@fluidframework/routerlicious-driver 2.0.0-internal.7.2.2 → 2.0.0-internal.7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -2
  3. package/api-extractor-lint.json +13 -0
  4. package/api-extractor.json +3 -3
  5. package/api-report/routerlicious-driver.api.md +10 -10
  6. package/dist/{cache.js → cache.cjs} +2 -2
  7. package/dist/cache.cjs.map +1 -0
  8. package/dist/{policies.js → contracts.cjs} +1 -1
  9. package/dist/contracts.cjs.map +1 -0
  10. package/dist/{createNewUtils.js → createNewUtils.cjs} +1 -1
  11. package/dist/createNewUtils.cjs.map +1 -0
  12. package/dist/{defaultTokenProvider.js → defaultTokenProvider.cjs} +2 -1
  13. package/dist/defaultTokenProvider.cjs.map +1 -0
  14. package/dist/defaultTokenProvider.d.ts +1 -0
  15. package/dist/defaultTokenProvider.d.ts.map +1 -1
  16. package/dist/{definitions.js → definitions.cjs} +1 -1
  17. package/dist/definitions.cjs.map +1 -0
  18. package/dist/{deltaStorageService.js → deltaStorageService.cjs} +1 -1
  19. package/dist/deltaStorageService.cjs.map +1 -0
  20. package/dist/{documentDeltaConnection.js → documentDeltaConnection.cjs} +3 -3
  21. package/dist/documentDeltaConnection.cjs.map +1 -0
  22. package/dist/{documentService.js → documentService.cjs} +9 -9
  23. package/dist/documentService.cjs.map +1 -0
  24. package/dist/{documentServiceFactory.js → documentServiceFactory.cjs} +8 -6
  25. package/{lib/documentServiceFactory.js.map → dist/documentServiceFactory.cjs.map} +1 -1
  26. package/dist/documentServiceFactory.d.ts +2 -0
  27. package/dist/documentServiceFactory.d.ts.map +1 -1
  28. package/dist/{documentStorageService.js → documentStorageService.cjs} +3 -3
  29. package/dist/documentStorageService.cjs.map +1 -0
  30. package/dist/{errorUtils.js → errorUtils.cjs} +4 -2
  31. package/dist/errorUtils.cjs.map +1 -0
  32. package/dist/errorUtils.d.ts +12 -0
  33. package/dist/errorUtils.d.ts.map +1 -1
  34. package/dist/{gitManager.js → gitManager.cjs} +1 -1
  35. package/dist/gitManager.cjs.map +1 -0
  36. package/dist/{historian.js → historian.cjs} +1 -1
  37. package/{lib/historian.js.map → dist/historian.cjs.map} +1 -1
  38. package/dist/{index.js → index.cjs} +4 -4
  39. package/dist/index.cjs.map +1 -0
  40. package/dist/{mapWithExpiration.js → mapWithExpiration.cjs} +1 -1
  41. package/dist/mapWithExpiration.cjs.map +1 -0
  42. package/dist/{nullBlobStorageService.js → nullBlobStorageService.cjs} +1 -1
  43. package/dist/nullBlobStorageService.cjs.map +1 -0
  44. package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
  45. package/dist/packageVersion.cjs.map +1 -0
  46. package/dist/packageVersion.d.ts +1 -1
  47. package/dist/{contracts.js → policies.cjs} +1 -1
  48. package/dist/policies.cjs.map +1 -0
  49. package/dist/policies.d.ts +3 -0
  50. package/dist/policies.d.ts.map +1 -1
  51. package/dist/{r11sSnapshotParser.js → r11sSnapshotParser.cjs} +1 -1
  52. package/dist/r11sSnapshotParser.cjs.map +1 -0
  53. package/dist/{restWrapper.js → restWrapper.cjs} +4 -4
  54. package/dist/restWrapper.cjs.map +1 -0
  55. package/dist/{restWrapperBase.js → restWrapperBase.cjs} +1 -1
  56. package/dist/restWrapperBase.cjs.map +1 -0
  57. package/dist/{retriableGitManager.js → retriableGitManager.cjs} +1 -1
  58. package/dist/retriableGitManager.cjs.map +1 -0
  59. package/dist/routerlicious-driver-alpha.d.ts +92 -0
  60. package/dist/routerlicious-driver-beta.d.ts +35 -0
  61. package/dist/routerlicious-driver-public.d.ts +35 -0
  62. package/dist/routerlicious-driver-untrimmed.d.ts +268 -0
  63. package/dist/{shreddedSummaryDocumentStorageService.js → shreddedSummaryDocumentStorageService.cjs} +4 -4
  64. package/dist/shreddedSummaryDocumentStorageService.cjs.map +1 -0
  65. package/dist/{storageContracts.js → storageContracts.cjs} +1 -1
  66. package/dist/storageContracts.cjs.map +1 -0
  67. package/dist/{summaryTreeUploadManager.js → summaryTreeUploadManager.cjs} +1 -1
  68. package/dist/summaryTreeUploadManager.cjs.map +1 -0
  69. package/dist/{tokens.js → tokens.cjs} +1 -1
  70. package/dist/tokens.cjs.map +1 -0
  71. package/dist/tokens.d.ts +5 -0
  72. package/dist/tokens.d.ts.map +1 -1
  73. package/dist/{treeUtils.js → treeUtils.cjs} +1 -1
  74. package/dist/treeUtils.cjs.map +1 -0
  75. package/dist/tsdoc-metadata.json +1 -1
  76. package/dist/{urlUtils.js → urlUtils.cjs} +1 -1
  77. package/dist/urlUtils.cjs.map +1 -0
  78. package/dist/{wholeSummaryDocumentStorageService.js → wholeSummaryDocumentStorageService.cjs} +5 -5
  79. package/dist/wholeSummaryDocumentStorageService.cjs.map +1 -0
  80. package/dist/{wholeSummaryUploadManager.js → wholeSummaryUploadManager.cjs} +1 -1
  81. package/dist/wholeSummaryUploadManager.cjs.map +1 -0
  82. package/lib/{cache.js → cache.mjs} +2 -2
  83. package/lib/cache.mjs.map +1 -0
  84. package/lib/contracts.d.ts.map +1 -1
  85. package/lib/{policies.js → contracts.mjs} +1 -1
  86. package/{dist/contracts.js.map → lib/contracts.mjs.map} +1 -1
  87. package/lib/createNewUtils.d.ts.map +1 -1
  88. package/lib/{createNewUtils.js → createNewUtils.mjs} +1 -1
  89. package/lib/createNewUtils.mjs.map +1 -0
  90. package/lib/defaultTokenProvider.d.ts +2 -1
  91. package/lib/defaultTokenProvider.d.ts.map +1 -1
  92. package/lib/{defaultTokenProvider.js → defaultTokenProvider.mjs} +2 -1
  93. package/lib/defaultTokenProvider.mjs.map +1 -0
  94. package/lib/definitions.d.ts.map +1 -1
  95. package/lib/{definitions.js → definitions.mjs} +1 -1
  96. package/{dist/definitions.js.map → lib/definitions.mjs.map} +1 -1
  97. package/lib/deltaStorageService.d.ts +2 -2
  98. package/lib/deltaStorageService.d.ts.map +1 -1
  99. package/lib/{deltaStorageService.js → deltaStorageService.mjs} +1 -1
  100. package/lib/deltaStorageService.mjs.map +1 -0
  101. package/lib/documentDeltaConnection.d.ts.map +1 -1
  102. package/lib/{documentDeltaConnection.js → documentDeltaConnection.mjs} +3 -3
  103. package/lib/documentDeltaConnection.mjs.map +1 -0
  104. package/lib/documentService.d.ts +6 -6
  105. package/lib/documentService.d.ts.map +1 -1
  106. package/lib/{documentService.js → documentService.mjs} +9 -9
  107. package/lib/documentService.mjs.map +1 -0
  108. package/lib/documentServiceFactory.d.ts +4 -2
  109. package/lib/documentServiceFactory.d.ts.map +1 -1
  110. package/lib/{documentServiceFactory.js → documentServiceFactory.mjs} +8 -6
  111. package/lib/documentServiceFactory.mjs.map +1 -0
  112. package/lib/documentStorageService.d.ts +5 -5
  113. package/lib/documentStorageService.d.ts.map +1 -1
  114. package/lib/{documentStorageService.js → documentStorageService.mjs} +3 -3
  115. package/lib/documentStorageService.mjs.map +1 -0
  116. package/lib/errorUtils.d.ts +12 -0
  117. package/lib/errorUtils.d.ts.map +1 -1
  118. package/lib/{errorUtils.js → errorUtils.mjs} +4 -2
  119. package/lib/errorUtils.mjs.map +1 -0
  120. package/lib/gitManager.d.ts +3 -3
  121. package/lib/gitManager.d.ts.map +1 -1
  122. package/lib/{gitManager.js → gitManager.mjs} +1 -1
  123. package/lib/gitManager.mjs.map +1 -0
  124. package/lib/historian.d.ts +4 -4
  125. package/lib/historian.d.ts.map +1 -1
  126. package/lib/{historian.js → historian.mjs} +1 -1
  127. package/lib/historian.mjs.map +1 -0
  128. package/lib/index.d.ts +5 -5
  129. package/lib/index.d.ts.map +1 -1
  130. package/lib/{index.js → index.mjs} +4 -7
  131. package/lib/index.mjs.map +1 -0
  132. package/lib/{mapWithExpiration.js → mapWithExpiration.mjs} +1 -1
  133. package/lib/mapWithExpiration.mjs.map +1 -0
  134. package/lib/nullBlobStorageService.d.ts.map +1 -1
  135. package/lib/{nullBlobStorageService.js → nullBlobStorageService.mjs} +1 -1
  136. package/lib/nullBlobStorageService.mjs.map +1 -0
  137. package/lib/packageVersion.d.ts +1 -1
  138. package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
  139. package/lib/packageVersion.mjs.map +1 -0
  140. package/lib/policies.d.ts +3 -0
  141. package/lib/policies.d.ts.map +1 -1
  142. package/lib/{contracts.js → policies.mjs} +1 -1
  143. package/lib/policies.mjs.map +1 -0
  144. package/lib/r11sSnapshotParser.d.ts +1 -1
  145. package/lib/r11sSnapshotParser.d.ts.map +1 -1
  146. package/lib/{r11sSnapshotParser.js → r11sSnapshotParser.mjs} +1 -1
  147. package/lib/r11sSnapshotParser.mjs.map +1 -0
  148. package/lib/restWrapper.d.ts +2 -2
  149. package/lib/restWrapper.d.ts.map +1 -1
  150. package/lib/{restWrapper.js → restWrapper.mjs} +4 -4
  151. package/lib/restWrapper.mjs.map +1 -0
  152. package/lib/restWrapperBase.d.ts +1 -1
  153. package/lib/restWrapperBase.d.ts.map +1 -1
  154. package/lib/{restWrapperBase.js → restWrapperBase.mjs} +1 -1
  155. package/lib/restWrapperBase.mjs.map +1 -0
  156. package/lib/retriableGitManager.d.ts +3 -3
  157. package/lib/retriableGitManager.d.ts.map +1 -1
  158. package/lib/{retriableGitManager.js → retriableGitManager.mjs} +1 -1
  159. package/lib/retriableGitManager.mjs.map +1 -0
  160. package/lib/routerlicious-driver-alpha.d.ts +92 -0
  161. package/lib/routerlicious-driver-beta.d.ts +35 -0
  162. package/lib/routerlicious-driver-public.d.ts +35 -0
  163. package/lib/routerlicious-driver-untrimmed.d.ts +268 -0
  164. package/lib/shreddedSummaryDocumentStorageService.d.ts +4 -4
  165. package/lib/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
  166. package/lib/{shreddedSummaryDocumentStorageService.js → shreddedSummaryDocumentStorageService.mjs} +4 -4
  167. package/lib/shreddedSummaryDocumentStorageService.mjs.map +1 -0
  168. package/lib/storageContracts.d.ts +2 -2
  169. package/lib/storageContracts.d.ts.map +1 -1
  170. package/lib/{storageContracts.js → storageContracts.mjs} +1 -1
  171. package/{dist/storageContracts.js.map → lib/storageContracts.mjs.map} +1 -1
  172. package/lib/summaryTreeUploadManager.d.ts +1 -1
  173. package/lib/summaryTreeUploadManager.d.ts.map +1 -1
  174. package/lib/{summaryTreeUploadManager.js → summaryTreeUploadManager.mjs} +1 -1
  175. package/lib/summaryTreeUploadManager.mjs.map +1 -0
  176. package/lib/tokens.d.ts +5 -0
  177. package/lib/tokens.d.ts.map +1 -1
  178. package/lib/{tokens.js → tokens.mjs} +1 -1
  179. package/lib/tokens.mjs.map +1 -0
  180. package/lib/treeUtils.d.ts +1 -1
  181. package/lib/treeUtils.d.ts.map +1 -1
  182. package/lib/{treeUtils.js → treeUtils.mjs} +1 -1
  183. package/lib/treeUtils.mjs.map +1 -0
  184. package/lib/urlUtils.d.ts.map +1 -1
  185. package/lib/{urlUtils.js → urlUtils.mjs} +1 -1
  186. package/lib/urlUtils.mjs.map +1 -0
  187. package/lib/wholeSummaryDocumentStorageService.d.ts +4 -4
  188. package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  189. package/lib/{wholeSummaryDocumentStorageService.js → wholeSummaryDocumentStorageService.mjs} +5 -5
  190. package/lib/wholeSummaryDocumentStorageService.mjs.map +1 -0
  191. package/lib/wholeSummaryUploadManager.d.ts +1 -1
  192. package/lib/wholeSummaryUploadManager.d.ts.map +1 -1
  193. package/lib/{wholeSummaryUploadManager.js → wholeSummaryUploadManager.mjs} +1 -1
  194. package/lib/wholeSummaryUploadManager.mjs.map +1 -0
  195. package/package.json +46 -26
  196. package/src/defaultTokenProvider.ts +1 -0
  197. package/src/documentServiceFactory.ts +2 -0
  198. package/src/errorUtils.ts +5 -0
  199. package/src/packageVersion.ts +1 -1
  200. package/src/policies.ts +3 -0
  201. package/src/tokens.ts +5 -0
  202. package/tsc-multi.test.json +4 -0
  203. package/tsconfig.json +5 -4
  204. package/dist/cache.js.map +0 -1
  205. package/dist/createNewUtils.js.map +0 -1
  206. package/dist/defaultTokenProvider.js.map +0 -1
  207. package/dist/deltaStorageService.js.map +0 -1
  208. package/dist/documentDeltaConnection.js.map +0 -1
  209. package/dist/documentService.js.map +0 -1
  210. package/dist/documentServiceFactory.js.map +0 -1
  211. package/dist/documentStorageService.js.map +0 -1
  212. package/dist/errorUtils.js.map +0 -1
  213. package/dist/gitManager.js.map +0 -1
  214. package/dist/historian.js.map +0 -1
  215. package/dist/index.js.map +0 -1
  216. package/dist/mapWithExpiration.js.map +0 -1
  217. package/dist/nullBlobStorageService.js.map +0 -1
  218. package/dist/packageVersion.js.map +0 -1
  219. package/dist/policies.js.map +0 -1
  220. package/dist/r11sSnapshotParser.js.map +0 -1
  221. package/dist/restWrapper.js.map +0 -1
  222. package/dist/restWrapperBase.js.map +0 -1
  223. package/dist/retriableGitManager.js.map +0 -1
  224. package/dist/shreddedSummaryDocumentStorageService.js.map +0 -1
  225. package/dist/summaryTreeUploadManager.js.map +0 -1
  226. package/dist/tokens.js.map +0 -1
  227. package/dist/treeUtils.js.map +0 -1
  228. package/dist/urlUtils.js.map +0 -1
  229. package/dist/wholeSummaryDocumentStorageService.js.map +0 -1
  230. package/dist/wholeSummaryUploadManager.js.map +0 -1
  231. package/lib/cache.js.map +0 -1
  232. package/lib/contracts.js.map +0 -1
  233. package/lib/createNewUtils.js.map +0 -1
  234. package/lib/defaultTokenProvider.js.map +0 -1
  235. package/lib/definitions.js.map +0 -1
  236. package/lib/deltaStorageService.js.map +0 -1
  237. package/lib/documentDeltaConnection.js.map +0 -1
  238. package/lib/documentService.js.map +0 -1
  239. package/lib/documentStorageService.js.map +0 -1
  240. package/lib/errorUtils.js.map +0 -1
  241. package/lib/gitManager.js.map +0 -1
  242. package/lib/index.js.map +0 -1
  243. package/lib/mapWithExpiration.js.map +0 -1
  244. package/lib/nullBlobStorageService.js.map +0 -1
  245. package/lib/packageVersion.js.map +0 -1
  246. package/lib/policies.js.map +0 -1
  247. package/lib/r11sSnapshotParser.js.map +0 -1
  248. package/lib/restWrapper.js.map +0 -1
  249. package/lib/restWrapperBase.js.map +0 -1
  250. package/lib/retriableGitManager.js.map +0 -1
  251. package/lib/shreddedSummaryDocumentStorageService.js.map +0 -1
  252. package/lib/storageContracts.js.map +0 -1
  253. package/lib/summaryTreeUploadManager.js.map +0 -1
  254. package/lib/tokens.js.map +0 -1
  255. package/lib/treeUtils.js.map +0 -1
  256. package/lib/urlUtils.js.map +0 -1
  257. package/lib/wholeSummaryDocumentStorageService.js.map +0 -1
  258. package/lib/wholeSummaryUploadManager.js.map +0 -1
  259. package/tsconfig.esnext.json +0 -7
