@fluidframework/driver-utils 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.204906
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 +70 -0
- package/api-extractor.json +1 -1
- package/api-report/driver-utils.api.md +401 -0
- package/dist/adapters/compression/compressionTypes.d.ts +6 -0
- package/dist/adapters/compression/compressionTypes.d.ts.map +1 -1
- package/dist/adapters/compression/compressionTypes.js +4 -1
- package/dist/adapters/compression/compressionTypes.js.map +1 -1
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +1 -9
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +1 -0
- package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
- package/dist/adapters/predefinedAdapters.js +1 -0
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/blob.d.ts +3 -0
- package/dist/blob.d.ts.map +1 -1
- package/dist/blob.js +3 -0
- package/dist/blob.js.map +1 -1
- package/dist/buildSnapshotTree.d.ts +1 -0
- package/dist/buildSnapshotTree.d.ts.map +1 -1
- package/dist/buildSnapshotTree.js +1 -0
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +3 -0
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js +6 -3
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/driver-utils-alpha.d.ts +574 -0
- package/dist/driver-utils-beta.d.ts +574 -0
- package/dist/driver-utils-public.d.ts +574 -0
- package/dist/driver-utils-untrimmed.d.ts +588 -0
- package/dist/error.d.ts +4 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +4 -1
- package/dist/error.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/insecureUrlResolver.d.ts +1 -0
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/insecureUrlResolver.js +2 -1
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/messageRecognition.d.ts +10 -0
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +11 -4
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +50 -4
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +46 -6
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +3 -0
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +3 -0
- package/dist/networkUtils.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/parallelRequests.d.ts +12 -0
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +18 -6
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts +3 -1
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/prefetchDocumentStorageService.js +3 -0
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/rateLimiter.d.ts +3 -0
- package/dist/rateLimiter.d.ts.map +1 -1
- package/dist/rateLimiter.js +3 -0
- package/dist/rateLimiter.js.map +1 -1
- package/dist/readAndParse.d.ts +1 -0
- package/dist/readAndParse.d.ts.map +1 -1
- package/dist/readAndParse.js +1 -0
- package/dist/readAndParse.js.map +1 -1
- package/dist/runWithRetry.d.ts +5 -0
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/runWithRetry.js +4 -2
- package/dist/runWithRetry.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +3 -1
- package/dist/summaryForCreateNew.d.ts.map +1 -1
- package/dist/summaryForCreateNew.js +4 -2
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts +1 -0
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/treeConversions.js +1 -0
- package/dist/treeConversions.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/adapters/compression/compressionTypes.d.ts +6 -0
- package/lib/adapters/compression/compressionTypes.d.ts.map +1 -1
- package/lib/adapters/compression/compressionTypes.js +3 -0
- package/lib/adapters/compression/compressionTypes.js.map +1 -1
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js +1 -9
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +4 -0
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +4 -0
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/adapters/predefinedAdapters.d.ts +1 -0
- package/lib/adapters/predefinedAdapters.d.ts.map +1 -1
- package/lib/adapters/predefinedAdapters.js +1 -0
- package/lib/adapters/predefinedAdapters.js.map +1 -1
- package/lib/blob.d.ts +3 -0
- package/lib/blob.d.ts.map +1 -1
- package/lib/blob.js +3 -0
- package/lib/blob.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts +1 -0
- package/lib/buildSnapshotTree.d.ts.map +1 -1
- package/lib/buildSnapshotTree.js +1 -0
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +3 -0
- package/lib/documentStorageServiceProxy.d.ts.map +1 -1
- package/lib/documentStorageServiceProxy.js +6 -3
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/error.d.ts +4 -1
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +4 -1
- package/lib/error.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/insecureUrlResolver.d.ts +1 -0
- package/lib/insecureUrlResolver.d.ts.map +1 -1
- package/lib/insecureUrlResolver.js +2 -1
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/messageRecognition.d.ts +10 -0
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +10 -3
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +50 -4
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +45 -5
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +3 -0
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +3 -0
- package/lib/networkUtils.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/parallelRequests.d.ts +12 -0
- package/lib/parallelRequests.d.ts.map +1 -1
- package/lib/parallelRequests.js +18 -6
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts +3 -1
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
- package/lib/prefetchDocumentStorageService.js +3 -0
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/rateLimiter.d.ts +3 -0
- package/lib/rateLimiter.d.ts.map +1 -1
- package/lib/rateLimiter.js +3 -0
- package/lib/rateLimiter.js.map +1 -1
- package/lib/readAndParse.d.ts +1 -0
- package/lib/readAndParse.d.ts.map +1 -1
- package/lib/readAndParse.js +1 -0
- package/lib/readAndParse.js.map +1 -1
- package/lib/runWithRetry.d.ts +5 -0
- package/lib/runWithRetry.d.ts.map +1 -1
- package/lib/runWithRetry.js +4 -2
- package/lib/runWithRetry.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +3 -1
- package/lib/summaryForCreateNew.d.ts.map +1 -1
- package/lib/summaryForCreateNew.js +4 -2
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts +1 -0
- package/lib/treeConversions.d.ts.map +1 -1
- package/lib/treeConversions.js +1 -0
- package/lib/treeConversions.js.map +1 -1
- package/package.json +21 -22
- package/src/adapters/compression/compressionTypes.ts +6 -0
- package/src/adapters/compression/documentServiceCompressionAdapter.ts +4 -1
- package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +1 -9
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +4 -0
- package/src/adapters/predefinedAdapters.ts +1 -0
- package/src/blob.ts +11 -2
- package/src/buildSnapshotTree.ts +1 -0
- package/src/documentStorageServiceProxy.ts +3 -0
- package/src/error.ts +4 -1
- package/src/index.ts +1 -0
- package/src/insecureUrlResolver.ts +2 -1
- package/src/messageRecognition.ts +10 -3
- package/src/network.ts +64 -9
- package/src/networkUtils.ts +3 -0
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +13 -1
- package/src/prefetchDocumentStorageService.ts +3 -0
- package/src/rateLimiter.ts +3 -0
- package/src/readAndParse.ts +1 -0
- package/src/runWithRetry.ts +7 -4
- package/src/summaryForCreateNew.ts +4 -1
- package/src/treeConversions.ts +1 -0
|
@@ -8,13 +8,13 @@ import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
|
8
8
|
* this is used internally for create new, and single commit summary
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
export function isCombinedAppAndProtocolSummary(summary) {
|
|
11
|
+
export function isCombinedAppAndProtocolSummary(summary, ...optionalRootTrees) {
|
|
12
12
|
if (summary?.tree === undefined ||
|
|
13
13
|
summary.tree?.[".app"]?.type !== SummaryType.Tree ||
|
|
14
14
|
summary.tree?.[".protocol"]?.type !== SummaryType.Tree) {
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
|
-
const treeKeys = Object.keys(summary.tree);
|
|
17
|
+
const treeKeys = Object.keys(summary.tree).filter((t) => !optionalRootTrees.includes(t));
|
|
18
18
|
if (treeKeys.length !== 2) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
@@ -23,6 +23,7 @@ export function isCombinedAppAndProtocolSummary(summary) {
|
|
|
23
23
|
/**
|
|
24
24
|
* Extract the attributes from the protocol summary.
|
|
25
25
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
26
|
+
* @public
|
|
26
27
|
*/
|
|
27
28
|
export function getDocAttributesFromProtocolSummary(protocolSummary) {
|
|
28
29
|
const attributesBlob = protocolSummary.tree.attributes;
|
|
@@ -31,6 +32,7 @@ export function getDocAttributesFromProtocolSummary(protocolSummary) {
|
|
|
31
32
|
/**
|
|
32
33
|
* Extract quorum values from the protocol summary.
|
|
33
34
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
35
|
+
* @public
|
|
34
36
|
*/
|
|
35
37
|
export function getQuorumValuesFromProtocolSummary(protocolSummary) {
|
|
36
38
|
const quorumValuesBlob = protocolSummary.tree.quorumValues;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryForCreateNew.js","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,WAAW,GAIX,MAAM,sCAAsC,CAAC;AAc9C;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAC9C,OAAiC;
|
|
1
|
+
{"version":3,"file":"summaryForCreateNew.js","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,WAAW,GAIX,MAAM,sCAAsC,CAAC;AAc9C;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAC9C,OAAiC,EACjC,GAAG,iBAA2B;IAE9B,IACC,OAAO,EAAE,IAAI,KAAK,SAAS;QAC3B,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,KAAK,WAAW,CAAC,IAAI;QACjD,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,KAAK,WAAW,CAAC,IAAI,EACrD;QACD,OAAO,KAAK,CAAC;KACb;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,OAAO,KAAK,CAAC;KACb;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mCAAmC,CAClD,eAA6B;IAE7B,MAAM,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,UAA0B,CAAC;IACvE,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAiB,CAAwB,CAAC;AAC5E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CACjD,eAA6B;IAE7B,MAAM,gBAAgB,GAAG,eAAe,CAAC,IAAI,CAAC,YAA4B,CAAC;IAC3E,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAiB,CAG/D,CAAC;IACJ,OAAO,YAAY,CAAC;AACrB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tISummaryTree,\n\tSummaryType,\n\tISummaryBlob,\n\tICommittedProposal,\n\tIDocumentAttributes,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Defines the current layout of an .app + .protocol summary tree\n * this is used internally for create new, and single commit summary\n * @internal\n */\nexport interface CombinedAppAndProtocolSummary extends ISummaryTree {\n\ttree: {\n\t\t[\".app\"]: ISummaryTree;\n\t\t[\".protocol\"]: ISummaryTree;\n\t};\n}\n\n/**\n * Validates the current layout of an .app + .protocol summary tree\n * this is used internally for create new, and single commit summary\n * @internal\n */\nexport function isCombinedAppAndProtocolSummary(\n\tsummary: ISummaryTree | undefined,\n\t...optionalRootTrees: string[]\n): summary is CombinedAppAndProtocolSummary {\n\tif (\n\t\tsummary?.tree === undefined ||\n\t\tsummary.tree?.[\".app\"]?.type !== SummaryType.Tree ||\n\t\tsummary.tree?.[\".protocol\"]?.type !== SummaryType.Tree\n\t) {\n\t\treturn false;\n\t}\n\tconst treeKeys = Object.keys(summary.tree).filter((t) => !optionalRootTrees.includes(t));\n\tif (treeKeys.length !== 2) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/**\n * Extract the attributes from the protocol summary.\n * @param protocolSummary - protocol summary from which the values are to be extracted.\n * @public\n */\nexport function getDocAttributesFromProtocolSummary(\n\tprotocolSummary: ISummaryTree,\n): IDocumentAttributes {\n\tconst attributesBlob = protocolSummary.tree.attributes as ISummaryBlob;\n\treturn JSON.parse(attributesBlob.content as string) as IDocumentAttributes;\n}\n\n/**\n * Extract quorum values from the protocol summary.\n * @param protocolSummary - protocol summary from which the values are to be extracted.\n * @public\n */\nexport function getQuorumValuesFromProtocolSummary(\n\tprotocolSummary: ISummaryTree,\n): [string, ICommittedProposal][] {\n\tconst quorumValuesBlob = protocolSummary.tree.quorumValues as ISummaryBlob;\n\tconst quorumValues = JSON.parse(quorumValuesBlob.content as string) as [\n\t\tstring,\n\t\tICommittedProposal,\n\t][];\n\treturn quorumValues;\n}\n"]}
|
package/lib/treeConversions.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { ISummaryTree, ITree } from "@fluidframework/protocol-definitions";
|
|
|
6
6
|
/**
|
|
7
7
|
* Converts ISummaryTree to ITree format.
|
|
8
8
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
9
|
+
* @public
|
|
9
10
|
*/
|
|
10
11
|
export declare function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree;
|
|
11
12
|
//# sourceMappingURL=treeConversions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeConversions.d.ts","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,KAAK,EAA2B,MAAM,sCAAsC,CAAC;AAIpG
|
|
1
|
+
{"version":3,"file":"treeConversions.d.ts","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,KAAK,EAA2B,MAAM,sCAAsC,CAAC;AAIpG;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAgDlF"}
|
package/lib/treeConversions.js
CHANGED
|
@@ -10,6 +10,7 @@ import { isCombinedAppAndProtocolSummary } from "./summaryForCreateNew";
|
|
|
10
10
|
/**
|
|
11
11
|
* Converts ISummaryTree to ITree format.
|
|
12
12
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
13
|
+
* @public
|
|
13
14
|
*/
|
|
14
15
|
export function convertSummaryTreeToSnapshotITree(summaryTree) {
|
|
15
16
|
const entries = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeConversions.js","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAmC,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"treeConversions.js","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAmC,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAExE;;;;GAIG;AACH,MAAM,UAAU,iCAAiC,CAAC,WAAyB;IAC1E,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,+BAA+B,CAAC,WAAW,CAAC,CAAC;IACtE,MAAM,iBAAiB,GAAG,gBAAgB;QACzC,CAAC,CAAC;YACA,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;YACrD,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;SAC/C;QACH,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEpC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,iBAAiB,EAAE;QAC7C,MAAM,CAAC,GAAG,gBAAgB,IAAI,GAAG,KAAK,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;QACzE,QAAQ,KAAK,CAAC,IAAI,EAAE;YACnB,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;gBACtB,IAAI,aAAqB,CAAC;gBAC1B,IAAI,QAAQ,GAAuB,OAAO,CAAC;gBAC3C,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE;oBACtC,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC;iBAC9B;qBAAM;oBACN,aAAa,GAAG,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;oBAC5D,QAAQ,GAAG,QAAQ,CAAC;iBACpB;gBACD,OAAO,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;gBAC5D,MAAM;aACN;YAED,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;gBACtB,OAAO,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC7E,MAAM;aACN;YAED,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC;gBAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;gBACnD,MAAM;aACN;YAED,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAC/D;YAED;gBACC,eAAe,CAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;SACxD;KACD;IACD,OAAO;QACN,OAAO;QACP,YAAY,EAAE,WAAW,CAAC,YAAY;KACtC,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { unreachableCase } from \"@fluidframework/core-utils\";\nimport { ISummaryTree, ITree, ITreeEntry, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from \"./blob\";\nimport { isCombinedAppAndProtocolSummary } from \"./summaryForCreateNew\";\n\n/**\n * Converts ISummaryTree to ITree format.\n * @param summaryTree - summary tree in ISummaryTree format\n * @public\n */\nexport function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree {\n\tconst entries: ITreeEntry[] = [];\n\tconst adaptSummaryTree = isCombinedAppAndProtocolSummary(summaryTree);\n\tconst allSummaryEntries = adaptSummaryTree\n\t\t? [\n\t\t\t\t...Object.entries(summaryTree.tree[\".protocol\"].tree),\n\t\t\t\t...Object.entries(summaryTree.tree[\".app\"].tree),\n\t\t ]\n\t\t: Object.entries(summaryTree.tree);\n\n\tfor (const [key, value] of allSummaryEntries) {\n\t\tconst k = adaptSummaryTree && key === \"attributes\" ? \".attributes\" : key;\n\t\tswitch (value.type) {\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tlet parsedContent: string;\n\t\t\t\tlet encoding: \"utf-8\" | \"base64\" = \"utf-8\";\n\t\t\t\tif (typeof value.content === \"string\") {\n\t\t\t\t\tparsedContent = value.content;\n\t\t\t\t} else {\n\t\t\t\t\tparsedContent = Uint8ArrayToString(value.content, \"base64\");\n\t\t\t\t\tencoding = \"base64\";\n\t\t\t\t}\n\t\t\t\tentries.push(new BlobTreeEntry(k, parsedContent, encoding));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\tentries.push(new TreeTreeEntry(k, convertSummaryTreeToSnapshotITree(value)));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase SummaryType.Attachment: {\n\t\t\t\tentries.push(new AttachmentTreeEntry(k, value.id));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase SummaryType.Handle: {\n\t\t\t\tthrow new Error(\"Should not have Handle type in summary tree\");\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tunreachableCase(value, \"Unexpected summary tree type\");\n\t\t}\n\t}\n\treturn {\n\t\tentries,\n\t\tunreferenced: summaryTree.unreferenced,\n\t};\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.7.2.0.204906",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,42 +35,41 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": "2.0.0-dev.
|
|
39
|
-
"@fluidframework/core-interfaces": "2.0.0-dev.
|
|
40
|
-
"@fluidframework/core-utils": "2.0.0-dev.
|
|
41
|
-
"@fluidframework/driver-definitions": "2.0.0-dev.
|
|
42
|
-
"@fluidframework/gitresources": "^
|
|
43
|
-
"@fluidframework/protocol-base": "^
|
|
44
|
-
"@fluidframework/protocol-definitions": "^
|
|
45
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev.
|
|
38
|
+
"@fluid-internal/client-utils": "2.0.0-dev.7.2.0.204906",
|
|
39
|
+
"@fluidframework/core-interfaces": "2.0.0-dev.7.2.0.204906",
|
|
40
|
+
"@fluidframework/core-utils": "2.0.0-dev.7.2.0.204906",
|
|
41
|
+
"@fluidframework/driver-definitions": "2.0.0-dev.7.2.0.204906",
|
|
42
|
+
"@fluidframework/gitresources": "^2.0.1",
|
|
43
|
+
"@fluidframework/protocol-base": "^2.0.1",
|
|
44
|
+
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
45
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev.7.2.0.204906",
|
|
46
46
|
"axios": "^0.26.0",
|
|
47
47
|
"lz4js": "^0.2.0",
|
|
48
48
|
"url": "^0.11.0",
|
|
49
49
|
"uuid": "^9.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@fluid-tools/build-cli": "
|
|
53
|
-
"@fluidframework/build-common": "^2.0.
|
|
54
|
-
"@fluidframework/build-tools": "
|
|
55
|
-
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.
|
|
56
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
57
|
-
"@fluidframework/mocha-test-setup": "2.0.0-dev.
|
|
58
|
-
"@microsoft/api-extractor": "^7.
|
|
52
|
+
"@fluid-tools/build-cli": "0.26.0-203096",
|
|
53
|
+
"@fluidframework/build-common": "^2.0.2",
|
|
54
|
+
"@fluidframework/build-tools": "0.26.0-203096",
|
|
55
|
+
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.7.1.0",
|
|
56
|
+
"@fluidframework/eslint-config-fluid": "^3.0.0",
|
|
57
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev.7.2.0.204906",
|
|
58
|
+
"@microsoft/api-extractor": "^7.37.0",
|
|
59
59
|
"@types/mocha": "^9.1.1",
|
|
60
60
|
"@types/node": "^16.18.38",
|
|
61
61
|
"@types/sinon": "^7.0.13",
|
|
62
62
|
"c8": "^7.7.1",
|
|
63
|
-
"copyfiles": "^2.4.1",
|
|
64
63
|
"cross-env": "^7.0.3",
|
|
65
|
-
"eslint": "~8.
|
|
64
|
+
"eslint": "~8.50.0",
|
|
66
65
|
"mocha": "^10.2.0",
|
|
67
66
|
"mocha-json-output-reporter": "^2.0.1",
|
|
68
67
|
"mocha-multi-reporters": "^1.5.1",
|
|
69
68
|
"moment": "^2.21.0",
|
|
70
|
-
"prettier": "~
|
|
69
|
+
"prettier": "~3.0.3",
|
|
71
70
|
"rimraf": "^4.4.0",
|
|
72
71
|
"sinon": "^7.4.2",
|
|
73
|
-
"typescript": "~
|
|
72
|
+
"typescript": "~5.1.6"
|
|
74
73
|
},
|
|
75
74
|
"typeValidation": {
|
|
76
75
|
"broken": {}
|
|
@@ -79,11 +78,11 @@
|
|
|
79
78
|
"build": "fluid-build . --task build",
|
|
80
79
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
81
80
|
"build:compile": "fluid-build . --task compile",
|
|
82
|
-
"build:docs": "api-extractor run --local
|
|
81
|
+
"build:docs": "api-extractor run --local",
|
|
83
82
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
84
83
|
"build:genver": "gen-version",
|
|
85
84
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
86
|
-
"ci:build:docs": "api-extractor run
|
|
85
|
+
"ci:build:docs": "api-extractor run",
|
|
87
86
|
"clean": "rimraf --glob 'dist' 'lib' '*.tsbuildinfo' '*.build.log' '_api-extractor-temp' 'nyc'",
|
|
88
87
|
"eslint": "eslint --format stylish src",
|
|
89
88
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
6
9
|
export enum SummaryCompressionAlgorithm {
|
|
7
10
|
None = 0,
|
|
8
11
|
LZ4 = 1,
|
|
9
12
|
}
|
|
10
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
11
17
|
export interface ICompressionStorageConfig {
|
|
12
18
|
algorithm: SummaryCompressionAlgorithm;
|
|
13
19
|
minSizeToCompress: number;
|
|
@@ -9,7 +9,10 @@ import { DocumentStorageServiceCompressionAdapter as DocumentStorageServiceSumma
|
|
|
9
9
|
import { ICompressionStorageConfig } from "./compressionTypes";
|
|
10
10
|
|
|
11
11
|
export class DocumentServiceCompressionAdapter extends DocumentServiceProxy {
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(
|
|
13
|
+
service: IDocumentService,
|
|
14
|
+
private readonly _config: ICompressionStorageConfig,
|
|
15
|
+
) {
|
|
13
16
|
super(service);
|
|
14
17
|
}
|
|
15
18
|
|
|
@@ -30,15 +30,7 @@ export class DocumentServiceFactoryCompressionAdapter extends DocumentServiceFac
|
|
|
30
30
|
clientIsSummarizer?: boolean,
|
|
31
31
|
): Promise<IDocumentService> {
|
|
32
32
|
if (createNewSummary !== undefined) {
|
|
33
|
-
|
|
34
|
-
// We must prevent the initial summary from being compressed because
|
|
35
|
-
// of the hack at packages/drivers/routerlicious-driver/src/createNewUtils.ts
|
|
36
|
-
// where the binary blob is converted to a string using UTF-8 encoding
|
|
37
|
-
// which is producing incorrect results for compressed data.
|
|
38
|
-
const configForInitial = {
|
|
39
|
-
...this._config,
|
|
40
|
-
minSizeToCompress: Number.POSITIVE_INFINITY,
|
|
41
|
-
};
|
|
33
|
+
const configForInitial = this._config;
|
|
42
34
|
const newAppSumary =
|
|
43
35
|
DocumentStorageServiceSummaryBlobCompressionAdapter.compressSummary(
|
|
44
36
|
createNewSummary.tree[".app"] as ISummaryTree,
|
package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts
CHANGED
|
@@ -19,6 +19,9 @@ import { compress, decompress } from "lz4js";
|
|
|
19
19
|
import { DocumentStorageServiceProxy } from "../../../documentStorageServiceProxy";
|
|
20
20
|
import { ICompressionStorageConfig, SummaryCompressionAlgorithm } from "../";
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
22
25
|
export const blobHeadersBlobName = ".metadata.blobHeaders";
|
|
23
26
|
const metadataBlobName = ".metadata";
|
|
24
27
|
|
|
@@ -32,6 +35,7 @@ const metadataBlobName = ".metadata";
|
|
|
32
35
|
* In case, the markup blob is present, it is expected that the first byte of the markup blob
|
|
33
36
|
* will contain the info about the compression. If the first byte is not present, it is assumed
|
|
34
37
|
* that the compression is not enabled and no first prefix byte is present in the blobs.
|
|
38
|
+
* @public
|
|
35
39
|
*/
|
|
36
40
|
export class DocumentStorageServiceCompressionAdapter extends DocumentStorageServiceProxy {
|
|
37
41
|
private _isCompressionEnabled: boolean = false;
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
* @param documentServiceFactory - The document service factory to apply compression to.
|
|
18
18
|
* @param config - The compression configuration.
|
|
19
19
|
* @returns The document service factory possibly with compression applied.
|
|
20
|
+
* @public
|
|
20
21
|
*/
|
|
21
22
|
export function applyStorageCompression(
|
|
22
23
|
documentServiceFactory: IDocumentServiceFactory,
|
package/src/blob.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Basic implementation of a blob ITreeEntry
|
|
16
|
+
* @public
|
|
16
17
|
*/
|
|
17
18
|
export class BlobTreeEntry {
|
|
18
19
|
public readonly mode = FileMode.File;
|
|
@@ -36,6 +37,7 @@ export class BlobTreeEntry {
|
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Basic implementation of a tree ITreeEntry
|
|
40
|
+
* @public
|
|
39
41
|
*/
|
|
40
42
|
export class TreeTreeEntry {
|
|
41
43
|
public readonly mode = FileMode.Directory;
|
|
@@ -46,11 +48,15 @@ export class TreeTreeEntry {
|
|
|
46
48
|
* @param path - path of entry
|
|
47
49
|
* @param value - subtree
|
|
48
50
|
*/
|
|
49
|
-
constructor(
|
|
51
|
+
constructor(
|
|
52
|
+
public readonly path: string,
|
|
53
|
+
public readonly value: ITree,
|
|
54
|
+
) {}
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
/**
|
|
53
58
|
* Basic implementation of an attachment ITreeEntry
|
|
59
|
+
* @public
|
|
54
60
|
*/
|
|
55
61
|
export class AttachmentTreeEntry {
|
|
56
62
|
public readonly mode = FileMode.File;
|
|
@@ -62,7 +68,10 @@ export class AttachmentTreeEntry {
|
|
|
62
68
|
* @param path - path of entry
|
|
63
69
|
* @param id - id of external blob attachment
|
|
64
70
|
*/
|
|
65
|
-
constructor(
|
|
71
|
+
constructor(
|
|
72
|
+
public readonly path: string,
|
|
73
|
+
public readonly id: string,
|
|
74
|
+
) {
|
|
66
75
|
this.value = { id };
|
|
67
76
|
}
|
|
68
77
|
}
|
package/src/buildSnapshotTree.ts
CHANGED
|
@@ -86,6 +86,7 @@ function flatten(tree: ITreeEntry[], blobMap: Map<string, ArrayBufferLike>): git
|
|
|
86
86
|
* @param blobMap - a map of blob's sha1 to content that gets filled with content from entries
|
|
87
87
|
* NOTE: blobMap's validity is contingent on the returned promise's resolution
|
|
88
88
|
* @returns the hierarchical tree
|
|
89
|
+
* @public
|
|
89
90
|
*/
|
|
90
91
|
export function buildSnapshotTree(
|
|
91
92
|
entries: ITreeEntry[],
|
package/src/error.ts
CHANGED
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
import { DriverErrorType, IDriverErrorBase } from "@fluidframework/driver-definitions";
|
|
8
8
|
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
11
14
|
export class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
12
15
|
// eslint-disable-next-line import/no-deprecated
|
|
13
16
|
readonly errorType = DriverErrorType.usageError;
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ import Axios from "axios";
|
|
|
22
22
|
* The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional
|
|
23
23
|
* part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service
|
|
24
24
|
* works or a router inside of a single page app framework.
|
|
25
|
+
* @public
|
|
25
26
|
*/
|
|
26
27
|
export class InsecureUrlResolver implements IUrlResolver {
|
|
27
28
|
private readonly cache = new Map<string, Promise<IResolvedUrl>>();
|
|
@@ -48,7 +49,7 @@ export class InsecureUrlResolver implements IUrlResolver {
|
|
|
48
49
|
// service using our bearer token.
|
|
49
50
|
if (this.isForNodeTest) {
|
|
50
51
|
const [, documentId, tmpRelativePath] = parsedUrl.pathname.substr(1).split("/");
|
|
51
|
-
const relativePath = tmpRelativePath
|
|
52
|
+
const relativePath = tmpRelativePath ?? "";
|
|
52
53
|
return this.resolveHelper(documentId, relativePath, parsedUrl.search);
|
|
53
54
|
} else if (parsedUrl.host === window.location.host) {
|
|
54
55
|
const fullPath = parsedUrl.pathname.substr(1);
|
|
@@ -12,18 +12,25 @@ import {
|
|
|
12
12
|
* Tells if message was sent by container runtime
|
|
13
13
|
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
14
14
|
* @returns whether the message is a runtime message
|
|
15
|
+
* @public
|
|
15
16
|
*/
|
|
16
17
|
export function isRuntimeMessage(message: { type: string }): boolean {
|
|
17
18
|
return message.type === MessageType.Operation;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* @privateRemarks ADO #1385: staging code changes across layers.
|
|
23
|
+
* Eventually to be replaced by MessageType.accept
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
22
26
|
export enum MessageType2 {
|
|
23
27
|
Accept = "accept",
|
|
24
28
|
}
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
27
34
|
export function canBeCoalescedByService(
|
|
28
35
|
message: ISequencedDocumentMessage | IDocumentMessage,
|
|
29
36
|
): boolean {
|
package/src/network.ts
CHANGED
|
@@ -16,15 +16,21 @@ import {
|
|
|
16
16
|
import { ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
17
17
|
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
19
22
|
export enum OnlineStatus {
|
|
20
23
|
Offline,
|
|
21
24
|
Online,
|
|
22
25
|
Unknown,
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
/**
|
|
29
|
+
* It tells if we have local connection only - we might not have connection to web.
|
|
30
|
+
* No solution for node.js (other than resolve dns names / ping specific sites)
|
|
31
|
+
* Can also use window.addEventListener("online" / "offline")
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
28
34
|
export function isOnline(): OnlineStatus {
|
|
29
35
|
if (
|
|
30
36
|
typeof navigator === "object" &&
|
|
@@ -36,25 +42,34 @@ export function isOnline(): OnlineStatus {
|
|
|
36
42
|
return OnlineStatus.Unknown;
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Telemetry props with driver-specific required properties
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
40
49
|
export type DriverErrorTelemetryProps = ITelemetryProperties & {
|
|
41
50
|
driverVersion: string | undefined;
|
|
42
51
|
};
|
|
43
52
|
|
|
44
53
|
/**
|
|
45
54
|
* Generic network error class.
|
|
55
|
+
* @public
|
|
46
56
|
*/
|
|
47
57
|
export class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
48
58
|
// eslint-disable-next-line import/no-deprecated
|
|
49
59
|
readonly errorType = DriverErrorType.genericNetworkError;
|
|
50
60
|
|
|
51
|
-
constructor(
|
|
61
|
+
constructor(
|
|
62
|
+
message: string,
|
|
63
|
+
readonly canRetry: boolean,
|
|
64
|
+
props: DriverErrorTelemetryProps,
|
|
65
|
+
) {
|
|
52
66
|
super(message, props);
|
|
53
67
|
}
|
|
54
68
|
}
|
|
55
69
|
|
|
56
70
|
/**
|
|
57
71
|
* FluidInvalidSchema error class.
|
|
72
|
+
* @public
|
|
58
73
|
*/
|
|
59
74
|
export class FluidInvalidSchemaError
|
|
60
75
|
extends LoggingError
|
|
@@ -69,6 +84,9 @@ export class FluidInvalidSchemaError
|
|
|
69
84
|
}
|
|
70
85
|
}
|
|
71
86
|
|
|
87
|
+
/**
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
72
90
|
export class DeltaStreamConnectionForbiddenError
|
|
73
91
|
extends LoggingError
|
|
74
92
|
implements IDriverErrorBase, IFluidErrorBase
|
|
@@ -85,6 +103,9 @@ export class DeltaStreamConnectionForbiddenError
|
|
|
85
103
|
}
|
|
86
104
|
}
|
|
87
105
|
|
|
106
|
+
/**
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
88
109
|
export class AuthorizationError
|
|
89
110
|
extends LoggingError
|
|
90
111
|
implements IAuthorizationError, IFluidErrorBase
|
|
@@ -104,6 +125,9 @@ export class AuthorizationError
|
|
|
104
125
|
}
|
|
105
126
|
}
|
|
106
127
|
|
|
128
|
+
/**
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
107
131
|
export class LocationRedirectionError
|
|
108
132
|
extends LoggingError
|
|
109
133
|
implements ILocationRedirectionError, IFluidErrorBase
|
|
@@ -122,6 +146,9 @@ export class LocationRedirectionError
|
|
|
122
146
|
}
|
|
123
147
|
}
|
|
124
148
|
|
|
149
|
+
/**
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
125
152
|
export class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
|
|
126
153
|
constructor(
|
|
127
154
|
message: string,
|
|
@@ -133,20 +160,35 @@ export class NetworkErrorBasic<T extends string> extends LoggingError implements
|
|
|
133
160
|
}
|
|
134
161
|
}
|
|
135
162
|
|
|
163
|
+
/**
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
136
166
|
export class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
137
|
-
constructor(
|
|
167
|
+
constructor(
|
|
168
|
+
message: string,
|
|
169
|
+
readonly errorType: T,
|
|
170
|
+
props: DriverErrorTelemetryProps,
|
|
171
|
+
) {
|
|
138
172
|
super(message, errorType, false, props);
|
|
139
173
|
}
|
|
140
174
|
}
|
|
141
175
|
|
|
176
|
+
/**
|
|
177
|
+
* @public
|
|
178
|
+
*/
|
|
142
179
|
export class RetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
143
|
-
constructor(
|
|
180
|
+
constructor(
|
|
181
|
+
message: string,
|
|
182
|
+
readonly errorType: T,
|
|
183
|
+
props: DriverErrorTelemetryProps,
|
|
184
|
+
) {
|
|
144
185
|
super(message, errorType, true, props);
|
|
145
186
|
}
|
|
146
187
|
}
|
|
147
188
|
|
|
148
189
|
/**
|
|
149
190
|
* Throttling error class - used to communicate all throttling errors
|
|
191
|
+
* @public
|
|
150
192
|
*/
|
|
151
193
|
export class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
|
|
152
194
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -162,9 +204,15 @@ export class ThrottlingError extends LoggingError implements IThrottlingWarning,
|
|
|
162
204
|
}
|
|
163
205
|
}
|
|
164
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @public
|
|
209
|
+
*/
|
|
165
210
|
export const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>
|
|
166
211
|
new NonRetryableError(message, DriverErrorTypes.writeError, props);
|
|
167
212
|
|
|
213
|
+
/**
|
|
214
|
+
* @public
|
|
215
|
+
*/
|
|
168
216
|
export function createGenericNetworkError(
|
|
169
217
|
message: string,
|
|
170
218
|
retryInfo: { canRetry: boolean; retryAfterMs?: number },
|
|
@@ -180,13 +228,20 @@ export function createGenericNetworkError(
|
|
|
180
228
|
* Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
|
|
181
229
|
* I.e. asserts or unexpected exceptions in our code result in container failure.
|
|
182
230
|
* @param error - The error to inspect for ability to retry
|
|
231
|
+
* @public
|
|
183
232
|
*/
|
|
184
233
|
export const canRetryOnError = (error: any): boolean => error?.canRetry === true;
|
|
185
234
|
|
|
186
|
-
/**
|
|
235
|
+
/**
|
|
236
|
+
* Check retryAfterSeconds property on error
|
|
237
|
+
* @public
|
|
238
|
+
* */
|
|
187
239
|
export const getRetryDelaySecondsFromError = (error: any): number | undefined =>
|
|
188
240
|
error?.retryAfterSeconds as number | undefined;
|
|
189
241
|
|
|
190
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* Check retryAfterSeconds property on error and convert to ms
|
|
244
|
+
* @public
|
|
245
|
+
* */
|
|
191
246
|
export const getRetryDelayFromError = (error: any): number | undefined =>
|
|
192
247
|
error?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;
|
package/src/networkUtils.ts
CHANGED
|
@@ -7,6 +7,9 @@ import { ITelemetryErrorEvent } from "@fluidframework/core-interfaces";
|
|
|
7
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
8
|
import { isOnline, OnlineStatus, canRetryOnError } from "./network";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
10
13
|
export function logNetworkFailure(
|
|
11
14
|
logger: ITelemetryLoggerExt,
|
|
12
15
|
event: ITelemetryErrorEvent,
|
package/src/packageVersion.ts
CHANGED
package/src/parallelRequests.ts
CHANGED
|
@@ -29,11 +29,12 @@ type WorkingState = "working" | "done" | "canceled";
|
|
|
29
29
|
* @param logger - logger to use
|
|
30
30
|
* @param requestCallback - callback to request batches
|
|
31
31
|
* @returns Queue that can be used to retrieve data
|
|
32
|
+
* @public
|
|
32
33
|
*/
|
|
33
34
|
export class ParallelRequests<T> {
|
|
34
35
|
private latestRequested: number;
|
|
35
36
|
private nextToDeliver: number;
|
|
36
|
-
private readonly results
|
|
37
|
+
private readonly results = new Map<number, T[]>();
|
|
37
38
|
private workingState: WorkingState = "working";
|
|
38
39
|
private requestsInFlight = 0;
|
|
39
40
|
private readonly endEvent = new Deferred<void>();
|
|
@@ -338,6 +339,7 @@ export class ParallelRequests<T> {
|
|
|
338
339
|
/**
|
|
339
340
|
* Helper queue class to allow async push / pull
|
|
340
341
|
* It's essentially a pipe allowing multiple writers, and single reader
|
|
342
|
+
* @public
|
|
341
343
|
*/
|
|
342
344
|
export class Queue<T> implements IStream<T> {
|
|
343
345
|
private readonly queue: Promise<IStreamResult<T>>[] = [];
|
|
@@ -531,6 +533,7 @@ async function getSingleOpBatch(
|
|
|
531
533
|
* @param signal - Cancelation signal
|
|
532
534
|
* @param scenarioName - Reason for fetching ops
|
|
533
535
|
* @returns Messages fetched
|
|
536
|
+
* @public
|
|
534
537
|
*/
|
|
535
538
|
export function requestOps(
|
|
536
539
|
get: (
|
|
@@ -651,12 +654,18 @@ export function requestOps(
|
|
|
651
654
|
return queue;
|
|
652
655
|
}
|
|
653
656
|
|
|
657
|
+
/**
|
|
658
|
+
* @public
|
|
659
|
+
*/
|
|
654
660
|
export const emptyMessageStream: IStream<ISequencedDocumentMessage[]> = {
|
|
655
661
|
read: async () => {
|
|
656
662
|
return { done: true };
|
|
657
663
|
},
|
|
658
664
|
};
|
|
659
665
|
|
|
666
|
+
/**
|
|
667
|
+
* @public
|
|
668
|
+
*/
|
|
660
669
|
export function streamFromMessages(
|
|
661
670
|
messagesArg: Promise<ISequencedDocumentMessage[]>,
|
|
662
671
|
): IStream<ISequencedDocumentMessage[]> {
|
|
@@ -673,6 +682,9 @@ export function streamFromMessages(
|
|
|
673
682
|
};
|
|
674
683
|
}
|
|
675
684
|
|
|
685
|
+
/**
|
|
686
|
+
* @public
|
|
687
|
+
*/
|
|
676
688
|
export function streamObserver<T>(
|
|
677
689
|
stream: IStream<T>,
|
|
678
690
|
handler: (value: IStreamResult<T>) => void,
|
|
@@ -7,6 +7,9 @@ import { ISnapshotTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
|
7
7
|
import { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
|
|
8
8
|
import { canRetryOnError } from "./network";
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
10
13
|
export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {
|
|
11
14
|
// BlobId -> blob prefetchCache cache
|
|
12
15
|
private readonly prefetchCache = new Map<string, Promise<ArrayBufferLike>>();
|