@fluidframework/routerlicious-driver 2.0.0-dev-rc.5.0.0.265721 → 2.0.0-dev-rc.5.0.0.268409

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.
Files changed (148) hide show
  1. package/api-report/routerlicious-driver.alpha.api.md +36 -0
  2. package/api-report/routerlicious-driver.beta.api.md +30 -0
  3. package/api-report/routerlicious-driver.public.api.md +30 -0
  4. package/dist/contracts.d.ts +1 -1
  5. package/dist/contracts.d.ts.map +1 -1
  6. package/dist/contracts.js.map +1 -1
  7. package/dist/createNewUtils.d.ts +1 -1
  8. package/dist/createNewUtils.d.ts.map +1 -1
  9. package/dist/createNewUtils.js +4 -4
  10. package/dist/createNewUtils.js.map +1 -1
  11. package/dist/definitions.d.ts +1 -1
  12. package/dist/definitions.d.ts.map +1 -1
  13. package/dist/definitions.js.map +1 -1
  14. package/dist/deltaStorageService.d.ts +1 -1
  15. package/dist/deltaStorageService.d.ts.map +1 -1
  16. package/dist/deltaStorageService.js.map +1 -1
  17. package/dist/documentDeltaConnection.d.ts +1 -1
  18. package/dist/documentDeltaConnection.d.ts.map +1 -1
  19. package/dist/documentDeltaConnection.js.map +1 -1
  20. package/dist/documentService.d.ts +8 -8
  21. package/dist/documentService.d.ts.map +1 -1
  22. package/dist/documentService.js.map +1 -1
  23. package/dist/documentServiceFactory.d.ts +1 -1
  24. package/dist/documentServiceFactory.d.ts.map +1 -1
  25. package/dist/documentServiceFactory.js.map +1 -1
  26. package/dist/documentStorageService.d.ts +1 -2
  27. package/dist/documentStorageService.d.ts.map +1 -1
  28. package/dist/documentStorageService.js.map +1 -1
  29. package/dist/gitManager.d.ts +6 -6
  30. package/dist/gitManager.d.ts.map +1 -1
  31. package/dist/gitManager.js.map +1 -1
  32. package/dist/historian.d.ts +6 -6
  33. package/dist/historian.d.ts.map +1 -1
  34. package/dist/historian.js.map +1 -1
  35. package/dist/nullBlobStorageService.d.ts +7 -7
  36. package/dist/nullBlobStorageService.d.ts.map +1 -1
  37. package/dist/nullBlobStorageService.js.map +1 -1
  38. package/dist/packageVersion.d.ts +1 -1
  39. package/dist/packageVersion.js +1 -1
  40. package/dist/packageVersion.js.map +1 -1
  41. package/dist/r11sSnapshotParser.js.map +1 -1
  42. package/dist/retriableGitManager.d.ts +6 -6
  43. package/dist/retriableGitManager.d.ts.map +1 -1
  44. package/dist/retriableGitManager.js.map +1 -1
  45. package/dist/shreddedSummaryDocumentStorageService.d.ts +2 -2
  46. package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
  47. package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
  48. package/dist/storageContracts.d.ts +13 -13
  49. package/dist/storageContracts.d.ts.map +1 -1
  50. package/dist/storageContracts.js.map +1 -1
  51. package/dist/summaryTreeUploadManager.d.ts +2 -1
  52. package/dist/summaryTreeUploadManager.d.ts.map +1 -1
  53. package/dist/summaryTreeUploadManager.js +7 -7
  54. package/dist/summaryTreeUploadManager.js.map +1 -1
  55. package/dist/tokens.d.ts +1 -1
  56. package/dist/tokens.d.ts.map +1 -1
  57. package/dist/tokens.js.map +1 -1
  58. package/dist/treeUtils.d.ts +2 -1
  59. package/dist/treeUtils.d.ts.map +1 -1
  60. package/dist/treeUtils.js +5 -5
  61. package/dist/treeUtils.js.map +1 -1
  62. package/dist/wholeSummaryDocumentStorageService.d.ts +2 -2
  63. package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  64. package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
  65. package/lib/contracts.d.ts +1 -1
  66. package/lib/contracts.d.ts.map +1 -1
  67. package/lib/contracts.js.map +1 -1
  68. package/lib/createNewUtils.d.ts +1 -1
  69. package/lib/createNewUtils.d.ts.map +1 -1
  70. package/lib/createNewUtils.js +1 -1
  71. package/lib/createNewUtils.js.map +1 -1
  72. package/lib/definitions.d.ts +1 -1
  73. package/lib/definitions.d.ts.map +1 -1
  74. package/lib/definitions.js.map +1 -1
  75. package/lib/deltaStorageService.d.ts +1 -1
  76. package/lib/deltaStorageService.d.ts.map +1 -1
  77. package/lib/deltaStorageService.js.map +1 -1
  78. package/lib/documentDeltaConnection.d.ts +1 -1
  79. package/lib/documentDeltaConnection.d.ts.map +1 -1
  80. package/lib/documentDeltaConnection.js.map +1 -1
  81. package/lib/documentService.d.ts +8 -8
  82. package/lib/documentService.d.ts.map +1 -1
  83. package/lib/documentService.js.map +1 -1
  84. package/lib/documentServiceFactory.d.ts +1 -1
  85. package/lib/documentServiceFactory.d.ts.map +1 -1
  86. package/lib/documentServiceFactory.js.map +1 -1
  87. package/lib/documentStorageService.d.ts +1 -2
  88. package/lib/documentStorageService.d.ts.map +1 -1
  89. package/lib/documentStorageService.js.map +1 -1
  90. package/lib/gitManager.d.ts +6 -6
  91. package/lib/gitManager.d.ts.map +1 -1
  92. package/lib/gitManager.js.map +1 -1
  93. package/lib/historian.d.ts +6 -6
  94. package/lib/historian.d.ts.map +1 -1
  95. package/lib/historian.js.map +1 -1
  96. package/lib/nullBlobStorageService.d.ts +7 -7
  97. package/lib/nullBlobStorageService.d.ts.map +1 -1
  98. package/lib/nullBlobStorageService.js.map +1 -1
  99. package/lib/packageVersion.d.ts +1 -1
  100. package/lib/packageVersion.js +1 -1
  101. package/lib/packageVersion.js.map +1 -1
  102. package/lib/r11sSnapshotParser.js.map +1 -1
  103. package/lib/retriableGitManager.d.ts +6 -6
  104. package/lib/retriableGitManager.d.ts.map +1 -1
  105. package/lib/retriableGitManager.js.map +1 -1
  106. package/lib/shreddedSummaryDocumentStorageService.d.ts +2 -2
  107. package/lib/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
  108. package/lib/shreddedSummaryDocumentStorageService.js.map +1 -1
  109. package/lib/storageContracts.d.ts +13 -13
  110. package/lib/storageContracts.d.ts.map +1 -1
  111. package/lib/storageContracts.js.map +1 -1
  112. package/lib/summaryTreeUploadManager.d.ts +2 -1
  113. package/lib/summaryTreeUploadManager.d.ts.map +1 -1
  114. package/lib/summaryTreeUploadManager.js +1 -1
  115. package/lib/summaryTreeUploadManager.js.map +1 -1
  116. package/lib/tokens.d.ts +1 -1
  117. package/lib/tokens.d.ts.map +1 -1
  118. package/lib/tokens.js.map +1 -1
  119. package/lib/treeUtils.d.ts +2 -1
  120. package/lib/treeUtils.d.ts.map +1 -1
  121. package/lib/treeUtils.js +1 -1
  122. package/lib/treeUtils.js.map +1 -1
  123. package/lib/tsdoc-metadata.json +1 -1
  124. package/lib/wholeSummaryDocumentStorageService.d.ts +2 -2
  125. package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  126. package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
  127. package/package.json +13 -15
  128. package/src/contracts.ts +1 -1
  129. package/src/createNewUtils.ts +1 -1
  130. package/src/definitions.ts +1 -1
  131. package/src/deltaStorageService.ts +1 -1
  132. package/src/documentDeltaConnection.ts +2 -1
  133. package/src/documentService.ts +18 -10
  134. package/src/documentServiceFactory.ts +1 -1
  135. package/src/documentStorageService.ts +2 -1
  136. package/src/gitManager.ts +14 -9
  137. package/src/historian.ts +20 -13
  138. package/src/nullBlobStorageService.ts +9 -6
  139. package/src/packageVersion.ts +1 -1
  140. package/src/r11sSnapshotParser.ts +1 -1
  141. package/src/retriableGitManager.ts +12 -6
  142. package/src/shreddedSummaryDocumentStorageService.ts +4 -7
  143. package/src/storageContracts.ts +20 -13
  144. package/src/summaryTreeUploadManager.ts +4 -8
  145. package/src/tokens.ts +1 -1
  146. package/src/treeUtils.ts +2 -6
  147. package/src/wholeSummaryDocumentStorageService.ts +2 -5
  148. package/api-report/routerlicious-driver.api.md +0 -105
