@fluidframework/map 2.0.0-rc.1.0.6 → 2.0.0-rc.2.0.1

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 (132) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +10 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +11 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/api-report/map.api.md +14 -57
  8. package/dist/directory.d.ts +10 -50
  9. package/dist/directory.d.ts.map +1 -1
  10. package/dist/directory.js +76 -164
  11. package/dist/directory.js.map +1 -1
  12. package/dist/index.d.ts +45 -4
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +43 -8
  15. package/dist/index.js.map +1 -1
  16. package/dist/interfaces.d.ts.map +1 -1
  17. package/dist/interfaces.js.map +1 -1
  18. package/dist/internalInterfaces.d.ts +2 -2
  19. package/dist/internalInterfaces.d.ts.map +1 -1
  20. package/dist/internalInterfaces.js.map +1 -1
  21. package/dist/localValues.d.ts +3 -5
  22. package/dist/localValues.d.ts.map +1 -1
  23. package/dist/localValues.js +9 -8
  24. package/dist/localValues.js.map +1 -1
  25. package/dist/map-alpha.d.ts +31 -116
  26. package/dist/map-beta.d.ts +24 -105
  27. package/dist/map-public.d.ts +24 -105
  28. package/dist/map-untrimmed.d.ts +31 -116
  29. package/dist/map.d.ts +4 -23
  30. package/dist/map.d.ts.map +1 -1
  31. package/dist/map.js +6 -29
  32. package/dist/map.js.map +1 -1
  33. package/dist/mapKernel.d.ts +3 -4
  34. package/dist/mapKernel.d.ts.map +1 -1
  35. package/dist/mapKernel.js +30 -35
  36. package/dist/mapKernel.js.map +1 -1
  37. package/dist/package.json +3 -0
  38. package/dist/packageVersion.d.ts +1 -1
  39. package/dist/packageVersion.js +1 -1
  40. package/dist/packageVersion.js.map +1 -1
  41. package/dist/tsdoc-metadata.json +1 -1
  42. package/lib/{directory.d.mts → directory.d.ts} +11 -51
  43. package/lib/directory.d.ts.map +1 -0
  44. package/lib/{directory.mjs → directory.js} +77 -165
  45. package/lib/directory.js.map +1 -0
  46. package/lib/index.d.ts +61 -0
  47. package/lib/index.d.ts.map +1 -0
  48. package/lib/index.js +55 -0
  49. package/lib/index.js.map +1 -0
  50. package/lib/{interfaces.d.mts → interfaces.d.ts} +1 -1
  51. package/lib/interfaces.d.ts.map +1 -0
  52. package/lib/{interfaces.mjs → interfaces.js} +1 -1
  53. package/lib/interfaces.js.map +1 -0
  54. package/lib/{internalInterfaces.d.mts → internalInterfaces.d.ts} +3 -3
  55. package/lib/internalInterfaces.d.ts.map +1 -0
  56. package/lib/{internalInterfaces.mjs → internalInterfaces.js} +1 -1
  57. package/lib/internalInterfaces.js.map +1 -0
  58. package/lib/{localValues.d.mts → localValues.d.ts} +4 -6
  59. package/lib/localValues.d.ts.map +1 -0
  60. package/lib/{localValues.mjs → localValues.js} +10 -9
  61. package/lib/localValues.js.map +1 -0
  62. package/lib/{map-alpha.d.mts → map-alpha.d.ts} +43 -116
  63. package/lib/{map-beta.d.mts → map-beta.d.ts} +36 -105
  64. package/lib/{map-public.d.mts → map-public.d.ts} +36 -105
  65. package/lib/{map-untrimmed.d.mts → map-untrimmed.d.ts} +43 -116
  66. package/lib/{map.d.mts → map.d.ts} +5 -24
  67. package/lib/map.d.ts.map +1 -0
  68. package/lib/{map.mjs → map.js} +5 -28
  69. package/lib/map.js.map +1 -0
  70. package/lib/{mapKernel.d.mts → mapKernel.d.ts} +4 -5
  71. package/lib/mapKernel.d.ts.map +1 -0
  72. package/lib/{mapKernel.mjs → mapKernel.js} +32 -37
  73. package/lib/mapKernel.js.map +1 -0
  74. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  75. package/lib/packageVersion.d.ts.map +1 -0
  76. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  77. package/lib/packageVersion.js.map +1 -0
  78. package/lib/test/memory/directory.spec.js +71 -0
  79. package/lib/test/memory/directory.spec.js.map +1 -0
  80. package/lib/test/memory/map.spec.js +71 -0
  81. package/lib/test/memory/map.spec.js.map +1 -0
  82. package/lib/test/mocha/directory.order.spec.js +422 -0
  83. package/lib/test/mocha/directory.order.spec.js.map +1 -0
  84. package/lib/test/mocha/directory.snapshot.spec.js +111 -0
  85. package/lib/test/mocha/directory.snapshot.spec.js.map +1 -0
  86. package/lib/test/mocha/directory.spec.js +1406 -0
  87. package/lib/test/mocha/directory.spec.js.map +1 -0
  88. package/lib/test/mocha/directoryEquivalenceUtils.js +36 -0
  89. package/lib/test/mocha/directoryEquivalenceUtils.js.map +1 -0
  90. package/lib/test/mocha/directoryFuzzTests.spec.js +337 -0
  91. package/lib/test/mocha/directoryFuzzTests.spec.js.map +1 -0
  92. package/lib/test/mocha/dirname.cjs +16 -0
  93. package/lib/test/mocha/dirname.cjs.map +1 -0
  94. package/lib/test/mocha/map.fuzz.spec.js +114 -0
  95. package/lib/test/mocha/map.fuzz.spec.js.map +1 -0
  96. package/lib/test/mocha/map.spec.js +685 -0
  97. package/lib/test/mocha/map.spec.js.map +1 -0
  98. package/lib/test/mocha/rebasing.spec.js +158 -0
  99. package/lib/test/mocha/rebasing.spec.js.map +1 -0
  100. package/lib/test/mocha/reconnection.spec.js +327 -0
  101. package/lib/test/mocha/reconnection.spec.js.map +1 -0
  102. package/lib/test/types/validateMapPrevious.generated.js +66 -0
  103. package/lib/test/types/validateMapPrevious.generated.js.map +1 -0
  104. package/package.json +55 -52
  105. package/src/directory.ts +122 -217
  106. package/src/index.ts +57 -4
  107. package/src/interfaces.ts +2 -2
  108. package/src/internalInterfaces.ts +2 -2
  109. package/src/localValues.ts +14 -9
  110. package/src/map.ts +7 -32
  111. package/src/mapKernel.ts +40 -42
  112. package/src/packageVersion.ts +1 -1
  113. package/tsconfig.cjs.json +7 -0
  114. package/tsconfig.json +2 -5
  115. package/lib/directory.d.mts.map +0 -1
  116. package/lib/directory.mjs.map +0 -1
  117. package/lib/index.d.mts +0 -9
  118. package/lib/index.d.mts.map +0 -1
  119. package/lib/index.mjs +0 -8
  120. package/lib/index.mjs.map +0 -1
  121. package/lib/interfaces.d.mts.map +0 -1
  122. package/lib/interfaces.mjs.map +0 -1
  123. package/lib/internalInterfaces.d.mts.map +0 -1
  124. package/lib/internalInterfaces.mjs.map +0 -1
  125. package/lib/localValues.d.mts.map +0 -1
  126. package/lib/localValues.mjs.map +0 -1
  127. package/lib/map.d.mts.map +0 -1
  128. package/lib/map.mjs.map +0 -1
  129. package/lib/mapKernel.d.mts.map +0 -1
  130. package/lib/mapKernel.mjs.map +0 -1
  131. package/lib/packageVersion.d.mts.map +0 -1
  132. package/lib/packageVersion.mjs.map +0 -1
