@fluidframework/driver-definitions 2.0.0-rc.1.0.4 → 2.0.0-rc.2.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.
Files changed (76) hide show
  1. package/.eslintrc.cjs +12 -0
  2. package/CHANGELOG.md +28 -0
  3. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  4. package/api-extractor.json +1 -1
  5. package/api-report/driver-definitions.api.md +58 -52
  6. package/dist/driver-definitions-alpha.d.ts +108 -119
  7. package/dist/driver-definitions-beta.d.ts +31 -112
  8. package/dist/driver-definitions-public.d.ts +31 -112
  9. package/dist/driver-definitions-untrimmed.d.ts +108 -119
  10. package/dist/driverError.d.ts +11 -98
  11. package/dist/driverError.d.ts.map +1 -1
  12. package/dist/driverError.js +1 -95
  13. package/dist/driverError.js.map +1 -1
  14. package/dist/index.d.ts +6 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +8 -9
  17. package/dist/index.js.map +1 -1
  18. package/dist/package.json +3 -0
  19. package/dist/storage.d.ts +79 -6
  20. package/dist/storage.d.ts.map +1 -1
  21. package/dist/storage.js.map +1 -1
  22. package/dist/tsdoc-metadata.json +1 -1
  23. package/dist/urlResolver.d.ts +1 -1
  24. package/dist/urlResolver.d.ts.map +1 -1
  25. package/dist/urlResolver.js.map +1 -1
  26. package/lib/{driver-definitions-alpha.d.mts → driver-definitions-alpha.d.ts} +108 -119
  27. package/lib/{driver-definitions-public.d.mts → driver-definitions-beta.d.ts} +31 -112
  28. package/lib/{driver-definitions-beta.d.mts → driver-definitions-public.d.ts} +31 -112
  29. package/lib/{driver-definitions-untrimmed.d.mts → driver-definitions-untrimmed.d.ts} +108 -119
  30. package/lib/{driverError.d.mts → driverError.d.ts} +12 -99
  31. package/lib/driverError.d.ts.map +1 -0
  32. package/lib/driverError.js +87 -0
  33. package/lib/driverError.js.map +1 -0
  34. package/lib/index.d.ts +11 -0
  35. package/lib/index.d.ts.map +1 -0
  36. package/lib/index.js +8 -0
  37. package/lib/index.js.map +1 -0
  38. package/lib/{storage.d.mts → storage.d.ts} +80 -7
  39. package/lib/storage.d.ts.map +1 -0
  40. package/lib/{storage.mjs → storage.js} +1 -1
  41. package/lib/storage.js.map +1 -0
  42. package/lib/test/types/{maximumCacheDurationPolicy.spec.d.mts → maximumCacheDurationPolicy.spec.d.ts} +1 -1
  43. package/lib/test/types/maximumCacheDurationPolicy.spec.d.ts.map +1 -0
  44. package/lib/test/types/{maximumCacheDurationPolicy.spec.mjs → maximumCacheDurationPolicy.spec.js} +1 -1
  45. package/lib/test/types/maximumCacheDurationPolicy.spec.js.map +1 -0
  46. package/lib/test/types/{validateDriverDefinitionsPrevious.generated.d.mts → validateDriverDefinitionsPrevious.generated.d.ts} +1 -1
  47. package/lib/test/types/validateDriverDefinitionsPrevious.generated.d.ts.map +1 -0
  48. package/lib/test/types/{validateDriverDefinitionsPrevious.generated.mjs → validateDriverDefinitionsPrevious.generated.js} +7 -5
  49. package/lib/test/types/validateDriverDefinitionsPrevious.generated.js.map +1 -0
  50. package/lib/{urlResolver.d.mts → urlResolver.d.ts} +6 -2
  51. package/lib/urlResolver.d.ts.map +1 -0
  52. package/lib/{urlResolver.mjs → urlResolver.js} +1 -1
  53. package/lib/urlResolver.js.map +1 -0
  54. package/package.json +58 -18
  55. package/src/driverError.ts +23 -131
  56. package/src/index.ts +12 -11
  57. package/src/storage.ts +91 -7
  58. package/src/urlResolver.ts +3 -2
  59. package/tsconfig.cjs.json +7 -0
  60. package/tsconfig.json +2 -5
  61. package/.eslintrc.js +0 -8
  62. package/lib/driverError.d.mts.map +0 -1
  63. package/lib/driverError.mjs +0 -181
  64. package/lib/driverError.mjs.map +0 -1
  65. package/lib/index.d.mts +0 -8
  66. package/lib/index.d.mts.map +0 -1
  67. package/lib/index.mjs +0 -8
  68. package/lib/index.mjs.map +0 -1
  69. package/lib/storage.d.mts.map +0 -1
  70. package/lib/storage.mjs.map +0 -1
  71. package/lib/test/types/maximumCacheDurationPolicy.spec.d.mts.map +0 -1
  72. package/lib/test/types/maximumCacheDurationPolicy.spec.mjs.map +0 -1
  73. package/lib/test/types/validateDriverDefinitionsPrevious.generated.d.mts.map +0 -1
  74. package/lib/test/types/validateDriverDefinitionsPrevious.generated.mjs.map +0 -1
  75. package/lib/urlResolver.d.mts.map +0 -1
  76. package/lib/urlResolver.mjs.map +0 -1
