@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetchSnapshot.mjs","sourceRoot":"","sources":["../src/fetchSnapshot.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM;OAC1B,EAEN,YAAY,EACZ,gBAAgB,EAChB,SAAS,GACT,MAAM,iCAAiC;OACjC,EAAE,gBAAgB,EAAE,MAAM,8BAA8B;OACxD,EAAE,MAAM,EAAE,MAAM,4BAA4B;OAC5C,EAAE,UAAU,EAAE,MAAM,6BAA6B;OACjD,EAAE,eAAe,EAAE,MAAM,oCAAoC;OAC7D,EAGN,aAAa,GAEb,MAAM,yCAAyC;OAEzC,EAEN,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,8BAA8B;OAC9B,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,mCAAmC;OAC1F,EAIN,0BAA0B,GAC1B;OACM,EAAE,cAAc,EAAE;OAClB,EAAE,wBAAwB,EAAE;OAC5B,EACN,yBAAyB,EACzB,WAAW,EACX,2BAA2B,EAC3B,iCAAiC,EAEjC,OAAO,EACP,QAAQ,GACR;OAEM,EAAE,yCAAyC,EAAE;OAC7C,EACN,kBAAkB,EAElB,4BAA4B,GAC5B;OAEM,EAAE,UAAU,EAAE;AAErB;;;GAGG;AACH,MAAM,CAAN,IAAY,yBAIX;AAJD,WAAY,yBAAyB;IACpC,yEAAQ,CAAA;IACR,6EAAU,CAAA;IACV,2FAAiB,CAAA;AAClB,CAAC,EAJW,yBAAyB,KAAzB,yBAAyB,QAIpC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAClC,WAAmB;AACnB,kDAAkD;AAClD,KAAoB,EACpB,SAAiB,EACjB,iBAA0B,EAC1B,sCAA+C,EAC/C,MAA2B,EAC3B,kBAGoC;IAEpC,MAAM,IAAI,GAAG,UAAU,SA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mB,KAAK,SAAS;QAChE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,KAAK,CAAC,SAAS,KAAK,eAAe,CAAC,kBAAkB;YACtD,KAAK,CAAC,SAAS,KAAK,eAAe,CAAC,+BAA+B,CAAC,EACpE;QACD,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAW;IACtC;;;OAGG;IACH,IAAI,UAAU,GAAG,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpF,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACrC,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport {\n\tITelemetryLoggerExt,\n\tisFluidError,\n\tPerformanceEvent,\n\twrapError,\n} from \"@fluidframework/telemetry-utils\";\nimport { fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { getW3CData } from \"@fluidframework/driver-base\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport {\n\tIOdspResolvedUrl,\n\tISnapshotOptions,\n\tOdspErrorType,\n\tInstrumentedStorageTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tDriverErrorTelemetryProps,\n\tisRuntimeMessage,\n\tNonRetryableError,\n} from \"@fluidframework/driver-utils\";\nimport { fetchIncorrectResponse, throwOdspNetworkError } from \"@fluidframework/odsp-doclib-utils\";\nimport {\n\tIOdspSnapshot,\n\tISnapshotCachedEntry,\n\tIVersionedValueWithEpoch,\n\tpersistedCacheValueVersion,\n} from \"./contracts\";\nimport { getQueryString } from \"./getQueryString\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth\";\nimport {\n\tfetchAndParseAsJSONHelper,\n\tfetchHelper,\n\tgetWithRetryForTokenRefresh,\n\tgetWithRetryForTokenRefreshRepeat,\n\tIOdspResponse,\n\tmeasure,\n\tmeasureP,\n} from \"./odspUtils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { convertOdspSnapshotToSnapshotTreeAndBlobs } from \"./odspSnapshotParser\";\nimport {\n\tcurrentReadVersion,\n\tISnapshotContentsWithProps,\n\tparseCompactSnapshotResponse,\n} from \"./compactSnapshotParser\";\nimport { EpochTracker } from \"./epochTracker\";\nimport { pkgVersion } from \"./packageVersion\";\n\n/**\n * Enum to support different types of snapshot formats.\n * @alpha\n */\nexport enum SnapshotFormatSupportType {\n\tJson = 0,\n\tBinary = 1,\n\tJsonAndBinary = 2,\n}\n\n/**\n * Fetches a snapshot from the server with a given version id.\n * @param snapshotUrl - snapshot url from where the odsp snapshot will be fetched\n * @param token - token used for authorization in the request\n * @param storageFetchWrapper - Implementation of the get/post methods used to fetch the snapshot\n * @param versionId - id of specific snapshot to be fetched\n * @param fetchFullSnapshot - whether we want to fetch full snapshot(with blobs)\n * @param forceAccessTokenViaAuthorizationHeader - whether to force passing given token via authorization header\n * @returns A promise of the snapshot and the status code of the response\n */\nexport async function fetchSnapshot(\n\tsnapshotUrl: string,\n\t// eslint-disable-next-line @rushstack/no-new-null\n\ttoken: string | null,\n\tversionId: string,\n\tfetchFullSnapshot: boolean,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tlogger: ITelemetryLoggerExt,\n\tsnapshotDownloader: (\n\t\turl: string,\n\t\tfetchOptions: { [index: string]: any },\n\t) => Promise<IOdspResponse<unknown>>,\n): Promise<ISnapshotContents> {\n\tconst path = `/trees/${versionId}`;\n\tlet queryParams: ISnapshotOptions = {};\n\n\tif (fetchFullSnapshot) {\n\t\tqueryParams = versionId !== \"latest\" ? { blobs: 2 } : { deltas: 1, blobs: 2 };\n\t}\n\n\tconst queryString = getQueryString(queryParams);\n\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t`${snapshotUrl}${path}${queryString}`,\n\t\ttoken,\n\t\tforceAccessTokenViaAuthorizationHeader,\n\t);\n\tconst response = (await PerformanceEvent.timedExecAsync(\n\t\tlogger,\n\t\t{\n\t\t\teventName: \"fetchSnapshot\",\n\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t},\n\t\tasync () => snapshotDownloader(url, { headers }),\n\t)) as IOdspResponse<IOdspSnapshot>;\n\treturn convertOdspSnapshotToSnapshotTreeAndBlobs(response.content);\n}\n\nexport async function fetchSnapshotWithRedeem(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tstorageTokenFetcher: InstrumentedStorageTokenFetcher,\n\tsnapshotOptions: ISnapshotOptions | undefined,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tlogger: ITelemetryLoggerExt,\n\tsnapshotDownloader: (\n\t\tfinalOdspResolvedUrl: IOdspResolvedUrl,\n\t\tstorageToken: string,\n\t\tsnapshotOptions: ISnapshotOptions | undefined,\n\t\tcontroller?: AbortController,\n\t) => Promise<ISnapshotRequestAndResponseOptions>,\n\tputInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,\n\tremoveEntries: () => Promise<void>,\n\tenableRedeemFallback?: boolean,\n): Promise<ISnapshotContents> {\n\t// back-compat: This block to be removed with #8784 when we only consume/consider odsp resolvers that are >= 0.51\n\tconst sharingLinkToRedeem = (odspResolvedUrl as any).sharingLinkToRedeem;\n\tif (sharingLinkToRedeem) {\n\t\todspResolvedUrl.shareLinkInfo = { ...odspResolvedUrl.shareLinkInfo, sharingLinkToRedeem };\n\t}\n\n\treturn fetchLatestSnapshotCore(\n\t\todspResolvedUrl,\n\t\tstorageTokenFetcher,\n\t\tsnapshotOptions,\n\t\tlogger,\n\t\tsnapshotDownloader,\n\t\tputInCache,\n\t\tenableRedeemFallback,\n\t)\n\t\t.catch(async (error) => {\n\t\t\tif (enableRedeemFallback && isRedeemSharingLinkError(odspResolvedUrl, error)) {\n\t\t\t\t// Execute the redeem fallback\n\n\t\t\t\tawait redeemSharingLink(\n\t\t\t\t\todspResolvedUrl,\n\t\t\t\t\tstorageTokenFetcher,\n\t\t\t\t\tlogger,\n\t\t\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t\t\t);\n\t\t\t\tconst odspResolvedUrlWithoutShareLink: IOdspResolvedUrl = {\n\t\t\t\t\t...odspResolvedUrl,\n\t\t\t\t\tshareLinkInfo: {\n\t\t\t\t\t\t...odspResolvedUrl.shareLinkInfo,\n\t\t\t\t\t\tsharingLinkToRedeem: undefined,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\t// Log initial failure only if redeem succeeded - it points out to some bug somewhere\n\t\t\t\t// If redeem failed, that most likely means user has no permissions to access a file,\n\t\t\t\t// and thus it's not worth it logging extra errors - same error will be logged by end-to-end\n\t\t\t\t// flow (container open) based on a failure above.\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"RedeemFallback\",\n\t\t\t\t\t\terrorType: error.errorType,\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\n\t\t\t\treturn fetchLatestSnapshotCore(\n\t\t\t\t\todspResolvedUrlWithoutShareLink,\n\t\t\t\t\tstorageTokenFetcher,\n\t\t\t\t\tsnapshotOptions,\n\t\t\t\t\tlogger,\n\t\t\t\t\tsnapshotDownloader,\n\t\t\t\t\tputInCache,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})\n\t\t.catch(async (error) => {\n\t\t\t// Clear the cache on 401/403/404 on snapshot fetch from network because this means either the user doesn't\n\t\t\t// have permissions for the file or it was deleted. So, if we do not clear cache, we will continue fetching\n\t\t\t// snapshot from cache in the future.\n\t\t\tif (\n\t\t\t\t(typeof error === \"object\" &&\n\t\t\t\t\terror !== null &&\n\t\t\t\t\terror.errorType === DriverErrorType.authorizationError) ||\n\t\t\t\terror.errorType === DriverErrorType.fileNotFoundOrAccessDeniedError\n\t\t\t) {\n\t\t\t\tawait removeEntries();\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n}\n\nasync function redeemSharingLink(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tstorageTokenFetcher: InstrumentedStorageTokenFetcher,\n\tlogger: ITelemetryLoggerExt,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n) {\n\treturn PerformanceEvent.timedExecAsync(\n\t\tlogger,\n\t\t{\n\t\t\teventName: \"RedeemShareLink\",\n\t\t},\n\t\tasync () =>\n\t\t\tgetWithRetryForTokenRefresh(async (tokenFetchOptions) => {\n\t\t\t\tassert(\n\t\t\t\t\t!!odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem,\n\t\t\t\t\t0x1ed /* \"Share link should be present\" */,\n\t\t\t\t);\n\t\t\t\tconst storageToken = await storageTokenFetcher(\n\t\t\t\t\ttokenFetchOptions,\n\t\t\t\t\t\"RedeemShareLink\",\n\t\t\t\t);\n\t\t\t\tconst encodedShareUrl = getEncodedShareUrl(\n\t\t\t\t\todspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem,\n\t\t\t\t);\n\t\t\t\tconst redeemUrl = `${odspResolvedUrl.siteUrl}/_api/v2.0/shares/${encodedShareUrl}`;\n\t\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t\tredeemUrl,\n\t\t\t\t\tstorageToken,\n\t\t\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t\t\t);\n\t\t\t\theaders.prefer = \"redeemSharingLink\";\n\t\t\t\treturn fetchAndParseAsJSONHelper(url, { headers });\n\t\t\t}),\n\t);\n}\n\nasync function fetchLatestSnapshotCore(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tstorageTokenFetcher: InstrumentedStorageTokenFetcher,\n\tsnapshotOptions: ISnapshotOptions | undefined,\n\tlogger: ITelemetryLoggerExt,\n\tsnapshotDownloader: (\n\t\tfinalOdspResolvedUrl: IOdspResolvedUrl,\n\t\tstorageToken: string,\n\t\tsnapshotOptions: ISnapshotOptions | undefined,\n\t\tcontroller?: AbortController,\n\t) => Promise<ISnapshotRequestAndResponseOptions>,\n\tputInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,\n\tenableRedeemFallback?: boolean,\n): Promise<ISnapshotContents> {\n\treturn getWithRetryForTokenRefresh(async (tokenFetchOptions) => {\n\t\tconst storageToken = await storageTokenFetcher(tokenFetchOptions, \"TreesLatest\", true);\n\t\tassert(storageToken !== null, 0x1e5 /* \"Storage token should not be null\" */);\n\n\t\tconst perfEvent = {\n\t\t\teventName: \"TreesLatest\",\n\t\t\tattempts: tokenFetchOptions.refresh ? 2 : 1,\n\t\t\tshareLinkPresent: odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem !== undefined,\n\t\t\tisSummarizer: odspResolvedUrl.summarizer,\n\t\t\tredeemFallbackEnabled: enableRedeemFallback,\n\t\t};\n\t\tif (snapshotOptions !== undefined) {\n\t\t\tObject.entries(snapshotOptions).forEach(([key, value]) => {\n\t\t\t\tif (value !== undefined) {\n\t\t\t\t\tperfEvent[`snapshotOption_${key}`] = value;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t// This event measures only successful cases of getLatest call (no tokens, no retries).\n\t\treturn PerformanceEvent.timedExecAsync(logger, perfEvent, async (event) => {\n\t\t\tlet controller: AbortController | undefined;\n\t\t\tlet fetchTimeout: ReturnType<typeof setTimeout> | undefined;\n\t\t\tif (snapshotOptions?.timeout !== undefined) {\n\t\t\t\tcontroller = new AbortController();\n\t\t\t\tfetchTimeout = setTimeout(() => controller!.abort(), snapshotOptions.timeout);\n\t\t\t}\n\n\t\t\tconst [response, fetchTime] = await measureP(async () =>\n\t\t\t\tsnapshotDownloader(odspResolvedUrl, storageToken, snapshotOptions, controller),\n\t\t\t).finally(() => {\n\t\t\t\t// Clear the fetchTimeout once the response is fetched.\n\t\t\t\tif (fetchTimeout !== undefined) {\n\t\t\t\t\tclearTimeout(fetchTimeout);\n\t\t\t\t\tfetchTimeout = undefined;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tconst odspResponse = response.odspResponse;\n\t\t\tconst contentType = odspResponse.headers.get(\"content-type\");\n\n\t\t\tconst propsToLog: DriverErrorTelemetryProps = {\n\t\t\t\t...odspResponse.propsToLog,\n\t\t\t\tcontentType,\n\t\t\t\taccept: response.requestHeaders.accept,\n\t\t\t\tdriverVersion: pkgVersion,\n\t\t\t};\n\n\t\t\tlet parsedSnapshotContents: IOdspResponse<ISnapshotContentsWithProps> | undefined;\n\t\t\tlet contentTypeToRead: string | undefined;\n\t\t\tif (contentType?.includes(\"application/ms-fluid\")) {\n\t\t\t\tcontentTypeToRead = \"application/ms-fluid\";\n\t\t\t} else if (contentType?.includes(\"application/json\")) {\n\t\t\t\tcontentTypeToRead = \"application/json\";\n\t\t\t}\n\n\t\t\tlet parseTime: number;\n\t\t\tlet receiveContentTime: number;\n\t\t\ttry {\n\t\t\t\tswitch (contentTypeToRead) {\n\t\t\t\t\tcase \"application/json\": {\n\t\t\t\t\t\tlet text: string;\n\t\t\t\t\t\t[text, receiveContentTime] = await measureP(async () =>\n\t\t\t\t\t\t\todspResponse.content.text().catch((err) =>\n\t\t\t\t\t\t\t\t// Parsing can fail and message could contain full request URI, including\n\t\t\t\t\t\t\t\t// tokens, etc. So do not log error object itself.\n\t\t\t\t\t\t\t\tthrowOdspNetworkError(\n\t\t\t\t\t\t\t\t\t\"Error while parsing fetch response\",\n\t\t\t\t\t\t\t\t\tfetchIncorrectResponse,\n\t\t\t\t\t\t\t\t\todspResponse.content, // response\n\t\t\t\t\t\t\t\t\tundefined, // response text\n\t\t\t\t\t\t\t\t\tpropsToLog,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tpropsToLog.bodySize = text.length;\n\t\t\t\t\t\tlet content: IOdspSnapshot;\n\t\t\t\t\t\t[content, parseTime] = measure(() => JSON.parse(text) as IOdspSnapshot);\n\t\t\t\t\t\tvalidateBlobsAndTrees(content);\n\t\t\t\t\t\tconst snapshotContents: ISnapshotContents =\n\t\t\t\t\t\t\tconvertOdspSnapshotToSnapshotTreeAndBlobs(content);\n\t\t\t\t\t\tparsedSnapshotContents = {\n\t\t\t\t\t\t\t...odspResponse,\n\t\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\t...snapshotContents,\n\t\t\t\t\t\t\t\ttelemetryProps: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"application/ms-fluid\": {\n\t\t\t\t\t\tlet content: ArrayBuffer;\n\t\t\t\t\t\t[content, receiveContentTime] = await measureP(async () =>\n\t\t\t\t\t\t\todspResponse.content.arrayBuffer().catch((err) =>\n\t\t\t\t\t\t\t\t// Parsing can fail and message could contain full request URI, including\n\t\t\t\t\t\t\t\t// tokens, etc. So do not log error object itself.\n\t\t\t\t\t\t\t\tthrowOdspNetworkError(\n\t\t\t\t\t\t\t\t\t\"Error while parsing fetch response\",\n\t\t\t\t\t\t\t\t\tfetchIncorrectResponse,\n\t\t\t\t\t\t\t\t\todspResponse.content, // response\n\t\t\t\t\t\t\t\t\tundefined, // response text\n\t\t\t\t\t\t\t\t\tpropsToLog,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tpropsToLog.bodySize = content.byteLength;\n\t\t\t\t\t\tlet snapshotContents: ISnapshotContentsWithProps;\n\t\t\t\t\t\t[snapshotContents, parseTime] = measure(() =>\n\t\t\t\t\t\t\tparseCompactSnapshotResponse(new Uint8Array(content), logger),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tsnapshotContents.snapshotTree.trees === undefined ||\n\t\t\t\t\t\t\tsnapshotContents.snapshotTree.blobs === undefined\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t\t\t\"Returned odsp snapshot is malformed. No trees or blobs!\",\n\t\t\t\t\t\t\t\tDriverErrorType.incorrectServerResponse,\n\t\t\t\t\t\t\t\tpropsToLog,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst props = snapshotContents.telemetryProps;\n\t\t\t\t\t\tconst slowTreeParseCodePaths = props.slowTreeStructureCount ?? 0;\n\t\t\t\t\t\tconst slowBlobParseCodePaths = props.slowBlobStructureCount ?? 0;\n\t\t\t\t\t\tif (slowTreeParseCodePaths > 10 || slowBlobParseCodePaths > 10) {\n\t\t\t\t\t\t\tlogger.sendErrorEvent({\n\t\t\t\t\t\t\t\teventName: \"SlowSnapshotParseCodePaths\",\n\t\t\t\t\t\t\t\tslowTreeStructureCount: slowTreeParseCodePaths,\n\t\t\t\t\t\t\t\tslowBlobStructureCount: slowBlobParseCodePaths,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tparsedSnapshotContents = { ...odspResponse, content: snapshotContents };\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t\t\"Unknown snapshot content type\",\n\t\t\t\t\t\t\tDriverErrorType.incorrectServerResponse,\n\t\t\t\t\t\t\tpropsToLog,\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (isFluidError(error)) {\n\t\t\t\t\terror.addTelemetryProperties(propsToLog);\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tconst enhancedError = wrapError(\n\t\t\t\t\terror,\n\t\t\t\t\t(errorMessage) =>\n\t\t\t\t\t\tnew NonRetryableError(\n\t\t\t\t\t\t\t`Error parsing snapshot response: ${errorMessage}`,\n\t\t\t\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t\t\t\tpropsToLog,\n\t\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t\tthrow enhancedError;\n\t\t\t}\n\n\t\t\tassert(parsedSnapshotContents !== undefined, 0x312 /* snapshot should be parsed */);\n\t\t\tconst snapshot = parsedSnapshotContents.content;\n\t\t\tconst { trees, numBlobs, encodedBlobsSize } = evalBlobsAndTrees(snapshot);\n\n\t\t\t// There are some scenarios in ODSP where we cannot cache, trees/latest will explicitly tell us when we\n\t\t\t// cannot cache using an HTTP response header.\n\t\t\tconst canCache =\n\t\t\t\todspResponse.headers.get(\"disablebrowsercachingofusercontent\") !== \"true\";\n\t\t\tconst sequenceNumber: number = snapshot.sequenceNumber ?? 0;\n\t\t\tconst seqNumberFromOps =\n\t\t\t\tsnapshot.ops && snapshot.ops.length > 0\n\t\t\t\t\t? snapshot.ops[0].sequenceNumber - 1\n\t\t\t\t\t: undefined;\n\n\t\t\tif (\n\t\t\t\t!Number.isInteger(sequenceNumber) ||\n\t\t\t\t(seqNumberFromOps !== undefined && seqNumberFromOps !== sequenceNumber)\n\t\t\t) {\n\t\t\t\tlogger.sendErrorEvent({\n\t\t\t\t\teventName: \"fetchSnapshotError\",\n\t\t\t\t\tsequenceNumber,\n\t\t\t\t\tseqNumberFromOps,\n\t\t\t\t});\n\t\t\t\tsnapshot.sequenceNumber = undefined;\n\t\t\t} else if (canCache) {\n\t\t\t\tconst fluidEpoch = odspResponse.headers.get(\"x-fluid-epoch\");\n\t\t\t\tassert(\n\t\t\t\t\tfluidEpoch !== undefined,\n\t\t\t\t\t0x1e6 /* \"Epoch should be present in response\" */,\n\t\t\t\t);\n\t\t\t\tconst value: ISnapshotCachedEntry = {\n\t\t\t\t\t...snapshot,\n\t\t\t\t\tcacheEntryTime: Date.now(),\n\t\t\t\t};\n\t\t\t\tconst valueWithEpoch: IVersionedValueWithEpoch = {\n\t\t\t\t\tvalue,\n\t\t\t\t\tfluidEpoch,\n\t\t\t\t\tversion: persistedCacheValueVersion,\n\t\t\t\t};\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\t\t\tputInCache(valueWithEpoch);\n\t\t\t}\n\n\t\t\tevent.end({\n\t\t\t\ttrees,\n\t\t\t\tblobs: snapshot.blobs?.size ?? 0,\n\t\t\t\tleafNodes: numBlobs,\n\t\t\t\tencodedBlobsSize,\n\t\t\t\tsequenceNumber,\n\t\t\t\tops: snapshot.ops?.length ?? 0,\n\t\t\t\tuserOps: snapshot.ops?.filter((op) => isRuntimeMessage(op)).length ?? 0,\n\t\t\t\theaders: Object.keys(response.requestHeaders).length !== 0 ? true : undefined,\n\t\t\t\t// Measures time to make fetch call. Should be similar to\n\t\t\t\t// fetchStartToResponseEndTime - receiveContentTime, i.e. it looks like it's time till first byte /\n\t\t\t\t// end of response headers\n\t\t\t\tfetchTime,\n\t\t\t\t// time it takes client to parse payload. Same payload as in \"SnapshotParse\" event, here for\n\t\t\t\t// easier analyzes.\n\t\t\t\tparseTime,\n\t\t\t\t// Time it takes to receive content (text of buffer) from Response object.\n\t\t\t\t// This time likely is very closely correlated with networkTime, i.e. time it takes to receive\n\t\t\t\t// actual content (starting measuring from first bite / end of response header)\n\t\t\t\treceiveContentTime,\n\t\t\t\t...getW3CData(response.requestUrl, \"fetch\"),\n\t\t\t\t// Sharing link telemetry regarding sharing link redeem status and performance. Ex: FRL; dur=100,\n\t\t\t\t// Azure Fluid Relay service; desc=S, FRP; desc=False. Here, FRL is the duration taken for redeem,\n\t\t\t\t// Azure Fluid Relay service is the redeem status (S means success), and FRP is a flag to indicate\n\t\t\t\t// if the permission has changed.\n\t\t\t\tsltelemetry: odspResponse.headers.get(\"x-fluid-sltelemetry\"),\n\t\t\t\t// All other props\n\t\t\t\t...propsToLog,\n\t\t\t\t// Various perf counters and measures collected by binary parsing code:\n\t\t\t\t// slowTreeStructureCount, slowBlobStructureCount, durationStructure, durationStrings,\n\t\t\t\t// durationSnapshotTree, durationBlobs, etc.\n\t\t\t\t...parsedSnapshotContents.content.telemetryProps,\n\t\t\t});\n\t\t\treturn snapshot;\n\t\t}).catch((error) => {\n\t\t\t// We hit these errors in stress tests, under load\n\t\t\t// It's useful to try one more time in such case.\n\t\t\tif (\n\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\terror !== null &&\n\t\t\t\t(error.errorType === DriverErrorType.fetchFailure ||\n\t\t\t\t\terror.errorType === OdspErrorType.fetchTimeout)\n\t\t\t) {\n\t\t\t\terror[getWithRetryForTokenRefreshRepeat] = true;\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t});\n}\n\nexport interface ISnapshotRequestAndResponseOptions {\n\todspResponse: IOdspResponse<Response>;\n\trequestUrl: string;\n\trequestHeaders: { [index: string]: any };\n}\n\nfunction getFormBodyAndHeaders(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tstorageToken: string,\n\theaders?: { [index: string]: string },\n) {\n\tconst formBoundary = uuid();\n\tconst formParams: string[] = [];\n\tformParams.push(`--${formBoundary}`);\n\tformParams.push(`Authorization: Bearer ${storageToken}`);\n\tformParams.push(`X-HTTP-Method-Override: GET`);\n\n\tif (headers !== undefined) {\n\t\tObject.entries(headers).forEach(([key, value]) => {\n\t\t\tif (value !== undefined) {\n\t\t\t\tformParams.push(`${key}: ${value}`);\n\t\t\t}\n\t\t});\n\t}\n\tif (odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem) {\n\t\tformParams.push(`sl: ${odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem}`);\n\t}\n\tformParams.push(`_post: 1`);\n\tformParams.push(`\\r\\n--${formBoundary}--`);\n\tconst postBody = formParams.join(\"\\r\\n\");\n\tconst header: { [index: string]: any } = {\n\t\t\"Content-Type\": `multipart/form-data;boundary=${formBoundary}`,\n\t};\n\treturn { body: postBody, headers: header };\n}\n\nexport function evalBlobsAndTrees(snapshot: ISnapshotContents) {\n\tconst trees = countTreesInSnapshotTree(snapshot.snapshotTree);\n\tconst numBlobs = snapshot.blobs.size;\n\tlet encodedBlobsSize = 0;\n\tfor (const [_, blobContent] of snapshot.blobs) {\n\t\tencodedBlobsSize += blobContent.byteLength;\n\t}\n\treturn { trees, numBlobs, encodedBlobsSize };\n}\n\nexport function validateBlobsAndTrees(snapshot: IOdspSnapshot) {\n\tassert(\n\t\tsnapshot.trees !== undefined,\n\t\t0x200 /* \"Returned odsp snapshot is malformed. No trees!\" */,\n\t);\n\tassert(\n\t\tsnapshot.blobs !== undefined,\n\t\t0x201 /* \"Returned odsp snapshot is malformed. No blobs!\" */,\n\t);\n}\n\nfunction countTreesInSnapshotTree(snapshotTree: ISnapshotTree): number {\n\tlet numTrees = 0;\n\tfor (const [_, tree] of Object.entries(snapshotTree.trees)) {\n\t\tnumTrees += 1;\n\t\tnumTrees += countTreesInSnapshotTree(tree);\n\t}\n\treturn numTrees;\n}\n\n/**\n * This function fetches the snapshot and parse it according to what is mentioned in response headers.\n * @param odspResolvedUrl - resolved odsp url.\n * @param storageToken - token to do the auth for network request.\n * @param snapshotOptions - Options used to specify how and what to fetch in the snapshot.\n * @param logger - logger\n * @param snapshotFormatFetchType - Snapshot format to fetch.\n * @param controller - abort controller if caller needs to abort the network call.\n * @param epochTracker - epoch tracker used to add/validate epoch in the network call.\n * @returns fetched snapshot.\n */\nexport async function downloadSnapshot(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tstorageToken: string,\n\tlogger: ITelemetryLoggerExt,\n\tsnapshotOptions: ISnapshotOptions | undefined,\n\tsnapshotFormatFetchType?: SnapshotFormatSupportType,\n\tcontroller?: AbortController,\n\tepochTracker?: EpochTracker,\n\tscenarioName?: string,\n): Promise<ISnapshotRequestAndResponseOptions> {\n\t// back-compat: This block to be removed with #8784 when we only consume/consider odsp resolvers that are >= 0.51\n\tconst sharingLinkToRedeem = (odspResolvedUrl as any).sharingLinkToRedeem;\n\tif (sharingLinkToRedeem) {\n\t\todspResolvedUrl.shareLinkInfo = { ...odspResolvedUrl.shareLinkInfo, sharingLinkToRedeem };\n\t}\n\n\tconst snapshotUrl = odspResolvedUrl.endpoints.snapshotStorageUrl;\n\n\tconst queryParams = { ump: 1 };\n\tif (snapshotOptions !== undefined) {\n\t\tObject.entries(snapshotOptions).forEach(([key, value]) => {\n\t\t\t// Exclude \"timeout\" from query string\n\t\t\tif (value !== undefined && key !== \"timeout\") {\n\t\t\t\tqueryParams[key] = value;\n\t\t\t}\n\t\t});\n\t}\n\n\tconst queryString = getQueryString(queryParams);\n\tconst url = `${snapshotUrl}/trees/latest${queryString}`;\n\t// The location of file can move on Spo in which case server returns 308(Permanent Redirect) error.\n\t// Adding below header will make VROOM API return 404 instead of 308 and browser can intercept it.\n\t// This error thrown by server will contain the new redirect location. Look at the 404 error parsing\n\t// for futher reference here: \\packages\\utils\\odsp-doclib-utils\\src\\odspErrorUtils.ts\n\tconst header = { prefer: \"manualredirect\" };\n\tconst { body, headers } = getFormBodyAndHeaders(odspResolvedUrl, storageToken, header);\n\tconst fetchOptions = {\n\t\tbody,\n\t\theaders,\n\t\tsignal: controller?.signal,\n\t\tmethod: \"POST\",\n\t};\n\t// Decide what snapshot format to fetch as per the feature gate.\n\tswitch (snapshotFormatFetchType) {\n\t\tcase SnapshotFormatSupportType.Binary:\n\t\t\theaders.accept = `application/ms-fluid; v=${currentReadVersion}`;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t// By default ask both versions and let the server decide the format.\n\t\t\theaders.accept = `application/json, application/ms-fluid; v=${currentReadVersion}`;\n\t}\n\n\tconst odspResponse = await (epochTracker?.fetch(\n\t\turl,\n\t\tfetchOptions,\n\t\t\"treesLatest\",\n\t\ttrue,\n\t\tscenarioName,\n\t) ?? fetchHelper(url, fetchOptions));\n\n\treturn {\n\t\todspResponse,\n\t\trequestHeaders: headers,\n\t\trequestUrl: url,\n\t};\n}\n\nfunction isRedeemSharingLinkError(odspResolvedUrl: IOdspResolvedUrl, error: any) {\n\tif (\n\t\todspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem !== undefined &&\n\t\ttypeof error === \"object\" &&\n\t\terror !== null &&\n\t\t(error.errorType === DriverErrorType.authorizationError ||\n\t\t\terror.errorType === DriverErrorType.fileNotFoundOrAccessDeniedError)\n\t) {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nfunction getEncodedShareUrl(url: string): string {\n\t/**\n\t * Encode the url to accepted format by Sharepoint\n\t * https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/shares_get\n\t */\n\tlet encodedUrl = fromUtf8ToBase64(encodeURI(url));\n\tencodedUrl = encodedUrl.replace(/=+$/g, \"\").replace(/\\//g, \"_\").replace(/\\+/g, \"-\");\n\tencodedUrl = \"u!\".concat(encodedUrl);\n\treturn encodedUrl;\n}\n"]}
@@ -2,8 +2,8 @@
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";
6
- import { IOdspUrlParts, OdspResourceTokenFetchOptions, IdentityType, TokenFetcher } from "@fluidframework/odsp-driver-definitions";
5
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
6
+ import { IOdspUrlParts, OdspResourceTokenFetchOptions, TokenFetcher } from "@fluidframework/odsp-driver-definitions";
7
7
  /**
8
8
  * Returns file link for a file with given drive and item ids.
9
9
  * Scope needed: files.readwrite.all.
@@ -11,12 +11,9 @@ import { IOdspUrlParts, OdspResourceTokenFetchOptions, IdentityType, TokenFetche
11
11
  * throttling error. In future, we are thinking of app allowing to pass some cancel token, with which
12
12
  * we would be able to stop retrying.
13
13
  * @param getToken - used to fetch access tokens needed to execute operation
14
- * @param siteUrl - url of the site that contains the file
15
- * @param driveId - drive where file is stored
16
- * @param itemId - file id
17
- * @param identityType - type of client account
14
+ * @param odspUrlParts - object describing file storage identity
18
15
  * @param logger - used to log results of operation, including any error
19
16
  * @returns Promise which resolves to file link url when successful; otherwise, undefined.
20
17
  */
