@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
@@ -4,11 +4,11 @@
4
4
  */
5
5
  import { IFluidHandle } from "@fluidframework/core-interfaces";
6
6
  import { IFluidSerializer } from "@fluidframework/shared-object-base";
7
- import { ISerializableValue, ISerializedValue, IValueOpEmitter, IValueOperation, IValueType } from "./mapKernelInterfaces";
7
+ import { ISerializableValue, ISerializedValue, IValueOperation, IValueType } from "./defaultMapInterfaces";
8
8
  /**
9
9
  * A local value to be stored in a container type DDS.
10
10
  */
11
- export interface ILocalValue {
11
+ export interface ILocalValue<T = any> {
12
12
  /**
13
13
  * Type indicator of the value stored within.
14
14
  */
@@ -16,7 +16,7 @@ export interface ILocalValue {
16
16
  /**
17
17
  * The in-memory value stored within.
18
18
  */
19
- readonly value: any;
19
+ readonly value: T;
20
20
  /**
21
21
  * Retrieve the serialized form of the value stored within.
22
22
  * @param serializer - Data store runtime's serializer
@@ -26,42 +26,20 @@ export interface ILocalValue {
26
26
  makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;
27
27
  }
28
28
  export declare function makeSerializable(localValue: ILocalValue, serializer: IFluidSerializer, bind: IFluidHandle): ISerializableValue;
29
- /**
30
- * Manages a contained plain value. May also contain shared object handles.
31
- */
32
- export declare class PlainLocalValue implements ILocalValue {
33
- readonly value: any;
34
- /**
35
- * Create a new PlainLocalValue.
36
- * @param value - The value to store, which may contain shared object handles
37
- */
38
- constructor(value: any);
39
- /**
40
- * {@inheritDoc ILocalValue."type"}
41
- */
42
- get type(): string;
43
- /**
44
- * {@inheritDoc ILocalValue.makeSerialized}
45
- */
46
- makeSerialized(serializer: IFluidSerializer, bind: IFluidHandle): ISerializedValue;
47
- }
48
29
  /**
49
30
  * Manages a contained value type.
50
31
  *
51
- * @privateRemarks
52
- * TODO: Should maybe be a generic
53
- *
54
32
  * @alpha
55
33
  */
56
- export declare class ValueTypeLocalValue implements ILocalValue {
57
- readonly value: any;
34
+ export declare class ValueTypeLocalValue<T> implements ILocalValue<T> {
35
+ readonly value: T;
58
36
  private readonly valueType;
59
37
  /**
60
38
  * Create a new ValueTypeLocalValue.
61
39
  * @param value - The instance of the value type stored within
62
40
  * @param valueType - The type object of the value type stored within
63
41
  */
64
- constructor(value: any, valueType: IValueType<any>);
42
+ constructor(value: T, valueType: IValueType<T>);
65
43
  /**
66
44
  * {@inheritDoc ILocalValue."type"}
67
45
  */
@@ -75,63 +53,6 @@ export declare class ValueTypeLocalValue implements ILocalValue {
75
53
  * @param opName - The name of the operation that needs processing
76
54
  * @returns The object which can process the given op
77
55
  */
78
- getOpHandler(opName: string): IValueOperation<any>;
79
- }
80
- /**
81
- * A LocalValueMaker enables a container type DDS to produce and store local values with minimal awareness of how
82
- * those objects are stored, serialized, and deserialized.
83
- */
84
- export declare class LocalValueMaker {
85
- private readonly serializer;
86
- /**
87
- * The value types this maker is able to produce.
88
- */
89
- private readonly valueTypes;
90
- /**
91
- * Create a new LocalValueMaker.
92
- * @param serializer - The serializer to serialize / parse handles.
93
- */
94
- constructor(serializer: IFluidSerializer);
95
- /**
96
- * Register a value type this maker will be able to produce.
97
- * @param type - The value type to register
98
- * @alpha
99
- */
100
- registerValueType<T>(type: IValueType<T>): void;
101
- /**
102
- * Create a new local value from an incoming serialized value.
103
- * @param serializable - The serializable value to make local
104
- */
105
- fromSerializable(serializable: ISerializableValue): ILocalValue;
106
- /**
107
- * Create a new local value from an incoming serialized value for value type
108
- * @param serializable - The serializable value to make local
109
- * @param emitter - The value op emitter, if the serializable is a value type
110
- */
111
- fromSerializableValueType(serializable: ISerializableValue, emitter: IValueOpEmitter): ILocalValue;
112
- /**
113
- * Create a new local value containing a given plain object.
114
- * @param value - The value to store
115
- * @returns An ILocalValue containing the value
116
- */
117
- fromInMemory(value: any): ILocalValue;
118
- /**
119
- * Create a new local value containing a value type.
120
- * @param type - The type of the value type to create
121
- * @param emitter - The IValueOpEmitter object that the new value type will use to emit ops
122
- * @param params - The initialization arguments for the value type
123
- * @returns An ILocalValue containing the new value type
124
- * @alpha
125
- */
126
- makeValueType(type: string, emitter: IValueOpEmitter, params: any): ILocalValue;
127
- /**
128
- * Create a new value type.
129
- * @param params - The initialization arguments for the value type
130
- * @param type - The type of value type to create
131
- * @param emitter - The IValueOpEmitter object that the new value type will use to emit ops
132
- * @returns The new value type
133
- * @alpha
134
- */
135
- private loadValueType;
56
+ getOpHandler(opName: string): IValueOperation<T>;
136
57
  }
137
58
  //# sourceMappingURL=localValues.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"localValues.d.ts","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACH,gBAAgB,EAKnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,UAAU,EACb,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;IAEpB;;;;;OAKG;IACH,cAAc,CACV,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GACnB,gBAAgB,CAAC;CACvB;AAED,wBAAgB,gBAAgB,CAC5B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GAAG,kBAAkB,CAM1C;AAED;;GAEG;AACH,qBAAa,eAAgB,YAAW,WAAW;aAKnB,KAAK,EAAE,GAAG;IAJtC;;;OAGG;gBACyB,KAAK,EAAE,GAAG;IAGtC;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACI,cAAc,CACjB,UAAU,EAAE,gBAAgB,EAC5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AM,iCAAiC,CAAC;AAC/D,OAAO,EACH,gBAAgB,EAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACb,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IAChC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAElB;;;;;OAKG;IACH,cAAc,CACV,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GACnB,gBAAgB,CAAC;CACvB;AAED,wBAAgB,gBAAgB,CAC5B,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GAAG,kBAAkB,CAM1C;AAED;;;;GAIG;AACH,qBAAa,mBAAmB,CAAC,CAAC,CAAE,YAAW,WAAW,CAAC,CAAC,CAAC;aAM7B,KAAK,EAAE,CAAC;IAAE,OAAO,CAAC,QAAQ,CAAC,SAAS;IALhE;;;;OAIG;gBACyB,KAAK,EAAE,CAAC,EAAmB,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAG/E;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACI,cAAc,CACjB,UAAU,EAAE,gBAAgB,EAC5B,IAAI,EAAE,YAAY,GACnB,gBAAgB;IAUnB;;;;OAIG;IACI,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC;CAQ1D"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { parseHandles, serializeHandles, ValueType, } from "@fluidframework/shared-object-base";
5
+ import { serializeHandles, } from "@fluidframework/shared-object-base";
6
6
  export function makeSerializable(localValue, serializer, bind) {
7
7
  const value = localValue.makeSerialized(serializer, bind);
8
8
  return {
@@ -10,42 +10,9 @@ export function makeSerializable(localValue, serializer, bind) {
10
10
  value: value.value && JSON.parse(value.value),
11
11
  };
12
12
  }
13
- /**
14
- * Manages a contained plain value. May also contain shared object handles.
15
- */
16
- export class PlainLocalValue {
17
- /**
18
- * Create a new PlainLocalValue.
19
- * @param value - The value to store, which may contain shared object handles
20
- */
21
- constructor(value) {
22
- this.value = value;
23
- }
24
- /**
25
- * {@inheritDoc ILocalValue."type"}
26
- */
27
- get type() {
28
- return ValueType[ValueType.Plain];
29
- }
30
- /**
31
- * {@inheritDoc ILocalValue.makeSerialized}
32
- */
33
- makeSerialized(serializer, bind) {
34
- // Stringify to convert to the serialized handle values - and then parse in order to create
35
- // a POJO for the op
36
- const value = serializeHandles(this.value, serializer, bind);
37
- return {
38
- type: this.type,
39
- value,
40
- };
41
- }
42
- }
43
13
  /**
44
14
  * Manages a contained value type.
45
15
  *
46
- * @privateRemarks
47
- * TODO: Should maybe be a generic
48
- *
49
16
  * @alpha
50
17
  */
51
18
  export class ValueTypeLocalValue {
@@ -88,99 +55,4 @@ export class ValueTypeLocalValue {
88
55
  return handler;
89
56
  }
90
57
  }
91
- /**
92
- * A LocalValueMaker enables a container type DDS to produce and store local values with minimal awareness of how
93
- * those objects are stored, serialized, and deserialized.
94
- */
95
- export class LocalValueMaker {
96
- /**
97
- * Create a new LocalValueMaker.
98
- * @param serializer - The serializer to serialize / parse handles.
99
- */
100
- constructor(serializer) {
101
- this.serializer = serializer;
102
- /**
103
- * The value types this maker is able to produce.
104
- */
105
- this.valueTypes = new Map();
106
- }
107
- /**
108
- * Register a value type this maker will be able to produce.
109
- * @param type - The value type to register
110
- * @alpha
111
- */
112
- registerValueType(type) {
113
- this.valueTypes.set(type.name, type);
114
- }
115
- /**
116
- * Create a new local value from an incoming serialized value.
117
- * @param serializable - The serializable value to make local
118
- */
119
- fromSerializable(serializable) {
120
- // Migrate from old shared value to handles
121
- if (serializable.type === ValueType[ValueType.Shared]) {
122
- serializable.type = ValueType[ValueType.Plain];
123
- const handle = {
124
- type: "__fluid_handle__",
125
- url: serializable.value,
126
- };
127
- serializable.value = handle;
128
- }
129
- const translatedValue = parseHandles(serializable.value, this.serializer);
130
- return new PlainLocalValue(translatedValue);
131
- }
132
- /**
133
- * Create a new local value from an incoming serialized value for value type
134
- * @param serializable - The serializable value to make local
135
- * @param emitter - The value op emitter, if the serializable is a value type
136
- */
137
- fromSerializableValueType(serializable, emitter) {
138
- if (this.valueTypes.has(serializable.type)) {
139
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
140
- const valueType = this.valueTypes.get(serializable.type);
141
- serializable.value = parseHandles(serializable.value, this.serializer);
142
- const localValue = valueType.factory.load(emitter, serializable.value);
143
- return new ValueTypeLocalValue(localValue, valueType);
144
- }
145
- else {
146
- throw new Error(`Unknown value type "${serializable.type}"`);
147
- }
148
- }
149
- /**
150
- * Create a new local value containing a given plain object.
151
- * @param value - The value to store
152
- * @returns An ILocalValue containing the value
153
- */
154
- fromInMemory(value) {
155
- return new PlainLocalValue(value);
156
- }
157
- /**
158
- * Create a new local value containing a value type.
159
- * @param type - The type of the value type to create
160
- * @param emitter - The IValueOpEmitter object that the new value type will use to emit ops
161
- * @param params - The initialization arguments for the value type
162
- * @returns An ILocalValue containing the new value type
163
- * @alpha
164
- */
165
- makeValueType(type, emitter, params) {
166
- const valueType = this.loadValueType(params, type, emitter);
167
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
168
- return new ValueTypeLocalValue(valueType, this.valueTypes.get(type));
169
- }
170
- /**
171
- * Create a new value type.
172
- * @param params - The initialization arguments for the value type
173
- * @param type - The type of value type to create
174
- * @param emitter - The IValueOpEmitter object that the new value type will use to emit ops
175
- * @returns The new value type
176
- * @alpha
177
- */
178
- loadValueType(params, type, emitter) {
179
- const valueType = this.valueTypes.get(type);
180
- if (!valueType) {
181
- throw new Error(`Unknown type '${type}' specified`);
182
- }
183
- return valueType.factory.load(emitter, params);
184
- }
185
- }
186
58
  //# sourceMappingURL=localValues.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"localValues.js","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAGH,YAAY,EACZ,gBAAgB,EAChB,SAAS,GACZ,MAAM,oCAAoC,CAAC;AAmC5C,MAAM,UAAU,gBAAgB,CAC5B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAClB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO;QACH,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;KAChD,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,eAAe;IACxB;;;OAGG;IACH,YAA4B,KAAU;QAAV,UAAK,GAAL,KAAK,CAAK;IACtC,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,cAAc,CACjB,UAA4B,EAC5B,IAAkB;QAElB,2FAA2F;QAC3F,oBAAoB;QACpB,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAE7D,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK;SACR,CAAC;IACN,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAmB;IAC5B;;;;OAIG;IACH,YAA4B,KAAU,EAAmB,SAA0B;QAAvD,UAAK,GAAL,KAAK,CAAK;QAAmB,cAAS,GAAT,SAAS,CAAiB;IACnF,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,IAA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AwB;QACrE,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,aAAa,CAAC,CAAC;SACvD;QACD,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACJ","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 IFluidSerializer,\n ISerializedHandle,\n parseHandles,\n serializeHandles,\n ValueType,\n} from \"@fluidframework/shared-object-base\";\nimport {\n ISerializableValue,\n ISerializedValue,\n IValueOpEmitter,\n IValueOperation,\n IValueType,\n} from \"./mapKernelInterfaces\";\n\n/**\n * A local value to be stored in a container type DDS.\n */\nexport interface ILocalValue {\n /**\n * Type indicator of the value stored within.\n */\n readonly type: string;\n\n /**\n * The in-memory value stored within.\n */\n readonly value: any;\n\n /**\n * Retrieve the serialized form of the value stored within.\n * @param serializer - Data store runtime's serializer\n * @param bind - Container type's handle\n * @returns The serialized form of the contained value\n */\n makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue;\n}\n\nexport function makeSerializable(\n localValue: ILocalValue,\n serializer: IFluidSerializer,\n bind: IFluidHandle): ISerializableValue {\n const value = localValue.makeSerialized(serializer, bind);\n return {\n type: value.type,\n value: value.value && JSON.parse(value.value),\n };\n}\n\n/**\n * Manages a contained plain value. May also contain shared object handles.\n */\nexport class PlainLocalValue implements ILocalValue {\n /**\n * Create a new PlainLocalValue.\n * @param value - The value to store, which may contain shared object handles\n */\n constructor(public readonly value: any) {\n }\n\n /**\n * {@inheritDoc ILocalValue.\"type\"}\n */\n public get type(): string {\n return ValueType[ValueType.Plain];\n }\n\n /**\n * {@inheritDoc ILocalValue.makeSerialized}\n */\n public makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue {\n // Stringify to convert to the serialized handle values - and then parse in order to create\n // a POJO for the op\n const value = serializeHandles(this.value, serializer, bind);\n\n return {\n type: this.type,\n value,\n };\n }\n}\n\n/**\n * Manages a contained value type.\n *\n * @privateRemarks\n * TODO: Should maybe be a generic\n *\n * @alpha\n */\nexport class ValueTypeLocalValue implements ILocalValue {\n /**\n * Create a new ValueTypeLocalValue.\n * @param value - The instance of the value type stored within\n * @param valueType - The type object of the value type stored within\n */\n constructor(public readonly value: any, private readonly valueType: IValueType<any>) {\n }\n\n /**\n * {@inheritDoc ILocalValue.\"type\"}\n */\n public get type(): string {\n return this.valueType.name;\n }\n\n /**\n * {@inheritDoc ILocalValue.makeSerialized}\n */\n public makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue {\n const storedValueType = this.valueType.factory.store(this.value);\n const value = serializeHandles(storedValueType, serializer, bind);\n\n return {\n type: this.type,\n value,\n };\n }\n\n /**\n * Get the handler for a given op of this value type.\n * @param opName - The name of the operation that needs processing\n * @returns The object which can process the given op\n */\n public getOpHandler(opName: string): IValueOperation<any> {\n const handler = this.valueType.ops.get(opName);\n if (!handler) {\n throw new Error(\"Unknown type message\");\n }\n\n return handler;\n }\n}\n\n/**\n * A LocalValueMaker enables a container type DDS to produce and store local values with minimal awareness of how\n * those objects are stored, serialized, and deserialized.\n */\nexport class LocalValueMaker {\n /**\n * The value types this maker is able to produce.\n */\n private readonly valueTypes = new Map<string, IValueType<any>>();\n\n /**\n * Create a new LocalValueMaker.\n * @param serializer - The serializer to serialize / parse handles.\n */\n constructor(private readonly serializer: IFluidSerializer) {\n }\n\n /**\n * Register a value type this maker will be able to produce.\n * @param type - The value type to register\n * @alpha\n */\n public registerValueType<T>(type: IValueType<T>) {\n this.valueTypes.set(type.name, type);\n }\n\n /**\n * Create a new local value from an incoming serialized value.\n * @param serializable - The serializable value to make local\n */\n public fromSerializable(serializable: ISerializableValue): ILocalValue {\n // Migrate from old shared value to handles\n if (serializable.type === ValueType[ValueType.Shared]) {\n serializable.type = ValueType[ValueType.Plain];\n const handle: ISerializedHandle = {\n type: \"__fluid_handle__\",\n url: serializable.value as string,\n };\n serializable.value = handle;\n }\n\n const translatedValue = parseHandles(serializable.value, this.serializer);\n\n return new PlainLocalValue(translatedValue);\n }\n\n /**\n * Create a new local value from an incoming serialized value for value type\n * @param serializable - The serializable value to make local\n * @param emitter - The value op emitter, if the serializable is a value type\n */\n public fromSerializableValueType(serializable: ISerializableValue, emitter: IValueOpEmitter): ILocalValue {\n if (this.valueTypes.has(serializable.type)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const valueType = this.valueTypes.get(serializable.type)!;\n\n serializable.value = parseHandles(serializable.value, this.serializer);\n\n const localValue = valueType.factory.load(emitter, serializable.value);\n return new ValueTypeLocalValue(localValue, valueType);\n } else {\n throw new Error(`Unknown value type \"${serializable.type}\"`);\n }\n }\n\n /**\n * Create a new local value containing a given plain object.\n * @param value - The value to store\n * @returns An ILocalValue containing the value\n */\n public fromInMemory(value: any): ILocalValue {\n return new PlainLocalValue(value);\n }\n\n /**\n * Create a new local value containing a value type.\n * @param type - The type of the value type to create\n * @param emitter - The IValueOpEmitter object that the new value type will use to emit ops\n * @param params - The initialization arguments for the value type\n * @returns An ILocalValue containing the new value type\n * @alpha\n */\n public makeValueType(type: string, emitter: IValueOpEmitter, params: any): ILocalValue {\n const valueType = this.loadValueType(params, type, emitter);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return new ValueTypeLocalValue(valueType, this.valueTypes.get(type)!);\n }\n\n /**\n * Create a new value type.\n * @param params - The initialization arguments for the value type\n * @param type - The type of value type to create\n * @param emitter - The IValueOpEmitter object that the new value type will use to emit ops\n * @returns The new value type\n * @alpha\n */\n private loadValueType(params: any, type: string, emitter: IValueOpEmitter): any {\n const valueType = this.valueTypes.get(type);\n if (!valueType) {\n throw new Error(`Unknown type '${type}' specified`);\n }\n return valueType.factory.load(emitter, params);\n }\n}\n"]}
1
+ {"version":3,"file":"localValues.js","sourceRoot":"","sources":["../src/localValues.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEH,gBAAgB,GACnB,MAAM,oCAAoC,CAAC;AAkC5C,MAAM,UAAU,gBAAgB,CAC5B,UAAuB,EACvB,UAA4B,EAC5B,IAAkB;IAClB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC1D,OAAO;QACH,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;KAChD,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IAC5B;;;;OAIG;IACH,YAA4B,KAAQ,EAAmB,SAAwB;QAAnD,UAAK,GAAL,KAAK,CAAG;QAAmB,cAAS,GAAT,SAAS,CAAe;IAC/E,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,cAAc,CACjB,UAA4B,EAC5B,IAAkB;QAElB,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjE,MAAM,KAAK,GAAG,gBAAgB,CAAC,eAAe,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;QAElE,OAAO;YACH,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK;SACR,CAAC;IACN,CAAC;IAED;;;;OAIG;IACI,YAAY,CAAC,MAAc;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SAC3C;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ","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 IFluidSerializer,\n serializeHandles,\n} from \"@fluidframework/shared-object-base\";\nimport {\n ISerializableValue,\n ISerializedValue,\n IValueOperation,\n IValueType,\n} from \"./defaultMapInterfaces\";\n\n/**\n * A local value to be stored in a container type DDS.\n */\nexport interface ILocalValue<T = any> {\n /**\n * Type indicator of the value stored within.\n */\n readonly type: string;\n\n /**\n * The in-memory value stored within.\n */\n readonly value: T;\n\n /**\n * Retrieve the serialized form of the value stored within.\n * @param serializer - Data store runtime's serializer\n * @param bind - Container type's handle\n * @returns The serialized form of the contained value\n */\n makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue;\n}\n\nexport function makeSerializable(\n localValue: ILocalValue,\n serializer: IFluidSerializer,\n bind: IFluidHandle): ISerializableValue {\n const value = localValue.makeSerialized(serializer, bind);\n return {\n type: value.type,\n value: value.value && JSON.parse(value.value),\n };\n}\n\n/**\n * Manages a contained value type.\n *\n * @alpha\n */\nexport class ValueTypeLocalValue<T> implements ILocalValue<T> {\n /**\n * Create a new ValueTypeLocalValue.\n * @param value - The instance of the value type stored within\n * @param valueType - The type object of the value type stored within\n */\n constructor(public readonly value: T, private readonly valueType: IValueType<T>) {\n }\n\n /**\n * {@inheritDoc ILocalValue.\"type\"}\n */\n public get type(): string {\n return this.valueType.name;\n }\n\n /**\n * {@inheritDoc ILocalValue.makeSerialized}\n */\n public makeSerialized(\n serializer: IFluidSerializer,\n bind: IFluidHandle,\n ): ISerializedValue {\n const storedValueType = this.valueType.factory.store(this.value);\n const value = serializeHandles(storedValueType, serializer, bind);\n\n return {\n type: this.type,\n value,\n };\n }\n\n /**\n * Get the handler for a given op of this value type.\n * @param opName - The name of the operation that needs processing\n * @returns The object which can process the given op\n */\n public getOpHandler(opName: string): IValueOperation<T> {\n const handler = this.valueType.ops.get(opName);\n if (!handler) {\n throw new Error(\"Unknown type message\");\n }\n\n return handler;\n }\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/sequence";
8
- export declare const pkgVersion = "0.59.3003";
8
+ export declare const pkgVersion = "0.59.4000";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/sequence";
8
- export const pkgVersion = "0.59.3003";
8
+ export const pkgVersion = "0.59.4000";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"0.59.3003\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/sequence\";\nexport const pkgVersion = \"0.59.4000\";\n"]}
package/lib/sequence.d.ts CHANGED
@@ -58,7 +58,7 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
58
58
  private deferIncomingOps;
59
59
  private readonly loadedDeferredIncomingOps;
60
60
  private messagesSinceMSNChange;
61
- private readonly intervalMapKernel;
61
+ private readonly intervalCollections;
62
62
  constructor(dataStoreRuntime: IFluidDataStoreRuntime, id: string, attributes: IChannelAttributes, segmentFromSpec: (spec: IJSONSegment) => ISegment);
63
63
  /**
64
64
  * @param start - The inclusive start of the range to remove
@@ -153,6 +153,10 @@ export declare abstract class SharedSegmentSequence<T extends ISegment> extends
153
153
  getStackContext(startPos: number, rangeLabels: string[]): RangeStackMap;
154
154
  getCurrentSeq(): number;
155
155
  insertAtReferencePosition(pos: ReferencePosition, segment: T): void;
156
+ /**
157
+ * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates
158
+ * are supported. Use `getIntervalCollection` instead.
159
+ */
156
160
  waitIntervalCollection(label: string): Promise<IntervalCollection<SequenceInterval>>;
157
161
  getIntervalCollection(label: string): IntervalCollection<SequenceInterval>;
158
162
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAA0B,MAAM,8BAA8B,CAAC;AAEhF,OAAO,EACH,yBAAyB,EAE5B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,MAAM,EAKN,YAAY,EACZ,YAAY,EAGZ,kBAAkB,EAClB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,cAAc,EAGd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,OAAO;IAS7D;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAwDxD,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;IAsBlG,SAAS,CAAC,SAAS;IAQnB,SAAS,CAAC,mBAAmB;IAK7B;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;IAI/C,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,mBAAmB;IAuC3B,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,+BAA+B;IAYvC,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,6BAA6B;CAiBxC"}
package/lib/sequence.js CHANGED
@@ -9,7 +9,7 @@ import { Client, createAnnotateRangeOp, createGroupOp, createInsertOp, createRem
9
9
  import { ObjectStoragePartition, SummaryTreeBuilder } from "@fluidframework/runtime-utils";
10
10
  import { makeHandlesSerializable, parseHandles, SharedObject, } from "@fluidframework/shared-object-base";
11
11
  import { SequenceIntervalCollectionValueType, } from "./intervalCollection";
12
- import { MapKernel } from "./mapKernel";
12
+ import { DefaultMap } from "./defaultMap";
13
13
  import { SequenceDeltaEvent, SequenceMaintenanceEvent } from "./sequenceDeltaEvent";
14
14
  const snapshotFileName = "header";
15
15
  const contentPath = "content";
@@ -66,7 +66,7 @@ export class SharedSegmentSequence extends SharedObject {
66
66
  break;
67
67
  }
68
68
  });
69
- this.intervalMapKernel = new MapKernel(this.serializer, this.handle, (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata), () => this.isAttached(), [new SequenceIntervalCollectionValueType()]);
69
+ this.intervalCollections = new DefaultMap(this.serializer, this.handle, (op, localOpMetadata) => this.submitLocalMessage(op, localOpMetadata), new SequenceIntervalCollectionValueType());
70
70
  }
71
71
  get loaded() {
72
72
  return this.loadedDeferred.promise;
@@ -268,16 +268,16 @@ export class SharedSegmentSequence extends SharedObject {
268
268
  this.submitSequenceMessage(insertOp);
269
269
  }
270
270
  }
271
+ /**
272
+ * @deprecated - IntervalCollections are created on a first-write wins basis, and concurrent creates
273
+ * are supported. Use `getIntervalCollection` instead.
274
+ */
271
275
  async waitIntervalCollection(label) {
272
- return this.intervalMapKernel.wait(this.getIntervalCollectionPath(label));
276
+ return this.intervalCollections.get(this.getIntervalCollectionPath(label));
273
277
  }
274
- // TODO: fix race condition on creation by putting type on every operation
275
278
  getIntervalCollection(label) {
276
279
  const labelPath = this.getIntervalCollectionPath(label);
277
- if (!this.intervalMapKernel.has(labelPath)) {
278
- this.intervalMapKernel.createValueType(labelPath, SequenceIntervalCollectionValueType.Name, undefined);
279
- }
280
- const sharedCollection = this.intervalMapKernel.get(labelPath);
280
+ const sharedCollection = this.intervalCollections.get(labelPath);
281
281
  return sharedCollection;
282
282
  }
283
283
  /**
@@ -289,14 +289,14 @@ export class SharedSegmentSequence extends SharedObject {
289
289
  * ...
290
290
  */
291
291
  getIntervalCollectionLabels() {
292
- return this.intervalMapKernel.keys();
292
+ return this.intervalCollections.keys();
293
293
  }
294
294
  summarizeCore(serializer) {
295
295
  const builder = new SummaryTreeBuilder();
296
296
  // conditionally write the interval collection blob
297
297
  // only if it has entries
298
- if (this.intervalMapKernel.size > 0) {
299
- builder.addBlob(snapshotFileName, this.intervalMapKernel.serialize(serializer));
298
+ if (this.intervalCollections.size > 0) {
299
+ builder.addBlob(snapshotFileName, this.intervalCollections.serialize(serializer));
300
300
  }
301
301
  builder.addWithStats(contentPath, this.summarizeMergeTree(serializer));
302
302
  return builder.getSummaryTree();
@@ -306,8 +306,8 @@ export class SharedSegmentSequence extends SharedObject {
306
306
  * All the IFluidHandle's represent routes to other objects.
307
307
  */
308
308
  processGCDataCore(serializer) {
309
- if (this.intervalMapKernel.size > 0) {
310
- this.intervalMapKernel.serialize(serializer);
309
+ if (this.intervalCollections.size > 0) {
310
+ this.intervalCollections.serialize(serializer);
311
311
  }
312
312
  this.client.serializeGCData(this.handle, serializer);
313
313
  }
@@ -341,7 +341,7 @@ export class SharedSegmentSequence extends SharedObject {
341
341
  }
342
342
  onDisconnect() { }
343
343
  reSubmitCore(content, localOpMetadata) {
344
- if (!this.intervalMapKernel.trySubmitMessage(content, localOpMetadata)) {
344
+ if (!this.intervalCollections.trySubmitMessage(content, localOpMetadata)) {
345
345
  this.submitSequenceMessage(this.client.regeneratePendingOp(content, localOpMetadata));
346
346
  }
347
347
  }
@@ -353,7 +353,7 @@ export class SharedSegmentSequence extends SharedObject {
353
353
  if (await storage.contains(snapshotFileName)) {
354
354
  const blob = await storage.readBlob(snapshotFileName);
355
355
  const header = bufferToString(blob, "utf8");
356
- this.intervalMapKernel.populate(header);
356
+ this.intervalCollections.populate(header);
357
357
  }
358
358
  try {
359
359
  // this will load the header, and return a promise
@@ -408,7 +408,7 @@ export class SharedSegmentSequence extends SharedObject {
408
408
  }
409
409
  else {
410
410
  assert(message.type === MessageType.Operation, 0x073 /* "Sequence message not operation" */);
411
- const handled = this.intervalMapKernel.tryProcessMessage(message.contents, local, message, localOpMetadata);
411
+ const handled = this.intervalCollections.tryProcessMessage(message.contents, local, message, localOpMetadata);
412
412
  if (!handled) {
413
413
  this.processMergeTreeMsg(message, local);
414
414
  }
@@ -512,17 +512,17 @@ export class SharedSegmentSequence extends SharedObject {
512
512
  }
513
513
  initializeIntervalCollections() {
514
514
  // Listen and initialize new SharedIntervalCollections
515
- this.intervalMapKernel.eventEmitter.on("create", (ev, local) => {
516
- const intervalCollection = this.intervalMapKernel.get(ev.key);
515
+ this.intervalCollections.eventEmitter.on("create", ({ key, previousValue }, local) => {
516
+ const intervalCollection = this.intervalCollections.get(key);
517
517
  if (!intervalCollection.attached) {
518
- intervalCollection.attachGraph(this.client, ev.key);
518
+ intervalCollection.attachGraph(this.client, key);
519
519
  }
520
- assert(ev.previousValue === undefined, 0x2c1 /* "Creating an interval that already exists?" */);
521
- this.emit("createIntervalCollection", ev.key, local, this);
520
+ assert(previousValue === undefined, 0x2c1 /* "Creating an interval collection that already exists?" */);
521
+ this.emit("createIntervalCollection", key, local, this);
522
522
  });
523
523
  // Initialize existing SharedIntervalCollections
524
- for (const key of this.intervalMapKernel.keys()) {
525
- const intervalCollection = this.intervalMapKernel.get(key);
524
+ for (const key of this.intervalCollections.keys()) {
525
+ const intervalCollection = this.intervalCollections.get(key);
526
526
  intervalCollection.attachGraph(this.client, key);
527
527
  }
528
528
  }