@fluidframework/register-collection 2.0.0-dev-rc.3.0.0.250606 → 2.0.0-dev-rc.3.0.0.254274

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 (36) hide show
  1. package/api-report/register-collection.api.md +1 -1
  2. package/dist/consensusRegisterCollection.d.ts +2 -1
  3. package/dist/consensusRegisterCollection.d.ts.map +1 -1
  4. package/dist/consensusRegisterCollection.js +11 -11
  5. package/dist/consensusRegisterCollection.js.map +1 -1
  6. package/dist/consensusRegisterCollectionFactory.d.ts.map +1 -1
  7. package/dist/consensusRegisterCollectionFactory.js.map +1 -1
  8. package/dist/packageVersion.d.ts +1 -1
  9. package/dist/packageVersion.js +1 -1
  10. package/dist/packageVersion.js.map +1 -1
  11. package/dist/register-collection-alpha.d.ts +1 -1
  12. package/dist/register-collection-beta.d.ts +1 -1
  13. package/dist/register-collection-public.d.ts +1 -1
  14. package/dist/register-collection-untrimmed.d.ts +1 -1
  15. package/lib/consensusRegisterCollection.d.ts +2 -1
  16. package/lib/consensusRegisterCollection.d.ts.map +1 -1
  17. package/lib/consensusRegisterCollection.js +2 -2
  18. package/lib/consensusRegisterCollection.js.map +1 -1
  19. package/lib/consensusRegisterCollectionFactory.d.ts.map +1 -1
  20. package/lib/consensusRegisterCollectionFactory.js.map +1 -1
  21. package/lib/packageVersion.d.ts +1 -1
  22. package/lib/packageVersion.js +1 -1
  23. package/lib/packageVersion.js.map +1 -1
  24. package/lib/register-collection-alpha.d.ts +1 -1
  25. package/lib/register-collection-beta.d.ts +1 -1
  26. package/lib/register-collection-public.d.ts +1 -1
  27. package/lib/register-collection-untrimmed.d.ts +1 -1
  28. package/lib/tsdoc-metadata.json +11 -0
  29. package/package.json +13 -25
  30. package/src/consensusRegisterCollection.ts +4 -6
  31. package/src/consensusRegisterCollectionFactory.ts +1 -0
  32. package/src/packageVersion.ts +1 -1
  33. package/lib/test/consensusRegisterCollection.spec.js +0 -281
  34. package/lib/test/consensusRegisterCollection.spec.js.map +0 -1
  35. package/lib/test/types/validateRegisterCollectionPrevious.generated.js +0 -14
  36. package/lib/test/types/validateRegisterCollectionPrevious.generated.js.map +0 -1
@@ -14,7 +14,7 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
14
14
  import { ISharedObject } from '@fluidframework/shared-object-base';
15
15
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
16
16
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
17
- import { SharedObject } from '@fluidframework/shared-object-base';
17
+ import { SharedObject } from '@fluidframework/shared-object-base/internal';
18
18
 
19
19
  // @alpha
20
20
  export class ConsensusRegisterCollection<T> extends SharedObject<IConsensusRegisterCollectionEvents> implements IConsensusRegisterCollection<T> {
@@ -5,7 +5,8 @@
5
5
  import { IChannelAttributes, IChannelStorageService, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
6
6
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
7
  import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
8
- import { IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base";
8
+ import { IFluidSerializer } from "@fluidframework/shared-object-base";
9
+ import { SharedObject } from "@fluidframework/shared-object-base/internal";
9
10
  import { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory.js";
10
11
  import { IConsensusRegisterCollection, IConsensusRegisterCollectionEvents, ReadPolicy } from "./interfaces.js";
11
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"consensusRegisterCollection.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EACN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,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,IAAI,IAAI;CAGhC"}
@@ -6,9 +6,9 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.ConsensusRegisterCollection = void 0;
8
8
  const client_utils_1 = require("@fluid-internal/client-utils");
9
- const core_utils_1 = require("@fluidframework/core-utils");
9
+ const internal_1 = require("@fluidframework/core-utils/internal");
10
10
  const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
11
- const shared_object_base_1 = require("@fluidframework/shared-object-base");
11
+ const internal_2 = require("@fluidframework/shared-object-base/internal");
12
12
  const consensusRegisterCollectionFactory_js_1 = require("./consensusRegisterCollectionFactory.js");
13
13
  const interfaces_js_1 = require("./interfaces.js");
14
14
  const newLocalRegister = (sequenceNumber, value) => ({
@@ -25,7 +25,7 @@ const snapshotFileName = "header";
25
25
  * {@inheritDoc IConsensusRegisterCollection}
26
26
  * @alpha
27
27
  */
28
- class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
28
+ class ConsensusRegisterCollection extends internal_2.SharedObject {
29
29
  /**
30
30
  * Create a new consensus register collection
31
31
  *
@@ -92,7 +92,7 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
92
92
  const versions = this.readVersions(key);
93
93
  if (versions !== undefined) {
94
94
  // We don't support deletion. So there should be at least one value.
95
- (0, core_utils_1.assert)(versions.length > 0, 0x06c /* "Value should be undefined or non-empty" */);
95
+ (0, internal_1.assert)(versions.length > 0, 0x06c /* "Value should be undefined or non-empty" */);
96
96
  return versions[versions.length - 1];
97
97
  }
98
98
  }
@@ -108,7 +108,7 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
108
108
  this.data.forEach((v, k) => {
109
109
  dataObj[k] = v;
110
110
  });
111
- return (0, shared_object_base_1.createSingleBlobSummary)(snapshotFileName, this.stringify(dataObj, serializer));
111
+ return (0, internal_2.createSingleBlobSummary)(snapshotFileName, this.stringify(dataObj, serializer));
112
112
  }
113
113
  /**
114
114
  * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
@@ -118,7 +118,7 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
118
118
  const header = (0, client_utils_1.bufferToString)(blob, "utf8");
119
119
  const dataObj = this.parse(header, this.serializer);
120
120
  for (const key of Object.keys(dataObj)) {
121
- (0, core_utils_1.assert)(dataObj[key].atomic?.value.type !== "Shared", 0x06d /* "SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17" */);
121
+ (0, internal_1.assert)(dataObj[key].atomic?.value.type !== "Shared", 0x06d /* "SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17" */);
122
122
  this.data.set(key, dataObj[key]);
123
123
  }
124
124
  }
@@ -136,7 +136,7 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
136
136
  // Message can be delivered with delay - e.g. resubmitted on reconnect.
137
137
  // Use the refSeq from when the op was created, not when it was transmitted
138
138
  const refSeqWhenCreated = op.refSeq;
139
- (0, core_utils_1.assert)(refSeqWhenCreated <= message.referenceSequenceNumber, 0x06e /* "Message's reference sequence number < op's reference sequence number!" */);
139
+ (0, internal_1.assert)(refSeqWhenCreated <= message.referenceSequenceNumber, 0x06e /* "Message's reference sequence number < op's reference sequence number!" */);
140
140
  const value = incomingOpMatchesPlainFormat(op)
141
141
  ? op.value.value
142
142
  : this.parse(op.serializedValue, this.serializer);
@@ -149,7 +149,7 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
149
149
  break;
150
150
  }
151
151
  default:
152
- (0, core_utils_1.unreachableCase)(op.type);
152
+ (0, internal_1.unreachableCase)(op.type);
153
153
  }
154
154
  }
155
155
  }
@@ -184,7 +184,7 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
184
184
  }
185
185
  }
186
186
  else {
187
- (0, core_utils_1.assert)(!!data, 0x06f /* "data missing for non-atomic inbound update!" */);
187
+ (0, internal_1.assert)(!!data, 0x06f /* "data missing for non-atomic inbound update!" */);
188
188
  }
189
189
  // Remove versions that were known to the remote client at the time of write
