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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (661) hide show
  1. package/.eslintrc.js +12 -12
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +162 -0
  4. package/README.md +56 -0
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/odsp-driver.api.md +310 -0
  8. package/dist/{ReadBufferUtils.js → ReadBufferUtils.cjs} +16 -9
  9. package/dist/ReadBufferUtils.cjs.map +1 -0
  10. package/dist/ReadBufferUtils.d.ts.map +1 -1
  11. package/dist/{WriteBufferUtils.js → WriteBufferUtils.cjs} +73 -69
  12. package/dist/WriteBufferUtils.cjs.map +1 -0
  13. package/dist/WriteBufferUtils.d.ts +3 -5
  14. package/dist/WriteBufferUtils.d.ts.map +1 -1
  15. package/dist/{checkUrl.js → checkUrl.cjs} +7 -6
  16. package/dist/checkUrl.cjs.map +1 -0
  17. package/dist/checkUrl.d.ts +1 -0
  18. package/dist/checkUrl.d.ts.map +1 -1
  19. package/dist/compactSnapshotParser.cjs +207 -0
  20. package/dist/compactSnapshotParser.cjs.map +1 -0
  21. package/dist/compactSnapshotParser.d.ts +12 -3
  22. package/dist/compactSnapshotParser.d.ts.map +1 -1
  23. package/dist/{compactSnapshotWriter.js → compactSnapshotWriter.cjs} +43 -33
  24. package/dist/compactSnapshotWriter.cjs.map +1 -0
  25. package/dist/compactSnapshotWriter.d.ts +2 -3
  26. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  27. package/dist/{constants.js → constants.cjs} +7 -1
  28. package/dist/constants.cjs.map +1 -0
  29. package/dist/constants.d.ts +6 -0
  30. package/dist/constants.d.ts.map +1 -1
  31. package/dist/{contracts.js → contracts.cjs} +1 -1
  32. package/dist/contracts.cjs.map +1 -0
  33. package/dist/contracts.d.ts +16 -53
  34. package/dist/contracts.d.ts.map +1 -1
  35. package/dist/{contractsPublic.js → contractsPublic.cjs} +9 -3
  36. package/dist/contractsPublic.cjs.map +1 -0
  37. package/dist/contractsPublic.d.ts +15 -0
  38. package/dist/contractsPublic.d.ts.map +1 -1
  39. package/dist/createFile.cjs +177 -0
  40. package/dist/createFile.cjs.map +1 -0
  41. package/dist/createFile.d.ts +6 -10
  42. package/dist/createFile.d.ts.map +1 -1
  43. package/dist/createNewContainerOnExistingFile.cjs +60 -0
  44. package/dist/createNewContainerOnExistingFile.cjs.map +1 -0
  45. package/dist/createNewContainerOnExistingFile.d.ts +22 -0
  46. package/dist/createNewContainerOnExistingFile.d.ts.map +1 -0
  47. package/dist/createNewModule.cjs +12 -0
  48. package/dist/createNewModule.cjs.map +1 -0
  49. package/dist/createNewModule.d.ts +7 -0
  50. package/dist/createNewModule.d.ts.map +1 -0
  51. package/dist/createNewUtils.cjs +203 -0
  52. package/dist/createNewUtils.cjs.map +1 -0
  53. package/dist/createNewUtils.d.ts +16 -0
  54. package/dist/createNewUtils.d.ts.map +1 -1
  55. package/dist/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.cjs} +8 -4
  56. package/dist/createOdspCreateContainerRequest.cjs.map +1 -0
  57. package/dist/createOdspCreateContainerRequest.d.ts +5 -3
  58. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  59. package/dist/{createOdspUrl.js → createOdspUrl.cjs} +2 -1
  60. package/dist/createOdspUrl.cjs.map +1 -0
  61. package/dist/createOdspUrl.d.ts +1 -0
  62. package/dist/createOdspUrl.d.ts.map +1 -1
  63. package/dist/{epochTracker.js → epochTracker.cjs} +102 -48
  64. package/dist/epochTracker.cjs.map +1 -0
  65. package/dist/epochTracker.d.ts +32 -8
  66. package/dist/epochTracker.d.ts.map +1 -1
  67. package/dist/{fetch.js → fetch.cjs} +1 -1
  68. package/dist/fetch.cjs.map +1 -0
  69. package/dist/fetch.d.ts +1 -1
  70. package/dist/fetch.d.ts.map +1 -1
  71. package/dist/{fetchSnapshot.js → fetchSnapshot.cjs} +192 -176
  72. package/dist/fetchSnapshot.cjs.map +1 -0
  73. package/dist/fetchSnapshot.d.ts +10 -5
  74. package/dist/fetchSnapshot.d.ts.map +1 -1
  75. package/dist/{getFileLink.js → getFileLink.cjs} +52 -41
  76. package/dist/getFileLink.cjs.map +1 -0
  77. package/dist/getFileLink.d.ts +4 -7
  78. package/dist/getFileLink.d.ts.map +1 -1
  79. package/dist/{getQueryString.js → getQueryString.cjs} +1 -1
  80. package/dist/getQueryString.cjs.map +1 -0
  81. package/dist/getQueryString.d.ts.map +1 -1
  82. package/dist/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.cjs} +4 -2
  83. package/dist/getUrlAndHeadersWithAuth.cjs.map +1 -0
  84. package/dist/getUrlAndHeadersWithAuth.d.ts.map +1 -1
  85. package/dist/index.cjs +59 -0
  86. package/dist/index.cjs.map +1 -0
  87. package/dist/index.d.ts +19 -16
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs +35 -0
  90. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +1 -0
  91. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +17 -0
  92. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
  93. package/dist/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.cjs} +7 -5
  94. package/dist/localOdspDriver/localOdspDocumentService.cjs.map +1 -0
  95. package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
  96. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  97. package/dist/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.cjs} +9 -10
  98. package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +1 -0
  99. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +2 -3
  100. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  101. package/dist/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.cjs} +13 -11
  102. package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +1 -0
  103. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -2
  104. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  105. package/dist/odsp-driver-alpha.d.ts +497 -0
  106. package/dist/odsp-driver-beta.d.ts +159 -0
  107. package/dist/odsp-driver-public.d.ts +159 -0
  108. package/dist/odsp-driver-untrimmed.d.ts +566 -0
  109. package/dist/{odspCache.js → odspCache.cjs} +9 -10
  110. package/dist/odspCache.cjs.map +1 -0
  111. package/dist/odspCache.d.ts +19 -4
  112. package/dist/odspCache.d.ts.map +1 -1
  113. package/dist/odspDelayLoadedDeltaStream.cjs +291 -0
  114. package/dist/odspDelayLoadedDeltaStream.cjs.map +1 -0
  115. package/dist/odspDelayLoadedDeltaStream.d.ts +75 -0
  116. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -0
  117. package/dist/{odspDeltaStorageService.js → odspDeltaStorageService.cjs} +70 -71
  118. package/dist/odspDeltaStorageService.cjs.map +1 -0
  119. package/dist/odspDeltaStorageService.d.ts +8 -6
  120. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  121. package/dist/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.cjs} +224 -113
  122. package/dist/odspDocumentDeltaConnection.cjs.map +1 -0
  123. package/dist/odspDocumentDeltaConnection.d.ts +32 -12
  124. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  125. package/dist/odspDocumentService.cjs +225 -0
  126. package/dist/odspDocumentService.cjs.map +1 -0
  127. package/dist/odspDocumentService.d.ts +11 -25
  128. package/dist/odspDocumentService.d.ts.map +1 -1
  129. package/dist/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.cjs} +8 -5
  130. package/dist/odspDocumentServiceFactory.cjs.map +1 -0
  131. package/dist/odspDocumentServiceFactory.d.ts +4 -0
  132. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  133. package/dist/odspDocumentServiceFactoryCore.cjs +196 -0
  134. package/dist/odspDocumentServiceFactoryCore.cjs.map +1 -0
  135. package/dist/odspDocumentServiceFactoryCore.d.ts +16 -11
  136. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  137. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs +20 -0
  138. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +1 -0
  139. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +5 -0
  140. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
  141. package/dist/odspDocumentStorageManager.cjs +490 -0
  142. package/dist/odspDocumentStorageManager.cjs.map +1 -0
  143. package/dist/odspDocumentStorageManager.d.ts +11 -5
  144. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  145. package/dist/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.cjs} +32 -34
  146. package/dist/odspDocumentStorageServiceBase.cjs.map +1 -0
  147. package/dist/odspDocumentStorageServiceBase.d.ts +7 -9
  148. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  149. package/dist/{odspDriverUrlResolver.js → odspDriverUrlResolver.cjs} +50 -36
  150. package/dist/odspDriverUrlResolver.cjs.map +1 -0
  151. package/dist/odspDriverUrlResolver.d.ts +12 -0
  152. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  153. package/dist/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.cjs} +37 -26
  154. package/dist/odspDriverUrlResolverForShareLink.cjs.map +1 -0
  155. package/dist/odspDriverUrlResolverForShareLink.d.ts +5 -3
  156. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  157. package/dist/{odspError.js → odspError.cjs} +7 -3
  158. package/dist/odspError.cjs.map +1 -0
  159. package/dist/odspError.d.ts.map +1 -1
  160. package/dist/{odspFluidFileLink.js → odspFluidFileLink.cjs} +25 -18
  161. package/dist/odspFluidFileLink.cjs.map +1 -0
  162. package/dist/odspFluidFileLink.d.ts +10 -1
  163. package/dist/odspFluidFileLink.d.ts.map +1 -1
  164. package/dist/odspLocationRedirection.cjs +24 -0
  165. package/dist/odspLocationRedirection.cjs.map +1 -0
  166. package/dist/odspLocationRedirection.d.ts +14 -0
  167. package/dist/odspLocationRedirection.d.ts.map +1 -0
  168. package/dist/{odspPublicUtils.js → odspPublicUtils.cjs} +7 -4
  169. package/dist/odspPublicUtils.cjs.map +1 -0
  170. package/dist/odspPublicUtils.d.ts +6 -0
  171. package/dist/odspPublicUtils.d.ts.map +1 -1
  172. package/dist/{odspSnapshotParser.js → odspSnapshotParser.cjs} +11 -12
  173. package/dist/odspSnapshotParser.cjs.map +1 -0
  174. package/dist/odspSnapshotParser.d.ts.map +1 -1
  175. package/dist/{odspSummaryUploadManager.js → odspSummaryUploadManager.cjs} +47 -34
  176. package/dist/odspSummaryUploadManager.cjs.map +1 -0
  177. package/dist/odspSummaryUploadManager.d.ts +7 -4
  178. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  179. package/dist/{odspUrlHelper.js → odspUrlHelper.cjs} +9 -3
  180. package/dist/odspUrlHelper.cjs.map +1 -0
  181. package/dist/odspUrlHelper.d.ts +5 -0
  182. package/dist/odspUrlHelper.d.ts.map +1 -1
  183. package/dist/{odspUtils.js → odspUtils.cjs} +118 -30
  184. package/dist/odspUtils.cjs.map +1 -0
  185. package/dist/odspUtils.d.ts +35 -6
  186. package/dist/odspUtils.d.ts.map +1 -1
  187. package/dist/{opsCaching.js → opsCaching.cjs} +25 -9
  188. package/dist/opsCaching.cjs.map +1 -0
  189. package/dist/opsCaching.d.ts +3 -3
  190. package/dist/opsCaching.d.ts.map +1 -1
  191. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  192. package/dist/packageVersion.cjs.map +1 -0
  193. package/dist/packageVersion.d.ts +1 -1
  194. package/dist/packageVersion.d.ts.map +1 -1
  195. package/dist/prefetchLatestSnapshot.cjs +100 -0
  196. package/dist/prefetchLatestSnapshot.cjs.map +1 -0
  197. package/dist/prefetchLatestSnapshot.d.ts +12 -7
  198. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  199. package/dist/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.cjs} +13 -6
  200. package/dist/retryErrorsStorageAdapter.cjs.map +1 -0
  201. package/dist/retryErrorsStorageAdapter.d.ts +5 -4
  202. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  203. package/dist/{retryUtils.js → retryUtils.cjs} +30 -14
  204. package/dist/retryUtils.cjs.map +1 -0
  205. package/dist/retryUtils.d.ts +2 -2
  206. package/dist/retryUtils.d.ts.map +1 -1
  207. package/dist/socketModule.cjs +10 -0
  208. package/dist/socketModule.cjs.map +1 -0
  209. package/dist/socketModule.d.ts +7 -0
  210. package/dist/socketModule.d.ts.map +1 -0
  211. package/dist/tsdoc-metadata.json +11 -0
  212. package/dist/{vroom.js → vroom.cjs} +24 -9
  213. package/dist/vroom.cjs.map +1 -0
  214. package/dist/vroom.d.ts +4 -4
  215. package/dist/vroom.d.ts.map +1 -1
  216. package/dist/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.cjs} +227 -118
  217. package/dist/zipItDataRepresentationUtils.cjs.map +1 -0
  218. package/dist/zipItDataRepresentationUtils.d.ts +47 -20
  219. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  220. package/lib/ReadBufferUtils.d.mts.map +1 -0
  221. package/lib/{ReadBufferUtils.js → ReadBufferUtils.mjs} +14 -7
  222. package/lib/ReadBufferUtils.mjs.map +1 -0
  223. package/lib/{WriteBufferUtils.d.ts → WriteBufferUtils.d.mts} +3 -5
  224. package/lib/WriteBufferUtils.d.mts.map +1 -0
  225. package/lib/{WriteBufferUtils.js → WriteBufferUtils.mjs} +68 -64
  226. package/lib/WriteBufferUtils.mjs.map +1 -0
  227. package/lib/{checkUrl.d.ts → checkUrl.d.mts} +1 -0
  228. package/lib/checkUrl.d.mts.map +1 -0
  229. package/lib/{checkUrl.js → checkUrl.mjs} +7 -6
  230. package/lib/checkUrl.mjs.map +1 -0
  231. package/lib/compactSnapshotParser.d.mts +24 -0
  232. package/lib/compactSnapshotParser.d.mts.map +1 -0
  233. package/lib/compactSnapshotParser.mjs +203 -0
  234. package/lib/compactSnapshotParser.mjs.map +1 -0
  235. package/lib/{compactSnapshotWriter.d.ts → compactSnapshotWriter.d.mts} +3 -4
  236. package/lib/compactSnapshotWriter.d.mts.map +1 -0
  237. package/lib/{compactSnapshotWriter.js → compactSnapshotWriter.mjs} +41 -31
  238. package/lib/compactSnapshotWriter.mjs.map +1 -0
  239. package/lib/{constants.d.ts → constants.d.mts} +6 -0
  240. package/lib/constants.d.mts.map +1 -0
  241. package/lib/{constants.js → constants.mjs} +7 -1
  242. package/lib/constants.mjs.map +1 -0
  243. package/lib/{contracts.d.ts → contracts.d.mts} +17 -54
  244. package/lib/contracts.d.mts.map +1 -0
  245. package/lib/{contracts.js → contracts.mjs} +1 -1
  246. package/lib/contracts.mjs.map +1 -0
  247. package/lib/{contractsPublic.d.ts → contractsPublic.d.mts} +15 -0
  248. package/lib/contractsPublic.d.mts.map +1 -0
  249. package/lib/{contractsPublic.js → contractsPublic.mjs} +7 -1
  250. package/lib/contractsPublic.mjs.map +1 -0
  251. package/lib/createFile.d.mts +18 -0
  252. package/lib/createFile.d.mts.map +1 -0
  253. package/lib/createFile.mjs +171 -0
  254. package/lib/createFile.mjs.map +1 -0
  255. package/lib/createNewContainerOnExistingFile.d.mts +22 -0
  256. package/lib/createNewContainerOnExistingFile.d.mts.map +1 -0
  257. package/lib/createNewContainerOnExistingFile.mjs +56 -0
  258. package/lib/createNewContainerOnExistingFile.mjs.map +1 -0
  259. package/lib/createNewModule.d.mts +7 -0
  260. package/lib/createNewModule.d.mts.map +1 -0
  261. package/lib/createNewModule.mjs +7 -0
  262. package/lib/createNewModule.mjs.map +1 -0
  263. package/lib/createNewUtils.d.mts +27 -0
  264. package/lib/createNewUtils.d.mts.map +1 -0
  265. package/lib/createNewUtils.mjs +197 -0
  266. package/lib/createNewUtils.mjs.map +1 -0
  267. package/lib/{createOdspCreateContainerRequest.d.ts → createOdspCreateContainerRequest.d.mts} +5 -7
  268. package/lib/createOdspCreateContainerRequest.d.mts.map +1 -0
  269. package/lib/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.mjs} +8 -4
  270. package/lib/createOdspCreateContainerRequest.mjs.map +1 -0
  271. package/lib/{createOdspUrl.d.ts → createOdspUrl.d.mts} +2 -1
  272. package/lib/{createOdspUrl.d.ts.map → createOdspUrl.d.mts.map} +1 -1
  273. package/lib/{createOdspUrl.js → createOdspUrl.mjs} +2 -1
  274. package/lib/createOdspUrl.mjs.map +1 -0
  275. package/lib/{epochTracker.d.ts → epochTracker.d.mts} +34 -10
  276. package/lib/epochTracker.d.mts.map +1 -0
  277. package/lib/{epochTracker.js → epochTracker.mjs} +97 -43
  278. package/lib/epochTracker.mjs.map +1 -0
  279. package/lib/{fetch.d.ts → fetch.d.mts} +1 -1
  280. package/lib/{fetch.d.ts.map → fetch.d.mts.map} +1 -1
  281. package/lib/{fetch.js → fetch.mjs} +1 -1
  282. package/lib/fetch.mjs.map +1 -0
  283. package/lib/{fetchSnapshot.d.ts → fetchSnapshot.d.mts} +14 -9
  284. package/lib/fetchSnapshot.d.mts.map +1 -0
  285. package/lib/{fetchSnapshot.js → fetchSnapshot.mjs} +185 -167
  286. package/lib/fetchSnapshot.mjs.map +1 -0
  287. package/lib/{getFileLink.d.ts → getFileLink.d.mts} +4 -7
  288. package/lib/getFileLink.d.mts.map +1 -0
  289. package/lib/{getFileLink.js → getFileLink.mjs} +49 -38
  290. package/lib/getFileLink.mjs.map +1 -0
  291. package/lib/{getQueryString.d.ts → getQueryString.d.mts} +0 -4
  292. package/lib/getQueryString.d.mts.map +1 -0
  293. package/lib/{getQueryString.js → getQueryString.mjs} +1 -1
  294. package/lib/getQueryString.mjs.map +1 -0
  295. package/lib/{getUrlAndHeadersWithAuth.d.ts.map → getUrlAndHeadersWithAuth.d.mts.map} +1 -1
  296. package/lib/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.mjs} +4 -2
  297. package/lib/getUrlAndHeadersWithAuth.mjs.map +1 -0
  298. package/lib/index.d.mts +24 -0
  299. package/lib/index.d.mts.map +1 -0
  300. package/lib/index.mjs +22 -0
  301. package/lib/index.mjs.map +1 -0
  302. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts +17 -0
  303. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +1 -0
  304. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs +31 -0
  305. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +1 -0
  306. package/lib/localOdspDriver/{localOdspDocumentService.d.ts → localOdspDocumentService.d.mts} +3 -2
  307. package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -0
  308. package/lib/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.mjs} +8 -6
  309. package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -0
  310. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.ts → localOdspDocumentServiceFactory.d.mts} +4 -5
  311. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +1 -0
  312. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.mjs} +9 -10
  313. package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +1 -0
  314. package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.ts → localOdspDocumentStorageManager.d.mts} +3 -3
  315. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -0
  316. package/lib/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.mjs} +11 -9
  317. package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -0
  318. package/lib/odsp-driver-alpha.d.mts +497 -0
  319. package/lib/odsp-driver-beta.d.mts +159 -0
  320. package/lib/odsp-driver-public.d.mts +159 -0
  321. package/lib/odsp-driver-untrimmed.d.mts +566 -0
  322. package/lib/{odspCache.d.ts → odspCache.d.mts} +19 -8
  323. package/lib/odspCache.d.mts.map +1 -0
  324. package/lib/{odspCache.js → odspCache.mjs} +6 -11
  325. package/lib/odspCache.mjs.map +1 -0
  326. package/lib/odspDelayLoadedDeltaStream.d.mts +75 -0
  327. package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -0
  328. package/lib/odspDelayLoadedDeltaStream.mjs +287 -0
  329. package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -0
  330. package/lib/{odspDeltaStorageService.d.ts → odspDeltaStorageService.d.mts} +9 -7
  331. package/lib/odspDeltaStorageService.d.mts.map +1 -0
  332. package/lib/{odspDeltaStorageService.js → odspDeltaStorageService.mjs} +70 -68
  333. package/lib/odspDeltaStorageService.mjs.map +1 -0
  334. package/lib/{odspDocumentDeltaConnection.d.ts → odspDocumentDeltaConnection.d.mts} +33 -13
  335. package/lib/odspDocumentDeltaConnection.d.mts.map +1 -0
  336. package/lib/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.mjs} +214 -103
  337. package/lib/odspDocumentDeltaConnection.mjs.map +1 -0
  338. package/lib/{odspDocumentService.d.ts → odspDocumentService.d.mts} +14 -28
  339. package/lib/odspDocumentService.d.mts.map +1 -0
  340. package/lib/odspDocumentService.mjs +221 -0
  341. package/lib/odspDocumentService.mjs.map +1 -0
  342. package/lib/{odspDocumentServiceFactory.d.ts → odspDocumentServiceFactory.d.mts} +5 -1
  343. package/lib/odspDocumentServiceFactory.d.mts.map +1 -0
  344. package/lib/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.mjs} +8 -6
  345. package/lib/odspDocumentServiceFactory.mjs.map +1 -0
  346. package/lib/{odspDocumentServiceFactoryCore.d.ts → odspDocumentServiceFactoryCore.d.mts} +17 -12
  347. package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -0
  348. package/lib/odspDocumentServiceFactoryCore.mjs +192 -0
  349. package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -0
  350. package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.ts → odspDocumentServiceFactoryWithCodeSplit.d.mts} +6 -1
  351. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +1 -0
  352. package/lib/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.mjs} +8 -3
  353. package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +1 -0
  354. package/lib/{odspDocumentStorageManager.d.ts → odspDocumentStorageManager.d.mts} +17 -11
  355. package/lib/odspDocumentStorageManager.d.mts.map +1 -0
  356. package/lib/odspDocumentStorageManager.mjs +486 -0
  357. package/lib/odspDocumentStorageManager.mjs.map +1 -0
  358. package/lib/{odspDocumentStorageServiceBase.d.ts → odspDocumentStorageServiceBase.d.mts} +8 -10
  359. package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -0
  360. package/lib/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.mjs} +31 -33
  361. package/lib/odspDocumentStorageServiceBase.mjs.map +1 -0
  362. package/lib/{odspDriverUrlResolver.d.ts → odspDriverUrlResolver.d.mts} +12 -0
  363. package/lib/odspDriverUrlResolver.d.mts.map +1 -0
  364. package/lib/{odspDriverUrlResolver.js → odspDriverUrlResolver.mjs} +50 -40
  365. package/lib/odspDriverUrlResolver.mjs.map +1 -0
  366. package/lib/{odspDriverUrlResolverForShareLink.d.ts → odspDriverUrlResolverForShareLink.d.mts} +6 -4
  367. package/lib/odspDriverUrlResolverForShareLink.d.mts.map +1 -0
  368. package/lib/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.mjs} +36 -29
  369. package/lib/odspDriverUrlResolverForShareLink.mjs.map +1 -0
  370. package/lib/{odspError.d.ts → odspError.d.mts} +1 -1
  371. package/lib/odspError.d.mts.map +1 -0
  372. package/lib/{odspError.js → odspError.mjs} +7 -3
  373. package/lib/odspError.mjs.map +1 -0
  374. package/lib/{odspFluidFileLink.d.ts → odspFluidFileLink.d.mts} +11 -2
  375. package/lib/odspFluidFileLink.d.mts.map +1 -0
  376. package/lib/{odspFluidFileLink.js → odspFluidFileLink.mjs} +23 -16
  377. package/lib/odspFluidFileLink.mjs.map +1 -0
  378. package/lib/odspLocationRedirection.d.mts +14 -0
  379. package/lib/odspLocationRedirection.d.mts.map +1 -0
  380. package/lib/odspLocationRedirection.mjs +20 -0
  381. package/lib/odspLocationRedirection.mjs.map +1 -0
  382. package/lib/{odspPublicUtils.d.ts → odspPublicUtils.d.mts} +6 -0
  383. package/lib/odspPublicUtils.d.mts.map +1 -0
  384. package/lib/{odspPublicUtils.js → odspPublicUtils.mjs} +5 -2
  385. package/lib/odspPublicUtils.mjs.map +1 -0
  386. package/lib/{odspSnapshotParser.d.ts → odspSnapshotParser.d.mts} +2 -2
  387. package/lib/odspSnapshotParser.d.mts.map +1 -0
  388. package/lib/{odspSnapshotParser.js → odspSnapshotParser.mjs} +10 -11
  389. package/lib/odspSnapshotParser.mjs.map +1 -0
  390. package/lib/{odspSummaryUploadManager.d.ts → odspSummaryUploadManager.d.mts} +8 -5
  391. package/lib/odspSummaryUploadManager.d.mts.map +1 -0
  392. package/lib/{odspSummaryUploadManager.js → odspSummaryUploadManager.mjs} +41 -32
  393. package/lib/odspSummaryUploadManager.mjs.map +1 -0
  394. package/lib/{odspUrlHelper.d.ts → odspUrlHelper.d.mts} +5 -0
  395. package/lib/odspUrlHelper.d.mts.map +1 -0
  396. package/lib/{odspUrlHelper.js → odspUrlHelper.mjs} +9 -3
  397. package/lib/odspUrlHelper.mjs.map +1 -0
  398. package/lib/{odspUtils.d.ts → odspUtils.d.mts} +36 -7
  399. package/lib/odspUtils.d.mts.map +1 -0
  400. package/lib/{odspUtils.js → odspUtils.mjs} +109 -27
  401. package/lib/odspUtils.mjs.map +1 -0
  402. package/lib/{opsCaching.d.ts → opsCaching.d.mts} +3 -3
  403. package/lib/opsCaching.d.mts.map +1 -0
  404. package/lib/{opsCaching.js → opsCaching.mjs} +23 -7
  405. package/lib/opsCaching.mjs.map +1 -0
  406. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
  407. package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
  408. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  409. package/lib/packageVersion.mjs.map +1 -0
  410. package/lib/{prefetchLatestSnapshot.d.ts → prefetchLatestSnapshot.d.mts} +13 -8
  411. package/lib/prefetchLatestSnapshot.d.mts.map +1 -0
  412. package/lib/prefetchLatestSnapshot.mjs +96 -0
  413. package/lib/prefetchLatestSnapshot.mjs.map +1 -0
  414. package/lib/{retryErrorsStorageAdapter.d.ts → retryErrorsStorageAdapter.d.mts} +5 -4
  415. package/lib/retryErrorsStorageAdapter.d.mts.map +1 -0
  416. package/lib/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.mjs} +13 -6
  417. package/lib/retryErrorsStorageAdapter.mjs.map +1 -0
  418. package/lib/{retryUtils.d.ts → retryUtils.d.mts} +2 -2
  419. package/lib/retryUtils.d.mts.map +1 -0
  420. package/lib/{retryUtils.js → retryUtils.mjs} +27 -11
  421. package/lib/retryUtils.mjs.map +1 -0
  422. package/lib/socketModule.d.mts +7 -0
  423. package/lib/socketModule.d.mts.map +1 -0
  424. package/lib/socketModule.mjs +7 -0
  425. package/lib/socketModule.mjs.map +1 -0
  426. package/lib/{vroom.d.ts → vroom.d.mts} +6 -6
  427. package/lib/vroom.d.mts.map +1 -0
  428. package/lib/{vroom.js → vroom.mjs} +24 -9
  429. package/lib/vroom.mjs.map +1 -0
  430. package/lib/{zipItDataRepresentationUtils.d.ts → zipItDataRepresentationUtils.d.mts} +48 -21
  431. package/lib/zipItDataRepresentationUtils.d.mts.map +1 -0
  432. package/lib/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.mjs} +213 -111
  433. package/lib/zipItDataRepresentationUtils.mjs.map +1 -0
  434. package/package.json +89 -69
  435. package/prettier.config.cjs +8 -0
  436. package/src/ReadBufferUtils.ts +51 -44
  437. package/src/WriteBufferUtils.ts +203 -181
  438. package/src/checkUrl.ts +16 -15
  439. package/src/compactSnapshotParser.ts +219 -103
  440. package/src/compactSnapshotWriter.ts +118 -97
  441. package/src/constants.ts +7 -0
  442. package/src/contracts.ts +96 -136
  443. package/src/contractsPublic.ts +31 -16
  444. package/src/createFile.ts +243 -305
  445. package/src/createNewContainerOnExistingFile.ts +93 -0
  446. package/src/createNewModule.ts +7 -0
  447. package/src/createNewUtils.ts +266 -56
  448. package/src/createOdspCreateContainerRequest.ts +22 -18
  449. package/src/createOdspUrl.ts +12 -13
  450. package/src/epochTracker.ts +596 -457
  451. package/src/fetch.ts +4 -4
  452. package/src/fetchSnapshot.ts +583 -508
  453. package/src/getFileLink.ts +194 -155
  454. package/src/getQueryString.ts +11 -9
  455. package/src/getUrlAndHeadersWithAuth.ts +34 -33
  456. package/src/index.ts +42 -18
  457. package/src/localOdspDriver/localOdspDeltaStorageService.ts +49 -0
  458. package/src/localOdspDriver/localOdspDocumentService.ts +40 -38
  459. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +46 -43
  460. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +55 -50
  461. package/src/odspCache.ts +112 -90
  462. package/src/odspDelayLoadedDeltaStream.ts +459 -0
  463. package/src/odspDeltaStorageService.ts +232 -221
  464. package/src/odspDocumentDeltaConnection.ts +751 -563
  465. package/src/odspDocumentService.ts +324 -523
  466. package/src/odspDocumentServiceFactory.ts +20 -21
  467. package/src/odspDocumentServiceFactoryCore.ts +325 -202
  468. package/src/odspDocumentServiceFactoryWithCodeSplit.ts +20 -20
  469. package/src/odspDocumentStorageManager.ts +730 -534
  470. package/src/odspDocumentStorageServiceBase.ts +279 -254
  471. package/src/odspDriverUrlResolver.ts +230 -188
  472. package/src/odspDriverUrlResolverForShareLink.ts +223 -203
  473. package/src/odspError.ts +27 -19
  474. package/src/odspFluidFileLink.ts +106 -87
  475. package/src/odspLocationRedirection.ts +26 -0
  476. package/src/odspPublicUtils.ts +20 -14
  477. package/src/odspSnapshotParser.ts +53 -46
  478. package/src/odspSummaryUploadManager.ts +243 -218
  479. package/src/odspUrlHelper.ts +81 -71
  480. package/src/odspUtils.ts +401 -259
  481. package/src/opsCaching.ts +214 -193
  482. package/src/packageVersion.ts +1 -1
  483. package/src/prefetchLatestSnapshot.ts +142 -80
  484. package/src/retryErrorsStorageAdapter.ts +92 -77
  485. package/src/retryUtils.ts +80 -57
  486. package/src/socketModule.ts +8 -0
  487. package/src/vroom.ts +92 -83
  488. package/src/zipItDataRepresentationUtils.ts +534 -394
  489. package/tsc-multi.test.json +4 -0
  490. package/tsconfig.json +11 -13
  491. package/.editorconfig +0 -7
  492. package/dist/ReadBufferUtils.js.map +0 -1
  493. package/dist/WriteBufferUtils.js.map +0 -1
  494. package/dist/checkUrl.js.map +0 -1
  495. package/dist/compactSnapshotParser.js +0 -115
  496. package/dist/compactSnapshotParser.js.map +0 -1
  497. package/dist/compactSnapshotWriter.js.map +0 -1
  498. package/dist/constants.js.map +0 -1
  499. package/dist/contracts.js.map +0 -1
  500. package/dist/contractsPublic.js.map +0 -1
  501. package/dist/createFile.js +0 -242
  502. package/dist/createFile.js.map +0 -1
  503. package/dist/createNewUtils.js +0 -67
  504. package/dist/createNewUtils.js.map +0 -1
  505. package/dist/createOdspCreateContainerRequest.js.map +0 -1
  506. package/dist/createOdspUrl.js.map +0 -1
  507. package/dist/epochTracker.js.map +0 -1
  508. package/dist/fetch.js.map +0 -1
  509. package/dist/fetchSnapshot.js.map +0 -1
  510. package/dist/getFileLink.js.map +0 -1
  511. package/dist/getQueryString.js.map +0 -1
  512. package/dist/getSocketIo.d.ts +0 -11
  513. package/dist/getSocketIo.d.ts.map +0 -1
  514. package/dist/getSocketIo.js +0 -20
  515. package/dist/getSocketIo.js.map +0 -1
  516. package/dist/getUrlAndHeadersWithAuth.js.map +0 -1
  517. package/dist/index.js +0 -41
  518. package/dist/index.js.map +0 -1
  519. package/dist/localOdspDriver/localOdspDocumentService.js.map +0 -1
  520. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  521. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  522. package/dist/odspCache.js.map +0 -1
  523. package/dist/odspDeltaStorageService.js.map +0 -1
  524. package/dist/odspDocumentDeltaConnection.js.map +0 -1
  525. package/dist/odspDocumentService.js +0 -364
  526. package/dist/odspDocumentService.js.map +0 -1
  527. package/dist/odspDocumentServiceFactory.js.map +0 -1
  528. package/dist/odspDocumentServiceFactoryCore.js +0 -118
  529. package/dist/odspDocumentServiceFactoryCore.js.map +0 -1
  530. package/dist/odspDocumentServiceFactoryWithCodeSplit.js +0 -34
  531. package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  532. package/dist/odspDocumentStorageManager.js +0 -356
  533. package/dist/odspDocumentStorageManager.js.map +0 -1
  534. package/dist/odspDocumentStorageServiceBase.js.map +0 -1
  535. package/dist/odspDriverUrlResolver.js.map +0 -1
  536. package/dist/odspDriverUrlResolverForShareLink.js.map +0 -1
  537. package/dist/odspError.js.map +0 -1
  538. package/dist/odspFluidFileLink.js.map +0 -1
  539. package/dist/odspPublicUtils.js.map +0 -1
  540. package/dist/odspSnapshotParser.js.map +0 -1
  541. package/dist/odspSummaryUploadManager.js.map +0 -1
  542. package/dist/odspUrlHelper.js.map +0 -1
  543. package/dist/odspUtils.js.map +0 -1
  544. package/dist/opsCaching.js.map +0 -1
  545. package/dist/packageVersion.js.map +0 -1
  546. package/dist/prefetchLatestSnapshot.js +0 -57
  547. package/dist/prefetchLatestSnapshot.js.map +0 -1
  548. package/dist/retryErrorsStorageAdapter.js.map +0 -1
  549. package/dist/retryUtils.js.map +0 -1
  550. package/dist/vroom.js.map +0 -1
  551. package/dist/zipItDataRepresentationUtils.js.map +0 -1
  552. package/lib/ReadBufferUtils.d.ts.map +0 -1
  553. package/lib/ReadBufferUtils.js.map +0 -1
  554. package/lib/WriteBufferUtils.d.ts.map +0 -1
  555. package/lib/WriteBufferUtils.js.map +0 -1
  556. package/lib/checkUrl.d.ts.map +0 -1
  557. package/lib/checkUrl.js.map +0 -1
  558. package/lib/compactSnapshotParser.d.ts +0 -15
  559. package/lib/compactSnapshotParser.d.ts.map +0 -1
  560. package/lib/compactSnapshotParser.js +0 -111
  561. package/lib/compactSnapshotParser.js.map +0 -1
  562. package/lib/compactSnapshotWriter.d.ts.map +0 -1
  563. package/lib/compactSnapshotWriter.js.map +0 -1
  564. package/lib/constants.d.ts.map +0 -1
  565. package/lib/constants.js.map +0 -1
  566. package/lib/contracts.d.ts.map +0 -1
  567. package/lib/contracts.js.map +0 -1
  568. package/lib/contractsPublic.d.ts.map +0 -1
  569. package/lib/contractsPublic.js.map +0 -1
  570. package/lib/createFile.d.ts +0 -22
  571. package/lib/createFile.d.ts.map +0 -1
  572. package/lib/createFile.js +0 -235
  573. package/lib/createFile.js.map +0 -1
  574. package/lib/createNewUtils.d.ts +0 -11
  575. package/lib/createNewUtils.d.ts.map +0 -1
  576. package/lib/createNewUtils.js +0 -63
  577. package/lib/createNewUtils.js.map +0 -1
  578. package/lib/createOdspCreateContainerRequest.d.ts.map +0 -1
  579. package/lib/createOdspCreateContainerRequest.js.map +0 -1
  580. package/lib/createOdspUrl.js.map +0 -1
  581. package/lib/epochTracker.d.ts.map +0 -1
  582. package/lib/epochTracker.js.map +0 -1
  583. package/lib/fetch.js.map +0 -1
  584. package/lib/fetchSnapshot.d.ts.map +0 -1
  585. package/lib/fetchSnapshot.js.map +0 -1
  586. package/lib/getFileLink.d.ts.map +0 -1
  587. package/lib/getFileLink.js.map +0 -1
  588. package/lib/getQueryString.d.ts.map +0 -1
  589. package/lib/getQueryString.js.map +0 -1
  590. package/lib/getSocketIo.d.ts +0 -11
  591. package/lib/getSocketIo.d.ts.map +0 -1
  592. package/lib/getSocketIo.js +0 -13
  593. package/lib/getSocketIo.js.map +0 -1
  594. package/lib/getUrlAndHeadersWithAuth.js.map +0 -1
  595. package/lib/index.d.ts +0 -21
  596. package/lib/index.d.ts.map +0 -1
  597. package/lib/index.js +0 -29
  598. package/lib/index.js.map +0 -1
  599. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +0 -1
  600. package/lib/localOdspDriver/localOdspDocumentService.js.map +0 -1
  601. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +0 -1
  602. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  603. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +0 -1
  604. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  605. package/lib/odspCache.d.ts.map +0 -1
  606. package/lib/odspCache.js.map +0 -1
  607. package/lib/odspDeltaStorageService.d.ts.map +0 -1
  608. package/lib/odspDeltaStorageService.js.map +0 -1
  609. package/lib/odspDocumentDeltaConnection.d.ts.map +0 -1
  610. package/lib/odspDocumentDeltaConnection.js.map +0 -1
  611. package/lib/odspDocumentService.d.ts.map +0 -1
  612. package/lib/odspDocumentService.js +0 -360
  613. package/lib/odspDocumentService.js.map +0 -1
  614. package/lib/odspDocumentServiceFactory.d.ts.map +0 -1
  615. package/lib/odspDocumentServiceFactory.js.map +0 -1
  616. package/lib/odspDocumentServiceFactoryCore.d.ts.map +0 -1
  617. package/lib/odspDocumentServiceFactoryCore.js +0 -114
  618. package/lib/odspDocumentServiceFactoryCore.js.map +0 -1
  619. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +0 -1
  620. package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  621. package/lib/odspDocumentStorageManager.d.ts.map +0 -1
  622. package/lib/odspDocumentStorageManager.js +0 -352
  623. package/lib/odspDocumentStorageManager.js.map +0 -1
  624. package/lib/odspDocumentStorageServiceBase.d.ts.map +0 -1
  625. package/lib/odspDocumentStorageServiceBase.js.map +0 -1
  626. package/lib/odspDriverUrlResolver.d.ts.map +0 -1
  627. package/lib/odspDriverUrlResolver.js.map +0 -1
  628. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +0 -1
  629. package/lib/odspDriverUrlResolverForShareLink.js.map +0 -1
  630. package/lib/odspError.d.ts.map +0 -1
  631. package/lib/odspError.js.map +0 -1
  632. package/lib/odspFluidFileLink.d.ts.map +0 -1
  633. package/lib/odspFluidFileLink.js.map +0 -1
  634. package/lib/odspPublicUtils.d.ts.map +0 -1
  635. package/lib/odspPublicUtils.js.map +0 -1
  636. package/lib/odspSnapshotParser.d.ts.map +0 -1
  637. package/lib/odspSnapshotParser.js.map +0 -1
  638. package/lib/odspSummaryUploadManager.d.ts.map +0 -1
  639. package/lib/odspSummaryUploadManager.js.map +0 -1
  640. package/lib/odspUrlHelper.d.ts.map +0 -1
  641. package/lib/odspUrlHelper.js.map +0 -1
  642. package/lib/odspUtils.d.ts.map +0 -1
  643. package/lib/odspUtils.js.map +0 -1
  644. package/lib/opsCaching.d.ts.map +0 -1
  645. package/lib/opsCaching.js.map +0 -1
  646. package/lib/packageVersion.js.map +0 -1
  647. package/lib/prefetchLatestSnapshot.d.ts.map +0 -1
  648. package/lib/prefetchLatestSnapshot.js +0 -53
  649. package/lib/prefetchLatestSnapshot.js.map +0 -1
  650. package/lib/retryErrorsStorageAdapter.d.ts.map +0 -1
  651. package/lib/retryErrorsStorageAdapter.js.map +0 -1
  652. package/lib/retryUtils.d.ts.map +0 -1
  653. package/lib/retryUtils.js.map +0 -1
  654. package/lib/vroom.d.ts.map +0 -1
  655. package/lib/vroom.js.map +0 -1
  656. package/lib/zipItDataRepresentationUtils.d.ts.map +0 -1
  657. package/lib/zipItDataRepresentationUtils.js.map +0 -1
  658. package/src/getSocketIo.ts +0 -14
  659. package/tsconfig.esnext.json +0 -7
  660. /package/lib/{ReadBufferUtils.d.ts → ReadBufferUtils.d.mts} +0 -0
  661. /package/lib/{getUrlAndHeadersWithAuth.d.ts → getUrlAndHeadersWithAuth.d.mts} +0 -0
