@interop/did-cli 0.7.1 → 0.9.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 +130 -0
- package/README.md +335 -6
- package/dist/commands/did.d.ts.map +1 -1
- package/dist/commands/did.js +66 -18
- package/dist/commands/did.js.map +1 -1
- package/dist/commands/edv.d.ts +63 -0
- package/dist/commands/edv.d.ts.map +1 -0
- package/dist/commands/edv.js +627 -0
- package/dist/commands/edv.js.map +1 -0
- package/dist/commands/key.d.ts.map +1 -1
- package/dist/commands/key.js +87 -13
- 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/edv/core.d.ts +60 -0
- package/dist/edv/core.d.ts.map +1 -0
- package/dist/edv/core.js +75 -0
- package/dist/edv/core.js.map +1 -0
- package/dist/edv/document.d.ts +25 -0
- package/dist/edv/document.d.ts.map +1 -0
- package/dist/edv/document.js +19 -0
- package/dist/edv/document.js.map +1 -0
- package/dist/edv/hmac.d.ts +26 -0
- package/dist/edv/hmac.d.ts.map +1 -0
- package/dist/edv/hmac.js +67 -0
- package/dist/edv/hmac.js.map +1 -0
- package/dist/edv/recipients.d.ts +65 -0
- package/dist/edv/recipients.d.ts.map +1 -0
- package/dist/edv/recipients.js +253 -0
- package/dist/edv/recipients.js.map +1 -0
- package/dist/edv/stream.d.ts +69 -0
- package/dist/edv/stream.d.ts.map +1 -0
- package/dist/edv/stream.js +169 -0
- package/dist/edv/stream.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/meta.d.ts +1 -0
- package/dist/meta.d.ts.map +1 -1
- package/dist/meta.js +1 -1
- package/dist/meta.js.map +1 -1
- package/dist/storage.d.ts +6 -4
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +6 -5
- package/dist/storage.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/was/io.d.ts +14 -0
- package/dist/was/io.d.ts.map +1 -1
- package/dist/was/io.js +20 -7
- package/dist/was/io.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 +17 -14
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `was space` run functions: create, list (local registry, or `--remote`),
|
|
3
|
+
* show (server description or `--meta` registry record), update, delete
|
|
4
|
+
* (server + registry), forget (registry only), add (register an existing
|
|
5
|
+
* remote space), backends (the storage backends available within a space),
|
|
6
|
+
* quotas (the space's storage report grouped by backend), and export/import
|
|
7
|
+
* of a whole space as a tar archive.
|
|
8
|
+
*/
|
|
9
|
+
import { buildWasClient, resolveWasTarget } from '../../was/client.js';
|
|
10
|
+
import { readInputBytes, writeBytesOutput } from '../../was/io.js';
|
|
11
|
+
import { listSpaceRecords, removeSpaceRecord, resolveSpaceRef, saveSpaceRecord } from '../../was/registry.js';
|
|
12
|
+
import { renderTable } from '../../table.js';
|
|
13
|
+
import { parseSpaceAddress, reportError, wasUrl } from './shared.js';
|
|
14
|
+
/**
|
|
15
|
+
* Creates a space on the server and prints `{ id, url, name?, controller }`.
|
|
16
|
+
*
|
|
17
|
+
* @param options {object}
|
|
18
|
+
* @param [options.name] {string} The space's display name.
|
|
19
|
+
* @param [options.server] {string} The server base URL.
|
|
20
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
21
|
+
* @param [options.id] {string} A caller-chosen space id.
|
|
22
|
+
* @param [options.save] {boolean} Register the space in the local wallet.
|
|
23
|
+
* @param [options.handle] {string} Short tag for the registry entry.
|
|
24
|
+
* @param [options.description] {string} Longer registry entry description.
|
|
25
|
+
* @returns {Promise<number>} The process exit code.
|
|
26
|
+
*/
|
|
27
|
+
export async function runSpaceCreate(options) {
|
|
28
|
+
try {
|
|
29
|
+
const { client, server, did } = await buildWasClient({
|
|
30
|
+
server: options.server,
|
|
31
|
+
did: options.did
|
|
32
|
+
});
|
|
33
|
+
const space = await client.createSpace({
|
|
34
|
+
...(options.name !== undefined && { name: options.name }),
|
|
35
|
+
...(options.id !== undefined && { id: options.id })
|
|
36
|
+
});
|
|
37
|
+
const url = wasUrl({ server, spaceId: space.id });
|
|
38
|
+
if (options.save) {
|
|
39
|
+
const filePath = await saveSpaceRecord({
|
|
40
|
+
record: {
|
|
41
|
+
id: space.id,
|
|
42
|
+
...(options.name !== undefined && { name: options.name }),
|
|
43
|
+
server,
|
|
44
|
+
controller: did
|
|
45
|
+
},
|
|
46
|
+
handle: options.handle,
|
|
47
|
+
description: options.description
|
|
48
|
+
});
|
|
49
|
+
console.error(`Space registered in ${filePath}`);
|
|
50
|
+
}
|
|
51
|
+
console.log(JSON.stringify({
|
|
52
|
+
id: space.id,
|
|
53
|
+
url,
|
|
54
|
+
...(options.name !== undefined && { name: options.name }),
|
|
55
|
+
controller: did
|
|
56
|
+
}, null, 2));
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
return reportError({ action: 'create the space', err });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Lists the locally registered spaces (the working model while servers do
|
|
65
|
+
* not implement List Spaces); `--remote` asks the server instead.
|
|
66
|
+
*
|
|
67
|
+
* @param options {object}
|
|
68
|
+
* @param [options.json] {boolean} Output a JSON array with metadata.
|
|
69
|
+
* @param [options.plain] {boolean} Output one space id per line.
|
|
70
|
+
* @param [options.remote] {boolean} List spaces on the server instead.
|
|
71
|
+
* @param [options.server] {string} The server base URL (with `--remote`).
|
|
72
|
+
* @param [options.did] {string} The signing DID (with `--remote`).
|
|
73
|
+
* @returns {Promise<number>} The process exit code.
|
|
74
|
+
*/
|
|
75
|
+
export async function runSpaceList(options) {
|
|
76
|
+
try {
|
|
77
|
+
if (options.remote) {
|
|
78
|
+
const { client } = await buildWasClient({
|
|
79
|
+
server: options.server,
|
|
80
|
+
did: options.did
|
|
81
|
+
});
|
|
82
|
+
const listing = await client.listSpaces();
|
|
83
|
+
console.log(JSON.stringify(listing, null, 2));
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
const entries = await listSpaceRecords();
|
|
87
|
+
if (options.plain) {
|
|
88
|
+
const spaceIds = entries.map(entry => entry.record.id).sort();
|
|
89
|
+
for (const spaceId of spaceIds) {
|
|
90
|
+
console.log(spaceId);
|
|
91
|
+
}
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
if (options.json) {
|
|
95
|
+
const output = entries.map(entry => ({
|
|
96
|
+
id: entry.record.id,
|
|
97
|
+
server: entry.record.server,
|
|
98
|
+
...(entry.record.name && { name: entry.record.name }),
|
|
99
|
+
...(entry.record.controller && {
|
|
100
|
+
controller: entry.record.controller
|
|
101
|
+
}),
|
|
102
|
+
...(entry.meta?.created && { created: entry.meta.created }),
|
|
103
|
+
...(entry.meta?.handle && { handle: entry.meta.handle }),
|
|
104
|
+
...(entry.meta?.description && {
|
|
105
|
+
description: entry.meta.description
|
|
106
|
+
})
|
|
107
|
+
}));
|
|
108
|
+
console.log(JSON.stringify(output, null, 2));
|
|
109
|
+
return 0;
|
|
110
|
+
}
|
|
111
|
+
if (entries.length === 0) {
|
|
112
|
+
return 0;
|
|
113
|
+
}
|
|
114
|
+
const rows = entries.map(entry => [
|
|
115
|
+
entry.meta?.handle ?? '',
|
|
116
|
+
entry.record.name ?? '',
|
|
117
|
+
entry.record.id,
|
|
118
|
+
entry.record.server,
|
|
119
|
+
entry.meta?.created?.slice(0, 10) ?? ''
|
|
120
|
+
]);
|
|
121
|
+
console.log(renderTable({
|
|
122
|
+
columns: [
|
|
123
|
+
{ header: 'HANDLE', maxWidth: 16 },
|
|
124
|
+
{ header: 'NAME', maxWidth: 20 },
|
|
125
|
+
{ header: 'SPACE ID', maxWidth: 40 },
|
|
126
|
+
{ header: 'SERVER', maxWidth: 32 },
|
|
127
|
+
{ header: 'CREATED' }
|
|
128
|
+
],
|
|
129
|
+
rows
|
|
130
|
+
}));
|
|
131
|
+
return 0;
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
return reportError({ action: 'list spaces', err });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Shows a space: its Space Description from the server, or (`--meta`) its
|
|
139
|
+
* local registry record and metadata.
|
|
140
|
+
*
|
|
141
|
+
* @param options {object}
|
|
142
|
+
* @param options.address {string} The space address.
|
|
143
|
+
* @param [options.meta] {boolean} Show the local registry metadata instead.
|
|
144
|
+
* @param [options.json] {boolean} With `--meta`, output JSON.
|
|
145
|
+
* @param [options.server] {string} The server base URL.
|
|
146
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
147
|
+
* @returns {Promise<number>} The process exit code.
|
|
148
|
+
*/
|
|
149
|
+
export async function runSpaceShow(options) {
|
|
150
|
+
try {
|
|
151
|
+
const parsed = parseSpaceAddress(options.address);
|
|
152
|
+
if (options.meta) {
|
|
153
|
+
const entry = await resolveSpaceRef({ ref: parsed.spaceRef });
|
|
154
|
+
if (!entry) {
|
|
155
|
+
throw new Error(`No locally registered space found for "${parsed.spaceRef}".`);
|
|
156
|
+
}
|
|
157
|
+
if (options.json) {
|
|
158
|
+
const output = {
|
|
159
|
+
id: entry.record.id,
|
|
160
|
+
server: entry.record.server,
|
|
161
|
+
...(entry.record.name && { name: entry.record.name }),
|
|
162
|
+
...(entry.record.controller && {
|
|
163
|
+
controller: entry.record.controller
|
|
164
|
+
}),
|
|
165
|
+
...(entry.meta?.created && { created: entry.meta.created }),
|
|
166
|
+
...(entry.meta?.handle && { handle: entry.meta.handle }),
|
|
167
|
+
...(entry.meta?.description && {
|
|
168
|
+
description: entry.meta.description
|
|
169
|
+
})
|
|
170
|
+
};
|
|
171
|
+
console.log(JSON.stringify(output, null, 2));
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
const rows = [
|
|
175
|
+
['ID', entry.record.id],
|
|
176
|
+
['Name', entry.record.name ?? ''],
|
|
177
|
+
['Server', entry.record.server],
|
|
178
|
+
['Controller', entry.record.controller ?? ''],
|
|
179
|
+
['Handle', entry.meta?.handle ?? ''],
|
|
180
|
+
['Created', entry.meta?.created ?? ''],
|
|
181
|
+
['Description', entry.meta?.description ?? '']
|
|
182
|
+
];
|
|
183
|
+
console.log(renderTable({
|
|
184
|
+
columns: [{ header: 'FIELD' }, { header: 'VALUE' }],
|
|
185
|
+
rows
|
|
186
|
+
}));
|
|
187
|
+
return 0;
|
|
188
|
+
}
|
|
189
|
+
const target = await resolveWasTarget({
|
|
190
|
+
address: options.address,
|
|
191
|
+
server: options.server,
|
|
192
|
+
did: options.did
|
|
193
|
+
});
|
|
194
|
+
const description = await target.client.space(target.spaceId).describe();
|
|
195
|
+
if (description === null) {
|
|
196
|
+
console.error('Not found (or not visible to you): ' +
|
|
197
|
+
wasUrl({ server: target.server, spaceId: target.spaceId }));
|
|
198
|
+
return 1;
|
|
199
|
+
}
|
|
200
|
+
console.log(JSON.stringify(description, null, 2));
|
|
201
|
+
return 0;
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
return reportError({ action: 'show the space', err });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Updates a space's description fields on the server (upsert via
|
|
209
|
+
* `configure()`), refreshing the name in the local registry entry when one
|
|
210
|
+
* exists.
|
|
211
|
+
*
|
|
212
|
+
* @param options {object}
|
|
213
|
+
* @param options.address {string} The space address.
|
|
214
|
+
* @param [options.name] {string} The new display name.
|
|
215
|
+
* @param [options.server] {string} The server base URL.
|
|
216
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
217
|
+
* @returns {Promise<number>} The process exit code.
|
|
218
|
+
*/
|
|
219
|
+
export async function runSpaceUpdate(options) {
|
|
220
|
+
try {
|
|
221
|
+
parseSpaceAddress(options.address);
|
|
222
|
+
const target = await resolveWasTarget({
|
|
223
|
+
address: options.address,
|
|
224
|
+
server: options.server,
|
|
225
|
+
did: options.did
|
|
226
|
+
});
|
|
227
|
+
const description = await target.client.space(target.spaceId).configure({
|
|
228
|
+
...(options.name !== undefined && { name: options.name })
|
|
229
|
+
});
|
|
230
|
+
if (target.entry && options.name !== undefined) {
|
|
231
|
+
await saveSpaceRecord({
|
|
232
|
+
record: { ...target.entry.record, name: options.name }
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
console.log(JSON.stringify(description, null, 2));
|
|
236
|
+
return 0;
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
return reportError({ action: 'update the space', err });
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Deletes a space on the server (idempotent) and removes its local registry
|
|
244
|
+
* entry when one exists. The local-only counterpart is `forget`.
|
|
245
|
+
*
|
|
246
|
+
* @param options {object}
|
|
247
|
+
* @param options.address {string} The space address.
|
|
248
|
+
* @param [options.server] {string} The server base URL.
|
|
249
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
250
|
+
* @returns {Promise<number>} The process exit code.
|
|
251
|
+
*/
|
|
252
|
+
export async function runSpaceDelete(options) {
|
|
253
|
+
try {
|
|
254
|
+
parseSpaceAddress(options.address);
|
|
255
|
+
const target = await resolveWasTarget({
|
|
256
|
+
address: options.address,
|
|
257
|
+
server: options.server,
|
|
258
|
+
did: options.did
|
|
259
|
+
});
|
|
260
|
+
await target.client.space(target.spaceId).delete();
|
|
261
|
+
console.error('Deleted ' +
|
|
262
|
+
wasUrl({ server: target.server, spaceId: target.spaceId }) +
|
|
263
|
+
' on the server.');
|
|
264
|
+
if (target.entry) {
|
|
265
|
+
const removed = await removeSpaceRecord({
|
|
266
|
+
storageId: target.entry.storageId
|
|
267
|
+
});
|
|
268
|
+
for (const filePath of removed) {
|
|
269
|
+
console.error(`Removed ${filePath}`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return 0;
|
|
273
|
+
}
|
|
274
|
+
catch (err) {
|
|
275
|
+
return reportError({ action: 'delete the space', err });
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Removes a space's local registry entry only; the server-side space is
|
|
280
|
+
* untouched. The remote counterpart is `delete`.
|
|
281
|
+
*
|
|
282
|
+
* @param options {object}
|
|
283
|
+
* @param options.address {string} The space address.
|
|
284
|
+
* @returns {Promise<number>} The process exit code.
|
|
285
|
+
*/
|
|
286
|
+
export async function runSpaceForget(options) {
|
|
287
|
+
try {
|
|
288
|
+
const parsed = parseSpaceAddress(options.address);
|
|
289
|
+
const entry = await resolveSpaceRef({ ref: parsed.spaceRef });
|
|
290
|
+
if (!entry) {
|
|
291
|
+
throw new Error(`No locally registered space found for "${parsed.spaceRef}".`);
|
|
292
|
+
}
|
|
293
|
+
const removed = await removeSpaceRecord({ storageId: entry.storageId });
|
|
294
|
+
for (const filePath of removed) {
|
|
295
|
+
console.error(`Removed ${filePath}`);
|
|
296
|
+
}
|
|
297
|
+
return 0;
|
|
298
|
+
}
|
|
299
|
+
catch (err) {
|
|
300
|
+
return reportError({ action: 'forget the space', err });
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Registers an existing remote space (e.g. created elsewhere or received via
|
|
305
|
+
* delegation) in the local registry, verifying it first with `describe()`.
|
|
306
|
+
*
|
|
307
|
+
* @param options {object}
|
|
308
|
+
* @param options.address {string} A full space https URL or a bare space id.
|
|
309
|
+
* @param [options.server] {string} The server base URL (with a bare id).
|
|
310
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
311
|
+
* @param [options.handle] {string} Short tag for the registry entry.
|
|
312
|
+
* @param [options.description] {string} Longer registry entry description.
|
|
313
|
+
* @returns {Promise<number>} The process exit code.
|
|
314
|
+
*/
|
|
315
|
+
export async function runSpaceAdd(options) {
|
|
316
|
+
try {
|
|
317
|
+
parseSpaceAddress(options.address);
|
|
318
|
+
const target = await resolveWasTarget({
|
|
319
|
+
address: options.address,
|
|
320
|
+
server: options.server,
|
|
321
|
+
did: options.did
|
|
322
|
+
});
|
|
323
|
+
const description = await target.client.space(target.spaceId).describe();
|
|
324
|
+
if (description === null) {
|
|
325
|
+
console.error('Not found (or not visible to you): ' +
|
|
326
|
+
wasUrl({ server: target.server, spaceId: target.spaceId }));
|
|
327
|
+
return 1;
|
|
328
|
+
}
|
|
329
|
+
const filePath = await saveSpaceRecord({
|
|
330
|
+
record: {
|
|
331
|
+
id: target.spaceId,
|
|
332
|
+
...(description.name && { name: description.name }),
|
|
333
|
+
server: target.server,
|
|
334
|
+
controller: description.controller ?? target.did
|
|
335
|
+
},
|
|
336
|
+
handle: options.handle,
|
|
337
|
+
description: options.description
|
|
338
|
+
});
|
|
339
|
+
console.error(`Space registered in ${filePath}`);
|
|
340
|
+
console.log(JSON.stringify(description, null, 2));
|
|
341
|
+
return 0;
|
|
342
|
+
}
|
|
343
|
+
catch (err) {
|
|
344
|
+
return reportError({ action: 'add the space', err });
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Lists the storage backends available within a space. The reference server
|
|
349
|
+
* ships a single server-configured backend (registered as `default`); a
|
|
350
|
+
* server without backend support returns `null` (a 501), reported as an
|
|
351
|
+
* error.
|
|
352
|
+
*
|
|
353
|
+
* @param options {object}
|
|
354
|
+
* @param options.address {string} The space address.
|
|
355
|
+
* @param [options.json] {boolean} Output the raw backends JSON.
|
|
356
|
+
* @param [options.server] {string} The server base URL.
|
|
357
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
358
|
+
* @returns {Promise<number>} The process exit code.
|
|
359
|
+
*/
|
|
360
|
+
export async function runSpaceBackends(options) {
|
|
361
|
+
try {
|
|
362
|
+
parseSpaceAddress(options.address);
|
|
363
|
+
const target = await resolveWasTarget({
|
|
364
|
+
address: options.address,
|
|
365
|
+
server: options.server,
|
|
366
|
+
did: options.did
|
|
367
|
+
});
|
|
368
|
+
const backends = await target.client.space(target.spaceId).backends();
|
|
369
|
+
if (backends === null) {
|
|
370
|
+
console.error('This server does not support listing backends (501 Not Implemented).');
|
|
371
|
+
return 1;
|
|
372
|
+
}
|
|
373
|
+
if (options.json) {
|
|
374
|
+
console.log(JSON.stringify(backends, null, 2));
|
|
375
|
+
return 0;
|
|
376
|
+
}
|
|
377
|
+
if (backends.length === 0) {
|
|
378
|
+
return 0;
|
|
379
|
+
}
|
|
380
|
+
const rows = backends.map(backend => [
|
|
381
|
+
backend.id,
|
|
382
|
+
backend.name ?? '',
|
|
383
|
+
backend.managedBy ?? '',
|
|
384
|
+
backend.storageMode?.join(', ') ?? '',
|
|
385
|
+
backend.persistence ?? ''
|
|
386
|
+
]);
|
|
387
|
+
console.log(renderTable({
|
|
388
|
+
columns: [
|
|
389
|
+
{ header: 'ID', maxWidth: 24 },
|
|
390
|
+
{ header: 'NAME', maxWidth: 20 },
|
|
391
|
+
{ header: 'MANAGED BY' },
|
|
392
|
+
{ header: 'STORAGE MODE' },
|
|
393
|
+
{ header: 'PERSISTENCE' }
|
|
394
|
+
],
|
|
395
|
+
rows
|
|
396
|
+
}));
|
|
397
|
+
return 0;
|
|
398
|
+
}
|
|
399
|
+
catch (err) {
|
|
400
|
+
return reportError({ action: 'list the space backends', err });
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Shows a space's storage quota report, grouped by backend (one row per
|
|
405
|
+
* backend: state, usage, limit, and any restricted actions). A server
|
|
406
|
+
* without quota support returns `null` (a 501), reported as an error.
|
|
407
|
+
*
|
|
408
|
+
* @param options {object}
|
|
409
|
+
* @param options.address {string} The space address.
|
|
410
|
+
* @param [options.json] {boolean} Output the raw quota report JSON.
|
|
411
|
+
* @param [options.server] {string} The server base URL.
|
|
412
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
413
|
+
* @returns {Promise<number>} The process exit code.
|
|
414
|
+
*/
|
|
415
|
+
export async function runSpaceQuotas(options) {
|
|
416
|
+
try {
|
|
417
|
+
parseSpaceAddress(options.address);
|
|
418
|
+
const target = await resolveWasTarget({
|
|
419
|
+
address: options.address,
|
|
420
|
+
server: options.server,
|
|
421
|
+
did: options.did
|
|
422
|
+
});
|
|
423
|
+
const report = await target.client.space(target.spaceId).quotas();
|
|
424
|
+
if (report === null) {
|
|
425
|
+
console.error('This server does not support quota reports (501 Not Implemented).');
|
|
426
|
+
return 1;
|
|
427
|
+
}
|
|
428
|
+
if (options.json) {
|
|
429
|
+
console.log(JSON.stringify(report, null, 2));
|
|
430
|
+
return 0;
|
|
431
|
+
}
|
|
432
|
+
if (report.backends.length === 0) {
|
|
433
|
+
return 0;
|
|
434
|
+
}
|
|
435
|
+
const rows = report.backends.map(backend => [
|
|
436
|
+
backend.name ? `${backend.id} (${backend.name})` : backend.id,
|
|
437
|
+
backend.state,
|
|
438
|
+
String(backend.usageBytes),
|
|
439
|
+
backend.limit.isUnlimited
|
|
440
|
+
? 'unlimited'
|
|
441
|
+
: String(backend.limit.capacityBytes ?? ''),
|
|
442
|
+
backend.restrictedActions.join(', ')
|
|
443
|
+
]);
|
|
444
|
+
console.log(renderTable({
|
|
445
|
+
columns: [
|
|
446
|
+
{ header: 'BACKEND', maxWidth: 28 },
|
|
447
|
+
{ header: 'STATE' },
|
|
448
|
+
{ header: 'USAGE (B)' },
|
|
449
|
+
{ header: 'LIMIT (B)' },
|
|
450
|
+
{ header: 'RESTRICTED' }
|
|
451
|
+
],
|
|
452
|
+
rows
|
|
453
|
+
}));
|
|
454
|
+
return 0;
|
|
455
|
+
}
|
|
456
|
+
catch (err) {
|
|
457
|
+
return reportError({ action: 'get the space quotas', err });
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Exports a whole space as a tar archive, written to `--output` or raw to
|
|
462
|
+
* stdout.
|
|
463
|
+
*
|
|
464
|
+
* @param options {object}
|
|
465
|
+
* @param options.address {string} The space address.
|
|
466
|
+
* @param [options.output] {string} The output file path; stdout when
|
|
467
|
+
* omitted.
|
|
468
|
+
* @param [options.server] {string} The server base URL.
|
|
469
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
470
|
+
* @returns {Promise<number>} The process exit code.
|
|
471
|
+
*/
|
|
472
|
+
export async function runSpaceExport(options) {
|
|
473
|
+
try {
|
|
474
|
+
parseSpaceAddress(options.address);
|
|
475
|
+
const target = await resolveWasTarget({
|
|
476
|
+
address: options.address,
|
|
477
|
+
server: options.server,
|
|
478
|
+
did: options.did
|
|
479
|
+
});
|
|
480
|
+
const bytes = await target.client.space(target.spaceId).export();
|
|
481
|
+
await writeBytesOutput({ bytes, output: options.output });
|
|
482
|
+
return 0;
|
|
483
|
+
}
|
|
484
|
+
catch (err) {
|
|
485
|
+
return reportError({ action: 'export the space', err });
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Imports (merges) a tar archive into a space and prints the import stats
|
|
490
|
+
* summary.
|
|
491
|
+
*
|
|
492
|
+
* @param options {object}
|
|
493
|
+
* @param options.address {string} The space address.
|
|
494
|
+
* @param [options.file] {string} The tar file; stdin when omitted.
|
|
495
|
+
* @param [options.server] {string} The server base URL.
|
|
496
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
497
|
+
* @returns {Promise<number>} The process exit code.
|
|
498
|
+
*/
|
|
499
|
+
export async function runSpaceImport(options) {
|
|
500
|
+
try {
|
|
501
|
+
parseSpaceAddress(options.address);
|
|
502
|
+
const target = await resolveWasTarget({
|
|
503
|
+
address: options.address,
|
|
504
|
+
server: options.server,
|
|
505
|
+
did: options.did
|
|
506
|
+
});
|
|
507
|
+
const tar = await readInputBytes({ file: options.file });
|
|
508
|
+
const stats = await target.client.space(target.spaceId).import(tar);
|
|
509
|
+
console.log(JSON.stringify(stats, null, 2));
|
|
510
|
+
return 0;
|
|
511
|
+
}
|
|
512
|
+
catch (err) {
|
|
513
|
+
return reportError({ action: 'import into the space', err });
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
//# sourceMappingURL=space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.js","sourceRoot":"","sources":["../../../src/commands/was/space.ts"],"names":[],"mappings":"AAAA;;;;;;;GA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C,MAAM;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAA;QACF,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;QACxD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACnE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAC3C,OAAO,CAAC,CAAA;IACV,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,WAAW,CAAC,EAAE,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,CAAC,CAAA;IAC9D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `was ls` shorthand: lists the collections of a space or the resources
|
|
3
|
+
* of a collection, depending on the depth of the path (or of a
|
|
4
|
+
* `--capability`'s invocation target).
|
|
5
|
+
*
|
|
6
|
+
* @param options {object}
|
|
7
|
+
* @param [options.address] {string} A space or collection address.
|
|
8
|
+
* @param [options.capability] {string} A capability reference instead of
|
|
9
|
+
* a path.
|
|
10
|
+
* @param [options.json] {boolean} Output the raw listing JSON.
|
|
11
|
+
* @param [options.plain] {boolean} Output one id per line.
|
|
12
|
+
* @param [options.server] {string} The server base URL.
|
|
13
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
14
|
+
* @returns {Promise<number>} The process exit code.
|
|
15
|
+
*/
|
|
16
|
+
export declare function runLs(options: {
|
|
17
|
+
address?: string;
|
|
18
|
+
capability?: string;
|
|
19
|
+
json?: boolean;
|
|
20
|
+
plain?: boolean;
|
|
21
|
+
server?: string;
|
|
22
|
+
did?: string;
|
|
23
|
+
}): Promise<number>;
|
|
24
|
+
/**
|
|
25
|
+
* The `was rm` shorthand: deletes whatever the path (or a `--capability`'s
|
|
26
|
+
* invocation target) points at -- a space, a collection, or a resource (the
|
|
27
|
+
* client's uniform `delete()` design).
|
|
28
|
+
*
|
|
29
|
+
* @param options {object}
|
|
30
|
+
* @param [options.address] {string} A space, collection, or resource
|
|
31
|
+
* address.
|
|
32
|
+
* @param [options.capability] {string} A capability reference instead of
|
|
33
|
+
* a path.
|
|
34
|
+
* @param [options.server] {string} The server base URL.
|
|
35
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
36
|
+
* @returns {Promise<number>} The process exit code.
|
|
37
|
+
*/
|
|
38
|
+
export declare function runRm(options: {
|
|
39
|
+
address?: string;
|
|
40
|
+
capability?: string;
|
|
41
|
+
server?: string;
|
|
42
|
+
did?: string;
|
|
43
|
+
}): Promise<number>;
|
|
44
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../../src/commands/was/tree.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CA4DlB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BlB"}
|