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

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 (118) hide show
  1. package/.eslintrc.js +12 -11
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +162 -0
  4. package/README.md +24 -8
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/map.api.md +297 -0
  8. package/dist/{directory.js → directory.cjs} +749 -228
  9. package/dist/directory.cjs.map +1 -0
  10. package/dist/directory.d.ts +567 -34
  11. package/dist/directory.d.ts.map +1 -1
  12. package/dist/index.cjs +27 -0
  13. package/dist/index.cjs.map +1 -0
  14. package/dist/index.d.ts +5 -5
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/{interfaces.js → interfaces.cjs} +1 -1
  17. package/dist/interfaces.cjs.map +1 -0
  18. package/dist/interfaces.d.ts +167 -184
  19. package/dist/interfaces.d.ts.map +1 -1
  20. package/dist/internalInterfaces.cjs +7 -0
  21. package/dist/internalInterfaces.cjs.map +1 -0
  22. package/dist/internalInterfaces.d.ts +101 -0
  23. package/dist/internalInterfaces.d.ts.map +1 -0
  24. package/dist/{localValues.js → localValues.cjs} +15 -3
  25. package/dist/localValues.cjs.map +1 -0
  26. package/dist/localValues.d.ts +17 -6
  27. package/dist/localValues.d.ts.map +1 -1
  28. package/dist/map-alpha.d.ts +982 -0
  29. package/dist/map-beta.d.ts +275 -0
  30. package/dist/map-public.d.ts +275 -0
  31. package/dist/map-untrimmed.d.ts +996 -0
  32. package/dist/{map.js → map.cjs} +39 -34
  33. package/dist/map.cjs.map +1 -0
  34. package/dist/map.d.ts +10 -17
  35. package/dist/map.d.ts.map +1 -1
  36. package/dist/{mapKernel.js → mapKernel.cjs} +122 -79
  37. package/dist/mapKernel.cjs.map +1 -0
  38. package/dist/mapKernel.d.ts +17 -48
  39. package/dist/mapKernel.d.ts.map +1 -1
  40. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  41. package/dist/packageVersion.cjs.map +1 -0
  42. package/dist/packageVersion.d.ts +1 -1
  43. package/dist/packageVersion.d.ts.map +1 -1
  44. package/dist/tsdoc-metadata.json +11 -0
  45. package/lib/directory.d.mts +902 -0
  46. package/lib/directory.d.mts.map +1 -0
  47. package/lib/{directory.js → directory.mjs} +736 -199
  48. package/lib/directory.mjs.map +1 -0
  49. package/lib/index.d.mts +9 -0
  50. package/lib/index.d.mts.map +1 -0
  51. package/lib/index.mjs +8 -0
  52. package/lib/index.mjs.map +1 -0
  53. package/lib/{interfaces.d.ts → interfaces.d.mts} +167 -184
  54. package/lib/interfaces.d.mts.map +1 -0
  55. package/lib/{interfaces.js → interfaces.mjs} +1 -1
  56. package/lib/interfaces.mjs.map +1 -0
  57. package/lib/internalInterfaces.d.mts +101 -0
  58. package/lib/internalInterfaces.d.mts.map +1 -0
  59. package/lib/internalInterfaces.mjs +6 -0
  60. package/lib/internalInterfaces.mjs.map +1 -0
  61. package/lib/{localValues.d.ts → localValues.d.mts} +18 -7
  62. package/lib/localValues.d.mts.map +1 -0
  63. package/lib/{localValues.js → localValues.mjs} +15 -3
  64. package/lib/localValues.mjs.map +1 -0
  65. package/lib/map-alpha.d.mts +982 -0
  66. package/lib/map-beta.d.mts +275 -0
  67. package/lib/map-public.d.mts +275 -0
  68. package/lib/map-untrimmed.d.mts +996 -0
  69. package/lib/{map.d.ts → map.d.mts} +11 -18
  70. package/lib/map.d.mts.map +1 -0
  71. package/lib/{map.js → map.mjs} +40 -35
  72. package/lib/map.mjs.map +1 -0
  73. package/lib/{mapKernel.d.ts → mapKernel.d.mts} +18 -49
  74. package/lib/mapKernel.d.mts.map +1 -0
  75. package/lib/{mapKernel.js → mapKernel.mjs} +116 -73
  76. package/lib/mapKernel.mjs.map +1 -0
  77. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
  78. package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
  79. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  80. package/lib/packageVersion.mjs.map +1 -0
  81. package/map.test-files.tar +0 -0
  82. package/package.json +105 -65
  83. package/prettier.config.cjs +8 -0
  84. package/src/directory.ts +2544 -1727
  85. package/src/index.ts +31 -5
  86. package/src/interfaces.ts +346 -345
  87. package/src/internalInterfaces.ts +119 -0
  88. package/src/localValues.ts +103 -96
  89. package/src/map.ts +362 -351
  90. package/src/mapKernel.ts +755 -722
  91. package/src/packageVersion.ts +1 -1
  92. package/tsc-multi.test.json +4 -0
  93. package/tsconfig.json +10 -15
  94. package/dist/directory.js.map +0 -1
  95. package/dist/index.js +0 -34
  96. package/dist/index.js.map +0 -1
  97. package/dist/interfaces.js.map +0 -1
  98. package/dist/localValues.js.map +0 -1
  99. package/dist/map.js.map +0 -1
  100. package/dist/mapKernel.js.map +0 -1
  101. package/dist/packageVersion.js.map +0 -1
  102. package/lib/directory.d.ts +0 -369
  103. package/lib/directory.d.ts.map +0 -1
  104. package/lib/directory.js.map +0 -1
  105. package/lib/index.d.ts +0 -20
  106. package/lib/index.d.ts.map +0 -1
  107. package/lib/index.js +0 -20
  108. package/lib/index.js.map +0 -1
  109. package/lib/interfaces.d.ts.map +0 -1
  110. package/lib/interfaces.js.map +0 -1
  111. package/lib/localValues.d.ts.map +0 -1
  112. package/lib/localValues.js.map +0 -1
  113. package/lib/map.d.ts.map +0 -1
  114. package/lib/map.js.map +0 -1
  115. package/lib/mapKernel.d.ts.map +0 -1
  116. package/lib/mapKernel.js.map +0 -1
  117. package/lib/packageVersion.js.map +0 -1
  118. package/tsconfig.esnext.json +0 -7
