@fluidframework/map 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +9 -1
  4. package/api-report/map.api.md +42 -44
  5. package/dist/{directory.js → directory.cjs} +228 -41
  6. package/dist/directory.cjs.map +1 -0
  7. package/dist/directory.d.ts +499 -38
  8. package/dist/directory.d.ts.map +1 -1
  9. package/dist/{index.js → index.cjs} +4 -4
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/{interfaces.js → interfaces.cjs} +1 -1
  12. package/dist/interfaces.cjs.map +1 -0
  13. package/dist/interfaces.d.ts +10 -20
  14. package/dist/interfaces.d.ts.map +1 -1
  15. package/dist/{internalInterfaces.js → internalInterfaces.cjs} +1 -1
  16. package/dist/internalInterfaces.cjs.map +1 -0
  17. package/dist/{localValues.js → localValues.cjs} +2 -3
  18. package/dist/localValues.cjs.map +1 -0
  19. package/dist/localValues.d.ts +2 -4
  20. package/dist/localValues.d.ts.map +1 -1
  21. package/dist/map-alpha.d.ts +979 -0
  22. package/dist/map-beta.d.ts +119 -0
  23. package/dist/map-public.d.ts +119 -0
  24. package/dist/map-untrimmed.d.ts +993 -0
  25. package/dist/{map.js → map.cjs} +5 -13
  26. package/dist/map.cjs.map +1 -0
  27. package/dist/map.d.ts +2 -10
  28. package/dist/map.d.ts.map +1 -1
  29. package/dist/{mapKernel.js → mapKernel.cjs} +2 -2
  30. package/dist/mapKernel.cjs.map +1 -0
  31. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  32. package/dist/packageVersion.cjs.map +1 -0
  33. package/dist/packageVersion.d.ts +1 -1
  34. package/dist/tsdoc-metadata.json +1 -1
  35. package/lib/directory.d.ts +499 -38
  36. package/lib/directory.d.ts.map +1 -1
  37. package/lib/{directory.js → directory.mjs} +228 -41
  38. package/lib/directory.mjs.map +1 -0
  39. package/lib/index.d.ts +4 -15
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.mjs +8 -0
  42. package/lib/index.mjs.map +1 -0
  43. package/lib/interfaces.d.ts +10 -20
  44. package/lib/interfaces.d.ts.map +1 -1
  45. package/lib/{interfaces.js → interfaces.mjs} +1 -1
  46. package/lib/interfaces.mjs.map +1 -0
  47. package/lib/internalInterfaces.d.ts +2 -2
  48. package/lib/internalInterfaces.d.ts.map +1 -1
  49. package/lib/{internalInterfaces.js → internalInterfaces.mjs} +1 -1
  50. package/{dist/internalInterfaces.js.map → lib/internalInterfaces.mjs.map} +1 -1
  51. package/lib/localValues.d.ts +3 -5
  52. package/lib/localValues.d.ts.map +1 -1
  53. package/lib/{localValues.js → localValues.mjs} +2 -3
  54. package/lib/localValues.mjs.map +1 -0
  55. package/lib/map-alpha.d.ts +979 -0
  56. package/lib/map-beta.d.ts +119 -0
  57. package/lib/map-public.d.ts +119 -0
  58. package/lib/map-untrimmed.d.ts +993 -0
  59. package/lib/map.d.ts +3 -11
  60. package/lib/map.d.ts.map +1 -1
  61. package/lib/{map.js → map.mjs} +5 -13
  62. package/lib/map.mjs.map +1 -0
  63. package/lib/mapKernel.d.ts +2 -2
  64. package/lib/mapKernel.d.ts.map +1 -1
  65. package/lib/{mapKernel.js → mapKernel.mjs} +2 -2
  66. package/lib/mapKernel.mjs.map +1 -0
  67. package/lib/packageVersion.d.ts +1 -1
  68. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  69. package/lib/packageVersion.mjs.map +1 -0
  70. package/map.test-files.tar +0 -0
  71. package/package.json +54 -33
  72. package/src/directory.ts +280 -62
  73. package/src/interfaces.ts +10 -20
  74. package/src/localValues.ts +2 -4
  75. package/src/map.ts +2 -10
  76. package/src/packageVersion.ts +1 -1
  77. package/tsc-multi.test.json +4 -0
  78. package/tsconfig.json +6 -5
  79. package/dist/directory.js.map +0 -1
  80. package/dist/index.js.map +0 -1
  81. package/dist/interfaces.js.map +0 -1
  82. package/dist/localValues.js.map +0 -1
  83. package/dist/map.js.map +0 -1
  84. package/dist/mapKernel.js.map +0 -1
  85. package/dist/packageVersion.js.map +0 -1
  86. package/lib/directory.js.map +0 -1
  87. package/lib/index.js +0 -19
  88. package/lib/index.js.map +0 -1
  89. package/lib/interfaces.js.map +0 -1
  90. package/lib/internalInterfaces.js.map +0 -1
  91. package/lib/localValues.js.map +0 -1
  92. package/lib/map.js.map +0 -1
  93. package/lib/mapKernel.js.map +0 -1
  94. package/lib/packageVersion.js.map +0 -1
  95. package/tsconfig.esnext.json +0 -7
