@enbox/api 0.3.2 → 0.4.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 (102) hide show
  1. package/README.md +63 -0
  2. package/dist/browser.mjs +11 -28
  3. package/dist/browser.mjs.map +4 -4
  4. package/dist/esm/advanced.js +1 -1
  5. package/dist/esm/define-protocol.js +3 -3
  6. package/dist/esm/did-api.js +1 -1
  7. package/dist/esm/did-api.js.map +1 -1
  8. package/dist/esm/dwn-api.js +6 -6
  9. package/dist/esm/dwn-api.js.map +1 -1
  10. package/dist/esm/dwn-reader-api.js +2 -2
  11. package/dist/esm/enbox.js +205 -0
  12. package/dist/esm/enbox.js.map +1 -0
  13. package/dist/esm/index.js +16 -15
  14. package/dist/esm/index.js.map +1 -1
  15. package/dist/esm/protocol.js +2 -2
  16. package/dist/esm/protocol.js.map +1 -1
  17. package/dist/esm/record-data.js +79 -5
  18. package/dist/esm/record-data.js.map +1 -1
  19. package/dist/esm/record.js +49 -10
  20. package/dist/esm/record.js.map +1 -1
  21. package/dist/esm/repository.js +7 -7
  22. package/dist/esm/repository.js.map +1 -1
  23. package/dist/esm/typed-enbox.js +583 -0
  24. package/dist/esm/typed-enbox.js.map +1 -0
  25. package/dist/esm/typed-live-query.js +1 -1
  26. package/dist/esm/typed-record.js +370 -46
  27. package/dist/esm/typed-record.js.map +1 -1
  28. package/dist/esm/utils.js +25 -0
  29. package/dist/esm/utils.js.map +1 -1
  30. package/dist/esm/vc-api.js.map +1 -1
  31. package/dist/types/advanced.d.ts +1 -1
  32. package/dist/types/define-protocol.d.ts +3 -3
  33. package/dist/types/did-api.d.ts +4 -4
  34. package/dist/types/did-api.d.ts.map +1 -1
  35. package/dist/types/dwn-api.d.ts +12 -7
  36. package/dist/types/dwn-api.d.ts.map +1 -1
  37. package/dist/types/dwn-reader-api.d.ts +2 -2
  38. package/dist/types/enbox.d.ts +202 -0
  39. package/dist/types/enbox.d.ts.map +1 -0
  40. package/dist/types/grant-revocation.d.ts +2 -2
  41. package/dist/types/grant-revocation.d.ts.map +1 -1
  42. package/dist/types/index.d.ts +16 -15
  43. package/dist/types/index.d.ts.map +1 -1
  44. package/dist/types/live-query.d.ts +2 -2
  45. package/dist/types/live-query.d.ts.map +1 -1
  46. package/dist/types/permission-grant.d.ts +2 -2
  47. package/dist/types/permission-grant.d.ts.map +1 -1
  48. package/dist/types/permission-request.d.ts +2 -2
  49. package/dist/types/permission-request.d.ts.map +1 -1
  50. package/dist/types/protocol-types.d.ts +2 -2
  51. package/dist/types/protocol.d.ts +7 -7
  52. package/dist/types/protocol.d.ts.map +1 -1
  53. package/dist/types/record-data.d.ts +17 -0
  54. package/dist/types/record-data.d.ts.map +1 -1
  55. package/dist/types/record.d.ts +24 -10
  56. package/dist/types/record.d.ts.map +1 -1
  57. package/dist/types/repository-types.d.ts +19 -11
  58. package/dist/types/repository-types.d.ts.map +1 -1
  59. package/dist/types/repository.d.ts +7 -7
  60. package/dist/types/repository.d.ts.map +1 -1
  61. package/dist/types/typed-enbox.d.ts +613 -0
  62. package/dist/types/typed-enbox.d.ts.map +1 -0
  63. package/dist/types/typed-live-query.d.ts +1 -1
  64. package/dist/types/typed-record.d.ts +427 -53
  65. package/dist/types/typed-record.d.ts.map +1 -1
  66. package/dist/types/utils.d.ts +23 -0
  67. package/dist/types/utils.d.ts.map +1 -1
  68. package/dist/types/vc-api.d.ts +3 -3
  69. package/dist/types/vc-api.d.ts.map +1 -1
  70. package/package.json +12 -11
  71. package/src/advanced.ts +1 -1
  72. package/src/define-protocol.ts +3 -3
  73. package/src/did-api.ts +5 -5
  74. package/src/dwn-api.ts +22 -17
  75. package/src/dwn-reader-api.ts +2 -2
  76. package/src/enbox.ts +281 -0
  77. package/src/grant-revocation.ts +3 -3
  78. package/src/index.ts +17 -16
  79. package/src/live-query.ts +2 -2
  80. package/src/permission-grant.ts +4 -4
  81. package/src/permission-request.ts +3 -3
  82. package/src/protocol-types.ts +2 -2
  83. package/src/protocol.ts +8 -8
  84. package/src/record-data.ts +86 -5
  85. package/src/record.ts +54 -13
  86. package/src/repository-types.ts +19 -7
  87. package/src/repository.ts +15 -15
  88. package/src/typed-enbox.ts +1169 -0
  89. package/src/typed-live-query.ts +1 -1
  90. package/src/typed-record.ts +431 -53
  91. package/src/utils.ts +27 -0
  92. package/src/vc-api.ts +4 -4
  93. package/dist/esm/typed-web5.js +0 -339
  94. package/dist/esm/typed-web5.js.map +0 -1
  95. package/dist/esm/web5.js +0 -410
  96. package/dist/esm/web5.js.map +0 -1
  97. package/dist/types/typed-web5.d.ts +0 -221
  98. package/dist/types/typed-web5.d.ts.map +0 -1
  99. package/dist/types/web5.d.ts +0 -351
  100. package/dist/types/web5.d.ts.map +0 -1
  101. package/src/typed-web5.ts +0 -598
  102. package/src/web5.ts +0 -762
