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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (666) hide show
  1. package/.eslintrc.js +12 -12
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +162 -0
  4. package/README.md +56 -0
  5. package/api-extractor-esm.json +4 -0
  6. package/api-extractor-lint.json +4 -0
  7. package/api-extractor.json +2 -2
  8. package/api-report/odsp-driver.api.md +309 -0
  9. package/dist/{ReadBufferUtils.js → ReadBufferUtils.cjs} +16 -9
  10. package/dist/ReadBufferUtils.cjs.map +1 -0
  11. package/dist/ReadBufferUtils.d.ts.map +1 -1
  12. package/dist/{WriteBufferUtils.js → WriteBufferUtils.cjs} +73 -69
  13. package/dist/WriteBufferUtils.cjs.map +1 -0
  14. package/dist/WriteBufferUtils.d.ts +3 -5
  15. package/dist/WriteBufferUtils.d.ts.map +1 -1
  16. package/dist/{checkUrl.js → checkUrl.cjs} +7 -6
  17. package/dist/checkUrl.cjs.map +1 -0
  18. package/dist/checkUrl.d.ts +1 -0
  19. package/dist/checkUrl.d.ts.map +1 -1
  20. package/dist/compactSnapshotParser.cjs +207 -0
  21. package/dist/compactSnapshotParser.cjs.map +1 -0
  22. package/dist/compactSnapshotParser.d.ts +12 -3
  23. package/dist/compactSnapshotParser.d.ts.map +1 -1
  24. package/dist/{compactSnapshotWriter.js → compactSnapshotWriter.cjs} +43 -33
  25. package/dist/compactSnapshotWriter.cjs.map +1 -0
  26. package/dist/compactSnapshotWriter.d.ts +2 -3
  27. package/dist/compactSnapshotWriter.d.ts.map +1 -1
  28. package/dist/{constants.js → constants.cjs} +7 -1
  29. package/dist/constants.cjs.map +1 -0
  30. package/dist/constants.d.ts +6 -0
  31. package/dist/constants.d.ts.map +1 -1
  32. package/dist/{contracts.js → contracts.cjs} +1 -1
  33. package/dist/contracts.cjs.map +1 -0
  34. package/dist/contracts.d.ts +16 -53
  35. package/dist/contracts.d.ts.map +1 -1
  36. package/dist/{contractsPublic.js → contractsPublic.cjs} +9 -3
  37. package/dist/contractsPublic.cjs.map +1 -0
  38. package/dist/contractsPublic.d.ts +15 -0
  39. package/dist/contractsPublic.d.ts.map +1 -1
  40. package/dist/createFile.cjs +177 -0
  41. package/dist/createFile.cjs.map +1 -0
  42. package/dist/createFile.d.ts +6 -10
  43. package/dist/createFile.d.ts.map +1 -1
  44. package/dist/createNewContainerOnExistingFile.cjs +60 -0
  45. package/dist/createNewContainerOnExistingFile.cjs.map +1 -0
  46. package/dist/createNewContainerOnExistingFile.d.ts +22 -0
  47. package/dist/createNewContainerOnExistingFile.d.ts.map +1 -0
  48. package/dist/createNewModule.cjs +12 -0
  49. package/dist/createNewModule.cjs.map +1 -0
  50. package/dist/createNewModule.d.ts +7 -0
  51. package/dist/createNewModule.d.ts.map +1 -0
  52. package/dist/createNewUtils.cjs +203 -0
  53. package/dist/createNewUtils.cjs.map +1 -0
  54. package/dist/createNewUtils.d.ts +16 -0
  55. package/dist/createNewUtils.d.ts.map +1 -1
  56. package/dist/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.cjs} +8 -4
  57. package/dist/createOdspCreateContainerRequest.cjs.map +1 -0
  58. package/dist/createOdspCreateContainerRequest.d.ts +5 -3
  59. package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
  60. package/dist/{createOdspUrl.js → createOdspUrl.cjs} +2 -1
  61. package/dist/createOdspUrl.cjs.map +1 -0
  62. package/dist/createOdspUrl.d.ts +1 -0
  63. package/dist/createOdspUrl.d.ts.map +1 -1
  64. package/dist/{epochTracker.js → epochTracker.cjs} +102 -48
  65. package/dist/epochTracker.cjs.map +1 -0
  66. package/dist/epochTracker.d.ts +32 -8
  67. package/dist/epochTracker.d.ts.map +1 -1
  68. package/dist/{fetch.js → fetch.cjs} +1 -1
  69. package/dist/fetch.cjs.map +1 -0
  70. package/dist/fetch.d.ts +1 -1
  71. package/dist/fetch.d.ts.map +1 -1
  72. package/dist/{fetchSnapshot.js → fetchSnapshot.cjs} +192 -176
  73. package/dist/fetchSnapshot.cjs.map +1 -0
  74. package/dist/fetchSnapshot.d.ts +10 -5
  75. package/dist/fetchSnapshot.d.ts.map +1 -1
  76. package/dist/{getFileLink.js → getFileLink.cjs} +52 -41
  77. package/dist/getFileLink.cjs.map +1 -0
  78. package/dist/getFileLink.d.ts +4 -7
  79. package/dist/getFileLink.d.ts.map +1 -1
  80. package/dist/{getQueryString.js → getQueryString.cjs} +1 -1
  81. package/dist/getQueryString.cjs.map +1 -0
  82. package/dist/getQueryString.d.ts.map +1 -1
  83. package/dist/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.cjs} +4 -2
  84. package/dist/getUrlAndHeadersWithAuth.cjs.map +1 -0
  85. package/dist/getUrlAndHeadersWithAuth.d.ts.map +1 -1
  86. package/dist/index.cjs +59 -0
  87. package/dist/index.cjs.map +1 -0
  88. package/dist/index.d.ts +19 -16
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs +35 -0
  91. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +1 -0
  92. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts +17 -0
  93. package/dist/localOdspDriver/localOdspDeltaStorageService.d.ts.map +1 -0
  94. package/dist/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.cjs} +7 -5
  95. package/dist/localOdspDriver/localOdspDocumentService.cjs.map +1 -0
  96. package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
  97. package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
  98. package/dist/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.cjs} +9 -10
  99. package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +1 -0
  100. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts +2 -3
  101. package/dist/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +1 -1
  102. package/dist/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.cjs} +13 -11
  103. package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +1 -0
  104. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -2
  105. package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
  106. package/dist/odsp-driver-alpha.d.ts +496 -0
  107. package/dist/odsp-driver-beta.d.ts +160 -0
  108. package/dist/odsp-driver-public.d.ts +160 -0
  109. package/dist/odsp-driver-untrimmed.d.ts +565 -0
  110. package/dist/{odspCache.js → odspCache.cjs} +9 -10
  111. package/dist/odspCache.cjs.map +1 -0
  112. package/dist/odspCache.d.ts +19 -4
  113. package/dist/odspCache.d.ts.map +1 -1
  114. package/dist/odspDelayLoadedDeltaStream.cjs +291 -0
  115. package/dist/odspDelayLoadedDeltaStream.cjs.map +1 -0
  116. package/dist/odspDelayLoadedDeltaStream.d.ts +75 -0
  117. package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -0
  118. package/dist/{odspDeltaStorageService.js → odspDeltaStorageService.cjs} +70 -71
  119. package/dist/odspDeltaStorageService.cjs.map +1 -0
  120. package/dist/odspDeltaStorageService.d.ts +8 -6
  121. package/dist/odspDeltaStorageService.d.ts.map +1 -1
  122. package/dist/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.cjs} +224 -113
  123. package/dist/odspDocumentDeltaConnection.cjs.map +1 -0
  124. package/dist/odspDocumentDeltaConnection.d.ts +32 -12
  125. package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
  126. package/dist/odspDocumentService.cjs +225 -0
  127. package/dist/odspDocumentService.cjs.map +1 -0
  128. package/dist/odspDocumentService.d.ts +11 -25
  129. package/dist/odspDocumentService.d.ts.map +1 -1
  130. package/dist/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.cjs} +8 -5
  131. package/dist/odspDocumentServiceFactory.cjs.map +1 -0
  132. package/dist/odspDocumentServiceFactory.d.ts +4 -0
  133. package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
  134. package/dist/odspDocumentServiceFactoryCore.cjs +196 -0
  135. package/dist/odspDocumentServiceFactoryCore.cjs.map +1 -0
  136. package/dist/odspDocumentServiceFactoryCore.d.ts +18 -11
  137. package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
  138. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs +20 -0
  139. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +1 -0
  140. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +5 -0
  141. package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
  142. package/dist/odspDocumentStorageManager.cjs +490 -0
  143. package/dist/odspDocumentStorageManager.cjs.map +1 -0
  144. package/dist/odspDocumentStorageManager.d.ts +11 -5
  145. package/dist/odspDocumentStorageManager.d.ts.map +1 -1
  146. package/dist/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.cjs} +32 -34
  147. package/dist/odspDocumentStorageServiceBase.cjs.map +1 -0
  148. package/dist/odspDocumentStorageServiceBase.d.ts +7 -9
  149. package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
  150. package/dist/{odspDriverUrlResolver.js → odspDriverUrlResolver.cjs} +50 -36
  151. package/dist/odspDriverUrlResolver.cjs.map +1 -0
  152. package/dist/odspDriverUrlResolver.d.ts +12 -0
  153. package/dist/odspDriverUrlResolver.d.ts.map +1 -1
  154. package/dist/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.cjs} +37 -26
  155. package/dist/odspDriverUrlResolverForShareLink.cjs.map +1 -0
  156. package/dist/odspDriverUrlResolverForShareLink.d.ts +5 -3
  157. package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
  158. package/dist/{odspError.js → odspError.cjs} +7 -3
  159. package/dist/odspError.cjs.map +1 -0
  160. package/dist/odspError.d.ts.map +1 -1
  161. package/dist/{odspFluidFileLink.js → odspFluidFileLink.cjs} +25 -18
  162. package/dist/odspFluidFileLink.cjs.map +1 -0
  163. package/dist/odspFluidFileLink.d.ts +10 -1
  164. package/dist/odspFluidFileLink.d.ts.map +1 -1
  165. package/dist/odspLocationRedirection.cjs +24 -0
  166. package/dist/odspLocationRedirection.cjs.map +1 -0
  167. package/dist/odspLocationRedirection.d.ts +14 -0
  168. package/dist/odspLocationRedirection.d.ts.map +1 -0
  169. package/dist/{odspPublicUtils.js → odspPublicUtils.cjs} +7 -4
  170. package/dist/odspPublicUtils.cjs.map +1 -0
  171. package/dist/odspPublicUtils.d.ts +6 -0
  172. package/dist/odspPublicUtils.d.ts.map +1 -1
  173. package/dist/{odspSnapshotParser.js → odspSnapshotParser.cjs} +11 -12
  174. package/dist/odspSnapshotParser.cjs.map +1 -0
  175. package/dist/odspSnapshotParser.d.ts.map +1 -1
  176. package/dist/{odspSummaryUploadManager.js → odspSummaryUploadManager.cjs} +47 -34
  177. package/dist/odspSummaryUploadManager.cjs.map +1 -0
  178. package/dist/odspSummaryUploadManager.d.ts +7 -4
  179. package/dist/odspSummaryUploadManager.d.ts.map +1 -1
  180. package/dist/{odspUrlHelper.js → odspUrlHelper.cjs} +9 -3
  181. package/dist/odspUrlHelper.cjs.map +1 -0
  182. package/dist/odspUrlHelper.d.ts +5 -0
  183. package/dist/odspUrlHelper.d.ts.map +1 -1
  184. package/dist/{odspUtils.js → odspUtils.cjs} +118 -30
  185. package/dist/odspUtils.cjs.map +1 -0
  186. package/dist/odspUtils.d.ts +35 -6
  187. package/dist/odspUtils.d.ts.map +1 -1
  188. package/dist/{opsCaching.js → opsCaching.cjs} +25 -9
  189. package/dist/opsCaching.cjs.map +1 -0
  190. package/dist/opsCaching.d.ts +3 -3
  191. package/dist/opsCaching.d.ts.map +1 -1
  192. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  193. package/dist/packageVersion.cjs.map +1 -0
  194. package/dist/packageVersion.d.ts +1 -1
  195. package/dist/packageVersion.d.ts.map +1 -1
  196. package/dist/prefetchLatestSnapshot.cjs +100 -0
  197. package/dist/prefetchLatestSnapshot.cjs.map +1 -0
  198. package/dist/prefetchLatestSnapshot.d.ts +12 -7
  199. package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
  200. package/dist/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.cjs} +13 -6
  201. package/dist/retryErrorsStorageAdapter.cjs.map +1 -0
  202. package/dist/retryErrorsStorageAdapter.d.ts +5 -4
  203. package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
  204. package/dist/{retryUtils.js → retryUtils.cjs} +30 -14
  205. package/dist/retryUtils.cjs.map +1 -0
  206. package/dist/retryUtils.d.ts +2 -2
  207. package/dist/retryUtils.d.ts.map +1 -1
  208. package/dist/socketModule.cjs +10 -0
  209. package/dist/socketModule.cjs.map +1 -0
  210. package/dist/socketModule.d.ts +7 -0
  211. package/dist/socketModule.d.ts.map +1 -0
  212. package/dist/tsdoc-metadata.json +11 -0
  213. package/dist/{vroom.js → vroom.cjs} +24 -9
  214. package/dist/vroom.cjs.map +1 -0
  215. package/dist/vroom.d.ts +4 -4
  216. package/dist/vroom.d.ts.map +1 -1
  217. package/dist/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.cjs} +227 -118
  218. package/dist/zipItDataRepresentationUtils.cjs.map +1 -0
  219. package/dist/zipItDataRepresentationUtils.d.ts +47 -20
  220. package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
  221. package/lib/{ReadBufferUtils.d.ts → ReadBufferUtils.d.mts} +1 -1
  222. package/lib/ReadBufferUtils.d.mts.map +1 -0
  223. package/lib/{ReadBufferUtils.js → ReadBufferUtils.mjs} +14 -7
  224. package/lib/ReadBufferUtils.mjs.map +1 -0
  225. package/lib/{WriteBufferUtils.d.ts → WriteBufferUtils.d.mts} +4 -6
  226. package/lib/WriteBufferUtils.d.mts.map +1 -0
  227. package/lib/{WriteBufferUtils.js → WriteBufferUtils.mjs} +68 -64
  228. package/lib/WriteBufferUtils.mjs.map +1 -0
  229. package/lib/{checkUrl.d.ts → checkUrl.d.mts} +2 -1
  230. package/lib/checkUrl.d.mts.map +1 -0
  231. package/lib/{checkUrl.js → checkUrl.mjs} +7 -6
  232. package/lib/checkUrl.mjs.map +1 -0
  233. package/lib/compactSnapshotParser.d.mts +24 -0
  234. package/lib/compactSnapshotParser.d.mts.map +1 -0
  235. package/lib/compactSnapshotParser.mjs +203 -0
  236. package/lib/compactSnapshotParser.mjs.map +1 -0
  237. package/lib/{compactSnapshotWriter.d.ts → compactSnapshotWriter.d.mts} +4 -5
  238. package/lib/compactSnapshotWriter.d.mts.map +1 -0
  239. package/lib/{compactSnapshotWriter.js → compactSnapshotWriter.mjs} +41 -31
  240. package/lib/compactSnapshotWriter.mjs.map +1 -0
  241. package/lib/{constants.d.ts → constants.d.mts} +7 -1
  242. package/lib/constants.d.mts.map +1 -0
  243. package/lib/{constants.js → constants.mjs} +7 -1
  244. package/lib/constants.mjs.map +1 -0
  245. package/lib/{contracts.d.ts → contracts.d.mts} +18 -55
  246. package/lib/contracts.d.mts.map +1 -0
  247. package/lib/{contracts.js → contracts.mjs} +1 -1
  248. package/lib/contracts.mjs.map +1 -0
  249. package/lib/{contractsPublic.d.ts → contractsPublic.d.mts} +16 -1
  250. package/lib/contractsPublic.d.mts.map +1 -0
  251. package/lib/{contractsPublic.js → contractsPublic.mjs} +7 -1
  252. package/lib/contractsPublic.mjs.map +1 -0
  253. package/lib/createFile.d.mts +18 -0
  254. package/lib/createFile.d.mts.map +1 -0
  255. package/lib/createFile.mjs +171 -0
  256. package/lib/createFile.mjs.map +1 -0
  257. package/lib/createNewContainerOnExistingFile.d.mts +22 -0
  258. package/lib/createNewContainerOnExistingFile.d.mts.map +1 -0
  259. package/lib/createNewContainerOnExistingFile.mjs +56 -0
  260. package/lib/createNewContainerOnExistingFile.mjs.map +1 -0
  261. package/lib/createNewModule.d.mts +7 -0
  262. package/lib/createNewModule.d.mts.map +1 -0
  263. package/lib/createNewModule.mjs +7 -0
  264. package/lib/createNewModule.mjs.map +1 -0
  265. package/lib/createNewUtils.d.mts +27 -0
  266. package/lib/createNewUtils.d.mts.map +1 -0
  267. package/lib/createNewUtils.mjs +197 -0
  268. package/lib/createNewUtils.mjs.map +1 -0
  269. package/lib/{createOdspCreateContainerRequest.d.ts → createOdspCreateContainerRequest.d.mts} +6 -8
  270. package/lib/createOdspCreateContainerRequest.d.mts.map +1 -0
  271. package/lib/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.mjs} +8 -4
  272. package/lib/createOdspCreateContainerRequest.mjs.map +1 -0
  273. package/lib/{createOdspUrl.d.ts → createOdspUrl.d.mts} +3 -2
  274. package/lib/createOdspUrl.d.mts.map +1 -0
  275. package/lib/{createOdspUrl.js → createOdspUrl.mjs} +2 -1
  276. package/lib/createOdspUrl.mjs.map +1 -0
  277. package/lib/{epochTracker.d.ts → epochTracker.d.mts} +35 -11
  278. package/lib/epochTracker.d.mts.map +1 -0
  279. package/lib/{epochTracker.js → epochTracker.mjs} +97 -43
  280. package/lib/epochTracker.mjs.map +1 -0
  281. package/lib/{fetch.d.ts → fetch.d.mts} +2 -2
  282. package/lib/fetch.d.mts.map +1 -0
  283. package/lib/{fetch.js → fetch.mjs} +1 -1
  284. package/lib/fetch.mjs.map +1 -0
  285. package/lib/{fetchSnapshot.d.ts → fetchSnapshot.d.mts} +15 -10
  286. package/lib/fetchSnapshot.d.mts.map +1 -0
  287. package/lib/{fetchSnapshot.js → fetchSnapshot.mjs} +185 -167
  288. package/lib/fetchSnapshot.mjs.map +1 -0
  289. package/lib/{getFileLink.d.ts → getFileLink.d.mts} +5 -8
  290. package/lib/getFileLink.d.mts.map +1 -0
  291. package/lib/{getFileLink.js → getFileLink.mjs} +49 -38
  292. package/lib/getFileLink.mjs.map +1 -0
  293. package/lib/{getQueryString.d.ts → getQueryString.d.mts} +1 -5
  294. package/lib/getQueryString.d.mts.map +1 -0
  295. package/lib/{getQueryString.js → getQueryString.mjs} +1 -1
  296. package/lib/getQueryString.mjs.map +1 -0
  297. package/lib/{getUrlAndHeadersWithAuth.d.ts → getUrlAndHeadersWithAuth.d.mts} +1 -1
  298. package/lib/getUrlAndHeadersWithAuth.d.mts.map +1 -0
  299. package/lib/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.mjs} +4 -2
  300. package/lib/getUrlAndHeadersWithAuth.mjs.map +1 -0
  301. package/lib/index.d.mts +24 -0
  302. package/lib/index.d.mts.map +1 -0
  303. package/lib/index.mjs +22 -0
  304. package/lib/index.mjs.map +1 -0
  305. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts +17 -0
  306. package/lib/localOdspDriver/localOdspDeltaStorageService.d.mts.map +1 -0
  307. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs +31 -0
  308. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +1 -0
  309. package/lib/localOdspDriver/{localOdspDocumentService.d.ts → localOdspDocumentService.d.mts} +4 -3
  310. package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -0
  311. package/lib/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.mjs} +8 -6
  312. package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -0
  313. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.d.ts → localOdspDocumentServiceFactory.d.mts} +5 -6
  314. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.mts.map +1 -0
  315. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.mjs} +9 -10
  316. package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +1 -0
  317. package/lib/localOdspDriver/{localOdspDocumentStorageManager.d.ts → localOdspDocumentStorageManager.d.mts} +4 -4
  318. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -0
  319. package/lib/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.mjs} +11 -9
  320. package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -0
  321. package/lib/odsp-driver-alpha.d.mts +496 -0
  322. package/lib/odsp-driver-beta.d.mts +160 -0
  323. package/lib/odsp-driver-public.d.mts +160 -0
  324. package/lib/odsp-driver-untrimmed.d.mts +565 -0
  325. package/lib/{odspCache.d.ts → odspCache.d.mts} +20 -9
  326. package/lib/odspCache.d.mts.map +1 -0
  327. package/lib/{odspCache.js → odspCache.mjs} +6 -11
  328. package/lib/odspCache.mjs.map +1 -0
  329. package/lib/odspDelayLoadedDeltaStream.d.mts +75 -0
  330. package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -0
  331. package/lib/odspDelayLoadedDeltaStream.mjs +287 -0
  332. package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -0
  333. package/lib/{odspDeltaStorageService.d.ts → odspDeltaStorageService.d.mts} +10 -8
  334. package/lib/odspDeltaStorageService.d.mts.map +1 -0
  335. package/lib/{odspDeltaStorageService.js → odspDeltaStorageService.mjs} +70 -68
  336. package/lib/odspDeltaStorageService.mjs.map +1 -0
  337. package/lib/{odspDocumentDeltaConnection.d.ts → odspDocumentDeltaConnection.d.mts} +34 -14
  338. package/lib/odspDocumentDeltaConnection.d.mts.map +1 -0
  339. package/lib/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.mjs} +214 -103
  340. package/lib/odspDocumentDeltaConnection.mjs.map +1 -0
  341. package/lib/{odspDocumentService.d.ts → odspDocumentService.d.mts} +15 -29
  342. package/lib/odspDocumentService.d.mts.map +1 -0
  343. package/lib/odspDocumentService.mjs +221 -0
  344. package/lib/odspDocumentService.mjs.map +1 -0
  345. package/lib/{odspDocumentServiceFactory.d.ts → odspDocumentServiceFactory.d.mts} +6 -2
  346. package/lib/odspDocumentServiceFactory.d.mts.map +1 -0
  347. package/lib/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.mjs} +8 -6
  348. package/lib/odspDocumentServiceFactory.mjs.map +1 -0
  349. package/lib/{odspDocumentServiceFactoryCore.d.ts → odspDocumentServiceFactoryCore.d.mts} +20 -13
  350. package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -0
  351. package/lib/odspDocumentServiceFactoryCore.mjs +192 -0
  352. package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -0
  353. package/lib/{odspDocumentServiceFactoryWithCodeSplit.d.ts → odspDocumentServiceFactoryWithCodeSplit.d.mts} +7 -2
  354. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.mts.map +1 -0
  355. package/lib/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.mjs} +8 -3
  356. package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +1 -0
  357. package/lib/{odspDocumentStorageManager.d.ts → odspDocumentStorageManager.d.mts} +18 -12
  358. package/lib/odspDocumentStorageManager.d.mts.map +1 -0
  359. package/lib/odspDocumentStorageManager.mjs +486 -0
  360. package/lib/odspDocumentStorageManager.mjs.map +1 -0
  361. package/lib/{odspDocumentStorageServiceBase.d.ts → odspDocumentStorageServiceBase.d.mts} +9 -11
  362. package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -0
  363. package/lib/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.mjs} +31 -33
  364. package/lib/odspDocumentStorageServiceBase.mjs.map +1 -0
  365. package/lib/{odspDriverUrlResolver.d.ts → odspDriverUrlResolver.d.mts} +13 -1
  366. package/lib/odspDriverUrlResolver.d.mts.map +1 -0
  367. package/lib/{odspDriverUrlResolver.js → odspDriverUrlResolver.mjs} +50 -40
  368. package/lib/odspDriverUrlResolver.mjs.map +1 -0
  369. package/lib/{odspDriverUrlResolverForShareLink.d.ts → odspDriverUrlResolverForShareLink.d.mts} +7 -5
  370. package/lib/odspDriverUrlResolverForShareLink.d.mts.map +1 -0
  371. package/lib/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.mjs} +36 -29
  372. package/lib/odspDriverUrlResolverForShareLink.mjs.map +1 -0
  373. package/lib/{odspError.d.ts → odspError.d.mts} +2 -2
  374. package/lib/odspError.d.mts.map +1 -0
  375. package/lib/{odspError.js → odspError.mjs} +7 -3
  376. package/lib/odspError.mjs.map +1 -0
  377. package/lib/{odspFluidFileLink.d.ts → odspFluidFileLink.d.mts} +12 -3
  378. package/lib/odspFluidFileLink.d.mts.map +1 -0
  379. package/lib/{odspFluidFileLink.js → odspFluidFileLink.mjs} +23 -16
  380. package/lib/odspFluidFileLink.mjs.map +1 -0
  381. package/lib/odspLocationRedirection.d.mts +14 -0
  382. package/lib/odspLocationRedirection.d.mts.map +1 -0
  383. package/lib/odspLocationRedirection.mjs +20 -0
  384. package/lib/odspLocationRedirection.mjs.map +1 -0
  385. package/lib/{odspPublicUtils.d.ts → odspPublicUtils.d.mts} +7 -1
  386. package/lib/odspPublicUtils.d.mts.map +1 -0
  387. package/lib/{odspPublicUtils.js → odspPublicUtils.mjs} +5 -2
  388. package/lib/odspPublicUtils.mjs.map +1 -0
  389. package/lib/{odspSnapshotParser.d.ts → odspSnapshotParser.d.mts} +3 -3
  390. package/lib/odspSnapshotParser.d.mts.map +1 -0
  391. package/lib/{odspSnapshotParser.js → odspSnapshotParser.mjs} +10 -11
  392. package/lib/odspSnapshotParser.mjs.map +1 -0
  393. package/lib/{odspSummaryUploadManager.d.ts → odspSummaryUploadManager.d.mts} +9 -6
  394. package/lib/odspSummaryUploadManager.d.mts.map +1 -0
  395. package/lib/{odspSummaryUploadManager.js → odspSummaryUploadManager.mjs} +41 -32
  396. package/lib/odspSummaryUploadManager.mjs.map +1 -0
  397. package/lib/{odspUrlHelper.d.ts → odspUrlHelper.d.mts} +6 -1
  398. package/lib/odspUrlHelper.d.mts.map +1 -0
  399. package/lib/{odspUrlHelper.js → odspUrlHelper.mjs} +9 -3
  400. package/lib/odspUrlHelper.mjs.map +1 -0
  401. package/lib/{odspUtils.d.ts → odspUtils.d.mts} +37 -8
  402. package/lib/odspUtils.d.mts.map +1 -0
  403. package/lib/{odspUtils.js → odspUtils.mjs} +109 -27
  404. package/lib/odspUtils.mjs.map +1 -0
  405. package/lib/{opsCaching.d.ts → opsCaching.d.mts} +4 -4
  406. package/lib/opsCaching.d.mts.map +1 -0
  407. package/lib/{opsCaching.js → opsCaching.mjs} +23 -7
  408. package/lib/opsCaching.mjs.map +1 -0
  409. package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
  410. package/lib/packageVersion.d.mts.map +1 -0
  411. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  412. package/lib/packageVersion.mjs.map +1 -0
  413. package/lib/{prefetchLatestSnapshot.d.ts → prefetchLatestSnapshot.d.mts} +14 -9
  414. package/lib/prefetchLatestSnapshot.d.mts.map +1 -0
  415. package/lib/prefetchLatestSnapshot.mjs +96 -0
  416. package/lib/prefetchLatestSnapshot.mjs.map +1 -0
  417. package/lib/{retryErrorsStorageAdapter.d.ts → retryErrorsStorageAdapter.d.mts} +6 -5
  418. package/lib/retryErrorsStorageAdapter.d.mts.map +1 -0
  419. package/lib/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.mjs} +13 -6
  420. package/lib/retryErrorsStorageAdapter.mjs.map +1 -0
  421. package/lib/{retryUtils.d.ts → retryUtils.d.mts} +3 -3
  422. package/lib/retryUtils.d.mts.map +1 -0
  423. package/lib/{retryUtils.js → retryUtils.mjs} +27 -11
  424. package/lib/retryUtils.mjs.map +1 -0
  425. package/lib/socketModule.d.mts +7 -0
  426. package/lib/socketModule.d.mts.map +1 -0
  427. package/lib/socketModule.mjs +7 -0
  428. package/lib/socketModule.mjs.map +1 -0
  429. package/lib/{vroom.d.ts → vroom.d.mts} +7 -7
  430. package/lib/vroom.d.mts.map +1 -0
  431. package/lib/{vroom.js → vroom.mjs} +24 -9
  432. package/lib/vroom.mjs.map +1 -0
  433. package/lib/{zipItDataRepresentationUtils.d.ts → zipItDataRepresentationUtils.d.mts} +49 -22
  434. package/lib/zipItDataRepresentationUtils.d.mts.map +1 -0
  435. package/lib/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.mjs} +213 -111
  436. package/lib/zipItDataRepresentationUtils.mjs.map +1 -0
  437. package/package.json +87 -69
  438. package/prettier.config.cjs +8 -0
  439. package/src/ReadBufferUtils.ts +51 -44
  440. package/src/WriteBufferUtils.ts +203 -181
  441. package/src/checkUrl.ts +16 -15
  442. package/src/compactSnapshotParser.ts +219 -103
  443. package/src/compactSnapshotWriter.ts +118 -97
  444. package/src/constants.ts +7 -0
  445. package/src/contracts.ts +96 -136
  446. package/src/contractsPublic.ts +31 -16
  447. package/src/createFile.ts +243 -305
  448. package/src/createNewContainerOnExistingFile.ts +93 -0
  449. package/src/createNewModule.ts +7 -0
  450. package/src/createNewUtils.ts +266 -56
  451. package/src/createOdspCreateContainerRequest.ts +22 -18
  452. package/src/createOdspUrl.ts +12 -13
  453. package/src/epochTracker.ts +596 -457
  454. package/src/fetch.ts +4 -4
  455. package/src/fetchSnapshot.ts +583 -508
  456. package/src/getFileLink.ts +194 -155
  457. package/src/getQueryString.ts +11 -9
  458. package/src/getUrlAndHeadersWithAuth.ts +34 -33
  459. package/src/index.ts +42 -18
  460. package/src/localOdspDriver/localOdspDeltaStorageService.ts +49 -0
  461. package/src/localOdspDriver/localOdspDocumentService.ts +40 -38
  462. package/src/localOdspDriver/localOdspDocumentServiceFactory.ts +46 -43
  463. package/src/localOdspDriver/localOdspDocumentStorageManager.ts +55 -50
  464. package/src/odspCache.ts +112 -90
  465. package/src/odspDelayLoadedDeltaStream.ts +459 -0
  466. package/src/odspDeltaStorageService.ts +232 -221
  467. package/src/odspDocumentDeltaConnection.ts +751 -563
  468. package/src/odspDocumentService.ts +324 -523
  469. package/src/odspDocumentServiceFactory.ts +20 -21
  470. package/src/odspDocumentServiceFactoryCore.ts +329 -200
  471. package/src/odspDocumentServiceFactoryWithCodeSplit.ts +20 -20
  472. package/src/odspDocumentStorageManager.ts +730 -534
  473. package/src/odspDocumentStorageServiceBase.ts +279 -254
  474. package/src/odspDriverUrlResolver.ts +230 -188
  475. package/src/odspDriverUrlResolverForShareLink.ts +223 -203
  476. package/src/odspError.ts +27 -19
  477. package/src/odspFluidFileLink.ts +106 -87
  478. package/src/odspLocationRedirection.ts +26 -0
  479. package/src/odspPublicUtils.ts +20 -14
  480. package/src/odspSnapshotParser.ts +53 -46
  481. package/src/odspSummaryUploadManager.ts +243 -218
  482. package/src/odspUrlHelper.ts +81 -71
  483. package/src/odspUtils.ts +401 -259
  484. package/src/opsCaching.ts +214 -193
  485. package/src/packageVersion.ts +1 -1
  486. package/src/prefetchLatestSnapshot.ts +142 -80
  487. package/src/retryErrorsStorageAdapter.ts +92 -77
  488. package/src/retryUtils.ts +80 -57
  489. package/src/socketModule.ts +8 -0
  490. package/src/vroom.ts +92 -83
  491. package/src/zipItDataRepresentationUtils.ts +534 -394
  492. package/tsc-multi.test.json +4 -0
  493. package/tsconfig.json +11 -13
  494. package/.editorconfig +0 -7
  495. package/dist/ReadBufferUtils.js.map +0 -1
  496. package/dist/WriteBufferUtils.js.map +0 -1
  497. package/dist/checkUrl.js.map +0 -1
  498. package/dist/compactSnapshotParser.js +0 -115
  499. package/dist/compactSnapshotParser.js.map +0 -1
  500. package/dist/compactSnapshotWriter.js.map +0 -1
  501. package/dist/constants.js.map +0 -1
  502. package/dist/contracts.js.map +0 -1
  503. package/dist/contractsPublic.js.map +0 -1
  504. package/dist/createFile.js +0 -242
  505. package/dist/createFile.js.map +0 -1
  506. package/dist/createNewUtils.js +0 -67
  507. package/dist/createNewUtils.js.map +0 -1
  508. package/dist/createOdspCreateContainerRequest.js.map +0 -1
  509. package/dist/createOdspUrl.js.map +0 -1
  510. package/dist/epochTracker.js.map +0 -1
  511. package/dist/fetch.js.map +0 -1
  512. package/dist/fetchSnapshot.js.map +0 -1
  513. package/dist/getFileLink.js.map +0 -1
  514. package/dist/getQueryString.js.map +0 -1
  515. package/dist/getSocketIo.d.ts +0 -11
  516. package/dist/getSocketIo.d.ts.map +0 -1
  517. package/dist/getSocketIo.js +0 -20
  518. package/dist/getSocketIo.js.map +0 -1
  519. package/dist/getUrlAndHeadersWithAuth.js.map +0 -1
  520. package/dist/index.js +0 -41
  521. package/dist/index.js.map +0 -1
  522. package/dist/localOdspDriver/localOdspDocumentService.js.map +0 -1
  523. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  524. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  525. package/dist/odspCache.js.map +0 -1
  526. package/dist/odspDeltaStorageService.js.map +0 -1
  527. package/dist/odspDocumentDeltaConnection.js.map +0 -1
  528. package/dist/odspDocumentService.js +0 -364
  529. package/dist/odspDocumentService.js.map +0 -1
  530. package/dist/odspDocumentServiceFactory.js.map +0 -1
  531. package/dist/odspDocumentServiceFactoryCore.js +0 -118
  532. package/dist/odspDocumentServiceFactoryCore.js.map +0 -1
  533. package/dist/odspDocumentServiceFactoryWithCodeSplit.js +0 -34
  534. package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  535. package/dist/odspDocumentStorageManager.js +0 -356
  536. package/dist/odspDocumentStorageManager.js.map +0 -1
  537. package/dist/odspDocumentStorageServiceBase.js.map +0 -1
  538. package/dist/odspDriverUrlResolver.js.map +0 -1
  539. package/dist/odspDriverUrlResolverForShareLink.js.map +0 -1
  540. package/dist/odspError.js.map +0 -1
  541. package/dist/odspFluidFileLink.js.map +0 -1
  542. package/dist/odspPublicUtils.js.map +0 -1
  543. package/dist/odspSnapshotParser.js.map +0 -1
  544. package/dist/odspSummaryUploadManager.js.map +0 -1
  545. package/dist/odspUrlHelper.js.map +0 -1
  546. package/dist/odspUtils.js.map +0 -1
  547. package/dist/opsCaching.js.map +0 -1
  548. package/dist/packageVersion.js.map +0 -1
  549. package/dist/prefetchLatestSnapshot.js +0 -57
  550. package/dist/prefetchLatestSnapshot.js.map +0 -1
  551. package/dist/retryErrorsStorageAdapter.js.map +0 -1
  552. package/dist/retryUtils.js.map +0 -1
  553. package/dist/vroom.js.map +0 -1
  554. package/dist/zipItDataRepresentationUtils.js.map +0 -1
  555. package/lib/ReadBufferUtils.d.ts.map +0 -1
  556. package/lib/ReadBufferUtils.js.map +0 -1
  557. package/lib/WriteBufferUtils.d.ts.map +0 -1
  558. package/lib/WriteBufferUtils.js.map +0 -1
  559. package/lib/checkUrl.d.ts.map +0 -1
  560. package/lib/checkUrl.js.map +0 -1
  561. package/lib/compactSnapshotParser.d.ts +0 -15
  562. package/lib/compactSnapshotParser.d.ts.map +0 -1
  563. package/lib/compactSnapshotParser.js +0 -111
  564. package/lib/compactSnapshotParser.js.map +0 -1
  565. package/lib/compactSnapshotWriter.d.ts.map +0 -1
  566. package/lib/compactSnapshotWriter.js.map +0 -1
  567. package/lib/constants.d.ts.map +0 -1
  568. package/lib/constants.js.map +0 -1
  569. package/lib/contracts.d.ts.map +0 -1
  570. package/lib/contracts.js.map +0 -1
  571. package/lib/contractsPublic.d.ts.map +0 -1
  572. package/lib/contractsPublic.js.map +0 -1
  573. package/lib/createFile.d.ts +0 -22
  574. package/lib/createFile.d.ts.map +0 -1
  575. package/lib/createFile.js +0 -235
  576. package/lib/createFile.js.map +0 -1
  577. package/lib/createNewUtils.d.ts +0 -11
  578. package/lib/createNewUtils.d.ts.map +0 -1
  579. package/lib/createNewUtils.js +0 -63
  580. package/lib/createNewUtils.js.map +0 -1
  581. package/lib/createOdspCreateContainerRequest.d.ts.map +0 -1
  582. package/lib/createOdspCreateContainerRequest.js.map +0 -1
  583. package/lib/createOdspUrl.d.ts.map +0 -1
  584. package/lib/createOdspUrl.js.map +0 -1
  585. package/lib/epochTracker.d.ts.map +0 -1
  586. package/lib/epochTracker.js.map +0 -1
  587. package/lib/fetch.d.ts.map +0 -1
  588. package/lib/fetch.js.map +0 -1
  589. package/lib/fetchSnapshot.d.ts.map +0 -1
  590. package/lib/fetchSnapshot.js.map +0 -1
  591. package/lib/getFileLink.d.ts.map +0 -1
  592. package/lib/getFileLink.js.map +0 -1
  593. package/lib/getQueryString.d.ts.map +0 -1
  594. package/lib/getQueryString.js.map +0 -1
  595. package/lib/getSocketIo.d.ts +0 -11
  596. package/lib/getSocketIo.d.ts.map +0 -1
  597. package/lib/getSocketIo.js +0 -13
  598. package/lib/getSocketIo.js.map +0 -1
  599. package/lib/getUrlAndHeadersWithAuth.d.ts.map +0 -1
  600. package/lib/getUrlAndHeadersWithAuth.js.map +0 -1
  601. package/lib/index.d.ts +0 -21
  602. package/lib/index.d.ts.map +0 -1
  603. package/lib/index.js +0 -29
  604. package/lib/index.js.map +0 -1
  605. package/lib/localOdspDriver/localOdspDocumentService.d.ts.map +0 -1
  606. package/lib/localOdspDriver/localOdspDocumentService.js.map +0 -1
  607. package/lib/localOdspDriver/localOdspDocumentServiceFactory.d.ts.map +0 -1
  608. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  609. package/lib/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +0 -1
  610. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  611. package/lib/odspCache.d.ts.map +0 -1
  612. package/lib/odspCache.js.map +0 -1
  613. package/lib/odspDeltaStorageService.d.ts.map +0 -1
  614. package/lib/odspDeltaStorageService.js.map +0 -1
  615. package/lib/odspDocumentDeltaConnection.d.ts.map +0 -1
  616. package/lib/odspDocumentDeltaConnection.js.map +0 -1
  617. package/lib/odspDocumentService.d.ts.map +0 -1
  618. package/lib/odspDocumentService.js +0 -360
  619. package/lib/odspDocumentService.js.map +0 -1
  620. package/lib/odspDocumentServiceFactory.d.ts.map +0 -1
  621. package/lib/odspDocumentServiceFactory.js.map +0 -1
  622. package/lib/odspDocumentServiceFactoryCore.d.ts.map +0 -1
  623. package/lib/odspDocumentServiceFactoryCore.js +0 -114
  624. package/lib/odspDocumentServiceFactoryCore.js.map +0 -1
  625. package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +0 -1
  626. package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  627. package/lib/odspDocumentStorageManager.d.ts.map +0 -1
  628. package/lib/odspDocumentStorageManager.js +0 -352
  629. package/lib/odspDocumentStorageManager.js.map +0 -1
  630. package/lib/odspDocumentStorageServiceBase.d.ts.map +0 -1
  631. package/lib/odspDocumentStorageServiceBase.js.map +0 -1
  632. package/lib/odspDriverUrlResolver.d.ts.map +0 -1
  633. package/lib/odspDriverUrlResolver.js.map +0 -1
  634. package/lib/odspDriverUrlResolverForShareLink.d.ts.map +0 -1
  635. package/lib/odspDriverUrlResolverForShareLink.js.map +0 -1
  636. package/lib/odspError.d.ts.map +0 -1
  637. package/lib/odspError.js.map +0 -1
  638. package/lib/odspFluidFileLink.d.ts.map +0 -1
  639. package/lib/odspFluidFileLink.js.map +0 -1
  640. package/lib/odspPublicUtils.d.ts.map +0 -1
  641. package/lib/odspPublicUtils.js.map +0 -1
  642. package/lib/odspSnapshotParser.d.ts.map +0 -1
  643. package/lib/odspSnapshotParser.js.map +0 -1
  644. package/lib/odspSummaryUploadManager.d.ts.map +0 -1
  645. package/lib/odspSummaryUploadManager.js.map +0 -1
  646. package/lib/odspUrlHelper.d.ts.map +0 -1
  647. package/lib/odspUrlHelper.js.map +0 -1
  648. package/lib/odspUtils.d.ts.map +0 -1
  649. package/lib/odspUtils.js.map +0 -1
  650. package/lib/opsCaching.d.ts.map +0 -1
  651. package/lib/opsCaching.js.map +0 -1
  652. package/lib/packageVersion.d.ts.map +0 -1
  653. package/lib/packageVersion.js.map +0 -1
  654. package/lib/prefetchLatestSnapshot.d.ts.map +0 -1
  655. package/lib/prefetchLatestSnapshot.js +0 -53
  656. package/lib/prefetchLatestSnapshot.js.map +0 -1
  657. package/lib/retryErrorsStorageAdapter.d.ts.map +0 -1
  658. package/lib/retryErrorsStorageAdapter.js.map +0 -1
  659. package/lib/retryUtils.d.ts.map +0 -1
  660. package/lib/retryUtils.js.map +0 -1
  661. package/lib/vroom.d.ts.map +0 -1
  662. package/lib/vroom.js.map +0 -1
  663. package/lib/zipItDataRepresentationUtils.d.ts.map +0 -1
  664. package/lib/zipItDataRepresentationUtils.js.map +0 -1
  665. package/src/getSocketIo.ts +0 -14
  666. package/tsconfig.esnext.json +0 -7
