@fluidframework/register-collection 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419

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 (83) hide show
  1. package/.eslintrc.js +5 -7
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +117 -0
  4. package/README.md +29 -8
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/register-collection.api.md +90 -0
  8. package/dist/{consensusRegisterCollection.js → consensusRegisterCollection.cjs} +31 -29
  9. package/dist/consensusRegisterCollection.cjs.map +1 -0
  10. package/dist/consensusRegisterCollection.d.ts +2 -1
  11. package/dist/consensusRegisterCollection.d.ts.map +1 -1
  12. package/dist/{consensusRegisterCollectionFactory.js → consensusRegisterCollectionFactory.cjs} +5 -4
  13. package/dist/consensusRegisterCollectionFactory.cjs.map +1 -0
  14. package/dist/consensusRegisterCollectionFactory.d.ts +2 -1
  15. package/dist/consensusRegisterCollectionFactory.d.ts.map +1 -1
  16. package/dist/index.cjs +14 -0
  17. package/dist/index.cjs.map +1 -0
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/{interfaces.js → interfaces.cjs} +3 -2
  21. package/dist/interfaces.cjs.map +1 -0
  22. package/dist/interfaces.d.ts +9 -5
  23. package/dist/interfaces.d.ts.map +1 -1
  24. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  25. package/dist/packageVersion.cjs.map +1 -0
  26. package/dist/packageVersion.d.ts +1 -1
  27. package/dist/packageVersion.d.ts.map +1 -1
  28. package/dist/register-collection-alpha.d.ts +163 -0
  29. package/dist/register-collection-beta.d.ts +25 -0
  30. package/dist/register-collection-public.d.ts +25 -0
  31. package/dist/register-collection-untrimmed.d.ts +163 -0
  32. package/dist/tsdoc-metadata.json +11 -0
  33. package/lib/{consensusRegisterCollection.d.ts → consensusRegisterCollection.d.mts} +4 -3
  34. package/lib/consensusRegisterCollection.d.mts.map +1 -0
  35. package/lib/{consensusRegisterCollection.js → consensusRegisterCollection.mjs} +27 -25
  36. package/lib/consensusRegisterCollection.mjs.map +1 -0
  37. package/lib/{consensusRegisterCollectionFactory.d.ts → consensusRegisterCollectionFactory.d.mts} +3 -2
  38. package/lib/consensusRegisterCollectionFactory.d.mts.map +1 -0
  39. package/lib/{consensusRegisterCollectionFactory.js → consensusRegisterCollectionFactory.mjs} +5 -4
  40. package/lib/consensusRegisterCollectionFactory.mjs.map +1 -0
  41. package/lib/index.d.mts +8 -0
  42. package/lib/index.d.mts.map +1 -0
  43. package/lib/index.mjs +8 -0
  44. package/lib/index.mjs.map +1 -0
  45. package/lib/{interfaces.d.ts → interfaces.d.mts} +9 -5
  46. package/lib/interfaces.d.mts.map +1 -0
  47. package/lib/{interfaces.js → interfaces.mjs} +2 -1
  48. package/lib/interfaces.mjs.map +1 -0
  49. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
  50. package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
  51. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  52. package/lib/packageVersion.mjs.map +1 -0
  53. package/lib/register-collection-alpha.d.mts +163 -0
  54. package/lib/register-collection-beta.d.mts +25 -0
  55. package/lib/register-collection-public.d.mts +25 -0
  56. package/lib/register-collection-untrimmed.d.mts +163 -0
  57. package/package.json +97 -62
  58. package/prettier.config.cjs +8 -0
  59. package/src/consensusRegisterCollection.ts +307 -284
  60. package/src/consensusRegisterCollectionFactory.ts +39 -33
  61. package/src/index.ts +8 -3
  62. package/src/interfaces.ts +52 -43
  63. package/src/packageVersion.ts +1 -1
  64. package/tsc-multi.test.json +4 -0
  65. package/tsconfig.json +11 -13
  66. package/dist/consensusRegisterCollection.js.map +0 -1
  67. package/dist/consensusRegisterCollectionFactory.js.map +0 -1
  68. package/dist/index.js +0 -20
  69. package/dist/index.js.map +0 -1
  70. package/dist/interfaces.js.map +0 -1
  71. package/dist/packageVersion.js.map +0 -1
  72. package/lib/consensusRegisterCollection.d.ts.map +0 -1
  73. package/lib/consensusRegisterCollection.js.map +0 -1
  74. package/lib/consensusRegisterCollectionFactory.d.ts.map +0 -1
  75. package/lib/consensusRegisterCollectionFactory.js.map +0 -1
  76. package/lib/index.d.ts +0 -8
  77. package/lib/index.d.ts.map +0 -1
  78. package/lib/index.js +0 -8
  79. package/lib/index.js.map +0 -1
  80. package/lib/interfaces.d.ts.map +0 -1
  81. package/lib/interfaces.js.map +0 -1
  82. package/lib/packageVersion.js.map +0 -1
  83. package/tsconfig.esnext.json +0 -7
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ReadPolicy = void 0;
8
8
  /**
9
9
  * Read policies used when reading the map value.
10
+ * @alpha
10
11
  */