190
190
  while (data.versions.length > 0 && refSeq >= data.versions[0].sequenceNumber) {
@@ -193,10 +193,10 @@ class ConsensusRegisterCollection extends shared_object_base_1.SharedObject {
193
193
  const versionUpdate = newLocalRegister(sequenceNumber, value);
194
194
  // Asserts for data integrity
195
195
  if (!this.isAttached()) {
196
- (0, core_utils_1.assert)(refSeq === 0 && sequenceNumber === 0, 0x070 /* "sequence numbers are expected to be 0 when unattached" */);
196
+ (0, internal_1.assert)(refSeq === 0 && sequenceNumber === 0, 0x070 /* "sequence numbers are expected to be 0 when unattached" */);
197
197
  }
198
198
  else if (data.versions.length > 0) {
199
- (0, core_utils_1.assert)(
199
+ (0, internal_1.assert)(
200
200
  // seqNum should always be increasing, except for the case of grouped batches (seqNum will be the same)
201
201
  sequenceNumber >= data.versions[data.versions.length - 1].sequenceNumber, 0x071 /* "Versions should naturally be ordered by sequenceNumber" */);
202
202
  }
@@ -1 +1 @@
1
- {"version":3,"file":"consensusRegisterCollection.js","sourceRoot":"","sources":["../src/consensusRegisterCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,2DAAqE;AAMrE,+EAA8F;AAE9F,2EAI4C;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AI,CAAC,aAAa,CAAC,CAAC;QAElC,sDAAsD;QACtD,IAAI,MAAM,EAAE;YACX,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC9C;QACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAE/C,OAAO,MAAM,CAAC;IACf,CAAC;IAEO,SAAS,CAAC,KAAU,EAAE,UAA4B;QACzD,OAAO,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IAEO,KAAK,CAAC,OAAe,EAAE,UAA4B;QAC1D,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAES,cAAc;QACvB,uBAAuB;IACxB,CAAC;CACD;AAlQD,kEAkQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport {\n\tIChannelAttributes,\n\tIChannelStorageService,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n\tIFluidSerializer,\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base\";\nimport { ConsensusRegisterCollectionFactory } from \"./consensusRegisterCollectionFactory.js\";\nimport {\n\tIConsensusRegisterCollection,\n\tIConsensusRegisterCollectionEvents,\n\tReadPolicy,\n} from \"./interfaces.js\";\n\ninterface ILocalData<T> {\n\t// Atomic version\n\tatomic: ILocalRegister<T>;\n\n\t// All concurrent versions awaiting consensus\n\tversions: ILocalRegister<T>[];\n}\n\ninterface ILocalRegister<T> {\n\t// Register value, wrapped for backwards compatibility with < 0.17\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\n\t// The sequence number when last consensus was reached\n\tsequenceNumber: number;\n}\n\nconst newLocalRegister = <T>(sequenceNumber: number, value: T): ILocalRegister<T> => ({\n\tsequenceNumber,\n\tvalue: {\n\t\ttype: \"Plain\",\n\t\tvalue,\n\t},\n});\n\n/**\n * An operation for consensus register collection\n *\n * The value stored in this op is serialized as a string and must be deserialized\n */\ninterface IRegisterOperationSerialized {\n\tkey: string;\n\ttype: \"write\";\n\tserializedValue: string;\n\n\t// Message can be delivered with delay - resubmitted on reconnect.\n\t// As such, refSeq needs to reference seq # at the time op was created,\n\t// not when op was actually sent over wire (ISequencedDocumentMessage.referenceSequenceNumber),\n\t// as client can ingest ops in between.\n\trefSeq: number | undefined;\n}\n\n/**\n * IRegisterOperation format in versions \\< 0.17 and \\>=2.0.0-rc.2.0.0\n *\n * The value stored in this op is _not_ serialized and is stored literally as `T`\n */\ninterface IRegisterOperationPlain<T> {\n\tkey: string;\n\ttype: \"write\";\n\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\n\t// back-compat: for clients prior to 2.0.0-rc.2.0.0, we must also pass in\n\t// the serialized value for them to parse handles correctly. we do not have\n\t// to pay the cost of deserializing this value in newer clients\n\tserializedValue: string;\n\n\t// back-compat: files at rest written with runtime <= 0.13 do not have refSeq\n\trefSeq: number | undefined;\n}\n\n/** Incoming ops could match any of these types */\ntype IIncomingRegisterOperation<T> = IRegisterOperationSerialized | IRegisterOperationPlain<T>;\n\n/** Distinguish between incoming op formats so we know which type it is */\nconst incomingOpMatchesPlainFormat = <T>(op): op is IRegisterOperationPlain<T> => \"value\" in op;\n\n/** The type of the resolve function to call after the local operation is ack'd */\ntype PendingResolve = (winner: boolean) => void;\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc IConsensusRegisterCollection}\n * @alpha\n */\nexport class ConsensusRegisterCollection<T>\n\textends SharedObject<IConsensusRegisterCollectionEvents>\n\timplements IConsensusRegisterCollection<T>\n{\n\t/**\n\t * Create a new consensus register collection\n\t *\n\t * @param runtime - data store runtime the new consensus register collection belongs to\n\t * @param id - optional name of the consensus register collection\n\t * @returns newly create consensus register collection (but not attached yet)\n\t */\n\tpublic static create<T>(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(\n\t\t\tid,\n\t\t\tConsensusRegisterCollectionFactory.Type,\n\t\t) as ConsensusRegisterCollection<T>;\n\t}\n\n\t/**\n\t * Get a factory for ConsensusRegisterCollection to register with the data store.\n\t *\n\t * @returns a factory that creates and load ConsensusRegisterCollection\n\t */\n\tpublic static getFactory() {\n\t\treturn new ConsensusRegisterCollectionFactory();\n\t}\n\n\tprivate readonly data = new Map<string, ILocalData<T>>();\n\n\t/**\n\t * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will\n\t * be provided\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_consensusRegisterCollection_\");\n\t}\n\n\t/**\n\t * Creates a new register or writes a new value.\n\t * Returns a promise that will resolve when the write is acked.\n\t *\n\t * @returns Promise<true> if write was non-concurrent\n\t */\n\tpublic async write(key: string, value: T): Promise<boolean> {\n\t\tif (!this.isAttached()) {\n\t\t\tthis.processInboundWrite(key, value, 0, 0, true);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst message: IRegisterOperationPlain<T> = {\n\t\t\tkey,\n\t\t\ttype: \"write\",\n\t\t\tserializedValue: this.stringify(value, this.serializer),\n\t\t\tvalue: {\n\t\t\t\ttype: \"Plain\",\n\t\t\t\tvalue,\n\t\t\t},\n\t\t\trefSeq: this.runtime.deltaManager.lastSequenceNumber,\n\t\t};\n\n\t\treturn this.newAckBasedPromise<boolean>((resolve) => {\n\t\t\t// Send the resolve function as the localOpMetadata. This will be provided back to us when the\n\t\t\t// op is ack'd.\n\t\t\tthis.submitLocalMessage(message, resolve);\n\t\t\t// If we fail due to runtime being disposed, it's better to return false then unhandled exception.\n\t\t}).catch((error) => false);\n\t}\n\n\t/**\n\t * Returns the most recent local value of a register.\n\t * @param key - The key to read\n\t * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.\n\t */\n\tpublic read(key: string, readPolicy: ReadPolicy = ReadPolicy.Atomic): T | undefined {\n\t\tif (readPolicy === ReadPolicy.Atomic) {\n\t\t\treturn this.readAtomic(key);\n\t\t}\n\n\t\tconst versions = this.readVersions(key);\n\n\t\tif (versions !== undefined) {\n\t\t\t// We don't support deletion. So there should be at least one value.\n\t\t\tassert(versions.length > 0, 0x06c /* \"Value should be undefined or non-empty\" */);\n\n\t\t\treturn versions[versions.length - 1];\n\t\t}\n\t}\n\n\tpublic readVersions(key: string): T[] | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.versions.map((element: ILocalRegister<T>) => element.value.value);\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [...this.data.keys()];\n\t}\n\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst dataObj: { [key: string]: ILocalData<T> } = {};\n\t\tthis.data.forEach((v, k) => {\n\t\t\tdataObj[k] = v;\n\t\t});\n\n\t\treturn createSingleBlobSummary(snapshotFileName, this.stringify(dataObj, serializer));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\tconst header = bufferToString(blob, \"utf8\");\n\t\tconst dataObj = this.parse(header, this.serializer);\n\n\t\tfor (const key of Object.keys(dataObj)) {\n\t\t\tassert(\n\t\t\t\tdataObj[key].atomic?.value.type !== \"Shared\",\n\t\t\t\t0x06d /* \"SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17\" */,\n\t\t\t);\n\n\t\t\tthis.data.set(key, dataObj[key]);\n\t\t}\n\t}\n\n\tprotected onDisconnect() {}\n\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op = message.contents as IIncomingRegisterOperation<T>;\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"write\": {\n\t\t\t\t\t// backward compatibility: File at rest written with runtime <= 0.13 do not have refSeq\n\t\t\t\t\t// when the refSeq property didn't exist\n\t\t\t\t\tif (op.refSeq === undefined) {\n\t\t\t\t\t\top.refSeq = message.referenceSequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\t// Message can be delivered with delay - e.g. resubmitted on reconnect.\n\t\t\t\t\t// Use the refSeq from when the op was created, not when it was transmitted\n\t\t\t\t\tconst refSeqWhenCreated = op.refSeq;\n\t\t\t\t\tassert(\n\t\t\t\t\t\trefSeqWhenCreated <= message.referenceSequenceNumber,\n\t\t\t\t\t\t0x06e /* \"Message's reference sequence number < op's reference sequence number!\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst value = incomingOpMatchesPlainFormat<T>(op)\n\t\t\t\t\t\t? op.value.value\n\t\t\t\t\t\t: (this.parse(op.serializedValue, this.serializer) as T);\n\t\t\t\t\tconst winner = this.processInboundWrite(\n\t\t\t\t\t\top.key,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\trefSeqWhenCreated,\n\t\t\t\t\t\tmessage.sequenceNumber,\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t);\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\t// Resolve the pending promise for this operation now that we have received an ack for it.\n\t\t\t\t\t\tconst resolve = localOpMetadata as PendingResolve;\n\t\t\t\t\t\tresolve(winner);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(op.type);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readAtomic(key: string): T | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.atomic.value.value;\n\t}\n\n\t/**\n\t * Process an inbound write op\n\t * @param key - Key that was written to\n\t * @param value - Incoming value\n\t * @param refSeq - RefSeq at the time of write on the remote client\n\t * @param sequenceNumber - Sequence Number of this write op\n\t * @param local - Did this write originate on this client\n\t */\n\tprivate processInboundWrite(\n\t\tkey: string,\n\t\tvalue: T,\n\t\trefSeq: number,\n\t\tsequenceNumber: number,\n\t\tlocal: boolean,\n\t): boolean {\n\t\tlet data = this.data.get(key);\n\t\t// Atomic update if it's a new register or the write was not concurrent,\n\t\t// meaning our state was known to the remote client at the time of write\n\t\tconst winner = data === undefined || refSeq >= data.atomic.sequenceNumber;\n\t\tif (winner) {\n\t\t\tconst atomicUpdate = newLocalRegister<T>(sequenceNumber, value);\n\t\t\tif (data === undefined) {\n\t\t\t\tdata = {\n\t\t\t\t\tatomic: atomicUpdate,\n\t\t\t\t\tversions: [], // we'll update versions next, leave it empty for now\n\t\t\t\t};\n\t\t\t\tthis.data.set(key, data);\n\t\t\t} else {\n\t\t\t\tdata.atomic = atomicUpdate;\n\t\t\t}\n\t\t} else {\n\t\t\tassert(!!data, 0x06f /* \"data missing for non-atomic inbound update!\" */);\n\t\t}\n\n\t\t// Remove versions that were known to the remote client at the time of write\n\t\twhile (data.versions.length > 0 && refSeq >= data.versions[0].sequenceNumber) {\n\t\t\tdata.versions.shift();\n\t\t}\n\n\t\tconst versionUpdate = newLocalRegister<T>(sequenceNumber, value);\n\n\t\t// Asserts for data integrity\n\t\tif (!this.isAttached()) {\n\t\t\tassert(\n\t\t\t\trefSeq === 0 && sequenceNumber === 0,\n\t\t\t\t0x070 /* \"sequence numbers are expected to be 0 when unattached\" */,\n\t\t\t);\n\t\t} else if (data.versions.length > 0) {\n\t\t\tassert(\n\t\t\t\t// seqNum should always be increasing, except for the case of grouped batches (seqNum will be the same)\n\t\t\t\tsequenceNumber >= data.versions[data.versions.length - 1].sequenceNumber,\n\t\t\t\t0x071 /* \"Versions should naturally be ordered by sequenceNumber\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Push the new element.\n\t\tdata.versions.push(versionUpdate);\n\n\t\t// Raise events at the end, to avoid reentrancy issues\n\t\tif (winner) {\n\t\t\tthis.emit(\"atomicChanged\", key, value, local);\n\t\t}\n\t\tthis.emit(\"versionChanged\", key, value, local);\n\n\t\treturn winner;\n\t}\n\n\tprivate stringify(value: any, serializer: IFluidSerializer): string {\n\t\treturn serializer.stringify(value, this.handle);\n\t}\n\n\tprivate parse(content: string, serializer: IFluidSerializer): any {\n\t\treturn serializer.parse(content);\n\t}\n\n\tprotected applyStashedOp(): void {\n\t\t// empty implementation\n\t}\n}\n"]}
1
+ {"version":3,"file":"consensusRegisterCollection.js","sourceRoot":"","sources":["../src/consensusRegisterCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAC9D,kEAA8E;AAM9E,+EAA8F;AAG9F,0EAAoG;AAEpG,mGAA6F;AAC7F,mDAIyB;AAqBzB,MAAM,gBAAgB,GAAG,CAAI,cAAsB,EAAE,KAAQ,EAAqB,EAAE,CAAC,CAAC;IACrF,cAAc;IACd,KAAK,EAAE;QACN,IAAI,EAAE,OAAO;QACb,KAAK;KACL;CACD,CAAC,CAAC;AA6CH,0EAA0E;AAC1E,MAAM,4BAA4B,GAAG,CAAI,EAAE,EAAoC,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC;AAKhG,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;GAGG;AACH,MAAa,2BACZ,SAAQ,uBAAgD;IAGxD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAI,OAA+B,EAAE,EAAW;QACnE,OAAO,OAAO,CAAC,aAAa,CAC3B,EAAE,EACF,0EAAkC,CAAC,IAAI,CACL,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU;QACvB,OAAO,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) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannelAttributes,\n\tIChannelStorageService,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { IFluidSerializer } from \"@fluidframework/shared-object-base\";\nimport { SharedObject, createSingleBlobSummary } from \"@fluidframework/shared-object-base/internal\";\n\nimport { ConsensusRegisterCollectionFactory } from \"./consensusRegisterCollectionFactory.js\";\nimport {\n\tIConsensusRegisterCollection,\n\tIConsensusRegisterCollectionEvents,\n\tReadPolicy,\n} from \"./interfaces.js\";\n\ninterface ILocalData<T> {\n\t// Atomic version\n\tatomic: ILocalRegister<T>;\n\n\t// All concurrent versions awaiting consensus\n\tversions: ILocalRegister<T>[];\n}\n\ninterface ILocalRegister<T> {\n\t// Register value, wrapped for backwards compatibility with < 0.17\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\n\t// The sequence number when last consensus was reached\n\tsequenceNumber: number;\n}\n\nconst newLocalRegister = <T>(sequenceNumber: number, value: T): ILocalRegister<T> => ({\n\tsequenceNumber,\n\tvalue: {\n\t\ttype: \"Plain\",\n\t\tvalue,\n\t},\n});\n\n/**\n * An operation for consensus register collection\n *\n * The value stored in this op is serialized as a string and must be deserialized\n */\ninterface IRegisterOperationSerialized {\n\tkey: string;\n\ttype: \"write\";\n\tserializedValue: string;\n\n\t// Message can be delivered with delay - resubmitted on reconnect.\n\t// As such, refSeq needs to reference seq # at the time op was created,\n\t// not when op was actually sent over wire (ISequencedDocumentMessage.referenceSequenceNumber),\n\t// as client can ingest ops in between.\n\trefSeq: number | undefined;\n}\n\n/**\n * IRegisterOperation format in versions \\< 0.17 and \\>=2.0.0-rc.2.0.0\n *\n * The value stored in this op is _not_ serialized and is stored literally as `T`\n */\ninterface IRegisterOperationPlain<T> {\n\tkey: string;\n\ttype: \"write\";\n\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\n\t// back-compat: for clients prior to 2.0.0-rc.2.0.0, we must also pass in\n\t// the serialized value for them to parse handles correctly. we do not have\n\t// to pay the cost of deserializing this value in newer clients\n\tserializedValue: string;\n\n\t// back-compat: files at rest written with runtime <= 0.13 do not have refSeq\n\trefSeq: number | undefined;\n}\n\n/** Incoming ops could match any of these types */\ntype IIncomingRegisterOperation<T> = IRegisterOperationSerialized | IRegisterOperationPlain<T>;\n\n/** Distinguish between incoming op formats so we know which type it is */\nconst incomingOpMatchesPlainFormat = <T>(op): op is IRegisterOperationPlain<T> => \"value\" in op;\n\n/** The type of the resolve function to call after the local operation is ack'd */\ntype PendingResolve = (winner: boolean) => void;\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc IConsensusRegisterCollection}\n * @alpha\n */\nexport class ConsensusRegisterCollection<T>\n\textends SharedObject<IConsensusRegisterCollectionEvents>\n\timplements IConsensusRegisterCollection<T>\n{\n\t/**\n\t * Create a new consensus register collection\n\t *\n\t * @param runtime - data store runtime the new consensus register collection belongs to\n\t * @param id - optional name of the consensus register collection\n\t * @returns newly create consensus register collection (but not attached yet)\n\t */\n\tpublic static create<T>(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(\n\t\t\tid,\n\t\t\tConsensusRegisterCollectionFactory.Type,\n\t\t) as ConsensusRegisterCollection<T>;\n\t}\n\n\t/**\n\t * Get a factory for ConsensusRegisterCollection to register with the data store.\n\t *\n\t * @returns a factory that creates and load ConsensusRegisterCollection\n\t */\n\tpublic static getFactory() {\n\t\treturn new ConsensusRegisterCollectionFactory();\n\t}\n\n\tprivate readonly data = new Map<string, ILocalData<T>>();\n\n\t/**\n\t * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will\n\t * be provided\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_consensusRegisterCollection_\");\n\t}\n\n\t/**\n\t * Creates a new register or writes a new value.\n\t * Returns a promise that will resolve when the write is acked.\n\t *\n\t * @returns Promise<true> if write was non-concurrent\n\t */\n\tpublic async write(key: string, value: T): Promise<boolean> {\n\t\tif (!this.isAttached()) {\n\t\t\tthis.processInboundWrite(key, value, 0, 0, true);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst message: IRegisterOperationPlain<T> = {\n\t\t\tkey,\n\t\t\ttype: \"write\",\n\t\t\tserializedValue: this.stringify(value, this.serializer),\n\t\t\tvalue: {\n\t\t\t\ttype: \"Plain\",\n\t\t\t\tvalue,\n\t\t\t},\n\t\t\trefSeq: this.runtime.deltaManager.lastSequenceNumber,\n\t\t};\n\n\t\treturn this.newAckBasedPromise<boolean>((resolve) => {\n\t\t\t// Send the resolve function as the localOpMetadata. This will be provided back to us when the\n\t\t\t// op is ack'd.\n\t\t\tthis.submitLocalMessage(message, resolve);\n\t\t\t// If we fail due to runtime being disposed, it's better to return false then unhandled exception.\n\t\t}).catch((error) => false);\n\t}\n\n\t/**\n\t * Returns the most recent local value of a register.\n\t * @param key - The key to read\n\t * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.\n\t */\n\tpublic read(key: string, readPolicy: ReadPolicy = ReadPolicy.Atomic): T | undefined {\n\t\tif (readPolicy === ReadPolicy.Atomic) {\n\t\t\treturn this.readAtomic(key);\n\t\t}\n\n\t\tconst versions = this.readVersions(key);\n\n\t\tif (versions !== undefined) {\n\t\t\t// We don't support deletion. So there should be at least one value.\n\t\t\tassert(versions.length > 0, 0x06c /* \"Value should be undefined or non-empty\" */);\n\n\t\t\treturn versions[versions.length - 1];\n\t\t}\n\t}\n\n\tpublic readVersions(key: string): T[] | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.versions.map((element: ILocalRegister<T>) => element.value.value);\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [...this.data.keys()];\n\t}\n\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst dataObj: { [key: string]: ILocalData<T> } = {};\n\t\tthis.data.forEach((v, k) => {\n\t\t\tdataObj[k] = v;\n\t\t});\n\n\t\treturn createSingleBlobSummary(snapshotFileName, this.stringify(dataObj, serializer));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\tconst header = bufferToString(blob, \"utf8\");\n\t\tconst dataObj = this.parse(header, this.serializer);\n\n\t\tfor (const key of Object.keys(dataObj)) {\n\t\t\tassert(\n\t\t\t\tdataObj[key].atomic?.value.type !== \"Shared\",\n\t\t\t\t0x06d /* \"SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17\" */,\n\t\t\t);\n\n\t\t\tthis.data.set(key, dataObj[key]);\n\t\t}\n\t}\n\n\tprotected onDisconnect() {}\n\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op = message.contents as IIncomingRegisterOperation<T>;\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"write\": {\n\t\t\t\t\t// backward compatibility: File at rest written with runtime <= 0.13 do not have refSeq\n\t\t\t\t\t// when the refSeq property didn't exist\n\t\t\t\t\tif (op.refSeq === undefined) {\n\t\t\t\t\t\top.refSeq = message.referenceSequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\t// Message can be delivered with delay - e.g. resubmitted on reconnect.\n\t\t\t\t\t// Use the refSeq from when the op was created, not when it was transmitted\n\t\t\t\t\tconst refSeqWhenCreated = op.refSeq;\n\t\t\t\t\tassert(\n\t\t\t\t\t\trefSeqWhenCreated <= message.referenceSequenceNumber,\n\t\t\t\t\t\t0x06e /* \"Message's reference sequence number < op's reference sequence number!\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst value = incomingOpMatchesPlainFormat<T>(op)\n\t\t\t\t\t\t? op.value.value\n\t\t\t\t\t\t: (this.parse(op.serializedValue, this.serializer) as T);\n\t\t\t\t\tconst winner = this.processInboundWrite(\n\t\t\t\t\t\top.key,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\trefSeqWhenCreated,\n\t\t\t\t\t\tmessage.sequenceNumber,\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t);\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\t// Resolve the pending promise for this operation now that we have received an ack for it.\n\t\t\t\t\t\tconst resolve = localOpMetadata as PendingResolve;\n\t\t\t\t\t\tresolve(winner);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(op.type);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readAtomic(key: string): T | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.atomic.value.value;\n\t}\n\n\t/**\n\t * Process an inbound write op\n\t * @param key - Key that was written to\n\t * @param value - Incoming value\n\t * @param refSeq - RefSeq at the time of write on the remote client\n\t * @param sequenceNumber - Sequence Number of this write op\n\t * @param local - Did this write originate on this client\n\t */\n\tprivate processInboundWrite(\n\t\tkey: string,\n\t\tvalue: T,\n\t\trefSeq: number,\n\t\tsequenceNumber: number,\n\t\tlocal: boolean,\n\t): boolean {\n\t\tlet data = this.data.get(key);\n\t\t// Atomic update if it's a new register or the write was not concurrent,\n\t\t// meaning our state was known to the remote client at the time of write\n\t\tconst winner = data === undefined || refSeq >= data.atomic.sequenceNumber;\n\t\tif (winner) {\n\t\t\tconst atomicUpdate = newLocalRegister<T>(sequenceNumber, value);\n\t\t\tif (data === undefined) {\n\t\t\t\tdata = {\n\t\t\t\t\tatomic: atomicUpdate,\n\t\t\t\t\tversions: [], // we'll update versions next, leave it empty for now\n\t\t\t\t};\n\t\t\t\tthis.data.set(key, data);\n\t\t\t} else {\n\t\t\t\tdata.atomic = atomicUpdate;\n\t\t\t}\n\t\t} else {\n\t\t\tassert(!!data, 0x06f /* \"data missing for non-atomic inbound update!\" */);\n\t\t}\n\n\t\t// Remove versions that were known to the remote client at the time of write\n\t\twhile (data.versions.length > 0 && refSeq >= data.versions[0].sequenceNumber) {\n\t\t\tdata.versions.shift();\n\t\t}\n\n\t\tconst versionUpdate = newLocalRegister<T>(sequenceNumber, value);\n\n\t\t// Asserts for data integrity\n\t\tif (!this.isAttached()) {\n\t\t\tassert(\n\t\t\t\trefSeq === 0 && sequenceNumber === 0,\n\t\t\t\t0x070 /* \"sequence numbers are expected to be 0 when unattached\" */,\n\t\t\t);\n\t\t} else if (data.versions.length > 0) {\n\t\t\tassert(\n\t\t\t\t// seqNum should always be increasing, except for the case of grouped batches (seqNum will be the same)\n\t\t\t\tsequenceNumber >= data.versions[data.versions.length - 1].sequenceNumber,\n\t\t\t\t0x071 /* \"Versions should naturally be ordered by sequenceNumber\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Push the new element.\n\t\tdata.versions.push(versionUpdate);\n\n\t\t// Raise events at the end, to avoid reentrancy issues\n\t\tif (winner) {\n\t\t\tthis.emit(\"atomicChanged\", key, value, local);\n\t\t}\n\t\tthis.emit(\"versionChanged\", key, value, local);\n\n\t\treturn winner;\n\t}\n\n\tprivate stringify(value: any, serializer: IFluidSerializer): string {\n\t\treturn serializer.stringify(value, this.handle);\n\t}\n\n\tprivate parse(content: string, serializer: IFluidSerializer): any {\n\t\treturn serializer.parse(content);\n\t}\n\n\tprotected applyStashedOp(): void {\n\t\t// empty implementation\n\t}\n}\n"]}
@@ -1 +1 @@
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
+ {"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;AAG/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\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"]}
1
+ {"version":3,"file":"consensusRegisterCollectionFactory.js","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,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\";\n\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"]}
@@ -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.3.0.0.250606";
8
+ export declare const pkgVersion = "2.0.0-dev-rc.3.0.0.254274";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -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.3.0.0.250606";
11
+ exports.pkgVersion = "2.0.0-dev-rc.3.0.0.254274";
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.3.0.0.250606\";\n"]}
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.254274\";\n"]}
@@ -8,7 +8,7 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
8
8
  import { ISharedObject } from '@fluidframework/shared-object-base';
