@fluidframework/cell 2.0.0-internal.7.2.2 → 2.0.0-internal.7.3.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -2
  3. package/api-extractor.json +3 -0
  4. package/dist/cell-alpha.d.ts +267 -0
  5. package/dist/cell-beta.d.ts +243 -0
  6. package/dist/cell-public.d.ts +243 -0
  7. package/dist/cell-untrimmed.d.ts +272 -0
  8. package/dist/{cell.js → cell.cjs} +2 -2
  9. package/dist/cell.cjs.map +1 -0
  10. package/dist/{cellFactory.js → cellFactory.cjs} +3 -3
  11. package/dist/cellFactory.cjs.map +1 -0
  12. package/dist/{index.js → index.cjs} +2 -2
  13. package/dist/index.cjs.map +1 -0
  14. package/dist/{interfaces.js → interfaces.cjs} +1 -1
  15. package/dist/interfaces.cjs.map +1 -0
  16. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  17. package/dist/packageVersion.cjs.map +1 -0
  18. package/dist/packageVersion.d.ts +1 -1
  19. package/dist/tsdoc-metadata.json +1 -1
  20. package/lib/cell-alpha.d.ts +267 -0
  21. package/lib/cell-beta.d.ts +243 -0
  22. package/lib/cell-public.d.ts +243 -0
  23. package/lib/cell-untrimmed.d.ts +272 -0
  24. package/lib/{cell.js → cell.mjs} +2 -2
  25. package/lib/cell.mjs.map +1 -0
  26. package/lib/{cellFactory.js → cellFactory.mjs} +3 -3
  27. package/lib/cellFactory.mjs.map +1 -0
  28. package/lib/index.mjs +6 -0
  29. package/lib/index.mjs.map +1 -0
  30. package/lib/{interfaces.js → interfaces.mjs} +1 -1
  31. package/{dist/interfaces.js.map → lib/interfaces.mjs.map} +1 -1
  32. package/lib/packageVersion.d.ts +1 -1
  33. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  34. package/lib/packageVersion.mjs.map +1 -0
  35. package/package.json +52 -23
  36. package/src/packageVersion.ts +1 -1
  37. package/tsc-multi.test.json +4 -0
  38. package/tsconfig.json +5 -3
  39. package/dist/cell.js.map +0 -1
  40. package/dist/cellFactory.js.map +0 -1
  41. package/dist/index.js.map +0 -1
  42. package/dist/packageVersion.js.map +0 -1
  43. package/lib/cell.js.map +0 -1
  44. package/lib/cellFactory.js.map +0 -1
  45. package/lib/index.js +0 -11
  46. package/lib/index.js.map +0 -1
  47. package/lib/interfaces.js.map +0 -1
  48. package/lib/packageVersion.js.map +0 -1
  49. package/tsconfig.esnext.json +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/cell
2
2
 
3
+ ## 2.0.0-internal.7.3.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.0.0-internal.7.2.0
4
8
 
5
9
  Dependency updates only.
package/README.md CHANGED
@@ -109,8 +109,7 @@ Thank you!
109
109
 
110
110
  This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
111
111
 
112
- Use of these trademarks or logos must follow Microsoft's [Trademark & Brand
113
- Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
112
+ Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
114
113
 
115
114
  Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
116
115
 
@@ -9,5 +9,8 @@
9
9
  "logLevel": "none"
10
10
  }
11
11
  }
12
+ },
13
+ "dtsRollup": {
14
+ "enabled": true
12
15
  }
13
16
  }