@@ -7,10 +7,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.errorObjectFromSocketError = exports.throwR11sNetworkError = exports.createR11sNetworkError = exports.RouterliciousErrorType = exports.RouterliciousErrorTypes = void 0;
8
8
  const driver_definitions_1 = require("@fluidframework/driver-definitions");
9
9
  const driver_utils_1 = require("@fluidframework/driver-utils");
10
- const packageVersion_1 = require("./packageVersion");
10
+ const packageVersion_1 = require("./packageVersion.cjs");
11
11
  /**
12
12
  * Routerlicious Error types
13
13
  * Different error types that may be thrown by the routerlicious driver
14
+ * @internal
14
15
  */
15
16
  exports.RouterliciousErrorTypes = {
16
17
  // Inherit base driver error types
@@ -25,6 +26,7 @@ exports.RouterliciousErrorTypes = {
25
26
  * Different error types that may be thrown by the routerlicious driver
26
27
  *
27
28
  * @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.
29
+ * @internal
28
30
  */
29
31
  var RouterliciousErrorType;
30
32
  (function (RouterliciousErrorType) {
@@ -82,4 +84,4 @@ function errorObjectFromSocketError(socketError, handler) {
82
84
  return createR11sNetworkError(message, socketError.code, socketError.retryAfterMs);
83
85
  }
84
86
  exports.errorObjectFromSocketError = errorObjectFromSocketError;
85
- //# sourceMappingURL=errorUtils.js.map
87
+ //# sourceMappingURL=errorUtils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorUtils.cjs","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],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AAS,EAAE,YAAY,EAAE,CAAC;YACzE,KAAK,GAAG,IAAA,wCAAyB,EAAC,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAClE,MAAM;KACP;IACD,KAAK,CAAC,sBAAsB,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC;AACd,CAAC;AApCD,wDAoCC;AAED,SAAgB,qBAAqB,CACpC,YAAoB,EACpB,UAAkB,EAClB,YAAqB;IAErB,MAAM,YAAY,GAAG,sBAAsB,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAEpF,+DAA+D;IAC/D,MAAM,YAAY,CAAC;AACpB,CAAC;AATD,sDASC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CACzC,WAA6B,EAC7B,OAAe;IAEf,iDAAiD;IACjD,MAAM,OAAO,GAAG,sBAAsB,OAAO,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;IACzE,OAAO,sBAAsB,CAAC,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;AACpF,CAAC;AAPD,gEAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDriverError,\n\tIDriverErrorBase,\n\tDriverErrorTypes,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tNonRetryableError,\n\tGenericNetworkError,\n\tcreateGenericNetworkError,\n\tAuthorizationError,\n} from \"@fluidframework/driver-utils\";\nimport { IFluidErrorBase } from \"@fluidframework/telemetry-utils\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\n\n/**\n * Routerlicious Error types\n * Different error types that may be thrown by the routerlicious driver\n * @internal\n */\nexport const RouterliciousErrorTypes = {\n\t// Inherit base driver error types\n\t...DriverErrorTypes,\n\n\t/**\n\t * SSL Certificate Error.\n\t */\n\tsslCertError: \"sslCertError\",\n} as const;\n/**\n * @internal\n */\nexport type RouterliciousErrorTypes =\n\t(typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];\n\n/**\n * Routerlicious Error types\n * Different error types that may be thrown by the routerlicious driver\n *\n * @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.\n * @internal\n */\nexport enum RouterliciousErrorType {\n\t/**\n\t * File not found, or file deleted during session\n\t */\n\tfileNotFoundOrAccessDeniedError = \"fileNotFoundOrAccessDeniedError\",\n\n\t/**\n\t * SSL Certificate Error.\n\t */\n\tsslCertError = \"sslCertError\",\n}\n\n/**\n * Interface for error responses for the WebSocket connection\n * Intended to be compatible with output from {@link NetworkError.toJSON}\n */\nexport interface IR11sSocketError {\n\t/**\n\t * An error code number for the error that occurred.\n\t * It will be a valid HTTP status code.\n\t */\n\tcode: number;\n\n\t/**\n\t * A message about the error that occurred for debugging / logging purposes.\n\t * This should not be displayed to the user directly.\n\t */\n\tmessage: string;\n\n\t/**\n\t * Optional Retry-After time in seconds.\n\t * The client should wait this many seconds before retrying its request.\n\t */\n\tretryAfter?: number;\n\n\t/**\n\t * Optional Retry-After time in milliseconds.\n\t * The client should wait this many milliseconds before retrying its request.\n\t */\n\tretryAfterMs?: number;\n}\n\nexport interface IR11sError extends Omit<IDriverErrorBase, \"errorType\"> {\n\treadonly errorType: RouterliciousErrorType;\n}\n\nexport type R11sError = DriverError | IR11sError;\n\nexport function createR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n): IFluidErrorBase & R11sError {\n\tlet error: IFluidErrorBase & R11sError;\n\tconst props = { statusCode, driverVersion };\n\tswitch (statusCode) {\n\t\tcase 401:\n\t\t// The first 401 is manually retried in RouterliciousRestWrapper with a refreshed token,\n\t\t// so we treat repeat 401s the same as 403.\n\t\tcase 403:\n\t\t\terror = new AuthorizationError(errorMessage, undefined, undefined, props);\n\t\t\tbreak;\n\t\tcase 404:\n\t\t\tconst errorType = RouterliciousErrorType.fileNotFoundOrAccessDeniedError;\n\t\t\terror = new NonRetryableError(errorMessage, errorType, props);\n\t\t\tbreak;\n\t\tcase 429:\n\t\t\terror = createGenericNetworkError(\n\t\t\t\terrorMessage,\n\t\t\t\t{ canRetry: true, retryAfterMs },\n\t\t\t\tprops,\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 500:\n\t\tcase 502:\n\t\t\terror = new GenericNetworkError(errorMessage, true, props);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconst retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };\n\t\t\terror = createGenericNetworkError(errorMessage, retryInfo, props);\n\t\t\tbreak;\n\t}\n\terror.addTelemetryProperties({ endpointReached: true });\n\treturn error;\n}\n\nexport function throwR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n): never {\n\tconst networkError = createR11sNetworkError(errorMessage, statusCode, retryAfterMs);\n\n\t// eslint-disable-next-line @typescript-eslint/no-throw-literal\n\tthrow networkError;\n}\n\n/**\n * Returns network error based on error object from R11s socket (IR11sSocketError)\n */\nexport function errorObjectFromSocketError(\n\tsocketError: IR11sSocketError,\n\thandler: string,\n): R11sError {\n\t// pre-0.58 error message prefix: R11sSocketError\n\tconst message = `R11s socket error (${handler}): ${socketError.message}`;\n\treturn createR11sNetworkError(message, socketError.code, socketError.retryAfterMs);\n}\n"]}
@@ -7,6 +7,7 @@ import { IFluidErrorBase } from "@fluidframework/telemetry-utils";
7
7
  /**
8
8
  * Routerlicious Error types
9
9
  * Different error types that may be thrown by the routerlicious driver
10
+ * @internal
10
11
  */
11
12
  export declare const RouterliciousErrorTypes: {
12
13
  /**
@@ -17,6 +18,13 @@ export declare const RouterliciousErrorTypes: {
17
18
  readonly authorizationError: "authorizationError";
18
19
  readonly fileNotFoundOrAccessDeniedError: "fileNotFoundOrAccessDeniedError";
19
20
  readonly offlineError: "offlineError";
21
+ /**
22
+ * Routerlicious Error types
23
+ * Different error types that may be thrown by the routerlicious driver
24
+ *
25
+ * @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.
26
+ * @internal
27
+ */
20
28
  readonly unsupportedClientProtocolVersion: "unsupportedClientProtocolVersion";
21
29
  readonly writeError: "writeError";
22
30
  readonly fetchFailure: "fetchFailure";
@@ -32,12 +40,16 @@ export declare const RouterliciousErrorTypes: {
32
40
  readonly throttlingError: "throttlingError";
33
41
  readonly usageError: "usageError";
34
42
  };
43
+ /**
44
+ * @internal
45
+ */
35
46
  export type RouterliciousErrorTypes = (typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];
36
47
  /**
37
48
  * Routerlicious Error types
38
49
  * Different error types that may be thrown by the routerlicious driver
39
50
  *
40
51
  * @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.
52
+ * @internal
41
53
  */
42
54
  export declare enum RouterliciousErrorType {
43
55
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"errorUtils.d.ts","sourceRoot":"","sources":["../src/errorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,gBAAgB,EAEhB,MAAM,oCAAoC,CAAC;AAO5C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGlE;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IAInC;;OAEG;;;;;;;;;;;;;;;;;;;;CAEM,CAAC;AACX,MAAM,MAAM,uBAAuB,GAClC,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;GAKG;AACH,oBAAY,sBAAsB;IACjC;;OAEG;IACH,+BAA+B,oCAAoC;IAEnE;;OAEG;IACH,YAAY,iBAAiB;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,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IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC;IACtE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;CAC3C;AAED,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAEjD,wBAAgB,sBAAsB,CACrC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACnB,eAAe,GAAG,SAAS,CAgC7B;AAED,wBAAgB,qBAAqB,CACpC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GACnB,KAAK,CAKP;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,MAAM,GACb,SAAS,CAIX"}
@@ -43,4 +43,4 @@ class GitManager {
43
43
  }
44
44
  }
45
45
  exports.GitManager = GitManager;
46
- //# sourceMappingURL=gitManager.js.map
46
+ //# sourceMappingURL=gitManager.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitManager.cjs","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAWH,MAAa,UAAU;IACtB,YAA6B,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;IAAG,CAAC;IAEtD;;OAEG;IACI,KAAK,CAAC,UAAU,CACtB,GAAW,EACX,KAAa;QAEb,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,SAAS,GAAG,IAAI;QAClD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,OAAe,EACf,QAA4B;QAE5B,MAAM,IAAI,GAAgC;YACzC,OAAO;YACP,QAAQ;SACR,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,MAAmC;QAEnC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,OAA6B,EAC7B,UAAmB,KAAK;QAExB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;CACD;AApDD,gCAoDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as resources from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { IGitManager, IHistorian } from \"./storageContracts\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport class GitManager implements IGitManager {\n\tconstructor(private readonly historian: IHistorian) {}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<resources.ICommitDetails[]>> {\n\t\treturn this.historian.getCommits(sha, count);\n\t}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getTree(root: string, recursive = true): Promise<IR11sResponse<resources.ITree>> {\n\t\treturn this.historian.getTree(root, recursive);\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>> {\n\t\treturn this.historian.getBlob(sha);\n\t}\n\n\tpublic async createBlob(\n\t\tcontent: string,\n\t\tencoding: \"utf-8\" | \"base64\",\n\t): Promise<IR11sResponse<resources.ICreateBlobResponse>> {\n\t\tconst blob: resources.ICreateBlobParams = {\n\t\t\tcontent,\n\t\t\tencoding,\n\t\t};\n\t\treturn this.historian.createBlob(blob);\n\t}\n\n\tpublic async createGitTree(\n\t\tparams: resources.ICreateTreeParams,\n\t): Promise<IR11sResponse<resources.ITree>> {\n\t\tconst treeP = this.historian.createTree(params);\n\t\treturn treeP;\n\t}\n\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial: boolean = false,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.historian.createSummary(summary, initial);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.historian.getSnapshot(sha);\n\t}\n}\n"]}
@@ -69,4 +69,4 @@ class Historian {
69
69
  }
70
70
  }
71
71
  exports.Historian = Historian;
72
- //# sourceMappingURL=historian.js.map
72
+ //# sourceMappingURL=historian.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"historian.js","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAgBhE,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,WAAyB,EAAU,EAAE,CACzF,SAAS,gBAAgB,CAAC,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;AAE5E;;GAE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C;IAEM,KAAK,CAAC,UAAU,CAAC,IAA2B;QAClD,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAY,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IACpF,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,SAAkB;QACnD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAC1B,cAAc,kBAAkB,CAAC,GAAG,CAAC,EAAE,EACvC,IAAI,CAAC,cAAc,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CACrD,CAAC;IACH,CAAC;IACM,KAAK,CAAC,aAAa,CACzB,OAA6B,EAC7B,OAAiB;QAEjB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAC3B,gBAAgB,EAChB,OAAO,EACP,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CACpE,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAC1B,kBAAkB,GAAG,EAAE,EACvB,IAAI,CAAC,cAAc,EAAE,CACrB,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,WAA6B;QACnD,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,OAAO;gBACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,GAAG,IAAI,CAAC,kBAAkB;gBAC1B,GAAG,WAAW;aACd,CAAC;SACF;QACD,OAAO;YACN,GAAG,IAAI,CAAC,kBAAkB;YAC1B,GAAG,WAAW;SACd,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport * as git from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { QueryStringType, RestWrapper } from \"./restWrapperBase\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IHistorian } from \"./storageContracts\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport interface ICredentials {\n\tuser: string;\n\tpassword: string;\n}\n\nexport const getAuthorizationTokenFromCredentials = (credentials: ICredentials): string =>\n\t`Basic ${fromUtf8ToBase64(`${credentials.user}:${credentials.password}`)}`;\n\n/**\n * Implementation of the IHistorian interface that calls out to a REST interface\n */\nexport class Historian implements IHistorian {\n\tprivate readonly defaultQueryString: QueryStringType = {};\n\tprivate readonly cacheBust: boolean;\n\n\tconstructor(\n\t\tprivate readonly historianApi: boolean,\n\t\tdisableCache: boolean,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t) {\n\t\tif (disableCache && this.historianApi) {\n\t\t\tthis.defaultQueryString.disableCache = disableCache;\n\t\t\tthis.cacheBust = false;\n\t\t} else {\n\t\t\tthis.cacheBust = disableCache;\n\t\t}\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<git.IBlob>> {\n\t\treturn this.restWrapper.get<git.IBlob>(\n\t\t\t`/git/blobs/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: git.ICreateBlobParams,\n\t): Promise<IR11sResponse<git.ICreateBlobResponse>> {\n\t\treturn this.restWrapper.post<git.ICreateBlobResponse>(\n\t\t\t`/git/blobs`,\n\t\t\tblob,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<git.ICommitDetails[]>> {\n\t\treturn this.restWrapper\n\t\t\t.get<git.ICommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))\n\t\t\t.catch(async (error) =>\n\t\t\t\terror.statusCode === 400 || error.statusCode === 404\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcontent: [],\n\t\t\t\t\t\t\theaders: new Map(),\n\t\t\t\t\t\t\tpropsToLog: {},\n\t\t\t\t\t\t\trequestUrl: \"\",\n\t\t\t\t\t }\n\t\t\t\t\t: Promise.reject<IR11sResponse<git.ICommitDetails[]>>(error),\n\t\t\t);\n\t}\n\n\tpublic async createTree(tree: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.restWrapper.post<git.ITree>(`/git/trees`, tree, this.getQueryString());\n\t}\n\n\tpublic async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.restWrapper.get<git.ITree>(\n\t\t\t`/git/trees/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString({ recursive: recursive ? 1 : 0 }),\n\t\t);\n\t}\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.restWrapper.post<IWriteSummaryResponse>(\n\t\t\t`/git/summaries`,\n\t\t\tsummary,\n\t\t\tthis.getQueryString(initial !== undefined ? { initial } : undefined),\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.restWrapper.get<IWholeFlatSnapshot>(\n\t\t\t`/git/summaries/${sha}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tprivate getQueryString(queryString?: QueryStringType): QueryStringType {\n\t\tif (this.cacheBust) {\n\t\t\treturn {\n\t\t\t\tcacheBust: Date.now(),\n\t\t\t\t...this.defaultQueryString,\n\t\t\t\t...queryString,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...this.defaultQueryString,\n\t\t\t...queryString,\n\t\t};\n\t}\n}\n"]}
1
+ {"version":3,"file":"historian.cjs","sourceRoot":"","sources":["../src/histor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,CAAC,kBAAkB;gBAC1B,GAAG,WAAW;aACd,CAAC;SACF;QACD,OAAO;YACN,GAAG,IAAI,CAAC,kBAAkB;YAC1B,GAAG,WAAW;SACd,CAAC;IACH,CAAC;CACD;AA7FD,8BA6FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport * as git from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { QueryStringType, RestWrapper } from \"./restWrapperBase\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IHistorian } from \"./storageContracts\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport interface ICredentials {\n\tuser: string;\n\tpassword: string;\n}\n\nexport const getAuthorizationTokenFromCredentials = (credentials: ICredentials): string =>\n\t`Basic ${fromUtf8ToBase64(`${credentials.user}:${credentials.password}`)}`;\n\n/**\n * Implementation of the IHistorian interface that calls out to a REST interface\n */\nexport class Historian implements IHistorian {\n\tprivate readonly defaultQueryString: QueryStringType = {};\n\tprivate readonly cacheBust: boolean;\n\n\tconstructor(\n\t\tprivate readonly historianApi: boolean,\n\t\tdisableCache: boolean,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t) {\n\t\tif (disableCache && this.historianApi) {\n\t\t\tthis.defaultQueryString.disableCache = disableCache;\n\t\t\tthis.cacheBust = false;\n\t\t} else {\n\t\t\tthis.cacheBust = disableCache;\n\t\t}\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<git.IBlob>> {\n\t\treturn this.restWrapper.get<git.IBlob>(\n\t\t\t`/git/blobs/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: git.ICreateBlobParams,\n\t): Promise<IR11sResponse<git.ICreateBlobResponse>> {\n\t\treturn this.restWrapper.post<git.ICreateBlobResponse>(\n\t\t\t`/git/blobs`,\n\t\t\tblob,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<git.ICommitDetails[]>> {\n\t\treturn this.restWrapper\n\t\t\t.get<git.ICommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))\n\t\t\t.catch(async (error) =>\n\t\t\t\terror.statusCode === 400 || error.statusCode === 404\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcontent: [],\n\t\t\t\t\t\t\theaders: new Map(),\n\t\t\t\t\t\t\tpropsToLog: {},\n\t\t\t\t\t\t\trequestUrl: \"\",\n\t\t\t\t\t }\n\t\t\t\t\t: Promise.reject<IR11sResponse<git.ICommitDetails[]>>(error),\n\t\t\t);\n\t}\n\n\tpublic async createTree(tree: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.restWrapper.post<git.ITree>(`/git/trees`, tree, this.getQueryString());\n\t}\n\n\tpublic async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.restWrapper.get<git.ITree>(\n\t\t\t`/git/trees/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString({ recursive: recursive ? 1 : 0 }),\n\t\t);\n\t}\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.restWrapper.post<IWriteSummaryResponse>(\n\t\t\t`/git/summaries`,\n\t\t\tsummary,\n\t\t\tthis.getQueryString(initial !== undefined ? { initial } : undefined),\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.restWrapper.get<IWholeFlatSnapshot>(\n\t\t\t`/git/summaries/${sha}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tprivate getQueryString(queryString?: QueryStringType): QueryStringType {\n\t\tif (this.cacheBust) {\n\t\t\treturn {\n\t\t\t\tcacheBust: Date.now(),\n\t\t\t\t...this.defaultQueryString,\n\t\t\t\t...queryString,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...this.defaultQueryString,\n\t\t\t...queryString,\n\t\t};\n\t}\n}\n"]}
@@ -6,14 +6,14 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.RouterliciousDocumentServiceFactory = exports.DocumentPostCreateError = exports.RouterliciousErrorTypes = exports.RouterliciousErrorType = exports.DefaultTokenProvider = void 0;
8
8
  // Tokens
9
- var defaultTokenProvider_1 = require("./defaultTokenProvider");
9
+ var defaultTokenProvider_1 = require("./defaultTokenProvider.cjs");
10
10
  Object.defineProperty(exports, "DefaultTokenProvider", { enumerable: true, get: function () { return defaultTokenProvider_1.DefaultTokenProvider; } });
11
11
  // Errors
12
- var errorUtils_1 = require("./errorUtils");
12
+ var errorUtils_1 = require("./errorUtils.cjs");
13
13
  Object.defineProperty(exports, "RouterliciousErrorType", { enumerable: true, get: function () { return errorUtils_1.RouterliciousErrorType; } });
14
14
  Object.defineProperty(exports, "RouterliciousErrorTypes", { enumerable: true, get: function () { return errorUtils_1.RouterliciousErrorTypes; } });
15
15
  // Factory
16
- var documentServiceFactory_1 = require("./documentServiceFactory");
16
+ var documentServiceFactory_1 = require("./documentServiceFactory.cjs");
17
17
  Object.defineProperty(exports, "DocumentPostCreateError", { enumerable: true, get: function () { return documentServiceFactory_1.DocumentPostCreateError; } });
18
18
  Object.defineProperty(exports, "RouterliciousDocumentServiceFactory", { enumerable: true, get: function () { return documentServiceFactory_1.RouterliciousDocumentServiceFactory; } });
19
- //# sourceMappingURL=index.js.map
19
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,SAAS;AACT,mEAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAG7B,SAAS;AACT,+CAA+E;AAAtE,oHAAA,sBAAsB,OAAA;AAAE,qHAAA,uBAAuB,OAAA;AAExD,UAAU;AACV,uEAGkC;AAFjC,iIAAA,uBAAuB,OAAA;AACvB,6IAAA,mCAAmC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Tokens\nexport { DefaultTokenProvider } from \"./defaultTokenProvider\";\nexport { ITokenProvider, ITokenResponse, ITokenService } from \"./tokens\";\n\n// Errors\nexport { RouterliciousErrorType, RouterliciousErrorTypes } from \"./errorUtils\";\n\n// Factory\nexport {\n\tDocumentPostCreateError,\n\tRouterliciousDocumentServiceFactory,\n} from \"./documentServiceFactory\";\n\n// Configuration\nexport { IRouterliciousDriverPolicies } from \"./policies\";\n"]}
@@ -102,4 +102,4 @@ class MapWithExpiration extends Map {
102
102
  }
103
103
  }
104
104
  exports.MapWithExpiration = MapWithExpiration;
105
- //# sourceMappingURL=mapWithExpiration.js.map
105
+ //# sourceMappingURL=mapWithExpiration.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapWithExpiration.cjs","sourceRoot":"","sources":["../src/mapWithExpiration.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD;;;GAGG;AACH,MAAa,iBAA4C,SAAQ,GAAiB;IAIjF,YAA6B,QAAgB;QAC5C,KAAK,EAAE,CAAC;QADoB,aAAQ,GAAR,QAAQ,CAAQ;QAH7C,2EAA2E;QAC1D,uBAAkB,GAAG,IAAI,GAAG,EAAgB,CAAC;IAI9D,CAAC;IAEO,OAAO,CAAC,GAAS;QACxB,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACK,WAAW,CAAC,GAAS,EAAE,UAAmB,KAAK;QACtD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C,EAAE,CAAC;IACjC,CAAC;IAED,OAAO;QACN,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;CACD;AAhHD,8CAgHC","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\";\n\n/**\n * An extension of Map that expires (deletes) entries after a period of inactivity.\n * The policy is based on the last time a key was written to.\n */\nexport class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValue> {\n\t/** Timestamps (as epoch ms numbers) of when each key was last refreshed */\n\tprivate readonly lastRefreshedTimes = new Map<TKey, number>();\n\n\tconstructor(private readonly expiryMs: number) {\n\t\tsuper();\n\t}\n\n\tprivate refresh(key: TKey): void {\n\t\tthis.lastRefreshedTimes.set(key, new Date().valueOf());\n\t}\n\n\t/**\n\t * Returns true if the key is present and expired, false if it's not expired, and undefined if it's not found\n\t * If cleanUp is passed as true, then delete any expired entry before returning.\n\t */\n\tprivate checkExpiry(key: TKey, cleanUp: boolean = false): boolean | undefined {\n\t\tconst refreshTime = this.lastRefreshedTimes.get(key);\n\t\tassert(\n\t\t\t(refreshTime !== undefined) === super.has(key),\n\t\t\t0x50c /* freshness map out of sync */,\n\t\t);\n\n\t\tif (refreshTime === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst expired = new Date().valueOf() - refreshTime >= this.expiryMs;\n\t\tif (expired && cleanUp) {\n\t\t\tthis.delete(key);\n\t\t}\n\t\treturn expired;\n\t}\n\n\tprivate clearExpiredEntries() {\n\t\t// forEach clears out any expired entries\n\t\tthis.forEach(() => {});\n\t}\n\n\tget size(): number {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.size;\n\t}\n\n\thas(key: TKey): boolean {\n\t\tthis.checkExpiry(key, true /* cleanUp */);\n\t\treturn super.has(key);\n\t}\n\n\tget(key: TKey): TValue | undefined {\n\t\tthis.checkExpiry(key, true /* cleanUp */);\n\t\treturn super.get(key);\n\t}\n\n\tset(key: TKey, value: TValue): this {\n\t\t// Sliding window expiration policy (on write)\n\t\tthis.refresh(key);\n\t\treturn super.set(key, value);\n\t}\n\n\tdelete(key: TKey): boolean {\n\t\tthis.lastRefreshedTimes.delete(key);\n\t\treturn super.delete(key);\n\t}\n\n\tclear(): void {\n\t\tthis.lastRefreshedTimes.clear();\n\t\tsuper.clear();\n\t}\n\n\tforEach(\n\t\tcallbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void,\n\t\tthisArg?: any,\n\t): void {\n\t\tconst expiredKeys: TKey[] = [];\n\t\tsuper.forEach(\n\t\t\t(v, k, m) => {\n\t\t\t\tif (this.checkExpiry(k) === true) {\n\t\t\t\t\texpiredKeys.push(k);\n\t\t\t\t} else {\n\t\t\t\t\tcallbackfn.bind(thisArg)(v, k, m);\n\t\t\t\t}\n\t\t\t},\n\t\t\t// Note we don't pass thisArg here, since we bind it directly to callbackFn and don't need it otherwise\n\t\t);\n\n\t\t// Clean up keys we know are expired now that we're done iterating\n\t\texpiredKeys.forEach((key: TKey) => {\n\t\t\tthis.delete(key);\n\t\t});\n\t}\n\n\tentries(): IterableIterator<[TKey, TValue]> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.entries();\n\t}\n\tkeys(): IterableIterator<TKey> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.keys();\n\t}\n\tvalues(): IterableIterator<TValue> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.values();\n\t}\n\t[Symbol.iterator](): IterableIterator<[TKey, TValue]> {\n\t\tthis.clearExpiredEntries();\n\t\treturn super[Symbol.iterator]();\n\t}\n\n\tvalueOf() {\n\t\tthis.clearExpiredEntries();\n\t\treturn super.valueOf();\n\t}\n}\n"]}
@@ -33,4 +33,4 @@ class NullBlobStorageService {
33
33
  }
34
34
  }
