@fluidframework/cell 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.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.
@@ -4,6 +4,7 @@
4
4
  * @packageDocumentation
5
5
  */
6
6
 
7
+ import { AttributionKey } from '@fluidframework/runtime-definitions';
7
8
  import { IChannelAttributes } from '@fluidframework/datastore-definitions';
8
9
  import { IChannelFactory } from '@fluidframework/datastore-definitions';
9
10
  import { IChannelStorageService } from '@fluidframework/datastore-definitions';
@@ -22,222 +23,30 @@ import { SharedObject } from '@fluidframework/shared-object-base';
22
23
 
23
24
  /* Excluded from this release type: ICellOptions */
24
25
 
25
- /**
26
- * A Distributed Data Structure (DDS), which stores a single shared value that can be edited or deleted.
27
- *
28
- * @typeParam T - The type of cell data. Must be serializable.
29
- *
30
- * @example Creation
31
- *
32
- * To create a `SharedCell`, call the static create method:
33
- *
34
- * ```typescript
35
- * const myCell = SharedCell.create(this.runtime, id);
36
- * ```
37
- *
38
- * @example Usage
39
- *
40
- * The value stored in the cell can be set with the `.set()` method and retrieved with the `.get()` method:
41
- *
42
- * ```typescript
43
- * myCell.set(3);
44
- * console.log(myCell.get()); // 3
45
- * ```
46
- *
47
- * The value must only be plain JS objects or `SharedObject` handles (e.g. to another DDS or Fluid object).
48
- * In collaborative scenarios, the value is settled with a policy of _last write wins_.
49
- *
50
- * The `.delete()` method will delete the stored value from the cell:
51
- *
52
- * ```typescript
53
- * myCell.delete();
54
- * console.log(myCell.get()); // undefined
55
- * ```
56
- *
57
- * The `.empty()` method will check if the value is undefined.
58
- *
59
- * ```typescript
60
- * if (myCell.empty()) {
61
- * // myCell.get() will return undefined
62
- * } else {
63
- * // myCell.get() will return a non-undefined value
64
- * }
65
- * ```
66
- *
67
- * @example Eventing
68
- *
69
- * `SharedCell` is an `EventEmitter`, and will emit events when other clients make modifications. You should
70
- * register for these events and respond appropriately as the data is modified. `valueChanged` will be emitted
71
- * in response to a `set`, and `delete` will be emitted in response to a `delete`.
72
- *
73
- * @public
74
- */
75
- export declare interface ISharedCell<T = any> extends ISharedObject<ISharedCellEvents<T>> {
76
- /**
77
- * Retrieves the cell value.
78
- *
79
- * @returns The value of the cell
80
- */
81
- get(): Serializable<T> | undefined;
82
- /**
83
- * Sets the cell value.
84
- *
85
- * @param value - a JSON-able or SharedObject value to set the cell to
86
- */
87
- set(value: Serializable<T>): void;
88
- /**
89
- * Checks whether cell is empty or not.
90
- *
91
- * @returns `true` if the value of cell is `undefined`, `false` otherwise
92
- */
93
- empty(): boolean;
94
- /**
95
- * Delete the value from the cell.
96
- */
97
- delete(): void;
98
- /* Excluded from this release type: getAttribution */
99
- }
26
+ /* Excluded from this release type: IChannelAttributes */
100
27
 
101
- /**
102
- * Events emitted by {@link ISharedCell}.
103
- *
104
- * @public
105
- */
106
- export declare interface ISharedCellEvents<T> extends ISharedObjectEvents {
107
- /**
108
- * Emitted when the value has changed.
109
- *
110
- * @remarks Event paramters:
111
- *
112
- * - `value`: The new value of the cell.
113
- */
114
- (event: "valueChanged", listener: (value: Serializable<T>) => void): any;
115
- /**
116
- * Emitted when the value has been deleted.
117
- */
118
- (event: "delete", listener: () => void): any;
119
- }
28
+ /* Excluded from this release type: IChannelFactory */
120
29
 
