@fluidframework/driver-definitions 2.0.0-dev.2.3.0.115467 → 2.0.0-dev.4.1.0.148229

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.
@@ -10,91 +10,102 @@ import { IResolvedUrl } from "./urlResolver";
10
10
  * Lists types that are likely to be used by all drivers
11
11
  */
12
12
  export enum DriverErrorType {
13
- /**
14
- * A fatal error with no specific interpretation covered by other DriverErrorType values
15
- */
16
- genericError = "genericError",
17
-
18
- /**
19
- * Some non-categorized (below) networking error
20
- * Include errors like fatal server error (usually 500).
21
- */
22
- genericNetworkError = "genericNetworkError",
23
-
24
- /**
25
- * Access denied - user does not have enough privileges to open a file, or continue to operate on a file
26
- */
27
- authorizationError = "authorizationError",
28
-
29
- /**
30
- * File not found, or file deleted during session
31
- */
32
- fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
33
-
34
- /**
35
- * Throttling error from server. Server is busy and is asking not to reconnect for some time
36
- */
37
- throttlingError = "throttlingError",
38
-
39
- /**
40
- * We can not reach server due to computer being offline.
41
- */
42
- offlineError = "offlineError",
43
-
44
- /*
45
- * Unsupported client protocol
46
- */
47
- unsupportedClientProtocolVersion = "unsupportedClientProtocolVersion",
48
-
49
- /**
50
- * User does not have write permissions to a file, but is changing content of a file.
51
- * That might be indication of some data store error - data stores should not generate ops in readonly mode.
52
- */
53
- writeError = "writeError",
54
-
55
- /**
56
- * A generic fetch failure that indicates we were not able to get a response from the server.
57
- * This may be due to the client being offline (though, if we are able to detect offline state it will be
58
- * logged as an offlineError instead). Other possibilities could be DNS errors, malformed fetch request,
59
- * CSP violation, etc.
60
- */
61
- fetchFailure = "fetchFailure",
62
-
63
- /**
64
- * Unexpected response from server. Either JSON is malformed, or some required properties are missing
65
- */
66
- incorrectServerResponse = "incorrectServerResponse",
67
-
68
- /**
69
- * This error occurs when the file is modified externally (not through Fluid protocol) in storage.
70
- * It will occur in cases where client has some state or cache that is based on old content (identity) of a file,
71
- * and storage / driver / loader detects such mismatch.
72
- * When it's hit, client needs to forget all the knowlege about this file and start over.
73
- */
74
- fileOverwrittenInStorage = "fileOverwrittenInStorage",
75
-
76
- /**
77
- * The document is read-only and delta stream connection is forbidden.
78
- */
79
- deltaStreamConnectionForbidden = "deltaStreamConnectionForbidden",
80
-
81
- /**
82
- * The location of file/container can change on server. So if the file location moves and we try to access the old
83
- * location, then this error is thrown to let the client know about the new location info.
84
- */
85
- locationRedirection = "locationRedirection",
86
-
87
- /**
88
- * When a file is not a Fluid file, but has Fluid extension such as ".note",
89
- * server won't be able to open it and will return this error. The innerMostErrorCode will be
90
- * "fluidInvalidSchema"
91
- */
92
- fluidInvalidSchema = "fluidInvalidSchema",
93
- /**
94
- * Error indicating an API is being used improperly resulting in an invalid operation.
95
- * ! Should match the value of ContainerErrorType.usageError
96
- */
97
- usageError = "usageError",
13
+ /**
14
+ * A fatal error with no specific interpretation covered by other DriverErrorType values
15
+ */
16
+ genericError = "genericError",
17
+
18
+ /**
19
+ * Some non-categorized (below) networking error
20
+ * Include errors like fatal server error (usually 500).
21
+ */
22
+ genericNetworkError = "genericNetworkError",
23
+
24
+ /**
25
+ * Access denied - user does not have enough privileges to open a file, or continue to operate on a file
26
+ */
27
+ authorizationError = "authorizationError",
28
+
29
+ /**
30
+ * File not found, or file deleted during session
31
+ */
32
+ fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
33
+
34
+ /**
35
+ * Throttling error from server. Server is busy and is asking not to reconnect for some time
36
+ */
37
+ throttlingError = "throttlingError",
38
+
39
+ /**
40
+ * We can not reach server due to computer being offline.
41
+ */
42
+ offlineError = "offlineError",
43
+
44
+ /*
45
+ * Unsupported client protocol
46
+ */
47
+ unsupportedClientProtocolVersion = "unsupportedClientProtocolVersion",
48
+
49
+ /**
50
+ * User does not have write permissions to a file, but is changing content of a file.
51
+ * That might be indication of some data store error - data stores should not generate ops in readonly mode.
52
+ */
53
+ writeError = "writeError",
54
+
55
+ /**
56
+ * A generic fetch failure that indicates we were not able to get a response from the server.
57
+ * This may be due to the client being offline (though, if we are able to detect offline state it will be
58
+ * logged as an offlineError instead). Other possibilities could be DNS errors, malformed fetch request,
59
+ * CSP violation, etc.
60
+ */
61
+ fetchFailure = "fetchFailure",
62
+
63
+ /**
64
+ * This error occurs when token provider fails to fetch orderer token
65
+ */
66
+ fetchTokenError = "fetchTokenError",
67
+
68
+ /**
69
+ * Unexpected response from server. Either JSON is malformed, or some required properties are missing
70
+ */
71
+ incorrectServerResponse = "incorrectServerResponse",
72
+
73
+ /**
74
+ * This error occurs when the file is modified externally (not through Fluid protocol) in storage.
75
+ * It will occur in cases where client has some state or cache that is based on old content (identity) of a file,
76
+ * and storage / driver / loader detects such mismatch.
77
+ * When it's hit, client needs to forget all the knowledge about this file and start over.
78
+ */
79
+ fileOverwrittenInStorage = "fileOverwrittenInStorage",
80
+
81
+ /**
82
+ * The document is read-only and delta stream connection is forbidden.
83
+ */
84
+ deltaStreamConnectionForbidden = "deltaStreamConnectionForbidden",
85
+
86
+ /**
87
+ * The location of file/container can change on server. So if the file location moves and we try to access the old
88
+ * location, then this error is thrown to let the client know about the new location info.
89
+ */
90
+ locationRedirection = "locationRedirection",
91
+
92
+ /**
93
+ * When a file is not a Fluid file, but has Fluid extension such as ".note",
94
+ * server won't be able to open it and will return this error. The innerMostErrorCode will be
95
+ * "fluidInvalidSchema"
96
+ */
97
+ fluidInvalidSchema = "fluidInvalidSchema",
98
+
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
+ /**
106
+ * File is locked for read/write by storage, e.g. whole collection is locked and access denied.
107
+ */
108
+ fileIsLocked = "fileIsLocked",
98
109
  }
