@streamr/cli-tools 5.0.1 → 6.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +21 -6
- package/bin/common.ts +23 -22
- package/bin/streamr-storage-node-add-stream.ts +3 -1
- package/bin/streamr-storage-node-list-stream-parts.ts +5 -5
- package/bin/streamr-storage-node-list.ts +8 -3
- package/bin/streamr-storage-node-remove-stream.ts +3 -1
- package/bin/streamr-stream-create.ts +3 -3
- package/bin/streamr-stream-grant-permission.ts +4 -2
- package/bin/streamr-stream-publish.ts +3 -2
- package/bin/streamr-stream-resend.ts +7 -4
- package/bin/streamr-stream-revoke-permission.ts +4 -2
- package/bin/streamr-stream-show.ts +3 -2
- package/bin/streamr-stream-subscribe.ts +3 -2
- package/dist/bin/common.d.ts +2 -3
- package/dist/bin/common.js +26 -23
- package/dist/bin/common.js.map +1 -1
- package/dist/bin/streamr-misc-get-session-token.js +4 -4
- package/dist/bin/streamr-misc-get-session-token.js.map +1 -1
- package/dist/bin/streamr-mock-data-generate.js +3 -3
- package/dist/bin/streamr-mock-data-generate.js.map +1 -1
- package/dist/bin/streamr-storage-node-add-stream.js +6 -5
- package/dist/bin/streamr-storage-node-add-stream.js.map +1 -1
- package/dist/bin/streamr-storage-node-list-stream-parts.js +7 -7
- package/dist/bin/streamr-storage-node-list-stream-parts.js.map +1 -1
- package/dist/bin/streamr-storage-node-list.js +9 -7
- package/dist/bin/streamr-storage-node-list.js.map +1 -1
- package/dist/bin/streamr-storage-node-remove-stream.js +6 -5
- package/dist/bin/streamr-storage-node-remove-stream.js.map +1 -1
- package/dist/bin/streamr-stream-create.js +8 -8
- package/dist/bin/streamr-stream-create.js.map +1 -1
- package/dist/bin/streamr-stream-grant-permission.js +5 -4
- package/dist/bin/streamr-stream-grant-permission.js.map +1 -1
- package/dist/bin/streamr-stream-list.js +4 -4
- package/dist/bin/streamr-stream-list.js.map +1 -1
- package/dist/bin/streamr-stream-publish.js +6 -5
- package/dist/bin/streamr-stream-publish.js.map +1 -1
- package/dist/bin/streamr-stream-resend.js +15 -12
- package/dist/bin/streamr-stream-resend.js.map +1 -1
- package/dist/bin/streamr-stream-revoke-permission.js +6 -5
- package/dist/bin/streamr-stream-revoke-permission.js.map +1 -1
- package/dist/bin/streamr-stream-show.js +6 -5
- package/dist/bin/streamr-stream-show.js.map +1 -1
- package/dist/bin/streamr-stream-subscribe.js +7 -6
- package/dist/bin/streamr-stream-subscribe.js.map +1 -1
- package/dist/bin/streamr.js +0 -0
- package/dist/package.json +11 -9
- package/dist/src/create.d.ts +1 -1
- package/dist/src/create.js +3 -2
- package/dist/src/create.js.map +1 -1
- package/dist/src/publish.js +2 -3
- package/dist/src/publish.js.map +1 -1
- package/dist/src/resend.js +2 -17
- package/dist/src/resend.js.map +1 -1
- package/dist/src/show.js +1 -1
- package/dist/src/show.js.map +1 -1
- package/dist/src/subscribe.d.ts +1 -1
- package/dist/src/subscribe.js +3 -3
- package/dist/src/subscribe.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -8525
- package/package.json +11 -9
- package/src/create.ts +5 -2
- package/src/publish.ts +2 -3
- package/src/resend.ts +2 -20
- package/src/show.ts +1 -1
- package/src/subscribe.ts +3 -3
- package/dist/commands/common.js +0 -76
- package/dist/commands/streamor.js +0 -16
- package/dist/commands/streamr-mock-data-generate.js +0 -20
- package/dist/commands/streamr-mock-data.js +0 -14
- package/dist/commands/streamr-storage-node-add-stream.js +0 -24
- package/dist/commands/streamr-storage-node-list-stream-parts.js +0 -32
- package/dist/commands/streamr-storage-node-list.js +0 -44
- package/dist/commands/streamr-storage-node-remove-stream.js +0 -24
- package/dist/commands/streamr-storage-node.js +0 -17
- package/dist/commands/streamr-stream-create.js +0 -31
- package/dist/commands/streamr-stream-grant-permission.js +0 -62
- package/dist/commands/streamr-stream-list.js +0 -33
- package/dist/commands/streamr-stream-publish.js +0 -32
- package/dist/commands/streamr-stream-resend.js +0 -101
- package/dist/commands/streamr-stream-revoke-permission.js +0 -24
- package/dist/commands/streamr-stream-show.js +0 -23
- package/dist/commands/streamr-stream-subscribe.js +0 -25
- package/dist/commands/streamr-stream.js +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
- Add permission commands: `stream grant-permission` and `stream revoke-permission`
|
|
9
9
|
- Remove `typescript` and `ts-node` as run-time dependencies
|
|
10
10
|
- Remove `--msg-chain-id` parameter from `stream resend from`
|
|
11
|
+
- (Breaking) `streamr stream create` argument is a stream ID, not a name
|
|
12
|
+
- Support path notation when defining a stream ID
|
|
11
13
|
|
|
12
14
|
## [5.0.0] - 2021-05-05
|
|
13
15
|
### Added
|
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://streamr.network">
|
|
3
|
+
<img alt="Streamr" src="https://raw.githubusercontent.com/streamr-dev/network-monorepo/main/packages/client/readme-header-img.png" width="1320" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
1
7
|
# @streamr/cli-tools
|
|
2
8
|
|
|
3
9
|
Command line tool for interacting with [Streamr](https://streamr.network).
|
|
@@ -28,12 +34,14 @@ To get a list of all commands simply run `streamr`. To list subcommands run e.g.
|
|
|
28
34
|
|
|
29
35
|
Run `streamr <command> <subcommand> --help` to get more information about a a command, its options, and so forth.
|
|
30
36
|
|
|
37
|
+
If there is a stream parameter in a command, it can be defined as a full id (e.g. `0x1234567890123456789012345678901234567890/foo/bar`) or a path (e.g. `/foo/bar`). If path notation is used, the stream ID is made by prefixing the authenticated Ethereum address (`--private-key <key>`) to the path.
|
|
38
|
+
|
|
31
39
|
### subscribe
|
|
32
40
|
Used to subscribe to a stream and output real-time JSON objects to stdout line-by-line.
|
|
33
41
|
|
|
34
42
|
For example, to subscribe to a public stream such as the tram demo do
|
|
35
43
|
```
|
|
36
|
-
streamr stream subscribe
|
|
44
|
+
streamr stream subscribe streamr.eth/demos/helsinki-trams
|
|
37
45
|
```
|
|
38
46
|
|
|
39
47
|
To subscribe to a private stream and authenticate with an Ethereum private key:
|
|
@@ -79,15 +87,22 @@ streamr stream show <streamId> --private-key <key>
|
|
|
79
87
|
### create
|
|
80
88
|
Create a new stream
|
|
81
89
|
```
|
|
82
|
-
streamr stream create <
|
|
90
|
+
streamr stream create <streamId> --private-key <key>
|
|
91
|
+
```
|
|
92
|
+
E.g.
|
|
83
93
|
```
|
|
94
|
+
streamr stream create /foo/bar
|
|
95
|
+
streamr stream create 0x1234567890123456789012345678901234567890/foobar
|
|
96
|
+
streamr stream create yourdomain.ens/foobar
|
|
97
|
+
```
|
|
98
|
+
|
|
84
99
|
|
|
85
100
|
### resend
|
|
86
101
|
Request a resend of historical data printed as JSON objects to stdout line-by-line.
|
|
87
102
|
|
|
88
103
|
For example, to fetch the 10 latest messages of a public stream such as the tram demo do
|
|
89
104
|
```
|
|
90
|
-
streamr stream resend last 10
|
|
105
|
+
streamr stream resend last 10 streamr.eth/demos/helsinki-trams
|
|
91
106
|
```
|
|
92
107
|
|
|
93
108
|
|
|
@@ -114,7 +129,7 @@ You can pipe the line-by-line JSON objects output by `subscribe` to
|
|
|
114
129
|
your program written in any language. Just make the program read JSON objects
|
|
115
130
|
from stdin.
|
|
116
131
|
```
|
|
117
|
-
streamr stream subscribe
|
|
132
|
+
streamr stream subscribe streamr.eth/demos/helsinki-trams | ruby calculate-average-speed.rb
|
|
118
133
|
```
|
|
119
134
|
|
|
120
135
|
#### Publishing to a stream from any programming language
|
|
@@ -139,12 +154,12 @@ If you have a working stream in production that you'd also like to use in your
|
|
|
139
154
|
development environment, you can combine the `subscribe` and `publish` commands to effectively copy
|
|
140
155
|
the real-time events.
|
|
141
156
|
```
|
|
142
|
-
streamr stream subscribe
|
|
157
|
+
streamr stream subscribe streamr.eth/demos/helsinki-trams | streamr stream publish --dev <streamId> --private-key <key>
|
|
143
158
|
```
|
|
144
159
|
|
|
145
160
|
And the same for staging environment:
|
|
146
161
|
```
|
|
147
|
-
streamr stream subscribe
|
|
162
|
+
streamr stream subscribe streamr.eth/demos/helsinki-trams | streamr stream publish --stg <streamId> --private-key <key>
|
|
148
163
|
```
|
|
149
164
|
|
|
150
165
|
## Develop
|
package/bin/common.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import * as commander from 'commander'
|
|
2
|
+
import { Wallet } from 'ethers'
|
|
2
3
|
import { StreamrClientOptions } from 'streamr-client'
|
|
3
4
|
|
|
4
5
|
export interface EnvironmentOptions {
|
|
5
6
|
dev?: boolean
|
|
6
7
|
stg?: boolean
|
|
7
|
-
|
|
8
|
-
httpUrl?: string
|
|
8
|
+
httpUrl?: string
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface AuthenticationOptions {
|
|
12
12
|
privateKey?: string
|
|
13
|
-
apiKey?: string
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export function envOptions(program: commander.Command): commander.Command {
|
|
@@ -24,7 +23,6 @@ export function envOptions(program: commander.Command): commander.Command {
|
|
|
24
23
|
export function authOptions(program: commander.Command): commander.Command {
|
|
25
24
|
return program
|
|
26
25
|
.option('--private-key <key>', 'use an Ethereum private key to authenticate')
|
|
27
|
-
.option('--api-key <key>', 'use an API key to authenticate (deprecated)')
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
export function exitWithHelpIfArgsNotBetween(program: commander.Command, min: number, max: number): void {
|
|
@@ -34,7 +32,7 @@ export function exitWithHelpIfArgsNotBetween(program: commander.Command, min: nu
|
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
export function formStreamrOptionsWithEnv(
|
|
37
|
-
{ dev, stg,
|
|
35
|
+
{ dev, stg, httpUrl, privateKey }: EnvironmentOptions & AuthenticationOptions
|
|
38
36
|
): StreamrClientOptions {
|
|
39
37
|
const options: StreamrClientOptions = {}
|
|
40
38
|
|
|
@@ -44,38 +42,24 @@ export function formStreamrOptionsWithEnv(
|
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
if (dev) {
|
|
47
|
-
options.url = 'ws://localhost/api/v1/ws'
|
|
48
45
|
options.restUrl = 'http://localhost/api/v1'
|
|
49
|
-
options.
|
|
46
|
+
options.storageNodeRegistry = [{
|
|
50
47
|
// "broker-node-storage-1" on Docker environment
|
|
51
48
|
address: '0xde1112f631486CfC759A50196853011528bC5FA0',
|
|
52
49
|
url: 'http://10.200.10.1:8891'
|
|
53
|
-
}
|
|
50
|
+
}]
|
|
54
51
|
} else if (stg) {
|
|
55
|
-
options.url = 'wss://staging.streamr.com/api/v1/ws'
|
|
56
52
|
options.restUrl = 'https://staging.streamr.com/api/v1/'
|
|
57
53
|
}
|
|
58
54
|
|
|
59
|
-
if (wsUrl) {
|
|
60
|
-
options.url = wsUrl
|
|
61
|
-
}
|
|
62
55
|
if (httpUrl) {
|
|
63
56
|
options.restUrl = httpUrl
|
|
64
57
|
}
|
|
65
58
|
|
|
66
|
-
if (privateKey && apiKey) {
|
|
67
|
-
console.error('flags --privateKey and --apiKey cannot be used at the same time')
|
|
68
|
-
process.exit(1)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
59
|
if (privateKey) {
|
|
72
60
|
options.auth = {
|
|
73
61
|
privateKey
|
|
74
62
|
}
|
|
75
|
-
} else if (apiKey) {
|
|
76
|
-
options.auth = {
|
|
77
|
-
apiKey
|
|
78
|
-
}
|
|
79
63
|
}
|
|
80
64
|
|
|
81
65
|
return options
|
|
@@ -90,4 +74,21 @@ export function createFnParseInt(name: string): (s: string) => number {
|
|
|
90
74
|
}
|
|
91
75
|
return n
|
|
92
76
|
}
|
|
93
|
-
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
80
|
+
export const getStreamId = (streamIdOrPath: string|undefined, options: any): string|undefined => {
|
|
81
|
+
if (streamIdOrPath === undefined) {
|
|
82
|
+
return undefined
|
|
83
|
+
}
|
|
84
|
+
const PATH_PREFIX = '/'
|
|
85
|
+
if (!streamIdOrPath.startsWith(PATH_PREFIX)) {
|
|
86
|
+
return streamIdOrPath
|
|
87
|
+
}
|
|
88
|
+
const privateKey = options.privateKey
|
|
89
|
+
if (privateKey === undefined) {
|
|
90
|
+
console.error(`relative stream id ${streamIdOrPath} requires authentication`)
|
|
91
|
+
process.exit(1)
|
|
92
|
+
}
|
|
93
|
+
return new Wallet(privateKey).address.toLowerCase() + streamIdOrPath
|
|
94
|
+
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
authOptions,
|
|
7
7
|
exitWithHelpIfArgsNotBetween,
|
|
8
8
|
formStreamrOptionsWithEnv,
|
|
9
|
+
getStreamId,
|
|
9
10
|
} from './common'
|
|
10
11
|
import pkg from '../package.json'
|
|
11
12
|
|
|
@@ -16,8 +17,9 @@ program
|
|
|
16
17
|
authOptions(program)
|
|
17
18
|
envOptions(program)
|
|
18
19
|
.version(pkg.version)
|
|
19
|
-
.action((storageNodeAddress: string,
|
|
20
|
+
.action((storageNodeAddress: string, streamIdOrPath: string, options: any) => {
|
|
20
21
|
const client = new StreamrClient(formStreamrOptionsWithEnv(options))
|
|
22
|
+
const streamId = getStreamId(streamIdOrPath, options)!
|
|
21
23
|
client.getStream(streamId)
|
|
22
24
|
.then((stream: Stream) => stream.addToStorageNode(storageNodeAddress))
|
|
23
25
|
.catch((err) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander'
|
|
3
|
-
import { StreamrClient
|
|
3
|
+
import { StreamrClient } from 'streamr-client'
|
|
4
4
|
import {
|
|
5
5
|
envOptions,
|
|
6
6
|
authOptions,
|
|
@@ -20,11 +20,11 @@ envOptions(program)
|
|
|
20
20
|
.action((storageNodeAddress: string, options: any) => {
|
|
21
21
|
const client = new StreamrClient(formStreamrOptionsWithEnv(options))
|
|
22
22
|
client.getStreamPartsByStorageNode(storageNodeAddress)
|
|
23
|
-
.then((streamParts
|
|
23
|
+
.then((streamParts) => {
|
|
24
24
|
if (streamParts.length > 0) {
|
|
25
|
-
console.info(EasyTable.print(streamParts.map((
|
|
26
|
-
streamId
|
|
27
|
-
streamPartition
|
|
25
|
+
console.info(EasyTable.print(streamParts.map(({ streamId, streamPartition }) => ({
|
|
26
|
+
streamId,
|
|
27
|
+
streamPartition,
|
|
28
28
|
}))))
|
|
29
29
|
}
|
|
30
30
|
return true
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
authOptions,
|
|
7
7
|
exitWithHelpIfArgsNotBetween,
|
|
8
8
|
formStreamrOptionsWithEnv,
|
|
9
|
+
getStreamId,
|
|
9
10
|
} from './common'
|
|
10
11
|
import pkg from '../package.json'
|
|
11
12
|
import EasyTable from 'easy-table'
|
|
@@ -14,10 +15,11 @@ const getStorageNodes = async (streamId: string | undefined, client: StreamrClie
|
|
|
14
15
|
if (streamId !== undefined) {
|
|
15
16
|
const stream = await client.getStream(streamId)
|
|
16
17
|
const storageNodes = await stream.getStorageNodes()
|
|
17
|
-
return storageNodes.map((storageNode) => storageNode.
|
|
18
|
+
return storageNodes.map((storageNode) => storageNode.address)
|
|
18
19
|
} else {
|
|
19
20
|
// all storage nodes (currently there is only one)
|
|
20
|
-
|
|
21
|
+
const nodes = await client.getNodes()
|
|
22
|
+
return nodes.map((n) => n.address)
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -25,12 +27,15 @@ const program = new Command()
|
|
|
25
27
|
program
|
|
26
28
|
.description('fetch a list of storage nodes')
|
|
27
29
|
.option('-s, --stream <streamId>', 'only storage nodes which store the given stream (needs authentication)')
|
|
30
|
+
|
|
28
31
|
authOptions(program)
|
|
32
|
+
|
|
29
33
|
envOptions(program)
|
|
30
34
|
.version(pkg.version)
|
|
31
35
|
.action((options: any) => {
|
|
32
36
|
const client = new StreamrClient(formStreamrOptionsWithEnv(options))
|
|
33
|
-
|
|
37
|
+
const streamId = getStreamId(options.stream, options)
|
|
38
|
+
getStorageNodes(streamId, client).then((addresses: string[]) => {
|
|
34
39
|
if (addresses.length > 0) {
|
|
35
40
|
console.info(EasyTable.print(addresses.map((address: string) => ({
|
|
36
41
|
address
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
authOptions,
|
|
7
7
|
exitWithHelpIfArgsNotBetween,
|
|
8
8
|
formStreamrOptionsWithEnv,
|
|
9
|
+
getStreamId,
|
|
9
10
|
} from './common'
|
|
10
11
|
import pkg from '../package.json'
|
|
11
12
|
|
|
@@ -16,8 +17,9 @@ program
|
|
|
16
17
|
authOptions(program)
|
|
17
18
|
envOptions(program)
|
|
18
19
|
.version(pkg.version)
|
|
19
|
-
.action((storageNodeAddress: string,
|
|
20
|
+
.action((storageNodeAddress: string, streamIdOrPath: string, options: any) => {
|
|
20
21
|
const client = new StreamrClient(formStreamrOptionsWithEnv(options))
|
|
22
|
+
const streamId = getStreamId(streamIdOrPath, options)!
|
|
21
23
|
client.getStream(streamId)
|
|
22
24
|
.then((stream: Stream) => stream.removeFromStorageNode(storageNodeAddress))
|
|
23
25
|
.catch((err) => {
|
|
@@ -12,7 +12,7 @@ import pkg from '../package.json'
|
|
|
12
12
|
|
|
13
13
|
const program = new Command()
|
|
14
14
|
program
|
|
15
|
-
.arguments('<
|
|
15
|
+
.arguments('<streamId>')
|
|
16
16
|
.description('create a new stream')
|
|
17
17
|
.option('-d, --description <description>', 'define a description')
|
|
18
18
|
.option('-c, --config <config>', 'define a configuration as JSON', (s: string) => JSON.parse(s))
|
|
@@ -21,9 +21,9 @@ program
|
|
|
21
21
|
authOptions(program)
|
|
22
22
|
envOptions(program)
|
|
23
23
|
.version(pkg.version)
|
|
24
|
-
.action((
|
|
24
|
+
.action((streamIdOrPath: string, options: any) => {
|
|
25
25
|
const body: any = {
|
|
26
|
-
|
|
26
|
+
id: streamIdOrPath,
|
|
27
27
|
description: options.description,
|
|
28
28
|
config: options.config,
|
|
29
29
|
partitions: options.partitions
|
|
@@ -3,7 +3,8 @@ import { Command } from 'commander'
|
|
|
3
3
|
import {
|
|
4
4
|
envOptions,
|
|
5
5
|
authOptions,
|
|
6
|
-
formStreamrOptionsWithEnv
|
|
6
|
+
formStreamrOptionsWithEnv,
|
|
7
|
+
getStreamId
|
|
7
8
|
} from './common'
|
|
8
9
|
import pkg from '../package.json'
|
|
9
10
|
import { AnonymousStreamPermisson, StreamOperation, StreamrClient, UserStreamPermission } from 'streamr-client'
|
|
@@ -47,10 +48,11 @@ program
|
|
|
47
48
|
authOptions(program)
|
|
48
49
|
envOptions(program)
|
|
49
50
|
.version(pkg.version)
|
|
50
|
-
.action(async (
|
|
51
|
+
.action(async (streamIdOrPath: string, user: string, operationIds: string[], options: any) => {
|
|
51
52
|
const operations = operationIds.map((o: string) => getOperation(o))
|
|
52
53
|
const target = getTarget(user)
|
|
53
54
|
const client = new StreamrClient(formStreamrOptionsWithEnv(options))
|
|
55
|
+
const streamId = getStreamId(streamIdOrPath, options)!
|
|
54
56
|
const stream = await client.getStream(streamId)
|
|
55
57
|
const tasks = operations.map((operation: StreamOperation) => stream.grantPermission(operation, target))
|
|
56
58
|
const permissions = await Promise.all(tasks)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Command } from 'commander'
|
|
3
3
|
import es from 'event-stream'
|
|
4
4
|
import { publishStream } from '../src/publish'
|
|
5
|
-
import { envOptions, authOptions, exitWithHelpIfArgsNotBetween, formStreamrOptionsWithEnv } from './common'
|
|
5
|
+
import { envOptions, authOptions, exitWithHelpIfArgsNotBetween, formStreamrOptionsWithEnv, getStreamId } from './common'
|
|
6
6
|
import pkg from '../package.json'
|
|
7
7
|
|
|
8
8
|
const program = new Command()
|
|
@@ -13,7 +13,8 @@ program
|
|
|
13
13
|
authOptions(program)
|
|
14
14
|
envOptions(program)
|
|
15
15
|
.version(pkg.version)
|
|
16
|
-
.action((
|
|
16
|
+
.action((streamIdOrPath: string, options: any) => {
|
|
17
|
+
const streamId = getStreamId(streamIdOrPath, options)!
|
|
17
18
|
const ps = publishStream(streamId, options.partitionKey, formStreamrOptionsWithEnv(options))
|
|
18
19
|
process.stdin
|
|
19
20
|
.pipe(es.split())
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Command } from 'commander'
|
|
3
3
|
import { StreamrClientOptions } from 'streamr-client'
|
|
4
4
|
import { resend } from '../src/resend'
|
|
5
|
-
import { envOptions, authOptions, exitWithHelpIfArgsNotBetween, formStreamrOptionsWithEnv } from './common'
|
|
5
|
+
import { envOptions, authOptions, exitWithHelpIfArgsNotBetween, formStreamrOptionsWithEnv, getStreamId } from './common'
|
|
6
6
|
import pkg from '../package.json'
|
|
7
7
|
|
|
8
8
|
function assertBothOrNoneDefined(option1: string, option2: string, errorMessage: string, commandOptions: any) {
|
|
@@ -23,7 +23,7 @@ program
|
|
|
23
23
|
.description('request last N messages')
|
|
24
24
|
.option('-d, --disable-ordering', 'disable ordering of messages by OrderingUtil', false)
|
|
25
25
|
.option('-s, --subscribe', 'subscribe in addition to resend', false)
|
|
26
|
-
.action((n: string,
|
|
26
|
+
.action((n: string, streamIdOrPath: string, options: any, command: Command) => {
|
|
27
27
|
if (isNaN(n as any)) {
|
|
28
28
|
console.error('argument n is not a number')
|
|
29
29
|
process.exit(1)
|
|
@@ -34,6 +34,7 @@ program
|
|
|
34
34
|
const clientOptions: StreamrClientOptions & { subscribe?: boolean } = formStreamrOptionsWithEnv(command.parent!.opts())
|
|
35
35
|
clientOptions.orderMessages = !options.disableOrdering
|
|
36
36
|
clientOptions.subscribe = options.subscribe
|
|
37
|
+
const streamId = getStreamId(streamIdOrPath, command.parent!.opts())!
|
|
37
38
|
resend(streamId, resendOptions, clientOptions)
|
|
38
39
|
})
|
|
39
40
|
|
|
@@ -43,7 +44,7 @@ program
|
|
|
43
44
|
.option('--publisher-id <string>', 'filter results by publisher')
|
|
44
45
|
.option('-d, --disable-ordering', 'disable ordering of messages by OrderingUtil', false)
|
|
45
46
|
.option('-s, --subscribe', 'subscribe in addition to resend', false)
|
|
46
|
-
.action((from: string,
|
|
47
|
+
.action((from: string, streamIdOrPath: string, options: any, command: Command) => {
|
|
47
48
|
const resendOptions = {
|
|
48
49
|
from: {
|
|
49
50
|
timestamp: Date.parse(from),
|
|
@@ -54,6 +55,7 @@ program
|
|
|
54
55
|
const clientOptions: StreamrClientOptions & { subscribe?: boolean } = formStreamrOptionsWithEnv(command.parent!.opts())
|
|
55
56
|
clientOptions.orderMessages = !options.disableOrdering
|
|
56
57
|
clientOptions.subscribe = options.subscribe
|
|
58
|
+
const streamId = getStreamId(streamIdOrPath, command.parent!.opts())!
|
|
57
59
|
resend(streamId, resendOptions, clientOptions)
|
|
58
60
|
})
|
|
59
61
|
|
|
@@ -63,7 +65,7 @@ program
|
|
|
63
65
|
.option('--publisher-id <string>', 'filter results by publisher')
|
|
64
66
|
.option('--msg-chain-id <string>', 'filter results by message chain')
|
|
65
67
|
.option('-d, --disable-ordering', 'disable ordering of messages by OrderingUtil', false)
|
|
66
|
-
.action((from: string, to: string,
|
|
68
|
+
.action((from: string, to: string, streamIdOrPath: string, options: any, command: Command) => {
|
|
67
69
|
const resendOptions = {
|
|
68
70
|
from: {
|
|
69
71
|
timestamp: Date.parse(from),
|
|
@@ -79,6 +81,7 @@ program
|
|
|
79
81
|
assertBothOrNoneDefined('publisherId', 'msgChainId', '--publisher-id must be accompanied by option --msg-chain-id', options)
|
|
80
82
|
const clientOptions = formStreamrOptionsWithEnv(command.parent!.opts())
|
|
81
83
|
clientOptions.orderMessages = !options.disableOrdering
|
|
84
|
+
const streamId = getStreamId(streamIdOrPath, command.parent!.opts())!
|
|
82
85
|
resend(streamId, resendOptions, clientOptions)
|
|
83
86
|
})
|
|
84
87
|
|
|
@@ -4,7 +4,8 @@ import {
|
|
|
4
4
|
envOptions,
|
|
5
5
|
authOptions,
|
|
6
6
|
exitWithHelpIfArgsNotBetween,
|
|
7
|
-
formStreamrOptionsWithEnv
|
|
7
|
+
formStreamrOptionsWithEnv,
|
|
8
|
+
getStreamId
|
|
8
9
|
} from './common'
|
|
9
10
|
import pkg from '../package.json'
|
|
10
11
|
import { StreamrClient } from 'streamr-client'
|
|
@@ -16,8 +17,9 @@ program
|
|
|
16
17
|
authOptions(program)
|
|
17
18
|
envOptions(program)
|
|
18
19
|
.version(pkg.version)
|
|
19
|
-
.action(async (
|
|
20
|
+
.action(async (streamIdOrPath: string, permissionId: number, options: any) => {
|
|
20
21
|
const client = new StreamrClient(formStreamrOptionsWithEnv(options))
|
|
22
|
+
const streamId = getStreamId(streamIdOrPath, options)!
|
|
21
23
|
const stream = await client.getStream(streamId)
|
|
22
24
|
stream.revokePermission(permissionId)
|
|
23
25
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander'
|
|
3
3
|
import { show } from '../src/show'
|
|
4
|
-
import { envOptions, authOptions, exitWithHelpIfArgsNotBetween, formStreamrOptionsWithEnv } from './common'
|
|
4
|
+
import { envOptions, authOptions, exitWithHelpIfArgsNotBetween, formStreamrOptionsWithEnv, getStreamId } from './common'
|
|
5
5
|
import pkg from '../package.json'
|
|
6
6
|
|
|
7
7
|
const program = new Command()
|
|
@@ -12,7 +12,8 @@ program
|
|
|
12
12
|
authOptions(program)
|
|
13
13
|
envOptions(program)
|
|
14
14
|
.version(pkg.version)
|
|
15
|
-
.action((
|
|
15
|
+
.action((streamIdOrPath: string, options: any) => {
|
|
16
|
+
const streamId = getStreamId(streamIdOrPath, options)!
|
|
16
17
|
show(streamId, options.includePermissions, formStreamrOptionsWithEnv(options))
|
|
17
18
|
})
|
|
18
19
|
.parse(process.argv)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander'
|
|
3
3
|
import { subscribe } from '../src/subscribe'
|
|
4
|
-
import { envOptions, authOptions, exitWithHelpIfArgsNotBetween, formStreamrOptionsWithEnv, createFnParseInt } from './common'
|
|
4
|
+
import { envOptions, authOptions, exitWithHelpIfArgsNotBetween, formStreamrOptionsWithEnv, createFnParseInt, getStreamId } from './common'
|
|
5
5
|
import pkg from '../package.json'
|
|
6
6
|
|
|
7
7
|
const program = new Command()
|
|
@@ -13,8 +13,9 @@ program
|
|
|
13
13
|
authOptions(program)
|
|
14
14
|
envOptions(program)
|
|
15
15
|
.version(pkg.version)
|
|
16
|
-
.action((
|
|
16
|
+
.action((streamIdOrPath: string, options: any) => {
|
|
17
17
|
options.orderMessages = !options.disableOrdering
|
|
18
|
+
const streamId = getStreamId(streamIdOrPath, options)!
|
|
18
19
|
subscribe(streamId, options.partition, formStreamrOptionsWithEnv(options))
|
|
19
20
|
})
|
|
20
21
|
.parse(process.argv)
|
package/dist/bin/common.d.ts
CHANGED
|
@@ -3,15 +3,14 @@ import { StreamrClientOptions } from 'streamr-client';
|
|
|
3
3
|
export interface EnvironmentOptions {
|
|
4
4
|
dev?: boolean;
|
|
5
5
|
stg?: boolean;
|
|
6
|
-
wsUrl?: string;
|
|
7
6
|
httpUrl?: string;
|
|
8
7
|
}
|
|
9
8
|
export interface AuthenticationOptions {
|
|
10
9
|
privateKey?: string;
|
|
11
|
-
apiKey?: string;
|
|
12
10
|
}
|
|
13
11
|
export declare function envOptions(program: commander.Command): commander.Command;
|
|
14
12
|
export declare function authOptions(program: commander.Command): commander.Command;
|
|
15
13
|
export declare function exitWithHelpIfArgsNotBetween(program: commander.Command, min: number, max: number): void;
|
|
16
|
-
export declare function formStreamrOptionsWithEnv({ dev, stg,
|
|
14
|
+
export declare function formStreamrOptionsWithEnv({ dev, stg, httpUrl, privateKey }: EnvironmentOptions & AuthenticationOptions): StreamrClientOptions;
|
|
17
15
|
export declare function createFnParseInt(name: string): (s: string) => number;
|
|
16
|
+
export declare const getStreamId: (streamIdOrPath: string | undefined, options: any) => string | undefined;
|
package/dist/bin/common.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createFnParseInt = exports.formStreamrOptionsWithEnv = exports.exitWithHelpIfArgsNotBetween = exports.authOptions = exports.envOptions = void 0;
|
|
3
|
+
exports.getStreamId = exports.createFnParseInt = exports.formStreamrOptionsWithEnv = exports.exitWithHelpIfArgsNotBetween = exports.authOptions = exports.envOptions = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
4
5
|
function envOptions(program) {
|
|
5
6
|
return program
|
|
6
7
|
.option('--dev', 'use pre-defined development environment')
|
|
@@ -11,8 +12,7 @@ function envOptions(program) {
|
|
|
11
12
|
exports.envOptions = envOptions;
|
|
12
13
|
function authOptions(program) {
|
|
13
14
|
return program
|
|
14
|
-
.option('--private-key <key>', 'use an Ethereum private key to authenticate')
|
|
15
|
-
.option('--api-key <key>', 'use an API key to authenticate (deprecated)');
|
|
15
|
+
.option('--private-key <key>', 'use an Ethereum private key to authenticate');
|
|
16
16
|
}
|
|
17
17
|
exports.authOptions = authOptions;
|
|
18
18
|
function exitWithHelpIfArgsNotBetween(program, min, max) {
|
|
@@ -21,45 +21,31 @@ function exitWithHelpIfArgsNotBetween(program, min, max) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
exports.exitWithHelpIfArgsNotBetween = exitWithHelpIfArgsNotBetween;
|
|
24
|
-
function formStreamrOptionsWithEnv({ dev, stg,
|
|
24
|
+
function formStreamrOptionsWithEnv({ dev, stg, httpUrl, privateKey }) {
|
|
25
25
|
const options = {};
|
|
26
26
|
if (dev && stg) {
|
|
27
27
|
console.error('flags --dev and --stg cannot be enabled at the same time');
|
|
28
28
|
process.exit(1);
|
|
29
29
|
}
|
|
30
30
|
if (dev) {
|
|
31
|
-
options.url = 'ws://localhost/api/v1/ws';
|
|
32
31
|
options.restUrl = 'http://localhost/api/v1';
|
|
33
|
-
options.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
options.storageNodeRegistry = [{
|
|
33
|
+
// "broker-node-storage-1" on Docker environment
|
|
34
|
+
address: '0xde1112f631486CfC759A50196853011528bC5FA0',
|
|
35
|
+
url: 'http://10.200.10.1:8891'
|
|
36
|
+
}];
|
|
38
37
|
}
|
|
39
38
|
else if (stg) {
|
|
40
|
-
options.url = 'wss://staging.streamr.com/api/v1/ws';
|
|
41
39
|
options.restUrl = 'https://staging.streamr.com/api/v1/';
|
|
42
40
|
}
|
|
43
|
-
if (wsUrl) {
|
|
44
|
-
options.url = wsUrl;
|
|
45
|
-
}
|
|
46
41
|
if (httpUrl) {
|
|
47
42
|
options.restUrl = httpUrl;
|
|
48
43
|
}
|
|
49
|
-
if (privateKey && apiKey) {
|
|
50
|
-
console.error('flags --privateKey and --apiKey cannot be used at the same time');
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
44
|
if (privateKey) {
|
|
54
45
|
options.auth = {
|
|
55
46
|
privateKey
|
|
56
47
|
};
|
|
57
48
|
}
|
|
58
|
-
else if (apiKey) {
|
|
59
|
-
options.auth = {
|
|
60
|
-
apiKey
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
49
|
return options;
|
|
64
50
|
}
|
|
65
51
|
exports.formStreamrOptionsWithEnv = formStreamrOptionsWithEnv;
|
|
@@ -74,4 +60,21 @@ function createFnParseInt(name) {
|
|
|
74
60
|
};
|
|
75
61
|
}
|
|
76
62
|
exports.createFnParseInt = createFnParseInt;
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
64
|
+
const getStreamId = (streamIdOrPath, options) => {
|
|
65
|
+
if (streamIdOrPath === undefined) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
const PATH_PREFIX = '/';
|
|
69
|
+
if (!streamIdOrPath.startsWith(PATH_PREFIX)) {
|
|
70
|
+
return streamIdOrPath;
|
|
71
|
+
}
|
|
72
|
+
const privateKey = options.privateKey;
|
|
73
|
+
if (privateKey === undefined) {
|
|
74
|
+
console.error(`relative stream id ${streamIdOrPath} requires authentication`);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
return new ethers_1.Wallet(privateKey).address.toLowerCase() + streamIdOrPath;
|
|
78
|
+
};
|
|
79
|
+
exports.getStreamId = getStreamId;
|
|
77
80
|
//# sourceMappingURL=common.js.map
|
package/dist/bin/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../bin/common.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../bin/common.ts"],"names":[],"mappings":"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"}
|
|
@@ -11,11 +11,11 @@ const package_json_1 = __importDefault(require("../package.json"));
|
|
|
11
11
|
const program = new commander_1.Command();
|
|
12
12
|
program
|
|
13
13
|
.description('get a session token for the current user');
|
|
14
|
-
common_1.authOptions(program);
|
|
15
|
-
common_1.envOptions(program)
|
|
14
|
+
(0, common_1.authOptions)(program);
|
|
15
|
+
(0, common_1.envOptions)(program)
|
|
16
16
|
.version(package_json_1.default.version)
|
|
17
17
|
.action(async (options) => {
|
|
18
|
-
const client = new streamr_client_1.StreamrClient(common_1.formStreamrOptionsWithEnv(options));
|
|
18
|
+
const client = new streamr_client_1.StreamrClient((0, common_1.formStreamrOptionsWithEnv)(options));
|
|
19
19
|
try {
|
|
20
20
|
console.info(await client.session.getSessionToken());
|
|
21
21
|
}
|
|
@@ -29,5 +29,5 @@ common_1.envOptions(program)
|
|
|
29
29
|
console.error(e);
|
|
30
30
|
process.exit(1);
|
|
31
31
|
});
|
|
32
|
-
common_1.exitWithHelpIfArgsNotBetween(program, 0, 0);
|
|
32
|
+
(0, common_1.exitWithHelpIfArgsNotBetween)(program, 0, 0);
|
|
33
33
|
//# sourceMappingURL=streamr-misc-get-session-token.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamr-misc-get-session-token.js","sourceRoot":"","sources":["../../bin/streamr-misc-get-session-token.ts"],"names":[],"mappings":";;;;;;AACA,yCAAmC;AACnC,mDAA8C;AAC9C,qCAKiB;AACjB,mEAAiC;AAEjC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;AAC7B,OAAO;KACF,WAAW,CAAC,0CAA0C,CAAC,CAAA;AAC5D,oBAAW,
|
|
1
|
+
{"version":3,"file":"streamr-misc-get-session-token.js","sourceRoot":"","sources":["../../bin/streamr-misc-get-session-token.ts"],"names":[],"mappings":";;;;;;AACA,yCAAmC;AACnC,mDAA8C;AAC9C,qCAKiB;AACjB,mEAAiC;AAEjC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;AAC7B,OAAO;KACF,WAAW,CAAC,0CAA0C,CAAC,CAAA;AAC5D,IAAA,oBAAW,EAAC,OAAO,CAAC,CAAA;AACpB,IAAA,mBAAU,EAAC,OAAO,CAAC;KACd,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC;KACpB,MAAM,CAAC,KAAK,EAAE,OAAY,EAAE,EAAE;IAC3B,MAAM,MAAM,GAAG,IAAI,8BAAa,CAAC,IAAA,kCAAyB,EAAC,OAAO,CAAC,CAAC,CAAA;IACpE,IAAI;QACA,OAAO,CAAC,IAAI,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAA;KACvD;IAAC,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAClB;AACL,CAAC,CAAC;KACD,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC;KACxB,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACT,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC,CAAC,CAAA;AAEN,IAAA,qCAA4B,EAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA"}
|
|
@@ -11,11 +11,11 @@ const package_json_1 = __importDefault(require("../package.json"));
|
|
|
11
11
|
const program = new commander_1.Command();
|
|
12
12
|
program
|
|
13
13
|
.description('generate and print semi-random JSON data to stdout')
|
|
14
|
-
.option('-r, --rate <n>', 'rate in milliseconds', common_1.createFnParseInt('--rate'), 500)
|
|
14
|
+
.option('-r, --rate <n>', 'rate in milliseconds', (0, common_1.createFnParseInt)('--rate'), 500)
|
|
15
15
|
.version(package_json_1.default.version)
|
|
16
16
|
.action((options) => {
|
|
17
|
-
generate_1.generate(options.rate);
|
|
17
|
+
(0, generate_1.generate)(options.rate);
|
|
18
18
|
})
|
|
19
19
|
.parse(process.argv);
|
|
20
|
-
common_1.exitWithHelpIfArgsNotBetween(program, 0, 0);
|
|
20
|
+
(0, common_1.exitWithHelpIfArgsNotBetween)(program, 0, 0);
|
|
21
21
|
//# sourceMappingURL=streamr-mock-data-generate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamr-mock-data-generate.js","sourceRoot":"","sources":["../../bin/streamr-mock-data-generate.ts"],"names":[],"mappings":";;;;;;AACA,yCAAmC;AACnC,8CAA0C;AAC1C,qCAAyE;AACzE,mEAAiC;AAEjC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;AAC7B,OAAO;KACF,WAAW,CAAC,oDAAoD,CAAC;KACjE,MAAM,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,yBAAgB,
|
|
1
|
+
{"version":3,"file":"streamr-mock-data-generate.js","sourceRoot":"","sources":["../../bin/streamr-mock-data-generate.ts"],"names":[],"mappings":";;;;;;AACA,yCAAmC;AACnC,8CAA0C;AAC1C,qCAAyE;AACzE,mEAAiC;AAEjC,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;AAC7B,OAAO;KACF,WAAW,CAAC,oDAAoD,CAAC;KACjE,MAAM,CAAC,gBAAgB,EAAE,sBAAsB,EAAE,IAAA,yBAAgB,EAAC,QAAQ,CAAC,EAAE,GAAG,CAAC;KACjF,OAAO,CAAC,sBAAG,CAAC,OAAO,CAAC;KACpB,MAAM,CAAC,CAAC,OAAY,EAAE,EAAE;IACrB,IAAA,mBAAQ,EAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAC,CAAC;KACD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;AAExB,IAAA,qCAA4B,EAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA"}
|