21
- export declare function getFileLink(getToken: TokenFetcher<OdspResourceTokenFetchOptions>, odspUrlParts: IOdspUrlParts, identityType: IdentityType, logger: ITelemetryLogger): Promise<string>;
22
- //# sourceMappingURL=getFileLink.d.ts.map
18
+ export declare function getFileLink(getToken: TokenFetcher<OdspResourceTokenFetchOptions>, odspUrlParts: IOdspUrlParts, logger: ITelemetryLoggerExt): Promise<string>;
19
+ //# sourceMappingURL=getFileLink.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFileLink.d.mts","sourceRoot":"","sources":["../src/getFileLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAoB,MAAM,iCAAiC;OAIhF,EACN,aAAa,EACb,6BAA6B,EAC7B,YAAY,EACZ,MAAM,yCAAyC;AAahD;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAChC,QAAQ,EAAE,YAAY,CAAC,6BAA6B,CAAC,EACrD,YAAY,EAAE,aAAa,EAC3B,MAAM,EAAE,mBAAmB,GACzB,OAAO,CAAC,MAAM,CAAC,CAiDjB"}
@@ -2,14 +2,14 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/common-utils";
6
- import { canRetryOnError, NonRetryableError } from "@fluidframework/driver-utils";
7
5
  import { PerformanceEvent } from "@fluidframework/telemetry-utils";