99
110
 
100
111
  /**
@@ -107,45 +118,54 @@ export enum DriverErrorType {
107
118
  * but we can't reference a specific driver's error type enum in this code.
108
119
  */
109
120
  export interface IAnyDriverError extends Omit<IDriverErrorBase, "errorType"> {
110
- readonly errorType: string;
121
+ readonly errorType: string;
111
122
  }
112
123
 
113
124
  /**
114
125
  * Base interface for all errors and warnings
115
126
  */
116
127
  export interface IDriverErrorBase {
117
- /** Classification of what type of error this is, used programmatically by consumers to interpret the error */
118
- readonly errorType: DriverErrorType;
119
- /** Free-form error message */
120
- readonly message: string;
121
- /** True indicates the caller may retry the failed action. False indicates it's a fatal error */
122
- canRetry: boolean;
123
- /**
124
- * Best guess as to network conditions (online/offline) when the error arose.
125
- * See OnlineStatus enum in driver-utils package for expected values.
126
- */
127
- online?: string;
128
+ /**
129
+ * Classification of what type of error this is, used programmatically by consumers to interpret the error
130
+ */
131
+ readonly errorType: DriverErrorType;
132
+
133
+ /**
134
+ * Free-form error message
135
+ */
136
+ readonly message: string;
137
+
138
+ /**
139
+ * True indicates the caller may retry the failed action. False indicates it's a fatal error
140
+ */
141
+ canRetry: boolean;
142
+
143
+ /**
144
+ * Best guess as to network conditions (online/offline) when the error arose.
145
+ * See OnlineStatus enum in driver-utils package for expected values.
146
+ */
147
+ online?: string;
128
148
  }
129
149
 
130
150
  export interface IThrottlingWarning extends IDriverErrorBase {
131
- readonly errorType: DriverErrorType.throttlingError;
132
- readonly retryAfterSeconds: number;
151
+ readonly errorType: DriverErrorType.throttlingError;
152
+ readonly retryAfterSeconds: number;
133
153
  }
134
154
 
135
155
  export interface IGenericNetworkError extends IDriverErrorBase {
136
- readonly errorType: DriverErrorType.genericNetworkError;
137
- readonly statusCode?: number;
156
+ readonly errorType: DriverErrorType.genericNetworkError;
157
+ readonly statusCode?: number;
138
158
  }
139
159
 
140
160
  export interface IAuthorizationError extends IDriverErrorBase {
141
- readonly errorType: DriverErrorType.authorizationError;
142
- readonly claims?: string;
143
- readonly tenantId?: string;
161
+ readonly errorType: DriverErrorType.authorizationError;
162
+ readonly claims?: string;
163
+ readonly tenantId?: string;
144
164
  }
145
165
 
146
166
  export interface ILocationRedirectionError extends IDriverErrorBase {
147
- readonly errorType: DriverErrorType.locationRedirection;
148
- readonly redirectUrl: IResolvedUrl;
167
+ readonly errorType: DriverErrorType.locationRedirection;
168
+ readonly redirectUrl: IResolvedUrl;
149
169
  }
