@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.
- package/{.eslintrc.js → .eslintrc.cjs} +10 -1
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +11 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/map.api.md +14 -57
- package/dist/directory.d.ts +10 -50
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +76 -164
- package/dist/directory.js.map +1 -1
- package/dist/index.d.ts +45 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -8
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/internalInterfaces.d.ts +2 -2
- package/dist/internalInterfaces.d.ts.map +1 -1
- package/dist/internalInterfaces.js.map +1 -1
- package/dist/localValues.d.ts +3 -5
- package/dist/localValues.d.ts.map +1 -1
- package/dist/localValues.js +9 -8
- package/dist/localValues.js.map +1 -1
- package/dist/map-alpha.d.ts +31 -116
- package/dist/map-beta.d.ts +24 -105
- package/dist/map-public.d.ts +24 -105
- package/dist/map-untrimmed.d.ts +31 -116
- package/dist/map.d.ts +4 -23
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +6 -29
- package/dist/map.js.map +1 -1
- package/dist/mapKernel.d.ts +3 -4
- package/dist/mapKernel.d.ts.map +1 -1
- package/dist/mapKernel.js +30 -35
- package/dist/mapKernel.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/{directory.d.mts → directory.d.ts} +11 -51
- package/lib/directory.d.ts.map +1 -0
- package/lib/{directory.mjs → directory.js} +77 -165
- package/lib/directory.js.map +1 -0
- package/lib/index.d.ts +61 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +55 -0
- package/lib/index.js.map +1 -0
- package/lib/{interfaces.d.mts → interfaces.d.ts} +1 -1
- package/lib/interfaces.d.ts.map +1 -0
- package/lib/{interfaces.mjs → interfaces.js} +1 -1
- package/lib/interfaces.js.map +1 -0
- package/lib/{internalInterfaces.d.mts → internalInterfaces.d.ts} +3 -3
- package/lib/internalInterfaces.d.ts.map +1 -0
- package/lib/{internalInterfaces.mjs → internalInterfaces.js} +1 -1
- package/lib/internalInterfaces.js.map +1 -0
- package/lib/{localValues.d.mts → localValues.d.ts} +4 -6
- package/lib/localValues.d.ts.map +1 -0
- package/lib/{localValues.mjs → localValues.js} +10 -9
- package/lib/localValues.js.map +1 -0
- package/lib/{map-alpha.d.mts → map-alpha.d.ts} +43 -116
- package/lib/{map-beta.d.mts → map-beta.d.ts} +36 -105
- package/lib/{map-public.d.mts → map-public.d.ts} +36 -105
- package/lib/{map-untrimmed.d.mts → map-untrimmed.d.ts} +43 -116
- package/lib/{map.d.mts → map.d.ts} +5 -24
- package/lib/map.d.ts.map +1 -0
- package/lib/{map.mjs → map.js} +5 -28
- package/lib/map.js.map +1 -0
- package/lib/{mapKernel.d.mts → mapKernel.d.ts} +4 -5
- package/lib/mapKernel.d.ts.map +1 -0
- package/lib/{mapKernel.mjs → mapKernel.js} +32 -37
- package/lib/mapKernel.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/test/memory/directory.spec.js +71 -0
- package/lib/test/memory/directory.spec.js.map +1 -0
- package/lib/test/memory/map.spec.js +71 -0
- package/lib/test/memory/map.spec.js.map +1 -0
- package/lib/test/mocha/directory.order.spec.js +422 -0
- package/lib/test/mocha/directory.order.spec.js.map +1 -0
- package/lib/test/mocha/directory.snapshot.spec.js +111 -0
- package/lib/test/mocha/directory.snapshot.spec.js.map +1 -0
- package/lib/test/mocha/directory.spec.js +1406 -0
- package/lib/test/mocha/directory.spec.js.map +1 -0
- package/lib/test/mocha/directoryEquivalenceUtils.js +36 -0
- package/lib/test/mocha/directoryEquivalenceUtils.js.map +1 -0
- package/lib/test/mocha/directoryFuzzTests.spec.js +337 -0
- package/lib/test/mocha/directoryFuzzTests.spec.js.map +1 -0
- package/lib/test/mocha/dirname.cjs +16 -0
- package/lib/test/mocha/dirname.cjs.map +1 -0
- package/lib/test/mocha/map.fuzz.spec.js +114 -0
- package/lib/test/mocha/map.fuzz.spec.js.map +1 -0
- package/lib/test/mocha/map.spec.js +685 -0
- package/lib/test/mocha/map.spec.js.map +1 -0
- package/lib/test/mocha/rebasing.spec.js +158 -0
- package/lib/test/mocha/rebasing.spec.js.map +1 -0
- package/lib/test/mocha/reconnection.spec.js +327 -0
- package/lib/test/mocha/reconnection.spec.js.map +1 -0
- package/lib/test/types/validateMapPrevious.generated.js +66 -0
- package/lib/test/types/validateMapPrevious.generated.js.map +1 -0
- package/package.json +55 -52
- package/src/directory.ts +122 -217
- package/src/index.ts +57 -4
- package/src/interfaces.ts +2 -2
- package/src/internalInterfaces.ts +2 -2
- package/src/localValues.ts +14 -9
- package/src/map.ts +7 -32
- package/src/mapKernel.ts +40 -42
- package/src/packageVersion.ts +1 -1
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/lib/directory.d.mts.map +0 -1
- package/lib/directory.mjs.map +0 -1
- package/lib/index.d.mts +0 -9
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -8
- package/lib/index.mjs.map +0 -1
- package/lib/interfaces.d.mts.map +0 -1
- package/lib/interfaces.mjs.map +0 -1
- package/lib/internalInterfaces.d.mts.map +0 -1
- package/lib/internalInterfaces.mjs.map +0 -1
- package/lib/localValues.d.mts.map +0 -1
- package/lib/localValues.mjs.map +0 -1
- package/lib/map.d.mts.map +0 -1
- package/lib/map.mjs.map +0 -1
- package/lib/mapKernel.d.mts.map +0 -1
- package/lib/mapKernel.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- 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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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(
|
|
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
|
|
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):
|
|
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):
|
|
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
|
|
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
|
-
|
|
867
|
-
|
|
868
|
-
*
|
|
869
|
-
*
|
|
870
|
-
*/
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
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
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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 { }
|