121
- /**
122
- * {@inheritDoc ISharedCell}
123
- *
124
- * @public
125
- */
126
- export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>> implements ISharedCell<T> {
127
- /**
128
- * Create a new `SharedCell`.
129
- *
130
- * @param runtime - The data store runtime to which the `SharedCell` belongs.
131
- * @param id - Unique identifier for the `SharedCell`.
132
- *
133
- * @returns The newly create `SharedCell`. Note that it will not yet be attached.
134
- */
135
- static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCell;
136
- /**
137
- * Gets the factory for the `SharedCell` to register with the data store.
138
- *
139
- * @returns A factory that creates and loads `SharedCell`s.
140
- */
141
- static getFactory(): IChannelFactory;
142
- /**
143
- * The data held by this cell.
144
- */
145
- private data;
146
- /**
147
- * This is used to assign a unique id to outgoing messages. It is used to track messages until
148
- * they are ack'd.
149
- */
150
- private messageId;
151
- /**
152
- * This keeps track of the messageId of messages that have been ack'd. It is updated every time
153
- * we a message is ack'd with it's messageId.
154
- */
155
- private messageIdObserved;
156
- private readonly pendingMessageIds;
157
- private attribution;
158
- private readonly options;
159
- /**
160
- * Constructs a new `SharedCell`.
161
- * If the object is non-local an id and service interfaces will be provided.
162
- *
163
- * @param runtime - The data store runtime to which the `SharedCell` belongs.
164
- * @param id - Unique identifier for the `SharedCell`.
165
- */
166
- constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
167
- /**
168
- * {@inheritDoc ISharedCell.get}
169
- */
170
- get(): Serializable<T> | undefined;
171
- /**
172
- * {@inheritDoc ISharedCell.set}
173
- */
174
- set(value: Serializable<T>): void;
175
- /**
176
- * {@inheritDoc ISharedCell.delete}
177
- */
178
- delete(): void;
179
- /**
180
- * {@inheritDoc ISharedCell.empty}
181
- */
182
- empty(): boolean;
183
- /* Excluded from this release type: getAttribution */
184
- /**
185
- * Set the Op-based attribution through the SequencedDocumentMessage,
186
- * or set the local/detached attribution.
187
- */
188
- private setAttribution;
189
- /**
190
- * Creates a summary for the Cell.
191
- *
192
- * @returns The summary of the current state of the Cell.
193
- */
194
- protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
195
- /**
196
- * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
197
- */
198
- protected loadCore(storage: IChannelStorageService): Promise<void>;
199
- /**
200
- * Initialize a local instance of cell.
201
- */
202
- protected initializeLocalCore(): void;
203
- /**
204
- * Call back on disconnect.
205
- */
206
- protected onDisconnect(): void;
207
- /**
208
- * Apply inner op.
209
- *
210
- * @param content - ICellOperation content
211
- */
212
- private applyInnerOp;
213
- /**
214
- * Process a cell operation (op).
215
- *
216
- * @param message - The message to prepare.
217
- * @param local - Whether or not the message was sent by the local client.
218
- * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
219
- * For messages from a remote client, this will be `undefined`.
220
- */
221
- protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
222
- private setCore;
223
- private deleteCore;
224
- private decode;
225
- private createLocalOpMetadata;
226
- /* Excluded from this release type: applyStashedOp */
227
- /**
228
- * Rollback a local op.
229
- *
230
- * @param content - The operation to rollback.
231
- * @param localOpMetadata - The local metadata associated with the op.
232
- */
233
- protected rollback(content: any, localOpMetadata: unknown): void;
234
- /**
235
- * Submit a cell message to remote clients.
236
- *
237
- * @param op - The cell message.
238
- * @param previousValue - The value of the cell before this op.
239
- */
240
- private submitCellMessage;
241
- }
30
+ /* Excluded from this release type: IChannelStorageService */
31
+
32
+ /* Excluded from this release type: IFluidDataStoreRuntime */
33
+
34
+ /* Excluded from this release type: IFluidSerializer */
35
+
36
+ /* Excluded from this release type: ISharedCell */
37
+
38
+ /* Excluded from this release type: ISharedCellEvents */
39
+
40
+ /* Excluded from this release type: ISharedObject */
41
+
42
+ /* Excluded from this release type: ISharedObjectEvents */
43
+
44
+ /* Excluded from this release type: ISummaryTreeWithStats */
45
+
46
+ /* Excluded from this release type: Serializable */
47
+
48
+ /* Excluded from this release type: SharedCell */
49
+
50
+ /* Excluded from this release type: SharedObject */
242
51
 
