@fluidframework/runtime-definitions 2.92.0 → 2.100.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.
@@ -1 +1 @@
1
- {"version":3,"file":"stagingMode.js","sourceRoot":"","sources":["../src/stagingMode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6FH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,IAA2B;IACxD,OAAO,IAAiC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IContainerRuntimeBase } from \"./dataStoreContext.js\";\n\n/**\n * Options for committing staged changes in experimental staging mode.\n * @internal\n */\nexport interface CommitStagedChangesOptionsInternal {\n\t/**\n\t * If true, intermediate states created by changes made while in staging mode will be \"squashed\" out of the\n\t * ops which were created during staging mode.\n\t * Defaults to false.\n\t * @remarks\n\t * The squash parameter is analogous to `git squash` but differs in a notable way: ops created by a client exiting staging mode\n\t * are not necessarily coalesced into a single op or something like it.\n\t * It still does have the desirable property that \"unnecessary changes\" (such as inserting some content then removing it) will\n\t * be removed from the set of submitted ops, which means it helps reduce network traffic and the chance of unwanted data being\n\t * persisted--even if only temporarily--in the document.\n\t *\n\t * By not attempting to reduce the set of changes to a single op a la `git squash`, we can better preserve the ordering of\n\t * changes that remote clients see such that they better align with the client which submitted the changes.\n\t */\n\tsquash?: boolean;\n}\n\n/**\n * Controls for managing staged changes in experimental staging mode.\n *\n * Provides methods to either commit or discard changes made while in staging mode.\n * @internal\n */\nexport interface StageControlsInternal extends StageControlsAlpha {\n\t/**\n\t * Exit staging mode and commit to any changes made while in staging mode.\n\t * This will cause them to be sent to the ordering service, and subsequent changes\n\t * made by this container will additionally flow freely to the ordering service.\n\t * @param options - Options when committing changes.\n\t */\n\treadonly commitChanges: (options?: Partial<CommitStagedChangesOptionsInternal>) => void;\n}\n\n/**\n * Controls for managing staged changes in alpha staging mode.\n *\n * Provides methods to either commit or discard changes made while in staging mode.\n *\n * @legacy @alpha\n * @sealed\n */\nexport interface StageControlsAlpha {\n\t/**\n\t * Exit staging mode and commit to any changes made while in staging mode.\n\t * This will cause them to be sent to the ordering service, and subsequent changes\n\t * made by this container will additionally flow freely to the ordering service.\n\t */\n\treadonly commitChanges: () => void;\n\t/**\n\t * Exit staging mode and discard any changes made while in staging mode.\n\t */\n\treadonly discardChanges: () => void;\n}\n\n/**\n * Experimental extension of {@link IContainerRuntimeBase} to support staging mode.\n * @internal\n */\nexport interface IContainerRuntimeBaseInternal extends ContainerRuntimeBaseAlpha {\n\t/**\n\t * Enters staging mode, allowing changes to be staged before being committed or discarded.\n\t * @returns Controls for committing or discarding staged changes.\n\t */\n\tenterStagingMode(): StageControlsInternal;\n}\n\n/**\n * Alpha interface for container runtime base supporting staging mode.\n *\n * @legacy @alpha\n * @sealed\n */\nexport interface ContainerRuntimeBaseAlpha extends IContainerRuntimeBase {\n\t/**\n\t * Enters staging mode, allowing changes to be staged before being committed or discarded.\n\t * @returns Controls for committing or discarding staged changes.\n\t */\n\tenterStagingMode(): StageControlsAlpha;\n\t/**\n\t * Indicates whether the container is currently in staging mode.\n\t */\n\treadonly inStagingMode: boolean;\n}\n\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n * @sealed\n */\nexport function asLegacyAlpha(base: IContainerRuntimeBase): ContainerRuntimeBaseAlpha {\n\treturn base as ContainerRuntimeBaseAlpha;\n}\n"]}
1
+ {"version":3,"file":"stagingMode.js","sourceRoot":"","sources":["../src/stagingMode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4EH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,IAA2B;IACxD,OAAO,IAAiC,CAAC;AAC1C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IContainerRuntimeBase, StageControls } from \"./dataStoreContext.js\";\n\n/**\n * Options for committing staged changes in experimental staging mode.\n * @internal\n */\nexport interface CommitStagedChangesOptionsInternal {\n\t/**\n\t * If true, intermediate states created by changes made while in staging mode will be \"squashed\" out of the\n\t * ops which were created during staging mode.\n\t * Defaults to false.\n\t * @remarks\n\t * The squash parameter is analogous to `git squash` but differs in a notable way: ops created by a client exiting staging mode\n\t * are not necessarily coalesced into a single op or something like it.\n\t * It still does have the desirable property that \"unnecessary changes\" (such as inserting some content then removing it) will\n\t * be removed from the set of submitted ops, which means it helps reduce network traffic and the chance of unwanted data being\n\t * persisted--even if only temporarily--in the document.\n\t *\n\t * By not attempting to reduce the set of changes to a single op a la `git squash`, we can better preserve the ordering of\n\t * changes that remote clients see such that they better align with the client which submitted the changes.\n\t */\n\tsquash?: boolean;\n}\n\n/**\n * Controls for managing staged changes in experimental staging mode.\n *\n * Provides methods to either commit or discard changes made while in staging mode.\n * @internal\n */\nexport interface StageControlsInternal extends StageControls {\n\t/**\n\t * Exit staging mode and commit to any changes made while in staging mode.\n\t * This will cause them to be sent to the ordering service, and subsequent changes\n\t * made by this container will additionally flow freely to the ordering service.\n\t * @param options - Options when committing changes.\n\t */\n\treadonly commitChanges: (options?: Partial<CommitStagedChangesOptionsInternal>) => void;\n}\n\n/**\n * Internal extension of {@link IContainerRuntimeBase} whose {@link IContainerRuntimeBaseInternal.enterStagingMode}\n * returns {@link StageControlsInternal} (which exposes internal commit options such as squash)\n * @internal\n */\nexport interface IContainerRuntimeBaseInternal extends IContainerRuntimeBase {\n\t/**\n\t * Enters staging mode, allowing changes to be staged before being committed or discarded.\n\t * @returns Controls for committing or discarding staged changes.\n\t */\n\tenterStagingMode(): StageControlsInternal;\n}\n\n/**\n * Controls for managing staged changes in alpha staging mode.\n *\n * Provides methods to either commit or discard changes made while in staging mode.\n *\n * @deprecated Use {@link StageControls} (beta) instead.\n * @legacy @alpha\n * @sealed\n */\nexport interface StageControlsAlpha extends StageControls {}\n\n/**\n * Alpha extension of {@link IContainerRuntimeBase} that exposes alpha-level APIs.\n *\n * @remarks Use {@link asLegacyAlpha} to obtain an instance from an {@link IContainerRuntimeBase}.\n *\n * @legacy @alpha\n * @sealed\n */\nexport interface ContainerRuntimeBaseAlpha extends IContainerRuntimeBase {}\n\n/**\n * Converts types to their alpha counterparts to expose alpha functionality.\n * @legacy @alpha\n * @sealed\n */\nexport function asLegacyAlpha(base: IContainerRuntimeBase): ContainerRuntimeBaseAlpha {\n\treturn base as ContainerRuntimeBaseAlpha;\n}\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.52.11"
8
+ "packageVersion": "7.58.1"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/runtime-definitions",
3
- "version": "2.92.0",
3
+ "version": "2.100.0",
4
4
  "description": "Fluid Runtime definitions",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -67,22 +67,22 @@
67
67
  "main": "lib/index.js",
68
68
  "types": "lib/public.d.ts",
69
69
  "dependencies": {
70
- "@fluid-internal/client-utils": "~2.92.0",
71
- "@fluidframework/container-definitions": "~2.92.0",
72
- "@fluidframework/core-interfaces": "~2.92.0",
73
- "@fluidframework/driver-definitions": "~2.92.0",
74
- "@fluidframework/id-compressor": "~2.92.0",
75
- "@fluidframework/telemetry-utils": "~2.92.0"
70
+ "@fluid-internal/client-utils": "~2.100.0",
71
+ "@fluidframework/container-definitions": "~2.100.0",
72
+ "@fluidframework/core-interfaces": "~2.100.0",
73
+ "@fluidframework/driver-definitions": "~2.100.0",
74
+ "@fluidframework/id-compressor": "~2.100.0",
75
+ "@fluidframework/telemetry-utils": "~2.100.0"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@arethetypeswrong/cli": "^0.18.2",
79
79
  "@biomejs/biome": "~2.4.5",
80
- "@fluid-tools/build-cli": "^0.64.0",
80
+ "@fluid-tools/build-cli": "^0.65.0",
81
81
  "@fluidframework/build-common": "^2.0.3",
82
- "@fluidframework/build-tools": "^0.64.0",
82
+ "@fluidframework/build-tools": "^0.65.0",
83
83
  "@fluidframework/eslint-config-fluid": "^9.0.0",
84
- "@fluidframework/runtime-definitions-previous": "npm:@fluidframework/runtime-definitions@2.91.0",
85
- "@microsoft/api-extractor": "7.52.11",
84
+ "@fluidframework/runtime-definitions-previous": "npm:@fluidframework/runtime-definitions@2.92.0",
85
+ "@microsoft/api-extractor": "7.58.1",
86
86
  "concurrently": "^9.2.1",
87
87
  "copyfiles": "^2.4.1",
88
88
  "eslint": "~9.39.1",
@@ -133,7 +133,6 @@
133
133
  "lint": "fluid-build . --task lint",
134
134
  "lint:fix": "fluid-build . --task eslint:fix --task format",
135
135
  "tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
136
- "typetests:gen": "flub generate typetests --dir . -v",
137
- "typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
136
+ "typetests:gen": "flub generate typetests --dir . -v"
138
137
  }
139
138
  }
@@ -132,6 +132,17 @@ export interface IContainerRuntimeBaseEvents extends IEvent {
132
132
  (event: "op", listener: (op: ISequencedDocumentMessage, runtimeMessage?: boolean) => void);
133
133
  (event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void);
134
134
  (event: "dispose", listener: () => void);
135
+ /**
136
+ * Fires when the container runtime enters or exits staging mode.
137
+ * @param stagingModeInfo - An object describing the staging mode state.
138
+ * If `inStagingMode` is true, the runtime has entered staging mode.
139
+ * If false, it has exited staging mode, and `commit` indicates whether changes were committed or discarded.
140
+ *
141
+ * @remarks
142
+ * This event is not emitted when the container is disposed while in staging mode.
143
+ * If the container is disposed, staged changes are silently dropped.
144
+ */
145
+ (event: "stagingModeChanged", listener: (stagingModeInfo: StagingModeChangedEvent) => void);
135
146
  }
136
147
 
137
148
  /**
@@ -180,6 +191,35 @@ export interface IDataStore {
180
191
  readonly entryPoint: IFluidHandleInternal<FluidObject>;
181
192
  }
182
193
 
194
+ /**
195
+ * Controls for managing staged changes in staging mode.
196
+ *
197
+ * Provides methods to either commit or discard changes made while in staging mode.
198
+ *
199
+ * @see {@link IContainerRuntimeBase.enterStagingMode}
200
+ *
201
+ * @legacy @beta
202
+ * @sealed
203
+ */
204
+ export interface StageControls {
205
+ /**
206
+ * Exit staging mode and commit to any changes made while in staging mode.
207
+ * This will cause them to be sent to the ordering service, and subsequent changes
208
+ * made by this container will additionally flow freely to the ordering service.
209
+ *
210
+ * @remarks
211
+ * Squash-rebase semantics during commit are not yet fully specified.
212
+ */
213
+ readonly commitChanges: () => void;
214
+ /**
215
+ * Exit staging mode and discard any changes made while in staging mode.
216
+ *
217
+ * @remarks
218
+ * DDS rollback support may be incomplete — this may throw for some DDS implementations.
219
+ */
220
+ readonly discardChanges: () => void;
221
+ }
222
+
183
223
  /**
184
224
  * A reduced set of functionality of {@link @fluidframework/container-runtime-definitions#IContainerRuntime} that a data store context/data store runtime will need.
185
225
  * @privateRemarks
@@ -290,6 +330,27 @@ export interface IContainerRuntimeBase extends IEventProvider<IContainerRuntimeB
290
330
  loadingGroupIds: string[],
291
331
  pathParts: string[],
292
332
  ): Promise<{ snapshotTree: ISnapshotTree; sequenceNumber: number }>;
333
+
334
+ /**
335
+ * Enter Staging Mode, such that ops submitted to the ContainerRuntime will not be sent to the ordering service.
336
+ * To exit Staging Mode, call either discardChanges or commitChanges on the Stage Controls returned from this method.
337
+ *
338
+ * @remarks
339
+ * Known limitations:
340
+ * - DDS rollback support may be incomplete — {@link StageControls.discardChanges} may throw for some DDS implementations.
341
+ * - Squash-rebase semantics during {@link StageControls.commitChanges} are not yet fully specified.
342
+ *
343
+ * @returns Controls for committing or discarding staged changes.
344
+ */
345
+ enterStagingMode(): StageControls;
346
+
347
+ /**
348
+ * If true, the ContainerRuntime is not submitting any new ops to the ordering service.
349
+ * Ops submitted to the ContainerRuntime while in Staging Mode will be queued in the PendingStateManager,
350
+ * either to be discarded or committed later (via the Stage Controls returned from enterStagingMode).
351
+ * @see {@link IContainerRuntimeBase.enterStagingMode}
352
+ */
353
+ readonly inStagingMode: boolean;
293
354
  }