11
12
  var ReadPolicy;
12
13
  (function (ReadPolicy) {
@@ -14,5 +15,5 @@ var ReadPolicy;
14
15
  ReadPolicy[ReadPolicy["Atomic"] = 0] = "Atomic";
15
16
  // Last writer wins. Simply returns the last written value.
16
17
  ReadPolicy[ReadPolicy["LWW"] = 1] = "LWW";
17
- })(ReadPolicy = exports.ReadPolicy || (exports.ReadPolicy = {}));
18
- //# sourceMappingURL=interfaces.js.map
18
+ })(ReadPolicy || (exports.ReadPolicy = ReadPolicy = {}));
19
+ //# sourceMappingURL=interfaces.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.cjs","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAsFH;;;GAGG;AACH,IAAY,UAMX;AAND,WAAY,UAAU;IACrB,mFAAmF;IACnF,+CAAM,CAAA;IAEN,2DAA2D;IAC3D,yCAAG,CAAA;AACJ,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB","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 * Consensus Register Collection channel factory interface\n *\n * Extends the base IChannelFactory to return a more definite type of IConsensusRegisterCollection\n * Use for the runtime to create and load distributed data structure by type name of each channel.\n * @alpha\n */\nexport interface IConsensusRegisterCollectionFactory extends IChannelFactory {\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tload(\n\t\tdocument: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<IConsensusRegisterCollection>;\n\n\tcreate(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;\n}\n\n/**\n * Events emitted by {@link IConsensusRegisterCollection}.\n * @alpha\n */\nexport interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents {\n\t(\n\t\tevent: \"atomicChanged\" | \"versionChanged\",\n\t\tlistener: (key: string, value: any, local: boolean) => void,\n\t);\n}\n\n/**\n * A distributed data structure that holds a set of registers with update\n * versions. On concurrent updates, a register internally stores all possible versions of a value by using reference\n * sequence number of the incoming update.\n *\n * Using all the stored versions, we can then distinguish amongst different read policies. Below are the policies\n * we support:\n *\n * Atomic: Atomicity requires a linearizable register. A linearizable register behaves as if there is only a single\n * copy of the data, and that every operation appears to take effect atomically at one point in time. This definition\n * implies that operations are executed in an well-defined order. On a concurrent update, we perform a compare-and-set\n * operation, where we compare a register sequence number with the incoming reference sequence number.\n * The earliest operation overwriting prior sequence numbers wins since every client reaches to an agreement on\n * the value. So we can safely return the first value.\n *\n * LWW: The last write to a key always wins.\n * @alpha\n */\nexport interface IConsensusRegisterCollection<T = any>\n\textends ISharedObject<IConsensusRegisterCollectionEvents> {\n\t/**\n\t * Attempts to write a register with a value. Returns a promise to indicate the roundtrip completion.\n\t * For a non existent register, it will attempt to create a new register with the specified value.\n\t *\n\t * @returns Promise<true> if write was non-concurrent\n\t */\n\twrite(key: string, value: T): Promise<boolean>;\n\n\t/**\n\t * Retrieves the agreed upon value for the register based on policy. Returns undefined if not present.\n\t */\n\tread(key: string, policy?: ReadPolicy): T | undefined;\n\n\t/**\n\t * Retrives all concurrent versions. Undefined if not present.\n\t */\n\treadVersions(key: string): T[] | undefined;\n\n\t/**\n\t * Returns the keys.\n\t */\n\tkeys(): string[];\n}\n\n/**\n * Read policies used when reading the map value.\n * @alpha\n */\nexport enum ReadPolicy {\n\t// On a concurrent update, returns the first agreed upon value amongst all clients.\n\tAtomic,\n\n\t// Last writer wins. Simply returns the last written value.\n\tLWW,\n}\n"]}
@@ -8,7 +8,8 @@ import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-objec
8
8
  * Consensus Register Collection channel factory interface
