@fluidframework/map 1.2.2 → 2.0.0-internal.1.0.0.82159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/directory.d.ts +26 -7
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +4 -11
- package/dist/directory.js.map +1 -1
- package/dist/interfaces.d.ts +139 -181
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/localValues.d.ts +3 -3
- package/dist/localValues.js +2 -2
- package/dist/localValues.js.map +1 -1
- package/dist/map.d.ts +3 -5
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +4 -7
- package/dist/map.js.map +1 -1
- package/dist/mapKernel.d.ts +9 -2
- package/dist/mapKernel.d.ts.map +1 -1
- package/dist/mapKernel.js +28 -13
- package/dist/mapKernel.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/directory.d.ts +26 -7
- package/lib/directory.d.ts.map +1 -1
- package/lib/directory.js +4 -11
- package/lib/directory.js.map +1 -1
- package/lib/interfaces.d.ts +139 -181
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/localValues.d.ts +3 -3
- package/lib/localValues.js +2 -2
- package/lib/localValues.js.map +1 -1
- package/lib/map.d.ts +3 -5
- package/lib/map.d.ts.map +1 -1
- package/lib/map.js +4 -7
- package/lib/map.js.map +1 -1
- package/lib/mapKernel.d.ts +9 -2
- package/lib/mapKernel.d.ts.map +1 -1
- package/lib/mapKernel.js +28 -13
- package/lib/mapKernel.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +53 -16
- package/src/directory.ts +30 -15
- package/src/interfaces.ts +146 -181
- package/src/localValues.ts +3 -3
- package/src/map.ts +8 -11
- package/src/mapKernel.ts +42 -16
- package/src/packageVersion.ts +1 -1
package/lib/map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.js","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAA6B,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAS9F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAEH,YAAY,GACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,EAA8B,SAAS,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAO9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAM,OAAO,UAAU;IAenB;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,UAAU,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,UAAU,CAAC,UAAU,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEzB,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACrD,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;QAC9D,GAAG,CAAC,eAAe,EAAE,CAAC;QAEtB,OAAO,GAAG,CAAC;IACf,CAAC;;A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SACP;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAkC,CAAC,CAAC;SAC5E;IACL,CAAC;IAED;;;OAGG;IACO,YAAY,KAAI,CAAC;IAE3B;;;OAGG;IACO,YAAY,CAAC,OAAY,EAAE,eAAwB;QACzD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,OAAY;QACjC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACO,WAAW,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,EAAE;YACxC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;SAC3E;IACL,CAAC;IAED;;;MAGE;IACO,QAAQ,CAAC,OAAY,EAAE,eAAwB;QACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACnD,CAAC;CACH","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport {\n ISharedMap,\n ISharedMapEvents,\n} from \"./interfaces\";\nimport { IMapDataObjectSerializable, MapKernel } from \"./mapKernel\";\nimport { pkgVersion } from \"./packageVersion\";\n\ninterface IMapSerializationFormat {\n blobs?: string[];\n content: IMapDataObjectSerializable;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * The factory that defines the map.\n * @sealed\n */\nexport class MapFactory implements IChannelFactory {\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public static readonly Type = \"https://graph.microsoft.com/types/map\";\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public static readonly Attributes: IChannelAttributes = {\n type: MapFactory.Type,\n snapshotFormatVersion: \"0.2\",\n packageVersion: pkgVersion,\n };\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public get type() {\n return MapFactory.Type;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public get attributes() {\n return MapFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedMap> {\n const map = new SharedMap(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n */\n public create(runtime: IFluidDataStoreRuntime, id: string): ISharedMap {\n const map = new SharedMap(id, runtime, MapFactory.Attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\n/**\n * The SharedMap distributed data structure can be used to store key-value pairs. It provides the same API for setting\n * and retrieving values that JavaScript developers are accustomed to with the\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | Map} built-in object.\n * However, the keys of a SharedMap must be strings.\n */\nexport class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {\n /**\n * Create a new shared map.\n * @param runtime - The data store runtime that the new shared map belongs to.\n * @param id - Optional name of the shared map.\n * @returns Newly created shared map.\n *\n * @example\n * To create a `SharedMap`, call the static create method:\n *\n * ```typescript\n * const myMap = SharedMap.create(this.runtime, id);\n * ```\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap {\n return runtime.createChannel(id, MapFactory.Type) as SharedMap;\n }\n\n /**\n * Get a factory for SharedMap to register with the data store.\n * @returns A factory that creates SharedMaps and loads them from storage.\n */\n public static getFactory(): IChannelFactory {\n return new MapFactory();\n }\n\n /**\n * String representation for the class.\n */\n public readonly [Symbol.toStringTag]: string = \"SharedMap\";\n\n /**\n * MapKernel which manages actual map operations.\n */\n private readonly kernel: MapKernel;\n\n /**\n * Do not call the constructor. Instead, you should use the {@link SharedMap.create | create method}.\n *\n * @param id - String identifier.\n * @param runtime - Data store runtime.\n * @param attributes - The attributes for the map.\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes, \"fluid_map_\");\n this.kernel = new MapKernel(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n () => this.isAttached(),\n this,\n );\n }\n\n /**\n * Get an iterator over the keys in this map.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.kernel.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n return this.kernel.entries();\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n return this.kernel.values();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.kernel.entries();\n }\n\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size() {\n return this.kernel.size;\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n this.kernel.forEach(callbackFn);\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n public get<T = any>(key: string): T | undefined {\n return this.kernel.get<T>(key);\n }\n\n /**\n * Check if a key exists in the map.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.kernel.has(key);\n }\n\n /**\n * {@inheritDoc ISharedMap.set}\n */\n public set(key: string, value: any): this {\n this.kernel.set(key, value);\n return this;\n }\n\n /**\n * Delete a key from the map.\n * @param key - Key to delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n public delete(key: string): boolean {\n return this.kernel.delete(key);\n }\n\n /**\n * Clear all data from the map.\n */\n public clear(): void {\n this.kernel.clear();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n * @internal\n */\n protected summarizeCore(\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n let currentSize = 0;\n let counter = 0;\n let headerBlob: IMapDataObjectSerializable = {};\n const blobs: string[] = [];\n\n const builder = new SummaryTreeBuilder();\n\n const data = this.kernel.getSerializedStorage(serializer);\n\n // If single property exceeds this size, it goes into its own blob\n const MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n // Maximum blob size for multiple map properties\n // Should be bigger than MinValueSizeSeparateSnapshotBlob\n const MaxSnapshotBlobSize = 16 * 1024;\n\n // Partitioning algorithm:\n // 1) Split large (over MinValueSizeSeparateSnapshotBlob = 8K) properties into their own blobs.\n // Naming (across snapshots) of such blob does not have to be stable across snapshots,\n // As de-duping process (in driver) should not care about paths, only content.\n // 2) Split remaining properties into blobs of MaxSnapshotBlobSize (16K) size.\n // This process does not produce stable partitioning. This means\n // modification (including addition / deletion) of property can shift properties across blobs\n // and result in non-incremental snapshot.\n // This can be improved in the future, without being format breaking change, as loading sequence\n // loads all blobs at once and partitioning schema has no impact on that process.\n for (const key of Object.keys(data)) {\n const value = data[key];\n if (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n const blobName = `blob${counter}`;\n counter++;\n blobs.push(blobName);\n const content: IMapDataObjectSerializable = {\n [key]: {\n type: value.type,\n value: JSON.parse(value.value),\n },\n };\n builder.addBlob(blobName, JSON.stringify(content));\n } else {\n currentSize += value.type.length + 21; // Approximation cost of property header\n if (value.value) {\n currentSize += value.value.length;\n }\n\n if (currentSize > MaxSnapshotBlobSize) {\n const blobName = `blob${counter}`;\n counter++;\n blobs.push(blobName);\n builder.addBlob(blobName, JSON.stringify(headerBlob));\n headerBlob = {};\n currentSize = 0;\n }\n headerBlob[key] = {\n type: value.type,\n value: value.value === undefined ? undefined : JSON.parse(value.value),\n };\n }\n }\n\n const header: IMapSerializationFormat = {\n blobs,\n content: headerBlob,\n };\n builder.addBlob(snapshotFileName, JSON.stringify(header));\n\n return builder.getSummaryTree();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n * @internal\n */\n protected async loadCore(storage: IChannelStorageService) {\n const json = await readAndParse<object>(storage, snapshotFileName);\n const newFormat = json as IMapSerializationFormat;\n if (Array.isArray(newFormat.blobs)) {\n this.kernel.populateFromSerializable(newFormat.content);\n await Promise.all(newFormat.blobs.map(async (value) => {\n const content = await readAndParse<IMapDataObjectSerializable>(storage, value);\n this.kernel.populateFromSerializable(content);\n }));\n } else {\n this.kernel.populateFromSerializable(json as IMapDataObjectSerializable);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n * @internal\n */\n protected onDisconnect() {}\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n * @internal\n */\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.kernel.trySubmitMessage(content, localOpMetadata);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n * @internal\n */\n protected applyStashedOp(content: any): unknown {\n this.kernel.tryProcessMessage(content, false, undefined);\n return this.kernel.tryGetStashedOpLocalMetadata(content);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n * @internal\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (message.type === MessageType.Operation) {\n this.kernel.tryProcessMessage(message.contents, local, localOpMetadata);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n * @internal\n */\n protected rollback(content: any, localOpMetadata: unknown) {\n this.kernel.rollback(content, localOpMetadata);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"map.js","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAA6B,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAS9F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAEH,YAAY,GACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,EAA8B,SAAS,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAO9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,MAAM,OAAO,UAAU;IAenB;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,UAAU,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,UAAU,CAAC,UAAU,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,GAAG,CAAC,IAAI,CAAC,Q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ACxD,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;gBAClD,MAAM,OAAO,GAAG,MAAM,YAAY,CAA6B,OAAO,EAAE,KAAK,CAAC,CAAC;gBAC/E,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC,CAAC;SACP;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAkC,CAAC,CAAC;SAC5E;IACL,CAAC;IAED;;;OAGG;IACO,YAAY,KAAK,CAAC;IAE5B;;;OAGG;IACO,YAAY,CAAC,OAAY,EAAE,eAAwB;QACzD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,OAAY;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACO,WAAW,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,EAAE;YACxC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;SAC3E;IACL,CAAC;IAED;;;MAGE;IACQ,QAAQ,CAAC,OAAY,EAAE,eAAwB;QACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACnD,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport {\n ISharedMap,\n ISharedMapEvents,\n} from \"./interfaces\";\nimport { IMapDataObjectSerializable, MapKernel } from \"./mapKernel\";\nimport { pkgVersion } from \"./packageVersion\";\n\ninterface IMapSerializationFormat {\n blobs?: string[];\n content: IMapDataObjectSerializable;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMap}.\n *\n * @sealed\n */\nexport class MapFactory implements IChannelFactory {\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public static readonly Type = \"https://graph.microsoft.com/types/map\";\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public static readonly Attributes: IChannelAttributes = {\n type: MapFactory.Type,\n snapshotFormatVersion: \"0.2\",\n packageVersion: pkgVersion,\n };\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public get type() {\n return MapFactory.Type;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public get attributes() {\n return MapFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedMap> {\n const map = new SharedMap(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n */\n public create(runtime: IFluidDataStoreRuntime, id: string): ISharedMap {\n const map = new SharedMap(id, runtime, MapFactory.Attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\n/**\n * {@inheritDoc ISharedMap}\n */\nexport class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {\n /**\n * Create a new shared map.\n * @param runtime - The data store runtime that the new shared map belongs to.\n * @param id - Optional name of the shared map.\n * @returns Newly created shared map.\n *\n * @example\n * To create a `SharedMap`, call the static create method:\n *\n * ```typescript\n * const myMap = SharedMap.create(this.runtime, id);\n * ```\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap {\n return runtime.createChannel(id, MapFactory.Type) as SharedMap;\n }\n\n /**\n * Get a factory for SharedMap to register with the data store.\n * @returns A factory that creates SharedMaps and loads them from storage.\n */\n public static getFactory(): IChannelFactory {\n return new MapFactory();\n }\n\n /**\n * String representation for the class.\n */\n public readonly [Symbol.toStringTag]: string = \"SharedMap\";\n\n /**\n * MapKernel which manages actual map operations.\n */\n private readonly kernel: MapKernel;\n\n /**\n * Do not call the constructor. Instead, you should use the {@link SharedMap.create | create method}.\n *\n * @param id - String identifier.\n * @param runtime - Data store runtime.\n * @param attributes - The attributes for the map.\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes, \"fluid_map_\");\n this.kernel = new MapKernel(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n () => this.isAttached(),\n this,\n );\n }\n\n /**\n * Get an iterator over the keys in this map.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.kernel.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n return this.kernel.entries();\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n return this.kernel.values();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.kernel.entries();\n }\n\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size() {\n return this.kernel.size;\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n this.kernel.forEach(callbackFn);\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n public get<T = any>(key: string): T | undefined {\n return this.kernel.get<T>(key);\n }\n\n /**\n * Check if a key exists in the map.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.kernel.has(key);\n }\n\n /**\n * {@inheritDoc ISharedMap.set}\n */\n public set(key: string, value: any): this {\n this.kernel.set(key, value);\n return this;\n }\n\n /**\n * Delete a key from the map.\n * @param key - Key to delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n public delete(key: string): boolean {\n return this.kernel.delete(key);\n }\n\n /**\n * Clear all data from the map.\n */\n public clear(): void {\n this.kernel.clear();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n * @internal\n */\n protected summarizeCore(\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n let currentSize = 0;\n let counter = 0;\n let headerBlob: IMapDataObjectSerializable = {};\n const blobs: string[] = [];\n\n const builder = new SummaryTreeBuilder();\n\n const data = this.kernel.getSerializedStorage(serializer);\n\n // If single property exceeds this size, it goes into its own blob\n const MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n // Maximum blob size for multiple map properties\n // Should be bigger than MinValueSizeSeparateSnapshotBlob\n const MaxSnapshotBlobSize = 16 * 1024;\n\n // Partitioning algorithm:\n // 1) Split large (over MinValueSizeSeparateSnapshotBlob = 8K) properties into their own blobs.\n // Naming (across snapshots) of such blob does not have to be stable across snapshots,\n // As de-duping process (in driver) should not care about paths, only content.\n // 2) Split remaining properties into blobs of MaxSnapshotBlobSize (16K) size.\n // This process does not produce stable partitioning. This means\n // modification (including addition / deletion) of property can shift properties across blobs\n // and result in non-incremental snapshot.\n // This can be improved in the future, without being format breaking change, as loading sequence\n // loads all blobs at once and partitioning schema has no impact on that process.\n for (const key of Object.keys(data)) {\n const value = data[key];\n if (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n const blobName = `blob${counter}`;\n counter++;\n blobs.push(blobName);\n const content: IMapDataObjectSerializable = {\n [key]: {\n type: value.type,\n value: JSON.parse(value.value),\n },\n };\n builder.addBlob(blobName, JSON.stringify(content));\n } else {\n currentSize += value.type.length + 21; // Approximation cost of property header\n if (value.value) {\n currentSize += value.value.length;\n }\n\n if (currentSize > MaxSnapshotBlobSize) {\n const blobName = `blob${counter}`;\n counter++;\n blobs.push(blobName);\n builder.addBlob(blobName, JSON.stringify(headerBlob));\n headerBlob = {};\n currentSize = 0;\n }\n headerBlob[key] = {\n type: value.type,\n value: value.value === undefined ? undefined : JSON.parse(value.value),\n };\n }\n }\n\n const header: IMapSerializationFormat = {\n blobs,\n content: headerBlob,\n };\n builder.addBlob(snapshotFileName, JSON.stringify(header));\n\n return builder.getSummaryTree();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n * @internal\n */\n protected async loadCore(storage: IChannelStorageService) {\n const json = await readAndParse<object>(storage, snapshotFileName);\n const newFormat = json as IMapSerializationFormat;\n if (Array.isArray(newFormat.blobs)) {\n this.kernel.populateFromSerializable(newFormat.content);\n await Promise.all(newFormat.blobs.map(async (value) => {\n const content = await readAndParse<IMapDataObjectSerializable>(storage, value);\n this.kernel.populateFromSerializable(content);\n }));\n } else {\n this.kernel.populateFromSerializable(json as IMapDataObjectSerializable);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n * @internal\n */\n protected onDisconnect() { }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n * @internal\n */\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.kernel.trySubmitMessage(content, localOpMetadata);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n * @internal\n */\n protected applyStashedOp(content: any): unknown {\n return this.kernel.tryApplyStashedOp(content);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n * @internal\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (message.type === MessageType.Operation) {\n this.kernel.tryProcessMessage(message.contents, local, localOpMetadata);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n * @internal\n */\n protected rollback(content: any, localOpMetadata: unknown) {\n this.kernel.rollback(content, localOpMetadata);\n }\n}\n"]}
|
package/lib/mapKernel.d.ts
CHANGED
|
@@ -55,11 +55,18 @@ export interface IMapClearOperation {
|
|
|
55
55
|
export declare type IMapOperation = IMapKeyOperation | IMapClearOperation;
|
|
56
56
|
/**
|
|
57
57
|
* Defines the in-memory object structure to be used for the conversion to/from serialized.
|
|
58
|
-
*
|
|
58
|
+
*
|
|
59
|
+
* @remarks Directly used in
|
|
60
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
|
|
61
|
+
* | JSON.stringify}, direct result from
|
|
62
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.
|
|
59
63
|
*/
|
|
60
64
|
export interface IMapDataObjectSerializable {
|
|
61
65
|
[key: string]: ISerializableValue;
|
|
62
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Serialized key/value data.
|
|
69
|
+
*/
|
|
63
70
|
export interface IMapDataObjectSerialized {
|
|
64
71
|
[key: string]: ISerializedValue;
|
|
65
72
|
}
|
|
@@ -182,7 +189,7 @@ export declare class MapKernel {
|
|
|
182
189
|
* @returns True if the operation was submitted, false otherwise.
|
|
183
190
|
*/
|
|
184
191
|
trySubmitMessage(op: any, localOpMetadata: unknown): boolean;
|
|
185
|
-
|
|
192
|
+
tryApplyStashedOp(op: any): unknown;
|
|
186
193
|
/**
|
|
187
194
|
* Process the given op if a handler is registered.
|
|
188
195
|
* @param op - The message to process
|
package/lib/mapKernel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapKernel.d.ts","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAa,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAU,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,cAAc,CAAC;AAkCtB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,kBAAkB,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,oBAAY,gBAAgB,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAEtE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,oBAAY,aAAa,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;AAElE
|
|
1
|
+
{"version":3,"file":"mapKernel.d.ts","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAa,MAAM,oCAAoC,CAAC;AAC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ata(metadata) {
|
|
|
16
16
|
return metadata !== undefined && typeof metadata.pendingMessageId === "number" &&
|
|
17
17
|
(metadata.type === "add" || metadata.type === "edit" || metadata.type === "clear");
|
|
18
18
|
}
|
|
19
|
+
function createClearLocalOpMetadata(op, pendingClearMessageId, previousMap) {
|
|
20
|
+
const localMetadata = {
|
|
21
|
+
type: "clear",
|
|
22
|
+
pendingMessageId: pendingClearMessageId, previousMap,
|
|
23
|
+
};
|
|
24
|
+
return localMetadata;
|
|
25
|
+
}
|
|
26
|
+
function createKeyLocalOpMetadata(op, pendingMessageId, previousValue) {
|
|
27
|
+
const localMetadata = previousValue ?
|
|
28
|
+
{ type: "edit", pendingMessageId, previousValue } :
|
|
29
|
+
{ type: "add", pendingMessageId };
|
|
30
|
+
return localMetadata;
|
|
31
|
+
}
|
|
19
32
|
/**
|
|
20
33
|
* A SharedMap is a map-like distributed data structure.
|
|
21
34
|
*/
|
|
@@ -261,12 +274,12 @@ export class MapKernel {
|
|
|
261
274
|
handler.submit(op, localOpMetadata);
|
|
262
275
|
return true;
|
|
263
276
|
}
|
|
264
|
-
|
|
277
|
+
tryApplyStashedOp(op) {
|
|
265
278
|
const handler = this.messageHandlers.get(op.type);
|
|
266
279
|
if (handler === undefined) {
|
|
267
280
|
throw new Error("no apply stashed op handler");
|
|
268
281
|
}
|
|
269
|
-
return handler.
|
|
282
|
+
return handler.applyStashedOp(op);
|
|
270
283
|
}
|
|
271
284
|
/**
|
|
272
285
|
* Process the given op if a handler is registered.
|
|
@@ -462,9 +475,11 @@ export class MapKernel {
|
|
|
462
475
|
assert(pendingClearMessageId === localOpMetadata.pendingMessageId, 0x2fd /* pendingMessageId does not match */);
|
|
463
476
|
this.submitMapClearMessage(op, localOpMetadata.previousMap);
|
|
464
477
|
},
|
|
465
|
-
|
|
478
|
+
applyStashedOp: (op) => {
|
|
479
|
+
const copy = new Map(this.data);
|
|
480
|
+
this.clearCore(true);
|
|
466
481
|
// We don't reuse the metadata pendingMessageId but send a new one on each submit.
|
|
467
|
-
return
|
|
482
|
+
return createClearLocalOpMetadata(op, this.getMapClearMessageId(), copy);
|
|
468
483
|
},
|
|
469
484
|
});
|
|
470
485
|
messageHandlers.set("delete", {
|
|
@@ -477,9 +492,10 @@ export class MapKernel {
|
|
|
477
492
|
submit: (op, localOpMetadata) => {
|
|
478
493
|
this.resubmitMapKeyMessage(op, localOpMetadata);
|
|
479
494
|
},
|
|
480
|
-
|
|
495
|
+
applyStashedOp: (op) => {
|
|
481
496
|
// We don't reuse the metadata pendingMessageId but send a new one on each submit.
|
|
482
|
-
|
|
497
|
+
const previousValue = this.deleteCore(op.key, true);
|
|
498
|
+
return createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);
|
|
483
499
|
},
|
|
484
500
|
});
|
|
485
501
|
messageHandlers.set("set", {
|
|
@@ -494,9 +510,11 @@ export class MapKernel {
|
|
|
494
510
|
submit: (op, localOpMetadata) => {
|
|
495
511
|
this.resubmitMapKeyMessage(op, localOpMetadata);
|
|
496
512
|
},
|
|
497
|
-
|
|
513
|
+
applyStashedOp: (op) => {
|
|
498
514
|
// We don't reuse the metadata pendingMessageId but send a new one on each submit.
|
|
499
|
-
|
|
515
|
+
const context = this.makeLocal(op.key, op.value);
|
|
516
|
+
const previousValue = this.setCore(op.key, context, true);
|
|
517
|
+
return createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);
|
|
500
518
|
},
|
|
501
519
|
});
|
|
502
520
|
return messageHandlers;
|
|
@@ -511,7 +529,7 @@ export class MapKernel {
|
|
|
511
529
|
* @param op - The clear message
|
|
512
530
|
*/
|
|
513
531
|
submitMapClearMessage(op, previousMap) {
|
|
514
|
-
const metadata =
|
|
532
|
+
const metadata = createClearLocalOpMetadata(op, this.getMapClearMessageId(), previousMap);
|
|
515
533
|
this.submitMessage(op, metadata);
|
|
516
534
|
}
|
|
517
535
|
getMapKeyMessageId(op) {
|
|
@@ -531,10 +549,7 @@ export class MapKernel {
|
|
|
531
549
|
* @param previousValue - The value of the key before this op
|
|
532
550
|
*/
|
|
533
551
|
submitMapKeyMessage(op, previousValue) {
|
|
534
|
-
const
|
|
535
|
-
const localMetadata = previousValue ?
|
|
536
|
-
{ type: "edit", pendingMessageId, previousValue } :
|
|
537
|
-
{ type: "add", pendingMessageId };
|
|
552
|
+
const localMetadata = createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);
|
|
538
553
|
this.submitMessage(op, localMetadata);
|
|
539
554
|
}
|
|
540
555
|
/**
|
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,EAAqB,MAAM,8BAA8B,CAAC;AAMzE,OAAO,EAEH,eAAe,EACf,gBAAgB,GACnB,MAAM,eAAe,CAAC;AAoHvB,SAAS,uBAAuB,CAAC,QAAa;IAC1C,OAAO,QAAQ,KAAK,SAAS,IAAI,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ;QAC1E,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,sBAAsB,CAAC,QAAa;IACzC,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ,CAAC;AAChH,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAa;IACvC,OAAO,QAAQ,KAAK,SAAS,IAAI,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ;QAC1E,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,OAA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ClF,MAAM,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACrD,MAAM,aAAa,GAAG,eAAe,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;YACnD,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,CAAC,aAAa,EAAE,CAAC,CAAC;YAClF,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { IFluidSerializer, ValueType } from \"@fluidframework/shared-object-base\";\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport {\n ISerializableValue,\n ISerializedValue,\n ISharedMapEvents,\n} from \"./interfaces\";\nimport {\n ILocalValue,\n LocalValueMaker,\n makeSerializable,\n} from \"./localValues\";\n\n/**\n * Defines the means to process and submit a given op on a map.\n */\ninterface IMapMessageHandler {\n /**\n * Apply the given operation.\n * @param op - The map operation to apply\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n process(\n op: IMapOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): void;\n\n /**\n * Communicate the operation to remote clients.\n * @param op - The map operation to submit\n * @param localOpMetadata - The metadata to be submitted with the message.\n */\n submit(op: IMapOperation, localOpMetadata: unknown): void;\n\n getStashedOpLocalMetadata(op: IMapOperation): unknown;\n}\n\n/**\n * Operation indicating a value should be set for a key.\n */\nexport interface IMapSetOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"set\";\n\n /**\n * Map key being modified.\n */\n key: string;\n\n /**\n * Value to be set on the key.\n */\n value: ISerializableValue;\n}\n\n/**\n * Operation indicating a key should be deleted from the map.\n */\nexport interface IMapDeleteOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"delete\";\n\n /**\n * Map key being modified.\n */\n key: string;\n}\n\n/**\n * Map key operations are one of several types.\n */\nexport type IMapKeyOperation = IMapSetOperation | IMapDeleteOperation;\n\n/**\n * Operation indicating the map should be cleared.\n */\nexport interface IMapClearOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"clear\";\n}\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 * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n [key: string]: ISerializableValue;\n}\n\nexport interface IMapDataObjectSerialized {\n [key: string]: ISerializedValue;\n}\n\ninterface IMapKeyEditLocalOpMetadata {\n type: \"edit\";\n pendingMessageId: number;\n previousValue?: ILocalValue;\n}\n\ninterface IMapKeyAddLocalOpMetadata {\n type: \"add\";\n pendingMessageId: number;\n}\n\ninterface IMapClearLocalOpMetadata {\n type: \"clear\";\n pendingMessageId: number;\n previousMap?: Map<string, ILocalValue>;\n}\n\ntype MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;\ntype MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;\n\nfunction isMapKeyLocalOpMetadata(metadata: any): metadata is MapKeyLocalOpMetadata {\n return metadata !== undefined && typeof metadata.pendingMessageId === \"number\" &&\n (metadata.type === \"add\" || metadata.type === \"edit\");\n}\n\nfunction isClearLocalOpMetadata(metadata: any): metadata is IMapClearLocalOpMetadata {\n return metadata !== undefined && metadata.type === \"clear\" && typeof metadata.pendingMessageId === \"number\";\n}\n\nfunction isMapLocalOpMetadata(metadata: any): metadata is MapLocalOpMetadata {\n return metadata !== undefined && typeof metadata.pendingMessageId === \"number\" &&\n (metadata.type === \"add\" || metadata.type === \"edit\" || metadata.type === \"clear\");\n}\n\n/**\n * A SharedMap is a map-like distributed data structure.\n */\nexport class MapKernel {\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size(): number {\n return this.data.size;\n }\n\n /**\n * Mapping of op types to message handlers.\n */\n private readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n /**\n * The in-memory data the map is storing.\n */\n private readonly data = new Map<string, ILocalValue>();\n\n /**\n * Keys that have been modified locally but not yet ack'd from the server.\n */\n private readonly pendingKeys: Map<string, number[]> = new Map();\n\n /**\n * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.\n */\n private pendingMessageId: number = -1;\n\n /**\n * The pending ids of any clears that have been performed locally but not yet ack'd from the server\n */\n private readonly pendingClearMessageIds: number[] = [];\n\n /**\n * Object to create encapsulations of the values stored in the map.\n */\n private readonly localValueMaker: LocalValueMaker;\n\n /**\n * Create a new shared map kernel.\n * @param serializer - The serializer to serialize / parse handles\n * @param handle - The handle of the shared object using the kernel\n * @param submitMessage - A callback to submit a message through the shared object\n * @param isAttached - To query whether the shared object should generate ops\n * @param valueTypes - The value types to register\n * @param eventEmitter - The object that will emit map events\n */\n constructor(\n private readonly serializer: IFluidSerializer,\n private readonly handle: IFluidHandle,\n private readonly submitMessage: (op: any, localOpMetadata: unknown) => void,\n private readonly isAttached: () => boolean,\n private readonly eventEmitter: TypedEventEmitter<ISharedMapEvents>,\n ) {\n this.localValueMaker = new LocalValueMaker(serializer);\n this.messageHandlers = this.getMessageHandlers();\n }\n\n /**\n * Get an iterator over the keys in this map.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.data.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n const localEntriesIterator = this.data.entries();\n const iterator = {\n next(): IteratorResult<[string, any]> {\n const nextVal = localEntriesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: [nextVal.value[0], nextVal.value[1].value], done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n const localValuesIterator = this.data.values();\n const iterator = {\n next(): IteratorResult<any> {\n const nextVal = localValuesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: nextVal.value.value, done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.entries();\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n this.data.forEach((localValue, key, m) => {\n callbackFn(localValue.value, key, m);\n });\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n public get<T = any>(key: string): T | undefined {\n const localValue = this.data.get(key);\n return localValue === undefined ? undefined : localValue.value as T;\n }\n\n /**\n * Check if a key exists in the map.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.data.has(key);\n }\n\n /**\n * {@inheritDoc ISharedMap.set}\n */\n public set(key: string, value: any) {\n // Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n if (key === undefined || key === null) {\n throw new Error(\"Undefined and null keys are not supported\");\n }\n\n // Create a local value and serialize it.\n const localValue = this.localValueMaker.fromInMemory(value);\n const serializableValue = makeSerializable(\n localValue,\n this.serializer,\n this.handle);\n\n // Set the value locally.\n const previousValue = this.setCore(\n key,\n localValue,\n true,\n );\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IMapSetOperation = {\n key,\n type: \"set\",\n value: serializableValue,\n };\n this.submitMapKeyMessage(op, previousValue);\n }\n\n /**\n * Delete a key from the map.\n * @param key - Key to delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n public delete(key: string): boolean {\n // Delete the key locally first.\n const previousValue = this.deleteCore(key, true);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return previousValue !== undefined;\n }\n\n const op: IMapDeleteOperation = {\n key,\n type: \"delete\",\n };\n this.submitMapKeyMessage(op, previousValue);\n\n return previousValue !== undefined;\n }\n\n /**\n * Clear all data from the map.\n */\n public clear(): void {\n const copy = this.isAttached() ? new Map<string, ILocalValue>(this.data) : undefined;\n\n // Clear the data locally first.\n this.clearCore(true);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IMapClearOperation = {\n type: \"clear\",\n };\n this.submitMapClearMessage(op, copy);\n }\n\n /**\n * Serializes the data stored in the shared map to a JSON string\n * @param serializer - The serializer to use to serialize handles in its values.\n * @returns A JSON string containing serialized map data\n */\n public getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n const serializableMapData: IMapDataObjectSerialized = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n const serializableMapData: IMapDataObjectSerializable = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public serialize(serializer: IFluidSerializer): string {\n return JSON.stringify(this.getSerializableStorage(serializer));\n }\n\n /**\n * Populate the kernel with the given map data.\n * @param data - A JSON string containing serialized map data\n */\n public populateFromSerializable(json: IMapDataObjectSerializable): void {\n for (const [key, serializable] of Object.entries(json)) {\n const localValue = {\n key,\n value: this.makeLocal(key, serializable),\n };\n\n this.data.set(localValue.key, localValue.value);\n }\n }\n\n public populate(json: string): void {\n this.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n }\n\n /**\n * Submit the given op if a handler is registered.\n * @param op - The operation to attempt to submit\n * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n * @returns True if the operation was submitted, false otherwise.\n */\n public trySubmitMessage(op: any, localOpMetadata: unknown): boolean {\n const handler = this.messageHandlers.get(op.type);\n if (handler === undefined) {\n return false;\n }\n handler.submit(op as IMapOperation, localOpMetadata);\n return true;\n }\n\n public tryGetStashedOpLocalMetadata(op: any): unknown {\n const handler = this.messageHandlers.get(op.type);\n if (handler === undefined) {\n throw new Error(\"no apply stashed op handler\");\n }\n return handler.getStashedOpLocalMetadata(op as IMapOperation);\n }\n\n /**\n * Process the given op if a handler is registered.\n * @param op - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation was processed, false otherwise.\n */\n public tryProcessMessage(\n op: IMapOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): boolean {\n const handler = this.messageHandlers.get(op.type);\n if (handler === undefined) {\n return false;\n }\n handler.process(op, local, localOpMetadata);\n return true;\n }\n\n /**\n * Rollback a local op\n * @param op - The operation to rollback\n * @param localOpMetadata - The local metadata associated with the op.\n */\n public rollback(op: any, localOpMetadata: unknown) {\n if (!isMapLocalOpMetadata(localOpMetadata)) {\n throw new Error(\"Invalid localOpMetadata\");\n }\n\n if (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n if (localOpMetadata.previousMap === undefined) {\n throw new Error(\"Cannot rollback without previous map\");\n }\n localOpMetadata.previousMap.forEach((localValue, key) => {\n this.setCore(key, localValue, true);\n });\n\n const lastPendingClearId = this.pendingClearMessageIds.pop();\n if (lastPendingClearId === undefined || lastPendingClearId !== localOpMetadata.pendingMessageId) {\n throw new Error(\"Rollback op does match last clear\");\n }\n } else if (op.type === \"delete\" || op.type === \"set\") {\n if (localOpMetadata.type === \"add\") {\n this.deleteCore(op.key, true);\n } else if (localOpMetadata.type === \"edit\" && localOpMetadata.previousValue !== undefined) {\n this.setCore(op.key, localOpMetadata.previousValue, true);\n } else {\n throw new Error(\"Cannot rollback without previous value\");\n }\n\n const pendingMessageIds = this.pendingKeys.get(op.key);\n const lastPendingMessageId = pendingMessageIds?.pop();\n if (!pendingMessageIds || lastPendingMessageId !== localOpMetadata.pendingMessageId) {\n throw new Error(\"Rollback op does not match last pending\");\n }\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n } else {\n throw new Error(\"Unsupported op for rollback\");\n }\n }\n\n /**\n * Set implementation used for both locally sourced sets as well as incoming remote sets.\n * @param key - The key being set\n * @param value - The value being set\n * @param local - Whether the message originated from the local client\n * @returns Previous local value of the key, if any\n */\n private setCore(key: string, value: ILocalValue, local: boolean): ILocalValue | undefined {\n const previousLocalValue = this.data.get(key);\n const previousValue = previousLocalValue?.value;\n this.data.set(key, value);\n this.eventEmitter.emit(\"valueChanged\", { key, previousValue }, local, this.eventEmitter);\n return previousLocalValue;\n }\n\n /**\n * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n * @param local - Whether the message originated from the local client\n */\n private clearCore(local: boolean): void {\n this.data.clear();\n this.eventEmitter.emit(\"clear\", local, this.eventEmitter);\n }\n\n /**\n * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n * @param key - The key being deleted\n * @param local - Whether the message originated from the local client\n * @returns Previous local value of the key if it existed, undefined if it did not exist\n */\n private deleteCore(key: string, local: boolean): ILocalValue | undefined {\n const previousLocalValue = this.data.get(key);\n const previousValue = previousLocalValue?.value;\n const successfullyRemoved = this.data.delete(key);\n if (successfullyRemoved) {\n this.eventEmitter.emit(\"valueChanged\", { key, previousValue }, local, this.eventEmitter);\n }\n return previousLocalValue;\n }\n\n /**\n * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n */\n private clearExceptPendingKeys(): void {\n // Assuming the pendingKeys is small and the map is large\n // we will get the value for the pendingKeys and clear the map\n const temp = new Map<string, ILocalValue>();\n this.pendingKeys.forEach((value, key) => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n temp.set(key, this.data.get(key)!);\n });\n this.clearCore(false);\n temp.forEach((value, key) => {\n this.setCore(key, value, true);\n });\n }\n\n /**\n * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n * have the information we need to create a real object, but will not be the real object yet. For example,\n * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n * job is to convert that information into a real object for local usage.\n * @param key - The key that the caller intends to store the local value into (used for ops later). But\n * doesn't actually store the local value into that key. So better not lie!\n * @param serializable - The remote information that we can convert into a real object\n * @returns The local value that was produced\n */\n private makeLocal(key: string, serializable: ISerializableValue): ILocalValue {\n if (serializable.type === ValueType[ValueType.Plain] || serializable.type === ValueType[ValueType.Shared]) {\n return this.localValueMaker.fromSerializable(serializable);\n } else {\n throw new Error(\"Unknown local value type\");\n }\n }\n\n /**\n * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n * not process the incoming operation.\n * @param op - Operation to check\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation should be processed, false otherwise\n */\n private needProcessKeyOperation(\n op: IMapKeyOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): boolean {\n if (this.pendingClearMessageIds.length > 0) {\n if (local) {\n assert(localOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata) &&\n localOpMetadata.pendingMessageId < this.pendingClearMessageIds[0],\n 0x013 /* \"Received out of order op when there is an unackd clear message\" */);\n }\n // If we have an unack'd clear, we can ignore all ops.\n return false;\n }\n\n const pendingKeyMessageId = this.pendingKeys.get(op.key);\n if (pendingKeyMessageId !== undefined) {\n // Found an unack'd op. Clear it from the map if the pendingMessageId in the map matches this message's\n // and don't process the op.\n if (local) {\n assert(localOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata),\n 0x014 /* pendingMessageId is missing from the local client's operation */);\n const pendingMessageIds = this.pendingKeys.get(op.key);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x2fa /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n }\n return false;\n }\n\n // If we don't have a NACK op on the key, we need to process the remote ops.\n return !local;\n }\n\n /**\n * Get the message handlers for the map.\n * @returns A map of string op names to IMapMessageHandlers for those ops\n */\n private getMessageHandlers() {\n const messageHandlers = new Map<string, IMapMessageHandler>();\n messageHandlers.set(\n \"clear\",\n {\n process: (op: IMapClearOperation, local, localOpMetadata) => {\n if (local) {\n assert(isClearLocalOpMetadata(localOpMetadata),\n 0x015 /* \"pendingMessageId is missing from the local client's clear operation\" */);\n const pendingClearMessageId = this.pendingClearMessageIds.shift();\n assert(pendingClearMessageId === localOpMetadata.pendingMessageId,\n 0x2fb /* pendingMessageId does not match */);\n return;\n }\n if (this.pendingKeys.size !== 0) {\n this.clearExceptPendingKeys();\n return;\n }\n this.clearCore(local);\n },\n submit: (op: IMapClearOperation, localOpMetadata: unknown) => {\n assert(isClearLocalOpMetadata(localOpMetadata), 0x2fc /* Invalid localOpMetadata for clear */);\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const pendingClearMessageId = this.pendingClearMessageIds.shift();\n assert(pendingClearMessageId === localOpMetadata.pendingMessageId,\n 0x2fd /* pendingMessageId does not match */);\n this.submitMapClearMessage(op, localOpMetadata.previousMap);\n },\n getStashedOpLocalMetadata: (op: IMapClearOperation) => {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n return { type: \"clear\", pendingMessageId: this.getMapClearMessageId() };\n },\n });\n messageHandlers.set(\n \"delete\",\n {\n process: (op: IMapDeleteOperation, local, localOpMetadata) => {\n if (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n return;\n }\n this.deleteCore(op.key, local);\n },\n submit: (op: IMapDeleteOperation, localOpMetadata: unknown) => {\n this.resubmitMapKeyMessage(op, localOpMetadata);\n },\n getStashedOpLocalMetadata: (op: IMapDeleteOperation) => {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n return { type: \"edit\", pendingMessageId: this.getMapKeyMessageId(op) };\n },\n });\n messageHandlers.set(\n \"set\",\n {\n process: (op: IMapSetOperation, local, localOpMetadata) => {\n if (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n return;\n }\n\n // needProcessKeyOperation should have returned false if local is true\n const context = this.makeLocal(op.key, op.value);\n this.setCore(op.key, context, local);\n },\n submit: (op: IMapSetOperation, localOpMetadata: unknown) => {\n this.resubmitMapKeyMessage(op, localOpMetadata);\n },\n getStashedOpLocalMetadata: (op: IMapSetOperation) => {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n return { type: \"edit\", pendingMessageId: this.getMapKeyMessageId(op) };\n },\n });\n\n return messageHandlers;\n }\n\n private getMapClearMessageId(): number {\n const pendingMessageId = ++this.pendingMessageId;\n this.pendingClearMessageIds.push(pendingMessageId);\n return pendingMessageId;\n }\n\n /**\n * Submit a clear message to remote clients.\n * @param op - The clear message\n */\n private submitMapClearMessage(op: IMapClearOperation, previousMap?: Map<string, ILocalValue>): void {\n const metadata = { type: \"clear\", pendingMessageId: this.getMapClearMessageId(), previousMap };\n this.submitMessage(op, metadata);\n }\n\n private getMapKeyMessageId(op: IMapKeyOperation): number {\n const pendingMessageId = ++this.pendingMessageId;\n const pendingMessageIds = this.pendingKeys.get(op.key);\n if (pendingMessageIds !== undefined) {\n pendingMessageIds.push(pendingMessageId);\n } else {\n this.pendingKeys.set(op.key, [pendingMessageId]);\n }\n return pendingMessageId;\n }\n\n /**\n * Submit a map key message to remote clients.\n * @param op - The map key message\n * @param previousValue - The value of the key before this op\n */\n private submitMapKeyMessage(op: IMapKeyOperation, previousValue?: ILocalValue): void {\n const pendingMessageId = this.getMapKeyMessageId(op);\n const localMetadata = previousValue ?\n { type: \"edit\", pendingMessageId, previousValue } :\n { type: \"add\", pendingMessageId };\n this.submitMessage(op, localMetadata);\n }\n\n /**\n * Submit a map key message to remote clients based on a previous submit.\n * @param op - The map key message\n * @param localOpMetadata - Metadata from the previous submit\n */\n private resubmitMapKeyMessage(op: IMapKeyOperation, localOpMetadata: unknown): void {\n assert(isMapKeyLocalOpMetadata(localOpMetadata), 0x2fe /* Invalid localOpMetadata in submit */);\n\n // clear the old pending message id\n const pendingMessageIds = this.pendingKeys.get(op.key);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x2ff /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const pendingMessageId = this.getMapKeyMessageId(op);\n const localMetadata = localOpMetadata.type === \"edit\" ?\n { type: \"edit\", pendingMessageId, previousValue: localOpMetadata.previousValue } :\n { type: \"add\", pendingMessageId };\n this.submitMessage(op, localMetadata);\n }\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,EAAqB,MAAM,8BAA8B,CAAC;AAMzE,OAAO,EAEH,eAAe,EACf,gBAAgB,GACnB,MAAM,eAAe,CAAC;AA2HvB,SAAS,uBAAuB,CAAC,QAAa;IAC1C,OAAO,QAAQ,KAAK,SAAS,IAAI,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ;QAC1E,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,sBAAsB,CAAC,QAAa;IACzC,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ,CAA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,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { IFluidSerializer, ValueType } from \"@fluidframework/shared-object-base\";\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport {\n ISerializableValue,\n ISerializedValue,\n ISharedMapEvents,\n} from \"./interfaces\";\nimport {\n ILocalValue,\n LocalValueMaker,\n makeSerializable,\n} from \"./localValues\";\n\n/**\n * Defines the means to process and submit a given op on a map.\n */\ninterface IMapMessageHandler {\n /**\n * Apply the given operation.\n * @param op - The map operation to apply\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n process(\n op: IMapOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): void;\n\n /**\n * Communicate the operation to remote clients.\n * @param op - The map operation to submit\n * @param localOpMetadata - The metadata to be submitted with the message.\n */\n submit(op: IMapOperation, localOpMetadata: unknown): void;\n\n applyStashedOp(op: IMapOperation): unknown;\n}\n\n/**\n * Operation indicating a value should be set for a key.\n */\nexport interface IMapSetOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"set\";\n\n /**\n * Map key being modified.\n */\n key: string;\n\n /**\n * Value to be set on the key.\n */\n value: ISerializableValue;\n}\n\n/**\n * Operation indicating a key should be deleted from the map.\n */\nexport interface IMapDeleteOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"delete\";\n\n /**\n * Map key being modified.\n */\n key: string;\n}\n\n/**\n * Map key operations are one of several types.\n */\nexport type IMapKeyOperation = IMapSetOperation | IMapDeleteOperation;\n\n/**\n * Operation indicating the map should be cleared.\n */\nexport interface IMapClearOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"clear\";\n}\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 [key: string]: ISerializableValue;\n}\n\n/**\n * Serialized key/value data.\n */\nexport interface IMapDataObjectSerialized {\n [key: string]: ISerializedValue;\n}\n\ninterface IMapKeyEditLocalOpMetadata {\n type: \"edit\";\n pendingMessageId: number;\n previousValue: ILocalValue;\n}\n\ninterface IMapKeyAddLocalOpMetadata {\n type: \"add\";\n pendingMessageId: number;\n}\n\ninterface IMapClearLocalOpMetadata {\n type: \"clear\";\n pendingMessageId: number;\n previousMap?: Map<string, ILocalValue>;\n}\n\ntype MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;\ntype MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;\n\nfunction isMapKeyLocalOpMetadata(metadata: any): metadata is MapKeyLocalOpMetadata {\n return metadata !== undefined && typeof metadata.pendingMessageId === \"number\" &&\n (metadata.type === \"add\" || metadata.type === \"edit\");\n}\n\nfunction isClearLocalOpMetadata(metadata: any): metadata is IMapClearLocalOpMetadata {\n return metadata !== undefined && metadata.type === \"clear\" && typeof metadata.pendingMessageId === \"number\";\n}\n\nfunction isMapLocalOpMetadata(metadata: any): metadata is MapLocalOpMetadata {\n return metadata !== undefined && typeof metadata.pendingMessageId === \"number\" &&\n (metadata.type === \"add\" || metadata.type === \"edit\" || metadata.type === \"clear\");\n}\n\nfunction createClearLocalOpMetadata(op: IMapClearOperation,\n pendingClearMessageId: number, previousMap?: Map<string, ILocalValue>): IMapClearLocalOpMetadata {\n const localMetadata: IMapClearLocalOpMetadata = {\n type: \"clear\",\n pendingMessageId: pendingClearMessageId, previousMap,\n };\n return localMetadata;\n}\n\nfunction createKeyLocalOpMetadata(op: IMapKeyOperation,\n pendingMessageId: number, previousValue?: ILocalValue): MapKeyLocalOpMetadata {\n const localMetadata: MapKeyLocalOpMetadata = previousValue ?\n { type: \"edit\", pendingMessageId, previousValue } :\n { type: \"add\", pendingMessageId };\n return localMetadata;\n}\n\n/**\n * A SharedMap is a map-like distributed data structure.\n */\nexport class MapKernel {\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size(): number {\n return this.data.size;\n }\n\n /**\n * Mapping of op types to message handlers.\n */\n private readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n /**\n * The in-memory data the map is storing.\n */\n private readonly data = new Map<string, ILocalValue>();\n\n /**\n * Keys that have been modified locally but not yet ack'd from the server.\n */\n private readonly pendingKeys: Map<string, number[]> = new Map();\n\n /**\n * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.\n */\n private pendingMessageId: number = -1;\n\n /**\n * The pending ids of any clears that have been performed locally but not yet ack'd from the server\n */\n private readonly pendingClearMessageIds: number[] = [];\n\n /**\n * Object to create encapsulations of the values stored in the map.\n */\n private readonly localValueMaker: LocalValueMaker;\n\n /**\n * Create a new shared map kernel.\n * @param serializer - The serializer to serialize / parse handles\n * @param handle - The handle of the shared object using the kernel\n * @param submitMessage - A callback to submit a message through the shared object\n * @param isAttached - To query whether the shared object should generate ops\n * @param valueTypes - The value types to register\n * @param eventEmitter - The object that will emit map events\n */\n constructor(\n private readonly serializer: IFluidSerializer,\n private readonly handle: IFluidHandle,\n private readonly submitMessage: (op: any, localOpMetadata: unknown) => void,\n private readonly isAttached: () => boolean,\n private readonly eventEmitter: TypedEventEmitter<ISharedMapEvents>,\n ) {\n this.localValueMaker = new LocalValueMaker(serializer);\n this.messageHandlers = this.getMessageHandlers();\n }\n\n /**\n * Get an iterator over the keys in this map.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.data.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n const localEntriesIterator = this.data.entries();\n const iterator = {\n next(): IteratorResult<[string, any]> {\n const nextVal = localEntriesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: [nextVal.value[0], nextVal.value[1].value], done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n const localValuesIterator = this.data.values();\n const iterator = {\n next(): IteratorResult<any> {\n const nextVal = localValuesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: nextVal.value.value, done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.entries();\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n this.data.forEach((localValue, key, m) => {\n callbackFn(localValue.value, key, m);\n });\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n public get<T = any>(key: string): T | undefined {\n const localValue = this.data.get(key);\n return localValue === undefined ? undefined : localValue.value as T;\n }\n\n /**\n * Check if a key exists in the map.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.data.has(key);\n }\n\n /**\n * {@inheritDoc ISharedMap.set}\n */\n public set(key: string, value: any) {\n // Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n if (key === undefined || key === null) {\n throw new Error(\"Undefined and null keys are not supported\");\n }\n\n // Create a local value and serialize it.\n const localValue = this.localValueMaker.fromInMemory(value);\n const serializableValue = makeSerializable(\n localValue,\n this.serializer,\n this.handle);\n\n // Set the value locally.\n const previousValue = this.setCore(\n key,\n localValue,\n true,\n );\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IMapSetOperation = {\n key,\n type: \"set\",\n value: serializableValue,\n };\n this.submitMapKeyMessage(op, previousValue);\n }\n\n /**\n * Delete a key from the map.\n * @param key - Key to delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n public delete(key: string): boolean {\n // Delete the key locally first.\n const previousValue = this.deleteCore(key, true);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return previousValue !== undefined;\n }\n\n const op: IMapDeleteOperation = {\n key,\n type: \"delete\",\n };\n this.submitMapKeyMessage(op, previousValue);\n\n return previousValue !== undefined;\n }\n\n /**\n * Clear all data from the map.\n */\n public clear(): void {\n const copy = this.isAttached() ? new Map<string, ILocalValue>(this.data) : undefined;\n\n // Clear the data locally first.\n this.clearCore(true);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IMapClearOperation = {\n type: \"clear\",\n };\n this.submitMapClearMessage(op, copy);\n }\n\n /**\n * Serializes the data stored in the shared map to a JSON string\n * @param serializer - The serializer to use to serialize handles in its values.\n * @returns A JSON string containing serialized map data\n */\n public getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n const serializableMapData: IMapDataObjectSerialized = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n const serializableMapData: IMapDataObjectSerializable = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public serialize(serializer: IFluidSerializer): string {\n return JSON.stringify(this.getSerializableStorage(serializer));\n }\n\n /**\n * Populate the kernel with the given map data.\n * @param data - A JSON string containing serialized map data\n */\n public populateFromSerializable(json: IMapDataObjectSerializable): void {\n for (const [key, serializable] of Object.entries(json)) {\n const localValue = {\n key,\n value: this.makeLocal(key, serializable),\n };\n\n this.data.set(localValue.key, localValue.value);\n }\n }\n\n public populate(json: string): void {\n this.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n }\n\n /**\n * Submit the given op if a handler is registered.\n * @param op - The operation to attempt to submit\n * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n * @returns True if the operation was submitted, false otherwise.\n */\n public trySubmitMessage(op: any, localOpMetadata: unknown): boolean {\n const handler = this.messageHandlers.get(op.type);\n if (handler === undefined) {\n return false;\n }\n handler.submit(op as IMapOperation, localOpMetadata);\n return true;\n }\n\n public tryApplyStashedOp(op: any): unknown {\n const handler = this.messageHandlers.get(op.type);\n if (handler === undefined) {\n throw new Error(\"no apply stashed op handler\");\n }\n return handler.applyStashedOp(op as IMapOperation);\n }\n\n /**\n * Process the given op if a handler is registered.\n * @param op - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation was processed, false otherwise.\n */\n public tryProcessMessage(\n op: IMapOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): boolean {\n const handler = this.messageHandlers.get(op.type);\n if (handler === undefined) {\n return false;\n }\n handler.process(op, local, localOpMetadata);\n return true;\n }\n\n /**\n * Rollback a local op\n * @param op - The operation to rollback\n * @param localOpMetadata - The local metadata associated with the op.\n */\n public rollback(op: any, localOpMetadata: unknown) {\n if (!isMapLocalOpMetadata(localOpMetadata)) {\n throw new Error(\"Invalid localOpMetadata\");\n }\n\n if (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n if (localOpMetadata.previousMap === undefined) {\n throw new Error(\"Cannot rollback without previous map\");\n }\n localOpMetadata.previousMap.forEach((localValue, key) => {\n this.setCore(key, localValue, true);\n });\n\n const lastPendingClearId = this.pendingClearMessageIds.pop();\n if (lastPendingClearId === undefined || lastPendingClearId !== localOpMetadata.pendingMessageId) {\n throw new Error(\"Rollback op does match last clear\");\n }\n } else if (op.type === \"delete\" || op.type === \"set\") {\n if (localOpMetadata.type === \"add\") {\n this.deleteCore(op.key, true);\n } else if (localOpMetadata.type === \"edit\" && localOpMetadata.previousValue !== undefined) {\n this.setCore(op.key, localOpMetadata.previousValue, true);\n } else {\n throw new Error(\"Cannot rollback without previous value\");\n }\n\n const pendingMessageIds = this.pendingKeys.get(op.key);\n const lastPendingMessageId = pendingMessageIds?.pop();\n if (!pendingMessageIds || lastPendingMessageId !== localOpMetadata.pendingMessageId) {\n throw new Error(\"Rollback op does not match last pending\");\n }\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n } else {\n throw new Error(\"Unsupported op for rollback\");\n }\n }\n\n /**\n * Set implementation used for both locally sourced sets as well as incoming remote sets.\n * @param key - The key being set\n * @param value - The value being set\n * @param local - Whether the message originated from the local client\n * @returns Previous local value of the key, if any\n */\n private setCore(key: string, value: ILocalValue, local: boolean): ILocalValue | undefined {\n const previousLocalValue = this.data.get(key);\n const previousValue = previousLocalValue?.value;\n this.data.set(key, value);\n this.eventEmitter.emit(\"valueChanged\", { key, previousValue }, local, this.eventEmitter);\n return previousLocalValue;\n }\n\n /**\n * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n * @param local - Whether the message originated from the local client\n */\n private clearCore(local: boolean): void {\n this.data.clear();\n this.eventEmitter.emit(\"clear\", local, this.eventEmitter);\n }\n\n /**\n * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n * @param key - The key being deleted\n * @param local - Whether the message originated from the local client\n * @returns Previous local value of the key if it existed, undefined if it did not exist\n */\n private deleteCore(key: string, local: boolean): ILocalValue | undefined {\n const previousLocalValue = this.data.get(key);\n const previousValue = previousLocalValue?.value;\n const successfullyRemoved = this.data.delete(key);\n if (successfullyRemoved) {\n this.eventEmitter.emit(\"valueChanged\", { key, previousValue }, local, this.eventEmitter);\n }\n return previousLocalValue;\n }\n\n /**\n * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n */\n private clearExceptPendingKeys(): void {\n // Assuming the pendingKeys is small and the map is large\n // we will get the value for the pendingKeys and clear the map\n const temp = new Map<string, ILocalValue>();\n this.pendingKeys.forEach((value, key) => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n temp.set(key, this.data.get(key)!);\n });\n this.clearCore(false);\n temp.forEach((value, key) => {\n this.setCore(key, value, true);\n });\n }\n\n /**\n * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n * have the information we need to create a real object, but will not be the real object yet. For example,\n * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n * job is to convert that information into a real object for local usage.\n * @param key - The key that the caller intends to store the local value into (used for ops later). But\n * doesn't actually store the local value into that key. So better not lie!\n * @param serializable - The remote information that we can convert into a real object\n * @returns The local value that was produced\n */\n private makeLocal(key: string, serializable: ISerializableValue): ILocalValue {\n if (serializable.type === ValueType[ValueType.Plain] || serializable.type === ValueType[ValueType.Shared]) {\n return this.localValueMaker.fromSerializable(serializable);\n } else {\n throw new Error(\"Unknown local value type\");\n }\n }\n\n /**\n * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n * not process the incoming operation.\n * @param op - Operation to check\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation should be processed, false otherwise\n */\n private needProcessKeyOperation(\n op: IMapKeyOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): boolean {\n if (this.pendingClearMessageIds.length > 0) {\n if (local) {\n assert(localOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata) &&\n localOpMetadata.pendingMessageId < this.pendingClearMessageIds[0],\n 0x013 /* \"Received out of order op when there is an unackd clear message\" */);\n }\n // If we have an unack'd clear, we can ignore all ops.\n return false;\n }\n\n const pendingKeyMessageId = this.pendingKeys.get(op.key);\n if (pendingKeyMessageId !== undefined) {\n // Found an unack'd op. Clear it from the map if the pendingMessageId in the map matches this message's\n // and don't process the op.\n if (local) {\n assert(localOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata),\n 0x014 /* pendingMessageId is missing from the local client's operation */);\n const pendingMessageIds = this.pendingKeys.get(op.key);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x2fa /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n }\n return false;\n }\n\n // If we don't have a NACK op on the key, we need to process the remote ops.\n return !local;\n }\n\n /**\n * Get the message handlers for the map.\n * @returns A map of string op names to IMapMessageHandlers for those ops\n */\n private getMessageHandlers() {\n const messageHandlers = new Map<string, IMapMessageHandler>();\n messageHandlers.set(\n \"clear\",\n {\n process: (op: IMapClearOperation, local, localOpMetadata) => {\n if (local) {\n assert(isClearLocalOpMetadata(localOpMetadata),\n 0x015 /* \"pendingMessageId is missing from the local client's clear operation\" */);\n const pendingClearMessageId = this.pendingClearMessageIds.shift();\n assert(pendingClearMessageId === localOpMetadata.pendingMessageId,\n 0x2fb /* pendingMessageId does not match */);\n return;\n }\n if (this.pendingKeys.size !== 0) {\n this.clearExceptPendingKeys();\n return;\n }\n this.clearCore(local);\n },\n submit: (op: IMapClearOperation, localOpMetadata: unknown) => {\n assert(isClearLocalOpMetadata(localOpMetadata), 0x2fc /* Invalid localOpMetadata for clear */);\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const pendingClearMessageId = this.pendingClearMessageIds.shift();\n assert(pendingClearMessageId === localOpMetadata.pendingMessageId,\n 0x2fd /* pendingMessageId does not match */);\n this.submitMapClearMessage(op, localOpMetadata.previousMap);\n },\n applyStashedOp: (op: IMapClearOperation) => {\n const copy = new Map<string, ILocalValue>(this.data);\n this.clearCore(true);\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n return createClearLocalOpMetadata(op, this.getMapClearMessageId(), copy);\n },\n });\n messageHandlers.set(\n \"delete\",\n {\n process: (op: IMapDeleteOperation, local, localOpMetadata) => {\n if (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n return;\n }\n this.deleteCore(op.key, local);\n },\n submit: (op: IMapDeleteOperation, localOpMetadata: unknown) => {\n this.resubmitMapKeyMessage(op, localOpMetadata);\n },\n applyStashedOp: (op: IMapDeleteOperation) => {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const previousValue = this.deleteCore(op.key, true);\n return createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);\n },\n });\n messageHandlers.set(\n \"set\",\n {\n process: (op: IMapSetOperation, local, localOpMetadata) => {\n if (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n return;\n }\n\n // needProcessKeyOperation should have returned false if local is true\n const context = this.makeLocal(op.key, op.value);\n this.setCore(op.key, context, local);\n },\n submit: (op: IMapSetOperation, localOpMetadata: unknown) => {\n this.resubmitMapKeyMessage(op, localOpMetadata);\n },\n applyStashedOp: (op: IMapSetOperation) => {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const context = this.makeLocal(op.key, op.value);\n const previousValue = this.setCore(op.key, context, true);\n return createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);\n },\n });\n\n return messageHandlers;\n }\n\n private getMapClearMessageId(): number {\n const pendingMessageId = ++this.pendingMessageId;\n this.pendingClearMessageIds.push(pendingMessageId);\n return pendingMessageId;\n }\n\n /**\n * Submit a clear message to remote clients.\n * @param op - The clear message\n */\n private submitMapClearMessage(op: IMapClearOperation, previousMap?: Map<string, ILocalValue>): void {\n const metadata = createClearLocalOpMetadata(op, this.getMapClearMessageId(), previousMap);\n this.submitMessage(op, metadata);\n }\n\n private getMapKeyMessageId(op: IMapKeyOperation): number {\n const pendingMessageId = ++this.pendingMessageId;\n const pendingMessageIds = this.pendingKeys.get(op.key);\n if (pendingMessageIds !== undefined) {\n pendingMessageIds.push(pendingMessageId);\n } else {\n this.pendingKeys.set(op.key, [pendingMessageId]);\n }\n return pendingMessageId;\n }\n\n /**\n * Submit a map key message to remote clients.\n * @param op - The map key message\n * @param previousValue - The value of the key before this op\n */\n private submitMapKeyMessage(op: IMapKeyOperation, previousValue?: ILocalValue): void {\n const localMetadata = createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);\n this.submitMessage(op, localMetadata);\n }\n\n /**\n * Submit a map key message to remote clients based on a previous submit.\n * @param op - The map key message\n * @param localOpMetadata - Metadata from the previous submit\n */\n private resubmitMapKeyMessage(op: IMapKeyOperation, localOpMetadata: unknown): void {\n assert(isMapKeyLocalOpMetadata(localOpMetadata), 0x2fe /* Invalid localOpMetadata in submit */);\n\n // clear the old pending message id\n const pendingMessageIds = this.pendingKeys.get(op.key);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x2ff /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const pendingMessageId = this.getMapKeyMessageId(op);\n const localMetadata = localOpMetadata.type === \"edit\" ?\n { type: \"edit\", pendingMessageId, previousValue: localOpMetadata.previousValue } :\n { type: \"add\", pendingMessageId };\n this.submitMessage(op, localMetadata);\n }\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 = "1.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.1.0.0.82159";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,wBAAwB,CAAC;AAC7C,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,wBAAwB,CAAC;AAC7C,eAAO,MAAM,UAAU,+BAA+B,CAAC"}
|
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,
|
|
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,4BAA4B,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-internal.1.0.0.82159\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/map",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.0-internal.1.0.0.82159",
|
|
4
4
|
"description": "Distributed map",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -62,24 +62,24 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
64
64
|
"@fluidframework/common-utils": "^0.32.1",
|
|
65
|
-
"@fluidframework/container-utils": "
|
|
66
|
-
"@fluidframework/core-interfaces": "
|
|
67
|
-
"@fluidframework/datastore-definitions": "
|
|
68
|
-
"@fluidframework/driver-utils": "
|
|
69
|
-
"@fluidframework/protocol-definitions": "^0.
|
|
70
|
-
"@fluidframework/runtime-definitions": "
|
|
71
|
-
"@fluidframework/runtime-utils": "
|
|
72
|
-
"@fluidframework/shared-object-base": "
|
|
65
|
+
"@fluidframework/container-utils": "2.0.0-internal.1.0.0.82159",
|
|
66
|
+
"@fluidframework/core-interfaces": "2.0.0-internal.1.0.0.82159",
|
|
67
|
+
"@fluidframework/datastore-definitions": "2.0.0-internal.1.0.0.82159",
|
|
68
|
+
"@fluidframework/driver-utils": "2.0.0-internal.1.0.0.82159",
|
|
69
|
+
"@fluidframework/protocol-definitions": "^0.1029.1000-0",
|
|
70
|
+
"@fluidframework/runtime-definitions": "2.0.0-internal.1.0.0.82159",
|
|
71
|
+
"@fluidframework/runtime-utils": "2.0.0-internal.1.0.0.82159",
|
|
72
|
+
"@fluidframework/shared-object-base": "2.0.0-internal.1.0.0.82159",
|
|
73
73
|
"path-browserify": "^1.0.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@fluid-internal/test-dds-utils": "
|
|
76
|
+
"@fluid-internal/test-dds-utils": "2.0.0-internal.1.0.0.82159",
|
|
77
77
|
"@fluidframework/build-common": "^0.24.0",
|
|
78
|
-
"@fluidframework/build-tools": "^0.
|
|
78
|
+
"@fluidframework/build-tools": "^0.3.0-0",
|
|
79
79
|
"@fluidframework/eslint-config-fluid": "^0.28.2000",
|
|
80
|
-
"@fluidframework/map-previous": "npm:@fluidframework/map
|
|
81
|
-
"@fluidframework/mocha-test-setup": "
|
|
82
|
-
"@fluidframework/test-runtime-utils": "
|
|
80
|
+
"@fluidframework/map-previous": "npm:@fluidframework/map@^1.0.0",
|
|
81
|
+
"@fluidframework/mocha-test-setup": "2.0.0-internal.1.0.0.82159",
|
|
82
|
+
"@fluidframework/test-runtime-utils": "2.0.0-internal.1.0.0.82159",
|
|
83
83
|
"@microsoft/api-extractor": "^7.22.2",
|
|
84
84
|
"@rushstack/eslint-config": "^2.5.1",
|
|
85
85
|
"@types/mocha": "^9.1.1",
|
|
@@ -95,7 +95,44 @@
|
|
|
95
95
|
"typescript-formatter": "7.1.0"
|
|
96
96
|
},
|
|
97
97
|
"typeValidation": {
|
|
98
|
-
"version": "
|
|
99
|
-
"broken": {
|
|
98
|
+
"version": "2.0.0",
|
|
99
|
+
"broken": {
|
|
100
|
+
"RemovedInterfaceDeclaration_IDirectoryClearOperation": {
|
|
101
|
+
"forwardCompat": false,
|
|
102
|
+
"backCompat": false
|
|
103
|
+
},
|
|
104
|
+
"RemovedInterfaceDeclaration_IDirectoryCreateSubDirectoryOperation": {
|
|
105
|
+
"forwardCompat": false,
|
|
106
|
+
"backCompat": false
|
|
107
|
+
},
|
|
108
|
+
"RemovedInterfaceDeclaration_IDirectoryDeleteOperation": {
|
|
109
|
+
"forwardCompat": false,
|
|
110
|
+
"backCompat": false
|
|
111
|
+
},
|
|
112
|
+
"RemovedInterfaceDeclaration_IDirectoryDeleteSubDirectoryOperation": {
|
|
113
|
+
"forwardCompat": false,
|
|
114
|
+
"backCompat": false
|
|
115
|
+
},
|
|
116
|
+
"RemovedTypeAliasDeclaration_IDirectoryKeyOperation": {
|
|
117
|
+
"forwardCompat": false,
|
|
118
|
+
"backCompat": false
|
|
119
|
+
},
|
|
120
|
+
"RemovedInterfaceDeclaration_IDirectorySetOperation": {
|
|
121
|
+
"forwardCompat": false,
|
|
122
|
+
"backCompat": false
|
|
123
|
+
},
|
|
124
|
+
"RemovedTypeAliasDeclaration_IDirectoryStorageOperation": {
|
|
125
|
+
"forwardCompat": false,
|
|
126
|
+
"backCompat": false
|
|
127
|
+
},
|
|
128
|
+
"RemovedTypeAliasDeclaration_IDirectorySubDirectoryOperation": {
|
|
129
|
+
"forwardCompat": false,
|
|
130
|
+
"backCompat": false
|
|
131
|
+
},
|
|
132
|
+
"RemovedInterfaceDeclaration_ILocalValue": {
|
|
133
|
+
"forwardCompat": false,
|
|
134
|
+
"backCompat": false
|
|
135
|
+
}
|
|
136
|
+
}
|
|
100
137
|
}
|
|
101
138
|
}
|