Coder Social home page Coder Social logo

streamr-dev / cli-tools Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 340 KB

Command line tool for interacting with Streamr

Home Page: https://streamr.network

License: GNU Affero General Public License v3.0

JavaScript 69.57% TypeScript 30.43%
cli stdin stdout streamr

cli-tools's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

timoxley

cli-tools's Issues

Use subcommand model?

Like in npm or git we have

git status
git ci
git push

We could have, e.g.,

streamr publish
streamr subscribe
streamr create-stream
streamr get-stream

Crashes on echo example

Crashes on

echo '{"message": "test"}' | publish-to-stream-dev c4iXIHoVSHGadSDBvsLWsw tester1-api-key

because it interprets echo's last new line as unparseable JSON.

Needs something of the likes of

if (!data.trim()) {
  return done()
}

Found by @timoxley

Resend request support

Add new command for requesting a resend. Pipes messages line-by-line to stdout until resend is completed or there is no resend.

Usage: streamr-resend <streamId> [apiKey]

request resend of stream, prints JSON messages to stdout line-by-line

Options:
  --last <n>           request last N messages
  --from <fromTs>      request messages starting from given unix epoch
  --to <toTs>          request messages until given unix epoch

  -V, --version        output the version number
  --dev                use pre-defined development environment
  --stg                use pre-defined staging environment
  --wsUrl <wsUrl>      alternative websocket url to use
  --httpUrl <httpUrl>  alternative http url to use
  -h, --help           output usage information

interactive session mode

Implement an interactive session mode, where you can send commands to the broker as you wish, and see the (raw) responses of the broker as well.

Tests

  1. Think about testing strategy. Maybe it could be more integration-test based since this is a thin wrapper.
  2. Implement some basic tests

CSV <-> JSON tools

  • Ability to take in lines of CSV that get converted to JSON and then published to stream.
  • Ability to subscribe to stream, get JSON rows converted to CSV.
  • How to handle hierarchical data? Just leave out for now?

Validate user integer inputs

If a command-line argument or option requires an integer and user provides something else, quit program with a user-friendly error message instead of trying to push to server.

Cannot authenticate via Stream API keys

Steps to reproduce

  1. Create a new stream
  2. Create a (stream-specific) API key for the stream with WRITE permission
  3. Do streamr listen streamId streamApiKey or streamr publish streamId streamApiKey

Expected Behavior

Will listen or publish to stream

Actual behavior

Program exits with error

   Response {
     size: 0,
     timeout: 0,
     [Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
     [Symbol(Response internals)]:
      { url: 'https://www.streamr.com/api/v1/users/me',
        status: 401,
        statusText: 'Unauthorized',
        headers: [Headers],
        counter: 0 } },
  body:
   '{"code":"NOT_AUTHENTICATED","message":"Not authenticated via token or cookie"}' }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.