@fluidframework/routerlicious-driver 2.0.0-dev.5.3.2.178189 → 2.0.0-dev.6.4.0.191258
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 +59 -0
- package/README.md +4 -3
- package/dist/contracts.d.ts +28 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/createNewUtils.d.ts +1 -1
- package/dist/createNewUtils.js +3 -3
- package/dist/createNewUtils.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 +4 -4
- package/dist/documentService.js.map +1 -1
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js +32 -10
- 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 +38 -6
- package/dist/errorUtils.d.ts.map +1 -1
- package/dist/errorUtils.js +32 -16
- 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 +13 -6
- package/dist/historian.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/mapWithExpiration.js +2 -2
- package/dist/mapWithExpiration.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/policies.d.ts +7 -1
- package/dist/policies.d.ts.map +1 -1
- package/dist/policies.js.map +1 -1
- package/dist/r11sSnapshotParser.d.ts +4 -5
- package/dist/r11sSnapshotParser.d.ts.map +1 -1
- package/dist/r11sSnapshotParser.js +13 -15
- package/dist/r11sSnapshotParser.js.map +1 -1
- package/dist/restWrapper.d.ts +3 -3
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/restWrapper.js +53 -36
- 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 +13 -16
- 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.d.ts.map +1 -1
- package/dist/summaryTreeUploadManager.js +11 -11
- 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 +8 -8
- 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 +27 -22
- 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/createNewUtils.d.ts +1 -1
- package/lib/createNewUtils.js +2 -2
- package/lib/createNewUtils.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 +4 -4
- package/lib/documentService.js.map +1 -1
- package/lib/documentServiceFactory.d.ts.map +1 -1
- package/lib/documentServiceFactory.js +32 -10
- 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 +38 -6
- package/lib/errorUtils.d.ts.map +1 -1
- package/lib/errorUtils.js +31 -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 +12 -5
- package/lib/historian.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/mapWithExpiration.js +1 -1
- package/lib/mapWithExpiration.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/policies.d.ts +7 -1
- package/lib/policies.d.ts.map +1 -1
- package/lib/policies.js.map +1 -1
- package/lib/r11sSnapshotParser.d.ts +4 -5
- package/lib/r11sSnapshotParser.d.ts.map +1 -1
- package/lib/r11sSnapshotParser.js +11 -13
- package/lib/r11sSnapshotParser.js.map +1 -1
- package/lib/restWrapper.d.ts +3 -3
- package/lib/restWrapper.d.ts.map +1 -1
- package/lib/restWrapper.js +48 -31
- 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 +12 -15
- 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.d.ts.map +1 -1
- package/lib/summaryTreeUploadManager.js +4 -4
- 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 +4 -4
- 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 +23 -18
- package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
- package/lib/wholeSummaryUploadManager.js +1 -2
- package/lib/wholeSummaryUploadManager.js.map +1 -1
- package/package.json +26 -28
- package/src/contracts.ts +45 -1
- package/src/createNewUtils.ts +2 -2
- package/src/deltaStorageService.ts +8 -1
- package/src/documentService.ts +5 -5
- package/src/documentServiceFactory.ts +21 -11
- package/src/documentStorageService.ts +3 -3
- package/src/errorUtils.ts +48 -30
- package/src/gitManager.ts +3 -3
- package/src/historian.ts +5 -5
- package/src/index.ts +1 -1
- package/src/mapWithExpiration.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/policies.ts +7 -1
- package/src/r11sSnapshotParser.ts +14 -15
- package/src/restWrapper.ts +34 -21
- package/src/retriableGitManager.ts +3 -3
- package/src/shreddedSummaryDocumentStorageService.ts +3 -3
- package/src/storageContracts.ts +3 -3
- package/src/summaryTreeUploadManager.ts +2 -7
- package/src/treeUtils.ts +4 -3
- package/src/wholeSummaryDocumentStorageService.ts +14 -19
package/dist/historian.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.Historian = exports.getAuthorizationTokenFromCredentials = void 0;
|
|
8
|
-
const
|
|
9
|
-
const getAuthorizationTokenFromCredentials = (credentials) => `Basic ${(0,
|
|
8
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
|
+
const getAuthorizationTokenFromCredentials = (credentials) => `Basic ${(0, client_utils_1.fromUtf8ToBase64)(`${credentials.user}:${credentials.password}`)}`;
|
|
10
10
|
exports.getAuthorizationTokenFromCredentials = getAuthorizationTokenFromCredentials;
|
|
11
11
|
/**
|
|
12
12
|
* Implementation of the IHistorian interface that calls out to a REST interface
|
|
@@ -33,7 +33,7 @@ class Historian {
|
|
|
33
33
|
async getCommits(sha, count) {
|
|
34
34
|
return this.restWrapper
|
|
35
35
|
.get(`/commits`, this.getQueryString({ count, sha }))
|
|
36
|
-
.catch((error) => error.statusCode === 400 || error.statusCode === 404
|
|
36
|
+
.catch(async (error) => error.statusCode === 400 || error.statusCode === 404
|
|
37
37
|
? {
|
|
38
38
|
content: [],
|
|
39
39
|
headers: new Map(),
|
|
@@ -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,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,GAAW;QAC/B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAC1B,cAAc,kBAAkB,CAAC,GAAG,CAAC,EAAE,EACvC,IAAI,CAAC,cAAc,EAAE,CACrB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,IAA2B;QAE3B,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAC3B,YAAY,EACZ,IAAI,EACJ,IAAI,CAAC,cAAc,EAAE,CACrB,CAAC;IACH,CAAC;IAEM,K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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 \"@fluid-internal/client-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(async (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/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { DefaultTokenProvider } from "./defaultTokenProvider";
|
|
6
6
|
export { ITokenProvider, ITokenResponse, ITokenService } from "./tokens";
|
|
7
|
-
export { RouterliciousErrorType } from "./errorUtils";
|
|
7
|
+
export { RouterliciousErrorType, RouterliciousErrorTypes } from "./errorUtils";
|
|
8
8
|
export { DocumentPostCreateError, RouterliciousDocumentServiceFactory, } from "./documentServiceFactory";
|
|
9
9
|
export { IRouterliciousDriverPolicies } from "./policies";
|
|
10
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,EAAE,sBAAsB,EAAE,MAAM,cAAc,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,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,EACN,uBAAuB,EACvB,mCAAmC,GACnC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.RouterliciousDocumentServiceFactory = exports.DocumentPostCreateError = exports.RouterliciousErrorType = exports.DefaultTokenProvider = void 0;
|
|
7
|
+
exports.RouterliciousDocumentServiceFactory = exports.DocumentPostCreateError = exports.RouterliciousErrorTypes = 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
11
|
// Errors
|
|
12
12
|
var errorUtils_1 = require("./errorUtils");
|
|
13
13
|
Object.defineProperty(exports, "RouterliciousErrorType", { enumerable: true, get: function () { return errorUtils_1.RouterliciousErrorType; } });
|
|
14
|
+
Object.defineProperty(exports, "RouterliciousErrorTypes", { enumerable: true, get: function () { return errorUtils_1.RouterliciousErrorTypes; } });
|
|
14
15
|
// Factory
|
|
15
16
|
var documentServiceFactory_1 = require("./documentServiceFactory");
|
|
16
17
|
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,SAAS;AACT,
|
|
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,2CAA+E;AAAtE,oHAAA,sBAAsB,OAAA;AAAE,qHAAA,uBAAuB,OAAA;AAExD,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, RouterliciousErrorTypes } from \"./errorUtils\";\n\n// Factory\nexport {\n\tDocumentPostCreateError,\n\tRouterliciousDocumentServiceFactory,\n} from \"./documentServiceFactory\";\n\n// Configuration\nexport { IRouterliciousDriverPolicies } from \"./policies\";\n"]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.MapWithExpiration = void 0;
|
|
8
|
-
const
|
|
8
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
9
|
/**
|
|
10
10
|
* An extension of Map that expires (deletes) entries after a period of inactivity.
|
|
11
11
|
* The policy is based on the last time a key was written to.
|
|
@@ -26,7 +26,7 @@ class MapWithExpiration extends Map {
|
|
|
26
26
|
*/
|
|
27
27
|
checkExpiry(key, cleanUp = false) {
|
|
28
28
|
const refreshTime = this.lastRefreshedTimes.get(key);
|
|
29
|
-
(0,
|
|
29
|
+
(0, core_utils_1.assert)((refreshTime !== undefined) === super.has(key), 0x50c /* freshness map out of sync */);
|
|
30
30
|
if (refreshTime === undefined) {
|
|
31
31
|
return undefined;
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapWithExpiration.js","sourceRoot":"","sources":["../src/mapWithExpiration.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH
|
|
1
|
+
{"version":3,"file":"mapWithExpiration.js","sourceRoot":"","sources":["../src/mapWithExpiration.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD;;;GAGG;AACH,MAAa,iBAA4C,SAAQ,GAAiB;IAIjF,YAA6B,QAAgB;QAC5C,KAAK,EAAE,CAAC;QADoB,aAAQ,GAAR,QAAQ,CAAQ;QAH7C,2EAA2E;QAC1D,uBAAkB,GAAG,IAAI,GAAG,EAAgB,CAAC;IAI9D,CAAC;IAEO,OAAO,CAAC,GAAS;QACxB,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACK,WAAW,CAAC,GAAS,EAAE,UAAmB,KAAK;QACtD,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACrD,IAAA,mBAAM,EACL,CAAC,WAAW,KAAK,SAAS,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAC9C,KAAK,CAAC,+BAA+B,CACrC,CAAC;QAEF,IAAI,WAAW,KAAK,SAAS,EAAE;YAC9B,OAAO,SAAS,CAAC;SACjB;QACD,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC;QACpE,IAAI,OAAO,IAAI,OAAO,EAAE;YACvB,IAAI,CAAC,MAAM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,CAAC,KAAK,IAAI,EAAE;gBACjC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACpB;iBAAM;gBACN,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;aAClC;QACF,CAAC,CAED,CAAC;QAEF,kEAAkE;QAClE,WAAW,CAAC,OAAO,CAAC,CAAC,GAAS,EAAE,EAAE;YACjC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,OAAO;QACN,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IACD,IAAI;QACH,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IACD,MAAM;QACL,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;IACD,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACjC,CAAC;IAED,OAAO;QACN,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;CACD;AAhHD,8CAgHC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\n\n/**\n * An extension of Map that expires (deletes) entries after a period of inactivity.\n * The policy is based on the last time a key was written to.\n */\nexport class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValue> {\n\t/** Timestamps (as epoch ms numbers) of when each key was last refreshed */\n\tprivate readonly lastRefreshedTimes = new Map<TKey, number>();\n\n\tconstructor(private readonly expiryMs: number) {\n\t\tsuper();\n\t}\n\n\tprivate refresh(key: TKey): void {\n\t\tthis.lastRefreshedTimes.set(key, new Date().valueOf());\n\t}\n\n\t/**\n\t * Returns true if the key is present and expired, false if it's not expired, and undefined if it's not found\n\t * If cleanUp is passed as true, then delete any expired entry before returning.\n\t */\n\tprivate checkExpiry(key: TKey, cleanUp: boolean = false): boolean | undefined {\n\t\tconst refreshTime = this.lastRefreshedTimes.get(key);\n\t\tassert(\n\t\t\t(refreshTime !== undefined) === super.has(key),\n\t\t\t0x50c /* freshness map out of sync */,\n\t\t);\n\n\t\tif (refreshTime === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst expired = new Date().valueOf() - refreshTime >= this.expiryMs;\n\t\tif (expired && cleanUp) {\n\t\t\tthis.delete(key);\n\t\t}\n\t\treturn expired;\n\t}\n\n\tprivate clearExpiredEntries() {\n\t\t// forEach clears out any expired entries\n\t\tthis.forEach(() => {});\n\t}\n\n\tget size(): number {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.size;\n\t}\n\n\thas(key: TKey): boolean {\n\t\tthis.checkExpiry(key, true /* cleanUp */);\n\t\treturn super.has(key);\n\t}\n\n\tget(key: TKey): TValue | undefined {\n\t\tthis.checkExpiry(key, true /* cleanUp */);\n\t\treturn super.get(key);\n\t}\n\n\tset(key: TKey, value: TValue): this {\n\t\t// Sliding window expiration policy (on write)\n\t\tthis.refresh(key);\n\t\treturn super.set(key, value);\n\t}\n\n\tdelete(key: TKey): boolean {\n\t\tthis.lastRefreshedTimes.delete(key);\n\t\treturn super.delete(key);\n\t}\n\n\tclear(): void {\n\t\tthis.lastRefreshedTimes.clear();\n\t\tsuper.clear();\n\t}\n\n\tforEach(\n\t\tcallbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void,\n\t\tthisArg?: any,\n\t): void {\n\t\tconst expiredKeys: TKey[] = [];\n\t\tsuper.forEach(\n\t\t\t(v, k, m) => {\n\t\t\t\tif (this.checkExpiry(k) === true) {\n\t\t\t\t\texpiredKeys.push(k);\n\t\t\t\t} else {\n\t\t\t\t\tcallbackfn.bind(thisArg)(v, k, m);\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Note we don't pass thisArg here, since we bind it directly to callbackFn and don't need it otherwise\n\t\t);\n\n\t\t// Clean up keys we know are expired now that we're done iterating\n\t\texpiredKeys.forEach((key: TKey) => {\n\t\t\tthis.delete(key);\n\t\t});\n\t}\n\n\tentries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.entries();\n\t}\n\tkeys(): IterableIterator<TKey> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.keys();\n\t}\n\tvalues(): IterableIterator<TValue> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.values();\n\t}\n\t[Symbol.iterator](): IterableIterator<[TKey, TValue]> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super[Symbol.iterator]();\n\t}\n\n\tvalueOf() {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.valueOf();\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-dev.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-dev.6.4.0.191258";
|
|
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-dev.
|
|
11
|
+
exports.pkgVersion = "2.0.0-dev.6.4.0.191258";
|
|
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,wBAAwB,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-dev.
|
|
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,wBAAwB,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-dev.6.4.0.191258\";\n"]}
|
package/dist/policies.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface IRouterliciousDriverPolicies {
|
|
|
35
35
|
* Enable service endpoint discovery when creating or joining a session.
|
|
36
36
|
* Default: false
|
|
37
37
|
*/
|
|
38
|
-
enableDiscovery
|
|
38
|
+
enableDiscovery: boolean;
|
|
39
39
|
/**
|
|
40
40
|
* Enable using RestLess which avoids CORS preflight requests.
|
|
41
41
|
* Default: true
|
|
@@ -53,5 +53,11 @@ export interface IRouterliciousDriverPolicies {
|
|
|
53
53
|
* Default: true
|
|
54
54
|
*/
|
|
55
55
|
enableLongPollingDowngrade: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Indicates that the container is ephemeral.
|
|
58
|
+
* Artifacts relates to the container are limited to container lifetime.
|
|
59
|
+
* Default: false
|
|
60
|
+
*/
|
|
61
|
+
isEphemeralContainer: boolean;
|
|
56
62
|
}
|
|
57
63
|
//# sourceMappingURL=policies.d.ts.map
|
package/dist/policies.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;;;;OAMG;IACH,8BAA8B,EAAE,MAAM,GAAG,SAAS,CAAC;IACnD;;;OAGG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,eAAe,
|
|
1
|
+
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;;;;OAMG;IACH,8BAA8B,EAAE,MAAM,GAAG,SAAS,CAAC;IACnD;;;OAGG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,4BAA4B,EAAE,OAAO,CAAC;IACtC;;;;OAIG;IACH,0BAA0B,EAAE,OAAO,CAAC;IACpC;;;;OAIG;IACH,oBAAoB,EAAE,OAAO,CAAC;CAC9B"}
|
package/dist/policies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport interface IRouterliciousDriverPolicies {\n\t/**\n\t * Enable prefetching entire snapshot tree into memory before it is loaded by the runtime.\n\t * Default: true\n\t */\n\tenablePrefetch: boolean;\n\t/**\n\t * Rate limit concurrent storage requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentStorageRequests: number;\n\t/**\n\t * Rate limit concurrent orderer requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentOrdererRequests: number;\n\t/**\n\t * Give hosts the option to change blob aggregation behavior to suit their needs.\n\t * Larger number means fewer blob individual requests, but less blob-deduping.\n\t * Smaller number means more blob individual requests, but more blob-deduping.\n\t * Setting to `undefined` disables blob aggregration.\n\t * Default: undefined\n\t */\n\taggregateBlobsSmallerThanBytes: number | undefined;\n\t/**\n\t * Enable uploading entire summary tree as a IWholeSummaryPayload to storage.\n\t * Default: false\n\t */\n\tenableWholeSummaryUpload: boolean;\n\t/**\n\t * Enable service endpoint discovery when creating or joining a session.\n\t * Default: false\n\t */\n\tenableDiscovery
|
|
1
|
+
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport interface IRouterliciousDriverPolicies {\n\t/**\n\t * Enable prefetching entire snapshot tree into memory before it is loaded by the runtime.\n\t * Default: true\n\t */\n\tenablePrefetch: boolean;\n\t/**\n\t * Rate limit concurrent storage requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentStorageRequests: number;\n\t/**\n\t * Rate limit concurrent orderer requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentOrdererRequests: number;\n\t/**\n\t * Give hosts the option to change blob aggregation behavior to suit their needs.\n\t * Larger number means fewer blob individual requests, but less blob-deduping.\n\t * Smaller number means more blob individual requests, but more blob-deduping.\n\t * Setting to `undefined` disables blob aggregration.\n\t * Default: undefined\n\t */\n\taggregateBlobsSmallerThanBytes: number | undefined;\n\t/**\n\t * Enable uploading entire summary tree as a IWholeSummaryPayload to storage.\n\t * Default: false\n\t */\n\tenableWholeSummaryUpload: boolean;\n\t/**\n\t * Enable service endpoint discovery when creating or joining a session.\n\t * Default: false\n\t */\n\tenableDiscovery: boolean;\n\t/**\n\t * Enable using RestLess which avoids CORS preflight requests.\n\t * Default: true\n\t */\n\tenableRestLess: boolean;\n\t/**\n\t * Enable internal cache of summaries/snapshots.\n\t * Reduces Summarizer boot time and reduces server load in E2E tests.\n\t * Default: true\n\t */\n\tenableInternalSummaryCaching: boolean;\n\t/**\n\t * Enable downgrading socket connection to long-polling\n\t * when websocket connection cannot be established.\n\t * Default: true\n\t */\n\tenableLongPollingDowngrade: boolean;\n\t/**\n\t * Indicates that the container is ephemeral.\n\t * Artifacts relates to the container are limited to container lifetime.\n\t * Default: false\n\t */\n\tisEphemeralContainer: boolean;\n}\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,8 +4,8 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
const
|
|
7
|
+
exports.convertWholeFlatSnapshotToSnapshotTreeAndBlobs = void 0;
|
|
8
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
9
|
/**
|
|
10
10
|
* Build a tree hierarchy from a flat tree.
|
|
11
11
|
*
|
|
@@ -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, client_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":"r11sSnapshotParser.js","sourceRoot":"","sources":["../src/r11sSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA8D;AA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AC,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 \"@fluid-internal/client-utils\";\nimport { INormalizedWholeSnapshot, IWholeFlatSnapshot, IWholeFlatSnapshotTree } from \"./contracts\";\n\n/**\n * Build a tree hierarchy from a flat tree.\n *\n * @param flatTree - a flat tree\n * @param treePrefixToRemove - tree prefix to strip\n * @returns the heirarchical tree\n */\nfunction buildHierarchy(\n\tflatTree: IWholeFlatSnapshotTree,\n\ttreePrefixToRemove: string,\n): ISnapshotTree {\n\tconst lookup: { [path: string]: ISnapshotTree } = {};\n\t// Root tree id will be used to determine which version was downloaded.\n\tconst root: ISnapshotTree = { id: flatTree.id, blobs: {}, trees: {} };\n\tlookup[\"\"] = root;\n\n\tfor (const entry of flatTree.entries) {\n\t\t// Strip the `treePrefixToRemove` path from tree entries such that they are stored under root.\n\t\tconst entryPath = entry.path.replace(new RegExp(`^${treePrefixToRemove}/`), \"\");\n\t\tconst lastIndex = entryPath.lastIndexOf(\"/\");\n\t\tconst entryPathDir = entryPath.slice(0, Math.max(0, lastIndex));\n\t\tconst entryPathBase = entryPath.slice(lastIndex + 1);\n\n\t\t// The flat output is breadth-first so we can assume we see tree nodes prior to their contents\n\t\tconst node = lookup[entryPathDir];\n\n\t\t// Add in either the blob or tree\n\t\tif (entry.type === \"tree\") {\n\t\t\tconst newTree: ISnapshotTree = {\n\t\t\t\tblobs: {},\n\t\t\t\ttrees: {},\n\t\t\t\tunreferenced: entry.unreferenced,\n\t\t\t};\n\t\t\tnode.trees[decodeURIComponent(entryPathBase)] = newTree;\n\t\t\tlookup[entryPath] = newTree;\n\t\t} else if (entry.type === \"blob\") {\n\t\t\tnode.blobs[decodeURIComponent(entryPathBase)] = entry.id;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown entry type!!`);\n\t\t}\n\t}\n\n\treturn root;\n}\n\n/**\n * Converts existing IWholeFlatSnapshot to snapshot tree, blob array, and sequence number.\n *\n * @param flatSnapshot - flat snapshot\n * @param treePrefixToRemove - tree prefix to strip. By default we are stripping \".app\" prefix\n * @returns snapshot tree, blob array, and sequence number\n */\nexport function convertWholeFlatSnapshotToSnapshotTreeAndBlobs(\n\tflatSnapshot: IWholeFlatSnapshot,\n\ttreePrefixToRemove: string = \".app\",\n): INormalizedWholeSnapshot {\n\tconst blobs = new Map<string, ArrayBuffer>();\n\tif (flatSnapshot.blobs) {\n\t\tflatSnapshot.blobs.forEach((blob) => {\n\t\t\tblobs.set(blob.id, stringToBuffer(blob.content, blob.encoding ?? \"utf-8\"));\n\t\t});\n\t}\n\tconst flatSnapshotTree = flatSnapshot.trees?.[0];\n\tconst sequenceNumber = flatSnapshotTree?.sequenceNumber;\n\tconst snapshotTree = buildHierarchy(flatSnapshotTree, treePrefixToRemove);\n\n\treturn {\n\t\tblobs,\n\t\tsnapshotTree,\n\t\tsequenceNumber,\n\t\tid: flatSnapshot.id,\n\t};\n}\n"]}
|
package/dist/restWrapper.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ export interface IR11sResponse<T> {
|
|
|
17
17
|
requestUrl: string;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* A utility function to create a
|
|
21
|
-
* @param content -
|
|
22
|
-
* @returns
|
|
20
|
+
* A utility function to create a Routerlicious response without any additional props as we might not have them always.
|
|
21
|
+
* @param content - Response which is equivalent to content.
|
|
22
|
+
* @returns A Routerlicious response without any extra props.
|
|
23
23
|
*/
|
|
24
24
|
export declare function createR11sResponseFromContent<T>(content: T): IR11sResponse<T>;
|
|
25
25
|
export declare function getPropsToLogFromResponse(headers: {
|
|
@@ -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;
|
|
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;AAGzC,OAAO,EAA0C,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAQnG,OAAO,KAAK,EAAE,kBAAkB,EAAuB,MAAM,OAAO,CAAC;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|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.toInstrumentedR11sStorageTokenFetcher = exports.toInstrumentedR11sOrdererTokenFetcher = exports.RouterliciousOrdererRestWrapper = exports.RouterliciousStorageRestWrapper = exports.RouterliciousRestWrapper = exports.getPropsToLogFromResponse = exports.createR11sResponseFromContent = void 0;
|
|
11
11
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
12
|
-
const
|
|
12
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
13
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
14
|
+
const driver_utils_1 = require("@fluidframework/driver-utils");
|
|
13
15
|
const server_services_client_1 = require("@fluidframework/server-services-client");
|
|
14
16
|
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
15
17
|
const json_stringify_safe_1 = __importDefault(require("json-stringify-safe"));
|
|
16
|
-
const uuid_1 = require("uuid");
|
|
17
18
|
const errorUtils_1 = require("./errorUtils");
|
|
18
19
|
const packageVersion_1 = require("./packageVersion");
|
|
19
20
|
const restWrapperBase_1 = require("./restWrapperBase");
|
|
20
21
|
const axiosRequestConfigToFetchRequestConfig = (requestConfig) => {
|
|
21
|
-
var _a, _b;
|
|
22
22
|
const requestInfo = requestConfig.baseURL !== undefined
|
|
23
|
-
? `${requestConfig.baseURL}${
|
|
24
|
-
:
|
|
23
|
+
? `${requestConfig.baseURL}${requestConfig.url ?? ""}`
|
|
24
|
+
: requestConfig.url ?? "";
|
|
25
25
|
const requestInit = {
|
|
26
26
|
method: requestConfig.method,
|
|
27
27
|
// NOTE: I believe that although the Axios type permits non-string values in the header, here we are
|
|
@@ -32,9 +32,9 @@ const axiosRequestConfigToFetchRequestConfig = (requestConfig) => {
|
|
|
32
32
|
return [requestInfo, requestInit];
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
|
-
* A utility function to create a
|
|
36
|
-
* @param content -
|
|
37
|
-
* @returns
|
|
35
|
+
* A utility function to create a Routerlicious response without any additional props as we might not have them always.
|
|
36
|
+
* @param content - Response which is equivalent to content.
|
|
37
|
+
* @returns A Routerlicious response without any extra props.
|
|
38
38
|
*/
|
|
39
39
|
function createR11sResponseFromContent(content) {
|
|
40
40
|
return {
|
|
@@ -56,12 +56,12 @@ function getPropsToLogFromResponse(headers) {
|
|
|
56
56
|
// We rename headers so that otel doesn't scrub them away. Otel doesn't allow
|
|
57
57
|
// certain characters in headers including '-'
|
|
58
58
|
const headersToLog = [
|
|
59
|
-
{ headerName:
|
|
59
|
+
{ headerName: server_services_client_1.CorrelationIdHeaderName, logName: "requestCorrelationId" },
|
|
60
60
|
{ headerName: "content-encoding", logName: "contentEncoding" },
|
|
61
61
|
{ headerName: "content-type", logName: "contentType" },
|
|
62
62
|
];
|
|
63
63
|
const additionalProps = {
|
|
64
|
-
contentsize: telemetry_utils_1.
|
|
64
|
+
contentsize: (0, telemetry_utils_1.numberFromString)(headers.get("content-length")),
|
|
65
65
|
};
|
|
66
66
|
headersToLog.forEach((header) => {
|
|
67
67
|
const headerValue = headers.get(header.headerName);
|
|
@@ -83,32 +83,47 @@ class RouterliciousRestWrapper extends restWrapperBase_1.RestWrapper {
|
|
|
83
83
|
this.restLess = new server_services_client_1.RestLessClient();
|
|
84
84
|
}
|
|
85
85
|
async request(requestConfig, statusCode, canRetry = true) {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
const config = {
|
|
87
|
+
...requestConfig,
|
|
88
|
+
headers: await this.generateHeaders(requestConfig.headers),
|
|
89
|
+
};
|
|
88
90
|
const translatedConfig = this.useRestLess ? this.restLess.translate(config) : config;
|
|
89
91
|
const fetchRequestConfig = axiosRequestConfigToFetchRequestConfig(translatedConfig);
|
|
90
92
|
const res = await this.rateLimiter.schedule(async () => {
|
|
91
|
-
const perfStart =
|
|
93
|
+
const perfStart = client_utils_1.performance.now();
|
|
92
94
|
const result = await (0, cross_fetch_1.default)(...fetchRequestConfig).catch(async (error) => {
|
|
93
95
|
// Browser Fetch throws a TypeError on network error, `node-fetch` throws a FetchError
|
|
94
|
-
const isNetworkError = ["TypeError", "FetchError"].includes(error
|
|
95
|
-
|
|
96
|
+
const isNetworkError = ["TypeError", "FetchError"].includes(error?.name);
|
|
97
|
+
const errorMessage = isNetworkError
|
|
98
|
+
? `NetworkError: ${error.message}`
|
|
99
|
+
: (0, json_stringify_safe_1.default)(error);
|
|
100
|
+
// If a service is temporarily down or a browser resource limit is reached, RestWrapper will throw
|
|
101
|
+
// a network error with no status code (e.g. err:ERR_CONN_REFUSED or err:ERR_FAILED) and
|
|
102
|
+
// the error message will start with NetworkError as defined in restWrapper.ts
|
|
103
|
+
// If there exists a self-signed SSL certificates error, throw a NonRetryableError
|
|
104
|
+
// TODO: instead of relying on string matching, filter error based on the error code like we do for websocket connections
|
|
105
|
+
const err = errorMessage.includes("failed, reason: self signed certificate")
|
|
106
|
+
? new driver_utils_1.NonRetryableError(errorMessage, errorUtils_1.RouterliciousErrorTypes.sslCertError, {
|
|
107
|
+
driverVersion: packageVersion_1.pkgVersion,
|
|
108
|
+
})
|
|
109
|
+
: new driver_utils_1.GenericNetworkError(errorMessage, errorMessage.startsWith("NetworkError"), { driverVersion: packageVersion_1.pkgVersion });
|
|
110
|
+
throw err;
|
|
96
111
|
});
|
|
97
112
|
return {
|
|
98
113
|
response: result,
|
|
99
|
-
duration:
|
|
114
|
+
duration: client_utils_1.performance.now() - perfStart,
|
|
100
115
|
};
|
|
101
116
|
});
|
|
102
117
|
const response = res.response;
|
|
103
|
-
let start =
|
|
118
|
+
let start = client_utils_1.performance.now();
|
|
104
119
|
const text = await response.text();
|
|
105
|
-
const receiveContentTime =
|
|
120
|
+
const receiveContentTime = client_utils_1.performance.now() - start;
|
|
106
121
|
const bodySize = text.length;
|
|
107
|
-
start =
|
|
108
|
-
const responseBody =
|
|
122
|
+
start = client_utils_1.performance.now();
|
|
123
|
+
const responseBody = response.headers.get("content-type")?.includes("application/json")
|
|
109
124
|
? JSON.parse(text)
|
|
110
125
|
: text;
|
|
111
|
-
const parseTime =
|
|
126
|
+
const parseTime = client_utils_1.performance.now() - start;
|
|
112
127
|
// Success
|
|
113
128
|
if (response.ok || response.status === statusCode) {
|
|
114
129
|
const result = responseBody;
|
|
@@ -117,9 +132,13 @@ class RouterliciousRestWrapper extends restWrapperBase_1.RestWrapper {
|
|
|
117
132
|
content: result,
|
|
118
133
|
headers,
|
|
119
134
|
requestUrl: fetchRequestConfig[0].toString(),
|
|
120
|
-
propsToLog:
|
|
135
|
+
propsToLog: {
|
|
136
|
+
...getPropsToLogFromResponse(headers),
|
|
137
|
+
bodySize,
|
|
121
138
|
receiveContentTime,
|
|
122
|
-
parseTime,
|
|
139
|
+
parseTime,
|
|
140
|
+
fetchTime: res.duration,
|
|
141
|
+
},
|
|
123
142
|
};
|
|
124
143
|
}
|
|
125
144
|
// Failure
|
|
@@ -128,7 +147,7 @@ class RouterliciousRestWrapper extends restWrapperBase_1.RestWrapper {
|
|
|
128
147
|
this.token = await this.fetchRefreshedToken(true /* refreshToken */);
|
|
129
148
|
return this.request(config, statusCode, false);
|
|
130
149
|
}
|
|
131
|
-
if (response.status === 429 &&
|
|
150
|
+
if (response.status === 429 && responseBody?.retryAfter > 0) {
|
|
132
151
|
// Retry based on retryAfter[Seconds]
|
|
133
152
|
return new Promise((resolve, reject) => setTimeout(() => {
|
|
134
153
|
this.request(config, statusCode).then(resolve).catch(reject);
|
|
@@ -139,26 +158,24 @@ class RouterliciousRestWrapper extends restWrapperBase_1.RestWrapper {
|
|
|
139
158
|
? responseBody
|
|
140
159
|
: (0, json_stringify_safe_1.default)(responseBody)
|
|
141
160
|
: response.statusText;
|
|
142
|
-
(0, errorUtils_1.throwR11sNetworkError)(`R11s fetch error: ${responseSummary}`, response.status, responseBody
|
|
161
|
+
(0, errorUtils_1.throwR11sNetworkError)(`R11s fetch error: ${responseSummary}`, response.status, responseBody?.retryAfter);
|
|
143
162
|
}
|
|
144
163
|
async generateHeaders(requestHeaders) {
|
|
145
|
-
var _a;
|
|
146
164
|
const token = await this.getToken();
|
|
147
|
-
(0,
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// NOTE: Can correlationId actually be number | true?
|
|
152
|
-
"x-correlation-id": correlationId, "x-driver-version": packageVersion_1.pkgVersion,
|
|
165
|
+
(0, core_utils_1.assert)(token !== undefined, 0x679 /* token should be present */);
|
|
166
|
+
const headers = {
|
|
167
|
+
...requestHeaders,
|
|
168
|
+
[server_services_client_1.DriverVersionHeaderName]: packageVersion_1.pkgVersion,
|
|
153
169
|
// NOTE: If this.authorizationHeader is undefined, should "Authorization" be removed entirely?
|
|
154
|
-
|
|
170
|
+
Authorization: this.getAuthorizationHeader(token),
|
|
171
|
+
};
|
|
172
|
+
return headers;
|
|
155
173
|
}
|
|
156
174
|
async getToken() {
|
|
157
|
-
var _a;
|
|
158
175
|
if (this.token !== undefined) {
|
|
159
176
|
return this.token;
|
|
160
177
|
}
|
|
161
|
-
const token = await (
|
|
178
|
+
const token = await (this.tokenP ?? this.fetchRefreshedToken());
|
|
162
179
|
this.setToken(token);
|
|
163
180
|
this.tokenP = undefined;
|
|
164
181
|
return token;
|
|
@@ -174,7 +191,7 @@ class RouterliciousStorageRestWrapper extends RouterliciousRestWrapper {
|
|
|
174
191
|
}
|
|
175
192
|
static async load(tenantId, tokenFetcher, logger, rateLimiter, useRestLess, baseurl, initialTokenP) {
|
|
176
193
|
const defaultQueryString = {
|
|
177
|
-
token: `${(0,
|
|
194
|
+
token: `${(0, client_utils_1.fromUtf8ToBase64)(tenantId)}`,
|
|
178
195
|
};
|
|
179
196
|
const getAuthorizationHeader = (token) => {
|
|
180
197
|
const credentials = {
|