6
+ import { assert } from "@fluidframework/core-utils";
7
+ import { NonRetryableError, runWithRetry } from "@fluidframework/driver-utils";
8
8
  import { DriverErrorType } from "@fluidframework/driver-definitions";
9
- import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth";
10
- import { fetchHelper, getWithRetryForTokenRefresh, toInstrumentedOdspTokenFetcher } from "./odspUtils";
11
- import { pkgVersion as driverVersion } from "./packageVersion";
12
- import { runWithRetry } from "./retryUtils";
9
+ import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth.mjs";
10
+ import { fetchHelper, getWithRetryForTokenRefresh, toInstrumentedOdspTokenFetcher, } from "./odspUtils.mjs";
11
+ import { pkgVersion as driverVersion } from "./packageVersion.mjs";
12
+ import { runWithRetry as runWithRetryForCoherencyAndServiceReadOnlyErrors } from "./retryUtils.mjs";
13
13
  // Store cached responses for the lifetime of web session as file link remains the same for given file item
14
14
  const fileLinkCache = new Map();
15
15
  /**
@@ -19,14 +19,11 @@ const fileLinkCache = new Map();
19
19
  * throttling error. In future, we are thinking of app allowing to pass some cancel token, with which
20
20
  * we would be able to stop retrying.
21
21
  * @param getToken - used to fetch access tokens needed to execute operation
22
- * @param siteUrl - url of the site that contains the file
23
- * @param driveId - drive where file is stored
24
- * @param itemId - file id
25
- * @param identityType - type of client account
22
+ * @param odspUrlParts - object describing file storage identity
26
23
  * @param logger - used to log results of operation, including any error
27
24
  * @returns Promise which resolves to file link url when successful; otherwise, undefined.
28
25
  */
