@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.
Files changed (39) hide show
  1. package/api-report/driver-definitions.api.md +36 -30
  2. package/dist/driver-definitions-alpha.d.ts +77 -99
  3. package/dist/driver-definitions-beta.d.ts +11 -93
  4. package/dist/driver-definitions-public.d.ts +11 -93
  5. package/dist/driver-definitions-untrimmed.d.ts +77 -99
  6. package/dist/driverError.d.ts +9 -97
  7. package/dist/driverError.d.ts.map +1 -1
  8. package/dist/driverError.js +1 -95
  9. package/dist/driverError.js.map +1 -1
  10. package/dist/index.d.ts +2 -2
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -2
  13. package/dist/index.js.map +1 -1
  14. package/dist/storage.d.ts +65 -2
  15. package/dist/storage.d.ts.map +1 -1
  16. package/dist/storage.js.map +1 -1
  17. package/dist/tsdoc-metadata.json +1 -1
  18. package/lib/driver-definitions-alpha.d.mts +77 -99
  19. package/lib/driver-definitions-beta.d.mts +11 -93
  20. package/lib/driver-definitions-public.d.mts +11 -93
  21. package/lib/driver-definitions-untrimmed.d.mts +77 -99
  22. package/lib/driverError.d.mts +9 -97
  23. package/lib/driverError.d.mts.map +1 -1
  24. package/lib/driverError.mjs +0 -94
  25. package/lib/driverError.mjs.map +1 -1
  26. package/lib/index.d.mts +2 -2
  27. package/lib/index.d.mts.map +1 -1
  28. package/lib/index.mjs +1 -1
  29. package/lib/index.mjs.map +1 -1
  30. package/lib/storage.d.mts +65 -2
  31. package/lib/storage.d.mts.map +1 -1
  32. package/lib/storage.mjs.map +1 -1
  33. package/lib/test/types/validateDriverDefinitionsPrevious.generated.mjs +3 -3
  34. package/lib/test/types/validateDriverDefinitionsPrevious.generated.mjs.map +1 -1
  35. package/package.json +14 -6
  36. package/src/driverError.ts +21 -130
  37. package/src/index.ts +3 -1
  38. package/src/storage.ts +74 -1
  39. /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