294
355
 
295
356
  /**
@@ -310,6 +371,10 @@ export interface IFluidDataStorePolicies {
310
371
  * (e.g., `ConsensusRegisterCollection`, `ConsensusQueue`, `TaskManager`) won't resolve their promises until
311
372
  * staging mode exits. Set this to `true` for data stores that depend on consensus acknowledgments
312
373
  * to prevent modifications that would leave the data store in an unresponsive state.
374
+ *
375
+ * This provides a best-effort readonly appearance, but no strict enforcement.
376
+ *
377
+ * @see {@link IContainerRuntimeBase.enterStagingMode}
313
378
  */
314
379
  readonly readonlyInStagingMode: boolean;
315
380
  }
@@ -438,6 +503,19 @@ export interface IFluidDataStoreChannel extends IDisposable {
438
503
  setAttachState(attachState: AttachState.Attaching | AttachState.Attached): void;
439
504
  }
440
505
 
506
+ /**
507
+ * Describes a staging mode transition on the container runtime.
508
+ * - `{ inStagingMode: true }` — the runtime has entered staging mode.
509
+ *
510
+ * - `{ inStagingMode: false, commit: boolean }` — the runtime has exited staging mode.
511
+ * `commit` is `true` when staged changes were committed (not discarded), or `false` when they were discarded.
512
+ *
513
+ * @legacy @beta
514
+ */
515
+ export type StagingModeChangedEvent =
516
+ | { readonly inStagingMode: true }
517
+ | { readonly inStagingMode: false; readonly commit: boolean };
518
+
441
519
  /**
442
520
  * @legacy @beta
443
521
  */