@@ -3,23 +3,34 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { v4 as uuid } from "uuid";
6
- import { assert, Deferred } from "@fluidframework/common-utils";
7
- import { ThrottlingError, RateLimiter, NonRetryableError } from "@fluidframework/driver-utils";
6
+ import { assert, Deferred } from "@fluidframework/core-utils";
7
+ import { PerformanceEvent, isFluidError, normalizeError, loggerToMonitoringContext, wrapError, } from "@fluidframework/telemetry-utils";
8
+ import { ThrottlingError, RateLimiter, NonRetryableError, LocationRedirectionError, } from "@fluidframework/driver-utils";
8
9
  import { snapshotKey, } from "@fluidframework/odsp-driver-definitions";
9
10
  import { DriverErrorType } from "@fluidframework/driver-definitions";
10
- import { PerformanceEvent, isFluidError, normalizeError } from "@fluidframework/telemetry-utils";
11
- import { fetchAndParseAsJSONHelper, fetchArray, fetchHelper, getOdspResolvedUrl } from "./odspUtils";
12
- import { persistedCacheValueVersion } from "./contracts";
13
- import { ClpCompliantAppHeader } from "./contractsPublic";
14
- import { pkgVersion as driverVersion } from "./packageVersion";
11
+ import { fetchAndParseAsJSONHelper, fetchArray, fetchHelper, getOdspResolvedUrl, } from "./odspUtils.mjs";
12
+ import { persistedCacheValueVersion } from "./contracts.mjs";
13
+ import { ClpCompliantAppHeader } from "./contractsPublic.mjs";
14
+ import { pkgVersion as driverVersion } from "./packageVersion.mjs";
15
+ import { patchOdspResolvedUrl } from "./odspLocationRedirection.mjs";
15
16
  export const Odsp409Error = "Odsp409Error";