@@ -0,0 +1,267 @@
1
+ /**
2
+ * The `SharedCell` Distributed Data Structure (DDS) stores a single, shared value that can be edited or deleted.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { AttributionKey } from '@fluidframework/runtime-definitions';
8
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
9
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
10
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
11
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
12
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
13
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
14
+ import { ISharedObject } from '@fluidframework/shared-object-base';
15
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
16
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
17
+ import { Serializable } from '@fluidframework/datastore-definitions';
18
+ import { SharedObject } from '@fluidframework/shared-object-base';
19
+
20
+ /**
21
+ * This enables the cell to store the attribution information which can be accessed with the runtime
22
+ * (i.e. who creeated the content and when it was created)
23
+ *
24
+ * default: false
25
+ *
26
+ * @alpha
27
+ */
28
+ export declare interface ICellAttributionOptions {
29
+ track?: boolean;
30
+ }
31
+
32
+ /**
33
+ * Options related to attribution
34
+ *
35
+ * @alpha
36
+ */
37
+ export declare interface ICellOptions {
38
+ attribution?: ICellAttributionOptions;
39
+ }
40
+
41
+ /**
42
+ * A Distributed Data Structure (DDS), which stores a single shared value that can be edited or deleted.
43
+ *
44
+ * @typeParam T - The type of cell data. Must be serializable.
45
+ *
46
+ * @example Creation
47
+ *
48
+ * To create a `SharedCell`, call the static create method:
49
+ *
50
+ * ```typescript
51
+ * const myCell = SharedCell.create(this.runtime, id);
52
+ * ```
53
+ *
54
+ * @example Usage
55
+ *
56
+ * The value stored in the cell can be set with the `.set()` method and retrieved with the `.get()` method:
57
+ *
58
+ * ```typescript
59
+ * myCell.set(3);
60
+ * console.log(myCell.get()); // 3
61
+ * ```
62
+ *
63
+ * The value must only be plain JS objects or `SharedObject` handles (e.g. to another DDS or Fluid object).
64
+ * In collaborative scenarios, the value is settled with a policy of _last write wins_.
65
+ *
66
+ * The `.delete()` method will delete the stored value from the cell:
67
+ *
68
+ * ```typescript
69
+ * myCell.delete();
70
+ * console.log(myCell.get()); // undefined
71
+ * ```
72
+ *
73
+ * The `.empty()` method will check if the value is undefined.
74
+ *
75
+ * ```typescript
76
+ * if (myCell.empty()) {
77
+ * // myCell.get() will return undefined
78
+ * } else {
79
+ * // myCell.get() will return a non-undefined value
80
+ * }
81
+ * ```
82
+ *
83
+ * @example Eventing
84
+ *
85
+ * `SharedCell` is an `EventEmitter`, and will emit events when other clients make modifications. You should
86
+ * register for these events and respond appropriately as the data is modified. `valueChanged` will be emitted
87
+ * in response to a `set`, and `delete` will be emitted in response to a `delete`.
88
+ *
89
+ * @public
90
+ */
91
+ export declare interface ISharedCell<T = any> extends ISharedObject<ISharedCellEvents<T>> {
92
+ /**
93
+ * Retrieves the cell value.
94
+ *
95
+ * @returns The value of the cell
96
+ */
97
+ get(): Serializable<T> | undefined;
98
+ /**
99
+ * Sets the cell value.
100
+ *
101
+ * @param value - a JSON-able or SharedObject value to set the cell to
102
+ */
103
+ set(value: Serializable<T>): void;
104
+ /**
105
+ * Checks whether cell is empty or not.
106
+ *
107
+ * @returns `true` if the value of cell is `undefined`, `false` otherwise
108
+ */
109
+ empty(): boolean;
110
+ /**
111
+ * Delete the value from the cell.
112
+ */
113
+ delete(): void;
114
+ /**
115
+ * @alpha
116
+ * @returns the AttributionKey associated with the cell's most recent change.
117
+ */
118
+ getAttribution(): AttributionKey | undefined;
119
+ }
120
+
121
+ /**
122
+ * Events emitted by {@link ISharedCell}.
123
+ *
124
+ * @public
125
+ */
126
+ export declare interface ISharedCellEvents<T> extends ISharedObjectEvents {
127
+ /**
128
+ * Emitted when the value has changed.
129
+ *
130
+ * @remarks Event paramters:
131
+ *
132
+ * - `value`: The new value of the cell.
133
+ */
134
+ (event: "valueChanged", listener: (value: Serializable<T>) => void): any;
135
+ /**
136
+ * Emitted when the value has been deleted.
137
+ */
138
+ (event: "delete", listener: () => void): any;
139
+ }
140
+
141
+ /**
142
+ * {@inheritDoc ISharedCell}
143
+ *
144
+ * @public
145
+ */
146
+ export declare class SharedCell<T = any> extends SharedObject<ISharedCellEvents<T>> implements ISharedCell<T> {
147
+ /**
148
+ * Create a new `SharedCell`.
149
+ *
150
+ * @param runtime - The data store runtime to which the `SharedCell` belongs.
151
+ * @param id - Unique identifier for the `SharedCell`.
152
+ *
153
+ * @returns The newly create `SharedCell`. Note that it will not yet be attached.
154
+ */
155
+ static create(runtime: IFluidDataStoreRuntime, id?: string): SharedCell;
156
+ /**
157
+ * Gets the factory for the `SharedCell` to register with the data store.
158
+ *
159
+ * @returns A factory that creates and loads `SharedCell`s.
160
+ */
161
+ static getFactory(): IChannelFactory;
162
+ /**
163
+ * The data held by this cell.
164
+ */
165
+ private data;
166
+ /**
167
+ * This is used to assign a unique id to outgoing messages. It is used to track messages until
168
+ * they are ack'd.
169
+ */
170
+ private messageId;
171
+ /**
172
+ * This keeps track of the messageId of messages that have been ack'd. It is updated every time
173
+ * we a message is ack'd with it's messageId.
174
+ */
175
+ private messageIdObserved;
176
+ private readonly pendingMessageIds;
177
+ private attribution;
178
+ private readonly options;
179
+ /**
180
+ * Constructs a new `SharedCell`.
181
+ * If the object is non-local an id and service interfaces will be provided.
182
+ *
183
+ * @param runtime - The data store runtime to which the `SharedCell` belongs.
184
+ * @param id - Unique identifier for the `SharedCell`.
185
+ */
186
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
187
+ /**
188
+ * {@inheritDoc ISharedCell.get}
189
+ */
190
+ get(): Serializable<T> | undefined;
191
+ /**
192
+ * {@inheritDoc ISharedCell.set}
193
+ */
194
+ set(value: Serializable<T>): void;
195
+ /**
196
+ * {@inheritDoc ISharedCell.delete}
197
+ */
198
+ delete(): void;
199
+ /**
200
+ * {@inheritDoc ISharedCell.empty}
201
+ */
202
+ empty(): boolean;
203
+ /**
204
+ * {@inheritDoc ISharedCell.getAttribution}
205
+ * @alpha
206
+ */
207
+ getAttribution(): AttributionKey | undefined;
208
+ /**
209
+ * Set the Op-based attribution through the SequencedDocumentMessage,
210
+ * or set the local/detached attribution.
211
+ */
212
+ private setAttribution;
213
+ /**
214
+ * Creates a summary for the Cell.
215
+ *
216
+ * @returns The summary of the current state of the Cell.
217
+ */
218
+ protected summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;
219
+ /**
220
+ * {@inheritDoc @fluidframework/shared-object-base#SharedObject.loadCore}
221
+ */
222
+ protected loadCore(storage: IChannelStorageService): Promise<void>;
223
+ /**
224
+ * Initialize a local instance of cell.
225
+ */
226
+ protected initializeLocalCore(): void;
227
+ /**
228
+ * Call back on disconnect.
229
+ */
230
+ protected onDisconnect(): void;
231
+ /**
232
+ * Apply inner op.
233
+ *
234
+ * @param content - ICellOperation content
235
+ */
236
+ private applyInnerOp;
237
+ /**
238
+ * Process a cell operation (op).
239
+ *
240
+ * @param message - The message to prepare.
241
+ * @param local - Whether or not the message was sent by the local client.
242
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
243
+ * For messages from a remote client, this will be `undefined`.
244
+ */
245
+ protected processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
246
+ private setCore;
247
+ private deleteCore;
248
+ private decode;
249
+ private createLocalOpMetadata;
250
+ /* Excluded from this release type: applyStashedOp */
251
+ /**
252
+ * Rollback a local op.
253
+ *
254
+ * @param content - The operation to rollback.
255
+ * @param localOpMetadata - The local metadata associated with the op.
256
+ */
257
+ protected rollback(content: any, localOpMetadata: unknown): void;
258
+ /**
259
+ * Submit a cell message to remote clients.
260
+ *
261
+ * @param op - The cell message.
262
+ * @param previousValue - The value of the cell before this op.
263
+ */
264
+ private submitCellMessage;
265
+ }
266
+
267
+ export { }
@@ -0,0 +1,243 @@
1
+ /**
2
+ * The `SharedCell` Distributed Data Structure (DDS) stores a single, shared value that can be edited or deleted.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+
7
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
8
+ import { IChannelFactory } from '@fluidframework/datastore-definitions';
9
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
10
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
11
+ import { IFluidSerializer } from '@fluidframework/shared-object-base';
12
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
13
+ import { ISharedObject } from '@fluidframework/shared-object-base';
14
+ import { ISharedObjectEvents } from '@fluidframework/shared-object-base';
15
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
16
+ import { Serializable } from '@fluidframework/datastore-definitions';
17
+ import { SharedObject } from '@fluidframework/shared-object-base';
18
+
19
+ /* Excluded from this release type: AttributionKey */
20
+
21
+ /* Excluded from this release type: ICellAttributionOptions */
22
+
23
+ /* Excluded from this release type: ICellOptions */
24
+
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
+ }
100
+
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
+ }
120
+
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
+ }
242
+
243
+ export { }