@fluidframework/driver-utils 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +1 -2
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +9 -1
- package/api-report/driver-utils.api.md +48 -48
- package/dist/adapters/compression/compressionTypes.d.ts +2 -2
- package/dist/adapters/compression/compressionTypes.js +1 -1
- package/dist/adapters/compression/compressionTypes.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +1 -1
- package/dist/adapters/predefinedAdapters.js +1 -1
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/blob.d.ts +3 -3
- package/dist/blob.js +3 -3
- package/dist/blob.js.map +1 -1
- package/dist/buildSnapshotTree.d.ts +1 -1
- package/dist/buildSnapshotTree.js +1 -1
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +1 -1
- package/dist/documentStorageServiceProxy.js +1 -1
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/driver-utils-alpha.d.ts +169 -0
- package/dist/driver-utils-beta.d.ts +176 -0
- package/dist/driver-utils-public.d.ts +176 -0
- package/dist/driver-utils-untrimmed.d.ts +590 -0
- package/dist/error.d.ts +1 -1
- package/dist/error.js +1 -1
- package/dist/error.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts +1 -1
- package/dist/insecureUrlResolver.js +1 -1
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/messageRecognition.d.ts +3 -3
- package/dist/messageRecognition.js +3 -3
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +19 -19
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +18 -18
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +1 -1
- package/dist/networkUtils.js +1 -1
- 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 +6 -6
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +14 -14
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts +1 -1
- package/dist/prefetchDocumentStorageService.js +1 -1
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/rateLimiter.d.ts +1 -1
- package/dist/rateLimiter.js +1 -1
- package/dist/rateLimiter.js.map +1 -1
- package/dist/readAndParse.d.ts +1 -1
- package/dist/readAndParse.js +1 -1
- package/dist/readAndParse.js.map +1 -1
- package/dist/runWithRetry.d.ts +11 -9
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/runWithRetry.js +20 -16
- package/dist/runWithRetry.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +2 -2
- package/dist/summaryForCreateNew.js +2 -2
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts +1 -1
- package/dist/treeConversions.js +1 -1
- package/dist/treeConversions.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/adapters/compression/compressionTypes.d.ts +2 -2
- package/lib/adapters/compression/compressionTypes.js +1 -1
- package/lib/adapters/compression/compressionTypes.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/adapters/predefinedAdapters.d.ts +1 -1
- package/lib/adapters/predefinedAdapters.js +1 -1
- package/lib/adapters/predefinedAdapters.js.map +1 -1
- package/lib/blob.d.ts +3 -3
- package/lib/blob.js +3 -3
- package/lib/blob.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts +1 -1
- package/lib/buildSnapshotTree.js +1 -1
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +1 -1
- package/lib/documentStorageServiceProxy.js +1 -1
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/driver-utils-alpha.d.ts +169 -0
- package/lib/driver-utils-beta.d.ts +176 -0
- package/lib/driver-utils-public.d.ts +176 -0
- package/lib/driver-utils-untrimmed.d.ts +590 -0
- package/lib/error.d.ts +1 -1
- package/lib/error.js +1 -1
- package/lib/error.js.map +1 -1
- package/lib/insecureUrlResolver.d.ts +1 -1
- package/lib/insecureUrlResolver.js +1 -1
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/messageRecognition.d.ts +3 -3
- package/lib/messageRecognition.js +3 -3
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +19 -19
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +18 -18
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +1 -1
- package/lib/networkUtils.js +1 -1
- 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 +6 -6
- package/lib/parallelRequests.d.ts.map +1 -1
- package/lib/parallelRequests.js +14 -14
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts +1 -1
- package/lib/prefetchDocumentStorageService.js +1 -1
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/rateLimiter.d.ts +1 -1
- package/lib/rateLimiter.js +1 -1
- package/lib/rateLimiter.js.map +1 -1
- package/lib/readAndParse.d.ts +1 -1
- package/lib/readAndParse.js +1 -1
- package/lib/readAndParse.js.map +1 -1
- package/lib/runWithRetry.d.ts +11 -9
- package/lib/runWithRetry.d.ts.map +1 -1
- package/lib/runWithRetry.js +20 -16
- package/lib/runWithRetry.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +2 -2
- package/lib/summaryForCreateNew.js +2 -2
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts +1 -1
- package/lib/treeConversions.js +1 -1
- package/lib/treeConversions.js.map +1 -1
- package/package.json +38 -19
- package/src/adapters/compression/compressionTypes.ts +2 -2
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +1 -1
- package/src/adapters/predefinedAdapters.ts +1 -1
- package/src/blob.ts +3 -3
- package/src/buildSnapshotTree.ts +1 -1
- package/src/documentStorageServiceProxy.ts +1 -1
- package/src/error.ts +1 -1
- package/src/insecureUrlResolver.ts +1 -1
- package/src/messageRecognition.ts +3 -3
- package/src/network.ts +19 -19
- package/src/networkUtils.ts +1 -1
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +15 -15
- package/src/prefetchDocumentStorageService.ts +1 -1
- package/src/rateLimiter.ts +1 -1
- package/src/readAndParse.ts +1 -1
- package/src/runWithRetry.ts +25 -18
- package/src/summaryForCreateNew.ts +2 -2
- package/src/treeConversions.ts +1 -1
|
@@ -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,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 * @
|
|
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 * @internal\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 * @internal\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,7 +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
|
-
* @
|
|
9
|
+
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export declare function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree;
|
|
12
12
|
//# sourceMappingURL=treeConversions.d.ts.map
|
package/lib/treeConversions.js
CHANGED
|
@@ -10,7 +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
|
-
* @
|
|
13
|
+
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export function convertSummaryTreeToSnapshotITree(summaryTree) {
|
|
16
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;;;;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 * @
|
|
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 * @internal\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-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.4.0",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,31 +35,33 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
39
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
40
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
41
|
-
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
39
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
40
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
41
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
42
42
|
"@fluidframework/gitresources": "^2.0.1",
|
|
43
43
|
"@fluidframework/protocol-base": "^2.0.1",
|
|
44
44
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
45
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
45
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
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
|
-
"@
|
|
52
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
53
|
+
"@fluid-tools/build-cli": "^0.28.0",
|
|
53
54
|
"@fluidframework/build-common": "^2.0.3",
|
|
54
|
-
"@fluidframework/build-tools": "^0.
|
|
55
|
-
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.7.2.
|
|
56
|
-
"@fluidframework/eslint-config-fluid": "^3.
|
|
57
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
58
|
-
"@microsoft/api-extractor": "^7.
|
|
55
|
+
"@fluidframework/build-tools": "^0.28.0",
|
|
56
|
+
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.7.2.0",
|
|
57
|
+
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
58
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.4.0 <2.0.0-internal.7.5.0",
|
|
59
|
+
"@microsoft/api-extractor": "^7.38.3",
|
|
59
60
|
"@types/mocha": "^9.1.1",
|
|
60
|
-
"@types/node": "^
|
|
61
|
+
"@types/node": "^18.19.0",
|
|
61
62
|
"@types/sinon": "^7.0.13",
|
|
62
63
|
"c8": "^7.7.1",
|
|
64
|
+
"copyfiles": "^2.4.1",
|
|
63
65
|
"cross-env": "^7.0.3",
|
|
64
66
|
"eslint": "~8.50.0",
|
|
65
67
|
"mocha": "^10.2.0",
|
|
@@ -71,29 +73,46 @@
|
|
|
71
73
|
"sinon": "^7.4.2",
|
|
72
74
|
"typescript": "~5.1.6"
|
|
73
75
|
},
|
|
76
|
+
"fluidBuild": {
|
|
77
|
+
"tasks": {
|
|
78
|
+
"build:docs": {
|
|
79
|
+
"dependsOn": [
|
|
80
|
+
"...",
|
|
81
|
+
"api-extractor:commonjs",
|
|
82
|
+
"api-extractor:esnext"
|
|
83
|
+
],
|
|
84
|
+
"script": false
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
74
88
|
"typeValidation": {
|
|
75
89
|
"broken": {}
|
|
76
90
|
},
|
|
77
91
|
"scripts": {
|
|
92
|
+
"api": "fluid-build . --task api",
|
|
93
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
94
|
+
"api-extractor:esnext": "copyfiles -u 1 \"dist/**/*-@(alpha|beta|public|untrimmed).d.ts\" lib",
|
|
78
95
|
"build": "fluid-build . --task build",
|
|
79
96
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
80
97
|
"build:compile": "fluid-build . --task compile",
|
|
81
|
-
"build:docs": "
|
|
98
|
+
"build:docs": "fluid-build . --task api",
|
|
82
99
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
83
100
|
"build:genver": "gen-version",
|
|
84
101
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
102
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
103
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
85
104
|
"ci:build:docs": "api-extractor run",
|
|
86
|
-
"clean": "rimraf --glob dist lib \"
|
|
105
|
+
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
87
106
|
"eslint": "eslint --format stylish src",
|
|
88
107
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
89
108
|
"format": "npm run prettier:fix",
|
|
90
|
-
"lint": "npm run prettier && npm run eslint",
|
|
109
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
91
110
|
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
92
|
-
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
|
|
93
|
-
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
|
|
111
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
112
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
94
113
|
"test": "npm run test:mocha",
|
|
95
114
|
"test:coverage": "c8 npm test",
|
|
96
|
-
"test:mocha": "mocha --ignore
|
|
115
|
+
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
|
|
97
116
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
98
117
|
"tsc": "tsc",
|
|
99
118
|
"typetests:gen": "fluid-type-test-generator",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* @alpha
|
|
8
8
|
*/
|
|
9
9
|
export enum SummaryCompressionAlgorithm {
|
|
10
10
|
None = 0,
|
|
@@ -12,7 +12,7 @@ export enum SummaryCompressionAlgorithm {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @
|
|
15
|
+
* @alpha
|
|
16
16
|
*/
|
|
17
17
|
export interface ICompressionStorageConfig {
|
|
18
18
|
algorithm: SummaryCompressionAlgorithm;
|
package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { DocumentStorageServiceProxy } from "../../../documentStorageServiceProx
|
|
|
20
20
|
import { ICompressionStorageConfig, SummaryCompressionAlgorithm } from "../";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* @
|
|
23
|
+
* @internal
|
|
24
24
|
*/
|
|
25
25
|
export const blobHeadersBlobName = ".metadata.blobHeaders";
|
|
26
26
|
const metadataBlobName = ".metadata";
|
|
@@ -17,7 +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
|
-
* @
|
|
20
|
+
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export function applyStorageCompression(
|
|
23
23
|
documentServiceFactory: IDocumentServiceFactory,
|
package/src/blob.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Basic implementation of a blob ITreeEntry
|
|
16
|
-
* @
|
|
16
|
+
* @internal
|
|
17
17
|
*/
|
|
18
18
|
export class BlobTreeEntry {
|
|
19
19
|
public readonly mode = FileMode.File;
|
|
@@ -37,7 +37,7 @@ export class BlobTreeEntry {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Basic implementation of a tree ITreeEntry
|
|
40
|
-
* @
|
|
40
|
+
* @internal
|
|
41
41
|
*/
|
|
42
42
|
export class TreeTreeEntry {
|
|
43
43
|
public readonly mode = FileMode.Directory;
|
|
@@ -56,7 +56,7 @@ export class TreeTreeEntry {
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Basic implementation of an attachment ITreeEntry
|
|
59
|
-
* @
|
|
59
|
+
* @internal
|
|
60
60
|
*/
|
|
61
61
|
export class AttachmentTreeEntry {
|
|
62
62
|
public readonly mode = FileMode.File;
|
package/src/buildSnapshotTree.ts
CHANGED
|
@@ -86,7 +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
|
-
* @
|
|
89
|
+
* @internal
|
|
90
90
|
*/
|
|
91
91
|
export function buildSnapshotTree(
|
|
92
92
|
entries: ITreeEntry[],
|
package/src/error.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
12
|
-
* @
|
|
12
|
+
* @internal
|
|
13
13
|
*/
|
|
14
14
|
export class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
15
15
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -22,7 +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
|
-
* @
|
|
25
|
+
* @internal
|
|
26
26
|
*/
|
|
27
27
|
export class InsecureUrlResolver implements IUrlResolver {
|
|
28
28
|
private readonly cache = new Map<string, Promise<IResolvedUrl>>();
|
|
@@ -12,7 +12,7 @@ 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
|
-
* @
|
|
15
|
+
* @internal
|
|
16
16
|
*/
|
|
17
17
|
export function isRuntimeMessage(message: { type: string }): boolean {
|
|
18
18
|
return message.type === MessageType.Operation;
|
|
@@ -21,7 +21,7 @@ export function isRuntimeMessage(message: { type: string }): boolean {
|
|
|
21
21
|
/**
|
|
22
22
|
* @privateRemarks ADO #1385: staging code changes across layers.
|
|
23
23
|
* Eventually to be replaced by MessageType.accept
|
|
24
|
-
* @
|
|
24
|
+
* @internal
|
|
25
25
|
*/
|
|
26
26
|
export enum MessageType2 {
|
|
27
27
|
Accept = "accept",
|
|
@@ -29,7 +29,7 @@ export enum MessageType2 {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
32
|
-
* @
|
|
32
|
+
* @internal
|
|
33
33
|
*/
|
|
34
34
|
export function canBeCoalescedByService(
|
|
35
35
|
message: ISequencedDocumentMessage | IDocumentMessage,
|
package/src/network.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { ITelemetryProperties } from "@fluidframework/core-interfaces";
|
|
|
17
17
|
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* @
|
|
20
|
+
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export enum OnlineStatus {
|
|
23
23
|
Offline,
|
|
@@ -29,7 +29,7 @@ export enum OnlineStatus {
|
|
|
29
29
|
* It tells if we have local connection only - we might not have connection to web.
|
|
30
30
|
* No solution for node.js (other than resolve dns names / ping specific sites)
|
|
31
31
|
* Can also use window.addEventListener("online" / "offline")
|
|
32
|
-
* @
|
|
32
|
+
* @internal
|
|
33
33
|
*/
|
|
34
34
|
export function isOnline(): OnlineStatus {
|
|
35
35
|
if (
|
|
@@ -44,7 +44,7 @@ export function isOnline(): OnlineStatus {
|
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* Telemetry props with driver-specific required properties
|
|
47
|
-
* @
|
|
47
|
+
* @internal
|
|
48
48
|
*/
|
|
49
49
|
export type DriverErrorTelemetryProps = ITelemetryProperties & {
|
|
50
50
|
driverVersion: string | undefined;
|
|
@@ -52,7 +52,7 @@ export type DriverErrorTelemetryProps = ITelemetryProperties & {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Generic network error class.
|
|
55
|
-
* @
|
|
55
|
+
* @internal
|
|
56
56
|
*/
|
|
57
57
|
export class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
58
58
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -69,7 +69,7 @@ export class GenericNetworkError extends LoggingError implements IDriverErrorBas
|
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* FluidInvalidSchema error class.
|
|
72
|
-
* @
|
|
72
|
+
* @internal
|
|
73
73
|
*/
|
|
74
74
|
export class FluidInvalidSchemaError
|
|
75
75
|
extends LoggingError
|
|
@@ -85,7 +85,7 @@ export class FluidInvalidSchemaError
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
|
-
* @
|
|
88
|
+
* @internal
|
|
89
89
|
*/
|
|
90
90
|
export class DeltaStreamConnectionForbiddenError
|
|
91
91
|
extends LoggingError
|
|
@@ -104,7 +104,7 @@ export class DeltaStreamConnectionForbiddenError
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* @
|
|
107
|
+
* @internal
|
|
108
108
|
*/
|
|
109
109
|
export class AuthorizationError
|
|
110
110
|
extends LoggingError
|
|
@@ -126,7 +126,7 @@ export class AuthorizationError
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
* @
|
|
129
|
+
* @internal
|
|
130
130
|
*/
|
|
131
131
|
export class LocationRedirectionError
|
|
132
132
|
extends LoggingError
|
|
@@ -147,7 +147,7 @@ export class LocationRedirectionError
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
* @
|
|
150
|
+
* @internal
|
|
151
151
|
*/
|
|
152
152
|
export class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {
|
|
153
153
|
constructor(
|
|
@@ -161,7 +161,7 @@ export class NetworkErrorBasic<T extends string> extends LoggingError implements
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/**
|
|
164
|
-
* @
|
|
164
|
+
* @internal
|
|
165
165
|
*/
|
|
166
166
|
export class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
167
167
|
constructor(
|
|
@@ -174,7 +174,7 @@ export class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
|
-
* @
|
|
177
|
+
* @internal
|
|
178
178
|
*/
|
|
179
179
|
export class RetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
180
180
|
constructor(
|
|
@@ -188,7 +188,7 @@ export class RetryableError<T extends string> extends NetworkErrorBasic<T> {
|
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
190
|
* Throttling error class - used to communicate all throttling errors
|
|
191
|
-
* @
|
|
191
|
+
* @internal
|
|
192
192
|
*/
|
|
193
193
|
export class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
|
|
194
194
|
// eslint-disable-next-line import/no-deprecated
|
|
@@ -205,13 +205,13 @@ export class ThrottlingError extends LoggingError implements IThrottlingWarning,
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
|
-
* @
|
|
208
|
+
* @internal
|
|
209
209
|
*/
|
|
210
210
|
export const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>
|
|
211
211
|
new NonRetryableError(message, DriverErrorTypes.writeError, props);
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
|
-
* @
|
|
214
|
+
* @internal
|
|
215
215
|
*/
|
|
216
216
|
export function createGenericNetworkError(
|
|
217
217
|
message: string,
|
|
@@ -228,20 +228,20 @@ export function createGenericNetworkError(
|
|
|
228
228
|
* Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.
|
|
229
229
|
* I.e. asserts or unexpected exceptions in our code result in container failure.
|
|
230
230
|
* @param error - The error to inspect for ability to retry
|
|
231
|
-
* @
|
|
231
|
+
* @internal
|
|
232
232
|
*/
|
|
233
233
|
export const canRetryOnError = (error: any): boolean => error?.canRetry === true;
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
236
|
* Check retryAfterSeconds property on error
|
|
237
|
-
* @
|
|
238
|
-
|
|
237
|
+
* @internal
|
|
238
|
+
*/
|
|
239
239
|
export const getRetryDelaySecondsFromError = (error: any): number | undefined =>
|
|
240
240
|
error?.retryAfterSeconds as number | undefined;
|
|
241
241
|
|
|
242
242
|
/**
|
|
243
243
|
* Check retryAfterSeconds property on error and convert to ms
|
|
244
|
-
* @
|
|
245
|
-
|
|
244
|
+
* @internal
|
|
245
|
+
*/
|
|
246
246
|
export const getRetryDelayFromError = (error: any): number | undefined =>
|
|
247
247
|
error?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;
|
package/src/networkUtils.ts
CHANGED
package/src/packageVersion.ts
CHANGED
package/src/parallelRequests.ts
CHANGED
|
@@ -12,9 +12,10 @@ import { getRetryDelayFromError, canRetryOnError, createGenericNetworkError } fr
|
|
|
12
12
|
import { logNetworkFailure } from "./networkUtils";
|
|
13
13
|
// For now, this package is versioned and released in unison with the specific drivers
|
|
14
14
|
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
15
|
+
import { calculateMaxWaitTime } from "./runWithRetry";
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
const MissingFetchDelayInMs =
|
|
17
|
+
// We double this value in first try in when we calculate time to wait for in "calculateMaxWaitTime" function.
|
|
18
|
+
const MissingFetchDelayInMs = 50;
|
|
18
19
|
|
|
19
20
|
type WorkingState = "working" | "done" | "canceled";
|
|
20
21
|
|
|
@@ -29,7 +30,7 @@ type WorkingState = "working" | "done" | "canceled";
|
|
|
29
30
|
* @param logger - logger to use
|
|
30
31
|
* @param requestCallback - callback to request batches
|
|
31
32
|
* @returns Queue that can be used to retrieve data
|
|
32
|
-
* @
|
|
33
|
+
* @internal
|
|
33
34
|
*/
|
|
34
35
|
export class ParallelRequests<T> {
|
|
35
36
|
private latestRequested: number;
|
|
@@ -339,7 +340,7 @@ export class ParallelRequests<T> {
|
|
|
339
340
|
/**
|
|
340
341
|
* Helper queue class to allow async push / pull
|
|
341
342
|
* It's essentially a pipe allowing multiple writers, and single reader
|
|
342
|
-
* @
|
|
343
|
+
* @internal
|
|
343
344
|
*/
|
|
344
345
|
export class Queue<T> implements IStream<T> {
|
|
345
346
|
private readonly queue: Promise<IStreamResult<T>>[] = [];
|
|
@@ -423,10 +424,11 @@ async function getSingleOpBatch(
|
|
|
423
424
|
let retry: number = 0;
|
|
424
425
|
const nothing = { partial: false, cancel: true, payload: [] };
|
|
425
426
|
let waitStartTime: number = 0;
|
|
427
|
+
let waitTime = MissingFetchDelayInMs;
|
|
426
428
|
|
|
427
429
|
while (signal?.aborted !== true) {
|
|
428
430
|
retry++;
|
|
429
|
-
let
|
|
431
|
+
let lastError: unknown;
|
|
430
432
|
const startTime = performance.now();
|
|
431
433
|
|
|
432
434
|
try {
|
|
@@ -470,6 +472,7 @@ async function getSingleOpBatch(
|
|
|
470
472
|
);
|
|
471
473
|
}
|
|
472
474
|
} catch (error) {
|
|
475
|
+
lastError = error;
|
|
473
476
|
const canRetry = canRetryOnError(error);
|
|
474
477
|
|
|
475
478
|
const retryAfter = getRetryDelayFromError(error);
|
|
@@ -492,11 +495,6 @@ async function getSingleOpBatch(
|
|
|
492
495
|
// It's game over scenario.
|
|
493
496
|
throw error;
|
|
494
497
|
}
|
|
495
|
-
|
|
496
|
-
if (retryAfter !== undefined) {
|
|
497
|
-
// If the error told us to wait, then we will wait for that specific amount rather than the default.
|
|
498
|
-
delay = retryAfter;
|
|
499
|
-
}
|
|
500
498
|
}
|
|
501
499
|
|
|
502
500
|
if (telemetryEvent === undefined) {
|
|
@@ -506,10 +504,12 @@ async function getSingleOpBatch(
|
|
|
506
504
|
});
|
|
507
505
|
}
|
|
508
506
|
|
|
507
|
+
waitTime = calculateMaxWaitTime(waitTime, lastError);
|
|
508
|
+
|
|
509
509
|
// If we get here something has gone wrong - either got an unexpected empty set of messages back or a real error.
|
|
510
510
|
// Either way we will wait a little bit before retrying.
|
|
511
511
|
await new Promise<void>((resolve) => {
|
|
512
|
-
setTimeout(resolve,
|
|
512
|
+
setTimeout(resolve, waitTime);
|
|
513
513
|
});
|
|
514
514
|
|
|
515
515
|
// If we believe we're offline, we assume there's no point in trying until we at least think we're online.
|
|
@@ -533,7 +533,7 @@ async function getSingleOpBatch(
|
|
|
533
533
|
* @param signal - Cancelation signal
|
|
534
534
|
* @param scenarioName - Reason for fetching ops
|
|
535
535
|
* @returns Messages fetched
|
|
536
|
-
* @
|
|
536
|
+
* @internal
|
|
537
537
|
*/
|
|
538
538
|
export function requestOps(
|
|
539
539
|
get: (
|
|
@@ -655,7 +655,7 @@ export function requestOps(
|
|
|
655
655
|
}
|
|
656
656
|
|
|
657
657
|
/**
|
|
658
|
-
* @
|
|
658
|
+
* @internal
|
|
659
659
|
*/
|
|
660
660
|
export const emptyMessageStream: IStream<ISequencedDocumentMessage[]> = {
|
|
661
661
|
read: async () => {
|
|
@@ -664,7 +664,7 @@ export const emptyMessageStream: IStream<ISequencedDocumentMessage[]> = {
|
|
|
664
664
|
};
|
|
665
665
|
|
|
666
666
|
/**
|
|
667
|
-
* @
|
|
667
|
+
* @internal
|
|
668
668
|
*/
|
|
669
669
|
export function streamFromMessages(
|
|
670
670
|
messagesArg: Promise<ISequencedDocumentMessage[]>,
|
|
@@ -683,7 +683,7 @@ export function streamFromMessages(
|
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
/**
|
|
686
|
-
* @
|
|
686
|
+
* @internal
|
|
687
687
|
*/
|
|
688
688
|
export function streamObserver<T>(
|
|
689
689
|
stream: IStream<T>,
|
|
@@ -8,7 +8,7 @@ import { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
|
|
|
8
8
|
import { canRetryOnError } from "./network";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @
|
|
11
|
+
* @internal
|
|
12
12
|
*/
|
|
13
13
|
export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {
|
|
14
14
|
// BlobId -> blob prefetchCache cache
|
package/src/rateLimiter.ts
CHANGED
package/src/readAndParse.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
|
17
17
|
* @typeParam T - Output type matching JSON format of inpyt blob data.
|
|
18
18
|
*
|
|
19
19
|
* @returns The object that we decoded and parsed via `JSON.parse`.
|
|
20
|
-
* @
|
|
20
|
+
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export async function readAndParse<T>(
|
|
23
23
|
storage: Pick<IDocumentStorageService, "readBlob">,
|