@fluidframework/ordered-collection 2.0.0-internal.7.3.0 → 2.0.0-internal.7.4.0

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 (60) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +3 -6
  4. package/api-report/ordered-collection.api.md +11 -11
  5. package/dist/consensusOrderedCollection.cjs +1 -0
  6. package/dist/consensusOrderedCollection.cjs.map +1 -1
  7. package/dist/consensusOrderedCollection.d.ts +1 -0
  8. package/dist/consensusOrderedCollection.d.ts.map +1 -1
  9. package/dist/consensusQueue.cjs +1 -0
  10. package/dist/consensusQueue.cjs.map +1 -1
  11. package/dist/consensusQueue.d.ts +1 -0
  12. package/dist/consensusQueue.d.ts.map +1 -1
  13. package/dist/interfaces.cjs +3 -0
  14. package/dist/interfaces.cjs.map +1 -1
  15. package/dist/interfaces.d.ts +9 -0
  16. package/dist/interfaces.d.ts.map +1 -1
  17. package/dist/ordered-collection-alpha.d.ts +11 -209
  18. package/dist/ordered-collection-beta.d.ts +41 -219
  19. package/dist/ordered-collection-public.d.ts +41 -219
  20. package/dist/ordered-collection-untrimmed.d.ts +13 -0
  21. package/dist/packageVersion.cjs +1 -1
  22. package/dist/packageVersion.cjs.map +1 -1
  23. package/dist/packageVersion.d.ts +1 -1
  24. package/dist/testUtils.cjs +2 -0
  25. package/dist/testUtils.cjs.map +1 -1
  26. package/dist/testUtils.d.ts +2 -0
  27. package/dist/testUtils.d.ts.map +1 -1
  28. package/lib/consensusOrderedCollection.d.ts +2 -1
  29. package/lib/consensusOrderedCollection.d.ts.map +1 -1
  30. package/lib/consensusOrderedCollection.mjs +1 -0
  31. package/lib/consensusOrderedCollection.mjs.map +1 -1
  32. package/lib/consensusOrderedCollectionFactory.d.ts +1 -1
  33. package/lib/consensusOrderedCollectionFactory.d.ts.map +1 -1
  34. package/lib/consensusQueue.d.ts +2 -1
  35. package/lib/consensusQueue.d.ts.map +1 -1
  36. package/lib/consensusQueue.mjs +1 -0
  37. package/lib/consensusQueue.mjs.map +1 -1
  38. package/lib/index.d.ts +4 -4
  39. package/lib/index.d.ts.map +1 -1
  40. package/lib/interfaces.d.ts +9 -0
  41. package/lib/interfaces.d.ts.map +1 -1
  42. package/lib/interfaces.mjs +3 -0
  43. package/lib/interfaces.mjs.map +1 -1
  44. package/lib/ordered-collection-alpha.d.ts +11 -209
  45. package/lib/ordered-collection-beta.d.ts +41 -219
  46. package/lib/ordered-collection-public.d.ts +41 -219
  47. package/lib/ordered-collection-untrimmed.d.ts +13 -0
  48. package/lib/packageVersion.d.ts +1 -1
  49. package/lib/packageVersion.mjs +1 -1
  50. package/lib/packageVersion.mjs.map +1 -1
  51. package/lib/testUtils.d.ts +3 -1
  52. package/lib/testUtils.d.ts.map +1 -1
  53. package/lib/testUtils.mjs +2 -0
  54. package/lib/testUtils.mjs.map +1 -1
  55. package/package.json +18 -27
  56. package/src/consensusOrderedCollection.ts +1 -0
  57. package/src/consensusQueue.ts +1 -0
  58. package/src/interfaces.ts +9 -0
  59. package/src/packageVersion.ts +1 -1
  60. package/src/testUtils.ts +2 -0
@@ -10,224 +10,46 @@ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
10
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
11
  import { SharedObject } from '@fluidframework/shared-object-base';
12
12
 
