@fluidframework/odsp-driver 2.50.0 → 2.51.0

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 (355) hide show
  1. package/.eslintrc.cjs +12 -0
  2. package/CHANGELOG.md +4 -0
  3. package/dist/checkUrl.d.ts +1 -1
  4. package/dist/checkUrl.d.ts.map +1 -1
  5. package/dist/checkUrl.js.map +1 -1
  6. package/dist/compactSnapshotParser.d.ts +2 -2
  7. package/dist/compactSnapshotParser.d.ts.map +1 -1
  8. package/dist/compactSnapshotParser.js.map +1 -1
  9. package/dist/compactSnapshotWriter.d.ts +1 -1
  10. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  11. package/dist/compactSnapshotWriter.js.map +1 -1
  12. package/dist/contracts.d.ts +3 -3
  13. package/dist/contracts.d.ts.map +1 -1
  14. package/dist/contracts.js.map +1 -1
  15. package/dist/contractsPublic.d.ts +18 -2
  16. package/dist/contractsPublic.d.ts.map +1 -1
  17. package/dist/contractsPublic.js +12 -1
  18. package/dist/contractsPublic.js.map +1 -1
  19. package/dist/createFile/createFile.d.ts +6 -6
  20. package/dist/createFile/createFile.d.ts.map +1 -1
  21. package/dist/createFile/createFile.js.map +1 -1
  22. package/dist/createFile/createNewContainerOnExistingFile.d.ts +6 -6
  23. package/dist/createFile/createNewContainerOnExistingFile.d.ts.map +1 -1
  24. package/dist/createFile/createNewContainerOnExistingFile.js +11 -2
  25. package/dist/createFile/createNewContainerOnExistingFile.js.map +1 -1
  26. package/dist/createFile/createNewUtils.d.ts +9 -6
  27. package/dist/createFile/createNewUtils.d.ts.map +1 -1
  28. package/dist/createFile/createNewUtils.js +19 -8
  29. package/dist/createFile/createNewUtils.js.map +1 -1
  30. package/dist/createFile/index.d.ts +1 -1
  31. package/dist/createFile/index.d.ts.map +1 -1
  32. package/dist/createFile/index.js.map +1 -1
  33. package/dist/createOdspCreateContainerRequest.d.ts +2 -2
  34. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  35. package/dist/createOdspCreateContainerRequest.js.map +1 -1
  36. package/dist/createOdspUrl.d.ts +1 -1
  37. package/dist/createOdspUrl.d.ts.map +1 -1
  38. package/dist/createOdspUrl.js.map +1 -1
  39. package/dist/epochTracker.d.ts +4 -4
  40. package/dist/epochTracker.d.ts.map +1 -1
  41. package/dist/epochTracker.js.map +1 -1
  42. package/dist/fetchSnapshot.d.ts +6 -6
  43. package/dist/fetchSnapshot.d.ts.map +1 -1
  44. package/dist/fetchSnapshot.js +7 -0
  45. package/dist/fetchSnapshot.js.map +1 -1
  46. package/dist/getFileLink.d.ts +2 -2
  47. package/dist/getFileLink.d.ts.map +1 -1
  48. package/dist/getFileLink.js.map +1 -1
  49. package/dist/getQueryString.d.ts +1 -1
  50. package/dist/getQueryString.d.ts.map +1 -1
  51. package/dist/getQueryString.js.map +1 -1
  52. package/dist/index.d.ts +7 -7
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js.map +1 -1
  55. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +2 -2
  56. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
  57. package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
  58. package/dist/localOdspDriver/localOdspDocumentService.d.ts +4 -4
  59. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  60. package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
  61. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +5 -5
  62. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  63. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  64. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -3
  65. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  66. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  67. package/dist/localOdspDriver/localOdspLayerCompatState.d.ts +1 -1
  68. package/dist/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -1
  69. package/dist/localOdspDriver/localOdspLayerCompatState.js.map +1 -1
  70. package/dist/odspCache.d.ts +2 -2
  71. package/dist/odspCache.d.ts.map +1 -1
  72. package/dist/odspCache.js.map +1 -1
  73. package/dist/odspDelayLoadedDeltaStream.d.ts +6 -6
  74. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  75. package/dist/odspDelayLoadedDeltaStream.js +9 -0
  76. package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
  77. package/dist/odspDeltaStorageService.d.ts +6 -6
  78. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  79. package/dist/odspDeltaStorageService.js.map +1 -1
  80. package/dist/odspDocumentDeltaConnection.d.ts +5 -5
  81. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  82. package/dist/odspDocumentDeltaConnection.js.map +1 -1
  83. package/dist/odspDocumentService.d.ts +6 -6
  84. package/dist/odspDocumentService.d.ts.map +1 -1
  85. package/dist/odspDocumentService.js.map +1 -1
  86. package/dist/odspDocumentServiceFactory.d.ts +2 -2
  87. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  88. package/dist/odspDocumentServiceFactory.js.map +1 -1
  89. package/dist/odspDocumentServiceFactoryCore.d.ts +7 -7
  90. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  91. package/dist/odspDocumentServiceFactoryCore.js +1 -1
  92. package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
  93. package/dist/odspDocumentStorageManager.d.ts +9 -9
  94. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  95. package/dist/odspDocumentStorageManager.js.map +1 -1
  96. package/dist/odspDocumentStorageServiceBase.d.ts +3 -3
  97. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  98. package/dist/odspDocumentStorageServiceBase.js.map +1 -1
  99. package/dist/odspDriverUrlResolver.d.ts +3 -3
  100. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  101. package/dist/odspDriverUrlResolver.js +3 -0
  102. package/dist/odspDriverUrlResolver.js.map +1 -1
  103. package/dist/odspDriverUrlResolverForShareLink.d.ts +4 -4
  104. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  105. package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
  106. package/dist/odspError.d.ts +3 -3
  107. package/dist/odspError.d.ts.map +1 -1
  108. package/dist/odspError.js.map +1 -1
  109. package/dist/odspFluidFileLink.d.ts +1 -1
  110. package/dist/odspFluidFileLink.d.ts.map +1 -1
  111. package/dist/odspFluidFileLink.js.map +1 -1
  112. package/dist/odspLayerCompatState.d.ts +1 -1
  113. package/dist/odspLayerCompatState.d.ts.map +1 -1
  114. package/dist/odspLayerCompatState.js.map +1 -1
  115. package/dist/odspLocationRedirection.d.ts +2 -2
  116. package/dist/odspLocationRedirection.d.ts.map +1 -1
  117. package/dist/odspLocationRedirection.js.map +1 -1
  118. package/dist/odspPublicUtils.d.ts +1 -1
  119. package/dist/odspPublicUtils.d.ts.map +1 -1
  120. package/dist/odspPublicUtils.js.map +1 -1
  121. package/dist/odspSnapshotParser.d.ts +2 -2
  122. package/dist/odspSnapshotParser.d.ts.map +1 -1
  123. package/dist/odspSnapshotParser.js.map +1 -1
  124. package/dist/odspSummaryUploadManager.d.ts +5 -5
  125. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  126. package/dist/odspSummaryUploadManager.js.map +1 -1
  127. package/dist/odspUrlHelper.d.ts +1 -1
  128. package/dist/odspUrlHelper.d.ts.map +1 -1
  129. package/dist/odspUrlHelper.js.map +1 -1
  130. package/dist/odspUtils.d.ts +5 -5
  131. package/dist/odspUtils.d.ts.map +1 -1
  132. package/dist/odspUtils.js.map +1 -1
  133. package/dist/opsCaching.d.ts +1 -1
  134. package/dist/opsCaching.d.ts.map +1 -1
  135. package/dist/opsCaching.js.map +1 -1
  136. package/dist/packageVersion.d.ts +1 -1
  137. package/dist/packageVersion.js +1 -1
  138. package/dist/packageVersion.js.map +1 -1
  139. package/dist/prefetchLatestSnapshot.d.ts +5 -5
  140. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  141. package/dist/prefetchLatestSnapshot.js.map +1 -1
  142. package/dist/retryErrorsStorageAdapter.d.ts +4 -4
  143. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  144. package/dist/retryErrorsStorageAdapter.js.map +1 -1
  145. package/dist/retryUtils.d.ts +1 -1
  146. package/dist/retryUtils.d.ts.map +1 -1
  147. package/dist/retryUtils.js.map +1 -1
  148. package/dist/vroom.d.ts +4 -4
  149. package/dist/vroom.d.ts.map +1 -1
  150. package/dist/vroom.js.map +1 -1
  151. package/dist/zipItDataRepresentationUtils.d.ts +2 -2
  152. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  153. package/dist/zipItDataRepresentationUtils.js.map +1 -1
  154. package/lib/checkUrl.d.ts +1 -1
  155. package/lib/checkUrl.d.ts.map +1 -1
  156. package/lib/checkUrl.js.map +1 -1
  157. package/lib/compactSnapshotParser.d.ts +2 -2
  158. package/lib/compactSnapshotParser.d.ts.map +1 -1
  159. package/lib/compactSnapshotParser.js.map +1 -1
  160. package/lib/compactSnapshotWriter.d.ts +1 -1
  161. package/lib/compactSnapshotWriter.d.ts.map +1 -1
  162. package/lib/compactSnapshotWriter.js.map +1 -1
  163. package/lib/contracts.d.ts +3 -3
  164. package/lib/contracts.d.ts.map +1 -1
  165. package/lib/contracts.js.map +1 -1
  166. package/lib/contractsPublic.d.ts +18 -2
  167. package/lib/contractsPublic.d.ts.map +1 -1
  168. package/lib/contractsPublic.js +11 -0
  169. package/lib/contractsPublic.js.map +1 -1
  170. package/lib/createFile/createFile.d.ts +6 -6
  171. package/lib/createFile/createFile.d.ts.map +1 -1
  172. package/lib/createFile/createFile.js.map +1 -1
  173. package/lib/createFile/createNewContainerOnExistingFile.d.ts +6 -6
  174. package/lib/createFile/createNewContainerOnExistingFile.d.ts.map +1 -1
  175. package/lib/createFile/createNewContainerOnExistingFile.js +12 -3
  176. package/lib/createFile/createNewContainerOnExistingFile.js.map +1 -1
  177. package/lib/createFile/createNewUtils.d.ts +9 -6
  178. package/lib/createFile/createNewUtils.d.ts.map +1 -1
  179. package/lib/createFile/createNewUtils.js +19 -8
  180. package/lib/createFile/createNewUtils.js.map +1 -1
  181. package/lib/createFile/index.d.ts +1 -1
  182. package/lib/createFile/index.d.ts.map +1 -1
  183. package/lib/createFile/index.js.map +1 -1
  184. package/lib/createOdspCreateContainerRequest.d.ts +2 -2
  185. package/lib/createOdspCreateContainerRequest.d.ts.map +1 -1
  186. package/lib/createOdspCreateContainerRequest.js.map +1 -1
  187. package/lib/createOdspUrl.d.ts +1 -1
  188. package/lib/createOdspUrl.d.ts.map +1 -1
  189. package/lib/createOdspUrl.js.map +1 -1
  190. package/lib/epochTracker.d.ts +4 -4
  191. package/lib/epochTracker.d.ts.map +1 -1
  192. package/lib/epochTracker.js.map +1 -1
  193. package/lib/fetchSnapshot.d.ts +6 -6
  194. package/lib/fetchSnapshot.d.ts.map +1 -1
  195. package/lib/fetchSnapshot.js +7 -0
  196. package/lib/fetchSnapshot.js.map +1 -1
  197. package/lib/getFileLink.d.ts +2 -2
  198. package/lib/getFileLink.d.ts.map +1 -1
  199. package/lib/getFileLink.js.map +1 -1
  200. package/lib/getQueryString.d.ts +1 -1
  201. package/lib/getQueryString.d.ts.map +1 -1
  202. package/lib/getQueryString.js.map +1 -1
  203. package/lib/index.d.ts +7 -7
  204. package/lib/index.d.ts.map +1 -1
  205. package/lib/index.js.map +1 -1
  206. package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts +2 -2
  207. package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
  208. package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
  209. package/lib/localOdspDriver/localOdspDocumentService.d.ts +4 -4
  210. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  211. package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -1
  212. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts +5 -5
  213. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  214. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  215. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -3
  216. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  217. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  218. package/lib/localOdspDriver/localOdspLayerCompatState.d.ts +1 -1
  219. package/lib/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -1
  220. package/lib/localOdspDriver/localOdspLayerCompatState.js.map +1 -1
  221. package/lib/odspCache.d.ts +2 -2
  222. package/lib/odspCache.d.ts.map +1 -1
  223. package/lib/odspCache.js.map +1 -1
  224. package/lib/odspDelayLoadedDeltaStream.d.ts +6 -6
  225. package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  226. package/lib/odspDelayLoadedDeltaStream.js +9 -0
  227. package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
  228. package/lib/odspDeltaStorageService.d.ts +6 -6
  229. package/lib/odspDeltaStorageService.d.ts.map +1 -1
  230. package/lib/odspDeltaStorageService.js.map +1 -1
  231. package/lib/odspDocumentDeltaConnection.d.ts +5 -5
  232. package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
  233. package/lib/odspDocumentDeltaConnection.js.map +1 -1
  234. package/lib/odspDocumentService.d.ts +6 -6
  235. package/lib/odspDocumentService.d.ts.map +1 -1
  236. package/lib/odspDocumentService.js.map +1 -1
  237. package/lib/odspDocumentServiceFactory.d.ts +2 -2
  238. package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
  239. package/lib/odspDocumentServiceFactory.js.map +1 -1
  240. package/lib/odspDocumentServiceFactoryCore.d.ts +7 -7
  241. package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  242. package/lib/odspDocumentServiceFactoryCore.js +1 -1
  243. package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
  244. package/lib/odspDocumentStorageManager.d.ts +9 -9
  245. package/lib/odspDocumentStorageManager.d.ts.map +1 -1
  246. package/lib/odspDocumentStorageManager.js.map +1 -1
  247. package/lib/odspDocumentStorageServiceBase.d.ts +3 -3
  248. package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -1
  249. package/lib/odspDocumentStorageServiceBase.js.map +1 -1
  250. package/lib/odspDriverUrlResolver.d.ts +3 -3
  251. package/lib/odspDriverUrlResolver.d.ts.map +1 -1
  252. package/lib/odspDriverUrlResolver.js +4 -1
  253. package/lib/odspDriverUrlResolver.js.map +1 -1
  254. package/lib/odspDriverUrlResolverForShareLink.d.ts +4 -4
  255. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  256. package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
  257. package/lib/odspError.d.ts +3 -3
  258. package/lib/odspError.d.ts.map +1 -1
  259. package/lib/odspError.js +1 -1
  260. package/lib/odspError.js.map +1 -1
  261. package/lib/odspFluidFileLink.d.ts +1 -1
  262. package/lib/odspFluidFileLink.d.ts.map +1 -1
  263. package/lib/odspFluidFileLink.js.map +1 -1
  264. package/lib/odspLayerCompatState.d.ts +1 -1
  265. package/lib/odspLayerCompatState.d.ts.map +1 -1
  266. package/lib/odspLayerCompatState.js.map +1 -1
  267. package/lib/odspLocationRedirection.d.ts +2 -2
  268. package/lib/odspLocationRedirection.d.ts.map +1 -1
  269. package/lib/odspLocationRedirection.js.map +1 -1
  270. package/lib/odspPublicUtils.d.ts +1 -1
  271. package/lib/odspPublicUtils.d.ts.map +1 -1
  272. package/lib/odspPublicUtils.js.map +1 -1
  273. package/lib/odspSnapshotParser.d.ts +2 -2
  274. package/lib/odspSnapshotParser.d.ts.map +1 -1
  275. package/lib/odspSnapshotParser.js.map +1 -1
  276. package/lib/odspSummaryUploadManager.d.ts +5 -5
  277. package/lib/odspSummaryUploadManager.d.ts.map +1 -1
  278. package/lib/odspSummaryUploadManager.js +1 -1
  279. package/lib/odspSummaryUploadManager.js.map +1 -1
  280. package/lib/odspUrlHelper.d.ts +1 -1
  281. package/lib/odspUrlHelper.d.ts.map +1 -1
  282. package/lib/odspUrlHelper.js.map +1 -1
  283. package/lib/odspUtils.d.ts +5 -5
  284. package/lib/odspUtils.d.ts.map +1 -1
  285. package/lib/odspUtils.js.map +1 -1
  286. package/lib/opsCaching.d.ts +1 -1
  287. package/lib/opsCaching.d.ts.map +1 -1
  288. package/lib/opsCaching.js.map +1 -1
  289. package/lib/packageVersion.d.ts +1 -1
  290. package/lib/packageVersion.js +1 -1
  291. package/lib/packageVersion.js.map +1 -1
  292. package/lib/prefetchLatestSnapshot.d.ts +5 -5
  293. package/lib/prefetchLatestSnapshot.d.ts.map +1 -1
  294. package/lib/prefetchLatestSnapshot.js.map +1 -1
  295. package/lib/retryErrorsStorageAdapter.d.ts +4 -4
  296. package/lib/retryErrorsStorageAdapter.d.ts.map +1 -1
  297. package/lib/retryErrorsStorageAdapter.js.map +1 -1
  298. package/lib/retryUtils.d.ts +1 -1
  299. package/lib/retryUtils.d.ts.map +1 -1
  300. package/lib/retryUtils.js.map +1 -1
  301. package/lib/vroom.d.ts +4 -4
  302. package/lib/vroom.d.ts.map +1 -1
  303. package/lib/vroom.js.map +1 -1
  304. package/lib/zipItDataRepresentationUtils.d.ts +2 -2
  305. package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
  306. package/lib/zipItDataRepresentationUtils.js.map +1 -1
  307. package/package.json +13 -14
  308. package/src/checkUrl.ts +1 -1
  309. package/src/compactSnapshotParser.ts +4 -4
  310. package/src/compactSnapshotWriter.ts +2 -2
  311. package/src/contracts.ts +3 -3
  312. package/src/contractsPublic.ts +20 -2
  313. package/src/createFile/createFile.ts +10 -10
  314. package/src/createFile/createNewContainerOnExistingFile.ts +20 -9
  315. package/src/createFile/createNewUtils.ts +27 -15
  316. package/src/createFile/index.ts +2 -1
  317. package/src/createOdspCreateContainerRequest.ts +2 -2
  318. package/src/createOdspUrl.ts +1 -1
  319. package/src/epochTracker.ts +11 -11
  320. package/src/fetchSnapshot.ts +20 -13
  321. package/src/getFileLink.ts +4 -4
  322. package/src/getQueryString.ts +1 -1
  323. package/src/index.ts +10 -10
  324. package/src/localOdspDriver/localOdspDeltaStorageService.ts +2 -2
  325. package/src/localOdspDriver/localOdspDocumentService.ts +4 -4
  326. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +8 -5
  327. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +4 -4
  328. package/src/localOdspDriver/localOdspLayerCompatState.ts +1 -1
  329. package/src/odspCache.ts +7 -7
  330. package/src/odspDelayLoadedDeltaStream.ts +24 -14
  331. package/src/odspDeltaStorageService.ts +8 -8
  332. package/src/odspDocumentDeltaConnection.ts +9 -9
  333. package/src/odspDocumentService.ts +8 -8
  334. package/src/odspDocumentServiceFactory.ts +2 -2
  335. package/src/odspDocumentServiceFactoryCore.ts +20 -19
  336. package/src/odspDocumentStorageManager.ts +18 -18
  337. package/src/odspDocumentStorageServiceBase.ts +13 -13
  338. package/src/odspDriverUrlResolver.ts +9 -6
  339. package/src/odspDriverUrlResolverForShareLink.ts +5 -5
  340. package/src/odspError.ts +6 -3
  341. package/src/odspFluidFileLink.ts +1 -1
  342. package/src/odspLayerCompatState.ts +1 -1
  343. package/src/odspLocationRedirection.ts +2 -2
  344. package/src/odspPublicUtils.ts +1 -1
  345. package/src/odspSnapshotParser.ts +2 -2
  346. package/src/odspSummaryUploadManager.ts +11 -7
  347. package/src/odspUrlHelper.ts +1 -1
  348. package/src/odspUtils.ts +13 -13
  349. package/src/opsCaching.ts +1 -1
  350. package/src/packageVersion.ts +1 -1
  351. package/src/prefetchLatestSnapshot.ts +13 -13
  352. package/src/retryErrorsStorageAdapter.ts +4 -4
  353. package/src/retryUtils.ts +1 -1
  354. package/src/vroom.ts +5 -5
  355. package/src/zipItDataRepresentationUtils.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"getF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CAAC,uBAAuB,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC9I,CAAC;IACD,IAAI,eAAe,CAAC,SAAS,CAAC,wBAAwB,EAAE,CAAC;QACxD,eAAe,CAAC,SAAS,CAAC,wBAAwB,GAAG,GAAG,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC,QAAQ,EAAE,CAAC;IAChJ,CAAC;IACD,IAAI,eAAe,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;QAC/C,eAAe,CAAC,SAAS,CAAC,eAAe,GAAG,GAAG,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC9H,CAAC;IACD,IAAI,eAAe,CAAC,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAClD,eAAe,CAAC,SAAS,CAAC,kBAAkB,GAAG,GAAG,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE,CAAC;IACpI,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { NonRetryableError, runWithRetry } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIOdspUrlParts,\n\tOdspErrorTypes,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n\ttype IOdspResolvedUrl,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tisFluidError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { getHeadersWithAuth } from \"./getUrlAndHeadersWithAuth.js\";\nimport { mockify } from \"./mockify.js\";\nimport {\n\tfetchHelper,\n\tgetWithRetryForTokenRefresh,\n\ttoInstrumentedOdspStorageTokenFetcher,\n} from \"./odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { runWithRetry as runWithRetryForCoherencyAndServiceReadOnlyErrors } from \"./retryUtils.js\";\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 const getFileLink = mockify(\n\tasync (\n\t\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tresolvedUrl: IOdspResolvedUrl,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<string> => {\n\t\tconst cacheKey = `${resolvedUrl.siteUrl}_${resolvedUrl.driveId}_${resolvedUrl.itemId}`;\n\t\tconst maybeFileLinkCacheEntry = fileLinkCache.get(cacheKey);\n\t\tif (maybeFileLinkCacheEntry !== undefined) {\n\t\t\treturn maybeFileLinkCacheEntry;\n\t\t}\n\n\t\tconst fileLinkGenerator = async function (): Promise<string> {\n\t\t\tlet fileLinkCore: string;\n\t\t\ttry {\n\t\t\t\tlet retryCount = 0;\n\t\t\t\tfileLinkCore = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\trunWithRetryForCoherencyAndServiceReadOnlyErrors(\n\t\t\t\t\t\t\tasync () =>\n\t\t\t\t\t\t\t\tgetFileLinkWithLocationRedirectionHandling(getToken, resolvedUrl, logger),\n\t\t\t\t\t\t\t\"getFileLinkCore\",\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t),\n\t\t\t\t\t\"getShareLink\",\n\t\t\t\t\tlogger,\n\t\t\t\t\t{\n\t\t\t\t\t\t// TODO: use a stronger type\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tonRetry(delayInMs: number, error: any) {\n\t\t\t\t\t\t\tretryCount++;\n\t\t\t\t\t\t\tif (retryCount === 5) {\n\t\t\t\t\t\t\t\tif (error !== undefined && typeof error === \"object\") {\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\t\terror.canRetry = false;\n\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t}\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},\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\t// Delete from the cache to permit retrying later.\n\t\t\t\tfileLinkCache.delete(cacheKey);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// We are guaranteed to run the getFileLinkCore at least once with successful result (which must be a string)\n\t\t\tassert(\n\t\t\t\tfileLinkCore !== undefined,\n\t\t\t\t0x292 /* \"Unexpected undefined result from getFileLinkCore\" */,\n\t\t\t);\n\t\t\treturn fileLinkCore;\n\t\t};\n\t\tconst fileLink = fileLinkGenerator();\n\t\tfileLinkCache.set(cacheKey, fileLink);\n\t\treturn fileLink;\n\t},\n);\n\n/**\n * Handles location redirection while fulfilling the getFileLink call. We don't want browser to handle\n * the redirection as the browser will retry with same auth token which will not work as we need app\n * to regenerate tokens for the new site domain. So when we will make the network calls below we will set\n * the redirect:manual header to manually handle these redirects.\n * Refer: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308\n * @param getToken - token fetcher to fetch the token.\n * @param odspUrlParts - parts of odsp resolved url.\n * @param logger - logger to send events.\n * @returns Response from the API call.\n * @legacy\n * @alpha\n */\nasync function getFileLinkWithLocationRedirectionHandling(\n\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\tresolvedUrl: IOdspResolvedUrl,\n\tlogger: ITelemetryLoggerExt,\n): Promise<string> {\n\t// We can have chains of location redirection one after the other, so have a for loop\n\t// so that we can keep handling the same type of error. Set max number of redirection to 5.\n\tlet lastError: unknown;\n\tlet locationRedirected = false;\n\tfor (let count = 1; count <= 5; count++) {\n\t\ttry {\n\t\t\tconst fileItem = await getFileItemLite(getToken, resolvedUrl, logger);\n\t\t\t// Sometimes the siteUrl in the actual file is different from the siteUrl in the resolvedUrl due to location\n\t\t\t// redirection. This creates issues in the getSharingInformation call. So we need to update the siteUrl in the\n\t\t\t// resolvedUrl to the siteUrl in the fileItem which is the updated siteUrl.\n\t\t\tconst oldSiteDomain = new URL(resolvedUrl.siteUrl).origin;\n\t\t\tconst newSiteDomain = new URL(fileItem.sharepointIds.siteUrl).origin;\n\t\t\tif (oldSiteDomain !== newSiteDomain) {\n\t\t\t\tlocationRedirected = true;\n\t\t\t\tlogger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"LocationRedirectionErrorForGetOdspFileLink\",\n\t\t\t\t\tretryCount: count,\n\t\t\t\t});\n\t\t\t\trenameTenantInOdspResolvedUrl(resolvedUrl, newSiteDomain);\n\t\t\t}\n\t\t\treturn await getFileLinkCore(getToken, resolvedUrl, logger, fileItem);\n\t\t} catch (error: unknown) {\n\t\t\tlastError = error;\n\t\t\t// If the getSharingLink call fails with the 401/403/404 error, then it could be due to that the file has moved\n\t\t\t// to another location. This could occur in case we have more than 1 tenant rename. In that case, we should retry\n\t\t\t// the getFileItemLite call to get the updated fileItem.\n\t\t\tif (\n\t\t\t\tisFluidError(error) &&\n\t\t\t\tlocationRedirected &&\n\t\t\t\t(error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError ||\n\t\t\t\t\terror.errorType === OdspErrorTypes.authorizationError)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\tthrow lastError;\n}\n\nasync function getFileLinkCore(\n\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\todspUrlParts: IOdspUrlParts,\n\tlogger: ITelemetryLoggerExt,\n\tfileItem: FileItemLite,\n): Promise<string> {\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 getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\t\t\t\tlogger,\n\t\t\t\t\todspUrlParts,\n\t\t\t\t\tgetToken,\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 = `${\n\t\t\t\t\todspUrlParts.siteUrl\n\t\t\t\t}/_api/web/GetFileById(@a1)/ListItemAllFields/GetSharingInformation?@a1=guid${encodeURIComponent(\n\t\t\t\t\t`'${fileItem.sharepointIds.listItemUniqueId}'`,\n\t\t\t\t)}`;\n\t\t\t\tconst method = \"POST\";\n\t\t\t\tconst authHeader = await getAuthHeader(\n\t\t\t\t\t{ ...options, request: { url, method } },\n\t\t\t\t\t\"GetFileLinkCore\",\n\t\t\t\t);\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\n\t\t\t\tconst requestInit = {\n\t\t\t\t\tmethod,\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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tconst sharingInfo = await response.content.json();\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\t\t\tconst 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\tOdspErrorTypes.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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\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: unknown): maybeFileItemLite is FileItemLite =>\n\ttypeof (maybeFileItemLite as Partial<FileItemLite>).webUrl === \"string\" &&\n\ttypeof (maybeFileItemLite as Partial<FileItemLite>).webDavUrl === \"string\" &&\n\t// TODO: stronger check\n\ttypeof (maybeFileItemLite as Partial<FileItemLite>).sharepointIds === \"object\";\n\nasync function getFileItemLite(\n\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\todspUrlParts: IOdspUrlParts,\n\tlogger: ITelemetryLoggerExt,\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: ITelemetryBaseProperties | undefined;\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 getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\t\t\t\tlogger,\n\t\t\t\t\todspUrlParts,\n\t\t\t\t\tgetToken,\n\t\t\t\t);\n\t\t\t\tconst url = `${siteUrl}/_api/v2.0/drives/${driveId}/items/${itemId}?select=webUrl,webDavUrl,sharepointIds`;\n\t\t\t\tconst method = \"GET\";\n\t\t\t\tconst authHeader = await getAuthHeader(\n\t\t\t\t\t{ ...options, request: { url, method } },\n\t\t\t\t\t\"GetFileItemLite\",\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tauthHeader !== 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 headers = getHeadersWithAuth(authHeader);\n\t\t\t\tconst requestInit = { method, 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: unknown = 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\tOdspErrorTypes.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\n/**\n * It takes a resolved url with old siteUrl and patches resolved url with updated site url domain.\n * @param odspResolvedUrl - Previous odsp resolved url with older site url.\n * @param newSiteDomain - New site domain after the tenant rename.\n */\nfunction renameTenantInOdspResolvedUrl(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tnewSiteDomain: string,\n): void {\n\tconst newSiteUrl = `${newSiteDomain}${new URL(odspResolvedUrl.siteUrl).pathname}`;\n\todspResolvedUrl.siteUrl = newSiteUrl;\n\n\tif (odspResolvedUrl.endpoints.attachmentGETStorageUrl) {\n\t\todspResolvedUrl.endpoints.attachmentGETStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.attachmentGETStorageUrl).pathname}`;\n\t}\n\tif (odspResolvedUrl.endpoints.attachmentPOSTStorageUrl) {\n\t\todspResolvedUrl.endpoints.attachmentPOSTStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.attachmentPOSTStorageUrl).pathname}`;\n\t}\n\tif (odspResolvedUrl.endpoints.deltaStorageUrl) {\n\t\todspResolvedUrl.endpoints.deltaStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.deltaStorageUrl).pathname}`;\n\t}\n\tif (odspResolvedUrl.endpoints.snapshotStorageUrl) {\n\t\todspResolvedUrl.endpoints.snapshotStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.snapshotStorageUrl).pathname}`;\n\t}\n}\n"]}
