@fluidframework/register-collection 2.0.0-dev-rc.2.0.0.246488 → 2.0.0-dev-rc.3.0.0.250606
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.
- package/dist/consensusRegisterCollectionFactory.d.ts +1 -1
- package/dist/consensusRegisterCollectionFactory.d.ts.map +1 -1
- package/dist/consensusRegisterCollectionFactory.js.map +1 -1
- package/dist/interfaces.d.ts +1 -1
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/interfaces.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/lib/consensusRegisterCollectionFactory.d.ts +1 -1
- package/lib/consensusRegisterCollectionFactory.d.ts.map +1 -1
- package/lib/consensusRegisterCollectionFactory.js.map +1 -1
- package/lib/interfaces.d.ts +1 -1
- package/lib/interfaces.d.ts.map +1 -1
- package/lib/interfaces.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/test/consensusRegisterCollection.spec.js +1 -1
- package/lib/test/consensusRegisterCollection.spec.js.map +1 -1
- package/package.json +19 -16
- package/src/consensusRegisterCollectionFactory.ts +1 -1
- package/src/interfaces.ts +2 -2
- package/src/packageVersion.ts +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IChannelAttributes,
|
|
5
|
+
import { IChannelAttributes, IChannelServices, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
6
6
|
import { IConsensusRegisterCollection, IConsensusRegisterCollectionFactory } from "./interfaces.js";
|
|
7
7
|
/**
|
|
8
8
|
* The factory that defines the consensus queue.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consensusRegisterCollectionFactory.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"consensusRegisterCollectionFactory.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,iBAAiB,CAAC;AAGpG;;;GAGG;AACH,qBAAa,kCAAmC,YAAW,mCAAmC;IAC7F,OAAc,IAAI,SAAqE;IAEvF,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF,IAAW,IAAI,WAEd;IAED,IAAW,UAAU,uBAEpB;IAED;;OAEG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,4BAA4B,CAAC;IAMjC,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,4BAA4B;CASzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consensusRegisterCollectionFactory.js","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,qFAA+E;AAE/E,2DAAiD;AAEjD;;;GAGG;AACH,MAAa,kCAAkC;IAS9C,IAAW,IAAI;QACd,OAAO,kCAAkC,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,kCAAkC,CAAC,UAAU,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,UAAU,GAAG,IAAI,4DAA2B,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC5E,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,UAAU,GAAG,IAAI,4DAA2B,CACjD,EAAE,EACF,QAAQ,EACR,kCAAkC,CAAC,UAAU,CAC7C,CAAC;QACF,UAAU,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACnB,CAAC;;AAvCF,gFAwCC;AAvCc,uCAAI,GAAG,iEAAiE,CAAC;AAEhE,6CAAU,GAAuB;IACvD,IAAI,EAAE,kCAAkC,CAAC,IAAI;IAC7C,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,8BAAU;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\
|
|
1
|
+
{"version":3,"file":"consensusRegisterCollectionFactory.js","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,qFAA+E;AAE/E,2DAAiD;AAEjD;;;GAGG;AACH,MAAa,kCAAkC;IAS9C,IAAW,IAAI;QACd,OAAO,kCAAkC,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,kCAAkC,CAAC,UAAU,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,UAAU,GAAG,IAAI,4DAA2B,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC5E,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,UAAU,GAAG,IAAI,4DAA2B,CACjD,EAAE,EACF,QAAQ,EACR,kCAAkC,CAAC,UAAU,CAC7C,CAAC;QACF,UAAU,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACnB,CAAC;;AAvCF,gFAwCC;AAvCc,uCAAI,GAAG,iEAAiE,CAAC;AAEhE,6CAAU,GAAuB;IACvD,IAAI,EAAE,kCAAkC,CAAC,IAAI;IAC7C,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,8BAAU;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\tIChannelServices,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { ConsensusRegisterCollection } from \"./consensusRegisterCollection.js\";\nimport { IConsensusRegisterCollection, IConsensusRegisterCollectionFactory } from \"./interfaces.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * The factory that defines the consensus queue.\n * @alpha\n */\nexport class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {\n\tpublic static Type = \"https://graph.microsoft.com/types/consensus-register-collection\";\n\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: ConsensusRegisterCollectionFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic get type() {\n\t\treturn ConsensusRegisterCollectionFactory.Type;\n\t}\n\n\tpublic get attributes() {\n\t\treturn ConsensusRegisterCollectionFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<IConsensusRegisterCollection> {\n\t\tconst collection = new ConsensusRegisterCollection(id, runtime, attributes);\n\t\tawait collection.load(services);\n\t\treturn collection;\n\t}\n\n\tpublic create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection {\n\t\tconst collection = new ConsensusRegisterCollection(\n\t\t\tid,\n\t\t\tdocument,\n\t\t\tConsensusRegisterCollectionFactory.Attributes,\n\t\t);\n\t\tcollection.initializeLocal();\n\t\treturn collection;\n\t}\n}\n"]}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { IChannelAttributes, IChannelFactory, IChannelServices, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
6
6
|
import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
|
|
7
7
|
/**
|
|
8
8
|
* Consensus Register Collection channel factory interface
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,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,EA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Content":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\
|
|
1
|
+
{"version":3,"file":"interfaces.js","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\tIChannelAttributes,\n\tIChannelFactory,\n\tIChannelServices,\n\tIFluidDataStoreRuntime,\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"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -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 = "2.0.0-dev-rc.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-dev-rc.3.0.0.250606";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -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 = "2.0.0-dev-rc.
|
|
11
|
+
exports.pkgVersion = "2.0.0-dev-rc.3.0.0.250606";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","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
|
+
{"version":3,"file":"packageVersion.js","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.3.0.0.250606\";\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IChannelAttributes,
|
|
5
|
+
import { IChannelAttributes, IChannelServices, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
6
6
|
import { IConsensusRegisterCollection, IConsensusRegisterCollectionFactory } from "./interfaces.js";
|
|
7
7
|
/**
|
|
8
8
|
* The factory that defines the consensus queue.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consensusRegisterCollectionFactory.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,
|
|
1
|
+
{"version":3,"file":"consensusRegisterCollectionFactory.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,4BAA4B,EAAE,mCAAmC,EAAE,MAAM,iBAAiB,CAAC;AAGpG;;;GAGG;AACH,qBAAa,kCAAmC,YAAW,mCAAmC;IAC7F,OAAc,IAAI,SAAqE;IAEvF,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF,IAAW,IAAI,WAEd;IAED,IAAW,UAAU,uBAEpB;IAED;;OAEG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,4BAA4B,CAAC;IAMjC,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,4BAA4B;CASzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consensusRegisterCollectionFactory.js","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,MAAM,OAAO,kCAAkC;IAS9C,IAAW,IAAI;QACd,OAAO,kCAAkC,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,kCAAkC,CAAC,UAAU,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,UAAU,GAAG,IAAI,2BAA2B,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC5E,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,UAAU,GAAG,IAAI,2BAA2B,CACjD,EAAE,EACF,QAAQ,EACR,kCAAkC,CAAC,UAAU,CAC7C,CAAC;QACF,UAAU,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACnB,CAAC;;AAtCa,uCAAI,GAAG,iEAAiE,CAAC;AAEhE,6CAAU,GAAuB;IACvD,IAAI,EAAE,kCAAkC,CAAC,IAAI;IAC7C,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,UAAU;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\
|
|
1
|
+
{"version":3,"file":"consensusRegisterCollectionFactory.js","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD;;;GAGG;AACH,MAAM,OAAO,kCAAkC;IAS9C,IAAW,IAAI;QACd,OAAO,kCAAkC,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IAAW,UAAU;QACpB,OAAO,kCAAkC,CAAC,UAAU,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI,CAChB,OAA+B,EAC/B,EAAU,EACV,QAA0B,EAC1B,UAA8B;QAE9B,MAAM,UAAU,GAAG,IAAI,2BAA2B,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC5E,MAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,MAAM,CAAC,QAAgC,EAAE,EAAU;QACzD,MAAM,UAAU,GAAG,IAAI,2BAA2B,CACjD,EAAE,EACF,QAAQ,EACR,kCAAkC,CAAC,UAAU,CAC7C,CAAC;QACF,UAAU,CAAC,eAAe,EAAE,CAAC;QAC7B,OAAO,UAAU,CAAC;IACnB,CAAC;;AAtCa,uCAAI,GAAG,iEAAiE,CAAC;AAEhE,6CAAU,GAAuB;IACvD,IAAI,EAAE,kCAAkC,CAAC,IAAI;IAC7C,qBAAqB,EAAE,KAAK;IAC5B,cAAc,EAAE,UAAU;CAC1B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\tIChannelServices,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { ConsensusRegisterCollection } from \"./consensusRegisterCollection.js\";\nimport { IConsensusRegisterCollection, IConsensusRegisterCollectionFactory } from \"./interfaces.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * The factory that defines the consensus queue.\n * @alpha\n */\nexport class ConsensusRegisterCollectionFactory implements IConsensusRegisterCollectionFactory {\n\tpublic static Type = \"https://graph.microsoft.com/types/consensus-register-collection\";\n\n\tpublic static readonly Attributes: IChannelAttributes = {\n\t\ttype: ConsensusRegisterCollectionFactory.Type,\n\t\tsnapshotFormatVersion: \"0.1\",\n\t\tpackageVersion: pkgVersion,\n\t};\n\n\tpublic get type() {\n\t\treturn ConsensusRegisterCollectionFactory.Type;\n\t}\n\n\tpublic get attributes() {\n\t\treturn ConsensusRegisterCollectionFactory.Attributes;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/datastore-definitions#IChannelFactory.load}\n\t */\n\tpublic async load(\n\t\truntime: IFluidDataStoreRuntime,\n\t\tid: string,\n\t\tservices: IChannelServices,\n\t\tattributes: IChannelAttributes,\n\t): Promise<IConsensusRegisterCollection> {\n\t\tconst collection = new ConsensusRegisterCollection(id, runtime, attributes);\n\t\tawait collection.load(services);\n\t\treturn collection;\n\t}\n\n\tpublic create(document: IFluidDataStoreRuntime, id: string): IConsensusRegisterCollection {\n\t\tconst collection = new ConsensusRegisterCollection(\n\t\t\tid,\n\t\t\tdocument,\n\t\t\tConsensusRegisterCollectionFactory.Attributes,\n\t\t);\n\t\tcollection.initializeLocal();\n\t\treturn collection;\n\t}\n}\n"]}
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { IChannelAttributes, IChannelFactory, IChannelServices, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
|
|
6
6
|
import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
|
|
7
7
|
/**
|
|
8
8
|
* Consensus Register Collection channel factory interface
|
package/lib/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kB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lib/interfaces.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsFH;;;GAGG;AACH,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACrB,mFAAmF;IACnF,+CAAM,CAAA;IAEN,2DAA2D;IAC3D,yCAAG,CAAA;AACJ,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsFH;;;GAGG;AACH,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACrB,mFAAmF;IACnF,+CAAM,CAAA;IAEN,2DAA2D;IAC3D,yCAAG,CAAA;AACJ,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIChannelAttributes,\n\tIChannelFactory,\n\tIChannelServices,\n\tIFluidDataStoreRuntime,\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"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -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 = "2.0.0-dev-rc.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-dev-rc.3.0.0.250606";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -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/register-collection";
|
|
8
|
-
export const pkgVersion = "2.0.0-dev-rc.
|
|
8
|
+
export const pkgVersion = "2.0.0-dev-rc.3.0.0.250606";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qCAAqC,CAAC;AAC7D,MAAM,CAAC,MAAM,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
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,qCAAqC,CAAC;AAC7D,MAAM,CAAC,MAAM,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.3.0.0.250606\";\n"]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { strict as assert } from "assert";
|
|
6
|
-
import { BlobTreeEntry } from "@fluidframework/driver-utils";
|
|
7
6
|
import { runGCTests } from "@fluid-private/test-dds-utils";
|
|
7
|
+
import { BlobTreeEntry } from "@fluidframework/driver-utils";
|
|
8
8
|
import { MockContainerRuntimeFactory, MockContainerRuntimeFactoryForReconnection, MockEmptyDeltaConnection, MockFluidDataStoreRuntime, MockStorage, } from "@fluidframework/test-runtime-utils";
|
|
9
9
|
import { ConsensusRegisterCollectionFactory } from "../consensusRegisterCollectionFactory.js";
|
|
10
10
|
function createConnectedCollection(id, runtimeFactory) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consensusRegisterCollection.spec.js","sourceRoot":"","sources":["../../src/test/consensusRegisterCollection.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAmB,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EACN,2BAA2B,EAC3B,0CAA0C,EAE1C,wBAAwB,EACxB,yBAAyB,EACzB,WAAW,GACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAG9F,SAAS,yBAAyB,CAAC,EAAU,EAAE,cAA2C;IACzF,MAAM,gBAAgB,GAAG,IAAI,yBAAyB,EAAE,CAAC;IACzD,cAAc,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IACxD,MAAM,Q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IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;gBACjE,sDAAsD;gBACtD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CACjD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,aAAa,CAAC,YAAY,CAC/C,CAAC;YACH,CAAC;YAEM,KAAK,CAAC,gBAAgB;gBAC5B,MAAM,gBAAgB,GAAG,iBAAiB,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBACtE,MAAM,gBAAgB,GAAG,iBAAiB,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBACtE,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;gBACnE,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;gBACnE,MAAM,gBAAgB,GAAG;oBACxB,iBAAiB,EAAE,kBAAkB,CAAC,MAAM;oBAC5C,SAAS,EAAE;wBACV,iBAAiB,EAAE,kBAAkB,CAAC,MAAM;qBAC5C;iBACD,CAAC;gBACF,MAAM,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;gBAClE,IAAI,CAAC,eAAe,CAAC,IAAI,CACxB,kBAAkB,CAAC,MAAM,CAAC,YAAY,EACtC,kBAAkB,CAAC,MAAM,CAAC,YAAY,CACtC,CAAC;YACH,CAAC;SACD;QAED,UAAU,CAAC,8BAA8B,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { BlobTreeEntry } from \"@fluidframework/driver-utils\";\nimport { ISummaryBlob, ITree } from \"@fluidframework/protocol-definitions\";\nimport { IGCTestProvider, runGCTests } from \"@fluid-private/test-dds-utils\";\nimport {\n\tMockContainerRuntimeFactory,\n\tMockContainerRuntimeFactoryForReconnection,\n\tMockContainerRuntimeForReconnection,\n\tMockEmptyDeltaConnection,\n\tMockFluidDataStoreRuntime,\n\tMockStorage,\n} from \"@fluidframework/test-runtime-utils\";\nimport { ConsensusRegisterCollectionFactory } from \"../consensusRegisterCollectionFactory.js\";\nimport { IConsensusRegisterCollection } from \"../interfaces.js\";\n\nfunction createConnectedCollection(id: string, runtimeFactory: MockContainerRuntimeFactory) {\n\tconst dataStoreRuntime = new MockFluidDataStoreRuntime();\n\truntimeFactory.createContainerRuntime(dataStoreRuntime);\n\tconst services = {\n\t\tdeltaConnection: dataStoreRuntime.createDeltaConnection(),\n\t\tobjectStorage: new MockStorage(),\n\t};\n\n\tconst crcFactory = new ConsensusRegisterCollectionFactory();\n\tconst collection = crcFactory.create(dataStoreRuntime, id);\n\tcollection.connect(services);\n\treturn collection;\n}\n\nfunction createLocalCollection(id: string) {\n\tconst factory = new ConsensusRegisterCollectionFactory();\n\treturn factory.create(new MockFluidDataStoreRuntime(), id);\n}\n\nfunction createCollectionForReconnection(\n\tid: string,\n\truntimeFactory: MockContainerRuntimeFactoryForReconnection,\n) {\n\tconst dataStoreRuntime = new MockFluidDataStoreRuntime();\n\tconst containerRuntime = runtimeFactory.createContainerRuntime(dataStoreRuntime);\n\tconst services = {\n\t\tdeltaConnection: dataStoreRuntime.createDeltaConnection(),\n\t\tobjectStorage: new MockStorage(),\n\t};\n\n\tconst crcFactory = new ConsensusRegisterCollectionFactory();\n\tconst collection = crcFactory.create(dataStoreRuntime, id);\n\tcollection.connect(services);\n\treturn { collection, containerRuntime };\n}\n\ndescribe(\"ConsensusRegisterCollection\", () => {\n\tdescribe(\"Single connected client\", () => {\n\t\tconst collectionId = \"consensus-register-collection\";\n\t\tlet crc: IConsensusRegisterCollection;\n\t\tlet containerRuntimeFactory: MockContainerRuntimeFactory;\n\n\t\tbeforeEach(() => {\n\t\t\tcontainerRuntimeFactory = new MockContainerRuntimeFactory();\n\t\t\tcrc = createConnectedCollection(collectionId, containerRuntimeFactory);\n\t\t});\n\n\t\tasync function writeAndProcessMsg(key: string, value: any) {\n\t\t\tconst waitP = crc.write(key, value);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\treturn waitP;\n\t\t}\n\n\t\tdescribe(\"API\", () => {\n\t\t\tit(\"Can create a collection\", () => {\n\t\t\t\tassert.ok(crc);\n\t\t\t});\n\n\t\t\tit(\"Can add and remove data\", async () => {\n\t\t\t\tassert.strictEqual(crc.read(\"key1\"), undefined);\n\t\t\t\tconst writeResult = await writeAndProcessMsg(\"key1\", \"val1\");\n\t\t\t\tassert.strictEqual(crc.read(\"key1\"), \"val1\");\n\t\t\t\tassert.strictEqual(writeResult, true, \"No concurrency expected\");\n\t\t\t});\n\n\t\t\tit(\"Can add and remove a handle\", async () => {\n\t\t\t\tassert.strictEqual(crc.read(\"key1\"), undefined);\n\t\t\t\tconst handle = crc.handle;\n\t\t\t\tif (handle === undefined) {\n\t\t\t\t\tassert.fail(\"Need an actual handle to test this case\");\n\t\t\t\t}\n\t\t\t\tconst writeResult = await writeAndProcessMsg(\"key1\", handle);\n\t\t\t\tconst readValue = crc.read(\"key1\");\n\t\t\t\tassert.strictEqual(readValue.absolutePath, handle.absolutePath);\n\t\t\t\tassert.strictEqual(writeResult, true, \"No concurrency expected\");\n\t\t\t});\n\n\t\t\tit(\"Change events emit the right key/value\", async () => {\n\t\t\t\tcrc.on(\"atomicChanged\", (key: string, value: any, local: boolean) => {\n\t\t\t\t\tassert.strictEqual(key, \"key1\", \"atomicChanged event emitted the wrong key\");\n\t\t\t\t\tassert.strictEqual(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\"val1\",\n\t\t\t\t\t\t\"atomicChanged event emitted the wrong value\",\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t\tcrc.on(\"versionChanged\", (key: string, value: any, local: boolean) => {\n\t\t\t\t\tassert.strictEqual(key, \"key1\", \"versionChanged event emitted the wrong key\");\n\t\t\t\t\tassert.strictEqual(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\"val1\",\n\t\t\t\t\t\t\"versionChanged event emitted the wrong value\",\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t\tawait writeAndProcessMsg(\"key1\", \"val1\");\n\t\t\t});\n\t\t});\n\n\t\tdescribe(\"Summary\", () => {\n\t\t\tconst snapshotFileName = \"header\";\n\t\t\tconst expectedSerialization = JSON.stringify({\n\t\t\t\tkey1: {\n\t\t\t\t\tatomic: { sequenceNumber: 1, value: { type: \"Plain\", value: \"val1.1\" } },\n\t\t\t\t\tversions: [{ sequenceNumber: 1, value: { type: \"Plain\", value: \"val1.1\" } }],\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst legacySharedObjectSerialization = JSON.stringify({\n\t\t\t\tkey1: {\n\t\t\t\t\tatomic: { sequenceNumber: 1, value: { type: \"Shared\", value: \"sharedObjId\" } },\n\t\t\t\t\tversions: [\n\t\t\t\t\t\t{ sequenceNumber: 1, value: { type: \"Shared\", value: \"sharedObjId\" } },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst buildTree = (serialized: string) => ({\n\t\t\t\tentries: [new BlobTreeEntry(snapshotFileName, serialized)],\n\t\t\t});\n\n\t\t\tit(\"summarize\", async () => {\n\t\t\t\tawait writeAndProcessMsg(\"key1\", \"val1.1\");\n\t\t\t\tconst summaryTree = crc.getAttachSummary().summary;\n\t\t\t\tassert(\n\t\t\t\t\tObject.keys(summaryTree.tree).length === 1,\n\t\t\t\t\t\"summarize should return a tree with single blob\",\n\t\t\t\t);\n\t\t\t\tconst serialized = (summaryTree.tree.header as ISummaryBlob)?.content as string;\n\t\t\t\tassert(serialized, \"summarize should return a tree with blob with contents\");\n\t\t\t\tassert.strictEqual(serialized, expectedSerialization);\n\t\t\t});\n\n\t\t\tit(\"load\", async () => {\n\t\t\t\tconst tree: ITree = buildTree(expectedSerialization);\n\t\t\t\tconst services = {\n\t\t\t\t\tdeltaConnection: new MockEmptyDeltaConnection(),\n\t\t\t\t\tobjectStorage: new MockStorage(tree),\n\t\t\t\t};\n\t\t\t\tconst crcFactory = new ConsensusRegisterCollectionFactory();\n\t\t\t\tconst loadedCrc = await crcFactory.load(\n\t\t\t\t\tnew MockFluidDataStoreRuntime(),\n\t\t\t\t\tcollectionId,\n\t\t\t\t\tservices,\n\t\t\t\t\tConsensusRegisterCollectionFactory.Attributes,\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(loadedCrc.read(\"key1\"), \"val1.1\");\n\t\t\t});\n\n\t\t\tit(\"load with SharedObject not supported\", async () => {\n\t\t\t\tconst tree: ITree = buildTree(legacySharedObjectSerialization);\n\t\t\t\tconst services = {\n\t\t\t\t\tdeltaConnection: new MockEmptyDeltaConnection(),\n\t\t\t\t\tobjectStorage: new MockStorage(tree),\n\t\t\t\t};\n\t\t\t\tconst crcFactory = new ConsensusRegisterCollectionFactory();\n\t\t\t\tawait assert.rejects(\n\t\t\t\t\tcrcFactory.load(\n\t\t\t\t\t\tnew MockFluidDataStoreRuntime(),\n\t\t\t\t\t\tcollectionId,\n\t\t\t\t\t\tservices,\n\t\t\t\t\t\tConsensusRegisterCollectionFactory.Attributes,\n\t\t\t\t\t),\n\t\t\t\t\t\"SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized\",\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe(\"Multiple Clients\", () => {\n\t\tdescribe(\"Local state\", () => {\n\t\t\tlet containerRuntimeFactory: MockContainerRuntimeFactory;\n\t\t\tlet testCollection1: IConsensusRegisterCollection;\n\t\t\tlet testCollection2: IConsensusRegisterCollection;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tcontainerRuntimeFactory = new MockContainerRuntimeFactoryForReconnection();\n\t\t\t\ttestCollection1 = createLocalCollection(\"collection1\");\n\t\t\t\ttestCollection2 = createLocalCollection(\"collection2\");\n\t\t\t});\n\n\t\t\tit(\"should not send ops when the collection is not connected\", async () => {\n\t\t\t\t// Add a listener to the second collection. This is used to verify that the written value reaches\n\t\t\t\t// the remote client.\n\t\t\t\tlet receivedValue: string = \"\";\n\t\t\t\ttestCollection2.on(\"atomicChanged\", (key: string, value: string) => {\n\t\t\t\t\treceivedValue = value;\n\t\t\t\t});\n\n\t\t\t\t// Write to the first register collection.\n\t\t\t\tconst testValue = \"testValue\";\n\t\t\t\tconst writeP = testCollection1.write(\"key\", testValue);\n\n\t\t\t\t// Process the messages.\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t\t// Verify that the first collection successfully writes and is the winner.\n\t\t\t\tconst winner = await writeP;\n\t\t\t\tassert.equal(winner, true, \"Write was not successful\");\n\n\t\t\t\t// Verify that the remote client does not get this write because the DDS is not connected.\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedValue,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"The remote client should not have received the write\",\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe(\"Reconnection\", () => {\n\t\t\tconst testKey: string = \"testKey\";\n\t\t\tconst testValue: string = \"testValue\";\n\t\t\tlet receivedKey: string = \"\";\n\t\t\tlet receivedValue: string = \"\";\n\t\t\tlet receivedLocalStatus: boolean = true;\n\n\t\t\tlet containerRuntimeFactory: MockContainerRuntimeFactoryForReconnection;\n\t\t\tlet containerRuntime1: MockContainerRuntimeForReconnection;\n\t\t\tlet testCollection1: IConsensusRegisterCollection;\n\t\t\tlet testCollection2: IConsensusRegisterCollection;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tcontainerRuntimeFactory = new MockContainerRuntimeFactoryForReconnection();\n\t\t\t\tconst response1 = createCollectionForReconnection(\n\t\t\t\t\t\"collection1\",\n\t\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\t);\n\t\t\t\ttestCollection1 = response1.collection;\n\t\t\t\tcontainerRuntime1 = response1.containerRuntime;\n\n\t\t\t\tconst response2 = createCollectionForReconnection(\n\t\t\t\t\t\"collection2\",\n\t\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\t);\n\t\t\t\ttestCollection2 = response2.collection;\n\n\t\t\t\t// Add a listener to the second collection. This is used to verify that the written value reaches\n\t\t\t\t// the remote client.\n\t\t\t\ttestCollection2.on(\n\t\t\t\t\t\"atomicChanged\",\n\t\t\t\t\t(key: string, value: string, local: boolean) => {\n\t\t\t\t\t\treceivedKey = key;\n\t\t\t\t\t\treceivedValue = value;\n\t\t\t\t\t\treceivedLocalStatus = local;\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit(\"can resend unacked ops on reconnection\", async () => {\n\t\t\t\t// Write to the first register collection.\n\t\t\t\tconst writeP = testCollection1.write(testKey, testValue);\n\n\t\t\t\t// Disconnect and reconnect the first collection.\n\t\t\t\tcontainerRuntime1.connected = false;\n\t\t\t\tcontainerRuntime1.connected = true;\n\n\t\t\t\t// Process the messages.\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t\t// Verify that the first collection successfully writes and is the winner.\n\t\t\t\tconst winner = await writeP;\n\t\t\t\tassert.equal(winner, true, \"Write was not successful\");\n\n\t\t\t\t// Verify that the remote register collection received the write.\n\t\t\t\tassert.equal(receivedKey, testKey, \"The remote client did not receive the key\");\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedValue,\n\t\t\t\t\ttestValue,\n\t\t\t\t\t\"The remote client did not receive the value\",\n\t\t\t\t);\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedLocalStatus,\n\t\t\t\t\tfalse,\n\t\t\t\t\t\"The remote client's value should not be local\",\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit(\"can store ops in disconnected state and resend them on reconnection\", async () => {\n\t\t\t\t// Disconnect the first collection.\n\t\t\t\tcontainerRuntime1.connected = false;\n\n\t\t\t\t// Write to the first register collection.\n\t\t\t\tconst writeP = testCollection1.write(testKey, testValue);\n\n\t\t\t\t// Reconnect the first collection.\n\t\t\t\tcontainerRuntime1.connected = true;\n\n\t\t\t\t// Process the messages.\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t\t// Verify that the first collection successfully writes and is the winner.\n\t\t\t\tconst winner = await writeP;\n\t\t\t\tassert.equal(winner, true, \"Write was not successful\");\n\n\t\t\t\t// Verify that the remote register collection received the write.\n\t\t\t\tassert.equal(receivedKey, testKey, \"The remote client did not receive the key\");\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedValue,\n\t\t\t\t\ttestValue,\n\t\t\t\t\t\"The remote client did not receive the value\",\n\t\t\t\t);\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedLocalStatus,\n\t\t\t\t\tfalse,\n\t\t\t\t\t\"The remote client's value should not be local\",\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tafterEach(() => {\n\t\t\t\treceivedKey = \"\";\n\t\t\t\treceivedValue = \"\";\n\t\t\t\treceivedLocalStatus = true;\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe(\"Garbage Collection\", () => {\n\t\tclass GCRegisteredCollectionProvider implements IGCTestProvider {\n\t\t\tprivate subCollectionCount = 0;\n\t\t\tprivate _expectedRoutes: string[] = [];\n\t\t\tprivate readonly collection1: IConsensusRegisterCollection;\n\t\t\tprivate readonly collection2: IConsensusRegisterCollection;\n\t\t\tprivate readonly containerRuntimeFactory: MockContainerRuntimeFactory;\n\n\t\t\tconstructor() {\n\t\t\t\tthis.containerRuntimeFactory = new MockContainerRuntimeFactory();\n\t\t\t\tthis.collection1 = createConnectedCollection(\n\t\t\t\t\t\"collection1\",\n\t\t\t\t\tthis.containerRuntimeFactory,\n\t\t\t\t);\n\t\t\t\tthis.collection2 = createConnectedCollection(\n\t\t\t\t\t\"collection2\",\n\t\t\t\t\tthis.containerRuntimeFactory,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tprivate async writeAndProcessMsg(key: string, value: any) {\n\t\t\t\tconst waitP = this.collection1.write(key, value);\n\t\t\t\tthis.containerRuntimeFactory.processAllMessages();\n\t\t\t\treturn waitP;\n\t\t\t}\n\n\t\t\tpublic get sharedObject() {\n\t\t\t\t// Return the remote collection because we want to verify its summary data.\n\t\t\t\treturn this.collection2;\n\t\t\t}\n\n\t\t\tpublic get expectedOutboundRoutes() {\n\t\t\t\treturn this._expectedRoutes;\n\t\t\t}\n\n\t\t\tpublic async addOutboundRoutes() {\n\t\t\t\tconst subCollectionId = `subCollection-${++this.subCollectionCount}`;\n\t\t\t\tconst subTestCollection = createLocalCollection(subCollectionId);\n\t\t\t\tawait this.writeAndProcessMsg(subCollectionId, subTestCollection.handle);\n\t\t\t\tthis._expectedRoutes.push(subTestCollection.handle.absolutePath);\n\t\t\t}\n\n\t\t\tpublic async deleteOutboundRoutes() {\n\t\t\t\tconst subCollectionId = `subCollection-${this.subCollectionCount}`;\n\t\t\t\tconst deletedHandle = this.collection1.read(subCollectionId) as IFluidHandle;\n\t\t\t\tassert(deletedHandle, \"Route must be added before deleting\");\n\n\t\t\t\t// Delete the last handle that was added.\n\t\t\t\tawait this.writeAndProcessMsg(subCollectionId, \"nonHandleValue\");\n\t\t\t\t// Remove deleted handle's route from expected routes.\n\t\t\t\tthis._expectedRoutes = this._expectedRoutes.filter(\n\t\t\t\t\t(route) => route !== deletedHandle.absolutePath,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpublic async addNestedHandles() {\n\t\t\t\tconst subCollectionId1 = `subCollection-${++this.subCollectionCount}`;\n\t\t\t\tconst subCollectionId2 = `subCollection-${++this.subCollectionCount}`;\n\t\t\t\tconst subTestCollection1 = createLocalCollection(subCollectionId1);\n\t\t\t\tconst subTestCollection2 = createLocalCollection(subCollectionId2);\n\t\t\t\tconst containingObject = {\n\t\t\t\t\tcollection1Handle: subTestCollection1.handle,\n\t\t\t\t\tnestedObj: {\n\t\t\t\t\t\tcollection2Handle: subTestCollection2.handle,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tawait this.writeAndProcessMsg(subCollectionId2, containingObject);\n\t\t\t\tthis._expectedRoutes.push(\n\t\t\t\t\tsubTestCollection1.handle.absolutePath,\n\t\t\t\t\tsubTestCollection2.handle.absolutePath,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\trunGCTests(GCRegisteredCollectionProvider);\n\t});\n});\n"]}
|
|
1
|
+
{"version":3,"file":"consensusRegisterCollection.spec.js","sourceRoot":"","sources":["../../src/test/consensusRegisterCollection.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAmB,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EACN,2BAA2B,EAC3B,0CAA0C,EAE1C,wBAAwB,EACxB,yBAAyB,EACzB,WAAW,GACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAG9F,SAAS,yBAAyB,CAAC,EAAU,EAAE,cAA2C;IACzF,MAAM,gBAAgB,GAAG,IAAI,yBAAyB,EAAE,CAAC;IACzD,cAAc,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG;QAChB,eAAe,EAAE,gBAAgB,CAAC,qBAAqB,EAAE;QACzD,aAAa,EAAE,IAAI,WAAW,EAAE;KAChC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,kCAAkC,EAAE,CAAC;IAC5D,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAC3D,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7B,OAAO,UAAU,CAAC;AACnB,CAAC;AAED,SAAS,qBAAqB,CAAC,EAAU;IACxC,MAAM,OAAO,GAAG,IAAI,kCAAkC,EAAE,CAAC;IACzD,OAAO,OAAO,CAA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qBAAqB,CAAC,gBAAgB,CAAC,CAAC;gBACnE,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;gBACnE,MAAM,gBAAgB,GAAG;oBACxB,iBAAiB,EAAE,kBAAkB,CAAC,MAAM;oBAC5C,SAAS,EAAE;wBACV,iBAAiB,EAAE,kBAAkB,CAAC,MAAM;qBAC5C;iBACD,CAAC;gBACF,MAAM,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;gBAClE,IAAI,CAAC,eAAe,CAAC,IAAI,CACxB,kBAAkB,CAAC,MAAM,CAAC,YAAY,EACtC,kBAAkB,CAAC,MAAM,CAAC,YAAY,CACtC,CAAC;YACH,CAAC;SACD;QAED,UAAU,CAAC,8BAA8B,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { IGCTestProvider, runGCTests } from \"@fluid-private/test-dds-utils\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport { BlobTreeEntry } from \"@fluidframework/driver-utils\";\nimport { ISummaryBlob, ITree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tMockContainerRuntimeFactory,\n\tMockContainerRuntimeFactoryForReconnection,\n\tMockContainerRuntimeForReconnection,\n\tMockEmptyDeltaConnection,\n\tMockFluidDataStoreRuntime,\n\tMockStorage,\n} from \"@fluidframework/test-runtime-utils\";\nimport { ConsensusRegisterCollectionFactory } from \"../consensusRegisterCollectionFactory.js\";\nimport { IConsensusRegisterCollection } from \"../interfaces.js\";\n\nfunction createConnectedCollection(id: string, runtimeFactory: MockContainerRuntimeFactory) {\n\tconst dataStoreRuntime = new MockFluidDataStoreRuntime();\n\truntimeFactory.createContainerRuntime(dataStoreRuntime);\n\tconst services = {\n\t\tdeltaConnection: dataStoreRuntime.createDeltaConnection(),\n\t\tobjectStorage: new MockStorage(),\n\t};\n\n\tconst crcFactory = new ConsensusRegisterCollectionFactory();\n\tconst collection = crcFactory.create(dataStoreRuntime, id);\n\tcollection.connect(services);\n\treturn collection;\n}\n\nfunction createLocalCollection(id: string) {\n\tconst factory = new ConsensusRegisterCollectionFactory();\n\treturn factory.create(new MockFluidDataStoreRuntime(), id);\n}\n\nfunction createCollectionForReconnection(\n\tid: string,\n\truntimeFactory: MockContainerRuntimeFactoryForReconnection,\n) {\n\tconst dataStoreRuntime = new MockFluidDataStoreRuntime();\n\tconst containerRuntime = runtimeFactory.createContainerRuntime(dataStoreRuntime);\n\tconst services = {\n\t\tdeltaConnection: dataStoreRuntime.createDeltaConnection(),\n\t\tobjectStorage: new MockStorage(),\n\t};\n\n\tconst crcFactory = new ConsensusRegisterCollectionFactory();\n\tconst collection = crcFactory.create(dataStoreRuntime, id);\n\tcollection.connect(services);\n\treturn { collection, containerRuntime };\n}\n\ndescribe(\"ConsensusRegisterCollection\", () => {\n\tdescribe(\"Single connected client\", () => {\n\t\tconst collectionId = \"consensus-register-collection\";\n\t\tlet crc: IConsensusRegisterCollection;\n\t\tlet containerRuntimeFactory: MockContainerRuntimeFactory;\n\n\t\tbeforeEach(() => {\n\t\t\tcontainerRuntimeFactory = new MockContainerRuntimeFactory();\n\t\t\tcrc = createConnectedCollection(collectionId, containerRuntimeFactory);\n\t\t});\n\n\t\tasync function writeAndProcessMsg(key: string, value: any) {\n\t\t\tconst waitP = crc.write(key, value);\n\t\t\tcontainerRuntimeFactory.processAllMessages();\n\t\t\treturn waitP;\n\t\t}\n\n\t\tdescribe(\"API\", () => {\n\t\t\tit(\"Can create a collection\", () => {\n\t\t\t\tassert.ok(crc);\n\t\t\t});\n\n\t\t\tit(\"Can add and remove data\", async () => {\n\t\t\t\tassert.strictEqual(crc.read(\"key1\"), undefined);\n\t\t\t\tconst writeResult = await writeAndProcessMsg(\"key1\", \"val1\");\n\t\t\t\tassert.strictEqual(crc.read(\"key1\"), \"val1\");\n\t\t\t\tassert.strictEqual(writeResult, true, \"No concurrency expected\");\n\t\t\t});\n\n\t\t\tit(\"Can add and remove a handle\", async () => {\n\t\t\t\tassert.strictEqual(crc.read(\"key1\"), undefined);\n\t\t\t\tconst handle = crc.handle;\n\t\t\t\tif (handle === undefined) {\n\t\t\t\t\tassert.fail(\"Need an actual handle to test this case\");\n\t\t\t\t}\n\t\t\t\tconst writeResult = await writeAndProcessMsg(\"key1\", handle);\n\t\t\t\tconst readValue = crc.read(\"key1\");\n\t\t\t\tassert.strictEqual(readValue.absolutePath, handle.absolutePath);\n\t\t\t\tassert.strictEqual(writeResult, true, \"No concurrency expected\");\n\t\t\t});\n\n\t\t\tit(\"Change events emit the right key/value\", async () => {\n\t\t\t\tcrc.on(\"atomicChanged\", (key: string, value: any, local: boolean) => {\n\t\t\t\t\tassert.strictEqual(key, \"key1\", \"atomicChanged event emitted the wrong key\");\n\t\t\t\t\tassert.strictEqual(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\"val1\",\n\t\t\t\t\t\t\"atomicChanged event emitted the wrong value\",\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t\tcrc.on(\"versionChanged\", (key: string, value: any, local: boolean) => {\n\t\t\t\t\tassert.strictEqual(key, \"key1\", \"versionChanged event emitted the wrong key\");\n\t\t\t\t\tassert.strictEqual(\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\"val1\",\n\t\t\t\t\t\t\"versionChanged event emitted the wrong value\",\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t\tawait writeAndProcessMsg(\"key1\", \"val1\");\n\t\t\t});\n\t\t});\n\n\t\tdescribe(\"Summary\", () => {\n\t\t\tconst snapshotFileName = \"header\";\n\t\t\tconst expectedSerialization = JSON.stringify({\n\t\t\t\tkey1: {\n\t\t\t\t\tatomic: { sequenceNumber: 1, value: { type: \"Plain\", value: \"val1.1\" } },\n\t\t\t\t\tversions: [{ sequenceNumber: 1, value: { type: \"Plain\", value: \"val1.1\" } }],\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst legacySharedObjectSerialization = JSON.stringify({\n\t\t\t\tkey1: {\n\t\t\t\t\tatomic: { sequenceNumber: 1, value: { type: \"Shared\", value: \"sharedObjId\" } },\n\t\t\t\t\tversions: [\n\t\t\t\t\t\t{ sequenceNumber: 1, value: { type: \"Shared\", value: \"sharedObjId\" } },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t});\n\t\t\tconst buildTree = (serialized: string) => ({\n\t\t\t\tentries: [new BlobTreeEntry(snapshotFileName, serialized)],\n\t\t\t});\n\n\t\t\tit(\"summarize\", async () => {\n\t\t\t\tawait writeAndProcessMsg(\"key1\", \"val1.1\");\n\t\t\t\tconst summaryTree = crc.getAttachSummary().summary;\n\t\t\t\tassert(\n\t\t\t\t\tObject.keys(summaryTree.tree).length === 1,\n\t\t\t\t\t\"summarize should return a tree with single blob\",\n\t\t\t\t);\n\t\t\t\tconst serialized = (summaryTree.tree.header as ISummaryBlob)?.content as string;\n\t\t\t\tassert(serialized, \"summarize should return a tree with blob with contents\");\n\t\t\t\tassert.strictEqual(serialized, expectedSerialization);\n\t\t\t});\n\n\t\t\tit(\"load\", async () => {\n\t\t\t\tconst tree: ITree = buildTree(expectedSerialization);\n\t\t\t\tconst services = {\n\t\t\t\t\tdeltaConnection: new MockEmptyDeltaConnection(),\n\t\t\t\t\tobjectStorage: new MockStorage(tree),\n\t\t\t\t};\n\t\t\t\tconst crcFactory = new ConsensusRegisterCollectionFactory();\n\t\t\t\tconst loadedCrc = await crcFactory.load(\n\t\t\t\t\tnew MockFluidDataStoreRuntime(),\n\t\t\t\t\tcollectionId,\n\t\t\t\t\tservices,\n\t\t\t\t\tConsensusRegisterCollectionFactory.Attributes,\n\t\t\t\t);\n\t\t\t\tassert.strictEqual(loadedCrc.read(\"key1\"), \"val1.1\");\n\t\t\t});\n\n\t\t\tit(\"load with SharedObject not supported\", async () => {\n\t\t\t\tconst tree: ITree = buildTree(legacySharedObjectSerialization);\n\t\t\t\tconst services = {\n\t\t\t\t\tdeltaConnection: new MockEmptyDeltaConnection(),\n\t\t\t\t\tobjectStorage: new MockStorage(tree),\n\t\t\t\t};\n\t\t\t\tconst crcFactory = new ConsensusRegisterCollectionFactory();\n\t\t\t\tawait assert.rejects(\n\t\t\t\t\tcrcFactory.load(\n\t\t\t\t\t\tnew MockFluidDataStoreRuntime(),\n\t\t\t\t\t\tcollectionId,\n\t\t\t\t\t\tservices,\n\t\t\t\t\t\tConsensusRegisterCollectionFactory.Attributes,\n\t\t\t\t\t),\n\t\t\t\t\t\"SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized\",\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe(\"Multiple Clients\", () => {\n\t\tdescribe(\"Local state\", () => {\n\t\t\tlet containerRuntimeFactory: MockContainerRuntimeFactory;\n\t\t\tlet testCollection1: IConsensusRegisterCollection;\n\t\t\tlet testCollection2: IConsensusRegisterCollection;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tcontainerRuntimeFactory = new MockContainerRuntimeFactoryForReconnection();\n\t\t\t\ttestCollection1 = createLocalCollection(\"collection1\");\n\t\t\t\ttestCollection2 = createLocalCollection(\"collection2\");\n\t\t\t});\n\n\t\t\tit(\"should not send ops when the collection is not connected\", async () => {\n\t\t\t\t// Add a listener to the second collection. This is used to verify that the written value reaches\n\t\t\t\t// the remote client.\n\t\t\t\tlet receivedValue: string = \"\";\n\t\t\t\ttestCollection2.on(\"atomicChanged\", (key: string, value: string) => {\n\t\t\t\t\treceivedValue = value;\n\t\t\t\t});\n\n\t\t\t\t// Write to the first register collection.\n\t\t\t\tconst testValue = \"testValue\";\n\t\t\t\tconst writeP = testCollection1.write(\"key\", testValue);\n\n\t\t\t\t// Process the messages.\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t\t// Verify that the first collection successfully writes and is the winner.\n\t\t\t\tconst winner = await writeP;\n\t\t\t\tassert.equal(winner, true, \"Write was not successful\");\n\n\t\t\t\t// Verify that the remote client does not get this write because the DDS is not connected.\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedValue,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"The remote client should not have received the write\",\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe(\"Reconnection\", () => {\n\t\t\tconst testKey: string = \"testKey\";\n\t\t\tconst testValue: string = \"testValue\";\n\t\t\tlet receivedKey: string = \"\";\n\t\t\tlet receivedValue: string = \"\";\n\t\t\tlet receivedLocalStatus: boolean = true;\n\n\t\t\tlet containerRuntimeFactory: MockContainerRuntimeFactoryForReconnection;\n\t\t\tlet containerRuntime1: MockContainerRuntimeForReconnection;\n\t\t\tlet testCollection1: IConsensusRegisterCollection;\n\t\t\tlet testCollection2: IConsensusRegisterCollection;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tcontainerRuntimeFactory = new MockContainerRuntimeFactoryForReconnection();\n\t\t\t\tconst response1 = createCollectionForReconnection(\n\t\t\t\t\t\"collection1\",\n\t\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\t);\n\t\t\t\ttestCollection1 = response1.collection;\n\t\t\t\tcontainerRuntime1 = response1.containerRuntime;\n\n\t\t\t\tconst response2 = createCollectionForReconnection(\n\t\t\t\t\t\"collection2\",\n\t\t\t\t\tcontainerRuntimeFactory,\n\t\t\t\t);\n\t\t\t\ttestCollection2 = response2.collection;\n\n\t\t\t\t// Add a listener to the second collection. This is used to verify that the written value reaches\n\t\t\t\t// the remote client.\n\t\t\t\ttestCollection2.on(\n\t\t\t\t\t\"atomicChanged\",\n\t\t\t\t\t(key: string, value: string, local: boolean) => {\n\t\t\t\t\t\treceivedKey = key;\n\t\t\t\t\t\treceivedValue = value;\n\t\t\t\t\t\treceivedLocalStatus = local;\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit(\"can resend unacked ops on reconnection\", async () => {\n\t\t\t\t// Write to the first register collection.\n\t\t\t\tconst writeP = testCollection1.write(testKey, testValue);\n\n\t\t\t\t// Disconnect and reconnect the first collection.\n\t\t\t\tcontainerRuntime1.connected = false;\n\t\t\t\tcontainerRuntime1.connected = true;\n\n\t\t\t\t// Process the messages.\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t\t// Verify that the first collection successfully writes and is the winner.\n\t\t\t\tconst winner = await writeP;\n\t\t\t\tassert.equal(winner, true, \"Write was not successful\");\n\n\t\t\t\t// Verify that the remote register collection received the write.\n\t\t\t\tassert.equal(receivedKey, testKey, \"The remote client did not receive the key\");\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedValue,\n\t\t\t\t\ttestValue,\n\t\t\t\t\t\"The remote client did not receive the value\",\n\t\t\t\t);\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedLocalStatus,\n\t\t\t\t\tfalse,\n\t\t\t\t\t\"The remote client's value should not be local\",\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit(\"can store ops in disconnected state and resend them on reconnection\", async () => {\n\t\t\t\t// Disconnect the first collection.\n\t\t\t\tcontainerRuntime1.connected = false;\n\n\t\t\t\t// Write to the first register collection.\n\t\t\t\tconst writeP = testCollection1.write(testKey, testValue);\n\n\t\t\t\t// Reconnect the first collection.\n\t\t\t\tcontainerRuntime1.connected = true;\n\n\t\t\t\t// Process the messages.\n\t\t\t\tcontainerRuntimeFactory.processAllMessages();\n\n\t\t\t\t// Verify that the first collection successfully writes and is the winner.\n\t\t\t\tconst winner = await writeP;\n\t\t\t\tassert.equal(winner, true, \"Write was not successful\");\n\n\t\t\t\t// Verify that the remote register collection received the write.\n\t\t\t\tassert.equal(receivedKey, testKey, \"The remote client did not receive the key\");\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedValue,\n\t\t\t\t\ttestValue,\n\t\t\t\t\t\"The remote client did not receive the value\",\n\t\t\t\t);\n\t\t\t\tassert.equal(\n\t\t\t\t\treceivedLocalStatus,\n\t\t\t\t\tfalse,\n\t\t\t\t\t\"The remote client's value should not be local\",\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tafterEach(() => {\n\t\t\t\treceivedKey = \"\";\n\t\t\t\treceivedValue = \"\";\n\t\t\t\treceivedLocalStatus = true;\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe(\"Garbage Collection\", () => {\n\t\tclass GCRegisteredCollectionProvider implements IGCTestProvider {\n\t\t\tprivate subCollectionCount = 0;\n\t\t\tprivate _expectedRoutes: string[] = [];\n\t\t\tprivate readonly collection1: IConsensusRegisterCollection;\n\t\t\tprivate readonly collection2: IConsensusRegisterCollection;\n\t\t\tprivate readonly containerRuntimeFactory: MockContainerRuntimeFactory;\n\n\t\t\tconstructor() {\n\t\t\t\tthis.containerRuntimeFactory = new MockContainerRuntimeFactory();\n\t\t\t\tthis.collection1 = createConnectedCollection(\n\t\t\t\t\t\"collection1\",\n\t\t\t\t\tthis.containerRuntimeFactory,\n\t\t\t\t);\n\t\t\t\tthis.collection2 = createConnectedCollection(\n\t\t\t\t\t\"collection2\",\n\t\t\t\t\tthis.containerRuntimeFactory,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tprivate async writeAndProcessMsg(key: string, value: any) {\n\t\t\t\tconst waitP = this.collection1.write(key, value);\n\t\t\t\tthis.containerRuntimeFactory.processAllMessages();\n\t\t\t\treturn waitP;\n\t\t\t}\n\n\t\t\tpublic get sharedObject() {\n\t\t\t\t// Return the remote collection because we want to verify its summary data.\n\t\t\t\treturn this.collection2;\n\t\t\t}\n\n\t\t\tpublic get expectedOutboundRoutes() {\n\t\t\t\treturn this._expectedRoutes;\n\t\t\t}\n\n\t\t\tpublic async addOutboundRoutes() {\n\t\t\t\tconst subCollectionId = `subCollection-${++this.subCollectionCount}`;\n\t\t\t\tconst subTestCollection = createLocalCollection(subCollectionId);\n\t\t\t\tawait this.writeAndProcessMsg(subCollectionId, subTestCollection.handle);\n\t\t\t\tthis._expectedRoutes.push(subTestCollection.handle.absolutePath);\n\t\t\t}\n\n\t\t\tpublic async deleteOutboundRoutes() {\n\t\t\t\tconst subCollectionId = `subCollection-${this.subCollectionCount}`;\n\t\t\t\tconst deletedHandle = this.collection1.read(subCollectionId) as IFluidHandle;\n\t\t\t\tassert(deletedHandle, \"Route must be added before deleting\");\n\n\t\t\t\t// Delete the last handle that was added.\n\t\t\t\tawait this.writeAndProcessMsg(subCollectionId, \"nonHandleValue\");\n\t\t\t\t// Remove deleted handle's route from expected routes.\n\t\t\t\tthis._expectedRoutes = this._expectedRoutes.filter(\n\t\t\t\t\t(route) => route !== deletedHandle.absolutePath,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpublic async addNestedHandles() {\n\t\t\t\tconst subCollectionId1 = `subCollection-${++this.subCollectionCount}`;\n\t\t\t\tconst subCollectionId2 = `subCollection-${++this.subCollectionCount}`;\n\t\t\t\tconst subTestCollection1 = createLocalCollection(subCollectionId1);\n\t\t\t\tconst subTestCollection2 = createLocalCollection(subCollectionId2);\n\t\t\t\tconst containingObject = {\n\t\t\t\t\tcollection1Handle: subTestCollection1.handle,\n\t\t\t\t\tnestedObj: {\n\t\t\t\t\t\tcollection2Handle: subTestCollection2.handle,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tawait this.writeAndProcessMsg(subCollectionId2, containingObject);\n\t\t\t\tthis._expectedRoutes.push(\n\t\t\t\t\tsubTestCollection1.handle.absolutePath,\n\t\t\t\t\tsubTestCollection2.handle.absolutePath,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\trunGCTests(GCRegisteredCollectionProvider);\n\t});\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/register-collection",
|
|
3
|
-
"version": "2.0.0-dev-rc.
|
|
3
|
+
"version": "2.0.0-dev-rc.3.0.0.250606",
|
|
4
4
|
"description": "Consensus Register",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -77,25 +77,26 @@
|
|
|
77
77
|
"temp-directory": "nyc/.nyc_output"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@fluid-internal/client-utils": "2.0.0-dev-rc.
|
|
81
|
-
"@fluidframework/core-interfaces": "2.0.0-dev-rc.
|
|
82
|
-
"@fluidframework/core-utils": "2.0.0-dev-rc.
|
|
83
|
-
"@fluidframework/datastore-definitions": "2.0.0-dev-rc.
|
|
84
|
-
"@fluidframework/driver-utils": "2.0.0-dev-rc.
|
|
80
|
+
"@fluid-internal/client-utils": "2.0.0-dev-rc.3.0.0.250606",
|
|
81
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.3.0.0.250606",
|
|
82
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.3.0.0.250606",
|
|
83
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev-rc.3.0.0.250606",
|
|
84
|
+
"@fluidframework/driver-utils": "2.0.0-dev-rc.3.0.0.250606",
|
|
85
85
|
"@fluidframework/protocol-definitions": "^3.2.0",
|
|
86
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.
|
|
87
|
-
"@fluidframework/shared-object-base": "2.0.0-dev-rc.
|
|
86
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.3.0.0.250606",
|
|
87
|
+
"@fluidframework/shared-object-base": "2.0.0-dev-rc.3.0.0.250606"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@arethetypeswrong/cli": "^0.13.3",
|
|
91
|
-
"@
|
|
92
|
-
"@fluid-
|
|
91
|
+
"@biomejs/biome": "^1.6.2",
|
|
92
|
+
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.3.0.0.250606",
|
|
93
|
+
"@fluid-private/test-dds-utils": "2.0.0-dev-rc.3.0.0.250606",
|
|
93
94
|
"@fluid-tools/build-cli": "^0.34.0",
|
|
94
95
|
"@fluidframework/build-common": "^2.0.3",
|
|
95
96
|
"@fluidframework/build-tools": "^0.34.0",
|
|
96
97
|
"@fluidframework/eslint-config-fluid": "^5.1.0",
|
|
97
98
|
"@fluidframework/register-collection-previous": "npm:@fluidframework/register-collection@2.0.0-internal.8.0.0",
|
|
98
|
-
"@fluidframework/test-runtime-utils": "2.0.0-dev-rc.
|
|
99
|
+
"@fluidframework/test-runtime-utils": "2.0.0-dev-rc.3.0.0.250606",
|
|
99
100
|
"@microsoft/api-extractor": "^7.42.3",
|
|
100
101
|
"@types/mocha": "^9.1.1",
|
|
101
102
|
"@types/node": "^18.19.0",
|
|
@@ -141,16 +142,18 @@
|
|
|
141
142
|
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
|
|
142
143
|
"build:test:esm": "tsc --project ./src/test/tsconfig.json",
|
|
143
144
|
"check:are-the-types-wrong": "attw --pack . --entrypoints .",
|
|
145
|
+
"check:biome": "biome check .",
|
|
146
|
+
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
144
147
|
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
145
148
|
"ci:build:docs": "api-extractor run",
|
|
146
149
|
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
147
150
|
"eslint": "eslint --format stylish src",
|
|
148
151
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
149
|
-
"format": "
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
152
|
+
"format": "fluid-build --task format .",
|
|
153
|
+
"format:biome": "biome check --apply .",
|
|
154
|
+
"format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
155
|
+
"lint": "fluid-build . --task lint",
|
|
156
|
+
"lint:fix": "fluid-build . --task eslint:fix --task format",
|
|
154
157
|
"test": "npm run test:mocha",
|
|
155
158
|
"test:coverage": "c8 npm test",
|
|
156
159
|
"test:mocha": "npm run test:mocha:esm && echo skipping cjs to avoid overhead - npm run test:mocha:cjs",
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
IChannelAttributes,
|
|
8
|
-
IFluidDataStoreRuntime,
|
|
9
8
|
IChannelServices,
|
|
9
|
+
IFluidDataStoreRuntime,
|
|
10
10
|
} from "@fluidframework/datastore-definitions";
|
|
11
11
|
import { ConsensusRegisterCollection } from "./consensusRegisterCollection.js";
|
|
12
12
|
import { IConsensusRegisterCollection, IConsensusRegisterCollectionFactory } from "./interfaces.js";
|
package/src/interfaces.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
IFluidDataStoreRuntime,
|
|
8
|
-
IChannelServices,
|
|
9
7
|
IChannelAttributes,
|
|
10
8
|
IChannelFactory,
|
|
9
|
+
IChannelServices,
|
|
10
|
+
IFluidDataStoreRuntime,
|
|
11
11
|
} from "@fluidframework/datastore-definitions";
|
|
12
12
|
import { ISharedObject, ISharedObjectEvents } from "@fluidframework/shared-object-base";
|
|
13
13
|
|
package/src/packageVersion.ts
CHANGED