@fluidframework/cell 2.70.0-361248 → 2.70.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/cell
2
2
 
3
+ ## 2.70.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.63.0
4
8
 
5
9
  Dependency updates only.
package/dist/cell.d.ts CHANGED
@@ -3,8 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IChannelAttributes, IFluidDataStoreRuntime, Serializable, IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
- import { type ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
7
- import type { ISummaryTreeWithStats, AttributionKey } from "@fluidframework/runtime-definitions/internal";
6
+ import type { ISummaryTreeWithStats, AttributionKey, IRuntimeMessageCollection } from "@fluidframework/runtime-definitions/internal";
8
7
  import type { IFluidSerializer } from "@fluidframework/shared-object-base/internal";
9
8
  import { SharedObject } from "@fluidframework/shared-object-base/internal";
10
9
  import type { ISharedCell, ISharedCellEvents } from "./interfaces.js";
@@ -87,14 +86,10 @@ export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<
87
86
  */
88
87
  private applyInnerOp;
89
88
  /**
90
- * Process a cell operation (op).
91
- *
92
- * @param message - The message to prepare.
93
- * @param local - Whether or not the message was sent by the local client.
94
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
95
- * For messages from a remote client, this will be `undefined`.
89
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
96
90
  */
97
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
91
+ protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void;
92
+ private processMessage;
98
93
  private setCore;
99
94
  private deleteCore;
100
95
  private createLocalOpMetadata;
@@ -1 +1 @@
1
- {"version":3,"file":"cell.d.ts","sourceRoot":"","sources":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AC,OAAO;IAOf,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,qBAAqB;IAa7B;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAiBhD;;;;;OAKG;IAGH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAmBhE;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;CAIzB"}
package/dist/cell.js CHANGED
@@ -97,10 +97,10 @@ class SharedCell extends internal_4.SharedObject {
97
97
  * Set the Op-based attribution through the SequencedDocumentMessage,
98
98
  * or set the local/detached attribution.
99
99
  */
100
- setAttribution(message) {
100
+ setAttribution(messageEnvelope) {
101
101
  if (this.options?.attribution?.track ?? false) {
102
- this.attribution = message
103
- ? { type: "op", seq: message.sequenceNumber }
102
+ this.attribution = messageEnvelope
103
+ ? { type: "op", seq: messageEnvelope.sequenceNumber }
104
104
  : this.isAttached()
105
105
  ? { type: "local" }
106
106
  : { type: "detached", id: 0 };
@@ -154,15 +154,16 @@ class SharedCell extends internal_4.SharedObject {
154
154
  }
155
155
  }
156
156
  /**
157
- * Process a cell operation (op).
158
- *
159
- * @param message - The message to prepare.
160
- * @param local - Whether or not the message was sent by the local client.
161
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
162
- * For messages from a remote client, this will be `undefined`.
157
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
163
158
  */
164
- processCore(message, local, localOpMetadata) {
165
- const cellOpMetadata = localOpMetadata;
159
+ processMessagesCore(messagesCollection) {
160
+ const { envelope, local, messagesContent } = messagesCollection;
161
+ for (const messageContent of messagesContent) {
162
+ this.processMessage(envelope, messageContent, local);
163
+ }
164
+ }
165
+ processMessage(messageEnvelope, messageContent, local) {
166
+ const cellOpMetadata = messageContent.localOpMetadata;
166
167
  if (this.messageId !== this.messageIdObserved) {
167
168
  // We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.
168
169
  if (local) {
@@ -174,15 +175,15 @@ class SharedCell extends internal_4.SharedObject {
174
175
  // We got an ACK. Update messageIdObserved.
175
176
  this.messageIdObserved = cellOpMetadata.pendingMessageId;
176
177
  // update the attributor
177
- this.setAttribution(message);
178
+ this.setAttribution(messageEnvelope);
178
179
  }
179
180
  return;
180
181
  }
181
182
  // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
182
- if (message.type === internal_2.MessageType.Operation && !local) {
183
- const op = message.contents;
183
+ if (messageEnvelope.type === internal_2.MessageType.Operation && !local) {
184
+ const op = messageContent.contents;
184
185
  // update the attributor
185
- this.setAttribution(message);
186
+ this.setAttribution(messageEnvelope);
186
187
  this.applyInnerOp(op);
187
188
  }
188
189
  }
package/dist/cell.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cell.js","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAO9E,0EAGqD;AACrD,oEAAqE;AAMrE,0EAGqD;AAkCrD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;GAEG;AACH,iDAAiD;AACjD,8DAA8D;AAC9D,MAAa,UACZ,SAAQ,uBAAkC;IA0B1C;;;;;;OAMG;IACH,4EAA4E;IAC5E,YAAY,EAAU,EAAE,OAA+B,EAAE,UAA8B;QACtF,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;QA3B/C;;;WAGG;QACK,cAAS,GAAW,CAAC,CAAC,CAAC;QAE/B;;;WAGG;QACK,sBAAiB,GAAW,CAAC,CAAC,CAAC;QAEtB,sBAAiB,GAAa,EAAE,CAAC;QAiBjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAuB,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,GAAG;QACT,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,GAAG,CAAC,KAAsB;QA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AAM,cAAc,GAAG,eAAuC,CAAC;QAC/D,sEAAsE;QACtE,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YACjE,IAAI,cAAc,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;gBAChD,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,aAAgC,CAAC,CAAC;YAC/D,CAAC;YAED,MAAM,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;YAC1D,IAAI,oBAAoB,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC5D,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAChD,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACK,iBAAiB,CAAC,EAAkB,EAAE,aAA+B;QAC5E,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;QACpE,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC5C,CAAC;CACD;AAnTD,gCAmTC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tSerializable,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tAttributionKey,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type {\n\tICellLocalOpMetadata,\n\tICellOptions,\n\tISharedCell,\n\tISharedCellEvents,\n} from \"./interfaces.js\";\n\n/**\n * Description of a cell delta operation\n */\ntype ICellOperation = ISetCellOperation | IDeleteCellOperation;\n\ninterface ISetCellOperation {\n\ttype: \"setCell\";\n\tvalue: ICellValue;\n}\n\ninterface IDeleteCellOperation {\n\ttype: \"deleteCell\";\n}\n\ninterface ICellValue {\n\t/**\n\t * The actual value contained in the `Cell`, which needs to be wrapped to handle `undefined`.\n\t */\n\tvalue: unknown;\n\t/**\n\t * The attribution key contained in the `Cell`.\n\t */\n\tattribution?: AttributionKey;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCell}\n */\n// TODO: use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class SharedCell<T = any>\n\textends SharedObject<ISharedCellEvents<T>>\n\timplements ISharedCell<T>\n{\n\t/**\n\t * The data held by this cell.\n\t */\n\tprivate data: Serializable<T> | undefined;\n\n\t/**\n\t * This is used to assign a unique id to outgoing messages. It is used to track messages until\n\t * they are ack'd.\n\t */\n\tprivate messageId: number = -1;\n\n\t/**\n\t * This keeps track of the messageId of messages that have been ack'd. It is updated every time\n\t * we a message is ack'd with it's messageId.\n\t */\n\tprivate messageIdObserved: number = -1;\n\n\tprivate readonly pendingMessageIds: number[] = [];\n\n\tprivate attribution: AttributionKey | undefined;\n\n\tprivate readonly options: ICellOptions | undefined;\n\n\t/**\n\t * Constructs a new `SharedCell`.\n\t * If the object is non-local an id and service interfaces will be provided.\n\t *\n\t * @param runtime - The data store runtime to which the `SharedCell` belongs.\n\t * @param id - Unique identifier for the `SharedCell`.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n\tconstructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n\t\tsuper(id, runtime, attributes, \"fluid_cell_\");\n\n\t\tthis.options = runtime.options as ICellOptions;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.get}\n\t */\n\tpublic get(): Serializable<T> | undefined {\n\t\treturn this.data;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.set}\n\t */\n\tpublic set(value: Serializable<T>): void {\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(value);\n\t\tthis.setAttribution();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst operationValue: ICellValue = {\n\t\t\tvalue,\n\t\t};\n\n\t\tconst op: ISetCellOperation = {\n\t\t\ttype: \"setCell\",\n\t\t\tvalue: operationValue,\n\t\t};\n\t\tthis.submitCellMessage(op, previousValue);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.delete}\n\t */\n\tpublic delete(): void {\n\t\t// Delete the value locally.\n\t\tconst previousValue = this.deleteCore();\n\t\tthis.setAttribution();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst op: IDeleteCellOperation = {\n\t\t\ttype: \"deleteCell\",\n\t\t};\n\t\tthis.submitCellMessage(op, previousValue);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.empty}\n\t */\n\tpublic empty(): boolean {\n\t\treturn this.data === undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.getAttribution}\n\t */\n\tpublic getAttribution(): AttributionKey | undefined {\n\t\treturn this.attribution;\n\t}\n\n\t/**\n\t * Set the Op-based attribution through the SequencedDocumentMessage,\n\t * or set the local/detached attribution.\n\t */\n\tprivate setAttribution(message?: ISequencedDocumentMessage): void {\n\t\tif (this.options?.attribution?.track ?? false) {\n\t\t\tthis.attribution = message\n\t\t\t\t? { type: \"op\", seq: message.sequenceNumber }\n\t\t\t\t: this.isAttached()\n\t\t\t\t\t? { type: \"local\" }\n\t\t\t\t\t: { type: \"detached\", id: 0 };\n\t\t}\n\t}\n\n\t/**\n\t * Creates a summary for the Cell.\n\t *\n\t * @returns The summary of the current state of the Cell.\n\t */\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst content: ICellValue =\n\t\t\tthis.attribution?.type === \"local\"\n\t\t\t\t? { value: this.data, attribution: undefined }\n\t\t\t\t: { value: this.data, attribution: this.attribution };\n\t\treturn createSingleBlobSummary(\n\t\t\tsnapshotFileName,\n\t\t\tserializer.stringify(content, this.handle),\n\t\t);\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 content = await readAndParse<ICellValue>(storage, snapshotFileName);\n\n\t\tthis.data = this.serializer.decode(content.value) as Serializable<T>;\n\t\tthis.attribution = content.attribution;\n\t}\n\n\t/**\n\t * Initialize a local instance of cell.\n\t */\n\tprotected initializeLocalCore(): void {\n\t\tthis.data = undefined;\n\t}\n\n\t/**\n\t * Call back on disconnect.\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Apply inner op.\n\t *\n\t * @param content - ICellOperation content\n\t */\n\tprivate applyInnerOp(content: ICellOperation): Serializable<T> | undefined {\n\t\tswitch (content.type) {\n\t\t\tcase \"setCell\": {\n\t\t\t\treturn this.setCore(content.value.value as Serializable<T>);\n\t\t\t}\n\n\t\t\tcase \"deleteCell\": {\n\t\t\t\treturn this.deleteCore();\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process a cell operation (op).\n\t *\n\t * @param message - The message to prepare.\n\t * @param local - Whether or not the message was sent by the local client.\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be `undefined`.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tconst cellOpMetadata = localOpMetadata as ICellLocalOpMetadata;\n\t\tif (this.messageId !== this.messageIdObserved) {\n\t\t\t// We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.\n\t\t\tif (local) {\n\t\t\t\tconst messageIdReceived = cellOpMetadata.pendingMessageId;\n\t\t\t\tassert(\n\t\t\t\t\tmessageIdReceived !== undefined && messageIdReceived <= this.messageId,\n\t\t\t\t\t0x00c /* \"messageId is incorrect from from the local client's ACK\" */,\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tthis.pendingMessageIds !== undefined &&\n\t\t\t\t\t\tthis.pendingMessageIds[0] === cellOpMetadata.pendingMessageId,\n\t\t\t\t\t0x471 /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tthis.pendingMessageIds.shift();\n\t\t\t\t// We got an ACK. Update messageIdObserved.\n\t\t\t\tthis.messageIdObserved = cellOpMetadata.pendingMessageId;\n\t\t\t\t// update the attributor\n\t\t\t\tthis.setAttribution(message);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation && !local) {\n\t\t\tconst op = message.contents as ICellOperation;\n\t\t\t// update the attributor\n\t\t\tthis.setAttribution(message);\n\t\t\tthis.applyInnerOp(op);\n\t\t}\n\t}\n\n\tprivate setCore(value: Serializable<T>): Serializable<T> | undefined {\n\t\tconst previousLocalValue = this.get();\n\t\tthis.data = value;\n\t\tthis.emit(\"valueChanged\", value);\n\t\treturn previousLocalValue;\n\t}\n\n\tprivate deleteCore(): Serializable<T> | undefined {\n\t\tconst previousLocalValue = this.get();\n\t\tthis.data = undefined;\n\t\tthis.emit(\"delete\");\n\t\treturn previousLocalValue;\n\t}\n\n\tprivate createLocalOpMetadata(\n\t\top: ICellOperation,\n\t\tpreviousValue?: Serializable<T>,\n\t): ICellLocalOpMetadata {\n\t\tconst pendingMessageId = ++this.messageId;\n\t\tthis.pendingMessageIds.push(pendingMessageId);\n\t\tconst localMetadata: ICellLocalOpMetadata = {\n\t\t\tpendingMessageId,\n\t\t\tpreviousValue,\n\t\t};\n\t\treturn localMetadata;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: unknown): void {\n\t\tconst cellContent = content as ICellOperation;\n\t\tswitch (cellContent.type) {\n\t\t\tcase \"deleteCell\": {\n\t\t\t\tthis.delete();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"setCell\": {\n\t\t\t\tthis.set(cellContent.value.value as Serializable<T>);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(cellContent);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Rollback a local op.\n\t *\n\t * @param content - The operation to rollback.\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\t// TODO: use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tconst cellOpMetadata = localOpMetadata as ICellLocalOpMetadata;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\tif (content.type === \"setCell\" || content.type === \"deleteCell\") {\n\t\t\tif (cellOpMetadata.previousValue === undefined) {\n\t\t\t\tthis.deleteCore();\n\t\t\t} else {\n\t\t\t\tthis.setCore(cellOpMetadata.previousValue as Serializable<T>);\n\t\t\t}\n\n\t\t\tconst lastPendingMessageId = this.pendingMessageIds.pop();\n\t\t\tif (lastPendingMessageId !== cellOpMetadata.pendingMessageId) {\n\t\t\t\tthrow new Error(\"Rollback op does not match last pending\");\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/**\n\t * Submit a cell message to remote clients.\n\t *\n\t * @param op - The cell message.\n\t * @param previousValue - The value of the cell before this op.\n\t */\n\tprivate submitCellMessage(op: ICellOperation, previousValue?: Serializable<T>): void {\n\t\tconst localMetadata = this.createLocalOpMetadata(op, previousValue);\n\t\tthis.submitLocalMessage(op, localMetadata);\n\t}\n}\n"]}
1
+ {"version":3,"file":"cell.js","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA8E;AAO9E,0EAA0E;AAC1E,oEAAqE;AASrE,0EAGqD;AAkCrD,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;GAEG;AACH,iDAAiD;AACjD,8DAA8D;AAC9D,MAAa,UACZ,SAAQ,uBAAkC;IA0B1C;;;;;;OAMG;IACH,4EAA4E;IAC5E,YAAY,EAAU,EAAE,OAA+B,EAAE,UAA8B;QACtF,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;QA3B/C;;;WAGG;QACK,cAAS,GAAW,CAAC,CAAC,CAAC;QAE/B;;;WAGG;QACK,sBAAiB,GAAW,CAAC,CAAC,CAAC;QAEtB,sBAAiB,GAAa,EAAE,CAAC;QAiBjD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAuB,CAAC;IAChD,CAAC;IAED;;OAEG;IACI,GAAG;QACT,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED;;OAEG;IACI,GAAG,CAAC,KAAsB;QAChC,yBAAyB;QACzB,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,cAAc,EAAE,CAAC;QAEtB,+CAA+C;QAC/C,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;YACxB,OAAO;QACR,CAAC;QAED,MAAM,cAAc,GAAe;YAClC,KAAK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AAwB;QACxD,MAAM,cAAc,GAAG,eAAuC,CAAC;QAC/D,sEAAsE;QACtE,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YACjE,IAAI,cAAc,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;gBAChD,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,aAAgC,CAAC,CAAC;YAC/D,CAAC;YAED,MAAM,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;YAC1D,IAAI,oBAAoB,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC5D,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAChD,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACK,iBAAiB,CAAC,EAAkB,EAAE,aAA+B;QAC5E,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;QACpE,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC5C,CAAC;CACD;AArTD,gCAqTC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tSerializable,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { MessageType } from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tAttributionKey,\n\tIRuntimeMessageCollection,\n\tISequencedMessageEnvelope,\n\tIRuntimeMessagesContent,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type {\n\tICellLocalOpMetadata,\n\tICellOptions,\n\tISharedCell,\n\tISharedCellEvents,\n} from \"./interfaces.js\";\n\n/**\n * Description of a cell delta operation\n */\ntype ICellOperation = ISetCellOperation | IDeleteCellOperation;\n\ninterface ISetCellOperation {\n\ttype: \"setCell\";\n\tvalue: ICellValue;\n}\n\ninterface IDeleteCellOperation {\n\ttype: \"deleteCell\";\n}\n\ninterface ICellValue {\n\t/**\n\t * The actual value contained in the `Cell`, which needs to be wrapped to handle `undefined`.\n\t */\n\tvalue: unknown;\n\t/**\n\t * The attribution key contained in the `Cell`.\n\t */\n\tattribution?: AttributionKey;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCell}\n */\n// TODO: use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class SharedCell<T = any>\n\textends SharedObject<ISharedCellEvents<T>>\n\timplements ISharedCell<T>\n{\n\t/**\n\t * The data held by this cell.\n\t */\n\tprivate data: Serializable<T> | undefined;\n\n\t/**\n\t * This is used to assign a unique id to outgoing messages. It is used to track messages until\n\t * they are ack'd.\n\t */\n\tprivate messageId: number = -1;\n\n\t/**\n\t * This keeps track of the messageId of messages that have been ack'd. It is updated every time\n\t * we a message is ack'd with it's messageId.\n\t */\n\tprivate messageIdObserved: number = -1;\n\n\tprivate readonly pendingMessageIds: number[] = [];\n\n\tprivate attribution: AttributionKey | undefined;\n\n\tprivate readonly options: ICellOptions | undefined;\n\n\t/**\n\t * Constructs a new `SharedCell`.\n\t * If the object is non-local an id and service interfaces will be provided.\n\t *\n\t * @param runtime - The data store runtime to which the `SharedCell` belongs.\n\t * @param id - Unique identifier for the `SharedCell`.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n\tconstructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n\t\tsuper(id, runtime, attributes, \"fluid_cell_\");\n\n\t\tthis.options = runtime.options as ICellOptions;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.get}\n\t */\n\tpublic get(): Serializable<T> | undefined {\n\t\treturn this.data;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.set}\n\t */\n\tpublic set(value: Serializable<T>): void {\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(value);\n\t\tthis.setAttribution();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst operationValue: ICellValue = {\n\t\t\tvalue,\n\t\t};\n\n\t\tconst op: ISetCellOperation = {\n\t\t\ttype: \"setCell\",\n\t\t\tvalue: operationValue,\n\t\t};\n\t\tthis.submitCellMessage(op, previousValue);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.delete}\n\t */\n\tpublic delete(): void {\n\t\t// Delete the value locally.\n\t\tconst previousValue = this.deleteCore();\n\t\tthis.setAttribution();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst op: IDeleteCellOperation = {\n\t\t\ttype: \"deleteCell\",\n\t\t};\n\t\tthis.submitCellMessage(op, previousValue);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.empty}\n\t */\n\tpublic empty(): boolean {\n\t\treturn this.data === undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.getAttribution}\n\t */\n\tpublic getAttribution(): AttributionKey | undefined {\n\t\treturn this.attribution;\n\t}\n\n\t/**\n\t * Set the Op-based attribution through the SequencedDocumentMessage,\n\t * or set the local/detached attribution.\n\t */\n\tprivate setAttribution(messageEnvelope?: ISequencedMessageEnvelope): void {\n\t\tif (this.options?.attribution?.track ?? false) {\n\t\t\tthis.attribution = messageEnvelope\n\t\t\t\t? { type: \"op\", seq: messageEnvelope.sequenceNumber }\n\t\t\t\t: this.isAttached()\n\t\t\t\t\t? { type: \"local\" }\n\t\t\t\t\t: { type: \"detached\", id: 0 };\n\t\t}\n\t}\n\n\t/**\n\t * Creates a summary for the Cell.\n\t *\n\t * @returns The summary of the current state of the Cell.\n\t */\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst content: ICellValue =\n\t\t\tthis.attribution?.type === \"local\"\n\t\t\t\t? { value: this.data, attribution: undefined }\n\t\t\t\t: { value: this.data, attribution: this.attribution };\n\t\treturn createSingleBlobSummary(\n\t\t\tsnapshotFileName,\n\t\t\tserializer.stringify(content, this.handle),\n\t\t);\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 content = await readAndParse<ICellValue>(storage, snapshotFileName);\n\n\t\tthis.data = this.serializer.decode(content.value) as Serializable<T>;\n\t\tthis.attribution = content.attribution;\n\t}\n\n\t/**\n\t * Initialize a local instance of cell.\n\t */\n\tprotected initializeLocalCore(): void {\n\t\tthis.data = undefined;\n\t}\n\n\t/**\n\t * Call back on disconnect.\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Apply inner op.\n\t *\n\t * @param content - ICellOperation content\n\t */\n\tprivate applyInnerOp(content: ICellOperation): Serializable<T> | undefined {\n\t\tswitch (content.type) {\n\t\t\tcase \"setCell\": {\n\t\t\t\treturn this.setCore(content.value.value as Serializable<T>);\n\t\t\t}\n\n\t\t\tcase \"deleteCell\": {\n\t\t\t\treturn this.deleteCore();\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}\n\t */\n\tprotected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tfor (const messageContent of messagesContent) {\n\t\t\tthis.processMessage(envelope, messageContent, local);\n\t\t}\n\t}\n\n\tprivate processMessage(\n\t\tmessageEnvelope: ISequencedMessageEnvelope,\n\t\tmessageContent: IRuntimeMessagesContent,\n\t\tlocal: boolean,\n\t): void {\n\t\tconst cellOpMetadata = messageContent.localOpMetadata as ICellLocalOpMetadata;\n\t\tif (this.messageId !== this.messageIdObserved) {\n\t\t\t// We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.\n\t\t\tif (local) {\n\t\t\t\tconst messageIdReceived = cellOpMetadata.pendingMessageId;\n\t\t\t\tassert(\n\t\t\t\t\tmessageIdReceived !== undefined && messageIdReceived <= this.messageId,\n\t\t\t\t\t0x00c /* \"messageId is incorrect from from the local client's ACK\" */,\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tthis.pendingMessageIds !== undefined &&\n\t\t\t\t\t\tthis.pendingMessageIds[0] === cellOpMetadata.pendingMessageId,\n\t\t\t\t\t0x471 /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tthis.pendingMessageIds.shift();\n\t\t\t\t// We got an ACK. Update messageIdObserved.\n\t\t\t\tthis.messageIdObserved = cellOpMetadata.pendingMessageId;\n\t\t\t\t// update the attributor\n\t\t\t\tthis.setAttribution(messageEnvelope);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (messageEnvelope.type === MessageType.Operation && !local) {\n\t\t\tconst op = messageContent.contents as ICellOperation;\n\t\t\t// update the attributor\n\t\t\tthis.setAttribution(messageEnvelope);\n\t\t\tthis.applyInnerOp(op);\n\t\t}\n\t}\n\n\tprivate setCore(value: Serializable<T>): Serializable<T> | undefined {\n\t\tconst previousLocalValue = this.get();\n\t\tthis.data = value;\n\t\tthis.emit(\"valueChanged\", value);\n\t\treturn previousLocalValue;\n\t}\n\n\tprivate deleteCore(): Serializable<T> | undefined {\n\t\tconst previousLocalValue = this.get();\n\t\tthis.data = undefined;\n\t\tthis.emit(\"delete\");\n\t\treturn previousLocalValue;\n\t}\n\n\tprivate createLocalOpMetadata(\n\t\top: ICellOperation,\n\t\tpreviousValue?: Serializable<T>,\n\t): ICellLocalOpMetadata {\n\t\tconst pendingMessageId = ++this.messageId;\n\t\tthis.pendingMessageIds.push(pendingMessageId);\n\t\tconst localMetadata: ICellLocalOpMetadata = {\n\t\t\tpendingMessageId,\n\t\t\tpreviousValue,\n\t\t};\n\t\treturn localMetadata;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: unknown): void {\n\t\tconst cellContent = content as ICellOperation;\n\t\tswitch (cellContent.type) {\n\t\t\tcase \"deleteCell\": {\n\t\t\t\tthis.delete();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"setCell\": {\n\t\t\t\tthis.set(cellContent.value.value as Serializable<T>);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(cellContent);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Rollback a local op.\n\t *\n\t * @param content - The operation to rollback.\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\t// TODO: use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tconst cellOpMetadata = localOpMetadata as ICellLocalOpMetadata;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\tif (content.type === \"setCell\" || content.type === \"deleteCell\") {\n\t\t\tif (cellOpMetadata.previousValue === undefined) {\n\t\t\t\tthis.deleteCore();\n\t\t\t} else {\n\t\t\t\tthis.setCore(cellOpMetadata.previousValue as Serializable<T>);\n\t\t\t}\n\n\t\t\tconst lastPendingMessageId = this.pendingMessageIds.pop();\n\t\t\tif (lastPendingMessageId !== cellOpMetadata.pendingMessageId) {\n\t\t\t\tthrow new Error(\"Rollback op does not match last pending\");\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/**\n\t * Submit a cell message to remote clients.\n\t *\n\t * @param op - The cell message.\n\t * @param previousValue - The value of the cell before this op.\n\t */\n\tprivate submitCellMessage(op: ICellOperation, previousValue?: Serializable<T>): void {\n\t\tconst localMetadata = this.createLocalOpMetadata(op, previousValue);\n\t\tthis.submitLocalMessage(op, localMetadata);\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/cell";
8
- export declare const pkgVersion = "2.70.0-361248";
8
+ export declare const pkgVersion = "2.70.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yBAAyB,CAAC;AAC9C,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yBAAyB,CAAC;AAC9C,eAAO,MAAM,UAAU,WAAW,CAAC"}
@@ -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/cell";
11
- exports.pkgVersion = "2.70.0-361248";
11
+ exports.pkgVersion = "2.70.0";
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,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,eAAe,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/cell\";\nexport const pkgVersion = \"2.70.0-361248\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,UAAU,GAAG,QAAQ,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/cell\";\nexport const pkgVersion = \"2.70.0\";\n"]}
package/lib/cell.d.ts CHANGED
@@ -3,8 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import type { IChannelAttributes, IFluidDataStoreRuntime, Serializable, IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
- import { type ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
7
- import type { ISummaryTreeWithStats, AttributionKey } from "@fluidframework/runtime-definitions/internal";
6
+ import type { ISummaryTreeWithStats, AttributionKey, IRuntimeMessageCollection } from "@fluidframework/runtime-definitions/internal";
8
7
  import type { IFluidSerializer } from "@fluidframework/shared-object-base/internal";
9
8
  import { SharedObject } from "@fluidframework/shared-object-base/internal";
10
9
  import type { ISharedCell, ISharedCellEvents } from "./interfaces.js";
@@ -87,14 +86,10 @@ export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<
87
86
  */
88
87
  private applyInnerOp;
89
88
  /**
90
- * Process a cell operation (op).
91
- *
92
- * @param message - The message to prepare.
93
- * @param local - Whether or not the message was sent by the local client.
94
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
95
- * For messages from a remote client, this will be `undefined`.
89
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
96
90
  */
97
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
91
+ protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void;
92
+ private processMessage;
98
93
  private setCore;
99
94
  private deleteCore;
100
95
  private createLocalOpMetadata;
package/lib/cell.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cell.d.ts","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,sBAAsB,EACtB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEN,KAAK,yBAAyB,EAC9B,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EACX,qBAAqB,EACrB,cAAc,EACd,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EACN,YAAY,EAEZ,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAGX,WAAW,EACX,iBAAiB,EACjB,MAAM,iBAAiB,CAAC;AA6BzB;;GAEG;AAGH,qBAAa,UAAU,CAAC,CAAC,GAAG,GAAG,CAC9B,SAAQ,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,CACzC,YAAW,WAAW,CAAC,CAAC,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,IAAI,CAA8B;IAE1C;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAc;IAE/B;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAAc;IAEvC,OAAO,CAAC,QAAQ,CAAC,iBAA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InD;;;OAGG;IACH,OAAO,CAAC,cAAc;IAUtB;;;;OAIG;IACH,SAAS,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;IAW5E;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxE;;OAEG;IACH,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAIrC;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,IAAI;IAE9B;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAgBpB;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,yBAAyB,GAAG,IAAI;IAOlF,OAAO,CAAC,cAAc;IAqCtB,OAAO,CAAC,OAAO;IAOf,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,qBAAqB;IAa7B;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAiBhD;;;;;OAKG;IAGH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,GAAG,IAAI;IAmBhE;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;CAIzB"}
package/lib/cell.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
6
- import { MessageType, } from "@fluidframework/driver-definitions/internal";
6
+ import { MessageType } from "@fluidframework/driver-definitions/internal";
7
7
  import { readAndParse } from "@fluidframework/driver-utils/internal";
8
8
  import { SharedObject, createSingleBlobSummary, } from "@fluidframework/shared-object-base/internal";
9
9
  const snapshotFileName = "header";
@@ -94,10 +94,10 @@ export class SharedCell extends SharedObject {
94
94
  * Set the Op-based attribution through the SequencedDocumentMessage,
95
95
  * or set the local/detached attribution.
96
96
  */
97
- setAttribution(message) {
97
+ setAttribution(messageEnvelope) {
98
98
  if (this.options?.attribution?.track ?? false) {
99
- this.attribution = message
100
- ? { type: "op", seq: message.sequenceNumber }
99
+ this.attribution = messageEnvelope
100
+ ? { type: "op", seq: messageEnvelope.sequenceNumber }
101
101
  : this.isAttached()
102
102
  ? { type: "local" }
103
103
  : { type: "detached", id: 0 };
@@ -151,15 +151,16 @@ export class SharedCell extends SharedObject {
151
151
  }
152
152
  }
153
153
  /**
154
- * Process a cell operation (op).
155
- *
156
- * @param message - The message to prepare.
157
- * @param local - Whether or not the message was sent by the local client.
158
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
159
- * For messages from a remote client, this will be `undefined`.
154
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
160
155
  */
161
- processCore(message, local, localOpMetadata) {
162
- const cellOpMetadata = localOpMetadata;
156
+ processMessagesCore(messagesCollection) {
157
+ const { envelope, local, messagesContent } = messagesCollection;
158
+ for (const messageContent of messagesContent) {
159
+ this.processMessage(envelope, messageContent, local);
160
+ }
161
+ }
162
+ processMessage(messageEnvelope, messageContent, local) {
163
+ const cellOpMetadata = messageContent.localOpMetadata;
163
164
  if (this.messageId !== this.messageIdObserved) {
164
165
  // We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.
165
166
  if (local) {
@@ -171,15 +172,15 @@ export class SharedCell extends SharedObject {
171
172
  // We got an ACK. Update messageIdObserved.
172
173
  this.messageIdObserved = cellOpMetadata.pendingMessageId;
173
174
  // update the attributor
174
- this.setAttribution(message);
175
+ this.setAttribution(messageEnvelope);
175
176
  }
176
177
  return;
177
178
  }
178
179
  // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
179
- if (message.type === MessageType.Operation && !local) {
180
- const op = message.contents;
180
+ if (messageEnvelope.type === MessageType.Operation && !local) {
181
+ const op = messageContent.contents;
181
182
  // update the attributor
182
- this.setAttribution(message);
183
+ this.setAttribution(messageEnvelope);
183
184
  this.applyInnerOp(op);
184
185
  }
185
186
  }
package/lib/cell.js.map CHANGED
@@ -1 +1 @@
1
- {"version":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AAG,EAAE,CAAC;YAC1D,IAAI,oBAAoB,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC5D,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAChD,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACK,iBAAiB,CAAC,EAAkB,EAAE,aAA+B;QAC5E,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;QACpE,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tSerializable,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tAttributionKey,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type {\n\tICellLocalOpMetadata,\n\tICellOptions,\n\tISharedCell,\n\tISharedCellEvents,\n} from \"./interfaces.js\";\n\n/**\n * Description of a cell delta operation\n */\ntype ICellOperation = ISetCellOperation | IDeleteCellOperation;\n\ninterface ISetCellOperation {\n\ttype: \"setCell\";\n\tvalue: ICellValue;\n}\n\ninterface IDeleteCellOperation {\n\ttype: \"deleteCell\";\n}\n\ninterface ICellValue {\n\t/**\n\t * The actual value contained in the `Cell`, which needs to be wrapped to handle `undefined`.\n\t */\n\tvalue: unknown;\n\t/**\n\t * The attribution key contained in the `Cell`.\n\t */\n\tattribution?: AttributionKey;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCell}\n */\n// TODO: use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class SharedCell<T = any>\n\textends SharedObject<ISharedCellEvents<T>>\n\timplements ISharedCell<T>\n{\n\t/**\n\t * The data held by this cell.\n\t */\n\tprivate data: Serializable<T> | undefined;\n\n\t/**\n\t * This is used to assign a unique id to outgoing messages. It is used to track messages until\n\t * they are ack'd.\n\t */\n\tprivate messageId: number = -1;\n\n\t/**\n\t * This keeps track of the messageId of messages that have been ack'd. It is updated every time\n\t * we a message is ack'd with it's messageId.\n\t */\n\tprivate messageIdObserved: number = -1;\n\n\tprivate readonly pendingMessageIds: number[] = [];\n\n\tprivate attribution: AttributionKey | undefined;\n\n\tprivate readonly options: ICellOptions | undefined;\n\n\t/**\n\t * Constructs a new `SharedCell`.\n\t * If the object is non-local an id and service interfaces will be provided.\n\t *\n\t * @param runtime - The data store runtime to which the `SharedCell` belongs.\n\t * @param id - Unique identifier for the `SharedCell`.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n\tconstructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n\t\tsuper(id, runtime, attributes, \"fluid_cell_\");\n\n\t\tthis.options = runtime.options as ICellOptions;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.get}\n\t */\n\tpublic get(): Serializable<T> | undefined {\n\t\treturn this.data;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.set}\n\t */\n\tpublic set(value: Serializable<T>): void {\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(value);\n\t\tthis.setAttribution();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst operationValue: ICellValue = {\n\t\t\tvalue,\n\t\t};\n\n\t\tconst op: ISetCellOperation = {\n\t\t\ttype: \"setCell\",\n\t\t\tvalue: operationValue,\n\t\t};\n\t\tthis.submitCellMessage(op, previousValue);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.delete}\n\t */\n\tpublic delete(): void {\n\t\t// Delete the value locally.\n\t\tconst previousValue = this.deleteCore();\n\t\tthis.setAttribution();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst op: IDeleteCellOperation = {\n\t\t\ttype: \"deleteCell\",\n\t\t};\n\t\tthis.submitCellMessage(op, previousValue);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.empty}\n\t */\n\tpublic empty(): boolean {\n\t\treturn this.data === undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.getAttribution}\n\t */\n\tpublic getAttribution(): AttributionKey | undefined {\n\t\treturn this.attribution;\n\t}\n\n\t/**\n\t * Set the Op-based attribution through the SequencedDocumentMessage,\n\t * or set the local/detached attribution.\n\t */\n\tprivate setAttribution(message?: ISequencedDocumentMessage): void {\n\t\tif (this.options?.attribution?.track ?? false) {\n\t\t\tthis.attribution = message\n\t\t\t\t? { type: \"op\", seq: message.sequenceNumber }\n\t\t\t\t: this.isAttached()\n\t\t\t\t\t? { type: \"local\" }\n\t\t\t\t\t: { type: \"detached\", id: 0 };\n\t\t}\n\t}\n\n\t/**\n\t * Creates a summary for the Cell.\n\t *\n\t * @returns The summary of the current state of the Cell.\n\t */\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst content: ICellValue =\n\t\t\tthis.attribution?.type === \"local\"\n\t\t\t\t? { value: this.data, attribution: undefined }\n\t\t\t\t: { value: this.data, attribution: this.attribution };\n\t\treturn createSingleBlobSummary(\n\t\t\tsnapshotFileName,\n\t\t\tserializer.stringify(content, this.handle),\n\t\t);\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 content = await readAndParse<ICellValue>(storage, snapshotFileName);\n\n\t\tthis.data = this.serializer.decode(content.value) as Serializable<T>;\n\t\tthis.attribution = content.attribution;\n\t}\n\n\t/**\n\t * Initialize a local instance of cell.\n\t */\n\tprotected initializeLocalCore(): void {\n\t\tthis.data = undefined;\n\t}\n\n\t/**\n\t * Call back on disconnect.\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Apply inner op.\n\t *\n\t * @param content - ICellOperation content\n\t */\n\tprivate applyInnerOp(content: ICellOperation): Serializable<T> | undefined {\n\t\tswitch (content.type) {\n\t\t\tcase \"setCell\": {\n\t\t\t\treturn this.setCore(content.value.value as Serializable<T>);\n\t\t\t}\n\n\t\t\tcase \"deleteCell\": {\n\t\t\t\treturn this.deleteCore();\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Process a cell operation (op).\n\t *\n\t * @param message - The message to prepare.\n\t * @param local - Whether or not the message was sent by the local client.\n\t * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n\t * For messages from a remote client, this will be `undefined`.\n\t */\n\tprotected processCore(\n\t\tmessage: ISequencedDocumentMessage,\n\t\tlocal: boolean,\n\t\tlocalOpMetadata: unknown,\n\t): void {\n\t\tconst cellOpMetadata = localOpMetadata as ICellLocalOpMetadata;\n\t\tif (this.messageId !== this.messageIdObserved) {\n\t\t\t// We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.\n\t\t\tif (local) {\n\t\t\t\tconst messageIdReceived = cellOpMetadata.pendingMessageId;\n\t\t\t\tassert(\n\t\t\t\t\tmessageIdReceived !== undefined && messageIdReceived <= this.messageId,\n\t\t\t\t\t0x00c /* \"messageId is incorrect from from the local client's ACK\" */,\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tthis.pendingMessageIds !== undefined &&\n\t\t\t\t\t\tthis.pendingMessageIds[0] === cellOpMetadata.pendingMessageId,\n\t\t\t\t\t0x471 /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tthis.pendingMessageIds.shift();\n\t\t\t\t// We got an ACK. Update messageIdObserved.\n\t\t\t\tthis.messageIdObserved = cellOpMetadata.pendingMessageId;\n\t\t\t\t// update the attributor\n\t\t\t\tthis.setAttribution(message);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (message.type === MessageType.Operation && !local) {\n\t\t\tconst op = message.contents as ICellOperation;\n\t\t\t// update the attributor\n\t\t\tthis.setAttribution(message);\n\t\t\tthis.applyInnerOp(op);\n\t\t}\n\t}\n\n\tprivate setCore(value: Serializable<T>): Serializable<T> | undefined {\n\t\tconst previousLocalValue = this.get();\n\t\tthis.data = value;\n\t\tthis.emit(\"valueChanged\", value);\n\t\treturn previousLocalValue;\n\t}\n\n\tprivate deleteCore(): Serializable<T> | undefined {\n\t\tconst previousLocalValue = this.get();\n\t\tthis.data = undefined;\n\t\tthis.emit(\"delete\");\n\t\treturn previousLocalValue;\n\t}\n\n\tprivate createLocalOpMetadata(\n\t\top: ICellOperation,\n\t\tpreviousValue?: Serializable<T>,\n\t): ICellLocalOpMetadata {\n\t\tconst pendingMessageId = ++this.messageId;\n\t\tthis.pendingMessageIds.push(pendingMessageId);\n\t\tconst localMetadata: ICellLocalOpMetadata = {\n\t\t\tpendingMessageId,\n\t\t\tpreviousValue,\n\t\t};\n\t\treturn localMetadata;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: unknown): void {\n\t\tconst cellContent = content as ICellOperation;\n\t\tswitch (cellContent.type) {\n\t\t\tcase \"deleteCell\": {\n\t\t\t\tthis.delete();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"setCell\": {\n\t\t\t\tthis.set(cellContent.value.value as Serializable<T>);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(cellContent);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Rollback a local op.\n\t *\n\t * @param content - The operation to rollback.\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\t// TODO: use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tconst cellOpMetadata = localOpMetadata as ICellLocalOpMetadata;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\tif (content.type === \"setCell\" || content.type === \"deleteCell\") {\n\t\t\tif (cellOpMetadata.previousValue === undefined) {\n\t\t\t\tthis.deleteCore();\n\t\t\t} else {\n\t\t\t\tthis.setCore(cellOpMetadata.previousValue as Serializable<T>);\n\t\t\t}\n\n\t\t\tconst lastPendingMessageId = this.pendingMessageIds.pop();\n\t\t\tif (lastPendingMessageId !== cellOpMetadata.pendingMessageId) {\n\t\t\t\tthrow new Error(\"Rollback op does not match last pending\");\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/**\n\t * Submit a cell message to remote clients.\n\t *\n\t * @param op - The cell message.\n\t * @param previousValue - The value of the cell before this op.\n\t */\n\tprivate submitCellMessage(op: ICellOperation, previousValue?: Serializable<T>): void {\n\t\tconst localMetadata = this.createLocalOpMetadata(op, previousValue);\n\t\tthis.submitLocalMessage(op, localMetadata);\n\t}\n}\n"]}
1
+ {"version":3,"file":"cell.js","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC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CAAC;gBACP,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,aAAgC,CAAC,CAAC;YAC/D,CAAC;YAED,MAAM,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;YAC1D,IAAI,oBAAoB,KAAK,cAAc,CAAC,gBAAgB,EAAE,CAAC;gBAC9D,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAC5D,CAAC;QACF,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAChD,CAAC;IACF,CAAC;IAED;;;;;OAKG;IACK,iBAAiB,CAAC,EAAkB,EAAE,aAA+B;QAC5E,MAAM,aAAa,GAAG,IAAI,CAAC,qBAAqB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;QACpE,IAAI,CAAC,kBAAkB,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC5C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport type {\n\tIChannelAttributes,\n\tIFluidDataStoreRuntime,\n\tSerializable,\n\tIChannelStorageService,\n} from \"@fluidframework/datastore-definitions/internal\";\nimport { MessageType } from \"@fluidframework/driver-definitions/internal\";\nimport { readAndParse } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tISummaryTreeWithStats,\n\tAttributionKey,\n\tIRuntimeMessageCollection,\n\tISequencedMessageEnvelope,\n\tIRuntimeMessagesContent,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport type { IFluidSerializer } from \"@fluidframework/shared-object-base/internal\";\nimport {\n\tSharedObject,\n\tcreateSingleBlobSummary,\n} from \"@fluidframework/shared-object-base/internal\";\n\nimport type {\n\tICellLocalOpMetadata,\n\tICellOptions,\n\tISharedCell,\n\tISharedCellEvents,\n} from \"./interfaces.js\";\n\n/**\n * Description of a cell delta operation\n */\ntype ICellOperation = ISetCellOperation | IDeleteCellOperation;\n\ninterface ISetCellOperation {\n\ttype: \"setCell\";\n\tvalue: ICellValue;\n}\n\ninterface IDeleteCellOperation {\n\ttype: \"deleteCell\";\n}\n\ninterface ICellValue {\n\t/**\n\t * The actual value contained in the `Cell`, which needs to be wrapped to handle `undefined`.\n\t */\n\tvalue: unknown;\n\t/**\n\t * The attribution key contained in the `Cell`.\n\t */\n\tattribution?: AttributionKey;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCell}\n */\n// TODO: use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class SharedCell<T = any>\n\textends SharedObject<ISharedCellEvents<T>>\n\timplements ISharedCell<T>\n{\n\t/**\n\t * The data held by this cell.\n\t */\n\tprivate data: Serializable<T> | undefined;\n\n\t/**\n\t * This is used to assign a unique id to outgoing messages. It is used to track messages until\n\t * they are ack'd.\n\t */\n\tprivate messageId: number = -1;\n\n\t/**\n\t * This keeps track of the messageId of messages that have been ack'd. It is updated every time\n\t * we a message is ack'd with it's messageId.\n\t */\n\tprivate messageIdObserved: number = -1;\n\n\tprivate readonly pendingMessageIds: number[] = [];\n\n\tprivate attribution: AttributionKey | undefined;\n\n\tprivate readonly options: ICellOptions | undefined;\n\n\t/**\n\t * Constructs a new `SharedCell`.\n\t * If the object is non-local an id and service interfaces will be provided.\n\t *\n\t * @param runtime - The data store runtime to which the `SharedCell` belongs.\n\t * @param id - Unique identifier for the `SharedCell`.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility\n\tconstructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n\t\tsuper(id, runtime, attributes, \"fluid_cell_\");\n\n\t\tthis.options = runtime.options as ICellOptions;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.get}\n\t */\n\tpublic get(): Serializable<T> | undefined {\n\t\treturn this.data;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.set}\n\t */\n\tpublic set(value: Serializable<T>): void {\n\t\t// Set the value locally.\n\t\tconst previousValue = this.setCore(value);\n\t\tthis.setAttribution();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst operationValue: ICellValue = {\n\t\t\tvalue,\n\t\t};\n\n\t\tconst op: ISetCellOperation = {\n\t\t\ttype: \"setCell\",\n\t\t\tvalue: operationValue,\n\t\t};\n\t\tthis.submitCellMessage(op, previousValue);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.delete}\n\t */\n\tpublic delete(): void {\n\t\t// Delete the value locally.\n\t\tconst previousValue = this.deleteCore();\n\t\tthis.setAttribution();\n\n\t\t// If we are not attached, don't submit the op.\n\t\tif (!this.isAttached()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst op: IDeleteCellOperation = {\n\t\t\ttype: \"deleteCell\",\n\t\t};\n\t\tthis.submitCellMessage(op, previousValue);\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.empty}\n\t */\n\tpublic empty(): boolean {\n\t\treturn this.data === undefined;\n\t}\n\n\t/**\n\t * {@inheritDoc ISharedCell.getAttribution}\n\t */\n\tpublic getAttribution(): AttributionKey | undefined {\n\t\treturn this.attribution;\n\t}\n\n\t/**\n\t * Set the Op-based attribution through the SequencedDocumentMessage,\n\t * or set the local/detached attribution.\n\t */\n\tprivate setAttribution(messageEnvelope?: ISequencedMessageEnvelope): void {\n\t\tif (this.options?.attribution?.track ?? false) {\n\t\t\tthis.attribution = messageEnvelope\n\t\t\t\t? { type: \"op\", seq: messageEnvelope.sequenceNumber }\n\t\t\t\t: this.isAttached()\n\t\t\t\t\t? { type: \"local\" }\n\t\t\t\t\t: { type: \"detached\", id: 0 };\n\t\t}\n\t}\n\n\t/**\n\t * Creates a summary for the Cell.\n\t *\n\t * @returns The summary of the current state of the Cell.\n\t */\n\tprotected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats {\n\t\tconst content: ICellValue =\n\t\t\tthis.attribution?.type === \"local\"\n\t\t\t\t? { value: this.data, attribution: undefined }\n\t\t\t\t: { value: this.data, attribution: this.attribution };\n\t\treturn createSingleBlobSummary(\n\t\t\tsnapshotFileName,\n\t\t\tserializer.stringify(content, this.handle),\n\t\t);\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 content = await readAndParse<ICellValue>(storage, snapshotFileName);\n\n\t\tthis.data = this.serializer.decode(content.value) as Serializable<T>;\n\t\tthis.attribution = content.attribution;\n\t}\n\n\t/**\n\t * Initialize a local instance of cell.\n\t */\n\tprotected initializeLocalCore(): void {\n\t\tthis.data = undefined;\n\t}\n\n\t/**\n\t * Call back on disconnect.\n\t */\n\tprotected onDisconnect(): void {}\n\n\t/**\n\t * Apply inner op.\n\t *\n\t * @param content - ICellOperation content\n\t */\n\tprivate applyInnerOp(content: ICellOperation): Serializable<T> | undefined {\n\t\tswitch (content.type) {\n\t\t\tcase \"setCell\": {\n\t\t\t\treturn this.setCore(content.value.value as Serializable<T>);\n\t\t\t}\n\n\t\t\tcase \"deleteCell\": {\n\t\t\t\treturn this.deleteCore();\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(\"Unknown operation\");\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}\n\t */\n\tprotected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {\n\t\tconst { envelope, local, messagesContent } = messagesCollection;\n\t\tfor (const messageContent of messagesContent) {\n\t\t\tthis.processMessage(envelope, messageContent, local);\n\t\t}\n\t}\n\n\tprivate processMessage(\n\t\tmessageEnvelope: ISequencedMessageEnvelope,\n\t\tmessageContent: IRuntimeMessagesContent,\n\t\tlocal: boolean,\n\t): void {\n\t\tconst cellOpMetadata = messageContent.localOpMetadata as ICellLocalOpMetadata;\n\t\tif (this.messageId !== this.messageIdObserved) {\n\t\t\t// We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.\n\t\t\tif (local) {\n\t\t\t\tconst messageIdReceived = cellOpMetadata.pendingMessageId;\n\t\t\t\tassert(\n\t\t\t\t\tmessageIdReceived !== undefined && messageIdReceived <= this.messageId,\n\t\t\t\t\t0x00c /* \"messageId is incorrect from from the local client's ACK\" */,\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tthis.pendingMessageIds !== undefined &&\n\t\t\t\t\t\tthis.pendingMessageIds[0] === cellOpMetadata.pendingMessageId,\n\t\t\t\t\t0x471 /* Unexpected pending message received */,\n\t\t\t\t);\n\t\t\t\tthis.pendingMessageIds.shift();\n\t\t\t\t// We got an ACK. Update messageIdObserved.\n\t\t\t\tthis.messageIdObserved = cellOpMetadata.pendingMessageId;\n\t\t\t\t// update the attributor\n\t\t\t\tthis.setAttribution(messageEnvelope);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison\n\t\tif (messageEnvelope.type === MessageType.Operation && !local) {\n\t\t\tconst op = messageContent.contents as ICellOperation;\n\t\t\t// update the attributor\n\t\t\tthis.setAttribution(messageEnvelope);\n\t\t\tthis.applyInnerOp(op);\n\t\t}\n\t}\n\n\tprivate setCore(value: Serializable<T>): Serializable<T> | undefined {\n\t\tconst previousLocalValue = this.get();\n\t\tthis.data = value;\n\t\tthis.emit(\"valueChanged\", value);\n\t\treturn previousLocalValue;\n\t}\n\n\tprivate deleteCore(): Serializable<T> | undefined {\n\t\tconst previousLocalValue = this.get();\n\t\tthis.data = undefined;\n\t\tthis.emit(\"delete\");\n\t\treturn previousLocalValue;\n\t}\n\n\tprivate createLocalOpMetadata(\n\t\top: ICellOperation,\n\t\tpreviousValue?: Serializable<T>,\n\t): ICellLocalOpMetadata {\n\t\tconst pendingMessageId = ++this.messageId;\n\t\tthis.pendingMessageIds.push(pendingMessageId);\n\t\tconst localMetadata: ICellLocalOpMetadata = {\n\t\t\tpendingMessageId,\n\t\t\tpreviousValue,\n\t\t};\n\t\treturn localMetadata;\n\t}\n\n\t/**\n\t * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}\n\t */\n\tprotected applyStashedOp(content: unknown): void {\n\t\tconst cellContent = content as ICellOperation;\n\t\tswitch (cellContent.type) {\n\t\t\tcase \"deleteCell\": {\n\t\t\t\tthis.delete();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"setCell\": {\n\t\t\t\tthis.set(cellContent.value.value as Serializable<T>);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(cellContent);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Rollback a local op.\n\t *\n\t * @param content - The operation to rollback.\n\t * @param localOpMetadata - The local metadata associated with the op.\n\t */\n\t// TODO: use `unknown` instead (breaking change).\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\n\tprotected rollback(content: any, localOpMetadata: unknown): void {\n\t\tconst cellOpMetadata = localOpMetadata as ICellLocalOpMetadata;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\tif (content.type === \"setCell\" || content.type === \"deleteCell\") {\n\t\t\tif (cellOpMetadata.previousValue === undefined) {\n\t\t\t\tthis.deleteCore();\n\t\t\t} else {\n\t\t\t\tthis.setCore(cellOpMetadata.previousValue as Serializable<T>);\n\t\t\t}\n\n\t\t\tconst lastPendingMessageId = this.pendingMessageIds.pop();\n\t\t\tif (lastPendingMessageId !== cellOpMetadata.pendingMessageId) {\n\t\t\t\tthrow new Error(\"Rollback op does not match last pending\");\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(\"Unsupported op for rollback\");\n\t\t}\n\t}\n\n\t/**\n\t * Submit a cell message to remote clients.\n\t *\n\t * @param op - The cell message.\n\t * @param previousValue - The value of the cell before this op.\n\t */\n\tprivate submitCellMessage(op: ICellOperation, previousValue?: Serializable<T>): void {\n\t\tconst localMetadata = this.createLocalOpMetadata(op, previousValue);\n\t\tthis.submitLocalMessage(op, localMetadata);\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/cell";
8
- export declare const pkgVersion = "2.70.0-361248";
8
+ export declare const pkgVersion = "2.70.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yBAAyB,CAAC;AAC9C,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,yBAAyB,CAAC;AAC9C,eAAO,MAAM,UAAU,WAAW,CAAC"}
@@ -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/cell";
8
- export const pkgVersion = "2.70.0-361248";
8
+ export const pkgVersion = "2.70.0";
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,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,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/cell\";\nexport const pkgVersion = \"2.70.0-361248\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,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/cell\";\nexport const pkgVersion = \"2.70.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/cell",
3
- "version": "2.70.0-361248",
3
+ "version": "2.70.0",
4
4
  "description": "Distributed data structure for a single value",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -59,26 +59,26 @@
59
59
  "temp-directory": "nyc/.nyc_output"
60
60
  },
61
61
  "dependencies": {
62
- "@fluidframework/core-interfaces": "2.70.0-361248",
63
- "@fluidframework/core-utils": "2.70.0-361248",
64
- "@fluidframework/datastore-definitions": "2.70.0-361248",
65
- "@fluidframework/driver-definitions": "2.70.0-361248",
66
- "@fluidframework/driver-utils": "2.70.0-361248",
67
- "@fluidframework/runtime-definitions": "2.70.0-361248",
68
- "@fluidframework/shared-object-base": "2.70.0-361248"
62
+ "@fluidframework/core-interfaces": "~2.70.0",
63
+ "@fluidframework/core-utils": "~2.70.0",
64
+ "@fluidframework/datastore-definitions": "~2.70.0",
65
+ "@fluidframework/driver-definitions": "~2.70.0",
66
+ "@fluidframework/driver-utils": "~2.70.0",
67
+ "@fluidframework/runtime-definitions": "~2.70.0",
68
+ "@fluidframework/shared-object-base": "~2.70.0"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@arethetypeswrong/cli": "^0.17.1",
72
72
  "@biomejs/biome": "~1.9.3",
73
- "@fluid-internal/mocha-test-setup": "2.70.0-361248",
74
- "@fluid-private/test-dds-utils": "2.70.0-361248",
73
+ "@fluid-internal/mocha-test-setup": "~2.70.0",
74
+ "@fluid-private/test-dds-utils": "~2.70.0",
75
75
  "@fluid-tools/build-cli": "^0.58.3",
76
76
  "@fluidframework/build-common": "^2.0.3",
77
77
  "@fluidframework/build-tools": "^0.58.3",
78
78
  "@fluidframework/cell-previous": "npm:@fluidframework/cell@2.63.0",
79
- "@fluidframework/container-definitions": "2.70.0-361248",
79
+ "@fluidframework/container-definitions": "~2.70.0",
80
80
  "@fluidframework/eslint-config-fluid": "^6.1.0",
81
- "@fluidframework/test-runtime-utils": "2.70.0-361248",
81
+ "@fluidframework/test-runtime-utils": "~2.70.0",
82
82
  "@microsoft/api-extractor": "7.52.11",
83
83
  "@types/mocha": "^10.0.10",
84
84
  "@types/node": "^18.19.0",
package/src/cell.ts CHANGED
@@ -10,14 +10,14 @@ import type {
10
10
  Serializable,
11
11
  IChannelStorageService,
12
12
  } from "@fluidframework/datastore-definitions/internal";
13
- import {
14
- MessageType,
15
- type ISequencedDocumentMessage,
16
- } from "@fluidframework/driver-definitions/internal";
13
+ import { MessageType } from "@fluidframework/driver-definitions/internal";
17
14
  import { readAndParse } from "@fluidframework/driver-utils/internal";
18
15
  import type {
19
16
  ISummaryTreeWithStats,
20
17
  AttributionKey,
18
+ IRuntimeMessageCollection,
19
+ ISequencedMessageEnvelope,
20
+ IRuntimeMessagesContent,
21
21
  } from "@fluidframework/runtime-definitions/internal";
22
22
  import type { IFluidSerializer } from "@fluidframework/shared-object-base/internal";
23
23
  import {
@@ -173,10 +173,10 @@ export class SharedCell<T = any>
173
173
  * Set the Op-based attribution through the SequencedDocumentMessage,
174
174
  * or set the local/detached attribution.
175
175
  */
176
- private setAttribution(message?: ISequencedDocumentMessage): void {
176
+ private setAttribution(messageEnvelope?: ISequencedMessageEnvelope): void {
177
177
  if (this.options?.attribution?.track ?? false) {
178
- this.attribution = message
179
- ? { type: "op", seq: message.sequenceNumber }
178
+ this.attribution = messageEnvelope
179
+ ? { type: "op", seq: messageEnvelope.sequenceNumber }
180
180
  : this.isAttached()
181
181
  ? { type: "local" }
182
182
  : { type: "detached", id: 0 };
@@ -243,19 +243,21 @@ export class SharedCell<T = any>
243
243
  }
244
244
 
245
245
  /**
246
- * Process a cell operation (op).
247
- *
248
- * @param message - The message to prepare.
249
- * @param local - Whether or not the message was sent by the local client.
250
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
251
- * For messages from a remote client, this will be `undefined`.
246
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.processMessagesCore}
252
247
  */
253
- protected processCore(
254
- message: ISequencedDocumentMessage,
248
+ protected processMessagesCore(messagesCollection: IRuntimeMessageCollection): void {
249
+ const { envelope, local, messagesContent } = messagesCollection;
250
+ for (const messageContent of messagesContent) {
251
+ this.processMessage(envelope, messageContent, local);
252
+ }
253
+ }
254
+
255
+ private processMessage(
256
+ messageEnvelope: ISequencedMessageEnvelope,
257
+ messageContent: IRuntimeMessagesContent,
255
258
  local: boolean,
256
- localOpMetadata: unknown,
257
259
  ): void {
258
- const cellOpMetadata = localOpMetadata as ICellLocalOpMetadata;
260
+ const cellOpMetadata = messageContent.localOpMetadata as ICellLocalOpMetadata;
259
261
  if (this.messageId !== this.messageIdObserved) {
260
262
  // We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.
261
263
  if (local) {
@@ -273,16 +275,16 @@ export class SharedCell<T = any>
273
275
  // We got an ACK. Update messageIdObserved.
274
276
  this.messageIdObserved = cellOpMetadata.pendingMessageId;
275
277
  // update the attributor
276
- this.setAttribution(message);
278
+ this.setAttribution(messageEnvelope);
277
279
  }
278
280
  return;
279
281
  }
280
282
 
281
283
  // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
282
- if (message.type === MessageType.Operation && !local) {
283
- const op = message.contents as ICellOperation;
284
+ if (messageEnvelope.type === MessageType.Operation && !local) {
285
+ const op = messageContent.contents as ICellOperation;
284
286
  // update the attributor
285
- this.setAttribution(message);
287
+ this.setAttribution(messageEnvelope);
286
288
  this.applyInnerOp(op);
287
289
  }
288
290
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/cell";
9
- export const pkgVersion = "2.70.0-361248";
9
+ export const pkgVersion = "2.70.0";