@@ -1 +1 @@
1
- {"version":3,"file":"wholeSummaryDocumentStorageService.js","sourceRoot":"","sources":["../src/wholeSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE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nB,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 { Uint8ArrayToString, performance, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { getW3CData, promiseRaceWithWinner } from \"@fluidframework/driver-base/internal\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport {\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ICache, InMemoryCache } from \"./cache.js\";\nimport { INormalizedWholeSnapshot, IWholeFlatSnapshot } from \"./contracts.js\";\nimport { GitManager } from \"./gitManager.js\";\nimport { IRouterliciousDriverPolicies } from \"./policies.js\";\nimport { convertWholeFlatSnapshotToSnapshotTreeAndBlobs } from \"./r11sSnapshotParser.js\";\nimport { IR11sResponse } from \"./restWrapper.js\";\nimport { ISummaryUploadManager } from \"./storageContracts.js\";\nimport {\n\tconvertSnapshotAndBlobsToSummaryTree,\n\tevalBlobsAndTrees,\n\tvalidateBlobsAndTrees,\n} from \"./treeUtils.js\";\nimport { WholeSummaryUploadManager } from \"./wholeSummaryUploadManager.js\";\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\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.js","sourceRoot":"","sources":["../src/wholeSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAUzF,OAAO,EAGN,gBAAgB,EAChB,4BAA4B,GAC5B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAU,aAAa,EAAE,MAAM,YAAY,CAAC;AAInD,OAAO,EAAE,8CAA8C,EAAE,MAAM,yBAAyB,CAAC;AAGzF,OAAO,EACN,oCAAoC,EACpC,iBAAiB,EACjB,qBAAqB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,MAAM,gBAAgB,GAAW,QAAQ,CAAC;AAE1C,MAAM,OAAO,kCAAkC;IAItC,KAAK,CAAC,uBAAuB;QACpC,MAAM,OA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IAC/B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString, performance, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { getW3CData, promiseRaceWithWinner } from \"@fluidframework/driver-base/internal\";\nimport { ISummaryHandle, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ICache, InMemoryCache } from \"./cache.js\";\nimport { INormalizedWholeSnapshot, IWholeFlatSnapshot } from \"./contracts.js\";\nimport { GitManager } from \"./gitManager.js\";\nimport { IRouterliciousDriverPolicies } from \"./policies.js\";\nimport { convertWholeFlatSnapshotToSnapshotTreeAndBlobs } from \"./r11sSnapshotParser.js\";\nimport { IR11sResponse } from \"./restWrapper.js\";\nimport { ISummaryUploadManager } from \"./storageContracts.js\";\nimport {\n\tconvertSnapshotAndBlobsToSummaryTree,\n\tevalBlobsAndTrees,\n\tvalidateBlobsAndTrees,\n} from \"./treeUtils.js\";\nimport { WholeSummaryUploadManager } from \"./wholeSummaryUploadManager.js\";\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\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.5.0.0.265721",
3
+ "version": "2.0.0-dev-rc.5.0.0.268409",
4
4
  "description": "Socket.IO + Git implementation of Fluid service API",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -77,17 +77,15 @@
77
77
  "temp-directory": "nyc/.nyc_output"
78
78
  },
79
79
  "dependencies": {
80
- "@fluid-internal/client-utils": "2.0.0-dev-rc.5.0.0.265721",
81
- "@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.265721",
82
- "@fluidframework/core-utils": "2.0.0-dev-rc.5.0.0.265721",
83
- "@fluidframework/driver-base": "2.0.0-dev-rc.5.0.0.265721",
84
- "@fluidframework/driver-definitions": "2.0.0-dev-rc.5.0.0.265721",
85
- "@fluidframework/driver-utils": "2.0.0-dev-rc.5.0.0.265721",
86
- "@fluidframework/gitresources": "^4.0.0",
80
+ "@fluid-internal/client-utils": "2.0.0-dev-rc.5.0.0.268409",
81
+ "@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.268409",
82
+ "@fluidframework/core-utils": "2.0.0-dev-rc.5.0.0.268409",
83
+ "@fluidframework/driver-base": "2.0.0-dev-rc.5.0.0.268409",
84
+ "@fluidframework/driver-definitions": "2.0.0-dev-rc.5.0.0.268409",
85
+ "@fluidframework/driver-utils": "2.0.0-dev-rc.5.0.0.268409",
87
86
  "@fluidframework/protocol-base": "^4.0.0",
88
- "@fluidframework/protocol-definitions": "^3.2.0",
89
87
  "@fluidframework/server-services-client": "^4.0.0",
90
- "@fluidframework/telemetry-utils": "2.0.0-dev-rc.5.0.0.265721",
88
+ "@fluidframework/telemetry-utils": "2.0.0-dev-rc.5.0.0.268409",
91
89
  "cross-fetch": "^3.1.5",
92
90
  "json-stringify-safe": "5.0.1",
93
91
  "socket.io-client": "^4.7.3",
@@ -95,14 +93,14 @@
95
93
  },
96
94
  "devDependencies": {
97
95
  "@arethetypeswrong/cli": "^0.15.2",
98
- "@biomejs/biome": "^1.6.2",
99
- "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.5.0.0.265721",
96
+ "@biomejs/biome": "^1.7.3",
97
+ "@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.5.0.0.268409",
100
98
  "@fluid-tools/build-cli": "^0.39.0-264124",
101
99
  "@fluidframework/build-common": "^2.0.3",
102
100
  "@fluidframework/build-tools": "^0.39.0-264124",
103
- "@fluidframework/eslint-config-fluid": "^5.1.0",
101
+ "@fluidframework/eslint-config-fluid": "^5.3.0",
104
102
  "@fluidframework/routerlicious-driver-previous": "npm:@fluidframework/routerlicious-driver@2.0.0-rc.4.0.0",
105
- "@microsoft/api-extractor": "^7.43.1",
103
+ "@microsoft/api-extractor": "^7.45.1",
106
104
  "@types/mocha": "^9.1.1",
107
105
  "@types/nock": "^9.3.0",
108
106
  "@types/node": "^18.19.0",
@@ -121,7 +119,7 @@
121
119
  "prettier": "~3.0.3",
122
120
  "rimraf": "^4.4.0",
123
121
  "sinon": "^17.0.1",
124
- "typescript": "~5.3.3"
122
+ "typescript": "~5.4.5"
125
123
  },
126
124
  "typeValidation": {
127
125
  "broken": {}
package/src/contracts.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ISnapshotTree } from "@fluidframework/protocol-definitions";
6
+ import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
7
7
 
8
8
  /*
9
9
  *
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { Uint8ArrayToString } from "@fluid-internal/client-utils";
7
- import { ISummaryTree, SummaryType } from "@fluidframework/protocol-definitions";
7
+ import { ISummaryTree, SummaryType } from "@fluidframework/driver-definitions";
8
8
 
9
9
  /**
10
10
  * Utility api to convert ISummaryTree to a summary tree where blob contents are only utf8 strings.
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ISnapshotTree } from "@fluidframework/protocol-definitions";
6
+ import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
7
7
 
8
8
  export interface ISnapshotTreeVersion {
9
9
  id: string;
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
7
7
  import { getW3CData, validateMessages } from "@fluidframework/driver-base/internal";
8
+ import { ISequencedDocumentMessage } from "@fluidframework/driver-definitions";
8
9
  import {
9
10
  IDeltaStorageService,
10
11
  IDeltasFetchResult,
@@ -17,7 +18,6 @@ import {
17
18
  requestOps,
18
19
  streamObserver,
19
20
  } from "@fluidframework/driver-utils/internal";
20
- import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
21
21
  import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils/internal";
22
22
 
23
23
  import { DocumentStorageService } from "./documentStorageService.js";
@@ -4,11 +4,12 @@
4
4
  */
5
5
 
6
6
  import { DocumentDeltaConnection } from "@fluidframework/driver-base/internal";
7
+ import { IClient } from "@fluidframework/driver-definitions";
7
8
  import {
8
9
  IDocumentDeltaConnection,
9
10
  IAnyDriverError,
11
+ IConnect,
10
12
  } from "@fluidframework/driver-definitions/internal";
11
- import { IClient, IConnect } from "@fluidframework/protocol-definitions";
12
13
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
13
14
  import type { io as SocketIOClientStatic } from "socket.io-client";
14
15
 
@@ -5,13 +5,21 @@
5
5
 
6
6
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
7
7
  import { assert } from "@fluidframework/core-utils/internal";
8
- import * as api from "@fluidframework/driver-definitions/internal";
8
+ import { IClient } from "@fluidframework/driver-definitions";
9
+ import {
10
+ IDocumentServiceEvents,
11
+ IDocumentDeltaConnection,
12
+ IDocumentDeltaStorageService,
13
+ IDocumentService,
14
+ IDocumentStorageService,
15
+ IDocumentStorageServicePolicies,
16
+ IResolvedUrl,
17
+ } from "@fluidframework/driver-definitions/internal";
9
18
  import {
10
19
  NetworkErrorBasic,
11
20
  RateLimiter,
12
21
  canRetryOnError,
13
22
  } from "@fluidframework/driver-utils/internal";
14
- import { IClient } from "@fluidframework/protocol-definitions";
15
23
  import {
16
24
  ITelemetryLoggerExt,
17
25
  PerformanceEvent,
@@ -52,9 +60,9 @@ const RediscoverAfterTimeSinceDiscoveryMs = 5 * 60000; // 5 minute
52
60
  * clients.
53
61
  */
54
62
  export class DocumentService
55
- extends TypedEventEmitter<api.IDocumentServiceEvents>
63
+ extends TypedEventEmitter<IDocumentServiceEvents>
56
64
  // eslint-disable-next-line import/namespace
57
- implements api.IDocumentService
65
+ implements IDocumentService
58
66
  {
59
67
  private lastDiscoveredAt: number = Date.now();
60
68
  private discoverP: Promise<void> | undefined;
@@ -67,7 +75,7 @@ export class DocumentService
67
75
  }
68
76
 
69
77
  constructor(
70
- private _resolvedUrl: api.IResolvedUrl,
78
+ private _resolvedUrl: IResolvedUrl,
71
79
  protected ordererUrl: string,
72
80
  private deltaStorageUrl: string,
73
81
  private deltaStreamUrl: string,
@@ -77,12 +85,12 @@ export class DocumentService
77
85
  protected tenantId: string,
78
86
  protected documentId: string,
79
87
  protected ordererRestWrapper: RouterliciousOrdererRestWrapper,
80
- private readonly documentStorageServicePolicies: api.IDocumentStorageServicePolicies,
88
+ private readonly documentStorageServicePolicies: IDocumentStorageServicePolicies,
81
89
  private readonly driverPolicies: IRouterliciousDriverPolicies,
82
90
  private readonly blobCache: ICache<ArrayBufferLike>,
83
91
  private readonly wholeSnapshotTreeCache: ICache<INormalizedWholeSnapshot>,
84
92
  private readonly shreddedSummaryTreeCache: ICache<ISnapshotTreeVersion>,
85
- private readonly discoverFluidResolvedUrl: () => Promise<api.IResolvedUrl>,
93
+ private readonly discoverFluidResolvedUrl: () => Promise<IResolvedUrl>,
86
94
  private storageRestWrapper: RouterliciousStorageRestWrapper,
87
95
  private readonly storageTokenFetcher: TokenFetcher,
88
96
  private readonly ordererTokenFetcher: TokenFetcher,
@@ -99,7 +107,7 @@ export class DocumentService
99
107
  *
100
108
  * @returns returns the document storage service for routerlicious driver.
101
109
  */
102
- public async connectToStorage(): Promise<api.IDocumentStorageService> {
110
+ public async connectToStorage(): Promise<IDocumentStorageService> {
103
111
  if (this.documentStorageService !== undefined) {
104
112
  return this.documentStorageService;
105
113
  }
@@ -162,7 +170,7 @@ export class DocumentService
162
170
  *
163
171
  * @returns returns the document delta storage service for routerlicious driver.
164
172
  */
165
- public async connectToDeltaStorage(): Promise<api.IDocumentDeltaStorageService> {
173
+ public async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {
166
174
  await this.connectToStorage();
167
175
  assert(!!this.documentStorageService, 0x0b1 /* "Storage service not initialized" */);
168
176
 
@@ -205,7 +213,7 @@ export class DocumentService
205
213
  *
206
214
  * @returns returns the document delta stream service for routerlicious driver.
207
215
  */
208
- public async connectToDeltaStream(client: IClient): Promise<api.IDocumentDeltaConnection> {
216
+ public async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {
209
217
  const connect = async (refreshToken?: boolean) => {
210
218
  let ordererToken = await this.ordererRestWrapper.getToken();
211
219
  if (this.shouldUpdateDiscoveredSessionInfo()) {
@@ -6,6 +6,7 @@
6
6
  import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
7
  import { assert } from "@fluidframework/core-utils/internal";
8
8
  import { getW3CData } from "@fluidframework/driver-base/internal";
9
+ import { ISummaryTree } from "@fluidframework/driver-definitions";
9
10
  import {
10
11
  FiveDaysMs,
11
12
  IDocumentService,
@@ -20,7 +21,6 @@ import {
20
21
  getQuorumValuesFromProtocolSummary,
21
22
  isCombinedAppAndProtocolSummary,
22
23
  } from "@fluidframework/driver-utils/internal";
23
- import { ISummaryTree } from "@fluidframework/protocol-definitions";
24
24
  import {
25
25
  ISession,
26
26
  convertSummaryTreeToWholeSummaryTree,
@@ -7,12 +7,13 @@ import {
7
7
  IDocumentStorageService,
8
8
  IDocumentStorageServicePolicies,
9
9
  LoaderCachingPolicy,
10
+ ISnapshotTree,
11
+ IVersion,
10
12
  } from "@fluidframework/driver-definitions/internal";
11
13
  import {
12
14
  DocumentStorageServiceProxy,
13
15
  PrefetchDocumentStorageService,
14
16
  } from "@fluidframework/driver-utils/internal";
15
- import { ISnapshotTree, IVersion } from "@fluidframework/protocol-definitions";
16
17
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
17
18
 
18
19
  import { ICache } from "./cache.js";
package/src/gitManager.ts CHANGED
@@ -3,7 +3,14 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import * as resources from "@fluidframework/gitresources";
6
+ import type {
7
+ IGitBlob,
8
+ IGitCommitDetails,
9
+ IGitCreateBlobParams,
10
+ IGitCreateBlobResponse,
11
+ IGitCreateTreeParams,
12
+ IGitTree,
13
+ } from "@fluidframework/driver-definitions/internal";
7
14
  import {
8
15
  IWholeSummaryPayload,
9
16
  IWriteSummaryResponse,
@@ -22,35 +29,33 @@ export class GitManager implements IGitManager {
22
29
  public async getCommits(
23
30
  sha: string,
24
31
  count: number,
25
- ): Promise<IR11sResponse<resources.ICommitDetails[]>> {
32
+ ): Promise<IR11sResponse<IGitCommitDetails[]>> {
26
33
  return this.historian.getCommits(sha, count);
27
34
  }
28
35
 
29
36
  /**
30
37
  * Reads the object with the given ID. We defer to the client implementation to do the actual read.
31
38
  */
32
- public async getTree(root: string, recursive = true): Promise<IR11sResponse<resources.ITree>> {
39
+ public async getTree(root: string, recursive = true): Promise<IR11sResponse<IGitTree>> {
33
40
  return this.historian.getTree(root, recursive);
34
41
  }
35
42
 
36
- public async getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>> {
43
+ public async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {
37
44
  return this.historian.getBlob(sha);
38
45
  }
39
46
 
40
47
  public async createBlob(
41
48
  content: string,
42
49
  encoding: "utf-8" | "base64",
43
- ): Promise<IR11sResponse<resources.ICreateBlobResponse>> {
44
- const blob: resources.ICreateBlobParams = {
50
+ ): Promise<IR11sResponse<IGitCreateBlobResponse>> {
51
+ const blob: IGitCreateBlobParams = {
45
52
  content,
46
53
  encoding,
47
54
  };
48
55
  return this.historian.createBlob(blob);
49
56
  }
50
57
 
51
- public async createGitTree(
52
- params: resources.ICreateTreeParams,
53
- ): Promise<IR11sResponse<resources.ITree>> {
58
+ public async createGitTree(params: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {
54
59
  const treeP = this.historian.createTree(params);
55
60
  return treeP;
56
61
  }
package/src/historian.ts CHANGED
@@ -4,7 +4,14 @@
4
4
  */
5
5
 
6
6
  import { fromUtf8ToBase64 } from "@fluid-internal/client-utils";
7
- import * as git from "@fluidframework/gitresources";
7
+ import type {
8
+ IGitBlob,
9
+ IGitCommitDetails,
10
+ IGitCreateBlobParams,
11
+ IGitCreateBlobResponse,
12
+ IGitCreateTreeParams,
13
+ IGitTree,
14
+ } from "@fluidframework/driver-definitions/internal";
8
15
  import {
9
16
  IWholeSummaryPayload,
10
17
  IWriteSummaryResponse,
@@ -43,17 +50,17 @@ export class Historian implements IHistorian {
43
50
  }
44
51
  }
45
52
 
46
- public async getBlob(sha: string): Promise<IR11sResponse<git.IBlob>> {
47
- return this.restWrapper.get<git.IBlob>(
53
+ public async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {
54
+ return this.restWrapper.get<IGitBlob>(
48
55
  `/git/blobs/${encodeURIComponent(sha)}`,
49
56
  this.getQueryString(),
50
57
  );
51
58
  }
52
59
 
53
60
  public async createBlob(
54
- blob: git.ICreateBlobParams,
55
- ): Promise<IR11sResponse<git.ICreateBlobResponse>> {
56
- return this.restWrapper.post<git.ICreateBlobResponse>(
61
+ blob: IGitCreateBlobParams,
62
+ ): Promise<IR11sResponse<IGitCreateBlobResponse>> {
63
+ return this.restWrapper.post<IGitCreateBlobResponse>(
57
64
  `/git/blobs`,
58
65
  blob,
59
66
  this.getQueryString(),
@@ -63,9 +70,9 @@ export class Historian implements IHistorian {
63
70
  public async getCommits(
64
71
  sha: string,
65
72
  count: number,
66
- ): Promise<IR11sResponse<git.ICommitDetails[]>> {
73
+ ): Promise<IR11sResponse<IGitCommitDetails[]>> {
67
74
  return this.restWrapper
68
- .get<git.ICommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))
75
+ .get<IGitCommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))
69
76
  .catch(async (error) =>
70
77
  error.statusCode === 400 || error.statusCode === 404
71
78
  ? {
@@ -74,16 +81,16 @@ export class Historian implements IHistorian {
74
81
  propsToLog: {},
75
82
  requestUrl: "",
76
83
  }
77
- : Promise.reject<IR11sResponse<git.ICommitDetails[]>>(error),
84
+ : Promise.reject<IR11sResponse<IGitCommitDetails[]>>(error),
78
85
  );
79
86
  }
80
87
 
81
- public async createTree(tree: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>> {
82
- return this.restWrapper.post<git.ITree>(`/git/trees`, tree, this.getQueryString());
88
+ public async createTree(tree: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {
89
+ return this.restWrapper.post<IGitTree>(`/git/trees`, tree, this.getQueryString());
83
90
  }
84
91
 
85
- public async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<git.ITree>> {
86
- return this.restWrapper.get<git.ITree>(
92
+ public async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<IGitTree>> {
93
+ return this.restWrapper.get<IGitTree>(
87
94
  `/git/trees/${encodeURIComponent(sha)}`,
88
95
  this.getQueryString({ recursive: recursive ? 1 : 0 }),
89
96
  );
@@ -3,37 +3,40 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { ISummaryTree, ISummaryHandle } from "@fluidframework/driver-definitions";
6
7
  import {
7
8
  IDocumentStorageService,
8
9
  ISummaryContext,
10
+ IVersion,
11
+ ISnapshotTree,
12
+ ICreateBlobResponse,
9
13
  } from "@fluidframework/driver-definitions/internal";
10
- import * as api from "@fluidframework/protocol-definitions";
11
14
 
12
15
  /**
13
16
  * Document access to underlying storage. It is default implementation of a storage service.
14
17
  * Does not read/write anything.
15
18
  */
16
19
  export class NullBlobStorageService implements IDocumentStorageService {
17
- public async getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null> {
20
+ public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {
18
21
  return version ? Promise.reject(new Error("Invalid operation")) : null;
19
22
  }
20
23
 
21
- public async getVersions(versionId: string | null, count: number): Promise<api.IVersion[]> {
24
+ public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {
22
25
  return [];
23
26
  }
24
27
 
25
28
  public async uploadSummaryWithContext(
26
- summary: api.ISummaryTree,
29
+ summary: ISummaryTree,
27
30
  context: ISummaryContext,
28
31
  ): Promise<string> {
29
32
  throw new Error("Invalid operation");
30
33
  }
31
34
 
32
- public async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {
35
+ public async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {
33
36
  throw new Error("Invalid operation");
34
37
  }
35
38
 
36
- public async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {
39
+ public async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {
37
40
  throw new Error("Null blob storage can not create blob");
38
41
  }
39
42
  public async readBlob(blobId: string): Promise<ArrayBufferLike> {
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/routerlicious-driver";
9
- export const pkgVersion = "2.0.0-dev-rc.5.0.0.265721";
9
+ export const pkgVersion = "2.0.0-dev-rc.5.0.0.268409";
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { stringToBuffer } from "@fluid-internal/client-utils";
7
- import { ISnapshotTree } from "@fluidframework/protocol-definitions";
7
+ import { ISnapshotTree } from "@fluidframework/driver-definitions/internal";
8
8
 
9
9
  import {
10
10
  INormalizedWholeSnapshot,
@@ -3,8 +3,14 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import type {
7
+ IGitCommitDetails,
8
+ IGitBlob,
9
+ IGitCreateBlobResponse,
10
+ IGitCreateTreeParams,
11
+ IGitTree,
12
+ } from "@fluidframework/driver-definitions/internal";
6
13
  import { runWithRetry } from "@fluidframework/driver-utils/internal";
7
- import type * as git from "@fluidframework/gitresources";
8
14
  import {
9
15
  IWholeSummaryPayload,
10
16
  IWriteSummaryResponse,
@@ -24,21 +30,21 @@ export class RetriableGitManager implements IGitManager {
24
30
  public async getCommits(
25
31
  sha: string,
26
32
  count: number,
27
- ): Promise<IR11sResponse<git.ICommitDetails[]>> {
33
+ ): Promise<IR11sResponse<IGitCommitDetails[]>> {
28
34
  return this.runWithRetry(
29
35
  async () => this.internalGitManager.getCommits(sha, count),
30
36
  "gitManager_getCommits",
31
37
  );
32
38
  }
33
39
 
34
- public async getTree(root: string, recursive: boolean): Promise<IR11sResponse<git.ITree>> {
40
+ public async getTree(root: string, recursive: boolean): Promise<IR11sResponse<IGitTree>> {
35
41
  return this.runWithRetry(
36
42
  async () => this.internalGitManager.getTree(root, recursive),
37
43
  "gitManager_getTree",
38
44
  );
39
45
  }
40
46
 
41
- public async getBlob(sha: string): Promise<IR11sResponse<git.IBlob>> {
47
+ public async getBlob(sha: string): Promise<IR11sResponse<IGitBlob>> {
42
48
  return this.runWithRetry(
43
49
  async () => this.internalGitManager.getBlob(sha),
44
50
  "gitManager_getBlob",
@@ -48,14 +54,14 @@ export class RetriableGitManager implements IGitManager {
48
54
  public async createBlob(
49
55
  content: string,
50
56
  encoding: string,
51
- ): Promise<IR11sResponse<git.ICreateBlobResponse>> {
57
+ ): Promise<IR11sResponse<IGitCreateBlobResponse>> {
52
58
  return this.runWithRetry(
53
59
  async () => this.internalGitManager.createBlob(content, encoding),
54
60
  "gitManager_createBlob",
55
61
  );
56
62
  }
57
63
 
58
- public async createGitTree(params: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>> {
64
+ public async createGitTree(params: IGitCreateTreeParams): Promise<IR11sResponse<IGitTree>> {
59
65
  return this.runWithRetry(
60
66
  async () => this.internalGitManager.createGitTree(params),
61
67
  "gitManager_createGitTree",
@@ -4,19 +4,16 @@
4
4
  */
5
5
 
6
6
  import { Uint8ArrayToString, stringToBuffer } from "@fluid-internal/client-utils";
7
+ import { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
7
8
  import {
8
9
  IDocumentStorageService,
9
10
  IDocumentStorageServicePolicies,
10
11
  ISummaryContext,
11
- } from "@fluidframework/driver-definitions/internal";
12
- import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
13
- import {
14
12
  ICreateBlobResponse,
15
13
  ISnapshotTreeEx,
16
- ISummaryHandle,
17
- ISummaryTree,
18
14
  IVersion,
19
- } from "@fluidframework/protocol-definitions";
15
+ } from "@fluidframework/driver-definitions/internal";
16
+ import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
20
17
  import {
21
18
  ITelemetryLoggerExt,
22
19
  MonitoringContext,
@@ -125,7 +122,7 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
125
122
  },
126
123
  async (event) => {
127
124
  const manager = await this.getStorageManager();
128
- const response = (await manager.getTree(requestVersion!.treeId)).content;
125
+ const response = (await manager.getTree(requestVersion.treeId)).content;
129
126
  event.end({
130
127
  size: response.tree.length,
131
128
  });