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

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 (666) 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-esm.json +4 -0
  6. package/api-extractor-lint.json +4 -0
  7. package/api-extractor.json +2 -2
  8. package/api-report/odsp-driver.api.md +309 -0
  9. package/dist/{ReadBufferUtils.js → ReadBufferUtils.cjs} +16 -9
  10. package/dist/ReadBufferUtils.cjs.map +1 -0
  11. package/dist/ReadBufferUtils.d.ts.map +1 -1
  12. package/dist/{WriteBufferUtils.js → WriteBufferUtils.cjs} +73 -69
  13. package/dist/WriteBufferUtils.cjs.map +1 -0
  14. package/dist/WriteBufferUtils.d.ts +3 -5
  15. package/dist/WriteBufferUtils.d.ts.map +1 -1
  16. package/dist/{checkUrl.js → checkUrl.cjs} +7 -6
  17. package/dist/checkUrl.cjs.map +1 -0
  18. package/dist/checkUrl.d.ts +1 -0
  19. package/dist/checkUrl.d.ts.map +1 -1
  20. package/dist/compactSnapshotParser.cjs +207 -0
  21. package/dist/compactSnapshotParser.cjs.map +1 -0
  22. package/dist/compactSnapshotParser.d.ts +12 -3
  23. package/dist/compactSnapshotParser.d.ts.map +1 -1
  24. package/dist/{compactSnapshotWriter.js → compactSnapshotWriter.cjs} +43 -33
  25. package/dist/compactSnapshotWriter.cjs.map +1 -0
  26. package/dist/compactSnapshotWriter.d.ts +2 -3
  27. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  28. package/dist/{constants.js → constants.cjs} +7 -1
  29. package/dist/constants.cjs.map +1 -0
  30. package/dist/constants.d.ts +6 -0
  31. package/dist/constants.d.ts.map +1 -1
  32. package/dist/{contracts.js → contracts.cjs} +1 -1
  33. package/dist/contracts.cjs.map +1 -0
  34. package/dist/contracts.d.ts +16 -53
  35. package/dist/contracts.d.ts.map +1 -1
  36. package/dist/{contractsPublic.js → contractsPublic.cjs} +9 -3
  37. package/dist/contractsPublic.cjs.map +1 -0
  38. package/dist/contractsPublic.d.ts +15 -0
  39. package/dist/contractsPublic.d.ts.map +1 -1
  40. package/dist/createFile.cjs +177 -0
  41. package/dist/createFile.cjs.map +1 -0
  42. package/dist/createFile.d.ts +6 -10
  43. package/dist/createFile.d.ts.map +1 -1
  44. package/dist/createNewContainerOnExistingFile.cjs +60 -0
  45. package/dist/createNewContainerOnExistingFile.cjs.map +1 -0
  46. package/dist/createNewContainerOnExistingFile.d.ts +22 -0
  47. package/dist/createNewContainerOnExistingFile.d.ts.map +1 -0
  48. package/dist/createNewModule.cjs +12 -0
  49. package/dist/createNewModule.cjs.map +1 -0
  50. package/dist/createNewModule.d.ts +7 -0
  51. package/dist/createNewModule.d.ts.map +1 -0
  52. package/dist/createNewUtils.cjs +203 -0
  53. package/dist/createNewUtils.cjs.map +1 -0
  54. package/dist/createNewUtils.d.ts +16 -0
  55. package/dist/createNewUtils.d.ts.map +1 -1
  56. package/dist/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.cjs} +8 -4
  57. package/dist/createOdspCreateContainerRequest.cjs.map +1 -0
  58. package/dist/createOdspCreateContainerRequest.d.ts +5 -3
  59. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  60. package/dist/{createOdspUrl.js → createOdspUrl.cjs} +2 -1
  61. package/dist/createOdspUrl.cjs.map +1 -0
  62. package/dist/createOdspUrl.d.ts +1 -0
  63. package/dist/createOdspUrl.d.ts.map +1 -1
  64. package/dist/{epochTracker.js → epochTracker.cjs} +102 -48
  65. package/dist/epochTracker.cjs.map +1 -0
  66. package/dist/epochTracker.d.ts +32 -8
  67. package/dist/epochTracker.d.ts.map +1 -1
  68. package/dist/{fetch.js → fetch.cjs} +1 -1
  69. package/dist/fetch.cjs.map +1 -0
  70. package/dist/fetch.d.ts +1 -1
  71. package/dist/fetch.d.ts.map +1 -1
  72. package/dist/{fetchSnapshot.js → fetchSnapshot.cjs} +192 -176
  73. package/dist/fetchSnapshot.cjs.map +1 -0
  74. package/dist/fetchSnapshot.d.ts +10 -5
  75. package/dist/fetchSnapshot.d.ts.map +1 -1
  76. package/dist/{getFileLink.js → getFileLink.cjs} +52 -41
  77. package/dist/getFileLink.cjs.map +1 -0
  78. package/dist/getFileLink.d.ts +4 -7
  79. package/dist/getFileLink.d.ts.map +1 -1
  80. package/dist/{getQueryString.js → getQueryString.cjs} +1 -1
  81. package/dist/getQueryString.cjs.map +1 -0
  82. package/dist/getQueryString.d.ts.map +1 -1
  83. package/dist/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.cjs} +4 -2
  84. package/dist/getUrlAndHeadersWithAuth.cjs.map +1 -0
  85. package/dist/getUrlAndHeadersWithAuth.d.ts.map +1 -1
  86. package/dist/index.cjs +59 -0
  87. package/dist/index.cjs.map +1 -0
  88. package/dist/index.d.ts +19 -16
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs +35 -0
  91. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +1 -0
  92. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +17 -0
  93. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
  94. package/dist/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.cjs} +7 -5
  95. package/dist/localOdspDriver/localOdspDocumentService.cjs.map +1 -0
  96. package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
  97. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  98. package/dist/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.cjs} +9 -10
  99. package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +1 -0
  100. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +2 -3
  101. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  102. package/dist/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.cjs} +13 -11
  103. package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +1 -0
  104. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -2
  105. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  106. package/dist/odsp-driver-alpha.d.ts +496 -0
  107. package/dist/odsp-driver-beta.d.ts +160 -0
  108. package/dist/odsp-driver-public.d.ts +160 -0
  109. package/dist/odsp-driver-untrimmed.d.ts +565 -0
  110. package/dist/{odspCache.js → odspCache.cjs} +9 -10
  111. package/dist/odspCache.cjs.map +1 -0
  112. package/dist/odspCache.d.ts +19 -4
  113. package/dist/odspCache.d.ts.map +1 -1
  114. package/dist/odspDelayLoadedDeltaStream.cjs +291 -0
  115. package/dist/odspDelayLoadedDeltaStream.cjs.map +1 -0
  116. package/dist/odspDelayLoadedDeltaStream.d.ts +75 -0
  117. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -0
  118. package/dist/{odspDeltaStorageService.js → odspDeltaStorageService.cjs} +70 -71
  119. package/dist/odspDeltaStorageService.cjs.map +1 -0
  120. package/dist/odspDeltaStorageService.d.ts +8 -6
  121. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  122. package/dist/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.cjs} +224 -113
  123. package/dist/odspDocumentDeltaConnection.cjs.map +1 -0
  124. package/dist/odspDocumentDeltaConnection.d.ts +32 -12
  125. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  126. package/dist/odspDocumentService.cjs +225 -0
  127. package/dist/odspDocumentService.cjs.map +1 -0
  128. package/dist/odspDocumentService.d.ts +11 -25
  129. package/dist/odspDocumentService.d.ts.map +1 -1
  130. package/dist/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.cjs} +8 -5
  131. package/dist/odspDocumentServiceFactory.cjs.map +1 -0
  132. package/dist/odspDocumentServiceFactory.d.ts +4 -0
  133. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  134. package/dist/odspDocumentServiceFactoryCore.cjs +196 -0
  135. package/dist/odspDocumentServiceFactoryCore.cjs.map +1 -0
  136. package/dist/odspDocumentServiceFactoryCore.d.ts +18 -11
  137. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  138. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs +20 -0
  139. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +1 -0
  140. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +5 -0
  141. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
  142. package/dist/odspDocumentStorageManager.cjs +490 -0
  143. package/dist/odspDocumentStorageManager.cjs.map +1 -0
  144. package/dist/odspDocumentStorageManager.d.ts +11 -5
  145. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  146. package/dist/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.cjs} +32 -34
  147. package/dist/odspDocumentStorageServiceBase.cjs.map +1 -0
  148. package/dist/odspDocumentStorageServiceBase.d.ts +7 -9
  149. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  150. package/dist/{odspDriverUrlResolver.js → odspDriverUrlResolver.cjs} +50 -36
  151. package/dist/odspDriverUrlResolver.cjs.map +1 -0
  152. package/dist/odspDriverUrlResolver.d.ts +12 -0
  153. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  154. package/dist/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.cjs} +37 -26
  155. package/dist/odspDriverUrlResolverForShareLink.cjs.map +1 -0
  156. package/dist/odspDriverUrlResolverForShareLink.d.ts +5 -3
  157. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  158. package/dist/{odspError.js → odspError.cjs} +7 -3
  159. package/dist/odspError.cjs.map +1 -0
  160. package/dist/odspError.d.ts.map +1 -1
  161. package/dist/{odspFluidFileLink.js → odspFluidFileLink.cjs} +25 -18
  162. package/dist/odspFluidFileLink.cjs.map +1 -0
  163. package/dist/odspFluidFileLink.d.ts +10 -1
  164. package/dist/odspFluidFileLink.d.ts.map +1 -1
  165. package/dist/odspLocationRedirection.cjs +24 -0
  166. package/dist/odspLocationRedirection.cjs.map +1 -0
  167. package/dist/odspLocationRedirection.d.ts +14 -0
  168. package/dist/odspLocationRedirection.d.ts.map +1 -0
  169. package/dist/{odspPublicUtils.js → odspPublicUtils.cjs} +7 -4
  170. package/dist/odspPublicUtils.cjs.map +1 -0
  171. package/dist/odspPublicUtils.d.ts +6 -0
  172. package/dist/odspPublicUtils.d.ts.map +1 -1
  173. package/dist/{odspSnapshotParser.js → odspSnapshotParser.cjs} +11 -12
  174. package/dist/odspSnapshotParser.cjs.map +1 -0
  175. package/dist/odspSnapshotParser.d.ts.map +1 -1
  176. package/dist/{odspSummaryUploadManager.js → odspSummaryUploadManager.cjs} +47 -34
  177. package/dist/odspSummaryUploadManager.cjs.map +1 -0
  178. package/dist/odspSummaryUploadManager.d.ts +7 -4
  179. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  180. package/dist/{odspUrlHelper.js → odspUrlHelper.cjs} +9 -3
  181. package/dist/odspUrlHelper.cjs.map +1 -0
  182. package/dist/odspUrlHelper.d.ts +5 -0
  183. package/dist/odspUrlHelper.d.ts.map +1 -1
  184. package/dist/{odspUtils.js → odspUtils.cjs} +118 -30
  185. package/dist/odspUtils.cjs.map +1 -0
  186. package/dist/odspUtils.d.ts +35 -6
  187. package/dist/odspUtils.d.ts.map +1 -1
  188. package/dist/{opsCaching.js → opsCaching.cjs} +25 -9
  189. package/dist/opsCaching.cjs.map +1 -0
  190. package/dist/opsCaching.d.ts +3 -3
  191. package/dist/opsCaching.d.ts.map +1 -1
  192. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  193. package/dist/packageVersion.cjs.map +1 -0
  194. package/dist/packageVersion.d.ts +1 -1
  195. package/dist/packageVersion.d.ts.map +1 -1
  196. package/dist/prefetchLatestSnapshot.cjs +100 -0
  197. package/dist/prefetchLatestSnapshot.cjs.map +1 -0
  198. package/dist/prefetchLatestSnapshot.d.ts +12 -7
  199. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  200. package/dist/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.cjs} +13 -6
  201. package/dist/retryErrorsStorageAdapter.cjs.map +1 -0
  202. package/dist/retryErrorsStorageAdapter.d.ts +5 -4
  203. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  204. package/dist/{retryUtils.js → retryUtils.cjs} +30 -14
  205. package/dist/retryUtils.cjs.map +1 -0
  206. package/dist/retryUtils.d.ts +2 -2
  207. package/dist/retryUtils.d.ts.map +1 -1
  208. package/dist/socketModule.cjs +10 -0
  209. package/dist/socketModule.cjs.map +1 -0
  210. package/dist/socketModule.d.ts +7 -0
  211. package/dist/socketModule.d.ts.map +1 -0
  212. package/dist/tsdoc-metadata.json +11 -0
  213. package/dist/{vroom.js → vroom.cjs} +24 -9
  214. package/dist/vroom.cjs.map +1 -0
  215. package/dist/vroom.d.ts +4 -4
  216. package/dist/vroom.d.ts.map +1 -1
  217. package/dist/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.cjs} +227 -118
  218. package/dist/zipItDataRepresentationUtils.cjs.map +1 -0
  219. package/dist/zipItDataRepresentationUtils.d.ts +47 -20
  220. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  221. package/lib/{ReadBufferUtils.d.ts → ReadBufferUtils.d.mts} +1 -1
  222. package/lib/ReadBufferUtils.d.mts.map +1 -0
  223. package/lib/{ReadBufferUtils.js → ReadBufferUtils.mjs} +14 -7
  224. package/lib/ReadBufferUtils.mjs.map +1 -0
  225. package/lib/{WriteBufferUtils.d.ts → WriteBufferUtils.d.mts} +4 -6
  226. package/lib/WriteBufferUtils.d.mts.map +1 -0
  227. package/lib/{WriteBufferUtils.js → WriteBufferUtils.mjs} +68 -64
  228. package/lib/WriteBufferUtils.mjs.map +1 -0
  229. package/lib/{checkUrl.d.ts → checkUrl.d.mts} +2 -1
  230. package/lib/checkUrl.d.mts.map +1 -0
  231. package/lib/{checkUrl.js → checkUrl.mjs} +7 -6
  232. package/lib/checkUrl.mjs.map +1 -0
  233. package/lib/compactSnapshotParser.d.mts +24 -0
  234. package/lib/compactSnapshotParser.d.mts.map +1 -0
  235. package/lib/compactSnapshotParser.mjs +203 -0
  236. package/lib/compactSnapshotParser.mjs.map +1 -0
  237. package/lib/{compactSnapshotWriter.d.ts → compactSnapshotWriter.d.mts} +4 -5
  238. package/lib/compactSnapshotWriter.d.mts.map +1 -0
  239. package/lib/{compactSnapshotWriter.js → compactSnapshotWriter.mjs} +41 -31
  240. package/lib/compactSnapshotWriter.mjs.map +1 -0
  241. package/lib/{constants.d.ts → constants.d.mts} +7 -1
  242. package/lib/constants.d.mts.map +1 -0
  243. package/lib/{constants.js → constants.mjs} +7 -1
  244. package/lib/constants.mjs.map +1 -0
  245. package/lib/{contracts.d.ts → contracts.d.mts} +18 -55
  246. package/lib/contracts.d.mts.map +1 -0
  247. package/lib/{contracts.js → contracts.mjs} +1 -1
  248. package/lib/contracts.mjs.map +1 -0
  249. package/lib/{contractsPublic.d.ts → contractsPublic.d.mts} +16 -1
  250. package/lib/contractsPublic.d.mts.map +1 -0
  251. package/lib/{contractsPublic.js → contractsPublic.mjs} +7 -1
  252. package/lib/contractsPublic.mjs.map +1 -0
  253. package/lib/createFile.d.mts +18 -0
  254. package/lib/createFile.d.mts.map +1 -0
  255. package/lib/createFile.mjs +171 -0
  256. package/lib/createFile.mjs.map +1 -0
  257. package/lib/createNewContainerOnExistingFile.d.mts +22 -0
  258. package/lib/createNewContainerOnExistingFile.d.mts.map +1 -0
  259. package/lib/createNewContainerOnExistingFile.mjs +56 -0
  260. package/lib/createNewContainerOnExistingFile.mjs.map +1 -0
  261. package/lib/createNewModule.d.mts +7 -0
  262. package/lib/createNewModule.d.mts.map +1 -0
  263. package/lib/createNewModule.mjs +7 -0
  264. package/lib/createNewModule.mjs.map +1 -0
  265. package/lib/createNewUtils.d.mts +27 -0
  266. package/lib/createNewUtils.d.mts.map +1 -0
  267. package/lib/createNewUtils.mjs +197 -0
  268. package/lib/createNewUtils.mjs.map +1 -0
  269. package/lib/{createOdspCreateContainerRequest.d.ts → createOdspCreateContainerRequest.d.mts} +6 -8
  270. package/lib/createOdspCreateContainerRequest.d.mts.map +1 -0
  271. package/lib/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.mjs} +8 -4
  272. package/lib/createOdspCreateContainerRequest.mjs.map +1 -0
  273. package/lib/{createOdspUrl.d.ts → createOdspUrl.d.mts} +3 -2
  274. package/lib/createOdspUrl.d.mts.map +1 -0
  275. package/lib/{createOdspUrl.js → createOdspUrl.mjs} +2 -1
  276. package/lib/createOdspUrl.mjs.map +1 -0
  277. package/lib/{epochTracker.d.ts → epochTracker.d.mts} +35 -11
  278. package/lib/epochTracker.d.mts.map +1 -0
  279. package/lib/{epochTracker.js → epochTracker.mjs} +97 -43
  280. package/lib/epochTracker.mjs.map +1 -0
  281. package/lib/{fetch.d.ts → fetch.d.mts} +2 -2
  282. package/lib/fetch.d.mts.map +1 -0
  283. package/lib/{fetch.js → fetch.mjs} +1 -1
  284. package/lib/fetch.mjs.map +1 -0
  285. package/lib/{fetchSnapshot.d.ts → fetchSnapshot.d.mts} +15 -10
  286. package/lib/fetchSnapshot.d.mts.map +1 -0
  287. package/lib/{fetchSnapshot.js → fetchSnapshot.mjs} +185 -167
  288. package/lib/fetchSnapshot.mjs.map +1 -0
  289. package/lib/{getFileLink.d.ts → getFileLink.d.mts} +5 -8
  290. package/lib/getFileLink.d.mts.map +1 -0
  291. package/lib/{getFileLink.js → getFileLink.mjs} +49 -38
  292. package/lib/getFileLink.mjs.map +1 -0
  293. package/lib/{getQueryString.d.ts → getQueryString.d.mts} +1 -5
  294. package/lib/getQueryString.d.mts.map +1 -0
  295. package/lib/{getQueryString.js → getQueryString.mjs} +1 -1
  296. package/lib/getQueryString.mjs.map +1 -0
  297. package/lib/{getUrlAndHeadersWithAuth.d.ts → getUrlAndHeadersWithAuth.d.mts} +1 -1
  298. package/lib/getUrlAndHeadersWithAuth.d.mts.map +1 -0
  299. package/lib/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.mjs} +4 -2
  300. package/lib/getUrlAndHeadersWithAuth.mjs.map +1 -0
  301. package/lib/index.d.mts +24 -0
  302. package/lib/index.d.mts.map +1 -0
  303. package/lib/index.mjs +22 -0
  304. package/lib/index.mjs.map +1 -0
  305. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts +17 -0
  306. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +1 -0
  307. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs +31 -0
  308. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +1 -0
  309. package/lib/localOdspDriver/{localOdspDocumentService.d.ts → localOdspDocumentService.d.mts} +4 -3
  310. package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -0
  311. package/lib/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.mjs} +8 -6
  312. package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -0
  313. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.ts → localOdspDocumentServiceFactory.d.mts} +5 -6
  314. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +1 -0
  315. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.mjs} +9 -10
  316. package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +1 -0
  317. package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.ts → localOdspDocumentStorageManager.d.mts} +4 -4
  318. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -0
  319. package/lib/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.mjs} +11 -9
  320. package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -0
  321. package/lib/odsp-driver-alpha.d.mts +496 -0
  322. package/lib/odsp-driver-beta.d.mts +160 -0
  323. package/lib/odsp-driver-public.d.mts +160 -0
  324. package/lib/odsp-driver-untrimmed.d.mts +565 -0
  325. package/lib/{odspCache.d.ts → odspCache.d.mts} +20 -9
  326. package/lib/odspCache.d.mts.map +1 -0
  327. package/lib/{odspCache.js → odspCache.mjs} +6 -11
  328. package/lib/odspCache.mjs.map +1 -0
  329. package/lib/odspDelayLoadedDeltaStream.d.mts +75 -0
  330. package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -0
  331. package/lib/odspDelayLoadedDeltaStream.mjs +287 -0
  332. package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -0
  333. package/lib/{odspDeltaStorageService.d.ts → odspDeltaStorageService.d.mts} +10 -8
  334. package/lib/odspDeltaStorageService.d.mts.map +1 -0
  335. package/lib/{odspDeltaStorageService.js → odspDeltaStorageService.mjs} +70 -68
  336. package/lib/odspDeltaStorageService.mjs.map +1 -0
  337. package/lib/{odspDocumentDeltaConnection.d.ts → odspDocumentDeltaConnection.d.mts} +34 -14
  338. package/lib/odspDocumentDeltaConnection.d.mts.map +1 -0
  339. package/lib/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.mjs} +214 -103
  340. package/lib/odspDocumentDeltaConnection.mjs.map +1 -0
  341. package/lib/{odspDocumentService.d.ts → odspDocumentService.d.mts} +15 -29
  342. package/lib/odspDocumentService.d.mts.map +1 -0
  343. package/lib/odspDocumentService.mjs +221 -0
  344. package/lib/odspDocumentService.mjs.map +1 -0
  345. package/lib/{odspDocumentServiceFactory.d.ts → odspDocumentServiceFactory.d.mts} +6 -2
  346. package/lib/odspDocumentServiceFactory.d.mts.map +1 -0
  347. package/lib/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.mjs} +8 -6
  348. package/lib/odspDocumentServiceFactory.mjs.map +1 -0
  349. package/lib/{odspDocumentServiceFactoryCore.d.ts → odspDocumentServiceFactoryCore.d.mts} +20 -13
  350. package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -0
  351. package/lib/odspDocumentServiceFactoryCore.mjs +192 -0
  352. package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -0
  353. package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.ts → odspDocumentServiceFactoryWithCodeSplit.d.mts} +7 -2
  354. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +1 -0
  355. package/lib/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.mjs} +8 -3
  356. package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +1 -0
  357. package/lib/{odspDocumentStorageManager.d.ts → odspDocumentStorageManager.d.mts} +18 -12
  358. package/lib/odspDocumentStorageManager.d.mts.map +1 -0
  359. package/lib/odspDocumentStorageManager.mjs +486 -0
  360. package/lib/odspDocumentStorageManager.mjs.map +1 -0
  361. package/lib/{odspDocumentStorageServiceBase.d.ts → odspDocumentStorageServiceBase.d.mts} +9 -11
  362. package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -0
  363. package/lib/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.mjs} +31 -33
  364. package/lib/odspDocumentStorageServiceBase.mjs.map +1 -0
  365. package/lib/{odspDriverUrlResolver.d.ts → odspDriverUrlResolver.d.mts} +13 -1
  366. package/lib/odspDriverUrlResolver.d.mts.map +1 -0
  367. package/lib/{odspDriverUrlResolver.js → odspDriverUrlResolver.mjs} +50 -40
  368. package/lib/odspDriverUrlResolver.mjs.map +1 -0
  369. package/lib/{odspDriverUrlResolverForShareLink.d.ts → odspDriverUrlResolverForShareLink.d.mts} +7 -5
  370. package/lib/odspDriverUrlResolverForShareLink.d.mts.map +1 -0
  371. package/lib/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.mjs} +36 -29
  372. package/lib/odspDriverUrlResolverForShareLink.mjs.map +1 -0
  373. package/lib/{odspError.d.ts → odspError.d.mts} +2 -2
  374. package/lib/odspError.d.mts.map +1 -0
  375. package/lib/{odspError.js → odspError.mjs} +7 -3
  376. package/lib/odspError.mjs.map +1 -0
  377. package/lib/{odspFluidFileLink.d.ts → odspFluidFileLink.d.mts} +12 -3
  378. package/lib/odspFluidFileLink.d.mts.map +1 -0
  379. package/lib/{odspFluidFileLink.js → odspFluidFileLink.mjs} +23 -16
  380. package/lib/odspFluidFileLink.mjs.map +1 -0
  381. package/lib/odspLocationRedirection.d.mts +14 -0
  382. package/lib/odspLocationRedirection.d.mts.map +1 -0
  383. package/lib/odspLocationRedirection.mjs +20 -0
  384. package/lib/odspLocationRedirection.mjs.map +1 -0
  385. package/lib/{odspPublicUtils.d.ts → odspPublicUtils.d.mts} +7 -1
  386. package/lib/odspPublicUtils.d.mts.map +1 -0
  387. package/lib/{odspPublicUtils.js → odspPublicUtils.mjs} +5 -2
  388. package/lib/odspPublicUtils.mjs.map +1 -0
  389. package/lib/{odspSnapshotParser.d.ts → odspSnapshotParser.d.mts} +3 -3
  390. package/lib/odspSnapshotParser.d.mts.map +1 -0
  391. package/lib/{odspSnapshotParser.js → odspSnapshotParser.mjs} +10 -11
  392. package/lib/odspSnapshotParser.mjs.map +1 -0
  393. package/lib/{odspSummaryUploadManager.d.ts → odspSummaryUploadManager.d.mts} +9 -6
  394. package/lib/odspSummaryUploadManager.d.mts.map +1 -0
  395. package/lib/{odspSummaryUploadManager.js → odspSummaryUploadManager.mjs} +41 -32
  396. package/lib/odspSummaryUploadManager.mjs.map +1 -0
  397. package/lib/{odspUrlHelper.d.ts → odspUrlHelper.d.mts} +6 -1
  398. package/lib/odspUrlHelper.d.mts.map +1 -0
  399. package/lib/{odspUrlHelper.js → odspUrlHelper.mjs} +9 -3
  400. package/lib/odspUrlHelper.mjs.map +1 -0
  401. package/lib/{odspUtils.d.ts → odspUtils.d.mts} +37 -8
  402. package/lib/odspUtils.d.mts.map +1 -0
  403. package/lib/{odspUtils.js → odspUtils.mjs} +109 -27
  404. package/lib/odspUtils.mjs.map +1 -0
  405. package/lib/{opsCaching.d.ts → opsCaching.d.mts} +4 -4
  406. package/lib/opsCaching.d.mts.map +1 -0
  407. package/lib/{opsCaching.js → opsCaching.mjs} +23 -7
  408. package/lib/opsCaching.mjs.map +1 -0
  409. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
  410. package/lib/packageVersion.d.mts.map +1 -0
  411. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  412. package/lib/packageVersion.mjs.map +1 -0
  413. package/lib/{prefetchLatestSnapshot.d.ts → prefetchLatestSnapshot.d.mts} +14 -9
  414. package/lib/prefetchLatestSnapshot.d.mts.map +1 -0
  415. package/lib/prefetchLatestSnapshot.mjs +96 -0
  416. package/lib/prefetchLatestSnapshot.mjs.map +1 -0
  417. package/lib/{retryErrorsStorageAdapter.d.ts → retryErrorsStorageAdapter.d.mts} +6 -5
  418. package/lib/retryErrorsStorageAdapter.d.mts.map +1 -0
  419. package/lib/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.mjs} +13 -6
  420. package/lib/retryErrorsStorageAdapter.mjs.map +1 -0
  421. package/lib/{retryUtils.d.ts → retryUtils.d.mts} +3 -3
  422. package/lib/retryUtils.d.mts.map +1 -0
  423. package/lib/{retryUtils.js → retryUtils.mjs} +27 -11
  424. package/lib/retryUtils.mjs.map +1 -0
  425. package/lib/socketModule.d.mts +7 -0
  426. package/lib/socketModule.d.mts.map +1 -0
  427. package/lib/socketModule.mjs +7 -0
  428. package/lib/socketModule.mjs.map +1 -0
  429. package/lib/{vroom.d.ts → vroom.d.mts} +7 -7
  430. package/lib/vroom.d.mts.map +1 -0
  431. package/lib/{vroom.js → vroom.mjs} +24 -9
  432. package/lib/vroom.mjs.map +1 -0
  433. package/lib/{zipItDataRepresentationUtils.d.ts → zipItDataRepresentationUtils.d.mts} +49 -22
  434. package/lib/zipItDataRepresentationUtils.d.mts.map +1 -0
  435. package/lib/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.mjs} +213 -111
  436. package/lib/zipItDataRepresentationUtils.mjs.map +1 -0
  437. package/package.json +87 -69
  438. package/prettier.config.cjs +8 -0
  439. package/src/ReadBufferUtils.ts +51 -44
  440. package/src/WriteBufferUtils.ts +203 -181
  441. package/src/checkUrl.ts +16 -15
  442. package/src/compactSnapshotParser.ts +219 -103
  443. package/src/compactSnapshotWriter.ts +118 -97
  444. package/src/constants.ts +7 -0
  445. package/src/contracts.ts +96 -136
  446. package/src/contractsPublic.ts +31 -16
  447. package/src/createFile.ts +243 -305
  448. package/src/createNewContainerOnExistingFile.ts +93 -0
  449. package/src/createNewModule.ts +7 -0
  450. package/src/createNewUtils.ts +266 -56
  451. package/src/createOdspCreateContainerRequest.ts +22 -18
  452. package/src/createOdspUrl.ts +12 -13
  453. package/src/epochTracker.ts +596 -457
  454. package/src/fetch.ts +4 -4
  455. package/src/fetchSnapshot.ts +583 -508
  456. package/src/getFileLink.ts +194 -155
  457. package/src/getQueryString.ts +11 -9
  458. package/src/getUrlAndHeadersWithAuth.ts +34 -33
  459. package/src/index.ts +42 -18
  460. package/src/localOdspDriver/localOdspDeltaStorageService.ts +49 -0
  461. package/src/localOdspDriver/localOdspDocumentService.ts +40 -38
  462. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +46 -43
  463. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +55 -50
  464. package/src/odspCache.ts +112 -90
  465. package/src/odspDelayLoadedDeltaStream.ts +459 -0
  466. package/src/odspDeltaStorageService.ts +232 -221
  467. package/src/odspDocumentDeltaConnection.ts +751 -563
  468. package/src/odspDocumentService.ts +324 -523
  469. package/src/odspDocumentServiceFactory.ts +20 -21
  470. package/src/odspDocumentServiceFactoryCore.ts +329 -200
  471. package/src/odspDocumentServiceFactoryWithCodeSplit.ts +20 -20
  472. package/src/odspDocumentStorageManager.ts +730 -534
  473. package/src/odspDocumentStorageServiceBase.ts +279 -254
  474. package/src/odspDriverUrlResolver.ts +230 -188
  475. package/src/odspDriverUrlResolverForShareLink.ts +223 -203
  476. package/src/odspError.ts +27 -19
  477. package/src/odspFluidFileLink.ts +106 -87
  478. package/src/odspLocationRedirection.ts +26 -0
  479. package/src/odspPublicUtils.ts +20 -14
  480. package/src/odspSnapshotParser.ts +53 -46
  481. package/src/odspSummaryUploadManager.ts +243 -218
  482. package/src/odspUrlHelper.ts +81 -71
  483. package/src/odspUtils.ts +401 -259
  484. package/src/opsCaching.ts +214 -193
  485. package/src/packageVersion.ts +1 -1
  486. package/src/prefetchLatestSnapshot.ts +142 -80
  487. package/src/retryErrorsStorageAdapter.ts +92 -77
  488. package/src/retryUtils.ts +80 -57
  489. package/src/socketModule.ts +8 -0
  490. package/src/vroom.ts +92 -83
  491. package/src/zipItDataRepresentationUtils.ts +534 -394
  492. package/tsc-multi.test.json +4 -0
  493. package/tsconfig.json +11 -13
  494. package/.editorconfig +0 -7
  495. package/dist/ReadBufferUtils.js.map +0 -1
  496. package/dist/WriteBufferUtils.js.map +0 -1
  497. package/dist/checkUrl.js.map +0 -1
  498. package/dist/compactSnapshotParser.js +0 -115
  499. package/dist/compactSnapshotParser.js.map +0 -1
  500. package/dist/compactSnapshotWriter.js.map +0 -1
  501. package/dist/constants.js.map +0 -1
  502. package/dist/contracts.js.map +0 -1
  503. package/dist/contractsPublic.js.map +0 -1
  504. package/dist/createFile.js +0 -242
  505. package/dist/createFile.js.map +0 -1
  506. package/dist/createNewUtils.js +0 -67
  507. package/dist/createNewUtils.js.map +0 -1
  508. package/dist/createOdspCreateContainerRequest.js.map +0 -1
  509. package/dist/createOdspUrl.js.map +0 -1
  510. package/dist/epochTracker.js.map +0 -1
  511. package/dist/fetch.js.map +0 -1
  512. package/dist/fetchSnapshot.js.map +0 -1
  513. package/dist/getFileLink.js.map +0 -1
  514. package/dist/getQueryString.js.map +0 -1
  515. package/dist/getSocketIo.d.ts +0 -11
  516. package/dist/getSocketIo.d.ts.map +0 -1
  517. package/dist/getSocketIo.js +0 -20
  518. package/dist/getSocketIo.js.map +0 -1
  519. package/dist/getUrlAndHeadersWithAuth.js.map +0 -1
  520. package/dist/index.js +0 -41
  521. package/dist/index.js.map +0 -1
  522. package/dist/localOdspDriver/localOdspDocumentService.js.map +0 -1
  523. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  524. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  525. package/dist/odspCache.js.map +0 -1
  526. package/dist/odspDeltaStorageService.js.map +0 -1
  527. package/dist/odspDocumentDeltaConnection.js.map +0 -1
  528. package/dist/odspDocumentService.js +0 -364
  529. package/dist/odspDocumentService.js.map +0 -1
  530. package/dist/odspDocumentServiceFactory.js.map +0 -1
  531. package/dist/odspDocumentServiceFactoryCore.js +0 -118
  532. package/dist/odspDocumentServiceFactoryCore.js.map +0 -1
  533. package/dist/odspDocumentServiceFactoryWithCodeSplit.js +0 -34
  534. package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  535. package/dist/odspDocumentStorageManager.js +0 -356
  536. package/dist/odspDocumentStorageManager.js.map +0 -1
  537. package/dist/odspDocumentStorageServiceBase.js.map +0 -1
  538. package/dist/odspDriverUrlResolver.js.map +0 -1
  539. package/dist/odspDriverUrlResolverForShareLink.js.map +0 -1
  540. package/dist/odspError.js.map +0 -1
  541. package/dist/odspFluidFileLink.js.map +0 -1
  542. package/dist/odspPublicUtils.js.map +0 -1
  543. package/dist/odspSnapshotParser.js.map +0 -1
  544. package/dist/odspSummaryUploadManager.js.map +0 -1
  545. package/dist/odspUrlHelper.js.map +0 -1
  546. package/dist/odspUtils.js.map +0 -1
  547. package/dist/opsCaching.js.map +0 -1
  548. package/dist/packageVersion.js.map +0 -1
  549. package/dist/prefetchLatestSnapshot.js +0 -57
  550. package/dist/prefetchLatestSnapshot.js.map +0 -1
  551. package/dist/retryErrorsStorageAdapter.js.map +0 -1
  552. package/dist/retryUtils.js.map +0 -1
  553. package/dist/vroom.js.map +0 -1
  554. package/dist/zipItDataRepresentationUtils.js.map +0 -1
  555. package/lib/ReadBufferUtils.d.ts.map +0 -1
  556. package/lib/ReadBufferUtils.js.map +0 -1
  557. package/lib/WriteBufferUtils.d.ts.map +0 -1
  558. package/lib/WriteBufferUtils.js.map +0 -1
  559. package/lib/checkUrl.d.ts.map +0 -1
  560. package/lib/checkUrl.js.map +0 -1
  561. package/lib/compactSnapshotParser.d.ts +0 -15
  562. package/lib/compactSnapshotParser.d.ts.map +0 -1
  563. package/lib/compactSnapshotParser.js +0 -111
  564. package/lib/compactSnapshotParser.js.map +0 -1
  565. package/lib/compactSnapshotWriter.d.ts.map +0 -1
  566. package/lib/compactSnapshotWriter.js.map +0 -1
  567. package/lib/constants.d.ts.map +0 -1
  568. package/lib/constants.js.map +0 -1
  569. package/lib/contracts.d.ts.map +0 -1
  570. package/lib/contracts.js.map +0 -1
  571. package/lib/contractsPublic.d.ts.map +0 -1
  572. package/lib/contractsPublic.js.map +0 -1
  573. package/lib/createFile.d.ts +0 -22
  574. package/lib/createFile.d.ts.map +0 -1
  575. package/lib/createFile.js +0 -235
  576. package/lib/createFile.js.map +0 -1
  577. package/lib/createNewUtils.d.ts +0 -11
  578. package/lib/createNewUtils.d.ts.map +0 -1
  579. package/lib/createNewUtils.js +0 -63
  580. package/lib/createNewUtils.js.map +0 -1
  581. package/lib/createOdspCreateContainerRequest.d.ts.map +0 -1
  582. package/lib/createOdspCreateContainerRequest.js.map +0 -1
  583. package/lib/createOdspUrl.d.ts.map +0 -1
  584. package/lib/createOdspUrl.js.map +0 -1
  585. package/lib/epochTracker.d.ts.map +0 -1
  586. package/lib/epochTracker.js.map +0 -1
  587. package/lib/fetch.d.ts.map +0 -1
  588. package/lib/fetch.js.map +0 -1
  589. package/lib/fetchSnapshot.d.ts.map +0 -1
  590. package/lib/fetchSnapshot.js.map +0 -1
  591. package/lib/getFileLink.d.ts.map +0 -1
  592. package/lib/getFileLink.js.map +0 -1
  593. package/lib/getQueryString.d.ts.map +0 -1
  594. package/lib/getQueryString.js.map +0 -1
  595. package/lib/getSocketIo.d.ts +0 -11
  596. package/lib/getSocketIo.d.ts.map +0 -1
  597. package/lib/getSocketIo.js +0 -13
  598. package/lib/getSocketIo.js.map +0 -1
  599. package/lib/getUrlAndHeadersWithAuth.d.ts.map +0 -1
  600. package/lib/getUrlAndHeadersWithAuth.js.map +0 -1
  601. package/lib/index.d.ts +0 -21
  602. package/lib/index.d.ts.map +0 -1
  603. package/lib/index.js +0 -29
  604. package/lib/index.js.map +0 -1
  605. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +0 -1
  606. package/lib/localOdspDriver/localOdspDocumentService.js.map +0 -1
  607. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +0 -1
  608. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  609. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +0 -1
  610. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  611. package/lib/odspCache.d.ts.map +0 -1
  612. package/lib/odspCache.js.map +0 -1
  613. package/lib/odspDeltaStorageService.d.ts.map +0 -1
  614. package/lib/odspDeltaStorageService.js.map +0 -1
  615. package/lib/odspDocumentDeltaConnection.d.ts.map +0 -1
  616. package/lib/odspDocumentDeltaConnection.js.map +0 -1
  617. package/lib/odspDocumentService.d.ts.map +0 -1
  618. package/lib/odspDocumentService.js +0 -360
  619. package/lib/odspDocumentService.js.map +0 -1
  620. package/lib/odspDocumentServiceFactory.d.ts.map +0 -1
  621. package/lib/odspDocumentServiceFactory.js.map +0 -1
  622. package/lib/odspDocumentServiceFactoryCore.d.ts.map +0 -1
  623. package/lib/odspDocumentServiceFactoryCore.js +0 -114
  624. package/lib/odspDocumentServiceFactoryCore.js.map +0 -1
  625. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +0 -1
  626. package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  627. package/lib/odspDocumentStorageManager.d.ts.map +0 -1
  628. package/lib/odspDocumentStorageManager.js +0 -352
  629. package/lib/odspDocumentStorageManager.js.map +0 -1
  630. package/lib/odspDocumentStorageServiceBase.d.ts.map +0 -1
  631. package/lib/odspDocumentStorageServiceBase.js.map +0 -1
  632. package/lib/odspDriverUrlResolver.d.ts.map +0 -1
  633. package/lib/odspDriverUrlResolver.js.map +0 -1
  634. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +0 -1
  635. package/lib/odspDriverUrlResolverForShareLink.js.map +0 -1
  636. package/lib/odspError.d.ts.map +0 -1
  637. package/lib/odspError.js.map +0 -1
  638. package/lib/odspFluidFileLink.d.ts.map +0 -1
  639. package/lib/odspFluidFileLink.js.map +0 -1
  640. package/lib/odspPublicUtils.d.ts.map +0 -1
  641. package/lib/odspPublicUtils.js.map +0 -1
  642. package/lib/odspSnapshotParser.d.ts.map +0 -1
  643. package/lib/odspSnapshotParser.js.map +0 -1
  644. package/lib/odspSummaryUploadManager.d.ts.map +0 -1
  645. package/lib/odspSummaryUploadManager.js.map +0 -1
  646. package/lib/odspUrlHelper.d.ts.map +0 -1
  647. package/lib/odspUrlHelper.js.map +0 -1
  648. package/lib/odspUtils.d.ts.map +0 -1
  649. package/lib/odspUtils.js.map +0 -1
  650. package/lib/opsCaching.d.ts.map +0 -1
  651. package/lib/opsCaching.js.map +0 -1
  652. package/lib/packageVersion.d.ts.map +0 -1
  653. package/lib/packageVersion.js.map +0 -1
  654. package/lib/prefetchLatestSnapshot.d.ts.map +0 -1
  655. package/lib/prefetchLatestSnapshot.js +0 -53
  656. package/lib/prefetchLatestSnapshot.js.map +0 -1
  657. package/lib/retryErrorsStorageAdapter.d.ts.map +0 -1
  658. package/lib/retryErrorsStorageAdapter.js.map +0 -1
  659. package/lib/retryUtils.d.ts.map +0 -1
  660. package/lib/retryUtils.js.map +0 -1
  661. package/lib/vroom.d.ts.map +0 -1
  662. package/lib/vroom.js.map +0 -1
  663. package/lib/zipItDataRepresentationUtils.d.ts.map +0 -1
  664. package/lib/zipItDataRepresentationUtils.js.map +0 -1
  665. package/src/getSocketIo.ts +0 -14
  666. package/tsconfig.esnext.json +0 -7
