@fluidframework/odsp-driver 2.0.0-dev.7.3.0.210328 → 2.0.0-dev.7.3.0.211848

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 (328) hide show
  1. package/api-report/odsp-driver.api.md +2 -1
  2. package/dist/{ReadBufferUtils.js → ReadBufferUtils.cjs} +1 -1
  3. package/{lib/ReadBufferUtils.js.map → dist/ReadBufferUtils.cjs.map} +1 -1
  4. package/dist/{WriteBufferUtils.js → WriteBufferUtils.cjs} +2 -2
  5. package/dist/WriteBufferUtils.cjs.map +1 -0
  6. package/dist/{checkUrl.js → checkUrl.cjs} +2 -2
  7. package/dist/checkUrl.cjs.map +1 -0
  8. package/dist/{compactSnapshotParser.js → compactSnapshotParser.cjs} +4 -4
  9. package/dist/compactSnapshotParser.cjs.map +1 -0
  10. package/dist/{compactSnapshotWriter.js → compactSnapshotWriter.cjs} +4 -4
  11. package/dist/compactSnapshotWriter.cjs.map +1 -0
  12. package/dist/{constants.js → constants.cjs} +1 -1
  13. package/dist/constants.cjs.map +1 -0
  14. package/dist/{contracts.js → contracts.cjs} +1 -1
  15. package/dist/contracts.cjs.map +1 -0
  16. package/dist/{contractsPublic.js → contractsPublic.cjs} +1 -1
  17. package/dist/contractsPublic.cjs.map +1 -0
  18. package/dist/{createFile.js → createFile.cjs} +10 -10
  19. package/dist/createFile.cjs.map +1 -0
  20. package/dist/{createNewContainerOnExistingFile.js → createNewContainerOnExistingFile.cjs} +7 -7
  21. package/dist/createNewContainerOnExistingFile.cjs.map +1 -0
  22. package/dist/{createNewModule.js → createNewModule.cjs} +3 -3
  23. package/dist/createNewModule.cjs.map +1 -0
  24. package/dist/{createNewUtils.js → createNewUtils.cjs} +4 -4
  25. package/dist/createNewUtils.cjs.map +1 -0
  26. package/dist/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.cjs} +2 -2
  27. package/dist/createOdspCreateContainerRequest.cjs.map +1 -0
  28. package/dist/{createOdspUrl.js → createOdspUrl.cjs} +1 -1
  29. package/dist/createOdspUrl.cjs.map +1 -0
  30. package/dist/{epochTracker.js → epochTracker.cjs} +6 -6
  31. package/dist/epochTracker.cjs.map +1 -0
  32. package/dist/{fetch.js → fetch.cjs} +1 -1
  33. package/dist/fetch.cjs.map +1 -0
  34. package/dist/{fetchSnapshot.js → fetchSnapshot.cjs} +8 -8
  35. package/dist/fetchSnapshot.cjs.map +1 -0
  36. package/dist/{getFileLink.js → getFileLink.cjs} +5 -5
  37. package/dist/getFileLink.cjs.map +1 -0
  38. package/dist/{getQueryString.js → getQueryString.cjs} +1 -1
  39. package/dist/getQueryString.cjs.map +1 -0
  40. package/dist/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.cjs} +1 -1
  41. package/dist/getUrlAndHeadersWithAuth.cjs.map +1 -0
  42. package/dist/{index.js → index.cjs} +17 -17
  43. package/dist/index.cjs.map +1 -0
  44. package/dist/localOdspDriver/{localOdspDeltaStorageService.js → localOdspDeltaStorageService.cjs} +1 -1
  45. package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +1 -0
  46. package/dist/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.cjs} +3 -3
  47. package/dist/localOdspDriver/localOdspDocumentService.cjs.map +1 -0
  48. package/dist/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.cjs} +4 -4
  49. package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +1 -0
  50. package/dist/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.cjs} +4 -4
  51. package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +1 -0
  52. package/dist/{odspCache.js → odspCache.cjs} +1 -1
  53. package/dist/odspCache.cjs.map +1 -0
  54. package/dist/{odspDelayLoadedDeltaStream.js → odspDelayLoadedDeltaStream.cjs} +5 -5
  55. package/dist/odspDelayLoadedDeltaStream.cjs.map +1 -0
  56. package/dist/{odspDeltaStorageService.js → odspDeltaStorageService.cjs} +2 -2
  57. package/dist/odspDeltaStorageService.cjs.map +1 -0
  58. package/dist/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.cjs} +4 -4
  59. package/dist/odspDocumentDeltaConnection.cjs.map +1 -0
  60. package/dist/{odspDocumentService.js → odspDocumentService.cjs} +8 -32
  61. package/dist/odspDocumentService.cjs.map +1 -0
  62. package/dist/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.cjs} +3 -3
  63. package/dist/odspDocumentServiceFactory.cjs.map +1 -0
  64. package/dist/{odspDocumentServiceFactoryCore.js → odspDocumentServiceFactoryCore.cjs} +6 -30
  65. package/dist/odspDocumentServiceFactoryCore.cjs.map +1 -0
  66. package/dist/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.cjs} +2 -2
  67. package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +1 -0
  68. package/dist/{odspDocumentStorageManager.js → odspDocumentStorageManager.cjs} +7 -31
  69. package/dist/odspDocumentStorageManager.cjs.map +1 -0
  70. package/dist/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.cjs} +1 -1
  71. package/dist/odspDocumentStorageServiceBase.cjs.map +1 -0
  72. package/dist/{odspDriverUrlResolver.js → odspDriverUrlResolver.cjs} +7 -7
  73. package/dist/odspDriverUrlResolver.cjs.map +1 -0
  74. package/dist/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.cjs} +7 -7
  75. package/dist/odspDriverUrlResolverForShareLink.cjs.map +1 -0
  76. package/dist/{odspError.js → odspError.cjs} +2 -2
  77. package/dist/odspError.cjs.map +1 -0
  78. package/dist/{odspFluidFileLink.js → odspFluidFileLink.cjs} +2 -2
  79. package/dist/odspFluidFileLink.cjs.map +1 -0
  80. package/dist/{odspLocationRedirection.js → odspLocationRedirection.cjs} +2 -2
  81. package/dist/odspLocationRedirection.cjs.map +1 -0
  82. package/dist/{odspPublicUtils.js → odspPublicUtils.cjs} +1 -1
  83. package/dist/odspPublicUtils.cjs.map +1 -0
  84. package/dist/{odspSnapshotParser.js → odspSnapshotParser.cjs} +1 -1
  85. package/dist/odspSnapshotParser.cjs.map +1 -0
  86. package/dist/{odspSummaryUploadManager.js → odspSummaryUploadManager.cjs} +3 -3
  87. package/dist/odspSummaryUploadManager.cjs.map +1 -0
  88. package/dist/{odspUrlHelper.js → odspUrlHelper.cjs} +1 -1
  89. package/dist/odspUrlHelper.cjs.map +1 -0
  90. package/dist/{odspUtils.js → odspUtils.cjs} +3 -3
  91. package/dist/odspUtils.cjs.map +1 -0
  92. package/dist/{opsCaching.js → opsCaching.cjs} +1 -1
  93. package/dist/opsCaching.cjs.map +1 -0
  94. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  95. package/dist/packageVersion.cjs.map +1 -0
  96. package/dist/packageVersion.d.ts +1 -1
  97. package/dist/{prefetchLatestSnapshot.js → prefetchLatestSnapshot.cjs} +3 -3
  98. package/dist/prefetchLatestSnapshot.cjs.map +1 -0
  99. package/dist/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.cjs} +2 -2
  100. package/dist/retryErrorsStorageAdapter.cjs.map +1 -0
  101. package/dist/{retryUtils.js → retryUtils.cjs} +2 -2
  102. package/dist/retryUtils.cjs.map +1 -0
  103. package/dist/{socketModule.js → socketModule.cjs} +1 -1
  104. package/dist/socketModule.cjs.map +1 -0
  105. package/dist/tsdoc-metadata.json +1 -1
  106. package/dist/{vroom.js → vroom.cjs} +4 -4
  107. package/{lib/vroom.js.map → dist/vroom.cjs.map} +1 -1
  108. package/dist/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.cjs} +3 -3
  109. package/dist/zipItDataRepresentationUtils.cjs.map +1 -0
  110. package/lib/{ReadBufferUtils.js → ReadBufferUtils.mjs} +1 -1
  111. package/lib/ReadBufferUtils.mjs.map +1 -0
  112. package/lib/{WriteBufferUtils.js → WriteBufferUtils.mjs} +2 -2
  113. package/lib/WriteBufferUtils.mjs.map +1 -0
  114. package/lib/{checkUrl.js → checkUrl.mjs} +2 -2
  115. package/lib/checkUrl.mjs.map +1 -0
  116. package/lib/{compactSnapshotParser.js → compactSnapshotParser.mjs} +4 -4
  117. package/lib/compactSnapshotParser.mjs.map +1 -0
  118. package/lib/{compactSnapshotWriter.js → compactSnapshotWriter.mjs} +4 -4
  119. package/lib/compactSnapshotWriter.mjs.map +1 -0
  120. package/lib/{constants.js → constants.mjs} +1 -1
  121. package/lib/constants.mjs.map +1 -0
  122. package/lib/{contracts.js → contracts.mjs} +1 -1
  123. package/lib/contracts.mjs.map +1 -0
  124. package/lib/{contractsPublic.js → contractsPublic.mjs} +1 -1
  125. package/lib/contractsPublic.mjs.map +1 -0
  126. package/lib/{createFile.js → createFile.mjs} +10 -10
  127. package/lib/createFile.mjs.map +1 -0
  128. package/lib/{createNewContainerOnExistingFile.js → createNewContainerOnExistingFile.mjs} +7 -7
  129. package/lib/createNewContainerOnExistingFile.mjs.map +1 -0
  130. package/lib/{createNewModule.js → createNewModule.mjs} +3 -3
  131. package/lib/createNewModule.mjs.map +1 -0
  132. package/lib/{createNewUtils.js → createNewUtils.mjs} +4 -4
  133. package/lib/createNewUtils.mjs.map +1 -0
  134. package/lib/{createOdspCreateContainerRequest.js → createOdspCreateContainerRequest.mjs} +2 -2
  135. package/lib/createOdspCreateContainerRequest.mjs.map +1 -0
  136. package/lib/{createOdspUrl.js → createOdspUrl.mjs} +1 -1
  137. package/lib/createOdspUrl.mjs.map +1 -0
  138. package/lib/{epochTracker.js → epochTracker.mjs} +6 -6
  139. package/lib/epochTracker.mjs.map +1 -0
  140. package/lib/{fetch.js → fetch.mjs} +1 -1
  141. package/lib/fetch.mjs.map +1 -0
  142. package/lib/{fetchSnapshot.js → fetchSnapshot.mjs} +8 -8
  143. package/lib/fetchSnapshot.mjs.map +1 -0
  144. package/lib/{getFileLink.js → getFileLink.mjs} +5 -5
  145. package/lib/getFileLink.mjs.map +1 -0
  146. package/lib/{getQueryString.js → getQueryString.mjs} +1 -1
  147. package/lib/getQueryString.mjs.map +1 -0
  148. package/lib/{getUrlAndHeadersWithAuth.js → getUrlAndHeadersWithAuth.mjs} +1 -1
  149. package/lib/getUrlAndHeadersWithAuth.mjs.map +1 -0
  150. package/lib/{index.js → index.mjs} +17 -24
  151. package/lib/index.mjs.map +1 -0
  152. package/lib/localOdspDriver/{localOdspDeltaStorageService.js → localOdspDeltaStorageService.mjs} +1 -1
  153. package/lib/localOdspDriver/localOdspDeltaStorageService.mjs.map +1 -0
  154. package/lib/localOdspDriver/{localOdspDocumentService.js → localOdspDocumentService.mjs} +3 -3
  155. package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -0
  156. package/lib/localOdspDriver/{localOdspDocumentServiceFactory.js → localOdspDocumentServiceFactory.mjs} +4 -4
  157. package/lib/localOdspDriver/localOdspDocumentServiceFactory.mjs.map +1 -0
  158. package/lib/localOdspDriver/{localOdspDocumentStorageManager.js → localOdspDocumentStorageManager.mjs} +4 -4
  159. package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -0
  160. package/lib/{odspCache.js → odspCache.mjs} +1 -5
  161. package/lib/odspCache.mjs.map +1 -0
  162. package/lib/{odspDelayLoadedDeltaStream.js → odspDelayLoadedDeltaStream.mjs} +5 -5
  163. package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -0
  164. package/lib/{odspDeltaStorageService.js → odspDeltaStorageService.mjs} +2 -2
  165. package/lib/odspDeltaStorageService.mjs.map +1 -0
  166. package/lib/{odspDocumentDeltaConnection.js → odspDocumentDeltaConnection.mjs} +4 -4
  167. package/lib/odspDocumentDeltaConnection.mjs.map +1 -0
  168. package/lib/{odspDocumentService.js → odspDocumentService.mjs} +8 -10
  169. package/lib/odspDocumentService.mjs.map +1 -0
  170. package/lib/{odspDocumentServiceFactory.js → odspDocumentServiceFactory.mjs} +3 -4
  171. package/lib/odspDocumentServiceFactory.mjs.map +1 -0
  172. package/lib/{odspDocumentServiceFactoryCore.js → odspDocumentServiceFactoryCore.mjs} +6 -8
  173. package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -0
  174. package/lib/{odspDocumentServiceFactoryWithCodeSplit.js → odspDocumentServiceFactoryWithCodeSplit.mjs} +2 -2
  175. package/lib/odspDocumentServiceFactoryWithCodeSplit.mjs.map +1 -0
  176. package/lib/{odspDocumentStorageManager.js → odspDocumentStorageManager.mjs} +7 -9
  177. package/lib/odspDocumentStorageManager.mjs.map +1 -0
  178. package/lib/{odspDocumentStorageServiceBase.js → odspDocumentStorageServiceBase.mjs} +1 -1
  179. package/lib/odspDocumentStorageServiceBase.mjs.map +1 -0
  180. package/lib/{odspDriverUrlResolver.js → odspDriverUrlResolver.mjs} +7 -11
  181. package/lib/odspDriverUrlResolver.mjs.map +1 -0
  182. package/lib/{odspDriverUrlResolverForShareLink.js → odspDriverUrlResolverForShareLink.mjs} +7 -11
  183. package/lib/odspDriverUrlResolverForShareLink.mjs.map +1 -0
  184. package/lib/{odspError.js → odspError.mjs} +2 -2
  185. package/lib/odspError.mjs.map +1 -0
  186. package/lib/{odspFluidFileLink.js → odspFluidFileLink.mjs} +2 -2
  187. package/lib/odspFluidFileLink.mjs.map +1 -0
  188. package/lib/{odspLocationRedirection.js → odspLocationRedirection.mjs} +2 -2
  189. package/lib/odspLocationRedirection.mjs.map +1 -0
  190. package/lib/{odspPublicUtils.js → odspPublicUtils.mjs} +1 -1
  191. package/lib/odspPublicUtils.mjs.map +1 -0
  192. package/lib/{odspSnapshotParser.js → odspSnapshotParser.mjs} +1 -1
  193. package/lib/odspSnapshotParser.mjs.map +1 -0
  194. package/lib/{odspSummaryUploadManager.js → odspSummaryUploadManager.mjs} +3 -3
  195. package/lib/odspSummaryUploadManager.mjs.map +1 -0
  196. package/lib/{odspUrlHelper.js → odspUrlHelper.mjs} +1 -1
  197. package/lib/odspUrlHelper.mjs.map +1 -0
  198. package/lib/{odspUtils.js → odspUtils.mjs} +3 -3
  199. package/lib/odspUtils.mjs.map +1 -0
  200. package/lib/{opsCaching.js → opsCaching.mjs} +1 -1
  201. package/lib/opsCaching.mjs.map +1 -0
  202. package/lib/packageVersion.d.ts +1 -1
  203. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  204. package/lib/packageVersion.mjs.map +1 -0
  205. package/lib/{prefetchLatestSnapshot.js → prefetchLatestSnapshot.mjs} +3 -3
  206. package/lib/prefetchLatestSnapshot.mjs.map +1 -0
  207. package/lib/{retryErrorsStorageAdapter.js → retryErrorsStorageAdapter.mjs} +2 -2
  208. package/lib/retryErrorsStorageAdapter.mjs.map +1 -0
  209. package/lib/{retryUtils.js → retryUtils.mjs} +2 -2
  210. package/lib/retryUtils.mjs.map +1 -0
  211. package/lib/{socketModule.js → socketModule.mjs} +1 -1
  212. package/lib/socketModule.mjs.map +1 -0
  213. package/lib/{vroom.js → vroom.mjs} +4 -4
  214. package/lib/vroom.mjs.map +1 -0
  215. package/lib/{zipItDataRepresentationUtils.js → zipItDataRepresentationUtils.mjs} +3 -7
  216. package/lib/zipItDataRepresentationUtils.mjs.map +1 -0
  217. package/package.json +21 -21
  218. package/src/odspDocumentService.ts +1 -1
  219. package/src/odspDocumentServiceFactoryCore.ts +1 -1
  220. package/src/odspDocumentStorageManager.ts +1 -1
  221. package/src/packageVersion.ts +1 -1
  222. package/tsc-multi.test.json +4 -0
  223. package/tsconfig.json +5 -3
  224. package/dist/ReadBufferUtils.js.map +0 -1
  225. package/dist/WriteBufferUtils.js.map +0 -1
  226. package/dist/checkUrl.js.map +0 -1
  227. package/dist/compactSnapshotParser.js.map +0 -1
  228. package/dist/compactSnapshotWriter.js.map +0 -1
  229. package/dist/constants.js.map +0 -1
  230. package/dist/contracts.js.map +0 -1
  231. package/dist/contractsPublic.js.map +0 -1
  232. package/dist/createFile.js.map +0 -1
  233. package/dist/createNewContainerOnExistingFile.js.map +0 -1
  234. package/dist/createNewModule.js.map +0 -1
  235. package/dist/createNewUtils.js.map +0 -1
  236. package/dist/createOdspCreateContainerRequest.js.map +0 -1
  237. package/dist/createOdspUrl.js.map +0 -1
  238. package/dist/epochTracker.js.map +0 -1
  239. package/dist/fetch.js.map +0 -1
  240. package/dist/fetchSnapshot.js.map +0 -1
  241. package/dist/getFileLink.js.map +0 -1
  242. package/dist/getQueryString.js.map +0 -1
  243. package/dist/getUrlAndHeadersWithAuth.js.map +0 -1
  244. package/dist/index.js.map +0 -1
  245. package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +0 -1
  246. package/dist/localOdspDriver/localOdspDocumentService.js.map +0 -1
  247. package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  248. package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  249. package/dist/odspCache.js.map +0 -1
  250. package/dist/odspDelayLoadedDeltaStream.js.map +0 -1
  251. package/dist/odspDeltaStorageService.js.map +0 -1
  252. package/dist/odspDocumentDeltaConnection.js.map +0 -1
  253. package/dist/odspDocumentService.js.map +0 -1
  254. package/dist/odspDocumentServiceFactory.js.map +0 -1
  255. package/dist/odspDocumentServiceFactoryCore.js.map +0 -1
  256. package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  257. package/dist/odspDocumentStorageManager.js.map +0 -1
  258. package/dist/odspDocumentStorageServiceBase.js.map +0 -1
  259. package/dist/odspDriverUrlResolver.js.map +0 -1
  260. package/dist/odspDriverUrlResolverForShareLink.js.map +0 -1
  261. package/dist/odspError.js.map +0 -1
  262. package/dist/odspFluidFileLink.js.map +0 -1
  263. package/dist/odspLocationRedirection.js.map +0 -1
  264. package/dist/odspPublicUtils.js.map +0 -1
  265. package/dist/odspSnapshotParser.js.map +0 -1
  266. package/dist/odspSummaryUploadManager.js.map +0 -1
  267. package/dist/odspUrlHelper.js.map +0 -1
  268. package/dist/odspUtils.js.map +0 -1
  269. package/dist/opsCaching.js.map +0 -1
  270. package/dist/packageVersion.js.map +0 -1
  271. package/dist/prefetchLatestSnapshot.js.map +0 -1
  272. package/dist/retryErrorsStorageAdapter.js.map +0 -1
  273. package/dist/retryUtils.js.map +0 -1
  274. package/dist/socketModule.js.map +0 -1
  275. package/dist/vroom.js.map +0 -1
  276. package/dist/zipItDataRepresentationUtils.js.map +0 -1
  277. package/lib/WriteBufferUtils.js.map +0 -1
  278. package/lib/checkUrl.js.map +0 -1
  279. package/lib/compactSnapshotParser.js.map +0 -1
  280. package/lib/compactSnapshotWriter.js.map +0 -1
  281. package/lib/constants.js.map +0 -1
  282. package/lib/contracts.js.map +0 -1
  283. package/lib/contractsPublic.js.map +0 -1
  284. package/lib/createFile.js.map +0 -1
  285. package/lib/createNewContainerOnExistingFile.js.map +0 -1
  286. package/lib/createNewModule.js.map +0 -1
  287. package/lib/createNewUtils.js.map +0 -1
  288. package/lib/createOdspCreateContainerRequest.js.map +0 -1
  289. package/lib/createOdspUrl.js.map +0 -1
  290. package/lib/epochTracker.js.map +0 -1
  291. package/lib/fetch.js.map +0 -1
  292. package/lib/fetchSnapshot.js.map +0 -1
  293. package/lib/getFileLink.js.map +0 -1
  294. package/lib/getQueryString.js.map +0 -1
  295. package/lib/getUrlAndHeadersWithAuth.js.map +0 -1
  296. package/lib/index.js.map +0 -1
  297. package/lib/localOdspDriver/localOdspDeltaStorageService.js.map +0 -1
  298. package/lib/localOdspDriver/localOdspDocumentService.js.map +0 -1
  299. package/lib/localOdspDriver/localOdspDocumentServiceFactory.js.map +0 -1
  300. package/lib/localOdspDriver/localOdspDocumentStorageManager.js.map +0 -1
  301. package/lib/odspCache.js.map +0 -1
  302. package/lib/odspDelayLoadedDeltaStream.js.map +0 -1
  303. package/lib/odspDeltaStorageService.js.map +0 -1
  304. package/lib/odspDocumentDeltaConnection.js.map +0 -1
  305. package/lib/odspDocumentService.js.map +0 -1
  306. package/lib/odspDocumentServiceFactory.js.map +0 -1
  307. package/lib/odspDocumentServiceFactoryCore.js.map +0 -1
  308. package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +0 -1
  309. package/lib/odspDocumentStorageManager.js.map +0 -1
  310. package/lib/odspDocumentStorageServiceBase.js.map +0 -1
  311. package/lib/odspDriverUrlResolver.js.map +0 -1
  312. package/lib/odspDriverUrlResolverForShareLink.js.map +0 -1
  313. package/lib/odspError.js.map +0 -1
  314. package/lib/odspFluidFileLink.js.map +0 -1
  315. package/lib/odspLocationRedirection.js.map +0 -1
  316. package/lib/odspPublicUtils.js.map +0 -1
  317. package/lib/odspSnapshotParser.js.map +0 -1
  318. package/lib/odspSummaryUploadManager.js.map +0 -1
  319. package/lib/odspUrlHelper.js.map +0 -1
  320. package/lib/odspUtils.js.map +0 -1
  321. package/lib/opsCaching.js.map +0 -1
  322. package/lib/packageVersion.js.map +0 -1
  323. package/lib/prefetchLatestSnapshot.js.map +0 -1
  324. package/lib/retryErrorsStorageAdapter.js.map +0 -1
  325. package/lib/retryUtils.js.map +0 -1
  326. package/lib/socketModule.js.map +0 -1
  327. package/lib/zipItDataRepresentationUtils.js.map +0 -1
  328. package/tsconfig.esnext.json +0 -7