@@ -58,17 +58,15 @@ export class PlainLocalValue {
58
58
  export class LocalValueMaker {
59
59
  /**
60
60
  * Create a new LocalValueMaker.
61
- * @param serializer - The serializer to serialize / parse handles.
62
61
  */
63
- constructor(serializer) {
64
- this.serializer = serializer;
65
- }
62
+ constructor() { }
66
63
  /**
67
64
  * Create a new local value from an incoming serialized value.
68
65
  * @param serializable - The serializable value to make local
69
66
  */
67
+ fromSerializable(
70
68
  // eslint-disable-next-line import/no-deprecated
71
- fromSerializable(serializable) {
69
+ serializable, serializer, bind) {
72
70
  // Migrate from old shared value to handles
73
71
  if (serializable.type === ValueType[ValueType.Shared]) {
74
72
  serializable.type = ValueType[ValueType.Plain];
@@ -76,10 +74,13 @@ export class LocalValueMaker {
76
74
  type: "__fluid_handle__",
77
75
  url: serializable.value,
78
76
  };
79
- serializable.value = handle;
77
+ // NOTE: here we require the use of `parseHandles` because the roundtrip
78
+ // through a string is necessary to resolve the absolute path of
79
+ // legacy handles (`ValueType.Shared`)
80
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
81
+ serializable.value = serializer.encode(parseHandles(handle, serializer), bind);
80
82
  }
81
- const translatedValue = parseHandles(serializable.value, this.serializer);
82
- return new PlainLocalValue(translatedValue);
83
+ return new PlainLocalValue(serializable.value);
83
84
  }
84
85
  /**
85
86
  * Create a new local value containing a given plain object.
@@ -90,4 +91,4 @@ export class LocalValueMaker {
90
91
  return new PlainLocalValue(value);
91
92
  }
92
93
  }
93
- //# sourceMappingURL=localValues.mjs.map
94
+ //# sourceMappingURL=localValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localValues.js","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEN,YAAY,EACZ,gBAAgB,EAChB,SAAS,GACT,MAAM,oCAAoC,CAAC;AA+B5C;;;;;;;;GAQG;AACH,MAAM,UAAU,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;AAED;;GAEG;AACH,MAAM,OAAO,eAAe;IAC3B;;;OAGG;IACH,YAAmC,KAAc;QAAd,UAAK,GAAL,KAAK,CAAS;IAAG,CAAC;IAErD;;OAEG;IACH,IAAW,IAAI;QACd,OAAO,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,cAAc,CAAC,UAA4B,EAAE,IAAkB;QACrE,2FAA2F;QAC3F,oBAAoB;QACpB,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAE7D,OAAO;YACN,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK;SACL,CAAC;IACH,CAAC;CACD;AAED;;;;GAIG;AACH,MAAM,OAAO,eAAe;IAC3B;;OAEG;IACH,gBAAsB,CAAC;IAEvB;;;OAGG;IACI,gBAAgB;IACtB,gDAAgD;IAChD,YAAgC,EAChC,UAA4B,EAC5B,IAAkB;QAElB,2CAA2C;QAC3C,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE;YACtD,YAAY,CAAC,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAsB;gBACjC,IAAI,EAAE,kBAAkB;gBACxB,GAAG,EAAE,YAAY,CAAC,KAAe;aACjC,CAAC;YACF,wEAAwE;YACxE,gEAAgE;YAChE,sCAAsC;YACtC,mEAAmE;YACnE,YAAY,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,CAAC;SAC/E;QAED,OAAO,IAAI,eAAe,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,KAAc;QACjC,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIFluidSerializer,\n\tparseHandles,\n\tserializeHandles,\n\tValueType,\n} from \"@fluidframework/shared-object-base\";\nimport { ISerializedHandle } from \"@fluidframework/runtime-utils\";\n// eslint-disable-next-line import/no-deprecated\nimport { ISerializableValue, ISerializedValue } from \"./interfaces.js\";\n\n/**\n * A local value to be stored in a container type Distributed Data Store (DDS).\n * @alpha\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 * @alpha\n */\nexport class LocalValueMaker {\n\t/**\n\t * Create a new LocalValueMaker.\n\t */\n\tpublic constructor() {}\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\tpublic fromSerializable(\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tserializable: ISerializableValue,\n\t\tserializer: IFluidSerializer,\n\t\tbind: IFluidHandle,\n\t): 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\t// NOTE: here we require the use of `parseHandles` because the roundtrip\n\t\t\t// through a string is necessary to resolve the absolute path of\n\t\t\t// legacy handles (`ValueType.Shared`)\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\tserializable.value = serializer.encode(parseHandles(handle, serializer), bind);\n\t\t}\n\n\t\treturn new PlainLocalValue(serializable.value);\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"]}
@@ -1,3 +1,15 @@
1
+ /**
2
+ * The `map` library provides interfaces and implementing classes for map-like distributed data structures.
3
+ *
4
+ * @remarks The following distributed data structures are defined in this library:
5
+ *
6
+ * - {@link SharedMap}
7
+ *
8
+ * - {@link SharedDirectory}
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+
1
13
  import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
14
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
15
  import { IChannelServices } from '@fluidframework/datastore-definitions';
@@ -22,7 +34,7 @@ import { SharedObject } from '@fluidframework/shared-object-base';
22
34
  * @sealed
23
35
  * @alpha
24
36
  */
25
- export declare class DirectoryFactory implements IChannelFactory {
37
+ export declare class DirectoryFactory implements IChannelFactory<ISharedDirectory> {
26
38
  /**
27
39
  * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
28
40
  */
@@ -585,17 +597,15 @@ export declare interface IValueChanged {
585
597
  * @alpha
586
598
  */
587
599
  export declare class LocalValueMaker {
588
- private readonly serializer;
589
600
  /**
590
601
  * Create a new LocalValueMaker.
591
- * @param serializer - The serializer to serialize / parse handles.
592
602
  */
593
- constructor(serializer: IFluidSerializer);
603
+ constructor();
594
604
  /**
595
605
  * Create a new local value from an incoming serialized value.
596
606
  * @param serializable - The serializable value to make local
597
607
  */
598
- fromSerializable(serializable: ISerializableValue): ILocalValue;
608
+ fromSerializable(serializable: ISerializableValue, serializer: IFluidSerializer, bind: IFluidHandle): ILocalValue;
599
609
  /**
600
610
  * Create a new local value containing a given plain object.
601
611
  * @param value - The value to store
@@ -605,12 +615,12 @@ export declare class LocalValueMaker {
605
615
  }
606
616
 
607
617
  /**
608
- * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link SharedMap}.
618
+ * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link ISharedMap}.
609
619
  *
610
620
  * @sealed
611
621
  * @alpha
612
622
  */
613
- export declare class MapFactory implements IChannelFactory {
623
+ export declare class MapFactory implements IChannelFactory<ISharedMap> {
614
624
  /**
615
625
  * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory."type"}
616
626
  */
@@ -659,13 +669,13 @@ export declare class SharedDirectory extends SharedObject<ISharedDirectoryEvents
659
669
  * @param id - Optional name of the shared directory
660
670
  * @returns Newly create shared directory (but not attached yet)
661
671
  */
662
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedDirectory;
672
+ static create(runtime: IFluidDataStoreRuntime, id?: string): ISharedDirectory;
663
673
  /**
664
674
  * Get a factory for SharedDirectory to register with the data store.
665
675
  *
666
676
  * @returns A factory that creates and load SharedDirectory
667
677
  */
668
- static getFactory(): IChannelFactory;
678
+ static getFactory(): IChannelFactory<ISharedDirectory>;
669
679
  /**
670
680
  * String representation for the class.
671
681
  */
@@ -840,7 +850,7 @@ export declare class SharedDirectory extends SharedObject<ISharedDirectoryEvents
840
850
  /**
841
851
  * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
842
852
  */
843
- protected applyStashedOp(op: unknown): unknown;
853
+ protected applyStashedOp(op: unknown): void;
844
854
  private serializeDirectory;
845
855
  }
846
856
 
@@ -849,7 +859,12 @@ export declare class SharedDirectory extends SharedObject<ISharedDirectoryEvents
849
859
  * @public
850
860
  * @deprecated Please use SharedTree for new containers. SharedMap is supported for loading preexisting Fluid Framework 1.0 containers only.
851
861
  */
852
- export declare class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {
862
+ export declare const SharedMap: {
863
+ /**
864
+ * Get a factory for SharedMap to register with the data store.
865
+ * @returns A factory that creates SharedMaps and loads them from storage.
866
+ */
867
+ getFactory(): IChannelFactory<ISharedMap>;
853
868
  /**
854
869
  * Create a new shared map.
855
870
  * @param runtime - The data store runtime that the new shared map belongs to.
@@ -862,110 +877,22 @@ export declare class SharedMap extends SharedObject<ISharedMapEvents> implements
862
877
  * ```typescript
863
878
  * const myMap = SharedMap.create(this.runtime, id);
864
879
  * ```
865
- */
866
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap;
867
- /**
868
- * Get a factory for SharedMap to register with the data store.
869
- * @returns A factory that creates SharedMaps and loads them from storage.
870
- */
871
- static getFactory(): IChannelFactory;
872
- /**
873
- * String representation for the class.
874
- */
875
- readonly [Symbol.toStringTag]: string;
876
- /**
877
- * MapKernel which manages actual map operations.
878
- */
879
- private readonly kernel;
880
- /**
881
- * Do not call the constructor. Instead, you should use the {@link SharedMap.create | create method}.
882
- *
883
- * @param id - String identifier.
884
- * @param runtime - Data store runtime.
885
- * @param attributes - The attributes for the map.
886
- */
887
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
888
- /**
889
- * Get an iterator over the keys in this map.
890
- * @returns The iterator
891
- */
892
- keys(): IterableIterator<string>;
893
- /**
894
- * Get an iterator over the entries in this map.
895
- * @returns The iterator
896
- */
897
- entries(): IterableIterator<[string, any]>;
898
- /**
899
- * Get an iterator over the values in this map.
900
- * @returns The iterator
901
- */
902
- values(): IterableIterator<any>;
903
- /**
904
- * Get an iterator over the entries in this map.
905
- * @returns The iterator
906
- */
907
- [Symbol.iterator](): IterableIterator<[string, any]>;
908
- /**
909
- * The number of key/value pairs stored in the map.
910
- */
911
- get size(): number;
912
- /**
913
- * Executes the given callback on each entry in the map.
914
- * @param callbackFn - Callback function
915
- */
916
- forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void;
917
- /**
918
- * {@inheritDoc ISharedMap.get}
919
- */
920
- get<T = any>(key: string): T | undefined;
921
- /**
922
- * Check if a key exists in the map.
923
- * @param key - The key to check
924
- * @returns True if the key exists, false otherwise
925
- */
926
- has(key: string): boolean;
927
- /**
928
- * {@inheritDoc ISharedMap.set}
929
- */
930
- set(key: string, value: unknown): this;
931
- /**
932
- * Delete a key from the map.
933
- * @param key - Key to delete
934
- * @returns True if the key existed and was deleted, false if it did not exist
935
- */
936
- delete(key: string): boolean;
937
- /**
938
- * Clear all data from the map.
939
- */
940
- clear(): void;
941
- /**
942
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
943
- */
944
- protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
945
- /**
946
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
947
- */
948
- protected loadCore(storage: IChannelStorageService): Promise<void>;
949
- /**
950
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
951
- */
952
- protected onDisconnect(): void;
953
- /**
954
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
955
- */
956
- protected reSubmitCore(content: unknown, localOpMetadata: unknown): void;
957
- /**
958
- * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
959
- */
960
- protected applyStashedOp(content: unknown): unknown;
961
- /**
962
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
963
- */
964
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
965
- /**
966
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
967
- */
968
- protected rollback(content: unknown, localOpMetadata: unknown): void;
969
- }
880
+ * @privateRemarks
881
+ * TODO:
882
+ * Clarify how this differs from `MapFactory.create`.
883
+ * They are different since making this forward to MapFactory.create breaks some things,
884
+ * but the difference is unclear from the documentation.
885
+ */
886
+ create(runtime: IFluidDataStoreRuntime, id?: string): ISharedMap;
887
+ };
888
+
889
+ /**
890
+ * {@inheritDoc ISharedMap}
891
+ * @public
892
+ * @deprecated Use ISharedMap instead.
893
+ * @privateRemarks
894
+ * This alias is for legacy compat from when the SharedMap class was exported as public.
895
+ */
896
+ export declare type SharedMap = ISharedMap;
970
897
 
971
898
  export { }
@@ -1,3 +1,15 @@
1
+ /**
2
+ * The `map` library provides interfaces and implementing classes for map-like distributed data structures.
3
+ *
4
+ * @remarks The following distributed data structures are defined in this library:
5
+ *
6
+ * - {@link SharedMap}
7
+ *
8
+ * - {@link SharedDirectory}
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+
1
13
  import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
14
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
15
  import { IChannelServices } from '@fluidframework/datastore-definitions';
@@ -142,7 +154,12 @@ export declare interface IValueChanged {
142
154
  * @public
143
155
  * @deprecated Please use SharedTree for new containers. SharedMap is supported for loading preexisting Fluid Framework 1.0 containers only.
144
156
  */
145
- export declare class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {
157
+ export declare const SharedMap: {
158
+ /**
159
+ * Get a factory for SharedMap to register with the data store.
160
+ * @returns A factory that creates SharedMaps and loads them from storage.
161
+ */
162
+ getFactory(): IChannelFactory<ISharedMap>;
146
163
  /**
147
164
  * Create a new shared map.
148
165
  * @param runtime - The data store runtime that the new shared map belongs to.
@@ -155,110 +172,24 @@ export declare class SharedMap extends SharedObject<ISharedMapEvents> implements
155
172
  * ```typescript
156
173
  * const myMap = SharedMap.create(this.runtime, id);
157
174
  * ```
175
+ * @privateRemarks
176
+ * TODO:
177
+ * Clarify how this differs from `MapFactory.create`.
178
+ * They are different since making this forward to MapFactory.create breaks some things,
179
+ * but the difference is unclear from the documentation.
158
180
  */
159
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap;
160
- /**
161
- * Get a factory for SharedMap to register with the data store.
162
- * @returns A factory that creates SharedMaps and loads them from storage.
163
- */
164
- static getFactory(): IChannelFactory;
165
- /**
166
- * String representation for the class.
167
- */
168
- readonly [Symbol.toStringTag]: string;
169
- /**
170
- * MapKernel which manages actual map operations.
171
- */
172
- private readonly kernel;
173
- /**
174
- * Do not call the constructor. Instead, you should use the {@link SharedMap.create | create method}.
175
- *
176
- * @param id - String identifier.
177
- * @param runtime - Data store runtime.
178
- * @param attributes - The attributes for the map.
179
- */
180
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
181
- /**
182
- * Get an iterator over the keys in this map.
183
- * @returns The iterator
184
- */
185
- keys(): IterableIterator<string>;
186
- /**
187
- * Get an iterator over the entries in this map.
188
- * @returns The iterator
189
- */
190
- entries(): IterableIterator<[string, any]>;
191
- /**
192
- * Get an iterator over the values in this map.
193
- * @returns The iterator
194
- */
195
- values(): IterableIterator<any>;
196
- /**
197
- * Get an iterator over the entries in this map.
198
- * @returns The iterator
199
- */
200
- [Symbol.iterator](): IterableIterator<[string, any]>;
201
- /**
202
- * The number of key/value pairs stored in the map.
203
- */
204
- get size(): number;
205
- /**
206
- * Executes the given callback on each entry in the map.
207
- * @param callbackFn - Callback function
208
- */
209
- forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void;
210
- /**
211
- * {@inheritDoc ISharedMap.get}
212
- */
213
- get<T = any>(key: string): T | undefined;
214
- /**
215
- * Check if a key exists in the map.
216
- * @param key - The key to check
217
- * @returns True if the key exists, false otherwise
218
- */
219
- has(key: string): boolean;
220
- /**
221
- * {@inheritDoc ISharedMap.set}
222
- */
223
- set(key: string, value: unknown): this;
224
- /**
225
- * Delete a key from the map.
226
- * @param key - Key to delete
227
- * @returns True if the key existed and was deleted, false if it did not exist
228
- */
229
- delete(key: string): boolean;
230
- /**
231
- * Clear all data from the map.
232
- */
233
- clear(): void;
234
- /**
235
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
236
- */
237
- protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
238
- /**
239
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
240
- */
241
- protected loadCore(storage: IChannelStorageService): Promise<void>;
242
- /**
243
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
244
- */
245
- protected onDisconnect(): void;
246
- /**
247
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
248
- */
249
- protected reSubmitCore(content: unknown, localOpMetadata: unknown): void;
250
- /**
251
- * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
252
- */
253
- protected applyStashedOp(content: unknown): unknown;
254
- /**
255
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
256
- */
257
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
258
- /**
259
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
260
- */
261
- protected rollback(content: unknown, localOpMetadata: unknown): void;
262
- }
181
+ create(runtime: IFluidDataStoreRuntime, id?: string): ISharedMap;
182
+ };
183
+
184
+ /**
185
+ * {@inheritDoc ISharedMap}
186
+ * @public
187
+ * @deprecated Use ISharedMap instead.
188
+ * @privateRemarks
189
+ * This alias is for legacy compat from when the SharedMap class was exported as public.
190
+ */
191
+ export declare type SharedMap = ISharedMap;
192
+
193
+ /* Excluded from this release type: SharedObject */
263
194
 
264
195
  export { }
@@ -1,3 +1,15 @@
1
+ /**
2
+ * The `map` library provides interfaces and implementing classes for map-like distributed data structures.
3
+ *
4
+ * @remarks The following distributed data structures are defined in this library:
5
+ *
6
+ * - {@link SharedMap}
7
+ *
8
+ * - {@link SharedDirectory}
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+
1
13
  import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
14
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
15
  import { IChannelServices } from '@fluidframework/datastore-definitions';
@@ -142,7 +154,12 @@ export declare interface IValueChanged {
142
154
  * @public
143
155
  * @deprecated Please use SharedTree for new containers. SharedMap is supported for loading preexisting Fluid Framework 1.0 containers only.
144
156
  */
145
- export declare class SharedMap extends SharedObject<ISharedMapEvents> implements ISharedMap {
157
+ export declare const SharedMap: {
158
+ /**
159
+ * Get a factory for SharedMap to register with the data store.
160
+ * @returns A factory that creates SharedMaps and loads them from storage.
161
+ */
162
+ getFactory(): IChannelFactory<ISharedMap>;
146
163
  /**
147
164
  * Create a new shared map.
148
165
  * @param runtime - The data store runtime that the new shared map belongs to.
@@ -155,110 +172,24 @@ export declare class SharedMap extends SharedObject<ISharedMapEvents> implements
155
172
  * ```typescript
156
173
  * const myMap = SharedMap.create(this.runtime, id);
157
174
  * ```
175
+ * @privateRemarks
176
+ * TODO:
177
+ * Clarify how this differs from `MapFactory.create`.
178
+ * They are different since making this forward to MapFactory.create breaks some things,
179
+ * but the difference is unclear from the documentation.
158
180
  */
159
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedMap;
160
- /**
161
- * Get a factory for SharedMap to register with the data store.
162
- * @returns A factory that creates SharedMaps and loads them from storage.
163
- */
164
- static getFactory(): IChannelFactory;
165
- /**
166
- * String representation for the class.
167
- */
168
- readonly [Symbol.toStringTag]: string;
169
- /**
170
- * MapKernel which manages actual map operations.
171
- */
172
- private readonly kernel;
173
- /**
174
- * Do not call the constructor. Instead, you should use the {@link SharedMap.create | create method}.
175
- *
176
- * @param id - String identifier.
177
- * @param runtime - Data store runtime.
178
- * @param attributes - The attributes for the map.
179
- */
180
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
181
- /**
182
- * Get an iterator over the keys in this map.
183
- * @returns The iterator
184
- */
185
- keys(): IterableIterator<string>;
186
- /**
187
- * Get an iterator over the entries in this map.
188
- * @returns The iterator
189
- */
190
- entries(): IterableIterator<[string, any]>;
191
- /**
192
- * Get an iterator over the values in this map.
193
- * @returns The iterator
194
- */
195
- values(): IterableIterator<any>;
196
- /**
197
- * Get an iterator over the entries in this map.
198
- * @returns The iterator
199
- */
200
- [Symbol.iterator](): IterableIterator<[string, any]>;
201
- /**
202
- * The number of key/value pairs stored in the map.
203
- */
204
- get size(): number;
205
- /**
206
- * Executes the given callback on each entry in the map.
207
- * @param callbackFn - Callback function
208
- */
209
- forEach(callbackFn: (value: any, key: string, map: Map<string, any>) => void): void;
210
- /**
211
- * {@inheritDoc ISharedMap.get}
212
- */
213
- get<T = any>(key: string): T | undefined;
214
- /**
215
- * Check if a key exists in the map.
216
- * @param key - The key to check
217
- * @returns True if the key exists, false otherwise
218
- */
219
- has(key: string): boolean;
220
- /**
221
- * {@inheritDoc ISharedMap.set}
222
- */
223
- set(key: string, value: unknown): this;
224
- /**
225
- * Delete a key from the map.
226
- * @param key - Key to delete
227
- * @returns True if the key existed and was deleted, false if it did not exist
228
- */
229
- delete(key: string): boolean;
230
- /**
231
- * Clear all data from the map.
232
- */
233
- clear(): void;
234
- /**
235
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.summarizeCore}
236
- */
237
- protected summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
238
- /**
239
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
240
- */
241
- protected loadCore(storage: IChannelStorageService): Promise<void>;
242
- /**
243
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.onDisconnect}
244
- */
245
- protected onDisconnect(): void;
246
- /**
247
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.reSubmitCore}
248
- */
249
- protected reSubmitCore(content: unknown, localOpMetadata: unknown): void;
250
- /**
251
- * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
252
- */
253
- protected applyStashedOp(content: unknown): unknown;
254
- /**
255
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processCore}
256
- */
257
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
258
- /**
259
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.rollback}
260
- */
261
- protected rollback(content: unknown, localOpMetadata: unknown): void;
262
- }
181
+ create(runtime: IFluidDataStoreRuntime, id?: string): ISharedMap;
182
+ };
183
+
184
+ /**
185
+ * {@inheritDoc ISharedMap}
186
+ * @public
187
+ * @deprecated Use ISharedMap instead.
188
+ * @privateRemarks
189
+ * This alias is for legacy compat from when the SharedMap class was exported as public.
190
+ */
191
+ export declare type SharedMap = ISharedMap;
192
+
193
+ /* Excluded from this release type: SharedObject */
263
194
 
264
195
  export { }