@@ -3,9 +3,25 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ISummaryTree } from "@fluidframework/protocol-definitions";
6
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
7
+ import { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions";
8
+ import { IOdspSummaryPayload } from "./contracts";
6
9
  import { ISnapshotContents } from "./odspPublicUtils";
10
+ import { EpochTracker, FetchType } from "./epochTracker";
7
11
  /**
8
12
  * Converts a summary(ISummaryTree) taken in detached container to snapshot tree and blobs
9
13
  */
10
14
  export declare function convertCreateNewSummaryTreeToTreeAndBlobs(summary: ISummaryTree, treeId: string): ISnapshotContents;
15
+ export declare function convertSummaryIntoContainerSnapshot(createNewSummary: ISummaryTree): IOdspSummaryPayload;
16
+ export declare function createNewFluidContainerCore<T>(args: {
17
+ containerSnapshot: IOdspSummaryPayload;
18
+ getStorageToken: InstrumentedStorageTokenFetcher;
19
+ logger: ITelemetryLoggerExt;
20
+ initialUrl: string;
21
+ forceAccessTokenViaAuthorizationHeader: boolean;
22
+ epochTracker: EpochTracker;
23
+ telemetryName: string;
24
+ fetchType: FetchType;
25
+ validateResponseCallback?: (content: T) => void;
26
+ }): Promise<T>;
11
27
  //# sourceMappingURL=createNewUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createNewUtils.d.ts","sourceRoot":"","sources":["../src/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAe,MAAM,sCAAsC,CAAC;AAGjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD;;GAEG;AACH,wBAAgB,yCAAyC,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAgBlH"}
1
+ {"version":3,"file":"createNewUtils.d.ts","sourceRoot":"","sources":["../src/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAEN,YAAY,EAGZ,MAAM,sCAAsC,CAAC;AAQ9C,OAAO,EAAE,mBAAmB,EAAoB,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EACN,mBAAmB,EAInB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIzD;;GAEG;AACH,wBAAgB,yCAAyC,CACxD,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,GACZ,iBAAiB,CAgBnB;AA6CD,wBAAgB,mCAAmC,CAAC,gBAAgB,EAAE,YAAY,uBA2BjF;AA6DD,wBAAsB,2BAA2B,CAAC,CAAC,EAAE,IAAI,EAAE;IAC1D,iBAAiB,EAAE,mBAAmB,CAAC;IACvC,eAAe,EAAE,+BAA+B,CAAC;IACjD,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC,EAAE,OAAO,CAAC;IAChD,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,wBAAwB,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;CAChD,GAAG,OAAO,CAAC,CAAC,CAAC,CAmFb"}
@@ -2,17 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createOdspCreateContainerRequest = void 0;
4
4
  const driver_definitions_1 = require("@fluidframework/driver-definitions");
5
+ const odspUtils_1 = require("./odspUtils.cjs");
5
6
  /**
6
7
  * Create the request object with url and headers for creating a new file on OneDrive Sharepoint
7
8
  * @param siteUrl - Base url for OneDrive
8
9
  * @param driveId - drive identifier
9
10
  * @param filePath - path where file needs to be created
10
11
  * @param fileName - name of the new file to be created
11
- * @param createLinkType - type of sharing link you would like to create for this file
12
+ * @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes
13
+ * will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink
14
+ * @alpha
12
15
  */
13
- function createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName, createLinkType) {
16
+ function createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName, createShareLinkType) {
17
+ const shareLinkRequestParams = (0, odspUtils_1.buildOdspShareLinkReqParams)(createShareLinkType);
14
18
  const createNewRequest = {
15
- url: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(filePath)}${createLinkType ? `&createLinkType=${createLinkType}` : ""}`,
19
+ url: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(filePath)}${shareLinkRequestParams ? `&${shareLinkRequestParams}` : ""}`,
16
20
  headers: {
17
21
  [driver_definitions_1.DriverHeader.createNew]: {
18
22
  fileName,
@@ -22,4 +26,4 @@ function createOdspCreateContainerRequest(siteUrl, driveId, filePath, fileName,
22
26
  return createNewRequest;
23
27
  }
24
28
  exports.createOdspCreateContainerRequest = createOdspCreateContainerRequest;
25
- //# sourceMappingURL=createOdspCreateContainerRequest.js.map
29
+ //# sourceMappingURL=createOdspCreateContainerRequest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createOdspCreateContainerRequest.cjs","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":";;;AAKA,2EAAkE;AAElE,+CAA0D;AAE1D;;;;;;;;;GASG;AACH,SAAgB,gCAAgC,CAC/C,OAAe,EACf,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,mBAAuD;IAEvD,MAAM,sBAAsB,GAAG,IAAA,uCAA2B,EAAC,mBAAmB,CAAC,CAAC;IAChF,MAAM,gBAAgB,GAAa;QAClC,GAAG,EAAE,GAAG,OAAO,YAAY,kBAAkB,CAAC,OAAO,CAAC,SAAS,kBAAkB,CAChF,QAAQ,CACR,GAAG,sBAAsB,CAAC,CAAC,CAAC,IAAI,sBAAsB,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;QAChE,OAAO,EAAE;YACR,CAAC,iCAAY,CAAC,SAAS,CAAC,EAAE;gBACzB,QAAQ;aACR;SACD;KACD,CAAC;IACF,OAAO,gBAAgB,CAAC;AACzB,CAAC;AAnBD,4EAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { DriverHeader } from \"@fluidframework/driver-definitions\";\nimport { ShareLinkTypes, ISharingLinkKind } from \"@fluidframework/odsp-driver-definitions\";\nimport { buildOdspShareLinkReqParams } from \"./odspUtils\";\n\n/**\n * Create the request object with url and headers for creating a new file on OneDrive Sharepoint\n * @param siteUrl - Base url for OneDrive\n * @param driveId - drive identifier\n * @param filePath - path where file needs to be created\n * @param fileName - name of the new file to be created\n * @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes\n * will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink\n * @alpha\n */\nexport function createOdspCreateContainerRequest(\n\tsiteUrl: string,\n\tdriveId: string,\n\tfilePath: string,\n\tfileName: string,\n\tcreateShareLinkType?: ShareLinkTypes | ISharingLinkKind,\n): IRequest {\n\tconst shareLinkRequestParams = buildOdspShareLinkReqParams(createShareLinkType);\n\tconst createNewRequest: IRequest = {\n\t\turl: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(\n\t\t\tfilePath,\n\t\t)}${shareLinkRequestParams ? `&${shareLinkRequestParams}` : \"\"}`,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: {\n\t\t\t\tfileName,\n\t\t\t},\n\t\t},\n\t};\n\treturn createNewRequest;\n}\n"]}
@@ -3,14 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IRequest } from "@fluidframework/core-interfaces";
6
- import { ShareLinkTypes } from "@fluidframework/odsp-driver-definitions";
6
+ import { ShareLinkTypes, ISharingLinkKind } from "@fluidframework/odsp-driver-definitions";
7
7
  /**
8
8
  * Create the request object with url and headers for creating a new file on OneDrive Sharepoint
9
9
  * @param siteUrl - Base url for OneDrive
10
10
  * @param driveId - drive identifier
11
11
  * @param filePath - path where file needs to be created
12
12
  * @param fileName - name of the new file to be created
13
- * @param createLinkType - type of sharing link you would like to create for this file
13
+ * @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes
14
+ * will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink
15
+ * @alpha
14
16
  */
15
- export declare function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string, createLinkType?: ShareLinkTypes): IRequest;
17
+ export declare function createOdspCreateContainerRequest(siteUrl: string, driveId: string, filePath: string, fileName: string, createShareLinkType?: ShareLinkTypes | ISharingLinkKind): IRequest;
16
18
  //# sourceMappingURL=createOdspCreateContainerRequest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createOdspCreateContainerRequest.d.ts","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC5C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,cAAc,GAChC,QAAQ,CAYV"}
1
+ {"version":3,"file":"createOdspCreateContainerRequest.d.ts","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAG3F;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC/C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,cAAc,GAAG,gBAAgB,GACrD,QAAQ,CAaV"}
@@ -11,6 +11,7 @@ exports.createOdspUrl = void 0;
11
11
  /**
12
12
  * Encodes ODC/SPO information into a URL format that can be handled by the Loader
13
13
  * @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it
14
+ * @alpha
14
15
  */
15
16
  function createOdspUrl(l) {
16
17
  let odspUrl = `${l.siteUrl}?driveId=${encodeURIComponent(l.driveId)}&itemId=${encodeURIComponent(l.itemId)}&path=${encodeURIComponent(l.dataStorePath)}`;
@@ -23,4 +24,4 @@ function createOdspUrl(l) {
23
24
  return odspUrl;
24
25
  }
25
26
  exports.createOdspUrl = createOdspUrl;
26
- //# sourceMappingURL=createOdspUrl.js.map
27
+ //# sourceMappingURL=createOdspUrl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createOdspUrl.cjs","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;GAEG;AAEH;;;;GAIG;AACH,SAAgB,aAAa,CAAC,CAA4B;IACzD,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,YAAY,kBAAkB,CACvD,CAAC,CAAC,OAAO,CACT,WAAW,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;IACvF,IAAI,CAAC,CAAC,oBAAoB,EAAE;QAC3B,OAAO,IAAI,yBAAyB,kBAAkB,CAAC,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC;KACjF;IACD,IAAI,CAAC,CAAC,WAAW,EAAE;QAClB,OAAO,IAAI,gBAAgB,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;KAC/D;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAZD,sCAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { OdspFluidDataStoreLocator } from \"./contractsPublic\";\n\n/*\n * Per https://github.com/microsoft/FluidFramework/issues/1556, isolating createOdspUrl() in its own file.\n */\n\n/**\n * Encodes ODC/SPO information into a URL format that can be handled by the Loader\n * @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it\n * @alpha\n */\nexport function createOdspUrl(l: OdspFluidDataStoreLocator): string {\n\tlet odspUrl = `${l.siteUrl}?driveId=${encodeURIComponent(\n\t\tl.driveId,\n\t)}&itemId=${encodeURIComponent(l.itemId)}&path=${encodeURIComponent(l.dataStorePath)}`;\n\tif (l.containerPackageName) {\n\t\todspUrl += `&containerPackageName=${encodeURIComponent(l.containerPackageName)}`;\n\t}\n\tif (l.fileVersion) {\n\t\todspUrl += `&fileVersion=${encodeURIComponent(l.fileVersion)}`;\n\t}\n\n\treturn odspUrl;\n}\n"]}
@@ -6,6 +6,7 @@ import { OdspFluidDataStoreLocator } from "./contractsPublic";
6
6
  /**
7
7
  * Encodes ODC/SPO information into a URL format that can be handled by the Loader
8
8
  * @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it
9
+ * @alpha
9
10
  */
10
11
  export declare function createOdspUrl(l: OdspFluidDataStoreLocator): string;
11
12
  //# sourceMappingURL=createOdspUrl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createOdspUrl.d.ts","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAM9D;;;GAGG;AACH,wBAAgB,aAAa,CACzB,CAAC,EAAE,yBAAyB,GAC7B,MAAM,CAYR"}
1
+ {"version":3,"file":"createOdspUrl.d.ts","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAM9D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,yBAAyB,GAAG,MAAM,CAYlE"}
@@ -6,23 +6,34 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.createOdspCacheAndTracker = exports.EpochTrackerWithRedemption = exports.EpochTracker = exports.defaultCacheExpiryTimeoutMs = exports.Odsp409Error = void 0;
8
8
  const uuid_1 = require("uuid");
9
- const common_utils_1 = require("@fluidframework/common-utils");
9
+ const core_utils_1 = require("@fluidframework/core-utils");
10
+ const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
10
11
  const driver_utils_1 = require("@fluidframework/driver-utils");
11
12
  const odsp_driver_definitions_1 = require("@fluidframework/odsp-driver-definitions");
12
13
  const driver_definitions_1 = require("@fluidframework/driver-definitions");
13
- const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
14
- const odspUtils_1 = require("./odspUtils");
15
- const contracts_1 = require("./contracts");
16
- const contractsPublic_1 = require("./contractsPublic");
17
- const packageVersion_1 = require("./packageVersion");
14
+ const odspUtils_1 = require("./odspUtils.cjs");
15
+ const contracts_1 = require("./contracts.cjs");
16
+ const contractsPublic_1 = require("./contractsPublic.cjs");
17
+ const packageVersion_1 = require("./packageVersion.cjs");
18
+ const odspLocationRedirection_1 = require("./odspLocationRedirection.cjs");
18
19
  exports.Odsp409Error = "Odsp409Error";
19
- // Please update the README file in odsp-driver-definitions if you change the defaultCacheExpiryTimeoutMs.
20
- exports.defaultCacheExpiryTimeoutMs = 2 * 24 * 60 * 60 * 1000;
20
+ // Must be less than policy of 5 days
21
+ exports.defaultCacheExpiryTimeoutMs = 2 * 24 * 60 * 60 * 1000; // 2 days in ms
21
22
  /**
23
+ * In ODSP, the concept of "epoch" refers to binary updates to files. For example, this might include using
24
+ * version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch
25
+ * value being incremented.
26
+ *
27
+ * The implications of these binary updates is that the Fluid state is disrupted: the sequence number might
28
+ * go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's
29
+ * not safe to continue collaboration across an epoch change. We need to detect these epoch changes and
30
+ * error out from the collaboration.
31
+ *
22
32
  * This class is a wrapper around fetch calls. It adds epoch to the request made so that the
23
33
  * server can match it with its epoch value in order to match the version.
24
34
  * It also validates the epoch value received in response of fetch calls. If the epoch does not match,
25
35
  * then it also clears all the cached entries for the given container.
36
+ * @alpha
26
37
  */
27
38
  class EpochTracker {
28
39
  constructor(cache, fileEntry, logger, clientIsSummarizer) {
@@ -35,10 +46,14 @@ class EpochTracker {
35
46
  this.networkCallNumber = 1;
36
47
  // Limits the max number of concurrent requests to 24.
37
48
  this.rateLimiter = new driver_utils_1.RateLimiter(24);
49
+ // Matches the TestOverride logic for the policy defined in odspDocumentStorageServiceBase.ts
50
+ this.snapshotCacheExpiryTimeoutMs = (0, telemetry_utils_1.loggerToMonitoringContext)(logger).config.getBoolean("Fluid.Driver.Odsp.TestOverride.DisableSnapshotCache")
51
+ ? 0
52
+ : exports.defaultCacheExpiryTimeoutMs;
38
53
  }
39
54
  // public for UT purposes only!
40
55
  setEpoch(epoch, fromCache, fetchType) {
41
- (0, common_utils_1.assert)(this._fluidEpoch === undefined, 0x1db /* "epoch exists" */);
56
+ (0, core_utils_1.assert)(this._fluidEpoch === undefined, 0x1db /* "epoch exists" */);
42
57
  this._fluidEpoch = epoch;
43
58
  this.logger.sendTelemetryEvent({
44
59
  eventName: "EpochLearnedFirstTime",
@@ -48,7 +63,6 @@ class EpochTracker {
48
63
  });
49
64
  }
50
65
  async get(entry) {
51
- var _a;
52
66
  try {
53
67
  // Return undefined so that the ops/snapshots are grabbed from the server instead of the cache
54
68
  const value = await this.cache.get(this.fileEntryFromEntry(entry));
@@ -57,7 +71,7 @@ class EpochTracker {
57
71
  if (value === undefined || value.version !== contracts_1.persistedCacheValueVersion) {
58
72
  return undefined;
59
73
  }
60
- (0, common_utils_1.assert)(value.fluidEpoch !== undefined, 0x1dc /* "all entries have to have epoch" */);
74
+ (0, core_utils_1.assert)(value.fluidEpoch !== undefined, 0x1dc /* "all entries have to have epoch" */);
61
75
  if (this._fluidEpoch === undefined) {
62
76
  this.setEpoch(value.fluidEpoch, true, "cache");
63
77
  // Epoch mismatch, the cached value is considerably different from what the current state of
@@ -66,16 +80,17 @@ class EpochTracker {
66
80
  else if (this._fluidEpoch !== value.fluidEpoch) {
67
81
  return undefined;
68
82
  }
69
- // Expire the cached snapshot if it's older than the defaultCacheExpiryTimeoutMs and immediately
83
+ // Expire the cached snapshot if it's older than snapshotCacheExpiryTimeoutMs and immediately
70
84
  // expire all old caches that do not have cacheEntryTime
71
85
  if (entry.type === odsp_driver_definitions_1.snapshotKey) {
72
- const cacheTime = (_a = value.value) === null || _a === void 0 ? void 0 : _a.cacheEntryTime;
86
+ const cacheTime = value.value?.cacheEntryTime;
73
87
  const currentTime = Date.now();
74
- if (cacheTime === undefined || currentTime - cacheTime >= exports.defaultCacheExpiryTimeoutMs) {
88
+ if (cacheTime === undefined ||
89
+ currentTime - cacheTime >= this.snapshotCacheExpiryTimeoutMs) {
75
90
  this.logger.sendTelemetryEvent({
76
91
  eventName: "odspVersionsCacheExpired",
77
92
  duration: currentTime - cacheTime,
78
- maxCacheAgeMs: exports.defaultCacheExpiryTimeoutMs,
93
+ maxCacheAgeMs: this.snapshotCacheExpiryTimeoutMs,
79
94
  });
80
95
  await this.removeEntries();
81
96
  return undefined;
@@ -90,20 +105,18 @@ class EpochTracker {
90
105
  }
91
106
  }
92
107
  async put(entry, value) {
93
- var _a;
94
- (0, common_utils_1.assert)(this._fluidEpoch !== undefined, 0x1dd /* "no epoch" */);
95
- // For snapshots, the value should have the cacheEntryTime. This will be used to expire snapshots older
96
- // than the defaultCacheExpiryTimeoutMs.
108
+ (0, core_utils_1.assert)(this._fluidEpoch !== undefined, 0x1dd /* "no epoch" */);
109
+ // For snapshots, the value should have the cacheEntryTime.
110
+ // This will be used to expire snapshots older than snapshotCacheExpiryTimeoutMs.
97
111
  if (entry.type === odsp_driver_definitions_1.snapshotKey) {
98
- value.cacheEntryTime = (_a = value.cacheEntryTime) !== null && _a !== void 0 ? _a : Date.now();
112
+ value.cacheEntryTime = value.cacheEntryTime ?? Date.now();
99
113
  }
100
114
  const data = {
101
115
  value,
102
116
  version: contracts_1.persistedCacheValueVersion,
103
117
  fluidEpoch: this._fluidEpoch,
104
118
  };
105
- return this.cache.put(this.fileEntryFromEntry(entry), data)
106
- .catch((error) => {
119
+ return this.cache.put(this.fileEntryFromEntry(entry), data).catch((error) => {
107
120
  this.logger.sendErrorEvent({ eventName: "cachePutError", type: entry.type }, error);
108
121
  throw error;
109
122
  });
@@ -119,14 +132,13 @@ class EpochTracker {
119
132
  get fluidEpoch() {
120
133
  return this._fluidEpoch;
121
134
  }
122
- async validateEpochFromPush(details) {
123
- const epoch = details.epoch;
124
- (0, common_utils_1.assert)(epoch !== undefined, 0x09d /* "Connection details should contain epoch" */);
135
+ async validateEpoch(epoch, fetchType) {
136
+ (0, core_utils_1.assert)(epoch !== undefined, 0x584 /* response should contain epoch */);
125
137
  try {
126
- this.validateEpochFromResponse(epoch, "push");
138
+ this.validateEpochFromResponse(epoch, fetchType);
127
139
  }
128
140
  catch (error) {
129
- await this.checkForEpochError(error, epoch, "push");
141
+ await this.checkForEpochError(error, epoch, fetchType);
130
142
  throw error;
131
143
  }
132
144
  }
@@ -157,12 +169,15 @@ class EpochTracker {
157
169
  // Add epoch in fetch request.
158
170
  this.addEpochInRequest(fetchOptions, addInBody, clientCorrelationId);
159
171
  let epochFromResponse;
160
- return this.rateLimiter.schedule(async () => fetcher(url, fetchOptions)).then((response) => {
172
+ return this.rateLimiter
173
+ .schedule(async () => fetcher(url, fetchOptions))
174
+ .then((response) => {
161
175
  epochFromResponse = response.headers.get("x-fluid-epoch");
162
176
  this.validateEpochFromResponse(epochFromResponse, fetchType);
163
177
  response.propsToLog.XRequestStatsHeader = clientCorrelationId;
164
178
  return response;
165
- }).catch(async (error) => {
179
+ })
180
+ .catch(async (error) => {
166
181
  // Get the server epoch from error in case we don't have it as if undefined we won't be able
167
182
  // to mark it as epoch error.
168
183
  if (epochFromResponse === undefined) {
@@ -170,8 +185,26 @@ class EpochTracker {
170
185
  }
171
186
  await this.checkForEpochError(error, epochFromResponse, fetchType);
172
187
  throw error;
173
- }).catch((error) => {
174
- const fluidError = (0, telemetry_utils_1.normalizeError)(error, { props: { XRequestStatsHeader: clientCorrelationId } });
188
+ })
189
+ .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;
200
+ }
201
+ }
202
+ throw error;
203
+ })
204
+ .catch((error) => {
205
+ const fluidError = (0, telemetry_utils_1.normalizeError)(error, {
206
+ props: { XRequestStatsHeader: clientCorrelationId },
207
+ });
175
208
  throw fluidError;
176
209
  });
177
210
  }
@@ -201,8 +234,10 @@ class EpochTracker {
201
234
  }
202
235
  else {
203
236
  const addHeader = (key, val) => {
204
- fetchOptions.headers = Object.assign({}, fetchOptions.headers);
205
- (0, common_utils_1.assert)(fetchOptions.headers !== undefined, 0x282 /* "Headers should be present now" */);
237
+ fetchOptions.headers = {
238
+ ...fetchOptions.headers,
239
+ };
240
+ (0, core_utils_1.assert)(fetchOptions.headers !== undefined, 0x282 /* "Headers should be present now" */);
206
241
  fetchOptions.headers[key] = val;
207
242
  };
208
243
  addHeader("X-RequestStats", clientCorrelationId);
@@ -218,10 +253,10 @@ class EpochTracker {
218
253
  // We use multi part form request for post body where we want to use this.
219
254
  // So extract the form boundary to mark the end of form.
220
255
  const body = fetchOptions.body;
221
- (0, common_utils_1.assert)(typeof body === "string", 0x21d /* "body is not string" */);
256
+ (0, core_utils_1.assert)(typeof body === "string", 0x21d /* "body is not string" */);
222
257
  const splitBody = body.split("\r\n");
223
258
  const firstLine = splitBody.shift();
224
- (0, common_utils_1.assert)((firstLine === null || firstLine === void 0 ? void 0 : firstLine.startsWith("--")) === true, 0x21e /* "improper boundary format" */);
259
+ (0, core_utils_1.assert)(firstLine?.startsWith("--") === true, 0x21e /* "improper boundary format" */);
225
260
  const formParams = [firstLine];
226
261
  Object.entries(headers).forEach(([key, value]) => {
227
262
  formParams.push(`${key}: ${value}`);
@@ -260,7 +295,6 @@ class EpochTracker {
260
295
  if (epochError !== undefined) {
261
296
  epochError.addTelemetryProperties({
262
297
  fromCache,
263
- clientEpoch: this.fluidEpoch,
264
298
  fetchType,
265
299
  });
266
300
  this.logger.sendErrorEvent({ eventName: "fileOverwrittenInStorage" }, epochError);
@@ -271,28 +305,40 @@ class EpochTracker {
271
305
  // If it was categorized as epoch error but the epoch returned in response matches with the client epoch
272
306
  // then it was coherency 409, so rethrow it as throttling error so that it can retried. Default throttling
273
307
  // time is 1s.
274
- throw new driver_utils_1.ThrottlingError(`Coherency 409: ${error.message}`, 1 /* retryAfterSeconds */, { [exports.Odsp409Error]: true, driverVersion: packageVersion_1.pkgVersion });
308
+ const newError = (0, telemetry_utils_1.wrapError)(error, (message) => {
309
+ return new driver_utils_1.ThrottlingError(`Coherency 409: ${message}`, 1 /* retryAfterSeconds */, {
310
+ [exports.Odsp409Error]: true,
311
+ driverVersion: packageVersion_1.pkgVersion,
312
+ });
313
+ });
314
+ throw newError;
275
315
  }
276
316
  }
277
317
  checkForEpochErrorCore(epochFromResponse) {
278
318
  // If epoch is undefined, then don't compare it because initially for createNew or TreesLatest
279
319
  // initializes this value. Sometimes response does not contain epoch as it is still in
280
320
  // implementation phase at server side. In that case also, don't compare it with our epoch value.
281
- if (this.fluidEpoch && epochFromResponse && (this.fluidEpoch !== epochFromResponse)) {
321
+ if (this.fluidEpoch && epochFromResponse && this.fluidEpoch !== epochFromResponse) {
282
322
  // This is similar in nature to how fluidEpochMismatchError (409) is handled.
283
323
  // Difference - client detected mismatch, instead of server detecting it.
284
- return new driver_utils_1.NonRetryableError("Epoch mismatch", driver_definitions_1.DriverErrorType.fileOverwrittenInStorage, { driverVersion: packageVersion_1.pkgVersion });
324
+ return new driver_utils_1.NonRetryableError("Epoch mismatch", driver_definitions_1.DriverErrorType.fileOverwrittenInStorage, { driverVersion: packageVersion_1.pkgVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch });
285
325
  }
286
326
  }
287
327
  fileEntryFromEntry(entry) {
288
- return Object.assign(Object.assign({}, entry), { file: this.fileEntry });
328
+ return { ...entry, file: this.fileEntry };
289
329
  }
290
330
  }
291
331
  exports.EpochTracker = EpochTracker;
292
332
  class EpochTrackerWithRedemption extends EpochTracker {
293
- constructor() {
294
- super(...arguments);
295
- this.treesLatestDeferral = new common_utils_1.Deferred();
333
+ constructor(cache, fileEntry, logger, clientIsSummarizer) {
334
+ super(cache, fileEntry, logger, clientIsSummarizer);
335
+ this.cache = cache;
336
+ this.fileEntry = fileEntry;
337
+ this.logger = logger;
338
+ this.clientIsSummarizer = clientIsSummarizer;
339
+ this.treesLatestDeferral = new core_utils_1.Deferred();
340
+ // Handles the rejected promise within treesLatestDeferral.
341
+ this.treesLatestDeferral.promise.catch(() => { });
296
342
  }
297
343
  validateEpochFromResponse(epochFromResponse, fetchType, fromCache = false) {
298
344
  super.validateEpochFromResponse(epochFromResponse, fetchType, fromCache);
@@ -336,7 +382,10 @@ class EpochTrackerWithRedemption extends EpochTracker {
336
382
  if (fetchType === "treesLatest") {
337
383
  this.treesLatestDeferral.reject(error);
338
384
  }
339
- if (fetchType !== "joinSession" || error.statusCode < 401 || error.statusCode > 404 || completed) {
385
+ if (fetchType !== "joinSession" ||
386
+ error.statusCode < 401 ||
387
+ error.statusCode > 404 ||
388
+ completed) {
340
389
  throw error;
341
390
  }
342
391
  }
@@ -352,12 +401,14 @@ class EpochTrackerWithRedemption extends EpochTracker {
352
401
  const timeoutRes = 51; // anything will work here
353
402
  let timer;
354
403
  const timeoutP = new Promise((resolve) => {
355
- timer = setTimeout(() => { resolve(timeoutRes); }, 15000);
404
+ timer = setTimeout(() => {
405
+ resolve(timeoutRes);
406
+ }, 15000);
356
407
  });
357
408
  const res = await Promise.race([
358
409
  timeoutP,
359
410
  // cancel timeout to unblock UTs (otherwise Node process does not exit for 15 sec)
360
- this.treesLatestDeferral.promise.finally(() => clearTimeout(timer))
411
+ this.treesLatestDeferral.promise.finally(() => clearTimeout(timer)),
361
412
  ]);
362
413
  if (res === timeoutRes) {
363
414
  event.cancel();
@@ -370,9 +421,12 @@ exports.EpochTrackerWithRedemption = EpochTrackerWithRedemption;
370
421
  function createOdspCacheAndTracker(persistedCacheArg, nonpersistentCache, fileEntry, logger, clientIsSummarizer) {
371
422
  const epochTracker = new EpochTrackerWithRedemption(persistedCacheArg, fileEntry, logger, clientIsSummarizer);
372
423
  return {
373
- cache: Object.assign(Object.assign({}, nonpersistentCache), { persistedCache: epochTracker }),
424
+ cache: {
425
+ ...nonpersistentCache,
426
+ persistedCache: epochTracker,
427
+ },
374
428
  epochTracker,
375
429
  };
376
430
  }
377
431
  exports.createOdspCacheAndTracker = createOdspCacheAndTracker;
378
- //# sourceMappingURL=epochTracker.js.map
432
+ //# sourceMappingURL=epochTracker.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"epochTracker.cjs","sourceRoot":"","sources":["../src/epochTracker.ts"],"names":[],"mappings":";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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;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"]}
@@ -2,38 +2,54 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryLogger } from "@fluidframework/common-definitions";
5
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
6
6
  import { RateLimiter } from "@fluidframework/driver-utils";
7
- import { IConnected } from "@fluidframework/protocol-definitions";
8
7
  import { IEntry, IFileEntry, IPersistedCache } from "@fluidframework/odsp-driver-definitions";
9
8
  import { IOdspResponse } from "./odspUtils";
10
9
  import { IOdspCache, INonPersistentCache, IPersistedFileCache } from "./odspCache";
11
- export declare type FetchType = "blob" | "createBlob" | "createFile" | "joinSession" | "ops" | "test" | "snapshotTree" | "treesLatest" | "uploadSummary" | "push" | "versions";
12
- export declare type FetchTypeInternal = FetchType | "cache";
10
+ /**
11
+ * @alpha
12
+ */
13
+ export type FetchType = "blob" | "createBlob" | "createFile" | "joinSession" | "ops" | "test" | "snapshotTree" | "treesLatest" | "uploadSummary" | "push" | "versions";
14
+ /**
15
+ * @alpha
16
+ */
17
+ export type FetchTypeInternal = FetchType | "cache";
13
18
  export declare const Odsp409Error = "Odsp409Error";
14
19
  export declare const defaultCacheExpiryTimeoutMs: number;
15
20
  /**
21
+ * In ODSP, the concept of "epoch" refers to binary updates to files. For example, this might include using
22
+ * version restore, or if the user downloads a Fluid file and then uploads it again. These result in the epoch
23
+ * value being incremented.
24
+ *
25
+ * The implications of these binary updates is that the Fluid state is disrupted: the sequence number might
26
+ * go backwards, the data might be inconsistent with the latest state of collaboration, etc. As a result, it's
27
+ * not safe to continue collaboration across an epoch change. We need to detect these epoch changes and
28
+ * error out from the collaboration.
29
+ *
16
30
  * This class is a wrapper around fetch calls. It adds epoch to the request made so that the
17
31
  * server can match it with its epoch value in order to match the version.
18
32
  * It also validates the epoch value received in response of fetch calls. If the epoch does not match,
19
33
  * then it also clears all the cached entries for the given container.
34
+ * @alpha
20
35
  */
21
36
  export declare class EpochTracker implements IPersistedFileCache {
22
37
  protected readonly cache: IPersistedCache;
23
38
  protected readonly fileEntry: IFileEntry;
24
- protected readonly logger: ITelemetryLogger;
39
+ protected readonly logger: ITelemetryLoggerExt;
25
40
  protected readonly clientIsSummarizer?: boolean | undefined;
26
41
  private _fluidEpoch;
42
+ private readonly snapshotCacheExpiryTimeoutMs;
27
43
  readonly rateLimiter: RateLimiter;
28
44
  private readonly driverId;
29
45
  private networkCallNumber;
30
- constructor(cache: IPersistedCache, fileEntry: IFileEntry, logger: ITelemetryLogger, clientIsSummarizer?: boolean | undefined);
46
+ constructor(cache: IPersistedCache, fileEntry: IFileEntry, logger: ITelemetryLoggerExt, clientIsSummarizer?: boolean | undefined);
31
47
  setEpoch(epoch: string, fromCache: boolean, fetchType: FetchTypeInternal): void;
32
48
  get(entry: IEntry): Promise<any>;
33
49
  put(entry: IEntry, value: any): Promise<void>;
34
50
  removeEntries(): Promise<void>;
35
51
  get fluidEpoch(): string | undefined;
36
- validateEpochFromPush(details: IConnected): Promise<void>;
52
+ validateEpoch(epoch: string | undefined, fetchType: FetchType): Promise<void>;
37
53
  /**
38
54
  * Api to fetch the response for given request and parse it as json.
39
55
  * @param url - url of the request
@@ -73,16 +89,24 @@ export declare class EpochTracker implements IPersistedFileCache {
73
89
  private fileEntryFromEntry;
74
90
  }
75
91
  export declare class EpochTrackerWithRedemption extends EpochTracker {
92
+ protected readonly cache: IPersistedCache;
93
+ protected readonly fileEntry: IFileEntry;
94
+ protected readonly logger: ITelemetryLoggerExt;
95
+ protected readonly clientIsSummarizer?: boolean | undefined;
76
96
  private readonly treesLatestDeferral;
97
+ constructor(cache: IPersistedCache, fileEntry: IFileEntry, logger: ITelemetryLoggerExt, clientIsSummarizer?: boolean | undefined);
77
98
  protected validateEpochFromResponse(epochFromResponse: string | undefined, fetchType: FetchType, fromCache?: boolean): void;
78
99
  get(entry: IEntry): Promise<any>;
79
100
  fetchAndParseAsJSON<T>(url: string, fetchOptions: {
80
101
  [index: string]: any;
81
102
  }, fetchType: FetchType, addInBody?: boolean, fetchReason?: string): Promise<IOdspResponse<T>>;
82
103
  }
104
+ /**
105
+ * @alpha
106
+ */
83
107
  export interface ICacheAndTracker {
84
108
  cache: IOdspCache;
85
109
  epochTracker: EpochTracker;
86
110
  }
87
- export declare function createOdspCacheAndTracker(persistedCacheArg: IPersistedCache, nonpersistentCache: INonPersistentCache, fileEntry: IFileEntry, logger: ITelemetryLogger, clientIsSummarizer?: boolean): ICacheAndTracker;
111
+ export declare function createOdspCacheAndTracker(persistedCacheArg: IPersistedCache, nonpersistentCache: INonPersistentCache, fileEntry: IFileEntry, logger: ITelemetryLoggerExt, clientIsSummarizer?: boolean): ICacheAndTracker;
88
112
  //# sourceMappingURL=epochTracker.d.ts.map