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

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 (661) hide show
  1. package/.eslintrc.js +12 -12
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +162 -0
  4. package/README.md +56 -0
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/odsp-driver.api.md +310 -0
  8. package/dist/{ReadBufferUtils.js → ReadBufferUtils.cjs} +16 -9
  9. package/dist/ReadBufferUtils.cjs.map +1 -0
  10. package/dist/ReadBufferUtils.d.ts.map +1 -1
  11. package/dist/{WriteBufferUtils.js → WriteBufferUtils.cjs} +73 -69
  12. package/dist/WriteBufferUtils.cjs.map +1 -0
  13. package/dist/WriteBufferUtils.d.ts +3 -5
  14. package/dist/WriteBufferUtils.d.ts.map +1 -1
  15. package/dist/{checkUrl.js → checkUrl.cjs} +7 -6
  16. package/dist/checkUrl.cjs.map +1 -0
  17. package/dist/checkUrl.d.ts +1 -0
  18. package/dist/checkUrl.d.ts.map +1 -1
  19. package/dist/compactSnapshotParser.cjs +207 -0
  20. package/dist/compactSnapshotParser.cjs.map +1 -0
  21. package/dist/compactSnapshotParser.d.ts +12 -3
  22. package/dist/compactSnapshotParser.d.ts.map +1 -1
  23. package/dist/{compactSnapshotWriter.js → compactSnapshotWriter.cjs} +43 -33
  24. package/dist/compactSnapshotWriter.cjs.map +1 -0
  25. package/dist/compactSnapshotWriter.d.ts +2 -3
  26. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  27. package/dist/{constants.js → constants.cjs} +7 -1
  28. package/dist/constants.cjs.map +1 -0
  29. package/dist/constants.d.ts +6 -0
  30. package/dist/constants.d.ts.map +1 -1
  31. package/dist/{contracts.js → contracts.cjs} +1 -1
  32. package/dist/contracts.cjs.map +1 -0
  33. package/dist/contracts.d.ts +16 -53
  34. package/dist/contracts.d.ts.map +1 -1
  35. package/dist/{contractsPublic.js → contractsPublic.cjs} +9 -3
  36. package/dist/contractsPublic.cjs.map +1 -0
  37. package/dist/contractsPublic.d.ts +15 -0
  38. package/dist/contractsPublic.d.ts.map +1 -1
  39. package/dist/createFile.cjs +177 -0
  40. package/dist/createFile.cjs.map +1 -0
  41. package/dist/createFile.d.ts +6 -10
  42. package/dist/createFile.d.ts.map +1 -1
  43. package/dist/createNewContainerOnExistingFile.cjs +60 -0
  44. package/dist/createNewContainerOnExistingFile.cjs.map +1 -0
  45. package/dist/createNewContainerOnExistingFile.d.ts +22 -0
  46. package/dist/createNewContainerOnExistingFile.d.ts.map +1 -0
  47. package/dist/createNewModule.cjs +12 -0
  48. package/dist/createNewModule.cjs.map +1 -0
  49. package/dist/createNewModule.d.ts +7 -0
  50. package/dist/createNewModule.d.ts.map +1 -0
  51. package/dist/createNewUtils.cjs +203 -0
  52. package/dist/createNewUtils.cjs.map +1 -0
  53. package/dist/createNewUtils.d.ts +16 -0
  54. package/dist/createNewUtils.d.ts.map +1 -1
  55. package/dist/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.cjs} +8 -4
  56. package/dist/createOdspCreateContainerRequest.cjs.map +1 -0
  57. package/dist/createOdspCreateContainerRequest.d.ts +5 -3
  58. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  59. package/dist/{createOdspUrl.js → createOdspUrl.cjs} +2 -1
  60. package/dist/createOdspUrl.cjs.map +1 -0
  61. package/dist/createOdspUrl.d.ts +1 -0
  62. package/dist/createOdspUrl.d.ts.map +1 -1
  63. package/dist/{epochTracker.js → epochTracker.cjs} +102 -48
  64. package/dist/epochTracker.cjs.map +1 -0
  65. package/dist/epochTracker.d.ts +32 -8
  66. package/dist/epochTracker.d.ts.map +1 -1
  67. package/dist/{fetch.js → fetch.cjs} +1 -1
  68. package/dist/fetch.cjs.map +1 -0
  69. package/dist/fetch.d.ts +1 -1
  70. package/dist/fetch.d.ts.map +1 -1
  71. package/dist/{fetchSnapshot.js → fetchSnapshot.cjs} +192 -176
  72. package/dist/fetchSnapshot.cjs.map +1 -0
  73. package/dist/fetchSnapshot.d.ts +10 -5
  74. package/dist/fetchSnapshot.d.ts.map +1 -1
  75. package/dist/{getFileLink.js → getFileLink.cjs} +52 -41
  76. package/dist/getFileLink.cjs.map +1 -0
  77. package/dist/getFileLink.d.ts +4 -7
  78. package/dist/getFileLink.d.ts.map +1 -1
  79. package/dist/{getQueryString.js → getQueryString.cjs} +1 -1
  80. package/dist/getQueryString.cjs.map +1 -0
  81. package/dist/getQueryString.d.ts.map +1 -1
  82. package/dist/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.cjs} +4 -2
  83. package/dist/getUrlAndHeadersWithAuth.cjs.map +1 -0
  84. package/dist/getUrlAndHeadersWithAuth.d.ts.map +1 -1
  85. package/dist/index.cjs +59 -0
  86. package/dist/index.cjs.map +1 -0
  87. package/dist/index.d.ts +19 -16
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs +35 -0
  90. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +1 -0
  91. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +17 -0
  92. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
  93. package/dist/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.cjs} +7 -5
  94. package/dist/localOdspDriver/localOdspDocumentService.cjs.map +1 -0
  95. package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
  96. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  97. package/dist/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.cjs} +9 -10
  98. package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +1 -0
  99. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +2 -3
  100. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  101. package/dist/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.cjs} +13 -11
  102. package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +1 -0
  103. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -2
  104. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  105. package/dist/odsp-driver-alpha.d.ts +497 -0
  106. package/dist/odsp-driver-beta.d.ts +159 -0
  107. package/dist/odsp-driver-public.d.ts +159 -0
  108. package/dist/odsp-driver-untrimmed.d.ts +566 -0
  109. package/dist/{odspCache.js → odspCache.cjs} +9 -10
  110. package/dist/odspCache.cjs.map +1 -0
  111. package/dist/odspCache.d.ts +19 -4
  112. package/dist/odspCache.d.ts.map +1 -1
  113. package/dist/odspDelayLoadedDeltaStream.cjs +291 -0
  114. package/dist/odspDelayLoadedDeltaStream.cjs.map +1 -0
  115. package/dist/odspDelayLoadedDeltaStream.d.ts +75 -0
  116. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -0
  117. package/dist/{odspDeltaStorageService.js → odspDeltaStorageService.cjs} +70 -71
  118. package/dist/odspDeltaStorageService.cjs.map +1 -0
  119. package/dist/odspDeltaStorageService.d.ts +8 -6
  120. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  121. package/dist/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.cjs} +224 -113
  122. package/dist/odspDocumentDeltaConnection.cjs.map +1 -0
  123. package/dist/odspDocumentDeltaConnection.d.ts +32 -12
  124. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  125. package/dist/odspDocumentService.cjs +225 -0
  126. package/dist/odspDocumentService.cjs.map +1 -0
  127. package/dist/odspDocumentService.d.ts +11 -25
  128. package/dist/odspDocumentService.d.ts.map +1 -1
  129. package/dist/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.cjs} +8 -5
  130. package/dist/odspDocumentServiceFactory.cjs.map +1 -0
  131. package/dist/odspDocumentServiceFactory.d.ts +4 -0
  132. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  133. package/dist/odspDocumentServiceFactoryCore.cjs +196 -0
  134. package/dist/odspDocumentServiceFactoryCore.cjs.map +1 -0
  135. package/dist/odspDocumentServiceFactoryCore.d.ts +16 -11
  136. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  137. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs +20 -0
  138. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +1 -0
  139. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +5 -0
  140. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
  141. package/dist/odspDocumentStorageManager.cjs +490 -0
  142. package/dist/odspDocumentStorageManager.cjs.map +1 -0
  143. package/dist/odspDocumentStorageManager.d.ts +11 -5
  144. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  145. package/dist/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.cjs} +32 -34
  146. package/dist/odspDocumentStorageServiceBase.cjs.map +1 -0
  147. package/dist/odspDocumentStorageServiceBase.d.ts +7 -9
  148. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  149. package/dist/{odspDriverUrlResolver.js → odspDriverUrlResolver.cjs} +50 -36
  150. package/dist/odspDriverUrlResolver.cjs.map +1 -0
  151. package/dist/odspDriverUrlResolver.d.ts +12 -0
  152. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  153. package/dist/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.cjs} +37 -26
  154. package/dist/odspDriverUrlResolverForShareLink.cjs.map +1 -0
  155. package/dist/odspDriverUrlResolverForShareLink.d.ts +5 -3
  156. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  157. package/dist/{odspError.js → odspError.cjs} +7 -3
  158. package/dist/odspError.cjs.map +1 -0
  159. package/dist/odspError.d.ts.map +1 -1
  160. package/dist/{odspFluidFileLink.js → odspFluidFileLink.cjs} +25 -18
  161. package/dist/odspFluidFileLink.cjs.map +1 -0
  162. package/dist/odspFluidFileLink.d.ts +10 -1
  163. package/dist/odspFluidFileLink.d.ts.map +1 -1
  164. package/dist/odspLocationRedirection.cjs +24 -0
  165. package/dist/odspLocationRedirection.cjs.map +1 -0
  166. package/dist/odspLocationRedirection.d.ts +14 -0
  167. package/dist/odspLocationRedirection.d.ts.map +1 -0
  168. package/dist/{odspPublicUtils.js → odspPublicUtils.cjs} +7 -4
  169. package/dist/odspPublicUtils.cjs.map +1 -0
  170. package/dist/odspPublicUtils.d.ts +6 -0
  171. package/dist/odspPublicUtils.d.ts.map +1 -1
  172. package/dist/{odspSnapshotParser.js → odspSnapshotParser.cjs} +11 -12
  173. package/dist/odspSnapshotParser.cjs.map +1 -0
  174. package/dist/odspSnapshotParser.d.ts.map +1 -1
  175. package/dist/{odspSummaryUploadManager.js → odspSummaryUploadManager.cjs} +47 -34
  176. package/dist/odspSummaryUploadManager.cjs.map +1 -0
  177. package/dist/odspSummaryUploadManager.d.ts +7 -4
  178. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  179. package/dist/{odspUrlHelper.js → odspUrlHelper.cjs} +9 -3
  180. package/dist/odspUrlHelper.cjs.map +1 -0
  181. package/dist/odspUrlHelper.d.ts +5 -0
  182. package/dist/odspUrlHelper.d.ts.map +1 -1
  183. package/dist/{odspUtils.js → odspUtils.cjs} +118 -30
  184. package/dist/odspUtils.cjs.map +1 -0
  185. package/dist/odspUtils.d.ts +35 -6
  186. package/dist/odspUtils.d.ts.map +1 -1
  187. package/dist/{opsCaching.js → opsCaching.cjs} +25 -9
  188. package/dist/opsCaching.cjs.map +1 -0
  189. package/dist/opsCaching.d.ts +3 -3
  190. package/dist/opsCaching.d.ts.map +1 -1
  191. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  192. package/dist/packageVersion.cjs.map +1 -0
  193. package/dist/packageVersion.d.ts +1 -1
  194. package/dist/packageVersion.d.ts.map +1 -1
  195. package/dist/prefetchLatestSnapshot.cjs +100 -0
  196. package/dist/prefetchLatestSnapshot.cjs.map +1 -0
  197. package/dist/prefetchLatestSnapshot.d.ts +12 -7
  198. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  199. package/dist/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.cjs} +13 -6
  200. package/dist/retryErrorsStorageAdapter.cjs.map +1 -0
  201. package/dist/retryErrorsStorageAdapter.d.ts +5 -4
  202. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  203. package/dist/{retryUtils.js → retryUtils.cjs} +30 -14
  204. package/dist/retryUtils.cjs.map +1 -0
  205. package/dist/retryUtils.d.ts +2 -2
  206. package/dist/retryUtils.d.ts.map +1 -1
  207. package/dist/socketModule.cjs +10 -0
  208. package/dist/socketModule.cjs.map +1 -0
  209. package/dist/socketModule.d.ts +7 -0
  210. package/dist/socketModule.d.ts.map +1 -0
  211. package/dist/tsdoc-metadata.json +11 -0
  212. package/dist/{vroom.js → vroom.cjs} +24 -9
  213. package/dist/vroom.cjs.map +1 -0
  214. package/dist/vroom.d.ts +4 -4
  215. package/dist/vroom.d.ts.map +1 -1
  216. package/dist/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.cjs} +227 -118
  217. package/dist/zipItDataRepresentationUtils.cjs.map +1 -0
  218. package/dist/zipItDataRepresentationUtils.d.ts +47 -20
  219. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  220. package/lib/ReadBufferUtils.d.mts.map +1 -0
  221. package/lib/{ReadBufferUtils.js → ReadBufferUtils.mjs} +14 -7
  222. package/lib/ReadBufferUtils.mjs.map +1 -0
  223. package/lib/{WriteBufferUtils.d.ts → WriteBufferUtils.d.mts} +3 -5
  224. package/lib/WriteBufferUtils.d.mts.map +1 -0
  225. package/lib/{WriteBufferUtils.js → WriteBufferUtils.mjs} +68 -64
  226. package/lib/WriteBufferUtils.mjs.map +1 -0
  227. package/lib/{checkUrl.d.ts → checkUrl.d.mts} +1 -0
  228. package/lib/checkUrl.d.mts.map +1 -0
  229. package/lib/{checkUrl.js → checkUrl.mjs} +7 -6
  230. package/lib/checkUrl.mjs.map +1 -0
  231. package/lib/compactSnapshotParser.d.mts +24 -0
  232. package/lib/compactSnapshotParser.d.mts.map +1 -0
  233. package/lib/compactSnapshotParser.mjs +203 -0
  234. package/lib/compactSnapshotParser.mjs.map +1 -0
  235. package/lib/{compactSnapshotWriter.d.ts → compactSnapshotWriter.d.mts} +3 -4
  236. package/lib/compactSnapshotWriter.d.mts.map +1 -0
  237. package/lib/{compactSnapshotWriter.js → compactSnapshotWriter.mjs} +41 -31
  238. package/lib/compactSnapshotWriter.mjs.map +1 -0
  239. package/lib/{constants.d.ts → constants.d.mts} +6 -0
  240. package/lib/constants.d.mts.map +1 -0
  241. package/lib/{constants.js → constants.mjs} +7 -1
  242. package/lib/constants.mjs.map +1 -0
  243. package/lib/{contracts.d.ts → contracts.d.mts} +17 -54
  244. package/lib/contracts.d.mts.map +1 -0
  245. package/lib/{contracts.js → contracts.mjs} +1 -1
  246. package/lib/contracts.mjs.map +1 -0
  247. package/lib/{contractsPublic.d.ts → contractsPublic.d.mts} +15 -0
  248. package/lib/contractsPublic.d.mts.map +1 -0
  249. package/lib/{contractsPublic.js → contractsPublic.mjs} +7 -1
  250. package/lib/contractsPublic.mjs.map +1 -0
  251. package/lib/createFile.d.mts +18 -0
  252. package/lib/createFile.d.mts.map +1 -0
  253. package/lib/createFile.mjs +171 -0
  254. package/lib/createFile.mjs.map +1 -0
  255. package/lib/createNewContainerOnExistingFile.d.mts +22 -0
  256. package/lib/createNewContainerOnExistingFile.d.mts.map +1 -0
  257. package/lib/createNewContainerOnExistingFile.mjs +56 -0
  258. package/lib/createNewContainerOnExistingFile.mjs.map +1 -0
  259. package/lib/createNewModule.d.mts +7 -0
  260. package/lib/createNewModule.d.mts.map +1 -0
  261. package/lib/createNewModule.mjs +7 -0
  262. package/lib/createNewModule.mjs.map +1 -0
  263. package/lib/createNewUtils.d.mts +27 -0
  264. package/lib/createNewUtils.d.mts.map +1 -0
  265. package/lib/createNewUtils.mjs +197 -0
  266. package/lib/createNewUtils.mjs.map +1 -0
  267. package/lib/{createOdspCreateContainerRequest.d.ts → createOdspCreateContainerRequest.d.mts} +5 -7
  268. package/lib/createOdspCreateContainerRequest.d.mts.map +1 -0
  269. package/lib/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.mjs} +8 -4
  270. package/lib/createOdspCreateContainerRequest.mjs.map +1 -0
  271. package/lib/{createOdspUrl.d.ts → createOdspUrl.d.mts} +2 -1
  272. package/lib/{createOdspUrl.d.ts.map → createOdspUrl.d.mts.map} +1 -1
  273. package/lib/{createOdspUrl.js → createOdspUrl.mjs} +2 -1
  274. package/lib/createOdspUrl.mjs.map +1 -0
  275. package/lib/{epochTracker.d.ts → epochTracker.d.mts} +34 -10
  276. package/lib/epochTracker.d.mts.map +1 -0
  277. package/lib/{epochTracker.js → epochTracker.mjs} +97 -43
  278. package/lib/epochTracker.mjs.map +1 -0
  279. package/lib/{fetch.d.ts → fetch.d.mts} +1 -1
  280. package/lib/{fetch.d.ts.map → fetch.d.mts.map} +1 -1
  281. package/lib/{fetch.js → fetch.mjs} +1 -1
  282. package/lib/fetch.mjs.map +1 -0
  283. package/lib/{fetchSnapshot.d.ts → fetchSnapshot.d.mts} +14 -9
  284. package/lib/fetchSnapshot.d.mts.map +1 -0
  285. package/lib/{fetchSnapshot.js → fetchSnapshot.mjs} +185 -167
  286. package/lib/fetchSnapshot.mjs.map +1 -0
  287. package/lib/{getFileLink.d.ts → getFileLink.d.mts} +4 -7
  288. package/lib/getFileLink.d.mts.map +1 -0
  289. package/lib/{getFileLink.js → getFileLink.mjs} +49 -38
  290. package/lib/getFileLink.mjs.map +1 -0
  291. package/lib/{getQueryString.d.ts → getQueryString.d.mts} +0 -4
  292. package/lib/getQueryString.d.mts.map +1 -0
  293. package/lib/{getQueryString.js → getQueryString.mjs} +1 -1
  294. package/lib/getQueryString.mjs.map +1 -0
  295. package/lib/{getUrlAndHeadersWithAuth.d.ts.map → getUrlAndHeadersWithAuth.d.mts.map} +1 -1
  296. package/lib/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.mjs} +4 -2
  297. package/lib/getUrlAndHeadersWithAuth.mjs.map +1 -0
  298. package/lib/index.d.mts +24 -0
  299. package/lib/index.d.mts.map +1 -0
  300. package/lib/index.mjs +22 -0
  301. package/lib/index.mjs.map +1 -0
  302. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts +17 -0
  303. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +1 -0
  304. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs +31 -0
  305. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +1 -0
  306. package/lib/localOdspDriver/{localOdspDocumentService.d.ts → localOdspDocumentService.d.mts} +3 -2
  307. package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -0
  308. package/lib/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.mjs} +8 -6
  309. package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -0
  310. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.ts → localOdspDocumentServiceFactory.d.mts} +4 -5
  311. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +1 -0
  312. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.mjs} +9 -10
  313. package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +1 -0
  314. package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.ts → localOdspDocumentStorageManager.d.mts} +3 -3
  315. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -0
  316. package/lib/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.mjs} +11 -9
  317. package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -0
  318. package/lib/odsp-driver-alpha.d.mts +497 -0
  319. package/lib/odsp-driver-beta.d.mts +159 -0
  320. package/lib/odsp-driver-public.d.mts +159 -0
  321. package/lib/odsp-driver-untrimmed.d.mts +566 -0
  322. package/lib/{odspCache.d.ts → odspCache.d.mts} +19 -8
  323. package/lib/odspCache.d.mts.map +1 -0
  324. package/lib/{odspCache.js → odspCache.mjs} +6 -11
  325. package/lib/odspCache.mjs.map +1 -0
  326. package/lib/odspDelayLoadedDeltaStream.d.mts +75 -0
  327. package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -0
  328. package/lib/odspDelayLoadedDeltaStream.mjs +287 -0
  329. package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -0
  330. package/lib/{odspDeltaStorageService.d.ts → odspDeltaStorageService.d.mts} +9 -7
  331. package/lib/odspDeltaStorageService.d.mts.map +1 -0
  332. package/lib/{odspDeltaStorageService.js → odspDeltaStorageService.mjs} +70 -68
  333. package/lib/odspDeltaStorageService.mjs.map +1 -0
  334. package/lib/{odspDocumentDeltaConnection.d.ts → odspDocumentDeltaConnection.d.mts} +33 -13
  335. package/lib/odspDocumentDeltaConnection.d.mts.map +1 -0
  336. package/lib/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.mjs} +214 -103
  337. package/lib/odspDocumentDeltaConnection.mjs.map +1 -0
  338. package/lib/{odspDocumentService.d.ts → odspDocumentService.d.mts} +14 -28
  339. package/lib/odspDocumentService.d.mts.map +1 -0
  340. package/lib/odspDocumentService.mjs +221 -0
  341. package/lib/odspDocumentService.mjs.map +1 -0
  342. package/lib/{odspDocumentServiceFactory.d.ts → odspDocumentServiceFactory.d.mts} +5 -1
  343. package/lib/odspDocumentServiceFactory.d.mts.map +1 -0
  344. package/lib/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.mjs} +8 -6
  345. package/lib/odspDocumentServiceFactory.mjs.map +1 -0
  346. package/lib/{odspDocumentServiceFactoryCore.d.ts → odspDocumentServiceFactoryCore.d.mts} +17 -12
  347. package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -0
  348. package/lib/odspDocumentServiceFactoryCore.mjs +192 -0
  349. package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -0
  350. package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.ts → odspDocumentServiceFactoryWithCodeSplit.d.mts} +6 -1
  351. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +1 -0
  352. package/lib/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.mjs} +8 -3
  353. package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +1 -0
  354. package/lib/{odspDocumentStorageManager.d.ts → odspDocumentStorageManager.d.mts} +17 -11
  355. package/lib/odspDocumentStorageManager.d.mts.map +1 -0
  356. package/lib/odspDocumentStorageManager.mjs +486 -0
  357. package/lib/odspDocumentStorageManager.mjs.map +1 -0
  358. package/lib/{odspDocumentStorageServiceBase.d.ts → odspDocumentStorageServiceBase.d.mts} +8 -10
  359. package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -0
  360. package/lib/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.mjs} +31 -33
  361. package/lib/odspDocumentStorageServiceBase.mjs.map +1 -0
  362. package/lib/{odspDriverUrlResolver.d.ts → odspDriverUrlResolver.d.mts} +12 -0
  363. package/lib/odspDriverUrlResolver.d.mts.map +1 -0
  364. package/lib/{odspDriverUrlResolver.js → odspDriverUrlResolver.mjs} +50 -40
  365. package/lib/odspDriverUrlResolver.mjs.map +1 -0
  366. package/lib/{odspDriverUrlResolverForShareLink.d.ts → odspDriverUrlResolverForShareLink.d.mts} +6 -4
  367. package/lib/odspDriverUrlResolverForShareLink.d.mts.map +1 -0
  368. package/lib/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.mjs} +36 -29
  369. package/lib/odspDriverUrlResolverForShareLink.mjs.map +1 -0
  370. package/lib/{odspError.d.ts → odspError.d.mts} +1 -1
  371. package/lib/odspError.d.mts.map +1 -0
  372. package/lib/{odspError.js → odspError.mjs} +7 -3
  373. package/lib/odspError.mjs.map +1 -0
  374. package/lib/{odspFluidFileLink.d.ts → odspFluidFileLink.d.mts} +11 -2
  375. package/lib/odspFluidFileLink.d.mts.map +1 -0
  376. package/lib/{odspFluidFileLink.js → odspFluidFileLink.mjs} +23 -16
  377. package/lib/odspFluidFileLink.mjs.map +1 -0
  378. package/lib/odspLocationRedirection.d.mts +14 -0
  379. package/lib/odspLocationRedirection.d.mts.map +1 -0
  380. package/lib/odspLocationRedirection.mjs +20 -0
  381. package/lib/odspLocationRedirection.mjs.map +1 -0
  382. package/lib/{odspPublicUtils.d.ts → odspPublicUtils.d.mts} +6 -0
  383. package/lib/odspPublicUtils.d.mts.map +1 -0
  384. package/lib/{odspPublicUtils.js → odspPublicUtils.mjs} +5 -2
  385. package/lib/odspPublicUtils.mjs.map +1 -0
  386. package/lib/{odspSnapshotParser.d.ts → odspSnapshotParser.d.mts} +2 -2
  387. package/lib/odspSnapshotParser.d.mts.map +1 -0
  388. package/lib/{odspSnapshotParser.js → odspSnapshotParser.mjs} +10 -11
  389. package/lib/odspSnapshotParser.mjs.map +1 -0
  390. package/lib/{odspSummaryUploadManager.d.ts → odspSummaryUploadManager.d.mts} +8 -5
  391. package/lib/odspSummaryUploadManager.d.mts.map +1 -0
  392. package/lib/{odspSummaryUploadManager.js → odspSummaryUploadManager.mjs} +41 -32
  393. package/lib/odspSummaryUploadManager.mjs.map +1 -0
  394. package/lib/{odspUrlHelper.d.ts → odspUrlHelper.d.mts} +5 -0
  395. package/lib/odspUrlHelper.d.mts.map +1 -0
  396. package/lib/{odspUrlHelper.js → odspUrlHelper.mjs} +9 -3
  397. package/lib/odspUrlHelper.mjs.map +1 -0
  398. package/lib/{odspUtils.d.ts → odspUtils.d.mts} +36 -7
  399. package/lib/odspUtils.d.mts.map +1 -0
  400. package/lib/{odspUtils.js → odspUtils.mjs} +109 -27
  401. package/lib/odspUtils.mjs.map +1 -0
  402. package/lib/{opsCaching.d.ts → opsCaching.d.mts} +3 -3
  403. package/lib/opsCaching.d.mts.map +1 -0
  404. package/lib/{opsCaching.js → opsCaching.mjs} +23 -7
  405. package/lib/opsCaching.mjs.map +1 -0
  406. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
  407. package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
  408. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  409. package/lib/packageVersion.mjs.map +1 -0
  410. package/lib/{prefetchLatestSnapshot.d.ts → prefetchLatestSnapshot.d.mts} +13 -8
  411. package/lib/prefetchLatestSnapshot.d.mts.map +1 -0
  412. package/lib/prefetchLatestSnapshot.mjs +96 -0
  413. package/lib/prefetchLatestSnapshot.mjs.map +1 -0
  414. package/lib/{retryErrorsStorageAdapter.d.ts → retryErrorsStorageAdapter.d.mts} +5 -4
  415. package/lib/retryErrorsStorageAdapter.d.mts.map +1 -0
  416. package/lib/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.mjs} +13 -6
  417. package/lib/retryErrorsStorageAdapter.mjs.map +1 -0
  418. package/lib/{retryUtils.d.ts → retryUtils.d.mts} +2 -2
  419. package/lib/retryUtils.d.mts.map +1 -0
  420. package/lib/{retryUtils.js → retryUtils.mjs} +27 -11
  421. package/lib/retryUtils.mjs.map +1 -0
  422. package/lib/socketModule.d.mts +7 -0
  423. package/lib/socketModule.d.mts.map +1 -0
  424. package/lib/socketModule.mjs +7 -0
  425. package/lib/socketModule.mjs.map +1 -0
  426. package/lib/{vroom.d.ts → vroom.d.mts} +6 -6
  427. package/lib/vroom.d.mts.map +1 -0
  428. package/lib/{vroom.js → vroom.mjs} +24 -9
  429. package/lib/vroom.mjs.map +1 -0
  430. package/lib/{zipItDataRepresentationUtils.d.ts → zipItDataRepresentationUtils.d.mts} +48 -21
  431. package/lib/zipItDataRepresentationUtils.d.mts.map +1 -0
  432. package/lib/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.mjs} +213 -111
  433. package/lib/zipItDataRepresentationUtils.mjs.map +1 -0
  434. package/package.json +89 -69
  435. package/prettier.config.cjs +8 -0
  436. package/src/ReadBufferUtils.ts +51 -44
  437. package/src/WriteBufferUtils.ts +203 -181
  438. package/src/checkUrl.ts +16 -15
  439. package/src/compactSnapshotParser.ts +219 -103
  440. package/src/compactSnapshotWriter.ts +118 -97
  441. package/src/constants.ts +7 -0
  442. package/src/contracts.ts +96 -136
  443. package/src/contractsPublic.ts +31 -16
  444. package/src/createFile.ts +243 -305
  445. package/src/createNewContainerOnExistingFile.ts +93 -0
  446. package/src/createNewModule.ts +7 -0
  447. package/src/createNewUtils.ts +266 -56
  448. package/src/createOdspCreateContainerRequest.ts +22 -18
  449. package/src/createOdspUrl.ts +12 -13
  450. package/src/epochTracker.ts +596 -457
  451. package/src/fetch.ts +4 -4
  452. package/src/fetchSnapshot.ts +583 -508
  453. package/src/getFileLink.ts +194 -155
  454. package/src/getQueryString.ts +11 -9
  455. package/src/getUrlAndHeadersWithAuth.ts +34 -33
  456. package/src/index.ts +42 -18
  457. package/src/localOdspDriver/localOdspDeltaStorageService.ts +49 -0
  458. package/src/localOdspDriver/localOdspDocumentService.ts +40 -38
  459. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +46 -43
  460. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +55 -50
  461. package/src/odspCache.ts +112 -90
  462. package/src/odspDelayLoadedDeltaStream.ts +459 -0
  463. package/src/odspDeltaStorageService.ts +232 -221
  464. package/src/odspDocumentDeltaConnection.ts +751 -563
  465. package/src/odspDocumentService.ts +324 -523
  466. package/src/odspDocumentServiceFactory.ts +20 -21
  467. package/src/odspDocumentServiceFactoryCore.ts +325 -202
  468. package/src/odspDocumentServiceFactoryWithCodeSplit.ts +20 -20
  469. package/src/odspDocumentStorageManager.ts +730 -534
  470. package/src/odspDocumentStorageServiceBase.ts +279 -254
  471. package/src/odspDriverUrlResolver.ts +230 -188
  472. package/src/odspDriverUrlResolverForShareLink.ts +223 -203
  473. package/src/odspError.ts +27 -19
  474. package/src/odspFluidFileLink.ts +106 -87
  475. package/src/odspLocationRedirection.ts +26 -0
  476. package/src/odspPublicUtils.ts +20 -14
  477. package/src/odspSnapshotParser.ts +53 -46
  478. package/src/odspSummaryUploadManager.ts +243 -218
  479. package/src/odspUrlHelper.ts +81 -71
  480. package/src/odspUtils.ts +401 -259
  481. package/src/opsCaching.ts +214 -193
  482. package/src/packageVersion.ts +1 -1
  483. package/src/prefetchLatestSnapshot.ts +142 -80
  484. package/src/retryErrorsStorageAdapter.ts +92 -77
  485. package/src/retryUtils.ts +80 -57
  486. package/src/socketModule.ts +8 -0
  487. package/src/vroom.ts +92 -83
  488. package/src/zipItDataRepresentationUtils.ts +534 -394
  489. package/tsc-multi.test.json +4 -0
  490. package/tsconfig.json +11 -13
  491. package/.editorconfig +0 -7
  492. package/dist/ReadBufferUtils.js.map +0 -1
  493. package/dist/WriteBufferUtils.js.map +0 -1
  494. package/dist/checkUrl.js.map +0 -1
  495. package/dist/compactSnapshotParser.js +0 -115
  496. package/dist/compactSnapshotParser.js.map +0 -1
  497. package/dist/compactSnapshotWriter.js.map +0 -1
  498. package/dist/constants.js.map +0 -1
  499. package/dist/contracts.js.map +0 -1
  500. package/dist/contractsPublic.js.map +0 -1
  501. package/dist/createFile.js +0 -242
  502. package/dist/createFile.js.map +0 -1
  503. package/dist/createNewUtils.js +0 -67
  504. package/dist/createNewUtils.js.map +0 -1
  505. package/dist/createOdspCreateContainerRequest.js.map +0 -1
  506. package/dist/createOdspUrl.js.map +0 -1
  507. package/dist/epochTracker.js.map +0 -1
  508. package/dist/fetch.js.map +0 -1
  509. package/dist/fetchSnapshot.js.map +0 -1
  510. package/dist/getFileLink.js.map +0 -1
  511. package/dist/getQueryString.js.map +0 -1
  512. package/dist/getSocketIo.d.ts +0 -11
  513. package/dist/getSocketIo.d.ts.map +0 -1
  514. package/dist/getSocketIo.js +0 -20
  515. package/dist/getSocketIo.js.map +0 -1
  516. package/dist/getUrlAndHeadersWithAuth.js.map +0 -1
  517. package/dist/index.js +0 -41
  518. package/dist/index.js.map +0 -1
  519. package/dist/localOdspDriver/localOdspDocumentService.js.map +0 -1
  520. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  521. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  522. package/dist/odspCache.js.map +0 -1
  523. package/dist/odspDeltaStorageService.js.map +0 -1
  524. package/dist/odspDocumentDeltaConnection.js.map +0 -1
  525. package/dist/odspDocumentService.js +0 -364
  526. package/dist/odspDocumentService.js.map +0 -1
  527. package/dist/odspDocumentServiceFactory.js.map +0 -1
  528. package/dist/odspDocumentServiceFactoryCore.js +0 -118
  529. package/dist/odspDocumentServiceFactoryCore.js.map +0 -1
  530. package/dist/odspDocumentServiceFactoryWithCodeSplit.js +0 -34
  531. package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  532. package/dist/odspDocumentStorageManager.js +0 -356
  533. package/dist/odspDocumentStorageManager.js.map +0 -1
  534. package/dist/odspDocumentStorageServiceBase.js.map +0 -1
  535. package/dist/odspDriverUrlResolver.js.map +0 -1
  536. package/dist/odspDriverUrlResolverForShareLink.js.map +0 -1
  537. package/dist/odspError.js.map +0 -1
  538. package/dist/odspFluidFileLink.js.map +0 -1
  539. package/dist/odspPublicUtils.js.map +0 -1
  540. package/dist/odspSnapshotParser.js.map +0 -1
  541. package/dist/odspSummaryUploadManager.js.map +0 -1
  542. package/dist/odspUrlHelper.js.map +0 -1
  543. package/dist/odspUtils.js.map +0 -1
  544. package/dist/opsCaching.js.map +0 -1
  545. package/dist/packageVersion.js.map +0 -1
  546. package/dist/prefetchLatestSnapshot.js +0 -57
  547. package/dist/prefetchLatestSnapshot.js.map +0 -1
  548. package/dist/retryErrorsStorageAdapter.js.map +0 -1
  549. package/dist/retryUtils.js.map +0 -1
  550. package/dist/vroom.js.map +0 -1
  551. package/dist/zipItDataRepresentationUtils.js.map +0 -1
  552. package/lib/ReadBufferUtils.d.ts.map +0 -1
  553. package/lib/ReadBufferUtils.js.map +0 -1
  554. package/lib/WriteBufferUtils.d.ts.map +0 -1
  555. package/lib/WriteBufferUtils.js.map +0 -1
  556. package/lib/checkUrl.d.ts.map +0 -1
  557. package/lib/checkUrl.js.map +0 -1
  558. package/lib/compactSnapshotParser.d.ts +0 -15
  559. package/lib/compactSnapshotParser.d.ts.map +0 -1
  560. package/lib/compactSnapshotParser.js +0 -111
  561. package/lib/compactSnapshotParser.js.map +0 -1
  562. package/lib/compactSnapshotWriter.d.ts.map +0 -1
  563. package/lib/compactSnapshotWriter.js.map +0 -1
  564. package/lib/constants.d.ts.map +0 -1
  565. package/lib/constants.js.map +0 -1
  566. package/lib/contracts.d.ts.map +0 -1
  567. package/lib/contracts.js.map +0 -1
  568. package/lib/contractsPublic.d.ts.map +0 -1
  569. package/lib/contractsPublic.js.map +0 -1
  570. package/lib/createFile.d.ts +0 -22
  571. package/lib/createFile.d.ts.map +0 -1
  572. package/lib/createFile.js +0 -235
  573. package/lib/createFile.js.map +0 -1
  574. package/lib/createNewUtils.d.ts +0 -11
  575. package/lib/createNewUtils.d.ts.map +0 -1
  576. package/lib/createNewUtils.js +0 -63
  577. package/lib/createNewUtils.js.map +0 -1
  578. package/lib/createOdspCreateContainerRequest.d.ts.map +0 -1
  579. package/lib/createOdspCreateContainerRequest.js.map +0 -1
  580. package/lib/createOdspUrl.js.map +0 -1
  581. package/lib/epochTracker.d.ts.map +0 -1
  582. package/lib/epochTracker.js.map +0 -1
  583. package/lib/fetch.js.map +0 -1
  584. package/lib/fetchSnapshot.d.ts.map +0 -1
  585. package/lib/fetchSnapshot.js.map +0 -1
  586. package/lib/getFileLink.d.ts.map +0 -1
  587. package/lib/getFileLink.js.map +0 -1
  588. package/lib/getQueryString.d.ts.map +0 -1
  589. package/lib/getQueryString.js.map +0 -1
  590. package/lib/getSocketIo.d.ts +0 -11
  591. package/lib/getSocketIo.d.ts.map +0 -1
  592. package/lib/getSocketIo.js +0 -13
  593. package/lib/getSocketIo.js.map +0 -1
  594. package/lib/getUrlAndHeadersWithAuth.js.map +0 -1
  595. package/lib/index.d.ts +0 -21
  596. package/lib/index.d.ts.map +0 -1
  597. package/lib/index.js +0 -29
  598. package/lib/index.js.map +0 -1
  599. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +0 -1
  600. package/lib/localOdspDriver/localOdspDocumentService.js.map +0 -1
  601. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +0 -1
  602. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  603. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +0 -1
  604. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  605. package/lib/odspCache.d.ts.map +0 -1
  606. package/lib/odspCache.js.map +0 -1
  607. package/lib/odspDeltaStorageService.d.ts.map +0 -1
  608. package/lib/odspDeltaStorageService.js.map +0 -1
  609. package/lib/odspDocumentDeltaConnection.d.ts.map +0 -1
  610. package/lib/odspDocumentDeltaConnection.js.map +0 -1
  611. package/lib/odspDocumentService.d.ts.map +0 -1
  612. package/lib/odspDocumentService.js +0 -360
  613. package/lib/odspDocumentService.js.map +0 -1
  614. package/lib/odspDocumentServiceFactory.d.ts.map +0 -1
  615. package/lib/odspDocumentServiceFactory.js.map +0 -1
  616. package/lib/odspDocumentServiceFactoryCore.d.ts.map +0 -1
  617. package/lib/odspDocumentServiceFactoryCore.js +0 -114
  618. package/lib/odspDocumentServiceFactoryCore.js.map +0 -1
  619. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +0 -1
  620. package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  621. package/lib/odspDocumentStorageManager.d.ts.map +0 -1
  622. package/lib/odspDocumentStorageManager.js +0 -352
  623. package/lib/odspDocumentStorageManager.js.map +0 -1
  624. package/lib/odspDocumentStorageServiceBase.d.ts.map +0 -1
  625. package/lib/odspDocumentStorageServiceBase.js.map +0 -1
  626. package/lib/odspDriverUrlResolver.d.ts.map +0 -1
  627. package/lib/odspDriverUrlResolver.js.map +0 -1
  628. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +0 -1
  629. package/lib/odspDriverUrlResolverForShareLink.js.map +0 -1
  630. package/lib/odspError.d.ts.map +0 -1
  631. package/lib/odspError.js.map +0 -1
  632. package/lib/odspFluidFileLink.d.ts.map +0 -1
  633. package/lib/odspFluidFileLink.js.map +0 -1
  634. package/lib/odspPublicUtils.d.ts.map +0 -1
  635. package/lib/odspPublicUtils.js.map +0 -1
  636. package/lib/odspSnapshotParser.d.ts.map +0 -1
  637. package/lib/odspSnapshotParser.js.map +0 -1
  638. package/lib/odspSummaryUploadManager.d.ts.map +0 -1
  639. package/lib/odspSummaryUploadManager.js.map +0 -1
  640. package/lib/odspUrlHelper.d.ts.map +0 -1
  641. package/lib/odspUrlHelper.js.map +0 -1
  642. package/lib/odspUtils.d.ts.map +0 -1
  643. package/lib/odspUtils.js.map +0 -1
  644. package/lib/opsCaching.d.ts.map +0 -1
  645. package/lib/opsCaching.js.map +0 -1
  646. package/lib/packageVersion.js.map +0 -1
  647. package/lib/prefetchLatestSnapshot.d.ts.map +0 -1
  648. package/lib/prefetchLatestSnapshot.js +0 -53
  649. package/lib/prefetchLatestSnapshot.js.map +0 -1
  650. package/lib/retryErrorsStorageAdapter.d.ts.map +0 -1
  651. package/lib/retryErrorsStorageAdapter.js.map +0 -1
  652. package/lib/retryUtils.d.ts.map +0 -1
  653. package/lib/retryUtils.js.map +0 -1
  654. package/lib/vroom.d.ts.map +0 -1
  655. package/lib/vroom.js.map +0 -1
  656. package/lib/zipItDataRepresentationUtils.d.ts.map +0 -1
  657. package/lib/zipItDataRepresentationUtils.js.map +0 -1
  658. package/src/getSocketIo.ts +0 -14
  659. package/tsconfig.esnext.json +0 -7
  660. /package/lib/{ReadBufferUtils.d.ts → ReadBufferUtils.d.mts} +0 -0
  661. /package/lib/{getUrlAndHeadersWithAuth.d.ts → getUrlAndHeadersWithAuth.d.mts} +0 -0
