@fluidframework/datastore-definitions 2.0.0-rc.1.0.4 → 2.0.0-rc.2.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 (55) hide show
  1. package/.eslintrc.cjs +1 -1
  2. package/CHANGELOG.md +16 -0
  3. package/api-extractor-cjs.json +8 -0
  4. package/api-extractor-lint.json +1 -1
  5. package/api-extractor.json +1 -1
  6. package/api-report/datastore-definitions.api.md +26 -27
  7. package/dist/channel.d.ts +27 -13
  8. package/dist/channel.d.ts.map +1 -1
  9. package/dist/dataStoreRuntime.d.ts +8 -8
  10. package/dist/dataStoreRuntime.d.ts.map +1 -1
  11. package/dist/datastore-definitions-alpha.d.ts +44 -31
  12. package/dist/datastore-definitions-beta.d.ts +44 -31
  13. package/dist/datastore-definitions-public.d.ts +44 -31
  14. package/dist/datastore-definitions-untrimmed.d.ts +44 -31
  15. package/dist/index.d.ts +5 -5
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/package.json +3 -0
  18. package/dist/serializable.d.ts +2 -2
  19. package/dist/serializable.d.ts.map +1 -1
  20. package/dist/tsdoc-metadata.json +1 -1
  21. package/lib/channel.d.ts +272 -0
  22. package/lib/channel.d.ts.map +1 -0
  23. package/lib/dataStoreRuntime.d.ts +95 -0
  24. package/lib/dataStoreRuntime.d.ts.map +1 -0
  25. package/lib/datastore-definitions-alpha.d.ts +496 -0
  26. package/lib/datastore-definitions-beta.d.ts +411 -0
  27. package/lib/datastore-definitions-public.d.ts +411 -0
  28. package/lib/datastore-definitions-untrimmed.d.ts +496 -0
  29. package/lib/index.d.ts +16 -0
  30. package/lib/index.d.ts.map +1 -0
  31. package/lib/jsonable.d.ts +75 -0
  32. package/lib/jsonable.d.ts.map +1 -0
  33. package/lib/serializable.d.ts +26 -0
  34. package/lib/serializable.d.ts.map +1 -0
  35. package/lib/storage.d.ts +24 -0
  36. package/lib/storage.d.ts.map +1 -0
  37. package/package.json +55 -33
  38. package/src/channel.ts +27 -13
  39. package/src/dataStoreRuntime.ts +10 -14
  40. package/src/index.ts +10 -6
  41. package/src/serializable.ts +2 -2
  42. package/tsconfig.cjs.json +7 -0
  43. package/tsconfig.json +3 -5
  44. package/dist/channel.js +0 -7
  45. package/dist/channel.js.map +0 -1
  46. package/dist/dataStoreRuntime.js +0 -7
  47. package/dist/dataStoreRuntime.js.map +0 -1
  48. package/dist/index.js +0 -7
  49. package/dist/index.js.map +0 -1
  50. package/dist/jsonable.js +0 -7
  51. package/dist/jsonable.js.map +0 -1
  52. package/dist/serializable.js +0 -7
  53. package/dist/serializable.js.map +0 -1
  54. package/dist/storage.js +0 -7
  55. package/dist/storage.js.map +0 -1
@@ -5,27 +5,26 @@
5
5
  * @packageDocumentation
6
6
  */
7
7
 
