@fluidframework/odsp-driver 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.246488

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (617) hide show
  1. package/.eslintrc.cjs +18 -3
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +44 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/api-report/odsp-driver.api.md +11 -12
  8. package/dist/ReadBufferUtils.d.ts.map +1 -1
  9. package/dist/ReadBufferUtils.js.map +1 -1
  10. package/dist/WriteBufferUtils.d.ts +1 -1
  11. package/dist/WriteBufferUtils.d.ts.map +1 -1
  12. package/dist/WriteBufferUtils.js +12 -12
  13. package/dist/WriteBufferUtils.js.map +1 -1
  14. package/dist/checkUrl.d.ts.map +1 -1
  15. package/dist/checkUrl.js +5 -3
  16. package/dist/checkUrl.js.map +1 -1
  17. package/dist/compactSnapshotParser.d.ts.map +1 -1
  18. package/dist/compactSnapshotParser.js +87 -69
  19. package/dist/compactSnapshotParser.js.map +1 -1
  20. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  21. package/dist/compactSnapshotWriter.js +25 -19
  22. package/dist/compactSnapshotWriter.js.map +1 -1
  23. package/dist/contracts.d.ts +10 -4
  24. package/dist/contracts.d.ts.map +1 -1
  25. package/dist/contracts.js.map +1 -1
  26. package/dist/createFile.d.ts +3 -3
  27. package/dist/createFile.d.ts.map +1 -1
  28. package/dist/createFile.js +30 -27
  29. package/dist/createFile.js.map +1 -1
  30. package/dist/createNewContainerOnExistingFile.d.ts +2 -2
  31. package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
  32. package/dist/createNewContainerOnExistingFile.js +14 -14
  33. package/dist/createNewContainerOnExistingFile.js.map +1 -1
  34. package/dist/createNewModule.d.ts +2 -2
  35. package/dist/createNewModule.d.ts.map +1 -1
  36. package/dist/createNewModule.js +4 -4
  37. package/dist/createNewModule.js.map +1 -1
  38. package/dist/createNewUtils.d.ts +2 -2
  39. package/dist/createNewUtils.d.ts.map +1 -1
  40. package/dist/createNewUtils.js +12 -8
  41. package/dist/createNewUtils.js.map +1 -1
  42. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  43. package/dist/createOdspCreateContainerRequest.js +6 -2
  44. package/dist/createOdspCreateContainerRequest.js.map +1 -1
  45. package/dist/createOdspUrl.d.ts +1 -1
  46. package/dist/createOdspUrl.d.ts.map +1 -1
  47. package/dist/createOdspUrl.js.map +1 -1
  48. package/dist/epochTracker.d.ts +10 -9
  49. package/dist/epochTracker.d.ts.map +1 -1
  50. package/dist/epochTracker.js +66 -43
  51. package/dist/epochTracker.js.map +1 -1
  52. package/dist/fetchSnapshot.d.ts +11 -8
  53. package/dist/fetchSnapshot.d.ts.map +1 -1
  54. package/dist/fetchSnapshot.js +79 -58
  55. package/dist/fetchSnapshot.js.map +1 -1
  56. package/dist/getFileLink.d.ts.map +1 -1
  57. package/dist/getFileLink.js +24 -17
  58. package/dist/getFileLink.js.map +1 -1
  59. package/dist/getQueryString.d.ts.map +1 -1
  60. package/dist/getQueryString.js +6 -0
  61. package/dist/getQueryString.js.map +1 -1
  62. package/dist/index.d.ts +19 -19
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +44 -44
  65. package/dist/index.js.map +1 -1
  66. package/dist/localOdspDriver/localOdspDocumentService.d.ts +1 -1
  67. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  68. package/dist/localOdspDriver/localOdspDocumentService.js +5 -5
  69. package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
  70. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +8 -6
  71. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  72. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js +10 -9
  73. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  74. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +1 -1
  75. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  76. package/dist/localOdspDriver/localOdspDocumentStorageManager.js +6 -6
  77. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  78. package/dist/odsp-driver-alpha.d.ts +27 -12
  79. package/dist/odsp-driver-beta.d.ts +1 -2
  80. package/dist/odsp-driver-public.d.ts +1 -2
  81. package/dist/odsp-driver-untrimmed.d.ts +29 -12
  82. package/dist/odspCache.d.ts +3 -3
  83. package/dist/odspCache.d.ts.map +1 -1
  84. package/dist/odspCache.js +3 -4
  85. package/dist/odspCache.js.map +1 -1
  86. package/dist/odspDelayLoadedDeltaStream.d.ts +7 -5
  87. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  88. package/dist/odspDelayLoadedDeltaStream.js +41 -28
  89. package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
  90. package/dist/odspDeltaStorageService.d.ts +7 -7
  91. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  92. package/dist/odspDeltaStorageService.js +5 -5
  93. package/dist/odspDeltaStorageService.js.map +1 -1
  94. package/dist/odspDocumentDeltaConnection.d.ts +1 -1
  95. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  96. package/dist/odspDocumentDeltaConnection.js +41 -23
  97. package/dist/odspDocumentDeltaConnection.js.map +1 -1
  98. package/dist/odspDocumentService.d.ts +6 -4
  99. package/dist/odspDocumentService.d.ts.map +1 -1
  100. package/dist/odspDocumentService.js +19 -16
  101. package/dist/odspDocumentService.js.map +1 -1
  102. package/dist/odspDocumentServiceFactory.d.ts +6 -1
  103. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  104. package/dist/odspDocumentServiceFactory.js +9 -4
  105. package/dist/odspDocumentServiceFactory.js.map +1 -1
  106. package/dist/odspDocumentServiceFactoryCore.d.ts +4 -4
  107. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  108. package/dist/odspDocumentServiceFactoryCore.js +26 -22
  109. package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
  110. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +1 -1
  111. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
  112. package/dist/odspDocumentServiceFactoryWithCodeSplit.js +2 -2
  113. package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -1
  114. package/dist/odspDocumentStorageManager.d.ts +15 -9
  115. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  116. package/dist/odspDocumentStorageManager.js +219 -181
  117. package/dist/odspDocumentStorageManager.js.map +1 -1
  118. package/dist/odspDocumentStorageServiceBase.d.ts +2 -4
  119. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  120. package/dist/odspDocumentStorageServiceBase.js +32 -29
  121. package/dist/odspDocumentStorageServiceBase.js.map +1 -1
  122. package/dist/odspDriverUrlResolver.d.ts +5 -1
  123. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  124. package/dist/odspDriverUrlResolver.js +27 -24
  125. package/dist/odspDriverUrlResolver.js.map +1 -1
  126. package/dist/odspDriverUrlResolverForShareLink.d.ts +17 -6
  127. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  128. package/dist/odspDriverUrlResolverForShareLink.js +49 -39
  129. package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
  130. package/dist/odspError.d.ts +1 -1
  131. package/dist/odspError.d.ts.map +1 -1
  132. package/dist/odspError.js +5 -5
  133. package/dist/odspError.js.map +1 -1
  134. package/dist/odspFluidFileLink.d.ts +1 -1
  135. package/dist/odspFluidFileLink.d.ts.map +1 -1
  136. package/dist/odspFluidFileLink.js +2 -2
  137. package/dist/odspFluidFileLink.js.map +1 -1
  138. package/dist/odspLocationRedirection.js +2 -2
  139. package/dist/odspLocationRedirection.js.map +1 -1
  140. package/dist/odspPublicUtils.d.ts +3 -0
  141. package/dist/odspPublicUtils.d.ts.map +1 -1
  142. package/dist/odspPublicUtils.js +3 -0
  143. package/dist/odspPublicUtils.js.map +1 -1
  144. package/dist/odspSnapshotParser.d.ts +1 -1
  145. package/dist/odspSnapshotParser.d.ts.map +1 -1
  146. package/dist/odspSnapshotParser.js +3 -2
  147. package/dist/odspSnapshotParser.js.map +1 -1
  148. package/dist/odspSummaryUploadManager.d.ts +1 -1
  149. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  150. package/dist/odspSummaryUploadManager.js +9 -6
  151. package/dist/odspSummaryUploadManager.js.map +1 -1
  152. package/dist/odspUrlHelper.d.ts.map +1 -1
  153. package/dist/odspUrlHelper.js +1 -2
  154. package/dist/odspUrlHelper.js.map +1 -1
  155. package/dist/odspUtils.d.ts +19 -7
  156. package/dist/odspUtils.d.ts.map +1 -1
  157. package/dist/odspUtils.js +61 -31
  158. package/dist/odspUtils.js.map +1 -1
  159. package/dist/opsCaching.d.ts +1 -1
  160. package/dist/opsCaching.d.ts.map +1 -1
  161. package/dist/opsCaching.js +2 -1
  162. package/dist/opsCaching.js.map +1 -1
  163. package/dist/package.json +3 -0
  164. package/dist/packageVersion.d.ts +1 -1
  165. package/dist/packageVersion.js +1 -1
  166. package/dist/packageVersion.js.map +1 -1
  167. package/dist/prefetchLatestSnapshot.d.ts +2 -2
  168. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  169. package/dist/prefetchLatestSnapshot.js +17 -12
  170. package/dist/prefetchLatestSnapshot.js.map +1 -1
  171. package/dist/retryErrorsStorageAdapter.d.ts +0 -1
  172. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  173. package/dist/retryErrorsStorageAdapter.js +2 -5
  174. package/dist/retryErrorsStorageAdapter.js.map +1 -1
  175. package/dist/retryUtils.d.ts.map +1 -1
  176. package/dist/retryUtils.js +6 -2
  177. package/dist/retryUtils.js.map +1 -1
  178. package/dist/socketModule.d.ts.map +1 -1
  179. package/dist/socketModule.js +2 -0
  180. package/dist/socketModule.js.map +1 -1
  181. package/dist/tsdoc-metadata.json +1 -1
  182. package/dist/vroom.d.ts +2 -2
  183. package/dist/vroom.d.ts.map +1 -1
  184. package/dist/vroom.js +5 -5
  185. package/dist/vroom.js.map +1 -1
  186. package/dist/zipItDataRepresentationUtils.d.ts +1 -1
  187. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  188. package/dist/zipItDataRepresentationUtils.js +15 -11
  189. package/dist/zipItDataRepresentationUtils.js.map +1 -1
  190. package/lib/{ReadBufferUtils.d.mts → ReadBufferUtils.d.ts} +1 -1
  191. package/lib/ReadBufferUtils.d.ts.map +1 -0
  192. package/lib/{ReadBufferUtils.mjs → ReadBufferUtils.js} +1 -1
  193. package/lib/ReadBufferUtils.js.map +1 -0
  194. package/lib/{WriteBufferUtils.d.mts → WriteBufferUtils.d.ts} +2 -2
  195. package/lib/WriteBufferUtils.d.ts.map +1 -0
  196. package/lib/{WriteBufferUtils.mjs → WriteBufferUtils.js} +2 -2
  197. package/lib/WriteBufferUtils.js.map +1 -0
  198. package/lib/{checkUrl.d.mts → checkUrl.d.ts} +1 -1
  199. package/lib/checkUrl.d.ts.map +1 -0
  200. package/lib/{checkUrl.mjs → checkUrl.js} +5 -3
  201. package/lib/checkUrl.js.map +1 -0
  202. package/lib/{compactSnapshotParser.d.mts → compactSnapshotParser.d.ts} +1 -1
  203. package/lib/compactSnapshotParser.d.ts.map +1 -0
  204. package/lib/{compactSnapshotParser.mjs → compactSnapshotParser.js} +61 -43
  205. package/lib/compactSnapshotParser.js.map +1 -0
  206. package/lib/{compactSnapshotWriter.d.mts → compactSnapshotWriter.d.ts} +1 -1
  207. package/lib/compactSnapshotWriter.d.ts.map +1 -0
  208. package/lib/{compactSnapshotWriter.mjs → compactSnapshotWriter.js} +13 -7
  209. package/lib/compactSnapshotWriter.js.map +1 -0
  210. package/lib/{constants.d.mts → constants.d.ts} +1 -1
  211. package/lib/constants.d.ts.map +1 -0
  212. package/lib/{constants.mjs → constants.js} +1 -1
  213. package/lib/constants.js.map +1 -0
  214. package/lib/{contracts.d.mts → contracts.d.ts} +11 -5
  215. package/lib/contracts.d.ts.map +1 -0
  216. package/lib/{contracts.mjs → contracts.js} +1 -1
  217. package/lib/contracts.js.map +1 -0
  218. package/lib/{contractsPublic.d.mts → contractsPublic.d.ts} +1 -1
  219. package/lib/contractsPublic.d.ts.map +1 -0
  220. package/lib/{contractsPublic.mjs → contractsPublic.js} +1 -1
  221. package/lib/contractsPublic.js.map +1 -0
  222. package/lib/{createFile.d.mts → createFile.d.ts} +4 -4
  223. package/lib/createFile.d.ts.map +1 -0
  224. package/lib/{createFile.mjs → createFile.js} +15 -12
  225. package/lib/createFile.js.map +1 -0
  226. package/lib/{createNewContainerOnExistingFile.d.mts → createNewContainerOnExistingFile.d.ts} +3 -3
  227. package/lib/createNewContainerOnExistingFile.d.ts.map +1 -0
  228. package/lib/{createNewContainerOnExistingFile.mjs → createNewContainerOnExistingFile.js} +7 -7
  229. package/lib/createNewContainerOnExistingFile.js.map +1 -0
  230. package/lib/{createNewModule.mjs → createNewModule.d.ts} +3 -3
  231. package/lib/createNewModule.d.ts.map +1 -0
  232. package/lib/{createNewModule.d.mts → createNewModule.js} +3 -3
  233. package/lib/createNewModule.js.map +1 -0
  234. package/lib/{createNewUtils.d.mts → createNewUtils.d.ts} +3 -3
  235. package/lib/createNewUtils.d.ts.map +1 -0
  236. package/lib/{createNewUtils.mjs → createNewUtils.js} +9 -5
  237. package/lib/createNewUtils.js.map +1 -0
  238. package/lib/{createOdspCreateContainerRequest.d.mts → createOdspCreateContainerRequest.d.ts} +5 -1
  239. package/lib/createOdspCreateContainerRequest.d.ts.map +1 -0
  240. package/lib/{createOdspCreateContainerRequest.mjs → createOdspCreateContainerRequest.js} +6 -2
  241. package/lib/createOdspCreateContainerRequest.js.map +1 -0
  242. package/lib/{createOdspUrl.d.mts → createOdspUrl.d.ts} +2 -2
  243. package/lib/createOdspUrl.d.ts.map +1 -0
  244. package/lib/{createOdspUrl.mjs → createOdspUrl.js} +1 -1
  245. package/lib/createOdspUrl.js.map +1 -0
  246. package/lib/{epochTracker.d.mts → epochTracker.d.ts} +11 -10
  247. package/lib/epochTracker.d.ts.map +1 -0
  248. package/lib/{epochTracker.mjs → epochTracker.js} +56 -33
  249. package/lib/epochTracker.js.map +1 -0
  250. package/lib/{fetch.d.mts → fetch.d.ts} +1 -1
  251. package/lib/fetch.d.ts.map +1 -0
  252. package/lib/{fetch.mjs → fetch.js} +1 -1
  253. package/lib/fetch.js.map +1 -0
  254. package/lib/{fetchSnapshot.d.mts → fetchSnapshot.d.ts} +12 -9
  255. package/lib/fetchSnapshot.d.ts.map +1 -0
  256. package/lib/{fetchSnapshot.mjs → fetchSnapshot.js} +61 -40
  257. package/lib/fetchSnapshot.js.map +1 -0
  258. package/lib/{getFileLink.d.mts → getFileLink.d.ts} +1 -1
  259. package/lib/getFileLink.d.ts.map +1 -0
  260. package/lib/{getFileLink.mjs → getFileLink.js} +14 -7
  261. package/lib/getFileLink.js.map +1 -0
  262. package/lib/{getQueryString.d.mts → getQueryString.d.ts} +5 -1
  263. package/lib/getQueryString.d.ts.map +1 -0
  264. package/lib/{getQueryString.mjs → getQueryString.js} +7 -1
  265. package/lib/getQueryString.js.map +1 -0
  266. package/lib/{getUrlAndHeadersWithAuth.d.mts → getUrlAndHeadersWithAuth.d.ts} +1 -1
  267. package/lib/getUrlAndHeadersWithAuth.d.ts.map +1 -0
  268. package/lib/{getUrlAndHeadersWithAuth.mjs → getUrlAndHeadersWithAuth.js} +1 -1
  269. package/lib/getUrlAndHeadersWithAuth.js.map +1 -0
  270. package/lib/{index.d.mts → index.d.ts} +20 -20
  271. package/lib/index.d.ts.map +1 -0
  272. package/lib/index.js +29 -0
  273. package/lib/index.js.map +1 -0
  274. package/lib/localOdspDriver/{localOdspDeltaStorageService.d.mts → localOdspDeltaStorageService.d.ts} +1 -1
  275. package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
  276. package/lib/localOdspDriver/{localOdspDeltaStorageService.mjs → localOdspDeltaStorageService.js} +1 -1
  277. package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -0
  278. package/lib/localOdspDriver/{localOdspDocumentService.d.mts → localOdspDocumentService.d.ts} +2 -2
  279. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -0
  280. package/lib/localOdspDriver/{localOdspDocumentService.mjs → localOdspDocumentService.js} +4 -4
  281. package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -0
  282. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.mts → localOdspDocumentServiceFactory.d.ts} +9 -7
  283. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -0
  284. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.mjs → localOdspDocumentServiceFactory.js} +9 -8
  285. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -0
  286. package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.mts → localOdspDocumentStorageManager.d.ts} +2 -2
  287. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -0
  288. package/lib/localOdspDriver/{localOdspDocumentStorageManager.mjs → localOdspDocumentStorageManager.js} +4 -4
  289. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
  290. package/lib/{odsp-driver-alpha.d.mts → odsp-driver-alpha.d.ts} +27 -12
  291. package/lib/{odsp-driver-public.d.mts → odsp-driver-beta.d.ts} +1 -2
  292. package/lib/{odsp-driver-beta.d.mts → odsp-driver-public.d.ts} +1 -2
  293. package/lib/{odsp-driver-untrimmed.d.mts → odsp-driver-untrimmed.d.ts} +29 -12
  294. package/lib/{odspCache.d.mts → odspCache.d.ts} +8 -4
  295. package/lib/odspCache.d.ts.map +1 -0
  296. package/lib/{odspCache.mjs → odspCache.js} +6 -3
  297. package/lib/odspCache.js.map +1 -0
  298. package/lib/{odspDelayLoadedDeltaStream.d.mts → odspDelayLoadedDeltaStream.d.ts} +8 -6
  299. package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -0
  300. package/lib/{odspDelayLoadedDeltaStream.mjs → odspDelayLoadedDeltaStream.js} +33 -20
  301. package/lib/odspDelayLoadedDeltaStream.js.map +1 -0
  302. package/lib/{odspDeltaStorageService.d.mts → odspDeltaStorageService.d.ts} +8 -8
  303. package/lib/odspDeltaStorageService.d.ts.map +1 -0
  304. package/lib/{odspDeltaStorageService.mjs → odspDeltaStorageService.js} +5 -5
  305. package/lib/odspDeltaStorageService.js.map +1 -0
  306. package/lib/{odspDocumentDeltaConnection.d.mts → odspDocumentDeltaConnection.d.ts} +2 -2
  307. package/lib/odspDocumentDeltaConnection.d.ts.map +1 -0
  308. package/lib/{odspDocumentDeltaConnection.mjs → odspDocumentDeltaConnection.js} +34 -16
  309. package/lib/odspDocumentDeltaConnection.js.map +1 -0
  310. package/lib/{odspDocumentService.d.mts → odspDocumentService.d.ts} +7 -5
  311. package/lib/odspDocumentService.d.ts.map +1 -0
  312. package/lib/{odspDocumentService.mjs → odspDocumentService.js} +16 -11
  313. package/lib/odspDocumentService.js.map +1 -0
  314. package/lib/{odspDocumentServiceFactory.d.mts → odspDocumentServiceFactory.d.ts} +7 -2
  315. package/lib/odspDocumentServiceFactory.d.ts.map +1 -0
  316. package/lib/{odspDocumentServiceFactory.mjs → odspDocumentServiceFactory.js} +9 -3
  317. package/lib/odspDocumentServiceFactory.js.map +1 -0
  318. package/lib/{odspDocumentServiceFactoryCore.d.mts → odspDocumentServiceFactoryCore.d.ts} +5 -5
  319. package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -0
  320. package/lib/{odspDocumentServiceFactoryCore.mjs → odspDocumentServiceFactoryCore.js} +23 -17
  321. package/lib/odspDocumentServiceFactoryCore.js.map +1 -0
  322. package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.mts → odspDocumentServiceFactoryWithCodeSplit.d.ts} +2 -2
  323. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -0
  324. package/lib/{odspDocumentServiceFactoryWithCodeSplit.mjs → odspDocumentServiceFactoryWithCodeSplit.js} +2 -2
  325. package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -0
  326. package/lib/{odspDocumentStorageManager.d.mts → odspDocumentStorageManager.d.ts} +16 -10
  327. package/lib/odspDocumentStorageManager.d.ts.map +1 -0
  328. package/lib/{odspDocumentStorageManager.mjs → odspDocumentStorageManager.js} +207 -167
  329. package/lib/odspDocumentStorageManager.js.map +1 -0
  330. package/lib/{odspDocumentStorageServiceBase.d.mts → odspDocumentStorageServiceBase.d.ts} +3 -5
  331. package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -0
  332. package/lib/{odspDocumentStorageServiceBase.mjs → odspDocumentStorageServiceBase.js} +32 -29
  333. package/lib/odspDocumentStorageServiceBase.js.map +1 -0
  334. package/lib/{odspDriverUrlResolver.d.mts → odspDriverUrlResolver.d.ts} +6 -2
  335. package/lib/odspDriverUrlResolver.d.ts.map +1 -0
  336. package/lib/{odspDriverUrlResolver.mjs → odspDriverUrlResolver.js} +24 -17
  337. package/lib/odspDriverUrlResolver.js.map +1 -0
  338. package/lib/{odspDriverUrlResolverForShareLink.d.mts → odspDriverUrlResolverForShareLink.d.ts} +18 -7
  339. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -0
  340. package/lib/{odspDriverUrlResolverForShareLink.mjs → odspDriverUrlResolverForShareLink.js} +41 -27
  341. package/lib/odspDriverUrlResolverForShareLink.js.map +1 -0
  342. package/lib/{odspError.d.mts → odspError.d.ts} +2 -2
  343. package/lib/odspError.d.ts.map +1 -0
  344. package/lib/{odspError.mjs → odspError.js} +4 -4
  345. package/lib/odspError.js.map +1 -0
  346. package/lib/{odspFluidFileLink.d.mts → odspFluidFileLink.d.ts} +2 -2
  347. package/lib/odspFluidFileLink.d.ts.map +1 -0
  348. package/lib/{odspFluidFileLink.mjs → odspFluidFileLink.js} +2 -2
  349. package/lib/odspFluidFileLink.js.map +1 -0
  350. package/lib/{odspLocationRedirection.d.mts → odspLocationRedirection.d.ts} +1 -1
  351. package/lib/odspLocationRedirection.d.ts.map +1 -0
  352. package/lib/{odspLocationRedirection.mjs → odspLocationRedirection.js} +2 -2
  353. package/lib/odspLocationRedirection.js.map +1 -0
  354. package/lib/{odspPublicUtils.d.mts → odspPublicUtils.d.ts} +4 -1
  355. package/lib/odspPublicUtils.d.ts.map +1 -0
  356. package/lib/{odspPublicUtils.mjs → odspPublicUtils.js} +4 -1
  357. package/lib/odspPublicUtils.js.map +1 -0
  358. package/lib/{odspSnapshotParser.d.mts → odspSnapshotParser.d.ts} +2 -2
  359. package/lib/odspSnapshotParser.d.ts.map +1 -0
  360. package/lib/{odspSnapshotParser.mjs → odspSnapshotParser.js} +4 -3
  361. package/lib/odspSnapshotParser.js.map +1 -0
  362. package/lib/{odspSummaryUploadManager.d.mts → odspSummaryUploadManager.d.ts} +2 -2
  363. package/lib/odspSummaryUploadManager.d.ts.map +1 -0
  364. package/lib/{odspSummaryUploadManager.mjs → odspSummaryUploadManager.js} +8 -5
  365. package/lib/odspSummaryUploadManager.js.map +1 -0
  366. package/lib/{odspUrlHelper.d.mts → odspUrlHelper.d.ts} +1 -1
  367. package/lib/odspUrlHelper.d.ts.map +1 -0
  368. package/lib/{odspUrlHelper.mjs → odspUrlHelper.js} +2 -3
  369. package/lib/odspUrlHelper.js.map +1 -0
  370. package/lib/{odspUtils.d.mts → odspUtils.d.ts} +20 -8
  371. package/lib/odspUtils.d.ts.map +1 -0
  372. package/lib/{odspUtils.mjs → odspUtils.js} +45 -17
  373. package/lib/odspUtils.js.map +1 -0
  374. package/lib/{opsCaching.d.mts → opsCaching.d.ts} +2 -2
  375. package/lib/opsCaching.d.ts.map +1 -0
  376. package/lib/{opsCaching.mjs → opsCaching.js} +3 -2
  377. package/lib/opsCaching.js.map +1 -0
  378. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  379. package/lib/packageVersion.d.ts.map +1 -0
  380. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  381. package/lib/packageVersion.js.map +1 -0
  382. package/lib/{prefetchLatestSnapshot.d.mts → prefetchLatestSnapshot.d.ts} +3 -3
  383. package/lib/prefetchLatestSnapshot.d.ts.map +1 -0
  384. package/lib/{prefetchLatestSnapshot.mjs → prefetchLatestSnapshot.js} +16 -11
  385. package/lib/prefetchLatestSnapshot.js.map +1 -0
  386. package/lib/{retryErrorsStorageAdapter.d.mts → retryErrorsStorageAdapter.d.ts} +1 -2
  387. package/lib/retryErrorsStorageAdapter.d.ts.map +1 -0
  388. package/lib/{retryErrorsStorageAdapter.mjs → retryErrorsStorageAdapter.js} +2 -5
  389. package/lib/retryErrorsStorageAdapter.js.map +1 -0
  390. package/lib/{retryUtils.d.mts → retryUtils.d.ts} +1 -1
  391. package/lib/retryUtils.d.ts.map +1 -0
  392. package/lib/{retryUtils.mjs → retryUtils.js} +6 -2
  393. package/lib/retryUtils.js.map +1 -0
  394. package/lib/{socketModule.d.mts → socketModule.d.ts} +1 -1
  395. package/lib/socketModule.d.ts.map +1 -0
  396. package/lib/{socketModule.mjs → socketModule.js} +3 -1
  397. package/lib/socketModule.js.map +1 -0
  398. package/lib/test/buildOdspShareLinkReqParams.spec.js +25 -0
  399. package/lib/test/buildOdspShareLinkReqParams.spec.js.map +1 -0
  400. package/lib/test/createNewUtilsTests.spec.js +221 -0
  401. package/lib/test/createNewUtilsTests.spec.js.map +1 -0
  402. package/lib/test/deltaStorageService.spec.js +176 -0
  403. package/lib/test/deltaStorageService.spec.js.map +1 -0
  404. package/lib/test/epochTests.spec.js +340 -0
  405. package/lib/test/epochTests.spec.js.map +1 -0
  406. package/lib/test/epochTestsWithRedemption.spec.js +119 -0
  407. package/lib/test/epochTestsWithRedemption.spec.js.map +1 -0
  408. package/lib/test/fetchSnapshot.spec.js +412 -0
  409. package/lib/test/fetchSnapshot.spec.js.map +1 -0
  410. package/lib/test/getFileLink.spec.js +62 -0
  411. package/lib/test/getFileLink.spec.js.map +1 -0
  412. package/lib/test/getUrlAndHeadersWithAuth.spec.js +66 -0
  413. package/lib/test/getUrlAndHeadersWithAuth.spec.js.map +1 -0
  414. package/lib/test/getVersions.spec.js +284 -0
  415. package/lib/test/getVersions.spec.js.map +1 -0
  416. package/lib/test/joinSessionCacheTests.spec.js +53 -0
  417. package/lib/test/joinSessionCacheTests.spec.js.map +1 -0
  418. package/lib/test/joinSessionPeriodicCall.spec.js +158 -0
  419. package/lib/test/joinSessionPeriodicCall.spec.js.map +1 -0
  420. package/lib/test/jsonSnapshotFormatTests.spec.js +107 -0
  421. package/lib/test/jsonSnapshotFormatTests.spec.js.map +1 -0
  422. package/lib/test/localOdspDriver.spec.js +177 -0
  423. package/lib/test/localOdspDriver.spec.js.map +1 -0
  424. package/lib/test/mockFetch.js +61 -0
  425. package/lib/test/mockFetch.js.map +1 -0
  426. package/lib/test/odspCreateContainer.spec.js +116 -0
  427. package/lib/test/odspCreateContainer.spec.js.map +1 -0
  428. package/lib/test/odspDriverResolverTest.spec.js +289 -0
  429. package/lib/test/odspDriverResolverTest.spec.js.map +1 -0
  430. package/lib/test/odspDriverUrlResolverForShareLink.spec.js +287 -0
  431. package/lib/test/odspDriverUrlResolverForShareLink.spec.js.map +1 -0
  432. package/lib/test/odspError.spec.js +299 -0
  433. package/lib/test/odspError.spec.js.map +1 -0
  434. package/lib/test/opsCaching.spec.js +357 -0
  435. package/lib/test/opsCaching.spec.js.map +1 -0
  436. package/lib/test/prefetchSnapshotTests.spec.js +420 -0
  437. package/lib/test/prefetchSnapshotTests.spec.js.map +1 -0
  438. package/lib/test/snapshotFormatTests.spec.js +218 -0
  439. package/lib/test/snapshotFormatTests.spec.js.map +1 -0
  440. package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js +152 -0
  441. package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js.map +1 -0
  442. package/lib/test/socketTests/socketMock.js +109 -0
  443. package/lib/test/socketTests/socketMock.js.map +1 -0
  444. package/lib/test/socketTests/socketTests.spec.js +256 -0
  445. package/lib/test/socketTests/socketTests.spec.js.map +1 -0
  446. package/lib/test/tokenFetch.spec.js +39 -0
  447. package/lib/test/tokenFetch.spec.js.map +1 -0
  448. package/lib/test/types/validateOdspDriverPrevious.generated.js +96 -0
  449. package/lib/test/types/validateOdspDriverPrevious.generated.js.map +1 -0
  450. package/lib/test/zipItDataRepresentationTests.spec.js +207 -0
  451. package/lib/test/zipItDataRepresentationTests.spec.js.map +1 -0
  452. package/lib/{vroom.d.mts → vroom.d.ts} +3 -3
  453. package/lib/vroom.d.ts.map +1 -0
  454. package/lib/{vroom.mjs → vroom.js} +4 -4
  455. package/lib/vroom.js.map +1 -0
  456. package/lib/{zipItDataRepresentationUtils.d.mts → zipItDataRepresentationUtils.d.ts} +2 -2
  457. package/lib/zipItDataRepresentationUtils.d.ts.map +1 -0
  458. package/lib/{zipItDataRepresentationUtils.mjs → zipItDataRepresentationUtils.js} +17 -9
  459. package/lib/zipItDataRepresentationUtils.js.map +1 -0
  460. package/package.json +90 -31
  461. package/src/ReadBufferUtils.ts +7 -7
  462. package/src/WriteBufferUtils.ts +13 -9
  463. package/src/checkUrl.ts +4 -2
  464. package/src/compactSnapshotParser.ts +87 -52
  465. package/src/compactSnapshotWriter.ts +19 -12
  466. package/src/contracts.ts +16 -4
  467. package/src/createFile.ts +16 -13
  468. package/src/createNewContainerOnExistingFile.ts +8 -8
  469. package/src/createNewModule.ts +2 -2
  470. package/src/createNewUtils.ts +19 -9
  471. package/src/createOdspCreateContainerRequest.ts +2 -1
  472. package/src/createOdspUrl.ts +1 -1
  473. package/src/epochTracker.ts +90 -55
  474. package/src/fetchSnapshot.ts +104 -47
  475. package/src/getFileLink.ts +21 -13
  476. package/src/getQueryString.ts +3 -0
  477. package/src/index.ts +27 -19
  478. package/src/localOdspDriver/localOdspDocumentService.ts +3 -3
  479. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +12 -11
  480. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +5 -5
  481. package/src/odspCache.ts +13 -9
  482. package/src/odspDelayLoadedDeltaStream.ts +54 -33
  483. package/src/odspDeltaStorageService.ts +17 -16
  484. package/src/odspDocumentDeltaConnection.ts +52 -34
  485. package/src/odspDocumentService.ts +23 -20
  486. package/src/odspDocumentServiceFactory.ts +7 -2
  487. package/src/odspDocumentServiceFactoryCore.ts +25 -18
  488. package/src/odspDocumentServiceFactoryWithCodeSplit.ts +1 -1
  489. package/src/odspDocumentStorageManager.ts +276 -216
  490. package/src/odspDocumentStorageServiceBase.ts +45 -43
  491. package/src/odspDriverUrlResolver.ts +39 -24
  492. package/src/odspDriverUrlResolverForShareLink.ts +51 -31
  493. package/src/odspError.ts +4 -4
  494. package/src/odspFluidFileLink.ts +3 -3
  495. package/src/odspLocationRedirection.ts +1 -1
  496. package/src/odspPublicUtils.ts +3 -0
  497. package/src/odspSnapshotParser.ts +4 -3
  498. package/src/odspSummaryUploadManager.ts +21 -9
  499. package/src/odspUrlHelper.ts +2 -3
  500. package/src/odspUtils.ts +73 -30
  501. package/src/opsCaching.ts +13 -12
  502. package/src/packageVersion.ts +1 -1
  503. package/src/prefetchLatestSnapshot.ts +24 -15
  504. package/src/retryErrorsStorageAdapter.ts +4 -8
  505. package/src/retryUtils.ts +6 -2
  506. package/src/socketModule.ts +2 -0
  507. package/src/vroom.ts +6 -6
  508. package/src/zipItDataRepresentationUtils.ts +63 -35
  509. package/tsconfig.cjs.json +7 -0
  510. package/tsconfig.json +2 -5
  511. package/lib/ReadBufferUtils.d.mts.map +0 -1
  512. package/lib/ReadBufferUtils.mjs.map +0 -1
  513. package/lib/WriteBufferUtils.d.mts.map +0 -1
  514. package/lib/WriteBufferUtils.mjs.map +0 -1
  515. package/lib/checkUrl.d.mts.map +0 -1
  516. package/lib/checkUrl.mjs.map +0 -1
  517. package/lib/compactSnapshotParser.d.mts.map +0 -1
  518. package/lib/compactSnapshotParser.mjs.map +0 -1
  519. package/lib/compactSnapshotWriter.d.mts.map +0 -1
  520. package/lib/compactSnapshotWriter.mjs.map +0 -1
  521. package/lib/constants.d.mts.map +0 -1
  522. package/lib/constants.mjs.map +0 -1
  523. package/lib/contracts.d.mts.map +0 -1
  524. package/lib/contracts.mjs.map +0 -1
  525. package/lib/contractsPublic.d.mts.map +0 -1
  526. package/lib/contractsPublic.mjs.map +0 -1
  527. package/lib/createFile.d.mts.map +0 -1
  528. package/lib/createFile.mjs.map +0 -1
  529. package/lib/createNewContainerOnExistingFile.d.mts.map +0 -1
  530. package/lib/createNewContainerOnExistingFile.mjs.map +0 -1
  531. package/lib/createNewModule.d.mts.map +0 -1
  532. package/lib/createNewModule.mjs.map +0 -1
  533. package/lib/createNewUtils.d.mts.map +0 -1
  534. package/lib/createNewUtils.mjs.map +0 -1
  535. package/lib/createOdspCreateContainerRequest.d.mts.map +0 -1
  536. package/lib/createOdspCreateContainerRequest.mjs.map +0 -1
  537. package/lib/createOdspUrl.d.mts.map +0 -1
  538. package/lib/createOdspUrl.mjs.map +0 -1
  539. package/lib/epochTracker.d.mts.map +0 -1
  540. package/lib/epochTracker.mjs.map +0 -1
  541. package/lib/fetch.d.mts.map +0 -1
  542. package/lib/fetch.mjs.map +0 -1
  543. package/lib/fetchSnapshot.d.mts.map +0 -1
  544. package/lib/fetchSnapshot.mjs.map +0 -1
  545. package/lib/getFileLink.d.mts.map +0 -1
  546. package/lib/getFileLink.mjs.map +0 -1
  547. package/lib/getQueryString.d.mts.map +0 -1
  548. package/lib/getQueryString.mjs.map +0 -1
  549. package/lib/getUrlAndHeadersWithAuth.d.mts.map +0 -1
  550. package/lib/getUrlAndHeadersWithAuth.mjs.map +0 -1
  551. package/lib/index.d.mts.map +0 -1
  552. package/lib/index.mjs +0 -22
  553. package/lib/index.mjs.map +0 -1
  554. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +0 -1
  555. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +0 -1
  556. package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +0 -1
  557. package/lib/localOdspDriver/localOdspDocumentService.mjs.map +0 -1
  558. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +0 -1
  559. package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +0 -1
  560. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +0 -1
  561. package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +0 -1
  562. package/lib/odspCache.d.mts.map +0 -1
  563. package/lib/odspCache.mjs.map +0 -1
  564. package/lib/odspDelayLoadedDeltaStream.d.mts.map +0 -1
  565. package/lib/odspDelayLoadedDeltaStream.mjs.map +0 -1
  566. package/lib/odspDeltaStorageService.d.mts.map +0 -1
  567. package/lib/odspDeltaStorageService.mjs.map +0 -1
  568. package/lib/odspDocumentDeltaConnection.d.mts.map +0 -1
  569. package/lib/odspDocumentDeltaConnection.mjs.map +0 -1
  570. package/lib/odspDocumentService.d.mts.map +0 -1
  571. package/lib/odspDocumentService.mjs.map +0 -1
  572. package/lib/odspDocumentServiceFactory.d.mts.map +0 -1
  573. package/lib/odspDocumentServiceFactory.mjs.map +0 -1
  574. package/lib/odspDocumentServiceFactoryCore.d.mts.map +0 -1
  575. package/lib/odspDocumentServiceFactoryCore.mjs.map +0 -1
  576. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +0 -1
  577. package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +0 -1
  578. package/lib/odspDocumentStorageManager.d.mts.map +0 -1
  579. package/lib/odspDocumentStorageManager.mjs.map +0 -1
  580. package/lib/odspDocumentStorageServiceBase.d.mts.map +0 -1
  581. package/lib/odspDocumentStorageServiceBase.mjs.map +0 -1
  582. package/lib/odspDriverUrlResolver.d.mts.map +0 -1
  583. package/lib/odspDriverUrlResolver.mjs.map +0 -1
  584. package/lib/odspDriverUrlResolverForShareLink.d.mts.map +0 -1
  585. package/lib/odspDriverUrlResolverForShareLink.mjs.map +0 -1
  586. package/lib/odspError.d.mts.map +0 -1
  587. package/lib/odspError.mjs.map +0 -1
  588. package/lib/odspFluidFileLink.d.mts.map +0 -1
  589. package/lib/odspFluidFileLink.mjs.map +0 -1
  590. package/lib/odspLocationRedirection.d.mts.map +0 -1
  591. package/lib/odspLocationRedirection.mjs.map +0 -1
  592. package/lib/odspPublicUtils.d.mts.map +0 -1
  593. package/lib/odspPublicUtils.mjs.map +0 -1
  594. package/lib/odspSnapshotParser.d.mts.map +0 -1
  595. package/lib/odspSnapshotParser.mjs.map +0 -1
  596. package/lib/odspSummaryUploadManager.d.mts.map +0 -1
  597. package/lib/odspSummaryUploadManager.mjs.map +0 -1
  598. package/lib/odspUrlHelper.d.mts.map +0 -1
  599. package/lib/odspUrlHelper.mjs.map +0 -1
  600. package/lib/odspUtils.d.mts.map +0 -1
  601. package/lib/odspUtils.mjs.map +0 -1
  602. package/lib/opsCaching.d.mts.map +0 -1
  603. package/lib/opsCaching.mjs.map +0 -1
  604. package/lib/packageVersion.d.mts.map +0 -1
  605. package/lib/packageVersion.mjs.map +0 -1
  606. package/lib/prefetchLatestSnapshot.d.mts.map +0 -1
  607. package/lib/prefetchLatestSnapshot.mjs.map +0 -1
  608. package/lib/retryErrorsStorageAdapter.d.mts.map +0 -1
  609. package/lib/retryErrorsStorageAdapter.mjs.map +0 -1
  610. package/lib/retryUtils.d.mts.map +0 -1
  611. package/lib/retryUtils.mjs.map +0 -1
  612. package/lib/socketModule.d.mts.map +0 -1
  613. package/lib/socketModule.mjs.map +0 -1
  614. package/lib/vroom.d.mts.map +0 -1
  615. package/lib/vroom.mjs.map +0 -1
  616. package/lib/zipItDataRepresentationUtils.d.mts.map +0 -1
  617. package/lib/zipItDataRepresentationUtils.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspUtils.js","sourceRoot":"","sources":["../src/odspUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACN,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,iBAAi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,eAAe,CAAC,gBAAgB,cAAc,CAAC;AAC1D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;AACpC,gDAAgD;AAChD,GAA8C;IAE9C,OAAO,GAAG,KAAK,SAAS,IAAI,iBAAiB,IAAI,GAAG,IAAI,GAAG,CAAC,eAAe,KAAK,CAAC,CAAC;AACnF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,8BAA8B,CAAC,eAAqC;IACnF,OAAO,eAAe,KAAK,SAAS,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,0CAA0C,CACzD,eAAqC;IAErC,OAAO,eAAe,KAAK,SAAS,CAAC;AACtC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseProperties, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, ISnapshot } from \"@fluidframework/driver-definitions\";\nimport {\n\tisOnline,\n\tOnlineStatus,\n\tRetryableError,\n\tNonRetryableError,\n\tNetworkErrorBasic,\n\ttype AuthorizationError,\n} from \"@fluidframework/driver-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tTelemetryDataTag,\n\tcreateChildLogger,\n\twrapError,\n\ttype IFluidErrorBase,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tfetchIncorrectResponse,\n\tthrowOdspNetworkError,\n\tgetSPOAndGraphRequestIdsFromResponse,\n} from \"@fluidframework/odsp-doclib-utils/internal\";\nimport {\n\tIOdspResolvedUrl,\n\tTokenFetchOptions,\n\tOdspErrorTypes,\n\ttokenFromResponse,\n\tisTokenFromCache,\n\tOdspResourceTokenFetchOptions,\n\tISharingLinkKind,\n\tTokenFetcher,\n\tICacheEntry,\n\tsnapshotKey,\n\tInstrumentedStorageTokenFetcher,\n\tIOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { fetch } from \"./fetch.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { IOdspSnapshot } from \"./contracts.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { ISnapshotContents } from \"./odspPublicUtils.js\";\n\nexport const getWithRetryForTokenRefreshRepeat = \"getWithRetryForTokenRefreshRepeat\";\n\n/**\n * Parse the given url and return the origin (host name)\n */\nexport const getOrigin = (url: string): string => new URL(url).origin;\n\n/**\n * @alpha\n */\nexport interface IOdspResponse<T> {\n\tcontent: T;\n\theaders: Map<string, string>;\n\tpropsToLog: ITelemetryBaseProperties;\n\tduration: number;\n}\n\nexport interface TokenFetchOptionsEx extends TokenFetchOptions {\n\t/**\n\t * The previous error we hit in {@link getWithRetryForTokenRefresh}.\n\t */\n\tpreviousError?: unknown;\n}\n\nfunction headersToMap(headers: Headers): Map<string, string> {\n\tconst newHeaders = new Map<string, string>();\n\tfor (const [key, value] of headers.entries()) {\n\t\tnewHeaders.set(key, value);\n\t}\n\treturn newHeaders;\n}\n\n/**\n * This API should be used with pretty much all network calls (fetch, webSocket connection) in order\n * to correctly handle expired tokens. It relies on callback fetching token, and be able to refetch\n * token on failure. Only specific cases get retry call with refresh = true, all other / unknown errors\n * simply propagate to caller\n */\nexport async function getWithRetryForTokenRefresh<T>(\n\tget: (options: TokenFetchOptionsEx) => Promise<T>,\n): Promise<T> {\n\treturn get({ refresh: false }).catch(async (error) => {\n\t\tconst options: TokenFetchOptionsEx = { refresh: true, previousError: error };\n\t\tswitch ((error as Partial<IFluidErrorBase>).errorType) {\n\t\t\t// If the error is 401 or 403 refresh the token and try once more.\n\t\t\tcase OdspErrorTypes.authorizationError: {\n\t\t\t\tconst authError = error as AuthorizationError;\n\t\t\t\treturn get({ ...options, claims: authError.claims, tenantId: authError.tenantId });\n\t\t\t}\n\n\t\t\tcase OdspErrorTypes.incorrectServerResponse: // some error on the wire, retry once\n\t\t\tcase OdspErrorTypes.fetchTokenError: {\n\t\t\t\t// If the token was null, then retry once.\n\t\t\t\treturn get(options);\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\t// Caller may determine that it wants one retry\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-explicit-any\n\t\t\t\tif ((error as any)[getWithRetryForTokenRefreshRepeat] === true) {\n\t\t\t\t\treturn get(options);\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t});\n}\n\nexport async function fetchHelper(\n\trequestInfo: RequestInfo,\n\trequestInit: RequestInit | undefined,\n): Promise<IOdspResponse<Response>> {\n\tconst start = performance.now();\n\n\t// Node-fetch and dom have conflicting typing, force them to work by casting for now\n\treturn fetch(requestInfo, requestInit).then(\n\t\tasync (fetchResponse) => {\n\t\t\tconst response = fetchResponse as unknown as Response;\n\t\t\t// Let's assume we can retry.\n\t\t\tif (!response) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t// pre-0.58 error message: No response from fetch call\n\t\t\t\t\t\"No response from ODSP fetch call\",\n\t\t\t\t\tOdspErrorTypes.incorrectServerResponse,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!response.ok || response.status < 200 || response.status >= 300) {\n\t\t\t\tthrowOdspNetworkError(\n\t\t\t\t\t// pre-0.58 error message prefix: odspFetchError\n\t\t\t\t\t`ODSP fetch error [${response.status}]`,\n\t\t\t\t\tresponse.status,\n\t\t\t\t\tresponse,\n\t\t\t\t\tawait response.text(),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst headers = headersToMap(response.headers);\n\t\t\treturn {\n\t\t\t\tcontent: response,\n\t\t\t\theaders,\n\t\t\t\tpropsToLog: getSPOAndGraphRequestIdsFromResponse(headers),\n\t\t\t\tduration: performance.now() - start,\n\t\t\t};\n\t\t},\n\t\t(error) => {\n\t\t\tconst online = isOnline();\n\n\t\t\t// The error message may not be suitable to log for privacy reasons, so tag it as such\n\t\t\tconst taggedErrorMessage = {\n\t\t\t\tvalue: `${error}`, // This uses toString for objects, which often results in `${error.name}: ${error.message}`\n\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t};\n\t\t\t// After redacting URLs we believe the error message is safe to log\n\t\t\tconst urlRegex = /((http|https):\\/\\/(\\S*))/i;\n\t\t\tconst redactedErrorText = taggedErrorMessage.value.replace(urlRegex, \"REDACTED_URL\");\n\n\t\t\t// This error is thrown by fetch() when AbortSignal is provided and it gets cancelled\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tif (error.name === \"AbortError\") {\n\t\t\t\tthrow new RetryableError(\n\t\t\t\t\t\"Fetch Timeout (AbortError)\",\n\t\t\t\t\tOdspErrorTypes.fetchTimeout,\n\t\t\t\t\t{\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\t// TCP/IP timeout\n\t\t\tif (redactedErrorText.includes(\"ETIMEDOUT\")) {\n\t\t\t\tthrow new RetryableError(\"Fetch Timeout (ETIMEDOUT)\", OdspErrorTypes.fetchTimeout, {\n\t\t\t\t\tdriverVersion,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (online === OnlineStatus.Offline) {\n\t\t\t\tthrow new RetryableError(\n\t\t\t\t\t// pre-0.58 error message prefix: Offline\n\t\t\t\t\t`ODSP fetch failure (Offline): ${redactedErrorText}`,\n\t\t\t\t\tOdspErrorTypes.offlineError,\n\t\t\t\t\t{\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t\trawErrorMessage: taggedErrorMessage,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// It is perhaps still possible that this is due to being offline, the error does not reveal enough\n\t\t\t\t// information to conclude. Could also be DNS errors, malformed fetch request, CSP violation, etc.\n\t\t\t\tthrow new RetryableError(\n\t\t\t\t\t// pre-0.58 error message prefix: Fetch error\n\t\t\t\t\t`ODSP fetch failure: ${redactedErrorText}`,\n\t\t\t\t\tOdspErrorTypes.fetchFailure,\n\t\t\t\t\t{\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t\trawErrorMessage: taggedErrorMessage,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t);\n}\n\n/**\n * A utility function to fetch and parse as JSON with support for retries\n * @param requestInfo - fetch requestInfo, can be a string\n * @param requestInit - fetch requestInit\n */\nexport async function fetchArray(\n\trequestInfo: RequestInfo,\n\trequestInit: RequestInit | undefined,\n): Promise<IOdspResponse<ArrayBuffer>> {\n\tconst { content, headers, propsToLog, duration } = await fetchHelper(requestInfo, requestInit);\n\tlet arrayBuffer: ArrayBuffer;\n\ttry {\n\t\tarrayBuffer = await content.arrayBuffer();\n\t} catch {\n\t\t// Parsing can fail and message could contain full request URI, including\n\t\t// tokens, etc. So do not log error object itself.\n\t\tthrowOdspNetworkError(\n\t\t\t\"Error while parsing fetch response\",\n\t\t\tfetchIncorrectResponse,\n\t\t\tcontent, // response\n\t\t\tundefined, // response text\n\t\t\tpropsToLog,\n\t\t);\n\t}\n\n\tpropsToLog.bodySize = arrayBuffer.byteLength;\n\treturn {\n\t\theaders,\n\t\tcontent: arrayBuffer,\n\t\tpropsToLog,\n\t\tduration,\n\t};\n}\n\n/**\n * A utility function to fetch and parse as JSON with support for retries\n * @param requestInfo - fetch requestInfo, can be a string\n * @param requestInit - fetch requestInit\n */\nexport async function fetchAndParseAsJSONHelper<T>(\n\trequestInfo: RequestInfo,\n\trequestInit: RequestInit | undefined,\n): Promise<IOdspResponse<T>> {\n\tconst { content, headers, propsToLog, duration } = await fetchHelper(requestInfo, requestInit);\n\tlet text: string | undefined;\n\ttry {\n\t\ttext = await content.text();\n\t} catch {\n\t\t// JSON.parse() can fail and message would container full request URI, including\n\t\t// tokens... It fails for me with \"Unexpected end of JSON input\" quite often - an attempt to download big file\n\t\t// (many ops) almost always ends up with this error - I'd guess 1% of op request end up here... It always\n\t\t// succeeds on retry.\n\t\t// So do not log error object itself.\n\t\tthrowOdspNetworkError(\n\t\t\t// pre-0.58 error message: errorWhileParsingFetchResponse\n\t\t\t\"Error while parsing fetch response\",\n\t\t\tfetchIncorrectResponse,\n\t\t\tcontent, // response\n\t\t\ttext,\n\t\t\tpropsToLog,\n\t\t);\n\t}\n\n\tpropsToLog.bodySize = text.length;\n\tconst res = {\n\t\theaders,\n\t\tcontent: JSON.parse(text) as T,\n\t\tpropsToLog,\n\t\tduration,\n\t};\n\treturn res;\n}\n\nexport interface IFileInfoBase {\n\ttype: \"New\" | \"Existing\";\n\tsiteUrl: string;\n\tdriveId: string;\n}\n\nexport interface INewFileInfo extends IFileInfoBase {\n\ttype: \"New\";\n\tfilename: string;\n\tfilePath: string;\n\t/**\n\t * application can request creation of a share link along with the creation of a new file\n\t * by passing in an optional param to specify the kind of sharing link\n\t */\n\tcreateLinkType?: ISharingLinkKind;\n}\n\nexport interface IExistingFileInfo extends IFileInfoBase {\n\ttype: \"Existing\";\n\titemId: string;\n}\n\nexport function isNewFileInfo(\n\tfileInfo: INewFileInfo | IExistingFileInfo,\n): fileInfo is INewFileInfo {\n\treturn fileInfo.type === undefined || fileInfo.type === \"New\";\n}\n\nexport function getOdspResolvedUrl(resolvedUrl: IResolvedUrl): IOdspResolvedUrl {\n\tassert(\n\t\t(resolvedUrl as IOdspResolvedUrl).odspResolvedUrl === true,\n\t\t0x1de /* \"Not an ODSP resolved url\" */,\n\t);\n\treturn resolvedUrl as IOdspResolvedUrl;\n}\n\n/**\n * Type narrowing utility to determine if the provided {@link @fluidframework/driver-definitions#IResolvedUrl}\n * is an {@link @fluidframework/odsp-driver-definitions#IOdspResolvedUrl}.\n * @internal\n */\nexport function isOdspResolvedUrl(resolvedUrl: IResolvedUrl): resolvedUrl is IOdspResolvedUrl {\n\treturn \"odspResolvedUrl\" in resolvedUrl && resolvedUrl.odspResolvedUrl === true;\n}\n\nexport const createOdspLogger = (logger?: ITelemetryBaseLogger): ITelemetryLoggerExt =>\n\tcreateChildLogger({\n\t\tlogger,\n\t\tnamespace: \"OdspDriver\",\n\t\tproperties: {\n\t\t\tall: {\n\t\t\t\tdriverVersion,\n\t\t\t},\n\t\t},\n\t});\n\nexport function evalBlobsAndTrees(snapshot: IOdspSnapshot): {\n\tnumTrees: number;\n\tnumBlobs: number;\n\tencodedBlobsSize: number;\n\tdecodedBlobsSize: number;\n} {\n\tlet numTrees = 0;\n\tlet numBlobs = 0;\n\tlet encodedBlobsSize = 0;\n\tlet decodedBlobsSize = 0;\n\tfor (const tree of snapshot.trees) {\n\t\tfor (const treeEntry of tree.entries) {\n\t\t\tif (treeEntry.type === \"blob\") {\n\t\t\t\tnumBlobs++;\n\t\t\t} else if (treeEntry.type === \"tree\") {\n\t\t\t\tnumTrees++;\n\t\t\t}\n\t\t}\n\t}\n\tif (snapshot.blobs !== undefined) {\n\t\tfor (const blob of snapshot.blobs) {\n\t\t\tdecodedBlobsSize += blob.size;\n\t\t\tencodedBlobsSize += blob.content.length;\n\t\t}\n\t}\n\treturn { numTrees, numBlobs, encodedBlobsSize, decodedBlobsSize };\n}\n\nexport function toInstrumentedOdspTokenFetcher(\n\tlogger: ITelemetryLoggerExt,\n\tresolvedUrlParts: IOdspUrlParts,\n\ttokenFetcher: TokenFetcher<OdspResourceTokenFetchOptions>,\n\tthrowOnNullToken: boolean,\n): InstrumentedStorageTokenFetcher {\n\treturn async (\n\t\toptions: TokenFetchOptions,\n\t\tname: string,\n\t\talwaysRecordTokenFetchTelemetry: boolean = false,\n\t) => {\n\t\t// Telemetry note: if options.refresh is true, there is a potential perf issue:\n\t\t// Host should optimize and provide non-expired tokens on all critical paths.\n\t\t// Exceptions: race conditions around expiration, revoked tokens, host that does not care\n\t\t// (fluid-fetcher)\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: `${name}_GetToken`,\n\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\thasClaims: !!options.claims,\n\t\t\t\thasTenantId: !!options.tenantId,\n\t\t\t},\n\t\t\tasync (event) =>\n\t\t\t\ttokenFetcher({\n\t\t\t\t\t...options,\n\t\t\t\t\t...resolvedUrlParts,\n\t\t\t\t}).then(\n\t\t\t\t\t(tokenResponse) => {\n\t\t\t\t\t\tconst token = tokenFromResponse(tokenResponse);\n\t\t\t\t\t\t// This event alone generates so many events that is materially impacts cost of telemetry\n\t\t\t\t\t\t// Thus do not report end event when it comes back quickly.\n\t\t\t\t\t\t// Note that most of the hosts do not report if result is comming from cache or not,\n\t\t\t\t\t\t// so we can't rely on that here. But always record if specified explicitly for cases such as\n\t\t\t\t\t\t// calling trees/latest during load.\n\t\t\t\t\t\tif (alwaysRecordTokenFetchTelemetry || event.duration >= 32) {\n\t\t\t\t\t\t\tevent.end({\n\t\t\t\t\t\t\t\tfromCache: isTokenFromCache(tokenResponse),\n\t\t\t\t\t\t\t\tisNull: token === null,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (token === null && throwOnNullToken) {\n\t\t\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t\t\t// pre-0.58 error message: Token is null for ${name} call\n\t\t\t\t\t\t\t\t`The Host-provided token fetcher returned null`,\n\t\t\t\t\t\t\t\tOdspErrorTypes.fetchTokenError,\n\t\t\t\t\t\t\t\t{ method: name, driverVersion },\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn token;\n\t\t\t\t\t},\n\t\t\t\t\t(error) => {\n\t\t\t\t\t\t// There is an important but unofficial contract here where token providers can set canRetry: true\n\t\t\t\t\t\t// to hook into the driver's retry logic (e.g. the retry loop when initiating a connection)\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\tconst rawCanRetry = error?.canRetry;\n\t\t\t\t\t\tconst tokenError = wrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t(errorMessage) =>\n\t\t\t\t\t\t\t\tnew NetworkErrorBasic(\n\t\t\t\t\t\t\t\t\t`The Host-provided token fetcher threw an error`,\n\t\t\t\t\t\t\t\t\tOdspErrorTypes.fetchTokenError,\n\t\t\t\t\t\t\t\t\ttypeof rawCanRetry === \"boolean\"\n\t\t\t\t\t\t\t\t\t\t? rawCanRetry\n\t\t\t\t\t\t\t\t\t\t: false /* canRetry */,\n\t\t\t\t\t\t\t\t\t{ method: name, errorMessage, driverVersion },\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthrow tokenError;\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t{ cancel: \"generic\" },\n\t\t);\n\t};\n}\n\nexport function createCacheSnapshotKey(odspResolvedUrl: IOdspResolvedUrl): ICacheEntry {\n\tconst cacheEntry: ICacheEntry = {\n\t\ttype: snapshotKey,\n\t\tkey: odspResolvedUrl.fileVersion ?? \"\",\n\t\tfile: {\n\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t},\n\t};\n\treturn cacheEntry;\n}\n\n// 80KB is the max body size that we can put in ump post body for server to be able to accept it.\n// Keeping it 78KB to be a little cautious. As per the telemetry 99p is less than 78KB.\nexport const maxUmpPostBodySize = 79872;\n\n/**\n * Build request parameters to request for the creation of a sharing link along with the creation of the file\n * through the /snapshot api call.\n * @param shareLinkType - Kind of sharing link requested\n * @returns A string of request parameters that can be concatenated with the base URI\n */\nexport function buildOdspShareLinkReqParams(\n\tshareLinkType: ISharingLinkKind | undefined,\n): string | undefined {\n\tif (!shareLinkType) {\n\t\treturn;\n\t}\n\tconst scope = shareLinkType.scope;\n\tlet shareLinkRequestParams = `createLinkScope=${scope}`;\n\tconst role = shareLinkType.role;\n\tshareLinkRequestParams = role\n\t\t? `${shareLinkRequestParams}&createLinkRole=${role}`\n\t\t: shareLinkRequestParams;\n\treturn shareLinkRequestParams;\n}\n\nexport function measure<T>(callback: () => T): [T, number] {\n\tconst start = performance.now();\n\tconst result = callback();\n\tconst time = performance.now() - start;\n\treturn [result, time];\n}\n\nexport async function measureP<T>(callback: () => Promise<T>): Promise<[T, number]> {\n\tconst start = performance.now();\n\tconst result = await callback();\n\tconst time = performance.now() - start;\n\treturn [result, time];\n}\n\nexport function getJoinSessionCacheKey(odspResolvedUrl: IOdspResolvedUrl): string {\n\treturn `${odspResolvedUrl.hashedDocumentId}/joinsession`;\n}\n\n/**\n * Utility API to check if the type of snapshot contents is `ISnapshot`.\n * @internal\n * @param obj - obj whose type needs to be identified.\n */\nexport function isInstanceOfISnapshot(\n\t// eslint-disable-next-line import/no-deprecated\n\tobj: ISnapshotContents | ISnapshot | undefined,\n): obj is ISnapshot {\n\treturn obj !== undefined && \"snapshotFormatV\" in obj && obj.snapshotFormatV === 1;\n}\n\n/**\n * This tells whether request if for a specific loading group or not. The snapshot which\n * we fetch on initial load, fetches all ungrouped content.\n */\nexport function isSnapshotFetchForLoadingGroup(loadingGroupIds: string[] | undefined): boolean {\n\treturn loadingGroupIds !== undefined && loadingGroupIds.length > 0;\n}\n\n/*\n * This tells whether we are using legacy flow for fetching snapshot where we don't use\n * groupId query param in the trees latest network call.\n */\nexport function useLegacyFlowWithoutGroupsForSnapshotFetch(\n\tloadingGroupIds: string[] | undefined,\n): boolean {\n\treturn loadingGroupIds === undefined;\n}\n"]}
