@fluidframework/sequence 0.59.3003 → 0.59.4000

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 (80) hide show
  1. package/dist/{mapKernel.d.ts → defaultMap.d.ts} +21 -145
  2. package/dist/defaultMap.d.ts.map +1 -0
  3. package/dist/defaultMap.js +317 -0
  4. package/dist/defaultMap.js.map +1 -0
  5. package/dist/{mapKernelInterfaces.d.ts → defaultMapInterfaces.d.ts} +9 -51
  6. package/dist/defaultMapInterfaces.d.ts.map +1 -0
  7. package/dist/{mapKernelInterfaces.js → defaultMapInterfaces.js} +1 -1
  8. package/dist/defaultMapInterfaces.js.map +1 -0
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/intervalCollection.d.ts +12 -3
  13. package/dist/intervalCollection.d.ts.map +1 -1
  14. package/dist/intervalCollection.js +44 -39
  15. package/dist/intervalCollection.js.map +1 -1
  16. package/dist/localValues.d.ts +7 -86
  17. package/dist/localValues.d.ts.map +1 -1
  18. package/dist/localValues.js +1 -131
  19. package/dist/localValues.js.map +1 -1
  20. package/dist/packageVersion.d.ts +1 -1
  21. package/dist/packageVersion.js +1 -1
  22. package/dist/packageVersion.js.map +1 -1
  23. package/dist/sequence.d.ts +5 -1
  24. package/dist/sequence.d.ts.map +1 -1
  25. package/dist/sequence.js +23 -23
  26. package/dist/sequence.js.map +1 -1
  27. package/dist/sharedIntervalCollection.d.ts +13 -5
  28. package/dist/sharedIntervalCollection.d.ts.map +1 -1
  29. package/dist/sharedIntervalCollection.js +16 -12
  30. package/dist/sharedIntervalCollection.js.map +1 -1
  31. package/lib/{mapKernel.d.ts → defaultMap.d.ts} +21 -145
  32. package/lib/defaultMap.d.ts.map +1 -0
  33. package/lib/defaultMap.js +313 -0
  34. package/lib/defaultMap.js.map +1 -0
  35. package/lib/{mapKernelInterfaces.d.ts → defaultMapInterfaces.d.ts} +9 -51
  36. package/lib/defaultMapInterfaces.d.ts.map +1 -0
  37. package/lib/{mapKernelInterfaces.js → defaultMapInterfaces.js} +1 -1
  38. package/lib/defaultMapInterfaces.js.map +1 -0
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js.map +1 -1
  42. package/lib/intervalCollection.d.ts +12 -3
  43. package/lib/intervalCollection.d.ts.map +1 -1
  44. package/lib/intervalCollection.js +44 -39
  45. package/lib/intervalCollection.js.map +1 -1
  46. package/lib/localValues.d.ts +7 -86
  47. package/lib/localValues.d.ts.map +1 -1
  48. package/lib/localValues.js +1 -129
  49. package/lib/localValues.js.map +1 -1
  50. package/lib/packageVersion.d.ts +1 -1
  51. package/lib/packageVersion.js +1 -1
  52. package/lib/packageVersion.js.map +1 -1
  53. package/lib/sequence.d.ts +5 -1
  54. package/lib/sequence.d.ts.map +1 -1
  55. package/lib/sequence.js +23 -23
  56. package/lib/sequence.js.map +1 -1
  57. package/lib/sharedIntervalCollection.d.ts +13 -5
  58. package/lib/sharedIntervalCollection.d.ts.map +1 -1
  59. package/lib/sharedIntervalCollection.js +16 -12
  60. package/lib/sharedIntervalCollection.js.map +1 -1
  61. package/package.json +23 -18
  62. package/src/defaultMap.ts +453 -0
  63. package/src/{mapKernelInterfaces.ts → defaultMapInterfaces.ts} +14 -59
  64. package/src/index.ts +1 -1
  65. package/src/intervalCollection.ts +58 -43
  66. package/src/localValues.ts +6 -154
  67. package/src/packageVersion.ts +1 -1
  68. package/src/sequence.ts +32 -33
  69. package/src/sharedIntervalCollection.ts +22 -25
  70. package/dist/mapKernel.d.ts.map +0 -1
  71. package/dist/mapKernel.js +0 -599
  72. package/dist/mapKernel.js.map +0 -1
  73. package/dist/mapKernelInterfaces.d.ts.map +0 -1
  74. package/dist/mapKernelInterfaces.js.map +0 -1
  75. package/lib/mapKernel.d.ts.map +0 -1
  76. package/lib/mapKernel.js +0 -595
  77. package/lib/mapKernel.js.map +0 -1
  78. package/lib/mapKernelInterfaces.d.ts.map +0 -1
  79. package/lib/mapKernelInterfaces.js.map +0 -1
  80. package/src/mapKernel.ts +0 -850