9
9
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
10
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
- import { SharedObject } from '@fluidframework/shared-object-base';
11
+ import { SharedObject } from '@fluidframework/shared-object-base/internal';
12
12
 
13
13
  /**
14
14
  * {@inheritDoc IConsensusRegisterCollection}
@@ -8,7 +8,7 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
8
8
  import { ISharedObject } from '@fluidframework/shared-object-base';
9
9
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
10
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
- import { SharedObject } from '@fluidframework/shared-object-base';
11
+ import { SharedObject } from '@fluidframework/shared-object-base/internal';
12
12
 
13
13
  /* Excluded from this release type: ConsensusRegisterCollection */
14
14
 
@@ -8,7 +8,7 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
8
8
  import { ISharedObject } from '@fluidframework/shared-object-base';
9
9
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
10
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
- import { SharedObject } from '@fluidframework/shared-object-base';
11
+ import { SharedObject } from '@fluidframework/shared-object-base/internal';
12
12
 
13
13
  /* Excluded from this release type: ConsensusRegisterCollection */
14
14
 
@@ -8,7 +8,7 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
8
8
  import { ISharedObject } from '@fluidframework/shared-object-base';
9
9
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
10
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
- import { SharedObject } from '@fluidframework/shared-object-base';
11
+ import { SharedObject } from '@fluidframework/shared-object-base/internal';
12
12
 
