@fluidframework/odsp-driver 2.50.0 → 2.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/.eslintrc.cjs +12 -0
  2. package/CHANGELOG.md +4 -0
  3. package/dist/checkUrl.d.ts +1 -1
  4. package/dist/checkUrl.d.ts.map +1 -1
  5. package/dist/checkUrl.js.map +1 -1
  6. package/dist/compactSnapshotParser.d.ts +2 -2
  7. package/dist/compactSnapshotParser.d.ts.map +1 -1
  8. package/dist/compactSnapshotParser.js.map +1 -1
  9. package/dist/compactSnapshotWriter.d.ts +1 -1
  10. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  11. package/dist/compactSnapshotWriter.js.map +1 -1
  12. package/dist/contracts.d.ts +3 -3
  13. package/dist/contracts.d.ts.map +1 -1
  14. package/dist/contracts.js.map +1 -1
  15. package/dist/contractsPublic.d.ts +18 -2
  16. package/dist/contractsPublic.d.ts.map +1 -1
  17. package/dist/contractsPublic.js +12 -1
  18. package/dist/contractsPublic.js.map +1 -1
  19. package/dist/createFile/createFile.d.ts +6 -6
  20. package/dist/createFile/createFile.d.ts.map +1 -1
  21. package/dist/createFile/createFile.js.map +1 -1
  22. package/dist/createFile/createNewContainerOnExistingFile.d.ts +6 -6
  23. package/dist/createFile/createNewContainerOnExistingFile.d.ts.map +1 -1
  24. package/dist/createFile/createNewContainerOnExistingFile.js +11 -2
  25. package/dist/createFile/createNewContainerOnExistingFile.js.map +1 -1
  26. package/dist/createFile/createNewUtils.d.ts +9 -6
  27. package/dist/createFile/createNewUtils.d.ts.map +1 -1
  28. package/dist/createFile/createNewUtils.js +19 -8
  29. package/dist/createFile/createNewUtils.js.map +1 -1
  30. package/dist/createFile/index.d.ts +1 -1
  31. package/dist/createFile/index.d.ts.map +1 -1
  32. package/dist/createFile/index.js.map +1 -1
  33. package/dist/createOdspCreateContainerRequest.d.ts +2 -2
  34. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  35. package/dist/createOdspCreateContainerRequest.js.map +1 -1
  36. package/dist/createOdspUrl.d.ts +1 -1
  37. package/dist/createOdspUrl.d.ts.map +1 -1
  38. package/dist/createOdspUrl.js.map +1 -1
  39. package/dist/epochTracker.d.ts +4 -4
  40. package/dist/epochTracker.d.ts.map +1 -1
  41. package/dist/epochTracker.js.map +1 -1
  42. package/dist/fetchSnapshot.d.ts +6 -6
  43. package/dist/fetchSnapshot.d.ts.map +1 -1
  44. package/dist/fetchSnapshot.js +7 -0
  45. package/dist/fetchSnapshot.js.map +1 -1
  46. package/dist/getFileLink.d.ts +2 -2
  47. package/dist/getFileLink.d.ts.map +1 -1
  48. package/dist/getFileLink.js.map +1 -1
  49. package/dist/getQueryString.d.ts +1 -1
  50. package/dist/getQueryString.d.ts.map +1 -1
  51. package/dist/getQueryString.js.map +1 -1
  52. package/dist/index.d.ts +7 -7
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js.map +1 -1
  55. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +2 -2
  56. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
  57. package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
  58. package/dist/localOdspDriver/localOdspDocumentService.d.ts +4 -4
  59. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  60. package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -1
  61. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +5 -5
  62. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  63. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  64. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -3
  65. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  66. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  67. package/dist/localOdspDriver/localOdspLayerCompatState.d.ts +1 -1
  68. package/dist/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -1
  69. package/dist/localOdspDriver/localOdspLayerCompatState.js.map +1 -1
  70. package/dist/odspCache.d.ts +2 -2
  71. package/dist/odspCache.d.ts.map +1 -1
  72. package/dist/odspCache.js.map +1 -1
  73. package/dist/odspDelayLoadedDeltaStream.d.ts +6 -6
  74. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  75. package/dist/odspDelayLoadedDeltaStream.js +9 -0
  76. package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
  77. package/dist/odspDeltaStorageService.d.ts +6 -6
  78. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  79. package/dist/odspDeltaStorageService.js.map +1 -1
  80. package/dist/odspDocumentDeltaConnection.d.ts +5 -5
  81. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  82. package/dist/odspDocumentDeltaConnection.js.map +1 -1
  83. package/dist/odspDocumentService.d.ts +6 -6
  84. package/dist/odspDocumentService.d.ts.map +1 -1
  85. package/dist/odspDocumentService.js.map +1 -1
  86. package/dist/odspDocumentServiceFactory.d.ts +2 -2
  87. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  88. package/dist/odspDocumentServiceFactory.js.map +1 -1
  89. package/dist/odspDocumentServiceFactoryCore.d.ts +7 -7
  90. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  91. package/dist/odspDocumentServiceFactoryCore.js +1 -1
  92. package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
  93. package/dist/odspDocumentStorageManager.d.ts +9 -9
  94. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  95. package/dist/odspDocumentStorageManager.js.map +1 -1
  96. package/dist/odspDocumentStorageServiceBase.d.ts +3 -3
  97. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  98. package/dist/odspDocumentStorageServiceBase.js.map +1 -1
  99. package/dist/odspDriverUrlResolver.d.ts +3 -3
  100. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  101. package/dist/odspDriverUrlResolver.js +3 -0
  102. package/dist/odspDriverUrlResolver.js.map +1 -1
  103. package/dist/odspDriverUrlResolverForShareLink.d.ts +4 -4
  104. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  105. package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
  106. package/dist/odspError.d.ts +3 -3
  107. package/dist/odspError.d.ts.map +1 -1
  108. package/dist/odspError.js.map +1 -1
  109. package/dist/odspFluidFileLink.d.ts +1 -1
  110. package/dist/odspFluidFileLink.d.ts.map +1 -1
  111. package/dist/odspFluidFileLink.js.map +1 -1
  112. package/dist/odspLayerCompatState.d.ts +1 -1
  113. package/dist/odspLayerCompatState.d.ts.map +1 -1
  114. package/dist/odspLayerCompatState.js.map +1 -1
  115. package/dist/odspLocationRedirection.d.ts +2 -2
  116. package/dist/odspLocationRedirection.d.ts.map +1 -1
  117. package/dist/odspLocationRedirection.js.map +1 -1
  118. package/dist/odspPublicUtils.d.ts +1 -1
  119. package/dist/odspPublicUtils.d.ts.map +1 -1
  120. package/dist/odspPublicUtils.js.map +1 -1
  121. package/dist/odspSnapshotParser.d.ts +2 -2
  122. package/dist/odspSnapshotParser.d.ts.map +1 -1
  123. package/dist/odspSnapshotParser.js.map +1 -1
  124. package/dist/odspSummaryUploadManager.d.ts +5 -5
  125. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  126. package/dist/odspSummaryUploadManager.js.map +1 -1
  127. package/dist/odspUrlHelper.d.ts +1 -1
  128. package/dist/odspUrlHelper.d.ts.map +1 -1
  129. package/dist/odspUrlHelper.js.map +1 -1
  130. package/dist/odspUtils.d.ts +5 -5
  131. package/dist/odspUtils.d.ts.map +1 -1
  132. package/dist/odspUtils.js.map +1 -1
  133. package/dist/opsCaching.d.ts +1 -1
  134. package/dist/opsCaching.d.ts.map +1 -1
  135. package/dist/opsCaching.js.map +1 -1
  136. package/dist/packageVersion.d.ts +1 -1
  137. package/dist/packageVersion.js +1 -1
  138. package/dist/packageVersion.js.map +1 -1
  139. package/dist/prefetchLatestSnapshot.d.ts +5 -5
  140. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  141. package/dist/prefetchLatestSnapshot.js.map +1 -1
  142. package/dist/retryErrorsStorageAdapter.d.ts +4 -4
  143. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  144. package/dist/retryErrorsStorageAdapter.js.map +1 -1
  145. package/dist/retryUtils.d.ts +1 -1
  146. package/dist/retryUtils.d.ts.map +1 -1
  147. package/dist/retryUtils.js.map +1 -1
  148. package/dist/vroom.d.ts +4 -4
  149. package/dist/vroom.d.ts.map +1 -1
  150. package/dist/vroom.js.map +1 -1
  151. package/dist/zipItDataRepresentationUtils.d.ts +2 -2
  152. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  153. package/dist/zipItDataRepresentationUtils.js.map +1 -1
  154. package/lib/checkUrl.d.ts +1 -1
  155. package/lib/checkUrl.d.ts.map +1 -1
  156. package/lib/checkUrl.js.map +1 -1
  157. package/lib/compactSnapshotParser.d.ts +2 -2
  158. package/lib/compactSnapshotParser.d.ts.map +1 -1
  159. package/lib/compactSnapshotParser.js.map +1 -1
  160. package/lib/compactSnapshotWriter.d.ts +1 -1
  161. package/lib/compactSnapshotWriter.d.ts.map +1 -1
  162. package/lib/compactSnapshotWriter.js.map +1 -1
  163. package/lib/contracts.d.ts +3 -3
  164. package/lib/contracts.d.ts.map +1 -1
  165. package/lib/contracts.js.map +1 -1
  166. package/lib/contractsPublic.d.ts +18 -2
  167. package/lib/contractsPublic.d.ts.map +1 -1
  168. package/lib/contractsPublic.js +11 -0
  169. package/lib/contractsPublic.js.map +1 -1
  170. package/lib/createFile/createFile.d.ts +6 -6
  171. package/lib/createFile/createFile.d.ts.map +1 -1
  172. package/lib/createFile/createFile.js.map +1 -1
  173. package/lib/createFile/createNewContainerOnExistingFile.d.ts +6 -6
  174. package/lib/createFile/createNewContainerOnExistingFile.d.ts.map +1 -1
  175. package/lib/createFile/createNewContainerOnExistingFile.js +12 -3
  176. package/lib/createFile/createNewContainerOnExistingFile.js.map +1 -1
  177. package/lib/createFile/createNewUtils.d.ts +9 -6
  178. package/lib/createFile/createNewUtils.d.ts.map +1 -1
  179. package/lib/createFile/createNewUtils.js +19 -8
  180. package/lib/createFile/createNewUtils.js.map +1 -1
  181. package/lib/createFile/index.d.ts +1 -1
  182. package/lib/createFile/index.d.ts.map +1 -1
  183. package/lib/createFile/index.js.map +1 -1
  184. package/lib/createOdspCreateContainerRequest.d.ts +2 -2
  185. package/lib/createOdspCreateContainerRequest.d.ts.map +1 -1
  186. package/lib/createOdspCreateContainerRequest.js.map +1 -1
  187. package/lib/createOdspUrl.d.ts +1 -1
  188. package/lib/createOdspUrl.d.ts.map +1 -1
  189. package/lib/createOdspUrl.js.map +1 -1
  190. package/lib/epochTracker.d.ts +4 -4
  191. package/lib/epochTracker.d.ts.map +1 -1
  192. package/lib/epochTracker.js.map +1 -1
  193. package/lib/fetchSnapshot.d.ts +6 -6
  194. package/lib/fetchSnapshot.d.ts.map +1 -1
  195. package/lib/fetchSnapshot.js +7 -0
  196. package/lib/fetchSnapshot.js.map +1 -1
  197. package/lib/getFileLink.d.ts +2 -2
  198. package/lib/getFileLink.d.ts.map +1 -1
  199. package/lib/getFileLink.js.map +1 -1
  200. package/lib/getQueryString.d.ts +1 -1
  201. package/lib/getQueryString.d.ts.map +1 -1
  202. package/lib/getQueryString.js.map +1 -1
  203. package/lib/index.d.ts +7 -7
  204. package/lib/index.d.ts.map +1 -1
  205. package/lib/index.js.map +1 -1
  206. package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts +2 -2
  207. package/lib/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -1
  208. package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +1 -1
  209. package/lib/localOdspDriver/localOdspDocumentService.d.ts +4 -4
  210. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  211. package/lib/localOdspDriver/localOdspDocumentService.js.map +1 -1
  212. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts +5 -5
  213. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  214. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -1
  215. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts +3 -3
  216. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  217. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -1
  218. package/lib/localOdspDriver/localOdspLayerCompatState.d.ts +1 -1
  219. package/lib/localOdspDriver/localOdspLayerCompatState.d.ts.map +1 -1
  220. package/lib/localOdspDriver/localOdspLayerCompatState.js.map +1 -1
  221. package/lib/odspCache.d.ts +2 -2
  222. package/lib/odspCache.d.ts.map +1 -1
  223. package/lib/odspCache.js.map +1 -1
  224. package/lib/odspDelayLoadedDeltaStream.d.ts +6 -6
  225. package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
  226. package/lib/odspDelayLoadedDeltaStream.js +9 -0
  227. package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
  228. package/lib/odspDeltaStorageService.d.ts +6 -6
  229. package/lib/odspDeltaStorageService.d.ts.map +1 -1
  230. package/lib/odspDeltaStorageService.js.map +1 -1
  231. package/lib/odspDocumentDeltaConnection.d.ts +5 -5
  232. package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
  233. package/lib/odspDocumentDeltaConnection.js.map +1 -1
  234. package/lib/odspDocumentService.d.ts +6 -6
  235. package/lib/odspDocumentService.d.ts.map +1 -1
  236. package/lib/odspDocumentService.js.map +1 -1
  237. package/lib/odspDocumentServiceFactory.d.ts +2 -2
  238. package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
  239. package/lib/odspDocumentServiceFactory.js.map +1 -1
  240. package/lib/odspDocumentServiceFactoryCore.d.ts +7 -7
  241. package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  242. package/lib/odspDocumentServiceFactoryCore.js +1 -1
  243. package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
  244. package/lib/odspDocumentStorageManager.d.ts +9 -9
  245. package/lib/odspDocumentStorageManager.d.ts.map +1 -1
  246. package/lib/odspDocumentStorageManager.js.map +1 -1
  247. package/lib/odspDocumentStorageServiceBase.d.ts +3 -3
  248. package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -1
  249. package/lib/odspDocumentStorageServiceBase.js.map +1 -1
  250. package/lib/odspDriverUrlResolver.d.ts +3 -3
  251. package/lib/odspDriverUrlResolver.d.ts.map +1 -1
  252. package/lib/odspDriverUrlResolver.js +4 -1
  253. package/lib/odspDriverUrlResolver.js.map +1 -1
  254. package/lib/odspDriverUrlResolverForShareLink.d.ts +4 -4
  255. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  256. package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
  257. package/lib/odspError.d.ts +3 -3
  258. package/lib/odspError.d.ts.map +1 -1
  259. package/lib/odspError.js +1 -1
  260. package/lib/odspError.js.map +1 -1
  261. package/lib/odspFluidFileLink.d.ts +1 -1
  262. package/lib/odspFluidFileLink.d.ts.map +1 -1
  263. package/lib/odspFluidFileLink.js.map +1 -1
  264. package/lib/odspLayerCompatState.d.ts +1 -1
  265. package/lib/odspLayerCompatState.d.ts.map +1 -1
  266. package/lib/odspLayerCompatState.js.map +1 -1
  267. package/lib/odspLocationRedirection.d.ts +2 -2
  268. package/lib/odspLocationRedirection.d.ts.map +1 -1
  269. package/lib/odspLocationRedirection.js.map +1 -1
  270. package/lib/odspPublicUtils.d.ts +1 -1
  271. package/lib/odspPublicUtils.d.ts.map +1 -1
  272. package/lib/odspPublicUtils.js.map +1 -1
  273. package/lib/odspSnapshotParser.d.ts +2 -2
  274. package/lib/odspSnapshotParser.d.ts.map +1 -1
  275. package/lib/odspSnapshotParser.js.map +1 -1
  276. package/lib/odspSummaryUploadManager.d.ts +5 -5
  277. package/lib/odspSummaryUploadManager.d.ts.map +1 -1
  278. package/lib/odspSummaryUploadManager.js +1 -1
  279. package/lib/odspSummaryUploadManager.js.map +1 -1
  280. package/lib/odspUrlHelper.d.ts +1 -1
  281. package/lib/odspUrlHelper.d.ts.map +1 -1
  282. package/lib/odspUrlHelper.js.map +1 -1
  283. package/lib/odspUtils.d.ts +5 -5
  284. package/lib/odspUtils.d.ts.map +1 -1
  285. package/lib/odspUtils.js.map +1 -1
  286. package/lib/opsCaching.d.ts +1 -1
  287. package/lib/opsCaching.d.ts.map +1 -1
  288. package/lib/opsCaching.js.map +1 -1
  289. package/lib/packageVersion.d.ts +1 -1
  290. package/lib/packageVersion.js +1 -1
  291. package/lib/packageVersion.js.map +1 -1
  292. package/lib/prefetchLatestSnapshot.d.ts +5 -5
  293. package/lib/prefetchLatestSnapshot.d.ts.map +1 -1
  294. package/lib/prefetchLatestSnapshot.js.map +1 -1
  295. package/lib/retryErrorsStorageAdapter.d.ts +4 -4
  296. package/lib/retryErrorsStorageAdapter.d.ts.map +1 -1
  297. package/lib/retryErrorsStorageAdapter.js.map +1 -1
  298. package/lib/retryUtils.d.ts +1 -1
  299. package/lib/retryUtils.d.ts.map +1 -1
  300. package/lib/retryUtils.js.map +1 -1
  301. package/lib/vroom.d.ts +4 -4
  302. package/lib/vroom.d.ts.map +1 -1
  303. package/lib/vroom.js.map +1 -1
  304. package/lib/zipItDataRepresentationUtils.d.ts +2 -2
  305. package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
  306. package/lib/zipItDataRepresentationUtils.js.map +1 -1
  307. package/package.json +13 -14
  308. package/src/checkUrl.ts +1 -1
  309. package/src/compactSnapshotParser.ts +4 -4
  310. package/src/compactSnapshotWriter.ts +2 -2
  311. package/src/contracts.ts +3 -3
  312. package/src/contractsPublic.ts +20 -2
  313. package/src/createFile/createFile.ts +10 -10
  314. package/src/createFile/createNewContainerOnExistingFile.ts +20 -9
  315. package/src/createFile/createNewUtils.ts +27 -15
  316. package/src/createFile/index.ts +2 -1
  317. package/src/createOdspCreateContainerRequest.ts +2 -2
  318. package/src/createOdspUrl.ts +1 -1
  319. package/src/epochTracker.ts +11 -11
  320. package/src/fetchSnapshot.ts +20 -13
  321. package/src/getFileLink.ts +4 -4
  322. package/src/getQueryString.ts +1 -1
  323. package/src/index.ts +10 -10
  324. package/src/localOdspDriver/localOdspDeltaStorageService.ts +2 -2
  325. package/src/localOdspDriver/localOdspDocumentService.ts +4 -4
  326. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +8 -5
  327. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +4 -4
  328. package/src/localOdspDriver/localOdspLayerCompatState.ts +1 -1
  329. package/src/odspCache.ts +7 -7
  330. package/src/odspDelayLoadedDeltaStream.ts +24 -14
  331. package/src/odspDeltaStorageService.ts +8 -8
  332. package/src/odspDocumentDeltaConnection.ts +9 -9
  333. package/src/odspDocumentService.ts +8 -8
  334. package/src/odspDocumentServiceFactory.ts +2 -2
  335. package/src/odspDocumentServiceFactoryCore.ts +20 -19
  336. package/src/odspDocumentStorageManager.ts +18 -18
  337. package/src/odspDocumentStorageServiceBase.ts +13 -13
  338. package/src/odspDriverUrlResolver.ts +9 -6
  339. package/src/odspDriverUrlResolverForShareLink.ts +5 -5
  340. package/src/odspError.ts +6 -3
  341. package/src/odspFluidFileLink.ts +1 -1
  342. package/src/odspLayerCompatState.ts +1 -1
  343. package/src/odspLocationRedirection.ts +2 -2
  344. package/src/odspPublicUtils.ts +1 -1
  345. package/src/odspSnapshotParser.ts +2 -2
  346. package/src/odspSummaryUploadManager.ts +11 -7
  347. package/src/odspUrlHelper.ts +1 -1
  348. package/src/odspUtils.ts +13 -13
  349. package/src/opsCaching.ts +1 -1
  350. package/src/packageVersion.ts +1 -1
  351. package/src/prefetchLatestSnapshot.ts +13 -13
  352. package/src/retryErrorsStorageAdapter.ts +4 -4
  353. package/src/retryUtils.ts +1 -1
  354. package/src/vroom.ts +5 -5
  355. package/src/zipItDataRepresentationUtils.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"createF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C;QACtC,YAAY;QACZ,aAAa,EAAE,eAAe;QAC9B,SAAS,EAAE,YAAY;QACvB,wBAAwB,EAAE,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;gBACtB,MAAM,IAAI,iBAAiB,CAC1B,0CAA0C,EAC1C,cAAc,CAAC,uBAAuB,EACtC,EAAE,aAAa,EAAE,CACjB,CAAC;YACH,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { ISnapshot } from \"@fluidframework/driver-definitions/internal\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIFileEntry,\n\tIOdspResolvedUrl,\n\tInstrumentedStorageTokenFetcher,\n\tOdspErrorTypes,\n\tShareLinkInfoType,\n\ttype IOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ICreateFileResponse, type IRenameFileResponse } from \"./../contracts.js\";\nimport { ClpCompliantAppHeader } from \"./../contractsPublic.js\";\nimport { createOdspUrl } from \"./../createOdspUrl.js\";\nimport { EpochTracker } from \"./../epochTracker.js\";\nimport { getHeadersWithAuth } from \"./../getUrlAndHeadersWithAuth.js\";\nimport { OdspDriverUrlResolver } from \"./../odspDriverUrlResolver.js\";\nimport { checkForKnownServerFarmType, getApiRoot } from \"./../odspUrlHelper.js\";\nimport {\n\tINewFileInfo,\n\tappendNavParam,\n\tbuildOdspShareLinkReqParams,\n\tcreateCacheSnapshotKey,\n\tgetWithRetryForTokenRefresh,\n\tsnapshotWithLoadingGroupIdSupported,\n} from \"./../odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./../packageVersion.js\";\nimport { runWithRetry } from \"./../retryUtils.js\";\nimport {\n\tconvertCreateNewSummaryTreeToTreeAndBlobs,\n\tconvertSummaryIntoContainerSnapshot,\n\tcreateNewFluidContainerCore,\n} from \"./createNewUtils.js\";\n\nconst isInvalidFileName = (fileName: string): boolean => {\n\tconst invalidCharsRegex = /[\"*/:<>?\\\\|]+/g;\n\treturn invalidCharsRegex.test(fileName);\n};\n\n/**\n * Creates a new Fluid file.\n * Returns resolved url\n */\nexport async function createNewFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree | undefined,\n\tepochTracker: EpochTracker,\n\tfileEntry: IFileEntry,\n\tcreateNewCaching: boolean,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tisClpCompliantApp?: boolean,\n\tenableSingleRequestForShareLinkWithCreate?: boolean,\n\tresolvedUrl?: IOdspResolvedUrl,\n): Promise<IOdspResolvedUrl> {\n\t// Check for valid filename before the request to create file is actually made.\n\tif (isInvalidFileName(newFileInfo.filename)) {\n\t\tthrow new NonRetryableError(\n\t\t\t// pre-0.58 error message: Invalid filename\n\t\t\t\"Invalid filename for createNew\",\n\t\t\tOdspErrorTypes.invalidFileNameError,\n\t\t\t{ driverVersion },\n\t\t);\n\t}\n\n\tlet itemId: string;\n\tlet pendingRename: string | undefined;\n\tlet summaryHandle: string = \"\";\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (createNewSummary === undefined) {\n\t\tconst content = await createNewEmptyFluidFile(\n\t\t\tgetAuthHeader,\n\t\t\tnewFileInfo,\n\t\t\tlogger,\n\t\t\tepochTracker,\n\t\t);\n\t\titemId = content.itemId;\n\t\tpendingRename = newFileInfo.filename;\n\t} else {\n\t\tconst content = await createNewFluidFileFromSummary(\n\t\t\tgetAuthHeader,\n\t\t\tnewFileInfo,\n\t\t\tlogger,\n\t\t\tcreateNewSummary,\n\t\t\tepochTracker,\n\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t);\n\t\titemId = content.itemId;\n\t\tsummaryHandle = content.id;\n\n\t\tshareLinkInfo = extractShareLinkData(content, enableSingleRequestForShareLinkWithCreate);\n\t}\n\n\tconst odspUrl = createOdspUrl({ ...newFileInfo, itemId, dataStorePath: \"/\" });\n\tconst resolver = new OdspDriverUrlResolver();\n\tconst odspResolvedUrl = await resolver.resolve({\n\t\turl: odspUrl,\n\t\theaders: { [ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp },\n\t});\n\tfileEntry.docId = odspResolvedUrl.hashedDocumentId;\n\tfileEntry.resolvedUrl = odspResolvedUrl;\n\n\todspResolvedUrl.context = resolvedUrl?.context;\n\todspResolvedUrl.appName = resolvedUrl?.appName;\n\todspResolvedUrl.codeHint = odspResolvedUrl.codeHint?.containerPackageName\n\t\t? odspResolvedUrl.codeHint\n\t\t: resolvedUrl?.codeHint;\n\n\tif (shareLinkInfo?.createLink?.link) {\n\t\tlet newWebUrl = shareLinkInfo.createLink.link.webUrl;\n\t\tnewWebUrl = appendNavParam(\n\t\t\tnewWebUrl,\n\t\t\todspResolvedUrl,\n\t\t\todspResolvedUrl.dataStorePath ?? \"/\",\n\t\t\todspResolvedUrl.codeHint?.containerPackageName,\n\t\t);\n\t\tshareLinkInfo.createLink.link.webUrl = newWebUrl;\n\t}\n\n\todspResolvedUrl.shareLinkInfo = shareLinkInfo;\n\todspResolvedUrl.pendingRename = pendingRename;\n\n\tif (createNewSummary !== undefined && createNewCaching) {\n\t\tassert(summaryHandle !== undefined, 0x203 /* \"Summary handle is undefined\" */);\n\t\t// converting summary and getting sequence number\n\t\tconst snapshot: ISnapshot = convertCreateNewSummaryTreeToTreeAndBlobs(\n\t\t\tcreateNewSummary,\n\t\t\tsummaryHandle,\n\t\t);\n\t\t// caching the converted summary\n\t\tawait epochTracker.put(\n\t\t\tcreateCacheSnapshotKey(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tsnapshotWithLoadingGroupIdSupported(loggerToMonitoringContext(logger).config),\n\t\t\t),\n\t\t\tsnapshot,\n\t\t);\n\t}\n\treturn odspResolvedUrl;\n}\n\n/**\n * If user requested creation of a sharing link along with the creation of the file by providing\n * createLinkScope in the request parameters then extract and save the sharing link information from\n * the response if it is available.\n * In case there was an error in creation of the sharing link, error is provided back in the response,\n * and does not impact the creation of file in ODSP.\n * @param requestedSharingLinkKind - Kind of sharing link requested to be created along with the creation of file.\n * @param response - Response object received from the /snapshot api call\n * @returns Sharing link information received in the response from a successful creation of a file.\n */\nfunction extractShareLinkData(\n\tresponse: ICreateFileResponse,\n\tenableSingleRequestForShareLinkWithCreate?: boolean,\n): ShareLinkInfoType | undefined {\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (enableSingleRequestForShareLinkWithCreate) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst { sharing } = response;\n\t\tif (!sharing) {\n\t\t\treturn;\n\t\t}\n\t\t/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */\n\t\tshareLinkInfo = {\n\t\t\tcreateLink: {\n\t\t\t\tlink: sharing.sharingLink\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tscope: sharing.sharingLink.scope,\n\t\t\t\t\t\t\trole: sharing.sharingLink.type,\n\t\t\t\t\t\t\twebUrl: sharing.sharingLink.webUrl,\n\t\t\t\t\t\t\t...sharing.sharingLink,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t\terror: sharing.error,\n\t\t\t\tshareId: sharing.shareId,\n\t\t\t},\n\t\t};\n\t\t/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */\n\t}\n\treturn shareLinkInfo;\n}\n\n/**\n * Encodes file path so it can be embedded in the request url\n * @param path - path to encode\n * @returns encoded path or \"\" if path is undefined\n */\nfunction encodeFilePath(path: string | undefined): string {\n\treturn path ? encodeURIComponent(path.startsWith(\"/\") ? path : `/${path}`) : \"\";\n}\n\nexport async function createNewEmptyFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n): Promise<{ itemId: string; fileName: string }> {\n\tconst filePath = encodeFilePath(newFileInfo.filePath);\n\tconst encodedFilename = encodeURIComponent(`${newFileInfo.filename}.tmp`);\n\tconst initialUrl = `${getApiRoot(new URL(newFileInfo.siteUrl))}/drives/${\n\t\tnewFileInfo.driveId\n\t}/items/root:${filePath}/${encodedFilename}:/content?@name.conflictBehavior=rename&select=id,name,parentReference`;\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\tconst url = initialUrl;\n\t\tconst method = \"PUT\";\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"CreateNewFile\",\n\t\t);\n\t\tconst internalFarmType = checkForKnownServerFarmType(newFileInfo.siteUrl);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"createNewEmptyFile\",\n\t\t\t\tdetails: {\n\t\t\t\t\tinternalFarmType,\n\t\t\t\t},\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\n\t\t\t\theaders[\"Content-Type\"] = \"application/json\";\n\n\t\t\t\tconst fetchResponse = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<ICreateFileResponse>(\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: undefined,\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"createFile\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\"createFile\",\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tconst content = fetchResponse.content;\n\t\t\t\tif (!content?.id) {\n\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t// pre-0.58 error message: ODSP CreateFile call returned no item ID\n\t\t\t\t\t\t\"ODSP CreateFile call returned no item ID (for empty file)\",\n\t\t\t\t\t\tOdspErrorTypes.incorrectServerResponse,\n\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tevent.end({\n\t\t\t\t\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\t\t\t\treturn { itemId: content.id, fileName: content.name };\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t});\n}\n\nexport async function renameEmptyFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\todspParts: IOdspUrlParts,\n\trequestedFileName: string,\n\tlogger: ITelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n): Promise<IRenameFileResponse> {\n\tconst initialUrl = `${getApiRoot(new URL(odspParts.siteUrl))}/drives/${\n\t\todspParts.driveId\n\t}/items/${odspParts.itemId}?@name.conflictBehavior=rename`;\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\tconst url = initialUrl;\n\t\tconst method = \"PATCH\";\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"renameFile\",\n\t\t);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"renameFile\" },\n\t\t\tasync (event) => {\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\n\t\t\t\theaders[\"Content-Type\"] = \"application/json\";\n\n\t\t\t\tconst fetchResponse = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<IRenameFileResponse>(\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: JSON.stringify({\n\t\t\t\t\t\t\t\t\tname: requestedFileName,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"PATCH\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"renameFile\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\"renameFile\",\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tconst content = fetchResponse.content;\n\t\t\t\tif (!content?.id) {\n\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t\"ODSP RenameFile call returned no item ID (for empty file)\",\n\t\t\t\t\t\tOdspErrorTypes.incorrectServerResponse,\n\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tevent.end({\n\t\t\t\t\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\t\t\t\treturn content;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t});\n}\n\nexport async function createNewFluidFileFromSummary(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree,\n\tepochTracker: EpochTracker,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n): Promise<ICreateFileResponse> {\n\tconst filePath = encodeFilePath(newFileInfo.filePath);\n\tconst encodedFilename = encodeURIComponent(newFileInfo.filename);\n\tconst baseUrl =\n\t\t`${getApiRoot(new URL(newFileInfo.siteUrl))}/drives/${newFileInfo.driveId}/items/root:` +\n\t\t`${filePath}/${encodedFilename}`;\n\n\tconst containerSnapshot = convertSummaryIntoContainerSnapshot(createNewSummary);\n\n\t// Build share link parameter based on the createLinkType provided so that the\n\t// snapshot api can create and return the share link along with creation of file in the response.\n\tconst createShareLinkParam = buildOdspShareLinkReqParams(newFileInfo.createLinkType);\n\tconst initialUrl = `${baseUrl}:/opStream/snapshots/snapshot${\n\t\tcreateShareLinkParam ? `?${createShareLinkParam}` : \"\"\n\t}`;\n\n\treturn createNewFluidContainerCore<ICreateFileResponse>({\n\t\tcontainerSnapshot,\n\t\tgetAuthHeader,\n\t\tlogger,\n\t\tinitialUrl,\n\t\tforceAccessTokenViaAuthorizationHeader,\n\t\tepochTracker,\n\t\ttelemetryName: \"CreateNewFile\",\n\t\tfetchType: \"createFile\",\n\t\tvalidateResponseCallback: (content) => {\n\t\t\tif (!content?.itemId) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"ODSP CreateFile call returned no item ID\",\n\t\t\t\t\tOdspErrorTypes.incorrectServerResponse,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