29
- export async function getFileLink(getToken, odspUrlParts, identityType, logger) {
26
+ export async function getFileLink(getToken, odspUrlParts, logger) {
30
27
  const cacheKey = `${odspUrlParts.siteUrl}_${odspUrlParts.driveId}_${odspUrlParts.itemId}`;
31
28
  const maybeFileLinkCacheEntry = fileLinkCache.get(cacheKey);
32
29
  if (maybeFileLinkCacheEntry !== undefined) {
@@ -35,15 +32,23 @@ export async function getFileLink(getToken, odspUrlParts, identityType, logger)
35
32
  const fileLinkGenerator = async function () {
36
33
  let fileLinkCore;
37
34
  try {
38
- fileLinkCore = await runWithRetry(async () => getFileLinkCore(getToken, odspUrlParts, identityType, logger), "getFileLinkCore", logger);
35
+ let retryCount = 0;
36
+ fileLinkCore = await runWithRetry(async () => runWithRetryForCoherencyAndServiceReadOnlyErrors(async () => getFileLinkCore(getToken, odspUrlParts, logger), "getFileLinkCore", logger), "getShareLink", logger, {
37
+ onRetry(delayInMs, error) {
38
+ retryCount++;
39
+ if (retryCount === 5) {
40
+ if (error !== undefined && typeof error === "object") {
41
+ error.canRetry = false;
42
+ throw error;
43
+ }
44
+ throw error;
45
+ }
46
+ },
47
+ });
39
48
  }
40
49
  catch (err) {
41
- // runWithRetry throws a non retriable error after it hits the max # of attempts
42
- // or encounters an unexpected error type
43
- if (!canRetryOnError(err)) {
44
- // Delete from the cache to permit retrying later.
45
- fileLinkCache.delete(cacheKey);
46
- }
50
+ // Delete from the cache to permit retrying later.
51
+ fileLinkCache.delete(cacheKey);
47
52
  throw err;
48
53
  }
49
54
  // We are guaranteed to run the getFileLinkCore at least once with successful result (which must be a string)
@@ -54,43 +59,49 @@ export async function getFileLink(getToken, odspUrlParts, identityType, logger)
54
59
  fileLinkCache.set(cacheKey, fileLink);
55
60
  return fileLink;
56
61
  }
57
- async function getFileLinkCore(getToken, odspUrlParts, identityType, logger) {
58
- const fileItem = await getFileItemLite(getToken, odspUrlParts, logger, identityType === "Consumer");
62
+ async function getFileLinkCore(getToken, odspUrlParts, logger) {
63
+ const fileItem = await getFileItemLite(getToken, odspUrlParts, logger, true);
59
64
  // ODSP link requires extra call to return link that is resistant to file being renamed or moved to different folder
60
- return PerformanceEvent.timedExecAsync(logger, { eventName: "odspFileLink", requestName: "getSharingLink" }, async (event) => {
65
+ return PerformanceEvent.timedExecAsync(logger, { eventName: "odspFileLink", requestName: "getSharingInformation" }, async (event) => {
61
66
  let attempts = 0;
62
67
  let additionalProps;
63
68
  const fileLink = await getWithRetryForTokenRefresh(async (options) => {
64
- var _a;
65
69
  attempts++;
66
70
  const storageTokenFetcher = toInstrumentedOdspTokenFetcher(logger, odspUrlParts, getToken, true /* throwOnNullToken */);
67
71
  const storageToken = await storageTokenFetcher(options, "GetFileLinkCore");
68
72
  assert(storageToken !== null, 0x2bb /* "Instrumented token fetcher with throwOnNullToken = true should never return null" */);
69
- const { url, headers } = getUrlAndHeadersWithAuth(`${odspUrlParts.siteUrl}/_api/web/GetFileByServerRelativeUrl(@a1)/Linkingurl?@a1=${encodeURIComponent(`'${new URL(fileItem.webDavUrl).pathname}'`)}`, storageToken, false);
73
+ // IMPORTANT: In past we were using GetFileByUrl() API to get to the list item that was corresponding
74
+ // to the file. This was intentionally replaced with GetFileById() to solve the following issue:
75
+ // GetFileByUrl() uses webDavUrl to locate list item. This API does not work for Consumer scenarios
76
+ // where webDavUrl is constructed using legacy ODC format for backward compatibility reasons.
77
+ // GetFileByUrl() does not understand that format and thus fails. GetFileById() relies on file item
78
+ // unique guid (sharepointIds.listItemUniqueId) and it works uniformly across Consumer and Commercial.
79
+ const { url, headers } = getUrlAndHeadersWithAuth(`${odspUrlParts.siteUrl}/_api/web/GetFileById(@a1)/ListItemAllFields/GetSharingInformation?@a1=guid${encodeURIComponent(`'${fileItem.sharepointIds.listItemUniqueId}'`)}`, storageToken, true);
70
80
  const requestInit = {
71
81
  method: "POST",
72
- headers: Object.assign({ "Content-Type": "application/json;odata=verbose", "Accept": "application/json;odata=verbose" }, headers),
82
+ headers: {
83
+ "Content-Type": "application/json;odata=verbose",
84
+ "Accept": "application/json;odata=verbose",
85
+ ...headers,
86
+ },
73
87
  };
74
88
  const response = await fetchHelper(url, requestInit);
75
89
  additionalProps = response.propsToLog;
76
90
  const sharingInfo = await response.content.json();
77
- const linkingUrl = (_a = sharingInfo === null || sharingInfo === void 0 ? void 0 : sharingInfo.d) === null || _a === void 0 ? void 0 : _a.LinkingUrl;
78
- if (typeof linkingUrl !== "string") {
91
+ const directUrl = sharingInfo?.d?.directUrl;
92
+ if (typeof directUrl !== "string") {
79
93
  // This will retry once in getWithRetryForTokenRefresh
80
- throw new NonRetryableError("Malformed GetSharingLink response", DriverErrorType.incorrectServerResponse, { driverVersion });
94
+ throw new NonRetryableError("Malformed GetSharingInformation response", DriverErrorType.incorrectServerResponse, { driverVersion });
81
95
  }
82
- return linkingUrl;
96
+ return directUrl;
83
97
  });
84
- event.end(Object.assign(Object.assign({}, additionalProps), { attempts }));
98
+ event.end({ ...additionalProps, attempts });
85
99
  return fileLink;
86
100
  });
87
101
  }
88
- const isFileItemLite = (maybeFileItemLite) => {
89
- if (typeof maybeFileItemLite.webUrl !== "string" || typeof maybeFileItemLite.webDavUrl !== "string") {
90
- return false;
91
- }
92
- return true;
93
- };
102
+ const isFileItemLite = (maybeFileItemLite) => typeof maybeFileItemLite.webUrl === "string" &&
103
+ typeof maybeFileItemLite.webDavUrl === "string" &&
104
+ typeof maybeFileItemLite.sharepointIds === "object";
94
105
  async function getFileItemLite(getToken, odspUrlParts, logger, forceAccessTokenViaAuthorizationHeader) {
95
106
  return PerformanceEvent.timedExecAsync(logger, { eventName: "odspFileLink", requestName: "getFileItemLite" }, async (event) => {
96
107
  let attempts = 0;
@@ -101,7 +112,7 @@ async function getFileItemLite(getToken, odspUrlParts, logger, forceAccessTokenV
101
112
  const storageTokenFetcher = toInstrumentedOdspTokenFetcher(logger, odspUrlParts, getToken, true /* throwOnNullToken */);
102
113
  const storageToken = await storageTokenFetcher(options, "GetFileItemLite");
103
114
  assert(storageToken !== null, 0x2bc /* "Instrumented token fetcher with throwOnNullToken =true should never return null" */);
104
- const { url, headers } = getUrlAndHeadersWithAuth(`${siteUrl}/_api/v2.0/drives/${driveId}/items/${itemId}?select=webUrl,webDavUrl`, storageToken, forceAccessTokenViaAuthorizationHeader);
115
+ const { url, headers } = getUrlAndHeadersWithAuth(`${siteUrl}/_api/v2.0/drives/${driveId}/items/${itemId}?select=webUrl,webDavUrl,sharepointIds`, storageToken, forceAccessTokenViaAuthorizationHeader);
105
116
  const requestInit = { method: "GET", headers };
106
117
  const response = await fetchHelper(url, requestInit);
107
118
  additionalProps = response.propsToLog;
@@ -112,8 +123,8 @@ async function getFileItemLite(getToken, odspUrlParts, logger, forceAccessTokenV
112
123
  }
113
124
  return responseJson;
114
125
  });
115
- event.end(Object.assign(Object.assign({}, additionalProps), { attempts }));
126
+ event.end({ ...additionalProps, attempts });
116
127
  return fileItem;
117
128
  });
118
129
  }
119
- //# sourceMappingURL=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rD,eAAe,GAAG,QAAQ,CAAC,UAAU,CAAC;YAEtC,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACnD,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,EAAE;gBAClC,sDAAsD;gBACtD,MAAM,IAAI,iBAAiB,CAC1B,oCAAoC,EACpC,eAAe,CAAC,uBAAuB,EACvC,EAAE,aAAa,EAAE,CACjB,CAAC;aACF;YACD,OAAO,YAAY,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,eAAe,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC5C,OAAO,QAAQ,CAAC;IACjB,CAAC,CACD,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { NonRetryableError, runWithRetry } from \"@fluidframework/driver-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport {\n\tIOdspUrlParts,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth\";\nimport {\n\tfetchHelper,\n\tgetWithRetryForTokenRefresh,\n\ttoInstrumentedOdspTokenFetcher,\n} from \"./odspUtils\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { runWithRetry as runWithRetryForCoherencyAndServiceReadOnlyErrors } from \"./retryUtils\";\n\n// Store cached responses for the lifetime of web session as file link remains the same for given file item\nconst fileLinkCache = new Map<string, Promise<string>>();\n\n/**\n * Returns file link for a file with given drive and item ids.\n * Scope needed: files.readwrite.all.\n * This function keeps retrying if it gets a retriable error or wait for some delay if it gets a\n * throttling error. In future, we are thinking of app allowing to pass some cancel token, with which\n * we would be able to stop retrying.\n * @param getToken - used to fetch access tokens needed to execute operation\n * @param odspUrlParts - object describing file storage identity\n * @param logger - used to log results of operation, including any error\n * @returns Promise which resolves to file link url when successful; otherwise, undefined.\n */\nexport async function getFileLink(\n\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\todspUrlParts: IOdspUrlParts,\n\tlogger: ITelemetryLoggerExt,\n): Promise<string> {\n\tconst cacheKey = `${odspUrlParts.siteUrl}_${odspUrlParts.driveId}_${odspUrlParts.itemId}`;\n\tconst maybeFileLinkCacheEntry = fileLinkCache.get(cacheKey);\n\tif (maybeFileLinkCacheEntry !== undefined) {\n\t\treturn maybeFileLinkCacheEntry;\n\t}\n\n\tconst fileLinkGenerator = async function () {\n\t\tlet fileLinkCore: string;\n\t\ttry {\n\t\t\tlet retryCount = 0;\n\t\t\tfileLinkCore = await runWithRetry(\n\t\t\t\tasync () =>\n\t\t\t\t\trunWithRetryForCoherencyAndServiceReadOnlyErrors(\n\t\t\t\t\t\tasync () => getFileLinkCore(getToken, odspUrlParts, logger),\n\t\t\t\t\t\t\"getFileLinkCore\",\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t),\n\t\t\t\t\"getShareLink\",\n\t\t\t\tlogger,\n\t\t\t\t{\n\t\t\t\t\tonRetry(delayInMs: number, error: any) {\n\t\t\t\t\t\tretryCount++;\n\t\t\t\t\t\tif (retryCount === 5) {\n\t\t\t\t\t\t\tif (error !== undefined && typeof error === \"object\") {\n\t\t\t\t\t\t\t\terror.canRetry = false;\n\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\t\t} catch (err) {\n\t\t\t// Delete from the cache to permit retrying later.\n\t\t\tfileLinkCache.delete(cacheKey);\n\t\t\tthrow err;\n\t\t}\n\n\t\t// We are guaranteed to run the getFileLinkCore at least once with successful result (which must be a string)\n\t\tassert(\n\t\t\tfileLinkCore !== undefined,\n\t\t\t0x292 /* \"Unexpected undefined result from getFileLinkCore\" */,\n\t\t);\n\t\treturn fileLinkCore;\n\t};\n\tconst fileLink = fileLinkGenerator();\n\tfileLinkCache.set(cacheKey, fileLink);\n\treturn fileLink;\n}\n\nasync function getFileLinkCore(\n\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\todspUrlParts: IOdspUrlParts,\n\tlogger: ITelemetryLoggerExt,\n): Promise<string> {\n\tconst fileItem = await getFileItemLite(getToken, odspUrlParts, logger, true);\n\n\t// ODSP link requires extra call to return link that is resistant to file being renamed or moved to different folder\n\treturn PerformanceEvent.timedExecAsync(\n\t\tlogger,\n\t\t{ eventName: \"odspFileLink\", requestName: \"getSharingInformation\" },\n\t\tasync (event) => {\n\t\t\tlet attempts = 0;\n\t\t\tlet additionalProps;\n\t\t\tconst fileLink = await getWithRetryForTokenRefresh(async (options) => {\n\t\t\t\tattempts++;\n\t\t\t\tconst storageTokenFetcher = toInstrumentedOdspTokenFetcher(\n\t\t\t\t\tlogger,\n\t\t\t\t\todspUrlParts,\n\t\t\t\t\tgetToken,\n\t\t\t\t\ttrue /* throwOnNullToken */,\n\t\t\t\t);\n\t\t\t\tconst storageToken = await storageTokenFetcher(options, \"GetFileLinkCore\");\n\t\t\t\tassert(\n\t\t\t\t\tstorageToken !== null,\n\t\t\t\t\t0x2bb /* \"Instrumented token fetcher with throwOnNullToken = true should never return null\" */,\n\t\t\t\t);\n\n\t\t\t\t// IMPORTANT: In past we were using GetFileByUrl() API to get to the list item that was corresponding\n\t\t\t\t// to the file. This was intentionally replaced with GetFileById() to solve the following issue:\n\t\t\t\t// GetFileByUrl() uses webDavUrl to locate list item. This API does not work for Consumer scenarios\n\t\t\t\t// where webDavUrl is constructed using legacy ODC format for backward compatibility reasons.\n\t\t\t\t// GetFileByUrl() does not understand that format and thus fails. GetFileById() relies on file item\n\t\t\t\t// unique guid (sharepointIds.listItemUniqueId) and it works uniformly across Consumer and Commercial.\n\t\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t\t`${\n\t\t\t\t\t\todspUrlParts.siteUrl\n\t\t\t\t\t}/_api/web/GetFileById(@a1)/ListItemAllFields/GetSharingInformation?@a1=guid${encodeURIComponent(\n\t\t\t\t\t\t`'${fileItem.sharepointIds.listItemUniqueId}'`,\n\t\t\t\t\t)}`,\n\t\t\t\t\tstorageToken,\n\t\t\t\t\ttrue,\n\t\t\t\t);\n\t\t\t\tconst requestInit = {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"Content-Type\": \"application/json;odata=verbose\",\n\t\t\t\t\t\t\"Accept\": \"application/json;odata=verbose\",\n\t\t\t\t\t\t...headers,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst response = await fetchHelper(url, requestInit);\n\t\t\t\tadditionalProps = response.propsToLog;\n\n\t\t\t\tconst sharingInfo = await response.content.json();\n\t\t\t\tconst directUrl = sharingInfo?.d?.directUrl;\n\t\t\t\tif (typeof directUrl !== \"string\") {\n\t\t\t\t\t// This will retry once in getWithRetryForTokenRefresh\n\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t\"Malformed GetSharingInformation response\",\n\t\t\t\t\t\tDriverErrorType.incorrectServerResponse,\n\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn directUrl;\n\t\t\t});\n\t\t\tevent.end({ ...additionalProps, attempts });\n\t\t\treturn fileLink;\n\t\t},\n\t);\n}\n\n/**\n * Sharepoint Ids Interface\n */\ninterface IGraphSharepointIds {\n\tlistId: string;\n\tlistItemId: string;\n\tlistItemUniqueId: string;\n\tsiteId: string;\n\tsiteUrl: string;\n\twebId: string;\n}\n\n/**\n * This represents a lite version of file item containing only select file properties\n */\ninterface FileItemLite {\n\twebUrl: string;\n\twebDavUrl: string;\n\tsharepointIds: IGraphSharepointIds;\n}\n\nconst isFileItemLite = (maybeFileItemLite: any): maybeFileItemLite is FileItemLite =>\n\ttypeof maybeFileItemLite.webUrl === \"string\" &&\n\ttypeof maybeFileItemLite.webDavUrl === \"string\" &&\n\ttypeof maybeFileItemLite.sharepointIds === \"object\";\n\nasync function getFileItemLite(\n\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\todspUrlParts: IOdspUrlParts,\n\tlogger: ITelemetryLoggerExt,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n): Promise<FileItemLite> {\n\treturn PerformanceEvent.timedExecAsync(\n\t\tlogger,\n\t\t{ eventName: \"odspFileLink\", requestName: \"getFileItemLite\" },\n\t\tasync (event) => {\n\t\t\tlet attempts = 0;\n\t\t\tlet additionalProps;\n\t\t\tconst fileItem = await getWithRetryForTokenRefresh(async (options) => {\n\t\t\t\tattempts++;\n\t\t\t\tconst { siteUrl, driveId, itemId } = odspUrlParts;\n\t\t\t\tconst storageTokenFetcher = toInstrumentedOdspTokenFetcher(\n\t\t\t\t\tlogger,\n\t\t\t\t\todspUrlParts,\n\t\t\t\t\tgetToken,\n\t\t\t\t\ttrue /* throwOnNullToken */,\n\t\t\t\t);\n\t\t\t\tconst storageToken = await storageTokenFetcher(options, \"GetFileItemLite\");\n\t\t\t\tassert(\n\t\t\t\t\tstorageToken !== null,\n\t\t\t\t\t0x2bc /* \"Instrumented token fetcher with throwOnNullToken =true should never return null\" */,\n\t\t\t\t);\n\n\t\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t\t`${siteUrl}/_api/v2.0/drives/${driveId}/items/${itemId}?select=webUrl,webDavUrl,sharepointIds`,\n\t\t\t\t\tstorageToken,\n\t\t\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t\t\t);\n\t\t\t\tconst requestInit = { method: \"GET\", headers };\n\t\t\t\tconst response = await fetchHelper(url, requestInit);\n\t\t\t\tadditionalProps = response.propsToLog;\n\n\t\t\t\tconst responseJson = await response.content.json();\n\t\t\t\tif (!isFileItemLite(responseJson)) {\n\t\t\t\t\t// This will retry once in getWithRetryForTokenRefresh\n\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t\"Malformed getFileItemLite response\",\n\t\t\t\t\t\tDriverErrorType.incorrectServerResponse,\n\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn responseJson;\n\t\t\t});\n\t\t\tevent.end({ ...additionalProps, attempts });\n\t\t\treturn fileItem;\n\t\t},\n\t);\n}\n"]}
@@ -1,7 +1,3 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
1
  import { ISnapshotOptions } from "@fluidframework/odsp-driver-definitions";
6
2
  /**
7
3
  * Generates query string from the given query parameters.
@@ -10,4 +6,4 @@ import { ISnapshotOptions } from "@fluidframework/odsp-driver-definitions";
10
6
  export declare function getQueryString(queryParams: {
11
7
  [key: string]: string | number;
12
8
  } | ISnapshotOptions): string;
13
- //# sourceMappingURL=getQueryString.d.ts.map
9
+ //# sourceMappingURL=getQueryString.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getQueryString.d.mts","sourceRoot":"","sources":["../src/getQueryString.ts"],"names":[],"mappings":"OAIO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC;AAE1E;;;GAGG;AACH,wBAAgB,cAAc,CAC7B,WAAW,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,gBAAgB,GAChE,MAAM,CAUR"}
@@ -12,4 +12,4 @@ export function getQueryString(queryParams) {
12
12
  }
13
13
  return queryString;
14
14
  }
15
- //# sourceMappingURL=getQueryString.js.map
15
+ //# sourceMappingURL=getQueryString.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getQueryString.mjs","sourceRoot":"","sources":["../src/getQueryString.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC7B,WAAkE;IAElE,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;QAC3C,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;YACnC,MAAM,SAAS,GAAG,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YACjD,WAAW,IAAI,GAAG,SAAS,GAAG,GAAG,IAAI,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;SAC5E;KACD;IAED,OAAO,WAAW,CAAC;AACpB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ISnapshotOptions } from \"@fluidframework/odsp-driver-definitions\";\n\n/**\n * Generates query string from the given query parameters.\n * @param queryParams - Query parameters from which to create a query.\n */\nexport function getQueryString(\n\tqueryParams: { [key: string]: string | number } | ISnapshotOptions,\n): string {\n\tlet queryString = \"\";\n\tfor (const key of Object.keys(queryParams)) {\n\t\tif (queryParams[key] !== undefined) {\n\t\t\tconst startChar = queryString === \"\" ? \"?\" : \"&\";\n\t\t\tqueryString += `${startChar}${key}=${encodeURIComponent(queryParams[key])}`;\n\t\t}\n\t}\n\n\treturn queryString;\n}\n"]}
@@ -8,4 +8,4 @@ export declare function getUrlAndHeadersWithAuth(url: string, token: string | nu
8
8
  [index: string]: string;
9
9
  };
10
10
  };
11
- //# sourceMappingURL=getUrlAndHeadersWithAuth.d.ts.map
11
+ //# sourceMappingURL=getUrlAndHeadersWithAuth.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUrlAndHeadersWithAuth.d.mts","sourceRoot":"","sources":["../src/getUrlAndHeadersWithAuth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,wBAAwB,CACvC,GAAG,EAAE,MAAM,EAEX,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,sCAAsC,EAAE,OAAO,GAC7C;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CAAE,CAgCvD"}
@@ -2,7 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- export function getUrlAndHeadersWithAuth(url, token, forceAccessTokenViaAuthorizationHeader) {
5
+ export function getUrlAndHeadersWithAuth(url,
6
+ // eslint-disable-next-line @rushstack/no-new-null
7
+ token, forceAccessTokenViaAuthorizationHeader) {
6
8
  if (!token || token.length === 0) {
7
9
  return { url, headers: {} };
8
10
  }
@@ -33,4 +35,4 @@ export function getUrlAndHeadersWithAuth(url, token, forceAccessTokenViaAuthoriz
33
35
  url,
34
36
  };
35
37
  }
36
- //# sourceMappingURL=getUrlAndHeadersWithAuth.js.map
38
+ //# sourceMappingURL=getUrlAndHeadersWithAuth.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUrlAndHeadersWithAuth.mjs","sourceRoot":"","sources":["../src/getUrlAndHeadersWithAuth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,UAAU,wBAAwB,CACvC,GAAW;AACX,kDAAkD;AAClD,KAAoB,EACpB,sCAA+C;IAE/C,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACjC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;KAC5B;IAED,IAAI,CAAC,sCAAsC,EAAE;QAC5C,4FAA4F;QAC5F,6DAA6D;QAC7D,MAAM,+BAA+B,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACrD,4FAA4F;QAC5F,qCAAqC;QACrC,+BAA+B,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;QACxE,mFAAmF;QACnF,wGAAwG;QACxG,4EAA4E;QAC5E,2GAA2G;QAC3G,0GAA0G;QAC1G,gBAAgB;QAChB,IAAI,+BAA+B,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE;YAC1D,OAAO;gBACN,OAAO,EAAE,EAAE;gBACX,GAAG,EAAE,+BAA+B,CAAC,IAAI;aACzC,CAAC;SACF;KACD;IAED,OAAO;QACN,OAAO,EAAE;YACR,aAAa,EAAE,UAAU,KAAK,EAAE;SAChC;QACD,GAAG;KACH,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport function getUrlAndHeadersWithAuth(\n\turl: string,\n\t// eslint-disable-next-line @rushstack/no-new-null\n\ttoken: string | null,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n): { url: string; headers: { [index: string]: string } } {\n\tif (!token || token.length === 0) {\n\t\treturn { url, headers: {} };\n\t}\n\n\tif (!forceAccessTokenViaAuthorizationHeader) {\n\t\t// Pass access token via query string: this will make request be treated as 'simple' request\n\t\t// which does not require OPTIONS call as part of CORS check.\n\t\tconst urlWithAccessTokenInQueryString = new URL(url);\n\t\t// IMPORTANT: Do not apply encodeURIComponent to token, param value is automatically encoded\n\t\t// when set via URLSearchParams class\n\t\turlWithAccessTokenInQueryString.searchParams.set(\"access_token\", token);\n\t\t// ODSP APIs have a limitation that the query string cannot exceed 2048 characters.\n\t\t// If the query string exceeds 2048, we have to fall back to sending the access token as a header, which\n\t\t// has a negative performance implication as it adds a performance overhead.\n\t\t// NOTE: URL.search.length value includes '?' symbol and it is unclear whether backend logic which enforces\n\t\t// query length limit accounts for it. This logic errs on side of caution and includes that key in overall\n\t\t// query length.\n\t\tif (urlWithAccessTokenInQueryString.search.length <= 2048) {\n\t\t\treturn {\n\t\t\t\theaders: {},\n\t\t\t\turl: urlWithAccessTokenInQueryString.href,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn {\n\t\theaders: {\n\t\t\tAuthorization: `Bearer ${token}`,\n\t\t},\n\t\turl,\n\t};\n}\n"]}
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { OdcApiSiteOrigin, OdcFileSiteOrigin } from "./constants.mjs";
6
+ export { ClpCompliantAppHeader, IClpCompliantAppHeader, ISharingLinkHeader, OdspFluidDataStoreLocator, SharingLinkHeader, } from "./contractsPublic.mjs";
7
+ export { checkUrl } from "./checkUrl.mjs";
8
+ export { createOdspUrl } from "./createOdspUrl.mjs";
9
+ export { getHashedDocumentId, ISnapshotContents } from "./odspPublicUtils.mjs";
10
+ export { getApiRoot, getOdspUrlParts, isOdcOrigin, isOdcUrl, isSpoUrl } from "./odspUrlHelper.mjs";
11
+ export { prefetchLatestSnapshot } from "./prefetchLatestSnapshot.mjs";
12
+ export { createLocalOdspDocumentServiceFactory, OdspDocumentServiceFactory, } from "./odspDocumentServiceFactory.mjs";
13
+ export { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore.mjs";
14
+ export { OdspDocumentServiceFactoryWithCodeSplit } from "./odspDocumentServiceFactoryWithCodeSplit.mjs";
15
+ export { createOdspCreateContainerRequest } from "./createOdspCreateContainerRequest.mjs";
16
+ export { OdspDriverUrlResolver } from "./odspDriverUrlResolver.mjs";
17
+ export { OdspDriverUrlResolverForShareLink, ShareLinkFetcherProps, } from "./odspDriverUrlResolverForShareLink.mjs";
18
+ export { encodeOdspFluidDataStoreLocator, getLocatorFromOdspUrl, locatorQueryParamName, storeLocatorInOdspUrl, } from "./odspFluidFileLink.mjs";
19
+ export { IOdspCache, IPersistedFileCache, INonPersistentCache, IPrefetchSnapshotContents, } from "./odspCache.mjs";
20
+ export { ICacheAndTracker, type EpochTracker, FetchType, FetchTypeInternal } from "./epochTracker.mjs";
21
+ export { IOdspResponse, isOdspResolvedUrl } from "./odspUtils.mjs";
22
+ export { SnapshotFormatSupportType } from "./fetchSnapshot.mjs";
23
+ export { ISnapshotContentsWithProps, parseCompactSnapshotResponse } from "./compactSnapshotParser.mjs";
24
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,gBAAgB,EAAE,iBAAiB,EAAE;OAEvC,EACN,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,GACjB;OAGM,EAAE,QAAQ,EAAE;OACZ,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE;OAC1C,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE;OAGhE,EAAE,sBAAsB,EAAE;OAG1B,EACN,qCAAqC,EACrC,0BAA0B,GAC1B;OACM,EAAE,8BAA8B,EAAE;OAClC,EAAE,uCAAuC,EAAE;OAG3C,EAAE,gCAAgC,EAAE;OAGpC,EAAE,qBAAqB,EAAE;OACzB,EACN,iCAAiC,EACjC,qBAAqB,GACrB;OAGM,EACN,+BAA+B,EAC/B,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACrB;OAEM,EACN,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,GACzB;OACM,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE;OACrE,EAAE,aAAa,EAAE,iBAAiB,EAAE;OACpC,EAAE,yBAAyB,EAAE;OAC7B,EAAE,0BAA0B,EAAE,4BAA4B,EAAE"}
package/lib/index.mjs ADDED
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { OdcApiSiteOrigin, OdcFileSiteOrigin } from "./constants.mjs";
6
+ export { ClpCompliantAppHeader, SharingLinkHeader, } from "./contractsPublic.mjs";
7
+ export { checkUrl } from "./checkUrl.mjs";
8
+ export { createOdspUrl } from "./createOdspUrl.mjs";
9
+ export { getHashedDocumentId } from "./odspPublicUtils.mjs";
10
+ export { getApiRoot, getOdspUrlParts, isOdcOrigin, isOdcUrl, isSpoUrl } from "./odspUrlHelper.mjs";
11
+ export { prefetchLatestSnapshot } from "./prefetchLatestSnapshot.mjs";
12
+ export { createLocalOdspDocumentServiceFactory, OdspDocumentServiceFactory, } from "./odspDocumentServiceFactory.mjs";
13
+ export { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore.mjs";
14
+ export { OdspDocumentServiceFactoryWithCodeSplit } from "./odspDocumentServiceFactoryWithCodeSplit.mjs";
15
+ export { createOdspCreateContainerRequest } from "./createOdspCreateContainerRequest.mjs";
16
+ export { OdspDriverUrlResolver } from "./odspDriverUrlResolver.mjs";
17
+ export { OdspDriverUrlResolverForShareLink, } from "./odspDriverUrlResolverForShareLink.mjs";
18
+ export { encodeOdspFluidDataStoreLocator, getLocatorFromOdspUrl, locatorQueryParamName, storeLocatorInOdspUrl, } from "./odspFluidFileLink.mjs";
19
+ export { isOdspResolvedUrl } from "./odspUtils.mjs";
20
+ export { SnapshotFormatSupportType } from "./fetchSnapshot.mjs";
21
+ export { parseCompactSnapshotResponse } from "./compactSnapshotParser.mjs";
22
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,gBAAgB,EAAE,iBAAiB,EAAE;OAEvC,EACN,qBAAqB,EAIrB,iBAAiB,GACjB;OAGM,EAAE,QAAQ,EAAE;OACZ,EAAE,aAAa,EAAE;OACjB,EAAE,mBAAmB,EAAqB;OAC1C,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE;OAGhE,EAAE,sBAAsB,EAAE;OAG1B,EACN,qCAAqC,EACrC,0BAA0B,GAC1B;OACM,EAAE,8BAA8B,EAAE;OAClC,EAAE,uCAAuC,EAAE;OAG3C,EAAE,gCAAgC,EAAE;OAGpC,EAAE,qBAAqB,EAAE;OACzB,EACN,iCAAiC,GAEjC;OAGM,EACN,+BAA+B,EAC/B,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACrB;OASM,EAAiB,iBAAiB,EAAE;OACpC,EAAE,yBAAyB,EAAE;OAC7B,EAA8B,4BAA4B,EAAE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Constants\nexport { OdcApiSiteOrigin, OdcFileSiteOrigin } from \"./constants\";\n\nexport {\n\tClpCompliantAppHeader,\n\tIClpCompliantAppHeader,\n\tISharingLinkHeader,\n\tOdspFluidDataStoreLocator,\n\tSharingLinkHeader,\n} from \"./contractsPublic\";\n\n// public utils\nexport { checkUrl } from \"./checkUrl\";\nexport { createOdspUrl } from \"./createOdspUrl\";\nexport { getHashedDocumentId, ISnapshotContents } from \"./odspPublicUtils\";\nexport { getApiRoot, getOdspUrlParts, isOdcOrigin, isOdcUrl, isSpoUrl } from \"./odspUrlHelper\";\n\n// prefetch latest snapshot before container load\nexport { prefetchLatestSnapshot } from \"./prefetchLatestSnapshot\";\n\n// Factory\nexport {\n\tcreateLocalOdspDocumentServiceFactory,\n\tOdspDocumentServiceFactory,\n} from \"./odspDocumentServiceFactory\";\nexport { OdspDocumentServiceFactoryCore } from \"./odspDocumentServiceFactoryCore\";\nexport { OdspDocumentServiceFactoryWithCodeSplit } from \"./odspDocumentServiceFactoryWithCodeSplit\";\n\n// File creation\nexport { createOdspCreateContainerRequest } from \"./createOdspCreateContainerRequest\";\n\n// URI Resolver functionality, URI management\nexport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver\";\nexport {\n\tOdspDriverUrlResolverForShareLink,\n\tShareLinkFetcherProps,\n} from \"./odspDriverUrlResolverForShareLink\";\n\n// It's used by URL resolve code, but also has some public functions\nexport {\n\tencodeOdspFluidDataStoreLocator,\n\tgetLocatorFromOdspUrl,\n\tlocatorQueryParamName,\n\tstoreLocatorInOdspUrl,\n} from \"./odspFluidFileLink\";\n\nexport {\n\tIOdspCache,\n\tIPersistedFileCache,\n\tINonPersistentCache,\n\tIPrefetchSnapshotContents,\n} from \"./odspCache\";\nexport { ICacheAndTracker, type EpochTracker, FetchType, FetchTypeInternal } from \"./epochTracker\";\nexport { IOdspResponse, isOdspResolvedUrl } from \"./odspUtils\";\nexport { SnapshotFormatSupportType } from \"./fetchSnapshot\";\nexport { ISnapshotContentsWithProps, parseCompactSnapshotResponse } from \"./compactSnapshotParser\";\n"]}
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
6
+ import { IDocumentDeltaStorageService, IStream } from "@fluidframework/driver-definitions";
7
+ import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
8
+ /**
9
+ * Implementation of IDocumentDeltaStorageService that will return snapshot ops when fetching messages
10
+ */
11
+ export declare class LocalOdspDeltaStorageService implements IDocumentDeltaStorageService {
12
+ private readonly logger;
13
+ private snapshotOps;
14
+ constructor(logger: ITelemetryLoggerExt, snapshotOps: ISequencedDocumentMessage[]);
15
+ fetchMessages(from: number, to: number | undefined, _abortSignal?: AbortSignal, _cachedOnly?: boolean, _fetchReason?: string): IStream<ISequencedDocumentMessage[]>;
16
+ }
17
+ //# sourceMappingURL=localOdspDeltaStorageService.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localOdspDeltaStorageService.d.mts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;OAC9D,EAAE,4BAA4B,EAAE,OAAO,EAAE,MAAM,oCAAoC;OAEnF,EAAE,yBAAyB,EAAE,MAAM,sCAAsC;AAGhF;;GAEG;AACH,qBAAa,4BAA6B,YAAW,4BAA4B;IAE/E,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,WAAW;gBADF,MAAM,EAAE,mBAAmB,EACpC,WAAW,EAAE,yBAAyB,EAAE;IAG1C,aAAa,CACnB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GAAG,SAAS,EACtB,YAAY,CAAC,EAAE,WAAW,EAC1B,WAAW,CAAC,EAAE,OAAO,EACrB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,yBAAyB,EAAE,CAAC;CAsBvC"}
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { Queue, emptyMessageStream } from "@fluidframework/driver-utils";
6
+ import { validateMessages } from "@fluidframework/driver-base";
7
+ /**
8
+ * Implementation of IDocumentDeltaStorageService that will return snapshot ops when fetching messages
9
+ */
10
+ export class LocalOdspDeltaStorageService {
11
+ constructor(logger, snapshotOps) {
12
+ this.logger = logger;
13
+ this.snapshotOps = snapshotOps;
14
+ }
15
+ fetchMessages(from, to, _abortSignal, _cachedOnly, _fetchReason) {
16
+ if (this.snapshotOps.length === 0) {
17
+ return emptyMessageStream;
18
+ }
19
+ const queue = new Queue();
20
+ const messages = this.snapshotOps.filter((op) => op.sequenceNumber >= from && (to === undefined || op.sequenceNumber < to));
21
+ validateMessages("cached", messages, from, this.logger);
22
+ if (messages.length === 0 || messages[0].sequenceNumber !== from) {
23
+ this.snapshotOps = [];
24
+ }
25
+ this.snapshotOps = this.snapshotOps.filter((op) => to !== undefined && op.sequenceNumber >= to);
26
+ queue.pushValue(messages);
27
+ queue.pushDone();
28
+ return queue;
29
+ }
30
+ }
31
+ //# sourceMappingURL=localOdspDeltaStorageService.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localOdspDeltaStorageService.mjs","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B;OAEjE,EAAE,gBAAgB,EAAE,MAAM,6BAA6B;AAE9D;;GAEG;AACH,MAAM,OAAO,4BAA4B;IACxC,YACkB,MAA2B,EACpC,WAAwC;QAD/B,WAAM,GAAN,MAAM,CAAqB;QACpC,gBAAW,GAAX,WAAW,CAA6B;IAC9C,CAAC;IAEG,aAAa,CACnB,IAAY,EACZ,EAAsB,EACtB,YAA0B,EAC1B,WAAqB,EACrB,YAAqB;QAErB,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,OAAO,kBAAkB,CAAC;SAC1B;QAED,MAAM,KAAK,GAAG,IAAI,KAAK,EAA+B,CAAC;QACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CACvC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,cAAc,IAAI,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,cAAc,GAAG,EAAE,CAAC,CACjF,CAAC;QACF,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAExD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,KAAK,IAAI,EAAE;YACjE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;SACtB;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CACzC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,cAAc,IAAI,EAAE,CACnD,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC1B,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { IDocumentDeltaStorageService, IStream } from \"@fluidframework/driver-definitions\";\nimport { Queue, emptyMessageStream } from \"@fluidframework/driver-utils\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { validateMessages } from \"@fluidframework/driver-base\";\n\n/**\n * Implementation of IDocumentDeltaStorageService that will return snapshot ops when fetching messages\n */\nexport class LocalOdspDeltaStorageService implements IDocumentDeltaStorageService {\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate snapshotOps: ISequencedDocumentMessage[],\n\t) {}\n\n\tpublic fetchMessages(\n\t\tfrom: number,\n\t\tto: number | undefined,\n\t\t_abortSignal?: AbortSignal,\n\t\t_cachedOnly?: boolean,\n\t\t_fetchReason?: string,\n\t): IStream<ISequencedDocumentMessage[]> {\n\t\tif (this.snapshotOps.length === 0) {\n\t\t\treturn emptyMessageStream;\n\t\t}\n\n\t\tconst queue = new Queue<ISequencedDocumentMessage[]>();\n\t\tconst messages = this.snapshotOps.filter(\n\t\t\t(op) => op.sequenceNumber >= from && (to === undefined || op.sequenceNumber < to),\n\t\t);\n\t\tvalidateMessages(\"cached\", messages, from, this.logger);\n\n\t\tif (messages.length === 0 || messages[0].sequenceNumber !== from) {\n\t\t\tthis.snapshotOps = [];\n\t\t}\n\t\tthis.snapshotOps = this.snapshotOps.filter(\n\t\t\t(op) => to !== undefined && op.sequenceNumber >= to,\n\t\t);\n\n\t\tqueue.pushValue(messages);\n\t\tqueue.pushDone();\n\t\treturn queue;\n\t}\n}\n"]}
@@ -2,7 +2,7 @@
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 { IDocumentDeltaStorageService, IDocumentService, IDocumentStorageService, IResolvedUrl } from "@fluidframework/driver-definitions";
7
7
  import { IOdspResolvedUrl } from "@fluidframework/odsp-driver-definitions";
8
8
  import { IClient } from "@fluidframework/protocol-definitions";
@@ -16,11 +16,12 @@ export declare class LocalOdspDocumentService implements IDocumentService {
16
16
  policies: {
17
17
  storageOnly: boolean;
18
18
  };
19
- constructor(odspResolvedUrl: IOdspResolvedUrl, logger: ITelemetryLogger, localSnapshot: Uint8Array | string);
19
+ private storageManager?;
20
+ constructor(odspResolvedUrl: IOdspResolvedUrl, logger: ITelemetryLoggerExt, localSnapshot: Uint8Array | string);
20
21
  get resolvedUrl(): IResolvedUrl;
21
22
  connectToStorage(): Promise<IDocumentStorageService>;
22
23
  connectToDeltaStorage(): Promise<IDocumentDeltaStorageService>;
23
24
  connectToDeltaStream(_client: IClient): never;
24
25
  dispose(_error?: any): void;
25
26
  }
26
- //# sourceMappingURL=localOdspDocumentService.d.ts.map
27
+ //# sourceMappingURL=localOdspDocumentService.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localOdspDocumentService.d.mts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;OAC9D,EACN,4BAA4B,EAC5B,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,MAAM,oCAAoC;OAEpC,EAAE,gBAAgB,EAAE,MAAM,yCAAyC;OACnE,EAAE,OAAO,EAAE,MAAM,sCAAsC;AAI9D;;GAEG;AACH,qBAAa,wBAAyB,YAAW,gBAAgB;IAK/D,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IANxB,QAAQ;;MAAyB;IACxC,OAAO,CAAC,cAAc,CAAC,CAAkC;gBAGvC,eAAe,EAAE,gBAAgB,EACjC,MAAM,EAAE,mBAAmB,EAC3B,aAAa,EAAE,UAAU,GAAG,MAAM;IAGpD,IAAW,WAAW,IAAI,YAAY,CAErC;IAEY,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAKpD,qBAAqB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAIpE,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,KAAK;IAQ7C,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,IAAI;CAGlC"}
@@ -2,8 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { UsageError, EmptyDocumentDeltaStorageService } from "@fluidframework/driver-utils";
6
- import { LocalOdspDocumentStorageService } from "./localOdspDocumentStorageManager";
5
+ import { UsageError } from "@fluidframework/driver-utils";
6
+ import { LocalOdspDeltaStorageService } from "./localOdspDeltaStorageService.mjs";
7
+ import { LocalOdspDocumentStorageService } from "./localOdspDocumentStorageManager.mjs";
7
8
  /**
8
9
  * IDocumentService implementation that provides explicit snapshot to the document storage service.
9
10
  */
@@ -18,13 +19,14 @@ export class LocalOdspDocumentService {
18
19
  return this.odspResolvedUrl;
19
20
  }
20
21
  async connectToStorage() {
21
- return new LocalOdspDocumentStorageService(this.logger, this.localSnapshot);
22
+ this.storageManager = new LocalOdspDocumentStorageService(this.logger, this.localSnapshot);
23
+ return this.storageManager;
22
24
  }
23
25
  async connectToDeltaStorage() {
24
- return new EmptyDocumentDeltaStorageService();
26
+ return new LocalOdspDeltaStorageService(this.logger, this.storageManager?.ops ?? []);
25
27
  }
26
28
  connectToDeltaStream(_client) {
27
- const toThrow = new UsageError("\"connectToDeltaStream\" is not supported by LocalOdspDocumentService");
29
+ const toThrow = new UsageError('"connectToDeltaStream" is not supported by LocalOdspDocumentService');
28
30
  this.logger.sendErrorEvent({ eventName: "UnsupportedUsage" }, toThrow);
29
31
  throw toThrow;
30
32
  }
@@ -32,4 +34,4 @@ export class LocalOdspDocumentService {
32
34
  // Do nothing
33
35
  }
34
36
  }
35
- //# sourceMappingURL=localOdspDocumentService.js.map
37
+ //# sourceMappingURL=localOdspDocumentService.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localOdspDocumentService.mjs","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OASI,EAAE,UAAU,EAAE,MAAM,8BAA8B;OAGlD,EAAE,4BAA4B,EAAE;OAChC,EAAE,+BAA+B,EAAE;AAE1C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAIpC,YACkB,eAAiC,EACjC,MAA2B,EAC3B,aAAkC;QAFlC,oBAAe,GAAf,eAAe,CAAkB;QACjC,WAAM,GAAN,MAAM,CAAqB;QAC3B,kBAAa,GAAb,aAAa,CAAqB;QAN7C,aAAQ,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAOrC,CAAC;IAEJ,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC7B,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC5B,IAAI,CAAC,cAAc,GAAG,IAAI,+BAA+B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC3F,OAAO,IAAI,CAAC,cAAc,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,4BAA4B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACtF,CAAC;IAEM,oBAAoB,CAAC,OAAgB;QAC3C,MAAM,OAAO,GAAG,IAAI,UAAU,CAC7B,qEAAqE,CACrE,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC,CAAC;QACvE,MAAM,OAAO,CAAC;IACf,CAAC;IAEM,OAAO,CAAC,MAAY;QAC1B,aAAa;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { UsageError } from \"@fluidframework/driver-utils\";\nimport { IOdspResolvedUrl } from \"@fluidframework/odsp-driver-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\nimport { LocalOdspDeltaStorageService } from \"./localOdspDeltaStorageService\";\nimport { LocalOdspDocumentStorageService } from \"./localOdspDocumentStorageManager\";\n\n/**\n * IDocumentService implementation that provides explicit snapshot to the document storage service.\n */\nexport class LocalOdspDocumentService implements IDocumentService {\n\tpublic policies = { storageOnly: true };\n\tprivate storageManager?: LocalOdspDocumentStorageService;\n\n\tconstructor(\n\t\tprivate readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly localSnapshot: Uint8Array | string,\n\t) {}\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this.odspResolvedUrl;\n\t}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\tthis.storageManager = new LocalOdspDocumentStorageService(this.logger, this.localSnapshot);\n\t\treturn this.storageManager;\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn new LocalOdspDeltaStorageService(this.logger, this.storageManager?.ops ?? []);\n\t}\n\n\tpublic connectToDeltaStream(_client: IClient): never {\n\t\tconst toThrow = new UsageError(\n\t\t\t'\"connectToDeltaStream\" is not supported by LocalOdspDocumentService',\n\t\t);\n\t\tthis.logger.sendErrorEvent({ eventName: \"UnsupportedUsage\" }, toThrow);\n\t\tthrow toThrow;\n\t}\n\n\tpublic dispose(_error?: any): void {\n\t\t// Do nothing\n\t}\n}\n"]}