8
- import { AttachState } from '@fluidframework/container-definitions';
9
- import { FluidObject } from '@fluidframework/core-interfaces';
10
- import { IAudience } from '@fluidframework/container-definitions';
11
- import { IDeltaManager } from '@fluidframework/container-definitions';
12
- import { IDisposable } from '@fluidframework/core-interfaces';
13
- import { IDocumentMessage } from '@fluidframework/protocol-definitions';
14
- import { IEvent } from '@fluidframework/core-interfaces';
15
- import { IEventProvider } from '@fluidframework/core-interfaces';
16
- import { IExperimentalIncrementalSummaryContext } from '@fluidframework/runtime-definitions';
17
- import { IFluidHandle } from '@fluidframework/core-interfaces';
18
- import { IFluidHandleContext } from '@fluidframework/core-interfaces';
19
- import { IFluidLoadable } from '@fluidframework/core-interfaces';
20
- import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
21
- import { IIdCompressor } from '@fluidframework/id-compressor';
22
- import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
23
- import { ILoaderOptions } from '@fluidframework/container-definitions';
24
- import { IQuorumClients } from '@fluidframework/protocol-definitions';
25
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
26
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
27
- import { ITelemetryContext } from '@fluidframework/runtime-definitions';
28
- import { ITelemetryLogger } from '@fluidframework/core-interfaces';
8
+ import type { AttachState } from '@fluidframework/container-definitions';
9
+ import type { FluidObject } from '@fluidframework/core-interfaces';
10
+ import type { IAudience } from '@fluidframework/container-definitions';
11
+ import type { IDeltaManager } from '@fluidframework/container-definitions';
12
+ import type { IDisposable } from '@fluidframework/core-interfaces';
13
+ import type { IDocumentMessage } from '@fluidframework/protocol-definitions';
14
+ import type { IEvent } from '@fluidframework/core-interfaces';
15
+ import type { IEventProvider } from '@fluidframework/core-interfaces';
16
+ import type { IExperimentalIncrementalSummaryContext } from '@fluidframework/runtime-definitions';
17
+ import type { IFluidHandle } from '@fluidframework/core-interfaces';
18
+ import type { IFluidHandleContext } from '@fluidframework/core-interfaces';
19
+ import type { IFluidLoadable } from '@fluidframework/core-interfaces';
20
+ import type { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
21
+ import type { IIdCompressor } from '@fluidframework/id-compressor';
22
+ import type { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
23
+ import type { IQuorumClients } from '@fluidframework/protocol-definitions';
24
+ import type { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
25
+ import type { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
26
+ import type { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
27
+ import type { ITelemetryContext } from '@fluidframework/runtime-definitions';
29
28
 
30
29
  /**
31
30
  * @public
@@ -153,9 +152,16 @@ export declare interface IChannelAttributes {
153
152
  *
154
153
  * If a collaboration includes a {@link https://fluidframework.com/docs/data-structures/map/ | SharedMap},
155
154
  * the collaborating clients will need to have access to a factory that can produce the `SharedMap` object.
155
+ *
156
+ * @privateRemarks
157
+ * TChannel extends IFluidLoadable instead of TChannel since doing so enables LoadableObjectClass to be covariant over its input parameter.
158
+ * This means that code like fluid-static's `InitialObjects` can be simple and type safe and LoadableObjectClass<any> is not needed.
159
+ * This approach (not requiring TChannel to extend IChannel) also makes it possible for SharedObject's public interfaces to not include IChannel if desired
160
+ * (while still requiring the implementation to implement it).
161
+ *
156
162
  * @public
157
163
  */
158
- export declare interface IChannelFactory {
164
+ export declare interface IChannelFactory<out TChannel extends IFluidLoadable = IFluidLoadable> {
159
165
  /**
160
166
  * String representing the type of the factory.
161
167
  */
@@ -179,7 +185,7 @@ export declare interface IChannelFactory {
179
185
  * for the given object? The latter seems good in general. But both are probably good things. We then just
180
186
  * need a way to allow the document to provide later storage for the object.
181
187
  */
182
- load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, channelAttributes: Readonly<IChannelAttributes>): Promise<IChannel>;
188
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, channelAttributes: Readonly<IChannelAttributes>): Promise<TChannel & IChannel>;
183
189
  /**
184
190
  * Creates a local version of the channel.
185
191
  * Calling attach on the object later will insert it into the object stream.
@@ -191,7 +197,7 @@ export declare interface IChannelFactory {
191
197
  * NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach
192
198
  * for consistency.
193
199
  */
194
- create(runtime: IFluidDataStoreRuntime, id: string): IChannel;
200
+ create(runtime: IFluidDataStoreRuntime, id: string): TChannel & IChannel;
195
201
  }
196
202
 
197
203
  /**
@@ -285,14 +291,21 @@ export declare interface IDeltaHandler {
285
291
  */
286
292
  reSubmit(message: any, localOpMetadata: unknown): void;
287
293
  /**
288
- * Apply changes from an op. Used when rehydrating an attached container
294
+ * Apply changes from an op just as if a local client has made the change,
295
+ * including submitting the op. Used when rehydrating an attached container
289
296
  * with pending changes. This prepares the SharedObject for seeing an ACK
290
297
  * for the op or resubmitting the op upon reconnection.
291
- * @param message - Contents of a stashed op.
292
- * @returns localMetadata of the op, to be passed to process() or resubmit()
293
- * when the op is ACKed or resubmitted, respectively
298
+ * @param content - Contents of a stashed op.
299
+ * @returns Should return void.
300
+ *
301
+ * @privateRemarks
302
+ * This interface is undergoing changes. Right now it support both the old
303
+ * flow, where just local metadata is returned, and a more ergonomic flow
304
+ * where operations are applied just like local edits, including
305
+ * submission of the op if attached. Soon the old flow will be removed
306
+ * and only the new flow will be supported.
294
307
  */
295
- applyStashedOp(message: any): unknown;
308
+ applyStashedOp(message: any): void;
296
309
  /**
297
310
  * Revert a local op.
298
311
  * @param message - The original message that was submitted.
@@ -311,11 +324,11 @@ export declare interface IFluidDataStoreRuntime extends IEventProvider<IFluidDat
311
324
  readonly rootRoutingContext: IFluidHandleContext;
312
325
  readonly channelsRoutingContext: IFluidHandleContext;
313
326
  readonly objectsRoutingContext: IFluidHandleContext;
314
- readonly options: ILoaderOptions;
327
+ readonly options: Record<string | number, any>;
315
328
  readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
316
329
  readonly clientId: string | undefined;
317
330
  readonly connected: boolean;
318
- readonly logger: ITelemetryLogger;
331
+ readonly logger: ITelemetryBaseLogger;
319
332
  /**
320
333
  * Indicates the attachment state of the data store to a host service.
321
334
  */
@@ -5,27 +5,26 @@
5
5
  * @packageDocumentation
6
6
  */
7
7
 
8
- import { AttachState } from '@fluidframework/container-definitions';
9
- import { FluidObject } from '@fluidframework/core-interfaces';
10
- import { IAudience } from '@fluidframework/container-definitions';
11
- import { IDeltaManager } from '@fluidframework/container-definitions';
12
- import { IDisposable } from '@fluidframework/core-interfaces';
13
- import { IDocumentMessage } from '@fluidframework/protocol-definitions';
14
- import { IEvent } from '@fluidframework/core-interfaces';
15
- import { IEventProvider } from '@fluidframework/core-interfaces';
16
- import { IExperimentalIncrementalSummaryContext } from '@fluidframework/runtime-definitions';
17
- import { IFluidHandle } from '@fluidframework/core-interfaces';
18
- import { IFluidHandleContext } from '@fluidframework/core-interfaces';
19
- import { IFluidLoadable } from '@fluidframework/core-interfaces';
20
- import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
21
- import { IIdCompressor } from '@fluidframework/id-compressor';
22
- import { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
23
- import { ILoaderOptions } from '@fluidframework/container-definitions';
24
- import { IQuorumClients } from '@fluidframework/protocol-definitions';
25
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
26
- import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
27
- import { ITelemetryContext } from '@fluidframework/runtime-definitions';
28
- import { ITelemetryLogger } from '@fluidframework/core-interfaces';
8
+ import type { AttachState } from '@fluidframework/container-definitions';
9
+ import type { FluidObject } from '@fluidframework/core-interfaces';
10
+ import type { IAudience } from '@fluidframework/container-definitions';
11
+ import type { IDeltaManager } from '@fluidframework/container-definitions';
12
+ import type { IDisposable } from '@fluidframework/core-interfaces';
13
+ import type { IDocumentMessage } from '@fluidframework/protocol-definitions';
14
+ import type { IEvent } from '@fluidframework/core-interfaces';
15
+ import type { IEventProvider } from '@fluidframework/core-interfaces';
16
+ import type { IExperimentalIncrementalSummaryContext } from '@fluidframework/runtime-definitions';
17
+ import type { IFluidHandle } from '@fluidframework/core-interfaces';
18
+ import type { IFluidHandleContext } from '@fluidframework/core-interfaces';
19
+ import type { IFluidLoadable } from '@fluidframework/core-interfaces';
20
+ import type { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
21
+ import type { IIdCompressor } from '@fluidframework/id-compressor';
22
+ import type { IInboundSignalMessage } from '@fluidframework/runtime-definitions';
23
+ import type { IQuorumClients } from '@fluidframework/protocol-definitions';
24
+ import type { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
25
+ import type { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
26
+ import type { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
27
+ import type { ITelemetryContext } from '@fluidframework/runtime-definitions';
29
28
 
30
29
  /**
31
30
  * @public
@@ -153,9 +152,16 @@ export declare interface IChannelAttributes {
153
152
  *
154
153
  * If a collaboration includes a {@link https://fluidframework.com/docs/data-structures/map/ | SharedMap},
155
154
  * the collaborating clients will need to have access to a factory that can produce the `SharedMap` object.
155
+ *
156
+ * @privateRemarks
157
+ * TChannel extends IFluidLoadable instead of TChannel since doing so enables LoadableObjectClass to be covariant over its input parameter.
158
+ * This means that code like fluid-static's `InitialObjects` can be simple and type safe and LoadableObjectClass<any> is not needed.
159
+ * This approach (not requiring TChannel to extend IChannel) also makes it possible for SharedObject's public interfaces to not include IChannel if desired
160
+ * (while still requiring the implementation to implement it).
161
+ *
156
162
  * @public
157
163
  */
158
- export declare interface IChannelFactory {
164
+ export declare interface IChannelFactory<out TChannel extends IFluidLoadable = IFluidLoadable> {
159
165
  /**
160
166
  * String representing the type of the factory.
161
167
  */
@@ -179,7 +185,7 @@ export declare interface IChannelFactory {
179
185
  * for the given object? The latter seems good in general. But both are probably good things. We then just
180
186
  * need a way to allow the document to provide later storage for the object.
181
187
  */
182
- load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, channelAttributes: Readonly<IChannelAttributes>): Promise<IChannel>;
188
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, channelAttributes: Readonly<IChannelAttributes>): Promise<TChannel & IChannel>;
183
189
  /**
184
190
  * Creates a local version of the channel.
185
191
  * Calling attach on the object later will insert it into the object stream.
@@ -191,7 +197,7 @@ export declare interface IChannelFactory {
191
197
  * NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach
192
198
  * for consistency.
193
199
  */
194
- create(runtime: IFluidDataStoreRuntime, id: string): IChannel;
200
+ create(runtime: IFluidDataStoreRuntime, id: string): TChannel & IChannel;
195
201
  }
196
202
 
197
203
  /**
@@ -285,14 +291,21 @@ export declare interface IDeltaHandler {
285
291
  */
286
292
  reSubmit(message: any, localOpMetadata: unknown): void;
287
293
  /**
288
- * Apply changes from an op. Used when rehydrating an attached container
294
+ * Apply changes from an op just as if a local client has made the change,
295
+ * including submitting the op. Used when rehydrating an attached container
289
296
  * with pending changes. This prepares the SharedObject for seeing an ACK
290
297
  * for the op or resubmitting the op upon reconnection.
291
- * @param message - Contents of a stashed op.
292
- * @returns localMetadata of the op, to be passed to process() or resubmit()
293
- * when the op is ACKed or resubmitted, respectively
298
+ * @param content - Contents of a stashed op.
299
+ * @returns Should return void.
300
+ *
301
+ * @privateRemarks
302
+ * This interface is undergoing changes. Right now it support both the old
303
+ * flow, where just local metadata is returned, and a more ergonomic flow
304
+ * where operations are applied just like local edits, including
305
+ * submission of the op if attached. Soon the old flow will be removed
306
+ * and only the new flow will be supported.
294
307
  */
295
- applyStashedOp(message: any): unknown;
308
+ applyStashedOp(message: any): void;
296
309
  /**
297
310
  * Revert a local op.
298
311
  * @param message - The original message that was submitted.
@@ -311,11 +324,11 @@ export declare interface IFluidDataStoreRuntime extends IEventProvider<IFluidDat
311
324
  readonly rootRoutingContext: IFluidHandleContext;
312
325
  readonly channelsRoutingContext: IFluidHandleContext;
313
326
  readonly objectsRoutingContext: IFluidHandleContext;
314
- readonly options: ILoaderOptions;
327
+ readonly options: Record<string | number, any>;
315
328
  readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
316
329
  readonly clientId: string | undefined;
317
330
  readonly connected: boolean;
318
- readonly logger: ITelemetryLogger;
331
+ readonly logger: ITelemetryBaseLogger;
319
332
  /**
320
333
  * Indicates the attachment state of the data store to a host service.
321
334
  */
package/dist/index.d.ts CHANGED
@@ -8,9 +8,9 @@
8
8
  *
9
9
  * @packageDocumentation
10
10
  */
11
- export { IChannel, IChannelFactory, IChannelServices, IChannelStorageService, IDeltaConnection, IDeltaHandler, } from "./channel";
12
- export { IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents } from "./dataStoreRuntime";
13
- export type { Jsonable, JsonableTypeWith, Internal_InterfaceOfJsonableTypesWith } from "./jsonable";
14
- export { Serializable } from "./serializable";
15
- export { IChannelAttributes } from "./storage";
11
+ export type { IChannel, IChannelFactory, IChannelServices, IChannelStorageService, IDeltaConnection, IDeltaHandler, } from "./channel.js";
12
+ export type { IFluidDataStoreRuntime, IFluidDataStoreRuntimeEvents } from "./dataStoreRuntime.js";
13
+ export type { Jsonable, JsonableTypeWith, Internal_InterfaceOfJsonableTypesWith, } from "./jsonable.js";
14
+ export type { Serializable } from "./serializable.js";
15
+ export type { IChannelAttributes } from "./storage.js";
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EACN,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,GACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAC1F,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,qCAAqC,EAAE,MAAM,YAAY,CAAC;AACpG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,YAAY,EACX,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,GACb,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAClG,YAAY,EACX,QAAQ,EACR,gBAAgB,EAChB,qCAAqC,GACrC,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IFluidHandle } from "@fluidframework/core-interfaces";
6
- import { Jsonable } from "./jsonable";
5
+ import type { IFluidHandle } from "@fluidframework/core-interfaces";
6
+ import type { Jsonable } from "./jsonable.js";
7
7
  /**
8
8
  * Used to constrain a type 'T' to types that Fluid can intrinsically serialize. Produces a
9
9
  * compile-time error if `T` contains non-serializable members.
@@ -1 +1 @@
1
- {"version":3,"file":"serializable.d.ts","sourceRoot":"","sources":["../src/serializable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"serializable.d.ts","sourceRoot":"","sources":["../src/serializable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC"}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.38.3"
8
+ "packageVersion": "7.42.3"
9
9
  }
10
10
  ]
11
11
  }
@@ -0,0 +1,272 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import type { IFluidHandle, IFluidLoadable } from "@fluidframework/core-interfaces";
6
+ import type { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
7
+ import type { IGarbageCollectionData, IExperimentalIncrementalSummaryContext, ISummaryTreeWithStats, ITelemetryContext } from "@fluidframework/runtime-definitions";
8
+ import type { IChannelAttributes } from "./storage.js";
9
+ import type { IFluidDataStoreRuntime } from "./dataStoreRuntime.js";
10
+ /**
11
+ * @public
12
+ */
13
+ export interface IChannel extends IFluidLoadable {
14
+ /**
15
+ * A readonly identifier for the channel
16
+ */
17
+ readonly id: string;
18
+ readonly attributes: IChannelAttributes;
19
+ /**
20
+ * Generates summary of the channel synchronously. It is called when an `attach message`
21
+ * for a local channel is generated. In other words, when the channel is being attached
22
+ * to make it visible to other clients.
23
+ *
24
+ * @remarks
25
+ *
26
+ * Note: Since the Attach Summary is generated for local channels when making them visible to
27
+ * remote clients, they don't have any previous summaries to compare against. For this reason,
28
+ * the attach summary cannot contain summary handles (paths to sub-trees or blobs).
29
+ * It can, however, contain {@link @fluidframework/protocol-definitions#ISummaryAttachment}
30
+ * (handles to blobs uploaded async via the blob manager).
31
+ *
32
+ * @param fullTree - A flag indicating whether the attempt should generate a full
33
+ * summary tree without any handles for unchanged subtrees.
34
+ *
35
+ * Default: `false`
36
+ *
37
+ * @param trackState - An optimization for tracking state of objects across summaries. If the state
38
+ * of an object did not change since last successful summary, an
39
+ * {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used
40
+ * instead of re-summarizing it. If this is `false`, the expectation is that you should never
41
+ * send an `ISummaryHandle`, since you are not expected to track state.
42
+ *
43
+ * Note: The goal is to remove the trackState and automatically decided whether the
44
+ * handles will be used or not: {@link https://github.com/microsoft/FluidFramework/issues/10455}
45
+ *
46
+ * Default: `false`
47
+ *
48
+ * @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.
49
+ *
50
+ * @returns A summary capturing the current state of the channel.
51
+ */
52
+ getAttachSummary(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
53
+ /**
54
+ * Generates summary of the channel asynchronously.
55
+ * This should not be called where the channel can be modified while summarization is in progress.
56
+ *
57
+ * @param fullTree - flag indicating whether the attempt should generate a full
58
+ * summary tree without any handles for unchanged subtrees. It should only be set to true when generating
59
+ * a summary from the entire container.
60
+ *
61
+ * Default: `false`
62
+ *
63
+ * @param trackState - An optimization for tracking state of objects across summaries. If the state
64
+ * of an object did not change since last successful summary, an
65
+ * {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used
66
+ * instead of re-summarizing it. If this is `false`, the expectation is that you should never
67
+ * send an `ISummaryHandle`, since you are not expected to track state.
68
+ *
69
+ * Default: `false`
70
+ *
71
+ * Note: The goal is to remove the trackState and automatically decided whether the
72
+ * handles will be used or not: {@link https://github.com/microsoft/FluidFramework/issues/10455}
73
+ *
74
+ * @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.
75
+ *
76
+ * @returns A summary capturing the current state of the channel.
77
+ */
78
+ summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): Promise<ISummaryTreeWithStats>;
79
+ /**
80
+ * Checks if the channel is attached to storage.
81
+ * @returns True iff the channel is attached.
82
+ */
83
+ isAttached(): boolean;
84
+ /**
85
+ * Enables the channel to send and receive ops.
86
+ * @param services - The services to connect to.
87
+ */
88
+ connect(services: IChannelServices): void;
89
+ /**
90
+ * Returns the GC data for this channel. It contains a list of GC nodes that contains references to
91
+ * other GC nodes.
92
+ * @param fullGC - true to bypass optimizations and force full generation of GC data.
93
+ */
94
+ getGCData(fullGC?: boolean): IGarbageCollectionData;
95
+ }
96
+ /**
97
+ * Handler provided by shared data structure to process requests from the runtime.
98
+ * @public
99
+ */
100
+ export interface IDeltaHandler {
101
+ /**
102
+ * Processes the op.
103
+ * @param message - The message to process
104
+ * @param local - Whether the message originated from the local client
105
+ * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
106
+ * For messages from a remote client, this will be undefined.
107
+ */
108
+ process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => void;
109
+ /**
110
+ * State change events to indicate changes to the delta connection
111
+ * @param connected - true if connected, false otherwise
112
+ */
113
+ setConnectionState(connected: boolean): void;
114
+ /**
115
+ * Called when the runtime asks the client to resubmit an op. This may be because the Container reconnected and
116
+ * this op was not acked.
117
+ * The client can choose to resubmit the same message, submit different / multiple messages or not submit anything
118
+ * at all.
119
+ * @param message - The original message that was submitted.
120
+ * @param localOpMetadata - The local metadata associated with the original message.
121
+ */
122
+ reSubmit(message: any, localOpMetadata: unknown): void;
123
+ /**
124
+ * Apply changes from an op just as if a local client has made the change,
125
+ * including submitting the op. Used when rehydrating an attached container
126
+ * with pending changes. This prepares the SharedObject for seeing an ACK
127
+ * for the op or resubmitting the op upon reconnection.
128
+ * @param content - Contents of a stashed op.
129
+ * @returns Should return void.
130
+ *
131
+ * @privateRemarks
132
+ * This interface is undergoing changes. Right now it support both the old
133
+ * flow, where just local metadata is returned, and a more ergonomic flow
134
+ * where operations are applied just like local edits, including
135
+ * submission of the op if attached. Soon the old flow will be removed
136
+ * and only the new flow will be supported.
137
+ */
138
+ applyStashedOp(message: any): void;
139
+ /**
140
+ * Revert a local op.
141
+ * @param message - The original message that was submitted.
142
+ * @param localOpMetadata - The local metadata associated with the original message.
143
+ */
144
+ rollback?(message: any, localOpMetadata: unknown): void;
145
+ }
146
+ /**
147
+ * Interface to represent a connection to a delta notification stream.
148
+ * @public
149
+ */
150
+ export interface IDeltaConnection {
151
+ connected: boolean;
152
+ /**
153
+ * Send new messages to the server.
154
+ * @param messageContent - The content of the message to be sent.
155
+ * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime
156
+ * and not sent to the server. It will be provided back when this message is acknowledged by the server. It will
157
+ * also be provided back when asked to resubmit the message.
158
+ */
159
+ submit(messageContent: any, localOpMetadata: unknown): void;
160
+ /**
161
+ * Attaches a message handler to the delta connection
162
+ */
163
+ attach(handler: IDeltaHandler): void;
164
+ /**
165
+ * Indicates that the channel is dirty and needs to be part of the summary. It is called by a SharedSummaryBlock
166
+ * that needs to be part of the summary but does not generate ops.
167
+ */
168
+ dirty(): void;
169
+ /**
170
+ * @deprecated There is no replacement for this, its functionality is no longer needed at this layer.
171
+ * It will be removed in a future release, sometime after 2.0.0-internal.8.0.0
172
+ *
173
+ * Called when a new outbound reference is added to another node. This is used by garbage collection to identify
174
+ * all references added in the system.
175
+ * @param srcHandle - The handle of the node that added the reference.
176
+ * @param outboundHandle - The handle of the outbound node that is referenced.
177
+ */
178
+ addedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
179
+ }
180
+ /**
181
+ * Storage services to read the objects at a given path.
182
+ * @public
183
+ */
184
+ export interface IChannelStorageService {
185
+ /**
186
+ * Reads the object contained at the given path. Returns a buffer representation for the object.
187
+ */
188
+ readBlob(path: string): Promise<ArrayBufferLike>;
189
+ /**
190
+ * Determines if there is an object contained at the given path.
191
+ */
192
+ contains(path: string): Promise<boolean>;
193
+ /**
194
+ * Lists the blobs that exist at a specific path.
195
+ */
196
+ list(path: string): Promise<string[]>;
197
+ }
198
+ /**
199
+ * Storage services to read the objects at a given path using the given delta connection.
200
+ * @public
201
+ */
202
+ export interface IChannelServices {
203
+ deltaConnection: IDeltaConnection;
204
+ objectStorage: IChannelStorageService;
205
+ }
206
+ /**
207
+ * Definitions of a channel factory.
208
+ *
209
+ * @remarks
210
+ *
211
+ * The runtime must be able to produce "channels" of the correct in-memory object type for the collaborative session.
212
+ * Here "channels" are typically distributed data structures (DDSs).
213
+ *
214
+ * The runtime will consult with a registry of such factories during
215
+ * {@link https://fluidframework.com/docs/build/containers/ | Container} load and when receiving "attach" operations
216
+ * (ops), which indicate a new instance of a channel being introduced to the collaboration session, to produce the
217
+ * appropriate in-memory object.
218
+ *
219
+ * Factories follow a common model but enable custom behavior.
220
+ *
221
+ * @example
222
+ *
223
+ * If a collaboration includes a {@link https://fluidframework.com/docs/data-structures/map/ | SharedMap},
224
+ * the collaborating clients will need to have access to a factory that can produce the `SharedMap` object.
225
+ *
226
+ * @privateRemarks
227
+ * TChannel extends IFluidLoadable instead of TChannel since doing so enables LoadableObjectClass to be covariant over its input parameter.
228
+ * This means that code like fluid-static's `InitialObjects` can be simple and type safe and LoadableObjectClass<any> is not needed.
229
+ * This approach (not requiring TChannel to extend IChannel) also makes it possible for SharedObject's public interfaces to not include IChannel if desired
230
+ * (while still requiring the implementation to implement it).
231
+ *
232
+ * @public
233
+ */
234
+ export interface IChannelFactory<out TChannel extends IFluidLoadable = IFluidLoadable> {
235
+ /**
236
+ * String representing the type of the factory.
237
+ */
238
+ readonly type: string;
239
+ /**
240
+ * Attributes of the channel.
241
+ */
242
+ readonly attributes: IChannelAttributes;
243
+ /**
244
+ * Loads the given channel. This call is only ever invoked internally as the only thing
245
+ * that is ever directly loaded is the document itself. Load will then only be called on documents that
246
+ * were created and added to a channel.
247
+ * @param runtime - Data store runtime containing state/info/helper methods about the data store.
248
+ * @param id - ID of the channel.
249
+ * @param services - Services to read objects at a given path using the delta connection.
250
+ * @param channelAttributes - The attributes for the the channel to be loaded.
251
+ * @returns The loaded object
252
+ *
253
+ * @privateRemarks
254
+ * Thought: should the storage object include the version information and limit access to just files
255
+ * for the given object? The latter seems good in general. But both are probably good things. We then just
256
+ * need a way to allow the document to provide later storage for the object.
257
+ */
258
+ load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, channelAttributes: Readonly<IChannelAttributes>): Promise<TChannel & IChannel>;
259
+ /**
260
+ * Creates a local version of the channel.
261
+ * Calling attach on the object later will insert it into the object stream.
262
+ * @param runtime - The runtime the new object will be associated with
263
+ * @param id - The unique ID of the new object
264
+ * @returns The newly created object.
265
+ *
266
+ * @privateRemarks
267
+ * NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach
268
+ * for consistency.
269
+ */
270
+ create(runtime: IFluidDataStoreRuntime, id: string): TChannel & IChannel;
271
+ }
272
+ //# sourceMappingURL=channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,KAAK,EAAE,yBA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