@fluidframework/odsp-driver 2.0.0-dev-rc.1.0.0.228517 → 2.0.0-dev-rc.2.0.0.245554

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 (623) hide show
  1. package/.eslintrc.cjs +33 -0
  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 +16 -17
  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 +2 -2
  18. package/dist/compactSnapshotParser.d.ts.map +1 -1
  19. package/dist/compactSnapshotParser.js +94 -75
  20. package/dist/compactSnapshotParser.js.map +1 -1
  21. package/dist/compactSnapshotWriter.d.ts +2 -2
  22. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  23. package/dist/compactSnapshotWriter.js +26 -20
  24. package/dist/compactSnapshotWriter.js.map +1 -1
  25. package/dist/contracts.d.ts +24 -4
  26. package/dist/contracts.d.ts.map +1 -1
  27. package/dist/contracts.js +5 -1
  28. package/dist/contracts.js.map +1 -1
  29. package/dist/createFile.d.ts +4 -4
  30. package/dist/createFile.d.ts.map +1 -1
  31. package/dist/createFile.js +36 -52
  32. package/dist/createFile.js.map +1 -1
  33. package/dist/createNewContainerOnExistingFile.d.ts +2 -2
  34. package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
  35. package/dist/createNewContainerOnExistingFile.js +14 -14
  36. package/dist/createNewContainerOnExistingFile.js.map +1 -1
  37. package/dist/createNewModule.d.ts +2 -2
  38. package/dist/createNewModule.d.ts.map +1 -1
  39. package/dist/createNewModule.js +4 -4
  40. package/dist/createNewModule.js.map +1 -1
  41. package/dist/createNewUtils.d.ts +4 -4
  42. package/dist/createNewUtils.d.ts.map +1 -1
  43. package/dist/createNewUtils.js +16 -11
  44. package/dist/createNewUtils.js.map +1 -1
  45. package/dist/createOdspCreateContainerRequest.d.ts +2 -2
  46. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  47. package/dist/createOdspCreateContainerRequest.js +2 -2
  48. package/dist/createOdspCreateContainerRequest.js.map +1 -1
  49. package/dist/createOdspUrl.d.ts +1 -1
  50. package/dist/createOdspUrl.d.ts.map +1 -1
  51. package/dist/createOdspUrl.js.map +1 -1
  52. package/dist/epochTracker.d.ts +10 -9
  53. package/dist/epochTracker.d.ts.map +1 -1
  54. package/dist/epochTracker.js +67 -45
  55. package/dist/epochTracker.js.map +1 -1
  56. package/dist/fetchSnapshot.d.ts +14 -11
  57. package/dist/fetchSnapshot.d.ts.map +1 -1
  58. package/dist/fetchSnapshot.js +91 -71
  59. package/dist/fetchSnapshot.js.map +1 -1
  60. package/dist/getFileLink.d.ts.map +1 -1
  61. package/dist/getFileLink.js +25 -18
  62. package/dist/getFileLink.js.map +1 -1
  63. package/dist/getQueryString.d.ts.map +1 -1
  64. package/dist/getQueryString.js +2 -0
  65. package/dist/getQueryString.js.map +1 -1
  66. package/dist/index.d.ts +19 -19
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +44 -44
  69. package/dist/index.js.map +1 -1
  70. package/dist/localOdspDriver/localOdspDocumentService.d.ts +4 -3
  71. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  72. package/dist/localOdspDriver/localOdspDocumentService.js +8 -6
  73. package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
  74. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +8 -6
  75. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  76. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js +10 -9
  77. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  78. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -2
  79. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  80. package/dist/localOdspDriver/localOdspDocumentStorageManager.js +9 -6
  81. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  82. package/dist/odsp-driver-alpha.d.ts +31 -15
  83. package/dist/odsp-driver-beta.d.ts +4 -5
  84. package/dist/odsp-driver-public.d.ts +4 -5
  85. package/dist/odsp-driver-untrimmed.d.ts +34 -16
  86. package/dist/odspCache.d.ts +5 -5
  87. package/dist/odspCache.d.ts.map +1 -1
  88. package/dist/odspCache.js +1 -2
  89. package/dist/odspCache.js.map +1 -1
  90. package/dist/odspDelayLoadedDeltaStream.d.ts +12 -6
  91. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  92. package/dist/odspDelayLoadedDeltaStream.js +89 -25
  93. package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
  94. package/dist/odspDeltaStorageService.d.ts +7 -7
  95. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  96. package/dist/odspDeltaStorageService.js +5 -5
  97. package/dist/odspDeltaStorageService.js.map +1 -1
  98. package/dist/odspDocumentDeltaConnection.d.ts +1 -1
  99. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  100. package/dist/odspDocumentDeltaConnection.js +41 -23
  101. package/dist/odspDocumentDeltaConnection.js.map +1 -1
  102. package/dist/odspDocumentService.d.ts +9 -6
  103. package/dist/odspDocumentService.d.ts.map +1 -1
  104. package/dist/odspDocumentService.js +25 -19
  105. package/dist/odspDocumentService.js.map +1 -1
  106. package/dist/odspDocumentServiceFactory.d.ts +6 -1
  107. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  108. package/dist/odspDocumentServiceFactory.js +9 -4
  109. package/dist/odspDocumentServiceFactory.js.map +1 -1
  110. package/dist/odspDocumentServiceFactoryCore.d.ts +4 -4
  111. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  112. package/dist/odspDocumentServiceFactoryCore.js +27 -30
  113. package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
  114. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +1 -1
  115. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
  116. package/dist/odspDocumentServiceFactoryWithCodeSplit.js +2 -2
  117. package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -1
  118. package/dist/odspDocumentStorageManager.d.ts +17 -10
  119. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  120. package/dist/odspDocumentStorageManager.js +226 -169
  121. package/dist/odspDocumentStorageManager.js.map +1 -1
  122. package/dist/odspDocumentStorageServiceBase.d.ts +4 -6
  123. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  124. package/dist/odspDocumentStorageServiceBase.js +34 -31
  125. package/dist/odspDocumentStorageServiceBase.js.map +1 -1
  126. package/dist/odspDriverUrlResolver.d.ts +1 -1
  127. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  128. package/dist/odspDriverUrlResolver.js +26 -32
  129. package/dist/odspDriverUrlResolver.js.map +1 -1
  130. package/dist/odspDriverUrlResolverForShareLink.d.ts +13 -6
  131. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  132. package/dist/odspDriverUrlResolverForShareLink.js +47 -37
  133. package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
  134. package/dist/odspError.d.ts +1 -1
  135. package/dist/odspError.d.ts.map +1 -1
  136. package/dist/odspError.js +6 -6
  137. package/dist/odspError.js.map +1 -1
  138. package/dist/odspFluidFileLink.d.ts +1 -1
  139. package/dist/odspFluidFileLink.d.ts.map +1 -1
  140. package/dist/odspFluidFileLink.js +2 -2
  141. package/dist/odspFluidFileLink.js.map +1 -1
  142. package/dist/odspLocationRedirection.js +2 -2
  143. package/dist/odspLocationRedirection.js.map +1 -1
  144. package/dist/odspPublicUtils.d.ts +4 -0
  145. package/dist/odspPublicUtils.d.ts.map +1 -1
  146. package/dist/odspPublicUtils.js +3 -0
  147. package/dist/odspPublicUtils.js.map +1 -1
  148. package/dist/odspSnapshotParser.d.ts +3 -3
  149. package/dist/odspSnapshotParser.d.ts.map +1 -1
  150. package/dist/odspSnapshotParser.js +5 -3
  151. package/dist/odspSnapshotParser.js.map +1 -1
  152. package/dist/odspSummaryUploadManager.d.ts +1 -1
  153. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  154. package/dist/odspSummaryUploadManager.js +9 -6
  155. package/dist/odspSummaryUploadManager.js.map +1 -1
  156. package/dist/odspUrlHelper.d.ts.map +1 -1
  157. package/dist/odspUrlHelper.js +1 -2
  158. package/dist/odspUrlHelper.js.map +1 -1
  159. package/dist/odspUtils.d.ts +29 -13
  160. package/dist/odspUtils.d.ts.map +1 -1
  161. package/dist/odspUtils.js +75 -41
  162. package/dist/odspUtils.js.map +1 -1
  163. package/dist/opsCaching.d.ts +1 -1
  164. package/dist/opsCaching.d.ts.map +1 -1
  165. package/dist/opsCaching.js +2 -1
  166. package/dist/opsCaching.js.map +1 -1
  167. package/dist/package.json +3 -0
  168. package/dist/packageVersion.d.ts +1 -1
  169. package/dist/packageVersion.js +1 -1
  170. package/dist/packageVersion.js.map +1 -1
  171. package/dist/prefetchLatestSnapshot.d.ts +2 -2
  172. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  173. package/dist/prefetchLatestSnapshot.js +17 -12
  174. package/dist/prefetchLatestSnapshot.js.map +1 -1
  175. package/dist/retryErrorsStorageAdapter.d.ts +2 -2
  176. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  177. package/dist/retryErrorsStorageAdapter.js +10 -5
  178. package/dist/retryErrorsStorageAdapter.js.map +1 -1
  179. package/dist/retryUtils.d.ts.map +1 -1
  180. package/dist/retryUtils.js +7 -3
  181. package/dist/retryUtils.js.map +1 -1
  182. package/dist/socketModule.d.ts.map +1 -1
  183. package/dist/socketModule.js +2 -0
  184. package/dist/socketModule.js.map +1 -1
  185. package/dist/tsdoc-metadata.json +1 -1
  186. package/dist/vroom.d.ts +2 -2
  187. package/dist/vroom.d.ts.map +1 -1
  188. package/dist/vroom.js +5 -5
  189. package/dist/vroom.js.map +1 -1
  190. package/dist/zipItDataRepresentationUtils.d.ts +1 -1
  191. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  192. package/dist/zipItDataRepresentationUtils.js +17 -13
  193. package/dist/zipItDataRepresentationUtils.js.map +1 -1
  194. package/lib/{ReadBufferUtils.d.mts → ReadBufferUtils.d.ts} +1 -1
  195. package/lib/ReadBufferUtils.d.ts.map +1 -0
  196. package/lib/{ReadBufferUtils.mjs → ReadBufferUtils.js} +1 -1
  197. package/lib/ReadBufferUtils.js.map +1 -0
  198. package/lib/{WriteBufferUtils.d.mts → WriteBufferUtils.d.ts} +2 -2
  199. package/lib/WriteBufferUtils.d.ts.map +1 -0
  200. package/lib/{WriteBufferUtils.mjs → WriteBufferUtils.js} +2 -2
  201. package/lib/WriteBufferUtils.js.map +1 -0
  202. package/lib/{checkUrl.d.mts → checkUrl.d.ts} +1 -1
  203. package/lib/checkUrl.d.ts.map +1 -0
  204. package/lib/{checkUrl.mjs → checkUrl.js} +5 -3
  205. package/lib/checkUrl.js.map +1 -0
  206. package/lib/{compactSnapshotParser.d.mts → compactSnapshotParser.d.ts} +3 -3
  207. package/lib/compactSnapshotParser.d.ts.map +1 -0
  208. package/lib/{compactSnapshotParser.mjs → compactSnapshotParser.js} +69 -50
  209. package/lib/compactSnapshotParser.js.map +1 -0
  210. package/lib/{compactSnapshotWriter.d.mts → compactSnapshotWriter.d.ts} +3 -3
  211. package/lib/compactSnapshotWriter.d.ts.map +1 -0
  212. package/lib/{compactSnapshotWriter.mjs → compactSnapshotWriter.js} +14 -8
  213. package/lib/compactSnapshotWriter.js.map +1 -0
  214. package/lib/{constants.d.mts → constants.d.ts} +1 -1
  215. package/lib/constants.d.ts.map +1 -0
  216. package/lib/{constants.mjs → constants.js} +1 -1
  217. package/lib/constants.js.map +1 -0
  218. package/lib/{contracts.d.mts → contracts.d.ts} +25 -5
  219. package/lib/contracts.d.ts.map +1 -0
  220. package/lib/contracts.js +10 -0
  221. package/lib/contracts.js.map +1 -0
  222. package/lib/{contractsPublic.d.mts → contractsPublic.d.ts} +1 -1
  223. package/lib/contractsPublic.d.ts.map +1 -0
  224. package/lib/{contractsPublic.mjs → contractsPublic.js} +1 -1
  225. package/lib/contractsPublic.js.map +1 -0
  226. package/lib/{createFile.d.mts → createFile.d.ts} +5 -5
  227. package/lib/createFile.d.ts.map +1 -0
  228. package/lib/{createFile.mjs → createFile.js} +25 -41
  229. package/lib/createFile.js.map +1 -0
  230. package/lib/{createNewContainerOnExistingFile.d.mts → createNewContainerOnExistingFile.d.ts} +3 -3
  231. package/lib/createNewContainerOnExistingFile.d.ts.map +1 -0
  232. package/lib/{createNewContainerOnExistingFile.mjs → createNewContainerOnExistingFile.js} +7 -7
  233. package/lib/createNewContainerOnExistingFile.js.map +1 -0
  234. package/lib/{createNewModule.mjs → createNewModule.d.ts} +3 -3
  235. package/lib/createNewModule.d.ts.map +1 -0
  236. package/lib/{createNewModule.d.mts → createNewModule.js} +3 -3
  237. package/lib/createNewModule.js.map +1 -0
  238. package/lib/{createNewUtils.d.mts → createNewUtils.d.ts} +5 -5
  239. package/lib/createNewUtils.d.ts.map +1 -0
  240. package/lib/{createNewUtils.mjs → createNewUtils.js} +13 -8
  241. package/lib/createNewUtils.js.map +1 -0
  242. package/lib/{createOdspCreateContainerRequest.d.mts → createOdspCreateContainerRequest.d.ts} +7 -3
  243. package/lib/createOdspCreateContainerRequest.d.ts.map +1 -0
  244. package/lib/{createOdspCreateContainerRequest.mjs → createOdspCreateContainerRequest.js} +2 -2
  245. package/lib/createOdspCreateContainerRequest.js.map +1 -0
  246. package/lib/{createOdspUrl.d.mts → createOdspUrl.d.ts} +2 -2
  247. package/lib/createOdspUrl.d.ts.map +1 -0
  248. package/lib/{createOdspUrl.mjs → createOdspUrl.js} +1 -1
  249. package/lib/createOdspUrl.js.map +1 -0
  250. package/lib/{epochTracker.d.mts → epochTracker.d.ts} +11 -10
  251. package/lib/epochTracker.d.ts.map +1 -0
  252. package/lib/{epochTracker.mjs → epochTracker.js} +58 -36
  253. package/lib/epochTracker.js.map +1 -0
  254. package/lib/{fetch.d.mts → fetch.d.ts} +1 -1
  255. package/lib/fetch.d.ts.map +1 -0
  256. package/lib/{fetch.mjs → fetch.js} +1 -1
  257. package/lib/fetch.js.map +1 -0
  258. package/lib/{fetchSnapshot.d.mts → fetchSnapshot.d.ts} +15 -12
  259. package/lib/fetchSnapshot.d.ts.map +1 -0
  260. package/lib/{fetchSnapshot.mjs → fetchSnapshot.js} +74 -54
  261. package/lib/fetchSnapshot.js.map +1 -0
  262. package/lib/{getFileLink.d.mts → getFileLink.d.ts} +1 -1
  263. package/lib/getFileLink.d.ts.map +1 -0
  264. package/lib/{getFileLink.mjs → getFileLink.js} +17 -10
  265. package/lib/getFileLink.js.map +1 -0
  266. package/lib/{getQueryString.d.mts → getQueryString.d.ts} +5 -1
  267. package/lib/getQueryString.d.ts.map +1 -0
  268. package/lib/{getQueryString.mjs → getQueryString.js} +3 -1
  269. package/lib/getQueryString.js.map +1 -0
  270. package/lib/{getUrlAndHeadersWithAuth.d.mts → getUrlAndHeadersWithAuth.d.ts} +1 -1
  271. package/lib/getUrlAndHeadersWithAuth.d.ts.map +1 -0
  272. package/lib/{getUrlAndHeadersWithAuth.mjs → getUrlAndHeadersWithAuth.js} +1 -1
  273. package/lib/getUrlAndHeadersWithAuth.js.map +1 -0
  274. package/lib/{index.d.mts → index.d.ts} +20 -20
  275. package/lib/index.d.ts.map +1 -0
  276. package/lib/index.js +29 -0
  277. package/lib/index.js.map +1 -0
  278. package/lib/localOdspDriver/{localOdspDeltaStorageService.d.mts → localOdspDeltaStorageService.d.ts} +1 -1
  279. package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
  280. package/lib/localOdspDriver/{localOdspDeltaStorageService.mjs → localOdspDeltaStorageService.js} +1 -1
  281. package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -0
  282. package/lib/localOdspDriver/{localOdspDocumentService.d.mts → localOdspDocumentService.d.ts} +5 -4
  283. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -0
  284. package/lib/localOdspDriver/{localOdspDocumentService.mjs → localOdspDocumentService.js} +7 -5
  285. package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -0
  286. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.mts → localOdspDocumentServiceFactory.d.ts} +9 -7
  287. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -0
  288. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.mjs → localOdspDocumentServiceFactory.js} +9 -8
  289. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -0
  290. package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.mts → localOdspDocumentStorageManager.d.ts} +4 -3
  291. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -0
  292. package/lib/localOdspDriver/{localOdspDocumentStorageManager.mjs → localOdspDocumentStorageManager.js} +7 -4
  293. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
  294. package/lib/{odsp-driver-alpha.d.mts → odsp-driver-alpha.d.ts} +31 -15
  295. package/lib/{odsp-driver-beta.d.mts → odsp-driver-beta.d.ts} +4 -5
  296. package/lib/{odsp-driver-public.d.mts → odsp-driver-public.d.ts} +4 -5
  297. package/lib/{odsp-driver-untrimmed.d.mts → odsp-driver-untrimmed.d.ts} +34 -16
  298. package/lib/{odspCache.d.mts → odspCache.d.ts} +10 -6
  299. package/lib/odspCache.d.ts.map +1 -0
  300. package/lib/{odspCache.mjs → odspCache.js} +6 -3
  301. package/lib/odspCache.js.map +1 -0
  302. package/lib/{odspDelayLoadedDeltaStream.d.mts → odspDelayLoadedDeltaStream.d.ts} +13 -7
  303. package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -0
  304. package/lib/{odspDelayLoadedDeltaStream.mjs → odspDelayLoadedDeltaStream.js} +84 -20
  305. package/lib/odspDelayLoadedDeltaStream.js.map +1 -0
  306. package/lib/{odspDeltaStorageService.d.mts → odspDeltaStorageService.d.ts} +8 -8
  307. package/lib/odspDeltaStorageService.d.ts.map +1 -0
  308. package/lib/{odspDeltaStorageService.mjs → odspDeltaStorageService.js} +5 -5
  309. package/lib/odspDeltaStorageService.js.map +1 -0
  310. package/lib/{odspDocumentDeltaConnection.d.mts → odspDocumentDeltaConnection.d.ts} +2 -2
  311. package/lib/odspDocumentDeltaConnection.d.ts.map +1 -0
  312. package/lib/{odspDocumentDeltaConnection.mjs → odspDocumentDeltaConnection.js} +34 -16
  313. package/lib/odspDocumentDeltaConnection.js.map +1 -0
  314. package/lib/{odspDocumentService.d.mts → odspDocumentService.d.ts} +10 -7
  315. package/lib/odspDocumentService.d.ts.map +1 -0
  316. package/lib/{odspDocumentService.mjs → odspDocumentService.js} +22 -14
  317. package/lib/odspDocumentService.js.map +1 -0
  318. package/lib/{odspDocumentServiceFactory.d.mts → odspDocumentServiceFactory.d.ts} +7 -2
  319. package/lib/odspDocumentServiceFactory.d.ts.map +1 -0
  320. package/lib/{odspDocumentServiceFactory.mjs → odspDocumentServiceFactory.js} +9 -3
  321. package/lib/odspDocumentServiceFactory.js.map +1 -0
  322. package/lib/{odspDocumentServiceFactoryCore.d.mts → odspDocumentServiceFactoryCore.d.ts} +5 -5
  323. package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -0
  324. package/lib/{odspDocumentServiceFactoryCore.mjs → odspDocumentServiceFactoryCore.js} +25 -26
  325. package/lib/odspDocumentServiceFactoryCore.js.map +1 -0
  326. package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.mts → odspDocumentServiceFactoryWithCodeSplit.d.ts} +2 -2
  327. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -0
  328. package/lib/{odspDocumentServiceFactoryWithCodeSplit.mjs → odspDocumentServiceFactoryWithCodeSplit.js} +2 -2
  329. package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -0
  330. package/lib/{odspDocumentStorageManager.d.mts → odspDocumentStorageManager.d.ts} +18 -11
  331. package/lib/odspDocumentStorageManager.d.ts.map +1 -0
  332. package/lib/{odspDocumentStorageManager.mjs → odspDocumentStorageManager.js} +221 -162
  333. package/lib/odspDocumentStorageManager.js.map +1 -0
  334. package/lib/{odspDocumentStorageServiceBase.d.mts → odspDocumentStorageServiceBase.d.ts} +5 -7
  335. package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -0
  336. package/lib/{odspDocumentStorageServiceBase.mjs → odspDocumentStorageServiceBase.js} +34 -31
  337. package/lib/odspDocumentStorageServiceBase.js.map +1 -0
  338. package/lib/{odspDriverUrlResolver.d.mts → odspDriverUrlResolver.d.ts} +2 -2
  339. package/lib/odspDriverUrlResolver.d.ts.map +1 -0
  340. package/lib/{odspDriverUrlResolver.mjs → odspDriverUrlResolver.js} +27 -29
  341. package/lib/odspDriverUrlResolver.js.map +1 -0
  342. package/lib/{odspDriverUrlResolverForShareLink.d.mts → odspDriverUrlResolverForShareLink.d.ts} +14 -7
  343. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -0
  344. package/lib/{odspDriverUrlResolverForShareLink.mjs → odspDriverUrlResolverForShareLink.js} +41 -27
  345. package/lib/odspDriverUrlResolverForShareLink.js.map +1 -0
  346. package/lib/{odspError.d.mts → odspError.d.ts} +2 -2
  347. package/lib/odspError.d.ts.map +1 -0
  348. package/lib/{odspError.mjs → odspError.js} +6 -6
  349. package/lib/odspError.js.map +1 -0
  350. package/lib/{odspFluidFileLink.d.mts → odspFluidFileLink.d.ts} +2 -2
  351. package/lib/odspFluidFileLink.d.ts.map +1 -0
  352. package/lib/{odspFluidFileLink.mjs → odspFluidFileLink.js} +2 -2
  353. package/lib/odspFluidFileLink.js.map +1 -0
  354. package/lib/{odspLocationRedirection.d.mts → odspLocationRedirection.d.ts} +1 -1
  355. package/lib/odspLocationRedirection.d.ts.map +1 -0
  356. package/lib/{odspLocationRedirection.mjs → odspLocationRedirection.js} +2 -2
  357. package/lib/odspLocationRedirection.js.map +1 -0
  358. package/lib/{odspPublicUtils.d.mts → odspPublicUtils.d.ts} +5 -1
  359. package/lib/odspPublicUtils.d.ts.map +1 -0
  360. package/lib/{odspPublicUtils.mjs → odspPublicUtils.js} +4 -1
  361. package/lib/odspPublicUtils.js.map +1 -0
  362. package/lib/{odspSnapshotParser.d.mts → odspSnapshotParser.d.ts} +4 -4
  363. package/lib/odspSnapshotParser.d.ts.map +1 -0
  364. package/lib/{odspSnapshotParser.mjs → odspSnapshotParser.js} +6 -4
  365. package/lib/odspSnapshotParser.js.map +1 -0
  366. package/lib/{odspSummaryUploadManager.d.mts → odspSummaryUploadManager.d.ts} +2 -2
  367. package/lib/odspSummaryUploadManager.d.ts.map +1 -0
  368. package/lib/{odspSummaryUploadManager.mjs → odspSummaryUploadManager.js} +8 -5
  369. package/lib/odspSummaryUploadManager.js.map +1 -0
  370. package/lib/{odspUrlHelper.d.mts → odspUrlHelper.d.ts} +1 -1
  371. package/lib/odspUrlHelper.d.ts.map +1 -0
  372. package/lib/{odspUrlHelper.mjs → odspUrlHelper.js} +2 -3
  373. package/lib/odspUrlHelper.js.map +1 -0
  374. package/lib/{odspUtils.d.mts → odspUtils.d.ts} +30 -14
  375. package/lib/odspUtils.d.ts.map +1 -0
  376. package/lib/{odspUtils.mjs → odspUtils.js} +61 -30
  377. package/lib/odspUtils.js.map +1 -0
  378. package/lib/{opsCaching.d.mts → opsCaching.d.ts} +2 -2
  379. package/lib/opsCaching.d.ts.map +1 -0
  380. package/lib/{opsCaching.mjs → opsCaching.js} +3 -2
  381. package/lib/opsCaching.js.map +1 -0
  382. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  383. package/lib/packageVersion.d.ts.map +1 -0
  384. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  385. package/lib/packageVersion.js.map +1 -0
  386. package/lib/{prefetchLatestSnapshot.d.mts → prefetchLatestSnapshot.d.ts} +3 -3
  387. package/lib/prefetchLatestSnapshot.d.ts.map +1 -0
  388. package/lib/{prefetchLatestSnapshot.mjs → prefetchLatestSnapshot.js} +16 -11
  389. package/lib/prefetchLatestSnapshot.js.map +1 -0
  390. package/lib/{retryErrorsStorageAdapter.d.mts → retryErrorsStorageAdapter.d.ts} +3 -3
  391. package/lib/retryErrorsStorageAdapter.d.ts.map +1 -0
  392. package/lib/{retryErrorsStorageAdapter.mjs → retryErrorsStorageAdapter.js} +11 -6
  393. package/lib/retryErrorsStorageAdapter.js.map +1 -0
  394. package/lib/{retryUtils.d.mts → retryUtils.d.ts} +1 -1
  395. package/lib/retryUtils.d.ts.map +1 -0
  396. package/lib/{retryUtils.mjs → retryUtils.js} +8 -4
  397. package/lib/retryUtils.js.map +1 -0
  398. package/lib/{socketModule.d.mts → socketModule.d.ts} +1 -1
  399. package/lib/socketModule.d.ts.map +1 -0
  400. package/lib/{socketModule.mjs → socketModule.js} +3 -1
  401. package/lib/socketModule.js.map +1 -0
  402. package/lib/test/buildOdspShareLinkReqParams.spec.js +25 -0
  403. package/lib/test/buildOdspShareLinkReqParams.spec.js.map +1 -0
  404. package/lib/test/createNewUtilsTests.spec.js +221 -0
  405. package/lib/test/createNewUtilsTests.spec.js.map +1 -0
  406. package/lib/test/deltaStorageService.spec.js +176 -0
  407. package/lib/test/deltaStorageService.spec.js.map +1 -0
  408. package/lib/test/epochTests.spec.js +340 -0
  409. package/lib/test/epochTests.spec.js.map +1 -0
  410. package/lib/test/epochTestsWithRedemption.spec.js +119 -0
  411. package/lib/test/epochTestsWithRedemption.spec.js.map +1 -0
  412. package/lib/test/fetchSnapshot.spec.js +412 -0
  413. package/lib/test/fetchSnapshot.spec.js.map +1 -0
  414. package/lib/test/getFileLink.spec.js +62 -0
  415. package/lib/test/getFileLink.spec.js.map +1 -0
  416. package/lib/test/getUrlAndHeadersWithAuth.spec.js +66 -0
  417. package/lib/test/getUrlAndHeadersWithAuth.spec.js.map +1 -0
  418. package/lib/test/getVersions.spec.js +284 -0
  419. package/lib/test/getVersions.spec.js.map +1 -0
  420. package/lib/test/joinSessionCacheTests.spec.js +53 -0
  421. package/lib/test/joinSessionCacheTests.spec.js.map +1 -0
  422. package/lib/test/joinSessionPeriodicCall.spec.js +158 -0
  423. package/lib/test/joinSessionPeriodicCall.spec.js.map +1 -0
  424. package/lib/test/jsonSnapshotFormatTests.spec.js +107 -0
  425. package/lib/test/jsonSnapshotFormatTests.spec.js.map +1 -0
  426. package/lib/test/localOdspDriver.spec.js +177 -0
  427. package/lib/test/localOdspDriver.spec.js.map +1 -0
  428. package/lib/test/mockFetch.js +61 -0
  429. package/lib/test/mockFetch.js.map +1 -0
  430. package/lib/test/odspCreateContainer.spec.js +116 -0
  431. package/lib/test/odspCreateContainer.spec.js.map +1 -0
  432. package/lib/test/odspDriverResolverTest.spec.js +289 -0
  433. package/lib/test/odspDriverResolverTest.spec.js.map +1 -0
  434. package/lib/test/odspDriverUrlResolverForShareLink.spec.js +287 -0
  435. package/lib/test/odspDriverUrlResolverForShareLink.spec.js.map +1 -0
  436. package/lib/test/odspError.spec.js +299 -0
  437. package/lib/test/odspError.spec.js.map +1 -0
  438. package/lib/test/opsCaching.spec.js +357 -0
  439. package/lib/test/opsCaching.spec.js.map +1 -0
  440. package/lib/test/prefetchSnapshotTests.spec.js +420 -0
  441. package/lib/test/prefetchSnapshotTests.spec.js.map +1 -0
  442. package/lib/test/snapshotFormatTests.spec.js +218 -0
  443. package/lib/test/snapshotFormatTests.spec.js.map +1 -0
  444. package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js +152 -0
  445. package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js.map +1 -0
  446. package/lib/test/socketTests/socketMock.js +109 -0
  447. package/lib/test/socketTests/socketMock.js.map +1 -0
  448. package/lib/test/socketTests/socketTests.spec.js +256 -0
  449. package/lib/test/socketTests/socketTests.spec.js.map +1 -0
  450. package/lib/test/tokenFetch.spec.js +39 -0
  451. package/lib/test/tokenFetch.spec.js.map +1 -0
  452. package/lib/test/types/validateOdspDriverPrevious.generated.js +96 -0
  453. package/lib/test/types/validateOdspDriverPrevious.generated.js.map +1 -0
  454. package/lib/test/zipItDataRepresentationTests.spec.js +207 -0
  455. package/lib/test/zipItDataRepresentationTests.spec.js.map +1 -0
  456. package/lib/{vroom.d.mts → vroom.d.ts} +3 -3
  457. package/lib/vroom.d.ts.map +1 -0
  458. package/lib/{vroom.mjs → vroom.js} +4 -4
  459. package/lib/vroom.js.map +1 -0
  460. package/lib/{zipItDataRepresentationUtils.d.mts → zipItDataRepresentationUtils.d.ts} +2 -2
  461. package/lib/zipItDataRepresentationUtils.d.ts.map +1 -0
  462. package/lib/{zipItDataRepresentationUtils.mjs → zipItDataRepresentationUtils.js} +19 -11
  463. package/lib/zipItDataRepresentationUtils.js.map +1 -0
  464. package/package.json +100 -32
  465. package/src/ReadBufferUtils.ts +7 -7
  466. package/src/WriteBufferUtils.ts +13 -9
  467. package/src/checkUrl.ts +4 -2
  468. package/src/compactSnapshotParser.ts +97 -61
  469. package/src/compactSnapshotWriter.ts +22 -15
  470. package/src/contracts.ts +33 -4
  471. package/src/createFile.ts +26 -51
  472. package/src/createNewContainerOnExistingFile.ts +10 -10
  473. package/src/createNewModule.ts +2 -2
  474. package/src/createNewUtils.ts +26 -15
  475. package/src/createOdspCreateContainerRequest.ts +3 -3
  476. package/src/createOdspUrl.ts +1 -1
  477. package/src/epochTracker.ts +93 -58
  478. package/src/fetchSnapshot.ts +122 -66
  479. package/src/getFileLink.ts +24 -16
  480. package/src/getQueryString.ts +2 -0
  481. package/src/index.ts +27 -19
  482. package/src/localOdspDriver/localOdspDocumentService.ts +12 -5
  483. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +12 -11
  484. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +15 -8
  485. package/src/odspCache.ts +14 -11
  486. package/src/odspDelayLoadedDeltaStream.ts +113 -31
  487. package/src/odspDeltaStorageService.ts +17 -16
  488. package/src/odspDocumentDeltaConnection.ts +52 -34
  489. package/src/odspDocumentService.ts +33 -22
  490. package/src/odspDocumentServiceFactory.ts +7 -2
  491. package/src/odspDocumentServiceFactoryCore.ts +28 -29
  492. package/src/odspDocumentServiceFactoryWithCodeSplit.ts +1 -1
  493. package/src/odspDocumentStorageManager.ts +303 -210
  494. package/src/odspDocumentStorageServiceBase.ts +52 -47
  495. package/src/odspDriverUrlResolver.ts +41 -41
  496. package/src/odspDriverUrlResolverForShareLink.ts +50 -31
  497. package/src/odspError.ts +6 -7
  498. package/src/odspFluidFileLink.ts +3 -3
  499. package/src/odspLocationRedirection.ts +1 -1
  500. package/src/odspPublicUtils.ts +4 -0
  501. package/src/odspSnapshotParser.ts +9 -9
  502. package/src/odspSummaryUploadManager.ts +21 -9
  503. package/src/odspUrlHelper.ts +2 -3
  504. package/src/odspUtils.ts +102 -53
  505. package/src/opsCaching.ts +13 -12
  506. package/src/packageVersion.ts +1 -1
  507. package/src/prefetchLatestSnapshot.ts +24 -15
  508. package/src/retryErrorsStorageAdapter.ts +16 -9
  509. package/src/retryUtils.ts +8 -4
  510. package/src/socketModule.ts +2 -0
  511. package/src/vroom.ts +6 -6
  512. package/src/zipItDataRepresentationUtils.ts +65 -37
  513. package/tsconfig.cjs.json +7 -0
  514. package/tsconfig.json +2 -5
  515. package/.eslintrc.js +0 -18
  516. package/lib/ReadBufferUtils.d.mts.map +0 -1
  517. package/lib/ReadBufferUtils.mjs.map +0 -1
  518. package/lib/WriteBufferUtils.d.mts.map +0 -1
  519. package/lib/WriteBufferUtils.mjs.map +0 -1
  520. package/lib/checkUrl.d.mts.map +0 -1
  521. package/lib/checkUrl.mjs.map +0 -1
  522. package/lib/compactSnapshotParser.d.mts.map +0 -1
  523. package/lib/compactSnapshotParser.mjs.map +0 -1
  524. package/lib/compactSnapshotWriter.d.mts.map +0 -1
  525. package/lib/compactSnapshotWriter.mjs.map +0 -1
  526. package/lib/constants.d.mts.map +0 -1
  527. package/lib/constants.mjs.map +0 -1
  528. package/lib/contracts.d.mts.map +0 -1
  529. package/lib/contracts.mjs +0 -6
  530. package/lib/contracts.mjs.map +0 -1
  531. package/lib/contractsPublic.d.mts.map +0 -1
  532. package/lib/contractsPublic.mjs.map +0 -1
  533. package/lib/createFile.d.mts.map +0 -1
  534. package/lib/createFile.mjs.map +0 -1
  535. package/lib/createNewContainerOnExistingFile.d.mts.map +0 -1
  536. package/lib/createNewContainerOnExistingFile.mjs.map +0 -1
  537. package/lib/createNewModule.d.mts.map +0 -1
  538. package/lib/createNewModule.mjs.map +0 -1
  539. package/lib/createNewUtils.d.mts.map +0 -1
  540. package/lib/createNewUtils.mjs.map +0 -1
  541. package/lib/createOdspCreateContainerRequest.d.mts.map +0 -1
  542. package/lib/createOdspCreateContainerRequest.mjs.map +0 -1
  543. package/lib/createOdspUrl.d.mts.map +0 -1
  544. package/lib/createOdspUrl.mjs.map +0 -1
  545. package/lib/epochTracker.d.mts.map +0 -1
  546. package/lib/epochTracker.mjs.map +0 -1
  547. package/lib/fetch.d.mts.map +0 -1
  548. package/lib/fetch.mjs.map +0 -1
  549. package/lib/fetchSnapshot.d.mts.map +0 -1
  550. package/lib/fetchSnapshot.mjs.map +0 -1
  551. package/lib/getFileLink.d.mts.map +0 -1
  552. package/lib/getFileLink.mjs.map +0 -1
  553. package/lib/getQueryString.d.mts.map +0 -1
  554. package/lib/getQueryString.mjs.map +0 -1
  555. package/lib/getUrlAndHeadersWithAuth.d.mts.map +0 -1
  556. package/lib/getUrlAndHeadersWithAuth.mjs.map +0 -1
  557. package/lib/index.d.mts.map +0 -1
  558. package/lib/index.mjs +0 -22
  559. package/lib/index.mjs.map +0 -1
  560. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +0 -1
  561. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +0 -1
  562. package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +0 -1
  563. package/lib/localOdspDriver/localOdspDocumentService.mjs.map +0 -1
  564. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +0 -1
  565. package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +0 -1
  566. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +0 -1
  567. package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +0 -1
  568. package/lib/odspCache.d.mts.map +0 -1
  569. package/lib/odspCache.mjs.map +0 -1
  570. package/lib/odspDelayLoadedDeltaStream.d.mts.map +0 -1
  571. package/lib/odspDelayLoadedDeltaStream.mjs.map +0 -1
  572. package/lib/odspDeltaStorageService.d.mts.map +0 -1
  573. package/lib/odspDeltaStorageService.mjs.map +0 -1
  574. package/lib/odspDocumentDeltaConnection.d.mts.map +0 -1
  575. package/lib/odspDocumentDeltaConnection.mjs.map +0 -1
  576. package/lib/odspDocumentService.d.mts.map +0 -1
  577. package/lib/odspDocumentService.mjs.map +0 -1
  578. package/lib/odspDocumentServiceFactory.d.mts.map +0 -1
  579. package/lib/odspDocumentServiceFactory.mjs.map +0 -1
  580. package/lib/odspDocumentServiceFactoryCore.d.mts.map +0 -1
  581. package/lib/odspDocumentServiceFactoryCore.mjs.map +0 -1
  582. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +0 -1
  583. package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +0 -1
  584. package/lib/odspDocumentStorageManager.d.mts.map +0 -1
  585. package/lib/odspDocumentStorageManager.mjs.map +0 -1
  586. package/lib/odspDocumentStorageServiceBase.d.mts.map +0 -1
  587. package/lib/odspDocumentStorageServiceBase.mjs.map +0 -1
  588. package/lib/odspDriverUrlResolver.d.mts.map +0 -1
  589. package/lib/odspDriverUrlResolver.mjs.map +0 -1
  590. package/lib/odspDriverUrlResolverForShareLink.d.mts.map +0 -1
  591. package/lib/odspDriverUrlResolverForShareLink.mjs.map +0 -1
  592. package/lib/odspError.d.mts.map +0 -1
  593. package/lib/odspError.mjs.map +0 -1
  594. package/lib/odspFluidFileLink.d.mts.map +0 -1
  595. package/lib/odspFluidFileLink.mjs.map +0 -1
  596. package/lib/odspLocationRedirection.d.mts.map +0 -1
  597. package/lib/odspLocationRedirection.mjs.map +0 -1
  598. package/lib/odspPublicUtils.d.mts.map +0 -1
  599. package/lib/odspPublicUtils.mjs.map +0 -1
  600. package/lib/odspSnapshotParser.d.mts.map +0 -1
  601. package/lib/odspSnapshotParser.mjs.map +0 -1
  602. package/lib/odspSummaryUploadManager.d.mts.map +0 -1
  603. package/lib/odspSummaryUploadManager.mjs.map +0 -1
  604. package/lib/odspUrlHelper.d.mts.map +0 -1
  605. package/lib/odspUrlHelper.mjs.map +0 -1
  606. package/lib/odspUtils.d.mts.map +0 -1
  607. package/lib/odspUtils.mjs.map +0 -1
  608. package/lib/opsCaching.d.mts.map +0 -1
  609. package/lib/opsCaching.mjs.map +0 -1
  610. package/lib/packageVersion.d.mts.map +0 -1
  611. package/lib/packageVersion.mjs.map +0 -1
  612. package/lib/prefetchLatestSnapshot.d.mts.map +0 -1
  613. package/lib/prefetchLatestSnapshot.mjs.map +0 -1
  614. package/lib/retryErrorsStorageAdapter.d.mts.map +0 -1
  615. package/lib/retryErrorsStorageAdapter.mjs.map +0 -1
  616. package/lib/retryUtils.d.mts.map +0 -1
  617. package/lib/retryUtils.mjs.map +0 -1
  618. package/lib/socketModule.d.mts.map +0 -1
  619. package/lib/socketModule.mjs.map +0 -1
  620. package/lib/vroom.d.mts.map +0 -1
  621. package/lib/vroom.mjs.map +0 -1
  622. package/lib/zipItDataRepresentationUtils.d.mts.map +0 -1
  623. package/lib/zipItDataRepresentationUtils.mjs.map +0 -1