@@ -0,0 +1,4 @@
1
+ {
2
+ "targets": [{ "extname": ".cjs", "module": "CommonJS", "moduleResolution": "Node10" }],
3
+ "projects": ["./tsconfig.json", "./src/test/tsconfig.json"]
4
+ }
package/tsconfig.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
- "extends": "@fluidframework/build-common/ts-common-config.json",
3
- "exclude": [
4
- "src/test/**/*"
5
- ],
6
- "compilerOptions": {
7
- "rootDir": "./src",
8
- "outDir": "./dist",
9
- "composite": true
10
- },
11
- "include": [
12
- "src/**/*"
13
- ]
14
- }
2
+ "extends": [
3
+ "../../../common/build/build-common/tsconfig.base.json",
4
+ "../../../common/build/build-common/tsconfig.cjs.json",
5
+ ],
6
+ "include": ["src/**/*"],
7
+ "exclude": ["src/test/**/*"],
8
+ "compilerOptions": {
9
+ "rootDir": "./src",
10
+ "outDir": "./dist",
11
+ },
12
+ }
package/.editorconfig DELETED
@@ -1,7 +0,0 @@
1
- [*]
2
- indent_size = 4
3
- trim_trailing_whitespace = true
4
- insert_final_newline = true
5
-
6
- [package.json]
7
- indent_size = 2
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReadBufferUtils.js","sourceRoot":"","sources":["../src/ReadBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAEtD;;;GAGG;AACH,MAAa,UAAU;IAOnB,YAA+B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;QANrC,UAAK,GAAG,CAAC,CAAC;QAOhB,4DAA4D;QAC5D,+DAA+D;QAC/D,8DAA8D;QAC9D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IATD,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IASD,IAAW,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,IAAW,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,IAAW,MAAM,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzC,KAAK,CAAC,KAAa,EAAE,GAAW;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;IACnB,CAAC;IAEM,IAAI,CAAC,SAAS,GAAG,CAAC;QACrB,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,UAAU,GAAG,CAAC,CAAC;QACnB,IAAI,MAAM,GAAG,SAAS,CAAC;QACvB,OAAO,MAAM,GAAG,CAAC,EAAE;YACf,IAAA,qBAAM,EAAC,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAC1D,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;YAC1C,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,UAAU,IAAI,GAAG,CAAC;YAClB,MAAM,EAAE,CAAC;SACZ;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAEM,IAAI,CAAC,MAAc;QACtB,IAAA,qBAAM,EAAC,MAAM,IAAI,CAAC,EAAE,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAClE,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC;IACzB,CAAC;CACJ;AA5CD,gCA4CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\n\n/**\n * Buffer class, used to sequentially read data.\n * Used by tree code to reconstruct a tree from binary representation.\n */\nexport class ReadBuffer {\n protected index = 0;\n\n public get buffer() {\n return this.data;\n }\n\n constructor(protected readonly data: Uint8Array) {\n // BlobShallowCopy will return to users parts of this array.\n // We need to ensure that nobody can change it, as it will have\n // catastrophic result and will be really hard to investigate.\n Object.freeze(data.buffer);\n }\n\n public get eof() { return this.index === this.data.length; }\n public get pos() { return this.index; }\n public get length() { return this.data.length; }\n\n public slice(start: number, end: number) {\n return this.data.slice(start, end);\n }\n\n public reset() {\n this.index = 0;\n }\n\n public read(lengthArg = 1): number {\n let res = 0;\n let multiplier = 1;\n let length = lengthArg;\n while (length > 0) {\n assert(!this.eof, 0x223 /* \"unexpected end of buffer\" */);\n res += this.data[this.index] * multiplier;\n this.index++;\n multiplier *= 256;\n length--;\n }\n return res;\n }\n\n public skip(length: number) {\n assert(length >= 0, 0x224 /* \"Skip length should be positive\" */);\n this.index += length;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"WriteBufferUtils.js","sourceRoot":"","sources":["../src/WriteBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAuE;AACvE,uDAA+C;AAC/C,iFASwC;AAExC;;;GAGG;AACH,MAAa,WAAW;IAAxB;QACc,SAAI,GAAgB,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,UAAK,GAAG,CAAC,CAAC;IAsCxB,CAAC;IApCa,IAAI,CAAC,IAAY;QACvB,IAAA,qBAAM,EAAC,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QAChC,IAAI,IAAI,CAAC,KAAK,KAAK,MAAM,EAAE;YACvB,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;YACpD,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;YAC1B,OAAO,KAAK,GAAG,MAAM,EAAE;gBACnB,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CA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sDAcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, unreachableCase } from \"@fluidframework/common-utils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport {\n BlobCore,\n codeToBytesMap,\n getValueSafely,\n MarkerCodes,\n MarkerCodesEnd,\n MarkerCodesStart,\n NodeCore,\n TreeBuilder,\n} from \"./zipItDataRepresentationUtils\";\n\n/**\n * Buffer class, used to sequentially writ data.\n * Used by tree code to serialize tree into binary representation.\n */\nexport class WriteBuffer {\n protected data?: Uint8Array = new Uint8Array(4096);\n protected index = 0;\n\n protected push(code: number) {\n assert(this.data !== undefined, 0x225 /* \"Data should be there\" */);\n const length = this.data.length;\n if (this.index === length) {\n const newData = new Uint8Array(length * 1.2 + 4096);\n let index = 0;\n const oldData = this.data;\n while (index < length) {\n newData[index] = oldData[index];\n index++;\n }\n this.data = newData;\n }\n this.data[this.index] = code % 256;\n this.index++;\n }\n\n public write(codeArg: number, lengthArg = 1) {\n let code = codeArg;\n let length = lengthArg;\n while (length > 0) {\n this.push(code % 256);\n code = Math.floor(code / 256);\n length--;\n }\n assert(code === 0, 0x226 /* Should write complete data */);\n }\n\n public done(): ReadBuffer {\n assert(this.data !== undefined, 0x227 /* \"Data should be there\" */);\n // We can slice it to have smaller memory representation.\n // But it will be way more expensive in terms of CPU cycles!\n const buffer = new ReadBuffer(this.data.subarray(0, this.index));\n this.data = undefined;\n return buffer;\n }\n}\n\n// This list of maps below is reverse mapping of Marker Codes specified in zipItDataRepresentationUtils.ts file.\n// We can also found them on server filestore code.\n// eslint-disable-next-line max-len\n// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=/cobalt/Base/Property/BinaryEncodedPropertyReader.cs&version=GBmaster&_a=contents\n\n/**\n * This contains mapping of number of bytes representing the corresponding string length to Marker Codes.\n*/\nconst utf8StringBytesToCodeMap = {\n 0: 13,\n 1: 14,\n 2: 15,\n 4: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding length in which actual data(base64 string)\n * will be stored to Marker Codes.\n*/\nconst binaryBytesToCodeMap = {\n 0: 32,\n 1: 33,\n 2: 34,\n 4: 35,\n 8: 16,\n};\n\n/**\n * This contains mapping of number of bytes representing the corresponding const string id to Marker Codes.\n*/\nconst constStringBytesToCodeMap = {\n 1: 17,\n 2: 18,\n 4: 19,\n};\n\n/**\n * This contains mapping of number of bytes to Marker Codes representing the corresponding Integer.\n*/\nconst integerBytesToCodeMap = {\n 0: 1,\n 1: 3,\n 2: 5,\n 4: 7,\n 8: 9,\n};\n\n/**\n * This contains mapping of boolean to Marker Codes representing the corresponding bool value.\n*/\nconst boolToCodeMap = [\n 12, // false\n 11, // true\n];\n\n/**\n * Calculate how many bytes are required to encode an integer. This is always power of 2.\n * So if 6 bytes are required to store an integer than it will return 8. 0 is a special case for which we\n * return 0 as it is usually just represented by marker code and we don't store the actual data.\n * @param num - number to encode.\n */\n export function calcLength(numArg: number) {\n if (numArg === 0) {\n return 0;\n }\n let num = numArg;\n let lengthLen = 0;\n while (num > 0) {\n num = Math.floor(num / 256);\n lengthLen++;\n }\n let res = 1;\n while (res < lengthLen) {\n res *= 2;\n }\n return res;\n}\n\n/**\n * Implementation of serialization of blobs in buffer with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param blob - blob to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeBlob(buffer: WriteBuffer, blob: BlobCore, dictionary: Map<string, number>) {\n const data = blob.buffer;\n const lengthOfDataLen = calcLength(data.length);\n if (blob.constString) {\n const content = blob.toString();\n let id = dictionary.get(content);\n let idLength: number;\n if (id === undefined) {\n id = dictionary.size + 1;\n idLength = calcLength(id);\n dictionary.set(content, id);\n let code: number;\n if (lengthOfDataLen > 1 || idLength > 1) {\n code = MarkerCodes.ConstStringDeclareBig;\n } else {\n code = MarkerCodes.ConstStringDeclare;\n }\n // Write marker code for const string.\n buffer.write(code);\n const bytes = getValueSafely(codeToBytesMap, code);\n assert(bytes >= lengthOfDataLen, 0x283 /* \"Length of data len should fit in the bytes from the map\" */);\n assert(bytes >= idLength, 0x284 /* \"Length of id should fit in the bytes from the map\" */);\n // Assign and write id for const string.\n buffer.write(id, bytes);\n // Write length of const string.\n buffer.write(data.length, bytes);\n // Write const string data.\n for (const element of data) {\n buffer.write(element);\n }\n } else {\n idLength = calcLength(id);\n }\n // Write Marker Code\n buffer.write(getValueSafely(constStringBytesToCodeMap, idLength));\n // Write id of const string\n buffer.write(id, idLength);\n } else {\n // Write Marker code.\n buffer.write(blob.useUtf8Code ? getValueSafely(utf8StringBytesToCodeMap, lengthOfDataLen)\n : getValueSafely(binaryBytesToCodeMap, lengthOfDataLen));\n // Write actual data if length greater than 0, otherwise Marker Code is enough.\n if (lengthOfDataLen > 0) {\n buffer.write(data.length, lengthOfDataLen);\n for (const element of data) {\n buffer.write(element);\n }\n }\n }\n}\n\n/**\n * Implementation of serialization of nodes with Marker Codes etc.\n * @param buffer - Buffer to serialize to.\n * @param nodeCore - Node to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeNodeCore(buffer: WriteBuffer, nodeCore: NodeCore, dictionary: Map<string, number>) {\n for (const child of nodeCore.nodes) {\n if (child instanceof NodeCore) {\n // For a tree node start and end with set/list start and end marker codes.\n const startCode = MarkerCodesStart[child.type];\n const endCode = MarkerCodesEnd[child.type];\n assert(startCode !== undefined, 0x285 /* \"Start code should not undefined\" */);\n assert(endCode !== undefined, 0x286 /* \"End code should not undefined\" */);\n buffer.write(startCode);\n serializeNodeCore(buffer, child, dictionary);\n buffer.write(endCode);\n } else if (child instanceof BlobCore) {\n serializeBlob(buffer, child, dictionary);\n } else if (typeof child === \"number\") {\n // Calculate length in which integer will be stored\n const len = calcLength(child);\n // Write corresponding Marker code for length of integer.\n buffer.write(getValueSafely(integerBytesToCodeMap, len));\n // Write actual number if greater than 0, otherwise Marker Code is enough.\n if (len > 0) {\n buffer.write(child, len);\n }\n } else if (typeof child === \"boolean\") {\n buffer.write(boolToCodeMap[child ? 1 : 0]);\n } else {\n unreachableCase(child, \"Unsupported node type\");\n }\n }\n}\n\nclass NodeCoreSerializer extends NodeCore {\n constructor() {\n super();\n }\n\n public serialize(buffer: WriteBuffer) {\n serializeNodeCore(buffer, this, new Map<string, number>());\n }\n}\n\nexport class TreeBuilderSerializer extends NodeCoreSerializer {\n constructor() {\n super();\n }\n\n static load(buffer: ReadBuffer): TreeBuilder {\n return TreeBuilder.load(buffer);\n }\n\n public serialize(): ReadBuffer {\n const buffer = new WriteBuffer();\n super.serialize(buffer);\n return buffer.done();\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkUrl.js","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2DAA4D;AAE5D;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,WAAgB;IACvC,MAAM,OAAO,GAAG,IAAA,yCAAqB,EAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,UAA8B,CAAC;IACnC,IAAI;QACF,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,EAAE;YACpB,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC,MAAM,CAAC;SAC/C;KACF;IAAC,WAAM,GAAE;IAEV,OAAO;QACL,eAAe,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,oBAAoB;QAC9C,uEAAuE;QACvE,mBAAmB,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;KAC3D,CAAC;AACJ,CAAC;AAnBD,4BAmBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { DriverPreCheckInfo } from \"@fluidframework/driver-definitions\";\nimport { getLocatorFromOdspUrl } from \"./odspFluidFileLink\";\n\n/**\n * A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver.\n * Note that returning information here is NOT a full guarantee that resolve will ultimately be successful.\n * Instead, this should be used as a lightweight check that can filter out easily detectable unsupported URLs\n * before the entire Fluid loading process needs to be kicked off.\n */\nexport function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined {\n const locator = getLocatorFromOdspUrl(documentUrl);\n\n if (!locator) {\n return undefined;\n }\n\n let siteOrigin: string | undefined;\n try {\n if (locator?.siteUrl) {\n siteOrigin = new URL(locator?.siteUrl).origin;\n }\n } catch {}\n\n return {\n codeDetailsHint: locator?.containerPackageName,\n // Add the snapshot endpoint, which has the same domain as the site URL\n criticalBootDomains: siteOrigin ? [siteOrigin] : undefined,\n };\n}\n"]}
@@ -1,115 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.parseCompactSnapshotResponse = exports.currentReadVersion = exports.snapshotMinReadVersion = void 0;
8
- const common_utils_1 = require("@fluidframework/common-utils");
9
- const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils");
10
- exports.snapshotMinReadVersion = "1.0";
11
- exports.currentReadVersion = "1.0";
12
- /**
13
- * Recreates blobs section of the tree.
14
- * @param node - tree node to read blob section from
15
- */
16
- function readBlobSection(node) {
17
- (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(node, "TreeBlobs should be of type NodeCore");
18
- const blobs = new Map();
19
- for (let count = 0; count < node.length; ++count) {
20
- const blob = node.getNode(count);
21
- const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(blob, ["id", "data"]);
22
- (0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.data, "data should be of BlobCore type");
23
- (0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.id, "blob id should be of BlobCore type");
24
- blobs.set(records.id.toString(), records.data.arrayBuffer);
25
- }
26
- return blobs;
27
- }
28
- /**
29
- * Recreates ops section of the tree.
30
- * @param node - tree node to read ops section from
31
- */
32
- function readOpsSection(node) {
33
- (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(node, "Deltas should be of type NodeCore");
34
- const ops = [];
35
- const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(node, ["firstSequenceNumber", "deltas"]);
36
- (0, zipItDataRepresentationUtils_1.assertNumberInstance)(records.firstSequenceNumber, "Seq number should be a number");
37
- (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(records.deltas, "Deltas should be a Node");
38
- for (let i = 0; i < records.deltas.length; ++i) {
39
- ops.push(JSON.parse(records.deltas.getString(i)));
40
- }
41
- (0, common_utils_1.assert)(records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber, 0x280 /* "Validate first op seq number" */);
42
- return ops;
43
- }
44
- /**
45
- * Recreates snapshot tree out of tree representation.
46
- * @param node - tree node to de-serialize from
47
- */
48
- function readTreeSection(node) {
49
- const snapshotTree = {
50
- blobs: {},
51
- commits: {},
52
- trees: {},
53
- };
54
- for (let count = 0; count < node.length; count++) {
55
- const treeNode = node.getNode(count);
56
- const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(treeNode, ["name", "value", "children", "unreferenced"], false);
57
- (0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.name, "Path should be of BlobCore");
58
- const path = records.name.toString();
59
- if (records.value !== undefined) {
60
- (0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.value, "Blob value should be BlobCore");
61
- snapshotTree.blobs[path] = records.value.toString();
62
- }
63
- else {
64
- (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(records.children, "Trees should be of type NodeCore");
65
- snapshotTree.trees[path] = readTreeSection(records.children);
66
- }
67
- if (records.unreferenced !== undefined) {
68
- (0, zipItDataRepresentationUtils_1.assertBoolInstance)(records.unreferenced, "Unreferenced flag should be bool");
69
- const unreferenced = records.unreferenced.valueOf();
70
- (0, common_utils_1.assert)(unreferenced, 0x281 /* "Unreferenced if present should be true" */);
71
- snapshotTree.unreferenced = unreferenced;
72
- }
73
- }
74
- return snapshotTree;
75
- }
76
- /**
77
- * Recreates snapshot tree out of tree representation.
78
- * @param node - tree node to de-serialize from
79
- */
80
- function readSnapshotSection(node) {
81
- (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(node, "Snapshot should be of type NodeCore");
82
- const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(node, ["id", "sequenceNumber", "treeNodes"]);
83
- (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(records.treeNodes, "TreeNodes should be of type NodeCore");
84
- (0, zipItDataRepresentationUtils_1.assertNumberInstance)(records.sequenceNumber, "sequenceNumber should be of type number");
85
- (0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.id, "snapshotId should be BlobCore");
86
- const snapshotTree = readTreeSection(records.treeNodes);
87
- snapshotTree.id = records.id.toString();
88
- const sequenceNumber = records.sequenceNumber.valueOf();
89
- return {
90
- sequenceNumber,
91
- snapshotTree,
92
- };
93
- }
94
- /**
95
- * Converts snapshot from binary compact representation to tree/blobs/ops.
96
- * @param buffer - Compact snapshot to be parsed into tree/blobs/ops.
97
- * @returns - tree, blobs and ops from the snapshot.
98
- */
99
- function parseCompactSnapshotResponse(buffer) {
100
- const builder = zipItDataRepresentationUtils_1.TreeBuilder.load(buffer);
101
- (0, common_utils_1.assert)(builder.length === 1, 0x219 /* "1 root should be there" */);
102
- const root = builder.getNode(0);
103
- const records = (0, zipItDataRepresentationUtils_1.getAndValidateNodeProps)(root, ["mrv", "cv", "lsn", "snapshot", "blobs", "deltas"], false);
104
- (0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.mrv, "minReadVersion should be of BlobCore type");
105
- (0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.cv, "createVersion should be of BlobCore type");
106
- if (records.lsn !== undefined) {
107
- (0, zipItDataRepresentationUtils_1.assertNumberInstance)(records.lsn, "lsn should be a number");
108
- }
109
- (0, common_utils_1.assert)(parseFloat(exports.snapshotMinReadVersion) >= parseFloat(records.mrv.toString()), 0x20f /* "Driver min read version should >= to server minReadVersion" */);
110
- (0, common_utils_1.assert)(parseFloat(records.cv.toString()) >= parseFloat(exports.snapshotMinReadVersion), 0x210 /* "Snapshot should be created with minReadVersion or above" */);
111
- (0, common_utils_1.assert)(exports.currentReadVersion === records.cv.toString(), 0x2c2 /* "Create Version should be equal to currentReadVersion" */);
112
- return Object.assign(Object.assign({}, readSnapshotSection(records.snapshot)), { blobs: readBlobSection(records.blobs), ops: records.deltas !== undefined ? readOpsSection(records.deltas) : [], latestSequenceNumber: records.lsn });
113
- }
114
- exports.parseCompactSnapshotResponse = parseCompactSnapshotResponse;
115
- //# sourceMappingURL=compactSnapshotParser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compactSnapshotParser.js","sourceRoot":"","sources":["../src/compactSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AAKtD,iFASwC;AAE3B,QAAA,sBAAsB,GAAG,KAAK,CAAC;AAC/B,QAAA,kBAAkB,GAAG,KAAK,CAAC;AAOxC;;;GAGG;AACH,SAAS,eAAe,CAAC,IAAe;IACpC,IAAA,qDAAsB,EAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;IACrE,MAAM,KAAK,GAA6B,IAAI,GAAG,EAAE,CAAC;IAClD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,IAAA,sDAAuB,EAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9D,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;IAC/E,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE;QAC3B,IAAA,mDAAoB,EAAC,OAAO,CAAC,GAAG,EAAE,wBAAwB,CAAC,CAAC;KAC/D;IAED,IAAA,qBAAM,EAAC,UAAU,CAAC,8BAAsB,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAC3E,KAAK,CAAC,kEAAkE,CAAC,CAAC;IAC9E,IAAA,qBAAM,EAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,UAAU,CAAC,8BAAsB,CAAC,EAC1E,KAAK,CAAC,+DAA+D,CAAC,CAAC;IAC3E,IAAA,qBAAM,EAAC,0BAAkB,KAAK,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,EAC/C,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAExE,uCACO,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,KACxC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,EACrC,GAAG,EAAE,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,EACvE,oBAAoB,EAAE,OAAO,CAAC,GAAG,IACnC;AACN,CAAC;AA3BD,oEA2BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport { ISnapshotTreeEx } from \"./contracts\";\nimport {\n assertBlobCoreInstance,\n assertBoolInstance,\n assertNodeCoreInstance,\n assertNumberInstance,\n getAndValidateNodeProps,\n NodeCore,\n NodeTypes,\n TreeBuilder,\n} from \"./zipItDataRepresentationUtils\";\n\nexport const snapshotMinReadVersion = \"1.0\";\nexport const currentReadVersion = \"1.0\";\n\ninterface ISnapshotSection {\n snapshotTree: ISnapshotTree;\n sequenceNumber: number;\n}\n\n/**\n * Recreates blobs section of the tree.\n * @param node - tree node to read blob section from\n */\nfunction readBlobSection(node: NodeTypes) {\n assertNodeCoreInstance(node, \"TreeBlobs should be of type NodeCore\");\n const blobs: Map<string, ArrayBuffer> = new Map();\n for (let count = 0; count < node.length; ++count) {\n const blob = node.getNode(count);\n const records = getAndValidateNodeProps(blob, [\"id\", \"data\"]);\n assertBlobCoreInstance(records.data, \"data should be of BlobCore type\");\n assertBlobCoreInstance(records.id, \"blob id should be of BlobCore type\");\n blobs.set(records.id.toString(), records.data.arrayBuffer);\n }\n return blobs;\n}\n\n/**\n * Recreates ops section of the tree.\n * @param node - tree node to read ops section from\n */\nfunction readOpsSection(node: NodeTypes) {\n assertNodeCoreInstance(node, \"Deltas should be of type NodeCore\");\n const ops: ISequencedDocumentMessage[] = [];\n const records = getAndValidateNodeProps(node, [\"firstSequenceNumber\", \"deltas\"]);\n assertNumberInstance(records.firstSequenceNumber, \"Seq number should be a number\");\n assertNodeCoreInstance(records.deltas, \"Deltas should be a Node\");\n for (let i = 0; i < records.deltas.length; ++i) {\n ops.push(JSON.parse(records.deltas.getString(i)));\n }\n assert(records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber,\n 0x280 /* \"Validate first op seq number\" */);\n return ops;\n}\n\n/**\n * Recreates snapshot tree out of tree representation.\n * @param node - tree node to de-serialize from\n */\nfunction readTreeSection(node: NodeCore) {\n const snapshotTree: ISnapshotTreeEx = {\n blobs: {},\n commits: {},\n trees: {},\n };\n for (let count = 0; count < node.length; count++) {\n const treeNode = node.getNode(count);\n const records = getAndValidateNodeProps(treeNode,\n [\"name\", \"value\", \"children\", \"unreferenced\"], false);\n assertBlobCoreInstance(records.name, \"Path should be of BlobCore\");\n const path = records.name.toString();\n if (records.value !== undefined) {\n assertBlobCoreInstance(records.value, \"Blob value should be BlobCore\");\n snapshotTree.blobs[path] = records.value.toString();\n } else {\n assertNodeCoreInstance(records.children, \"Trees should be of type NodeCore\");\n snapshotTree.trees[path] = readTreeSection(records.children);\n }\n if (records.unreferenced !== undefined) {\n assertBoolInstance(records.unreferenced, \"Unreferenced flag should be bool\");\n const unreferenced = records.unreferenced.valueOf();\n assert(unreferenced, 0x281 /* \"Unreferenced if present should be true\" */);\n snapshotTree.unreferenced = unreferenced;\n }\n }\n return snapshotTree;\n}\n\n/**\n * Recreates snapshot tree out of tree representation.\n * @param node - tree node to de-serialize from\n */\nfunction readSnapshotSection(node: NodeTypes): ISnapshotSection {\n assertNodeCoreInstance(node, \"Snapshot should be of type NodeCore\");\n const records = getAndValidateNodeProps(node,\n [\"id\", \"sequenceNumber\", \"treeNodes\"]);\n\n assertNodeCoreInstance(records.treeNodes, \"TreeNodes should be of type NodeCore\");\n assertNumberInstance(records.sequenceNumber, \"sequenceNumber should be of type number\");\n assertBlobCoreInstance(records.id, \"snapshotId should be BlobCore\");\n const snapshotTree: ISnapshotTree = readTreeSection(records.treeNodes);\n snapshotTree.id = records.id.toString();\n const sequenceNumber = records.sequenceNumber.valueOf();\n return {\n sequenceNumber,\n snapshotTree,\n };\n}\n\n/**\n * Converts snapshot from binary compact representation to tree/blobs/ops.\n * @param buffer - Compact snapshot to be parsed into tree/blobs/ops.\n * @returns - tree, blobs and ops from the snapshot.\n */\nexport function parseCompactSnapshotResponse(buffer: ReadBuffer): ISnapshotContents {\n const builder = TreeBuilder.load(buffer);\n assert(builder.length === 1, 0x219 /* \"1 root should be there\" */);\n const root = builder.getNode(0);\n\n const records = getAndValidateNodeProps(root,\n [\"mrv\", \"cv\", \"lsn\", \"snapshot\", \"blobs\", \"deltas\"], false);\n\n assertBlobCoreInstance(records.mrv, \"minReadVersion should be of BlobCore type\");\n assertBlobCoreInstance(records.cv, \"createVersion should be of BlobCore type\");\n if (records.lsn !== undefined) {\n assertNumberInstance(records.lsn, \"lsn should be a number\");\n }\n\n assert(parseFloat(snapshotMinReadVersion) >= parseFloat(records.mrv.toString()),\n 0x20f /* \"Driver min read version should >= to server minReadVersion\" */);\n assert(parseFloat(records.cv.toString()) >= parseFloat(snapshotMinReadVersion),\n 0x210 /* \"Snapshot should be created with minReadVersion or above\" */);\n assert(currentReadVersion === records.cv.toString(),\n 0x2c2 /* \"Create Version should be equal to currentReadVersion\" */);\n\n return {\n ...readSnapshotSection(records.snapshot),\n blobs: readBlobSection(records.blobs),\n ops: records.deltas !== undefined ? readOpsSection(records.deltas) : [],\n latestSequenceNumber: records.lsn,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"compactSnapshotWriter.js","sourceRoot":"","sources":["../src/compactSnapshotWriter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsE;AAEtE,mEAAiE;AAGjE,yDAA2D;AAC3D,iFAAiH;AAEjH;;;;EAIE;AACF,SAAS,kBAAkB,CAAC,IAAc,EAAE,oBAA4B;IACpE,IAAA,gDAAiB,EAAC,IAAI,EAAE,KAAK,EAAE,8CAAsB,CAAC,CAAC;IACvD,IAAA,gDAAiB,EAAC,IAAI,EAAE,IAAI,EAAE,8CAAsB,CAAC,CAAC;IACtD,IAAA,gDAAiB,EAAC,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC;AACzD,CAAC;AAED;;;;EAIE;AACF,SAAS,iBAAiB,CAAC,YAAsB,EAAE,KAAuC;;IACtF,YAAY,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,KAAK,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE;QACvC,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;QACrC,IAAA,gDAAiB,EAAC,QAAQ,EAAE,IAAI,EAAE,aAA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Y;IACZ,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAEpD,2BAA2B;IAC3B,eAAe,CAAC,QAAQ,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAEhD,OAAO,OAAO,CAAC,SAAS,EAAE,CAAC;AAC/B,CAAC;AAzBD,4DAyBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert, stringToBuffer } from \"@fluidframework/common-utils\";\nimport { IBlob, ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { snapshotMinReadVersion } from \"./compactSnapshotParser\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport { TreeBuilderSerializer } from \"./WriteBufferUtils\";\nimport { addBoolProperty, addNumberProperty, addStringProperty, NodeCore } from \"./zipItDataRepresentationUtils\";\n\n/**\n * Writes header section of the snapshot.\n * @param node - snapshot node to serialize to\n * @param latestSequenceNumber - latest seq number of the container.\n*/\nfunction writeSnapshotProps(node: NodeCore, latestSequenceNumber: number) {\n addStringProperty(node, \"mrv\", snapshotMinReadVersion);\n addStringProperty(node, \"cv\", snapshotMinReadVersion);\n addNumberProperty(node, \"lsn\", latestSequenceNumber);\n}\n\n/**\n * Represents blobs in the tree.\n * @param snapshotNode - node to serialize to.\n * @param blobs - blobs that is being serialized\n*/\nfunction writeBlobsSection(snapshotNode: NodeCore, blobs: Map<string, IBlob | ArrayBuffer>) {\n snapshotNode.addString(\"blobs\", true);\n const blobsNode = snapshotNode.addNode(\"list\");\n for (const [storageBlobId, blob] of blobs) {\n const blobNode = blobsNode.addNode();\n addStringProperty(blobNode, \"id\", storageBlobId, true);\n blobNode.addString(\"data\", true);\n if (blob instanceof ArrayBuffer) {\n blobNode.addBlob(new Uint8Array(blob), false);\n } else {\n blobNode.addBlob(new Uint8Array(stringToBuffer(blob.contents, blob.encoding ?? \"utf-8\")), false);\n }\n }\n}\n\n/**\n * Represents and serializes tree part of the snapshot\n * @param snapshotNode - tree node to serialize to\n * @param snapshotTree - snapshot tree that is being serialized\n*/\nfunction writeTreeSection(snapshotNode: NodeCore, snapshotTree: ISnapshotTree) {\n snapshotNode.addString(\"treeNodes\", true);\n const treesNode = snapshotNode.addNode(\"list\");\n writeTreeSectionCore(treesNode, snapshotTree);\n}\n\nfunction writeTreeSectionCore(treesNode: NodeCore, snapshotTree: ISnapshotTree) {\n for (const [path, value] of Object.entries(snapshotTree.trees)) {\n const treeNode = treesNode.addNode();\n addStringProperty(treeNode, \"name\", path);\n if (snapshotTree.unreferenced) {\n addBoolProperty(treeNode, \"unreferenced\", snapshotTree.unreferenced);\n }\n treeNode.addString(\"children\", true);\n const childNode = treeNode.addNode(\"list\");\n writeTreeSectionCore(childNode, value);\n }\n\n if (snapshotTree.blobs) {\n for (const [path, id] of Object.entries(snapshotTree.blobs)) {\n const blobNode = treesNode.addNode();\n addStringProperty(blobNode, \"name\", path);\n addStringProperty(blobNode, \"value\", id, true);\n }\n }\n}\n\n/**\n * Represents (serializes) snapshot tree as generalizes tree\n * @param rootNode - tree node to serialize to\n * @param snapshotTree - snapshot tree that is being serialized\n * @param blobs - blobs mapping of the snapshot\n * @param snapshotSequenceNumber - seq number at which snapshot is taken\n*/\nfunction writeSnapshotSection(\n rootNode: NodeCore,\n snapshotTree: ISnapshotTree,\n snapshotSequenceNumber: number,\n) {\n rootNode.addString(\"snapshot\", true);\n const snapshotNode = rootNode.addNode();\n\n const snapshotId = snapshotTree.id;\n assert(snapshotId !== undefined, 0x21b /* \"Snapshot id should be provided\" */);\n addStringProperty(snapshotNode, \"id\", snapshotId);\n addStringProperty(snapshotNode, \"message\", `Snapshot@${snapshotSequenceNumber}`);\n addNumberProperty(snapshotNode, \"sequenceNumber\", snapshotSequenceNumber);\n\n // Add Trees\n writeTreeSection(snapshotNode, snapshotTree);\n}\n\n/**\n * Represents ops in the tree.\n * @param rootNode - node to serialize to.\n * @param ops - ops that is being serialized\n*/\nfunction writeOpsSection(rootNode: NodeCore, ops: ISequencedDocumentMessage[]) {\n let firstSequenceNumber: number | undefined;\n if (ops.length > 0) {\n firstSequenceNumber = ops[0].sequenceNumber;\n }\n if (firstSequenceNumber !== undefined) {\n rootNode.addString(\"deltas\", true);\n const opsNode = rootNode.addNode();\n addNumberProperty(opsNode, \"firstSequenceNumber\", firstSequenceNumber);\n opsNode.addString(\"deltas\", true);\n const deltaNode = opsNode.addNode(\"list\");\n ops.forEach((op) => {\n deltaNode.addString(JSON.stringify(op), false);\n });\n }\n}\n\n/**\n * Converts trees/blobs/ops to binary compact representation.\n * @param snapshotContents - snapshot tree contents to serialize\n * @returns - ReadBuffer - binary representation of the data.\n */\nexport function convertToCompactSnapshot(snapshotContents: ISnapshotContents): ReadBuffer {\n const builder = new TreeBuilderSerializer();\n // Create the root node.\n const rootNode = builder.addNode();\n assert(snapshotContents.sequenceNumber !== undefined, 0x21c /* \"Seq number should be provided\" */);\n\n const latestSequenceNumber = snapshotContents.latestSequenceNumber ??\n snapshotContents.ops.length > 0 ?\n snapshotContents.ops[snapshotContents.ops.length - 1].sequenceNumber : snapshotContents.sequenceNumber;\n\n writeSnapshotProps(rootNode, latestSequenceNumber);\n\n writeSnapshotSection(\n rootNode,\n snapshotContents.snapshotTree,\n snapshotContents.sequenceNumber,\n );\n\n // Add Blobs\n writeBlobsSection(rootNode, snapshotContents.blobs);\n\n // Then write the ops node.\n writeOpsSection(rootNode, snapshotContents.ops);\n\n return builder.serialize();\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEU,QAAA,gBAAgB,GAAG,yCAAyC,CAAC;AAC7D,QAAA,iBAAiB,GAAG,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport const OdcApiSiteOrigin = \"https://my.microsoftpersonalcontent.com\";\nexport const OdcFileSiteOrigin = \"https://1drv.ms\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAkOU,QAAA,0BAA0B,GAAG,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { HostStoragePolicy } from \"@fluidframework/odsp-driver-definitions\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\n\n/** https://portal.microsofticm.com/imp/v3/incidents/details/308931013/home\n * The commits property was removed from protocol-definitions but in order to support back compat, we will\n * temporarily add back in this local structure in order to upload the snapshot to support rolling back to 0.58.\n * Notice this entire interface will be removed once the backward compatibility is not required anymore.\n*/\nexport interface ISnapshotTreeEx {\n id?: string;\n blobs: { [path: string]: string; };\n commits: { [path: string]: string; };\n trees: { [path: string]: ISnapshotTreeEx; };\n // Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.\n unreferenced?: true;\n}\n\n/**\n * Socket storage discovery api response\n */\nexport interface ISocketStorageDiscovery {\n // The id of the web socket\n id: string;\n\n // SPO gives us runtimeTenantId, we remap it to tenantId\n // See getSocketStorageDiscovery\n runtimeTenantId?: string;\n tenantId: string;\n\n snapshotStorageUrl: string;\n deltaStorageUrl: string;\n\n /**\n * PUSH URL\n */\n deltaStreamSocketUrl: string;\n\n /**\n * The access token for PushChannel. Optionally returned, depending on implementation.\n * OneDrive for Consumer implementation returns it and OneDrive for Business implementation\n * does not return it and instead expects token to be returned via `getWebsocketToken` callback\n * passed as a parameter to `OdspDocumentService.create()` factory.\n */\n socketToken?: string;\n\n /**\n * This is the time within which client has to refresh the session on (ODSP) relay service.\n */\n refreshSessionDurationSeconds?: number;\n}\n\n/**\n * Interface for error responses for the WebSocket connection\n */\nexport interface IOdspSocketError {\n /**\n * An error code number for the error that occurred\n * It will be a valid HTTP status code\n */\n code: number;\n\n /**\n * A message about the error that occurred for debugging / logging purposes\n * This should not be displayed to the user directly\n */\n message: string;\n\n /**\n * Optional Retry-After time in seconds\n * The client should wait this many seconds before retrying its request\n */\n retryAfter?: number;\n}\n\n/**\n * Interface for delta storage response.\n * Contains either SequencedDocumentMessages or SequencedDeltaOpMessage.\n */\nexport interface IDeltaStorageGetResponse {\n value: api.ISequencedDocumentMessage[] | ISequencedDeltaOpMessage[];\n}\n\nexport interface ISequencedDeltaOpMessage {\n op: api.ISequencedDocumentMessage;\n sequenceNumber: number;\n}\n\nexport interface IDocumentStorageGetVersionsResponse {\n value: IDocumentStorageVersion[];\n}\n\nexport interface IDocumentStorageVersion {\n id: string;\n}\n\n/**\n *\n * Data structures that form ODSP Summary\n *\n */\n\nexport interface IOdspSummaryPayload {\n type: \"container\" | \"channel\";\n message: string;\n sequenceNumber: number;\n entries: OdspSummaryTreeEntry[];\n}\n\nexport interface IWriteSummaryResponse {\n id: string;\n}\n\nexport type OdspSummaryTreeEntry = IOdspSummaryTreeValueEntry | IOdspSummaryTreeHandleEntry;\n\nexport interface IOdspSummaryTreeBaseEntry {\n path: string;\n type: \"blob\" | \"tree\" | \"commit\";\n}\n\nexport interface IOdspSummaryTreeValueEntry extends IOdspSummaryTreeBaseEntry {\n value: OdspSummaryTreeValue;\n // Indicates that this tree entry is unreferenced. If this is not present, the tree entry is considered referenced.\n unreferenced?: true;\n}\n\nexport interface IOdspSummaryTreeHandleEntry extends IOdspSummaryTreeBaseEntry {\n id: string;\n}\n\nexport type OdspSummaryTreeValue = IOdspSummaryTree | IOdspSummaryBlob;\n\nexport interface IOdspSummaryTree {\n type: \"tree\";\n entries?: OdspSummaryTreeEntry[];\n}\n\nexport interface IOdspSummaryBlob {\n type: \"blob\";\n content: string;\n encoding: \"base64\" | \"utf-8\";\n}\n\n/**\n *\n * Data structures that form ODSP Snapshot\n *\n */\n\nexport interface IOdspSnapshotTreeEntryTree {\n path: string;\n type: \"tree\";\n // Indicates that this tree entry is unreferenced. If this is not present, the tree entry is considered referenced.\n unreferenced?: true;\n}\n\nexport interface IOdspSnapshotTreeEntryCommit {\n id: string;\n path: string;\n type: \"commit\";\n}\n\nexport interface IOdspSnapshotTreeEntryBlob {\n id: string;\n path: string;\n type: \"blob\";\n}\n\nexport type IOdspSnapshotTreeEntry =\n | IOdspSnapshotTreeEntryTree\n | IOdspSnapshotTreeEntryCommit\n | IOdspSnapshotTreeEntryBlob;\n\nexport interface IOdspSnapshotCommit {\n entries: IOdspSnapshotTreeEntry[];\n id: string;\n sequenceNumber: number;\n}\n\n/**\n * Blob content, represents blobs in downloaded snapshot.\n */\nexport interface IOdspSnapshotBlob {\n content: string;\n // SPO only uses \"base64\" today for download.\n // We are adding undefined too, as temp way to roundtrip strings unchanged.\n encoding: \"base64\" | undefined;\n id: string;\n size: number;\n}\n\nexport interface IOdspSnapshot {\n id: string;\n trees: IOdspSnapshotCommit[];\n blobs?: IOdspSnapshotBlob[];\n ops?: ISequencedDeltaOpMessage[];\n}\n\n/**\n * Same as HostStoragePolicy, but adds options that are internal to runtime.\n * All fields should be optional.\n */\nexport interface HostStoragePolicyInternal extends HostStoragePolicy {\n summarizerClient?: boolean;\n}\n\nexport interface ICreateFileResponse {\n \"@odata.context\": string;\n driveId: string;\n id: string;\n itemId: string;\n itemUrl: string;\n sequenceNumber: number;\n sharingLink?: string;\n sharingLinkErrorReason?: string;\n}\n\nexport interface IVersionedValueWithEpoch {\n value: any;\n fluidEpoch: string;\n // This is same as \"persistedCacheValueVersion\" below. This represents the version of data stored in cache.\n version: 3;\n}\n\nexport const persistedCacheValueVersion = 3;\n\nexport interface IGetOpsResponse {\n nonce: string;\n code: number;\n /** Time in seconds. Currently never set by PUSH */\n retryAfter?: number;\n messages?: api.ISequencedDocumentMessage[];\n}\n\nexport interface IFlushOpsResponse {\n nonce: string;\n code: number;\n /** Time in seconds */\n retryAfter?: number;\n lastPersistedSequenceNumber?: number;\n}\n\n/**\n * Represents the cached snapshot value.\n */\nexport interface ISnapshotCachedEntry extends ISnapshotContents {\n cacheEntryTime: number;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contractsPublic.js","sourceRoot":"","sources":["../src/contractsPublic.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAYH,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,yGAAyG;IACzG,sDAAsD;IACtD,oEAA+C,CAAA;AACnD,CAAC,EAJW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAI5B;AAMD,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC7B,oGAAoG;IACpG,wGAAwG;IACxG,kEAAyC,CAAA;AAC7C,CAAC,EAJW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAIhC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IOdspUrlParts } from \"@fluidframework/odsp-driver-definitions\";\n\nexport interface OdspFluidDataStoreLocator extends IOdspUrlParts {\n dataStorePath: string;\n appName?: string;\n containerPackageName?: string;\n fileVersion?: string;\n context?: string;\n}\n\nexport enum SharingLinkHeader {\n // Can be used in request made to resolver, to tell the resolver that the passed in URL is a sharing link\n // which can be redeemed at server to get permissions.\n isSharingLinkToRedeem = \"isSharingLinkToRedeem\",\n}\n\nexport interface ISharingLinkHeader {\n [SharingLinkHeader.isSharingLinkToRedeem]: boolean;\n}\n\nexport enum ClpCompliantAppHeader {\n // Can be used in request made to resolver, to tell the resolver that the host app is CLP compliant.\n // Odsp will not return Classified, labeled, or protected documents if the host app cannot support them.\n isClpCompliantApp = \"X-CLP-Compliant-App\",\n}\n\nexport interface IClpCompliantAppHeader {\n [ClpCompliantAppHeader.isClpCompliantApp]: boolean;\n}\n\ndeclare module \"@fluidframework/core-interfaces\" {\n // eslint-disable-next-line @typescript-eslint/no-empty-interface\n export interface IRequestHeader extends Partial<ISharingLinkHeader>, Partial<IClpCompliantAppHeader> { }\n}\n"]}
@@ -1,242 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.convertSummaryToSnapshotTreeForCreateNew = exports.createNewFluidFileFromSummary = exports.createNewEmptyFluidFile = exports.createNewFluidFile = void 0;
8
- const uuid_1 = require("uuid");
9
- const common_utils_1 = require("@fluidframework/common-utils");
10
- const driver_utils_1 = require("@fluidframework/driver-utils");
11
- const protocol_base_1 = require("@fluidframework/protocol-base");
12
- const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
13
- const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
14
- const odsp_driver_definitions_1 = require("@fluidframework/odsp-driver-definitions");
15
- const driver_definitions_1 = require("@fluidframework/driver-definitions");
16
- const getUrlAndHeadersWithAuth_1 = require("./getUrlAndHeadersWithAuth");
17
- const odspUtils_1 = require("./odspUtils");
18
- const createOdspUrl_1 = require("./createOdspUrl");
19
- const odspUrlHelper_1 = require("./odspUrlHelper");
20
- const odspDriverUrlResolver_1 = require("./odspDriverUrlResolver");
21
- const createNewUtils_1 = require("./createNewUtils");
22
- const retryUtils_1 = require("./retryUtils");
23
- const packageVersion_1 = require("./packageVersion");
24
- const contractsPublic_1 = require("./contractsPublic");
25
- const isInvalidFileName = (fileName) => {
26
- const invalidCharsRegex = /["*/:<>?\\|]+/g;
27
- return !!fileName.match(invalidCharsRegex);
28
- };
29
- /**
30
- * Creates a new Fluid file.
31
- * Returns resolved url
32
- */
33
- async function createNewFluidFile(getStorageToken, newFileInfo, logger, createNewSummary, epochTracker, fileEntry, createNewCaching, forceAccessTokenViaAuthorizationHeader, isClpCompliantApp) {
34
- // Check for valid filename before the request to create file is actually made.
35
- if (isInvalidFileName(newFileInfo.filename)) {
36
- throw new driver_utils_1.NonRetryableError(
37
- // pre-0.58 error message: Invalid filename
38
- "Invalid filename for createNew", odsp_driver_definitions_1.OdspErrorType.invalidFileNameError, { driverVersion: packageVersion_1.pkgVersion });
39
- }
40
- let itemId;
41
- let summaryHandle = "";
42
- let sharingLink;
43
- let sharingLinkErrorReason;
44
- if (createNewSummary === undefined) {
45
- itemId = await createNewEmptyFluidFile(getStorageToken, newFileInfo, logger, epochTracker, forceAccessTokenViaAuthorizationHeader);
46
- }
47
- else {
48
- const content = await createNewFluidFileFromSummary(getStorageToken, newFileInfo, logger, createNewSummary, epochTracker, forceAccessTokenViaAuthorizationHeader);
49
- itemId = content.itemId;
50
- summaryHandle = content.id;
51
- sharingLink = content.sharingLink;
52
- sharingLinkErrorReason = content.sharingLinkErrorReason;
53
- }
54
- const odspUrl = (0, createOdspUrl_1.createOdspUrl)(Object.assign(Object.assign({}, newFileInfo), { itemId, dataStorePath: "/" }));
55
- const resolver = new odspDriverUrlResolver_1.OdspDriverUrlResolver();
56
- const odspResolvedUrl = await resolver.resolve({
57
- url: odspUrl,
58
- headers: { [contractsPublic_1.ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp },
59
- });
60
- fileEntry.docId = odspResolvedUrl.hashedDocumentId;
61
- fileEntry.resolvedUrl = odspResolvedUrl;
62
- if (sharingLink || sharingLinkErrorReason) {
63
- odspResolvedUrl.shareLinkInfo = {
64
- createLink: {
65
- type: newFileInfo.createLinkType,
66
- link: sharingLink,
67
- error: sharingLinkErrorReason,
68
- },
69
- };
70
- }
71
- if (createNewSummary !== undefined && createNewCaching) {
72
- (0, common_utils_1.assert)(summaryHandle !== undefined, 0x203 /* "Summary handle is undefined" */);
73
- // converting summary and getting sequence number
74
- const snapshot = (0, createNewUtils_1.convertCreateNewSummaryTreeToTreeAndBlobs)(createNewSummary, summaryHandle);
75
- // caching the converted summary
76
- await epochTracker.put((0, odspUtils_1.createCacheSnapshotKey)(odspResolvedUrl), snapshot);
77
- }
78
- return odspResolvedUrl;
79
- }
80
- exports.createNewFluidFile = createNewFluidFile;
81
- async function createNewEmptyFluidFile(getStorageToken, newFileInfo, logger, epochTracker, forceAccessTokenViaAuthorizationHeader) {
82
- const filePath = newFileInfo.filePath ? encodeURIComponent(`/${newFileInfo.filePath}`) : "";
83
- // add .tmp extension to empty file (host is expected to rename)
84
- const encodedFilename = encodeURIComponent(`${newFileInfo.filename}.tmp`);
85
- const initialUrl = `${(0, odspUrlHelper_1.getApiRoot)((0, odspUtils_1.getOrigin)(newFileInfo.siteUrl))}/drives/${newFileInfo.driveId}/items/root:/${filePath}/${encodedFilename}:/content?@name.conflictBehavior=rename&select=id,name,parentReference`;
86
- return (0, odspUtils_1.getWithRetryForTokenRefresh)(async (options) => {
87
- const storageToken = await getStorageToken(options, "CreateNewFile");
88
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, { eventName: "createNewEmptyFile" }, async (event) => {
89
- const { url, headers } = (0, getUrlAndHeadersWithAuth_1.getUrlAndHeadersWithAuth)(initialUrl, storageToken, forceAccessTokenViaAuthorizationHeader);
90
- headers["Content-Type"] = "application/json";
91
- const fetchResponse = await (0, retryUtils_1.runWithRetry)(async () => epochTracker.fetchAndParseAsJSON(url, {
92
- body: undefined,
93
- headers,
94
- method: "PUT",
95
- }, "createFile"), "createFile", logger);
96
- const content = fetchResponse.content;
97
- if (!content || !content.id) {
98
- throw new driver_utils_1.NonRetryableError(
99
- // pre-0.58 error message: ODSP CreateFile call returned no item ID
100
- "ODSP CreateFile call returned no item ID (for empty file)", driver_definitions_1.DriverErrorType.incorrectServerResponse, { driverVersion: packageVersion_1.pkgVersion });
101
- }
102
- event.end(Object.assign({ headers: Object.keys(headers).length !== 0 ? true : undefined }, fetchResponse.propsToLog));
103
- return content.id;
104
- }, { end: true, cancel: "error" });
105
- });
106
- }
107
- exports.createNewEmptyFluidFile = createNewEmptyFluidFile;
108
- async function createNewFluidFileFromSummary(getStorageToken, newFileInfo, logger, createNewSummary, epochTracker, forceAccessTokenViaAuthorizationHeader) {
109
- const filePath = newFileInfo.filePath ? encodeURIComponent(`/${newFileInfo.filePath}`) : "";
110
- const encodedFilename = encodeURIComponent(newFileInfo.filename);
111
- const baseUrl = `${(0, odspUrlHelper_1.getApiRoot)((0, odspUtils_1.getOrigin)(newFileInfo.siteUrl))}/drives/${newFileInfo.driveId}/items/root:` +
112
- `${filePath}/${encodedFilename}`;
113
- const containerSnapshot = convertSummaryIntoContainerSnapshot(createNewSummary);
114
- const initialUrl = `${baseUrl}:/opStream/snapshots/snapshot${newFileInfo.createLinkType ?
115
- `?createLinkType=${newFileInfo.createLinkType}` : ""}`;
116
- return (0, odspUtils_1.getWithRetryForTokenRefresh)(async (options) => {
117
- const storageToken = await getStorageToken(options, "CreateNewFile");
118
- return telemetry_utils_1.PerformanceEvent.timedExecAsync(logger, { eventName: "createNewFile" }, async (event) => {
119
- const snapshotBody = JSON.stringify(containerSnapshot);
120
- let url;
121
- let headers;
122
- let addInBody = false;
123
- const formBoundary = (0, uuid_1.v4)();
124
- let postBody = `--${formBoundary}\r\n`;
125
- postBody += `Authorization: Bearer ${storageToken}\r\n`;
126
- postBody += `X-HTTP-Method-Override: POST\r\n`;
127
- postBody += `Content-Type: application/json\r\n`;
128
- postBody += `_post: 1\r\n`;
129
- postBody += `\r\n${snapshotBody}\r\n`;
130
- postBody += `\r\n--${formBoundary}--`;
131
- if (postBody.length <= odspUtils_1.maxUmpPostBodySize) {
132
- const urlObj = new URL(initialUrl);
133
- urlObj.searchParams.set("ump", "1");
134
- url = urlObj.href;
135
- headers = {
136
- "Content-Type": `multipart/form-data;boundary=${formBoundary}`,
137
- };
138
- addInBody = true;
139
- }
140
- else {
141
- const parts = (0, getUrlAndHeadersWithAuth_1.getUrlAndHeadersWithAuth)(initialUrl, storageToken, forceAccessTokenViaAuthorizationHeader);
142
- url = parts.url;
143
- headers = Object.assign(Object.assign({}, parts.headers), { "Content-Type": "application/json" });
144
- postBody = snapshotBody;
145
- }
146
- const fetchResponse = await (0, retryUtils_1.runWithRetry)(async () => epochTracker.fetchAndParseAsJSON(url, {
147
- body: postBody,
148
- headers,
149
- method: "POST",
150
- }, "createFile", addInBody), "createFile", logger);
151
- const content = fetchResponse.content;
152
- if (!content || !content.itemId) {
153
- throw new driver_utils_1.NonRetryableError("ODSP CreateFile call returned no item ID", driver_definitions_1.DriverErrorType.incorrectServerResponse, { driverVersion: packageVersion_1.pkgVersion });
154
- }
155
- event.end(Object.assign({ headers: Object.keys(headers).length !== 0 ? true : undefined, attempts: options.refresh ? 2 : 1 }, fetchResponse.propsToLog));
156
- return content;
157
- });
158
- });
159
- }
160
- exports.createNewFluidFileFromSummary = createNewFluidFileFromSummary;
161
- function convertSummaryIntoContainerSnapshot(createNewSummary) {
162
- var _a;
163
- const appSummary = createNewSummary.tree[".app"];
164
- const protocolSummary = createNewSummary.tree[".protocol"];
165
- if (!(appSummary && protocolSummary)) {
166
- throw new Error("App and protocol summary required for create new path!!");
167
- }
168
- const documentAttributes = (0, driver_utils_1.getDocAttributesFromProtocolSummary)(protocolSummary);
169
- const attributesSummaryBlob = {
170
- type: protocol_definitions_1.SummaryType.Blob,
171
- content: JSON.stringify(documentAttributes),
172
- };
173
- protocolSummary.tree.attributes = attributesSummaryBlob;
174
- const convertedCreateNewSummary = {
175
- type: protocol_definitions_1.SummaryType.Tree,
176
- tree: {
177
- ".protocol": protocolSummary,
178
- ".app": appSummary,
179
- },
180
- };
181
- const snapshotTree = convertSummaryToSnapshotTreeForCreateNew(convertedCreateNewSummary);
182
- const snapshot = {
183
- entries: (_a = snapshotTree.entries) !== null && _a !== void 0 ? _a : [],
184
- message: "app",
185
- sequenceNumber: documentAttributes.sequenceNumber,
186
- type: "container",
187
- };
188
- return snapshot;
189
- }
190
- /**
191
- * Converts a summary tree to ODSP tree
192
- */
193
- function convertSummaryToSnapshotTreeForCreateNew(summary) {
194
- var _a;
195
- const snapshotTree = {
196
- type: "tree",
197
- entries: [],
198
- };
199
- const keys = Object.keys(summary.tree);
200
- for (const key of keys) {
201
- const summaryObject = summary.tree[key];
202
- let value;
203
- // Tracks if an entry is unreferenced. Currently, only tree entries can be marked as unreferenced. If the
204
- // property is not present, the tree entry is considered referenced. If the property is present and is true,
205
- // the tree entry is considered unreferenced.
206
- let unreferenced;
207
- switch (summaryObject.type) {
208
- case protocol_definitions_1.SummaryType.Tree: {
209
- value = convertSummaryToSnapshotTreeForCreateNew(summaryObject);
210
- unreferenced = summaryObject.unreferenced;
211
- break;
212
- }
213
- case protocol_definitions_1.SummaryType.Blob: {
214
- const content = typeof summaryObject.content === "string" ?
215
- summaryObject.content : (0, common_utils_1.Uint8ArrayToString)(summaryObject.content, "base64");
216
- const encoding = typeof summaryObject.content === "string" ? "utf-8" : "base64";
217
- value = {
218
- type: "blob",
219
- content,
220
- encoding,
221
- };
222
- break;
223
- }
224
- case protocol_definitions_1.SummaryType.Handle: {
225
- throw new Error("No handle should be present for first summary!!");
226
- }
227
- default: {
228
- throw new Error(`Unknown tree type ${summaryObject.type}`);
229
- }
230
- }
231
- const entry = {
232
- path: encodeURIComponent(key),
233
- type: (0, protocol_base_1.getGitType)(summaryObject),
234
- value,
235
- unreferenced,
236
- };
237
- (_a = snapshotTree.entries) === null || _a === void 0 ? void 0 : _a.push(entry);
238
- }
239
- return snapshotTree;
240
- }
241
- exports.convertSummaryToSnapshotTreeForCreateNew = convertSummaryToSnapshotTreeForCreateNew;
242
- //# sourceMappingURL=createFile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createFile.js","sourceRoot":"","sources":["../src/createFile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAClC,+DAA0E;AAC1E,+DAAsG;AACtG,iEAA2D;AAC3D,+EAA+F;AAE/F,qEAAmE;AACnE,qFAKiD;AACjD,2EAAqE;AAQrE,yEAAsE;AACtE,2CAMqB;AAErB,mDAAgD;AAChD,mDAA6C;AAE7C,mEAAgE;AAChE,qDAA6E;AAC7E,6CAA4C;AAC5C,qDAA+D;AAC/D,uDAA0D;AAE1D,MAAM,iBAAiB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aAAa,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;gBAEhF,KAAK,GAAG;oBACJ,IAAI,EAAE,MAAM;oBACZ,OAAO;oBACP,QAAQ;iBACX,CAAC;gBACF,MAAM;aACT;YACD,KAAK,kCAAW,CAAC,MAAM,CAAC,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;aACtE;YACD,OAAO,CAAC,CAAC;gBACL,MAAM,IAAI,KAAK,CAAC,qBAAqB,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;aAC9D;SACJ;QAED,MAAM,KAAK,GAAyB;YAChC,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC;YAC7B,IAAI,EAAE,IAAA,0BAAU,EAAC,aAAa,CAAC;YAC/B,KAAK;YACL,YAAY;SACf,CAAC;QACF,MAAA,YAAY,CAAC,OAAO,0CAAE,IAAI,CAAC,KAAK,CAAC,CAAC;KACrC;IAED,OAAO,YAAY,CAAC;AACxB,CAAC;AApDD,4FAoDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { assert, Uint8ArrayToString } from \"@fluidframework/common-utils\";\nimport { getDocAttributesFromProtocolSummary, NonRetryableError } from \"@fluidframework/driver-utils\";\nimport { getGitType } from \"@fluidframework/protocol-base\";\nimport { SummaryType, ISummaryTree, ISummaryBlob } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n IFileEntry,\n InstrumentedStorageTokenFetcher,\n IOdspResolvedUrl,\n OdspErrorType,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport {\n IOdspSummaryTree,\n OdspSummaryTreeValue,\n OdspSummaryTreeEntry,\n ICreateFileResponse,\n IOdspSummaryPayload,\n} from \"./contracts\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth\";\nimport {\n createCacheSnapshotKey,\n getWithRetryForTokenRefresh,\n INewFileInfo,\n getOrigin,\n maxUmpPostBodySize,\n} from \"./odspUtils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { createOdspUrl } from \"./createOdspUrl\";\nimport { getApiRoot } from \"./odspUrlHelper\";\nimport { EpochTracker } from \"./epochTracker\";\nimport { OdspDriverUrlResolver } from \"./odspDriverUrlResolver\";\nimport { convertCreateNewSummaryTreeToTreeAndBlobs } from \"./createNewUtils\";\nimport { runWithRetry } from \"./retryUtils\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { ClpCompliantAppHeader } from \"./contractsPublic\";\n\nconst isInvalidFileName = (fileName: string): boolean => {\n const invalidCharsRegex = /[\"*/:<>?\\\\|]+/g;\n return !!fileName.match(invalidCharsRegex);\n};\n\n/**\n * Creates a new Fluid file.\n * Returns resolved url\n */\nexport async function createNewFluidFile(\n getStorageToken: InstrumentedStorageTokenFetcher,\n newFileInfo: INewFileInfo,\n logger: ITelemetryLogger,\n createNewSummary: ISummaryTree | undefined,\n epochTracker: EpochTracker,\n fileEntry: IFileEntry,\n createNewCaching: boolean,\n forceAccessTokenViaAuthorizationHeader: boolean,\n isClpCompliantApp?: boolean,\n): Promise<IOdspResolvedUrl> {\n // Check for valid filename before the request to create file is actually made.\n if (isInvalidFileName(newFileInfo.filename)) {\n throw new NonRetryableError(\n // pre-0.58 error message: Invalid filename\n \"Invalid filename for createNew\", OdspErrorType.invalidFileNameError, { driverVersion });\n }\n\n let itemId: string;\n let summaryHandle: string = \"\";\n let sharingLink: string | undefined;\n let sharingLinkErrorReason: string | undefined;\n if (createNewSummary === undefined) {\n itemId = await createNewEmptyFluidFile(\n getStorageToken, newFileInfo, logger, epochTracker, forceAccessTokenViaAuthorizationHeader);\n } else {\n const content = await createNewFluidFileFromSummary(\n getStorageToken,\n newFileInfo,\n logger,\n createNewSummary,\n epochTracker,\n forceAccessTokenViaAuthorizationHeader,\n );\n itemId = content.itemId;\n summaryHandle = content.id;\n sharingLink = content.sharingLink;\n sharingLinkErrorReason = content.sharingLinkErrorReason;\n }\n\n const odspUrl = createOdspUrl({ ...newFileInfo, itemId, dataStorePath: \"/\" });\n const resolver = new OdspDriverUrlResolver();\n const odspResolvedUrl = await resolver.resolve({\n url: odspUrl,\n headers: { [ClpCompliantAppHeader.isClpCompliantApp]: isClpCompliantApp },\n });\n fileEntry.docId = odspResolvedUrl.hashedDocumentId;\n fileEntry.resolvedUrl = odspResolvedUrl;\n\n if (sharingLink || sharingLinkErrorReason) {\n odspResolvedUrl.shareLinkInfo = {\n createLink: {\n type: newFileInfo.createLinkType,\n link: sharingLink,\n error: sharingLinkErrorReason,\n },\n };\n }\n\n if (createNewSummary !== undefined && createNewCaching) {\n assert(summaryHandle !== undefined, 0x203 /* \"Summary handle is undefined\" */);\n // converting summary and getting sequence number\n const snapshot: ISnapshotContents = convertCreateNewSummaryTreeToTreeAndBlobs(createNewSummary, summaryHandle);\n // caching the converted summary\n await epochTracker.put(createCacheSnapshotKey(odspResolvedUrl), snapshot);\n }\n return odspResolvedUrl;\n}\n\nexport async function createNewEmptyFluidFile(\n getStorageToken: InstrumentedStorageTokenFetcher,\n newFileInfo: INewFileInfo,\n logger: ITelemetryLogger,\n epochTracker: EpochTracker,\n forceAccessTokenViaAuthorizationHeader: boolean,\n): Promise<string> {\n const filePath = newFileInfo.filePath ? encodeURIComponent(`/${newFileInfo.filePath}`) : \"\";\n // add .tmp extension to empty file (host is expected to rename)\n const encodedFilename = encodeURIComponent(`${newFileInfo.filename}.tmp`);\n const initialUrl =\n `${getApiRoot(getOrigin(newFileInfo.siteUrl))}/drives/${newFileInfo.driveId}/items/root:/${filePath\n }/${encodedFilename}:/content?@name.conflictBehavior=rename&select=id,name,parentReference`;\n\n return getWithRetryForTokenRefresh(async (options) => {\n const storageToken = await getStorageToken(options, \"CreateNewFile\");\n\n return PerformanceEvent.timedExecAsync(\n logger,\n { eventName: \"createNewEmptyFile\" },\n async (event) => {\n const { url, headers } = getUrlAndHeadersWithAuth(\n initialUrl, storageToken, forceAccessTokenViaAuthorizationHeader);\n headers[\"Content-Type\"] = \"application/json\";\n\n const fetchResponse = await runWithRetry(\n async () => epochTracker.fetchAndParseAsJSON<ICreateFileResponse>(\n url,\n {\n body: undefined,\n headers,\n method: \"PUT\",\n },\n \"createFile\",\n ),\n \"createFile\",\n logger,\n );\n\n const content = fetchResponse.content;\n if (!content || !content.id) {\n throw new NonRetryableError(\n // pre-0.58 error message: ODSP CreateFile call returned no item ID\n \"ODSP CreateFile call returned no item ID (for empty file)\",\n DriverErrorType.incorrectServerResponse,\n { driverVersion });\n }\n event.end({\n headers: Object.keys(headers).length !== 0 ? true : undefined,\n ...fetchResponse.propsToLog,\n });\n return content.id;\n },\n { end: true, cancel: \"error\" });\n });\n}\n\nexport async function createNewFluidFileFromSummary(\n getStorageToken: InstrumentedStorageTokenFetcher,\n newFileInfo: INewFileInfo,\n logger: ITelemetryLogger,\n createNewSummary: ISummaryTree,\n epochTracker: EpochTracker,\n forceAccessTokenViaAuthorizationHeader: boolean,\n): Promise<ICreateFileResponse> {\n const filePath = newFileInfo.filePath ? encodeURIComponent(`/${newFileInfo.filePath}`) : \"\";\n const encodedFilename = encodeURIComponent(newFileInfo.filename);\n const baseUrl =\n `${getApiRoot(getOrigin(newFileInfo.siteUrl))}/drives/${newFileInfo.driveId}/items/root:` +\n `${filePath}/${encodedFilename}`;\n\n const containerSnapshot = convertSummaryIntoContainerSnapshot(createNewSummary);\n const initialUrl = `${baseUrl}:/opStream/snapshots/snapshot${newFileInfo.createLinkType ?\n `?createLinkType=${newFileInfo.createLinkType}` : \"\"}`;\n\n return getWithRetryForTokenRefresh(async (options) => {\n const storageToken = await getStorageToken(options, \"CreateNewFile\");\n\n return PerformanceEvent.timedExecAsync(\n logger,\n { eventName: \"createNewFile\" },\n async (event) => {\n const snapshotBody = JSON.stringify(containerSnapshot);\n let url: string;\n let headers: { [index: string]: string; };\n let addInBody = false;\n const formBoundary = uuid();\n let postBody = `--${formBoundary}\\r\\n`;\n postBody += `Authorization: Bearer ${storageToken}\\r\\n`;\n postBody += `X-HTTP-Method-Override: POST\\r\\n`;\n postBody += `Content-Type: application/json\\r\\n`;\n postBody += `_post: 1\\r\\n`;\n postBody += `\\r\\n${snapshotBody}\\r\\n`;\n postBody += `\\r\\n--${formBoundary}--`;\n\n if (postBody.length <= maxUmpPostBodySize) {\n const urlObj = new URL(initialUrl);\n urlObj.searchParams.set(\"ump\", \"1\");\n url = urlObj.href;\n headers = {\n \"Content-Type\": `multipart/form-data;boundary=${formBoundary}`,\n };\n addInBody = true;\n } else {\n const parts = getUrlAndHeadersWithAuth(\n initialUrl, storageToken, forceAccessTokenViaAuthorizationHeader);\n url = parts.url;\n headers = {\n ...parts.headers,\n \"Content-Type\": \"application/json\",\n };\n postBody = snapshotBody;\n }\n\n const fetchResponse = await runWithRetry(\n async () => epochTracker.fetchAndParseAsJSON<ICreateFileResponse>(\n url,\n {\n body: postBody,\n headers,\n method: \"POST\",\n },\n \"createFile\",\n addInBody,\n ),\n \"createFile\",\n logger,\n );\n\n const content = fetchResponse.content;\n if (!content || !content.itemId) {\n throw new NonRetryableError(\n \"ODSP CreateFile call returned no item ID\",\n DriverErrorType.incorrectServerResponse,\n { driverVersion });\n }\n event.end({\n headers: Object.keys(headers).length !== 0 ? true : undefined,\n attempts: options.refresh ? 2 : 1,\n ...fetchResponse.propsToLog,\n });\n return content;\n },\n );\n });\n}\n\nfunction convertSummaryIntoContainerSnapshot(createNewSummary: ISummaryTree) {\n const appSummary = createNewSummary.tree[\".app\"] as ISummaryTree;\n const protocolSummary = createNewSummary.tree[\".protocol\"] as ISummaryTree;\n if (!(appSummary && protocolSummary)) {\n throw new Error(\"App and protocol summary required for create new path!!\");\n }\n const documentAttributes = getDocAttributesFromProtocolSummary(protocolSummary);\n const attributesSummaryBlob: ISummaryBlob = {\n type: SummaryType.Blob,\n content: JSON.stringify(documentAttributes),\n };\n protocolSummary.tree.attributes = attributesSummaryBlob;\n const convertedCreateNewSummary: ISummaryTree = {\n type: SummaryType.Tree,\n tree: {\n \".protocol\": protocolSummary,\n \".app\": appSummary,\n },\n };\n const snapshotTree = convertSummaryToSnapshotTreeForCreateNew(convertedCreateNewSummary);\n const snapshot: IOdspSummaryPayload = {\n entries: snapshotTree.entries ?? [],\n message: \"app\",\n sequenceNumber: documentAttributes.sequenceNumber,\n type: \"container\",\n };\n return snapshot;\n}\n\n/**\n * Converts a summary tree to ODSP tree\n */\nexport function convertSummaryToSnapshotTreeForCreateNew(summary: ISummaryTree): IOdspSummaryTree {\n const snapshotTree: IOdspSummaryTree = {\n type: \"tree\",\n entries: [],\n };\n\n const keys = Object.keys(summary.tree);\n for (const key of keys) {\n const summaryObject = summary.tree[key];\n\n let value: OdspSummaryTreeValue;\n // Tracks if an entry is unreferenced. Currently, only tree entries can be marked as unreferenced. If the\n // property is not present, the tree entry is considered referenced. If the property is present and is true,\n // the tree entry is considered unreferenced.\n let unreferenced: true | undefined;\n\n switch (summaryObject.type) {\n case SummaryType.Tree: {\n value = convertSummaryToSnapshotTreeForCreateNew(summaryObject);\n unreferenced = summaryObject.unreferenced;\n break;\n }\n case SummaryType.Blob: {\n const content = typeof summaryObject.content === \"string\" ?\n summaryObject.content : Uint8ArrayToString(summaryObject.content, \"base64\");\n const encoding = typeof summaryObject.content === \"string\" ? \"utf-8\" : \"base64\";\n\n value = {\n type: \"blob\",\n content,\n encoding,\n };\n break;\n }\n case SummaryType.Handle: {\n throw new Error(\"No handle should be present for first summary!!\");\n }\n default: {\n throw new Error(`Unknown tree type ${summaryObject.type}`);\n }\n }\n\n const entry: OdspSummaryTreeEntry = {\n path: encodeURIComponent(key),\n type: getGitType(summaryObject),\n value,\n unreferenced,\n };\n snapshotTree.entries?.push(entry);\n }\n\n return snapshotTree;\n}\n"]}