@@ -5,9 +5,9 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.TreeBuilderSerializer = exports.calcLength = exports.WriteBuffer = void 0;
8
- const common_utils_1 = require("@fluidframework/common-utils");
9
- const ReadBufferUtils_1 = require("./ReadBufferUtils");
10
- const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils");
8
+ const client_utils_1 = require("@fluid-internal/client-utils");
9
+ const core_utils_1 = require("@fluidframework/core-utils");
10
+ const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils.cjs");
11
11
  /**
12
12
  * Buffer class, used to sequentially writ data.
13
13
  * Used by tree code to serialize tree into binary representation.
@@ -18,7 +18,7 @@ class WriteBuffer {
18
18
  this.index = 0;
19
19
  }
20
20
  push(code) {
21
- (0, common_utils_1.assert)(this.data !== undefined, 0x225 /* "Data should be there" */);
21
+ (0, core_utils_1.assert)(this.data !== undefined, 0x225 /* "Data should be there" */);
22
22
  const length = this.data.length;
23
23
  if (this.index === length) {
24
24
  const newData = new Uint8Array(length * 1.2 + 4096);
@@ -41,13 +41,13 @@ class WriteBuffer {
41
41
  code = Math.floor(code / 256);
42
42
  length--;
43
43
  }
44
- (0, common_utils_1.assert)(code === 0, 0x226 /* Should write complete data */);
44
+ (0, core_utils_1.assert)(code === 0, 0x226 /* Should write complete data */);
45
45
  }
