@fluidframework/map 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.204906
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/CHANGELOG.md +52 -0
- package/api-extractor.json +1 -1
- package/api-report/map.api.md +299 -0
- package/dist/directory.d.ts +32 -8
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +42 -35
- package/dist/directory.js.map +1 -1
- package/dist/interfaces.d.ts +23 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/internalInterfaces.d.ts +2 -2
- package/dist/internalInterfaces.d.ts.map +1 -1
- package/dist/localValues.d.ts +4 -0
- package/dist/localValues.d.ts.map +1 -1
- package/dist/localValues.js +2 -0
- package/dist/localValues.js.map +1 -1
- package/dist/map-alpha.d.ts +950 -0
- package/dist/map-beta.d.ts +950 -0
- package/dist/map-public.d.ts +950 -0
- package/dist/map-untrimmed.d.ts +1035 -0
- package/dist/map.d.ts +3 -0
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +18 -15
- package/dist/map.js.map +1 -1
- package/dist/mapKernel.d.ts +2 -2
- package/dist/mapKernel.d.ts.map +1 -1
- package/dist/mapKernel.js +6 -6
- package/dist/mapKernel.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/tsdoc-metadata.json +1 -1
- package/lib/directory.d.ts +32 -8
- package/lib/directory.d.ts.map +1 -1
- package/lib/directory.js +37 -34
- package/lib/directory.js.map +1 -1
- package/lib/interfaces.d.ts +23 -1
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/internalInterfaces.d.ts +2 -2
- package/lib/internalInterfaces.d.ts.map +1 -1
- package/lib/localValues.d.ts +4 -0
- package/lib/localValues.d.ts.map +1 -1
- package/lib/localValues.js +2 -0
- package/lib/localValues.js.map +1 -1
- package/lib/map.d.ts +3 -0
- package/lib/map.d.ts.map +1 -1
- package/lib/map.js +18 -15
- package/lib/map.js.map +1 -1
- package/lib/mapKernel.d.ts +2 -2
- package/lib/mapKernel.d.ts.map +1 -1
- package/lib/mapKernel.js +6 -6
- package/lib/mapKernel.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/package.json +26 -27
- package/src/directory.ts +41 -16
- package/src/interfaces.ts +23 -1
- package/src/localValues.ts +4 -0
- package/src/map.ts +3 -0
- package/src/packageVersion.ts +1 -1
package/lib/mapKernel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapKernel.js","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAoB,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAYpD,OAAO,EAAe,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA0D/E,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,SAAS,oBAAoB,CAAC,QAAa;IAC1C,OAAO,CACN,QAAQ,KAAK,SAAS;QACtB,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ;QAC7C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,aAAa,EAAE;YAClF,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IACvC,CAAC;CACD","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 { IFluidSerializer, ValueType } from \"@fluidframework/shared-object-base\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\n// eslint-disable-next-line import/no-deprecated\nimport { ISerializableValue, ISerializedValue, ISharedMapEvents } from \"./interfaces\";\nimport {\n\tIMapSetOperation,\n\tIMapDeleteOperation,\n\tIMapClearOperation,\n\tIMapKeyEditLocalOpMetadata,\n\tIMapKeyAddLocalOpMetadata,\n\tIMapClearLocalOpMetadata,\n} from \"./internalInterfaces\";\nimport { ILocalValue, LocalValueMaker, makeSerializable } from \"./localValues\";\n\n/**\n * Defines the means to process and submit 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(op: IMapOperation, local: boolean, localOpMetadata: MapLocalOpMetadata): void;\n\n\t/**\n\t * Communicate the operation to remote clients.\n\t * @param op - The map operation to submit\n\t * @param localOpMetadata - The metadata to be submitted with the message.\n\t */\n\tsubmit(op: IMapOperation, localOpMetadata: MapLocalOpMetadata): void;\n\n\tapplyStashedOp(op: IMapOperation): MapLocalOpMetadata;\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 */\nexport interface IMapDataObjectSerializable {\n\t// eslint-disable-next-line import/no-deprecated\n\t[key: string]: ISerializableValue;\n}\n\n/**\n * Serialized key/value data.\n */\nexport interface IMapDataObjectSerialized {\n\t[key: string]: ISerializedValue;\n}\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\nfunction isMapLocalOpMetadata(metadata: any): metadata is MapLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\t(metadata.type === \"add\" || metadata.type === \"edit\" || metadata.type === \"clear\")\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: Map<string, number[]> = new Map();\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 pendingMessageId: number = -1;\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 * Object to create encapsulations of the values stored in the map.\n\t */\n\tprivate readonly localValueMaker: LocalValueMaker;\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.localValueMaker = new LocalValueMaker(serializer);\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\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic entries(): IterableIterator<[string, any]> {\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 { 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\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic values(): IterableIterator<any> {\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 { value: nextVal.value.value as unknown, 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\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\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\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic get<T = any>(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// Create a local value and serialize it.\n\t\tconst localValue = this.localValueMaker.fromInMemory(value);\n\t\tconst serializableValue = makeSerializable(localValue, this.serializer, this.handle);\n\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(key, localValue, 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: serializableValue,\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 serializableMapData: IMapDataObjectSerialized = {};\n\t\tfor (const [key, localValue] of this.data.entries()) {\n\t\t\tserializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n\t\t}\n\t\treturn serializableMapData;\n\t}\n\n\tpublic getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n\t\tconst serializableMapData: IMapDataObjectSerializable = {};\n\t\tfor (const [key, localValue] of this.data.entries()) {\n\t\t\tserializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n\t\t}\n\t\treturn serializableMapData;\n\t}\n\n\tpublic serialize(serializer: IFluidSerializer): string {\n\t\treturn JSON.stringify(this.getSerializableStorage(serializer));\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(json)) {\n\t\t\tconst localValue = {\n\t\t\t\tkey,\n\t\t\t\tvalue: this.makeLocal(key, serializable),\n\t\t\t};\n\n\t\t\tthis.data.set(localValue.key, localValue.value);\n\t\t}\n\t}\n\n\tpublic populate(json: string): void {\n\t\tthis.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n\t}\n\n\t/**\n\t * Submit 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 trySubmitMessage(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.submit(op, localOpMetadata as MapLocalOpMetadata);\n\t\treturn true;\n\t}\n\n\tpublic tryApplyStashedOp(op: IMapOperation): unknown {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler === undefined) {\n\t\t\tthrow new Error(\"no apply stashed op handler\");\n\t\t}\n\t\treturn handler.applyStashedOp(op);\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param op - 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 processed, false otherwise.\n\t */\n\tpublic tryProcessMessage(op: IMapOperation, local: boolean, 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.process(op, local, localOpMetadata as MapLocalOpMetadata);\n\t\treturn true;\n\t}\n\n\t/* eslint-disable @typescript-eslint/no-unsafe-member-access */\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\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\tpublic rollback(op: any, localOpMetadata: unknown): void {\n\t\tif (!isMapLocalOpMetadata(localOpMetadata)) {\n\t\t\tthrow new Error(\"Invalid localOpMetadata\");\n\t\t}\n\n\t\tif (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n\t\t\tif (localOpMetadata.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 localOpMetadata.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 !== localOpMetadata.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 (op.type === \"delete\" || op.type === \"set\") {\n\t\t\tif (localOpMetadata.type === \"add\") {\n\t\t\t\tthis.deleteCore(op.key as string, true);\n\t\t\t} else if (\n\t\t\t\tlocalOpMetadata.type === \"edit\" &&\n\t\t\t\tlocalOpMetadata.previousValue !== undefined\n\t\t\t) {\n\t\t\t\tthis.setCore(op.key as string, localOpMetadata.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(op.key as string);\n\t\t\tconst lastPendingMessageId = pendingMessageIds?.pop();\n\t\t\tif (!pendingMessageIds || lastPendingMessageId !== localOpMetadata.pendingMessageId) {\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(op.key as string);\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/* eslint-enable @typescript-eslint/no-unsafe-member-access */\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(\n\t\t\t\t\"valueChanged\",\n\t\t\t\t{ key, previousValue },\n\t\t\t\tlocal,\n\t\t\t\tthis.eventEmitter,\n\t\t\t);\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 * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n\t * have the information we need to create a real object, but will not be the real object yet. For example,\n\t * 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\t * job is to convert that information into a real object for local usage.\n\t * @param key - The key that the caller intends to store the local value into (used for ops later). But\n\t * doesn't actually store the local value into that key. So better not lie!\n\t * @param serializable - The remote information that we can convert into a real object\n\t * @returns The local value that was produced\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate makeLocal(key: string, serializable: ISerializableValue): ILocalValue {\n\t\tif (\n\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\tserializable.type === ValueType[ValueType.Shared]\n\t\t) {\n\t\t\treturn this.localValueMaker.fromSerializable(serializable);\n\t\t} else {\n\t\t\tthrow new Error(\"Unknown local value type\");\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,\n\t): boolean {\n\t\tif (this.pendingClearMessageIds.length > 0) {\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 pendingKeyMessageId = this.pendingKeys.get(op.key);\n\t\tif (pendingKeyMessageId !== 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\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\t\t\tassert(\n\t\t\t\t\tpendingMessageIds !== undefined &&\n\t\t\t\t\t\tpendingMessageIds[0] === localOpMetadata.pendingMessageId,\n\t\t\t\t\t0x2fa /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tpendingMessageIds.shift();\n\t\t\t\tif (pendingMessageIds.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: (op: IMapClearOperation, local, localOpMetadata) => {\n\t\t\t\tif (local) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tisClearLocalOpMetadata(localOpMetadata),\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.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\tsubmit: (op: IMapClearOperation, localOpMetadata: IMapClearLocalOpMetadata) => {\n\t\t\t\tassert(\n\t\t\t\t\tisClearLocalOpMetadata(localOpMetadata),\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.pendingMessageId,\n\t\t\t\t\t0x2fd /* pendingMessageId does not match */,\n\t\t\t\t);\n\t\t\t\tthis.submitMapClearMessage(op, localOpMetadata.previousMap);\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IMapClearOperation) => {\n\t\t\t\tconst copy = new Map<string, ILocalValue>(this.data);\n\t\t\t\tthis.clearCore(true);\n\t\t\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\t\t\treturn createClearLocalOpMetadata(op, this.getMapClearMessageId(), copy);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"delete\", {\n\t\t\tprocess: (op: IMapDeleteOperation, local, localOpMetadata) => {\n\t\t\t\tif (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\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\tsubmit: (op: IMapDeleteOperation, localOpMetadata: MapKeyLocalOpMetadata) => {\n\t\t\t\tthis.resubmitMapKeyMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IMapDeleteOperation) => {\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 previousValue = this.deleteCore(op.key, true);\n\t\t\t\treturn createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"set\", {\n\t\t\tprocess: (op: IMapSetOperation, local, localOpMetadata) => {\n\t\t\t\tif (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\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\tconst context = this.makeLocal(op.key, op.value);\n\t\t\t\tthis.setCore(op.key, context, local);\n\t\t\t},\n\t\t\tsubmit: (op: IMapSetOperation, localOpMetadata: MapKeyLocalOpMetadata) => {\n\t\t\t\tthis.resubmitMapKeyMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IMapSetOperation) => {\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 context = this.makeLocal(op.key, op.value);\n\t\t\t\tconst previousValue = this.setCore(op.key, context, true);\n\t\t\t\treturn createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);\n\t\t\t},\n\t\t});\n\n\t\treturn messageHandlers;\n\t}\n\n\tprivate getMapClearMessageId(): number {\n\t\tconst pendingMessageId = ++this.pendingMessageId;\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 metadata = createClearLocalOpMetadata(op, this.getMapClearMessageId(), previousMap);\n\t\tthis.submitMessage(op, metadata);\n\t}\n\n\tprivate getMapKeyMessageId(op: IMapKeyOperation): number {\n\t\tconst pendingMessageId = ++this.pendingMessageId;\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingMessageIds !== undefined) {\n\t\t\tpendingMessageIds.push(pendingMessageId);\n\t\t} else {\n\t\t\tthis.pendingKeys.set(op.key, [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 localMetadata = createKeyLocalOpMetadata(\n\t\t\top,\n\t\t\tthis.getMapKeyMessageId(op),\n\t\t\tpreviousValue,\n\t\t);\n\t\tthis.submitMessage(op, localMetadata);\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(op: IMapKeyOperation, localOpMetadata: MapLocalOpMetadata): 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 (\n\t\t\tpendingMessageIds === undefined ||\n\t\t\tpendingMessageIds[0] !== localOpMetadata.pendingMessageId\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// clear the old pending message id\n\t\tpendingMessageIds.shift();\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 =\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\tthis.submitMessage(op, localMetadata);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mapKernel.js","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAoB,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAYpD,OAAO,EAAe,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AA0D/E,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,SAAS,oBAAoB,CAAC,QAAa;IAC1C,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,IAAI,QAAQ,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CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IACvC,CAAC;CACD","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 { IFluidSerializer, ValueType } from \"@fluidframework/shared-object-base\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\n// eslint-disable-next-line import/no-deprecated\nimport { ISerializableValue, ISerializedValue, ISharedMapEvents } from \"./interfaces\";\nimport {\n\tIMapSetOperation,\n\tIMapDeleteOperation,\n\tIMapClearOperation,\n\tIMapKeyEditLocalOpMetadata,\n\tIMapKeyAddLocalOpMetadata,\n\tIMapClearLocalOpMetadata,\n} from \"./internalInterfaces\";\nimport { ILocalValue, LocalValueMaker, makeSerializable } from \"./localValues\";\n\n/**\n * Defines the means to process and submit 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(op: IMapOperation, local: boolean, localOpMetadata: MapLocalOpMetadata): void;\n\n\t/**\n\t * Communicate the operation to remote clients.\n\t * @param op - The map operation to submit\n\t * @param localOpMetadata - The metadata to be submitted with the message.\n\t */\n\tsubmit(op: IMapOperation, localOpMetadata: MapLocalOpMetadata): void;\n\n\tapplyStashedOp(op: IMapOperation): MapLocalOpMetadata;\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 */\nexport interface IMapDataObjectSerializable {\n\t// eslint-disable-next-line import/no-deprecated\n\t[key: string]: ISerializableValue;\n}\n\n/**\n * Serialized key/value data.\n */\nexport interface IMapDataObjectSerialized {\n\t[key: string]: ISerializedValue;\n}\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\nfunction isMapLocalOpMetadata(metadata: any): metadata is MapLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\t(metadata.type === \"add\" || metadata.type === \"edit\" || metadata.type === \"clear\")\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: Map<string, number[]> = new Map();\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 pendingMessageId: number = -1;\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 * Object to create encapsulations of the values stored in the map.\n\t */\n\tprivate readonly localValueMaker: LocalValueMaker;\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.localValueMaker = new LocalValueMaker(serializer);\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\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic entries(): IterableIterator<[string, any]> {\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 { 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\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic values(): IterableIterator<any> {\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 { value: nextVal.value.value as unknown, 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\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\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\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic get<T = any>(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// Create a local value and serialize it.\n\t\tconst localValue = this.localValueMaker.fromInMemory(value);\n\t\tconst serializableValue = makeSerializable(localValue, this.serializer, this.handle);\n\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(key, localValue, 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: serializableValue,\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 serializableMapData: IMapDataObjectSerialized = {};\n\t\tfor (const [key, localValue] of this.data.entries()) {\n\t\t\tserializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n\t\t}\n\t\treturn serializableMapData;\n\t}\n\n\tpublic getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n\t\tconst serializableMapData: IMapDataObjectSerializable = {};\n\t\tfor (const [key, localValue] of this.data.entries()) {\n\t\t\tserializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n\t\t}\n\t\treturn serializableMapData;\n\t}\n\n\tpublic serialize(serializer: IFluidSerializer): string {\n\t\treturn JSON.stringify(this.getSerializableStorage(serializer));\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(json)) {\n\t\t\tconst localValue = {\n\t\t\t\tkey,\n\t\t\t\tvalue: this.makeLocal(key, serializable),\n\t\t\t};\n\n\t\t\tthis.data.set(localValue.key, localValue.value);\n\t\t}\n\t}\n\n\tpublic populate(json: string): void {\n\t\tthis.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n\t}\n\n\t/**\n\t * Submit 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 trySubmitMessage(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.submit(op, localOpMetadata as MapLocalOpMetadata);\n\t\treturn true;\n\t}\n\n\tpublic tryApplyStashedOp(op: IMapOperation): unknown {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler === undefined) {\n\t\t\tthrow new Error(\"no apply stashed op handler\");\n\t\t}\n\t\treturn handler.applyStashedOp(op);\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param op - 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 processed, false otherwise.\n\t */\n\tpublic tryProcessMessage(op: IMapOperation, local: boolean, 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.process(op, local, localOpMetadata as MapLocalOpMetadata);\n\t\treturn true;\n\t}\n\n\t/* eslint-disable @typescript-eslint/no-unsafe-member-access */\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\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\tpublic rollback(op: any, localOpMetadata: unknown): void {\n\t\tif (!isMapLocalOpMetadata(localOpMetadata)) {\n\t\t\tthrow new Error(\"Invalid localOpMetadata\");\n\t\t}\n\n\t\tif (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n\t\t\tif (localOpMetadata.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 localOpMetadata.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 !== localOpMetadata.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 (op.type === \"delete\" || op.type === \"set\") {\n\t\t\tif (localOpMetadata.type === \"add\") {\n\t\t\t\tthis.deleteCore(op.key as string, true);\n\t\t\t} else if (\n\t\t\t\tlocalOpMetadata.type === \"edit\" &&\n\t\t\t\tlocalOpMetadata.previousValue !== undefined\n\t\t\t) {\n\t\t\t\tthis.setCore(op.key as string, localOpMetadata.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(op.key as string);\n\t\t\tconst lastPendingMessageId = pendingMessageIds?.pop();\n\t\t\tif (!pendingMessageIds || lastPendingMessageId !== localOpMetadata.pendingMessageId) {\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(op.key as string);\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/* eslint-enable @typescript-eslint/no-unsafe-member-access */\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(\n\t\t\t\t\"valueChanged\",\n\t\t\t\t{ key, previousValue },\n\t\t\t\tlocal,\n\t\t\t\tthis.eventEmitter,\n\t\t\t);\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 * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n\t * have the information we need to create a real object, but will not be the real object yet. For example,\n\t * 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\t * job is to convert that information into a real object for local usage.\n\t * @param key - The key that the caller intends to store the local value into (used for ops later). But\n\t * doesn't actually store the local value into that key. So better not lie!\n\t * @param serializable - The remote information that we can convert into a real object\n\t * @returns The local value that was produced\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate makeLocal(key: string, serializable: ISerializableValue): ILocalValue {\n\t\tif (\n\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\tserializable.type === ValueType[ValueType.Shared]\n\t\t) {\n\t\t\treturn this.localValueMaker.fromSerializable(serializable);\n\t\t} else {\n\t\t\tthrow new Error(\"Unknown local value type\");\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,\n\t): boolean {\n\t\tif (this.pendingClearMessageIds.length > 0) {\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 pendingKeyMessageId = this.pendingKeys.get(op.key);\n\t\tif (pendingKeyMessageId !== 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\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\t\t\tassert(\n\t\t\t\t\tpendingMessageIds !== undefined &&\n\t\t\t\t\t\tpendingMessageIds[0] === localOpMetadata.pendingMessageId,\n\t\t\t\t\t0x2fa /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tpendingMessageIds.shift();\n\t\t\t\tif (pendingMessageIds.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: (op: IMapClearOperation, local, localOpMetadata) => {\n\t\t\t\tif (local) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tisClearLocalOpMetadata(localOpMetadata),\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.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\tsubmit: (op: IMapClearOperation, localOpMetadata: IMapClearLocalOpMetadata) => {\n\t\t\t\tassert(\n\t\t\t\t\tisClearLocalOpMetadata(localOpMetadata),\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.pendingMessageId,\n\t\t\t\t\t0x2fd /* pendingMessageId does not match */,\n\t\t\t\t);\n\t\t\t\tthis.submitMapClearMessage(op, localOpMetadata.previousMap);\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IMapClearOperation) => {\n\t\t\t\tconst copy = new Map<string, ILocalValue>(this.data);\n\t\t\t\tthis.clearCore(true);\n\t\t\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\t\t\treturn createClearLocalOpMetadata(op, this.getMapClearMessageId(), copy);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"delete\", {\n\t\t\tprocess: (op: IMapDeleteOperation, local, localOpMetadata) => {\n\t\t\t\tif (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\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\tsubmit: (op: IMapDeleteOperation, localOpMetadata: MapKeyLocalOpMetadata) => {\n\t\t\t\tthis.resubmitMapKeyMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IMapDeleteOperation) => {\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 previousValue = this.deleteCore(op.key, true);\n\t\t\t\treturn createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"set\", {\n\t\t\tprocess: (op: IMapSetOperation, local, localOpMetadata) => {\n\t\t\t\tif (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\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\tconst context = this.makeLocal(op.key, op.value);\n\t\t\t\tthis.setCore(op.key, context, local);\n\t\t\t},\n\t\t\tsubmit: (op: IMapSetOperation, localOpMetadata: MapKeyLocalOpMetadata) => {\n\t\t\t\tthis.resubmitMapKeyMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IMapSetOperation) => {\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 context = this.makeLocal(op.key, op.value);\n\t\t\t\tconst previousValue = this.setCore(op.key, context, true);\n\t\t\t\treturn createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);\n\t\t\t},\n\t\t});\n\n\t\treturn messageHandlers;\n\t}\n\n\tprivate getMapClearMessageId(): number {\n\t\tconst pendingMessageId = ++this.pendingMessageId;\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 metadata = createClearLocalOpMetadata(op, this.getMapClearMessageId(), previousMap);\n\t\tthis.submitMessage(op, metadata);\n\t}\n\n\tprivate getMapKeyMessageId(op: IMapKeyOperation): number {\n\t\tconst pendingMessageId = ++this.pendingMessageId;\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingMessageIds !== undefined) {\n\t\t\tpendingMessageIds.push(pendingMessageId);\n\t\t} else {\n\t\t\tthis.pendingKeys.set(op.key, [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 localMetadata = createKeyLocalOpMetadata(\n\t\t\top,\n\t\t\tthis.getMapKeyMessageId(op),\n\t\t\tpreviousValue,\n\t\t);\n\t\tthis.submitMessage(op, localMetadata);\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(op: IMapKeyOperation, localOpMetadata: MapLocalOpMetadata): 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 (\n\t\t\tpendingMessageIds === undefined ||\n\t\t\tpendingMessageIds[0] !== localOpMetadata.pendingMessageId\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// clear the old pending message id\n\t\tpendingMessageIds.shift();\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 =\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\tthis.submitMessage(op, localMetadata);\n\t}\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -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.0.0-dev.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-dev.7.2.0.204906";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -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,wBAAwB,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.0.0-dev.
|
|
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,wBAAwB,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.0.0-dev.7.2.0.204906\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/map",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.7.2.0.204906",
|
|
4
4
|
"description": "Distributed map",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,44 +35,43 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": "2.0.0-dev.
|
|
39
|
-
"@fluidframework/core-interfaces": "2.0.0-dev.
|
|
40
|
-
"@fluidframework/core-utils": "2.0.0-dev.
|
|
41
|
-
"@fluidframework/datastore-definitions": "2.0.0-dev.
|
|
42
|
-
"@fluidframework/driver-utils": "2.0.0-dev.
|
|
43
|
-
"@fluidframework/protocol-definitions": "^
|
|
44
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev.
|
|
45
|
-
"@fluidframework/runtime-utils": "2.0.0-dev.
|
|
46
|
-
"@fluidframework/shared-object-base": "2.0.0-dev.
|
|
47
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev.
|
|
38
|
+
"@fluid-internal/client-utils": "2.0.0-dev.7.2.0.204906",
|
|
39
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.7.2.0.204906",
|
|
40
|
+
"@fluidframework/core-utils": "2.0.0-dev.7.2.0.204906",
|
|
41
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev.7.2.0.204906",
|
|
42
|
+
"@fluidframework/driver-utils": "2.0.0-dev.7.2.0.204906",
|
|
43
|
+
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
44
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev.7.2.0.204906",
|
|
45
|
+
"@fluidframework/runtime-utils": "2.0.0-dev.7.2.0.204906",
|
|
46
|
+
"@fluidframework/shared-object-base": "2.0.0-dev.7.2.0.204906",
|
|
47
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev.7.2.0.204906",
|
|
48
48
|
"path-browserify": "^1.0.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@fluid-internal/stochastic-test-utils": "2.0.0-dev.
|
|
52
|
-
"@fluid-internal/test-dds-utils": "2.0.0-dev.
|
|
51
|
+
"@fluid-internal/stochastic-test-utils": "2.0.0-dev.7.2.0.204906",
|
|
52
|
+
"@fluid-internal/test-dds-utils": "2.0.0-dev.7.2.0.204906",
|
|
53
53
|
"@fluid-tools/benchmark": "^0.48.0",
|
|
54
|
-
"@fluid-tools/build-cli": "
|
|
55
|
-
"@fluidframework/build-common": "^2.0.
|
|
56
|
-
"@fluidframework/build-tools": "
|
|
57
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
58
|
-
"@fluidframework/map-previous": "npm:@fluidframework/map@2.0.0-internal.
|
|
59
|
-
"@fluidframework/mocha-test-setup": "2.0.0-dev.
|
|
60
|
-
"@fluidframework/test-runtime-utils": "2.0.0-dev.
|
|
61
|
-
"@microsoft/api-extractor": "^7.
|
|
54
|
+
"@fluid-tools/build-cli": "0.26.0-203096",
|
|
55
|
+
"@fluidframework/build-common": "^2.0.2",
|
|
56
|
+
"@fluidframework/build-tools": "0.26.0-203096",
|
|
57
|
+
"@fluidframework/eslint-config-fluid": "^3.0.0",
|
|
58
|
+
"@fluidframework/map-previous": "npm:@fluidframework/map@2.0.0-internal.7.1.0",
|
|
59
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev.7.2.0.204906",
|
|
60
|
+
"@fluidframework/test-runtime-utils": "2.0.0-dev.7.2.0.204906",
|
|
61
|
+
"@microsoft/api-extractor": "^7.37.0",
|
|
62
62
|
"@types/mocha": "^9.1.1",
|
|
63
63
|
"@types/node": "^16.18.38",
|
|
64
64
|
"@types/path-browserify": "^1.0.0",
|
|
65
65
|
"c8": "^7.7.1",
|
|
66
|
-
"copyfiles": "^2.4.1",
|
|
67
66
|
"cross-env": "^7.0.3",
|
|
68
|
-
"eslint": "~8.
|
|
67
|
+
"eslint": "~8.50.0",
|
|
69
68
|
"mocha": "^10.2.0",
|
|
70
69
|
"mocha-json-output-reporter": "^2.0.1",
|
|
71
70
|
"mocha-multi-reporters": "^1.5.1",
|
|
72
71
|
"moment": "^2.21.0",
|
|
73
|
-
"prettier": "~
|
|
72
|
+
"prettier": "~3.0.3",
|
|
74
73
|
"rimraf": "^4.4.0",
|
|
75
|
-
"typescript": "~
|
|
74
|
+
"typescript": "~5.1.6"
|
|
76
75
|
},
|
|
77
76
|
"typeValidation": {
|
|
78
77
|
"broken": {}
|
|
@@ -81,11 +80,11 @@
|
|
|
81
80
|
"build": "fluid-build . --task build",
|
|
82
81
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
83
82
|
"build:compile": "fluid-build . --task compile",
|
|
84
|
-
"build:docs": "api-extractor run --local
|
|
83
|
+
"build:docs": "api-extractor run --local",
|
|
85
84
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
86
85
|
"build:genver": "gen-version",
|
|
87
86
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
88
|
-
"ci:build:docs": "api-extractor run
|
|
87
|
+
"ci:build:docs": "api-extractor run",
|
|
89
88
|
"clean": "rimraf --glob 'dist' 'lib' '*.tsbuildinfo' '*.build.log' '_api-extractor-temp' 'nyc'",
|
|
90
89
|
"eslint": "eslint --format stylish src",
|
|
91
90
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
package/src/directory.ts
CHANGED
|
@@ -70,6 +70,8 @@ interface IDirectoryMessageHandler {
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Operation indicating a value should be set for a key.
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
73
75
|
*/
|
|
74
76
|
export interface IDirectorySetOperation {
|
|
75
77
|
/**
|
|
@@ -96,6 +98,8 @@ export interface IDirectorySetOperation {
|
|
|
96
98
|
|
|
97
99
|
/**
|
|
98
100
|
* Operation indicating a key should be deleted from the directory.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
99
103
|
*/
|
|
100
104
|
export interface IDirectoryDeleteOperation {
|
|
101
105
|
/**
|
|
@@ -115,12 +119,16 @@ export interface IDirectoryDeleteOperation {
|
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
/**
|
|
118
|
-
* An operation on a specific key within a directory
|
|
122
|
+
* An operation on a specific key within a directory.
|
|
123
|
+
*
|
|
124
|
+
* @public
|
|
119
125
|
*/
|
|
120
126
|
export type IDirectoryKeyOperation = IDirectorySetOperation | IDirectoryDeleteOperation;
|
|
121
127
|
|
|
122
128
|
/**
|
|
123
129
|
* Operation indicating the directory should be cleared.
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
124
132
|
*/
|
|
125
133
|
export interface IDirectoryClearOperation {
|
|
126
134
|
/**
|
|
@@ -135,12 +143,16 @@ export interface IDirectoryClearOperation {
|
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
/**
|
|
138
|
-
* An operation on one or more of the keys within a directory
|
|
146
|
+
* An operation on one or more of the keys within a directory.
|
|
147
|
+
*
|
|
148
|
+
* @public
|
|
139
149
|
*/
|
|
140
150
|
export type IDirectoryStorageOperation = IDirectoryKeyOperation | IDirectoryClearOperation;
|
|
141
151
|
|
|
142
152
|
/**
|
|
143
153
|
* Operation indicating a subdirectory should be created.
|
|
154
|
+
*
|
|
155
|
+
* @public
|
|
144
156
|
*/
|
|
145
157
|
export interface IDirectoryCreateSubDirectoryOperation {
|
|
146
158
|
/**
|
|
@@ -161,6 +173,8 @@ export interface IDirectoryCreateSubDirectoryOperation {
|
|
|
161
173
|
|
|
162
174
|
/**
|
|
163
175
|
* Operation indicating a subdirectory should be deleted.
|
|
176
|
+
*
|
|
177
|
+
* @public
|
|
164
178
|
*/
|
|
165
179
|
export interface IDirectoryDeleteSubDirectoryOperation {
|
|
166
180
|
/**
|
|
@@ -180,19 +194,25 @@ export interface IDirectoryDeleteSubDirectoryOperation {
|
|
|
180
194
|
}
|
|
181
195
|
|
|
182
196
|
/**
|
|
183
|
-
* An operation on the subdirectories within a directory
|
|
197
|
+
* An operation on the subdirectories within a directory.
|
|
198
|
+
*
|
|
199
|
+
* @public
|
|
184
200
|
*/
|
|
185
201
|
export type IDirectorySubDirectoryOperation =
|
|
186
202
|
| IDirectoryCreateSubDirectoryOperation
|
|
187
203
|
| IDirectoryDeleteSubDirectoryOperation;
|
|
188
204
|
|
|
189
205
|
/**
|
|
190
|
-
* Any operation on a directory
|
|
206
|
+
* Any operation on a directory.
|
|
207
|
+
*
|
|
208
|
+
* @public
|
|
191
209
|
*/
|
|
192
210
|
export type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDirectoryOperation;
|
|
193
211
|
|
|
194
212
|
/**
|
|
195
213
|
* Create info for the subdirectory.
|
|
214
|
+
*
|
|
215
|
+
* @public
|
|
196
216
|
*/
|
|
197
217
|
export interface ICreateInfo {
|
|
198
218
|
/**
|
|
@@ -213,6 +233,8 @@ export interface ICreateInfo {
|
|
|
213
233
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
|
|
214
234
|
* | JSON.stringify}, direct result from
|
|
215
235
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.
|
|
236
|
+
*
|
|
237
|
+
* @public
|
|
216
238
|
*/
|
|
217
239
|
export interface IDirectoryDataObject {
|
|
218
240
|
/**
|
|
@@ -257,6 +279,7 @@ export interface IDirectoryNewStorageFormat {
|
|
|
257
279
|
* {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedDirectory}.
|
|
258
280
|
*
|
|
259
281
|
* @sealed
|
|
282
|
+
* @public
|
|
260
283
|
*/
|
|
261
284
|
export class DirectoryFactory implements IChannelFactory {
|
|
262
285
|
/**
|
|
@@ -325,6 +348,7 @@ export class DirectoryFactory implements IChannelFactory {
|
|
|
325
348
|
* ```
|
|
326
349
|
*
|
|
327
350
|
* @sealed
|
|
351
|
+
* @public
|
|
328
352
|
*/
|
|
329
353
|
export class SharedDirectory
|
|
330
354
|
extends SharedObject<ISharedDirectoryEvents>
|
|
@@ -1819,11 +1843,14 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
|
|
|
1819
1843
|
const pendingMessageIds = this.pendingKeys.get(op.key);
|
|
1820
1844
|
// Only submit the op, if we have record for it, otherwise it is possible that the older instance
|
|
1821
1845
|
// is already deleted, in which case we don't need to submit the op.
|
|
1822
|
-
if (
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1846
|
+
if (pendingMessageIds !== undefined) {
|
|
1847
|
+
const index = pendingMessageIds.findIndex(
|
|
1848
|
+
(id) => id === localOpMetadata.pendingMessageId,
|
|
1849
|
+
);
|
|
1850
|
+
if (index === -1) {
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
pendingMessageIds.splice(index, 1);
|
|
1827
1854
|
if (pendingMessageIds.length === 0) {
|
|
1828
1855
|
this.pendingKeys.delete(op.key);
|
|
1829
1856
|
}
|
|
@@ -2134,8 +2161,8 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
|
|
|
2134
2161
|
return false;
|
|
2135
2162
|
}
|
|
2136
2163
|
|
|
2137
|
-
const
|
|
2138
|
-
if (
|
|
2164
|
+
const pendingKeyMessageIds = this.pendingKeys.get(op.key);
|
|
2165
|
+
if (pendingKeyMessageIds !== undefined) {
|
|
2139
2166
|
// Found an NACK op, clear it from the directory if the latest sequence number in the directory
|
|
2140
2167
|
// match the message's and don't process the op.
|
|
2141
2168
|
if (local) {
|
|
@@ -2143,14 +2170,12 @@ class SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirec
|
|
|
2143
2170
|
localOpMetadata !== undefined && isKeyEditLocalOpMetadata(localOpMetadata),
|
|
2144
2171
|
0x011 /* pendingMessageId is missing from the local client's operation */,
|
|
2145
2172
|
);
|
|
2146
|
-
const pendingMessageIds = this.pendingKeys.get(op.key);
|
|
2147
2173
|
assert(
|
|
2148
|
-
|
|
2149
|
-
pendingMessageIds[0] === localOpMetadata.pendingMessageId,
|
|
2174
|
+
pendingKeyMessageIds[0] === localOpMetadata.pendingMessageId,
|
|
2150
2175
|
0x331 /* Unexpected pending message received */,
|
|
2151
2176
|
);
|
|
2152
|
-
|
|
2153
|
-
if (
|
|
2177
|
+
pendingKeyMessageIds.shift();
|
|
2178
|
+
if (pendingKeyMessageIds.length === 0) {
|
|
2154
2179
|
this.pendingKeys.delete(op.key);
|
|
2155
2180
|
}
|
|
2156
2181
|
}
|
package/src/interfaces.ts
CHANGED
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Type of "valueChanged" event parameter.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
16
18
|
*/
|
|
17
19
|
export interface IValueChanged {
|
|
18
20
|
/**
|
|
@@ -32,6 +34,8 @@ export interface IValueChanged {
|
|
|
32
34
|
* Interface describing actions on a directory.
|
|
33
35
|
*
|
|
34
36
|
* @remarks When used as a Map, operates on its keys.
|
|
37
|
+
*
|
|
38
|
+
* @public
|
|
35
39
|
*/
|
|
36
40
|
// TODO: Use `unknown` instead (breaking change).
|
|
37
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -112,7 +116,11 @@ export interface IDirectory
|
|
|
112
116
|
|
|
113
117
|
/**
|
|
114
118
|
* Events emitted in response to changes to the directory data.
|
|
119
|
+
*
|
|
120
|
+
* @remarks
|
|
115
121
|
* These events only emit on the {@link ISharedDirectory} itself, and not on subdirectories.
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
116
124
|
*/
|
|
117
125
|
export interface ISharedDirectoryEvents extends ISharedObjectEvents {
|
|
118
126
|
/**
|
|
@@ -185,6 +193,8 @@ export interface ISharedDirectoryEvents extends ISharedObjectEvents {
|
|
|
185
193
|
|
|
186
194
|
/**
|
|
187
195
|
* Events emitted in response to changes to the directory data.
|
|
196
|
+
*
|
|
197
|
+
* @public
|
|
188
198
|
*/
|
|
189
199
|
export interface IDirectoryEvents extends IEvent {
|
|
190
200
|
/**
|
|
@@ -265,6 +275,8 @@ export interface IDirectoryEvents extends IEvent {
|
|
|
265
275
|
* Provides a hierarchical organization of map-like data structures as SubDirectories.
|
|
266
276
|
* The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.
|
|
267
277
|
* SubDirectories can be retrieved for use as working directories.
|
|
278
|
+
*
|
|
279
|
+
* @public
|
|
268
280
|
*/
|
|
269
281
|
export interface ISharedDirectory
|
|
270
282
|
extends ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>,
|
|
@@ -278,7 +290,9 @@ export interface ISharedDirectory
|
|
|
278
290
|
}
|
|
279
291
|
|
|
280
292
|
/**
|
|
281
|
-
* Type of "valueChanged" event parameter for {@link ISharedDirectory}
|
|
293
|
+
* Type of "valueChanged" event parameter for {@link ISharedDirectory}.
|
|
294
|
+
*
|
|
295
|
+
* @public
|
|
282
296
|
*/
|
|
283
297
|
export interface IDirectoryValueChanged extends IValueChanged {
|
|
284
298
|
/**
|
|
@@ -289,6 +303,8 @@ export interface IDirectoryValueChanged extends IValueChanged {
|
|
|
289
303
|
|
|
290
304
|
/**
|
|
291
305
|
* Events emitted in response to changes to the {@link ISharedMap | map} data.
|
|
306
|
+
*
|
|
307
|
+
* @public
|
|
292
308
|
*/
|
|
293
309
|
export interface ISharedMapEvents extends ISharedObjectEvents {
|
|
294
310
|
/**
|
|
@@ -327,6 +343,8 @@ export interface ISharedMapEvents extends ISharedObjectEvents {
|
|
|
327
343
|
* {@link @fluidframework/datastore#FluidObjectHandle}.
|
|
328
344
|
*
|
|
329
345
|
* For more information, including example usages, see {@link https://fluidframework.com/docs/data-structures/map/}.
|
|
346
|
+
*
|
|
347
|
+
* @public
|
|
330
348
|
*/
|
|
331
349
|
// TODO: Use `unknown` instead (breaking change).
|
|
332
350
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -371,6 +389,8 @@ export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string,
|
|
|
371
389
|
* channel ID.
|
|
372
390
|
*
|
|
373
391
|
* @deprecated This type is legacy and deprecated.
|
|
392
|
+
*
|
|
393
|
+
* @public
|
|
374
394
|
*/
|
|
375
395
|
export interface ISerializableValue {
|
|
376
396
|
/**
|
|
@@ -387,6 +407,8 @@ export interface ISerializableValue {
|
|
|
387
407
|
|
|
388
408
|
/**
|
|
389
409
|
* Serialized {@link ISerializableValue} counterpart.
|
|
410
|
+
*
|
|
411
|
+
* @public
|
|
390
412
|
*/
|
|
391
413
|
export interface ISerializedValue {
|
|
392
414
|
/**
|
package/src/localValues.ts
CHANGED
|
@@ -16,6 +16,8 @@ import { ISerializableValue, ISerializedValue } from "./interfaces";
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* A local value to be stored in a container type Distributed Data Store (DDS).
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
19
21
|
*/
|
|
20
22
|
export interface ILocalValue {
|
|
21
23
|
/**
|
|
@@ -97,6 +99,8 @@ export class PlainLocalValue implements ILocalValue {
|
|
|
97
99
|
/**
|
|
98
100
|
* Enables a container type {@link https://fluidframework.com/docs/build/dds/ | DDS} to produce and store local
|
|
99
101
|
* values with minimal awareness of how those objects are stored, serialized, and deserialized.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
100
104
|
*/
|
|
101
105
|
export class LocalValueMaker {
|
|
102
106
|
/**
|
package/src/map.ts
CHANGED
|
@@ -30,6 +30,7 @@ const snapshotFileName = "header";
|
|
|
30
30
|
* {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMap}.
|
|
31
31
|
*
|
|
32
32
|
* @sealed
|
|
33
|
+
* @public
|
|
33
34
|
*/
|
|
34
35
|
export class MapFactory implements IChannelFactory {
|
|
35
36
|
/**
|
|
@@ -88,6 +89,8 @@ export class MapFactory implements IChannelFactory {
|
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* {@inheritDoc ISharedMap}
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
91
94
|
*/
|
|
92
95
|
export class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {
|
|
93
96
|
/**
|
package/src/packageVersion.ts
CHANGED