1
+ {"version":3,"file":"getFileLink.js","sourceRoot":"","sources":["../src/getFileLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AACxF,OAAO,EAEN,cAAc,GAId,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,CAAC,wBAAwB,CAAC,CAAC,QAAQ,EAAE,CAAC;IAChJ,CAAC;IACD,IAAI,eAAe,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;QAC/C,eAAe,CAAC,SAAS,CAAC,eAAe,GAAG,GAAG,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC9H,CAAC;IACD,IAAI,eAAe,CAAC,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAClD,eAAe,CAAC,SAAS,CAAC,kBAAkB,GAAG,GAAG,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE,CAAC;IACpI,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { NonRetryableError, runWithRetry } from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype IOdspUrlParts,\n\tOdspErrorTypes,\n\ttype OdspResourceTokenFetchOptions,\n\ttype TokenFetcher,\n\ttype IOdspResolvedUrl,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tPerformanceEvent,\n\tisFluidError,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { getHeadersWithAuth } from \"./getUrlAndHeadersWithAuth.js\";\nimport { mockify } from \"./mockify.js\";\nimport {\n\tfetchHelper,\n\tgetWithRetryForTokenRefresh,\n\ttoInstrumentedOdspStorageTokenFetcher,\n} from \"./odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { runWithRetry as runWithRetryForCoherencyAndServiceReadOnlyErrors } from \"./retryUtils.js\";\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 const getFileLink = mockify(\n\tasync (\n\t\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tresolvedUrl: IOdspResolvedUrl,\n\t\tlogger: ITelemetryLoggerExt,\n\t): Promise<string> => {\n\t\tconst cacheKey = `${resolvedUrl.siteUrl}_${resolvedUrl.driveId}_${resolvedUrl.itemId}`;\n\t\tconst maybeFileLinkCacheEntry = fileLinkCache.get(cacheKey);\n\t\tif (maybeFileLinkCacheEntry !== undefined) {\n\t\t\treturn maybeFileLinkCacheEntry;\n\t\t}\n\n\t\tconst fileLinkGenerator = async function (): Promise<string> {\n\t\t\tlet fileLinkCore: string;\n\t\t\ttry {\n\t\t\t\tlet retryCount = 0;\n\t\t\t\tfileLinkCore = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\trunWithRetryForCoherencyAndServiceReadOnlyErrors(\n\t\t\t\t\t\t\tasync () =>\n\t\t\t\t\t\t\t\tgetFileLinkWithLocationRedirectionHandling(getToken, resolvedUrl, logger),\n\t\t\t\t\t\t\t\"getFileLinkCore\",\n\t\t\t\t\t\t\tlogger,\n\t\t\t\t\t\t),\n\t\t\t\t\t\"getShareLink\",\n\t\t\t\t\tlogger,\n\t\t\t\t\t{\n\t\t\t\t\t\t// TODO: use a stronger type\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tonRetry(delayInMs: number, error: any) {\n\t\t\t\t\t\t\tretryCount++;\n\t\t\t\t\t\t\tif (retryCount === 5) {\n\t\t\t\t\t\t\t\tif (error !== undefined && typeof error === \"object\") {\n\t\t\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\t\t\t\terror.canRetry = false;\n\t\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t\t}\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},\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} catch (error) {\n\t\t\t\t// Delete from the cache to permit retrying later.\n\t\t\t\tfileLinkCache.delete(cacheKey);\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// We are guaranteed to run the getFileLinkCore at least once with successful result (which must be a string)\n\t\t\tassert(\n\t\t\t\tfileLinkCore !== undefined,\n\t\t\t\t0x292 /* \"Unexpected undefined result from getFileLinkCore\" */,\n\t\t\t);\n\t\t\treturn fileLinkCore;\n\t\t};\n\t\tconst fileLink = fileLinkGenerator();\n\t\tfileLinkCache.set(cacheKey, fileLink);\n\t\treturn fileLink;\n\t},\n);\n\n/**\n * Handles location redirection while fulfilling the getFileLink call. We don't want browser to handle\n * the redirection as the browser will retry with same auth token which will not work as we need app\n * to regenerate tokens for the new site domain. So when we will make the network calls below we will set\n * the redirect:manual header to manually handle these redirects.\n * Refer: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308\n * @param getToken - token fetcher to fetch the token.\n * @param odspUrlParts - parts of odsp resolved url.\n * @param logger - logger to send events.\n * @returns Response from the API call.\n * @legacy\n * @alpha\n */\nasync function getFileLinkWithLocationRedirectionHandling(\n\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\tresolvedUrl: IOdspResolvedUrl,\n\tlogger: ITelemetryLoggerExt,\n): Promise<string> {\n\t// We can have chains of location redirection one after the other, so have a for loop\n\t// so that we can keep handling the same type of error. Set max number of redirection to 5.\n\tlet lastError: unknown;\n\tlet locationRedirected = false;\n\tfor (let count = 1; count <= 5; count++) {\n\t\ttry {\n\t\t\tconst fileItem = await getFileItemLite(getToken, resolvedUrl, logger);\n\t\t\t// Sometimes the siteUrl in the actual file is different from the siteUrl in the resolvedUrl due to location\n\t\t\t// redirection. This creates issues in the getSharingInformation call. So we need to update the siteUrl in the\n\t\t\t// resolvedUrl to the siteUrl in the fileItem which is the updated siteUrl.\n\t\t\tconst oldSiteDomain = new URL(resolvedUrl.siteUrl).origin;\n\t\t\tconst newSiteDomain = new URL(fileItem.sharepointIds.siteUrl).origin;\n\t\t\tif (oldSiteDomain !== newSiteDomain) {\n\t\t\t\tlocationRedirected = true;\n\t\t\t\tlogger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"LocationRedirectionErrorForGetOdspFileLink\",\n\t\t\t\t\tretryCount: count,\n\t\t\t\t});\n\t\t\t\trenameTenantInOdspResolvedUrl(resolvedUrl, newSiteDomain);\n\t\t\t}\n\t\t\treturn await getFileLinkCore(getToken, resolvedUrl, logger, fileItem);\n\t\t} catch (error: unknown) {\n\t\t\tlastError = error;\n\t\t\t// If the getSharingLink call fails with the 401/403/404 error, then it could be due to that the file has moved\n\t\t\t// to another location. This could occur in case we have more than 1 tenant rename. In that case, we should retry\n\t\t\t// the getFileItemLite call to get the updated fileItem.\n\t\t\tif (\n\t\t\t\tisFluidError(error) &&\n\t\t\t\tlocationRedirected &&\n\t\t\t\t(error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError ||\n\t\t\t\t\terror.errorType === OdspErrorTypes.authorizationError)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\tthrow lastError;\n}\n\nasync function getFileLinkCore(\n\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\todspUrlParts: IOdspUrlParts,\n\tlogger: ITelemetryLoggerExt,\n\tfileItem: FileItemLite,\n): Promise<string> {\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 getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\t\t\t\tlogger,\n\t\t\t\t\todspUrlParts,\n\t\t\t\t\tgetToken,\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 = `${\n\t\t\t\t\todspUrlParts.siteUrl\n\t\t\t\t}/_api/web/GetFileById(@a1)/ListItemAllFields/GetSharingInformation?@a1=guid${encodeURIComponent(\n\t\t\t\t\t`'${fileItem.sharepointIds.listItemUniqueId}'`,\n\t\t\t\t)}`;\n\t\t\t\tconst method = \"POST\";\n\t\t\t\tconst authHeader = await getAuthHeader(\n\t\t\t\t\t{ ...options, request: { url, method } },\n\t\t\t\t\t\"GetFileLinkCore\",\n\t\t\t\t);\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\n\t\t\t\tconst requestInit = {\n\t\t\t\t\tmethod,\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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\tconst sharingInfo = await response.content.json();\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\t\t\tconst 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\tOdspErrorTypes.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\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\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: unknown): maybeFileItemLite is FileItemLite =>\n\ttypeof (maybeFileItemLite as Partial<FileItemLite>).webUrl === \"string\" &&\n\ttypeof (maybeFileItemLite as Partial<FileItemLite>).webDavUrl === \"string\" &&\n\t// TODO: stronger check\n\ttypeof (maybeFileItemLite as Partial<FileItemLite>).sharepointIds === \"object\";\n\nasync function getFileItemLite(\n\tgetToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\todspUrlParts: IOdspUrlParts,\n\tlogger: ITelemetryLoggerExt,\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: ITelemetryBaseProperties | undefined;\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 getAuthHeader = toInstrumentedOdspStorageTokenFetcher(\n\t\t\t\t\tlogger,\n\t\t\t\t\todspUrlParts,\n\t\t\t\t\tgetToken,\n\t\t\t\t);\n\t\t\t\tconst url = `${siteUrl}/_api/v2.0/drives/${driveId}/items/${itemId}?select=webUrl,webDavUrl,sharepointIds`;\n\t\t\t\tconst method = \"GET\";\n\t\t\t\tconst authHeader = await getAuthHeader(\n\t\t\t\t\t{ ...options, request: { url, method } },\n\t\t\t\t\t\"GetFileItemLite\",\n\t\t\t\t);\n\t\t\t\tassert(\n\t\t\t\t\tauthHeader !== 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 headers = getHeadersWithAuth(authHeader);\n\t\t\t\tconst requestInit = { method, 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: unknown = 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\tOdspErrorTypes.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\n/**\n * It takes a resolved url with old siteUrl and patches resolved url with updated site url domain.\n * @param odspResolvedUrl - Previous odsp resolved url with older site url.\n * @param newSiteDomain - New site domain after the tenant rename.\n */\nfunction renameTenantInOdspResolvedUrl(\n\todspResolvedUrl: IOdspResolvedUrl,\n\tnewSiteDomain: string,\n): void {\n\tconst newSiteUrl = `${newSiteDomain}${new URL(odspResolvedUrl.siteUrl).pathname}`;\n\todspResolvedUrl.siteUrl = newSiteUrl;\n\n\tif (odspResolvedUrl.endpoints.attachmentGETStorageUrl) {\n\t\todspResolvedUrl.endpoints.attachmentGETStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.attachmentGETStorageUrl).pathname}`;\n\t}\n\tif (odspResolvedUrl.endpoints.attachmentPOSTStorageUrl) {\n\t\todspResolvedUrl.endpoints.attachmentPOSTStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.attachmentPOSTStorageUrl).pathname}`;\n\t}\n\tif (odspResolvedUrl.endpoints.deltaStorageUrl) {\n\t\todspResolvedUrl.endpoints.deltaStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.deltaStorageUrl).pathname}`;\n\t}\n\tif (odspResolvedUrl.endpoints.snapshotStorageUrl) {\n\t\todspResolvedUrl.endpoints.snapshotStorageUrl = `${newSiteDomain}${new URL(odspResolvedUrl.endpoints.snapshotStorageUrl).pathname}`;\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 { ISnapshotOptions } from "@fluidframework/odsp-driver-definitions/internal";
5
+ import type { ISnapshotOptions } from "@fluidframework/odsp-driver-definitions/internal";
6
6
  /**
7
7
  * Generates query string from the given query parameters.
8
8
  * @param queryParams - Query parameters from which to create a query.
@@ -1 +1 @@
1
- {"version":3,"file":"getQueryString.d.ts","sourceRoot":"","sources":["../src/getQueryString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEpF;;;GAGG;AACH,wBAAgB,cAAc,CAC7B,WAAW,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,gBAAgB,GAChE,MAAM,CAYR"}
1
+ {"version":3,"file":"getQueryString.d.ts","sourceRoot":"","sources":["../src/getQueryString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEzF;;;GAGG;AACH,wBAAgB,cAAc,CAC7B,WAAW,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,gBAAgB,GAChE,MAAM,CAYR"}
@@ -1 +1 @@
1
- {"version":3,"file":"getQueryString.js","sourceRoot":"","sources":["../src/getQueryString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;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,CAAC;QAC5C,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,SAAS,GAAG,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YACjD,iBAAiB;YACjB,iEAAiE;YACjE,WAAW,IAAI,GAAG,SAAS,GAAG,GAAG,IAAI,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC7E,CAAC;IACF,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotOptions } from \"@fluidframework/odsp-driver-definitions/internal\";\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\t// False-positive\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\tqueryString += `${startChar}${key}=${encodeURIComponent(queryParams[key])}`;\n\t\t}\n\t}\n\n\treturn queryString;\n}\n"]}
1
+ {"version":3,"file":"getQueryString.js","sourceRoot":"","sources":["../src/getQueryString.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;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,CAAC;QAC5C,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,SAAS,GAAG,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YACjD,iBAAiB;YACjB,iEAAiE;YACjE,WAAW,IAAI,GAAG,SAAS,GAAG,GAAG,IAAI,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC7E,CAAC;IACF,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ISnapshotOptions } from \"@fluidframework/odsp-driver-definitions/internal\";\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\t// False-positive\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\tqueryString += `${startChar}${key}=${encodeURIComponent(queryParams[key])}`;\n\t\t}\n\t}\n\n\treturn queryString;\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -3,22 +3,22 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { OdcApiSiteOrigin, OdcFileSiteOrigin } from "./constants.js";
6
- export { ClpCompliantAppHeader, IClpCompliantAppHeader, ISharingLinkHeader, OdspFluidDataStoreLocator, SharingLinkHeader, } from "./contractsPublic.js";
6
+ export { ClpCompliantAppHeader, type IClpCompliantAppHeader, type ISharingLinkHeader, type OdspFluidDataStoreLocator, SharingLinkHeader, } from "./contractsPublic.js";
7
7
  export { checkUrl } from "./checkUrl.js";
8
8
  export { createOdspUrl } from "./createOdspUrl.js";
9
- export { getHashedDocumentId, ISnapshotContents } from "./odspPublicUtils.js";
9
+ export { getHashedDocumentId, type ISnapshotContents } from "./odspPublicUtils.js";
10
10
  export { getOdspUrlParts, isOdcUrl, isSpoUrl } from "./odspUrlHelper.js";
11
11
  export { prefetchLatestSnapshot } from "./prefetchLatestSnapshot.js";
12
12
  export { createLocalOdspDocumentServiceFactory, OdspDocumentServiceFactory, } from "./odspDocumentServiceFactory.js";
13
13
  export { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore.js";
14
14
  export { createOdspCreateContainerRequest } from "./createOdspCreateContainerRequest.js";
15
15
  export { OdspDriverUrlResolver } from "./odspDriverUrlResolver.js";
16
- export { OdspDriverUrlResolverForShareLink, ShareLinkFetcherProps, } from "./odspDriverUrlResolverForShareLink.js";
16
+ export { OdspDriverUrlResolverForShareLink, type ShareLinkFetcherProps, } from "./odspDriverUrlResolverForShareLink.js";
17
17
  export { encodeOdspFluidDataStoreLocator, getLocatorFromOdspUrl, locatorQueryParamName, storeLocatorInOdspUrl, } from "./odspFluidFileLink.js";
18
- export { IOdspCache, IPersistedFileCache, INonPersistentCache, IPrefetchSnapshotContents, } from "./odspCache.js";
19
- export { ICacheAndTracker, type EpochTracker, FetchType, FetchTypeInternal, } from "./epochTracker.js";
20
- export { IOdspResponse, isOdspResolvedUrl } from "./odspUtils.js";
18
+ export type { IOdspCache, IPersistedFileCache, INonPersistentCache, IPrefetchSnapshotContents, } from "./odspCache.js";
19
+ export type { ICacheAndTracker, EpochTracker, FetchType, FetchTypeInternal, } from "./epochTracker.js";
20
+ export { type IOdspResponse, isOdspResolvedUrl } from "./odspUtils.js";
21
21
  export { SnapshotFormatSupportType } from "./fetchSnapshot.js";
22
- export { ISnapshotContentsWithProps, parseCompactSnapshotResponse, } from "./compactSnapshotParser.js";
22
+ export { type ISnapshotContentsWithProps, parseCompactSnapshotResponse, } from "./compactSnapshotParser.js";
23
23
  export { odspDriverCompatDetailsForLoader } from "./odspLayerCompatState.js";
24
24
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,EACN,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,GACjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,EACN,qCAAqC,EACrC,0BAA0B,GAC1B,MAAM,iC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,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAqB,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEzE,iDAAiD;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,UAAU;AACV,OAAO,EACN,qCAAqC,EACrC,0BAA0B,GAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF,gBAAgB;AAChB,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,6CAA6C;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACN,iCAAiC,GAEjC,MAAM,wCAAwC,CAAC;AAEhD,oEAAoE;AACpE,OAAO,EACN,+BAA+B,EAC/B,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACrB,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAAiB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAEN,4BAA4B,GAC5B,MAAM,4BAA4B,CAAC;AAEpC,uBAAuB;AACvB,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC","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.js\";\n\nexport {\n\tClpCompliantAppHeader,\n\tIClpCompliantAppHeader,\n\tISharingLinkHeader,\n\tOdspFluidDataStoreLocator,\n\tSharingLinkHeader,\n} from \"./contractsPublic.js\";\n\n// public utils\nexport { checkUrl } from \"./checkUrl.js\";\nexport { createOdspUrl } from \"./createOdspUrl.js\";\nexport { getHashedDocumentId, ISnapshotContents } from \"./odspPublicUtils.js\";\nexport { getOdspUrlParts, isOdcUrl, isSpoUrl } from \"./odspUrlHelper.js\";\n\n// prefetch latest snapshot before container load\nexport { prefetchLatestSnapshot } from \"./prefetchLatestSnapshot.js\";\n\n// Factory\nexport {\n\tcreateLocalOdspDocumentServiceFactory,\n\tOdspDocumentServiceFactory,\n} from \"./odspDocumentServiceFactory.js\";\nexport { OdspDocumentServiceFactoryCore } from \"./odspDocumentServiceFactoryCore.js\";\n\n// File creation\nexport { createOdspCreateContainerRequest } from \"./createOdspCreateContainerRequest.js\";\n\n// URI Resolver functionality, URI management\nexport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver.js\";\nexport {\n\tOdspDriverUrlResolverForShareLink,\n\tShareLinkFetcherProps,\n} from \"./odspDriverUrlResolverForShareLink.js\";\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.js\";\n\nexport {\n\tIOdspCache,\n\tIPersistedFileCache,\n\tINonPersistentCache,\n\tIPrefetchSnapshotContents,\n} from \"./odspCache.js\";\nexport {\n\tICacheAndTracker,\n\ttype EpochTracker,\n\tFetchType,\n\tFetchTypeInternal,\n} from \"./epochTracker.js\";\nexport { IOdspResponse, isOdspResolvedUrl } from \"./odspUtils.js\";\nexport { SnapshotFormatSupportType } from \"./fetchSnapshot.js\";\nexport {\n\tISnapshotContentsWithProps,\n\tparseCompactSnapshotResponse,\n} from \"./compactSnapshotParser.js\";\n\n// Layer Compat details\nexport { odspDriverCompatDetailsForLoader } from \"./odspLayerCompatState.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,EACN,qBAAqB,EAIrB,iBAAiB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,eAAe;AACf,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAA0B,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEzE,iDAAiD;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,UAAU;AACV,OAAO,EACN,qCAAqC,EACrC,0BAA0B,GAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF,gBAAgB;AAChB,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,6CAA6C;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACN,iCAAiC,GAEjC,MAAM,wCAAwC,CAAC;AAEhD,oEAAoE;AACpE,OAAO,EACN,+BAA+B,EAC/B,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACrB,MAAM,wBAAwB,CAAC;AAchC,OAAO,EAAsB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAEN,4BAA4B,GAC5B,MAAM,4BAA4B,CAAC;AAEpC,uBAAuB;AACvB,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC","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.js\";\n\nexport {\n\tClpCompliantAppHeader,\n\ttype IClpCompliantAppHeader,\n\ttype ISharingLinkHeader,\n\ttype OdspFluidDataStoreLocator,\n\tSharingLinkHeader,\n} from \"./contractsPublic.js\";\n\n// public utils\nexport { checkUrl } from \"./checkUrl.js\";\nexport { createOdspUrl } from \"./createOdspUrl.js\";\nexport { getHashedDocumentId, type ISnapshotContents } from \"./odspPublicUtils.js\";\nexport { getOdspUrlParts, isOdcUrl, isSpoUrl } from \"./odspUrlHelper.js\";\n\n// prefetch latest snapshot before container load\nexport { prefetchLatestSnapshot } from \"./prefetchLatestSnapshot.js\";\n\n// Factory\nexport {\n\tcreateLocalOdspDocumentServiceFactory,\n\tOdspDocumentServiceFactory,\n} from \"./odspDocumentServiceFactory.js\";\nexport { OdspDocumentServiceFactoryCore } from \"./odspDocumentServiceFactoryCore.js\";\n\n// File creation\nexport { createOdspCreateContainerRequest } from \"./createOdspCreateContainerRequest.js\";\n\n// URI Resolver functionality, URI management\nexport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver.js\";\nexport {\n\tOdspDriverUrlResolverForShareLink,\n\ttype ShareLinkFetcherProps,\n} from \"./odspDriverUrlResolverForShareLink.js\";\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.js\";\n\nexport type {\n\tIOdspCache,\n\tIPersistedFileCache,\n\tINonPersistentCache,\n\tIPrefetchSnapshotContents,\n} from \"./odspCache.js\";\nexport type {\n\tICacheAndTracker,\n\tEpochTracker,\n\tFetchType,\n\tFetchTypeInternal,\n} from \"./epochTracker.js\";\nexport { type IOdspResponse, isOdspResolvedUrl } from \"./odspUtils.js\";\nexport { SnapshotFormatSupportType } from \"./fetchSnapshot.js\";\nexport {\n\ttype ISnapshotContentsWithProps,\n\tparseCompactSnapshotResponse,\n} from \"./compactSnapshotParser.js\";\n\n// Layer Compat details\nexport { odspDriverCompatDetailsForLoader } from \"./odspLayerCompatState.js\";\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 { IDocumentDeltaStorageService, IStream, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
6
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
5
+ import type { IDocumentDeltaStorageService, IStream, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
6
+ import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
7
7
  /**
8
8
  * Implementation of IDocumentDeltaStorageService that will return snapshot ops when fetching messages
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"localOdspDeltaStorageService.d.ts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,4BAA4B,EAC5B,OAAO,EACP,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E;;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"}
1
+ {"version":3,"file":"localOdspDeltaStorageService.d.ts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,4BAA4B,EAC5B,OAAO,EACP,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAEpF;;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"}
@@ -1 +1 @@
1
- {"version":3,"file":"localOdspDeltaStorageService.js","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAMxE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAGlF;;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,CAAC;YACnC,OAAO,kBAAkB,CAAC;QAC3B,CAAC;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,CAAC;YAClE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACvB,CAAC;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 { validateMessages } from \"@fluidframework/driver-base/internal\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIStream,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { Queue, emptyMessageStream } from \"@fluidframework/driver-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\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"]}
1
+ {"version":3,"file":"localOdspDeltaStorageService.js","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDeltaStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAMxE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAGlF;;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,CAAC;YACnC,OAAO,kBAAkB,CAAC;QAC3B,CAAC;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,CAAC;YAClE,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACvB,CAAC;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 { validateMessages } from \"@fluidframework/driver-base/internal\";\nimport type {\n\tIDocumentDeltaStorageService,\n\tIStream,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { Queue, emptyMessageStream } from \"@fluidframework/driver-utils/internal\";\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\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"]}
@@ -3,10 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { TypedEventEmitter, type ILayerCompatDetails } from "@fluid-internal/client-utils";
6
- import { IClient } from "@fluidframework/driver-definitions";
7
- import { IDocumentDeltaStorageService, IDocumentService, IDocumentServiceEvents, IDocumentStorageService, IResolvedUrl } from "@fluidframework/driver-definitions/internal";
8
- import { IOdspResolvedUrl } from "@fluidframework/odsp-driver-definitions/internal";
9
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
6
+ import type { IClient } from "@fluidframework/driver-definitions";
7
+ import type { IDocumentDeltaStorageService, IDocumentService, IDocumentServiceEvents, IDocumentStorageService, IResolvedUrl } from "@fluidframework/driver-definitions/internal";
8
+ import type { IOdspResolvedUrl } from "@fluidframework/odsp-driver-definitions/internal";
9
+ import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
10
10
  /**
11
11
  * IDocumentService implementation that provides explicit snapshot to the document storage service.
12
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"localOdspDocumentService.d.ts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,i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MAAM,gCAAgC,CAAC;AAEvF;;GAEG;AACH,MAAM,OAAO,wBACZ,SAAQ,iBAAyC;IAMjD,YACkB,eAAiC,EACjC,MAA2B,EAC3B,aAAkC;QAEnD,KAAK,EAAE,CAAC;QAJS,oBAAe,GAAf,eAAe,CAAkB;QACjC,WAAM,GAAN,MAAM,CAAqB;QAC3B,kBAAa,GAAb,aAAa,CAAqB;QAN7C,aAAQ,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IASxC,CAAC;IAED;;;OAGG;IACH,IAAW,mBAAmB;QAC7B,OAAO,qCAAqC,CAAC;IAC9C,CAAC;IAED,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,KAAe;QAC7B,aAAa;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter, type ILayerCompatDetails } from \"@fluid-internal/client-utils\";\nimport { IClient } from \"@fluidframework/driver-definitions\";\nimport {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport { IOdspResolvedUrl } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { LocalOdspDeltaStorageService } from \"./localOdspDeltaStorageService.js\";\nimport { LocalOdspDocumentStorageService } from \"./localOdspDocumentStorageManager.js\";\nimport { localOdspDriverCompatDetailsForLoader } from \"./localOdspLayerCompatState.js\";\n\n/**\n * IDocumentService implementation that provides explicit snapshot to the document storage service.\n */\nexport class LocalOdspDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\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\t\tsuper();\n\t}\n\n\t/**\n\t * The compatibility details of the Local ODSP Driver layer that is exposed to the Loader layer\n\t * for validating Loader-Driver compatibility.\n\t */\n\tpublic get ILayerCompatDetails(): ILayerCompatDetails {\n\t\treturn localOdspDriverCompatDetailsForLoader;\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?: unknown): void {\n\t\t// Do nothing\n\t}\n}\n"]}
1
+ {"version":3,"file":"localOdspDocumentService.js","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAA4B,MAAM,8BAA8B,CAAC;AAS3F,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAInE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AAEvF;;GAEG;AACH,MAAM,OAAO,wBACZ,SAAQ,iBAAyC;IAMjD,YACkB,eAAiC,EACjC,MAA2B,EAC3B,aAAkC;QAEnD,KAAK,EAAE,CAAC;QAJS,oBAAe,GAAf,eAAe,CAAkB;QACjC,WAAM,GAAN,MAAM,CAAqB;QAC3B,kBAAa,GAAb,aAAa,CAAqB;QAN7C,aAAQ,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IASxC,CAAC;IAED;;;OAGG;IACH,IAAW,mBAAmB;QAC7B,OAAO,qCAAqC,CAAC;IAC9C,CAAC;IAED,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,KAAe;QAC7B,aAAa;IACd,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter, type ILayerCompatDetails } from \"@fluid-internal/client-utils\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport type { IOdspResolvedUrl } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { LocalOdspDeltaStorageService } from \"./localOdspDeltaStorageService.js\";\nimport { LocalOdspDocumentStorageService } from \"./localOdspDocumentStorageManager.js\";\nimport { localOdspDriverCompatDetailsForLoader } from \"./localOdspLayerCompatState.js\";\n\n/**\n * IDocumentService implementation that provides explicit snapshot to the document storage service.\n */\nexport class LocalOdspDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\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\t\tsuper();\n\t}\n\n\t/**\n\t * The compatibility details of the Local ODSP Driver layer that is exposed to the Loader layer\n\t * for validating Loader-Driver compatibility.\n\t */\n\tpublic get ILayerCompatDetails(): ILayerCompatDetails {\n\t\treturn localOdspDriverCompatDetailsForLoader;\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?: unknown): void {\n\t\t// Do nothing\n\t}\n}\n"]}
@@ -2,11 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
6
- import { ISummaryTree } from "@fluidframework/driver-definitions";
7
- import { IDocumentService, IResolvedUrl } from "@fluidframework/driver-definitions/internal";
8
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
9
- import { ICacheAndTracker } from "../epochTracker.js";
5
+ import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
6
+ import type { ISummaryTree } from "@fluidframework/driver-definitions";
7
+ import type { IDocumentService, IResolvedUrl } from "@fluidframework/driver-definitions/internal";
8
+ import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
9
+ import type { ICacheAndTracker } from "../epochTracker.js";
10
10
  import { OdspDocumentServiceFactoryCore } from "../odspDocumentServiceFactoryCore.js";
11
11
  /**
12
12
  * Factory for creating sharepoint document service with a provided snapshot.
@@ -1 +1 @@
1
- {"version":3,"file":"localOdspDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAKtF;;;;;GAKG;AACH,qBAAa,+BAAgC,SAAQ,8BAA8B;IAGtE,OAAO,CAAC,QAAQ,CAAC,aAAa;IAF1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;gBAErC,aAAa,EAAE,UAAU,GAAG,MAAM;IAO/D,OAAO,CAAC,0BAA0B;IAQ3B,eAAe,CACrB,iBAAiB,EAAE,YAAY,GAAG,SAAS,EAC3C,qBAAqB,EAAE,YAAY,EACnC,MAAM,CAAC,EAAE,oBAAoB,EAC7B,mBAAmB,CAAC,EAAE,OAAO,GAC3B,KAAK;cAQQ,yBAAyB,CACxC,WAAW,EAAE,YAAY,EACzB,UAAU,EAAE,mBAAmB,EAC/B,mBAAmB,CAAC,EAAE,gBAAgB,EACtC,mBAAmB,CAAC,EAAE,OAAO,GAC3B,OAAO,CAAC,gBAAgB,CAAC;CAa5B"}
1
+ {"version":3,"file":"localOdspDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAE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UAAU,EACV,IAAI,CAAC,aAAa,CAClB,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { IDocumentService, IResolvedUrl } from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ICacheAndTracker } from \"../epochTracker.js\";\nimport { OdspDocumentServiceFactoryCore } from \"../odspDocumentServiceFactoryCore.js\";\nimport { createOdspLogger, getOdspResolvedUrl } from \"../odspUtils.js\";\n\nimport { LocalOdspDocumentService } from \"./localOdspDocumentService.js\";\n\n/**\n * Factory for creating sharepoint document service with a provided snapshot.\n *\n * @remarks Use if you don't want to connect to any kind of external/internal storages and want to provide\n * content directly.\n */\nexport class LocalOdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {\n\tprivate readonly logger: ITelemetryLoggerExt = createOdspLogger();\n\n\tconstructor(private readonly localSnapshot: Uint8Array | string) {\n\t\tsuper(\n\t\t\t(_options) => this.throwUnsupportedUsageError(\"Getting storage token\"),\n\t\t\t(_options) => this.throwUnsupportedUsageError(\"Getting websocket token\"),\n\t\t);\n\t}\n\n\tprivate throwUnsupportedUsageError(unsupportedFuncName: string): never {\n\t\tconst toThrow = new UsageError(\n\t\t\t`${unsupportedFuncName} is not supported by LocalOdspDocumentServiceFactory`,\n\t\t);\n\t\tthis.logger.sendErrorEvent({ eventName: \"UnsupportedUsage\" }, toThrow);\n\t\tthrow toThrow;\n\t}\n\n\tpublic createContainer(\n\t\t_createNewSummary: ISummaryTree | undefined,\n\t\t_createNewResolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\t_clientIsSummarizer?: boolean,\n\t): never {\n\t\tconst toThrow = new UsageError(\n\t\t\t'\"createContainer\" is not supported by LocalOdspDocumentServiceFactory',\n\t\t);\n\t\tthis.logger.sendErrorEvent({ eventName: \"UnsupportedUsage\" }, toThrow);\n\t\tthrow toThrow;\n\t}\n\n\tprotected async createDocumentServiceCore(\n\t\tresolvedUrl: IResolvedUrl,\n\t\todspLogger: ITelemetryLoggerExt,\n\t\t_cacheAndTrackerArg?: ICacheAndTracker,\n\t\t_clientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tif (_cacheAndTrackerArg !== undefined) {\n\t\t\tthrow new UsageError('Invalid usage. \"_cacheAndTrackerArg\" should not be provided');\n\t\t}\n\t\tif (_clientIsSummarizer) {\n\t\t\tthrow new UsageError('Invalid usage. \"_clientIsSummarizer\" should not be provided');\n\t\t}\n\t\treturn new LocalOdspDocumentService(\n\t\t\tgetOdspResolvedUrl(resolvedUrl),\n\t\t\todspLogger,\n\t\t\tthis.localSnapshot,\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"localOdspDocumentServiceFactory.js","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAInE,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,OAAO,+BAAgC,SAAQ,8BAA8B;IAGlF,YAA6B,aAAkC;QAC9D,KAAK,CACJ,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,0BAA0B,CAAC,uBAAuB,CAAC,EACtE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,0BAA0B,CAAC,yBAAyB,CAAC,CACxE,CAAC;QAJ0B,kBAAa,GAAb,aAAa,CAAqB;QAF9C,WAAM,GAAwB,gBAAgB,EAAE,CAAC;IAOlE,CAAC;IAEO,0BAA0B,CAAC,mBAA2B;QAC7D,MAAM,OAAO,GAAG,IAAI,UAAU,CAC7B,GAAG,mBAAmB,sDAAsD,CAC5E,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC,CAAC;QACvE,MAAM,OAAO,CAAC;IACf,CAAC;IAEM,eAAe,CACrB,iBAA2C,EAC3C,qBAAmC,EACnC,MAA6B,EAC7B,mBAA6B;QAE7B,MAAM,OAAO,GAAG,IAAI,UAAU,CAC7B,uEAAuE,CACvE,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC,CAAC;QACvE,MAAM,OAAO,CAAC;IACf,CAAC;IAES,KAAK,CAAC,yBAAyB,CACxC,WAAyB,EACzB,UAA+B,EAC/B,mBAAsC,EACtC,mBAA6B;QAE7B,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,IAAI,UAAU,CAAC,6DAA6D,CAAC,CAAC;QACrF,CAAC;QACD,IAAI,mBAAmB,EAAE,CAAC;YACzB,MAAM,IAAI,UAAU,CAAC,6DAA6D,CAAC,CAAC;QACrF,CAAC;QACD,OAAO,IAAI,wBAAwB,CAClC,kBAAkB,CAAC,WAAW,CAAC,EAC/B,UAAU,EACV,IAAI,CAAC,aAAa,CAClB,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICacheAndTracker } from \"../epochTracker.js\";\nimport { OdspDocumentServiceFactoryCore } from \"../odspDocumentServiceFactoryCore.js\";\nimport { createOdspLogger, getOdspResolvedUrl } from \"../odspUtils.js\";\n\nimport { LocalOdspDocumentService } from \"./localOdspDocumentService.js\";\n\n/**\n * Factory for creating sharepoint document service with a provided snapshot.\n *\n * @remarks Use if you don't want to connect to any kind of external/internal storages and want to provide\n * content directly.\n */\nexport class LocalOdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {\n\tprivate readonly logger: ITelemetryLoggerExt = createOdspLogger();\n\n\tconstructor(private readonly localSnapshot: Uint8Array | string) {\n\t\tsuper(\n\t\t\t(_options) => this.throwUnsupportedUsageError(\"Getting storage token\"),\n\t\t\t(_options) => this.throwUnsupportedUsageError(\"Getting websocket token\"),\n\t\t);\n\t}\n\n\tprivate throwUnsupportedUsageError(unsupportedFuncName: string): never {\n\t\tconst toThrow = new UsageError(\n\t\t\t`${unsupportedFuncName} is not supported by LocalOdspDocumentServiceFactory`,\n\t\t);\n\t\tthis.logger.sendErrorEvent({ eventName: \"UnsupportedUsage\" }, toThrow);\n\t\tthrow toThrow;\n\t}\n\n\tpublic createContainer(\n\t\t_createNewSummary: ISummaryTree | undefined,\n\t\t_createNewResolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\t_clientIsSummarizer?: boolean,\n\t): never {\n\t\tconst toThrow = new UsageError(\n\t\t\t'\"createContainer\" is not supported by LocalOdspDocumentServiceFactory',\n\t\t);\n\t\tthis.logger.sendErrorEvent({ eventName: \"UnsupportedUsage\" }, toThrow);\n\t\tthrow toThrow;\n\t}\n\n\tprotected async createDocumentServiceCore(\n\t\tresolvedUrl: IResolvedUrl,\n\t\todspLogger: ITelemetryLoggerExt,\n\t\t_cacheAndTrackerArg?: ICacheAndTracker,\n\t\t_clientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tif (_cacheAndTrackerArg !== undefined) {\n\t\t\tthrow new UsageError('Invalid usage. \"_cacheAndTrackerArg\" should not be provided');\n\t\t}\n\t\tif (_clientIsSummarizer) {\n\t\t\tthrow new UsageError('Invalid usage. \"_clientIsSummarizer\" should not be provided');\n\t\t}\n\t\treturn new LocalOdspDocumentService(\n\t\t\tgetOdspResolvedUrl(resolvedUrl),\n\t\t\todspLogger,\n\t\t\tthis.localSnapshot,\n\t\t);\n\t}\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ISummaryTree } from "@fluidframework/driver-definitions";
6
- import { ISnapshot, ISnapshotFetchOptions, ISummaryContext, IVersion } from "@fluidframework/driver-definitions/internal";
7
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
5
+ import type { ISummaryTree } from "@fluidframework/driver-definitions";
6
+ import type { ISnapshot, ISnapshotFetchOptions, ISummaryContext, IVersion } from "@fluidframework/driver-definitions/internal";
7
+ import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
8
8
  import { OdspDocumentStorageServiceBase } from "../odspDocumentStorageServiceBase.js";
9
9
  /**
10
10
  * ODSP document storage service that works on a provided snapshot for all its processing.
@@ -1 +1 @@
1
- {"version":3,"file":"localOdspDocumentStorageManager.d.ts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentStorageManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EACN,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,QAAQ,EACR,MAAM,6CAA6C,CAAC;AAErD,OAAO,EACN,mBAAmB,EAEnB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAGtF;;;GAGG;AACH,qBAAa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CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;IAEO,kBAAkB;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,SAAU,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrF,CAAC;IAES,qBAAqB,CAAC,GAAW,EAAE,aAAsB;QAClE,IAAI,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAAC;IAC/C,CAAC;IAES,oBAAoB,CAAC,OAAe,EAAE,QAAiB;QAChE,IAAI,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC;IAC9C,CAAC;IAEM,wBAAwB,CAAC,QAAsB,EAAE,QAAyB;QAChF,IAAI,CAAC,eAAe,CAAC,0BAA0B,CAAC,CAAC;IAClD,CAAC;IAEM,UAAU,CAAC,KAAsB;QACvC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC;IAEO,eAAe,CAAC,UAAkB;QACzC,MAAM,OAAO,GAAG,IAAI,UAAU,CAC7B,IAAI,UAAU,uDAAuD,CACrE,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC,CAAC;QACvE,MAAM,OAAO,CAAC;IACf,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport {\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { parseCompactSnapshotResponse } from \"../compactSnapshotParser.js\";\nimport { IOdspSnapshot } from \"../contracts.js\";\nimport { OdspDocumentStorageServiceBase } from \"../odspDocumentStorageServiceBase.js\";\nimport { convertOdspSnapshotToSnapshotTreeAndBlobs } from \"../odspSnapshotParser.js\";\n\n/**\n * ODSP document storage service that works on a provided snapshot for all its processing.\n * Attempting to use unsupported actions/methods will result in errors being thrown.\n */\nexport class LocalOdspDocumentStorageService extends OdspDocumentStorageServiceBase {\n\tprivate snapshotTreeId: string | undefined;\n\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly localSnapshot: Uint8Array | string,\n\t) {\n\t\tsuper(loggerToMonitoringContext(logger).config);\n\t}\n\n\tprivate calledGetVersions = false;\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tblobid: string | null,\n\t\tcount: number,\n\t\t_scenarioName?: string,\n\t): Promise<IVersion[]> {\n\t\tassert(blobid === null, 0x342 /* Invalid usage. \"blobid\" should always be null */);\n\t\tassert(count === 1, 0x343 /* Invalid usage. \"count\" should always be 1 */);\n\n\t\t// No reason to re-parse the data since it will never change\n\t\tif (this.calledGetVersions) {\n\t\t\treturn this.getSnapshotVersion();\n\t\t}\n\t\tthis.calledGetVersions = true;\n\n\t\tlet snapshotContents: ISnapshot;\n\n\t\tif (typeof this.localSnapshot === \"string\") {\n\t\t\tconst content: IOdspSnapshot = JSON.parse(this.localSnapshot) as IOdspSnapshot;\n\t\t\tsnapshotContents = convertOdspSnapshotToSnapshotTreeAndBlobs(content);\n\t\t} else {\n\t\t\tsnapshotContents = parseCompactSnapshotResponse(this.localSnapshot, this.logger);\n\t\t}\n\n\t\tthis.snapshotTreeId = this.initializeFromSnapshot(snapshotContents);\n\t\treturn this.getSnapshotVersion();\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\tthis.throwUsageError(\"getSnapshot\");\n\t}\n\n\tprivate getSnapshotVersion(): IVersion[] {\n\t\treturn this.snapshotTreeId ? [{ id: this.snapshotTreeId, treeId: undefined! }] : [];\n\t}\n\n\tprotected fetchTreeFromSnapshot(_id: string, _scenarioName?: string): never {\n\t\tthis.throwUsageError(\"fetchTreeFromSnapshot\");\n\t}\n\n\tprotected fetchBlobFromStorage(_blobId: string, _evicted: boolean): never {\n\t\tthis.throwUsageError(\"fetchBlobFromStorage\");\n\t}\n\n\tpublic uploadSummaryWithContext(_summary: ISummaryTree, _context: ISummaryContext): never {\n\t\tthis.throwUsageError(\"uploadSummaryWithContext\");\n\t}\n\n\tpublic createBlob(_file: ArrayBufferLike): never {\n\t\tthis.throwUsageError(\"createBlob\");\n\t}\n\n\tprivate throwUsageError(methodName: string): never {\n\t\tconst toThrow = new UsageError(\n\t\t\t`\"${methodName}\" is not supported by LocalOdspDocumentStorageService`,\n\t\t);\n\t\tthis.logger.sendErrorEvent({ eventName: \"UnsupportedUsage\" }, toThrow);\n\t\tthrow toThrow;\n\t}\n}\n"]}
1
+ {"version":3,"file":"localOdspDocumentStorageManager.js","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspDocumentStorageManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAQ7D,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAEN,yBAAyB,GACzB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAE3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,EAAE,yCAAyC,EAAE,MAAM,0BAA0B,CAAC;AAErF;;;GAGG;AACH,MAAM,OAAO,+BAAgC,SAAQ,8BAA8B;IAGlF,YACkB,MAA2B,EAC3B,aAAkC;QAEnD,KAAK,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;QAH/B,WA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EAAE,CAAC;IACrF,CAAC;IAES,qBAAqB,CAAC,GAAW,EAAE,aAAsB;QAClE,IAAI,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAAC;IAC/C,CAAC;IAES,oBAAoB,CAAC,OAAe,EAAE,QAAiB;QAChE,IAAI,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC;IAC9C,CAAC;IAEM,wBAAwB,CAAC,QAAsB,EAAE,QAAyB;QAChF,IAAI,CAAC,eAAe,CAAC,0BAA0B,CAAC,CAAC;IAClD,CAAC;IAEM,UAAU,CAAC,KAAsB;QACvC,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IACpC,CAAC;IAEO,eAAe,CAAC,UAAkB;QACzC,MAAM,OAAO,GAAG,IAAI,UAAU,CAC7B,IAAI,UAAU,uDAAuD,CACrE,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,OAAO,CAAC,CAAC;QACvE,MAAM,OAAO,CAAC;IACf,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type {\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { parseCompactSnapshotResponse } from \"../compactSnapshotParser.js\";\nimport type { IOdspSnapshot } from \"../contracts.js\";\nimport { OdspDocumentStorageServiceBase } from \"../odspDocumentStorageServiceBase.js\";\nimport { convertOdspSnapshotToSnapshotTreeAndBlobs } from \"../odspSnapshotParser.js\";\n\n/**\n * ODSP document storage service that works on a provided snapshot for all its processing.\n * Attempting to use unsupported actions/methods will result in errors being thrown.\n */\nexport class LocalOdspDocumentStorageService extends OdspDocumentStorageServiceBase {\n\tprivate snapshotTreeId: string | undefined;\n\n\tconstructor(\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly localSnapshot: Uint8Array | string,\n\t) {\n\t\tsuper(loggerToMonitoringContext(logger).config);\n\t}\n\n\tprivate calledGetVersions = false;\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tblobid: string | null,\n\t\tcount: number,\n\t\t_scenarioName?: string,\n\t): Promise<IVersion[]> {\n\t\tassert(blobid === null, 0x342 /* Invalid usage. \"blobid\" should always be null */);\n\t\tassert(count === 1, 0x343 /* Invalid usage. \"count\" should always be 1 */);\n\n\t\t// No reason to re-parse the data since it will never change\n\t\tif (this.calledGetVersions) {\n\t\t\treturn this.getSnapshotVersion();\n\t\t}\n\t\tthis.calledGetVersions = true;\n\n\t\tlet snapshotContents: ISnapshot;\n\n\t\tif (typeof this.localSnapshot === \"string\") {\n\t\t\tconst content: IOdspSnapshot = JSON.parse(this.localSnapshot) as IOdspSnapshot;\n\t\t\tsnapshotContents = convertOdspSnapshotToSnapshotTreeAndBlobs(content);\n\t\t} else {\n\t\t\tsnapshotContents = parseCompactSnapshotResponse(this.localSnapshot, this.logger);\n\t\t}\n\n\t\tthis.snapshotTreeId = this.initializeFromSnapshot(snapshotContents);\n\t\treturn this.getSnapshotVersion();\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\tthis.throwUsageError(\"getSnapshot\");\n\t}\n\n\tprivate getSnapshotVersion(): IVersion[] {\n\t\treturn this.snapshotTreeId ? [{ id: this.snapshotTreeId, treeId: undefined! }] : [];\n\t}\n\n\tprotected fetchTreeFromSnapshot(_id: string, _scenarioName?: string): never {\n\t\tthis.throwUsageError(\"fetchTreeFromSnapshot\");\n\t}\n\n\tprotected fetchBlobFromStorage(_blobId: string, _evicted: boolean): never {\n\t\tthis.throwUsageError(\"fetchBlobFromStorage\");\n\t}\n\n\tpublic uploadSummaryWithContext(_summary: ISummaryTree, _context: ISummaryContext): never {\n\t\tthis.throwUsageError(\"uploadSummaryWithContext\");\n\t}\n\n\tpublic createBlob(_file: ArrayBufferLike): never {\n\t\tthis.throwUsageError(\"createBlob\");\n\t}\n\n\tprivate throwUsageError(methodName: string): never {\n\t\tconst toThrow = new UsageError(\n\t\t\t`\"${methodName}\" is not supported by LocalOdspDocumentStorageService`,\n\t\t);\n\t\tthis.logger.sendErrorEvent({ eventName: \"UnsupportedUsage\" }, toThrow);\n\t\tthrow toThrow;\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 { type ILayerCompatDetails } from "@fluid-internal/client-utils";
5
+ import type { ILayerCompatDetails } from "@fluid-internal/client-utils";
6
6
  /**
7
7
  * Local ODSP Driver's compatibility details that is exposed to the Loader layer.
8
8
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"localOdspLayerCompatState.d.ts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAIxE;;;GAGG;AACH,eAAO,MAAM,qCAAqC,EAAE,mBAanD,CAAC"}
1
+ {"version":3,"file":"localOdspLayerCompatState.d.ts","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAIxE;;;GAGG;AACH,eAAO,MAAM,qCAAqC,EAAE,mBAanD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"localOdspLayerCompatState.js","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAwB;IACzE;;OAEG;IACH,UAAU;IACV;;OAEG;IACH,UAAU,EAAE,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,EAAU;CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { type ILayerCompatDetails } from \"@fluid-internal/client-utils\";\n\nimport { pkgVersion } from \"../packageVersion.js\";\n\n/**\n * Local ODSP Driver's compatibility details that is exposed to the Loader layer.\n * @internal\n */\nexport const localOdspDriverCompatDetailsForLoader: ILayerCompatDetails = {\n\t/**\n\t * The package version of the Local ODSP Driver layer.\n\t */\n\tpkgVersion,\n\t/**\n\t * The current generation of the Local ODSP Driver layer.\n\t */\n\tgeneration: 1,\n\t/**\n\t * The features supported by the Local ODSP Driver layer across the Driver / Loader boundary.\n\t */\n\tsupportedFeatures: new Set<string>(),\n};\n"]}
1
+ {"version":3,"file":"localOdspLayerCompatState.js","sourceRoot":"","sources":["../../src/localOdspDriver/localOdspLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAwB;IACzE;;OAEG;IACH,UAAU;IACV;;OAEG;IACH,UAAU,EAAE,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,EAAU;CACpC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ILayerCompatDetails } from \"@fluid-internal/client-utils\";\n\nimport { pkgVersion } from \"../packageVersion.js\";\n\n/**\n * Local ODSP Driver's compatibility details that is exposed to the Loader layer.\n * @internal\n */\nexport const localOdspDriverCompatDetailsForLoader: ILayerCompatDetails = {\n\t/**\n\t * The package version of the Local ODSP Driver layer.\n\t */\n\tpkgVersion,\n\t/**\n\t * The current generation of the Local ODSP Driver layer.\n\t */\n\tgeneration: 1,\n\t/**\n\t * The features supported by the Local ODSP Driver layer across the Driver / Loader boundary.\n\t */\n\tsupportedFeatures: new Set<string>(),\n};\n"]}
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { PromiseCache } from "@fluidframework/core-utils/internal";
6
- import { ISnapshot } from "@fluidframework/driver-definitions/internal";
7
- import { ICacheEntry, IEntry, IFileEntry, IOdspResolvedUrl, IPersistedCache, ISocketStorageDiscovery } from "@fluidframework/odsp-driver-definitions/internal";
6
+ import type { ISnapshot } from "@fluidframework/driver-definitions/internal";
7
+ import { type ICacheEntry, type IEntry, type IFileEntry, type IOdspResolvedUrl, type IPersistedCache, type ISocketStorageDiscovery } from "@fluidframework/odsp-driver-definitions/internal";
8
8
  /**
9
9
  * Similar to IPersistedCache, but exposes cache interface for single file
10
10
  * @legacy
@@ -1 +1 @@
1
- {"version":3,"file":"odspCache.d.ts","sourceRoot":"","sources":["../src/odspCache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACxE,OAAO,EACN,WAAW,EACX,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EAEvB,MAAM,kDAAkD,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAGnC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAGjC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,aAAa,IA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C,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE;YACnB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,qBAAqB,CAAC,KAAa;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;IACF,CAAC;IAEO,qBAAqB,CAAC,KAAa;QAC1C,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAC1B,KAAK,EACL,UAAU,CAAC,GAAG,EAAE;YACf,IAAI,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAC7B,CAAC;IACH,CAAC;CACD;AACD,MAAM,OAAO,oCAAwC,SAAQ,YAAuB;IACnF,YAAY,aAA2C;QACtD,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;IAC9E,CAAC;CACD;AAwCD,MAAM,OAAO,kBAAkB;IAA/B;QACiB,qBAAgB,GAAG,IAAI,YAAY,EAGhD,CAAC;QAEY,iBAAY,GAAG,IAAI,YAAY,EAA4B,CAAC;QAE5D,gCAA2B,GAAG,IAAI,YAAY,EAG3D,CAAC;IACL,CAAC;CAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { PromiseCache } from \"@fluidframework/core-utils/internal\";\nimport { ISnapshot } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tICacheEntry,\n\tIEntry,\n\tIFileEntry,\n\tIOdspResolvedUrl,\n\tIPersistedCache,\n\tISocketStorageDiscovery,\n\tgetKeyForCacheEntry,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\n\n/**\n * Similar to IPersistedCache, but exposes cache interface for single file\n * @legacy\n * @alpha\n */\nexport interface IPersistedFileCache {\n\t// TODO: use a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tget(entry: IEntry): Promise<any>;\n\t// TODO: use a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tput(entry: IEntry, value: any): Promise<void>;\n\tremoveEntries(): Promise<void>;\n}\n\n/**\n * Default local-only implementation of IPersistedCache,\n * used if no persisted cache is provided by the host\n */\nexport class LocalPersistentCache implements IPersistedCache {\n\tprivate readonly cache = new Map<string, unknown>();\n\t// For every document id there will be a single expiration entry inspite of the number of cache entries.\n\tprivate readonly docIdExpirationMap = new Map<string, ReturnType<typeof setTimeout>>();\n\n\tpublic constructor(private readonly snapshotExpiryPolicy = 3600 * 1000) {}\n\n\tasync get(entry: ICacheEntry): Promise<unknown> {\n\t\tconst key = getKeyForCacheEntry(entry);\n\t\treturn this.cache.get(key);\n\t}\n\n\tasync put(entry: ICacheEntry, value: unknown): Promise<void> {\n\t\tconst key = getKeyForCacheEntry(entry);\n\t\tthis.cache.set(key, value);\n\t\tthis.updateExpirationEntry(entry.file.docId);\n\t}\n\n\tasync removeEntries(file: IFileEntry): Promise<void> {\n\t\tthis.removeDocIdEntriesFromCache(file.docId);\n\t}\n\n\tprivate removeDocIdEntriesFromCache(docId: string): void[] {\n\t\tthis.removeExpirationEntry(docId);\n\t\treturn [...this.cache]\n\t\t\t.filter(([cachekey]) => {\n\t\t\t\tconst docIdFromKey = cachekey.split(\"_\");\n\t\t\t\tif (docIdFromKey[0] === docId) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.map(([cachekey]) => {\n\t\t\t\tthis.cache.delete(cachekey);\n\t\t\t});\n\t}\n\n\tprivate removeExpirationEntry(docId: string): void {\n\t\tconst timeout = this.docIdExpirationMap.get(docId);\n\t\tif (timeout !== undefined) {\n\t\t\tclearTimeout(timeout);\n\t\t\tthis.docIdExpirationMap.delete(docId);\n\t\t}\n\t}\n\n\tprivate updateExpirationEntry(docId: string): void {\n\t\tthis.removeExpirationEntry(docId);\n\t\tthis.docIdExpirationMap.set(\n\t\t\tdocId,\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.removeDocIdEntriesFromCache(docId);\n\t\t\t}, this.snapshotExpiryPolicy),\n\t\t);\n\t}\n}\nexport class PromiseCacheWithOneHourSlidingExpiry<T> extends PromiseCache<string, T> {\n\tconstructor(removeOnError?: (error: unknown) => boolean) {\n\t\tsuper({ expiry: { policy: \"sliding\", durationMs: 3600000 }, removeOnError });\n\t}\n}\n\n/**\n * Internal cache interface used within driver only\n * @legacy\n * @alpha\n */\nexport interface INonPersistentCache {\n\t/**\n\t * Cache of joined/joining session info\n\t */\n\treadonly sessionJoinCache: PromiseCache<\n\t\tstring,\n\t\t{ entryTime: number; joinSessionResponse: ISocketStorageDiscovery }\n\t>;\n\n\t/**\n\t * Cache of resolved/resolving file URLs\n\t */\n\treadonly fileUrlCache: PromiseCache<string, IOdspResolvedUrl>;\n\n\t/**\n\t * Used to store the snapshot fetch promise if the prefetch has been made using the prefetchLatestSnapshot api.\n\t * This is then used later to look for the promise during the container load.\n\t */\n\treadonly snapshotPrefetchResultCache: PromiseCache<string, IPrefetchSnapshotContents>;\n}\n\n/**\n * Internal cache interface used within driver only\n * @legacy\n * @alpha\n */\nexport interface IOdspCache extends INonPersistentCache {\n\t/**\n\t * Persisted cache - only serializable content is allowed\n\t */\n\treadonly persistedCache: IPersistedFileCache;\n}\n\nexport class NonPersistentCache implements INonPersistentCache {\n\tpublic readonly sessionJoinCache = new PromiseCache<\n\t\tstring,\n\t\t{ entryTime: number; joinSessionResponse: ISocketStorageDiscovery }\n\t>();\n\n\tpublic readonly fileUrlCache = new PromiseCache<string, IOdspResolvedUrl>();\n\n\tpublic readonly snapshotPrefetchResultCache = new PromiseCache<\n\t\tstring,\n\t\tIPrefetchSnapshotContents\n\t>();\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IPrefetchSnapshotContents extends ISnapshot {\n\tfluidEpoch: string;\n\tprefetchStartTime: number;\n}\n"]}
1
+ {"version":3,"file":"odspCache.js","sourceRoot":"","sources":["../src/odspCache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAEnE,OAAO,EAON,mBAAmB,GACnB,MAAM,kDAAkD,CAAC;AAiB1D;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAKhC,YAAoC,uBAAuB,IAAI,GAAG,IAAI;QAAlC,yBAAoB,GAApB,oBAAoB,CAAc;QAJrD,UAAK,GAAG,IAAI,GAAG,EAAmB,CAAC;QACpD,wGAAwG;QACvF,uBAAkB,GAAG,IAAI,GAAG,EAAyC,CAAC;IAEd,CAAC;IAE1E,KAAK,CAAC,GAAG,CAAC,KAAkB;QAC3B,MAAM,GAAG,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,KAAkB,EAAE,KAAc;QAC3C,MAAM,GAAG,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC3B,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAgB;QACnC,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAEO,2B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,CAAC;IAC9E,CAAC;CACD;AAwCD,MAAM,OAAO,kBAAkB;IAA/B;QACiB,qBAAgB,GAAG,IAAI,YAAY,EAGhD,CAAC;QAEY,iBAAY,GAAG,IAAI,YAAY,EAA4B,CAAC;QAE5D,gCAA2B,GAAG,IAAI,YAAY,EAG3D,CAAC;IACL,CAAC;CAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { PromiseCache } from \"@fluidframework/core-utils/internal\";\nimport type { ISnapshot } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\ttype ICacheEntry,\n\ttype IEntry,\n\ttype IFileEntry,\n\ttype IOdspResolvedUrl,\n\ttype IPersistedCache,\n\ttype ISocketStorageDiscovery,\n\tgetKeyForCacheEntry,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\n\n/**\n * Similar to IPersistedCache, but exposes cache interface for single file\n * @legacy\n * @alpha\n */\nexport interface IPersistedFileCache {\n\t// TODO: use a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tget(entry: IEntry): Promise<any>;\n\t// TODO: use a stronger type\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tput(entry: IEntry, value: any): Promise<void>;\n\tremoveEntries(): Promise<void>;\n}\n\n/**\n * Default local-only implementation of IPersistedCache,\n * used if no persisted cache is provided by the host\n */\nexport class LocalPersistentCache implements IPersistedCache {\n\tprivate readonly cache = new Map<string, unknown>();\n\t// For every document id there will be a single expiration entry inspite of the number of cache entries.\n\tprivate readonly docIdExpirationMap = new Map<string, ReturnType<typeof setTimeout>>();\n\n\tpublic constructor(private readonly snapshotExpiryPolicy = 3600 * 1000) {}\n\n\tasync get(entry: ICacheEntry): Promise<unknown> {\n\t\tconst key = getKeyForCacheEntry(entry);\n\t\treturn this.cache.get(key);\n\t}\n\n\tasync put(entry: ICacheEntry, value: unknown): Promise<void> {\n\t\tconst key = getKeyForCacheEntry(entry);\n\t\tthis.cache.set(key, value);\n\t\tthis.updateExpirationEntry(entry.file.docId);\n\t}\n\n\tasync removeEntries(file: IFileEntry): Promise<void> {\n\t\tthis.removeDocIdEntriesFromCache(file.docId);\n\t}\n\n\tprivate removeDocIdEntriesFromCache(docId: string): void[] {\n\t\tthis.removeExpirationEntry(docId);\n\t\treturn [...this.cache]\n\t\t\t.filter(([cachekey]) => {\n\t\t\t\tconst docIdFromKey = cachekey.split(\"_\");\n\t\t\t\tif (docIdFromKey[0] === docId) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.map(([cachekey]) => {\n\t\t\t\tthis.cache.delete(cachekey);\n\t\t\t});\n\t}\n\n\tprivate removeExpirationEntry(docId: string): void {\n\t\tconst timeout = this.docIdExpirationMap.get(docId);\n\t\tif (timeout !== undefined) {\n\t\t\tclearTimeout(timeout);\n\t\t\tthis.docIdExpirationMap.delete(docId);\n\t\t}\n\t}\n\n\tprivate updateExpirationEntry(docId: string): void {\n\t\tthis.removeExpirationEntry(docId);\n\t\tthis.docIdExpirationMap.set(\n\t\t\tdocId,\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.removeDocIdEntriesFromCache(docId);\n\t\t\t}, this.snapshotExpiryPolicy),\n\t\t);\n\t}\n}\nexport class PromiseCacheWithOneHourSlidingExpiry<T> extends PromiseCache<string, T> {\n\tconstructor(removeOnError?: (error: unknown) => boolean) {\n\t\tsuper({ expiry: { policy: \"sliding\", durationMs: 3600000 }, removeOnError });\n\t}\n}\n\n/**\n * Internal cache interface used within driver only\n * @legacy\n * @alpha\n */\nexport interface INonPersistentCache {\n\t/**\n\t * Cache of joined/joining session info\n\t */\n\treadonly sessionJoinCache: PromiseCache<\n\t\tstring,\n\t\t{ entryTime: number; joinSessionResponse: ISocketStorageDiscovery }\n\t>;\n\n\t/**\n\t * Cache of resolved/resolving file URLs\n\t */\n\treadonly fileUrlCache: PromiseCache<string, IOdspResolvedUrl>;\n\n\t/**\n\t * Used to store the snapshot fetch promise if the prefetch has been made using the prefetchLatestSnapshot api.\n\t * This is then used later to look for the promise during the container load.\n\t */\n\treadonly snapshotPrefetchResultCache: PromiseCache<string, IPrefetchSnapshotContents>;\n}\n\n/**\n * Internal cache interface used within driver only\n * @legacy\n * @alpha\n */\nexport interface IOdspCache extends INonPersistentCache {\n\t/**\n\t * Persisted cache - only serializable content is allowed\n\t */\n\treadonly persistedCache: IPersistedFileCache;\n}\n\nexport class NonPersistentCache implements INonPersistentCache {\n\tpublic readonly sessionJoinCache = new PromiseCache<\n\t\tstring,\n\t\t{ entryTime: number; joinSessionResponse: ISocketStorageDiscovery }\n\t>();\n\n\tpublic readonly fileUrlCache = new PromiseCache<string, IOdspResolvedUrl>();\n\n\tpublic readonly snapshotPrefetchResultCache = new PromiseCache<\n\t\tstring,\n\t\tIPrefetchSnapshotContents\n\t>();\n}\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IPrefetchSnapshotContents extends ISnapshot {\n\tfluidEpoch: string;\n\tprefetchStartTime: number;\n}\n"]}
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IClient } from "@fluidframework/driver-definitions";
6
- import { IDocumentDeltaConnection, IDocumentServicePolicies, IResolvedUrl, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
7
- import { HostStoragePolicy, IOdspResolvedUrl, InstrumentedStorageTokenFetcher, TokenFetchOptions } from "@fluidframework/odsp-driver-definitions/internal";
8
- import { MonitoringContext } from "@fluidframework/telemetry-utils/internal";
9
- import { EpochTracker } from "./epochTracker.js";
10
- import { IOdspCache } from "./odspCache.js";
5
+ import type { IClient } from "@fluidframework/driver-definitions";
6
+ import type { IDocumentDeltaConnection, IDocumentServicePolicies, IResolvedUrl, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
7
+ import { type HostStoragePolicy, type IOdspResolvedUrl, type InstrumentedStorageTokenFetcher, type TokenFetchOptions } from "@fluidframework/odsp-driver-definitions/internal";
8
+ import { type MonitoringContext } from "@fluidframework/telemetry-utils/internal";
9
+ import type { EpochTracker } from "./epochTracker.js";
10
+ import type { IOdspCache } from "./odspCache.js";
11
11
  import { OdspDocumentDeltaConnection } from "./odspDocumentDeltaConnection.js";
12
12
  /**
13
13
  * This OdspDelayLoadedDeltaStream is used by OdspDocumentService.ts to delay load the delta connection
@@ -1 +1 @@
1
- {"version":3,"file":"odspDelayLoadedDeltaStream.d.ts","sourceRoot":"","sources":["../src/odspDelayLoadedDeltaStream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EACN,wBAAwB,EACxB,wBAAwB,EACxB,YAAY,EAEZ,yBAAyB,EAEzB,MAAM,6CAA6C,CAAC;AAMrD,OAAO,EACN,iBAAiB,EAEjB,gBAAgB,EAEhB,+BAA+B,EAE/B,iBAAiB,EACjB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,iBAAiB,EAEjB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAS/E;;;GAGG;AACH,qBAAa,0BAA0B;aAkCrB,eAAe,EAAE,gBAAgB;IAC1C,QAAQ,EAAE,wBAAwB;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAGlC,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,qBAAqB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aStream {
115
115
  const annotateAndRethrowConnectionError = (step) => (error) => {
116
116
  throw this.annotateConnectionError(error, step, !requestWebsocketTokenFromJoinSession);
117
117
  };
118
+ // Log telemetry for join session attempt
119
+ if (this.firstConnectionAttempt) {
120
+ this.mc.logger.sendTelemetryEvent({
121
+ eventName: "FirstJoinSessionAttemptDetails",
122
+ details: {
123
+ requestWebsocketToken: requestWebsocketTokenFromJoinSession,
124
+ },
125
+ });
126
+ }
118
127
  const joinSessionPromise = this.joinSession(requestWebsocketTokenFromJoinSession, options, false /* isRefreshingJoinSession */, undefined /* clientId */, this.hostPolicy.sessionOptions?.displayName);
119
128
  const [websocketEndpoint, websocketToken] = await Promise.all([
120
129
  joinSessionPromise.catch(annotateAndRethrowConnectionError("joinSession")),