13
13
  /**
14
14
  * {@inheritDoc IConsensusRegisterCollection}
@@ -5,7 +5,8 @@
5
5
  import { IChannelAttributes, IChannelStorageService, IFluidDataStoreRuntime } from "@fluidframework/datastore-definitions";
6
6
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
7
  import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
8
- import { IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base";
8
+ import { IFluidSerializer } from "@fluidframework/shared-object-base";
9
+ import { SharedObject } from "@fluidframework/shared-object-base/internal";
9
10
  import { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory.js";
10
11
  import { IConsensusRegisterCollection, IConsensusRegisterCollectionEvents, ReadPolicy } from "./interfaces.js";
11
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"consensusRegisterCollection.d.ts","sourceRoot":"","sources":["../src/consensusRegisterCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAe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,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,IAAI,IAAI;CAGhC"}
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { bufferToString } from "@fluid-internal/client-utils";
6
- import { assert, unreachableCase } from "@fluidframework/core-utils";
6
+ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
7
7
  import { MessageType } from "@fluidframework/protocol-definitions";
8
- import { SharedObject, createSingleBlobSummary, } from "@fluidframework/shared-object-base";
8
+ import { SharedObject, createSingleBlobSummary } from "@fluidframework/shared-object-base/internal";
9
9
  import { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory.js";
10
10
  import { ReadPolicy, } from "./interfaces.js";
11
11
  const newLocalRegister = (sequenceNumber, value) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"consensusRegisterCollection.js","sourceRoot":"","sources":["../src/consensusRegisterCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,eAAe,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AAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc,EACxE,KAAK,CAAC,8DAA8D,CACpE,CAAC;SACF;QAED,wBAAwB;QACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAElC,sDAAsD;QACtD,IAAI,MAAM,EAAE;YACX,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC9C;QACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAE/C,OAAO,MAAM,CAAC;IACf,CAAC;IAEO,SAAS,CAAC,KAAU,EAAE,UAA4B;QACzD,OAAO,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IAEO,KAAK,CAAC,OAAe,EAAE,UAA4B;QAC1D,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAES,cAAc;QACvB,uBAAuB;IACxB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport {\n\tIChannelAttributes,\n\tIChannelStorageService,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport {\n\tIFluidSerializer,\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base\";\nimport { ConsensusRegisterCollectionFactory } from \"./consensusRegisterCollectionFactory.js\";\nimport {\n\tIConsensusRegisterCollection,\n\tIConsensusRegisterCollectionEvents,\n\tReadPolicy,\n} from \"./interfaces.js\";\n\ninterface ILocalData<T> {\n\t// Atomic version\n\tatomic: ILocalRegister<T>;\n\n\t// All concurrent versions awaiting consensus\n\tversions: ILocalRegister<T>[];\n}\n\ninterface ILocalRegister<T> {\n\t// Register value, wrapped for backwards compatibility with < 0.17\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\n\t// The sequence number when last consensus was reached\n\tsequenceNumber: number;\n}\n\nconst newLocalRegister = <T>(sequenceNumber: number, value: T): ILocalRegister<T> => ({\n\tsequenceNumber,\n\tvalue: {\n\t\ttype: \"Plain\",\n\t\tvalue,\n\t},\n});\n\n/**\n * An operation for consensus register collection\n *\n * The value stored in this op is serialized as a string and must be deserialized\n */\ninterface IRegisterOperationSerialized {\n\tkey: string;\n\ttype: \"write\";\n\tserializedValue: string;\n\n\t// Message can be delivered with delay - resubmitted on reconnect.\n\t// As such, refSeq needs to reference seq # at the time op was created,\n\t// not when op was actually sent over wire (ISequencedDocumentMessage.referenceSequenceNumber),\n\t// as client can ingest ops in between.\n\trefSeq: number | undefined;\n}\n\n/**\n * IRegisterOperation format in versions \\< 0.17 and \\>=2.0.0-rc.2.0.0\n *\n * The value stored in this op is _not_ serialized and is stored literally as `T`\n */\ninterface IRegisterOperationPlain<T> {\n\tkey: string;\n\ttype: \"write\";\n\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\n\t// back-compat: for clients prior to 2.0.0-rc.2.0.0, we must also pass in\n\t// the serialized value for them to parse handles correctly. we do not have\n\t// to pay the cost of deserializing this value in newer clients\n\tserializedValue: string;\n\n\t// back-compat: files at rest written with runtime <= 0.13 do not have refSeq\n\trefSeq: number | undefined;\n}\n\n/** Incoming ops could match any of these types */\ntype IIncomingRegisterOperation<T> = IRegisterOperationSerialized | IRegisterOperationPlain<T>;\n\n/** Distinguish between incoming op formats so we know which type it is */\nconst incomingOpMatchesPlainFormat = <T>(op): op is IRegisterOperationPlain<T> => \"value\" in op;\n\n/** The type of the resolve function to call after the local operation is ack'd */\ntype PendingResolve = (winner: boolean) => void;\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc IConsensusRegisterCollection}\n * @alpha\n */\nexport class ConsensusRegisterCollection<T>\n\textends SharedObject<IConsensusRegisterCollectionEvents>\n\timplements IConsensusRegisterCollection<T>\n{\n\t/**\n\t * Create a new consensus register collection\n\t *\n\t * @param runtime - data store runtime the new consensus register collection belongs to\n\t * @param id - optional name of the consensus register collection\n\t * @returns newly create consensus register collection (but not attached yet)\n\t */\n\tpublic static create<T>(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(\n\t\t\tid,\n\t\t\tConsensusRegisterCollectionFactory.Type,\n\t\t) as ConsensusRegisterCollection<T>;\n\t}\n\n\t/**\n\t * Get a factory for ConsensusRegisterCollection to register with the data store.\n\t *\n\t * @returns a factory that creates and load ConsensusRegisterCollection\n\t */\n\tpublic static getFactory() {\n\t\treturn new ConsensusRegisterCollectionFactory();\n\t}\n\n\tprivate readonly data = new Map<string, ILocalData<T>>();\n\n\t/**\n\t * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will\n\t * be provided\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_consensusRegisterCollection_\");\n\t}\n\n\t/**\n\t * Creates a new register or writes a new value.\n\t * Returns a promise that will resolve when the write is acked.\n\t *\n\t * @returns Promise<true> if write was non-concurrent\n\t */\n\tpublic async write(key: string, value: T): Promise<boolean> {\n\t\tif (!this.isAttached()) {\n\t\t\tthis.processInboundWrite(key, value, 0, 0, true);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst message: IRegisterOperationPlain<T> = {\n\t\t\tkey,\n\t\t\ttype: \"write\",\n\t\t\tserializedValue: this.stringify(value, this.serializer),\n\t\t\tvalue: {\n\t\t\t\ttype: \"Plain\",\n\t\t\t\tvalue,\n\t\t\t},\n\t\t\trefSeq: this.runtime.deltaManager.lastSequenceNumber,\n\t\t};\n\n\t\treturn this.newAckBasedPromise<boolean>((resolve) => {\n\t\t\t// Send the resolve function as the localOpMetadata. This will be provided back to us when the\n\t\t\t// op is ack'd.\n\t\t\tthis.submitLocalMessage(message, resolve);\n\t\t\t// If we fail due to runtime being disposed, it's better to return false then unhandled exception.\n\t\t}).catch((error) => false);\n\t}\n\n\t/**\n\t * Returns the most recent local value of a register.\n\t * @param key - The key to read\n\t * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.\n\t */\n\tpublic read(key: string, readPolicy: ReadPolicy = ReadPolicy.Atomic): T | undefined {\n\t\tif (readPolicy === ReadPolicy.Atomic) {\n\t\t\treturn this.readAtomic(key);\n\t\t}\n\n\t\tconst versions = this.readVersions(key);\n\n\t\tif (versions !== undefined) {\n\t\t\t// We don't support deletion. So there should be at least one value.\n\t\t\tassert(versions.length > 0, 0x06c /* \"Value should be undefined or non-empty\" */);\n\n\t\t\treturn versions[versions.length - 1];\n\t\t}\n\t}\n\n\tpublic readVersions(key: string): T[] | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.versions.map((element: ILocalRegister<T>) => element.value.value);\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [...this.data.keys()];\n\t}\n\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst dataObj: { [key: string]: ILocalData<T> } = {};\n\t\tthis.data.forEach((v, k) => {\n\t\t\tdataObj[k] = v;\n\t\t});\n\n\t\treturn createSingleBlobSummary(snapshotFileName, this.stringify(dataObj, serializer));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\tconst header = bufferToString(blob, \"utf8\");\n\t\tconst dataObj = this.parse(header, this.serializer);\n\n\t\tfor (const key of Object.keys(dataObj)) {\n\t\t\tassert(\n\t\t\t\tdataObj[key].atomic?.value.type !== \"Shared\",\n\t\t\t\t0x06d /* \"SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17\" */,\n\t\t\t);\n\n\t\t\tthis.data.set(key, dataObj[key]);\n\t\t}\n\t}\n\n\tprotected onDisconnect() {}\n\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op = message.contents as IIncomingRegisterOperation<T>;\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"write\": {\n\t\t\t\t\t// backward compatibility: File at rest written with runtime <= 0.13 do not have refSeq\n\t\t\t\t\t// when the refSeq property didn't exist\n\t\t\t\t\tif (op.refSeq === undefined) {\n\t\t\t\t\t\top.refSeq = message.referenceSequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\t// Message can be delivered with delay - e.g. resubmitted on reconnect.\n\t\t\t\t\t// Use the refSeq from when the op was created, not when it was transmitted\n\t\t\t\t\tconst refSeqWhenCreated = op.refSeq;\n\t\t\t\t\tassert(\n\t\t\t\t\t\trefSeqWhenCreated <= message.referenceSequenceNumber,\n\t\t\t\t\t\t0x06e /* \"Message's reference sequence number < op's reference sequence number!\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst value = incomingOpMatchesPlainFormat<T>(op)\n\t\t\t\t\t\t? op.value.value\n\t\t\t\t\t\t: (this.parse(op.serializedValue, this.serializer) as T);\n\t\t\t\t\tconst winner = this.processInboundWrite(\n\t\t\t\t\t\top.key,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\trefSeqWhenCreated,\n\t\t\t\t\t\tmessage.sequenceNumber,\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t);\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\t// Resolve the pending promise for this operation now that we have received an ack for it.\n\t\t\t\t\t\tconst resolve = localOpMetadata as PendingResolve;\n\t\t\t\t\t\tresolve(winner);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(op.type);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readAtomic(key: string): T | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.atomic.value.value;\n\t}\n\n\t/**\n\t * Process an inbound write op\n\t * @param key - Key that was written to\n\t * @param value - Incoming value\n\t * @param refSeq - RefSeq at the time of write on the remote client\n\t * @param sequenceNumber - Sequence Number of this write op\n\t * @param local - Did this write originate on this client\n\t */\n\tprivate processInboundWrite(\n\t\tkey: string,\n\t\tvalue: T,\n\t\trefSeq: number,\n\t\tsequenceNumber: number,\n\t\tlocal: boolean,\n\t): boolean {\n\t\tlet data = this.data.get(key);\n\t\t// Atomic update if it's a new register or the write was not concurrent,\n\t\t// meaning our state was known to the remote client at the time of write\n\t\tconst winner = data === undefined || refSeq >= data.atomic.sequenceNumber;\n\t\tif (winner) {\n\t\t\tconst atomicUpdate = newLocalRegister<T>(sequenceNumber, value);\n\t\t\tif (data === undefined) {\n\t\t\t\tdata = {\n\t\t\t\t\tatomic: atomicUpdate,\n\t\t\t\t\tversions: [], // we'll update versions next, leave it empty for now\n\t\t\t\t};\n\t\t\t\tthis.data.set(key, data);\n\t\t\t} else {\n\t\t\t\tdata.atomic = atomicUpdate;\n\t\t\t}\n\t\t} else {\n\t\t\tassert(!!data, 0x06f /* \"data missing for non-atomic inbound update!\" */);\n\t\t}\n\n\t\t// Remove versions that were known to the remote client at the time of write\n\t\twhile (data.versions.length > 0 && refSeq >= data.versions[0].sequenceNumber) {\n\t\t\tdata.versions.shift();\n\t\t}\n\n\t\tconst versionUpdate = newLocalRegister<T>(sequenceNumber, value);\n\n\t\t// Asserts for data integrity\n\t\tif (!this.isAttached()) {\n\t\t\tassert(\n\t\t\t\trefSeq === 0 && sequenceNumber === 0,\n\t\t\t\t0x070 /* \"sequence numbers are expected to be 0 when unattached\" */,\n\t\t\t);\n\t\t} else if (data.versions.length > 0) {\n\t\t\tassert(\n\t\t\t\t// seqNum should always be increasing, except for the case of grouped batches (seqNum will be the same)\n\t\t\t\tsequenceNumber >= data.versions[data.versions.length - 1].sequenceNumber,\n\t\t\t\t0x071 /* \"Versions should naturally be ordered by sequenceNumber\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Push the new element.\n\t\tdata.versions.push(versionUpdate);\n\n\t\t// Raise events at the end, to avoid reentrancy issues\n\t\tif (winner) {\n\t\t\tthis.emit(\"atomicChanged\", key, value, local);\n\t\t}\n\t\tthis.emit(\"versionChanged\", key, value, local);\n\n\t\treturn winner;\n\t}\n\n\tprivate stringify(value: any, serializer: IFluidSerializer): string {\n\t\treturn serializer.stringify(value, this.handle);\n\t}\n\n\tprivate parse(content: string, serializer: IFluidSerializer): any {\n\t\treturn serializer.parse(content);\n\t}\n\n\tprotected applyStashedOp(): void {\n\t\t// empty implementation\n\t}\n}\n"]}
