@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,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `was publish`/`unpublish` (the world-readable `PublicCanRead` toggle) and
|
|
3
|
+
* `was grant` (delegate a signed capability to another DID) run functions.
|
|
4
|
+
*/
|
|
5
|
+
import { resolveDidRef } from '../../meta.js';
|
|
6
|
+
import { saveToCollection } from '../../storage.js';
|
|
7
|
+
import { encodeCapability } from '../../zcap/encoding.js';
|
|
8
|
+
import { expiresFromTtl } from '../../zcap/ttl.js';
|
|
9
|
+
import { resolveWasTarget } from '../../was/client.js';
|
|
10
|
+
import { storageIdFor, writeCreateMeta } from '../zcap.js';
|
|
11
|
+
import { handleForTarget, reportError, wasUrl } from './shared.js';
|
|
12
|
+
/** The capability actions WAS servers match against (HTTP verbs). */
|
|
13
|
+
const WAS_ACTIONS = ['GET', 'PUT', 'POST', 'DELETE'];
|
|
14
|
+
/**
|
|
15
|
+
* Normalizes grant action verbs to their canonical uppercase form,
|
|
16
|
+
* rejecting anything that is not a WAS-supported HTTP verb.
|
|
17
|
+
*
|
|
18
|
+
* @param actions {string[]}
|
|
19
|
+
* @returns {WasAction[]}
|
|
20
|
+
*/
|
|
21
|
+
function normalizeActions(actions) {
|
|
22
|
+
return actions.map(action => {
|
|
23
|
+
const verb = action.toUpperCase();
|
|
24
|
+
if (!WAS_ACTIONS.includes(verb)) {
|
|
25
|
+
throw new Error(`Unknown action "${action}" (supported: GET, PUT, POST, DELETE).`);
|
|
26
|
+
}
|
|
27
|
+
return verb;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Makes a space, collection, or resource world-readable (the
|
|
32
|
+
* `PublicCanRead` policy) and prints its public URL -- the "share via
|
|
33
|
+
* public link" case.
|
|
34
|
+
*
|
|
35
|
+
* @param options {object}
|
|
36
|
+
* @param options.address {string} A space/collection/resource address.
|
|
37
|
+
* @param [options.server] {string} The server base URL.
|
|
38
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
39
|
+
* @returns {Promise<number>} The process exit code.
|
|
40
|
+
*/
|
|
41
|
+
export async function runPublish(options) {
|
|
42
|
+
try {
|
|
43
|
+
const target = await resolveWasTarget({
|
|
44
|
+
address: options.address,
|
|
45
|
+
server: options.server,
|
|
46
|
+
did: options.did
|
|
47
|
+
});
|
|
48
|
+
const { handle, url } = handleForTarget(target);
|
|
49
|
+
await handle.setPublic();
|
|
50
|
+
console.error(`Published (world-readable): ${url}`);
|
|
51
|
+
console.log(url);
|
|
52
|
+
return 0;
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
return reportError({ action: 'publish the path', err });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Reverts a published space, collection, or resource to capability-only
|
|
60
|
+
* access (clears its policy). Idempotent.
|
|
61
|
+
*
|
|
62
|
+
* @param options {object}
|
|
63
|
+
* @param options.address {string} A space/collection/resource address.
|
|
64
|
+
* @param [options.server] {string} The server base URL.
|
|
65
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
66
|
+
* @returns {Promise<number>} The process exit code.
|
|
67
|
+
*/
|
|
68
|
+
export async function runUnpublish(options) {
|
|
69
|
+
try {
|
|
70
|
+
const target = await resolveWasTarget({
|
|
71
|
+
address: options.address,
|
|
72
|
+
server: options.server,
|
|
73
|
+
did: options.did
|
|
74
|
+
});
|
|
75
|
+
const { handle, url } = handleForTarget(target);
|
|
76
|
+
await handle.clearPolicy();
|
|
77
|
+
console.error(`Unpublished (capability-only access): ${url}`);
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
return reportError({ action: 'unpublish the path', err });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Delegates access to a space, collection, or resource: signs a capability
|
|
86
|
+
* for the `--to` DID with the given actions and expiration, and prints
|
|
87
|
+
* `{ delegatedCapability, encoded }` (the same shape as `zcap delegate`).
|
|
88
|
+
* `--save` stores the capability in the local zcap store
|
|
89
|
+
* (`~/.config/did-cli-wallet/zcaps/`).
|
|
90
|
+
*
|
|
91
|
+
* @param options {object}
|
|
92
|
+
* @param options.address {string} The space/collection/resource address.
|
|
93
|
+
* @param options.to {string} The delegatee DID (or stored-DID handle).
|
|
94
|
+
* @param options.action {string[]} Allowed actions (HTTP verbs; lowercase
|
|
95
|
+
* accepted).
|
|
96
|
+
* @param [options.ttl] {string} Time-to-live for expiration (default 1y).
|
|
97
|
+
* @param [options.expires] {string} Explicit ISO 8601 expiration
|
|
98
|
+
* (overrides --ttl).
|
|
99
|
+
* @param [options.save] {boolean} Save the capability to the zcap store.
|
|
100
|
+
* @param [options.handle] {string} Short tag for the saved zcap.
|
|
101
|
+
* @param [options.description] {string} Longer description for the saved
|
|
102
|
+
* zcap.
|
|
103
|
+
* @param [options.server] {string} The server base URL.
|
|
104
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
105
|
+
* @returns {Promise<number>} The process exit code.
|
|
106
|
+
*/
|
|
107
|
+
export async function runGrant(options) {
|
|
108
|
+
try {
|
|
109
|
+
const actions = normalizeActions(options.action);
|
|
110
|
+
const delegatee = await resolveDidRef({ ref: options.to });
|
|
111
|
+
if (!delegatee) {
|
|
112
|
+
throw new Error(`No locally stored DID found for "${options.to}".`);
|
|
113
|
+
}
|
|
114
|
+
const expires = options.expires ?? expiresFromTtl(options.ttl ?? '1y').toISOString();
|
|
115
|
+
const target = await resolveWasTarget({
|
|
116
|
+
address: options.address,
|
|
117
|
+
server: options.server,
|
|
118
|
+
did: options.did
|
|
119
|
+
});
|
|
120
|
+
const url = wasUrl({
|
|
121
|
+
server: target.server,
|
|
122
|
+
spaceId: target.spaceId,
|
|
123
|
+
collectionId: target.collectionId,
|
|
124
|
+
resourceId: target.resourceId
|
|
125
|
+
});
|
|
126
|
+
const delegatedCapability = await target.client.grant({
|
|
127
|
+
to: delegatee,
|
|
128
|
+
actions,
|
|
129
|
+
expires,
|
|
130
|
+
target: url
|
|
131
|
+
});
|
|
132
|
+
const encoded = encodeCapability(delegatedCapability);
|
|
133
|
+
if (options.save) {
|
|
134
|
+
const storageId = storageIdFor(delegatedCapability.id);
|
|
135
|
+
const filePath = await saveToCollection('zcaps', storageId, delegatedCapability);
|
|
136
|
+
await writeCreateMeta({
|
|
137
|
+
storageId,
|
|
138
|
+
created: new Date().toISOString(),
|
|
139
|
+
handle: options.handle,
|
|
140
|
+
description: options.description
|
|
141
|
+
});
|
|
142
|
+
console.error(`Capability saved to ${filePath}`);
|
|
143
|
+
}
|
|
144
|
+
console.log(JSON.stringify({ delegatedCapability, encoded }, null, 2));
|
|
145
|
+
return 0;
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
return reportError({ action: 'grant access', err });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../src/commands/was/publish.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAElE,qEAAqE;AACrE,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAA;AAG7D;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,OAA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mBAAmB,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;YACpD,EAAE,EAAE,SAAS;YACb,OAAO;YACP,OAAO;YACP,MAAM,EAAE,GAAG;SACZ,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,gBAAgB,CAAC,mBAAmB,CAAC,CAAA;QACrD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,SAAS,GAAG,YAAY,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAA;YACtD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CACrC,OAAO,EACP,SAAS,EACT,mBAAmB,CACpB,CAAA;YACD,MAAM,eAAe,CAAC;gBACpB,SAAS;gBACT,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACjC,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,WAAW,EAAE,OAAO,CAAC,WAAW;aACjC,CAAC,CAAA;YACF,OAAO,CAAC,KAAK,CAAC,uBAAuB,QAAQ,EAAE,CAAC,CAAA;QAClD,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,mBAAmB,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QACtE,OAAO,CAAC,CAAA;IACV,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,WAAW,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,CAAA;IACrD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds a resource to a collection (server-generated id) and prints the
|
|
3
|
+
* `{ id, url, contentType }` add result. The collection comes from a path
|
|
4
|
+
* or a `--capability` targeting one.
|
|
5
|
+
*
|
|
6
|
+
* @param options {object}
|
|
7
|
+
* @param [options.address] {string} The collection address.
|
|
8
|
+
* @param [options.capability] {string} A capability reference instead of
|
|
9
|
+
* a path.
|
|
10
|
+
* @param [options.file] {string} The payload file; stdin when omitted.
|
|
11
|
+
* @param [options.contentType] {string} Explicit payload content type.
|
|
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 runResourceAdd(options: {
|
|
17
|
+
address?: string;
|
|
18
|
+
capability?: string;
|
|
19
|
+
file?: string;
|
|
20
|
+
contentType?: string;
|
|
21
|
+
server?: string;
|
|
22
|
+
did?: string;
|
|
23
|
+
}): Promise<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates or replaces a resource at a known id (upsert) and prints
|
|
26
|
+
* `{ id, url }`. The resource comes from a path or a `--capability`
|
|
27
|
+
* targeting one.
|
|
28
|
+
*
|
|
29
|
+
* @param options {object}
|
|
30
|
+
* @param [options.address] {string} The resource address.
|
|
31
|
+
* @param [options.capability] {string} A capability reference instead of
|
|
32
|
+
* a path.
|
|
33
|
+
* @param [options.file] {string} The payload file; stdin when omitted.
|
|
34
|
+
* @param [options.contentType] {string} Explicit payload content type.
|
|
35
|
+
* @param [options.server] {string} The server base URL.
|
|
36
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
37
|
+
* @returns {Promise<number>} The process exit code.
|
|
38
|
+
*/
|
|
39
|
+
export declare function runResourcePut(options: {
|
|
40
|
+
address?: string;
|
|
41
|
+
capability?: string;
|
|
42
|
+
file?: string;
|
|
43
|
+
contentType?: string;
|
|
44
|
+
server?: string;
|
|
45
|
+
did?: string;
|
|
46
|
+
}): Promise<number>;
|
|
47
|
+
/**
|
|
48
|
+
* Reads a resource: JSON pretty-printed to stdout, binary written raw
|
|
49
|
+
* (`--output` for files). The resource comes from a path or a
|
|
50
|
+
* `--capability` targeting one.
|
|
51
|
+
*
|
|
52
|
+
* @param options {object}
|
|
53
|
+
* @param [options.address] {string} The resource address.
|
|
54
|
+
* @param [options.capability] {string} A capability reference instead of
|
|
55
|
+
* a path.
|
|
56
|
+
* @param [options.output] {string} The output file path; stdout when
|
|
57
|
+
* omitted.
|
|
58
|
+
* @param [options.server] {string} The server base URL.
|
|
59
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
60
|
+
* @returns {Promise<number>} The process exit code.
|
|
61
|
+
*/
|
|
62
|
+
export declare function runResourceGet(options: {
|
|
63
|
+
address?: string;
|
|
64
|
+
capability?: string;
|
|
65
|
+
output?: string;
|
|
66
|
+
server?: string;
|
|
67
|
+
did?: string;
|
|
68
|
+
}): Promise<number>;
|
|
69
|
+
/**
|
|
70
|
+
* Reads a resource's metadata object (server-managed `contentType` / `size` /
|
|
71
|
+
* timestamps plus the user-writable `custom`) and pretty-prints it. The
|
|
72
|
+
* resource comes from a path or a `--capability` targeting one.
|
|
73
|
+
*
|
|
74
|
+
* @param options {object}
|
|
75
|
+
* @param [options.address] {string} The resource address.
|
|
76
|
+
* @param [options.capability] {string} A capability reference instead of
|
|
77
|
+
* a path.
|
|
78
|
+
* @param [options.server] {string} The server base URL.
|
|
79
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
80
|
+
* @returns {Promise<number>} The process exit code.
|
|
81
|
+
*/
|
|
82
|
+
export declare function runResourceMetaGet(options: {
|
|
83
|
+
address?: string;
|
|
84
|
+
capability?: string;
|
|
85
|
+
server?: string;
|
|
86
|
+
did?: string;
|
|
87
|
+
}): Promise<number>;
|
|
88
|
+
/**
|
|
89
|
+
* Updates a resource's user-writable metadata and prints the resulting
|
|
90
|
+
* metadata. `--name`/`--tag` are read-modify-write sugar that preserve the
|
|
91
|
+
* other field; giving both, or `--json`, is a full `custom` replacement so
|
|
92
|
+
* any omitted property is cleared. The resource comes from a path or a
|
|
93
|
+
* `--capability` targeting one.
|
|
94
|
+
*
|
|
95
|
+
* @param options {object}
|
|
96
|
+
* @param [options.address] {string} The resource address.
|
|
97
|
+
* @param [options.capability] {string} A capability reference instead of
|
|
98
|
+
* a path.
|
|
99
|
+
* @param [options.name] {string} The resource's display name.
|
|
100
|
+
* @param options.tag {string[]} Repeatable `key=value` tag pairs.
|
|
101
|
+
* @param [options.json] {string} Full `custom` JSON (inline or a file
|
|
102
|
+
* path); mutually exclusive with `--name`/`--tag`.
|
|
103
|
+
* @param [options.server] {string} The server base URL.
|
|
104
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
105
|
+
* @returns {Promise<number>} The process exit code.
|
|
106
|
+
*/
|
|
107
|
+
export declare function runResourceMetaPut(options: {
|
|
108
|
+
address?: string;
|
|
109
|
+
capability?: string;
|
|
110
|
+
name?: string;
|
|
111
|
+
tag: string[];
|
|
112
|
+
json?: string;
|
|
113
|
+
server?: string;
|
|
114
|
+
did?: string;
|
|
115
|
+
}): Promise<number>;
|
|
116
|
+
/**
|
|
117
|
+
* Lists the resources in a collection.
|
|
118
|
+
*
|
|
119
|
+
* @param options {object}
|
|
120
|
+
* @param options.address {string} The collection address.
|
|
121
|
+
* @param [options.json] {boolean} Output the raw listing JSON.
|
|
122
|
+
* @param [options.plain] {boolean} Output one resource id per line.
|
|
123
|
+
* @param [options.server] {string} The server base URL.
|
|
124
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
125
|
+
* @returns {Promise<number>} The process exit code.
|
|
126
|
+
*/
|
|
127
|
+
export declare function runResourceList(options: {
|
|
128
|
+
address: string;
|
|
129
|
+
json?: boolean;
|
|
130
|
+
plain?: boolean;
|
|
131
|
+
server?: string;
|
|
132
|
+
did?: string;
|
|
133
|
+
}): Promise<number>;
|
|
134
|
+
/**
|
|
135
|
+
* Deletes a resource on the server. Idempotent.
|
|
136
|
+
*
|
|
137
|
+
* @param options {object}
|
|
138
|
+
* @param options.address {string} The resource address.
|
|
139
|
+
* @param [options.server] {string} The server base URL.
|
|
140
|
+
* @param [options.did] {string} The signing DID or stored-DID handle.
|
|
141
|
+
* @returns {Promise<number>} The process exit code.
|
|
142
|
+
*/
|
|
143
|
+
export declare function runResourceDelete(options: {
|
|
144
|
+
address: string;
|
|
145
|
+
server?: string;
|
|
146
|
+
did?: string;
|
|
147
|
+
}): Promise<number>;
|
|
148
|
+
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/commands/was/resource.ts"],"names":[],"mappings":"AAoFA;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CA2ClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBlB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,OA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