@fluidframework/driver-definitions 2.0.0-dev-rc.1.0.0.228517 → 2.0.0-dev-rc.1.0.0.232845
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/api-report/driver-definitions.api.md +36 -30
- package/dist/driver-definitions-alpha.d.ts +77 -99
- package/dist/driver-definitions-beta.d.ts +11 -93
- package/dist/driver-definitions-public.d.ts +11 -93
- package/dist/driver-definitions-untrimmed.d.ts +77 -99
- package/dist/driverError.d.ts +9 -97
- package/dist/driverError.d.ts.map +1 -1
- package/dist/driverError.js +1 -95
- package/dist/driverError.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/storage.d.ts +65 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/driver-definitions-alpha.d.mts +77 -99
- package/lib/driver-definitions-beta.d.mts +11 -93
- package/lib/driver-definitions-public.d.mts +11 -93
- package/lib/driver-definitions-untrimmed.d.mts +77 -99
- package/lib/driverError.d.mts +9 -97
- package/lib/driverError.d.mts.map +1 -1
- package/lib/driverError.mjs +0 -94
- package/lib/driverError.mjs.map +1 -1
- package/lib/index.d.mts +2 -2
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/storage.d.mts +65 -2
- package/lib/storage.d.mts.map +1 -1
- package/lib/storage.mjs.map +1 -1
- package/lib/test/types/validateDriverDefinitionsPrevious.generated.mjs +3 -3
- package/lib/test/types/validateDriverDefinitionsPrevious.generated.mjs.map +1 -1
- package/package.json +14 -6
- package/src/driverError.ts +21 -130
- package/src/index.ts +3 -1
- package/src/storage.ts +74 -1
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/src/driverError.ts
CHANGED
|
@@ -110,124 +110,15 @@ export const DriverErrorTypes = {
|
|
|
110
110
|
*/
|
|
111
111
|
export type DriverErrorTypes = (typeof DriverErrorTypes)[keyof typeof DriverErrorTypes];
|
|
112
112
|
|
|
113
|
-
/**
|
|
114
|
-
* Driver Error types
|
|
115
|
-
* Lists types that are likely to be used by all drivers
|
|
116
|
-
*
|
|
117
|
-
* @deprecated Use {@link (DriverErrorTypes:type)} instead.
|
|
118
|
-
* @public
|
|
119
|
-
*/
|
|
120
|
-
export enum DriverErrorType {
|
|
121
|
-
/**
|
|
122
|
-
* A fatal error with no specific interpretation covered by other DriverErrorType values
|
|
123
|
-
*/
|
|
124
|
-
genericError = "genericError",
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Some non-categorized (below) networking error
|
|
128
|
-
* Include errors like fatal server error (usually 500).
|
|
129
|
-
*/
|
|
130
|
-
genericNetworkError = "genericNetworkError",
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Access denied - user does not have enough privileges to open a file, or continue to operate on a file
|
|
134
|
-
*/
|
|
135
|
-
authorizationError = "authorizationError",
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* File not found, or file deleted during session
|
|
139
|
-
*/
|
|
140
|
-
fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Throttling error from server. Server is busy and is asking not to reconnect for some time
|
|
144
|
-
*/
|
|
145
|
-
throttlingError = "throttlingError",
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* We can not reach server due to computer being offline.
|
|
149
|
-
*/
|
|
150
|
-
offlineError = "offlineError",
|
|
151
|
-
|
|
152
|
-
/*
|
|
153
|
-
* Unsupported client protocol
|
|
154
|
-
*/
|
|
155
|
-
unsupportedClientProtocolVersion = "unsupportedClientProtocolVersion",
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* User does not have write permissions to a file, but is changing content of a file.
|
|
159
|
-
* That might be indication of some data store error - data stores should not generate ops in readonly mode.
|
|
160
|
-
*/
|
|
161
|
-
writeError = "writeError",
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* A generic fetch failure that indicates we were not able to get a response from the server.
|
|
165
|
-
* This may be due to the client being offline (though, if we are able to detect offline state it will be
|
|
166
|
-
* logged as an offlineError instead). Other possibilities could be DNS errors, malformed fetch request,
|
|
167
|
-
* CSP violation, etc.
|
|
168
|
-
*/
|
|
169
|
-
fetchFailure = "fetchFailure",
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* This error occurs when token provider fails to fetch orderer token
|
|
173
|
-
*/
|
|
174
|
-
fetchTokenError = "fetchTokenError",
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Unexpected response from server. Either JSON is malformed, or some required properties are missing
|
|
178
|
-
*/
|
|
179
|
-
incorrectServerResponse = "incorrectServerResponse",
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* This error occurs when the file is modified externally (not through Fluid protocol) in storage.
|
|
183
|
-
* It will occur in cases where client has some state or cache that is based on old content (identity) of a file,
|
|
184
|
-
* and storage / driver / loader detects such mismatch.
|
|
185
|
-
* When it's hit, client needs to forget all the knowledge about this file and start over.
|
|
186
|
-
*/
|
|
187
|
-
fileOverwrittenInStorage = "fileOverwrittenInStorage",
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* The document is read-only and delta stream connection is forbidden.
|
|
191
|
-
*/
|
|
192
|
-
deltaStreamConnectionForbidden = "deltaStreamConnectionForbidden",
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* The location of file/container can change on server. So if the file location moves and we try to access the old
|
|
196
|
-
* location, then this error is thrown to let the client know about the new location info.
|
|
197
|
-
*/
|
|
198
|
-
locationRedirection = "locationRedirection",
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* When a file is not a Fluid file, but has Fluid extension such as ".note",
|
|
202
|
-
* server won't be able to open it and will return this error. The innerMostErrorCode will be
|
|
203
|
-
* "fluidInvalidSchema"
|
|
204
|
-
*/
|
|
205
|
-
fluidInvalidSchema = "fluidInvalidSchema",
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
209
|
-
* ! Should match the value of ContainerErrorType.usageError
|
|
210
|
-
*/
|
|
211
|
-
usageError = "usageError",
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* File is locked for read/write by storage, e.g. whole collection is locked and access denied.
|
|
215
|
-
*/
|
|
216
|
-
fileIsLocked = "fileIsLocked",
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Storage is out of space
|
|
220
|
-
*/
|
|
221
|
-
outOfStorageError = "outOfStorageError",
|
|
222
|
-
}
|
|
223
|
-
|
|
224
113
|
/**
|
|
225
114
|
* Interface describing errors and warnings raised by any driver code.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
226
117
|
* Not expected to be implemented by a class or an object literal, but rather used in place of
|
|
227
118
|
* any or unknown in various function signatures that pass errors around.
|
|
228
119
|
*
|
|
229
120
|
* "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
|
|
230
|
-
* It will be either
|
|
121
|
+
* It will be either {@link @fluidframework/driver-definitions#(DriverErrorTypes:variable)} or the specific driver's specialized error type enum,
|
|
231
122
|
* but we can't reference a specific driver's error type enum in this code.
|
|
232
123
|
* @public
|
|
233
124
|
*/
|
|
@@ -245,7 +136,7 @@ export interface IDriverErrorBase {
|
|
|
245
136
|
*
|
|
246
137
|
* @privateRemarks TODO: use {@link DriverErrorTypes} instead (breaking change).
|
|
247
138
|
*/
|
|
248
|
-
readonly errorType:
|
|
139
|
+
readonly errorType: DriverErrorTypes;
|
|
249
140
|
|
|
250
141
|
/**
|
|
251
142
|
* Free-form error message
|
|
@@ -273,7 +164,7 @@ export interface IDriverErrorBase {
|
|
|
273
164
|
* @alpha
|
|
274
165
|
*/
|
|
275
166
|
export interface IThrottlingWarning extends IDriverErrorBase {
|
|
276
|
-
readonly errorType:
|
|
167
|
+
readonly errorType: typeof DriverErrorTypes.throttlingError;
|
|
277
168
|
readonly retryAfterSeconds: number;
|
|
278
169
|
}
|
|
279
170
|
|
|
@@ -281,7 +172,7 @@ export interface IThrottlingWarning extends IDriverErrorBase {
|
|
|
281
172
|
* @alpha
|
|
282
173
|
*/
|
|
283
174
|
export interface IGenericNetworkError extends IDriverErrorBase {
|
|
284
|
-
readonly errorType:
|
|
175
|
+
readonly errorType: typeof DriverErrorTypes.genericNetworkError;
|
|
285
176
|
readonly statusCode?: number;
|
|
286
177
|
}
|
|
287
178
|
|
|
@@ -289,7 +180,7 @@ export interface IGenericNetworkError extends IDriverErrorBase {
|
|
|
289
180
|
* @alpha
|
|
290
181
|
*/
|
|
291
182
|
export interface IAuthorizationError extends IDriverErrorBase {
|
|
292
|
-
readonly errorType:
|
|
183
|
+
readonly errorType: typeof DriverErrorTypes.authorizationError;
|
|
293
184
|
readonly claims?: string;
|
|
294
185
|
readonly tenantId?: string;
|
|
295
186
|
}
|
|
@@ -298,7 +189,7 @@ export interface IAuthorizationError extends IDriverErrorBase {
|
|
|
298
189
|
* @alpha
|
|
299
190
|
*/
|
|
300
191
|
export interface ILocationRedirectionError extends IDriverErrorBase {
|
|
301
|
-
readonly errorType:
|
|
192
|
+
readonly errorType: typeof DriverErrorTypes.locationRedirection;
|
|
302
193
|
readonly redirectUrl: IResolvedUrl;
|
|
303
194
|
}
|
|
304
195
|
|
|
@@ -309,19 +200,19 @@ export interface ILocationRedirectionError extends IDriverErrorBase {
|
|
|
309
200
|
*/
|
|
310
201
|
export interface IDriverBasicError extends IDriverErrorBase {
|
|
311
202
|
readonly errorType:
|
|
312
|
-
|
|
|
313
|
-
|
|
|
314
|
-
|
|
|
315
|
-
|
|
|
316
|
-
|
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
|
|
|
320
|
-
|
|
|
321
|
-
|
|
|
322
|
-
|
|
|
323
|
-
|
|
|
324
|
-
|
|
|
203
|
+
| typeof DriverErrorTypes.genericError
|
|
204
|
+
| typeof DriverErrorTypes.fileNotFoundOrAccessDeniedError
|
|
205
|
+
| typeof DriverErrorTypes.offlineError
|
|
206
|
+
| typeof DriverErrorTypes.unsupportedClientProtocolVersion
|
|
207
|
+
| typeof DriverErrorTypes.writeError
|
|
208
|
+
| typeof DriverErrorTypes.fetchFailure
|
|
209
|
+
| typeof DriverErrorTypes.fetchTokenError
|
|
210
|
+
| typeof DriverErrorTypes.incorrectServerResponse
|
|
211
|
+
| typeof DriverErrorTypes.fileOverwrittenInStorage
|
|
212
|
+
| typeof DriverErrorTypes.fluidInvalidSchema
|
|
213
|
+
| typeof DriverErrorTypes.usageError
|
|
214
|
+
| typeof DriverErrorTypes.fileIsLocked
|
|
215
|
+
| typeof DriverErrorTypes.outOfStorageError;
|
|
325
216
|
readonly statusCode?: number;
|
|
326
217
|
}
|
|
327
218
|
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
export {
|
|
7
7
|
DriverError,
|
|
8
|
-
DriverErrorType,
|
|
9
8
|
DriverErrorTypes,
|
|
10
9
|
IAnyDriverError,
|
|
11
10
|
IAuthorizationError,
|
|
@@ -24,10 +23,13 @@ export {
|
|
|
24
23
|
IDocumentDeltaConnectionEvents,
|
|
25
24
|
IDocumentDeltaStorageService,
|
|
26
25
|
IDocumentService,
|
|
26
|
+
IDocumentServiceEvents,
|
|
27
27
|
IDocumentServiceFactory,
|
|
28
28
|
IDocumentServicePolicies,
|
|
29
29
|
IDocumentStorageService,
|
|
30
30
|
IDocumentStorageServicePolicies,
|
|
31
|
+
ISnapshot,
|
|
32
|
+
ISnapshotFetchOptions,
|
|
31
33
|
IStream,
|
|
32
34
|
IStreamResult,
|
|
33
35
|
ISummaryContext,
|
package/src/storage.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
IEventProvider,
|
|
9
9
|
IErrorEvent,
|
|
10
10
|
ITelemetryBaseLogger,
|
|
11
|
+
IEvent,
|
|
11
12
|
} from "@fluidframework/core-interfaces";
|
|
12
13
|
import {
|
|
13
14
|
ConnectionMode,
|
|
@@ -160,6 +161,14 @@ export interface IDocumentStorageService extends Partial<IDisposable> {
|
|
|
160
161
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
161
162
|
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
|
|
162
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Returns the snapshot which can contain other artifacts too like blob contents, ops etc. It is different from
|
|
166
|
+
* `getSnapshotTree` api in that, that API only returns the snapshot tree from the snapshot.
|
|
167
|
+
* @param snapshotFetchOptions - Options specified by the caller to specify and want certain behavior from the
|
|
168
|
+
* driver when fetching the snapshot.
|
|
169
|
+
*/
|
|
170
|
+
getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
|
|
171
|
+
|
|
163
172
|
/**
|
|
164
173
|
* Retrieves all versions of the document starting at the specified versionId - or null if from the head
|
|
165
174
|
* @param versionId - Version id of the requested version.
|
|
@@ -205,6 +214,18 @@ export interface IDocumentStorageService extends Partial<IDisposable> {
|
|
|
205
214
|
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
206
215
|
}
|
|
207
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Events emitted by {@link IDocumentService}.
|
|
219
|
+
* @alpha
|
|
220
|
+
*/
|
|
221
|
+
export interface IDocumentServiceEvents extends IEvent {
|
|
222
|
+
/**
|
|
223
|
+
* This event is used to communicate any metadata related to the container. We might have received metadata from the service.
|
|
224
|
+
* Read more info on this event from here `IContainer.containerMetadata`.
|
|
225
|
+
*/
|
|
226
|
+
(event: "metadataUpdate", listener: (metadata: Record<string, string>) => void);
|
|
227
|
+
}
|
|
228
|
+
|
|
208
229
|
/**
|
|
209
230
|
* @alpha
|
|
210
231
|
*/
|
|
@@ -328,12 +349,19 @@ export interface IDocumentServicePolicies {
|
|
|
328
349
|
* Summarizer uploads the protocol tree too when summarizing.
|
|
329
350
|
*/
|
|
330
351
|
readonly summarizeProtocolTree?: boolean;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Whether the driver supports the new getSnapshot api which returns snapshot which
|
|
355
|
+
* contains all contents along with the snapshot tree. Enable this by default when the
|
|
356
|
+
* driver can fully support the api.
|
|
357
|
+
*/
|
|
358
|
+
readonly supportGetSnapshotApi?: boolean;
|
|
331
359
|
}
|
|
332
360
|
|
|
333
361
|
/**
|
|
334
362
|
* @alpha
|
|
335
363
|
*/
|
|
336
|
-
export interface IDocumentService {
|
|
364
|
+
export interface IDocumentService extends IEventProvider<IDocumentServiceEvents> {
|
|
337
365
|
resolvedUrl: IResolvedUrl;
|
|
338
366
|
|
|
339
367
|
/**
|
|
@@ -437,3 +465,48 @@ export enum FetchSource {
|
|
|
437
465
|
default = "default",
|
|
438
466
|
noCache = "noCache",
|
|
439
467
|
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* @alpha
|
|
471
|
+
*/
|
|
472
|
+
export interface ISnapshot {
|
|
473
|
+
snapshotTree: ISnapshotTree;
|
|
474
|
+
blobContents: Map<string, ArrayBuffer>;
|
|
475
|
+
ops: ISequencedDocumentMessage[];
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Sequence number of the snapshot
|
|
479
|
+
*/
|
|
480
|
+
sequenceNumber: number | undefined;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Sequence number for the latest op/snapshot for the file in ODSP
|
|
484
|
+
*/
|
|
485
|
+
latestSequenceNumber: number | undefined;
|
|
486
|
+
|
|
487
|
+
snapshotFormatV: 1;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Snapshot fetch options which are used to communicate different things to the driver
|
|
492
|
+
* when fetching the snapshot.
|
|
493
|
+
* @alpha
|
|
494
|
+
*/
|
|
495
|
+
export interface ISnapshotFetchOptions {
|
|
496
|
+
/**
|
|
497
|
+
* Indicates scenario in which the snapshot is fetched. It is a free form string mostly
|
|
498
|
+
* used for telemetry purposes.
|
|
499
|
+
*/
|
|
500
|
+
scenarioName?: string;
|
|
501
|
+
/**
|
|
502
|
+
* Tell driver to cache the fetched snapshot. Driver is supposed to cache the fetched snapshot if this is
|
|
503
|
+
* set to true. If undefined, then it is upto the driver, to cache it or not.
|
|
504
|
+
*/
|
|
505
|
+
cacheSnapshot?: boolean;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Version of the snapshot to be fetched. Certain storage services just keep 1 snapshot for the
|
|
509
|
+
* container, so specifying version is not necessary for storage services.
|
|
510
|
+
*/
|
|
511
|
+
versionId?: string;
|
|
512
|
+
}
|
|
File without changes
|