9
9
  *
10
10
  * Extends the base IChannelFactory to return a more definite type of IConsensusRegisterCollection
11
- * Use for the runtime to create and load distributed data structure by type name of each channel
11
+ * Use for the runtime to create and load distributed data structure by type name of each channel.
12
+ * @alpha
12
13
  */
13
14
  export interface IConsensusRegisterCollectionFactory extends IChannelFactory {
14
15
  /**
@@ -17,13 +18,15 @@ export interface IConsensusRegisterCollectionFactory extends IChannelFactory {
17
18
  load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
18
19
  create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
19
20
  }
21
+ /**
22
+ * Events emitted by {@link IConsensusRegisterCollection}.
23
+ * @alpha
24
+ */
20
25
  export interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents {
21
26
  (event: "atomicChanged" | "versionChanged", listener: (key: string, value: any, local: boolean) => void): any;
22
27
  }
23
28
  /**
24
- * Consensus Register Collection.
25
- *
26
- * A consensus register collection is a distributed data structure, which holds a set of registers with update
29
+ * A distributed data structure that holds a set of registers with update
27
30
  * versions. On concurrent updates, a register internally stores all possible versions of a value by using reference
28
31
  * sequence number of the incoming update.
29
32
  *
@@ -38,7 +41,7 @@ export interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents
38
41
  * the value. So we can safely return the first value.
39
42
  *
40
43
  * LWW: The last write to a key always wins.
41
- *
44
+ * @alpha
42
45
  */
43
46
  export interface IConsensusRegisterCollection<T = any> extends ISharedObject<IConsensusRegisterCollectionEvents> {
44
47
  /**
@@ -63,6 +66,7 @@ export interface IConsensusRegisterCollection<T = any> extends ISharedObject<ICo
63
66
  }
64
67
  /**
65
68
  * Read policies used when reading the map value.
69
+ * @alpha
66
70
  */
67
71
  export declare enum ReadPolicy {
68
72
  Atomic = 0,
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAExF;;;;;GAKG;AACH,MAAM,WAAW,mCAAoC,SAAQ,eAAe;IACxE;;OAEG;IACH,IAAI,CACA,QAAQ,EAAE,sBAAsB,EAChC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAE3E,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,4BAA4B,CAAC;CACtF;AAED,MAAM,WAAW,kCAAmC,SAAQ,mBAAmB;IAC3E,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,OAAE;CAC5G;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,4BAA4B,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,aAAa,CAAC,kCAAkC,CAAC;IAC5G;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C;;OAEG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,CAAC,GAAG,SAAS,CAAC;IAEtD;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC;IAE3C;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,oBAAY,UAAU;IAElB,MAAM,IAAA;IAGN,GAAG,IAAA;CACN"}
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,CAAC;AAExF;;;;;;GAMG;AACH,MAAM,WAAW,mCAAoC,SAAQ,eAAe;IAC3E;;OAEG;IACH,IAAI,CACH,QAAQ,EAAE,sBAAsB,EAChC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAEzC,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,4BAA4B,CAAC;CACnF;AAED;;;GAGG;AACH,MAAM,WAAW,kCAAmC,SAAQ,mBAAmB;IAC9E,CACC,KAAK,EAAE,eAAe,GAAG,gBAAgB,EACzC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,OAC1D;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,4BAA4B,CAAC,CAAC,GAAG,GAAG,CACpD,SAAQ,aAAa,CAAC,kCAAkC,CAAC;IACzD;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C;;OAEG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,CAAC,GAAG,SAAS,CAAC;IAEtD;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC;IAE3C;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,oBAAY,UAAU;IAErB,MAAM,IAAA;IAGN,GAAG,IAAA;CACH"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/register-collection";
11
- exports.pkgVersion = "1.4.0-115997";
12
- //# sourceMappingURL=packageVersion.js.map
11
+ exports.pkgVersion = "2.0.0-dev-rc.1.0.0.224419";
12
+ //# sourceMappingURL=packageVersion.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.cjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,qCAAqC,CAAC;AAChD,QAAA,UAAU,GAAG,2BAA2B,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/register-collection\";\nexport const pkgVersion = \"2.0.0-dev-rc.1.0.0.224419\";\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/register-collection";
8
- export declare const pkgVersion = "1.4.0-115997";
8
+ export declare const pkgVersion = "2.0.0-dev-rc.1.0.0.224419";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,wCAAwC,CAAC;AAC7D,eAAO,MAAM,UAAU,iBAAiB,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,wCAAwC,CAAC;AAC7D,eAAO,MAAM,UAAU,8BAA8B,CAAC"}
@@ -0,0 +1,163 @@
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
+ * {@inheritDoc IConsensusRegisterCollection}
15
+ * @alpha
16
+ */
17
+ export declare class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
18
+ /**
19
+ * Create a new consensus register collection
20
+ *
21
+ * @param runtime - data store runtime the new consensus register collection belongs to
22
+ * @param id - optional name of the consensus register collection
23
+ * @returns newly create consensus register collection (but not attached yet)
24
+ */
25
+ static create<T>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusRegisterCollection<T>;
26
+ /**
27
+ * Get a factory for ConsensusRegisterCollection to register with the data store.
28
+ *
29
+ * @returns a factory that creates and load ConsensusRegisterCollection
30
+ */
31
+ static getFactory(): ConsensusRegisterCollectionFactory;
32
+ private readonly data;
33
+ /**
34
+ * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
35
+ * be provided
36
+ */
37
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
38
+ /**
39
+ * Creates a new register or writes a new value.
40
+ * Returns a promise that will resolve when the write is acked.
41
+ *
42
+ * @returns Promise<true> if write was non-concurrent
43
+ */
44
+ write(key: string, value: T): Promise<boolean>;
45
+ /**
46
+ * Returns the most recent local value of a register.
47
+ * @param key - The key to read
48
+ * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.
49
+ */
50
+ read(key: string, readPolicy?: ReadPolicy): T | undefined;
51
+ readVersions(key: string): T[] | undefined;
52
+ keys(): string[];
53
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
54
+ /**
55
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
56
+ */
57
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
58
+ protected onDisconnect(): void;
59
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
60
+ private readAtomic;
61
+ /**
62
+ * Process an inbound write op
63
+ * @param key - Key that was written to
64
+ * @param value - Incoming value
65
+ * @param refSeq - RefSeq at the time of write on the remote client
66
+ * @param sequenceNumber - Sequence Number of this write op
67
+ * @param local - Did this write originate on this client
68
+ */
69
+ private processInboundWrite;
70
+ private stringify;
71
+ private parse;
72
+ protected applyStashedOp(): () => void;
73
+ }
74
+
75
+ /**
76
+ * The factory that defines the consensus queue.
77
+ * @alpha
78
+ */
79
+ export declare class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {
80
+ static Type: string;
81
+ static readonly Attributes: IChannelAttributes;
82
+ get type(): string;
83
+ get attributes(): IChannelAttributes;
84
+ /**
85
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
86
+ */
87
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
88
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
89
+ }
90
+
91
+ /**
92
+ * A distributed data structure that holds a set of registers with update
93
+ * versions. On concurrent updates, a register internally stores all possible versions of a value by using reference
94
+ * sequence number of the incoming update.
95
+ *
96
+ * Using all the stored versions, we can then distinguish amongst different read policies. Below are the policies
97
+ * we support:
98
+ *
99
+ * Atomic: Atomicity requires a linearizable register. A linearizable register behaves as if there is only a single
100
+ * copy of the data, and that every operation appears to take effect atomically at one point in time. This definition
101
+ * implies that operations are executed in an well-defined order. On a concurrent update, we perform a compare-and-set
102
+ * operation, where we compare a register sequence number with the incoming reference sequence number.
103
+ * The earliest operation overwriting prior sequence numbers wins since every client reaches to an agreement on
104
+ * the value. So we can safely return the first value.
105
+ *
106
+ * LWW: The last write to a key always wins.
107
+ * @alpha
108
+ */
109
+ export declare interface IConsensusRegisterCollection<T = any> extends ISharedObject<IConsensusRegisterCollectionEvents> {
110
+ /**
111
+ * Attempts to write a register with a value. Returns a promise to indicate the roundtrip completion.
112
+ * For a non existent register, it will attempt to create a new register with the specified value.
113
+ *
114
+ * @returns Promise<true> if write was non-concurrent
115
+ */
116
+ write(key: string, value: T): Promise<boolean>;
117
+ /**
118
+ * Retrieves the agreed upon value for the register based on policy. Returns undefined if not present.
119
+ */
120
+ read(key: string, policy?: ReadPolicy): T | undefined;
121
+ /**
122
+ * Retrives all concurrent versions. Undefined if not present.
123
+ */
124
+ readVersions(key: string): T[] | undefined;
125
+ /**
126
+ * Returns the keys.
127
+ */
128
+ keys(): string[];
129
+ }
130
+
131
+ /**
132
+ * Events emitted by {@link IConsensusRegisterCollection}.
133
+ * @alpha
134
+ */
135
+ export declare interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents {
136
+ (event: "atomicChanged" | "versionChanged", listener: (key: string, value: any, local: boolean) => void): any;
137
+ }
138
+
139
+ /**
140
+ * Consensus Register Collection channel factory interface
141
+ *
142
+ * Extends the base IChannelFactory to return a more definite type of IConsensusRegisterCollection
143
+ * Use for the runtime to create and load distributed data structure by type name of each channel.
144
+ * @alpha
145
+ */
146
+ export declare interface IConsensusRegisterCollectionFactory extends IChannelFactory {
147
+ /**
148
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
149
+ */
150
+ load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
151
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
152
+ }
153
+
154
+ /**
155
+ * Read policies used when reading the map value.
156
+ * @alpha
157
+ */
158
+ export declare enum ReadPolicy {
159
+ Atomic = 0,
160
+ LWW = 1
161
+ }
162
+
163
+ export { }
@@ -0,0 +1,25 @@
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: ConsensusRegisterCollection */
14
+
15
+ /* Excluded from this release type: ConsensusRegisterCollectionFactory */
16
+
17
+ /* Excluded from this release type: IConsensusRegisterCollection */
18
+
19
+ /* Excluded from this release type: IConsensusRegisterCollectionEvents */
20
+
21
+ /* Excluded from this release type: IConsensusRegisterCollectionFactory */
22
+
23
+ /* Excluded from this release type: ReadPolicy */
24
+
25
+ export { }
@@ -0,0 +1,25 @@
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: ConsensusRegisterCollection */
14
+
15
+ /* Excluded from this release type: ConsensusRegisterCollectionFactory */
16
+
17
+ /* Excluded from this release type: IConsensusRegisterCollection */
18
+
19
+ /* Excluded from this release type: IConsensusRegisterCollectionEvents */
20
+
21
+ /* Excluded from this release type: IConsensusRegisterCollectionFactory */
22
+
23
+ /* Excluded from this release type: ReadPolicy */
24
+
25
+ export { }
@@ -0,0 +1,163 @@
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
+ * {@inheritDoc IConsensusRegisterCollection}
15
+ * @alpha
16
+ */
17
+ export declare class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
18
+ /**
19
+ * Create a new consensus register collection
20
+ *
21
+ * @param runtime - data store runtime the new consensus register collection belongs to
22
+ * @param id - optional name of the consensus register collection
23
+ * @returns newly create consensus register collection (but not attached yet)
24
+ */
25
+ static create<T>(runtime: IFluidDataStoreRuntime, id?: string): ConsensusRegisterCollection<T>;
26
+ /**
27
+ * Get a factory for ConsensusRegisterCollection to register with the data store.
28
+ *
29
+ * @returns a factory that creates and load ConsensusRegisterCollection
30
+ */
31
+ static getFactory(): ConsensusRegisterCollectionFactory;
32
+ private readonly data;
33
+ /**
34
+ * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
35
+ * be provided
36
+ */
37
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
38
+ /**
39
+ * Creates a new register or writes a new value.
40
+ * Returns a promise that will resolve when the write is acked.
41
+ *
42
+ * @returns Promise<true> if write was non-concurrent
43
+ */
44
+ write(key: string, value: T): Promise<boolean>;
45
+ /**
46
+ * Returns the most recent local value of a register.
47
+ * @param key - The key to read
48
+ * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.
49
+ */
50
+ read(key: string, readPolicy?: ReadPolicy): T | undefined;
51
+ readVersions(key: string): T[] | undefined;
52
+ keys(): string[];
53
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
54
+ /**
55
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
56
+ */
57
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
58
+ protected onDisconnect(): void;
59
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
60
+ private readAtomic;
61
+ /**
62
+ * Process an inbound write op
63
+ * @param key - Key that was written to
64
+ * @param value - Incoming value
65
+ * @param refSeq - RefSeq at the time of write on the remote client
66
+ * @param sequenceNumber - Sequence Number of this write op
67
+ * @param local - Did this write originate on this client
68
+ */
69
+ private processInboundWrite;
70
+ private stringify;
71
+ private parse;
72
+ protected applyStashedOp(): () => void;
73
+ }
74
+
75
+ /**
76
+ * The factory that defines the consensus queue.
77
+ * @alpha
78
+ */
79
+ export declare class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {
80
+ static Type: string;
81
+ static readonly Attributes: IChannelAttributes;
82
+ get type(): string;
83
+ get attributes(): IChannelAttributes;
84
+ /**
85
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
86
+ */
87
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
88
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
89
+ }
90
+
91
+ /**
92
+ * A distributed data structure that holds a set of registers with update
93
+ * versions. On concurrent updates, a register internally stores all possible versions of a value by using reference
94
+ * sequence number of the incoming update.
95
+ *
96
+ * Using all the stored versions, we can then distinguish amongst different read policies. Below are the policies
97
+ * we support:
98
+ *
99
+ * Atomic: Atomicity requires a linearizable register. A linearizable register behaves as if there is only a single
100
+ * copy of the data, and that every operation appears to take effect atomically at one point in time. This definition
101
+ * implies that operations are executed in an well-defined order. On a concurrent update, we perform a compare-and-set
102
+ * operation, where we compare a register sequence number with the incoming reference sequence number.
103
+ * The earliest operation overwriting prior sequence numbers wins since every client reaches to an agreement on
104
+ * the value. So we can safely return the first value.
105
+ *
106
+ * LWW: The last write to a key always wins.
107
+ * @alpha
108
+ */
109
+ export declare interface IConsensusRegisterCollection<T = any> extends ISharedObject<IConsensusRegisterCollectionEvents> {
110
+ /**
111
+ * Attempts to write a register with a value. Returns a promise to indicate the roundtrip completion.
112
+ * For a non existent register, it will attempt to create a new register with the specified value.
113
+ *
114
+ * @returns Promise<true> if write was non-concurrent
115
+ */
116
+ write(key: string, value: T): Promise<boolean>;
117
+ /**
118
+ * Retrieves the agreed upon value for the register based on policy. Returns undefined if not present.
119
+ */
120
+ read(key: string, policy?: ReadPolicy): T | undefined;
121
+ /**
122
+ * Retrives all concurrent versions. Undefined if not present.
123
+ */
124
+ readVersions(key: string): T[] | undefined;
125
+ /**
126
+ * Returns the keys.
127
+ */
128
+ keys(): string[];
129
+ }
130
+
131
+ /**
132
+ * Events emitted by {@link IConsensusRegisterCollection}.
133
+ * @alpha
134
+ */
135
+ export declare interface IConsensusRegisterCollectionEvents extends ISharedObjectEvents {
136
+ (event: "atomicChanged" | "versionChanged", listener: (key: string, value: any, local: boolean) => void): any;
137
+ }
138
+
139
+ /**
140
+ * Consensus Register Collection channel factory interface
141
+ *
142
+ * Extends the base IChannelFactory to return a more definite type of IConsensusRegisterCollection
143
+ * Use for the runtime to create and load distributed data structure by type name of each channel.
144
+ * @alpha
145
+ */
146
+ export declare interface IConsensusRegisterCollectionFactory extends IChannelFactory {
147
+ /**
148
+ * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}
149
+ */
150
+ load(document: IFluidDataStoreRuntime, id: string, services: IChannelServices, attributes: IChannelAttributes): Promise<IConsensusRegisterCollection>;
151
+ create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection;
152
+ }
153
+
154
+ /**
155
+ * Read policies used when reading the map value.
156
+ * @alpha
157
+ */
158
+ export declare enum ReadPolicy {
159
+ Atomic = 0,
160
+ LWW = 1
161
+ }
162
+
163
+ export { }
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.38.3"
9
+ }
10
+ ]
11
+ }
@@ -6,10 +6,11 @@ import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions"
6
6
  import { IChannelAttributes, IFluidDataStoreRuntime, IChannelStorageService } from "@fluidframework/datastore-definitions";
