@fluidframework/cell 0.45.4 → 0.46.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"cell.d.ts","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAqB,MAAM,iCAAiC,CAAC;AAEtF,OAAO,EAEH,yBAAyB,EACzB,KAAK,EAGR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,YAAY,EACf,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAa,MAAM,oCAAoC,CAAC;AAG7E,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AA0B9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,qBAAa,UAAU,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,CACtE,YAAW,WAAW,CAAC,CAAC,CAAC;IACzB;;;;;;OAMG;WACW,MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM;IAIjE;;;;OAIG;WACW,UAAU,IAAI,eAAe;IAG3C;;OAEG;IACH,OAAO,CAAC,IAAI,CAA8B;IAE1C;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAc;IAE/B;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAAc;IAEvC;;;;;;OAMG;gBACS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB;IAIvF;;OAEG;IACI,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IAIzC;;OAEG;IACI,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,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MAAM,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,CAAC,EAAE,MAAM;IAIjE;;;;OAIG;WACW,UAAU,IAAI,eAAe;IAG3C;;OAEG;IACH,OAAO,CAAC,IAAI,CAA8B;IAE1C;;;OAGG;IACH,OAAO,CAAC,SAAS,CAAc;IAE/B;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAAc;IAEvC;;;;;;OAMG;gBACS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB;IAIvF;;OAEG;IACI,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IAIzC;;OAEG;IACI,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IA0BjC;;OAEG;IACI,MAAM;IAeb;;OAEG;IACI,KAAK;IAIZ;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,gBAAgB,GAAG,KAAK;IAyB3D;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxE;;OAEG;IACH,SAAS,CAAC,mBAAmB;IAI7B;;OAEG;IACH,SAAS,CAAC,YAAY;IAMtB;;OAEG;IACH,SAAS,CAAC,YAAY;IAEtB;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;IAgClG,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,gBAAgB;IAkBxB,SAAS,CAAC,cAAc;CAG3B"}
package/dist/cell.js CHANGED
@@ -10,7 +10,6 @@ const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
10
10
  const driver_utils_1 = require("@fluidframework/driver-utils");
11
11
  const shared_object_base_1 = require("@fluidframework/shared-object-base");
12
12
  const cellFactory_1 = require("./cellFactory");
13
- const debug_1 = require("./debug");
14
13
  const snapshotFileName = "header";
15
14
  /**
16
15
  * The SharedCell distributed data structure can be used to store a single serializable value.
@@ -200,9 +199,7 @@ class SharedCell extends shared_object_base_1.SharedObject {
200
199
  /**
201
200
  * Call back on disconnect
202
201
  */