package/.eslintrc.cjs ADDED
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ module.exports = {
7
+ extends: [require.resolve("@fluidframework/eslint-config-fluid/strict"), "prettier"],
8
+ rules: {
9
+ // TODO: Enabling this may require breaking changes.
10
+ "@typescript-eslint/consistent-indexed-object-style": "off",
11
+ },
12
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @fluidframework/driver-definitions
2
2
 
3
+ ## 2.0.0-rc.2.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - driver-definitions: Deprecate `ISnapshotContents` ([#19314](https://github.com/microsoft/FluidFramework/issues/19314)) [fc731b69de](https://github.com/microsoft/FluidFramework/commits/fc731b69deed4a2987e9b97d8918492d689bafbc)
8
+
9
+ `ISnapshotContents` is deprecated. It has been replaced with `ISnapshot`.
10
+
11
+ - driver-definitions: repositoryUrl removed from IDocumentStorageService ([#19522](https://github.com/microsoft/FluidFramework/issues/19522)) [90eb3c9d33](https://github.com/microsoft/FluidFramework/commits/90eb3c9d33d80e24caa1393a50f414c5602f6aa3)
12
+
13
+ The `repositoryUrl` member of `IDocumentStorageService` was unused and always equal to the empty string. It has been removed.
14
+
15
+ - Deprecated error-related enums have been removed ([#19067](https://github.com/microsoft/FluidFramework/issues/19067)) [59793302e5](https://github.com/microsoft/FluidFramework/commits/59793302e56784cfb6ace0e6469345f3565b3312)
16
+
17
+ Error-related enums `ContainerErrorType`, `DriverErrorType`, `OdspErrorType` and `RouterliciousErrorType` were previously
18
+ deprecated and are now removed. There are replacement object-based enumerations of `ContainerErrorTypes`,
19
+ `DriverErrorTypes`, `OdspErrorTypes` and `RouterliciousErrorTypes`. Refer to the release notes of [Fluid Framework version
20
+ 2.0.0-internal.7.0.0](https://github.com/microsoft/FluidFramework/releases/tag/client_v2.0.0-internal.7.0.0) for details
21
+ on the replacements.
22
+
23
+ - container-definitions: Added containerMetadata prop on IContainer interface ([#19142](https://github.com/microsoft/FluidFramework/issues/19142)) [d0d77f3516](https://github.com/microsoft/FluidFramework/commits/d0d77f3516d67f3c9faedb47b20dbd4e309c3bc2)
24
+
25
+ Added `containerMetadata` prop on IContainer interface.
26
+
27
+ - runtime-definitions: Moved ISignalEnvelope interface to core-interfaces ([#19142](https://github.com/microsoft/FluidFramework/issues/19142)) [d0d77f3516](https://github.com/microsoft/FluidFramework/commits/d0d77f3516d67f3c9faedb47b20dbd4e309c3bc2)
28
+
29
+ The `ISignalEnvelope` interface has been moved to the @fluidframework/core-interfaces package.
30
+
3
31
  ## 2.0.0-rc.1.0.0
4
32
 
5
33
  ### Minor Changes
@@ -1,4 +1,8 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base-esm.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
+ }
4
8
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "../../../common/build/build-common/api-extractor-base.json"
3
+ "extends": "../../../common/build/build-common/api-extractor-base.esm.primary.json"
4
4
  }
@@ -4,52 +4,30 @@
4
4
 
5
5
  ```ts
6
6
 
7
- import { ConnectionMode } from '@fluidframework/protocol-definitions';
8
- import { IClient } from '@fluidframework/protocol-definitions';
9
- import { IClientConfiguration } from '@fluidframework/protocol-definitions';
10
- import { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
11
- import { IDisposable } from '@fluidframework/core-interfaces';
12
- import { IDocumentMessage } from '@fluidframework/protocol-definitions';
13
- import { IErrorEvent } from '@fluidframework/core-interfaces';
14
- import { IEventProvider } from '@fluidframework/core-interfaces';
15
- import { INack } from '@fluidframework/protocol-definitions';
16
- import { IRequest } from '@fluidframework/core-interfaces';
17
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
18
- import { ISignalClient } from '@fluidframework/protocol-definitions';
19
- import { ISignalMessage } from '@fluidframework/protocol-definitions';
20
- import { ISnapshotTree } from '@fluidframework/protocol-definitions';
21
- import { ISummaryHandle } from '@fluidframework/protocol-definitions';
22
- import { ISummaryTree } from '@fluidframework/protocol-definitions';
23
- import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
24
- import { ITokenClaims } from '@fluidframework/protocol-definitions';
25
- import { IVersion } from '@fluidframework/protocol-definitions';
7
+ import type { ConnectionMode } from '@fluidframework/protocol-definitions';
8
+ import type { IClient } from '@fluidframework/protocol-definitions';
9
+ import type { IClientConfiguration } from '@fluidframework/protocol-definitions';
10
+ import type { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
11
+ import type { IDisposable } from '@fluidframework/core-interfaces';
12
+ import type { IDocumentMessage } from '@fluidframework/protocol-definitions';
13
+ import type { IErrorEvent } from '@fluidframework/core-interfaces';
14
+ import type { IEvent } from '@fluidframework/core-interfaces';
15
+ import type { IEventProvider } from '@fluidframework/core-interfaces';
16
+ import type { INack } from '@fluidframework/protocol-definitions';
17
+ import type { IRequest } from '@fluidframework/core-interfaces';
18
+ import type { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
19
+ import type { ISignalClient } from '@fluidframework/protocol-definitions';
20
+ import type { ISignalMessage } from '@fluidframework/protocol-definitions';
21
+ import type { ISnapshotTree } from '@fluidframework/protocol-definitions';
22
+ import type { ISummaryHandle } from '@fluidframework/protocol-definitions';
23
+ import type { ISummaryTree } from '@fluidframework/protocol-definitions';
24
+ import type { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
25
+ import type { ITokenClaims } from '@fluidframework/protocol-definitions';
26
+ import type { IVersion } from '@fluidframework/protocol-definitions';
26
27
 
27
28
  // @alpha (undocumented)
28
29
  export type DriverError = IThrottlingWarning | IGenericNetworkError | IAuthorizationError | ILocationRedirectionError | IDriverBasicError;
29
30
 
30
- // @public @deprecated
31
- export enum DriverErrorType {
32
- authorizationError = "authorizationError",
33
- deltaStreamConnectionForbidden = "deltaStreamConnectionForbidden",
34
- fetchFailure = "fetchFailure",
35
- fetchTokenError = "fetchTokenError",
36
- fileIsLocked = "fileIsLocked",
37
- fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
38
- fileOverwrittenInStorage = "fileOverwrittenInStorage",
39
- fluidInvalidSchema = "fluidInvalidSchema",
40
- genericError = "genericError",
41
- genericNetworkError = "genericNetworkError",
42
- incorrectServerResponse = "incorrectServerResponse",
43
- locationRedirection = "locationRedirection",
44
- offlineError = "offlineError",
45
- outOfStorageError = "outOfStorageError",
46
- throttlingError = "throttlingError",
47
- // (undocumented)
48
- unsupportedClientProtocolVersion = "unsupportedClientProtocolVersion",
49
- usageError = "usageError",
50
- writeError = "writeError"
51
- }
52
-
53
31
  // @public
54
32
  export const DriverErrorTypes: {
55
33
  readonly genericNetworkError: "genericNetworkError";
@@ -72,7 +50,7 @@ export const DriverErrorTypes: {
72
50
  readonly usageError: "usageError";
73
51
  };
74
52
 
75
- // @public (undocumented)
53
+ // @public
76
54
  export type DriverErrorTypes = (typeof DriverErrorTypes)[keyof typeof DriverErrorTypes];
77
55
 
78
56
  // @alpha
@@ -111,7 +89,7 @@ export interface IAuthorizationError extends IDriverErrorBase {
111
89
  // (undocumented)
112
90
  readonly claims?: string;
113
91
  // (undocumented)
114
- readonly errorType: DriverErrorType.authorizationError;
92
+ readonly errorType: typeof DriverErrorTypes.authorizationError;
115
93
  // (undocumented)
116
94
  readonly tenantId?: string;
117
95
  }
@@ -173,7 +151,7 @@ export interface IDocumentDeltaStorageService {
173
151
  }
174
152
 
175
153
  // @alpha (undocumented)
176
- export interface IDocumentService {
154
+ export interface IDocumentService extends IEventProvider<IDocumentServiceEvents> {
177
155
  connectToDeltaStorage(): Promise<IDocumentDeltaStorageService>;
178
156
  connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection>;
179
157
  connectToStorage(): Promise<IDocumentStorageService>;
@@ -183,6 +161,11 @@ export interface IDocumentService {
183
161
  resolvedUrl: IResolvedUrl;
184
162
  }
185
163
 
164
+ // @alpha
165
+ export interface IDocumentServiceEvents extends IEvent {
166
+ (event: "metadataUpdate", listener: (metadata: Record<string, string>) => void): any;
167
+ }
168
+
186
169
  // @alpha (undocumented)
187
170
  export interface IDocumentServiceFactory {
188
171
  createContainer(createNewSummary: ISummaryTree | undefined, createNewResolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean): Promise<IDocumentService>;
@@ -193,18 +176,18 @@ export interface IDocumentServiceFactory {
193
176
  export interface IDocumentServicePolicies {
194
177
  readonly storageOnly?: boolean;
195
178
  readonly summarizeProtocolTree?: boolean;
179
+ readonly supportGetSnapshotApi?: boolean;
196
180
  }
197
181
 
198
182
  // @alpha
199
183
  export interface IDocumentStorageService extends Partial<IDisposable> {
200
184
  createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
201
185
  downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
186
+ getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
202
187
  getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
203
188
  getVersions(versionId: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<IVersion[]>;
204
189
  readonly policies?: IDocumentStorageServicePolicies;
205
190
  readBlob(id: string): Promise<ArrayBufferLike>;
206
- // (undocumented)
207
- repositoryUrl: string;
208
191
  uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
209
192
  }
210
193
 
@@ -217,7 +200,7 @@ export interface IDocumentStorageServicePolicies {
217
200
  // @alpha
218
201
  export interface IDriverBasicError extends IDriverErrorBase {
219
202
  // (undocumented)
220
- 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;
203
+ 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;
221
204
  // (undocumented)
222
205
  readonly statusCode?: number;
223
206
  }
@@ -226,7 +209,7 @@ export interface IDriverBasicError extends IDriverErrorBase {
226
209
  export interface IDriverErrorBase {
227
210
  canRetry: boolean;
228
211
  endpointReached?: boolean;
229
- readonly errorType: DriverErrorType;
212
+ readonly errorType: DriverErrorTypes;
230
213
  readonly message: string;
231
214
  online?: string;
232
215
  }
@@ -242,7 +225,7 @@ export interface IDriverHeader {
242
225
  // @alpha (undocumented)
243
226
  export interface IGenericNetworkError extends IDriverErrorBase {
244
227
  // (undocumented)
245
- readonly errorType: DriverErrorType.genericNetworkError;
228
+ readonly errorType: typeof DriverErrorTypes.genericNetworkError;
246
229
  // (undocumented)
247
230
  readonly statusCode?: number;
248
231
  }
@@ -250,7 +233,7 @@ export interface IGenericNetworkError extends IDriverErrorBase {
250
233
  // @alpha (undocumented)
251
234
  export interface ILocationRedirectionError extends IDriverErrorBase {
252
235
  // (undocumented)
253
- readonly errorType: DriverErrorType.locationRedirection;
236
+ readonly errorType: typeof DriverErrorTypes.locationRedirection;
254
237
  // (undocumented)
255
238
  readonly redirectUrl: IResolvedUrl;
256
239
  }
@@ -272,6 +255,29 @@ export interface IResolvedUrl {
272
255
  url: string;
273
256
  }
274
257
 
258
+ // @alpha (undocumented)
259
+ export interface ISnapshot {
260
+ // (undocumented)
261
+ blobContents: Map<string, ArrayBuffer>;
262
+ latestSequenceNumber: number | undefined;
263
+ // (undocumented)
264
+ ops: ISequencedDocumentMessage[];
265
+ sequenceNumber: number | undefined;
266
+ // (undocumented)
267
+ snapshotFormatV: 1;
268
+ // (undocumented)
269
+ snapshotTree: ISnapshotTree;
270
+ }
271
+
272
+ // @alpha
273
+ export interface ISnapshotFetchOptions {
274
+ cacheSnapshot?: boolean;
275
+ fetchSource?: FetchSource;
276
+ loadingGroupIds?: string[];
277
+ scenarioName?: string;
278
+ versionId?: string;
279
+ }
280
+
275
281
  // @alpha
276
282
  export interface IStream<T> {
277
283
  // (undocumented)
@@ -297,7 +303,7 @@ export interface ISummaryContext {
297
303
  // @alpha (undocumented)
298
304
  export interface IThrottlingWarning extends IDriverErrorBase {
299
305
  // (undocumented)
300
- readonly errorType: DriverErrorType.throttlingError;
306
+ readonly errorType: typeof DriverErrorTypes.throttlingError;
301
307
  // (undocumented)
302
308
  readonly retryAfterSeconds: number;
303
309
  }
@@ -1,119 +1,29 @@
1
- import { ConnectionMode } from '@fluidframework/protocol-definitions';
2
- import { IClient } from '@fluidframework/protocol-definitions';
3
- import { IClientConfiguration } from '@fluidframework/protocol-definitions';
4
- import { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
5
- import { IDisposable } from '@fluidframework/core-interfaces';
6
- import { IDocumentMessage } from '@fluidframework/protocol-definitions';
7
- import { IErrorEvent } from '@fluidframework/core-interfaces';
8
- import { IEventProvider } from '@fluidframework/core-interfaces';
9
- import { INack } from '@fluidframework/protocol-definitions';
10
- import { IRequest } from '@fluidframework/core-interfaces';
11
- import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
12
- import { ISignalClient } from '@fluidframework/protocol-definitions';
13
- import { ISignalMessage } from '@fluidframework/protocol-definitions';
14
- import { ISnapshotTree } from '@fluidframework/protocol-definitions';
15
- import { ISummaryHandle } from '@fluidframework/protocol-definitions';
16
- import { ISummaryTree } from '@fluidframework/protocol-definitions';
17
- import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
18
- import { ITokenClaims } from '@fluidframework/protocol-definitions';
19
- import { IVersion } from '@fluidframework/protocol-definitions';
1
+ import type { ConnectionMode } from '@fluidframework/protocol-definitions';
2
+ import type { IClient } from '@fluidframework/protocol-definitions';
3
+ import type { IClientConfiguration } from '@fluidframework/protocol-definitions';
4
+ import type { ICreateBlobResponse } from '@fluidframework/protocol-definitions';
5
+ import type { IDisposable } from '@fluidframework/core-interfaces';
6
+ import type { IDocumentMessage } from '@fluidframework/protocol-definitions';
7
+ import type { IErrorEvent } from '@fluidframework/core-interfaces';
8
+ import type { IEvent } from '@fluidframework/core-interfaces';
9
+ import type { IEventProvider } from '@fluidframework/core-interfaces';
10
+ import type { INack } from '@fluidframework/protocol-definitions';
11
+ import type { IRequest } from '@fluidframework/core-interfaces';
12
+ import type { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
13
+ import type { ISignalClient } from '@fluidframework/protocol-definitions';
14
+ import type { ISignalMessage } from '@fluidframework/protocol-definitions';
15
+ import type { ISnapshotTree } from '@fluidframework/protocol-definitions';
16
+ import type { ISummaryHandle } from '@fluidframework/protocol-definitions';
17
+ import type { ISummaryTree } from '@fluidframework/protocol-definitions';
18
+ import type { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
19
+ import type { ITokenClaims } from '@fluidframework/protocol-definitions';
20
+ import type { IVersion } from '@fluidframework/protocol-definitions';
20
21
 
21
22
  /**
22
23
  * @alpha
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
@@ -193,6 +103,7 @@ export declare const DriverErrorTypes: {
193
103
  };
194
104
 
195
105
  /**
106
+ * {@inheritDoc (DriverErrorTypes:variable)}
196
107
  * @public
197
108
  */
198
109
  export declare type DriverErrorTypes = (typeof DriverErrorTypes)[keyof typeof DriverErrorTypes];
@@ -238,11 +149,13 @@ export declare type FiveDaysMs = 432000000;
238
149
 
239
150
  /**
240
151
  * Interface describing errors and warnings raised by any driver code.
152
+ *
153
+ * @remarks
241
154
  * Not expected to be implemented by a class or an object literal, but rather used in place of
242
155
  * any or unknown in various function signatures that pass errors around.
243
156
  *
244
157
  * "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,
158
+ * It will be either {@link @fluidframework/driver-definitions#(DriverErrorTypes:variable)} or the specific driver's specialized error type enum,
246
159
  * but we can't reference a specific driver's error type enum in this code.
247
160
  * @public
248
161
  */
@@ -254,7 +167,7 @@ export declare interface IAnyDriverError extends Omit<IDriverErrorBase, "errorTy
254
167
  * @alpha
255
168
  */
256
169
  export declare interface IAuthorizationError extends IDriverErrorBase {
257
- readonly errorType: DriverErrorType.authorizationError;
170
+ readonly errorType: typeof DriverErrorTypes.authorizationError;
258
171
  readonly claims?: string;
259
172
  readonly tenantId?: string;
260
173
  }
@@ -372,7 +285,7 @@ export declare interface IDocumentDeltaStorageService {
372
285
  /**
373
286
  * @alpha
374
287
  */
375
- export declare interface IDocumentService {
288
+ export declare interface IDocumentService extends IEventProvider<IDocumentServiceEvents> {
376
289
  resolvedUrl: IResolvedUrl;
377
290
  /**
378
291
  * Policies implemented/instructed by driver.
@@ -403,6 +316,18 @@ export declare interface IDocumentService {
403
316
  dispose(error?: any): void;
404
317
  }
405
318
 
319
+ /**
320
+ * Events emitted by {@link IDocumentService}.
321
+ * @alpha
322
+ */
323
+ export declare interface IDocumentServiceEvents extends IEvent {
324
+ /**
325
+ * This event is used to communicate any metadata related to the container. We might have received metadata from the service.
326
+ * Read more info on this event from here `IContainer.containerMetadata`.
327
+ */
328
+ (event: "metadataUpdate", listener: (metadata: Record<string, string>) => void): any;
329
+ }
330
+
406
331
  /**
407
332
  * @alpha
408
333
  */
@@ -445,6 +370,12 @@ export declare interface IDocumentServicePolicies {
445
370
  * Summarizer uploads the protocol tree too when summarizing.
446
371
  */
447
372
  readonly summarizeProtocolTree?: boolean;
373
+ /**
374
+ * Whether the driver supports the new getSnapshot api which returns snapshot which
375
+ * contains all contents along with the snapshot tree. Enable this by default when the
376
+ * driver can fully support the api.
377
+ */
378
+ readonly supportGetSnapshotApi?: boolean;
448
379
  }
449
380
 
450
381
  /**
@@ -452,7 +383,6 @@ export declare interface IDocumentServicePolicies {
452
383
  * @alpha
453
384
  */
454
385
  export declare interface IDocumentStorageService extends Partial<IDisposable> {
455
- repositoryUrl: string;
456
386
  /**
457
387
  * Policies implemented/instructed by driver.
458
388
  */
@@ -464,6 +394,13 @@ export declare interface IDocumentStorageService extends Partial<IDisposable> {
464
394
  * in debugging purposes to see why this call was made.
465
395
  */
466
396
  getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
397
+ /**
398
+ * Returns the snapshot which can contain other artifacts too like blob contents, ops etc. It is different from
399
+ * `getSnapshotTree` api in that, that API only returns the snapshot tree from the snapshot.
400
+ * @param snapshotFetchOptions - Options specified by the caller to specify and want certain behavior from the
401
+ * driver when fetching the snapshot.
402
+ */
403
+ getSnapshot?(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
467
404
  /**
468
405
  * Retrieves all versions of the document starting at the specified versionId - or null if from the head
469
406
  * @param versionId - Version id of the requested version.
@@ -525,7 +462,7 @@ export declare interface IDocumentStorageServicePolicies {
525
462
  * @alpha
526
463
  */
527
464
  export declare interface IDriverBasicError extends IDriverErrorBase {
528
- 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;
465
+ 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;
529
466
  readonly statusCode?: number;
530
467
  }
531
468
 
@@ -539,7 +476,7 @@ export declare interface IDriverErrorBase {
539
476
  *
540
477
  * @privateRemarks TODO: use {@link DriverErrorTypes} instead (breaking change).
541
478
  */
542
- readonly errorType: DriverErrorType;
479
+ readonly errorType: DriverErrorTypes;
543
480
  /**
544
481
  * Free-form error message
545
482
  */
@@ -565,7 +502,7 @@ export declare interface IDriverErrorBase {
565
502
  * @alpha
566
503
  */
567
504
  export declare interface IGenericNetworkError extends IDriverErrorBase {
568
- readonly errorType: DriverErrorType.genericNetworkError;
505
+ readonly errorType: typeof DriverErrorTypes.genericNetworkError;
569
506
  readonly statusCode?: number;
570
507
  }
571
508
 
@@ -573,7 +510,7 @@ export declare interface IGenericNetworkError extends IDriverErrorBase {
573
510
  * @alpha
574
511
  */
575
512
  export declare interface ILocationRedirectionError extends IDriverErrorBase {
576
- readonly errorType: DriverErrorType.locationRedirection;
513
+ readonly errorType: typeof DriverErrorTypes.locationRedirection;
577
514
  readonly redirectUrl: IResolvedUrl;
578
515
  }
579
516
 
@@ -595,6 +532,58 @@ export declare interface IResolvedUrl {
595
532
  };
596
533
  }
597
534
 
535
+ /**
536
+ * @alpha
537
+ */
538
+ export declare interface ISnapshot {
539
+ snapshotTree: ISnapshotTree;
540
+ blobContents: Map<string, ArrayBuffer>;
541
+ ops: ISequencedDocumentMessage[];
542
+ /**
543
+ * Sequence number of the snapshot
544
+ */
545
+ sequenceNumber: number | undefined;
546
+ /**
547
+ * Sequence number for the latest op/snapshot for the file in ODSP
548
+ */
549
+ latestSequenceNumber: number | undefined;
550
+ snapshotFormatV: 1;
551
+ }
552
+
553
+ /**
554
+ * Snapshot fetch options which are used to communicate different things to the driver
555
+ * when fetching the snapshot.
556
+ * @alpha
557
+ */
558
+ export declare interface ISnapshotFetchOptions {
559
+ /**
560
+ * Indicates scenario in which the snapshot is fetched. It is a free form string mostly
561
+ * used for telemetry purposes.
562
+ */
563
+ scenarioName?: string;
564
+ /**
565
+ * Tell driver to cache the fetched snapshot. Driver is supposed to cache the fetched snapshot if this is
566
+ * set to true. If undefined, then it is upto the driver, to cache it or not.
567
+ */
568
+ cacheSnapshot?: boolean;
569
+ /**
570
+ * Version of the snapshot to be fetched. Certain storage services just keep 1 snapshot for the
571
+ * container, so specifying version is not necessary for storage services.
572
+ */
573
+ versionId?: string;
574
+ /**
575
+ * List of loading groupId of datastores for which the snapshot needs to be fetched. If not provided, content with
576
+ * default/missing groupIDs will be requested from the service. It is upto the service, to include snapshot for
577
+ * content with groupIds or not. Don't provide anything here for fetching content for initial container boot.
578
+ */
579
+ loadingGroupIds?: string[];
580
+ /**
581
+ * Specify if you want default behavior of the driver to fetch the snapshot like lets say simultaneously fetch from
582
+ * network and cache or specify FetchSource.noCache to just fetch from network.
583
+ */
584
+ fetchSource?: FetchSource;
585
+ }
586
+
598
587
  /**
599
588
  * Read interface for the Queue
600
589
  * @alpha
@@ -634,7 +623,7 @@ export declare interface ISummaryContext {
634
623
  * @alpha
635
624
  */
636
625
  export declare interface IThrottlingWarning extends IDriverErrorBase {
637
- readonly errorType: DriverErrorType.throttlingError;
626
+ readonly errorType: typeof DriverErrorTypes.throttlingError;
638
627
  readonly retryAfterSeconds: number;
639
628
  }
640
629