@fluidframework/driver-utils 2.81.1 → 2.82.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 +4 -0
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts +2 -2
- 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 +4 -4
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/index.d.ts +1 -1
- package/dist/adapters/compression/index.d.ts.map +1 -1
- package/dist/adapters/compression/index.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +2 -2
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +15 -11
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +3 -3
- package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
- package/dist/adapters/predefinedAdapters.js +4 -1
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/blob.d.ts +2 -1
- package/dist/blob.d.ts.map +1 -1
- package/dist/blob.js +3 -1
- package/dist/blob.js.map +1 -1
- package/dist/buildSnapshotTree.d.ts +1 -1
- package/dist/buildSnapshotTree.d.ts.map +1 -1
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/cacheUtils.js +1 -1
- package/dist/cacheUtils.js.map +1 -1
- package/dist/documentServiceFactoryProxy.d.ts +3 -3
- package/dist/documentServiceFactoryProxy.d.ts.map +1 -1
- package/dist/documentServiceFactoryProxy.js.map +1 -1
- package/dist/documentServiceProxy.d.ts +3 -3
- package/dist/documentServiceProxy.d.ts.map +1 -1
- package/dist/documentServiceProxy.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +2 -2
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js +3 -1
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/error.d.ts +2 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts +2 -2
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/insecureUrlResolver.js +4 -4
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/messageRecognition.d.ts +3 -1
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +2 -0
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +10 -6
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +18 -3
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +4 -3
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +6 -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 +8 -4
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +24 -21
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/prefetchDocumentStorageService.js +8 -10
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/protocol/gitHelper.d.ts +1 -1
- package/dist/protocol/gitHelper.d.ts.map +1 -1
- package/dist/protocol/gitHelper.js +12 -6
- package/dist/protocol/gitHelper.js.map +1 -1
- package/dist/readAndParse.d.ts +1 -1
- package/dist/readAndParse.d.ts.map +1 -1
- package/dist/readAndParse.js.map +1 -1
- package/dist/runWithRetry.d.ts +4 -2
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/runWithRetry.js +14 -11
- package/dist/runWithRetry.js.map +1 -1
- package/dist/storageUtils.d.ts +1 -1
- package/dist/storageUtils.d.ts.map +1 -1
- package/dist/storageUtils.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +2 -2
- package/dist/summaryForCreateNew.d.ts.map +1 -1
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts +2 -2
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/treeConversions.js +3 -1
- package/dist/treeConversions.js.map +1 -1
- package/eslint.config.mts +2 -2
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts +2 -2
- 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 +4 -4
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/lib/adapters/compression/index.d.ts +1 -1
- package/lib/adapters/compression/index.d.ts.map +1 -1
- package/lib/adapters/compression/index.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +2 -2
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +15 -11
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/adapters/index.d.ts +1 -1
- package/lib/adapters/index.d.ts.map +1 -1
- package/lib/adapters/index.js.map +1 -1
- package/lib/adapters/predefinedAdapters.d.ts +3 -3
- package/lib/adapters/predefinedAdapters.d.ts.map +1 -1
- package/lib/adapters/predefinedAdapters.js +4 -1
- package/lib/adapters/predefinedAdapters.js.map +1 -1
- package/lib/blob.d.ts +2 -1
- package/lib/blob.d.ts.map +1 -1
- package/lib/blob.js +4 -2
- package/lib/blob.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts +1 -1
- package/lib/buildSnapshotTree.d.ts.map +1 -1
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/cacheUtils.js +1 -1
- package/lib/cacheUtils.js.map +1 -1
- package/lib/documentServiceFactoryProxy.d.ts +3 -3
- package/lib/documentServiceFactoryProxy.d.ts.map +1 -1
- package/lib/documentServiceFactoryProxy.js.map +1 -1
- package/lib/documentServiceProxy.d.ts +3 -3
- package/lib/documentServiceProxy.d.ts.map +1 -1
- package/lib/documentServiceProxy.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +2 -2
- package/lib/documentStorageServiceProxy.d.ts.map +1 -1
- package/lib/documentStorageServiceProxy.js +3 -1
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/error.d.ts +2 -2
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/insecureUrlResolver.d.ts +2 -2
- package/lib/insecureUrlResolver.d.ts.map +1 -1
- package/lib/insecureUrlResolver.js +4 -4
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/messageRecognition.d.ts +3 -1
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +2 -0
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +10 -6
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +18 -3
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +4 -3
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +6 -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 +8 -4
- package/lib/parallelRequests.d.ts.map +1 -1
- package/lib/parallelRequests.js +24 -21
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
- package/lib/prefetchDocumentStorageService.js +8 -10
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/protocol/gitHelper.d.ts +1 -1
- package/lib/protocol/gitHelper.d.ts.map +1 -1
- package/lib/protocol/gitHelper.js +12 -6
- package/lib/protocol/gitHelper.js.map +1 -1
- package/lib/readAndParse.d.ts +1 -1
- package/lib/readAndParse.d.ts.map +1 -1
- package/lib/readAndParse.js.map +1 -1
- package/lib/runWithRetry.d.ts +4 -2
- package/lib/runWithRetry.d.ts.map +1 -1
- package/lib/runWithRetry.js +15 -12
- package/lib/runWithRetry.js.map +1 -1
- package/lib/storageUtils.d.ts +1 -1
- package/lib/storageUtils.d.ts.map +1 -1
- package/lib/storageUtils.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +2 -2
- package/lib/summaryForCreateNew.d.ts.map +1 -1
- package/lib/summaryForCreateNew.js +1 -1
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts +2 -2
- package/lib/treeConversions.d.ts.map +1 -1
- package/lib/treeConversions.js +3 -1
- package/lib/treeConversions.js.map +1 -1
- package/package.json +10 -9
- package/src/adapters/compression/documentServiceCompressionAdapter.ts +2 -2
- package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +4 -4
- package/src/adapters/compression/index.ts +1 -1
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +25 -21
- package/src/adapters/index.ts +1 -1
- package/src/adapters/predefinedAdapters.ts +7 -4
- package/src/blob.ts +3 -7
- package/src/buildSnapshotTree.ts +6 -6
- package/src/cacheUtils.ts +1 -1
- package/src/documentServiceFactoryProxy.ts +3 -3
- package/src/documentServiceProxy.ts +3 -3
- package/src/documentStorageServiceProxy.ts +4 -2
- package/src/error.ts +2 -2
- package/src/index.ts +4 -4
- package/src/insecureUrlResolver.ts +7 -7
- package/src/messageRecognition.ts +4 -2
- package/src/network.ts +26 -12
- package/src/networkUtils.ts +12 -4
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +33 -30
- package/src/prefetchDocumentStorageService.ts +10 -10
- package/src/protocol/gitHelper.ts +15 -9
- package/src/readAndParse.ts +1 -1
- package/src/runWithRetry.ts +20 -14
- package/src/storageUtils.ts +1 -1
- package/src/summaryForCreateNew.ts +5 -1
- package/src/treeConversions.ts +5 -3
- package/biome.jsonc +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetchDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,+BAA+B,EAC/B,aAAa,EACb,QAAQ,EACR,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAG/E;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,2BAA2B;IAE9E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+C;IAC7E,OAAO,CAAC,eAAe,CAAQ;IAE/B,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAKjE;
|
|
1
|
+
{"version":3,"file":"prefetchDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,+BAA+B,EAC/B,aAAa,EACb,QAAQ,EACR,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAG/E;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,2BAA2B;IAE9E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+C;IAC7E,OAAO,CAAC,eAAe,CAAQ;IAE/B,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAKjE;IAGY,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAmBlE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAGxD,YAAY,IAAI,IAAI;YAKb,UAAU;IA2BxB,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,gBAAgB;CAkBxB"}
|
|
@@ -21,6 +21,7 @@ export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy
|
|
|
21
21
|
return { ...policies, caching: LoaderCachingPolicy.NoCaching };
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
// eslint-disable-next-line @rushstack/no-new-null -- TODO: use `undefined` instead
|
|
24
25
|
async getSnapshotTree(version) {
|
|
25
26
|
const p = this.internalStorageService.getSnapshotTree(version);
|
|
26
27
|
if (this.prefetchEnabled) {
|
|
@@ -58,12 +59,11 @@ export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy
|
|
|
58
59
|
// 2. Prevent unhandled rejection warning for fire-and-forget prefetch
|
|
59
60
|
// Note: Callers who await the cached promise will still see the rejection
|
|
60
61
|
prefetchedBlobPFromStorage.catch((error) => {
|
|
61
|
-
if
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
62
|
+
// Only clear cache if our promise is still the cached one
|
|
63
|
+
// (avoids race condition with concurrent requests)
|
|
64
|
+
if (canRetryOnError(error) &&
|
|
65
|
+
this.prefetchCache.get(blobId) === prefetchedBlobPFromStorage) {
|
|
66
|
+
this.prefetchCache.delete(blobId);
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
this.prefetchCache.set(blobId, prefetchedBlobPFromStorage);
|
|
@@ -94,10 +94,8 @@ export class PrefetchDocumentStorageService extends DocumentStorageServiceProxy
|
|
|
94
94
|
this.cachedRead(blob).catch(() => { });
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
else if (!blobKey.startsWith("deltas")) {
|
|
98
|
-
|
|
99
|
-
secondary.push(blob);
|
|
100
|
-
}
|
|
97
|
+
else if (!blobKey.startsWith("deltas") && blob !== null) {
|
|
98
|
+
secondary.push(blob);
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
for (const subTree of Object.values(tree.trees)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetchDocumentStorageService.js","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,8BAA+B,SAAQ,2BAA2B;IAA/E;;QACC,qCAAqC;QACpB,kBAAa,GAAG,IAAI,GAAG,EAAoC,CAAC;QACrE,oBAAe,GAAG,IAAI,CAAC;IAiGhC,CAAC;IA/FA,IAAW,QAAQ;QAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;QACtD,IAAI,QAAQ,EAAE,CAAC;YACd,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE,mBAAmB,CAAC,SAAS,EAAE,CAAC;QAChE,CAAC;IACF,CAAC;
|
|
1
|
+
{"version":3,"file":"prefetchDocumentStorageService.js","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,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EAAE,GAAE,CAAC,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAEO,gBAAgB,CAAC,IAAmB,EAAE,SAAmB;QAChE,KAAK,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1D,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACrF,6DAA6D;gBAC7D,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBACpD,sEAAsE;oBACtE,kEAAkE;oBAClE,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;gBACvC,CAAC;YACF,CAAC;iBAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBAC3D,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;QACF,CAAC;QAED,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC3C,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIDocumentStorageServicePolicies,\n\tISnapshotTree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { LoaderCachingPolicy } from \"@fluidframework/driver-definitions/internal\";\n\nimport { DocumentStorageServiceProxy } from \"./documentStorageServiceProxy.js\";\nimport { canRetryOnError } from \"./network.js\";\n\n/**\n * @internal\n */\nexport class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {\n\t// BlobId -> blob prefetchCache cache\n\tprivate readonly prefetchCache = new Map<string, Promise<ArrayBufferLike>>();\n\tprivate prefetchEnabled = true;\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\tconst policies = this.internalStorageService.policies;\n\t\tif (policies) {\n\t\t\treturn { ...policies, caching: LoaderCachingPolicy.NoCaching };\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null -- TODO: use `undefined` instead\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tconst p = this.internalStorageService.getSnapshotTree(version);\n\t\tif (this.prefetchEnabled) {\n\t\t\t// Fire-and-forget prefetch - we don't care if it succeeds.\n\t\t\t// The .catch() prevents unhandled rejection when p rejects, since\n\t\t\t// p.then() creates a derived promise that also rejects if p rejects.\n\t\t\t// Callers awaiting the returned p will still receive the error.\n\t\t\tp.then((tree: ISnapshotTree | null | undefined) => {\n\t\t\t\tif (tree === null || tree === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.prefetchTree(tree);\n\t\t\t}).catch(() => {\n\t\t\t\t// Intentionally empty - error will be handled by caller awaiting p\n\t\t\t});\n\t\t}\n\t\treturn p;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.cachedRead(blobId);\n\t}\n\tpublic stopPrefetch(): void {\n\t\tthis.prefetchEnabled = false;\n\t\tthis.prefetchCache.clear();\n\t}\n\n\tprivate async cachedRead(blobId: string): Promise<ArrayBufferLike> {\n\t\tif (this.prefetchEnabled) {\n\t\t\tconst prefetchedBlobP = this.prefetchCache.get(blobId);\n\t\t\tif (prefetchedBlobP !== undefined) {\n\t\t\t\treturn prefetchedBlobP;\n\t\t\t}\n\t\t\tconst prefetchedBlobPFromStorage = this.internalStorageService.readBlob(blobId);\n\t\t\t// Attach error handler for side effects only:\n\t\t\t// 1. Clear cache on retryable errors so next read retries\n\t\t\t// 2. Prevent unhandled rejection warning for fire-and-forget prefetch\n\t\t\t// Note: Callers who await the cached promise will still see the rejection\n\t\t\tprefetchedBlobPFromStorage.catch((error) => {\n\t\t\t\t// Only clear cache if our promise is still the cached one\n\t\t\t\t// (avoids race condition with concurrent requests)\n\t\t\t\tif (\n\t\t\t\t\tcanRetryOnError(error) &&\n\t\t\t\t\tthis.prefetchCache.get(blobId) === prefetchedBlobPFromStorage\n\t\t\t\t) {\n\t\t\t\t\tthis.prefetchCache.delete(blobId);\n\t\t\t\t}\n\t\t\t});\n\t\t\tthis.prefetchCache.set(blobId, prefetchedBlobPFromStorage);\n\t\t\treturn prefetchedBlobPFromStorage;\n\t\t}\n\t\treturn this.internalStorageService.readBlob(blobId);\n\t}\n\n\tprivate prefetchTree(tree: ISnapshotTree): void {\n\t\tconst secondary: string[] = [];\n\t\tthis.prefetchTreeCore(tree, secondary);\n\n\t\tfor (const blob of secondary) {\n\t\t\t// Skip if already cached (avoids unnecessary async overhead)\n\t\t\tif (this.prefetchCache.has(blob)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// Fire-and-forget prefetch. The .catch() prevents unhandled rejection\n\t\t\t// since cachedRead is async and returns a separate promise chain.\n\t\t\tthis.cachedRead(blob).catch(() => {});\n\t\t}\n\t}\n\n\tprivate prefetchTreeCore(tree: ISnapshotTree, secondary: string[]): void {\n\t\tfor (const [blobKey, blob] of Object.entries(tree.blobs)) {\n\t\t\tif (blobKey.startsWith(\".\") || blobKey === \"header\" || blobKey.startsWith(\"quorum\")) {\n\t\t\t\t// Skip if already cached (avoids unnecessary async overhead)\n\t\t\t\tif (blob !== null && !this.prefetchCache.has(blob)) {\n\t\t\t\t\t// Fire-and-forget prefetch. The .catch() prevents unhandled rejection\n\t\t\t\t\t// since cachedRead is async and returns a separate promise chain.\n\t\t\t\t\tthis.cachedRead(blob).catch(() => {});\n\t\t\t\t}\n\t\t\t} else if (!blobKey.startsWith(\"deltas\") && blob !== null) {\n\t\t\t\tsecondary.push(blob);\n\t\t\t}\n\t\t}\n\n\t\tfor (const subTree of Object.values(tree.trees)) {\n\t\t\tthis.prefetchTreeCore(subTree, secondary);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IGitTree, ISnapshotTreeEx, SummaryObject } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import { type IGitTree, type ISnapshotTreeEx, type SummaryObject } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Take a summary object and returns its git mode.
|
|
8
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitHelper.d.ts","sourceRoot":"","sources":["../../src/protocol/gitHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEN,QAAQ,
|
|
1
|
+
{"version":3,"file":"gitHelper.d.ts","sourceRoot":"","sources":["../../src/protocol/gitHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEN,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,MAAM,6CAA6C,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAcvD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,MAAM,CAehE;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACpC,QAAQ,EAAE,QAAQ,EAClB,mBAAmB,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAA6B,EACpE,mBAAmB,UAAQ,GACzB,eAAe,CA4BjB"}
|
|
@@ -15,12 +15,15 @@ export function getGitMode(value) {
|
|
|
15
15
|
const type = value.type === SummaryType.Handle ? value.handleType : value.type;
|
|
16
16
|
switch (type) {
|
|
17
17
|
case SummaryType.Blob:
|
|
18
|
-
case SummaryType.Attachment:
|
|
18
|
+
case SummaryType.Attachment: {
|
|
19
19
|
return FileMode.File;
|
|
20
|
-
|
|
20
|
+
}
|
|
21
|
+
case SummaryType.Tree: {
|
|
21
22
|
return FileMode.Directory;
|
|
22
|
-
|
|
23
|
+
}
|
|
24
|
+
default: {
|
|
23
25
|
unreachableCase(type, `Unknown type: ${type}`);
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
@@ -34,12 +37,15 @@ export function getGitType(value) {
|
|
|
34
37
|
const type = value.type === SummaryType.Handle ? value.handleType : value.type;
|
|
35
38
|
switch (type) {
|
|
36
39
|
case SummaryType.Blob:
|
|
37
|
-
case SummaryType.Attachment:
|
|
40
|
+
case SummaryType.Attachment: {
|
|
38
41
|
return "blob";
|
|
39
|
-
|
|
42
|
+
}
|
|
43
|
+
case SummaryType.Tree: {
|
|
40
44
|
return "tree";
|
|
41
|
-
|
|
45
|
+
}
|
|
46
|
+
default: {
|
|
42
47
|
unreachableCase(type, `Unknown type: ${type}`);
|
|
48
|
+
}
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitHelper.js","sourceRoot":"","sources":["../../src/protocol/gitHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EACN,QAAQ,
|
|
1
|
+
{"version":3,"file":"gitHelper.js","sourceRoot":"","sources":["../../src/protocol/gitHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EACN,QAAQ,EAIR,WAAW,GACX,MAAM,6CAA6C,CAAC;AAErD;;;;;;GAMG;AACH,M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AAC,GAAG,KAAK,CAAC,GAAG,CAAC;YAC1D,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,SAAS,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACzC,CAAC;IACF,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tFileMode,\n\ttype IGitTree,\n\ttype ISnapshotTreeEx,\n\ttype SummaryObject,\n\tSummaryType,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Take a summary object and returns its git mode.\n *\n * @param value - summary object\n * @returns the git mode of summary object\n * @internal\n */\nexport function getGitMode(value: SummaryObject): string {\n\tconst type = value.type === SummaryType.Handle ? value.handleType : value.type;\n\tswitch (type) {\n\t\tcase SummaryType.Blob:\n\t\tcase SummaryType.Attachment: {\n\t\t\treturn FileMode.File;\n\t\t}\n\t\tcase SummaryType.Tree: {\n\t\t\treturn FileMode.Directory;\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(type, `Unknown type: ${type}`);\n\t\t}\n\t}\n}\n\n/**\n * Take a summary object and returns its type.\n *\n * @param value - summary object\n * @returns the type of summary object\n * @internal\n */\nexport function getGitType(value: SummaryObject): \"blob\" | \"tree\" {\n\tconst type = value.type === SummaryType.Handle ? value.handleType : value.type;\n\n\tswitch (type) {\n\t\tcase SummaryType.Blob:\n\t\tcase SummaryType.Attachment: {\n\t\t\treturn \"blob\";\n\t\t}\n\t\tcase SummaryType.Tree: {\n\t\t\treturn \"tree\";\n\t\t}\n\t\tdefault: {\n\t\t\tunreachableCase(type, `Unknown type: ${type}`);\n\t\t}\n\t}\n}\n\n/**\n * NOTE: Renamed from `buildHierarchy` to `buildGitTreeHierarchy`. There is usage of this function in loader and driver layer.\n * Build a tree hierarchy base on a flat tree\n *\n * @param flatTree - a flat tree\n * @param blobsShaToPathCache - Map with blobs sha as keys and values as path of the blob.\n * @param removeAppTreePrefix - Remove `.app/` from beginning of paths when present\n * @returns the hierarchical tree\n * @internal\n */\nexport function buildGitTreeHierarchy(\n\tflatTree: IGitTree,\n\tblobsShaToPathCache: Map<string, string> = new Map<string, string>(),\n\tremoveAppTreePrefix = false,\n): ISnapshotTreeEx {\n\tconst lookup: { [path: string]: ISnapshotTreeEx } = {};\n\tconst root: ISnapshotTreeEx = { id: flatTree.sha, blobs: {}, trees: {} };\n\tlookup[\"\"] = root;\n\n\tfor (const entry of flatTree.tree) {\n\t\tconst entryPath = removeAppTreePrefix ? entry.path.replace(/^\\.app\\//, \"\") : entry.path;\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 = { id: entry.sha, blobs: {}, commits: {}, trees: {} };\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.sha;\n\t\t\tblobsShaToPathCache.set(entry.sha, `/${entryPath}`);\n\t\t} else {\n\t\t\tthrow new Error(\"Unknown entry type!!\");\n\t\t}\n\t}\n\n\treturn root;\n}\n"]}
|
package/lib/readAndParse.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IDocumentStorageService } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import type { IDocumentStorageService } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and
|
|
8
8
|
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readAndParse.d.ts","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"readAndParse.d.ts","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAE3F;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,CAAC,EACnC,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,EAClD,EAAE,EAAE,MAAM,GACR,OAAO,CAAC,CAAC,CAAC,CAIZ"}
|
package/lib/readAndParse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readAndParse.js","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,OAAkD,EAClD,EAAU;IAEV,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;AACjC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}\n * it into object of type `T`.\n *\n * @param storage - The `DocumentStorageService` to read from.\n * @param id - The ID of the blob to read and parse.\n *\n * @typeParam T - Output type matching JSON format of inpyt blob data.\n *\n * @returns The object that we decoded and parsed via `JSON.parse`.\n * @internal\n */\nexport async function readAndParse<T>(\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n\tid: string,\n): Promise<T> {\n\tconst blob = await storage.readBlob(id);\n\tconst decoded = bufferToString(blob, \"utf8\");\n\treturn JSON.parse(decoded) as T;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"readAndParse.js","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,OAAkD,EAClD,EAAU;IAEV,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;AACjC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport type { IDocumentStorageService } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}\n * it into object of type `T`.\n *\n * @param storage - The `DocumentStorageService` to read from.\n * @param id - The ID of the blob to read and parse.\n *\n * @typeParam T - Output type matching JSON format of inpyt blob data.\n *\n * @returns The object that we decoded and parsed via `JSON.parse`.\n * @internal\n */\nexport async function readAndParse<T>(\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n\tid: string,\n): Promise<T> {\n\tconst blob = await storage.readBlob(id);\n\tconst decoded = bufferToString(blob, \"utf8\");\n\treturn JSON.parse(decoded) as T;\n}\n"]}
|
package/lib/runWithRetry.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
5
|
+
import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Interface describing an object passed to various network APIs.
|
|
8
8
|
* It allows caller to control cancellation, as well as learn about any delays.
|
|
@@ -32,9 +32,11 @@ export interface IProgress {
|
|
|
32
32
|
* as well as information provided by service (like 429 error asking to wait for some time before retry)
|
|
33
33
|
* @param error - error object returned from the call.
|
|
34
34
|
*/
|
|
35
|
-
onRetry?(delayInMs: number, error:
|
|
35
|
+
onRetry?(delayInMs: number, error: unknown): void;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
+
* Runs the provided API call with automatic retry logic.
|
|
39
|
+
*
|
|
38
40
|
* @internal
|
|
39
41
|
*/
|
|
40
42
|
export declare function runWithRetry<T>(api: (cancel?: AbortSignal) => Promise<T>, fetchCallName: string, logger: ITelemetryLoggerExt, progress: IProgress): Promise<T>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,
|
|
1
|
+
{"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,0CAA0C,CAAC;AAKlD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;;OAOG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAClD;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,CAAC,EACnC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,SAAS,GACjB,OAAO,CAAC,CAAC,CAAC,CAuFZ;AAKD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAU5E"}
|
package/lib/runWithRetry.js
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
import { performanceNow } from "@fluid-internal/client-utils";
|
|
6
6
|
import { delay } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { DriverErrorTypes } from "@fluidframework/driver-definitions/internal";
|
|
8
|
-
import { isFluidError } from "@fluidframework/telemetry-utils/internal";
|
|
8
|
+
import { isFluidError, } from "@fluidframework/telemetry-utils/internal";
|
|
9
9
|
import { NonRetryableError, canRetryOnError, getRetryDelayFromError } from "./network.js";
|
|
10
10
|
import { pkgVersion } from "./packageVersion.js";
|
|
11
11
|
/**
|
|
12
|
+
* Runs the provided API call with automatic retry logic.
|
|
13
|
+
*
|
|
12
14
|
* @internal
|
|
13
15
|
*/
|
|
14
16
|
export async function runWithRetry(api, fetchCallName, logger, progress) {
|
|
@@ -24,29 +26,30 @@ export async function runWithRetry(api, fetchCallName, logger, progress) {
|
|
|
24
26
|
result = await api(progress.cancel);
|
|
25
27
|
success = true;
|
|
26
28
|
}
|
|
27
|
-
catch (
|
|
29
|
+
catch (error) {
|
|
28
30
|
// If it is not retriable, then just throw the error.
|
|
29
|
-
if (!canRetryOnError(
|
|
31
|
+
if (!canRetryOnError(error)) {
|
|
30
32
|
logger.sendTelemetryEvent({
|
|
31
33
|
eventName: `${fetchCallName}_cancel`,
|
|
32
34
|
retry: numRetries,
|
|
33
35
|
duration: performanceNow() - startTime,
|
|
34
36
|
fetchCallName,
|
|
35
|
-
},
|
|
36
|
-
throw
|
|
37
|
+
}, error);
|
|
38
|
+
throw error;
|
|
37
39
|
}
|
|
38
40
|
if (progress.cancel?.aborted === true) {
|
|
41
|
+
const abortReason = progress.cancel.reason;
|
|
39
42
|
logger.sendTelemetryEvent({
|
|
40
43
|
eventName: `${fetchCallName}_runWithRetryAborted`,
|
|
41
44
|
retry: numRetries,
|
|
42
45
|
duration: performanceNow() - startTime,
|
|
43
46
|
fetchCallName,
|
|
44
|
-
reason:
|
|
45
|
-
},
|
|
47
|
+
reason: abortReason,
|
|
48
|
+
}, error);
|
|
46
49
|
throw new NonRetryableError("runWithRetry was Aborted", DriverErrorTypes.genericError, {
|
|
47
50
|
driverVersion: pkgVersion,
|
|
48
51
|
fetchCallName,
|
|
49
|
-
reason:
|
|
52
|
+
reason: abortReason,
|
|
50
53
|
});
|
|
51
54
|
}
|
|
52
55
|
// logging the first failed retry instead of every attempt. We want to avoid filling telemetry
|
|
@@ -57,14 +60,14 @@ export async function runWithRetry(api, fetchCallName, logger, progress) {
|
|
|
57
60
|
eventName: `${fetchCallName}_firstFailed`,
|
|
58
61
|
duration: performanceNow() - startTime,
|
|
59
62
|
fetchCallName,
|
|
60
|
-
},
|
|
63
|
+
}, error);
|
|
61
64
|
}
|
|
62
65
|
numRetries++;
|
|
63
|
-
lastError =
|
|
66
|
+
lastError = error;
|
|
64
67
|
// Wait for the calculated time before retrying.
|
|
65
|
-
retryAfterMs = calculateMaxWaitTime(retryAfterMs,
|
|
68
|
+
retryAfterMs = calculateMaxWaitTime(retryAfterMs, error);
|
|
66
69
|
if (progress.onRetry) {
|
|
67
|
-
progress.onRetry(retryAfterMs,
|
|
70
|
+
progress.onRetry(retryAfterMs, error);
|
|
68
71
|
}
|
|
69
72
|
await delay(retryAfterMs);
|
|
70
73
|
}
|
package/lib/runWithRetry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWithRetry.js","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"runWithRetry.js","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EACN,YAAY,GAEZ,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAmCjD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,GAAyC,EACzC,aAAqB,EACrB,MAA2B,EAC3B,QAAmB;IAEnB,IAAI,MAAqB,CAAC;IAC1B,IAAI,OAAO,GAAG,KAAK,CAAC;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C,4CAA4C;QAC9C,CAAC,CAAC,+CAA+C,CAClD,CAAC;IACF,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport { delay } from \"@fluidframework/core-utils/internal\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tisFluidError,\n\ttype ITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { NonRetryableError, canRetryOnError, getRetryDelayFromError } from \"./network.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * Interface describing an object passed to various network APIs.\n * It allows caller to control cancellation, as well as learn about any delays.\n * @internal\n */\nexport interface IProgress {\n\t/**\n\t * Abort signal used to cancel operation.\n\t *\n\t * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.\n\t * Please consult with API documentation / implementation.\n\t * Note that number of layers may not check this signal while holding this request in a queue,\n\t * so it may take a while it takes effect. This can be improved in the future.\n\t *\n\t * The layers in question are:\n\t *\n\t * - driver (RateLimiter)\n\t *\n\t * - runWithRetry\n\t */\n\tcancel?: AbortSignal;\n\n\t/**\n\t * Called whenever api returns cancellable error and the call is going to be retried.\n\t * Any exception thrown from this call back result in cancellation of operation\n\t * and propagation of thrown exception.\n\t * @param delayInMs - delay before next retry. This value will depend on internal back-off logic,\n\t * as well as information provided by service (like 429 error asking to wait for some time before retry)\n\t * @param error - error object returned from the call.\n\t */\n\tonRetry?(delayInMs: number, error: unknown): void;\n}\n\n/**\n * Runs the provided API call with automatic retry logic.\n *\n * @internal\n */\nexport async function runWithRetry<T>(\n\tapi: (cancel?: AbortSignal) => Promise<T>,\n\tfetchCallName: string,\n\tlogger: ITelemetryLoggerExt,\n\tprogress: IProgress,\n): Promise<T> {\n\tlet result: T | undefined;\n\tlet success = false;\n\t// We double this value in first try in when we calculate time to wait for in \"calculateMaxWaitTime\" function.\n\tlet retryAfterMs = 500; // has to be positive!\n\tlet numRetries = 0;\n\tconst startTime = performanceNow();\n\tlet lastError: unknown;\n\tdo {\n\t\ttry {\n\t\t\tresult = await api(progress.cancel);\n\t\t\tsuccess = true;\n\t\t} catch (error) {\n\t\t\t// If it is not retriable, then just throw the error.\n\t\t\tif (!canRetryOnError(error)) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${fetchCallName}_cancel`,\n\t\t\t\t\t\tretry: numRetries,\n\t\t\t\t\t\tduration: performanceNow() - startTime,\n\t\t\t\t\t\tfetchCallName,\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (progress.cancel?.aborted === true) {\n\t\t\t\tconst abortReason = progress.cancel.reason as string;\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${fetchCallName}_runWithRetryAborted`,\n\t\t\t\t\t\tretry: numRetries,\n\t\t\t\t\t\tduration: performanceNow() - startTime,\n\t\t\t\t\t\tfetchCallName,\n\t\t\t\t\t\treason: abortReason,\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"runWithRetry was Aborted\",\n\t\t\t\t\tDriverErrorTypes.genericError,\n\t\t\t\t\t{\n\t\t\t\t\t\tdriverVersion: pkgVersion,\n\t\t\t\t\t\tfetchCallName,\n\t\t\t\t\t\treason: abortReason,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// logging the first failed retry instead of every attempt. We want to avoid filling telemetry\n\t\t\t// when we have tight loop of retrying in offline mode, but we also want to know what caused\n\t\t\t// the failure in the first place\n\t\t\tif (numRetries === 0) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${fetchCallName}_firstFailed`,\n\t\t\t\t\t\tduration: performanceNow() - startTime,\n\t\t\t\t\t\tfetchCallName,\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tnumRetries++;\n\t\t\tlastError = error;\n\t\t\t// Wait for the calculated time before retrying.\n\t\t\tretryAfterMs = calculateMaxWaitTime(retryAfterMs, error);\n\t\t\tif (progress.onRetry) {\n\t\t\t\tprogress.onRetry(retryAfterMs, error);\n\t\t\t}\n\t\t\tawait delay(retryAfterMs);\n\t\t}\n\t} while (!success);\n\tif (numRetries > 0) {\n\t\tlogger.sendTelemetryEvent(\n\t\t\t{\n\t\t\t\teventName: `${fetchCallName}_lastError`,\n\t\t\t\tretry: numRetries,\n\t\t\t\tduration: performanceNow() - startTime,\n\t\t\t\tfetchCallName,\n\t\t\t},\n\t\t\tlastError,\n\t\t);\n\t}\n\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\treturn result!;\n}\n\nconst MaxReconnectDelayInMsWhenEndpointIsReachable = 60000;\nconst MaxReconnectDelayInMsWhenEndpointIsNotReachable = 8000;\n\n/**\n * Calculates time to wait for after an error based on the error and wait time for previous iteration.\n * In case endpoint(service or socket) is not reachable, then we maybe offline or may have got some\n * transient error not related to endpoint, in that case we want to try at faster pace and hence the\n * max wait is lesser 8s as compared to when endpoint is reachable in which case it is 60s.\n * @param delayMs - wait time for previous iteration\n * @param error - error based on which we decide wait time.\n * @returns Wait time to wait for.\n * @internal\n */\nexport function calculateMaxWaitTime(delayMs: number, error: unknown): number {\n\tconst retryDelayFromError = getRetryDelayFromError(error);\n\tlet newDelayMs = Math.max(retryDelayFromError ?? 0, delayMs * 2);\n\tnewDelayMs = Math.min(\n\t\tnewDelayMs,\n\t\tisFluidError(error) && error.getTelemetryProperties().endpointReached === true\n\t\t\t? MaxReconnectDelayInMsWhenEndpointIsReachable\n\t\t\t: MaxReconnectDelayInMsWhenEndpointIsNotReachable,\n\t);\n\treturn newDelayMs;\n}\n"]}
|
package/lib/storageUtils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISnapshot, ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import type { ISnapshot, ISnapshotTree } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Utility API to check if the type of snapshot contents is `ISnapshot`.
|
|
8
8
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageUtils.d.ts","sourceRoot":"","sources":["../src/storageUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"storageUtils.d.ts","sourceRoot":"","sources":["../src/storageUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAE5F;;;;GAIG;AACH,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,aAAa,GAAG,SAAS,GAAG,SAAS,GACxC,GAAG,IAAI,SAAS,CAElB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,aAAa,CAE9E"}
|
package/lib/storageUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storageUtils.js","sourceRoot":"","sources":["../src/storageUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACpC,GAA0C;IAE1C,OAAO,GAAG,KAAK,SAAS,IAAI,iBAAiB,IAAI,GAAG,IAAI,GAAG,CAAC,eAAe,KAAK,CAAC,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAA+B;IAC9D,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshot, ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Utility API to check if the type of snapshot contents is `ISnapshot`.\n * @internal\n * @param obj - obj whose type needs to be identified.\n */\nexport function isInstanceOfISnapshot(\n\tobj: ISnapshotTree | ISnapshot | undefined,\n): obj is ISnapshot {\n\treturn obj !== undefined && \"snapshotFormatV\" in obj && obj.snapshotFormatV === 1;\n}\n\n/**\n * Utility API to return ISnapshotTree either from ISnapshot or ISnapshotTree itself.\n * @internal\n */\nexport function getSnapshotTree(tree: ISnapshotTree | ISnapshot): ISnapshotTree {\n\treturn isInstanceOfISnapshot(tree) ? tree.snapshotTree : tree;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"storageUtils.js","sourceRoot":"","sources":["../src/storageUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACpC,GAA0C;IAE1C,OAAO,GAAG,KAAK,SAAS,IAAI,iBAAiB,IAAI,GAAG,IAAI,GAAG,CAAC,eAAe,KAAK,CAAC,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAA+B;IAC9D,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ISnapshot, ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Utility API to check if the type of snapshot contents is `ISnapshot`.\n * @internal\n * @param obj - obj whose type needs to be identified.\n */\nexport function isInstanceOfISnapshot(\n\tobj: ISnapshotTree | ISnapshot | undefined,\n): obj is ISnapshot {\n\treturn obj !== undefined && \"snapshotFormatV\" in obj && obj.snapshotFormatV === 1;\n}\n\n/**\n * Utility API to return ISnapshotTree either from ISnapshot or ISnapshotTree itself.\n * @internal\n */\nexport function getSnapshotTree(tree: ISnapshotTree | ISnapshot): ISnapshotTree {\n\treturn isInstanceOfISnapshot(tree) ? tree.snapshotTree : tree;\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ICommittedProposal, IDocumentAttributes } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import { type ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
+
import type { ICommittedProposal, IDocumentAttributes } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
/**
|
|
8
8
|
* Defines the current layout of an .app + .protocol summary tree
|
|
9
9
|
* this is used internally for create new, and single commit summary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryForCreateNew.d.ts","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"summaryForCreateNew.d.ts","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,KAAK,YAAY,EAEjB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EACX,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,6CAA6C,CAAC;AAErD;;;;GAIG;AACH,MAAM,WAAW,6BAA8B,SAAQ,YAAY;IAClE,IAAI,EAAE;QACL,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;QACvB,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC;KAC5B,CAAC;CACF;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC9C,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,GAAG,iBAAiB,EAAE,MAAM,EAAE,GAC5B,OAAO,IAAI,6BAA6B,CAa1C;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CAClD,eAAe,EAAE,YAAY,GAC3B,mBAAmB,CAGrB;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CACjD,eAAe,EAAE,YAAY,GAC3B,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAOhC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { SummaryType } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { SummaryType, } from "@fluidframework/driver-definitions";
|
|
6
6
|
/**
|
|
7
7
|
* Validates the current layout of an .app + .protocol summary tree
|
|
8
8
|
* this is used internally for create new, and single commit summary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryForCreateNew.js","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"summaryForCreateNew.js","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,WAAW,GACX,MAAM,oCAAoC,CAAC;AAkB5C;;;;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,CAAC;QACF,OAAO,KAAK,CAAC;IACd,CAAC;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,CAAC;QAC3B,OAAO,KAAK,CAAC;IACd,CAAC;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\ttype ISummaryBlob,\n\ttype ISummaryTree,\n\tSummaryType,\n} from \"@fluidframework/driver-definitions\";\nimport type {\n\tICommittedProposal,\n\tIDocumentAttributes,\n} from \"@fluidframework/driver-definitions/internal\";\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
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ITree } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import { type ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
+
import type { ITree } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
/**
|
|
8
8
|
* Converts ISummaryTree to ITree format.
|
|
9
9
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeConversions.d.ts","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAe,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"treeConversions.d.ts","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,oCAAoC,CAAC;AACpF,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,6CAA6C,CAAC;AAKrF;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAmDlF"}
|
package/lib/treeConversions.js
CHANGED
|
@@ -26,6 +26,7 @@ export function convertSummaryTreeToSnapshotITree(summaryTree) {
|
|
|
26
26
|
switch (value.type) {
|
|
27
27
|
case SummaryType.Blob: {
|
|
28
28
|
let parsedContent;
|
|
29
|
+
// eslint-disable-next-line unicorn/text-encoding-identifier-case
|
|
29
30
|
let encoding = "utf-8";
|
|
30
31
|
if (typeof value.content === "string") {
|
|
31
32
|
parsedContent = value.content;
|
|
@@ -48,8 +49,9 @@ export function convertSummaryTreeToSnapshotITree(summaryTree) {
|
|
|
48
49
|
case SummaryType.Handle: {
|
|
49
50
|
throw new Error("Should not have Handle type in summary tree");
|
|
50
51
|
}
|
|
51
|
-
default:
|
|
52
|
+
default: {
|
|
52
53
|
unreachableCase(value, "Unexpected summary tree type");
|
|
54
|
+
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeConversions.js","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"A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the MIT License.\n */\n\nimport { Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { type ISummaryTree, SummaryType } from \"@fluidframework/driver-definitions\";\nimport type { ITree, ITreeEntry } from \"@fluidframework/driver-definitions/internal\";\n\nimport { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from \"./blob.js\";\nimport { isCombinedAppAndProtocolSummary } from \"./summaryForCreateNew.js\";\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\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\t// eslint-disable-next-line unicorn/text-encoding-identifier-case\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\t}\n\t\t}\n\t}\n\treturn {\n\t\tentries,\n\t\tunreferenced: summaryTree.unreferenced,\n\t\tgroupId: summaryTree.groupId,\n\t};\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.82.0",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,26 +69,27 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "~2.
|
|
73
|
-
"@fluidframework/core-interfaces": "~2.
|
|
74
|
-
"@fluidframework/core-utils": "~2.
|
|
75
|
-
"@fluidframework/driver-definitions": "~2.
|
|
76
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
72
|
+
"@fluid-internal/client-utils": "~2.82.0",
|
|
73
|
+
"@fluidframework/core-interfaces": "~2.82.0",
|
|
74
|
+
"@fluidframework/core-utils": "~2.82.0",
|
|
75
|
+
"@fluidframework/driver-definitions": "~2.82.0",
|
|
76
|
+
"@fluidframework/telemetry-utils": "~2.82.0",
|
|
77
77
|
"lz4js": "^0.2.0",
|
|
78
78
|
"uuid": "^11.1.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
82
82
|
"@biomejs/biome": "~1.9.3",
|
|
83
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
83
|
+
"@fluid-internal/mocha-test-setup": "~2.82.0",
|
|
84
84
|
"@fluid-tools/build-cli": "^0.63.0",
|
|
85
85
|
"@fluidframework/build-common": "^2.0.3",
|
|
86
86
|
"@fluidframework/build-tools": "^0.63.0",
|
|
87
87
|
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.81.0",
|
|
88
|
-
"@fluidframework/eslint-config-fluid": "~2.
|
|
88
|
+
"@fluidframework/eslint-config-fluid": "~2.82.0",
|
|
89
89
|
"@microsoft/api-extractor": "7.52.11",
|
|
90
|
+
"@types/lz4js": "^0.2.0",
|
|
90
91
|
"@types/mocha": "^10.0.10",
|
|
91
|
-
"@types/node": "
|
|
92
|
+
"@types/node": "~20.19.30",
|
|
92
93
|
"@types/sinon": "^17.0.3",
|
|
93
94
|
"c8": "^10.1.3",
|
|
94
95
|
"concurrently": "^9.2.1",
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import type {
|
|
7
7
|
IDocumentService,
|
|
8
8
|
IDocumentStorageService,
|
|
9
9
|
} from "@fluidframework/driver-definitions/internal";
|
|
10
10
|
|
|
11
11
|
import { DocumentServiceProxy } from "../../documentServiceProxy.js";
|
|
12
12
|
|
|
13
|
-
import { ICompressionStorageConfig } from "./compressionTypes.js";
|
|
13
|
+
import type { ICompressionStorageConfig } from "./compressionTypes.js";
|
|
14
14
|
import { DocumentStorageServiceCompressionAdapter as DocumentStorageServiceSummaryBlobCompressionAdapter } from "./summaryblob/index.js";
|
|
15
15
|
|
|
16
16
|
export class DocumentServiceCompressionAdapter extends DocumentServiceProxy {
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
|
-
import { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
8
|
-
import {
|
|
6
|
+
import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
|
|
7
|
+
import type { ISummaryTree } from "@fluidframework/driver-definitions";
|
|
8
|
+
import type {
|
|
9
9
|
IDocumentService,
|
|
10
10
|
IDocumentServiceFactory,
|
|
11
11
|
IResolvedUrl,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
import { DocumentServiceFactoryProxy } from "../../documentServiceFactoryProxy.js";
|
|
15
15
|
|
|
16
|
-
import { ICompressionStorageConfig } from "./compressionTypes.js";
|
|
16
|
+
import type { ICompressionStorageConfig } from "./compressionTypes.js";
|
|
17
17
|
import { DocumentServiceCompressionAdapter } from "./documentServiceCompressionAdapter.js";
|
|
18
18
|
import { DocumentStorageServiceCompressionAdapter as DocumentStorageServiceSummaryBlobCompressionAdapter } from "./summaryblob/index.js";
|
|
19
19
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
export {
|
|
7
7
|
SummaryCompressionAlgorithm,
|
|
8
|
-
ICompressionStorageConfig,
|
|
8
|
+
type ICompressionStorageConfig,
|
|
9
9
|
DefaultCompressionStorageConfig,
|
|
10
10
|
} from "./compressionTypes.js";
|
|
11
11
|
export { DocumentServiceFactoryCompressionAdapter } from "./documentServiceFactoryCompressionAdapter.js";
|