203
- onDisconnect() {
204
- debug_1.debug(`Cell ${this.id} is now disconnected`);
205
- }
202
+ onDisconnect() { }
206
203
  /**
207
204
  * Process a cell operation
208
205
  *
package/dist/cell.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cell.js","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAGtD,+EAM8C;AAQ9C,+DAA4D;AAC5D,2EAA6E;AAC7E,+CAA4C;AAC5C,mCAAgC;AAyBhC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAa,UAAoB,SAAQ,iCAAkC;IAsCvE;;;;;;OAMG;IACH,YAAY,EAAU,EAAE,OAA+B,EAAE,UAA8B;QACnF,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QApBnC;;;WAGG;QACK,cAAS,GAAW,CAAC,CAAC,CAAC;QAE/B;;;WAGG;QACK,sBAAiB,GAAW,CAAC,CAAC,CAAC;IAWvC,CAAC;IA7CD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAC7D,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,yBAAW,CAAC,IAAI,CAAe,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,yBAAW,EAAE,CAAC;IAC7B,CAAC;IA6BD;;OAEG;IACI,GAAG;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;OAEG;IACI,GAAG,CAAC,KAAsB;Q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,CAAC,EAAE;YAChD,MAAM,MAAM,GAAsB;gBAC9B,IAAI,EAAE,kBAAkB;gBACxB,GAAG,EAAE,SAAS,CAAC,KAAe;aACjC,CAAC;YACF,KAAK,GAAG,MAAM,CAAC;SAClB;QAED,+DAA+D;QAC/D,OAAO,KAAK,KAAK,SAAS;YACtB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC,CAAC,KAAK,CAAC;IAChB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AA/PD,gCA+PC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IFluidSerializer, ISerializedHandle } from \"@fluidframework/core-interfaces\";\n\nimport {\n FileMode,\n ISequencedDocumentMessage,\n ITree,\n MessageType,\n TreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelFactory,\n Serializable,\n} from \"@fluidframework/datastore-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { SharedObject, ValueType } from \"@fluidframework/shared-object-base\";\nimport { CellFactory } from \"./cellFactory\";\nimport { debug } from \"./debug\";\nimport { ISharedCell, ISharedCellEvents } from \"./interfaces\";\n\n/**\n * Description of a cell delta operation\n */\ntype ICellOperation = ISetCellOperation | IDeleteCellOperation;\n\ninterface ISetCellOperation {\n type: \"setCell\";\n value: ICellValue;\n}\n\ninterface IDeleteCellOperation {\n type: \"deleteCell\";\n}\n\ninterface ICellValue {\n // The type of the value\n type: string;\n\n // The actual value\n value: any;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * The SharedCell distributed data structure can be used to store a single serializable value.\n *\n * @remarks\n * ### Creation\n *\n * To create a `SharedCell`, call the static create method:\n *\n * ```typescript\n * const myCell = SharedCell.create(this.runtime, id);\n * ```\n *\n * ### Usage\n *\n * The value stored in the cell can be set with the `.set()` method and retrieved with the `.get()` method:\n *\n * ```typescript\n * myCell.set(3);\n * console.log(myCell.get()); // 3\n * ```\n *\n * The value must only be plain JS objects or `SharedObject` handles (e.g. to another DDS or Fluid object).\n * In collaborative scenarios, the value is settled with a policy of _last write wins_.\n *\n * The `.delete()` method will delete the stored value from the cell:\n *\n * ```typescript\n * myCell.delete();\n * console.log(myCell.get()); // undefined\n * ```\n *\n * The `.empty()` method will check if the value is undefined.\n *\n * ```typescript\n * if (myCell.empty()) {\n * // myCell.get() will return undefined\n * } else {\n * // myCell.get() will return a non-undefined value\n * }\n * ```\n *\n * ### Eventing\n *\n * `SharedCell` is an `EventEmitter`, and will emit events when other clients make modifications. You should\n * register for these events and respond appropriately as the data is modified. `valueChanged` will be emitted\n * in response to a `set`, and `delete` will be emitted in response to a `delete`.\n */\nexport class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>>\n implements ISharedCell<T> {\n /**\n * Create a new shared cell\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, CellFactory.Type) as SharedCell;\n }\n\n /**\n * Get a factory for SharedCell to register with the data store.\n *\n * @returns a factory that creates and load SharedCell\n */\n public static getFactory(): IChannelFactory {\n return new CellFactory();\n }\n /**\n * The data held by this cell.\n */\n private data: Serializable<T> | undefined;\n\n /**\n * This is used to assign a unique id to outgoing messages. It is used to track messages until\n * they are ack'd.\n */\n private messageId: number = -1;\n\n /**\n * This keeps track of the messageId of messages that have been ack'd. It is updated every time\n * we a message is ack'd with it's messageId.\n */\n private messageIdObserved: number = -1;\n\n /**\n * Constructs a new shared cell. If the object is non-local an id and service interfaces will\n * be provided\n *\n * @param runtime - data store runtime the shared map belongs to\n * @param id - optional name of the shared map\n */\n constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n super(id, runtime, attributes);\n }\n\n /**\n * {@inheritDoc ISharedCell.get}\n */\n public get(): Serializable<T> | undefined {\n return this.data;\n }\n\n /**\n * {@inheritDoc ISharedCell.set}\n */\n public set(value: Serializable<T>) {\n if (SharedObject.is(value)) {\n throw new Error(\"SharedObject sets are no longer supported. Instead set the SharedObject handle.\");\n }\n\n // Serialize the value if required.\n const operationValue: ICellValue = {\n type: ValueType[ValueType.Plain],\n value: this.toSerializable(value, this.serializer),\n };\n\n // Set the value locally.\n this.setCore(value);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: ISetCellOperation = {\n type: \"setCell\",\n value: operationValue,\n };\n this.submitLocalMessage(op, ++this.messageId);\n }\n\n /**\n * {@inheritDoc ISharedCell.delete}\n */\n public delete() {\n // Delete the value locally.\n this.deleteCore();\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IDeleteCellOperation = {\n type: \"deleteCell\",\n };\n this.submitLocalMessage(op, ++this.messageId);\n }\n\n /**\n * {@inheritDoc ISharedCell.empty}\n */\n public empty() {\n return this.data === undefined;\n }\n\n /**\n * Create a snapshot for the cell\n *\n * @returns the snapshot of the current state of the cell\n */\n protected snapshotCore(serializer: IFluidSerializer): ITree {\n // Get a serializable form of data\n const content: ICellValue = {\n type: ValueType[ValueType.Plain],\n value: this.toSerializable(this.data, serializer),\n };\n\n // And then construct the tree for it\n const tree: ITree = {\n entries: [\n {\n mode: FileMode.File,\n path: snapshotFileName,\n type: TreeEntry.Blob,\n value: {\n contents: JSON.stringify(content),\n encoding: \"utf-8\",\n },\n },\n ],\n };\n\n return tree;\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService): Promise<void> {\n const content = await readAndParse<ICellValue>(storage, snapshotFileName);\n\n this.data = this.fromSerializable(content);\n }\n\n /**\n * Initialize a local instance of cell\n */\n protected initializeLocalCore() {\n this.data = undefined;\n }\n\n /**\n * Process the cell value on register\n */\n protected registerCore() {\n if (SharedObject.is(this.data)) {\n this.data.bindToContext();\n }\n }\n\n /**\n * Call back on disconnect\n */\n protected onDisconnect() {\n debug(`Cell ${this.id} is now disconnected`);\n }\n\n /**\n * Process a cell operation\n *\n * @param message - the message to prepare\n * @param local - whether the message was sent by the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (this.messageId !== this.messageIdObserved) {\n // We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.\n if (local) {\n const messageIdReceived = localOpMetadata as number;\n assert(messageIdReceived !== undefined && messageIdReceived <= this.messageId,\n 0x00c /* \"messageId is incorrect from from the local client's ACK\" */);\n\n // We got an ACK. Update messageIdObserved.\n this.messageIdObserved = localOpMetadata as number;\n }\n return;\n }\n\n if (message.type === MessageType.Operation && !local) {\n const op = message.contents as ICellOperation;\n\n switch (op.type) {\n case \"setCell\":\n this.setCore(this.fromSerializable(op.value));\n break;\n\n case \"deleteCell\":\n this.deleteCore();\n break;\n\n default:\n throw new Error(\"Unknown operation\");\n }\n }\n }\n\n private setCore(value: Serializable<T>) {\n this.data = value;\n this.emit(\"valueChanged\", value);\n }\n\n private deleteCore() {\n this.data = undefined;\n this.emit(\"delete\");\n }\n\n private toSerializable(value: T | undefined, serializer: IFluidSerializer) {\n if (value === undefined) {\n return value;\n }\n\n // Stringify to convert to the serialized handle values - and then parse in order to create\n // a POJO for the op\n const stringified = serializer.stringify(value, this.handle);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return JSON.parse(stringified);\n }\n\n private fromSerializable(operation: ICellValue) {\n let value = operation.value;\n\n // Convert any stored shared object to updated handle\n if (operation.type === ValueType[ValueType.Shared]) {\n const handle: ISerializedHandle = {\n type: \"__fluid_handle__\",\n url: operation.value as string,\n };\n value = handle;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value !== undefined\n ? this.serializer.parse(JSON.stringify(value))\n : value;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
1
+ {"version":3,"file":"cell.js","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAGtD,+EAM8C;AAQ9C,+DAA4D;AAC5D,2EAA6E;AAC7E,+CAA4C;AAyB5C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAa,UAAoB,SAAQ,iCAAkC;IAsCvE;;;;;;OAMG;IACH,YAAY,EAAU,EAAE,OAA+B,EAAE,UAA8B;QACnF,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QApBnC;;;WAGG;QACK,cAAS,GAAW,CAAC,CAAC,CAAC;QAE/B;;;WAGG;QACK,sBAAiB,GAAW,CAAC,CAAC,CAAC;IAWvC,CAAC;IA7CD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAC7D,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,yBAAW,CAAC,IAAI,CAAe,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,yBAAW,EAAE,CAAC;IAC7B,CAAC;IA6BD;;OAEG;IACI,GAAG;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;OAEG;IACI,GAAG,CAAC,KAAsB;QAC7B,IAAI,iCAAY,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;SACtG;QAED,mCAAmC;QACnC,MAAM,cAAc,GAAe;Y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C,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC,CAAC,KAAK,CAAC;IAChB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ;AA7PD,gCA6PC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IFluidSerializer, ISerializedHandle } from \"@fluidframework/core-interfaces\";\n\nimport {\n FileMode,\n ISequencedDocumentMessage,\n ITree,\n MessageType,\n TreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelFactory,\n Serializable,\n} from \"@fluidframework/datastore-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { SharedObject, ValueType } from \"@fluidframework/shared-object-base\";\nimport { CellFactory } from \"./cellFactory\";\nimport { ISharedCell, ISharedCellEvents } from \"./interfaces\";\n\n/**\n * Description of a cell delta operation\n */\ntype ICellOperation = ISetCellOperation | IDeleteCellOperation;\n\ninterface ISetCellOperation {\n type: \"setCell\";\n value: ICellValue;\n}\n\ninterface IDeleteCellOperation {\n type: \"deleteCell\";\n}\n\ninterface ICellValue {\n // The type of the value\n type: string;\n\n // The actual value\n value: any;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * The SharedCell distributed data structure can be used to store a single serializable value.\n *\n * @remarks\n * ### Creation\n *\n * To create a `SharedCell`, call the static create method:\n *\n * ```typescript\n * const myCell = SharedCell.create(this.runtime, id);\n * ```\n *\n * ### Usage\n *\n * The value stored in the cell can be set with the `.set()` method and retrieved with the `.get()` method:\n *\n * ```typescript\n * myCell.set(3);\n * console.log(myCell.get()); // 3\n * ```\n *\n * The value must only be plain JS objects or `SharedObject` handles (e.g. to another DDS or Fluid object).\n * In collaborative scenarios, the value is settled with a policy of _last write wins_.\n *\n * The `.delete()` method will delete the stored value from the cell:\n *\n * ```typescript\n * myCell.delete();\n * console.log(myCell.get()); // undefined\n * ```\n *\n * The `.empty()` method will check if the value is undefined.\n *\n * ```typescript\n * if (myCell.empty()) {\n * // myCell.get() will return undefined\n * } else {\n * // myCell.get() will return a non-undefined value\n * }\n * ```\n *\n * ### Eventing\n *\n * `SharedCell` is an `EventEmitter`, and will emit events when other clients make modifications. You should\n * register for these events and respond appropriately as the data is modified. `valueChanged` will be emitted\n * in response to a `set`, and `delete` will be emitted in response to a `delete`.\n */\nexport class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>>\n implements ISharedCell<T> {\n /**\n * Create a new shared cell\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, CellFactory.Type) as SharedCell;\n }\n\n /**\n * Get a factory for SharedCell to register with the data store.\n *\n * @returns a factory that creates and load SharedCell\n */\n public static getFactory(): IChannelFactory {\n return new CellFactory();\n }\n /**\n * The data held by this cell.\n */\n private data: Serializable<T> | undefined;\n\n /**\n * This is used to assign a unique id to outgoing messages. It is used to track messages until\n * they are ack'd.\n */\n private messageId: number = -1;\n\n /**\n * This keeps track of the messageId of messages that have been ack'd. It is updated every time\n * we a message is ack'd with it's messageId.\n */\n private messageIdObserved: number = -1;\n\n /**\n * Constructs a new shared cell. If the object is non-local an id and service interfaces will\n * be provided\n *\n * @param runtime - data store runtime the shared map belongs to\n * @param id - optional name of the shared map\n */\n constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n super(id, runtime, attributes);\n }\n\n /**\n * {@inheritDoc ISharedCell.get}\n */\n public get(): Serializable<T> | undefined {\n return this.data;\n }\n\n /**\n * {@inheritDoc ISharedCell.set}\n */\n public set(value: Serializable<T>) {\n if (SharedObject.is(value)) {\n throw new Error(\"SharedObject sets are no longer supported. Instead set the SharedObject handle.\");\n }\n\n // Serialize the value if required.\n const operationValue: ICellValue = {\n type: ValueType[ValueType.Plain],\n value: this.toSerializable(value, this.serializer),\n };\n\n // Set the value locally.\n this.setCore(value);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: ISetCellOperation = {\n type: \"setCell\",\n value: operationValue,\n };\n this.submitLocalMessage(op, ++this.messageId);\n }\n\n /**\n * {@inheritDoc ISharedCell.delete}\n */\n public delete() {\n // Delete the value locally.\n this.deleteCore();\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IDeleteCellOperation = {\n type: \"deleteCell\",\n };\n this.submitLocalMessage(op, ++this.messageId);\n }\n\n /**\n * {@inheritDoc ISharedCell.empty}\n */\n public empty() {\n return this.data === undefined;\n }\n\n /**\n * Create a snapshot for the cell\n *\n * @returns the snapshot of the current state of the cell\n */\n protected snapshotCore(serializer: IFluidSerializer): ITree {\n // Get a serializable form of data\n const content: ICellValue = {\n type: ValueType[ValueType.Plain],\n value: this.toSerializable(this.data, serializer),\n };\n\n // And then construct the tree for it\n const tree: ITree = {\n entries: [\n {\n mode: FileMode.File,\n path: snapshotFileName,\n type: TreeEntry.Blob,\n value: {\n contents: JSON.stringify(content),\n encoding: \"utf-8\",\n },\n },\n ],\n };\n\n return tree;\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService): Promise<void> {\n const content = await readAndParse<ICellValue>(storage, snapshotFileName);\n\n this.data = this.fromSerializable(content);\n }\n\n /**\n * Initialize a local instance of cell\n */\n protected initializeLocalCore() {\n this.data = undefined;\n }\n\n /**\n * Process the cell value on register\n */\n protected registerCore() {\n if (SharedObject.is(this.data)) {\n this.data.bindToContext();\n }\n }\n\n /**\n * Call back on disconnect\n */\n protected onDisconnect() {}\n\n /**\n * Process a cell operation\n *\n * @param message - the message to prepare\n * @param local - whether the message was sent by the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (this.messageId !== this.messageIdObserved) {\n // We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.\n if (local) {\n const messageIdReceived = localOpMetadata as number;\n assert(messageIdReceived !== undefined && messageIdReceived <= this.messageId,\n 0x00c /* \"messageId is incorrect from from the local client's ACK\" */);\n\n // We got an ACK. Update messageIdObserved.\n this.messageIdObserved = localOpMetadata as number;\n }\n return;\n }\n\n if (message.type === MessageType.Operation && !local) {\n const op = message.contents as ICellOperation;\n\n switch (op.type) {\n case \"setCell\":\n this.setCore(this.fromSerializable(op.value));\n break;\n\n case \"deleteCell\":\n this.deleteCore();\n break;\n\n default:\n throw new Error(\"Unknown operation\");\n }\n }\n }\n\n private setCore(value: Serializable<T>) {\n this.data = value;\n this.emit(\"valueChanged\", value);\n }\n\n private deleteCore() {\n this.data = undefined;\n this.emit(\"delete\");\n }\n\n private toSerializable(value: T | undefined, serializer: IFluidSerializer) {\n if (value === undefined) {\n return value;\n }\n\n // Stringify to convert to the serialized handle values - and then parse in order to create\n // a POJO for the op\n const stringified = serializer.stringify(value, this.handle);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return JSON.parse(stringified);\n }\n\n private fromSerializable(operation: ICellValue) {\n let value = operation.value;\n\n // Convert any stored shared object to updated handle\n if (operation.type === ValueType[ValueType.Shared]) {\n const handle: ISerializedHandle = {\n type: \"__fluid_handle__\",\n url: operation.value as string,\n };\n value = handle;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value !== undefined\n ? this.serializer.parse(JSON.stringify(value))\n : value;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\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 = "0.45.4";
8
+ export declare const pkgVersion = "0.46.2";
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/cell";
11
- exports.pkgVersion = "0.45.4";
11
+ exports.pkgVersion = "0.46.2";
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,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 = \"0.45.4\";\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 = \"0.46.2\";\n"]}
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,EAAE,gBAAgB,EAAqB,MAAM,iCAAiC,CAAC;AA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EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,kBAAkB;IAIvF;;OAEG;IACI,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS;IAIzC;;OAEG;IACI,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IA0BjC;;OAEG;IACI,MAAM;IAeb;;OAEG;IACI,KAAK;IAIZ;;;;OAIG;IACH,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,gBAAgB,GAAG,KAAK;IAyB3D;;OAEG;cACa,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxE;;OAEG;IACH,SAAS,CAAC,mBAAmB;IAI7B;;OAEG;IACH,SAAS,CAAC,YAAY;IAMtB;;OAEG;IACH,SAAS,CAAC,YAAY;IAEtB;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,CAAC,OAAO,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO;IAgClG,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,gBAAgB;IAkBxB,SAAS,CAAC,cAAc;CAG3B"}
package/lib/cell.js CHANGED
@@ -7,7 +7,6 @@ import { FileMode, MessageType, TreeEntry, } from "@fluidframework/protocol-defi
7
7
  import { readAndParse } from "@fluidframework/driver-utils";
