@fluidframework/shared-object-base 2.0.0-internal.8.0.0 → 2.0.0-rc.1.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +0 -6
  3. package/api-extractor-esm.json +4 -0
  4. package/api-extractor-lint.json +1 -10
  5. package/api-extractor.json +1 -9
  6. package/api-report/shared-object-base.api.md +11 -22
  7. package/dist/{handle.cjs → handle.js} +1 -1
  8. package/dist/handle.js.map +1 -0
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/{index.cjs → index.js} +7 -8
  12. package/dist/index.js.map +1 -0
  13. package/dist/packageVersion.d.ts +1 -1
  14. package/dist/packageVersion.d.ts.map +1 -1
  15. package/dist/{packageVersion.cjs → packageVersion.js} +2 -2
  16. package/dist/packageVersion.js.map +1 -0
  17. package/dist/{remoteObjectHandle.cjs → remoteObjectHandle.js} +1 -1
  18. package/dist/remoteObjectHandle.js.map +1 -0
  19. package/dist/serializer.d.ts +3 -15
  20. package/dist/serializer.d.ts.map +1 -1
  21. package/dist/{serializer.cjs → serializer.js} +6 -11
  22. package/dist/serializer.js.map +1 -0
  23. package/dist/shared-object-base-alpha.d.ts +32 -64
  24. package/dist/shared-object-base-beta.d.ts +353 -46
  25. package/dist/shared-object-base-public.d.ts +353 -46
  26. package/dist/shared-object-base-untrimmed.d.ts +11 -25
  27. package/dist/sharedObject.d.ts +3 -4
  28. package/dist/sharedObject.d.ts.map +1 -1
  29. package/dist/{sharedObject.cjs → sharedObject.js} +6 -6
  30. package/dist/{sharedObject.cjs.map → sharedObject.js.map} +1 -1
  31. package/dist/summarySerializer.d.ts +1 -1
  32. package/dist/{summarySerializer.cjs → summarySerializer.js} +3 -3
  33. package/dist/summarySerializer.js.map +1 -0
  34. package/dist/types.d.ts +2 -2
  35. package/dist/{types.cjs → types.js} +1 -1
  36. package/dist/types.js.map +1 -0
  37. package/dist/utils.d.ts +2 -2
  38. package/dist/{utils.cjs → utils.js} +3 -3
  39. package/dist/utils.js.map +1 -0
  40. package/dist/{valueType.cjs → valueType.js} +1 -1
  41. package/dist/valueType.js.map +1 -0
  42. package/lib/{handle.d.ts → handle.d.mts} +1 -1
  43. package/lib/handle.d.mts.map +1 -0
  44. package/lib/{index.d.ts → index.d.mts} +2 -2
  45. package/lib/index.d.mts.map +1 -0
  46. package/lib/index.mjs +1 -1
  47. package/lib/index.mjs.map +1 -1
  48. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
  49. package/lib/packageVersion.d.mts.map +1 -0
  50. package/lib/packageVersion.mjs +1 -1
  51. package/lib/packageVersion.mjs.map +1 -1
  52. package/lib/{remoteObjectHandle.d.ts → remoteObjectHandle.d.mts} +1 -1
  53. package/lib/remoteObjectHandle.d.mts.map +1 -0
  54. package/lib/{serializer.d.ts → serializer.d.mts} +4 -16
  55. package/lib/serializer.d.mts.map +1 -0
  56. package/lib/serializer.mjs +3 -7
  57. package/lib/serializer.mjs.map +1 -1
  58. package/lib/shared-object-base-alpha.d.mts +411 -0
  59. package/lib/{shared-object-base-alpha.d.ts → shared-object-base-beta.d.mts} +8 -62
  60. package/lib/shared-object-base-public.d.mts +389 -0
  61. package/lib/{shared-object-base-untrimmed.d.ts → shared-object-base-untrimmed.d.mts} +11 -25
  62. package/lib/{sharedObject.d.ts → sharedObject.d.mts} +4 -5
  63. package/lib/sharedObject.d.mts.map +1 -0
  64. package/lib/sharedObject.mjs +2 -2
  65. package/lib/sharedObject.mjs.map +1 -1
  66. package/lib/{summarySerializer.d.ts → summarySerializer.d.mts} +2 -2
  67. package/lib/summarySerializer.d.mts.map +1 -0
  68. package/lib/summarySerializer.mjs +1 -1
  69. package/lib/summarySerializer.mjs.map +1 -1
  70. package/lib/{types.d.ts → types.d.mts} +3 -3
  71. package/lib/types.d.mts.map +1 -0
  72. package/lib/types.mjs.map +1 -1
  73. package/lib/{utils.d.ts → utils.d.mts} +3 -3
  74. package/lib/utils.d.mts.map +1 -0
  75. package/lib/utils.mjs +2 -2
  76. package/lib/utils.mjs.map +1 -1
  77. package/lib/{valueType.d.ts → valueType.d.mts} +1 -1
  78. package/lib/valueType.d.mts.map +1 -0
  79. package/package.json +91 -29
  80. package/src/index.ts +1 -6
  81. package/src/packageVersion.ts +1 -1
  82. package/src/serializer.ts +4 -22
  83. package/src/sharedObject.ts +3 -3
  84. package/src/summarySerializer.ts +1 -1
  85. package/src/types.ts +2 -2
  86. package/src/utils.ts +2 -2
  87. package/dist/handle.cjs.map +0 -1
  88. package/dist/index.cjs.map +0 -1
  89. package/dist/packageVersion.cjs.map +0 -1
  90. package/dist/remoteObjectHandle.cjs.map +0 -1
  91. package/dist/serializer.cjs.map +0 -1
  92. package/dist/summarySerializer.cjs.map +0 -1
  93. package/dist/types.cjs.map +0 -1
  94. package/dist/utils.cjs.map +0 -1
  95. package/dist/valueType.cjs.map +0 -1
  96. package/lib/handle.d.ts.map +0 -1
  97. package/lib/index.d.ts.map +0 -1
  98. package/lib/packageVersion.d.ts.map +0 -1
  99. package/lib/remoteObjectHandle.d.ts.map +0 -1
  100. package/lib/serializer.d.ts.map +0 -1
  101. package/lib/shared-object-base-beta.d.ts +0 -82
  102. package/lib/shared-object-base-public.d.ts +0 -82
  103. package/lib/sharedObject.d.ts.map +0 -1
  104. package/lib/summarySerializer.d.ts.map +0 -1
  105. package/lib/types.d.ts.map +0 -1
  106. package/lib/utils.d.ts.map +0 -1
  107. package/lib/valueType.d.ts.map +0 -1
  108. package/tsc-multi.test.json +0 -4