7
7
  import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
8
8
  import { IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base";
9
- import { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory";
10
- import { IConsensusRegisterCollection, ReadPolicy, IConsensusRegisterCollectionEvents } from "./interfaces";
9
+ import { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory.mjs";
10
+ import { IConsensusRegisterCollection, ReadPolicy, IConsensusRegisterCollectionEvents } from "./interfaces.mjs";
11
11
  /**
12
- * Implementation of a consensus register collection
12
+ * {@inheritDoc IConsensusRegisterCollection}
13
+ * @alpha
13
14
  */
14
15
  export declare class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
15
16
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consensusRegisterCollection.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,yBAAyB,EAAe,MAAM,sCAAsC;OACtF,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,uCAAuC;OACvC,EAAE,qBAAqB,EAAE,MAAM,qCAAqC;OACpE,EAEN,gBAAgB,EAChB,YAAY,EACZ,MAAM,oCAAoC;OACpC,EAAE,kCAAkC,EAAE;OACtC,EACN,4BAA4B,EAC5B,UAAU,EACV,kCAAkC,EAClC;AAoED;;;GAGG;AACH,qBAAa,2BAA2B,CAAC,CAAC,CACzC,SAAQ,YAAY,CAAC,kCAAkC,CACvD,YAAW,4BAA4B,CAAC,CAAC,CAAC;IAE1C;;;;;;OAMG;WACW,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM;IAOpE;;;;OAIG;WACW,UAAU;IAIxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoC;IAEzD;;;OAGG;gBAEF,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB;IAK/B;;;;;OAKG;IACU,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAwB3D;;;;OAIG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,GAAE,UAA8B,GAAG,CAAC,GAAG,SAAS;IAe5E,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,SAAS;IAK1C,IAAI,IAAI,MAAM,EAAE;IAIvB,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;IAS5E;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAexE,SAAS,CAAC,YAAY;IAEtB,SAAS,CAAC,WAAW,CACpB,OAAO,EAAE,yBAAyB,EAClC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,OAAO;IA0CzB,OAAO,CAAC,UAAU;IAKlB;;;;;;;OAOG;IACH,OAAO,CAAC,mBAAmB;IA2D3B,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,KAAK;IAIb,SAAS,CAAC,cAAc;CAIxB"}
@@ -2,11 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert, bufferToString, unreachableCase } from "@fluidframework/common-utils";
5
+ import { bufferToString } from "@fluid-internal/client-utils";
6
+ import { assert, unreachableCase } from "@fluidframework/core-utils";
6
7
  import { MessageType } from "@fluidframework/protocol-definitions";
7
- import { createSingleBlobSummary, SharedObject } from "@fluidframework/shared-object-base";
8
- import { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory";
9
- import { ReadPolicy } from "./interfaces";
8
+ import { createSingleBlobSummary, SharedObject, } from "@fluidframework/shared-object-base";
9
+ import { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory.mjs";
10
+ import { ReadPolicy, } from "./interfaces.mjs";
10
11
  const newLocalRegister = (sequenceNumber, value) => ({
11
12
  sequenceNumber,
12
13
  value: {
@@ -18,17 +19,10 @@ const newLocalRegister = (sequenceNumber, value) => ({
18
19
  const incomingOpMatchesCurrentFormat = (op) => "serializedValue" in op;
19
20
  const snapshotFileName = "header";
20
21
  /**
21
- * Implementation of a consensus register collection
22
+ * {@inheritDoc IConsensusRegisterCollection}
23
+ * @alpha
22
24
  */
23
25
  export class ConsensusRegisterCollection extends SharedObject {
24
- /**
25
- * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
26
- * be provided
27
- */
28
- constructor(id, runtime, attributes) {
29
- super(id, runtime, attributes, "fluid_consensusRegisterCollection_");
30
- this.data = new Map();
31
- }
32
26
  /**
33
27
  * Create a new consensus register collection
34
28
  *
@@ -36,7 +30,6 @@ export class ConsensusRegisterCollection extends SharedObject {
36
30
  * @param id - optional name of the consensus register collection
37
31
  * @returns newly create consensus register collection (but not attached yet)
38
32
  */
39
- // eslint-disable-next-line @typescript-eslint/no-shadow
40
33
  static create(runtime, id) {
41
34
  return runtime.createChannel(id, ConsensusRegisterCollectionFactory.Type);
42
35
  }
@@ -48,6 +41,14 @@ export class ConsensusRegisterCollection extends SharedObject {
48
41
  static getFactory() {
49
42
  return new ConsensusRegisterCollectionFactory();
50
43
  }
44
+ /**
45
+ * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will
46
+ * be provided
47
+ */
48
+ constructor(id, runtime, attributes) {
49
+ super(id, runtime, attributes, "fluid_consensusRegisterCollection_");
50
+ this.data = new Map();
51
+ }
51
52
  /**
52
53
  * Creates a new register or writes a new value.
53
54
  * Returns a promise that will resolve when the write is acked.
@@ -92,28 +93,27 @@ export class ConsensusRegisterCollection extends SharedObject {
92
93
  }
93
94
  readVersions(key) {
94
95
  const data = this.data.get(key);
95
- return data === null || data === void 0 ? void 0 : data.versions.map((element) => element.value.value);
96
+ return data?.versions.map((element) => element.value.value);
96
97
  }
97
98
  keys() {
98
99
  return [...this.data.keys()];
99
100
  }
100
101
  summarizeCore(serializer) {
101
102
  const dataObj = {};
102
- this.data.forEach((v, k) => { dataObj[k] = v; });
103
+ this.data.forEach((v, k) => {
104
+ dataObj[k] = v;
105
+ });
103
106
  return createSingleBlobSummary(snapshotFileName, this.stringify(dataObj, serializer));
104
107
  }
105
108
  /**
106
109
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
107
110
  */
108
111
  async loadCore(storage) {
109
- var _a;
110
112
  const blob = await storage.readBlob(snapshotFileName);
111
113
  const header = bufferToString(blob, "utf8");
112
114
  const dataObj = this.parse(header, this.serializer);
113
115
  for (const key of Object.keys(dataObj)) {
114
- assert(((_a = dataObj[key].atomic) === null || _a === void 0 ? void 0 : _a.value.type) !== "Shared",
115
- // eslint-disable-next-line max-len
116
- 0x06d /* "SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17" */);
116
+ assert(dataObj[key].atomic?.value.type !== "Shared", 0x06d /* "SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17" */);
117
117
  this.data.set(key, dataObj[key]);
118
118
  }
119
119
  }
@@ -143,13 +143,14 @@ export class ConsensusRegisterCollection extends SharedObject {
143
143
  }
144
144
  break;
145
145
  }
146
- default: unreachableCase(op.type);
146
+ default:
147
+ unreachableCase(op.type);
147
148
  }
148
149
  }
149
150
  }
150
151
  readAtomic(key) {
151
152
  const data = this.data.get(key);
152
- return data === null || data === void 0 ? void 0 : data.atomic.value.value;
153
+ return data?.atomic.value.value;
153
154
  }
154
155
  /**
155
156
  * Process an inbound write op
@@ -190,7 +191,9 @@ export class ConsensusRegisterCollection extends SharedObject {
190
191
  assert(refSeq === 0 && sequenceNumber === 0, 0x070 /* "sequence numbers are expected to be 0 when unattached" */);
191
192
  }
192
193
  else if (data.versions.length > 0) {
193
- assert(sequenceNumber > data.versions[data.versions.length - 1].sequenceNumber, 0x071 /* "Versions should naturally be ordered by sequenceNumber" */);
194
+ assert(
195
+ // seqNum should always be increasing, except for the case of grouped batches (seqNum will be the same)
196
+ sequenceNumber >= data.versions[data.versions.length - 1].sequenceNumber, 0x071 /* "Versions should naturally be ordered by sequenceNumber" */);
194
197
  }
195
198
  // Push the new element.
196
199
  data.versions.push(versionUpdate);
@@ -205,7 +208,6 @@ export class ConsensusRegisterCollection extends SharedObject {
205
208
  return serializer.stringify(value, this.handle);
206
209
  }
207
210
  parse(content, serializer) {
208
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
209
211
  return serializer.parse(content);
210
212
  }
211
213
  applyStashedOp() {
@@ -213,4 +215,4 @@ export class ConsensusRegisterCollection extends SharedObject {
213
215
  return () => { };
214
216
  }
215
217
  }
216
- //# sourceMappingURL=consensusRegisterCollection.js.map
218
+ //# sourceMappingURL=consensusRegisterCollection.mjs.map