8
8
  import { SharedObject, ValueType } from "@fluidframework/shared-object-base";
9
9
  import { CellFactory } from "./cellFactory";
10
- import { debug } from "./debug";
11
10
  const snapshotFileName = "header";
12
11
  /**
13
12
  * The SharedCell distributed data structure can be used to store a single serializable value.
@@ -197,9 +196,7 @@ export class SharedCell extends SharedObject {
197
196
  /**
198
197
  * Call back on disconnect
199
198
  */
200
- onDisconnect() {
201
- debug(`Cell ${this.id} is now disconnected`);
202
- }
199
+ onDisconnect() { }
203
200
  /**
204
201
  * Process a cell operation
205
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,IAAI,EAAE,kBAAkB;gBACxB,GAAG,EAAE,SAAS,CAAC,KAAe;aACjC,CAAC;YACF,KAAK,GAAG,MAAM,CAAC;SAClB;QAED,+DAA+D;QAC/D,OAAO,KAAK,KAAK,SAAS;YACtB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC,CAAC,KAAK,CAAC;IAChB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IFluidSerializer, ISerializedHandle } from \"@fluidframework/core-interfaces\";\n\nimport {\n FileMode,\n ISequencedDocumentMessage,\n ITree,\n MessageType,\n TreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelFactory,\n Serializable,\n} from \"@fluidframework/datastore-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { SharedObject, ValueType } from \"@fluidframework/shared-object-base\";\nimport { CellFactory } from \"./cellFactory\";\nimport { debug } from \"./debug\";\nimport { ISharedCell, ISharedCellEvents } from \"./interfaces\";\n\n/**\n * Description of a cell delta operation\n */\ntype ICellOperation = ISetCellOperation | IDeleteCellOperation;\n\ninterface ISetCellOperation {\n type: \"setCell\";\n value: ICellValue;\n}\n\ninterface IDeleteCellOperation {\n type: \"deleteCell\";\n}\n\ninterface ICellValue {\n // The type of the value\n type: string;\n\n // The actual value\n value: any;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * The SharedCell distributed data structure can be used to store a single serializable value.\n *\n * @remarks\n * ### Creation\n *\n * To create a `SharedCell`, call the static create method:\n *\n * ```typescript\n * const myCell = SharedCell.create(this.runtime, id);\n * ```\n *\n * ### Usage\n *\n * The value stored in the cell can be set with the `.set()` method and retrieved with the `.get()` method:\n *\n * ```typescript\n * myCell.set(3);\n * console.log(myCell.get()); // 3\n * ```\n *\n * The value must only be plain JS objects or `SharedObject` handles (e.g. to another DDS or Fluid object).\n * In collaborative scenarios, the value is settled with a policy of _last write wins_.\n *\n * The `.delete()` method will delete the stored value from the cell:\n *\n * ```typescript\n * myCell.delete();\n * console.log(myCell.get()); // undefined\n * ```\n *\n * The `.empty()` method will check if the value is undefined.\n *\n * ```typescript\n * if (myCell.empty()) {\n * // myCell.get() will return undefined\n * } else {\n * // myCell.get() will return a non-undefined value\n * }\n * ```\n *\n * ### Eventing\n *\n * `SharedCell` is an `EventEmitter`, and will emit events when other clients make modifications. You should\n * register for these events and respond appropriately as the data is modified. `valueChanged` will be emitted\n * in response to a `set`, and `delete` will be emitted in response to a `delete`.\n */\nexport class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>>\n implements ISharedCell<T> {\n /**\n * Create a new shared cell\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, CellFactory.Type) as SharedCell;\n }\n\n /**\n * Get a factory for SharedCell to register with the data store.\n *\n * @returns a factory that creates and load SharedCell\n */\n public static getFactory(): IChannelFactory {\n return new CellFactory();\n }\n /**\n * The data held by this cell.\n */\n private data: Serializable<T> | undefined;\n\n /**\n * This is used to assign a unique id to outgoing messages. It is used to track messages until\n * they are ack'd.\n */\n private messageId: number = -1;\n\n /**\n * This keeps track of the messageId of messages that have been ack'd. It is updated every time\n * we a message is ack'd with it's messageId.\n */\n private messageIdObserved: number = -1;\n\n /**\n * Constructs a new shared cell. If the object is non-local an id and service interfaces will\n * be provided\n *\n * @param runtime - data store runtime the shared map belongs to\n * @param id - optional name of the shared map\n */\n constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n super(id, runtime, attributes);\n }\n\n /**\n * {@inheritDoc ISharedCell.get}\n */\n public get(): Serializable<T> | undefined {\n return this.data;\n }\n\n /**\n * {@inheritDoc ISharedCell.set}\n */\n public set(value: Serializable<T>) {\n if (SharedObject.is(value)) {\n throw new Error(\"SharedObject sets are no longer supported. Instead set the SharedObject handle.\");\n }\n\n // Serialize the value if required.\n const operationValue: ICellValue = {\n type: ValueType[ValueType.Plain],\n value: this.toSerializable(value, this.serializer),\n };\n\n // Set the value locally.\n this.setCore(value);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: ISetCellOperation = {\n type: \"setCell\",\n value: operationValue,\n };\n this.submitLocalMessage(op, ++this.messageId);\n }\n\n /**\n * {@inheritDoc ISharedCell.delete}\n */\n public delete() {\n // Delete the value locally.\n this.deleteCore();\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IDeleteCellOperation = {\n type: \"deleteCell\",\n };\n this.submitLocalMessage(op, ++this.messageId);\n }\n\n /**\n * {@inheritDoc ISharedCell.empty}\n */\n public empty() {\n return this.data === undefined;\n }\n\n /**\n * Create a snapshot for the cell\n *\n * @returns the snapshot of the current state of the cell\n */\n protected snapshotCore(serializer: IFluidSerializer): ITree {\n // Get a serializable form of data\n const content: ICellValue = {\n type: ValueType[ValueType.Plain],\n value: this.toSerializable(this.data, serializer),\n };\n\n // And then construct the tree for it\n const tree: ITree = {\n entries: [\n {\n mode: FileMode.File,\n path: snapshotFileName,\n type: TreeEntry.Blob,\n value: {\n contents: JSON.stringify(content),\n encoding: \"utf-8\",\n },\n },\n ],\n };\n\n return tree;\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService): Promise<void> {\n const content = await readAndParse<ICellValue>(storage, snapshotFileName);\n\n this.data = this.fromSerializable(content);\n }\n\n /**\n * Initialize a local instance of cell\n */\n protected initializeLocalCore() {\n this.data = undefined;\n }\n\n /**\n * Process the cell value on register\n */\n protected registerCore() {\n if (SharedObject.is(this.data)) {\n this.data.bindToContext();\n }\n }\n\n /**\n * Call back on disconnect\n */\n protected onDisconnect() {\n debug(`Cell ${this.id} is now disconnected`);\n }\n\n /**\n * Process a cell operation\n *\n * @param message - the message to prepare\n * @param local - whether the message was sent by the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (this.messageId !== this.messageIdObserved) {\n // We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.\n if (local) {\n const messageIdReceived = localOpMetadata as number;\n assert(messageIdReceived !== undefined && messageIdReceived <= this.messageId,\n 0x00c /* \"messageId is incorrect from from the local client's ACK\" */);\n\n // We got an ACK. Update messageIdObserved.\n this.messageIdObserved = localOpMetadata as number;\n }\n return;\n }\n\n if (message.type === MessageType.Operation && !local) {\n const op = message.contents as ICellOperation;\n\n switch (op.type) {\n case \"setCell\":\n this.setCore(this.fromSerializable(op.value));\n break;\n\n case \"deleteCell\":\n this.deleteCore();\n break;\n\n default:\n throw new Error(\"Unknown operation\");\n }\n }\n }\n\n private setCore(value: Serializable<T>) {\n this.data = value;\n this.emit(\"valueChanged\", value);\n }\n\n private deleteCore() {\n this.data = undefined;\n this.emit(\"delete\");\n }\n\n private toSerializable(value: T | undefined, serializer: IFluidSerializer) {\n if (value === undefined) {\n return value;\n }\n\n // Stringify to convert to the serialized handle values - and then parse in order to create\n // a POJO for the op\n const stringified = serializer.stringify(value, this.handle);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return JSON.parse(stringified);\n }\n\n private fromSerializable(operation: ICellValue) {\n let value = operation.value;\n\n // Convert any stored shared object to updated handle\n if (operation.type === ValueType[ValueType.Shared]) {\n const handle: ISerializedHandle = {\n type: \"__fluid_handle__\",\n url: operation.value as string,\n };\n value = handle;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value !== undefined\n ? this.serializer.parse(JSON.stringify(value))\n : value;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\n}\n"]}
1
+ {"version":3,"file":"cell.js","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAGtD,OAAO,EACH,QAAQ,EAGR,WAAW,EACX,SAAS,GACZ,MAAM,sCAAsC,CAAC;AAQ9C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAyB5C,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,OAAO,UAAoB,SAAQ,YAAkC;IAsCvE;;;;;;OAMG;IACH,YAAY,EAAU,EAAE,OAA+B,EAAE,UAA8B;QACnF,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QApBnC;;;WAGG;QACK,cAAS,GAAW,CAAC,CAAC,CAAC;QAE/B;;;WAGG;QACK,sBAAiB,GAAW,CAAC,CAAC,CAAC;IAWvC,CAAC;IA7CD;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAAC,OAA+B,EAAE,EAAW;QAC7D,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,CAAe,CAAC;IACrE,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,UAAU;QACpB,OAAO,IAAI,WAAW,EAAE,CAAC;IAC7B,CAAC;IA6BD;;OAEG;IACI,GAAG;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;OAEG;IACI,GAAG,CAAC,KAAsB;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AAG,EAAE,SAAS,CAAC,KAAe;aACjC,CAAC;YACF,KAAK,GAAG,MAAM,CAAC;SAClB;QAED,+DAA+D;QAC/D,OAAO,KAAK,KAAK,SAAS;YACtB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC,CAAC,KAAK,CAAC;IAChB,CAAC;IAES,cAAc;QACpB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { IFluidSerializer, ISerializedHandle } from \"@fluidframework/core-interfaces\";\n\nimport {\n FileMode,\n ISequencedDocumentMessage,\n ITree,\n MessageType,\n TreeEntry,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelFactory,\n Serializable,\n} from \"@fluidframework/datastore-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport { SharedObject, ValueType } from \"@fluidframework/shared-object-base\";\nimport { CellFactory } from \"./cellFactory\";\nimport { ISharedCell, ISharedCellEvents } from \"./interfaces\";\n\n/**\n * Description of a cell delta operation\n */\ntype ICellOperation = ISetCellOperation | IDeleteCellOperation;\n\ninterface ISetCellOperation {\n type: \"setCell\";\n value: ICellValue;\n}\n\ninterface IDeleteCellOperation {\n type: \"deleteCell\";\n}\n\ninterface ICellValue {\n // The type of the value\n type: string;\n\n // The actual value\n value: any;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * The SharedCell distributed data structure can be used to store a single serializable value.\n *\n * @remarks\n * ### Creation\n *\n * To create a `SharedCell`, call the static create method:\n *\n * ```typescript\n * const myCell = SharedCell.create(this.runtime, id);\n * ```\n *\n * ### Usage\n *\n * The value stored in the cell can be set with the `.set()` method and retrieved with the `.get()` method:\n *\n * ```typescript\n * myCell.set(3);\n * console.log(myCell.get()); // 3\n * ```\n *\n * The value must only be plain JS objects or `SharedObject` handles (e.g. to another DDS or Fluid object).\n * In collaborative scenarios, the value is settled with a policy of _last write wins_.\n *\n * The `.delete()` method will delete the stored value from the cell:\n *\n * ```typescript\n * myCell.delete();\n * console.log(myCell.get()); // undefined\n * ```\n *\n * The `.empty()` method will check if the value is undefined.\n *\n * ```typescript\n * if (myCell.empty()) {\n * // myCell.get() will return undefined\n * } else {\n * // myCell.get() will return a non-undefined value\n * }\n * ```\n *\n * ### Eventing\n *\n * `SharedCell` is an `EventEmitter`, and will emit events when other clients make modifications. You should\n * register for these events and respond appropriately as the data is modified. `valueChanged` will be emitted\n * in response to a `set`, and `delete` will be emitted in response to a `delete`.\n */\nexport class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>>\n implements ISharedCell<T> {\n /**\n * Create a new shared cell\n *\n * @param runtime - data store runtime the new shared map belongs to\n * @param id - optional name of the shared map\n * @returns newly create shared map (but not attached yet)\n */\n public static create(runtime: IFluidDataStoreRuntime, id?: string) {\n return runtime.createChannel(id, CellFactory.Type) as SharedCell;\n }\n\n /**\n * Get a factory for SharedCell to register with the data store.\n *\n * @returns a factory that creates and load SharedCell\n */\n public static getFactory(): IChannelFactory {\n return new CellFactory();\n }\n /**\n * The data held by this cell.\n */\n private data: Serializable<T> | undefined;\n\n /**\n * This is used to assign a unique id to outgoing messages. It is used to track messages until\n * they are ack'd.\n */\n private messageId: number = -1;\n\n /**\n * This keeps track of the messageId of messages that have been ack'd. It is updated every time\n * we a message is ack'd with it's messageId.\n */\n private messageIdObserved: number = -1;\n\n /**\n * Constructs a new shared cell. If the object is non-local an id and service interfaces will\n * be provided\n *\n * @param runtime - data store runtime the shared map belongs to\n * @param id - optional name of the shared map\n */\n constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes) {\n super(id, runtime, attributes);\n }\n\n /**\n * {@inheritDoc ISharedCell.get}\n */\n public get(): Serializable<T> | undefined {\n return this.data;\n }\n\n /**\n * {@inheritDoc ISharedCell.set}\n */\n public set(value: Serializable<T>) {\n if (SharedObject.is(value)) {\n throw new Error(\"SharedObject sets are no longer supported. Instead set the SharedObject handle.\");\n }\n\n // Serialize the value if required.\n const operationValue: ICellValue = {\n type: ValueType[ValueType.Plain],\n value: this.toSerializable(value, this.serializer),\n };\n\n // Set the value locally.\n this.setCore(value);\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: ISetCellOperation = {\n type: \"setCell\",\n value: operationValue,\n };\n this.submitLocalMessage(op, ++this.messageId);\n }\n\n /**\n * {@inheritDoc ISharedCell.delete}\n */\n public delete() {\n // Delete the value locally.\n this.deleteCore();\n\n // If we are not attached, don't submit the op.\n if (!this.isAttached()) {\n return;\n }\n\n const op: IDeleteCellOperation = {\n type: \"deleteCell\",\n };\n this.submitLocalMessage(op, ++this.messageId);\n }\n\n /**\n * {@inheritDoc ISharedCell.empty}\n */\n public empty() {\n return this.data === undefined;\n }\n\n /**\n * Create a snapshot for the cell\n *\n * @returns the snapshot of the current state of the cell\n */\n protected snapshotCore(serializer: IFluidSerializer): ITree {\n // Get a serializable form of data\n const content: ICellValue = {\n type: ValueType[ValueType.Plain],\n value: this.toSerializable(this.data, serializer),\n };\n\n // And then construct the tree for it\n const tree: ITree = {\n entries: [\n {\n mode: FileMode.File,\n path: snapshotFileName,\n type: TreeEntry.Blob,\n value: {\n contents: JSON.stringify(content),\n encoding: \"utf-8\",\n },\n },\n ],\n };\n\n return tree;\n }\n\n /**\n * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}\n */\n protected async loadCore(storage: IChannelStorageService): Promise<void> {\n const content = await readAndParse<ICellValue>(storage, snapshotFileName);\n\n this.data = this.fromSerializable(content);\n }\n\n /**\n * Initialize a local instance of cell\n */\n protected initializeLocalCore() {\n this.data = undefined;\n }\n\n /**\n * Process the cell value on register\n */\n protected registerCore() {\n if (SharedObject.is(this.data)) {\n this.data.bindToContext();\n }\n }\n\n /**\n * Call back on disconnect\n */\n protected onDisconnect() {}\n\n /**\n * Process a cell operation\n *\n * @param message - the message to prepare\n * @param local - whether the message was sent by the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n if (this.messageId !== this.messageIdObserved) {\n // We are waiting for an ACK on our change to this cell - we will ignore all messages until we get it.\n if (local) {\n const messageIdReceived = localOpMetadata as number;\n assert(messageIdReceived !== undefined && messageIdReceived <= this.messageId,\n 0x00c /* \"messageId is incorrect from from the local client's ACK\" */);\n\n // We got an ACK. Update messageIdObserved.\n this.messageIdObserved = localOpMetadata as number;\n }\n return;\n }\n\n if (message.type === MessageType.Operation && !local) {\n const op = message.contents as ICellOperation;\n\n switch (op.type) {\n case \"setCell\":\n this.setCore(this.fromSerializable(op.value));\n break;\n\n case \"deleteCell\":\n this.deleteCore();\n break;\n\n default:\n throw new Error(\"Unknown operation\");\n }\n }\n }\n\n private setCore(value: Serializable<T>) {\n this.data = value;\n this.emit(\"valueChanged\", value);\n }\n\n private deleteCore() {\n this.data = undefined;\n this.emit(\"delete\");\n }\n\n private toSerializable(value: T | undefined, serializer: IFluidSerializer) {\n if (value === undefined) {\n return value;\n }\n\n // Stringify to convert to the serialized handle values - and then parse in order to create\n // a POJO for the op\n const stringified = serializer.stringify(value, this.handle);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return JSON.parse(stringified);\n }\n\n private fromSerializable(operation: ICellValue) {\n let value = operation.value;\n\n // Convert any stored shared object to updated handle\n if (operation.type === ValueType[ValueType.Shared]) {\n const handle: ISerializedHandle = {\n type: \"__fluid_handle__\",\n url: operation.value as string,\n };\n value = handle;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return value !== undefined\n ? this.serializer.parse(JSON.stringify(value))\n : value;\n }\n\n protected applyStashedOp() {\n throw new Error(\"not implemented\");\n }\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 = "0.45.4";
8
+ export declare const pkgVersion = "0.46.2";
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/cell";
8
- export const pkgVersion = "0.45.4";
8
+ export const pkgVersion = "0.46.2";
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,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 = \"0.45.4\";\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 = \"0.46.2\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/cell",
3
- "version": "0.45.4",
3
+ "version": "0.46.2",
4
4
  "description": "Distributed data structure for a single value",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": "https://github.com/microsoft/FluidFramework",
@@ -57,20 +57,18 @@
57
57
  "dependencies": {
58
58
  "@fluidframework/common-utils": "^0.32.1",
59
59
  "@fluidframework/core-interfaces": "^0.39.7",
60
- "@fluidframework/datastore-definitions": "^0.45.4",
61
- "@fluidframework/driver-utils": "^0.45.4",
60
+ "@fluidframework/datastore-definitions": "^0.46.2",
61
+ "@fluidframework/driver-utils": "^0.46.2",
62
62
  "@fluidframework/protocol-definitions": "^0.1024.0",
63
- "@fluidframework/shared-object-base": "^0.45.4",
64
- "debug": "^4.1.1"
63
+ "@fluidframework/shared-object-base": "^0.46.2"
65
64
  },
66
65
  "devDependencies": {
67
- "@fluid-internal/test-dds-utils": "^0.45.4",
66
+ "@fluid-internal/test-dds-utils": "^0.46.2",
68
67
  "@fluidframework/build-common": "^0.22.0",
69
68
  "@fluidframework/eslint-config-fluid": "^0.23.0",
70
- "@fluidframework/mocha-test-setup": "^0.45.4",
71
- "@fluidframework/test-runtime-utils": "^0.45.4",
69
+ "@fluidframework/mocha-test-setup": "^0.46.2",
70
+ "@fluidframework/test-runtime-utils": "^0.46.2",
72
71
  "@microsoft/api-extractor": "^7.16.1",
73
- "@types/debug": "^4.1.5",
74
72
  "@types/mocha": "^8.2.2",
75
73
  "@types/node": "^12.19.0",
76
74
  "@typescript-eslint/eslint-plugin": "~4.14.0",
package/src/cell.ts CHANGED
@@ -23,7 +23,6 @@ import {
23
23
  import { readAndParse } from "@fluidframework/driver-utils";
24
24
  import { SharedObject, ValueType } from "@fluidframework/shared-object-base";
25
25
  import { CellFactory } from "./cellFactory";
26
- import { debug } from "./debug";
27
26
  import { ISharedCell, ISharedCellEvents } from "./interfaces";
28
27
 
29
28
  /**
@@ -265,9 +264,7 @@ export class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>>
265
264
  /**
266
265
  * Call back on disconnect
267
266
  */
268
- protected onDisconnect() {
269
- debug(`Cell ${this.id} is now disconnected`);
270
- }
267
+ protected onDisconnect() {}
271
268
 
272
269
  /**
273
270
  * Process a cell operation
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/cell";
9
- export const pkgVersion = "0.45.4";
9
+ export const pkgVersion = "0.46.2";
package/dist/debug.d.ts DELETED
@@ -1,7 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import registerDebug from "debug";
6
- export declare const debug: registerDebug.Debugger;
7
- //# sourceMappingURL=debug.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,aAAa,MAAM,OAAO,CAAC;AAGlC,eAAO,MAAM,KAAK,wBAA8B,CAAC"}
package/dist/debug.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.debug = void 0;
11
- const debug_1 = __importDefault(require("debug"));
12
- const packageVersion_1 = require("./packageVersion");
13
- exports.debug = debug_1.default("fluid:cell");
14
- exports.debug(`Package: ${packageVersion_1.pkgName} - Version: ${packageVersion_1.pkgVersion}`);
15
- //# sourceMappingURL=debug.js.map
package/dist/debug.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,kDAAkC;AAClC,qDAAuD;AAE1C,QAAA,KAAK,GAAG,eAAa,CAAC,YAAY,CAAC,CAAC;AACjD,aAAK,CAAC,YAAY,wBAAO,eAAe,2BAAU,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport registerDebug from \"debug\";\nimport { pkgName, pkgVersion } from \"./packageVersion\";\n\nexport const debug = registerDebug(\"fluid:cell\");\ndebug(`Package: ${pkgName} - Version: ${pkgVersion}`);\n"]}
package/lib/debug.d.ts DELETED
@@ -1,7 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import registerDebug from "debug";
6
- export declare const debug: registerDebug.Debugger;
7
- //# sourceMappingURL=debug.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,aAAa,MAAM,OAAO,CAAC;AAGlC,eAAO,MAAM,KAAK,wBAA8B,CAAC"}
package/lib/debug.js DELETED
@@ -1,9 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import registerDebug from "debug";
6
- import { pkgName, pkgVersion } from "./packageVersion";
7
- export const debug = registerDebug("fluid:cell");
8
- debug(`Package: ${pkgName} - Version: ${pkgVersion}`);
9
- //# sourceMappingURL=debug.js.map
package/lib/debug.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,aAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;AACjD,KAAK,CAAC,YAAY,OAAO,eAAe,UAAU,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport registerDebug from \"debug\";\nimport { pkgName, pkgVersion } from \"./packageVersion\";\n\nexport const debug = registerDebug(\"fluid:cell\");\ndebug(`Package: ${pkgName} - Version: ${pkgVersion}`);\n"]}
package/src/debug.ts DELETED
@@ -1,10 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- import registerDebug from "debug";
7
- import { pkgName, pkgVersion } from "./packageVersion";
8
-
9
- export const debug = registerDebug("fluid:cell");
10
- debug(`Package: ${pkgName} - Version: ${pkgVersion}`);