@fluidframework/routerlicious-driver 2.0.0-internal.5.3.2 → 2.0.0-internal.6.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/CHANGELOG.md +20 -0
- package/dist/contracts.d.ts +28 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaStorageService.d.ts.map +1 -1
- package/dist/deltaStorageService.js +17 -6
- package/dist/deltaStorageService.js.map +1 -1
- package/dist/documentDeltaConnection.js +1 -1
- package/dist/documentDeltaConnection.js.map +1 -1
- package/dist/documentService.d.ts +3 -3
- package/dist/documentService.d.ts.map +1 -1
- package/dist/documentService.js +1 -1
- package/dist/documentService.js.map +1 -1
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js +27 -8
- package/dist/documentServiceFactory.js.map +1 -1
- package/dist/documentStorageService.d.ts +2 -2
- package/dist/documentStorageService.d.ts.map +1 -1
- package/dist/documentStorageService.js +2 -2
- package/dist/documentStorageService.js.map +1 -1
- package/dist/errorUtils.d.ts +5 -6
- package/dist/errorUtils.d.ts.map +1 -1
- package/dist/errorUtils.js +13 -15
- package/dist/errorUtils.js.map +1 -1
- package/dist/gitManager.d.ts +3 -2
- package/dist/gitManager.d.ts.map +1 -1
- package/dist/gitManager.js +2 -2
- package/dist/gitManager.js.map +1 -1
- package/dist/historian.d.ts +3 -2
- package/dist/historian.d.ts.map +1 -1
- package/dist/historian.js +10 -3
- package/dist/historian.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/r11sSnapshotParser.d.ts +4 -5
- package/dist/r11sSnapshotParser.d.ts.map +1 -1
- package/dist/r11sSnapshotParser.js +12 -14
- package/dist/r11sSnapshotParser.js.map +1 -1
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/restWrapper.js +40 -24
- package/dist/restWrapper.js.map +1 -1
- package/dist/restWrapperBase.js +39 -5
- package/dist/restWrapperBase.js.map +1 -1
- package/dist/retriableGitManager.d.ts +3 -2
- package/dist/retriableGitManager.d.ts.map +1 -1
- package/dist/retriableGitManager.js +2 -2
- package/dist/retriableGitManager.js.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.js +10 -13
- package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/dist/storageContracts.d.ts +4 -3
- package/dist/storageContracts.d.ts.map +1 -1
- package/dist/storageContracts.js.map +1 -1
- package/dist/summaryTreeUploadManager.js +2 -3
- package/dist/summaryTreeUploadManager.js.map +1 -1
- package/dist/treeUtils.d.ts +2 -2
- package/dist/treeUtils.d.ts.map +1 -1
- package/dist/treeUtils.js +2 -3
- package/dist/treeUtils.js.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts +2 -2
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.js +20 -16
- package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
- package/dist/wholeSummaryUploadManager.js +1 -2
- package/dist/wholeSummaryUploadManager.js.map +1 -1
- package/lib/contracts.d.ts +28 -1
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contracts.js.map +1 -1
- package/lib/deltaStorageService.d.ts.map +1 -1
- package/lib/deltaStorageService.js +17 -6
- package/lib/deltaStorageService.js.map +1 -1
- package/lib/documentDeltaConnection.js +1 -1
- package/lib/documentDeltaConnection.js.map +1 -1
- package/lib/documentService.d.ts +3 -3
- package/lib/documentService.d.ts.map +1 -1
- package/lib/documentService.js +1 -1
- package/lib/documentService.js.map +1 -1
- package/lib/documentServiceFactory.d.ts.map +1 -1
- package/lib/documentServiceFactory.js +28 -9
- package/lib/documentServiceFactory.js.map +1 -1
- package/lib/documentStorageService.d.ts +2 -2
- package/lib/documentStorageService.d.ts.map +1 -1
- package/lib/documentStorageService.js +2 -2
- package/lib/documentStorageService.js.map +1 -1
- package/lib/errorUtils.d.ts +5 -6
- package/lib/errorUtils.d.ts.map +1 -1
- package/lib/errorUtils.js +13 -15
- package/lib/errorUtils.js.map +1 -1
- package/lib/gitManager.d.ts +3 -2
- package/lib/gitManager.d.ts.map +1 -1
- package/lib/gitManager.js +2 -2
- package/lib/gitManager.js.map +1 -1
- package/lib/historian.d.ts +3 -2
- package/lib/historian.d.ts.map +1 -1
- package/lib/historian.js +10 -3
- package/lib/historian.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/r11sSnapshotParser.d.ts +4 -5
- package/lib/r11sSnapshotParser.d.ts.map +1 -1
- package/lib/r11sSnapshotParser.js +10 -12
- package/lib/r11sSnapshotParser.js.map +1 -1
- package/lib/restWrapper.d.ts.map +1 -1
- package/lib/restWrapper.js +43 -27
- package/lib/restWrapper.js.map +1 -1
- package/lib/restWrapperBase.js +39 -5
- package/lib/restWrapperBase.js.map +1 -1
- package/lib/retriableGitManager.d.ts +3 -2
- package/lib/retriableGitManager.d.ts.map +1 -1
- package/lib/retriableGitManager.js +2 -2
- package/lib/retriableGitManager.js.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.js +11 -14
- package/lib/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/lib/storageContracts.d.ts +4 -3
- package/lib/storageContracts.d.ts.map +1 -1
- package/lib/storageContracts.js.map +1 -1
- package/lib/summaryTreeUploadManager.js +2 -3
- package/lib/summaryTreeUploadManager.js.map +1 -1
- package/lib/treeUtils.d.ts +2 -2
- package/lib/treeUtils.d.ts.map +1 -1
- package/lib/treeUtils.js +2 -3
- package/lib/treeUtils.js.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.d.ts +2 -2
- package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.js +21 -17
- package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
- package/lib/wholeSummaryUploadManager.js +1 -2
- package/lib/wholeSummaryUploadManager.js.map +1 -1
- package/package.json +13 -13
- package/src/contracts.ts +45 -1
- package/src/deltaStorageService.ts +8 -1
- package/src/documentService.ts +2 -2
- package/src/documentServiceFactory.ts +17 -10
- package/src/documentStorageService.ts +3 -3
- package/src/errorUtils.ts +23 -30
- package/src/gitManager.ts +3 -3
- package/src/historian.ts +3 -3
- package/src/packageVersion.ts +1 -1
- package/src/r11sSnapshotParser.ts +13 -14
- package/src/restWrapper.ts +29 -17
- package/src/retriableGitManager.ts +3 -3
- package/src/shreddedSummaryDocumentStorageService.ts +2 -2
- package/src/storageContracts.ts +3 -3
- package/src/treeUtils.ts +2 -2
- package/src/wholeSummaryDocumentStorageService.ts +12 -13
|
@@ -21,11 +21,11 @@ class DocumentStorageService extends driver_utils_1.DocumentStorageServiceProxy
|
|
|
21
21
|
return this._logTailSha;
|
|
22
22
|
}
|
|
23
23
|
static loadInternalDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, shreddedSummaryTreeCache, noCacheGitManager, getStorageManager) {
|
|
24
|
-
const storageService =
|
|
24
|
+
const storageService = driverPolicies?.enableWholeSummaryUpload
|
|
25
25
|
? new wholeSummaryDocumentStorageService_1.WholeSummaryDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager)
|
|
26
26
|
: new shreddedSummaryDocumentStorageService_1.ShreddedSummaryDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, shreddedSummaryTreeCache, getStorageManager);
|
|
27
27
|
// TODO: worth prefetching latest summary making version + snapshot call with WholeSummary storage?
|
|
28
|
-
if (!
|
|
28
|
+
if (!driverPolicies?.enableWholeSummaryUpload &&
|
|
29
29
|
policies.caching === driver_definitions_1.LoaderCachingPolicy.Prefetch) {
|
|
30
30
|
return new driver_utils_1.PrefetchDocumentStorageService(storageService);
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageService.js","sourceRoot":"","sources":["../src/documentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAI4C;AAE5C,+DAGsC;AAGtC,6FAA0F;AAC1F,mGAAgG;AAKhG,MAAa,sBAAuB,SAAQ,0CAA2B;IAmDtE,YACiB,EAAU,EACnB,OAAmB,EAC1B,MAA2B,EAC3B,QAAyC,EACzC,cAA6C,EAC7C,SAAmC,EACnC,
|
|
1
|
+
{"version":3,"file":"documentStorageService.js","sourceRoot":"","sources":["../src/documentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAI4C;AAE5C,+DAGsC;AAGtC,6FAA0F;AAC1F,mGAAgG;AAKhG,MAAa,sBAAuB,SAAQ,0CAA2B;IAmDtE,YACiB,EAAU,EACnB,OAAmB,EAC1B,MAA2B,EAC3B,QAAyC,EACzC,cAA6C,EAC7C,SAAmC,EACnC,iBAAoD,EACpD,wBAAuD,EAChD,iBAA8B,EACrC,iBAAmE;QAEnE,KAAK,CACJ,sBAAsB,CAAC,kCAAkC,CACxD,EAAE,EACF,OAAO,EACP,MAAM,EACN,QAAQ,EACR,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,CACjB,CACD,CAAC;QAxBc,OAAE,GAAF,EAAE,CAAQ;QACnB,YAAO,GAAP,OAAO,CAAY;QAOnB,sBAAiB,GAAjB,iBAAiB,CAAa;QA3D9B,gBAAW,GAAuB,SAAS,CAAC;IA4EpD,CAAC;IA1ED,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAEO,MAAM,CAAC,kCAAkC,CAChD,EAAU,EACV,OAAmB,EACnB,MAA2B,EAC3B,QAAyC,EACzC,cAA6C,EAC7C,SAAmC,EACnC,iBAAoD,EACpD,wBAAuD,EACvD,iBAA8B,EAC9B,iBAAmE;QAEnE,MAAM,cAAc,GAAG,cAAc,EAAE,wBAAwB;YAC9D,CAAC,CAAC,IAAI,uEAAkC,CACtC,EAAE,EACF,OAAO,EACP,MAAM,EACN,QAAQ,EACR,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,CAChB;YACH,CAAC,CAAC,IAAI,6EAAqC,CACzC,EAAE,EACF,OAAO,EACP,MAAM,EACN,QAAQ,EACR,cAAc,EACd,SAAS,EACT,wBAAwB,EACxB,iBAAiB,CAChB,CAAC;QACL,mGAAmG;QACnG,IACC,CAAC,cAAc,EAAE,wBAAwB;YACzC,QAAQ,CAAC,OAAO,KAAK,wCAAmB,CAAC,QAAQ,EAChD;YACD,OAAO,IAAI,6CAA8B,CAAC,cAAc,CAAC,CAAC;SAC1D;QACD,OAAO,cAAc,CAAC;IACvB,CAAC;IA8BM,KAAK,CAAC,eAAe,CAAC,OAAkB;QAC9C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACxE,IAAI,IAAI,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,WAAW;gBACf,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;SAC7E;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAvFD,wDAuFC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tLoaderCachingPolicy,\n} from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree, IVersion } from \"@fluidframework/protocol-definitions\";\nimport {\n\tDocumentStorageServiceProxy,\n\tPrefetchDocumentStorageService,\n} from \"@fluidframework/driver-utils\";\nimport { IRouterliciousDriverPolicies } from \"./policies\";\nimport { ICache } from \"./cache\";\nimport { WholeSummaryDocumentStorageService } from \"./wholeSummaryDocumentStorageService\";\nimport { ShreddedSummaryDocumentStorageService } from \"./shreddedSummaryDocumentStorageService\";\nimport { GitManager } from \"./gitManager\";\nimport { ISnapshotTreeVersion } from \"./definitions\";\nimport { INormalizedWholeSnapshot } from \"./contracts\";\n\nexport class DocumentStorageService extends DocumentStorageServiceProxy {\n\tprivate _logTailSha: string | undefined = undefined;\n\n\tpublic get logTailSha(): string | undefined {\n\t\treturn this._logTailSha;\n\t}\n\n\tprivate static loadInternalDocumentStorageService(\n\t\tid: string,\n\t\tmanager: GitManager,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tpolicies: IDocumentStorageServicePolicies,\n\t\tdriverPolicies?: IRouterliciousDriverPolicies,\n\t\tblobCache?: ICache<ArrayBufferLike>,\n\t\tsnapshotTreeCache?: ICache<INormalizedWholeSnapshot>,\n\t\tshreddedSummaryTreeCache?: ICache<ISnapshotTreeVersion>,\n\t\tnoCacheGitManager?: GitManager,\n\t\tgetStorageManager?: (disableCache?: boolean) => Promise<GitManager>,\n\t): IDocumentStorageService {\n\t\tconst storageService = driverPolicies?.enableWholeSummaryUpload\n\t\t\t? new WholeSummaryDocumentStorageService(\n\t\t\t\t\tid,\n\t\t\t\t\tmanager,\n\t\t\t\t\tlogger,\n\t\t\t\t\tpolicies,\n\t\t\t\t\tdriverPolicies,\n\t\t\t\t\tblobCache,\n\t\t\t\t\tsnapshotTreeCache,\n\t\t\t\t\tnoCacheGitManager,\n\t\t\t\t\tgetStorageManager,\n\t\t\t )\n\t\t\t: new ShreddedSummaryDocumentStorageService(\n\t\t\t\t\tid,\n\t\t\t\t\tmanager,\n\t\t\t\t\tlogger,\n\t\t\t\t\tpolicies,\n\t\t\t\t\tdriverPolicies,\n\t\t\t\t\tblobCache,\n\t\t\t\t\tshreddedSummaryTreeCache,\n\t\t\t\t\tgetStorageManager,\n\t\t\t );\n\t\t// TODO: worth prefetching latest summary making version + snapshot call with WholeSummary storage?\n\t\tif (\n\t\t\t!driverPolicies?.enableWholeSummaryUpload &&\n\t\t\tpolicies.caching === LoaderCachingPolicy.Prefetch\n\t\t) {\n\t\t\treturn new PrefetchDocumentStorageService(storageService);\n\t\t}\n\t\treturn storageService;\n\t}\n\n\tconstructor(\n\t\tpublic readonly id: string,\n\t\tpublic manager: GitManager,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tpolicies: IDocumentStorageServicePolicies,\n\t\tdriverPolicies?: IRouterliciousDriverPolicies,\n\t\tblobCache?: ICache<ArrayBufferLike>,\n\t\tsnapshotTreeCache?: ICache<INormalizedWholeSnapshot>,\n\t\tshreddedSummaryTreeCache?: ICache<ISnapshotTreeVersion>,\n\t\tpublic noCacheGitManager?: GitManager,\n\t\tgetStorageManager?: (disableCache?: boolean) => Promise<GitManager>,\n\t) {\n\t\tsuper(\n\t\t\tDocumentStorageService.loadInternalDocumentStorageService(\n\t\t\t\tid,\n\t\t\t\tmanager,\n\t\t\t\tlogger,\n\t\t\t\tpolicies,\n\t\t\t\tdriverPolicies,\n\t\t\t\tblobCache,\n\t\t\t\tsnapshotTreeCache,\n\t\t\t\tshreddedSummaryTreeCache,\n\t\t\t\tnoCacheGitManager,\n\t\t\t\tgetStorageManager,\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tconst tree = await this.internalStorageService.getSnapshotTree(version);\n\t\tif (tree !== null) {\n\t\t\tthis._logTailSha =\n\t\t\t\t\".logTail\" in tree.trees ? tree.trees[\".logTail\"].blobs.logTail : undefined;\n\t\t}\n\t\treturn tree;\n\t}\n}\n"]}
|
package/dist/errorUtils.d.ts
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { DriverError } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { DriverError, IDriverErrorBase } from "@fluidframework/driver-definitions";
|
|
6
|
+
import { IFluidErrorBase } from "@fluidframework/telemetry-utils";
|
|
6
7
|
/**
|
|
7
8
|
* Routerlicious Error types
|
|
8
9
|
* Different error types that may be thrown by the routerlicious driver
|
|
@@ -40,14 +41,12 @@ export interface IR11sSocketError {
|
|
|
40
41
|
*/
|
|
41
42
|
retryAfterMs?: number;
|
|
42
43
|
}
|
|
43
|
-
export interface IR11sError {
|
|
44
|
+
export interface IR11sError extends Omit<IDriverErrorBase, "errorType"> {
|
|
44
45
|
readonly errorType: RouterliciousErrorType;
|
|
45
|
-
readonly message: string;
|
|
46
|
-
canRetry: boolean;
|
|
47
46
|
}
|
|
48
47
|
export declare type R11sError = DriverError | IR11sError;
|
|
49
|
-
export declare function createR11sNetworkError(errorMessage: string, statusCode
|
|
50
|
-
export declare function throwR11sNetworkError(errorMessage: string, statusCode
|
|
48
|
+
export declare function createR11sNetworkError(errorMessage: string, statusCode: number, retryAfterMs?: number): IFluidErrorBase & R11sError;
|
|
49
|
+
export declare function throwR11sNetworkError(errorMessage: string, statusCode: number, retryAfterMs?: number): never;
|
|
51
50
|
/**
|
|
52
51
|
* Returns network error based on error object from R11s socket (IR11sSocketError)
|
|
53
52
|
*/
|
package/dist/errorUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorUtils.d.ts","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"errorUtils.d.ts","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAOnF,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGlE;;;GAGG;AACH,oBAAY,sBAAsB;IACjC;;OAEG;IACH,+BAA+B,oCAAoC;IAEnE,YAAY,iBAAiB;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC;IACtE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;CAC3C;AAED,oBAAY,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAEjD,wBAAgB,sBAAsB,CACrC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACnB,eAAe,GAAG,SAAS,CAgC7B;AAED,wBAAgB,qBAAqB,CACpC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACnB,KAAK,CAKP;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,MAAM,GACb,SAAS,CAIX"}
|
package/dist/errorUtils.js
CHANGED
|
@@ -20,35 +20,33 @@ var RouterliciousErrorType;
|
|
|
20
20
|
RouterliciousErrorType["sslCertError"] = "sslCertError";
|
|
21
21
|
})(RouterliciousErrorType = exports.RouterliciousErrorType || (exports.RouterliciousErrorType = {}));
|
|
22
22
|
function createR11sNetworkError(errorMessage, statusCode, retryAfterMs) {
|
|
23
|
+
let error;
|
|
23
24
|
const props = { statusCode, driverVersion: packageVersion_1.pkgVersion };
|
|
24
25
|
switch (statusCode) {
|
|
25
|
-
case undefined:
|
|
26
|
-
// If a service is temporarily down or a browser resource limit is reached, RestWrapper will throw
|
|
27
|
-
// a network error with no status code (e.g. err:ERR_CONN_REFUSED or err:ERR_FAILED) and
|
|
28
|
-
// the error message will start with NetworkError as defined in restWrapper.ts
|
|
29
|
-
// If there exists a self-signed SSL certificates error, throw a NonRetryableError
|
|
30
|
-
// TODO: instead of relying on string matching, filter error based on the error code like we do for websocket connections
|
|
31
|
-
if (errorMessage.includes("failed, reason: self signed certificate")) {
|
|
32
|
-
return new driver_utils_1.NonRetryableError(errorMessage, RouterliciousErrorType.sslCertError, props);
|
|
33
|
-
}
|
|
34
|
-
return new driver_utils_1.GenericNetworkError(errorMessage, errorMessage.startsWith("NetworkError"), props);
|
|
35
26
|
case 401:
|
|
36
27
|
// The first 401 is manually retried in RouterliciousRestWrapper with a refreshed token,
|
|
37
28
|
// so we treat repeat 401s the same as 403.
|
|
38
29
|
case 403:
|
|
39
|
-
|
|
30
|
+
error = new driver_utils_1.AuthorizationError(errorMessage, undefined, undefined, props);
|
|
31
|
+
break;
|
|
40
32
|
case 404:
|
|
41
33
|
const errorType = RouterliciousErrorType.fileNotFoundOrAccessDeniedError;
|
|
42
|
-
|
|
34
|
+
error = new driver_utils_1.NonRetryableError(errorMessage, errorType, props);
|
|
35
|
+
break;
|
|
43
36
|
case 429:
|
|
44
|
-
|
|
37
|
+
error = (0, driver_utils_1.createGenericNetworkError)(errorMessage, { canRetry: true, retryAfterMs }, props);
|
|
38
|
+
break;
|
|
45
39
|
case 500:
|
|
46
40
|
case 502:
|
|
47
|
-
|
|
41
|
+
error = new driver_utils_1.GenericNetworkError(errorMessage, true, props);
|
|
42
|
+
break;
|
|
48
43
|
default:
|
|
49
44
|
const retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };
|
|
50
|
-
|
|
45
|
+
error = (0, driver_utils_1.createGenericNetworkError)(errorMessage, retryInfo, props);
|
|
46
|
+
break;
|
|
51
47
|
}
|
|
48
|
+
error.addTelemetryProperties({ endpointReached: true });
|
|
49
|
+
return error;
|
|
52
50
|
}
|
|
53
51
|
exports.createR11sNetworkError = createR11sNetworkError;
|
|
54
52
|
function throwR11sNetworkError(errorMessage, statusCode, retryAfterMs) {
|
package/dist/errorUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAKsC;
|
|
1
|
+
{"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAKsC;AAEtC,qDAA+D;AAE/D;;;GAGG;AACH,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IACjC;;OAEG;IACH,6FAAmE,CAAA;IAEnE,uDAA6B,CAAA;AAC9B,CAAC,EAPW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAOjC;AAsCD,SAAgB,sBAAsB,CACrC,YAAoB,EACpB,UAAkB,EAClB,YAAqB;IAErB,IAAI,KAAkC,CAAC;IACvC,MAAM,KAAK,GAAG,EAAE,UAAU,EAAE,aAAa,EAAb,2BAAa,EAAE,CAAC;IAC5C,QAAQ,UAAU,EAAE;QACnB,KAAK,GAAG,CAAC;QACT,wFAAwF;QACxF,2CAA2C;QAC3C,KAAK,GAAG;YACP,KAAK,GAAG,IAAI,iCAAkB,CAAC,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAC1E,MAAM;QACP,KAAK,GAAG;YACP,MAAM,SAAS,GAAG,sBAAsB,CAAC,+BAA+B,CAAC;YACzE,KAAK,GAAG,IAAI,gCAAiB,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAC9D,MAAM;QACP,KAAK,GAAG;YACP,KAAK,GAAG,IAAA,wCAAyB,EAChC,YAAY,EACZ,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,EAChC,KAAK,CACL,CAAC;YACF,MAAM;QACP,KAAK,GAAG,CAAC;QACT,KAAK,GAAG;YACP,KAAK,GAAG,IAAI,kCAAmB,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC3D,MAAM;QACP;YACC,MAAM,SAAS,GAAG,EAAE,QAAQ,EAAE,YAAY,KAAK,SAAS,EAAE,YAAY,EAAE,CAAC;YACzE,KAAK,GAAG,IAAA,wCAAyB,EAAC,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;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 { DriverError, IDriverErrorBase } 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 */\nexport enum RouterliciousErrorType {\n\t/**\n\t * File not found, or file deleted during session\n\t */\n\tfileNotFoundOrAccessDeniedError = \"fileNotFoundOrAccessDeniedError\",\n\n\tsslCertError = \"sslCertError\",\n}\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: RouterliciousErrorType;\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 = RouterliciousErrorType.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/gitManager.d.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import * as resources from "@fluidframework/gitresources";
|
|
6
|
-
import {
|
|
6
|
+
import { IWholeSummaryPayload, IWriteSummaryResponse } from "@fluidframework/server-services-client";
|
|
7
7
|
import { IGitManager, IHistorian } from "./storageContracts";
|
|
8
8
|
import { IR11sResponse } from "./restWrapper";
|
|
9
|
+
import { IWholeFlatSnapshot } from "./contracts";
|
|
9
10
|
export declare class GitManager implements IGitManager {
|
|
10
11
|
private readonly historian;
|
|
11
12
|
private readonly blobCache;
|
|
@@ -25,6 +26,6 @@ export declare class GitManager implements IGitManager {
|
|
|
25
26
|
createBlob(content: string, encoding: "utf-8" | "base64"): Promise<IR11sResponse<resources.ICreateBlobResponse>>;
|
|
26
27
|
createGitTree(params: resources.ICreateTreeParams): Promise<IR11sResponse<resources.ITree>>;
|
|
27
28
|
createSummary(summary: IWholeSummaryPayload, initial?: boolean): Promise<IR11sResponse<IWriteSummaryResponse>>;
|
|
28
|
-
|
|
29
|
+
getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>>;
|
|
29
30
|
}
|
|
30
31
|
//# sourceMappingURL=gitManager.d.ts.map
|
package/dist/gitManager.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitManager.d.ts","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,SAAS,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"gitManager.d.ts","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,SAAS,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAiC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,qBAAa,UAAW,YAAW,WAAW;IAMjC,OAAO,CAAC,QAAQ,CAAC,SAAS;IALtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAChE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAwC;IACpE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAChE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;gBAEzB,SAAS,EAAE,UAAU;IAElD;;OAEG;IACU,UAAU,CACtB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC;IAuCrD;;OAEG;IACU,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAShF,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAQ7D,UAAU,CACtB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,OAAO,GAAG,QAAQ,GAC1B,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAQ3C,aAAa,CACzB,MAAM,EAAE,SAAS,CAAC,iBAAiB,GACjC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAK7B,aAAa,CACzB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,OAAe,GACtB,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAInC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAGjF"}
|
package/dist/gitManager.js
CHANGED
|
@@ -81,8 +81,8 @@ class GitManager {
|
|
|
81
81
|
async createSummary(summary, initial = false) {
|
|
82
82
|
return this.historian.createSummary(summary, initial);
|
|
83
83
|
}
|
|
84
|
-
async
|
|
85
|
-
return this.historian.
|
|
84
|
+
async getSnapshot(sha) {
|
|
85
|
+
return this.historian.getSnapshot(sha);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
exports.GitManager = GitManager;
|
package/dist/gitManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitManager.js","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"gitManager.js","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,+CAA6E;AAG7E,MAAa,UAAU;IAMtB,YAA6B,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;QALjC,cAAS,GAAG,IAAI,GAAG,EA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Content":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as resources from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { IGitManager, IHistorian } from \"./storageContracts\";\nimport { IR11sResponse, createR11sResponseFromContent } from \"./restWrapper\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport class GitManager implements IGitManager {\n\tprivate readonly blobCache = new Map<string, resources.IBlob>();\n\tprivate readonly commitCache = new Map<string, resources.ICommit>();\n\tprivate readonly treeCache = new Map<string, resources.ITree>();\n\tprivate readonly refCache = new Map<string, string>();\n\n\tconstructor(private readonly historian: IHistorian) {}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getCommits(\n\t\tshaOrRef: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<resources.ICommitDetails[]>> {\n\t\tlet sha: string | undefined = shaOrRef;\n\n\t\t// See if the sha is really a ref and convert\n\t\tif (this.refCache.has(shaOrRef)) {\n\t\t\tsha = this.refCache.get(shaOrRef);\n\n\t\t\t// Delete refcache after first use\n\t\t\tthis.refCache.delete(shaOrRef);\n\n\t\t\t// If null is stored for the ref then there are no commits - return an empty array\n\t\t\tif (!sha) {\n\t\t\t\treturn createR11sResponseFromContent([]);\n\t\t\t}\n\t\t}\n\n\t\t// See if the commit sha is hashed and return it if so\n\t\tconst commit = this.commitCache.get(sha);\n\t\tif (commit !== undefined) {\n\t\t\treturn createR11sResponseFromContent([\n\t\t\t\t{\n\t\t\t\t\tcommit: {\n\t\t\t\t\t\tauthor: commit.author,\n\t\t\t\t\t\tcommitter: commit.committer,\n\t\t\t\t\t\tmessage: commit.message,\n\t\t\t\t\t\ttree: commit.tree,\n\t\t\t\t\t\turl: commit.url,\n\t\t\t\t\t},\n\t\t\t\t\tparents: commit.parents,\n\t\t\t\t\tsha: commit.sha,\n\t\t\t\t\turl: commit.url,\n\t\t\t\t},\n\t\t\t]);\n\t\t}\n\n\t\t// Otherwise fall back to the historian\n\t\treturn this.historian.getCommits(sha, count);\n\t}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getTree(root: string, recursive = true): Promise<IR11sResponse<resources.ITree>> {\n\t\tconst tree = this.treeCache.get(root);\n\t\tif (tree !== undefined) {\n\t\t\treturn createR11sResponseFromContent(tree);\n\t\t}\n\n\t\treturn this.historian.getTree(root, recursive);\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>> {\n\t\tconst blob = this.blobCache.get(sha);\n\t\tif (blob !== undefined) {\n\t\t\treturn createR11sResponseFromContent(blob);\n\t\t}\n\t\treturn this.historian.getBlob(sha);\n\t}\n\n\tpublic async createBlob(\n\t\tcontent: string,\n\t\tencoding: \"utf-8\" | \"base64\",\n\t): Promise<IR11sResponse<resources.ICreateBlobResponse>> {\n\t\tconst blob: resources.ICreateBlobParams = {\n\t\t\tcontent,\n\t\t\tencoding,\n\t\t};\n\t\treturn this.historian.createBlob(blob);\n\t}\n\n\tpublic async createGitTree(\n\t\tparams: resources.ICreateTreeParams,\n\t): Promise<IR11sResponse<resources.ITree>> {\n\t\tconst treeP = this.historian.createTree(params);\n\t\treturn treeP;\n\t}\n\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial: boolean = false,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.historian.createSummary(summary, initial);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.historian.getSnapshot(sha);\n\t}\n}\n"]}
|
package/dist/historian.d.ts
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import * as git from "@fluidframework/gitresources";
|
|
6
|
-
import {
|
|
6
|
+
import { IWholeSummaryPayload, IWriteSummaryResponse } from "@fluidframework/server-services-client";
|
|
7
7
|
import { RestWrapper } from "./restWrapperBase";
|
|
8
8
|
import { IR11sResponse } from "./restWrapper";
|
|
9
9
|
import { IHistorian } from "./storageContracts";
|
|
10
|
+
import { IWholeFlatSnapshot } from "./contracts";
|
|
10
11
|
export interface ICredentials {
|
|
11
12
|
user: string;
|
|
12
13
|
password: string;
|
|
@@ -27,7 +28,7 @@ export declare class Historian implements IHistorian {
|
|
|
27
28
|
createTree(tree: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>>;
|
|
28
29
|
getTree(sha: string, recursive: boolean): Promise<IR11sResponse<git.ITree>>;
|
|
29
30
|
createSummary(summary: IWholeSummaryPayload, initial?: boolean): Promise<IR11sResponse<IWriteSummaryResponse>>;
|
|
30
|
-
|
|
31
|
+
getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>>;
|
|
31
32
|
private getQueryString;
|
|
32
33
|
}
|
|
33
34
|
//# sourceMappingURL=historian.d.ts.map
|
package/dist/historian.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"historian.d.ts","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACN,
|
|
1
|
+
{"version":3,"file":"historian.d.ts","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAmB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,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O,CAAC,cAAc;CAatB"}
|
package/dist/historian.js
CHANGED
|
@@ -51,14 +51,21 @@ class Historian {
|
|
|
51
51
|
async createSummary(summary, initial) {
|
|
52
52
|
return this.restWrapper.post(`/git/summaries`, summary, this.getQueryString(initial !== undefined ? { initial } : undefined));
|
|
53
53
|
}
|
|
54
|
-
async
|
|
54
|
+
async getSnapshot(sha) {
|
|
55
55
|
return this.restWrapper.get(`/git/summaries/${sha}`, this.getQueryString());
|
|
56
56
|
}
|
|
57
57
|
getQueryString(queryString) {
|
|
58
58
|
if (this.cacheBust) {
|
|
59
|
-
return
|
|
59
|
+
return {
|
|
60
|
+
cacheBust: Date.now(),
|
|
61
|
+
...this.defaultQueryString,
|
|
62
|
+
...queryString,
|
|
63
|
+
};
|
|
60
64
|
}
|
|
61
|
-
return
|
|
65
|
+
return {
|
|
66
|
+
...this.defaultQueryString,
|
|
67
|
+
...queryString,
|
|
68
|
+
};
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
71
|
exports.Historian = Historian;
|
package/dist/historian.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"historian.js","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAgE;AAgBzD,MAAM,oCAAoC,GAAG,CAAC,WAAyB,EAAU,EAAE,CACzF,SAAS,IAAA,+BAAgB,EAAC,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;AAD/D,QAAA,oCAAoC,wCAC2B;AAE5E;;GAEG;AACH,MAAa,SAAS;IAIrB,YACkB,YAAqB,EACtC,YAAqB,EACJ,WAAwB;QAFxB,iBAAY,GAAZ,YAAY,CAAS;QAErB,gBAAW,GAAX,WAAW,CAAa;QANzB,uBAAkB,GAAoB,EAAE,CAAC;QAQzD,IAAI,YAAY,IAAI,IAAI,CAAC,YAAY,EAAE;YACtC,IAAI,CAAC,kBAAkB,CAAC,YAAY,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AAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAC3B,gBAAgB,EAChB,OAAO,EACP,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CACpE,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAC1B,kBAAkB,GAAG,EAAE,EACvB,IAAI,CAAC,cAAc,EAAE,CACrB,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,WAA6B;QACnD,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,OAAO;gBACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,GAAG,IAAI,CAAC,kBAAkB;gBAC1B,GAAG,WAAW;aACd,CAAC;SACF;QACD,OAAO;YACN,GAAG,IAAI,CAAC,kBAAkB;YAC1B,GAAG,WAAW;SACd,CAAC;IACH,CAAC;CACD;AA7FD,8BA6FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromUtf8ToBase64 } from \"@fluidframework/common-utils\";\nimport * as git from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { QueryStringType, RestWrapper } from \"./restWrapperBase\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IHistorian } from \"./storageContracts\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport interface ICredentials {\n\tuser: string;\n\tpassword: string;\n}\n\nexport const getAuthorizationTokenFromCredentials = (credentials: ICredentials): string =>\n\t`Basic ${fromUtf8ToBase64(`${credentials.user}:${credentials.password}`)}`;\n\n/**\n * Implementation of the IHistorian interface that calls out to a REST interface\n */\nexport class Historian implements IHistorian {\n\tprivate readonly defaultQueryString: QueryStringType = {};\n\tprivate readonly cacheBust: boolean;\n\n\tconstructor(\n\t\tprivate readonly historianApi: boolean,\n\t\tdisableCache: boolean,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t) {\n\t\tif (disableCache && this.historianApi) {\n\t\t\tthis.defaultQueryString.disableCache = disableCache;\n\t\t\tthis.cacheBust = false;\n\t\t} else {\n\t\t\tthis.cacheBust = disableCache;\n\t\t}\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<git.IBlob>> {\n\t\treturn this.restWrapper.get<git.IBlob>(\n\t\t\t`/git/blobs/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: git.ICreateBlobParams,\n\t): Promise<IR11sResponse<git.ICreateBlobResponse>> {\n\t\treturn this.restWrapper.post<git.ICreateBlobResponse>(\n\t\t\t`/git/blobs`,\n\t\t\tblob,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<git.ICommitDetails[]>> {\n\t\treturn this.restWrapper\n\t\t\t.get<git.ICommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))\n\t\t\t.catch((error) =>\n\t\t\t\terror.statusCode === 400 || error.statusCode === 404\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcontent: [],\n\t\t\t\t\t\t\theaders: new Map(),\n\t\t\t\t\t\t\tpropsToLog: {},\n\t\t\t\t\t\t\trequestUrl: \"\",\n\t\t\t\t\t }\n\t\t\t\t\t: Promise.reject<IR11sResponse<git.ICommitDetails[]>>(error),\n\t\t\t);\n\t}\n\n\tpublic async createTree(tree: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.restWrapper.post<git.ITree>(`/git/trees`, tree, this.getQueryString());\n\t}\n\n\tpublic async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.restWrapper.get<git.ITree>(\n\t\t\t`/git/trees/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString({ recursive: recursive ? 1 : 0 }),\n\t\t);\n\t}\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.restWrapper.post<IWriteSummaryResponse>(\n\t\t\t`/git/summaries`,\n\t\t\tsummary,\n\t\t\tthis.getQueryString(initial !== undefined ? { initial } : undefined),\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.restWrapper.get<IWholeFlatSnapshot>(\n\t\t\t`/git/summaries/${sha}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tprivate getQueryString(queryString?: QueryStringType): QueryStringType {\n\t\tif (this.cacheBust) {\n\t\t\treturn {\n\t\t\t\tcacheBust: Date.now(),\n\t\t\t\t...this.defaultQueryString,\n\t\t\t\t...queryString,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...this.defaultQueryString,\n\t\t\t...queryString,\n\t\t};\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-internal.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.6.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-internal.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.6.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,sBAAsB,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-internal.
|
|
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,sBAAsB,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-internal.6.0.0\";\n"]}
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { INormalizedWholeSummary } from "./contracts";
|
|
5
|
+
import { INormalizedWholeSnapshot, IWholeFlatSnapshot } from "./contracts";
|
|
7
6
|
/**
|
|
8
|
-
* Converts existing
|
|
7
|
+
* Converts existing IWholeFlatSnapshot to snapshot tree, blob array, and sequence number.
|
|
9
8
|
*
|
|
10
|
-
* @param
|
|
9
|
+
* @param flatSnapshot - flat snapshot
|
|
11
10
|
* @param treePrefixToRemove - tree prefix to strip. By default we are stripping ".app" prefix
|
|
12
11
|
* @returns snapshot tree, blob array, and sequence number
|
|
13
12
|
*/
|
|
14
|
-
export declare function
|
|
13
|
+
export declare function convertWholeFlatSnapshotToSnapshotTreeAndBlobs(flatSnapshot: IWholeFlatSnapshot, treePrefixToRemove?: string): INormalizedWholeSnapshot;
|
|
15
14
|
//# sourceMappingURL=r11sSnapshotParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r11sSnapshotParser.d.ts","sourceRoot":"","sources":["../src/r11sSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
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;AA+CnG;;;;;;GAMG;AACH,wBAAgB,8CAA8C,CAC7D,YAAY,EAAE,kBAAkB,EAChC,kBAAkB,GAAE,MAAe,GACjC,wBAAwB,CAiB1B"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.convertWholeFlatSnapshotToSnapshotTreeAndBlobs = void 0;
|
|
8
8
|
const common_utils_1 = require("@fluidframework/common-utils");
|
|
9
9
|
/**
|
|
10
10
|
* Build a tree hierarchy from a flat tree.
|
|
@@ -46,30 +46,28 @@ function buildHierarchy(flatTree, treePrefixToRemove) {
|
|
|
46
46
|
return root;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* Converts existing
|
|
49
|
+
* Converts existing IWholeFlatSnapshot to snapshot tree, blob array, and sequence number.
|
|
50
50
|
*
|
|
51
|
-
* @param
|
|
51
|
+
* @param flatSnapshot - flat snapshot
|
|
52
52
|
* @param treePrefixToRemove - tree prefix to strip. By default we are stripping ".app" prefix
|
|
53
53
|
* @returns snapshot tree, blob array, and sequence number
|
|
54
54
|
*/
|
|
55
|
-
function
|
|
56
|
-
var _a;
|
|
55
|
+
function convertWholeFlatSnapshotToSnapshotTreeAndBlobs(flatSnapshot, treePrefixToRemove = ".app") {
|
|
57
56
|
const blobs = new Map();
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
blobs.set(blob.id, (0, common_utils_1.stringToBuffer)(blob.content, (_a = blob.encoding) !== null && _a !== void 0 ? _a : "utf-8"));
|
|
57
|
+
if (flatSnapshot.blobs) {
|
|
58
|
+
flatSnapshot.blobs.forEach((blob) => {
|
|
59
|
+
blobs.set(blob.id, (0, common_utils_1.stringToBuffer)(blob.content, blob.encoding ?? "utf-8"));
|
|
62
60
|
});
|
|
63
61
|
}
|
|
64
|
-
const
|
|
65
|
-
const sequenceNumber =
|
|
66
|
-
const snapshotTree = buildHierarchy(
|
|
62
|
+
const flatSnapshotTree = flatSnapshot.trees?.[0];
|
|
63
|
+
const sequenceNumber = flatSnapshotTree?.sequenceNumber;
|
|
64
|
+
const snapshotTree = buildHierarchy(flatSnapshotTree, treePrefixToRemove);
|
|
67
65
|
return {
|
|
68
66
|
blobs,
|
|
69
67
|
snapshotTree,
|
|
70
68
|
sequenceNumber,
|
|
71
|
-
id:
|
|
69
|
+
id: flatSnapshot.id,
|
|
72
70
|
};
|
|
73
71
|
}
|
|
74
|
-
exports.
|
|
72
|
+
exports.convertWholeFlatSnapshotToSnapshotTreeAndBlobs = convertWholeFlatSnapshotToSnapshotTreeAndBlobs;
|
|
75
73
|
//# sourceMappingURL=r11sSnapshotParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r11sSnapshotParser.js","sourceRoot":"","sources":["../src/r11sSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"r11sSnapsh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B;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE;YACjC,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;SACzD;aAAM;YACN,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;SACxC;KACD;IAED,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,8CAA8C,CAC7D,YAAgC,EAChC,qBAA6B,MAAM;IAEnC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC7C,IAAI,YAAY,CAAC,KAAK,EAAE;QACvB,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACnC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,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 \"@fluidframework/common-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};\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restWrapper.d.ts","sourceRoot":"","sources":["../src/restWrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EACN,mBAAmB,EAGnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,
|
|
1
|
+
{"version":3,"file":"restWrapper.d.ts","sourceRoot":"","sources":["../src/restWrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EACN,mBAAmB,EAGnB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAA0C,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAQnG,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,OAAO,CAAC;AAGrE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEjE,aAAK,yBAAyB,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,MAAM,CAAC;AACnE,oBAAY,YAAY,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAmB1E,MAAM,WA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