@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.
- package/.eslintrc.js +2 -5
- package/api-extractor.json +2 -2
- package/dist/driverError.d.ts +21 -7
- package/dist/driverError.d.ts.map +1 -1
- package/dist/driverError.js +10 -2
- package/dist/driverError.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/storage.d.ts +18 -9
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js.map +1 -1
- package/dist/urlResolver.d.ts +9 -3
- package/dist/urlResolver.d.ts.map +1 -1
- package/dist/urlResolver.js.map +1 -1
- package/lib/driverError.d.ts +21 -7
- package/lib/driverError.d.ts.map +1 -1
- package/lib/driverError.js +10 -2
- package/lib/driverError.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/storage.d.ts +18 -9
- package/lib/storage.d.ts.map +1 -1
- package/lib/storage.js.map +1 -1
- package/lib/test/types/maximumCacheDurationPolicy.spec.js.map +1 -1
- package/lib/test/types/validateDriverDefinitionsPrevious.generated.js +2 -2
- package/lib/test/types/validateDriverDefinitionsPrevious.generated.js.map +1 -1
- package/lib/urlResolver.d.ts +9 -3
- package/lib/urlResolver.d.ts.map +1 -1
- package/lib/urlResolver.js.map +1 -1
- package/package.json +27 -31
- package/prettier.config.cjs +1 -1
- package/src/driverError.ts +145 -123
- package/src/index.ts +34 -34
- package/src/storage.ts +339 -310
- package/src/urlResolver.ts +60 -53
- package/tsconfig.esnext.json +6 -6
- package/tsconfig.json +8 -13
package/src/driverError.ts
CHANGED
|
@@ -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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
132
|
-
|
|
151
|
+
readonly errorType: DriverErrorType.throttlingError;
|
|
152
|
+
readonly retryAfterSeconds: number;
|
|
133
153
|
}
|
|
134
154
|
|
|
135
155
|
export interface IGenericNetworkError extends IDriverErrorBase {
|
|
136
|
-
|
|
137
|
-
|
|
156
|
+
readonly errorType: DriverErrorType.genericNetworkError;
|
|
157
|
+
readonly statusCode?: number;
|
|
138
158
|
}
|
|
139
159
|
|
|
140
160
|
export interface IAuthorizationError extends IDriverErrorBase {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
-
|
|
148
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
DriverPreCheckInfo,
|
|
37
|
+
DriverHeader,
|
|
38
|
+
IContainerPackageInfo,
|
|
39
|
+
IDriverHeader,
|
|
40
|
+
IFluidResolvedUrl,
|
|
41
|
+
IResolvedUrl,
|
|
42
|
+
IResolvedUrlBase,
|
|
43
|
+
IWebResolvedUrl,
|
|
44
|
+
IUrlResolver,
|
|
45
45
|
} from "./urlResolver";
|