@@ -492,7 +570,7 @@ export interface IFluidParentContext
492
570
  * Consumed by {@link @fluidframework/container-runtime#FluidDataStoreContext}.
493
571
  * See {@link @fluidframework/container-runtime#LoadContainerRuntimeParams.minVersionForCollab} for more details.
494
572
  */
495
- readonly minVersionForCollab?: MinimumVersionForCollab;
573
+ readonly minVersionForCollab: MinimumVersionForCollab;
496
574
  readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
497
575
  readonly storage: IRuntimeStorageService;
498
576
  readonly baseLogger: ITelemetryBaseLogger;
package/src/index.ts CHANGED
@@ -31,6 +31,8 @@ export type {
31
31
  IFluidDataStoreContextDetached,
32
32
  IPendingMessagesState,
33
33
  PackagePath,
34
+ StageControls,
35
+ StagingModeChangedEvent,
34
36
  } from "./dataStoreContext.js";
35
37
  export { FlushMode, VisibilityState } from "./dataStoreContext.js";
36
38
  export type { IProvideFluidDataStoreFactory } from "./dataStoreFactory.js";
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import type { IContainerRuntimeBase } from "./dataStoreContext.js";
6
+ import type { IContainerRuntimeBase, StageControls } from "./dataStoreContext.js";
7
7
 
8
8
  /**
9
9
  * Options for committing staged changes in experimental staging mode.
@@ -33,7 +33,7 @@ export interface CommitStagedChangesOptionsInternal {
33
33
  * Provides methods to either commit or discard changes made while in staging mode.
34
34
  * @internal
35
35
  */
36
- export interface StageControlsInternal extends StageControlsAlpha {
36
+ export interface StageControlsInternal extends StageControls {
37
37
  /**
38
38
  * Exit staging mode and commit to any changes made while in staging mode.
39
39
  * This will cause them to be sent to the ordering service, and subsequent changes
@@ -44,31 +44,11 @@ export interface StageControlsInternal extends StageControlsAlpha {
44
44
  }
45
45
 
46
46
  /**
47
- * Controls for managing staged changes in alpha staging mode.
48
- *
49
- * Provides methods to either commit or discard changes made while in staging mode.
50
- *
51
- * @legacy @alpha
52
- * @sealed
53
- */
54
- export interface StageControlsAlpha {
55
- /**
56
- * Exit staging mode and commit to any changes made while in staging mode.
57
- * This will cause them to be sent to the ordering service, and subsequent changes
58
- * made by this container will additionally flow freely to the ordering service.
59
- */
60
- readonly commitChanges: () => void;
61
- /**
62
- * Exit staging mode and discard any changes made while in staging mode.
63
- */
64
- readonly discardChanges: () => void;
65
- }
66
-
67
- /**
68
- * Experimental extension of {@link IContainerRuntimeBase} to support staging mode.
47
+ * Internal extension of {@link IContainerRuntimeBase} whose {@link IContainerRuntimeBaseInternal.enterStagingMode}
48
+ * returns {@link StageControlsInternal} (which exposes internal commit options such as squash)
69
49
  * @internal
70
50
  */
71
- export interface IContainerRuntimeBaseInternal extends ContainerRuntimeBaseAlpha {
51
+ export interface IContainerRuntimeBaseInternal extends IContainerRuntimeBase {
72
52
  /**
73
53
  * Enters staging mode, allowing changes to be staged before being committed or discarded.
74
54
  * @returns Controls for committing or discarding staged changes.
@@ -77,22 +57,25 @@ export interface IContainerRuntimeBaseInternal extends ContainerRuntimeBaseAlpha
77
57
  }
78
58
 
79
59
  /**
80
- * Alpha interface for container runtime base supporting staging mode.
60
+ * Controls for managing staged changes in alpha staging mode.
61
+ *
62
+ * Provides methods to either commit or discard changes made while in staging mode.
81
63
  *
64
+ * @deprecated Use {@link StageControls} (beta) instead.
82
65
  * @legacy @alpha
83
66
  * @sealed
84
67
  */
85
- export interface ContainerRuntimeBaseAlpha extends IContainerRuntimeBase {
86
- /**
87
- * Enters staging mode, allowing changes to be staged before being committed or discarded.
88
- * @returns Controls for committing or discarding staged changes.
89
- */
90
- enterStagingMode(): StageControlsAlpha;
91
- /**
92
- * Indicates whether the container is currently in staging mode.
93
- */
94
- readonly inStagingMode: boolean;
95
- }
68
+ export interface StageControlsAlpha extends StageControls {}
69
+
70
+ /**
71
+ * Alpha extension of {@link IContainerRuntimeBase} that exposes alpha-level APIs.
72
+ *
73
+ * @remarks Use {@link asLegacyAlpha} to obtain an instance from an {@link IContainerRuntimeBase}.
74
+ *
75
+ * @legacy @alpha
76
+ * @sealed
77
+ */
78
+ export interface ContainerRuntimeBaseAlpha extends IContainerRuntimeBase {}
96
79
 
97
80
  /**
98
81
  * Converts types to their alpha counterparts to expose alpha functionality.