@interop/did-cli 0.7.1 → 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.
Files changed (57) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +141 -6
  3. package/dist/commands/did.d.ts.map +1 -1
  4. package/dist/commands/did.js +41 -12
  5. package/dist/commands/did.js.map +1 -1
  6. package/dist/commands/key.d.ts.map +1 -1
  7. package/dist/commands/key.js +46 -8
  8. package/dist/commands/key.js.map +1 -1
  9. package/dist/commands/was/collection.d.ts +121 -0
  10. package/dist/commands/was/collection.d.ts.map +1 -0
  11. package/dist/commands/was/collection.js +316 -0
  12. package/dist/commands/was/collection.js.map +1 -0
  13. package/dist/commands/was/policy.d.ts +50 -0
  14. package/dist/commands/was/policy.d.ts.map +1 -0
  15. package/dist/commands/was/policy.js +133 -0
  16. package/dist/commands/was/policy.js.map +1 -0
  17. package/dist/commands/was/publish.d.ts +67 -0
  18. package/dist/commands/was/publish.d.ts.map +1 -0
  19. package/dist/commands/was/publish.js +151 -0
  20. package/dist/commands/was/publish.js.map +1 -0
  21. package/dist/commands/was/resource.d.ts +148 -0
  22. package/dist/commands/was/resource.d.ts.map +1 -0
  23. package/dist/commands/was/resource.js +402 -0
  24. package/dist/commands/was/resource.js.map +1 -0
  25. package/dist/commands/was/shared.d.ts +156 -0
  26. package/dist/commands/was/shared.d.ts.map +1 -0
  27. package/dist/commands/was/shared.js +237 -0
  28. package/dist/commands/was/shared.js.map +1 -0
  29. package/dist/commands/was/space.d.ts +196 -0
  30. package/dist/commands/was/space.d.ts.map +1 -0
  31. package/dist/commands/was/space.js +516 -0
  32. package/dist/commands/was/space.js.map +1 -0
  33. package/dist/commands/was/tree.d.ts +44 -0
  34. package/dist/commands/was/tree.d.ts.map +1 -0
  35. package/dist/commands/was/tree.js +135 -0
  36. package/dist/commands/was/tree.js.map +1 -0
  37. package/dist/commands/was.d.ts +29 -496
  38. package/dist/commands/was.d.ts.map +1 -1
  39. package/dist/commands/was.js +84 -1473
  40. package/dist/commands/was.js.map +1 -1
  41. package/dist/commands/zcap.d.ts +22 -2
  42. package/dist/commands/zcap.d.ts.map +1 -1
  43. package/dist/commands/zcap.js +6 -20
  44. package/dist/commands/zcap.js.map +1 -1
  45. package/dist/meta.js +1 -1
  46. package/dist/meta.js.map +1 -1
  47. package/dist/was/capability.d.ts +10 -13
  48. package/dist/was/capability.d.ts.map +1 -1
  49. package/dist/was/capability.js +1 -59
  50. package/dist/was/capability.js.map +1 -1
  51. package/dist/zcap/delegate.d.ts +2 -2
  52. package/dist/zcap/delegate.js +2 -2
  53. package/dist/zcap/resolve.d.ts +15 -0
  54. package/dist/zcap/resolve.d.ts.map +1 -0
  55. package/dist/zcap/resolve.js +55 -0
  56. package/dist/zcap/resolve.js.map +1 -0
  57. package/package.json +15 -14
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Shared helpers for the `was` command group: option factories, address
3
+ * parsing/assertion, URL building, error reporting, listing renderers, and
4
+ * the run-and-exit wrapper. Commander `Option` instances are bound to the
5
+ * command they are added to, so the options are exposed as factories.
6
+ */
7
+ import { Option } from 'commander';
8
+ import { WasError } from '@interop/was-client';
9
+ import { parseWasAddress } from '../../was/address.js';
10
+ import { renderTable } from '../../table.js';
11
+ /**
12
+ * Awaits a command's run function and exits the process with its code when
13
+ * non-zero -- the shared tail of every `was` command action.
14
+ *
15
+ * @param run {Promise<number>}
16
+ * @returns {Promise<void>}
17
+ */
18
+ export async function runAndExit(run) {
19
+ const code = await run;
20
+ if (code !== 0) {
21
+ process.exit(code);
22
+ }
23
+ }
24
+ /**
25
+ * The shared command options, as factories (commander `Option` instances
26
+ * are bound to the command they are added to, so they cannot be shared).
27
+ * Centralizing them keeps the flag names and help text consistent across
28
+ * the whole command tree.
29
+ *
30
+ * @returns {Option}
31
+ */
32
+ export function serverOption() {
33
+ return new Option('--server <url>', 'the WAS server base URL (or WAS_SERVER_URL)');
34
+ }
35
+ export function didOption() {
36
+ return new Option('--did <did>', 'DID or stored-DID handle to sign with (or WAS_DID)');
37
+ }
38
+ export function capabilityOption() {
39
+ return new Option('--capability <ref>', 'a received capability (encoded string, JSON file, or stored zcap ' +
40
+ 'id/handle) instead of a path');
41
+ }
42
+ export function contentTypeOption() {
43
+ return new Option('--content-type <type>', 'send the payload as-is with this content type (skips JSON detection)');
44
+ }
45
+ /**
46
+ * Guards a run function against receiving both path- and capability-based
47
+ * addressing (or neither).
48
+ *
49
+ * @param options {object}
50
+ * @param [options.address] {string}
51
+ * @param [options.capability] {string}
52
+ * @returns {void}
53
+ */
54
+ export function assertOneAddressing({ address, capability }) {
55
+ if (address && capability) {
56
+ throw new Error('Provide either a path or --capability, not both.');
57
+ }
58
+ if (!address && !capability) {
59
+ throw new Error('Provide a path or --capability.');
60
+ }
61
+ }
62
+ /**
63
+ * Builds the canonical URL of a space, collection, or resource on its
64
+ * server, for messages and output.
65
+ *
66
+ * @param options {object}
67
+ * @param options.server {string}
68
+ * @param options.spaceId {string}
69
+ * @param [options.collectionId] {string}
70
+ * @param [options.resourceId] {string}
71
+ * @returns {string}
72
+ */
73
+ export function wasUrl({ server, spaceId, collectionId, resourceId }) {
74
+ const segments = [spaceId, collectionId, resourceId]
75
+ .filter((segment) => segment !== undefined)
76
+ .map(encodeURIComponent);
77
+ return `${server.replace(/\/$/, '')}/space/${segments.join('/')}`;
78
+ }
79
+ /**
80
+ * Prints a one-line error for a failed command and classifies its exit code:
81
+ * 1 for operation errors (typed WAS errors from the server exchange), 2 for
82
+ * input errors (bad addresses, unknown handles/DIDs, missing server URL).
83
+ *
84
+ * @param options {object}
85
+ * @param options.action {string} What failed, e.g. `create the space`.
86
+ * @param options.err {unknown}
87
+ * @returns {number} The process exit code.
88
+ */
89
+ export function reportError({ action, err }) {
90
+ const message = err instanceof Error ? err.message : String(err);
91
+ console.error(`Could not ${action}: ${message}`);
92
+ return err instanceof WasError ? 1 : 2;
93
+ }
94
+ /**
95
+ * Parses a WAS address and asserts it addresses a space only (no
96
+ * collection/resource segments), as the `space` subcommands require.
97
+ *
98
+ * @param address {string}
99
+ * @returns {{server?: string, spaceRef: string}}
100
+ */
101
+ export function parseSpaceAddress(address) {
102
+ const parsed = parseWasAddress(address);
103
+ if (parsed.collectionId !== undefined) {
104
+ throw new Error(`"${address}" addresses a collection or resource; ` +
105
+ 'space commands take a space address.');
106
+ }
107
+ return parsed;
108
+ }
109
+ /**
110
+ * Asserts a resolved target addresses a collection (`SPACE/COLLECTION`,
111
+ * no resource segment) and narrows its type accordingly.
112
+ *
113
+ * @param options {object}
114
+ * @param options.target {ResolvedWasTarget}
115
+ * @param options.address {string} The original address, for error messages.
116
+ * @returns {ResolvedWasTarget & {collectionId: string}}
117
+ */
118
+ export function requireCollectionTarget({ target, address }) {
119
+ if (target.collectionId === undefined || target.resourceId !== undefined) {
120
+ throw new Error(`"${address}" must address a collection (SPACE/COLLECTION).`);
121
+ }
122
+ return target;
123
+ }
124
+ /**
125
+ * Asserts a resolved target addresses a resource
126
+ * (`SPACE/COLLECTION/RESOURCE`) and narrows its type accordingly.
127
+ *
128
+ * @param options {object}
129
+ * @param options.target {ResolvedWasTarget}
130
+ * @param options.address {string} The original address, for error messages.
131
+ * @returns {ResolvedWasTarget & {collectionId: string, resourceId: string}}
132
+ */
133
+ export function requireResourceTarget({ target, address }) {
134
+ if (target.collectionId === undefined || target.resourceId === undefined) {
135
+ throw new Error(`"${address}" must address a resource (SPACE/COLLECTION/RESOURCE).`);
136
+ }
137
+ return target;
138
+ }
139
+ /**
140
+ * Renders a listing as a table, raw JSON, or one item id per line -- the
141
+ * shared output logic of `collection list`, `resource list`, and `ls`.
142
+ *
143
+ * @param options {object}
144
+ * @param options.listing {{items: T[]}}
145
+ * @param [options.json] {boolean}
146
+ * @param [options.plain] {boolean}
147
+ * @param options.columns {Column[]}
148
+ * @param options.toRow {(item: T) => string[]}
149
+ * @returns {void}
150
+ */
151
+ function printListing({ listing, json, plain, columns, toRow }) {
152
+ if (json) {
153
+ console.log(JSON.stringify(listing, null, 2));
154
+ return;
155
+ }
156
+ if (plain) {
157
+ const ids = listing.items.map(item => item.id).sort();
158
+ for (const id of ids) {
159
+ console.log(id);
160
+ }
161
+ return;
162
+ }
163
+ if (listing.items.length === 0) {
164
+ return;
165
+ }
166
+ console.log(renderTable({ columns, rows: listing.items.map(toRow) }));
167
+ }
168
+ /**
169
+ * Renders a collection listing as a table, raw JSON, or one id per line.
170
+ *
171
+ * @param options {object}
172
+ * @param options.listing {CollectionsList}
173
+ * @param [options.json] {boolean}
174
+ * @param [options.plain] {boolean}
175
+ * @returns {void}
176
+ */
177
+ export function printCollectionListing({ listing, json, plain }) {
178
+ printListing({
179
+ listing,
180
+ json,
181
+ plain,
182
+ columns: [
183
+ { header: 'ID', maxWidth: 30 },
184
+ { header: 'NAME', maxWidth: 20 },
185
+ { header: 'URL' }
186
+ ],
187
+ toRow: item => [item.id, item.name, item.url]
188
+ });
189
+ }
190
+ /**
191
+ * Renders a resource listing as a table, raw JSON, or one id per line.
192
+ *
193
+ * @param options {object}
194
+ * @param options.listing {CollectionResourcesList}
195
+ * @param [options.json] {boolean}
196
+ * @param [options.plain] {boolean}
197
+ * @returns {void}
198
+ */
199
+ export function printResourceListing({ listing, json, plain }) {
200
+ printListing({
201
+ listing,
202
+ json,
203
+ plain,
204
+ columns: [
205
+ { header: 'ID', maxWidth: 30 },
206
+ { header: 'CONTENT TYPE', maxWidth: 24 },
207
+ { header: 'URL' }
208
+ ],
209
+ toRow: item => [item.id, item.contentType, item.url]
210
+ });
211
+ }
212
+ /**
213
+ * Builds the access handle (space, collection, or resource) a resolved
214
+ * target addresses, together with its URL. Policies and publishing work at
215
+ * every depth, so these commands dispatch through this helper.
216
+ *
217
+ * @param target {ResolvedWasTarget}
218
+ * @returns {{handle: Space | Collection | Resource, url: string}}
219
+ */
220
+ export function handleForTarget(target) {
221
+ const url = wasUrl({
222
+ server: target.server,
223
+ spaceId: target.spaceId,
224
+ collectionId: target.collectionId,
225
+ resourceId: target.resourceId
226
+ });
227
+ const space = target.client.space(target.spaceId);
228
+ if (target.collectionId === undefined) {
229
+ return { handle: space, url };
230
+ }
231
+ const collection = space.collection(target.collectionId);
232
+ if (target.resourceId === undefined) {
233
+ return { handle: collection, url };
234
+ }
235
+ return { handle: collection.resource(target.resourceId), url };
236
+ }
237
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/commands/was/shared.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EACL,QAAQ,EAMT,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAA;AAEzD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAoB;IACnD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAA;IACtB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACpB,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,MAAM,CACf,gBAAgB,EAChB,6CAA6C,CAC9C,CAAA;AACH,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,IAAI,MAAM,CACf,aAAa,EACb,oDAAoD,CACrD,CAAA;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,MAAM,CACf,oBAAoB,EACpB,mEAAmE;QACjE,8BAA8B,CACjC,CAAA;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,IAAI,MAAM,CACf,uBAAuB,EACvB,sEAAsE,CACvE,CAAA;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB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AIvD,MAAM,GAAG,GAAG,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC,CAAA;IACF,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjD,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;IAC/B,CAAC;IACD,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;IACxD,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,CAAA;IACpC,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;AAChE,CAAC"}
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Creates a space on the server and prints `{ id, url, name?, controller }`.
3
+ *
4
+ * @param options {object}
5
+ * @param [options.name] {string} The space's display name.
6
+ * @param [options.server] {string} The server base URL.
7
+ * @param [options.did] {string} The signing DID or stored-DID handle.
8
+ * @param [options.id] {string} A caller-chosen space id.
9
+ * @param [options.save] {boolean} Register the space in the local wallet.
10
+ * @param [options.handle] {string} Short tag for the registry entry.
11
+ * @param [options.description] {string} Longer registry entry description.
12
+ * @returns {Promise<number>} The process exit code.
13
+ */
14
+ export declare function runSpaceCreate(options: {
15
+ name?: string;
16
+ server?: string;
17
+ did?: string;
18
+ id?: string;
19
+ save?: boolean;
20
+ handle?: string;
21
+ description?: string;
22
+ }): Promise<number>;
23
+ /**
24
+ * Lists the locally registered spaces (the working model while servers do
25
+ * not implement List Spaces); `--remote` asks the server instead.
26
+ *
27
+ * @param options {object}
28
+ * @param [options.json] {boolean} Output a JSON array with metadata.
29
+ * @param [options.plain] {boolean} Output one space id per line.
30
+ * @param [options.remote] {boolean} List spaces on the server instead.
31
+ * @param [options.server] {string} The server base URL (with `--remote`).
32
+ * @param [options.did] {string} The signing DID (with `--remote`).
33
+ * @returns {Promise<number>} The process exit code.
34
+ */
35
+ export declare function runSpaceList(options: {
36
+ json?: boolean;
37
+ plain?: boolean;
38
+ remote?: boolean;
39
+ server?: string;
40
+ did?: string;
41
+ }): Promise<number>;
42
+ /**
43
+ * Shows a space: its Space Description from the server, or (`--meta`) its
44
+ * local registry record and metadata.
45
+ *
46
+ * @param options {object}
47
+ * @param options.address {string} The space address.
48
+ * @param [options.meta] {boolean} Show the local registry metadata instead.
49
+ * @param [options.json] {boolean} With `--meta`, output JSON.
50
+ * @param [options.server] {string} The server base URL.
51
+ * @param [options.did] {string} The signing DID or stored-DID handle.
52
+ * @returns {Promise<number>} The process exit code.
53
+ */
54
+ export declare function runSpaceShow(options: {
55
+ address: string;
56
+ meta?: boolean;
57
+ json?: boolean;
58
+ server?: string;
59
+ did?: string;
60
+ }): Promise<number>;
61
+ /**
62
+ * Updates a space's description fields on the server (upsert via
63
+ * `configure()`), refreshing the name in the local registry entry when one
64
+ * exists.
65
+ *
66
+ * @param options {object}
67
+ * @param options.address {string} The space address.
68
+ * @param [options.name] {string} The new display name.
69
+ * @param [options.server] {string} The server base URL.
70
+ * @param [options.did] {string} The signing DID or stored-DID handle.
71
+ * @returns {Promise<number>} The process exit code.
72
+ */
73
+ export declare function runSpaceUpdate(options: {
74
+ address: string;
75
+ name?: string;
76
+ server?: string;
77
+ did?: string;
78
+ }): Promise<number>;
79
+ /**
80
+ * Deletes a space on the server (idempotent) and removes its local registry
81
+ * entry when one exists. The local-only counterpart is `forget`.
82
+ *
83
+ * @param options {object}
84
+ * @param options.address {string} The space address.
85
+ * @param [options.server] {string} The server base URL.
86
+ * @param [options.did] {string} The signing DID or stored-DID handle.
87
+ * @returns {Promise<number>} The process exit code.
88
+ */
89
+ export declare function runSpaceDelete(options: {
90
+ address: string;
91
+ server?: string;
92
+ did?: string;
93
+ }): Promise<number>;
94
+ /**
95
+ * Removes a space's local registry entry only; the server-side space is
96
+ * untouched. The remote counterpart is `delete`.
97
+ *
98
+ * @param options {object}
99
+ * @param options.address {string} The space address.
100
+ * @returns {Promise<number>} The process exit code.
101
+ */
102
+ export declare function runSpaceForget(options: {
103
+ address: string;
104
+ }): Promise<number>;
105
+ /**
106
+ * Registers an existing remote space (e.g. created elsewhere or received via
107
+ * delegation) in the local registry, verifying it first with `describe()`.
108
+ *
109
+ * @param options {object}
110
+ * @param options.address {string} A full space https URL or a bare space id.
111
+ * @param [options.server] {string} The server base URL (with a bare id).
112
+ * @param [options.did] {string} The signing DID or stored-DID handle.
113
+ * @param [options.handle] {string} Short tag for the registry entry.
114
+ * @param [options.description] {string} Longer registry entry description.
115
+ * @returns {Promise<number>} The process exit code.
116
+ */
117
+ export declare function runSpaceAdd(options: {
118
+ address: string;
119
+ server?: string;
120
+ did?: string;
121
+ handle?: string;
122
+ description?: string;
123
+ }): Promise<number>;
124
+ /**
125
+ * Lists the storage backends available within a space. The reference server
126
+ * ships a single server-configured backend (registered as `default`); a
127
+ * server without backend support returns `null` (a 501), reported as an
128
+ * error.
129
+ *
130
+ * @param options {object}
131
+ * @param options.address {string} The space address.
132
+ * @param [options.json] {boolean} Output the raw backends JSON.
133
+ * @param [options.server] {string} The server base URL.
134
+ * @param [options.did] {string} The signing DID or stored-DID handle.
135
+ * @returns {Promise<number>} The process exit code.
136
+ */
137
+ export declare function runSpaceBackends(options: {
138
+ address: string;
139
+ json?: boolean;
140
+ server?: string;
141
+ did?: string;
142
+ }): Promise<number>;
143
+ /**
144
+ * Shows a space's storage quota report, grouped by backend (one row per
145
+ * backend: state, usage, limit, and any restricted actions). A server
146
+ * without quota support returns `null` (a 501), reported as an error.
147
+ *
148
+ * @param options {object}
149
+ * @param options.address {string} The space address.
150
+ * @param [options.json] {boolean} Output the raw quota report JSON.
151
+ * @param [options.server] {string} The server base URL.
152
+ * @param [options.did] {string} The signing DID or stored-DID handle.
153
+ * @returns {Promise<number>} The process exit code.
154
+ */
155
+ export declare function runSpaceQuotas(options: {
156
+ address: string;
157
+ json?: boolean;
158
+ server?: string;
159
+ did?: string;
160
+ }): Promise<number>;
161
+ /**
162
+ * Exports a whole space as a tar archive, written to `--output` or raw to
163
+ * stdout.
164
+ *
165
+ * @param options {object}
166
+ * @param options.address {string} The space address.
167
+ * @param [options.output] {string} The output file path; stdout when
168
+ * omitted.
169
+ * @param [options.server] {string} The server base URL.
170
+ * @param [options.did] {string} The signing DID or stored-DID handle.
171
+ * @returns {Promise<number>} The process exit code.
172
+ */
173
+ export declare function runSpaceExport(options: {
174
+ address: string;
175
+ output?: string;
176
+ server?: string;
177
+ did?: string;
178
+ }): Promise<number>;
179
+ /**
180
+ * Imports (merges) a tar archive into a space and prints the import stats
181
+ * summary.
182
+ *
183
+ * @param options {object}
184
+ * @param options.address {string} The space address.
185
+ * @param [options.file] {string} The tar file; stdin when omitted.
186
+ * @param [options.server] {string} The server base URL.
187
+ * @param [options.did] {string} The signing DID or stored-DID handle.
188
+ * @returns {Promise<number>} The process exit code.
189
+ */
190
+ export declare function runSpaceImport(options: {
191
+ address: string;
192
+ file?: string;
193
+ server?: string;
194
+ did?: string;
195
+ }): Promise<number>;
196
+ //# sourceMappingURL=space.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../src/commands/was/space.ts"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,EAAE,CAAC,E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