@fluidframework/map 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277

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 (119) hide show
  1. package/.eslintrc.js +12 -11
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +162 -0
  4. package/README.md +24 -8
  5. package/api-extractor-esm.json +4 -0
  6. package/api-extractor-lint.json +4 -0
  7. package/api-extractor.json +2 -2
  8. package/api-report/map.api.md +297 -0
  9. package/dist/{directory.js → directory.cjs} +749 -228
  10. package/dist/directory.cjs.map +1 -0
  11. package/dist/directory.d.ts +567 -34
  12. package/dist/directory.d.ts.map +1 -1
  13. package/dist/index.cjs +27 -0
  14. package/dist/index.cjs.map +1 -0
  15. package/dist/index.d.ts +5 -5
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/{interfaces.js → interfaces.cjs} +1 -1
  18. package/dist/interfaces.cjs.map +1 -0
  19. package/dist/interfaces.d.ts +167 -184
  20. package/dist/interfaces.d.ts.map +1 -1
  21. package/dist/internalInterfaces.cjs +7 -0
  22. package/dist/internalInterfaces.cjs.map +1 -0
  23. package/dist/internalInterfaces.d.ts +101 -0
  24. package/dist/internalInterfaces.d.ts.map +1 -0
  25. package/dist/{localValues.js → localValues.cjs} +15 -3
  26. package/dist/localValues.cjs.map +1 -0
  27. package/dist/localValues.d.ts +17 -6
  28. package/dist/localValues.d.ts.map +1 -1
  29. package/dist/map-alpha.d.ts +982 -0
  30. package/dist/map-beta.d.ts +275 -0
  31. package/dist/map-public.d.ts +275 -0
  32. package/dist/map-untrimmed.d.ts +996 -0
  33. package/dist/{map.js → map.cjs} +39 -34
  34. package/dist/map.cjs.map +1 -0
  35. package/dist/map.d.ts +10 -17
  36. package/dist/map.d.ts.map +1 -1
  37. package/dist/{mapKernel.js → mapKernel.cjs} +122 -79
  38. package/dist/mapKernel.cjs.map +1 -0
  39. package/dist/mapKernel.d.ts +17 -48
  40. package/dist/mapKernel.d.ts.map +1 -1
  41. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  42. package/dist/packageVersion.cjs.map +1 -0
  43. package/dist/packageVersion.d.ts +1 -1
  44. package/dist/packageVersion.d.ts.map +1 -1
  45. package/dist/tsdoc-metadata.json +11 -0
  46. package/lib/directory.d.mts +902 -0
  47. package/lib/directory.d.mts.map +1 -0
  48. package/lib/{directory.js → directory.mjs} +736 -199
  49. package/lib/directory.mjs.map +1 -0
  50. package/lib/index.d.mts +9 -0
  51. package/lib/index.d.mts.map +1 -0
  52. package/lib/index.mjs +8 -0
  53. package/lib/index.mjs.map +1 -0
  54. package/lib/{interfaces.d.ts → interfaces.d.mts} +168 -185
  55. package/lib/interfaces.d.mts.map +1 -0
  56. package/lib/{interfaces.js → interfaces.mjs} +1 -1
  57. package/lib/interfaces.mjs.map +1 -0
  58. package/lib/internalInterfaces.d.mts +101 -0
  59. package/lib/internalInterfaces.d.mts.map +1 -0
  60. package/lib/internalInterfaces.mjs +6 -0
  61. package/lib/internalInterfaces.mjs.map +1 -0
  62. package/lib/{localValues.d.ts → localValues.d.mts} +19 -8
  63. package/lib/localValues.d.mts.map +1 -0
  64. package/lib/{localValues.js → localValues.mjs} +15 -3
  65. package/lib/localValues.mjs.map +1 -0
  66. package/lib/map-alpha.d.mts +970 -0
  67. package/lib/map-beta.d.mts +263 -0
  68. package/lib/map-public.d.mts +263 -0
  69. package/lib/map-untrimmed.d.mts +984 -0
  70. package/lib/{map.d.ts → map.d.mts} +12 -19
  71. package/lib/map.d.mts.map +1 -0
  72. package/lib/{map.js → map.mjs} +40 -35
  73. package/lib/map.mjs.map +1 -0
  74. package/lib/{mapKernel.d.ts → mapKernel.d.mts} +19 -50
  75. package/lib/mapKernel.d.mts.map +1 -0
  76. package/lib/{mapKernel.js → mapKernel.mjs} +116 -73
  77. package/lib/mapKernel.mjs.map +1 -0
  78. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
  79. package/lib/packageVersion.d.mts.map +1 -0
  80. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  81. package/lib/packageVersion.mjs.map +1 -0
  82. package/package.json +143 -65
  83. package/prettier.config.cjs +8 -0
  84. package/src/directory.ts +2544 -1727
  85. package/src/index.ts +31 -5
  86. package/src/interfaces.ts +346 -345
  87. package/src/internalInterfaces.ts +119 -0
  88. package/src/localValues.ts +103 -96
  89. package/src/map.ts +362 -351
  90. package/src/mapKernel.ts +755 -722
  91. package/src/packageVersion.ts +1 -1
  92. package/tsc-multi.test.json +4 -0
  93. package/tsconfig.json +10 -15
  94. package/dist/directory.js.map +0 -1
  95. package/dist/index.js +0 -34
  96. package/dist/index.js.map +0 -1
  97. package/dist/interfaces.js.map +0 -1
  98. package/dist/localValues.js.map +0 -1
  99. package/dist/map.js.map +0 -1
  100. package/dist/mapKernel.js.map +0 -1
  101. package/dist/packageVersion.js.map +0 -1
  102. package/lib/directory.d.ts +0 -369
  103. package/lib/directory.d.ts.map +0 -1
  104. package/lib/directory.js.map +0 -1
  105. package/lib/index.d.ts +0 -20
  106. package/lib/index.d.ts.map +0 -1
  107. package/lib/index.js +0 -20
  108. package/lib/index.js.map +0 -1
  109. package/lib/interfaces.d.ts.map +0 -1
  110. package/lib/interfaces.js.map +0 -1
  111. package/lib/localValues.d.ts.map +0 -1
  112. package/lib/localValues.js.map +0 -1
  113. package/lib/map.d.ts.map +0 -1
  114. package/lib/map.js.map +0 -1
  115. package/lib/mapKernel.d.ts.map +0 -1
  116. package/lib/mapKernel.js.map +0 -1
  117. package/lib/packageVersion.d.ts.map +0 -1
  118. package/lib/packageVersion.js.map +0 -1
  119. package/tsconfig.esnext.json +0 -7
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/map";
9
- export const pkgVersion = "1.4.0-121020";
9
+ export const pkgVersion = "2.0.0-dev-rc.1.0.0.225277";
@@ -0,0 +1,4 @@
1
+ {
2
+ "targets": [{ "extname": ".cjs", "module": "CommonJS", "moduleResolution": "Node10" }],
3
+ "projects": ["./tsconfig.json", "./src/test/tsconfig.json"]
4
+ }
package/tsconfig.json CHANGED
@@ -1,17 +1,12 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
3
- "compilerOptions": {
4
- "composite": true,
5
- "rootDir": "./src",
6
- "outDir": "./dist",
7
- "types": [
8
- "node"
9
- ]
10
- },
11
- "include": [
12
- "src/**/*"
13
- ],
14
- "exclude": [
15
- "src/test/**/*"
16
- ]
2
+ "extends": [
3
+ "../../../common/build/build-common/tsconfig.base.json",
4
+ "../../../common/build/build-common/tsconfig.cjs.json",
5
+ ],
6
+ "include": ["src/**/*"],
7
+ "exclude": ["src/test/**/*"],
8
+ "compilerOptions": {
9
+ "rootDir": "./src",
10
+ "outDir": "./dist",
11
+ },
17
12
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"directory.js","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;AAEH,+DAAyE;AACzE,qEAA6D;AAC7D,+DAA4D;AAC5D,+EAG8C;AAS9C,2EAA+F;AAC/F,iEAAmE;AACnE,sDAAwC;AAWxC,+CAIuB;AACvB,qDAA8C;AAE9C,sFAAsF;AACtF,oDAAoD;AACpD,MAAM,KAAK,GAAgC,IAAI,CAAC,KAAK,CAAC;AAEtD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAmKlC;;;GAGG;AACH,MAAa,gBAAgB;IAezB;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,gBAAgB,CAAC,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,gBAAgB,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE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ACzC,SAAS,CAAC,OAAO,EAAE,CAAC;SACvB;IACL,CAAC;IAEO,wBAAwB,CAAC,SAAuB;QACpD,4GAA4G;QAC5G,KAAK,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE;YAC5D,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;SAC/C;QACD,SAAS,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport { UsageError } from \"@fluidframework/container-utils\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n ISequencedDocumentMessage,\n MessageType,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\nimport { IFluidSerializer, SharedObject, ValueType } from \"@fluidframework/shared-object-base\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport * as path from \"path-browserify\";\nimport {\n IDirectory,\n IDirectoryEvents,\n IDirectoryValueChanged,\n ISerializableValue,\n ISerializedValue,\n ISharedDirectory,\n ISharedDirectoryEvents,\n IValueChanged,\n} from \"./interfaces\";\nimport {\n ILocalValue,\n LocalValueMaker,\n makeSerializable,\n} 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: typeof import(\"path\").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 /**\n * Apply the given operation.\n * @param op - The directory operation to apply\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n process(\n op: IDirectoryOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): void;\n\n /**\n * Communicate the operation to remote clients.\n * @param op - The directory operation to submit\n * @param localOpMetadata - The metadata to be submitted with the message.\n */\n submit(op: IDirectoryOperation, localOpMetadata: unknown): void;\n}\n\n/**\n * Operation indicating a value should be set for a key.\n */\nexport interface IDirectorySetOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"set\";\n\n /**\n * Directory key being modified.\n */\n key: string;\n\n /**\n * Absolute path of the directory where the modified key is located.\n */\n path: string;\n\n /**\n * Value to be set on the key.\n */\n value: ISerializableValue;\n}\n\n/**\n * Operation indicating a key should be deleted from the directory.\n */\nexport interface IDirectoryDeleteOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"delete\";\n\n /**\n * Directory key being modified.\n */\n key: string;\n\n /**\n * Absolute path of the directory where the modified key is located.\n */\n path: string;\n}\n\n/**\n * An operation on a specific key within a directory\n */\nexport type IDirectoryKeyOperation = IDirectorySetOperation | IDirectoryDeleteOperation;\n\n/**\n * Operation indicating the directory should be cleared.\n */\nexport interface IDirectoryClearOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"clear\";\n\n /**\n * Absolute path of the directory being cleared.\n */\n path: string;\n}\n\n/**\n * An operation on one or more of the keys within a directory\n */\nexport type IDirectoryStorageOperation = IDirectoryKeyOperation | IDirectoryClearOperation;\n\n/**\n * Operation indicating a subdirectory should be created.\n */\nexport interface IDirectoryCreateSubDirectoryOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"createSubDirectory\";\n\n /**\n * Absolute path of the directory that will contain the new subdirectory.\n */\n path: string;\n\n /**\n * Name of the new subdirectory.\n */\n subdirName: string;\n}\n\n/**\n * Operation indicating a subdirectory should be deleted.\n */\nexport interface IDirectoryDeleteSubDirectoryOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"deleteSubDirectory\";\n\n /**\n * Absolute path of the directory that contains the directory to be deleted.\n */\n path: string;\n\n /**\n * Name of the subdirectory to be deleted.\n */\n subdirName: string;\n}\n\n/**\n * An operation on the subdirectories within a directory\n */\nexport type IDirectorySubDirectoryOperation = IDirectoryCreateSubDirectoryOperation\n | IDirectoryDeleteSubDirectoryOperation;\n\n/**\n * Any operation on a directory\n */\nexport type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDirectoryOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * @privateRemarks\n * Directly used in JSON.stringify, direct result from JSON.parse.\n */\nexport interface IDirectoryDataObject {\n storage?: { [key: string]: ISerializableValue; };\n subdirectories?: { [subdirName: string]: IDirectoryDataObject; };\n}\n\nexport interface IDirectoryNewStorageFormat {\n blobs: string[];\n content: IDirectoryDataObject;\n}\n\n/**\n * The factory that defines the directory.\n * @sealed\n */\nexport class DirectoryFactory {\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public static readonly Type = \"https://graph.microsoft.com/types/directory\";\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public static readonly Attributes: IChannelAttributes = {\n type: DirectoryFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public get type() {\n return DirectoryFactory.Type;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public get attributes() {\n return DirectoryFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedDirectory> {\n const directory = new SharedDirectory(id, runtime, attributes);\n await directory.load(services);\n\n return directory;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n */\n public create(runtime: IFluidDataStoreRuntime, id: string): ISharedDirectory {\n const directory = new SharedDirectory(id, runtime, DirectoryFactory.Attributes);\n directory.initializeLocal();\n\n return directory;\n }\n}\n\n/**\n * SharedDirectory provides a hierarchical organization of map-like data structures as SubDirectories.\n * The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.\n * SubDirectories can be retrieved for use as working directories.\n *\n * @example\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 */\nexport class SharedDirectory extends SharedObject<ISharedDirectoryEvents> implements ISharedDirectory {\n /**\n * Create a new shared directory\n *\n * @param runtime - Data store runtime the new shared directory belongs to\n * @param id - Optional name of the shared directory\n * @returns Newly create shared directory (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string): SharedDirectory {\n return runtime.createChannel(id, DirectoryFactory.Type) as SharedDirectory;\n }\n\n /**\n * Get a factory for SharedDirectory to register with the data store.\n *\n * @returns A factory that creates and load SharedDirectory\n */\n public static getFactory(): IChannelFactory {\n return new DirectoryFactory();\n }\n\n /**\n * String representation for the class.\n */\n public [Symbol.toStringTag]: string = \"SharedDirectory\";\n\n /**\n * {@inheritDoc IDirectory.absolutePath}\n */\n public get absolutePath(): string {\n return this.root.absolutePath;\n }\n\n /**\n * @internal\n */\n public readonly localValueMaker: LocalValueMaker;\n\n /**\n * Root of the SharedDirectory, most operations on the SharedDirectory itself act on the root.\n */\n private readonly root: SubDirectory = new SubDirectory(this, this.runtime, this.serializer, posix.sep);\n\n /**\n * Mapping of op types to message handlers.\n */\n private readonly messageHandlers: Map<string, IDirectoryMessageHandler> = new Map();\n\n /**\n * Constructs a new shared directory. If the object is non-local an id and service interfaces will\n * be provided.\n * @param id - String identifier for the SharedDirectory\n * @param runtime - Data store runtime\n * @param type - Type identifier\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes, \"fluid_directory_\");\n this.localValueMaker = new LocalValueMaker(this.serializer);\n this.setMessageHandlers();\n // Mirror the containedValueChanged op on the SharedDirectory\n this.root.on(\n \"containedValueChanged\",\n (changed: IValueChanged, local: boolean) => {\n this.emit(\"containedValueChanged\", changed, local, this);\n },\n );\n this.root.on(\n \"subDirectoryCreated\",\n (relativePath: string, local: boolean) => {\n this.emit(\"subDirectoryCreated\", relativePath, local, this);\n },\n );\n this.root.on(\n \"subDirectoryDeleted\",\n (relativePath: string, local: boolean) => {\n this.emit(\"subDirectoryDeleted\", relativePath, local, this);\n },\n );\n }\n\n /**\n * {@inheritDoc IDirectory.get}\n */\n public get<T = any>(key: string): T | undefined {\n return this.root.get<T>(key);\n }\n\n /**\n * {@inheritDoc IDirectory.set}\n */\n public set<T = any>(key: string, value: T): this {\n this.root.set(key, value);\n return this;\n }\n\n public dispose(error?: Error): void {\n this.root.dispose(error);\n }\n\n public get disposed(): boolean {\n return this.root.disposed;\n }\n\n /**\n * Deletes the given key from within this IDirectory.\n * @param key - The key to delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n public delete(key: string): boolean {\n return this.root.delete(key);\n }\n\n /**\n * Deletes all keys from within this IDirectory.\n */\n public clear(): void {\n this.root.clear();\n }\n\n /**\n * Checks whether the given key exists in this IDirectory.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.root.has(key);\n }\n\n /**\n * The number of entries under this IDirectory.\n */\n public get size(): number {\n return this.root.size;\n }\n\n /**\n * Issue a callback on each entry under this IDirectory.\n * @param callback - Callback to issue\n */\n public forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void {\n this.root.forEach(callback);\n }\n\n /**\n * Get an iterator over the entries under this IDirectory.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.root[Symbol.iterator]();\n }\n\n /**\n * Get an iterator over the entries under this IDirectory.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n return this.root.entries();\n }\n\n /**\n * {@inheritDoc IDirectory.countSubDirectory}\n */\n public countSubDirectory(): number {\n return this.root.countSubDirectory();\n }\n\n /**\n * Get an iterator over the keys under this IDirectory.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.root.keys();\n }\n\n /**\n * Get an iterator over the values under this IDirectory.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n return this.root.values();\n }\n\n /**\n * {@inheritDoc IDirectory.createSubDirectory}\n */\n public createSubDirectory(subdirName: string): IDirectory {\n return this.root.createSubDirectory(subdirName);\n }\n\n /**\n * {@inheritDoc IDirectory.getSubDirectory}\n */\n public getSubDirectory(subdirName: string): IDirectory | undefined {\n return this.root.getSubDirectory(subdirName);\n }\n\n /**\n * {@inheritDoc IDirectory.hasSubDirectory}\n */\n public hasSubDirectory(subdirName: string): boolean {\n return this.root.hasSubDirectory(subdirName);\n }\n\n /**\n * {@inheritDoc IDirectory.deleteSubDirectory}\n */\n public deleteSubDirectory(subdirName: string): boolean {\n return this.root.deleteSubDirectory(subdirName);\n }\n\n /**\n * {@inheritDoc IDirectory.subdirectories}\n */\n public subdirectories(): IterableIterator<[string, IDirectory]> {\n return this.root.subdirectories();\n }\n\n /**\n * {@inheritDoc IDirectory.getWorkingDirectory}\n */\n public getWorkingDirectory(relativePath: string): IDirectory | undefined {\n const absolutePath = this.makeAbsolute(relativePath);\n if (absolutePath === posix.sep) {\n return this.root;\n }\n\n let currentSubDir = this.root;\n const subdirs = absolutePath.substr(1).split(posix.sep);\n for (const subdir of subdirs) {\n currentSubDir = currentSubDir.getSubDirectory(subdir) as SubDirectory;\n if (!currentSubDir) {\n return undefined;\n }\n }\n return currentSubDir;\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n * @internal\n */\n protected summarizeCore(\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n return this.serializeDirectory(this.root, serializer);\n }\n\n /**\n * Submits an operation\n * @param op - Op to submit\n * @param localOpMetadata - The local metadata associated with the op. We send a unique id that is used to track\n * this op while it has not been ack'd. This will be sent when we receive this op back from the server.\n * @internal\n */\n public submitDirectoryMessage(op: IDirectoryOperation, localOpMetadata: unknown) {\n this.submitLocalMessage(op, localOpMetadata);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n * @internal\n */\n protected onDisconnect() {}\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n * @internal\n */\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n const message = content as IDirectoryOperation;\n const handler = this.messageHandlers.get(message.type);\n assert(handler !== undefined, 0x00d /* Missing message handler for message type */);\n handler.submit(message, localOpMetadata);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n * @internal\n */\n protected async loadCore(storage: IChannelStorageService) {\n const data = await readAndParse(storage, snapshotFileName);\n const newFormat = data as IDirectoryNewStorageFormat;\n if (Array.isArray(newFormat.blobs)) {\n // New storage format\n this.populate(newFormat.content);\n await Promise.all(newFormat.blobs.map(async (value) => {\n const dataExtra = await readAndParse(storage, value);\n this.populate(dataExtra as IDirectoryDataObject);\n }));\n } else {\n // Old storage format\n this.populate(data as IDirectoryDataObject);\n }\n }\n\n /**\n * Populate the directory with the given directory data.\n * @param data - A JSON string containing serialized directory data\n * @internal\n */\n protected populate(data: IDirectoryDataObject) {\n const stack: [SubDirectory, IDirectoryDataObject][] = [];\n stack.push([this.root, data]);\n while (stack.length > 0) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const [currentSubDir, currentSubDirObject] = stack.pop()!;\n if (currentSubDirObject.subdirectories) {\n for (const [subdirName, subdirObject] of Object.entries(currentSubDirObject.subdirectories)) {\n let newSubDir = currentSubDir.getSubDirectory(subdirName) as SubDirectory;\n if (!newSubDir) {\n newSubDir = new SubDirectory(\n this,\n this.runtime,\n this.serializer,\n posix.join(currentSubDir.absolutePath, subdirName),\n );\n currentSubDir.populateSubDirectory(subdirName, newSubDir);\n }\n stack.push([newSubDir, subdirObject]);\n }\n }\n\n if (currentSubDirObject.storage) {\n for (const [key, serializable] of Object.entries(currentSubDirObject.storage)) {\n const localValue = this.makeLocal(\n key,\n currentSubDir.absolutePath,\n serializable,\n );\n currentSubDir.populateStorage(key, localValue);\n }\n }\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n * @internal\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void {\n if (message.type === MessageType.Operation) {\n const op: IDirectoryOperation = message.contents as IDirectoryOperation;\n const handler = this.messageHandlers.get(op.type);\n assert(handler !== undefined, 0x00e /* Missing message handler for message type */);\n handler.process(op, local, localOpMetadata);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n * @internal\n */\n protected rollback(content: any, localOpMetadata: unknown) {\n const op: IDirectoryOperation = content as IDirectoryOperation;\n const subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (subdir) {\n subdir.rollback(op, localOpMetadata);\n }\n }\n\n /**\n * Converts the given relative path to absolute against the root.\n * @param relativePath - The path to convert\n */\n private makeAbsolute(relativePath: string): string {\n return posix.resolve(posix.sep, relativePath);\n }\n\n /**\n * The remote ISerializableValue we're receiving (either as a result of a snapshot load or an incoming set op)\n * will have the information we need to create a real object, but will not be the real object yet. For example,\n * we might know it's a map and the ID but not have the actual map or its data yet. makeLocal's job\n * is to convert that information into a real object for local usage.\n * @param key - Key of element being converted\n * @param absolutePath - Path of element being converted\n * @param serializable - The remote information that we can convert into a real object\n * @returns The local value that was produced\n */\n private makeLocal(\n key: string,\n absolutePath: string,\n serializable: ISerializableValue,\n ): ILocalValue {\n assert(\n serializable.type === ValueType[ValueType.Plain] || serializable.type === ValueType[ValueType.Shared],\n 0x1e4 /* \"Unexpected serializable type\" */,\n );\n return this.localValueMaker.fromSerializable(serializable);\n }\n\n /**\n * Set the message handlers for the directory.\n */\n private setMessageHandlers(): void {\n this.messageHandlers.set(\n \"clear\",\n {\n process: (op: IDirectoryClearOperation, local, localOpMetadata) => {\n const subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (subdir) {\n subdir.processClearMessage(op, local, localOpMetadata);\n }\n },\n submit: (op: IDirectoryClearOperation, localOpMetadata: unknown) => {\n const subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (subdir) {\n subdir.resubmitClearMessage(op, localOpMetadata);\n }\n },\n },\n );\n this.messageHandlers.set(\n \"delete\",\n {\n process: (op: IDirectoryDeleteOperation, local, localOpMetadata) => {\n const subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (subdir) {\n subdir.processDeleteMessage(op, local, localOpMetadata);\n }\n },\n submit: (op: IDirectoryDeleteOperation, localOpMetadata: unknown) => {\n const subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (subdir) {\n subdir.resubmitKeyMessage(op, localOpMetadata);\n }\n },\n },\n );\n this.messageHandlers.set(\n \"set\",\n {\n process: (op: IDirectorySetOperation, local, localOpMetadata) => {\n const subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (subdir) {\n const context = local ? undefined : this.makeLocal(op.key, op.path, op.value);\n subdir.processSetMessage(op, context, local, localOpMetadata);\n }\n },\n submit: (op: IDirectorySetOperation, localOpMetadata: unknown) => {\n const subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (subdir) {\n subdir.resubmitKeyMessage(op, localOpMetadata);\n }\n },\n },\n );\n\n this.messageHandlers.set(\n \"createSubDirectory\",\n {\n process: (op: IDirectoryCreateSubDirectoryOperation, local, localOpMetadata) => {\n const parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (parentSubdir) {\n parentSubdir.processCreateSubDirectoryMessage(op, local, localOpMetadata);\n }\n },\n submit: (op: IDirectoryCreateSubDirectoryOperation, localOpMetadata: unknown) => {\n const parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (parentSubdir) {\n // We don't reuse the metadata but send a new one on each submit.\n parentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n }\n },\n },\n );\n\n this.messageHandlers.set(\n \"deleteSubDirectory\",\n {\n process: (op: IDirectoryDeleteSubDirectoryOperation, local, localOpMetadata) => {\n const parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (parentSubdir) {\n parentSubdir.processDeleteSubDirectoryMessage(op, local, localOpMetadata);\n }\n },\n submit: (op: IDirectoryDeleteSubDirectoryOperation, localOpMetadata: unknown) => {\n const parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n if (parentSubdir) {\n // We don't reuse the metadata but send a new one on each submit.\n parentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n }\n },\n },\n );\n }\n\n /**\n * @internal\n */\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n\n private serializeDirectory(\n root: SubDirectory,\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n const MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n const builder = new SummaryTreeBuilder();\n let counter = 0;\n const blobs: string[] = [];\n\n const stack: [SubDirectory, IDirectoryDataObject][] = [];\n const content: IDirectoryDataObject = {};\n stack.push([root, content]);\n\n while (stack.length > 0) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const [currentSubDir, currentSubDirObject] = stack.pop()!;\n for (const [key, value] of currentSubDir.getSerializedStorage(serializer)) {\n if (!currentSubDirObject.storage) {\n currentSubDirObject.storage = {};\n }\n const result: ISerializableValue = {\n type: value.type,\n // eslint-disable-next-line @typescript-eslint/ban-types\n value: value.value && JSON.parse(value.value) as object,\n };\n if (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n const extraContent: IDirectoryDataObject = {};\n let largeContent = extraContent;\n if (currentSubDir.absolutePath !== posix.sep) {\n for (const dir of currentSubDir.absolutePath.substr(1).split(posix.sep)) {\n const subDataObject: IDirectoryDataObject = {};\n largeContent.subdirectories = { [dir]: subDataObject };\n largeContent = subDataObject;\n }\n }\n largeContent.storage = { [key]: result };\n const blobName = `blob${counter}`;\n counter++;\n blobs.push(blobName);\n builder.addBlob(blobName, JSON.stringify(extraContent));\n } else {\n currentSubDirObject.storage[key] = result;\n }\n }\n\n for (const [subdirName, subdir] of currentSubDir.subdirectories()) {\n if (!currentSubDirObject.subdirectories) {\n currentSubDirObject.subdirectories = {};\n }\n const subDataObject: IDirectoryDataObject = {};\n currentSubDirObject.subdirectories[subdirName] = subDataObject;\n stack.push([subdir as SubDirectory, subDataObject]);\n }\n }\n\n const newFormat: IDirectoryNewStorageFormat = {\n blobs,\n content,\n };\n builder.addBlob(snapshotFileName, JSON.stringify(newFormat));\n\n return builder.getSummaryTree();\n }\n}\n\ninterface IKeyEditLocalOpMetadata {\n type: \"edit\";\n pendingMessageId: number;\n previousValue: ILocalValue | undefined;\n}\n\ninterface IClearLocalOpMetadata {\n type: \"clear\";\n pendingMessageId: number;\n previousStorage: Map<string, ILocalValue>;\n}\n\ninterface ICreateSubDirLocalOpMetadata {\n type: \"createSubDir\";\n pendingMessageId: number;\n previouslyExisted: boolean;\n}\n\ninterface IDeleteSubDirLocalOpMetadata {\n type: \"deleteSubDir\";\n pendingMessageId: number;\n subDirectory: SubDirectory | undefined;\n}\n\ntype SubDirLocalOpMetadata = ICreateSubDirLocalOpMetadata | IDeleteSubDirLocalOpMetadata;\ntype DirectoryLocalOpMetadata = IClearLocalOpMetadata | IKeyEditLocalOpMetadata | SubDirLocalOpMetadata;\n\nfunction isKeyEditLocalOpMetadata(metadata: any): metadata is IKeyEditLocalOpMetadata {\n return metadata !== undefined && typeof metadata.pendingMessageId === \"number\" && metadata.type === \"edit\";\n}\n\nfunction isClearLocalOpMetadata(metadata: any): metadata is IClearLocalOpMetadata {\n return metadata !== undefined && metadata.type === \"clear\" && typeof metadata.pendingMessageId === \"number\" &&\n typeof metadata.previousStorage === \"object\";\n}\n\nfunction isSubDirLocalOpMetadata(metadata: any): metadata is SubDirLocalOpMetadata {\n return metadata !== undefined && typeof metadata.pendingMessageId === \"number\" &&\n ((metadata.type === \"createSubDir\" && typeof metadata.previouslyExisted === \"boolean\") ||\n metadata.type === \"deleteSubDir\");\n}\n\nfunction isDirectoryLocalOpMetadata(metadata: any): metadata is DirectoryLocalOpMetadata {\n return metadata !== undefined && typeof metadata.pendingMessageId === \"number\" &&\n (metadata.type === \"edit\" || metadata.type === \"deleteSubDir\" ||\n (metadata.type === \"clear\" && typeof metadata.previousStorage === \"object\") ||\n (metadata.type === \"createSubDir\" && typeof metadata.previouslyExisted === \"boolean\"));\n}\n\n/**\n * Node of the directory tree.\n * @sealed\n */\nclass SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirectory {\n /**\n * Tells if the sub directory is deleted or not.\n */\n private _deleted = false;\n\n /**\n * String representation for the class.\n */\n public [Symbol.toStringTag]: string = \"SubDirectory\";\n\n /**\n * The in-memory data the directory is storing.\n */\n private readonly _storage: Map<string, ILocalValue> = new Map();\n\n /**\n * The subdirectories the directory is holding.\n */\n private readonly _subdirectories: Map<string, SubDirectory> = new Map();\n\n /**\n * Keys that have been modified locally but not yet ack'd from the server.\n */\n private readonly pendingKeys: Map<string, number[]> = new Map();\n\n /**\n * Subdirectories that have been modified locally but not yet ack'd from the server.\n */\n private readonly pendingSubDirectories: Map<string, number[]> = new Map();\n\n /**\n * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.\n */\n private pendingMessageId: number = -1;\n\n /**\n * The pending ids of any clears that have been performed locally but not yet ack'd from the server\n */\n private readonly pendingClearMessageIds: number[] = [];\n\n /**\n * Constructor.\n * @param directory - Reference back to the SharedDirectory to perform operations\n * @param runtime - The data store runtime this directory is associated with\n * @param serializer - The serializer to serialize / parse handles\n * @param absolutePath - The absolute path of this IDirectory\n */\n constructor(\n private readonly directory: SharedDirectory,\n private readonly runtime: IFluidDataStoreRuntime,\n private readonly serializer: IFluidSerializer,\n public readonly absolutePath: string,\n ) {\n super();\n }\n\n public dispose(error?: Error): void {\n this._deleted = true;\n this.emit(\"disposed\", this);\n }\n\n /**\n * Unmark the deleted property when rolling back delete.\n */\n private undispose(): void {\n this._deleted = false;\n }\n\n public get disposed(): boolean {\n return this._deleted;\n }\n\n private throwIfDisposed() {\n if (this._deleted) {\n throw new UsageError(\"Cannot access Disposed subDirectory\");\n }\n }\n\n /**\n * Checks whether the given key exists in this IDirectory.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n this.throwIfDisposed();\n return this._storage.has(key);\n }\n\n /**\n * {@inheritDoc IDirectory.get}\n */\n public get<T = any>(key: string): T | undefined {\n this.throwIfDisposed();\n return this._storage.get(key)?.value as T | undefined;\n }\n\n /**\n * {@inheritDoc IDirectory.set}\n */\n public set<T = any>(key: string, value: T): this {\n this.throwIfDisposed();\n // Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n if (key === undefined || key === null) {\n throw new Error(\"Undefined and null keys are not supported\");\n }\n\n // Create a local value and serialize it.\n const localValue = this.directory.localValueMaker.fromInMemory(value);\n const serializableValue = makeSerializable(\n localValue,\n this.serializer,\n this.directory.handle);\n\n // Set the value locally.\n const previousValue = this.setCore(\n key,\n localValue,\n true,\n );\n\n // If we are not attached, don't submit the op.\n if (!this.directory.isAttached()) {\n return this;\n }\n\n const op: IDirectorySetOperation = {\n key,\n path: this.absolutePath,\n type: \"set\",\n value: serializableValue,\n };\n this.submitKeyMessage(op, previousValue);\n return this;\n }\n\n /**\n * {@inheritDoc IDirectory.countSubDirectory}\n */\n public countSubDirectory(): number {\n return this._subdirectories.size;\n }\n\n /**\n * {@inheritDoc IDirectory.createSubDirectory}\n */\n public createSubDirectory(subdirName: string): IDirectory {\n this.throwIfDisposed();\n // Undefined/null subdirectory names can't be serialized to JSON in the manner we currently snapshot.\n if (subdirName === undefined || subdirName === null) {\n throw new Error(\"SubDirectory name may not be undefined or null\");\n }\n\n if (subdirName.includes(posix.sep)) {\n throw new Error(`SubDirectory name may not contain ${posix.sep}`);\n }\n\n // Create the sub directory locally first.\n const isNew = this.createSubDirectoryCore(subdirName, true);\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const subDir: IDirectory = this._subdirectories.get(subdirName)!;\n\n // If we are not attached, don't submit the op.\n if (!this.directory.isAttached()) {\n return subDir;\n }\n\n const op: IDirectoryCreateSubDirectoryOperation = {\n path: this.absolutePath,\n subdirName,\n type: \"createSubDirectory\",\n };\n this.submitCreateSubDirectoryMessage(op, !isNew);\n\n return subDir;\n }\n\n /**\n * {@inheritDoc IDirectory.getSubDirectory}\n */\n public getSubDirectory(subdirName: string): IDirectory | undefined {\n this.throwIfDisposed();\n return this._subdirectories.get(subdirName);\n }\n\n /**\n * {@inheritDoc IDirectory.hasSubDirectory}\n */\n public hasSubDirectory(subdirName: string): boolean {\n this.throwIfDisposed();\n return this._subdirectories.has(subdirName);\n }\n\n /**\n * {@inheritDoc IDirectory.deleteSubDirectory}\n */\n public deleteSubDirectory(subdirName: string): boolean {\n this.throwIfDisposed();\n // Delete the sub directory locally first.\n const subDir = this.deleteSubDirectoryCore(subdirName, true);\n\n // If we are not attached, don't submit the op.\n if (!this.directory.isAttached()) {\n return subDir !== undefined;\n }\n\n const op: IDirectoryDeleteSubDirectoryOperation = {\n path: this.absolutePath,\n subdirName,\n type: \"deleteSubDirectory\",\n };\n\n this.submitDeleteSubDirectoryMessage(op, subDir);\n return subDir !== undefined;\n }\n\n /**\n * {@inheritDoc IDirectory.subdirectories}\n */\n public subdirectories(): IterableIterator<[string, IDirectory]> {\n this.throwIfDisposed();\n return this._subdirectories.entries();\n }\n\n /**\n * {@inheritDoc IDirectory.getWorkingDirectory}\n */\n public getWorkingDirectory(relativePath: string): IDirectory | undefined {\n this.throwIfDisposed();\n return this.directory.getWorkingDirectory(this.makeAbsolute(relativePath));\n }\n\n /**\n * Deletes the given key from within this IDirectory.\n * @param key - The key to delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n public delete(key: string): boolean {\n this.throwIfDisposed();\n // Delete the key locally first.\n const previousValue = this.deleteCore(key, true);\n\n // If we are not attached, don't submit the op.\n if (!this.directory.isAttached()) {\n return previousValue !== undefined;\n }\n\n const op: IDirectoryDeleteOperation = {\n key,\n path: this.absolutePath,\n type: \"delete\",\n };\n\n this.submitKeyMessage(op, previousValue);\n return previousValue !== undefined;\n }\n\n /**\n * Deletes all keys from within this IDirectory.\n */\n public clear(): void {\n this.throwIfDisposed();\n\n // If we are not attached, don't submit the op.\n if (!this.directory.isAttached()) {\n this.clearCore(true);\n return;\n }\n\n const copy = new Map<string, ILocalValue>(this._storage);\n this.clearCore(true);\n const op: IDirectoryClearOperation = {\n path: this.absolutePath,\n type: \"clear\",\n };\n this.submitClearMessage(op, copy);\n }\n\n /**\n * Issue a callback on each entry under this IDirectory.\n * @param callback - Callback to issue\n */\n public forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void {\n this.throwIfDisposed();\n this._storage.forEach((localValue, key, map) => {\n callback(localValue.value, key, map);\n });\n }\n\n /**\n * The number of entries under this IDirectory.\n */\n public get size(): number {\n this.throwIfDisposed();\n return this._storage.size;\n }\n\n /**\n * Get an iterator over the entries under this IDirectory.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n this.throwIfDisposed();\n const localEntriesIterator = this._storage.entries();\n const iterator = {\n next(): IteratorResult<[string, any]> {\n const nextVal = localEntriesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: [nextVal.value[0], nextVal.value[1].value], done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the keys under this IDirectory.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n this.throwIfDisposed();\n return this._storage.keys();\n }\n\n /**\n * Get an iterator over the values under this IDirectory.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n this.throwIfDisposed();\n const localValuesIterator = this._storage.values();\n const iterator = {\n next(): IteratorResult<any> {\n const nextVal = localValuesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: nextVal.value.value, done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the entries under this IDirectory.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n this.throwIfDisposed();\n return this.entries();\n }\n\n /**\n * Process a clear operation.\n * @param op - The op to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @internal\n */\n public processClearMessage(\n op: IDirectoryClearOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): void {\n this.throwIfDisposed();\n if (local) {\n assert(isClearLocalOpMetadata(localOpMetadata),\n 0x00f /* pendingMessageId is missing from the local client's operation */);\n const pendingClearMessageId = this.pendingClearMessageIds.shift();\n assert(pendingClearMessageId === localOpMetadata.pendingMessageId,\n 0x32a /* pendingMessageId does not match */);\n return;\n }\n this.clearExceptPendingKeys();\n }\n\n /**\n * Process a delete operation.\n * @param op - The op to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @internal\n */\n public processDeleteMessage(\n op: IDirectoryDeleteOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): void {\n this.throwIfDisposed();\n if (!this.needProcessStorageOperation(op, local, localOpMetadata)) {\n return;\n }\n this.deleteCore(op.key, local);\n }\n\n /**\n * Process a set operation.\n * @param op - The op to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @internal\n */\n public processSetMessage(\n op: IDirectorySetOperation,\n context: ILocalValue | undefined,\n local: boolean,\n localOpMetadata: unknown,\n ): void {\n this.throwIfDisposed();\n if (!this.needProcessStorageOperation(op, local, localOpMetadata)) {\n return;\n }\n\n // needProcessStorageOperation should have returned false if local is true\n // so we can assume context is not undefined\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.setCore(op.key, context!, local);\n }\n\n /**\n * Process a create subdirectory operation.\n * @param op - The op to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @internal\n */\n public processCreateSubDirectoryMessage(\n op: IDirectoryCreateSubDirectoryOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): void {\n this.throwIfDisposed();\n if (!this.needProcessSubDirectoryOperation(op, local, localOpMetadata)) {\n return;\n }\n this.createSubDirectoryCore(op.subdirName, local);\n }\n\n /**\n * Process a delete subdirectory operation.\n * @param op - The op to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @internal\n */\n public processDeleteSubDirectoryMessage(\n op: IDirectoryDeleteSubDirectoryOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): void {\n this.throwIfDisposed();\n if (!this.needProcessSubDirectoryOperation(op, local, localOpMetadata)) {\n return;\n }\n this.deleteSubDirectoryCore(op.subdirName, local);\n }\n\n /**\n * Submit a clear operation.\n * @param op - The operation\n */\n private submitClearMessage(op: IDirectoryClearOperation,\n previousValue: Map<string, ILocalValue>): void {\n this.throwIfDisposed();\n const pendingMsgId = ++this.pendingMessageId;\n this.pendingClearMessageIds.push(pendingMsgId);\n const metadata: IClearLocalOpMetadata = {\n type: \"clear\",\n pendingMessageId: pendingMsgId,\n previousStorage: previousValue,\n };\n this.directory.submitDirectoryMessage(op, metadata);\n }\n\n /**\n * Resubmit a clear operation.\n * @param op - The operation\n * @internal\n */\n public resubmitClearMessage(op: IDirectoryClearOperation, localOpMetadata: unknown): void {\n assert(isClearLocalOpMetadata(localOpMetadata), 0x32b /* Invalid localOpMetadata for clear */);\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const pendingClearMessageId = this.pendingClearMessageIds.shift();\n assert(pendingClearMessageId === localOpMetadata.pendingMessageId,\n 0x32c /* pendingMessageId does not match */);\n this.submitClearMessage(op, localOpMetadata.previousStorage);\n }\n\n /**\n * Get a new pending message id for the op and cache it to track the pending op\n */\n private getKeyMessageId(op: IDirectoryKeyOperation): number {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const pendingMessageId = ++this.pendingMessageId;\n const pendingMessageIds = this.pendingKeys.get(op.key);\n if (pendingMessageIds !== undefined) {\n pendingMessageIds.push(pendingMessageId);\n } else {\n this.pendingKeys.set(op.key, [pendingMessageId]);\n }\n return pendingMessageId;\n }\n\n /**\n * Submit a key operation.\n * @param op - The operation\n * @param previousValue - The value of the key before this op\n */\n private submitKeyMessage(op: IDirectoryKeyOperation, previousValue?: ILocalValue): void {\n this.throwIfDisposed();\n const pendingMessageId = this.getKeyMessageId(op);\n const localMetadata = { type: \"edit\", pendingMessageId, previousValue };\n this.directory.submitDirectoryMessage(op, localMetadata);\n }\n\n /**\n * Submit a key message to remote clients based on a previous submit.\n * @param op - The map key message\n * @param localOpMetadata - Metadata from the previous submit\n * @internal\n */\n public resubmitKeyMessage(op: IDirectoryKeyOperation, localOpMetadata: unknown): void {\n assert(isKeyEditLocalOpMetadata(localOpMetadata), 0x32d /* Invalid localOpMetadata in submit */);\n\n // clear the old pending message id\n const pendingMessageIds = this.pendingKeys.get(op.key);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x32e /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n\n this.submitKeyMessage(op, localOpMetadata.previousValue);\n }\n\n /**\n * Get a new pending message id for the op and cache it to track the pending op\n */\n private getSubDirMessageId(op: IDirectorySubDirectoryOperation): number {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const newMessageId = ++this.pendingMessageId;\n const pendingMessageIds = this.pendingSubDirectories.get(op.subdirName);\n if (pendingMessageIds !== undefined) {\n pendingMessageIds.push(newMessageId);\n } else {\n this.pendingSubDirectories.set(op.subdirName, [newMessageId]);\n }\n return newMessageId;\n }\n\n /**\n * Submit a create subdirectory operation.\n * @param op - The operation\n * @param prevExisted - Whether the subdirectory existed before the op\n */\n private submitCreateSubDirectoryMessage(op: IDirectorySubDirectoryOperation,\n prevExisted: boolean): void {\n this.throwIfDisposed();\n const newMessageId = this.getSubDirMessageId(op);\n\n const localOpMetadata: ICreateSubDirLocalOpMetadata = {\n type: \"createSubDir\",\n pendingMessageId: newMessageId,\n previouslyExisted: prevExisted,\n };\n this.directory.submitDirectoryMessage(op, localOpMetadata);\n }\n\n /**\n * Submit a delete subdirectory operation.\n * @param op - The operation\n * @param subDir - Any subdirectory deleted by the op\n */\n private submitDeleteSubDirectoryMessage(op: IDirectorySubDirectoryOperation,\n subDir: SubDirectory | undefined): void {\n this.throwIfDisposed();\n const newMessageId = this.getSubDirMessageId(op);\n\n const localOpMetadata: IDeleteSubDirLocalOpMetadata = {\n type: \"deleteSubDir\",\n pendingMessageId: newMessageId,\n subDirectory: subDir,\n };\n this.directory.submitDirectoryMessage(op, localOpMetadata);\n }\n\n /**\n * Submit a subdirectory operation again\n * @param op - The operation\n * @param localOpMetadata - metadata submitted with the op originally\n * @internal\n */\n public resubmitSubDirectoryMessage(op: IDirectorySubDirectoryOperation, localOpMetadata: unknown): void {\n assert(isSubDirLocalOpMetadata(localOpMetadata), 0x32f /* Invalid localOpMetadata for sub directory op */);\n\n // clear the old pending message id\n const pendingMessageIds = this.pendingSubDirectories.get(op.subdirName);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x330 /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingSubDirectories.delete(op.subdirName);\n }\n\n if (localOpMetadata.type === \"createSubDir\") {\n this.submitCreateSubDirectoryMessage(op, localOpMetadata.previouslyExisted);\n } else {\n this.submitDeleteSubDirectoryMessage(op, localOpMetadata.subDirectory);\n }\n }\n\n /**\n * Get the storage of this subdirectory in a serializable format, to be used in snapshotting.\n * @param serializer - The serializer to use to serialize handles in its values.\n * @returns The JSONable string representing the storage of this subdirectory\n * @internal\n */\n public *getSerializedStorage(serializer: IFluidSerializer) {\n this.throwIfDisposed();\n for (const [key, localValue] of this._storage) {\n const value = localValue.makeSerialized(serializer, this.directory.handle);\n const res: [string, ISerializedValue] = [key, value];\n yield res;\n }\n }\n\n /**\n * Populate a key value in this subdirectory's storage, to be used when loading from snapshot.\n * @param key - The key to populate\n * @param localValue - The local value to populate into it\n * @internal\n */\n public populateStorage(key: string, localValue: ILocalValue): void {\n this.throwIfDisposed();\n this._storage.set(key, localValue);\n }\n\n /**\n * Populate a subdirectory into this subdirectory, to be used when loading from snapshot.\n * @param subdirName - The name of the subdirectory to add\n * @param newSubDir - The new subdirectory to add\n * @internal\n */\n public populateSubDirectory(subdirName: string, newSubDir: SubDirectory): void {\n this.throwIfDisposed();\n this._subdirectories.set(subdirName, newSubDir);\n }\n\n /**\n * Retrieve the local value at the given key. This is used to get value type information stashed on the local\n * value so op handlers can be retrieved\n * @param key - The key to retrieve from\n * @returns The local value\n * @internal\n */\n public getLocalValue<T extends ILocalValue = ILocalValue>(key: string): T {\n this.throwIfDisposed();\n return this._storage.get(key) as T;\n }\n\n /**\n * Remove the pendingMessageId from the map tracking it on rollback\n * @param map - map tracking the pending messages\n * @param key - key of the edit in the op\n */\n private rollbackPendingMessageId(map: Map<string, number[]>, key: string, pendingMessageId) {\n const pendingMessageIds = map.get(key);\n const lastPendingMessageId = pendingMessageIds?.pop();\n if (!pendingMessageIds || lastPendingMessageId !== pendingMessageId) {\n throw new Error(\"Rollback op does not match last pending\");\n }\n if (pendingMessageIds.length === 0) {\n map.delete(key);\n }\n }\n\n /**\n * Rollback a local op\n * @param op - The operation to rollback\n * @param localOpMetadata - The local metadata associated with the op.\n */\n public rollback(op: any, localOpMetadata: unknown) {\n if (!isDirectoryLocalOpMetadata(localOpMetadata)) {\n throw new Error(\"Invalid localOpMetadata\");\n }\n\n if (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n localOpMetadata.previousStorage.forEach((localValue, key) => {\n this.setCore(key, localValue, true);\n });\n\n const lastPendingClearId = this.pendingClearMessageIds.pop();\n if (lastPendingClearId === undefined || lastPendingClearId !== localOpMetadata.pendingMessageId) {\n throw new Error(\"Rollback op does match last clear\");\n }\n } else if ((op.type === \"delete\" || op.type === \"set\") && localOpMetadata.type === \"edit\") {\n if (localOpMetadata.previousValue === undefined) {\n this.deleteCore(op.key, true);\n } else {\n this.setCore(op.key, localOpMetadata.previousValue, true);\n }\n\n this.rollbackPendingMessageId(this.pendingKeys, op.key, localOpMetadata.pendingMessageId);\n } else if (op.type === \"createSubDirectory\" && localOpMetadata.type === \"createSubDir\") {\n if (!localOpMetadata.previouslyExisted) {\n this.deleteSubDirectoryCore(op.subdirName, true);\n }\n\n this.rollbackPendingMessageId(this.pendingSubDirectories, op.subdirName, localOpMetadata.pendingMessageId);\n } else if (op.type === \"deleteSubDirectory\" && localOpMetadata.type === \"deleteSubDir\") {\n if (localOpMetadata.subDirectory !== undefined) {\n this.undeleteSubDirectoryTree(localOpMetadata.subDirectory);\n // don't need to register events because deleting never unregistered\n this._subdirectories.set(op.subdirName, localOpMetadata.subDirectory);\n this.emit(\"subDirectoryCreated\", op.subdirName, true, this);\n }\n\n this.rollbackPendingMessageId(this.pendingSubDirectories, op.subdirName, localOpMetadata.pendingMessageId);\n } else {\n throw new Error(\"Unsupported op for rollback\");\n }\n }\n\n /**\n * Converts the given relative path into an absolute path.\n * @param path - Relative path to convert\n * @returns The equivalent absolute path\n */\n private makeAbsolute(relativePath: string): string {\n return posix.resolve(this.absolutePath, relativePath);\n }\n\n /**\n * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n * not process the incoming operation.\n * @param op - Operation to check\n * @param local - Whether the operation originated from the local client\n * @param localOpMetadata - For local client ops, this is the metadata that was submitted with the op.\n * For ops from a remote client, this will be undefined.\n * @returns True if the operation should be processed, false otherwise\n */\n private needProcessStorageOperation(\n op: IDirectoryKeyOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): boolean {\n if (this.pendingClearMessageIds.length > 0) {\n if (local) {\n assert(localOpMetadata !== undefined && isKeyEditLocalOpMetadata(localOpMetadata) &&\n localOpMetadata.pendingMessageId < this.pendingClearMessageIds[0],\n 0x010 /* \"Received out of order storage op when there is an unackd clear message\" */);\n }\n // If I have a NACK clear, we can ignore all ops.\n return false;\n }\n\n const pendingKeyMessageId = this.pendingKeys.get(op.key);\n if (pendingKeyMessageId !== undefined) {\n // Found an NACK op, clear it from the directory if the latest sequence number in the directory\n // match the message's and don't process the op.\n if (local) {\n assert(localOpMetadata !== undefined && isKeyEditLocalOpMetadata(localOpMetadata),\n 0x011 /* pendingMessageId is missing from the local client's operation */);\n const pendingMessageIds = this.pendingKeys.get(op.key);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x331 /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n }\n return false;\n }\n\n // If we don't have a NACK op on the key, we need to process the remote ops.\n return !local;\n }\n\n /**\n * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n * not process the incoming operation.\n * @param op - Operation to check\n * @param local - Whether the message originated from the local client\n * @param message - The message\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation should be processed, false otherwise\n */\n private needProcessSubDirectoryOperation(\n op: IDirectorySubDirectoryOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): boolean {\n const pendingSubDirectoryMessageId = this.pendingSubDirectories.get(op.subdirName);\n if (pendingSubDirectoryMessageId !== undefined) {\n if (local) {\n assert(isSubDirLocalOpMetadata(localOpMetadata),\n 0x012 /* pendingMessageId is missing from the local client's operation */);\n const pendingMessageIds = this.pendingSubDirectories.get(op.subdirName);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x332 /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingSubDirectories.delete(op.subdirName);\n }\n }\n return false;\n }\n\n return !local;\n }\n\n /**\n * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n */\n private clearExceptPendingKeys() {\n // Assuming the pendingKeys is small and the map is large\n // we will get the value for the pendingKeys and clear the map\n const temp = new Map<string, ILocalValue>();\n this.pendingKeys.forEach((value, key, map) => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n temp.set(key, this._storage.get(key)!);\n });\n this.clearCore(false);\n temp.forEach((value, key, map) => {\n this.setCore(key, value, true);\n });\n }\n\n /**\n * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n * @param local - Whether the message originated from the local client\n */\n private clearCore(local: boolean) {\n this._storage.clear();\n this.directory.emit(\"clear\", local, this.directory);\n }\n\n /**\n * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n * @param key - The key being deleted\n * @param local - Whether the message originated from the local client\n * @returns Previous local value of the key if it existed, undefined if it did not exist\n */\n private deleteCore(key: string, local: boolean): ILocalValue | undefined {\n const previousLocalValue = this._storage.get(key);\n const previousValue = previousLocalValue?.value;\n const successfullyRemoved = this._storage.delete(key);\n if (successfullyRemoved) {\n const event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };\n this.directory.emit(\"valueChanged\", event, local, this.directory);\n const containedEvent: IValueChanged = { key, previousValue };\n this.emit(\"containedValueChanged\", containedEvent, local, this);\n }\n return previousLocalValue;\n }\n\n /**\n * Set implementation used for both locally sourced sets as well as incoming remote sets.\n * @param key - The key being set\n * @param value - The value being set\n * @param local - Whether the message originated from the local client\n * @returns Previous local value of the key, if any\n */\n private setCore(key: string, value: ILocalValue, local: boolean): ILocalValue | undefined {\n const previousLocalValue = this._storage.get(key);\n const previousValue = previousLocalValue?.value;\n this._storage.set(key, value);\n const event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };\n this.directory.emit(\"valueChanged\", event, local, this.directory);\n const containedEvent: IValueChanged = { key, previousValue };\n this.emit(\"containedValueChanged\", containedEvent, local, this);\n return previousLocalValue;\n }\n\n /**\n * Create subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n * @param subdirName - The name of the subdirectory being created\n * @param local - Whether the message originated from the local client\n * @returns - True if is newly created, false if it already existed.\n */\n private createSubDirectoryCore(subdirName: string, local: boolean): boolean {\n if (!this._subdirectories.has(subdirName)) {\n const absolutePath = posix.join(this.absolutePath, subdirName);\n const subDir = new SubDirectory(this.directory, this.runtime, this.serializer, absolutePath);\n this.registerEventsOnSubDirectory(subDir, subdirName);\n this._subdirectories.set(subdirName, subDir);\n this.emit(\"subDirectoryCreated\", subdirName, local, this);\n return true;\n }\n return false;\n }\n\n private registerEventsOnSubDirectory(subDirectory: SubDirectory, subDirName: string) {\n subDirectory.on(\"subDirectoryCreated\", (relativePath: string, local: boolean) => {\n this.emit(\"subDirectoryCreated\", posix.join(subDirName, relativePath), local, this);\n });\n subDirectory.on(\"subDirectoryDeleted\", (relativePath: string, local: boolean) => {\n this.emit(\"subDirectoryDeleted\", posix.join(subDirName, relativePath), local, this);\n });\n }\n\n /**\n * Delete subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n * @param subdirName - The name of the subdirectory being deleted\n * @param local - Whether the message originated from the local client\n */\n private deleteSubDirectoryCore(subdirName: string, local: boolean) {\n const previousValue = this._subdirectories.get(subdirName);\n // This should make the subdirectory structure unreachable so it can be GC'd and won't appear in snapshots\n // Might want to consider cleaning out the structure more exhaustively though? But not when rollback.\n if (previousValue !== undefined) {\n this._subdirectories.delete(subdirName);\n this.disposeSubDirectoryTree(previousValue);\n this.emit(\"subDirectoryDeleted\", subdirName, local, this);\n }\n return previousValue;\n }\n\n private disposeSubDirectoryTree(directory: IDirectory | undefined) {\n if (!directory) {\n return;\n }\n // Dispose the subdirectory tree. This will dispose the subdirectories from bottom to top.\n const subDirectories = directory.subdirectories();\n for (const [_, subDirectory] of subDirectories) {\n this.disposeSubDirectoryTree(subDirectory);\n }\n if (typeof directory.dispose === \"function\") {\n directory.dispose();\n }\n }\n\n private undeleteSubDirectoryTree(directory: SubDirectory) {\n // Restore deleted subdirectory tree. This will unmark \"deleted\" from the subdirectories from bottom to top.\n for (const [_, subDirectory] of this._subdirectories.entries()) {\n this.undeleteSubDirectoryTree(subDirectory);\n }\n directory.undispose();\n }\n}\n"]}
package/dist/index.js DELETED
@@ -1,34 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.LocalValueMaker = void 0;
18
- /**
19
- * The `map` package provides interfaces and implementing classes for map-like distributed data structures.
20
- *
21
- * @remarks The following distributed data structures are defined in this package:
22
- *
23
- * - {@link SharedMap}
24
- *
25
- * - {@link SharedDirectory}
26
- *
27
- * @packageDocumentation
28
- */
29
- __exportStar(require("./interfaces"), exports);
30
- __exportStar(require("./map"), exports);
31
- __exportStar(require("./directory"), exports);
32
- var localValues_1 = require("./localValues");
33
- Object.defineProperty(exports, "LocalValueMaker", { enumerable: true, get: function () { return localValues_1.LocalValueMaker; } });
34
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;AAEH;;;;;;;;;;GAUG;AAEH,+CAA6B;AAC7B,wCAAsB;AACtB,8CAA4B;AAC5B,6CAA6D;AAApD,8GAAA,eAAe,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `map` package provides interfaces and implementing classes for map-like distributed data structures.\n *\n * @remarks The following distributed data structures are defined in this package:\n *\n * - {@link SharedMap}\n *\n * - {@link SharedDirectory}\n *\n * @packageDocumentation\n */\n\nexport * from \"./interfaces\";\nexport * from \"./map\";\nexport * from \"./directory\";\nexport { LocalValueMaker, ILocalValue } from \"./localValues\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISharedObject, ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { IDisposable, IEvent, IEventProvider, IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n */\nexport interface IValueChanged {\n /**\n * The key storing the value that changed.\n */\n key: string;\n\n /**\n * The value that was stored at the key prior to the change.\n */\n previousValue: any;\n}\n\n/**\n * Interface describing actions on a directory.\n *\n * @remarks\n * When used as a Map, operates on its keys.\n */\nexport interface IDirectory extends Map<string, any>, IEventProvider<IDirectoryEvents>, Partial<IDisposable> {\n /**\n * The absolute path of the directory.\n */\n readonly absolutePath: string;\n\n /**\n * Retrieves the value stored at the given key from the directory.\n * @param key - Key to retrieve from\n * @returns The stored value, or undefined if the key is not set\n */\n get<T = any>(key: string): T | undefined;\n\n /**\n * Sets the value stored at key to the provided value.\n * @param key - Key to set at\n * @param value - Value to set\n * @returns The IDirectory itself\n */\n set<T = any>(key: string, value: T): this;\n\n /**\n * Get the number of sub directory within the directory.\n * @returns The number of sub directory within a directory.\n */\n countSubDirectory?(): number;\n\n /**\n * Creates an IDirectory child of this IDirectory, or retrieves the existing IDirectory child if one with the\n * same name already exists.\n * @param subdirName - Name of the new child directory to create\n * @returns The IDirectory child that was created or retrieved\n */\n createSubDirectory(subdirName: string): IDirectory;\n\n /**\n * Gets an IDirectory child of this IDirectory, if it exists.\n * @param subdirName - Name of the child directory to get\n * @returns The requested IDirectory\n */\n getSubDirectory(subdirName: string): IDirectory | undefined;\n\n /**\n * Checks whether this directory has a child directory with the given name.\n * @param subdirName - Name of the child directory to check\n * @returns True if it exists, false otherwise\n */\n hasSubDirectory(subdirName: string): boolean;\n\n /**\n * Deletes an IDirectory child of this IDirectory, if it exists, along with all descendent keys and directories.\n * @param subdirName - Name of the child directory to delete\n * @returns True if the IDirectory existed and was deleted, false if it did not exist\n */\n deleteSubDirectory(subdirName: string): boolean;\n\n /**\n * Gets an iterator over the IDirectory children of this IDirectory.\n * @returns The IDirectory iterator\n */\n subdirectories(): IterableIterator<[string, IDirectory]>;\n\n /**\n * Get an IDirectory within the directory, in order to use relative paths from that location.\n * @param relativePath - Path of the IDirectory to get, relative to this IDirectory\n * @returns The requested IDirectory\n */\n getWorkingDirectory(relativePath: string): IDirectory | undefined;\n}\n\n/**\n * Events emitted in response to changes to the directory data. These events only emit on the ISharedDirectory itself,\n * and not on subdirectories.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"valueChanged\"\n *\n * The valueChanged event is emitted when a key is set or deleted. This is emitted for any key in the ISharedDirectory\n * or any subdirectory.\n *\n * #### Listener signature\n *\n * ```typescript\n * (\n * changed: IDirectoryValueChanged,\n * local: boolean,\n * target: IEventThisPlaceHolder,\n * ) => void\n * ```\n * - `changed` - Information on the key that changed, its value prior to the change, and the path to the key that\n * changed.\n *\n * - `local` - Whether the change originated from this client.\n *\n * - `target` - The ISharedDirectory itself.\n *\n * ### \"clear\"\n *\n * The clear event is emitted when the ISharedDirectory is cleared.\n *\n * #### Listener signature\n *\n * ```typescript\n * (local: boolean, target: IEventThisPlaceHolder) => void\n * ```\n * - `local` - Whether the clear originated from this client.\n *\n * - `target` - The ISharedDirectory itself.\n *\n * ### \"subDirectoryCreated\"\n *\n * The subDirectoryCreated event is emitted when a subdirectory is created.\n *\n * #### Listener signature\n *\n * ```typescript\n * (path: string, local: boolean, target: IEventThisPlaceHolder) => void\n * ```\n * - `path` - The relative path to the subdirectory that is created.\n * It is relative from the object which raises the event.\n *\n * - `local` - Whether the create originated from the this client.\n *\n * - `target` - The ISharedDirectory itself.\n *\n * ###\"subDirectoryDeleted\"\n *\n * The subDirectoryDeleted event is emitted when a subdirectory is deleted.\n *\n * #### Listener signature\n *\n * ```typescript\n * (path: string, local: boolean, target: IEventThisPlaceHolder) => void\n * ```\n * - `path` - The relative path to the subdirectory that is deleted.\n * It is relative from the object which raises the event.\n *\n * - `local` - Whether the delete originated from the this client.\n *\n * - `target` - The ISharedDirectory itself.\n */\nexport interface ISharedDirectoryEvents extends ISharedObjectEvents {\n (event: \"valueChanged\", listener: (\n changed: IDirectoryValueChanged,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n (event: \"clear\", listener: (\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n (event: \"subDirectoryCreated\", listener: (\n path: string,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n (event: \"subDirectoryDeleted\", listener: (\n path: string,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n}\n\n/**\n * Events emitted in response to changes to the directory data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"containedValueChanged\"\n *\n * The containedValueChanged event is emitted when a key is set or deleted. As opposed to the SharedDirectory's\n * valueChanged event, this is emitted only on the IDirectory that directly contains the key.\n *\n * #### Listener signature\n *\n * ```typescript\n * (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void\n * ```\n * - `changed` - Information on the key that changed and its value prior to the change.\n *\n * - `local` - Whether the change originated from this client.\n *\n * - `target` - The IDirectory itself.\n *\n * ### \"subDirectoryCreated\"\n *\n * The subDirectoryCreated event is emitted when a subdirectory is created.\n *\n * #### Listener signature\n *\n * ```typescript\n * (path: string, local: boolean, target: IEventThisPlaceHolder) => void\n * ```\n * - `path` - The relative path to the subdirectory that is created.\n * It is relative from the object which raises the event.\n *\n * - `local` - Whether the creation originated from the this client.\n *\n * - `target` - The ISharedDirectory itself.\n *\n * ### \"subDirectoryDeleted\"\n *\n * The subDirectoryDeleted event is emitted when a subdirectory is deleted.\n *\n * #### Listener signature\n *\n * ```typescript\n * (path: string, local: boolean, target: IEventThisPlaceHolder) => void\n * ```\n * - `path` - The relative path to the subdirectory that is deleted.\n * It is relative from the object which raises the event.\n *\n * - `local` - Whether the delete originated from the this client.\n *\n * - `target` - The ISharedDirectory itself.\n *\n * ### \"disposed\"\n *\n * The dispose event is emitted when this sub directory is deleted.\n *\n * #### Listener signature\n *\n * ```typescript\n * (local: boolean, target: IEventThisPlaceHolder) => void\n * ```\n *\n * - `target` - The IDirectory itself.\n */\nexport interface IDirectoryEvents extends IEvent {\n (event: \"containedValueChanged\", listener: (\n changed: IValueChanged,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n (event: \"subDirectoryCreated\", listener: (\n path: string,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n (event: \"subDirectoryDeleted\", listener: (\n path: string,\n local: boolean,\n target: IEventThisPlaceHolder,\n ) => void);\n (event: \"disposed\", listener: (\n target: IEventThisPlaceHolder,\n ) => void);\n}\n\n/**\n * Interface describing a shared directory.\n */\nexport interface ISharedDirectory extends\n ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>,\n Omit<IDirectory, \"on\" | \"once\" | \"off\"> {\n // The Omit type excludes symbols, which we don't want to exclude. Adding them back here manually.\n // https://github.com/microsoft/TypeScript/issues/31671\n [Symbol.iterator](): IterableIterator<[string, any]>;\n readonly [Symbol.toStringTag]: string;\n}\n\n/**\n * Type of \"valueChanged\" event parameter for SharedDirectory.\n */\nexport interface IDirectoryValueChanged extends IValueChanged {\n /**\n * The absolute path to the IDirectory storing the key which changed.\n */\n path: string;\n}\n\n/**\n * Events emitted in response to changes to the map data.\n *\n * @remarks\n *\n * The following is the list of events emitted.\n *\n * ### \"valueChanged\"\n *\n * The valueChanged event is emitted when a key is set or deleted.\n *\n * #### Listener signature\n *\n * ```typescript\n * (\n * changed: IValueChanged,\n * local: boolean,\n * target: IEventThisPlaceHolder,\n * ) => void\n * ```\n * - `changed` - Information on the key that changed and its value prior to the change.\n *\n * - `local` - Whether the change originated from this client.\n *\n * - `target` - The map itself.\n *\n * ### \"clear\"\n *\n * The clear event is emitted when the map is cleared.\n *\n * #### Listener signature\n *\n * ```typescript\n * (local: boolean, target: IEventThisPlaceHolder) => void\n * ```\n * - `local` - Whether the clear originated from this client.\n *\n * - `target` - The map itself.\n */\nexport interface ISharedMapEvents extends ISharedObjectEvents {\n (event: \"valueChanged\", listener: (\n changed: IValueChanged,\n local: boolean,\n target: IEventThisPlaceHolder) => void);\n (event: \"clear\", listener: (\n local: boolean,\n target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * Shared map interface\n */\nexport interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {\n /**\n * Retrieves the given key from the map.\n * @param key - Key to retrieve from\n * @returns The stored value, or undefined if the key is not set\n */\n get<T = any>(key: string): T | undefined;\n\n /**\n * Sets the value stored at key to the provided value.\n * @param key - Key to set at\n * @param value - Value to set\n * @returns The ISharedMap itself\n */\n set<T = any>(key: string, value: T): this;\n}\n\n/**\n * The _ready-for-serialization_ format of values contained in DDS contents. This allows us to use\n * ISerializableValue.type to understand whether they're storing a Plain JS object, a SharedObject, or a value type.\n *\n * @remarks\n *\n * Note that the in-memory equivalent of ISerializableValue is ILocalValue (similarly holding a type, but with\n * the _in-memory representation_ of the value instead). An ISerializableValue is what gets passed to\n * JSON.stringify and comes out of JSON.parse. This format is used both for snapshots (loadCore/populate)\n * and ops (set).\n * If type is Plain, it must be a plain JS object that can survive a JSON.stringify/parse. E.g. a URL object will\n * just get stringified to a URL string and not rehydrate as a URL object on the other side. It may contain members\n * that are ISerializedHandle (the serialized form of a handle).\n * If type is a value type then it must be amongst the types registered via registerValueType or we won't know how\n * to serialize/deserialize it (we rely on its factory via .load() and .store()). Its value will be type-dependent.\n * If type is Shared, then the in-memory value will just be a reference to the SharedObject. Its value will be a\n * channel ID. This type is legacy and deprecated.\n */\nexport interface ISerializableValue {\n /**\n * A type annotation to help indicate how the value serializes.\n */\n type: string;\n\n /**\n * The JSONable representation of the value.\n */\n value: any;\n}\n\nexport interface ISerializedValue {\n /**\n * A type annotation to help indicate how the value serializes.\n */\n type: string;\n\n /**\n * String representation of the value.\n */\n value: string | undefined;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"localValues.js","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAM4C;AAgC5C,SAAgB,gBAAgB,CAC5B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAClB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO;QACH,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;KAChD,CAAC;AACN,CAAC;AAT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AoCC","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 {\n IFluidSerializer,\n ISerializedHandle,\n parseHandles,\n serializeHandles,\n ValueType,\n} from \"@fluidframework/shared-object-base\";\nimport {\n ISerializableValue,\n ISerializedValue,\n} from \"./interfaces\";\n\n/**\n * A local value to be stored in a container type DDS.\n */\nexport interface ILocalValue {\n /**\n * Type indicator of the value stored within.\n */\n readonly type: string;\n\n /**\n * The in-memory value stored within.\n */\n readonly value: any;\n\n /**\n * Retrieve the serialized form of the value stored within.\n * @param serializer - Data store runtime's serializer\n * @param bind - Container type's handle\n * @returns The serialized form of the contained value\n */\n makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue;\n}\n\nexport function makeSerializable(\n localValue: ILocalValue,\n serializer: IFluidSerializer,\n bind: IFluidHandle): ISerializableValue {\n const value = localValue.makeSerialized(serializer, bind);\n return {\n type: value.type,\n value: value.value && JSON.parse(value.value),\n };\n}\n\n/**\n * Manages a contained plain value. May also contain shared object handles.\n */\nexport class PlainLocalValue implements ILocalValue {\n /**\n * Create a new PlainLocalValue.\n * @param value - The value to store, which may contain shared object handles\n */\n constructor(public readonly value: any) {\n }\n\n /**\n * {@inheritDoc ILocalValue.\"type\"}\n */\n public get type(): string {\n return ValueType[ValueType.Plain];\n }\n\n /**\n * {@inheritDoc ILocalValue.makeSerialized}\n */\n public makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue {\n // Stringify to convert to the serialized handle values - and then parse in order to create\n // a POJO for the op\n const value = serializeHandles(this.value, serializer, bind);\n\n return {\n type: this.type,\n value,\n };\n }\n}\n\n/**\n * A LocalValueMaker enables a container type DDS to produce and store local values with minimal awareness of how\n * those objects are stored, serialized, and deserialized.\n */\nexport class LocalValueMaker {\n /**\n * Create a new LocalValueMaker.\n * @param serializer - The serializer to serialize / parse handles.\n */\n constructor(private readonly serializer: IFluidSerializer) {\n }\n\n /**\n * Create a new local value from an incoming serialized value.\n * @param serializable - The serializable value to make local\n */\n public fromSerializable(serializable: ISerializableValue): ILocalValue {\n // Migrate from old shared value to handles\n if (serializable.type === ValueType[ValueType.Shared]) {\n serializable.type = ValueType[ValueType.Plain];\n const handle: ISerializedHandle = {\n type: \"__fluid_handle__\",\n url: serializable.value as string,\n };\n serializable.value = handle;\n }\n\n const translatedValue = parseHandles(serializable.value, this.serializer);\n\n return new PlainLocalValue(translatedValue);\n }\n\n /**\n * Create a new local value containing a given plain object.\n * @param value - The value to store\n * @returns An ILocalValue containing the value\n */\n public fromInMemory(value: any): ILocalValue {\n return new PlainLocalValue(value);\n }\n}\n"]}
package/dist/map.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"map.js","sourceRoot":"","sources":["../src/map.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+EAA8F;AAS9F,+DAA4D;AAC5D,2EAG4C;AAC5C,iEAAmE;AAKnE,2CAAoE;AACpE,qDAA8C;AAO9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAa,UAAU;IAenB;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,UAAU,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,UAAU,CAAC,UAAU,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CACb,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAC9B,MAAM,GAAG,GAAG,IAAI,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEzB,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACrD,MAAM,GAAG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EAAE;gBAClD,MAAM,OAAO,GAAG,MAAM,IAAA,2BAAY,EAA6B,OAAO,EAAE,KAAK,CAAC,CAAC;gBAC/E,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC,CAAC;SACP;aAAM;YACH,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAkC,CAAC,CAAC;SAC5E;IACL,CAAC;IAED;;;OAGG;IACO,YAAY,KAAI,CAAC;IAE3B;;;OAGG;IACO,YAAY,CAAC,OAAY,EAAE,eAAwB;QACzD,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACO,cAAc,CAAC,OAAY;QACjC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACzD,OAAO,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED;;;OAGG;IACO,WAAW,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,EAAE;YACxC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;SAC3E;IACL,CAAC;IAED;;;MAGE;IACO,QAAQ,CAAC,OAAY,EAAE,eAAwB;QACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACnD,CAAC;CACH;AAxRD,8BAwRC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport {\n ISharedMap,\n ISharedMapEvents,\n} from \"./interfaces\";\nimport { IMapDataObjectSerializable, MapKernel } from \"./mapKernel\";\nimport { pkgVersion } from \"./packageVersion\";\n\ninterface IMapSerializationFormat {\n blobs?: string[];\n content: IMapDataObjectSerializable;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * The factory that defines the map.\n * @sealed\n */\nexport class MapFactory implements IChannelFactory {\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public static readonly Type = \"https://graph.microsoft.com/types/map\";\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public static readonly Attributes: IChannelAttributes = {\n type: MapFactory.Type,\n snapshotFormatVersion: \"0.2\",\n packageVersion: pkgVersion,\n };\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n */\n public get type() {\n return MapFactory.Type;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n */\n public get attributes() {\n return MapFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<ISharedMap> {\n const map = new SharedMap(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n */\n public create(runtime: IFluidDataStoreRuntime, id: string): ISharedMap {\n const map = new SharedMap(id, runtime, MapFactory.Attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\n/**\n * The SharedMap distributed data structure can be used to store key-value pairs. It provides the same API for setting\n * and retrieving values that JavaScript developers are accustomed to with the\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map | Map} built-in object.\n * However, the keys of a SharedMap must be strings.\n */\nexport class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {\n /**\n * Create a new shared map.\n * @param runtime - The data store runtime that the new shared map belongs to.\n * @param id - Optional name of the shared map.\n * @returns Newly created shared map.\n *\n * @example\n * To create a `SharedMap`, call the static create method:\n *\n * ```typescript\n * const myMap = SharedMap.create(this.runtime, id);\n * ```\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap {\n return runtime.createChannel(id, MapFactory.Type) as SharedMap;\n }\n\n /**\n * Get a factory for SharedMap to register with the data store.\n * @returns A factory that creates SharedMaps and loads them from storage.\n */\n public static getFactory(): IChannelFactory {\n return new MapFactory();\n }\n\n /**\n * String representation for the class.\n */\n public readonly [Symbol.toStringTag]: string = \"SharedMap\";\n\n /**\n * MapKernel which manages actual map operations.\n */\n private readonly kernel: MapKernel;\n\n /**\n * Do not call the constructor. Instead, you should use the {@link SharedMap.create | create method}.\n *\n * @param id - String identifier.\n * @param runtime - Data store runtime.\n * @param attributes - The attributes for the map.\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes, \"fluid_map_\");\n this.kernel = new MapKernel(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n () => this.isAttached(),\n this,\n );\n }\n\n /**\n * Get an iterator over the keys in this map.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.kernel.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n return this.kernel.entries();\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n return this.kernel.values();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.kernel.entries();\n }\n\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size() {\n return this.kernel.size;\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n this.kernel.forEach(callbackFn);\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n public get<T = any>(key: string): T | undefined {\n return this.kernel.get<T>(key);\n }\n\n /**\n * Check if a key exists in the map.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.kernel.has(key);\n }\n\n /**\n * {@inheritDoc ISharedMap.set}\n */\n public set(key: string, value: any): this {\n this.kernel.set(key, value);\n return this;\n }\n\n /**\n * Delete a key from the map.\n * @param key - Key to delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n public delete(key: string): boolean {\n return this.kernel.delete(key);\n }\n\n /**\n * Clear all data from the map.\n */\n public clear(): void {\n this.kernel.clear();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n * @internal\n */\n protected summarizeCore(\n serializer: IFluidSerializer,\n telemetryContext?: ITelemetryContext,\n ): ISummaryTreeWithStats {\n let currentSize = 0;\n let counter = 0;\n let headerBlob: IMapDataObjectSerializable = {};\n const blobs: string[] = [];\n\n const builder = new SummaryTreeBuilder();\n\n const data = this.kernel.getSerializedStorage(serializer);\n\n // If single property exceeds this size, it goes into its own blob\n const MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n // Maximum blob size for multiple map properties\n // Should be bigger than MinValueSizeSeparateSnapshotBlob\n const MaxSnapshotBlobSize = 16 * 1024;\n\n // Partitioning algorithm:\n // 1) Split large (over MinValueSizeSeparateSnapshotBlob = 8K) properties into their own blobs.\n // Naming (across snapshots) of such blob does not have to be stable across snapshots,\n // As de-duping process (in driver) should not care about paths, only content.\n // 2) Split remaining properties into blobs of MaxSnapshotBlobSize (16K) size.\n // This process does not produce stable partitioning. This means\n // modification (including addition / deletion) of property can shift properties across blobs\n // and result in non-incremental snapshot.\n // This can be improved in the future, without being format breaking change, as loading sequence\n // loads all blobs at once and partitioning schema has no impact on that process.\n for (const key of Object.keys(data)) {\n const value = data[key];\n if (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n const blobName = `blob${counter}`;\n counter++;\n blobs.push(blobName);\n const content: IMapDataObjectSerializable = {\n [key]: {\n type: value.type,\n value: JSON.parse(value.value),\n },\n };\n builder.addBlob(blobName, JSON.stringify(content));\n } else {\n currentSize += value.type.length + 21; // Approximation cost of property header\n if (value.value) {\n currentSize += value.value.length;\n }\n\n if (currentSize > MaxSnapshotBlobSize) {\n const blobName = `blob${counter}`;\n counter++;\n blobs.push(blobName);\n builder.addBlob(blobName, JSON.stringify(headerBlob));\n headerBlob = {};\n currentSize = 0;\n }\n headerBlob[key] = {\n type: value.type,\n value: value.value === undefined ? undefined : JSON.parse(value.value),\n };\n }\n }\n\n const header: IMapSerializationFormat = {\n blobs,\n content: headerBlob,\n };\n builder.addBlob(snapshotFileName, JSON.stringify(header));\n\n return builder.getSummaryTree();\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n * @internal\n */\n protected async loadCore(storage: IChannelStorageService) {\n const json = await readAndParse<object>(storage, snapshotFileName);\n const newFormat = json as IMapSerializationFormat;\n if (Array.isArray(newFormat.blobs)) {\n this.kernel.populateFromSerializable(newFormat.content);\n await Promise.all(newFormat.blobs.map(async (value) => {\n const content = await readAndParse<IMapDataObjectSerializable>(storage, value);\n this.kernel.populateFromSerializable(content);\n }));\n } else {\n this.kernel.populateFromSerializable(json as IMapDataObjectSerializable);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n * @internal\n */\n protected onDisconnect() {}\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n * @internal\n */\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.kernel.trySubmitMessage(content, localOpMetadata);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n * @internal\n */\n protected applyStashedOp(content: any): unknown {\n this.kernel.tryProcessMessage(content, false, undefined);\n return this.kernel.tryGetStashedOpLocalMetadata(content);\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n * @internal\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (message.type === MessageType.Operation) {\n this.kernel.tryProcessMessage(message.contents, local, localOpMetadata);\n }\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n * @internal\n */\n protected rollback(content: any, localOpMetadata: unknown) {\n this.kernel.rollback(content, localOpMetadata);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapKernel.js","sourceRoot":"","sources":["../src/mapKernel.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAAiF;AACjF,+DAAyE;AAMzE,+CAIuB;AAoHvB,SAAS,uBAAuB,CAAC,QAAa;IAC1C,OAAO,QAAQ,KAAK,SAAS,IAAI,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ;QAC1E,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,IAAI,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,sBAAsB,CAAC,QAAa;IACzC,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,QAAQ,CAAC,gBAAgB,KAAK,QAAQ,CAAC;AAChH,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAa;IACvC,OAAO,QAAQ,KAAK,SAAS,IAAI,OAAO,QAAQ,CAAC,gBAAgB,KAAK,Q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yC,CAAC,CAAC;QACrD,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC1B,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;SACnC;QAED,kFAAkF;QAClF,MAAM,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACrD,MAAM,aAAa,GAAG,eAAe,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;YACnD,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,CAAC,aAAa,EAAE,CAAC,CAAC;YAClF,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;QACtC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC1C,CAAC;CACJ;AA9mBD,8BA8mBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { IFluidSerializer, ValueType } from \"@fluidframework/shared-object-base\";\nimport { assert, TypedEventEmitter } from \"@fluidframework/common-utils\";\nimport {\n ISerializableValue,\n ISerializedValue,\n ISharedMapEvents,\n} from \"./interfaces\";\nimport {\n ILocalValue,\n LocalValueMaker,\n makeSerializable,\n} from \"./localValues\";\n\n/**\n * Defines the means to process and submit a given op on a map.\n */\ninterface IMapMessageHandler {\n /**\n * Apply the given operation.\n * @param op - The map operation to apply\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n process(\n op: IMapOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): void;\n\n /**\n * Communicate the operation to remote clients.\n * @param op - The map operation to submit\n * @param localOpMetadata - The metadata to be submitted with the message.\n */\n submit(op: IMapOperation, localOpMetadata: unknown): void;\n\n getStashedOpLocalMetadata(op: IMapOperation): unknown;\n}\n\n/**\n * Operation indicating a value should be set for a key.\n */\nexport interface IMapSetOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"set\";\n\n /**\n * Map key being modified.\n */\n key: string;\n\n /**\n * Value to be set on the key.\n */\n value: ISerializableValue;\n}\n\n/**\n * Operation indicating a key should be deleted from the map.\n */\nexport interface IMapDeleteOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"delete\";\n\n /**\n * Map key being modified.\n */\n key: string;\n}\n\n/**\n * Map key operations are one of several types.\n */\nexport type IMapKeyOperation = IMapSetOperation | IMapDeleteOperation;\n\n/**\n * Operation indicating the map should be cleared.\n */\nexport interface IMapClearOperation {\n /**\n * String identifier of the operation type.\n */\n type: \"clear\";\n}\n\n/**\n * Description of a map delta operation\n */\nexport type IMapOperation = IMapKeyOperation | IMapClearOperation;\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n * Directly used in JSON.stringify, direct result from JSON.parse\n */\nexport interface IMapDataObjectSerializable {\n [key: string]: ISerializableValue;\n}\n\nexport interface IMapDataObjectSerialized {\n [key: string]: ISerializedValue;\n}\n\ninterface IMapKeyEditLocalOpMetadata {\n type: \"edit\";\n pendingMessageId: number;\n previousValue?: ILocalValue;\n}\n\ninterface IMapKeyAddLocalOpMetadata {\n type: \"add\";\n pendingMessageId: number;\n}\n\ninterface IMapClearLocalOpMetadata {\n type: \"clear\";\n pendingMessageId: number;\n previousMap?: Map<string, ILocalValue>;\n}\n\ntype MapKeyLocalOpMetadata = IMapKeyEditLocalOpMetadata | IMapKeyAddLocalOpMetadata;\ntype MapLocalOpMetadata = IMapClearLocalOpMetadata | MapKeyLocalOpMetadata;\n\nfunction isMapKeyLocalOpMetadata(metadata: any): metadata is MapKeyLocalOpMetadata {\n return metadata !== undefined && typeof metadata.pendingMessageId === \"number\" &&\n (metadata.type === \"add\" || metadata.type === \"edit\");\n}\n\nfunction isClearLocalOpMetadata(metadata: any): metadata is IMapClearLocalOpMetadata {\n return metadata !== undefined && metadata.type === \"clear\" && typeof metadata.pendingMessageId === \"number\";\n}\n\nfunction isMapLocalOpMetadata(metadata: any): metadata is MapLocalOpMetadata {\n return metadata !== undefined && typeof metadata.pendingMessageId === \"number\" &&\n (metadata.type === \"add\" || metadata.type === \"edit\" || metadata.type === \"clear\");\n}\n\n/**\n * A SharedMap is a map-like distributed data structure.\n */\nexport class MapKernel {\n /**\n * The number of key/value pairs stored in the map.\n */\n public get size(): number {\n return this.data.size;\n }\n\n /**\n * Mapping of op types to message handlers.\n */\n private readonly messageHandlers: ReadonlyMap<string, IMapMessageHandler> = new Map();\n\n /**\n * The in-memory data the map is storing.\n */\n private readonly data = new Map<string, ILocalValue>();\n\n /**\n * Keys that have been modified locally but not yet ack'd from the server.\n */\n private readonly pendingKeys: Map<string, number[]> = new Map();\n\n /**\n * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.\n */\n private pendingMessageId: number = -1;\n\n /**\n * The pending ids of any clears that have been performed locally but not yet ack'd from the server\n */\n private readonly pendingClearMessageIds: number[] = [];\n\n /**\n * Object to create encapsulations of the values stored in the map.\n */\n private readonly localValueMaker: LocalValueMaker;\n\n /**\n * Create a new shared map kernel.\n * @param serializer - The serializer to serialize / parse handles\n * @param handle - The handle of the shared object using the kernel\n * @param submitMessage - A callback to submit a message through the shared object\n * @param isAttached - To query whether the shared object should generate ops\n * @param valueTypes - The value types to register\n * @param eventEmitter - The object that will emit map events\n */\n constructor(\n private readonly serializer: IFluidSerializer,\n private readonly handle: IFluidHandle,\n private readonly submitMessage: (op: any, localOpMetadata: unknown) => void,\n private readonly isAttached: () => boolean,\n private readonly eventEmitter: TypedEventEmitter<ISharedMapEvents>,\n ) {\n this.localValueMaker = new LocalValueMaker(serializer);\n this.messageHandlers = this.getMessageHandlers();\n }\n\n /**\n * Get an iterator over the keys in this map.\n * @returns The iterator\n */\n public keys(): IterableIterator<string> {\n return this.data.keys();\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public entries(): IterableIterator<[string, any]> {\n const localEntriesIterator = this.data.entries();\n const iterator = {\n next(): IteratorResult<[string, any]> {\n const nextVal = localEntriesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: [nextVal.value[0], nextVal.value[1].value], done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the values in this map.\n * @returns The iterator\n */\n public values(): IterableIterator<any> {\n const localValuesIterator = this.data.values();\n const iterator = {\n next(): IteratorResult<any> {\n const nextVal = localValuesIterator.next();\n if (nextVal.done) {\n return { value: undefined, done: true };\n } else {\n // Unpack the stored value\n return { value: nextVal.value.value, done: false };\n }\n },\n [Symbol.iterator]() {\n return this;\n },\n };\n return iterator;\n }\n\n /**\n * Get an iterator over the entries in this map.\n * @returns The iterator\n */\n public [Symbol.iterator](): IterableIterator<[string, any]> {\n return this.entries();\n }\n\n /**\n * Executes the given callback on each entry in the map.\n * @param callbackFn - Callback function\n */\n public forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void {\n this.data.forEach((localValue, key, m) => {\n callbackFn(localValue.value, key, m);\n });\n }\n\n /**\n * {@inheritDoc ISharedMap.get}\n */\n public get<T = any>(key: string): T | undefined {\n const localValue = this.data.get(key);\n return localValue === undefined ? undefined : localValue.value as T;\n }\n\n /**\n * Check if a key exists in the map.\n * @param key - The key to check\n * @returns True if the key exists, false otherwise\n */\n public has(key: string): boolean {\n return this.data.has(key);\n }\n\n /**\n * {@inheritDoc ISharedMap.set}\n */\n public set(key: string, value: any) {\n // Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n if (key === undefined || key === null) {\n throw new Error(\"Undefined and null keys are not supported\");\n }\n\n // Create a local value and serialize it.\n const localValue = this.localValueMaker.fromInMemory(value);\n const serializableValue = makeSerializable(\n localValue,\n this.serializer,\n this.handle);\n\n // Set the value locally.\n const previousValue = this.setCore(\n key,\n localValue,\n true,\n );\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IMapSetOperation = {\n key,\n type: \"set\",\n value: serializableValue,\n };\n this.submitMapKeyMessage(op, previousValue);\n }\n\n /**\n * Delete a key from the map.\n * @param key - Key to delete\n * @returns True if the key existed and was deleted, false if it did not exist\n */\n public delete(key: string): boolean {\n // Delete the key locally first.\n const previousValue = this.deleteCore(key, true);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return previousValue !== undefined;\n }\n\n const op: IMapDeleteOperation = {\n key,\n type: \"delete\",\n };\n this.submitMapKeyMessage(op, previousValue);\n\n return previousValue !== undefined;\n }\n\n /**\n * Clear all data from the map.\n */\n public clear(): void {\n const copy = this.isAttached() ? new Map<string, ILocalValue>(this.data) : undefined;\n\n // Clear the data locally first.\n this.clearCore(true);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IMapClearOperation = {\n type: \"clear\",\n };\n this.submitMapClearMessage(op, copy);\n }\n\n /**\n * Serializes the data stored in the shared map to a JSON string\n * @param serializer - The serializer to use to serialize handles in its values.\n * @returns A JSON string containing serialized map data\n */\n public getSerializedStorage(serializer: IFluidSerializer): IMapDataObjectSerialized {\n const serializableMapData: IMapDataObjectSerialized = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = localValue.makeSerialized(serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public getSerializableStorage(serializer: IFluidSerializer): IMapDataObjectSerializable {\n const serializableMapData: IMapDataObjectSerializable = {};\n this.data.forEach((localValue, key) => {\n serializableMapData[key] = makeSerializable(localValue, serializer, this.handle);\n });\n return serializableMapData;\n }\n\n public serialize(serializer: IFluidSerializer): string {\n return JSON.stringify(this.getSerializableStorage(serializer));\n }\n\n /**\n * Populate the kernel with the given map data.\n * @param data - A JSON string containing serialized map data\n */\n public populateFromSerializable(json: IMapDataObjectSerializable): void {\n for (const [key, serializable] of Object.entries(json)) {\n const localValue = {\n key,\n value: this.makeLocal(key, serializable),\n };\n\n this.data.set(localValue.key, localValue.value);\n }\n }\n\n public populate(json: string): void {\n this.populateFromSerializable(JSON.parse(json) as IMapDataObjectSerializable);\n }\n\n /**\n * Submit the given op if a handler is registered.\n * @param op - The operation to attempt to submit\n * @param localOpMetadata - The local metadata associated with the op. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n * @returns True if the operation was submitted, false otherwise.\n */\n public trySubmitMessage(op: any, localOpMetadata: unknown): boolean {\n const handler = this.messageHandlers.get(op.type);\n if (handler === undefined) {\n return false;\n }\n handler.submit(op as IMapOperation, localOpMetadata);\n return true;\n }\n\n public tryGetStashedOpLocalMetadata(op: any): unknown {\n const handler = this.messageHandlers.get(op.type);\n if (handler === undefined) {\n throw new Error(\"no apply stashed op handler\");\n }\n return handler.getStashedOpLocalMetadata(op as IMapOperation);\n }\n\n /**\n * Process the given op if a handler is registered.\n * @param op - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation was processed, false otherwise.\n */\n public tryProcessMessage(\n op: IMapOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): boolean {\n const handler = this.messageHandlers.get(op.type);\n if (handler === undefined) {\n return false;\n }\n handler.process(op, local, localOpMetadata);\n return true;\n }\n\n /**\n * Rollback a local op\n * @param op - The operation to rollback\n * @param localOpMetadata - The local metadata associated with the op.\n */\n public rollback(op: any, localOpMetadata: unknown) {\n if (!isMapLocalOpMetadata(localOpMetadata)) {\n throw new Error(\"Invalid localOpMetadata\");\n }\n\n if (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n if (localOpMetadata.previousMap === undefined) {\n throw new Error(\"Cannot rollback without previous map\");\n }\n localOpMetadata.previousMap.forEach((localValue, key) => {\n this.setCore(key, localValue, true);\n });\n\n const lastPendingClearId = this.pendingClearMessageIds.pop();\n if (lastPendingClearId === undefined || lastPendingClearId !== localOpMetadata.pendingMessageId) {\n throw new Error(\"Rollback op does match last clear\");\n }\n } else if (op.type === \"delete\" || op.type === \"set\") {\n if (localOpMetadata.type === \"add\") {\n this.deleteCore(op.key, true);\n } else if (localOpMetadata.type === \"edit\" && localOpMetadata.previousValue !== undefined) {\n this.setCore(op.key, localOpMetadata.previousValue, true);\n } else {\n throw new Error(\"Cannot rollback without previous value\");\n }\n\n const pendingMessageIds = this.pendingKeys.get(op.key);\n const lastPendingMessageId = pendingMessageIds?.pop();\n if (!pendingMessageIds || lastPendingMessageId !== localOpMetadata.pendingMessageId) {\n throw new Error(\"Rollback op does not match last pending\");\n }\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n } else {\n throw new Error(\"Unsupported op for rollback\");\n }\n }\n\n /**\n * Set implementation used for both locally sourced sets as well as incoming remote sets.\n * @param key - The key being set\n * @param value - The value being set\n * @param local - Whether the message originated from the local client\n * @returns Previous local value of the key, if any\n */\n private setCore(key: string, value: ILocalValue, local: boolean): ILocalValue | undefined {\n const previousLocalValue = this.data.get(key);\n const previousValue = previousLocalValue?.value;\n this.data.set(key, value);\n this.eventEmitter.emit(\"valueChanged\", { key, previousValue }, local, this.eventEmitter);\n return previousLocalValue;\n }\n\n /**\n * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n * @param local - Whether the message originated from the local client\n */\n private clearCore(local: boolean): void {\n this.data.clear();\n this.eventEmitter.emit(\"clear\", local, this.eventEmitter);\n }\n\n /**\n * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n * @param key - The key being deleted\n * @param local - Whether the message originated from the local client\n * @returns Previous local value of the key if it existed, undefined if it did not exist\n */\n private deleteCore(key: string, local: boolean): ILocalValue | undefined {\n const previousLocalValue = this.data.get(key);\n const previousValue = previousLocalValue?.value;\n const successfullyRemoved = this.data.delete(key);\n if (successfullyRemoved) {\n this.eventEmitter.emit(\"valueChanged\", { key, previousValue }, local, this.eventEmitter);\n }\n return previousLocalValue;\n }\n\n /**\n * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n */\n private clearExceptPendingKeys(): void {\n // Assuming the pendingKeys is small and the map is large\n // we will get the value for the pendingKeys and clear the map\n const temp = new Map<string, ILocalValue>();\n this.pendingKeys.forEach((value, key) => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n temp.set(key, this.data.get(key)!);\n });\n this.clearCore(false);\n temp.forEach((value, key) => {\n this.setCore(key, value, true);\n });\n }\n\n /**\n * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will\n * have the information we need to create a real object, but will not be the real object yet. For example,\n * we might know it's a map and the map's ID but not have the actual map or its data yet. makeLocal's\n * job is to convert that information into a real object for local usage.\n * @param key - The key that the caller intends to store the local value into (used for ops later). But\n * doesn't actually store the local value into that key. So better not lie!\n * @param serializable - The remote information that we can convert into a real object\n * @returns The local value that was produced\n */\n private makeLocal(key: string, serializable: ISerializableValue): ILocalValue {\n if (serializable.type === ValueType[ValueType.Plain] || serializable.type === ValueType[ValueType.Shared]) {\n return this.localValueMaker.fromSerializable(serializable);\n } else {\n throw new Error(\"Unknown local value type\");\n }\n }\n\n /**\n * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n * not process the incoming operation.\n * @param op - Operation to check\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n * @returns True if the operation should be processed, false otherwise\n */\n private needProcessKeyOperation(\n op: IMapKeyOperation,\n local: boolean,\n localOpMetadata: unknown,\n ): boolean {\n if (this.pendingClearMessageIds.length > 0) {\n if (local) {\n assert(localOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata) &&\n localOpMetadata.pendingMessageId < this.pendingClearMessageIds[0],\n 0x013 /* \"Received out of order op when there is an unackd clear message\" */);\n }\n // If we have an unack'd clear, we can ignore all ops.\n return false;\n }\n\n const pendingKeyMessageId = this.pendingKeys.get(op.key);\n if (pendingKeyMessageId !== undefined) {\n // Found an unack'd op. Clear it from the map if the pendingMessageId in the map matches this message's\n // and don't process the op.\n if (local) {\n assert(localOpMetadata !== undefined && isMapKeyLocalOpMetadata(localOpMetadata),\n 0x014 /* pendingMessageId is missing from the local client's operation */);\n const pendingMessageIds = this.pendingKeys.get(op.key);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x2fa /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n }\n return false;\n }\n\n // If we don't have a NACK op on the key, we need to process the remote ops.\n return !local;\n }\n\n /**\n * Get the message handlers for the map.\n * @returns A map of string op names to IMapMessageHandlers for those ops\n */\n private getMessageHandlers() {\n const messageHandlers = new Map<string, IMapMessageHandler>();\n messageHandlers.set(\n \"clear\",\n {\n process: (op: IMapClearOperation, local, localOpMetadata) => {\n if (local) {\n assert(isClearLocalOpMetadata(localOpMetadata),\n 0x015 /* \"pendingMessageId is missing from the local client's clear operation\" */);\n const pendingClearMessageId = this.pendingClearMessageIds.shift();\n assert(pendingClearMessageId === localOpMetadata.pendingMessageId,\n 0x2fb /* pendingMessageId does not match */);\n return;\n }\n if (this.pendingKeys.size !== 0) {\n this.clearExceptPendingKeys();\n return;\n }\n this.clearCore(local);\n },\n submit: (op: IMapClearOperation, localOpMetadata: unknown) => {\n assert(isClearLocalOpMetadata(localOpMetadata), 0x2fc /* Invalid localOpMetadata for clear */);\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const pendingClearMessageId = this.pendingClearMessageIds.shift();\n assert(pendingClearMessageId === localOpMetadata.pendingMessageId,\n 0x2fd /* pendingMessageId does not match */);\n this.submitMapClearMessage(op, localOpMetadata.previousMap);\n },\n getStashedOpLocalMetadata: (op: IMapClearOperation) => {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n return { type: \"clear\", pendingMessageId: this.getMapClearMessageId() };\n },\n });\n messageHandlers.set(\n \"delete\",\n {\n process: (op: IMapDeleteOperation, local, localOpMetadata) => {\n if (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n return;\n }\n this.deleteCore(op.key, local);\n },\n submit: (op: IMapDeleteOperation, localOpMetadata: unknown) => {\n this.resubmitMapKeyMessage(op, localOpMetadata);\n },\n getStashedOpLocalMetadata: (op: IMapDeleteOperation) => {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n return { type: \"edit\", pendingMessageId: this.getMapKeyMessageId(op) };\n },\n });\n messageHandlers.set(\n \"set\",\n {\n process: (op: IMapSetOperation, local, localOpMetadata) => {\n if (!this.needProcessKeyOperation(op, local, localOpMetadata)) {\n return;\n }\n\n // needProcessKeyOperation should have returned false if local is true\n const context = this.makeLocal(op.key, op.value);\n this.setCore(op.key, context, local);\n },\n submit: (op: IMapSetOperation, localOpMetadata: unknown) => {\n this.resubmitMapKeyMessage(op, localOpMetadata);\n },\n getStashedOpLocalMetadata: (op: IMapSetOperation) => {\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n return { type: \"edit\", pendingMessageId: this.getMapKeyMessageId(op) };\n },\n });\n\n return messageHandlers;\n }\n\n private getMapClearMessageId(): number {\n const pendingMessageId = ++this.pendingMessageId;\n this.pendingClearMessageIds.push(pendingMessageId);\n return pendingMessageId;\n }\n\n /**\n * Submit a clear message to remote clients.\n * @param op - The clear message\n */\n private submitMapClearMessage(op: IMapClearOperation, previousMap?: Map<string, ILocalValue>): void {\n const metadata = { type: \"clear\", pendingMessageId: this.getMapClearMessageId(), previousMap };\n this.submitMessage(op, metadata);\n }\n\n private getMapKeyMessageId(op: IMapKeyOperation): number {\n const pendingMessageId = ++this.pendingMessageId;\n const pendingMessageIds = this.pendingKeys.get(op.key);\n if (pendingMessageIds !== undefined) {\n pendingMessageIds.push(pendingMessageId);\n } else {\n this.pendingKeys.set(op.key, [pendingMessageId]);\n }\n return pendingMessageId;\n }\n\n /**\n * Submit a map key message to remote clients.\n * @param op - The map key message\n * @param previousValue - The value of the key before this op\n */\n private submitMapKeyMessage(op: IMapKeyOperation, previousValue?: ILocalValue): void {\n const pendingMessageId = this.getMapKeyMessageId(op);\n const localMetadata = previousValue ?\n { type: \"edit\", pendingMessageId, previousValue } :\n { type: \"add\", pendingMessageId };\n this.submitMessage(op, localMetadata);\n }\n\n /**\n * Submit a map key message to remote clients based on a previous submit.\n * @param op - The map key message\n * @param localOpMetadata - Metadata from the previous submit\n */\n private resubmitMapKeyMessage(op: IMapKeyOperation, localOpMetadata: unknown): void {\n assert(isMapKeyLocalOpMetadata(localOpMetadata), 0x2fe /* Invalid localOpMetadata in submit */);\n\n // clear the old pending message id\n const pendingMessageIds = this.pendingKeys.get(op.key);\n assert(pendingMessageIds !== undefined && pendingMessageIds[0] === localOpMetadata.pendingMessageId,\n 0x2ff /* Unexpected pending message received */);\n pendingMessageIds.shift();\n if (pendingMessageIds.length === 0) {\n this.pendingKeys.delete(op.key);\n }\n\n // We don't reuse the metadata pendingMessageId but send a new one on each submit.\n const pendingMessageId = this.getMapKeyMessageId(op);\n const localMetadata = localOpMetadata.type === \"edit\" ?\n { type: \"edit\", pendingMessageId, previousValue: localOpMetadata.previousValue } :\n { type: \"add\", pendingMessageId };\n this.submitMessage(op, localMetadata);\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,qBAAqB,CAAC;AAChC,QAAA,UAAU,GAAG,cAAc,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 = \"1.4.0-121020\";\n"]}