@fluidframework/map 2.0.0-dev.7.3.0.210328 → 2.0.0-dev.7.3.0.212138

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-extractor.json +4 -1
  3. package/dist/{directory.js → directory.cjs} +3 -3
  4. package/dist/directory.cjs.map +1 -0
  5. package/dist/{index.js → index.cjs} +4 -4
  6. package/dist/index.cjs.map +1 -0
  7. package/dist/{interfaces.js → interfaces.cjs} +1 -1
  8. package/dist/interfaces.cjs.map +1 -0
  9. package/dist/{internalInterfaces.js → internalInterfaces.cjs} +1 -1
  10. package/dist/internalInterfaces.cjs.map +1 -0
  11. package/dist/{localValues.js → localValues.cjs} +1 -1
  12. package/dist/localValues.cjs.map +1 -0
  13. package/dist/map-alpha.d.ts +950 -0
  14. package/dist/map-beta.d.ts +950 -0
  15. package/dist/map-public.d.ts +950 -0
  16. package/dist/map-untrimmed.d.ts +1035 -0
  17. package/dist/{map.js → map.cjs} +3 -3
  18. package/dist/map.cjs.map +1 -0
  19. package/dist/{mapKernel.js → mapKernel.cjs} +2 -2
  20. package/dist/mapKernel.cjs.map +1 -0
  21. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  22. package/dist/packageVersion.cjs.map +1 -0
  23. package/dist/packageVersion.d.ts +1 -1
  24. package/dist/tsdoc-metadata.json +1 -1
  25. package/lib/{directory.js → directory.mjs} +3 -3
  26. package/lib/directory.mjs.map +1 -0
  27. package/lib/index.mjs +8 -0
  28. package/lib/index.mjs.map +1 -0
  29. package/lib/{interfaces.js → interfaces.mjs} +1 -1
  30. package/{dist/interfaces.js.map → lib/interfaces.mjs.map} +1 -1
  31. package/lib/{internalInterfaces.js → internalInterfaces.mjs} +1 -1
  32. package/{dist/internalInterfaces.js.map → lib/internalInterfaces.mjs.map} +1 -1
  33. package/lib/{localValues.js → localValues.mjs} +1 -1
  34. package/lib/localValues.mjs.map +1 -0
  35. package/lib/map-alpha.d.ts +950 -0
  36. package/lib/map-beta.d.ts +950 -0
  37. package/lib/map-public.d.ts +950 -0
  38. package/lib/map-untrimmed.d.ts +1035 -0
  39. package/lib/{map.js → map.mjs} +3 -3
  40. package/lib/map.mjs.map +1 -0
  41. package/lib/{mapKernel.js → mapKernel.mjs} +2 -2
  42. package/lib/mapKernel.mjs.map +1 -0
  43. package/lib/packageVersion.d.ts +1 -1
  44. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  45. package/lib/packageVersion.mjs.map +1 -0
  46. package/package.json +44 -27
  47. package/src/packageVersion.ts +1 -1
  48. package/tsc-multi.test.json +4 -0
  49. package/dist/directory.js.map +0 -1
  50. package/dist/index.js.map +0 -1
  51. package/dist/localValues.js.map +0 -1
  52. package/dist/map.js.map +0 -1
  53. package/dist/mapKernel.js.map +0 -1
  54. package/dist/packageVersion.js.map +0 -1
  55. package/lib/directory.js.map +0 -1
  56. package/lib/index.js +0 -19
  57. package/lib/index.js.map +0 -1
  58. package/lib/interfaces.js.map +0 -1
  59. package/lib/internalInterfaces.js.map +0 -1
  60. package/lib/localValues.js.map +0 -1
  61. package/lib/map.js.map +0 -1
  62. package/lib/mapKernel.js.map +0 -1
  63. package/lib/packageVersion.js.map +0 -1
  64. package/tsconfig.esnext.json +0 -6
@@ -10,8 +10,8 @@ const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
10
10
  const driver_utils_1 = require("@fluidframework/driver-utils");
11
11
  const shared_object_base_1 = require("@fluidframework/shared-object-base");
12
12
  const runtime_utils_1 = require("@fluidframework/runtime-utils");
13
- const mapKernel_1 = require("./mapKernel");
14
- const packageVersion_1 = require("./packageVersion");
13
+ const mapKernel_1 = require("./mapKernel.cjs");
14
+ const packageVersion_1 = require("./packageVersion.cjs");
15
15
  const snapshotFileName = "header";
16
16
  /**
17
17
  * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMap}.
@@ -316,4 +316,4 @@ class SharedMap extends shared_object_base_1.SharedObject {
316
316
  }
317
317
  }
318
318
  exports.SharedMap = SharedMap;
319
- //# sourceMappingURL=map.js.map
319
+ //# sourceMappingURL=map.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.cjs","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+EAA8F;AAS9F,+DAA4D;AAC5D,2EAAoF;AACpF,iEAAmE;AAEnE,+CAAmF;AACnF,yDAA8C;AAO9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;;GAKG;AACH,MAAa,UAAU;IAetB;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,UAAU,CAAC,IAAI,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,UAAU,CAAC,UAAU,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,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;IACZ,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,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;IACZ,CAAC;;AApDF,gCAqDC;AApDA;;GAEG;AACoB,eAAI,GAAG,uCAAuC,CAAC;AAEtE;;GAEG;AACoB,qBAAU,GAAuB;IACvD,IAAI,EAAE,UAAU,CAAC,IAAI;IACrB,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,2BAAU;CAC1B,CAAC;AA0CH;;;;GAIG;AACH,MA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AC,wBAAwB,CAAC,IAAkC,CAAC,CAAC;SACzE;IACF,CAAC;IAED;;;OAGG;IACO,YAAY,KAAU,CAAC;IAEjC;;;OAGG;IACO,YAAY,CAAC,OAAgB,EAAE,eAAwB;QAChE,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAwB,EAAE,eAAe,CAAC,CAAC;IACzE,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,OAAgB;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAwB,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACO,WAAW,CACpB,OAAkC,EAClC,KAAc,EACd,eAAwB;QAExB,IAAI,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,EAAE;YAC3C,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAC5B,OAAO,CAAC,QAAyB,EACjC,KAAK,EACL,eAAe,CACf,CAAC;SACF;IACF,CAAC;IAED;;;OAGG;IACO,QAAQ,CAAC,OAAgB,EAAE,eAAwB;QAC5D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAChD,CAAC;CACD;AA/SD,8BA+SC","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\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelServices,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { IFluidSerializer, SharedObject } from \"@fluidframework/shared-object-base\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport { ISharedMap, ISharedMapEvents } from \"./interfaces\";\nimport { IMapDataObjectSerializable, IMapOperation, MapKernel } from \"./mapKernel\";\nimport { pkgVersion } from \"./packageVersion\";\n\ninterface IMapSerializationFormat {\n\tblobs?: string[];\n\tcontent: IMapDataObjectSerializable;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMap}.\n *\n * @sealed\n * @public\n */\nexport class MapFactory implements IChannelFactory {\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/map\";\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: MapFactory.Type,\n\t\tsnapshotFormatVersion: \"0.2\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn MapFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn MapFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<ISharedMap> {\n\t\tconst map = new SharedMap(id, runtime, attributes);\n\t\tawait map.load(services);\n\n\t\treturn map;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): ISharedMap {\n\t\tconst map = new SharedMap(id, runtime, MapFactory.Attributes);\n\t\tmap.initializeLocal();\n\n\t\treturn map;\n\t}\n}\n\n/**\n * {@inheritDoc ISharedMap}\n *\n * @public\n */\nexport class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {\n\t/**\n\t * Create a new shared map.\n\t * @param runtime - The data store runtime that the new shared map belongs to.\n\t * @param id - Optional name of the shared map.\n\t * @returns Newly created shared map.\n\t *\n\t * @example\n\t * To create a `SharedMap`, call the static create method:\n\t *\n\t * ```typescript\n\t * const myMap = SharedMap.create(this.runtime, id);\n\t * ```\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap {\n\t\treturn runtime.createChannel(id, MapFactory.Type) as SharedMap;\n\t}\n\n\t/**\n\t * Get a factory for SharedMap to register with the data store.\n\t * @returns A factory that creates SharedMaps and loads them from storage.\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new MapFactory();\n\t}\n\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic readonly [Symbol.toStringTag]: string = \"SharedMap\";\n\n\t/**\n\t * MapKernel which manages actual map operations.\n\t */\n\tprivate readonly kernel: MapKernel;\n\n\t/**\n\t * Do not call the constructor. Instead, you should use the {@link SharedMap.create | create method}.\n\t *\n\t * @param id - String identifier.\n\t * @param runtime - Data store runtime.\n\t * @param attributes - The attributes for the map.\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_map_\");\n\t\tthis.kernel = new MapKernel(\n\t\t\tthis.serializer,\n\t\t\tthis.handle,\n\t\t\t(op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n\t\t\t() => this.isAttached(),\n\t\t\tthis,\n\t\t);\n\t}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.kernel.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic entries(): IterableIterator<[string, any]> {\n\t\treturn this.kernel.entries();\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic values(): IterableIterator<any> {\n\t\treturn this.kernel.values();\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\n\t\treturn this.kernel.entries();\n\t}\n\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.kernel.size;\n\t}\n\n\t/**\n\t * Executes the given callback on each entry in the map.\n\t * @param callbackFn - Callback function\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n\t\t// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-callback-reference\n\t\tthis.kernel.forEach(callbackFn);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic get<T = any>(key: string): T | undefined {\n\t\treturn this.kernel.get<T>(key);\n\t}\n\n\t/**\n\t * Check if a key exists in the map.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.kernel.has(key);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.set}\n\t */\n\tpublic set(key: string, value: unknown): this {\n\t\tthis.kernel.set(key, value);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Delete a key from the map.\n\t * @param key - Key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\treturn this.kernel.delete(key);\n\t}\n\n\t/**\n\t * Clear all data from the map.\n\t */\n\tpublic clear(): void {\n\t\tthis.kernel.clear();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t * @internal\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tlet currentSize = 0;\n\t\tlet counter = 0;\n\t\tlet headerBlob: IMapDataObjectSerializable = {};\n\t\tconst blobs: string[] = [];\n\n\t\tconst builder = new SummaryTreeBuilder();\n\n\t\tconst data = this.kernel.getSerializedStorage(serializer);\n\n\t\t// If single property exceeds this size, it goes into its own blob\n\t\tconst MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n\t\t// Maximum blob size for multiple map properties\n\t\t// Should be bigger than MinValueSizeSeparateSnapshotBlob\n\t\tconst MaxSnapshotBlobSize = 16 * 1024;\n\n\t\t// Partitioning algorithm:\n\t\t// 1) Split large (over MinValueSizeSeparateSnapshotBlob = 8K) properties into their own blobs.\n\t\t// Naming (across snapshots) of such blob does not have to be stable across snapshots,\n\t\t// As de-duping process (in driver) should not care about paths, only content.\n\t\t// 2) Split remaining properties into blobs of MaxSnapshotBlobSize (16K) size.\n\t\t// This process does not produce stable partitioning. This means\n\t\t// modification (including addition / deletion) of property can shift properties across blobs\n\t\t// and result in non-incremental snapshot.\n\t\t// This can be improved in the future, without being format breaking change, as loading sequence\n\t\t// loads all blobs at once and partitioning schema has no impact on that process.\n\t\tfor (const key of Object.keys(data)) {\n\t\t\tconst value = data[key];\n\t\t\tif (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n\t\t\t\tconst blobName = `blob${counter}`;\n\t\t\t\tcounter++;\n\t\t\t\tblobs.push(blobName);\n\t\t\t\tconst content: IMapDataObjectSerializable = {\n\t\t\t\t\t[key]: {\n\t\t\t\t\t\ttype: value.type,\n\t\t\t\t\t\tvalue: JSON.parse(value.value) as unknown,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tbuilder.addBlob(blobName, JSON.stringify(content));\n\t\t\t} else {\n\t\t\t\tcurrentSize += value.type.length + 21; // Approximation cost of property header\n\t\t\t\tif (value.value) {\n\t\t\t\t\tcurrentSize += value.value.length;\n\t\t\t\t}\n\n\t\t\t\tif (currentSize > MaxSnapshotBlobSize) {\n\t\t\t\t\tconst blobName = `blob${counter}`;\n\t\t\t\t\tcounter++;\n\t\t\t\t\tblobs.push(blobName);\n\t\t\t\t\tbuilder.addBlob(blobName, JSON.stringify(headerBlob));\n\t\t\t\t\theaderBlob = {};\n\t\t\t\t\tcurrentSize = 0;\n\t\t\t\t}\n\t\t\t\theaderBlob[key] = {\n\t\t\t\t\ttype: value.type,\n\t\t\t\t\tvalue:\n\t\t\t\t\t\tvalue.value === undefined\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: (JSON.parse(value.value) as unknown),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tconst header: IMapSerializationFormat = {\n\t\t\tblobs,\n\t\t\tcontent: headerBlob,\n\t\t};\n\t\tbuilder.addBlob(snapshotFileName, JSON.stringify(header));\n\n\t\treturn builder.getSummaryTree();\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t * @internal\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst json = await readAndParse<object>(storage, snapshotFileName);\n\t\tconst newFormat = json as IMapSerializationFormat;\n\t\tif (Array.isArray(newFormat.blobs)) {\n\t\t\tthis.kernel.populateFromSerializable(newFormat.content);\n\t\t\tawait Promise.all(\n\t\t\t\tnewFormat.blobs.map(async (value) => {\n\t\t\t\t\tconst content = await readAndParse<IMapDataObjectSerializable>(storage, value);\n\t\t\t\t\tthis.kernel.populateFromSerializable(content);\n\t\t\t\t}),\n\t\t\t);\n\t\t} else {\n\t\t\tthis.kernel.populateFromSerializable(json as IMapDataObjectSerializable);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t * @internal\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t * @internal\n\t */\n\tprotected reSubmitCore(content: unknown, localOpMetadata: unknown): void {\n\t\tthis.kernel.trySubmitMessage(content as IMapOperation, localOpMetadata);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t * @internal\n\t */\n\tprotected applyStashedOp(content: unknown): unknown {\n\t\treturn this.kernel.tryApplyStashedOp(content as IMapOperation);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t * @internal\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tthis.kernel.tryProcessMessage(\n\t\t\t\tmessage.contents as IMapOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n\t * @internal\n\t */\n\tprotected rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tthis.kernel.rollback(content, localOpMetadata);\n\t}\n}\n"]}
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.MapKernel = void 0;
8
8
  const shared_object_base_1 = require("@fluidframework/shared-object-base");