13
- /**
14
- * Helper method to acquire and complete an item
15
- * Should be used in test code only
16
- */
17
- export declare function acquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T | undefined>;
18
-
19
- /**
20
- * Callback provided to acquire() and waitAndAcquire() methods.
21
- * @returns ConsensusResult indicating whether item was completed, or releases back to the queue.
22
- */
23
- export declare type ConsensusCallback<T> = (value: T) => Promise<ConsensusResult>;
24
-
25
- /**
26
- * Implementation of a consensus collection shared object
27
- *
28
- * Implements the shared object's communication, and the semantics around the
29
- * release/complete mechanism following acquire.
30
- *
31
- * Generally not used directly. A derived type will pass in a backing data type
32
- * IOrderedCollection that will define the deterministic add/acquire order and snapshot ability.
33
- */
34
- export declare class ConsensusOrderedCollection<T = any> extends SharedObject<IConsensusOrderedCollectionEvents<T>> implements IConsensusOrderedCollection<T> {
35
- private readonly data;
36
- /**
37
- * The set of values that have been acquired but not yet completed or released
38
- */
39
- private jobTracking;
40
- /**
41
- * Constructs a new consensus collection. If the object is non-local an id and service interfaces will
42
- * be provided
43
- */
44
- protected constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, data: IOrderedCollection<T>);
45
- /**
46
- * Add a value to the consensus collection.
47
- */
48
- add(value: T): Promise<void>;
49
- /**
50
- * Remove a value from the consensus collection. If the collection is empty, returns false.
51
- * Otherwise calls callback with the value
52
- */
53
- acquire(callback: ConsensusCallback<T>): Promise<boolean>;
54
- /**
55
- * Wait for a value to be available and acquire it from the consensus collection
56
- */
57
- waitAndAcquire(callback: ConsensusCallback<T>): Promise<void>;
58
- protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
59
- protected isActive(): boolean;
60
- protected complete(acquireId: string): Promise<void>;
61
- protected completeCore(acquireId: string): void;
62
- protected release(acquireId: string): void;
63
- protected releaseCore(acquireId: string): void;
64
- /**
65
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
66
- */
67
- protected loadCore(storage: IChannelStorageService): Promise<void>;
68
- protected onDisconnect(): void;
69
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
70
- private submit;
71
- private addCore;
72
- private acquireCore;
73
- private acquireInternal;
74
- private removeClient;
75
- private serializeValue;
76
- private deserializeValue;
77
- protected applyStashedOp(): void;
78
- }
79
-
80
- /**
81
- * Implementation of a consensus stack
82
- *
83
- * An derived type of ConsensusOrderedCollection with a queue as the backing data and order.
84
- */
85
- export declare class ConsensusQueue<T = any> extends ConsensusOrderedCollection<T> {
86
- /**
87
- * Create a new consensus queue
88
- *
89
- * @param runtime - data store runtime the new consensus queue belongs to
90
- * @param id - optional name of theconsensus queue
91
- * @returns newly create consensus queue (but not attached yet)
92
- */
93
- static create<T = any>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusQueue<T>;
94
- /**
95
- * Get a factory for ConsensusQueue to register with the data store.
96
- *
97
- * @returns a factory that creates and load ConsensusQueue
98
- */
99
- static getFactory(): IChannelFactory;
100
- /**
101
- * Constructs a new consensus queue. If the object is non-local an id and service interfaces will
102
- * be provided
103
- */
104
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
105
- }
106
-
107
- export declare enum ConsensusResult {
108
- Release = 0,
109
- Complete = 1
110
- }
111
-
112
- /**
113
- * Consensus Ordered Collection interface
114
- *
115
- * An consensus ordered collection is a distributed data structure, which
116
- * holds a collection of JSON-able or handles, and has a
117
- * deterministic add/remove order.
118
- *
119
- * @remarks
120
- * The order the server receive the add/remove operation determines the
121
- * order those operation are applied to the collection. Different clients
122
- * issuing `add` or `acquire` operations at the same time will be sequenced.
123
- * The order dictates which `add` is done first, thus determining the order
124
- * in which it appears in the collection. It also determines which client
125
- * will get the first removed item, etc. All operations are asynchronous.
126
- * A function `waitAndAcquire` is provided to wait for and remove an entry in the collection.
127
- *
128
- * As a client acquires an item, it processes it and then returns a value (via callback)
129
- * indicating whether it has completed processing the item, or whether the item should be
130
- * released back to the collection for another client to process.
131
- *
132
- * All objects added to the collection will be cloned (via JSON).
133
- * They will not be references to the original input object. Thus changed to
134
- * the input object will not reflect the object in the collection.
135
- */
136
- export declare interface IConsensusOrderedCollection<T = any> extends ISharedObject<IConsensusOrderedCollectionEvents<T>> {
137
- /**
138
- * Adds a value to the collection
139
- */
140
- add(value: T): Promise<void>;
141
- /**
142
- * Retrieves a value from the collection.
143
- * @returns Returns true (and calls callback with acquired value) if collection was not empty.
144
- * Otherwise returns false.
145
- */
146
- acquire(callback: ConsensusCallback<T>): Promise<boolean>;
147
- /**
148
- * Wait for a value to be available and remove it from the consensus collection
149
- * Calls callback with retrieved value.
150
- */
151
- waitAndAcquire(callback: ConsensusCallback<T>): Promise<void>;
152
- }
153
-
154
- /**
155
- * Events notifying about addition, acquisition, release and completion of items
156
- */
157
- export declare interface IConsensusOrderedCollectionEvents<T> extends ISharedObjectEvents {
158
- /**
159
- * Event fires when new item is added to the queue or
160
- * an item previously acquired is returned back to a queue (including client loosing connection)
161
- * @param newlyAdded - indicates if it's newly added item of previously acquired item
162
- */
163
- (event: "add", listener: (value: T, newlyAdded: boolean) => void): this;
164
- /**
165
- * Event fires when a client acquired an item
166
- * Fires both for locally acquired items, as well as items acquired by remote clients
167
- */
168
- (event: "acquire", listener: (value: T, clientId?: string) => void): this;
169
- /**
170
- * "Complete event fires when a client completes an item.
171
- */
172
- (event: "complete", listener: (value: T) => void): this;
173
- /**
174
- * Event fires when locally acquired item is being released back to the queue.
175
- * Please note that release process is asynchronous, so it takes a while for it to happen
176
- * ("add" event will be fired as result of it)
177
- * @param intentional - indicates whether release was intentional (result of returning
178
- * ConsensusResult.Release from callback) or it happened as result of lost connection.
179
- */
180
- (event: "localRelease", listener: (value: T, intentional: boolean) => void): this;
181
- }
182
-
183
- /**
184
- * Consensus Ordered Collection channel factory interface
185
- *
186
- * Extends the base IChannelFactory to return a more definite type of IConsensusOrderedCollection
187
- * Use for the runtime to create and load distributed data structure by type name of each channel
188
- */
189
- export declare interface IConsensusOrderedCollectionFactory extends IChannelFactory {
190
- load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusOrderedCollection>;
191
- create(document: IFluidDataStoreRuntime, id: string): IConsensusOrderedCollection;
192
- }
193
-
194
- /**
195
- * Ordered Collection interface
196
- *
197
- * Collection of objects that has deterministic add and remove ordering.
198
- * Object implementing this interface can be used as the data backing
199
- * for the ConsensusOrderedCollection
200
- */
201
- export declare interface IOrderedCollection<T = any> extends ISnapshotable<T> {
202
- /**
203
- * Adds a value to the collection
204
- */
205
- add(value: T): any;
206
- /**
207
- * Retrieves a value from the collection.
208
- */
209
- remove(): T;
210
- /**
211
- * Return the size of the collection
212
- */
213
- size(): number;
214
- }
215
-
216
- /**
217
- * Interface for object that can be snapshoted
218
- *
219
- * TODO: move this to be use in other place
220
- * TODO: currently input and output is not symmetrical, can they become symmetrical?
221
- */
222
- export declare interface ISnapshotable<T> {
223
- asArray(): T[];
224
- loadFrom(values: T[]): void;
225
- }
226
-
227
- /**
228
- * Helper method to acquire and complete an item
229
- * Should be used in test code only
230
- */
231
- export declare function waitAcquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T>;
13
+ /* Excluded from this release type: acquireAndComplete */
14
+
15
+ /* Excluded from this release type: ConsensusCallback */
16
+
17
+ /* Excluded from this release type: ConsensusOrderedCollection */
18
+
19
+ /* Excluded from this release type: ConsensusQueue */
20
+
21
+ /* Excluded from this release type: ConsensusResult */
22
+
23
+ /* Excluded from this release type: IChannelAttributes */
24
+
25
+ /* Excluded from this release type: IChannelFactory */
26
+
27
+ /* Excluded from this release type: IChannelServices */
28
+
29
+ /* Excluded from this release type: IChannelStorageService */
30
+
31
+ /* Excluded from this release type: IConsensusOrderedCollection */
32
+
33
+ /* Excluded from this release type: IConsensusOrderedCollectionEvents */
34
+
35
+ /* Excluded from this release type: IConsensusOrderedCollectionFactory */
36
+
37
+ /* Excluded from this release type: IFluidDataStoreRuntime */
38
+
39
+ /* Excluded from this release type: IFluidSerializer */
40
+
41
+ /* Excluded from this release type: IOrderedCollection */
42
+
43
+ /* Excluded from this release type: ISharedObject */
44
+
45
+ /* Excluded from this release type: ISharedObjectEvents */
46
+
47
+ /* Excluded from this release type: ISnapshotable */
48
+
49
+ /* Excluded from this release type: ISummaryTreeWithStats */
50
+
51
+ /* Excluded from this release type: SharedObject */
52
+
53
+ /* Excluded from this release type: waitAcquireAndComplete */
232
54
 
