@fluidframework/datastore-definitions 2.0.0-rc.2.0.2 → 2.0.0-rc.3.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.
- package/CHANGELOG.md +23 -0
- package/api-report/datastore-definitions.api.md +3 -2
- package/dist/channel.d.ts +4 -4
- package/dist/channel.d.ts.map +1 -1
- package/dist/dataStoreRuntime.d.ts +19 -5
- package/dist/dataStoreRuntime.d.ts.map +1 -1
- package/dist/legacy.d.ts +28 -0
- package/dist/public.d.ts +22 -0
- package/dist/serializable.d.ts.map +1 -1
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- package/lib/channel.d.ts +4 -4
- package/lib/channel.d.ts.map +1 -1
- package/lib/dataStoreRuntime.d.ts +19 -5
- package/lib/dataStoreRuntime.d.ts.map +1 -1
- package/lib/legacy.d.ts +28 -0
- package/lib/public.d.ts +22 -0
- package/lib/serializable.d.ts.map +1 -1
- package/package.json +26 -45
- package/src/channel.ts +5 -4
- package/src/dataStoreRuntime.ts +23 -7
- package/src/serializable.ts +1 -0
- package/api-extractor-cjs.json +0 -8
- package/dist/datastore-definitions-alpha.d.ts +0 -496
- package/dist/datastore-definitions-beta.d.ts +0 -411
- package/dist/datastore-definitions-public.d.ts +0 -411
- package/dist/datastore-definitions-untrimmed.d.ts +0 -496
- package/lib/datastore-definitions-alpha.d.ts +0 -496
- package/lib/datastore-definitions-beta.d.ts +0 -411
- package/lib/datastore-definitions-public.d.ts +0 -411
- package/lib/datastore-definitions-untrimmed.d.ts +0 -496
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
package/src/dataStoreRuntime.ts
CHANGED
|
@@ -3,23 +3,24 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import type { AttachState, IAudience, IDeltaManager } from "@fluidframework/container-definitions";
|
|
6
7
|
import type {
|
|
8
|
+
FluidObject,
|
|
9
|
+
IDisposable,
|
|
7
10
|
IEvent,
|
|
8
11
|
IEventProvider,
|
|
9
|
-
IDisposable,
|
|
10
|
-
IFluidHandleContext,
|
|
11
12
|
IFluidHandle,
|
|
12
|
-
|
|
13
|
+
IFluidHandleContext,
|
|
13
14
|
ITelemetryBaseLogger,
|
|
14
15
|
} from "@fluidframework/core-interfaces";
|
|
15
|
-
import type {
|
|
16
|
+
import type { IIdCompressor } from "@fluidframework/id-compressor";
|
|
16
17
|
import type {
|
|
17
18
|
IDocumentMessage,
|
|
18
19
|
IQuorumClients,
|
|
19
20
|
ISequencedDocumentMessage,
|
|
20
21
|
} from "@fluidframework/protocol-definitions";
|
|
21
22
|
import type { IInboundSignalMessage } from "@fluidframework/runtime-definitions";
|
|
22
|
-
|
|
23
|
+
|
|
23
24
|
import type { IChannel } from "./channel.js";
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -88,6 +89,21 @@ export interface IFluidDataStoreRuntime
|
|
|
88
89
|
*/
|
|
89
90
|
createChannel(id: string | undefined, type: string): IChannel;
|
|
90
91
|
|
|
92
|
+
/**
|
|
93
|
+
* This api allows adding channel to data store after it was created.
|
|
94
|
+
* This allows callers to cusmomize channel instance. For example, channel implementation
|
|
95
|
+
* could have various modes of operations. As long as such configuration is provided at creation
|
|
96
|
+
* and stored in summaries (such that all users of such channel instance behave the same), this
|
|
97
|
+
* could be useful technique to have customized solutions without introducing a number of data structures
|
|
98
|
+
* that all have same implementation.
|
|
99
|
+
* This is also useful for scenarios like SharedTree DDS, where schema is provided at creation and stored in a summary.
|
|
100
|
+
* The channel type should be present in the registry, otherwise the runtime would reject
|
|
101
|
+
* the channel. The runtime used to create the channel object should be same to which
|
|
102
|
+
* it is added.
|
|
103
|
+
* @param channel - channel which needs to be added to the runtime.
|
|
104
|
+
*/
|
|
105
|
+
addChannel(channel: IChannel): void;
|
|
106
|
+
|
|
91
107
|
/**
|
|
92
108
|
* Bind the channel with the data store runtime. If the runtime
|
|
93
109
|
* is attached then we attach the channel to make it live.
|
|
@@ -104,10 +120,10 @@ export interface IFluidDataStoreRuntime
|
|
|
104
120
|
/**
|
|
105
121
|
* Submits the signal to be sent to other clients.
|
|
106
122
|
* @param type - Type of the signal.
|
|
107
|
-
* @param content - Content of the signal.
|
|
123
|
+
* @param content - Content of the signal. Should be a JSON serializable object or primitive.
|
|
108
124
|
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
109
125
|
*/
|
|
110
|
-
submitSignal(type: string, content:
|
|
126
|
+
submitSignal: (type: string, content: unknown, targetClientId?: string) => void;
|
|
111
127
|
|
|
112
128
|
/**
|
|
113
129
|
* Returns the current quorum.
|
package/src/serializable.ts
CHANGED
package/api-extractor-cjs.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
|
|
4
|
-
// CJS is actually secondary; so, no report.
|
|
5
|
-
"apiReport": {
|
|
6
|
-
"enabled": false
|
|
7
|
-
}
|
|
8
|
-
}
|
|
@@ -1,496 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This library defines the interfaces required to implement and/or communicate
|
|
3
|
-
* with a data store.
|
|
4
|
-
*
|
|
5
|
-
* @packageDocumentation
|
|
6
|
-
*/
|
|
7
|
-
|
|
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';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
export declare interface IChannel extends IFluidLoadable {
|
|
33
|
-
/**
|
|
34
|
-
* A readonly identifier for the channel
|
|
35
|
-
*/
|
|
36
|
-
readonly id: string;
|
|
37
|
-
readonly attributes: IChannelAttributes;
|
|
38
|
-
/**
|
|
39
|
-
* Generates summary of the channel synchronously. It is called when an `attach message`
|
|
40
|
-
* for a local channel is generated. In other words, when the channel is being attached
|
|
41
|
-
* to make it visible to other clients.
|
|
42
|
-
*
|
|
43
|
-
* @remarks
|
|
44
|
-
*
|
|
45
|
-
* Note: Since the Attach Summary is generated for local channels when making them visible to
|
|
46
|
-
* remote clients, they don't have any previous summaries to compare against. For this reason,
|
|
47
|
-
* the attach summary cannot contain summary handles (paths to sub-trees or blobs).
|
|
48
|
-
* It can, however, contain {@link @fluidframework/protocol-definitions#ISummaryAttachment}
|
|
49
|
-
* (handles to blobs uploaded async via the blob manager).
|
|
50
|
-
*
|
|
51
|
-
* @param fullTree - A flag indicating whether the attempt should generate a full
|
|
52
|
-
* summary tree without any handles for unchanged subtrees.
|
|
53
|
-
*
|
|
54
|
-
* Default: `false`
|
|
55
|
-
*
|
|
56
|
-
* @param trackState - An optimization for tracking state of objects across summaries. If the state
|
|
57
|
-
* of an object did not change since last successful summary, an
|
|
58
|
-
* {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used
|
|
59
|
-
* instead of re-summarizing it. If this is `false`, the expectation is that you should never
|
|
60
|
-
* send an `ISummaryHandle`, since you are not expected to track state.
|
|
61
|
-
*
|
|
62
|
-
* Note: The goal is to remove the trackState and automatically decided whether the
|
|
63
|
-
* handles will be used or not: {@link https://github.com/microsoft/FluidFramework/issues/10455}
|
|
64
|
-
*
|
|
65
|
-
* Default: `false`
|
|
66
|
-
*
|
|
67
|
-
* @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.
|
|
68
|
-
*
|
|
69
|
-
* @returns A summary capturing the current state of the channel.
|
|
70
|
-
*/
|
|
71
|
-
getAttachSummary(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
72
|
-
/**
|
|
73
|
-
* Generates summary of the channel asynchronously.
|
|
74
|
-
* This should not be called where the channel can be modified while summarization is in progress.
|
|
75
|
-
*
|
|
76
|
-
* @param fullTree - flag indicating whether the attempt should generate a full
|
|
77
|
-
* summary tree without any handles for unchanged subtrees. It should only be set to true when generating
|
|
78
|
-
* a summary from the entire container.
|
|
79
|
-
*
|
|
80
|
-
* Default: `false`
|
|
81
|
-
*
|
|
82
|
-
* @param trackState - An optimization for tracking state of objects across summaries. If the state
|
|
83
|
-
* of an object did not change since last successful summary, an
|
|
84
|
-
* {@link @fluidframework/protocol-definitions#ISummaryHandle} can be used
|
|
85
|
-
* instead of re-summarizing it. If this is `false`, the expectation is that you should never
|
|
86
|
-
* send an `ISummaryHandle`, since you are not expected to track state.
|
|
87
|
-
*
|
|
88
|
-
* Default: `false`
|
|
89
|
-
*
|
|
90
|
-
* Note: The goal is to remove the trackState and automatically decided whether the
|
|
91
|
-
* handles will be used or not: {@link https://github.com/microsoft/FluidFramework/issues/10455}
|
|
92
|
-
*
|
|
93
|
-
* @param telemetryContext - See {@link @fluidframework/runtime-definitions#ITelemetryContext}.
|
|
94
|
-
*
|
|
95
|
-
* @returns A summary capturing the current state of the channel.
|
|
96
|
-
*/
|
|
97
|
-
summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): Promise<ISummaryTreeWithStats>;
|
|
98
|
-
/**
|
|
99
|
-
* Checks if the channel is attached to storage.
|
|
100
|
-
* @returns True iff the channel is attached.
|
|
101
|
-
*/
|
|
102
|
-
isAttached(): boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Enables the channel to send and receive ops.
|
|
105
|
-
* @param services - The services to connect to.
|
|
106
|
-
*/
|
|
107
|
-
connect(services: IChannelServices): void;
|
|
108
|
-
/**
|
|
109
|
-
* Returns the GC data for this channel. It contains a list of GC nodes that contains references to
|
|
110
|
-
* other GC nodes.
|
|
111
|
-
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
112
|
-
*/
|
|
113
|
-
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Represents the attributes of a channel/DDS.
|
|
118
|
-
* @public
|
|
119
|
-
*/
|
|
120
|
-
export declare interface IChannelAttributes {
|
|
121
|
-
/**
|
|
122
|
-
* Type name of the DDS for factory look up with ISharedObjectRegistry
|
|
123
|
-
*/
|
|
124
|
-
readonly type: string;
|
|
125
|
-
/**
|
|
126
|
-
* Format version of the snapshot
|
|
127
|
-
* Currently, only use to display a debug message if the version is incompatible
|
|
128
|
-
*/
|
|
129
|
-
readonly snapshotFormatVersion: string;
|
|
130
|
-
/**
|
|
131
|
-
* The package version of the code of the DDS, for debug only
|
|
132
|
-
*/
|
|
133
|
-
readonly packageVersion?: string;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Definitions of a channel factory.
|
|
138
|
-
*
|
|
139
|
-
* @remarks
|
|
140
|
-
*
|
|
141
|
-
* The runtime must be able to produce "channels" of the correct in-memory object type for the collaborative session.
|
|
142
|
-
* Here "channels" are typically distributed data structures (DDSs).
|
|
143
|
-
*
|
|
144
|
-
* The runtime will consult with a registry of such factories during
|
|
145
|
-
* {@link https://fluidframework.com/docs/build/containers/ | Container} load and when receiving "attach" operations
|
|
146
|
-
* (ops), which indicate a new instance of a channel being introduced to the collaboration session, to produce the
|
|
147
|
-
* appropriate in-memory object.
|
|
148
|
-
*
|
|
149
|
-
* Factories follow a common model but enable custom behavior.
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
*
|
|
153
|
-
* If a collaboration includes a {@link https://fluidframework.com/docs/data-structures/map/ | SharedMap},
|
|
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
|
-
*
|
|
162
|
-
* @public
|
|
163
|
-
*/
|
|
164
|
-
export declare interface IChannelFactory<out TChannel extends IFluidLoadable = IFluidLoadable> {
|
|
165
|
-
/**
|
|
166
|
-
* String representing the type of the factory.
|
|
167
|
-
*/
|
|
168
|
-
readonly type: string;
|
|
169
|
-
/**
|
|
170
|
-
* Attributes of the channel.
|
|
171
|
-
*/
|
|
172
|
-
readonly attributes: IChannelAttributes;
|
|
173
|
-
/**
|
|
174
|
-
* Loads the given channel. This call is only ever invoked internally as the only thing
|
|
175
|
-
* that is ever directly loaded is the document itself. Load will then only be called on documents that
|
|
176
|
-
* were created and added to a channel.
|
|
177
|
-
* @param runtime - Data store runtime containing state/info/helper methods about the data store.
|
|
178
|
-
* @param id - ID of the channel.
|
|
179
|
-
* @param services - Services to read objects at a given path using the delta connection.
|
|
180
|
-
* @param channelAttributes - The attributes for the the channel to be loaded.
|
|
181
|
-
* @returns The loaded object
|
|
182
|
-
*
|
|
183
|
-
* @privateRemarks
|
|
184
|
-
* Thought: should the storage object include the version information and limit access to just files
|
|
185
|
-
* for the given object? The latter seems good in general. But both are probably good things. We then just
|
|
186
|
-
* need a way to allow the document to provide later storage for the object.
|
|
187
|
-
*/
|
|
188
|
-
load(runtime: IFluidDataStoreRuntime, id: string, services: IChannelServices, channelAttributes: Readonly<IChannelAttributes>): Promise<TChannel & IChannel>;
|
|
189
|
-
/**
|
|
190
|
-
* Creates a local version of the channel.
|
|
191
|
-
* Calling attach on the object later will insert it into the object stream.
|
|
192
|
-
* @param runtime - The runtime the new object will be associated with
|
|
193
|
-
* @param id - The unique ID of the new object
|
|
194
|
-
* @returns The newly created object.
|
|
195
|
-
*
|
|
196
|
-
* @privateRemarks
|
|
197
|
-
* NOTE here - When we attach we need to submit all the pending ops prior to actually doing the attach
|
|
198
|
-
* for consistency.
|
|
199
|
-
*/
|
|
200
|
-
create(runtime: IFluidDataStoreRuntime, id: string): TChannel & IChannel;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Storage services to read the objects at a given path using the given delta connection.
|
|
205
|
-
* @public
|
|
206
|
-
*/
|
|
207
|
-
export declare interface IChannelServices {
|
|
208
|
-
deltaConnection: IDeltaConnection;
|
|
209
|
-
objectStorage: IChannelStorageService;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Storage services to read the objects at a given path.
|
|
214
|
-
* @public
|
|
215
|
-
*/
|
|
216
|
-
export declare interface IChannelStorageService {
|
|
217
|
-
/**
|
|
218
|
-
* Reads the object contained at the given path. Returns a buffer representation for the object.
|
|
219
|
-
*/
|
|
220
|
-
readBlob(path: string): Promise<ArrayBufferLike>;
|
|
221
|
-
/**
|
|
222
|
-
* Determines if there is an object contained at the given path.
|
|
223
|
-
*/
|
|
224
|
-
contains(path: string): Promise<boolean>;
|
|
225
|
-
/**
|
|
226
|
-
* Lists the blobs that exist at a specific path.
|
|
227
|
-
*/
|
|
228
|
-
list(path: string): Promise<string[]>;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Interface to represent a connection to a delta notification stream.
|
|
233
|
-
* @public
|
|
234
|
-
*/
|
|
235
|
-
export declare interface IDeltaConnection {
|
|
236
|
-
connected: boolean;
|
|
237
|
-
/**
|
|
238
|
-
* Send new messages to the server.
|
|
239
|
-
* @param messageContent - The content of the message to be sent.
|
|
240
|
-
* @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime
|
|
241
|
-
* and not sent to the server. It will be provided back when this message is acknowledged by the server. It will
|
|
242
|
-
* also be provided back when asked to resubmit the message.
|
|
243
|
-
*/
|
|
244
|
-
submit(messageContent: any, localOpMetadata: unknown): void;
|
|
245
|
-
/**
|
|
246
|
-
* Attaches a message handler to the delta connection
|
|
247
|
-
*/
|
|
248
|
-
attach(handler: IDeltaHandler): void;
|
|
249
|
-
/**
|
|
250
|
-
* Indicates that the channel is dirty and needs to be part of the summary. It is called by a SharedSummaryBlock
|
|
251
|
-
* that needs to be part of the summary but does not generate ops.
|
|
252
|
-
*/
|
|
253
|
-
dirty(): void;
|
|
254
|
-
/**
|
|
255
|
-
* @deprecated There is no replacement for this, its functionality is no longer needed at this layer.
|
|
256
|
-
* It will be removed in a future release, sometime after 2.0.0-internal.8.0.0
|
|
257
|
-
*
|
|
258
|
-
* Called when a new outbound reference is added to another node. This is used by garbage collection to identify
|
|
259
|
-
* all references added in the system.
|
|
260
|
-
* @param srcHandle - The handle of the node that added the reference.
|
|
261
|
-
* @param outboundHandle - The handle of the outbound node that is referenced.
|
|
262
|
-
*/
|
|
263
|
-
addedGCOutboundReference?(srcHandle: IFluidHandle, outboundHandle: IFluidHandle): void;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Handler provided by shared data structure to process requests from the runtime.
|
|
268
|
-
* @public
|
|
269
|
-
*/
|
|
270
|
-
export declare interface IDeltaHandler {
|
|
271
|
-
/**
|
|
272
|
-
* Processes the op.
|
|
273
|
-
* @param message - The message to process
|
|
274
|
-
* @param local - Whether the message originated from the local client
|
|
275
|
-
* @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
276
|
-
* For messages from a remote client, this will be undefined.
|
|
277
|
-
*/
|
|
278
|
-
process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => void;
|
|
279
|
-
/**
|
|
280
|
-
* State change events to indicate changes to the delta connection
|
|
281
|
-
* @param connected - true if connected, false otherwise
|
|
282
|
-
*/
|
|
283
|
-
setConnectionState(connected: boolean): void;
|
|
284
|
-
/**
|
|
285
|
-
* Called when the runtime asks the client to resubmit an op. This may be because the Container reconnected and
|
|
286
|
-
* this op was not acked.
|
|
287
|
-
* The client can choose to resubmit the same message, submit different / multiple messages or not submit anything
|
|
288
|
-
* at all.
|
|
289
|
-
* @param message - The original message that was submitted.
|
|
290
|
-
* @param localOpMetadata - The local metadata associated with the original message.
|
|
291
|
-
*/
|
|
292
|
-
reSubmit(message: any, localOpMetadata: unknown): void;
|
|
293
|
-
/**
|
|
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
|
|
296
|
-
* with pending changes. This prepares the SharedObject for seeing an ACK
|
|
297
|
-
* for the op or resubmitting the op upon reconnection.
|
|
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.
|
|
307
|
-
*/
|
|
308
|
-
applyStashedOp(message: any): void;
|
|
309
|
-
/**
|
|
310
|
-
* Revert a local op.
|
|
311
|
-
* @param message - The original message that was submitted.
|
|
312
|
-
* @param localOpMetadata - The local metadata associated with the original message.
|
|
313
|
-
*/
|
|
314
|
-
rollback?(message: any, localOpMetadata: unknown): void;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Represents the runtime for the data store. Contains helper functions/state of the data store.
|
|
319
|
-
* @public
|
|
320
|
-
*/
|
|
321
|
-
export declare interface IFluidDataStoreRuntime extends IEventProvider<IFluidDataStoreRuntimeEvents>, IDisposable {
|
|
322
|
-
readonly id: string;
|
|
323
|
-
readonly IFluidHandleContext: IFluidHandleContext;
|
|
324
|
-
readonly rootRoutingContext: IFluidHandleContext;
|
|
325
|
-
readonly channelsRoutingContext: IFluidHandleContext;
|
|
326
|
-
readonly objectsRoutingContext: IFluidHandleContext;
|
|
327
|
-
readonly options: Record<string | number, any>;
|
|
328
|
-
readonly deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
329
|
-
readonly clientId: string | undefined;
|
|
330
|
-
readonly connected: boolean;
|
|
331
|
-
readonly logger: ITelemetryBaseLogger;
|
|
332
|
-
/**
|
|
333
|
-
* Indicates the attachment state of the data store to a host service.
|
|
334
|
-
*/
|
|
335
|
-
readonly attachState: AttachState;
|
|
336
|
-
readonly idCompressor?: IIdCompressor;
|
|
337
|
-
/**
|
|
338
|
-
* Returns the channel with the given id
|
|
339
|
-
*/
|
|
340
|
-
getChannel(id: string): Promise<IChannel>;
|
|
341
|
-
/**
|
|
342
|
-
* Invokes the given callback and expects that no ops are submitted
|
|
343
|
-
* until execution finishes. If an op is submitted, an error will be raised.
|
|
344
|
-
*
|
|
345
|
-
* Can be disabled by feature gate `Fluid.ContainerRuntime.DisableOpReentryCheck`
|
|
346
|
-
*
|
|
347
|
-
* @param callback - the callback to be invoked
|
|
348
|
-
*/
|
|
349
|
-
ensureNoDataModelChanges<T>(callback: () => T): T;
|
|
350
|
-
/**
|
|
351
|
-
* Creates a new channel of the given type.
|
|
352
|
-
* @param id - ID of the channel to be created. A unique ID will be generated if left undefined.
|
|
353
|
-
* @param type - Type of the channel.
|
|
354
|
-
*/
|
|
355
|
-
createChannel(id: string | undefined, type: string): IChannel;
|
|
356
|
-
/**
|
|
357
|
-
* Bind the channel with the data store runtime. If the runtime
|
|
358
|
-
* is attached then we attach the channel to make it live.
|
|
359
|
-
*/
|
|
360
|
-
bindChannel(channel: IChannel): void;
|
|
361
|
-
/**
|
|
362
|
-
* Api to upload a blob of data.
|
|
363
|
-
* @param blob - blob to be uploaded.
|
|
364
|
-
*/
|
|
365
|
-
uploadBlob(blob: ArrayBufferLike, signal?: AbortSignal): Promise<IFluidHandle<ArrayBufferLike>>;
|
|
366
|
-
/**
|
|
367
|
-
* Submits the signal to be sent to other clients.
|
|
368
|
-
* @param type - Type of the signal.
|
|
369
|
-
* @param content - Content of the signal.
|
|
370
|
-
* @param targetClientId - When specified, the signal is only sent to the provided client id.
|
|
371
|
-
*/
|
|
372
|
-
submitSignal(type: string, content: any, targetClientId?: string): void;
|
|
373
|
-
/**
|
|
374
|
-
* Returns the current quorum.
|
|
375
|
-
*/
|
|
376
|
-
getQuorum(): IQuorumClients;
|
|
377
|
-
/**
|
|
378
|
-
* Returns the current audience.
|
|
379
|
-
*/
|
|
380
|
-
getAudience(): IAudience;
|
|
381
|
-
/**
|
|
382
|
-
* Resolves when a local data store is attached.
|
|
383
|
-
*/
|
|
384
|
-
waitAttached(): Promise<void>;
|
|
385
|
-
/**
|
|
386
|
-
* Exposes a handle to the root object / entryPoint of the data store. Use this as the primary way of interacting
|
|
387
|
-
* with it.
|
|
388
|
-
*/
|
|
389
|
-
readonly entryPoint: IFluidHandle<FluidObject>;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Events emitted by {@link IFluidDataStoreRuntime}.
|
|
394
|
-
* @public
|
|
395
|
-
*/
|
|
396
|
-
export declare interface IFluidDataStoreRuntimeEvents extends IEvent {
|
|
397
|
-
(event: "disconnected" | "dispose" | "attaching" | "attached", listener: () => void): any;
|
|
398
|
-
(event: "op", listener: (message: ISequencedDocumentMessage) => void): any;
|
|
399
|
-
(event: "signal", listener: (message: IInboundSignalMessage, local: boolean) => void): any;
|
|
400
|
-
(event: "connected", listener: (clientId: string) => void): any;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* @remarks
|
|
405
|
-
* This type is a kludge and not intended for general use.
|
|
406
|
-
*
|
|
407
|
-
* @privateRemarks
|
|
408
|
-
* Internal type testing for compatibility uses TypeOnly filter which cannot handle recursive "pure" types.
|
|
409
|
-
* This interface along with ArrayLike above avoids pure type recursion issues, but introduces a limitation on
|
|
410
|
-
* the ability of {@link Jsonable} to detect array-like types that are not handled naively ({@link JSON.stringify}).
|
|
411
|
-
* The TypeOnly filter is not useful for {@link JsonableTypeWith}; so, if type testing improves, this can be removed.
|
|
412
|
-
* @alpha
|
|
413
|
-
*/
|
|
414
|
-
export declare interface Internal_InterfaceOfJsonableTypesWith<T> {
|
|
415
|
-
[index: string | number]: JsonableTypeWith<T>;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Used to constrain a type `T` to types that are serializable as JSON.
|
|
420
|
-
* Produces a compile-time error if `T` contains non-Jsonable members.
|
|
421
|
-
*
|
|
422
|
-
* @remarks
|
|
423
|
-
* Note that this does NOT prevent using of values with non-json compatible data,
|
|
424
|
-
* it only prevents using values with types that include non-json compatible data.
|
|
425
|
-
* This means that one can, for example, pass in a value typed with json compatible
|
|
426
|
-
* interface into this function,
|
|
427
|
-
* that could actually be a class with lots on non-json compatible fields and methods.
|
|
428
|
-
*
|
|
429
|
-
* Important: `T extends Jsonable<T>` is incorrect (does not even compile).
|
|
430
|
-
*
|
|
431
|
-
* The optional 'TReplaced' parameter may be used to permit additional leaf types to support
|
|
432
|
-
* situations where a `replacer` is used to handle special values (e.g., `Jsonable<{ x: IFluidHandle }, IFluidHandle>`).
|
|
433
|
-
*
|
|
434
|
-
* Note that `Jsonable<T>` does not protect against the following pitfalls when serializing with JSON.stringify():
|
|
435
|
-
*
|
|
436
|
-
* - `undefined` properties on objects are omitted (i.e., properties become undefined instead of equal to undefined).
|
|
437
|
-
*
|
|
438
|
-
* - When `undefined` appears as the root object or as an array element it is coerced to `null`.
|
|
439
|
-
*
|
|
440
|
-
* - Non-finite numbers (`NaN`, `+/-Infinity`) are also coerced to `null`.
|
|
441
|
-
*
|
|
442
|
-
* - prototypes and non-enumerable properties are lost.
|
|
443
|
-
*
|
|
444
|
-
* - `ArrayLike` types that are not arrays and are serialized as `{ length: number }`.
|
|
445
|
-
*
|
|
446
|
-
* Also, `Jsonable<T>` does not prevent the construction of circular references.
|
|
447
|
-
*
|
|
448
|
-
* Using `Jsonable<unknown>` or `Jsonable<any>` is a type alias for
|
|
449
|
-
* {@link JsonableTypeWith}`<never>` and should not be used if precise type safety is desired.
|
|
450
|
-
*
|
|
451
|
-
* @example Typical usage
|
|
452
|
-
*
|
|
453
|
-
* ```typescript
|
|
454
|
-
* function foo<T>(value: Jsonable<T>) { ... }
|
|
455
|
-
* ```
|
|
456
|
-
* @alpha
|
|
457
|
-
*/
|
|
458
|
-
export declare type Jsonable<T, TReplaced = never> = boolean extends (T extends never ? true : false) ? JsonableTypeWith<TReplaced> : unknown extends T ? JsonableTypeWith<TReplaced> : T extends undefined | null | boolean | number | string | TReplaced ? T : Extract<T, Function> extends never ? T extends object ? T extends (infer U)[] ? Jsonable<U, TReplaced>[] : {
|
|
459
|
-
[K in keyof T]: Extract<K, symbol> extends never ? Jsonable<T[K], TReplaced> : never;
|
|
460
|
-
} : never : never;
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Type constraint for types that are likely serializable as JSON or have a custom
|
|
464
|
-
* alternate type.
|
|
465
|
-
*
|
|
466
|
-
* @remarks
|
|
467
|
-
* Use `JsonableTypeWith<never>` for just JSON serializable types.
|
|
468
|
-
* See {@link Jsonable} for serialization pitfalls.
|
|
469
|
-
*
|
|
470
|
-
* @privateRemarks
|
|
471
|
-
* Perfer using `Jsonable<unknown>` over this type that is an implementation detail.
|
|
472
|
-
* @alpha
|
|
473
|
-
*/
|
|
474
|
-
export declare type JsonableTypeWith<T> = undefined | null | boolean | number | string | T | Internal_InterfaceOfJsonableTypesWith<T> | ArrayLike<JsonableTypeWith<T>>;
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Used to constrain a type 'T' to types that Fluid can intrinsically serialize. Produces a
|
|
478
|
-
* compile-time error if `T` contains non-serializable members.
|
|
479
|
-
*
|
|
480
|
-
* @remarks
|
|
481
|
-
* See Jsonable for caveats regarding serialization of `undefined`, non-finite numbers,
|
|
482
|
-
* and circular references.
|
|
483
|
-
*
|
|
484
|
-
* Important: `T extends Serializable<T>` is generally incorrect.
|
|
485
|
-
* (Any value of `T` extends the serializable subset of itself.)
|
|
486
|
-
*
|
|
487
|
-
* @example Typical usage
|
|
488
|
-
*
|
|
489
|
-
* ```typescript
|
|
490
|
-
* function serialize<T>(value: Serializable<T>) { ... }
|
|
491
|
-
* ```
|
|
492
|
-
* @alpha
|
|
493
|
-
*/
|
|
494
|
-
export declare type Serializable<T> = Jsonable<T, IFluidHandle>;
|
|
495
|
-
|
|
496
|
-
export { }
|