9
9
  const core_utils_1 = require("@fluidframework/core-utils");
10
- const localValues_1 = require("./localValues");
10
+ const localValues_1 = require("./localValues.cjs");
11
11
  /* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
12
12
  function isMapKeyLocalOpMetadata(metadata) {
13
13
  return (metadata !== undefined &&
@@ -606,4 +606,4 @@ class MapKernel {
606
606
  }
607
607
  }
608
608
  exports.MapKernel = MapKernel;
609
- //# sourceMappingURL=mapKernel.js.map
609
+ //# sourceMappingURL=mapKernel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapKernel.cjs","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAAiF;AACjF,2DAAoD;AAYpD,mDAA+E;AA0D/E,mGAAmG;AAEnG,SAAS,uBAAuB,CAAC,QAAa;IAC7C,OAAO,CACN,QAAQ,KAAK,SAAS;QACtB,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ;QAC7C,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CACrD,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,QAAa;IAC5C,OAAO,CACN,QAAQ,KAAK,SAAS;QACtB,QAAQ,CAAC,IAAI,KAAK,OAAO;QACzB,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ,CAC7C,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAa;IAC1C,OAAO,CACN,QAAQ,KAAK,SAAS;QACtB,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ;QAC7C,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC,CAClF,CAAC;AACH,CAAC;AAED,kGAAkG;AAElG,SAAS,0BAA0B,CAClC,EAAsB,EACtB,qBAA6B,EAC7B,WAAsC;IAEtC,MAAM,aAAa,GAA6B;QAC/C,IAAI,EAAE,OAAO;QACb,gBAAgB,EAAE,qBAAqB;QACvC,WAAW;KACX,CAAC;IACF,OAAO,aAAa,CAAC;AACtB,CAAC;AAED,SAAS,wBAAwB,CAChC,EAAoB,E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C;IACvC,CAAC;IAED;;;;OAIG;IACK,qBAAqB,CAAC,EAAoB,EAAE,eAAmC;QACtF,IAAA,mBAAM,EACL,uBAAuB,CAAC,eAAe,CAAC,EACxC,KAAK,CAAC,uCAAuC,CAC7C,CAAC;QAEF,6DAA6D;QAC7D,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QACvD,IAAI,iBAAiB,KAAK,SAAS,EAAE;YACpC,OAAO;SACP;QAED,MAAM,KAAK,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,eAAe,CAAC,gBAAgB,CAAC,CAAC;QAC3F,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACjB,OAAO;SACP;QAED,iBAAiB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACnC,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;YACnC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;SAChC;QAED,kFAAkF;QAClF,MAAM,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACrD,MAAM,aAAa,GAClB,eAAe,CAAC,IAAI,KAAK,MAAM;YAC9B,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,CAAC,aAAa,EAAE;YAClF,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IACvC,CAAC;CACD;AAjqBD,8BAiqBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { IFluidSerializer, ValueType } from \"@fluidframework/shared-object-base\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\n// eslint-disable-next-line import/no-deprecated\nimport { ISerializableValue, ISerializedValue, ISharedMapEvents } from \"./interfaces\";\nimport {\n\tIMapSetOperation,\n\tIMapDeleteOperation,\n\tIMapClearOperation,\n\tIMapKeyEditLocalOpMetadata,\n\tIMapKeyAddLocalOpMetadata,\n\tIMapClearLocalOpMetadata,\n} from \"./internalInterfaces\";\nimport { ILocalValue, LocalValueMaker, makeSerializable } from \"./localValues\";\n\n/**\n * Defines the means to process and submit a given op on a map.\n */\ninterface IMapMessageHandler {\n\t/**\n\t * Apply the given operation.\n\t * @param op - The map operation to apply\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess(op: IMapOperation, local: boolean, localOpMetadata: MapLocalOpMetadata): void;\n\n\t/**\n\t * Communicate the operation to remote clients.\n\t * @param op - The map operation to submit\n\t * @param localOpMetadata - The metadata to be submitted with the message.\n\t */\n\tsubmit(op: IMapOperation, localOpMetadata: MapLocalOpMetadata): void;\n\n\tapplyStashedOp(op: IMapOperation): MapLocalOpMetadata;\n}\n\n/**\n * Map key operations are one of several types.\n */\nexport type IMapKeyOperation = IMapSetOperation | IMapDeleteOperation;\n\n/**\n * Description of a map delta operation\n */\nexport type IMapOperation = IMapKeyOperation | IMapClearOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n *\n * @remarks Directly used in\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify\n * | JSON.stringify}, direct result from\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.\n */\nexport interface IMapDataObjectSerializable {\n\t// eslint-disable-next-line import/no-deprecated\n\t[key: string]: ISerializableValue;\n}\n\n/**\n * Serialized key/value data.\n */\nexport interface IMapDataObjectSerialized {\n\t[key: string]: ISerializedValue;\n}\n\ntype MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;\ntype MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction isMapKeyLocalOpMetadata(metadata: any): metadata is MapKeyLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\t(metadata.type === \"add\" || metadata.type === \"edit\")\n\t);\n}\n\nfunction isClearLocalOpMetadata(metadata: any): metadata is IMapClearLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\tmetadata.type === \"clear\" &&\n\t\ttypeof metadata.pendingMessageId === \"number\"\n\t);\n}\n\nfunction isMapLocalOpMetadata(metadata: any): metadata is MapLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\t(metadata.type === \"add\" || metadata.type === \"edit\" || metadata.type === \"clear\")\n\t);\n}\n\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction createClearLocalOpMetadata(\n\top: IMapClearOperation,\n\tpendingClearMessageId: number,\n\tpreviousMap?: Map<string, ILocalValue>,\n): IMapClearLocalOpMetadata {\n\tconst localMetadata: IMapClearLocalOpMetadata = {\n\t\ttype: \"clear\",\n\t\tpendingMessageId: pendingClearMessageId,\n\t\tpreviousMap,\n\t};\n\treturn localMetadata;\n}\n\nfunction createKeyLocalOpMetadata(\n\top: IMapKeyOperation,\n\tpendingMessageId: number,\n\tpreviousValue?: ILocalValue,\n): MapKeyLocalOpMetadata {\n\tconst localMetadata: MapKeyLocalOpMetadata = previousValue\n\t\t? { type: \"edit\", pendingMessageId, previousValue }\n\t\t: { type: \"add\", pendingMessageId };\n\treturn localMetadata;\n}\n\n/**\n * A SharedMap is a map-like distributed data structure.\n */\nexport class MapKernel {\n\t/**\n\t * The number of key/value pairs stored in the map.\n\t */\n\tpublic get size(): number {\n\t\treturn this.data.size;\n\t}\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n\t/**\n\t * The in-memory data the map is storing.\n\t */\n\tprivate readonly data = new Map<string, ILocalValue>();\n\n\t/**\n\t * Keys that have been modified locally but not yet ack'd from the server.\n\t */\n\tprivate readonly pendingKeys: Map<string, number[]> = new Map();\n\n\t/**\n\t * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.\n\t */\n\tprivate pendingMessageId: number = -1;\n\n\t/**\n\t * The pending ids of any clears that have been performed locally but not yet ack'd from the server\n\t */\n\tprivate readonly pendingClearMessageIds: number[] = [];\n\n\t/**\n\t * Object to create encapsulations of the values stored in the map.\n\t */\n\tprivate readonly localValueMaker: LocalValueMaker;\n\n\t/**\n\t * Create a new shared map kernel.\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param handle - The handle of the shared object using the kernel\n\t * @param submitMessage - A callback to submit a message through the shared object\n\t * @param isAttached - To query whether the shared object should generate ops\n\t * @param valueTypes - The value types to register\n\t * @param eventEmitter - The object that will emit map events\n\t */\n\tpublic constructor(\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tprivate readonly handle: IFluidHandle,\n\t\tprivate readonly submitMessage: (op: unknown, localOpMetadata: unknown) => void,\n\t\tprivate readonly isAttached: () => boolean,\n\t\tprivate readonly eventEmitter: TypedEventEmitter<ISharedMapEvents>,\n\t) {\n\t\tthis.localValueMaker = new LocalValueMaker(serializer);\n\t\tthis.messageHandlers = this.getMessageHandlers();\n\t}\n\n\t/**\n\t * Get an iterator over the keys in this map.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.data.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic entries(): IterableIterator<[string, any]> {\n\t\tconst localEntriesIterator = this.data.entries();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<[string, unknown]> {\n\t\t\t\tconst nextVal = localEntriesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: // Unpack the stored value\n\t\t\t\t\t { value: [nextVal.value[0], nextVal.value[1].value], done: false };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the values in this map.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic values(): IterableIterator<any> {\n\t\tconst localValuesIterator = this.data.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<unknown> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: // Unpack the stored value\n\t\t\t\t\t { value: nextVal.value.value as unknown, done: false };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<unknown> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the entries in this map.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Executes the given callback on each entry in the map.\n\t * @param callbackFn - Callback function\n\t */\n\tpublic forEach(\n\t\tcallbackFn: (value: unknown, key: string, map: Map<string, unknown>) => void,\n\t): void {\n\t\t// eslint-disable-next-line unicorn/no-array-for-each\n\t\tthis.data.forEach((localValue, key, m) => {\n\t\t\tcallbackFn(localValue.value, key, m);\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.get}\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic get<T = any>(key: string): T | undefined {\n\t\tconst localValue = this.data.get(key);\n\t\treturn localValue === undefined ? undefined : (localValue.value as T);\n\t}\n\n\t/**\n\t * Check if a key exists in the map.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.data.has(key);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedMap.set}\n\t */\n\tpublic set(key: string, value: unknown): void {\n\t\t// Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (key === undefined || key === null) {\n\t\t\tthrow new Error(\"Undefined and null keys are not supported\");\n\t\t}\n\n\t\t// Create a local value and serialize it.\n\t\tconst localValue = this.localValueMaker.fromInMemory(value);\n\t\tconst serializableValue = makeSerializable(localValue, this.serializer, this.handle);\n\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(key, localValue, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst op: IMapSetOperation = {\n\t\t\tkey,\n\t\t\ttype: \"set\",\n\t\t\tvalue: serializableValue,\n\t\t};\n\t\tthis.submitMapKeyMessage(op, previousValue);\n\t}\n\n\t/**\n\t * Delete a key from the map.\n\t * @param key - Key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\t// Delete the key locally first.\n\t\tconst previousValue = this.deleteCore(key, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn previousValue !== undefined;\n\t\t}\n\n\t\tconst op: IMapDeleteOperation = {\n\t\t\tkey,\n\t\t\ttype: \"delete\",\n\t\t};\n\t\tthis.submitMapKeyMessage(op, previousValue);\n\n\t\treturn previousValue !== undefined;\n\t}\n\n\t/**\n\t * Clear all data from the map.\n\t */\n\tpublic clear(): void {\n\t\tconst copy = this.isAttached() ? new Map<string, ILocalValue>(this.data) : undefined;\n\n\t\t// Clear the data locally first.\n\t\tthis.clearCore(true);\n\n\t\t// Clear the pendingKeys immediately, the local unack'd operations are aborted\n\t\tthis.pendingKeys.clear();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst op: IMapClearOperation = {\n\t\t\ttype: \"clear\",\n\t\t};\n\t\tthis.submitMapClearMessage(op, copy);\n\t}\n\n\t/**\n\t * Serializes the data stored in the shared map to a JSON string\n\t * @param serializer - The serializer to use to serialize handles in its values.\n\t * @returns A JSON string containing serialized map data\n\t */\n\tpublic getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n\t\tconst serializableMapData: IMapDataObjectSerialized = {};\n\t\tfor (const [key, localValue] of this.data.entries()) {\n\t\t\tserializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n\t\t}\n\t\treturn serializableMapData;\n\t}\n\n\tpublic getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n\t\tconst serializableMapData: IMapDataObjectSerializable = {};\n\t\tfor (const [key, localValue] of this.data.entries()) {\n\t\t\tserializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n\t\t}\n\t\treturn serializableMapData;\n\t}\n\n\tpublic serialize(serializer: IFluidSerializer): string {\n\t\treturn JSON.stringify(this.getSerializableStorage(serializer));\n\t}\n\n\t/**\n\t * Populate the kernel with the given map data.\n\t * @param data - A JSON string containing serialized map data\n\t */\n\tpublic populateFromSerializable(json: IMapDataObjectSerializable): void {\n\t\tfor (const [key, serializable] of Object.entries(json)) {\n\t\t\tconst localValue = {\n\t\t\t\tkey,\n\t\t\t\tvalue: this.makeLocal(key, serializable),\n\t\t\t};\n\n\t\t\tthis.data.set(localValue.key, localValue.value);\n\t\t}\n\t}\n\n\tpublic populate(json: string): void {\n\t\tthis.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n\t}\n\n\t/**\n\t * Submit the given op if a handler is registered.\n\t * @param op - The operation to attempt to submit\n\t * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n\t * and not sent to the server. This will be sent back when this message is received back from the server. This is\n\t * also sent if we are asked to resubmit the message.\n\t * @returns True if the operation was submitted, false otherwise.\n\t */\n\tpublic trySubmitMessage(op: IMapOperation, localOpMetadata: unknown): boolean {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\thandler.submit(op, localOpMetadata as MapLocalOpMetadata);\n\t\treturn true;\n\t}\n\n\tpublic tryApplyStashedOp(op: IMapOperation): unknown {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler === undefined) {\n\t\t\tthrow new Error(\"no apply stashed op handler\");\n\t\t}\n\t\treturn handler.applyStashedOp(op);\n\t}\n\n\t/**\n\t * Process the given op if a handler is registered.\n\t * @param op - The message to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation was processed, false otherwise.\n\t */\n\tpublic tryProcessMessage(op: IMapOperation, local: boolean, localOpMetadata: unknown): boolean {\n\t\tconst handler = this.messageHandlers.get(op.type);\n\t\tif (handler === undefined) {\n\t\t\treturn false;\n\t\t}\n\t\thandler.process(op, local, localOpMetadata as MapLocalOpMetadata);\n\t\treturn true;\n\t}\n\n\t/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\n\t/**\n\t * Rollback a local op\n\t * @param op - The operation to rollback\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\tpublic rollback(op: any, localOpMetadata: unknown): void {\n\t\tif (!isMapLocalOpMetadata(localOpMetadata)) {\n\t\t\tthrow new Error(\"Invalid localOpMetadata\");\n\t\t}\n\n\t\tif (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n\t\t\tif (localOpMetadata.previousMap === undefined) {\n\t\t\t\tthrow new Error(\"Cannot rollback without previous map\");\n\t\t\t}\n\t\t\tfor (const [key, localValue] of localOpMetadata.previousMap.entries()) {\n\t\t\t\tthis.setCore(key, localValue, true);\n\t\t\t}\n\n\t\t\tconst lastPendingClearId = this.pendingClearMessageIds.pop();\n\t\t\tif (\n\t\t\t\tlastPendingClearId === undefined ||\n\t\t\t\tlastPendingClearId !== localOpMetadata.pendingMessageId\n\t\t\t) {\n\t\t\t\tthrow new Error(\"Rollback op does match last clear\");\n\t\t\t}\n\t\t} else if (op.type === \"delete\" || op.type === \"set\") {\n\t\t\tif (localOpMetadata.type === \"add\") {\n\t\t\t\tthis.deleteCore(op.key as string, true);\n\t\t\t} else if (\n\t\t\t\tlocalOpMetadata.type === \"edit\" &&\n\t\t\t\tlocalOpMetadata.previousValue !== undefined\n\t\t\t) {\n\t\t\t\tthis.setCore(op.key as string, localOpMetadata.previousValue, true);\n\t\t\t} else {\n\t\t\t\tthrow new Error(\"Cannot rollback without previous value\");\n\t\t\t}\n\n\t\t\tconst pendingMessageIds = this.pendingKeys.get(op.key as string);\n\t\t\tconst lastPendingMessageId = pendingMessageIds?.pop();\n\t\t\tif (!pendingMessageIds || lastPendingMessageId !== localOpMetadata.pendingMessageId) {\n\t\t\t\tthrow new Error(\"Rollback op does not match last pending\");\n\t\t\t}\n\t\t\tif (pendingMessageIds.length === 0) {\n\t\t\t\tthis.pendingKeys.delete(op.key as string);\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n\t/**\n\t * Set implementation used for both locally sourced sets as well as incoming remote sets.\n\t * @param key - The key being set\n\t * @param value - The value being set\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key, if any\n\t */\n\tprivate setCore(key: string, value: ILocalValue, local: boolean): ILocalValue | undefined {\n\t\tconst previousLocalValue = this.data.get(key);\n\t\tconst previousValue: unknown = previousLocalValue?.value;\n\t\tthis.data.set(key, value);\n\t\tthis.eventEmitter.emit(\"valueChanged\", { key, previousValue }, local, this.eventEmitter);\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate clearCore(local: boolean): void {\n\t\tthis.data.clear();\n\t\tthis.eventEmitter.emit(\"clear\", local, this.eventEmitter);\n\t}\n\n\t/**\n\t * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n\t * @param key - The key being deleted\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key if it existed, undefined if it did not exist\n\t */\n\tprivate deleteCore(key: string, local: boolean): ILocalValue | undefined {\n\t\tconst previousLocalValue = this.data.get(key);\n\t\tconst previousValue: unknown = previousLocalValue?.value;\n\t\tconst successfullyRemoved = this.data.delete(key);\n\t\tif (successfullyRemoved) {\n\t\t\tthis.eventEmitter.emit(\n\t\t\t\t\"valueChanged\",\n\t\t\t\t{ key, previousValue },\n\t\t\t\tlocal,\n\t\t\t\tthis.eventEmitter,\n\t\t\t);\n\t\t}\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n\t */\n\tprivate clearExceptPendingKeys(): void {\n\t\t// Assuming the pendingKeys is small and the map is large\n\t\t// we will get the value for the pendingKeys and clear the map\n\t\tconst temp = new Map<string, ILocalValue>();\n\t\tfor (const key of this.pendingKeys.keys()) {\n\t\t\t// Verify if the most recent pending operation is a delete op, no need to retain it if so.\n\t\t\t// This ensures the map size remains consistent.\n\t\t\tif (this.data.has(key)) {\n\t\t\t\ttemp.set(key, this.data.get(key) as ILocalValue);\n\t\t\t}\n\t\t}\n\t\tthis.clearCore(false);\n\t\tfor (const [key, value] of temp.entries()) {\n\t\t\tthis.setCore(key, value, true);\n\t\t}\n\t}\n\n\t/**\n\t * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n\t * have the information we need to create a real object, but will not be the real object yet. For example,\n\t * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n\t * job is to convert that information into a real object for local usage.\n\t * @param key - The key that the caller intends to store the local value into (used for ops later). But\n\t * doesn't actually store the local value into that key. So better not lie!\n\t * @param serializable - The remote information that we can convert into a real object\n\t * @returns The local value that was produced\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate makeLocal(key: string, serializable: ISerializableValue): ILocalValue {\n\t\tif (\n\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\tserializable.type === ValueType[ValueType.Shared]\n\t\t) {\n\t\t\treturn this.localValueMaker.fromSerializable(serializable);\n\t\t} else {\n\t\t\tthrow new Error(\"Unknown local value type\");\n\t\t}\n\t}\n\n\t/**\n\t * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n\t * not process the incoming operation.\n\t * @param op - Operation to check\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation should be processed, false otherwise\n\t */\n\tprivate needProcessKeyOperation(\n\t\top: IMapKeyOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: MapLocalOpMetadata,\n\t): boolean {\n\t\tif (this.pendingClearMessageIds.length > 0) {\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined &&\n\t\t\t\t\t\tisMapKeyLocalOpMetadata(localOpMetadata) &&\n\t\t\t\t\t\tlocalOpMetadata.pendingMessageId < this.pendingClearMessageIds[0],\n\t\t\t\t\t0x013 /* \"Received out of order op when there is an unackd clear message\" */,\n\t\t\t\t);\n\t\t\t}\n\t\t\t// If we have an unack'd clear, we can ignore all ops.\n\t\t\treturn false;\n\t\t}\n\n\t\tconst pendingKeyMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingKeyMessageIds !== undefined) {\n\t\t\t// Found an unack'd op. Clear it from the map if the pendingMessageId in the map matches this message's\n\t\t\t// and don't process the op.\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t0x014 /* pendingMessageId is missing from the local client's operation */,\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tpendingKeyMessageIds[0] === localOpMetadata.pendingMessageId,\n\t\t\t\t\t0x2fa /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tpendingKeyMessageIds.shift();\n\t\t\t\tif (pendingKeyMessageIds.length === 0) {\n\t\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// If we don't have a NACK op on the key, we need to process the remote ops.\n\t\treturn !local;\n\t}\n\n\t/**\n\t * Get the message handlers for the map.\n\t * @returns A map of string op names to IMapMessageHandlers for those ops\n\t */\n\tprivate getMessageHandlers(): Map<string, IMapMessageHandler> {\n\t\tconst messageHandlers = new Map<string, IMapMessageHandler>();\n\t\tmessageHandlers.set(\"clear\", {\n\t\t\tprocess: (op: IMapClearOperation, local, localOpMetadata) => {\n\t\t\t\tif (local) {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tisClearLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t\t0x015 /* \"pendingMessageId is missing from the local client's clear operation\" */,\n\t\t\t\t\t);\n\t\t\t\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingClearMessageId === localOpMetadata.pendingMessageId,\n\t\t\t\t\t\t0x2fb /* pendingMessageId does not match */,\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (this.pendingKeys.size > 0) {\n\t\t\t\t\tthis.clearExceptPendingKeys();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.clearCore(local);\n\t\t\t},\n\t\t\tsubmit: (op: IMapClearOperation, localOpMetadata: IMapClearLocalOpMetadata) => {\n\t\t\t\tassert(\n\t\t\t\t\tisClearLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t0x2fc /* Invalid localOpMetadata for clear */,\n\t\t\t\t);\n\t\t\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\t\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t\t\tassert(\n\t\t\t\t\tpendingClearMessageId === localOpMetadata.pendingMessageId,\n\t\t\t\t\t0x2fd /* pendingMessageId does not match */,\n\t\t\t\t);\n\t\t\t\tthis.submitMapClearMessage(op, localOpMetadata.previousMap);\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IMapClearOperation) => {\n\t\t\t\tconst copy = new Map<string, ILocalValue>(this.data);\n\t\t\t\tthis.clearCore(true);\n\t\t\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\t\t\treturn createClearLocalOpMetadata(op, this.getMapClearMessageId(), copy);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"delete\", {\n\t\t\tprocess: (op: IMapDeleteOperation, local, localOpMetadata) => {\n\t\t\t\tif (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.deleteCore(op.key, local);\n\t\t\t},\n\t\t\tsubmit: (op: IMapDeleteOperation, localOpMetadata: MapKeyLocalOpMetadata) => {\n\t\t\t\tthis.resubmitMapKeyMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IMapDeleteOperation) => {\n\t\t\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\t\t\tconst previousValue = this.deleteCore(op.key, true);\n\t\t\t\treturn createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);\n\t\t\t},\n\t\t});\n\t\tmessageHandlers.set(\"set\", {\n\t\t\tprocess: (op: IMapSetOperation, local, localOpMetadata) => {\n\t\t\t\tif (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// needProcessKeyOperation should have returned false if local is true\n\t\t\t\tconst context = this.makeLocal(op.key, op.value);\n\t\t\t\tthis.setCore(op.key, context, local);\n\t\t\t},\n\t\t\tsubmit: (op: IMapSetOperation, localOpMetadata: MapKeyLocalOpMetadata) => {\n\t\t\t\tthis.resubmitMapKeyMessage(op, localOpMetadata);\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IMapSetOperation) => {\n\t\t\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\t\t\tconst context = this.makeLocal(op.key, op.value);\n\t\t\t\tconst previousValue = this.setCore(op.key, context, true);\n\t\t\t\treturn createKeyLocalOpMetadata(op, this.getMapKeyMessageId(op), previousValue);\n\t\t\t},\n\t\t});\n\n\t\treturn messageHandlers;\n\t}\n\n\tprivate getMapClearMessageId(): number {\n\t\tconst pendingMessageId = ++this.pendingMessageId;\n\t\tthis.pendingClearMessageIds.push(pendingMessageId);\n\t\treturn pendingMessageId;\n\t}\n\n\t/**\n\t * Submit a clear message to remote clients.\n\t * @param op - The clear message\n\t */\n\tprivate submitMapClearMessage(\n\t\top: IMapClearOperation,\n\t\tpreviousMap?: Map<string, ILocalValue>,\n\t): void {\n\t\tconst metadata = createClearLocalOpMetadata(op, this.getMapClearMessageId(), previousMap);\n\t\tthis.submitMessage(op, metadata);\n\t}\n\n\tprivate getMapKeyMessageId(op: IMapKeyOperation): number {\n\t\tconst pendingMessageId = ++this.pendingMessageId;\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingMessageIds !== undefined) {\n\t\t\tpendingMessageIds.push(pendingMessageId);\n\t\t} else {\n\t\t\tthis.pendingKeys.set(op.key, [pendingMessageId]);\n\t\t}\n\t\treturn pendingMessageId;\n\t}\n\n\t/**\n\t * Submit a map key message to remote clients.\n\t * @param op - The map key message\n\t * @param previousValue - The value of the key before this op\n\t */\n\tprivate submitMapKeyMessage(op: IMapKeyOperation, previousValue?: ILocalValue): void {\n\t\tconst localMetadata = createKeyLocalOpMetadata(\n\t\t\top,\n\t\t\tthis.getMapKeyMessageId(op),\n\t\t\tpreviousValue,\n\t\t);\n\t\tthis.submitMessage(op, localMetadata);\n\t}\n\n\t/**\n\t * Submit a map key message to remote clients based on a previous submit.\n\t * @param op - The map key message\n\t * @param localOpMetadata - Metadata from the previous submit\n\t */\n\tprivate resubmitMapKeyMessage(op: IMapKeyOperation, localOpMetadata: MapLocalOpMetadata): void {\n\t\tassert(\n\t\t\tisMapKeyLocalOpMetadata(localOpMetadata),\n\t\t\t0x2fe /* Invalid localOpMetadata in submit */,\n\t\t);\n\n\t\t// no need to submit messages for op's that have been aborted\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingMessageIds === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst index = pendingMessageIds.findIndex((id) => id === localOpMetadata.pendingMessageId);\n\t\tif (index === -1) {\n\t\t\treturn;\n\t\t}\n\n\t\tpendingMessageIds.splice(index, 1);\n\t\tif (pendingMessageIds.length === 0) {\n\t\t\tthis.pendingKeys.delete(op.key);\n\t\t}\n\n\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\tconst pendingMessageId = this.getMapKeyMessageId(op);\n\t\tconst localMetadata =\n\t\t\tlocalOpMetadata.type === \"edit\"\n\t\t\t\t? { type: \"edit\", pendingMessageId, previousValue: localOpMetadata.previousValue }\n\t\t\t\t: { type: \"add\", pendingMessageId };\n\t\tthis.submitMessage(op, localMetadata);\n\t}\n}\n"]}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/map";
11
- exports.pkgVersion = "2.0.0-dev.7.3.0.210328";
12
- //# sourceMappingURL=packageVersion.js.map
11
+ exports.pkgVersion = "2.0.0-dev.7.3.0.212138";
12
+ //# sourceMappingURL=packageVersion.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.cjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,qBAAqB,CAAC;AAChC,QAAA,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/map\";\nexport const pkgVersion = \"2.0.0-dev.7.3.0.212138\";\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/map";
8
- export declare const pkgVersion = "2.0.0-dev.7.3.0.210328";
8
+ export declare const pkgVersion = "2.0.0-dev.7.3.0.212138";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.38.0"
8
+ "packageVersion": "7.38.3"
9
9
  }
