@interop/did-cli 0.6.0 → 0.8.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 +64 -1
- package/README.md +144 -6
- package/dist/commands/did.d.ts.map +1 -1
- package/dist/commands/did.js +41 -12
- package/dist/commands/did.js.map +1 -1
- package/dist/commands/key.d.ts.map +1 -1
- package/dist/commands/key.js +46 -8
- package/dist/commands/key.js.map +1 -1
- package/dist/commands/was/collection.d.ts +121 -0
- package/dist/commands/was/collection.d.ts.map +1 -0
- package/dist/commands/was/collection.js +316 -0
- package/dist/commands/was/collection.js.map +1 -0
- package/dist/commands/was/policy.d.ts +50 -0
- package/dist/commands/was/policy.d.ts.map +1 -0
- package/dist/commands/was/policy.js +133 -0
- package/dist/commands/was/policy.js.map +1 -0
- package/dist/commands/was/publish.d.ts +67 -0
- package/dist/commands/was/publish.d.ts.map +1 -0
- package/dist/commands/was/publish.js +151 -0
- package/dist/commands/was/publish.js.map +1 -0
- package/dist/commands/was/resource.d.ts +148 -0
- package/dist/commands/was/resource.d.ts.map +1 -0
- package/dist/commands/was/resource.js +402 -0
- package/dist/commands/was/resource.js.map +1 -0
- package/dist/commands/was/shared.d.ts +156 -0
- package/dist/commands/was/shared.d.ts.map +1 -0
- package/dist/commands/was/shared.js +237 -0
- package/dist/commands/was/shared.js.map +1 -0
- package/dist/commands/was/space.d.ts +196 -0
- package/dist/commands/was/space.d.ts.map +1 -0
- package/dist/commands/was/space.js +516 -0
- package/dist/commands/was/space.js.map +1 -0
- package/dist/commands/was/tree.d.ts +44 -0
- package/dist/commands/was/tree.d.ts.map +1 -0
- package/dist/commands/was/tree.js +135 -0
- package/dist/commands/was/tree.js.map +1 -0
- package/dist/commands/was.d.ts +29 -496
- package/dist/commands/was.d.ts.map +1 -1
- package/dist/commands/was.js +84 -1473
- package/dist/commands/was.js.map +1 -1
- package/dist/commands/zcap.d.ts +22 -2
- package/dist/commands/zcap.d.ts.map +1 -1
- package/dist/commands/zcap.js +6 -20
- package/dist/commands/zcap.js.map +1 -1
- package/dist/meta.js +1 -1
- package/dist/meta.js.map +1 -1
- package/dist/was/capability.d.ts +10 -13
- package/dist/was/capability.d.ts.map +1 -1
- package/dist/was/capability.js +1 -59
- package/dist/was/capability.js.map +1 -1
- package/dist/zcap/delegate.d.ts +2 -2
- package/dist/zcap/delegate.js +2 -2
- package/dist/zcap/resolve.d.ts +15 -0
- package/dist/zcap/resolve.d.ts.map +1 -0
- package/dist/zcap/resolve.js +55 -0
- package/dist/zcap/resolve.js.map +1 -0
- package/package.json +29 -16
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The depth-dispatching `was` shorthands `ls` and `rm`: they inspect the
|
|
3
|
+
* path (or a `--capability`'s invocation target) and delegate to the right
|
|
4
|
+
* space/collection/resource run function, mirroring the client's
|
|
5
|
+
* uniform-verbs-at-every-level design.
|
|
6
|
+
*/
|
|
7
|
+
import { parseWasAddress } from '../../was/address.js';
|
|
8
|
+
import { resolveCapabilityTarget } from '../../was/capability.js';
|
|
9
|
+
import { assertOneAddressing, printCollectionListing, printResourceListing, reportError } from './shared.js';
|
|
10
|
+
import { runCollectionDelete, runCollectionList } from './collection.js';
|
|
11
|
+
import { runResourceDelete, runResourceList } from './resource.js';
|
|
12
|
+
import { runSpaceDelete } from './space.js';
|
|
13
|
+
/**
|
|
14
|
+
* The `was ls` shorthand: lists the collections of a space or the resources
|
|
15
|
+
* of a collection, depending on the depth of the path (or of a
|
|
16
|
+
* `--capability`'s invocation target).
|
|
17
|
+
*
|
|
18
|
+
* @param options {object}
|
|
19
|
+
* @param [options.address] {string} A space or collection address.
|
|
20
|
+
* @param [options.capability] {string} A capability reference instead of
|
|
21
|
+
* a path.
|
|
22
|
+
* @param [options.json] {boolean} Output the raw listing JSON.
|
|
23
|
+
* @param [options.plain] {boolean} Output one id per line.
|
|
24
|
+
* @param [options.server] {string} The server base URL.
|
|
25
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
26
|
+
* @returns {Promise<number>} The process exit code.
|
|
27
|
+
*/
|
|
28
|
+
export async function runLs(options) {
|
|
29
|
+
if (options.capability) {
|
|
30
|
+
try {
|
|
31
|
+
assertOneAddressing(options);
|
|
32
|
+
const resolved = await resolveCapabilityTarget({
|
|
33
|
+
ref: options.capability,
|
|
34
|
+
did: options.did
|
|
35
|
+
});
|
|
36
|
+
if (resolved.depth === 'resource') {
|
|
37
|
+
throw new Error('the capability targets a resource; ' +
|
|
38
|
+
'ls takes a space or collection capability.');
|
|
39
|
+
}
|
|
40
|
+
if (resolved.depth === 'space') {
|
|
41
|
+
const listing = await resolved.handle.collections();
|
|
42
|
+
if (listing === null) {
|
|
43
|
+
console.error(`Not found (or not visible to you): ${resolved.url}`);
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
printCollectionListing({
|
|
47
|
+
listing,
|
|
48
|
+
json: options.json,
|
|
49
|
+
plain: options.plain
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const listing = await resolved.handle.list();
|
|
54
|
+
if (listing === null) {
|
|
55
|
+
console.error(`Not found (or not visible to you): ${resolved.url}`);
|
|
56
|
+
return 1;
|
|
57
|
+
}
|
|
58
|
+
printResourceListing({
|
|
59
|
+
listing,
|
|
60
|
+
json: options.json,
|
|
61
|
+
plain: options.plain
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
return reportError({ action: 'list the path', err });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
let parsed;
|
|
71
|
+
try {
|
|
72
|
+
assertOneAddressing(options);
|
|
73
|
+
parsed = parseWasAddress(options.address);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
return reportError({ action: 'list the path', err });
|
|
77
|
+
}
|
|
78
|
+
if (parsed.resourceId !== undefined) {
|
|
79
|
+
console.error(`Could not list the path: "${options.address}" is a resource; ` +
|
|
80
|
+
'ls takes a space or collection address.');
|
|
81
|
+
return 2;
|
|
82
|
+
}
|
|
83
|
+
if (parsed.collectionId !== undefined) {
|
|
84
|
+
return runResourceList({ ...options, address: options.address });
|
|
85
|
+
}
|
|
86
|
+
return runCollectionList({ ...options, address: options.address });
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The `was rm` shorthand: deletes whatever the path (or a `--capability`'s
|
|
90
|
+
* invocation target) points at -- a space, a collection, or a resource (the
|
|
91
|
+
* client's uniform `delete()` design).
|
|
92
|
+
*
|
|
93
|
+
* @param options {object}
|
|
94
|
+
* @param [options.address] {string} A space, collection, or resource
|
|
95
|
+
* address.
|
|
96
|
+
* @param [options.capability] {string} A capability reference instead of
|
|
97
|
+
* a path.
|
|
98
|
+
* @param [options.server] {string} The server base URL.
|
|
99
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
100
|
+
* @returns {Promise<number>} The process exit code.
|
|
101
|
+
*/
|
|
102
|
+
export async function runRm(options) {
|
|
103
|
+
if (options.capability) {
|
|
104
|
+
try {
|
|
105
|
+
assertOneAddressing(options);
|
|
106
|
+
const resolved = await resolveCapabilityTarget({
|
|
107
|
+
ref: options.capability,
|
|
108
|
+
did: options.did
|
|
109
|
+
});
|
|
110
|
+
await resolved.handle.delete();
|
|
111
|
+
console.error(`Deleted ${resolved.url} on the server.`);
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
return reportError({ action: 'delete the path', err });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
let parsed;
|
|
119
|
+
try {
|
|
120
|
+
assertOneAddressing(options);
|
|
121
|
+
parsed = parseWasAddress(options.address);
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
return reportError({ action: 'delete the path', err });
|
|
125
|
+
}
|
|
126
|
+
const pathOptions = { ...options, address: options.address };
|
|
127
|
+
if (parsed.resourceId !== undefined) {
|
|
128
|
+
return runResourceDelete(pathOptions);
|
|
129
|
+
}
|
|
130
|
+
if (parsed.collectionId !== undefined) {
|
|
131
|
+
return runCollectionDelete(pathOptions);
|
|
132
|
+
}
|
|
133
|
+
return runSpaceDelete(pathOptions);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/commands/was/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACZ,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAO3B;IACC,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,mBAAmB,CAAC,OAAO,CAAC,CAAA;YAC5B,MAAM,QAAQ,GAAG,MAAM,uBAAuB,CAAC;gBAC7C,GAAG,EAAE,OAAO,CAAC,UAAU;gBACvB,GAAG,EAAE,OAAO,CAAC,GAAG;aACjB,CAAC,CAAA;YACF,IAAI,QAAQ,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CACb,qCAAqC;oBACnC,4CAA4C,CAC/C,CAAA;YACH,CAAC;YACD,IAAI,QAAQ,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;gBAC/B,MAAM,OAAO,G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AAE,GAAG,EAAE,CAAC,CAAA;IACxD,CAAC;IACD,MAAM,WAAW,GAAG,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAiB,EAAE,CAAA;IACtE,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,iBAAiB,CAAC,WAAW,CAAC,CAAA;IACvC,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,mBAAmB,CAAC,WAAW,CAAC,CAAA;IACzC,CAAC;IACD,OAAO,cAAc,CAAC,WAAW,CAAC,CAAA;AACpC,CAAC"}
|
package/dist/commands/was.d.ts
CHANGED
|
@@ -1,500 +1,33 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a space on the server and prints `{ id, url, name?, controller }`.
|
|
4
|
-
*
|
|
5
|
-
* @param options {object}
|
|
6
|
-
* @param [options.name] {string} The space's display name.
|
|
7
|
-
* @param [options.server] {string} The server base URL.
|
|
8
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
9
|
-
* @param [options.id] {string} A caller-chosen space id.
|
|
10
|
-
* @param [options.save] {boolean} Register the space in the local wallet.
|
|
11
|
-
* @param [options.handle] {string} Short tag for the registry entry.
|
|
12
|
-
* @param [options.description] {string} Longer registry entry description.
|
|
13
|
-
* @returns {Promise<number>} The process exit code.
|
|
14
|
-
*/
|
|
15
|
-
export declare function runSpaceCreate(options: {
|
|
16
|
-
name?: string;
|
|
17
|
-
server?: string;
|
|
18
|
-
did?: string;
|
|
19
|
-
id?: string;
|
|
20
|
-
save?: boolean;
|
|
21
|
-
handle?: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
}): Promise<number>;
|
|
24
1
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @returns {Promise<number>} The process exit code.
|
|
54
|
-
*/
|
|
55
|
-
export declare function runSpaceShow(options: {
|
|
56
|
-
address: string;
|
|
57
|
-
meta?: boolean;
|
|
58
|
-
json?: boolean;
|
|
59
|
-
server?: string;
|
|
60
|
-
did?: string;
|
|
61
|
-
}): Promise<number>;
|
|
62
|
-
/**
|
|
63
|
-
* Updates a space's description fields on the server (upsert via
|
|
64
|
-
* `configure()`), refreshing the name in the local registry entry when one
|
|
65
|
-
* exists.
|
|
66
|
-
*
|
|
67
|
-
* @param options {object}
|
|
68
|
-
* @param options.address {string} The space address.
|
|
69
|
-
* @param [options.name] {string} The new display name.
|
|
70
|
-
* @param [options.server] {string} The server base URL.
|
|
71
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
72
|
-
* @returns {Promise<number>} The process exit code.
|
|
73
|
-
*/
|
|
74
|
-
export declare function runSpaceUpdate(options: {
|
|
75
|
-
address: string;
|
|
76
|
-
name?: string;
|
|
77
|
-
server?: string;
|
|
78
|
-
did?: string;
|
|
79
|
-
}): Promise<number>;
|
|
80
|
-
/**
|
|
81
|
-
* Deletes a space on the server (idempotent) and removes its local registry
|
|
82
|
-
* entry when one exists. The local-only counterpart is `forget`.
|
|
83
|
-
*
|
|
84
|
-
* @param options {object}
|
|
85
|
-
* @param options.address {string} The space address.
|
|
86
|
-
* @param [options.server] {string} The server base URL.
|
|
87
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
88
|
-
* @returns {Promise<number>} The process exit code.
|
|
89
|
-
*/
|
|
90
|
-
export declare function runSpaceDelete(options: {
|
|
91
|
-
address: string;
|
|
92
|
-
server?: string;
|
|
93
|
-
did?: string;
|
|
94
|
-
}): Promise<number>;
|
|
95
|
-
/**
|
|
96
|
-
* Removes a space's local registry entry only; the server-side space is
|
|
97
|
-
* untouched. The remote counterpart is `delete`.
|
|
98
|
-
*
|
|
99
|
-
* @param options {object}
|
|
100
|
-
* @param options.address {string} The space address.
|
|
101
|
-
* @returns {Promise<number>} The process exit code.
|
|
102
|
-
*/
|
|
103
|
-
export declare function runSpaceForget(options: {
|
|
104
|
-
address: string;
|
|
105
|
-
}): Promise<number>;
|
|
106
|
-
/**
|
|
107
|
-
* Registers an existing remote space (e.g. created elsewhere or received via
|
|
108
|
-
* delegation) in the local registry, verifying it first with `describe()`.
|
|
109
|
-
*
|
|
110
|
-
* @param options {object}
|
|
111
|
-
* @param options.address {string} A full space https URL or a bare space id.
|
|
112
|
-
* @param [options.server] {string} The server base URL (with a bare id).
|
|
113
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
114
|
-
* @param [options.handle] {string} Short tag for the registry entry.
|
|
115
|
-
* @param [options.description] {string} Longer registry entry description.
|
|
116
|
-
* @returns {Promise<number>} The process exit code.
|
|
117
|
-
*/
|
|
118
|
-
export declare function runSpaceAdd(options: {
|
|
119
|
-
address: string;
|
|
120
|
-
server?: string;
|
|
121
|
-
did?: string;
|
|
122
|
-
handle?: string;
|
|
123
|
-
description?: string;
|
|
124
|
-
}): Promise<number>;
|
|
125
|
-
/**
|
|
126
|
-
* Creates a collection within a space and prints `{ id, url, name? }`.
|
|
127
|
-
*
|
|
128
|
-
* @param options {object}
|
|
129
|
-
* @param options.address {string} The space address.
|
|
130
|
-
* @param [options.name] {string} The collection's display name.
|
|
131
|
-
* @param [options.id] {string} A caller-chosen collection id.
|
|
132
|
-
* @param [options.server] {string} The server base URL.
|
|
133
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
134
|
-
* @returns {Promise<number>} The process exit code.
|
|
135
|
-
*/
|
|
136
|
-
export declare function runCollectionCreate(options: {
|
|
137
|
-
address: string;
|
|
138
|
-
name?: string;
|
|
139
|
-
id?: string;
|
|
140
|
-
server?: string;
|
|
141
|
-
did?: string;
|
|
142
|
-
}): Promise<number>;
|
|
143
|
-
/**
|
|
144
|
-
* Lists the collections in a space.
|
|
145
|
-
*
|
|
146
|
-
* @param options {object}
|
|
147
|
-
* @param options.address {string} The space address.
|
|
148
|
-
* @param [options.json] {boolean} Output the raw listing JSON.
|
|
149
|
-
* @param [options.plain] {boolean} Output one collection id per line.
|
|
150
|
-
* @param [options.server] {string} The server base URL.
|
|
151
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
152
|
-
* @returns {Promise<number>} The process exit code.
|
|
153
|
-
*/
|
|
154
|
-
export declare function runCollectionList(options: {
|
|
155
|
-
address: string;
|
|
156
|
-
json?: boolean;
|
|
157
|
-
plain?: boolean;
|
|
158
|
-
server?: string;
|
|
159
|
-
did?: string;
|
|
160
|
-
}): Promise<number>;
|
|
161
|
-
/**
|
|
162
|
-
* Shows a collection's description from the server.
|
|
163
|
-
*
|
|
164
|
-
* @param options {object}
|
|
165
|
-
* @param options.address {string} The collection address.
|
|
166
|
-
* @param [options.server] {string} The server base URL.
|
|
167
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
168
|
-
* @returns {Promise<number>} The process exit code.
|
|
169
|
-
*/
|
|
170
|
-
export declare function runCollectionShow(options: {
|
|
171
|
-
address: string;
|
|
172
|
-
server?: string;
|
|
173
|
-
did?: string;
|
|
174
|
-
}): Promise<number>;
|
|
175
|
-
/**
|
|
176
|
-
* Updates a collection's description fields on the server (upsert via
|
|
177
|
-
* `configure()`).
|
|
178
|
-
*
|
|
179
|
-
* @param options {object}
|
|
180
|
-
* @param options.address {string} The collection address.
|
|
181
|
-
* @param options.name {string} The collection's new display name.
|
|
182
|
-
* @param [options.server] {string} The server base URL.
|
|
183
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
184
|
-
* @returns {Promise<number>} The process exit code.
|
|
185
|
-
*/
|
|
186
|
-
export declare function runCollectionUpdate(options: {
|
|
187
|
-
address: string;
|
|
188
|
-
name: string;
|
|
189
|
-
server?: string;
|
|
190
|
-
did?: string;
|
|
191
|
-
}): Promise<number>;
|
|
192
|
-
/**
|
|
193
|
-
* Deletes a whole collection and its contents on the server. Idempotent.
|
|
194
|
-
*
|
|
195
|
-
* @param options {object}
|
|
196
|
-
* @param options.address {string} The collection address.
|
|
197
|
-
* @param [options.server] {string} The server base URL.
|
|
198
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
199
|
-
* @returns {Promise<number>} The process exit code.
|
|
200
|
-
*/
|
|
201
|
-
export declare function runCollectionDelete(options: {
|
|
202
|
-
address: string;
|
|
203
|
-
server?: string;
|
|
204
|
-
did?: string;
|
|
205
|
-
}): Promise<number>;
|
|
206
|
-
/**
|
|
207
|
-
* Adds a resource to a collection (server-generated id) and prints the
|
|
208
|
-
* `{ id, url, contentType }` add result. The collection comes from a path
|
|
209
|
-
* or a `--capability` targeting one.
|
|
210
|
-
*
|
|
211
|
-
* @param options {object}
|
|
212
|
-
* @param [options.address] {string} The collection address.
|
|
213
|
-
* @param [options.capability] {string} A capability reference instead of
|
|
214
|
-
* a path.
|
|
215
|
-
* @param [options.file] {string} The payload file; stdin when omitted.
|
|
216
|
-
* @param [options.contentType] {string} Explicit payload content type.
|
|
217
|
-
* @param [options.server] {string} The server base URL.
|
|
218
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
219
|
-
* @returns {Promise<number>} The process exit code.
|
|
220
|
-
*/
|
|
221
|
-
export declare function runResourceAdd(options: {
|
|
222
|
-
address?: string;
|
|
223
|
-
capability?: string;
|
|
224
|
-
file?: string;
|
|
225
|
-
contentType?: string;
|
|
226
|
-
server?: string;
|
|
227
|
-
did?: string;
|
|
228
|
-
}): Promise<number>;
|
|
229
|
-
/**
|
|
230
|
-
* Creates or replaces a resource at a known id (upsert) and prints
|
|
231
|
-
* `{ id, url }`. The resource comes from a path or a `--capability`
|
|
232
|
-
* targeting one.
|
|
233
|
-
*
|
|
234
|
-
* @param options {object}
|
|
235
|
-
* @param [options.address] {string} The resource address.
|
|
236
|
-
* @param [options.capability] {string} A capability reference instead of
|
|
237
|
-
* a path.
|
|
238
|
-
* @param [options.file] {string} The payload file; stdin when omitted.
|
|
239
|
-
* @param [options.contentType] {string} Explicit payload content type.
|
|
240
|
-
* @param [options.server] {string} The server base URL.
|
|
241
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
242
|
-
* @returns {Promise<number>} The process exit code.
|
|
2
|
+
* `was` command -- Wallet Attached Storage (WAS) operations.
|
|
3
|
+
*
|
|
4
|
+
* Talks to WAS servers via `@interop/was-client`, signing every request with
|
|
5
|
+
* a `did:key` DID stored in the local wallet. Spaces are addressed by a
|
|
6
|
+
* single positional WAS path -- `SPACE[/COLLECTION[/RESOURCE]]` -- where the
|
|
7
|
+
* space part is a local registry handle, a bare space id, or a full space
|
|
8
|
+
* https URL (see `src/was/address.ts`). The local space registry
|
|
9
|
+
* (`~/.config/did-cli-wallet/was-spaces/`) records each space's server URL and controller
|
|
10
|
+
* DID so day-to-day commands need no `--server`/`--did` flags.
|
|
11
|
+
*
|
|
12
|
+
* Subcommand groups: `space` (`create`, `list`, `show`, `update` alias
|
|
13
|
+
* `configure`, `delete`, `forget`, `add`, `backends`, `quotas`),
|
|
14
|
+
* `collection` (alias `coll`;
|
|
15
|
+
* `create`, `list`, `show`, `update`, `delete`, `backend`, `quota`),
|
|
16
|
+
* `resource` (alias
|
|
17
|
+
* `res`; `add`, `put`, `get`, `list`, `delete`), and `resource-meta`
|
|
18
|
+
* (alias `meta`; `get`, `put`). The top-level shorthand
|
|
19
|
+
* verbs `ls`, `get`, `put`, and `rm` dispatch on the path depth, mirroring
|
|
20
|
+
* the client's uniform-verbs-at-every-level design. Resource payloads come
|
|
21
|
+
* from a file argument or stdin, with JSON-vs-binary detection in
|
|
22
|
+
* `src/was/io.ts`.
|
|
23
|
+
*
|
|
24
|
+
* Data goes to stdout, diagnostics to stderr. Exit codes: 0 success, 1
|
|
25
|
+
* operation error (typed WAS errors and not-found/not-visible reads), 2
|
|
26
|
+
* input error (bad path syntax, unknown handle/DID, missing server URL).
|
|
27
|
+
*
|
|
28
|
+
* The run functions for each subcommand group live in `src/commands/was/`;
|
|
29
|
+
* this module wires them onto the commander command tree.
|
|
243
30
|
*/
|
|
244
|
-
|
|
245
|
-
address?: string;
|
|
246
|
-
capability?: string;
|
|
247
|
-
file?: string;
|
|
248
|
-
contentType?: string;
|
|
249
|
-
server?: string;
|
|
250
|
-
did?: string;
|
|
251
|
-
}): Promise<number>;
|
|
252
|
-
/**
|
|
253
|
-
* Reads a resource: JSON pretty-printed to stdout, binary written raw
|
|
254
|
-
* (`--output` for files). The resource comes from a path or a
|
|
255
|
-
* `--capability` targeting one.
|
|
256
|
-
*
|
|
257
|
-
* @param options {object}
|
|
258
|
-
* @param [options.address] {string} The resource address.
|
|
259
|
-
* @param [options.capability] {string} A capability reference instead of
|
|
260
|
-
* a path.
|
|
261
|
-
* @param [options.output] {string} The output file path; stdout when
|
|
262
|
-
* omitted.
|
|
263
|
-
* @param [options.server] {string} The server base URL.
|
|
264
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
265
|
-
* @returns {Promise<number>} The process exit code.
|
|
266
|
-
*/
|
|
267
|
-
export declare function runResourceGet(options: {
|
|
268
|
-
address?: string;
|
|
269
|
-
capability?: string;
|
|
270
|
-
output?: string;
|
|
271
|
-
server?: string;
|
|
272
|
-
did?: string;
|
|
273
|
-
}): Promise<number>;
|
|
274
|
-
/**
|
|
275
|
-
* Lists the resources in a collection.
|
|
276
|
-
*
|
|
277
|
-
* @param options {object}
|
|
278
|
-
* @param options.address {string} The collection address.
|
|
279
|
-
* @param [options.json] {boolean} Output the raw listing JSON.
|
|
280
|
-
* @param [options.plain] {boolean} Output one resource id per line.
|
|
281
|
-
* @param [options.server] {string} The server base URL.
|
|
282
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
283
|
-
* @returns {Promise<number>} The process exit code.
|
|
284
|
-
*/
|
|
285
|
-
export declare function runResourceList(options: {
|
|
286
|
-
address: string;
|
|
287
|
-
json?: boolean;
|
|
288
|
-
plain?: boolean;
|
|
289
|
-
server?: string;
|
|
290
|
-
did?: string;
|
|
291
|
-
}): Promise<number>;
|
|
292
|
-
/**
|
|
293
|
-
* Deletes a resource on the server. Idempotent.
|
|
294
|
-
*
|
|
295
|
-
* @param options {object}
|
|
296
|
-
* @param options.address {string} The resource address.
|
|
297
|
-
* @param [options.server] {string} The server base URL.
|
|
298
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
299
|
-
* @returns {Promise<number>} The process exit code.
|
|
300
|
-
*/
|
|
301
|
-
export declare function runResourceDelete(options: {
|
|
302
|
-
address: string;
|
|
303
|
-
server?: string;
|
|
304
|
-
did?: string;
|
|
305
|
-
}): Promise<number>;
|
|
306
|
-
/**
|
|
307
|
-
* The `was ls` shorthand: lists the collections of a space or the resources
|
|
308
|
-
* of a collection, depending on the depth of the path (or of a
|
|
309
|
-
* `--capability`'s invocation target).
|
|
310
|
-
*
|
|
311
|
-
* @param options {object}
|
|
312
|
-
* @param [options.address] {string} A space or collection address.
|
|
313
|
-
* @param [options.capability] {string} A capability reference instead of
|
|
314
|
-
* a path.
|
|
315
|
-
* @param [options.json] {boolean} Output the raw listing JSON.
|
|
316
|
-
* @param [options.plain] {boolean} Output one id per line.
|
|
317
|
-
* @param [options.server] {string} The server base URL.
|
|
318
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
319
|
-
* @returns {Promise<number>} The process exit code.
|
|
320
|
-
*/
|
|
321
|
-
export declare function runLs(options: {
|
|
322
|
-
address?: string;
|
|
323
|
-
capability?: string;
|
|
324
|
-
json?: boolean;
|
|
325
|
-
plain?: boolean;
|
|
326
|
-
server?: string;
|
|
327
|
-
did?: string;
|
|
328
|
-
}): Promise<number>;
|
|
329
|
-
/**
|
|
330
|
-
* The `was rm` shorthand: deletes whatever the path (or a `--capability`'s
|
|
331
|
-
* invocation target) points at -- a space, a collection, or a resource (the
|
|
332
|
-
* client's uniform `delete()` design).
|
|
333
|
-
*
|
|
334
|
-
* @param options {object}
|
|
335
|
-
* @param [options.address] {string} A space, collection, or resource
|
|
336
|
-
* address.
|
|
337
|
-
* @param [options.capability] {string} A capability reference instead of
|
|
338
|
-
* a path.
|
|
339
|
-
* @param [options.server] {string} The server base URL.
|
|
340
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
341
|
-
* @returns {Promise<number>} The process exit code.
|
|
342
|
-
*/
|
|
343
|
-
export declare function runRm(options: {
|
|
344
|
-
address?: string;
|
|
345
|
-
capability?: string;
|
|
346
|
-
server?: string;
|
|
347
|
-
did?: string;
|
|
348
|
-
}): Promise<number>;
|
|
349
|
-
/**
|
|
350
|
-
* Shows the access-control policy of a space, collection, or resource.
|
|
351
|
-
*
|
|
352
|
-
* @param options {object}
|
|
353
|
-
* @param options.address {string} A space/collection/resource address.
|
|
354
|
-
* @param [options.server] {string} The server base URL.
|
|
355
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
356
|
-
* @returns {Promise<number>} The process exit code.
|
|
357
|
-
*/
|
|
358
|
-
export declare function runPolicyShow(options: {
|
|
359
|
-
address: string;
|
|
360
|
-
server?: string;
|
|
361
|
-
did?: string;
|
|
362
|
-
}): Promise<number>;
|
|
363
|
-
/**
|
|
364
|
-
* Sets (creates or replaces) the access-control policy of a space,
|
|
365
|
-
* collection, or resource, and prints the policy document that was set.
|
|
366
|
-
*
|
|
367
|
-
* @param options {object}
|
|
368
|
-
* @param options.address {string} A space/collection/resource address.
|
|
369
|
-
* @param [options.file] {string} A policy JSON file.
|
|
370
|
-
* @param [options.type] {string} A simple type-only policy (e.g.
|
|
371
|
-
* PublicCanRead).
|
|
372
|
-
* @param [options.server] {string} The server base URL.
|
|
373
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
374
|
-
* @returns {Promise<number>} The process exit code.
|
|
375
|
-
*/
|
|
376
|
-
export declare function runPolicySet(options: {
|
|
377
|
-
address: string;
|
|
378
|
-
file?: string;
|
|
379
|
-
type?: string;
|
|
380
|
-
server?: string;
|
|
381
|
-
did?: string;
|
|
382
|
-
}): Promise<number>;
|
|
383
|
-
/**
|
|
384
|
-
* Removes the access-control policy of a space, collection, or resource,
|
|
385
|
-
* reverting it to capability-only access. Idempotent.
|
|
386
|
-
*
|
|
387
|
-
* @param options {object}
|
|
388
|
-
* @param options.address {string} A space/collection/resource address.
|
|
389
|
-
* @param [options.server] {string} The server base URL.
|
|
390
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
391
|
-
* @returns {Promise<number>} The process exit code.
|
|
392
|
-
*/
|
|
393
|
-
export declare function runPolicyClear(options: {
|
|
394
|
-
address: string;
|
|
395
|
-
server?: string;
|
|
396
|
-
did?: string;
|
|
397
|
-
}): Promise<number>;
|
|
398
|
-
/**
|
|
399
|
-
* Makes a space, collection, or resource world-readable (the
|
|
400
|
-
* `PublicCanRead` policy) and prints its public URL -- the "share via
|
|
401
|
-
* public link" case.
|
|
402
|
-
*
|
|
403
|
-
* @param options {object}
|
|
404
|
-
* @param options.address {string} A space/collection/resource address.
|
|
405
|
-
* @param [options.server] {string} The server base URL.
|
|
406
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
407
|
-
* @returns {Promise<number>} The process exit code.
|
|
408
|
-
*/
|
|
409
|
-
export declare function runPublish(options: {
|
|
410
|
-
address: string;
|
|
411
|
-
server?: string;
|
|
412
|
-
did?: string;
|
|
413
|
-
}): Promise<number>;
|
|
414
|
-
/**
|
|
415
|
-
* Reverts a published space, collection, or resource to capability-only
|
|
416
|
-
* access (clears its policy). Idempotent.
|
|
417
|
-
*
|
|
418
|
-
* @param options {object}
|
|
419
|
-
* @param options.address {string} A space/collection/resource address.
|
|
420
|
-
* @param [options.server] {string} The server base URL.
|
|
421
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
422
|
-
* @returns {Promise<number>} The process exit code.
|
|
423
|
-
*/
|
|
424
|
-
export declare function runUnpublish(options: {
|
|
425
|
-
address: string;
|
|
426
|
-
server?: string;
|
|
427
|
-
did?: string;
|
|
428
|
-
}): Promise<number>;
|
|
429
|
-
/**
|
|
430
|
-
* Exports a whole space as a tar archive, written to `--output` or raw to
|
|
431
|
-
* stdout.
|
|
432
|
-
*
|
|
433
|
-
* @param options {object}
|
|
434
|
-
* @param options.address {string} The space address.
|
|
435
|
-
* @param [options.output] {string} The output file path; stdout when
|
|
436
|
-
* omitted.
|
|
437
|
-
* @param [options.server] {string} The server base URL.
|
|
438
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
439
|
-
* @returns {Promise<number>} The process exit code.
|
|
440
|
-
*/
|
|
441
|
-
export declare function runSpaceExport(options: {
|
|
442
|
-
address: string;
|
|
443
|
-
output?: string;
|
|
444
|
-
server?: string;
|
|
445
|
-
did?: string;
|
|
446
|
-
}): Promise<number>;
|
|
447
|
-
/**
|
|
448
|
-
* Imports (merges) a tar archive into a space and prints the import stats
|
|
449
|
-
* summary.
|
|
450
|
-
*
|
|
451
|
-
* @param options {object}
|
|
452
|
-
* @param options.address {string} The space address.
|
|
453
|
-
* @param [options.file] {string} The tar file; stdin when omitted.
|
|
454
|
-
* @param [options.server] {string} The server base URL.
|
|
455
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
456
|
-
* @returns {Promise<number>} The process exit code.
|
|
457
|
-
*/
|
|
458
|
-
export declare function runSpaceImport(options: {
|
|
459
|
-
address: string;
|
|
460
|
-
file?: string;
|
|
461
|
-
server?: string;
|
|
462
|
-
did?: string;
|
|
463
|
-
}): Promise<number>;
|
|
464
|
-
/**
|
|
465
|
-
* Delegates access to a space, collection, or resource: signs a capability
|
|
466
|
-
* for the `--to` DID with the given actions and expiration, and prints
|
|
467
|
-
* `{ delegatedCapability, encoded }` (the same shape as `zcap delegate`).
|
|
468
|
-
* `--save` stores the capability in the local zcap store
|
|
469
|
-
* (`~/.config/did-cli-wallet/zcaps/`).
|
|
470
|
-
*
|
|
471
|
-
* @param options {object}
|
|
472
|
-
* @param options.address {string} The space/collection/resource address.
|
|
473
|
-
* @param options.to {string} The delegatee DID (or stored-DID handle).
|
|
474
|
-
* @param options.action {string[]} Allowed actions (HTTP verbs; lowercase
|
|
475
|
-
* accepted).
|
|
476
|
-
* @param [options.ttl] {string} Time-to-live for expiration (default 1y).
|
|
477
|
-
* @param [options.expires] {string} Explicit ISO 8601 expiration
|
|
478
|
-
* (overrides --ttl).
|
|
479
|
-
* @param [options.save] {boolean} Save the capability to the zcap store.
|
|
480
|
-
* @param [options.handle] {string} Short tag for the saved zcap.
|
|
481
|
-
* @param [options.description] {string} Longer description for the saved
|
|
482
|
-
* zcap.
|
|
483
|
-
* @param [options.server] {string} The server base URL.
|
|
484
|
-
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
485
|
-
* @returns {Promise<number>} The process exit code.
|
|
486
|
-
*/
|
|
487
|
-
export declare function runGrant(options: {
|
|
488
|
-
address: string;
|
|
489
|
-
to: string;
|
|
490
|
-
action: string[];
|
|
491
|
-
ttl?: string;
|
|
492
|
-
expires?: string;
|
|
493
|
-
save?: boolean;
|
|
494
|
-
handle?: string;
|
|
495
|
-
description?: string;
|
|
496
|
-
server?: string;
|
|
497
|
-
did?: string;
|
|
498
|
-
}): Promise<number>;
|
|
31
|
+
import { Command } from 'commander';
|
|
499
32
|
export declare function makeWasCommand(): Command;
|
|
500
33
|
//# sourceMappingURL=was.d.ts.map
|