@@ -28,7 +28,7 @@ export declare class OpsCache {
28
28
  private totalOpsToCache;
29
29
  private readonly batches;
30
30
  private timer;
31
- constructor(startingSequenceNumber: number, logger: ITelemetryLoggerExt, cache: ICache, batchSize: number, timerGranularity: any, totalOpsToCache: any);
31
+ constructor(startingSequenceNumber: number, logger: ITelemetryLoggerExt, cache: ICache, batchSize: number, timerGranularity: number, totalOpsToCache: number);
32
32
  dispose(): void;
33
33
  flushOps(): void;
34
34
  addOps(ops: IMessage[]): void;
@@ -52,4 +52,4 @@ export declare class OpsCache {
52
52
  private getPositionInBatchArray;
53
53
  private initializeNewBatchDataArray;
54
54
  }
55
- //# sourceMappingURL=opsCaching.d.mts.map
55
+ //# sourceMappingURL=opsCaching.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opsCaching.d.ts","sourceRoot":"","sources":["../src/opsCaching.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAItE,MAAM,WAAW,QAAQ;IACxB,cAAc,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC;AAElD,MAAM,WAAW,MAAM;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,UAAU,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,MAAM;IACtB,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACvD,MAAM,IAAI,IAAI,CAAC;CACf;AAED,qBAAa,QAAQ;IAMnB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,eAAe;IATxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyC;IACjE,OAAO,CAAC,KAAK,CAA4C;gBAGxD,sBAAsB,EAAE,MAAM,EACb,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,EACjC,eAAe,EAAE,MAAM;IAiBzB,OAAO,IAAI,IAAI;IAQf,QAAQ,IAAI,IAAI;IAiBhB,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,IAAI;IAkDpC;;;;;OAKG;YACW,OAAO;IAwCrB;;;;;OAKG;IACU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAkBhE,SAAS,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAU3D,SAAS,CAAC,aAAa,IAAI,IAAI;IAS/B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,2BAA2B;CAKnC"}
@@ -75,6 +75,7 @@ export class OpsCache {
75
75
  if (currentBatch.remainingSlots === 0) {
76
76
  // batch is full, flush to cache
77
77
  this.write(batchNumber, currentBatch);
78
+ // eslint-disable-next-line unicorn/no-null
78
79
  this.batches.set(batchNumber, null);
79
80
  }
80
81
  else {
@@ -122,7 +123,7 @@ export class OpsCache {
122
123
  }
123
124
  messages.push(op);
124
125
  }
125
- else if (messages.length !== 0) {
126
+ else if (messages.length > 0) {
126
127
  // If there is any gap, return the messages till now.
127
128
  return messages;
128
129
  }
@@ -185,4 +186,4 @@ export class OpsCache {
185
186
  return tempArray;
186
187
  }
187
188
  }
188
- //# sourceMappingURL=opsCaching.mjs.map
189
+ //# sourceMappingURL=opsCaching.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opsCaching.js","sourceRoot":"","sources":["../src/opsCaching.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAwB3D,MAAM,OAAO,QAAQ;IAIpB,YACC,sBAA8B,EACb,MAA2B,EAC3B,KAAa,EACb,SAAiB,EACjB,gBAAwB,EACjC,e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C,CAAC,CAAC;IACL,CAAC;IAES,aAAa;QACtB,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,gBAAgB,GAAG,CAAC,EAAE;YAC7C,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC5B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;gBACvB,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjB,CAAC,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;SAC1B;IACF,CAAC;IAEO,cAAc,CAAC,cAAsB;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAEO,uBAAuB,CAAC,cAAsB;QACrD,OAAO,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;IACxC,CAAC;IAEO,2BAA2B;QAClC,MAAM,SAAS,GAAe,EAAE,CAAC;QACjC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,sCAAsC;QACzE,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\n\n// ISequencedDocumentMessage\nexport interface IMessage {\n\tsequenceNumber: number;\n}\n\nexport type CacheEntry = (IMessage | undefined)[];\n\nexport interface IBatch {\n\tremainingSlots: number;\n\tbatchData: CacheEntry;\n\t/**\n\t * Tells if this batch is dirty, i.e. it contains ops that were not flushed to cache\n\t */\n\tdirty: boolean;\n}\n\nexport interface ICache {\n\twrite(batchNumber: string, data: string): Promise<void>;\n\tread(batchNumber: string): Promise<string | undefined>;\n\tremove(): void;\n}\n\nexport class OpsCache {\n\tprivate readonly batches: Map<number, null | IBatch> = new Map();\n\tprivate timer: ReturnType<typeof setTimeout> | undefined;\n\n\tconstructor(\n\t\tstartingSequenceNumber: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly cache: ICache,\n\t\tprivate readonly batchSize: number,\n\t\tprivate readonly timerGranularity: number,\n\t\tprivate totalOpsToCache: number,\n\t) {\n\t\t/**\n\t\t * Initial batch is a special case because it will never be full - all ops prior (inclusive) to\n\t\t * `startingSequenceNumber` are never going to show up (undefined)\n\t\t */\n\t\tconst remainingSlots =\n\t\t\tthis.batchSize - this.getPositionInBatchArray(startingSequenceNumber) - 1;\n\t\tif (remainingSlots !== 0) {\n\t\t\tthis.batches.set(this.getBatchNumber(startingSequenceNumber), {\n\t\t\t\tremainingSlots,\n\t\t\t\tbatchData: this.initializeNewBatchDataArray(),\n\t\t\t\tdirty: false,\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic dispose(): void {\n\t\tthis.batches.clear();\n\t\tif (this.timer !== undefined) {\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = undefined;\n\t\t}\n\t}\n\n\tpublic flushOps(): void {\n\t\tfor (const [key, value] of this.batches) {\n\t\t\t// Don't flush if the batch has no ops, already flushed or has empty slots at both beginning and end.\n\t\t\tif (\n\t\t\t\tvalue === null ||\n\t\t\t\t!value.dirty ||\n\t\t\t\tvalue.batchData.length === 0 ||\n\t\t\t\t(value.batchData[0] === undefined &&\n\t\t\t\t\tvalue.batchData[value.batchData.length - 1] === undefined)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvalue.dirty = false;\n\t\t\tthis.write(key, value);\n\t\t}\n\t}\n\n\tpublic addOps(ops: IMessage[]): void {\n\t\tif (this.totalOpsToCache <= 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const op of ops) {\n\t\t\tconst batchNumber = this.getBatchNumber(op.sequenceNumber);\n\t\t\tconst positionInBatch = this.getPositionInBatchArray(op.sequenceNumber);\n\n\t\t\tlet currentBatch = this.batches.get(batchNumber);\n\n\t\t\tif (currentBatch === undefined) {\n\t\t\t\tcurrentBatch = {\n\t\t\t\t\tremainingSlots: this.batchSize - 1,\n\t\t\t\t\tbatchData: this.initializeNewBatchDataArray(),\n\t\t\t\t\tdirty: true,\n\t\t\t\t};\n\t\t\t\tcurrentBatch.batchData[positionInBatch] = op;\n\t\t\t\tthis.batches.set(batchNumber, currentBatch);\n\t\t\t} else if (\n\t\t\t\tcurrentBatch !== null &&\n\t\t\t\tcurrentBatch.batchData[positionInBatch] === undefined\n\t\t\t) {\n\t\t\t\tcurrentBatch.batchData[positionInBatch] = op;\n\t\t\t\tcurrentBatch.remainingSlots--;\n\t\t\t\tcurrentBatch.dirty = true;\n\t\t\t} else {\n\t\t\t\t// Either batch was flushed or this op was already there - nothing to do!\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (currentBatch.remainingSlots === 0) {\n\t\t\t\t// batch is full, flush to cache\n\t\t\t\tthis.write(batchNumber, currentBatch);\n\t\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\t\tthis.batches.set(batchNumber, null);\n\t\t\t} else {\n\t\t\t\tthis.scheduleTimer();\n\t\t\t}\n\n\t\t\tthis.totalOpsToCache--;\n\t\t\tif (this.totalOpsToCache === 0) {\n\t\t\t\tthis.logger.sendPerformanceEvent({ eventName: \"CacheOpsLimitHit\" });\n\t\t\t\tthis.cache.remove();\n\t\t\t\tthis.dispose();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves ops from cache\n\t * @param from - inclusive\n\t * @param to - exclusive\n\t * @returns ops retrieved\n\t */\n\tprivate async getCore(from: number, to?: number): Promise<IMessage[]> {\n\t\tconst messages: IMessage[] = [];\n\t\tlet batchNumber = this.getBatchNumber(from);\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tconst res = await this.cache.read(`${this.batchSize}_${batchNumber}`);\n\t\t\tif (res === undefined) {\n\t\t\t\treturn messages;\n\t\t\t}\n\t\t\tconst result: CacheEntry = JSON.parse(res) as CacheEntry;\n\t\t\tconst prevMessagesLength = messages.length;\n\t\t\tfor (const op of result) {\n\t\t\t\t// Note that we write out undefined, but due to JSON.stringify, it turns into null!\n\t\t\t\tif (op) {\n\t\t\t\t\tif (to !== undefined && op.sequenceNumber >= to) {\n\t\t\t\t\t\treturn messages;\n\t\t\t\t\t}\n\t\t\t\t\tif (messages.length === 0) {\n\t\t\t\t\t\tif (op.sequenceNumber > from) {\n\t\t\t\t\t\t\treturn messages;\n\t\t\t\t\t\t} else if (op.sequenceNumber < from) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tmessages.push(op);\n\t\t\t\t} else if (messages.length > 0) {\n\t\t\t\t\t// If there is any gap, return the messages till now.\n\t\t\t\t\treturn messages;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we didn't get any op from this batch, then return messages till now. As it tells us that,\n\t\t\t// either the first message \"from\" is not present in cache or a gap will occur from 1 batch to next.\n\t\t\tif (prevMessagesLength === messages.length) {\n\t\t\t\treturn messages;\n\t\t\t}\n\t\t\tbatchNumber++;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves ops from cache\n\t * @param from - inclusive\n\t * @param to - exclusive\n\t * @returns ops retrieved\n\t */\n\tpublic async get(from: number, to?: number): Promise<IMessage[]> {\n\t\tconst start = performance.now();\n\n\t\tconst messages = await this.getCore(from, to);\n\n\t\tconst duration = performance.now() - start;\n\t\tif (messages.length > 0 || duration > 1000) {\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"CacheOpsUsed\",\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tlength: messages.length,\n\t\t\t\tduration,\n\t\t\t});\n\t\t}\n\t\treturn messages;\n\t}\n\n\tprotected write(batchNumber: number, payload: IBatch): void {\n\t\t// Errors are caught and logged by PersistedCacheWithErrorHandling that sits\n\t\t// in the adapter chain of cache adapters\n\t\tthis.cache\n\t\t\t.write(`${this.batchSize}_${batchNumber}`, JSON.stringify(payload.batchData))\n\t\t\t.catch(() => {\n\t\t\t\tthis.totalOpsToCache = 0;\n\t\t\t});\n\t}\n\n\tprotected scheduleTimer(): void {\n\t\tif (!this.timer && this.timerGranularity > 0) {\n\t\t\tthis.timer = setTimeout(() => {\n\t\t\t\tthis.timer = undefined;\n\t\t\t\tthis.flushOps();\n\t\t\t}, this.timerGranularity);\n\t\t}\n\t}\n\n\tprivate getBatchNumber(sequenceNumber: number): number {\n\t\treturn Math.floor(sequenceNumber / this.batchSize);\n\t}\n\n\tprivate getPositionInBatchArray(sequenceNumber: number): number {\n\t\treturn sequenceNumber % this.batchSize;\n\t}\n\n\tprivate initializeNewBatchDataArray(): IMessage[] {\n\t\tconst tempArray: IMessage[] = [];\n\t\ttempArray.length = this.batchSize; // fill with empty, undefined elements\n\t\treturn tempArray;\n\t}\n}\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/odsp-driver";
8
- export declare const pkgVersion = "2.0.0-dev-rc.1.0.0.232845";
9
- //# sourceMappingURL=packageVersion.d.mts.map
8
+ export declare const pkgVersion = "2.0.0-dev-rc.2.0.0.246488";
9
+ //# sourceMappingURL=packageVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,gCAAgC,CAAC;AACrD,eAAO,MAAM,UAAU,8BAA8B,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/odsp-driver";
8
- export const pkgVersion = "2.0.0-dev-rc.1.0.0.232845";
9
- //# sourceMappingURL=packageVersion.mjs.map
8
+ export const pkgVersion = "2.0.0-dev-rc.2.0.0.246488";
9
+ //# sourceMappingURL=packageVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"2.0.0-dev-rc.2.0.0.246488\";\n"]}
@@ -5,8 +5,8 @@
5
5
  import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
6
6
  import { IResolvedUrl } from "@fluidframework/driver-definitions";
7
7
  import { IPersistedCache, ISnapshotOptions, OdspResourceTokenFetchOptions, TokenFetcher } from "@fluidframework/odsp-driver-definitions";
8
- import { SnapshotFormatSupportType } from "./fetchSnapshot.mjs";
9
- import { OdspDocumentServiceFactory } from "./odspDocumentServiceFactory.mjs";
8
+ import { SnapshotFormatSupportType } from "./fetchSnapshot.js";
9
+ import { OdspDocumentServiceFactory } from "./odspDocumentServiceFactory.js";
10
10
  /**
11
11
  * Function to prefetch the snapshot and cached it in the persistant cache, so that when the container is loaded
12
12
  * the cached latest snapshot could be used and removes the network call from the critical path.
@@ -30,4 +30,4 @@ import { OdspDocumentServiceFactory } from "./odspDocumentServiceFactory.mjs";
30
30
  * @alpha
31
31
  */
32
32
  export declare function prefetchLatestSnapshot(resolvedUrl: IResolvedUrl, getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, persistedCache: IPersistedCache, forceAccessTokenViaAuthorizationHeader: boolean, logger: ITelemetryBaseLogger, hostSnapshotFetchOptions: ISnapshotOptions | undefined, enableRedeemFallback?: boolean, fetchBinarySnapshotFormat?: boolean, snapshotFormatFetchType?: SnapshotFormatSupportType, odspDocumentServiceFactory?: OdspDocumentServiceFactory): Promise<boolean>;
33
- //# sourceMappingURL=prefetchLatestSnapshot.d.mts.map
33
+ //# sourceMappingURL=prefetchLatestSnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefetchLatestSnapshot.d.ts","sourceRoot":"","sources":["../src/prefetchLatestSnapshot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAEN,eAAe,EACf,gBAAgB,EAChB,6BAA6B,EAC7B,YAAY,EAGZ,MAAM,yCAAyC,CAAC;AAQjD,OAAO,EAIN,yBAAyB,EACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,sBAAsB,CAC3C,WAAW,EAAE,YAAY,EACzB,eAAe,EAAE,YAAY,CAAC,6BAA6B,CAAC,EAC5D,cAAc,EAAE,eAAe,EAC/B,sCAAsC,EAAE,OAAO,EAC/C,MAAM,EAAE,oBAAoB,EAC5B,wBAAwB,EAAE,gBAAgB,GAAG,SAAS,EACtD,oBAAoB,GAAE,OAAc,EACpC,yBAAyB,CAAC,EAAE,OAAO,EACnC,uBAAuB,CAAC,EAAE,yBAAyB,EACnD,0BAA0B,CAAC,EAAE,0BAA0B,GACrD,OAAO,CAAC,OAAO,CAAC,CAgHlB"}
@@ -5,9 +5,9 @@
5
5
  import { performance } from "@fluid-internal/client-utils";
6
6
  import { assert, Deferred } from "@fluidframework/core-utils";
7
7
  import { getKeyForCacheEntry, } from "@fluidframework/odsp-driver-definitions";
8
- import { createChildLogger, PerformanceEvent } from "@fluidframework/telemetry-utils";
9
- import { createCacheSnapshotKey, createOdspLogger, getOdspResolvedUrl, toInstrumentedOdspTokenFetcher, } from "./odspUtils.mjs";
10
- import { downloadSnapshot, fetchSnapshotWithRedeem, } from "./fetchSnapshot.mjs";
8
+ import { createChildMonitoringContext, PerformanceEvent } from "@fluidframework/telemetry-utils";
9
+ import { createCacheSnapshotKey, createOdspLogger, getOdspResolvedUrl, toInstrumentedOdspTokenFetcher, } from "./odspUtils.js";
10
+ import { downloadSnapshot, fetchSnapshotWithRedeem, } from "./fetchSnapshot.js";
11
11
  /**
12
12
  * Function to prefetch the snapshot and cached it in the persistant cache, so that when the container is loaded
13
13
  * the cached latest snapshot could be used and removes the network call from the critical path.
@@ -31,7 +31,12 @@ import { downloadSnapshot, fetchSnapshotWithRedeem, } from "./fetchSnapshot.mjs"
31
31
  * @alpha
32
32
  */
33
33
  export async function prefetchLatestSnapshot(resolvedUrl, getStorageToken, persistedCache, forceAccessTokenViaAuthorizationHeader, logger, hostSnapshotFetchOptions, enableRedeemFallback = true, fetchBinarySnapshotFormat, snapshotFormatFetchType, odspDocumentServiceFactory) {
34
- const odspLogger = createOdspLogger(createChildLogger({ logger, namespace: "PrefetchSnapshot" }));
34
+ const mc = createChildMonitoringContext({ logger, namespace: "PrefetchSnapshot" });
35
+ const odspLogger = createOdspLogger(mc.logger);
36
+ const useGroupIdsForSnapshotFetch = mc.config.getBoolean("Fluid.Container.UseLoadingGroupIdForSnapshotFetch");
37
+ // For prefetch, we just want to fetch the ungrouped data and want to use the new API if the
38
+ // feature gate is set, so provide an empty array.
39
+ const loadingGroupIds = useGroupIdsForSnapshotFetch ? [] : undefined;
35
40
  const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);
36
41
  const resolvedUrlData = {
37
42
  siteUrl: odspResolvedUrl.siteUrl,
@@ -39,8 +44,8 @@ export async function prefetchLatestSnapshot(resolvedUrl, getStorageToken, persi
39
44
  itemId: odspResolvedUrl.itemId,
40
45
  };
41
46
  const storageTokenFetcher = toInstrumentedOdspTokenFetcher(odspLogger, resolvedUrlData, getStorageToken, true /* throwOnNullToken */);
42
- const snapshotDownloader = async (finalOdspResolvedUrl, storageToken, snapshotOptions, controller) => {
43
- return downloadSnapshot(finalOdspResolvedUrl, storageToken, odspLogger, snapshotOptions, undefined, controller);
47
+ const snapshotDownloader = async (finalOdspResolvedUrl, storageToken, loadingGroupId, snapshotOptions, controller) => {
48
+ return downloadSnapshot(finalOdspResolvedUrl, storageToken, loadingGroupId, snapshotOptions, undefined, controller);
44
49
  };
45
50
  const snapshotKey = createCacheSnapshotKey(odspResolvedUrl);
46
51
  let cacheP;
@@ -58,7 +63,7 @@ export async function prefetchLatestSnapshot(resolvedUrl, getStorageToken, persi
58
63
  const nonPersistentCacheKey = getKeyForCacheEntry(snapshotKey);
59
64
  const snapshotNonPersistentCache = odspDocumentServiceFactory?.snapshotPrefetchResultCache;
60
65
  snapshotNonPersistentCache?.add(nonPersistentCacheKey, async () => snapshotContentsWithEpochP.promise);
61
- await fetchSnapshotWithRedeem(odspResolvedUrl, storageTokenFetcher, hostSnapshotFetchOptions, forceAccessTokenViaAuthorizationHeader, odspLogger, snapshotDownloader, putInCache, removeEntries, enableRedeemFallback)
66
+ await fetchSnapshotWithRedeem(odspResolvedUrl, storageTokenFetcher, hostSnapshotFetchOptions, forceAccessTokenViaAuthorizationHeader, odspLogger, snapshotDownloader, putInCache, removeEntries, loadingGroupIds, enableRedeemFallback)
62
67
  .then(async (value) => {
63
68
  assert(!!snapshotEpoch, 0x585 /* prefetched snapshot should have a valid epoch */);
64
69
  snapshotContentsWithEpochP.resolve({
@@ -81,11 +86,11 @@ export async function prefetchLatestSnapshot(resolvedUrl, getStorageToken, persi
81
86
  snapshotNonPersistentCache?.remove(nonPersistentCacheKey);
82
87
  }, 5000);
83
88
  })
84
- .catch((err) => {
89
+ .catch((error) => {
85
90
  // Remove it from the non persistent cache if an error occured.
86
91
  snapshotNonPersistentCache?.remove(nonPersistentCacheKey);
87
- snapshotContentsWithEpochP.reject(err);
88
- throw err;
92
+ snapshotContentsWithEpochP.reject(error);
93
+ throw error;
89
94
  });
90
95
  return true;
91
96
  }).catch(async (error) => {
@@ -93,4 +98,4 @@ export async function prefetchLatestSnapshot(resolvedUrl, getStorageToken, persi
93
98
  return false;
94
99
  });
95
100
  }
96
- //# sourceMappingURL=prefetchLatestSnapshot.mjs.map
101
+ //# sourceMappingURL=prefetchLatestSnapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefetchLatestSnapshot.js","sourceRoot":"","sources":["../src/prefetchLatestSnapshot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAON,mBAAmB,GACnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,8BAA8B,GAC9B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,gBAAgB,EAChB,uBAAuB,GAGvB,MAAM,oBAAoB,CAAC;AAK5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,WAAyB,EACzB,eAA4D,EAC5D,cAA+B,EAC/B,sCAA+C,EAC/C,MAA4B,EAC5B,wBAAsD,EACtD,uBAAgC,IAAI,EACpC,yBAAmC,EACnC,uBAAmD,EACnD,0BAAuD;IAEvD,MAAM,EAAE,GAAG,4BAA4B,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACnF,MAAM,UAAU,GAAG,gBAAgB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,2BAA2B,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CACvD,mDAAmD,CACnD,CAAC;IACF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;QACb,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CAAC;IACb,CAAC,CACD,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACvB,UAAU,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,6BAA6B,EAAE,EAAE,KAAK,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\nimport { IResolvedUrl } from \"@fluidframework/driver-definitions\";\nimport {\n\tIOdspResolvedUrl,\n\tIPersistedCache,\n\tISnapshotOptions,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n\tIOdspUrlParts,\n\tgetKeyForCacheEntry,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { createChildMonitoringContext, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n\tcreateCacheSnapshotKey,\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\ttoInstrumentedOdspTokenFetcher,\n} from \"./odspUtils.js\";\nimport {\n\tdownloadSnapshot,\n\tfetchSnapshotWithRedeem,\n\tISnapshotRequestAndResponseOptions,\n\tSnapshotFormatSupportType,\n} from \"./fetchSnapshot.js\";\nimport { IVersionedValueWithEpoch } from \"./contracts.js\";\nimport { IPrefetchSnapshotContents } from \"./odspCache.js\";\nimport { OdspDocumentServiceFactory } from \"./odspDocumentServiceFactory.js\";\n\n/**\n * Function to prefetch the snapshot and cached it in the persistant cache, so that when the container is loaded\n * the cached latest snapshot could be used and removes the network call from the critical path.\n *\n * @param resolvedUrl - Resolved url to fetch the snapshot.\n * @param getStorageToken - function that can provide the storage token for a given site. This is\n * is also referred to as the \"VROOM\" token in SPO.\n * @param persistedCache - Cache to store the fetched snapshot.\n * @param forceAccessTokenViaAuthorizationHeader - whether to force passing given token via authorization header.\n * @param logger - Logger to have telemetry events.\n * @param hostSnapshotFetchOptions - Options to fetch the snapshot if any. Otherwise default will be used.\n * @param enableRedeemFallback - True to have the sharing link redeem fallback in case the Trees Latest/Redeem\n * 1RT call fails with redeem error. During fallback it will first redeem the sharing link and then make\n * the Trees latest call.\n * Note: this can be considered deprecated - it will be replaced with `snapshotFormatFetchType`.\n * @param fetchBinarySnapshotFormat - Control if we want to fetch binary format snapshot.\n * @param snapshotFormatFetchType - Snapshot format to fetch.\n * @param odspDocumentServiceFactory - factory to access the non persistent cache and store the prefetch promise.\n *\n * @returns `true` if the snapshot is cached, `false` otherwise.\n * @alpha\n */\nexport async function prefetchLatestSnapshot(\n\tresolvedUrl: IResolvedUrl,\n\tgetStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\tpersistedCache: IPersistedCache,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tlogger: ITelemetryBaseLogger,\n\thostSnapshotFetchOptions: ISnapshotOptions | undefined,\n\tenableRedeemFallback: boolean = true,\n\tfetchBinarySnapshotFormat?: boolean,\n\tsnapshotFormatFetchType?: SnapshotFormatSupportType,\n\todspDocumentServiceFactory?: OdspDocumentServiceFactory,\n): Promise<boolean> {\n\tconst mc = createChildMonitoringContext({ logger, namespace: \"PrefetchSnapshot\" });\n\tconst odspLogger = createOdspLogger(mc.logger);\n\tconst useGroupIdsForSnapshotFetch = mc.config.getBoolean(\n\t\t\"Fluid.Container.UseLoadingGroupIdForSnapshotFetch\",\n\t);\n\t// For prefetch, we just want to fetch the ungrouped data and want to use the new API if the\n\t// feature gate is set, so provide an empty array.\n\tconst loadingGroupIds = useGroupIdsForSnapshotFetch ? [] : undefined;\n\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\tconst resolvedUrlData: IOdspUrlParts = {\n\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\tdriveId: odspResolvedUrl.driveId,\n\t\titemId: odspResolvedUrl.itemId,\n\t};\n\tconst storageTokenFetcher = toInstrumentedOdspTokenFetcher(\n\t\todspLogger,\n\t\tresolvedUrlData,\n\t\tgetStorageToken,\n\t\ttrue /* throwOnNullToken */,\n\t);\n\n\tconst snapshotDownloader = async (\n\t\tfinalOdspResolvedUrl: IOdspResolvedUrl,\n\t\tstorageToken: string,\n\t\tloadingGroupId: string[] | undefined,\n\t\tsnapshotOptions: ISnapshotOptions | undefined,\n\t\tcontroller?: AbortController,\n\t): Promise<ISnapshotRequestAndResponseOptions> => {\n\t\treturn downloadSnapshot(\n\t\t\tfinalOdspResolvedUrl,\n\t\t\tstorageToken,\n\t\t\tloadingGroupId,\n\t\t\tsnapshotOptions,\n\t\t\tundefined,\n\t\t\tcontroller,\n\t\t);\n\t};\n\tconst snapshotKey = createCacheSnapshotKey(odspResolvedUrl);\n\tlet cacheP: Promise<void> | undefined;\n\tlet snapshotEpoch: string | undefined;\n\tconst putInCache = async (valueWithEpoch: IVersionedValueWithEpoch): Promise<void> => {\n\t\tsnapshotEpoch = valueWithEpoch.fluidEpoch;\n\t\tcacheP = persistedCache.put(snapshotKey, valueWithEpoch);\n\t\treturn cacheP;\n\t};\n\n\tconst removeEntries = async (): Promise<void> => persistedCache.removeEntries(snapshotKey.file);\n\treturn PerformanceEvent.timedExecAsync(\n\t\todspLogger,\n\t\t{ eventName: \"PrefetchLatestSnapshot\" },\n\t\tasync () => {\n\t\t\tconst prefetchStartTime = performance.now();\n\t\t\t// Add the deferred promise to the cache, so that it can be leveraged while loading the container.\n\t\t\tconst snapshotContentsWithEpochP = new Deferred<IPrefetchSnapshotContents>();\n\t\t\tconst nonPersistentCacheKey = getKeyForCacheEntry(snapshotKey);\n\t\t\tconst snapshotNonPersistentCache =\n\t\t\t\todspDocumentServiceFactory?.snapshotPrefetchResultCache;\n\t\t\tsnapshotNonPersistentCache?.add(\n\t\t\t\tnonPersistentCacheKey,\n\t\t\t\tasync () => snapshotContentsWithEpochP.promise,\n\t\t\t);\n\t\t\tawait fetchSnapshotWithRedeem(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tstorageTokenFetcher,\n\t\t\t\thostSnapshotFetchOptions,\n\t\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t\t\todspLogger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t\tputInCache,\n\t\t\t\tremoveEntries,\n\t\t\t\tloadingGroupIds,\n\t\t\t\tenableRedeemFallback,\n\t\t\t)\n\t\t\t\t.then(async (value) => {\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!snapshotEpoch,\n\t\t\t\t\t\t0x585 /* prefetched snapshot should have a valid epoch */,\n\t\t\t\t\t);\n\t\t\t\t\tsnapshotContentsWithEpochP.resolve({\n\t\t\t\t\t\t...value,\n\t\t\t\t\t\tfluidEpoch: snapshotEpoch,\n\t\t\t\t\t\tprefetchStartTime,\n\t\t\t\t\t});\n\t\t\t\t\tassert(cacheP !== undefined, 0x1e7 /* \"caching was not performed!\" */);\n\t\t\t\t\tawait cacheP;\n\t\t\t\t\t// Schedule it to remove from cache after 5s.\n\t\t\t\t\t// 1. While it's in snapshotNonPersistentCache: Load flow will use this value and will not attempt\n\t\t\t\t\t// to fetch snapshot from network again. That's the best from perf POV, but cache will not be\n\t\t\t\t\t// updated if we keep it in this cache, thus we want to eventually remove snapshot from this cache.\n\t\t\t\t\t// 2. After it's removed from snapshotNonPersistentCache: snapshot is present in persistent cache,\n\t\t\t\t\t// so we sill still use it (in accordance with cache policy controlled by host). But load flow will\n\t\t\t\t\t// also fetch snapshot (in parallel) from storage and update cache. This is fine long term,\n\t\t\t\t\t// but is an extra cost (unneeded network call). However since it is 5s older, new network call\n\t\t\t\t\t// will update the snapshot in cache.\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tsnapshotNonPersistentCache?.remove(nonPersistentCacheKey);\n\t\t\t\t\t}, 5000);\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\t// Remove it from the non persistent cache if an error occured.\n\t\t\t\t\tsnapshotNonPersistentCache?.remove(nonPersistentCacheKey);\n\t\t\t\t\tsnapshotContentsWithEpochP.reject(error);\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t\treturn true;\n\t\t},\n\t).catch(async (error) => {\n\t\todspLogger.sendErrorEvent({ eventName: \"PrefetchLatestSnapshotError\" }, error);\n\t\treturn false;\n\t});\n}\n"]}
@@ -14,7 +14,6 @@ export declare class RetryErrorsStorageAdapter implements IDocumentStorageServic
14
14
  get policies(): IDocumentStorageServicePolicies | undefined;
15
15
  get disposed(): boolean;
16
16
  dispose(): void;
17
- get repositoryUrl(): string;
18
17
  getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
19
18
  getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
20
19
  readBlob(id: string): Promise<ArrayBufferLike>;
@@ -25,4 +24,4 @@ export declare class RetryErrorsStorageAdapter implements IDocumentStorageServic
25
24
  private checkStorageDisposed;
26
25
  private runWithRetry;
27
26
  }
28
- //# sourceMappingURL=retryErrorsStorageAdapter.d.mts.map
27
+ //# sourceMappingURL=retryErrorsStorageAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retryErrorsStorageAdapter.d.ts","sourceRoot":"","sources":["../src/retryErrorsStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,mBAAmB,EAAc,MAAM,iCAAiC,CAAC;AAChG,OAAO,EACN,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,qBAAa,yBAA0B,YAAW,uBAAuB,EAAE,WAAW;IAGpF,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHxB,OAAO,CAAC,SAAS,CAAS;gBAER,sBAAsB,EAAE,uBAAuB,EAC/C,MAAM,EAAE,mBAAmB;IAG7C,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAEjE;IACD,IAAW,QAAQ,IAAI,OAAO,CAE7B;IACM,OAAO,IAAI,IAAI;IAKT,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAOlE,WAAW,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IAS7E,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAO9C,WAAW,CAEvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAaT,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAQL,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAO9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAO5E,OAAO,CAAC,oBAAoB;YASd,YAAY;CAG1B"}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { LoggingError, UsageError } from "@fluidframework/telemetry-utils";
6
- import { runWithRetry } from "./retryUtils.mjs";
6
+ import { runWithRetry } from "./retryUtils.js";
7
7
  export class RetryErrorsStorageAdapter {
8
8
  constructor(internalStorageService, logger) {
9
9
  this.internalStorageService = internalStorageService;
@@ -19,9 +19,6 @@ export class RetryErrorsStorageAdapter {
19
19
  dispose() {
20
20
  this._disposed = true;
21
21
  }
22
- get repositoryUrl() {
23
- return this.internalStorageService.repositoryUrl;
24
- }
25
22
  // eslint-disable-next-line @rushstack/no-new-null
26
23
  async getSnapshotTree(version) {
27
24
  return this.runWithRetry(async () => this.internalStorageService.getSnapshotTree(version), "storage_getSnapshotTree");
@@ -64,4 +61,4 @@ export class RetryErrorsStorageAdapter {
64
61
  return runWithRetry(api, callName, this.logger, () => this.checkStorageDisposed());
65
62
  }
66
63
  }
67
- //# sourceMappingURL=retryErrorsStorageAdapter.mjs.map
64
+ //# sourceMappingURL=retryErrorsStorageAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retryErrorsStorageAdapter.js","sourceRoot":"","sources":["../src/retryErrorsStorageAdapter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAuB,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAiBhG,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,OAAO,yBAAyB;IAErC,YACkB,sBAA+C,EAC/C,MAA2B;QAD3B,2BAAsB,GAAtB,sBAAsB,CAAyB;QAC/C,WAAM,GAAN,MAAM,CAAqB;QAHrC,cAAS,GAAG,KAAK,CAAC;IAIvB,CAAC;IAEJ,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IACD,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IACM,OAAO;QACb,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,kDAAkD;IAC3C,KAAK,CAAC,eAAe,CAAC,OAAkB;QAC9C,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,OAAO,CAAC,EAChE,yBAAyB,CACzB,CAAC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,CAAC,UAAU,CAAC,IAAqB;QAC5C,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,EACxD,oBAAoB,CACpB,CAAC;IACH,CAAC;IAEO,oBAAoB;QAC3B,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,4DAA4D;YAC5D,MAAM,IAAI,YAAY,CAAC,2CAA2C,EAAE;gBACnE,QAAQ,EAAE,KAAK;aACf,CAAC,CAAC;SACH;IACF,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACpE,OAAO,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACpF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LoggingError, ITelemetryLoggerExt, UsageError } from \"@fluidframework/telemetry-utils\";\nimport {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { runWithRetry } from \"./retryUtils.js\";\n\nexport class RetryErrorsStorageAdapter implements IDocumentStorageService, IDisposable {\n\tprivate _disposed = false;\n\tconstructor(\n\t\tprivate readonly internalStorageService: IDocumentStorageService,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this.internalStorageService.policies;\n\t}\n\tpublic get disposed(): boolean {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose(): void {\n\t\tthis._disposed = true;\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.getSnapshotTree(version),\n\t\t\t\"storage_getSnapshotTree\",\n\t\t);\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\treturn this.runWithRetry(async () => {\n\t\t\tif (this.internalStorageService.getSnapshot !== undefined) {\n\t\t\t\treturn this.internalStorageService.getSnapshot(snapshotFetchOptions);\n\t\t\t}\n\t\t\tthrow new UsageError(\"getSnapshot should exist in storage adapter in ODSP driver\");\n\t\t}, \"storage_getSnapshot\");\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.readBlob(id),\n\t\t\t\"storage_readBlob\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageService.getVersions(\n\t\t\t\t\tversionId,\n\t\t\t\t\tcount,\n\t\t\t\t\tscenarioName,\n\t\t\t\t\tfetchSource,\n\t\t\t\t),\n\t\t\t\"storage_getVersions\",\n\t\t);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\t// Creation flow with attachment blobs - need to do retries!\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.uploadSummaryWithContext(summary, context),\n\t\t\t\"storage_uploadSummaryWithContext\",\n\t\t);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.downloadSummary(handle),\n\t\t\t\"storage_downloadSummary\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.createBlob(file),\n\t\t\t\"storage_createBlob\",\n\t\t);\n\t}\n\n\tprivate checkStorageDisposed(): void {\n\t\tif (this._disposed) {\n\t\t\t// pre-0.58 error message: storageServiceDisposedCannotRetry\n\t\t\tthrow new LoggingError(\"Storage Service is disposed. Cannot retry\", {\n\t\t\t\tcanRetry: false,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(api, callName, this.logger, () => this.checkStorageDisposed());\n\t}\n}\n"]}
@@ -7,4 +7,4 @@ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
7
7
  * This method retries only for retriable coherency and service read only errors.
8
8
  */
9
9
  export declare function runWithRetry<T>(api: () => Promise<T>, callName: string, logger: ITelemetryLoggerExt, checkDisposed?: () => void): Promise<T>;
10
- //# sourceMappingURL=retryUtils.d.mts.map
10
+ //# sourceMappingURL=retryUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retryUtils.d.ts","sourceRoot":"","sources":["../src/retryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAOtE;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EACnC,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACrB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,mBAAmB,EAC3B,aAAa,CAAC,EAAE,MAAM,IAAI,GACxB,OAAO,CAAC,CAAC,CAAC,CAgFZ"}
@@ -6,7 +6,7 @@ import { performance } from "@fluid-internal/client-utils";
6
6
  import { delay } from "@fluidframework/core-utils";
7
7
  import { canRetryOnError, getRetryDelayFromError } from "@fluidframework/driver-utils";
8
8
  import { OdspErrorTypes } from "@fluidframework/odsp-driver-definitions";
9
- import { Odsp409Error } from "./epochTracker.mjs";
9
+ import { Odsp409Error } from "./epochTracker.js";
10
10
  /**
11
11
  * This method retries only for retriable coherency and service read only errors.
12
12
  */
@@ -29,10 +29,13 @@ export async function runWithRetry(api, callName, logger, checkDisposed) {
29
29
  }, lastError);
30
30
  }
31
31
  return result;
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
33
  }
33
34
  catch (error) {
34
35
  const canRetry = canRetryOnError(error);
36
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
35
37
  const coherencyError = error?.[Odsp409Error] === true;
38
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
36
39
  const serviceReadonlyError = error?.errorType === OdspErrorTypes.serviceReadOnly;
37
40
  // logging the first failed retry instead of every attempt. We want to avoid filling telemetry
38
41
  // when we have tight loop of retrying in offline mode, but we also want to know what caused
@@ -64,6 +67,7 @@ export async function runWithRetry(api, callName, logger, checkDisposed) {
64
67
  duration: performance.now() - start, // record total wait time.
65
68
  }, error);
66
69
  // Fail hard.
70
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
67
71
  error.canRetry = false;
68
72
  throw error;
69
73
  }
@@ -74,4 +78,4 @@ export async function runWithRetry(api, callName, logger, checkDisposed) {
74
78
  }
75
79
  }
76
80
  }
77
- //# sourceMappingURL=retryUtils.mjs.map
81
+ //# sourceMappingURL=retryUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retryUtils.js","sourceRoot":"","sources":["../src/retryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,sBAAsB,E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BACR,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,0BAA0B;iBAC/D,EACD,KAAK,CACL,CAAC;aACF;YAED,wGAAwG;YACxG,oGAAoG;YACpG,yBAAyB;YACzB,IAAI,CAAC,CAAC,CAAC,cAAc,IAAI,oBAAoB,CAAC,IAAI,QAAQ,CAAC,EAAE;gBAC5D,MAAM,KAAK,CAAC;aACZ;YAED,+EAA+E;YAC/E,oFAAoF;YACpF,uEAAuE;YACvE,IAAI,QAAQ,KAAK,CAAC,EAAE;gBACnB,MAAM,CAAC,cAAc,CACpB;oBACC,SAAS,EAAE,cAAc;wBACxB,CAAC,CAAC,8BAA8B;wBAChC,CAAC,CAAC,oCAAoC;oBACvC,QAAQ;oBACR,QAAQ;oBACR,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,0BAA0B;iBAC/D,EACD,KAAK,CACL,CAAC;gBACF,aAAa;gBACb,sEAAsE;gBACtE,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACvB,MAAM,KAAK,CAAC;aACZ;YAED,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC;YACzD,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;YACpC,UAAU,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YACrD,SAAS,GAAG,KAAK,CAAC;SAClB;KACD;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { delay } from \"@fluidframework/core-utils\";\nimport { canRetryOnError, getRetryDelayFromError } from \"@fluidframework/driver-utils\";\nimport { OdspErrorTypes } from \"@fluidframework/odsp-driver-definitions\";\nimport { Odsp409Error } from \"./epochTracker.js\";\n\n/**\n * This method retries only for retriable coherency and service read only errors.\n */\nexport async function runWithRetry<T>(\n\tapi: () => Promise<T>,\n\tcallName: string,\n\tlogger: ITelemetryLoggerExt,\n\tcheckDisposed?: () => void,\n): Promise<T> {\n\tlet retryAfter = 1000;\n\tconst start = performance.now();\n\tlet lastError: unknown;\n\tfor (let attempts = 1; ; attempts++) {\n\t\tif (checkDisposed !== undefined) {\n\t\t\tcheckDisposed();\n\t\t}\n\t\ttry {\n\t\t\tconst result = await api();\n\t\t\tif (attempts > 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"MultipleRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performance.now() - start,\n\t\t\t\t\t},\n\t\t\t\t\tlastError,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn result;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t} catch (error: any) {\n\t\t\tconst canRetry = canRetryOnError(error);\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tconst coherencyError = error?.[Odsp409Error] === true;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\tconst serviceReadonlyError = error?.errorType === OdspErrorTypes.serviceReadOnly;\n\n\t\t\t// logging the first failed retry instead of every attempt. We want to avoid filling telemetry\n\t\t\t// when we have tight loop of retrying in offline mode, but we also want to know what caused\n\t\t\t// the failure in the first place\n\t\t\tif (attempts === 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${callName}_firstFailed`,\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performance.now() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Retry for retriable 409 coherency errors or serviceReadOnly errors. These errors are always retriable\n\t\t\t// unless someone specifically set canRetry = false on the error like in fetchSnapshot() flow. So in\n\t\t\t// that case don't retry.\n\t\t\tif (!((coherencyError || serviceReadonlyError) && canRetry)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// SPO itself does number of retries internally before returning 409 to client.\n\t\t\t// That multiplied to 5 suggests need to reconsider current design, as client spends\n\t\t\t// too much time / bandwidth doing the same thing without any progress.\n\t\t\tif (attempts === 5) {\n\t\t\t\tlogger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: coherencyError\n\t\t\t\t\t\t\t? \"CoherencyErrorTooManyRetries\"\n\t\t\t\t\t\t\t: \"ServiceReadonlyErrorTooManyRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performance.now() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t\t// Fail hard.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\terror.canRetry = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tretryAfter = getRetryDelayFromError(error) ?? retryAfter;\n\t\t\tawait delay(Math.floor(retryAfter));\n\t\t\tretryAfter += (retryAfter / 4) * (1 + Math.random());\n\t\t\tlastError = error;\n\t\t}\n\t}\n}\n"]}
@@ -4,4 +4,4 @@
4
4
  */
5
5
  import { io } from "socket.io-client";
6
6
  export declare const SocketIOClientStatic: typeof io;
7
- //# sourceMappingURL=socketModule.d.mts.map
7
+ //# sourceMappingURL=socketModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socketModule.d.ts","sourceRoot":"","sources":["../src/socketModule.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAItC,eAAO,MAAM,oBAAoB,WAAK,CAAC"}
@@ -3,5 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { io } from "socket.io-client";
6
+ // Import is required for side-effects.
7
+ // eslint-disable-next-line unicorn/prefer-export-from
6
8
  export const SocketIOClientStatic = io;
7
- //# sourceMappingURL=socketModule.mjs.map
9
+ //# sourceMappingURL=socketModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socketModule.js","sourceRoot":"","sources":["../src/socketModule.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,uCAAuC;AACvC,sDAAsD;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { io } from \"socket.io-client\";\n\n// Import is required for side-effects.\n// eslint-disable-next-line unicorn/prefer-export-from\nexport const SocketIOClientStatic = io;\n"]}
@@ -0,0 +1,25 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { strict as assert } from "node:assert";
6
+ import { SharingLinkRole, SharingLinkScope } from "@fluidframework/odsp-driver-definitions";
7
+ import { buildOdspShareLinkReqParams } from "../odspUtils.js";
8
+ describe("buildOdspShareLinkReqParams", () => {
9
+ it("Should return appropriate query parameters when only scope is provided", async () => {
10
+ const result = buildOdspShareLinkReqParams({ scope: SharingLinkScope.organization });
11
+ assert.strictEqual(result, `createLinkScope=${SharingLinkScope.organization}`);
12
+ });
13
+ it("Should return appropriate query parameters when both scope and link role are provided", async () => {
14
+ const result = buildOdspShareLinkReqParams({
15
+ scope: SharingLinkScope.organization,
16
+ role: SharingLinkRole.view,
17
+ });
18
+ assert.strictEqual(result, `createLinkScope=${SharingLinkScope.organization}&createLinkRole=${SharingLinkRole.view}`);
19
+ });
20
+ it("Should return undefined when the input is undefined", async () => {
21
+ const result = buildOdspShareLinkReqParams(undefined);
22
+ assert.strictEqual(result, undefined);
23
+ });
24
+ });
25
+ //# sourceMappingURL=buildOdspShareLinkReqParams.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildOdspShareLinkReqParams.spec.js","sourceRoot":"","sources":["../../src/test/buildOdspShareLinkReqParams.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,wEAAwE,EAAE,KAAK,IAAI,EAAE;QACvF,MAAM,MAAM,GAAG,2BAA2B,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAC;QACrF,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,mBAAmB,gBAAgB,CAAC,YAAY,EAAE,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uFAAuF,EAAE,KAAK,IAAI,EAAE;QACtG,MAAM,MAAM,GAAG,2BAA2B,CAAC;YAC1C,KAAK,EAAE,gBAAgB,CAAC,YAAY;YACpC,IAAI,EAAE,eAAe,CAAC,IAAI;SAC1B,CAAC,CAAC;QACH,MAAM,CAAC,WAAW,CACjB,MAAM,EACN,mBAAmB,gBAAgB,CAAC,YAAY,mBAAmB,eAAe,CAAC,IAAI,EAAE,CACzF,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;QACpE,MAAM,MAAM,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;QACtD,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"node:assert\";\nimport { SharingLinkRole, SharingLinkScope } from \"@fluidframework/odsp-driver-definitions\";\nimport { buildOdspShareLinkReqParams } from \"../odspUtils.js\";\n\ndescribe(\"buildOdspShareLinkReqParams\", () => {\n\tit(\"Should return appropriate query parameters when only scope is provided\", async () => {\n\t\tconst result = buildOdspShareLinkReqParams({ scope: SharingLinkScope.organization });\n\t\tassert.strictEqual(result, `createLinkScope=${SharingLinkScope.organization}`);\n\t});\n\n\tit(\"Should return appropriate query parameters when both scope and link role are provided\", async () => {\n\t\tconst result = buildOdspShareLinkReqParams({\n\t\t\tscope: SharingLinkScope.organization,\n\t\t\trole: SharingLinkRole.view,\n\t\t});\n\t\tassert.strictEqual(\n\t\t\tresult,\n\t\t\t`createLinkScope=${SharingLinkScope.organization}&createLinkRole=${SharingLinkRole.view}`,\n\t\t);\n\t});\n\n\tit(\"Should return undefined when the input is undefined\", async () => {\n\t\tconst result = buildOdspShareLinkReqParams(undefined);\n\t\tassert.strictEqual(result, undefined);\n\t});\n});\n"]}