150
170
 
151
171
  /**
@@ -153,23 +173,25 @@ export interface ILocationRedirectionError extends IDriverErrorBase {
153
173
  * allows compiler to differentiate interfaces based on error type
154
174
  */
155
175
  export interface IDriverBasicError extends IDriverErrorBase {
156
- readonly errorType:
157
- DriverErrorType.genericError
158
- | DriverErrorType.fileNotFoundOrAccessDeniedError
159
- | DriverErrorType.offlineError
160
- | DriverErrorType.unsupportedClientProtocolVersion
161
- | DriverErrorType.writeError
162
- | DriverErrorType.fetchFailure
163
- | DriverErrorType.incorrectServerResponse
164
- | DriverErrorType.fileOverwrittenInStorage
165
- | DriverErrorType.fluidInvalidSchema
166
- | DriverErrorType.usageError;
167
- readonly statusCode?: number;
176
+ readonly errorType:
177
+ | DriverErrorType.genericError
178
+ | DriverErrorType.fileNotFoundOrAccessDeniedError
179
+ | DriverErrorType.offlineError
180
+ | DriverErrorType.unsupportedClientProtocolVersion
181
+ | DriverErrorType.writeError
182
+ | DriverErrorType.fetchFailure
183
+ | DriverErrorType.fetchTokenError
184
+ | DriverErrorType.incorrectServerResponse
185
+ | DriverErrorType.fileOverwrittenInStorage
186
+ | DriverErrorType.fluidInvalidSchema
187
+ | DriverErrorType.usageError
188
+ | DriverErrorType.fileIsLocked;
189
+ readonly statusCode?: number;
168
190
  }
169
191
 
170
192
  export type DriverError =
171
- | IThrottlingWarning
172
- | IGenericNetworkError
173
- | IAuthorizationError
174
- | ILocationRedirectionError
175
- | IDriverBasicError;
193
+ | IThrottlingWarning
194
+ | IGenericNetworkError
195
+ | IAuthorizationError
196
+ | ILocationRedirectionError
197
+ | IDriverBasicError;
package/src/index.ts CHANGED
@@ -4,42 +4,42 @@
4
4
  */
5
5
 
6
6
  export {
7
- DriverError,
8
- DriverErrorType,
9
- IAnyDriverError,
10
- IAuthorizationError,
11
- IDriverErrorBase,
12
- IDriverBasicError,
13
- IGenericNetworkError,
14
- ILocationRedirectionError,
15
- IThrottlingWarning,
7
+ DriverError,
8
+ DriverErrorType,
9
+ IAnyDriverError,
10
+ IAuthorizationError,
11
+ IDriverErrorBase,
12
+ IDriverBasicError,
13
+ IGenericNetworkError,
14
+ ILocationRedirectionError,
15
+ IThrottlingWarning,
16
16
  } from "./driverError";
17
17
  export {
18
- FetchSource,
19
- FiveDaysMs,
20
- IDeltasFetchResult,
21
- IDeltaStorageService,
22
- IDocumentDeltaConnection,
23
- IDocumentDeltaConnectionEvents,
24
- IDocumentDeltaStorageService,
25
- IDocumentService,
26
- IDocumentServiceFactory,
27
- IDocumentServicePolicies,
28
- IDocumentStorageService,
29
- IDocumentStorageServicePolicies,
30
- IStream,
31
- IStreamResult,
32
- ISummaryContext,
33
- LoaderCachingPolicy,
18
+ FetchSource,
19
+ FiveDaysMs,
20
+ IDeltasFetchResult,
21
+ IDeltaStorageService,
22
+ IDocumentDeltaConnection,
23
+ IDocumentDeltaConnectionEvents,
24
+ IDocumentDeltaStorageService,
25
+ IDocumentService,
26
+ IDocumentServiceFactory,
27
+ IDocumentServicePolicies,
28
+ IDocumentStorageService,
29
+ IDocumentStorageServicePolicies,
30
+ IStream,
31
+ IStreamResult,
32
+ ISummaryContext,
33
+ LoaderCachingPolicy,
34
34
  } from "./storage";
35
35
  export {
36
- DriverPreCheckInfo,
37
- DriverHeader,
38
- IContainerPackageInfo,
39
- IDriverHeader,
40
- IFluidResolvedUrl,
41
- IResolvedUrl,
42
- IResolvedUrlBase,
43
- IWebResolvedUrl,
44
- IUrlResolver,
36
+ DriverPreCheckInfo,
37
+ DriverHeader,
38
+ IContainerPackageInfo,
39
+ IDriverHeader,
40
+ IFluidResolvedUrl,
41
+ IResolvedUrl,
42
+ IResolvedUrlBase,
43
+ IWebResolvedUrl,
44
+ IUrlResolver,
45
45
  } from "./urlResolver";