@evolu/common 6.0.1-preview.1 → 6.0.1-preview.11
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/dist/src/Assert.d.ts +6 -3
- package/dist/src/Assert.d.ts.map +1 -1
- package/dist/src/Assert.js +6 -3
- package/dist/src/Crypto.d.ts +11 -0
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Evolu/Config.d.ts +17 -4
- package/dist/src/Evolu/Config.d.ts.map +1 -1
- package/dist/src/Evolu/Config.js +1 -1
- package/dist/src/Evolu/Db.d.ts +21 -13
- package/dist/src/Evolu/Db.d.ts.map +1 -1
- package/dist/src/Evolu/Db.js +81 -64
- package/dist/src/Evolu/Evolu.d.ts +6 -6
- package/dist/src/Evolu/Evolu.d.ts.map +1 -1
- package/dist/src/Evolu/Evolu.js +19 -24
- package/dist/src/Evolu/Protocol.d.ts +79 -37
- package/dist/src/Evolu/Protocol.d.ts.map +1 -1
- package/dist/src/Evolu/Protocol.js +170 -58
- package/dist/src/Evolu/Relay.d.ts +3 -1
- package/dist/src/Evolu/Relay.d.ts.map +1 -1
- package/dist/src/Evolu/Relay.js +39 -3
- package/dist/src/Evolu/Schema.d.ts +24 -40
- package/dist/src/Evolu/Schema.d.ts.map +1 -1
- package/dist/src/Evolu/Schema.js +13 -72
- package/dist/src/Evolu/Storage.d.ts +1 -0
- package/dist/src/Evolu/Storage.d.ts.map +1 -1
- package/dist/src/Evolu/Storage.js +10 -0
- package/dist/src/Type.d.ts +42 -2
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +58 -1
- package/package.json +3 -3
- package/src/Assert.ts +6 -3
- package/src/Crypto.ts +13 -0
- package/src/Evolu/Config.ts +19 -5
- package/src/Evolu/Db.ts +92 -76
- package/src/Evolu/Evolu.ts +38 -35
- package/src/Evolu/Protocol.ts +209 -89
- package/src/Evolu/Relay.ts +45 -4
- package/src/Evolu/Schema.ts +102 -130
- package/src/Evolu/Storage.ts +12 -0
- package/src/Type.ts +71 -3
package/dist/src/Evolu/Evolu.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNonEmptyArray, isNonEmptyReadonlyArray } from "../Array.js";
|
|
2
|
-
import { assertNonEmptyArray } from "../Assert.js";
|
|
2
|
+
import { assert, assertNonEmptyArray } from "../Assert.js";
|
|
3
3
|
import { createCallbacks } from "../Callbacks.js";
|
|
4
4
|
import { exhaustiveCheck } from "../Function.js";
|
|
5
5
|
import { err, ok } from "../Result.js";
|
|
@@ -9,8 +9,9 @@ import { createId, } from "../Type.js";
|
|
|
9
9
|
import { defaultConfig } from "./Config.js";
|
|
10
10
|
import { applyPatches } from "./Diff.js";
|
|
11
11
|
import { kysely } from "./Kysely.js";
|
|
12
|
+
import { DbChange, } from "./Protocol.js";
|
|
12
13
|
import { createSubscribedQueries, emptyRows, serializeQuery, } from "./Query.js";
|
|
13
|
-
import {
|
|
14
|
+
import { evoluSchemaToDbSchema, insertable, updateable, upsertable, } from "./Schema.js";
|
|
14
15
|
import { initialSyncState } from "./Sync.js";
|
|
15
16
|
// For hot reloading and Evolu multitenancy.
|
|
16
17
|
const evoluInstances = new Map();
|
|
@@ -62,10 +63,7 @@ let tabId = null;
|
|
|
62
63
|
* const evolu = createEvolu(evoluReactDeps)(Schema);
|
|
63
64
|
* ```
|
|
64
65
|
*/
|
|
65
|
-
export const createEvolu = (deps) => (
|
|
66
|
-
// TODO: Validate missing Id, unsupported types, used default types via TS types
|
|
67
|
-
// with type errors messages as we had it in the old Evolu.
|
|
68
|
-
schema, partialConfig = {}) => {
|
|
66
|
+
export const createEvolu = (deps) => (schema, partialConfig = {}) => {
|
|
69
67
|
const config = { ...defaultConfig, ...partialConfig };
|
|
70
68
|
let evolu = evoluInstances.get(config.name);
|
|
71
69
|
if (evolu == null) {
|
|
@@ -159,7 +157,7 @@ const createEvoluInstance = (deps) => (schema, evoluConfig) => {
|
|
|
159
157
|
exhaustiveCheck(message);
|
|
160
158
|
}
|
|
161
159
|
});
|
|
162
|
-
const dbSchema =
|
|
160
|
+
const dbSchema = evoluSchemaToDbSchema(schema, indexes);
|
|
163
161
|
const mutationTypesCache = new Map();
|
|
164
162
|
// Lazy create mutation Types like this: `insertable(Schema.todo)`
|
|
165
163
|
const getMutationType = (table, kind) => {
|
|
@@ -185,18 +183,15 @@ const createEvoluInstance = (deps) => (schema, evoluConfig) => {
|
|
|
185
183
|
if (initialData)
|
|
186
184
|
initialData({
|
|
187
185
|
insert: (table, props) => {
|
|
188
|
-
const Type = getMutationType(table, "insert");
|
|
189
186
|
const id = createId(deps);
|
|
190
|
-
const
|
|
191
|
-
if (
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
values: result.value,
|
|
196
|
-
});
|
|
187
|
+
const values = getMutationType(table, "insert").fromUnknown(props);
|
|
188
|
+
if (values.ok) {
|
|
189
|
+
const dbChange = { table, id, values: values.value };
|
|
190
|
+
assertValidDbChange(dbChange);
|
|
191
|
+
initialDataDbChanges.push(dbChange);
|
|
197
192
|
return ok({ id });
|
|
198
193
|
}
|
|
199
|
-
return
|
|
194
|
+
return values;
|
|
200
195
|
},
|
|
201
196
|
});
|
|
202
197
|
dbWorker.postMessage({
|
|
@@ -222,9 +217,9 @@ const createEvoluInstance = (deps) => (schema, evoluConfig) => {
|
|
|
222
217
|
else {
|
|
223
218
|
// Remove `id` from values.
|
|
224
219
|
const { id: _id, ...values } = result.value;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
mutateMicrotaskQueue.push([
|
|
220
|
+
const dbChange = { table, id, values };
|
|
221
|
+
assertValidDbChange(dbChange);
|
|
222
|
+
mutateMicrotaskQueue.push([dbChange, options?.onComplete]);
|
|
228
223
|
}
|
|
229
224
|
if (mutateMicrotaskQueue.length === 1)
|
|
230
225
|
queueMicrotask(() => {
|
|
@@ -350,11 +345,8 @@ const createEvoluInstance = (deps) => (schema, evoluConfig) => {
|
|
|
350
345
|
},
|
|
351
346
|
ensureSchema: (schema) => {
|
|
352
347
|
mutationTypesCache.clear();
|
|
353
|
-
const
|
|
354
|
-
dbWorker.postMessage({
|
|
355
|
-
type: "ensureDbSchema",
|
|
356
|
-
dbSchema: validEvoluSchemaToDbSchema(validSchema),
|
|
357
|
-
});
|
|
348
|
+
const dbSchema = evoluSchemaToDbSchema(schema);
|
|
349
|
+
dbWorker.postMessage({ type: "ensureDbSchema", dbSchema });
|
|
358
350
|
},
|
|
359
351
|
exportDatabase: () => {
|
|
360
352
|
const { promise, resolve } = Promise.withResolvers();
|
|
@@ -432,3 +424,6 @@ const createLoadingPromises = (subscribedQueries) => {
|
|
|
432
424
|
};
|
|
433
425
|
return loadingPromises;
|
|
434
426
|
};
|
|
427
|
+
const assertValidDbChange = (dbChange) => {
|
|
428
|
+
assert(DbChange.is(dbChange), `Failed to create DbChange for table "${dbChange.table}". If you see this message, you either disabled EvoluSchema validation or Evolu has a bug - please report it.`);
|
|
429
|
+
};
|
|
@@ -15,21 +15,39 @@
|
|
|
15
15
|
*
|
|
16
16
|
* ### Message Structure
|
|
17
17
|
*
|
|
18
|
-
* | Field | Notes
|
|
19
|
-
* | :----------------------------- |
|
|
20
|
-
* | **Header** |
|
|
21
|
-
* | - {@link protocolVersion} |
|
|
22
|
-
* | - {@link OwnerId} |
|
|
23
|
-
* |
|
|
24
|
-
* |
|
|
25
|
-
* | - {@link
|
|
26
|
-
* | - {@link
|
|
27
|
-
* | -
|
|
28
|
-
* |
|
|
29
|
-
* |
|
|
30
|
-
* | - {@link
|
|
31
|
-
*
|
|
32
|
-
*
|
|
18
|
+
* | Field | Notes |
|
|
19
|
+
* | :----------------------------- | :------------------------ |
|
|
20
|
+
* | **Header** | |
|
|
21
|
+
* | - {@link protocolVersion} | |
|
|
22
|
+
* | - {@link OwnerId} | {@link Owner} |
|
|
23
|
+
* | **Initiator** | |
|
|
24
|
+
* | - {@link WriteKeyMode} | |
|
|
25
|
+
* | - {@link WriteKey} | If WriteKeyMode >= 1 |
|
|
26
|
+
* | - {@link WriteKey} | If WriteKeyMode = 2 (new) |
|
|
27
|
+
* | **Non-initiator** | |
|
|
28
|
+
* | - {@link ProtocolErrorCode} | |
|
|
29
|
+
* | **Messages** | |
|
|
30
|
+
* | - {@link NonNegativeInt} | A number of messages. |
|
|
31
|
+
* | - {@link EncryptedCrdtMessage} | |
|
|
32
|
+
* | **Ranges** | |
|
|
33
|
+
* | - {@link NonNegativeInt} | Number of ranges. |
|
|
34
|
+
* | - {@link Range} | |
|
|
35
|
+
*
|
|
36
|
+
* ### WriteKey Validation
|
|
37
|
+
*
|
|
38
|
+
* The initiator sends WriteKeyMode and optionally one or two WriteKeys. One key
|
|
39
|
+
* for write operations and two for key rotation (current and new). Note that
|
|
40
|
+
* it's ok to not send any key if initiator is going to be synced with readonly
|
|
41
|
+
* owner. The non-initiator validates them immediately after parsing the
|
|
42
|
+
* initiator header, before processing any messages or ranges.
|
|
43
|
+
*
|
|
44
|
+
* ### WriteKey Rotation
|
|
45
|
+
*
|
|
46
|
+
* When initiator's {@link WriteKeyMode} is `Rotation`, two WriteKeys are
|
|
47
|
+
* present:
|
|
48
|
+
*
|
|
49
|
+
* 1. Current WriteKey (for validation)
|
|
50
|
+
* 2. New WriteKey (to be stored)
|
|
33
51
|
*
|
|
34
52
|
* ### Synchronization
|
|
35
53
|
*
|
|
@@ -123,7 +141,6 @@
|
|
|
123
141
|
import { NonEmptyReadonlyArray } from "../Array.js";
|
|
124
142
|
import { Buffer } from "../Buffer.js";
|
|
125
143
|
import { CreateRandomBytesDep, EncryptionKey, SymmetricCryptoDecryptError, SymmetricCryptoDep } from "../Crypto.js";
|
|
126
|
-
import { ReadonlyRecord } from "../Object.js";
|
|
127
144
|
import { Result } from "../Result.js";
|
|
128
145
|
import { SqliteValue } from "../Sqlite.js";
|
|
129
146
|
import { Id, NanoId, NonNegativeInt, PositiveInt } from "../Type.js";
|
|
@@ -148,6 +165,11 @@ export declare const ProtocolErrorCode: {
|
|
|
148
165
|
readonly SyncError: 3;
|
|
149
166
|
};
|
|
150
167
|
type ProtocolErrorCode = (typeof ProtocolErrorCode)[keyof typeof ProtocolErrorCode];
|
|
168
|
+
export declare const WriteKeyMode: {
|
|
169
|
+
readonly None: 0;
|
|
170
|
+
readonly Single: 1;
|
|
171
|
+
readonly Rotation: 2;
|
|
172
|
+
};
|
|
151
173
|
/**
|
|
152
174
|
* Evolu Protocol Storage
|
|
153
175
|
*
|
|
@@ -169,17 +191,16 @@ export interface Storage {
|
|
|
169
191
|
readonly fingerprintRanges: (ownerId: BinaryOwnerId, buckets: ReadonlyArray<NonNegativeInt>, upperBound?: RangeUpperBound) => ReadonlyArray<FingerprintRange> | null;
|
|
170
192
|
readonly findLowerBound: (ownerId: BinaryOwnerId, begin: NonNegativeInt, end: NonNegativeInt, upperBound: RangeUpperBound) => NonNegativeInt | null;
|
|
171
193
|
readonly iterate: (ownerId: BinaryOwnerId, begin: NonNegativeInt, end: NonNegativeInt, callback: (timestamp: BinaryTimestamp, index: NonNegativeInt) => boolean) => void;
|
|
172
|
-
/**
|
|
173
|
-
* Authorizes the initiator's {@link WriteKey} for the given
|
|
174
|
-
* {@link BinaryOwnerId}.
|
|
175
|
-
*
|
|
176
|
-
* For a client that does not expect foreign writes, return `false`.
|
|
177
|
-
*/
|
|
194
|
+
/** Validates the {@link WriteKey} for the given {@link Owner}. */
|
|
178
195
|
readonly validateWriteKey: (ownerId: BinaryOwnerId, writeKey: WriteKey) => boolean;
|
|
196
|
+
/** Sets the {@link WriteKey} for the given {@link Owner}. */
|
|
197
|
+
readonly setWriteKey: (ownerId: BinaryOwnerId, writeKey: WriteKey) => boolean;
|
|
179
198
|
/** Write encrypted {@link CrdtMessage}s to storage. */
|
|
180
199
|
readonly writeMessages: (ownerId: BinaryOwnerId, messages: NonEmptyReadonlyArray<EncryptedCrdtMessage>) => boolean;
|
|
181
200
|
/** Read encrypted {@link DbChange}s from storage. */
|
|
182
201
|
readonly readDbChange: (ownerId: BinaryOwnerId, timestamp: BinaryTimestamp) => EncryptedDbChange | null;
|
|
202
|
+
/** Delete all data for the given {@link Owner}. */
|
|
203
|
+
readonly deleteOwner: (ownerId: BinaryOwnerId) => boolean;
|
|
183
204
|
}
|
|
184
205
|
export interface StorageDep {
|
|
185
206
|
readonly storage: Storage;
|
|
@@ -199,15 +220,22 @@ export interface CrdtMessage {
|
|
|
199
220
|
readonly timestamp: Timestamp;
|
|
200
221
|
readonly change: DbChange;
|
|
201
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Base64Url string with maximum length of 256 characters. Encoding strings as
|
|
225
|
+
* Base64UrlString saves up to 25% in size compared to regular strings.
|
|
226
|
+
*/
|
|
227
|
+
export declare const Base64Url256: import("../Type.js").BrandType<import("../Type.js").Type<"Brand", string & Brand<"Base64Url">, string, import("../Type.js").RegexError<"Base64Url">, string, import("../Type.js").StringError>, "MaxLength256", import("../Type.js").MaxLengthError<256>, import("../Type.js").StringError | import("../Type.js").RegexError<"Base64Url">>;
|
|
228
|
+
export type Base64Url256 = typeof Base64Url256.Type;
|
|
202
229
|
/**
|
|
203
230
|
* A DbChange is a change to a table row. Together with a unique
|
|
204
231
|
* {@link Timestamp}, it forms a {@link CrdtMessage}.
|
|
205
232
|
*/
|
|
206
|
-
export
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
233
|
+
export declare const DbChange: import("../Type.js").ObjectType<{
|
|
234
|
+
table: import("../Type.js").BrandType<import("../Type.js").Type<"Brand", string & Brand<"Base64Url">, string, import("../Type.js").RegexError<"Base64Url">, string, import("../Type.js").StringError>, "MaxLength256", import("../Type.js").MaxLengthError<256>, import("../Type.js").StringError | import("../Type.js").RegexError<"Base64Url">>;
|
|
235
|
+
id: import("../Type.js").BrandType<import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, "Id", import("../Type.js").RegexError<"Id">, import("../Type.js").StringError>;
|
|
236
|
+
values: import("../Type.js").RecordType<"Brand", string & Brand<"Base64Url"> & Brand<"MaxLength256">, string, import("../Type.js").MaxLengthError<256>, string & Brand<"Base64Url">, import("../Type.js").StringError | import("../Type.js").RegexError<"Base64Url">, import("../Type.js").UnionType<[import("../Type.js").Type<"Null", null, null, import("../Type.js").NullError, null, import("../Type.js").NullError>, import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, import("../Type.js").Type<"Number", number, number, import("../Type.js").NumberError, number, import("../Type.js").NumberError>, import("../Type.js").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError>]>>;
|
|
237
|
+
}>;
|
|
238
|
+
export type DbChange = typeof DbChange.Type;
|
|
211
239
|
export declare const RangeType: {
|
|
212
240
|
readonly Fingerprint: 1;
|
|
213
241
|
readonly Skip: 0;
|
|
@@ -300,6 +328,8 @@ export interface ProtocolSyncError extends ProtocolErrorBase {
|
|
|
300
328
|
export declare const createProtocolMessageFromCrdtMessages: (deps: SymmetricCryptoDep & CreateRandomBytesDep) => (owner: OwnerWithWriteAccess, messages: NonEmptyReadonlyArray<CrdtMessage>, maxSize?: PositiveInt) => ProtocolMessage;
|
|
301
329
|
/** Creates a {@link ProtocolMessage} for sync. */
|
|
302
330
|
export declare const createProtocolMessageForSync: (deps: StorageDep) => (ownerId: OwnerId) => ProtocolMessage | null;
|
|
331
|
+
/** Creates a ProtocolMessage for {@link WriteKey} rotation. */
|
|
332
|
+
export declare const createProtocolMessageForWriteKeyRotation: (ownerId: OwnerId, currentWriteKey: WriteKey, newWriteKey: WriteKey) => ProtocolMessage;
|
|
303
333
|
/**
|
|
304
334
|
* Mutable builder for constructing {@link ProtocolMessage} respecting size
|
|
305
335
|
* limits.
|
|
@@ -313,13 +343,18 @@ export interface ProtocolMessageBuffer {
|
|
|
313
343
|
readonly unwrap: () => ProtocolMessage;
|
|
314
344
|
readonly getSize: () => PositiveInt;
|
|
315
345
|
}
|
|
316
|
-
export declare const createProtocolMessageBuffer: (ownerId: OwnerId, options
|
|
317
|
-
readonly errorCode?: ProtocolErrorCode;
|
|
318
|
-
readonly writeKey?: WriteKey;
|
|
346
|
+
export declare const createProtocolMessageBuffer: (ownerId: OwnerId, options: {
|
|
319
347
|
readonly totalMaxSize?: PositiveInt | undefined;
|
|
320
348
|
readonly rangesMaxSize?: PositiveInt | undefined;
|
|
321
349
|
readonly version?: NonNegativeInt;
|
|
322
|
-
}
|
|
350
|
+
} & ({
|
|
351
|
+
readonly type: "initiator";
|
|
352
|
+
/** Single key or [current, new] for rotation. */
|
|
353
|
+
readonly writeKey?: WriteKey | readonly [WriteKey, WriteKey];
|
|
354
|
+
} | {
|
|
355
|
+
readonly type: "non-initiator";
|
|
356
|
+
readonly errorCode: ProtocolErrorCode;
|
|
357
|
+
})) => ProtocolMessageBuffer;
|
|
323
358
|
export interface TimestampsBuffer {
|
|
324
359
|
readonly add: (timestamp: Timestamp) => void;
|
|
325
360
|
readonly addInfinite: () => void;
|
|
@@ -356,12 +391,6 @@ export declare const binaryIdToId: (binaryId: BinaryId) => Id;
|
|
|
356
391
|
export type BinaryOwnerId = Uint8Array & Brand<"BinaryOwnerId">;
|
|
357
392
|
export declare const ownerIdToBinaryOwnerId: (ownerId: OwnerId) => BinaryOwnerId;
|
|
358
393
|
export declare const binaryOwnerIdToOwnerId: (binaryOwnerId: BinaryOwnerId) => OwnerId;
|
|
359
|
-
/**
|
|
360
|
-
* Base64Url string with maximum length of 256 characters. Encoding strings as
|
|
361
|
-
* Base64UrlString saves up to 25% in size compared to regular strings.
|
|
362
|
-
*/
|
|
363
|
-
export declare const Base64Url256: import("../Type.js").BrandType<import("../Type.js").Type<"Brand", string & Brand<"Base64Url">, string, import("../Type.js").RegexError<"Base64Url">, string, import("../Type.js").StringError>, "MaxLength256", import("../Type.js").MaxLengthError<256>, import("../Type.js").StringError | import("../Type.js").RegexError<"Base64Url">>;
|
|
364
|
-
export type Base64Url256 = typeof Base64Url256.Type;
|
|
365
394
|
/**
|
|
366
395
|
* Union type for all variants of Base64Url strings with limited length. All
|
|
367
396
|
* these types use Base64Url alphabet and are < 256 characters.
|
|
@@ -425,5 +454,18 @@ export declare const ProtocolValueType: {
|
|
|
425
454
|
};
|
|
426
455
|
export declare const encodeSqliteValue: (buffer: Buffer, value: SqliteValue) => void;
|
|
427
456
|
export declare const decodeSqliteValue: (buffer: Buffer) => SqliteValue;
|
|
457
|
+
/**
|
|
458
|
+
* Decodes a ProtocolMessage into a readable JSON object for debugging.
|
|
459
|
+
*
|
|
460
|
+
* Note: This is a stub for future implementation. It should use:
|
|
461
|
+
*
|
|
462
|
+
* - DecodeVersionAndOwner
|
|
463
|
+
* - DecodeError or decodeWriteKeys (depending on context)
|
|
464
|
+
* - DecodeMessages
|
|
465
|
+
* - DecodeRanges
|
|
466
|
+
*
|
|
467
|
+
* If you want to help, please contribute to this function.
|
|
468
|
+
*/
|
|
469
|
+
export declare const decodeProtocolMessageToJson: (_protocolMessage: ProtocolMessage, _isInitiator: boolean) => unknown;
|
|
428
470
|
export {};
|
|
429
471
|
//# sourceMappingURL=Protocol.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Protocol.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Protocol.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2IG;AAIH,OAAO,EAA2B,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE7E,OAAO,EACL,MAAM,EAMP,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,a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