1
+ {"version":3,"file":"consensusRegisterCollection.js","sourceRoot":"","sources":["../src/consensusRegisterCollection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAM9E,OAAO,EAA6B,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAG9F,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAEpG,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAGN,UAAU,GACV,MAAM,iBAAiB,CAAC;AAqBzB,MAAM,gBAAgB,GAAG,CAAI,cAAsB,EAAE,KAAQ,EAAqB,EAAE,CAAC,CAAC;IACrF,cAAc;IACd,KAAK,EAAE;QACN,IAAI,EAAE,OAAO;QACb,KAAK;KACL;CACD,CAAC,CAAC;AA6CH,0EAA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,CAAC;IAEO,SAAS,CAAC,KAAU,EAAE,UAA4B;QACzD,OAAO,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;IAEO,KAAK,CAAC,OAAe,EAAE,UAA4B;QAC1D,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAES,cAAc;QACvB,uBAAuB;IACxB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIChannelAttributes,\n\tIChannelStorageService,\n\tIFluidDataStoreRuntime,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport { ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\nimport { IFluidSerializer } from \"@fluidframework/shared-object-base\";\nimport { SharedObject, createSingleBlobSummary } from \"@fluidframework/shared-object-base/internal\";\n\nimport { ConsensusRegisterCollectionFactory } from \"./consensusRegisterCollectionFactory.js\";\nimport {\n\tIConsensusRegisterCollection,\n\tIConsensusRegisterCollectionEvents,\n\tReadPolicy,\n} from \"./interfaces.js\";\n\ninterface ILocalData<T> {\n\t// Atomic version\n\tatomic: ILocalRegister<T>;\n\n\t// All concurrent versions awaiting consensus\n\tversions: ILocalRegister<T>[];\n}\n\ninterface ILocalRegister<T> {\n\t// Register value, wrapped for backwards compatibility with < 0.17\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\n\t// The sequence number when last consensus was reached\n\tsequenceNumber: number;\n}\n\nconst newLocalRegister = <T>(sequenceNumber: number, value: T): ILocalRegister<T> => ({\n\tsequenceNumber,\n\tvalue: {\n\t\ttype: \"Plain\",\n\t\tvalue,\n\t},\n});\n\n/**\n * An operation for consensus register collection\n *\n * The value stored in this op is serialized as a string and must be deserialized\n */\ninterface IRegisterOperationSerialized {\n\tkey: string;\n\ttype: \"write\";\n\tserializedValue: string;\n\n\t// Message can be delivered with delay - resubmitted on reconnect.\n\t// As such, refSeq needs to reference seq # at the time op was created,\n\t// not when op was actually sent over wire (ISequencedDocumentMessage.referenceSequenceNumber),\n\t// as client can ingest ops in between.\n\trefSeq: number | undefined;\n}\n\n/**\n * IRegisterOperation format in versions \\< 0.17 and \\>=2.0.0-rc.2.0.0\n *\n * The value stored in this op is _not_ serialized and is stored literally as `T`\n */\ninterface IRegisterOperationPlain<T> {\n\tkey: string;\n\ttype: \"write\";\n\n\tvalue: {\n\t\ttype: \"Plain\";\n\t\tvalue: T;\n\t};\n\n\t// back-compat: for clients prior to 2.0.0-rc.2.0.0, we must also pass in\n\t// the serialized value for them to parse handles correctly. we do not have\n\t// to pay the cost of deserializing this value in newer clients\n\tserializedValue: string;\n\n\t// back-compat: files at rest written with runtime <= 0.13 do not have refSeq\n\trefSeq: number | undefined;\n}\n\n/** Incoming ops could match any of these types */\ntype IIncomingRegisterOperation<T> = IRegisterOperationSerialized | IRegisterOperationPlain<T>;\n\n/** Distinguish between incoming op formats so we know which type it is */\nconst incomingOpMatchesPlainFormat = <T>(op): op is IRegisterOperationPlain<T> => \"value\" in op;\n\n/** The type of the resolve function to call after the local operation is ack'd */\ntype PendingResolve = (winner: boolean) => void;\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc IConsensusRegisterCollection}\n * @alpha\n */\nexport class ConsensusRegisterCollection<T>\n\textends SharedObject<IConsensusRegisterCollectionEvents>\n\timplements IConsensusRegisterCollection<T>\n{\n\t/**\n\t * Create a new consensus register collection\n\t *\n\t * @param runtime - data store runtime the new consensus register collection belongs to\n\t * @param id - optional name of the consensus register collection\n\t * @returns newly create consensus register collection (but not attached yet)\n\t */\n\tpublic static create<T>(runtime: IFluidDataStoreRuntime, id?: string) {\n\t\treturn runtime.createChannel(\n\t\t\tid,\n\t\t\tConsensusRegisterCollectionFactory.Type,\n\t\t) as ConsensusRegisterCollection<T>;\n\t}\n\n\t/**\n\t * Get a factory for ConsensusRegisterCollection to register with the data store.\n\t *\n\t * @returns a factory that creates and load ConsensusRegisterCollection\n\t */\n\tpublic static getFactory() {\n\t\treturn new ConsensusRegisterCollectionFactory();\n\t}\n\n\tprivate readonly data = new Map<string, ILocalData<T>>();\n\n\t/**\n\t * Constructs a new consensus register collection. If the object is non-local an id and service interfaces will\n\t * be provided\n\t */\n\tpublic constructor(\n\t\tid: string,\n\t\truntime: IFluidDataStoreRuntime,\n\t\tattributes: IChannelAttributes,\n\t) {\n\t\tsuper(id, runtime, attributes, \"fluid_consensusRegisterCollection_\");\n\t}\n\n\t/**\n\t * Creates a new register or writes a new value.\n\t * Returns a promise that will resolve when the write is acked.\n\t *\n\t * @returns Promise<true> if write was non-concurrent\n\t */\n\tpublic async write(key: string, value: T): Promise<boolean> {\n\t\tif (!this.isAttached()) {\n\t\t\tthis.processInboundWrite(key, value, 0, 0, true);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst message: IRegisterOperationPlain<T> = {\n\t\t\tkey,\n\t\t\ttype: \"write\",\n\t\t\tserializedValue: this.stringify(value, this.serializer),\n\t\t\tvalue: {\n\t\t\t\ttype: \"Plain\",\n\t\t\t\tvalue,\n\t\t\t},\n\t\t\trefSeq: this.runtime.deltaManager.lastSequenceNumber,\n\t\t};\n\n\t\treturn this.newAckBasedPromise<boolean>((resolve) => {\n\t\t\t// Send the resolve function as the localOpMetadata. This will be provided back to us when the\n\t\t\t// op is ack'd.\n\t\t\tthis.submitLocalMessage(message, resolve);\n\t\t\t// If we fail due to runtime being disposed, it's better to return false then unhandled exception.\n\t\t}).catch((error) => false);\n\t}\n\n\t/**\n\t * Returns the most recent local value of a register.\n\t * @param key - The key to read\n\t * @param readPolicy - The ReadPolicy to apply. Defaults to Atomic.\n\t */\n\tpublic read(key: string, readPolicy: ReadPolicy = ReadPolicy.Atomic): T | undefined {\n\t\tif (readPolicy === ReadPolicy.Atomic) {\n\t\t\treturn this.readAtomic(key);\n\t\t}\n\n\t\tconst versions = this.readVersions(key);\n\n\t\tif (versions !== undefined) {\n\t\t\t// We don't support deletion. So there should be at least one value.\n\t\t\tassert(versions.length > 0, 0x06c /* \"Value should be undefined or non-empty\" */);\n\n\t\t\treturn versions[versions.length - 1];\n\t\t}\n\t}\n\n\tpublic readVersions(key: string): T[] | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.versions.map((element: ILocalRegister<T>) => element.value.value);\n\t}\n\n\tpublic keys(): string[] {\n\t\treturn [...this.data.keys()];\n\t}\n\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst dataObj: { [key: string]: ILocalData<T> } = {};\n\t\tthis.data.forEach((v, k) => {\n\t\t\tdataObj[k] = v;\n\t\t});\n\n\t\treturn createSingleBlobSummary(snapshotFileName, this.stringify(dataObj, serializer));\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n\t */\n\tprotected async loadCore(storage: IChannelStorageService): Promise<void> {\n\t\tconst blob = await storage.readBlob(snapshotFileName);\n\t\tconst header = bufferToString(blob, \"utf8\");\n\t\tconst dataObj = this.parse(header, this.serializer);\n\n\t\tfor (const key of Object.keys(dataObj)) {\n\t\t\tassert(\n\t\t\t\tdataObj[key].atomic?.value.type !== \"Shared\",\n\t\t\t\t0x06d /* \"SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized as of 0.17\" */,\n\t\t\t);\n\n\t\t\tthis.data.set(key, dataObj[key]);\n\t\t}\n\t}\n\n\tprotected onDisconnect() {}\n\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t) {\n\t\tif (message.type === MessageType.Operation) {\n\t\t\tconst op = message.contents as IIncomingRegisterOperation<T>;\n\t\t\tswitch (op.type) {\n\t\t\t\tcase \"write\": {\n\t\t\t\t\t// backward compatibility: File at rest written with runtime <= 0.13 do not have refSeq\n\t\t\t\t\t// when the refSeq property didn't exist\n\t\t\t\t\tif (op.refSeq === undefined) {\n\t\t\t\t\t\top.refSeq = message.referenceSequenceNumber;\n\t\t\t\t\t}\n\t\t\t\t\t// Message can be delivered with delay - e.g. resubmitted on reconnect.\n\t\t\t\t\t// Use the refSeq from when the op was created, not when it was transmitted\n\t\t\t\t\tconst refSeqWhenCreated = op.refSeq;\n\t\t\t\t\tassert(\n\t\t\t\t\t\trefSeqWhenCreated <= message.referenceSequenceNumber,\n\t\t\t\t\t\t0x06e /* \"Message's reference sequence number < op's reference sequence number!\" */,\n\t\t\t\t\t);\n\n\t\t\t\t\tconst value = incomingOpMatchesPlainFormat<T>(op)\n\t\t\t\t\t\t? op.value.value\n\t\t\t\t\t\t: (this.parse(op.serializedValue, this.serializer) as T);\n\t\t\t\t\tconst winner = this.processInboundWrite(\n\t\t\t\t\t\top.key,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\trefSeqWhenCreated,\n\t\t\t\t\t\tmessage.sequenceNumber,\n\t\t\t\t\t\tlocal,\n\t\t\t\t\t);\n\t\t\t\t\tif (local) {\n\t\t\t\t\t\t// Resolve the pending promise for this operation now that we have received an ack for it.\n\t\t\t\t\t\tconst resolve = localOpMetadata as PendingResolve;\n\t\t\t\t\t\tresolve(winner);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tunreachableCase(op.type);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate readAtomic(key: string): T | undefined {\n\t\tconst data = this.data.get(key);\n\t\treturn data?.atomic.value.value;\n\t}\n\n\t/**\n\t * Process an inbound write op\n\t * @param key - Key that was written to\n\t * @param value - Incoming value\n\t * @param refSeq - RefSeq at the time of write on the remote client\n\t * @param sequenceNumber - Sequence Number of this write op\n\t * @param local - Did this write originate on this client\n\t */\n\tprivate processInboundWrite(\n\t\tkey: string,\n\t\tvalue: T,\n\t\trefSeq: number,\n\t\tsequenceNumber: number,\n\t\tlocal: boolean,\n\t): boolean {\n\t\tlet data = this.data.get(key);\n\t\t// Atomic update if it's a new register or the write was not concurrent,\n\t\t// meaning our state was known to the remote client at the time of write\n\t\tconst winner = data === undefined || refSeq >= data.atomic.sequenceNumber;\n\t\tif (winner) {\n\t\t\tconst atomicUpdate = newLocalRegister<T>(sequenceNumber, value);\n\t\t\tif (data === undefined) {\n\t\t\t\tdata = {\n\t\t\t\t\tatomic: atomicUpdate,\n\t\t\t\t\tversions: [], // we'll update versions next, leave it empty for now\n\t\t\t\t};\n\t\t\t\tthis.data.set(key, data);\n\t\t\t} else {\n\t\t\t\tdata.atomic = atomicUpdate;\n\t\t\t}\n\t\t} else {\n\t\t\tassert(!!data, 0x06f /* \"data missing for non-atomic inbound update!\" */);\n\t\t}\n\n\t\t// Remove versions that were known to the remote client at the time of write\n\t\twhile (data.versions.length > 0 && refSeq >= data.versions[0].sequenceNumber) {\n\t\t\tdata.versions.shift();\n\t\t}\n\n\t\tconst versionUpdate = newLocalRegister<T>(sequenceNumber, value);\n\n\t\t// Asserts for data integrity\n\t\tif (!this.isAttached()) {\n\t\t\tassert(\n\t\t\t\trefSeq === 0 && sequenceNumber === 0,\n\t\t\t\t0x070 /* \"sequence numbers are expected to be 0 when unattached\" */,\n\t\t\t);\n\t\t} else if (data.versions.length > 0) {\n\t\t\tassert(\n\t\t\t\t// seqNum should always be increasing, except for the case of grouped batches (seqNum will be the same)\n\t\t\t\tsequenceNumber >= data.versions[data.versions.length - 1].sequenceNumber,\n\t\t\t\t0x071 /* \"Versions should naturally be ordered by sequenceNumber\" */,\n\t\t\t);\n\t\t}\n\n\t\t// Push the new element.\n\t\tdata.versions.push(versionUpdate);\n\n\t\t// Raise events at the end, to avoid reentrancy issues\n\t\tif (winner) {\n\t\t\tthis.emit(\"atomicChanged\", key, value, local);\n\t\t}\n\t\tthis.emit(\"versionChanged\", key, value, local);\n\n\t\treturn winner;\n\t}\n\n\tprivate stringify(value: any, serializer: IFluidSerializer): string {\n\t\treturn serializer.stringify(value, this.handle);\n\t}\n\n\tprivate parse(content: string, serializer: IFluidSerializer): any {\n\t\treturn serializer.parse(content);\n\t}\n\n\tprotected applyStashedOp(): void {\n\t\t// empty implementation\n\t}\n}\n"]}
@@ -1 +1 @@
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
+ {"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;AAG/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\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"]}
1
+ {"version":3,"file":"consensusRegisterCollectionFactory.js","sourceRoot":"","sources":["../src/consensusRegisterCollectionFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,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\";\n\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"]}
@@ -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.3.0.0.250606";
8
+ export declare const pkgVersion = "2.0.0-dev-rc.3.0.0.254274";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/register-collection";
8
- export const pkgVersion = "2.0.0-dev-rc.3.0.0.250606";
8
+ export const pkgVersion = "2.0.0-dev-rc.3.0.0.254274";
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.3.0.0.250606\";\n"]}
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.254274\";\n"]}
@@ -8,7 +8,7 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
8
8
  import { ISharedObject } from '@fluidframework/shared-object-base';