@@ -5,6 +5,7 @@ import { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
5
5
  import { IDisposable } from '@fluidframework/core-interfaces';
6
6
  import { IDocumentMessage } from '@fluidframework/protocol-definitions';
7
7
  import { IErrorEvent } from '@fluidframework/core-interfaces';
8
+ import { IEvent } from '@fluidframework/core-interfaces';
8
9
  import { IEventProvider } from '@fluidframework/core-interfaces';
9
10
  import { INack } from '@fluidframework/protocol-definitions';
10
11
  import { IRequest } from '@fluidframework/core-interfaces';
@@ -20,97 +21,6 @@ import { IVersion } from '@fluidframework/protocol-definitions';
20
21
 
21
22
  /* Excluded from this release type: DriverError */
22
23
 
23
- /**
24
- * Driver Error types
25
- * Lists types that are likely to be used by all drivers
26
- *
27
- * @deprecated Use {@link (DriverErrorTypes:type)} instead.
28
- * @public
29
- */
30
- export declare enum DriverErrorType {
31
- /**
32
- * A fatal error with no specific interpretation covered by other DriverErrorType values
33
- */
34
- genericError = "genericError",
35
- /**
36
- * Some non-categorized (below) networking error
37
- * Include errors like fatal server error (usually 500).
38
- */
39
- genericNetworkError = "genericNetworkError",
40
- /**
41
- * Access denied - user does not have enough privileges to open a file, or continue to operate on a file
42
- */
43
- authorizationError = "authorizationError",
44
- /**
45
- * File not found, or file deleted during session
46
- */
47
- fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
48
- /**
49
- * Throttling error from server. Server is busy and is asking not to reconnect for some time
50
- */
51
- throttlingError = "throttlingError",
52
- /**
53
- * We can not reach server due to computer being offline.
54
- */
55
- offlineError = "offlineError",
56
- unsupportedClientProtocolVersion = "unsupportedClientProtocolVersion",
57
- /**
58
- * User does not have write permissions to a file, but is changing content of a file.
59
- * That might be indication of some data store error - data stores should not generate ops in readonly mode.
60
- */
61
- writeError = "writeError",
62
- /**
63
- * A generic fetch failure that indicates we were not able to get a response from the server.
64
- * This may be due to the client being offline (though, if we are able to detect offline state it will be
65
- * logged as an offlineError instead). Other possibilities could be DNS errors, malformed fetch request,
66
- * CSP violation, etc.
67
- */
68
- fetchFailure = "fetchFailure",
69
- /**
70
- * This error occurs when token provider fails to fetch orderer token
71
- */
72
- fetchTokenError = "fetchTokenError",
73
- /**
74
- * Unexpected response from server. Either JSON is malformed, or some required properties are missing
75
- */
76
- incorrectServerResponse = "incorrectServerResponse",
77
- /**
78
- * This error occurs when the file is modified externally (not through Fluid protocol) in storage.
79
- * It will occur in cases where client has some state or cache that is based on old content (identity) of a file,
80
- * and storage / driver / loader detects such mismatch.
81
- * When it's hit, client needs to forget all the knowledge about this file and start over.
82
- */
83
- fileOverwrittenInStorage = "fileOverwrittenInStorage",
84
- /**
85
- * The document is read-only and delta stream connection is forbidden.
86
- */
87
- deltaStreamConnectionForbidden = "deltaStreamConnectionForbidden",
88
- /**
89
- * The location of file/container can change on server. So if the file location moves and we try to access the old
90
- * location, then this error is thrown to let the client know about the new location info.
91
- */
92
- locationRedirection = "locationRedirection",
93
- /**
94
- * When a file is not a Fluid file, but has Fluid extension such as ".note",
95
- * server won't be able to open it and will return this error. The innerMostErrorCode will be
96
- * "fluidInvalidSchema"
97
- */
98
- fluidInvalidSchema = "fluidInvalidSchema",
99
- /**
100
- * Error indicating an API is being used improperly resulting in an invalid operation.
101
- * ! Should match the value of ContainerErrorType.usageError
102
- */
103
- usageError = "usageError",
104
- /**
105
- * File is locked for read/write by storage, e.g. whole collection is locked and access denied.
106
- */
107
- fileIsLocked = "fileIsLocked",
108
- /**
109
- * Storage is out of space
110
- */
111
- outOfStorageError = "outOfStorageError"
112
- }
113
-
114
24
  /**
115
25
  * Different error types the Driver may report out to the Host.
116
26
  * @public
@@ -204,11 +114,13 @@ export declare type DriverErrorTypes = (typeof DriverErrorTypes)[keyof typeof Dr
204
114
 
205
115
  /**
206
116
  * Interface describing errors and warnings raised by any driver code.
117
+ *
118
+ * @remarks
207
119
  * Not expected to be implemented by a class or an object literal, but rather used in place of
208
120
  * any or unknown in various function signatures that pass errors around.
209
121
  *
210
122
  * "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
211
- * It will be either DriverErrorType or the specific driver's specialized error type enum,
123
+ * It will be either {@link @fluidframework/driver-definitions#(DriverErrorTypes:variable)} or the specific driver's specialized error type enum,
212
124
  * but we can't reference a specific driver's error type enum in this code.
213
125
  * @public
214
126
  */
@@ -232,6 +144,8 @@ export declare interface IAnyDriverError extends Omit<IDriverErrorBase, "errorTy
232
144
 
233
145
  /* Excluded from this release type: IDocumentService */
234
146
 
147
+ /* Excluded from this release type: IDocumentServiceEvents */
148
+
235
149
  /* Excluded from this release type: IDocumentServiceFactory */
236
150
 
237
151
  /* Excluded from this release type: IDocumentServicePolicies */
@@ -252,7 +166,7 @@ export declare interface IDriverErrorBase {
252
166
  *
253
167
  * @privateRemarks TODO: use {@link DriverErrorTypes} instead (breaking change).
254
168
  */
255
- readonly errorType: DriverErrorType;
169
+ readonly errorType: DriverErrorTypes;
256
170
  /**
257
171
  * Free-form error message
258
172
  */
@@ -280,6 +194,10 @@ export declare interface IDriverErrorBase {
280
194
 
281
195
  /* Excluded from this release type: IResolvedUrl */
282
196
 
197
+ /* Excluded from this release type: ISnapshot */
198
+
199
+ /* Excluded from this release type: ISnapshotFetchOptions */
200
+
283
201
  /* Excluded from this release type: IStream */
284
202
 
285
203
  /* Excluded from this release type: IStreamResult */
@@ -5,6 +5,7 @@ import { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
5
5
  import { IDisposable } from '@fluidframework/core-interfaces';
6
6
  import { IDocumentMessage } from '@fluidframework/protocol-definitions';
7
7
  import { IErrorEvent } from '@fluidframework/core-interfaces';
8
+ import { IEvent } from '@fluidframework/core-interfaces';
8
9
  import { IEventProvider } from '@fluidframework/core-interfaces';
9
10
  import { INack } from '@fluidframework/protocol-definitions';
10
11
  import { IRequest } from '@fluidframework/core-interfaces';
@@ -23,97 +24,6 @@ import { IVersion } from '@fluidframework/protocol-definitions';
23
24
  */
24
25
  export declare type DriverError = IThrottlingWarning | IGenericNetworkError | IAuthorizationError | ILocationRedirectionError | IDriverBasicError;
25
26
 
26
- /**
27
- * Driver Error types
28
- * Lists types that are likely to be used by all drivers
29
- *
30
- * @deprecated Use {@link (DriverErrorTypes:type)} instead.
31
- * @public
32
- */
33
- export declare enum DriverErrorType {
34
- /**
35
- * A fatal error with no specific interpretation covered by other DriverErrorType values
36
- */
37
- genericError = "genericError",
38
- /**
39
- * Some non-categorized (below) networking error
40
- * Include errors like fatal server error (usually 500).
41
- */
42
- genericNetworkError = "genericNetworkError",
43
- /**
44
- * Access denied - user does not have enough privileges to open a file, or continue to operate on a file
45
- */
46
- authorizationError = "authorizationError",
47
- /**
48
- * File not found, or file deleted during session
49
- */
50
- fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
51
- /**
52
- * Throttling error from server. Server is busy and is asking not to reconnect for some time
53
- */
54
- throttlingError = "throttlingError",
55
- /**
56
- * We can not reach server due to computer being offline.
57
- */
58
- offlineError = "offlineError",
59
- unsupportedClientProtocolVersion = "unsupportedClientProtocolVersion",
60
- /**
61
- * User does not have write permissions to a file, but is changing content of a file.
62
- * That might be indication of some data store error - data stores should not generate ops in readonly mode.
63
- */
64
- writeError = "writeError",
65
- /**
66
- * A generic fetch failure that indicates we were not able to get a response from the server.
67
- * This may be due to the client being offline (though, if we are able to detect offline state it will be
68
- * logged as an offlineError instead). Other possibilities could be DNS errors, malformed fetch request,
69
- * CSP violation, etc.
70
- */
71
- fetchFailure = "fetchFailure",
72
- /**
73
- * This error occurs when token provider fails to fetch orderer token
74
- */
75
- fetchTokenError = "fetchTokenError",
76
- /**
77
- * Unexpected response from server. Either JSON is malformed, or some required properties are missing
78
- */
79
- incorrectServerResponse = "incorrectServerResponse",
80
- /**
81
- * This error occurs when the file is modified externally (not through Fluid protocol) in storage.
82
- * It will occur in cases where client has some state or cache that is based on old content (identity) of a file,
83
- * and storage / driver / loader detects such mismatch.
84
- * When it's hit, client needs to forget all the knowledge about this file and start over.
85
- */
86
- fileOverwrittenInStorage = "fileOverwrittenInStorage",
87
- /**
88
- * The document is read-only and delta stream connection is forbidden.
89
- */
90
- deltaStreamConnectionForbidden = "deltaStreamConnectionForbidden",
91
- /**
92
- * The location of file/container can change on server. So if the file location moves and we try to access the old
93
- * location, then this error is thrown to let the client know about the new location info.
94
- */
95
- locationRedirection = "locationRedirection",
96
- /**
97
- * When a file is not a Fluid file, but has Fluid extension such as ".note",
98
- * server won't be able to open it and will return this error. The innerMostErrorCode will be
99
- * "fluidInvalidSchema"
100
- */
101
- fluidInvalidSchema = "fluidInvalidSchema",
102
- /**
103
- * Error indicating an API is being used improperly resulting in an invalid operation.
104
- * ! Should match the value of ContainerErrorType.usageError
105
- */
106
- usageError = "usageError",
107
- /**
108
- * File is locked for read/write by storage, e.g. whole collection is locked and access denied.
109
- */
110
- fileIsLocked = "fileIsLocked",
111
- /**
112
- * Storage is out of space
113
- */
114
- outOfStorageError = "outOfStorageError"
115
- }
116
-
117
27
  /**
118
28
  * Different error types the Driver may report out to the Host.
119
29
  * @public
@@ -238,11 +148,13 @@ export declare type FiveDaysMs = 432000000;
238
148
 
239
149
  /**
240
150
  * Interface describing errors and warnings raised by any driver code.
151
+ *
152
+ * @remarks
241
153
  * Not expected to be implemented by a class or an object literal, but rather used in place of
242
154
  * any or unknown in various function signatures that pass errors around.
243
155
  *
244
156
  * "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
245
- * It will be either DriverErrorType or the specific driver's specialized error type enum,
157
+ * It will be either {@link @fluidframework/driver-definitions#(DriverErrorTypes:variable)} or the specific driver's specialized error type enum,
246
158
  * but we can't reference a specific driver's error type enum in this code.
247
159
  * @public
248
160
  */
@@ -254,7 +166,7 @@ export declare interface IAnyDriverError extends Omit<IDriverErrorBase, "errorTy
254
166
  * @alpha
255
167
  */
256
168
  export declare interface IAuthorizationError extends IDriverErrorBase {
257
- readonly errorType: DriverErrorType.authorizationError;
169
+ readonly errorType: typeof DriverErrorTypes.authorizationError;
258
170
  readonly claims?: string;
259
171
  readonly tenantId?: string;
260
172
  }
@@ -405,7 +317,7 @@ export declare interface IDocumentDeltaStorageService {
405
317
  /**
406
318
  * @alpha
407
319
  */
408
- export declare interface IDocumentService {
320
+ export declare interface IDocumentService extends IEventProvider<IDocumentServiceEvents> {
409
321
  resolvedUrl: IResolvedUrl;
410
322
  /**
411
323
  * Policies implemented/instructed by driver.
@@ -436,6 +348,18 @@ export declare interface IDocumentService {
436
348
  dispose(error?: any): void;
437
349
  }
438
350
 
351
+ /**
352
+ * Events emitted by {@link IDocumentService}.
353
+ * @alpha
354
+ */
355
+ export declare interface IDocumentServiceEvents extends IEvent {
356
+ /**
357
+ * This event is used to communicate any metadata related to the container. We might have received metadata from the service.
358
+ * Read more info on this event from here `IContainer.containerMetadata`.
359
+ */
360
+ (event: "metadataUpdate", listener: (metadata: Record<string, string>) => void): any;
361
+ }
362
+
439
363
  /**
440
364
  * @alpha
441
365
  */
@@ -478,6 +402,12 @@ export declare interface IDocumentServicePolicies {
478
402
  * Summarizer uploads the protocol tree too when summarizing.
479
403
  */
480
404
  readonly summarizeProtocolTree?: boolean;
405
+ /**
406
+ * Whether the driver supports the new getSnapshot api which returns snapshot which
407
+ * contains all contents along with the snapshot tree. Enable this by default when the
408
+ * driver can fully support the api.
409
+ */
410
+ readonly supportGetSnapshotApi?: boolean;
481
411
  }
482
412
 
483
413
  /**
@@ -497,6 +427,13 @@ export declare interface IDocumentStorageService extends Partial<IDisposable> {
497
427
  * in debugging purposes to see why this call was made.
498
428
  */
499
429
  getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
430
+ /**
431
+ * Returns the snapshot which can contain other artifacts too like blob contents, ops etc. It is different from
432
+ * `getSnapshotTree` api in that, that API only returns the snapshot tree from the snapshot.
433
+ * @param snapshotFetchOptions - Options specified by the caller to specify and want certain behavior from the
434
+ * driver when fetching the snapshot.
435
+ */
436
+ getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
500
437
  /**
501
438
  * Retrieves all versions of the document starting at the specified versionId - or null if from the head
502
439
  * @param versionId - Version id of the requested version.
@@ -558,7 +495,7 @@ export declare interface IDocumentStorageServicePolicies {
558
495
  * @alpha
559
496
  */
560
497
  export declare interface IDriverBasicError extends IDriverErrorBase {
561
- readonly errorType: DriverErrorType.genericError | DriverErrorType.fileNotFoundOrAccessDeniedError | DriverErrorType.offlineError | DriverErrorType.unsupportedClientProtocolVersion | DriverErrorType.writeError | DriverErrorType.fetchFailure | DriverErrorType.fetchTokenError | DriverErrorType.incorrectServerResponse | DriverErrorType.fileOverwrittenInStorage | DriverErrorType.fluidInvalidSchema | DriverErrorType.usageError | DriverErrorType.fileIsLocked | DriverErrorType.outOfStorageError;
498
+ readonly errorType: typeof DriverErrorTypes.genericError | typeof DriverErrorTypes.fileNotFoundOrAccessDeniedError | typeof DriverErrorTypes.offlineError | typeof DriverErrorTypes.unsupportedClientProtocolVersion | typeof DriverErrorTypes.writeError | typeof DriverErrorTypes.fetchFailure | typeof DriverErrorTypes.fetchTokenError | typeof DriverErrorTypes.incorrectServerResponse | typeof DriverErrorTypes.fileOverwrittenInStorage | typeof DriverErrorTypes.fluidInvalidSchema | typeof DriverErrorTypes.usageError | typeof DriverErrorTypes.fileIsLocked | typeof DriverErrorTypes.outOfStorageError;
562
499
  readonly statusCode?: number;
563
500
  }
564
501
 
@@ -572,7 +509,7 @@ export declare interface IDriverErrorBase {
572
509
  *
573
510
  * @privateRemarks TODO: use {@link DriverErrorTypes} instead (breaking change).
574
511
  */
575
- readonly errorType: DriverErrorType;
512
+ readonly errorType: DriverErrorTypes;
576
513
  /**
577
514
  * Free-form error message
578
515
  */
@@ -604,7 +541,7 @@ export declare interface IDriverHeader {
604
541
  * @alpha
605
542
  */
606
543
  export declare interface IGenericNetworkError extends IDriverErrorBase {
607
- readonly errorType: DriverErrorType.genericNetworkError;
544
+ readonly errorType: typeof DriverErrorTypes.genericNetworkError;
608
545
  readonly statusCode?: number;
609
546
  }
610
547
 
@@ -612,7 +549,7 @@ export declare interface IGenericNetworkError extends IDriverErrorBase {
612
549
  * @alpha
613
550
  */
614
551
  export declare interface ILocationRedirectionError extends IDriverErrorBase {
615
- readonly errorType: DriverErrorType.locationRedirection;
552
+ readonly errorType: typeof DriverErrorTypes.locationRedirection;
616
553
  readonly redirectUrl: IResolvedUrl;
617
554
  }
618
555
 
@@ -634,6 +571,47 @@ export declare interface IResolvedUrl {
634
571
  };
635
572
  }
636
573
 
574
+ /**
575
+ * @alpha
576
+ */
577
+ export declare interface ISnapshot {
578
+ snapshotTree: ISnapshotTree;
579
+ blobContents: Map<string, ArrayBuffer>;
580
+ ops: ISequencedDocumentMessage[];
581
+ /**
582
+ * Sequence number of the snapshot
583
+ */
584
+ sequenceNumber: number | undefined;
585
+ /**
586
+ * Sequence number for the latest op/snapshot for the file in ODSP
587
+ */
588
+ latestSequenceNumber: number | undefined;
589
+ snapshotFormatV: 1;
590
+ }
591
+
592
+ /**
593
+ * Snapshot fetch options which are used to communicate different things to the driver
594
+ * when fetching the snapshot.
595
+ * @alpha
596
+ */
597
+ export declare interface ISnapshotFetchOptions {
598
+ /**
599
+ * Indicates scenario in which the snapshot is fetched. It is a free form string mostly
600
+ * used for telemetry purposes.
601
+ */
602
+ scenarioName?: string;
603
+ /**
604
+ * Tell driver to cache the fetched snapshot. Driver is supposed to cache the fetched snapshot if this is
605
+ * set to true. If undefined, then it is upto the driver, to cache it or not.
606
+ */
607
+ cacheSnapshot?: boolean;
608
+ /**
609
+ * Version of the snapshot to be fetched. Certain storage services just keep 1 snapshot for the
610
+ * container, so specifying version is not necessary for storage services.
611
+ */
612
+ versionId?: string;
613
+ }
614
+
637
615
  /**
638
616
  * Read interface for the Queue
639
617
  * @alpha
@@ -673,7 +651,7 @@ export declare interface ISummaryContext {
673
651
  * @alpha
674
652
  */
675
653
  export declare interface IThrottlingWarning extends IDriverErrorBase {
676
- readonly errorType: DriverErrorType.throttlingError;
654
+ readonly errorType: typeof DriverErrorTypes.throttlingError;
677
655
  readonly retryAfterSeconds: number;
678
656
  }
679
657
 
@@ -84,103 +84,15 @@ export declare const DriverErrorTypes: {
84
84
  * @public
85
85
  */
86
86
  export type DriverErrorTypes = (typeof DriverErrorTypes)[keyof typeof DriverErrorTypes];
87
- /**
88
- * Driver Error types
89
- * Lists types that are likely to be used by all drivers
90
- *
91
- * @deprecated Use {@link (DriverErrorTypes:type)} instead.
92
- * @public
93
- */
94
- export declare enum DriverErrorType {
95
- /**
96
- * A fatal error with no specific interpretation covered by other DriverErrorType values
97
- */
98
- genericError = "genericError",
99
- /**
100
- * Some non-categorized (below) networking error
101
- * Include errors like fatal server error (usually 500).
102
- */
103
- genericNetworkError = "genericNetworkError",
104
- /**
105
- * Access denied - user does not have enough privileges to open a file, or continue to operate on a file
106
- */
107
- authorizationError = "authorizationError",
108
- /**
109
- * File not found, or file deleted during session
110
- */
111
- fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
112
- /**
113
- * Throttling error from server. Server is busy and is asking not to reconnect for some time
114
- */
115
- throttlingError = "throttlingError",
116
- /**
117
- * We can not reach server due to computer being offline.
118
- */
119
- offlineError = "offlineError",
120
- unsupportedClientProtocolVersion = "unsupportedClientProtocolVersion",
121
- /**
122
- * User does not have write permissions to a file, but is changing content of a file.
123
- * That might be indication of some data store error - data stores should not generate ops in readonly mode.
124
- */
125
- writeError = "writeError",
126
- /**
127
- * A generic fetch failure that indicates we were not able to get a response from the server.
128
- * This may be due to the client being offline (though, if we are able to detect offline state it will be
129
- * logged as an offlineError instead). Other possibilities could be DNS errors, malformed fetch request,
130
- * CSP violation, etc.
131
- */
132
- fetchFailure = "fetchFailure",
133
- /**
134
- * This error occurs when token provider fails to fetch orderer token
135
- */
136
- fetchTokenError = "fetchTokenError",
137
- /**
138
- * Unexpected response from server. Either JSON is malformed, or some required properties are missing
139
- */
140
- incorrectServerResponse = "incorrectServerResponse",
141
- /**
142
- * This error occurs when the file is modified externally (not through Fluid protocol) in storage.
143
- * It will occur in cases where client has some state or cache that is based on old content (identity) of a file,
144
- * and storage / driver / loader detects such mismatch.
145
- * When it's hit, client needs to forget all the knowledge about this file and start over.
146
- */
147
- fileOverwrittenInStorage = "fileOverwrittenInStorage",
148
- /**
149
- * The document is read-only and delta stream connection is forbidden.
150
- */
151
- deltaStreamConnectionForbidden = "deltaStreamConnectionForbidden",
152
- /**
153
- * The location of file/container can change on server. So if the file location moves and we try to access the old
154
- * location, then this error is thrown to let the client know about the new location info.
155
- */
156
- locationRedirection = "locationRedirection",
157
- /**
158
- * When a file is not a Fluid file, but has Fluid extension such as ".note",
159
- * server won't be able to open it and will return this error. The innerMostErrorCode will be
160
- * "fluidInvalidSchema"
161
- */
162
- fluidInvalidSchema = "fluidInvalidSchema",
163
- /**
164
- * Error indicating an API is being used improperly resulting in an invalid operation.
165
- * ! Should match the value of ContainerErrorType.usageError
166
- */
167
- usageError = "usageError",
168
- /**
169
- * File is locked for read/write by storage, e.g. whole collection is locked and access denied.
170
- */
171
- fileIsLocked = "fileIsLocked",
172
- /**
173
- * Storage is out of space
174
- */
175
- outOfStorageError = "outOfStorageError"
176
- }
177
87
  /**
178
88
  * Interface describing errors and warnings raised by any driver code.
89
+ *
90
+ * @remarks
179
91
  * Not expected to be implemented by a class or an object literal, but rather used in place of
180
92
  * any or unknown in various function signatures that pass errors around.
181
93
  *
182
94
  * "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
183
- * It will be either DriverErrorType or the specific driver's specialized error type enum,
95
+ * It will be either {@link @fluidframework/driver-definitions#(DriverErrorTypes:variable)} or the specific driver's specialized error type enum,
184
96
  * but we can't reference a specific driver's error type enum in this code.
185
97
  * @public
186
98
  */
@@ -197,7 +109,7 @@ export interface IDriverErrorBase {
197
109
  *
198
110
  * @privateRemarks TODO: use {@link DriverErrorTypes} instead (breaking change).
199
111
  */
200
- readonly errorType: DriverErrorType;
112
+ readonly errorType: DriverErrorTypes;
201
113
  /**
202
114
  * Free-form error message
203
115
  */
@@ -220,21 +132,21 @@ export interface IDriverErrorBase {
220
132
  * @alpha
221
133
  */
222
134
  export interface IThrottlingWarning extends IDriverErrorBase {
223
- readonly errorType: DriverErrorType.throttlingError;
135
+ readonly errorType: typeof DriverErrorTypes.throttlingError;
224
136
  readonly retryAfterSeconds: number;
225
137
  }
226
138
  /**
227
139
  * @alpha
228
140
  */
229
141
  export interface IGenericNetworkError extends IDriverErrorBase {
230
- readonly errorType: DriverErrorType.genericNetworkError;
142
+ readonly errorType: typeof DriverErrorTypes.genericNetworkError;
231
143
  readonly statusCode?: number;
232
144
  }
233
145
  /**
234
146
  * @alpha
235
147
  */
236
148
  export interface IAuthorizationError extends IDriverErrorBase {
237
- readonly errorType: DriverErrorType.authorizationError;
149
+ readonly errorType: typeof DriverErrorTypes.authorizationError;
238
150
  readonly claims?: string;
239
151
  readonly tenantId?: string;
240
152
  }
@@ -242,7 +154,7 @@ export interface IAuthorizationError extends IDriverErrorBase {
242
154
  * @alpha
243
155
  */
244
156
  export interface ILocationRedirectionError extends IDriverErrorBase {
245
- readonly errorType: DriverErrorType.locationRedirection;
157
+ readonly errorType: typeof DriverErrorTypes.locationRedirection;
246
158
  readonly redirectUrl: IResolvedUrl;
247
159
  }
248
160
  /**
@@ -251,7 +163,7 @@ export interface ILocationRedirectionError extends IDriverErrorBase {
251
163
  * @alpha
252
164
  */
253
165
  export interface IDriverBasicError extends IDriverErrorBase {
254
- readonly errorType: DriverErrorType.genericError | DriverErrorType.fileNotFoundOrAccessDeniedError | DriverErrorType.offlineError | DriverErrorType.unsupportedClientProtocolVersion | DriverErrorType.writeError | DriverErrorType.fetchFailure | DriverErrorType.fetchTokenError | DriverErrorType.incorrectServerResponse | DriverErrorType.fileOverwrittenInStorage | DriverErrorType.fluidInvalidSchema | DriverErrorType.usageError | DriverErrorType.fileIsLocked | DriverErrorType.outOfStorageError;
166
+ readonly errorType: typeof DriverErrorTypes.genericError | typeof DriverErrorTypes.fileNotFoundOrAccessDeniedError | typeof DriverErrorTypes.offlineError | typeof DriverErrorTypes.unsupportedClientProtocolVersion | typeof DriverErrorTypes.writeError | typeof DriverErrorTypes.fetchFailure | typeof DriverErrorTypes.fetchTokenError | typeof DriverErrorTypes.incorrectServerResponse | typeof DriverErrorTypes.fileOverwrittenInStorage | typeof DriverErrorTypes.fluidInvalidSchema | typeof DriverErrorTypes.usageError | typeof DriverErrorTypes.fileIsLocked | typeof DriverErrorTypes.outOfStorageError;
255
167
  readonly statusCode?: number;
256
168
  }
257
169
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"driverError.d.ts","sourceRoot":"","sources":["../src/driverError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM7C;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAI5B;;;OAGG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;;IAQH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;;;;OAKG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAGH;;;;OAIG;;IAGH;;OAEG;;IAGH;;OAEG;;;;;CAEM,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAExF;;;;;;GAMG;AACH,oBAAY,eAAe;IAC1B;;OAEG;IACH,YAAY,iBAAiB;IAE7B;;;OAGG;IACH,mBAAmB,wBAAwB;IAE3C;;OAEG;IACH,kBAAkB,uBAAuB;IAEzC;;OAEG;IACH,+BAA+B,oCAAoC;IAEnE;;OAEG;IACH,eAAe,oBAAoB;IAEnC;;OAEG;IACH,YAAY,iBAAiB;IAK7B,gCAAgC,qCAAqC;IAErE;;;OAGG;IACH,UAAU,eAAe;IAEzB;;;;;OAKG;IACH,YAAY,iBAAiB;IAE7B;;OAEG;IACH,eAAe,oBAA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