@fluidframework/odsp-driver 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.224419

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 (661) hide show
  1. package/.eslintrc.js +12 -12
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +162 -0
  4. package/README.md +56 -0
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/odsp-driver.api.md +310 -0
  8. package/dist/{ReadBufferUtils.js → ReadBufferUtils.cjs} +16 -9
  9. package/dist/ReadBufferUtils.cjs.map +1 -0
  10. package/dist/ReadBufferUtils.d.ts.map +1 -1
  11. package/dist/{WriteBufferUtils.js → WriteBufferUtils.cjs} +73 -69
  12. package/dist/WriteBufferUtils.cjs.map +1 -0
  13. package/dist/WriteBufferUtils.d.ts +3 -5
  14. package/dist/WriteBufferUtils.d.ts.map +1 -1
  15. package/dist/{checkUrl.js → checkUrl.cjs} +7 -6
  16. package/dist/checkUrl.cjs.map +1 -0
  17. package/dist/checkUrl.d.ts +1 -0
  18. package/dist/checkUrl.d.ts.map +1 -1
  19. package/dist/compactSnapshotParser.cjs +207 -0
  20. package/dist/compactSnapshotParser.cjs.map +1 -0
  21. package/dist/compactSnapshotParser.d.ts +12 -3
  22. package/dist/compactSnapshotParser.d.ts.map +1 -1
  23. package/dist/{compactSnapshotWriter.js → compactSnapshotWriter.cjs} +43 -33
  24. package/dist/compactSnapshotWriter.cjs.map +1 -0
  25. package/dist/compactSnapshotWriter.d.ts +2 -3
  26. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  27. package/dist/{constants.js → constants.cjs} +7 -1
  28. package/dist/constants.cjs.map +1 -0
  29. package/dist/constants.d.ts +6 -0
  30. package/dist/constants.d.ts.map +1 -1
  31. package/dist/{contracts.js → contracts.cjs} +1 -1
  32. package/dist/contracts.cjs.map +1 -0
  33. package/dist/contracts.d.ts +16 -53
  34. package/dist/contracts.d.ts.map +1 -1
  35. package/dist/{contractsPublic.js → contractsPublic.cjs} +9 -3
  36. package/dist/contractsPublic.cjs.map +1 -0
  37. package/dist/contractsPublic.d.ts +15 -0
  38. package/dist/contractsPublic.d.ts.map +1 -1
  39. package/dist/createFile.cjs +177 -0
  40. package/dist/createFile.cjs.map +1 -0
  41. package/dist/createFile.d.ts +6 -10
  42. package/dist/createFile.d.ts.map +1 -1
  43. package/dist/createNewContainerOnExistingFile.cjs +60 -0
  44. package/dist/createNewContainerOnExistingFile.cjs.map +1 -0
  45. package/dist/createNewContainerOnExistingFile.d.ts +22 -0
  46. package/dist/createNewContainerOnExistingFile.d.ts.map +1 -0
  47. package/dist/createNewModule.cjs +12 -0
  48. package/dist/createNewModule.cjs.map +1 -0
  49. package/dist/createNewModule.d.ts +7 -0
  50. package/dist/createNewModule.d.ts.map +1 -0
  51. package/dist/createNewUtils.cjs +203 -0
  52. package/dist/createNewUtils.cjs.map +1 -0
  53. package/dist/createNewUtils.d.ts +16 -0
  54. package/dist/createNewUtils.d.ts.map +1 -1
  55. package/dist/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.cjs} +8 -4
  56. package/dist/createOdspCreateContainerRequest.cjs.map +1 -0
  57. package/dist/createOdspCreateContainerRequest.d.ts +5 -3
  58. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  59. package/dist/{createOdspUrl.js → createOdspUrl.cjs} +2 -1
  60. package/dist/createOdspUrl.cjs.map +1 -0
  61. package/dist/createOdspUrl.d.ts +1 -0
  62. package/dist/createOdspUrl.d.ts.map +1 -1
  63. package/dist/{epochTracker.js → epochTracker.cjs} +102 -48
  64. package/dist/epochTracker.cjs.map +1 -0
  65. package/dist/epochTracker.d.ts +32 -8
  66. package/dist/epochTracker.d.ts.map +1 -1
  67. package/dist/{fetch.js → fetch.cjs} +1 -1
  68. package/dist/fetch.cjs.map +1 -0
  69. package/dist/fetch.d.ts +1 -1
  70. package/dist/fetch.d.ts.map +1 -1
  71. package/dist/{fetchSnapshot.js → fetchSnapshot.cjs} +192 -176
  72. package/dist/fetchSnapshot.cjs.map +1 -0
  73. package/dist/fetchSnapshot.d.ts +10 -5
  74. package/dist/fetchSnapshot.d.ts.map +1 -1
  75. package/dist/{getFileLink.js → getFileLink.cjs} +52 -41
  76. package/dist/getFileLink.cjs.map +1 -0
  77. package/dist/getFileLink.d.ts +4 -7
  78. package/dist/getFileLink.d.ts.map +1 -1
  79. package/dist/{getQueryString.js → getQueryString.cjs} +1 -1
  80. package/dist/getQueryString.cjs.map +1 -0
  81. package/dist/getQueryString.d.ts.map +1 -1
  82. package/dist/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.cjs} +4 -2
  83. package/dist/getUrlAndHeadersWithAuth.cjs.map +1 -0
  84. package/dist/getUrlAndHeadersWithAuth.d.ts.map +1 -1
  85. package/dist/index.cjs +59 -0
  86. package/dist/index.cjs.map +1 -0
  87. package/dist/index.d.ts +19 -16
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs +35 -0
  90. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +1 -0
  91. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +17 -0
  92. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
  93. package/dist/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.cjs} +7 -5
  94. package/dist/localOdspDriver/localOdspDocumentService.cjs.map +1 -0
  95. package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
  96. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  97. package/dist/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.cjs} +9 -10
  98. package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +1 -0
  99. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +2 -3
  100. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  101. package/dist/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.cjs} +13 -11
  102. package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +1 -0
  103. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -2
  104. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  105. package/dist/odsp-driver-alpha.d.ts +497 -0
  106. package/dist/odsp-driver-beta.d.ts +159 -0
  107. package/dist/odsp-driver-public.d.ts +159 -0
  108. package/dist/odsp-driver-untrimmed.d.ts +566 -0
  109. package/dist/{odspCache.js → odspCache.cjs} +9 -10
  110. package/dist/odspCache.cjs.map +1 -0
  111. package/dist/odspCache.d.ts +19 -4
  112. package/dist/odspCache.d.ts.map +1 -1
  113. package/dist/odspDelayLoadedDeltaStream.cjs +291 -0
  114. package/dist/odspDelayLoadedDeltaStream.cjs.map +1 -0
  115. package/dist/odspDelayLoadedDeltaStream.d.ts +75 -0
  116. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -0
  117. package/dist/{odspDeltaStorageService.js → odspDeltaStorageService.cjs} +70 -71
  118. package/dist/odspDeltaStorageService.cjs.map +1 -0
  119. package/dist/odspDeltaStorageService.d.ts +8 -6
  120. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  121. package/dist/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.cjs} +224 -113
  122. package/dist/odspDocumentDeltaConnection.cjs.map +1 -0
  123. package/dist/odspDocumentDeltaConnection.d.ts +32 -12
  124. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  125. package/dist/odspDocumentService.cjs +225 -0
  126. package/dist/odspDocumentService.cjs.map +1 -0
  127. package/dist/odspDocumentService.d.ts +11 -25
  128. package/dist/odspDocumentService.d.ts.map +1 -1
  129. package/dist/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.cjs} +8 -5
  130. package/dist/odspDocumentServiceFactory.cjs.map +1 -0
  131. package/dist/odspDocumentServiceFactory.d.ts +4 -0
  132. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  133. package/dist/odspDocumentServiceFactoryCore.cjs +196 -0
  134. package/dist/odspDocumentServiceFactoryCore.cjs.map +1 -0
  135. package/dist/odspDocumentServiceFactoryCore.d.ts +16 -11
  136. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  137. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs +20 -0
  138. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +1 -0
  139. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +5 -0
  140. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
  141. package/dist/odspDocumentStorageManager.cjs +490 -0
  142. package/dist/odspDocumentStorageManager.cjs.map +1 -0
  143. package/dist/odspDocumentStorageManager.d.ts +11 -5
  144. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  145. package/dist/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.cjs} +32 -34
  146. package/dist/odspDocumentStorageServiceBase.cjs.map +1 -0
  147. package/dist/odspDocumentStorageServiceBase.d.ts +7 -9
  148. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  149. package/dist/{odspDriverUrlResolver.js → odspDriverUrlResolver.cjs} +50 -36
  150. package/dist/odspDriverUrlResolver.cjs.map +1 -0
  151. package/dist/odspDriverUrlResolver.d.ts +12 -0
  152. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  153. package/dist/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.cjs} +37 -26
  154. package/dist/odspDriverUrlResolverForShareLink.cjs.map +1 -0
  155. package/dist/odspDriverUrlResolverForShareLink.d.ts +5 -3
  156. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  157. package/dist/{odspError.js → odspError.cjs} +7 -3
  158. package/dist/odspError.cjs.map +1 -0
  159. package/dist/odspError.d.ts.map +1 -1
  160. package/dist/{odspFluidFileLink.js → odspFluidFileLink.cjs} +25 -18
  161. package/dist/odspFluidFileLink.cjs.map +1 -0
  162. package/dist/odspFluidFileLink.d.ts +10 -1
  163. package/dist/odspFluidFileLink.d.ts.map +1 -1
  164. package/dist/odspLocationRedirection.cjs +24 -0
  165. package/dist/odspLocationRedirection.cjs.map +1 -0
  166. package/dist/odspLocationRedirection.d.ts +14 -0
  167. package/dist/odspLocationRedirection.d.ts.map +1 -0
  168. package/dist/{odspPublicUtils.js → odspPublicUtils.cjs} +7 -4
  169. package/dist/odspPublicUtils.cjs.map +1 -0
  170. package/dist/odspPublicUtils.d.ts +6 -0
  171. package/dist/odspPublicUtils.d.ts.map +1 -1
  172. package/dist/{odspSnapshotParser.js → odspSnapshotParser.cjs} +11 -12
  173. package/dist/odspSnapshotParser.cjs.map +1 -0
  174. package/dist/odspSnapshotParser.d.ts.map +1 -1
  175. package/dist/{odspSummaryUploadManager.js → odspSummaryUploadManager.cjs} +47 -34
  176. package/dist/odspSummaryUploadManager.cjs.map +1 -0
  177. package/dist/odspSummaryUploadManager.d.ts +7 -4
  178. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  179. package/dist/{odspUrlHelper.js → odspUrlHelper.cjs} +9 -3
  180. package/dist/odspUrlHelper.cjs.map +1 -0
  181. package/dist/odspUrlHelper.d.ts +5 -0
  182. package/dist/odspUrlHelper.d.ts.map +1 -1
  183. package/dist/{odspUtils.js → odspUtils.cjs} +118 -30
  184. package/dist/odspUtils.cjs.map +1 -0
  185. package/dist/odspUtils.d.ts +35 -6
  186. package/dist/odspUtils.d.ts.map +1 -1
  187. package/dist/{opsCaching.js → opsCaching.cjs} +25 -9
  188. package/dist/opsCaching.cjs.map +1 -0
  189. package/dist/opsCaching.d.ts +3 -3
  190. package/dist/opsCaching.d.ts.map +1 -1
  191. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  192. package/dist/packageVersion.cjs.map +1 -0
  193. package/dist/packageVersion.d.ts +1 -1
  194. package/dist/packageVersion.d.ts.map +1 -1
  195. package/dist/prefetchLatestSnapshot.cjs +100 -0
  196. package/dist/prefetchLatestSnapshot.cjs.map +1 -0
  197. package/dist/prefetchLatestSnapshot.d.ts +12 -7
  198. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  199. package/dist/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.cjs} +13 -6
  200. package/dist/retryErrorsStorageAdapter.cjs.map +1 -0
  201. package/dist/retryErrorsStorageAdapter.d.ts +5 -4
  202. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  203. package/dist/{retryUtils.js → retryUtils.cjs} +30 -14
  204. package/dist/retryUtils.cjs.map +1 -0
  205. package/dist/retryUtils.d.ts +2 -2
  206. package/dist/retryUtils.d.ts.map +1 -1
  207. package/dist/socketModule.cjs +10 -0
  208. package/dist/socketModule.cjs.map +1 -0
  209. package/dist/socketModule.d.ts +7 -0
  210. package/dist/socketModule.d.ts.map +1 -0
  211. package/dist/tsdoc-metadata.json +11 -0
  212. package/dist/{vroom.js → vroom.cjs} +24 -9
  213. package/dist/vroom.cjs.map +1 -0
  214. package/dist/vroom.d.ts +4 -4
  215. package/dist/vroom.d.ts.map +1 -1
  216. package/dist/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.cjs} +227 -118
  217. package/dist/zipItDataRepresentationUtils.cjs.map +1 -0
  218. package/dist/zipItDataRepresentationUtils.d.ts +47 -20
  219. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  220. package/lib/ReadBufferUtils.d.mts.map +1 -0
  221. package/lib/{ReadBufferUtils.js → ReadBufferUtils.mjs} +14 -7
  222. package/lib/ReadBufferUtils.mjs.map +1 -0
  223. package/lib/{WriteBufferUtils.d.ts → WriteBufferUtils.d.mts} +3 -5
  224. package/lib/WriteBufferUtils.d.mts.map +1 -0
  225. package/lib/{WriteBufferUtils.js → WriteBufferUtils.mjs} +68 -64
  226. package/lib/WriteBufferUtils.mjs.map +1 -0
  227. package/lib/{checkUrl.d.ts → checkUrl.d.mts} +1 -0
  228. package/lib/checkUrl.d.mts.map +1 -0
  229. package/lib/{checkUrl.js → checkUrl.mjs} +7 -6
  230. package/lib/checkUrl.mjs.map +1 -0
  231. package/lib/compactSnapshotParser.d.mts +24 -0
  232. package/lib/compactSnapshotParser.d.mts.map +1 -0
  233. package/lib/compactSnapshotParser.mjs +203 -0
  234. package/lib/compactSnapshotParser.mjs.map +1 -0
  235. package/lib/{compactSnapshotWriter.d.ts → compactSnapshotWriter.d.mts} +3 -4
  236. package/lib/compactSnapshotWriter.d.mts.map +1 -0
  237. package/lib/{compactSnapshotWriter.js → compactSnapshotWriter.mjs} +41 -31
  238. package/lib/compactSnapshotWriter.mjs.map +1 -0
  239. package/lib/{constants.d.ts → constants.d.mts} +6 -0
  240. package/lib/constants.d.mts.map +1 -0
  241. package/lib/{constants.js → constants.mjs} +7 -1
  242. package/lib/constants.mjs.map +1 -0
  243. package/lib/{contracts.d.ts → contracts.d.mts} +17 -54
  244. package/lib/contracts.d.mts.map +1 -0
  245. package/lib/{contracts.js → contracts.mjs} +1 -1
  246. package/lib/contracts.mjs.map +1 -0
  247. package/lib/{contractsPublic.d.ts → contractsPublic.d.mts} +15 -0
  248. package/lib/contractsPublic.d.mts.map +1 -0
  249. package/lib/{contractsPublic.js → contractsPublic.mjs} +7 -1
  250. package/lib/contractsPublic.mjs.map +1 -0
  251. package/lib/createFile.d.mts +18 -0
  252. package/lib/createFile.d.mts.map +1 -0
  253. package/lib/createFile.mjs +171 -0
  254. package/lib/createFile.mjs.map +1 -0
  255. package/lib/createNewContainerOnExistingFile.d.mts +22 -0
  256. package/lib/createNewContainerOnExistingFile.d.mts.map +1 -0
  257. package/lib/createNewContainerOnExistingFile.mjs +56 -0
  258. package/lib/createNewContainerOnExistingFile.mjs.map +1 -0
  259. package/lib/createNewModule.d.mts +7 -0
  260. package/lib/createNewModule.d.mts.map +1 -0
  261. package/lib/createNewModule.mjs +7 -0
  262. package/lib/createNewModule.mjs.map +1 -0
  263. package/lib/createNewUtils.d.mts +27 -0
  264. package/lib/createNewUtils.d.mts.map +1 -0
  265. package/lib/createNewUtils.mjs +197 -0
  266. package/lib/createNewUtils.mjs.map +1 -0
  267. package/lib/{createOdspCreateContainerRequest.d.ts → createOdspCreateContainerRequest.d.mts} +5 -7
  268. package/lib/createOdspCreateContainerRequest.d.mts.map +1 -0
  269. package/lib/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.mjs} +8 -4
  270. package/lib/createOdspCreateContainerRequest.mjs.map +1 -0
  271. package/lib/{createOdspUrl.d.ts → createOdspUrl.d.mts} +2 -1
  272. package/lib/{createOdspUrl.d.ts.map → createOdspUrl.d.mts.map} +1 -1
  273. package/lib/{createOdspUrl.js → createOdspUrl.mjs} +2 -1
  274. package/lib/createOdspUrl.mjs.map +1 -0
  275. package/lib/{epochTracker.d.ts → epochTracker.d.mts} +34 -10
  276. package/lib/epochTracker.d.mts.map +1 -0
  277. package/lib/{epochTracker.js → epochTracker.mjs} +97 -43
  278. package/lib/epochTracker.mjs.map +1 -0
  279. package/lib/{fetch.d.ts → fetch.d.mts} +1 -1
  280. package/lib/{fetch.d.ts.map → fetch.d.mts.map} +1 -1
  281. package/lib/{fetch.js → fetch.mjs} +1 -1
  282. package/lib/fetch.mjs.map +1 -0
  283. package/lib/{fetchSnapshot.d.ts → fetchSnapshot.d.mts} +14 -9
  284. package/lib/fetchSnapshot.d.mts.map +1 -0
  285. package/lib/{fetchSnapshot.js → fetchSnapshot.mjs} +185 -167
  286. package/lib/fetchSnapshot.mjs.map +1 -0
  287. package/lib/{getFileLink.d.ts → getFileLink.d.mts} +4 -7
  288. package/lib/getFileLink.d.mts.map +1 -0
  289. package/lib/{getFileLink.js → getFileLink.mjs} +49 -38
  290. package/lib/getFileLink.mjs.map +1 -0
  291. package/lib/{getQueryString.d.ts → getQueryString.d.mts} +0 -4
  292. package/lib/getQueryString.d.mts.map +1 -0
  293. package/lib/{getQueryString.js → getQueryString.mjs} +1 -1
  294. package/lib/getQueryString.mjs.map +1 -0
  295. package/lib/{getUrlAndHeadersWithAuth.d.ts.map → getUrlAndHeadersWithAuth.d.mts.map} +1 -1
  296. package/lib/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.mjs} +4 -2
  297. package/lib/getUrlAndHeadersWithAuth.mjs.map +1 -0
  298. package/lib/index.d.mts +24 -0
  299. package/lib/index.d.mts.map +1 -0
  300. package/lib/index.mjs +22 -0
  301. package/lib/index.mjs.map +1 -0
  302. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts +17 -0
  303. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +1 -0
  304. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs +31 -0
  305. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +1 -0
  306. package/lib/localOdspDriver/{localOdspDocumentService.d.ts → localOdspDocumentService.d.mts} +3 -2
  307. package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -0
  308. package/lib/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.mjs} +8 -6
  309. package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -0
  310. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.ts → localOdspDocumentServiceFactory.d.mts} +4 -5
  311. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +1 -0
  312. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.mjs} +9 -10
  313. package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +1 -0
  314. package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.ts → localOdspDocumentStorageManager.d.mts} +3 -3
  315. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -0
  316. package/lib/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.mjs} +11 -9
  317. package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -0
  318. package/lib/odsp-driver-alpha.d.mts +497 -0
  319. package/lib/odsp-driver-beta.d.mts +159 -0
  320. package/lib/odsp-driver-public.d.mts +159 -0
  321. package/lib/odsp-driver-untrimmed.d.mts +566 -0
  322. package/lib/{odspCache.d.ts → odspCache.d.mts} +19 -8
  323. package/lib/odspCache.d.mts.map +1 -0
  324. package/lib/{odspCache.js → odspCache.mjs} +6 -11
  325. package/lib/odspCache.mjs.map +1 -0
  326. package/lib/odspDelayLoadedDeltaStream.d.mts +75 -0
  327. package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -0
  328. package/lib/odspDelayLoadedDeltaStream.mjs +287 -0
  329. package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -0
  330. package/lib/{odspDeltaStorageService.d.ts → odspDeltaStorageService.d.mts} +9 -7
  331. package/lib/odspDeltaStorageService.d.mts.map +1 -0
  332. package/lib/{odspDeltaStorageService.js → odspDeltaStorageService.mjs} +70 -68
  333. package/lib/odspDeltaStorageService.mjs.map +1 -0
  334. package/lib/{odspDocumentDeltaConnection.d.ts → odspDocumentDeltaConnection.d.mts} +33 -13
  335. package/lib/odspDocumentDeltaConnection.d.mts.map +1 -0
  336. package/lib/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.mjs} +214 -103
  337. package/lib/odspDocumentDeltaConnection.mjs.map +1 -0
  338. package/lib/{odspDocumentService.d.ts → odspDocumentService.d.mts} +14 -28
  339. package/lib/odspDocumentService.d.mts.map +1 -0
  340. package/lib/odspDocumentService.mjs +221 -0
  341. package/lib/odspDocumentService.mjs.map +1 -0
  342. package/lib/{odspDocumentServiceFactory.d.ts → odspDocumentServiceFactory.d.mts} +5 -1
  343. package/lib/odspDocumentServiceFactory.d.mts.map +1 -0
  344. package/lib/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.mjs} +8 -6
  345. package/lib/odspDocumentServiceFactory.mjs.map +1 -0
  346. package/lib/{odspDocumentServiceFactoryCore.d.ts → odspDocumentServiceFactoryCore.d.mts} +17 -12
  347. package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -0
  348. package/lib/odspDocumentServiceFactoryCore.mjs +192 -0
  349. package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -0
  350. package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.ts → odspDocumentServiceFactoryWithCodeSplit.d.mts} +6 -1
  351. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +1 -0
  352. package/lib/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.mjs} +8 -3
  353. package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +1 -0
  354. package/lib/{odspDocumentStorageManager.d.ts → odspDocumentStorageManager.d.mts} +17 -11
  355. package/lib/odspDocumentStorageManager.d.mts.map +1 -0
  356. package/lib/odspDocumentStorageManager.mjs +486 -0
  357. package/lib/odspDocumentStorageManager.mjs.map +1 -0
  358. package/lib/{odspDocumentStorageServiceBase.d.ts → odspDocumentStorageServiceBase.d.mts} +8 -10
  359. package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -0
  360. package/lib/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.mjs} +31 -33
  361. package/lib/odspDocumentStorageServiceBase.mjs.map +1 -0
  362. package/lib/{odspDriverUrlResolver.d.ts → odspDriverUrlResolver.d.mts} +12 -0
  363. package/lib/odspDriverUrlResolver.d.mts.map +1 -0
  364. package/lib/{odspDriverUrlResolver.js → odspDriverUrlResolver.mjs} +50 -40
  365. package/lib/odspDriverUrlResolver.mjs.map +1 -0
  366. package/lib/{odspDriverUrlResolverForShareLink.d.ts → odspDriverUrlResolverForShareLink.d.mts} +6 -4
  367. package/lib/odspDriverUrlResolverForShareLink.d.mts.map +1 -0
  368. package/lib/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.mjs} +36 -29
  369. package/lib/odspDriverUrlResolverForShareLink.mjs.map +1 -0
  370. package/lib/{odspError.d.ts → odspError.d.mts} +1 -1
  371. package/lib/odspError.d.mts.map +1 -0
  372. package/lib/{odspError.js → odspError.mjs} +7 -3
  373. package/lib/odspError.mjs.map +1 -0
  374. package/lib/{odspFluidFileLink.d.ts → odspFluidFileLink.d.mts} +11 -2
  375. package/lib/odspFluidFileLink.d.mts.map +1 -0
  376. package/lib/{odspFluidFileLink.js → odspFluidFileLink.mjs} +23 -16
  377. package/lib/odspFluidFileLink.mjs.map +1 -0
  378. package/lib/odspLocationRedirection.d.mts +14 -0
  379. package/lib/odspLocationRedirection.d.mts.map +1 -0
  380. package/lib/odspLocationRedirection.mjs +20 -0
  381. package/lib/odspLocationRedirection.mjs.map +1 -0
  382. package/lib/{odspPublicUtils.d.ts → odspPublicUtils.d.mts} +6 -0
  383. package/lib/odspPublicUtils.d.mts.map +1 -0
  384. package/lib/{odspPublicUtils.js → odspPublicUtils.mjs} +5 -2
  385. package/lib/odspPublicUtils.mjs.map +1 -0
  386. package/lib/{odspSnapshotParser.d.ts → odspSnapshotParser.d.mts} +2 -2
  387. package/lib/odspSnapshotParser.d.mts.map +1 -0
  388. package/lib/{odspSnapshotParser.js → odspSnapshotParser.mjs} +10 -11
  389. package/lib/odspSnapshotParser.mjs.map +1 -0
  390. package/lib/{odspSummaryUploadManager.d.ts → odspSummaryUploadManager.d.mts} +8 -5
  391. package/lib/odspSummaryUploadManager.d.mts.map +1 -0
  392. package/lib/{odspSummaryUploadManager.js → odspSummaryUploadManager.mjs} +41 -32
  393. package/lib/odspSummaryUploadManager.mjs.map +1 -0
  394. package/lib/{odspUrlHelper.d.ts → odspUrlHelper.d.mts} +5 -0
  395. package/lib/odspUrlHelper.d.mts.map +1 -0
  396. package/lib/{odspUrlHelper.js → odspUrlHelper.mjs} +9 -3
  397. package/lib/odspUrlHelper.mjs.map +1 -0
  398. package/lib/{odspUtils.d.ts → odspUtils.d.mts} +36 -7
  399. package/lib/odspUtils.d.mts.map +1 -0
  400. package/lib/{odspUtils.js → odspUtils.mjs} +109 -27
  401. package/lib/odspUtils.mjs.map +1 -0
  402. package/lib/{opsCaching.d.ts → opsCaching.d.mts} +3 -3
  403. package/lib/opsCaching.d.mts.map +1 -0
  404. package/lib/{opsCaching.js → opsCaching.mjs} +23 -7
  405. package/lib/opsCaching.mjs.map +1 -0
  406. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
  407. package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
  408. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  409. package/lib/packageVersion.mjs.map +1 -0
  410. package/lib/{prefetchLatestSnapshot.d.ts → prefetchLatestSnapshot.d.mts} +13 -8
  411. package/lib/prefetchLatestSnapshot.d.mts.map +1 -0
  412. package/lib/prefetchLatestSnapshot.mjs +96 -0
  413. package/lib/prefetchLatestSnapshot.mjs.map +1 -0
  414. package/lib/{retryErrorsStorageAdapter.d.ts → retryErrorsStorageAdapter.d.mts} +5 -4
  415. package/lib/retryErrorsStorageAdapter.d.mts.map +1 -0
  416. package/lib/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.mjs} +13 -6
  417. package/lib/retryErrorsStorageAdapter.mjs.map +1 -0
  418. package/lib/{retryUtils.d.ts → retryUtils.d.mts} +2 -2
  419. package/lib/retryUtils.d.mts.map +1 -0
  420. package/lib/{retryUtils.js → retryUtils.mjs} +27 -11
  421. package/lib/retryUtils.mjs.map +1 -0
  422. package/lib/socketModule.d.mts +7 -0
  423. package/lib/socketModule.d.mts.map +1 -0
  424. package/lib/socketModule.mjs +7 -0
  425. package/lib/socketModule.mjs.map +1 -0
  426. package/lib/{vroom.d.ts → vroom.d.mts} +6 -6
  427. package/lib/vroom.d.mts.map +1 -0
  428. package/lib/{vroom.js → vroom.mjs} +24 -9
  429. package/lib/vroom.mjs.map +1 -0
  430. package/lib/{zipItDataRepresentationUtils.d.ts → zipItDataRepresentationUtils.d.mts} +48 -21
  431. package/lib/zipItDataRepresentationUtils.d.mts.map +1 -0
  432. package/lib/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.mjs} +213 -111
  433. package/lib/zipItDataRepresentationUtils.mjs.map +1 -0
  434. package/package.json +89 -69
  435. package/prettier.config.cjs +8 -0
  436. package/src/ReadBufferUtils.ts +51 -44
  437. package/src/WriteBufferUtils.ts +203 -181
  438. package/src/checkUrl.ts +16 -15
  439. package/src/compactSnapshotParser.ts +219 -103
  440. package/src/compactSnapshotWriter.ts +118 -97
  441. package/src/constants.ts +7 -0
  442. package/src/contracts.ts +96 -136
  443. package/src/contractsPublic.ts +31 -16
  444. package/src/createFile.ts +243 -305
  445. package/src/createNewContainerOnExistingFile.ts +93 -0
  446. package/src/createNewModule.ts +7 -0
  447. package/src/createNewUtils.ts +266 -56
  448. package/src/createOdspCreateContainerRequest.ts +22 -18
  449. package/src/createOdspUrl.ts +12 -13
  450. package/src/epochTracker.ts +596 -457
  451. package/src/fetch.ts +4 -4
  452. package/src/fetchSnapshot.ts +583 -508
  453. package/src/getFileLink.ts +194 -155
  454. package/src/getQueryString.ts +11 -9
  455. package/src/getUrlAndHeadersWithAuth.ts +34 -33
  456. package/src/index.ts +42 -18
  457. package/src/localOdspDriver/localOdspDeltaStorageService.ts +49 -0
  458. package/src/localOdspDriver/localOdspDocumentService.ts +40 -38
  459. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +46 -43
  460. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +55 -50
  461. package/src/odspCache.ts +112 -90
  462. package/src/odspDelayLoadedDeltaStream.ts +459 -0
  463. package/src/odspDeltaStorageService.ts +232 -221
  464. package/src/odspDocumentDeltaConnection.ts +751 -563
  465. package/src/odspDocumentService.ts +324 -523
  466. package/src/odspDocumentServiceFactory.ts +20 -21
  467. package/src/odspDocumentServiceFactoryCore.ts +325 -202
  468. package/src/odspDocumentServiceFactoryWithCodeSplit.ts +20 -20
  469. package/src/odspDocumentStorageManager.ts +730 -534
  470. package/src/odspDocumentStorageServiceBase.ts +279 -254
  471. package/src/odspDriverUrlResolver.ts +230 -188
  472. package/src/odspDriverUrlResolverForShareLink.ts +223 -203
  473. package/src/odspError.ts +27 -19
  474. package/src/odspFluidFileLink.ts +106 -87
  475. package/src/odspLocationRedirection.ts +26 -0
  476. package/src/odspPublicUtils.ts +20 -14
  477. package/src/odspSnapshotParser.ts +53 -46
  478. package/src/odspSummaryUploadManager.ts +243 -218
  479. package/src/odspUrlHelper.ts +81 -71
  480. package/src/odspUtils.ts +401 -259
  481. package/src/opsCaching.ts +214 -193
  482. package/src/packageVersion.ts +1 -1
  483. package/src/prefetchLatestSnapshot.ts +142 -80
  484. package/src/retryErrorsStorageAdapter.ts +92 -77
  485. package/src/retryUtils.ts +80 -57
  486. package/src/socketModule.ts +8 -0
  487. package/src/vroom.ts +92 -83
  488. package/src/zipItDataRepresentationUtils.ts +534 -394
  489. package/tsc-multi.test.json +4 -0
  490. package/tsconfig.json +11 -13
  491. package/.editorconfig +0 -7
  492. package/dist/ReadBufferUtils.js.map +0 -1
  493. package/dist/WriteBufferUtils.js.map +0 -1
  494. package/dist/checkUrl.js.map +0 -1
  495. package/dist/compactSnapshotParser.js +0 -115
  496. package/dist/compactSnapshotParser.js.map +0 -1
  497. package/dist/compactSnapshotWriter.js.map +0 -1
  498. package/dist/constants.js.map +0 -1
  499. package/dist/contracts.js.map +0 -1
  500. package/dist/contractsPublic.js.map +0 -1
  501. package/dist/createFile.js +0 -242
  502. package/dist/createFile.js.map +0 -1
  503. package/dist/createNewUtils.js +0 -67
  504. package/dist/createNewUtils.js.map +0 -1
  505. package/dist/createOdspCreateContainerRequest.js.map +0 -1
  506. package/dist/createOdspUrl.js.map +0 -1
  507. package/dist/epochTracker.js.map +0 -1
  508. package/dist/fetch.js.map +0 -1
  509. package/dist/fetchSnapshot.js.map +0 -1
  510. package/dist/getFileLink.js.map +0 -1
  511. package/dist/getQueryString.js.map +0 -1
  512. package/dist/getSocketIo.d.ts +0 -11
  513. package/dist/getSocketIo.d.ts.map +0 -1
  514. package/dist/getSocketIo.js +0 -20
  515. package/dist/getSocketIo.js.map +0 -1
  516. package/dist/getUrlAndHeadersWithAuth.js.map +0 -1
  517. package/dist/index.js +0 -41
  518. package/dist/index.js.map +0 -1
  519. package/dist/localOdspDriver/localOdspDocumentService.js.map +0 -1
  520. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  521. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  522. package/dist/odspCache.js.map +0 -1
  523. package/dist/odspDeltaStorageService.js.map +0 -1
  524. package/dist/odspDocumentDeltaConnection.js.map +0 -1
  525. package/dist/odspDocumentService.js +0 -364
  526. package/dist/odspDocumentService.js.map +0 -1
  527. package/dist/odspDocumentServiceFactory.js.map +0 -1
  528. package/dist/odspDocumentServiceFactoryCore.js +0 -118
  529. package/dist/odspDocumentServiceFactoryCore.js.map +0 -1
  530. package/dist/odspDocumentServiceFactoryWithCodeSplit.js +0 -34
  531. package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  532. package/dist/odspDocumentStorageManager.js +0 -356
  533. package/dist/odspDocumentStorageManager.js.map +0 -1
  534. package/dist/odspDocumentStorageServiceBase.js.map +0 -1
  535. package/dist/odspDriverUrlResolver.js.map +0 -1
  536. package/dist/odspDriverUrlResolverForShareLink.js.map +0 -1
  537. package/dist/odspError.js.map +0 -1
  538. package/dist/odspFluidFileLink.js.map +0 -1
  539. package/dist/odspPublicUtils.js.map +0 -1
  540. package/dist/odspSnapshotParser.js.map +0 -1
  541. package/dist/odspSummaryUploadManager.js.map +0 -1
  542. package/dist/odspUrlHelper.js.map +0 -1
  543. package/dist/odspUtils.js.map +0 -1
  544. package/dist/opsCaching.js.map +0 -1
  545. package/dist/packageVersion.js.map +0 -1
  546. package/dist/prefetchLatestSnapshot.js +0 -57
  547. package/dist/prefetchLatestSnapshot.js.map +0 -1
  548. package/dist/retryErrorsStorageAdapter.js.map +0 -1
  549. package/dist/retryUtils.js.map +0 -1
  550. package/dist/vroom.js.map +0 -1
  551. package/dist/zipItDataRepresentationUtils.js.map +0 -1
  552. package/lib/ReadBufferUtils.d.ts.map +0 -1
  553. package/lib/ReadBufferUtils.js.map +0 -1
  554. package/lib/WriteBufferUtils.d.ts.map +0 -1
  555. package/lib/WriteBufferUtils.js.map +0 -1
  556. package/lib/checkUrl.d.ts.map +0 -1
  557. package/lib/checkUrl.js.map +0 -1
  558. package/lib/compactSnapshotParser.d.ts +0 -15
  559. package/lib/compactSnapshotParser.d.ts.map +0 -1
  560. package/lib/compactSnapshotParser.js +0 -111
  561. package/lib/compactSnapshotParser.js.map +0 -1
  562. package/lib/compactSnapshotWriter.d.ts.map +0 -1
  563. package/lib/compactSnapshotWriter.js.map +0 -1
  564. package/lib/constants.d.ts.map +0 -1
  565. package/lib/constants.js.map +0 -1
  566. package/lib/contracts.d.ts.map +0 -1
  567. package/lib/contracts.js.map +0 -1
  568. package/lib/contractsPublic.d.ts.map +0 -1
  569. package/lib/contractsPublic.js.map +0 -1
  570. package/lib/createFile.d.ts +0 -22
  571. package/lib/createFile.d.ts.map +0 -1
  572. package/lib/createFile.js +0 -235
  573. package/lib/createFile.js.map +0 -1
  574. package/lib/createNewUtils.d.ts +0 -11
  575. package/lib/createNewUtils.d.ts.map +0 -1
  576. package/lib/createNewUtils.js +0 -63
  577. package/lib/createNewUtils.js.map +0 -1
  578. package/lib/createOdspCreateContainerRequest.d.ts.map +0 -1
  579. package/lib/createOdspCreateContainerRequest.js.map +0 -1
  580. package/lib/createOdspUrl.js.map +0 -1
  581. package/lib/epochTracker.d.ts.map +0 -1
  582. package/lib/epochTracker.js.map +0 -1
  583. package/lib/fetch.js.map +0 -1
  584. package/lib/fetchSnapshot.d.ts.map +0 -1
  585. package/lib/fetchSnapshot.js.map +0 -1
  586. package/lib/getFileLink.d.ts.map +0 -1
  587. package/lib/getFileLink.js.map +0 -1
  588. package/lib/getQueryString.d.ts.map +0 -1
  589. package/lib/getQueryString.js.map +0 -1
  590. package/lib/getSocketIo.d.ts +0 -11
  591. package/lib/getSocketIo.d.ts.map +0 -1
  592. package/lib/getSocketIo.js +0 -13
  593. package/lib/getSocketIo.js.map +0 -1
  594. package/lib/getUrlAndHeadersWithAuth.js.map +0 -1
  595. package/lib/index.d.ts +0 -21
  596. package/lib/index.d.ts.map +0 -1
  597. package/lib/index.js +0 -29
  598. package/lib/index.js.map +0 -1
  599. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +0 -1
  600. package/lib/localOdspDriver/localOdspDocumentService.js.map +0 -1
  601. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +0 -1
  602. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  603. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +0 -1
  604. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  605. package/lib/odspCache.d.ts.map +0 -1
  606. package/lib/odspCache.js.map +0 -1
  607. package/lib/odspDeltaStorageService.d.ts.map +0 -1
  608. package/lib/odspDeltaStorageService.js.map +0 -1
  609. package/lib/odspDocumentDeltaConnection.d.ts.map +0 -1
  610. package/lib/odspDocumentDeltaConnection.js.map +0 -1
  611. package/lib/odspDocumentService.d.ts.map +0 -1
  612. package/lib/odspDocumentService.js +0 -360
  613. package/lib/odspDocumentService.js.map +0 -1
  614. package/lib/odspDocumentServiceFactory.d.ts.map +0 -1
  615. package/lib/odspDocumentServiceFactory.js.map +0 -1
  616. package/lib/odspDocumentServiceFactoryCore.d.ts.map +0 -1
  617. package/lib/odspDocumentServiceFactoryCore.js +0 -114
  618. package/lib/odspDocumentServiceFactoryCore.js.map +0 -1
  619. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +0 -1
  620. package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  621. package/lib/odspDocumentStorageManager.d.ts.map +0 -1
  622. package/lib/odspDocumentStorageManager.js +0 -352
  623. package/lib/odspDocumentStorageManager.js.map +0 -1
  624. package/lib/odspDocumentStorageServiceBase.d.ts.map +0 -1
  625. package/lib/odspDocumentStorageServiceBase.js.map +0 -1
  626. package/lib/odspDriverUrlResolver.d.ts.map +0 -1
  627. package/lib/odspDriverUrlResolver.js.map +0 -1
  628. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +0 -1
  629. package/lib/odspDriverUrlResolverForShareLink.js.map +0 -1
  630. package/lib/odspError.d.ts.map +0 -1
  631. package/lib/odspError.js.map +0 -1
  632. package/lib/odspFluidFileLink.d.ts.map +0 -1
  633. package/lib/odspFluidFileLink.js.map +0 -1
  634. package/lib/odspPublicUtils.d.ts.map +0 -1
  635. package/lib/odspPublicUtils.js.map +0 -1
  636. package/lib/odspSnapshotParser.d.ts.map +0 -1
  637. package/lib/odspSnapshotParser.js.map +0 -1
  638. package/lib/odspSummaryUploadManager.d.ts.map +0 -1
  639. package/lib/odspSummaryUploadManager.js.map +0 -1
  640. package/lib/odspUrlHelper.d.ts.map +0 -1
  641. package/lib/odspUrlHelper.js.map +0 -1
  642. package/lib/odspUtils.d.ts.map +0 -1
  643. package/lib/odspUtils.js.map +0 -1
  644. package/lib/opsCaching.d.ts.map +0 -1
  645. package/lib/opsCaching.js.map +0 -1
  646. package/lib/packageVersion.js.map +0 -1
  647. package/lib/prefetchLatestSnapshot.d.ts.map +0 -1
  648. package/lib/prefetchLatestSnapshot.js +0 -53
  649. package/lib/prefetchLatestSnapshot.js.map +0 -1
  650. package/lib/retryErrorsStorageAdapter.d.ts.map +0 -1
  651. package/lib/retryErrorsStorageAdapter.js.map +0 -1
  652. package/lib/retryUtils.d.ts.map +0 -1
  653. package/lib/retryUtils.js.map +0 -1
  654. package/lib/vroom.d.ts.map +0 -1
  655. package/lib/vroom.js.map +0 -1
  656. package/lib/zipItDataRepresentationUtils.d.ts.map +0 -1
  657. package/lib/zipItDataRepresentationUtils.js.map +0 -1
  658. package/src/getSocketIo.ts +0 -14
  659. package/tsconfig.esnext.json +0 -7
  660. /package/lib/{ReadBufferUtils.d.ts → ReadBufferUtils.d.mts} +0 -0
  661. /package/lib/{getUrlAndHeadersWithAuth.d.ts → getUrlAndHeadersWithAuth.d.mts} +0 -0