@@ -0,0 +1,411 @@
1
+ import { EventEmitterEventType } from '@fluid-internal/client-utils';
2
+ import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';
3
+ import { IChannel } from '@fluidframework/datastore-definitions';
4
+ import { IChannelAttributes } from '@fluidframework/datastore-definitions';
5
+ import { IChannelServices } from '@fluidframework/datastore-definitions';
6
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
7
+ import { IErrorEvent } from '@fluidframework/core-interfaces';
8
+ import { IEventProvider } from '@fluidframework/core-interfaces';
9
+ import { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
10
+ import { IExperimentalIncrementalSummaryContext } from '@fluidframework/runtime-definitions';
11
+ import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
12
+ import { IFluidHandle } from '@fluidframework/core-interfaces';
13
+ import { IFluidHandleContext } from '@fluidframework/core-interfaces';
14
+ import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
15
+ import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
16
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
17
+ import { ITelemetryContext } from '@fluidframework/runtime-definitions';
18
+ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
19
+
20
+ /* Excluded from this release type: createSingleBlobSummary */
21
+
22
+ /* Excluded from this release type: FluidSerializer */
23
+
24
+ /**
25
+ * @public
26
+ */
27
+ export declare interface IFluidSerializer {
28
+ /**
29
+ * Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object
30
+ * where any embedded IFluidHandles have been replaced with a serializable form.
31
+ *
32
+ * The original `input` object is not mutated. This method will shallowly clones all objects in the path from
33
+ * the root to any replaced handles. (If no handles are found, returns the original object.)
34
+ */
35
+ encode(value: any, bind: IFluidHandle): any;
36
+ /**
37
+ * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an
38
+ * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.
39
+ *
40
+ * The original `input` object is not mutated. This method will shallowly clone all objects in the path from
41
+ * the root to any replaced handles. (If no handles are found, returns the original object.)
42
+ *
43
+ * The decoded handles are implicitly bound to the handle context of this serializer.
44
+ */
45
+ decode(input: any): any;
46
+ /**
47
+ * Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.
48
+ */
49
+ stringify(value: any, bind: IFluidHandle): string;
50
+ /**
51
+ * Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid
52
+ * handles will be realized as part of the parse
53
+ */
54
+ parse(value: string): any;
55
+ }
56
+
57
+ /**
58
+ * Base interface for shared objects from which other interfaces derive. Implemented by SharedObject
59
+ * @public
60
+ */
61
+ export declare interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends IChannel, IEventProvider<TEvent> {
62
+ /**
63
+ * Binds the given shared object to its containing data store runtime, causing it to attach once
64
+ * the runtime attaches.
65
+ */
66
+ bindToContext(): void;
67
+ /**
68
+ * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to
69
+ * other GC nodes.
70
+ * @param fullGC - true to bypass optimizations and force full generation of GC data.
71
+ */
72
+ getGCData(fullGC?: boolean): IGarbageCollectionData;
73
+ }
74
+
75
+ /**
76
+ * Events emitted by {@link ISharedObject}.
77
+ * @public
78
+ */
79
+ export declare interface ISharedObjectEvents extends IErrorEvent {
80
+ /**
81
+ * Fires before an incoming operation (op) is applied to the shared object.
82
+ *
83
+ * @remarks Note: this should be considered an internal implementation detail. It is not recommended for external
84
+ * use.
85
+ *
86
+ * @eventProperty
87
+ */
88
+ (event: "pre-op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
89
+ /**
90
+ * Fires after an incoming op is applied to the shared object.
91
+ *
92
+ * @remarks Note: this should be considered an internal implementation detail. It is not recommended for external
93
+ * use.
94
+ *
95
+ * @eventProperty
96
+ */
97
+ (event: "op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
98
+ }
99
+
100
+ /**
101
+ * Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object
102
+ * where any embedded IFluidHandles have been replaced with a serializable form.
103
+ *
104
+ * The original `input` object is not mutated. This method will shallowly clones all objects in the path from
105
+ * the root to any replaced handles. (If no handles are found, returns the original object.)
106
+ *
107
+ * @param input - The mostly-plain object
108
+ * @param context - The handle context for the container
109
+ * @param bind - Bind any other handles we find in the object against this given handle.
110
+ * @returns The fully-plain object
111
+ * @alpha
112
+ */
113
+ export declare function makeHandlesSerializable(value: any, serializer: IFluidSerializer, bind: IFluidHandle): any;
114
+
115
+ /**
116
+ * Given a fully-plain object that may have serializable-form handles within, will return the mostly-plain object
117
+ * with handle objects created instead.
118
+ * @param value - The fully-plain object
119
+ * @param serializer - The serializer that knows how to convert serializable-form handles into handle objects
120
+ * @param context - The handle context for the container
121
+ * @returns The mostly-plain object with handle objects within
122
+ * @alpha
123
+ */
124
+ export declare function parseHandles(value: any, serializer: IFluidSerializer): any;
125
+
126
+ /* Excluded from this release type: serializeHandles */
127
+
128
+ /**
129
+ * SharedObject with simplified, synchronous summarization and GC.
130
+ * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.
131
+ * @public
132
+ */
133
+ export declare abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends SharedObjectCore<TEvent> {
134
+ private readonly telemetryContextPrefix;
135
+ /**
136
+ * True while we are garbage collecting this object's data.
137
+ */
138
+ private _isGCing;
139
+ /**
140
+ * The serializer to use to serialize / parse handles, if any.
141
+ */
142
+ private readonly _serializer;
143
+ protected get serializer(): IFluidSerializer;
144
+ /**
145
+ * @param id - The id of the shared object
146
+ * @param runtime - The IFluidDataStoreRuntime which contains the shared object
147
+ * @param attributes - Attributes of the shared object
148
+ */
149
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, telemetryContextPrefix: string);
150
+ /**
151
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
152
+ */
153
+ getAttachSummary(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
154
+ /**
155
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
156
+ */
157
+ summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): Promise<ISummaryTreeWithStats>;
158
+ /**
159
+ * {@inheritDoc (ISharedObject:interface).getGCData}
160
+ */
161
+ getGCData(fullGC?: boolean): IGarbageCollectionData;
162
+ /**
163
+ * Calls the serializer over all data in this object that reference other GC nodes.
164
+ * Derived classes must override this to provide custom list of references to other GC nodes.
165
+ */
166
+ protected processGCDataCore(serializer: IFluidSerializer): void;
167
+ /**
168
+ * Gets a form of the object that can be serialized.
169
+ * @returns A tree representing the snapshot of the shared object.
170
+ */
171
+ protected abstract summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): ISummaryTreeWithStats;
172
+ private incrementTelemetryMetric;
173
+ }
174
+
175
+ /**
176
+ * Base class from which all shared objects derive.
177
+ * @public
178
+ */
179
+ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {
180
+ id: string;
181
+ protected runtime: IFluidDataStoreRuntime;
182
+ readonly attributes: IChannelAttributes;
183
+ get IFluidLoadable(): this;
184
+ private readonly opProcessingHelper;
185
+ private readonly callbacksHelper;
186
+ /**
187
+ * The handle referring to this SharedObject
188
+ */
189
+ readonly handle: IFluidHandle;
190
+ /**
191
+ * Telemetry logger for the shared object
192
+ */
193
+ protected readonly logger: ITelemetryLoggerExt;
194
+ private readonly mc;
195
+ /**
196
+ * Connection state
197
+ */
198
+ private _connected;
199
+ /**
200
+ * Services used by the shared object
201
+ */
202
+ private services;
203
+ /**
204
+ * True if the dds is bound to its parent.
205
+ */
206
+ private _isBoundToContext;
207
+ /**
208
+ * Tracks error that closed this object.
209
+ */
210
+ private closeError?;
211
+ /**
212
+ * Gets the connection state
213
+ * @returns The state of the connection
214
+ */
215
+ get connected(): boolean;
216
+ /**
217
+ * @param id - The id of the shared object
218
+ * @param runtime - The IFluidDataStoreRuntime which contains the shared object
219
+ * @param attributes - Attributes of the shared object
220
+ */
221
+ constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
222
+ /**
223
+ * This function is only supposed to be called from SharedObjectCore's constructor and
224
+ * depends on a few things being set already. assert() calls make sure of it.
225
+ * @returns The telemetry sampling helpers, so the constructor can be the one to assign them
226
+ * to variables to avoid complaints from TypeScript.
227
+ */
228
+ private setUpSampledTelemetryHelpers;
229
+ /**
230
+ * Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)
231
+ * would result in same error thrown. If called multiple times, only first error is remembered.
232
+ * @param error - error object that is thrown whenever an attempt is made to modify this object
233
+ */
234
+ private closeWithError;
235
+ /**
236
+ * Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.
237
+ */
238
+ private verifyNotClosed;
239
+ /**
240
+ * Event listener handler helper that can be used to react to exceptions thrown from event listeners
241
+ * It wraps error with DataProcessingError, closes this object and throws resulting error.
242
+ * See closeWithError() for more details
243
+ * Ideally such situation never happens, as consumers of DDS should never throw exceptions
244
+ * in event listeners (i.e. catch any of the issues and make determination on how to handle it).
245
+ * When such exceptions propagate through, most likely data model is no longer consistent, i.e.
246
+ * DDS state does not match what user sees. Because of it DDS moves to "corrupted state" and does not
247
+ * allow processing of ops or local changes, which very quickly results in container closure.
248
+ */
249
+ private eventListenerErrorHandler;
250
+ private attachListeners;
251
+ /**
252
+ * A shared object, after construction, can either be loaded in the case that it is already part of
253
+ * a shared document. Or later attached if it is being newly added.
254
+ * @param services - Services used by the shared object
255
+ */
256
+ load(services: IChannelServices): Promise<void>;
257
+ /**
258
+ * Initializes the object as a local, non-shared object. This object can become shared after
259
+ * it is attached to the document.
260
+ */
261
+ initializeLocal(): void;
262
+ /**
263
+ * {@inheritDoc (ISharedObject:interface).bindToContext}
264
+ */
265
+ bindToContext(): void;
266
+ /**
267
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}
268
+ */
269
+ connect(services: IChannelServices): void;
270
+ /**
271
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}
272
+ */
273
+ isAttached(): boolean;
274
+ /**
275
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
276
+ */
277
+ abstract getAttachSummary(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
278
+ /**
279
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
280
+ */
281
+ abstract summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
282
+ /**
283
+ * {@inheritDoc (ISharedObject:interface).getGCData}
284
+ */
285
+ abstract getGCData(fullGC?: boolean): IGarbageCollectionData;
286
+ /**
287
+ * Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference
288
+ * to another object in the container.
289
+ * @param decodedHandle - The handle of the Fluid object that is decoded.
290
+ */
291
+ protected handleDecoded(decodedHandle: IFluidHandle): void;
292
+ /**
293
+ * Allows the distributed data type to perform custom loading
294
+ * @param services - Storage used by the shared object
295
+ */
296
+ protected abstract loadCore(services: IChannelStorageService): Promise<void>;
297
+ /**
298
+ * Allows the distributed data type to perform custom local loading.
299
+ */
300
+ protected initializeLocalCore(): void;
301
+ /**
302
+ * Allows the distributive data type the ability to perform custom processing once an attach has happened.
303
+ * Also called after non-local data type get loaded.
304
+ */
305
+ protected didAttach(): void;
306
+ /**
307
+ * Derived classes must override this to do custom processing on a remote message.
308
+ * @param message - The message to process
309
+ * @param local - True if the shared object is local
310
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
311
+ * For messages from a remote client, this will be undefined.
312
+ */
313
+ protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): any;
314
+ /**
315
+ * Called when the object has disconnected from the delta stream.
316
+ */
317
+ protected abstract onDisconnect(): any;
318
+ /**
319
+ * Submits a message by the local client to the runtime.
320
+ * @param content - Content of the message
321
+ * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime
322
+ * and not sent to the server. This will be sent back when this message is received back from the server. This is
323
+ * also sent if we are asked to resubmit the message.
324
+ */
325
+ protected submitLocalMessage(content: any, localOpMetadata?: unknown): void;
326
+ /**
327
+ * Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock
328
+ * that want to be part of summary but does not generate ops.
329
+ */
330
+ protected dirty(): void;
331
+ /**
332
+ * Called when the object has fully connected to the delta stream
333
+ * Default implementation for DDS, override if different behavior is required.
334
+ */
335
+ protected onConnect(): void;
336
+ /**
337
+ * Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.
338
+ * The default implementation here is to resubmit the same message. The client can override if different behavior
339
+ * is required. It can choose to resubmit the same message, submit different / multiple messages or not submit
340
+ * anything at all.
341
+ * @param content - The content of the original message.
342
+ * @param localOpMetadata - The local metadata associated with the original message.
343
+ */
344
+ protected reSubmitCore(content: any, localOpMetadata: unknown): void;
345
+ /**
346
+ * Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.
347
+ * It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),
348
+ * the Promise will reject.
349
+ * If runtime is disposed when this call is made, executor is not run and promise is rejected right away.
350
+ */
351
+ protected newAckBasedPromise<T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
352
+ private attachDeltaHandler;
353
+ /**
354
+ * Set the state of connection to services.
355
+ * @param connected - true if connected, false otherwise.
356
+ */
357
+ private setConnectionState;
358
+ /**
359
+ * Handles a message being received from the remote delta server.
360
+ * @param message - The message to process
361
+ * @param local - Whether the message originated from the local client
362
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
363
+ * For messages from a remote client, this will be undefined.
364
+ */
365
+ private process;
366
+ /**
367
+ * Called when a message has to be resubmitted. This typically happens for unacked messages after a
368
+ * reconnection.
369
+ * @param content - The content of the original message.
370
+ * @param localOpMetadata - The local metadata associated with the original message.
371
+ */
372
+ private reSubmit;
373
+ /**
374
+ * Revert an op
375
+ */
376
+ protected rollback(content: any, localOpMetadata: unknown): void;
377
+ /**
378
+ * Apply changes from an op. Used when rehydrating an attached container
379
+ * with pending changes. This prepares the SharedObject for seeing an ACK
380
+ * for the op or resubmitting the op upon reconnection.
381
+ * @param content - Contents of a stashed op.
382
+ * @returns localMetadata of the op, to be passed to process() or resubmit()
383
+ * when the op is ACKed or resubmitted, respectively
384
+ */
385
+ protected abstract applyStashedOp(content: any): unknown;
386
+ /**
387
+ * Emit an event. This function is only intended for use by DDS classes that extend SharedObject/SharedObjectCore,
388
+ * specifically to emit events that are part of the public interface of the DDS (i.e. those that can have listeners
389
+ * attached to them by the consumers of the DDS). It should not be called from outside the class or to emit events
390
+ * which are only internal to the DDS. Support for calling it from outside the DDS instance might be removed in the
391
+ * future.
392
+ * @param event - The event to emit.
393
+ * @param args - Arguments to pass to the event listeners.
394
+ * @returns `true` if the event had listeners, `false` otherwise.
395
+ */
396
+ emit(event: EventEmitterEventType, ...args: any[]): boolean;
397
+ /**
398
+ * Use to emit events inside {@link SharedObjectCore}, with no telemetry measurement
399
+ * done on the duration of the callbacks. Simply calls `super.emit()`.
400
+ * @param event - Event to emit
401
+ * @param args - Arguments for the event
402
+ * @returns Whatever `super.emit()` returns.
403
+ */
404
+ private emitInternal;
405
+ }
406
+
407
+ /* Excluded from this release type: SummarySerializer */
408
+
409
+ /* Excluded from this release type: ValueType */
410
+
411
+ export { }
@@ -19,49 +19,10 @@ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
19
19
 
20
20
  /* Excluded from this release type: createSingleBlobSummary */
21
21
 
22
- /**
23
- * Data Store serializer implementation
24
- * @alpha
25
- */
26
- export declare class FluidSerializer implements IFluidSerializer {
27
- private readonly context;
28
- private readonly handleParsedCb;
29
- private readonly root;
30
- constructor(context: IFluidHandleContext, handleParsedCb: (handle: IFluidHandle) => void);
31
- get IFluidSerializer(): this;
32
- /**
33
- * Given a mostly-jsonable object tree that may have handle objects embedded within, will return a
34
- * fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable form.
35
- *
36
- * The original `input` object is not mutated. This method will shallowly clone all objects in the path from
37
- * the root to any replaced handles. (If no handles are found, returns the original object.)
38
- *
39
- * Any unbound handles encountered are bound to the provided IFluidHandle.
40
- */
41
- encode(input: any, bind: IFluidHandle): any;
42
- /**
43
- * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an
44
- * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.
45
- *
46
- * The original `input` object is not mutated. This method will shallowly clone all objects in the path from
47
- * the root to any replaced handles. (If no handles are found, returns the original object.)
48
- *
49
- * The decoded handles are implicitly bound to the handle context of this serializer.
50
- */
51
- decode(input: any): any;
52
- stringify(input: any, bind: IFluidHandle): string;
53
- parse(input: string): any;
54
- private readonly encodeValue;
55
- private readonly decodeValue;
56
- private recursivelyReplace;
57
- protected serializeHandle(handle: IFluidHandle, bind: IFluidHandle): {
58
- type: string;
59
- url: string;
60
- };
61
- }
22
+ /* Excluded from this release type: FluidSerializer */
62
23
 
63
24
  /**
64
- * @alpha
25
+ * @public
65
26
  */
66
27
  export declare interface IFluidSerializer {
67
28
  /**
@@ -93,11 +54,9 @@ export declare interface IFluidSerializer {
93
54
  parse(value: string): any;
94
55
  }
95
56
 
96
- /* Excluded from this release type: ISerializedHandle */
97
-
98
57
  /**
99
58
  * Base interface for shared objects from which other interfaces derive. Implemented by SharedObject
100
- * @alpha
59
+ * @public
101
60
  */
102
61
  export declare interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends IChannel, IEventProvider<TEvent> {
103
62
  /**
@@ -115,7 +74,7 @@ export declare interface ISharedObject<TEvent extends ISharedObjectEvents = ISha
115
74
 
116
75
  /**
117
76
  * Events emitted by {@link ISharedObject}.
118
- * @alpha
77
+ * @public
119
78
  */
120
79
  export declare interface ISharedObjectEvents extends IErrorEvent {
121
80
  /**
@@ -138,8 +97,6 @@ export declare interface ISharedObjectEvents extends IErrorEvent {
138
97
  (event: "op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
139
98
  }
140
99
 
141
- /* Excluded from this release type: isSerializedHandle */
142
-
143
100
  /* Excluded from this release type: makeHandlesSerializable */
144
101
 
145
102
  /* Excluded from this release type: parseHandles */
@@ -149,7 +106,7 @@ export declare interface ISharedObjectEvents extends IErrorEvent {
149
106
  /**
150
107
  * SharedObject with simplified, synchronous summarization and GC.
151
108
  * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.
152
- * @alpha
109
+ * @public
153
110
  */
154
111
  export declare abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends SharedObjectCore<TEvent> {
155
112
  private readonly telemetryContextPrefix;
@@ -184,7 +141,7 @@ export declare abstract class SharedObject<TEvent extends ISharedObjectEvents =
184
141
  * Calls the serializer over all data in this object that reference other GC nodes.
185
142
  * Derived classes must override this to provide custom list of references to other GC nodes.
186
143
  */
187
- protected processGCDataCore(serializer: SummarySerializer): void;
144
+ protected processGCDataCore(serializer: IFluidSerializer): void;
188
145
  /**
189
146
  * Gets a form of the object that can be serialized.
190
147
  * @returns A tree representing the snapshot of the shared object.
@@ -195,7 +152,7 @@ export declare abstract class SharedObject<TEvent extends ISharedObjectEvents =
195
152
 
196
153
  /**
197
154
  * Base class from which all shared objects derive.
198
- * @alpha
155
+ * @public
199
156
  */
200
157
  export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {
201
158
  id: string;
@@ -425,18 +382,7 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
425
382
  private emitInternal;
426
383
  }
427
384
 
428
- /**
429
- * Serializer implementation for serializing handles during summary.
430
- * @alpha
431
- */
432
- export declare class SummarySerializer extends FluidSerializer {
433
- private readonly serializedRoutes;
434
- getSerializedRoutes(): string[];
435
- protected serializeHandle(handle: IFluidHandle, bind: IFluidHandle): {
436
- type: string;
437
- url: string;
438
- };
439
- }
385
+ /* Excluded from this release type: SummarySerializer */
440
386
 
441
387
  /* Excluded from this release type: ValueType */
442
388