@fluidframework/routerlicious-driver 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.246488
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/.eslintrc.cjs +4 -1
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +32 -0
- package/api-report/routerlicious-driver.api.md +6 -3
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaStorageService.js.map +1 -1
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js +11 -9
- package/dist/documentServiceFactory.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/nullBlobStorageService.d.ts +0 -1
- package/dist/nullBlobStorageService.d.ts.map +1 -1
- package/dist/nullBlobStorageService.js +0 -3
- package/dist/nullBlobStorageService.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/policies.d.ts +0 -6
- package/dist/policies.d.ts.map +1 -1
- package/dist/policies.js.map +1 -1
- package/dist/r11sSnapshotParser.d.ts.map +1 -1
- package/dist/r11sSnapshotParser.js +1 -0
- package/dist/r11sSnapshotParser.js.map +1 -1
- package/dist/restWrapper.d.ts +3 -3
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/restWrapper.js.map +1 -1
- package/dist/routerlicious-driver-alpha.d.ts +24 -0
- package/dist/routerlicious-driver-beta.d.ts +2 -0
- package/dist/routerlicious-driver-public.d.ts +2 -0
- package/dist/routerlicious-driver-untrimmed.d.ts +22 -4
- package/dist/routerliciousResolvedUrl.d.ts +34 -0
- package/dist/routerliciousResolvedUrl.d.ts.map +1 -0
- package/dist/routerliciousResolvedUrl.js +14 -0
- package/dist/routerliciousResolvedUrl.js.map +1 -0
- package/dist/shreddedSummaryDocumentStorageService.d.ts +0 -1
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.js +0 -1
- package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/dist/treeUtils.d.ts +1 -0
- package/dist/treeUtils.d.ts.map +1 -1
- package/dist/treeUtils.js +2 -0
- package/dist/treeUtils.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/urlUtils.d.ts +0 -2
- package/dist/urlUtils.d.ts.map +1 -1
- package/dist/urlUtils.js +9 -17
- package/dist/urlUtils.js.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts +0 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.js +0 -1
- package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
- package/lib/contracts.d.mts +1 -0
- package/lib/contracts.d.mts.map +1 -1
- package/lib/contracts.mjs.map +1 -1
- package/lib/deltaStorageService.mjs.map +1 -1
- package/lib/documentServiceFactory.d.mts.map +1 -1
- package/lib/documentServiceFactory.mjs +12 -10
- package/lib/documentServiceFactory.mjs.map +1 -1
- package/lib/index.d.mts +1 -0
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/nullBlobStorageService.d.mts +0 -1
- package/lib/nullBlobStorageService.d.mts.map +1 -1
- package/lib/nullBlobStorageService.mjs +0 -3
- package/lib/nullBlobStorageService.mjs.map +1 -1
- package/lib/packageVersion.d.mts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/policies.d.mts +0 -6
- package/lib/policies.d.mts.map +1 -1
- package/lib/policies.mjs.map +1 -1
- package/lib/r11sSnapshotParser.d.mts.map +1 -1
- package/lib/r11sSnapshotParser.mjs +1 -0
- package/lib/r11sSnapshotParser.mjs.map +1 -1
- package/lib/restWrapper.d.mts +3 -3
- package/lib/restWrapper.d.mts.map +1 -1
- package/lib/restWrapper.mjs.map +1 -1
- package/lib/routerlicious-driver-alpha.d.mts +24 -0
- package/lib/routerlicious-driver-beta.d.mts +2 -0
- package/lib/routerlicious-driver-public.d.mts +2 -0
- package/lib/routerlicious-driver-untrimmed.d.mts +22 -4
- package/lib/routerliciousResolvedUrl.d.mts +34 -0
- package/lib/routerliciousResolvedUrl.d.mts.map +1 -0
- package/lib/routerliciousResolvedUrl.mjs +10 -0
- package/lib/routerliciousResolvedUrl.mjs.map +1 -0
- package/lib/shreddedSummaryDocumentStorageService.d.mts +0 -1
- package/lib/shreddedSummaryDocumentStorageService.d.mts.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.mjs +0 -1
- package/lib/shreddedSummaryDocumentStorageService.mjs.map +1 -1
- package/lib/treeUtils.d.mts +1 -0
- package/lib/treeUtils.d.mts.map +1 -1
- package/lib/treeUtils.mjs +2 -0
- package/lib/treeUtils.mjs.map +1 -1
- package/lib/urlUtils.d.mts +0 -2
- package/lib/urlUtils.d.mts.map +1 -1
- package/lib/urlUtils.mjs +8 -12
- package/lib/urlUtils.mjs.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.d.mts +0 -1
- package/lib/wholeSummaryDocumentStorageService.d.mts.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.mjs +0 -1
- package/lib/wholeSummaryDocumentStorageService.mjs.map +1 -1
- package/package.json +25 -24
- package/src/contracts.ts +1 -0
- package/src/deltaStorageService.ts +3 -3
- package/src/documentServiceFactory.ts +16 -13
- package/src/index.ts +3 -0
- package/src/nullBlobStorageService.ts +0 -4
- package/src/packageVersion.ts +1 -1
- package/src/policies.ts +0 -6
- package/src/r11sSnapshotParser.ts +1 -0
- package/src/restWrapper.ts +3 -3
- package/src/routerliciousResolvedUrl.ts +39 -0
- package/src/shreddedSummaryDocumentStorageService.ts +0 -2
- package/src/treeUtils.ts +3 -0
- package/src/urlUtils.ts +8 -13
- package/src/wholeSummaryDocumentStorageService.ts +0 -2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CAAC,OAAO,CAAC,CAAC;QAE3B,OAAO,UAAU,CAAC;IACnB,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,KAA+B;QAC7D,MAAM,cAAc,GAAoB,EAAE,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YACtC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAEO,WAAW,CAAC,MAAc;QACjC,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;IAC/B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils\";\nimport { performance, stringToBuffer, Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { getW3CData, promiseRaceWithWinner } from \"@fluidframework/driver-base\";\nimport {\n\tIDocumentStorageService,\n\tISummaryContext,\n\tIDocumentStorageServicePolicies,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { ICache, InMemoryCache } from \"./cache\";\nimport { IRouterliciousDriverPolicies } from \"./policies\";\nimport {\n\tconvertSnapshotAndBlobsToSummaryTree,\n\tevalBlobsAndTrees,\n\tvalidateBlobsAndTrees,\n} from \"./treeUtils\";\nimport { GitManager } from \"./gitManager\";\nimport { WholeSummaryUploadManager } from \"./wholeSummaryUploadManager\";\nimport { ISummaryUploadManager } from \"./storageContracts\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { INormalizedWholeSnapshot, IWholeFlatSnapshot } from \"./contracts\";\nimport { convertWholeFlatSnapshotToSnapshotTreeAndBlobs } from \"./r11sSnapshotParser\";\n\nconst latestSnapshotId: string = \"latest\";\n\nexport class WholeSummaryDocumentStorageService implements IDocumentStorageService {\n\tprivate readonly mc: MonitoringContext;\n\tprivate firstVersionsCall: boolean = true;\n\n\tpublic readonly repositoryUrl = \"\";\n\n\tprivate async getSummaryUploadManager(): Promise<ISummaryUploadManager> {\n\t\tconst manager = await this.getStorageManager();\n\t\treturn new WholeSummaryUploadManager(manager);\n\t}\n\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly manager: GitManager,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tpublic readonly policies: IDocumentStorageServicePolicies,\n\t\tprivate readonly driverPolicies?: IRouterliciousDriverPolicies,\n\t\tprivate readonly blobCache: ICache<ArrayBufferLike> = new InMemoryCache(),\n\t\tprivate readonly snapshotTreeCache: ICache<INormalizedWholeSnapshot> = new InMemoryCache(),\n\t\tprivate readonly noCacheGitManager?: GitManager,\n\t\tprivate readonly getStorageManager: (\n\t\t\tdisableCache?: boolean,\n\t\t) => Promise<GitManager> = async (disableCache) =>\n\t\t\tdisableCache && this.noCacheGitManager !== undefined\n\t\t\t\t? this.noCacheGitManager\n\t\t\t\t: this.manager,\n\t) {\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger,\n\t\t});\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (versionId !== this.id && versionId !== null) {\n\t\t\t// Blobs/Trees in this scenario will never have multiple versions, so return versionId as is\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: versionId,\n\t\t\t\t\ttreeId: undefined!,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\t// If this is the first versions call for the document, we know we will want the latest summary.\n\t\t// Fetch latest summary, cache it, and return its id.\n\t\tif (this.firstVersionsCall && count === 1) {\n\t\t\tconst normalizedSnapshotContents = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"ObtainSnapshot\",\n\t\t\t\t\tversionId: versionId ?? undefined,\n\t\t\t\t\tcount,\n\t\t\t\t\tenableDiscovery: this.driverPolicies?.enableDiscovery,\n\t\t\t\t},\n\t\t\t\tasync (event) => {\n\t\t\t\t\tlet method: string;\n\t\t\t\t\tconst cachedSnapshotP = this.snapshotTreeCache.get(\n\t\t\t\t\t\tthis.getCacheKey(latestSnapshotId),\n\t\t\t\t\t);\n\n\t\t\t\t\tconst networkSnapshotP = !this.driverPolicies?.enableDiscovery\n\t\t\t\t\t\t? this.fetchSnapshotTree(latestSnapshotId, false, \"getVersions\")\n\t\t\t\t\t\t: this.fetchSnapshotTree(latestSnapshotId, true, \"getVersions\");\n\n\t\t\t\t\tconst promiseRaceWinner = await promiseRaceWithWinner([\n\t\t\t\t\t\tcachedSnapshotP.catch(() => undefined),\n\t\t\t\t\t\tnetworkSnapshotP.catch(() => undefined),\n\t\t\t\t\t]);\n\n\t\t\t\t\tlet retrievedSnapshot = promiseRaceWinner.value;\n\t\t\t\t\tmethod = promiseRaceWinner.index === 0 ? \"cache\" : \"network\";\n\n\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t// if network failed -> wait for cache ( then return network failure)\n\t\t\t\t\t\t// If cache returned empty or failed -> wait for network (success of failure)\n\t\t\t\t\t\tif (promiseRaceWinner.index === 1) {\n\t\t\t\t\t\t\tretrievedSnapshot = await cachedSnapshotP;\n\t\t\t\t\t\t\tmethod = \"cache\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\tretrievedSnapshot = await networkSnapshotP;\n\t\t\t\t\t\t\tmethod = \"network\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tmethod,\n\t\t\t\t\t});\n\t\t\t\t\treturn retrievedSnapshot;\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst _id = await this.initializeFromSnapshot(normalizedSnapshotContents);\n\t\t\tthis.firstVersionsCall = false;\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: _id,\n\t\t\t\t\ttreeId: normalizedSnapshotContents.snapshotTree.id!,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\t// Otherwise, get the latest version of the document as normal.\n\t\tconst id = versionId ? versionId : this.id;\n\t\tconst commits = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getVersions\",\n\t\t\t\tversionId: id,\n\t\t\t\tcount,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\treturn (await manager.getCommits(id, count)).content;\n\t\t\t},\n\t\t);\n\t\treturn commits.map((commit) => ({\n\t\t\tdate: commit.commit.author.date,\n\t\t\tid: commit.sha,\n\t\t\ttreeId: commit.commit.tree.sha,\n\t\t}));\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tlet requestVersion = version;\n\t\tif (!requestVersion) {\n\t\t\tconst versions = await this.getVersions(this.id, 1);\n\t\t\tif (versions.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\trequestVersion = versions[0];\n\t\t}\n\n\t\tlet normalizedWholeSnapshot = await this.snapshotTreeCache.get(\n\t\t\tthis.getCacheKey(requestVersion.id),\n\t\t);\n\t\tif (normalizedWholeSnapshot !== undefined) {\n\t\t\treturn normalizedWholeSnapshot.snapshotTree;\n\t\t}\n\n\t\tnormalizedWholeSnapshot = await this.fetchSnapshotTree(\n\t\t\trequestVersion.id,\n\t\t\tundefined,\n\t\t\t\"getSnapshotTree\",\n\t\t);\n\n\t\t// Currently retrieving blobs from network is not supported by AFR for WholeSummaryDocumentStorageService\n\t\t// Blobs are expected to be put in the cache\n\t\tawait this.updateBlobsCache(normalizedWholeSnapshot.blobs);\n\n\t\treturn normalizedWholeSnapshot.snapshotTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst cachedBlob = await this.blobCache.get(this.getCacheKey(blobId));\n\t\tif (cachedBlob !== undefined) {\n\t\t\treturn cachedBlob;\n\t\t}\n\n\t\t// Note: AFR does not support readBlobs, but potentially other r11s like servers do\n\t\tconst blob = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"readBlob\",\n\t\t\t\tblobId,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = (await manager.getBlob(blobId)).content;\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.size,\n\t\t\t\t});\n\t\t\t\treturn response;\n\t\t\t},\n\t\t\tundefined, // workers\n\t\t\tundefined, // recordHeapSize\n\t\t\tthis.mc.config.getNumber(\"Fluid.Driver.ReadBlobTelemetrySampling\"),\n\t\t);\n\t\tconst bufferValue = stringToBuffer(blob.content, blob.encoding);\n\n\t\tawait this.blobCache.put(this.getCacheKey(blob.sha), bufferValue);\n\n\t\treturn bufferValue;\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tconst summaryHandle = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"uploadSummaryWithContext\",\n\t\t\t\tproposalHandle: context.proposalHandle,\n\t\t\t\tackHandle: context.ackHandle,\n\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst summaryUploadManager = await this.getSummaryUploadManager();\n\t\t\t\treturn summaryUploadManager.writeSummaryTree(\n\t\t\t\t\tsummary,\n\t\t\t\t\tcontext.ackHandle ?? \"\",\n\t\t\t\t\t\"channel\",\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\t\treturn summaryHandle;\n\t}\n\n\tpublic async downloadSummary(summaryHandle: ISummaryHandle): Promise<ISummaryTree> {\n\t\tconst wholeFlatSnapshot = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getWholeFlatSummary\",\n\t\t\t\ttreeId: summaryHandle.handle,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = await manager.getSnapshot(summaryHandle.handle);\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.content.trees[0]?.entries.length,\n\t\t\t\t});\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\n\t\tconst { blobs, snapshotTree } = convertWholeFlatSnapshotToSnapshotTreeAndBlobs(\n\t\t\twholeFlatSnapshot,\n\t\t\t\"\",\n\t\t);\n\t\treturn convertSnapshotAndBlobsToSummaryTree(snapshotTree, blobs);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\tconst uint8ArrayFile = new Uint8Array(file);\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"createBlob\",\n\t\t\t\tsize: uint8ArrayFile.length,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = await manager\n\t\t\t\t\t.createBlob(Uint8ArrayToString(uint8ArrayFile, \"base64\"), \"base64\")\n\t\t\t\t\t.then((r) => ({ id: r.content.sha, url: r.content.url }));\n\t\t\t\tevent.end({\n\t\t\t\t\tblobId: response.id,\n\t\t\t\t});\n\t\t\t\treturn response;\n\t\t\t},\n\t\t);\n\t}\n\n\tprivate async fetchSnapshotTree(\n\t\tversionId: string,\n\t\tdisableCache?: boolean,\n\t\tscenarioName?: string,\n\t): Promise<INormalizedWholeSnapshot> {\n\t\tconst normalizedWholeSummary = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getWholeFlatSummary\",\n\t\t\t\ttreeId: versionId,\n\t\t\t\tscenarioName,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager(disableCache);\n\t\t\t\tconst response: IR11sResponse<IWholeFlatSnapshot> =\n\t\t\t\t\tawait manager.getSnapshot(versionId);\n\t\t\t\tconst start = performance.now();\n\t\t\t\tconst snapshot: INormalizedWholeSnapshot =\n\t\t\t\t\tconvertWholeFlatSnapshotToSnapshotTreeAndBlobs(response.content);\n\t\t\t\tconst snapshotConversionTime = performance.now() - start;\n\t\t\t\tvalidateBlobsAndTrees(snapshot.snapshotTree);\n\t\t\t\tconst { trees, numBlobs, encodedBlobsSize } = evalBlobsAndTrees(snapshot);\n\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.content.trees[0]?.entries.length,\n\t\t\t\t\ttrees,\n\t\t\t\t\tblobs: numBlobs,\n\t\t\t\t\tencodedBlobsSize,\n\t\t\t\t\tsequenceNumber: snapshot.sequenceNumber,\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\tsnapshotConversionTime,\n\t\t\t\t\t...getW3CData(response.requestUrl, \"xmlhttprequest\"),\n\t\t\t\t});\n\t\t\t\treturn snapshot;\n\t\t\t},\n\t\t);\n\n\t\t// Also add the result into the cache.\n\t\tawait this.snapshotTreeCache\n\t\t\t.put(this.getCacheKey(versionId), normalizedWholeSummary)\n\t\t\t.catch(() => undefined);\n\t\treturn normalizedWholeSummary;\n\t}\n\n\tprivate async initializeFromSnapshot(\n\t\tnormalizedWholeSummary: INormalizedWholeSnapshot,\n\t): Promise<string> {\n\t\tconst snapshotId = normalizedWholeSummary.id;\n\t\tassert(snapshotId !== undefined, 0x275 /* \"Root tree should contain the id\" */);\n\t\tconst cachePs: Promise<any>[] = [\n\t\t\tthis.snapshotTreeCache.put(this.getCacheKey(snapshotId), normalizedWholeSummary),\n\t\t\tthis.updateBlobsCache(normalizedWholeSummary.blobs),\n\t\t];\n\n\t\tawait Promise.all(cachePs);\n\n\t\treturn snapshotId;\n\t}\n\n\tprivate async updateBlobsCache(blobs: Map<string, ArrayBuffer>): Promise<void> {\n\t\tconst blobCachePutPs: Promise<void>[] = [];\n\t\tblobs.forEach((value, id) => {\n\t\t\tconst cacheKey = this.getCacheKey(id);\n\t\t\tblobCachePutPs.push(this.blobCache.put(cacheKey, value));\n\t\t});\n\t\tawait Promise.all(blobCachePutPs);\n\t}\n\n\tprivate getCacheKey(blobId: string): string {\n\t\treturn `${this.id}:${blobId}`;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"wholeSummaryDocumentStorageService.mjs","sourceRoot":"","sources":["../src/wholeSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAGN,gBAAgB,EAChB,4BAA4B,GAC5B,MAAM,iCAAiC;OACjC,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,8BAA8B;OACvF,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAC5C,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,6BAA6B;OAaxE,EAAU,aAAa,EAAE;OAEzB,EACN,oCAAoC,EACpC,iBAAiB,EACjB,qBAAqB,GACrB;OAEM,EAAE,yBAAyB,EAAE;OAI7B,EAAE,8CAA8C,EAAE;AAEzD,MAAM,gBAAgB,GAAW,QAAQ,CAAC;AAE1C,MAAM,OAAO,kCAAkC;IAItC,KAAK,CAAC,uBAAuB;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC/C,OAAO,IAAI,yBAAyB,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SAAS,CAAC,EAAE,sBAAsB,CAAC;aACxD,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACzB,OAAO,sBAAsB,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,sBAAsB,CACnC,sBAAgD;QAEhD,MAAM,UAAU,GAAG,sBAAsB,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAChF,MAAM,OAAO,GAAmB;YAC/B,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,sBAAsB,CAAC;YAChF,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,KAAK,CAAC;SACnD,CAAC;QAEF,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE3B,OAAO,UAAU,CAAC;IACnB,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,KAA+B;QAC7D,MAAM,cAAc,GAAoB,EAAE,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YACtC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAEO,WAAW,CAAC,MAAc;QACjC,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;IAC/B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils\";\nimport { performance, stringToBuffer, Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { getW3CData, promiseRaceWithWinner } from \"@fluidframework/driver-base\";\nimport {\n\tIDocumentStorageService,\n\tISummaryContext,\n\tIDocumentStorageServicePolicies,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { ICache, InMemoryCache } from \"./cache\";\nimport { IRouterliciousDriverPolicies } from \"./policies\";\nimport {\n\tconvertSnapshotAndBlobsToSummaryTree,\n\tevalBlobsAndTrees,\n\tvalidateBlobsAndTrees,\n} from \"./treeUtils\";\nimport { GitManager } from \"./gitManager\";\nimport { WholeSummaryUploadManager } from \"./wholeSummaryUploadManager\";\nimport { ISummaryUploadManager } from \"./storageContracts\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { INormalizedWholeSnapshot, IWholeFlatSnapshot } from \"./contracts\";\nimport { convertWholeFlatSnapshotToSnapshotTreeAndBlobs } from \"./r11sSnapshotParser\";\n\nconst latestSnapshotId: string = \"latest\";\n\nexport class WholeSummaryDocumentStorageService implements IDocumentStorageService {\n\tprivate readonly mc: MonitoringContext;\n\tprivate firstVersionsCall: boolean = true;\n\n\tprivate async getSummaryUploadManager(): Promise<ISummaryUploadManager> {\n\t\tconst manager = await this.getStorageManager();\n\t\treturn new WholeSummaryUploadManager(manager);\n\t}\n\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly manager: GitManager,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tpublic readonly policies: IDocumentStorageServicePolicies,\n\t\tprivate readonly driverPolicies?: IRouterliciousDriverPolicies,\n\t\tprivate readonly blobCache: ICache<ArrayBufferLike> = new InMemoryCache(),\n\t\tprivate readonly snapshotTreeCache: ICache<INormalizedWholeSnapshot> = new InMemoryCache(),\n\t\tprivate readonly noCacheGitManager?: GitManager,\n\t\tprivate readonly getStorageManager: (\n\t\t\tdisableCache?: boolean,\n\t\t) => Promise<GitManager> = async (disableCache) =>\n\t\t\tdisableCache && this.noCacheGitManager !== undefined\n\t\t\t\t? this.noCacheGitManager\n\t\t\t\t: this.manager,\n\t) {\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger,\n\t\t});\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (versionId !== this.id && versionId !== null) {\n\t\t\t// Blobs/Trees in this scenario will never have multiple versions, so return versionId as is\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: versionId,\n\t\t\t\t\ttreeId: undefined!,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\t// If this is the first versions call for the document, we know we will want the latest summary.\n\t\t// Fetch latest summary, cache it, and return its id.\n\t\tif (this.firstVersionsCall && count === 1) {\n\t\t\tconst normalizedSnapshotContents = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"ObtainSnapshot\",\n\t\t\t\t\tversionId: versionId ?? undefined,\n\t\t\t\t\tcount,\n\t\t\t\t\tenableDiscovery: this.driverPolicies?.enableDiscovery,\n\t\t\t\t},\n\t\t\t\tasync (event) => {\n\t\t\t\t\tlet method: string;\n\t\t\t\t\tconst cachedSnapshotP = this.snapshotTreeCache.get(\n\t\t\t\t\t\tthis.getCacheKey(latestSnapshotId),\n\t\t\t\t\t);\n\n\t\t\t\t\tconst networkSnapshotP = !this.driverPolicies?.enableDiscovery\n\t\t\t\t\t\t? this.fetchSnapshotTree(latestSnapshotId, false, \"getVersions\")\n\t\t\t\t\t\t: this.fetchSnapshotTree(latestSnapshotId, true, \"getVersions\");\n\n\t\t\t\t\tconst promiseRaceWinner = await promiseRaceWithWinner([\n\t\t\t\t\t\tcachedSnapshotP.catch(() => undefined),\n\t\t\t\t\t\tnetworkSnapshotP.catch(() => undefined),\n\t\t\t\t\t]);\n\n\t\t\t\t\tlet retrievedSnapshot = promiseRaceWinner.value;\n\t\t\t\t\tmethod = promiseRaceWinner.index === 0 ? \"cache\" : \"network\";\n\n\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t// if network failed -> wait for cache ( then return network failure)\n\t\t\t\t\t\t// If cache returned empty or failed -> wait for network (success of failure)\n\t\t\t\t\t\tif (promiseRaceWinner.index === 1) {\n\t\t\t\t\t\t\tretrievedSnapshot = await cachedSnapshotP;\n\t\t\t\t\t\t\tmethod = \"cache\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\tretrievedSnapshot = await networkSnapshotP;\n\t\t\t\t\t\t\tmethod = \"network\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tmethod,\n\t\t\t\t\t});\n\t\t\t\t\treturn retrievedSnapshot;\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst _id = await this.initializeFromSnapshot(normalizedSnapshotContents);\n\t\t\tthis.firstVersionsCall = false;\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: _id,\n\t\t\t\t\ttreeId: normalizedSnapshotContents.snapshotTree.id!,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\t// Otherwise, get the latest version of the document as normal.\n\t\tconst id = versionId ? versionId : this.id;\n\t\tconst commits = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getVersions\",\n\t\t\t\tversionId: id,\n\t\t\t\tcount,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\treturn (await manager.getCommits(id, count)).content;\n\t\t\t},\n\t\t);\n\t\treturn commits.map((commit) => ({\n\t\t\tdate: commit.commit.author.date,\n\t\t\tid: commit.sha,\n\t\t\ttreeId: commit.commit.tree.sha,\n\t\t}));\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tlet requestVersion = version;\n\t\tif (!requestVersion) {\n\t\t\tconst versions = await this.getVersions(this.id, 1);\n\t\t\tif (versions.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\trequestVersion = versions[0];\n\t\t}\n\n\t\tlet normalizedWholeSnapshot = await this.snapshotTreeCache.get(\n\t\t\tthis.getCacheKey(requestVersion.id),\n\t\t);\n\t\tif (normalizedWholeSnapshot !== undefined) {\n\t\t\treturn normalizedWholeSnapshot.snapshotTree;\n\t\t}\n\n\t\tnormalizedWholeSnapshot = await this.fetchSnapshotTree(\n\t\t\trequestVersion.id,\n\t\t\tundefined,\n\t\t\t\"getSnapshotTree\",\n\t\t);\n\n\t\t// Currently retrieving blobs from network is not supported by AFR for WholeSummaryDocumentStorageService\n\t\t// Blobs are expected to be put in the cache\n\t\tawait this.updateBlobsCache(normalizedWholeSnapshot.blobs);\n\n\t\treturn normalizedWholeSnapshot.snapshotTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst cachedBlob = await this.blobCache.get(this.getCacheKey(blobId));\n\t\tif (cachedBlob !== undefined) {\n\t\t\treturn cachedBlob;\n\t\t}\n\n\t\t// Note: AFR does not support readBlobs, but potentially other r11s like servers do\n\t\tconst blob = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"readBlob\",\n\t\t\t\tblobId,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = (await manager.getBlob(blobId)).content;\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.size,\n\t\t\t\t});\n\t\t\t\treturn response;\n\t\t\t},\n\t\t\tundefined, // workers\n\t\t\tundefined, // recordHeapSize\n\t\t\tthis.mc.config.getNumber(\"Fluid.Driver.ReadBlobTelemetrySampling\"),\n\t\t);\n\t\tconst bufferValue = stringToBuffer(blob.content, blob.encoding);\n\n\t\tawait this.blobCache.put(this.getCacheKey(blob.sha), bufferValue);\n\n\t\treturn bufferValue;\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tconst summaryHandle = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"uploadSummaryWithContext\",\n\t\t\t\tproposalHandle: context.proposalHandle,\n\t\t\t\tackHandle: context.ackHandle,\n\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst summaryUploadManager = await this.getSummaryUploadManager();\n\t\t\t\treturn summaryUploadManager.writeSummaryTree(\n\t\t\t\t\tsummary,\n\t\t\t\t\tcontext.ackHandle ?? \"\",\n\t\t\t\t\t\"channel\",\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\t\treturn summaryHandle;\n\t}\n\n\tpublic async downloadSummary(summaryHandle: ISummaryHandle): Promise<ISummaryTree> {\n\t\tconst wholeFlatSnapshot = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getWholeFlatSummary\",\n\t\t\t\ttreeId: summaryHandle.handle,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = await manager.getSnapshot(summaryHandle.handle);\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.content.trees[0]?.entries.length,\n\t\t\t\t});\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\n\t\tconst { blobs, snapshotTree } = convertWholeFlatSnapshotToSnapshotTreeAndBlobs(\n\t\t\twholeFlatSnapshot,\n\t\t\t\"\",\n\t\t);\n\t\treturn convertSnapshotAndBlobsToSummaryTree(snapshotTree, blobs);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\tconst uint8ArrayFile = new Uint8Array(file);\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"createBlob\",\n\t\t\t\tsize: uint8ArrayFile.length,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = await manager\n\t\t\t\t\t.createBlob(Uint8ArrayToString(uint8ArrayFile, \"base64\"), \"base64\")\n\t\t\t\t\t.then((r) => ({ id: r.content.sha, url: r.content.url }));\n\t\t\t\tevent.end({\n\t\t\t\t\tblobId: response.id,\n\t\t\t\t});\n\t\t\t\treturn response;\n\t\t\t},\n\t\t);\n\t}\n\n\tprivate async fetchSnapshotTree(\n\t\tversionId: string,\n\t\tdisableCache?: boolean,\n\t\tscenarioName?: string,\n\t): Promise<INormalizedWholeSnapshot> {\n\t\tconst normalizedWholeSummary = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getWholeFlatSummary\",\n\t\t\t\ttreeId: versionId,\n\t\t\t\tscenarioName,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager(disableCache);\n\t\t\t\tconst response: IR11sResponse<IWholeFlatSnapshot> =\n\t\t\t\t\tawait manager.getSnapshot(versionId);\n\t\t\t\tconst start = performance.now();\n\t\t\t\tconst snapshot: INormalizedWholeSnapshot =\n\t\t\t\t\tconvertWholeFlatSnapshotToSnapshotTreeAndBlobs(response.content);\n\t\t\t\tconst snapshotConversionTime = performance.now() - start;\n\t\t\t\tvalidateBlobsAndTrees(snapshot.snapshotTree);\n\t\t\t\tconst { trees, numBlobs, encodedBlobsSize } = evalBlobsAndTrees(snapshot);\n\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.content.trees[0]?.entries.length,\n\t\t\t\t\ttrees,\n\t\t\t\t\tblobs: numBlobs,\n\t\t\t\t\tencodedBlobsSize,\n\t\t\t\t\tsequenceNumber: snapshot.sequenceNumber,\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\tsnapshotConversionTime,\n\t\t\t\t\t...getW3CData(response.requestUrl, \"xmlhttprequest\"),\n\t\t\t\t});\n\t\t\t\treturn snapshot;\n\t\t\t},\n\t\t);\n\n\t\t// Also add the result into the cache.\n\t\tawait this.snapshotTreeCache\n\t\t\t.put(this.getCacheKey(versionId), normalizedWholeSummary)\n\t\t\t.catch(() => undefined);\n\t\treturn normalizedWholeSummary;\n\t}\n\n\tprivate async initializeFromSnapshot(\n\t\tnormalizedWholeSummary: INormalizedWholeSnapshot,\n\t): Promise<string> {\n\t\tconst snapshotId = normalizedWholeSummary.id;\n\t\tassert(snapshotId !== undefined, 0x275 /* \"Root tree should contain the id\" */);\n\t\tconst cachePs: Promise<any>[] = [\n\t\t\tthis.snapshotTreeCache.put(this.getCacheKey(snapshotId), normalizedWholeSummary),\n\t\t\tthis.updateBlobsCache(normalizedWholeSummary.blobs),\n\t\t];\n\n\t\tawait Promise.all(cachePs);\n\n\t\treturn snapshotId;\n\t}\n\n\tprivate async updateBlobsCache(blobs: Map<string, ArrayBuffer>): Promise<void> {\n\t\tconst blobCachePutPs: Promise<void>[] = [];\n\t\tblobs.forEach((value, id) => {\n\t\t\tconst cacheKey = this.getCacheKey(id);\n\t\t\tblobCachePutPs.push(this.blobCache.put(cacheKey, value));\n\t\t});\n\t\tawait Promise.all(blobCachePutPs);\n\t}\n\n\tprivate getCacheKey(blobId: string): string {\n\t\treturn `${this.id}:${blobId}`;\n\t}\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/routerlicious-driver",
|
|
3
|
-
"version": "2.0.0-dev-rc.
|
|
3
|
+
"version": "2.0.0-dev-rc.2.0.0.246488",
|
|
4
4
|
"description": "Socket.IO + Git implementation of Fluid service API",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -87,43 +87,41 @@
|
|
|
87
87
|
"temp-directory": "nyc/.nyc_output"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@fluid-internal/client-utils": "2.0.0-dev-rc.
|
|
91
|
-
"@fluidframework/core-interfaces": "2.0.0-dev-rc.
|
|
92
|
-
"@fluidframework/core-utils": "2.0.0-dev-rc.
|
|
93
|
-
"@fluidframework/driver-base": "2.0.0-dev-rc.
|
|
94
|
-
"@fluidframework/driver-definitions": "2.0.0-dev-rc.
|
|
95
|
-
"@fluidframework/driver-utils": "2.0.0-dev-rc.
|
|
96
|
-
"@fluidframework/gitresources": "^
|
|
97
|
-
"@fluidframework/protocol-base": "^
|
|
98
|
-
"@fluidframework/protocol-definitions": "^3.2.0
|
|
99
|
-
"@fluidframework/server-services-client": "^
|
|
100
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.
|
|
90
|
+
"@fluid-internal/client-utils": "2.0.0-dev-rc.2.0.0.246488",
|
|
91
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.2.0.0.246488",
|
|
92
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.2.0.0.246488",
|
|
93
|
+
"@fluidframework/driver-base": "2.0.0-dev-rc.2.0.0.246488",
|
|
94
|
+
"@fluidframework/driver-definitions": "2.0.0-dev-rc.2.0.0.246488",
|
|
95
|
+
"@fluidframework/driver-utils": "2.0.0-dev-rc.2.0.0.246488",
|
|
96
|
+
"@fluidframework/gitresources": "^4.0.0",
|
|
97
|
+
"@fluidframework/protocol-base": "^4.0.0",
|
|
98
|
+
"@fluidframework/protocol-definitions": "^3.2.0",
|
|
99
|
+
"@fluidframework/server-services-client": "^4.0.0",
|
|
100
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.2.0.0.246488",
|
|
101
101
|
"cross-fetch": "^3.1.5",
|
|
102
102
|
"json-stringify-safe": "5.0.1",
|
|
103
|
-
"socket.io-client": "^4.
|
|
104
|
-
"url-parse": "^1.5.8",
|
|
103
|
+
"socket.io-client": "^4.7.3",
|
|
105
104
|
"uuid": "^9.0.0"
|
|
106
105
|
},
|
|
107
106
|
"devDependencies": {
|
|
108
107
|
"@arethetypeswrong/cli": "^0.13.3",
|
|
109
|
-
"@fluid-
|
|
108
|
+
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.2.0.0.246488",
|
|
109
|
+
"@fluid-tools/build-cli": "^0.34.0",
|
|
110
110
|
"@fluidframework/build-common": "^2.0.3",
|
|
111
|
-
"@fluidframework/build-tools": "^0.
|
|
112
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
113
|
-
"@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.232845",
|
|
111
|
+
"@fluidframework/build-tools": "^0.34.0",
|
|
112
|
+
"@fluidframework/eslint-config-fluid": "^5.1.0",
|
|
114
113
|
"@fluidframework/routerlicious-driver-previous": "npm:@fluidframework/routerlicious-driver@2.0.0-internal.8.0.0",
|
|
115
|
-
"@microsoft/api-extractor": "^7.
|
|
114
|
+
"@microsoft/api-extractor": "^7.42.3",
|
|
116
115
|
"@types/mocha": "^9.1.1",
|
|
117
116
|
"@types/nock": "^9.3.0",
|
|
118
117
|
"@types/node": "^18.19.0",
|
|
119
|
-
"@types/sinon": "^
|
|
120
|
-
"@types/url-parse": "1.4.4",
|
|
118
|
+
"@types/sinon": "^17.0.3",
|
|
121
119
|
"@types/uuid": "^9.0.2",
|
|
122
120
|
"axios": "^1.6.2",
|
|
123
121
|
"c8": "^8.0.1",
|
|
124
122
|
"copyfiles": "^2.4.1",
|
|
125
123
|
"cross-env": "^7.0.3",
|
|
126
|
-
"eslint": "~8.
|
|
124
|
+
"eslint": "~8.55.0",
|
|
127
125
|
"mocha": "^10.2.0",
|
|
128
126
|
"mocha-json-output-reporter": "^2.0.1",
|
|
129
127
|
"mocha-multi-reporters": "^1.5.1",
|
|
@@ -131,7 +129,7 @@
|
|
|
131
129
|
"nock": "^13.3.3",
|
|
132
130
|
"prettier": "~3.0.3",
|
|
133
131
|
"rimraf": "^4.4.0",
|
|
134
|
-
"sinon": "^
|
|
132
|
+
"sinon": "^17.0.1",
|
|
135
133
|
"tsc-multi": "^1.1.0",
|
|
136
134
|
"typescript": "~5.1.6"
|
|
137
135
|
},
|
|
@@ -152,6 +150,9 @@
|
|
|
152
150
|
"RemovedEnumDeclaration_RouterliciousErrorType": {
|
|
153
151
|
"forwardCompat": false,
|
|
154
152
|
"backCompat": false
|
|
153
|
+
},
|
|
154
|
+
"InterfaceDeclaration_IRouterliciousDriverPolicies": {
|
|
155
|
+
"backCompat": false
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
},
|
|
@@ -179,7 +180,7 @@
|
|
|
179
180
|
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
180
181
|
"test": "npm run test:mocha",
|
|
181
182
|
"test:coverage": "c8 npm test",
|
|
182
|
-
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@
|
|
183
|
+
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluid-internal/mocha-test-setup",
|
|
183
184
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
184
185
|
"tsc": "tsc",
|
|
185
186
|
"typetests:gen": "fluid-type-test-generator",
|
package/src/contracts.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface IWholeFlatSnapshotTreeEntryTree {
|
|
|
16
16
|
type: "tree";
|
|
17
17
|
// Indicates that this tree entry is unreferenced. If this is not present, the tree entry is considered referenced.
|
|
18
18
|
unreferenced?: true;
|
|
19
|
+
groupId?: string;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export interface IWholeFlatSnapshotTreeEntryBlob {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
7
|
import { getW3CData, validateMessages } from "@fluidframework/driver-base";
|
|
8
8
|
import {
|
|
9
9
|
IDeltaStorageService,
|
|
@@ -62,7 +62,7 @@ export class DocumentDeltaStorageService implements IDocumentDeltaStorageService
|
|
|
62
62
|
const requestCallback = async (
|
|
63
63
|
from: number,
|
|
64
64
|
to: number,
|
|
65
|
-
telemetryProps:
|
|
65
|
+
telemetryProps: ITelemetryBaseProperties,
|
|
66
66
|
) => {
|
|
67
67
|
this.snapshotOps = this.logtailSha
|
|
68
68
|
? await readAndParse<ISequencedDocumentMessage[]>(
|
|
@@ -92,7 +92,7 @@ export class DocumentDeltaStorageService implements IDocumentDeltaStorageService
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
const stream = requestOps(
|
|
95
|
-
async (from: number, to: number, telemetryProps:
|
|
95
|
+
async (from: number, to: number, telemetryProps: ITelemetryBaseProperties) => {
|
|
96
96
|
const result = await requestCallback(from, to, telemetryProps);
|
|
97
97
|
// Catch all case, just in case
|
|
98
98
|
validateMessages("catch all", result.messages, from, this.logger);
|
|
@@ -26,20 +26,21 @@ import {
|
|
|
26
26
|
ISession,
|
|
27
27
|
convertSummaryTreeToWholeSummaryTree,
|
|
28
28
|
} from "@fluidframework/server-services-client";
|
|
29
|
+
import { ICache, InMemoryCache, NullCache } from "./cache";
|
|
30
|
+
import { INormalizedWholeSnapshot } from "./contracts";
|
|
31
|
+
import { ISnapshotTreeVersion } from "./definitions";
|
|
29
32
|
import { DocumentService } from "./documentService";
|
|
33
|
+
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
30
34
|
import { IRouterliciousDriverPolicies } from "./policies";
|
|
31
|
-
import { ITokenProvider } from "./tokens";
|
|
32
35
|
import {
|
|
33
36
|
RouterliciousOrdererRestWrapper,
|
|
34
37
|
RouterliciousStorageRestWrapper,
|
|
35
38
|
toInstrumentedR11sOrdererTokenFetcher,
|
|
36
39
|
toInstrumentedR11sStorageTokenFetcher,
|
|
37
40
|
} from "./restWrapper";
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import { ISnapshotTreeVersion } from "./definitions";
|
|
42
|
-
import { INormalizedWholeSnapshot } from "./contracts";
|
|
41
|
+
import { isRouterliciousResolvedUrl } from "./routerliciousResolvedUrl";
|
|
42
|
+
import { ITokenProvider } from "./tokens";
|
|
43
|
+
import { replaceDocumentIdInPath, getDiscoveredFluidResolvedUrl } from "./urlUtils";
|
|
43
44
|
|
|
44
45
|
const maximumSnapshotCacheDurationMs: FiveDaysMs = 432_000_000; // 5 days in ms
|
|
45
46
|
|
|
@@ -52,7 +53,6 @@ const defaultRouterliciousDriverPolicies: IRouterliciousDriverPolicies = {
|
|
|
52
53
|
enableRestLess: true,
|
|
53
54
|
enableInternalSummaryCaching: true,
|
|
54
55
|
enableLongPollingDowngrade: true,
|
|
55
|
-
isEphemeralContainer: false,
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
/**
|
|
@@ -107,7 +107,7 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
107
107
|
throw new Error("Empty file summary creation isn't supported in this driver.");
|
|
108
108
|
}
|
|
109
109
|
assert(!!resolvedUrl.endpoints.ordererUrl, 0x0b2 /* "Missing orderer URL!" */);
|
|
110
|
-
|
|
110
|
+
const parsedUrl = new URL(resolvedUrl.url);
|
|
111
111
|
if (!parsedUrl.pathname) {
|
|
112
112
|
throw new Error("Parsed url should contain tenant and doc Id!!");
|
|
113
113
|
}
|
|
@@ -138,6 +138,10 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
138
138
|
resolvedUrl.endpoints.ordererUrl,
|
|
139
139
|
);
|
|
140
140
|
|
|
141
|
+
const createAsEphemeral = isRouterliciousResolvedUrl(resolvedUrl)
|
|
142
|
+
? resolvedUrl.createAsEphemeral === true
|
|
143
|
+
: false;
|
|
144
|
+
|
|
141
145
|
const res = await PerformanceEvent.timedExecAsync(
|
|
142
146
|
logger2,
|
|
143
147
|
{
|
|
@@ -145,7 +149,7 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
145
149
|
details: JSON.stringify({
|
|
146
150
|
enableDiscovery: this.driverPolicies.enableDiscovery,
|
|
147
151
|
sequenceNumber: documentAttributes.sequenceNumber,
|
|
148
|
-
isEphemeralContainer:
|
|
152
|
+
isEphemeralContainer: createAsEphemeral,
|
|
149
153
|
}),
|
|
150
154
|
},
|
|
151
155
|
async (event) => {
|
|
@@ -159,7 +163,7 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
159
163
|
values: quorumValues,
|
|
160
164
|
enableDiscovery: this.driverPolicies.enableDiscovery,
|
|
161
165
|
generateToken: this.tokenProvider.documentPostCreateCallback !== undefined,
|
|
162
|
-
isEphemeralContainer:
|
|
166
|
+
isEphemeralContainer: createAsEphemeral,
|
|
163
167
|
enableAnyBinaryBlobOnFirstSummary: true,
|
|
164
168
|
})
|
|
165
169
|
).content;
|
|
@@ -185,7 +189,6 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
185
189
|
token = res.token;
|
|
186
190
|
session = this.driverPolicies.enableDiscovery ? res.session : undefined;
|
|
187
191
|
}
|
|
188
|
-
parsedUrl = parseFluidUrl(resolvedUrl.url);
|
|
189
192
|
|
|
190
193
|
// @TODO: Remove token from the condition, checking the documentPostCreateCallback !== undefined
|
|
191
194
|
// is sufficient to determine if the token will be undefined or not.
|
|
@@ -206,7 +209,7 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
206
209
|
throw new DocumentPostCreateError(error);
|
|
207
210
|
}
|
|
208
211
|
|
|
209
|
-
parsedUrl.
|
|
212
|
+
parsedUrl.pathname = replaceDocumentIdInPath(parsedUrl.pathname, documentId);
|
|
210
213
|
const deltaStorageUrl = resolvedUrl.endpoints.deltaStorageUrl;
|
|
211
214
|
if (!deltaStorageUrl) {
|
|
212
215
|
throw new Error(
|
|
@@ -246,7 +249,7 @@ export class RouterliciousDocumentServiceFactory implements IDocumentServiceFact
|
|
|
246
249
|
clientIsSummarizer?: boolean,
|
|
247
250
|
session?: ISession,
|
|
248
251
|
): Promise<IDocumentService> {
|
|
249
|
-
const parsedUrl =
|
|
252
|
+
const parsedUrl = new URL(resolvedUrl.url);
|
|
250
253
|
const [, tenantId, documentId] = parsedUrl.pathname.split("/");
|
|
251
254
|
if (!documentId || !tenantId) {
|
|
252
255
|
throw new Error(
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
// URL
|
|
7
|
+
export type { IRouterliciousResolvedUrl } from "./routerliciousResolvedUrl";
|
|
8
|
+
|
|
6
9
|
// Tokens
|
|
7
10
|
export { DefaultTokenProvider } from "./defaultTokenProvider";
|
|
8
11
|
export { ITokenProvider, ITokenResponse, ITokenService } from "./tokens";
|
|
@@ -11,10 +11,6 @@ import * as api from "@fluidframework/protocol-definitions";
|
|
|
11
11
|
* Does not read/write anything.
|
|
12
12
|
*/
|
|
13
13
|
export class NullBlobStorageService implements IDocumentStorageService {
|
|
14
|
-
public get repositoryUrl(): string {
|
|
15
|
-
throw new Error("Invalid operation");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
public async getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null> {
|
|
19
15
|
return version ? Promise.reject(new Error("Invalid operation")) : null;
|
|
20
16
|
}
|
package/src/packageVersion.ts
CHANGED
package/src/policies.ts
CHANGED
|
@@ -49,10 +49,4 @@ export interface IRouterliciousDriverPolicies {
|
|
|
49
49
|
* Default: true
|
|
50
50
|
*/
|
|
51
51
|
enableLongPollingDowngrade: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Indicates that the container is ephemeral.
|
|
54
|
-
* Artifacts relates to the container are limited to container lifetime.
|
|
55
|
-
* Default: false
|
|
56
|
-
*/
|
|
57
|
-
isEphemeralContainer: boolean;
|
|
58
52
|
}
|
package/src/restWrapper.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
7
|
import {
|
|
8
8
|
ITelemetryLoggerExt,
|
|
9
9
|
PerformanceEvent,
|
|
@@ -49,7 +49,7 @@ const axiosRequestConfigToFetchRequestConfig = (
|
|
|
49
49
|
export interface IR11sResponse<T> {
|
|
50
50
|
content: T;
|
|
51
51
|
headers: Map<string, string>;
|
|
52
|
-
propsToLog:
|
|
52
|
+
propsToLog: ITelemetryBaseProperties;
|
|
53
53
|
requestUrl: string;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -91,7 +91,7 @@ export function getPropsToLogFromResponse(headers: {
|
|
|
91
91
|
{ headerName: "content-encoding", logName: "contentEncoding" },
|
|
92
92
|
{ headerName: "content-type", logName: "contentType" },
|
|
93
93
|
];
|
|
94
|
-
const additionalProps:
|
|
94
|
+
const additionalProps: ITelemetryBaseProperties = {
|
|
95
95
|
contentsize: numberFromString(headers.get("content-length")),
|
|
96
96
|
};
|
|
97
97
|
headersToLog.forEach((header) => {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Routerlicious extends the resolved url with additional properties to control Routerlicious-specific behaviors.
|
|
10
|
+
*
|
|
11
|
+
* @privateRemarks
|
|
12
|
+
* {@link isRouterliciousResolvedUrl} can be used to detect whether an {@link @fluidframework/driver-definitions#IResolvedUrl}
|
|
13
|
+
* is an IRouterliciousResolvedUrl.
|
|
14
|
+
*
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export interface IRouterliciousResolvedUrl extends IResolvedUrl {
|
|
18
|
+
/**
|
|
19
|
+
* A flag to facilitate type narrowing from {@link @fluidframework/driver-definitions#IResolvedUrl} to IRouterliciousResolvedUrl.
|
|
20
|
+
*/
|
|
21
|
+
routerliciousResolvedUrl: true;
|
|
22
|
+
/**
|
|
23
|
+
* Controls whether a newly created container will be ephemeral, which means the service will not retain it
|
|
24
|
+
* after the collaboration session ends. Only affects
|
|
25
|
+
* {@link @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer} requests.
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue If left undefined, treated as `false`
|
|
28
|
+
*/
|
|
29
|
+
createAsEphemeral?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Type guard to detect if an IResolvedUrl is an IRouterliciousResolvedUrl.
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export const isRouterliciousResolvedUrl = (
|
|
37
|
+
resolvedUrl: IResolvedUrl,
|
|
38
|
+
): resolvedUrl is IRouterliciousResolvedUrl =>
|
|
39
|
+
(resolvedUrl as IRouterliciousResolvedUrl).routerliciousResolvedUrl === true;
|
|
@@ -46,8 +46,6 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
|
|
|
46
46
|
private readonly blobCache: ICache<ArrayBufferLike> | undefined;
|
|
47
47
|
private readonly snapshotTreeCache: ICache<ISnapshotTreeVersion> | undefined;
|
|
48
48
|
|
|
49
|
-
public readonly repositoryUrl = "";
|
|
50
|
-
|
|
51
49
|
private async getSummaryUploadManager(): Promise<ISummaryUploadManager> {
|
|
52
50
|
const manager = await this.getStorageManager();
|
|
53
51
|
return new SummaryTreeUploadManager(
|
package/src/treeUtils.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface ISummaryTreeAssemblerProps {
|
|
|
21
21
|
* Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.
|
|
22
22
|
*/
|
|
23
23
|
unreferenced?: true;
|
|
24
|
+
groupId?: string;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -40,6 +41,7 @@ export class SummaryTreeAssembler {
|
|
|
40
41
|
type: SummaryType.Tree,
|
|
41
42
|
tree: { ...this.summaryTree },
|
|
42
43
|
unreferenced: this.props?.unreferenced,
|
|
44
|
+
groupId: this.props?.groupId,
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -95,6 +97,7 @@ export function convertSnapshotAndBlobsToSummaryTree(
|
|
|
95
97
|
): ISummaryTree {
|
|
96
98
|
const assembler = new SummaryTreeAssembler({
|
|
97
99
|
unreferenced: snapshot.unreferenced,
|
|
100
|
+
groupId: snapshot.groupId,
|
|
98
101
|
});
|
|
99
102
|
for (const [path, id] of Object.entries(snapshot.blobs)) {
|
|
100
103
|
const blob = blobs.get(id);
|
package/src/urlUtils.ts
CHANGED
|
@@ -4,13 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
7
|
-
import URLParse from "url-parse";
|
|
8
7
|
import { ISession } from "@fluidframework/server-services-client";
|
|
9
8
|
|
|
10
|
-
export const parseFluidUrl = (fluidUrl: string): URLParse => {
|
|
11
|
-
return new URLParse(fluidUrl, true);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
9
|
/**
|
|
15
10
|
* Assume documentId is at end of url path.
|
|
16
11
|
* This is true for Routerlicious' and Tinylicious' documentUrl and deltaStorageUrl.
|
|
@@ -24,15 +19,15 @@ export const getDiscoveredFluidResolvedUrl = (
|
|
|
24
19
|
resolvedUrl: IResolvedUrl,
|
|
25
20
|
session: ISession,
|
|
26
21
|
): IResolvedUrl => {
|
|
27
|
-
const discoveredOrdererUrl = new
|
|
28
|
-
const deltaStorageUrl = new
|
|
29
|
-
deltaStorageUrl.
|
|
22
|
+
const discoveredOrdererUrl = new URL(session.ordererUrl);
|
|
23
|
+
const deltaStorageUrl = new URL(resolvedUrl.endpoints.deltaStorageUrl);
|
|
24
|
+
deltaStorageUrl.host = discoveredOrdererUrl.host;
|
|
30
25
|
|
|
31
|
-
const discoveredStorageUrl = new
|
|
32
|
-
const storageUrl = new
|
|
33
|
-
storageUrl.
|
|
26
|
+
const discoveredStorageUrl = new URL(session.historianUrl);
|
|
27
|
+
const storageUrl = new URL(resolvedUrl.endpoints.storageUrl);
|
|
28
|
+
storageUrl.host = discoveredStorageUrl.host;
|
|
34
29
|
|
|
35
|
-
const parsedUrl =
|
|
30
|
+
const parsedUrl = new URL(resolvedUrl.url);
|
|
36
31
|
const discoveredResolvedUrl: IResolvedUrl = {
|
|
37
32
|
endpoints: {
|
|
38
33
|
deltaStorageUrl: deltaStorageUrl.toString(),
|
|
@@ -43,7 +38,7 @@ export const getDiscoveredFluidResolvedUrl = (
|
|
|
43
38
|
id: resolvedUrl.id,
|
|
44
39
|
tokens: resolvedUrl.tokens,
|
|
45
40
|
type: resolvedUrl.type,
|
|
46
|
-
url: new
|
|
41
|
+
url: new URL(`https://${discoveredOrdererUrl.host}${parsedUrl.pathname}`).toString(),
|
|
47
42
|
};
|
|
48
43
|
return discoveredResolvedUrl;
|
|
49
44
|
};
|
|
@@ -44,8 +44,6 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
|
|
|
44
44
|
private readonly mc: MonitoringContext;
|
|
45
45
|
private firstVersionsCall: boolean = true;
|
|
46
46
|
|
|
47
|
-
public readonly repositoryUrl = "";
|
|
48
|
-
|
|
49
47
|
private async getSummaryUploadManager(): Promise<ISummaryUploadManager> {
|
|
50
48
|
const manager = await this.getStorageManager();
|
|
51
49
|
return new WholeSummaryUploadManager(manager);
|