@fluidframework/ordered-collection 2.0.0-internal.7.2.2 → 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 (92) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +3 -3
  4. package/api-report/ordered-collection.api.md +11 -11
  5. package/dist/{consensusOrderedCollection.js → consensusOrderedCollection.cjs} +3 -2
  6. package/dist/consensusOrderedCollection.cjs.map +1 -0
  7. package/dist/consensusOrderedCollection.d.ts +1 -0
  8. package/dist/consensusOrderedCollection.d.ts.map +1 -1
  9. package/dist/{consensusOrderedCollectionFactory.js → consensusOrderedCollectionFactory.cjs} +3 -3
  10. package/dist/consensusOrderedCollectionFactory.cjs.map +1 -0
  11. package/dist/{consensusQueue.js → consensusQueue.cjs} +5 -4
  12. package/dist/consensusQueue.cjs.map +1 -0
  13. package/dist/consensusQueue.d.ts +1 -0
  14. package/dist/consensusQueue.d.ts.map +1 -1
  15. package/dist/{index.js → index.cjs} +5 -5
  16. package/dist/index.cjs.map +1 -0
  17. package/dist/{interfaces.js → interfaces.cjs} +4 -1
  18. package/dist/interfaces.cjs.map +1 -0
  19. package/dist/interfaces.d.ts +9 -0
  20. package/dist/interfaces.d.ts.map +1 -1
  21. package/dist/ordered-collection-alpha.d.ts +35 -0
  22. package/dist/ordered-collection-beta.d.ts +55 -0
  23. package/dist/ordered-collection-public.d.ts +55 -0
  24. package/dist/ordered-collection-untrimmed.d.ts +246 -0
  25. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  26. package/dist/packageVersion.cjs.map +1 -0
  27. package/dist/packageVersion.d.ts +1 -1
  28. package/dist/{snapshotableArray.js → snapshotableArray.cjs} +1 -1
  29. package/dist/snapshotableArray.cjs.map +1 -0
  30. package/dist/{testUtils.js → testUtils.cjs} +4 -2
  31. package/dist/testUtils.cjs.map +1 -0
  32. package/dist/testUtils.d.ts +2 -0
  33. package/dist/testUtils.d.ts.map +1 -1
  34. package/dist/tsdoc-metadata.json +1 -1
  35. package/lib/consensusOrderedCollection.d.ts +2 -1
  36. package/lib/consensusOrderedCollection.d.ts.map +1 -1
  37. package/lib/{consensusOrderedCollection.js → consensusOrderedCollection.mjs} +3 -2
  38. package/lib/consensusOrderedCollection.mjs.map +1 -0
  39. package/lib/consensusOrderedCollectionFactory.d.ts +1 -1
  40. package/lib/consensusOrderedCollectionFactory.d.ts.map +1 -1
  41. package/lib/{consensusOrderedCollectionFactory.js → consensusOrderedCollectionFactory.mjs} +3 -3
  42. package/lib/consensusOrderedCollectionFactory.mjs.map +1 -0
  43. package/lib/consensusQueue.d.ts +2 -1
  44. package/lib/consensusQueue.d.ts.map +1 -1
  45. package/lib/{consensusQueue.js → consensusQueue.mjs} +5 -4
  46. package/lib/consensusQueue.mjs.map +1 -0
  47. package/lib/index.d.ts +4 -4
  48. package/lib/index.d.ts.map +1 -1
  49. package/lib/{index.js → index.mjs} +5 -5
  50. package/lib/index.mjs.map +1 -0
  51. package/lib/interfaces.d.ts +9 -0
  52. package/lib/interfaces.d.ts.map +1 -1
  53. package/lib/{interfaces.js → interfaces.mjs} +4 -1
  54. package/lib/interfaces.mjs.map +1 -0
  55. package/lib/ordered-collection-alpha.d.ts +35 -0
  56. package/lib/ordered-collection-beta.d.ts +55 -0
  57. package/lib/ordered-collection-public.d.ts +55 -0
  58. package/lib/ordered-collection-untrimmed.d.ts +246 -0
  59. package/lib/packageVersion.d.ts +1 -1
  60. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  61. package/lib/packageVersion.mjs.map +1 -0
  62. package/lib/{snapshotableArray.js → snapshotableArray.mjs} +1 -1
  63. package/lib/snapshotableArray.mjs.map +1 -0
  64. package/lib/testUtils.d.ts +3 -1
  65. package/lib/testUtils.d.ts.map +1 -1
  66. package/lib/{testUtils.js → testUtils.mjs} +4 -2
  67. package/lib/testUtils.mjs.map +1 -0
  68. package/package.json +48 -28
  69. package/src/consensusOrderedCollection.ts +1 -0
  70. package/src/consensusQueue.ts +1 -0
  71. package/src/interfaces.ts +9 -0
  72. package/src/packageVersion.ts +1 -1
  73. package/src/testUtils.ts +2 -0
  74. package/tsc-multi.test.json +4 -0
  75. package/tsconfig.json +5 -3
  76. package/dist/consensusOrderedCollection.js.map +0 -1
  77. package/dist/consensusOrderedCollectionFactory.js.map +0 -1
  78. package/dist/consensusQueue.js.map +0 -1
  79. package/dist/index.js.map +0 -1
  80. package/dist/interfaces.js.map +0 -1
  81. package/dist/packageVersion.js.map +0 -1
  82. package/dist/snapshotableArray.js.map +0 -1
  83. package/dist/testUtils.js.map +0 -1
  84. package/lib/consensusOrderedCollection.js.map +0 -1
  85. package/lib/consensusOrderedCollectionFactory.js.map +0 -1
  86. package/lib/consensusQueue.js.map +0 -1
  87. package/lib/index.js.map +0 -1
  88. package/lib/interfaces.js.map +0 -1
  89. package/lib/packageVersion.js.map +0 -1
  90. package/lib/snapshotableArray.js.map +0 -1
  91. package/lib/testUtils.js.map +0 -1
  92. package/tsconfig.esnext.json +0 -7