10
10
  ]
11
11
  }
@@ -11,8 +11,8 @@ import { MessageType } from "@fluidframework/protocol-definitions";
11
11
  import { SharedObject, ValueType } from "@fluidframework/shared-object-base";
12
12
  import { SummaryTreeBuilder } from "@fluidframework/runtime-utils";
13
13
  import * as path from "path-browserify";
14
- import { LocalValueMaker, makeSerializable } from "./localValues";
15
- import { pkgVersion } from "./packageVersion";
14
+ import { LocalValueMaker, makeSerializable } from "./localValues.mjs";
15
+ import { pkgVersion } from "./packageVersion.mjs";
16
16
  // We use path-browserify since this code can run safely on the server or the browser.
17
17
  // We standardize on using posix slashes everywhere.
18
18
  const posix = path.posix;
@@ -1735,4 +1735,4 @@ class SubDirectory extends TypedEventEmitter {
1735
1735
  }
1736
1736
  }
1737
1737
  }
1738
- //# sourceMappingURL=directory.js.map
1738
+ //# sourceMappingURL=directory.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.mjs","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAAA;;;GAGG;;OAEI,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAC5C,EAAE,iBAAiB,EAAE,MAAM,8BAA8B;OACzD,EAAE,UAAU,EAAE,MAAM,iCAAiC;OACrD,EAAE,YAAY,EAAE,MAAM,8BAA8B;OACpD,EAA6B,WAAW,EAAE,MAAM,sCAAsC;OAStF,EAAoB,YAAY,EAAE,SAAS,EAAE,MAAM,oCAAoC;OACvF,EAAE,kBAAkB,EAAE,MAAM,+BAA+B;OAC3D,KAAK,IAAI,MAAM,iBAAiB;OAYhC,EAAe,eAAe,EAAE,gBAAgB,EAAE;OAClD,EAAE,UAAU,EAAE;AAErB,sFAAsF;AACtF,oDAAoD;AACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AAEzB,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AA8OlC;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IAe5B;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,gBAAgB,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,gBAAgB,CAAC,UAAU,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,SAAS,GAAG,IA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AC;SAC3C;QACD,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,EAAE;YAC5C,SAAS,CAAC,OAAO,EAAE,CAAC;SACpB;IACF,CAAC;IAEO,wBAAwB,CAAC,SAAuB;QACvD,qHAAqH;QACrH,yEAAyE;QACzE,SAAS,CAAC,SAAS,EAAE,CAAC;QACtB,KAAK,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,IAAI,SAAS,CAAC,cAAc,EAAE,EAAE;YAC3D,IAAI,CAAC,wBAAwB,CAAC,YAA4B,CAAC,CAAC;SAC5D;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelServices,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\nimport { IFluidSerializer, SharedObject, ValueType } from \"@fluidframework/shared-object-base\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport * as path from \"path-browserify\";\nimport {\n\tIDirectory,\n\tIDirectoryEvents,\n\tIDirectoryValueChanged,\n\t// eslint-disable-next-line import/no-deprecated\n\tISerializableValue,\n\tISerializedValue,\n\tISharedDirectory,\n\tISharedDirectoryEvents,\n\tIValueChanged,\n} from \"./interfaces\";\nimport { ILocalValue, LocalValueMaker, makeSerializable } from \"./localValues\";\nimport { pkgVersion } from \"./packageVersion\";\n\n// We use path-browserify since this code can run safely on the server or the browser.\n// We standardize on using posix slashes everywhere.\nconst posix = path.posix;\n\nconst snapshotFileName = \"header\";\n\n/**\n * Defines the means to process and submit a given op on a directory.\n */\ninterface IDirectoryMessageHandler {\n\t/**\n\t * Apply the given operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The directory operation to apply\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void;\n\n\t/**\n\t * Communicate the operation to remote clients.\n\t * @param op - The directory operation to submit\n\t * @param localOpMetadata - The metadata to be submitted with the message.\n\t */\n\tsubmit(op: IDirectoryOperation, localOpMetadata: unknown): void;\n\n\tapplyStashedOp(op: IDirectoryOperation): unknown;\n}\n\n/**\n * Operation indicating a value should be set for a key.\n *\n * @public\n */\nexport interface IDirectorySetOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"set\";\n\n\t/**\n\t * Directory key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Absolute path of the directory where the modified key is located.\n\t */\n\tpath: string;\n\n\t/**\n\t * Value to be set on the key.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tvalue: ISerializableValue;\n}\n\n/**\n * Operation indicating a key should be deleted from the directory.\n *\n * @public\n */\nexport interface IDirectoryDeleteOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"delete\";\n\n\t/**\n\t * Directory key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Absolute path of the directory where the modified key is located.\n\t */\n\tpath: string;\n}\n\n/**\n * An operation on a specific key within a directory.\n *\n * @public\n */\nexport type IDirectoryKeyOperation = IDirectorySetOperation | IDirectoryDeleteOperation;\n\n/**\n * Operation indicating the directory should be cleared.\n *\n * @public\n */\nexport interface IDirectoryClearOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"clear\";\n\n\t/**\n\t * Absolute path of the directory being cleared.\n\t */\n\tpath: string;\n}\n\n/**\n * An operation on one or more of the keys within a directory.\n *\n * @public\n */\nexport type IDirectoryStorageOperation = IDirectoryKeyOperation | IDirectoryClearOperation;\n\n/**\n * Operation indicating a subdirectory should be created.\n *\n * @public\n */\nexport interface IDirectoryCreateSubDirectoryOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"createSubDirectory\";\n\n\t/**\n\t * Absolute path of the directory that will contain the new subdirectory.\n\t */\n\tpath: string;\n\n\t/**\n\t * Name of the new subdirectory.\n\t */\n\tsubdirName: string;\n}\n\n/**\n * Operation indicating a subdirectory should be deleted.\n *\n * @public\n */\nexport interface IDirectoryDeleteSubDirectoryOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"deleteSubDirectory\";\n\n\t/**\n\t * Absolute path of the directory that contains the directory to be deleted.\n\t */\n\tpath: string;\n\n\t/**\n\t * Name of the subdirectory to be deleted.\n\t */\n\tsubdirName: string;\n}\n\n/**\n * An operation on the subdirectories within a directory.\n *\n * @public\n */\nexport type IDirectorySubDirectoryOperation =\n\t| IDirectoryCreateSubDirectoryOperation\n\t| IDirectoryDeleteSubDirectoryOperation;\n\n/**\n * Any operation on a directory.\n *\n * @public\n */\nexport type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDirectoryOperation;\n\n/**\n * Create info for the subdirectory.\n *\n * @public\n */\nexport interface ICreateInfo {\n\t/**\n\t * Sequence number at which this subdirectory was created.\n\t */\n\tcsn: number;\n\n\t/**\n\t * clientids of the clients which created this sub directory.\n\t */\n\tccIds: string[];\n}\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n *\n * @remarks Directly used in\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify\n * | JSON.stringify}, direct result from\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.\n *\n * @public\n */\nexport interface IDirectoryDataObject {\n\t/**\n\t * Key/value date set by the user.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tstorage?: { [key: string]: ISerializableValue };\n\n\t/**\n\t * Recursive sub-directories {@link IDirectoryDataObject | objects}.\n\t */\n\tsubdirectories?: { [subdirName: string]: IDirectoryDataObject };\n\n\t/**\n\t * Create info for the sub directory. Since directories with same name can get deleted/created by multiple clients\n\t * asynchronously, this info helps us to determine whether the ops where for the current instance of sub directory\n\t * or not and whether to process them or not based on that. Summaries which were not produced which this change\n\t * will not have this info and in that case we can still run in eventual consistency issues but that is no worse\n\t * than the state before this change.\n\t */\n\tci?: ICreateInfo;\n}\n\n/**\n * {@link IDirectory} storage format.\n *\n * @internal\n */\nexport interface IDirectoryNewStorageFormat {\n\t/**\n\t * Blob IDs representing larger directory data that was serialized.\n\t */\n\tblobs: string[];\n\n\t/**\n\t * Storage content representing directory data that was not serialized.\n\t */\n\tcontent: IDirectoryDataObject;\n}\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedDirectory}.\n *\n * @sealed\n * @public\n */\nexport class DirectoryFactory implements IChannelFactory {\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/directory\";\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: DirectoryFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn DirectoryFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn DirectoryFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<ISharedDirectory> {\n\t\tconst directory = new SharedDirectory(id, runtime, attributes);\n\t\tawait directory.load(services);\n\n\t\treturn directory;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): ISharedDirectory {\n\t\tconst directory = new SharedDirectory(id, runtime, DirectoryFactory.Attributes);\n\t\tdirectory.initializeLocal();\n\n\t\treturn directory;\n\t}\n}\n\n/**\n * {@inheritDoc ISharedDirectory}\n *\n * @example\n *\n * ```typescript\n * mySharedDirectory.createSubDirectory(\"a\").createSubDirectory(\"b\").createSubDirectory(\"c\").set(\"foo\", val1);\n * const mySubDir = mySharedDirectory.getWorkingDirectory(\"/a/b/c\");\n * mySubDir.get(\"foo\"); // returns val1\n * ```\n *\n * @sealed\n * @public\n */\nexport class SharedDirectory\n\textends SharedObject<ISharedDirectoryEvents>\n\timplements ISharedDirectory\n{\n\t/**\n\t * Create a new shared directory\n\t *\n\t * @param runtime - Data store runtime the new shared directory belongs to\n\t * @param id - Optional name of the shared directory\n\t * @returns Newly create shared directory (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedDirectory {\n\t\treturn runtime.createChannel(id, DirectoryFactory.Type) as SharedDirectory;\n\t}\n\n\t/**\n\t * Get a factory for SharedDirectory to register with the data store.\n\t *\n\t * @returns A factory that creates and load SharedDirectory\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new DirectoryFactory();\n\t}\n\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic [Symbol.toStringTag]: string = \"SharedDirectory\";\n\n\t/**\n\t * {@inheritDoc IDirectory.absolutePath}\n\t */\n\tpublic get absolutePath(): string {\n\t\treturn this.root.absolutePath;\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic readonly localValueMaker: LocalValueMaker;\n\n\t/**\n\t * Root of the SharedDirectory, most operations on the SharedDirectory itself act on the root.\n\t */\n\tprivate readonly root: SubDirectory = new SubDirectory(\n\t\t0,\n\t\tnew Set(),\n\t\tthis,\n\t\tthis.runtime,\n\t\tthis.serializer,\n\t\tposix.sep,\n\t);\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandlers: Map<string, IDirectoryMessageHandler> = new Map();\n\n\t/**\n\t * Constructs a new shared directory. If the object is non-local an id and service interfaces will\n\t * be provided.\n\t * @param id - String identifier for the SharedDirectory\n\t * @param runtime - Data store runtime\n\t * @param type - Type identifier\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_directory_\");\n\t\tthis.localValueMaker = new LocalValueMaker(this.serializer);\n\t\tthis.setMessageHandlers();\n\t\t// Mirror the containedValueChanged op on the SharedDirectory\n\t\tthis.root.on(\"containedValueChanged\", (changed: IValueChanged, local: boolean) => {\n\t\t\tthis.emit(\"containedValueChanged\", changed, local, this);\n\t\t});\n\t\tthis.root.on(\"subDirectoryCreated\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryCreated\", relativePath, local, this);\n\t\t});\n\t\tthis.root.on(\"subDirectoryDeleted\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryDeleted\", relativePath, local, this);\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.get}\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic get<T = any>(key: string): T | undefined {\n\t\treturn this.root.get<T>(key);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.set}\n\t */\n\tpublic set<T = unknown>(key: string, value: T): this {\n\t\tthis.root.set(key, value);\n\t\treturn this;\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tthis.root.dispose(error);\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this.root.disposed;\n\t}\n\n\t/**\n\t * Deletes the given key from within this IDirectory.\n\t * @param key - The key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\treturn this.root.delete(key);\n\t}\n\n\t/**\n\t * Deletes all keys from within this IDirectory.\n\t */\n\tpublic clear(): void {\n\t\tthis.root.clear();\n\t}\n\n\t/**\n\t * Checks whether the given key exists in this IDirectory.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.root.has(key);\n\t}\n\n\t/**\n\t * The number of entries under this IDirectory.\n\t */\n\tpublic get size(): number {\n\t\treturn this.root.size;\n\t}\n\n\t/**\n\t * Issue a callback on each entry under this IDirectory.\n\t * @param callback - Callback to issue\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void {\n\t\t// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-callback-reference\n\t\tthis.root.forEach(callback);\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\n\t\treturn this.root[Symbol.iterator]();\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic entries(): IterableIterator<[string, any]> {\n\t\treturn this.root.entries();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.countSubDirectory}\n\t */\n\tpublic countSubDirectory(): number {\n\t\treturn this.root.countSubDirectory();\n\t}\n\n\t/**\n\t * Get an iterator over the keys under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.root.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic values(): IterableIterator<any> {\n\t\treturn this.root.values();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.createSubDirectory}\n\t */\n\tpublic createSubDirectory(subdirName: string): IDirectory {\n\t\treturn this.root.createSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getSubDirectory}\n\t */\n\tpublic getSubDirectory(subdirName: string): IDirectory | undefined {\n\t\treturn this.root.getSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.hasSubDirectory}\n\t */\n\tpublic hasSubDirectory(subdirName: string): boolean {\n\t\treturn this.root.hasSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.deleteSubDirectory}\n\t */\n\tpublic deleteSubDirectory(subdirName: string): boolean {\n\t\treturn this.root.deleteSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.subdirectories}\n\t */\n\tpublic subdirectories(): IterableIterator<[string, IDirectory]> {\n\t\treturn this.root.subdirectories();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getWorkingDirectory}\n\t */\n\tpublic getWorkingDirectory(relativePath: string): IDirectory | undefined {\n\t\tconst absolutePath = this.makeAbsolute(relativePath);\n\t\tif (absolutePath === posix.sep) {\n\t\t\treturn this.root;\n\t\t}\n\n\t\tlet currentSubDir = this.root;\n\t\tconst subdirs = absolutePath.slice(1).split(posix.sep);\n\t\tfor (const subdir of subdirs) {\n\t\t\tcurrentSubDir = currentSubDir.getSubDirectory(subdir) as SubDirectory;\n\t\t\tif (!currentSubDir) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\treturn currentSubDir;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t * @internal\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\treturn this.serializeDirectory(this.root, serializer);\n\t}\n\n\t/**\n\t * Submits an operation\n\t * @param op - Op to submit\n\t * @param localOpMetadata - The local metadata associated with the op. We send a unique id that is used to track\n\t * this op while it has not been ack'd. This will be sent when we receive this op back from the server.\n\t * @internal\n\t */\n\tpublic submitDirectoryMessage(op: IDirectoryOperation, localOpMetadata: unknown): void {\n\t\tthis.submitLocalMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t * @internal\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t * @internal\n\t */\n\tprotected reSubmitCore(content: unknown, localOpMetadata: unknown): void {\n\t\tconst message = content as IDirectoryOperation;\n\t\tconst handler = this.messageHandlers.get(message.type);\n\t\tassert(handler !== undefined, 0x00d /* Missing message handler for message type */);\n\t\thandler.submit(message, localOpMetadata);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t * @internal\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst data = await readAndParse(storage, snapshotFileName);\n\t\tconst newFormat = data as IDirectoryNewStorageFormat;\n\t\tif (Array.isArray(newFormat.blobs)) {\n\t\t\t// New storage format\n\t\t\tthis.populate(newFormat.content);\n\t\t\tawait Promise.all(\n\t\t\t\tnewFormat.blobs.map(async (value) => {\n\t\t\t\t\tconst dataExtra = await readAndParse(storage, value);\n\t\t\t\t\tthis.populate(dataExtra as IDirectoryDataObject);\n\t\t\t\t}),\n\t\t\t);\n\t\t} else {\n\t\t\t// Old storage format\n\t\t\tthis.populate(data as IDirectoryDataObject);\n\t\t}\n\t}\n\n\t/**\n\t * Populate the directory with the given directory data.\n\t * @param data - A JSON string containing serialized directory data\n\t * @internal\n\t */\n\tprotected populate(data: IDirectoryDataObject): void {\n\t\tconst stack: [SubDirectory, IDirectoryDataObject][] = [];\n\t\tstack.push([this.root, data]);\n\t\twhile (stack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst [currentSubDir, currentSubDirObject] = stack.pop()!;\n\t\t\tif (currentSubDirObject.subdirectories) {\n\t\t\t\tfor (const [subdirName, subdirObject] of Object.entries(\n\t\t\t\t\tcurrentSubDirObject.subdirectories,\n\t\t\t\t)) {\n\t\t\t\t\tlet newSubDir = currentSubDir.getSubDirectory(subdirName) as SubDirectory;\n\t\t\t\t\tif (!newSubDir) {\n\t\t\t\t\t\tconst createInfo = subdirObject.ci;\n\t\t\t\t\t\tnewSubDir = new SubDirectory(\n\t\t\t\t\t\t\t// If csn is -1, then initialize it with 0, otherwise we will never process ops for this\n\t\t\t\t\t\t\t// sub directory. This could be done at serialization time too, but we need to maintain\n\t\t\t\t\t\t\t// back compat too and also we will actually know the state when it was serialized.\n\t\t\t\t\t\t\tcreateInfo !== undefined && createInfo.csn > -1 ? createInfo.csn : 0,\n\t\t\t\t\t\t\tcreateInfo !== undefined\n\t\t\t\t\t\t\t\t? new Set<string>(createInfo.ccIds)\n\t\t\t\t\t\t\t\t: new Set(),\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\tthis.runtime,\n\t\t\t\t\t\t\tthis.serializer,\n\t\t\t\t\t\t\tposix.join(currentSubDir.absolutePath, subdirName),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcurrentSubDir.populateSubDirectory(subdirName, newSubDir);\n\t\t\t\t\t}\n\t\t\t\t\tstack.push([newSubDir, subdirObject]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentSubDirObject.storage) {\n\t\t\t\tfor (const [key, serializable] of Object.entries(currentSubDirObject.storage)) {\n\t\t\t\t\tconst localValue = this.makeLocal(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tcurrentSubDir.absolutePath,\n\t\t\t\t\t\tserializable,\n\t\t\t\t\t);\n\t\t\t\t\tcurrentSubDir.populateStorage(key, localValue);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t * @internal\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op: IDirectoryOperation = message.contents as IDirectoryOperation;\n\t\t\tconst handler = this.messageHandlers.get(op.type);\n\t\t\tassert(handler !== undefined, 0x00e /* Missing message handler for message type */);\n\t\t\thandler.process(message, op, local, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n\t * @internal\n\t */\n\tprotected rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tconst op: IDirectoryOperation = content as IDirectoryOperation;\n\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\tif (subdir) {\n\t\t\tsubdir.rollback(op, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * Converts the given relative path to absolute against the root.\n\t * @param relativePath - The path to convert\n\t */\n\tprivate makeAbsolute(relativePath: string): string {\n\t\treturn posix.resolve(posix.sep, relativePath);\n\t}\n\n\t/**\n\t * The remote ISerializableValue we're receiving (either as a result of a snapshot load or an incoming set op)\n\t * will have the information we need to create a real object, but will not be the real object yet. For example,\n\t * we might know it's a map and the ID but not have the actual map or its data yet. makeLocal's job\n\t * is to convert that information into a real object for local usage.\n\t * @param key - Key of element being converted\n\t * @param absolutePath - Path of element being converted\n\t * @param serializable - The remote information that we can convert into a real object\n\t * @returns The local value that was produced\n\t */\n\tprivate makeLocal(\n\t\tkey: string,\n\t\tabsolutePath: string,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tserializable: ISerializableValue,\n\t): ILocalValue {\n\t\tassert(\n\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\t\tserializable.type === ValueType[ValueType.Shared],\n\t\t\t0x1e4 /* \"Unexpected serializable type\" */,\n\t\t);\n\t\treturn this.localValueMaker.fromSerializable(serializable);\n\t}\n\n\t/**\n\t * This checks if there is pending delete op for local delete for a any subdir in the relative path.\n\t * @param relativePath - path of sub directory.\n\t * @returns `true` if there is pending delete, `false` otherwise.\n\t */\n\tprivate isSubDirectoryDeletePending(relativePath: string): boolean {\n\t\tconst absolutePath = this.makeAbsolute(relativePath);\n\t\tif (absolutePath === posix.sep) {\n\t\t\treturn false;\n\t\t}\n\t\tlet currentParent = this.root;\n\t\tconst nodeList = absolutePath.split(posix.sep);\n\t\tlet start = 1;\n\t\twhile (start < nodeList.length) {\n\t\t\tconst subDirName = nodeList[start];\n\t\t\tif (currentParent.isSubDirectoryDeletePending(subDirName)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tcurrentParent = currentParent.getSubDirectory(subDirName) as SubDirectory;\n\t\t\tif (currentParent === undefined) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tstart += 1;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Set the message handlers for the directory.\n\t */\n\tprivate setMessageHandlers(): void {\n\t\tthis.messageHandlers.set(\"clear\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryClearOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tsubdir.processClearMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryClearOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitClearMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IDirectoryClearOperation): IClearLocalOpMetadata | undefined => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\treturn subdir.applyStashedClearMessage(op);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tthis.messageHandlers.set(\"delete\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryDeleteOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tsubdir.processDeleteMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryDeleteOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitKeyMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (\n\t\t\t\top: IDirectoryDeleteOperation,\n\t\t\t): IKeyEditLocalOpMetadata | undefined => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\treturn subdir.applyStashedDeleteMessage(op);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tthis.messageHandlers.set(\"set\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectorySetOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tconst context = local ? undefined : this.makeLocal(op.key, op.path, op.value);\n\t\t\t\t\tsubdir.processSetMessage(msg, op, context, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectorySetOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitKeyMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IDirectorySetOperation): IKeyEditLocalOpMetadata | undefined => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tconst context = this.makeLocal(op.key, op.path, op.value);\n\t\t\t\t\treturn subdir.applyStashedSetMessage(op, context);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tthis.messageHandlers.set(\"createSubDirectory\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (parentSubdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tparentSubdir.processCreateSubDirectoryMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryCreateSubDirectoryOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\t// We don't reuse the metadata but send a new one on each submit.\n\t\t\t\t\tparentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (\n\t\t\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\t\t): ICreateSubDirLocalOpMetadata | undefined => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\treturn parentSubdir.applyStashedCreateSubDirMessage(op);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tthis.messageHandlers.set(\"deleteSubDirectory\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (parentSubdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tparentSubdir.processDeleteSubDirectoryMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryDeleteSubDirectoryOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\t// We don't reuse the metadata but send a new one on each submit.\n\t\t\t\t\tparentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (\n\t\t\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\t\t): IDeleteSubDirLocalOpMetadata | undefined => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\treturn parentSubdir.applyStashedDeleteSubDirMessage(op);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t * @internal\n\t */\n\tprotected applyStashedOp(op: unknown): unknown {\n\t\tconst handler = this.messageHandlers.get((op as IDirectoryOperation).type);\n\t\tif (handler === undefined) {\n\t\t\tthrow new Error(\"no apply stashed op handler\");\n\t\t}\n\t\treturn handler.applyStashedOp(op as IDirectoryOperation);\n\t}\n\n\tprivate serializeDirectory(\n\t\troot: SubDirectory,\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tlet counter = 0;\n\t\tconst blobs: string[] = [];\n\n\t\tconst stack: [SubDirectory, IDirectoryDataObject][] = [];\n\t\tconst content: IDirectoryDataObject = {};\n\t\tstack.push([root, content]);\n\n\t\twhile (stack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst [currentSubDir, currentSubDirObject] = stack.pop()!;\n\t\t\tcurrentSubDirObject.ci = currentSubDir.getSerializableCreateInfo();\n\t\t\tfor (const [key, value] of currentSubDir.getSerializedStorage(serializer)) {\n\t\t\t\tif (!currentSubDirObject.storage) {\n\t\t\t\t\tcurrentSubDirObject.storage = {};\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\tconst result: ISerializableValue = {\n\t\t\t\t\ttype: value.type,\n\t\t\t\t\tvalue: value.value && (JSON.parse(value.value) as object),\n\t\t\t\t};\n\t\t\t\tif (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n\t\t\t\t\tconst extraContent: IDirectoryDataObject = {};\n\t\t\t\t\tlet largeContent = extraContent;\n\t\t\t\t\tif (currentSubDir.absolutePath !== posix.sep) {\n\t\t\t\t\t\tfor (const dir of currentSubDir.absolutePath.slice(1).split(posix.sep)) {\n\t\t\t\t\t\t\tconst subDataObject: IDirectoryDataObject = {};\n\t\t\t\t\t\t\tlargeContent.subdirectories = { [dir]: subDataObject };\n\t\t\t\t\t\t\tlargeContent = subDataObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlargeContent.storage = { [key]: result };\n\t\t\t\t\tconst blobName = `blob${counter}`;\n\t\t\t\t\tcounter++;\n\t\t\t\t\tblobs.push(blobName);\n\t\t\t\t\tbuilder.addBlob(blobName, JSON.stringify(extraContent));\n\t\t\t\t} else {\n\t\t\t\t\tcurrentSubDirObject.storage[key] = result;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [subdirName, subdir] of currentSubDir.subdirectories()) {\n\t\t\t\tif (!currentSubDirObject.subdirectories) {\n\t\t\t\t\tcurrentSubDirObject.subdirectories = {};\n\t\t\t\t}\n\t\t\t\tconst subDataObject: IDirectoryDataObject = {};\n\t\t\t\tcurrentSubDirObject.subdirectories[subdirName] = subDataObject;\n\t\t\t\tstack.push([subdir as SubDirectory, subDataObject]);\n\t\t\t}\n\t\t}\n\n\t\tconst newFormat: IDirectoryNewStorageFormat = {\n\t\t\tblobs,\n\t\t\tcontent,\n\t\t};\n\t\tbuilder.addBlob(snapshotFileName, JSON.stringify(newFormat));\n\n\t\treturn builder.getSummaryTree();\n\t}\n}\n\ninterface IKeyEditLocalOpMetadata {\n\ttype: \"edit\";\n\tpendingMessageId: number;\n\tpreviousValue: ILocalValue | undefined;\n}\n\ninterface IClearLocalOpMetadata {\n\ttype: \"clear\";\n\tpendingMessageId: number;\n\tpreviousStorage: Map<string, ILocalValue>;\n}\n\ninterface ICreateSubDirLocalOpMetadata {\n\ttype: \"createSubDir\";\n}\n\ninterface IDeleteSubDirLocalOpMetadata {\n\ttype: \"deleteSubDir\";\n\tsubDirectory: SubDirectory | undefined;\n}\n\ntype SubDirLocalOpMetadata = ICreateSubDirLocalOpMetadata | IDeleteSubDirLocalOpMetadata;\ntype DirectoryLocalOpMetadata =\n\t| IClearLocalOpMetadata\n\t| IKeyEditLocalOpMetadata\n\t| SubDirLocalOpMetadata;\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction isKeyEditLocalOpMetadata(metadata: any): metadata is IKeyEditLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\tmetadata.type === \"edit\"\n\t);\n}\n\nfunction isClearLocalOpMetadata(metadata: any): metadata is IClearLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\tmetadata.type === \"clear\" &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\ttypeof metadata.previousStorage === \"object\"\n\t);\n}\n\nfunction isSubDirLocalOpMetadata(metadata: any): metadata is SubDirLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\t(metadata.type === \"createSubDir\" || metadata.type === \"deleteSubDir\")\n\t);\n}\n\nfunction isDirectoryLocalOpMetadata(metadata: any): metadata is DirectoryLocalOpMetadata {\n\treturn (\n\t\tisKeyEditLocalOpMetadata(metadata) ||\n\t\tisClearLocalOpMetadata(metadata) ||\n\t\tisSubDirLocalOpMetadata(metadata)\n\t);\n}\n\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction assertNonNullClientId(clientId: string | null): asserts clientId is string {\n\tassert(clientId !== null, 0x6af /* client id should never be null */);\n}\n\n/**\n * Node of the directory tree.\n * @sealed\n */\nclass SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirectory {\n\t/**\n\t * Tells if the sub directory is deleted or not.\n\t */\n\tprivate _deleted = false;\n\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic [Symbol.toStringTag]: string = \"SubDirectory\";\n\n\t/**\n\t * The in-memory data the directory is storing.\n\t */\n\tprivate readonly _storage: Map<string, ILocalValue> = new Map();\n\n\t/**\n\t * The subdirectories the directory is holding.\n\t */\n\tprivate readonly _subdirectories: Map<string, SubDirectory> = new Map();\n\n\t/**\n\t * Keys that have been modified locally but not yet ack'd from the server. This is for operations on keys like\n\t * set/delete operations on keys. The value of this map is list of pendingMessageIds at which that key\n\t * was modified. We don't store the type of ops, and behaviour of key ops are different from behaviour of sub\n\t * directory ops, so we have separate map from subDirectories tracker.\n\t */\n\tprivate readonly pendingKeys: Map<string, number[]> = new Map();\n\n\t/**\n\t * Subdirectories that have been deleted locally but not yet ack'd from the server. This maintains the record\n\t * of delete op that are pending or yet to be acked from server. This is maintained just to track the locally\n\t * deleted sub directory.\n\t */\n\tprivate readonly pendingDeleteSubDirectoriesTracker: Map<string, number> = new Map();\n\n\t/**\n\t * Subdirectories that have been created locally but not yet ack'd from the server. This maintains the record\n\t * of create op that are pending or yet to be acked from server. This is maintained just to track the locally\n\t * created sub directory.\n\t */\n\tprivate readonly pendingCreateSubDirectoriesTracker: Map<string, number> = new Map();\n\n\t/**\n\t * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.\n\t */\n\tprivate pendingMessageId: number = -1;\n\n\t/**\n\t * The pending ids of any clears that have been performed locally but not yet ack'd from the server\n\t */\n\tprivate readonly pendingClearMessageIds: number[] = [];\n\n\t/**\n\t * Constructor.\n\t * @param sequenceNumber - Message seq number at which this was created.\n\t * @param clientIds - Ids of client which created this directory.\n\t * @param directory - Reference back to the SharedDirectory to perform operations\n\t * @param runtime - The data store runtime this directory is associated with\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param absolutePath - The absolute path of this IDirectory\n\t */\n\tpublic constructor(\n\t\tprivate sequenceNumber: number,\n\t\tprivate readonly clientIds: Set<string>,\n\t\tprivate readonly directory: SharedDirectory,\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tpublic readonly absolutePath: string,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tthis._deleted = true;\n\t\tthis.emit(\"disposed\", this);\n\t}\n\n\t/**\n\t * Unmark the deleted property only when rolling back delete.\n\t */\n\tprivate undispose(): void {\n\t\tthis._deleted = false;\n\t\tthis.emit(\"undisposed\", this);\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._deleted;\n\t}\n\n\tprivate throwIfDisposed(): void {\n\t\tif (this._deleted) {\n\t\t\tthrow new UsageError(\"Cannot access Disposed subDirectory\");\n\t\t}\n\t}\n\n\t/**\n\t * Checks whether the given key exists in this IDirectory.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.has(key);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.get}\n\t */\n\tpublic get<T = unknown>(key: string): T | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.get(key)?.value as T | undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.set}\n\t */\n\tpublic set<T = unknown>(key: string, value: T): this {\n\t\tthis.throwIfDisposed();\n\t\t// Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (key === undefined || key === null) {\n\t\t\tthrow new Error(\"Undefined and null keys are not supported\");\n\t\t}\n\n\t\t// Create a local value and serialize it.\n\t\tconst localValue = this.directory.localValueMaker.fromInMemory(value);\n\t\tconst serializableValue = makeSerializable(\n\t\t\tlocalValue,\n\t\t\tthis.serializer,\n\t\t\tthis.directory.handle,\n\t\t);\n\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(key, localValue, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst op: IDirectorySetOperation = {\n\t\t\tkey,\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"set\",\n\t\t\tvalue: serializableValue,\n\t\t};\n\t\tthis.submitKeyMessage(op, previousValue);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.countSubDirectory}\n\t */\n\tpublic countSubDirectory(): number {\n\t\treturn this._subdirectories.size;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.createSubDirectory}\n\t */\n\tpublic createSubDirectory(subdirName: string): IDirectory {\n\t\tthis.throwIfDisposed();\n\t\t// Undefined/null subdirectory names can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (subdirName === undefined || subdirName === null) {\n\t\t\tthrow new Error(\"SubDirectory name may not be undefined or null\");\n\t\t}\n\n\t\tif (subdirName.includes(posix.sep)) {\n\t\t\tthrow new Error(`SubDirectory name may not contain ${posix.sep}`);\n\t\t}\n\n\t\t// Create the sub directory locally first.\n\t\tconst isNew = this.createSubDirectoryCore(\n\t\t\tsubdirName,\n\t\t\ttrue,\n\t\t\tthis.getLocalSeq(),\n\t\t\tthis.runtime.clientId ?? \"detached\",\n\t\t);\n\t\tconst subDir = this._subdirectories.get(subdirName);\n\t\tassert(subDir !== undefined, 0x5aa /* subdirectory should exist after creation */);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn subDir;\n\t\t}\n\n\t\t// Only submit the op, if it is newly created.\n\t\tif (isNew) {\n\t\t\tconst op: IDirectoryCreateSubDirectoryOperation = {\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tsubdirName,\n\t\t\t\ttype: \"createSubDirectory\",\n\t\t\t};\n\t\t\tthis.submitCreateSubDirectoryMessage(op);\n\t\t}\n\n\t\treturn subDir;\n\t}\n\n\t/**\n\t * @returns A sequenceNumber which should be used for local changes.\n\t * @remarks While detached, 0 is used rather than -1 to represent a change which should be universally known (as opposed to known\n\t * only by the local client). This ensures that if the directory is later attached, none of its data needs to be updated (the values\n\t * last set while detached will now be known to any new client, until they are changed).\n\t * TODO: Convert these conventions to named constants. The semantics used here match those for merge-tree.\n\t */\n\tprivate getLocalSeq(): number {\n\t\treturn this.directory.isAttached() ? -1 : 0;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getSubDirectory}\n\t */\n\tpublic getSubDirectory(subdirName: string): IDirectory | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.get(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.hasSubDirectory}\n\t */\n\tpublic hasSubDirectory(subdirName: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.has(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.deleteSubDirectory}\n\t */\n\tpublic deleteSubDirectory(subdirName: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\t// Delete the sub directory locally first.\n\t\tconst subDir = this.deleteSubDirectoryCore(subdirName, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn subDir !== undefined;\n\t\t}\n\n\t\t// Only submit the op, if the directory existed and we deleted it.\n\t\tif (subDir !== undefined) {\n\t\t\tconst op: IDirectoryDeleteSubDirectoryOperation = {\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tsubdirName,\n\t\t\t\ttype: \"deleteSubDirectory\",\n\t\t\t};\n\n\t\t\tthis.submitDeleteSubDirectoryMessage(op, subDir);\n\t\t}\n\t\treturn subDir !== undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.subdirectories}\n\t */\n\tpublic subdirectories(): IterableIterator<[string, IDirectory]> {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.entries();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getWorkingDirectory}\n\t */\n\tpublic getWorkingDirectory(relativePath: string): IDirectory | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this.directory.getWorkingDirectory(this.makeAbsolute(relativePath));\n\t}\n\n\t/**\n\t * This checks if there is pending delete op for local delete for a given child subdirectory.\n\t * @param subDirName - directory name.\n\t * @returns true if there is pending delete.\n\t */\n\tpublic isSubDirectoryDeletePending(subDirName: string): boolean {\n\t\tif (this.pendingDeleteSubDirectoriesTracker.has(subDirName)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Deletes the given key from within this IDirectory.\n\t * @param key - The key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\t// Delete the key locally first.\n\t\tconst previousValue = this.deleteCore(key, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn previousValue !== undefined;\n\t\t}\n\n\t\tconst op: IDirectoryDeleteOperation = {\n\t\t\tkey,\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"delete\",\n\t\t};\n\n\t\tthis.submitKeyMessage(op, previousValue);\n\t\treturn previousValue !== undefined;\n\t}\n\n\t/**\n\t * Deletes all keys from within this IDirectory.\n\t */\n\tpublic clear(): void {\n\t\tthis.throwIfDisposed();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\tthis.clearCore(true);\n\t\t\treturn;\n\t\t}\n\n\t\tconst copy = new Map<string, ILocalValue>(this._storage);\n\t\tthis.clearCore(true);\n\t\tconst op: IDirectoryClearOperation = {\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"clear\",\n\t\t};\n\t\tthis.submitClearMessage(op, copy);\n\t}\n\n\t/**\n\t * Issue a callback on each entry under this IDirectory.\n\t * @param callback - Callback to issue\n\t */\n\tpublic forEach(\n\t\tcallback: (value: unknown, key: string, map: Map<string, unknown>) => void,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\t// eslint-disable-next-line unicorn/no-array-for-each\n\t\tthis._storage.forEach((localValue, key, map) => {\n\t\t\tcallback(localValue.value, key, map);\n\t\t});\n\t}\n\n\t/**\n\t * The number of entries under this IDirectory.\n\t */\n\tpublic get size(): number {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.size;\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic entries(): IterableIterator<[string, unknown]> {\n\t\tthis.throwIfDisposed();\n\t\tconst localEntriesIterator = this._storage.entries();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<[string, unknown]> {\n\t\t\t\tconst nextVal = localEntriesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: [nextVal.value[0], nextVal.value[1].value], done: false };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the keys under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<unknown> {\n\t\tthis.throwIfDisposed();\n\t\tconst localValuesIterator = this._storage.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<unknown> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: nextVal.value.value, done: false };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<unknown> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\tthis.throwIfDisposed();\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Process a clear operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processClearMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryClearOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (!this.isMessageForCurrentInstanceOfSubDirectory(msg)) {\n\t\t\treturn;\n\t\t}\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tisClearLocalOpMetadata(localOpMetadata),\n\t\t\t\t0x00f /* pendingMessageId is missing from the local client's operation */,\n\t\t\t);\n\t\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t\tassert(\n\t\t\t\tpendingClearMessageId === localOpMetadata.pendingMessageId,\n\t\t\t\t0x32a /* pendingMessageId does not match */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tthis.clearExceptPendingKeys(false);\n\t}\n\n\t/**\n\t * Apply clear operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedClearMessage(op: IDirectoryClearOperation): IClearLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\tconst previousValue = new Map<string, ILocalValue>(this._storage);\n\t\tthis.clearExceptPendingKeys(true);\n\t\tconst pendingMsgId = ++this.pendingMessageId;\n\t\tthis.pendingClearMessageIds.push(pendingMsgId);\n\t\tconst metadata: IClearLocalOpMetadata = {\n\t\t\ttype: \"clear\",\n\t\t\tpendingMessageId: pendingMsgId,\n\t\t\tpreviousStorage: previousValue,\n\t\t};\n\t\treturn metadata;\n\t}\n\n\t/**\n\t * Process a delete operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processDeleteMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryDeleteOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessStorageOperation(op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deleteCore(op.key, local);\n\t}\n\n\t/**\n\t * Apply delete operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedDeleteMessage(op: IDirectoryDeleteOperation): IKeyEditLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\tconst previousValue = this.deleteCore(op.key, true);\n\t\tconst pendingMessageId = this.getKeyMessageId(op);\n\t\tconst localMetadata: IKeyEditLocalOpMetadata = {\n\t\t\ttype: \"edit\",\n\t\t\tpendingMessageId,\n\t\t\tpreviousValue,\n\t\t};\n\t\treturn localMetadata;\n\t}\n\n\t/**\n\t * Process a set operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processSetMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectorySetOperation,\n\t\tcontext: ILocalValue | undefined,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessStorageOperation(op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// needProcessStorageOperation should have returned false if local is true\n\t\t// so we can assume context is not undefined\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tthis.setCore(op.key, context!, local);\n\t}\n\n\t/**\n\t * Apply set operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedSetMessage(\n\t\top: IDirectorySetOperation,\n\t\tcontext: ILocalValue,\n\t): IKeyEditLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(op.key, context, true);\n\n\t\t// Create metadata\n\t\tconst pendingMessageId = this.getKeyMessageId(op);\n\t\tconst localMetadata: IKeyEditLocalOpMetadata = {\n\t\t\ttype: \"edit\",\n\t\t\tpendingMessageId,\n\t\t\tpreviousValue,\n\t\t};\n\t\treturn localMetadata;\n\t}\n\t/**\n\t * Process a create subdirectory operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processCreateSubDirectoryMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tassertNonNullClientId(msg.clientId);\n\t\tthis.createSubDirectoryCore(op.subdirName, local, msg.sequenceNumber, msg.clientId);\n\t}\n\n\t/**\n\t * Apply createSubDirectory operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedCreateSubDirMessage(\n\t\top: IDirectoryCreateSubDirectoryOperation,\n\t): ICreateSubDirLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\t// Create the sub directory locally first.\n\t\tthis.createSubDirectoryCore(\n\t\t\top.subdirName,\n\t\t\ttrue,\n\t\t\tthis.getLocalSeq(),\n\t\t\tthis.runtime.clientId ?? \"detached\",\n\t\t);\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: ICreateSubDirLocalOpMetadata = {\n\t\t\ttype: \"createSubDir\",\n\t\t};\n\t\treturn localOpMetadata;\n\t}\n\n\t/**\n\t * Process a delete subdirectory operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processDeleteSubDirectoryMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deleteSubDirectoryCore(op.subdirName, local);\n\t}\n\n\t/**\n\t * Apply deleteSubDirectory operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedDeleteSubDirMessage(\n\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t): IDeleteSubDirLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\tconst subDir = this.deleteSubDirectoryCore(op.subdirName, true);\n\t\tthis.updatePendingSubDirMessageCount(op);\n\t\tconst metadata: IDeleteSubDirLocalOpMetadata = {\n\t\t\ttype: \"deleteSubDir\",\n\t\t\tsubDirectory: subDir,\n\t\t};\n\t\treturn metadata;\n\t}\n\n\t/**\n\t * Submit a clear operation.\n\t * @param op - The operation\n\t */\n\tprivate submitClearMessage(\n\t\top: IDirectoryClearOperation,\n\t\tpreviousValue: Map<string, ILocalValue>,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tconst pendingMsgId = ++this.pendingMessageId;\n\t\tthis.pendingClearMessageIds.push(pendingMsgId);\n\t\tconst metadata: IClearLocalOpMetadata = {\n\t\t\ttype: \"clear\",\n\t\t\tpendingMessageId: pendingMsgId,\n\t\t\tpreviousStorage: previousValue,\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, metadata);\n\t}\n\n\t/**\n\t * Resubmit a clear operation.\n\t * @param op - The operation\n\t * @internal\n\t */\n\tpublic resubmitClearMessage(op: IDirectoryClearOperation, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\tisClearLocalOpMetadata(localOpMetadata),\n\t\t\t0x32b /* Invalid localOpMetadata for clear */,\n\t\t);\n\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (pendingClearMessageId === localOpMetadata.pendingMessageId) {\n\t\t\tthis.submitClearMessage(op, localOpMetadata.previousStorage);\n\t\t}\n\t}\n\n\t/**\n\t * Get a new pending message id for the op and cache it to track the pending op\n\t */\n\tprivate getKeyMessageId(op: IDirectoryKeyOperation): number {\n\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\tconst pendingMessageId = ++this.pendingMessageId;\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingMessageIds !== undefined) {\n\t\t\tpendingMessageIds.push(pendingMessageId);\n\t\t} else {\n\t\t\tthis.pendingKeys.set(op.key, [pendingMessageId]);\n\t\t}\n\t\treturn pendingMessageId;\n\t}\n\n\t/**\n\t * Submit a key operation.\n\t * @param op - The operation\n\t * @param previousValue - The value of the key before this op\n\t */\n\tprivate submitKeyMessage(op: IDirectoryKeyOperation, previousValue?: ILocalValue): void {\n\t\tthis.throwIfDisposed();\n\t\tconst pendingMessageId = this.getKeyMessageId(op);\n\t\tconst localMetadata = { type: \"edit\", pendingMessageId, previousValue };\n\t\tthis.directory.submitDirectoryMessage(op, localMetadata);\n\t}\n\n\t/**\n\t * Submit a key message to remote clients based on a previous submit.\n\t * @param op - The map key message\n\t * @param localOpMetadata - Metadata from the previous submit\n\t * @internal\n\t */\n\tpublic resubmitKeyMessage(op: IDirectoryKeyOperation, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\tisKeyEditLocalOpMetadata(localOpMetadata),\n\t\t\t0x32d /* Invalid localOpMetadata in submit */,\n\t\t);\n\n\t\t// clear the old pending message id\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (pendingMessageIds !== undefined) {\n\t\t\tconst index = pendingMessageIds.findIndex(\n\t\t\t\t(id) => id === localOpMetadata.pendingMessageId,\n\t\t\t);\n\t\t\tif (index === -1) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpendingMessageIds.splice(index, 1);\n\t\t\tif (pendingMessageIds.length === 0) {\n\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t}\n\t\t\tthis.submitKeyMessage(op, localOpMetadata.previousValue);\n\t\t}\n\t}\n\n\tprivate incrementPendingSubDirCount(map: Map<string, number>, subDirName: string) {\n\t\tconst count = map.get(subDirName) ?? 0;\n\t\tmap.set(subDirName, count + 1);\n\t}\n\n\tprivate decrementPendingSubDirCount(map: Map<string, number>, subDirName: string) {\n\t\tconst count = map.get(subDirName) ?? 0;\n\t\tmap.set(subDirName, count - 1);\n\t\tif (count <= 1) {\n\t\t\tmap.delete(subDirName);\n\t\t}\n\t}\n\n\t/**\n\t * Update the count for pending create/delete of the sub directory so that it can be validated on receiving op\n\t * or while resubmitting the op.\n\t */\n\tprivate updatePendingSubDirMessageCount(op: IDirectorySubDirectoryOperation) {\n\t\tif (op.type === \"deleteSubDirectory\") {\n\t\t\tthis.incrementPendingSubDirCount(\n\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\top.subdirName,\n\t\t\t);\n\t\t} else if (op.type === \"createSubDirectory\") {\n\t\t\tthis.incrementPendingSubDirCount(\n\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\top.subdirName,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Submit a create subdirectory operation.\n\t * @param op - The operation\n\t */\n\tprivate submitCreateSubDirectoryMessage(op: IDirectorySubDirectoryOperation): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: ICreateSubDirLocalOpMetadata = {\n\t\t\ttype: \"createSubDir\",\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Submit a delete subdirectory operation.\n\t * @param op - The operation\n\t * @param subDir - Any subdirectory deleted by the op\n\t */\n\tprivate submitDeleteSubDirectoryMessage(\n\t\top: IDirectorySubDirectoryOperation,\n\t\tsubDir: SubDirectory | undefined,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: IDeleteSubDirLocalOpMetadata = {\n\t\t\ttype: \"deleteSubDir\",\n\t\t\tsubDirectory: subDir,\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Submit a subdirectory operation again\n\t * @param op - The operation\n\t * @param localOpMetadata - metadata submitted with the op originally\n\t * @internal\n\t */\n\tpublic resubmitSubDirectoryMessage(\n\t\top: IDirectorySubDirectoryOperation,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tassert(\n\t\t\tisSubDirLocalOpMetadata(localOpMetadata),\n\t\t\t0x32f /* Invalid localOpMetadata for sub directory op */,\n\t\t);\n\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (\n\t\t\tlocalOpMetadata.type === \"createSubDir\" &&\n\t\t\t!this.pendingCreateSubDirectoriesTracker.has(op.subdirName)\n\t\t) {\n\t\t\treturn;\n\t\t} else if (\n\t\t\tlocalOpMetadata.type === \"deleteSubDir\" &&\n\t\t\t!this.pendingDeleteSubDirectoriesTracker.has(op.subdirName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (localOpMetadata.type === \"createSubDir\") {\n\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\top.subdirName,\n\t\t\t);\n\t\t\tthis.submitCreateSubDirectoryMessage(op);\n\t\t} else {\n\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\top.subdirName,\n\t\t\t);\n\t\t\tthis.submitDeleteSubDirectoryMessage(op, localOpMetadata.subDirectory);\n\t\t}\n\t}\n\n\t/**\n\t * Get the storage of this subdirectory in a serializable format, to be used in snapshotting.\n\t * @param serializer - The serializer to use to serialize handles in its values.\n\t * @returns The JSONable string representing the storage of this subdirectory\n\t * @internal\n\t */\n\tpublic *getSerializedStorage(\n\t\tserializer: IFluidSerializer,\n\t): Generator<[string, ISerializedValue], void> {\n\t\tthis.throwIfDisposed();\n\t\tfor (const [key, localValue] of this._storage) {\n\t\t\tconst value = localValue.makeSerialized(serializer, this.directory.handle);\n\t\t\tconst res: [string, ISerializedValue] = [key, value];\n\t\t\tyield res;\n\t\t}\n\t}\n\n\tpublic getSerializableCreateInfo() {\n\t\tthis.throwIfDisposed();\n\t\tconst createInfo: ICreateInfo = {\n\t\t\tcsn: this.sequenceNumber,\n\t\t\tccIds: Array.from(this.clientIds),\n\t\t};\n\t\treturn createInfo;\n\t}\n\n\t/**\n\t * Populate a key value in this subdirectory's storage, to be used when loading from snapshot.\n\t * @param key - The key to populate\n\t * @param localValue - The local value to populate into it\n\t * @internal\n\t */\n\tpublic populateStorage(key: string, localValue: ILocalValue): void {\n\t\tthis.throwIfDisposed();\n\t\tthis._storage.set(key, localValue);\n\t}\n\n\t/**\n\t * Populate a subdirectory into this subdirectory, to be used when loading from snapshot.\n\t * @param subdirName - The name of the subdirectory to add\n\t * @param newSubDir - The new subdirectory to add\n\t * @internal\n\t */\n\tpublic populateSubDirectory(subdirName: string, newSubDir: SubDirectory): void {\n\t\tthis.throwIfDisposed();\n\t\tthis._subdirectories.set(subdirName, newSubDir);\n\t}\n\n\t/**\n\t * Retrieve the local value at the given key. This is used to get value type information stashed on the local\n\t * value so op handlers can be retrieved\n\t * @param key - The key to retrieve from\n\t * @returns The local value\n\t * @internal\n\t */\n\tpublic getLocalValue<T extends ILocalValue = ILocalValue>(key: string): T {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.get(key) as T;\n\t}\n\n\t/**\n\t * Remove the pendingMessageId from the map tracking it on rollback\n\t * @param map - map tracking the pending messages\n\t * @param key - key of the edit in the op\n\t */\n\tprivate rollbackPendingMessageId(\n\t\tmap: Map<string, number[]>,\n\t\tkey: string,\n\t\tpendingMessageId,\n\t): void {\n\t\tconst pendingMessageIds = map.get(key);\n\t\tconst lastPendingMessageId = pendingMessageIds?.pop();\n\t\tif (!pendingMessageIds || lastPendingMessageId !== pendingMessageId) {\n\t\t\tthrow new Error(\"Rollback op does not match last pending\");\n\t\t}\n\t\tif (pendingMessageIds.length === 0) {\n\t\t\tmap.delete(key);\n\t\t}\n\t}\n\n\t/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\n\t/**\n\t * Rollback a local op\n\t * @param op - The operation to rollback\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic rollback(op: any, localOpMetadata: unknown): void {\n\t\tif (!isDirectoryLocalOpMetadata(localOpMetadata)) {\n\t\t\tthrow new Error(\"Invalid localOpMetadata\");\n\t\t}\n\n\t\tif (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n\t\t\tfor (const [key, localValue] of localOpMetadata.previousStorage.entries()) {\n\t\t\t\tthis.setCore(key, localValue, true);\n\t\t\t}\n\n\t\t\tconst lastPendingClearId = this.pendingClearMessageIds.pop();\n\t\t\tif (\n\t\t\t\tlastPendingClearId === undefined ||\n\t\t\t\tlastPendingClearId !== localOpMetadata.pendingMessageId\n\t\t\t) {\n\t\t\t\tthrow new Error(\"Rollback op does match last clear\");\n\t\t\t}\n\t\t} else if ((op.type === \"delete\" || op.type === \"set\") && localOpMetadata.type === \"edit\") {\n\t\t\tif (localOpMetadata.previousValue === undefined) {\n\t\t\t\tthis.deleteCore(op.key as string, true);\n\t\t\t} else {\n\t\t\t\tthis.setCore(op.key as string, localOpMetadata.previousValue, true);\n\t\t\t}\n\n\t\t\tthis.rollbackPendingMessageId(\n\t\t\t\tthis.pendingKeys,\n\t\t\t\top.key as string,\n\t\t\t\tlocalOpMetadata.pendingMessageId,\n\t\t\t);\n\t\t} else if (op.type === \"createSubDirectory\" && localOpMetadata.type === \"createSubDir\") {\n\t\t\tthis.deleteSubDirectoryCore(op.subdirName as string, true);\n\n\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\top.subdirName as string,\n\t\t\t);\n\t\t} else if (op.type === \"deleteSubDirectory\" && localOpMetadata.type === \"deleteSubDir\") {\n\t\t\tif (localOpMetadata.subDirectory !== undefined) {\n\t\t\t\tthis.undeleteSubDirectoryTree(localOpMetadata.subDirectory);\n\t\t\t\t// don't need to register events because deleting never unregistered\n\t\t\t\tthis._subdirectories.set(op.subdirName as string, localOpMetadata.subDirectory);\n\t\t\t\tthis.emit(\"subDirectoryCreated\", op.subdirName, true, this);\n\t\t\t}\n\n\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\top.subDirName as string,\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n\t/**\n\t * Converts the given relative path into an absolute path.\n\t * @param path - Relative path to convert\n\t * @returns The equivalent absolute path\n\t */\n\tprivate makeAbsolute(relativePath: string): string {\n\t\treturn posix.resolve(this.absolutePath, relativePath);\n\t}\n\n\t/**\n\t * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n\t * not process the incoming operation.\n\t * @param op - Operation to check\n\t * @param local - Whether the operation originated from the local client\n\t * @param localOpMetadata - For local client ops, this is the metadata that was submitted with the op.\n\t * For ops from a remote client, this will be undefined.\n\t * @returns True if the operation should be processed, false otherwise\n\t */\n\tprivate needProcessStorageOperation(\n\t\top: IDirectoryKeyOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tif (this.pendingClearMessageIds.length > 0) {\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined &&\n\t\t\t\t\t\tisKeyEditLocalOpMetadata(localOpMetadata) &&\n\t\t\t\t\t\tlocalOpMetadata.pendingMessageId < this.pendingClearMessageIds[0],\n\t\t\t\t\t0x010 /* \"Received out of order storage op when there is an unackd clear message\" */,\n\t\t\t\t);\n\t\t\t\t// Remove all pendingMessageIds lower than first pendingClearMessageId.\n\t\t\t\tconst lowestPendingClearMessageId = this.pendingClearMessageIds[0];\n\t\t\t\tconst pendingKeyMessageIdArray = this.pendingKeys.get(op.key);\n\t\t\t\tif (pendingKeyMessageIdArray !== undefined) {\n\t\t\t\t\tlet index = 0;\n\t\t\t\t\twhile (pendingKeyMessageIdArray[index] < lowestPendingClearMessageId) {\n\t\t\t\t\t\tindex += 1;\n\t\t\t\t\t}\n\t\t\t\t\tconst newPendingKeyMessageId = pendingKeyMessageIdArray.splice(index);\n\t\t\t\t\tif (newPendingKeyMessageId.length === 0) {\n\t\t\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.pendingKeys.set(op.key, newPendingKeyMessageId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If I have a NACK clear, we can ignore all ops.\n\t\t\treturn false;\n\t\t}\n\n\t\tconst pendingKeyMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingKeyMessageIds !== undefined) {\n\t\t\t// Found an NACK op, clear it from the directory if the latest sequence number in the directory\n\t\t\t// match the message's and don't process the op.\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined && isKeyEditLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t0x011 /* pendingMessageId is missing from the local client's operation */,\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tpendingKeyMessageIds[0] === localOpMetadata.pendingMessageId,\n\t\t\t\t\t0x331 /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tpendingKeyMessageIds.shift();\n\t\t\t\tif (pendingKeyMessageIds.length === 0) {\n\t\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// If we don't have a NACK op on the key, we need to process the remote ops.\n\t\treturn !local;\n\t}\n\n\t/**\n\t * This return true if the message is for the current instance of this sub directory. As the sub directory\n\t * can be deleted and created again, then this finds if the message is for current instance of directory or not.\n\t * @param msg - message for the directory\n\t */\n\tprivate isMessageForCurrentInstanceOfSubDirectory(msg: ISequencedDocumentMessage) {\n\t\t// If the message is either from the creator of directory or this directory was created when\n\t\t// container was detached or in case this directory is already live(known to other clients)\n\t\t// and the op was created after the directory was created then apply this op.\n\t\treturn (\n\t\t\t(msg.clientId !== null && this.clientIds.has(msg.clientId)) ||\n\t\t\tthis.clientIds.has(\"detached\") ||\n\t\t\t(this.sequenceNumber !== -1 && this.sequenceNumber <= msg.referenceSequenceNumber)\n\t\t);\n\t}\n\n\t/**\n\t * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n\t * not process the incoming operation.\n\t * @param op - Operation to check\n\t * @param local - Whether the message originated from the local client\n\t * @param message - The message\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation should be processed, false otherwise\n\t */\n\tprivate needProcessSubDirectoryOperation(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectorySubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tassertNonNullClientId(msg.clientId);\n\t\tconst pendingDeleteCount = this.pendingDeleteSubDirectoriesTracker.get(op.subdirName);\n\t\tconst pendingCreateCount = this.pendingCreateSubDirectoriesTracker.get(op.subdirName);\n\t\tif (\n\t\t\t(pendingDeleteCount !== undefined && pendingDeleteCount > 0) ||\n\t\t\t(pendingCreateCount !== undefined && pendingCreateCount > 0)\n\t\t) {\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tisSubDirLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t0x012 /* pendingMessageId is missing from the local client's operation */,\n\t\t\t\t);\n\t\t\t\tif (localOpMetadata.type === \"deleteSubDir\") {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingDeleteCount !== undefined && pendingDeleteCount > 0,\n\t\t\t\t\t\t0x6c2 /* pendingDeleteCount should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\t\t\top.subdirName,\n\t\t\t\t\t);\n\t\t\t\t} else if (localOpMetadata.type === \"createSubDir\") {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingCreateCount !== undefined && pendingCreateCount > 0,\n\t\t\t\t\t\t0x6c3 /* pendingCreateCount should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\t\t\top.subdirName,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op.type === \"deleteSubDirectory\") {\n\t\t\t\tconst resetSubDirectoryTree = (directory: SubDirectory | undefined): void => {\n\t\t\t\t\tif (!directory) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// If this is delete op and we have keys in this subDirectory, then we need to delete these\n\t\t\t\t\t// keys except the pending ones as they will be sequenced after this delete.\n\t\t\t\t\tdirectory.clearExceptPendingKeys(local);\n\t\t\t\t\t// In case of delete op, we need to reset the creation seq number and client ids of\n\t\t\t\t\t// creators as the previous directory is getting deleted and we will initialize again when\n\t\t\t\t\t// we will receive op for the create again.\n\t\t\t\t\tdirectory.sequenceNumber = -1;\n\t\t\t\t\tdirectory.clientIds.clear();\n\t\t\t\t\t// Do the same thing for the subtree of the directory. If create is not pending for a child, then just\n\t\t\t\t\t// delete it.\n\t\t\t\t\tconst subDirectories = directory.subdirectories();\n\t\t\t\t\tfor (const [subDirName, subDir] of subDirectories) {\n\t\t\t\t\t\tif (directory.pendingCreateSubDirectoriesTracker.has(subDirName)) {\n\t\t\t\t\t\t\tresetSubDirectoryTree(subDir as SubDirectory);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdirectory.deleteSubDirectoryCore(subDirName, false);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst subDirectory = this._subdirectories.get(op.subdirName);\n\t\t\t\tresetSubDirectoryTree(subDirectory);\n\t\t\t}\n\t\t\tif (op.type === \"createSubDirectory\") {\n\t\t\t\tconst dir = this._subdirectories.get(op.subdirName);\n\t\t\t\t// Child sub directory create seq number can't be lower than the parent subdirectory.\n\t\t\t\t// The sequence number for multiple ops can be the same when multiple createSubDirectory occurs with grouped batching enabled, thus <= and not just <.\n\t\t\t\tif (this.sequenceNumber !== -1 && this.sequenceNumber <= msg.sequenceNumber) {\n\t\t\t\t\tif (dir?.sequenceNumber === -1) {\n\t\t\t\t\t\t// Only set the seq on the first message, could be more\n\t\t\t\t\t\tdir.sequenceNumber = msg.sequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\t// The client created the dir at or after the dirs seq, so list its client id as a creator.\n\t\t\t\t\tif (\n\t\t\t\t\t\tdir !== undefined &&\n\t\t\t\t\t\t!dir.clientIds.has(msg.clientId) &&\n\t\t\t\t\t\tdir.sequenceNumber <= msg.sequenceNumber\n\t\t\t\t\t) {\n\t\t\t\t\t\tdir.clientIds.add(msg.clientId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !local;\n\t}\n\n\t/**\n\t * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n\t */\n\tprivate clearExceptPendingKeys(local: boolean): void {\n\t\t// Assuming the pendingKeys is small and the map is large\n\t\t// we will get the value for the pendingKeys and clear the map\n\t\tconst temp = new Map<string, ILocalValue>();\n\n\t\tfor (const [key] of this.pendingKeys) {\n\t\t\tconst value = this._storage.get(key);\n\t\t\t// If this key is already deleted, then we don't need to add it again.\n\t\t\tif (value !== undefined) {\n\t\t\t\ttemp.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\tthis.clearCore(local);\n\n\t\tfor (const [key, value] of temp.entries()) {\n\t\t\tthis.setCore(key, value, true);\n\t\t}\n\t}\n\n\t/**\n\t * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate clearCore(local: boolean): void {\n\t\tthis._storage.clear();\n\t\tthis.directory.emit(\"clear\", local, this.directory);\n\t}\n\n\t/**\n\t * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n\t * @param key - The key being deleted\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key if it existed, undefined if it did not exist\n\t */\n\tprivate deleteCore(key: string, local: boolean): ILocalValue | undefined {\n\t\tconst previousLocalValue = this._storage.get(key);\n\t\tconst previousValue: unknown = previousLocalValue?.value;\n\t\tconst successfullyRemoved = this._storage.delete(key);\n\t\tif (successfullyRemoved) {\n\t\t\tconst event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };\n\t\t\tthis.directory.emit(\"valueChanged\", event, local, this.directory);\n\t\t\tconst containedEvent: IValueChanged = { key, previousValue };\n\t\t\tthis.emit(\"containedValueChanged\", containedEvent, local, this);\n\t\t}\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Set implementation used for both locally sourced sets as well as incoming remote sets.\n\t * @param key - The key being set\n\t * @param value - The value being set\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key, if any\n\t */\n\tprivate setCore(key: string, value: ILocalValue, local: boolean): ILocalValue | undefined {\n\t\tconst previousLocalValue = this._storage.get(key);\n\t\tconst previousValue: unknown = previousLocalValue?.value;\n\t\tthis._storage.set(key, value);\n\t\tconst event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };\n\t\tthis.directory.emit(\"valueChanged\", event, local, this.directory);\n\t\tconst containedEvent: IValueChanged = { key, previousValue };\n\t\tthis.emit(\"containedValueChanged\", containedEvent, local, this);\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Create subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n\t * @param subdirName - The name of the subdirectory being created\n\t * @param local - Whether the message originated from the local client\n\t * @param seq - Sequence number at which this directory is created\n\t * @param clientId - Id of client which created this directory.\n\t * @returns True if is newly created, false if it already existed.\n\t */\n\tprivate createSubDirectoryCore(\n\t\tsubdirName: string,\n\t\tlocal: boolean,\n\t\tseq: number,\n\t\tclientId: string,\n\t): boolean {\n\t\tconst subdir = this._subdirectories.get(subdirName);\n\t\tif (subdir === undefined) {\n\t\t\tconst absolutePath = posix.join(this.absolutePath, subdirName);\n\t\t\tconst subDir = new SubDirectory(\n\t\t\t\tseq,\n\t\t\t\tnew Set([clientId]),\n\t\t\t\tthis.directory,\n\t\t\t\tthis.runtime,\n\t\t\t\tthis.serializer,\n\t\t\t\tabsolutePath,\n\t\t\t);\n\t\t\tthis.registerEventsOnSubDirectory(subDir, subdirName);\n\t\t\tthis._subdirectories.set(subdirName, subDir);\n\t\t\tthis.emit(\"subDirectoryCreated\", subdirName, local, this);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tsubdir.clientIds.add(clientId);\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate registerEventsOnSubDirectory(subDirectory: SubDirectory, subDirName: string): void {\n\t\tsubDirectory.on(\"subDirectoryCreated\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryCreated\", posix.join(subDirName, relativePath), local, this);\n\t\t});\n\t\tsubDirectory.on(\"subDirectoryDeleted\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryDeleted\", posix.join(subDirName, relativePath), local, this);\n\t\t});\n\t}\n\n\t/**\n\t * Delete subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n\t * @param subdirName - The name of the subdirectory being deleted\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate deleteSubDirectoryCore(subdirName: string, local: boolean): SubDirectory | undefined {\n\t\tconst previousValue = this._subdirectories.get(subdirName);\n\t\t// This should make the subdirectory structure unreachable so it can be GC'd and won't appear in snapshots\n\t\t// Might want to consider cleaning out the structure more exhaustively though? But not when rollback.\n\t\tif (previousValue !== undefined) {\n\t\t\tthis._subdirectories.delete(subdirName);\n\t\t\tthis.disposeSubDirectoryTree(previousValue);\n\t\t\tthis.emit(\"subDirectoryDeleted\", subdirName, local, this);\n\t\t}\n\t\treturn previousValue;\n\t}\n\n\tprivate disposeSubDirectoryTree(directory: IDirectory | undefined): void {\n\t\tif (!directory) {\n\t\t\treturn;\n\t\t}\n\t\t// Dispose the subdirectory tree. This will dispose the subdirectories from bottom to top.\n\t\tconst subDirectories = directory.subdirectories();\n\t\tfor (const [_, subDirectory] of subDirectories) {\n\t\t\tthis.disposeSubDirectoryTree(subDirectory);\n\t\t}\n\t\tif (typeof directory.dispose === \"function\") {\n\t\t\tdirectory.dispose();\n\t\t}\n\t}\n\n\tprivate undeleteSubDirectoryTree(directory: SubDirectory): void {\n\t\t// Restore deleted subdirectory tree. Need to undispose the current directory first, then get access to the iterator.\n\t\t// This will unmark \"deleted\" from the subdirectories from top to bottom.\n\t\tdirectory.undispose();\n\t\tfor (const [_, subDirectory] of directory.subdirectories()) {\n\t\t\tthis.undeleteSubDirectoryTree(subDirectory as SubDirectory);\n\t\t}\n\t}\n}\n"]}
package/lib/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { DirectoryFactory, SharedDirectory, } from "./directory.mjs";
6
+ export { LocalValueMaker } from "./localValues.mjs";
7
+ export { MapFactory, SharedMap } from "./map.mjs";
8
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAcI,EACN,gBAAgB,EAahB,eAAe,GACf;OAaM,EAAE,eAAe,EAAe;OAChC,EAAE,UAAU,EAAE,SAAS,EAAE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `map` library provides interfaces and implementing classes for map-like distributed data structures.\n *\n * @remarks The following distributed data structures are defined in this library:\n *\n * - {@link SharedMap}\n *\n * - {@link SharedDirectory}\n *\n * @packageDocumentation\n */\n\nexport {\n\tDirectoryFactory,\n\tICreateInfo,\n\tIDirectoryClearOperation,\n\tIDirectoryCreateSubDirectoryOperation,\n\tIDirectoryDataObject,\n\tIDirectoryDeleteOperation,\n\tIDirectoryDeleteSubDirectoryOperation,\n\tIDirectoryKeyOperation,\n\tIDirectoryNewStorageFormat,\n\tIDirectoryOperation,\n\tIDirectorySetOperation,\n\tIDirectoryStorageOperation,\n\tIDirectorySubDirectoryOperation,\n\tSharedDirectory,\n} from \"./directory\";\nexport {\n\tIDirectory,\n\tIDirectoryEvents,\n\tIDirectoryValueChanged,\n\tISerializableValue,\n\tISerializedValue,\n\tISharedDirectory,\n\tISharedDirectoryEvents,\n\tISharedMap,\n\tISharedMapEvents,\n\tIValueChanged,\n} from \"./interfaces\";\nexport { LocalValueMaker, ILocalValue } from \"./localValues\";\nexport { MapFactory, SharedMap } from \"./map\";\n"]}
@@ -3,4 +3,4 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=interfaces.js.map
6
+ //# sourceMappingURL=interfaces.mjs.map