@@ -4,9 +4,10 @@
4
4
  */
5
5
  import { IFluidHandle } from "@fluidframework/core-interfaces";
6
6
  import { IFluidSerializer } from "@fluidframework/shared-object-base";
7
- import { ISerializableValue, ISerializedValue } from "./interfaces";
7
+ import { ISerializableValue, ISerializedValue } from "./interfaces.mjs";
8
8
  /**
9
- * A local value to be stored in a container type DDS.
9
+ * A local value to be stored in a container type Distributed Data Store (DDS).
10
+ * @alpha
10
11
  */
11
12
  export interface ILocalValue {
12
13
  /**
@@ -25,17 +26,26 @@ export interface ILocalValue {
25
26
  */
26
27
  makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;
27
28
  }
29
+ /**
30
+ * Converts the provided `localValue` to its serialized form.
31
+ *
32
+ * @param localValue - The value to serialize.
33
+ * @param serializer - Data store runtime's serializer.
34
+ * @param bind - Container type's handle.
35
+ *
36
+ * @see {@link ILocalValue.makeSerialized}
37
+ */
28
38
  export declare function makeSerializable(localValue: ILocalValue, serializer: IFluidSerializer, bind: IFluidHandle): ISerializableValue;
29
39
  /**
30
40
  * Manages a contained plain value. May also contain shared object handles.
31
41
  */