@@ -4,21 +4,18 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createOdspCacheAndTracker = exports.EpochTrackerWithRedemption = exports.EpochTracker = exports.defaultCacheExpiryTimeoutMs = exports.Odsp409Error = void 0;
7
+ exports.createOdspCacheAndTracker = exports.EpochTrackerWithRedemption = exports.EpochTracker = exports.Odsp409Error = void 0;
8
8
  const uuid_1 = require("uuid");
9
9
  const core_utils_1 = require("@fluidframework/core-utils");
10
10
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
11
11
  const driver_utils_1 = require("@fluidframework/driver-utils");
12
12
  const odsp_driver_definitions_1 = require("@fluidframework/odsp-driver-definitions");
13
- const driver_definitions_1 = require("@fluidframework/driver-definitions");
14
- const odspUtils_1 = require("./odspUtils");
15
- const contracts_1 = require("./contracts");
16
- const contractsPublic_1 = require("./contractsPublic");
17
- const packageVersion_1 = require("./packageVersion");
18
- const odspLocationRedirection_1 = require("./odspLocationRedirection");
13
+ const odspUtils_js_1 = require("./odspUtils.js");
14
+ const contracts_js_1 = require("./contracts.js");
15
+ const contractsPublic_js_1 = require("./contractsPublic.js");
16
+ const packageVersion_js_1 = require("./packageVersion.js");
17
+ const odspLocationRedirection_js_1 = require("./odspLocationRedirection.js");
19
18
  exports.Odsp409Error = "Odsp409Error";
