@fluidframework/routerlicious-driver 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.
- package/{.eslintrc.js → .eslintrc.cjs} +4 -1
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +32 -0
- package/api-report/routerlicious-driver.api.md +6 -9
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaStorageService.js.map +1 -1
- package/dist/documentService.d.ts +2 -1
- package/dist/documentService.d.ts.map +1 -1
- package/dist/documentService.js +5 -3
- package/dist/documentService.js.map +1 -1
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js +11 -9
- package/dist/documentServiceFactory.js.map +1 -1
- package/dist/errorUtils.d.ts +1 -18
- package/dist/errorUtils.d.ts.map +1 -1
- package/dist/errorUtils.js +2 -20
- package/dist/errorUtils.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/nullBlobStorageService.d.ts +0 -1
- package/dist/nullBlobStorageService.d.ts.map +1 -1
- package/dist/nullBlobStorageService.js +0 -3
- package/dist/nullBlobStorageService.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/policies.d.ts +0 -6
- package/dist/policies.d.ts.map +1 -1
- package/dist/policies.js.map +1 -1
- package/dist/r11sSnapshotParser.d.ts.map +1 -1
- package/dist/r11sSnapshotParser.js +1 -0
- package/dist/r11sSnapshotParser.js.map +1 -1
- package/dist/restWrapper.d.ts +3 -3
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/restWrapper.js.map +1 -1
- package/dist/routerlicious-driver-alpha.d.ts +25 -4
- package/dist/routerlicious-driver-beta.d.ts +3 -4
- package/dist/routerlicious-driver-public.d.ts +3 -4
- package/dist/routerlicious-driver-untrimmed.d.ts +23 -24
- package/dist/routerliciousResolvedUrl.d.ts +34 -0
- package/dist/routerliciousResolvedUrl.d.ts.map +1 -0
- package/dist/routerliciousResolvedUrl.js +14 -0
- package/dist/routerliciousResolvedUrl.js.map +1 -0
- package/dist/shreddedSummaryDocumentStorageService.d.ts +0 -1
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.js +0 -1
- package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/dist/tokens.d.ts +1 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js.map +1 -1
- package/dist/treeUtils.d.ts +1 -0
- package/dist/treeUtils.d.ts.map +1 -1
- package/dist/treeUtils.js +2 -0
- package/dist/treeUtils.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/urlUtils.d.ts +0 -2
- package/dist/urlUtils.d.ts.map +1 -1
- package/dist/urlUtils.js +9 -17
- package/dist/urlUtils.js.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts +0 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.js +0 -1
- package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
- package/lib/contracts.d.mts +1 -0
- package/lib/contracts.d.mts.map +1 -1
- package/lib/contracts.mjs.map +1 -1
- package/lib/deltaStorageService.mjs.map +1 -1
- package/lib/documentService.d.mts +2 -1
- package/lib/documentService.d.mts.map +1 -1
- package/lib/documentService.mjs +5 -3
- package/lib/documentService.mjs.map +1 -1
- package/lib/documentServiceFactory.d.mts.map +1 -1
- package/lib/documentServiceFactory.mjs +12 -10
- package/lib/documentServiceFactory.mjs.map +1 -1
- package/lib/errorUtils.d.mts +1 -18
- package/lib/errorUtils.d.mts.map +1 -1
- package/lib/errorUtils.mjs +1 -19
- package/lib/errorUtils.mjs.map +1 -1
- package/lib/index.d.mts +2 -1
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/nullBlobStorageService.d.mts +0 -1
- package/lib/nullBlobStorageService.d.mts.map +1 -1
- package/lib/nullBlobStorageService.mjs +0 -3
- package/lib/nullBlobStorageService.mjs.map +1 -1
- package/lib/packageVersion.d.mts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/policies.d.mts +0 -6
- package/lib/policies.d.mts.map +1 -1
- package/lib/policies.mjs.map +1 -1
- package/lib/r11sSnapshotParser.d.mts.map +1 -1
- package/lib/r11sSnapshotParser.mjs +1 -0
- package/lib/r11sSnapshotParser.mjs.map +1 -1
- package/lib/restWrapper.d.mts +3 -3
- package/lib/restWrapper.d.mts.map +1 -1
- package/lib/restWrapper.mjs.map +1 -1
- package/lib/routerlicious-driver-alpha.d.mts +25 -4
- package/lib/routerlicious-driver-beta.d.mts +3 -4
- package/lib/routerlicious-driver-public.d.mts +3 -4
- package/lib/routerlicious-driver-untrimmed.d.mts +23 -24
- package/lib/routerliciousResolvedUrl.d.mts +34 -0
- package/lib/routerliciousResolvedUrl.d.mts.map +1 -0
- package/lib/routerliciousResolvedUrl.mjs +10 -0
- package/lib/routerliciousResolvedUrl.mjs.map +1 -0
- package/lib/shreddedSummaryDocumentStorageService.d.mts +0 -1
- package/lib/shreddedSummaryDocumentStorageService.d.mts.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.mjs +0 -1
- package/lib/shreddedSummaryDocumentStorageService.mjs.map +1 -1
- package/lib/tokens.d.mts +1 -2
- package/lib/tokens.d.mts.map +1 -1
- package/lib/tokens.mjs.map +1 -1
- package/lib/treeUtils.d.mts +1 -0
- package/lib/treeUtils.d.mts.map +1 -1
- package/lib/treeUtils.mjs +2 -0
- package/lib/treeUtils.mjs.map +1 -1
- package/lib/urlUtils.d.mts +0 -2
- package/lib/urlUtils.d.mts.map +1 -1
- package/lib/urlUtils.mjs +8 -12
- package/lib/urlUtils.mjs.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.d.mts +0 -1
- package/lib/wholeSummaryDocumentStorageService.d.mts.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.mjs +0 -1
- package/lib/wholeSummaryDocumentStorageService.mjs.map +1 -1
- package/package.json +31 -25
- package/src/contracts.ts +1 -0
- package/src/deltaStorageService.ts +3 -3
- package/src/documentService.ts +10 -4
- package/src/documentServiceFactory.ts +16 -13
- package/src/errorUtils.ts +2 -21
- package/src/index.ts +4 -1
- package/src/nullBlobStorageService.ts +0 -4
- package/src/packageVersion.ts +1 -1
- package/src/policies.ts +0 -6
- package/src/r11sSnapshotParser.ts +1 -0
- package/src/restWrapper.ts +3 -3
- package/src/routerliciousResolvedUrl.ts +39 -0
- package/src/shreddedSummaryDocumentStorageService.ts +0 -2
- package/src/tokens.ts +1 -2
- package/src/treeUtils.ts +3 -0
- package/src/urlUtils.ts +8 -13
- package/src/wholeSummaryDocumentStorageService.ts +0 -2
package/dist/errorUtils.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.errorObjectFromSocketError = exports.throwR11sNetworkError = exports.createR11sNetworkError = exports.
|
|
7
|
+
exports.errorObjectFromSocketError = exports.throwR11sNetworkError = exports.createR11sNetworkError = exports.RouterliciousErrorTypes = void 0;
|
|
8
8
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
9
9
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
10
10
|
const packageVersion_1 = require("./packageVersion");
|
|
@@ -21,24 +21,6 @@ exports.RouterliciousErrorTypes = {
|
|
|
21
21
|
*/
|
|
22
22
|
sslCertError: "sslCertError",
|
|
23
23
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Routerlicious Error types
|
|
26
|
-
* Different error types that may be thrown by the routerlicious driver
|
|
27
|
-
*
|
|
28
|
-
* @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
var RouterliciousErrorType;
|
|
32
|
-
(function (RouterliciousErrorType) {
|
|
33
|
-
/**
|
|
34
|
-
* File not found, or file deleted during session
|
|
35
|
-
*/
|
|
36
|
-
RouterliciousErrorType["fileNotFoundOrAccessDeniedError"] = "fileNotFoundOrAccessDeniedError";
|
|
37
|
-
/**
|
|
38
|
-
* SSL Certificate Error.
|
|
39
|
-
*/
|
|
40
|
-
RouterliciousErrorType["sslCertError"] = "sslCertError";
|
|
41
|
-
})(RouterliciousErrorType || (exports.RouterliciousErrorType = RouterliciousErrorType = {}));
|
|
42
24
|
function createR11sNetworkError(errorMessage, statusCode, retryAfterMs) {
|
|
43
25
|
let error;
|
|
44
26
|
const props = { statusCode, driverVersion: packageVersion_1.pkgVersion };
|
|
@@ -50,7 +32,7 @@ function createR11sNetworkError(errorMessage, statusCode, retryAfterMs) {
|
|
|
50
32
|
error = new driver_utils_1.AuthorizationError(errorMessage, undefined, undefined, props);
|
|
51
33
|
break;
|
|
52
34
|
case 404:
|
|
53
|
-
const errorType =
|
|
35
|
+
const errorType = exports.RouterliciousErrorTypes.fileNotFoundOrAccessDeniedError;
|
|
54
36
|
error = new driver_utils_1.NonRetryableError(errorMessage, errorType, props);
|
|
55
37
|
break;
|
|
56
38
|
case 429:
|
package/dist/errorUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAI4C;AAC5C,+DAKsC;AAEtC,qDAA+D;AAE/D;;;;GAIG;AACU,QAAA,uBAAuB,GAAG;IACtC,kCAAkC;IAClC,GAAG,qCAAgB;IAEnB;;OAEG;IACH,YAAY,EAAE,cAAc;CACnB,CAAC;
|
|
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C;YAClE,MAAM;KACP;IACD,KAAK,CAAC,sBAAsB,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC;AACd,CAAC;AApCD,wDAoCC;AAED,SAAgB,qBAAqB,CACpC,YAAoB,EACpB,UAAkB,EAClB,YAAqB;IAErB,MAAM,YAAY,GAAG,sBAAsB,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAEpF,+DAA+D;IAC/D,MAAM,YAAY,CAAC;AACpB,CAAC;AATD,sDASC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CACzC,WAA6B,EAC7B,OAAe;IAEf,iDAAiD;IACjD,MAAM,OAAO,GAAG,sBAAsB,OAAO,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;IACzE,OAAO,sBAAsB,CAAC,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;AACpF,CAAC;AAPD,gEAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDriverError,\n\tIDriverErrorBase,\n\tDriverErrorTypes,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tNonRetryableError,\n\tGenericNetworkError,\n\tcreateGenericNetworkError,\n\tAuthorizationError,\n} from \"@fluidframework/driver-utils\";\nimport { IFluidErrorBase } from \"@fluidframework/telemetry-utils\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\n\n/**\n * Routerlicious Error types\n * Different error types that may be thrown by the routerlicious driver\n * @internal\n */\nexport const RouterliciousErrorTypes = {\n\t// Inherit base driver error types\n\t...DriverErrorTypes,\n\n\t/**\n\t * SSL Certificate Error.\n\t */\n\tsslCertError: \"sslCertError\",\n} as const;\n/**\n * @internal\n */\nexport type RouterliciousErrorTypes =\n\t(typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];\n\n/**\n * Interface for error responses for the WebSocket connection\n * Intended to be compatible with output from {@link NetworkError.toJSON}\n */\nexport interface IR11sSocketError {\n\t/**\n\t * An error code number for the error that occurred.\n\t * It will be a valid HTTP status code.\n\t */\n\tcode: number;\n\n\t/**\n\t * A message about the error that occurred for debugging / logging purposes.\n\t * This should not be displayed to the user directly.\n\t */\n\tmessage: string;\n\n\t/**\n\t * Optional Retry-After time in seconds.\n\t * The client should wait this many seconds before retrying its request.\n\t */\n\tretryAfter?: number;\n\n\t/**\n\t * Optional Retry-After time in milliseconds.\n\t * The client should wait this many milliseconds before retrying its request.\n\t */\n\tretryAfterMs?: number;\n}\n\nexport interface IR11sError extends Omit<IDriverErrorBase, \"errorType\"> {\n\treadonly errorType: RouterliciousErrorTypes;\n}\n\nexport type R11sError = DriverError | IR11sError;\n\nexport function createR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n): IFluidErrorBase & R11sError {\n\tlet error: IFluidErrorBase & R11sError;\n\tconst props = { statusCode, driverVersion };\n\tswitch (statusCode) {\n\t\tcase 401:\n\t\t// The first 401 is manually retried in RouterliciousRestWrapper with a refreshed token,\n\t\t// so we treat repeat 401s the same as 403.\n\t\tcase 403:\n\t\t\terror = new AuthorizationError(errorMessage, undefined, undefined, props);\n\t\t\tbreak;\n\t\tcase 404:\n\t\t\tconst errorType = RouterliciousErrorTypes.fileNotFoundOrAccessDeniedError;\n\t\t\terror = new NonRetryableError(errorMessage, errorType, props);\n\t\t\tbreak;\n\t\tcase 429:\n\t\t\terror = createGenericNetworkError(\n\t\t\t\terrorMessage,\n\t\t\t\t{ canRetry: true, retryAfterMs },\n\t\t\t\tprops,\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 500:\n\t\tcase 502:\n\t\t\terror = new GenericNetworkError(errorMessage, true, props);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconst retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };\n\t\t\terror = createGenericNetworkError(errorMessage, retryInfo, props);\n\t\t\tbreak;\n\t}\n\terror.addTelemetryProperties({ endpointReached: true });\n\treturn error;\n}\n\nexport function throwR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n): never {\n\tconst networkError = createR11sNetworkError(errorMessage, statusCode, retryAfterMs);\n\n\t// eslint-disable-next-line @typescript-eslint/no-throw-literal\n\tthrow networkError;\n}\n\n/**\n * Returns network error based on error object from R11s socket (IR11sSocketError)\n */\nexport function errorObjectFromSocketError(\n\tsocketError: IR11sSocketError,\n\thandler: string,\n): R11sError {\n\t// pre-0.58 error message prefix: R11sSocketError\n\tconst message = `R11s socket error (${handler}): ${socketError.message}`;\n\treturn createR11sNetworkError(message, socketError.code, socketError.retryAfterMs);\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
export type { IRouterliciousResolvedUrl } from "./routerliciousResolvedUrl";
|
|
5
6
|
export { DefaultTokenProvider } from "./defaultTokenProvider";
|
|
6
7
|
export { ITokenProvider, ITokenResponse, ITokenService } from "./tokens";
|
|
7
|
-
export {
|
|
8
|
+
export { RouterliciousErrorTypes } from "./errorUtils";
|
|
8
9
|
export { DocumentPostCreateError, RouterliciousDocumentServiceFactory, } from "./documentServiceFactory";
|
|
9
10
|
export { IRouterliciousDriverPolicies } from "./policies";
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,YAAY,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAG5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGvD,OAAO,EACN,uBAAuB,EACvB,mCAAmC,GACnC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.RouterliciousDocumentServiceFactory = exports.DocumentPostCreateError = exports.RouterliciousErrorTypes = exports.
|
|
7
|
+
exports.RouterliciousDocumentServiceFactory = exports.DocumentPostCreateError = exports.RouterliciousErrorTypes = exports.DefaultTokenProvider = void 0;
|
|
8
8
|
// Tokens
|
|
9
9
|
var defaultTokenProvider_1 = require("./defaultTokenProvider");
|
|
10
10
|
Object.defineProperty(exports, "DefaultTokenProvider", { enumerable: true, get: function () { return defaultTokenProvider_1.DefaultTokenProvider; } });
|
|
11
11
|
// Errors
|
|
12
12
|
var errorUtils_1 = require("./errorUtils");
|
|
13
|
-
Object.defineProperty(exports, "RouterliciousErrorType", { enumerable: true, get: function () { return errorUtils_1.RouterliciousErrorType; } });
|
|
14
13
|
Object.defineProperty(exports, "RouterliciousErrorTypes", { enumerable: true, get: function () { return errorUtils_1.RouterliciousErrorTypes; } });
|
|
15
14
|
// Factory
|
|
16
15
|
var documentServiceFactory_1 = require("./documentServiceFactory");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,SAAS;AACT,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAG7B,SAAS;AACT,2CAAuD;AAA9C,qHAAA,uBAAuB,OAAA;AAEhC,UAAU;AACV,mEAGkC;AAFjC,iIAAA,uBAAuB,OAAA;AACvB,6IAAA,mCAAmC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// URL\nexport type { IRouterliciousResolvedUrl } from \"./routerliciousResolvedUrl\";\n\n// Tokens\nexport { DefaultTokenProvider } from \"./defaultTokenProvider\";\nexport { ITokenProvider, ITokenResponse, ITokenService } from \"./tokens\";\n\n// Errors\nexport { RouterliciousErrorTypes } from \"./errorUtils\";\n\n// Factory\nexport {\n\tDocumentPostCreateError,\n\tRouterliciousDocumentServiceFactory,\n} from \"./documentServiceFactory\";\n\n// Configuration\nexport { IRouterliciousDriverPolicies } from \"./policies\";\n"]}
|
|
@@ -9,7 +9,6 @@ import * as api from "@fluidframework/protocol-definitions";
|
|
|
9
9
|
* Does not read/write anything.
|
|
10
10
|
*/
|
|
11
11
|
export declare class NullBlobStorageService implements IDocumentStorageService {
|
|
12
|
-
get repositoryUrl(): string;
|
|
13
12
|
getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null>;
|
|
14
13
|
getVersions(versionId: string | null, count: number): Promise<api.IVersion[]>;
|
|
15
14
|
uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nullBlobStorageService.d.ts","sourceRoot":"","sources":["../src/nullBlobStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAE5D;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,uBAAuB;
|
|
1
|
+
{"version":3,"file":"nullBlobStorageService.d.ts","sourceRoot":"","sources":["../src/nullBlobStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC9F,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAE5D;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,uBAAuB;IACxD,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC;IAI1E,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAI7E,wBAAwB,CACpC,OAAO,EAAE,GAAG,CAAC,YAAY,EACzB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAIL,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAItE,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAGnE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAG/D"}
|
|
@@ -10,9 +10,6 @@ exports.NullBlobStorageService = void 0;
|
|
|
10
10
|
* Does not read/write anything.
|
|
11
11
|
*/
|
|
12
12
|
class NullBlobStorageService {
|
|
13
|
-
get repositoryUrl() {
|
|
14
|
-
throw new Error("Invalid operation");
|
|
15
|
-
}
|
|
16
13
|
async getSnapshotTree(version) {
|
|
17
14
|
return version ? Promise.reject(new Error("Invalid operation")) : null;
|
|
18
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nullBlobStorageService.js","sourceRoot":"","sources":["../src/nullBlobStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;GAGG;AACH,MAAa,sBAAsB;
|
|
1
|
+
{"version":3,"file":"nullBlobStorageService.js","sourceRoot":"","sources":["../src/nullBlobStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;GAGG;AACH,MAAa,sBAAsB;IAC3B,KAAK,CAAC,eAAe,CAAC,OAAsB;QAClD,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAAwB,EAAE,KAAa;QAC/D,OAAO,EAAE,CAAC;IACX,CAAC;IAEM,KAAK,CAAC,wBAAwB,CACpC,OAAyB,EACzB,OAAwB;QAExB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAA0B;QACtD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC1D,CAAC;IACM,KAAK,CAAC,QAAQ,CAAC,MAAc;QACnC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACxD,CAAC;CACD;AA1BD,wDA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport * as api from \"@fluidframework/protocol-definitions\";\n\n/**\n * Document access to underlying storage. It is default implementation of a storage service.\n * Does not read/write anything.\n */\nexport class NullBlobStorageService implements IDocumentStorageService {\n\tpublic async getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null> {\n\t\treturn version ? Promise.reject(new Error(\"Invalid operation\")) : null;\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<api.IVersion[]> {\n\t\treturn [];\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: api.ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tthrow new Error(\"Invalid operation\");\n\t}\n\n\tpublic async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {\n\t\tthrow new Error(\"Invalid operation\");\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {\n\t\tthrow new Error(\"Null blob storage can not create blob\");\n\t}\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tthrow new Error(\"Null blob storage can not read blob\");\n\t}\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/routerlicious-driver";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-rc.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-rc.2.0.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/routerlicious-driver";
|
|
11
|
-
exports.pkgVersion = "2.0.0-rc.
|
|
11
|
+
exports.pkgVersion = "2.0.0-rc.2.0.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sCAAsC,CAAC;AACjD,QAAA,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/routerlicious-driver\";\nexport const pkgVersion = \"2.0.0-rc.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sCAAsC,CAAC;AACjD,QAAA,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/routerlicious-driver\";\nexport const pkgVersion = \"2.0.0-rc.2.0.0\";\n"]}
|
package/dist/policies.d.ts
CHANGED
|
@@ -48,11 +48,5 @@ export interface IRouterliciousDriverPolicies {
|
|
|
48
48
|
* Default: true
|
|
49
49
|
*/
|
|
50
50
|
enableLongPollingDowngrade: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Indicates that the container is ephemeral.
|
|
53
|
-
* Artifacts relates to the container are limited to container lifetime.
|
|
54
|
-
* Default: false
|
|
55
|
-
*/
|
|
56
|
-
isEphemeralContainer: boolean;
|
|
57
51
|
}
|
|
58
52
|
//# sourceMappingURL=policies.d.ts.map
|
package/dist/policies.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,4BAA4B,EAAE,OAAO,CAAC;IACtC;;;;OAIG;IACH,0BAA0B,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,4BAA4B,EAAE,OAAO,CAAC;IACtC;;;;OAIG;IACH,0BAA0B,EAAE,OAAO,CAAC;CACpC"}
|
package/dist/policies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @internal\n */\nexport interface IRouterliciousDriverPolicies {\n\t/**\n\t * Enable prefetching entire snapshot tree into memory before it is loaded by the runtime.\n\t * Default: true\n\t */\n\tenablePrefetch: boolean;\n\t/**\n\t * Rate limit concurrent storage requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentStorageRequests: number;\n\t/**\n\t * Rate limit concurrent orderer requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentOrdererRequests: number;\n\t/**\n\t * Enable uploading entire summary tree as a IWholeSummaryPayload to storage.\n\t * Default: false\n\t */\n\tenableWholeSummaryUpload: boolean;\n\t/**\n\t * Enable service endpoint discovery when creating or joining a session.\n\t * Default: false\n\t */\n\tenableDiscovery: boolean;\n\t/**\n\t * Enable using RestLess which avoids CORS preflight requests.\n\t * Default: true\n\t */\n\tenableRestLess: boolean;\n\t/**\n\t * Enable internal cache of summaries/snapshots.\n\t * Reduces Summarizer boot time and reduces server load in E2E tests.\n\t * Default: true\n\t */\n\tenableInternalSummaryCaching: boolean;\n\t/**\n\t * Enable downgrading socket connection to long-polling\n\t * when websocket connection cannot be established.\n\t * Default: true\n\t */\n\tenableLongPollingDowngrade: boolean;\n
|
|
1
|
+
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @internal\n */\nexport interface IRouterliciousDriverPolicies {\n\t/**\n\t * Enable prefetching entire snapshot tree into memory before it is loaded by the runtime.\n\t * Default: true\n\t */\n\tenablePrefetch: boolean;\n\t/**\n\t * Rate limit concurrent storage requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentStorageRequests: number;\n\t/**\n\t * Rate limit concurrent orderer requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentOrdererRequests: number;\n\t/**\n\t * Enable uploading entire summary tree as a IWholeSummaryPayload to storage.\n\t * Default: false\n\t */\n\tenableWholeSummaryUpload: boolean;\n\t/**\n\t * Enable service endpoint discovery when creating or joining a session.\n\t * Default: false\n\t */\n\tenableDiscovery: boolean;\n\t/**\n\t * Enable using RestLess which avoids CORS preflight requests.\n\t * Default: true\n\t */\n\tenableRestLess: boolean;\n\t/**\n\t * Enable internal cache of summaries/snapshots.\n\t * Reduces Summarizer boot time and reduces server load in E2E tests.\n\t * Default: true\n\t */\n\tenableInternalSummaryCaching: boolean;\n\t/**\n\t * Enable downgrading socket connection to long-polling\n\t * when websocket connection cannot be established.\n\t * Default: true\n\t */\n\tenableLongPollingDowngrade: boolean;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r11sSnapshotParser.d.ts","sourceRoot":"","sources":["../src/r11sSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAA0B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"r11sSnapshotParser.d.ts","sourceRoot":"","sources":["../src/r11sSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAA0B,MAAM,aAAa,CAAC;AAgDnG;;;;;;GAMG;AACH,wBAAgB,8CAA8C,CAC7D,YAAY,EAAE,kBAAkB,EAChC,kBAAkB,GAAE,MAAe,GACjC,wBAAwB,CAiB1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r11sSnapshotParser.js","sourceRoot":"","sources":["../src/r11sSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA8D;AAG9D;;;;;;GAMG;AACH,SAAS,cAAc,CACtB,QAAgC,EAChC,kBAA0B;IAE1B,MAAM,MAAM,GAAsC,EAAE,CAAC;IACrD,uEAAuE;IACvE,MAAM,IAAI,GAAkB,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACtE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAElB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO,EAAE;QACrC,8F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AC,EAAE,EAAE,IAAA,6BAAc,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC;QAC5E,CAAC,CAAC,CAAC;KACH;IACD,MAAM,gBAAgB,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,cAAc,GAAG,gBAAgB,EAAE,cAAc,CAAC;IACxD,MAAM,YAAY,GAAG,cAAc,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;IAE1E,OAAO;QACN,KAAK;QACL,YAAY;QACZ,cAAc;QACd,EAAE,EAAE,YAAY,CAAC,EAAE;KACnB,CAAC;AACH,CAAC;AApBD,wGAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { INormalizedWholeSnapshot, IWholeFlatSnapshot, IWholeFlatSnapshotTree } from \"./contracts\";\n\n/**\n * Build a tree hierarchy from a flat tree.\n *\n * @param flatTree - a flat tree\n * @param treePrefixToRemove - tree prefix to strip\n * @returns the heirarchical tree\n */\nfunction buildHierarchy(\n\tflatTree: IWholeFlatSnapshotTree,\n\ttreePrefixToRemove: string,\n): ISnapshotTree {\n\tconst lookup: { [path: string]: ISnapshotTree } = {};\n\t// Root tree id will be used to determine which version was downloaded.\n\tconst root: ISnapshotTree = { id: flatTree.id, blobs: {}, trees: {} };\n\tlookup[\"\"] = root;\n\n\tfor (const entry of flatTree.entries) {\n\t\t// Strip the `treePrefixToRemove` path from tree entries such that they are stored under root.\n\t\tconst entryPath = entry.path.replace(new RegExp(`^${treePrefixToRemove}/`), \"\");\n\t\tconst lastIndex = entryPath.lastIndexOf(\"/\");\n\t\tconst entryPathDir = entryPath.slice(0, Math.max(0, lastIndex));\n\t\tconst entryPathBase = entryPath.slice(lastIndex + 1);\n\n\t\t// The flat output is breadth-first so we can assume we see tree nodes prior to their contents\n\t\tconst node = lookup[entryPathDir];\n\n\t\t// Add in either the blob or tree\n\t\tif (entry.type === \"tree\") {\n\t\t\tconst newTree: ISnapshotTree = {\n\t\t\t\tblobs: {},\n\t\t\t\ttrees: {},\n\t\t\t\tunreferenced: entry.unreferenced,\n\t\t\t\tgroupId: entry.groupId,\n\t\t\t};\n\t\t\tnode.trees[decodeURIComponent(entryPathBase)] = newTree;\n\t\t\tlookup[entryPath] = newTree;\n\t\t} else if (entry.type === \"blob\") {\n\t\t\tnode.blobs[decodeURIComponent(entryPathBase)] = entry.id;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown entry type!!`);\n\t\t}\n\t}\n\n\treturn root;\n}\n\n/**\n * Converts existing IWholeFlatSnapshot to snapshot tree, blob array, and sequence number.\n *\n * @param flatSnapshot - flat snapshot\n * @param treePrefixToRemove - tree prefix to strip. By default we are stripping \".app\" prefix\n * @returns snapshot tree, blob array, and sequence number\n */\nexport function convertWholeFlatSnapshotToSnapshotTreeAndBlobs(\n\tflatSnapshot: IWholeFlatSnapshot,\n\ttreePrefixToRemove: string = \".app\",\n): INormalizedWholeSnapshot {\n\tconst blobs = new Map<string, ArrayBuffer>();\n\tif (flatSnapshot.blobs) {\n\t\tflatSnapshot.blobs.forEach((blob) => {\n\t\t\tblobs.set(blob.id, stringToBuffer(blob.content, blob.encoding ?? \"utf-8\"));\n\t\t});\n\t}\n\tconst flatSnapshotTree = flatSnapshot.trees?.[0];\n\tconst sequenceNumber = flatSnapshotTree?.sequenceNumber;\n\tconst snapshotTree = buildHierarchy(flatSnapshotTree, treePrefixToRemove);\n\n\treturn {\n\t\tblobs,\n\t\tsnapshotTree,\n\t\tsequenceNumber,\n\t\tid: flatSnapshot.id,\n\t};\n}\n"]}
|
package/dist/restWrapper.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
6
6
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { RateLimiter } from "@fluidframework/driver-utils";
|
|
8
8
|
import type { AxiosRequestConfig } from "axios";
|
|
@@ -13,7 +13,7 @@ export type TokenFetcher = (refresh?: boolean) => Promise<ITokenResponse>;
|
|
|
13
13
|
export interface IR11sResponse<T> {
|
|
14
14
|
content: T;
|
|
15
15
|
headers: Map<string, string>;
|
|
16
|
-
propsToLog:
|
|
16
|
+
propsToLog: ITelemetryBaseProperties;
|
|
17
17
|
requestUrl: string;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -24,7 +24,7 @@ export interface IR11sResponse<T> {
|
|
|
24
24
|
export declare function createR11sResponseFromContent<T>(content: T): IR11sResponse<T>;
|
|
25
25
|
export declare function getPropsToLogFromResponse(headers: {
|
|
26
26
|
get: (id: string) => string | undefined | null;
|
|
27
|
-
}):
|
|
27
|
+
}): ITelemetryBaseProperties;
|
|
28
28
|
export declare class RouterliciousRestWrapper extends RestWrapper {
|
|
29
29
|
private readonly rateLimiter;
|
|
30
30
|
private readonly fetchRefreshedToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restWrapper.d.ts","sourceRoot":"","sources":["../src/restWrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"restWrapper.d.ts","sourceRoot":"","sources":["../src/restWrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EACN,mBAAmB,EAGnB,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAA0C,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAQnG,OAAO,KAAK,EAAE,kBAAkB,EAA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B,KAAK,EAAE,UAAU;SACjB,EACD,KAAK,IAAI,EAAE;YACV,MAAM,YAAY,GAAG,MAAM,aAAa,CAAC,iBAAiB,CACzD,QAAQ,EACR,UAAU,EACV,YAAY,CACZ,CAAC;YAEF,OAAO,YAAY,CAAC;QACrB,CAAC,CACD,CAAC;IACH,CAAC,CAAC;IACF,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AAzBD,sFAyBC;AAED,SAAgB,qCAAqC,CACpD,QAAgB,EAChB,UAAkB,EAClB,aAA6B,EAC7B,MAA2B;IAE3B,MAAM,iBAAiB,GAAG,KAAK,EAAE,YAAsB,EAA2B,EAAE;QACnF,OAAO,kCAAgB,CAAC,cAAc,CACrC,MAAM,EACN;YACC,SAAS,EAAE,mBAAmB;YAC9B,KAAK,EAAE,UAAU;SACjB,EACD,KAAK,IAAI,EAAE;YACV,8CAA8C;YAC9C,MAAM,YAAY,GAAG,MAAM,aAAa,CAAC,iBAAiB,CACzD,QAAQ,EACR,UAAU,EACV,YAAY,CACZ,CAAC;YAEF,OAAO,YAAY,CAAC;QACrB,CAAC,CACD,CAAC;IACH,CAAC,CAAC;IACF,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AA1BD,sFA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tnumberFromString,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { fromUtf8ToBase64, performance } from \"@fluid-internal/client-utils\";\nimport { GenericNetworkError, NonRetryableError, RateLimiter } from \"@fluidframework/driver-utils\";\nimport {\n\tCorrelationIdHeaderName,\n\tDriverVersionHeaderName,\n\tgetAuthorizationTokenFromCredentials,\n\tRestLessClient,\n} from \"@fluidframework/server-services-client\";\nimport fetch from \"cross-fetch\";\nimport type { AxiosRequestConfig, RawAxiosRequestHeaders } from \"axios\";\nimport safeStringify from \"json-stringify-safe\";\nimport { RouterliciousErrorTypes, throwR11sNetworkError } from \"./errorUtils\";\nimport { ITokenProvider, ITokenResponse } from \"./tokens\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { QueryStringType, RestWrapper } from \"./restWrapperBase\";\n\ntype AuthorizationHeaderGetter = (token: ITokenResponse) => string;\nexport type TokenFetcher = (refresh?: boolean) => Promise<ITokenResponse>;\n\nconst axiosRequestConfigToFetchRequestConfig = (\n\trequestConfig: AxiosRequestConfig,\n): [RequestInfo, RequestInit] => {\n\tconst requestInfo: string =\n\t\trequestConfig.baseURL !== undefined\n\t\t\t? `${requestConfig.baseURL}${requestConfig.url ?? \"\"}`\n\t\t\t: requestConfig.url ?? \"\";\n\tconst requestInit: RequestInit = {\n\t\tmethod: requestConfig.method,\n\t\t// NOTE: I believe that although the Axios type permits non-string values in the header, here we are\n\t\t// guaranteed the requestConfig only has string values in its header.\n\t\theaders: requestConfig.headers as Record<string, string>,\n\t\tbody: requestConfig.data,\n\t};\n\treturn [requestInfo, requestInit];\n};\n\nexport interface IR11sResponse<T> {\n\tcontent: T;\n\theaders: Map<string, string>;\n\tpropsToLog: ITelemetryProperties;\n\trequestUrl: string;\n}\n\n/**\n * A utility function to create a Routerlicious response without any additional props as we might not have them always.\n * @param content - Response which is equivalent to content.\n * @returns A Routerlicious response without any extra props.\n */\nexport function createR11sResponseFromContent<T>(content: T): IR11sResponse<T> {\n\treturn {\n\t\tcontent,\n\t\theaders: new Map(),\n\t\tpropsToLog: {},\n\t\trequestUrl: \"\",\n\t};\n}\n\nfunction headersToMap(headers: Headers) {\n\tconst newHeaders = new Map<string, string>();\n\tfor (const [key, value] of headers.entries()) {\n\t\tnewHeaders.set(key, value);\n\t}\n\treturn newHeaders;\n}\n\nexport function getPropsToLogFromResponse(headers: {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tget: (id: string) => string | undefined | null;\n}) {\n\tinterface LoggingHeader {\n\t\theaderName: string;\n\t\tlogName: string;\n\t}\n\n\t// We rename headers so that otel doesn't scrub them away. Otel doesn't allow\n\t// certain characters in headers including '-'\n\tconst headersToLog: LoggingHeader[] = [\n\t\t{ headerName: CorrelationIdHeaderName, logName: \"requestCorrelationId\" },\n\t\t{ headerName: \"content-encoding\", logName: \"contentEncoding\" },\n\t\t{ headerName: \"content-type\", logName: \"contentType\" },\n\t];\n\tconst additionalProps: ITelemetryProperties = {\n\t\tcontentsize: numberFromString(headers.get(\"content-length\")),\n\t};\n\theadersToLog.forEach((header) => {\n\t\tconst headerValue = headers.get(header.headerName);\n\t\tif (headerValue !== undefined && headerValue !== null) {\n\t\t\tadditionalProps[header.logName] = headerValue;\n\t\t}\n\t});\n\n\treturn additionalProps;\n}\n\nexport class RouterliciousRestWrapper extends RestWrapper {\n\tprivate readonly restLess = new RestLessClient();\n\tprivate token: ITokenResponse | undefined;\n\n\tconstructor(\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly rateLimiter: RateLimiter,\n\t\tprivate readonly fetchRefreshedToken: TokenFetcher,\n\t\tprivate readonly getAuthorizationHeader: AuthorizationHeaderGetter,\n\t\tprivate readonly useRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tprivate tokenP?: Promise<ITokenResponse>,\n\t\tdefaultQueryString: QueryStringType = {},\n\t) {\n\t\tsuper(baseurl, defaultQueryString);\n\t}\n\n\tprotected async request<T>(\n\t\trequestConfig: AxiosRequestConfig,\n\t\tstatusCode: number,\n\t\tcanRetry = true,\n\t): Promise<IR11sResponse<T>> {\n\t\tconst config = {\n\t\t\t...requestConfig,\n\t\t\theaders: await this.generateHeaders(requestConfig.headers),\n\t\t};\n\n\t\tconst translatedConfig = this.useRestLess ? this.restLess.translate(config) : config;\n\t\tconst fetchRequestConfig = axiosRequestConfigToFetchRequestConfig(translatedConfig);\n\n\t\tconst res = await this.rateLimiter.schedule(async () => {\n\t\t\tconst perfStart = performance.now();\n\t\t\tconst result = await fetch(...fetchRequestConfig).catch(async (error) => {\n\t\t\t\t// Browser Fetch throws a TypeError on network error, `node-fetch` throws a FetchError\n\t\t\t\tconst isNetworkError = [\"TypeError\", \"FetchError\"].includes(error?.name);\n\t\t\t\tconst errorMessage = isNetworkError\n\t\t\t\t\t? `NetworkError: ${error.message}`\n\t\t\t\t\t: safeStringify(error);\n\t\t\t\t// If a service is temporarily down or a browser resource limit is reached, RestWrapper will throw\n\t\t\t\t// a network error with no status code (e.g. err:ERR_CONN_REFUSED or err:ERR_FAILED) and\n\t\t\t\t// the error message will start with NetworkError as defined in restWrapper.ts\n\t\t\t\t// If there exists a self-signed SSL certificates error, throw a NonRetryableError\n\t\t\t\t// TODO: instead of relying on string matching, filter error based on the error code like we do for websocket connections\n\t\t\t\tconst err = errorMessage.includes(\"failed, reason: self signed certificate\")\n\t\t\t\t\t? new NonRetryableError(errorMessage, RouterliciousErrorTypes.sslCertError, {\n\t\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t })\n\t\t\t\t\t: new GenericNetworkError(\n\t\t\t\t\t\t\terrorMessage,\n\t\t\t\t\t\t\terrorMessage.startsWith(\"NetworkError\"),\n\t\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t );\n\t\t\t\tthrow err;\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tresponse: result,\n\t\t\t\tduration: performance.now() - perfStart,\n\t\t\t};\n\t\t});\n\n\t\tconst response = res.response;\n\n\t\tlet start = performance.now();\n\t\tconst text = await response.text();\n\t\tconst receiveContentTime = performance.now() - start;\n\n\t\tconst bodySize = text.length;\n\t\tstart = performance.now();\n\t\tconst responseBody: any = response.headers.get(\"content-type\")?.includes(\"application/json\")\n\t\t\t? JSON.parse(text)\n\t\t\t: text;\n\t\tconst parseTime = performance.now() - start;\n\n\t\t// Success\n\t\tif (response.ok || response.status === statusCode) {\n\t\t\tconst result = responseBody as T;\n\t\t\tconst headers = headersToMap(response.headers);\n\t\t\treturn {\n\t\t\t\tcontent: result,\n\t\t\t\theaders,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\t\trequestUrl: fetchRequestConfig[0].toString(),\n\t\t\t\tpropsToLog: {\n\t\t\t\t\t...getPropsToLogFromResponse(headers),\n\t\t\t\t\tbodySize,\n\t\t\t\t\treceiveContentTime,\n\t\t\t\t\tparseTime,\n\t\t\t\t\tfetchTime: res.duration,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\t// Failure\n\t\tif (response.status === 401 && canRetry) {\n\t\t\t// Refresh Authorization header and retry once\n\t\t\tthis.token = await this.fetchRefreshedToken(true /* refreshToken */);\n\t\t\treturn this.request<T>(config, statusCode, false);\n\t\t}\n\t\tif (response.status === 429 && responseBody?.retryAfter > 0) {\n\t\t\t// Retry based on retryAfter[Seconds]\n\t\t\treturn new Promise<IR11sResponse<T>>((resolve, reject) =>\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tthis.request<T>(config, statusCode).then(resolve).catch(reject);\n\t\t\t\t}, responseBody.retryAfter * 1000),\n\t\t\t);\n\t\t}\n\n\t\tconst responseSummary =\n\t\t\tresponseBody !== undefined\n\t\t\t\t? typeof responseBody === \"string\"\n\t\t\t\t\t? responseBody\n\t\t\t\t\t: safeStringify(responseBody)\n\t\t\t\t: response.statusText;\n\t\tthrowR11sNetworkError(\n\t\t\t`R11s fetch error: ${responseSummary}`,\n\t\t\tresponse.status,\n\t\t\tresponseBody?.retryAfter,\n\t\t);\n\t}\n\n\tprivate async generateHeaders(\n\t\trequestHeaders?: RawAxiosRequestHeaders | undefined,\n\t): Promise<RawAxiosRequestHeaders> {\n\t\tconst token = await this.getToken();\n\t\tassert(token !== undefined, 0x679 /* token should be present */);\n\t\tconst headers: RawAxiosRequestHeaders = {\n\t\t\t...requestHeaders,\n\t\t\t[DriverVersionHeaderName]: driverVersion,\n\t\t\t// NOTE: If this.authorizationHeader is undefined, should \"Authorization\" be removed entirely?\n\t\t\tAuthorization: this.getAuthorizationHeader(token),\n\t\t};\n\t\treturn headers;\n\t}\n\n\tpublic async getToken(): Promise<ITokenResponse> {\n\t\tif (this.token !== undefined) {\n\t\t\treturn this.token;\n\t\t}\n\t\tconst token = await (this.tokenP ?? this.fetchRefreshedToken());\n\t\tthis.setToken(token);\n\t\tthis.tokenP = undefined;\n\t\treturn token;\n\t}\n\n\tpublic setToken(token: ITokenResponse) {\n\t\tthis.token = token;\n\t}\n}\n\nexport class RouterliciousStorageRestWrapper extends RouterliciousRestWrapper {\n\tprivate constructor(\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tfetchToken: TokenFetcher,\n\t\tgetAuthorizationHeader: AuthorizationHeaderGetter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t\tdefaultQueryString: QueryStringType = {},\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\tfetchToken,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t\tdefaultQueryString,\n\t\t);\n\t}\n\n\tpublic static async load(\n\t\ttenantId: string,\n\t\ttokenFetcher: TokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t): Promise<RouterliciousStorageRestWrapper> {\n\t\tconst defaultQueryString = {\n\t\t\ttoken: `${fromUtf8ToBase64(tenantId)}`,\n\t\t};\n\n\t\tconst getAuthorizationHeader: AuthorizationHeaderGetter = (\n\t\t\ttoken: ITokenResponse,\n\t\t): string => {\n\t\t\tconst credentials = {\n\t\t\t\tpassword: token.jwt,\n\t\t\t\tuser: tenantId,\n\t\t\t};\n\t\t\treturn getAuthorizationTokenFromCredentials(credentials);\n\t\t};\n\n\t\tconst restWrapper = new RouterliciousStorageRestWrapper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\ttokenFetcher,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t\tdefaultQueryString,\n\t\t);\n\n\t\treturn restWrapper;\n\t}\n}\n\nexport class RouterliciousOrdererRestWrapper extends RouterliciousRestWrapper {\n\tprivate constructor(\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tfetchToken: TokenFetcher,\n\t\tgetAuthorizationHeader: AuthorizationHeaderGetter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t\tdefaultQueryString: QueryStringType = {},\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\tfetchToken,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t\tdefaultQueryString,\n\t\t);\n\t}\n\n\tpublic static async load(\n\t\ttokenFetcher: TokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t): Promise<RouterliciousOrdererRestWrapper> {\n\t\tconst getAuthorizationHeader: AuthorizationHeaderGetter = (\n\t\t\ttoken: ITokenResponse,\n\t\t): string => {\n\t\t\treturn `Basic ${token.jwt}`;\n\t\t};\n\n\t\tconst restWrapper = new RouterliciousOrdererRestWrapper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\ttokenFetcher,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t);\n\n\t\treturn restWrapper;\n\t}\n}\n\nexport function toInstrumentedR11sOrdererTokenFetcher(\n\ttenantId: string,\n\tdocumentId: string | undefined,\n\ttokenProvider: ITokenProvider,\n\tlogger: ITelemetryLoggerExt,\n): TokenFetcher {\n\tconst fetchOrdererToken = async (refreshToken?: boolean): Promise<ITokenResponse> => {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"FetchOrdererToken\",\n\t\t\t\tdocId: documentId,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst ordererToken = await tokenProvider.fetchOrdererToken(\n\t\t\t\t\ttenantId,\n\t\t\t\t\tdocumentId,\n\t\t\t\t\trefreshToken,\n\t\t\t\t);\n\n\t\t\t\treturn ordererToken;\n\t\t\t},\n\t\t);\n\t};\n\treturn fetchOrdererToken;\n}\n\nexport function toInstrumentedR11sStorageTokenFetcher(\n\ttenantId: string,\n\tdocumentId: string,\n\ttokenProvider: ITokenProvider,\n\tlogger: ITelemetryLoggerExt,\n): TokenFetcher {\n\tconst fetchStorageToken = async (refreshToken?: boolean): Promise<ITokenResponse> => {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"FetchStorageToken\",\n\t\t\t\tdocId: documentId,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\t// Craft credentials using tenant id and token\n\t\t\t\tconst storageToken = await tokenProvider.fetchStorageToken(\n\t\t\t\t\ttenantId,\n\t\t\t\t\tdocumentId,\n\t\t\t\t\trefreshToken,\n\t\t\t\t);\n\n\t\t\t\treturn storageToken;\n\t\t\t},\n\t\t);\n\t};\n\treturn fetchStorageToken;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"restWrapper.js","sourceRoot":"","sources":["../src/restWrapper.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAGH,qEAIyC;AACzC,2DAAoD;AACpD,+DAA6E;AAC7E,+DAAmG;AACnG,mFAKgD;AAChD,8DAAgC;AAEhC,8EAAgD;AAChD,6CAA8E;AAE9E,qDAA+D;AAC/D,uDAAiE;AAKjE,MAAM,sCAAsC,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AAED,SAAgB,qCAAqC,CACpD,QAAgB,EAChB,UAAkB,EAClB,aAA6B,EAC7B,MAA2B;IAE3B,MAAM,iBAAiB,GAAG,KAAK,EAAE,YAAsB,EAA2B,EAAE;QACnF,OAAO,kCAAgB,CAAC,cAAc,CACrC,MAAM,EACN;YACC,SAAS,EAAE,mBAAmB;YAC9B,KAAK,EAAE,UAAU;SACjB,EACD,KAAK,IAAI,EAAE;YACV,8CAA8C;YAC9C,MAAM,YAAY,GAAG,MAAM,aAAa,CAAC,iBAAiB,CACzD,QAAQ,EACR,UAAU,EACV,YAAY,CACZ,CAAC;YAEF,OAAO,YAAY,CAAC;QACrB,CAAC,CACD,CAAC;IACH,CAAC,CAAC;IACF,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AA1BD,sFA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tnumberFromString,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { fromUtf8ToBase64, performance } from \"@fluid-internal/client-utils\";\nimport { GenericNetworkError, NonRetryableError, RateLimiter } from \"@fluidframework/driver-utils\";\nimport {\n\tCorrelationIdHeaderName,\n\tDriverVersionHeaderName,\n\tgetAuthorizationTokenFromCredentials,\n\tRestLessClient,\n} from \"@fluidframework/server-services-client\";\nimport fetch from \"cross-fetch\";\nimport type { AxiosRequestConfig, RawAxiosRequestHeaders } from \"axios\";\nimport safeStringify from \"json-stringify-safe\";\nimport { RouterliciousErrorTypes, throwR11sNetworkError } from \"./errorUtils\";\nimport { ITokenProvider, ITokenResponse } from \"./tokens\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { QueryStringType, RestWrapper } from \"./restWrapperBase\";\n\ntype AuthorizationHeaderGetter = (token: ITokenResponse) => string;\nexport type TokenFetcher = (refresh?: boolean) => Promise<ITokenResponse>;\n\nconst axiosRequestConfigToFetchRequestConfig = (\n\trequestConfig: AxiosRequestConfig,\n): [RequestInfo, RequestInit] => {\n\tconst requestInfo: string =\n\t\trequestConfig.baseURL !== undefined\n\t\t\t? `${requestConfig.baseURL}${requestConfig.url ?? \"\"}`\n\t\t\t: requestConfig.url ?? \"\";\n\tconst requestInit: RequestInit = {\n\t\tmethod: requestConfig.method,\n\t\t// NOTE: I believe that although the Axios type permits non-string values in the header, here we are\n\t\t// guaranteed the requestConfig only has string values in its header.\n\t\theaders: requestConfig.headers as Record<string, string>,\n\t\tbody: requestConfig.data,\n\t};\n\treturn [requestInfo, requestInit];\n};\n\nexport interface IR11sResponse<T> {\n\tcontent: T;\n\theaders: Map<string, string>;\n\tpropsToLog: ITelemetryBaseProperties;\n\trequestUrl: string;\n}\n\n/**\n * A utility function to create a Routerlicious response without any additional props as we might not have them always.\n * @param content - Response which is equivalent to content.\n * @returns A Routerlicious response without any extra props.\n */\nexport function createR11sResponseFromContent<T>(content: T): IR11sResponse<T> {\n\treturn {\n\t\tcontent,\n\t\theaders: new Map(),\n\t\tpropsToLog: {},\n\t\trequestUrl: \"\",\n\t};\n}\n\nfunction headersToMap(headers: Headers) {\n\tconst newHeaders = new Map<string, string>();\n\tfor (const [key, value] of headers.entries()) {\n\t\tnewHeaders.set(key, value);\n\t}\n\treturn newHeaders;\n}\n\nexport function getPropsToLogFromResponse(headers: {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tget: (id: string) => string | undefined | null;\n}) {\n\tinterface LoggingHeader {\n\t\theaderName: string;\n\t\tlogName: string;\n\t}\n\n\t// We rename headers so that otel doesn't scrub them away. Otel doesn't allow\n\t// certain characters in headers including '-'\n\tconst headersToLog: LoggingHeader[] = [\n\t\t{ headerName: CorrelationIdHeaderName, logName: \"requestCorrelationId\" },\n\t\t{ headerName: \"content-encoding\", logName: \"contentEncoding\" },\n\t\t{ headerName: \"content-type\", logName: \"contentType\" },\n\t];\n\tconst additionalProps: ITelemetryBaseProperties = {\n\t\tcontentsize: numberFromString(headers.get(\"content-length\")),\n\t};\n\theadersToLog.forEach((header) => {\n\t\tconst headerValue = headers.get(header.headerName);\n\t\tif (headerValue !== undefined && headerValue !== null) {\n\t\t\tadditionalProps[header.logName] = headerValue;\n\t\t}\n\t});\n\n\treturn additionalProps;\n}\n\nexport class RouterliciousRestWrapper extends RestWrapper {\n\tprivate readonly restLess = new RestLessClient();\n\tprivate token: ITokenResponse | undefined;\n\n\tconstructor(\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly rateLimiter: RateLimiter,\n\t\tprivate readonly fetchRefreshedToken: TokenFetcher,\n\t\tprivate readonly getAuthorizationHeader: AuthorizationHeaderGetter,\n\t\tprivate readonly useRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tprivate tokenP?: Promise<ITokenResponse>,\n\t\tdefaultQueryString: QueryStringType = {},\n\t) {\n\t\tsuper(baseurl, defaultQueryString);\n\t}\n\n\tprotected async request<T>(\n\t\trequestConfig: AxiosRequestConfig,\n\t\tstatusCode: number,\n\t\tcanRetry = true,\n\t): Promise<IR11sResponse<T>> {\n\t\tconst config = {\n\t\t\t...requestConfig,\n\t\t\theaders: await this.generateHeaders(requestConfig.headers),\n\t\t};\n\n\t\tconst translatedConfig = this.useRestLess ? this.restLess.translate(config) : config;\n\t\tconst fetchRequestConfig = axiosRequestConfigToFetchRequestConfig(translatedConfig);\n\n\t\tconst res = await this.rateLimiter.schedule(async () => {\n\t\t\tconst perfStart = performance.now();\n\t\t\tconst result = await fetch(...fetchRequestConfig).catch(async (error) => {\n\t\t\t\t// Browser Fetch throws a TypeError on network error, `node-fetch` throws a FetchError\n\t\t\t\tconst isNetworkError = [\"TypeError\", \"FetchError\"].includes(error?.name);\n\t\t\t\tconst errorMessage = isNetworkError\n\t\t\t\t\t? `NetworkError: ${error.message}`\n\t\t\t\t\t: safeStringify(error);\n\t\t\t\t// If a service is temporarily down or a browser resource limit is reached, RestWrapper will throw\n\t\t\t\t// a network error with no status code (e.g. err:ERR_CONN_REFUSED or err:ERR_FAILED) and\n\t\t\t\t// the error message will start with NetworkError as defined in restWrapper.ts\n\t\t\t\t// If there exists a self-signed SSL certificates error, throw a NonRetryableError\n\t\t\t\t// TODO: instead of relying on string matching, filter error based on the error code like we do for websocket connections\n\t\t\t\tconst err = errorMessage.includes(\"failed, reason: self signed certificate\")\n\t\t\t\t\t? new NonRetryableError(errorMessage, RouterliciousErrorTypes.sslCertError, {\n\t\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t })\n\t\t\t\t\t: new GenericNetworkError(\n\t\t\t\t\t\t\terrorMessage,\n\t\t\t\t\t\t\terrorMessage.startsWith(\"NetworkError\"),\n\t\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t );\n\t\t\t\tthrow err;\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tresponse: result,\n\t\t\t\tduration: performance.now() - perfStart,\n\t\t\t};\n\t\t});\n\n\t\tconst response = res.response;\n\n\t\tlet start = performance.now();\n\t\tconst text = await response.text();\n\t\tconst receiveContentTime = performance.now() - start;\n\n\t\tconst bodySize = text.length;\n\t\tstart = performance.now();\n\t\tconst responseBody: any = response.headers.get(\"content-type\")?.includes(\"application/json\")\n\t\t\t? JSON.parse(text)\n\t\t\t: text;\n\t\tconst parseTime = performance.now() - start;\n\n\t\t// Success\n\t\tif (response.ok || response.status === statusCode) {\n\t\t\tconst result = responseBody as T;\n\t\t\tconst headers = headersToMap(response.headers);\n\t\t\treturn {\n\t\t\t\tcontent: result,\n\t\t\t\theaders,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\t\trequestUrl: fetchRequestConfig[0].toString(),\n\t\t\t\tpropsToLog: {\n\t\t\t\t\t...getPropsToLogFromResponse(headers),\n\t\t\t\t\tbodySize,\n\t\t\t\t\treceiveContentTime,\n\t\t\t\t\tparseTime,\n\t\t\t\t\tfetchTime: res.duration,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\t// Failure\n\t\tif (response.status === 401 && canRetry) {\n\t\t\t// Refresh Authorization header and retry once\n\t\t\tthis.token = await this.fetchRefreshedToken(true /* refreshToken */);\n\t\t\treturn this.request<T>(config, statusCode, false);\n\t\t}\n\t\tif (response.status === 429 && responseBody?.retryAfter > 0) {\n\t\t\t// Retry based on retryAfter[Seconds]\n\t\t\treturn new Promise<IR11sResponse<T>>((resolve, reject) =>\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tthis.request<T>(config, statusCode).then(resolve).catch(reject);\n\t\t\t\t}, responseBody.retryAfter * 1000),\n\t\t\t);\n\t\t}\n\n\t\tconst responseSummary =\n\t\t\tresponseBody !== undefined\n\t\t\t\t? typeof responseBody === \"string\"\n\t\t\t\t\t? responseBody\n\t\t\t\t\t: safeStringify(responseBody)\n\t\t\t\t: response.statusText;\n\t\tthrowR11sNetworkError(\n\t\t\t`R11s fetch error: ${responseSummary}`,\n\t\t\tresponse.status,\n\t\t\tresponseBody?.retryAfter,\n\t\t);\n\t}\n\n\tprivate async generateHeaders(\n\t\trequestHeaders?: RawAxiosRequestHeaders | undefined,\n\t): Promise<RawAxiosRequestHeaders> {\n\t\tconst token = await this.getToken();\n\t\tassert(token !== undefined, 0x679 /* token should be present */);\n\t\tconst headers: RawAxiosRequestHeaders = {\n\t\t\t...requestHeaders,\n\t\t\t[DriverVersionHeaderName]: driverVersion,\n\t\t\t// NOTE: If this.authorizationHeader is undefined, should \"Authorization\" be removed entirely?\n\t\t\tAuthorization: this.getAuthorizationHeader(token),\n\t\t};\n\t\treturn headers;\n\t}\n\n\tpublic async getToken(): Promise<ITokenResponse> {\n\t\tif (this.token !== undefined) {\n\t\t\treturn this.token;\n\t\t}\n\t\tconst token = await (this.tokenP ?? this.fetchRefreshedToken());\n\t\tthis.setToken(token);\n\t\tthis.tokenP = undefined;\n\t\treturn token;\n\t}\n\n\tpublic setToken(token: ITokenResponse) {\n\t\tthis.token = token;\n\t}\n}\n\nexport class RouterliciousStorageRestWrapper extends RouterliciousRestWrapper {\n\tprivate constructor(\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tfetchToken: TokenFetcher,\n\t\tgetAuthorizationHeader: AuthorizationHeaderGetter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t\tdefaultQueryString: QueryStringType = {},\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\tfetchToken,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t\tdefaultQueryString,\n\t\t);\n\t}\n\n\tpublic static async load(\n\t\ttenantId: string,\n\t\ttokenFetcher: TokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t): Promise<RouterliciousStorageRestWrapper> {\n\t\tconst defaultQueryString = {\n\t\t\ttoken: `${fromUtf8ToBase64(tenantId)}`,\n\t\t};\n\n\t\tconst getAuthorizationHeader: AuthorizationHeaderGetter = (\n\t\t\ttoken: ITokenResponse,\n\t\t): string => {\n\t\t\tconst credentials = {\n\t\t\t\tpassword: token.jwt,\n\t\t\t\tuser: tenantId,\n\t\t\t};\n\t\t\treturn getAuthorizationTokenFromCredentials(credentials);\n\t\t};\n\n\t\tconst restWrapper = new RouterliciousStorageRestWrapper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\ttokenFetcher,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t\tdefaultQueryString,\n\t\t);\n\n\t\treturn restWrapper;\n\t}\n}\n\nexport class RouterliciousOrdererRestWrapper extends RouterliciousRestWrapper {\n\tprivate constructor(\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tfetchToken: TokenFetcher,\n\t\tgetAuthorizationHeader: AuthorizationHeaderGetter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t\tdefaultQueryString: QueryStringType = {},\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\tfetchToken,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t\tdefaultQueryString,\n\t\t);\n\t}\n\n\tpublic static async load(\n\t\ttokenFetcher: TokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t): Promise<RouterliciousOrdererRestWrapper> {\n\t\tconst getAuthorizationHeader: AuthorizationHeaderGetter = (\n\t\t\ttoken: ITokenResponse,\n\t\t): string => {\n\t\t\treturn `Basic ${token.jwt}`;\n\t\t};\n\n\t\tconst restWrapper = new RouterliciousOrdererRestWrapper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\ttokenFetcher,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t);\n\n\t\treturn restWrapper;\n\t}\n}\n\nexport function toInstrumentedR11sOrdererTokenFetcher(\n\ttenantId: string,\n\tdocumentId: string | undefined,\n\ttokenProvider: ITokenProvider,\n\tlogger: ITelemetryLoggerExt,\n): TokenFetcher {\n\tconst fetchOrdererToken = async (refreshToken?: boolean): Promise<ITokenResponse> => {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"FetchOrdererToken\",\n\t\t\t\tdocId: documentId,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst ordererToken = await tokenProvider.fetchOrdererToken(\n\t\t\t\t\ttenantId,\n\t\t\t\t\tdocumentId,\n\t\t\t\t\trefreshToken,\n\t\t\t\t);\n\n\t\t\t\treturn ordererToken;\n\t\t\t},\n\t\t);\n\t};\n\treturn fetchOrdererToken;\n}\n\nexport function toInstrumentedR11sStorageTokenFetcher(\n\ttenantId: string,\n\tdocumentId: string,\n\ttokenProvider: ITokenProvider,\n\tlogger: ITelemetryLoggerExt,\n): TokenFetcher {\n\tconst fetchStorageToken = async (refreshToken?: boolean): Promise<ITokenResponse> => {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"FetchStorageToken\",\n\t\t\t\tdocId: documentId,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\t// Craft credentials using tenant id and token\n\t\t\t\tconst storageToken = await tokenProvider.fetchStorageToken(\n\t\t\t\t\ttenantId,\n\t\t\t\t\tdocumentId,\n\t\t\t\t\trefreshToken,\n\t\t\t\t);\n\n\t\t\t\treturn storageToken;\n\t\t\t},\n\t\t);\n\t};\n\treturn fetchStorageToken;\n}\n"]}
|
|
@@ -12,6 +12,30 @@ import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
|
12
12
|
|
|
13
13
|
/* Excluded from this release type: IRouterliciousDriverPolicies */
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Routerlicious extends the resolved url with additional properties to control Routerlicious-specific behaviors.
|
|
17
|
+
*
|
|
18
|
+
* @privateRemarks
|
|
19
|
+
* {@link isRouterliciousResolvedUrl} can be used to detect whether an {@link @fluidframework/driver-definitions#IResolvedUrl}
|
|
20
|
+
* is an IRouterliciousResolvedUrl.
|
|
21
|
+
*
|
|
22
|
+
* @alpha
|
|
23
|
+
*/
|
|
24
|
+
export declare interface IRouterliciousResolvedUrl extends IResolvedUrl {
|
|
25
|
+
/**
|
|
26
|
+
* A flag to facilitate type narrowing from {@link @fluidframework/driver-definitions#IResolvedUrl} to IRouterliciousResolvedUrl.
|
|
27
|
+
*/
|
|
28
|
+
routerliciousResolvedUrl: true;
|
|
29
|
+
/**
|
|
30
|
+
* Controls whether a newly created container will be ephemeral, which means the service will not retain it
|
|
31
|
+
* after the collaboration session ends. Only affects
|
|
32
|
+
* {@link @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer} requests.
|
|
33
|
+
*
|
|
34
|
+
* @defaultValue If left undefined, treated as `false`
|
|
35
|
+
*/
|
|
36
|
+
createAsEphemeral?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
15
39
|
/**
|
|
16
40
|
* Abstracts the token fetching mechanism for a hosting application.
|
|
17
41
|
* The hosting application is responsible for providing an implementation.
|
|
@@ -55,8 +79,7 @@ export declare interface ITokenProvider {
|
|
|
55
79
|
*
|
|
56
80
|
* * Using the callback may have performance impact on the document creation process.
|
|
57
81
|
*
|
|
58
|
-
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
59
|
-
* (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
|
|
82
|
+
* * Any exceptions thrown in the callback would fail the creation workflow.
|
|
60
83
|
*
|
|
61
84
|
* @param documentId - Document ID.
|
|
62
85
|
* @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
|
|
@@ -85,8 +108,6 @@ export declare interface ITokenResponse {
|
|
|
85
108
|
|
|
86
109
|
/* Excluded from this release type: RouterliciousDocumentServiceFactory */
|
|
87
110
|
|
|
88
|
-
/* Excluded from this release type: RouterliciousErrorType */
|
|
89
|
-
|
|
90
111
|
/* Excluded from this release type: RouterliciousErrorTypes */
|
|
91
112
|
|
|
92
113
|
export { }
|
|
@@ -18,6 +18,8 @@ import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
|
18
18
|
|
|
19
19
|
/* Excluded from this release type: IRouterliciousDriverPolicies */
|
|
20
20
|
|
|
21
|
+
/* Excluded from this release type: IRouterliciousResolvedUrl */
|
|
22
|
+
|
|
21
23
|
/**
|
|
22
24
|
* Abstracts the token fetching mechanism for a hosting application.
|
|
23
25
|
* The hosting application is responsible for providing an implementation.
|
|
@@ -61,8 +63,7 @@ export declare interface ITokenProvider {
|
|
|
61
63
|
*
|
|
62
64
|
* * Using the callback may have performance impact on the document creation process.
|
|
63
65
|
*
|
|
64
|
-
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
65
|
-
* (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
|
|
66
|
+
* * Any exceptions thrown in the callback would fail the creation workflow.
|
|
66
67
|
*
|
|
67
68
|
* @param documentId - Document ID.
|
|
68
69
|
* @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
|
|
@@ -91,8 +92,6 @@ export declare interface ITokenResponse {
|
|
|
91
92
|
|
|
92
93
|
/* Excluded from this release type: RouterliciousDocumentServiceFactory */
|
|
93
94
|
|
|
94
|
-
/* Excluded from this release type: RouterliciousErrorType */
|
|
95
|
-
|
|
96
95
|
/* Excluded from this release type: RouterliciousErrorTypes */
|
|
97
96
|
|
|
98
97
|
export { }
|
|
@@ -18,6 +18,8 @@ import { ITokenClaims } from '@fluidframework/protocol-definitions';
|
|
|
18
18
|
|
|
19
19
|
/* Excluded from this release type: IRouterliciousDriverPolicies */
|
|
20
20
|
|
|
21
|
+
/* Excluded from this release type: IRouterliciousResolvedUrl */
|
|
22
|
+
|
|
21
23
|
/**
|
|
22
24
|
* Abstracts the token fetching mechanism for a hosting application.
|
|
23
25
|
* The hosting application is responsible for providing an implementation.
|
|
@@ -61,8 +63,7 @@ export declare interface ITokenProvider {
|
|
|
61
63
|
*
|
|
62
64
|
* * Using the callback may have performance impact on the document creation process.
|
|
63
65
|
*
|
|
64
|
-
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
65
|
-
* (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
|
|
66
|
+
* * Any exceptions thrown in the callback would fail the creation workflow.
|
|
66
67
|
*
|
|
67
68
|
* @param documentId - Document ID.
|
|
68
69
|
* @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
|
|
@@ -91,8 +92,6 @@ export declare interface ITokenResponse {
|
|
|
91
92
|
|
|
92
93
|
/* Excluded from this release type: RouterliciousDocumentServiceFactory */
|
|
93
94
|
|
|
94
|
-
/* Excluded from this release type: RouterliciousErrorType */
|
|
95
|
-
|
|
96
95
|
/* Excluded from this release type: RouterliciousErrorTypes */
|
|
97
96
|
|
|
98
97
|
export { }
|
|
@@ -89,12 +89,30 @@ export declare interface IRouterliciousDriverPolicies {
|
|
|
89
89
|
* Default: true
|
|
90
90
|
*/
|
|
91
91
|
enableLongPollingDowngrade: boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Routerlicious extends the resolved url with additional properties to control Routerlicious-specific behaviors.
|
|
96
|
+
*
|
|
97
|
+
* @privateRemarks
|
|
98
|
+
* {@link isRouterliciousResolvedUrl} can be used to detect whether an {@link @fluidframework/driver-definitions#IResolvedUrl}
|
|
99
|
+
* is an IRouterliciousResolvedUrl.
|
|
100
|
+
*
|
|
101
|
+
* @alpha
|
|
102
|
+
*/
|
|
103
|
+
export declare interface IRouterliciousResolvedUrl extends IResolvedUrl {
|
|
92
104
|
/**
|
|
93
|
-
*
|
|
94
|
-
|
|
95
|
-
|
|
105
|
+
* A flag to facilitate type narrowing from {@link @fluidframework/driver-definitions#IResolvedUrl} to IRouterliciousResolvedUrl.
|
|
106
|
+
*/
|
|
107
|
+
routerliciousResolvedUrl: true;
|
|
108
|
+
/**
|
|
109
|
+
* Controls whether a newly created container will be ephemeral, which means the service will not retain it
|
|
110
|
+
* after the collaboration session ends. Only affects
|
|
111
|
+
* {@link @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer} requests.
|
|
112
|
+
*
|
|
113
|
+
* @defaultValue If left undefined, treated as `false`
|
|
96
114
|
*/
|
|
97
|
-
|
|
115
|
+
createAsEphemeral?: boolean;
|
|
98
116
|
}
|
|
99
117
|
|
|
100
118
|
/**
|
|
@@ -140,8 +158,7 @@ export declare interface ITokenProvider {
|
|
|
140
158
|
*
|
|
141
159
|
* * Using the callback may have performance impact on the document creation process.
|
|
142
160
|
*
|
|
143
|
-
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
144
|
-
* (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
|
|
161
|
+
* * Any exceptions thrown in the callback would fail the creation workflow.
|
|
145
162
|
*
|
|
146
163
|
* @param documentId - Document ID.
|
|
147
164
|
* @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
|
|
@@ -205,24 +222,6 @@ export declare class RouterliciousDocumentServiceFactory implements IDocumentSer
|
|
|
205
222
|
createDocumentService(resolvedUrl: IResolvedUrl, logger?: ITelemetryBaseLogger, clientIsSummarizer?: boolean, session?: ISession): Promise<IDocumentService>;
|
|
206
223
|
}
|
|
207
224
|
|
|
208
|
-
/**
|
|
209
|
-
* Routerlicious Error types
|
|
210
|
-
* Different error types that may be thrown by the routerlicious driver
|
|
211
|
-
*
|
|
212
|
-
* @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.
|
|
213
|
-
* @internal
|
|
214
|
-
*/
|
|
215
|
-
export declare enum RouterliciousErrorType {
|
|
216
|
-
/**
|
|
217
|
-
* File not found, or file deleted during session
|
|
218
|
-
*/
|
|
219
|
-
fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
|
|
220
|
-
/**
|
|
221
|
-
* SSL Certificate Error.
|
|
222
|
-
*/
|
|
223
|
-
sslCertError = "sslCertError"
|
|
224
|
-
}
|
|
225
|
-
|
|
226
225
|
/**
|
|
227
226
|
* Routerlicious Error types
|
|
228
227
|
* Different error types that may be thrown by the routerlicious driver
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
6
|
+
/**
|
|
7
|
+
* Routerlicious extends the resolved url with additional properties to control Routerlicious-specific behaviors.
|
|
8
|
+
*
|
|
9
|
+
* @privateRemarks
|
|
10
|
+
* {@link isRouterliciousResolvedUrl} can be used to detect whether an {@link @fluidframework/driver-definitions#IResolvedUrl}
|
|
11
|
+
* is an IRouterliciousResolvedUrl.
|
|
12
|
+
*
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
export interface IRouterliciousResolvedUrl extends IResolvedUrl {
|
|
16
|
+
/**
|
|
17
|
+
* A flag to facilitate type narrowing from {@link @fluidframework/driver-definitions#IResolvedUrl} to IRouterliciousResolvedUrl.
|
|
18
|
+
*/
|
|
19
|
+
routerliciousResolvedUrl: true;
|
|
20
|
+
/**
|
|
21
|
+
* Controls whether a newly created container will be ephemeral, which means the service will not retain it
|
|
22
|
+
* after the collaboration session ends. Only affects
|
|
23
|
+
* {@link @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer} requests.
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue If left undefined, treated as `false`
|
|
26
|
+
*/
|
|
27
|
+
createAsEphemeral?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Type guard to detect if an IResolvedUrl is an IRouterliciousResolvedUrl.
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare const isRouterliciousResolvedUrl: (resolvedUrl: IResolvedUrl) => resolvedUrl is IRouterliciousResolvedUrl;
|
|
34
|
+
//# sourceMappingURL=routerliciousResolvedUrl.d.ts.map
|