@fluidframework/sequence 1.0.1 → 1.1.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/README.md +18 -6
- package/dist/defaultMap.d.ts +2 -6
- package/dist/defaultMap.d.ts.map +1 -1
- package/dist/defaultMap.js +27 -37
- package/dist/defaultMap.js.map +1 -1
- package/dist/defaultMapInterfaces.d.ts +24 -3
- package/dist/defaultMapInterfaces.d.ts.map +1 -1
- package/dist/defaultMapInterfaces.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +72 -8
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +325 -155
- package/dist/intervalCollection.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sequence.d.ts +4 -5
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +11 -15
- package/dist/sequence.js.map +1 -1
- package/dist/sharedIntervalCollection.d.ts.map +1 -1
- package/dist/sharedIntervalCollection.js +1 -1
- package/dist/sharedIntervalCollection.js.map +1 -1
- package/dist/sharedSequence.js.map +1 -1
- package/dist/sparsematrix.js +2 -2
- package/dist/sparsematrix.js.map +1 -1
- package/lib/defaultMap.d.ts +2 -6
- package/lib/defaultMap.d.ts.map +1 -1
- package/lib/defaultMap.js +27 -37
- package/lib/defaultMap.js.map +1 -1
- package/lib/defaultMapInterfaces.d.ts +24 -3
- package/lib/defaultMapInterfaces.d.ts.map +1 -1
- package/lib/defaultMapInterfaces.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +72 -8
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +325 -155
- package/lib/intervalCollection.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sequence.d.ts +4 -5
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +11 -15
- package/lib/sequence.js.map +1 -1
- package/lib/sharedIntervalCollection.d.ts.map +1 -1
- package/lib/sharedIntervalCollection.js +1 -1
- package/lib/sharedIntervalCollection.js.map +1 -1
- package/lib/sharedSequence.js.map +1 -1
- package/lib/sparsematrix.js +2 -2
- package/lib/sparsematrix.js.map +1 -1
- package/package.json +20 -44
- package/src/defaultMap.ts +39 -41
- package/src/defaultMapInterfaces.ts +28 -3
- package/src/index.ts +3 -0
- package/src/intervalCollection.ts +447 -181
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +17 -21
- package/src/sharedIntervalCollection.ts +3 -2
- package/src/sharedSequence.ts +1 -1
- package/src/sparsematrix.ts +2 -2
package/lib/defaultMap.js
CHANGED
|
@@ -35,7 +35,6 @@ export class DefaultMap {
|
|
|
35
35
|
* The in-memory data the map is storing.
|
|
36
36
|
*/
|
|
37
37
|
this.data = new Map();
|
|
38
|
-
this.lastProcessedSeq = -1;
|
|
39
38
|
this.messageHandlers = this.getMessageHandlers();
|
|
40
39
|
}
|
|
41
40
|
/**
|
|
@@ -60,13 +59,9 @@ export class DefaultMap {
|
|
|
60
59
|
const iterator = {
|
|
61
60
|
next() {
|
|
62
61
|
const nextVal = localEntriesIterator.next();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
else {
|
|
67
|
-
// Unpack the stored value
|
|
68
|
-
return { value: [nextVal.value[0], nextVal.value[1].value], done: false };
|
|
69
|
-
}
|
|
62
|
+
return nextVal.done
|
|
63
|
+
? { value: undefined, done: true }
|
|
64
|
+
: { value: [nextVal.value[0], nextVal.value[1].value], done: false }; // Unpack the stored value
|
|
70
65
|
},
|
|
71
66
|
[Symbol.iterator]() {
|
|
72
67
|
return this;
|
|
@@ -83,13 +78,9 @@ export class DefaultMap {
|
|
|
83
78
|
const iterator = {
|
|
84
79
|
next() {
|
|
85
80
|
const nextVal = localValuesIterator.next();
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
else {
|
|
90
|
-
// Unpack the stored value
|
|
91
|
-
return { value: nextVal.value.value, done: false };
|
|
92
|
-
}
|
|
81
|
+
return nextVal.done
|
|
82
|
+
? { value: undefined, done: true }
|
|
83
|
+
: { value: nextVal.value.value, done: false }; // Unpack the stored value
|
|
93
84
|
},
|
|
94
85
|
[Symbol.iterator]() {
|
|
95
86
|
return this;
|
|
@@ -117,10 +108,8 @@ export class DefaultMap {
|
|
|
117
108
|
* {@inheritDoc ISharedMap.get}
|
|
118
109
|
*/
|
|
119
110
|
get(key) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
localValue = this.createCore(key, true);
|
|
123
|
-
}
|
|
111
|
+
var _a;
|
|
112
|
+
const localValue = (_a = this.data.get(key)) !== null && _a !== void 0 ? _a : this.createCore(key, true);
|
|
124
113
|
return localValue.value;
|
|
125
114
|
}
|
|
126
115
|
/**
|
|
@@ -165,8 +154,13 @@ export class DefaultMap {
|
|
|
165
154
|
|| serializable.type === ValueType[ValueType.Shared]) {
|
|
166
155
|
continue;
|
|
167
156
|
}
|
|
157
|
+
// Back-compat: Sequence previously arbitrarily prefixed all interval collection keys with
|
|
158
|
+
// "intervalCollections/". This would burden users trying to iterate the collection and
|
|
159
|
+
// access its value, as well as those trying to match a create message to its underlying
|
|
160
|
+
// collection. See https://github.com/microsoft/FluidFramework/issues/10557 for more context.
|
|
161
|
+
const normalizedKey = key.startsWith("intervalCollections/") ? key.substring(20) : key;
|
|
168
162
|
const localValue = {
|
|
169
|
-
key,
|
|
163
|
+
key: normalizedKey,
|
|
170
164
|
value: this.makeLocal(key, serializable),
|
|
171
165
|
};
|
|
172
166
|
this.data.set(localValue.key, localValue.value);
|
|
@@ -183,17 +177,11 @@ export class DefaultMap {
|
|
|
183
177
|
* also sent if we are asked to resubmit the message.
|
|
184
178
|
* @returns True if the operation was submitted, false otherwise.
|
|
185
179
|
*/
|
|
186
|
-
|
|
180
|
+
tryResubmitMessage(op, localOpMetadata) {
|
|
187
181
|
const type = op.type;
|
|
188
182
|
const handler = this.messageHandlers.get(type);
|
|
189
183
|
if (handler !== undefined) {
|
|
190
|
-
|
|
191
|
-
// we don't know how to rebase these operations, so if any other op has come in
|
|
192
|
-
// we will fail.
|
|
193
|
-
if (this.lastProcessedSeq !== (mapLocalMetadata === null || mapLocalMetadata === void 0 ? void 0 : mapLocalMetadata.lastProcessedSeq)) {
|
|
194
|
-
throw new Error("SharedInterval does not support reconnect in presence of external changes");
|
|
195
|
-
}
|
|
196
|
-
handler.submit(op);
|
|
184
|
+
handler.resubmit(op, localOpMetadata);
|
|
197
185
|
return true;
|
|
198
186
|
}
|
|
199
187
|
return false;
|
|
@@ -215,9 +203,6 @@ export class DefaultMap {
|
|
|
215
203
|
* @returns True if the operation was processed, false otherwise.
|
|
216
204
|
*/
|
|
217
205
|
tryProcessMessage(op, local, message, localOpMetadata) {
|
|
218
|
-
// track the seq of every incoming message, so we can detect if any
|
|
219
|
-
// changes happened during a resubmit
|
|
220
|
-
this.lastProcessedSeq = message.sequenceNumber;
|
|
221
206
|
const handler = this.messageHandlers.get(op.type);
|
|
222
207
|
if (handler !== undefined) {
|
|
223
208
|
handler.process(op, local, message, localOpMetadata);
|
|
@@ -272,12 +257,18 @@ export class DefaultMap {
|
|
|
272
257
|
const handler = localValue.getOpHandler(op.value.opName);
|
|
273
258
|
const previousValue = localValue.value;
|
|
274
259
|
const translatedValue = parseHandles(op.value.value, this.serializer);
|
|
275
|
-
handler.process(previousValue, translatedValue, local, message);
|
|
260
|
+
handler.process(previousValue, translatedValue, local, message, localOpMetadata);
|
|
276
261
|
const event = { key: op.key, previousValue };
|
|
277
262
|
this.eventEmitter.emit("valueChanged", event, local, message, this.eventEmitter);
|
|
278
263
|
},
|
|
279
|
-
submit: (op) => {
|
|
280
|
-
this.submitMessage(op,
|
|
264
|
+
submit: (op, localOpMetadata) => {
|
|
265
|
+
this.submitMessage(op, localOpMetadata);
|
|
266
|
+
},
|
|
267
|
+
resubmit: (op, localOpMetadata) => {
|
|
268
|
+
const localValue = this.data.get(op.key);
|
|
269
|
+
const handler = localValue.getOpHandler(op.value.opName);
|
|
270
|
+
const { rebasedOp, rebasedLocalOpMetadata, } = handler.rebase(localValue.value, op.value, localOpMetadata);
|
|
271
|
+
this.submitMessage(Object.assign(Object.assign({}, op), { value: rebasedOp }), rebasedLocalOpMetadata);
|
|
281
272
|
},
|
|
282
273
|
getStashedOpLocalMetadata: (op) => {
|
|
283
274
|
assert(false, 0x016 /* "apply stashed op not implemented for custom value type ops" */);
|
|
@@ -292,7 +283,7 @@ export class DefaultMap {
|
|
|
292
283
|
* @returns A value op emitter for the given key
|
|
293
284
|
*/
|
|
294
285
|
makeMapValueOpEmitter(key) {
|
|
295
|
-
const emit = (opName, previousValue, params) => {
|
|
286
|
+
const emit = (opName, previousValue, params, localOpMetadata) => {
|
|
296
287
|
const translatedParams = makeHandlesSerializable(params, this.serializer, this.handle);
|
|
297
288
|
const op = {
|
|
298
289
|
key,
|
|
@@ -302,8 +293,7 @@ export class DefaultMap {
|
|
|
302
293
|
value: translatedParams,
|
|
303
294
|
},
|
|
304
295
|
};
|
|
305
|
-
|
|
306
|
-
this.submitMessage(op, { lastProcessedSeq: this.lastProcessedSeq });
|
|
296
|
+
this.submitMessage(op, localOpMetadata);
|
|
307
297
|
const event = { key, previousValue };
|
|
308
298
|
this.eventEmitter.emit("valueChanged", event, true, null, this.eventEmitter);
|
|
309
299
|
};
|
package/lib/defaultMap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultMap.js","sourceRoot":"","sources":["../src/defaultMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEH,uBAAuB,EACvB,YAAY,EACZ,SAAS,GACZ,MAAM,oCAAoC,CAAC;AAC5C,OAA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pD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACjF,CAAC,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IFluidSerializer,\n makeHandlesSerializable,\n parseHandles,\n ValueType,\n} from \"@fluidframework/shared-object-base\";\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport {\n makeSerializable,\n ValueTypeLocalValue,\n} from \"./localValues\";\nimport {\n ISerializableValue,\n ISerializedValue,\n IValueChanged,\n IValueOpEmitter,\n IValueType,\n IValueTypeOperationValue,\n ISharedDefaultMapEvents,\n} from \"./defaultMapInterfaces\";\n\n/**\n * Defines the means to process and submit a given op on a map.\n */\ninterface IMapMessageHandler {\n /**\n * Apply the given operation.\n * @param op - The map operation to apply\n * @param local - Whether the message originated from the local client\n * @param message - The full message. Not provided for stashed ops.\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n process(\n op: IMapOperation,\n local: boolean,\n message: ISequencedDocumentMessage | undefined,\n localOpMetadata: IMapMessageLocalMetadata,\n ): void;\n\n /**\n * Communicate the operation to remote clients.\n * @param op - The map operation to submit\n */\n submit(op: IMapOperation): void;\n\n getStashedOpLocalMetadata(op: IMapOperation): unknown;\n}\n\nexport interface IMapMessageLocalMetadata {\n lastProcessedSeq: number;\n}\n\n/**\n * Describes an operation specific to a value type.\n */\nexport interface IMapValueTypeOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"act\";\n\n /**\n * Map key being modified.\n */\n key: string;\n\n /**\n * Value of the operation, specific to the value type.\n * @alpha\n */\n value: IValueTypeOperationValue;\n}\n\n/**\n * Description of a map delta operation\n */\nexport type IMapOperation = IMapValueTypeOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n [key: string]: ISerializableValue;\n}\n\nexport interface IMapDataObjectSerialized {\n [key: string]: ISerializedValue;\n}\n\n/**\n * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by\n * string key locations.\n *\n * Creation of values is implicit on access (either via `get` or a remote op application referring to\n * a collection that wasn't previously known)\n */\nexport class DefaultMap<T> {\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size(): number {\n return this.data.size;\n }\n\n /**\n * Mapping of op types to message handlers.\n */\n private readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n /**\n * The in-memory data the map is storing.\n */\n private readonly data = new Map<string, ValueTypeLocalValue<T>>();\n\n private lastProcessedSeq: number = -1;\n\n /**\n * Create a new default map.\n * @param serializer - The serializer to serialize / parse handles\n * @param handle - The handle of the shared object using the kernel\n * @param submitMessage - A callback to submit a message through the shared object\n * @param type - The value type to create at values of this map\n * @param eventEmitter - The object that will emit map events\n */\n constructor(\n private readonly serializer: IFluidSerializer,\n private readonly handle: IFluidHandle,\n private readonly submitMessage: (op: any, localOpMetadata: IMapMessageLocalMetadata) => void,\n private readonly type: IValueType<T>,\n public readonly eventEmitter = new TypedEventEmitter<ISharedDefaultMapEvents>(),\n ) {\n this.messageHandlers = this.getMessageHandlers();\n }\n\n /**\n * Get an iterator over the keys in this map.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.data.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n const localEntriesIterator = this.data.entries();\n const iterator = {\n next(): IteratorResult<[string, any]> {\n const nextVal = localEntriesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: [nextVal.value[0], nextVal.value[1].value], done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n const localValuesIterator = this.data.values();\n const iterator = {\n next(): IteratorResult<any> {\n const nextVal = localValuesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: nextVal.value.value, done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.entries();\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n this.data.forEach((localValue, key, m) => {\n callbackFn(localValue.value, key, m);\n });\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n public get(key: string): T {\n let localValue = this.data.get(key);\n if (!this.data.has(key)) {\n localValue = this.createCore(key, true);\n }\n return localValue.value;\n }\n\n /**\n * Check if a key exists in the map.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.data.has(key);\n }\n\n /**\n * Serializes the data stored in the shared map to a JSON string\n * @param serializer - The serializer to use to serialize handles in its values.\n * @returns A JSON string containing serialized map data\n */\n public getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n const serializableMapData: IMapDataObjectSerialized = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n const serializableMapData: IMapDataObjectSerializable = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public serialize(serializer: IFluidSerializer): string {\n return JSON.stringify(this.getSerializableStorage(serializer));\n }\n\n /**\n * Populate the kernel with the given map data.\n * @param data - A JSON string containing serialized map data\n */\n public populateFromSerializable(json: IMapDataObjectSerializable): void {\n for (const [key, serializable] of Object.entries(json)) {\n // Back-compat: legacy documents may have handles to an intervalCollection map kernel.\n // These collections should be empty, and ValueTypes are no longer supported.\n if (serializable.type === ValueType[ValueType.Plain]\n || serializable.type === ValueType[ValueType.Shared]) {\n continue;\n }\n\n const localValue = {\n key,\n value: this.makeLocal(key, serializable),\n };\n\n this.data.set(localValue.key, localValue.value);\n }\n }\n\n public populate(json: string): void {\n this.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n }\n\n /**\n * Submit the given op if a handler is registered.\n * @param op - The operation to attempt to submit\n * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n * @returns True if the operation was submitted, false otherwise.\n */\n public trySubmitMessage(op: any, localOpMetadata: IMapMessageLocalMetadata): boolean {\n const type: string = op.type;\n const handler = this.messageHandlers.get(type);\n if (handler !== undefined) {\n const mapLocalMetadata: Partial<IMapMessageLocalMetadata> = localOpMetadata;\n // we don't know how to rebase these operations, so if any other op has come in\n // we will fail.\n if (this.lastProcessedSeq !== mapLocalMetadata?.lastProcessedSeq) {\n throw new Error(\"SharedInterval does not support reconnect in presence of external changes\");\n }\n handler.submit(op as IMapOperation);\n return true;\n }\n return false;\n }\n\n public tryGetStashedOpLocalMetadata(op: any): unknown {\n const type: string = op.type;\n if (this.messageHandlers.has(type)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.messageHandlers.get(type)!.getStashedOpLocalMetadata(op as IMapOperation);\n }\n throw new Error(\"no apply stashed op handler\");\n }\n\n /**\n * Process the given op if a handler is registered.\n * @param message - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation was processed, false otherwise.\n */\n public tryProcessMessage(\n op: IMapOperation,\n local: boolean,\n message: ISequencedDocumentMessage | undefined,\n localOpMetadata: unknown,\n ): boolean {\n // track the seq of every incoming message, so we can detect if any\n // changes happened during a resubmit\n this.lastProcessedSeq = message.sequenceNumber;\n const handler = this.messageHandlers.get(op.type);\n if (handler !== undefined) {\n handler.process(op, local, message, localOpMetadata as IMapMessageLocalMetadata);\n return true;\n }\n return false;\n }\n\n /**\n * Initializes a default ValueType at the provided key.\n * Should be used when a map operation incurs creation.\n * @param key - The key being initialized\n * @param local - Whether the message originated from the local client\n */\n private createCore(key: string, local: boolean): ValueTypeLocalValue<T> {\n const localValue = new ValueTypeLocalValue(\n this.type.factory.load(this.makeMapValueOpEmitter(key), undefined),\n this.type,\n );\n const previousValue = this.data.get(key);\n this.data.set(key, localValue);\n const event: IValueChanged = { key, previousValue };\n this.eventEmitter.emit(\"create\", event, local, this.eventEmitter);\n return localValue;\n }\n\n /**\n * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n * have the information we need to create a real object, but will not be the real object yet. For example,\n * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n * job is to convert that information into a real object for local usage.\n * @param key - The key that the caller intends to store the local value into (used for ops later). But\n * doesn't actually store the local value into that key. So better not lie!\n * @param serializable - The remote information that we can convert into a real object\n * @returns The local value that was produced\n */\n private makeLocal(key: string, serializable: ISerializableValue): ValueTypeLocalValue<T> {\n assert(serializable.type !== ValueType[ValueType.Plain] && serializable.type !== ValueType[ValueType.Shared],\n 0x2e1 /* \"Support for plain value types removed.\" */);\n\n serializable.value = parseHandles(serializable.value, this.serializer);\n const localValue = this.type.factory.load(\n this.makeMapValueOpEmitter(key),\n serializable.value,\n );\n return new ValueTypeLocalValue(localValue, this.type);\n }\n\n /**\n * Get the message handlers for the map.\n * @returns A map of string op names to IMapMessageHandlers for those ops\n */\n private getMessageHandlers() {\n const messageHandlers = new Map<string, IMapMessageHandler>();\n // Ops with type \"act\" describe actions taken by custom value type handlers of whatever item is\n // being addressed. These custom handlers can be retrieved from the ValueTypeLocalValue which has\n // stashed its valueType (and therefore its handlers). We also emit a valueChanged for anyone\n // watching for manipulations of that item.\n messageHandlers.set(\n \"act\",\n {\n process: (op: IMapValueTypeOperation, local, message, localOpMetadata) => {\n const localValue = this.data.get(op.key) ?? this.createCore(op.key, local);\n const handler = localValue.getOpHandler(op.value.opName);\n const previousValue = localValue.value;\n const translatedValue = parseHandles(\n op.value.value,\n this.serializer);\n handler.process(previousValue, translatedValue, local, message);\n const event: IValueChanged = { key: op.key, previousValue };\n this.eventEmitter.emit(\"valueChanged\", event, local, message, this.eventEmitter);\n },\n submit: (op: IMapValueTypeOperation) => {\n this.submitMessage(\n op,\n { lastProcessedSeq: this.lastProcessedSeq },\n );\n },\n getStashedOpLocalMetadata: (op: IMapValueTypeOperation) => {\n assert(false, 0x016 /* \"apply stashed op not implemented for custom value type ops\" */);\n },\n });\n\n return messageHandlers;\n }\n\n /**\n * Create an emitter for a value type to emit ops from the given key.\n * @alpha\n * @param key - The key of the map that the value type will be stored on\n * @returns A value op emitter for the given key\n */\n private makeMapValueOpEmitter(key: string): IValueOpEmitter {\n const emit = (opName: string, previousValue: any, params: any) => {\n const translatedParams = makeHandlesSerializable(\n params,\n this.serializer,\n this.handle);\n\n const op: IMapValueTypeOperation = {\n key,\n type: \"act\",\n value: {\n opName,\n value: translatedParams,\n },\n };\n // Send the localOpMetadata as undefined because we don't care about the ack.\n this.submitMessage(op, { lastProcessedSeq: this.lastProcessedSeq });\n\n const event: IValueChanged = { key, previousValue };\n this.eventEmitter.emit(\"valueChanged\", event, true, null, this.eventEmitter);\n };\n\n return { emit };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"defaultMap.js","sourceRoot":"","sources":["../src/defaultMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEH,uBAAuB,EACvB,YAAY,EACZ,SAAS,GACZ,MAAM,oC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ACH,MAAM;oBACN,KAAK,EAAE,gBAAgB;iBAC1B;aACJ,CAAC;YAEF,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;YAExC,MAAM,KAAK,GAAkB,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC;YACpD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QACjF,CAAC,CAAC;QAEF,OAAO,EAAE,IAAI,EAAE,CAAC;IACpB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IFluidSerializer,\n makeHandlesSerializable,\n parseHandles,\n ValueType,\n} from \"@fluidframework/shared-object-base\";\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport {\n makeSerializable,\n ValueTypeLocalValue,\n} from \"./localValues\";\nimport {\n ISerializableValue,\n ISerializedValue,\n IValueChanged,\n IValueOpEmitter,\n IValueType,\n IValueTypeOperationValue,\n ISharedDefaultMapEvents,\n IMapMessageLocalMetadata,\n} from \"./defaultMapInterfaces\";\n\n/**\n * Defines the means to process and submit a given op on a map.\n */\ninterface IMapMessageHandler {\n /**\n * Apply the given operation.\n * @param op - The map operation to apply\n * @param local - Whether the message originated from the local client\n * @param message - The full message. Not provided for stashed ops.\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n process(\n op: IMapOperation,\n local: boolean,\n message: ISequencedDocumentMessage | undefined,\n localOpMetadata: IMapMessageLocalMetadata,\n ): void;\n\n /**\n * Communicate the operation to remote clients.\n * @param op - The map operation to submit\n */\n submit(op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata): void;\n\n resubmit(op: IMapOperation, localOpMetadata: IMapMessageLocalMetadata): void;\n\n getStashedOpLocalMetadata(op: IMapOperation): unknown;\n}\n\n/**\n * Describes an operation specific to a value type.\n */\nexport interface IMapValueTypeOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"act\";\n\n /**\n * Map key being modified.\n */\n key: string;\n\n /**\n * Value of the operation, specific to the value type.\n * @alpha\n */\n value: IValueTypeOperationValue;\n}\n\n/**\n * Description of a map delta operation\n */\nexport type IMapOperation = IMapValueTypeOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n [key: string]: ISerializableValue;\n}\n\nexport interface IMapDataObjectSerialized {\n [key: string]: ISerializedValue;\n}\n\n/**\n * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by\n * string key locations.\n *\n * Creation of values is implicit on access (either via `get` or a remote op application referring to\n * a collection that wasn't previously known)\n */\nexport class DefaultMap<T> {\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size(): number {\n return this.data.size;\n }\n\n /**\n * Mapping of op types to message handlers.\n */\n private readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n /**\n * The in-memory data the map is storing.\n */\n private readonly data = new Map<string, ValueTypeLocalValue<T>>();\n\n /**\n * Create a new default map.\n * @param serializer - The serializer to serialize / parse handles\n * @param handle - The handle of the shared object using the kernel\n * @param submitMessage - A callback to submit a message through the shared object\n * @param type - The value type to create at values of this map\n * @param eventEmitter - The object that will emit map events\n */\n constructor(\n private readonly serializer: IFluidSerializer,\n private readonly handle: IFluidHandle,\n private readonly submitMessage: (op: any, localOpMetadata: IMapMessageLocalMetadata) => void,\n private readonly type: IValueType<T>,\n public readonly eventEmitter = new TypedEventEmitter<ISharedDefaultMapEvents>(),\n ) {\n this.messageHandlers = this.getMessageHandlers();\n }\n\n /**\n * Get an iterator over the keys in this map.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.data.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n const localEntriesIterator = this.data.entries();\n const iterator = {\n next(): IteratorResult<[string, any]> {\n const nextVal = localEntriesIterator.next();\n return nextVal.done\n ? { value: undefined, done: true }\n : { value: [nextVal.value[0], nextVal.value[1].value], done: false }; // Unpack the stored value\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n const localValuesIterator = this.data.values();\n const iterator = {\n next(): IteratorResult<any> {\n const nextVal = localValuesIterator.next();\n return nextVal.done\n ? { value: undefined, done: true }\n : { value: nextVal.value.value, done: false }; // Unpack the stored value\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.entries();\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n this.data.forEach((localValue, key, m) => {\n callbackFn(localValue.value, key, m);\n });\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n public get(key: string): T {\n const localValue = this.data.get(key) ?? this.createCore(key, true);\n\n return localValue.value;\n }\n\n /**\n * Check if a key exists in the map.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.data.has(key);\n }\n\n /**\n * Serializes the data stored in the shared map to a JSON string\n * @param serializer - The serializer to use to serialize handles in its values.\n * @returns A JSON string containing serialized map data\n */\n public getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n const serializableMapData: IMapDataObjectSerialized = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n const serializableMapData: IMapDataObjectSerializable = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public serialize(serializer: IFluidSerializer): string {\n return JSON.stringify(this.getSerializableStorage(serializer));\n }\n\n /**\n * Populate the kernel with the given map data.\n * @param data - A JSON string containing serialized map data\n */\n public populateFromSerializable(json: IMapDataObjectSerializable): void {\n for (const [key, serializable] of Object.entries(json)) {\n // Back-compat: legacy documents may have handles to an intervalCollection map kernel.\n // These collections should be empty, and ValueTypes are no longer supported.\n if (serializable.type === ValueType[ValueType.Plain]\n || serializable.type === ValueType[ValueType.Shared]) {\n continue;\n }\n\n // Back-compat: Sequence previously arbitrarily prefixed all interval collection keys with\n // \"intervalCollections/\". This would burden users trying to iterate the collection and\n // access its value, as well as those trying to match a create message to its underlying\n // collection. See https://github.com/microsoft/FluidFramework/issues/10557 for more context.\n const normalizedKey = key.startsWith(\"intervalCollections/\") ? key.substring(20) : key;\n\n const localValue = {\n key: normalizedKey,\n value: this.makeLocal(key, serializable),\n };\n\n this.data.set(localValue.key, localValue.value);\n }\n }\n\n public populate(json: string): void {\n this.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n }\n\n /**\n * Submit the given op if a handler is registered.\n * @param op - The operation to attempt to submit\n * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n * @returns True if the operation was submitted, false otherwise.\n */\n public tryResubmitMessage(op: any, localOpMetadata: IMapMessageLocalMetadata): boolean {\n const type: string = op.type;\n const handler = this.messageHandlers.get(type);\n if (handler !== undefined) {\n handler.resubmit(op as IMapOperation, localOpMetadata);\n return true;\n }\n return false;\n }\n\n public tryGetStashedOpLocalMetadata(op: any): unknown {\n const type: string = op.type;\n if (this.messageHandlers.has(type)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this.messageHandlers.get(type)!.getStashedOpLocalMetadata(op as IMapOperation);\n }\n throw new Error(\"no apply stashed op handler\");\n }\n\n /**\n * Process the given op if a handler is registered.\n * @param message - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation was processed, false otherwise.\n */\n public tryProcessMessage(\n op: IMapOperation,\n local: boolean,\n message: ISequencedDocumentMessage | undefined,\n localOpMetadata: unknown,\n ): boolean {\n const handler = this.messageHandlers.get(op.type);\n if (handler !== undefined) {\n handler.process(op, local, message, localOpMetadata as IMapMessageLocalMetadata);\n return true;\n }\n return false;\n }\n\n /**\n * Initializes a default ValueType at the provided key.\n * Should be used when a map operation incurs creation.\n * @param key - The key being initialized\n * @param local - Whether the message originated from the local client\n */\n private createCore(key: string, local: boolean): ValueTypeLocalValue<T> {\n const localValue = new ValueTypeLocalValue(\n this.type.factory.load(this.makeMapValueOpEmitter(key), undefined),\n this.type,\n );\n const previousValue = this.data.get(key);\n this.data.set(key, localValue);\n const event: IValueChanged = { key, previousValue };\n this.eventEmitter.emit(\"create\", event, local, this.eventEmitter);\n return localValue;\n }\n\n /**\n * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n * have the information we need to create a real object, but will not be the real object yet. For example,\n * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n * job is to convert that information into a real object for local usage.\n * @param key - The key that the caller intends to store the local value into (used for ops later). But\n * doesn't actually store the local value into that key. So better not lie!\n * @param serializable - The remote information that we can convert into a real object\n * @returns The local value that was produced\n */\n private makeLocal(key: string, serializable: ISerializableValue): ValueTypeLocalValue<T> {\n assert(serializable.type !== ValueType[ValueType.Plain] && serializable.type !== ValueType[ValueType.Shared],\n 0x2e1 /* \"Support for plain value types removed.\" */);\n\n serializable.value = parseHandles(serializable.value, this.serializer);\n const localValue = this.type.factory.load(\n this.makeMapValueOpEmitter(key),\n serializable.value,\n );\n return new ValueTypeLocalValue(localValue, this.type);\n }\n\n /**\n * Get the message handlers for the map.\n * @returns A map of string op names to IMapMessageHandlers for those ops\n */\n private getMessageHandlers() {\n const messageHandlers = new Map<string, IMapMessageHandler>();\n // Ops with type \"act\" describe actions taken by custom value type handlers of whatever item is\n // being addressed. These custom handlers can be retrieved from the ValueTypeLocalValue which has\n // stashed its valueType (and therefore its handlers). We also emit a valueChanged for anyone\n // watching for manipulations of that item.\n messageHandlers.set(\n \"act\",\n {\n process: (op: IMapValueTypeOperation, local, message, localOpMetadata) => {\n const localValue = this.data.get(op.key) ?? this.createCore(op.key, local);\n const handler = localValue.getOpHandler(op.value.opName);\n const previousValue = localValue.value;\n const translatedValue = parseHandles(\n op.value.value,\n this.serializer);\n handler.process(previousValue, translatedValue, local, message, localOpMetadata);\n const event: IValueChanged = { key: op.key, previousValue };\n this.eventEmitter.emit(\"valueChanged\", event, local, message, this.eventEmitter);\n },\n submit: (op: IMapValueTypeOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n this.submitMessage(\n op,\n localOpMetadata,\n );\n },\n resubmit: (op: IMapValueTypeOperation, localOpMetadata: IMapMessageLocalMetadata) => {\n const localValue = this.data.get(op.key);\n const handler = localValue.getOpHandler(op.value.opName);\n const {\n rebasedOp,\n rebasedLocalOpMetadata,\n } = handler.rebase(localValue.value, op.value, localOpMetadata);\n this.submitMessage(\n { ...op, value: rebasedOp },\n rebasedLocalOpMetadata,\n );\n },\n getStashedOpLocalMetadata: (op: IMapValueTypeOperation) => {\n assert(false, 0x016 /* \"apply stashed op not implemented for custom value type ops\" */);\n },\n });\n\n return messageHandlers;\n }\n\n /**\n * Create an emitter for a value type to emit ops from the given key.\n * @alpha\n * @param key - The key of the map that the value type will be stored on\n * @returns A value op emitter for the given key\n */\n private makeMapValueOpEmitter(key: string): IValueOpEmitter {\n const emit = (opName: string, previousValue: any, params: any, localOpMetadata: IMapMessageLocalMetadata) => {\n const translatedParams = makeHandlesSerializable(\n params,\n this.serializer,\n this.handle);\n\n const op: IMapValueTypeOperation = {\n key,\n type: \"act\",\n value: {\n opName,\n value: translatedParams,\n },\n };\n\n this.submitMessage(op, localOpMetadata);\n\n const event: IValueChanged = { key, previousValue };\n this.eventEmitter.emit(\"valueChanged\", event, true, null, this.eventEmitter);\n };\n\n return { emit };\n }\n}\n"]}
|
|
@@ -20,6 +20,7 @@ export interface IValueChanged {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.
|
|
23
|
+
* @internal
|
|
23
24
|
*/
|
|
24
25
|
export interface IValueOpEmitter {
|
|
25
26
|
/**
|
|
@@ -27,9 +28,16 @@ export interface IValueOpEmitter {
|
|
|
27
28
|
* @param opName - Name of the emitted operation
|
|
28
29
|
* @param previousValue - JSONable previous value as defined by the value type
|
|
29
30
|
* @param params - JSONable params for the operation as defined by the value type
|
|
30
|
-
* @
|
|
31
|
+
* @param localOpMetadata - JSONable local metadata which should be submitted with the op
|
|
32
|
+
* @internal
|
|
31
33
|
*/
|
|
32
|
-
emit(opName: string, previousValue: any, params: any): void;
|
|
34
|
+
emit(opName: string, previousValue: any, params: any, localOpMetadata: IMapMessageLocalMetadata): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export interface IMapMessageLocalMetadata {
|
|
40
|
+
localSeq: number;
|
|
33
41
|
}
|
|
34
42
|
/**
|
|
35
43
|
* A value factory is used to serialize/deserialize value types to a map
|
|
@@ -65,9 +73,22 @@ export interface IValueOperation<T> {
|
|
|
65
73
|
* @param params - The params on the incoming operation
|
|
66
74
|
* @param local - Whether the operation originated from this client
|
|
67
75
|
* @param message - The operation itself
|
|
76
|
+
* @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.
|
|
68
77
|
* @alpha
|
|
69
78
|
*/
|
|
70
|
-
process(value: T, params: any, local: boolean, message: ISequencedDocumentMessage | undefined): any;
|
|
79
|
+
process(value: T, params: any, local: boolean, message: ISequencedDocumentMessage | undefined, localOpMetadata: IMapMessageLocalMetadata | undefined): any;
|
|
80
|
+
/**
|
|
81
|
+
* Rebases an `op` on `value` from its original perspective (ref/local seq) to the current
|
|
82
|
+
* perspective. Should be invoked on reconnection.
|
|
83
|
+
* @param value - The current value stored at the given key, which should be the value type.
|
|
84
|
+
* @param op - The op to be rebased.
|
|
85
|
+
* @param localOpMetadata - Any local metadata that was originally submitted with the op.
|
|
86
|
+
* @returns A rebased version of the op and any local metadata that should be submitted with it.
|
|
87
|
+
*/
|
|
88
|
+
rebase(value: T, op: IValueTypeOperationValue, localOpMetadata: IMapMessageLocalMetadata): {
|
|
89
|
+
rebasedOp: IValueTypeOperationValue;
|
|
90
|
+
rebasedLocalOpMetadata: IMapMessageLocalMetadata;
|
|
91
|
+
};
|
|
71
92
|
}
|
|
72
93
|
/**
|
|
73
94
|
* Defines a value type that can be registered on a container type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultMapInterfaces.d.ts","sourceRoot":"","sources":["../src/defaultMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,aAAa,EAAE,GAAG,CAAC;CACtB;AAED
|
|
1
|
+
{"version":3,"file":"defaultMapInterfaces.d.ts","sourceRoot":"","sources":["../src/defaultMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE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CAAC;IAE1B;;;OAGG;IACH,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,uBAAwB,SAAQ,mBAAmB;IAChE,CAAC,KAAK,EAAE,cAAc,GAAG,QAAQ,EAAE,QAAQ,EAAE,CACzC,OAAO,EAAE,aAAa,EACtB,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,qBAAqB,KAAK,IAAI,OAAE;CAC/C;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACrC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,GAAG,CAAC;CACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultMapInterfaces.js","sourceRoot":"","sources":["../src/defaultMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n /**\n * The key storing the value that changed.\n */\n key: string;\n\n /**\n * The value that was stored at the key prior to the change.\n */\n previousValue: any;\n}\n\n/**\n * Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.\n */\nexport interface IValueOpEmitter {\n /**\n * Called by the value type to emit a value type operation through the container type holding it.\n * @param opName - Name of the emitted operation\n * @param previousValue - JSONable previous value as defined by the value type\n * @param params - JSONable params for the operation as defined by the value type\n * @
|
|
1
|
+
{"version":3,"file":"defaultMapInterfaces.js","sourceRoot":"","sources":["../src/defaultMapInterfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n /**\n * The key storing the value that changed.\n */\n key: string;\n\n /**\n * The value that was stored at the key prior to the change.\n */\n previousValue: any;\n}\n\n/**\n * Value types are given an IValueOpEmitter to emit their ops through the container type that holds them.\n * @internal\n */\nexport interface IValueOpEmitter {\n /**\n * Called by the value type to emit a value type operation through the container type holding it.\n * @param opName - Name of the emitted operation\n * @param previousValue - JSONable previous value as defined by the value type\n * @param params - JSONable params for the operation as defined by the value type\n * @param localOpMetadata - JSONable local metadata which should be submitted with the op\n * @internal\n */\n emit(opName: string, previousValue: any, params: any, localOpMetadata: IMapMessageLocalMetadata): void;\n}\n\n/**\n * @internal\n */\nexport interface IMapMessageLocalMetadata {\n localSeq: number;\n}\n\n/**\n * A value factory is used to serialize/deserialize value types to a map\n * @alpha\n */\nexport interface IValueFactory<T> {\n /**\n * Create a new value type. Used both in creation of new value types, as well as in loading existing ones\n * from remote.\n * @param emitter - Emitter object that the created value type will use to emit operations\n * @param raw - Initialization parameters as defined by the value type\n * @returns The new value type\n * @alpha\n */\n load(emitter: IValueOpEmitter, raw: any): T;\n\n /**\n * Given a value type, provides a JSONable form of its data to be used for snapshotting. This data must be\n * loadable using the load method of its factory.\n * @param value - The value type to serialize\n * @returns The JSONable form of the value type\n * @alpha\n */\n store(value: T): any;\n}\n\n/**\n * Defines an operation that a value type is able to handle.\n * @alpha\n */\nexport interface IValueOperation<T> {\n /**\n * Performs the actual processing on the incoming operation.\n * @param value - The current value stored at the given key, which should be the value type\n * @param params - The params on the incoming operation\n * @param local - Whether the operation originated from this client\n * @param message - The operation itself\n * @param localOpMetadata - any local metadata submitted by `IValueOpEmitter.emit`.\n * @alpha\n */\n process(\n value: T,\n params: any,\n local: boolean,\n message: ISequencedDocumentMessage | undefined,\n localOpMetadata: IMapMessageLocalMetadata | undefined\n );\n\n /**\n * Rebases an `op` on `value` from its original perspective (ref/local seq) to the current\n * perspective. Should be invoked on reconnection.\n * @param value - The current value stored at the given key, which should be the value type.\n * @param op - The op to be rebased.\n * @param localOpMetadata - Any local metadata that was originally submitted with the op.\n * @returns A rebased version of the op and any local metadata that should be submitted with it.\n */\n rebase(\n value: T,\n op: IValueTypeOperationValue,\n localOpMetadata: IMapMessageLocalMetadata\n ): { rebasedOp: IValueTypeOperationValue; rebasedLocalOpMetadata: IMapMessageLocalMetadata; };\n}\n\n/**\n * Defines a value type that can be registered on a container type.\n */\nexport interface IValueType<T> {\n /**\n * Name of the value type.\n * @alpha\n */\n name: string;\n\n /**\n * Factory method used to convert to/from a JSON form of the type.\n * @alpha\n */\n factory: IValueFactory<T>;\n\n /**\n * Operations that can be applied to the value type.\n * @alpha\n */\n ops: Map<string, IValueOperation<T>>;\n}\n\nexport interface ISharedDefaultMapEvents extends ISharedObjectEvents {\n (event: \"valueChanged\" | \"create\", listener: (\n changed: IValueChanged,\n local: boolean,\n target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n *\n * The DefaultMap impelmentation for sequence has been specialized to only support a single ValueType, which serializes\n * and deserializes via .store() and .load().\n */\nexport interface ISerializableValue {\n /**\n * A type annotation to help indicate how the value serializes.\n */\n type: string;\n\n /**\n * The JSONable representation of the value.\n */\n value: any;\n}\n\nexport interface ISerializedValue {\n /**\n * A type annotation to help indicate how the value serializes.\n */\n type: string;\n\n /**\n * String representation of the value.\n */\n value: string | undefined;\n}\n\n/**\n * ValueTypes handle ops slightly differently from SharedObjects or plain JS objects. Since the Map/Directory doesn't\n * know how to handle the ValueType's ops, those ops are instead passed along to the ValueType for processing.\n * IValueTypeOperationValue is that passed-along op. The opName on it is the ValueType-specific operation and the\n * value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is\n * serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather\n * it just describes an operation to be applied to an already-in-memory value.\n * @alpha\n */\nexport interface IValueTypeOperationValue {\n /**\n * The name of the operation.\n */\n opName: string;\n\n /**\n * The payload that is submitted along with the operation.\n */\n value: any;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { DeserializeCallback, IIntervalCollectionEvent, IIntervalHelpers, Interval, IntervalCollection, IntervalCollectionIterator, IntervalType, ISerializableInterval, ISerializedInterval, SequenceInterval, } from "./intervalCollection";
|
|
6
|
-
export { IValueOpEmitter, } from "./defaultMapInterfaces";
|
|
5
|
+
export { DeserializeCallback, IIntervalCollectionEvent, IIntervalHelpers, Interval, IntervalCollection, IntervalCollectionIterator, IntervalType, ISerializableInterval, ISerializedInterval, SequenceInterval, ISerializedIntervalCollectionV2, CompressedSerializedInterval, } from "./intervalCollection";
|
|
6
|
+
export { IMapMessageLocalMetadata, IValueOpEmitter, } from "./defaultMapInterfaces";
|
|
7
7
|
export * from "./sharedString";
|
|
8
8
|
export * from "./sequence";
|
|
9
9
|
export * from "./sequenceFactory";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,+BAA+B,EAC/B,4BAA4B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACH,wBAAwB,EACxB,eAAe,GAClB,MAAM,wBAAwB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIH,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EAGZ,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIH,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EAGZ,gBAAgB,GAGnB,MAAM,sBAAsB,CAAC;AAK9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n DeserializeCallback,\n IIntervalCollectionEvent,\n IIntervalHelpers,\n Interval,\n IntervalCollection,\n IntervalCollectionIterator,\n IntervalType,\n ISerializableInterval,\n ISerializedInterval,\n SequenceInterval,\n ISerializedIntervalCollectionV2,\n CompressedSerializedInterval,\n} from \"./intervalCollection\";\nexport {\n IMapMessageLocalMetadata,\n IValueOpEmitter,\n} from \"./defaultMapInterfaces\";\nexport * from \"./sharedString\";\nexport * from \"./sequence\";\nexport * from \"./sequenceFactory\";\nexport * from \"./sequenceDeltaEvent\";\nexport * from \"./sharedSequence\";\nexport * from \"./sharedObjectSequence\";\nexport * from \"./sharedNumberSequence\";\nexport * from \"./sparsematrix\";\nexport * from \"./sharedIntervalCollection\";\n"]}
|
|
@@ -30,6 +30,21 @@ export interface ISerializedInterval {
|
|
|
30
30
|
intervalType: IntervalType;
|
|
31
31
|
properties?: PropertySet;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* A size optimization to avoid redundantly storing keys when serializing intervals
|
|
35
|
+
* as JSON. Intervals are of the format:
|
|
36
|
+
*
|
|
37
|
+
* [start, end, sequenceNumber, intervalType, properties]
|
|
38
|
+
*/
|
|
39
|
+
export declare type CompressedSerializedInterval = [number, number, number, IntervalType, PropertySet];
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export interface ISerializedIntervalCollectionV2 {
|
|
44
|
+
label: string;
|
|
45
|
+
version: 2;
|
|
46
|
+
intervals: CompressedSerializedInterval[];
|
|
47
|
+
}
|
|
33
48
|
export interface ISerializableInterval extends IInterval {
|
|
34
49
|
properties: PropertySet;
|
|
35
50
|
propertyManager: PropertiesManager;
|
|
@@ -61,6 +76,7 @@ export declare class Interval implements ISerializableInterval {
|
|
|
61
76
|
getProperties(): PropertySet;
|
|
62
77
|
addProperties(newProps: PropertySet, collaborating?: boolean, seq?: number, op?: ICombiningOp): PropertySet | undefined;
|
|
63
78
|
modify(label: string, start: number, end: number, op?: ISequencedDocumentMessage): Interval;
|
|
79
|
+
private initializeProperties;
|
|
64
80
|
}
|
|
65
81
|
export declare class SequenceInterval implements ISerializableInterval {
|
|
66
82
|
start: LocalReference;
|
|
@@ -69,6 +85,17 @@ export declare class SequenceInterval implements ISerializableInterval {
|
|
|
69
85
|
properties: PropertySet;
|
|
70
86
|
propertyManager: PropertiesManager;
|
|
71
87
|
constructor(start: LocalReference, end: LocalReference, intervalType: IntervalType, props?: PropertySet);
|
|
88
|
+
private callbacks?;
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
* Subscribes to position change events on this interval if there are no current listeners.
|
|
92
|
+
*/
|
|
93
|
+
addPositionChangeListeners(beforePositionChange: () => void, afterPositionChange: () => void): void;
|
|
94
|
+
/**
|
|
95
|
+
* @internal
|
|
96
|
+
* Removes the currently subscribed position change listeners.
|
|
97
|
+
*/
|
|
98
|
+
removePositionChangeListeners(): void;
|
|
72
99
|
serialize(client: Client): ISerializedInterval;
|
|
73
100
|
clone(): SequenceInterval;
|
|
74
101
|
compare(b: SequenceInterval): number;
|
|
@@ -80,6 +107,7 @@ export declare class SequenceInterval implements ISerializableInterval {
|
|
|
80
107
|
addProperties(newProps: PropertySet, collab?: boolean, seq?: number, op?: ICombiningOp): PropertySet | undefined;
|
|
81
108
|
overlapsPos(bstart: number, bend: number): boolean;
|
|
82
109
|
modify(label: string, start: number, end: number, op?: ISequencedDocumentMessage): SequenceInterval;
|
|
110
|
+
private initializeProperties;
|
|
83
111
|
}
|
|
84
112
|
export declare function defaultIntervalConflictResolver(a: Interval, b: Interval): Interval;
|
|
85
113
|
export declare function createIntervalIndex(conflict?: IntervalConflictResolver<Interval>): LocalIntervalCollection<Interval>;
|
|
@@ -87,29 +115,45 @@ export declare class LocalIntervalCollection<TInterval extends ISerializableInte
|
|
|
87
115
|
private readonly client;
|
|
88
116
|
private readonly label;
|
|
89
117
|
private readonly helpers;
|
|
118
|
+
/** Callback invoked each time one of the endpoints of an interval slides. */
|
|
119
|
+
private readonly onPositionChange?;
|
|
90
120
|
private readonly intervalTree;
|
|
91
121
|
private readonly endIntervalTree;
|
|
122
|
+
private readonly intervalIdMap;
|
|
92
123
|
private conflictResolver;
|
|
93
124
|
private endConflictResolver;
|
|
94
125
|
private static readonly legacyIdPrefix;
|
|
95
|
-
constructor(client: Client, label: string, helpers: IIntervalHelpers<TInterval
|
|
126
|
+
constructor(client: Client, label: string, helpers: IIntervalHelpers<TInterval>,
|
|
127
|
+
/** Callback invoked each time one of the endpoints of an interval slides. */
|
|
128
|
+
onPositionChange?: (interval: TInterval) => void);
|
|
96
129
|
addConflictResolver(conflictResolver: IntervalConflictResolver<TInterval>): void;
|
|
97
130
|
map(fn: (interval: TInterval) => void): void;
|
|
98
131
|
createLegacyId(start: number, end: number): string;
|
|
99
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Validates that a serialized interval has the ID property. Creates an ID
|
|
134
|
+
* if one does not already exist
|
|
135
|
+
*
|
|
136
|
+
* @param serializedInterval - The interval to be checked
|
|
137
|
+
* @returns The interval's existing or newly created id
|
|
138
|
+
*/
|
|
139
|
+
ensureSerializedId(serializedInterval: ISerializedInterval): string;
|
|
100
140
|
mapUntil(fn: (interval: TInterval) => boolean): void;
|
|
101
141
|
gatherIterationResults(results: TInterval[], iteratesForward: boolean, start?: number, end?: number): void;
|
|
102
142
|
findOverlappingIntervals(startPosition: number, endPosition: number): TInterval[];
|
|
103
143
|
previousInterval(pos: number): TInterval;
|
|
104
144
|
nextInterval(pos: number): TInterval;
|
|
105
145
|
removeInterval(startPosition: number, endPosition: number): TInterval;
|
|
146
|
+
private removeIntervalFromIndex;
|
|
106
147
|
removeExistingInterval(interval: TInterval): void;
|
|
107
148
|
createInterval(start: number, end: number, intervalType: IntervalType, op?: ISequencedDocumentMessage): TInterval;
|
|
108
149
|
addInterval(start: number, end: number, intervalType: IntervalType, props?: PropertySet, op?: ISequencedDocumentMessage): TInterval;
|
|
150
|
+
private addIntervalToIndex;
|
|
109
151
|
add(interval: TInterval): void;
|
|
110
152
|
getIntervalById(id: string): TInterval;
|
|
111
153
|
changeInterval(interval: TInterval, start: number, end: number, op?: ISequencedDocumentMessage): TInterval;
|
|
112
|
-
serialize():
|
|
154
|
+
serialize(): ISerializedIntervalCollectionV2;
|
|
155
|
+
private addIntervalListeners;
|
|
156
|
+
private removeIntervalListeners;
|
|
113
157
|
}
|
|
114
158
|
export declare class SequenceIntervalCollectionValueType implements IValueType<IntervalCollection<SequenceInterval>> {
|
|
115
159
|
static Name: string;
|
|
@@ -138,7 +182,17 @@ export declare class IntervalCollectionIterator<TInterval extends ISerializableI
|
|
|
138
182
|
};
|
|
139
183
|
}
|
|
140
184
|
export interface IIntervalCollectionEvent<TInterval extends ISerializableInterval> extends IEvent {
|
|
141
|
-
|
|
185
|
+
/**
|
|
186
|
+
* This event is invoked whenever the properties or endpoints of an interval may have changed.
|
|
187
|
+
* This can happen on:
|
|
188
|
+
* - endpoint modification (local or remote)
|
|
189
|
+
* - ack of an endpoint modification
|
|
190
|
+
* - property change (local or remote)
|
|
191
|
+
* - position change due to segment sliding (will always appear as a local change)
|
|
192
|
+
* The `interval` argument reflects the new values.
|
|
193
|
+
*/
|
|
194
|
+
(event: "changeInterval", listener: (interval: TInterval, local: boolean, op: ISequencedDocumentMessage | undefined) => void): any;
|
|
195
|
+
(event: "addInterval" | "deleteInterval", listener: (interval: TInterval, local: boolean, op: ISequencedDocumentMessage) => void): any;
|
|
142
196
|
(event: "propertyChanged", listener: (interval: TInterval, propertyArgs: PropertySet) => void): any;
|
|
143
197
|
}
|
|
144
198
|
export declare class IntervalCollection<TInterval extends ISerializableInterval> extends TypedEventEmitter<IIntervalCollectionEvent<TInterval>> {
|
|
@@ -149,11 +203,16 @@ export declare class IntervalCollection<TInterval extends ISerializableInterval>
|
|
|
149
203
|
private localCollection;
|
|
150
204
|
private onDeserialize;
|
|
151
205
|
private client;
|
|
152
|
-
private pendingChangesStart;
|
|
153
|
-
private pendingChangesEnd;
|
|
206
|
+
private readonly pendingChangesStart;
|
|
207
|
+
private readonly pendingChangesEnd;
|
|
154
208
|
get attached(): boolean;
|
|
155
|
-
|
|
209
|
+
/** @internal */
|
|
210
|
+
constructor(helpers: IIntervalHelpers<TInterval>, requiresClient: boolean, emitter: IValueOpEmitter, serializedIntervals: ISerializedInterval[] | ISerializedIntervalCollectionV2);
|
|
156
211
|
attachGraph(client: Client, label: string): void;
|
|
212
|
+
/**
|
|
213
|
+
* Gets the next local sequence number, modifying this client's collab window in doing so.
|
|
214
|
+
*/
|
|
215
|
+
private getNextLocalSeq;
|
|
157
216
|
getIntervalById(id: string): TInterval;
|
|
158
217
|
/**
|
|
159
218
|
* Create a new interval and add it to the collection
|
|
@@ -180,6 +239,8 @@ export declare class IntervalCollection<TInterval extends ISerializableInterval>
|
|
|
180
239
|
ackChange(serializedInterval: ISerializedInterval, local: boolean, op: ISequencedDocumentMessage): void;
|
|
181
240
|
addConflictResolver(conflictResolver: IntervalConflictResolver<TInterval>): void;
|
|
182
241
|
attachDeserializer(onDeserialize: DeserializeCallback): void;
|
|
242
|
+
/** @internal */
|
|
243
|
+
rebaseLocalInterval(opName: string, serializedInterval: ISerializedInterval, localSeq: number): ISerializedInterval;
|
|
183
244
|
private getSlideToSegment;
|
|
184
245
|
private setSlideOnRemove;
|
|
185
246
|
private ackInterval;
|
|
@@ -191,7 +252,10 @@ export declare class IntervalCollection<TInterval extends ISerializableInterval>
|
|
|
191
252
|
deleteInterval(serializedInterval: ISerializedInterval, local: boolean, op: ISequencedDocumentMessage): void;
|
|
192
253
|
/** @internal */
|
|
193
254
|
ackDelete(serializedInterval: ISerializedInterval, local: boolean, op: ISequencedDocumentMessage): void;
|
|
194
|
-
|
|
255
|
+
/**
|
|
256
|
+
* @internal
|
|
257
|
+
*/
|
|
258
|
+
serializeInternal(): ISerializedIntervalCollectionV2;
|
|
195
259
|
[Symbol.iterator](): IntervalCollectionIterator<TInterval>;
|
|
196
260
|
CreateForwardIteratorWithStartPosition(startPosition: number): IntervalCollectionIterator<TInterval>;
|
|
197
261
|
CreateBackwardIteratorWithStartPosition(startPosition: number): IntervalCollectionIterator<TInterval>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalCollection.d.ts","sourceRoot":"","sources":["../src/intervalCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAU,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EAEH,MAAM,EAGN,YAAY,EACZ,SAAS,EACT,wBAAwB,EAIxB,cAAc,EAEd,iBAAiB,EACjB,WAAW,EAMd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"intervalCollection.d.ts","sourceRoot":"","sources":["../src/intervalCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAU,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EAEH,MAAM,EAGN,YAAY,EACZ,SAAS,EACT,wBAAwB,EAIxB,cAAc,EAEd,iB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