@streamr/cli-tools 6.0.0-alpha.3 → 6.0.0-beta.1
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 +36 -5
- package/bin/streamr-stream-publish.ts +5 -5
- package/bin/streamr-stream-search.ts +46 -9
- package/bin/streamr-wallet-whoami.ts +10 -0
- package/bin/streamr-wallet.ts +10 -0
- package/bin/streamr.ts +1 -0
- package/dist/bin/streamr-stream-publish.js +5 -5
- package/dist/bin/streamr-stream-publish.js.map +1 -1
- package/dist/bin/streamr-stream-search.js +32 -11
- package/dist/bin/streamr-stream-search.js.map +1 -1
- package/dist/bin/streamr-wallet-whoami.d.ts +2 -0
- package/dist/bin/streamr-wallet-whoami.js +11 -0
- package/dist/bin/streamr-wallet-whoami.js.map +1 -0
- package/dist/bin/streamr-wallet.d.ts +2 -0
- package/dist/bin/streamr-wallet.js +15 -0
- package/dist/bin/streamr-wallet.js.map +1 -0
- package/dist/bin/streamr-whoami.d.ts +2 -0
- package/dist/bin/streamr-whoami.js +11 -0
- package/dist/bin/streamr-whoami.js.map +1 -0
- package/dist/bin/streamr.js +1 -0
- package/dist/bin/streamr.js.map +1 -1
- package/dist/package.json +3 -4
- package/dist/src/common.d.ts +5 -0
- package/dist/src/common.js +18 -1
- package/dist/src/common.js.map +1 -1
- package/dist/src/permission.d.ts +1 -0
- package/dist/src/permission.js +9 -1
- package/dist/src/permission.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/src/common.ts +15 -0
- package/src/permission.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamr/cli-tools",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-beta.1",
|
|
4
4
|
"description": "Command line tools for Streamr.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"streamr": "dist/bin/streamr.js"
|
|
@@ -33,15 +33,14 @@
|
|
|
33
33
|
"easy-table": "^1.1.1",
|
|
34
34
|
"event-stream": "^4.0.1",
|
|
35
35
|
"lodash": "^4.17.21",
|
|
36
|
-
"streamr-client": "^6.0.0-
|
|
37
|
-
"streamr-client-protocol": "^
|
|
36
|
+
"streamr-client": "^6.0.0-beta.1",
|
|
37
|
+
"streamr-client-protocol": "^12.0.0",
|
|
38
38
|
"streamr-test-utils": "^2.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@streamr/dev-config": "^1.0.0",
|
|
42
42
|
"@types/easy-table": "0.0.32",
|
|
43
43
|
"@types/event-stream": "^3.3.34",
|
|
44
|
-
"@types/jest": "^27.0.2",
|
|
45
44
|
"@types/lodash": "^4.14.175",
|
|
46
45
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
47
46
|
"@typescript-eslint/parser": "^5.0.0",
|
package/src/common.ts
CHANGED
|
@@ -4,6 +4,21 @@ export interface GlobalCommandLineArgs {
|
|
|
4
4
|
privateKey?: string
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
export enum OptionType {
|
|
8
|
+
FLAG, // e.g. "--enable"
|
|
9
|
+
ARGUMENT // e.g. "--private-key 0x1234"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const getOptionType = (value: string | boolean): OptionType | never => {
|
|
13
|
+
if (typeof value === 'boolean') {
|
|
14
|
+
return OptionType.FLAG
|
|
15
|
+
} else if (typeof value === 'string') {
|
|
16
|
+
return OptionType.ARGUMENT
|
|
17
|
+
} else {
|
|
18
|
+
throw new Error(`unknown option type (value: ${value})`)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
7
22
|
export function createFnParseInt(name: string): (s: string) => number {
|
|
8
23
|
return (str: string) => {
|
|
9
24
|
const n = parseInt(str, 10)
|
package/src/permission.ts
CHANGED
|
@@ -20,6 +20,14 @@ export const PERMISSIONS = new Map<string,StreamPermission>([
|
|
|
20
20
|
['grant', StreamPermission.GRANT]
|
|
21
21
|
])
|
|
22
22
|
|
|
23
|
+
export const getPermission = (id: string): StreamPermission | never => {
|
|
24
|
+
const result = PERMISSIONS.get(id)
|
|
25
|
+
if (result === undefined) {
|
|
26
|
+
throw new Error(`unknown permission: ${id}`)
|
|
27
|
+
}
|
|
28
|
+
return result
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
export const getPermissionId = (permission: StreamPermission): string => {
|
|
24
32
|
return Array.from(PERMISSIONS.entries()).find(([_id, p]) => p === permission)![0]
|
|
25
33
|
}
|