package/src/utils.ts CHANGED
@@ -1,5 +1,32 @@
1
+ import type { DwnResponseStatus } from '@enbox/agent';
1
2
  import { Convert, universalTypeOf } from '@enbox/common';
2
3
 
4
+ /**
5
+ * Returns `true` if the DWN response status indicates success (2xx code).
6
+ *
7
+ * Use this instead of manually checking `status.code >= 200 && status.code <= 299`
8
+ * on every API call.
9
+ *
10
+ * @param response - Any object that conforms to {@link DwnResponseStatus}.
11
+ * @returns `true` for 2xx status codes, `false` otherwise.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const result = await proto.records.create('note', { data: { text: 'hello' } });
16
+ * if (!isOk(result)) {
17
+ * console.error('Create failed:', result.status.detail);
18
+ * return;
19
+ * }
20
+ * // result.record is safe to use here
21
+ * ```
22
+ *
23
+ * @beta
24
+ */
25
+ export function isOk(response: DwnResponseStatus): boolean {
26
+ const code = response.status.code;
27
+ return code >= 200 && code <= 299;
28
+ }
29
+
3
30
  /**
4
31
  * Converts various data types to a `Blob` object, automatically detecting the data type or using
5
32
  * the specified `dataFormat` to set the Blob's MIME type.
package/src/vc-api.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Web5Agent } from '@enbox/agent';
1
+ import type { EnboxAgent } from '@enbox/agent';
2
2
 
3
3
  /**
4
4
  * The VC API is used to issue, present and verify VCs
@@ -7,15 +7,15 @@ import type { Web5Agent } from '@enbox/agent';
7
7
  */
