@fluidframework/runtime-definitions 2.61.0-356312 → 2.62.0-356644

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.
@@ -0,0 +1,127 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import type { IContainerRuntimeBase } from "./dataStoreContext.js";
7
+
8
+ /**
9
+ * Options for committing staged changes in experimental staging mode.
10
+ *
11
+ * @experimental
12
+ * @deprecated These APIs are unstable, and can be changed at will. They should only be used with direct agreement with the Fluid Framework.
13
+ * @legacy @beta
14
+ * @sealed
15
+ * @privateRemarks After partners move to the alpha interfaces this interface should be renamed and tagged to be internal.
16
+ */
17
+ export interface CommitStagedChangesOptionsExperimental {
18
+ /**
19
+ * If true, intermediate states created by changes made while in staging mode will be "squashed" out of the
20
+ * ops which were created during staging mode.
21
+ * Defaults to false.
22
+ * @remarks
23
+ * The squash parameter is analogous to `git squash` but differs in a notable way: ops created by a client exiting staging mode
24
+ * are not necessarily coalesced into a single op or something like it.
25
+ * It still does have the desirable property that "unnecessary changes" (such as inserting some content then removing it) will
26
+ * be removed from the set of submitted ops, which means it helps reduce network traffic and the chance of unwanted data being
27
+ * persisted--even if only temporarily--in the document.
28
+ *
29
+ * By not attempting to reduce the set of changes to a single op a la `git squash`, we can better preserve the ordering of
30
+ * changes that remote clients see such that they better align with the client which submitted the changes.
31
+ */
32
+ squash?: boolean;
33
+ }
34
+
35
+ /**
36
+ * Controls for managing staged changes in experimental staging mode.
37
+ *
38
+ * Provides methods to either commit or discard changes made while in staging mode.
39
+ *
40
+ * @experimental
41
+ * @deprecated These APIs are unstable, and can be changed at will. They should only be used with direct agreement with the Fluid Framework.
42
+ * @legacy @beta
43
+ * @sealed
44
+ * @privateRemarks After partners move to the alpha interfaces this interface should be renamed and tagged to be internal.
45
+ */
46
+ export interface StageControlsExperimental {
47
+ /**
48
+ * Exit staging mode and commit to any changes made while in staging mode.
49
+ * This will cause them to be sent to the ordering service, and subsequent changes
50
+ * made by this container will additionally flow freely to the ordering service.
51
+ * @param options - Options when committing changes.
52
+ */
53
+ readonly commitChanges: (options?: Partial<CommitStagedChangesOptionsExperimental>) => void;
54
+ /**
55
+ * Exit staging mode and discard any changes made while in staging mode.
56
+ */
57
+ readonly discardChanges: () => void;
58
+ }
59
+
60
+ /**
61
+ * Controls for managing staged changes in alpha staging mode.
62
+ *
63
+ * Provides methods to either commit or discard changes made while in staging mode.
64
+ *
65
+ * @legacy @alpha
66
+ * @sealed
67
+ */
68
+ export interface StageControlsAlpha {
69
+ /**
70
+ * Exit staging mode and commit to any changes made while in staging mode.
71
+ * This will cause them to be sent to the ordering service, and subsequent changes
72
+ * made by this container will additionally flow freely to the ordering service.
73
+ */
74
+ readonly commitChanges: () => void;
75
+ /**
76
+ * Exit staging mode and discard any changes made while in staging mode.
77
+ */
78
+ readonly discardChanges: () => void;
79
+ }
80
+
81
+ /**
82
+ * Experimental extension of {@link IContainerRuntimeBase} to support staging mode.
83
+ *
84
+ * @experimental
85
+ * @deprecated These APIs are unstable, and can be changed at will. They should only be used with direct agreement with the Fluid Framework.
86
+ * @legacy @beta
87
+ * @sealed
88
+ * @privateRemarks After partners move to the alpha interfaces this interface should be renamed and tagged to be internal.
89
+ */
90
+ export interface IContainerRuntimeBaseExperimental extends IContainerRuntimeBase {
91
+ /**
92
+ * Enters staging mode, allowing changes to be staged before being committed or discarded.
93
+ * @returns Controls for committing or discarding staged changes.
94
+ */
95
+ enterStagingMode?(): StageControlsExperimental;
96
+ /**
97
+ * Indicates whether the container is currently in staging mode.
98
+ */
99
+ readonly inStagingMode?: boolean;
100
+ }
101
+
102
+ /**
103
+ * Alpha interface for container runtime base supporting staging mode.
104
+ *
105
+ * @legacy @alpha
106
+ * @sealed
107
+ */
108
+ export interface ContainerRuntimeBaseAlpha extends IContainerRuntimeBase {
109
+ /**
110
+ * Enters staging mode, allowing changes to be staged before being committed or discarded.
111
+ * @returns Controls for committing or discarding staged changes.
112
+ */
113
+ enterStagingMode(): StageControlsAlpha;
114
+ /**
115
+ * Indicates whether the container is currently in staging mode.
116
+ */
117
+ readonly inStagingMode: boolean;
118
+ }
119
+
120
+ /**
121
+ * Converts types to their alpha counterparts to expose alpha functionality.
122
+ * @legacy @alpha
123
+ * @sealed
124
+ */
125
+ export function asLegacyAlpha(base: IContainerRuntimeBase): ContainerRuntimeBaseAlpha {
126
+ return base as ContainerRuntimeBaseAlpha;
127
+ }