9
9
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
10
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
- import { SharedObject } from '@fluidframework/shared-object-base';
11
+ import { SharedObject } from '@fluidframework/shared-object-base/internal';
12
12
 
13
13
  /**
14
14
  * {@inheritDoc IConsensusRegisterCollection}
@@ -8,7 +8,7 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
8
8
  import { ISharedObject } from '@fluidframework/shared-object-base';
9
9
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
10
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
- import { SharedObject } from '@fluidframework/shared-object-base';
11
+ import { SharedObject } from '@fluidframework/shared-object-base/internal';
12
12
 
13
13
  /* Excluded from this release type: ConsensusRegisterCollection */
14
14
 
@@ -8,7 +8,7 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
8
8
  import { ISharedObject } from '@fluidframework/shared-object-base';
9
9
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
10
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
- import { SharedObject } from '@fluidframework/shared-object-base';
11
+ import { SharedObject } from '@fluidframework/shared-object-base/internal';
12
12
 
13
13
  /* Excluded from this release type: ConsensusRegisterCollection */
14
14
 
@@ -8,7 +8,7 @@ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions'
8
8
  import { ISharedObject } from '@fluidframework/shared-object-base';
9
9
  import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
10
10
  import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
11
- import { SharedObject } from '@fluidframework/shared-object-base';
11
+ import { SharedObject } from '@fluidframework/shared-object-base/internal';
12
12
 