@@ -0,0 +1,486 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { generateStack, loggerToMonitoringContext, normalizeError, overwriteStack, PerformanceEvent, } from "@fluidframework/telemetry-utils";
6
+ import { performance } from "@fluid-internal/client-utils";
7
+ import { assert, delay } from "@fluidframework/core-utils";
8
+ import { LogLevel } from "@fluidframework/core-interfaces";
9
+ import { promiseRaceWithWinner } from "@fluidframework/driver-base";
10
+ import { DriverErrorType, FetchSource } from "@fluidframework/driver-definitions";
11
+ import { RateLimiter, NonRetryableError } from "@fluidframework/driver-utils";
12
+ import { OdspErrorType, getKeyForCacheEntry, } from "@fluidframework/odsp-driver-definitions";
13
+ import { downloadSnapshot, evalBlobsAndTrees, fetchSnapshot, fetchSnapshotWithRedeem, } from "./fetchSnapshot.mjs";
14
+ import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth.mjs";
15
+ import { createCacheSnapshotKey, getWithRetryForTokenRefresh } from "./odspUtils.mjs";
16
+ import { pkgVersion as driverVersion } from "./packageVersion.mjs";
17
+ import { OdspDocumentStorageServiceBase } from "./odspDocumentStorageServiceBase.mjs";
18
+ export const defaultSummarizerCacheExpiryTimeout = 60 * 1000; // 60 seconds.
19
+ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
20
+ constructor(odspResolvedUrl, getStorageToken, logger, fetchFullSnapshot, cache, hostPolicy, epochTracker, flushCallback, relayServiceTenantAndSessionId, snapshotFormatFetchType) {
21
+ super(loggerToMonitoringContext(logger).config);
22
+ this.odspResolvedUrl = odspResolvedUrl;
23
+ this.getStorageToken = getStorageToken;
24
+ this.logger = logger;
25
+ this.fetchFullSnapshot = fetchFullSnapshot;
26
+ this.cache = cache;
27
+ this.hostPolicy = hostPolicy;
28
+ this.epochTracker = epochTracker;
29
+ this.flushCallback = flushCallback;
30
+ this.relayServiceTenantAndSessionId = relayServiceTenantAndSessionId;
31
+ this.snapshotFormatFetchType = snapshotFormatFetchType;
32
+ this.odspSummaryModuleLoaded = false;
33
+ this.firstVersionCall = true;
34
+ // Driver specified limits for snapshot size and time.
35
+ /**
36
+ * NOTE: While commit cfff6e3 added restrictions to prevent large payloads, snapshot failures will continue to
37
+ * happen until blob request throttling is implemented. Until then, as a temporary fix we set arbitrarily large
38
+ * snapshot size and timeout limits so that such failures are unlikely to occur.
39
+ */
40
+ this.maxSnapshotSizeLimit = 500000000; // 500 MB
41
+ this.maxSnapshotFetchTimeout = 120000; // 2 min
42
+ // limits the amount of parallel "attachment" blob uploads
43
+ this.createBlobRateLimiter = new RateLimiter(1);
44
+ this.documentId = this.odspResolvedUrl.hashedDocumentId;
45
+ this.snapshotUrl = this.odspResolvedUrl.endpoints.snapshotStorageUrl;
46
+ this.attachmentPOSTUrl = this.odspResolvedUrl.endpoints.attachmentPOSTStorageUrl;
47
+ this.attachmentGETUrl = this.odspResolvedUrl.endpoints.attachmentGETStorageUrl;
48
+ }
49
+ get isFirstSnapshotFromNetwork() {
50
+ return this._isFirstSnapshotFromNetwork;
51
+ }
52
+ async createBlob(file) {
53
+ this.checkAttachmentPOSTUrl();
54
+ const response = await getWithRetryForTokenRefresh(async (options) => {
55
+ const storageToken = await this.getStorageToken(options, "CreateBlob");
56
+ const { url, headers } = getUrlAndHeadersWithAuth(`${this.attachmentPOSTUrl}/content`, storageToken, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader);
57
+ headers["Content-Type"] = "application/octet-stream";
58
+ return PerformanceEvent.timedExecAsync(this.logger, {
59
+ eventName: "createBlob",
60
+ size: file.byteLength,
61
+ waitQueueLength: this.createBlobRateLimiter.waitQueueLength,
62
+ }, async (event) => {
63
+ const res = await this.createBlobRateLimiter.schedule(async () => this.epochTracker.fetchAndParseAsJSON(url, {
64
+ body: file,
65
+ headers,
66
+ method: "POST",
67
+ }, "createBlob"));
68
+ event.end({
69
+ blobId: res.content.id,
70
+ ...res.propsToLog,
71
+ });
72
+ return res;
73
+ });
74
+ });
75
+ return response.content;
76
+ }
77
+ async fetchBlobFromStorage(blobId, evicted) {
78
+ this.checkAttachmentGETUrl();
79
+ const blob = await getWithRetryForTokenRefresh(async (options) => {
80
+ const storageToken = await this.getStorageToken(options, "GetBlob");
81
+ const unAuthedUrl = `${this.attachmentGETUrl}/${encodeURIComponent(blobId)}/content`;
82
+ const { url, headers } = getUrlAndHeadersWithAuth(unAuthedUrl, storageToken, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader);
83
+ return PerformanceEvent.timedExecAsync(this.logger, {
84
+ eventName: "readDataBlob",
85
+ blobId,
86
+ evicted,
87
+ headers: Object.keys(headers).length !== 0 ? true : undefined,
88
+ waitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,
89
+ }, async (event) => {
90
+ const res = await this.epochTracker.fetchArray(url, { headers }, "blob");
91
+ event.end({
92
+ waitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,
93
+ ...res.propsToLog,
94
+ attempts: options.refresh ? 2 : 1,
95
+ });
96
+ const cacheControl = res.headers.get("cache-control");
97
+ if (cacheControl === undefined ||
98
+ !(cacheControl.includes("private") || cacheControl.includes("public"))) {
99
+ this.logger.sendErrorEvent({
100
+ eventName: "NonCacheableBlob",
101
+ cacheControl,
102
+ blobId,
103
+ ...res.propsToLog,
104
+ });
105
+ }
106
+ return res.content;
107
+ });
108
+ });
109
+ this.blobCache.setBlob(blobId, blob);
110
+ return blob;
111
+ }
112
+ async getSnapshotTree(version, scenarioName) {
113
+ if (!this.snapshotUrl) {
114
+ return null;
115
+ }
116
+ return super.getSnapshotTree(version, scenarioName);
117
+ }
118
+ async getVersions(
119
+ // eslint-disable-next-line @rushstack/no-new-null
120
+ blobid, count, scenarioName, fetchSource) {
121
+ // Regular load workflow uses blobId === documentID to indicate "latest".
122
+ if (blobid !== this.documentId && blobid) {
123
+ // FluidFetch & FluidDebugger tools use empty sting to query for versions
124
+ // In such case we need to make a call against SPO to give full picture to the tool.
125
+ // Otherwise, each commit calls getVersions but odsp doesn't have a history for each commit
126
+ // return the blobid as is
127
+ return [
128
+ {
129
+ id: blobid,
130
+ treeId: undefined,
131
+ },
132
+ ];
133
+ }
134
+ // Can't really make a call if we do not have URL
135
+ if (!this.snapshotUrl) {
136
+ return [];
137
+ }
138
+ // If count is one, we can use the trees/latest API, which returns the latest version and trees in a single request for better performance
139
+ if (count === 1 && (blobid === null || blobid === this.documentId)) {
140
+ const hostSnapshotOptions = this.hostPolicy.snapshotOptions;
141
+ const odspSnapshotCacheValue = await PerformanceEvent.timedExecAsync(this.logger, { eventName: "ObtainSnapshot", fetchSource }, async (event) => {
142
+ const props = {};
143
+ let cacheLookupTimeInSerialFetch = 0;
144
+ let retrievedSnapshot;
145
+ let method;
146
+ let prefetchWaitStartTime = performance.now();
147
+ if (fetchSource === FetchSource.noCache) {
148
+ retrievedSnapshot = await this.fetchSnapshot(hostSnapshotOptions, scenarioName);
149
+ method = "networkOnly";
150
+ }
151
+ else {
152
+ // Here's the logic to grab the persistent cache snapshot implemented by the host
153
+ // Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions
154
+ const cachedSnapshotP = this.epochTracker
155
+ .get(createCacheSnapshotKey(this.odspResolvedUrl))
156
+ .then(async (snapshotCachedEntry) => {
157
+ if (snapshotCachedEntry !== undefined) {
158
+ // If the cached entry does not contain the entry time, then assign it a default of 30 days old.
159
+ const age = Date.now() -
160
+ (snapshotCachedEntry.cacheEntryTime ??
161
+ Date.now() - 30 * 24 * 60 * 60 * 1000);
162
+ // In order to decrease the number of times we have to execute a snapshot refresh,
163
+ // if this is the summarizer and we have a cache entry but it is past the defaultSummarizerCacheExpiryTimeout,
164
+ // force the network retrieval instead as there might be a more recent snapshot available.
165
+ // See: https://github.com/microsoft/FluidFramework/issues/8995 for additional information.
166
+ if (this.hostPolicy.summarizerClient) {
167
+ if (age > defaultSummarizerCacheExpiryTimeout) {
168
+ props.cacheSummarizerExpired = true;
169
+ return undefined;
170
+ }
171
+ else {
172
+ props.cacheSummarizerExpired = false;
173
+ }
174
+ }
175
+ // Record the cache age
176
+ props.cacheEntryAge = age;
177
+ }
178
+ return snapshotCachedEntry;
179
+ });
180
+ // Based on the concurrentSnapshotFetch policy:
181
+ // Either retrieve both the network and cache snapshots concurrently and pick the first to return,
182
+ // or grab the cache value and then the network value if the cache value returns undefined.
183
+ // For summarizer which could call this during refreshing of summary parent, always use the cache
184
+ // first. Also for other clients, if it is not critical path which is determined by firstVersionCall,
185
+ // then also check the cache first.
186
+ if (this.firstVersionCall &&
187
+ this.hostPolicy.concurrentSnapshotFetch &&
188
+ !this.hostPolicy.summarizerClient) {
189
+ const networkSnapshotP = this.fetchSnapshot(hostSnapshotOptions, scenarioName);
190
+ // Ensure that failures on both paths are ignored initially.
191
+ // I.e. if cache fails for some reason, we will proceed with network result.
192
+ // And vice versa - if (for example) client is offline and network request fails first, we
193
+ // do want to attempt to succeed with cached data!
194
+ const promiseRaceWinner = await promiseRaceWithWinner([
195
+ cachedSnapshotP.catch(() => undefined),
196
+ networkSnapshotP.catch(() => undefined),
197
+ ]);
198
+ retrievedSnapshot = promiseRaceWinner.value;
199
+ method = promiseRaceWinner.index === 0 ? "cache" : "network";
200
+ if (retrievedSnapshot === undefined) {
201
+ // if network failed -> wait for cache ( then return network failure)
202
+ // If cache returned empty or failed -> wait for network (success of failure)
203
+ try {
204
+ if (promiseRaceWinner.index === 1) {
205
+ retrievedSnapshot = await cachedSnapshotP;
206
+ method = "cache";
207
+ }
208
+ if (retrievedSnapshot === undefined) {
209
+ retrievedSnapshot = await networkSnapshotP;
210
+ method = "network";
211
+ }
212
+ }
213
+ catch (err) {
214
+ // The call stacks of any errors thrown by cached snapshot or network snapshot aren't very useful:
215
+ // they get truncated at this stack frame due to the promise race and how v8 tracks async stack traces--
216
+ // see https://v8.dev/docs/stack-trace-api#async-stack-traces and the "zero-cost async stack traces" document
217
+ // linked there. https://v8.dev/blog/fast-async#await-under-the-hood may also be helpful for context on internals.
218
+ // Regenerating the stack at this level provides more information for logged errors.
219
+ // Once FF uses an ES2021 target, we could convert the above promise race to use `Promise.any` + AggregateError and
220
+ // get similar quality stacks with less hand-crafted code.
221
+ const innerStack = err.stack;
222
+ const normalizedError = normalizeError(err);
223
+ normalizedError.addTelemetryProperties({ innerStack });
224
+ const newStack = `<<STACK TRUNCATED: see innerStack property>> \n${generateStack()}`;
225
+ overwriteStack(normalizedError, newStack);
226
+ throw normalizedError;
227
+ }
228
+ }
229
+ }
230
+ else {
231
+ // Note: There's a race condition here - another caller may come past the undefined check
232
+ // while the first caller is awaiting later async code in this block.
233
+ const startTime = performance.now();
234
+ retrievedSnapshot = await cachedSnapshotP;
235
+ cacheLookupTimeInSerialFetch = performance.now() - startTime;
236
+ method = retrievedSnapshot !== undefined ? "cache" : "network";
237
+ if (retrievedSnapshot === undefined) {
238
+ prefetchWaitStartTime = performance.now();
239
+ retrievedSnapshot = await this.fetchSnapshot(hostSnapshotOptions, scenarioName);
240
+ }
241
+ }
242
+ }
243
+ if (method === "network") {
244
+ props.cacheEntryAge = undefined;
245
+ }
246
+ if (this.firstVersionCall) {
247
+ this._isFirstSnapshotFromNetwork = method === "cache" ? false : true;
248
+ }
249
+ const prefetchStartTime = retrievedSnapshot.prefetchStartTime;
250
+ event.end({
251
+ ...props,
252
+ method,
253
+ avoidPrefetchSnapshotCache: this.hostPolicy.avoidPrefetchSnapshotCache,
254
+ ...evalBlobsAndTrees(retrievedSnapshot),
255
+ cacheLookupTimeInSerialFetch,
256
+ prefetchSavedDuration: prefetchStartTime !== undefined && method !== "cache"
257
+ ? prefetchWaitStartTime - prefetchStartTime
258
+ : undefined,
259
+ });
260
+ return retrievedSnapshot;
261
+ });
262
+ const stTime = performance.now();
263
+ // Don't override ops which were fetched during initial load, since we could still need them.
264
+ const id = this.initializeFromSnapshot(odspSnapshotCacheValue, this.firstVersionCall);
265
+ this.logger.sendTelemetryEvent({
266
+ eventName: "SnapshotInitializeTime",
267
+ duration: performance.now() - stTime,
268
+ }, undefined, LogLevel.verbose);
269
+ this.firstVersionCall = false;
270
+ return id ? [{ id, treeId: undefined }] : [];
271
+ }
272
+ return getWithRetryForTokenRefresh(async (options) => {
273
+ const storageToken = await this.getStorageToken(options, "GetVersions");
274
+ const { url, headers } = getUrlAndHeadersWithAuth(`${this.snapshotUrl}/versions?top=${count}`, storageToken, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader);
275
+ // Fetch the latest snapshot versions for the document
276
+ const response = await PerformanceEvent.timedExecAsync(this.logger, {
277
+ eventName: "getVersions",
278
+ headers: Object.keys(headers).length !== 0 ? true : undefined,
279
+ }, async () => this.epochTracker.fetchAndParseAsJSON(url, { headers }, "versions", undefined, scenarioName));
280
+ const versionsResponse = response.content;
281
+ if (!versionsResponse) {
282
+ throw new NonRetryableError("No response from /versions endpoint", DriverErrorType.genericNetworkError, { driverVersion });
283
+ }
284
+ if (!Array.isArray(versionsResponse.value)) {
285
+ throw new NonRetryableError("Incorrect response from /versions endpoint, expected an array", DriverErrorType.genericNetworkError, { driverVersion });
286
+ }
287
+ return versionsResponse.value.map((version) => {
288
+ return {
289
+ id: version.id,
290
+ treeId: undefined,
291
+ };
292
+ });
293
+ });
294
+ }
295
+ async fetchSnapshot(hostSnapshotOptions, scenarioName) {
296
+ return this.fetchSnapshotCore(hostSnapshotOptions, scenarioName).catch((error) => {
297
+ // Issue #5895:
298
+ // If we are offline, this error is retryable. But that means that RetriableDocumentStorageService
299
+ // will run in circles calling getSnapshotTree, which would result in OdspDocumentStorageService class
300
+ // going getVersions / individual blob download path. This path is very slow, and will not work with
301
+ // delay-loaded data stores and ODSP storage deleting old snapshots and blobs.
302
+ if (typeof error === "object" && error !== null) {
303
+ error.canRetry = false;
304
+ }
305
+ throw error;
306
+ });
307
+ }
308
+ async fetchSnapshotCore(hostSnapshotOptions, scenarioName) {
309
+ // Don't look into cache, if the host specifically tells us so.
310
+ if (!this.hostPolicy.avoidPrefetchSnapshotCache) {
311
+ const prefetchCacheKey = getKeyForCacheEntry(createCacheSnapshotKey(this.odspResolvedUrl));
312
+ const result = await this.cache.snapshotPrefetchResultCache
313
+ ?.get(prefetchCacheKey)
314
+ ?.then(async (response) => {
315
+ // Remove it from cache once used.
316
+ this.cache.snapshotPrefetchResultCache.remove(prefetchCacheKey);
317
+ // Validate the epoch from the prefetched snapshot result.
318
+ await this.epochTracker.validateEpoch(response.fluidEpoch, "treesLatest");
319
+ return response;
320
+ })
321
+ .catch(async (err) => {
322
+ this.logger.sendTelemetryEvent({
323
+ eventName: "PrefetchSnapshotError",
324
+ concurrentSnapshotFetch: this.hostPolicy.concurrentSnapshotFetch,
325
+ }, err);
326
+ return undefined;
327
+ });
328
+ // If the prefetch call, is successful, then return the contents otherwise as backup for now, just
329
+ // proceed with the old snapshot fetch flow.
330
+ if (result !== undefined) {
331
+ return result;
332
+ }
333
+ }
334
+ const snapshotOptions = {
335
+ mds: this.maxSnapshotSizeLimit,
336
+ ...hostSnapshotOptions,
337
+ timeout: hostSnapshotOptions?.timeout
338
+ ? Math.min(hostSnapshotOptions.timeout, this.maxSnapshotFetchTimeout)
339
+ : this.maxSnapshotFetchTimeout,
340
+ };
341
+ // No limit on size of snapshot or time to fetch, as otherwise we fail all clients to summarize
342
+ if (this.hostPolicy.summarizerClient) {
343
+ snapshotOptions.mds = undefined;
344
+ snapshotOptions.timeout = undefined;
345
+ }
346
+ const snapshotDownloader = async (finalOdspResolvedUrl, storageToken, options, controller) => {
347
+ return downloadSnapshot(finalOdspResolvedUrl, storageToken, this.logger, options, this.snapshotFormatFetchType, controller, this.epochTracker, scenarioName);
348
+ };
349
+ const putInCache = async (valueWithEpoch) => {
350
+ return this.cache.persistedCache.put(createCacheSnapshotKey(this.odspResolvedUrl),
351
+ // Epoch tracker will add the epoch and version to the value here. So just send value to cache.
352
+ valueWithEpoch.value);
353
+ };
354
+ const removeEntries = async () => this.cache.persistedCache.removeEntries();
355
+ try {
356
+ const odspSnapshot = await fetchSnapshotWithRedeem(this.odspResolvedUrl, this.getStorageToken, snapshotOptions, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader, this.logger, snapshotDownloader, putInCache, removeEntries, this.hostPolicy.enableRedeemFallback);
357
+ return odspSnapshot;
358
+ }
359
+ catch (error) {
360
+ const errorType = error.errorType;
361
+ // If the snapshot size is too big and the host specified the size limitation(specified in hostSnapshotOptions), then don't try to fetch the snapshot again.
362
+ if (errorType === OdspErrorType.snapshotTooBig &&
363
+ hostSnapshotOptions?.mds !== undefined &&
364
+ this.hostPolicy.summarizerClient !== true) {
365
+ throw error;
366
+ }
367
+ // If the first snapshot request was with blobs and we either timed out or the size was too big, then try to fetch without blobs.
368
+ if ((errorType === OdspErrorType.snapshotTooBig ||
369
+ errorType === OdspErrorType.fetchTimeout) &&
370
+ snapshotOptions.blobs) {
371
+ this.logger.sendErrorEvent({
372
+ eventName: "TreeLatest_SecondCall",
373
+ errorType,
374
+ });
375
+ const snapshotOptionsWithoutBlobs = {
376
+ ...snapshotOptions,
377
+ blobs: 0,
378
+ mds: undefined,
379
+ timeout: undefined,
380
+ };
381
+ const odspSnapshot = await fetchSnapshotWithRedeem(this.odspResolvedUrl, this.getStorageToken, snapshotOptionsWithoutBlobs, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader, this.logger, snapshotDownloader, putInCache, removeEntries, this.hostPolicy.enableRedeemFallback);
382
+ return odspSnapshot;
383
+ }
384
+ throw error;
385
+ }
386
+ }
387
+ async uploadSummaryWithContext(summary, context) {
388
+ this.checkSnapshotUrl();
389
+ // Set the module promise right away, so as to not call it twice.
390
+ if (this.summaryModuleP === undefined) {
391
+ this.summaryModuleP = this.getDelayLoadedSummaryManager();
392
+ }
393
+ // Enable flushing only if we have single commit summary and this is not the initial summary for an empty file
394
+ if (".protocol" in summary.tree && context.ackHandle !== undefined) {
395
+ let retry = 1;
396
+ for (;;) {
397
+ const result = await this.flushCallback();
398
+ const seq = result.lastPersistedSequenceNumber;
399
+ if (seq !== undefined && seq >= context.referenceSequenceNumber) {
400
+ break;
401
+ }
402
+ if (retry > 3) {
403
+ this.logger.sendErrorEvent({
404
+ eventName: "FlushFailure",
405
+ ...result,
406
+ retry,
407
+ referenceSequenceNumber: context.referenceSequenceNumber,
408
+ });
409
+ break;
410
+ }
411
+ this.logger.sendPerformanceEvent({
412
+ eventName: "FlushExtraCall",
413
+ ...result,
414
+ retry,
415
+ referenceSequenceNumber: context.referenceSequenceNumber,
416
+ });
417
+ retry++;
418
+ await delay(1000 * (result.retryAfter ?? 1));
419
+ }
420
+ }
421
+ if (!this.odspSummaryUploadManager) {
422
+ this.odspSummaryUploadManager = await this.summaryModuleP
423
+ .then(async (m) => {
424
+ this.odspSummaryModuleLoaded = true;
425
+ return m;
426
+ })
427
+ .catch((error) => {
428
+ this.odspSummaryModuleLoaded = false;
429
+ throw error;
430
+ });
431
+ }
432
+ assert(this.odspSummaryUploadManager !== undefined, 0x56e /* summary upload manager should have been initialized */);
433
+ const id = await this.odspSummaryUploadManager.writeSummaryTree(summary, context);
434
+ return id;
435
+ }
436
+ async getDelayLoadedSummaryManager() {
437
+ assert(this.odspSummaryModuleLoaded === false, 0x56f /* Should be loaded only once */);
438
+ const module = await import("./odspSummaryUploadManager.mjs").then((m) => {
439
+ this.logger.sendTelemetryEvent({ eventName: "SummaryModuleLoaded" });
440
+ return m;
441
+ })
442
+ .catch((error) => {
443
+ this.logger.sendErrorEvent({ eventName: "SummaryModuleLoadFailed" }, error);
444
+ throw error;
445
+ });
446
+ this.odspSummaryUploadManager = new module.OdspSummaryUploadManager(this.odspResolvedUrl.endpoints.snapshotStorageUrl, this.getStorageToken, this.logger, this.epochTracker, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader, this.relayServiceTenantAndSessionId);
447
+ return this.odspSummaryUploadManager;
448
+ }
449
+ checkSnapshotUrl() {
450
+ if (!this.snapshotUrl) {
451
+ throw new NonRetryableError("Method failed because no snapshot url was available", DriverErrorType.genericError, { driverVersion });
452
+ }
453
+ }
454
+ checkAttachmentPOSTUrl() {
455
+ if (!this.attachmentPOSTUrl) {
456
+ throw new NonRetryableError("Method failed because no attachment POST url was available", DriverErrorType.genericError, { driverVersion });
457
+ }
458
+ }
459
+ checkAttachmentGETUrl() {
460
+ if (!this.attachmentGETUrl) {
461
+ throw new NonRetryableError("Method failed because no attachment GET url was available", DriverErrorType.genericError, { driverVersion });
462
+ }
463
+ }
464
+ async fetchTreeFromSnapshot(id, scenarioName) {
465
+ return getWithRetryForTokenRefresh(async (options) => {
466
+ const storageToken = await this.getStorageToken(options, "ReadCommit");
467
+ const snapshotDownloader = async (url, fetchOptions) => {
468
+ return this.epochTracker.fetchAndParseAsJSON(url, fetchOptions, "snapshotTree", undefined, scenarioName);
469
+ };
470
+ const snapshot = await fetchSnapshot(this.snapshotUrl, storageToken, id, this.fetchFullSnapshot, !!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader, this.logger, snapshotDownloader);
471
+ let treeId = "";
472
+ if (snapshot.snapshotTree) {
473
+ assert(snapshot.snapshotTree.id !== undefined, 0x222 /* "Root tree should contain the id!!" */);
474
+ treeId = snapshot.snapshotTree.id;
475
+ this.setRootTree(treeId, snapshot.snapshotTree);
476
+ }
477
+ if (snapshot.blobs) {
478
+ this.initBlobsCache(snapshot.blobs);
479
+ }
480
+ // If the version id doesn't match with the id of the tree, then use the id of first tree which in that case
481
+ // will be the actual id of tree to be fetched.
482
+ return this.commitCache.get(id) ?? this.commitCache.get(treeId);
483
+ });
484
+ }
485
+ }
486
+ //# sourceMappingURL=odspDocumentStorageManager.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspDocumentStorageManager.mjs","sourceRoot":"","sources":["../src/odspDocumentStorageManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,aAAa,EAEb,yBAAyB,EACzB,cAAc,EACd,cAAc,EACd,gBAAgB,GAChB,MAAM,iCAAiC;OACjC,EAAE,WAAW,EAAE,MAAM,8BAA8B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X,YAAsC,EACrC,EAAE;gBACH,OAAO,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAC3C,GAAG,EACH,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,CACZ,CAAC;YACH,CAAC,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,aAAa,CACnC,IAAI,CAAC,WAAY,EACjB,YAAY,EACZ,EAAE,EACF,IAAI,CAAC,iBAAiB,EACtB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,sCAAsC,EACxE,IAAI,CAAC,MAAM,EACX,kBAAkB,CAClB,CAAC;YACF,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,IAAI,QAAQ,CAAC,YAAY,EAAE;gBAC1B,MAAM,CACL,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,SAAS,EACtC,KAAK,CAAC,yCAAyC,CAC/C,CAAC;gBACF,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;aAChD;YACD,IAAI,QAAQ,CAAC,KAAK,EAAE;gBACnB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACpC;YACD,4GAA4G;YAC5G,+CAA+C;YAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tgenerateStack,\n\tITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n\tnormalizeError,\n\toverwriteStack,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { assert, delay } from \"@fluidframework/core-utils\";\nimport { LogLevel } from \"@fluidframework/core-interfaces\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { promiseRaceWithWinner } from \"@fluidframework/driver-base\";\nimport { ISummaryContext, DriverErrorType, FetchSource } from \"@fluidframework/driver-definitions\";\nimport { RateLimiter, NonRetryableError } from \"@fluidframework/driver-utils\";\nimport {\n\tIOdspResolvedUrl,\n\tISnapshotOptions,\n\tOdspErrorType,\n\tInstrumentedStorageTokenFetcher,\n\tgetKeyForCacheEntry,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport {\n\tIDocumentStorageGetVersionsResponse,\n\tHostStoragePolicyInternal,\n\tIVersionedValueWithEpoch,\n\tISnapshotCachedEntry,\n} from \"./contracts\";\nimport {\n\tdownloadSnapshot,\n\tevalBlobsAndTrees,\n\tfetchSnapshot,\n\tfetchSnapshotWithRedeem,\n\tSnapshotFormatSupportType,\n} from \"./fetchSnapshot\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth\";\nimport { IOdspCache, IPrefetchSnapshotContents } from \"./odspCache\";\nimport { createCacheSnapshotKey, getWithRetryForTokenRefresh } from \"./odspUtils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { EpochTracker } from \"./epochTracker\";\nimport type { OdspSummaryUploadManager } from \"./odspSummaryUploadManager\";\nimport { FlushResult } from \"./odspDocumentDeltaConnection\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { OdspDocumentStorageServiceBase } from \"./odspDocumentStorageServiceBase\";\n\nexport const defaultSummarizerCacheExpiryTimeout: number = 60 * 1000; // 60 seconds.\n\ninterface GetVersionsTelemetryProps {\n\tcacheEntryAge?: number;\n\tcacheSummarizerExpired?: boolean;\n}\n\nexport class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {\n\tprivate odspSummaryModuleLoaded: boolean = false;\n\tprivate summaryModuleP: Promise<OdspSummaryUploadManager> | undefined;\n\tprivate odspSummaryUploadManager: OdspSummaryUploadManager | undefined;\n\n\tprivate firstVersionCall = true;\n\tprivate _isFirstSnapshotFromNetwork: boolean | undefined;\n\tprivate readonly documentId: string;\n\tprivate readonly snapshotUrl: string | undefined;\n\tprivate readonly attachmentPOSTUrl: string | undefined;\n\tprivate readonly attachmentGETUrl: string | undefined;\n\t// Driver specified limits for snapshot size and time.\n\t/**\n\t * NOTE: While commit cfff6e3 added restrictions to prevent large payloads, snapshot failures will continue to\n\t * happen until blob request throttling is implemented. Until then, as a temporary fix we set arbitrarily large\n\t * snapshot size and timeout limits so that such failures are unlikely to occur.\n\t */\n\tprivate readonly maxSnapshotSizeLimit = 500000000; // 500 MB\n\tprivate readonly maxSnapshotFetchTimeout = 120000; // 2 min\n\n\t// limits the amount of parallel \"attachment\" blob uploads\n\tprivate readonly createBlobRateLimiter = new RateLimiter(1);\n\n\tconstructor(\n\t\tprivate readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tprivate readonly getStorageToken: InstrumentedStorageTokenFetcher,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly fetchFullSnapshot: boolean,\n\t\tprivate readonly cache: IOdspCache,\n\t\tprivate readonly hostPolicy: HostStoragePolicyInternal,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly flushCallback: () => Promise<FlushResult>,\n\t\tprivate readonly relayServiceTenantAndSessionId: () => string | undefined,\n\t\tprivate readonly snapshotFormatFetchType?: SnapshotFormatSupportType,\n\t) {\n\t\tsuper(loggerToMonitoringContext(logger).config);\n\n\t\tthis.documentId = this.odspResolvedUrl.hashedDocumentId;\n\t\tthis.snapshotUrl = this.odspResolvedUrl.endpoints.snapshotStorageUrl;\n\t\tthis.attachmentPOSTUrl = this.odspResolvedUrl.endpoints.attachmentPOSTStorageUrl;\n\t\tthis.attachmentGETUrl = this.odspResolvedUrl.endpoints.attachmentGETStorageUrl;\n\t}\n\n\tpublic get isFirstSnapshotFromNetwork() {\n\t\treturn this._isFirstSnapshotFromNetwork;\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {\n\t\tthis.checkAttachmentPOSTUrl();\n\n\t\tconst response = await getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"CreateBlob\");\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t`${this.attachmentPOSTUrl}/content`,\n\t\t\t\tstorageToken,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\t\t\theaders[\"Content-Type\"] = \"application/octet-stream\";\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"createBlob\",\n\t\t\t\t\tsize: file.byteLength,\n\t\t\t\t\twaitQueueLength: this.createBlobRateLimiter.waitQueueLength,\n\t\t\t\t},\n\t\t\t\tasync (event) => {\n\t\t\t\t\tconst res = await this.createBlobRateLimiter.schedule(async () =>\n\t\t\t\t\t\tthis.epochTracker.fetchAndParseAsJSON<api.ICreateBlobResponse>(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbody: file,\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"createBlob\",\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\tblobId: res.content.id,\n\t\t\t\t\t\t...res.propsToLog,\n\t\t\t\t\t});\n\t\t\t\t\treturn res;\n\t\t\t\t},\n\t\t\t);\n\t\t});\n\n\t\treturn response.content;\n\t}\n\n\tprotected async fetchBlobFromStorage(blobId: string, evicted: boolean): Promise<ArrayBuffer> {\n\t\tthis.checkAttachmentGETUrl();\n\n\t\tconst blob = await getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"GetBlob\");\n\t\t\tconst unAuthedUrl = `${this.attachmentGETUrl}/${encodeURIComponent(blobId)}/content`;\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\tunAuthedUrl,\n\t\t\t\tstorageToken,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"readDataBlob\",\n\t\t\t\t\tblobId,\n\t\t\t\t\tevicted,\n\t\t\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t\t\t\twaitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,\n\t\t\t\t},\n\t\t\t\tasync (event) => {\n\t\t\t\t\tconst res = await this.epochTracker.fetchArray(url, { headers }, \"blob\");\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\twaitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,\n\t\t\t\t\t\t...res.propsToLog,\n\t\t\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\t\t});\n\t\t\t\t\tconst cacheControl = res.headers.get(\"cache-control\");\n\t\t\t\t\tif (\n\t\t\t\t\t\tcacheControl === undefined ||\n\t\t\t\t\t\t!(cacheControl.includes(\"private\") || cacheControl.includes(\"public\"))\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\t\t\teventName: \"NonCacheableBlob\",\n\t\t\t\t\t\t\tcacheControl,\n\t\t\t\t\t\t\tblobId,\n\t\t\t\t\t\t\t...res.propsToLog,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn res.content;\n\t\t\t\t},\n\t\t\t);\n\t\t});\n\t\tthis.blobCache.setBlob(blobId, blob);\n\t\treturn blob;\n\t}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: api.IVersion,\n\t\tscenarioName?: string,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<api.ISnapshotTree | null> {\n\t\tif (!this.snapshotUrl) {\n\t\t\treturn null;\n\t\t}\n\t\treturn super.getSnapshotTree(version, scenarioName);\n\t}\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tblobid: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<api.IVersion[]> {\n\t\t// Regular load workflow uses blobId === documentID to indicate \"latest\".\n\t\tif (blobid !== this.documentId && blobid) {\n\t\t\t// FluidFetch & FluidDebugger tools use empty sting to query for versions\n\t\t\t// In such case we need to make a call against SPO to give full picture to the tool.\n\t\t\t// Otherwise, each commit calls getVersions but odsp doesn't have a history for each commit\n\t\t\t// return the blobid as is\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: blobid,\n\t\t\t\t\ttreeId: undefined!,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\t// Can't really make a call if we do not have URL\n\t\tif (!this.snapshotUrl) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// If count is one, we can use the trees/latest API, which returns the latest version and trees in a single request for better performance\n\t\tif (count === 1 && (blobid === null || blobid === this.documentId)) {\n\t\t\tconst hostSnapshotOptions = this.hostPolicy.snapshotOptions;\n\t\t\tconst odspSnapshotCacheValue: ISnapshotContents = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{ eventName: \"ObtainSnapshot\", fetchSource },\n\t\t\t\tasync (event: PerformanceEvent) => {\n\t\t\t\t\tconst props: GetVersionsTelemetryProps = {};\n\t\t\t\t\tlet cacheLookupTimeInSerialFetch = 0;\n\t\t\t\t\tlet retrievedSnapshot:\n\t\t\t\t\t\t| ISnapshotContents\n\t\t\t\t\t\t| IPrefetchSnapshotContents\n\t\t\t\t\t\t| undefined;\n\n\t\t\t\t\tlet method: string;\n\t\t\t\t\tlet prefetchWaitStartTime: number = performance.now();\n\t\t\t\t\tif (fetchSource === FetchSource.noCache) {\n\t\t\t\t\t\tretrievedSnapshot = await this.fetchSnapshot(\n\t\t\t\t\t\t\thostSnapshotOptions,\n\t\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmethod = \"networkOnly\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Here's the logic to grab the persistent cache snapshot implemented by the host\n\t\t\t\t\t\t// Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions\n\t\t\t\t\t\tconst cachedSnapshotP: Promise<ISnapshotContents | undefined> =\n\t\t\t\t\t\t\tthis.epochTracker\n\t\t\t\t\t\t\t\t.get(createCacheSnapshotKey(this.odspResolvedUrl))\n\t\t\t\t\t\t\t\t.then(async (snapshotCachedEntry: ISnapshotCachedEntry) => {\n\t\t\t\t\t\t\t\t\tif (snapshotCachedEntry !== undefined) {\n\t\t\t\t\t\t\t\t\t\t// If the cached entry does not contain the entry time, then assign it a default of 30 days old.\n\t\t\t\t\t\t\t\t\t\tconst age =\n\t\t\t\t\t\t\t\t\t\t\tDate.now() -\n\t\t\t\t\t\t\t\t\t\t\t(snapshotCachedEntry.cacheEntryTime ??\n\t\t\t\t\t\t\t\t\t\t\t\tDate.now() - 30 * 24 * 60 * 60 * 1000);\n\n\t\t\t\t\t\t\t\t\t\t// In order to decrease the number of times we have to execute a snapshot refresh,\n\t\t\t\t\t\t\t\t\t\t// if this is the summarizer and we have a cache entry but it is past the defaultSummarizerCacheExpiryTimeout,\n\t\t\t\t\t\t\t\t\t\t// force the network retrieval instead as there might be a more recent snapshot available.\n\t\t\t\t\t\t\t\t\t\t// See: https://github.com/microsoft/FluidFramework/issues/8995 for additional information.\n\t\t\t\t\t\t\t\t\t\tif (this.hostPolicy.summarizerClient) {\n\t\t\t\t\t\t\t\t\t\t\tif (age > defaultSummarizerCacheExpiryTimeout) {\n\t\t\t\t\t\t\t\t\t\t\t\tprops.cacheSummarizerExpired = true;\n\t\t\t\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tprops.cacheSummarizerExpired = false;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t// Record the cache age\n\t\t\t\t\t\t\t\t\t\tprops.cacheEntryAge = age;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturn snapshotCachedEntry;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t// Based on the concurrentSnapshotFetch policy:\n\t\t\t\t\t\t// Either retrieve both the network and cache snapshots concurrently and pick the first to return,\n\t\t\t\t\t\t// or grab the cache value and then the network value if the cache value returns undefined.\n\t\t\t\t\t\t// For summarizer which could call this during refreshing of summary parent, always use the cache\n\t\t\t\t\t\t// first. Also for other clients, if it is not critical path which is determined by firstVersionCall,\n\t\t\t\t\t\t// then also check the cache first.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis.firstVersionCall &&\n\t\t\t\t\t\t\tthis.hostPolicy.concurrentSnapshotFetch &&\n\t\t\t\t\t\t\t!this.hostPolicy.summarizerClient\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst networkSnapshotP = this.fetchSnapshot(\n\t\t\t\t\t\t\t\thostSnapshotOptions,\n\t\t\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// Ensure that failures on both paths are ignored initially.\n\t\t\t\t\t\t\t// I.e. if cache fails for some reason, we will proceed with network result.\n\t\t\t\t\t\t\t// And vice versa - if (for example) client is offline and network request fails first, we\n\t\t\t\t\t\t\t// do want to attempt to succeed with cached data!\n\t\t\t\t\t\t\tconst promiseRaceWinner = await promiseRaceWithWinner([\n\t\t\t\t\t\t\t\tcachedSnapshotP.catch(() => undefined),\n\t\t\t\t\t\t\t\tnetworkSnapshotP.catch(() => undefined),\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tretrievedSnapshot = promiseRaceWinner.value;\n\t\t\t\t\t\t\tmethod = promiseRaceWinner.index === 0 ? \"cache\" : \"network\";\n\n\t\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\t\t// if network failed -> wait for cache ( then return network failure)\n\t\t\t\t\t\t\t\t// If cache returned empty or failed -> wait for network (success of failure)\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tif (promiseRaceWinner.index === 1) {\n\t\t\t\t\t\t\t\t\t\tretrievedSnapshot = await cachedSnapshotP;\n\t\t\t\t\t\t\t\t\t\tmethod = \"cache\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\t\t\t\tretrievedSnapshot = await networkSnapshotP;\n\t\t\t\t\t\t\t\t\t\tmethod = \"network\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\t\t\t\t\t// The call stacks of any errors thrown by cached snapshot or network snapshot aren't very useful:\n\t\t\t\t\t\t\t\t\t// they get truncated at this stack frame due to the promise race and how v8 tracks async stack traces--\n\t\t\t\t\t\t\t\t\t// see https://v8.dev/docs/stack-trace-api#async-stack-traces and the \"zero-cost async stack traces\" document\n\t\t\t\t\t\t\t\t\t// linked there. https://v8.dev/blog/fast-async#await-under-the-hood may also be helpful for context on internals.\n\t\t\t\t\t\t\t\t\t// Regenerating the stack at this level provides more information for logged errors.\n\t\t\t\t\t\t\t\t\t// Once FF uses an ES2021 target, we could convert the above promise race to use `Promise.any` + AggregateError and\n\t\t\t\t\t\t\t\t\t// get similar quality stacks with less hand-crafted code.\n\t\t\t\t\t\t\t\t\tconst innerStack = (err as Error).stack;\n\t\t\t\t\t\t\t\t\tconst normalizedError = normalizeError(err);\n\t\t\t\t\t\t\t\t\tnormalizedError.addTelemetryProperties({ innerStack });\n\n\t\t\t\t\t\t\t\t\tconst newStack = `<<STACK TRUNCATED: see innerStack property>> \\n${generateStack()}`;\n\t\t\t\t\t\t\t\t\toverwriteStack(normalizedError, newStack);\n\n\t\t\t\t\t\t\t\t\tthrow normalizedError;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Note: There's a race condition here - another caller may come past the undefined check\n\t\t\t\t\t\t\t// while the first caller is awaiting later async code in this block.\n\t\t\t\t\t\t\tconst startTime = performance.now();\n\t\t\t\t\t\t\tretrievedSnapshot = await cachedSnapshotP;\n\t\t\t\t\t\t\tcacheLookupTimeInSerialFetch = performance.now() - startTime;\n\t\t\t\t\t\t\tmethod = retrievedSnapshot !== undefined ? \"cache\" : \"network\";\n\n\t\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\t\tprefetchWaitStartTime = performance.now();\n\t\t\t\t\t\t\t\tretrievedSnapshot = await this.fetchSnapshot(\n\t\t\t\t\t\t\t\t\thostSnapshotOptions,\n\t\t\t\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (method === \"network\") {\n\t\t\t\t\t\tprops.cacheEntryAge = undefined;\n\t\t\t\t\t}\n\t\t\t\t\tif (this.firstVersionCall) {\n\t\t\t\t\t\tthis._isFirstSnapshotFromNetwork = method === \"cache\" ? false : true;\n\t\t\t\t\t}\n\t\t\t\t\tconst prefetchStartTime: number | undefined = (\n\t\t\t\t\t\tretrievedSnapshot as IPrefetchSnapshotContents\n\t\t\t\t\t).prefetchStartTime;\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tmethod,\n\t\t\t\t\t\tavoidPrefetchSnapshotCache: this.hostPolicy.avoidPrefetchSnapshotCache,\n\t\t\t\t\t\t...evalBlobsAndTrees(retrievedSnapshot),\n\t\t\t\t\t\tcacheLookupTimeInSerialFetch,\n\t\t\t\t\t\tprefetchSavedDuration:\n\t\t\t\t\t\t\tprefetchStartTime !== undefined && method !== \"cache\"\n\t\t\t\t\t\t\t\t? prefetchWaitStartTime - prefetchStartTime\n\t\t\t\t\t\t\t\t: undefined,\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 stTime = performance.now();\n\t\t\t// Don't override ops which were fetched during initial load, since we could still need them.\n\t\t\tconst id = this.initializeFromSnapshot(odspSnapshotCacheValue, this.firstVersionCall);\n\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"SnapshotInitializeTime\",\n\t\t\t\t\tduration: performance.now() - stTime,\n\t\t\t\t},\n\t\t\t\tundefined,\n\t\t\t\tLogLevel.verbose,\n\t\t\t);\n\t\t\tthis.firstVersionCall = false;\n\n\t\t\treturn id ? [{ id, treeId: undefined! }] : [];\n\t\t}\n\n\t\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"GetVersions\");\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t`${this.snapshotUrl}/versions?top=${count}`,\n\t\t\t\tstorageToken,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\n\t\t\t// Fetch the latest snapshot versions for the document\n\t\t\tconst response = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"getVersions\",\n\t\t\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t\t\t},\n\t\t\t\tasync () =>\n\t\t\t\t\tthis.epochTracker.fetchAndParseAsJSON<IDocumentStorageGetVersionsResponse>(\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t{ headers },\n\t\t\t\t\t\t\"versions\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t),\n\t\t\t);\n\t\t\tconst versionsResponse = response.content;\n\t\t\tif (!versionsResponse) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"No response from /versions endpoint\",\n\t\t\t\t\tDriverErrorType.genericNetworkError,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!Array.isArray(versionsResponse.value)) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"Incorrect response from /versions endpoint, expected an array\",\n\t\t\t\t\tDriverErrorType.genericNetworkError,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn versionsResponse.value.map((version) => {\n\t\t\t\treturn {\n\t\t\t\t\tid: version.id,\n\t\t\t\t\ttreeId: undefined!,\n\t\t\t\t};\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate async fetchSnapshot(\n\t\thostSnapshotOptions: ISnapshotOptions | undefined,\n\t\tscenarioName?: string,\n\t) {\n\t\treturn this.fetchSnapshotCore(hostSnapshotOptions, scenarioName).catch((error) => {\n\t\t\t// Issue #5895:\n\t\t\t// If we are offline, this error is retryable. But that means that RetriableDocumentStorageService\n\t\t\t// will run in circles calling getSnapshotTree, which would result in OdspDocumentStorageService class\n\t\t\t// going getVersions / individual blob download path. This path is very slow, and will not work with\n\t\t\t// delay-loaded data stores and ODSP storage deleting old snapshots and blobs.\n\t\t\tif (typeof error === \"object\" && error !== null) {\n\t\t\t\terror.canRetry = false;\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tprivate async fetchSnapshotCore(\n\t\thostSnapshotOptions: ISnapshotOptions | undefined,\n\t\tscenarioName?: string,\n\t): Promise<ISnapshotContents | IPrefetchSnapshotContents> {\n\t\t// Don't look into cache, if the host specifically tells us so.\n\t\tif (!this.hostPolicy.avoidPrefetchSnapshotCache) {\n\t\t\tconst prefetchCacheKey = getKeyForCacheEntry(\n\t\t\t\tcreateCacheSnapshotKey(this.odspResolvedUrl),\n\t\t\t);\n\t\t\tconst result = await this.cache.snapshotPrefetchResultCache\n\t\t\t\t?.get(prefetchCacheKey)\n\t\t\t\t?.then(async (response) => {\n\t\t\t\t\t// Remove it from cache once used.\n\t\t\t\t\tthis.cache.snapshotPrefetchResultCache.remove(prefetchCacheKey);\n\t\t\t\t\t// Validate the epoch from the prefetched snapshot result.\n\t\t\t\t\tawait this.epochTracker.validateEpoch(response.fluidEpoch, \"treesLatest\");\n\t\t\t\t\treturn response;\n\t\t\t\t})\n\t\t\t\t.catch(async (err) => {\n\t\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"PrefetchSnapshotError\",\n\t\t\t\t\t\t\tconcurrentSnapshotFetch: this.hostPolicy.concurrentSnapshotFetch,\n\t\t\t\t\t\t},\n\t\t\t\t\t\terr,\n\t\t\t\t\t);\n\t\t\t\t\treturn undefined;\n\t\t\t\t});\n\t\t\t// If the prefetch call, is successful, then return the contents otherwise as backup for now, just\n\t\t\t// proceed with the old snapshot fetch flow.\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tconst snapshotOptions: ISnapshotOptions = {\n\t\t\tmds: this.maxSnapshotSizeLimit,\n\t\t\t...hostSnapshotOptions,\n\t\t\ttimeout: hostSnapshotOptions?.timeout\n\t\t\t\t? Math.min(hostSnapshotOptions.timeout, this.maxSnapshotFetchTimeout)\n\t\t\t\t: this.maxSnapshotFetchTimeout,\n\t\t};\n\n\t\t// No limit on size of snapshot or time to fetch, as otherwise we fail all clients to summarize\n\t\tif (this.hostPolicy.summarizerClient) {\n\t\t\tsnapshotOptions.mds = undefined;\n\t\t\tsnapshotOptions.timeout = undefined;\n\t\t}\n\n\t\tconst snapshotDownloader = async (\n\t\t\tfinalOdspResolvedUrl: IOdspResolvedUrl,\n\t\t\tstorageToken: string,\n\t\t\toptions: ISnapshotOptions | undefined,\n\t\t\tcontroller?: AbortController,\n\t\t) => {\n\t\t\treturn downloadSnapshot(\n\t\t\t\tfinalOdspResolvedUrl,\n\t\t\t\tstorageToken,\n\t\t\t\tthis.logger,\n\t\t\t\toptions,\n\t\t\t\tthis.snapshotFormatFetchType,\n\t\t\t\tcontroller,\n\t\t\t\tthis.epochTracker,\n\t\t\t\tscenarioName,\n\t\t\t);\n\t\t};\n\t\tconst putInCache = async (valueWithEpoch: IVersionedValueWithEpoch) => {\n\t\t\treturn this.cache.persistedCache.put(\n\t\t\t\tcreateCacheSnapshotKey(this.odspResolvedUrl),\n\t\t\t\t// Epoch tracker will add the epoch and version to the value here. So just send value to cache.\n\t\t\t\tvalueWithEpoch.value,\n\t\t\t);\n\t\t};\n\t\tconst removeEntries = async () => this.cache.persistedCache.removeEntries();\n\t\ttry {\n\t\t\tconst odspSnapshot = await fetchSnapshotWithRedeem(\n\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\tthis.getStorageToken,\n\t\t\t\tsnapshotOptions,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\tthis.logger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t\tputInCache,\n\t\t\t\tremoveEntries,\n\t\t\t\tthis.hostPolicy.enableRedeemFallback,\n\t\t\t);\n\t\t\treturn odspSnapshot;\n\t\t} catch (error: any) {\n\t\t\tconst errorType = error.errorType;\n\t\t\t// If the snapshot size is too big and the host specified the size limitation(specified in hostSnapshotOptions), then don't try to fetch the snapshot again.\n\t\t\tif (\n\t\t\t\terrorType === OdspErrorType.snapshotTooBig &&\n\t\t\t\thostSnapshotOptions?.mds !== undefined &&\n\t\t\t\tthis.hostPolicy.summarizerClient !== true\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\t// If the first snapshot request was with blobs and we either timed out or the size was too big, then try to fetch without blobs.\n\t\t\tif (\n\t\t\t\t(errorType === OdspErrorType.snapshotTooBig ||\n\t\t\t\t\terrorType === OdspErrorType.fetchTimeout) &&\n\t\t\t\tsnapshotOptions.blobs\n\t\t\t) {\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"TreeLatest_SecondCall\",\n\t\t\t\t\terrorType,\n\t\t\t\t});\n\t\t\t\tconst snapshotOptionsWithoutBlobs: ISnapshotOptions = {\n\t\t\t\t\t...snapshotOptions,\n\t\t\t\t\tblobs: 0,\n\t\t\t\t\tmds: undefined,\n\t\t\t\t\ttimeout: undefined,\n\t\t\t\t};\n\t\t\t\tconst odspSnapshot = await fetchSnapshotWithRedeem(\n\t\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\t\tthis.getStorageToken,\n\t\t\t\t\tsnapshotOptionsWithoutBlobs,\n\t\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\tthis.logger,\n\t\t\t\t\tsnapshotDownloader,\n\t\t\t\t\tputInCache,\n\t\t\t\t\tremoveEntries,\n\t\t\t\t\tthis.hostPolicy.enableRedeemFallback,\n\t\t\t\t);\n\t\t\t\treturn odspSnapshot;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: api.ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tthis.checkSnapshotUrl();\n\n\t\t// Set the module promise right away, so as to not call it twice.\n\t\tif (this.summaryModuleP === undefined) {\n\t\t\tthis.summaryModuleP = this.getDelayLoadedSummaryManager();\n\t\t}\n\n\t\t// Enable flushing only if we have single commit summary and this is not the initial summary for an empty file\n\t\tif (\".protocol\" in summary.tree && context.ackHandle !== undefined) {\n\t\t\tlet retry = 1;\n\t\t\tfor (;;) {\n\t\t\t\tconst result = await this.flushCallback();\n\t\t\t\tconst seq = result.lastPersistedSequenceNumber;\n\t\t\t\tif (seq !== undefined && seq >= context.referenceSequenceNumber) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (retry > 3) {\n\t\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\t\teventName: \"FlushFailure\",\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tretry,\n\t\t\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"FlushExtraCall\",\n\t\t\t\t\t...result,\n\t\t\t\t\tretry,\n\t\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t\t});\n\n\t\t\t\tretry++;\n\t\t\t\tawait delay(1000 * (result.retryAfter ?? 1));\n\t\t\t}\n\t\t}\n\n\t\tif (!this.odspSummaryUploadManager) {\n\t\t\tthis.odspSummaryUploadManager = await this.summaryModuleP\n\t\t\t\t.then(async (m) => {\n\t\t\t\t\tthis.odspSummaryModuleLoaded = true;\n\t\t\t\t\treturn m;\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.odspSummaryModuleLoaded = false;\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t}\n\n\t\tassert(\n\t\t\tthis.odspSummaryUploadManager !== undefined,\n\t\t\t0x56e /* summary upload manager should have been initialized */,\n\t\t);\n\t\tconst id = await this.odspSummaryUploadManager.writeSummaryTree(summary, context);\n\t\treturn id;\n\t}\n\n\tprivate async getDelayLoadedSummaryManager() {\n\t\tassert(this.odspSummaryModuleLoaded === false, 0x56f /* Should be loaded only once */);\n\t\tconst module = await import(\n\t\t\t/* webpackChunkName: \"summaryModule\" */ \"./odspSummaryUploadManager.js\"\n\t\t)\n\t\t\t.then((m) => {\n\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: \"SummaryModuleLoaded\" });\n\t\t\t\treturn m;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"SummaryModuleLoadFailed\" }, error);\n\t\t\t\tthrow error;\n\t\t\t});\n\t\tthis.odspSummaryUploadManager = new module.OdspSummaryUploadManager(\n\t\t\tthis.odspResolvedUrl.endpoints.snapshotStorageUrl,\n\t\t\tthis.getStorageToken,\n\t\t\tthis.logger,\n\t\t\tthis.epochTracker,\n\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\tthis.relayServiceTenantAndSessionId,\n\t\t);\n\t\treturn this.odspSummaryUploadManager;\n\t}\n\n\tprivate checkSnapshotUrl() {\n\t\tif (!this.snapshotUrl) {\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"Method failed because no snapshot url was available\",\n\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t{ driverVersion },\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate checkAttachmentPOSTUrl() {\n\t\tif (!this.attachmentPOSTUrl) {\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"Method failed because no attachment POST url was available\",\n\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t{ driverVersion },\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate checkAttachmentGETUrl() {\n\t\tif (!this.attachmentGETUrl) {\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"Method failed because no attachment GET url was available\",\n\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t{ driverVersion },\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected async fetchTreeFromSnapshot(\n\t\tid: string,\n\t\tscenarioName?: string,\n\t): Promise<api.ISnapshotTree | undefined> {\n\t\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"ReadCommit\");\n\t\t\tconst snapshotDownloader = async (\n\t\t\t\turl: string,\n\t\t\t\tfetchOptions: { [index: string]: any },\n\t\t\t) => {\n\t\t\t\treturn this.epochTracker.fetchAndParseAsJSON(\n\t\t\t\t\turl,\n\t\t\t\t\tfetchOptions,\n\t\t\t\t\t\"snapshotTree\",\n\t\t\t\t\tundefined,\n\t\t\t\t\tscenarioName,\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst snapshot = await fetchSnapshot(\n\t\t\t\tthis.snapshotUrl!,\n\t\t\t\tstorageToken,\n\t\t\t\tid,\n\t\t\t\tthis.fetchFullSnapshot,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\tthis.logger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t);\n\t\t\tlet treeId = \"\";\n\t\t\tif (snapshot.snapshotTree) {\n\t\t\t\tassert(\n\t\t\t\t\tsnapshot.snapshotTree.id !== undefined,\n\t\t\t\t\t0x222 /* \"Root tree should contain the id!!\" */,\n\t\t\t\t);\n\t\t\t\ttreeId = snapshot.snapshotTree.id;\n\t\t\t\tthis.setRootTree(treeId, snapshot.snapshotTree);\n\t\t\t}\n\t\t\tif (snapshot.blobs) {\n\t\t\t\tthis.initBlobsCache(snapshot.blobs);\n\t\t\t}\n\t\t\t// If the version id doesn't match with the id of the tree, then use the id of first tree which in that case\n\t\t\t// will be the actual id of tree to be fetched.\n\t\t\treturn this.commitCache.get(id) ?? this.commitCache.get(treeId);\n\t\t});\n\t}\n}\n"]}
@@ -2,9 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IDocumentStorageService, ISummaryContext, LoaderCachingPolicy } from "@fluidframework/driver-definitions";
5
+ import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext, FetchSource } from "@fluidframework/driver-definitions";
6
6
  import * as api from "@fluidframework/protocol-definitions";