1
+ {"version":3,"file":"createFile.js","sourceRoot":"","sources":["../../src/createFile/createFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAG7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAIN,cAAc,GAGd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,yBAAyB,EACzB,gBAAgB,GAChB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAEN,cAAc,EACd,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,mCAAmC,GACnC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACrE,O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,WAAW,CAAC,OAAO,CAAC,CAAC,WAAW,WAAW,CAAC,OAAO,cAAc;QACvF,GAAG,QAAQ,IAAI,eAAe,EAAE,CAAC;IAElC,MAAM,iBAAiB,GAAG,mCAAmC,CAAC,gBAAgB,CAAC,CAAC;IAEhF,8EAA8E;IAC9E,iGAAiG;IACjG,MAAM,oBAAoB,GAAG,2BAA2B,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACrF,MAAM,UAAU,GAAG,GAAG,OAAO,gCAC5B,oBAAoB,CAAC,CAAC,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC,CAAC,EACrD,EAAE,CAAC;IAEH,OAAO,2BAA2B,CAAsB;QACvD,iBAAiB;QACjB,aAAa;QACb,MAAM;QACN,UAAU;QACV,sCAAsC;QACtC,YAAY;QACZ,aAAa,EAAE,eAAe;QAC9B,SAAS,EAAE,YAAY;QACvB,wBAAwB,EAAE,CAAC,OAAO,EAAE,EAAE;YACrC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;gBACtB,MAAM,IAAI,iBAAiB,CAC1B,0CAA0C,EAC1C,cAAc,CAAC,uBAAuB,EACtC,EAAE,aAAa,EAAE,CACjB,CAAC;YACH,CAAC;QACF,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type { ISnapshot } from \"@fluidframework/driver-definitions/internal\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype IFileEntry,\n\ttype IOdspResolvedUrl,\n\ttype InstrumentedStorageTokenFetcher,\n\tOdspErrorTypes,\n\ttype ShareLinkInfoType,\n\ttype IOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { ICreateFileResponse, IRenameFileResponse } from \"./../contracts.js\";\nimport { ClpCompliantAppHeader } from \"./../contractsPublic.js\";\nimport { createOdspUrl } from \"./../createOdspUrl.js\";\nimport type { EpochTracker } from \"./../epochTracker.js\";\nimport { getHeadersWithAuth } from \"./../getUrlAndHeadersWithAuth.js\";\nimport { OdspDriverUrlResolver } from \"./../odspDriverUrlResolver.js\";\nimport { checkForKnownServerFarmType, getApiRoot } from \"./../odspUrlHelper.js\";\nimport {\n\ttype INewFileInfo,\n\tappendNavParam,\n\tbuildOdspShareLinkReqParams,\n\tcreateCacheSnapshotKey,\n\tgetWithRetryForTokenRefresh,\n\tsnapshotWithLoadingGroupIdSupported,\n} from \"./../odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./../packageVersion.js\";\nimport { runWithRetry } from \"./../retryUtils.js\";\nimport {\n\tconvertCreateNewSummaryTreeToTreeAndBlobs,\n\tconvertSummaryIntoContainerSnapshot,\n\tcreateNewFluidContainerCore,\n} from \"./createNewUtils.js\";\n\nconst isInvalidFileName = (fileName: string): boolean => {\n\tconst invalidCharsRegex = /[\"*/:<>?\\\\|]+/g;\n\treturn invalidCharsRegex.test(fileName);\n};\n\n/**\n * Creates a new Fluid file.\n * Returns resolved url\n */\nexport async function createNewFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree | undefined,\n\tepochTracker: EpochTracker,\n\tfileEntry: IFileEntry,\n\tcreateNewCaching: boolean,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tisClpCompliantApp?: boolean,\n\tenableSingleRequestForShareLinkWithCreate?: boolean,\n\tresolvedUrl?: IOdspResolvedUrl,\n): Promise<IOdspResolvedUrl> {\n\t// Check for valid filename before the request to create file is actually made.\n\tif (isInvalidFileName(newFileInfo.filename)) {\n\t\tthrow new NonRetryableError(\n\t\t\t// pre-0.58 error message: Invalid filename\n\t\t\t\"Invalid filename for createNew\",\n\t\t\tOdspErrorTypes.invalidFileNameError,\n\t\t\t{ driverVersion },\n\t\t);\n\t}\n\n\tlet itemId: string;\n\tlet pendingRename: string | undefined;\n\tlet summaryHandle: string = \"\";\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (createNewSummary === undefined) {\n\t\tconst content = await createNewEmptyFluidFile(\n\t\t\tgetAuthHeader,\n\t\t\tnewFileInfo,\n\t\t\tlogger,\n\t\t\tepochTracker,\n\t\t);\n\t\titemId = content.itemId;\n\t\tpendingRename = newFileInfo.filename;\n\t} else {\n\t\tconst content = await createNewFluidFileFromSummary(\n\t\t\tgetAuthHeader,\n\t\t\tnewFileInfo,\n\t\t\tlogger,\n\t\t\tcreateNewSummary,\n\t\t\tepochTracker,\n\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t);\n\t\titemId = content.itemId;\n\t\tsummaryHandle = content.id;\n\n\t\tshareLinkInfo = extractShareLinkData(content, enableSingleRequestForShareLinkWithCreate);\n\t}\n\n\tconst odspUrl = createOdspUrl({ ...newFileInfo, itemId, dataStorePath: \"/\" });\n\tconst resolver = new OdspDriverUrlResolver();\n\tconst odspResolvedUrl = await resolver.resolve({\n\t\turl: odspUrl,\n\t\theaders: { [ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp },\n\t});\n\tfileEntry.docId = odspResolvedUrl.hashedDocumentId;\n\tfileEntry.resolvedUrl = odspResolvedUrl;\n\n\todspResolvedUrl.context = resolvedUrl?.context;\n\todspResolvedUrl.appName = resolvedUrl?.appName;\n\todspResolvedUrl.codeHint = odspResolvedUrl.codeHint?.containerPackageName\n\t\t? odspResolvedUrl.codeHint\n\t\t: resolvedUrl?.codeHint;\n\n\tif (shareLinkInfo?.createLink?.link) {\n\t\tlet newWebUrl = shareLinkInfo.createLink.link.webUrl;\n\t\tnewWebUrl = appendNavParam(\n\t\t\tnewWebUrl,\n\t\t\todspResolvedUrl,\n\t\t\todspResolvedUrl.dataStorePath ?? \"/\",\n\t\t\todspResolvedUrl.codeHint?.containerPackageName,\n\t\t);\n\t\tshareLinkInfo.createLink.link.webUrl = newWebUrl;\n\t}\n\n\todspResolvedUrl.shareLinkInfo = shareLinkInfo;\n\todspResolvedUrl.pendingRename = pendingRename;\n\n\tif (createNewSummary !== undefined && createNewCaching) {\n\t\tassert(summaryHandle !== undefined, 0x203 /* \"Summary handle is undefined\" */);\n\t\t// converting summary and getting sequence number\n\t\tconst snapshot: ISnapshot = convertCreateNewSummaryTreeToTreeAndBlobs(\n\t\t\tcreateNewSummary,\n\t\t\tsummaryHandle,\n\t\t);\n\t\t// caching the converted summary\n\t\tawait epochTracker.put(\n\t\t\tcreateCacheSnapshotKey(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tsnapshotWithLoadingGroupIdSupported(loggerToMonitoringContext(logger).config),\n\t\t\t),\n\t\t\tsnapshot,\n\t\t);\n\t}\n\treturn odspResolvedUrl;\n}\n\n/**\n * If user requested creation of a sharing link along with the creation of the file by providing\n * createLinkScope in the request parameters then extract and save the sharing link information from\n * the response if it is available.\n * In case there was an error in creation of the sharing link, error is provided back in the response,\n * and does not impact the creation of file in ODSP.\n * @param requestedSharingLinkKind - Kind of sharing link requested to be created along with the creation of file.\n * @param response - Response object received from the /snapshot api call\n * @returns Sharing link information received in the response from a successful creation of a file.\n */\nfunction extractShareLinkData(\n\tresponse: ICreateFileResponse,\n\tenableSingleRequestForShareLinkWithCreate?: boolean,\n): ShareLinkInfoType | undefined {\n\tlet shareLinkInfo: ShareLinkInfoType | undefined;\n\tif (enableSingleRequestForShareLinkWithCreate) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\tconst { sharing } = response;\n\t\tif (!sharing) {\n\t\t\treturn;\n\t\t}\n\t\t/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */\n\t\tshareLinkInfo = {\n\t\t\tcreateLink: {\n\t\t\t\tlink: sharing.sharingLink\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tscope: sharing.sharingLink.scope,\n\t\t\t\t\t\t\trole: sharing.sharingLink.type,\n\t\t\t\t\t\t\twebUrl: sharing.sharingLink.webUrl,\n\t\t\t\t\t\t\t...sharing.sharingLink,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\t\terror: sharing.error,\n\t\t\t\tshareId: sharing.shareId,\n\t\t\t},\n\t\t};\n\t\t/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */\n\t}\n\treturn shareLinkInfo;\n}\n\n/**\n * Encodes file path so it can be embedded in the request url\n * @param path - path to encode\n * @returns encoded path or \"\" if path is undefined\n */\nfunction encodeFilePath(path: string | undefined): string {\n\treturn path ? encodeURIComponent(path.startsWith(\"/\") ? path : `/${path}`) : \"\";\n}\n\nexport async function createNewEmptyFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n): Promise<{ itemId: string; fileName: string }> {\n\tconst filePath = encodeFilePath(newFileInfo.filePath);\n\tconst encodedFilename = encodeURIComponent(`${newFileInfo.filename}.tmp`);\n\tconst initialUrl = `${getApiRoot(new URL(newFileInfo.siteUrl))}/drives/${\n\t\tnewFileInfo.driveId\n\t}/items/root:${filePath}/${encodedFilename}:/content?@name.conflictBehavior=rename&select=id,name,parentReference`;\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\tconst url = initialUrl;\n\t\tconst method = \"PUT\";\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"CreateNewFile\",\n\t\t);\n\t\tconst internalFarmType = checkForKnownServerFarmType(newFileInfo.siteUrl);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"createNewEmptyFile\",\n\t\t\t\tdetails: {\n\t\t\t\t\tinternalFarmType,\n\t\t\t\t},\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\n\t\t\t\theaders[\"Content-Type\"] = \"application/json\";\n\n\t\t\t\tconst fetchResponse = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<ICreateFileResponse>(\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: undefined,\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"createFile\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\"createFile\",\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tconst content = fetchResponse.content;\n\t\t\t\tif (!content?.id) {\n\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t// pre-0.58 error message: ODSP CreateFile call returned no item ID\n\t\t\t\t\t\t\"ODSP CreateFile call returned no item ID (for empty file)\",\n\t\t\t\t\t\tOdspErrorTypes.incorrectServerResponse,\n\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tevent.end({\n\t\t\t\t\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\t\t\t\treturn { itemId: content.id, fileName: content.name };\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t});\n}\n\nexport async function renameEmptyFluidFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\todspParts: IOdspUrlParts,\n\trequestedFileName: string,\n\tlogger: ITelemetryLoggerExt,\n\tepochTracker: EpochTracker,\n): Promise<IRenameFileResponse> {\n\tconst initialUrl = `${getApiRoot(new URL(odspParts.siteUrl))}/drives/${\n\t\todspParts.driveId\n\t}/items/${odspParts.itemId}?@name.conflictBehavior=rename`;\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\tconst url = initialUrl;\n\t\tconst method = \"PATCH\";\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"renameFile\",\n\t\t);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: \"renameFile\" },\n\t\t\tasync (event) => {\n\t\t\t\tconst headers = getHeadersWithAuth(authHeader);\n\t\t\t\theaders[\"Content-Type\"] = \"application/json\";\n\n\t\t\t\tconst fetchResponse = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<IRenameFileResponse>(\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: JSON.stringify({\n\t\t\t\t\t\t\t\t\tname: requestedFileName,\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"PATCH\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"renameFile\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\"renameFile\",\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tconst content = fetchResponse.content;\n\t\t\t\tif (!content?.id) {\n\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t\"ODSP RenameFile call returned no item ID (for empty file)\",\n\t\t\t\t\t\tOdspErrorTypes.incorrectServerResponse,\n\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tevent.end({\n\t\t\t\t\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\t\t\t\treturn content;\n\t\t\t},\n\t\t\t{ end: true, cancel: \"error\" },\n\t\t);\n\t});\n}\n\nexport async function createNewFluidFileFromSummary(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tnewFileInfo: INewFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree,\n\tepochTracker: EpochTracker,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n): Promise<ICreateFileResponse> {\n\tconst filePath = encodeFilePath(newFileInfo.filePath);\n\tconst encodedFilename = encodeURIComponent(newFileInfo.filename);\n\tconst baseUrl =\n\t\t`${getApiRoot(new URL(newFileInfo.siteUrl))}/drives/${newFileInfo.driveId}/items/root:` +\n\t\t`${filePath}/${encodedFilename}`;\n\n\tconst containerSnapshot = convertSummaryIntoContainerSnapshot(createNewSummary);\n\n\t// Build share link parameter based on the createLinkType provided so that the\n\t// snapshot api can create and return the share link along with creation of file in the response.\n\tconst createShareLinkParam = buildOdspShareLinkReqParams(newFileInfo.createLinkType);\n\tconst initialUrl = `${baseUrl}:/opStream/snapshots/snapshot${\n\t\tcreateShareLinkParam ? `?${createShareLinkParam}` : \"\"\n\t}`;\n\n\treturn createNewFluidContainerCore<ICreateFileResponse>({\n\t\tcontainerSnapshot,\n\t\tgetAuthHeader,\n\t\tlogger,\n\t\tinitialUrl,\n\t\tforceAccessTokenViaAuthorizationHeader,\n\t\tepochTracker,\n\t\ttelemetryName: \"CreateNewFile\",\n\t\tfetchType: \"createFile\",\n\t\tvalidateResponseCallback: (content) => {\n\t\t\tif (!content?.itemId) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"ODSP CreateFile call returned no item ID\",\n\t\t\t\t\tOdspErrorTypes.incorrectServerResponse,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
@@ -2,11 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ISummaryTree } from "@fluidframework/driver-definitions";
6
- import { IFileEntry, IOdspResolvedUrl, InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
7
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
8
- import { EpochTracker } from "./../epochTracker.js";
9
- import { IExistingFileInfo } from "./../odspUtils.js";
5
+ import type { ISummaryTree } from "@fluidframework/driver-definitions";
6
+ import type { IFileEntry, IOdspResolvedUrl, InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
7
+ import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
8
+ import type { EpochTracker } from "./../epochTracker.js";
9
+ import { type IExistingFileInfo } from "./../odspUtils.js";
10
10
  /**
11
11
  * Creates a new Fluid container on an existing file.
12
12
  *
@@ -18,5 +18,5 @@ import { IExistingFileInfo } from "./../odspUtils.js";
18
18
  * by an existing file. For example, SharePoint Pages is able to store Fluid container in an
19
19
  * "alternative file partition" where the main File stub is an ASPX page.
20
20
  */
21
- export declare function createNewContainerOnExistingFile(getAuthHeader: InstrumentedStorageTokenFetcher, fileInfo: IExistingFileInfo, logger: ITelemetryLoggerExt, createNewSummary: ISummaryTree | undefined, epochTracker: EpochTracker, fileEntry: IFileEntry, createNewCaching: boolean, forceAccessTokenViaAuthorizationHeader: boolean, isClpCompliantApp?: boolean): Promise<IOdspResolvedUrl>;
21
+ export declare function createNewContainerOnExistingFile(getAuthHeader: InstrumentedStorageTokenFetcher, fileInfo: IExistingFileInfo, logger: ITelemetryLoggerExt, createNewSummary: ISummaryTree | undefined, epochTracker: EpochTracker, fileEntry: IFileEntry, createNewCaching: boolean, forceAccessTokenViaAuthorizationHeader: boolean, isClpCompliantApp?: boolean, eTag?: string): Promise<IOdspResolvedUrl>;
22
22
  //# sourceMappingURL=createNewContainerOnExistingFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createNewContainerOnExistingFile.d.ts","sourceRoot":"","sources":["../../src/createFile/createNewContainerOnExistingFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGlE,OAAO,EACN,UAAU,EACV,gBAAgB,EAChB,+BAA+B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,mBAAmB,EAEnB,MAAM,0CAA0C,CAAC;AAKlD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EACN,iBAAiB,EAGjB,MAAM,mBAAmB,CAAC;AAO3B;;;;;;;;;;GAUG;AACH,wBAAsB,gCAAgC,CACrD,aAAa,EAAE,+BAA+B,EAC9C,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,mBAAmB,EAC3B,gBAAgB,EAAE,YAAY,GAAG,SAAS,EAC1C,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,OAAO,EACzB,sCAAsC,EAAE,OAAO,EAC/C,iBAAiB,CAAC,EAAE,OAAO,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAkD3B"}
1
+ {"version":3,"file":"createNewContainerOnExistingFile.d.ts","sourceRoot":"","sources":["../../src/createFile/createNewContainerOnExistingFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,KAAK,EACX,UAAU,EACV,gBAAgB,EAChB,+BAA+B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,0CAA0C,CAAC;AAKlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,OAAO,EACN,KAAK,iBAAiB,EAGtB,MAAM,mBAAmB,CAAC;AAO3B;;;;;;;;;;GAUG;AACH,wBAAsB,gCAAgC,CACrD,aAAa,EAAE,+BAA+B,EAC9C,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,mBAAmB,EAC3B,gBAAgB,EAAE,YAAY,GAAG,SAAS,EAC1C,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,UAAU,EACrB,gBAAgB,EAAE,OAAO,EACzB,sCAAsC,EAAE,OAAO,EAC/C,iBAAiB,CAAC,EAAE,OAAO,EAC3B,IAAI,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,CAAC,CA4D3B"}
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import { UsageError } from "@fluidframework/driver-utils/internal";
6
6
  import { loggerToMonitoringContext, } from "@fluidframework/telemetry-utils/internal";
7
- import { ClpCompliantAppHeader } from "./../contractsPublic.js";
7
+ import { ClpCompliantAppHeader, FileMetadataHeader } from "./../contractsPublic.js";
8
8
  import { createOdspUrl } from "./../createOdspUrl.js";
9
9
  import { OdspDriverUrlResolver } from "./../odspDriverUrlResolver.js";
10
10
  import { getApiRoot } from "./../odspUrlHelper.js";
@@ -21,13 +21,18 @@ import { convertCreateNewSummaryTreeToTreeAndBlobs, convertSummaryIntoContainerS
21
21
  * by an existing file. For example, SharePoint Pages is able to store Fluid container in an
22
22
  * "alternative file partition" where the main File stub is an ASPX page.
23
23
  */
24
- export async function createNewContainerOnExistingFile(getAuthHeader, fileInfo, logger, createNewSummary, epochTracker, fileEntry, createNewCaching, forceAccessTokenViaAuthorizationHeader, isClpCompliantApp) {
24
+ export async function createNewContainerOnExistingFile(getAuthHeader, fileInfo, logger, createNewSummary, epochTracker, fileEntry, createNewCaching, forceAccessTokenViaAuthorizationHeader, isClpCompliantApp, eTag) {
25
25
  if (createNewSummary === undefined) {
26
26
  throw new UsageError("createNewSummary must exist to create a new container");
27
27
  }
28
28
  const baseUrl = `${getApiRoot(new URL(fileInfo.siteUrl))}/drives/${fileInfo.driveId}/items/${fileInfo.itemId}`;
29
29
  const containerSnapshot = convertSummaryIntoContainerSnapshot(createNewSummary);
30
30
  const initialUrl = `${baseUrl}/opStream/snapshots/snapshot`;
31
+ const additionalHeaders = {};
32
+ if (eTag !== undefined) {
33
+ // Sending the e-tag of the file in the If-Match triggers file conversion logic in the /snapshot api.
34
+ additionalHeaders["If-Match"] = eTag;
35
+ }
31
36
  const { id: summaryHandle } = await createNewFluidContainerCore({
32
37
  containerSnapshot,
33
38
  getAuthHeader,
@@ -37,12 +42,16 @@ export async function createNewContainerOnExistingFile(getAuthHeader, fileInfo,
37
42
  epochTracker,
38
43
  telemetryName: "CreateNewContainerOnExistingFile",
39
44
  fetchType: "uploadSummary",
45
+ additionalHeaders,
40
46
  });
41
47
  const odspUrl = createOdspUrl({ ...fileInfo, dataStorePath: "/" });
42
48
  const resolver = new OdspDriverUrlResolver();
43
49
  const odspResolvedUrl = await resolver.resolve({
44
50
  url: odspUrl,
45
- headers: { [ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp },
51
+ headers: {
52
+ [ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp,
53
+ [FileMetadataHeader.eTag]: eTag,
54
+ },
46
55
  });
47
56
  fileEntry.docId = odspResolvedUrl.hashedDocumentId;
48
57
  fileEntry.resolvedUrl = odspResolvedUrl;
@@ -1 +1 @@
1
- {"version":3,"file":"createNewContainerOnExistingFile.js","sourceRoot":"","sources":["../../src/createFile/createNewContainerOnExistingFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAMnE,OAAO,EAEN,yBAAyB,GACzB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAEN,sBAAsB,EACtB,mCAAmC,GACnC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,yCAAyC,EACzC,mCAAmC,EACnC,2BAA2B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACrD,aAA8C,EAC9C,QAA2B,EAC3B,MAA2B,EAC3B,g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MAAM,YAAY,CAAC,GAAG,CACrB,sBAAsB,CACrB,eAAe,EACf,mCAAmC,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAC7E,EACD,QAAQ,CACR,CAAC;IACH,CAAC;IAED,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 { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport { ISnapshot } from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport {\n\tIFileEntry,\n\tIOdspResolvedUrl,\n\tInstrumentedStorageTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { IWriteSummaryResponse } from \"./../contracts.js\";\nimport { ClpCompliantAppHeader } from \"./../contractsPublic.js\";\nimport { createOdspUrl } from \"./../createOdspUrl.js\";\nimport { EpochTracker } from \"./../epochTracker.js\";\nimport { OdspDriverUrlResolver } from \"./../odspDriverUrlResolver.js\";\nimport { getApiRoot } from \"./../odspUrlHelper.js\";\nimport {\n\tIExistingFileInfo,\n\tcreateCacheSnapshotKey,\n\tsnapshotWithLoadingGroupIdSupported,\n} from \"./../odspUtils.js\";\nimport {\n\tconvertCreateNewSummaryTreeToTreeAndBlobs,\n\tconvertSummaryIntoContainerSnapshot,\n\tcreateNewFluidContainerCore,\n} from \"./createNewUtils.js\";\n\n/**\n * Creates a new Fluid container on an existing file.\n *\n * @remarks This requires service's capability to manage Fluid container inside an existing file.\n *\n * @example\n *\n * This enables a scenario where Fluid data is not stored as a standalone file but in a way that is managed\n * by an existing file. For example, SharePoint Pages is able to store Fluid container in an\n * \"alternative file partition\" where the main File stub is an ASPX page.\n */\nexport async function createNewContainerOnExistingFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tfileInfo: IExistingFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree | undefined,\n\tepochTracker: EpochTracker,\n\tfileEntry: IFileEntry,\n\tcreateNewCaching: boolean,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tisClpCompliantApp?: boolean,\n): Promise<IOdspResolvedUrl> {\n\tif (createNewSummary === undefined) {\n\t\tthrow new UsageError(\"createNewSummary must exist to create a new container\");\n\t}\n\n\tconst baseUrl = `${getApiRoot(new URL(fileInfo.siteUrl))}/drives/${fileInfo.driveId}/items/${\n\t\tfileInfo.itemId\n\t}`;\n\n\tconst containerSnapshot = convertSummaryIntoContainerSnapshot(createNewSummary);\n\n\tconst initialUrl = `${baseUrl}/opStream/snapshots/snapshot`;\n\n\tconst { id: summaryHandle } = await createNewFluidContainerCore<IWriteSummaryResponse>({\n\t\tcontainerSnapshot,\n\t\tgetAuthHeader,\n\t\tlogger,\n\t\tinitialUrl,\n\t\tforceAccessTokenViaAuthorizationHeader,\n\t\tepochTracker,\n\t\ttelemetryName: \"CreateNewContainerOnExistingFile\",\n\t\tfetchType: \"uploadSummary\",\n\t});\n\n\tconst odspUrl = createOdspUrl({ ...fileInfo, dataStorePath: \"/\" });\n\tconst resolver = new OdspDriverUrlResolver();\n\tconst odspResolvedUrl = await resolver.resolve({\n\t\turl: odspUrl,\n\t\theaders: { [ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp },\n\t});\n\tfileEntry.docId = odspResolvedUrl.hashedDocumentId;\n\tfileEntry.resolvedUrl = odspResolvedUrl;\n\n\tif (createNewCaching) {\n\t\t// converting summary and getting sequence number\n\t\tconst snapshot: ISnapshot = convertCreateNewSummaryTreeToTreeAndBlobs(\n\t\t\tcreateNewSummary,\n\t\t\tsummaryHandle,\n\t\t);\n\t\t// caching the converted summary\n\t\tawait epochTracker.put(\n\t\t\tcreateCacheSnapshotKey(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tsnapshotWithLoadingGroupIdSupported(loggerToMonitoringContext(logger).config),\n\t\t\t),\n\t\t\tsnapshot,\n\t\t);\n\t}\n\n\treturn odspResolvedUrl;\n}\n"]}
1
+ {"version":3,"file":"createNewContainerOnExistingFile.js","sourceRoot":"","sources":["../../src/createFile/createNewContainerOnExistingFile.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAMnE,OAAO,EAEN,yBAAyB,GACzB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAEN,sBAAsB,EACtB,mCAAmC,GACnC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,yCAAyC,EACzC,mCAAmC,EACnC,2BAA2B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACrD,aAA8C,EAC9C,QAA2B,EAC3B,MAA2B,EAC3B,gBAA0C,EAC1C,YAA0B,EAC1B,SAAqB,EACrB,gBAAyB,EACzB,sCAA+C,EAC/C,iBAA2B,EAC3B,IAAa;IAEb,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,IAAI,UAAU,CAAC,uDAAuD,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,UAAU,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,QAAQ,CAAC,OAAO,UAClF,QAAQ,CAAC,MACV,EAAE,CAAC;IAEH,MAAM,iBAAiB,GAAG,mCAAmC,CAAC,gBAAgB,CAAC,CAAC;IAEhF,M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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type { ISnapshot } from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/driver-utils/internal\";\nimport type {\n\tIFileEntry,\n\tIOdspResolvedUrl,\n\tInstrumentedStorageTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { IWriteSummaryResponse } from \"./../contracts.js\";\nimport { ClpCompliantAppHeader, FileMetadataHeader } from \"./../contractsPublic.js\";\nimport { createOdspUrl } from \"./../createOdspUrl.js\";\nimport type { EpochTracker } from \"./../epochTracker.js\";\nimport { OdspDriverUrlResolver } from \"./../odspDriverUrlResolver.js\";\nimport { getApiRoot } from \"./../odspUrlHelper.js\";\nimport {\n\ttype IExistingFileInfo,\n\tcreateCacheSnapshotKey,\n\tsnapshotWithLoadingGroupIdSupported,\n} from \"./../odspUtils.js\";\nimport {\n\tconvertCreateNewSummaryTreeToTreeAndBlobs,\n\tconvertSummaryIntoContainerSnapshot,\n\tcreateNewFluidContainerCore,\n} from \"./createNewUtils.js\";\n\n/**\n * Creates a new Fluid container on an existing file.\n *\n * @remarks This requires service's capability to manage Fluid container inside an existing file.\n *\n * @example\n *\n * This enables a scenario where Fluid data is not stored as a standalone file but in a way that is managed\n * by an existing file. For example, SharePoint Pages is able to store Fluid container in an\n * \"alternative file partition\" where the main File stub is an ASPX page.\n */\nexport async function createNewContainerOnExistingFile(\n\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\tfileInfo: IExistingFileInfo,\n\tlogger: ITelemetryLoggerExt,\n\tcreateNewSummary: ISummaryTree | undefined,\n\tepochTracker: EpochTracker,\n\tfileEntry: IFileEntry,\n\tcreateNewCaching: boolean,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tisClpCompliantApp?: boolean,\n\teTag?: string,\n): Promise<IOdspResolvedUrl> {\n\tif (createNewSummary === undefined) {\n\t\tthrow new UsageError(\"createNewSummary must exist to create a new container\");\n\t}\n\n\tconst baseUrl = `${getApiRoot(new URL(fileInfo.siteUrl))}/drives/${fileInfo.driveId}/items/${\n\t\tfileInfo.itemId\n\t}`;\n\n\tconst containerSnapshot = convertSummaryIntoContainerSnapshot(createNewSummary);\n\n\tconst initialUrl = `${baseUrl}/opStream/snapshots/snapshot`;\n\n\tconst additionalHeaders: { [key: string]: string } = {};\n\tif (eTag !== undefined) {\n\t\t// Sending the e-tag of the file in the If-Match triggers file conversion logic in the /snapshot api.\n\t\tadditionalHeaders[\"If-Match\"] = eTag;\n\t}\n\n\tconst { id: summaryHandle } = await createNewFluidContainerCore<IWriteSummaryResponse>({\n\t\tcontainerSnapshot,\n\t\tgetAuthHeader,\n\t\tlogger,\n\t\tinitialUrl,\n\t\tforceAccessTokenViaAuthorizationHeader,\n\t\tepochTracker,\n\t\ttelemetryName: \"CreateNewContainerOnExistingFile\",\n\t\tfetchType: \"uploadSummary\",\n\t\tadditionalHeaders,\n\t});\n\n\tconst odspUrl = createOdspUrl({ ...fileInfo, dataStorePath: \"/\" });\n\tconst resolver = new OdspDriverUrlResolver();\n\tconst odspResolvedUrl = await resolver.resolve({\n\t\turl: odspUrl,\n\t\theaders: {\n\t\t\t[ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp,\n\t\t\t[FileMetadataHeader.eTag]: eTag,\n\t\t},\n\t});\n\tfileEntry.docId = odspResolvedUrl.hashedDocumentId;\n\tfileEntry.resolvedUrl = odspResolvedUrl;\n\n\tif (createNewCaching) {\n\t\t// converting summary and getting sequence number\n\t\tconst snapshot: ISnapshot = convertCreateNewSummaryTreeToTreeAndBlobs(\n\t\t\tcreateNewSummary,\n\t\t\tsummaryHandle,\n\t\t);\n\t\t// caching the converted summary\n\t\tawait epochTracker.put(\n\t\t\tcreateCacheSnapshotKey(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tsnapshotWithLoadingGroupIdSupported(loggerToMonitoringContext(logger).config),\n\t\t\t),\n\t\t\tsnapshot,\n\t\t);\n\t}\n\n\treturn odspResolvedUrl;\n}\n"]}
@@ -2,12 +2,12 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ISummaryTree } from "@fluidframework/driver-definitions";
6
- import { ISnapshot } from "@fluidframework/driver-definitions/internal";
7
- import { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
8
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
9
- import { IOdspSummaryPayload } from "./../contracts.js";
10
- import { EpochTracker, FetchType } from "./../epochTracker.js";
5
+ import { type ISummaryTree } from "@fluidframework/driver-definitions";
6
+ import type { ISnapshot } from "@fluidframework/driver-definitions/internal";
7
+ import type { InstrumentedStorageTokenFetcher } from "@fluidframework/odsp-driver-definitions/internal";
8
+ import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
9
+ import type { IOdspSummaryPayload } from "./../contracts.js";
10
+ import type { EpochTracker, FetchType } from "./../epochTracker.js";
11
11
  /**
12
12
  * Converts a summary(ISummaryTree) taken in detached container to snapshot tree and blobs
13
13
  */
@@ -23,5 +23,8 @@ export declare function createNewFluidContainerCore<T>(args: {
23
23
  telemetryName: string;
24
24
  fetchType: FetchType;
25
25
  validateResponseCallback?: (content: T) => void;
26
+ additionalHeaders?: {
27
+ [key: string]: string;
28
+ };
26
29
  }): Promise<T>;
27
30
  //# sourceMappingURL=createNewUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createNewUtils.d.ts","sourceRoot":"","sources":["../../src/createFile/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAEN,YAAY,EAGZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAi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mB,CAAC;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMpE;;GAEG;AACH,wBAAgB,yCAAyC,CACxD,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,GACZ,SAAS,CAiBX;AAiDD,wBAAgB,mCAAmC,CAClD,gBAAgB,EAAE,YAAY,GAC5B,mBAAmB,CA2BrB;AAiED,wBAAsB,2BAA2B,CAAC,CAAC,EAAE,IAAI,EAAE;IAC1D,iBAAiB,EAAE,mBAAmB,CAAC;IACvC,aAAa,EAAE,+BAA+B,CAAC;IAC/C,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC,EAAE,OAAO,CAAC;IAChD,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;IACrB,wBAAwB,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;IAChD,iBAAiB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC9C,GAAG,OAAO,CAAC,CAAC,CAAC,CAwGb"}
@@ -151,7 +151,7 @@ function convertSummaryToSnapshotTreeForCreateNew(summary) {
151
151
  return snapshotTree;
152
152
  }
153
153
  export async function createNewFluidContainerCore(args) {
154
- const { containerSnapshot, getAuthHeader, logger, initialUrl, epochTracker, telemetryName, fetchType, validateResponseCallback, } = args;
154
+ const { containerSnapshot, getAuthHeader, logger, initialUrl, epochTracker, telemetryName, fetchType, validateResponseCallback, additionalHeaders = {}, } = args;
155
155
  const internalFarmType = checkForKnownServerFarmType(initialUrl);
156
156
  return getWithRetryForTokenRefresh(async (options) => {
157
157
  return PerformanceEvent.timedExecAsync(logger, { eventName: telemetryName, details: { internalFarmType } }, async (event) => {
@@ -165,13 +165,23 @@ export async function createNewFluidContainerCore(args) {
165
165
  const authInBodyUrl = urlObj.href;
166
166
  const method = "POST";
167
167
  const authHeader = await getAuthHeader({ ...options, request: { url: authInBodyUrl, method } }, telemetryName);
168
- const postBodyWithAuth = `--${formBoundary}\r\n` +
169
- `Authorization: ${authHeader}\r\n` +
170
- `X-HTTP-Method-Override: POST\r\n` +
171
- `Content-Type: application/json\r\n` +
172
- `_post: 1\r\n` +
173
- `\r\n${snapshotBody}\r\n` +
174
- `\r\n--${formBoundary}--`;
168
+ const postBodyWithAuthHeaders = [
169
+ `Authorization: ${authHeader}`,
170
+ `X-HTTP-Method-Override: POST`,
171
+ `Content-Type: application/json`,
172
+ ];
173
+ if (additionalHeaders !== undefined) {
174
+ for (const [key, value] of Object.entries(additionalHeaders)) {
175
+ postBodyWithAuthHeaders.push(`${key}: ${value}`);
176
+ }
177
+ }
178
+ const postBodyWithAuth = [
179
+ `--${formBoundary}`,
180
+ ...postBodyWithAuthHeaders,
181
+ `_post: 1`,
182
+ `\r\n${snapshotBody}`,
183
+ `\r\n--${formBoundary}--`,
184
+ ].join("\r\n");
175
185
  let postBody = snapshotBody;
176
186
  // We use the byte length of the post body to determine if we should use the multipart/form-data or not. This helps
177
187
  // in cases where the body contains data with different language where 1 char could be multiple code points.
@@ -188,6 +198,7 @@ export async function createNewFluidContainerCore(args) {
188
198
  url = initialUrl;
189
199
  const authHeaderNoUmp = await getAuthHeader({ ...options, request: { url, method } }, telemetryName);
190
200
  headers = {
201
+ ...additionalHeaders,
191
202
  ...getHeadersWithAuth(authHeaderNoUmp),
192
203
  "Content-Type": "application/json",
193
204
  };
@@ -1 +1 @@
1
- {"version":3,"file":"createNewUtils.js","sourceRoot":"","sources":["../../src/createFile/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAIN,WAAW,GACX,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AAC,UAAU;aAC3B,CAAC,CAAC;YAEH,OAAO,aAAa,CAAC,OAAO,CAAC;QAC9B,CAAC,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\tISummaryBlob,\n\tISummaryTree,\n\ttype SummaryObject,\n\tSummaryType,\n} from \"@fluidframework/driver-definitions\";\nimport { ISnapshot, ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tgetDocAttributesFromProtocolSummary,\n\tgetGitType,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils/internal\";\nimport { InstrumentedStorageTokenFetcher } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport {\n\tIOdspSummaryPayload,\n\tIOdspSummaryTree,\n\tOdspSummaryTreeEntry,\n\tOdspSummaryTreeValue,\n} from \"./../contracts.js\";\nimport { EpochTracker, FetchType } from \"./../epochTracker.js\";\nimport { getHeadersWithAuth } from \"./../getUrlAndHeadersWithAuth.js\";\nimport { checkForKnownServerFarmType } from \"./../odspUrlHelper.js\";\nimport { getWithRetryForTokenRefresh, maxUmpPostBodySize } from \"./../odspUtils.js\";\nimport { runWithRetry } from \"./../retryUtils.js\";\n\n/**\n * Converts a summary(ISummaryTree) taken in detached container to snapshot tree and blobs\n */\nexport function convertCreateNewSummaryTreeToTreeAndBlobs(\n\tsummary: ISummaryTree,\n\ttreeId: string,\n): ISnapshot {\n\tconst protocolSummary = summary.tree[\".protocol\"] as ISummaryTree;\n\tconst documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);\n\tconst sequenceNumber = documentAttributes.sequenceNumber;\n\tconst blobContents = new Map<string, ArrayBuffer>();\n\tconst snapshotTree = convertCreateNewSummaryTreeToTreeAndBlobsCore(summary, blobContents);\n\tsnapshotTree.id = treeId;\n\tconst snapshotTreeValue: ISnapshot = {\n\t\tsnapshotTree,\n\t\tblobContents,\n\t\tops: [],\n\t\tsequenceNumber,\n\t\tlatestSequenceNumber: sequenceNumber,\n\t\tsnapshotFormatV: 1,\n\t};\n\n\treturn snapshotTreeValue;\n}\n\nfunction convertCreateNewSummaryTreeToTreeAndBlobsCore(\n\tsummary: ISummaryTree,\n\tblobs: Map<string, ArrayBuffer>,\n): ISnapshotTree {\n\tconst treeNode: ISnapshotTree = {\n\t\tblobs: {},\n\t\ttrees: {},\n\t\tunreferenced: summary.unreferenced,\n\t\tgroupId: summary.groupId,\n\t};\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\ttreeNode.trees[key] = convertCreateNewSummaryTreeToTreeAndBlobsCore(\n\t\t\t\t\tsummaryObject,\n\t\t\t\t\tblobs,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tconst contentBuffer =\n\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t? stringToBuffer(summaryObject.content, \"utf8\")\n\t\t\t\t\t\t: summaryObject.content;\n\t\t\t\tconst blobId = uuid();\n\t\t\t\ttreeNode.blobs[key] = blobId;\n\t\t\t\tblobs.set(blobId, contentBuffer);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle:\n\t\t\tcase SummaryType.Attachment: {\n\t\t\t\tthrow new Error(`No ${summaryObject.type} should be present for detached summary!`);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(\n\t\t\t\t\tsummaryObject,\n\t\t\t\t\t`Unknown tree type ${(summaryObject as SummaryObject).type}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn treeNode;\n}\n\nexport function convertSummaryIntoContainerSnapshot(\n\tcreateNewSummary: ISummaryTree,\n): IOdspSummaryPayload {\n\tif (!isCombinedAppAndProtocolSummary(createNewSummary)) {\n\t\tthrow new Error(\"App and protocol summary required for create new path!!\");\n\t}\n\tconst appSummary = createNewSummary.tree[\".app\"];\n\tconst protocolSummary = createNewSummary.tree[\".protocol\"];\n\tconst documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);\n\tconst attributesSummaryBlob: ISummaryBlob = {\n\t\ttype: SummaryType.Blob,\n\t\tcontent: JSON.stringify(documentAttributes),\n\t};\n\tprotocolSummary.tree.attributes = attributesSummaryBlob;\n\tconst convertedCreateNewSummary: ISummaryTree = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: {\n\t\t\t\".protocol\": protocolSummary,\n\t\t\t\".app\": appSummary,\n\t\t},\n\t};\n\tconst snapshotTree = convertSummaryToSnapshotTreeForCreateNew(convertedCreateNewSummary);\n\tconst snapshot: IOdspSummaryPayload = {\n\t\tentries: snapshotTree.entries ?? [],\n\t\tmessage: \"app\",\n\t\tsequenceNumber: documentAttributes.sequenceNumber,\n\t\ttype: \"container\",\n\t};\n\treturn snapshot;\n}\n\n/**\n * Converts a summary tree to ODSP tree\n */\nfunction convertSummaryToSnapshotTreeForCreateNew(summary: ISummaryTree): IOdspSummaryTree {\n\tconst snapshotTree: IOdspSummaryTree = {\n\t\ttype: \"tree\",\n\t\tentries: [],\n\t};\n\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tassert(!key.includes(\"/\"), 0x9cc /* id should not include slashes */);\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tlet value: OdspSummaryTreeValue;\n\t\t// Tracks if an entry is unreferenced. Currently, only tree entries can be marked as unreferenced. If the\n\t\t// property is not present, the tree entry is considered referenced. If the property is present and is true,\n\t\t// the tree entry is considered unreferenced.\n\t\tlet unreferenced: true | undefined;\n\t\tlet groupId: string | undefined;\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\tvalue = convertSummaryToSnapshotTreeForCreateNew(summaryObject);\n\t\t\t\tunreferenced = summaryObject.unreferenced;\n\t\t\t\tgroupId = summaryObject.groupId;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tconst content =\n\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t? summaryObject.content\n\t\t\t\t\t\t: Uint8ArrayToString(summaryObject.content, \"base64\");\n\t\t\t\tconst encoding = typeof summaryObject.content === \"string\" ? \"utf-8\" : \"base64\";\n\n\t\t\t\tvalue = {\n\t\t\t\t\ttype: \"blob\",\n\t\t\t\t\tcontent,\n\t\t\t\t\tencoding,\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle: {\n\t\t\t\tthrow new Error(\"No handle should be present for first summary!!\");\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`Unknown tree type ${summaryObject.type}`);\n\t\t\t}\n\t\t}\n\n\t\tconst entry: OdspSummaryTreeEntry = {\n\t\t\tpath: key,\n\t\t\ttype: getGitType(summaryObject),\n\t\t\tvalue,\n\t\t\tunreferenced,\n\t\t\tgroupId,\n\t\t};\n\t\tsnapshotTree.entries?.push(entry);\n\t}\n\n\treturn snapshotTree;\n}\n\nexport async function createNewFluidContainerCore<T>(args: {\n\tcontainerSnapshot: IOdspSummaryPayload;\n\tgetAuthHeader: InstrumentedStorageTokenFetcher;\n\tlogger: ITelemetryLoggerExt;\n\tinitialUrl: string;\n\tforceAccessTokenViaAuthorizationHeader: boolean;\n\tepochTracker: EpochTracker;\n\ttelemetryName: string;\n\tfetchType: FetchType;\n\tvalidateResponseCallback?: (content: T) => void;\n}): Promise<T> {\n\tconst {\n\t\tcontainerSnapshot,\n\t\tgetAuthHeader,\n\t\tlogger,\n\t\tinitialUrl,\n\t\tepochTracker,\n\t\ttelemetryName,\n\t\tfetchType,\n\t\tvalidateResponseCallback,\n\t} = args;\n\tconst internalFarmType = checkForKnownServerFarmType(initialUrl);\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: telemetryName, details: { internalFarmType } },\n\t\t\tasync (event) => {\n\t\t\t\tconst snapshotBody = JSON.stringify(containerSnapshot);\n\t\t\t\tlet url: string;\n\t\t\t\tlet headers: { [index: string]: string };\n\t\t\t\tlet addInBody = false;\n\t\t\t\tconst formBoundary = uuid();\n\t\t\t\tconst urlObj = new URL(initialUrl);\n\t\t\t\turlObj.searchParams.set(\"ump\", \"1\");\n\t\t\t\tconst authInBodyUrl = urlObj.href;\n\t\t\t\tconst method = \"POST\";\n\t\t\t\tconst authHeader = await getAuthHeader(\n\t\t\t\t\t{ ...options, request: { url: authInBodyUrl, method } },\n\t\t\t\t\ttelemetryName,\n\t\t\t\t);\n\t\t\t\tconst postBodyWithAuth =\n\t\t\t\t\t`--${formBoundary}\\r\\n` +\n\t\t\t\t\t`Authorization: ${authHeader}\\r\\n` +\n\t\t\t\t\t`X-HTTP-Method-Override: POST\\r\\n` +\n\t\t\t\t\t`Content-Type: application/json\\r\\n` +\n\t\t\t\t\t`_post: 1\\r\\n` +\n\t\t\t\t\t`\\r\\n${snapshotBody}\\r\\n` +\n\t\t\t\t\t`\\r\\n--${formBoundary}--`;\n\n\t\t\t\tlet postBody = snapshotBody;\n\t\t\t\t// We use the byte length of the post body to determine if we should use the multipart/form-data or not. This helps\n\t\t\t\t// in cases where the body contains data with different language where 1 char could be multiple code points.\n\t\t\t\tif (\n\t\t\t\t\tnew TextEncoder().encode(postBodyWithAuth).length <= maxUmpPostBodySize &&\n\t\t\t\t\tauthHeader?.startsWith(\"Bearer\")\n\t\t\t\t) {\n\t\t\t\t\turl = authInBodyUrl;\n\t\t\t\t\theaders = {\n\t\t\t\t\t\t\"Content-Type\": `multipart/form-data;boundary=${formBoundary}`,\n\t\t\t\t\t};\n\t\t\t\t\taddInBody = true;\n\t\t\t\t\tpostBody = postBodyWithAuth;\n\t\t\t\t} else {\n\t\t\t\t\turl = initialUrl;\n\t\t\t\t\tconst authHeaderNoUmp = await getAuthHeader(\n\t\t\t\t\t\t{ ...options, request: { url, method } },\n\t\t\t\t\t\ttelemetryName,\n\t\t\t\t\t);\n\t\t\t\t\theaders = {\n\t\t\t\t\t\t...getHeadersWithAuth(authHeaderNoUmp),\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t};\n\t\t\t\t\tpostBody = snapshotBody;\n\t\t\t\t}\n\n\t\t\t\tconst fetchResponse = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<T>(\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,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfetchType,\n\t\t\t\t\t\t\taddInBody,\n\t\t\t\t\t\t),\n\t\t\t\t\ttelemetryName,\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tvalidateResponseCallback?.(fetchResponse.content);\n\n\t\t\t\tevent.end({\n\t\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\t\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\n\t\t\t\treturn fetchResponse.content;\n\t\t\t},\n\t\t);\n\t});\n}\n"]}
1
+ {"version":3,"file":"createNewUtils.js","sourceRoot":"","sources":["../../src/createFile/createNewUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,M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C;gBACF,QAAQ,GAAG,YAAY,CAAC;YACzB,CAAC;YAED,MAAM,aAAa,GAAG,MAAM,YAAY,CACvC,KAAK,IAAI,EAAE,CACV,YAAY,CAAC,mBAAmB,CAC/B,GAAG,EACH;gBACC,IAAI,EAAE,QAAQ;gBACd,OAAO;gBACP,MAAM;aACN,EACD,SAAS,EACT,SAAS,CACT,EACF,aAAa,EACb,MAAM,CACN,CAAC;YAEF,wBAAwB,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YAElD,KAAK,CAAC,GAAG,CAAC;gBACT,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACjC,GAAG,aAAa,CAAC,UAAU;aAC3B,CAAC,CAAC;YAEH,OAAO,aAAa,CAAC,OAAO,CAAC;QAC9B,CAAC,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport {\n\ttype ISummaryBlob,\n\ttype ISummaryTree,\n\ttype SummaryObject,\n\tSummaryType,\n} from \"@fluidframework/driver-definitions\";\nimport type { ISnapshot, ISnapshotTree } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tgetDocAttributesFromProtocolSummary,\n\tgetGitType,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils/internal\";\nimport type { InstrumentedStorageTokenFetcher } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type {\n\tIOdspSummaryPayload,\n\tIOdspSummaryTree,\n\tOdspSummaryTreeEntry,\n\tOdspSummaryTreeValue,\n} from \"./../contracts.js\";\nimport type { EpochTracker, FetchType } from \"./../epochTracker.js\";\nimport { getHeadersWithAuth } from \"./../getUrlAndHeadersWithAuth.js\";\nimport { checkForKnownServerFarmType } from \"./../odspUrlHelper.js\";\nimport { getWithRetryForTokenRefresh, maxUmpPostBodySize } from \"./../odspUtils.js\";\nimport { runWithRetry } from \"./../retryUtils.js\";\n\n/**\n * Converts a summary(ISummaryTree) taken in detached container to snapshot tree and blobs\n */\nexport function convertCreateNewSummaryTreeToTreeAndBlobs(\n\tsummary: ISummaryTree,\n\ttreeId: string,\n): ISnapshot {\n\tconst protocolSummary = summary.tree[\".protocol\"] as ISummaryTree;\n\tconst documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);\n\tconst sequenceNumber = documentAttributes.sequenceNumber;\n\tconst blobContents = new Map<string, ArrayBuffer>();\n\tconst snapshotTree = convertCreateNewSummaryTreeToTreeAndBlobsCore(summary, blobContents);\n\tsnapshotTree.id = treeId;\n\tconst snapshotTreeValue: ISnapshot = {\n\t\tsnapshotTree,\n\t\tblobContents,\n\t\tops: [],\n\t\tsequenceNumber,\n\t\tlatestSequenceNumber: sequenceNumber,\n\t\tsnapshotFormatV: 1,\n\t};\n\n\treturn snapshotTreeValue;\n}\n\nfunction convertCreateNewSummaryTreeToTreeAndBlobsCore(\n\tsummary: ISummaryTree,\n\tblobs: Map<string, ArrayBuffer>,\n): ISnapshotTree {\n\tconst treeNode: ISnapshotTree = {\n\t\tblobs: {},\n\t\ttrees: {},\n\t\tunreferenced: summary.unreferenced,\n\t\tgroupId: summary.groupId,\n\t};\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\ttreeNode.trees[key] = convertCreateNewSummaryTreeToTreeAndBlobsCore(\n\t\t\t\t\tsummaryObject,\n\t\t\t\t\tblobs,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tconst contentBuffer =\n\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t? stringToBuffer(summaryObject.content, \"utf8\")\n\t\t\t\t\t\t: summaryObject.content;\n\t\t\t\tconst blobId = uuid();\n\t\t\t\ttreeNode.blobs[key] = blobId;\n\t\t\t\tblobs.set(blobId, contentBuffer);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle:\n\t\t\tcase SummaryType.Attachment: {\n\t\t\t\tthrow new Error(`No ${summaryObject.type} should be present for detached summary!`);\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tunreachableCase(\n\t\t\t\t\tsummaryObject,\n\t\t\t\t\t`Unknown tree type ${(summaryObject as SummaryObject).type}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\treturn treeNode;\n}\n\nexport function convertSummaryIntoContainerSnapshot(\n\tcreateNewSummary: ISummaryTree,\n): IOdspSummaryPayload {\n\tif (!isCombinedAppAndProtocolSummary(createNewSummary)) {\n\t\tthrow new Error(\"App and protocol summary required for create new path!!\");\n\t}\n\tconst appSummary = createNewSummary.tree[\".app\"];\n\tconst protocolSummary = createNewSummary.tree[\".protocol\"];\n\tconst documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);\n\tconst attributesSummaryBlob: ISummaryBlob = {\n\t\ttype: SummaryType.Blob,\n\t\tcontent: JSON.stringify(documentAttributes),\n\t};\n\tprotocolSummary.tree.attributes = attributesSummaryBlob;\n\tconst convertedCreateNewSummary: ISummaryTree = {\n\t\ttype: SummaryType.Tree,\n\t\ttree: {\n\t\t\t\".protocol\": protocolSummary,\n\t\t\t\".app\": appSummary,\n\t\t},\n\t};\n\tconst snapshotTree = convertSummaryToSnapshotTreeForCreateNew(convertedCreateNewSummary);\n\tconst snapshot: IOdspSummaryPayload = {\n\t\tentries: snapshotTree.entries ?? [],\n\t\tmessage: \"app\",\n\t\tsequenceNumber: documentAttributes.sequenceNumber,\n\t\ttype: \"container\",\n\t};\n\treturn snapshot;\n}\n\n/**\n * Converts a summary tree to ODSP tree\n */\nfunction convertSummaryToSnapshotTreeForCreateNew(summary: ISummaryTree): IOdspSummaryTree {\n\tconst snapshotTree: IOdspSummaryTree = {\n\t\ttype: \"tree\",\n\t\tentries: [],\n\t};\n\n\tconst keys = Object.keys(summary.tree);\n\tfor (const key of keys) {\n\t\tassert(!key.includes(\"/\"), 0x9cc /* id should not include slashes */);\n\t\tconst summaryObject = summary.tree[key];\n\n\t\tlet value: OdspSummaryTreeValue;\n\t\t// Tracks if an entry is unreferenced. Currently, only tree entries can be marked as unreferenced. If the\n\t\t// property is not present, the tree entry is considered referenced. If the property is present and is true,\n\t\t// the tree entry is considered unreferenced.\n\t\tlet unreferenced: true | undefined;\n\t\tlet groupId: string | undefined;\n\n\t\tswitch (summaryObject.type) {\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\tvalue = convertSummaryToSnapshotTreeForCreateNew(summaryObject);\n\t\t\t\tunreferenced = summaryObject.unreferenced;\n\t\t\t\tgroupId = summaryObject.groupId;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tconst content =\n\t\t\t\t\ttypeof summaryObject.content === \"string\"\n\t\t\t\t\t\t? summaryObject.content\n\t\t\t\t\t\t: Uint8ArrayToString(summaryObject.content, \"base64\");\n\t\t\t\tconst encoding = typeof summaryObject.content === \"string\" ? \"utf-8\" : \"base64\";\n\n\t\t\t\tvalue = {\n\t\t\t\t\ttype: \"blob\",\n\t\t\t\t\tcontent,\n\t\t\t\t\tencoding,\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase SummaryType.Handle: {\n\t\t\t\tthrow new Error(\"No handle should be present for first summary!!\");\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new Error(`Unknown tree type ${summaryObject.type}`);\n\t\t\t}\n\t\t}\n\n\t\tconst entry: OdspSummaryTreeEntry = {\n\t\t\tpath: key,\n\t\t\ttype: getGitType(summaryObject),\n\t\t\tvalue,\n\t\t\tunreferenced,\n\t\t\tgroupId,\n\t\t};\n\t\tsnapshotTree.entries?.push(entry);\n\t}\n\n\treturn snapshotTree;\n}\n\nexport async function createNewFluidContainerCore<T>(args: {\n\tcontainerSnapshot: IOdspSummaryPayload;\n\tgetAuthHeader: InstrumentedStorageTokenFetcher;\n\tlogger: ITelemetryLoggerExt;\n\tinitialUrl: string;\n\tforceAccessTokenViaAuthorizationHeader: boolean;\n\tepochTracker: EpochTracker;\n\ttelemetryName: string;\n\tfetchType: FetchType;\n\tvalidateResponseCallback?: (content: T) => void;\n\tadditionalHeaders?: { [key: string]: string };\n}): Promise<T> {\n\tconst {\n\t\tcontainerSnapshot,\n\t\tgetAuthHeader,\n\t\tlogger,\n\t\tinitialUrl,\n\t\tepochTracker,\n\t\ttelemetryName,\n\t\tfetchType,\n\t\tvalidateResponseCallback,\n\t\tadditionalHeaders = {},\n\t} = args;\n\tconst internalFarmType = checkForKnownServerFarmType(initialUrl);\n\n\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{ eventName: telemetryName, details: { internalFarmType } },\n\t\t\tasync (event) => {\n\t\t\t\tconst snapshotBody = JSON.stringify(containerSnapshot);\n\t\t\t\tlet url: string;\n\t\t\t\tlet headers: { [index: string]: string };\n\t\t\t\tlet addInBody = false;\n\t\t\t\tconst formBoundary = uuid();\n\t\t\t\tconst urlObj = new URL(initialUrl);\n\t\t\t\turlObj.searchParams.set(\"ump\", \"1\");\n\t\t\t\tconst authInBodyUrl = urlObj.href;\n\t\t\t\tconst method = \"POST\";\n\t\t\t\tconst authHeader = await getAuthHeader(\n\t\t\t\t\t{ ...options, request: { url: authInBodyUrl, method } },\n\t\t\t\t\ttelemetryName,\n\t\t\t\t);\n\t\t\t\tconst postBodyWithAuthHeaders = [\n\t\t\t\t\t`Authorization: ${authHeader}`,\n\t\t\t\t\t`X-HTTP-Method-Override: POST`,\n\t\t\t\t\t`Content-Type: application/json`,\n\t\t\t\t];\n\t\t\t\tif (additionalHeaders !== undefined) {\n\t\t\t\t\tfor (const [key, value] of Object.entries(additionalHeaders)) {\n\t\t\t\t\t\tpostBodyWithAuthHeaders.push(`${key}: ${value}`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst postBodyWithAuth = [\n\t\t\t\t\t`--${formBoundary}`,\n\t\t\t\t\t...postBodyWithAuthHeaders,\n\t\t\t\t\t`_post: 1`,\n\t\t\t\t\t`\\r\\n${snapshotBody}`,\n\t\t\t\t\t`\\r\\n--${formBoundary}--`,\n\t\t\t\t].join(\"\\r\\n\");\n\n\t\t\t\tlet postBody = snapshotBody;\n\t\t\t\t// We use the byte length of the post body to determine if we should use the multipart/form-data or not. This helps\n\t\t\t\t// in cases where the body contains data with different language where 1 char could be multiple code points.\n\t\t\t\tif (\n\t\t\t\t\tnew TextEncoder().encode(postBodyWithAuth).length <= maxUmpPostBodySize &&\n\t\t\t\t\tauthHeader?.startsWith(\"Bearer\")\n\t\t\t\t) {\n\t\t\t\t\turl = authInBodyUrl;\n\t\t\t\t\theaders = {\n\t\t\t\t\t\t\"Content-Type\": `multipart/form-data;boundary=${formBoundary}`,\n\t\t\t\t\t};\n\t\t\t\t\taddInBody = true;\n\t\t\t\t\tpostBody = postBodyWithAuth;\n\t\t\t\t} else {\n\t\t\t\t\turl = initialUrl;\n\t\t\t\t\tconst authHeaderNoUmp = await getAuthHeader(\n\t\t\t\t\t\t{ ...options, request: { url, method } },\n\t\t\t\t\t\ttelemetryName,\n\t\t\t\t\t);\n\t\t\t\t\theaders = {\n\t\t\t\t\t\t...additionalHeaders,\n\t\t\t\t\t\t...getHeadersWithAuth(authHeaderNoUmp),\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t};\n\t\t\t\t\tpostBody = snapshotBody;\n\t\t\t\t}\n\n\t\t\t\tconst fetchResponse = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<T>(\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,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfetchType,\n\t\t\t\t\t\t\taddInBody,\n\t\t\t\t\t\t),\n\t\t\t\t\ttelemetryName,\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tvalidateResponseCallback?.(fetchResponse.content);\n\n\t\t\t\tevent.end({\n\t\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\t\t...fetchResponse.propsToLog,\n\t\t\t\t});\n\n\t\t\t\treturn fetchResponse.content;\n\t\t\t},\n\t\t);\n\t});\n}\n"]}
@@ -2,6 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
5
+ import type { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
6
6
  export declare function useCreateNewModule<T = void>(odspLogger: ITelemetryLoggerExt, func: (m: typeof import("./createNewModule.js")) => Promise<T>): Promise<T>;
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/createFile/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,wBAAsB,kBAAkB,CAAC,CAAC,GAAG,IAAI,EAChD,UAAU,EAAE,mBAAmB,EAC/B,IAAI,EAAE,CACL,CAAC,EAAE,cAAc,sBAAsB,CAAC,KACpC,OAAO,CAAC,CAAC,CAAC,GACb,OAAO,CAAC,CAAC,CAAC,CAeZ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/createFile/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAEpF,wBAAsB,kBAAkB,CAAC,CAAC,GAAG,IAAI,EAChD,UAAU,EAAE,mBAAmB,EAC/B,IAAI,EAAE,CAEL,CAAC,EAAE,cAAc,sBAAsB,CAAC,KACpC,OAAO,CAAC,CAAC,CAAC,GACb,OAAO,CAAC,CAAC,CAAC,CAeZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/createFile/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACvC,UAA+B,EAC/B,IAEe;IAEf,gGAAgG;IAChG,sGAAsG;IACtG,sBAAsB;IACtB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,yCAAyC,CAAC,sBAAsB,CAAC;SAC3F,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,UAAU,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC,CAAC;QACtE,OAAO,CAAC,CAAC;IACV,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAChB,UAAU,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,2BAA2B,EAAE,EAAE,KAAK,CAAC,CAAC;QAC7E,MAAM,KAAK,CAAC;IACb,CAAC,CAAC,CAAC;IAEJ,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nexport async function useCreateNewModule<T = void>(\n\todspLogger: ITelemetryLoggerExt,\n\tfunc: (\n\t\tm: typeof import(\"./createNewModule.js\") /* webpackChunkName: \"createNewModule\" */,\n\t) => Promise<T>,\n): Promise<T> {\n\t// We can delay load this module as this path will not be executed in load flows and create flow\n\t// while only happens once in lifetime of a document which happens in the background after creation of\n\t// detached container.\n\tconst module = await import(/* webpackChunkName: \"createNewModule\" */ \"./createNewModule.js\")\n\t\t.then((m) => {\n\t\t\todspLogger.sendTelemetryEvent({ eventName: \"createNewModuleLoaded\" });\n\t\t\treturn m;\n\t\t})\n\t\t.catch((error) => {\n\t\t\todspLogger.sendErrorEvent({ eventName: \"createNewModuleLoadFailed\" }, error);\n\t\t\tthrow error;\n\t\t});\n\n\treturn func(module);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/createFile/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACvC,UAA+B,EAC/B,IAGe;IAEf,gGAAgG;IAChG,sGAAsG;IACtG,sBAAsB;IACtB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,yCAAyC,CAAC,sBAAsB,CAAC;SAC3F,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,UAAU,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC,CAAC;QACtE,OAAO,CAAC,CAAC;IACV,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAChB,UAAU,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,2BAA2B,EAAE,EAAE,KAAK,CAAC,CAAC;QAC7E,MAAM,KAAK,CAAC;IACb,CAAC,CAAC,CAAC;IAEJ,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\nexport async function useCreateNewModule<T = void>(\n\todspLogger: ITelemetryLoggerExt,\n\tfunc: (\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-imports\n\t\tm: typeof import(\"./createNewModule.js\") /* webpackChunkName: \"createNewModule\" */,\n\t) => Promise<T>,\n): Promise<T> {\n\t// We can delay load this module as this path will not be executed in load flows and create flow\n\t// while only happens once in lifetime of a document which happens in the background after creation of\n\t// detached container.\n\tconst module = await import(/* webpackChunkName: \"createNewModule\" */ \"./createNewModule.js\")\n\t\t.then((m) => {\n\t\t\todspLogger.sendTelemetryEvent({ eventName: \"createNewModuleLoaded\" });\n\t\t\treturn m;\n\t\t})\n\t\t.catch((error) => {\n\t\t\todspLogger.sendErrorEvent({ eventName: \"createNewModuleLoadFailed\" }, error);\n\t\t\tthrow error;\n\t\t});\n\n\treturn func(module);\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IRequest } from "@fluidframework/core-interfaces";
5
+ import type { IRequest } from "@fluidframework/core-interfaces";
6
6
  import { type IContainerPackageInfo } from "@fluidframework/driver-definitions/internal";
7
- import { ISharingLinkKind } from "@fluidframework/odsp-driver-definitions/internal";
7
+ import type { ISharingLinkKind } from "@fluidframework/odsp-driver-definitions/internal";
8
8
  /**
9
9
  * Create the request object with url and headers for creating a new file on OneDrive Sharepoint
10
10
  * @param siteUrl - Base url for OneDrive
@@ -1 +1 @@
1
- {"version":3,"file":"createOdspCreateContainerRequest.d.ts","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAEN,KAAK,qBAAqB,EAC1B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAIpF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAC/C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,gBAAgB,EACtC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,SAAS,GACtD,QAAQ,CAaV"}
1
+ {"version":3,"file":"createOdspCreateContainerRequest.d.ts","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAEN,KAAK,qBAAqB,EAC1B,MAAM,6CAA6C,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAIzF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAC/C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,gBAAgB,EACtC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,SAAS,GACtD,QAAQ,CAaV"}
@@ -1 +1 @@
1
- {"version":3,"file":"createOdspCreateContainerRequest.js","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,YAAY,GAEZ,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEtF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gCAAgC,CAC/C,OAAe,EACf,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,mBAAsC,EACtC,oBAAwD;IAExD,MAAM,sBAAsB,GAAG,2BAA2B,CAAC,mBAAmB,CAAC,CAAC;IAChF,MAAM,gBAAgB,GAAa;QAClC,GAAG,EAAE,GAAG,OAAO,YAAY,kBAAkB,CAAC,OAAO,CAAC,SAAS,kBAAkB,CAChF,QAAQ,CACR,GAAG,oBAAoB,CAAC,CAAC,CAAC,yBAAyB,uBAAuB,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,sBAAsB,CAAC,CAAC,CAAC,IAAI,sBAAsB,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;QACvK,OAAO,EAAE;YACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;gBACzB,QAAQ;aACR;SACD;KACD,CAAC;IACF,OAAO,gBAAgB,CAAC;AACzB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverHeader,\n\ttype IContainerPackageInfo,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { ISharingLinkKind } from \"@fluidframework/odsp-driver-definitions/internal\";\n\nimport { buildOdspShareLinkReqParams, getContainerPackageName } from \"./odspUtils.js\";\n\n/**\n * Create the request object with url and headers for creating a new file on OneDrive Sharepoint\n * @param siteUrl - Base url for OneDrive\n * @param driveId - drive identifier\n * @param filePath - path where file needs to be created\n * @param fileName - name of the new file to be created\n * @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes\n * will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink\n * @param containerPackageInfo - Container package information which will be used to extract the container package name.\n * If not given that means that the container package does not have a name.\n * @legacy\n * @alpha\n */\nexport function createOdspCreateContainerRequest(\n\tsiteUrl: string,\n\tdriveId: string,\n\tfilePath: string,\n\tfileName: string,\n\tcreateShareLinkType?: ISharingLinkKind,\n\tcontainerPackageInfo?: IContainerPackageInfo | undefined,\n): IRequest {\n\tconst shareLinkRequestParams = buildOdspShareLinkReqParams(createShareLinkType);\n\tconst createNewRequest: IRequest = {\n\t\turl: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(\n\t\t\tfilePath,\n\t\t)}${containerPackageInfo ? `&containerPackageName=${getContainerPackageName(containerPackageInfo)}` : \"\"}${shareLinkRequestParams ? `&${shareLinkRequestParams}` : \"\"}`,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: {\n\t\t\t\tfileName,\n\t\t\t},\n\t\t},\n\t};\n\treturn createNewRequest;\n}\n"]}
1
+ {"version":3,"file":"createOdspCreateContainerRequest.js","sourceRoot":"","sources":["../src/createOdspCreateContainerRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,YAAY,GAEZ,MAAM,6CAA6C,CAAC;AAGrD,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEtF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gCAAgC,CAC/C,OAAe,EACf,OAAe,EACf,QAAgB,EAChB,QAAgB,EAChB,mBAAsC,EACtC,oBAAwD;IAExD,MAAM,sBAAsB,GAAG,2BAA2B,CAAC,mBAAmB,CAAC,CAAC;IAChF,MAAM,gBAAgB,GAAa;QAClC,GAAG,EAAE,GAAG,OAAO,YAAY,kBAAkB,CAAC,OAAO,CAAC,SAAS,kBAAkB,CAChF,QAAQ,CACR,GAAG,oBAAoB,CAAC,CAAC,CAAC,yBAAyB,uBAAuB,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,sBAAsB,CAAC,CAAC,CAAC,IAAI,sBAAsB,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;QACvK,OAAO,EAAE;YACR,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;gBACzB,QAAQ;aACR;SACD;KACD,CAAC;IACF,OAAO,gBAAgB,CAAC;AACzB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverHeader,\n\ttype IContainerPackageInfo,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type { ISharingLinkKind } from \"@fluidframework/odsp-driver-definitions/internal\";\n\nimport { buildOdspShareLinkReqParams, getContainerPackageName } from \"./odspUtils.js\";\n\n/**\n * Create the request object with url and headers for creating a new file on OneDrive Sharepoint\n * @param siteUrl - Base url for OneDrive\n * @param driveId - drive identifier\n * @param filePath - path where file needs to be created\n * @param fileName - name of the new file to be created\n * @param createShareLinkType - type of sharing link you would like to create for this file. ShareLinkTypes\n * will be deprecated soon, so for any new implementation please provide createShareLinkType of type ShareLink\n * @param containerPackageInfo - Container package information which will be used to extract the container package name.\n * If not given that means that the container package does not have a name.\n * @legacy\n * @alpha\n */\nexport function createOdspCreateContainerRequest(\n\tsiteUrl: string,\n\tdriveId: string,\n\tfilePath: string,\n\tfileName: string,\n\tcreateShareLinkType?: ISharingLinkKind,\n\tcontainerPackageInfo?: IContainerPackageInfo | undefined,\n): IRequest {\n\tconst shareLinkRequestParams = buildOdspShareLinkReqParams(createShareLinkType);\n\tconst createNewRequest: IRequest = {\n\t\turl: `${siteUrl}?driveId=${encodeURIComponent(driveId)}&path=${encodeURIComponent(\n\t\t\tfilePath,\n\t\t)}${containerPackageInfo ? `&containerPackageName=${getContainerPackageName(containerPackageInfo)}` : \"\"}${shareLinkRequestParams ? `&${shareLinkRequestParams}` : \"\"}`,\n\t\theaders: {\n\t\t\t[DriverHeader.createNew]: {\n\t\t\t\tfileName,\n\t\t\t},\n\t\t},\n\t};\n\treturn createNewRequest;\n}\n"]}
@@ -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.js";
5
+ import type { OdspFluidDataStoreLocator } from "./contractsPublic.js";
6
6
  /**
7
7
  * Encodes ODC/SPO information into a URL format that can be handled by the Loader
8
8
  * @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it
@@ -1 +1 @@
1
- {"version":3,"file":"createOdspUrl.d.ts","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAMjE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,yBAAyB,GAAG,MAAM,CAYlE"}
1
+ {"version":3,"file":"createOdspUrl.d.ts","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAMtE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,yBAAyB,GAAG,MAAM,CAYlE"}
@@ -1 +1 @@
1
- {"version":3,"file":"createOdspUrl.js","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,CAA4B;IACzD,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,YAAY,kBAAkB,CACvD,CAAC,CAAC,OAAO,CACT,WAAW,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;IACvF,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;QAC5B,OAAO,IAAI,yBAAyB,kBAAkB,CAAC,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC;IAClF,CAAC;IACD,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,gBAAgB,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { OdspFluidDataStoreLocator } from \"./contractsPublic.js\";\n\n/*\n * Per https://github.com/microsoft/FluidFramework/issues/1556, isolating createOdspUrl() in its own file.\n */\n\n/**\n * Encodes ODC/SPO information into a URL format that can be handled by the Loader\n * @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it\n * @legacy\n * @alpha\n */\nexport function createOdspUrl(l: OdspFluidDataStoreLocator): string {\n\tlet odspUrl = `${l.siteUrl}?driveId=${encodeURIComponent(\n\t\tl.driveId,\n\t)}&itemId=${encodeURIComponent(l.itemId)}&path=${encodeURIComponent(l.dataStorePath)}`;\n\tif (l.containerPackageName) {\n\t\todspUrl += `&containerPackageName=${encodeURIComponent(l.containerPackageName)}`;\n\t}\n\tif (l.fileVersion) {\n\t\todspUrl += `&fileVersion=${encodeURIComponent(l.fileVersion)}`;\n\t}\n\n\treturn odspUrl;\n}\n"]}
1
+ {"version":3,"file":"createOdspUrl.js","sourceRoot":"","sources":["../src/createOdspUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,CAA4B;IACzD,IAAI,OAAO,GAAG,GAAG,CAAC,CAAC,OAAO,YAAY,kBAAkB,CACvD,CAAC,CAAC,OAAO,CACT,WAAW,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC;IACvF,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;QAC5B,OAAO,IAAI,yBAAyB,kBAAkB,CAAC,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC;IAClF,CAAC;IACD,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,IAAI,gBAAgB,kBAAkB,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { OdspFluidDataStoreLocator } from \"./contractsPublic.js\";\n\n/*\n * Per https://github.com/microsoft/FluidFramework/issues/1556, isolating createOdspUrl() in its own file.\n */\n\n/**\n * Encodes ODC/SPO information into a URL format that can be handled by the Loader\n * @param l -The property bag of necessary properties to locate a Fluid data store and craft a url for it\n * @legacy\n * @alpha\n */\nexport function createOdspUrl(l: OdspFluidDataStoreLocator): string {\n\tlet odspUrl = `${l.siteUrl}?driveId=${encodeURIComponent(\n\t\tl.driveId,\n\t)}&itemId=${encodeURIComponent(l.itemId)}&path=${encodeURIComponent(l.dataStorePath)}`;\n\tif (l.containerPackageName) {\n\t\todspUrl += `&containerPackageName=${encodeURIComponent(l.containerPackageName)}`;\n\t}\n\tif (l.fileVersion) {\n\t\todspUrl += `&fileVersion=${encodeURIComponent(l.fileVersion)}`;\n\t}\n\n\treturn odspUrl;\n}\n"]}
@@ -3,10 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { RateLimiter } from "@fluidframework/driver-utils/internal";
6
- import { IEntry, IFileEntry, IPersistedCache } from "@fluidframework/odsp-driver-definitions/internal";
7
- import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
8
- import { INonPersistentCache, IOdspCache, IPersistedFileCache } from "./odspCache.js";
9
- import { IOdspResponse } from "./odspUtils.js";
6
+ import { type IEntry, type IFileEntry, type IPersistedCache } from "@fluidframework/odsp-driver-definitions/internal";
7
+ import { type ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
8
+ import type { INonPersistentCache, IOdspCache, IPersistedFileCache } from "./odspCache.js";
9
+ import { type IOdspResponse } from "./odspUtils.js";
10
10
  /**
11
11
  * @legacy
12
12
  * @alpha
@@ -1 +1 @@
1
- {"version":3,"file":"epochTracker.d.ts","sourceRoot":"","sources":["../src/epochTracker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAGN,WAAW,EAEX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEN,MAAM,EACN,UAAU,EAIV,eAAe,EAKf,MAAM,kDAAkD,CAAC;AAC1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