8
8
  export class VcApi {
9
9
  /**
10
- * Holds the instance of a {@link Web5Agent} that represents the current execution context for
10
+ * Holds the instance of a {@link EnboxAgent} that represents the current execution context for
11
11
  * the `VcApi`. This agent is used to process VC requests.
12
12
  */
13
- private agent: Web5Agent;
13
+ private agent: EnboxAgent;
14
14
 
15
15
  /** The DID of the tenant under which DID operations are being performed. */
16
16
  private connectedDid: string;
17
17
 
18
- constructor(options: { agent: Web5Agent, connectedDid: string }) {
18
+ constructor(options: { agent: EnboxAgent, connectedDid: string }) {
19
19
  this.agent = options.agent;
20
20
  this.connectedDid = options.connectedDid;
21
21
  }
@@ -1,339 +0,0 @@
1
- /**
2
- * A protocol-scoped API returned by {@link Web5.using}.
3
- *
4
- * `TypedWeb5` is the **primary developer interface** for interacting with
5
- * protocol-backed records. It auto-injects the protocol URI, protocolPath,
6
- * and schema into every operation, and provides compile-time path
7
- * autocompletion plus typed data payloads via the schema map.
8
- *
9
- * All record-returning methods wrap the underlying `Record` instances in
10
- * {@link TypedRecord} so that type information flows through reads, queries,
11
- * updates, and subscriptions without manual casts.
12
- *
13
- * @example
14
- * ```ts
15
- * const social = web5.using(SocialProtocol);
16
- *
17
- * // Install the protocol
18
- * await social.configure();
19
- *
20
- * // Create — path and data type are checked at compile time
21
- * const { record } = await social.records.create('thread', {
22
- * data: { title: 'Hello World', body: '...' },
23
- * });
24
- * // record is TypedRecord<ThreadData>
25
- *
26
- * const data = await record.data.json(); // ThreadData — no cast needed
27
- *
28
- * // Query — protocol and protocolPath are auto-injected
29
- * const { records } = await social.records.query('thread');
30
- * // records is TypedRecord<ThreadData>[]
31
- *
32
- * // Subscribe — real-time changes via TypedLiveQuery
33
- * const { liveQuery } = await social.records.subscribe('thread/reply');
34
- * liveQuery.on('create', (record) => {
35
- * // record is TypedRecord<ReplyData>
36
- * });
37
- * ```
38
- */
39
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
40
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
- return new (P || (P = Promise))(function (resolve, reject) {
42
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
43
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
44
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
45
- step((generator = generator.apply(thisArg, _arguments || [])).next());
46
- });
47
- };
48
- import { TypedLiveQuery } from './typed-live-query.js';
49
- import { TypedRecord } from './typed-record.js';
50
- // ---------------------------------------------------------------------------
51
- // TypedWeb5 class
52
- // ---------------------------------------------------------------------------
53
- /**
54
- * A protocol-scoped API that auto-injects `protocol`, `protocolPath`, and
55
- * `schema` into every DWN operation.
56
- *
57
- * All record-returning methods wrap results in {@link TypedRecord} so that
58
- * the data type `T` (resolved from the schema map) flows end-to-end — from
59
- * write through read, query, update, and subscribe — without manual casts.
60
- *
61
- * Obtain an instance via `web5.using(typedProtocol)`.
62
- *
63
- * @example
64
- * ```ts
65
- * const social = web5.using(SocialProtocol);
66
- *
67
- * await social.configure();
68
- *
69
- * const { record } = await social.records.create('friend', {
70
- * data: { did: 'did:example:alice', alias: 'Alice' },
71
- * });
72
- * const data = await record.data.json(); // FriendData — no cast
73
- *
74
- * const { records } = await social.records.query('friend', {
75
- * filter: { tags: { did: 'did:example:alice' } },
76
- * });
77
- * for (const r of records) {
78
- * const d = await r.data.json(); // FriendData
79
- * }
80
- * ```
81
- */
82
- export class TypedWeb5 {
83
- constructor(dwn, protocol) {
84
- this._configured = false;
85
- this._dwn = dwn;
86
- this._definition = protocol.definition;
87
- this._validPaths = collectPaths(this._definition.structure);
88
- }
89
- /** The protocol URI. */
90
- get protocol() {
91
- return this._definition.protocol;
92
- }
93
- /** The raw protocol definition. */
94
- get definition() {
95
- return this._definition;
96
- }
97
- /**
98
- * Configures (installs) this protocol on the local DWN.
99
- *
100
- * If the protocol is already installed with an identical definition,
101
- * this is a no-op and returns the existing protocol. If the definition
102
- * has changed (e.g. new types, modified structure), the protocol is
103
- * re-configured with the updated definition.
104
- *
105
- * @param options - Optional overrides like `encryption`.
106
- */
107
- configure(options) {
108
- return __awaiter(this, void 0, void 0, function* () {
109
- // Query for an existing installation of this protocol.
110
- const { protocols } = yield this._dwn.protocols.query({
111
- filter: { protocol: this._definition.protocol },
112
- });
113
- // If already installed with the same definition, return it as-is.
114
- if (protocols.length > 0) {
115
- const existing = protocols[0];
116
- if (definitionsEqual(existing.definition, this._definition)) {
117
- this._configured = true;
118
- return { status: { code: 200, detail: 'OK' }, protocol: existing };
119
- }
120
- }
121
- // Not installed or definition has changed — configure the new version.
122
- const result = yield this._dwn.protocols.configure({
123
- definition: this._definition,
124
- encryption: options === null || options === void 0 ? void 0 : options.encryption,
125
- });
126
- if (result.status.code === 202) {
127
- this._configured = true;
128
- }
129
- return result;
130
- });
131
- }
132
- /** Whether the protocol has been configured (installed) on the local DWN. */
133
- get isConfigured() {
134
- return this._configured;
135
- }
136
- /**
137
- * Validates that the protocol has been configured and that the path is
138
- * recognized. Throws a descriptive error if either check fails.
139
- */
140
- _assertReady(path) {
141
- if (!this._configured) {
142
- throw new Error(`TypedWeb5: protocol '${this._definition.protocol}' has not been configured. ` +
143
- 'Call configure() before performing record operations.');
144
- }
145
- if (!this._validPaths.has(path)) {
146
- throw new Error(`TypedWeb5: invalid protocol path '${path}'. ` +
147
- `Valid paths are: ${[...this._validPaths].join(', ')}.`);
148
- }
149
- }
150
- /**
151
- * Protocol-scoped record operations.
152
- *
153
- * Every method auto-injects the protocol URI, protocolPath, and schema
154
- * from the protocol definition. Path parameters provide compile-time
155
- * autocompletion via `ProtocolPaths<D>`.
156
- *
157
- * All methods return {@link TypedRecord} or {@link TypedLiveQuery} instances
158
- * that carry the resolved data type from the schema map.
159
- */
160
- get records() {
161
- if (this._records !== undefined) {
162
- return this._records;
163
- }
164
- const cached = {
165
- /**
166
- * Create a new record at the given protocol path.
167
- *
168
- * @param path - The protocol path (e.g. `'friend'`, `'group/member'`).
169
- * @param request - Create options including typed `data`.
170
- */
171
- create: (path, request) => __awaiter(this, void 0, void 0, function* () {
172
- var _a, _b;
173
- const normalizedPath = normalizePath(path);
174
- this._assertReady(normalizedPath);
175
- const typeName = lastSegment(normalizedPath);
176
- const typeEntry = this._definition.types[typeName];
177
- const { status, record } = yield this._dwn.records.write(Object.assign(Object.assign({ data: request.data, store: request.store, encryption: request.encryption, parentContextId: request.parentContextId, published: request.published, datePublished: request.datePublished, recipient: request.recipient, protocolRole: request.protocolRole, tags: request.tags, protocol: this._definition.protocol, protocolPath: normalizedPath }, ((typeEntry === null || typeEntry === void 0 ? void 0 : typeEntry.schema) !== undefined ? { schema: typeEntry.schema } : {})), { dataFormat: (_a = request.dataFormat) !== null && _a !== void 0 ? _a : (_b = typeEntry === null || typeEntry === void 0 ? void 0 : typeEntry.dataFormats) === null || _b === void 0 ? void 0 : _b[0] }));
178
- return {
179
- status,
180
- record: new TypedRecord(record),
181
- };
182
- }),
183
- /**
184
- * Query records at the given protocol path.
185
- *
186
- * @param path - The protocol path to query.
187
- * @param request - Optional filter, sort, and pagination.
188
- */
189
- query: (path, request) => __awaiter(this, void 0, void 0, function* () {
190
- const normalizedPath = normalizePath(path);
191
- this._assertReady(normalizedPath);
192
- const typeName = lastSegment(normalizedPath);
193
- const typeEntry = this._definition.types[typeName];
194
- const { status, records, cursor } = yield this._dwn.records.query({
195
- from: request === null || request === void 0 ? void 0 : request.from,
196
- encryption: request === null || request === void 0 ? void 0 : request.encryption,
197
- filter: Object.assign(Object.assign(Object.assign({}, request === null || request === void 0 ? void 0 : request.filter), { protocol: this._definition.protocol, protocolPath: normalizedPath }), ((typeEntry === null || typeEntry === void 0 ? void 0 : typeEntry.schema) !== undefined ? { schema: typeEntry.schema } : {})),
198
- dateSort: request === null || request === void 0 ? void 0 : request.dateSort,
199
- pagination: request === null || request === void 0 ? void 0 : request.pagination,
200
- protocolRole: request === null || request === void 0 ? void 0 : request.protocolRole,
201
- });
202
- return {
203
- status,
204
- records: records.map((r) => new TypedRecord(r)),
205
- cursor,
206
- };
207
- }),
208
- /**
209
- * Read a single record at the given protocol path.
210
- *
211
- * @param path - The protocol path to read from.
212
- * @param request - Read options including a filter to identify the record.
213
- */
214
- read: (path, request) => __awaiter(this, void 0, void 0, function* () {
215
- const normalizedPath = normalizePath(path);
216
- this._assertReady(normalizedPath);
217
- const typeName = lastSegment(normalizedPath);
218
- const typeEntry = this._definition.types[typeName];
219
- const { status, record } = yield this._dwn.records.read({
220
- from: request.from,
221
- encryption: request.encryption,
222
- protocol: this._definition.protocol,
223
- filter: Object.assign(Object.assign(Object.assign({}, request.filter), { protocol: this._definition.protocol, protocolPath: normalizedPath }), ((typeEntry === null || typeEntry === void 0 ? void 0 : typeEntry.schema) !== undefined ? { schema: typeEntry.schema } : {})),
224
- });
225
- return {
226
- status,
227
- record: new TypedRecord(record),
228
- };
229
- }),
230
- /**
231
- * Delete a record at the given protocol path.
232
- *
233
- * @param path - The protocol path (used for permission scoping).
234
- * @param request - Delete options including the `recordId`.
235
- */
236
- delete: (_path, request) => __awaiter(this, void 0, void 0, function* () {
237
- this._assertReady(normalizePath(_path));
238
- return this._dwn.records.delete({
239
- from: request.from,
240
- protocol: this._definition.protocol,
241
- recordId: request.recordId,
242
- });
243
- }),
244
- /**
245
- * Subscribe to records at the given protocol path.
246
- *
247
- * Returns a {@link TypedLiveQuery} that atomically provides an initial
248
- * snapshot and a real-time stream of deduplicated change events, with
249
- * all records typed as `TypedRecord<T>`.
250
- *
251
- * @param path - The protocol path to subscribe to.
252
- * @param request - Optional filter and role.
253
- */
254
- subscribe: (path, request) => __awaiter(this, void 0, void 0, function* () {
255
- const normalizedPath = normalizePath(path);
256
- this._assertReady(normalizedPath);
257
- const typeName = lastSegment(normalizedPath);
258
- const typeEntry = this._definition.types[typeName];
259
- const { status, liveQuery } = yield this._dwn.records.subscribe({
260
- from: request === null || request === void 0 ? void 0 : request.from,
261
- filter: Object.assign(Object.assign(Object.assign({}, request === null || request === void 0 ? void 0 : request.filter), { protocol: this._definition.protocol, protocolPath: normalizedPath }), ((typeEntry === null || typeEntry === void 0 ? void 0 : typeEntry.schema) !== undefined ? { schema: typeEntry.schema } : {})),
262
- protocolRole: request === null || request === void 0 ? void 0 : request.protocolRole,
263
- });
264
- return {
265
- status,
266
- liveQuery: liveQuery ? new TypedLiveQuery(liveQuery) : undefined,
267
- };
268
- }),
269
- };
270
- this._records = cached;
271
- return cached;
272
- }
273
- }
274
- // ---------------------------------------------------------------------------
275
- // Helpers
276
- // ---------------------------------------------------------------------------
277
- /**
278
- * Compares two protocol definitions for deep equality using deterministic
279
- * JSON serialization.
280
- *
281
- * Keys are sorted recursively so that semantically identical definitions
282
- * with different key ordering are treated as equal.
283
- */
284
- function definitionsEqual(a, b) {
285
- return stableStringify(a) === stableStringify(b);
286
- }
287
- /**
288
- * Strips leading and trailing slashes from a path.
289
- *
290
- * `'friend/'` → `'friend'`, `'/group/member/'` → `'group/member'`.
291
- */
292
- function normalizePath(path) {
293
- return path.replace(/^\/+|\/+$/g, '');
294
- }
295
- /**
296
- * Returns the last segment of a slash-delimited path.
297
- */
298
- function lastSegment(path) {
299
- const parts = path.split('/');
300
- return parts[parts.length - 1];
301
- }
302
- /**
303
- * Recursively collects all valid protocol path strings from a structure object.
304
- *
305
- * Given `{ foo: { bar: { $actions: [...] } } }`, returns `Set(['foo', 'foo/bar'])`.
306
- * Keys starting with `$` are skipped.
307
- */
308
- function collectPaths(structure, prefix = '') {
309
- const paths = new Set();
310
- for (const key of Object.keys(structure)) {
311
- if (key.startsWith('$')) {
312
- continue;
313
- }
314
- const fullPath = prefix ? `${prefix}/${key}` : key;
315
- paths.add(fullPath);
316
- const child = structure[key];
317
- if (child !== null && typeof child === 'object') {
318
- for (const nested of collectPaths(child, fullPath)) {
319
- paths.add(nested);
320
- }
321
- }
322
- }
323
- return paths;
324
- }
325
- /**
326
- * Deterministic JSON serialization with sorted keys.
327
- */
328
- function stableStringify(value) {
329
- if (value === null || value === undefined || typeof value !== 'object') {
330
- return JSON.stringify(value);
331
- }
332
- if (Array.isArray(value)) {
333
- return '[' + value.map((item) => stableStringify(item)).join(',') + ']';
334
- }
335
- const keys = Object.keys(value).sort();
336
- const pairs = keys.map((key) => JSON.stringify(key) + ':' + stableStringify(value[key]));
337
- return '{' + pairs.join(',') + '}';
338
- }
339
- //# sourceMappingURL=typed-web5.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typed-web5.js","sourceRoot":"","sources":["../../src/typed-web5.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;;;;;;;;;AASH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA+IhD,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,OAAO,SAAS;IAUpB,YAAY,GAAW,EAAE,QAA6B;QAJ9C,gBAAW,GAAY,KAAK,CAAC;QAKnC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;IAED,wBAAwB;IACxB,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;IACnC,CAAC;IAED,mCAAmC;IACnC,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;;;;;;;OASG;IACU,SAAS,CAAC,OAAkC;;YACvD,uDAAuD;YACvD,MAA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