@fluidframework/map 2.51.0 → 2.52.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.
@@ -1 +1 @@
1
- {"version":3,"file":"mapKernel.js","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,MAAM,EACN,gBAAgB,EAEhB,eAAe,GACf,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAcxE,OAAO,EAEN,cAAc,EACd,2BAA2B,GAC3B,MAAM,kBAAkB,CAAC;AAwD1B,mGAAmG;AAEnG,SAAS,uBAAuB,CAAC,QAAa;IAC7C,OAAO,CACN,QAAQ,KAAK,SAAS;QACtB,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ;QAC7C,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CACrD,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,QAAa;IAC5C,OAAO,CACN,QAAQ,KAAK,SAAS;QACtB,QAAQ,CAAC,IAAI,KAAK,OAAO;QACzB,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ,CAC7C,CAAC;AACH,CAAC;AAED,kGAAkG;AAElG,SAAS,0BAA0B,CAClC,EAAsB,EACtB,qBAA6B,EAC7B,WAAsC;IAEtC,MAAM,aAAa,GAA6B;QAC/C,IAAI,EAAE,OAAO;QACb,gBAAgB,EAAE,qBAAqB;QACvC,WAAW;KACX,CAAC;IACF,OAAO,aAAa,CAAC;AACtB,CAAC;AAED,SAAS,wBAAwB,CAChC,EAAoB,EACpB,gBAAwB,EACxB,aAA2B;IAE3B,MAAM,aAAa,GAA0B,aAAa;QACzD,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE;QACnD,CAAC,CAAC,EAAE,IAA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AI,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC;QAC1E,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tassert,\n\tDoublyLinkedList,\n\ttype ListNode,\n\tunreachableCase,\n} from \"@fluidframework/core-utils/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport { ValueType } from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ISharedMapEvents } from \"./interfaces.js\";\nimport type {\n\tIMapClearLocalOpMetadata,\n\tIMapClearOperation,\n\tIMapDeleteOperation,\n\tIMapKeyAddLocalOpMetadata,\n\tIMapKeyEditLocalOpMetadata,\n\tIMapSetOperation,\n\t// eslint-disable-next-line import/no-deprecated\n\tISerializableValue,\n\tISerializedValue,\n} from \"./internalInterfaces.js\";\nimport {\n\ttype ILocalValue,\n\tserializeValue,\n\tmigrateIfSharedSerializable,\n} from \"./localValues.js\";\n\n/**\n * Defines the means to process and resubmit a given op on a map.\n */\ninterface IMapMessageHandler {\n\t/**\n\t * Apply the given operation.\n\t * @param op - The map operation to apply\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess(\n\t\top: IMapOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: ListNode<MapLocalOpMetadata> | undefined,\n\t): void;\n\n\t/**\n\t * Resubmit a previously submitted operation that was not delivered.\n\t * @param op - The map operation to resubmit\n\t * @param localOpMetadata - The metadata that was originally submitted with the message.\n\t */\n\tresubmit(op: IMapOperation, localOpMetadata: ListNode<MapLocalOpMetadata>): void;\n}\n\n/**\n * Map key operations are one of several types.\n */\nexport type IMapKeyOperation = IMapSetOperation | IMapDeleteOperation;\n\n/**\n * Description of a map delta operation\n */\nexport type IMapOperation = IMapKeyOperation | IMapClearOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n *\n * @remarks Directly used in\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify\n * | JSON.stringify}, direct result from\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.\n */\n// eslint-disable-next-line import/no-deprecated\nexport type IMapDataObjectSerializable = Record<string, ISerializableValue>;\n\n/**\n * Serialized key/value data.\n */\nexport type IMapDataObjectSerialized = Record<string, ISerializedValue>;\n\ntype MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;\ntype MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction isMapKeyLocalOpMetadata(metadata: any): metadata is MapKeyLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\t(metadata.type === \"add\" || metadata.type === \"edit\")\n\t);\n}\n\nfunction isClearLocalOpMetadata(metadata: any): metadata is IMapClearLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\tmetadata.type === \"clear\" &&\n\t\ttypeof metadata.pendingMessageId === \"number\"\n\t);\n}\n\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction createClearLocalOpMetadata(\n\top: IMapClearOperation,\n\tpendingClearMessageId: number,\n\tpreviousMap?: Map<string, ILocalValue>,\n): IMapClearLocalOpMetadata {\n\tconst localMetadata: IMapClearLocalOpMetadata = {\n\t\ttype: \"clear\",\n\t\tpendingMessageId: pendingClearMessageId,\n\t\tpreviousMap,\n\t};\n\treturn localMetadata;\n}\n\nfunction createKeyLocalOpMetadata(\n\top: IMapKeyOperation,\n\tpendingMessageId: number,\n\tpreviousValue?: ILocalValue,\n): MapKeyLocalOpMetadata {\n\tconst localMetadata: MapKeyLocalOpMetadata = previousValue\n\t\t? { type: \"edit\", pendingMessageId, previousValue }\n\t\t: { type: \"add\", pendingMessageId };\n\treturn localMetadata;\n}\n\n/**\n * A SharedMap is a map-like distributed data structure.\n */\nexport class MapKernel {\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.data.size;\n\t}\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n\t/**\n\t * The in-memory data the map is storing.\n\t */\n\tprivate readonly data = new Map<string, ILocalValue>();\n\n\t/**\n\t * Keys that have been modified locally but not yet ack'd from the server.\n\t */\n\tprivate readonly pendingKeys = new Map<string, number[]>();\n\n\t/**\n\t * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.\n\t */\n\tprivate nextPendingMessageId: number = 0;\n\n\t/**\n\t * The pending metadata for any local operations that have not yet been ack'd from the server, in order.\n\t */\n\tprivate readonly pendingMapLocalOpMetadata: DoublyLinkedList<MapLocalOpMetadata> =\n\t\tnew DoublyLinkedList<MapLocalOpMetadata>();\n\n\t/**\n\t * The pending ids of any clears that have been performed locally but not yet ack'd from the server\n\t */\n\tprivate readonly pendingClearMessageIds: number[] = [];\n\n\t/**\n\t * Create a new shared map kernel.\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param handle - The handle of the shared object using the kernel\n\t * @param submitMessage - A callback to submit a message through the shared object\n\t * @param isAttached - To query whether the shared object should generate ops\n\t * @param valueTypes - The value types to register\n\t * @param eventEmitter - The object that will emit map events\n\t */\n\tpublic constructor(\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tprivate readonly handle: IFluidHandle,\n\t\tprivate readonly submitMessage: (op: unknown, localOpMetadata: unknown) => void,\n\t\tprivate readonly isAttached: () => boolean,\n\t\tprivate readonly eventEmitter: TypedEventEmitter<ISharedMapEvents>,\n\t) {\n\t\tthis.messageHandlers = this.getMessageHandlers();\n\t}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.data.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\tpublic entries(): IterableIterator<[string, unknown]> {\n\t\tconst localEntriesIterator = this.data.entries();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<[string, unknown]> {\n\t\t\t\tconst nextVal = localEntriesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: // Unpack the stored value\n\t\t\t\t\t\t{ value: [nextVal.value[0], nextVal.value[1].value], done: false };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<unknown> {\n\t\tconst localValuesIterator = this.data.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<unknown> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: // Unpack the stored value\n\t\t\t\t\t\t{ value: nextVal.value.value, done: false };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<unknown> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Executes the given callback on each entry in the map.\n\t * @param callbackFn - Callback function\n\t */\n\tpublic forEach(\n\t\tcallbackFn: (value: unknown, key: string, map: Map<string, unknown>) => void,\n\t): void {\n\t\t// eslint-disable-next-line unicorn/no-array-for-each\n\t\tthis.data.forEach((localValue, key, m) => {\n\t\t\tcallbackFn(localValue.value, key, m);\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\tpublic get<T = unknown>(key: string): T | undefined {\n\t\tconst localValue = this.data.get(key);\n\t\treturn localValue === undefined ? undefined : (localValue.value as T);\n\t}\n\n\t/**\n\t * Check if a key exists in the map.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.data.has(key);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.set}\n\t */\n\tpublic set(key: string, value: unknown): void {\n\t\t// Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (key === undefined || key === null) {\n\t\t\tthrow new Error(\"Undefined and null keys are not supported\");\n\t\t}\n\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(key, { value }, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst op: IMapSetOperation = {\n\t\t\tkey,\n\t\t\ttype: \"set\",\n\t\t\tvalue: { type: ValueType[ValueType.Plain], value },\n\t\t};\n\t\tthis.submitMapKeyMessage(op, previousValue);\n\t}\n\n\t/**\n\t * Delete a key from the map.\n\t * @param key - Key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\t// Delete the key locally first.\n\t\tconst previousValue = this.deleteCore(key, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn previousValue !== undefined;\n\t\t}\n\n\t\tconst op: IMapDeleteOperation = {\n\t\t\tkey,\n\t\t\ttype: \"delete\",\n\t\t};\n\t\tthis.submitMapKeyMessage(op, previousValue);\n\n\t\treturn previousValue !== undefined;\n\t}\n\n\t/**\n\t * Clear all data from the map.\n\t */\n\tpublic clear(): void {\n\t\tconst copy = this.isAttached() ? new Map<string, ILocalValue>(this.data) : undefined;\n\n\t\t// Clear the data locally first.\n\t\tthis.clearCore(true);\n\n\t\t// Clear the pendingKeys immediately, the local unack'd operations are aborted\n\t\tthis.pendingKeys.clear();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst op: IMapClearOperation = {\n\t\t\ttype: \"clear\",\n\t\t};\n\t\tthis.submitMapClearMessage(op, copy);\n\t}\n\n\t/**\n\t * Serializes the data stored in the shared map to a JSON string\n\t * @param serializer - The serializer to use to serialize handles in its values.\n\t * @returns A JSON string containing serialized map data\n\t */\n\tpublic getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n\t\tconst serializedMapData: IMapDataObjectSerialized = {};\n\t\tfor (const [key, localValue] of this.data.entries()) {\n\t\t\tserializedMapData[key] = serializeValue(localValue.value, serializer, this.handle);\n\t\t}\n\t\treturn serializedMapData;\n\t}\n\n\t/**\n\t * Populate the kernel with the given map data.\n\t * @param data - A JSON string containing serialized map data\n\t */\n\tpublic populateFromSerializable(json: IMapDataObjectSerializable): void {\n\t\tfor (const [key, serializable] of Object.entries(\n\t\t\tthis.serializer.decode(json) as IMapDataObjectSerializable,\n\t\t)) {\n\t\t\tmigrateIfSharedSerializable(serializable, this.serializer, this.handle);\n\t\t\tthis.data.set(key, { value: serializable.value });\n\t\t}\n\t}\n\n\t/**\n\t * Resubmit the given op if a handler is registered.\n\t * @param op - The operation to attempt to submit\n\t * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t * @returns True if the operation was submitted, false otherwise.\n\t */\n\tpublic tryResubmitMessage(op: IMapOperation, localOpMetadata: unknown): boolean {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\thandler.resubmit(op, localOpMetadata as ListNode<MapLocalOpMetadata>);\n\t\treturn true;\n\t}\n\n\tpublic tryApplyStashedOp(op: IMapOperation): void {\n\t\tswitch (op.type) {\n\t\t\tcase \"clear\": {\n\t\t\t\tthis.clear();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tthis.delete(op.key);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"set\": {\n\t\t\t\tmigrateIfSharedSerializable(op.value, this.serializer, this.handle);\n\t\t\t\tthis.set(op.key, op.value.value);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(op);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation was recognized and thus processed, false otherwise.\n\t *\n\t * @remarks\n\t * When this returns false and the caller doesn't handle the op itself, then the op could be from a different version of this code.\n\t * In such a case, not applying the op would result in this client becoming out of sync with clients that do handle the op\n\t * and could result in data corruption or data loss as well.\n\t * Therefore, in such cases the caller should typically throw an error, ensuring that this client treats the situation as data corruption\n\t * (since its data no longer matches what other clients think the data should be) and will avoid overriding document content or misleading the users into thinking their current state is accurate.\n\t */\n\tpublic tryProcessMessage(\n\t\top: IMapOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\thandler.process(op, local, localOpMetadata as ListNode<MapLocalOpMetadata> | undefined);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Rollback a local op\n\t * @param op - The operation to rollback\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\tpublic rollback(op: unknown, localOpMetadata: unknown): void {\n\t\tconst mapOp: IMapOperation = op as IMapOperation;\n\t\tconst listNodeLocalOpMetadata = localOpMetadata as ListNode<MapLocalOpMetadata>;\n\t\tconst removedLocalOpMetadata = this.pendingMapLocalOpMetadata.pop();\n\t\tassert(\n\t\t\tremovedLocalOpMetadata !== undefined &&\n\t\t\t\tremovedLocalOpMetadata === listNodeLocalOpMetadata,\n\t\t\t0xbcb /* Rolling back unexpected op */,\n\t\t);\n\n\t\tif (mapOp.type === \"clear\" && listNodeLocalOpMetadata.data.type === \"clear\") {\n\t\t\tif (listNodeLocalOpMetadata.data.previousMap === undefined) {\n\t\t\t\tthrow new Error(\"Cannot rollback without previous map\");\n\t\t\t}\n\t\t\tfor (const [key, localValue] of listNodeLocalOpMetadata.data.previousMap.entries()) {\n\t\t\t\tthis.setCore(key, localValue, true);\n\t\t\t}\n\n\t\t\tconst lastPendingClearId = this.pendingClearMessageIds.pop();\n\t\t\tif (\n\t\t\t\tlastPendingClearId === undefined ||\n\t\t\t\tlastPendingClearId !== listNodeLocalOpMetadata.data.pendingMessageId\n\t\t\t) {\n\t\t\t\tthrow new Error(\"Rollback op does match last clear\");\n\t\t\t}\n\t\t} else if (mapOp.type === \"delete\" || mapOp.type === \"set\") {\n\t\t\tif (listNodeLocalOpMetadata.data.type === \"add\") {\n\t\t\t\tthis.deleteCore(mapOp.key, true);\n\t\t\t} else if (\n\t\t\t\tlistNodeLocalOpMetadata.data.type === \"edit\" &&\n\t\t\t\tlistNodeLocalOpMetadata.data.previousValue !== undefined\n\t\t\t) {\n\t\t\t\tthis.setCore(mapOp.key, listNodeLocalOpMetadata.data.previousValue, true);\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Cannot rollback without previous value\");\n\t\t\t}\n\n\t\t\tconst pendingMessageIds = this.pendingKeys.get(mapOp.key);\n\t\t\tconst lastPendingMessageId = pendingMessageIds?.pop();\n\t\t\tif (\n\t\t\t\t!pendingMessageIds ||\n\t\t\t\tlastPendingMessageId !== listNodeLocalOpMetadata.data.pendingMessageId\n\t\t\t) {\n\t\t\t\tthrow new Error(\"Rollback op does not match last pending\");\n\t\t\t}\n\t\t\tif (pendingMessageIds.length === 0) {\n\t\t\t\tthis.pendingKeys.delete(mapOp.key);\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/**\n\t * Set implementation used for both locally sourced sets as well as incoming remote sets.\n\t * @param key - The key being set\n\t * @param value - The value being set\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key, if any\n\t */\n\tprivate setCore(key: string, value: ILocalValue, local: boolean): ILocalValue | undefined {\n\t\tconst previousLocalValue = this.data.get(key);\n\t\tconst previousValue: unknown = previousLocalValue?.value;\n\t\tthis.data.set(key, value);\n\t\tthis.eventEmitter.emit(\"valueChanged\", { key, previousValue }, local, this.eventEmitter);\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate clearCore(local: boolean): void {\n\t\tthis.data.clear();\n\t\tthis.eventEmitter.emit(\"clear\", local, this.eventEmitter);\n\t}\n\n\t/**\n\t * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n\t * @param key - The key being deleted\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key if it existed, undefined if it did not exist\n\t */\n\tprivate deleteCore(key: string, local: boolean): ILocalValue | undefined {\n\t\tconst previousLocalValue = this.data.get(key);\n\t\tconst previousValue: unknown = previousLocalValue?.value;\n\t\tconst successfullyRemoved = this.data.delete(key);\n\t\tif (successfullyRemoved) {\n\t\t\tthis.eventEmitter.emit(\"valueChanged\", { key, previousValue }, local, this.eventEmitter);\n\t\t}\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n\t */\n\tprivate clearExceptPendingKeys(): void {\n\t\t// Assuming the pendingKeys is small and the map is large\n\t\t// we will get the value for the pendingKeys and clear the map\n\t\tconst temp = new Map<string, ILocalValue>();\n\t\tfor (const key of this.pendingKeys.keys()) {\n\t\t\t// Verify if the most recent pending operation is a delete op, no need to retain it if so.\n\t\t\t// This ensures the map size remains consistent.\n\t\t\tif (this.data.has(key)) {\n\t\t\t\ttemp.set(key, this.data.get(key) as ILocalValue);\n\t\t\t}\n\t\t}\n\t\tthis.clearCore(false);\n\t\tfor (const [key, value] of temp.entries()) {\n\t\t\tthis.setCore(key, value, true);\n\t\t}\n\t}\n\n\t/**\n\t * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n\t * not process the incoming operation.\n\t * @param op - Operation to check\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation should be processed, false otherwise\n\t */\n\tprivate needProcessKeyOperation(\n\t\top: IMapKeyOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: MapLocalOpMetadata | undefined,\n\t): boolean {\n\t\tif (this.pendingClearMessageIds[0] !== undefined) {\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined &&\n\t\t\t\t\t\tisMapKeyLocalOpMetadata(localOpMetadata) &&\n\t\t\t\t\t\tlocalOpMetadata.pendingMessageId < this.pendingClearMessageIds[0],\n\t\t\t\t\t0x013 /* \"Received out of order op when there is an unackd clear message\" */,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// If we have an unack'd clear, we can ignore all ops.\n\t\t\treturn false;\n\t\t}\n\n\t\tconst pendingKeyMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingKeyMessageIds !== undefined) {\n\t\t\t// Found an unack'd op. Clear it from the map if the pendingMessageId in the map matches this message's\n\t\t\t// and don't process the op.\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t0x014 /* pendingMessageId is missing from the local client's operation */,\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tpendingKeyMessageIds[0] === localOpMetadata.pendingMessageId,\n\t\t\t\t\t0x2fa /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tpendingKeyMessageIds.shift();\n\t\t\t\tif (pendingKeyMessageIds.length === 0) {\n\t\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// If we don't have a NACK op on the key, we need to process the remote ops.\n\t\treturn !local;\n\t}\n\n\t/**\n\t * Get the message handlers for the map.\n\t * @returns A map of string op names to IMapMessageHandlers for those ops\n\t */\n\tprivate getMessageHandlers(): Map<string, IMapMessageHandler> {\n\t\tconst messageHandlers = new Map<string, IMapMessageHandler>();\n\t\tmessageHandlers.set(\"clear\", {\n\t\t\tprocess: (\n\t\t\t\top: IMapClearOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: ListNode<MapLocalOpMetadata> | undefined,\n\t\t\t) => {\n\t\t\t\tif (local) {\n\t\t\t\t\tconst removedLocalOpMetadata = this.pendingMapLocalOpMetadata.shift();\n\t\t\t\t\tassert(\n\t\t\t\t\t\tremovedLocalOpMetadata !== undefined && removedLocalOpMetadata === localOpMetadata,\n\t\t\t\t\t\t0xbcc /* Processing unexpected local clear op */,\n\t\t\t\t\t);\n\t\t\t\t\tassert(\n\t\t\t\t\t\tisClearLocalOpMetadata(localOpMetadata.data),\n\t\t\t\t\t\t0x015 /* \"pendingMessageId is missing from the local client's clear operation\" */,\n\t\t\t\t\t);\n\t\t\t\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingClearMessageId === localOpMetadata.data.pendingMessageId,\n\t\t\t\t\t\t0x2fb /* pendingMessageId does not match */,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (this.pendingKeys.size > 0) {\n\t\t\t\t\tthis.clearExceptPendingKeys();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.clearCore(local);\n\t\t\t},\n\t\t\tresubmit: (op: IMapClearOperation, localOpMetadata: ListNode<MapLocalOpMetadata>) => {\n\t\t\t\tconst removedLocalOpMetadata = localOpMetadata.remove()?.data;\n\t\t\t\tassert(\n\t\t\t\t\tremovedLocalOpMetadata !== undefined,\n\t\t\t\t\t0xbcd /* Resubmitting unexpected local clear op */,\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tisClearLocalOpMetadata(localOpMetadata.data),\n\t\t\t\t\t0x2fc /* Invalid localOpMetadata for clear */,\n\t\t\t\t);\n\t\t\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\t\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t\t\tassert(\n\t\t\t\t\tpendingClearMessageId === localOpMetadata.data.pendingMessageId,\n\t\t\t\t\t0x2fd /* pendingMessageId does not match */,\n\t\t\t\t);\n\t\t\t\tthis.submitMapClearMessage(op, localOpMetadata.data.previousMap);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"delete\", {\n\t\t\tprocess: (\n\t\t\t\top: IMapDeleteOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: ListNode<MapLocalOpMetadata> | undefined,\n\t\t\t) => {\n\t\t\t\tif (local) {\n\t\t\t\t\tconst removedLocalOpMetadata = this.pendingMapLocalOpMetadata.shift();\n\t\t\t\t\tassert(\n\t\t\t\t\t\tremovedLocalOpMetadata !== undefined && removedLocalOpMetadata === localOpMetadata,\n\t\t\t\t\t\t0xbce /* Processing unexpected local delete op */,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (!this.needProcessKeyOperation(op, local, localOpMetadata?.data)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.deleteCore(op.key, local);\n\t\t\t},\n\t\t\tresubmit: (op: IMapDeleteOperation, localOpMetadata: ListNode<MapLocalOpMetadata>) => {\n\t\t\t\tconst removedLocalOpMetadata = localOpMetadata.remove()?.data;\n\t\t\t\tassert(\n\t\t\t\t\tremovedLocalOpMetadata !== undefined,\n\t\t\t\t\t0xbcf /* Resubmitting unexpected local delete op */,\n\t\t\t\t);\n\t\t\t\tthis.resubmitMapKeyMessage(op, localOpMetadata.data);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"set\", {\n\t\t\tprocess: (\n\t\t\t\top: IMapSetOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: ListNode<MapLocalOpMetadata> | undefined,\n\t\t\t) => {\n\t\t\t\tif (local) {\n\t\t\t\t\tconst removedLocalOpMetadata = this.pendingMapLocalOpMetadata.shift();\n\t\t\t\t\tassert(\n\t\t\t\t\t\tremovedLocalOpMetadata !== undefined && removedLocalOpMetadata === localOpMetadata,\n\t\t\t\t\t\t0xbd0 /* Processing unexpected local set op */,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (!this.needProcessKeyOperation(op, local, localOpMetadata?.data)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// needProcessKeyOperation should have returned false if local is true\n\t\t\t\tmigrateIfSharedSerializable(op.value, this.serializer, this.handle);\n\t\t\t\tthis.setCore(op.key, { value: op.value.value }, local);\n\t\t\t},\n\t\t\tresubmit: (op: IMapSetOperation, localOpMetadata: ListNode<MapLocalOpMetadata>) => {\n\t\t\t\tconst removedLocalOpMetadata = localOpMetadata.remove()?.data;\n\t\t\t\tassert(\n\t\t\t\t\tremovedLocalOpMetadata !== undefined,\n\t\t\t\t\t0xbd1 /* Resubmitting unexpected local set op */,\n\t\t\t\t);\n\t\t\t\tthis.resubmitMapKeyMessage(op, localOpMetadata.data);\n\t\t\t},\n\t\t});\n\n\t\treturn messageHandlers;\n\t}\n\n\tprivate getMapClearMessageId(): number {\n\t\tconst pendingMessageId = this.nextPendingMessageId++;\n\t\tthis.pendingClearMessageIds.push(pendingMessageId);\n\t\treturn pendingMessageId;\n\t}\n\n\t/**\n\t * Submit a clear message to remote clients.\n\t * @param op - The clear message\n\t */\n\tprivate submitMapClearMessage(\n\t\top: IMapClearOperation,\n\t\tpreviousMap?: Map<string, ILocalValue>,\n\t): void {\n\t\tconst pendingMessageId = this.getMapClearMessageId();\n\t\tconst localMetadata = createClearLocalOpMetadata(op, pendingMessageId, previousMap);\n\t\tconst listNode = this.pendingMapLocalOpMetadata.push(localMetadata).first;\n\t\tthis.submitMessage(op, listNode);\n\t}\n\n\tprivate getMapKeyMessageId(op: IMapKeyOperation): number {\n\t\tconst pendingMessageId = this.nextPendingMessageId++;\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingMessageIds === undefined) {\n\t\t\tthis.pendingKeys.set(op.key, [pendingMessageId]);\n\t\t} else {\n\t\t\tpendingMessageIds.push(pendingMessageId);\n\t\t}\n\t\treturn pendingMessageId;\n\t}\n\n\t/**\n\t * Submit a map key message to remote clients.\n\t * @param op - The map key message\n\t * @param previousValue - The value of the key before this op\n\t */\n\tprivate submitMapKeyMessage(op: IMapKeyOperation, previousValue?: ILocalValue): void {\n\t\tconst pendingMessageId = this.getMapKeyMessageId(op);\n\t\tconst localMetadata = createKeyLocalOpMetadata(op, pendingMessageId, previousValue);\n\t\tconst listNode = this.pendingMapLocalOpMetadata.push(localMetadata).first;\n\t\tthis.submitMessage(op, listNode);\n\t}\n\n\t/**\n\t * Submit a map key message to remote clients based on a previous submit.\n\t * @param op - The map key message\n\t * @param localOpMetadata - Metadata from the previous submit\n\t */\n\tprivate resubmitMapKeyMessage(\n\t\top: IMapKeyOperation,\n\t\tlocalOpMetadata: MapLocalOpMetadata,\n\t): void {\n\t\tassert(\n\t\t\tisMapKeyLocalOpMetadata(localOpMetadata),\n\t\t\t0x2fe /* Invalid localOpMetadata in submit */,\n\t\t);\n\n\t\t// no need to submit messages for op's that have been aborted\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingMessageIds === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst index = pendingMessageIds.indexOf(localOpMetadata.pendingMessageId);\n\t\tif (index === -1) {\n\t\t\treturn;\n\t\t}\n\n\t\tpendingMessageIds.splice(index, 1);\n\t\tif (pendingMessageIds.length === 0) {\n\t\t\tthis.pendingKeys.delete(op.key);\n\t\t}\n\n\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\tconst pendingMessageId = this.getMapKeyMessageId(op);\n\t\tconst localMetadata: MapKeyLocalOpMetadata =\n\t\t\tlocalOpMetadata.type === \"edit\"\n\t\t\t\t? { type: \"edit\", pendingMessageId, previousValue: localOpMetadata.previousValue }\n\t\t\t\t: { type: \"add\", pendingMessageId };\n\t\tconst listNode = this.pendingMapLocalOpMetadata.push(localMetadata).first;\n\t\tthis.submitMessage(op, listNode);\n\t}\n}\n"]}
1
+ {"version":3,"file":"mapKernel.js","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAWxE,OAAO,EAEN,cAAc,EACd,2BAA2B,GAC3B,MAAM,kBAAkB,CAAC;AAoF1B;;GAEG;AACH,MAAM,aAAa,GAAG,CAAI,KAAU,EAAE,UAAiC,EAAU,EAAE;IAClF,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5C,oEAAoE;QACpE,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,CAAC;QACV,CA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E,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;YACzC,CAAC;SACD,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IACxB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport { ValueType } from \"@fluidframework/shared-object-base/internal\";\n\nimport type { ISharedMapEvents } from \"./interfaces.js\";\nimport type {\n\tIMapClearOperation,\n\tIMapDeleteOperation,\n\tIMapSetOperation,\n\t// eslint-disable-next-line import/no-deprecated\n\tISerializableValue,\n\tISerializedValue,\n} from \"./internalInterfaces.js\";\nimport {\n\ttype ILocalValue,\n\tserializeValue,\n\tmigrateIfSharedSerializable,\n} from \"./localValues.js\";\n\n/**\n * Defines the means to process and resubmit a given op on a map.\n */\ninterface IMapMessageHandler {\n\t/**\n\t * Apply the given operation.\n\t * @param op - The map operation to apply\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess(\n\t\top: IMapOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: PendingLocalOpMetadata | undefined,\n\t): void;\n\n\t/**\n\t * Resubmit a previously submitted operation that was not delivered.\n\t * @param op - The map operation to resubmit\n\t * @param localOpMetadata - The metadata that was originally submitted with the message.\n\t */\n\tresubmit(op: IMapOperation, localOpMetadata: PendingLocalOpMetadata): void;\n}\n\n/**\n * Union of all possible map operations.\n */\nexport type IMapOperation = IMapSetOperation | IMapDeleteOperation | IMapClearOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n *\n * @remarks Directly used in\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify\n * | JSON.stringify}, direct result from\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.\n */\n// eslint-disable-next-line import/no-deprecated\nexport type IMapDataObjectSerializable = Record<string, ISerializableValue>;\n\n/**\n * Serialized key/value data.\n */\nexport type IMapDataObjectSerialized = Record<string, ISerializedValue>;\n\ninterface PendingKeySet {\n\ttype: \"set\";\n\tvalue: ILocalValue;\n}\n\ninterface PendingKeyDelete {\n\ttype: \"delete\";\n\tkey: string;\n}\n\ninterface PendingClear {\n\ttype: \"clear\";\n}\n\ninterface PendingKeyLifetime {\n\ttype: \"lifetime\";\n\tkey: string;\n\t/**\n\t * A non-empty array of pending key sets that occurred during this lifetime. If the list\n\t * becomes empty (e.g. during processing or rollback), the lifetime no longer exists and\n\t * must be removed from the pending data.\n\t */\n\tkeySets: PendingKeySet[];\n}\n\n/**\n * A member of the pendingData array, which tracks outstanding changes and can be used to\n * compute optimistic values. Local sets are aggregated into lifetimes.\n */\ntype PendingDataEntry = PendingKeyLifetime | PendingKeyDelete | PendingClear;\n/**\n * An individual outstanding change, which will also be found in the pendingData array\n * (though the PendingKeySets will be contained within a PendingKeyLifetime there).\n */\ntype PendingLocalOpMetadata = PendingKeySet | PendingKeyDelete | PendingClear;\n\n/**\n * Rough polyfill for Array.findLastIndex until we target ES2023 or greater.\n */\nconst findLastIndex = <T>(array: T[], callbackFn: (value: T) => boolean): number => {\n\tfor (let i = array.length - 1; i >= 0; i--) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tif (callbackFn(array[i]!)) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\n\n/**\n * Rough polyfill for Array.findLast until we target ES2023 or greater.\n */\nconst findLast = <T>(array: T[], callbackFn: (value: T) => boolean): T | undefined =>\n\tarray[findLastIndex(array, callbackFn)];\n\n/**\n * A SharedMap is a map-like distributed data structure.\n */\nexport class MapKernel {\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\tconst iterableItems = [...this.internalIterator()];\n\t\treturn iterableItems.length;\n\t}\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n\t/**\n\t * The data the map is storing, but only including sequenced values (no local pending\n\t * modifications are included).\n\t */\n\tprivate readonly sequencedData = new Map<string, ILocalValue>();\n\t/**\n\t * A data structure containing all local pending modifications, which is used in combination\n\t * with the sequencedData to compute optimistic values.\n\t *\n\t * Pending sets are aggregated into \"lifetimes\", which permit correct relative iteration order\n\t * even across remote operations and rollbacks.\n\t */\n\tprivate readonly pendingData: PendingDataEntry[] = [];\n\n\t/**\n\t * Create a new shared map kernel.\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param handle - The handle of the shared object using the kernel\n\t * @param submitMessage - A callback to submit a message through the shared object\n\t * @param isAttached - To query whether the shared object should generate ops\n\t * @param valueTypes - The value types to register\n\t * @param eventEmitter - The object that will emit map events\n\t */\n\tpublic constructor(\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tprivate readonly handle: IFluidHandle,\n\t\tprivate readonly submitMessage: (op: unknown, localOpMetadata: unknown) => void,\n\t\tprivate readonly isAttached: () => boolean,\n\t\tprivate readonly eventEmitter: TypedEventEmitter<ISharedMapEvents>,\n\t) {\n\t\tthis.messageHandlers = this.getMessageHandlers();\n\t}\n\n\t/**\n\t * Get an iterator over the optimistically observable ILocalValue entries in the map. For example, excluding\n\t * sequenced entries that have pending deletes/clears.\n\t *\n\t * @remarks\n\t * There is no perfect solution here, particularly when the iterator is retained over time and the map is\n\t * modified or new ack's are received. The pendingData portion of the iteration is the most susceptible to\n\t * this problem. The implementation prioritizes (in roughly this order):\n\t * 1. Correct immediate iteration (i.e. when the map is not modified before iteration completes)\n\t * 2. Consistent iteration order before/after sequencing of pending ops; acks don't change order\n\t * 3. Consistent iteration order between synchronized clients, even if they each modified the map concurrently\n\t * 4. Remaining as close as possible to the native Map iterator behavior, e.g. live-ish view rather than snapshot\n\t *\n\t * For this reason, it's important not to internally snapshot the output of the iterator for any purpose that\n\t * does not immediately (synchronously) consume that output and dispose of it.\n\t */\n\tprivate readonly internalIterator = (): IterableIterator<[string, ILocalValue]> => {\n\t\t// We perform iteration in two steps - first by iterating over members of the sequenced data that are not\n\t\t// optimistically deleted or cleared, and then over the pending data lifetimes that have not subsequently\n\t\t// been deleted or cleared. In total, this give an ordering of members based on when they were initially\n\t\t// added to the map (even if they were later modified), similar to the native Map.\n\t\tconst sequencedDataIterator = this.sequencedData.keys();\n\t\tconst pendingDataIterator = this.pendingData.values();\n\t\tconst next = (): IteratorResult<[string, ILocalValue]> => {\n\t\t\tlet nextSequencedKey = sequencedDataIterator.next();\n\t\t\twhile (!nextSequencedKey.done) {\n\t\t\t\tconst key = nextSequencedKey.value;\n\t\t\t\t// If we have any pending deletes or clears, then we won't iterate to this key yet (if at all).\n\t\t\t\t// Either it is optimistically deleted and will not be part of the iteration, or it was\n\t\t\t\t// re-added later and we'll iterate to it when we get to the pending data.\n\t\t\t\tif (\n\t\t\t\t\t!this.pendingData.some(\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.type === \"clear\" || (entry.type === \"delete\" && entry.key === key),\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst optimisticValue = this.getOptimisticLocalValue(key);\n\t\t\t\t\tassert(\n\t\t\t\t\t\toptimisticValue !== undefined,\n\t\t\t\t\t\t0xbf1 /* Should never iterate to a key with undefined optimisticValue */,\n\t\t\t\t\t);\n\t\t\t\t\treturn { value: [key, optimisticValue], done: false };\n\t\t\t\t}\n\t\t\t\tnextSequencedKey = sequencedDataIterator.next();\n\t\t\t}\n\n\t\t\tlet nextPending = pendingDataIterator.next();\n\t\t\twhile (!nextPending.done) {\n\t\t\t\tconst nextPendingEntry = nextPending.value;\n\t\t\t\t// A lifetime entry may need to be iterated.\n\t\t\t\tif (nextPendingEntry.type === \"lifetime\") {\n\t\t\t\t\tconst nextPendingEntryIndex = this.pendingData.indexOf(nextPendingEntry);\n\t\t\t\t\tconst mostRecentDeleteOrClearIndex = findLastIndex(\n\t\t\t\t\t\tthis.pendingData,\n\t\t\t\t\t\t(entry) =>\n\t\t\t\t\t\t\tentry.type === \"clear\" ||\n\t\t\t\t\t\t\t(entry.type === \"delete\" && entry.key === nextPendingEntry.key),\n\t\t\t\t\t);\n\t\t\t\t\t// Only iterate the pending entry now if it hasn't been deleted or cleared.\n\t\t\t\t\tif (nextPendingEntryIndex > mostRecentDeleteOrClearIndex) {\n\t\t\t\t\t\tconst latestPendingValue =\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\t\tnextPendingEntry.keySets[nextPendingEntry.keySets.length - 1]!;\n\t\t\t\t\t\t// Skip iterating if we would have would have already iterated it as part of the sequenced data.\n\t\t\t\t\t\t// This is not a perfect check in the case the map has changed since the iterator was created\n\t\t\t\t\t\t// (e.g. if a remote client added the same key in the meantime).\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!this.sequencedData.has(nextPendingEntry.key) ||\n\t\t\t\t\t\t\tmostRecentDeleteOrClearIndex !== -1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn { value: [nextPendingEntry.key, latestPendingValue.value], done: false };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnextPending = pendingDataIterator.next();\n\t\t\t}\n\n\t\t\treturn { value: undefined, done: true };\n\t\t};\n\n\t\tconst iterator = {\n\t\t\tnext,\n\t\t\t[Symbol.iterator](): IterableIterator<[string, ILocalValue]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t};\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\tpublic entries(): IterableIterator<[string, unknown]> {\n\t\tconst internalIterator = this.internalIterator();\n\t\tconst next = (): IteratorResult<[string, unknown]> => {\n\t\t\tconst nextResult = internalIterator.next();\n\t\t\tif (nextResult.done) {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t\t// Unpack the stored value\n\t\t\tconst [key, localValue] = nextResult.value;\n\t\t\treturn { value: [key, localValue.value], done: false };\n\t\t};\n\n\t\tconst iterator = {\n\t\t\tnext,\n\t\t\t[Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\tconst internalIterator = this.internalIterator();\n\t\tconst next = (): IteratorResult<string> => {\n\t\t\tconst nextResult = internalIterator.next();\n\t\t\tif (nextResult.done) {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t\tconst [key] = nextResult.value;\n\t\t\treturn { value: key, done: false };\n\t\t};\n\t\tconst iterator = {\n\t\t\tnext,\n\t\t\t[Symbol.iterator](): IterableIterator<string> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<unknown> {\n\t\tconst internalIterator = this.internalIterator();\n\t\tconst next = (): IteratorResult<unknown> => {\n\t\t\tconst nextResult = internalIterator.next();\n\t\t\tif (nextResult.done) {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t\tconst [, localValue] = nextResult.value;\n\t\t\treturn { value: localValue.value, done: false };\n\t\t};\n\t\tconst iterator = {\n\t\t\tnext,\n\t\t\t[Symbol.iterator](): IterableIterator<unknown> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Executes the given callback on each entry in the map.\n\t * @param callbackFn - Callback function\n\t */\n\tpublic forEach(\n\t\tcallbackFn: (value: unknown, key: string, map: Map<string, unknown>) => void,\n\t): void {\n\t\t// It would be better to iterate over the data without a temp map. However, we don't have a valid\n\t\t// map to pass for the third argument here (really, it should probably should be a reference to the\n\t\t// SharedMap and not the MapKernel).\n\t\tconst tempMap = new Map(this.internalIterator());\n\t\t// eslint-disable-next-line unicorn/no-array-for-each\n\t\ttempMap.forEach((localValue, key, m) => {\n\t\t\tcallbackFn(localValue.value, key, m);\n\t\t});\n\t}\n\n\t/**\n\t * Compute the optimistic local value for a given key. This combines the sequenced data with\n\t * any pending changes that have not yet been sequenced.\n\t */\n\tprivate readonly getOptimisticLocalValue = (key: string): ILocalValue | undefined => {\n\t\tconst latestPendingEntry = findLast(\n\t\t\tthis.pendingData,\n\t\t\t(entry) => entry.type === \"clear\" || entry.key === key,\n\t\t);\n\n\t\tif (latestPendingEntry === undefined) {\n\t\t\treturn this.sequencedData.get(key);\n\t\t} else if (latestPendingEntry.type === \"lifetime\") {\n\t\t\tconst latestPendingSet =\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tlatestPendingEntry.keySets[latestPendingEntry.keySets.length - 1]!;\n\t\t\treturn latestPendingSet.value;\n\t\t} else {\n\t\t\t// Delete or clear\n\t\t\treturn undefined;\n\t\t}\n\t};\n\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\tpublic get<T = unknown>(key: string): T | undefined {\n\t\tconst localValue = this.getOptimisticLocalValue(key);\n\t\treturn localValue === undefined ? undefined : (localValue.value as T);\n\t}\n\n\t/**\n\t * Check if a key exists in the map.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.getOptimisticLocalValue(key) !== undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.set}\n\t */\n\tpublic set(key: string, value: unknown): void {\n\t\t// Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (key === undefined || key === null) {\n\t\t\tthrow new Error(\"Undefined and null keys are not supported\");\n\t\t}\n\n\t\tconst localValue: ILocalValue = { value };\n\t\tconst previousOptimisticLocalValue = this.getOptimisticLocalValue(key);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\tthis.sequencedData.set(key, localValue);\n\t\t\tthis.eventEmitter.emit(\n\t\t\t\t\"valueChanged\",\n\t\t\t\t{ key, previousValue: previousOptimisticLocalValue?.value },\n\t\t\t\ttrue,\n\t\t\t\tthis.eventEmitter,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// A new pending key lifetime is created if:\n\t\t// 1. There isn't any pending entry for the key yet\n\t\t// 2. The most recent pending entry for the key was a deletion (as this terminates the prior lifetime)\n\t\t// 3. A clear was sent after the last pending entry for the key (which also terminates the prior lifetime)\n\t\tlet latestPendingEntry = findLast(\n\t\t\tthis.pendingData,\n\t\t\t(entry) => entry.type === \"clear\" || entry.key === key,\n\t\t);\n\t\tif (\n\t\t\tlatestPendingEntry === undefined ||\n\t\t\tlatestPendingEntry.type === \"delete\" ||\n\t\t\tlatestPendingEntry.type === \"clear\"\n\t\t) {\n\t\t\tlatestPendingEntry = { type: \"lifetime\", key, keySets: [] };\n\t\t\tthis.pendingData.push(latestPendingEntry);\n\t\t}\n\t\tconst pendingKeySet: PendingKeySet = {\n\t\t\ttype: \"set\",\n\t\t\tvalue: localValue,\n\t\t};\n\t\tlatestPendingEntry.keySets.push(pendingKeySet);\n\n\t\tconst op: IMapSetOperation = {\n\t\t\tkey,\n\t\t\ttype: \"set\",\n\t\t\tvalue: { type: ValueType[ValueType.Plain], value: localValue.value },\n\t\t};\n\t\tthis.submitMessage(op, pendingKeySet);\n\t\tthis.eventEmitter.emit(\n\t\t\t\"valueChanged\",\n\t\t\t{ key, previousValue: previousOptimisticLocalValue?.value },\n\t\t\ttrue,\n\t\t\tthis.eventEmitter,\n\t\t);\n\t}\n\n\t/**\n\t * Delete a key from the map.\n\t * @param key - Key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\tconst previousOptimisticLocalValue = this.getOptimisticLocalValue(key);\n\n\t\tif (!this.isAttached()) {\n\t\t\tconst successfullyRemoved = this.sequencedData.delete(key);\n\t\t\t// Only emit if we actually deleted something.\n\t\t\tif (previousOptimisticLocalValue !== undefined) {\n\t\t\t\tthis.eventEmitter.emit(\n\t\t\t\t\t\"valueChanged\",\n\t\t\t\t\t{ key, previousValue: previousOptimisticLocalValue.value },\n\t\t\t\t\ttrue,\n\t\t\t\t\tthis.eventEmitter,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn successfullyRemoved;\n\t\t}\n\n\t\tconst pendingKeyDelete: PendingKeyDelete = {\n\t\t\ttype: \"delete\",\n\t\t\tkey,\n\t\t};\n\t\tthis.pendingData.push(pendingKeyDelete);\n\n\t\tconst op: IMapDeleteOperation = {\n\t\t\tkey,\n\t\t\ttype: \"delete\",\n\t\t};\n\t\tthis.submitMessage(op, pendingKeyDelete);\n\t\t// Only emit if we locally believe we deleted something. Otherwise we still send the op\n\t\t// (permitting speculative deletion even if we don't see anything locally) but don't emit\n\t\t// a valueChanged since we in fact did not locally observe a value change.\n\t\tif (previousOptimisticLocalValue !== undefined) {\n\t\t\tthis.eventEmitter.emit(\n\t\t\t\t\"valueChanged\",\n\t\t\t\t{ key, previousValue: previousOptimisticLocalValue.value },\n\t\t\t\ttrue,\n\t\t\t\tthis.eventEmitter,\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Clear all data from the map.\n\t */\n\tpublic clear(): void {\n\t\tif (!this.isAttached()) {\n\t\t\tthis.sequencedData.clear();\n\t\t\tthis.eventEmitter.emit(\"clear\", true, this.eventEmitter);\n\t\t\treturn;\n\t\t}\n\n\t\tconst pendingClear: PendingClear = {\n\t\t\ttype: \"clear\",\n\t\t};\n\t\tthis.pendingData.push(pendingClear);\n\n\t\tconst op: IMapClearOperation = {\n\t\t\ttype: \"clear\",\n\t\t};\n\t\tthis.submitMessage(op, pendingClear);\n\t\tthis.eventEmitter.emit(\"clear\", true, this.eventEmitter);\n\t}\n\n\t/**\n\t * Serializes the data stored in the shared map to a JSON string\n\t * @param serializer - The serializer to use to serialize handles in its values.\n\t * @returns A JSON string containing serialized map data\n\t */\n\tpublic getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n\t\tconst serializedMapData: IMapDataObjectSerialized = {};\n\t\tfor (const [key, localValue] of this.sequencedData.entries()) {\n\t\t\tserializedMapData[key] = serializeValue(localValue.value, serializer, this.handle);\n\t\t}\n\t\treturn serializedMapData;\n\t}\n\n\t/**\n\t * Populate the kernel with the given map data.\n\t * @param data - A JSON string containing serialized map data\n\t */\n\tpublic populateFromSerializable(json: IMapDataObjectSerializable): void {\n\t\tfor (const [key, serializable] of Object.entries(\n\t\t\tthis.serializer.decode(json) as IMapDataObjectSerializable,\n\t\t)) {\n\t\t\tmigrateIfSharedSerializable(serializable, this.serializer, this.handle);\n\t\t\tthis.sequencedData.set(key, { value: serializable.value });\n\t\t}\n\t}\n\n\t/**\n\t * Resubmit the given op if a handler is registered.\n\t * @param op - The operation to attempt to submit\n\t * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t * @returns True if the operation was submitted, false otherwise.\n\t */\n\tpublic tryResubmitMessage(op: IMapOperation, localOpMetadata: unknown): boolean {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\thandler.resubmit(op, localOpMetadata as PendingLocalOpMetadata);\n\t\treturn true;\n\t}\n\n\tpublic tryApplyStashedOp(op: IMapOperation): void {\n\t\tswitch (op.type) {\n\t\t\tcase \"clear\": {\n\t\t\t\tthis.clear();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"delete\": {\n\t\t\t\tthis.delete(op.key);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"set\": {\n\t\t\t\tmigrateIfSharedSerializable(op.value, this.serializer, this.handle);\n\t\t\t\tthis.set(op.key, op.value.value);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(op);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param message - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation was recognized and thus processed, false otherwise.\n\t *\n\t * @remarks\n\t * When this returns false and the caller doesn't handle the op itself, then the op could be from a different version of this code.\n\t * In such a case, not applying the op would result in this client becoming out of sync with clients that do handle the op\n\t * and could result in data corruption or data loss as well.\n\t * Therefore, in such cases the caller should typically throw an error, ensuring that this client treats the situation as data corruption\n\t * (since its data no longer matches what other clients think the data should be) and will avoid overriding document content or misleading the users into thinking their current state is accurate.\n\t */\n\tpublic tryProcessMessage(\n\t\top: IMapOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\thandler.process(op, local, localOpMetadata as PendingLocalOpMetadata | undefined);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Rollback a local op\n\t * @param op - The operation to rollback\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\tpublic rollback(op: unknown, localOpMetadata: unknown): void {\n\t\tconst mapOp: IMapOperation = op as IMapOperation;\n\t\tconst typedLocalOpMetadata = localOpMetadata as PendingLocalOpMetadata;\n\t\tif (mapOp.type === \"clear\") {\n\t\t\t// A pending clear will be last in the list, since it terminates all prior lifetimes.\n\t\t\tconst pendingClear = this.pendingData.pop();\n\t\t\tassert(\n\t\t\t\tpendingClear !== undefined &&\n\t\t\t\t\tpendingClear.type === \"clear\" &&\n\t\t\t\t\tpendingClear === typedLocalOpMetadata,\n\t\t\t\t0xbf2 /* Unexpected clear rollback */,\n\t\t\t);\n\t\t\tfor (const [key] of this.internalIterator()) {\n\t\t\t\tthis.eventEmitter.emit(\n\t\t\t\t\t\"valueChanged\",\n\t\t\t\t\t{ key, previousValue: undefined },\n\t\t\t\t\ttrue,\n\t\t\t\t\tthis.eventEmitter,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\t// A pending set/delete may not be last in the list, as the lifetimes' order is based on when\n\t\t\t// they were created, not when they were last modified.\n\t\t\tconst pendingEntryIndex = findLastIndex(\n\t\t\t\tthis.pendingData,\n\t\t\t\t(entry) => entry.type !== \"clear\" && entry.key === mapOp.key,\n\t\t\t);\n\t\t\tconst pendingEntry = this.pendingData[pendingEntryIndex];\n\t\t\tassert(\n\t\t\t\tpendingEntry !== undefined &&\n\t\t\t\t\t(pendingEntry.type === \"delete\" || pendingEntry.type === \"lifetime\"),\n\t\t\t\t0xbf3 /* Unexpected pending data for set/delete op */,\n\t\t\t);\n\t\t\tif (pendingEntry.type === \"delete\") {\n\t\t\t\tassert(pendingEntry === typedLocalOpMetadata, 0xbf4 /* Unexpected delete rollback */);\n\t\t\t\tthis.pendingData.splice(pendingEntryIndex, 1);\n\t\t\t\t// Only emit if rolling back the delete actually results in a value becoming visible.\n\t\t\t\tif (this.getOptimisticLocalValue(mapOp.key) !== undefined) {\n\t\t\t\t\tthis.eventEmitter.emit(\n\t\t\t\t\t\t\"valueChanged\",\n\t\t\t\t\t\t{ key: mapOp.key, previousValue: undefined },\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tthis.eventEmitter,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else if (pendingEntry.type === \"lifetime\") {\n\t\t\t\tconst pendingKeySet = pendingEntry.keySets.pop();\n\t\t\t\tassert(\n\t\t\t\t\tpendingKeySet !== undefined && pendingKeySet === typedLocalOpMetadata,\n\t\t\t\t\t0xbf5 /* Unexpected set rollback */,\n\t\t\t\t);\n\t\t\t\tif (pendingEntry.keySets.length === 0) {\n\t\t\t\t\tthis.pendingData.splice(pendingEntryIndex, 1);\n\t\t\t\t}\n\t\t\t\tthis.eventEmitter.emit(\n\t\t\t\t\t\"valueChanged\",\n\t\t\t\t\t{ key: mapOp.key, previousValue: pendingKeySet.value.value },\n\t\t\t\t\ttrue,\n\t\t\t\t\tthis.eventEmitter,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Get the message handlers for the map.\n\t * @returns A map of string op names to IMapMessageHandlers for those ops\n\t */\n\tprivate getMessageHandlers(): Map<string, IMapMessageHandler> {\n\t\tconst messageHandlers = new Map<string, IMapMessageHandler>();\n\t\tmessageHandlers.set(\"clear\", {\n\t\t\tprocess: (\n\t\t\t\top: IMapClearOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: PendingLocalOpMetadata | undefined,\n\t\t\t) => {\n\t\t\t\tthis.sequencedData.clear();\n\t\t\t\tif (local) {\n\t\t\t\t\tconst pendingClear = this.pendingData.shift();\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingClear !== undefined &&\n\t\t\t\t\t\t\tpendingClear.type === \"clear\" &&\n\t\t\t\t\t\t\tpendingClear === localOpMetadata,\n\t\t\t\t\t\t0xbf6 /* Got a local clear message we weren't expecting */,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t// Only emit for remote ops, we would have already emitted for local ops. Only emit if there\n\t\t\t\t\t// is no optimistically-applied local pending clear that would supersede this remote clear.\n\t\t\t\t\tif (!this.pendingData.some((entry) => entry.type === \"clear\")) {\n\t\t\t\t\t\tthis.eventEmitter.emit(\"clear\", local, this.eventEmitter);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tresubmit: (op: IMapClearOperation, localOpMetadata: PendingLocalOpMetadata) => {\n\t\t\t\tthis.submitMessage(op, localOpMetadata);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"delete\", {\n\t\t\tprocess: (\n\t\t\t\top: IMapDeleteOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: PendingLocalOpMetadata | undefined,\n\t\t\t) => {\n\t\t\t\tconst { key } = op;\n\n\t\t\t\tif (local) {\n\t\t\t\t\tconst pendingEntryIndex = this.pendingData.findIndex(\n\t\t\t\t\t\t(entry) => entry.type !== \"clear\" && entry.key === key,\n\t\t\t\t\t);\n\t\t\t\t\tconst pendingEntry = this.pendingData[pendingEntryIndex];\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingEntry !== undefined &&\n\t\t\t\t\t\t\tpendingEntry.type === \"delete\" &&\n\t\t\t\t\t\t\tpendingEntry === localOpMetadata,\n\t\t\t\t\t\t0xbf7 /* Got a local delete message we weren't expecting */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.pendingData.splice(pendingEntryIndex, 1);\n\n\t\t\t\t\tthis.sequencedData.delete(key);\n\t\t\t\t} else {\n\t\t\t\t\tconst previousValue: unknown = this.sequencedData.get(key)?.value;\n\t\t\t\t\tthis.sequencedData.delete(key);\n\t\t\t\t\t// Suppress the event if local changes would cause the incoming change to be invisible optimistically.\n\t\t\t\t\tif (!this.pendingData.some((entry) => entry.type === \"clear\" || entry.key === key)) {\n\t\t\t\t\t\tthis.eventEmitter.emit(\n\t\t\t\t\t\t\t\"valueChanged\",\n\t\t\t\t\t\t\t{ key, previousValue },\n\t\t\t\t\t\t\tlocal,\n\t\t\t\t\t\t\tthis.eventEmitter,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tresubmit: (op: IMapDeleteOperation, localOpMetadata: PendingLocalOpMetadata) => {\n\t\t\t\tthis.submitMessage(op, localOpMetadata);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"set\", {\n\t\t\tprocess: (\n\t\t\t\top: IMapSetOperation,\n\t\t\t\tlocal: boolean,\n\t\t\t\tlocalOpMetadata: PendingLocalOpMetadata | undefined,\n\t\t\t) => {\n\t\t\t\tconst { key, value } = op;\n\n\t\t\t\tif (local) {\n\t\t\t\t\tconst pendingEntryIndex = this.pendingData.findIndex(\n\t\t\t\t\t\t(entry) => entry.type !== \"clear\" && entry.key === key,\n\t\t\t\t\t);\n\t\t\t\t\tconst pendingEntry = this.pendingData[pendingEntryIndex];\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingEntry !== undefined && pendingEntry.type === \"lifetime\",\n\t\t\t\t\t\t0xbf8 /* Couldn't match local set message to pending lifetime */,\n\t\t\t\t\t);\n\t\t\t\t\tconst pendingKeySet = pendingEntry.keySets.shift();\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingKeySet !== undefined && pendingKeySet === localOpMetadata,\n\t\t\t\t\t\t0xbf9 /* Got a local set message we weren't expecting */,\n\t\t\t\t\t);\n\t\t\t\t\tif (pendingEntry.keySets.length === 0) {\n\t\t\t\t\t\tthis.pendingData.splice(pendingEntryIndex, 1);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.sequencedData.set(key, pendingKeySet.value);\n\t\t\t\t} else {\n\t\t\t\t\tmigrateIfSharedSerializable(value, this.serializer, this.handle);\n\t\t\t\t\tconst localValue: ILocalValue = { value: value.value };\n\t\t\t\t\tconst previousValue: unknown = this.sequencedData.get(key)?.value;\n\t\t\t\t\tthis.sequencedData.set(key, localValue);\n\n\t\t\t\t\t// Suppress the event if local changes would cause the incoming change to be invisible optimistically.\n\t\t\t\t\tif (!this.pendingData.some((entry) => entry.type === \"clear\" || entry.key === key)) {\n\t\t\t\t\t\tthis.eventEmitter.emit(\n\t\t\t\t\t\t\t\"valueChanged\",\n\t\t\t\t\t\t\t{ key, previousValue },\n\t\t\t\t\t\t\tlocal,\n\t\t\t\t\t\t\tthis.eventEmitter,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tresubmit: (op: IMapSetOperation, localOpMetadata: PendingLocalOpMetadata) => {\n\t\t\t\tthis.submitMessage(op, localOpMetadata);\n\t\t\t},\n\t\t});\n\n\t\treturn messageHandlers;\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/map";
8
- export declare const pkgVersion = "2.51.0";
8
+ export declare const pkgVersion = "2.52.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/map";
8
- export const pkgVersion = "2.51.0";
8
+ export const pkgVersion = "2.52.0";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/map\";\nexport const pkgVersion = \"2.51.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qBAAqB,CAAC;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/map\";\nexport const pkgVersion = \"2.52.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/map",
3
- "version": "2.51.0",
3
+ "version": "2.52.0",
4
4
  "description": "Distributed map",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -81,33 +81,33 @@
81
81
  "temp-directory": "nyc/.nyc_output"
82
82
  },