@@ -4,6 +4,9 @@
4
4
  */
5
5
  import { IFluidDataStoreRuntime, IChannelServices, IChannelAttributes, IChannelFactory } from "@fluidframework/datastore-definitions";
6
6
  import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
7
+ /**
8
+ * @internal
9
+ */
7
10
  export declare enum ConsensusResult {
8
11
  Release = 0,
9
12
  Complete = 1
@@ -11,6 +14,7 @@ export declare enum ConsensusResult {
11
14
  /**
12
15
  * Callback provided to acquire() and waitAndAcquire() methods.
13
16
  * @returns ConsensusResult indicating whether item was completed, or releases back to the queue.
17
+ * @internal
14
18
  */
15
19
  export type ConsensusCallback<T> = (value: T) => Promise<ConsensusResult>;
16
20
  /**
@@ -18,6 +22,7 @@ export type ConsensusCallback<T> = (value: T) => Promise<ConsensusResult>;
18
22
  *
19
23
  * Extends the base IChannelFactory to return a more definite type of IConsensusOrderedCollection
20
24
  * Use for the runtime to create and load distributed data structure by type name of each channel
25
+ * @internal
21
26
  */
22
27
  export interface IConsensusOrderedCollectionFactory extends IChannelFactory {
23
28
  load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusOrderedCollection>;
@@ -25,6 +30,7 @@ export interface IConsensusOrderedCollectionFactory extends IChannelFactory {
25
30
  }
26
31
  /**
27
32
  * Events notifying about addition, acquisition, release and completion of items
33
+ * @internal
28
34
  */
29
35
  export interface IConsensusOrderedCollectionEvents<T> extends ISharedObjectEvents {
30
36
  /**
@@ -74,6 +80,7 @@ export interface IConsensusOrderedCollectionEvents<T> extends ISharedObjectEvent
74
80
  * All objects added to the collection will be cloned (via JSON).
75
81
  * They will not be references to the original input object. Thus changed to
76
82
  * the input object will not reflect the object in the collection.
83
+ * @internal
77
84
  */
78
85
  export interface IConsensusOrderedCollection<T = any> extends ISharedObject<IConsensusOrderedCollectionEvents<T>> {
79
86
  /**
@@ -97,6 +104,7 @@ export interface IConsensusOrderedCollection<T = any> extends ISharedObject<ICon
97
104
  *
98
105
  * TODO: move this to be use in other place
99
106
  * TODO: currently input and output is not symmetrical, can they become symmetrical?
107
+ * @internal
100
108
  */
101
109
  export interface ISnapshotable<T> {
102
110
  asArray(): T[];
@@ -108,6 +116,7 @@ export interface ISnapshotable<T> {
108
116
  * Collection of objects that has deterministic add and remove ordering.
109
117
  * Object implementing this interface can be used as the data backing
110
118
  * for the ConsensusOrderedCollection
119
+ * @internal
111
120
  */
112
121
  export interface IOrderedCollection<T = any> extends ISnapshotable<T> {
113
122
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oCAAoC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AAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,EAAE,CAAC;IAEf,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACpE;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,OAAE;IAEd;;OAEG;IACH,MAAM,IAAI,CAAC,CAAC;IAEZ;;OAEG;IACH,IAAI,IAAI,MAAM,CAAC;CACf"}
@@ -2,9 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ /**
6
+ * @internal
7
+ */
5
8
  export var ConsensusResult;
6
9
  (function (ConsensusResult) {
7
10
  ConsensusResult[ConsensusResult["Release"] = 0] = "Release";
8
11
  ConsensusResult[ConsensusResult["Complete"] = 1] = "Complete";
9
12
  })(ConsensusResult || (ConsensusResult = {}));
10
- //# sourceMappingURL=interfaces.js.map
13
+ //# sourceMappingURL=interfaces.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.mjs","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH;;GAEG;AACH,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IAC1B,2DAAO,CAAA;IACP,6DAAQ,CAAA;AACT,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIFluidDataStoreRuntime,\n\tIChannelServices,\n\tIChannelAttributes,\n\tIChannelFactory,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISharedObject, ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\n\n/**\n * @internal\n */\nexport enum ConsensusResult {\n\tRelease,\n\tComplete,\n}\n\n/**\n * Callback provided to acquire() and waitAndAcquire() methods.\n * @returns ConsensusResult indicating whether item was completed, or releases back to the queue.\n * @internal\n */\nexport type ConsensusCallback<T> = (value: T) => Promise<ConsensusResult>;\n\n/**\n * Consensus Ordered Collection channel factory interface\n *\n * Extends the base IChannelFactory to return a more definite type of IConsensusOrderedCollection\n * Use for the runtime to create and load distributed data structure by type name of each channel\n * @internal\n */\nexport interface IConsensusOrderedCollectionFactory extends IChannelFactory {\n\tload(\n\t\tdocument: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<IConsensusOrderedCollection>;\n\n\tcreate(document: IFluidDataStoreRuntime, id: string): IConsensusOrderedCollection;\n}\n\n/**\n * Events notifying about addition, acquisition, release and completion of items\n * @internal\n */\nexport interface IConsensusOrderedCollectionEvents<T> extends ISharedObjectEvents {\n\t/**\n\t * Event fires when new item is added to the queue or\n\t * an item previously acquired is returned back to a queue (including client loosing connection)\n\t * @param newlyAdded - indicates if it's newly added item of previously acquired item\n\t */\n\t(event: \"add\", listener: (value: T, newlyAdded: boolean) => void): this;\n\t/**\n\t * Event fires when a client acquired an item\n\t * Fires both for locally acquired items, as well as items acquired by remote clients\n\t */\n\t(event: \"acquire\", listener: (value: T, clientId?: string) => void): this;\n\n\t/**\n\t * \"Complete event fires when a client completes an item.\n\t */\n\t(event: \"complete\", listener: (value: T) => void): this;\n\n\t/**\n\t * Event fires when locally acquired item is being released back to the queue.\n\t * Please note that release process is asynchronous, so it takes a while for it to happen\n\t * (\"add\" event will be fired as result of it)\n\t * @param intentional - indicates whether release was intentional (result of returning\n\t * ConsensusResult.Release from callback) or it happened as result of lost connection.\n\t */\n\t(event: \"localRelease\", listener: (value: T, intentional: boolean) => void): this;\n}\n\n/**\n * Consensus Ordered Collection interface\n *\n * An consensus ordered collection is a distributed data structure, which\n * holds a collection of JSON-able or handles, and has a\n * deterministic add/remove order.\n *\n * @remarks\n * The order the server receive the add/remove operation determines the\n * order those operation are applied to the collection. Different clients\n * issuing `add` or `acquire` operations at the same time will be sequenced.\n * The order dictates which `add` is done first, thus determining the order\n * in which it appears in the collection. It also determines which client\n * will get the first removed item, etc. All operations are asynchronous.\n * A function `waitAndAcquire` is provided to wait for and remove an entry in the collection.\n *\n * As a client acquires an item, it processes it and then returns a value (via callback)\n * indicating whether it has completed processing the item, or whether the item should be\n * released back to the collection for another client to process.\n *\n * All objects added to the collection will be cloned (via JSON).\n * They will not be references to the original input object. Thus changed to\n * the input object will not reflect the object in the collection.\n * @internal\n */\nexport interface IConsensusOrderedCollection<T = any>\n\textends ISharedObject<IConsensusOrderedCollectionEvents<T>> {\n\t/**\n\t * Adds a value to the collection\n\t */\n\tadd(value: T): Promise<void>;\n\n\t/**\n\t * Retrieves a value from the collection.\n\t * @returns Returns true (and calls callback with acquired value) if collection was not empty.\n\t * Otherwise returns false.\n\t */\n\tacquire(callback: ConsensusCallback<T>): Promise<boolean>;\n\n\t/**\n\t * Wait for a value to be available and remove it from the consensus collection\n\t * Calls callback with retrieved value.\n\t */\n\twaitAndAcquire(callback: ConsensusCallback<T>): Promise<void>;\n}\n\n/**\n * Interface for object that can be snapshoted\n *\n * TODO: move this to be use in other place\n * TODO: currently input and output is not symmetrical, can they become symmetrical?\n * @internal\n */\nexport interface ISnapshotable<T> {\n\tasArray(): T[];\n\n\tloadFrom(values: T[]): void;\n}\n\n/**\n * Ordered Collection interface\n *\n * Collection of objects that has deterministic add and remove ordering.\n * Object implementing this interface can be used as the data backing\n * for the ConsensusOrderedCollection\n * @internal\n */\nexport interface IOrderedCollection<T = any> extends ISnapshotable<T> {\n\t/**\n\t * Adds a value to the collection\n\t */\n\tadd(value: T);\n\n\t/**\n\t * Retrieves a value from the collection.\n\t */\n\tremove(): T;\n\n\t/**\n\t * Return the size of the collection\n\t */\n\tsize(): number;\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
4
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
5
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
6
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
7
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
8
+ import { ISharedObject } from '@fluidframework/shared-object-base';
9
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
+ import { SharedObject } from '@fluidframework/shared-object-base';
12
+
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: IConsensusOrderedCollection */
24
+
25
+ /* Excluded from this release type: IConsensusOrderedCollectionEvents */
26
+
27
+ /* Excluded from this release type: IConsensusOrderedCollectionFactory */
28
+
29
+ /* Excluded from this release type: IOrderedCollection */
30
+
31
+ /* Excluded from this release type: ISnapshotable */
32
+
33
+ /* Excluded from this release type: waitAcquireAndComplete */
34
+
35
+ export { }
@@ -0,0 +1,55 @@
1
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
4
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
5
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
6
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
7
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
8
+ import { ISharedObject } from '@fluidframework/shared-object-base';
9
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
+ import { SharedObject } from '@fluidframework/shared-object-base';
12
+
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 */
54
+
55
+ export { }
@@ -0,0 +1,55 @@
1
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
4
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
5
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
6
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
7
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
8
+ import { ISharedObject } from '@fluidframework/shared-object-base';
9
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
+ import { SharedObject } from '@fluidframework/shared-object-base';
12
+
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 */
54
+
55
+ export { }
@@ -0,0 +1,246 @@
1
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
2
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
3
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
4
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
5
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
6
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
7
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
8
+ import { ISharedObject } from '@fluidframework/shared-object-base';
9
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
+ import { SharedObject } from '@fluidframework/shared-object-base';
12
+
13
+ /**
14
+ * Helper method to acquire and complete an item
15
+ * Should be used in test code only
16
+ * @internal
17
+ */
18
+ export declare function acquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T | undefined>;
19
+
20
+ /**
21
+ * Callback provided to acquire() and waitAndAcquire() methods.
22
+ * @returns ConsensusResult indicating whether item was completed, or releases back to the queue.
23
+ * @internal
24
+ */
25
+ export declare type ConsensusCallback<T> = (value: T) => Promise<ConsensusResult>;
26
+
27
+ /**
28
+ * Implementation of a consensus collection shared object
29
+ *
30
+ * Implements the shared object's communication, and the semantics around the
31
+ * release/complete mechanism following acquire.
32
+ *
33
+ * Generally not used directly. A derived type will pass in a backing data type
34
+ * IOrderedCollection that will define the deterministic add/acquire order and snapshot ability.
35
+ * @internal
36
+ */
37
+ export declare class ConsensusOrderedCollection<T = any> extends SharedObject<IConsensusOrderedCollectionEvents<T>> implements IConsensusOrderedCollection<T> {
38
+ private readonly data;
39
+ /**
40
+ * The set of values that have been acquired but not yet completed or released
41
+ */
42
+ private jobTracking;
43
+ /**
44
+ * Constructs a new consensus collection. If the object is non-local an id and service interfaces will
45
+ * be provided
46
+ */
47
+ protected constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, data: IOrderedCollection<T>);
48
+ /**
49
+ * Add a value to the consensus collection.
50
+ */
51
+ add(value: T): Promise<void>;
52
+ /**
53
+ * Remove a value from the consensus collection. If the collection is empty, returns false.
54
+ * Otherwise calls callback with the value
55
+ */
56
+ acquire(callback: ConsensusCallback<T>): Promise<boolean>;
57
+ /**
58
+ * Wait for a value to be available and acquire it from the consensus collection
59
+ */
60
+ waitAndAcquire(callback: ConsensusCallback<T>): Promise<void>;
61
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
62
+ protected isActive(): boolean;
63
+ protected complete(acquireId: string): Promise<void>;
64
+ protected completeCore(acquireId: string): void;
65
+ protected release(acquireId: string): void;
66
+ protected releaseCore(acquireId: string): void;
67
+ /**
68
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
69
+ */
70
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
71
+ protected onDisconnect(): void;
72
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
73
+ private submit;
74
+ private addCore;
75
+ private acquireCore;
76
+ private acquireInternal;
77
+ private removeClient;
78
+ private serializeValue;
79
+ private deserializeValue;
80
+ protected applyStashedOp(): void;
81
+ }
82
+
83
+ /**
84
+ * Implementation of a consensus stack
85
+ *
86
+ * An derived type of ConsensusOrderedCollection with a queue as the backing data and order.
87
+ * @internal
88
+ */
89
+ export declare class ConsensusQueue<T = any> extends ConsensusOrderedCollection<T> {
90
+ /**
91
+ * Create a new consensus queue
92
+ *
93
+ * @param runtime - data store runtime the new consensus queue belongs to
94
+ * @param id - optional name of theconsensus queue
95
+ * @returns newly create consensus queue (but not attached yet)
96
+ */
97
+ static create<T = any>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusQueue<T>;
98
+ /**
99
+ * Get a factory for ConsensusQueue to register with the data store.
100
+ *
101
+ * @returns a factory that creates and load ConsensusQueue
102
+ */
103
+ static getFactory(): IChannelFactory;
104
+ /**
105
+ * Constructs a new consensus queue. If the object is non-local an id and service interfaces will
106
+ * be provided
107
+ */
108
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
109
+ }
110
+
111
+ /**
112
+ * @internal
113
+ */
114
+ export declare enum ConsensusResult {
115
+ Release = 0,
116
+ Complete = 1
117
+ }
118
+
119
+ /**
120
+ * Consensus Ordered Collection interface
121
+ *
122
+ * An consensus ordered collection is a distributed data structure, which
123
+ * holds a collection of JSON-able or handles, and has a
124
+ * deterministic add/remove order.
125
+ *
126
+ * @remarks
127
+ * The order the server receive the add/remove operation determines the
128
+ * order those operation are applied to the collection. Different clients
129
+ * issuing `add` or `acquire` operations at the same time will be sequenced.
130
+ * The order dictates which `add` is done first, thus determining the order
131
+ * in which it appears in the collection. It also determines which client
132
+ * will get the first removed item, etc. All operations are asynchronous.
133
+ * A function `waitAndAcquire` is provided to wait for and remove an entry in the collection.
134
+ *
135
+ * As a client acquires an item, it processes it and then returns a value (via callback)
136
+ * indicating whether it has completed processing the item, or whether the item should be
137
+ * released back to the collection for another client to process.
138
+ *
139
+ * All objects added to the collection will be cloned (via JSON).
140
+ * They will not be references to the original input object. Thus changed to
141
+ * the input object will not reflect the object in the collection.
142
+ * @internal
143
+ */
144
+ export declare interface IConsensusOrderedCollection<T = any> extends ISharedObject<IConsensusOrderedCollectionEvents<T>> {
145
+ /**
146
+ * Adds a value to the collection
147
+ */
148
+ add(value: T): Promise<void>;
149
+ /**
150
+ * Retrieves a value from the collection.
151
+ * @returns Returns true (and calls callback with acquired value) if collection was not empty.
152
+ * Otherwise returns false.
153
+ */
154
+ acquire(callback: ConsensusCallback<T>): Promise<boolean>;
155
+ /**
156
+ * Wait for a value to be available and remove it from the consensus collection
157
+ * Calls callback with retrieved value.
158
+ */
159
+ waitAndAcquire(callback: ConsensusCallback<T>): Promise<void>;
160
+ }
161
+
162
+ /**
163
+ * Events notifying about addition, acquisition, release and completion of items
164
+ * @internal
165
+ */
166
+ export declare interface IConsensusOrderedCollectionEvents<T> extends ISharedObjectEvents {
167
+ /**
168
+ * Event fires when new item is added to the queue or
169
+ * an item previously acquired is returned back to a queue (including client loosing connection)
170
+ * @param newlyAdded - indicates if it's newly added item of previously acquired item
171
+ */
172
+ (event: "add", listener: (value: T, newlyAdded: boolean) => void): this;
173
+ /**
174
+ * Event fires when a client acquired an item
175
+ * Fires both for locally acquired items, as well as items acquired by remote clients
176
+ */
177
+ (event: "acquire", listener: (value: T, clientId?: string) => void): this;
178
+ /**
179
+ * "Complete event fires when a client completes an item.
180
+ */
181
+ (event: "complete", listener: (value: T) => void): this;
182
+ /**
183
+ * Event fires when locally acquired item is being released back to the queue.
184
+ * Please note that release process is asynchronous, so it takes a while for it to happen
185
+ * ("add" event will be fired as result of it)
186
+ * @param intentional - indicates whether release was intentional (result of returning
187
+ * ConsensusResult.Release from callback) or it happened as result of lost connection.
188
+ */
189
+ (event: "localRelease", listener: (value: T, intentional: boolean) => void): this;
190
+ }
191
+
192
+ /**
193
+ * Consensus Ordered Collection channel factory interface
194
+ *
195
+ * Extends the base IChannelFactory to return a more definite type of IConsensusOrderedCollection
196
+ * Use for the runtime to create and load distributed data structure by type name of each channel
197
+ * @internal
198
+ */
199
+ export declare interface IConsensusOrderedCollectionFactory extends IChannelFactory {
200
+ load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusOrderedCollection>;
201
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusOrderedCollection;
202
+ }
203
+
204
+ /**
205
+ * Ordered Collection interface
206
+ *
207
+ * Collection of objects that has deterministic add and remove ordering.
208
+ * Object implementing this interface can be used as the data backing
209
+ * for the ConsensusOrderedCollection
210
+ * @internal
211
+ */
212
+ export declare interface IOrderedCollection<T = any> extends ISnapshotable<T> {
213
+ /**
214
+ * Adds a value to the collection
215
+ */
216
+ add(value: T): any;
217
+ /**
218
+ * Retrieves a value from the collection.
219
+ */
220
+ remove(): T;
221
+ /**
222
+ * Return the size of the collection
223
+ */
224
+ size(): number;
225
+ }
226
+
227
+ /**
228
+ * Interface for object that can be snapshoted
229
+ *
230
+ * TODO: move this to be use in other place
231
+ * TODO: currently input and output is not symmetrical, can they become symmetrical?
232
+ * @internal
233
+ */
234
+ export declare interface ISnapshotable<T> {
235
+ asArray(): T[];
236
+ loadFrom(values: T[]): void;
237
+ }
238
+
239
+ /**
240
+ * Helper method to acquire and complete an item
241
+ * Should be used in test code only
242
+ * @internal
243
+ */
244
+ export declare function waitAcquireAndComplete<T>(collection: IConsensusOrderedCollection<T>): Promise<T>;
245
+
246
+ export { }
@@ -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.2.2";
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.2.2";
9
- //# sourceMappingURL=packageVersion.js.map
8
+ export const pkgVersion = "2.0.0-internal.7.4.0";
9
+ //# sourceMappingURL=packageVersion.mjs.map
@@ -0,0 +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.4.0\";\n"]}
@@ -19,4 +19,4 @@ export class SnapshotableArray extends Array {
19
19
  return this.data.length;
20
20
  }
21
21
  }
22
- //# sourceMappingURL=snapshotableArray.js.map
22
+ //# sourceMappingURL=snapshotableArray.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotableArray.mjs","sourceRoot":"","sources":["../src/snapshotableArray.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,MAAM,4BAA4B;AAEnD,MAAM,OAAO,iBAAqB,SAAQ,KAAK;IAA/C;;QACW,SAAI,GAAQ,EAAE,CAAC;IAc1B,CAAC;IAZO,OAAO;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAS;QAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAC3F,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAEM,IAAI;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;IACzB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\n\nexport class SnapshotableArray<T> extends Array {\n\tprotected data: T[] = [];\n\n\tpublic asArray() {\n\t\treturn this.data;\n\t}\n\n\tpublic async loadFrom(from: T[]): Promise<void> {\n\t\tassert(this.data.length === 0, 0x06b /* \"Loading snapshot into a non-empty collection\" */);\n\t\tthis.data = from;\n\t}\n\n\tpublic size(): number {\n\t\treturn this.data.length;\n\t}\n}\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"}
@@ -2,10 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ConsensusResult } from "./interfaces";
5
+ 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;
@@ -27,4 +29,4 @@ export async function waitAcquireAndComplete(collection) {
27
29
  });
28
30
  return res;
29
31
  }
30
- //# sourceMappingURL=testUtils.js.map
32
+ //# sourceMappingURL=testUtils.mjs.map
@@ -0,0 +1 @@
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"]}