package/src/interfaces.ts CHANGED
@@ -13,8 +13,7 @@ import {
13
13
 
14
14
  /**
15
15
  * Type of "valueChanged" event parameter.
16
- *
17
- * @public
16
+ * @alpha
18
17
  */
19
18
  export interface IValueChanged {
20
19
  /**
@@ -34,8 +33,7 @@ export interface IValueChanged {
34
33
  * Interface describing actions on a directory.
35
34
  *
36
35
  * @remarks When used as a Map, operates on its keys.
37
- *
38
- * @public
36
+ * @alpha
39
37
  */
40
38
  // TODO: Use `unknown` instead (breaking change).
41
39
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -119,8 +117,7 @@ export interface IDirectory
119
117
  *
120
118
  * @remarks
121
119
  * These events only emit on the {@link ISharedDirectory} itself, and not on subdirectories.
122
- *
123
- * @public
120
+ * @alpha
124
121
  */
125
122
  export interface ISharedDirectoryEvents extends ISharedObjectEvents {
126
123
  /**
@@ -193,8 +190,7 @@ export interface ISharedDirectoryEvents extends ISharedObjectEvents {
193
190
 
194
191
  /**
195
192
  * Events emitted in response to changes to the directory data.
196
- *
197
- * @public
193
+ * @alpha
198
194
  */
199
195
  export interface IDirectoryEvents extends IEvent {
200
196
  /**
@@ -275,8 +271,7 @@ export interface IDirectoryEvents extends IEvent {
275
271
  * Provides a hierarchical organization of map-like data structures as SubDirectories.
276
272
  * The values stored within can be accessed like a map, and the hierarchy can be navigated using path syntax.
277
273
  * SubDirectories can be retrieved for use as working directories.
278
- *
279
- * @public
274
+ * @alpha
280
275
  */
281
276
  export interface ISharedDirectory
282
277
  extends ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>,
@@ -291,8 +286,7 @@ export interface ISharedDirectory
291
286
 
292
287
  /**
293
288
  * Type of "valueChanged" event parameter for {@link ISharedDirectory}.
294
- *
295
- * @public
289
+ * @alpha
296
290
  */
297
291
  export interface IDirectoryValueChanged extends IValueChanged {
298
292
  /**
@@ -303,8 +297,7 @@ export interface IDirectoryValueChanged extends IValueChanged {
303
297
 
304
298
  /**
305
299
  * Events emitted in response to changes to the {@link ISharedMap | map} data.
306
- *
307
- * @public
300
+ * @alpha
308
301
  */
309
302
  export interface ISharedMapEvents extends ISharedObjectEvents {
310
303
  /**
@@ -343,8 +336,7 @@ export interface ISharedMapEvents extends ISharedObjectEvents {
343
336
  * {@link @fluidframework/datastore#FluidObjectHandle}.
344
337
  *
345
338
  * For more information, including example usages, see {@link https://fluidframework.com/docs/data-structures/map/}.
346
- *
347
- * @public
339
+ * @alpha
348
340
  */
349
341
  // TODO: Use `unknown` instead (breaking change).
350
342
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -389,8 +381,7 @@ export interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string,
389
381
  * channel ID.
390
382
  *
391
383
  * @deprecated This type is legacy and deprecated.
392
- *
393
- * @public
384
+ * @alpha
394
385
  */
395
386
  export interface ISerializableValue {
396
387
  /**
@@ -407,8 +398,7 @@ export interface ISerializableValue {
407
398
 
408
399
  /**
409
400
  * Serialized {@link ISerializableValue} counterpart.
410
- *
411
- * @public
401
+ * @alpha
412
402
  */
413
403
  export interface ISerializedValue {
414
404
  /**
@@ -16,8 +16,7 @@ import { ISerializableValue, ISerializedValue } from "./interfaces";
16
16
 
17
17
  /**
18
18
  * A local value to be stored in a container type Distributed Data Store (DDS).
19
- *
20
- * @public
19
+ * @alpha
21
20
  */
22
21
  export interface ILocalValue {
23
22
  /**
@@ -99,8 +98,7 @@ export class PlainLocalValue implements ILocalValue {
99
98
  /**
100
99
  * Enables a container type {@link https://fluidframework.com/docs/build/dds/ | DDS} to produce and store local
101
100
  * values with minimal awareness of how those objects are stored, serialized, and deserialized.
102
- *
103
- * @public
101
+ * @alpha
104
102
  */
105
103
  export class LocalValueMaker {
106
104
  /**
package/src/map.ts CHANGED
@@ -30,7 +30,7 @@ const snapshotFileName = "header";
30
30
  * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMap}.
31
31
  *
32
32
  * @sealed
33
- * @public
33
+ * @alpha
34
34
  */
35
35
  export class MapFactory implements IChannelFactory {
36
36
  /**
@@ -89,8 +89,7 @@ export class MapFactory implements IChannelFactory {
89
89
 
90
90
  /**
91
91
  * {@inheritDoc ISharedMap}
92
- *
93
- * @public
92
+ * @alpha
94
93
  */
95
94
  export class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {
96
95
  /**
@@ -250,7 +249,6 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
250
249
 
251
250
  /**
252
251
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
253
- * @internal
254
252
  */
255
253
  protected summarizeCore(
256
254
  serializer: IFluidSerializer,
@@ -330,7 +328,6 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
330
328
 
331
329
  /**
332
330
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
333
- * @internal
334
331
  */
335
332
  protected async loadCore(storage: IChannelStorageService): Promise<void> {
336
333
  const json = await readAndParse<object>(storage, snapshotFileName);
@@ -350,13 +347,11 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
350
347
 
351
348
  /**
352
349
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
353
- * @internal
354
350
  */
355
351
  protected onDisconnect(): void {}
356
352
 
357
353
  /**
358
354
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
359
- * @internal
360
355
  */
361
356
  protected reSubmitCore(content: unknown, localOpMetadata: unknown): void {
362
357
  this.kernel.trySubmitMessage(content as IMapOperation, localOpMetadata);
@@ -364,7 +359,6 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
364
359
 
365
360
  /**
366
361
  * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
367
- * @internal
368
362
  */
369
363
  protected applyStashedOp(content: unknown): unknown {
370
364
  return this.kernel.tryApplyStashedOp(content as IMapOperation);
@@ -372,7 +366,6 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
372
366
 
373
367
  /**
374
368
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
375
- * @internal
376
369
  */
377
370
  protected processCore(
378
371
  message: ISequencedDocumentMessage,
@@ -390,7 +383,6 @@ export class SharedMap extends SharedObject<ISharedMapEvents> implements IShared
390
383
 
391
384
  /**
392
385
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
393
- * @internal
394
386
  */
395
387
  protected rollback(content: unknown, localOpMetadata: unknown): void {
396
388
  this.kernel.rollback(content, localOpMetadata);
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/map";
9
- export const pkgVersion = "2.0.0-internal.7.2.2";
9
+ export const pkgVersion = "2.0.0-internal.7.4.0";
@@ -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,11 +1,12 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
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/**/*"],
3
8
  "compilerOptions": {
4
- "composite": true,
5
9
  "rootDir": "./src",
6
10
  "outDir": "./dist",
7
- "types": ["node"],
8
11
  },
9
- "include": ["src/**/*"],
10
- "exclude": ["src/test/**/*"],
11
12
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"directory.js","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2DAAoD;AACpD,+DAAiE;AACjE,qEAA6D;AAC7D,+DAA4D;AAC5D,+EAA8F;AAS9F,2EAA+F;AAC/F,iEAAmE;AACnE,sDAAwC;AAYxC,+CAA+E;AAC/E,qDAA8C;AAE9C,sFAAsF;AACtF,oDAAoD;AACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;AAEzB,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AA8OlC;;;;;GAKG;AACH,MAAa,gBAAgB;IAe5B;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,gBAAgB,CAAC,IAAI,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,gBAAgB,CAAC,UAAU,CAAC;IACpC,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC/D,MAAM,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE/B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,OAA+B,EAAE,EAAU;QACxD,MAAM,SAAS,GAAG,IAAI,eAAe,CAAC,EAAE,EAAE,OAAO,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAChF,SAAS,CAAC,eAAe,EAAE,CAAC;QAE5B,OAAO,SAAS,CAAC;IAClB,CAAC;;AApDF,4CAqDC;AApDA;;GAEG;AACoB,qBAAI,GAAG,6CAA6C,CAAC;AAE5E;;GA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AC,wBAAwB,CAAC,YAAY,CAAC,CAAC;SAC5C;QACD,SAAS,CAAC,SAAS,EAAE,CAAC;IACvB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tIChannelStorageService,\n\tIChannelServices,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISummaryTreeWithStats, ITelemetryContext } from \"@fluidframework/runtime-definitions\";\nimport { IFluidSerializer, SharedObject, ValueType } from \"@fluidframework/shared-object-base\";\nimport { SummaryTreeBuilder } from \"@fluidframework/runtime-utils\";\nimport * as path from \"path-browserify\";\nimport {\n\tIDirectory,\n\tIDirectoryEvents,\n\tIDirectoryValueChanged,\n\t// eslint-disable-next-line import/no-deprecated\n\tISerializableValue,\n\tISerializedValue,\n\tISharedDirectory,\n\tISharedDirectoryEvents,\n\tIValueChanged,\n} from \"./interfaces\";\nimport { ILocalValue, LocalValueMaker, makeSerializable } from \"./localValues\";\nimport { pkgVersion } from \"./packageVersion\";\n\n// We use path-browserify since this code can run safely on the server or the browser.\n// We standardize on using posix slashes everywhere.\nconst posix = path.posix;\n\nconst snapshotFileName = \"header\";\n\n/**\n * Defines the means to process and submit a given op on a directory.\n */\ninterface IDirectoryMessageHandler {\n\t/**\n\t * Apply the given operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The directory operation to apply\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t */\n\tprocess(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void;\n\n\t/**\n\t * Communicate the operation to remote clients.\n\t * @param op - The directory operation to submit\n\t * @param localOpMetadata - The metadata to be submitted with the message.\n\t */\n\tsubmit(op: IDirectoryOperation, localOpMetadata: unknown): void;\n\n\tapplyStashedOp(op: IDirectoryOperation): unknown;\n}\n\n/**\n * Operation indicating a value should be set for a key.\n *\n * @public\n */\nexport interface IDirectorySetOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"set\";\n\n\t/**\n\t * Directory key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Absolute path of the directory where the modified key is located.\n\t */\n\tpath: string;\n\n\t/**\n\t * Value to be set on the key.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tvalue: ISerializableValue;\n}\n\n/**\n * Operation indicating a key should be deleted from the directory.\n *\n * @public\n */\nexport interface IDirectoryDeleteOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"delete\";\n\n\t/**\n\t * Directory key being modified.\n\t */\n\tkey: string;\n\n\t/**\n\t * Absolute path of the directory where the modified key is located.\n\t */\n\tpath: string;\n}\n\n/**\n * An operation on a specific key within a directory.\n *\n * @public\n */\nexport type IDirectoryKeyOperation = IDirectorySetOperation | IDirectoryDeleteOperation;\n\n/**\n * Operation indicating the directory should be cleared.\n *\n * @public\n */\nexport interface IDirectoryClearOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"clear\";\n\n\t/**\n\t * Absolute path of the directory being cleared.\n\t */\n\tpath: string;\n}\n\n/**\n * An operation on one or more of the keys within a directory.\n *\n * @public\n */\nexport type IDirectoryStorageOperation = IDirectoryKeyOperation | IDirectoryClearOperation;\n\n/**\n * Operation indicating a subdirectory should be created.\n *\n * @public\n */\nexport interface IDirectoryCreateSubDirectoryOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"createSubDirectory\";\n\n\t/**\n\t * Absolute path of the directory that will contain the new subdirectory.\n\t */\n\tpath: string;\n\n\t/**\n\t * Name of the new subdirectory.\n\t */\n\tsubdirName: string;\n}\n\n/**\n * Operation indicating a subdirectory should be deleted.\n *\n * @public\n */\nexport interface IDirectoryDeleteSubDirectoryOperation {\n\t/**\n\t * String identifier of the operation type.\n\t */\n\ttype: \"deleteSubDirectory\";\n\n\t/**\n\t * Absolute path of the directory that contains the directory to be deleted.\n\t */\n\tpath: string;\n\n\t/**\n\t * Name of the subdirectory to be deleted.\n\t */\n\tsubdirName: string;\n}\n\n/**\n * An operation on the subdirectories within a directory.\n *\n * @public\n */\nexport type IDirectorySubDirectoryOperation =\n\t| IDirectoryCreateSubDirectoryOperation\n\t| IDirectoryDeleteSubDirectoryOperation;\n\n/**\n * Any operation on a directory.\n *\n * @public\n */\nexport type IDirectoryOperation = IDirectoryStorageOperation | IDirectorySubDirectoryOperation;\n\n/**\n * Create info for the subdirectory.\n *\n * @public\n */\nexport interface ICreateInfo {\n\t/**\n\t * Sequence number at which this subdirectory was created.\n\t */\n\tcsn: number;\n\n\t/**\n\t * clientids of the clients which created this sub directory.\n\t */\n\tccIds: string[];\n}\n\n/**\n * Defines the in-memory object structure to be used for the conversion to/from serialized.\n *\n * @remarks Directly used in\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify\n * | JSON.stringify}, direct result from\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}.\n *\n * @public\n */\nexport interface IDirectoryDataObject {\n\t/**\n\t * Key/value date set by the user.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tstorage?: { [key: string]: ISerializableValue };\n\n\t/**\n\t * Recursive sub-directories {@link IDirectoryDataObject | objects}.\n\t */\n\tsubdirectories?: { [subdirName: string]: IDirectoryDataObject };\n\n\t/**\n\t * Create info for the sub directory. Since directories with same name can get deleted/created by multiple clients\n\t * asynchronously, this info helps us to determine whether the ops where for the current instance of sub directory\n\t * or not and whether to process them or not based on that. Summaries which were not produced which this change\n\t * will not have this info and in that case we can still run in eventual consistency issues but that is no worse\n\t * than the state before this change.\n\t */\n\tci?: ICreateInfo;\n}\n\n/**\n * {@link IDirectory} storage format.\n *\n * @internal\n */\nexport interface IDirectoryNewStorageFormat {\n\t/**\n\t * Blob IDs representing larger directory data that was serialized.\n\t */\n\tblobs: string[];\n\n\t/**\n\t * Storage content representing directory data that was not serialized.\n\t */\n\tcontent: IDirectoryDataObject;\n}\n\n/**\n * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedDirectory}.\n *\n * @sealed\n * @public\n */\nexport class DirectoryFactory implements IChannelFactory {\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic static readonly Type = \"https://graph.microsoft.com/types/directory\";\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: DirectoryFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn DirectoryFactory.Type;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.attributes}\n\t */\n\tpublic get attributes(): IChannelAttributes {\n\t\treturn DirectoryFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<ISharedDirectory> {\n\t\tconst directory = new SharedDirectory(id, runtime, attributes);\n\t\tawait directory.load(services);\n\n\t\treturn directory;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.create}\n\t */\n\tpublic create(runtime: IFluidDataStoreRuntime, id: string): ISharedDirectory {\n\t\tconst directory = new SharedDirectory(id, runtime, DirectoryFactory.Attributes);\n\t\tdirectory.initializeLocal();\n\n\t\treturn directory;\n\t}\n}\n\n/**\n * {@inheritDoc ISharedDirectory}\n *\n * @example\n *\n * ```typescript\n * mySharedDirectory.createSubDirectory(\"a\").createSubDirectory(\"b\").createSubDirectory(\"c\").set(\"foo\", val1);\n * const mySubDir = mySharedDirectory.getWorkingDirectory(\"/a/b/c\");\n * mySubDir.get(\"foo\"); // returns val1\n * ```\n *\n * @sealed\n * @public\n */\nexport class SharedDirectory\n\textends SharedObject<ISharedDirectoryEvents>\n\timplements ISharedDirectory\n{\n\t/**\n\t * Create a new shared directory\n\t *\n\t * @param runtime - Data store runtime the new shared directory belongs to\n\t * @param id - Optional name of the shared directory\n\t * @returns Newly create shared directory (but not attached yet)\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedDirectory {\n\t\treturn runtime.createChannel(id, DirectoryFactory.Type) as SharedDirectory;\n\t}\n\n\t/**\n\t * Get a factory for SharedDirectory to register with the data store.\n\t *\n\t * @returns A factory that creates and load SharedDirectory\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new DirectoryFactory();\n\t}\n\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic [Symbol.toStringTag]: string = \"SharedDirectory\";\n\n\t/**\n\t * {@inheritDoc IDirectory.absolutePath}\n\t */\n\tpublic get absolutePath(): string {\n\t\treturn this.root.absolutePath;\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic readonly localValueMaker: LocalValueMaker;\n\n\t/**\n\t * Root of the SharedDirectory, most operations on the SharedDirectory itself act on the root.\n\t */\n\tprivate readonly root: SubDirectory = new SubDirectory(\n\t\t0,\n\t\tnew Set(),\n\t\tthis,\n\t\tthis.runtime,\n\t\tthis.serializer,\n\t\tposix.sep,\n\t);\n\n\t/**\n\t * Mapping of op types to message handlers.\n\t */\n\tprivate readonly messageHandlers: Map<string, IDirectoryMessageHandler> = new Map();\n\n\t/**\n\t * Constructs a new shared directory. If the object is non-local an id and service interfaces will\n\t * be provided.\n\t * @param id - String identifier for the SharedDirectory\n\t * @param runtime - Data store runtime\n\t * @param type - Type identifier\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_directory_\");\n\t\tthis.localValueMaker = new LocalValueMaker(this.serializer);\n\t\tthis.setMessageHandlers();\n\t\t// Mirror the containedValueChanged op on the SharedDirectory\n\t\tthis.root.on(\"containedValueChanged\", (changed: IValueChanged, local: boolean) => {\n\t\t\tthis.emit(\"containedValueChanged\", changed, local, this);\n\t\t});\n\t\tthis.root.on(\"subDirectoryCreated\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryCreated\", relativePath, local, this);\n\t\t});\n\t\tthis.root.on(\"subDirectoryDeleted\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryDeleted\", relativePath, local, this);\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.get}\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic get<T = any>(key: string): T | undefined {\n\t\treturn this.root.get<T>(key);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.set}\n\t */\n\tpublic set<T = unknown>(key: string, value: T): this {\n\t\tthis.root.set(key, value);\n\t\treturn this;\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tthis.root.dispose(error);\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this.root.disposed;\n\t}\n\n\t/**\n\t * Deletes the given key from within this IDirectory.\n\t * @param key - The key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\treturn this.root.delete(key);\n\t}\n\n\t/**\n\t * Deletes all keys from within this IDirectory.\n\t */\n\tpublic clear(): void {\n\t\tthis.root.clear();\n\t}\n\n\t/**\n\t * Checks whether the given key exists in this IDirectory.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\treturn this.root.has(key);\n\t}\n\n\t/**\n\t * The number of entries under this IDirectory.\n\t */\n\tpublic get size(): number {\n\t\treturn this.root.size;\n\t}\n\n\t/**\n\t * Issue a callback on each entry under this IDirectory.\n\t * @param callback - Callback to issue\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic forEach(callback: (value: any, key: string, map: Map<string, any>) => void): void {\n\t\t// eslint-disable-next-line unicorn/no-array-for-each, unicorn/no-array-callback-reference\n\t\tthis.root.forEach(callback);\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic [Symbol.iterator](): IterableIterator<[string, any]> {\n\t\treturn this.root[Symbol.iterator]();\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic entries(): IterableIterator<[string, any]> {\n\t\treturn this.root.entries();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.countSubDirectory}\n\t */\n\tpublic countSubDirectory(): number {\n\t\treturn this.root.countSubDirectory();\n\t}\n\n\t/**\n\t * Get an iterator over the keys under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\treturn this.root.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values under this IDirectory.\n\t * @returns The iterator\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic values(): IterableIterator<any> {\n\t\treturn this.root.values();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.createSubDirectory}\n\t */\n\tpublic createSubDirectory(subdirName: string): IDirectory {\n\t\treturn this.root.createSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getSubDirectory}\n\t */\n\tpublic getSubDirectory(subdirName: string): IDirectory | undefined {\n\t\treturn this.root.getSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.hasSubDirectory}\n\t */\n\tpublic hasSubDirectory(subdirName: string): boolean {\n\t\treturn this.root.hasSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.deleteSubDirectory}\n\t */\n\tpublic deleteSubDirectory(subdirName: string): boolean {\n\t\treturn this.root.deleteSubDirectory(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.subdirectories}\n\t */\n\tpublic subdirectories(): IterableIterator<[string, IDirectory]> {\n\t\treturn this.root.subdirectories();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getWorkingDirectory}\n\t */\n\tpublic getWorkingDirectory(relativePath: string): IDirectory | undefined {\n\t\tconst absolutePath = this.makeAbsolute(relativePath);\n\t\tif (absolutePath === posix.sep) {\n\t\t\treturn this.root;\n\t\t}\n\n\t\tlet currentSubDir = this.root;\n\t\tconst subdirs = absolutePath.slice(1).split(posix.sep);\n\t\tfor (const subdir of subdirs) {\n\t\t\tcurrentSubDir = currentSubDir.getSubDirectory(subdir) as SubDirectory;\n\t\t\tif (!currentSubDir) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\treturn currentSubDir;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}\n\t * @internal\n\t */\n\tprotected summarizeCore(\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\treturn this.serializeDirectory(this.root, serializer);\n\t}\n\n\t/**\n\t * Submits an operation\n\t * @param op - Op to submit\n\t * @param localOpMetadata - The local metadata associated with the op. We send a unique id that is used to track\n\t * this op while it has not been ack'd. This will be sent when we receive this op back from the server.\n\t * @internal\n\t */\n\tpublic submitDirectoryMessage(op: IDirectoryOperation, localOpMetadata: unknown): void {\n\t\tthis.submitLocalMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}\n\t * @internal\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}\n\t * @internal\n\t */\n\tprotected reSubmitCore(content: unknown, localOpMetadata: unknown): void {\n\t\tconst message = content as IDirectoryOperation;\n\t\tconst handler = this.messageHandlers.get(message.type);\n\t\tassert(handler !== undefined, 0x00d /* Missing message handler for message type */);\n\t\thandler.submit(message, localOpMetadata);\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t * @internal\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst data = await readAndParse(storage, snapshotFileName);\n\t\tconst newFormat = data as IDirectoryNewStorageFormat;\n\t\tif (Array.isArray(newFormat.blobs)) {\n\t\t\t// New storage format\n\t\t\tthis.populate(newFormat.content);\n\t\t\tawait Promise.all(\n\t\t\t\tnewFormat.blobs.map(async (value) => {\n\t\t\t\t\tconst dataExtra = await readAndParse(storage, value);\n\t\t\t\t\tthis.populate(dataExtra as IDirectoryDataObject);\n\t\t\t\t}),\n\t\t\t);\n\t\t} else {\n\t\t\t// Old storage format\n\t\t\tthis.populate(data as IDirectoryDataObject);\n\t\t}\n\t}\n\n\t/**\n\t * Populate the directory with the given directory data.\n\t * @param data - A JSON string containing serialized directory data\n\t * @internal\n\t */\n\tprotected populate(data: IDirectoryDataObject): void {\n\t\tconst stack: [SubDirectory, IDirectoryDataObject][] = [];\n\t\tstack.push([this.root, data]);\n\t\twhile (stack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst [currentSubDir, currentSubDirObject] = stack.pop()!;\n\t\t\tif (currentSubDirObject.subdirectories) {\n\t\t\t\tfor (const [subdirName, subdirObject] of Object.entries(\n\t\t\t\t\tcurrentSubDirObject.subdirectories,\n\t\t\t\t)) {\n\t\t\t\t\tlet newSubDir = currentSubDir.getSubDirectory(subdirName) as SubDirectory;\n\t\t\t\t\tif (!newSubDir) {\n\t\t\t\t\t\tconst createInfo = subdirObject.ci;\n\t\t\t\t\t\tnewSubDir = new SubDirectory(\n\t\t\t\t\t\t\t// If csn is -1, then initialize it with 0, otherwise we will never process ops for this\n\t\t\t\t\t\t\t// sub directory. This could be done at serialization time too, but we need to maintain\n\t\t\t\t\t\t\t// back compat too and also we will actually know the state when it was serialized.\n\t\t\t\t\t\t\tcreateInfo !== undefined && createInfo.csn > -1 ? createInfo.csn : 0,\n\t\t\t\t\t\t\tcreateInfo !== undefined\n\t\t\t\t\t\t\t\t? new Set<string>(createInfo.ccIds)\n\t\t\t\t\t\t\t\t: new Set(),\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\tthis.runtime,\n\t\t\t\t\t\t\tthis.serializer,\n\t\t\t\t\t\t\tposix.join(currentSubDir.absolutePath, subdirName),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tcurrentSubDir.populateSubDirectory(subdirName, newSubDir);\n\t\t\t\t\t}\n\t\t\t\t\tstack.push([newSubDir, subdirObject]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentSubDirObject.storage) {\n\t\t\t\tfor (const [key, serializable] of Object.entries(currentSubDirObject.storage)) {\n\t\t\t\t\tconst localValue = this.makeLocal(\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tcurrentSubDir.absolutePath,\n\t\t\t\t\t\tserializable,\n\t\t\t\t\t);\n\t\t\t\t\tcurrentSubDir.populateStorage(key, localValue);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}\n\t * @internal\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op: IDirectoryOperation = message.contents as IDirectoryOperation;\n\t\t\tconst handler = this.messageHandlers.get(op.type);\n\t\t\tassert(handler !== undefined, 0x00e /* Missing message handler for message type */);\n\t\t\thandler.process(message, op, local, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}\n\t * @internal\n\t */\n\tprotected rollback(content: unknown, localOpMetadata: unknown): void {\n\t\tconst op: IDirectoryOperation = content as IDirectoryOperation;\n\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\tif (subdir) {\n\t\t\tsubdir.rollback(op, localOpMetadata);\n\t\t}\n\t}\n\n\t/**\n\t * Converts the given relative path to absolute against the root.\n\t * @param relativePath - The path to convert\n\t */\n\tprivate makeAbsolute(relativePath: string): string {\n\t\treturn posix.resolve(posix.sep, relativePath);\n\t}\n\n\t/**\n\t * The remote ISerializableValue we're receiving (either as a result of a snapshot load or an incoming set op)\n\t * will have the information we need to create a real object, but will not be the real object yet. For example,\n\t * we might know it's a map and the ID but not have the actual map or its data yet. makeLocal's job\n\t * is to convert that information into a real object for local usage.\n\t * @param key - Key of element being converted\n\t * @param absolutePath - Path of element being converted\n\t * @param serializable - The remote information that we can convert into a real object\n\t * @returns The local value that was produced\n\t */\n\tprivate makeLocal(\n\t\tkey: string,\n\t\tabsolutePath: string,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tserializable: ISerializableValue,\n\t): ILocalValue {\n\t\tassert(\n\t\t\tserializable.type === ValueType[ValueType.Plain] ||\n\t\t\t\tserializable.type === ValueType[ValueType.Shared],\n\t\t\t0x1e4 /* \"Unexpected serializable type\" */,\n\t\t);\n\t\treturn this.localValueMaker.fromSerializable(serializable);\n\t}\n\n\t/**\n\t * This checks if there is pending delete op for local delete for a any subdir in the relative path.\n\t * @param relativePath - path of sub directory.\n\t * @returns `true` if there is pending delete, `false` otherwise.\n\t */\n\tprivate isSubDirectoryDeletePending(relativePath: string): boolean {\n\t\tconst absolutePath = this.makeAbsolute(relativePath);\n\t\tif (absolutePath === posix.sep) {\n\t\t\treturn false;\n\t\t}\n\t\tlet currentParent = this.root;\n\t\tconst nodeList = absolutePath.split(posix.sep);\n\t\tlet start = 1;\n\t\twhile (start < nodeList.length) {\n\t\t\tconst subDirName = nodeList[start];\n\t\t\tif (currentParent.isSubDirectoryDeletePending(subDirName)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tcurrentParent = currentParent.getSubDirectory(subDirName) as SubDirectory;\n\t\t\tif (currentParent === undefined) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tstart += 1;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Set the message handlers for the directory.\n\t */\n\tprivate setMessageHandlers(): void {\n\t\tthis.messageHandlers.set(\"clear\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryClearOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tsubdir.processClearMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryClearOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitClearMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IDirectoryClearOperation): IClearLocalOpMetadata | undefined => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\treturn subdir.applyStashedClearMessage(op);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tthis.messageHandlers.set(\"delete\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryDeleteOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tsubdir.processDeleteMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryDeleteOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitKeyMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (\n\t\t\t\top: IDirectoryDeleteOperation,\n\t\t\t): IKeyEditLocalOpMetadata | undefined => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\treturn subdir.applyStashedDeleteMessage(op);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t\tthis.messageHandlers.set(\"set\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectorySetOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (subdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tconst context = local ? undefined : this.makeLocal(op.key, op.path, op.value);\n\t\t\t\t\tsubdir.processSetMessage(msg, op, context, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectorySetOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tsubdir.resubmitKeyMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (op: IDirectorySetOperation): IKeyEditLocalOpMetadata | undefined => {\n\t\t\t\tconst subdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (subdir) {\n\t\t\t\t\tconst context = this.makeLocal(op.key, op.path, op.value);\n\t\t\t\t\treturn subdir.applyStashedSetMessage(op, context);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tthis.messageHandlers.set(\"createSubDirectory\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (parentSubdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tparentSubdir.processCreateSubDirectoryMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryCreateSubDirectoryOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\t// We don't reuse the metadata but send a new one on each submit.\n\t\t\t\t\tparentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (\n\t\t\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\t\t): ICreateSubDirLocalOpMetadata | undefined => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\treturn parentSubdir.applyStashedCreateSubDirMessage(op);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\n\t\tthis.messageHandlers.set(\"deleteSubDirectory\", {\n\t\t\tprocess: (\n\t\t\t\tmsg: ISequencedDocumentMessage,\n\t\t\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\t\t\tlocal,\n\t\t\t\tlocalOpMetadata,\n\t\t\t) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\t// If there is pending delete op for any subDirectory in the op.path, then don't apply the this op\n\t\t\t\t// as we are going to delete this subDirectory.\n\t\t\t\tif (parentSubdir && !this.isSubDirectoryDeletePending(op.path)) {\n\t\t\t\t\tparentSubdir.processDeleteSubDirectoryMessage(msg, op, local, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tsubmit: (op: IDirectoryDeleteSubDirectoryOperation, localOpMetadata: unknown) => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\t// We don't reuse the metadata but send a new one on each submit.\n\t\t\t\t\tparentSubdir.resubmitSubDirectoryMessage(op, localOpMetadata);\n\t\t\t\t}\n\t\t\t},\n\t\t\tapplyStashedOp: (\n\t\t\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\t\t): IDeleteSubDirLocalOpMetadata | undefined => {\n\t\t\t\tconst parentSubdir = this.getWorkingDirectory(op.path) as SubDirectory | undefined;\n\t\t\t\tif (parentSubdir) {\n\t\t\t\t\treturn parentSubdir.applyStashedDeleteSubDirMessage(op);\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t * @internal\n\t */\n\tprotected applyStashedOp(op: unknown): unknown {\n\t\tconst handler = this.messageHandlers.get((op as IDirectoryOperation).type);\n\t\tif (handler === undefined) {\n\t\t\tthrow new Error(\"no apply stashed op handler\");\n\t\t}\n\t\treturn handler.applyStashedOp(op as IDirectoryOperation);\n\t}\n\n\tprivate serializeDirectory(\n\t\troot: SubDirectory,\n\t\tserializer: IFluidSerializer,\n\t\ttelemetryContext?: ITelemetryContext,\n\t): ISummaryTreeWithStats {\n\t\tconst MinValueSizeSeparateSnapshotBlob = 8 * 1024;\n\n\t\tconst builder = new SummaryTreeBuilder();\n\t\tlet counter = 0;\n\t\tconst blobs: string[] = [];\n\n\t\tconst stack: [SubDirectory, IDirectoryDataObject][] = [];\n\t\tconst content: IDirectoryDataObject = {};\n\t\tstack.push([root, content]);\n\n\t\twhile (stack.length > 0) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tconst [currentSubDir, currentSubDirObject] = stack.pop()!;\n\t\t\tcurrentSubDirObject.ci = currentSubDir.getSerializableCreateInfo();\n\t\t\tfor (const [key, value] of currentSubDir.getSerializedStorage(serializer)) {\n\t\t\t\tif (!currentSubDirObject.storage) {\n\t\t\t\t\tcurrentSubDirObject.storage = {};\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\t\tconst result: ISerializableValue = {\n\t\t\t\t\ttype: value.type,\n\t\t\t\t\tvalue: value.value && (JSON.parse(value.value) as object),\n\t\t\t\t};\n\t\t\t\tif (value.value && value.value.length >= MinValueSizeSeparateSnapshotBlob) {\n\t\t\t\t\tconst extraContent: IDirectoryDataObject = {};\n\t\t\t\t\tlet largeContent = extraContent;\n\t\t\t\t\tif (currentSubDir.absolutePath !== posix.sep) {\n\t\t\t\t\t\tfor (const dir of currentSubDir.absolutePath.slice(1).split(posix.sep)) {\n\t\t\t\t\t\t\tconst subDataObject: IDirectoryDataObject = {};\n\t\t\t\t\t\t\tlargeContent.subdirectories = { [dir]: subDataObject };\n\t\t\t\t\t\t\tlargeContent = subDataObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlargeContent.storage = { [key]: result };\n\t\t\t\t\tconst blobName = `blob${counter}`;\n\t\t\t\t\tcounter++;\n\t\t\t\t\tblobs.push(blobName);\n\t\t\t\t\tbuilder.addBlob(blobName, JSON.stringify(extraContent));\n\t\t\t\t} else {\n\t\t\t\t\tcurrentSubDirObject.storage[key] = result;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [subdirName, subdir] of currentSubDir.subdirectories()) {\n\t\t\t\tif (!currentSubDirObject.subdirectories) {\n\t\t\t\t\tcurrentSubDirObject.subdirectories = {};\n\t\t\t\t}\n\t\t\t\tconst subDataObject: IDirectoryDataObject = {};\n\t\t\t\tcurrentSubDirObject.subdirectories[subdirName] = subDataObject;\n\t\t\t\tstack.push([subdir as SubDirectory, subDataObject]);\n\t\t\t}\n\t\t}\n\n\t\tconst newFormat: IDirectoryNewStorageFormat = {\n\t\t\tblobs,\n\t\t\tcontent,\n\t\t};\n\t\tbuilder.addBlob(snapshotFileName, JSON.stringify(newFormat));\n\n\t\treturn builder.getSummaryTree();\n\t}\n}\n\ninterface IKeyEditLocalOpMetadata {\n\ttype: \"edit\";\n\tpendingMessageId: number;\n\tpreviousValue: ILocalValue | undefined;\n}\n\ninterface IClearLocalOpMetadata {\n\ttype: \"clear\";\n\tpendingMessageId: number;\n\tpreviousStorage: Map<string, ILocalValue>;\n}\n\ninterface ICreateSubDirLocalOpMetadata {\n\ttype: \"createSubDir\";\n}\n\ninterface IDeleteSubDirLocalOpMetadata {\n\ttype: \"deleteSubDir\";\n\tsubDirectory: SubDirectory | undefined;\n}\n\ntype SubDirLocalOpMetadata = ICreateSubDirLocalOpMetadata | IDeleteSubDirLocalOpMetadata;\ntype DirectoryLocalOpMetadata =\n\t| IClearLocalOpMetadata\n\t| IKeyEditLocalOpMetadata\n\t| SubDirLocalOpMetadata;\n\n/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction isKeyEditLocalOpMetadata(metadata: any): metadata is IKeyEditLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\tmetadata.type === \"edit\"\n\t);\n}\n\nfunction isClearLocalOpMetadata(metadata: any): metadata is IClearLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\tmetadata.type === \"clear\" &&\n\t\ttypeof metadata.pendingMessageId === \"number\" &&\n\t\ttypeof metadata.previousStorage === \"object\"\n\t);\n}\n\nfunction isSubDirLocalOpMetadata(metadata: any): metadata is SubDirLocalOpMetadata {\n\treturn (\n\t\tmetadata !== undefined &&\n\t\t(metadata.type === \"createSubDir\" || metadata.type === \"deleteSubDir\")\n\t);\n}\n\nfunction isDirectoryLocalOpMetadata(metadata: any): metadata is DirectoryLocalOpMetadata {\n\treturn (\n\t\tisKeyEditLocalOpMetadata(metadata) ||\n\t\tisClearLocalOpMetadata(metadata) ||\n\t\tisSubDirLocalOpMetadata(metadata)\n\t);\n}\n\n/* eslint-enable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */\n\nfunction assertNonNullClientId(clientId: string | null): asserts clientId is string {\n\tassert(clientId !== null, 0x6af /* client id should never be null */);\n}\n\n/**\n * Node of the directory tree.\n * @sealed\n */\nclass SubDirectory extends TypedEventEmitter<IDirectoryEvents> implements IDirectory {\n\t/**\n\t * Tells if the sub directory is deleted or not.\n\t */\n\tprivate _deleted = false;\n\n\t/**\n\t * String representation for the class.\n\t */\n\tpublic [Symbol.toStringTag]: string = \"SubDirectory\";\n\n\t/**\n\t * The in-memory data the directory is storing.\n\t */\n\tprivate readonly _storage: Map<string, ILocalValue> = new Map();\n\n\t/**\n\t * The subdirectories the directory is holding.\n\t */\n\tprivate readonly _subdirectories: Map<string, SubDirectory> = new Map();\n\n\t/**\n\t * Keys that have been modified locally but not yet ack'd from the server. This is for operations on keys like\n\t * set/delete operations on keys. The value of this map is list of pendingMessageIds at which that key\n\t * was modified. We don't store the type of ops, and behaviour of key ops are different from behaviour of sub\n\t * directory ops, so we have separate map from subDirectories tracker.\n\t */\n\tprivate readonly pendingKeys: Map<string, number[]> = new Map();\n\n\t/**\n\t * Subdirectories that have been deleted locally but not yet ack'd from the server. This maintains the record\n\t * of delete op that are pending or yet to be acked from server. This is maintained just to track the locally\n\t * deleted sub directory.\n\t */\n\tprivate readonly pendingDeleteSubDirectoriesTracker: Map<string, number> = new Map();\n\n\t/**\n\t * Subdirectories that have been created locally but not yet ack'd from the server. This maintains the record\n\t * of create op that are pending or yet to be acked from server. This is maintained just to track the locally\n\t * created sub directory.\n\t */\n\tprivate readonly pendingCreateSubDirectoriesTracker: Map<string, number> = new Map();\n\n\t/**\n\t * This is used to assign a unique id to every outgoing operation and helps in tracking unack'd ops.\n\t */\n\tprivate pendingMessageId: number = -1;\n\n\t/**\n\t * The pending ids of any clears that have been performed locally but not yet ack'd from the server\n\t */\n\tprivate readonly pendingClearMessageIds: number[] = [];\n\n\t/**\n\t * Constructor.\n\t * @param sequenceNumber - Message seq number at which this was created.\n\t * @param clientIds - Ids of client which created this directory.\n\t * @param directory - Reference back to the SharedDirectory to perform operations\n\t * @param runtime - The data store runtime this directory is associated with\n\t * @param serializer - The serializer to serialize / parse handles\n\t * @param absolutePath - The absolute path of this IDirectory\n\t */\n\tpublic constructor(\n\t\tprivate sequenceNumber: number,\n\t\tprivate readonly clientIds: Set<string>,\n\t\tprivate readonly directory: SharedDirectory,\n\t\tprivate readonly runtime: IFluidDataStoreRuntime,\n\t\tprivate readonly serializer: IFluidSerializer,\n\t\tpublic readonly absolutePath: string,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic dispose(error?: Error): void {\n\t\tthis._deleted = true;\n\t\tthis.emit(\"disposed\", this);\n\t}\n\n\t/**\n\t * Unmark the deleted property only when rolling back delete.\n\t */\n\tprivate undispose(): void {\n\t\tthis._deleted = false;\n\t\tthis.emit(\"undisposed\", this);\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._deleted;\n\t}\n\n\tprivate throwIfDisposed(): void {\n\t\tif (this._deleted) {\n\t\t\tthrow new UsageError(\"Cannot access Disposed subDirectory\");\n\t\t}\n\t}\n\n\t/**\n\t * Checks whether the given key exists in this IDirectory.\n\t * @param key - The key to check\n\t * @returns True if the key exists, false otherwise\n\t */\n\tpublic has(key: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.has(key);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.get}\n\t */\n\tpublic get<T = unknown>(key: string): T | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.get(key)?.value as T | undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.set}\n\t */\n\tpublic set<T = unknown>(key: string, value: T): this {\n\t\tthis.throwIfDisposed();\n\t\t// Undefined/null keys can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (key === undefined || key === null) {\n\t\t\tthrow new Error(\"Undefined and null keys are not supported\");\n\t\t}\n\n\t\t// Create a local value and serialize it.\n\t\tconst localValue = this.directory.localValueMaker.fromInMemory(value);\n\t\tconst serializableValue = makeSerializable(\n\t\t\tlocalValue,\n\t\t\tthis.serializer,\n\t\t\tthis.directory.handle,\n\t\t);\n\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(key, localValue, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst op: IDirectorySetOperation = {\n\t\t\tkey,\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"set\",\n\t\t\tvalue: serializableValue,\n\t\t};\n\t\tthis.submitKeyMessage(op, previousValue);\n\t\treturn this;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.countSubDirectory}\n\t */\n\tpublic countSubDirectory(): number {\n\t\treturn this._subdirectories.size;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.createSubDirectory}\n\t */\n\tpublic createSubDirectory(subdirName: string): IDirectory {\n\t\tthis.throwIfDisposed();\n\t\t// Undefined/null subdirectory names can't be serialized to JSON in the manner we currently snapshot.\n\t\tif (subdirName === undefined || subdirName === null) {\n\t\t\tthrow new Error(\"SubDirectory name may not be undefined or null\");\n\t\t}\n\n\t\tif (subdirName.includes(posix.sep)) {\n\t\t\tthrow new Error(`SubDirectory name may not contain ${posix.sep}`);\n\t\t}\n\n\t\t// Create the sub directory locally first.\n\t\tconst isNew = this.createSubDirectoryCore(\n\t\t\tsubdirName,\n\t\t\ttrue,\n\t\t\tthis.getLocalSeq(),\n\t\t\tthis.runtime.clientId ?? \"detached\",\n\t\t);\n\t\tconst subDir = this._subdirectories.get(subdirName);\n\t\tassert(subDir !== undefined, 0x5aa /* subdirectory should exist after creation */);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn subDir;\n\t\t}\n\n\t\t// Only submit the op, if it is newly created.\n\t\tif (isNew) {\n\t\t\tconst op: IDirectoryCreateSubDirectoryOperation = {\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tsubdirName,\n\t\t\t\ttype: \"createSubDirectory\",\n\t\t\t};\n\t\t\tthis.submitCreateSubDirectoryMessage(op);\n\t\t}\n\n\t\treturn subDir;\n\t}\n\n\t/**\n\t * @returns A sequenceNumber which should be used for local changes.\n\t * @remarks While detached, 0 is used rather than -1 to represent a change which should be universally known (as opposed to known\n\t * only by the local client). This ensures that if the directory is later attached, none of its data needs to be updated (the values\n\t * last set while detached will now be known to any new client, until they are changed).\n\t * TODO: Convert these conventions to named constants. The semantics used here match those for merge-tree.\n\t */\n\tprivate getLocalSeq(): number {\n\t\treturn this.directory.isAttached() ? -1 : 0;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getSubDirectory}\n\t */\n\tpublic getSubDirectory(subdirName: string): IDirectory | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.get(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.hasSubDirectory}\n\t */\n\tpublic hasSubDirectory(subdirName: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.has(subdirName);\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.deleteSubDirectory}\n\t */\n\tpublic deleteSubDirectory(subdirName: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\t// Delete the sub directory locally first.\n\t\tconst subDir = this.deleteSubDirectoryCore(subdirName, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn subDir !== undefined;\n\t\t}\n\n\t\t// Only submit the op, if the directory existed and we deleted it.\n\t\tif (subDir !== undefined) {\n\t\t\tconst op: IDirectoryDeleteSubDirectoryOperation = {\n\t\t\t\tpath: this.absolutePath,\n\t\t\t\tsubdirName,\n\t\t\t\ttype: \"deleteSubDirectory\",\n\t\t\t};\n\n\t\t\tthis.submitDeleteSubDirectoryMessage(op, subDir);\n\t\t}\n\t\treturn subDir !== undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.subdirectories}\n\t */\n\tpublic subdirectories(): IterableIterator<[string, IDirectory]> {\n\t\tthis.throwIfDisposed();\n\t\treturn this._subdirectories.entries();\n\t}\n\n\t/**\n\t * {@inheritDoc IDirectory.getWorkingDirectory}\n\t */\n\tpublic getWorkingDirectory(relativePath: string): IDirectory | undefined {\n\t\tthis.throwIfDisposed();\n\t\treturn this.directory.getWorkingDirectory(this.makeAbsolute(relativePath));\n\t}\n\n\t/**\n\t * This checks if there is pending delete op for local delete for a given child subdirectory.\n\t * @param subDirName - directory name.\n\t * @returns true if there is pending delete.\n\t */\n\tpublic isSubDirectoryDeletePending(subDirName: string): boolean {\n\t\tif (this.pendingDeleteSubDirectoriesTracker.has(subDirName)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Deletes the given key from within this IDirectory.\n\t * @param key - The key to delete\n\t * @returns True if the key existed and was deleted, false if it did not exist\n\t */\n\tpublic delete(key: string): boolean {\n\t\tthis.throwIfDisposed();\n\t\t// Delete the key locally first.\n\t\tconst previousValue = this.deleteCore(key, true);\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\treturn previousValue !== undefined;\n\t\t}\n\n\t\tconst op: IDirectoryDeleteOperation = {\n\t\t\tkey,\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"delete\",\n\t\t};\n\n\t\tthis.submitKeyMessage(op, previousValue);\n\t\treturn previousValue !== undefined;\n\t}\n\n\t/**\n\t * Deletes all keys from within this IDirectory.\n\t */\n\tpublic clear(): void {\n\t\tthis.throwIfDisposed();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.directory.isAttached()) {\n\t\t\tthis.clearCore(true);\n\t\t\treturn;\n\t\t}\n\n\t\tconst copy = new Map<string, ILocalValue>(this._storage);\n\t\tthis.clearCore(true);\n\t\tconst op: IDirectoryClearOperation = {\n\t\t\tpath: this.absolutePath,\n\t\t\ttype: \"clear\",\n\t\t};\n\t\tthis.submitClearMessage(op, copy);\n\t}\n\n\t/**\n\t * Issue a callback on each entry under this IDirectory.\n\t * @param callback - Callback to issue\n\t */\n\tpublic forEach(\n\t\tcallback: (value: unknown, key: string, map: Map<string, unknown>) => void,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\t// eslint-disable-next-line unicorn/no-array-for-each\n\t\tthis._storage.forEach((localValue, key, map) => {\n\t\t\tcallback(localValue.value, key, map);\n\t\t});\n\t}\n\n\t/**\n\t * The number of entries under this IDirectory.\n\t */\n\tpublic get size(): number {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.size;\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic entries(): IterableIterator<[string, unknown]> {\n\t\tthis.throwIfDisposed();\n\t\tconst localEntriesIterator = this._storage.entries();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<[string, unknown]> {\n\t\t\t\tconst nextVal = localEntriesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: [nextVal.value[0], nextVal.value[1].value], done: false };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the keys under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic keys(): IterableIterator<string> {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.keys();\n\t}\n\n\t/**\n\t * Get an iterator over the values under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic values(): IterableIterator<unknown> {\n\t\tthis.throwIfDisposed();\n\t\tconst localValuesIterator = this._storage.values();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<unknown> {\n\t\t\t\tconst nextVal = localValuesIterator.next();\n\t\t\t\treturn nextVal.done\n\t\t\t\t\t? { value: undefined, done: true }\n\t\t\t\t\t: { value: nextVal.value.value, done: false };\n\t\t\t},\n\t\t\t[Symbol.iterator](): IterableIterator<unknown> {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * Get an iterator over the entries under this IDirectory.\n\t * @returns The iterator\n\t */\n\tpublic [Symbol.iterator](): IterableIterator<[string, unknown]> {\n\t\tthis.throwIfDisposed();\n\t\treturn this.entries();\n\t}\n\n\t/**\n\t * Process a clear operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processClearMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryClearOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (!this.isMessageForCurrentInstanceOfSubDirectory(msg)) {\n\t\t\treturn;\n\t\t}\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tisClearLocalOpMetadata(localOpMetadata),\n\t\t\t\t0x00f /* pendingMessageId is missing from the local client's operation */,\n\t\t\t);\n\t\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t\tassert(\n\t\t\t\tpendingClearMessageId === localOpMetadata.pendingMessageId,\n\t\t\t\t0x32a /* pendingMessageId does not match */,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tthis.clearExceptPendingKeys(false);\n\t}\n\n\t/**\n\t * Apply clear operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedClearMessage(op: IDirectoryClearOperation): IClearLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\tconst previousValue = new Map<string, ILocalValue>(this._storage);\n\t\tthis.clearExceptPendingKeys(true);\n\t\tconst pendingMsgId = ++this.pendingMessageId;\n\t\tthis.pendingClearMessageIds.push(pendingMsgId);\n\t\tconst metadata: IClearLocalOpMetadata = {\n\t\t\ttype: \"clear\",\n\t\t\tpendingMessageId: pendingMsgId,\n\t\t\tpreviousStorage: previousValue,\n\t\t};\n\t\treturn metadata;\n\t}\n\n\t/**\n\t * Process a delete operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processDeleteMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryDeleteOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessStorageOperation(op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deleteCore(op.key, local);\n\t}\n\n\t/**\n\t * Apply delete operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedDeleteMessage(op: IDirectoryDeleteOperation): IKeyEditLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\tconst previousValue = this.deleteCore(op.key, true);\n\t\tconst pendingMessageId = this.getKeyMessageId(op);\n\t\tconst localMetadata: IKeyEditLocalOpMetadata = {\n\t\t\ttype: \"edit\",\n\t\t\tpendingMessageId,\n\t\t\tpreviousValue,\n\t\t};\n\t\treturn localMetadata;\n\t}\n\n\t/**\n\t * Process a set operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processSetMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectorySetOperation,\n\t\tcontext: ILocalValue | undefined,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessStorageOperation(op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// needProcessStorageOperation should have returned false if local is true\n\t\t// so we can assume context is not undefined\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tthis.setCore(op.key, context!, local);\n\t}\n\n\t/**\n\t * Apply set operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedSetMessage(\n\t\top: IDirectorySetOperation,\n\t\tcontext: ILocalValue,\n\t): IKeyEditLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(op.key, context, true);\n\n\t\t// Create metadata\n\t\tconst pendingMessageId = this.getKeyMessageId(op);\n\t\tconst localMetadata: IKeyEditLocalOpMetadata = {\n\t\t\ttype: \"edit\",\n\t\t\tpendingMessageId,\n\t\t\tpreviousValue,\n\t\t};\n\t\treturn localMetadata;\n\t}\n\t/**\n\t * Process a create subdirectory operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processCreateSubDirectoryMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryCreateSubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tassertNonNullClientId(msg.clientId);\n\t\tthis.createSubDirectoryCore(op.subdirName, local, msg.sequenceNumber, msg.clientId);\n\t}\n\n\t/**\n\t * Apply createSubDirectory operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedCreateSubDirMessage(\n\t\top: IDirectoryCreateSubDirectoryOperation,\n\t): ICreateSubDirLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\t// Create the sub directory locally first.\n\t\tthis.createSubDirectoryCore(\n\t\t\top.subdirName,\n\t\t\ttrue,\n\t\t\tthis.getLocalSeq(),\n\t\t\tthis.runtime.clientId ?? \"detached\",\n\t\t);\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: ICreateSubDirLocalOpMetadata = {\n\t\t\ttype: \"createSubDir\",\n\t\t};\n\t\treturn localOpMetadata;\n\t}\n\n\t/**\n\t * Process a delete subdirectory operation.\n\t * @param msg - The message from the server to apply.\n\t * @param op - The op to process\n\t * @param local - Whether the message originated from the local client\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @internal\n\t */\n\tpublic processDeleteSubDirectoryMessage(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tif (\n\t\t\t!(\n\t\t\t\tthis.isMessageForCurrentInstanceOfSubDirectory(msg) &&\n\t\t\t\tthis.needProcessSubDirectoryOperation(msg, op, local, localOpMetadata)\n\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tthis.deleteSubDirectoryCore(op.subdirName, local);\n\t}\n\n\t/**\n\t * Apply deleteSubDirectory operation locally and generate metadata\n\t * @param op - Op to apply\n\t * @returns metadata generated for stahed op\n\t */\n\tpublic applyStashedDeleteSubDirMessage(\n\t\top: IDirectoryDeleteSubDirectoryOperation,\n\t): IDeleteSubDirLocalOpMetadata {\n\t\tthis.throwIfDisposed();\n\t\tconst subDir = this.deleteSubDirectoryCore(op.subdirName, true);\n\t\tthis.updatePendingSubDirMessageCount(op);\n\t\tconst metadata: IDeleteSubDirLocalOpMetadata = {\n\t\t\ttype: \"deleteSubDir\",\n\t\t\tsubDirectory: subDir,\n\t\t};\n\t\treturn metadata;\n\t}\n\n\t/**\n\t * Submit a clear operation.\n\t * @param op - The operation\n\t */\n\tprivate submitClearMessage(\n\t\top: IDirectoryClearOperation,\n\t\tpreviousValue: Map<string, ILocalValue>,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tconst pendingMsgId = ++this.pendingMessageId;\n\t\tthis.pendingClearMessageIds.push(pendingMsgId);\n\t\tconst metadata: IClearLocalOpMetadata = {\n\t\t\ttype: \"clear\",\n\t\t\tpendingMessageId: pendingMsgId,\n\t\t\tpreviousStorage: previousValue,\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, metadata);\n\t}\n\n\t/**\n\t * Resubmit a clear operation.\n\t * @param op - The operation\n\t * @internal\n\t */\n\tpublic resubmitClearMessage(op: IDirectoryClearOperation, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\tisClearLocalOpMetadata(localOpMetadata),\n\t\t\t0x32b /* Invalid localOpMetadata for clear */,\n\t\t);\n\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\tconst pendingClearMessageId = this.pendingClearMessageIds.shift();\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (pendingClearMessageId === localOpMetadata.pendingMessageId) {\n\t\t\tthis.submitClearMessage(op, localOpMetadata.previousStorage);\n\t\t}\n\t}\n\n\t/**\n\t * Get a new pending message id for the op and cache it to track the pending op\n\t */\n\tprivate getKeyMessageId(op: IDirectoryKeyOperation): number {\n\t\t// We don't reuse the metadata pendingMessageId but send a new one on each submit.\n\t\tconst pendingMessageId = ++this.pendingMessageId;\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingMessageIds !== undefined) {\n\t\t\tpendingMessageIds.push(pendingMessageId);\n\t\t} else {\n\t\t\tthis.pendingKeys.set(op.key, [pendingMessageId]);\n\t\t}\n\t\treturn pendingMessageId;\n\t}\n\n\t/**\n\t * Submit a key operation.\n\t * @param op - The operation\n\t * @param previousValue - The value of the key before this op\n\t */\n\tprivate submitKeyMessage(op: IDirectoryKeyOperation, previousValue?: ILocalValue): void {\n\t\tthis.throwIfDisposed();\n\t\tconst pendingMessageId = this.getKeyMessageId(op);\n\t\tconst localMetadata = { type: \"edit\", pendingMessageId, previousValue };\n\t\tthis.directory.submitDirectoryMessage(op, localMetadata);\n\t}\n\n\t/**\n\t * Submit a key message to remote clients based on a previous submit.\n\t * @param op - The map key message\n\t * @param localOpMetadata - Metadata from the previous submit\n\t * @internal\n\t */\n\tpublic resubmitKeyMessage(op: IDirectoryKeyOperation, localOpMetadata: unknown): void {\n\t\tassert(\n\t\t\tisKeyEditLocalOpMetadata(localOpMetadata),\n\t\t\t0x32d /* Invalid localOpMetadata in submit */,\n\t\t);\n\n\t\t// clear the old pending message id\n\t\tconst pendingMessageIds = this.pendingKeys.get(op.key);\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (pendingMessageIds !== undefined) {\n\t\t\tconst index = pendingMessageIds.findIndex(\n\t\t\t\t(id) => id === localOpMetadata.pendingMessageId,\n\t\t\t);\n\t\t\tif (index === -1) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpendingMessageIds.splice(index, 1);\n\t\t\tif (pendingMessageIds.length === 0) {\n\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t}\n\t\t\tthis.submitKeyMessage(op, localOpMetadata.previousValue);\n\t\t}\n\t}\n\n\tprivate incrementPendingSubDirCount(map: Map<string, number>, subDirName: string) {\n\t\tconst count = map.get(subDirName) ?? 0;\n\t\tmap.set(subDirName, count + 1);\n\t}\n\n\tprivate decrementPendingSubDirCount(map: Map<string, number>, subDirName: string) {\n\t\tconst count = map.get(subDirName) ?? 0;\n\t\tmap.set(subDirName, count - 1);\n\t\tif (count <= 1) {\n\t\t\tmap.delete(subDirName);\n\t\t}\n\t}\n\n\t/**\n\t * Update the count for pending create/delete of the sub directory so that it can be validated on receiving op\n\t * or while resubmitting the op.\n\t */\n\tprivate updatePendingSubDirMessageCount(op: IDirectorySubDirectoryOperation) {\n\t\tif (op.type === \"deleteSubDirectory\") {\n\t\t\tthis.incrementPendingSubDirCount(\n\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\top.subdirName,\n\t\t\t);\n\t\t} else if (op.type === \"createSubDirectory\") {\n\t\t\tthis.incrementPendingSubDirCount(\n\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\top.subdirName,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Submit a create subdirectory operation.\n\t * @param op - The operation\n\t */\n\tprivate submitCreateSubDirectoryMessage(op: IDirectorySubDirectoryOperation): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: ICreateSubDirLocalOpMetadata = {\n\t\t\ttype: \"createSubDir\",\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Submit a delete subdirectory operation.\n\t * @param op - The operation\n\t * @param subDir - Any subdirectory deleted by the op\n\t */\n\tprivate submitDeleteSubDirectoryMessage(\n\t\top: IDirectorySubDirectoryOperation,\n\t\tsubDir: SubDirectory | undefined,\n\t): void {\n\t\tthis.throwIfDisposed();\n\t\tthis.updatePendingSubDirMessageCount(op);\n\n\t\tconst localOpMetadata: IDeleteSubDirLocalOpMetadata = {\n\t\t\ttype: \"deleteSubDir\",\n\t\t\tsubDirectory: subDir,\n\t\t};\n\t\tthis.directory.submitDirectoryMessage(op, localOpMetadata);\n\t}\n\n\t/**\n\t * Submit a subdirectory operation again\n\t * @param op - The operation\n\t * @param localOpMetadata - metadata submitted with the op originally\n\t * @internal\n\t */\n\tpublic resubmitSubDirectoryMessage(\n\t\top: IDirectorySubDirectoryOperation,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tassert(\n\t\t\tisSubDirLocalOpMetadata(localOpMetadata),\n\t\t\t0x32f /* Invalid localOpMetadata for sub directory op */,\n\t\t);\n\n\t\t// Only submit the op, if we have record for it, otherwise it is possible that the older instance\n\t\t// is already deleted, in which case we don't need to submit the op.\n\t\tif (\n\t\t\tlocalOpMetadata.type === \"createSubDir\" &&\n\t\t\t!this.pendingCreateSubDirectoriesTracker.has(op.subdirName)\n\t\t) {\n\t\t\treturn;\n\t\t} else if (\n\t\t\tlocalOpMetadata.type === \"deleteSubDir\" &&\n\t\t\t!this.pendingDeleteSubDirectoriesTracker.has(op.subdirName)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (localOpMetadata.type === \"createSubDir\") {\n\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\top.subdirName,\n\t\t\t);\n\t\t\tthis.submitCreateSubDirectoryMessage(op);\n\t\t} else {\n\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\top.subdirName,\n\t\t\t);\n\t\t\tthis.submitDeleteSubDirectoryMessage(op, localOpMetadata.subDirectory);\n\t\t}\n\t}\n\n\t/**\n\t * Get the storage of this subdirectory in a serializable format, to be used in snapshotting.\n\t * @param serializer - The serializer to use to serialize handles in its values.\n\t * @returns The JSONable string representing the storage of this subdirectory\n\t * @internal\n\t */\n\tpublic *getSerializedStorage(\n\t\tserializer: IFluidSerializer,\n\t): Generator<[string, ISerializedValue], void> {\n\t\tthis.throwIfDisposed();\n\t\tfor (const [key, localValue] of this._storage) {\n\t\t\tconst value = localValue.makeSerialized(serializer, this.directory.handle);\n\t\t\tconst res: [string, ISerializedValue] = [key, value];\n\t\t\tyield res;\n\t\t}\n\t}\n\n\tpublic getSerializableCreateInfo() {\n\t\tthis.throwIfDisposed();\n\t\tconst createInfo: ICreateInfo = {\n\t\t\tcsn: this.sequenceNumber,\n\t\t\tccIds: Array.from(this.clientIds),\n\t\t};\n\t\treturn createInfo;\n\t}\n\n\t/**\n\t * Populate a key value in this subdirectory's storage, to be used when loading from snapshot.\n\t * @param key - The key to populate\n\t * @param localValue - The local value to populate into it\n\t * @internal\n\t */\n\tpublic populateStorage(key: string, localValue: ILocalValue): void {\n\t\tthis.throwIfDisposed();\n\t\tthis._storage.set(key, localValue);\n\t}\n\n\t/**\n\t * Populate a subdirectory into this subdirectory, to be used when loading from snapshot.\n\t * @param subdirName - The name of the subdirectory to add\n\t * @param newSubDir - The new subdirectory to add\n\t * @internal\n\t */\n\tpublic populateSubDirectory(subdirName: string, newSubDir: SubDirectory): void {\n\t\tthis.throwIfDisposed();\n\t\tthis._subdirectories.set(subdirName, newSubDir);\n\t}\n\n\t/**\n\t * Retrieve the local value at the given key. This is used to get value type information stashed on the local\n\t * value so op handlers can be retrieved\n\t * @param key - The key to retrieve from\n\t * @returns The local value\n\t * @internal\n\t */\n\tpublic getLocalValue<T extends ILocalValue = ILocalValue>(key: string): T {\n\t\tthis.throwIfDisposed();\n\t\treturn this._storage.get(key) as T;\n\t}\n\n\t/**\n\t * Remove the pendingMessageId from the map tracking it on rollback\n\t * @param map - map tracking the pending messages\n\t * @param key - key of the edit in the op\n\t */\n\tprivate rollbackPendingMessageId(\n\t\tmap: Map<string, number[]>,\n\t\tkey: string,\n\t\tpendingMessageId,\n\t): void {\n\t\tconst pendingMessageIds = map.get(key);\n\t\tconst lastPendingMessageId = pendingMessageIds?.pop();\n\t\tif (!pendingMessageIds || lastPendingMessageId !== pendingMessageId) {\n\t\t\tthrow new Error(\"Rollback op does not match last pending\");\n\t\t}\n\t\tif (pendingMessageIds.length === 0) {\n\t\t\tmap.delete(key);\n\t\t}\n\t}\n\n\t/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n\n\t/**\n\t * Rollback a local op\n\t * @param op - The operation to rollback\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic rollback(op: any, localOpMetadata: unknown): void {\n\t\tif (!isDirectoryLocalOpMetadata(localOpMetadata)) {\n\t\t\tthrow new Error(\"Invalid localOpMetadata\");\n\t\t}\n\n\t\tif (op.type === \"clear\" && localOpMetadata.type === \"clear\") {\n\t\t\tfor (const [key, localValue] of localOpMetadata.previousStorage.entries()) {\n\t\t\t\tthis.setCore(key, localValue, true);\n\t\t\t}\n\n\t\t\tconst lastPendingClearId = this.pendingClearMessageIds.pop();\n\t\t\tif (\n\t\t\t\tlastPendingClearId === undefined ||\n\t\t\t\tlastPendingClearId !== localOpMetadata.pendingMessageId\n\t\t\t) {\n\t\t\t\tthrow new Error(\"Rollback op does match last clear\");\n\t\t\t}\n\t\t} else if ((op.type === \"delete\" || op.type === \"set\") && localOpMetadata.type === \"edit\") {\n\t\t\tif (localOpMetadata.previousValue === undefined) {\n\t\t\t\tthis.deleteCore(op.key as string, true);\n\t\t\t} else {\n\t\t\t\tthis.setCore(op.key as string, localOpMetadata.previousValue, true);\n\t\t\t}\n\n\t\t\tthis.rollbackPendingMessageId(\n\t\t\t\tthis.pendingKeys,\n\t\t\t\top.key as string,\n\t\t\t\tlocalOpMetadata.pendingMessageId,\n\t\t\t);\n\t\t} else if (op.type === \"createSubDirectory\" && localOpMetadata.type === \"createSubDir\") {\n\t\t\tthis.deleteSubDirectoryCore(op.subdirName as string, true);\n\n\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\top.subdirName as string,\n\t\t\t);\n\t\t} else if (op.type === \"deleteSubDirectory\" && localOpMetadata.type === \"deleteSubDir\") {\n\t\t\tif (localOpMetadata.subDirectory !== undefined) {\n\t\t\t\tthis.undeleteSubDirectoryTree(localOpMetadata.subDirectory);\n\t\t\t\t// don't need to register events because deleting never unregistered\n\t\t\t\tthis._subdirectories.set(op.subdirName as string, localOpMetadata.subDirectory);\n\t\t\t\tthis.emit(\"subDirectoryCreated\", op.subdirName, true, this);\n\t\t\t}\n\n\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\top.subDirName as string,\n\t\t\t);\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/* eslint-enable @typescript-eslint/no-unsafe-member-access */\n\n\t/**\n\t * Converts the given relative path into an absolute path.\n\t * @param path - Relative path to convert\n\t * @returns The equivalent absolute path\n\t */\n\tprivate makeAbsolute(relativePath: string): string {\n\t\treturn posix.resolve(this.absolutePath, relativePath);\n\t}\n\n\t/**\n\t * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n\t * not process the incoming operation.\n\t * @param op - Operation to check\n\t * @param local - Whether the operation originated from the local client\n\t * @param localOpMetadata - For local client ops, this is the metadata that was submitted with the op.\n\t * For ops from a remote client, this will be undefined.\n\t * @returns True if the operation should be processed, false otherwise\n\t */\n\tprivate needProcessStorageOperation(\n\t\top: IDirectoryKeyOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tif (this.pendingClearMessageIds.length > 0) {\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined &&\n\t\t\t\t\t\tisKeyEditLocalOpMetadata(localOpMetadata) &&\n\t\t\t\t\t\tlocalOpMetadata.pendingMessageId < this.pendingClearMessageIds[0],\n\t\t\t\t\t0x010 /* \"Received out of order storage op when there is an unackd clear message\" */,\n\t\t\t\t);\n\t\t\t\t// Remove all pendingMessageIds lower than first pendingClearMessageId.\n\t\t\t\tconst lowestPendingClearMessageId = this.pendingClearMessageIds[0];\n\t\t\t\tconst pendingKeyMessageIdArray = this.pendingKeys.get(op.key);\n\t\t\t\tif (pendingKeyMessageIdArray !== undefined) {\n\t\t\t\t\tlet index = 0;\n\t\t\t\t\twhile (pendingKeyMessageIdArray[index] < lowestPendingClearMessageId) {\n\t\t\t\t\t\tindex += 1;\n\t\t\t\t\t}\n\t\t\t\t\tconst newPendingKeyMessageId = pendingKeyMessageIdArray.splice(index);\n\t\t\t\t\tif (newPendingKeyMessageId.length === 0) {\n\t\t\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.pendingKeys.set(op.key, newPendingKeyMessageId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If I have a NACK clear, we can ignore all ops.\n\t\t\treturn false;\n\t\t}\n\n\t\tconst pendingKeyMessageIds = this.pendingKeys.get(op.key);\n\t\tif (pendingKeyMessageIds !== undefined) {\n\t\t\t// Found an NACK op, clear it from the directory if the latest sequence number in the directory\n\t\t\t// match the message's and don't process the op.\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tlocalOpMetadata !== undefined && isKeyEditLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t0x011 /* pendingMessageId is missing from the local client's operation */,\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tpendingKeyMessageIds[0] === localOpMetadata.pendingMessageId,\n\t\t\t\t\t0x331 /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tpendingKeyMessageIds.shift();\n\t\t\t\tif (pendingKeyMessageIds.length === 0) {\n\t\t\t\t\tthis.pendingKeys.delete(op.key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t// If we don't have a NACK op on the key, we need to process the remote ops.\n\t\treturn !local;\n\t}\n\n\t/**\n\t * This return true if the message is for the current instance of this sub directory. As the sub directory\n\t * can be deleted and created again, then this finds if the message is for current instance of directory or not.\n\t * @param msg - message for the directory\n\t */\n\tprivate isMessageForCurrentInstanceOfSubDirectory(msg: ISequencedDocumentMessage) {\n\t\t// If the message is either from the creator of directory or this directory was created when\n\t\t// container was detached or in case this directory is already live(known to other clients)\n\t\t// and the op was created after the directory was created then apply this op.\n\t\treturn (\n\t\t\t(msg.clientId !== null && this.clientIds.has(msg.clientId)) ||\n\t\t\tthis.clientIds.has(\"detached\") ||\n\t\t\t(this.sequenceNumber !== -1 && this.sequenceNumber <= msg.referenceSequenceNumber)\n\t\t);\n\t}\n\n\t/**\n\t * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should\n\t * not process the incoming operation.\n\t * @param op - Operation to check\n\t * @param local - Whether the message originated from the local client\n\t * @param message - The message\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be undefined.\n\t * @returns True if the operation should be processed, false otherwise\n\t */\n\tprivate needProcessSubDirectoryOperation(\n\t\tmsg: ISequencedDocumentMessage,\n\t\top: IDirectorySubDirectoryOperation,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): boolean {\n\t\tassertNonNullClientId(msg.clientId);\n\t\tconst pendingDeleteCount = this.pendingDeleteSubDirectoriesTracker.get(op.subdirName);\n\t\tconst pendingCreateCount = this.pendingCreateSubDirectoriesTracker.get(op.subdirName);\n\t\tif (\n\t\t\t(pendingDeleteCount !== undefined && pendingDeleteCount > 0) ||\n\t\t\t(pendingCreateCount !== undefined && pendingCreateCount > 0)\n\t\t) {\n\t\t\tif (local) {\n\t\t\t\tassert(\n\t\t\t\t\tisSubDirLocalOpMetadata(localOpMetadata),\n\t\t\t\t\t0x012 /* pendingMessageId is missing from the local client's operation */,\n\t\t\t\t);\n\t\t\t\tif (localOpMetadata.type === \"deleteSubDir\") {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingDeleteCount !== undefined && pendingDeleteCount > 0,\n\t\t\t\t\t\t0x6c2 /* pendingDeleteCount should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\t\t\tthis.pendingDeleteSubDirectoriesTracker,\n\t\t\t\t\t\top.subdirName,\n\t\t\t\t\t);\n\t\t\t\t} else if (localOpMetadata.type === \"createSubDir\") {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpendingCreateCount !== undefined && pendingCreateCount > 0,\n\t\t\t\t\t\t0x6c3 /* pendingCreateCount should exist */,\n\t\t\t\t\t);\n\t\t\t\t\tthis.decrementPendingSubDirCount(\n\t\t\t\t\t\tthis.pendingCreateSubDirectoriesTracker,\n\t\t\t\t\t\top.subdirName,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (op.type === \"deleteSubDirectory\") {\n\t\t\t\tconst resetSubDirectoryTree = (directory: SubDirectory | undefined): void => {\n\t\t\t\t\tif (!directory) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// If this is delete op and we have keys in this subDirectory, then we need to delete these\n\t\t\t\t\t// keys except the pending ones as they will be sequenced after this delete.\n\t\t\t\t\tdirectory.clearExceptPendingKeys(local);\n\t\t\t\t\t// In case of delete op, we need to reset the creation seq number and client ids of\n\t\t\t\t\t// creators as the previous directory is getting deleted and we will initialize again when\n\t\t\t\t\t// we will receive op for the create again.\n\t\t\t\t\tdirectory.sequenceNumber = -1;\n\t\t\t\t\tdirectory.clientIds.clear();\n\t\t\t\t\t// Do the same thing for the subtree of the directory. If create is not pending for a child, then just\n\t\t\t\t\t// delete it.\n\t\t\t\t\tconst subDirectories = directory.subdirectories();\n\t\t\t\t\tfor (const [subDirName, subDir] of subDirectories) {\n\t\t\t\t\t\tif (directory.pendingCreateSubDirectoriesTracker.has(subDirName)) {\n\t\t\t\t\t\t\tresetSubDirectoryTree(subDir as SubDirectory);\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdirectory.deleteSubDirectoryCore(subDirName, false);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst subDirectory = this._subdirectories.get(op.subdirName);\n\t\t\t\tresetSubDirectoryTree(subDirectory);\n\t\t\t}\n\t\t\tif (op.type === \"createSubDirectory\") {\n\t\t\t\tconst dir = this._subdirectories.get(op.subdirName);\n\t\t\t\t// Child sub directory create seq number can't be lower than the parent subdirectory.\n\t\t\t\t// The sequence number for multiple ops can be the same when multiple createSubDirectory occurs with grouped batching enabled, thus <= and not just <.\n\t\t\t\tif (this.sequenceNumber !== -1 && this.sequenceNumber <= msg.sequenceNumber) {\n\t\t\t\t\tif (dir?.sequenceNumber === -1) {\n\t\t\t\t\t\t// Only set the seq on the first message, could be more\n\t\t\t\t\t\tdir.sequenceNumber = msg.sequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\t// The client created the dir at or after the dirs seq, so list its client id as a creator.\n\t\t\t\t\tif (\n\t\t\t\t\t\tdir !== undefined &&\n\t\t\t\t\t\t!dir.clientIds.has(msg.clientId) &&\n\t\t\t\t\t\tdir.sequenceNumber <= msg.sequenceNumber\n\t\t\t\t\t) {\n\t\t\t\t\t\tdir.clientIds.add(msg.clientId);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !local;\n\t}\n\n\t/**\n\t * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.\n\t */\n\tprivate clearExceptPendingKeys(local: boolean): void {\n\t\t// Assuming the pendingKeys is small and the map is large\n\t\t// we will get the value for the pendingKeys and clear the map\n\t\tconst temp = new Map<string, ILocalValue>();\n\n\t\tfor (const [key] of this.pendingKeys) {\n\t\t\tconst value = this._storage.get(key);\n\t\t\t// If this key is already deleted, then we don't need to add it again.\n\t\t\tif (value !== undefined) {\n\t\t\t\ttemp.set(key, value);\n\t\t\t}\n\t\t}\n\n\t\tthis.clearCore(local);\n\n\t\tfor (const [key, value] of temp.entries()) {\n\t\t\tthis.setCore(key, value, true);\n\t\t}\n\t}\n\n\t/**\n\t * Clear implementation used for both locally sourced clears as well as incoming remote clears.\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate clearCore(local: boolean): void {\n\t\tthis._storage.clear();\n\t\tthis.directory.emit(\"clear\", local, this.directory);\n\t}\n\n\t/**\n\t * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.\n\t * @param key - The key being deleted\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key if it existed, undefined if it did not exist\n\t */\n\tprivate deleteCore(key: string, local: boolean): ILocalValue | undefined {\n\t\tconst previousLocalValue = this._storage.get(key);\n\t\tconst previousValue: unknown = previousLocalValue?.value;\n\t\tconst successfullyRemoved = this._storage.delete(key);\n\t\tif (successfullyRemoved) {\n\t\t\tconst event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };\n\t\t\tthis.directory.emit(\"valueChanged\", event, local, this.directory);\n\t\t\tconst containedEvent: IValueChanged = { key, previousValue };\n\t\t\tthis.emit(\"containedValueChanged\", containedEvent, local, this);\n\t\t}\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Set implementation used for both locally sourced sets as well as incoming remote sets.\n\t * @param key - The key being set\n\t * @param value - The value being set\n\t * @param local - Whether the message originated from the local client\n\t * @returns Previous local value of the key, if any\n\t */\n\tprivate setCore(key: string, value: ILocalValue, local: boolean): ILocalValue | undefined {\n\t\tconst previousLocalValue = this._storage.get(key);\n\t\tconst previousValue: unknown = previousLocalValue?.value;\n\t\tthis._storage.set(key, value);\n\t\tconst event: IDirectoryValueChanged = { key, path: this.absolutePath, previousValue };\n\t\tthis.directory.emit(\"valueChanged\", event, local, this.directory);\n\t\tconst containedEvent: IValueChanged = { key, previousValue };\n\t\tthis.emit(\"containedValueChanged\", containedEvent, local, this);\n\t\treturn previousLocalValue;\n\t}\n\n\t/**\n\t * Create subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n\t * @param subdirName - The name of the subdirectory being created\n\t * @param local - Whether the message originated from the local client\n\t * @param seq - Sequence number at which this directory is created\n\t * @param clientId - Id of client which created this directory.\n\t * @returns True if is newly created, false if it already existed.\n\t */\n\tprivate createSubDirectoryCore(\n\t\tsubdirName: string,\n\t\tlocal: boolean,\n\t\tseq: number,\n\t\tclientId: string,\n\t): boolean {\n\t\tconst subdir = this._subdirectories.get(subdirName);\n\t\tif (subdir === undefined) {\n\t\t\tconst absolutePath = posix.join(this.absolutePath, subdirName);\n\t\t\tconst subDir = new SubDirectory(\n\t\t\t\tseq,\n\t\t\t\tnew Set([clientId]),\n\t\t\t\tthis.directory,\n\t\t\t\tthis.runtime,\n\t\t\t\tthis.serializer,\n\t\t\t\tabsolutePath,\n\t\t\t);\n\t\t\tthis.registerEventsOnSubDirectory(subDir, subdirName);\n\t\t\tthis._subdirectories.set(subdirName, subDir);\n\t\t\tthis.emit(\"subDirectoryCreated\", subdirName, local, this);\n\t\t\treturn true;\n\t\t} else {\n\t\t\tsubdir.clientIds.add(clientId);\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate registerEventsOnSubDirectory(subDirectory: SubDirectory, subDirName: string): void {\n\t\tsubDirectory.on(\"subDirectoryCreated\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryCreated\", posix.join(subDirName, relativePath), local, this);\n\t\t});\n\t\tsubDirectory.on(\"subDirectoryDeleted\", (relativePath: string, local: boolean) => {\n\t\t\tthis.emit(\"subDirectoryDeleted\", posix.join(subDirName, relativePath), local, this);\n\t\t});\n\t}\n\n\t/**\n\t * Delete subdirectory implementation used for both locally sourced creation as well as incoming remote creation.\n\t * @param subdirName - The name of the subdirectory being deleted\n\t * @param local - Whether the message originated from the local client\n\t */\n\tprivate deleteSubDirectoryCore(subdirName: string, local: boolean): SubDirectory | undefined {\n\t\tconst previousValue = this._subdirectories.get(subdirName);\n\t\t// This should make the subdirectory structure unreachable so it can be GC'd and won't appear in snapshots\n\t\t// Might want to consider cleaning out the structure more exhaustively though? But not when rollback.\n\t\tif (previousValue !== undefined) {\n\t\t\tthis._subdirectories.delete(subdirName);\n\t\t\tthis.disposeSubDirectoryTree(previousValue);\n\t\t\tthis.emit(\"subDirectoryDeleted\", subdirName, local, this);\n\t\t}\n\t\treturn previousValue;\n\t}\n\n\tprivate disposeSubDirectoryTree(directory: IDirectory | undefined): void {\n\t\tif (!directory) {\n\t\t\treturn;\n\t\t}\n\t\t// Dispose the subdirectory tree. This will dispose the subdirectories from bottom to top.\n\t\tconst subDirectories = directory.subdirectories();\n\t\tfor (const [_, subDirectory] of subDirectories) {\n\t\t\tthis.disposeSubDirectoryTree(subDirectory);\n\t\t}\n\t\tif (typeof directory.dispose === \"function\") {\n\t\t\tdirectory.dispose();\n\t\t}\n\t}\n\n\tprivate undeleteSubDirectoryTree(directory: SubDirectory): void {\n\t\t// Restore deleted subdirectory tree. This will unmark \"deleted\" from the subdirectories from bottom to top.\n\t\tfor (const [_, subDirectory] of this._subdirectories.entries()) {\n\t\t\tthis.undeleteSubDirectoryTree(subDirectory);\n\t\t}\n\t\tdirectory.undispose();\n\t}\n}\n"]}
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,yCAeqB;AAdpB,6GAAA,gBAAgB,OAAA;AAahB,4GAAA,eAAe,OAAA;AAchB,6CAA6D;AAApD,8GAAA,eAAe,OAAA;AACxB,6BAA8C;AAArC,iGAAA,UAAU,OAAA;AAAE,gGAAA,SAAS,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * The `map` library provides interfaces and implementing classes for map-like distributed data structures.\n *\n * @remarks The following distributed data structures are defined in this library:\n *\n * - {@link SharedMap}\n *\n * - {@link SharedDirectory}\n *\n * @packageDocumentation\n */\n\nexport {\n\tDirectoryFactory,\n\tICreateInfo,\n\tIDirectoryClearOperation,\n\tIDirectoryCreateSubDirectoryOperation,\n\tIDirectoryDataObject,\n\tIDirectoryDeleteOperation,\n\tIDirectoryDeleteSubDirectoryOperation,\n\tIDirectoryKeyOperation,\n\tIDirectoryNewStorageFormat,\n\tIDirectoryOperation,\n\tIDirectorySetOperation,\n\tIDirectoryStorageOperation,\n\tIDirectorySubDirectoryOperation,\n\tSharedDirectory,\n} from \"./directory\";\nexport {\n\tIDirectory,\n\tIDirectoryEvents,\n\tIDirectoryValueChanged,\n\tISerializableValue,\n\tISerializedValue,\n\tISharedDirectory,\n\tISharedDirectoryEvents,\n\tISharedMap,\n\tISharedMapEvents,\n\tIValueChanged,\n} from \"./interfaces\";\nexport { LocalValueMaker, ILocalValue } from \"./localValues\";\nexport { MapFactory, SharedMap } from \"./map\";\n"]}
@@ -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 {\n\tIDisposable,\n\tIEvent,\n\tIEventProvider,\n\tIEventThisPlaceHolder,\n} from \"@fluidframework/core-interfaces\";\n\n/**\n * Type of \"valueChanged\" event parameter.\n *\n * @public\n */\nexport interface IValueChanged {\n\t/**\n\t * The key storing the value that changed.\n\t */\n\tkey: string;\n\n\t/**\n\t * The value that was stored at the key prior to the change.\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpreviousValue: any;\n}\n\n/**\n * Interface describing actions on a directory.\n *\n * @remarks When used as a Map, operates on its keys.\n *\n * @public\n */\n// TODO: Use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface IDirectory\n\textends Map<string, any>,\n\t\tIEventProvider<IDirectoryEvents>,\n\t\tPartial<IDisposable> {\n\t/**\n\t * The absolute path of the directory.\n\t */\n\treadonly absolutePath: string;\n\n\t/**\n\t * Retrieves the value stored at the given key from the directory.\n\t * @param key - Key to retrieve from\n\t * @returns The stored value, or undefined if the key is not set\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tget<T = any>(key: string): T | undefined;\n\n\t/**\n\t * Sets the value stored at key to the provided value.\n\t * @param key - Key to set at\n\t * @param value - Value to set\n\t * @returns The IDirectory itself\n\t */\n\tset<T = unknown>(key: string, value: T): this;\n\n\t/**\n\t * Get the number of sub directory within the directory.\n\t * @returns The number of sub directory within a directory.\n\t */\n\tcountSubDirectory?(): number;\n\n\t/**\n\t * Creates an IDirectory child of this IDirectory, or retrieves the existing IDirectory child if one with the\n\t * same name already exists.\n\t * @param subdirName - Name of the new child directory to create\n\t * @returns The IDirectory child that was created or retrieved\n\t */\n\tcreateSubDirectory(subdirName: string): IDirectory;\n\n\t/**\n\t * Gets an IDirectory child of this IDirectory, if it exists.\n\t * @param subdirName - Name of the child directory to get\n\t * @returns The requested IDirectory\n\t */\n\tgetSubDirectory(subdirName: string): IDirectory | undefined;\n\n\t/**\n\t * Checks whether this directory has a child directory with the given name.\n\t * @param subdirName - Name of the child directory to check\n\t * @returns True if it exists, false otherwise\n\t */\n\thasSubDirectory(subdirName: string): boolean;\n\n\t/**\n\t * Deletes an IDirectory child of this IDirectory, if it exists, along with all descendent keys and directories.\n\t * @param subdirName - Name of the child directory to delete\n\t * @returns True if the IDirectory existed and was deleted, false if it did not exist\n\t */\n\tdeleteSubDirectory(subdirName: string): boolean;\n\n\t/**\n\t * Gets an iterator over the IDirectory children of this IDirectory.\n\t * @returns The IDirectory iterator\n\t */\n\tsubdirectories(): IterableIterator<[string, IDirectory]>;\n\n\t/**\n\t * Get an IDirectory within the directory, in order to use relative paths from that location.\n\t * @param relativePath - Path of the IDirectory to get, relative to this IDirectory\n\t * @returns The requested IDirectory\n\t */\n\tgetWorkingDirectory(relativePath: string): IDirectory | undefined;\n}\n\n/**\n * Events emitted in response to changes to the directory data.\n *\n * @remarks\n * These events only emit on the {@link ISharedDirectory} itself, and not on subdirectories.\n *\n * @public\n */\nexport interface ISharedDirectoryEvents extends ISharedObjectEvents {\n\t/**\n\t * Emitted when a key is set or deleted. This is emitted for any key in the {@link ISharedDirectory} or any\n\t * subdirectory.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `changed` - Information on the key that changed, its value prior to the change, and the path to the\n\t * key that changed.\n\t *\n\t * - `local` - Whether the change originated from this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"valueChanged\",\n\t\tlistener: (\n\t\t\tchanged: IDirectoryValueChanged,\n\t\t\tlocal: boolean,\n\t\t\ttarget: IEventThisPlaceHolder,\n\t\t) => void,\n\t);\n\n\t/**\n\t * Emitted when the {@link ISharedDirectory} is cleared.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `local` - Whether the clear originated from this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(event: \"clear\", listener: (local: boolean, target: IEventThisPlaceHolder) => void);\n\n\t/**\n\t * Emitted when a subdirectory is created.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is created.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the create originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryCreated\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when a subdirectory is deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is deleted.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the delete originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryDeleted\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n}\n\n/**\n * Events emitted in response to changes to the directory data.\n *\n * @public\n */\nexport interface IDirectoryEvents extends IEvent {\n\t/**\n\t * Emitted when a key is set or deleted. As opposed to the\n\t * {@link SharedDirectory}'s valueChanged event, this is emitted only on the {@link IDirectory} that directly\n\t * contains the key.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `changed` - Information on the key that changed and its value prior to the change.\n\t *\n\t * - `local` - Whether the change originated from this client.\n\t *\n\t * - `target` - The {@link IDirectory} itself.\n\t */\n\t(\n\t\tevent: \"containedValueChanged\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when a subdirectory is created. Also emitted when a delete\n\t * of a subdirectory is rolled back.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is created.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the creation originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryCreated\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when a subdirectory is deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `path` - The relative path to the subdirectory that is deleted.\n\t * It is relative from the object which raises the event.\n\t *\n\t * - `local` - Whether the delete originated from the this client.\n\t *\n\t * - `target` - The {@link ISharedDirectory} itself.\n\t */\n\t(\n\t\tevent: \"subDirectoryDeleted\",\n\t\tlistener: (path: string, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when this sub directory is deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `target` - The {@link IDirectory} itself.\n\t */\n\t(event: \"disposed\", listener: (target: IEventThisPlaceHolder) => void);\n\n\t/**\n\t * Emitted when this previously deleted sub directory is restored.\n\t * This event only needs to be handled in the case of rollback. If your application does\n\t * not use the local rollback feature, you can ignore this event.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `target` - The {@link IDirectory} itself.\n\t */\n\t(event: \"undisposed\", listener: (target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * 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 * @public\n */\nexport interface ISharedDirectory\n\textends ISharedObject<ISharedDirectoryEvents & IDirectoryEvents>,\n\t\tOmit<IDirectory, \"on\" | \"once\" | \"off\"> {\n\t// The Omit type excludes symbols, which we don't want to exclude. Adding them back here manually.\n\t// https://github.com/microsoft/TypeScript/issues/31671\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t[Symbol.iterator](): IterableIterator<[string, any]>;\n\treadonly [Symbol.toStringTag]: string;\n}\n\n/**\n * Type of \"valueChanged\" event parameter for {@link ISharedDirectory}.\n *\n * @public\n */\nexport interface IDirectoryValueChanged extends IValueChanged {\n\t/**\n\t * The absolute path to the IDirectory storing the key which changed.\n\t */\n\tpath: string;\n}\n\n/**\n * Events emitted in response to changes to the {@link ISharedMap | map} data.\n *\n * @public\n */\nexport interface ISharedMapEvents extends ISharedObjectEvents {\n\t/**\n\t * Emitted when a key is set or deleted.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `changed` - Information on the key that changed and its value prior to the change.\n\t *\n\t * - `local` - Whether the change originated from this client.\n\t *\n\t * - `target` - The {@link ISharedMap} itself.\n\t */\n\t(\n\t\tevent: \"valueChanged\",\n\t\tlistener: (changed: IValueChanged, local: boolean, target: IEventThisPlaceHolder) => void,\n\t);\n\n\t/**\n\t * Emitted when the map is cleared.\n\t *\n\t * @remarks Listener parameters:\n\t *\n\t * - `local` - Whether the clear originated from this client.\n\t *\n\t * - `target` - The {@link ISharedMap} itself.\n\t */\n\t(event: \"clear\", listener: (local: boolean, target: IEventThisPlaceHolder) => void);\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, and the values must either be a JSON-serializable object or a\n * {@link @fluidframework/datastore#FluidObjectHandle}.\n *\n * For more information, including example usages, see {@link https://fluidframework.com/docs/data-structures/map/}.\n *\n * @public\n */\n// TODO: Use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ISharedMap extends ISharedObject<ISharedMapEvents>, Map<string, any> {\n\t/**\n\t * Retrieves the given key from the map if it exists.\n\t * @param key - Key to retrieve from\n\t * @returns The stored value, or undefined if the key is not set\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tget<T = any>(key: string): T | undefined;\n\n\t/**\n\t * Sets the value stored at key to the provided value.\n\t * @param key - Key to set\n\t * @param value - Value to set\n\t * @returns The {@link ISharedMap} itself\n\t */\n\tset<T = unknown>(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 * {@link ISerializableValue.\"type\"} to understand whether they're storing a Plain JavaScript object,\n * a {@link @fluidframework/shared-object-base#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 *\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 *\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.\n *\n * @deprecated This type is legacy and deprecated.\n *\n * @public\n */\nexport interface ISerializableValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * The JSONable representation of the value.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tvalue: any;\n}\n\n/**\n * Serialized {@link ISerializableValue} counterpart.\n *\n * @public\n */\nexport interface ISerializedValue {\n\t/**\n\t * A type annotation to help indicate how the value serializes.\n\t */\n\ttype: string;\n\n\t/**\n\t * String representation of the value.\n\t *\n\t * @remarks Will be undefined if the original value was undefined.\n\t */\n\tvalue: string | undefined;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"localValues.js","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAM4C;AA+B5C;;;;;;;;GAQG;AACH,SAAgB,gBAAgB,CAC/B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAGlB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO;QACN,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,mEAAmE;QACnE,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;KAC7C,CAAC;AACH,CAAC;AAZD,4CAYC;AAED;;GAEG;AACH,MAAa,eAAe;IAC3B;;;OAGG;IACH,YAAmC,KAAc;QAAd,UAAK,GAAL,KAAK,CAAS;IAAG,CAAC;IAErD;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,8BAAS,CAAC,8BAAS,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,UAA4B,EAAE,IAAkB;QACrE,2FAA2F;QAC3F,oBAAoB;QACpB,MAAM,KAAK,GAAG,IAAA,qCAAgB,EAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAE7D,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK;SACL,CAAC;IACH,CAAC;CACD;AA3BD,0CA2BC;AAED;;;;;GAKG;AACH,MAAa,eAAe;IAC3B;;;OAGG;IACH,YAAoC,UAA4B;QAA5B,eAAU,GAAV,UAAU,CAAkB;IAAG,CAAC;IAEpE;;;OAGG;IACH,gDAAgD;IACzC,gBAAgB,CAAC,YAAgC;QACvD,2CAA2C;QAC3C,IAAI,YAAY,CAAC,IAAI,KAAK,8BAAS,CAAC,8BAAS,CAAC,MAAM,CAAC,EAAE;YACtD,YAAY,CAAC,IAAI,GAAG,8BAAS,CAAC,8BAAS,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAsB;gBACjC,IAAI,EAAE,kBAAkB;gBACxB,GAAG,EAAE,YAAY,CAAC,KAAe;aACjC,CAAC;YACF,YAAY,CAAC,KAAK,GAAG,MAAM,CAAC;SAC5B;QAED,MAAM,eAAe,GAAY,IAAA,iCAAY,EAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEnF,OAAO,IAAI,eAAe,CAAC,eAAe,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,KAAc;QACjC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACD;AApCD,0CAoCC","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\tIFluidSerializer,\n\tISerializedHandle,\n\tparseHandles,\n\tserializeHandles,\n\tValueType,\n} from \"@fluidframework/shared-object-base\";\n// eslint-disable-next-line import/no-deprecated\nimport { ISerializableValue, ISerializedValue } from \"./interfaces\";\n\n/**\n * A local value to be stored in a container type Distributed Data Store (DDS).\n *\n * @public\n */\nexport interface ILocalValue {\n\t/**\n\t * Type indicator of the value stored within.\n\t */\n\treadonly type: string;\n\n\t/**\n\t * The in-memory value stored within.\n\t */\n\t// TODO: Use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treadonly value: any;\n\n\t/**\n\t * Retrieve the serialized form of the value stored within.\n\t * @param serializer - Data store runtime's serializer\n\t * @param bind - Container type's handle\n\t * @returns The serialized form of the contained value\n\t */\n\tmakeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;\n}\n\n/**\n * Converts the provided `localValue` to its serialized form.\n *\n * @param localValue - The value to serialize.\n * @param serializer - Data store runtime's serializer.\n * @param bind - Container type's handle.\n *\n * @see {@link ILocalValue.makeSerialized}\n */\nexport function makeSerializable(\n\tlocalValue: ILocalValue,\n\tserializer: IFluidSerializer,\n\tbind: IFluidHandle,\n\t// eslint-disable-next-line import/no-deprecated\n): ISerializableValue {\n\tconst value = localValue.makeSerialized(serializer, bind);\n\treturn {\n\t\ttype: value.type,\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tvalue: value.value && JSON.parse(value.value),\n\t};\n}\n\n/**\n * Manages a contained plain value. May also contain shared object handles.\n */\nexport class PlainLocalValue implements ILocalValue {\n\t/**\n\t * Create a new PlainLocalValue.\n\t * @param value - The value to store, which may contain shared object handles\n\t */\n\tpublic constructor(public readonly value: unknown) {}\n\n\t/**\n\t * {@inheritDoc ILocalValue.\"type\"}\n\t */\n\tpublic get type(): string {\n\t\treturn ValueType[ValueType.Plain];\n\t}\n\n\t/**\n\t * {@inheritDoc ILocalValue.makeSerialized}\n\t */\n\tpublic makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue {\n\t\t// Stringify to convert to the serialized handle values - and then parse in order to create\n\t\t// a POJO for the op\n\t\tconst value = serializeHandles(this.value, serializer, bind);\n\n\t\treturn {\n\t\t\ttype: this.type,\n\t\t\tvalue,\n\t\t};\n\t}\n}\n\n/**\n * Enables a container type {@link https://fluidframework.com/docs/build/dds/ | DDS} to produce and store local\n * values with minimal awareness of how those objects are stored, serialized, and deserialized.\n *\n * @public\n */\nexport class LocalValueMaker {\n\t/**\n\t * Create a new LocalValueMaker.\n\t * @param serializer - The serializer to serialize / parse handles.\n\t */\n\tpublic constructor(private readonly serializer: IFluidSerializer) {}\n\n\t/**\n\t * Create a new local value from an incoming serialized value.\n\t * @param serializable - The serializable value to make local\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\tpublic fromSerializable(serializable: ISerializableValue): ILocalValue {\n\t\t// Migrate from old shared value to handles\n\t\tif (serializable.type === ValueType[ValueType.Shared]) {\n\t\t\tserializable.type = ValueType[ValueType.Plain];\n\t\t\tconst handle: ISerializedHandle = {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: serializable.value as string,\n\t\t\t};\n\t\t\tserializable.value = handle;\n\t\t}\n\n\t\tconst translatedValue: unknown = parseHandles(serializable.value, this.serializer);\n\n\t\treturn new PlainLocalValue(translatedValue);\n\t}\n\n\t/**\n\t * Create a new local value containing a given plain object.\n\t * @param value - The value to store\n\t * @returns An ILocalValue containing the value\n\t */\n\tpublic fromInMemory(value: unknown): ILocalValue {\n\t\treturn new PlainLocalValue(value);\n\t}\n}\n"]}