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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (623) hide show
  1. package/.eslintrc.cjs +33 -0
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +44 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/api-report/odsp-driver.api.md +16 -17
  8. package/dist/ReadBufferUtils.d.ts.map +1 -1
  9. package/dist/ReadBufferUtils.js.map +1 -1
  10. package/dist/WriteBufferUtils.d.ts +1 -1
  11. package/dist/WriteBufferUtils.d.ts.map +1 -1
  12. package/dist/WriteBufferUtils.js +12 -12
  13. package/dist/WriteBufferUtils.js.map +1 -1
  14. package/dist/checkUrl.d.ts.map +1 -1
  15. package/dist/checkUrl.js +5 -3
  16. package/dist/checkUrl.js.map +1 -1
  17. package/dist/compactSnapshotParser.d.ts +2 -2
  18. package/dist/compactSnapshotParser.d.ts.map +1 -1
  19. package/dist/compactSnapshotParser.js +94 -75
  20. package/dist/compactSnapshotParser.js.map +1 -1
  21. package/dist/compactSnapshotWriter.d.ts +2 -2
  22. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  23. package/dist/compactSnapshotWriter.js +26 -20
  24. package/dist/compactSnapshotWriter.js.map +1 -1
  25. package/dist/contracts.d.ts +24 -4
  26. package/dist/contracts.d.ts.map +1 -1
  27. package/dist/contracts.js +5 -1
  28. package/dist/contracts.js.map +1 -1
  29. package/dist/createFile.d.ts +4 -4
  30. package/dist/createFile.d.ts.map +1 -1
  31. package/dist/createFile.js +36 -52
  32. package/dist/createFile.js.map +1 -1
  33. package/dist/createNewContainerOnExistingFile.d.ts +2 -2
  34. package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
  35. package/dist/createNewContainerOnExistingFile.js +14 -14
  36. package/dist/createNewContainerOnExistingFile.js.map +1 -1
  37. package/dist/createNewModule.d.ts +2 -2
  38. package/dist/createNewModule.d.ts.map +1 -1
  39. package/dist/createNewModule.js +4 -4
  40. package/dist/createNewModule.js.map +1 -1
  41. package/dist/createNewUtils.d.ts +4 -4
  42. package/dist/createNewUtils.d.ts.map +1 -1
  43. package/dist/createNewUtils.js +16 -11
  44. package/dist/createNewUtils.js.map +1 -1
  45. package/dist/createOdspCreateContainerRequest.d.ts +2 -2
  46. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  47. package/dist/createOdspCreateContainerRequest.js +2 -2
  48. package/dist/createOdspCreateContainerRequest.js.map +1 -1
  49. package/dist/createOdspUrl.d.ts +1 -1
  50. package/dist/createOdspUrl.d.ts.map +1 -1
  51. package/dist/createOdspUrl.js.map +1 -1
  52. package/dist/epochTracker.d.ts +10 -9
  53. package/dist/epochTracker.d.ts.map +1 -1
  54. package/dist/epochTracker.js +67 -45
  55. package/dist/epochTracker.js.map +1 -1
  56. package/dist/fetchSnapshot.d.ts +14 -11
  57. package/dist/fetchSnapshot.d.ts.map +1 -1
  58. package/dist/fetchSnapshot.js +91 -71
  59. package/dist/fetchSnapshot.js.map +1 -1
  60. package/dist/getFileLink.d.ts.map +1 -1
  61. package/dist/getFileLink.js +25 -18
  62. package/dist/getFileLink.js.map +1 -1
  63. package/dist/getQueryString.d.ts.map +1 -1
  64. package/dist/getQueryString.js +2 -0
  65. package/dist/getQueryString.js.map +1 -1
  66. package/dist/index.d.ts +19 -19
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +44 -44
  69. package/dist/index.js.map +1 -1
  70. package/dist/localOdspDriver/localOdspDocumentService.d.ts +4 -3
  71. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  72. package/dist/localOdspDriver/localOdspDocumentService.js +8 -6
  73. package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
  74. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +8 -6
  75. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  76. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js +10 -9
  77. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  78. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -2
  79. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  80. package/dist/localOdspDriver/localOdspDocumentStorageManager.js +9 -6
  81. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  82. package/dist/odsp-driver-alpha.d.ts +31 -15
  83. package/dist/odsp-driver-beta.d.ts +4 -5
  84. package/dist/odsp-driver-public.d.ts +4 -5
  85. package/dist/odsp-driver-untrimmed.d.ts +34 -16
  86. package/dist/odspCache.d.ts +5 -5
  87. package/dist/odspCache.d.ts.map +1 -1
  88. package/dist/odspCache.js +1 -2
  89. package/dist/odspCache.js.map +1 -1
  90. package/dist/odspDelayLoadedDeltaStream.d.ts +12 -6
  91. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  92. package/dist/odspDelayLoadedDeltaStream.js +89 -25
  93. package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
  94. package/dist/odspDeltaStorageService.d.ts +7 -7
  95. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  96. package/dist/odspDeltaStorageService.js +5 -5
  97. package/dist/odspDeltaStorageService.js.map +1 -1
  98. package/dist/odspDocumentDeltaConnection.d.ts +1 -1
  99. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  100. package/dist/odspDocumentDeltaConnection.js +41 -23
  101. package/dist/odspDocumentDeltaConnection.js.map +1 -1
  102. package/dist/odspDocumentService.d.ts +9 -6
  103. package/dist/odspDocumentService.d.ts.map +1 -1
  104. package/dist/odspDocumentService.js +25 -19
  105. package/dist/odspDocumentService.js.map +1 -1
  106. package/dist/odspDocumentServiceFactory.d.ts +6 -1
  107. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  108. package/dist/odspDocumentServiceFactory.js +9 -4
  109. package/dist/odspDocumentServiceFactory.js.map +1 -1
  110. package/dist/odspDocumentServiceFactoryCore.d.ts +4 -4
  111. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  112. package/dist/odspDocumentServiceFactoryCore.js +27 -30
  113. package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
  114. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +1 -1
  115. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
  116. package/dist/odspDocumentServiceFactoryWithCodeSplit.js +2 -2
  117. package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -1
  118. package/dist/odspDocumentStorageManager.d.ts +17 -10
  119. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  120. package/dist/odspDocumentStorageManager.js +226 -169
  121. package/dist/odspDocumentStorageManager.js.map +1 -1
  122. package/dist/odspDocumentStorageServiceBase.d.ts +4 -6
  123. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  124. package/dist/odspDocumentStorageServiceBase.js +34 -31
  125. package/dist/odspDocumentStorageServiceBase.js.map +1 -1
  126. package/dist/odspDriverUrlResolver.d.ts +1 -1
  127. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  128. package/dist/odspDriverUrlResolver.js +26 -32
  129. package/dist/odspDriverUrlResolver.js.map +1 -1
  130. package/dist/odspDriverUrlResolverForShareLink.d.ts +13 -6
  131. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  132. package/dist/odspDriverUrlResolverForShareLink.js +47 -37
  133. package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
  134. package/dist/odspError.d.ts +1 -1
  135. package/dist/odspError.d.ts.map +1 -1
  136. package/dist/odspError.js +6 -6
  137. package/dist/odspError.js.map +1 -1
  138. package/dist/odspFluidFileLink.d.ts +1 -1
  139. package/dist/odspFluidFileLink.d.ts.map +1 -1
  140. package/dist/odspFluidFileLink.js +2 -2
  141. package/dist/odspFluidFileLink.js.map +1 -1
  142. package/dist/odspLocationRedirection.js +2 -2
  143. package/dist/odspLocationRedirection.js.map +1 -1
  144. package/dist/odspPublicUtils.d.ts +4 -0
  145. package/dist/odspPublicUtils.d.ts.map +1 -1
  146. package/dist/odspPublicUtils.js +3 -0
  147. package/dist/odspPublicUtils.js.map +1 -1
  148. package/dist/odspSnapshotParser.d.ts +3 -3
  149. package/dist/odspSnapshotParser.d.ts.map +1 -1
  150. package/dist/odspSnapshotParser.js +5 -3
  151. package/dist/odspSnapshotParser.js.map +1 -1
  152. package/dist/odspSummaryUploadManager.d.ts +1 -1
  153. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  154. package/dist/odspSummaryUploadManager.js +9 -6
  155. package/dist/odspSummaryUploadManager.js.map +1 -1
  156. package/dist/odspUrlHelper.d.ts.map +1 -1
  157. package/dist/odspUrlHelper.js +1 -2
  158. package/dist/odspUrlHelper.js.map +1 -1
  159. package/dist/odspUtils.d.ts +29 -13
  160. package/dist/odspUtils.d.ts.map +1 -1
  161. package/dist/odspUtils.js +75 -41
  162. package/dist/odspUtils.js.map +1 -1
  163. package/dist/opsCaching.d.ts +1 -1
  164. package/dist/opsCaching.d.ts.map +1 -1
  165. package/dist/opsCaching.js +2 -1
  166. package/dist/opsCaching.js.map +1 -1
  167. package/dist/package.json +3 -0
  168. package/dist/packageVersion.d.ts +1 -1
  169. package/dist/packageVersion.js +1 -1
  170. package/dist/packageVersion.js.map +1 -1
  171. package/dist/prefetchLatestSnapshot.d.ts +2 -2
  172. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  173. package/dist/prefetchLatestSnapshot.js +17 -12
  174. package/dist/prefetchLatestSnapshot.js.map +1 -1
  175. package/dist/retryErrorsStorageAdapter.d.ts +2 -2
  176. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  177. package/dist/retryErrorsStorageAdapter.js +10 -5
  178. package/dist/retryErrorsStorageAdapter.js.map +1 -1
  179. package/dist/retryUtils.d.ts.map +1 -1
  180. package/dist/retryUtils.js +7 -3
  181. package/dist/retryUtils.js.map +1 -1
  182. package/dist/socketModule.d.ts.map +1 -1
  183. package/dist/socketModule.js +2 -0
  184. package/dist/socketModule.js.map +1 -1
  185. package/dist/tsdoc-metadata.json +1 -1
  186. package/dist/vroom.d.ts +2 -2
  187. package/dist/vroom.d.ts.map +1 -1
  188. package/dist/vroom.js +5 -5
  189. package/dist/vroom.js.map +1 -1
  190. package/dist/zipItDataRepresentationUtils.d.ts +1 -1
  191. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  192. package/dist/zipItDataRepresentationUtils.js +17 -13
  193. package/dist/zipItDataRepresentationUtils.js.map +1 -1
  194. package/lib/{ReadBufferUtils.d.mts → ReadBufferUtils.d.ts} +1 -1
  195. package/lib/ReadBufferUtils.d.ts.map +1 -0
  196. package/lib/{ReadBufferUtils.mjs → ReadBufferUtils.js} +1 -1
  197. package/lib/ReadBufferUtils.js.map +1 -0
  198. package/lib/{WriteBufferUtils.d.mts → WriteBufferUtils.d.ts} +2 -2
  199. package/lib/WriteBufferUtils.d.ts.map +1 -0
  200. package/lib/{WriteBufferUtils.mjs → WriteBufferUtils.js} +2 -2
  201. package/lib/WriteBufferUtils.js.map +1 -0
  202. package/lib/{checkUrl.d.mts → checkUrl.d.ts} +1 -1
  203. package/lib/checkUrl.d.ts.map +1 -0
  204. package/lib/{checkUrl.mjs → checkUrl.js} +5 -3
  205. package/lib/checkUrl.js.map +1 -0
  206. package/lib/{compactSnapshotParser.d.mts → compactSnapshotParser.d.ts} +3 -3
  207. package/lib/compactSnapshotParser.d.ts.map +1 -0
  208. package/lib/{compactSnapshotParser.mjs → compactSnapshotParser.js} +69 -50
  209. package/lib/compactSnapshotParser.js.map +1 -0
  210. package/lib/{compactSnapshotWriter.d.mts → compactSnapshotWriter.d.ts} +3 -3
  211. package/lib/compactSnapshotWriter.d.ts.map +1 -0
  212. package/lib/{compactSnapshotWriter.mjs → compactSnapshotWriter.js} +14 -8
  213. package/lib/compactSnapshotWriter.js.map +1 -0
  214. package/lib/{constants.d.mts → constants.d.ts} +1 -1
  215. package/lib/constants.d.ts.map +1 -0
  216. package/lib/{constants.mjs → constants.js} +1 -1
  217. package/lib/constants.js.map +1 -0
  218. package/lib/{contracts.d.mts → contracts.d.ts} +25 -5
  219. package/lib/contracts.d.ts.map +1 -0
  220. package/lib/contracts.js +10 -0
  221. package/lib/contracts.js.map +1 -0
  222. package/lib/{contractsPublic.d.mts → contractsPublic.d.ts} +1 -1
  223. package/lib/contractsPublic.d.ts.map +1 -0
  224. package/lib/{contractsPublic.mjs → contractsPublic.js} +1 -1
  225. package/lib/contractsPublic.js.map +1 -0
  226. package/lib/{createFile.d.mts → createFile.d.ts} +5 -5
  227. package/lib/createFile.d.ts.map +1 -0
  228. package/lib/{createFile.mjs → createFile.js} +25 -41
  229. package/lib/createFile.js.map +1 -0
  230. package/lib/{createNewContainerOnExistingFile.d.mts → createNewContainerOnExistingFile.d.ts} +3 -3
  231. package/lib/createNewContainerOnExistingFile.d.ts.map +1 -0
  232. package/lib/{createNewContainerOnExistingFile.mjs → createNewContainerOnExistingFile.js} +7 -7
  233. package/lib/createNewContainerOnExistingFile.js.map +1 -0
  234. package/lib/{createNewModule.mjs → createNewModule.d.ts} +3 -3
  235. package/lib/createNewModule.d.ts.map +1 -0
  236. package/lib/{createNewModule.d.mts → createNewModule.js} +3 -3
  237. package/lib/createNewModule.js.map +1 -0
  238. package/lib/{createNewUtils.d.mts → createNewUtils.d.ts} +5 -5
  239. package/lib/createNewUtils.d.ts.map +1 -0
  240. package/lib/{createNewUtils.mjs → createNewUtils.js} +13 -8
  241. package/lib/createNewUtils.js.map +1 -0
  242. package/lib/{createOdspCreateContainerRequest.d.mts → createOdspCreateContainerRequest.d.ts} +7 -3
  243. package/lib/createOdspCreateContainerRequest.d.ts.map +1 -0
  244. package/lib/{createOdspCreateContainerRequest.mjs → createOdspCreateContainerRequest.js} +2 -2
  245. package/lib/createOdspCreateContainerRequest.js.map +1 -0
  246. package/lib/{createOdspUrl.d.mts → createOdspUrl.d.ts} +2 -2
  247. package/lib/createOdspUrl.d.ts.map +1 -0
  248. package/lib/{createOdspUrl.mjs → createOdspUrl.js} +1 -1
  249. package/lib/createOdspUrl.js.map +1 -0
  250. package/lib/{epochTracker.d.mts → epochTracker.d.ts} +11 -10
  251. package/lib/epochTracker.d.ts.map +1 -0
  252. package/lib/{epochTracker.mjs → epochTracker.js} +58 -36
  253. package/lib/epochTracker.js.map +1 -0
  254. package/lib/{fetch.d.mts → fetch.d.ts} +1 -1
  255. package/lib/fetch.d.ts.map +1 -0
  256. package/lib/{fetch.mjs → fetch.js} +1 -1
  257. package/lib/fetch.js.map +1 -0
  258. package/lib/{fetchSnapshot.d.mts → fetchSnapshot.d.ts} +15 -12
  259. package/lib/fetchSnapshot.d.ts.map +1 -0
  260. package/lib/{fetchSnapshot.mjs → fetchSnapshot.js} +74 -54
  261. package/lib/fetchSnapshot.js.map +1 -0
  262. package/lib/{getFileLink.d.mts → getFileLink.d.ts} +1 -1
  263. package/lib/getFileLink.d.ts.map +1 -0
  264. package/lib/{getFileLink.mjs → getFileLink.js} +17 -10
  265. package/lib/getFileLink.js.map +1 -0
  266. package/lib/{getQueryString.d.mts → getQueryString.d.ts} +5 -1
  267. package/lib/getQueryString.d.ts.map +1 -0
  268. package/lib/{getQueryString.mjs → getQueryString.js} +3 -1
  269. package/lib/getQueryString.js.map +1 -0
  270. package/lib/{getUrlAndHeadersWithAuth.d.mts → getUrlAndHeadersWithAuth.d.ts} +1 -1
  271. package/lib/getUrlAndHeadersWithAuth.d.ts.map +1 -0
  272. package/lib/{getUrlAndHeadersWithAuth.mjs → getUrlAndHeadersWithAuth.js} +1 -1
  273. package/lib/getUrlAndHeadersWithAuth.js.map +1 -0
  274. package/lib/{index.d.mts → index.d.ts} +20 -20
  275. package/lib/index.d.ts.map +1 -0
  276. package/lib/index.js +29 -0
  277. package/lib/index.js.map +1 -0
  278. package/lib/localOdspDriver/{localOdspDeltaStorageService.d.mts → localOdspDeltaStorageService.d.ts} +1 -1
  279. package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
  280. package/lib/localOdspDriver/{localOdspDeltaStorageService.mjs → localOdspDeltaStorageService.js} +1 -1
  281. package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -0
  282. package/lib/localOdspDriver/{localOdspDocumentService.d.mts → localOdspDocumentService.d.ts} +5 -4
  283. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -0
  284. package/lib/localOdspDriver/{localOdspDocumentService.mjs → localOdspDocumentService.js} +7 -5
  285. package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -0
  286. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.mts → localOdspDocumentServiceFactory.d.ts} +9 -7
  287. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -0
  288. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.mjs → localOdspDocumentServiceFactory.js} +9 -8
  289. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -0
  290. package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.mts → localOdspDocumentStorageManager.d.ts} +4 -3
  291. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -0
  292. package/lib/localOdspDriver/{localOdspDocumentStorageManager.mjs → localOdspDocumentStorageManager.js} +7 -4
  293. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
  294. package/lib/{odsp-driver-alpha.d.mts → odsp-driver-alpha.d.ts} +31 -15
  295. package/lib/{odsp-driver-beta.d.mts → odsp-driver-beta.d.ts} +4 -5
  296. package/lib/{odsp-driver-public.d.mts → odsp-driver-public.d.ts} +4 -5
  297. package/lib/{odsp-driver-untrimmed.d.mts → odsp-driver-untrimmed.d.ts} +34 -16
  298. package/lib/{odspCache.d.mts → odspCache.d.ts} +10 -6
  299. package/lib/odspCache.d.ts.map +1 -0
  300. package/lib/{odspCache.mjs → odspCache.js} +6 -3
  301. package/lib/odspCache.js.map +1 -0
  302. package/lib/{odspDelayLoadedDeltaStream.d.mts → odspDelayLoadedDeltaStream.d.ts} +13 -7
  303. package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -0
  304. package/lib/{odspDelayLoadedDeltaStream.mjs → odspDelayLoadedDeltaStream.js} +84 -20
  305. package/lib/odspDelayLoadedDeltaStream.js.map +1 -0
  306. package/lib/{odspDeltaStorageService.d.mts → odspDeltaStorageService.d.ts} +8 -8
  307. package/lib/odspDeltaStorageService.d.ts.map +1 -0
  308. package/lib/{odspDeltaStorageService.mjs → odspDeltaStorageService.js} +5 -5
  309. package/lib/odspDeltaStorageService.js.map +1 -0
  310. package/lib/{odspDocumentDeltaConnection.d.mts → odspDocumentDeltaConnection.d.ts} +2 -2
  311. package/lib/odspDocumentDeltaConnection.d.ts.map +1 -0
  312. package/lib/{odspDocumentDeltaConnection.mjs → odspDocumentDeltaConnection.js} +34 -16
  313. package/lib/odspDocumentDeltaConnection.js.map +1 -0
  314. package/lib/{odspDocumentService.d.mts → odspDocumentService.d.ts} +10 -7
  315. package/lib/odspDocumentService.d.ts.map +1 -0
  316. package/lib/{odspDocumentService.mjs → odspDocumentService.js} +22 -14
  317. package/lib/odspDocumentService.js.map +1 -0
  318. package/lib/{odspDocumentServiceFactory.d.mts → odspDocumentServiceFactory.d.ts} +7 -2
  319. package/lib/odspDocumentServiceFactory.d.ts.map +1 -0
  320. package/lib/{odspDocumentServiceFactory.mjs → odspDocumentServiceFactory.js} +9 -3
  321. package/lib/odspDocumentServiceFactory.js.map +1 -0
  322. package/lib/{odspDocumentServiceFactoryCore.d.mts → odspDocumentServiceFactoryCore.d.ts} +5 -5
  323. package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -0
  324. package/lib/{odspDocumentServiceFactoryCore.mjs → odspDocumentServiceFactoryCore.js} +25 -26
  325. package/lib/odspDocumentServiceFactoryCore.js.map +1 -0
  326. package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.mts → odspDocumentServiceFactoryWithCodeSplit.d.ts} +2 -2
  327. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -0
  328. package/lib/{odspDocumentServiceFactoryWithCodeSplit.mjs → odspDocumentServiceFactoryWithCodeSplit.js} +2 -2
  329. package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -0
  330. package/lib/{odspDocumentStorageManager.d.mts → odspDocumentStorageManager.d.ts} +18 -11
  331. package/lib/odspDocumentStorageManager.d.ts.map +1 -0
  332. package/lib/{odspDocumentStorageManager.mjs → odspDocumentStorageManager.js} +221 -162
  333. package/lib/odspDocumentStorageManager.js.map +1 -0
  334. package/lib/{odspDocumentStorageServiceBase.d.mts → odspDocumentStorageServiceBase.d.ts} +5 -7
  335. package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -0
  336. package/lib/{odspDocumentStorageServiceBase.mjs → odspDocumentStorageServiceBase.js} +34 -31
  337. package/lib/odspDocumentStorageServiceBase.js.map +1 -0
  338. package/lib/{odspDriverUrlResolver.d.mts → odspDriverUrlResolver.d.ts} +2 -2
  339. package/lib/odspDriverUrlResolver.d.ts.map +1 -0
  340. package/lib/{odspDriverUrlResolver.mjs → odspDriverUrlResolver.js} +27 -29
  341. package/lib/odspDriverUrlResolver.js.map +1 -0
  342. package/lib/{odspDriverUrlResolverForShareLink.d.mts → odspDriverUrlResolverForShareLink.d.ts} +14 -7
  343. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -0
  344. package/lib/{odspDriverUrlResolverForShareLink.mjs → odspDriverUrlResolverForShareLink.js} +41 -27
  345. package/lib/odspDriverUrlResolverForShareLink.js.map +1 -0
  346. package/lib/{odspError.d.mts → odspError.d.ts} +2 -2
  347. package/lib/odspError.d.ts.map +1 -0
  348. package/lib/{odspError.mjs → odspError.js} +6 -6
  349. package/lib/odspError.js.map +1 -0
  350. package/lib/{odspFluidFileLink.d.mts → odspFluidFileLink.d.ts} +2 -2
  351. package/lib/odspFluidFileLink.d.ts.map +1 -0
  352. package/lib/{odspFluidFileLink.mjs → odspFluidFileLink.js} +2 -2
  353. package/lib/odspFluidFileLink.js.map +1 -0
  354. package/lib/{odspLocationRedirection.d.mts → odspLocationRedirection.d.ts} +1 -1
  355. package/lib/odspLocationRedirection.d.ts.map +1 -0
  356. package/lib/{odspLocationRedirection.mjs → odspLocationRedirection.js} +2 -2
  357. package/lib/odspLocationRedirection.js.map +1 -0
  358. package/lib/{odspPublicUtils.d.mts → odspPublicUtils.d.ts} +5 -1
  359. package/lib/odspPublicUtils.d.ts.map +1 -0
  360. package/lib/{odspPublicUtils.mjs → odspPublicUtils.js} +4 -1
  361. package/lib/odspPublicUtils.js.map +1 -0
  362. package/lib/{odspSnapshotParser.d.mts → odspSnapshotParser.d.ts} +4 -4
  363. package/lib/odspSnapshotParser.d.ts.map +1 -0
  364. package/lib/{odspSnapshotParser.mjs → odspSnapshotParser.js} +6 -4
  365. package/lib/odspSnapshotParser.js.map +1 -0
  366. package/lib/{odspSummaryUploadManager.d.mts → odspSummaryUploadManager.d.ts} +2 -2
  367. package/lib/odspSummaryUploadManager.d.ts.map +1 -0
  368. package/lib/{odspSummaryUploadManager.mjs → odspSummaryUploadManager.js} +8 -5
  369. package/lib/odspSummaryUploadManager.js.map +1 -0
  370. package/lib/{odspUrlHelper.d.mts → odspUrlHelper.d.ts} +1 -1
  371. package/lib/odspUrlHelper.d.ts.map +1 -0
  372. package/lib/{odspUrlHelper.mjs → odspUrlHelper.js} +2 -3
  373. package/lib/odspUrlHelper.js.map +1 -0
  374. package/lib/{odspUtils.d.mts → odspUtils.d.ts} +30 -14
  375. package/lib/odspUtils.d.ts.map +1 -0
  376. package/lib/{odspUtils.mjs → odspUtils.js} +61 -30
  377. package/lib/odspUtils.js.map +1 -0
  378. package/lib/{opsCaching.d.mts → opsCaching.d.ts} +2 -2
  379. package/lib/opsCaching.d.ts.map +1 -0
  380. package/lib/{opsCaching.mjs → opsCaching.js} +3 -2
  381. package/lib/opsCaching.js.map +1 -0
  382. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  383. package/lib/packageVersion.d.ts.map +1 -0
  384. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  385. package/lib/packageVersion.js.map +1 -0
  386. package/lib/{prefetchLatestSnapshot.d.mts → prefetchLatestSnapshot.d.ts} +3 -3
  387. package/lib/prefetchLatestSnapshot.d.ts.map +1 -0
  388. package/lib/{prefetchLatestSnapshot.mjs → prefetchLatestSnapshot.js} +16 -11
  389. package/lib/prefetchLatestSnapshot.js.map +1 -0
  390. package/lib/{retryErrorsStorageAdapter.d.mts → retryErrorsStorageAdapter.d.ts} +3 -3
  391. package/lib/retryErrorsStorageAdapter.d.ts.map +1 -0
  392. package/lib/{retryErrorsStorageAdapter.mjs → retryErrorsStorageAdapter.js} +11 -6
  393. package/lib/retryErrorsStorageAdapter.js.map +1 -0
  394. package/lib/{retryUtils.d.mts → retryUtils.d.ts} +1 -1
  395. package/lib/retryUtils.d.ts.map +1 -0
  396. package/lib/{retryUtils.mjs → retryUtils.js} +8 -4
  397. package/lib/retryUtils.js.map +1 -0
  398. package/lib/{socketModule.d.mts → socketModule.d.ts} +1 -1
  399. package/lib/socketModule.d.ts.map +1 -0
  400. package/lib/{socketModule.mjs → socketModule.js} +3 -1
  401. package/lib/socketModule.js.map +1 -0
  402. package/lib/test/buildOdspShareLinkReqParams.spec.js +25 -0
  403. package/lib/test/buildOdspShareLinkReqParams.spec.js.map +1 -0
  404. package/lib/test/createNewUtilsTests.spec.js +221 -0
  405. package/lib/test/createNewUtilsTests.spec.js.map +1 -0
  406. package/lib/test/deltaStorageService.spec.js +176 -0
  407. package/lib/test/deltaStorageService.spec.js.map +1 -0
  408. package/lib/test/epochTests.spec.js +340 -0
  409. package/lib/test/epochTests.spec.js.map +1 -0
  410. package/lib/test/epochTestsWithRedemption.spec.js +119 -0
  411. package/lib/test/epochTestsWithRedemption.spec.js.map +1 -0
  412. package/lib/test/fetchSnapshot.spec.js +412 -0
  413. package/lib/test/fetchSnapshot.spec.js.map +1 -0
  414. package/lib/test/getFileLink.spec.js +62 -0
  415. package/lib/test/getFileLink.spec.js.map +1 -0
  416. package/lib/test/getUrlAndHeadersWithAuth.spec.js +66 -0
  417. package/lib/test/getUrlAndHeadersWithAuth.spec.js.map +1 -0
  418. package/lib/test/getVersions.spec.js +284 -0
  419. package/lib/test/getVersions.spec.js.map +1 -0
  420. package/lib/test/joinSessionCacheTests.spec.js +53 -0
  421. package/lib/test/joinSessionCacheTests.spec.js.map +1 -0
  422. package/lib/test/joinSessionPeriodicCall.spec.js +158 -0
  423. package/lib/test/joinSessionPeriodicCall.spec.js.map +1 -0
  424. package/lib/test/jsonSnapshotFormatTests.spec.js +107 -0
  425. package/lib/test/jsonSnapshotFormatTests.spec.js.map +1 -0
  426. package/lib/test/localOdspDriver.spec.js +177 -0
  427. package/lib/test/localOdspDriver.spec.js.map +1 -0
  428. package/lib/test/mockFetch.js +61 -0
  429. package/lib/test/mockFetch.js.map +1 -0
  430. package/lib/test/odspCreateContainer.spec.js +116 -0
  431. package/lib/test/odspCreateContainer.spec.js.map +1 -0
  432. package/lib/test/odspDriverResolverTest.spec.js +289 -0
  433. package/lib/test/odspDriverResolverTest.spec.js.map +1 -0
  434. package/lib/test/odspDriverUrlResolverForShareLink.spec.js +287 -0
  435. package/lib/test/odspDriverUrlResolverForShareLink.spec.js.map +1 -0
  436. package/lib/test/odspError.spec.js +299 -0
  437. package/lib/test/odspError.spec.js.map +1 -0
  438. package/lib/test/opsCaching.spec.js +357 -0
  439. package/lib/test/opsCaching.spec.js.map +1 -0
  440. package/lib/test/prefetchSnapshotTests.spec.js +420 -0
  441. package/lib/test/prefetchSnapshotTests.spec.js.map +1 -0
  442. package/lib/test/snapshotFormatTests.spec.js +218 -0
  443. package/lib/test/snapshotFormatTests.spec.js.map +1 -0
  444. package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js +152 -0
  445. package/lib/test/socketTests/deltaConnectionUpdateTests.spec.js.map +1 -0
  446. package/lib/test/socketTests/socketMock.js +109 -0
  447. package/lib/test/socketTests/socketMock.js.map +1 -0
  448. package/lib/test/socketTests/socketTests.spec.js +256 -0
  449. package/lib/test/socketTests/socketTests.spec.js.map +1 -0
  450. package/lib/test/tokenFetch.spec.js +39 -0
  451. package/lib/test/tokenFetch.spec.js.map +1 -0
  452. package/lib/test/types/validateOdspDriverPrevious.generated.js +96 -0
  453. package/lib/test/types/validateOdspDriverPrevious.generated.js.map +1 -0
  454. package/lib/test/zipItDataRepresentationTests.spec.js +207 -0
  455. package/lib/test/zipItDataRepresentationTests.spec.js.map +1 -0
  456. package/lib/{vroom.d.mts → vroom.d.ts} +3 -3
  457. package/lib/vroom.d.ts.map +1 -0
  458. package/lib/{vroom.mjs → vroom.js} +4 -4
  459. package/lib/vroom.js.map +1 -0
  460. package/lib/{zipItDataRepresentationUtils.d.mts → zipItDataRepresentationUtils.d.ts} +2 -2
  461. package/lib/zipItDataRepresentationUtils.d.ts.map +1 -0
  462. package/lib/{zipItDataRepresentationUtils.mjs → zipItDataRepresentationUtils.js} +19 -11
  463. package/lib/zipItDataRepresentationUtils.js.map +1 -0
  464. package/package.json +100 -32
  465. package/src/ReadBufferUtils.ts +7 -7
  466. package/src/WriteBufferUtils.ts +13 -9
  467. package/src/checkUrl.ts +4 -2
  468. package/src/compactSnapshotParser.ts +97 -61
  469. package/src/compactSnapshotWriter.ts +22 -15
  470. package/src/contracts.ts +33 -4
  471. package/src/createFile.ts +26 -51
  472. package/src/createNewContainerOnExistingFile.ts +10 -10
  473. package/src/createNewModule.ts +2 -2
  474. package/src/createNewUtils.ts +26 -15
  475. package/src/createOdspCreateContainerRequest.ts +3 -3
  476. package/src/createOdspUrl.ts +1 -1
  477. package/src/epochTracker.ts +93 -58
  478. package/src/fetchSnapshot.ts +122 -66
  479. package/src/getFileLink.ts +24 -16
  480. package/src/getQueryString.ts +2 -0
  481. package/src/index.ts +27 -19
  482. package/src/localOdspDriver/localOdspDocumentService.ts +12 -5
  483. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +12 -11
  484. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +15 -8
  485. package/src/odspCache.ts +14 -11
  486. package/src/odspDelayLoadedDeltaStream.ts +113 -31
  487. package/src/odspDeltaStorageService.ts +17 -16
  488. package/src/odspDocumentDeltaConnection.ts +52 -34
  489. package/src/odspDocumentService.ts +33 -22
  490. package/src/odspDocumentServiceFactory.ts +7 -2
  491. package/src/odspDocumentServiceFactoryCore.ts +28 -29
  492. package/src/odspDocumentServiceFactoryWithCodeSplit.ts +1 -1
  493. package/src/odspDocumentStorageManager.ts +303 -210
  494. package/src/odspDocumentStorageServiceBase.ts +52 -47
  495. package/src/odspDriverUrlResolver.ts +41 -41
  496. package/src/odspDriverUrlResolverForShareLink.ts +50 -31
  497. package/src/odspError.ts +6 -7
  498. package/src/odspFluidFileLink.ts +3 -3
  499. package/src/odspLocationRedirection.ts +1 -1
  500. package/src/odspPublicUtils.ts +4 -0
  501. package/src/odspSnapshotParser.ts +9 -9
  502. package/src/odspSummaryUploadManager.ts +21 -9
  503. package/src/odspUrlHelper.ts +2 -3
  504. package/src/odspUtils.ts +102 -53
  505. package/src/opsCaching.ts +13 -12
  506. package/src/packageVersion.ts +1 -1
  507. package/src/prefetchLatestSnapshot.ts +24 -15
  508. package/src/retryErrorsStorageAdapter.ts +16 -9
  509. package/src/retryUtils.ts +8 -4
  510. package/src/socketModule.ts +2 -0
  511. package/src/vroom.ts +6 -6
  512. package/src/zipItDataRepresentationUtils.ts +65 -37
  513. package/tsconfig.cjs.json +7 -0
  514. package/tsconfig.json +2 -5
  515. package/.eslintrc.js +0 -18
  516. package/lib/ReadBufferUtils.d.mts.map +0 -1
  517. package/lib/ReadBufferUtils.mjs.map +0 -1
  518. package/lib/WriteBufferUtils.d.mts.map +0 -1
  519. package/lib/WriteBufferUtils.mjs.map +0 -1
  520. package/lib/checkUrl.d.mts.map +0 -1
  521. package/lib/checkUrl.mjs.map +0 -1
  522. package/lib/compactSnapshotParser.d.mts.map +0 -1
  523. package/lib/compactSnapshotParser.mjs.map +0 -1
  524. package/lib/compactSnapshotWriter.d.mts.map +0 -1
  525. package/lib/compactSnapshotWriter.mjs.map +0 -1
  526. package/lib/constants.d.mts.map +0 -1
  527. package/lib/constants.mjs.map +0 -1
  528. package/lib/contracts.d.mts.map +0 -1
  529. package/lib/contracts.mjs +0 -6
  530. package/lib/contracts.mjs.map +0 -1
  531. package/lib/contractsPublic.d.mts.map +0 -1
  532. package/lib/contractsPublic.mjs.map +0 -1
  533. package/lib/createFile.d.mts.map +0 -1
  534. package/lib/createFile.mjs.map +0 -1
  535. package/lib/createNewContainerOnExistingFile.d.mts.map +0 -1
  536. package/lib/createNewContainerOnExistingFile.mjs.map +0 -1
  537. package/lib/createNewModule.d.mts.map +0 -1
  538. package/lib/createNewModule.mjs.map +0 -1
  539. package/lib/createNewUtils.d.mts.map +0 -1
  540. package/lib/createNewUtils.mjs.map +0 -1
  541. package/lib/createOdspCreateContainerRequest.d.mts.map +0 -1
  542. package/lib/createOdspCreateContainerRequest.mjs.map +0 -1
  543. package/lib/createOdspUrl.d.mts.map +0 -1
  544. package/lib/createOdspUrl.mjs.map +0 -1
  545. package/lib/epochTracker.d.mts.map +0 -1
  546. package/lib/epochTracker.mjs.map +0 -1
  547. package/lib/fetch.d.mts.map +0 -1
  548. package/lib/fetch.mjs.map +0 -1
  549. package/lib/fetchSnapshot.d.mts.map +0 -1
  550. package/lib/fetchSnapshot.mjs.map +0 -1
  551. package/lib/getFileLink.d.mts.map +0 -1
  552. package/lib/getFileLink.mjs.map +0 -1
  553. package/lib/getQueryString.d.mts.map +0 -1
  554. package/lib/getQueryString.mjs.map +0 -1
  555. package/lib/getUrlAndHeadersWithAuth.d.mts.map +0 -1
  556. package/lib/getUrlAndHeadersWithAuth.mjs.map +0 -1
  557. package/lib/index.d.mts.map +0 -1
  558. package/lib/index.mjs +0 -22
  559. package/lib/index.mjs.map +0 -1
  560. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +0 -1
  561. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +0 -1
  562. package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +0 -1
  563. package/lib/localOdspDriver/localOdspDocumentService.mjs.map +0 -1
  564. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +0 -1
  565. package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +0 -1
  566. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +0 -1
  567. package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +0 -1
  568. package/lib/odspCache.d.mts.map +0 -1
  569. package/lib/odspCache.mjs.map +0 -1
  570. package/lib/odspDelayLoadedDeltaStream.d.mts.map +0 -1
  571. package/lib/odspDelayLoadedDeltaStream.mjs.map +0 -1
  572. package/lib/odspDeltaStorageService.d.mts.map +0 -1
  573. package/lib/odspDeltaStorageService.mjs.map +0 -1
  574. package/lib/odspDocumentDeltaConnection.d.mts.map +0 -1
  575. package/lib/odspDocumentDeltaConnection.mjs.map +0 -1
  576. package/lib/odspDocumentService.d.mts.map +0 -1
  577. package/lib/odspDocumentService.mjs.map +0 -1
  578. package/lib/odspDocumentServiceFactory.d.mts.map +0 -1
  579. package/lib/odspDocumentServiceFactory.mjs.map +0 -1
  580. package/lib/odspDocumentServiceFactoryCore.d.mts.map +0 -1
  581. package/lib/odspDocumentServiceFactoryCore.mjs.map +0 -1
  582. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +0 -1
  583. package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +0 -1
  584. package/lib/odspDocumentStorageManager.d.mts.map +0 -1
  585. package/lib/odspDocumentStorageManager.mjs.map +0 -1
  586. package/lib/odspDocumentStorageServiceBase.d.mts.map +0 -1
  587. package/lib/odspDocumentStorageServiceBase.mjs.map +0 -1
  588. package/lib/odspDriverUrlResolver.d.mts.map +0 -1
  589. package/lib/odspDriverUrlResolver.mjs.map +0 -1
  590. package/lib/odspDriverUrlResolverForShareLink.d.mts.map +0 -1
  591. package/lib/odspDriverUrlResolverForShareLink.mjs.map +0 -1
  592. package/lib/odspError.d.mts.map +0 -1
  593. package/lib/odspError.mjs.map +0 -1
  594. package/lib/odspFluidFileLink.d.mts.map +0 -1
  595. package/lib/odspFluidFileLink.mjs.map +0 -1
  596. package/lib/odspLocationRedirection.d.mts.map +0 -1
  597. package/lib/odspLocationRedirection.mjs.map +0 -1
  598. package/lib/odspPublicUtils.d.mts.map +0 -1
  599. package/lib/odspPublicUtils.mjs.map +0 -1
  600. package/lib/odspSnapshotParser.d.mts.map +0 -1
  601. package/lib/odspSnapshotParser.mjs.map +0 -1
  602. package/lib/odspSummaryUploadManager.d.mts.map +0 -1
  603. package/lib/odspSummaryUploadManager.mjs.map +0 -1
  604. package/lib/odspUrlHelper.d.mts.map +0 -1
  605. package/lib/odspUrlHelper.mjs.map +0 -1
  606. package/lib/odspUtils.d.mts.map +0 -1
  607. package/lib/odspUtils.mjs.map +0 -1
  608. package/lib/opsCaching.d.mts.map +0 -1
  609. package/lib/opsCaching.mjs.map +0 -1
  610. package/lib/packageVersion.d.mts.map +0 -1
  611. package/lib/packageVersion.mjs.map +0 -1
  612. package/lib/prefetchLatestSnapshot.d.mts.map +0 -1
  613. package/lib/prefetchLatestSnapshot.mjs.map +0 -1
  614. package/lib/retryErrorsStorageAdapter.d.mts.map +0 -1
  615. package/lib/retryErrorsStorageAdapter.mjs.map +0 -1
  616. package/lib/retryUtils.d.mts.map +0 -1
  617. package/lib/retryUtils.mjs.map +0 -1
  618. package/lib/socketModule.d.mts.map +0 -1
  619. package/lib/socketModule.mjs.map +0 -1
  620. package/lib/vroom.d.mts.map +0 -1
  621. package/lib/vroom.mjs.map +0 -1
  622. package/lib/zipItDataRepresentationUtils.d.mts.map +0 -1
  623. package/lib/zipItDataRepresentationUtils.mjs.map +0 -1