20
- // Must be less than policy of 5 days
21
- exports.defaultCacheExpiryTimeoutMs = 2 * 24 * 60 * 60 * 1000; // 2 days in ms
22
19
  /**
23
20
  * In ODSP, the concept of "epoch" refers to binary updates to files. For example, this might include using
24
21
  * version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch
@@ -36,11 +33,12 @@ exports.defaultCacheExpiryTimeoutMs = 2 * 24 * 60 * 60 * 1000; // 2 days in ms
36
33
  * @alpha
37
34
  */
38
35
  class EpochTracker {
39
- constructor(cache, fileEntry, logger, clientIsSummarizer) {
36
+ constructor(cache, fileEntry, logger, clientIsSummarizer, hostPolicy) {
40
37
  this.cache = cache;
41
38
  this.fileEntry = fileEntry;
42
39
  this.logger = logger;
43
40
  this.clientIsSummarizer = clientIsSummarizer;
41
+ this.hostPolicy = hostPolicy;
44
42
  this.driverId = (0, uuid_1.v4)();
45
43
  // This tracks the request number made by the driver instance.
46
44
  this.networkCallNumber = 1;
@@ -49,7 +47,7 @@ class EpochTracker {
49
47
  // Matches the TestOverride logic for the policy defined in odspDocumentStorageServiceBase.ts
50
48
  this.snapshotCacheExpiryTimeoutMs = (0, telemetry_utils_1.loggerToMonitoringContext)(logger).config.getBoolean("Fluid.Driver.Odsp.TestOverride.DisableSnapshotCache")
51
49
  ? 0
52
- : exports.defaultCacheExpiryTimeoutMs;
50
+ : odsp_driver_definitions_1.maximumCacheDurationMs;
53
51
  }
54
52
  // public for UT purposes only!
55
53
  setEpoch(epoch, fromCache, fetchType) {
@@ -62,13 +60,16 @@ class EpochTracker {
62
60
  fromCache,
63
61
  });
64
62
  }
63
+ // TODO: return a stronger type
64
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
65
  async get(entry) {
66
66
  try {
67
67
  // Return undefined so that the ops/snapshots are grabbed from the server instead of the cache
68
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
68
69
  const value = await this.cache.get(this.fileEntryFromEntry(entry));
69
70
  // Version mismatch between what the runtime expects and what it recieved.
70
71
  // The cached value should not be used
71
- if (value === undefined || value.version !== contracts_1.persistedCacheValueVersion) {
72
+ if (value === undefined || value.version !== contracts_js_1.persistedCacheValueVersion) {
72
73
  return undefined;
73
74
  }
74
75
  (0, core_utils_1.assert)(value.fluidEpoch !== undefined, 0x1dc /* "all entries have to have epoch" */);
@@ -83,6 +84,7 @@ class EpochTracker {
83
84
  // Expire the cached snapshot if it's older than snapshotCacheExpiryTimeoutMs and immediately
84
85
  // expire all old caches that do not have cacheEntryTime
85
86
  if (entry.type === odsp_driver_definitions_1.snapshotKey) {
87
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
86
88
  const cacheTime = value.value?.cacheEntryTime;
87
89
  const currentTime = Date.now();
88
90
  if (cacheTime === undefined ||
@@ -104,16 +106,20 @@ class EpochTracker {
104
106
  return undefined;
105
107
  }
106
108
  }
109
+ // TODO: take a stronger type or `unknown`
110
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
107
111
  async put(entry, value) {
108
112
  (0, core_utils_1.assert)(this._fluidEpoch !== undefined, 0x1dd /* "no epoch" */);
109
113
  // For snapshots, the value should have the cacheEntryTime.
110
114
  // This will be used to expire snapshots older than snapshotCacheExpiryTimeoutMs.
111
115
  if (entry.type === odsp_driver_definitions_1.snapshotKey) {
116
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
112
117
  value.cacheEntryTime = value.cacheEntryTime ?? Date.now();
113
118
  }
114
119
  const data = {
120
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
115
121
  value,
116
- version: contracts_1.persistedCacheValueVersion,
122
+ version: contracts_js_1.persistedCacheValueVersion,
117
123
  fluidEpoch: this._fluidEpoch,
118
124
  };
119
125
  return this.cache.put(this.fileEntryFromEntry(entry), data).catch((error) => {
@@ -151,7 +157,7 @@ class EpochTracker {
151
157
  * @param fetchReason - fetch reason to add to the request.
152
158
  */
153
159
  async fetchAndParseAsJSON(url, fetchOptions, fetchType, addInBody = false, fetchReason) {
154
- return this.fetchCore(url, fetchOptions, odspUtils_1.fetchAndParseAsJSONHelper, fetchType, addInBody, fetchReason);
160
+ return this.fetchCore(url, fetchOptions, odspUtils_js_1.fetchAndParseAsJSONHelper, fetchType, addInBody, fetchReason);
155
161
  }
156
162
  /**
157
163
  * Api to fetch the response for given request and parse it as json.
@@ -162,7 +168,7 @@ class EpochTracker {
162
168
  * @param fetchReason - fetch reason to add to the request.
163
169
  */
164
170
  async fetch(url, fetchOptions, fetchType, addInBody = false, fetchReason) {
165
- return this.fetchCore(url, fetchOptions, odspUtils_1.fetchHelper, fetchType, addInBody, fetchReason);
171
+ return this.fetchCore(url, fetchOptions, odspUtils_js_1.fetchHelper, fetchType, addInBody, fetchReason);
166
172
  }
167
173
  async fetchCore(url, fetchOptions, fetcher, fetchType, addInBody = false, fetchReason) {
168
174
  const clientCorrelationId = this.formatClientCorrelationId(fetchReason);
@@ -187,16 +193,28 @@ class EpochTracker {
187
193
  throw error;
188
194
  })
189
195
  .catch((error) => {
190
- // If the error is about location redirection, then we need to generate new resolved url with correct
191
- // location info.
192
- if ((0, telemetry_utils_1.isFluidError)(error) &&
193
- error.errorType === driver_definitions_1.DriverErrorType.fileNotFoundOrAccessDeniedError) {
194
- const redirectLocation = error.redirectLocation;
195
- if (redirectLocation !== undefined) {
196
- const redirectUrl = (0, odspLocationRedirection_1.patchOdspResolvedUrl)(this.fileEntry.resolvedUrl, redirectLocation);
197
- const locationRedirectionError = new driver_utils_1.LocationRedirectionError(error.message, redirectUrl, { driverVersion: packageVersion_1.pkgVersion, redirectLocation });
198
- locationRedirectionError.addTelemetryProperties(error.getTelemetryProperties());
199
- throw locationRedirectionError;
196
+ if ((0, telemetry_utils_1.isFluidError)(error)) {
197
+ // If the error is about location redirection, then we need to generate new resolved url with correct
198
+ // location info.
199
+ if (error.errorType === odsp_driver_definitions_1.OdspErrorTypes.fileNotFoundOrAccessDeniedError) {
200
+ const redirectLocation = error
201
+ .redirectLocation;
202
+ if (redirectLocation !== undefined) {
203
+ const redirectUrl = (0, odspLocationRedirection_js_1.patchOdspResolvedUrl)(this.fileEntry.resolvedUrl, redirectLocation);
204
+ const locationRedirectionError = new driver_utils_1.LocationRedirectionError(error.message, redirectUrl, { driverVersion: packageVersion_js_1.pkgVersion, redirectLocation });
205
+ locationRedirectionError.addTelemetryProperties(error.getTelemetryProperties());
206
+ throw locationRedirectionError;
207
+ }
208
+ }
209
+ // If the hostPolicy disallows retries for throttling errors, then we throw a NonRetryableError
210
+ else if (error.errorType === odsp_driver_definitions_1.OdspErrorTypes.throttlingError &&
211
+ this.hostPolicy?.disableRetriesOnStorageThrottlingError) {
212
+ const nonRetriableThrottlingError = new driver_utils_1.NonRetryableError(error.message, odsp_driver_definitions_1.OdspErrorTypes.throttlingError, {
213
+ driverVersion: packageVersion_js_1.pkgVersion,
214
+ });
215
+ // This step ensures all the telemetry props are preserved including the retryAfterSeconds from the original error
216
+ nonRetriableThrottlingError.addTelemetryProperties(error.getTelemetryProperties());
217
+ throw nonRetriableThrottlingError;
200
218
  }
201
219
  }
202
220
  throw error;
@@ -217,10 +235,10 @@ class EpochTracker {
217
235
  * @param fetchReason - fetch reason to add to the request.
218
236
  */
219
237
  async fetchArray(url, fetchOptions, fetchType, addInBody = false, fetchReason) {
220
- return this.fetchCore(url, fetchOptions, odspUtils_1.fetchArray, fetchType, addInBody, fetchReason);
238
+ return this.fetchCore(url, fetchOptions, odspUtils_js_1.fetchArray, fetchType, addInBody, fetchReason);
221
239
  }
222
240
  addEpochInRequest(fetchOptions, addInBody, clientCorrelationId) {
223
- const isClpCompliantApp = (0, odspUtils_1.getOdspResolvedUrl)(this.fileEntry.resolvedUrl).isClpCompliantApp;
241
+ const isClpCompliantApp = (0, odspUtils_js_1.getOdspResolvedUrl)(this.fileEntry.resolvedUrl).isClpCompliantApp;
224
242
  if (addInBody) {
225
243
  const headers = {};
226
244
  headers["X-RequestStats"] = clientCorrelationId;
@@ -228,7 +246,7 @@ class EpochTracker {
228
246
  headers["x-fluid-epoch"] = this.fluidEpoch;
229
247
  }
230
248
  if (isClpCompliantApp) {
231
- headers[contractsPublic_1.ClpCompliantAppHeader.isClpCompliantApp] = isClpCompliantApp.toString();
249
+ headers[contractsPublic_js_1.ClpCompliantAppHeader.isClpCompliantApp] = isClpCompliantApp.toString();
232
250
  }
233
251
  this.addParamInBody(fetchOptions, headers);
234
252
  }
@@ -245,7 +263,7 @@ class EpochTracker {
245
263
  addHeader("x-fluid-epoch", this.fluidEpoch);
246
264
  }
247
265
  if (isClpCompliantApp) {
248
- addHeader(contractsPublic_1.ClpCompliantAppHeader.isClpCompliantApp, isClpCompliantApp.toString());
266
+ addHeader(contractsPublic_js_1.ClpCompliantAppHeader.isClpCompliantApp, isClpCompliantApp.toString());
249
267
  }
250
268
  }
251
269
  }
@@ -258,19 +276,19 @@ class EpochTracker {
258
276
  const firstLine = splitBody.shift();
259
277
  (0, core_utils_1.assert)(firstLine?.startsWith("--") === true, 0x21e /* "improper boundary format" */);
260
278
  const formParams = [firstLine];
261
- Object.entries(headers).forEach(([key, value]) => {
279
+ for (const [key, value] of Object.entries(headers)) {
262
280
  formParams.push(`${key}: ${value}`);
263
- });
264
- splitBody.forEach((value) => {
281
+ }
282
+ for (const value of splitBody) {
265
283
  formParams.push(value);
266
- });
284
+ }
267
285
  fetchOptions.body = formParams.join("\r\n");
268
286
  }
269
287
  formatClientCorrelationId(fetchReason) {
270
288
  const items = [
271
289
  `driverId=${this.driverId}`,
272
290
  `RequestNumber=${this.networkCallNumber++}`,
273
- `driverVersion=${packageVersion_1.pkgVersion}`,
291
+ `driverVersion=${packageVersion_js_1.pkgVersion}`,
274
292
  `isSummarizer=${this.clientIsSummarizer}`,
275
293
  ];
276
294
  if (fetchReason !== undefined) {
@@ -283,14 +301,12 @@ class EpochTracker {
283
301
  if (error !== undefined) {
284
302
  throw error;
285
303
  }
286
- if (epochFromResponse !== undefined) {
287
- if (this._fluidEpoch === undefined) {
288
- this.setEpoch(epochFromResponse, fromCache, fetchType);
289
- }
304
+ if (epochFromResponse !== undefined && this._fluidEpoch === undefined) {
305
+ this.setEpoch(epochFromResponse, fromCache, fetchType);
290
306
  }
291
307
  }
292
308
  async checkForEpochError(error, epochFromResponse, fetchType, fromCache = false) {
293
- if ((0, telemetry_utils_1.isFluidError)(error) && error.errorType === driver_definitions_1.DriverErrorType.fileOverwrittenInStorage) {
309
+ if ((0, telemetry_utils_1.isFluidError)(error) && error.errorType === odsp_driver_definitions_1.OdspErrorTypes.fileOverwrittenInStorage) {
294
310
  const epochError = this.checkForEpochErrorCore(epochFromResponse);
295
311
  if (epochError !== undefined) {
296
312
  epochError.addTelemetryProperties({
@@ -308,7 +324,7 @@ class EpochTracker {
308
324
  const newError = (0, telemetry_utils_1.wrapError)(error, (message) => {
309
325
  return new driver_utils_1.ThrottlingError(`Coherency 409: ${message}`, 1 /* retryAfterSeconds */, {
310
326
  [exports.Odsp409Error]: true,
311
- driverVersion: packageVersion_1.pkgVersion,
327
+ driverVersion: packageVersion_js_1.pkgVersion,
312
328
  });
313
329
  });
314
330
  throw newError;
@@ -321,7 +337,7 @@ class EpochTracker {
321
337
  if (this.fluidEpoch && epochFromResponse && this.fluidEpoch !== epochFromResponse) {
322
338
  // This is similar in nature to how fluidEpochMismatchError (409) is handled.
323
339
  // Difference - client detected mismatch, instead of server detecting it.
324
- return new driver_utils_1.NonRetryableError("Epoch mismatch", driver_definitions_1.DriverErrorType.fileOverwrittenInStorage, { driverVersion: packageVersion_1.pkgVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch });
340
+ return new driver_utils_1.NonRetryableError("Epoch mismatch", odsp_driver_definitions_1.OdspErrorTypes.fileOverwrittenInStorage, { driverVersion: packageVersion_js_1.pkgVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch });
325
341
  }
326
342
  }
327
343
  fileEntryFromEntry(entry) {
@@ -330,12 +346,13 @@ class EpochTracker {
330
346
  }
331
347
  exports.EpochTracker = EpochTracker;
332
348
  class EpochTrackerWithRedemption extends EpochTracker {
333
- constructor(cache, fileEntry, logger, clientIsSummarizer) {
334
- super(cache, fileEntry, logger, clientIsSummarizer);
349
+ constructor(cache, fileEntry, logger, clientIsSummarizer, hostPolicy) {
350
+ super(cache, fileEntry, logger, clientIsSummarizer, hostPolicy);
335
351
  this.cache = cache;
336
352
  this.fileEntry = fileEntry;
337
353
  this.logger = logger;
338
354
  this.clientIsSummarizer = clientIsSummarizer;
355
+ this.hostPolicy = hostPolicy;
339
356
  this.treesLatestDeferral = new core_utils_1.Deferred();
340
357
  // Handles the rejected promise within treesLatestDeferral.
341
358
  this.treesLatestDeferral.promise.catch(() => { });
@@ -347,6 +364,8 @@ class EpochTrackerWithRedemption extends EpochTracker {
347
364
  // exploring a file.
348
365
  this.treesLatestDeferral.resolve();
349
366
  }
367
+ // TODO: return a stronger type
368
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
350
369
  async get(entry) {
351
370
  let result = super.get(entry);
352
371
  // equivalence of what happens in fetchAndParseAsJSON()
@@ -374,6 +393,7 @@ class EpochTrackerWithRedemption extends EpochTracker {
374
393
  const completed = this.treesLatestDeferral.isCompleted;
375
394
  try {
376
395
  return await super.fetchAndParseAsJSON(url, fetchOptions, fetchType, addInBody, fetchReason);
396
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
377
397
  }
378
398
  catch (error) {
379
399
  // Only handling here treesLatest. If createFile failed, we should never try to do joinSession.
@@ -383,7 +403,9 @@ class EpochTrackerWithRedemption extends EpochTracker {
383
403
  this.treesLatestDeferral.reject(error);
384
404
  }
385
405
  if (fetchType !== "joinSession" ||
406
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
386
407
  error.statusCode < 401 ||
408
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
387
409
  error.statusCode > 404 ||
388
410
  completed) {
389
411
  throw error;
@@ -418,8 +440,8 @@ class EpochTrackerWithRedemption extends EpochTracker {
418
440
  }
419
441
  }
420
442
  exports.EpochTrackerWithRedemption = EpochTrackerWithRedemption;
421
- function createOdspCacheAndTracker(persistedCacheArg, nonpersistentCache, fileEntry, logger, clientIsSummarizer) {
422
- const epochTracker = new EpochTrackerWithRedemption(persistedCacheArg, fileEntry, logger, clientIsSummarizer);
443
+ function createOdspCacheAndTracker(persistedCacheArg, nonpersistentCache, fileEntry, logger, clientIsSummarizer, hostPolicy) {
444
+ const epochTracker = new EpochTrackerWithRedemption(persistedCacheArg, fileEntry, logger, clientIsSummarizer, hostPolicy);
423
445
  return {
424
446
  cache: {
425
447
  ...nonpersistent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C,OAAO,EAAE,EAAE;gBAChD,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;oBACvB,OAAO,CAAC,UAAU,CAAC,CAAC;gBACrB,CAAC,EAAE,KAAK,CAAC,CAAC;YACX,CAAC,CAAC,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;gBAC9B,QAAQ;gBACR,kFAAkF;gBAClF,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;aACnE,CAAC,CAAC;YACH,IAAI,GAAG,KAAK,UAAU,EAAE;gBACvB,KAAK,CAAC,MAAM,EAAE,CAAC;aACf;QACF,CAAC,EACD,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAC7C,CAAC;QACF,OAAO,KAAK,CAAC,mBAAmB,CAAI,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC9E,CAAC;CACD;AAvHD,gEAuHC;AAUD,SAAgB,yBAAyB,CACxC,iBAAkC,EAClC,kBAAuC,EACvC,SAAqB,EACrB,MAA2B,EAC3B,kBAA4B;IAE5B,MAAM,YAAY,GAAG,IAAI,0BAA0B,CAClD,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,kBAAkB,CAClB,CAAC;IACF,OAAO;QACN,KAAK,EAAE;YACN,GAAG,kBAAkB;YACrB,cAAc,EAAE,YAAY;SAC5B;QACD,YAAY;KACZ,CAAC;AACH,CAAC;AApBD,8DAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tisFluidError,\n\tnormalizeError,\n\tloggerToMonitoringContext,\n\twrapError,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tThrottlingError,\n\tRateLimiter,\n\tNonRetryableError,\n\tLocationRedirectionError,\n} from \"@fluidframework/driver-utils\";\nimport {\n\tsnapshotKey,\n\tICacheEntry,\n\tIEntry,\n\tIFileEntry,\n\tIPersistedCache,\n\tIOdspError,\n\tIOdspErrorAugmentations,\n\tIOdspResolvedUrl,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport {\n\tfetchAndParseAsJSONHelper,\n\tfetchArray,\n\tfetchHelper,\n\tgetOdspResolvedUrl,\n\tIOdspResponse,\n} from \"./odspUtils\";\nimport { IOdspCache, INonPersistentCache, IPersistedFileCache } from \"./odspCache\";\nimport { IVersionedValueWithEpoch, persistedCacheValueVersion } from \"./contracts\";\nimport { ClpCompliantAppHeader } from \"./contractsPublic\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { patchOdspResolvedUrl } from \"./odspLocationRedirection\";\n\n/**\n * @alpha\n */\nexport type FetchType =\n\t| \"blob\"\n\t| \"createBlob\"\n\t| \"createFile\"\n\t| \"joinSession\"\n\t| \"ops\"\n\t| \"test\"\n\t| \"snapshotTree\"\n\t| \"treesLatest\"\n\t| \"uploadSummary\"\n\t| \"push\"\n\t| \"versions\";\n\n/**\n * @alpha\n */\nexport type FetchTypeInternal = FetchType | \"cache\";\n\nexport const Odsp409Error = \"Odsp409Error\";\n\n// Must be less than policy of 5 days\nexport const defaultCacheExpiryTimeoutMs: number = 2 * 24 * 60 * 60 * 1000; // 2 days in ms\n\n/**\n * In ODSP, the concept of \"epoch\" refers to binary updates to files. For example, this might include using\n * version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch\n * value being incremented.\n *\n * The implications of these binary updates is that the Fluid state is disrupted: the sequence number might\n * go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's\n * not safe to continue collaboration across an epoch change. We need to detect these epoch changes and\n * error out from the collaboration.\n *\n * This class is a wrapper around fetch calls. It adds epoch to the request made so that the\n * server can match it with its epoch value in order to match the version.\n * It also validates the epoch value received in response of fetch calls. If the epoch does not match,\n * then it also clears all the cached entries for the given container.\n * @alpha\n */\nexport class EpochTracker implements IPersistedFileCache {\n\tprivate _fluidEpoch: string | undefined;\n\n\tprivate readonly snapshotCacheExpiryTimeoutMs: number;\n\tpublic readonly rateLimiter: RateLimiter;\n\tprivate readonly driverId = uuid();\n\t// This tracks the request number made by the driver instance.\n\tprivate networkCallNumber = 1;\n\tconstructor(\n\t\tprotected readonly cache: IPersistedCache,\n\t\tprotected readonly fileEntry: IFileEntry,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tprotected readonly clientIsSummarizer?: boolean,\n\t) {\n\t\t// Limits the max number of concurrent requests to 24.\n\t\tthis.rateLimiter = new RateLimiter(24);\n\n\t\t// Matches the TestOverride logic for the policy defined in odspDocumentStorageServiceBase.ts\n\t\tthis.snapshotCacheExpiryTimeoutMs = loggerToMonitoringContext(logger).config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.TestOverride.DisableSnapshotCache\",\n\t\t)\n\t\t\t? 0\n\t\t\t: defaultCacheExpiryTimeoutMs;\n\t}\n\n\t// public for UT purposes only!\n\tpublic setEpoch(epoch: string, fromCache: boolean, fetchType: FetchTypeInternal) {\n\t\tassert(this._fluidEpoch === undefined, 0x1db /* \"epoch exists\" */);\n\t\tthis._fluidEpoch = epoch;\n\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"EpochLearnedFirstTime\",\n\t\t\tepoch,\n\t\t\tfetchType,\n\t\t\tfromCache,\n\t\t});\n\t}\n\n\tpublic async get(entry: IEntry): Promise<any> {\n\t\ttry {\n\t\t\t// Return undefined so that the ops/snapshots are grabbed from the server instead of the cache\n\t\t\tconst value: IVersionedValueWithEpoch = await this.cache.get(\n\t\t\t\tthis.fileEntryFromEntry(entry),\n\t\t\t);\n\t\t\t// Version mismatch between what the runtime expects and what it recieved.\n\t\t\t// The cached value should not be used\n\t\t\tif (value === undefined || value.version !== persistedCacheValueVersion) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tassert(value.fluidEpoch !== undefined, 0x1dc /* \"all entries have to have epoch\" */);\n\t\t\tif (this._fluidEpoch === undefined) {\n\t\t\t\tthis.setEpoch(value.fluidEpoch, true, \"cache\");\n\t\t\t\t// Epoch mismatch, the cached value is considerably different from what the current state of\n\t\t\t\t// the runtime and should not be used\n\t\t\t} else if (this._fluidEpoch !== value.fluidEpoch) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\t// Expire the cached snapshot if it's older than snapshotCacheExpiryTimeoutMs and immediately\n\t\t\t// expire all old caches that do not have cacheEntryTime\n\t\t\tif (entry.type === snapshotKey) {\n\t\t\t\tconst cacheTime = value.value?.cacheEntryTime;\n\t\t\t\tconst currentTime = Date.now();\n\t\t\t\tif (\n\t\t\t\t\tcacheTime === undefined ||\n\t\t\t\t\tcurrentTime - cacheTime >= this.snapshotCacheExpiryTimeoutMs\n\t\t\t\t) {\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"odspVersionsCacheExpired\",\n\t\t\t\t\t\tduration: currentTime - cacheTime,\n\t\t\t\t\t\tmaxCacheAgeMs: this.snapshotCacheExpiryTimeoutMs,\n\t\t\t\t\t});\n\t\t\t\t\tawait this.removeEntries();\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn value.value;\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"cacheFetchError\", type: entry.type }, error);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\tpublic async put(entry: IEntry, value: any) {\n\t\tassert(this._fluidEpoch !== undefined, 0x1dd /* \"no epoch\" */);\n\t\t// For snapshots, the value should have the cacheEntryTime.\n\t\t// This will be used to expire snapshots older than snapshotCacheExpiryTimeoutMs.\n\t\tif (entry.type === snapshotKey) {\n\t\t\tvalue.cacheEntryTime = value.cacheEntryTime ?? Date.now();\n\t\t}\n\t\tconst data: IVersionedValueWithEpoch = {\n\t\t\tvalue,\n\t\t\tversion: persistedCacheValueVersion,\n\t\t\tfluidEpoch: this._fluidEpoch,\n\t\t};\n\t\treturn this.cache.put(this.fileEntryFromEntry(entry), data).catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"cachePutError\", type: entry.type }, error);\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tpublic async removeEntries(): Promise<void> {\n\t\ttry {\n\t\t\treturn await this.cache.removeEntries(this.fileEntry);\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"removeCacheEntries\" }, error);\n\t\t}\n\t}\n\n\tpublic get fluidEpoch() {\n\t\treturn this._fluidEpoch;\n\t}\n\n\tpublic async validateEpoch(epoch: string | undefined, fetchType: FetchType) {\n\t\tassert(epoch !== undefined, 0x584 /* response should contain epoch */);\n\t\ttry {\n\t\t\tthis.validateEpochFromResponse(epoch, fetchType);\n\t\t} catch (error) {\n\t\t\tawait this.checkForEpochError(error, epoch, fetchType);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Api to fetch the response for given request and parse it as json.\n\t * @param url - url of the request\n\t * @param fetchOptions - fetch options for request containing body, headers etc.\n\t * @param fetchType - method for which fetch is called.\n\t * @param addInBody - Pass True if caller wants to add epoch in post body.\n\t * @param fetchReason - fetch reason to add to the request.\n\t */\n\tpublic async fetchAndParseAsJSON<T>(\n\t\turl: string,\n\t\tfetchOptions: RequestInit,\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t): Promise<IOdspResponse<T>> {\n\t\treturn this.fetchCore<T>(\n\t\t\turl,\n\t\t\tfetchOptions,\n\t\t\tfetchAndParseAsJSONHelper,\n\t\t\tfetchType,\n\t\t\taddInBody,\n\t\t\tfetchReason,\n\t\t);\n\t}\n\n\t/**\n\t * Api to fetch the response for given request and parse it as json.\n\t * @param url - url of the request\n\t * @param fetchOptions - fetch options for request containing body, headers etc.\n\t * @param fetchType - method for which fetch is called.\n\t * @param addInBody - Pass True if caller wants to add epoch in post body.\n\t * @param fetchReason - fetch reason to add to the request.\n\t */\n\tpublic async fetch(\n\t\turl: string,\n\t\tfetchOptions: RequestInit,\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t) {\n\t\treturn this.fetchCore<Response>(\n\t\t\turl,\n\t\t\tfetchOptions,\n\t\t\tfetchHelper,\n\t\t\tfetchType,\n\t\t\taddInBody,\n\t\t\tfetchReason,\n\t\t);\n\t}\n\n\tprivate async fetchCore<T>(\n\t\turl: string,\n\t\tfetchOptions: { [index: string]: any },\n\t\tfetcher: (url: string, fetchOptions: { [index: string]: any }) => Promise<IOdspResponse<T>>,\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t) {\n\t\tconst clientCorrelationId = this.formatClientCorrelationId(fetchReason);\n\t\t// Add epoch in fetch request.\n\t\tthis.addEpochInRequest(fetchOptions, addInBody, clientCorrelationId);\n\t\tlet epochFromResponse: string | undefined;\n\t\treturn this.rateLimiter\n\t\t\t.schedule(async () => fetcher(url, fetchOptions))\n\t\t\t.then((response) => {\n\t\t\t\tepochFromResponse = response.headers.get(\"x-fluid-epoch\");\n\t\t\t\tthis.validateEpochFromResponse(epochFromResponse, fetchType);\n\t\t\t\tresponse.propsToLog.XRequestStatsHeader = clientCorrelationId;\n\t\t\t\treturn response;\n\t\t\t})\n\t\t\t.catch(async (error) => {\n\t\t\t\t// Get the server epoch from error in case we don't have it as if undefined we won't be able\n\t\t\t\t// to mark it as epoch error.\n\t\t\t\tif (epochFromResponse === undefined) {\n\t\t\t\t\tepochFromResponse = (error as IOdspError).serverEpoch;\n\t\t\t\t}\n\t\t\t\tawait this.checkForEpochError(error, epochFromResponse, fetchType);\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\t// If the error is about location redirection, then we need to generate new resolved url with correct\n\t\t\t\t// location info.\n\t\t\t\tif (\n\t\t\t\t\tisFluidError(error) &&\n\t\t\t\t\terror.errorType === DriverErrorType.fileNotFoundOrAccessDeniedError\n\t\t\t\t) {\n\t\t\t\t\tconst redirectLocation = (error as IOdspErrorAugmentations).redirectLocation;\n\t\t\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\t\t\tconst redirectUrl: IOdspResolvedUrl = patchOdspResolvedUrl(\n\t\t\t\t\t\t\tthis.fileEntry.resolvedUrl,\n\t\t\t\t\t\t\tredirectLocation,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst locationRedirectionError = new LocationRedirectionError(\n\t\t\t\t\t\t\terror.message,\n\t\t\t\t\t\t\tredirectUrl,\n\t\t\t\t\t\t\t{ driverVersion, redirectLocation },\n\t\t\t\t\t\t);\n\t\t\t\t\t\tlocationRedirectionError.addTelemetryProperties(\n\t\t\t\t\t\t\terror.getTelemetryProperties(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthrow locationRedirectionError;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tconst fluidError = normalizeError(error, {\n\t\t\t\t\tprops: { XRequestStatsHeader: clientCorrelationId },\n\t\t\t\t});\n\t\t\t\tthrow fluidError;\n\t\t\t});\n\t}\n\n\t/**\n\t * Api to fetch the response as it is for given request.\n\t * @param url - url of the request\n\t * @param fetchOptions - fetch options for request containing body, headers etc.\n\t * @param fetchType - method for which fetch is called.\n\t * @param addInBody - Pass True if caller wants to add epoch in post body.\n\t * @param fetchReason - fetch reason to add to the request.\n\t */\n\tpublic async fetchArray(\n\t\turl: string,\n\t\tfetchOptions: { [index: string]: any },\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t) {\n\t\treturn this.fetchCore<ArrayBuffer>(\n\t\t\turl,\n\t\t\tfetchOptions,\n\t\t\tfetchArray,\n\t\t\tfetchType,\n\t\t\taddInBody,\n\t\t\tfetchReason,\n\t\t);\n\t}\n\n\tprivate addEpochInRequest(\n\t\tfetchOptions: RequestInit,\n\t\taddInBody: boolean,\n\t\tclientCorrelationId: string,\n\t) {\n\t\tconst isClpCompliantApp = getOdspResolvedUrl(this.fileEntry.resolvedUrl).isClpCompliantApp;\n\t\tif (addInBody) {\n\t\t\tconst headers: { [key: string]: string } = {};\n\t\t\theaders[\"X-RequestStats\"] = clientCorrelationId;\n\t\t\tif (this.fluidEpoch !== undefined) {\n\t\t\t\theaders[\"x-fluid-epoch\"] = this.fluidEpoch;\n\t\t\t}\n\t\t\tif (isClpCompliantApp) {\n\t\t\t\theaders[ClpCompliantAppHeader.isClpCompliantApp] = isClpCompliantApp.toString();\n\t\t\t}\n\t\t\tthis.addParamInBody(fetchOptions, headers);\n\t\t} else {\n\t\t\tconst addHeader = (key: string, val: string) => {\n\t\t\t\tfetchOptions.headers = {\n\t\t\t\t\t...fetchOptions.headers,\n\t\t\t\t};\n\t\t\t\tassert(\n\t\t\t\t\tfetchOptions.headers !== undefined,\n\t\t\t\t\t0x282 /* \"Headers should be present now\" */,\n\t\t\t\t);\n\t\t\t\tfetchOptions.headers[key] = val;\n\t\t\t};\n\t\t\taddHeader(\"X-RequestStats\", clientCorrelationId);\n\t\t\tif (this.fluidEpoch !== undefined) {\n\t\t\t\taddHeader(\"x-fluid-epoch\", this.fluidEpoch);\n\t\t\t}\n\t\t\tif (isClpCompliantApp) {\n\t\t\t\taddHeader(ClpCompliantAppHeader.isClpCompliantApp, isClpCompliantApp.toString());\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate addParamInBody(fetchOptions: RequestInit, headers: { [key: string]: string }) {\n\t\t// We use multi part form request for post body where we want to use this.\n\t\t// So extract the form boundary to mark the end of form.\n\t\tconst body = fetchOptions.body;\n\t\tassert(typeof body === \"string\", 0x21d /* \"body is not string\" */);\n\t\tconst splitBody = body.split(\"\\r\\n\");\n\t\tconst firstLine = splitBody.shift();\n\t\tassert(firstLine?.startsWith(\"--\") === true, 0x21e /* \"improper boundary format\" */);\n\t\tconst formParams = [firstLine];\n\t\tObject.entries(headers).forEach(([key, value]) => {\n\t\t\tformParams.push(`${key}: ${value}`);\n\t\t});\n\t\tsplitBody.forEach((value: string) => {\n\t\t\tformParams.push(value);\n\t\t});\n\t\tfetchOptions.body = formParams.join(\"\\r\\n\");\n\t}\n\n\tprivate formatClientCorrelationId(fetchReason?: string) {\n\t\tconst items: string[] = [\n\t\t\t`driverId=${this.driverId}`,\n\t\t\t`RequestNumber=${this.networkCallNumber++}`,\n\t\t\t`driverVersion=${driverVersion}`,\n\t\t\t`isSummarizer=${this.clientIsSummarizer}`,\n\t\t];\n\t\tif (fetchReason !== undefined) {\n\t\t\titems.push(`fetchReason=${fetchReason}`);\n\t\t}\n\t\treturn items.join(\", \");\n\t}\n\n\tprotected validateEpochFromResponse(\n\t\tepochFromResponse: string | undefined,\n\t\tfetchType: FetchTypeInternal,\n\t\tfromCache: boolean = false,\n\t) {\n\t\tconst error = this.checkForEpochErrorCore(epochFromResponse);\n\t\tif (error !== undefined) {\n\t\t\tthrow error;\n\t\t}\n\t\tif (epochFromResponse !== undefined) {\n\t\t\tif (this._fluidEpoch === undefined) {\n\t\t\t\tthis.setEpoch(epochFromResponse, fromCache, fetchType);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async checkForEpochError(\n\t\terror: unknown,\n\t\tepochFromResponse: string | null | undefined,\n\t\tfetchType: FetchTypeInternal,\n\t\tfromCache: boolean = false,\n\t) {\n\t\tif (isFluidError(error) && error.errorType === DriverErrorType.fileOverwrittenInStorage) {\n\t\t\tconst epochError = this.checkForEpochErrorCore(epochFromResponse);\n\t\t\tif (epochError !== undefined) {\n\t\t\t\tepochError.addTelemetryProperties({\n\t\t\t\t\tfromCache,\n\t\t\t\t\tfetchType,\n\t\t\t\t});\n\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"fileOverwrittenInStorage\" }, epochError);\n\t\t\t\t// If the epoch mismatches, then clear all entries for such file entry from cache.\n\t\t\t\tawait this.removeEntries();\n\t\t\t\tthrow epochError;\n\t\t\t}\n\t\t\t// If it was categorized as epoch error but the epoch returned in response matches with the client epoch\n\t\t\t// then it was coherency 409, so rethrow it as throttling error so that it can retried. Default throttling\n\t\t\t// time is 1s.\n\t\t\tconst newError = wrapError(error, (message: string) => {\n\t\t\t\treturn new ThrottlingError(`Coherency 409: ${message}`, 1 /* retryAfterSeconds */, {\n\t\t\t\t\t[Odsp409Error]: true,\n\t\t\t\t\tdriverVersion,\n\t\t\t\t});\n\t\t\t});\n\t\t\tthrow newError;\n\t\t}\n\t}\n\n\tprivate checkForEpochErrorCore(epochFromResponse: string | null | undefined) {\n\t\t// If epoch is undefined, then don't compare it because initially for createNew or TreesLatest\n\t\t// initializes this value. Sometimes response does not contain epoch as it is still in\n\t\t// implementation phase at server side. In that case also, don't compare it with our epoch value.\n\t\tif (this.fluidEpoch && epochFromResponse && this.fluidEpoch !== epochFromResponse) {\n\t\t\t// This is similar in nature to how fluidEpochMismatchError (409) is handled.\n\t\t\t// Difference - client detected mismatch, instead of server detecting it.\n\t\t\treturn new NonRetryableError(\n\t\t\t\t\"Epoch mismatch\",\n\t\t\t\tDriverErrorType.fileOverwrittenInStorage,\n\t\t\t\t{ driverVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch },\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate fileEntryFromEntry(entry: IEntry): ICacheEntry {\n\t\treturn { ...entry, file: this.fileEntry };\n\t}\n}\n\nexport class EpochTrackerWithRedemption extends EpochTracker {\n\tprivate readonly treesLatestDeferral = new Deferred<void>();\n\n\tconstructor(\n\t\tprotected readonly cache: IPersistedCache,\n\t\tprotected readonly fileEntry: IFileEntry,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tprotected readonly clientIsSummarizer?: boolean,\n\t) {\n\t\tsuper(cache, fileEntry, logger, clientIsSummarizer);\n\t\t// Handles the rejected promise within treesLatestDeferral.\n\t\tthis.treesLatestDeferral.promise.catch(() => {});\n\t}\n\n\tprotected validateEpochFromResponse(\n\t\tepochFromResponse: string | undefined,\n\t\tfetchType: FetchType,\n\t\tfromCache: boolean = false,\n\t) {\n\t\tsuper.validateEpochFromResponse(epochFromResponse, fetchType, fromCache);\n\n\t\t// Any successful call means we have access to a file, i.e. any redemption that was required already happened.\n\t\t// That covers cases of \"treesLatest\" as well as \"getVersions\" or \"createFile\" - all the ways we can start\n\t\t// exploring a file.\n\t\tthis.treesLatestDeferral.resolve();\n\t}\n\n\tpublic async get(entry: IEntry): Promise<any> {\n\t\tlet result = super.get(entry);\n\n\t\t// equivalence of what happens in fetchAndParseAsJSON()\n\t\tif (entry.type === snapshotKey) {\n\t\t\tresult = result\n\t\t\t\t.then((value) => {\n\t\t\t\t\t// If there is nothing in cache, we need to wait for network call to complete (and do redemption)\n\t\t\t\t\t// Otherwise file was redeemed in prior session, so if joinSession failed, we should not retry\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\tthis.treesLatestDeferral.resolve();\n\t\t\t\t\t}\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\t\t\treturn value;\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.treesLatestDeferral.reject(error);\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic async fetchAndParseAsJSON<T>(\n\t\turl: string,\n\t\tfetchOptions: { [index: string]: any },\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t): Promise<IOdspResponse<T>> {\n\t\t// Optimize the flow if we know that treesLatestDeferral was already completed by the timer we started\n\t\t// joinSession call. If we did - there is no reason to repeat the call as it will fail with same error.\n\t\tconst completed = this.treesLatestDeferral.isCompleted;\n\n\t\ttry {\n\t\t\treturn await super.fetchAndParseAsJSON<T>(\n\t\t\t\turl,\n\t\t\t\tfetchOptions,\n\t\t\t\tfetchType,\n\t\t\t\taddInBody,\n\t\t\t\tfetchReason,\n\t\t\t);\n\t\t} catch (error: any) {\n\t\t\t// Only handling here treesLatest. If createFile failed, we should never try to do joinSession.\n\t\t\t// Similar, if getVersions failed, we should not do any further storage calls.\n\t\t\t// So treesLatest is the only call that can have parallel joinSession request.\n\t\t\tif (fetchType === \"treesLatest\") {\n\t\t\t\tthis.treesLatestDeferral.reject(error);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfetchType !== \"joinSession\" ||\n\t\t\t\terror.statusCode < 401 ||\n\t\t\t\terror.statusCode > 404 ||\n\t\t\t\tcompleted\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\t// It is joinSession failing with 401..404 error\n\t\t// Repeat after waiting for treeLatest succeeding (or fail if it failed).\n\t\t// No special handling after first call - if file has been deleted, then it's game over.\n\n\t\t// Ensure we have some safety here - we do not want to deadlock if we got logic somewhere wrong.\n\t\t// If we waited too long, we will log error event and proceed with call.\n\t\t// It may result in failure for user, but refreshing document would address it.\n\t\t// Thus we use rather long timeout (not to get these failures as much as possible), but not large enough\n\t\t// to unblock the process.\n\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{ eventName: \"JoinSessionSyncWait\" },\n\t\t\tasync (event) => {\n\t\t\t\tconst timeoutRes = 51; // anything will work here\n\t\t\t\tlet timer: ReturnType<typeof setTimeout>;\n\t\t\t\tconst timeoutP = new Promise<number>((resolve) => {\n\t\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\t\tresolve(timeoutRes);\n\t\t\t\t\t}, 15000);\n\t\t\t\t});\n\t\t\t\tconst res = await Promise.race([\n\t\t\t\t\ttimeoutP,\n\t\t\t\t\t// cancel timeout to unblock UTs (otherwise Node process does not exit for 15 sec)\n\t\t\t\t\tthis.treesLatestDeferral.promise.finally(() => clearTimeout(timer)),\n\t\t\t\t]);\n\t\t\t\tif (res === timeoutRes) {\n\t\t\t\t\tevent.cancel();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t);\n\t\treturn super.fetchAndParseAsJSON<T>(url, fetchOptions, fetchType, addInBody);\n\t}\n}\n\n/**\n * @alpha\n */\nexport interface ICacheAndTracker {\n\tcache: IOdspCache;\n\tepochTracker: EpochTracker;\n}\n\nexport function createOdspCacheAndTracker(\n\tpersistedCacheArg: IPersistedCache,\n\tnonpersistentCache: INonPersistentCache,\n\tfileEntry: IFileEntry,\n\tlogger: ITelemetryLoggerExt,\n\tclientIsSummarizer?: boolean,\n): ICacheAndTracker {\n\tconst epochTracker = new EpochTrackerWithRedemption(\n\t\tpersistedCacheArg,\n\t\tfileEntry,\n\t\tlogger,\n\t\tclientIsSummarizer,\n\t);\n\treturn {\n\t\tcache: {\n\t\t\t...nonpersistentCache,\n\t\t\tpersistedCache: epochTracker,\n\t\t},\n\t\tepochTracker,\n\t};\n}\n"]}
1
+ {"version":3,"file":"epochTracker.js","sourceRoot":"","sources":["../src/epochTracker.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAClC,2DAA8D;AAC9D,qEAOyC;AACzC,+DAKsC;AACtC,qFAYiD;AACjD,iDAMwB;AAExB,iDAAsF;AACtF,6DAA6D;AAC7D,2DAAkE;AAClE,6EAAoE;AAuBvD,QAAA,YAAY,GAAG,cAAc,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,MAAa,YAAY;IAQxB,YACoB,KAAsB,EACtB,SAAqB,EACrB,MAA2B,EAC3B,kBAA4B,EAC5B,UAA8B;QAJ9B,UAAK,GAAL,KAAK,CAAiB;QACtB,cAAS,GAAT,SAAS,CAAY;QACrB,WAAM,GAAN,MAAM,CAAqB;QAC3B,uBAAkB,GAAlB,kBAAkB,CAAU;QAC5B,eAAU,GAAV,UAAU,CAAoB;QARjC,aAAQ,GA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CAAC,CAAC;gBACrB,CAAC,EAAE,KAAK,CAAC,CAAC;YACX,CAAC,CAAC,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;gBAC9B,QAAQ;gBACR,kFAAkF;gBAClF,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;aACnE,CAAC,CAAC;YACH,IAAI,GAAG,KAAK,UAAU,EAAE;gBACvB,KAAK,CAAC,MAAM,EAAE,CAAC;aACf;QACF,CAAC,EACD,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAC7C,CAAC;QACF,OAAO,KAAK,CAAC,mBAAmB,CAAI,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC9E,CAAC;CACD;AA7HD,gEA6HC;AAUD,SAAgB,yBAAyB,CACxC,iBAAkC,EAClC,kBAAuC,EACvC,SAAqB,EACrB,MAA2B,EAC3B,kBAA4B,EAC5B,UAA8B;IAE9B,MAAM,YAAY,GAAG,IAAI,0BAA0B,CAClD,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,kBAAkB,EAClB,UAAU,CACV,CAAC;IACF,OAAO;QACN,KAAK,EAAE;YACN,GAAG,kBAAkB;YACrB,cAAc,EAAE,YAAY;SAC5B;QACD,YAAY;KACZ,CAAC;AACH,CAAC;AAtBD,8DAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tisFluidError,\n\tnormalizeError,\n\tloggerToMonitoringContext,\n\twrapError,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tThrottlingError,\n\tRateLimiter,\n\tNonRetryableError,\n\tLocationRedirectionError,\n} from \"@fluidframework/driver-utils\";\nimport {\n\tOdspErrorTypes,\n\tsnapshotKey,\n\tICacheEntry,\n\tIEntry,\n\tIFileEntry,\n\tIPersistedCache,\n\tIOdspError,\n\tIOdspErrorAugmentations,\n\tIOdspResolvedUrl,\n\tmaximumCacheDurationMs,\n\ttype HostStoragePolicy,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport {\n\tfetchAndParseAsJSONHelper,\n\tfetchArray,\n\tfetchHelper,\n\tgetOdspResolvedUrl,\n\tIOdspResponse,\n} from \"./odspUtils.js\";\nimport { IOdspCache, INonPersistentCache, IPersistedFileCache } from \"./odspCache.js\";\nimport { IVersionedValueWithEpoch, persistedCacheValueVersion } from \"./contracts.js\";\nimport { ClpCompliantAppHeader } from \"./contractsPublic.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { patchOdspResolvedUrl } from \"./odspLocationRedirection.js\";\n\n/**\n * @alpha\n */\nexport type FetchType =\n\t| \"blob\"\n\t| \"createBlob\"\n\t| \"createFile\"\n\t| \"joinSession\"\n\t| \"ops\"\n\t| \"test\"\n\t| \"snapshotTree\"\n\t| \"treesLatest\"\n\t| \"uploadSummary\"\n\t| \"push\"\n\t| \"versions\";\n\n/**\n * @alpha\n */\nexport type FetchTypeInternal = FetchType | \"cache\";\n\nexport const Odsp409Error = \"Odsp409Error\";\n\n/**\n * In ODSP, the concept of \"epoch\" refers to binary updates to files. For example, this might include using\n * version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch\n * value being incremented.\n *\n * The implications of these binary updates is that the Fluid state is disrupted: the sequence number might\n * go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's\n * not safe to continue collaboration across an epoch change. We need to detect these epoch changes and\n * error out from the collaboration.\n *\n * This class is a wrapper around fetch calls. It adds epoch to the request made so that the\n * server can match it with its epoch value in order to match the version.\n * It also validates the epoch value received in response of fetch calls. If the epoch does not match,\n * then it also clears all the cached entries for the given container.\n * @alpha\n */\nexport class EpochTracker implements IPersistedFileCache {\n\tprivate _fluidEpoch: string | undefined;\n\n\tprivate readonly snapshotCacheExpiryTimeoutMs: number;\n\tpublic readonly rateLimiter: RateLimiter;\n\tprivate readonly driverId = uuid();\n\t// This tracks the request number made by the driver instance.\n\tprivate networkCallNumber = 1;\n\tconstructor(\n\t\tprotected readonly cache: IPersistedCache,\n\t\tprotected readonly fileEntry: IFileEntry,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tprotected readonly clientIsSummarizer?: boolean,\n\t\tprotected readonly hostPolicy?: HostStoragePolicy,\n\t) {\n\t\t// Limits the max number of concurrent requests to 24.\n\t\tthis.rateLimiter = new RateLimiter(24);\n\n\t\t// Matches the TestOverride logic for the policy defined in odspDocumentStorageServiceBase.ts\n\t\tthis.snapshotCacheExpiryTimeoutMs = loggerToMonitoringContext(logger).config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.TestOverride.DisableSnapshotCache\",\n\t\t)\n\t\t\t? 0\n\t\t\t: maximumCacheDurationMs;\n\t}\n\n\t// public for UT purposes only!\n\tpublic setEpoch(epoch: string, fromCache: boolean, fetchType: FetchTypeInternal): void {\n\t\tassert(this._fluidEpoch === undefined, 0x1db /* \"epoch exists\" */);\n\t\tthis._fluidEpoch = epoch;\n\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"EpochLearnedFirstTime\",\n\t\t\tepoch,\n\t\t\tfetchType,\n\t\t\tfromCache,\n\t\t});\n\t}\n\n\t// TODO: return a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic async get(entry: IEntry): Promise<any> {\n\t\ttry {\n\t\t\t// Return undefined so that the ops/snapshots are grabbed from the server instead of the cache\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\tconst value: IVersionedValueWithEpoch = await this.cache.get(\n\t\t\t\tthis.fileEntryFromEntry(entry),\n\t\t\t);\n\t\t\t// Version mismatch between what the runtime expects and what it recieved.\n\t\t\t// The cached value should not be used\n\t\t\tif (value === undefined || value.version !== persistedCacheValueVersion) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tassert(value.fluidEpoch !== undefined, 0x1dc /* \"all entries have to have epoch\" */);\n\t\t\tif (this._fluidEpoch === undefined) {\n\t\t\t\tthis.setEpoch(value.fluidEpoch, true, \"cache\");\n\t\t\t\t// Epoch mismatch, the cached value is considerably different from what the current state of\n\t\t\t\t// the runtime and should not be used\n\t\t\t} else if (this._fluidEpoch !== value.fluidEpoch) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\t// Expire the cached snapshot if it's older than snapshotCacheExpiryTimeoutMs and immediately\n\t\t\t// expire all old caches that do not have cacheEntryTime\n\t\t\tif (entry.type === snapshotKey) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\t\t\tconst cacheTime = value.value?.cacheEntryTime;\n\t\t\t\tconst currentTime = Date.now();\n\t\t\t\tif (\n\t\t\t\t\tcacheTime === undefined ||\n\t\t\t\t\tcurrentTime - cacheTime >= this.snapshotCacheExpiryTimeoutMs\n\t\t\t\t) {\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"odspVersionsCacheExpired\",\n\t\t\t\t\t\tduration: currentTime - cacheTime,\n\t\t\t\t\t\tmaxCacheAgeMs: this.snapshotCacheExpiryTimeoutMs,\n\t\t\t\t\t});\n\t\t\t\t\tawait this.removeEntries();\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn value.value;\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"cacheFetchError\", type: entry.type }, error);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t// TODO: take a stronger type or `unknown`\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\tpublic async put(entry: IEntry, value: any): Promise<void> {\n\t\tassert(this._fluidEpoch !== undefined, 0x1dd /* \"no epoch\" */);\n\t\t// For snapshots, the value should have the cacheEntryTime.\n\t\t// This will be used to expire snapshots older than snapshotCacheExpiryTimeoutMs.\n\t\tif (entry.type === snapshotKey) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\t\tvalue.cacheEntryTime = value.cacheEntryTime ?? Date.now();\n\t\t}\n\t\tconst data: IVersionedValueWithEpoch = {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\tvalue,\n\t\t\tversion: persistedCacheValueVersion,\n\t\t\tfluidEpoch: this._fluidEpoch,\n\t\t};\n\t\treturn this.cache.put(this.fileEntryFromEntry(entry), data).catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"cachePutError\", type: entry.type }, error);\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tpublic async removeEntries(): Promise<void> {\n\t\ttry {\n\t\t\treturn await this.cache.removeEntries(this.fileEntry);\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"removeCacheEntries\" }, error);\n\t\t}\n\t}\n\n\tpublic get fluidEpoch(): string | undefined {\n\t\treturn this._fluidEpoch;\n\t}\n\n\tpublic async validateEpoch(epoch: string | undefined, fetchType: FetchType): Promise<void> {\n\t\tassert(epoch !== undefined, 0x584 /* response should contain epoch */);\n\t\ttry {\n\t\t\tthis.validateEpochFromResponse(epoch, fetchType);\n\t\t} catch (error) {\n\t\t\tawait this.checkForEpochError(error, epoch, fetchType);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Api to fetch the response for given request and parse it as json.\n\t * @param url - url of the request\n\t * @param fetchOptions - fetch options for request containing body, headers etc.\n\t * @param fetchType - method for which fetch is called.\n\t * @param addInBody - Pass True if caller wants to add epoch in post body.\n\t * @param fetchReason - fetch reason to add to the request.\n\t */\n\tpublic async fetchAndParseAsJSON<T>(\n\t\turl: string,\n\t\tfetchOptions: RequestInit,\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t): Promise<IOdspResponse<T>> {\n\t\treturn this.fetchCore<T>(\n\t\t\turl,\n\t\t\tfetchOptions,\n\t\t\tfetchAndParseAsJSONHelper,\n\t\t\tfetchType,\n\t\t\taddInBody,\n\t\t\tfetchReason,\n\t\t);\n\t}\n\n\t/**\n\t * Api to fetch the response for given request and parse it as json.\n\t * @param url - url of the request\n\t * @param fetchOptions - fetch options for request containing body, headers etc.\n\t * @param fetchType - method for which fetch is called.\n\t * @param addInBody - Pass True if caller wants to add epoch in post body.\n\t * @param fetchReason - fetch reason to add to the request.\n\t */\n\tpublic async fetch(\n\t\turl: string,\n\t\tfetchOptions: RequestInit,\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t): Promise<IOdspResponse<Response>> {\n\t\treturn this.fetchCore<Response>(\n\t\t\turl,\n\t\t\tfetchOptions,\n\t\t\tfetchHelper,\n\t\t\tfetchType,\n\t\t\taddInBody,\n\t\t\tfetchReason,\n\t\t);\n\t}\n\n\tprivate async fetchCore<T>(\n\t\turl: string,\n\t\tfetchOptions: RequestInit,\n\t\tfetcher: (url: string, fetchOptions: RequestInit) => Promise<IOdspResponse<T>>,\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t): Promise<IOdspResponse<T>> {\n\t\tconst clientCorrelationId = this.formatClientCorrelationId(fetchReason);\n\t\t// Add epoch in fetch request.\n\t\tthis.addEpochInRequest(fetchOptions, addInBody, clientCorrelationId);\n\t\tlet epochFromResponse: string | undefined;\n\t\treturn this.rateLimiter\n\t\t\t.schedule(async () => fetcher(url, fetchOptions))\n\t\t\t.then((response) => {\n\t\t\t\tepochFromResponse = response.headers.get(\"x-fluid-epoch\");\n\t\t\t\tthis.validateEpochFromResponse(epochFromResponse, fetchType);\n\t\t\t\tresponse.propsToLog.XRequestStatsHeader = clientCorrelationId;\n\t\t\t\treturn response;\n\t\t\t})\n\t\t\t.catch(async (error) => {\n\t\t\t\t// Get the server epoch from error in case we don't have it as if undefined we won't be able\n\t\t\t\t// to mark it as epoch error.\n\t\t\t\tif (epochFromResponse === undefined) {\n\t\t\t\t\tepochFromResponse = (error as IOdspError).serverEpoch;\n\t\t\t\t}\n\t\t\t\tawait this.checkForEpochError(error, epochFromResponse, fetchType);\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tif (isFluidError(error)) {\n\t\t\t\t\t// If the error is about location redirection, then we need to generate new resolved url with correct\n\t\t\t\t\t// location info.\n\t\t\t\t\tif (error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError) {\n\t\t\t\t\t\tconst redirectLocation = (error as IOdspErrorAugmentations)\n\t\t\t\t\t\t\t.redirectLocation;\n\t\t\t\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\t\t\t\tconst redirectUrl: IOdspResolvedUrl = patchOdspResolvedUrl(\n\t\t\t\t\t\t\t\tthis.fileEntry.resolvedUrl,\n\t\t\t\t\t\t\t\tredirectLocation,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst locationRedirectionError = new LocationRedirectionError(\n\t\t\t\t\t\t\t\terror.message,\n\t\t\t\t\t\t\t\tredirectUrl,\n\t\t\t\t\t\t\t\t{ driverVersion, redirectLocation },\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tlocationRedirectionError.addTelemetryProperties(\n\t\t\t\t\t\t\t\terror.getTelemetryProperties(),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tthrow locationRedirectionError;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// If the hostPolicy disallows retries for throttling errors, then we throw a NonRetryableError\n\t\t\t\t\telse if (\n\t\t\t\t\t\terror.errorType === OdspErrorTypes.throttlingError &&\n\t\t\t\t\t\tthis.hostPolicy?.disableRetriesOnStorageThrottlingError\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst nonRetriableThrottlingError = new NonRetryableError(\n\t\t\t\t\t\t\terror.message,\n\t\t\t\t\t\t\tOdspErrorTypes.throttlingError,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// This step ensures all the telemetry props are preserved including the retryAfterSeconds from the original error\n\t\t\t\t\t\tnonRetriableThrottlingError.addTelemetryProperties(\n\t\t\t\t\t\t\terror.getTelemetryProperties(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthrow nonRetriableThrottlingError;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthrow error;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tconst fluidError = normalizeError(error, {\n\t\t\t\t\tprops: { XRequestStatsHeader: clientCorrelationId },\n\t\t\t\t});\n\t\t\t\tthrow fluidError;\n\t\t\t});\n\t}\n\n\t/**\n\t * Api to fetch the response as it is for given request.\n\t * @param url - url of the request\n\t * @param fetchOptions - fetch options for request containing body, headers etc.\n\t * @param fetchType - method for which fetch is called.\n\t * @param addInBody - Pass True if caller wants to add epoch in post body.\n\t * @param fetchReason - fetch reason to add to the request.\n\t */\n\tpublic async fetchArray(\n\t\turl: string,\n\t\tfetchOptions: { [index: string]: RequestInit },\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t): Promise<IOdspResponse<ArrayBuffer>> {\n\t\treturn this.fetchCore<ArrayBuffer>(\n\t\t\turl,\n\t\t\tfetchOptions,\n\t\t\tfetchArray,\n\t\t\tfetchType,\n\t\t\taddInBody,\n\t\t\tfetchReason,\n\t\t);\n\t}\n\n\tprivate addEpochInRequest(\n\t\tfetchOptions: RequestInit,\n\t\taddInBody: boolean,\n\t\tclientCorrelationId: string,\n\t): void {\n\t\tconst isClpCompliantApp = getOdspResolvedUrl(this.fileEntry.resolvedUrl).isClpCompliantApp;\n\t\tif (addInBody) {\n\t\t\tconst headers: { [key: string]: string } = {};\n\t\t\theaders[\"X-RequestStats\"] = clientCorrelationId;\n\t\t\tif (this.fluidEpoch !== undefined) {\n\t\t\t\theaders[\"x-fluid-epoch\"] = this.fluidEpoch;\n\t\t\t}\n\t\t\tif (isClpCompliantApp) {\n\t\t\t\theaders[ClpCompliantAppHeader.isClpCompliantApp] = isClpCompliantApp.toString();\n\t\t\t}\n\t\t\tthis.addParamInBody(fetchOptions, headers);\n\t\t} else {\n\t\t\tconst addHeader = (key: string, val: string): void => {\n\t\t\t\tfetchOptions.headers = {\n\t\t\t\t\t...fetchOptions.headers,\n\t\t\t\t};\n\t\t\t\tassert(\n\t\t\t\t\tfetchOptions.headers !== undefined,\n\t\t\t\t\t0x282 /* \"Headers should be present now\" */,\n\t\t\t\t);\n\t\t\t\tfetchOptions.headers[key] = val;\n\t\t\t};\n\t\t\taddHeader(\"X-RequestStats\", clientCorrelationId);\n\t\t\tif (this.fluidEpoch !== undefined) {\n\t\t\t\taddHeader(\"x-fluid-epoch\", this.fluidEpoch);\n\t\t\t}\n\t\t\tif (isClpCompliantApp) {\n\t\t\t\taddHeader(ClpCompliantAppHeader.isClpCompliantApp, isClpCompliantApp.toString());\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate addParamInBody(fetchOptions: RequestInit, headers: { [key: string]: string }): void {\n\t\t// We use multi part form request for post body where we want to use this.\n\t\t// So extract the form boundary to mark the end of form.\n\t\tconst body = fetchOptions.body;\n\t\tassert(typeof body === \"string\", 0x21d /* \"body is not string\" */);\n\t\tconst splitBody = body.split(\"\\r\\n\");\n\t\tconst firstLine = splitBody.shift();\n\t\tassert(firstLine?.startsWith(\"--\") === true, 0x21e /* \"improper boundary format\" */);\n\t\tconst formParams = [firstLine];\n\t\tfor (const [key, value] of Object.entries(headers)) {\n\t\t\tformParams.push(`${key}: ${value}`);\n\t\t}\n\t\tfor (const value of splitBody) {\n\t\t\tformParams.push(value);\n\t\t}\n\t\tfetchOptions.body = formParams.join(\"\\r\\n\");\n\t}\n\n\tprivate formatClientCorrelationId(fetchReason?: string): string {\n\t\tconst items: string[] = [\n\t\t\t`driverId=${this.driverId}`,\n\t\t\t`RequestNumber=${this.networkCallNumber++}`,\n\t\t\t`driverVersion=${driverVersion}`,\n\t\t\t`isSummarizer=${this.clientIsSummarizer}`,\n\t\t];\n\t\tif (fetchReason !== undefined) {\n\t\t\titems.push(`fetchReason=${fetchReason}`);\n\t\t}\n\t\treturn items.join(\", \");\n\t}\n\n\tprotected validateEpochFromResponse(\n\t\tepochFromResponse: string | undefined,\n\t\tfetchType: FetchTypeInternal,\n\t\tfromCache: boolean = false,\n\t): void {\n\t\tconst error = this.checkForEpochErrorCore(epochFromResponse);\n\t\tif (error !== undefined) {\n\t\t\tthrow error;\n\t\t}\n\t\tif (epochFromResponse !== undefined && this._fluidEpoch === undefined) {\n\t\t\tthis.setEpoch(epochFromResponse, fromCache, fetchType);\n\t\t}\n\t}\n\n\tprivate async checkForEpochError(\n\t\terror: unknown,\n\t\tepochFromResponse: string | null | undefined,\n\t\tfetchType: FetchTypeInternal,\n\t\tfromCache: boolean = false,\n\t): Promise<void> {\n\t\tif (isFluidError(error) && error.errorType === OdspErrorTypes.fileOverwrittenInStorage) {\n\t\t\tconst epochError = this.checkForEpochErrorCore(epochFromResponse);\n\t\t\tif (epochError !== undefined) {\n\t\t\t\tepochError.addTelemetryProperties({\n\t\t\t\t\tfromCache,\n\t\t\t\t\tfetchType,\n\t\t\t\t});\n\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"fileOverwrittenInStorage\" }, epochError);\n\t\t\t\t// If the epoch mismatches, then clear all entries for such file entry from cache.\n\t\t\t\tawait this.removeEntries();\n\t\t\t\tthrow epochError;\n\t\t\t}\n\t\t\t// If it was categorized as epoch error but the epoch returned in response matches with the client epoch\n\t\t\t// then it was coherency 409, so rethrow it as throttling error so that it can retried. Default throttling\n\t\t\t// time is 1s.\n\t\t\tconst newError = wrapError(error, (message: string) => {\n\t\t\t\treturn new ThrottlingError(`Coherency 409: ${message}`, 1 /* retryAfterSeconds */, {\n\t\t\t\t\t[Odsp409Error]: true,\n\t\t\t\t\tdriverVersion,\n\t\t\t\t});\n\t\t\t});\n\t\t\tthrow newError;\n\t\t}\n\t}\n\n\tprivate checkForEpochErrorCore(\n\t\tepochFromResponse: string | null | undefined,\n\t): NonRetryableError<\"fileOverwrittenInStorage\"> | undefined {\n\t\t// If epoch is undefined, then don't compare it because initially for createNew or TreesLatest\n\t\t// initializes this value. Sometimes response does not contain epoch as it is still in\n\t\t// implementation phase at server side. In that case also, don't compare it with our epoch value.\n\t\tif (this.fluidEpoch && epochFromResponse && this.fluidEpoch !== epochFromResponse) {\n\t\t\t// This is similar in nature to how fluidEpochMismatchError (409) is handled.\n\t\t\t// Difference - client detected mismatch, instead of server detecting it.\n\t\t\treturn new NonRetryableError(\n\t\t\t\t\"Epoch mismatch\",\n\t\t\t\tOdspErrorTypes.fileOverwrittenInStorage,\n\t\t\t\t{ driverVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch },\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate fileEntryFromEntry(entry: IEntry): ICacheEntry {\n\t\treturn { ...entry, file: this.fileEntry };\n\t}\n}\n\nexport class EpochTrackerWithRedemption extends EpochTracker {\n\tprivate readonly treesLatestDeferral = new Deferred<void>();\n\n\tconstructor(\n\t\tprotected readonly cache: IPersistedCache,\n\t\tprotected readonly fileEntry: IFileEntry,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tprotected readonly clientIsSummarizer?: boolean,\n\t\tprotected readonly hostPolicy?: HostStoragePolicy,\n\t) {\n\t\tsuper(cache, fileEntry, logger, clientIsSummarizer, hostPolicy);\n\t\t// Handles the rejected promise within treesLatestDeferral.\n\t\tthis.treesLatestDeferral.promise.catch(() => {});\n\t}\n\n\tprotected validateEpochFromResponse(\n\t\tepochFromResponse: string | undefined,\n\t\tfetchType: FetchType,\n\t\tfromCache: boolean = false,\n\t): void {\n\t\tsuper.validateEpochFromResponse(epochFromResponse, fetchType, fromCache);\n\n\t\t// Any successful call means we have access to a file, i.e. any redemption that was required already happened.\n\t\t// That covers cases of \"treesLatest\" as well as \"getVersions\" or \"createFile\" - all the ways we can start\n\t\t// exploring a file.\n\t\tthis.treesLatestDeferral.resolve();\n\t}\n\n\t// TODO: return a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tpublic async get(entry: IEntry): Promise<any> {\n\t\tlet result = super.get(entry);\n\n\t\t// equivalence of what happens in fetchAndParseAsJSON()\n\t\tif (entry.type === snapshotKey) {\n\t\t\tresult = result\n\t\t\t\t.then((value) => {\n\t\t\t\t\t// If there is nothing in cache, we need to wait for network call to complete (and do redemption)\n\t\t\t\t\t// Otherwise file was redeemed in prior session, so if joinSession failed, we should not retry\n\t\t\t\t\tif (value !== undefined) {\n\t\t\t\t\t\tthis.treesLatestDeferral.resolve();\n\t\t\t\t\t}\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\t\t\treturn value;\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.treesLatestDeferral.reject(error);\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic async fetchAndParseAsJSON<T>(\n\t\turl: string,\n\t\tfetchOptions: { [index: string]: RequestInit },\n\t\tfetchType: FetchType,\n\t\taddInBody: boolean = false,\n\t\tfetchReason?: string,\n\t): Promise<IOdspResponse<T>> {\n\t\t// Optimize the flow if we know that treesLatestDeferral was already completed by the timer we started\n\t\t// joinSession call. If we did - there is no reason to repeat the call as it will fail with same error.\n\t\tconst completed = this.treesLatestDeferral.isCompleted;\n\n\t\ttry {\n\t\t\treturn await super.fetchAndParseAsJSON<T>(\n\t\t\t\turl,\n\t\t\t\tfetchOptions,\n\t\t\t\tfetchType,\n\t\t\t\taddInBody,\n\t\t\t\tfetchReason,\n\t\t\t);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t} catch (error: any) {\n\t\t\t// Only handling here treesLatest. If createFile failed, we should never try to do joinSession.\n\t\t\t// Similar, if getVersions failed, we should not do any further storage calls.\n\t\t\t// So treesLatest is the only call that can have parallel joinSession request.\n\t\t\tif (fetchType === \"treesLatest\") {\n\t\t\t\tthis.treesLatestDeferral.reject(error);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfetchType !== \"joinSession\" ||\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\terror.statusCode < 401 ||\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\terror.statusCode > 404 ||\n\t\t\t\tcompleted\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\t// It is joinSession failing with 401..404 error\n\t\t// Repeat after waiting for treeLatest succeeding (or fail if it failed).\n\t\t// No special handling after first call - if file has been deleted, then it's game over.\n\n\t\t// Ensure we have some safety here - we do not want to deadlock if we got logic somewhere wrong.\n\t\t// If we waited too long, we will log error event and proceed with call.\n\t\t// It may result in failure for user, but refreshing document would address it.\n\t\t// Thus we use rather long timeout (not to get these failures as much as possible), but not large enough\n\t\t// to unblock the process.\n\t\tawait PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{ eventName: \"JoinSessionSyncWait\" },\n\t\t\tasync (event) => {\n\t\t\t\tconst timeoutRes = 51; // anything will work here\n\t\t\t\tlet timer: ReturnType<typeof setTimeout>;\n\t\t\t\tconst timeoutP = new Promise<number>((resolve) => {\n\t\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\t\tresolve(timeoutRes);\n\t\t\t\t\t}, 15000);\n\t\t\t\t});\n\t\t\t\tconst res = await Promise.race([\n\t\t\t\t\ttimeoutP,\n\t\t\t\t\t// cancel timeout to unblock UTs (otherwise Node process does not exit for 15 sec)\n\t\t\t\t\tthis.treesLatestDeferral.promise.finally(() => clearTimeout(timer)),\n\t\t\t\t]);\n\t\t\t\tif (res === timeoutRes) {\n\t\t\t\t\tevent.cancel();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ start: true, end: true, cancel: \"generic\" },\n\t\t);\n\t\treturn super.fetchAndParseAsJSON<T>(url, fetchOptions, fetchType, addInBody);\n\t}\n}\n\n/**\n * @alpha\n */\nexport interface ICacheAndTracker {\n\tcache: IOdspCache;\n\tepochTracker: EpochTracker;\n}\n\nexport function createOdspCacheAndTracker(\n\tpersistedCacheArg: IPersistedCache,\n\tnonpersistentCache: INonPersistentCache,\n\tfileEntry: IFileEntry,\n\tlogger: ITelemetryLoggerExt,\n\tclientIsSummarizer?: boolean,\n\thostPolicy?: HostStoragePolicy,\n): ICacheAndTracker {\n\tconst epochTracker = new EpochTrackerWithRedemption(\n\t\tpersistedCacheArg,\n\t\tfileEntry,\n\t\tlogger,\n\t\tclientIsSummarizer,\n\t\thostPolicy,\n\t);\n\treturn {\n\t\tcache: {\n\t\t\t...nonpersistentCache,\n\t\t\tpersistedCache: epochTracker,\n\t\t},\n\t\tepochTracker,\n\t};\n}\n"]}
@@ -3,11 +3,11 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
6
+ import { ISnapshot } from "@fluidframework/driver-definitions";
6
7
  import { IOdspResolvedUrl, ISnapshotOptions, InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions";
7
- import { IOdspSnapshot, IVersionedValueWithEpoch } from "./contracts";
8
- import { IOdspResponse } from "./odspUtils";
9
- import { ISnapshotContents } from "./odspPublicUtils";
10
- import { EpochTracker } from "./epochTracker";
8
+ import { IOdspSnapshot, IVersionedValueWithEpoch } from "./contracts.js";
9
+ import { IOdspResponse } from "./odspUtils.js";
10
+ import { EpochTracker } from "./epochTracker.js";
11
11
  /**
12
12
  * Enum to support different types of snapshot formats.
13
13
  * @alpha
@@ -28,17 +28,17 @@ export declare enum SnapshotFormatSupportType {
28
28
  * @returns A promise of the snapshot and the status code of the response
29
29
  */
30
30
  export declare function fetchSnapshot(snapshotUrl: string, token: string | null, versionId: string, fetchFullSnapshot: boolean, forceAccessTokenViaAuthorizationHeader: boolean, logger: ITelemetryLoggerExt, snapshotDownloader: (url: string, fetchOptions: {
31
- [index: string]: any;
32
- }) => Promise<IOdspResponse<unknown>>): Promise<ISnapshotContents>;
33
- export declare function fetchSnapshotWithRedeem(odspResolvedUrl: IOdspResolvedUrl, storageTokenFetcher: InstrumentedStorageTokenFetcher, snapshotOptions: ISnapshotOptions | undefined, forceAccessTokenViaAuthorizationHeader: boolean, logger: ITelemetryLoggerExt, snapshotDownloader: (finalOdspResolvedUrl: IOdspResolvedUrl, storageToken: string, snapshotOptions: ISnapshotOptions | undefined, controller?: AbortController) => Promise<ISnapshotRequestAndResponseOptions>, putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>, removeEntries: () => Promise<void>, enableRedeemFallback?: boolean): Promise<ISnapshotContents>;
31
+ [index: string]: RequestInit;
32
+ }) => Promise<IOdspResponse<unknown>>): Promise<ISnapshot>;
33
+ export declare function fetchSnapshotWithRedeem(odspResolvedUrl: IOdspResolvedUrl, storageTokenFetcher: InstrumentedStorageTokenFetcher, snapshotOptions: ISnapshotOptions | undefined, forceAccessTokenViaAuthorizationHeader: boolean, logger: ITelemetryLoggerExt, snapshotDownloader: (finalOdspResolvedUrl: IOdspResolvedUrl, storageToken: string, loadingGroupIds: string[] | undefined, snapshotOptions: ISnapshotOptions | undefined, controller?: AbortController) => Promise<ISnapshotRequestAndResponseOptions>, putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>, removeEntries: () => Promise<void>, loadingGroupIds: string[] | undefined, enableRedeemFallback?: boolean): Promise<ISnapshot>;
34
34
  export interface ISnapshotRequestAndResponseOptions {
35
35
  odspResponse: IOdspResponse<Response>;
36
36
  requestUrl: string;
37
37
  requestHeaders: {
38
- [index: string]: any;
38
+ [index: string]: string;
39
39
  };
40
40
  }
41
- export declare function evalBlobsAndTrees(snapshot: ISnapshotContents): {
41
+ export declare function evalBlobsAndTrees(snapshot: ISnapshot): {
42
42
  trees: number;
43
43
  numBlobs: number;
44
44
  encodedBlobsSize: number;
@@ -49,11 +49,14 @@ export declare function validateBlobsAndTrees(snapshot: IOdspSnapshot): void;
49
49
  * @param odspResolvedUrl - resolved odsp url.
50
50
  * @param storageToken - token to do the auth for network request.
51
51
  * @param snapshotOptions - Options used to specify how and what to fetch in the snapshot.
52
- * @param logger - logger
52
+ * @param loadingGroupIds - loadingGroupIds for which snapshot needs to be downloaded. Note:
53
+ * 1.) If undefined, then legacy trees latest call will be used where no groupId query param would be specified.
54
+ * 2.) If [] is passed, then snapshot with all ungrouped data will be fetched.
55
+ * 3.) If any groupId is specified like ["g1"], then snapshot for g1 group will be fetched.
53
56
  * @param snapshotFormatFetchType - Snapshot format to fetch.
54
57
  * @param controller - abort controller if caller needs to abort the network call.
55
58
  * @param epochTracker - epoch tracker used to add/validate epoch in the network call.
56
59
  * @returns fetched snapshot.
57
60
  */
58
- export declare function downloadSnapshot(odspResolvedUrl: IOdspResolvedUrl, storageToken: string, logger: ITelemetryLoggerExt, snapshotOptions: ISnapshotOptions | undefined, snapshotFormatFetchType?: SnapshotFormatSupportType, controller?: AbortController, epochTracker?: EpochTracker, scenarioName?: string): Promise<ISnapshotRequestAndResponseOptions>;
61
+ export declare function downloadSnapshot(odspResolvedUrl: IOdspResolvedUrl, storageToken: string, loadingGroupIds: string[] | undefined, snapshotOptions: ISnapshotOptions | undefined, snapshotFormatFetchType?: SnapshotFormatSupportType, controller?: AbortController, epochTracker?: EpochTracker, scenarioName?: string): Promise<ISnapshotRequestAndResponseOptions>;
59
62
  //# sourceMappingURL=fetchSnapshot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchSnapshot.d.ts","sourceRoot":"","s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