32
42
  export declare class PlainLocalValue implements ILocalValue {
33
- readonly value: any;
43
+ readonly value: unknown;
34
44
  /**
35
45
  * Create a new PlainLocalValue.
36
46
  * @param value - The value to store, which may contain shared object handles
37
47
  */
38
- constructor(value: any);
48
+ constructor(value: unknown);
39
49
  /**
40
50
  * {@inheritDoc ILocalValue."type"}
41
51
  */
@@ -46,8 +56,9 @@ export declare class PlainLocalValue implements ILocalValue {
46
56
  makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;
47
57
  }
48
58
  /**
49
- * A LocalValueMaker enables a container type DDS to produce and store local values with minimal awareness of how
50
- * those objects are stored, serialized, and deserialized.
59
+ * Enables a container type {@link https://fluidframework.com/docs/build/dds/ | DDS} to produce and store local
60
+ * values with minimal awareness of how those objects are stored, serialized, and deserialized.
61
+ * @alpha
51
62
  */
52
63
  export declare class LocalValueMaker {
53
64
  private readonly serializer;
@@ -66,6 +77,6 @@ export declare class LocalValueMaker {
66
77
  * @param value - The value to store
67
78
  * @returns An ILocalValue containing the value
68
79
  */
69
- fromInMemory(value: any): ILocalValue;
80
+ fromInMemory(value: unknown): ILocalValue;
70
81
  }
71
82
  //# sourceMappingURL=localValues.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localValues.d.ts","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,YAAY,EAAE,MAAM,iCAAiC;OACvD,EACN,gBAAgB,EAKhB,MAAM,oCAAoC;OAEpC,EAAE,kBAAkB,EAAE,gBAAgB,EAAE;AAE/C;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IAGH,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;IAEpB;;;;;OAKG;IACH,cAAc,CAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB,CAAC;CACnF;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC/B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GAEhB,kBAAkB,CAOpB;AAED;;GAEG;AACH,qBAAa,eAAgB,YAAW,WAAW;aAKf,KAAK,EAAE,OAAO;IAJjD;;;OAGG;gBACgC,KAAK,EAAE,OAAO;IAEjD;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACI,cAAc,CAAC,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,GAAG,gBAAgB;CAUzF;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAKR,OAAO,CAAC,QAAQ,CAAC,UAAU;IAJ9C;;;OAGG;gBACiC,UAAU,EAAE,gBAAgB;IAEhE;;;OAGG;IAEI,gBAAgB,CAAC,YAAY,EAAE,kBAAkB,GAAG,WAAW;IAgBtE;;;;OAIG;IACI,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW;CAGhD"}
@@ -3,10 +3,20 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { parseHandles, serializeHandles, ValueType, } from "@fluidframework/shared-object-base";
6
+ /**
7
+ * Converts the provided `localValue` to its serialized form.
8
+ *
9
+ * @param localValue - The value to serialize.
10
+ * @param serializer - Data store runtime's serializer.
11
+ * @param bind - Container type's handle.
12
+ *
13
+ * @see {@link ILocalValue.makeSerialized}
14
+ */
6
15
  export function makeSerializable(localValue, serializer, bind) {
7
16
  const value = localValue.makeSerialized(serializer, bind);
8
17
  return {
9
18
  type: value.type,
19
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10
20
  value: value.value && JSON.parse(value.value),
11
21
  };
12
22
  }
@@ -41,8 +51,9 @@ export class PlainLocalValue {
41
51
  }
42
52
  }
43
53
  /**
44
- * A LocalValueMaker enables a container type DDS to produce and store local values with minimal awareness of how
45
- * those objects are stored, serialized, and deserialized.
54
+ * Enables a container type {@link https://fluidframework.com/docs/build/dds/ | DDS} to produce and store local
55
+ * values with minimal awareness of how those objects are stored, serialized, and deserialized.
56
+ * @alpha
46
57
  */
47
58
  export class LocalValueMaker {
48
59
  /**
@@ -56,6 +67,7 @@ export class LocalValueMaker {
56
67
  * Create a new local value from an incoming serialized value.
57
68
  * @param serializable - The serializable value to make local
58
69
  */
70
+ // eslint-disable-next-line import/no-deprecated
59
71
  fromSerializable(serializable) {
60
72
  // Migrate from old shared value to handles
61
73
  if (serializable.type === ValueType[ValueType.Shared]) {
@@ -78,4 +90,4 @@ export class LocalValueMaker {
78
90
  return new PlainLocalValue(value);
79
91
  }
80
92
  }
81
- //# sourceMappingURL=localValues.js.map
93
+ //# sourceMappingURL=localValues.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localValues.mjs","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAGN,YAAY,EACZ,gBAAgB,EAChB,SAAS,GACT,MAAM,oCAAoC;AA8B3C;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC/B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAGlB,MAAM,KAAK,GAAG,UAAU,CAAC,cA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AI,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","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 * @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 * @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"]}