83
83
  "dependencies": {
84
- "@fluid-internal/client-utils": "~2.51.0",
85
- "@fluidframework/core-interfaces": "~2.51.0",
86
- "@fluidframework/core-utils": "~2.51.0",
87
- "@fluidframework/datastore-definitions": "~2.51.0",
88
- "@fluidframework/driver-definitions": "~2.51.0",
89
- "@fluidframework/driver-utils": "~2.51.0",
90
- "@fluidframework/merge-tree": "~2.51.0",
91
- "@fluidframework/runtime-definitions": "~2.51.0",
92
- "@fluidframework/runtime-utils": "~2.51.0",
93
- "@fluidframework/shared-object-base": "~2.51.0",
94
- "@fluidframework/telemetry-utils": "~2.51.0",
84
+ "@fluid-internal/client-utils": "~2.52.0",
85
+ "@fluidframework/core-interfaces": "~2.52.0",
86
+ "@fluidframework/core-utils": "~2.52.0",
87
+ "@fluidframework/datastore-definitions": "~2.52.0",
88
+ "@fluidframework/driver-definitions": "~2.52.0",
89
+ "@fluidframework/driver-utils": "~2.52.0",
90
+ "@fluidframework/merge-tree": "~2.52.0",
91
+ "@fluidframework/runtime-definitions": "~2.52.0",
92
+ "@fluidframework/runtime-utils": "~2.52.0",
93
+ "@fluidframework/shared-object-base": "~2.52.0",
94
+ "@fluidframework/telemetry-utils": "~2.52.0",
95
95
  "path-browserify": "^1.0.1"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@arethetypeswrong/cli": "^0.17.1",
99
99
  "@biomejs/biome": "~1.9.3",
100
- "@fluid-internal/mocha-test-setup": "~2.51.0",
101
- "@fluid-private/stochastic-test-utils": "~2.51.0",
102
- "@fluid-private/test-dds-utils": "~2.51.0",
100
+ "@fluid-internal/mocha-test-setup": "~2.52.0",
101
+ "@fluid-private/stochastic-test-utils": "~2.52.0",
102
+ "@fluid-private/test-dds-utils": "~2.52.0",
103
103
  "@fluid-tools/benchmark": "^0.51.0",
104
- "@fluid-tools/build-cli": "^0.56.0",
104
+ "@fluid-tools/build-cli": "^0.57.0",
105
105
  "@fluidframework/build-common": "^2.0.3",
106
- "@fluidframework/build-tools": "^0.56.0",
107
- "@fluidframework/container-definitions": "~2.51.0",
106
+ "@fluidframework/build-tools": "^0.57.0",
107
+ "@fluidframework/container-definitions": "~2.52.0",
108
108
  "@fluidframework/eslint-config-fluid": "^5.7.4",
109
- "@fluidframework/map-previous": "npm:@fluidframework/map@2.50.0",
110
- "@fluidframework/test-runtime-utils": "~2.51.0",
109
+ "@fluidframework/map-previous": "npm:@fluidframework/map@2.51.0",
110
+ "@fluidframework/test-runtime-utils": "~2.52.0",
111
111
  "@microsoft/api-extractor": "7.52.8",
112
112
  "@types/mocha": "^10.0.10",
113
113
  "@types/node": "^18.19.0",
@@ -3,8 +3,6 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { ILocalValue } from "./localValues.js";
7
-
8
6
  /**
9
7
  * Operation indicating a value should be set for a key.
10
8
  */
@@ -50,71 +48,6 @@ export interface IMapDeleteOperation {
50
48
  key: string;
51
49
  }
52
50
 
53
- /**
54
- * Metadata for an local `edit` operation.
55
- */
56
- export interface IMapKeyEditLocalOpMetadata {
57
- /**
58
- * String identifier of the operation type.
59
- */
60
- type: "edit";
61
-
62
- /**
63
- * Unique identifier for the local operation.
64
- */
65
- pendingMessageId: number;
66
-
67
- /**
68
- * Local value prior to the edit.
69
- */
70
- previousValue: ILocalValue;
71
- }
72
-
73
- /**
74
- * Metadata for an local `add` operation.
75
- */
76
- export interface IMapKeyAddLocalOpMetadata {
77
- /**
78
- * String identifier of the operation type.
79
- */
80
- type: "add";
81
-
82
- /**
83
- * Unique identifier for the local operation.
84
- */
85
- pendingMessageId: number;
86
- }
87
-
88
- /**
89
- * Metadata for an local `clear` operation.
90
- */
91
- export interface IMapClearLocalOpMetadata {
92
- /**
93
- * String identifier of the operation type.
94
- */
95
- type: "clear";
96
-
97
- /**
98
- * Unique identifier for the local operation.
99
- */
100
- pendingMessageId: number;
101
-
102
- /**
103
- * Local map contents prior to clearing it.
104
- */
105
- previousMap?: Map<string, ILocalValue>;
106
- }
107
-
108
- /**
109
- * Metadata for a local operation associated with a specific key entry in the map.
110
- */
111
- export type MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;
112
-
113
- /**
114
- * Metadata for a local operation.
115
- */
116
- export type MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;
117
-
118
51
  /**
119
52
  * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use
120
53
  * {@link ISerializableValue."type"} to understand whether they're storing a Plain JavaScript object,