@@ -1,10 +1,16 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
1
5
  import { PromiseCache } from "@fluidframework/core-utils";
2
- import { getLocatorFromOdspUrl, storeLocatorInOdspUrl, encodeOdspFluidDataStoreLocator, locatorQueryParamName, } from "./odspFluidFileLink.mjs";
3
- import { SharingLinkHeader } from "./contractsPublic.mjs";
4
- import { createOdspUrl } from "./createOdspUrl.mjs";
5
- import { OdspDriverUrlResolver } from "./odspDriverUrlResolver.mjs";
6
- import { getOdspResolvedUrl, createOdspLogger } from "./odspUtils.mjs";
7
- import { getFileLink } from "./getFileLink.mjs";
6
+ import { getLocatorFromOdspUrl, storeLocatorInOdspUrl, locatorQueryParamName, } from "./odspFluidFileLink.js";
7
+ import { SharingLinkHeader } from "./contractsPublic.js";
8
+ import { createOdspUrl } from "./createOdspUrl.js";
9
+ import { OdspDriverUrlResolver } from "./odspDriverUrlResolver.js";
10
+ import { getOdspResolvedUrl, createOdspLogger } from "./odspUtils.js";
11
+ import { getFileLink } from "./getFileLink.js";
12
+ // back-compat: GitHub #9653
13
+ const isFluidPackage = (pkg) => typeof pkg === "object" && typeof pkg?.name === "string" && typeof pkg?.fluid === "object";
8
14
  /**
9
15
  * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner
10
16
  * url format and the ones which have things like driveId, siteId, itemId etc encoded in nav param.
@@ -49,9 +55,9 @@ export class OdspDriverUrlResolverForShareLink {
49
55
  // Determine if the caller is passing a query parameter or path since processing will be different.
50
56
  if (pathToAppend.startsWith("/?") || pathToAppend.startsWith("?")) {
51
57
  const queryParams = new URLSearchParams(pathToAppend);
52
- queryParams.forEach((value, key) => {
58
+ for (const [key, value] of queryParams.entries()) {
53
59
  parsingUrl.searchParams.append(key, value);
54
- });
60
+ }
55
61
  fluidInfo.dataStorePath = `${parsingUrl.pathname}${parsingUrl.search}`;
56
62
  }
57
63
  else {
@@ -136,31 +142,46 @@ export class OdspDriverUrlResolverForShareLink {
136
142
  async getAbsoluteUrl(resolvedUrl, dataStorePath, packageInfoSource) {
137
143
  const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);
138
144
  const shareLink = await this.getShareLinkPromise(odspResolvedUrl);
139
- const shareLinkUrl = new URL(shareLink);
140
- let actualDataStorePath = dataStorePath;
145
+ return this.appendLocatorParams(shareLink, resolvedUrl, dataStorePath, packageInfoSource);
146
+ }
147
+ /**
148
+ * Appends the store locator properties to the provided base URL. This function is useful for scenarios where an application
149
+ * has a base URL (for example a sharing link) of the Fluid file, but does not have the locator information that would be used by Fluid
150
+ * to load the file later.
151
+ * @param baseUrl - The input URL on which the locator params will be appended.
152
+ * @param resolvedUrl - odsp-driver's resolvedURL object.
153
+ * @param dataStorePath - The relative data store path URL.
154
+ * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath
155
+ * will be extracted from the resolved url if present.
156
+ * @returns The provided base URL appended with odsp-specific locator information
157
+ */
158
+ async appendLocatorParams(baseUrl, resolvedUrl, dataStorePath, packageInfoSource) {
159
+ const url = new URL(baseUrl);
160
+ const odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);
141
161
  // If the user has passed an empty dataStorePath, then extract it from the resolved url.