233
55
  export { }
@@ -13,12 +13,14 @@ import { SharedObject } from '@fluidframework/shared-object-base';
13
13
  /**
14
14
  * Helper method to acquire and complete an item
15
15
  * Should be used in test code only
16
+ * @internal
16
17
  */
17
18
  export declare function acquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T | undefined>;
18
19
 
19
20
  /**
20
21
  * Callback provided to acquire() and waitAndAcquire() methods.
21
22
  * @returns ConsensusResult indicating whether item was completed, or releases back to the queue.
23
+ * @internal
22
24
  */
23
25
  export declare type ConsensusCallback<T> = (value: T) => Promise<ConsensusResult>;
24
26
 
@@ -30,6 +32,7 @@ export declare type ConsensusCallback<T> = (value: T) => Promise<ConsensusResult
30
32
  *
31
33
  * Generally not used directly. A derived type will pass in a backing data type
32
34
  * IOrderedCollection that will define the deterministic add/acquire order and snapshot ability.
35
+ * @internal
33
36
  */
34
37
  export declare class ConsensusOrderedCollection<T = any> extends SharedObject<IConsensusOrderedCollectionEvents<T>> implements IConsensusOrderedCollection<T> {
35
38
  private readonly data;
@@ -81,6 +84,7 @@ export declare class ConsensusOrderedCollection<T = any> extends SharedObject<IC
81
84
  * Implementation of a consensus stack
82
85
  *
83
86
  * An derived type of ConsensusOrderedCollection with a queue as the backing data and order.
87
+ * @internal
84
88
  */
85
89
  export declare class ConsensusQueue<T = any> extends ConsensusOrderedCollection<T> {
86
90
  /**
@@ -104,6 +108,9 @@ export declare class ConsensusQueue<T = any> extends ConsensusOrderedCollection<
104
108
  constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
105
109
  }
106
110
 
111
+ /**
112
+ * @internal
113
+ */
107
114
  export declare enum ConsensusResult {
108
115
  Release = 0,
109
116
  Complete = 1
@@ -132,6 +139,7 @@ export declare enum ConsensusResult {
132
139
  * All objects added to the collection will be cloned (via JSON).
133
140
  * They will not be references to the original input object. Thus changed to
134
141
  * the input object will not reflect the object in the collection.
142
+ * @internal
135
143
  */
136
144
  export declare interface IConsensusOrderedCollection<T = any> extends ISharedObject<IConsensusOrderedCollectionEvents<T>> {
137
145
  /**
@@ -153,6 +161,7 @@ export declare interface IConsensusOrderedCollection<T = any> extends ISharedObj
153
161
 
154
162
  /**
155
163
  * Events notifying about addition, acquisition, release and completion of items
164
+ * @internal
156
165
  */
157
166
  export declare interface IConsensusOrderedCollectionEvents<T> extends ISharedObjectEvents {
158
167
  /**
@@ -185,6 +194,7 @@ export declare interface IConsensusOrderedCollectionEvents<T> extends ISharedObj
185
194
  *
186
195
  * Extends the base IChannelFactory to return a more definite type of IConsensusOrderedCollection
187
196
  * Use for the runtime to create and load distributed data structure by type name of each channel
197
+ * @internal
188
198
  */
189
199
  export declare interface IConsensusOrderedCollectionFactory extends IChannelFactory {
190
200
  load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusOrderedCollection>;
@@ -197,6 +207,7 @@ export declare interface IConsensusOrderedCollectionFactory extends IChannelFact
197
207
  * Collection of objects that has deterministic add and remove ordering.
198
208
  * Object implementing this interface can be used as the data backing
199
209
  * for the ConsensusOrderedCollection
210
+ * @internal
200
211
  */
201
212
  export declare interface IOrderedCollection<T = any> extends ISnapshotable<T> {
202
213
  /**
@@ -218,6 +229,7 @@ export declare interface IOrderedCollection<T = any> extends ISnapshotable<T> {
218
229
  *
219
230
  * TODO: move this to be use in other place
220
231
  * TODO: currently input and output is not symmetrical, can they become symmetrical?
232
+ * @internal
221
233
  */
222
234
  export declare interface ISnapshotable<T> {
223
235
  asArray(): T[];
@@ -227,6 +239,7 @@ export declare interface ISnapshotable<T> {
227
239
  /**
228
240
  * Helper method to acquire and complete an item
229
241
  * Should be used in test code only
242
+ * @internal
230
243
  */
231
244
  export declare function waitAcquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T>;
232
245
 
@@ -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/ordered-collection";
8
- export declare const pkgVersion = "2.0.0-internal.7.3.0";
8
+ export declare const pkgVersion = "2.0.0-internal.7.4.0";
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/ordered-collection";
8
- export const pkgVersion = "2.0.0-internal.7.3.0";
8
+ export const pkgVersion = "2.0.0-internal.7.4.0";
9
9
  //# sourceMappingURL=packageVersion.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,oCAAoC,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,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/ordered-collection\";\nexport const pkgVersion = \"2.0.0-internal.7.3.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,oCAAoC,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,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/ordered-collection\";\nexport const pkgVersion = \"2.0.0-internal.7.4.0\";\n"]}
@@ -2,15 +2,17 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IConsensusOrderedCollection } from "./interfaces";
5
+ import { IConsensusOrderedCollection } from "./interfaces.mjs";
6
6
  /**
7
7
  * Helper method to acquire and complete an item
8
8
  * Should be used in test code only
9
+ * @internal
9
10
  */
10
11
  export declare function acquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T | undefined>;
11
12
  /**
12
13
  * Helper method to acquire and complete an item
13
14
  * Should be used in test code only
15
+ * @internal
14
16
  */
15
17
  export declare function waitAcquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T>;
16
18
  //# sourceMappingURL=testUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAmB,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAE5E;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EACzC,UAAU,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAOxB;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,EAC7C,UAAU,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,CAAC,CAOZ"}
1
+ {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAmB,2BAA2B,EAAE;AAEvD;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,EACzC,UAAU,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAOxB;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,EAC7C,UAAU,EAAE,2BAA2B,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,CAAC,CAOZ"}
package/lib/testUtils.mjs CHANGED
@@ -6,6 +6,7 @@ import { ConsensusResult } from "./interfaces.mjs";
6
6
  /**
7
7
  * Helper method to acquire and complete an item
8
8
  * Should be used in test code only
9
+ * @internal
9
10
  */
10
11
  export async function acquireAndComplete(collection) {
11
12
  let res;
@@ -18,6 +19,7 @@ export async function acquireAndComplete(collection) {
18
19
  /**
19
20
  * Helper method to acquire and complete an item
20
21
  * Should be used in test code only
22
+ * @internal
21
23
  */
22
24
  export async function waitAcquireAndComplete(collection) {
23
25
  let res;
@@ -1 +1 @@
1
- {"version":3,"file":"testUtils.mjs","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,eAAe,EAA+B;AAEvD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACvC,UAA0C;IAE1C,IAAI,GAAkB,CAAC;IACvB,MAAM,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,KAAQ,EAAE,EAAE;QAC3C,GAAG,GAAG,KAAK,CAAC;QACZ,OAAO,eAAe,CAAC,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,UAA0C;IAE1C,IAAI,GAAkB,CAAC;IACvB,MAAM,UAAU,CAAC,cAAc,CAAC,KAAK,EAAE,KAAQ,EAAE,EAAE;QAClD,GAAG,GAAG,KAAK,CAAC;QACZ,OAAO,eAAe,CAAC,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IACH,OAAO,GAAQ,CAAC;AACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ConsensusResult, IConsensusOrderedCollection } from \"./interfaces\";\n\n/**\n * Helper method to acquire and complete an item\n * Should be used in test code only\n */\nexport async function acquireAndComplete<T>(\n\tcollection: IConsensusOrderedCollection<T>,\n): Promise<T | undefined> {\n\tlet res: T | undefined;\n\tawait collection.acquire(async (value: T) => {\n\t\tres = value;\n\t\treturn ConsensusResult.Complete;\n\t});\n\treturn res;\n}\n\n/**\n * Helper method to acquire and complete an item\n * Should be used in test code only\n */\nexport async function waitAcquireAndComplete<T>(\n\tcollection: IConsensusOrderedCollection<T>,\n): Promise<T> {\n\tlet res: T | undefined;\n\tawait collection.waitAndAcquire(async (value: T) => {\n\t\tres = value;\n\t\treturn ConsensusResult.Complete;\n\t});\n\treturn res as T;\n}\n"]}
1
+ {"version":3,"file":"testUtils.mjs","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,eAAe,EAA+B;AAEvD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACvC,UAA0C;IAE1C,IAAI,GAAkB,CAAC;IACvB,MAAM,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,KAAQ,EAAE,EAAE;QAC3C,GAAG,GAAG,KAAK,CAAC;QACZ,OAAO,eAAe,CAAC,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,UAA0C;IAE1C,IAAI,GAAkB,CAAC;IACvB,MAAM,UAAU,CAAC,cAAc,CAAC,KAAK,EAAE,KAAQ,EAAE,EAAE;QAClD,GAAG,GAAG,KAAK,CAAC;QACZ,OAAO,eAAe,CAAC,QAAQ,CAAC;IACjC,CAAC,CAAC,CAAC;IACH,OAAO,GAAQ,CAAC;AACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ConsensusResult, IConsensusOrderedCollection } from \"./interfaces\";\n\n/**\n * Helper method to acquire and complete an item\n * Should be used in test code only\n * @internal\n */\nexport async function acquireAndComplete<T>(\n\tcollection: IConsensusOrderedCollection<T>,\n): Promise<T | undefined> {\n\tlet res: T | undefined;\n\tawait collection.acquire(async (value: T) => {\n\t\tres = value;\n\t\treturn ConsensusResult.Complete;\n\t});\n\treturn res;\n}\n\n/**\n * Helper method to acquire and complete an item\n * Should be used in test code only\n * @internal\n */\nexport async function waitAcquireAndComplete<T>(\n\tcollection: IConsensusOrderedCollection<T>,\n): Promise<T> {\n\tlet res: T | undefined;\n\tawait collection.waitAndAcquire(async (value: T) => {\n\t\tres = value;\n\t\treturn ConsensusResult.Complete;\n\t});\n\treturn res as T;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/ordered-collection",
3
- "version": "2.0.0-internal.7.3.0",
3
+ "version": "2.0.0-internal.7.4.0",
4
4
  "description": "Consensus Collection",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -11,18 +11,6 @@
11
11
  "license": "MIT",
12
12
  "author": "Microsoft and contributors",
13
13
  "sideEffects": false,
14
- "exports": {
15
- ".": {
16
- "import": {
17
- "types": "./lib/index.d.ts",
18
- "default": "./lib/index.mjs"
19
- },
20
- "require": {
21
- "types": "./dist/index.d.ts",
22
- "default": "./dist/index.cjs"
23
- }
24
- }
25
- },
26
14
  "main": "dist/index.cjs",
27
15
  "module": "lib/index.mjs",
28
16
  "types": "dist/index.d.ts",
@@ -47,28 +35,29 @@
47
35
  "temp-directory": "nyc/.nyc_output"
48
36
  },
49
37
  "dependencies": {
50
- "@fluid-internal/client-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
51
- "@fluidframework/core-interfaces": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
52
- "@fluidframework/core-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
53
- "@fluidframework/datastore-definitions": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
38
+ "@fluid-internal/client-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
39
+ "@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
40
+ "@fluidframework/core-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
41
+ "@fluidframework/datastore-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
54
42
  "@fluidframework/protocol-definitions": "^3.0.0",
55
- "@fluidframework/runtime-definitions": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
56
- "@fluidframework/runtime-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
57
- "@fluidframework/shared-object-base": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
43
+ "@fluidframework/runtime-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
44
+ "@fluidframework/runtime-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
45
+ "@fluidframework/shared-object-base": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
58
46
  "uuid": "^9.0.0"
59
47
  },
60
48
  "devDependencies": {
61
- "@fluid-private/test-dds-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
49
+ "@arethetypeswrong/cli": "^0.13.3",
50
+ "@fluid-private/test-dds-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
62
51
  "@fluid-tools/build-cli": "^0.28.0",
63
52
  "@fluidframework/build-common": "^2.0.3",
64
53
  "@fluidframework/build-tools": "^0.28.0",
65
54
  "@fluidframework/eslint-config-fluid": "^3.1.0",
66
- "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
55
+ "@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
67
56
  "@fluidframework/ordered-collection-previous": "npm:@fluidframework/ordered-collection@2.0.0-internal.7.2.0",
68
- "@fluidframework/test-runtime-utils": ">=2.0.0-internal.7.3.0 <2.0.0-internal.7.4.0",
57
+ "@fluidframework/test-runtime-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
69
58
  "@microsoft/api-extractor": "^7.38.3",
70
59
  "@types/mocha": "^9.1.1",
71
- "@types/node": "^16.18.38",
60
+ "@types/node": "^18.19.0",
72
61
  "c8": "^7.7.1",
73
62
  "copyfiles": "^2.4.1",
74
63
  "cross-env": "^7.0.3",
@@ -108,15 +97,17 @@
108
97
  "build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
109
98
  "build:genver": "gen-version",
110
99
  "build:test": "tsc-multi --config ./tsc-multi.test.json",
100
+ "check:are-the-types-wrong": "attw --pack",
101
+ "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
111
102
  "ci:build:docs": "api-extractor run",
112
103
  "clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
113
104
  "eslint": "eslint --format stylish src",
114
105
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
115
106
  "format": "npm run prettier:fix",
116
- "lint": "npm run prettier && npm run eslint",
107
+ "lint": "npm run prettier && npm run check:release-tags && npm run eslint",
117
108
  "lint:fix": "npm run prettier:fix && npm run eslint:fix",
118
- "prettier": "prettier --check . --ignore-path ../../../.prettierignore",
119
- "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
109
+ "prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
110
+ "prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
120
111
  "test": "npm run test:mocha",
121
112
  "test:coverage": "c8 npm test",
122
113
  "test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
@@ -90,6 +90,7 @@ const idForLocalUnattachedClient = undefined;
90
90
  *
91
91
  * Generally not used directly. A derived type will pass in a backing data type
92
92
  * IOrderedCollection that will define the deterministic add/acquire order and snapshot ability.
93
+ * @internal
93
94
  */
94
95
  export class ConsensusOrderedCollection<T = any>
95
96
  extends SharedObject<IConsensusOrderedCollectionEvents<T>>
@@ -33,6 +33,7 @@ class SnapshotableQueue<T> extends SnapshotableArray<T> implements IOrderedColle
33
33
  * Implementation of a consensus stack
34
34
  *
35
35
  * An derived type of ConsensusOrderedCollection with a queue as the backing data and order.
36
+ * @internal
36
37
  */
37
38
  export class ConsensusQueue<T = any> extends ConsensusOrderedCollection<T> {
38
39
  /**
package/src/interfaces.ts CHANGED
@@ -11,6 +11,9 @@ import {
11
11
  } from "@fluidframework/datastore-definitions";
12
12
  import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
13
13
 
14
+ /**
15
+ * @internal
16
+ */
14
17
  export enum ConsensusResult {
15
18
  Release,
16
19
  Complete,
@@ -19,6 +22,7 @@ export enum ConsensusResult {
19
22
  /**
20
23
  * Callback provided to acquire() and waitAndAcquire() methods.
21
24
  * @returns ConsensusResult indicating whether item was completed, or releases back to the queue.
25
+ * @internal
22
26
  */
23
27
  export type ConsensusCallback<T> = (value: T) => Promise<ConsensusResult>;
24
28
 
@@ -27,6 +31,7 @@ export type ConsensusCallback<T> = (value: T) => Promise<ConsensusResult>;
27
31
  *
28
32
  * Extends the base IChannelFactory to return a more definite type of IConsensusOrderedCollection
29
33
  * Use for the runtime to create and load distributed data structure by type name of each channel
34
+ * @internal
30
35
  */
31
36
  export interface IConsensusOrderedCollectionFactory extends IChannelFactory {
32
37
  load(
@@ -41,6 +46,7 @@ export interface IConsensusOrderedCollectionFactory extends IChannelFactory {
41
46
 
42
47
  /**
43
48
  * Events notifying about addition, acquisition, release and completion of items
49
+ * @internal
44
50
  */
45
51
  export interface IConsensusOrderedCollectionEvents<T> extends ISharedObjectEvents {
46
52
  /**
@@ -93,6 +99,7 @@ export interface IConsensusOrderedCollectionEvents<T> extends ISharedObjectEvent
93
99
  * All objects added to the collection will be cloned (via JSON).
94
100
  * They will not be references to the original input object. Thus changed to
95
101
  * the input object will not reflect the object in the collection.
102
+ * @internal
96
103
  */
97
104
  export interface IConsensusOrderedCollection<T = any>
98
105
  extends ISharedObject<IConsensusOrderedCollectionEvents<T>> {
@@ -120,6 +127,7 @@ export interface IConsensusOrderedCollection<T = any>
120
127
  *
121
128
  * TODO: move this to be use in other place
122
129
  * TODO: currently input and output is not symmetrical, can they become symmetrical?
130
+ * @internal
123
131
  */
124
132
  export interface ISnapshotable<T> {
125
133
  asArray(): T[];
@@ -133,6 +141,7 @@ export interface ISnapshotable<T> {
133
141
  * Collection of objects that has deterministic add and remove ordering.
134
142
  * Object implementing this interface can be used as the data backing
135
143
  * for the ConsensusOrderedCollection
144
+ * @internal
136
145
  */
137
146
  export interface IOrderedCollection<T = any> extends ISnapshotable<T> {
138
147
  /**
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/ordered-collection";
9
- export const pkgVersion = "2.0.0-internal.7.3.0";
9
+ export const pkgVersion = "2.0.0-internal.7.4.0";
package/src/testUtils.ts CHANGED
@@ -8,6 +8,7 @@ import { ConsensusResult, IConsensusOrderedCollection } from "./interfaces";
8
8
  /**
9
9
  * Helper method to acquire and complete an item
10
10
  * Should be used in test code only
11
+ * @internal
11
12
  */
12
13
  export async function acquireAndComplete<T>(
13
14
  collection: IConsensusOrderedCollection<T>,
@@ -23,6 +24,7 @@ export async function acquireAndComplete<T>(
23
24
  /**
24
25
  * Helper method to acquire and complete an item
25
26
  * Should be used in test code only
27
+ * @internal
26
28
  */
27
29
  export async function waitAcquireAndComplete<T>(
28
30
  collection: IConsensusOrderedCollection<T>,