13
13
  /**
14
14
  * {@inheritDoc IConsensusRegisterCollection}
@@ -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.42.3"
9
+ }
10
+ ]
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/register-collection",
3
- "version": "2.0.0-dev-rc.3.0.0.250606",
3
+ "version": "2.0.0-dev-rc.3.0.0.254274",
4
4
  "description": "Consensus Register",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -14,16 +14,6 @@
14
14
  "type": "module",
15
15
  "exports": {
16
16
  ".": {
17
- "import": {
18
- "types": "./lib/index.d.ts",
19
- "default": "./lib/index.js"
20
- },
21
- "require": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/index.js"
24
- }
25
- },
26
- "./public": {
27
17
  "import": {
28
18
  "types": "./lib/register-collection-public.d.ts",
29
19
  "default": "./lib/index.js"
@@ -55,7 +45,7 @@
55
45
  }
56
46
  },
57
47
  "main": "dist/index.js",
58
- "types": "dist/index.d.ts",
48
+ "types": "./dist/register-collection-public.d.ts",
59
49
  "c8": {
60
50
  "all": true,
61
51
  "cache-dir": "nyc/.cache",
@@ -77,26 +67,26 @@
77
67
  "temp-directory": "nyc/.nyc_output"
78
68
  },
79
69
  "dependencies": {
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",
70
+ "@fluid-internal/client-utils": "2.0.0-dev-rc.3.0.0.254274",
71
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.3.0.0.254274",
72
+ "@fluidframework/core-utils": "2.0.0-dev-rc.3.0.0.254274",
73
+ "@fluidframework/datastore-definitions": "2.0.0-dev-rc.3.0.0.254274",
74
+ "@fluidframework/driver-utils": "2.0.0-dev-rc.3.0.0.254274",
85
75
  "@fluidframework/protocol-definitions": "^3.2.0",
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"
76
+ "@fluidframework/runtime-definitions": "2.0.0-dev-rc.3.0.0.254274",
77
+ "@fluidframework/shared-object-base": "2.0.0-dev-rc.3.0.0.254274"
88
78
  },
89
79
  "devDependencies": {
90
- "@arethetypeswrong/cli": "^0.13.3",
80
+ "@arethetypeswrong/cli": "^0.15.2",
91
81
  "@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",
82
+ "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.3.0.0.254274",
83
+ "@fluid-private/test-dds-utils": "2.0.0-dev-rc.3.0.0.254274",
94
84
  "@fluid-tools/build-cli": "^0.34.0",
95
85
  "@fluidframework/build-common": "^2.0.3",
96
86
  "@fluidframework/build-tools": "^0.34.0",
97
87
  "@fluidframework/eslint-config-fluid": "^5.1.0",
98
88
  "@fluidframework/register-collection-previous": "npm:@fluidframework/register-collection@2.0.0-internal.8.0.0",
99
- "@fluidframework/test-runtime-utils": "2.0.0-dev-rc.3.0.0.250606",
89
+ "@fluidframework/test-runtime-utils": "2.0.0-dev-rc.3.0.0.254274",
100
90
  "@microsoft/api-extractor": "^7.42.3",
101
91
  "@types/mocha": "^9.1.1",
102
92
  "@types/node": "^18.19.0",
@@ -142,7 +132,6 @@
142
132
  "build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
143
133
  "build:test:esm": "tsc --project ./src/test/tsconfig.json",
144
134
  "check:are-the-types-wrong": "attw --pack . --entrypoints .",
145
- "check:biome": "biome check .",
146
135
  "check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
147
136
  "check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
148
137
  "ci:build:docs": "api-extractor run",
@@ -150,7 +139,6 @@
150
139
  "eslint": "eslint --format stylish src",
151
140
  "eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
152
141
  "format": "fluid-build --task format .",
153
- "format:biome": "biome check --apply .",
154
142
  "format:prettier": "prettier --write . --cache --ignore-path ../../../.prettierignore",
155
143
  "lint": "fluid-build . --task lint",
156
144
  "lint:fix": "fluid-build . --task eslint:fix --task format",
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { bufferToString } from "@fluid-internal/client-utils";
7
- import { assert, unreachableCase } from "@fluidframework/core-utils";
7
+ import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
8
8
  import {
9
9
  IChannelAttributes,
10
10
  IChannelStorageService,
@@ -12,11 +12,9 @@ import {
12
12
  } from "@fluidframework/datastore-definitions";
13
13
  import { ISequencedDocumentMessage, MessageType } from "@fluidframework/protocol-definitions";
14
14
  import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
15
- import {
16
- IFluidSerializer,
17
- SharedObject,
18
- createSingleBlobSummary,
19
- } from "@fluidframework/shared-object-base";
15
+ import { IFluidSerializer } from "@fluidframework/shared-object-base";
16
+ import { SharedObject, createSingleBlobSummary } from "@fluidframework/shared-object-base/internal";
17
+
20
18
  import { ConsensusRegisterCollectionFactory } from "./consensusRegisterCollectionFactory.js";
21
19
  import {
22
20
  IConsensusRegisterCollection,
@@ -8,6 +8,7 @@ import {
8
8
  IChannelServices,
9
9
  IFluidDataStoreRuntime,
10
10
  } from "@fluidframework/datastore-definitions";
11
+
11
12
  import { ConsensusRegisterCollection } from "./consensusRegisterCollection.js";
12
13
  import { IConsensusRegisterCollection, IConsensusRegisterCollectionFactory } from "./interfaces.js";
13
14
  import { pkgVersion } from "./packageVersion.js";
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/register-collection";
9
- export const pkgVersion = "2.0.0-dev-rc.3.0.0.250606";
9
+ export const pkgVersion = "2.0.0-dev-rc.3.0.0.254274";
@@ -1,281 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { strict as assert } from "assert";
6
- import { runGCTests } from "@fluid-private/test-dds-utils";
7
- import { BlobTreeEntry } from "@fluidframework/driver-utils";
8
- import { MockContainerRuntimeFactory, MockContainerRuntimeFactoryForReconnection, MockEmptyDeltaConnection, MockFluidDataStoreRuntime, MockStorage, } from "@fluidframework/test-runtime-utils";
9
- import { ConsensusRegisterCollectionFactory } from "../consensusRegisterCollectionFactory.js";
10
- function createConnectedCollection(id, runtimeFactory) {
11
- const dataStoreRuntime = new MockFluidDataStoreRuntime();
12
- runtimeFactory.createContainerRuntime(dataStoreRuntime);
13
- const services = {
14
- deltaConnection: dataStoreRuntime.createDeltaConnection(),
15
- objectStorage: new MockStorage(),
16
- };
17
- const crcFactory = new ConsensusRegisterCollectionFactory();
18
- const collection = crcFactory.create(dataStoreRuntime, id);
19
- collection.connect(services);
20
- return collection;
21
- }
22
- function createLocalCollection(id) {
23
- const factory = new ConsensusRegisterCollectionFactory();
24
- return factory.create(new MockFluidDataStoreRuntime(), id);
25
- }
26
- function createCollectionForReconnection(id, runtimeFactory) {
27
- const dataStoreRuntime = new MockFluidDataStoreRuntime();
28
- const containerRuntime = runtimeFactory.createContainerRuntime(dataStoreRuntime);
29
- const services = {
30
- deltaConnection: dataStoreRuntime.createDeltaConnection(),
31
- objectStorage: new MockStorage(),
32
- };
33
- const crcFactory = new ConsensusRegisterCollectionFactory();
34
- const collection = crcFactory.create(dataStoreRuntime, id);
35
- collection.connect(services);
36
- return { collection, containerRuntime };
37
- }
38
- describe("ConsensusRegisterCollection", () => {
39
- describe("Single connected client", () => {
40
- const collectionId = "consensus-register-collection";
41
- let crc;
42
- let containerRuntimeFactory;
43
- beforeEach(() => {
44
- containerRuntimeFactory = new MockContainerRuntimeFactory();
45
- crc = createConnectedCollection(collectionId, containerRuntimeFactory);
46
- });
47
- async function writeAndProcessMsg(key, value) {
48
- const waitP = crc.write(key, value);
49
- containerRuntimeFactory.processAllMessages();
50
- return waitP;
51
- }
52
- describe("API", () => {
53
- it("Can create a collection", () => {
54
- assert.ok(crc);
55
- });
56
- it("Can add and remove data", async () => {
57
- assert.strictEqual(crc.read("key1"), undefined);
58
- const writeResult = await writeAndProcessMsg("key1", "val1");
59
- assert.strictEqual(crc.read("key1"), "val1");
60
- assert.strictEqual(writeResult, true, "No concurrency expected");
61
- });
62
- it("Can add and remove a handle", async () => {
63
- assert.strictEqual(crc.read("key1"), undefined);
64
- const handle = crc.handle;
65
- if (handle === undefined) {
66
- assert.fail("Need an actual handle to test this case");
67
- }
68
- const writeResult = await writeAndProcessMsg("key1", handle);
69
- const readValue = crc.read("key1");
70
- assert.strictEqual(readValue.absolutePath, handle.absolutePath);
71
- assert.strictEqual(writeResult, true, "No concurrency expected");
72
- });
73
- it("Change events emit the right key/value", async () => {
74
- crc.on("atomicChanged", (key, value, local) => {
75
- assert.strictEqual(key, "key1", "atomicChanged event emitted the wrong key");
76
- assert.strictEqual(value, "val1", "atomicChanged event emitted the wrong value");
77
- });
78
- crc.on("versionChanged", (key, value, local) => {
79
- assert.strictEqual(key, "key1", "versionChanged event emitted the wrong key");
80
- assert.strictEqual(value, "val1", "versionChanged event emitted the wrong value");
81
- });
82
- await writeAndProcessMsg("key1", "val1");
83
- });
84
- });
85
- describe("Summary", () => {
86
- const snapshotFileName = "header";
87
- const expectedSerialization = JSON.stringify({
88
- key1: {
89
- atomic: { sequenceNumber: 1, value: { type: "Plain", value: "val1.1" } },
90
- versions: [{ sequenceNumber: 1, value: { type: "Plain", value: "val1.1" } }],
91
- },
92
- });
93
- const legacySharedObjectSerialization = JSON.stringify({
94
- key1: {
95
- atomic: { sequenceNumber: 1, value: { type: "Shared", value: "sharedObjId" } },
96
- versions: [
97
- { sequenceNumber: 1, value: { type: "Shared", value: "sharedObjId" } },
98
- ],
99
- },
100
- });
101
- const buildTree = (serialized) => ({
102
- entries: [new BlobTreeEntry(snapshotFileName, serialized)],
103
- });
104
- it("summarize", async () => {
105
- await writeAndProcessMsg("key1", "val1.1");
106
- const summaryTree = crc.getAttachSummary().summary;
107
- assert(Object.keys(summaryTree.tree).length === 1, "summarize should return a tree with single blob");
108
- const serialized = summaryTree.tree.header?.content;
109
- assert(serialized, "summarize should return a tree with blob with contents");
110
- assert.strictEqual(serialized, expectedSerialization);
111
- });
112
- it("load", async () => {
113
- const tree = buildTree(expectedSerialization);
114
- const services = {
115
- deltaConnection: new MockEmptyDeltaConnection(),
116
- objectStorage: new MockStorage(tree),
117
- };
118
- const crcFactory = new ConsensusRegisterCollectionFactory();
119
- const loadedCrc = await crcFactory.load(new MockFluidDataStoreRuntime(), collectionId, services, ConsensusRegisterCollectionFactory.Attributes);
120
- assert.strictEqual(loadedCrc.read("key1"), "val1.1");
121
- });
122
- it("load with SharedObject not supported", async () => {
123
- const tree = buildTree(legacySharedObjectSerialization);
124
- const services = {
125
- deltaConnection: new MockEmptyDeltaConnection(),
126
- objectStorage: new MockStorage(tree),
127
- };
128
- const crcFactory = new ConsensusRegisterCollectionFactory();
129
- await assert.rejects(crcFactory.load(new MockFluidDataStoreRuntime(), collectionId, services, ConsensusRegisterCollectionFactory.Attributes), "SharedObjects contained in ConsensusRegisterCollection can no longer be deserialized");
130
- });
131
- });
132
- });
133
- describe("Multiple Clients", () => {
134
- describe("Local state", () => {
135
- let containerRuntimeFactory;
136
- let testCollection1;
137
- let testCollection2;
138
- beforeEach(() => {
139
- containerRuntimeFactory = new MockContainerRuntimeFactoryForReconnection();
140
- testCollection1 = createLocalCollection("collection1");
141
- testCollection2 = createLocalCollection("collection2");
142
- });
143
- it("should not send ops when the collection is not connected", async () => {
144
- // Add a listener to the second collection. This is used to verify that the written value reaches
145
- // the remote client.
146
- let receivedValue = "";
147
- testCollection2.on("atomicChanged", (key, value) => {
148
- receivedValue = value;
149
- });
150
- // Write to the first register collection.
151
- const testValue = "testValue";
152
- const writeP = testCollection1.write("key", testValue);
153
- // Process the messages.
154
- containerRuntimeFactory.processAllMessages();
155
- // Verify that the first collection successfully writes and is the winner.
156
- const winner = await writeP;
157
- assert.equal(winner, true, "Write was not successful");
158
- // Verify that the remote client does not get this write because the DDS is not connected.
159
- assert.equal(receivedValue, "", "The remote client should not have received the write");
160
- });
161
- });
162
- describe("Reconnection", () => {
163
- const testKey = "testKey";
164
- const testValue = "testValue";
165
- let receivedKey = "";
166
- let receivedValue = "";
167
- let receivedLocalStatus = true;
168
- let containerRuntimeFactory;
169
- let containerRuntime1;
170
- let testCollection1;
171
- let testCollection2;
172
- beforeEach(() => {
173
- containerRuntimeFactory = new MockContainerRuntimeFactoryForReconnection();
174
- const response1 = createCollectionForReconnection("collection1", containerRuntimeFactory);
175
- testCollection1 = response1.collection;
176
- containerRuntime1 = response1.containerRuntime;
177
- const response2 = createCollectionForReconnection("collection2", containerRuntimeFactory);
178
- testCollection2 = response2.collection;
179
- // Add a listener to the second collection. This is used to verify that the written value reaches
180
- // the remote client.
181
- testCollection2.on("atomicChanged", (key, value, local) => {
182
- receivedKey = key;
183
- receivedValue = value;
184
- receivedLocalStatus = local;
185
- });
186
- });
187
- it("can resend unacked ops on reconnection", async () => {
188
- // Write to the first register collection.
189
- const writeP = testCollection1.write(testKey, testValue);
190
- // Disconnect and reconnect the first collection.
191
- containerRuntime1.connected = false;
192
- containerRuntime1.connected = true;
193
- // Process the messages.
194
- containerRuntimeFactory.processAllMessages();
195
- // Verify that the first collection successfully writes and is the winner.
196
- const winner = await writeP;
197
- assert.equal(winner, true, "Write was not successful");
198
- // Verify that the remote register collection received the write.
199
- assert.equal(receivedKey, testKey, "The remote client did not receive the key");
200
- assert.equal(receivedValue, testValue, "The remote client did not receive the value");
201
- assert.equal(receivedLocalStatus, false, "The remote client's value should not be local");
202
- });
203
- it("can store ops in disconnected state and resend them on reconnection", async () => {
204
- // Disconnect the first collection.
205
- containerRuntime1.connected = false;
206
- // Write to the first register collection.
207
- const writeP = testCollection1.write(testKey, testValue);
208
- // Reconnect the first collection.
209
- containerRuntime1.connected = true;
210
- // Process the messages.
211
- containerRuntimeFactory.processAllMessages();
212
- // Verify that the first collection successfully writes and is the winner.
213
- const winner = await writeP;
214
- assert.equal(winner, true, "Write was not successful");
215
- // Verify that the remote register collection received the write.
216
- assert.equal(receivedKey, testKey, "The remote client did not receive the key");
217
- assert.equal(receivedValue, testValue, "The remote client did not receive the value");
218
- assert.equal(receivedLocalStatus, false, "The remote client's value should not be local");
219
- });
220
- afterEach(() => {
221
- receivedKey = "";
222
- receivedValue = "";
223
- receivedLocalStatus = true;
224
- });
225
- });
226
- });
227
- describe("Garbage Collection", () => {
228
- class GCRegisteredCollectionProvider {
229
- constructor() {
230
- this.subCollectionCount = 0;
231
- this._expectedRoutes = [];
232
- this.containerRuntimeFactory = new MockContainerRuntimeFactory();
233
- this.collection1 = createConnectedCollection("collection1", this.containerRuntimeFactory);
234
- this.collection2 = createConnectedCollection("collection2", this.containerRuntimeFactory);
235
- }
236
- async writeAndProcessMsg(key, value) {
237
- const waitP = this.collection1.write(key, value);
238
- this.containerRuntimeFactory.processAllMessages();
239
- return waitP;
240
- }
241
- get sharedObject() {
242
- // Return the remote collection because we want to verify its summary data.
243
- return this.collection2;
244
- }
245
- get expectedOutboundRoutes() {
246
- return this._expectedRoutes;
247
- }
248
- async addOutboundRoutes() {
249
- const subCollectionId = `subCollection-${++this.subCollectionCount}`;
250
- const subTestCollection = createLocalCollection(subCollectionId);
251
- await this.writeAndProcessMsg(subCollectionId, subTestCollection.handle);
252
- this._expectedRoutes.push(subTestCollection.handle.absolutePath);
253
- }
254
- async deleteOutboundRoutes() {
255
- const subCollectionId = `subCollection-${this.subCollectionCount}`;
256
- const deletedHandle = this.collection1.read(subCollectionId);
257
- assert(deletedHandle, "Route must be added before deleting");
258
- // Delete the last handle that was added.
259
- await this.writeAndProcessMsg(subCollectionId, "nonHandleValue");
260
- // Remove deleted handle's route from expected routes.
261
- this._expectedRoutes = this._expectedRoutes.filter((route) => route !== deletedHandle.absolutePath);
262
- }
263
- async addNestedHandles() {
264
- const subCollectionId1 = `subCollection-${++this.subCollectionCount}`;
265
- const subCollectionId2 = `subCollection-${++this.subCollectionCount}`;
266
- const subTestCollection1 = createLocalCollection(subCollectionId1);
267
- const subTestCollection2 = createLocalCollection(subCollectionId2);
268
- const containingObject = {
269
- collection1Handle: subTestCollection1.handle,
270
- nestedObj: {
271
- collection2Handle: subTestCollection2.handle,
272
- },
273
- };
274
- await this.writeAndProcessMsg(subCollectionId2, containingObject);
275
- this._expectedRoutes.push(subTestCollection1.handle.absolutePath, subTestCollection2.handle.absolutePath);
276
- }
277
- }
278
- runGCTests(GCRegisteredCollectionProvider);
279
- });
280
- });
281
- //# sourceMappingURL=consensusRegisterCollection.spec.js.map
@@ -1 +0,0 @@
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,UAA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,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 { 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"]}
@@ -1,14 +0,0 @@
1
- use_current_ClassDeclaration_ConsensusRegisterCollection(get_old_ClassDeclaration_ConsensusRegisterCollection());
2
- use_old_ClassDeclaration_ConsensusRegisterCollection(get_current_ClassDeclaration_ConsensusRegisterCollection());
3
- use_current_ClassDeclaration_ConsensusRegisterCollectionFactory(get_old_ClassDeclaration_ConsensusRegisterCollectionFactory());
4
- use_old_ClassDeclaration_ConsensusRegisterCollectionFactory(get_current_ClassDeclaration_ConsensusRegisterCollectionFactory());
5
- use_current_InterfaceDeclaration_IConsensusRegisterCollection(get_old_InterfaceDeclaration_IConsensusRegisterCollection());
6
- use_old_InterfaceDeclaration_IConsensusRegisterCollection(get_current_InterfaceDeclaration_IConsensusRegisterCollection());
7
- use_current_InterfaceDeclaration_IConsensusRegisterCollectionEvents(get_old_InterfaceDeclaration_IConsensusRegisterCollectionEvents());
8
- use_old_InterfaceDeclaration_IConsensusRegisterCollectionEvents(get_current_InterfaceDeclaration_IConsensusRegisterCollectionEvents());
9
- use_current_InterfaceDeclaration_IConsensusRegisterCollectionFactory(get_old_InterfaceDeclaration_IConsensusRegisterCollectionFactory());
10
- use_old_InterfaceDeclaration_IConsensusRegisterCollectionFactory(get_current_InterfaceDeclaration_IConsensusRegisterCollectionFactory());
11
- use_current_EnumDeclaration_ReadPolicy(get_old_EnumDeclaration_ReadPolicy());
12
- use_old_EnumDeclaration_ReadPolicy(get_current_EnumDeclaration_ReadPolicy());
13
- export {};
14
- //# sourceMappingURL=validateRegisterCollectionPrevious.generated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateRegisterCollectionPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateRegisterCollectionPrevious.generated.ts"],"names":[],"mappings":"AAgCA,wDAAwD,CACpD,oDAAoD,EAAE,CAAC,CAAC;AAW5D,oDAAoD,CAChD,wDAAwD,EAAE,CAAC,CAAC;AAWhE,+DAA+D,CAC3D,2DAA2D,EAAE,CAAC,CAAC;AAWnE,2DAA2D,CACvD,+DAA+D,EAAE,CAAC,CAAC;AAWvE,6DAA6D,CACzD,yDAAyD,EAAE,CAAC,CAAC;AAWjE,yDAAyD,CACrD,6DAA6D,EAAE,CAAC,CAAC;AAWrE,mEAAmE,CAC/D,+DAA+D,EAAE,CAAC,CAAC;AAWvE,+DAA+D,CAC3D,mEAAmE,EAAE,CAAC,CAAC;AAW3E,oEAAoE,CAChE,gEAAgE,EAAE,CAAC,CAAC;AAWxE,gEAAgE,CAC5D,oEAAoE,EAAE,CAAC,CAAC;AAW5E,sCAAsC,CAClC,kCAAkC,EAAE,CAAC,CAAC;AAW1C,kCAAkC,CAC9B,sCAAsC,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/register-collection-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_ConsensusRegisterCollection\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_ConsensusRegisterCollection():\n TypeOnly<old.ConsensusRegisterCollection<any>>;\ndeclare function use_current_ClassDeclaration_ConsensusRegisterCollection(\n use: TypeOnly<current.ConsensusRegisterCollection<any>>): void;\nuse_current_ClassDeclaration_ConsensusRegisterCollection(\n get_old_ClassDeclaration_ConsensusRegisterCollection());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_ConsensusRegisterCollection\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_ConsensusRegisterCollection():\n TypeOnly<current.ConsensusRegisterCollection<any>>;\ndeclare function use_old_ClassDeclaration_ConsensusRegisterCollection(\n use: TypeOnly<old.ConsensusRegisterCollection<any>>): void;\nuse_old_ClassDeclaration_ConsensusRegisterCollection(\n get_current_ClassDeclaration_ConsensusRegisterCollection());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_ConsensusRegisterCollectionFactory\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_ConsensusRegisterCollectionFactory():\n TypeOnly<old.ConsensusRegisterCollectionFactory>;\ndeclare function use_current_ClassDeclaration_ConsensusRegisterCollectionFactory(\n use: TypeOnly<current.ConsensusRegisterCollectionFactory>): void;\nuse_current_ClassDeclaration_ConsensusRegisterCollectionFactory(\n get_old_ClassDeclaration_ConsensusRegisterCollectionFactory());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_ConsensusRegisterCollectionFactory\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_ConsensusRegisterCollectionFactory():\n TypeOnly<current.ConsensusRegisterCollectionFactory>;\ndeclare function use_old_ClassDeclaration_ConsensusRegisterCollectionFactory(\n use: TypeOnly<old.ConsensusRegisterCollectionFactory>): void;\nuse_old_ClassDeclaration_ConsensusRegisterCollectionFactory(\n get_current_ClassDeclaration_ConsensusRegisterCollectionFactory());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IConsensusRegisterCollection\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IConsensusRegisterCollection():\n TypeOnly<old.IConsensusRegisterCollection>;\ndeclare function use_current_InterfaceDeclaration_IConsensusRegisterCollection(\n use: TypeOnly<current.IConsensusRegisterCollection>): void;\nuse_current_InterfaceDeclaration_IConsensusRegisterCollection(\n get_old_InterfaceDeclaration_IConsensusRegisterCollection());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IConsensusRegisterCollection\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IConsensusRegisterCollection():\n TypeOnly<current.IConsensusRegisterCollection>;\ndeclare function use_old_InterfaceDeclaration_IConsensusRegisterCollection(\n use: TypeOnly<old.IConsensusRegisterCollection>): void;\nuse_old_InterfaceDeclaration_IConsensusRegisterCollection(\n get_current_InterfaceDeclaration_IConsensusRegisterCollection());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IConsensusRegisterCollectionEvents\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IConsensusRegisterCollectionEvents():\n TypeOnly<old.IConsensusRegisterCollectionEvents>;\ndeclare function use_current_InterfaceDeclaration_IConsensusRegisterCollectionEvents(\n use: TypeOnly<current.IConsensusRegisterCollectionEvents>): void;\nuse_current_InterfaceDeclaration_IConsensusRegisterCollectionEvents(\n get_old_InterfaceDeclaration_IConsensusRegisterCollectionEvents());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IConsensusRegisterCollectionEvents\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IConsensusRegisterCollectionEvents():\n TypeOnly<current.IConsensusRegisterCollectionEvents>;\ndeclare function use_old_InterfaceDeclaration_IConsensusRegisterCollectionEvents(\n use: TypeOnly<old.IConsensusRegisterCollectionEvents>): void;\nuse_old_InterfaceDeclaration_IConsensusRegisterCollectionEvents(\n get_current_InterfaceDeclaration_IConsensusRegisterCollectionEvents());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IConsensusRegisterCollectionFactory\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IConsensusRegisterCollectionFactory():\n TypeOnly<old.IConsensusRegisterCollectionFactory>;\ndeclare function use_current_InterfaceDeclaration_IConsensusRegisterCollectionFactory(\n use: TypeOnly<current.IConsensusRegisterCollectionFactory>): void;\nuse_current_InterfaceDeclaration_IConsensusRegisterCollectionFactory(\n get_old_InterfaceDeclaration_IConsensusRegisterCollectionFactory());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IConsensusRegisterCollectionFactory\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IConsensusRegisterCollectionFactory():\n TypeOnly<current.IConsensusRegisterCollectionFactory>;\ndeclare function use_old_InterfaceDeclaration_IConsensusRegisterCollectionFactory(\n use: TypeOnly<old.IConsensusRegisterCollectionFactory>): void;\nuse_old_InterfaceDeclaration_IConsensusRegisterCollectionFactory(\n get_current_InterfaceDeclaration_IConsensusRegisterCollectionFactory());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"EnumDeclaration_ReadPolicy\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_EnumDeclaration_ReadPolicy():\n TypeOnly<old.ReadPolicy>;\ndeclare function use_current_EnumDeclaration_ReadPolicy(\n use: TypeOnly<current.ReadPolicy>): void;\nuse_current_EnumDeclaration_ReadPolicy(\n get_old_EnumDeclaration_ReadPolicy());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"EnumDeclaration_ReadPolicy\": {\"backCompat\": false}\n*/\ndeclare function get_current_EnumDeclaration_ReadPolicy():\n TypeOnly<current.ReadPolicy>;\ndeclare function use_old_EnumDeclaration_ReadPolicy(\n use: TypeOnly<old.ReadPolicy>): void;\nuse_old_EnumDeclaration_ReadPolicy(\n get_current_EnumDeclaration_ReadPolicy());\n"]}