16
- // Please update the README file in odsp-driver-definitions if you change the defaultCacheExpiryTimeoutMs.
17
- export const defaultCacheExpiryTimeoutMs = 2 * 24 * 60 * 60 * 1000;
17
+ // Must be less than policy of 5 days
18
+ export const defaultCacheExpiryTimeoutMs = 2 * 24 * 60 * 60 * 1000; // 2 days in ms
18
19
  /**
20
+ * In ODSP, the concept of "epoch" refers to binary updates to files. For example, this might include using
21
+ * version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch
22
+ * value being incremented.
23
+ *
24
+ * The implications of these binary updates is that the Fluid state is disrupted: the sequence number might
25
+ * go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's
26
+ * not safe to continue collaboration across an epoch change. We need to detect these epoch changes and
27
+ * error out from the collaboration.
28
+ *
19
29
  * This class is a wrapper around fetch calls. It adds epoch to the request made so that the
20
30
  * server can match it with its epoch value in order to match the version.
21
31
  * It also validates the epoch value received in response of fetch calls. If the epoch does not match,
22
32
  * then it also clears all the cached entries for the given container.
33
+ * @alpha
23
34
  */
24
35
  export class EpochTracker {
25
36
  constructor(cache, fileEntry, logger, clientIsSummarizer) {
@@ -32,6 +43,10 @@ export class EpochTracker {
32
43
  this.networkCallNumber = 1;
33
44
  // Limits the max number of concurrent requests to 24.
34
45
  this.rateLimiter = new RateLimiter(24);
46
+ // Matches the TestOverride logic for the policy defined in odspDocumentStorageServiceBase.ts
47
+ this.snapshotCacheExpiryTimeoutMs = loggerToMonitoringContext(logger).config.getBoolean("Fluid.Driver.Odsp.TestOverride.DisableSnapshotCache")
48
+ ? 0
49
+ : defaultCacheExpiryTimeoutMs;
35
50
  }
36
51
  // public for UT purposes only!
37
52
  setEpoch(epoch, fromCache, fetchType) {
@@ -45,7 +60,6 @@ export class EpochTracker {
45
60
  });
46
61
  }
47
62
  async get(entry) {
48
- var _a;
49
63
  try {
50
64
  // Return undefined so that the ops/snapshots are grabbed from the server instead of the cache
51
65
  const value = await this.cache.get(this.fileEntryFromEntry(entry));
@@ -63,16 +77,17 @@ export class EpochTracker {
63
77
  else if (this._fluidEpoch !== value.fluidEpoch) {
64
78
  return undefined;
65
79
  }
66
- // Expire the cached snapshot if it's older than the defaultCacheExpiryTimeoutMs and immediately
80
+ // Expire the cached snapshot if it's older than snapshotCacheExpiryTimeoutMs and immediately
67
81
  // expire all old caches that do not have cacheEntryTime
68
82
  if (entry.type === snapshotKey) {
69
- const cacheTime = (_a = value.value) === null || _a === void 0 ? void 0 : _a.cacheEntryTime;
83
+ const cacheTime = value.value?.cacheEntryTime;
70
84
  const currentTime = Date.now();
71
- if (cacheTime === undefined || currentTime - cacheTime >= defaultCacheExpiryTimeoutMs) {
85
+ if (cacheTime === undefined ||
86
+ currentTime - cacheTime >= this.snapshotCacheExpiryTimeoutMs) {
72
87
  this.logger.sendTelemetryEvent({
73
88
  eventName: "odspVersionsCacheExpired",
74
89
  duration: currentTime - cacheTime,
75
- maxCacheAgeMs: defaultCacheExpiryTimeoutMs,
90
+ maxCacheAgeMs: this.snapshotCacheExpiryTimeoutMs,
76
91
  });
77
92
  await this.removeEntries();
78
93
  return undefined;
@@ -87,20 +102,18 @@ export class EpochTracker {
87
102
  }
88
103
  }
89
104
  async put(entry, value) {
90
- var _a;
91
105
  assert(this._fluidEpoch !== undefined, 0x1dd /* "no epoch" */);
92
- // For snapshots, the value should have the cacheEntryTime. This will be used to expire snapshots older
93
- // than the defaultCacheExpiryTimeoutMs.
106
+ // For snapshots, the value should have the cacheEntryTime.
107
+ // This will be used to expire snapshots older than snapshotCacheExpiryTimeoutMs.
94
108
  if (entry.type === snapshotKey) {
95
- value.cacheEntryTime = (_a = value.cacheEntryTime) !== null && _a !== void 0 ? _a : Date.now();
109
+ value.cacheEntryTime = value.cacheEntryTime ?? Date.now();
96
110
  }
97
111
  const data = {
98
112
  value,
99
113
  version: persistedCacheValueVersion,
100
114
  fluidEpoch: this._fluidEpoch,
101
115
  };
102
- return this.cache.put(this.fileEntryFromEntry(entry), data)
103
- .catch((error) => {
116
+ return this.cache.put(this.fileEntryFromEntry(entry), data).catch((error) => {
104
117
  this.logger.sendErrorEvent({ eventName: "cachePutError", type: entry.type }, error);
105
118
  throw error;
106
119
  });
@@ -116,14 +129,13 @@ export class EpochTracker {
116
129
  get fluidEpoch() {
117
130
  return this._fluidEpoch;
118
131
  }
119
- async validateEpochFromPush(details) {
120
- const epoch = details.epoch;
121
- assert(epoch !== undefined, 0x09d /* "Connection details should contain epoch" */);
132
+ async validateEpoch(epoch, fetchType) {
133
+ assert(epoch !== undefined, 0x584 /* response should contain epoch */);
122
134
  try {
123
- this.validateEpochFromResponse(epoch, "push");
135
+ this.validateEpochFromResponse(epoch, fetchType);
124
136
  }
125
137
  catch (error) {
126
- await this.checkForEpochError(error, epoch, "push");
138
+ await this.checkForEpochError(error, epoch, fetchType);
127
139
  throw error;
128
140
  }
129
141
  }
@@ -154,12 +166,15 @@ export class EpochTracker {
154
166
  // Add epoch in fetch request.
155
167
  this.addEpochInRequest(fetchOptions, addInBody, clientCorrelationId);
156
168
  let epochFromResponse;
157
- return this.rateLimiter.schedule(async () => fetcher(url, fetchOptions)).then((response) => {
169
+ return this.rateLimiter
170
+ .schedule(async () => fetcher(url, fetchOptions))
171
+ .then((response) => {
158
172
  epochFromResponse = response.headers.get("x-fluid-epoch");
159
173
  this.validateEpochFromResponse(epochFromResponse, fetchType);
160
174
  response.propsToLog.XRequestStatsHeader = clientCorrelationId;
161
175
  return response;
162
- }).catch(async (error) => {
176
+ })
177
+ .catch(async (error) => {
163
178
  // Get the server epoch from error in case we don't have it as if undefined we won't be able
164
179
  // to mark it as epoch error.
165
180
  if (epochFromResponse === undefined) {
@@ -167,8 +182,26 @@ export class EpochTracker {
167
182
  }
168
183
  await this.checkForEpochError(error, epochFromResponse, fetchType);
169
184
  throw error;
170
- }).catch((error) => {
171
- const fluidError = normalizeError(error, { props: { XRequestStatsHeader: clientCorrelationId } });
185
+ })
186
+ .catch((error) => {
187
+ // If the error is about location redirection, then we need to generate new resolved url with correct
188
+ // location info.
189
+ if (isFluidError(error) &&
190
+ error.errorType === DriverErrorType.fileNotFoundOrAccessDeniedError) {
191
+ const redirectLocation = error.redirectLocation;
192
+ if (redirectLocation !== undefined) {
193
+ const redirectUrl = patchOdspResolvedUrl(this.fileEntry.resolvedUrl, redirectLocation);
194
+ const locationRedirectionError = new LocationRedirectionError(error.message, redirectUrl, { driverVersion, redirectLocation });
195
+ locationRedirectionError.addTelemetryProperties(error.getTelemetryProperties());
196
+ throw locationRedirectionError;
197
+ }
198
+ }
199
+ throw error;
200
+ })
201
+ .catch((error) => {
202
+ const fluidError = normalizeError(error, {
203
+ props: { XRequestStatsHeader: clientCorrelationId },
204
+ });
172
205
  throw fluidError;
173
206
  });
174
207
  }
@@ -198,7 +231,9 @@ export class EpochTracker {
198
231
  }
199
232
  else {
200
233
  const addHeader = (key, val) => {
201
- fetchOptions.headers = Object.assign({}, fetchOptions.headers);
234
+ fetchOptions.headers = {
235
+ ...fetchOptions.headers,
236
+ };
202
237
  assert(fetchOptions.headers !== undefined, 0x282 /* "Headers should be present now" */);
203
238
  fetchOptions.headers[key] = val;
204
239
  };
@@ -218,7 +253,7 @@ export class EpochTracker {
218
253
  assert(typeof body === "string", 0x21d /* "body is not string" */);
219
254
  const splitBody = body.split("\r\n");
220
255
  const firstLine = splitBody.shift();
221
- assert((firstLine === null || firstLine === void 0 ? void 0 : firstLine.startsWith("--")) === true, 0x21e /* "improper boundary format" */);
256
+ assert(firstLine?.startsWith("--") === true, 0x21e /* "improper boundary format" */);
222
257
  const formParams = [firstLine];
223
258
  Object.entries(headers).forEach(([key, value]) => {
224
259
  formParams.push(`${key}: ${value}`);
@@ -257,7 +292,6 @@ export class EpochTracker {
257
292
  if (epochError !== undefined) {
258
293
  epochError.addTelemetryProperties({
259
294
  fromCache,
260
- clientEpoch: this.fluidEpoch,
261
295
  fetchType,
262
296
  });
263
297
  this.logger.sendErrorEvent({ eventName: "fileOverwrittenInStorage" }, epochError);
@@ -268,27 +302,39 @@ export class EpochTracker {
268
302
  // If it was categorized as epoch error but the epoch returned in response matches with the client epoch
269
303
  // then it was coherency 409, so rethrow it as throttling error so that it can retried. Default throttling
270
304
  // time is 1s.
271
- throw new ThrottlingError(`Coherency 409: ${error.message}`, 1 /* retryAfterSeconds */, { [Odsp409Error]: true, driverVersion });
305
+ const newError = wrapError(error, (message) => {
306
+ return new ThrottlingError(`Coherency 409: ${message}`, 1 /* retryAfterSeconds */, {
307
+ [Odsp409Error]: true,
308
+ driverVersion,
309
+ });
310
+ });
311
+ throw newError;
272
312
  }
273
313
  }
274
314
  checkForEpochErrorCore(epochFromResponse) {
275
315
  // If epoch is undefined, then don't compare it because initially for createNew or TreesLatest
276
316
  // initializes this value. Sometimes response does not contain epoch as it is still in
277
317
  // implementation phase at server side. In that case also, don't compare it with our epoch value.
278
- if (this.fluidEpoch && epochFromResponse && (this.fluidEpoch !== epochFromResponse)) {
318
+ if (this.fluidEpoch && epochFromResponse && this.fluidEpoch !== epochFromResponse) {
279
319
  // This is similar in nature to how fluidEpochMismatchError (409) is handled.
280
320
  // Difference - client detected mismatch, instead of server detecting it.
281
- return new NonRetryableError("Epoch mismatch", DriverErrorType.fileOverwrittenInStorage, { driverVersion });
321
+ return new NonRetryableError("Epoch mismatch", DriverErrorType.fileOverwrittenInStorage, { driverVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch });
282
322
  }
283
323
  }
284
324
  fileEntryFromEntry(entry) {
285
- return Object.assign(Object.assign({}, entry), { file: this.fileEntry });
325
+ return { ...entry, file: this.fileEntry };
286
326
  }
287
327
  }
288
328
  export class EpochTrackerWithRedemption extends EpochTracker {
289
- constructor() {
290
- super(...arguments);
329
+ constructor(cache, fileEntry, logger, clientIsSummarizer) {
330
+ super(cache, fileEntry, logger, clientIsSummarizer);
331
+ this.cache = cache;
332
+ this.fileEntry = fileEntry;
333
+ this.logger = logger;
334
+ this.clientIsSummarizer = clientIsSummarizer;
291
335
  this.treesLatestDeferral = new Deferred();
336
+ // Handles the rejected promise within treesLatestDeferral.
337
+ this.treesLatestDeferral.promise.catch(() => { });
292
338
  }
293
339
  validateEpochFromResponse(epochFromResponse, fetchType, fromCache = false) {
294
340
  super.validateEpochFromResponse(epochFromResponse, fetchType, fromCache);
@@ -332,7 +378,10 @@ export class EpochTrackerWithRedemption extends EpochTracker {
332
378
  if (fetchType === "treesLatest") {
333
379
  this.treesLatestDeferral.reject(error);
334
380
  }
335
- if (fetchType !== "joinSession" || error.statusCode < 401 || error.statusCode > 404 || completed) {
381
+ if (fetchType !== "joinSession" ||
382
+ error.statusCode < 401 ||
383
+ error.statusCode > 404 ||
384
+ completed) {
336
385
  throw error;
337
386
  }
338
387
  }
@@ -348,12 +397,14 @@ export class EpochTrackerWithRedemption extends EpochTracker {
348
397
  const timeoutRes = 51; // anything will work here
349
398
  let timer;
350
399
  const timeoutP = new Promise((resolve) => {
351
- timer = setTimeout(() => { resolve(timeoutRes); }, 15000);
400
+ timer = setTimeout(() => {
401
+ resolve(timeoutRes);
402
+ }, 15000);
352
403
  });
353
404
  const res = await Promise.race([
354
405
  timeoutP,
355
406
  // cancel timeout to unblock UTs (otherwise Node process does not exit for 15 sec)
356
- this.treesLatestDeferral.promise.finally(() => clearTimeout(timer))
407
+ this.treesLatestDeferral.promise.finally(() => clearTimeout(timer)),
357
408
  ]);
358
409
  if (res === timeoutRes) {
359
410
  event.cancel();
@@ -365,8 +416,11 @@ export class EpochTrackerWithRedemption extends EpochTracker {
365
416
  export function createOdspCacheAndTracker(persistedCacheArg, nonpersistentCache, fileEntry, logger, clientIsSummarizer) {
366
417
  const epochTracker = new EpochTrackerWithRedemption(persistedCacheArg, fileEntry, logger, clientIsSummarizer);
367
418
  return {
368
- cache: Object.assign(Object.assign({}, nonpersistentCache), { persistedCache: epochTracker }),
419
+ cache: {
420
+ ...nonpersistentCache,
421
+ persistedCache: epochTracker,
422
+ },
369
423
  epochTracker,
370
424
  };
371
425
  }
372
- //# sourceMappingURL=epochTracker.js.map
426
+ //# sourceMappingURL=epochTracker.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"epochTracker.mjs","sourceRoot":"","sources":["../src/epochTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM;OAC1B,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B;OACtD,EAEN,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,SAAS,GACT,MAAM,iCAAiC;OACjC,EACN,eAAe,EACf,WAAW,EAC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BACrB,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;AAUD,MAAM,UAAU,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","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"]}
@@ -2,5 +2,5 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export declare const fetch: (request: RequestInfo, config?: RequestInit | undefined) => Promise<Response>;
5
+ export declare const fetch: (request: RequestInfo, config?: RequestInit) => Promise<Response>;
6
6
  //# sourceMappingURL=fetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,eAAO,MAAM,KAAK,YAAmB,WAAW,uCAAyB,QAAQ,QAAQ,CACI,CAAC"}
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,eAAO,MAAM,KAAK,YAAmB,WAAW,WAAW,WAAW,KAAG,QAAQ,QAAQ,CACC,CAAC"}
@@ -7,4 +7,4 @@ import { default as nodeFetch, } from "node-fetch";
7
7
  // Browser's fetch API and the 'node-fetch' package by wrapping the call to the 'node-fetch' API
8
8
  // in the browser's types from 'lib.dom.d.ts'.
9
9
  export const fetch = async (request, config) => nodeFetch(request, config);
10
- //# sourceMappingURL=fetch.js.map
10
+ //# sourceMappingURL=fetch.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.mjs","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,OAAO,IAAI,SAAS,GAGpB,MAAM,YAAY;AAEnB,yFAAyF;AACzF,gGAAgG;AAChG,8CAA8C;AAC9C,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,EAAE,OAAoB,EAAE,MAAoB,EAAqB,EAAE,CAC5F,SAAS,CAAC,OAA2B,EAAE,MAA0B,CAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tdefault as nodeFetch,\n\tRequestInfo as FetchRequestInfo,\n\tRequestInit as FetchRequestInit,\n} from \"node-fetch\";\n\n// The only purpose of this helper is to work around the slight misalignments between the\n// Browser's fetch API and the 'node-fetch' package by wrapping the call to the 'node-fetch' API\n// in the browser's types from 'lib.dom.d.ts'.\nexport const fetch = async (request: RequestInfo, config?: RequestInit): Promise<Response> =>\n\tnodeFetch(request as FetchRequestInfo, config as FetchRequestInit) as unknown as Response;\n"]}
@@ -2,15 +2,15 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { default as AbortController } from "abort-controller";
6
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
7
6
  import { IOdspResolvedUrl, ISnapshotOptions, InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions";
8
- import { IOdspSnapshot, IVersionedValueWithEpoch } from "./contracts";
9
- import { IOdspResponse } from "./odspUtils";
10
- import { ISnapshotContents } from "./odspPublicUtils";
11
- import { EpochTracker } from "./epochTracker";
7
+ import { IOdspSnapshot, IVersionedValueWithEpoch } from "./contracts.mjs";
8
+ import { IOdspResponse } from "./odspUtils.mjs";
9
+ import { ISnapshotContents } from "./odspPublicUtils.mjs";
10
+ import { EpochTracker } from "./epochTracker.mjs";
12
11
  /**
13
12
  * Enum to support different types of snapshot formats.
13
+ * @alpha
14
14
  */
15
15
  export declare enum SnapshotFormatSupportType {
16
16
  Json = 0,
@@ -27,10 +27,10 @@ export declare enum SnapshotFormatSupportType {
27
27
  * @param forceAccessTokenViaAuthorizationHeader - whether to force passing given token via authorization header
28
28
  * @returns A promise of the snapshot and the status code of the response
29
29
  */
30
- export declare function fetchSnapshot(snapshotUrl: string, token: string | null, versionId: string, fetchFullSnapshot: boolean, forceAccessTokenViaAuthorizationHeader: boolean, logger: ITelemetryLogger, snapshotDownloader: (url: string, fetchOptions: {
30
+ export declare function fetchSnapshot(snapshotUrl: string, token: string | null, versionId: string, fetchFullSnapshot: boolean, forceAccessTokenViaAuthorizationHeader: boolean, logger: ITelemetryLoggerExt, snapshotDownloader: (url: string, fetchOptions: {
31
31
  [index: string]: any;
32
32
  }) => Promise<IOdspResponse<unknown>>): Promise<ISnapshotContents>;
33
- export declare function fetchSnapshotWithRedeem(odspResolvedUrl: IOdspResolvedUrl, storageTokenFetcher: InstrumentedStorageTokenFetcher, snapshotOptions: ISnapshotOptions | undefined, forceAccessTokenViaAuthorizationHeader: boolean, logger: ITelemetryLogger, snapshotDownloader: (finalOdspResolvedUrl: IOdspResolvedUrl, storageToken: string, snapshotOptions: ISnapshotOptions | undefined, controller?: AbortController) => Promise<ISnapshotRequestAndResponseOptions>, putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>, removeEntries: () => Promise<void>, enableRedeemFallback?: boolean): 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>;
34
34
  export interface ISnapshotRequestAndResponseOptions {
35
35
  odspResponse: IOdspResponse<Response>;
36
36
  requestUrl: string;
@@ -38,6 +38,11 @@ export interface ISnapshotRequestAndResponseOptions {
38
38
  [index: string]: any;
39
39
  };
40
40
  }
41
+ export declare function evalBlobsAndTrees(snapshot: ISnapshotContents): {
42
+ trees: number;
43
+ numBlobs: number;
44
+ encodedBlobsSize: number;
45
+ };
41
46
  export declare function validateBlobsAndTrees(snapshot: IOdspSnapshot): void;
42
47
  /**
43
48
  * This function fetches the snapshot and parse it according to what is mentioned in response headers.
@@ -50,5 +55,5 @@ export declare function validateBlobsAndTrees(snapshot: IOdspSnapshot): void;
50
55
  * @param epochTracker - epoch tracker used to add/validate epoch in the network call.
51
56
  * @returns fetched snapshot.
52
57
  */
53
- export declare function downloadSnapshot(odspResolvedUrl: IOdspResolvedUrl, storageToken: string, logger: ITelemetryLogger, snapshotOptions: ISnapshotOptions | undefined, snapshotFormatFetchType?: SnapshotFormatSupportType, controller?: AbortController, epochTracker?: EpochTracker, scenarioName?: string): Promise<ISnapshotRequestAndResponseOptions>;
58
+ export declare function downloadSnapshot(odspResolvedUrl: IOdspResolvedUrl, storageToken: string, logger: ITelemetryLoggerExt, snapshotOptions: ISnapshotOptions | undefined, snapshotFormatFetchType?: SnapshotFormatSupportType, controller?: AbortController, epochTracker?: EpochTracker, scenarioName?: string): Promise<ISnapshotRequestAndResponseOptions>;
54
59
  //# sourceMappingURL=fetchSnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchSnapshot.d.ts","sourceRoot":"","sources":["../src/fetchSnapshot.ts"],"names":[],"mappings":"AAA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