142
- if (dataStorePath === "" && odspResolvedUrl.dataStorePath !== undefined) {
143
- actualDataStorePath = odspResolvedUrl.dataStorePath;
144
- }
145
- // back-compat: GitHub #9653
146
- const isFluidPackage = (pkg) => typeof pkg === "object" &&
147
- typeof pkg?.name === "string" &&
148
- typeof pkg?.fluid === "object";
162
+ const actualDataStorePath = dataStorePath || (odspResolvedUrl.dataStorePath ?? "");
149
163
  let containerPackageName;
150
164
  if (packageInfoSource && "name" in packageInfoSource) {
151
165
  containerPackageName = packageInfoSource.name;
152
166
  // packageInfoSource is cast to any as it is typed to IContainerPackageInfo instead of IFluidCodeDetails
167
+ // TODO: use a stronger type
168
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
153
169
  }
154
170
  else if (isFluidPackage(packageInfoSource?.package)) {
171
+ // TODO: use a stronger type
172
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
155
173
  containerPackageName = packageInfoSource?.package.name;
156
174
  }
157
175
  else {
176
+ // TODO: use a stronger type
177
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
158
178
  containerPackageName = packageInfoSource?.package;
159
179
  }
180
+ // TODO: use a stronger type
160
181
  containerPackageName =