@@ -9,6 +9,7 @@ import { IFluidSerializer, SharedObject } from "@fluidframework/shared-object-ba
9
9
  import { Interval, IntervalCollection, ISerializableInterval } from "./intervalCollection";
10
10
  /**
11
11
  * The factory that defines the SharedIntervalCollection
12
+ * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.
12
13
  */
13
14
  export declare class SharedIntervalCollectionFactory implements IChannelFactory {
14
15
  static readonly Type = "https://graph.microsoft.com/types/sharedIntervalCollection";
@@ -25,7 +26,10 @@ export interface ISharedIntervalCollection<TInterval extends ISerializableInterv
25
26
  waitIntervalCollection(label: string): Promise<IntervalCollection<TInterval>>;
26
27
  getIntervalCollection(label: string): IntervalCollection<TInterval>;
27
28
  }
28
- export declare class SharedIntervalCollection<TInterval extends ISerializableInterval = Interval> extends SharedObject implements ISharedIntervalCollection<TInterval> {
29
+ /**
30
+ * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.
31
+ */
32
+ export declare class SharedIntervalCollection extends SharedObject implements ISharedIntervalCollection<Interval> {
29
33
  /**
30
34
  * Create a SharedIntervalCollection
31
35
  *
@@ -33,7 +37,7 @@ export declare class SharedIntervalCollection<TInterval extends ISerializableInt
33
37
  * @param id - optional name of the shared map
34
38
  * @returns newly create shared map (but not attached yet)
35
39
  */
36
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedIntervalCollection<Interval>;
40
+ static create(runtime: IFluidDataStoreRuntime, id?: string): SharedIntervalCollection;
37
41
  /**
38
42
  * Get a factory for SharedIntervalCollection to register with the data store.
39
43
  *
@@ -41,14 +45,18 @@ export declare class SharedIntervalCollection<TInterval extends ISerializableInt
41
45
  */
42
46
  static getFactory(): IChannelFactory;
43
47
  readonly [Symbol.toStringTag]: string;
44
- private readonly intervalMapKernel;
48
+ private readonly intervalCollections;
45
49
  /**
46
50
  * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will
47
51
  * be provided
48
52
  */
49
53
  constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
50
- waitIntervalCollection(label: string): Promise<IntervalCollection<TInterval>>;
51
- getIntervalCollection(label: string): IntervalCollection<TInterval>;
54
+ /**
55
+ * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates
56
+ * are supported. Use `getIntervalCollection` instead.
57
+ */
58
+ waitIntervalCollection(label: string): Promise<IntervalCollection<Interval>>;
59
+ getIntervalCollection(label: string): IntervalCollection<Interval>;
52
60
  protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
53
61
  protected reSubmitCore(content: any, localOpMetadata: unknown): void;
54
62
  protected onDisconnect(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedIntervalCollection.d.ts","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAEH,gBAAgB,EAChB,YAAY,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,QAAQ,EACR,kBAAkB,EAElB,qBAAqB,EACxB,MAAM,sBAAsB,CAAC;AAM9B;;GAEG;AACH,qBAAa,+BAAgC,YAAW,eAAe;IACnE,gBAAuB,IAAI,gEAAgE;IAE3F,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF,IAAW,IAAI,WAEd;IAED,IAAW,UAAU,uBAEpB;IAED;;OAEG;IACU,IAAI,CACb,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAAG,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CAAC,CAAC;CACvE;AAED;;GAEG;AACH,qBAAa,wBACT,SAAQ,YAAa,YAAW,yBAAyB,CAAC,QAAQ,CAAC;IACnE;;;;;;OAMG;WACW,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM;IAIjE;;;;OAIG;WACW,UAAU,IAAI,eAAe;IAI3C,SAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAA8B;IAC1E,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA2C;IAE/E;;;OAGG;gBAEC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB;IAWlC;;;OAGG;IACU,sBAAsB,CAC/B,KAAK,EAAE,MAAM,GACd,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAIjC,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,CAAC,QAAQ,CAAC;IAMzE,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;IAI5E,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO;IAI7D,SAAS,CAAC,YAAY;IAEtB;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAMxD,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;IAMlG;;;OAGG;IACH,SAAS,CAAC,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI1D,SAAS,CAAC,cAAc;CAG3B"}
@@ -10,11 +10,12 @@ const common_utils_1 = require("@fluidframework/common-utils");
10
10
  const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
11
11
  const shared_object_base_1 = require("@fluidframework/shared-object-base");
12
12
  const intervalCollection_1 = require("./intervalCollection");
13
- const mapKernel_1 = require("./mapKernel");
13
+ const defaultMap_1 = require("./defaultMap");
14
14
  const packageVersion_1 = require("./packageVersion");
15
15
  const snapshotFileName = "header";
16
16
  /**
17
17
  * The factory that defines the SharedIntervalCollection
18
+ * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.
18
19
  */
19
20
  class SharedIntervalCollectionFactory {
20
21
  get type() {
@@ -44,6 +45,9 @@ SharedIntervalCollectionFactory.Attributes = {
44
45
  snapshotFormatVersion: "0.1",
45
46
  packageVersion: packageVersion_1.pkgVersion,
46
47
  };
48
+ /**
49
+ * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.
50
+ */
47
51
  class SharedIntervalCollection extends shared_object_base_1.SharedObject {
48
52
  /**
49
53
  * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will
@@ -52,7 +56,7 @@ class SharedIntervalCollection extends shared_object_base_1.SharedObject {
52
56
  constructor(id, runtime, attributes) {
53
57
  super(id, runtime, attributes);
54
58
  this[_a] = "SharedIntervalCollection";
55
- this.intervalMapKernel = new mapKernel_1.MapKernel(this.serializer, this.handle, (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata), () => this.isAttached(), [new intervalCollection_1.IntervalCollectionValueType()]);
59
+ this.intervalCollections = new defaultMap_1.DefaultMap(this.serializer, this.handle, (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata), new intervalCollection_1.IntervalCollectionValueType());
56
60
  }
57
61
  /**
58
62
  * Create a SharedIntervalCollection
@@ -72,23 +76,23 @@ class SharedIntervalCollection extends shared_object_base_1.SharedObject {
72
76
  static getFactory() {
73
77
  return new SharedIntervalCollectionFactory();
74
78
  }
79
+ /**
80
+ * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates
81
+ * are supported. Use `getIntervalCollection` instead.
82
+ */
75
83
  async waitIntervalCollection(label) {
76
- return this.intervalMapKernel.wait(this.getIntervalCollectionPath(label));
84
+ return this.intervalCollections.get(this.getIntervalCollectionPath(label));
77
85
  }
78
- // TODO: fix race condition on creation by putting type on every operation
79
86
  getIntervalCollection(label) {
80
87
  const realLabel = this.getIntervalCollectionPath(label);
81
- if (!this.intervalMapKernel.has(realLabel)) {
82
- this.intervalMapKernel.createValueType(label, intervalCollection_1.IntervalCollectionValueType.Name, undefined);
83
- }
84
- const sharedCollection = this.intervalMapKernel.get(realLabel);
88
+ const sharedCollection = this.intervalCollections.get(realLabel);
85
89
  return sharedCollection;
86
90
  }
87
91
  summarizeCore(serializer) {
88
- return (0, shared_object_base_1.createSingleBlobSummary)(snapshotFileName, this.intervalMapKernel.serialize(serializer));
92
+ return (0, shared_object_base_1.createSingleBlobSummary)(snapshotFileName, this.intervalCollections.serialize(serializer));
89
93
  }
90
94
  reSubmitCore(content, localOpMetadata) {
91
- this.intervalMapKernel.trySubmitMessage(content, localOpMetadata);
95
+ this.intervalCollections.trySubmitMessage(content, localOpMetadata);
92
96
  }
93
97
  onDisconnect() { }
94
98
  /**
@@ -97,11 +101,11 @@ class SharedIntervalCollection extends shared_object_base_1.SharedObject {
97
101
  async loadCore(storage) {
98
102
  const blob = await storage.readBlob(snapshotFileName);
99
103
  const header = (0, common_utils_1.bufferToString)(blob, "utf8");
100
- this.intervalMapKernel.populate(header);
104
+ this.intervalCollections.populate(header);
101
105
  }
102
106
  processCore(message, local, localOpMetadata) {
103
107
  if (message.type === protocol_definitions_1.MessageType.Operation) {
104
- this.intervalMapKernel.tryProcessMessage(message.contents, local, message, localOpMetadata);
108
+ this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);
105
109
  }
106
110
  }
107
111
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sharedIntervalCollection.js","sourceRoot":"","sources":["../src/sharedIntervalCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;AAEH,+DAA8D;AAQ9D,+EAA8F;AAE9F,2EAI4C;AAC5C,6DAK8B;AAC9B,2CAAwC;AACxC,qDAA8C;AAE9C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;GAEG;AACH,MAAa,+BAA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G,MAAM,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,IAAA,6BAAc,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAES,WAAW,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,EAAE;YACxC,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;SAC/F;IACL,CAAC;IAED;;;OAGG;IACO,yBAAyB,CAAC,KAAa;QAC7C,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AAtGD,4DAsGC;KAhFoB,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n createSingleBlobSummary,\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport {\n Interval,\n IntervalCollection,\n IntervalCollectionValueType,\n ISerializableInterval,\n} from \"./intervalCollection\";\nimport { MapKernel } from \"./mapKernel\";\nimport { pkgVersion } from \"./packageVersion\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * The factory that defines the SharedIntervalCollection\n */\nexport class SharedIntervalCollectionFactory implements IChannelFactory {\n public static readonly Type = \"https://graph.microsoft.com/types/sharedIntervalCollection\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedIntervalCollectionFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public get type() {\n return SharedIntervalCollectionFactory.Type;\n }\n\n public get attributes() {\n return SharedIntervalCollectionFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedIntervalCollection> {\n const map = new SharedIntervalCollection(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n public create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection {\n const map = new SharedIntervalCollection(\n id,\n runtime,\n this.attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\nexport interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {\n waitIntervalCollection(label: string): Promise<IntervalCollection<TInterval>>;\n getIntervalCollection(label: string): IntervalCollection<TInterval>;\n}\n\nexport class SharedIntervalCollection<TInterval extends ISerializableInterval = Interval>\n extends SharedObject implements ISharedIntervalCollection<TInterval> {\n /**\n * Create a SharedIntervalCollection\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedIntervalCollectionFactory.Type) as SharedIntervalCollection;\n }\n\n /**\n * Get a factory for SharedIntervalCollection to register with the data store.\n *\n * @returns a factory that creates and load SharedIntervalCollection\n */\n public static getFactory(): IChannelFactory {\n return new SharedIntervalCollectionFactory();\n }\n\n public readonly [Symbol.toStringTag]: string = \"SharedIntervalCollection\";\n private readonly intervalMapKernel: MapKernel;\n\n /**\n * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will\n * be provided\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes);\n this.intervalMapKernel = new MapKernel(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n () => this.isAttached(),\n [new IntervalCollectionValueType()],\n );\n }\n\n public async waitIntervalCollection(\n label: string,\n ): Promise<IntervalCollection<TInterval>> {\n return this.intervalMapKernel.wait<IntervalCollection<TInterval>>(\n this.getIntervalCollectionPath(label));\n }\n\n // TODO: fix race condition on creation by putting type on every operation\n public getIntervalCollection(label: string): IntervalCollection<TInterval> {\n const realLabel = this.getIntervalCollectionPath(label);\n if (!this.intervalMapKernel.has(realLabel)) {\n this.intervalMapKernel.createValueType(\n label,\n IntervalCollectionValueType.Name,\n undefined);\n }\n\n const sharedCollection =\n this.intervalMapKernel.get<IntervalCollection<TInterval>>(realLabel);\n return sharedCollection;\n }\n\n protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n return createSingleBlobSummary(snapshotFileName, this.intervalMapKernel.serialize(serializer));\n }\n\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.intervalMapKernel.trySubmitMessage(content, localOpMetadata);\n }\n\n protected onDisconnect() { }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalMapKernel.populate(header);\n }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (message.type === MessageType.Operation) {\n this.intervalMapKernel.tryProcessMessage(message.contents, local, message, localOpMetadata);\n }\n }\n\n /**\n * Creates the full path of the intervalCollection label\n * @param label - the incoming label\n */\n protected getIntervalCollectionPath(label: string): string {\n return label;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
1
+ {"version":3,"file":"sharedIntervalCollection.js","sourceRoot":"","sources":["../src/shared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,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,IAAA,6BAAc,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAES,WAAW,CAAC,OAAkC,EAAE,KAAc,EAAE,eAAwB;QAC9F,IAAI,OAAO,CAAC,IAAI,KAAK,kCAAW,CAAC,SAAS,EAAE;YACxC,IAAI,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;SACjG;IACL,CAAC;IAED;;;OAGG;IACO,yBAAyB,CAAC,KAAa;QAC7C,OAAO,KAAK,CAAC;IACjB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AA/FD,4DA+FC;KAzEoB,MAAM,CAAC,WAAW","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluidframework/common-utils\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n IChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n createSingleBlobSummary,\n IFluidSerializer,\n SharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport {\n Interval,\n IntervalCollection,\n IntervalCollectionValueType,\n ISerializableInterval,\n} from \"./intervalCollection\";\nimport { IMapMessageLocalMetadata, DefaultMap } from \"./defaultMap\";\nimport { pkgVersion } from \"./packageVersion\";\n\nconst snapshotFileName = \"header\";\n\n/**\n * The factory that defines the SharedIntervalCollection\n * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollectionFactory implements IChannelFactory {\n public static readonly Type = \"https://graph.microsoft.com/types/sharedIntervalCollection\";\n\n public static readonly Attributes: IChannelAttributes = {\n type: SharedIntervalCollectionFactory.Type,\n snapshotFormatVersion: \"0.1\",\n packageVersion: pkgVersion,\n };\n\n public get type() {\n return SharedIntervalCollectionFactory.Type;\n }\n\n public get attributes() {\n return SharedIntervalCollectionFactory.Attributes;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n */\n public async load(\n runtime: IFluidDataStoreRuntime,\n id: string,\n services: IChannelServices,\n attributes: IChannelAttributes): Promise<SharedIntervalCollection> {\n const map = new SharedIntervalCollection(id, runtime, attributes);\n await map.load(services);\n\n return map;\n }\n\n public create(runtime: IFluidDataStoreRuntime, id: string): SharedIntervalCollection {\n const map = new SharedIntervalCollection(\n id,\n runtime,\n this.attributes);\n map.initializeLocal();\n\n return map;\n }\n}\n\nexport interface ISharedIntervalCollection<TInterval extends ISerializableInterval> {\n waitIntervalCollection(label: string): Promise<IntervalCollection<TInterval>>;\n getIntervalCollection(label: string): IntervalCollection<TInterval>;\n}\n\n/**\n * @deprecated - SharedIntervalCollection is not maintained and is planned to be removed.\n */\nexport class SharedIntervalCollection\n extends SharedObject implements ISharedIntervalCollection<Interval> {\n /**\n * Create a SharedIntervalCollection\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, SharedIntervalCollectionFactory.Type) as SharedIntervalCollection;\n }\n\n /**\n * Get a factory for SharedIntervalCollection to register with the data store.\n *\n * @returns a factory that creates and load SharedIntervalCollection\n */\n public static getFactory(): IChannelFactory {\n return new SharedIntervalCollectionFactory();\n }\n\n public readonly [Symbol.toStringTag]: string = \"SharedIntervalCollection\";\n private readonly intervalCollections: DefaultMap<IntervalCollection<Interval>>;\n\n /**\n * Constructs a new shared SharedIntervalCollection. If the object is non-local an id and service interfaces will\n * be provided\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes,\n ) {\n super(id, runtime, attributes);\n this.intervalCollections = new DefaultMap(\n this.serializer,\n this.handle,\n (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata),\n new IntervalCollectionValueType(),\n );\n }\n\n /**\n * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates\n * are supported. Use `getIntervalCollection` instead.\n */\n public async waitIntervalCollection(\n label: string,\n ): Promise<IntervalCollection<Interval>> {\n return this.intervalCollections.get(this.getIntervalCollectionPath(label));\n }\n\n public getIntervalCollection(label: string): IntervalCollection<Interval> {\n const realLabel = this.getIntervalCollectionPath(label);\n const sharedCollection = this.intervalCollections.get(realLabel);\n return sharedCollection;\n }\n\n protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n return createSingleBlobSummary(snapshotFileName, this.intervalCollections.serialize(serializer));\n }\n\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.intervalCollections.trySubmitMessage(content, localOpMetadata as IMapMessageLocalMetadata);\n }\n\n protected onDisconnect() { }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService) {\n const blob = await storage.readBlob(snapshotFileName);\n const header = bufferToString(blob, \"utf8\");\n this.intervalCollections.populate(header);\n }\n\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (message.type === MessageType.Operation) {\n this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);\n }\n }\n\n /**\n * Creates the full path of the intervalCollection label\n * @param label - the incoming label\n */\n protected getIntervalCollectionPath(label: string): string {\n return label;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
@@ -6,10 +6,8 @@ import { IFluidHandle } from "@fluidframework/core-interfaces";
6
6
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
7
  import { IFluidSerializer } from "@fluidframework/shared-object-base";
8
8
  import { TypedEventEmitter } from "@fluidframework/common-utils";
9
- import { ISerializableValue, ISerializedValue, IValueType, IValueTypeCreator, IValueTypeOperationValue, ISharedMapEvents } from "./mapKernelInterfaces";
10
- interface IMapMessageLocalMetadata {
11
- pendingClearMessageId?: number;
12
- pendingMessageId?: number;
9
+ import { ISerializableValue, ISerializedValue, IValueType, IValueTypeOperationValue, ISharedDefaultMapEvents } from "./defaultMapInterfaces";
10
+ export interface IMapMessageLocalMetadata {
13
11
  lastProcessedSeq: number;
14
12
  }
15
13
  /**
@@ -30,53 +28,10 @@ export interface IMapValueTypeOperation {
30
28
  */
31
29
  value: IValueTypeOperationValue;
32
30
  }
33
- /**
34
- * Operation indicating a value should be set for a key.
35
- */
36
- export interface IMapSetOperation {
37
- /**
38
- * String identifier of the operation type.
39
- */
40
- type: "set";
41
- /**
42
- * Map key being modified.
43
- */
44
- key: string;
45
- /**
46
- * Value to be set on the key.
47
- */
48
- value: ISerializableValue;
49
- }
50
- /**
51
- * Operation indicating a key should be deleted from the map.
52
- */
53
- export interface IMapDeleteOperation {
54
- /**
55
- * String identifier of the operation type.
56
- */
57
- type: "delete";
58
- /**
59
- * Map key being modified.
60
- */
61
- key: string;
62
- }
63
- /**
64
- * Map key operations are one of several types.
65
- */
66
- export declare type IMapKeyOperation = IMapValueTypeOperation | IMapSetOperation | IMapDeleteOperation;
67
- /**
68
- * Operation indicating the map should be cleared.
69
- */
70
- export interface IMapClearOperation {
71
- /**
72
- * String identifier of the operation type.
73
- */
74
- type: "clear";
75
- }
76
31
  /**
77
32
  * Description of a map delta operation
78
33
  */
79
- export declare type IMapOperation = IMapKeyOperation | IMapClearOperation;
34
+ export declare type IMapOperation = IMapValueTypeOperation;
80
35
  /**
81
36
  * Defines the in-memory object structure to be used for the conversion to/from serialized.
82
37
  * Directly used in JSON.stringify, direct result from JSON.parse
@@ -88,14 +43,18 @@ export interface IMapDataObjectSerialized {
88
43
  [key: string]: ISerializedValue;
89
44
  }
90
45
  /**
91
- * A SharedMap is a map-like distributed data structure.
46
+ * A DefaultMap is a map-like distributed data structure, supporting operations on values stored by
47
+ * string key locations.
48
+ *
49
+ * Creation of values is implicit on access (either via `get` or a remote op application referring to
50
+ * a collection that wasn't previously known)
92
51
  */
93
- export declare class MapKernel implements IValueTypeCreator {
52
+ export declare class DefaultMap<T> {
94
53
  private readonly serializer;
95
54
  private readonly handle;
96
55
  private readonly submitMessage;
97
- private readonly isAttached;
98
- readonly eventEmitter: TypedEventEmitter<ISharedMapEvents>;
56
+ private readonly type;
57
+ readonly eventEmitter: TypedEventEmitter<ISharedDefaultMapEvents>;
99
58
  /**
100
59
  * The number of key/value pairs stored in the map.
101
60
  */
@@ -108,34 +67,16 @@ export declare class MapKernel implements IValueTypeCreator {
108
67
  * The in-memory data the map is storing.
109
68
  */
110
69
  private readonly data;
111
- /**
112
- * Keys that have been modified locally but not yet ack'd from the server.
113
- */
114
- private readonly pendingKeys;
115
- /**
116
- * This is used to assign a unique id to every outgoing operation and helps in tracking unacked ops.
117
- */
118
- private pendingMessageId;
119
- /**
120
- * If a clear has been performed locally but not yet ack'd from the server, then this stores the pending id
121
- * of that clear operation. Otherwise, is -1.
122
- */
123
- private pendingClearMessageId;
124
- /**
125
- * Object to create encapsulations of the values stored in the map.
126
- */
127
- private readonly localValueMaker;
128
70
  private lastProcessedSeq;
129
71
  /**
130
- * Create a new shared map kernel.
72
+ * Create a new default map.
131
73
  * @param serializer - The serializer to serialize / parse handles
132
74
  * @param handle - The handle of the shared object using the kernel
133
75
  * @param submitMessage - A callback to submit a message through the shared object
134
- * @param isAttached - To query whether the shared object should generate ops
135
- * @param valueTypes - The value types to register
76
+ * @param type - The value type to create at values of this map
136
77
  * @param eventEmitter - The object that will emit map events
137
78
  */
138
- constructor(serializer: IFluidSerializer, handle: IFluidHandle, submitMessage: (op: any, localOpMetadata: IMapMessageLocalMetadata) => void, isAttached: () => boolean, valueTypes: Readonly<IValueType<any>[]>, eventEmitter?: TypedEventEmitter<ISharedMapEvents>);
79
+ constructor(serializer: IFluidSerializer, handle: IFluidHandle, submitMessage: (op: any, localOpMetadata: IMapMessageLocalMetadata) => void, type: IValueType<T>, eventEmitter?: TypedEventEmitter<ISharedDefaultMapEvents>);
139
80
  /**
140
81
  * Get an iterator over the keys in this map.
141
82
  * @returns The iterator
@@ -164,35 +105,13 @@ export declare class MapKernel implements IValueTypeCreator {
164
105
  /**
165
106
  * {@inheritDoc ISharedMap.get}
166
107
  */
167
- get<T = any>(key: string): T | undefined;
168
- /**
169
- * {@inheritDoc ISharedMap.wait}
170
- */
171
- wait<T = any>(key: string): Promise<T>;
108
+ get(key: string): T;
172
109
  /**
173
110
  * Check if a key exists in the map.
174
111
  * @param key - The key to check
175
112
  * @returns True if the key exists, false otherwise
176
113
  */
177
114
  has(key: string): boolean;
178
- /**
179
- * {@inheritDoc ISharedMap.set}
180
- */
181
- set(key: string, value: any): void;
182
- /**
183
- * {@inheritDoc IValueTypeCreator.createValueType}
184
- */
185
- createValueType(key: string, type: string, params: any): this;
186
- /**
187
- * Delete a key from the map.
188
- * @param key - Key to delete
189
- * @returns True if the key existed and was deleted, false if it did not exist
190
- */
191
- delete(key: string): boolean;
192
- /**
193
- * Clear all data from the map.
194
- */
195
- clear(): void;
196
115
  /**
197
116
  * Serializes the data stored in the shared map to a JSON string
198
117
  * @param serializer - The serializer to use to serialize handles in its values.
@@ -215,7 +134,7 @@ export declare class MapKernel implements IValueTypeCreator {
215
134
  * also sent if we are asked to resubmit the message.
216
135
  * @returns True if the operation was submitted, false otherwise.
217
136
  */
218
- trySubmitMessage(op: any, localOpMetadata: unknown): boolean;
137
+ trySubmitMessage(op: any, localOpMetadata: IMapMessageLocalMetadata): boolean;
219
138
  tryGetStashedOpLocalMetadata(op: any): unknown;
220
139
  /**
221
140
  * Process the given op if a handler is registered.
@@ -227,31 +146,12 @@ export declare class MapKernel implements IValueTypeCreator {
227
146
  */
228
147
  tryProcessMessage(op: IMapOperation, local: boolean, message: ISequencedDocumentMessage | undefined, localOpMetadata: unknown): boolean;
229
148
  /**
230
- * Set implementation used for both locally sourced sets as well as incoming remote sets.
231
- * @param key - The key being set
232
- * @param value - The value being set
233
- * @param local - Whether the message originated from the local client
234
- * @param op - The message if from a remote set, or null if from a local set
235
- */
236
- private setCore;
237
- /**
238
- * Clear implementation used for both locally sourced clears as well as incoming remote clears.
239
- * @param local - Whether the message originated from the local client
240
- * @param op - The message if from a remote clear, or null if from a local clear
241
- */
242
- private clearCore;
243
- /**
244
- * Delete implementation used for both locally sourced deletes as well as incoming remote deletes.
245
- * @param key - The key being deleted
149
+ * Initializes a default ValueType at the provided key.
150
+ * Should be used when a map operation incurs creation.
151
+ * @param key - The key being initialized
246
152
  * @param local - Whether the message originated from the local client
247
- * @param op - The message if from a remote delete, or null if from a local delete
248
- * @returns True if the key existed and was deleted, false if it did not exist
249
- */
250
- private deleteCore;
251
- /**
252
- * Clear all keys in memory in response to a remote clear, but retain keys we have modified but not yet been ack'd.
253
153
  */
254
- private clearExceptPendingKeys;
154
+ private createCore;
255
155
  /**
256
156
  * The remote ISerializableValue we're receiving (either as a result of a load or an incoming set op) will
257
157
  * have the information we need to create a real object, but will not be the real object yet. For example,
@@ -263,34 +163,11 @@ export declare class MapKernel implements IValueTypeCreator {
263
163
  * @returns The local value that was produced
264
164
  */
265
165
  private makeLocal;
266
- /**
267
- * If our local operations that have not yet been ack'd will eventually overwrite an incoming operation, we should
268
- * not process the incoming operation.
269
- * @param op - Operation to check
270
- * @param local - Whether the message originated from the local client
271
- * @param message - The message
272
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
273
- * For messages from a remote client, this will be undefined.
274
- * @returns True if the operation should be processed, false otherwise
275
- */
276
- private needProcessKeyOperation;
277
166
  /**
278
167
  * Get the message handlers for the map.
279
168
  * @returns A map of string op names to IMapMessageHandlers for those ops
280
169
  */
281
170
  private getMessageHandlers;
282
- private getMapClearMessageLocalMetadata;
283
- /**
284
- * Submit a clear message to remote clients.
285
- * @param op - The clear message
286
- */
287
- private submitMapClearMessage;
288
- private getMapKeyMessageLocalMetadata;
289
- /**
290
- * Submit a map key message to remote clients.
291
- * @param op - The map key message
292
- */
293
- private submitMapKeyMessage;
294
171
  /**
295
172
  * Create an emitter for a value type to emit ops from the given key.
296
173
  * @alpha
@@ -299,5 +176,4 @@ export declare class MapKernel implements IValueTypeCreator {
299
176
  */
300
177
  private makeMapValueOpEmitter;
301
178
  }
302
- export {};
303
- //# sourceMappingURL=mapKernel.d.ts.map
179
+ //# sourceMappingURL=defaultMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultMap.d.ts","sourceRoot":"","sources":["../src/defaultMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACH,gBAAgB,EAInB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAU,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAKzE,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAGhB,UAAU,EACV,wBAAwB,EACxB,uBAAuB,EAC1B,MAAM,wBAAwB,CAAC;AA8BhC,MAAM,WAAW,wBAAwB;IACrC,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACnC;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,KAAK,EAAE,wBAAwB,CAAC;CACnC;AAED;;GAEG;AACH,oBAAY,aAAa,GAAG,sBAAsB,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAC;CACrC;AAED,MAAM,WAA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