7
- import { ISnapshotContents } from "./odspPublicUtils";
7
+ import { IConfigProvider } from "@fluidframework/telemetry-utils";
8
+ import { ISnapshotContents } from "./odspPublicUtils.mjs";
8
9
  declare class BlobCache {
9
10
  private blobCacheTimeout;
10
11
  private deferBlobCacheClear;
@@ -25,11 +26,8 @@ declare class BlobCache {
25
26
  setBlob(blobId: string, blob: ArrayBuffer): Map<string, ArrayBuffer> | undefined;
26
27
  }
27
28
  export declare abstract class OdspDocumentStorageServiceBase implements IDocumentStorageService {
28
- readonly policies: {
29
- caching: LoaderCachingPolicy;
30
- minBlobSize: number;
31
- maximumCacheDurationMs: number;
32
- };
29
+ readonly policies: IDocumentStorageServicePolicies;
30
+ constructor(config: IConfigProvider);
33
31
  protected readonly commitCache: Map<string, api.ISnapshotTree>;
34
32
  private readonly attributesBlobHandles;
35
33
  private _ops;
@@ -38,13 +36,13 @@ export declare abstract class OdspDocumentStorageServiceBase implements IDocumen
38
36
  set ops(ops: api.ISequencedDocumentMessage[] | undefined);
39
37
  get ops(): api.ISequencedDocumentMessage[] | undefined;
40
38
  get snapshotSequenceNumber(): number | undefined;
41
- get repositoryUrl(): string;
39
+ readonly repositoryUrl = "";
42
40
  abstract createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
43
41
  private readBlobCore;
44
42
  protected abstract fetchBlobFromStorage(blobId: string, evicted: boolean): Promise<ArrayBuffer>;
45
43
  readBlob(blobId: string): Promise<ArrayBufferLike>;
46
44
  getSnapshotTree(version?: api.IVersion, scenarioName?: string): Promise<api.ISnapshotTree | null>;
47
- abstract getVersions(blobid: string | null, count: number, scenarioName?: string): Promise<api.IVersion[]>;
45
+ abstract getVersions(blobid: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<api.IVersion[]>;
48
46
  abstract uploadSummaryWithContext(summary: api.ISummaryTree, context: ISummaryContext): Promise<string>;
49
47
  downloadSummary(commit: api.ISummaryHandle): Promise<api.ISummaryTree>;
50
48
  protected setRootTree(id: string, tree: api.ISnapshotTree): void;
@@ -52,7 +50,7 @@ export declare abstract class OdspDocumentStorageServiceBase implements IDocumen
52
50
  private readTree;
53
51
  protected abstract fetchTreeFromSnapshot(id: string, scenarioName?: string): Promise<api.ISnapshotTree | undefined>;
54
52
  private combineProtocolAndAppSnapshotTree;
55
- protected initializeFromSnapshot(odspSnapshotCacheValue: ISnapshotContents): string | undefined;
53
+ protected initializeFromSnapshot(odspSnapshotCacheValue: ISnapshotContents, cacheOps?: boolean): string | undefined;
56
54
  }
57
55
  export {};
58
56
  //# sourceMappingURL=odspDocumentStorageServiceBase.d.ts.map