35
35
  exports.NullBlobStorageService = NullBlobStorageService;
36
- //# sourceMappingURL=nullBlobStorageService.js.map
36
+ //# sourceMappingURL=nullBlobStorageService.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullBlobStorageService.cjs","sourceRoot":"","sources":["../src/nullBlobStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;GAGG;AACH,MAAa,sBAAsB;IAClC,IAAW,aAAa;QACvB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,OAAsB;QAClD,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,SAAwB,EAAE,KAAa;QAC/D,OAAO,EAAE,CAAC;IACX,CAAC;IAEM,KAAK,CAAC,wBAAwB,CACpC,OAAyB,EACzB,OAAwB;QAExB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAA0B;QACtD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC1D,CAAC;IACM,KAAK,CAAC,QAAQ,CAAC,MAAc;QACnC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACxD,CAAC;CACD;AA9BD,wDA8BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport * as api from \"@fluidframework/protocol-definitions\";\n\n/**\n * Document access to underlying storage. It is default implementation of a storage service.\n * Does not read/write anything.\n */\nexport class NullBlobStorageService implements IDocumentStorageService {\n\tpublic get repositoryUrl(): string {\n\t\tthrow new Error(\"Invalid operation\");\n\t}\n\n\tpublic async getSnapshotTree(version?: api.IVersion): Promise<api.ISnapshotTree | null> {\n\t\treturn version ? Promise.reject(new Error(\"Invalid operation\")) : null;\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<api.IVersion[]> {\n\t\treturn [];\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: api.ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tthrow new Error(\"Invalid operation\");\n\t}\n\n\tpublic async downloadSummary(handle: api.ISummaryHandle): Promise<api.ISummaryTree> {\n\t\tthrow new Error(\"Invalid operation\");\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {\n\t\tthrow new Error(\"Null blob storage can not create blob\");\n\t}\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tthrow new Error(\"Null blob storage can not read blob\");\n\t}\n}\n"]}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/routerlicious-driver";
11
- exports.pkgVersion = "2.0.0-internal.7.2.2";
12
- //# sourceMappingURL=packageVersion.js.map
11
+ exports.pkgVersion = "2.0.0-internal.7.4.0";
12
+ //# sourceMappingURL=packageVersion.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.cjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,sCAAsC,CAAC;AACjD,QAAA,UAAU,GAAG,sBAAsB,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/routerlicious-driver\";\nexport const pkgVersion = \"2.0.0-internal.7.4.0\";\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/routerlicious-driver";
8
- export declare const pkgVersion = "2.0.0-internal.7.2.2";
8
+ export declare const pkgVersion = "2.0.0-internal.7.4.0";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -4,4 +4,4 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=contracts.js.map
7
+ //# sourceMappingURL=policies.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policies.cjs","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @internal\n */\nexport interface IRouterliciousDriverPolicies {\n\t/**\n\t * Enable prefetching entire snapshot tree into memory before it is loaded by the runtime.\n\t * Default: true\n\t */\n\tenablePrefetch: boolean;\n\t/**\n\t * Rate limit concurrent storage requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentStorageRequests: number;\n\t/**\n\t * Rate limit concurrent orderer requests.\n\t * Default: 100\n\t */\n\tmaxConcurrentOrdererRequests: number;\n\t/**\n\t * Enable uploading entire summary tree as a IWholeSummaryPayload to storage.\n\t * Default: false\n\t */\n\tenableWholeSummaryUpload: boolean;\n\t/**\n\t * Enable service endpoint discovery when creating or joining a session.\n\t * Default: false\n\t */\n\tenableDiscovery: boolean;\n\t/**\n\t * Enable using RestLess which avoids CORS preflight requests.\n\t * Default: true\n\t */\n\tenableRestLess: boolean;\n\t/**\n\t * Enable internal cache of summaries/snapshots.\n\t * Reduces Summarizer boot time and reduces server load in E2E tests.\n\t * Default: true\n\t */\n\tenableInternalSummaryCaching: boolean;\n\t/**\n\t * Enable downgrading socket connection to long-polling\n\t * when websocket connection cannot be established.\n\t * Default: true\n\t */\n\tenableLongPollingDowngrade: boolean;\n\t/**\n\t * Indicates that the container is ephemeral.\n\t * Artifacts relates to the container are limited to container lifetime.\n\t * Default: false\n\t */\n\tisEphemeralContainer: boolean;\n}\n"]}
@@ -2,6 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ /**
6
+ * @internal
7
+ */
5
8
  export interface IRouterliciousDriverPolicies {
6
9
  /**
7
10
  * Enable prefetching entire snapshot tree into memory before it is loaded by the runtime.
@@ -1 +1 @@
1
- {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,4BAA4B,EAAE,OAAO,CAAC;IACtC;;;;OAIG;IACH,0BAA0B,EAAE,OAAO,CAAC;IACpC;;;;OAIG;IACH,oBAAoB,EAAE,OAAO,CAAC;CAC9B"}
1
+ {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC;;;OAGG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,4BAA4B,EAAE,OAAO,CAAC;IACtC;;;;OAIG;IACH,0BAA0B,EAAE,OAAO,CAAC;IACpC;;;;OAIG;IACH,oBAAoB,EAAE,OAAO,CAAC;CAC9B"}
@@ -70,4 +70,4 @@ function convertWholeFlatSnapshotToSnapshotTreeAndBlobs(flatSnapshot, treePrefix
70
70
  };
71
71
  }
72
72
  exports.convertWholeFlatSnapshotToSnapshotTreeAndBlobs = convertWholeFlatSnapshotToSnapshotTreeAndBlobs;
73
- //# sourceMappingURL=r11sSnapshotParser.js.map
73
+ //# sourceMappingURL=r11sSnapshotParser.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"r11sSnapshotParser.cjs","sourceRoot":"","sources":["../src/r11sSnapshotParser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+DAA8D;AAG9D;;;;;;GAMG;AACH,SAAS,cAAc,CACtB,QAAgC,EAChC,kBAA0B;IAE1B,MAAM,MAAM,GAAsC,EAAE,CAAC;IACrD,uEAAuE;IACvE,MAAM,IAAI,GAAkB,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IACtE,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;IAElB,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO,EAAE;QACrC,8FAA8F;QAC9F,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,kBAAkB,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QAChF,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC7C,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CA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;IACjD,MAAM,cAAc,GAAG,gBAAgB,EAAE,cAAc,CAAC;IACxD,MAAM,YAAY,GAAG,cAAc,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC;IAE1E,OAAO;QACN,KAAK;QACL,YAAY;QACZ,cAAc;QACd,EAAE,EAAE,YAAY,CAAC,EAAE;KACnB,CAAC;AACH,CAAC;AApBD,wGAoBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\nimport { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { INormalizedWholeSnapshot, IWholeFlatSnapshot, IWholeFlatSnapshotTree } from \"./contracts\";\n\n/**\n * Build a tree hierarchy from a flat tree.\n *\n * @param flatTree - a flat tree\n * @param treePrefixToRemove - tree prefix to strip\n * @returns the heirarchical tree\n */\nfunction buildHierarchy(\n\tflatTree: IWholeFlatSnapshotTree,\n\ttreePrefixToRemove: string,\n): ISnapshotTree {\n\tconst lookup: { [path: string]: ISnapshotTree } = {};\n\t// Root tree id will be used to determine which version was downloaded.\n\tconst root: ISnapshotTree = { id: flatTree.id, blobs: {}, trees: {} };\n\tlookup[\"\"] = root;\n\n\tfor (const entry of flatTree.entries) {\n\t\t// Strip the `treePrefixToRemove` path from tree entries such that they are stored under root.\n\t\tconst entryPath = entry.path.replace(new RegExp(`^${treePrefixToRemove}/`), \"\");\n\t\tconst lastIndex = entryPath.lastIndexOf(\"/\");\n\t\tconst entryPathDir = entryPath.slice(0, Math.max(0, lastIndex));\n\t\tconst entryPathBase = entryPath.slice(lastIndex + 1);\n\n\t\t// The flat output is breadth-first so we can assume we see tree nodes prior to their contents\n\t\tconst node = lookup[entryPathDir];\n\n\t\t// Add in either the blob or tree\n\t\tif (entry.type === \"tree\") {\n\t\t\tconst newTree: ISnapshotTree = {\n\t\t\t\tblobs: {},\n\t\t\t\ttrees: {},\n\t\t\t\tunreferenced: entry.unreferenced,\n\t\t\t};\n\t\t\tnode.trees[decodeURIComponent(entryPathBase)] = newTree;\n\t\t\tlookup[entryPath] = newTree;\n\t\t} else if (entry.type === \"blob\") {\n\t\t\tnode.blobs[decodeURIComponent(entryPathBase)] = entry.id;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown entry type!!`);\n\t\t}\n\t}\n\n\treturn root;\n}\n\n/**\n * Converts existing IWholeFlatSnapshot to snapshot tree, blob array, and sequence number.\n *\n * @param flatSnapshot - flat snapshot\n * @param treePrefixToRemove - tree prefix to strip. By default we are stripping \".app\" prefix\n * @returns snapshot tree, blob array, and sequence number\n */\nexport function convertWholeFlatSnapshotToSnapshotTreeAndBlobs(\n\tflatSnapshot: IWholeFlatSnapshot,\n\ttreePrefixToRemove: string = \".app\",\n): INormalizedWholeSnapshot {\n\tconst blobs = new Map<string, ArrayBuffer>();\n\tif (flatSnapshot.blobs) {\n\t\tflatSnapshot.blobs.forEach((blob) => {\n\t\t\tblobs.set(blob.id, stringToBuffer(blob.content, blob.encoding ?? \"utf-8\"));\n\t\t});\n\t}\n\tconst flatSnapshotTree = flatSnapshot.trees?.[0];\n\tconst sequenceNumber = flatSnapshotTree?.sequenceNumber;\n\tconst snapshotTree = buildHierarchy(flatSnapshotTree, treePrefixToRemove);\n\n\treturn {\n\t\tblobs,\n\t\tsnapshotTree,\n\t\tsequenceNumber,\n\t\tid: flatSnapshot.id,\n\t};\n}\n"]}
@@ -15,9 +15,9 @@ const driver_utils_1 = require("@fluidframework/driver-utils");
15
15
  const server_services_client_1 = require("@fluidframework/server-services-client");
16
16
  const cross_fetch_1 = __importDefault(require("cross-fetch"));
17
17
  const json_stringify_safe_1 = __importDefault(require("json-stringify-safe"));
18
- const errorUtils_1 = require("./errorUtils");
19
- const packageVersion_1 = require("./packageVersion");
20
- const restWrapperBase_1 = require("./restWrapperBase");
18
+ const errorUtils_1 = require("./errorUtils.cjs");
19
+ const packageVersion_1 = require("./packageVersion.cjs");
20
+ const restWrapperBase_1 = require("./restWrapperBase.cjs");
21
21
  const axiosRequestConfigToFetchRequestConfig = (requestConfig) => {
22
22
  const requestInfo = requestConfig.baseURL !== undefined
23
23
  ? `${requestConfig.baseURL}${requestConfig.url ?? ""}`
@@ -246,4 +246,4 @@ function toInstrumentedR11sStorageTokenFetcher(tenantId, documentId, tokenProvid
246
246
  return fetchStorageToken;
247
247
  }
248
248
  exports.toInstrumentedR11sStorageTokenFetcher = toInstrumentedR11sStorageTokenFetcher;
249
- //# sourceMappingURL=restWrapper.js.map
249
+ //# sourceMappingURL=restWrapper.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restWrapper.cjs","sourceRoot":"","sources":["../src/restWrapper.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAGH,qEAIyC;AACzC,2DAAoD;AACpD,+DAA6E;AAC7E,+DAAmG;AACnG,mFAKgD;AAChD,8DAAgC;AAEhC,8EAAgD;AAChD,iDAA8E;AAE9E,yDAA+D;AAC/D,2DAAiE;AAKjE,MAAM,sCAAsC,GAAG,CAC9C,aAAiC,EACJ,EAAE;IAC/B,MAAM,WAAW,GAChB,aAAa,CAAC,OAAO,KAAK,SAAS;QAClC,CAAC,CAAC,GAAG,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,GAAG,IAAI,EAAE,EAAE;QACtD,CAAC,CAAC,aAAa,CAAC,GAAG,IAAI,EAAE,CAAC;IAC5B,MAAM,WAAW,GAAgB;QAChC,MAAM,EAAE,aAAa,CAAC,MAAM;QAC5B,oGAAoG;QACpG,qEAAqE;QACrE,OAAO,EAAE,aAAa,CAAC,OAAiC;QACxD,IAAI,EAAE,aAAa,CAAC,IAAI;KACxB,CAAC;IACF,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AACnC,CAAC,CAAC;AASF;;;;GAIG;AACH,SAAgB,6BAA6B,CAAI,OAAU;IAC1D,OAAO;QACN,OAAO;QACP,OAAO,EAAE,IAAI,GAAG,EAAE;QAClB,UAAU,EAAE,EA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,+BAA+B,CACtD,MAAM,EACN,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,OAAO,EACP,aAAa,CACb,CAAC;QAEF,OAAO,WAAW,CAAC;IACpB,CAAC;CACD;AAjDD,0EAiDC;AAED,SAAgB,qCAAqC,CACpD,QAAgB,EAChB,UAA8B,EAC9B,aAA6B,EAC7B,MAA2B;IAE3B,MAAM,iBAAiB,GAAG,KAAK,EAAE,YAAsB,EAA2B,EAAE;QACnF,OAAO,kCAAgB,CAAC,cAAc,CACrC,MAAM,EACN;YACC,SAAS,EAAE,mBAAmB;YAC9B,KAAK,EAAE,UAAU;SACjB,EACD,KAAK,IAAI,EAAE;YACV,MAAM,YAAY,GAAG,MAAM,aAAa,CAAC,iBAAiB,CACzD,QAAQ,EACR,UAAU,EACV,YAAY,CACZ,CAAC;YAEF,OAAO,YAAY,CAAC;QACrB,CAAC,CACD,CAAC;IACH,CAAC,CAAC;IACF,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AAzBD,sFAyBC;AAED,SAAgB,qCAAqC,CACpD,QAAgB,EAChB,UAAkB,EAClB,aAA6B,EAC7B,MAA2B;IAE3B,MAAM,iBAAiB,GAAG,KAAK,EAAE,YAAsB,EAA2B,EAAE;QACnF,OAAO,kCAAgB,CAAC,cAAc,CACrC,MAAM,EACN;YACC,SAAS,EAAE,mBAAmB;YAC9B,KAAK,EAAE,UAAU;SACjB,EACD,KAAK,IAAI,EAAE;YACV,8CAA8C;YAC9C,MAAM,YAAY,GAAG,MAAM,aAAa,CAAC,iBAAiB,CACzD,QAAQ,EACR,UAAU,EACV,YAAY,CACZ,CAAC;YAEF,OAAO,YAAY,CAAC;QACrB,CAAC,CACD,CAAC;IACH,CAAC,CAAC;IACF,OAAO,iBAAiB,CAAC;AAC1B,CAAC;AA1BD,sFA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tITelemetryLoggerExt,\n\tPerformanceEvent,\n\tnumberFromString,\n} from \"@fluidframework/telemetry-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { fromUtf8ToBase64, performance } from \"@fluid-internal/client-utils\";\nimport { GenericNetworkError, NonRetryableError, RateLimiter } from \"@fluidframework/driver-utils\";\nimport {\n\tCorrelationIdHeaderName,\n\tDriverVersionHeaderName,\n\tgetAuthorizationTokenFromCredentials,\n\tRestLessClient,\n} from \"@fluidframework/server-services-client\";\nimport fetch from \"cross-fetch\";\nimport type { AxiosRequestConfig, AxiosRequestHeaders } from \"axios\";\nimport safeStringify from \"json-stringify-safe\";\nimport { RouterliciousErrorTypes, throwR11sNetworkError } from \"./errorUtils\";\nimport { ITokenProvider, ITokenResponse } from \"./tokens\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { QueryStringType, RestWrapper } from \"./restWrapperBase\";\n\ntype AuthorizationHeaderGetter = (token: ITokenResponse) => string;\nexport type TokenFetcher = (refresh?: boolean) => Promise<ITokenResponse>;\n\nconst axiosRequestConfigToFetchRequestConfig = (\n\trequestConfig: AxiosRequestConfig,\n): [RequestInfo, RequestInit] => {\n\tconst requestInfo: string =\n\t\trequestConfig.baseURL !== undefined\n\t\t\t? `${requestConfig.baseURL}${requestConfig.url ?? \"\"}`\n\t\t\t: requestConfig.url ?? \"\";\n\tconst requestInit: RequestInit = {\n\t\tmethod: requestConfig.method,\n\t\t// NOTE: I believe that although the Axios type permits non-string values in the header, here we are\n\t\t// guaranteed the requestConfig only has string values in its header.\n\t\theaders: requestConfig.headers as Record<string, string>,\n\t\tbody: requestConfig.data,\n\t};\n\treturn [requestInfo, requestInit];\n};\n\nexport interface IR11sResponse<T> {\n\tcontent: T;\n\theaders: Map<string, string>;\n\tpropsToLog: ITelemetryProperties;\n\trequestUrl: string;\n}\n\n/**\n * A utility function to create a Routerlicious response without any additional props as we might not have them always.\n * @param content - Response which is equivalent to content.\n * @returns A Routerlicious response without any extra props.\n */\nexport function createR11sResponseFromContent<T>(content: T): IR11sResponse<T> {\n\treturn {\n\t\tcontent,\n\t\theaders: new Map(),\n\t\tpropsToLog: {},\n\t\trequestUrl: \"\",\n\t};\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\nexport function getPropsToLogFromResponse(headers: {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tget: (id: string) => string | undefined | null;\n}) {\n\tinterface LoggingHeader {\n\t\theaderName: string;\n\t\tlogName: string;\n\t}\n\n\t// We rename headers so that otel doesn't scrub them away. Otel doesn't allow\n\t// certain characters in headers including '-'\n\tconst headersToLog: LoggingHeader[] = [\n\t\t{ headerName: CorrelationIdHeaderName, logName: \"requestCorrelationId\" },\n\t\t{ headerName: \"content-encoding\", logName: \"contentEncoding\" },\n\t\t{ headerName: \"content-type\", logName: \"contentType\" },\n\t];\n\tconst additionalProps: ITelemetryProperties = {\n\t\tcontentsize: numberFromString(headers.get(\"content-length\")),\n\t};\n\theadersToLog.forEach((header) => {\n\t\tconst headerValue = headers.get(header.headerName);\n\t\tif (headerValue !== undefined && headerValue !== null) {\n\t\t\tadditionalProps[header.logName] = headerValue;\n\t\t}\n\t});\n\n\treturn additionalProps;\n}\n\nexport class RouterliciousRestWrapper extends RestWrapper {\n\tprivate readonly restLess = new RestLessClient();\n\tprivate token: ITokenResponse | undefined;\n\n\tconstructor(\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly rateLimiter: RateLimiter,\n\t\tprivate readonly fetchRefreshedToken: TokenFetcher,\n\t\tprivate readonly getAuthorizationHeader: AuthorizationHeaderGetter,\n\t\tprivate readonly useRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tprivate tokenP?: Promise<ITokenResponse>,\n\t\tdefaultQueryString: QueryStringType = {},\n\t) {\n\t\tsuper(baseurl, defaultQueryString);\n\t}\n\n\tprotected async request<T>(\n\t\trequestConfig: AxiosRequestConfig,\n\t\tstatusCode: number,\n\t\tcanRetry = true,\n\t): Promise<IR11sResponse<T>> {\n\t\tconst config = {\n\t\t\t...requestConfig,\n\t\t\theaders: await this.generateHeaders(requestConfig.headers),\n\t\t};\n\n\t\tconst translatedConfig = this.useRestLess ? this.restLess.translate(config) : config;\n\t\tconst fetchRequestConfig = axiosRequestConfigToFetchRequestConfig(translatedConfig);\n\n\t\tconst res = await this.rateLimiter.schedule(async () => {\n\t\t\tconst perfStart = performance.now();\n\t\t\tconst result = await fetch(...fetchRequestConfig).catch(async (error) => {\n\t\t\t\t// Browser Fetch throws a TypeError on network error, `node-fetch` throws a FetchError\n\t\t\t\tconst isNetworkError = [\"TypeError\", \"FetchError\"].includes(error?.name);\n\t\t\t\tconst errorMessage = isNetworkError\n\t\t\t\t\t? `NetworkError: ${error.message}`\n\t\t\t\t\t: safeStringify(error);\n\t\t\t\t// If a service is temporarily down or a browser resource limit is reached, RestWrapper will throw\n\t\t\t\t// a network error with no status code (e.g. err:ERR_CONN_REFUSED or err:ERR_FAILED) and\n\t\t\t\t// the error message will start with NetworkError as defined in restWrapper.ts\n\t\t\t\t// If there exists a self-signed SSL certificates error, throw a NonRetryableError\n\t\t\t\t// TODO: instead of relying on string matching, filter error based on the error code like we do for websocket connections\n\t\t\t\tconst err = errorMessage.includes(\"failed, reason: self signed certificate\")\n\t\t\t\t\t? new NonRetryableError(errorMessage, RouterliciousErrorTypes.sslCertError, {\n\t\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t })\n\t\t\t\t\t: new GenericNetworkError(\n\t\t\t\t\t\t\terrorMessage,\n\t\t\t\t\t\t\terrorMessage.startsWith(\"NetworkError\"),\n\t\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t );\n\t\t\t\tthrow err;\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tresponse: result,\n\t\t\t\tduration: performance.now() - perfStart,\n\t\t\t};\n\t\t});\n\n\t\tconst response = res.response;\n\n\t\tlet start = performance.now();\n\t\tconst text = await response.text();\n\t\tconst receiveContentTime = performance.now() - start;\n\n\t\tconst bodySize = text.length;\n\t\tstart = performance.now();\n\t\tconst responseBody: any = response.headers.get(\"content-type\")?.includes(\"application/json\")\n\t\t\t? JSON.parse(text)\n\t\t\t: text;\n\t\tconst parseTime = performance.now() - start;\n\n\t\t// Success\n\t\tif (response.ok || response.status === statusCode) {\n\t\t\tconst result = responseBody as T;\n\t\t\tconst headers = headersToMap(response.headers);\n\t\t\treturn {\n\t\t\t\tcontent: result,\n\t\t\t\theaders,\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\t\t\trequestUrl: fetchRequestConfig[0].toString(),\n\t\t\t\tpropsToLog: {\n\t\t\t\t\t...getPropsToLogFromResponse(headers),\n\t\t\t\t\tbodySize,\n\t\t\t\t\treceiveContentTime,\n\t\t\t\t\tparseTime,\n\t\t\t\t\tfetchTime: res.duration,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\t// Failure\n\t\tif (response.status === 401 && canRetry) {\n\t\t\t// Refresh Authorization header and retry once\n\t\t\tthis.token = await this.fetchRefreshedToken(true /* refreshToken */);\n\t\t\treturn this.request<T>(config, statusCode, false);\n\t\t}\n\t\tif (response.status === 429 && responseBody?.retryAfter > 0) {\n\t\t\t// Retry based on retryAfter[Seconds]\n\t\t\treturn new Promise<IR11sResponse<T>>((resolve, reject) =>\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tthis.request<T>(config, statusCode).then(resolve).catch(reject);\n\t\t\t\t}, responseBody.retryAfter * 1000),\n\t\t\t);\n\t\t}\n\n\t\tconst responseSummary =\n\t\t\tresponseBody !== undefined\n\t\t\t\t? typeof responseBody === \"string\"\n\t\t\t\t\t? responseBody\n\t\t\t\t\t: safeStringify(responseBody)\n\t\t\t\t: response.statusText;\n\t\tthrowR11sNetworkError(\n\t\t\t`R11s fetch error: ${responseSummary}`,\n\t\t\tresponse.status,\n\t\t\tresponseBody?.retryAfter,\n\t\t);\n\t}\n\n\tprivate async generateHeaders(\n\t\trequestHeaders?: AxiosRequestHeaders | undefined,\n\t): Promise<Record<string, string>> {\n\t\tconst token = await this.getToken();\n\t\tassert(token !== undefined, 0x679 /* token should be present */);\n\t\tconst headers: Record<string, string> = {\n\t\t\t...requestHeaders,\n\t\t\t[DriverVersionHeaderName]: driverVersion,\n\t\t\t// NOTE: If this.authorizationHeader is undefined, should \"Authorization\" be removed entirely?\n\t\t\tAuthorization: this.getAuthorizationHeader(token),\n\t\t};\n\t\treturn headers;\n\t}\n\n\tpublic async getToken(): Promise<ITokenResponse> {\n\t\tif (this.token !== undefined) {\n\t\t\treturn this.token;\n\t\t}\n\t\tconst token = await (this.tokenP ?? this.fetchRefreshedToken());\n\t\tthis.setToken(token);\n\t\tthis.tokenP = undefined;\n\t\treturn token;\n\t}\n\n\tpublic setToken(token: ITokenResponse) {\n\t\tthis.token = token;\n\t}\n}\n\nexport class RouterliciousStorageRestWrapper extends RouterliciousRestWrapper {\n\tprivate constructor(\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tfetchToken: TokenFetcher,\n\t\tgetAuthorizationHeader: AuthorizationHeaderGetter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t\tdefaultQueryString: QueryStringType = {},\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\tfetchToken,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t\tdefaultQueryString,\n\t\t);\n\t}\n\n\tpublic static async load(\n\t\ttenantId: string,\n\t\ttokenFetcher: TokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t): Promise<RouterliciousStorageRestWrapper> {\n\t\tconst defaultQueryString = {\n\t\t\ttoken: `${fromUtf8ToBase64(tenantId)}`,\n\t\t};\n\n\t\tconst getAuthorizationHeader: AuthorizationHeaderGetter = (\n\t\t\ttoken: ITokenResponse,\n\t\t): string => {\n\t\t\tconst credentials = {\n\t\t\t\tpassword: token.jwt,\n\t\t\t\tuser: tenantId,\n\t\t\t};\n\t\t\treturn getAuthorizationTokenFromCredentials(credentials);\n\t\t};\n\n\t\tconst restWrapper = new RouterliciousStorageRestWrapper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\ttokenFetcher,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t\tdefaultQueryString,\n\t\t);\n\n\t\treturn restWrapper;\n\t}\n}\n\nexport class RouterliciousOrdererRestWrapper extends RouterliciousRestWrapper {\n\tprivate constructor(\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tfetchToken: TokenFetcher,\n\t\tgetAuthorizationHeader: AuthorizationHeaderGetter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t\tdefaultQueryString: QueryStringType = {},\n\t) {\n\t\tsuper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\tfetchToken,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t\tdefaultQueryString,\n\t\t);\n\t}\n\n\tpublic static async load(\n\t\ttokenFetcher: TokenFetcher,\n\t\tlogger: ITelemetryLoggerExt,\n\t\trateLimiter: RateLimiter,\n\t\tuseRestLess: boolean,\n\t\tbaseurl?: string,\n\t\tinitialTokenP?: Promise<ITokenResponse>,\n\t): Promise<RouterliciousOrdererRestWrapper> {\n\t\tconst getAuthorizationHeader: AuthorizationHeaderGetter = (\n\t\t\ttoken: ITokenResponse,\n\t\t): string => {\n\t\t\treturn `Basic ${token.jwt}`;\n\t\t};\n\n\t\tconst restWrapper = new RouterliciousOrdererRestWrapper(\n\t\t\tlogger,\n\t\t\trateLimiter,\n\t\t\ttokenFetcher,\n\t\t\tgetAuthorizationHeader,\n\t\t\tuseRestLess,\n\t\t\tbaseurl,\n\t\t\tinitialTokenP,\n\t\t);\n\n\t\treturn restWrapper;\n\t}\n}\n\nexport function toInstrumentedR11sOrdererTokenFetcher(\n\ttenantId: string,\n\tdocumentId: string | undefined,\n\ttokenProvider: ITokenProvider,\n\tlogger: ITelemetryLoggerExt,\n): TokenFetcher {\n\tconst fetchOrdererToken = async (refreshToken?: boolean): Promise<ITokenResponse> => {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"FetchOrdererToken\",\n\t\t\t\tdocId: documentId,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst ordererToken = await tokenProvider.fetchOrdererToken(\n\t\t\t\t\ttenantId,\n\t\t\t\t\tdocumentId,\n\t\t\t\t\trefreshToken,\n\t\t\t\t);\n\n\t\t\t\treturn ordererToken;\n\t\t\t},\n\t\t);\n\t};\n\treturn fetchOrdererToken;\n}\n\nexport function toInstrumentedR11sStorageTokenFetcher(\n\ttenantId: string,\n\tdocumentId: string,\n\ttokenProvider: ITokenProvider,\n\tlogger: ITelemetryLoggerExt,\n): TokenFetcher {\n\tconst fetchStorageToken = async (refreshToken?: boolean): Promise<ITokenResponse> => {\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"FetchStorageToken\",\n\t\t\t\tdocId: documentId,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\t// Craft credentials using tenant id and token\n\t\t\t\tconst storageToken = await tokenProvider.fetchStorageToken(\n\t\t\t\t\ttenantId,\n\t\t\t\t\tdocumentId,\n\t\t\t\t\trefreshToken,\n\t\t\t\t);\n\n\t\t\t\treturn storageToken;\n\t\t\t},\n\t\t);\n\t};\n\treturn fetchStorageToken;\n}\n"]}
@@ -86,4 +86,4 @@ function getQueryString(queryParams) {
86
86
  return queryString;
87
87
  }
88
88
  exports.getQueryString = getQueryString;
89
- //# sourceMappingURL=restWrapperBase.js.map
89
+ //# sourceMappingURL=restWrapperBase.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restWrapperBase.cjs","sourceRoot":"","sources":["../src/restWrapperBase.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,MAAsB,WAAW;IAChC,YACoB,OAAgB,EACzB,qBAAsC,EAAE,EAC/B,gBAAgB,IAAI,GAAG,IAAI,GAAG,IAAI,EAClC,mBAAmB,IAAI,GAAG,IAAI,GAAG,IAAI;QAHrC,YAAO,GAAP,OAAO,CAAS;QACzB,uBAAkB,GAAlB,kBAAkB,CAAsB;QAC/B,kBAAa,GAAb,aAAa,CAAqB;QAClC,qBAAgB,GAAhB,gBAAgB,CAAqB;IACtD,CAAC;IAEG,KAAK,CAAC,GAAG,CACf,GAAW,EACX,WAA6B,EAC7B,OAA6B,EAC7B,iBAKC;QAED,MAAM,OAAO,GAAuB;YACnC,GAAG,iBAAiB;YACpB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO;YACP,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE;SACrD,CAAC;QACF,OAAO,IAAI,CAAC,OAAO,CAAI,OAAO,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAEM,KAAK,CAAC,IAAI,CAChB,GAAW,EACX,WAAgB,EAChB,WAA6B,EAC7B,OAA6B,EAC7B,iBAKC;QAED,MAAM,OAAO,GAAuB;YACnC,GAAG,iBAAiB;YACpB,OAAO,E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ACtC,CAAC;IAQS,mBAAmB,CAAC,iBAAmC;QAChE,IAAI,IAAI,CAAC,kBAAkB,IAAI,iBAAiB,EAAE;YACjD,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,CAAC,kBAAkB,EAAE,GAAG,iBAAiB,EAAE,CAAC;YAE5E,OAAO,cAAc,CAAC,cAAc,CAAC,CAAC;SACtC;QAED,OAAO,EAAE,CAAC;IACX,CAAC;CACD;AAvHD,kCAuHC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,WAA4B;IAC1D,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;QAC3C,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;YACnC,MAAM,SAAS,GAAG,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;YACjD,WAAW,IAAI,GAAG,SAAS,GAAG,GAAG,IAAI,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;SAC5E;KACD;IAED,OAAO,WAAW,CAAC;AACpB,CAAC;AAVD,wCAUC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { AxiosRequestConfig, AxiosRequestHeaders } from \"axios\";\nimport { IR11sResponse } from \"./restWrapper\";\n\nexport abstract class RestWrapper {\n\tconstructor(\n\t\tprotected readonly baseurl?: string,\n\t\tprotected defaultQueryString: QueryStringType = {},\n\t\tprotected readonly maxBodyLength = 1000 * 1024 * 1024,\n\t\tprotected readonly maxContentLength = 1000 * 1024 * 1024,\n\t) {}\n\n\tpublic async get<T>(\n\t\turl: string,\n\t\tqueryString?: QueryStringType,\n\t\theaders?: AxiosRequestHeaders,\n\t\tadditionalOptions?: Partial<\n\t\t\tOmit<\n\t\t\t\tAxiosRequestConfig,\n\t\t\t\t\"baseURL\" | \"headers\" | \"maxBodyLength\" | \"maxContentLength\" | \"method\" | \"url\"\n\t\t\t>\n\t\t>,\n\t): Promise<IR11sResponse<T>> {\n\t\tconst options: AxiosRequestConfig = {\n\t\t\t...additionalOptions,\n\t\t\tbaseURL: this.baseurl,\n\t\t\theaders,\n\t\t\tmaxBodyLength: this.maxBodyLength,\n\t\t\tmaxContentLength: this.maxContentLength,\n\t\t\tmethod: \"GET\",\n\t\t\turl: `${url}${this.generateQueryString(queryString)}`,\n\t\t};\n\t\treturn this.request<T>(options, 200);\n\t}\n\n\tpublic async post<T>(\n\t\turl: string,\n\t\trequestBody: any,\n\t\tqueryString?: QueryStringType,\n\t\theaders?: AxiosRequestHeaders,\n\t\tadditionalOptions?: Partial<\n\t\t\tOmit<\n\t\t\t\tAxiosRequestConfig,\n\t\t\t\t\"baseURL\" | \"headers\" | \"maxBodyLength\" | \"maxContentLength\" | \"method\" | \"url\"\n\t\t\t>\n\t\t>,\n\t): Promise<IR11sResponse<T>> {\n\t\tconst options: AxiosRequestConfig = {\n\t\t\t...additionalOptions,\n\t\t\tbaseURL: this.baseurl,\n\t\t\tdata: requestBody,\n\t\t\theaders,\n\t\t\tmaxBodyLength: this.maxBodyLength,\n\t\t\tmaxContentLength: this.maxContentLength,\n\t\t\tmethod: \"POST\",\n\t\t\turl: `${url}${this.generateQueryString(queryString)}`,\n\t\t};\n\t\treturn this.request<T>(options, 201);\n\t}\n\n\tpublic async delete<T>(\n\t\turl: string,\n\t\tqueryString?: QueryStringType,\n\t\theaders?: AxiosRequestHeaders,\n\t\tadditionalOptions?: Partial<\n\t\t\tOmit<\n\t\t\t\tAxiosRequestConfig,\n\t\t\t\t\"baseURL\" | \"headers\" | \"maxBodyLength\" | \"maxContentLength\" | \"method\" | \"url\"\n\t\t\t>\n\t\t>,\n\t): Promise<IR11sResponse<T>> {\n\t\tconst options: AxiosRequestConfig = {\n\t\t\t...additionalOptions,\n\t\t\tbaseURL: this.baseurl,\n\t\t\theaders,\n\t\t\tmaxBodyLength: this.maxBodyLength,\n\t\t\tmaxContentLength: this.maxContentLength,\n\t\t\tmethod: \"DELETE\",\n\t\t\turl: `${url}${this.generateQueryString(queryString)}`,\n\t\t};\n\t\treturn this.request<T>(options, 204);\n\t}\n\n\tpublic async patch<T>(\n\t\turl: string,\n\t\trequestBody: any,\n\t\tqueryString?: QueryStringType,\n\t\theaders?: AxiosRequestHeaders,\n\t\tadditionalOptions?: Partial<\n\t\t\tOmit<\n\t\t\t\tAxiosRequestConfig,\n\t\t\t\t\"baseURL\" | \"headers\" | \"maxBodyLength\" | \"maxContentLength\" | \"method\" | \"url\"\n\t\t\t>\n\t\t>,\n\t): Promise<IR11sResponse<T>> {\n\t\tconst options: AxiosRequestConfig = {\n\t\t\t...additionalOptions,\n\t\t\tbaseURL: this.baseurl,\n\t\t\tdata: requestBody,\n\t\t\theaders,\n\t\t\tmaxBodyLength: this.maxBodyLength,\n\t\t\tmaxContentLength: this.maxContentLength,\n\t\t\tmethod: \"PATCH\",\n\t\t\turl: `${url}${this.generateQueryString(queryString)}`,\n\t\t};\n\t\treturn this.request<T>(options, 200);\n\t}\n\n\tprotected abstract request<T>(\n\t\toptions: AxiosRequestConfig,\n\t\tstatusCode: number,\n\t\taddNetworkCallProps?: boolean,\n\t): Promise<IR11sResponse<T>>;\n\n\tprotected generateQueryString(queryStringValues?: QueryStringType) {\n\t\tif (this.defaultQueryString || queryStringValues) {\n\t\t\tconst queryStringMap = { ...this.defaultQueryString, ...queryStringValues };\n\n\t\t\treturn getQueryString(queryStringMap);\n\t\t}\n\n\t\treturn \"\";\n\t}\n}\n\n/**\n * Generates query string from the given query parameters.\n * @param queryParams - Query parameters from which to create a query.\n */\nexport function getQueryString(queryParams: QueryStringType): string {\n\tlet queryString = \"\";\n\tfor (const key of Object.keys(queryParams)) {\n\t\tif (queryParams[key] !== undefined) {\n\t\t\tconst startChar = queryString === \"\" ? \"?\" : \"&\";\n\t\t\tqueryString += `${startChar}${key}=${encodeURIComponent(queryParams[key])}`;\n\t\t}\n\t}\n\n\treturn queryString;\n}\n\nexport type QueryStringType = Record<string, string | number | boolean>;\n"]}
@@ -37,4 +37,4 @@ class RetriableGitManager {
37
37
  }
38
38
  }
39
39
  exports.RetriableGitManager = RetriableGitManager;
40
- //# sourceMappingURL=retriableGitManager.js.map
40
+ //# sourceMappingURL=retriableGitManager.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retriableGitManager.cjs","sourceRoot":"","sources":["../src/retriableGitManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,+DAA4D;AAM5D,MAAa,mBAAmB;IAC/B,YACkB,kBAA+B,EAC/B,MAA2B;QAD3B,uBAAkB,GAAlB,kBAAkB,CAAa;QAC/B,WAAM,GAAN,MAAM,CAAqB;IAC1C,CAAC;IAEG,KAAK,CAAC,UAAU,CACtB,GAAW,EACX,KAAa;QAEb,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,EAC1D,uBAAuB,CACvB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,SAAkB;QACpD,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,EAC5D,oBAAoB,CACpB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,EAChD,oBAAoB,CACpB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,OAAe,EACf,QAAgB;QAEhB,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,EACjE,uBAAuB,CACvB,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,aAAa,CAAC,MAA6B;QACvD,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,MAAM,CAAC,EACzD,0BAA0B,CAC1B,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,OAA6B;QAE7B,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,OAAO,CAAC,EAC1D,0BAA0B,CAC1B,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,EACpD,uBAAuB,CACvB,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACpE,OAAO,IAAA,2BAAY,EAClB,GAAG,EACH,QAAQ,EACR,IAAI,CAAC,MAAM,EACX,EAAE,CACF,CAAC;IACH,CAAC;CACD;AAvED,kDAuEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type * as git from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { runWithRetry } from \"@fluidframework/driver-utils\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport { IGitManager } from \"./storageContracts\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport class RetriableGitManager implements IGitManager {\n\tconstructor(\n\t\tprivate readonly internalGitManager: IGitManager,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {}\n\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<git.ICommitDetails[]>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.getCommits(sha, count),\n\t\t\t\"gitManager_getCommits\",\n\t\t);\n\t}\n\n\tpublic async getTree(root: string, recursive: boolean): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.getTree(root, recursive),\n\t\t\t\"gitManager_getTree\",\n\t\t);\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<git.IBlob>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.getBlob(sha),\n\t\t\t\"gitManager_getBlob\",\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tcontent: string,\n\t\tencoding: string,\n\t): Promise<IR11sResponse<git.ICreateBlobResponse>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.createBlob(content, encoding),\n\t\t\t\"gitManager_createBlob\",\n\t\t);\n\t}\n\n\tpublic async createGitTree(params: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.createGitTree(params),\n\t\t\t\"gitManager_createGitTree\",\n\t\t);\n\t}\n\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.createSummary(summary),\n\t\t\t\"gitManager_createSummary\",\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.getSnapshot(sha),\n\t\t\t\"gitManager_getSummary\",\n\t\t);\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(\n\t\t\tapi,\n\t\t\tcallName,\n\t\t\tthis.logger,\n\t\t\t{}, // progress\n\t\t);\n\t}\n}\n"]}
@@ -0,0 +1,92 @@
1
+ import { IDocumentService } from '@fluidframework/driver-definitions';
2
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
3
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
4
+ import { ISession } from '@fluidframework/server-services-client';
5
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
6
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
7
+ import { ITokenClaims } from '@fluidframework/protocol-definitions';
8
+
9
+ /* Excluded from this release type: DefaultTokenProvider */
10
+
11
+ /* Excluded from this release type: DocumentPostCreateError */
12
+
13
+ /* Excluded from this release type: IRouterliciousDriverPolicies */
14
+
15
+ /**
16
+ * Abstracts the token fetching mechanism for a hosting application.
17
+ * The hosting application is responsible for providing an implementation.
18
+ * @alpha
19
+ */
20
+ export declare interface ITokenProvider {
21
+ /**
22
+ * Fetches the orderer token from host.
23
+ *
24
+ * @param tenantId - Tenant ID.
25
+ * @param documentId - Optional. Document ID is only required for document-scoped requests.
26
+ * @param refresh - Optional flag indicating whether token fetch must bypass local cache.
27
+ * This likely indicates that some previous request failed authorization due to an expired token,
28
+ * and so a fresh token is required.
29
+ *
30
+ * Default: `false`.
31
+ *
32
+ * NOTE: This parameter will be made required in the future.
33
+ */
34
+ fetchOrdererToken(tenantId: string, documentId?: string, refresh?: boolean): Promise<ITokenResponse>;
35
+ /**
36
+ * Fetches the storage token from host.
37
+ *
38
+ * @param tenantId - Tenant ID.
39
+ * @param documentId - Document ID.
40
+ * @param refresh - Optional flag indicating whether token fetch must bypass local cache.
41
+ * This likely indicates that some previous request failed authorization due to an expired token,
42
+ * and so a fresh token is required.
43
+ *
44
+ * Default: `false`.
45
+ *
46
+ * NOTE: This parameter will be made required in the future.
47
+ */
48
+ fetchStorageToken(tenantId: string, documentId: string, refresh?: boolean): Promise<ITokenResponse>;
49
+ /**
50
+ * A callback triggered directly after creating the document. In this callback the client has the opportunity, to
51
+ * verify against an authorization service, if the user who claims to create the document is the same user who
52
+ * created it.
53
+ *
54
+ * @remarks Notes:
55
+ *
56
+ * * Using the callback may have performance impact on the document creation process.
57
+ *
58
+ * * Any exceptions thrown in the callback would fail the creation workflow
59
+ * (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
60
+ *
61
+ * @param documentId - Document ID.
62
+ * @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
63
+ * and document id. It can be used to validate the identity of the document creator.
64
+ */
65
+ documentPostCreateCallback?(documentId: string, creationToken: string): Promise<void>;
66
+ }
67
+
68
+ /**
69
+ * @alpha
70
+ */
71
+ export declare interface ITokenResponse {
72
+ /**
73
+ * {@link https://jwt.io/introduction/ | JSON Web Token (JWT)} value.
74
+ */
75
+ jwt: string;
76
+ /**
77
+ * A flag indicating whether token was obtained from local cache.
78
+ *
79
+ * @remarks `undefined` indicates that the source of the token could not be determined.
80
+ */
81
+ fromCache?: boolean;
82
+ }
83
+
84
+ /* Excluded from this release type: ITokenService */
85
+
86
+ /* Excluded from this release type: RouterliciousDocumentServiceFactory */
87
+
88
+ /* Excluded from this release type: RouterliciousErrorType */
89
+
90
+ /* Excluded from this release type: RouterliciousErrorTypes */
91
+
92
+ export { }
@@ -0,0 +1,35 @@
1
+ import { IDocumentService } from '@fluidframework/driver-definitions';
2
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
3
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
4
+ import { ISession } from '@fluidframework/server-services-client';
5
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
6
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
7
+ import { ITokenClaims } from '@fluidframework/protocol-definitions';
8
+
9
+ /* Excluded from this release type: DefaultTokenProvider */
10
+
11
+ /* Excluded from this release type: DocumentPostCreateError */
12
+
13
+ /* Excluded from this release type: IDocumentService */
14
+
15
+ /* Excluded from this release type: IDocumentServiceFactory */
16
+
17
+ /* Excluded from this release type: IResolvedUrl */
18
+
19
+ /* Excluded from this release type: IRouterliciousDriverPolicies */
20
+
21
+ /* Excluded from this release type: ITelemetryBaseLogger */
22
+
23
+ /* Excluded from this release type: ITokenProvider */
24
+
25
+ /* Excluded from this release type: ITokenResponse */
26
+
27
+ /* Excluded from this release type: ITokenService */
28
+
29
+ /* Excluded from this release type: RouterliciousDocumentServiceFactory */
30
+
31
+ /* Excluded from this release type: RouterliciousErrorType */
32
+
33
+ /* Excluded from this release type: RouterliciousErrorTypes */
34
+
35
+ export { }
@@ -0,0 +1,35 @@
1
+ import { IDocumentService } from '@fluidframework/driver-definitions';
2
+ import { IDocumentServiceFactory } from '@fluidframework/driver-definitions';
3
+ import { IResolvedUrl } from '@fluidframework/driver-definitions';
4
+ import { ISession } from '@fluidframework/server-services-client';
5
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
6
+ import { ITelemetryBaseLogger } from '@fluidframework/core-interfaces';
7
+ import { ITokenClaims } from '@fluidframework/protocol-definitions';
8
+
9
+ /* Excluded from this release type: DefaultTokenProvider */
10
+
11
+ /* Excluded from this release type: DocumentPostCreateError */
12
+
13
+ /* Excluded from this release type: IDocumentService */
14
+
15
+ /* Excluded from this release type: IDocumentServiceFactory */
16
+
17
+ /* Excluded from this release type: IResolvedUrl */
18
+
19
+ /* Excluded from this release type: IRouterliciousDriverPolicies */
20
+
21
+ /* Excluded from this release type: ITelemetryBaseLogger */
22
+
23
+ /* Excluded from this release type: ITokenProvider */
24
+
25
+ /* Excluded from this release type: ITokenResponse */
26
+
27
+ /* Excluded from this release type: ITokenService */
28
+
29
+ /* Excluded from this release type: RouterliciousDocumentServiceFactory */
30
+
31
+ /* Excluded from this release type: RouterliciousErrorType */
32
+
33
+ /* Excluded from this release type: RouterliciousErrorTypes */
34
+
35
+ export { }