161
182
  containerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName;
162
183
  const context = await this.getContext?.(odspResolvedUrl, actualDataStorePath);
163
- storeLocatorInOdspUrl(shareLinkUrl, {
184
+ storeLocatorInOdspUrl(url, {
164
185
  siteUrl: odspResolvedUrl.siteUrl,
165
186
  driveId: odspResolvedUrl.driveId,
166
187
  itemId: odspResolvedUrl.itemId,
@@ -170,7 +191,7 @@ export class OdspDriverUrlResolverForShareLink {
170
191
  fileVersion: odspResolvedUrl.fileVersion,
171
192
  context,
172
193
  });
173
- return shareLinkUrl.href;
194
+ return url.href;
174
195
  }
175
196
  /**
176
197
  * Crafts a supported document/driver URL
@@ -180,12 +201,5 @@ export class OdspDriverUrlResolverForShareLink {
180
201
  storeLocatorInOdspUrl(url, driverInfo);
181
202
  return url.href;
182
203
  }
183
- /**
184
- * Crafts a supported data store nav param
185
- * @deprecated encodeOdspFluidDataStoreLocator should be used instead
186
- */
187
- static createNavParam(locator) {
188
- return encodeOdspFluidDataStoreLocator(locator);
189
- }
190
204
  }
191
- //# sourceMappingURL=odspDriverUrlResolverForShareLink.mjs.map
205
+ //# sourceMappingURL=odspDriverUrlResolverForShareLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspDriverUrlResolverForShareLink.js","sourceRoot":"","sources":["../src/odspDriverUrlResolverForShareLink.ts"],"names":[],"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AAO,EAAE,IAAI,CAAC,OAAO;YACrB,oBAAoB;YACpB,WAAW,EAAE,eAAe,CAAC,WAAW;YACxC,OAAO;SACP,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC,IAAI,CAAC;IACjB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,iBAAiB,CAC9B,OAAe,EACf,UAAqC;QAErC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAE7B,qBAAqB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QAEvC,OAAO,GAAG,CAAC,IAAI,CAAC;IACjB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { PromiseCache } from \"@fluidframework/core-utils\";\nimport { ITelemetryBaseLogger, IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tIContainerPackageInfo,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIOdspResolvedUrl,\n\tIdentityType,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport {\n\tgetLocatorFromOdspUrl,\n\tstoreLocatorInOdspUrl,\n\tlocatorQueryParamName,\n} from \"./odspFluidFileLink.js\";\nimport { OdspFluidDataStoreLocator, SharingLinkHeader } from \"./contractsPublic.js\";\nimport { createOdspUrl } from \"./createOdspUrl.js\";\nimport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver.js\";\nimport { getOdspResolvedUrl, createOdspLogger } from \"./odspUtils.js\";\nimport { getFileLink } from \"./getFileLink.js\";\n\n/**\n * Properties passed to the code responsible for fetching share link for a file.\n * @alpha\n */\nexport interface ShareLinkFetcherProps {\n\t/**\n\t * Callback method that is used to fetch access token necessary to call API that produces share link\n\t */\n\ttokenFetcher: TokenFetcher<OdspResourceTokenFetchOptions>;\n\t/**\n\t * Identity type determining the shape of share link as it differs for Enterprise and Consumer users.\n\t */\n\tidentityType: IdentityType;\n}\n\n// back-compat: GitHub #9653\nconst isFluidPackage = (pkg: Record<string, unknown>): boolean =>\n\ttypeof pkg === \"object\" && typeof pkg?.name === \"string\" && typeof pkg?.fluid === \"object\";\n\n/**\n * Resolver to resolve urls like the ones created by createOdspUrl which is driver inner\n * url format and the ones which have things like driveId, siteId, itemId etc encoded in nav param.\n * This resolver also handles share links and try to generate one for the use by the app.\n * @alpha\n */\nexport class OdspDriverUrlResolverForShareLink implements IUrlResolver {\n\tprivate readonly logger: ITelemetryLoggerExt;\n\tprivate readonly sharingLinkCache = new PromiseCache<string, string>();\n\tprivate readonly shareLinkFetcherProps: ShareLinkFetcherProps | undefined;\n\n\t/**\n\t * Creates url resolver instance\n\t * @param shareLinkFetcherProps - properties used when fetching share link.\n\t * Can be set as 'undefined' for cases where share link is not needed. Currently, only\n\t * getAbsoluteUrl() method requires share link.\n\t * @param logger - logger object that is used as telemetry sink\n\t * @param appName - application name hint that is encoded with url produced by getAbsoluteUrl() method.\n\t * This hint is used by link handling logic which determines which app to redirect to when user\n\t * navigates directly to the link.\n\t * @param getContext - callback function which is used to get context for given resolved url. If context\n\t * is returned then it will be embedded into url returned by getAbsoluteUrl() method.\n\t */\n\tpublic constructor(\n\t\tshareLinkFetcherProps?: ShareLinkFetcherProps | undefined,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tprivate readonly appName?: string,\n\t\tprivate readonly getContext?: (\n\t\t\tresolvedUrl: IOdspResolvedUrl,\n\t\t\tdataStorePath: string,\n\t\t) => Promise<string | undefined>,\n\t) {\n\t\tthis.logger = createOdspLogger(logger);\n\t\tif (shareLinkFetcherProps) {\n\t\t\tthis.shareLinkFetcherProps = {\n\t\t\t\t...shareLinkFetcherProps,\n\t\t\t\ttokenFetcher: shareLinkFetcherProps.tokenFetcher,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Takes an already generated data store url (from requestUrl) and appends a path to the\n\t * existing data store information.\n\t */\n\tpublic appendDataStorePath(requestUrl: URL, pathToAppend: string): string | undefined {\n\t\tconst fluidInfo = getLocatorFromOdspUrl(requestUrl);\n\n\t\tif (!fluidInfo) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst parsingUrl = new URL(\n\t\t\tfluidInfo.dataStorePath,\n\t\t\t`${requestUrl.protocol}//${requestUrl.hostname}`,\n\t\t);\n\t\t// Determine if the caller is passing a query parameter or path since processing will be different.\n\t\tif (pathToAppend.startsWith(\"/?\") || pathToAppend.startsWith(\"?\")) {\n\t\t\tconst queryParams = new URLSearchParams(pathToAppend);\n\t\t\tfor (const [key, value] of queryParams.entries()) {\n\t\t\t\tparsingUrl.searchParams.append(key, value);\n\t\t\t}\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${parsingUrl.search}`;\n\t\t} else {\n\t\t\tfluidInfo.dataStorePath = `${parsingUrl.pathname}${\n\t\t\t\tparsingUrl.pathname.endsWith(\"/\") || pathToAppend.startsWith(\"/\") ? \"\" : \"/\"\n\t\t\t}${pathToAppend}/${parsingUrl.search}`;\n\t\t}\n\t\tstoreLocatorInOdspUrl(requestUrl, fluidInfo);\n\n\t\treturn requestUrl.href;\n\t}\n\n\tprivate getKey(resolvedUrl: IOdspResolvedUrl): string {\n\t\treturn `${resolvedUrl.siteUrl},${resolvedUrl.driveId},${resolvedUrl.itemId}`;\n\t}\n\n\t/**\n\t * Resolves request URL into driver details\n\t */\n\tpublic async resolve(request: IRequest): Promise<IOdspResolvedUrl> {\n\t\tconst requestToBeResolved = { headers: request.headers, url: request.url };\n\t\tconst isSharingLinkToRedeem =\n\t\t\trequestToBeResolved.headers?.[SharingLinkHeader.isSharingLinkToRedeem];\n\t\ttry {\n\t\t\tconst url = new URL(request.url);\n\n\t\t\tconst odspFluidInfo = getLocatorFromOdspUrl(url);\n\t\t\tif (odspFluidInfo) {\n\t\t\t\trequestToBeResolved.url = createOdspUrl(odspFluidInfo);\n\t\t\t}\n\t\t} catch {\n\t\t\t// If the locator throws some error, then try to resolve the request as it is.\n\t\t}\n\n\t\tconst odspResolvedUrl = await new OdspDriverUrlResolver().resolve(requestToBeResolved);\n\n\t\tif (isSharingLinkToRedeem) {\n\t\t\t// We need to remove the nav param if set by host when setting the sharelink as otherwise the shareLinkId\n\t\t\t// when redeeming the share link during the redeem fallback for trees latest call becomes greater than\n\t\t\t// the eligible length.\n\t\t\todspResolvedUrl.shareLinkInfo = Object.assign(odspResolvedUrl.shareLinkInfo ?? {}, {\n\t\t\t\tsharingLinkToRedeem: this.removeNavParam(request.url),\n\t\t\t});\n\t\t}\n\t\tif (odspResolvedUrl.itemId) {\n\t\t\t// Kick start the sharing link request if we don't have it already as a performance optimization.\n\t\t\t// For detached create new, we don't have an item id yet and therefore cannot generate a share link\n\t\t\tthis.getShareLinkPromise(odspResolvedUrl).catch(() => {});\n\t\t}\n\t\treturn odspResolvedUrl;\n\t}\n\n\tprivate removeNavParam(link: string): string {\n\t\tconst url = new URL(link);\n\t\tconst params = new URLSearchParams(url.search);\n\t\tparams.delete(locatorQueryParamName);\n\t\turl.search = params.toString();\n\t\treturn url.href;\n\t}\n\n\tprivate async getShareLinkPromise(resolvedUrl: IOdspResolvedUrl): Promise<string> {\n\t\tif (this.shareLinkFetcherProps === undefined) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Failed to get share link because share link fetcher props are missing\",\n\t\t\t);\n\t\t}\n\n\t\tif (!(resolvedUrl.siteUrl && resolvedUrl.driveId && resolvedUrl.itemId)) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Failed to get share link because necessary information is missing \" +\n\t\t\t\t\t\"(e.g. siteUrl, driveId or itemId)\",\n\t\t\t);\n\t\t}\n\n\t\tconst key = this.getKey(resolvedUrl);\n\t\tconst cachedLinkPromise = this.sharingLinkCache.get(key);\n\t\tif (cachedLinkPromise) {\n\t\t\treturn cachedLinkPromise;\n\t\t}\n\t\tconst newLinkPromise = getFileLink(\n\t\t\tthis.shareLinkFetcherProps.tokenFetcher,\n\t\t\tresolvedUrl,\n\t\t\tthis.logger,\n\t\t).catch((error) => {\n\t\t\t// This should imply that error is a non-retriable error.\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"FluidFileUrlError\" }, error);\n\t\t\tthis.sharingLinkCache.remove(key);\n\t\t\tthrow error;\n\t\t});\n\t\tthis.sharingLinkCache.add(key, async () => newLinkPromise);\n\t\treturn newLinkPromise;\n\t}\n\n\t/**\n\t * Requests a driver + data store storage URL. Note that this method requires share link to be fetched\n\t * and it will throw in case share link fetcher props were not specified when instance was created.\n\t * @param resolvedUrl - The driver resolved URL\n\t * @param dataStorePath - The relative data store path URL.\n\t * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath\n\t * will be extracted from the resolved url if present.\n\t * @param packageInfoSource - optional, represents container package information to be included in url.\n\t */\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\tconst shareLink = await this.getShareLinkPromise(odspResolvedUrl);\n\n\t\treturn this.appendLocatorParams(shareLink, resolvedUrl, dataStorePath, packageInfoSource);\n\t}\n\n\t/**\n\t * Appends the store locator properties to the provided base URL. This function is useful for scenarios where an application\n\t * has a base URL (for example a sharing link) of the Fluid file, but does not have the locator information that would be used by Fluid\n\t * to load the file later.\n\t * @param baseUrl - The input URL on which the locator params will be appended.\n\t * @param resolvedUrl - odsp-driver's resolvedURL object.\n\t * @param dataStorePath - The relative data store path URL.\n\t * For requesting a driver URL, this value should always be '/'. If an empty string is passed, then dataStorePath\n\t * will be extracted from the resolved url if present.\n\t * @returns The provided base URL appended with odsp-specific locator information\n\t */\n\tpublic async appendLocatorParams(\n\t\tbaseUrl: string,\n\t\tresolvedUrl: IResolvedUrl,\n\t\tdataStorePath: string,\n\t\tpackageInfoSource?: IContainerPackageInfo,\n\t): Promise<string> {\n\t\tconst url = new URL(baseUrl);\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\t\t// If the user has passed an empty dataStorePath, then extract it from the resolved url.\n\t\tconst actualDataStorePath = dataStorePath || (odspResolvedUrl.dataStorePath ?? \"\");\n\n\t\tlet containerPackageName: string | undefined;\n\t\tif (packageInfoSource && \"name\" in packageInfoSource) {\n\t\t\tcontainerPackageName = packageInfoSource.name;\n\t\t\t// packageInfoSource is cast to any as it is typed to IContainerPackageInfo instead of IFluidCodeDetails\n\t\t\t// TODO: use a stronger type\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t} else if (isFluidPackage((packageInfoSource as any)?.package)) {\n\t\t\t// TODO: use a stronger type\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\tcontainerPackageName = (packageInfoSource as any)?.package.name;\n\t\t} else {\n\t\t\t// TODO: use a stronger type\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\tcontainerPackageName = (packageInfoSource as any)?.package;\n\t\t}\n\t\t// TODO: use a stronger type\n\t\tcontainerPackageName =\n\t\t\tcontainerPackageName ?? odspResolvedUrl.codeHint?.containerPackageName;\n\n\t\tconst context = await this.getContext?.(odspResolvedUrl, actualDataStorePath);\n\n\t\tstoreLocatorInOdspUrl(url, {\n\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\titemId: odspResolvedUrl.itemId,\n\t\t\tdataStorePath: actualDataStorePath,\n\t\t\tappName: this.appName,\n\t\t\tcontainerPackageName,\n\t\t\tfileVersion: odspResolvedUrl.fileVersion,\n\t\t\tcontext,\n\t\t});\n\n\t\treturn url.href;\n\t}\n\n\t/**\n\t * Crafts a supported document/driver URL\n\t */\n\tpublic static createDocumentUrl(\n\t\tbaseUrl: string,\n\t\tdriverInfo: OdspFluidDataStoreLocator,\n\t): string {\n\t\tconst url = new URL(baseUrl);\n\n\t\tstoreLocatorInOdspUrl(url, driverInfo);\n\n\t\treturn url.href;\n\t}\n}\n"]}
@@ -4,9 +4,9 @@
4
4
  */
5
5
  import { OdspError } from "@fluidframework/odsp-driver-definitions";
6
6
  import { IFluidErrorBase } from "@fluidframework/telemetry-utils";
7
- import { IOdspSocketError } from "./contracts.mjs";
7
+ import { IOdspSocketError } from "./contracts.js";
8
8
  /**
9
9
  * Returns network error based on error object from ODSP socket (IOdspSocketError)
10
10
  */
11
11
  export declare function errorObjectFromSocketError(socketError: IOdspSocketError, handler: string): IFluidErrorBase & OdspError;
12
- //# sourceMappingURL=odspError.d.mts.map
12
+ //# sourceMappingURL=odspError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspError.d.ts","sourceRoot":"","sources":["../src/odspError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,SAAS,EAAkB,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAuB,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,MAAM,GACb,eAAe,GAAG,SAAS,CAwB7B"}
@@ -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 { createOdspNetworkError } from "@fluidframework/odsp-doclib-utils";
6
- import { DriverErrorType } from "@fluidframework/driver-definitions";
5
+ import { createOdspNetworkError } from "@fluidframework/odsp-doclib-utils/internal";
7
6
  import { NonRetryableError } from "@fluidframework/driver-utils";
7
+ import { OdspErrorTypes } from "@fluidframework/odsp-driver-definitions";
8
8
  import { getCircularReplacer } from "@fluidframework/telemetry-utils";
9
- import { pkgVersion as driverVersion } from "./packageVersion.mjs";
9
+ import { pkgVersion as driverVersion } from "./packageVersion.js";
10
10
  /**
11
11
  * Returns network error based on error object from ODSP socket (IOdspSocketError)
12
12
  */
@@ -22,8 +22,8 @@ export function errorObjectFromSocketError(socketError, handler) {
22
22
  error.addTelemetryProperties({ odspError: true, relayServiceError: true });
23
23
  return error;
24
24
  }
25
- catch (error) {
26
- return new NonRetryableError("Internal error: errorObjectFromSocketError", DriverErrorType.fileNotFoundOrAccessDeniedError, { driverVersion });
25
+ catch {
26
+ return new NonRetryableError("Internal error: errorObjectFromSocketError", OdspErrorTypes.fileNotFoundOrAccessDeniedError, { driverVersion });
27
27
  }
28
28
  }
29
- //# sourceMappingURL=odspError.mjs.map
29
+ //# sourceMappingURL=odspError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspError.js","sourceRoot":"","sources":["../src/odspError.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAa,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAmB,MAAM,iCAAiC,CAAC;AAEvF,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACzC,WAA6B,EAC7B,OAAe;IAEf,0DAA0D;IAC1D,IAAI;QACH,iDAAiD;QACjD,MAAM,OAAO,GAAG,sBAAsB,OAAO,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;QACzE,MAAM,KAAK,GAAG,sBAAsB,CACnC,OAAO,EACP,WAAW,CAAC,IAAI,EAChB,WAAW,CAAC,UAAU,EACtB,SAAS,EAAE,6BAA6B;QACxC,WAAW,CAAC,KAAK;YAChB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,EAAE,EAAE,mBAAmB,EAAE,CAAC;YACrE,CAAC,CAAC,SAAS,CACZ,CAAC;QAEF,KAAK,CAAC,sBAAsB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3E,OAAO,KAAK,CAAC;KACb;IAAC,MAAM;QACP,OAAO,IAAI,iBAAiB,CAC3B,4CAA4C,EAC5C,cAAc,CAAC,+BAA+B,EAC9C,EAAE,aAAa,EAAE,CACjB,CAAC;KACF;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { createOdspNetworkError } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils\";\nimport { OdspError, OdspErrorTypes } from \"@fluidframework/odsp-driver-definitions\";\nimport { getCircularReplacer, IFluidErrorBase } from \"@fluidframework/telemetry-utils\";\nimport { IOdspSocketError } from \"./contracts.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\n/**\n * Returns network error based on error object from ODSP socket (IOdspSocketError)\n */\nexport function errorObjectFromSocketError(\n\tsocketError: IOdspSocketError,\n\thandler: string,\n): IFluidErrorBase & OdspError {\n\t// Make sure we always return something, and do not throw.\n\ttry {\n\t\t// pre-0.58 error message prefix: OdspSocketError\n\t\tconst message = `ODSP socket error (${handler}): ${socketError.message}`;\n\t\tconst error = createOdspNetworkError(\n\t\t\tmessage,\n\t\t\tsocketError.code,\n\t\t\tsocketError.retryAfter,\n\t\t\tundefined, // response from http request\n\t\t\tsocketError.error\n\t\t\t\t? JSON.stringify({ error: socketError.error }, getCircularReplacer())\n\t\t\t\t: undefined, // responseText\n\t\t);\n\n\t\terror.addTelemetryProperties({ odspError: true, relayServiceError: true });\n\t\treturn error;\n\t} catch {\n\t\treturn new NonRetryableError(\n\t\t\t\"Internal error: errorObjectFromSocketError\",\n\t\t\tOdspErrorTypes.fileNotFoundOrAccessDeniedError,\n\t\t\t{ driverVersion },\n\t\t);\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 { OdspFluidDataStoreLocator } from "./contractsPublic.mjs";
5
+ import { OdspFluidDataStoreLocator } from "./contractsPublic.js";
6
6
  /**
7
7
  * Transforms given Fluid data store locator into string that can be embedded into url
8
8
  * @param locator - describes Fluid data store locator info to be encoded
@@ -32,4 +32,4 @@ export declare function storeLocatorInOdspUrl(url: URL, locator: OdspFluidDataSt
32
32
  * @alpha
33
33
  */
34
34
  export declare function getLocatorFromOdspUrl(url: URL, requireFluidSignature?: boolean): OdspFluidDataStoreLocator | undefined;
35
- //# sourceMappingURL=odspFluidFileLink.d.mts.map
35
+ //# sourceMappingURL=odspFluidFileLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspFluidFileLink.d.ts","sourceRoot":"","sources":["../src/odspFluidFileLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAcjE;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CA0B1F;AA2DD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAE3C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAKxF;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACpC,GAAG,EAAE,GAAG,EACR,qBAAqB,GAAE,OAAc,GACnC,yBAAyB,GAAG,SAAS,CAiBvC"}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { fromBase64ToUtf8, fromUtf8ToBase64 } from "@fluid-internal/client-utils";
6
- import { OdcFileSiteOrigin, OdcApiSiteOrigin } from "./constants.mjs";
6
+ import { OdcFileSiteOrigin, OdcApiSiteOrigin } from "./constants.js";
7
7
  const fluidSignature = "1";
8
8
  const fluidSignatureParamName = "fluid";
9
9
  const sitePathParamName = "s";
@@ -126,4 +126,4 @@ export function getLocatorFromOdspUrl(url, requireFluidSignature = true) {
126
126
  const siteOriginUrl = url.origin.toLowerCase() === OdcFileSiteOrigin ? OdcApiSiteOrigin : url.origin;
127
127
  return decodeOdspFluidDataStoreLocator(encodedLocatorValue, siteOriginUrl, requireFluidSignature);
128
128
  }
129
- //# sourceMappingURL=odspFluidFileLink.mjs.map
129
+ //# sourceMappingURL=odspFluidFileLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspFluidFileLink.js","sourceRoot":"","sources":["../src/odspFluidFileLink.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAElF,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,uBAAuB,GAAG,OAAO,CAAC;AACxC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAC1C,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,OAAkC;IACjF,MAAM,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AAO;QACP,oBAAoB;QACpB,WAAW;QACX,OAAO;KACP,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAQ,EAAE,OAAkC;IACjF,MAAM,mBAAmB,GAAG,+BAA+B,CAAC,OAAO,CAAC,CAAC;IACrE,0GAA0G;IAC1G,qCAAqC;IACrC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACpC,GAAQ,EACR,wBAAiC,IAAI;IAErC,mGAAmG;IACnG,MAAM,mBAAmB,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACxE,IAAI,CAAC,mBAAmB,EAAE;QACzB,OAAO,SAAS,CAAC;KACjB;IAED,qGAAqG;IACrG,oFAAoF;IACpF,MAAM,aAAa,GAClB,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAEhF,OAAO,+BAA+B,CACrC,mBAAmB,EACnB,aAAa,EACb,qBAAqB,CACrB,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromBase64ToUtf8, fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport { OdspFluidDataStoreLocator } from \"./contractsPublic.js\";\nimport { OdcFileSiteOrigin, OdcApiSiteOrigin } from \"./constants.js\";\n\nconst fluidSignature = \"1\";\nconst fluidSignatureParamName = \"fluid\";\nconst sitePathParamName = \"s\";\nconst driveIdParamName = \"d\";\nconst itemIdParamName = \"f\";\nconst dataStorePathParamName = \"c\";\nconst appNameParamName = \"a\";\nconst containerPackageNameParamName = \"p\";\nconst fileVersionParamName = \"v\";\nconst additionalContextParamName = \"x\";\n\n/**\n * Transforms given Fluid data store locator into string that can be embedded into url\n * @param locator - describes Fluid data store locator info to be encoded\n * @returns string representing encoded Fluid data store locator info\n * @alpha\n */\nexport function encodeOdspFluidDataStoreLocator(locator: OdspFluidDataStoreLocator): string {\n\tconst siteUrl = new URL(locator.siteUrl);\n\tconst sitePath = encodeURIComponent(siteUrl.pathname);\n\tconst driveId = encodeURIComponent(locator.driveId);\n\tconst itemId = encodeURIComponent(locator.itemId);\n\tconst dataStorePath = encodeURIComponent(locator.dataStorePath);\n\n\tlet locatorSerialized = `${sitePathParamName}=${sitePath}&${driveIdParamName}=${driveId}&${itemIdParamName}=${itemId}&${dataStorePathParamName}=${dataStorePath}&${fluidSignatureParamName}=${fluidSignature}`;\n\tif (locator.appName) {\n\t\tlocatorSerialized += `&${appNameParamName}=${encodeURIComponent(locator.appName)}`;\n\t}\n\tif (locator.containerPackageName) {\n\t\tlocatorSerialized += `&${containerPackageNameParamName}=${encodeURIComponent(\n\t\t\tlocator.containerPackageName,\n\t\t)}`;\n\t}\n\tif (locator.fileVersion) {\n\t\tlocatorSerialized += `&${fileVersionParamName}=${encodeURIComponent(locator.fileVersion)}`;\n\t}\n\tif (locator.context) {\n\t\tlocatorSerialized += `&${additionalContextParamName}=${encodeURIComponent(\n\t\t\tlocator.context,\n\t\t)}`;\n\t}\n\n\treturn fromUtf8ToBase64(locatorSerialized);\n}\n\n/**\n * Decodes given encoded value representing Fluid data store locator extracted from ODSP Fluid file link\n * @param encodedLocatorValue - encoded Fluid data store locator value which was produced by\n * {@link encodeOdspFluidDataStoreLocator} function\n * @param siteOriginUrl - site origin that will be appended to encoded relative path to form absolute file url\n * @param requireFluidSignature - flag representing if the Fluid signature is expected in the url, default true\n * @returns object representing Fluid data store location in ODSP terms\n */\nfunction decodeOdspFluidDataStoreLocator(\n\tencodedLocatorValue: string,\n\tsiteOriginUrl: string,\n\trequireFluidSignature: boolean = true,\n): OdspFluidDataStoreLocator | undefined {\n\tconst locatorInfo = new URLSearchParams(fromBase64ToUtf8(encodedLocatorValue));\n\n\tconst signatureValue = locatorInfo.get(fluidSignatureParamName);\n\tif (requireFluidSignature && signatureValue !== \"1\") {\n\t\treturn undefined;\n\t}\n\n\tconst sitePath = locatorInfo.get(sitePathParamName);\n\tconst driveId = locatorInfo.get(driveIdParamName);\n\tconst itemId = locatorInfo.get(itemIdParamName);\n\tconst dataStorePath = locatorInfo.get(dataStorePathParamName);\n\tconst appName = locatorInfo.get(appNameParamName) ?? undefined;\n\tconst containerPackageName = locatorInfo.get(containerPackageNameParamName) ?? undefined;\n\tconst fileVersion = locatorInfo.get(fileVersionParamName) ?? undefined;\n\tconst context = locatorInfo.get(additionalContextParamName) ?? undefined;\n\t// \"\" is a valid value for dataStorePath so simply check for absence of the param;\n\t// file storage locator params must be present and non-empty\n\tif (!sitePath || !driveId || !itemId || dataStorePath === null) {\n\t\treturn undefined;\n\t}\n\n\tlet siteUrl: URL | undefined;\n\ttry {\n\t\tsiteUrl = new URL(sitePath, siteOriginUrl);\n\t} catch {\n\t\t// Ignore failure to parse url as input might be malformed\n\t}\n\n\tif (!siteUrl) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tsiteUrl: siteUrl.href,\n\t\tdriveId,\n\t\titemId,\n\t\tdataStorePath,\n\t\tappName,\n\t\tcontainerPackageName,\n\t\tfileVersion,\n\t\tcontext,\n\t};\n}\n\n/**\n * This parameter is provided by host in the resolve request and it contains information about the file\n * like driveId, itemId, siteUrl, datastorePath, packageName etc.\n * @alpha\n */\nexport const locatorQueryParamName = \"nav\";\n\n/**\n * Embeds Fluid data store locator data into given ODSP url\n * @param url - file url in ODSP format (can be either canonical or share link)\n * @param locator - object representing Fluid data store location in ODSP terms\n * @alpha\n */\nexport function storeLocatorInOdspUrl(url: URL, locator: OdspFluidDataStoreLocator): void {\n\tconst encodedLocatorValue = encodeOdspFluidDataStoreLocator(locator);\n\t// IMPORTANT: Do not apply encodeURIComponent to encodedLocatorValue, param value is automatically encoded\n\t// when set via URLSearchParams class\n\turl.searchParams.set(locatorQueryParamName, encodedLocatorValue);\n}\n\n/**\n * Extract ODSP Fluid data store locator object from given ODSP url. This extracts things like\n * driveId, ItemId, siteUrl etc from a url where these are encoded in nav query param.\n * @param url - ODSP url representing Fluid file link\n * @param requireFluidSignature - flag representing if the Fluid signature is expected in the url, default true\n * @returns object representing Fluid data store location in ODSP terms\n * @alpha\n */\nexport function getLocatorFromOdspUrl(\n\turl: URL,\n\trequireFluidSignature: boolean = true,\n): OdspFluidDataStoreLocator | undefined {\n\t// NOTE: No need to apply decodeURIComponent when accessing query params via URLSearchParams class.\n\tconst encodedLocatorValue = url.searchParams.get(locatorQueryParamName);\n\tif (!encodedLocatorValue) {\n\t\treturn undefined;\n\t}\n\n\t// IMPORTANT: ODC deviates from ODSP in that its file link origin is different from vroom api origin.\n\t// The following code passes vroom api origin as site origin instead of file origin.\n\tconst siteOriginUrl =\n\t\turl.origin.toLowerCase() === OdcFileSiteOrigin ? OdcApiSiteOrigin : url.origin;\n\n\treturn decodeOdspFluidDataStoreLocator(\n\t\tencodedLocatorValue,\n\t\tsiteOriginUrl,\n\t\trequireFluidSignature,\n\t);\n}\n"]}
@@ -11,4 +11,4 @@ import { IOdspResolvedUrl } from "@fluidframework/odsp-driver-definitions";
11
11
  * @returns The resolved url after patching the correct siteUrl.
12
12
  */
13
13
  export declare function patchOdspResolvedUrl(resolvedUrl: IResolvedUrl, redirectLocation: string): IOdspResolvedUrl;
14
- //# sourceMappingURL=odspLocationRedirection.d.mts.map
14
+ //# sourceMappingURL=odspLocationRedirection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspLocationRedirection.d.ts","sourceRoot":"","sources":["../src/odspLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAG3E;;;;;GAKG;AACH,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,YAAY,EACzB,gBAAgB,EAAE,MAAM,GACtB,gBAAgB,CAOlB"}
@@ -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 { getOdspResolvedUrl } from "./odspUtils.mjs";
5
+ import { getOdspResolvedUrl } from "./odspUtils.js";
6
6
  /**
7
7
  * It takes a resolved url with old siteUrl and creates a new resolved url with updated site url domain.
8
8
  * @param resolvedUrl - Previous odsp resolved url with older site url.
@@ -17,4 +17,4 @@ export function patchOdspResolvedUrl(resolvedUrl, redirectLocation) {
17
17
  odspResolvedUrl.siteUrl = newSiteUrl;
18
18
  return odspResolvedUrl;
19
19
  }
20
- //# sourceMappingURL=odspLocationRedirection.mjs.map
20
+ //# sourceMappingURL=odspLocationRedirection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspLocationRedirection.js","sourceRoot":"","sources":["../src/odspLocationRedirection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CACnC,WAAyB,EACzB,gBAAwB;IAExB,MAAM,eAAe,GAAG,EAAE,GAAG,kBAAkB,CAAC,WAAW,CAAC,EAAE,CAAC;IAC/D,0DAA0D;IAC1D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC;IACvD,MAAM,UAAU,GAAG,GAAG,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;IAClF,eAAe,CAAC,OAAO,GAAG,UAAU,CAAC;IACrC,OAAO,eAAe,CAAC;AACxB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IResolvedUrl } from \"@fluidframework/driver-definitions\";\nimport { IOdspResolvedUrl } from \"@fluidframework/odsp-driver-definitions\";\nimport { getOdspResolvedUrl } from \"./odspUtils.js\";\n\n/**\n * It takes a resolved url with old siteUrl and creates a new resolved url with updated site url domain.\n * @param resolvedUrl - Previous odsp resolved url with older site url.\n * @param redirectLocation - Url at which the network call has to be made. It contains new site info.\n * @returns The resolved url after patching the correct siteUrl.\n */\nexport function patchOdspResolvedUrl(\n\tresolvedUrl: IResolvedUrl,\n\tredirectLocation: string,\n): IOdspResolvedUrl {\n\tconst odspResolvedUrl = { ...getOdspResolvedUrl(resolvedUrl) };\n\t// Generate the new SiteUrl from the redirection location.\n\tconst newSiteDomain = new URL(redirectLocation).origin;\n\tconst newSiteUrl = `${newSiteDomain}${new URL(odspResolvedUrl.siteUrl).pathname}`;\n\todspResolvedUrl.siteUrl = newSiteUrl;\n\treturn odspResolvedUrl;\n}\n"]}
@@ -4,11 +4,15 @@
4
4
  */
5
5
  import { ISequencedDocumentMessage, ISnapshotTree } from "@fluidframework/protocol-definitions";
6
6
  /**
7
+ * Creates a unique and stable id for a document stored in ODSP which doesn't expose the driveId and itemId of
8
+ * said document.
9
+ *
7
10
  * @alpha
8
11
  */
9
12
  export declare function getHashedDocumentId(driveId: string, itemId: string): Promise<string>;
10
13
  /**
11
14
  * @alpha
15
+ * @deprecated - This is deprecated.
12
16
  */
13
17
  export interface ISnapshotContents {
14
18
  snapshotTree: ISnapshotTree;
@@ -23,4 +27,4 @@ export interface ISnapshotContents {
23
27
  */
24
28
  latestSequenceNumber: number | undefined;
25
29
  }
26
- //# sourceMappingURL=odspPublicUtils.d.mts.map
30
+ //# sourceMappingURL=odspPublicUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspPublicUtils.d.ts","sourceRoot":"","sources":["../src/odspPublicUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAEhG;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG1F;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,YAAY,EAAE,aAAa,CAAC;IAC5B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAChC,GAAG,EAAE,yBAAyB,EAAE,CAAC;IAEjC;;OAEG;IACH,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC;;OAEG;IACH,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC"}
@@ -4,10 +4,13 @@
4
4
  */
5
5
  import { hashFile, IsoBuffer } from "@fluid-internal/client-utils";
6
6
  /**
7
+ * Creates a unique and stable id for a document stored in ODSP which doesn't expose the driveId and itemId of
8
+ * said document.
9
+ *
7
10
  * @alpha
8
11
  */
9
12
  export async function getHashedDocumentId(driveId, itemId) {
10
13
  const buffer = IsoBuffer.from(`${driveId}_${itemId}`);
11
14
  return encodeURIComponent(await hashFile(buffer, "SHA-256", "base64"));
12
15
  }
13
- //# sourceMappingURL=odspPublicUtils.mjs.map
16
+ //# sourceMappingURL=odspPublicUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspPublicUtils.js","sourceRoot":"","sources":["../src/odspPublicUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGnE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,MAAc;IACxE,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;IACtD,OAAO,kBAAkB,CAAC,MAAM,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { hashFile, IsoBuffer } from \"@fluid-internal/client-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Creates a unique and stable id for a document stored in ODSP which doesn't expose the driveId and itemId of\n * said document.\n *\n * @alpha\n */\nexport async function getHashedDocumentId(driveId: string, itemId: string): Promise<string> {\n\tconst buffer = IsoBuffer.from(`${driveId}_${itemId}`);\n\treturn encodeURIComponent(await hashFile(buffer, \"SHA-256\", \"base64\"));\n}\n\n/**\n * @alpha\n * @deprecated - This is deprecated.\n */\nexport interface ISnapshotContents {\n\tsnapshotTree: ISnapshotTree;\n\tblobs: Map<string, ArrayBuffer>;\n\tops: ISequencedDocumentMessage[];\n\n\t/**\n\t * Sequence number of the snapshot\n\t */\n\tsequenceNumber: number | undefined;\n\n\t/**\n\t * Sequence number for the latest op/snapshot for the file in ODSP\n\t */\n\tlatestSequenceNumber: number | undefined;\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 { IOdspSnapshot } from "./contracts.mjs";
6
- import { ISnapshotContents } from "./odspPublicUtils.mjs";
5
+ import { ISnapshot } from "@fluidframework/driver-definitions";
6
+ import { IOdspSnapshot } from "./contracts.js";
7
7
  /**
8
8
  * Converts existing IOdspSnapshot to snapshot tree, blob array and ops
9
9
  * @param odspSnapshot - snapshot
10
10
  */
11
- export declare function convertOdspSnapshotToSnapshotTreeAndBlobs(odspSnapshot: IOdspSnapshot): ISnapshotContents;
12
- //# sourceMappingURL=odspSnapshotParser.d.mts.map
11
+ export declare function convertOdspSnapshotToSnapshotTreeAndBlobs(odspSnapshot: IOdspSnapshot): ISnapshot;
12
+ //# sourceMappingURL=odspSnapshotParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspSnapshotParser.d.ts","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAuB,MAAM,gBAAgB,CAAC;AAyCpE;;;GAGG;AACH,wBAAgB,yCAAyC,CAAC,YAAY,EAAE,aAAa,GAAG,SAAS,CA6BhG"}
@@ -28,6 +28,7 @@ function buildHierarchy(flatTree) {
28
28
  blobs: {},
29
29
  trees: {},
30
30
  unreferenced: entry.unreferenced,
31
+ groupId: entry.groupId,
31
32
  };
32
33
  node.trees[decodeURIComponent(entryPathBase)] = newTree;
33
34
  lookup[entry.path] = newTree;
@@ -45,21 +46,22 @@ function buildHierarchy(flatTree) {
45
46
  export function convertOdspSnapshotToSnapshotTreeAndBlobs(odspSnapshot) {
46
47
  const blobsWithBufferContent = new Map();
47
48
  if (odspSnapshot.blobs) {
48
- odspSnapshot.blobs.forEach((blob) => {
49
+ for (const blob of odspSnapshot.blobs) {
49
50
  assert(blob.encoding === "base64" || blob.encoding === undefined, 0x0a4 /* Unexpected blob encoding type */);
50
51
  blobsWithBufferContent.set(blob.id, stringToBuffer(blob.content, blob.encoding ?? "utf8"));
51
- });
52
+ }
52
53
  }
53
54
  const sequenceNumber = odspSnapshot?.trees[0].sequenceNumber;
54
55
  const val = {
55
- blobs: blobsWithBufferContent,
56
+ blobContents: blobsWithBufferContent,
56
57
  ops: odspSnapshot.ops?.map((op) => op.op) ?? [],
57
58
  sequenceNumber,
58
59
  snapshotTree: buildHierarchy(odspSnapshot.trees[0]),
59
60
  latestSequenceNumber: odspSnapshot.ops && odspSnapshot.ops.length > 0
60
61
  ? odspSnapshot.ops[odspSnapshot.ops.length - 1].sequenceNumber
61
62
  : sequenceNumber,
63
+ snapshotFormatV: 1,
62
64
  };
63
65
  return val;
64
66
  }
65
- //# sourceMappingURL=odspSnapshotParser.mjs.map
67
+ //# sourceMappingURL=odspSnapshotParser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspSnapshotParser.js","sourceRoot":"","sources":["../src/odspSnapshotParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAKpD;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,QAA6B;IACpD,MAAM,MAAM,GAA0C,EAAE,CAAC;IACzD,2FAA2F;IAC3F,MAAM,IAAI,GAAsB,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC1E,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAElB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO,EAAE;QACrC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;QACjE,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;QAEtD,sGAAsG;QACtG,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QAElC,iCAAiC;QACjC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE;YAC1B,MAAM,OAAO,GAAsB;gBAClC,KAAK,EAAE,EAAE;gBACT,KAAK,EAAE,EAAE;gBACT,YAAY,EAAE,KAAK,CAAC,YAAY;gBAChC,OAAO,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC;YACF,IAAI,CAAC,K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C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc;YAC9D,CAAC,CAAC,cAAc;QAClB,eAAe,EAAE,CAAC;KAClB,CAAC;IACF,OAAO,GAAG,CAAC;AACZ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { ISnapshot } from \"@fluidframework/driver-definitions\";\nimport { IOdspSnapshot, IOdspSnapshotCommit } from \"./contracts.js\";\n\n/**\n * Build a tree hierarchy base on a flat tree\n *\n * @param flatTree - a flat tree\n * @param blobsShaToPathCache - Map with blobs sha as keys and values as path of the blob.\n * @returns the hierarchical tree\n */\nfunction buildHierarchy(flatTree: IOdspSnapshotCommit): api.ISnapshotTree {\n\tconst lookup: { [path: string]: api.ISnapshotTree } = {};\n\t// id is required for root tree as it will be used to determine the version we loaded from.\n\tconst root: api.ISnapshotTree = { id: flatTree.id, blobs: {}, trees: {} };\n\tlookup[\"\"] = root;\n\n\tfor (const entry of flatTree.entries) {\n\t\tconst lastIndex = entry.path.lastIndexOf(\"/\");\n\t\tconst entryPathDir = entry.path.slice(0, Math.max(0, lastIndex));\n\t\tconst entryPathBase = entry.path.slice(lastIndex + 1);\n\n\t\t// ODSP snapshots are created breadth-first so we can assume we see tree nodes prior to their contents\n\t\tconst node = lookup[entryPathDir];\n\n\t\t// Add in either the blob or tree\n\t\tif (entry.type === \"tree\") {\n\t\t\tconst newTree: api.ISnapshotTree = {\n\t\t\t\tblobs: {},\n\t\t\t\ttrees: {},\n\t\t\t\tunreferenced: entry.unreferenced,\n\t\t\t\tgroupId: entry.groupId,\n\t\t\t};\n\t\t\tnode.trees[decodeURIComponent(entryPathBase)] = newTree;\n\t\t\tlookup[entry.path] = newTree;\n\t\t} else if (entry.type === \"blob\") {\n\t\t\tnode.blobs[decodeURIComponent(entryPathBase)] = entry.id;\n\t\t}\n\t}\n\n\treturn root;\n}\n\n/**\n * Converts existing IOdspSnapshot to snapshot tree, blob array and ops\n * @param odspSnapshot - snapshot\n */\nexport function convertOdspSnapshotToSnapshotTreeAndBlobs(odspSnapshot: IOdspSnapshot): ISnapshot {\n\tconst blobsWithBufferContent = new Map<string, ArrayBuffer>();\n\tif (odspSnapshot.blobs) {\n\t\tfor (const blob of odspSnapshot.blobs) {\n\t\t\tassert(\n\t\t\t\tblob.encoding === \"base64\" || blob.encoding === undefined,\n\t\t\t\t0x0a4 /* Unexpected blob encoding type */,\n\t\t\t);\n\t\t\tblobsWithBufferContent.set(\n\t\t\t\tblob.id,\n\t\t\t\tstringToBuffer(blob.content, blob.encoding ?? \"utf8\"),\n\t\t\t);\n\t\t}\n\t}\n\n\tconst sequenceNumber = odspSnapshot?.trees[0].sequenceNumber;\n\n\tconst val: ISnapshot = {\n\t\tblobContents: blobsWithBufferContent,\n\t\tops: odspSnapshot.ops?.map((op) => op.op) ?? [],\n\t\tsequenceNumber,\n\t\tsnapshotTree: buildHierarchy(odspSnapshot.trees[0]),\n\t\tlatestSequenceNumber:\n\t\t\todspSnapshot.ops && odspSnapshot.ops.length > 0\n\t\t\t\t? odspSnapshot.ops[odspSnapshot.ops.length - 1].sequenceNumber\n\t\t\t\t: sequenceNumber,\n\t\tsnapshotFormatV: 1,\n\t};\n\treturn val;\n}\n"]}
@@ -6,7 +6,7 @@ import { ISummaryContext } from "@fluidframework/driver-definitions";
6
6
  import * as api from "@fluidframework/protocol-definitions";
7
7
  import { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions";
8
8
  import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
9
- import { EpochTracker } from "./epochTracker.mjs";
9
+ import { EpochTracker } from "./epochTracker.js";
10
10
  /**
11
11
  * This class manages a summary upload. When it receives a call to upload summary, it converts the summary tree into
12
12
  * a snapshot tree and then uploads that to the server.
@@ -35,4 +35,4 @@ export declare class OdspSummaryUploadManager {
35
35
  */
36
36
  private convertSummaryToSnapshotTree;
37
37
  }
38
- //# sourceMappingURL=odspSummaryUploadManager.d.mts.map
38
+ //# sourceMappingURL=odspSummaryUploadManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspSummaryUploadManager.d.ts","sourceRoot":"","sources":["../src/odspSummaryUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EACN,mBAAmB,EAInB,MAAM,iCAAiC,CAAC;AAUzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;GAGG;AACH,qBAAa,wBAAwB;IAMnC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,eAAe;IAEhC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,sCAAsC;IACvD,OAAO,CAAC,QAAQ,CAAC,8BAA8B;IAThD,OAAO,CAAC,yBAAyB,CAAqB;IACtD,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;gBAGrB,WAAW,EAAE,MAAM,EACnB,eAAe,EAAE,+BAA+B,EACjE,MAAM,EAAE,mBAAmB,EACV,YAAY,EAAE,YAAY,EAC1B,sCAAsC,EAAE,OAAO,EAC/C,8BAA8B,EAAE,MAAM,MAAM,GAAG,SAAS;IAK7D,gBAAgB,CAC5B,IAAI,EAAE,GAAG,CAAC,YAAY,EACtB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;YA2BJ,oBAAoB;IAsElC;;;;;;;;;;OAUG;YACW,4BAA4B;CAkH1C"}
@@ -8,8 +8,8 @@ import { getGitType } from "@fluidframework/protocol-base";
8
8
  import * as api from "@fluidframework/protocol-definitions";
9
9
  import { loggerToMonitoringContext, PerformanceEvent, } from "@fluidframework/telemetry-utils";
10
10
  import { isCombinedAppAndProtocolSummary } from "@fluidframework/driver-utils";
11
- import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth.mjs";
12
- import { getWithRetryForTokenRefresh } from "./odspUtils.mjs";
11
+ import { getUrlAndHeadersWithAuth } from "./getUrlAndHeadersWithAuth.js";
12
+ import { getWithRetryForTokenRefresh } from "./odspUtils.js";
13
13
  /**
14
14
  * This class manages a summary upload. When it receives a call to upload summary, it converts the summary tree into
15
15
  * a snapshot tree and then uploads that to the server.
@@ -70,7 +70,7 @@ export class OdspSummaryUploadManager {
70
70
  attempt: options.refresh ? 2 : 1,
71
71
  hasClaims: !!options.claims,
72
72
  hasTenantId: !!options.tenantId,
73
- headers: Object.keys(headers).length !== 0 ? true : undefined,
73
+ headers: Object.keys(headers).length > 0 ? true : undefined,
74
74
  blobs,
75
75
  size: postBody.length,
76
76
  referenceSequenceNumber,
@@ -111,11 +111,13 @@ export class OdspSummaryUploadManager {
111
111
  // property is not present, the tree entry is considered referenced. If the property is present and is
112
112
  // true (which is the only value it can have), the tree entry is considered unreferenced.
113
113
  let unreferenced;
114
+ let groupId;
114
115
  switch (summaryObject.type) {
115
116
  case api.SummaryType.Tree: {
116
117
  const result = await this.convertSummaryToSnapshotTree(parentHandle, summaryObject, rootNodeName);
117
118
  value = result.snapshotTree;
118
119
  unreferenced = markUnreferencedNodes ? summaryObject.unreferenced : undefined;
120
+ groupId = summaryObject.groupId;
119
121
  blobs += result.blobs;
120
122
  break;
121
123
  }
@@ -137,7 +139,7 @@ export class OdspSummaryUploadManager {
137
139
  }
138
140
  case api.SummaryType.Handle: {
139
141
  if (!parentHandle) {
140
- throw Error("Parent summary does not exist to reference by handle.");
142
+ throw new Error("Parent summary does not exist to reference by handle.");
141
143
  }
142
144
  let handlePath = summaryObject.handle;
143
145
  if (handlePath.length > 0 && !handlePath.startsWith("/")) {
@@ -166,6 +168,7 @@ export class OdspSummaryUploadManager {
166
168
  value,
167
169
  ...baseEntry,
168
170
  unreferenced,
171
+ groupId,
169
172
  };
170
173
  }
171
174
  else if (id) {
@@ -182,4 +185,4 @@ export class OdspSummaryUploadManager {
182
185
  return { snapshotTree, blobs };
183
186
  }
184
187
  }
185
- //# sourceMappingURL=odspSummaryUploadManager.mjs.map
188
+ //# sourceMappingURL=odspSummaryUploadManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspSummaryUploadManager.js","sourceRoot":"","sources":["../src/odspSummaryUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAE5D,OAAO,EAEN,yBAAyB,EAEzB,gBAAgB,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AAU/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAE7D;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAKpC,YACkB,WAAmB,EACnB,eAAgD,EACjE,MAA2B,EACV,YAA0B,EAC1B,sCAA+C,EAC/C,8BAAwD;QALxD,gBAAW,GAAX,WAAW,CAAQ;QACnB,oBAAe,GAAf,eAAe,CAAiC;QAEhD,iBAAY,GAAZ,YAAY,CAAc;QAC1B,2CAAsC,GAAtC,sCAAsC,CAAS;QAC/C,mCAA8B,GAA9B,8BAA8B,CAA0B;QAEzE,IAAI,CAAC,EAAE,GAAG,yBAAyB,CAAC,MAAM,CA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AAC;oBACR,eAAe,CACd,aAAa,EACb,iBAAkB,aAAmC,CAAC,IAAI,EAAE,CAC5D,CAAC;iBACF;aACD;YAED,MAAM,SAAS,GAA8B;gBAC5C,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC;gBAC7B,IAAI,EAAE,UAAU,CAAC,aAAa,CAAC;aAC/B,CAAC;YAEF,IAAI,KAA2B,CAAC;YAEhC,IAAI,KAAK,EAAE;gBACV,MAAM,CACL,EAAE,KAAK,SAAS,EAChB,KAAK,CAAC,iEAAiE,CACvE,CAAC;gBACF,KAAK,GAAG;oBACP,KAAK;oBACL,GAAG,SAAS;oBACZ,YAAY;oBACZ,OAAO;iBACP,CAAC;aACF;iBAAM,IAAI,EAAE,EAAE;gBACd,KAAK,GAAG;oBACP,GAAG,SAAS;oBACZ,EAAE;iBACF,CAAC;aACF;iBAAM;gBACN,MAAM,IAAI,KAAK,CAAC,0BAA0B,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;aAChE;YAED,YAAY,CAAC,OAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAClC;QAED,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils\";\nimport { ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport { getGitType } from \"@fluidframework/protocol-base\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { InstrumentedStorageTokenFetcher } from \"@fluidframework/odsp-driver-definitions\";\nimport {\n\tITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n\tMonitoringContext,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { isCombinedAppAndProtocolSummary } from \"@fluidframework/driver-utils\";\nimport {\n\tIOdspSummaryPayload,\n\tIWriteSummaryResponse,\n\tIOdspSummaryTree,\n\tIOdspSummaryTreeBaseEntry,\n\tOdspSummaryTreeEntry,\n\tOdspSummaryTreeValue,\n} from \"./contracts.js\";\nimport { EpochTracker } from \"./epochTracker.js\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth.js\";\nimport { getWithRetryForTokenRefresh } from \"./odspUtils.js\";\n\n/**\n * This class manages a summary upload. When it receives a call to upload summary, it converts the summary tree into\n * a snapshot tree and then uploads that to the server.\n */\nexport class OdspSummaryUploadManager {\n\t// Last proposed handle of the uploaded app summary.\n\tprivate lastSummaryProposalHandle: string | undefined;\n\tprivate readonly mc: MonitoringContext;\n\n\tconstructor(\n\t\tprivate readonly snapshotUrl: string,\n\t\tprivate readonly getStorageToken: InstrumentedStorageTokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly forceAccessTokenViaAuthorizationHeader: boolean,\n\t\tprivate readonly relayServiceTenantAndSessionId: () => string | undefined,\n\t) {\n\t\tthis.mc = loggerToMonitoringContext(logger);\n\t}\n\n\tpublic async writeSummaryTree(\n\t\ttree: api.ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\t// If the last proposed handle is not the proposed handle of the acked summary(could happen when the last summary get nacked),\n\t\t// then re-initialize the caches with the previous ones else just update the previous caches with the caches from acked summary.\n\t\t// Don't bother logging if lastSummaryProposalHandle hasn't been set before; only log on a positive mismatch.\n\t\tif (\n\t\t\tthis.lastSummaryProposalHandle !== undefined &&\n\t\t\tthis.lastSummaryProposalHandle !== context.proposalHandle\n\t\t) {\n\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"LastSummaryProposedHandleMismatch\",\n\t\t\t\tackedSummaryProposedHandle: context.proposalHandle,\n\t\t\t\tlastSummaryProposalHandle: this.lastSummaryProposalHandle,\n\t\t\t});\n\t\t}\n\t\tconst result = await this.writeSummaryTreeCore(\n\t\t\tcontext.ackHandle,\n\t\t\tcontext.referenceSequenceNumber,\n\t\t\ttree,\n\t\t);\n\t\tconst id = result ? result.id : undefined;\n\t\tif (!result || !id) {\n\t\t\tthrow new Error(`Failed to write summary tree`);\n\t\t}\n\t\tthis.lastSummaryProposalHandle = id;\n\t\treturn id;\n\t}\n\n\tprivate async writeSummaryTreeCore(\n\t\tparentHandle: string | undefined,\n\t\treferenceSequenceNumber: number,\n\t\ttree: api.ISummaryTree,\n\t): Promise<IWriteSummaryResponse> {\n\t\tconst containsProtocolTree = isCombinedAppAndProtocolSummary(tree);\n\t\tconst { snapshotTree, blobs } = await this.convertSummaryToSnapshotTree(\n\t\t\tparentHandle,\n\t\t\ttree,\n\t\t\t\".app\",\n\t\t);\n\t\tconst snapshot: IOdspSummaryPayload = {\n\t\t\tentries: snapshotTree.entries!,\n\t\t\tmessage: \"app\",\n\t\t\tsequenceNumber: referenceSequenceNumber,\n\t\t\t// no ack handle implies this is initial summary after empty file creation.\n\t\t\t// send container payload so server will use it without a summary op\n\t\t\ttype: containsProtocolTree || parentHandle === undefined ? \"container\" : \"channel\",\n\t\t};\n\n\t\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"WriteSummaryTree\");\n\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t`${this.snapshotUrl}/snapshot`,\n\t\t\t\tstorageToken,\n\t\t\t\tthis.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\t\t\theaders[\"Content-Type\"] = \"application/json\";\n\t\t\tconst relayServiceTenantAndSessionId = this.relayServiceTenantAndSessionId();\n\t\t\t// This would be undefined in case of summary is uploaded in detached container with attachment\n\t\t\t// blobs flow where summary is uploaded without connecting to push.\n\t\t\tif (relayServiceTenantAndSessionId !== undefined) {\n\t\t\t\theaders[\"If-Match\"] = `fluid:sessionid=${relayServiceTenantAndSessionId}${\n\t\t\t\t\tparentHandle ? `;containerid=${parentHandle}` : \"\"\n\t\t\t\t}`;\n\t\t\t}\n\n\t\t\tconst postBody = JSON.stringify(snapshot);\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.mc.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"uploadSummary\",\n\t\t\t\t\tattempt: options.refresh ? 2 : 1,\n\t\t\t\t\thasClaims: !!options.claims,\n\t\t\t\t\thasTenantId: !!options.tenantId,\n\t\t\t\t\theaders: Object.keys(headers).length > 0 ? true : undefined,\n\t\t\t\t\tblobs,\n\t\t\t\t\tsize: postBody.length,\n\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\ttype: snapshot.type,\n\t\t\t\t},\n\t\t\t\tasync () => {\n\t\t\t\t\tconst response =\n\t\t\t\t\t\tawait this.epochTracker.fetchAndParseAsJSON<IWriteSummaryResponse>(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbody: postBody,\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"uploadSummary\",\n\t\t\t\t\t\t);\n\t\t\t\t\treturn response.content;\n\t\t\t\t},\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Following are the goals of this function:\n\t *\n\t * a. Converts the summary tree to a snapshot/odsp tree to be uploaded. Always upload full snapshot tree.\n\t *\n\t * @param parentHandle - Handle of the last uploaded summary or detach new summary.\n\t * @param tree - Summary Tree which will be converted to snapshot tree to be uploaded.\n\t * @param rootNodeName - Root node name of the summary tree.\n\t * @param path - Current path of node which is getting evaluated.\n\t * @param markUnreferencedNodes - True if we should mark unreferenced nodes.\n\t */\n\tprivate async convertSummaryToSnapshotTree(\n\t\tparentHandle: string | undefined,\n\t\ttree: api.ISummaryTree,\n\t\trootNodeName: string,\n\t\tmarkUnreferencedNodes: boolean = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.MarkUnreferencedNodes\",\n\t\t) ?? true,\n\t): Promise<{\n\t\tsnapshotTree: IOdspSummaryTree;\n\t\tblobs: number;\n\t}> {\n\t\tconst snapshotTree: IOdspSummaryTree = {\n\t\t\ttype: \"tree\",\n\t\t\tentries: [] as OdspSummaryTreeEntry[],\n\t\t};\n\n\t\tlet blobs = 0;\n\t\tconst keys = Object.keys(tree.tree);\n\t\tfor (const key of keys) {\n\t\t\tconst summaryObject = tree.tree[key];\n\n\t\t\tlet id: string | undefined;\n\t\t\tlet value: OdspSummaryTreeValue | undefined;\n\n\t\t\t// Tracks if an entry is unreferenced. Currently, only tree entries can be marked as unreferenced. If the\n\t\t\t// property is not present, the tree entry is considered referenced. If the property is present and is\n\t\t\t// true (which is the only value it can have), the tree entry is considered unreferenced.\n\t\t\tlet unreferenced: true | undefined;\n\t\t\tlet groupId: string | undefined;\n\t\t\tswitch (summaryObject.type) {\n\t\t\t\tcase api.SummaryType.Tree: {\n\t\t\t\t\tconst result = await this.convertSummaryToSnapshotTree(\n\t\t\t\t\t\tparentHandle,\n\t\t\t\t\t\tsummaryObject,\n\t\t\t\t\t\trootNodeName,\n\t\t\t\t\t);\n\t\t\t\t\tvalue = result.snapshotTree;\n\t\t\t\t\tunreferenced = markUnreferencedNodes ? summaryObject.unreferenced : undefined;\n\t\t\t\t\tgroupId = summaryObject.groupId;\n\t\t\t\t\tblobs += result.blobs;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase api.SummaryType.Blob: {\n\t\t\t\t\tvalue =\n\t\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\ttype: \"blob\",\n\t\t\t\t\t\t\t\t\tcontent: summaryObject.content,\n\t\t\t\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\ttype: \"blob\",\n\t\t\t\t\t\t\t\t\tcontent: Uint8ArrayToString(summaryObject.content, \"base64\"),\n\t\t\t\t\t\t\t\t\tencoding: \"base64\",\n\t\t\t\t\t\t\t };\n\t\t\t\t\tblobs++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase api.SummaryType.Handle: {\n\t\t\t\t\tif (!parentHandle) {\n\t\t\t\t\t\tthrow new Error(\"Parent summary does not exist to reference by handle.\");\n\t\t\t\t\t}\n\t\t\t\t\tlet handlePath = summaryObject.handle;\n\t\t\t\t\tif (handlePath.length > 0 && !handlePath.startsWith(\"/\")) {\n\t\t\t\t\t\thandlePath = `/${handlePath}`;\n\t\t\t\t\t}\n\t\t\t\t\tconst pathKey = `${rootNodeName}${handlePath}`;\n\t\t\t\t\tid = `${parentHandle}/${pathKey}`;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase api.SummaryType.Attachment: {\n\t\t\t\t\tid = summaryObject.id;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tunreachableCase(\n\t\t\t\t\t\tsummaryObject,\n\t\t\t\t\t\t`Unknown type: ${(summaryObject as api.SummaryObject).type}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst baseEntry: IOdspSummaryTreeBaseEntry = {\n\t\t\t\tpath: encodeURIComponent(key),\n\t\t\t\ttype: getGitType(summaryObject),\n\t\t\t};\n\n\t\t\tlet entry: OdspSummaryTreeEntry;\n\n\t\t\tif (value) {\n\t\t\t\tassert(\n\t\t\t\t\tid === undefined,\n\t\t\t\t\t0x0ad /* \"Snapshot entry has both a tree value and a referenced id!\" */,\n\t\t\t\t);\n\t\t\t\tentry = {\n\t\t\t\t\tvalue,\n\t\t\t\t\t...baseEntry,\n\t\t\t\t\tunreferenced,\n\t\t\t\t\tgroupId,\n\t\t\t\t};\n\t\t\t} else if (id) {\n\t\t\t\tentry = {\n\t\t\t\t\t...baseEntry,\n\t\t\t\t\tid,\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tthrow new Error(`Invalid tree entry for ${summaryObject.type}`);\n\t\t\t}\n\n\t\t\tsnapshotTree.entries!.push(entry);\n\t\t}\n\n\t\treturn { snapshotTree, blobs };\n\t}\n}\n"]}
@@ -34,4 +34,4 @@ export declare function isOdcUrl(url: string | URL): boolean;
34
34
  * @internal
35
35
  */
36
36
  export declare function getOdspUrlParts(url: URL): Promise<IOdspUrlParts | undefined>;
37
- //# sourceMappingURL=odspUrlHelper.d.mts.map
37
+ //# sourceMappingURL=odspUrlHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspUrlHelper.d.ts","sourceRoot":"","sources":["../src/odspUrlHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAIxE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAWnD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAM7C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAiBnD;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CA8ClF"}
@@ -40,7 +40,7 @@ export function isSpoUrl(url) {
40
40
  const urlLower = url.toLowerCase();
41
41
  // Format: foo.sharepoint.com/_api/v2.1./drives/bar/items/baz and foo.sharepoint-df.com/...
42
42
  const spoRegex = /(.*\.sharepoint(-df)*\.com)\/_api\/v2.1\/drives\/([^/]*)\/items\/([^/]*)/;
43
- return !!spoRegex.exec(urlLower);
43
+ return spoRegex.test(urlLower);
44
44
  }
45
45
  /**
46
46
  * Whether or not the given URL is a valid ODC URL
@@ -80,7 +80,6 @@ export async function getOdspUrlParts(url) {
80
80
  // 3: optional captured drive ID
81
81
  // 4: Item ID
82
82
  // 5: Drive ID portion of Item ID
83
- // eslint-disable-next-line unicorn/no-unsafe-regex
84
83
  joinSessionMatch = /(.*)\/v2\.1\/drive(s\/([\dA-Za-z]+))?\/items\/(([\dA-Za-z]+)!\d+)/.exec(pathname);
85
84
  if (joinSessionMatch === null) {
86
85
  // Try again but with the OData format ( `/drives('ABC123')/items('ABC123!456')` )
@@ -104,4 +103,4 @@ export async function getOdspUrlParts(url) {
104
103
  return { siteUrl: `${url.origin}${url.pathname}`, driveId, itemId };
105
104
  }
106
105
  }
107
- //# sourceMappingURL=odspUrlHelper.mjs.map
106
+ //# sourceMappingURL=odspUrlHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspUrlHelper.js","sourceRoot":"","sources":["../src/odspUrlHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,0CAA0C;AAE1C;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACzC,OAAO;IACN,kDAAkD;IAClD,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;QAC/B,8BAA8B;QAC9B,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QACnC,WAAW;QACX,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACvC,iBAAiB;QACjB,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CACnC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IACxC,IAAI,MAAM,GAAG,OAAO,CAAC;IACrB,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACxB,MAAM,GAAG,EAAE,CAAC;KACZ;IAED,OAAO,GAAG,MAAM,IAAI,MAAM,MAAM,CAAC;AAClC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW;IACnC,MAAM,QAAQ,GAAG,GAAG,CAA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IAAI,CAC5E,QAAQ,CACR,CAAC;YAEH,IAAI,gBAAgB,KAAK,IAAI,EAAE;gBAC9B,OAAO,SAAS,CAAC;aACjB;SACD;QAED,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAEnC,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;KACpE;SAAM;QACN,gBAAgB,GAAG,uDAAuD,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE1F,IAAI,gBAAgB,KAAK,IAAI,EAAE;YAC9B,OAAO,SAAS,CAAC;SACjB;QACD,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAEnC,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;KACpE;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IOdspUrlParts } from \"@fluidframework/odsp-driver-definitions\";\n\n// Centralized store for all ODC/SPO logic\n\n/**\n * Checks whether or not the given URL origin is an ODC origin\n * @param origin - The URL origin to check\n * @internal\n */\nexport function isOdcOrigin(origin: string): boolean {\n\treturn (\n\t\t// Primary API endpoint and several test endpoints\n\t\torigin.includes(\"onedrive.com\") ||\n\t\t// *storage.live.com hostnames\n\t\torigin.includes(\"storage.live.com\") ||\n\t\t// live-int\n\t\torigin.includes(\"storage.live-int.com\") ||\n\t\t// Test endpoints\n\t\torigin.includes(\"onedrive-tst.com\")\n\t);\n}\n\n/**\n * Gets the correct API root for the given ODSP url, e.g. 'https://foo-my.sharepoint.com/_api/v2.1'\n * @param origin - The URL origin\n * @internal\n */\nexport function getApiRoot(origin: string): string {\n\tlet prefix = \"_api/\";\n\tif (isOdcOrigin(origin)) {\n\t\tprefix = \"\";\n\t}\n\n\treturn `${origin}/${prefix}v2.1`;\n}\n\n/**\n * Whether or not the given URL is a valid SPO/ODB URL\n * @param url - The URL to check\n * @internal\n */\nexport function isSpoUrl(url: string): boolean {\n\tconst urlLower = url.toLowerCase();\n\n\t// Format: foo.sharepoint.com/_api/v2.1./drives/bar/items/baz and foo.sharepoint-df.com/...\n\tconst spoRegex = /(.*\\.sharepoint(-df)*\\.com)\\/_api\\/v2.1\\/drives\\/([^/]*)\\/items\\/([^/]*)/;\n\treturn spoRegex.test(urlLower);\n}\n\n/**\n * Whether or not the given URL is a valid ODC URL\n * @param url - The URL to check\n * @internal\n */\nexport function isOdcUrl(url: string | URL): boolean {\n\tconst urlObj = typeof url === \"string\" ? new URL(url) : url;\n\n\tif (!isOdcOrigin(urlObj.origin)) {\n\t\treturn false;\n\t}\n\n\tconst path = urlObj.pathname.toLowerCase();\n\n\t// Splitting the regexes so we don't have regex soup\n\t// Format: /v2.1/drive/items/ABC123!123 and /v2.1/drives/ABC123/items/ABC123!123\n\tconst odcRegex = /\\/v2.1\\/(drive|drives\\/[^/]+)\\/items\\/([\\da-z]+)!(\\d+)/;\n\n\t// Format: /v2.1/drives('ABC123')/items('ABC123!123')\n\tconst odcODataRegex = /\\/v2.1\\/drives\\('[^/]+'\\)\\/items\\('[\\da-z]+!\\d+'\\)/;\n\n\treturn !!(odcRegex.exec(path) ?? odcODataRegex.exec(path));\n}\n\n/**\n * Breaks an ODSP URL into its parts, extracting the site, drive ID, and item ID.\n * Returns undefined for invalid/malformed URLs.\n * @param url - The (raw) URL to parse\n * @internal\n */\nexport async function getOdspUrlParts(url: URL): Promise<IOdspUrlParts | undefined> {\n\tconst pathname = url.pathname;\n\n\t// Joinsession like URL\n\t// Pick a regex based on the hostname\n\t// TODO This will only support ODC using api.onedrive.com, update to handle the future (share links etc)\n\tlet joinSessionMatch: RegExpExecArray | null;\n\tif (isOdcOrigin(url.origin)) {\n\t\t// Capture groups:\n\t\t// 0: match\n\t\t// 1: origin\n\t\t// 2: optional `drives` capture (the `/drives/<DRIVEID>` API format vs `/drive`)\n\t\t// 3: optional captured drive ID\n\t\t// 4: Item ID\n\t\t// 5: Drive ID portion of Item ID\n\t\tjoinSessionMatch = /(.*)\\/v2\\.1\\/drive(s\\/([\\dA-Za-z]+))?\\/items\\/(([\\dA-Za-z]+)!\\d+)/.exec(\n\t\t\tpathname,\n\t\t);\n\n\t\tif (joinSessionMatch === null) {\n\t\t\t// Try again but with the OData format ( `/drives('ABC123')/items('ABC123!456')` )\n\t\t\tjoinSessionMatch =\n\t\t\t\t/(.*)\\/v2\\.1\\/drives\\('([\\dA-Za-z]+)'\\)\\/items\\('(([\\dA-Za-z]+)!\\d+)'\\)/.exec(\n\t\t\t\t\tpathname,\n\t\t\t\t);\n\n\t\t\tif (joinSessionMatch === null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst driveId = joinSessionMatch[3] || joinSessionMatch[5];\n\t\tconst itemId = joinSessionMatch[4];\n\n\t\treturn { siteUrl: `${url.origin}${url.pathname}`, driveId, itemId };\n\t} else {\n\t\tjoinSessionMatch = /(.*)\\/_api\\/v2.1\\/drives\\/([^/]*)\\/items\\/([^/]*)(.*)/.exec(pathname);\n\n\t\tif (joinSessionMatch === null) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst driveId = joinSessionMatch[2];\n\t\tconst itemId = joinSessionMatch[3];\n\n\t\treturn { siteUrl: `${url.origin}${url.pathname}`, driveId, itemId };\n\t}\n}\n"]}