46
46
  done() {
47
- (0, common_utils_1.assert)(this.data !== undefined, 0x227 /* "Data should be there" */);
47
+ (0, core_utils_1.assert)(this.data !== undefined, 0x227 /* "Data should be there" */);
48
48
  // We can slice it to have smaller memory representation.
49
49
  // But it will be way more expensive in terms of CPU cycles!
50
- const buffer = new ReadBufferUtils_1.ReadBuffer(this.data.subarray(0, this.index));
50
+ const buffer = this.data.subarray(0, this.index);
51
51
  this.data = undefined;
52
52
  return buffer;
53
53
  }
@@ -55,11 +55,10 @@ class WriteBuffer {
55
55
  exports.WriteBuffer = WriteBuffer;
56
56
  // This list of maps below is reverse mapping of Marker Codes specified in zipItDataRepresentationUtils.ts file.
57
57
  // We can also found them on server filestore code.
58
- // eslint-disable-next-line max-len
59
58
  // https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=/cobalt/Base/Property/BinaryEncodedPropertyReader.cs&version=GBmaster&_a=contents
60
59
  /**
61
60
  * This contains mapping of number of bytes representing the corresponding string length to Marker Codes.
62
- */
61
+ */
63
62
  const utf8StringBytesToCodeMap = {
64
63
  0: 13,
65
64
  1: 14,
@@ -69,7 +68,7 @@ const utf8StringBytesToCodeMap = {
69
68
  /**
70
69
  * This contains mapping of number of bytes representing the corresponding length in which actual data(base64 string)
71
70
  * will be stored to Marker Codes.
72
- */
71
+ */
73
72
  const binaryBytesToCodeMap = {
74
73
  0: 32,
75
74
  1: 33,
@@ -79,7 +78,7 @@ const binaryBytesToCodeMap = {
79
78
  };
80
79
  /**
81
80
  * This contains mapping of number of bytes representing the corresponding const string id to Marker Codes.
82
- */
81
+ */
83
82
  const constStringBytesToCodeMap = {
84
83
  1: 17,
85
84
  2: 18,
@@ -87,7 +86,7 @@ const constStringBytesToCodeMap = {
87
86
  };
88
87
  /**
89
88
  * This contains mapping of number of bytes to Marker Codes representing the corresponding Integer.
90
- */
89
+ */
91
90
  const integerBytesToCodeMap = {
92
91
  0: 1,
93
92
  1: 3,
@@ -97,7 +96,7 @@ const integerBytesToCodeMap = {
97
96
  };
98
97
  /**
99
98
  * This contains mapping of boolean to Marker Codes representing the corresponding bool value.
100
- */
99
+ */
101
100
  const boolToCodeMap = [
102
101
  12,
103
102
  11, // true
@@ -128,59 +127,61 @@ exports.calcLength = calcLength;
128
127
  /**
129
128
  * Implementation of serialization of blobs in buffer with Marker Codes etc.
130
129
  * @param buffer - Buffer to serialize to.
131
- * @param blob - blob to be serialized.
130
+ * @param content - string to be serialized.
132
131
  * @param dictionary - Const strings dictionary to be used while serializing.
133
132
  */
134
- function serializeBlob(buffer, blob, dictionary) {
135
- const data = blob.buffer;
136
- const lengthOfDataLen = calcLength(data.length);
137
- if (blob.constString) {
138
- const content = blob.toString();
139
- let id = dictionary.get(content);
140
- let idLength;
141
- if (id === undefined) {
142
- id = dictionary.size + 1;
143
- idLength = calcLength(id);
144
- dictionary.set(content, id);
145
- let code;
146
- if (lengthOfDataLen > 1 || idLength > 1) {
147
- code = zipItDataRepresentationUtils_1.MarkerCodes.ConstStringDeclareBig;
148
- }
149
- else {
150
- code = zipItDataRepresentationUtils_1.MarkerCodes.ConstStringDeclare;
151
- }
152
- // Write marker code for const string.
153
- buffer.write(code);
154
- const bytes = (0, zipItDataRepresentationUtils_1.getValueSafely)(zipItDataRepresentationUtils_1.codeToBytesMap, code);
155
- (0, common_utils_1.assert)(bytes >= lengthOfDataLen, 0x283 /* "Length of data len should fit in the bytes from the map" */);
156
- (0, common_utils_1.assert)(bytes >= idLength, 0x284 /* "Length of id should fit in the bytes from the map" */);
157
- // Assign and write id for const string.
158
- buffer.write(id, bytes);
159
- // Write length of const string.
160
- buffer.write(data.length, bytes);
161
- // Write const string data.
162
- for (const element of data) {
163
- buffer.write(element);
164
- }
133
+ function serializeDictionaryString(buffer, content, dictionary) {
134
+ let id = dictionary.get(content);
135
+ let idLength;
136
+ if (id === undefined) {
137
+ const data = client_utils_1.IsoBuffer.from(content, "utf8");
138
+ const lengthOfDataLen = calcLength(data.length);
139
+ id = dictionary.size + 1;
140
+ idLength = calcLength(id);
141
+ dictionary.set(content, id);
142
+ const code = lengthOfDataLen > 1 || idLength > 1
143
+ ? zipItDataRepresentationUtils_1.MarkerCodes.ConstStringDeclareBig
144
+ : zipItDataRepresentationUtils_1.MarkerCodes.ConstStringDeclare;
145
+ // Write marker code for const string.
146
+ buffer.write(code);
147
+ const bytes = (0, zipItDataRepresentationUtils_1.getValueSafely)(zipItDataRepresentationUtils_1.codeToBytesMap, code);
148
+ (0, core_utils_1.assert)(bytes >= lengthOfDataLen, 0x283 /* "Length of data len should fit in the bytes from the map" */);
149
+ (0, core_utils_1.assert)(bytes >= idLength, 0x284 /* "Length of id should fit in the bytes from the map" */);
150
+ // Assign and write id for const string.
151
+ buffer.write(id, bytes);
152
+ // Write length of const string.
153
+ buffer.write(data.length, bytes);
154
+ // Write const string data.
155
+ for (const element of data) {
156
+ buffer.write(element);
165
157
  }
166
- else {
167
- idLength = calcLength(id);
168
- }
169
- // Write Marker Code
170
- buffer.write((0, zipItDataRepresentationUtils_1.getValueSafely)(constStringBytesToCodeMap, idLength));
171
- // Write id of const string
172
- buffer.write(id, idLength);
173
158
  }
174
159
  else {
175
- // Write Marker code.
176
- buffer.write(blob.useUtf8Code ? (0, zipItDataRepresentationUtils_1.getValueSafely)(utf8StringBytesToCodeMap, lengthOfDataLen)
177
- : (0, zipItDataRepresentationUtils_1.getValueSafely)(binaryBytesToCodeMap, lengthOfDataLen));
178
- // Write actual data if length greater than 0, otherwise Marker Code is enough.
179
- if (lengthOfDataLen > 0) {
180
- buffer.write(data.length, lengthOfDataLen);
181
- for (const element of data) {
182
- buffer.write(element);
183
- }
160
+ idLength = calcLength(id);
161
+ }
162
+ // Write Marker Code
163
+ buffer.write((0, zipItDataRepresentationUtils_1.getValueSafely)(constStringBytesToCodeMap, idLength));
164
+ // Write id of const string
165
+ buffer.write(id, idLength);
166
+ }
167
+ function serializeString(buffer, content, codeMap = binaryBytesToCodeMap) {
168
+ serializeBlob(buffer, client_utils_1.IsoBuffer.from(content, "utf8"), utf8StringBytesToCodeMap);
169
+ }
170
+ /**
171
+ * Implementation of serialization of blobs in buffer with Marker Codes etc.
172
+ * @param buffer - Buffer to serialize to.
173
+ * @param blob - blob to be serialized.
174
+ * @param dictionary - Const strings dictionary to be used while serializing.
175
+ */
176
+ function serializeBlob(buffer, data, codeMap = binaryBytesToCodeMap) {
177
+ const lengthOfDataLen = calcLength(data.length);
178
+ // Write Marker code.
179
+ buffer.write((0, zipItDataRepresentationUtils_1.getValueSafely)(codeMap, lengthOfDataLen));
180
+ // Write actual data if length greater than 0, otherwise Marker Code is enough.
181
+ if (lengthOfDataLen > 0) {
182
+ buffer.write(data.length, lengthOfDataLen);
183
+ for (const element of data) {
184
+ buffer.write(element);
184
185
  }
185
186
  }
186
187
  }
@@ -196,14 +197,14 @@ function serializeNodeCore(buffer, nodeCore, dictionary) {
196
197
  // For a tree node start and end with set/list start and end marker codes.
197
198
  const startCode = zipItDataRepresentationUtils_1.MarkerCodesStart[child.type];
198
199
  const endCode = zipItDataRepresentationUtils_1.MarkerCodesEnd[child.type];
199
- (0, common_utils_1.assert)(startCode !== undefined, 0x285 /* "Start code should not undefined" */);
200
- (0, common_utils_1.assert)(endCode !== undefined, 0x286 /* "End code should not undefined" */);
200
+ (0, core_utils_1.assert)(startCode !== undefined, 0x285 /* "Start code should not undefined" */);
201
+ (0, core_utils_1.assert)(endCode !== undefined, 0x286 /* "End code should not undefined" */);
201
202
  buffer.write(startCode);
202
203
  serializeNodeCore(buffer, child, dictionary);
203
204
  buffer.write(endCode);
204
205
  }
205
206
  else if (child instanceof zipItDataRepresentationUtils_1.BlobCore) {
206
- serializeBlob(buffer, child, dictionary);
207
+ serializeBlob(buffer, child.buffer);
207
208
  }
208
209
  else if (typeof child === "number") {
209
210
  // Calculate length in which integer will be stored
@@ -219,7 +220,13 @@ function serializeNodeCore(buffer, nodeCore, dictionary) {
219
220
  buffer.write(boolToCodeMap[child ? 1 : 0]);
220
221
  }
221
222
  else {
222
- (0, common_utils_1.unreachableCase)(child, "Unsupported node type");
223
+ (0, core_utils_1.assert)(child._stringElement, 0x3dd /* Unsupported node type */);
224
+ if (child.dictionary) {
225
+ serializeDictionaryString(buffer, child.content, dictionary);
226
+ }
227
+ else {
228
+ serializeString(buffer, child.content);
229
+ }
223
230
  }
224
231
  }
225
232
  }
@@ -235,9 +242,6 @@ class TreeBuilderSerializer extends NodeCoreSerializer {
235
242
  constructor() {
236
243
  super();
237
244
  }
238
- static load(buffer) {
239
- return zipItDataRepresentationUtils_1.TreeBuilder.load(buffer);
240
- }
241
245
  serialize() {
242
246
  const buffer = new WriteBuffer();
243
247
  super.serialize(buffer);
@@ -245,4 +249,4 @@ class TreeBuilderSerializer extends NodeCoreSerializer {
245
249
  }
246
250
  }
247
251
  exports.TreeBuilderSerializer = TreeBuilderSerializer;
248
- //# sourceMappingURL=WriteBufferUtils.js.map
252
+ //# sourceMappingURL=WriteBufferUtils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WriteBufferUtils.cjs","sourceRoot":"","sources":["../src/WriteBufferUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyD;AACzD,2DAAoD;AACpD,qFAQwC;AAExC;;;GAGG;AACH,MAAa,WAAW;IAAxB;QACW,SAAI,GAAgB,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,UAAK,GAAG,CAAC,CAAC;IAsCrB,CAAC;IApCU,IAAI,CAAC,IAAY;QAC1B,IAAA,mBAAM,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;YAC1B,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;gBACtB,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;gBAChC,KAAK,EAAE,CAAC;aACR;YACD,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;SACpB;QACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,GAAG,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE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esContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tBlobCore,\n\tcodeToBytesMap,\n\tgetValueSafely,\n\tMarkerCodes,\n\tMarkerCodesEnd,\n\tMarkerCodesStart,\n\tNodeCore,\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\tprotected data?: Uint8Array = new Uint8Array(4096);\n\tprotected index = 0;\n\n\tprotected push(code: number) {\n\t\tassert(this.data !== undefined, 0x225 /* \"Data should be there\" */);\n\t\tconst length = this.data.length;\n\t\tif (this.index === length) {\n\t\t\tconst newData = new Uint8Array(length * 1.2 + 4096);\n\t\t\tlet index = 0;\n\t\t\tconst oldData = this.data;\n\t\t\twhile (index < length) {\n\t\t\t\tnewData[index] = oldData[index];\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\tthis.data = newData;\n\t\t}\n\t\tthis.data[this.index] = code % 256;\n\t\tthis.index++;\n\t}\n\n\tpublic write(codeArg: number, lengthArg = 1) {\n\t\tlet code = codeArg;\n\t\tlet length = lengthArg;\n\t\twhile (length > 0) {\n\t\t\tthis.push(code % 256);\n\t\t\tcode = Math.floor(code / 256);\n\t\t\tlength--;\n\t\t}\n\t\tassert(code === 0, 0x226 /* Should write complete data */);\n\t}\n\n\tpublic done(): Uint8Array {\n\t\tassert(this.data !== undefined, 0x227 /* \"Data should be there\" */);\n\t\t// We can slice it to have smaller memory representation.\n\t\t// But it will be way more expensive in terms of CPU cycles!\n\t\tconst buffer = this.data.subarray(0, this.index);\n\t\tthis.data = undefined;\n\t\treturn buffer;\n\t}\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// 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\t0: 13,\n\t1: 14,\n\t2: 15,\n\t4: 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\t0: 32,\n\t1: 33,\n\t2: 34,\n\t4: 35,\n\t8: 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\t1: 17,\n\t2: 18,\n\t4: 19,\n};\n\n/**\n * This contains mapping of number of bytes to Marker Codes representing the corresponding Integer.\n */\nconst integerBytesToCodeMap = {\n\t0: 1,\n\t1: 3,\n\t2: 5,\n\t4: 7,\n\t8: 9,\n};\n\n/**\n * This contains mapping of boolean to Marker Codes representing the corresponding bool value.\n */\nconst boolToCodeMap = [\n\t12, // false\n\t11, // 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 */\nexport function calcLength(numArg: number) {\n\tif (numArg === 0) {\n\t\treturn 0;\n\t}\n\tlet num = numArg;\n\tlet lengthLen = 0;\n\twhile (num > 0) {\n\t\tnum = Math.floor(num / 256);\n\t\tlengthLen++;\n\t}\n\tlet res = 1;\n\twhile (res < lengthLen) {\n\t\tres *= 2;\n\t}\n\treturn 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 content - string to be serialized.\n * @param dictionary - Const strings dictionary to be used while serializing.\n */\nfunction serializeDictionaryString(\n\tbuffer: WriteBuffer,\n\tcontent: string,\n\tdictionary: Map<string, number>,\n) {\n\tlet id = dictionary.get(content);\n\tlet idLength: number;\n\tif (id === undefined) {\n\t\tconst data = IsoBuffer.from(content, \"utf8\");\n\t\tconst lengthOfDataLen = calcLength(data.length);\n\n\t\tid = dictionary.size + 1;\n\t\tidLength = calcLength(id);\n\t\tdictionary.set(content, id);\n\t\tconst code =\n\t\t\tlengthOfDataLen > 1 || idLength > 1\n\t\t\t\t? MarkerCodes.ConstStringDeclareBig\n\t\t\t\t: MarkerCodes.ConstStringDeclare;\n\t\t// Write marker code for const string.\n\t\tbuffer.write(code);\n\t\tconst bytes = getValueSafely(codeToBytesMap, code);\n\t\tassert(\n\t\t\tbytes >= lengthOfDataLen,\n\t\t\t0x283 /* \"Length of data len should fit in the bytes from the map\" */,\n\t\t);\n\t\tassert(bytes >= idLength, 0x284 /* \"Length of id should fit in the bytes from the map\" */);\n\t\t// Assign and write id for const string.\n\t\tbuffer.write(id, bytes);\n\t\t// Write length of const string.\n\t\tbuffer.write(data.length, bytes);\n\t\t// Write const string data.\n\t\tfor (const element of data) {\n\t\t\tbuffer.write(element);\n\t\t}\n\t} else {\n\t\tidLength = calcLength(id);\n\t}\n\t// Write Marker Code\n\tbuffer.write(getValueSafely(constStringBytesToCodeMap, idLength));\n\t// Write id of const string\n\tbuffer.write(id, idLength);\n}\n\nfunction serializeString(buffer: WriteBuffer, content: string, codeMap = binaryBytesToCodeMap) {\n\tserializeBlob(buffer, IsoBuffer.from(content, \"utf8\"), utf8StringBytesToCodeMap);\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(\n\tbuffer: WriteBuffer,\n\tdata: Uint8Array,\n\tcodeMap: Record<number, number> = binaryBytesToCodeMap,\n) {\n\tconst lengthOfDataLen = calcLength(data.length);\n\t// Write Marker code.\n\tbuffer.write(getValueSafely(codeMap, lengthOfDataLen));\n\t// Write actual data if length greater than 0, otherwise Marker Code is enough.\n\tif (lengthOfDataLen > 0) {\n\t\tbuffer.write(data.length, lengthOfDataLen);\n\t\tfor (const element of data) {\n\t\t\tbuffer.write(element);\n\t\t}\n\t}\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(\n\tbuffer: WriteBuffer,\n\tnodeCore: NodeCore,\n\tdictionary: Map<string, number>,\n) {\n\tfor (const child of nodeCore.nodes) {\n\t\tif (child instanceof NodeCore) {\n\t\t\t// For a tree node start and end with set/list start and end marker codes.\n\t\t\tconst startCode = MarkerCodesStart[child.type];\n\t\t\tconst endCode = MarkerCodesEnd[child.type];\n\t\t\tassert(startCode !== undefined, 0x285 /* \"Start code should not undefined\" */);\n\t\t\tassert(endCode !== undefined, 0x286 /* \"End code should not undefined\" */);\n\t\t\tbuffer.write(startCode);\n\t\t\tserializeNodeCore(buffer, child, dictionary);\n\t\t\tbuffer.write(endCode);\n\t\t} else if (child instanceof BlobCore) {\n\t\t\tserializeBlob(buffer, child.buffer);\n\t\t} else if (typeof child === \"number\") {\n\t\t\t// Calculate length in which integer will be stored\n\t\t\tconst len = calcLength(child);\n\t\t\t// Write corresponding Marker code for length of integer.\n\t\t\tbuffer.write(getValueSafely(integerBytesToCodeMap, len));\n\t\t\t// Write actual number if greater than 0, otherwise Marker Code is enough.\n\t\t\tif (len > 0) {\n\t\t\t\tbuffer.write(child, len);\n\t\t\t}\n\t\t} else if (typeof child === \"boolean\") {\n\t\t\tbuffer.write(boolToCodeMap[child ? 1 : 0]);\n\t\t} else {\n\t\t\tassert(child._stringElement, 0x3dd /* Unsupported node type */);\n\t\t\tif (child.dictionary) {\n\t\t\t\tserializeDictionaryString(buffer, child.content, dictionary);\n\t\t\t} else {\n\t\t\t\tserializeString(buffer, child.content);\n\t\t\t}\n\t\t}\n\t}\n}\n\nclass NodeCoreSerializer extends NodeCore {\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tpublic serialize(buffer: WriteBuffer) {\n\t\tserializeNodeCore(buffer, this, new Map<string, number>());\n\t}\n}\n\nexport class TreeBuilderSerializer extends NodeCoreSerializer {\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tpublic serialize(): Uint8Array {\n\t\tconst buffer = new WriteBuffer();\n\t\tsuper.serialize(buffer);\n\t\treturn buffer.done();\n\t}\n}\n"]}
@@ -2,8 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ReadBuffer } from "./ReadBufferUtils";
6
- import { NodeCore, TreeBuilder } from "./zipItDataRepresentationUtils";
5
+ import { NodeCore } from "./zipItDataRepresentationUtils";
7
6
  /**
8
7
  * Buffer class, used to sequentially writ data.
9
8
  * Used by tree code to serialize tree into binary representation.
@@ -13,7 +12,7 @@ export declare class WriteBuffer {
13
12
  protected index: number;
14
13
  protected push(code: number): void;
15
14
  write(codeArg: number, lengthArg?: number): void;
16
- done(): ReadBuffer;
15
+ done(): Uint8Array;
17
16
  }
18
17
  /**
19
18
  * Calculate how many bytes are required to encode an integer. This is always power of 2.
@@ -28,8 +27,7 @@ declare class NodeCoreSerializer extends NodeCore {
28
27
  }
29
28
  export declare class TreeBuilderSerializer extends NodeCoreSerializer {
30
29
  constructor();
31
- static load(buffer: ReadBuffer): TreeBuilder;
32
- serialize(): ReadBuffer;
30
+ serialize(): Uint8Array;
33
31
  }
34
32
  export {};
35
33
  //# sourceMappingURL=WriteBufferUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WriteBufferUtils.d.ts","sourceRoot":"","sources":["../src/WriteBufferUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAOH,QAAQ,EACR,WAAW,EACd,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,qBAAa,WAAW;IACpB,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,CAAwB;IACnD,SAAS,CAAC,KAAK,SAAK;IAEpB,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM;IAiBpB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,SAAI;IAWpC,IAAI,IAAI,UAAU;CAQ5B;AAyDD;;;;;GAKG;AACF,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,UAezC;AA+FD,cAAM,kBAAmB,SAAQ,QAAQ;;IAK9B,SAAS,CAAC,MAAM,EAAE,WAAW;CAGvC;AAED,qBAAa,qBAAsB,SAAQ,kBAAkB;;IAKzD,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW;IAIrC,SAAS,IAAI,UAAU;CAKjC"}
1
+ {"version":3,"file":"WriteBufferUtils.d.ts","sourceRoot":"","sources":["../src/WriteBufferUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAON,QAAQ,EACR,MAAM,gCAAgC,CAAC;AAExC;;;GAGG;AACH,qBAAa,WAAW;IACvB,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,CAAwB;IACnD,SAAS,CAAC,KAAK,SAAK;IAEpB,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM;IAiBpB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,SAAI;IAWpC,IAAI,IAAI,UAAU;CAQzB;AAwDD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,UAexC;AA2HD,cAAM,kBAAmB,SAAQ,QAAQ;;IAKjC,SAAS,CAAC,MAAM,EAAE,WAAW;CAGpC;AAED,qBAAa,qBAAsB,SAAQ,kBAAkB;;IAKrD,SAAS,IAAI,UAAU;CAK9B"}
@@ -5,12 +5,13 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.checkUrl = void 0;
8
- const odspFluidFileLink_1 = require("./odspFluidFileLink");
8
+ const odspFluidFileLink_1 = require("./odspFluidFileLink.cjs");
9
9
  /**
10
10
  * A check that returns DriverPreCheckInfo if the URL format is likely supported by this driver.
11
11
  * Note that returning information here is NOT a full guarantee that resolve will ultimately be successful.
12
12
  * Instead, this should be used as a lightweight check that can filter out easily detectable unsupported URLs
13
13
  * before the entire Fluid loading process needs to be kicked off.
14
+ * @alpha
14
15
  */
15
16
  function checkUrl(documentUrl) {
16
17
  const locator = (0, odspFluidFileLink_1.getLocatorFromOdspUrl)(documentUrl);
@@ -19,16 +20,16 @@ function checkUrl(documentUrl) {
19
20
  }
20
21
  let siteOrigin;
21
22
  try {
22
- if (locator === null || locator === void 0 ? void 0 : locator.siteUrl) {
23
- siteOrigin = new URL(locator === null || locator === void 0 ? void 0 : locator.siteUrl).origin;
23
+ if (locator?.siteUrl) {
24
+ siteOrigin = new URL(locator?.siteUrl).origin;
24
25
  }
25
26
  }
26
- catch (_a) { }
27
+ catch { }
27
28
  return {
28
- codeDetailsHint: locator === null || locator === void 0 ? void 0 : locator.containerPackageName,
29
+ codeDetailsHint: locator?.containerPackageName,
29
30
  // Add the snapshot endpoint, which has the same domain as the site URL
30
31
  criticalBootDomains: siteOrigin ? [siteOrigin] : undefined,
31
32
  };
32
33
  }
33
34
  exports.checkUrl = checkUrl;
34
- //# sourceMappingURL=checkUrl.js.map
35
+ //# sourceMappingURL=checkUrl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkUrl.cjs","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA4D;AAE5D;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,WAAgB;IACxC,MAAM,OAAO,GAAG,IAAA,yCAAqB,EAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,OAAO,EAAE;QACb,OAAO,SAAS,CAAC;KACjB;IAED,IAAI,UAA8B,CAAC;IACnC,IAAI;QACH,IAAI,OAAO,EAAE,OAAO,EAAE;YACrB,UAAU,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC;SAC9C;KACD;IAAC,MAAM,GAAE;IAEV,OAAO;QACN,eAAe,EAAE,OAAO,EAAE,oBAAoB;QAC9C,uEAAuE;QACvE,mBAAmB,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS;KAC1D,CAAC;AACH,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 * @alpha\n */\nexport function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined {\n\tconst locator = getLocatorFromOdspUrl(documentUrl);\n\n\tif (!locator) {\n\t\treturn undefined;\n\t}\n\n\tlet siteOrigin: string | undefined;\n\ttry {\n\t\tif (locator?.siteUrl) {\n\t\t\tsiteOrigin = new URL(locator?.siteUrl).origin;\n\t\t}\n\t} catch {}\n\n\treturn {\n\t\tcodeDetailsHint: locator?.containerPackageName,\n\t\t// Add the snapshot endpoint, which has the same domain as the site URL\n\t\tcriticalBootDomains: siteOrigin ? [siteOrigin] : undefined,\n\t};\n}\n"]}
@@ -8,6 +8,7 @@ import { DriverPreCheckInfo } from "@fluidframework/driver-definitions";
8
8
  * Note that returning information here is NOT a full guarantee that resolve will ultimately be successful.
9
9
  * Instead, this should be used as a lightweight check that can filter out easily detectable unsupported URLs
10
10
  * before the entire Fluid loading process needs to be kicked off.
11
+ * @alpha
11
12
  */
12
13
  export declare function checkUrl(documentUrl: URL): DriverPreCheckInfo | undefined;
13
14
  //# sourceMappingURL=checkUrl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkUrl.d.ts","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAGxE;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,GAAG,GAAG,kBAAkB,GAAG,SAAS,CAmBzE"}
1
+ {"version":3,"file":"checkUrl.d.ts","sourceRoot":"","sources":["../src/checkUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAGxE;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,GAAG,GAAG,kBAAkB,GAAG,SAAS,CAmBzE"}
@@ -0,0 +1,207 @@
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 core_utils_1 = require("@fluidframework/core-utils");
9
+ const ReadBufferUtils_1 = require("./ReadBufferUtils.cjs");
10
+ const zipItDataRepresentationUtils_1 = require("./zipItDataRepresentationUtils.cjs");
11
+ const odspUtils_1 = require("./odspUtils.cjs");
12
+ exports.snapshotMinReadVersion = "1.0";
13
+ exports.currentReadVersion = "1.0";
14
+ /**
15
+ * Recreates blobs section of the tree.
16
+ * @param node - tree node to read blob section from
17
+ */
18
+ function readBlobSection(node) {
19
+ (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(node, "TreeBlobs should be of type NodeCore");
20
+ let slowBlobStructureCount = 0;
21
+ const blobs = new Map();
22
+ for (const blob of node) {
23
+ (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(blob, "blob should be node");
24
+ /**
25
+ * Perf optimization - the most common cases!
26
+ * This is essentially unrolling code below for faster processing
27
+ * It speeds up tree parsing by 2-3x times!
28
+ */
29
+ if (blob.length === 4 &&
30
+ blob.getMaybeString(0) === "id" &&
31
+ blob.getMaybeString(2) === "data") {
32
+ // "id": <node name>
33
+ // "data": <blob>
34
+ blobs.set(blob.getString(1), blob.getBlob(3).arrayBuffer);
35
+ continue;
36
+ }
37
+ /**
38
+ * More generalized workflow
39
+ */
40
+ slowBlobStructureCount += 1;
41
+ const records = (0, zipItDataRepresentationUtils_1.getNodeProps)(blob);
42
+ (0, zipItDataRepresentationUtils_1.assertBlobCoreInstance)(records.data, "data should be of BlobCore type");
43
+ const id = (0, zipItDataRepresentationUtils_1.getStringInstance)(records.id, "blob id should be string");
44
+ blobs.set(id, records.data.arrayBuffer);
45
+ }
46
+ return { blobs, slowBlobStructureCount };
47
+ }
48
+ /**
49
+ * Recreates ops section of the tree.
50
+ * @param node - tree node to read ops section from
51
+ */
52
+ function readOpsSection(node) {
53
+ (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(node, "Deltas should be of type NodeCore");
54
+ const ops = [];
55
+ const records = (0, zipItDataRepresentationUtils_1.getNodeProps)(node);
56
+ (0, zipItDataRepresentationUtils_1.assertNumberInstance)(records.firstSequenceNumber, "Seq number should be a number");
57
+ (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(records.deltas, "Deltas should be a Node");
58
+ for (let i = 0; i < records.deltas.length; ++i) {
59
+ ops.push(JSON.parse(records.deltas.getString(i)));
60
+ }
61
+ // Due to a bug at service side, in an edge case service was serializing deltas even
62
+ // when there are no ops. So just make the code resilient to that bug. Service has also
63
+ // fixed that bug.
64
+ (0, core_utils_1.assert)(ops.length === 0 || records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber, 0x280 /* "Validate first op seq number" */);
65
+ return ops;
66
+ }
67
+ /**
68
+ * Recreates snapshot tree out of tree representation.
69
+ * @param node - tree node to de-serialize from
70
+ */
71
+ function readTreeSection(node) {
72
+ let slowTreeStructureCount = 0;
73
+ const trees = {};
74
+ const snapshotTree = {
75
+ blobs: {},
76
+ trees,
77
+ };
78
+ for (const treeNode of node) {
79
+ (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(treeNode, "tree nodes should be nodes");
80
+ /**
81
+ * Perf optimization - the most common cases!
82
+ * This is essentially unrolling code below for faster processing
83
+ * It speeds up tree parsing by 2-3x times!
84
+ */
85
+ const length = treeNode.length;
86
+ if (length > 0 && treeNode.getMaybeString(0) === "name") {
87
+ if (length === 4) {
88
+ const content = treeNode.getMaybeString(2);
89
+ // "name": <node name>
90
+ // "children": <blob id>
91
+ if (content === "children") {
92
+ const result = readTreeSection(treeNode.getNode(3));
93
+ trees[treeNode.getString(1)] = result.snapshotTree;
94
+ slowTreeStructureCount += result.slowTreeStructureCount;
95
+ continue;
96
+ }
97
+ // "name": <node name>
98
+ // "value": <blob id>
99
+ if (content === "value") {
100
+ snapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(3);
101
+ continue;
102
+ }
103
+ }
104
+ // "name": <node name>
105
+ // "nodeType": 3
106
+ // "value": <blob id>
107
+ if (length === 6 &&
108
+ treeNode.getMaybeString(2) === "nodeType" &&
109
+ treeNode.getMaybeString(4) === "value") {
110
+ snapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(5);
111
+ continue;
112
+ }
113
+ // "name": <node name>
114
+ // "unreferenced": true
115
+ // "children": <blob id>
116
+ if (length === 6 &&
117
+ treeNode.getMaybeString(2) === "unreferenced" &&
118
+ treeNode.getMaybeString(4) === "children") {
119
+ const result = readTreeSection(treeNode.getNode(5));
120
+ trees[treeNode.getString(1)] = result.snapshotTree;
121
+ slowTreeStructureCount += result.slowTreeStructureCount;
122
+ (0, core_utils_1.assert)(treeNode.getBool(3), 0x3db /* Unreferenced if present should be true */);
123
+ snapshotTree.unreferenced = true;
124
+ continue;
125
+ }
126
+ }
127
+ /**
128
+ * More generalized workflow
129
+ */
130
+ slowTreeStructureCount += 1;
131
+ const records = (0, zipItDataRepresentationUtils_1.getNodeProps)(treeNode);
132
+ if (records.unreferenced !== undefined) {
133
+ (0, zipItDataRepresentationUtils_1.assertBoolInstance)(records.unreferenced, "Unreferenced flag should be bool");
134
+ (0, core_utils_1.assert)(records.unreferenced, 0x281 /* "Unreferenced if present should be true" */);
135
+ snapshotTree.unreferenced = true;
136
+ }
137
+ const path = (0, zipItDataRepresentationUtils_1.getStringInstance)(records.name, "Path name should be string");
138
+ if (records.value !== undefined) {
139
+ snapshotTree.blobs[path] = (0, zipItDataRepresentationUtils_1.getStringInstance)(records.value, "Blob value should be string");
140
+ }
141
+ else if (records.children !== undefined) {
142
+ (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(records.children, "Trees should be of type NodeCore");
143
+ const result = readTreeSection(records.children);
144
+ trees[path] = result.snapshotTree;
145
+ slowTreeStructureCount += result.slowTreeStructureCount;
146
+ }
147
+ else {
148
+ trees[path] = { blobs: {}, trees: {} };
149
+ }
150
+ }
151
+ return { snapshotTree, slowTreeStructureCount };
152
+ }
153
+ /**
154
+ * Recreates snapshot tree out of tree representation.
155
+ * @param node - tree node to de-serialize from
156
+ */
157
+ function readSnapshotSection(node) {
158
+ (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(node, "Snapshot should be of type NodeCore");
159
+ const records = (0, zipItDataRepresentationUtils_1.getNodeProps)(node);
160
+ (0, zipItDataRepresentationUtils_1.assertNodeCoreInstance)(records.treeNodes, "TreeNodes should be of type NodeCore");
161
+ (0, zipItDataRepresentationUtils_1.assertNumberInstance)(records.sequenceNumber, "sequenceNumber should be of type number");
162
+ const { snapshotTree, slowTreeStructureCount } = readTreeSection(records.treeNodes);
163
+ snapshotTree.id = (0, zipItDataRepresentationUtils_1.getStringInstance)(records.id, "snapshotId should be string");
164
+ const sequenceNumber = records.sequenceNumber.valueOf();
165
+ return {
166
+ sequenceNumber,
167
+ snapshotTree,
168
+ slowTreeStructureCount,
169
+ };
170
+ }
171
+ /**
172
+ * Converts snapshot from binary compact representation to tree/blobs/ops.
173
+ * @param buffer - Compact snapshot to be parsed into tree/blobs/ops.
174
+ * @returns Tree, blobs and ops from the snapshot.
175
+ * @internal
176
+ */
177
+ function parseCompactSnapshotResponse(buffer, logger) {
178
+ const { builder, telemetryProps } = zipItDataRepresentationUtils_1.TreeBuilder.load(new ReadBufferUtils_1.ReadBuffer(buffer), logger);
179
+ (0, core_utils_1.assert)(builder.length === 1, 0x219 /* "1 root should be there" */);
180
+ const root = builder.getNode(0);
181
+ const records = (0, zipItDataRepresentationUtils_1.getNodeProps)(root);
182
+ const mrv = (0, zipItDataRepresentationUtils_1.getStringInstance)(records.mrv, "minReadVersion should be string");
183
+ const cv = (0, zipItDataRepresentationUtils_1.getStringInstance)(records.cv, "createVersion should be string");
184
+ if (records.lsn !== undefined) {
185
+ (0, zipItDataRepresentationUtils_1.assertNumberInstance)(records.lsn, "lsn should be a number");
186
+ }
187
+ (0, core_utils_1.assert)(parseFloat(exports.snapshotMinReadVersion) >= parseFloat(mrv), 0x20f /* "Driver min read version should >= to server minReadVersion" */);
188
+ (0, core_utils_1.assert)(parseFloat(cv) >= parseFloat(exports.snapshotMinReadVersion), 0x210 /* "Snapshot should be created with minReadVersion or above" */);
189
+ (0, core_utils_1.assert)(exports.currentReadVersion === cv, 0x2c2 /* "Create Version should be equal to currentReadVersion" */);
190
+ const [snapshot, durationSnapshotTree] = (0, odspUtils_1.measure)(() => readSnapshotSection(records.snapshot));
191
+ const [blobs, durationBlobs] = (0, odspUtils_1.measure)(() => readBlobSection(records.blobs));
192
+ return {
193
+ ...snapshot,
194
+ ...blobs,
195
+ ops: records.deltas !== undefined ? readOpsSection(records.deltas) : [],
196
+ latestSequenceNumber: records.lsn,
197
+ telemetryProps: {
198
+ ...telemetryProps,
199
+ durationSnapshotTree,
200
+ durationBlobs,
201
+ slowTreeStructureCount: snapshot.slowTreeStructureCount,
202
+ slowBlobStructureCount: blobs.slowBlobStructureCount,
203
+ },
204
+ };
205
+ }
206
+ exports.parseCompactSnapshotResponse = parseCompactSnapshotResponse;
207
+ //# sourceMappingURL=compactSnapshotParser.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compactSnapshotParser.cjs","sourceRoot":"","sources":["../src/compactSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAIpD,2DAA+C;AAC/C,qFAUwC;AACxC,+CAAsC;AAEzB,QAAA,sBAAsB,GAAG,KAAK,CAAC;AAC/B,QAAA,kBAAkB,GAAG,KAAK,CAAC;AAWxC;;;GAGG;AACH,SAAS,eAAe,CAAC,IAAe;IACvC,IAAA,qDAAsB,EAAC,IAAI,EAAE,sCAAsC,CAAC,CAAC;IACrE,IAAI,sBAAsB,GAAG,CAAC,CAAC;IAC/B,MAAM,KAAK,GAA6B,IAAI,GAAG,EAAE,CAAC;IAClD,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE;QACxB,IAAA,qDAAsB,EAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QAEpD;;;;WAIG;QACH,IACC,IAAI,CAAC,MAAM,KAAK,CAAC;YACjB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI;YAC/B,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,MAAM,EAChC;YACD,oBAAoB;YACpB,iBAAiB;YACjB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;YAC1D,SAAS;SACT;QAED;;WAEG;QACH,sBAAsB,IAAI,CAAC,CAAC;QAC5B,MAAM,OAAO,GAAG,IAAA,2CAAY,EAAC,IAAI,CAAC,CAAC;QACnC,IAAA,qDAAsB,EAAC,OAAO,CAAC,IAAI,EAAE,iCAAiC,CAAC,CAAC;QACxE,MAAM,EAAE,GAAG,IAAA,gDAAiB,EAAC,OAAO,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AM,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;QACvE,oBAAoB,EAAE,OAAO,CAAC,GAAG;QACjC,cAAc,EAAE;YACf,GAAG,cAAc;YACjB,oBAAoB;YACpB,aAAa;YACb,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB;YACvD,sBAAsB,EAAE,KAAK,CAAC,sBAAsB;SACpD;KACD,CAAC;AACH,CAAC;AA7CD,oEA6CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ISequencedDocumentMessage, ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport {\n\tassertBlobCoreInstance,\n\tgetStringInstance,\n\tassertBoolInstance,\n\tassertNodeCoreInstance,\n\tassertNumberInstance,\n\tgetNodeProps,\n\tNodeCore,\n\tNodeTypes,\n\tTreeBuilder,\n} from \"./zipItDataRepresentationUtils\";\nimport { measure } from \"./odspUtils\";\n\nexport const snapshotMinReadVersion = \"1.0\";\nexport const currentReadVersion = \"1.0\";\n\n/**\n * The parsing is significantly faster if the position of props is well known instead of dynamic. So these variables\n * represents how many times slower parsing path is executed. This will be then logged into telemetry.\n * @internal\n */\nexport interface ISnapshotContentsWithProps extends ISnapshotContents {\n\ttelemetryProps: Record<string, 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\tassertNodeCoreInstance(node, \"TreeBlobs should be of type NodeCore\");\n\tlet slowBlobStructureCount = 0;\n\tconst blobs: Map<string, ArrayBuffer> = new Map();\n\tfor (const blob of node) {\n\t\tassertNodeCoreInstance(blob, \"blob should be node\");\n\n\t\t/**\n\t\t * Perf optimization - the most common cases!\n\t\t * This is essentially unrolling code below for faster processing\n\t\t * It speeds up tree parsing by 2-3x times!\n\t\t */\n\t\tif (\n\t\t\tblob.length === 4 &&\n\t\t\tblob.getMaybeString(0) === \"id\" &&\n\t\t\tblob.getMaybeString(2) === \"data\"\n\t\t) {\n\t\t\t// \"id\": <node name>\n\t\t\t// \"data\": <blob>\n\t\t\tblobs.set(blob.getString(1), blob.getBlob(3).arrayBuffer);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/**\n\t\t * More generalized workflow\n\t\t */\n\t\tslowBlobStructureCount += 1;\n\t\tconst records = getNodeProps(blob);\n\t\tassertBlobCoreInstance(records.data, \"data should be of BlobCore type\");\n\t\tconst id = getStringInstance(records.id, \"blob id should be string\");\n\t\tblobs.set(id, records.data.arrayBuffer);\n\t}\n\treturn { blobs, slowBlobStructureCount };\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\tassertNodeCoreInstance(node, \"Deltas should be of type NodeCore\");\n\tconst ops: ISequencedDocumentMessage[] = [];\n\tconst records = getNodeProps(node);\n\tassertNumberInstance(records.firstSequenceNumber, \"Seq number should be a number\");\n\tassertNodeCoreInstance(records.deltas, \"Deltas should be a Node\");\n\tfor (let i = 0; i < records.deltas.length; ++i) {\n\t\tops.push(JSON.parse(records.deltas.getString(i)));\n\t}\n\t// Due to a bug at service side, in an edge case service was serializing deltas even\n\t// when there are no ops. So just make the code resilient to that bug. Service has also\n\t// fixed that bug.\n\tassert(\n\t\tops.length === 0 || records.firstSequenceNumber.valueOf() === ops[0].sequenceNumber,\n\t\t0x280 /* \"Validate first op seq number\" */,\n\t);\n\treturn 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\tlet slowTreeStructureCount = 0;\n\tconst trees = {};\n\tconst snapshotTree: ISnapshotTree = {\n\t\tblobs: {},\n\t\ttrees,\n\t};\n\tfor (const treeNode of node) {\n\t\tassertNodeCoreInstance(treeNode, \"tree nodes should be nodes\");\n\n\t\t/**\n\t\t * Perf optimization - the most common cases!\n\t\t * This is essentially unrolling code below for faster processing\n\t\t * It speeds up tree parsing by 2-3x times!\n\t\t */\n\t\tconst length = treeNode.length;\n\t\tif (length > 0 && treeNode.getMaybeString(0) === \"name\") {\n\t\t\tif (length === 4) {\n\t\t\t\tconst content = treeNode.getMaybeString(2);\n\t\t\t\t// \"name\": <node name>\n\t\t\t\t// \"children\": <blob id>\n\t\t\t\tif (content === \"children\") {\n\t\t\t\t\tconst result = readTreeSection(treeNode.getNode(3));\n\t\t\t\t\ttrees[treeNode.getString(1)] = result.snapshotTree;\n\t\t\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// \"name\": <node name>\n\t\t\t\t// \"value\": <blob id>\n\t\t\t\tif (content === \"value\") {\n\t\t\t\t\tsnapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(3);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// \"name\": <node name>\n\t\t\t// \"nodeType\": 3\n\t\t\t// \"value\": <blob id>\n\t\t\tif (\n\t\t\t\tlength === 6 &&\n\t\t\t\ttreeNode.getMaybeString(2) === \"nodeType\" &&\n\t\t\t\ttreeNode.getMaybeString(4) === \"value\"\n\t\t\t) {\n\t\t\t\tsnapshotTree.blobs[treeNode.getString(1)] = treeNode.getString(5);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// \"name\": <node name>\n\t\t\t// \"unreferenced\": true\n\t\t\t// \"children\": <blob id>\n\t\t\tif (\n\t\t\t\tlength === 6 &&\n\t\t\t\ttreeNode.getMaybeString(2) === \"unreferenced\" &&\n\t\t\t\ttreeNode.getMaybeString(4) === \"children\"\n\t\t\t) {\n\t\t\t\tconst result = readTreeSection(treeNode.getNode(5));\n\t\t\t\ttrees[treeNode.getString(1)] = result.snapshotTree;\n\t\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t\t\tassert(treeNode.getBool(3), 0x3db /* Unreferenced if present should be true */);\n\t\t\t\tsnapshotTree.unreferenced = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * More generalized workflow\n\t\t */\n\t\tslowTreeStructureCount += 1;\n\t\tconst records = getNodeProps(treeNode);\n\n\t\tif (records.unreferenced !== undefined) {\n\t\t\tassertBoolInstance(records.unreferenced, \"Unreferenced flag should be bool\");\n\t\t\tassert(records.unreferenced, 0x281 /* \"Unreferenced if present should be true\" */);\n\t\t\tsnapshotTree.unreferenced = true;\n\t\t}\n\n\t\tconst path = getStringInstance(records.name, \"Path name should be string\");\n\t\tif (records.value !== undefined) {\n\t\t\tsnapshotTree.blobs[path] = getStringInstance(\n\t\t\t\trecords.value,\n\t\t\t\t\"Blob value should be string\",\n\t\t\t);\n\t\t} else if (records.children !== undefined) {\n\t\t\tassertNodeCoreInstance(records.children, \"Trees should be of type NodeCore\");\n\t\t\tconst result = readTreeSection(records.children);\n\t\t\ttrees[path] = result.snapshotTree;\n\t\t\tslowTreeStructureCount += result.slowTreeStructureCount;\n\t\t} else {\n\t\t\ttrees[path] = { blobs: {}, trees: {} };\n\t\t}\n\t}\n\treturn { snapshotTree, slowTreeStructureCount };\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) {\n\tassertNodeCoreInstance(node, \"Snapshot should be of type NodeCore\");\n\tconst records = getNodeProps(node);\n\n\tassertNodeCoreInstance(records.treeNodes, \"TreeNodes should be of type NodeCore\");\n\tassertNumberInstance(records.sequenceNumber, \"sequenceNumber should be of type number\");\n\tconst { snapshotTree, slowTreeStructureCount } = readTreeSection(records.treeNodes);\n\tsnapshotTree.id = getStringInstance(records.id, \"snapshotId should be string\");\n\tconst sequenceNumber = records.sequenceNumber.valueOf();\n\treturn {\n\t\tsequenceNumber,\n\t\tsnapshotTree,\n\t\tslowTreeStructureCount,\n\t};\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 * @internal\n */\nexport function parseCompactSnapshotResponse(\n\tbuffer: Uint8Array,\n\tlogger: ITelemetryLoggerExt,\n): ISnapshotContentsWithProps {\n\tconst { builder, telemetryProps } = TreeBuilder.load(new ReadBuffer(buffer), logger);\n\tassert(builder.length === 1, 0x219 /* \"1 root should be there\" */);\n\tconst root = builder.getNode(0);\n\n\tconst records = getNodeProps(root);\n\n\tconst mrv = getStringInstance(records.mrv, \"minReadVersion should be string\");\n\tconst cv = getStringInstance(records.cv, \"createVersion should be string\");\n\tif (records.lsn !== undefined) {\n\t\tassertNumberInstance(records.lsn, \"lsn should be a number\");\n\t}\n\n\tassert(\n\t\tparseFloat(snapshotMinReadVersion) >= parseFloat(mrv),\n\t\t0x20f /* \"Driver min read version should >= to server minReadVersion\" */,\n\t);\n\tassert(\n\t\tparseFloat(cv) >= parseFloat(snapshotMinReadVersion),\n\t\t0x210 /* \"Snapshot should be created with minReadVersion or above\" */,\n\t);\n\tassert(\n\t\tcurrentReadVersion === cv,\n\t\t0x2c2 /* \"Create Version should be equal to currentReadVersion\" */,\n\t);\n\n\tconst [snapshot, durationSnapshotTree] = measure(() => readSnapshotSection(records.snapshot));\n\tconst [blobs, durationBlobs] = measure(() => readBlobSection(records.blobs));\n\n\treturn {\n\t\t...snapshot,\n\t\t...blobs,\n\t\tops: records.deltas !== undefined ? readOpsSection(records.deltas) : [],\n\t\tlatestSequenceNumber: records.lsn,\n\t\ttelemetryProps: {\n\t\t\t...telemetryProps,\n\t\t\tdurationSnapshotTree,\n\t\t\tdurationBlobs,\n\t\t\tslowTreeStructureCount: snapshot.slowTreeStructureCount,\n\t\t\tslowBlobStructureCount: blobs.slowBlobStructureCount,\n\t\t},\n\t};\n}\n"]}