@fluidframework/routerlicious-driver 2.0.0-dev.3.1.0.125672 → 2.0.0-dev.4.2.0.153917
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 +5 -0
- package/README.md +38 -0
- package/dist/cache.js +2 -2
- package/dist/cache.js.map +1 -1
- package/dist/deltaStorageService.d.ts +1 -1
- package/dist/deltaStorageService.d.ts.map +1 -1
- package/dist/deltaStorageService.js +7 -4
- package/dist/deltaStorageService.js.map +1 -1
- package/dist/documentService.d.ts +4 -2
- package/dist/documentService.d.ts.map +1 -1
- package/dist/documentService.js +20 -12
- package/dist/documentService.js.map +1 -1
- package/dist/documentServiceFactory.d.ts +2 -2
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js +21 -12
- package/dist/documentServiceFactory.js.map +1 -1
- package/dist/documentStorageService.d.ts +3 -2
- package/dist/documentStorageService.d.ts.map +1 -1
- package/dist/documentStorageService.js +4 -4
- package/dist/documentStorageService.js.map +1 -1
- package/dist/errorUtils.d.ts +9 -2
- package/dist/errorUtils.d.ts.map +1 -1
- package/dist/errorUtils.js +15 -8
- package/dist/errorUtils.js.map +1 -1
- package/dist/gitManager.d.ts +30 -0
- package/dist/gitManager.d.ts.map +1 -0
- package/dist/gitManager.js +89 -0
- package/dist/gitManager.js.map +1 -0
- package/dist/historian.d.ts +33 -0
- package/dist/historian.d.ts.map +1 -0
- package/dist/historian.js +65 -0
- package/dist/historian.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/mapWithExpiration.d.ts +34 -0
- package/dist/mapWithExpiration.d.ts.map +1 -0
- package/dist/mapWithExpiration.js +105 -0
- package/dist/mapWithExpiration.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/restWrapper.d.ts +21 -8
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/restWrapper.js +93 -25
- package/dist/restWrapper.js.map +1 -1
- package/dist/restWrapperBase.d.ts +26 -0
- package/dist/restWrapperBase.d.ts.map +1 -0
- package/dist/restWrapperBase.js +55 -0
- package/dist/restWrapperBase.js.map +1 -0
- package/dist/retriableGitManager.d.ts +10 -21
- package/dist/retriableGitManager.d.ts.map +1 -1
- package/dist/retriableGitManager.js +0 -36
- package/dist/retriableGitManager.js.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.d.ts +1 -1
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.js +6 -6
- package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/dist/storageContracts.d.ts +44 -0
- package/dist/storageContracts.d.ts.map +1 -0
- package/dist/storageContracts.js +7 -0
- package/dist/storageContracts.js.map +1 -0
- package/dist/summaryTreeUploadManager.d.ts +23 -0
- package/dist/summaryTreeUploadManager.d.ts.map +1 -0
- package/dist/summaryTreeUploadManager.js +110 -0
- package/dist/summaryTreeUploadManager.js.map +1 -0
- package/dist/tokens.d.ts +24 -7
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js.map +1 -1
- package/dist/treeUtils.d.ts +58 -0
- package/dist/treeUtils.d.ts.map +1 -0
- package/dist/treeUtils.js +107 -0
- package/dist/treeUtils.js.map +1 -0
- package/dist/wholeSummaryDocumentStorageService.d.ts +5 -4
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.js +70 -38
- package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
- package/dist/wholeSummaryUploadManager.d.ts +16 -0
- package/dist/wholeSummaryUploadManager.d.ts.map +1 -0
- package/dist/wholeSummaryUploadManager.js +38 -0
- package/dist/wholeSummaryUploadManager.js.map +1 -0
- package/lib/cache.js +1 -1
- package/lib/cache.js.map +1 -1
- package/lib/deltaStorageService.d.ts +1 -1
- package/lib/deltaStorageService.d.ts.map +1 -1
- package/lib/deltaStorageService.js +7 -4
- package/lib/deltaStorageService.js.map +1 -1
- package/lib/documentService.d.ts +4 -2
- package/lib/documentService.d.ts.map +1 -1
- package/lib/documentService.js +20 -12
- package/lib/documentService.js.map +1 -1
- package/lib/documentServiceFactory.d.ts +2 -2
- package/lib/documentServiceFactory.d.ts.map +1 -1
- package/lib/documentServiceFactory.js +22 -13
- package/lib/documentServiceFactory.js.map +1 -1
- package/lib/documentStorageService.d.ts +3 -2
- package/lib/documentStorageService.d.ts.map +1 -1
- package/lib/documentStorageService.js +4 -4
- package/lib/documentStorageService.js.map +1 -1
- package/lib/errorUtils.d.ts +9 -2
- package/lib/errorUtils.d.ts.map +1 -1
- package/lib/errorUtils.js +14 -7
- package/lib/errorUtils.js.map +1 -1
- package/lib/gitManager.d.ts +30 -0
- package/lib/gitManager.d.ts.map +1 -0
- package/lib/gitManager.js +85 -0
- package/lib/gitManager.js.map +1 -0
- package/lib/historian.d.ts +33 -0
- package/lib/historian.d.ts.map +1 -0
- package/lib/historian.js +60 -0
- package/lib/historian.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/mapWithExpiration.d.ts +34 -0
- package/lib/mapWithExpiration.d.ts.map +1 -0
- package/lib/mapWithExpiration.js +101 -0
- package/lib/mapWithExpiration.js.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/restWrapper.d.ts +21 -8
- package/lib/restWrapper.d.ts.map +1 -1
- package/lib/restWrapper.js +92 -26
- package/lib/restWrapper.js.map +1 -1
- package/lib/restWrapperBase.d.ts +26 -0
- package/lib/restWrapperBase.d.ts.map +1 -0
- package/lib/restWrapperBase.js +50 -0
- package/lib/restWrapperBase.js.map +1 -0
- package/lib/retriableGitManager.d.ts +10 -21
- package/lib/retriableGitManager.d.ts.map +1 -1
- package/lib/retriableGitManager.js +0 -36
- package/lib/retriableGitManager.js.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.d.ts +1 -1
- package/lib/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.js +5 -5
- package/lib/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/lib/storageContracts.d.ts +44 -0
- package/lib/storageContracts.d.ts.map +1 -0
- package/lib/storageContracts.js +6 -0
- package/lib/storageContracts.js.map +1 -0
- package/lib/summaryTreeUploadManager.d.ts +23 -0
- package/lib/summaryTreeUploadManager.d.ts.map +1 -0
- package/lib/summaryTreeUploadManager.js +106 -0
- package/lib/summaryTreeUploadManager.js.map +1 -0
- package/lib/tokens.d.ts +24 -7
- package/lib/tokens.d.ts.map +1 -1
- package/lib/tokens.js.map +1 -1
- package/lib/treeUtils.d.ts +58 -0
- package/lib/treeUtils.d.ts.map +1 -0
- package/lib/treeUtils.js +100 -0
- package/lib/treeUtils.js.map +1 -0
- package/lib/wholeSummaryDocumentStorageService.d.ts +5 -4
- package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.js +70 -38
- package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
- package/lib/wholeSummaryUploadManager.d.ts +16 -0
- package/lib/wholeSummaryUploadManager.d.ts.map +1 -0
- package/lib/wholeSummaryUploadManager.js +34 -0
- package/lib/wholeSummaryUploadManager.js.map +1 -0
- package/package.json +52 -54
- package/src/cache.ts +1 -1
- package/src/deltaStorageService.ts +11 -3
- package/src/documentService.ts +37 -22
- package/src/documentServiceFactory.ts +40 -21
- package/src/documentStorageService.ts +8 -4
- package/src/errorUtils.ts +16 -4
- package/src/gitManager.ts +116 -0
- package/src/historian.ts +121 -0
- package/src/index.ts +3 -0
- package/src/mapWithExpiration.ts +124 -0
- package/src/packageVersion.ts +1 -1
- package/src/restWrapper.ts +114 -38
- package/src/restWrapperBase.ts +146 -0
- package/src/retriableGitManager.ts +17 -95
- package/src/shreddedSummaryDocumentStorageService.ts +7 -9
- package/src/storageContracts.ts +63 -0
- package/src/summaryTreeUploadManager.ts +160 -0
- package/src/tokens.ts +24 -7
- package/src/treeUtils.ts +137 -0
- package/src/wholeSummaryDocumentStorageService.ts +118 -46
- package/src/wholeSummaryUploadManager.ts +64 -0
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import type { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
6
|
import { IDocumentStorageServicePolicies } from "@fluidframework/driver-definitions";
|
|
7
7
|
import { ISnapshotTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
8
|
-
import { GitManager } from "@fluidframework/server-services-client";
|
|
9
8
|
import { DocumentStorageServiceProxy } from "@fluidframework/driver-utils";
|
|
9
|
+
import { INormalizedWholeSummary } from "@fluidframework/server-services-client";
|
|
10
10
|
import { IRouterliciousDriverPolicies } from "./policies";
|
|
11
11
|
import { ICache } from "./cache";
|
|
12
|
+
import { GitManager } from "./gitManager";
|
|
12
13
|
import { ISnapshotTreeVersion } from "./definitions";
|
|
13
14
|
export declare class DocumentStorageService extends DocumentStorageServiceProxy {
|
|
14
15
|
readonly id: string;
|
|
@@ -17,7 +18,7 @@ export declare class DocumentStorageService extends DocumentStorageServiceProxy
|
|
|
17
18
|
private _logTailSha;
|
|
18
19
|
get logTailSha(): string | undefined;
|
|
19
20
|
private static loadInternalDocumentStorageService;
|
|
20
|
-
constructor(id: string, manager: GitManager, logger: ITelemetryLogger, policies: IDocumentStorageServicePolicies, driverPolicies?: IRouterliciousDriverPolicies, blobCache?: ICache<ArrayBufferLike>, snapshotTreeCache?: ICache<ISnapshotTreeVersion>, noCacheGitManager?: GitManager | undefined, getStorageManager?: (disableCache?: boolean) => Promise<GitManager>);
|
|
21
|
+
constructor(id: string, manager: GitManager, logger: ITelemetryLogger, policies: IDocumentStorageServicePolicies, driverPolicies?: IRouterliciousDriverPolicies, blobCache?: ICache<ArrayBufferLike>, snapshotTreeCache?: ICache<INormalizedWholeSummary>, shreddedSummaryTreeCache?: ICache<ISnapshotTreeVersion>, noCacheGitManager?: GitManager | undefined, getStorageManager?: (disableCache?: boolean) => Promise<GitManager>);
|
|
21
22
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
22
23
|
}
|
|
23
24
|
//# sourceMappingURL=documentStorageService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageService.d.ts","sourceRoot":"","sources":["../src/documentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAEN,+BAA+B,EAE/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"documentStorageService.d.ts","sourceRoot":"","sources":["../src/documentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAEN,+BAA+B,EAE/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EACN,2BAA2B,EAE3B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAErD,qBAAa,sBAAuB,SAAQ,2BAA2B;aAoDrD,EAAE,EAAE,MAAM;IACnB,OAAO,EAAE,UAAU;IAOnB,iBAAiB,CAAC;IA3D1B,OAAO,CAAC,WAAW,CAAiC;IAEpD,IAAW,UAAU,IAAI,MAAM,GAAG,SAAS,CAE1C;IAED,OAAO,CAAC,MAAM,CAAC,kCAAkC;gBA6ChC,EAAE,EAAE,MAAM,EACnB,OAAO,EAAE,UAAU,EAC1B,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,+BAA+B,EACzC,cAAc,CAAC,EAAE,4BAA4B,EAC7C,SAAS,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,EACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC,uBAAuB,CAAC,EACnD,wBAAwB,CAAC,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAChD,iBAAiB,CAAC,wBAAY,EACrC,iBAAiB,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC;IAkBvD,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;CAQ/E"}
|
|
@@ -10,8 +10,8 @@ const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
|
10
10
|
const wholeSummaryDocumentStorageService_1 = require("./wholeSummaryDocumentStorageService");
|
|
11
11
|
const shreddedSummaryDocumentStorageService_1 = require("./shreddedSummaryDocumentStorageService");
|
|
12
12
|
class DocumentStorageService extends driver_utils_1.DocumentStorageServiceProxy {
|
|
13
|
-
constructor(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager) {
|
|
14
|
-
super(DocumentStorageService.loadInternalDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager));
|
|
13
|
+
constructor(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, shreddedSummaryTreeCache, noCacheGitManager, getStorageManager) {
|
|
14
|
+
super(DocumentStorageService.loadInternalDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, shreddedSummaryTreeCache, noCacheGitManager, getStorageManager));
|
|
15
15
|
this.id = id;
|
|
16
16
|
this.manager = manager;
|
|
17
17
|
this.noCacheGitManager = noCacheGitManager;
|
|
@@ -20,10 +20,10 @@ class DocumentStorageService extends driver_utils_1.DocumentStorageServiceProxy
|
|
|
20
20
|
get logTailSha() {
|
|
21
21
|
return this._logTailSha;
|
|
22
22
|
}
|
|
23
|
-
static loadInternalDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager) {
|
|
23
|
+
static loadInternalDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, shreddedSummaryTreeCache, noCacheGitManager, getStorageManager) {
|
|
24
24
|
const storageService = (driverPolicies === null || driverPolicies === void 0 ? void 0 : driverPolicies.enableWholeSummaryUpload)
|
|
25
25
|
? new wholeSummaryDocumentStorageService_1.WholeSummaryDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager)
|
|
26
|
-
: new shreddedSummaryDocumentStorageService_1.ShreddedSummaryDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache,
|
|
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
28
|
if (!(driverPolicies === null || driverPolicies === void 0 ? void 0 : driverPolicies.enableWholeSummaryUpload) &&
|
|
29
29
|
policies.caching === driver_definitions_1.LoaderCachingPolicy.Prefetch) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageService.js","sourceRoot":"","sources":["../src/documentStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2EAI4C;
|
|
1
|
+
{"version":3,"file":"documentStorageService.js","sourceRoot":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GAAmG;QACnG,IACC,CAAC,CAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,wBAAwB,CAAA;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 type { ITelemetryLogger } from \"@fluidframework/common-definitions\";\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 { INormalizedWholeSummary } from \"@fluidframework/server-services-client\";\nimport { IRouterliciousDriverPolicies } from \"./policies\";\nimport { ICache } from \"./cache\";\nimport { WholeSummaryDocumentStorageService } from \"./wholeSummaryDocumentStorageService\";\nimport { ShreddedSummaryDocumentStorageService } from \"./shreddedSummaryDocumentStorageService\";\nimport { GitManager } from \"./gitManager\";\nimport { ISnapshotTreeVersion } from \"./definitions\";\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: ITelemetryLogger,\n\t\tpolicies: IDocumentStorageServicePolicies,\n\t\tdriverPolicies?: IRouterliciousDriverPolicies,\n\t\tblobCache?: ICache<ArrayBufferLike>,\n\t\tsnapshotTreeCache?: ICache<INormalizedWholeSummary>,\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: ITelemetryLogger,\n\t\tpolicies: IDocumentStorageServicePolicies,\n\t\tdriverPolicies?: IRouterliciousDriverPolicies,\n\t\tblobCache?: ICache<ArrayBufferLike>,\n\t\tsnapshotTreeCache?: ICache<INormalizedWholeSummary>,\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
|
@@ -3,7 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { DriverError } from "@fluidframework/driver-definitions";
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Routerlicious Error types
|
|
8
|
+
* Different error types that may be thrown by the routerlicious driver
|
|
9
|
+
*/
|
|
10
|
+
export declare enum RouterliciousErrorType {
|
|
11
|
+
/**
|
|
12
|
+
* File not found, or file deleted during session
|
|
13
|
+
*/
|
|
7
14
|
fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
|
|
8
15
|
sslCertError = "sslCertError"
|
|
9
16
|
}
|
|
@@ -34,7 +41,7 @@ export interface IR11sSocketError {
|
|
|
34
41
|
retryAfterMs?: number;
|
|
35
42
|
}
|
|
36
43
|
export interface IR11sError {
|
|
37
|
-
readonly errorType:
|
|
44
|
+
readonly errorType: RouterliciousErrorType;
|
|
38
45
|
readonly message: string;
|
|
39
46
|
canRetry: boolean;
|
|
40
47
|
}
|
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;AASjE,oBAAY,
|
|
1
|
+
{"version":3,"file":"errorUtils.d.ts","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AASjE;;;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,UAAU;IAC1B,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;CAClB;AAED,oBAAY,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAEjD,wBAAgB,sBAAsB,CACrC,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,MAAM,GACnB,SAAS,CAsCX;AAED,wBAAgB,qBAAqB,CACpC,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,MAAM,EACnB,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
|
@@ -4,14 +4,21 @@
|
|
|
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.RouterliciousErrorType = void 0;
|
|
8
8
|
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
9
9
|
const packageVersion_1 = require("./packageVersion");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Routerlicious Error types
|
|
12
|
+
* Different error types that may be thrown by the routerlicious driver
|
|
13
|
+
*/
|
|
14
|
+
var RouterliciousErrorType;
|
|
15
|
+
(function (RouterliciousErrorType) {
|
|
16
|
+
/**
|
|
17
|
+
* File not found, or file deleted during session
|
|
18
|
+
*/
|
|
19
|
+
RouterliciousErrorType["fileNotFoundOrAccessDeniedError"] = "fileNotFoundOrAccessDeniedError";
|
|
20
|
+
RouterliciousErrorType["sslCertError"] = "sslCertError";
|
|
21
|
+
})(RouterliciousErrorType = exports.RouterliciousErrorType || (exports.RouterliciousErrorType = {}));
|
|
15
22
|
function createR11sNetworkError(errorMessage, statusCode, retryAfterMs) {
|
|
16
23
|
const props = { statusCode, driverVersion: packageVersion_1.pkgVersion };
|
|
17
24
|
switch (statusCode) {
|
|
@@ -22,7 +29,7 @@ function createR11sNetworkError(errorMessage, statusCode, retryAfterMs) {
|
|
|
22
29
|
// If there exists a self-signed SSL certificates error, throw a NonRetryableError
|
|
23
30
|
// TODO: instead of relying on string matching, filter error based on the error code like we do for websocket connections
|
|
24
31
|
if (errorMessage.includes("failed, reason: self signed certificate")) {
|
|
25
|
-
return new driver_utils_1.NonRetryableError(errorMessage,
|
|
32
|
+
return new driver_utils_1.NonRetryableError(errorMessage, RouterliciousErrorType.sslCertError, props);
|
|
26
33
|
}
|
|
27
34
|
return new driver_utils_1.GenericNetworkError(errorMessage, errorMessage.startsWith("NetworkError"), props);
|
|
28
35
|
case 401:
|
|
@@ -31,7 +38,7 @@ function createR11sNetworkError(errorMessage, statusCode, retryAfterMs) {
|
|
|
31
38
|
case 403:
|
|
32
39
|
return new driver_utils_1.AuthorizationError(errorMessage, undefined, undefined, props);
|
|
33
40
|
case 404:
|
|
34
|
-
const errorType =
|
|
41
|
+
const errorType = RouterliciousErrorType.fileNotFoundOrAccessDeniedError;
|
|
35
42
|
return new driver_utils_1.NonRetryableError(errorMessage, errorType, props);
|
|
36
43
|
case 429:
|
|
37
44
|
return (0, driver_utils_1.createGenericNetworkError)(errorMessage, { canRetry: true, retryAfterMs }, props);
|
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;AACtC,qDAA+D;AAE/D,IAAY,
|
|
1
|
+
{"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAKsC;AACtC,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;AAwCD,SAAgB,sBAAsB,CACrC,Y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B,qBAAqB,CACpC,YAAoB,EACpB,UAAmB,EACnB,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 } from \"@fluidframework/driver-definitions\";\nimport {\n\tNonRetryableError,\n\tGenericNetworkError,\n\tcreateGenericNetworkError,\n\tAuthorizationError,\n} from \"@fluidframework/driver-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 {\n\treadonly errorType: RouterliciousErrorType;\n\treadonly message: string;\n\tcanRetry: boolean;\n}\n\nexport type R11sError = DriverError | IR11sError;\n\nexport function createR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode?: number,\n\tretryAfterMs?: number,\n): R11sError {\n\tconst props = { statusCode, driverVersion };\n\tswitch (statusCode) {\n\t\tcase undefined:\n\t\t\t// If a service is temporarily down or a browser resource limit is reached, RestWrapper will throw\n\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// the error message will start with NetworkError as defined in restWrapper.ts\n\t\t\t// If there exists a self-signed SSL certificates error, throw a NonRetryableError\n\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\tif (errorMessage.includes(\"failed, reason: self signed certificate\")) {\n\t\t\t\treturn new NonRetryableError(\n\t\t\t\t\terrorMessage,\n\t\t\t\t\tRouterliciousErrorType.sslCertError,\n\t\t\t\t\tprops,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn new GenericNetworkError(\n\t\t\t\terrorMessage,\n\t\t\t\terrorMessage.startsWith(\"NetworkError\"),\n\t\t\t\tprops,\n\t\t\t);\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\treturn new AuthorizationError(errorMessage, undefined, undefined, props);\n\t\tcase 404:\n\t\t\tconst errorType = RouterliciousErrorType.fileNotFoundOrAccessDeniedError;\n\t\t\treturn new NonRetryableError(errorMessage, errorType, props);\n\t\tcase 429:\n\t\t\treturn createGenericNetworkError(errorMessage, { canRetry: true, retryAfterMs }, props);\n\t\tcase 500:\n\t\tcase 502:\n\t\t\treturn new GenericNetworkError(errorMessage, true, props);\n\t\tdefault:\n\t\t\tconst retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };\n\t\t\treturn createGenericNetworkError(errorMessage, retryInfo, props);\n\t}\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"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import * as resources from "@fluidframework/gitresources";
|
|
6
|
+
import { IWholeFlatSummary, IWholeSummaryPayload, IWriteSummaryResponse } from "@fluidframework/server-services-client";
|
|
7
|
+
import { IGitManager, IHistorian } from "./storageContracts";
|
|
8
|
+
import { IR11sResponse } from "./restWrapper";
|
|
9
|
+
export declare class GitManager implements IGitManager {
|
|
10
|
+
private readonly historian;
|
|
11
|
+
private readonly blobCache;
|
|
12
|
+
private readonly commitCache;
|
|
13
|
+
private readonly treeCache;
|
|
14
|
+
private readonly refCache;
|
|
15
|
+
constructor(historian: IHistorian);
|
|
16
|
+
/**
|
|
17
|
+
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
18
|
+
*/
|
|
19
|
+
getCommits(shaOrRef: string, count: number): Promise<IR11sResponse<resources.ICommitDetails[]>>;
|
|
20
|
+
/**
|
|
21
|
+
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
22
|
+
*/
|
|
23
|
+
getTree(root: string, recursive?: boolean): Promise<IR11sResponse<resources.ITree>>;
|
|
24
|
+
getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>>;
|
|
25
|
+
createBlob(content: string, encoding: "utf-8" | "base64"): Promise<IR11sResponse<resources.ICreateBlobResponse>>;
|
|
26
|
+
createGitTree(params: resources.ICreateTreeParams): Promise<IR11sResponse<resources.ITree>>;
|
|
27
|
+
createSummary(summary: IWholeSummaryPayload, initial?: boolean): Promise<IR11sResponse<IWriteSummaryResponse>>;
|
|
28
|
+
getSummary(sha: string): Promise<IR11sResponse<IWholeFlatSummary>>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=gitManager.d.ts.map
|
|
@@ -0,0 +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,iBAAiB,EACjB,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;AAE7E,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,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAG/E"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.GitManager = void 0;
|
|
8
|
+
const restWrapper_1 = require("./restWrapper");
|
|
9
|
+
class GitManager {
|
|
10
|
+
constructor(historian) {
|
|
11
|
+
this.historian = historian;
|
|
12
|
+
this.blobCache = new Map();
|
|
13
|
+
this.commitCache = new Map();
|
|
14
|
+
this.treeCache = new Map();
|
|
15
|
+
this.refCache = new Map();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
19
|
+
*/
|
|
20
|
+
async getCommits(shaOrRef, count) {
|
|
21
|
+
let sha = shaOrRef;
|
|
22
|
+
// See if the sha is really a ref and convert
|
|
23
|
+
if (this.refCache.has(shaOrRef)) {
|
|
24
|
+
sha = this.refCache.get(shaOrRef);
|
|
25
|
+
// Delete refcache after first use
|
|
26
|
+
this.refCache.delete(shaOrRef);
|
|
27
|
+
// If null is stored for the ref then there are no commits - return an empty array
|
|
28
|
+
if (!sha) {
|
|
29
|
+
return (0, restWrapper_1.createR11sResponseFromContent)([]);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// See if the commit sha is hashed and return it if so
|
|
33
|
+
const commit = this.commitCache.get(sha);
|
|
34
|
+
if (commit !== undefined) {
|
|
35
|
+
return (0, restWrapper_1.createR11sResponseFromContent)([
|
|
36
|
+
{
|
|
37
|
+
commit: {
|
|
38
|
+
author: commit.author,
|
|
39
|
+
committer: commit.committer,
|
|
40
|
+
message: commit.message,
|
|
41
|
+
tree: commit.tree,
|
|
42
|
+
url: commit.url,
|
|
43
|
+
},
|
|
44
|
+
parents: commit.parents,
|
|
45
|
+
sha: commit.sha,
|
|
46
|
+
url: commit.url,
|
|
47
|
+
},
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
// Otherwise fall back to the historian
|
|
51
|
+
return this.historian.getCommits(sha, count);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
55
|
+
*/
|
|
56
|
+
async getTree(root, recursive = true) {
|
|
57
|
+
const tree = this.treeCache.get(root);
|
|
58
|
+
if (tree !== undefined) {
|
|
59
|
+
return (0, restWrapper_1.createR11sResponseFromContent)(tree);
|
|
60
|
+
}
|
|
61
|
+
return this.historian.getTree(root, recursive);
|
|
62
|
+
}
|
|
63
|
+
async getBlob(sha) {
|
|
64
|
+
const blob = this.blobCache.get(sha);
|
|
65
|
+
if (blob !== undefined) {
|
|
66
|
+
return (0, restWrapper_1.createR11sResponseFromContent)(blob);
|
|
67
|
+
}
|
|
68
|
+
return this.historian.getBlob(sha);
|
|
69
|
+
}
|
|
70
|
+
async createBlob(content, encoding) {
|
|
71
|
+
const blob = {
|
|
72
|
+
content,
|
|
73
|
+
encoding,
|
|
74
|
+
};
|
|
75
|
+
return this.historian.createBlob(blob);
|
|
76
|
+
}
|
|
77
|
+
async createGitTree(params) {
|
|
78
|
+
const treeP = this.historian.createTree(params);
|
|
79
|
+
return treeP;
|
|
80
|
+
}
|
|
81
|
+
async createSummary(summary, initial = false) {
|
|
82
|
+
return this.historian.createSummary(summary, initial);
|
|
83
|
+
}
|
|
84
|
+
async getSummary(sha) {
|
|
85
|
+
return this.historian.getSummary(sha);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.GitManager = GitManager;
|
|
89
|
+
//# sourceMappingURL=gitManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitManager.js","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,+CAA6E;AAE7E,MAAa,UAAU;IAMtB,YAA6B,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;QALjC,cAAS,GAAG,IAAI,GAAG,EAA2B,CAAC;QAC/C,gBAAW,GAAG,IAAI,GAAG,EAA6B,CAAC;QACnD,cAAS,GAAG,IAAI,GAAG,EAA2B,CAAC;QAC/C,aAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAED,CAAC;IAEtD;;OAEG;IACI,KAAK,CAAC,UAAU,CACtB,QAAgB,EAChB,KAAa;QAEb,IAAI,GAAG,GAAuB,QAAQ,CAAC;QAEvC,6CAA6C;QAC7C,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAChC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAElC,kCAAkC;YAClC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAE/B,kFAAkF;YAClF,IAAI,CAAC,GAAG,EAAE;gBACT,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,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,OAAe,EACf,QAA4B;QAE5B,MAAM,IAAI,GAAgC;YACzC,OAAO;YACP,QAAQ;SACR,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,MAAmC;QAEnC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,OAA6B,EAC7B,UAAmB,KAAK;QAExB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,GAAW;QAClC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CACD;AArGD,gCAqGC","sourcesContent":["/*!\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\tIWholeFlatSummary,\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { IGitManager, IHistorian } from \"./storageContracts\";\nimport { IR11sResponse, createR11sResponseFromContent } from \"./restWrapper\";\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 getSummary(sha: string): Promise<IR11sResponse<IWholeFlatSummary>> {\n\t\treturn this.historian.getSummary(sha);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import * as git from "@fluidframework/gitresources";
|
|
6
|
+
import { IWholeFlatSummary, IWholeSummaryPayload, IWriteSummaryResponse } from "@fluidframework/server-services-client";
|
|
7
|
+
import { RestWrapper } from "./restWrapperBase";
|
|
8
|
+
import { IR11sResponse } from "./restWrapper";
|
|
9
|
+
import { IHistorian } from "./storageContracts";
|
|
10
|
+
export interface ICredentials {
|
|
11
|
+
user: string;
|
|
12
|
+
password: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const getAuthorizationTokenFromCredentials: (credentials: ICredentials) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Implementation of the IHistorian interface that calls out to a REST interface
|
|
17
|
+
*/
|
|
18
|
+
export declare class Historian implements IHistorian {
|
|
19
|
+
private readonly historianApi;
|
|
20
|
+
private readonly restWrapper;
|
|
21
|
+
private readonly defaultQueryString;
|
|
22
|
+
private readonly cacheBust;
|
|
23
|
+
constructor(historianApi: boolean, disableCache: boolean, restWrapper: RestWrapper);
|
|
24
|
+
getBlob(sha: string): Promise<IR11sResponse<git.IBlob>>;
|
|
25
|
+
createBlob(blob: git.ICreateBlobParams): Promise<IR11sResponse<git.ICreateBlobResponse>>;
|
|
26
|
+
getCommits(sha: string, count: number): Promise<IR11sResponse<git.ICommitDetails[]>>;
|
|
27
|
+
createTree(tree: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>>;
|
|
28
|
+
getTree(sha: string, recursive: boolean): Promise<IR11sResponse<git.ITree>>;
|
|
29
|
+
createSummary(summary: IWholeSummaryPayload, initial?: boolean): Promise<IR11sResponse<IWriteSummaryResponse>>;
|
|
30
|
+
getSummary(sha: string): Promise<IR11sResponse<IWholeFlatSummary>>;
|
|
31
|
+
private getQueryString;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=historian.d.ts.map
|
|
@@ -0,0 +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,iBAAiB,EACjB,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;AAEhD,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,oCAAoC,gBAAiB,YAAY,KAAG,MACN,CAAC;AAE5E;;GAEG;AACH,qBAAa,SAAU,YAAW,UAAU;IAK1C,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAN7B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAuB;IAC1D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAU;gBAGlB,YAAY,EAAE,OAAO,EACtC,YAAY,EAAE,OAAO,EACJ,WAAW,EAAE,WAAW;IAU7B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAOvD,UAAU,CACtB,IAAI,EAAE,GAAG,CAAC,iBAAiB,GACzB,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAQrC,UAAU,CACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;IAelC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAI1E,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAM3E,aAAa,CACzB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAQnC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAO/E,OAAO,CAAC,cAAc;CAatB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Historian = exports.getAuthorizationTokenFromCredentials = void 0;
|
|
8
|
+
const common_utils_1 = require("@fluidframework/common-utils");
|
|
9
|
+
const getAuthorizationTokenFromCredentials = (credentials) => `Basic ${(0, common_utils_1.fromUtf8ToBase64)(`${credentials.user}:${credentials.password}`)}`;
|
|
10
|
+
exports.getAuthorizationTokenFromCredentials = getAuthorizationTokenFromCredentials;
|
|
11
|
+
/**
|
|
12
|
+
* Implementation of the IHistorian interface that calls out to a REST interface
|
|
13
|
+
*/
|
|
14
|
+
class Historian {
|
|
15
|
+
constructor(historianApi, disableCache, restWrapper) {
|
|
16
|
+
this.historianApi = historianApi;
|
|
17
|
+
this.restWrapper = restWrapper;
|
|
18
|
+
this.defaultQueryString = {};
|
|
19
|
+
if (disableCache && this.historianApi) {
|
|
20
|
+
this.defaultQueryString.disableCache = disableCache;
|
|
21
|
+
this.cacheBust = false;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.cacheBust = disableCache;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async getBlob(sha) {
|
|
28
|
+
return this.restWrapper.get(`/git/blobs/${encodeURIComponent(sha)}`, this.getQueryString());
|
|
29
|
+
}
|
|
30
|
+
async createBlob(blob) {
|
|
31
|
+
return this.restWrapper.post(`/git/blobs`, blob, this.getQueryString());
|
|
32
|
+
}
|
|
33
|
+
async getCommits(sha, count) {
|
|
34
|
+
return this.restWrapper
|
|
35
|
+
.get(`/commits`, this.getQueryString({ count, sha }))
|
|
36
|
+
.catch((error) => error.statusCode === 400 || error.statusCode === 404
|
|
37
|
+
? {
|
|
38
|
+
content: [],
|
|
39
|
+
headers: new Map(),
|
|
40
|
+
propsToLog: {},
|
|
41
|
+
requestUrl: "",
|
|
42
|
+
}
|
|
43
|
+
: Promise.reject(error));
|
|
44
|
+
}
|
|
45
|
+
async createTree(tree) {
|
|
46
|
+
return this.restWrapper.post(`/git/trees`, tree, this.getQueryString());
|
|
47
|
+
}
|
|
48
|
+
async getTree(sha, recursive) {
|
|
49
|
+
return this.restWrapper.get(`/git/trees/${encodeURIComponent(sha)}`, this.getQueryString({ recursive: recursive ? 1 : 0 }));
|
|
50
|
+
}
|
|
51
|
+
async createSummary(summary, initial) {
|
|
52
|
+
return this.restWrapper.post(`/git/summaries`, summary, this.getQueryString(initial !== undefined ? { initial } : undefined));
|
|
53
|
+
}
|
|
54
|
+
async getSummary(sha) {
|
|
55
|
+
return this.restWrapper.get(`/git/summaries/${sha}`, this.getQueryString());
|
|
56
|
+
}
|
|
57
|
+
getQueryString(queryString) {
|
|
58
|
+
if (this.cacheBust) {
|
|
59
|
+
return Object.assign(Object.assign({ cacheBust: Date.now() }, this.defaultQueryString), queryString);
|
|
60
|
+
}
|
|
61
|
+
return Object.assign(Object.assign({}, this.defaultQueryString), queryString);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.Historian = Historian;
|
|
65
|
+
//# sourceMappingURL=historian.js.map
|
|
@@ -0,0 +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,GAAG,YAAY,CAAC;YACpD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;SACvB;aAAM;YACN,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC;SAC9B;IACF,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC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ACH,CAAC;IACM,KAAK,CAAC,aAAa,CACzB,OAA6B,EAC7B,OAAiB;QAEjB,OAAO,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,UAAU,CAAC,GAAW;QAClC,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,qCACC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,IAClB,IAAI,CAAC,kBAAkB,GACvB,WAAW,EACb;SACF;QACD,uCACI,IAAI,CAAC,kBAAkB,GACvB,WAAW,EACb;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\tIWholeFlatSummary,\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { QueryStringType, RestWrapper } from \"./restWrapperBase\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IHistorian } from \"./storageContracts\";\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 getSummary(sha: string): Promise<IR11sResponse<IWholeFlatSummary>> {\n\t\treturn this.restWrapper.get<IWholeFlatSummary>(\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/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { DefaultTokenProvider } from "./defaultTokenProvider";
|
|
6
6
|
export { ITokenProvider, ITokenResponse, ITokenService } from "./tokens";
|
|
7
|
+
export { RouterliciousErrorType } from "./errorUtils";
|
|
7
8
|
export { DocumentPostCreateError, RouterliciousDocumentServiceFactory, } from "./documentServiceFactory";
|
|
8
9
|
export { IRouterliciousDriverPolicies } from "./policies";
|
|
9
10
|
//# 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,EACN,uBAAuB,EACvB,mCAAmC,GACnC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC"}
|
|
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,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,EACN,uBAAuB,EACvB,mCAAmC,GACnC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.RouterliciousDocumentServiceFactory = exports.DocumentPostCreateError = exports.DefaultTokenProvider = void 0;
|
|
7
|
+
exports.RouterliciousDocumentServiceFactory = exports.DocumentPostCreateError = exports.RouterliciousErrorType = 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
|
+
// Errors
|
|
12
|
+
var errorUtils_1 = require("./errorUtils");
|
|
13
|
+
Object.defineProperty(exports, "RouterliciousErrorType", { enumerable: true, get: function () { return errorUtils_1.RouterliciousErrorType; } });
|
|
11
14
|
// Factory
|
|
12
15
|
var documentServiceFactory_1 = require("./documentServiceFactory");
|
|
13
16
|
Object.defineProperty(exports, "DocumentPostCreateError", { enumerable: true, get: function () { return documentServiceFactory_1.DocumentPostCreateError; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,SAAS;AACT,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAG7B,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// Tokens\nexport { DefaultTokenProvider } from \"./defaultTokenProvider\";\nexport { ITokenProvider, ITokenResponse, ITokenService } from \"./tokens\";\n\n// Factory\nexport {\n\tDocumentPostCreateError,\n\tRouterliciousDocumentServiceFactory,\n} from \"./documentServiceFactory\";\n\n// Configuration\nexport { IRouterliciousDriverPolicies } from \"./policies\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,SAAS;AACT,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAG7B,SAAS;AACT,2CAAsD;AAA7C,oHAAA,sBAAsB,OAAA;AAE/B,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// Tokens\nexport { DefaultTokenProvider } from \"./defaultTokenProvider\";\nexport { ITokenProvider, ITokenResponse, ITokenService } from \"./tokens\";\n\n// Errors\nexport { RouterliciousErrorType } from \"./errorUtils\";\n\n// Factory\nexport {\n\tDocumentPostCreateError,\n\tRouterliciousDocumentServiceFactory,\n} from \"./documentServiceFactory\";\n\n// Configuration\nexport { IRouterliciousDriverPolicies } from \"./policies\";\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* An extension of Map that expires (deletes) entries after a period of inactivity.
|
|
7
|
+
* The policy is based on the last time a key was written to.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValue> {
|
|
10
|
+
private readonly expiryMs;
|
|
11
|
+
/** Timestamps (as epoch ms numbers) of when each key was last refreshed */
|
|
12
|
+
private readonly lastRefreshedTimes;
|
|
13
|
+
constructor(expiryMs: number);
|
|
14
|
+
private refresh;
|
|
15
|
+
/**
|
|
16
|
+
* Returns true if the key is present and expired, false if it's not expired, and undefined if it's not found
|
|
17
|
+
* If cleanUp is passed as true, then delete any expired entry before returning.
|
|
18
|
+
*/
|
|
19
|
+
private checkExpiry;
|
|
20
|
+
private clearExpiredEntries;
|
|
21
|
+
get size(): number;
|
|
22
|
+
has(key: TKey): boolean;
|
|
23
|
+
get(key: TKey): TValue | undefined;
|
|
24
|
+
set(key: TKey, value: TValue): this;
|
|
25
|
+
delete(key: TKey): boolean;
|
|
26
|
+
clear(): void;
|
|
27
|
+
forEach(callbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void, thisArg?: any): void;
|
|
28
|
+
entries(): IterableIterator<[TKey, TValue]>;
|
|
29
|
+
keys(): IterableIterator<TKey>;
|
|
30
|
+
values(): IterableIterator<TValue>;
|
|
31
|
+
[Symbol.iterator](): IterableIterator<[TKey, TValue]>;
|
|
32
|
+
valueOf(): Object;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=mapWithExpiration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapWithExpiration.d.ts","sourceRoot":"","sources":["../src/mapWithExpiration.ts"],"names":[],"mappings":"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