@@ -1 +0,0 @@
1
- {"version":3,"file":"odspUrlHelper.js","sourceRoot":"","sources":["../src/odspUrlHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,0CAA0C;AAE1C;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACzC,OAAO;IACN,kDAAkD;IAClD,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;QAC/B,8BAA8B;QAC9B,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QACnC,WAAW;QACX,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACvC,iBAAiB;QACjB,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CACnC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IACxC,IAAI,MAAM,GAAG,OAAO,CAAC;IACrB,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QACxB,MAAM,GAAG,EAAE,CAAC;KACZ;IAED,OAAO,GAAG,MAAM,IA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gB,GAAG,mEAAmE,CAAC,IAAI,CAC1F,QAAQ,CACR,CAAC;QAEF,IAAI,gBAAgB,KAAK,IAAI,EAAE;YAC9B,kFAAkF;YAClF,gBAAgB;gBACf,wEAAwE,CAAC,IAAI,CAC5E,QAAQ,CACR,CAAC;YAEH,IAAI,gBAAgB,KAAK,IAAI,EAAE;gBAC9B,OAAO,SAAS,CAAC;aACjB;SACD;QAED,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAEnC,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;KACpE;SAAM;QACN,gBAAgB,GAAG,uDAAuD,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE1F,IAAI,gBAAgB,KAAK,IAAI,EAAE;YAC9B,OAAO,SAAS,CAAC;SACjB;QACD,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAEnC,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;KACpE;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IOdspUrlParts } from \"@fluidframework/odsp-driver-definitions\";\n\n// Centralized store for all ODC/SPO logic\n\n/**\n * Checks whether or not the given URL origin is an ODC origin\n * @param origin - The URL origin to check\n * @public\n */\nexport function isOdcOrigin(origin: string): boolean {\n\treturn (\n\t\t// Primary API endpoint and several test endpoints\n\t\torigin.includes(\"onedrive.com\") ||\n\t\t// *storage.live.com hostnames\n\t\torigin.includes(\"storage.live.com\") ||\n\t\t// live-int\n\t\torigin.includes(\"storage.live-int.com\") ||\n\t\t// Test endpoints\n\t\torigin.includes(\"onedrive-tst.com\")\n\t);\n}\n\n/**\n * Gets the correct API root for the given ODSP url, e.g. 'https://foo-my.sharepoint.com/_api/v2.1'\n * @param origin - The URL origin\n * @public\n */\nexport function getApiRoot(origin: string): string {\n\tlet prefix = \"_api/\";\n\tif (isOdcOrigin(origin)) {\n\t\tprefix = \"\";\n\t}\n\n\treturn `${origin}/${prefix}v2.1`;\n}\n\n/**\n * Whether or not the given URL is a valid SPO/ODB URL\n * @param url - The URL to check\n * @public\n */\nexport function isSpoUrl(url: string): boolean {\n\tconst urlLower = url.toLowerCase();\n\n\t// Format: foo.sharepoint.com/_api/v2.1./drives/bar/items/baz and foo.sharepoint-df.com/...\n\tconst spoRegex = /(.*\\.sharepoint(-df)*\\.com)\\/_api\\/v2.1\\/drives\\/([^/]*)\\/items\\/([^/]*)/;\n\treturn !!spoRegex.exec(urlLower);\n}\n\n/**\n * Whether or not the given URL is a valid ODC URL\n * @param url - The URL to check\n * @public\n */\nexport function isOdcUrl(url: string | URL): boolean {\n\tconst urlObj = typeof url === \"string\" ? new URL(url) : url;\n\n\tif (!isOdcOrigin(urlObj.origin)) {\n\t\treturn false;\n\t}\n\n\tconst path = urlObj.pathname.toLowerCase();\n\n\t// Splitting the regexes so we don't have regex soup\n\t// Format: /v2.1/drive/items/ABC123!123 and /v2.1/drives/ABC123/items/ABC123!123\n\tconst odcRegex = /\\/v2.1\\/(drive|drives\\/[^/]+)\\/items\\/([\\da-z]+)!(\\d+)/;\n\n\t// Format: /v2.1/drives('ABC123')/items('ABC123!123')\n\tconst odcODataRegex = /\\/v2.1\\/drives\\('[^/]+'\\)\\/items\\('[\\da-z]+!\\d+'\\)/;\n\n\treturn !!(odcRegex.exec(path) ?? odcODataRegex.exec(path));\n}\n\n/**\n * Breaks an ODSP URL into its parts, extracting the site, drive ID, and item ID.\n * Returns undefined for invalid/malformed URLs.\n * @param url - The (raw) URL to parse\n * @public\n */\nexport async function getOdspUrlParts(url: URL): Promise<IOdspUrlParts | undefined> {\n\tconst pathname = url.pathname;\n\n\t// Joinsession like URL\n\t// Pick a regex based on the hostname\n\t// TODO This will only support ODC using api.onedrive.com, update to handle the future (share links etc)\n\tlet joinSessionMatch;\n\tif (isOdcOrigin(url.origin)) {\n\t\t// Capture groups:\n\t\t// 0: match\n\t\t// 1: origin\n\t\t// 2: optional `drives` capture (the `/drives/<DRIVEID>` API format vs `/drive`)\n\t\t// 3: optional captured drive ID\n\t\t// 4: Item ID\n\t\t// 5: Drive ID portion of Item ID\n\t\t// eslint-disable-next-line unicorn/no-unsafe-regex\n\t\tjoinSessionMatch = /(.*)\\/v2\\.1\\/drive(s\\/([\\dA-Za-z]+))?\\/items\\/(([\\dA-Za-z]+)!\\d+)/.exec(\n\t\t\tpathname,\n\t\t);\n\n\t\tif (joinSessionMatch === null) {\n\t\t\t// Try again but with the OData format ( `/drives('ABC123')/items('ABC123!456')` )\n\t\t\tjoinSessionMatch =\n\t\t\t\t/(.*)\\/v2\\.1\\/drives\\('([\\dA-Za-z]+)'\\)\\/items\\('(([\\dA-Za-z]+)!\\d+)'\\)/.exec(\n\t\t\t\t\tpathname,\n\t\t\t\t);\n\n\t\t\tif (joinSessionMatch === null) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst driveId = joinSessionMatch[3] || joinSessionMatch[5];\n\t\tconst itemId = joinSessionMatch[4];\n\n\t\treturn { siteUrl: `${url.origin}${url.pathname}`, driveId, itemId };\n\t} else {\n\t\tjoinSessionMatch = /(.*)\\/_api\\/v2.1\\/drives\\/([^/]*)\\/items\\/([^/]*)(.*)/.exec(pathname);\n\n\t\tif (joinSessionMatch === null) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst driveId = joinSessionMatch[2];\n\t\tconst itemId = joinSessionMatch[3];\n\n\t\treturn { siteUrl: `${url.origin}${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,IAAI,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,eAAiC;IACvE,OAAO,GAAG,eAAe,CAAC,gBAAgB,cAAc,CAAC;AAC1D,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryProperties, ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport {\n\tisOnline,\n\tOnlineStatus,\n\tRetryableError,\n\tNonRetryableError,\n\tNetworkErrorBasic,\n} from \"@fluidframework/driver-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tTelemetryDataTag,\n\tcreateChildLogger,\n\twrapError,\n} from \"@fluidframework/telemetry-utils\";\nimport {\n\tfetchIncorrectResponse,\n\tthrowOdspNetworkError,\n\tgetSPOAndGraphRequestIdsFromResponse,\n} from \"@fluidframework/odsp-doclib-utils\";\nimport {\n\tIOdspResolvedUrl,\n\tTokenFetchOptions,\n\tOdspErrorType,\n\ttokenFromResponse,\n\tisTokenFromCache,\n\tOdspResourceTokenFetchOptions,\n\tShareLinkTypes,\n\tISharingLinkKind,\n\tTokenFetcher,\n\tICacheEntry,\n\tsnapshotKey,\n\tInstrumentedStorageTokenFetcher,\n\tIOdspUrlParts,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { fetch } from \"./fetch\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { IOdspSnapshot } from \"./contracts\";\n\nexport const getWithRetryForTokenRefreshRepeat = \"getWithRetryForTokenRefreshRepeat\";\n\n/** Parse the given url and return the origin (host name) */\nexport const getOrigin = (url: string) => new URL(url).origin;\n\n/**\n * @public\n */\nexport interface IOdspResponse<T> {\n\tcontent: T;\n\theaders: Map<string, string>;\n\tpropsToLog: ITelemetryProperties;\n\tduration: number;\n}\n\nexport interface TokenFetchOptionsEx extends TokenFetchOptions {\n\t/** previous error we hit in getWithRetryForTokenRefresh */\n\tpreviousError?: any;\n}\n\nfunction headersToMap(headers: Headers) {\n\tconst newHeaders = new Map<string, string>();\n\tfor (const [key, value] of headers.entries()) {\n\t\tnewHeaders.set(key, value);\n\t}\n\treturn newHeaders;\n}\n\n/**\n * This API should be used with pretty much all network calls (fetch, webSocket connection) in order\n * to correctly handle expired tokens. It relies on callback fetching token, and be able to refetch\n * token on failure. Only specific cases get retry call with refresh = true, all other / unknown errors\n * simply propagate to caller\n */\nexport async function getWithRetryForTokenRefresh<T>(\n\tget: (options: TokenFetchOptionsEx) => Promise<T>,\n) {\n\treturn get({ refresh: false }).catch(async (e) => {\n\t\tconst options: TokenFetchOptionsEx = { refresh: true, previousError: e };\n\t\tswitch (e.errorType) {\n\t\t\t// If the error is 401 or 403 refresh the token and try once more.\n\t\t\tcase DriverErrorType.authorizationError:\n\t\t\t\treturn get({ ...options, claims: e.claims, tenantId: e.tenantId });\n\n\t\t\tcase DriverErrorType.incorrectServerResponse: // some error on the wire, retry once\n\t\t\tcase OdspErrorType.fetchTokenError: // If the token was null, then retry once.\n\t\t\t\treturn get(options);\n\n\t\t\tdefault:\n\t\t\t\t// Caller may determine that it wants one retry\n\t\t\t\tif (e[getWithRetryForTokenRefreshRepeat] === true) {\n\t\t\t\t\treturn get(options);\n\t\t\t\t}\n\t\t\t\tthrow e;\n\t\t}\n\t});\n}\n\nexport async function fetchHelper(\n\trequestInfo: RequestInfo,\n\trequestInit: RequestInit | undefined,\n): Promise<IOdspResponse<Response>> {\n\tconst start = performance.now();\n\n\t// Node-fetch and dom have conflicting typing, force them to work by casting for now\n\treturn fetch(requestInfo, requestInit).then(\n\t\tasync (fetchResponse) => {\n\t\t\tconst response = fetchResponse as any as Response;\n\t\t\t// Let's assume we can retry.\n\t\t\tif (!response) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t// pre-0.58 error message: No response from fetch call\n\t\t\t\t\t\"No response from ODSP fetch call\",\n\t\t\t\t\tDriverErrorType.incorrectServerResponse,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!response.ok || response.status < 200 || response.status >= 300) {\n\t\t\t\tthrowOdspNetworkError(\n\t\t\t\t\t// pre-0.58 error message prefix: odspFetchError\n\t\t\t\t\t`ODSP fetch error [${response.status}]`,\n\t\t\t\t\tresponse.status,\n\t\t\t\t\tresponse,\n\t\t\t\t\tawait response.text(),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst headers = headersToMap(response.headers);\n\t\t\treturn {\n\t\t\t\tcontent: response,\n\t\t\t\theaders,\n\t\t\t\tpropsToLog: getSPOAndGraphRequestIdsFromResponse(headers),\n\t\t\t\tduration: performance.now() - start,\n\t\t\t};\n\t\t},\n\t\t(error) => {\n\t\t\tconst online = isOnline();\n\n\t\t\t// The error message may not be suitable to log for privacy reasons, so tag it as such\n\t\t\tconst taggedErrorMessage = {\n\t\t\t\tvalue: `${error}`, // This uses toString for objects, which often results in `${error.name}: ${error.message}`\n\t\t\t\ttag: TelemetryDataTag.UserData,\n\t\t\t};\n\t\t\t// After redacting URLs we believe the error message is safe to log\n\t\t\tconst urlRegex = /((http|https):\\/\\/(\\S*))/i;\n\t\t\tconst redactedErrorText = taggedErrorMessage.value.replace(urlRegex, \"REDACTED_URL\");\n\n\t\t\t// This error is thrown by fetch() when AbortSignal is provided and it gets cancelled\n\t\t\tif (error.name === \"AbortError\") {\n\t\t\t\tthrow new RetryableError(\"Fetch Timeout (AbortError)\", OdspErrorType.fetchTimeout, {\n\t\t\t\t\tdriverVersion,\n\t\t\t\t});\n\t\t\t}\n\t\t\t// TCP/IP timeout\n\t\t\tif (redactedErrorText.includes(\"ETIMEDOUT\")) {\n\t\t\t\tthrow new RetryableError(\"Fetch Timeout (ETIMEDOUT)\", OdspErrorType.fetchTimeout, {\n\t\t\t\t\tdriverVersion,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// eslint-disable-next-line unicorn/prefer-ternary\n\t\t\tif (online === OnlineStatus.Offline) {\n\t\t\t\tthrow new RetryableError(\n\t\t\t\t\t// pre-0.58 error message prefix: Offline\n\t\t\t\t\t`ODSP fetch failure (Offline): ${redactedErrorText}`,\n\t\t\t\t\tDriverErrorType.offlineError,\n\t\t\t\t\t{\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t\trawErrorMessage: taggedErrorMessage,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\t// It is perhaps still possible that this is due to being offline, the error does not reveal enough\n\t\t\t\t// information to conclude. Could also be DNS errors, malformed fetch request, CSP violation, etc.\n\t\t\t\tthrow new RetryableError(\n\t\t\t\t\t// pre-0.58 error message prefix: Fetch error\n\t\t\t\t\t`ODSP fetch failure: ${redactedErrorText}`,\n\t\t\t\t\tDriverErrorType.fetchFailure,\n\t\t\t\t\t{\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t\trawErrorMessage: taggedErrorMessage,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t);\n}\n\n/**\n * A utility function to fetch and parse as JSON with support for retries\n * @param requestInfo - fetch requestInfo, can be a string\n * @param requestInit - fetch requestInit\n */\nexport async function fetchArray(\n\trequestInfo: RequestInfo,\n\trequestInit: RequestInit | undefined,\n): Promise<IOdspResponse<ArrayBuffer>> {\n\tconst { content, headers, propsToLog, duration } = await fetchHelper(requestInfo, requestInit);\n\tlet arrayBuffer: ArrayBuffer;\n\ttry {\n\t\tarrayBuffer = await content.arrayBuffer();\n\t} catch (e) {\n\t\t// Parsing can fail and message could contain full request URI, including\n\t\t// tokens, etc. So do not log error object itself.\n\t\tthrowOdspNetworkError(\n\t\t\t\"Error while parsing fetch response\",\n\t\t\tfetchIncorrectResponse,\n\t\t\tcontent, // response\n\t\t\tundefined, // response text\n\t\t\tpropsToLog,\n\t\t);\n\t}\n\n\tpropsToLog.bodySize = arrayBuffer.byteLength;\n\treturn {\n\t\theaders,\n\t\tcontent: arrayBuffer,\n\t\tpropsToLog,\n\t\tduration,\n\t};\n}\n\n/**\n * A utility function to fetch and parse as JSON with support for retries\n * @param requestInfo - fetch requestInfo, can be a string\n * @param requestInit - fetch requestInit\n */\nexport async function fetchAndParseAsJSONHelper<T>(\n\trequestInfo: RequestInfo,\n\trequestInit: RequestInit | undefined,\n): Promise<IOdspResponse<T>> {\n\tconst { content, headers, propsToLog, duration } = await fetchHelper(requestInfo, requestInit);\n\tlet text: string | undefined;\n\ttry {\n\t\ttext = await content.text();\n\t} catch (e) {\n\t\t// JSON.parse() can fail and message would container full request URI, including\n\t\t// tokens... It fails for me with \"Unexpected end of JSON input\" quite often - an attempt to download big file\n\t\t// (many ops) almost always ends up with this error - I'd guess 1% of op request end up here... It always\n\t\t// succeeds on retry.\n\t\t// So do not log error object itself.\n\t\tthrowOdspNetworkError(\n\t\t\t// pre-0.58 error message: errorWhileParsingFetchResponse\n\t\t\t\"Error while parsing fetch response\",\n\t\t\tfetchIncorrectResponse,\n\t\t\tcontent, // response\n\t\t\ttext,\n\t\t\tpropsToLog,\n\t\t);\n\t}\n\n\tpropsToLog.bodySize = text.length;\n\tconst res = {\n\t\theaders,\n\t\tcontent: JSON.parse(text),\n\t\tpropsToLog,\n\t\tduration,\n\t};\n\treturn res;\n}\n\nexport interface IFileInfoBase {\n\ttype: \"New\" | \"Existing\";\n\tsiteUrl: string;\n\tdriveId: string;\n}\n\nexport interface INewFileInfo extends IFileInfoBase {\n\ttype: \"New\";\n\tfilename: string;\n\tfilePath: string;\n\t/**\n\t * application can request creation of a share link along with the creation of a new file\n\t * by passing in an optional param to specify the kind of sharing link\n\t * (at the time of adding this comment Sept/2021), odsp only supports csl\n\t * ShareLinkTypes will deprecated in future. Use ISharingLinkKind instead which specifies both\n\t * share link type and the role type.\n\t */\n\tcreateLinkType?: ShareLinkTypes | ISharingLinkKind;\n}\n\nexport interface IExistingFileInfo extends IFileInfoBase {\n\ttype: \"Existing\";\n\titemId: string;\n}\n\nexport function isNewFileInfo(\n\tfileInfo: INewFileInfo | IExistingFileInfo,\n): fileInfo is INewFileInfo {\n\treturn fileInfo.type === undefined || fileInfo.type === \"New\";\n}\n\nexport function getOdspResolvedUrl(resolvedUrl: IResolvedUrl): IOdspResolvedUrl {\n\tassert(\n\t\t(resolvedUrl as IOdspResolvedUrl).odspResolvedUrl === true,\n\t\t0x1de /* \"Not an ODSP resolved url\" */,\n\t);\n\treturn resolvedUrl as IOdspResolvedUrl;\n}\n\nexport const createOdspLogger = (logger?: ITelemetryBaseLogger) =>\n\tcreateChildLogger({\n\t\tlogger,\n\t\tnamespace: \"OdspDriver\",\n\t\tproperties: {\n\t\t\tall: {\n\t\t\t\tdriverVersion,\n\t\t\t},\n\t\t},\n\t});\n\nexport function evalBlobsAndTrees(snapshot: IOdspSnapshot) {\n\tlet numTrees = 0;\n\tlet numBlobs = 0;\n\tlet encodedBlobsSize = 0;\n\tlet decodedBlobsSize = 0;\n\tfor (const tree of snapshot.trees) {\n\t\tfor (const treeEntry of tree.entries) {\n\t\t\tif (treeEntry.type === \"blob\") {\n\t\t\t\tnumBlobs++;\n\t\t\t} else if (treeEntry.type === \"tree\") {\n\t\t\t\tnumTrees++;\n\t\t\t}\n\t\t}\n\t}\n\tif (snapshot.blobs !== undefined) {\n\t\tfor (const blob of snapshot.blobs) {\n\t\t\tdecodedBlobsSize += blob.size;\n\t\t\tencodedBlobsSize += blob.content.length;\n\t\t}\n\t}\n\treturn { numTrees, numBlobs, encodedBlobsSize, decodedBlobsSize };\n}\n\nexport function toInstrumentedOdspTokenFetcher(\n\tlogger: ITelemetryLoggerExt,\n\tresolvedUrlParts: IOdspUrlParts,\n\ttokenFetcher: TokenFetcher<OdspResourceTokenFetchOptions>,\n\tthrowOnNullToken: boolean,\n): InstrumentedStorageTokenFetcher {\n\treturn async (\n\t\toptions: TokenFetchOptions,\n\t\tname: string,\n\t\talwaysRecordTokenFetchTelemetry: boolean = false,\n\t) => {\n\t\t// Telemetry note: if options.refresh is true, there is a potential perf issue:\n\t\t// Host should optimize and provide non-expired tokens on all critical paths.\n\t\t// Exceptions: race conditions around expiration, revoked tokens, host that does not care\n\t\t// (fluid-fetcher)\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: `${name}_GetToken`,\n\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\thasClaims: !!options.claims,\n\t\t\t\thasTenantId: !!options.tenantId,\n\t\t\t},\n\t\t\tasync (event) =>\n\t\t\t\ttokenFetcher({\n\t\t\t\t\t...options,\n\t\t\t\t\t...resolvedUrlParts,\n\t\t\t\t}).then(\n\t\t\t\t\t(tokenResponse) => {\n\t\t\t\t\t\tconst token = tokenFromResponse(tokenResponse);\n\t\t\t\t\t\t// This event alone generates so many events that is materially impacts cost of telemetry\n\t\t\t\t\t\t// Thus do not report end event when it comes back quickly.\n\t\t\t\t\t\t// Note that most of the hosts do not report if result is comming from cache or not,\n\t\t\t\t\t\t// so we can't rely on that here. But always record if specified explicitly for cases such as\n\t\t\t\t\t\t// calling trees/latest during load.\n\t\t\t\t\t\tif (alwaysRecordTokenFetchTelemetry || event.duration >= 32) {\n\t\t\t\t\t\t\tevent.end({\n\t\t\t\t\t\t\t\tfromCache: isTokenFromCache(tokenResponse),\n\t\t\t\t\t\t\t\tisNull: token === null,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (token === null && throwOnNullToken) {\n\t\t\t\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\t\t\t// pre-0.58 error message: Token is null for ${name} call\n\t\t\t\t\t\t\t\t`The Host-provided token fetcher returned null`,\n\t\t\t\t\t\t\t\tOdspErrorType.fetchTokenError,\n\t\t\t\t\t\t\t\t{ method: name, driverVersion },\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn token;\n\t\t\t\t\t},\n\t\t\t\t\t(error) => {\n\t\t\t\t\t\t// There is an important but unofficial contract here where token providers can set canRetry: true\n\t\t\t\t\t\t// to hook into the driver's retry logic (e.g. the retry loop when initiating a connection)\n\t\t\t\t\t\tconst rawCanRetry = error?.canRetry;\n\t\t\t\t\t\tconst tokenError = wrapError(\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t\t(errorMessage) =>\n\t\t\t\t\t\t\t\tnew NetworkErrorBasic(\n\t\t\t\t\t\t\t\t\t`The Host-provided token fetcher threw an error`,\n\t\t\t\t\t\t\t\t\tOdspErrorType.fetchTokenError,\n\t\t\t\t\t\t\t\t\ttypeof rawCanRetry === \"boolean\"\n\t\t\t\t\t\t\t\t\t\t? rawCanRetry\n\t\t\t\t\t\t\t\t\t\t: false /* canRetry */,\n\t\t\t\t\t\t\t\t\t{ method: name, errorMessage, driverVersion },\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthrow tokenError;\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t{ cancel: \"generic\" },\n\t\t);\n\t};\n}\n\nexport function createCacheSnapshotKey(odspResolvedUrl: IOdspResolvedUrl): ICacheEntry {\n\tconst cacheEntry: ICacheEntry = {\n\t\ttype: snapshotKey,\n\t\tkey: odspResolvedUrl.fileVersion ?? \"\",\n\t\tfile: {\n\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t},\n\t};\n\treturn cacheEntry;\n}\n\n// 80KB is the max body size that we can put in ump post body for server to be able to accept it.\n// Keeping it 78KB to be a little cautious. As per the telemetry 99p is less than 78KB.\nexport const maxUmpPostBodySize = 79872;\n\n/**\n * Build request parameters to request for the creation of a sharing link along with the creation of the file\n * through the /snapshot api call.\n * @param shareLinkType - Kind of sharing link requested\n * @returns A string of request parameters that can be concatenated with the base URI\n */\nexport function buildOdspShareLinkReqParams(\n\tshareLinkType: ShareLinkTypes | ISharingLinkKind | undefined,\n) {\n\tif (!shareLinkType) {\n\t\treturn;\n\t}\n\tconst scope = (shareLinkType as ISharingLinkKind).scope;\n\tif (!scope) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\treturn `createLinkType=${shareLinkType}`;\n\t}\n\tlet shareLinkRequestParams = `createLinkScope=${scope}`;\n\tconst role = (shareLinkType as ISharingLinkKind).role;\n\tshareLinkRequestParams = role\n\t\t? `${shareLinkRequestParams}&createLinkRole=${role}`\n\t\t: shareLinkRequestParams;\n\treturn shareLinkRequestParams;\n}\n\nexport function measure<T>(callback: () => T): [T, number] {\n\tconst start = performance.now();\n\tconst result = callback();\n\tconst time = performance.now() - start;\n\treturn [result, time];\n}\n\nexport async function measureP<T>(callback: () => Promise<T>): Promise<[T, number]> {\n\tconst start = performance.now();\n\tconst result = await callback();\n\tconst time = performance.now() - start;\n\treturn [result, time];\n}\n\nexport function getJoinSessionCacheKey(odspResolvedUrl: IOdspResolvedUrl) {\n\treturn `${odspResolvedUrl.hashedDocumentId}/joinsession`;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opsCaching.js","sourceRoot":"","sources":["../src/opsCaching.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAwB3D,MAAM,OAAO,QAAQ;IAIpB,YACC,sBAA8B,EACb,MAA2B,EAC3B,KAAa,EACb,SAAiB,EACjB,gBAAgB,EACzB,eAAe;QAJN,WAAM,GAAN,MAAM,CAAqB;QAC3B,UAAK,GAAL,KAAK,CAAQ;QACb,cAAS,GAAT,SAAS,CAAQ;QACjB,qBAAgB,GAAhB,gBAAgB,CAAA;QACzB,oBAAe,GAAf,eAAe,CAAA;QATP,YAAO,GAA+B,IAAI,GAAG,EAAE,CAAC;QAWhE;;;WAGG;QACH,MAAM,cAAc,GACnB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,uBAAuB,CAAC,sBAAsB,CAAC,GAAG,CAAC,CA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B;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAEO,uBAAuB,CAAC,cAAsB;QACrD,OAAO,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;IACxC,CAAC;IAEO,2BAA2B;QAClC,MAAM,SAAS,GAAe,EAAE,CAAC;QACjC,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,sCAAsC;QACzE,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\n\n// ISequencedDocumentMessage\nexport interface IMessage {\n\tsequenceNumber: number;\n}\n\nexport type CacheEntry = (IMessage | undefined)[];\n\nexport interface IBatch {\n\tremainingSlots: number;\n\tbatchData: CacheEntry;\n\t/**\n\t * Tells if this batch is dirty, i.e. it contains ops that were not flushed to cache\n\t */\n\tdirty: boolean;\n}\n\nexport interface ICache {\n\twrite(batchNumber: string, data: string): Promise<void>;\n\tread(batchNumber: string): Promise<string | undefined>;\n\tremove(): void;\n}\n\nexport class OpsCache {\n\tprivate readonly batches: Map<number, null | IBatch> = new Map();\n\tprivate timer: ReturnType<typeof setTimeout> | undefined;\n\n\tconstructor(\n\t\tstartingSequenceNumber: number,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly cache: ICache,\n\t\tprivate readonly batchSize: number,\n\t\tprivate readonly timerGranularity,\n\t\tprivate totalOpsToCache,\n\t) {\n\t\t/**\n\t\t * Initial batch is a special case because it will never be full - all ops prior (inclusive) to\n\t\t * `startingSequenceNumber` are never going to show up (undefined)\n\t\t */\n\t\tconst remainingSlots =\n\t\t\tthis.batchSize - this.getPositionInBatchArray(startingSequenceNumber) - 1;\n\t\tif (remainingSlots !== 0) {\n\t\t\tthis.batches.set(this.getBatchNumber(startingSequenceNumber), {\n\t\t\t\tremainingSlots,\n\t\t\t\tbatchData: this.initializeNewBatchDataArray(),\n\t\t\t\tdirty: false,\n\t\t\t});\n\t\t}\n\t}\n\n\tpublic dispose() {\n\t\tthis.batches.clear();\n\t\tif (this.timer !== undefined) {\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = undefined;\n\t\t}\n\t}\n\n\tpublic flushOps() {\n\t\tfor (const [key, value] of this.batches) {\n\t\t\t// Don't flush if the batch has no ops, already flushed or has empty slots at both beginning and end.\n\t\t\tif (\n\t\t\t\tvalue === null ||\n\t\t\t\t!value.dirty ||\n\t\t\t\tvalue.batchData.length === 0 ||\n\t\t\t\t(value.batchData[0] === undefined &&\n\t\t\t\t\tvalue.batchData[value.batchData.length - 1] === undefined)\n\t\t\t) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tvalue.dirty = false;\n\t\t\tthis.write(key, value);\n\t\t}\n\t}\n\n\tpublic addOps(ops: IMessage[]) {\n\t\tif (this.totalOpsToCache <= 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const op of ops) {\n\t\t\tconst batchNumber = this.getBatchNumber(op.sequenceNumber);\n\t\t\tconst positionInBatch = this.getPositionInBatchArray(op.sequenceNumber);\n\n\t\t\tlet currentBatch = this.batches.get(batchNumber);\n\n\t\t\tif (currentBatch === undefined) {\n\t\t\t\tcurrentBatch = {\n\t\t\t\t\tremainingSlots: this.batchSize - 1,\n\t\t\t\t\tbatchData: this.initializeNewBatchDataArray(),\n\t\t\t\t\tdirty: true,\n\t\t\t\t};\n\t\t\t\tcurrentBatch.batchData[positionInBatch] = op;\n\t\t\t\tthis.batches.set(batchNumber, currentBatch);\n\t\t\t} else if (\n\t\t\t\tcurrentBatch !== null &&\n\t\t\t\tcurrentBatch.batchData[positionInBatch] === undefined\n\t\t\t) {\n\t\t\t\tcurrentBatch.batchData[positionInBatch] = op;\n\t\t\t\tcurrentBatch.remainingSlots--;\n\t\t\t\tcurrentBatch.dirty = true;\n\t\t\t} else {\n\t\t\t\t// Either batch was flushed or this op was already there - nothing to do!\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (currentBatch.remainingSlots === 0) {\n\t\t\t\t// batch is full, flush to cache\n\t\t\t\tthis.write(batchNumber, currentBatch);\n\t\t\t\tthis.batches.set(batchNumber, null);\n\t\t\t} else {\n\t\t\t\tthis.scheduleTimer();\n\t\t\t}\n\n\t\t\tthis.totalOpsToCache--;\n\t\t\tif (this.totalOpsToCache === 0) {\n\t\t\t\tthis.logger.sendPerformanceEvent({ eventName: \"CacheOpsLimitHit\" });\n\t\t\t\tthis.cache.remove();\n\t\t\t\tthis.dispose();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves ops from cache\n\t * @param from - inclusive\n\t * @param to - exclusive\n\t * @returns ops retrieved\n\t */\n\tprivate async getCore(from: number, to?: number): Promise<IMessage[]> {\n\t\tconst messages: IMessage[] = [];\n\t\tlet batchNumber = this.getBatchNumber(from);\n\t\t// eslint-disable-next-line no-constant-condition\n\t\twhile (true) {\n\t\t\tconst res = await this.cache.read(`${this.batchSize}_${batchNumber}`);\n\t\t\tif (res === undefined) {\n\t\t\t\treturn messages;\n\t\t\t}\n\t\t\tconst result: CacheEntry = JSON.parse(res);\n\t\t\tconst prevMessagesLength = messages.length;\n\t\t\tfor (const op of result) {\n\t\t\t\t// Note that we write out undefined, but due to JSON.stringify, it turns into null!\n\t\t\t\tif (op) {\n\t\t\t\t\tif (to !== undefined && op.sequenceNumber >= to) {\n\t\t\t\t\t\treturn messages;\n\t\t\t\t\t}\n\t\t\t\t\tif (messages.length === 0) {\n\t\t\t\t\t\tif (op.sequenceNumber > from) {\n\t\t\t\t\t\t\treturn messages;\n\t\t\t\t\t\t} else if (op.sequenceNumber < from) {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tmessages.push(op);\n\t\t\t\t} else if (messages.length !== 0) {\n\t\t\t\t\t// If there is any gap, return the messages till now.\n\t\t\t\t\treturn messages;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we didn't get any op from this batch, then return messages till now. As it tells us that,\n\t\t\t// either the first message \"from\" is not present in cache or a gap will occur from 1 batch to next.\n\t\t\tif (prevMessagesLength === messages.length) {\n\t\t\t\treturn messages;\n\t\t\t}\n\t\t\tbatchNumber++;\n\t\t}\n\t}\n\n\t/**\n\t * Retrieves ops from cache\n\t * @param from - inclusive\n\t * @param to - exclusive\n\t * @returns ops retrieved\n\t */\n\tpublic async get(from: number, to?: number): Promise<IMessage[]> {\n\t\tconst start = performance.now();\n\n\t\tconst messages = await this.getCore(from, to);\n\n\t\tconst duration = performance.now() - start;\n\t\tif (messages.length > 0 || duration > 1000) {\n\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"CacheOpsUsed\",\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tlength: messages.length,\n\t\t\t\tduration,\n\t\t\t});\n\t\t}\n\t\treturn messages;\n\t}\n\n\tprotected write(batchNumber: number, payload: IBatch) {\n\t\t// Errors are caught and logged by PersistedCacheWithErrorHandling that sits\n\t\t// in the adapter chain of cache adapters\n\t\tthis.cache\n\t\t\t.write(`${this.batchSize}_${batchNumber}`, JSON.stringify(payload.batchData))\n\t\t\t.catch(() => {\n\t\t\t\tthis.totalOpsToCache = 0;\n\t\t\t});\n\t}\n\n\tprotected scheduleTimer() {\n\t\tif (!this.timer && this.timerGranularity > 0) {\n\t\t\tthis.timer = setTimeout(() => {\n\t\t\t\tthis.timer = undefined;\n\t\t\t\tthis.flushOps();\n\t\t\t}, this.timerGranularity);\n\t\t}\n\t}\n\n\tprivate getBatchNumber(sequenceNumber: number) {\n\t\treturn Math.floor(sequenceNumber / this.batchSize);\n\t}\n\n\tprivate getPositionInBatchArray(sequenceNumber: number) {\n\t\treturn sequenceNumber % this.batchSize;\n\t}\n\n\tprivate initializeNewBatchDataArray() {\n\t\tconst tempArray: IMessage[] = [];\n\t\ttempArray.length = this.batchSize; // fill with empty, undefined elements\n\t\treturn tempArray;\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"2.0.0-dev.7.3.0.210328\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prefetchLatestSnapshot.js","sourceRoot":"","sources":["../src/prefetchLatestSnapshot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAON,mBAAmB,GACnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EACN,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,8BAA8B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,gBAAgB,EAChB,uBAAuB,GAEvB,MAAM,iBAAiB,CAAC;AAKzB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC3C,WAAyB,EACzB,eAA4D,EAC5D,cAA+B,EAC/B,sCAA+C,EAC/C,MAA4B,EAC5B,wBAAsD,EACtD,u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AC,CAAC;YACvC,MAAM,GAAG,CAAC;QACX,CAAC,CAAC,CAAC;QACJ,OAAO,IAAI,CAAC;IACb,CAAC,CACD,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACvB,UAAU,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,6BAA6B,EAAE,EAAE,KAAK,CAAC,CAAC;QAC/E,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger } from \"@fluidframework/core-interfaces\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { assert, Deferred } from \"@fluidframework/core-utils\";\nimport { IResolvedUrl } from \"@fluidframework/driver-definitions\";\nimport {\n\tIOdspResolvedUrl,\n\tIPersistedCache,\n\tISnapshotOptions,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n\tIOdspUrlParts,\n\tgetKeyForCacheEntry,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { createChildLogger, PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n\tcreateCacheSnapshotKey,\n\tcreateOdspLogger,\n\tgetOdspResolvedUrl,\n\ttoInstrumentedOdspTokenFetcher,\n} from \"./odspUtils\";\nimport {\n\tdownloadSnapshot,\n\tfetchSnapshotWithRedeem,\n\tSnapshotFormatSupportType,\n} from \"./fetchSnapshot\";\nimport { IVersionedValueWithEpoch } from \"./contracts\";\nimport { IPrefetchSnapshotContents } from \"./odspCache\";\nimport { OdspDocumentServiceFactory } from \"./odspDocumentServiceFactory\";\n\n/**\n * Function to prefetch the snapshot and cached it in the persistant cache, so that when the container is loaded\n * the cached latest snapshot could be used and removes the network call from the critical path.\n *\n * @param resolvedUrl - Resolved url to fetch the snapshot.\n * @param getStorageToken - function that can provide the storage token for a given site. This is\n * is also referred to as the \"VROOM\" token in SPO.\n * @param persistedCache - Cache to store the fetched snapshot.\n * @param forceAccessTokenViaAuthorizationHeader - whether to force passing given token via authorization header.\n * @param logger - Logger to have telemetry events.\n * @param hostSnapshotFetchOptions - Options to fetch the snapshot if any. Otherwise default will be used.\n * @param enableRedeemFallback - True to have the sharing link redeem fallback in case the Trees Latest/Redeem\n * 1RT call fails with redeem error. During fallback it will first redeem the sharing link and then make\n * the Trees latest call.\n * Note: this can be considered deprecated - it will be replaced with `snapshotFormatFetchType`.\n * @param fetchBinarySnapshotFormat - Control if we want to fetch binary format snapshot.\n * @param snapshotFormatFetchType - Snapshot format to fetch.\n * @param odspDocumentServiceFactory - factory to access the non persistent cache and store the prefetch promise.\n *\n * @returns `true` if the snapshot is cached, `false` otherwise.\n *\n * @public\n */\nexport async function prefetchLatestSnapshot(\n\tresolvedUrl: IResolvedUrl,\n\tgetStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\tpersistedCache: IPersistedCache,\n\tforceAccessTokenViaAuthorizationHeader: boolean,\n\tlogger: ITelemetryBaseLogger,\n\thostSnapshotFetchOptions: ISnapshotOptions | undefined,\n\tenableRedeemFallback: boolean = true,\n\tfetchBinarySnapshotFormat?: boolean,\n\tsnapshotFormatFetchType?: SnapshotFormatSupportType,\n\todspDocumentServiceFactory?: OdspDocumentServiceFactory,\n): Promise<boolean> {\n\tconst odspLogger = createOdspLogger(\n\t\tcreateChildLogger({ logger, namespace: \"PrefetchSnapshot\" }),\n\t);\n\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\n\tconst resolvedUrlData: IOdspUrlParts = {\n\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\tdriveId: odspResolvedUrl.driveId,\n\t\titemId: odspResolvedUrl.itemId,\n\t};\n\tconst storageTokenFetcher = toInstrumentedOdspTokenFetcher(\n\t\todspLogger,\n\t\tresolvedUrlData,\n\t\tgetStorageToken,\n\t\ttrue /* throwOnNullToken */,\n\t);\n\n\tconst snapshotDownloader = async (\n\t\tfinalOdspResolvedUrl: IOdspResolvedUrl,\n\t\tstorageToken: string,\n\t\tsnapshotOptions: ISnapshotOptions | undefined,\n\t\tcontroller?: AbortController,\n\t) => {\n\t\treturn downloadSnapshot(\n\t\t\tfinalOdspResolvedUrl,\n\t\t\tstorageToken,\n\t\t\todspLogger,\n\t\t\tsnapshotOptions,\n\t\t\tundefined,\n\t\t\tcontroller,\n\t\t);\n\t};\n\tconst snapshotKey = createCacheSnapshotKey(odspResolvedUrl);\n\tlet cacheP: Promise<void> | undefined;\n\tlet snapshotEpoch: string | undefined;\n\tconst putInCache = async (valueWithEpoch: IVersionedValueWithEpoch) => {\n\t\tsnapshotEpoch = valueWithEpoch.fluidEpoch;\n\t\tcacheP = persistedCache.put(snapshotKey, valueWithEpoch);\n\t\treturn cacheP;\n\t};\n\tconst removeEntries = async () => persistedCache.removeEntries(snapshotKey.file);\n\treturn PerformanceEvent.timedExecAsync(\n\t\todspLogger,\n\t\t{ eventName: \"PrefetchLatestSnapshot\" },\n\t\tasync () => {\n\t\t\tconst prefetchStartTime = performance.now();\n\t\t\t// Add the deferred promise to the cache, so that it can be leveraged while loading the container.\n\t\t\tconst snapshotContentsWithEpochP = new Deferred<IPrefetchSnapshotContents>();\n\t\t\tconst nonPersistentCacheKey = getKeyForCacheEntry(snapshotKey);\n\t\t\tconst snapshotNonPersistentCache =\n\t\t\t\todspDocumentServiceFactory?.snapshotPrefetchResultCache;\n\t\t\tsnapshotNonPersistentCache?.add(\n\t\t\t\tnonPersistentCacheKey,\n\t\t\t\tasync () => snapshotContentsWithEpochP.promise,\n\t\t\t);\n\t\t\tawait fetchSnapshotWithRedeem(\n\t\t\t\todspResolvedUrl,\n\t\t\t\tstorageTokenFetcher,\n\t\t\t\thostSnapshotFetchOptions,\n\t\t\t\tforceAccessTokenViaAuthorizationHeader,\n\t\t\t\todspLogger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t\tputInCache,\n\t\t\t\tremoveEntries,\n\t\t\t\tenableRedeemFallback,\n\t\t\t)\n\t\t\t\t.then(async (value) => {\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!snapshotEpoch,\n\t\t\t\t\t\t0x585 /* prefetched snapshot should have a valid epoch */,\n\t\t\t\t\t);\n\t\t\t\t\tsnapshotContentsWithEpochP.resolve({\n\t\t\t\t\t\t...value,\n\t\t\t\t\t\tfluidEpoch: snapshotEpoch,\n\t\t\t\t\t\tprefetchStartTime,\n\t\t\t\t\t});\n\t\t\t\t\tassert(cacheP !== undefined, 0x1e7 /* \"caching was not performed!\" */);\n\t\t\t\t\tawait cacheP;\n\t\t\t\t\t// Schedule it to remove from cache after 5s.\n\t\t\t\t\t// 1. While it's in snapshotNonPersistentCache: Load flow will use this value and will not attempt\n\t\t\t\t\t// to fetch snapshot from network again. That's the best from perf POV, but cache will not be\n\t\t\t\t\t// updated if we keep it in this cache, thus we want to eventually remove snapshot from this cache.\n\t\t\t\t\t// 2. After it's removed from snapshotNonPersistentCache: snapshot is present in persistent cache,\n\t\t\t\t\t// so we sill still use it (in accordance with cache policy controlled by host). But load flow will\n\t\t\t\t\t// also fetch snapshot (in parallel) from storage and update cache. This is fine long term,\n\t\t\t\t\t// but is an extra cost (unneeded network call). However since it is 5s older, new network call\n\t\t\t\t\t// will update the snapshot in cache.\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tsnapshotNonPersistentCache?.remove(nonPersistentCacheKey);\n\t\t\t\t\t}, 5000);\n\t\t\t\t})\n\t\t\t\t.catch((err) => {\n\t\t\t\t\t// Remove it from the non persistent cache if an error occured.\n\t\t\t\t\tsnapshotNonPersistentCache?.remove(nonPersistentCacheKey);\n\t\t\t\t\tsnapshotContentsWithEpochP.reject(err);\n\t\t\t\t\tthrow err;\n\t\t\t\t});\n\t\t\treturn true;\n\t\t},\n\t).catch(async (error) => {\n\t\todspLogger.sendErrorEvent({ eventName: \"PrefetchLatestSnapshotError\" }, error);\n\t\treturn false;\n\t});\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"retryError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AAS,EACT,KAAK,EACL,YAAY,EACZ,WAAW,CACX,EACF,qBAAqB,CACrB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,wBAAwB,CACpC,OAAqB,EACrB,OAAwB;QAExB,4DAA4D;QAC5D,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,EAClF,kCAAkC,CAClC,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAClD,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,EAC/D,yBAAyB,CACzB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,EACxD,oBAAoB,CACpB,CAAC;IACH,CAAC;IAEO,oBAAoB;QAC3B,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,4DAA4D;YAC5D,MAAM,IAAI,YAAY,CAAC,2CAA2C,EAAE;gBACnE,QAAQ,EAAE,KAAK;aACf,CAAC,CAAC;SACH;IACF,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACpE,OAAO,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACpF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LoggingError, ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { IDisposable } from \"@fluidframework/core-interfaces\";\nimport { runWithRetry } from \"./retryUtils\";\n\nexport class RetryErrorsStorageAdapter implements IDocumentStorageService, IDisposable {\n\tprivate _disposed = false;\n\tconstructor(\n\t\tprivate readonly internalStorageService: IDocumentStorageService,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this.internalStorageService.policies;\n\t}\n\tpublic get disposed() {\n\t\treturn this._disposed;\n\t}\n\tpublic dispose() {\n\t\tthis._disposed = true;\n\t}\n\n\tpublic get repositoryUrl(): string {\n\t\treturn this.internalStorageService.repositoryUrl;\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.getSnapshotTree(version),\n\t\t\t\"storage_getSnapshotTree\",\n\t\t);\n\t}\n\n\tpublic async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.readBlob(id),\n\t\t\t\"storage_readBlob\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () =>\n\t\t\t\tthis.internalStorageService.getVersions(\n\t\t\t\t\tversionId,\n\t\t\t\t\tcount,\n\t\t\t\t\tscenarioName,\n\t\t\t\t\tfetchSource,\n\t\t\t\t),\n\t\t\t\"storage_getVersions\",\n\t\t);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\t// Creation flow with attachment blobs - need to do retries!\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.uploadSummaryWithContext(summary, context),\n\t\t\t\"storage_uploadSummaryWithContext\",\n\t\t);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.downloadSummary(handle),\n\t\t\t\"storage_downloadSummary\",\n\t\t);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalStorageService.createBlob(file),\n\t\t\t\"storage_createBlob\",\n\t\t);\n\t}\n\n\tprivate checkStorageDisposed() {\n\t\tif (this._disposed) {\n\t\t\t// pre-0.58 error message: storageServiceDisposedCannotRetry\n\t\t\tthrow new LoggingError(\"Storage Service is disposed. Cannot retry\", {\n\t\t\t\tcanRetry: false,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(api, callName, this.logger, () => this.checkStorageDisposed());\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"retryUtils.js","sourceRoot":"","sources":["../src/retryUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,GAAqB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D,MAAM,KAAK,CAAC;aACZ;YAED,+EAA+E;YAC/E,oFAAoF;YACpF,uEAAuE;YACvE,IAAI,QAAQ,KAAK,CAAC,EAAE;gBACnB,MAAM,CAAC,cAAc,CACpB;oBACC,SAAS,EAAE,cAAc;wBACxB,CAAC,CAAC,8BAA8B;wBAChC,CAAC,CAAC,oCAAoC;oBACvC,QAAQ;oBACR,QAAQ;oBACR,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,0BAA0B;iBAC/D,EACD,KAAK,CACL,CAAC;gBACF,aAAa;gBACb,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;gBACvB,MAAM,KAAK,CAAC;aACZ;YAED,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC;YACzD,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;YACpC,UAAU,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YACrD,SAAS,GAAG,KAAK,CAAC;SAClB;KACD;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { delay } from \"@fluidframework/core-utils\";\nimport { canRetryOnError, getRetryDelayFromError } from \"@fluidframework/driver-utils\";\nimport { OdspErrorType } from \"@fluidframework/odsp-driver-definitions\";\nimport { Odsp409Error } from \"./epochTracker\";\n\n/**\n * This method retries only for retriable coherency and service read only errors.\n */\nexport async function runWithRetry<T>(\n\tapi: () => Promise<T>,\n\tcallName: string,\n\tlogger: ITelemetryLoggerExt,\n\tcheckDisposed?: () => void,\n): Promise<T> {\n\tlet retryAfter = 1000;\n\tconst start = performance.now();\n\tlet lastError: any;\n\tfor (let attempts = 1; ; attempts++) {\n\t\tif (checkDisposed !== undefined) {\n\t\t\tcheckDisposed();\n\t\t}\n\t\ttry {\n\t\t\tconst result = await api();\n\t\t\tif (attempts > 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"MultipleRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performance.now() - start,\n\t\t\t\t\t},\n\t\t\t\t\tlastError,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn result;\n\t\t} catch (error: any) {\n\t\t\tconst canRetry = canRetryOnError(error);\n\n\t\t\tconst coherencyError = error?.[Odsp409Error] === true;\n\t\t\tconst serviceReadonlyError = error?.errorType === OdspErrorType.serviceReadOnly;\n\n\t\t\t// logging the first failed retry instead of every attempt. We want to avoid filling telemetry\n\t\t\t// when we have tight loop of retrying in offline mode, but we also want to know what caused\n\t\t\t// the failure in the first place\n\t\t\tif (attempts === 1) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${callName}_firstFailed`,\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performance.now() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Retry for retriable 409 coherency errors or serviceReadOnly errors. These errors are always retriable\n\t\t\t// unless someone specifically set canRetry = false on the error like in fetchSnapshot() flow. So in\n\t\t\t// that case don't retry.\n\t\t\tif (!((coherencyError || serviceReadonlyError) && canRetry)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\t// SPO itself does number of retries internally before returning 409 to client.\n\t\t\t// That multiplied to 5 suggests need to reconsider current design, as client spends\n\t\t\t// too much time / bandwidth doing the same thing without any progress.\n\t\t\tif (attempts === 5) {\n\t\t\t\tlogger.sendErrorEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: coherencyError\n\t\t\t\t\t\t\t? \"CoherencyErrorTooManyRetries\"\n\t\t\t\t\t\t\t: \"ServiceReadonlyErrorTooManyRetries\",\n\t\t\t\t\t\tcallName,\n\t\t\t\t\t\tattempts,\n\t\t\t\t\t\tduration: performance.now() - start, // record total wait time.\n\t\t\t\t\t},\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t\t// Fail hard.\n\t\t\t\terror.canRetry = false;\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tretryAfter = getRetryDelayFromError(error) ?? retryAfter;\n\t\t\tawait delay(Math.floor(retryAfter));\n\t\t\tretryAfter += (retryAfter / 4) * (1 + Math.random());\n\t\t\tlastError = error;\n\t\t}\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"socketModule.js","sourceRoot":"","sources":["../src/socketModule.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { io } from \"socket.io-client\";\n\nexport const SocketIOClientStatic = io;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"zipItDataRepresentationUtils.js","sourceRoot":"","sources":["../src/zipItDataRepresentationUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAA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gBAAgB;QAChB,aAAa;KACb,CACD,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAgB;IACpC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC9B,OAAO,QAAQ,CAAC;KAChB;SAAM,IAAI,KAAK,YAAY,QAAQ,EAAE;QACrC,OAAO,UAAU,CAAC;KAClB;SAAM,IAAI,KAAK,YAAY,QAAQ,EAAE;QACrC,OAAO,UAAU,CAAC;KAClB;SAAM,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE;QACtC,OAAO,SAAS,CAAC;KACjB;SAAM,IAAI,KAAK,CAAC,cAAc,EAAE;QAChC,OAAO,QAAQ,CAAC;KAChB;IACD,OAAO,aAAa,CAAC;AACtB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Data representation which is followed(zipIt Protocol) here is described in this document:\n * https://microsoft.sharepoint-df.com/:w:/t/ODSPFileStore/ER06b64K_XdDjEyAKl-UT60BJiId39SCVkYSyo_2pvH9gQ?e=KYQ0c5\n */\n\nimport { Uint8ArrayToArrayBuffer, Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { NonRetryableError } from \"@fluidframework/driver-utils\";\nimport { DriverErrorType } from \"@fluidframework/driver-definitions\";\nimport { ReadBuffer } from \"./ReadBufferUtils\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { measure } from \"./odspUtils\";\n\n// https://onedrive.visualstudio.com/SharePoint%20Online/_git/SPO?path=/cobalt/Base/Property/BinaryEncodedPropertyReader.cs&version=GBmaster&_a=contents\n/**\n * Control codes used by tree serialization / decentralization code. Same as on server. These can be found on\n * filestore code on server too at above link.\n */\nexport enum MarkerCodes {\n\tBoolTrue = 11, // value = true\n\tBoolFalse = 12, // value = false\n\n\tStringEmpty = 13, // value = \"\"\n\tString8Length = 14, // unsigned-8-bit little-endian length, follows by UTF-8 bytes of length\n\tString16Length = 15, // unsigned-16-bit little-endian length, follows by UTF-8 bytes of length\n\tString32Length = 16, // unsigned-32-bit little-endian length, follows by UTF-8 bytes of length\n\n\tConstString8Id = 17, // unsigned-8-bit little-endian const string id follows\n\tConstString16Id = 18, // unsigned-16-bit little-endian const string id follows\n\tConstString32Id = 19, // unsigned-32-bit little-endian const string id follows\n\tConstStringDeclare = 20, // Code for declaring a const string with size <= 1 byte\n\tConstStringDeclareBig = 21, // Code for declaring a const string with size > 1 byte. It is represented in 4 bytes.\n\n\tInt0 = 1, // value = 0\n\tUInt8 = 3, // unsigned-8-bit little-endian follows\n\tUInt16 = 5, // unsigned-16-bit little-endian follows\n\tUInt32 = 7, // unsigned-32-bit little-endian follows\n\tUInt64 = 9, // unsigned-64-bit little-endian follows\n\tInt8 = 2, // signed-8-bit little-endian follows\n\tInt16 = 4, // signed-16-bit little-endian follows\n\tInt32 = 6, // signed-32-bit little-endian follows\n\tInt64 = 8, // signed-64-bit little-endian follows\n\n\tBinaryEmpty = 32, // value = byte[]\n\tBinarySingle8 = 33, // unsigned-8-bit little-endian length, follows by bytes of length\n\tBinarySingle16 = 34, // unsigned-16-bit little-endian length, follows by bytes of length\n\tBinarySingle32 = 35, // unsigned-32-bit little-endian length, follows by bytes of length\n\tBinarySingle64 = 36, // unsigned-64-bit little-endian length, follows by bytes of length\n}\n\n/**\n * Control codes used by tree serialization / decentralization code. They mark the start of sections.\n */\nexport enum MarkerCodesStart {\n\t\"list\" = 49,\n\t\"set\" = 51,\n}\n\n/**\n * Control codes used by tree serialization / decentralization code. They mark the end of sections.\n */\nexport enum MarkerCodesEnd {\n\t\"list\" = 50,\n\t\"set\" = 52,\n}\n\n/**\n * This contains mapping of Marker Codes to number of bytes in which the corresponding data\n * will be stored.\n */\nexport const codeToBytesMap = {\n\t// Integer code to bytes\n\t1: 0,\n\t2: 1,\n\t3: 1,\n\t4: 2,\n\t5: 2,\n\t6: 4,\n\t7: 4,\n\t8: 8,\n\t9: 8,\n\n\t// String code to Bytes\n\t13: 0,\n\t14: 1,\n\t15: 2,\n\t16: 4,\n\n\t17: 1,\n\t18: 2,\n\t19: 4,\n\n\t20: 1,\n\t21: 4,\n\n\t// Binary code to bytes\n\t32: 0,\n\t33: 1,\n\t34: 2,\n\t35: 4,\n\t36: 8,\n};\n\nexport function getValueSafely(map: { [index: number]: number }, key: number) {\n\tconst val = map[key];\n\tassert(val !== undefined, 0x287 /* key must exist in the map */);\n\treturn val;\n}\n\nexport function getNodeProps(node: NodeCore) {\n\tconst res: Record<string, NodeTypes> = {};\n\tfor (const [keyNode, valueNode] of node.iteratePairs()) {\n\t\tconst id = getStringInstance(keyNode, \"keynode should be a string\");\n\t\tres[id] = valueNode;\n\t}\n\treturn res;\n}\n\nexport function iteratePairs<T>(it: IterableIterator<T>) {\n\tconst res: IterableIterator<[T, T]> = {\n\t\tnext: () => {\n\t\t\tconst a = it.next();\n\t\t\tif (a.done) {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t\tconst b = it.next();\n\t\t\tassert(b.done !== true, 0x22b /* \"Should be a pair\" */);\n\t\t\treturn { value: [a.value, b.value], done: b.done };\n\t\t},\n\t\t[Symbol.iterator]: () => {\n\t\t\treturn res;\n\t\t},\n\t};\n\treturn res;\n}\n\n/**\n * Helper function that returns iterator from an object\n * @param obj - object that supports iteration\n */\nexport function iterate<T>(obj: { [Symbol.iterator]: () => IterableIterator<T> }) {\n\treturn obj[Symbol.iterator]();\n}\n\n/**\n * Base class to represent binary blob element.\n * Binary blob is one of three types supported as a leaf node of a tree.\n * Note: concrete implementations (derived classes) are not exposed from this module\n */\nexport abstract class BlobCore {\n\tpublic abstract get buffer(): Uint8Array;\n\tpublic abstract get arrayBuffer(): ArrayBufferLike;\n\n\t/**\n\t * Represents a blob.\n\t */\n\tconstructor() {}\n}\n\n/**\n * \"deep copy\" blob, holds to binary data passed in\n * It is called deep copy as a counter-part to BlobShallowCopy, which\n * is a reference to underlying binary stream (ReadBuffer).\n */\nclass BlobDeepCopy extends BlobCore {\n\t/**\n\t * Represents a deep copy of the blob.\n\t * @param data - Data array of the blob\n\t */\n\tconstructor(protected readonly data: Uint8Array) {\n\t\tsuper();\n\t}\n\n\tpublic get buffer() {\n\t\treturn this.data;\n\t}\n\n\tpublic get arrayBuffer(): ArrayBufferLike {\n\t\treturn Uint8ArrayToArrayBuffer(this.buffer);\n\t}\n\n\tpublic static read(buffer: ReadBuffer, lengthLen: number): BlobCore {\n\t\tconst length = buffer.read(lengthLen);\n\t\tconst data = new Uint8Array(length);\n\t\tfor (let counter = 0; counter < length; counter++) {\n\t\t\tdata[counter] = buffer.read();\n\t\t}\n\t\treturn new BlobDeepCopy(data);\n\t}\n}\n\n/**\n * Shallow copy blob, keeps a reference to portion of ReadBuffer\n * it was constructed from. It takes much less memory compared to BlobDeepCopy\n */\nexport class BlobShallowCopy extends BlobCore {\n\t/**\n\t * Represents a shallow copy of the blob. It is not a separate blob, just reference to original blobs.\n\t * @param data - Data array of the blob\n\t * @param start - Start point of the blob in the buffer.\n\t * @param end - End point of the blob in the buffer.\n\t */\n\tconstructor(\n\t\tprotected data: Uint8Array,\n\t\tprotected start: number,\n\t\tprotected end: number,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic get buffer() {\n\t\treturn this.data.subarray(this.start, this.end);\n\t}\n\n\t// Equivalent to Uint8ArrayToArrayBuffer(this.buffer)\n\tpublic get arrayBuffer(): ArrayBufferLike {\n\t\tconst offset = this.data.byteOffset;\n\t\treturn this.data.buffer.slice(this.start + offset, this.end + offset);\n\t}\n\n\tpublic static read(buffer: ReadBuffer, lengthLen: number): BlobCore {\n\t\tconst length = buffer.read(lengthLen);\n\t\tconst pos = buffer.pos;\n\t\tbuffer.skip(length);\n\t\treturn new BlobShallowCopy(buffer.buffer, pos, pos + length);\n\t}\n}\n\nexport const addStringProperty = (node: NodeCore, a: string, b: string) => {\n\tnode.addDictionaryString(a);\n\tnode.addString(b);\n};\nexport const addDictionaryStringProperty = (node: NodeCore, a: string, b: string) => {\n\tnode.addDictionaryString(a);\n\tnode.addString(b);\n};\nexport const addNumberProperty = (node: NodeCore, a: string, b: number) => {\n\tnode.addDictionaryString(a);\n\tnode.addNumber(b);\n};\nexport const addBoolProperty = (node: NodeCore, a: string, b: boolean) => {\n\tnode.addDictionaryString(a);\n\tnode.addBool(b);\n};\n\nexport interface IStringElement {\n\tcontent: string;\n\tdictionary: boolean;\n\t_stringElement: true;\n}\n\nexport interface IStringElementInternal extends Omit<IStringElement, \"content\"> {\n\tcontent?: string;\n\tstartPos: number;\n\tendPos: number;\n}\n\n/**\n * Three leaf types supported by tree:\n * 1. Node (sub-tree)\n * 2. binary blob\n * 3. integer\n * 4. boolean\n */\nexport type NodeTypes = NodeCore | BlobCore | number | boolean | IStringElement;\n\nexport type NodeCoreTypes = \"list\" | \"set\";\n\n/**\n * Node - node in the tree (non-leaf element of the tree)\n */\nexport class NodeCore {\n\t// It is an array of nodes.\n\tprivate readonly children: NodeTypes[] = [];\n\tpublic get nodes() {\n\t\treturn this.children;\n\t}\n\n\tconstructor(public type: NodeCoreTypes = \"set\") {}\n\n\tpublic [Symbol.iterator]() {\n\t\treturn this.children[Symbol.iterator]();\n\t}\n\n\tpublic iteratePairs() {\n\t\tassert(this.length % 2 === 0, 0x22c /* \"reading pairs\" */);\n\t\treturn iteratePairs(iterate(this));\n\t}\n\n\tpublic get length() {\n\t\treturn this.children.length;\n\t}\n\n\tpublic get(index: number) {\n\t\treturn this.children[index];\n\t}\n\n\tpublic getString(index: number): string {\n\t\tconst node = this.children[index];\n\t\treturn getStringInstance(node, \"getString should return string\");\n\t}\n\n\tpublic getMaybeString(index: number) {\n\t\tconst node = this.children[index];\n\t\treturn getMaybeStringInstance(node);\n\t}\n\n\tpublic getBlob(index: number): BlobCore {\n\t\tconst node = this.children[index];\n\t\tassertBlobCoreInstance(node, \"getBlob should return a blob\");\n\t\treturn node;\n\t}\n\n\tpublic getNode(index: number): NodeCore {\n\t\tconst node = this.children[index];\n\t\tassertNodeCoreInstance(node, \"getNode should return a node\");\n\t\treturn node;\n\t}\n\n\tpublic getNumber(index: number): number {\n\t\tconst node = this.children[index];\n\t\tassertNumberInstance(node, \"getNumber should return a number\");\n\t\treturn node;\n\t}\n\n\tpublic getBool(index: number): boolean {\n\t\tconst node = this.children[index];\n\t\tassertBoolInstance(node, \"getBool should return a boolean\");\n\t\treturn node;\n\t}\n\n\tpublic addNode(type?: NodeCoreTypes): NodeCore {\n\t\tconst node = new NodeCore(type);\n\t\tthis.children.push(node);\n\t\treturn node;\n\t}\n\n\tpublic addBlob(blob: Uint8Array) {\n\t\tthis.children.push(new BlobDeepCopy(blob));\n\t}\n\n\tpublic addDictionaryString(payload: string) {\n\t\tthis.children.push({\n\t\t\tcontent: payload,\n\t\t\tdictionary: true,\n\t\t\t_stringElement: true,\n\t\t});\n\t}\n\n\tpublic addString(payload: string) {\n\t\tthis.children.push({\n\t\t\tcontent: payload,\n\t\t\tdictionary: false,\n\t\t\t_stringElement: true,\n\t\t});\n\t}\n\n\tpublic addNumber(payload: number | undefined) {\n\t\tassert(Number.isInteger(payload), 0x231 /* \"Number should be an integer\" */);\n\t\tassert(payload !== undefined && payload >= 0, 0x232 /* \"Payload should not be negative\" */);\n\t\tthis.children.push(payload);\n\t}\n\n\tpublic addBool(payload: boolean) {\n\t\tthis.children.push(payload);\n\t}\n\n\t// Can we do more efficiently here, without extra objects somehow??\n\tprivate static readString(buffer: ReadBuffer, code: number, dictionary: boolean) {\n\t\tconst lengthLen = getValueSafely(codeToBytesMap, code);\n\t\tconst length = buffer.read(lengthLen);\n\t\tconst startPos = buffer.pos;\n\t\tbuffer.skip(length);\n\t\tconst result: IStringElementInternal = {\n\t\t\t// Note: Setting here property 'content: undefined' makes code substantially slower!\n\t\t\tdictionary,\n\t\t\t_stringElement: true,\n\t\t\tstartPos,\n\t\t\tendPos: buffer.pos,\n\t\t};\n\n\t\t// We are lying here in terms of presence of `content` property.\n\t\t// This will be addressed at the bottom of NodeCore.load() by resolving all strings at once!\n\t\t// It's equivalent (but much slower!) to do it here via\n\t\t// result.content = Uint8ArrayToString(buffer.buffer.subarray(startPos, buffer.pos), \"utf-8\");\n\t\treturn result as IStringElementInternal & IStringElement;\n\t}\n\n\t/**\n\t * Load and parse the buffer into a tree.\n\t * @param buffer - buffer to read from.\n\t */\n\tprotected load(buffer: ReadBuffer, logger: ITelemetryLoggerExt) {\n\t\tconst [stringsToResolve, durationStructure] = measure(() =>\n\t\t\tthis.loadStructure(buffer, logger),\n\t\t);\n\t\tconst [, durationStrings] = measure(() =>\n\t\t\tthis.loadStrings(buffer, stringsToResolve, logger),\n\t\t);\n\t\treturn { durationStructure, durationStrings };\n\t}\n\n\t/**\n\t * Load and parse the buffer into a tree.\n\t * @param buffer - buffer to read from.\n\t */\n\tprotected loadStructure(buffer: ReadBuffer, logger: ITelemetryLoggerExt) {\n\t\tconst stack: NodeTypes[][] = [];\n\t\tconst stringsToResolve: IStringElementInternal[] = [];\n\t\tconst dictionary: IStringElement[] = [];\n\n\t\tlet children = this.children;\n\t\tfor (; !buffer.eof; ) {\n\t\t\tconst code = buffer.read();\n\t\t\tswitch (code) {\n\t\t\t\tcase MarkerCodesStart.list:\n\t\t\t\tcase MarkerCodesStart.set: {\n\t\t\t\t\tconst childValue = new NodeCore(code === MarkerCodesStart.set ? \"set\" : \"list\");\n\t\t\t\t\tchildren.push(childValue);\n\t\t\t\t\tstack.push(children);\n\t\t\t\t\tchildren = childValue.children;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.ConstStringDeclare:\n\t\t\t\tcase MarkerCodes.ConstStringDeclareBig: {\n\t\t\t\t\tconst stringId = buffer.read(getValueSafely(codeToBytesMap, code));\n\t\t\t\t\tconst constString = NodeCore.readString(buffer, code, true /* dictionary */);\n\t\t\t\t\tstringsToResolve.push(constString);\n\t\t\t\t\tdictionary[stringId] = constString;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.ConstString8Id:\n\t\t\t\tcase MarkerCodes.ConstString16Id:\n\t\t\t\tcase MarkerCodes.ConstString32Id: {\n\t\t\t\t\tconst stringId = buffer.read(getValueSafely(codeToBytesMap, code));\n\t\t\t\t\tconst content = dictionary[stringId];\n\t\t\t\t\tassert(content !== undefined, 0x3de /* const string not found */);\n\t\t\t\t\tchildren.push(content);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.StringEmpty:\n\t\t\t\tcase MarkerCodes.String8Length:\n\t\t\t\tcase MarkerCodes.String16Length:\n\t\t\t\tcase MarkerCodes.String32Length: {\n\t\t\t\t\tconst str = NodeCore.readString(buffer, code, false /* dictionary */);\n\t\t\t\t\tstringsToResolve.push(str);\n\t\t\t\t\tchildren.push(str);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.BinaryEmpty:\n\t\t\t\tcase MarkerCodes.BinarySingle8:\n\t\t\t\tcase MarkerCodes.BinarySingle16:\n\t\t\t\tcase MarkerCodes.BinarySingle32:\n\t\t\t\tcase MarkerCodes.BinarySingle64: {\n\t\t\t\t\tchildren.push(\n\t\t\t\t\t\tBlobShallowCopy.read(buffer, getValueSafely(codeToBytesMap, code)),\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// If integer is 0.\n\t\t\t\tcase MarkerCodes.Int0: {\n\t\t\t\t\tchildren.push(0);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.UInt8:\n\t\t\t\tcase MarkerCodes.UInt16:\n\t\t\t\tcase MarkerCodes.UInt32:\n\t\t\t\tcase MarkerCodes.UInt64:\n\t\t\t\tcase MarkerCodes.Int8:\n\t\t\t\tcase MarkerCodes.Int16:\n\t\t\t\tcase MarkerCodes.Int32:\n\t\t\t\tcase MarkerCodes.Int64: {\n\t\t\t\t\tchildren.push(buffer.read(getValueSafely(codeToBytesMap, code)));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tcase MarkerCodes.BoolTrue:\n\t\t\t\t\tchildren.push(true);\n\t\t\t\t\tcontinue;\n\t\t\t\tcase MarkerCodes.BoolFalse:\n\t\t\t\t\tchildren.push(false);\n\t\t\t\t\tcontinue;\n\t\t\t\tcase MarkerCodesEnd.list:\n\t\t\t\tcase MarkerCodesEnd.set:\n\t\t\t\t\t// Note: We are not checking that end marker matches start marker.\n\t\t\t\t\t// I.e. that we do not have a case where we start a 'list' but end with a 'set'\n\t\t\t\t\t// Checking it would require more state tracking that seems not very useful, given\n\t\t\t\t\t// our code does not care.\n\t\t\t\t\tchildren = stack.pop()!;\n\n\t\t\t\t\t// To my surprise, checking children !== undefined adds measurable cost!\n\t\t\t\t\t// We will rely on children.push() crashing in case of mismatch, and check below\n\t\t\t\t\t// (outside of the loop)\n\t\t\t\t\tcontinue;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Invalid code: ${code}`);\n\t\t\t}\n\t\t}\n\n\t\t// This also ensures that stack.length === 0.\n\t\tassert(children === this.children, 0x3e7 /* Unpaired start/end list/set markers! */);\n\n\t\treturn stringsToResolve;\n\t}\n\n\tprivate loadStrings(\n\t\tbuffer: ReadBuffer,\n\t\tstringsToResolve: IStringElementInternal[],\n\t\tlogger: ITelemetryLoggerExt,\n\t) {\n\t\t/**\n\t\t * Process all the strings at once!\n\t\t */\n\t\tlet length = 0;\n\t\tfor (const el of stringsToResolve) {\n\t\t\tlength += el.endPos - el.startPos + 1;\n\t\t}\n\t\tconst stringBuffer = new Uint8Array(length);\n\n\t\tlength = 0;\n\t\tconst input = buffer.buffer;\n\t\tassert(input.byteOffset === 0, 0x3e8 /* code below assumes no offset */);\n\n\t\tfor (const el of stringsToResolve) {\n\t\t\tfor (let it = el.startPos; it < el.endPos; it++) {\n\t\t\t\tstringBuffer[length] = input[it];\n\t\t\t\tlength++;\n\t\t\t}\n\t\t\tstringBuffer[length] = 0;\n\t\t\tlength++;\n\t\t}\n\t\tassert(length === stringBuffer.length, 0x418 /* properly encoded */);\n\n\t\tconst result = Uint8ArrayToString(stringBuffer, \"utf-8\").split(String.fromCharCode(0));\n\t\tif (result.length === stringsToResolve.length + 1) {\n\t\t\t// All is good, we expect all the cases to get here\n\t\t\tfor (let i = 0; i < stringsToResolve.length; i++) {\n\t\t\t\tstringsToResolve[i].content = result[i];\n\t\t\t}\n\t\t} else {\n\t\t\t// String content has \\0 chars!\n\t\t\t// Recovery code\n\t\t\tlogger.sendErrorEvent({ eventName: \"StringParsingError\" });\n\t\t\tfor (const el of stringsToResolve) {\n\t\t\t\tassert(\n\t\t\t\t\tel.content ===\n\t\t\t\t\t\tUint8ArrayToString(input.subarray(el.startPos, el.endPos), \"utf-8\"),\n\t\t\t\t\t0x3ea /* test */,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * TreeBuilder - Root of the tree.\n * Provides loading and serialization capabilities.\n */\nexport class TreeBuilder extends NodeCore {\n\tstatic load(buffer: ReadBuffer, logger: ITelemetryLoggerExt) {\n\t\tconst builder = new TreeBuilder();\n\t\tconst telemetryProps = builder.load(buffer, logger);\n\t\tassert(buffer.eof, 0x233 /* \"Unexpected data at the end of buffer\" */);\n\t\treturn { builder, telemetryProps };\n\t}\n}\n\nexport function getMaybeStringInstance(node: NodeTypes): string | undefined {\n\tconst maybeString = node as IStringElement;\n\tif (maybeString._stringElement) {\n\t\treturn maybeString.content;\n\t}\n}\n\nexport function getStringInstance(node: NodeTypes, message: string): string {\n\tconst maybeString = node as IStringElement;\n\tif (maybeString._stringElement) {\n\t\treturn maybeString.content;\n\t}\n\tthrowBufferParseException(node, \"BlobCore\", message);\n}\n\nexport function assertBlobCoreInstance(node: NodeTypes, message: string): asserts node is BlobCore {\n\tif (node instanceof BlobCore) {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"BlobCore\", message);\n}\n\nexport function assertNodeCoreInstance(node: NodeTypes, message: string): asserts node is NodeCore {\n\tif (node instanceof NodeCore) {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"NodeCore\", message);\n}\n\nexport function assertNumberInstance(node: NodeTypes, message: string): asserts node is number {\n\tif (typeof node === \"number\") {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"Number\", message);\n}\n\nexport function assertBoolInstance(node: NodeTypes, message: string): asserts node is boolean {\n\tif (typeof node === \"boolean\") {\n\t\treturn;\n\t}\n\tthrowBufferParseException(node, \"Boolean\", message);\n}\n\nfunction throwBufferParseException(\n\tnode: NodeTypes,\n\texpectedNodeType: NodeType,\n\tmessage: string,\n): never {\n\tthrow new NonRetryableError(\n\t\t`Buffer parsing exception: ${message}`,\n\t\tDriverErrorType.incorrectServerResponse,\n\t\t{\n\t\t\tnodeType: getNodeType(node),\n\t\t\texpectedNodeType,\n\t\t\tdriverVersion,\n\t\t},\n\t);\n}\n\nfunction getNodeType(value: NodeTypes): NodeType {\n\tif (typeof value === \"number\") {\n\t\treturn \"Number\";\n\t} else if (value instanceof BlobCore) {\n\t\treturn \"BlobCore\";\n\t} else if (value instanceof NodeCore) {\n\t\treturn \"NodeCore\";\n\t} else if (typeof value === \"boolean\") {\n\t\treturn \"Boolean\";\n\t} else if (value._stringElement) {\n\t\treturn \"String\";\n\t}\n\treturn \"UnknownType\";\n}\n\ntype NodeType = \"Number\" | \"BlobCore\" | \"NodeCore\" | \"Boolean\" | \"UnknownType\" | \"String\";\n"]}
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./lib",
5
- "module": "esnext",
6
- },
7
- }