243
52
  export { }
@@ -22,8 +22,7 @@ import { SharedObject } from '@fluidframework/shared-object-base';
22
22
  * (i.e. who creeated the content and when it was created)
23
23
  *
24
24
  * default: false
25
- *
26
- * @alpha
25
+ * @internal
27
26
  */
28
27
  export declare interface ICellAttributionOptions {
29
28
  track?: boolean;
@@ -31,8 +30,7 @@ export declare interface ICellAttributionOptions {
31
30
 
32
31
  /**
33
32
  * Options related to attribution
34
- *
35
- * @alpha
33
+ * @internal
36
34
  */
37
35
  export declare interface ICellOptions {
38
36
  attribution?: ICellAttributionOptions;
@@ -85,8 +83,7 @@ export declare interface ICellOptions {
85
83
  * `SharedCell` is an `EventEmitter`, and will emit events when other clients make modifications. You should
86
84
  * register for these events and respond appropriately as the data is modified. `valueChanged` will be emitted
87
85
  * in response to a `set`, and `delete` will be emitted in response to a `delete`.
88
- *
89
- * @public
86
+ * @internal
90
87
  */
91
88
  export declare interface ISharedCell<T = any> extends ISharedObject<ISharedCellEvents<T>> {
92
89
  /**
@@ -112,7 +109,6 @@ export declare interface ISharedCell<T = any> extends ISharedObject<ISharedCellE
112
109
  */
113
110
  delete(): void;
114
111
  /**
115
- * @alpha
116
112
  * @returns the AttributionKey associated with the cell's most recent change.
117
113
  */
118
114
  getAttribution(): AttributionKey | undefined;
@@ -120,8 +116,7 @@ export declare interface ISharedCell<T = any> extends ISharedObject<ISharedCellE
120
116
 
121
117
  /**
122
118
  * Events emitted by {@link ISharedCell}.
123
- *
124
- * @public
119
+ * @internal
125
120
  */
126
121
  export declare interface ISharedCellEvents<T> extends ISharedObjectEvents {
127
122
  /**
@@ -140,8 +135,7 @@ export declare interface ISharedCellEvents<T> extends ISharedObjectEvents {
140
135
 
141
136
  /**
142
137
  * {@inheritDoc ISharedCell}
143
- *
144
- * @public
138
+ * @internal
145
139
  */
146
140
  export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>> implements ISharedCell<T> {
147
141
  /**
@@ -202,7 +196,6 @@ export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<
202
196
  empty(): boolean;
203
197
  /**
204
198
  * {@inheritDoc ISharedCell.getAttribution}
205
- * @alpha
206
199
  */
207
200
  getAttribution(): AttributionKey | undefined;
208
201
  /**
@@ -249,8 +242,6 @@ export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<
249
242
  private createLocalOpMetadata;
250
243
  /**
251
244
  * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
252
- *
253
- * @internal
254
245
  */
255
246
  protected applyStashedOp(content: unknown): unknown;
256
247
  /**
package/lib/cell.d.ts CHANGED
@@ -6,11 +6,10 @@ import { type ISequencedDocumentMessage } from "@fluidframework/protocol-definit
6
6
  import { type IChannelAttributes, type IFluidDataStoreRuntime, type IChannelStorageService, type IChannelFactory, type Serializable } from "@fluidframework/datastore-definitions";
7
7
  import { type AttributionKey, type ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
8
8
  import { type IFluidSerializer, SharedObject } from "@fluidframework/shared-object-base";
9
- import { type ISharedCell, type ISharedCellEvents } from "./interfaces";
9
+ import { type ISharedCell, type ISharedCellEvents } from "./interfaces.mjs";
10
10
  /**
11
11
  * {@inheritDoc ISharedCell}
12
- *
13
- * @public
12
+ * @internal
14
13
  */
15
14
  export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>> implements ISharedCell<T> {
16
15
  /**
@@ -71,7 +70,6 @@ export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<
71
70
  empty(): boolean;
72
71
  /**
73
72
  * {@inheritDoc ISharedCell.getAttribution}
74
- * @alpha
75
73
  */
76
74
  getAttribution(): AttributionKey | undefined;
77
75
  /**
@@ -118,8 +116,6 @@ export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<
118
116
  private createLocalOpMetadata;
119
117
  /**
120
118
  * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
121
- *
122
- * @internal
123
119
  */
124
120
  protected applyStashedOp(content: unknown): unknown;
125
121
  /**
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,KAAK,yBAAyB,EAAe,MAAM,sCAAsC,CAAC;AACnG,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAEN,KAAK,gBAAgB,EAC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,CAAC,UAAU;IAOlB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,qBAAqB;IAa7B;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO;IAMnD;;;;;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.mjs CHANGED
@@ -10,8 +10,7 @@ import { CellFactory } from "./cellFactory.mjs";
10
10
  const snapshotFileName = "header";
11
11
  /**
12
12
  * {@inheritDoc ISharedCell}
13
- *
14
- * @public
13
+ * @internal
15
14
  */
16
15
  // TODO: use `unknown` instead (breaking change).
17
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -109,7 +108,6 @@ export class SharedCell extends SharedObject {
109
108
  }
110
109
  /**
111
110
  * {@inheritDoc ISharedCell.getAttribution}
112
- * @alpha
113
111
  */
114
112
  getAttribution() {
115
113
  return this.attribution;
@@ -234,8 +232,6 @@ export class SharedCell extends SharedObject {
234
232
  }
235
233
  /**
236
234
  * {@inheritDoc @fluidframework/shared-object-base#SharedObjectCore.applyStashedOp}
237
- *
238
- * @internal
239
235
  */
240
236
  applyStashedOp(content) {
241
237
  const cellContent = content;
package/lib/cell.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cell.mjs","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAC5C,EAAkC,WAAW,EAAE,MAAM,sCAAsC;OAY3F,EAAE,YAAY,EAAE,MAAM,8BAA8B;OACpD,EACN,uBAAuB,EAEvB,YAAY,GACZ,MAAM,oCAAoC;OACpC,EAAE,WAAW,EAAE;AAkCtB,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC;;;;GAIG;AACH,iDAAiD;AACjD,8DAA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C5E,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 } from \"@fluidframework/core-utils\";\nimport { type ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n\ttype IChannelAttributes,\n\ttype IFluidDataStoreRuntime,\n\ttype IChannelStorageService,\n\ttype IChannelFactory,\n\ttype Serializable,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n\ttype AttributionKey,\n\ttype ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n\tcreateSingleBlobSummary,\n\ttype IFluidSerializer,\n\tSharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport { CellFactory } from \"./cellFactory\";\nimport {\n\ttype ISharedCell,\n\ttype ISharedCellEvents,\n\ttype ICellLocalOpMetadata,\n\ttype ICellOptions,\n} from \"./interfaces\";\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 * @alpha\n\t */\n\tattribution?: AttributionKey;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCell}\n *\n * @public\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 * Create a new `SharedCell`.\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 * @returns The newly create `SharedCell`. Note that it will not yet be attached.\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCell {\n\t\treturn runtime.createChannel(id, CellFactory.Type) as SharedCell;\n\t}\n\n\t/**\n\t * Gets the factory for the `SharedCell` to register with the data store.\n\t *\n\t * @returns A factory that creates and loads `SharedCell`s.\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new CellFactory();\n\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// Serialize the value if required.\n\t\tconst operationValue: ICellValue = {\n\t\t\tvalue: this.serializer.encode(value, this.handle),\n\t\t};\n\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 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 * @alpha\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? { type: \"local\" }\n\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.decode(content);\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(this.decode(content.value));\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 decode(cellValue: ICellValue): Serializable<T> {\n\t\tconst value = cellValue.value;\n\t\treturn this.serializer.decode(value) as Serializable<T>;\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\t * @internal\n\t */\n\tprotected applyStashedOp(content: unknown): unknown {\n\t\tconst cellContent = content as ICellOperation;\n\t\tconst previousValue = this.applyInnerOp(cellContent);\n\t\treturn this.createLocalOpMetadata(cellContent, previousValue);\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.mjs","sourceRoot":"","sources":["../src/cell.ts"],"names":[],"mapp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I,CAAC,iBAAiB,CAAC,GAAG,EAAE,CAAC;YAC1D,IAAI,oBAAoB,KAAK,cAAc,CAAC,gBAAgB,EAAE;gBAC7D,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;aAC3D;SACD;aAAM;YACN,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAC/C;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 } from \"@fluidframework/core-utils\";\nimport { type ISequencedDocumentMessage, MessageType } from \"@fluidframework/protocol-definitions\";\nimport {\n\ttype IChannelAttributes,\n\ttype IFluidDataStoreRuntime,\n\ttype IChannelStorageService,\n\ttype IChannelFactory,\n\ttype Serializable,\n} from \"@fluidframework/datastore-definitions\";\nimport {\n\ttype AttributionKey,\n\ttype ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { readAndParse } from \"@fluidframework/driver-utils\";\nimport {\n\tcreateSingleBlobSummary,\n\ttype IFluidSerializer,\n\tSharedObject,\n} from \"@fluidframework/shared-object-base\";\nimport { CellFactory } from \"./cellFactory\";\nimport {\n\ttype ISharedCell,\n\ttype ISharedCellEvents,\n\ttype ICellLocalOpMetadata,\n\ttype ICellOptions,\n} from \"./interfaces\";\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 * @alpha\n\t */\n\tattribution?: AttributionKey;\n}\n\nconst snapshotFileName = \"header\";\n\n/**\n * {@inheritDoc ISharedCell}\n * @internal\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 * Create a new `SharedCell`.\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 * @returns The newly create `SharedCell`. Note that it will not yet be attached.\n\t */\n\tpublic static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCell {\n\t\treturn runtime.createChannel(id, CellFactory.Type) as SharedCell;\n\t}\n\n\t/**\n\t * Gets the factory for the `SharedCell` to register with the data store.\n\t *\n\t * @returns A factory that creates and loads `SharedCell`s.\n\t */\n\tpublic static getFactory(): IChannelFactory {\n\t\treturn new CellFactory();\n\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// Serialize the value if required.\n\t\tconst operationValue: ICellValue = {\n\t\t\tvalue: this.serializer.encode(value, this.handle),\n\t\t};\n\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 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? { type: \"local\" }\n\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.decode(content);\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(this.decode(content.value));\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 decode(cellValue: ICellValue): Serializable<T> {\n\t\tconst value = cellValue.value;\n\t\treturn this.serializer.decode(value) as Serializable<T>;\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): unknown {\n\t\tconst cellContent = content as ICellOperation;\n\t\tconst previousValue = this.applyInnerOp(cellContent);\n\t\treturn this.createLocalOpMetadata(cellContent, previousValue);\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"]}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { type IChannelAttributes, type IFluidDataStoreRuntime, type IChannelServices, type IChannelFactory } from "@fluidframework/datastore-definitions";
6
- import { type ISharedCell } from "./interfaces";
6
+ import { type ISharedCell } from "./interfaces.mjs";
7
7
  /**
8
8
  * {@link @fluidframework/datastore-definitions#IChannelFactory} for {@link ISharedCell}.
9
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"cellFactory.d.ts","sourceRoot":"","sources":["../src/cellFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD;;;;GAIG;AACH,qBAAa,WAAY,YAAW,eAAe;IAClD;;OAEG;IACH,gBAAuB,IAAI,4CAA4C;IAEvE;;OAEG;IACH,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;OAEG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,WAAW,CAAC;IAMvB;;OAEG;IACI,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW;CAKxE"}
1
+ {"version":3,"file":"cellFactory.d.ts","sourceRoot":"","sources":["../src/cellFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,MAAM,uCAAuC;OAEvC,EAAE,KAAK,WAAW,EAAE;AAG3B;;;;GAIG;AACH,qBAAa,WAAY,YAAW,eAAe;IAClD;;OAEG;IACH,gBAAuB,IAAI,4CAA4C;IAEvE;;OAEG;IACH,gBAAuB,UAAU,EAAE,kBAAkB,CAInD;IAEF;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,kBAAkB,CAE1C;IAED;;OAEG;IACU,IAAI,CAChB,OAAO,EAAE,sBAAsB,EAC/B,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,gBAAgB,EAC1B,UAAU,EAAE,kBAAkB,GAC5B,OAAO,CAAC,WAAW,CAAC;IAMvB;;OAEG;IACI,MAAM,CAAC,QAAQ,EAAE,sBAAsB,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW;CAKxE"}
package/lib/index.d.ts CHANGED
@@ -2,11 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- /**
6
- * The `SharedCell` Distributed Data Structure (DDS) stores a single, shared value that can be edited or deleted.
7
- *
8
- * @packageDocumentation
9
- */
10
- export { SharedCell } from "./cell";
11
- export type { ISharedCell, ISharedCellEvents, ICellOptions, ICellAttributionOptions, } from "./interfaces";
5
+ export { SharedCell } from "./cell.mjs";
6
+ export type { ISharedCell, ISharedCellEvents, ICellOptions, ICellAttributionOptions, } from "./interfaces.mjs";
12
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,YAAY,EACX,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,GACvB,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAQI,EAAE,UAAU,EAAE;YACT,EACX,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,uBAAuB,GACvB"}
@@ -7,8 +7,7 @@ import { type Serializable } from "@fluidframework/datastore-definitions";
7
7
  import { type AttributionKey } from "@fluidframework/runtime-definitions";
8
8
  /**
9
9
  * Events emitted by {@link ISharedCell}.
10
- *
11
- * @public
10
+ * @internal
12
11
  */
13
12
  export interface ISharedCellEvents<T> extends ISharedObjectEvents {
14
13
  /**
@@ -71,8 +70,7 @@ export interface ISharedCellEvents<T> extends ISharedObjectEvents {
71
70
  * `SharedCell` is an `EventEmitter`, and will emit events when other clients make modifications. You should
72
71
  * register for these events and respond appropriately as the data is modified. `valueChanged` will be emitted
73
72
  * in response to a `set`, and `delete` will be emitted in response to a `delete`.
74
- *
75
- * @public
73
+ * @internal
76
74
  */
77
75
  export interface ISharedCell<T = any> extends ISharedObject<ISharedCellEvents<T>> {
78
76
  /**
@@ -98,7 +96,6 @@ export interface ISharedCell<T = any> extends ISharedObject<ISharedCellEvents<T>
98
96
  */
99
97
  delete(): void;
100
98
  /**
101
- * @alpha
102
99
  * @returns the AttributionKey associated with the cell's most recent change.
103
100
  */
104
101
  getAttribution(): AttributionKey | undefined;
@@ -118,8 +115,7 @@ export interface ICellLocalOpMetadata<T = any> {
118
115
  }
119
116
  /**
120
117
  * Options related to attribution
121
- *
122
- * @alpha
118
+ * @internal
123
119
  */
124
120
  export interface ICellOptions {
125
121
  attribution?: ICellAttributionOptions;
@@ -129,8 +125,7 @@ export interface ICellOptions {
129
125
  * (i.e. who creeated the content and when it was created)
130
126
  *
131
127
  * default: false
132
- *
133
- * @alpha
128
+ * @internal
134
129
  */
135
130
  export interface ICellAttributionOptions {
136
131
  track?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAClG,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,CAAE,SAAQ,mBAAmB;IAChE;;;;;;OAMG;IACH,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,OAAE;IAEpE;;OAEG;IACH,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,OAAE;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAGH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAChF;;;;OAIG;IACH,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAEnC;;;;OAIG;IACH,GAAG,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAElC;;;;OAIG;IACH,KAAK,IAAI,OAAO,CAAC;IAEjB;;OAEG;IACH,MAAM,IAAI,IAAI,CAAC;IAEf;;;OAGG;IACH,cAAc,IAAI,cAAc,GAAG,SAAS,CAAC;CAC7C;AAED;;GAEG;AAGH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,GAAG;IAC5C;;OAEG;IAC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f;;OAEG;IACH,cAAc,IAAI,cAAc,GAAG,SAAS,CAAC;CAC7C;AAED;;GAEG;AAGH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,GAAG;IAC5C;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;CAChC;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC5B,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACtC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.mjs","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ISharedObject, type ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { type Serializable } from \"@fluidframework/datastore-definitions\";\nimport { type AttributionKey } from \"@fluidframework/runtime-definitions\";\n\n/**\n * Events emitted by {@link ISharedCell}.\n *\n * @public\n */\nexport interface ISharedCellEvents<T> extends ISharedObjectEvents {\n\t/**\n\t * Emitted when the value has changed.\n\t *\n\t * @remarks Event paramters:\n\t *\n\t * - `value`: The new value of the cell.\n\t */\n\t(event: \"valueChanged\", listener: (value: Serializable<T>) => void);\n\n\t/**\n\t * Emitted when the value has been deleted.\n\t */\n\t(event: \"delete\", listener: () => void);\n}\n\n/**\n * A Distributed Data Structure (DDS), which stores a single shared value that can be edited or deleted.\n *\n * @typeParam T - The type of cell data. Must be serializable.\n *\n * @example 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 * @example 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 * @example 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 *\n * @public\n */\n// TODO: use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ISharedCell<T = any> extends ISharedObject<ISharedCellEvents<T>> {\n\t/**\n\t * Retrieves the cell value.\n\t *\n\t * @returns The value of the cell\n\t */\n\tget(): Serializable<T> | undefined;\n\n\t/**\n\t * Sets the cell value.\n\t *\n\t * @param value - a JSON-able or SharedObject value to set the cell to\n\t */\n\tset(value: Serializable<T>): void;\n\n\t/**\n\t * Checks whether cell is empty or not.\n\t *\n\t * @returns `true` if the value of cell is `undefined`, `false` otherwise\n\t */\n\tempty(): boolean;\n\n\t/**\n\t * Delete the value from the cell.\n\t */\n\tdelete(): void;\n\n\t/**\n\t * @alpha\n\t * @returns the AttributionKey associated with the cell's most recent change.\n\t */\n\tgetAttribution(): AttributionKey | undefined;\n}\n\n/**\n * Describes a local Cell operation (op).\n */\n// TODO: use `unknown` instead.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ICellLocalOpMetadata<T = any> {\n\t/**\n\t * Unique identifier for this local operation (op).\n\t */\n\tpendingMessageId: number;\n\n\t/**\n\t * The value of the {@link ISharedCell} prior to this operation (op).\n\t */\n\tpreviousValue?: Serializable<T>;\n}\n\n/**\n * Options related to attribution\n *\n * @alpha\n */\nexport interface ICellOptions {\n\tattribution?: ICellAttributionOptions;\n}\n\n/**\n * This enables the cell to store the attribution information which can be accessed with the runtime\n * (i.e. who creeated the content and when it was created)\n *\n * default: false\n *\n * @alpha\n */\nexport interface ICellAttributionOptions {\n\ttrack?: boolean;\n}\n"]}
1
+ {"version":3,"file":"interfaces.mjs","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ISharedObject, type ISharedObjectEvents } from \"@fluidframework/shared-object-base\";\nimport { type Serializable } from \"@fluidframework/datastore-definitions\";\nimport { type AttributionKey } from \"@fluidframework/runtime-definitions\";\n\n/**\n * Events emitted by {@link ISharedCell}.\n * @internal\n */\nexport interface ISharedCellEvents<T> extends ISharedObjectEvents {\n\t/**\n\t * Emitted when the value has changed.\n\t *\n\t * @remarks Event paramters:\n\t *\n\t * - `value`: The new value of the cell.\n\t */\n\t(event: \"valueChanged\", listener: (value: Serializable<T>) => void);\n\n\t/**\n\t * Emitted when the value has been deleted.\n\t */\n\t(event: \"delete\", listener: () => void);\n}\n\n/**\n * A Distributed Data Structure (DDS), which stores a single shared value that can be edited or deleted.\n *\n * @typeParam T - The type of cell data. Must be serializable.\n *\n * @example 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 * @example 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 * @example 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 * @internal\n */\n// TODO: use `unknown` instead (breaking change).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ISharedCell<T = any> extends ISharedObject<ISharedCellEvents<T>> {\n\t/**\n\t * Retrieves the cell value.\n\t *\n\t * @returns The value of the cell\n\t */\n\tget(): Serializable<T> | undefined;\n\n\t/**\n\t * Sets the cell value.\n\t *\n\t * @param value - a JSON-able or SharedObject value to set the cell to\n\t */\n\tset(value: Serializable<T>): void;\n\n\t/**\n\t * Checks whether cell is empty or not.\n\t *\n\t * @returns `true` if the value of cell is `undefined`, `false` otherwise\n\t */\n\tempty(): boolean;\n\n\t/**\n\t * Delete the value from the cell.\n\t */\n\tdelete(): void;\n\n\t/**\n\t * @returns the AttributionKey associated with the cell's most recent change.\n\t */\n\tgetAttribution(): AttributionKey | undefined;\n}\n\n/**\n * Describes a local Cell operation (op).\n */\n// TODO: use `unknown` instead.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ICellLocalOpMetadata<T = any> {\n\t/**\n\t * Unique identifier for this local operation (op).\n\t */\n\tpendingMessageId: number;\n\n\t/**\n\t * The value of the {@link ISharedCell} prior to this operation (op).\n\t */\n\tpreviousValue?: Serializable<T>;\n}\n\n/**\n * Options related to attribution\n * @internal\n */\nexport interface ICellOptions {\n\tattribution?: ICellAttributionOptions;\n}\n\n/**\n * This enables the cell to store the attribution information which can be accessed with the runtime\n * (i.e. who creeated the content and when it was created)\n *\n * default: false\n * @internal\n */\nexport interface ICellAttributionOptions {\n\ttrack?: boolean;\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.0.0-internal.7.3.0";
8
+ export declare const pkgVersion = "2.0.0-internal.8.0.0";
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 = "2.0.0-internal.7.3.0";
8
+ export const pkgVersion = "2.0.0-internal.8.0.0";
9
9
  //# sourceMappingURL=packageVersion.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,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.0.0-internal.7.3.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.mjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAC;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,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.0.0-internal.8.0.0\";\n"]}