@typespec/ts-http-runtime 0.1.0-alpha.20250325.2 → 0.2.0-alpha.20250326.3

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 (261) hide show
  1. package/dist/browser/auth/credentials.d.ts +77 -0
  2. package/dist/browser/auth/credentials.js +27 -0
  3. package/dist/browser/auth/credentials.js.map +1 -0
  4. package/dist/browser/auth/oauth2Flows.d.ts +57 -0
  5. package/dist/browser/{abort-controller/AbortSignalLike.js → auth/oauth2Flows.js} +1 -1
  6. package/dist/browser/auth/oauth2Flows.js.map +1 -0
  7. package/dist/browser/auth/schemes.d.ts +53 -0
  8. package/dist/{esm/abort-controller/AbortSignalLike.js → browser/auth/schemes.js} +1 -1
  9. package/dist/browser/auth/schemes.js.map +1 -0
  10. package/dist/browser/client/clientHelpers.d.ts +1 -20
  11. package/dist/browser/client/clientHelpers.js +21 -30
  12. package/dist/browser/client/clientHelpers.js.map +1 -1
  13. package/dist/browser/client/common.d.ts +13 -15
  14. package/dist/browser/client/common.js.map +1 -1
  15. package/dist/browser/client/getClient.d.ts +1 -9
  16. package/dist/browser/client/getClient.js +8 -16
  17. package/dist/browser/client/getClient.js.map +1 -1
  18. package/dist/browser/constants.js +1 -1
  19. package/dist/browser/constants.js.map +1 -1
  20. package/dist/browser/index.d.ts +3 -3
  21. package/dist/browser/index.js +2 -2
  22. package/dist/browser/index.js.map +1 -1
  23. package/dist/browser/interfaces.d.ts +10 -2
  24. package/dist/browser/interfaces.js.map +1 -1
  25. package/dist/browser/pipelineRequest.d.ts +1 -2
  26. package/dist/browser/pipelineRequest.js.map +1 -1
  27. package/dist/browser/policies/auth/apiKeyAuthenticationPolicy.d.ts +30 -0
  28. package/dist/browser/policies/auth/apiKeyAuthenticationPolicy.js +31 -0
  29. package/dist/browser/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -0
  30. package/dist/browser/policies/auth/basicAuthenticationPolicy.d.ts +30 -0
  31. package/dist/browser/policies/auth/basicAuthenticationPolicy.js +31 -0
  32. package/dist/browser/policies/auth/basicAuthenticationPolicy.js.map +1 -0
  33. package/dist/browser/policies/auth/bearerAuthenticationPolicy.d.ts +30 -0
  34. package/dist/browser/policies/auth/bearerAuthenticationPolicy.js +31 -0
  35. package/dist/browser/policies/auth/bearerAuthenticationPolicy.js.map +1 -0
  36. package/dist/browser/policies/auth/checkInsecureConnection.d.ts +9 -0
  37. package/dist/browser/policies/auth/checkInsecureConnection.js +50 -0
  38. package/dist/browser/policies/auth/checkInsecureConnection.js.map +1 -0
  39. package/dist/browser/policies/auth/oauth2AuthenticationPolicy.d.ts +31 -0
  40. package/dist/browser/policies/auth/oauth2AuthenticationPolicy.js +31 -0
  41. package/dist/browser/policies/auth/oauth2AuthenticationPolicy.js.map +1 -0
  42. package/dist/browser/util/aborterUtils.d.ts +3 -4
  43. package/dist/browser/util/aborterUtils.js.map +1 -1
  44. package/dist/browser/util/helpers.d.ts +1 -2
  45. package/dist/browser/util/helpers.js.map +1 -1
  46. package/dist/commonjs/auth/credentials.d.ts +77 -0
  47. package/dist/commonjs/auth/credentials.js +33 -0
  48. package/dist/commonjs/auth/credentials.js.map +1 -0
  49. package/dist/commonjs/auth/oauth2Flows.d.ts +57 -0
  50. package/dist/commonjs/{abort-controller/AbortSignalLike.js → auth/oauth2Flows.js} +1 -1
  51. package/dist/commonjs/auth/oauth2Flows.js.map +1 -0
  52. package/dist/commonjs/auth/schemes.d.ts +53 -0
  53. package/dist/commonjs/auth/schemes.js +5 -0
  54. package/dist/commonjs/auth/schemes.js.map +1 -0
  55. package/dist/commonjs/client/clientHelpers.d.ts +1 -20
  56. package/dist/commonjs/client/clientHelpers.js +21 -31
  57. package/dist/commonjs/client/clientHelpers.js.map +1 -1
  58. package/dist/commonjs/client/common.d.ts +13 -15
  59. package/dist/commonjs/client/common.js.map +1 -1
  60. package/dist/commonjs/client/getClient.d.ts +1 -9
  61. package/dist/commonjs/client/getClient.js +8 -16
  62. package/dist/commonjs/client/getClient.js.map +1 -1
  63. package/dist/commonjs/constants.js +1 -1
  64. package/dist/commonjs/constants.js.map +1 -1
  65. package/dist/commonjs/index.d.ts +3 -3
  66. package/dist/commonjs/index.js +4 -5
  67. package/dist/commonjs/index.js.map +1 -1
  68. package/dist/commonjs/interfaces.d.ts +10 -2
  69. package/dist/commonjs/interfaces.js.map +1 -1
  70. package/dist/commonjs/pipelineRequest.d.ts +1 -2
  71. package/dist/commonjs/pipelineRequest.js.map +1 -1
  72. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.d.ts +30 -0
  73. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js +35 -0
  74. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -0
  75. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.d.ts +30 -0
  76. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js +35 -0
  77. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js.map +1 -0
  78. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.d.ts +30 -0
  79. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js +35 -0
  80. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js.map +1 -0
  81. package/dist/commonjs/policies/auth/checkInsecureConnection.d.ts +9 -0
  82. package/dist/commonjs/policies/auth/checkInsecureConnection.js +53 -0
  83. package/dist/commonjs/policies/auth/checkInsecureConnection.js.map +1 -0
  84. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.d.ts +31 -0
  85. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js +35 -0
  86. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js.map +1 -0
  87. package/dist/commonjs/util/aborterUtils.d.ts +3 -4
  88. package/dist/commonjs/util/aborterUtils.js.map +1 -1
  89. package/dist/commonjs/util/helpers.d.ts +1 -2
  90. package/dist/commonjs/util/helpers.js.map +1 -1
  91. package/dist/esm/auth/credentials.d.ts +77 -0
  92. package/dist/esm/auth/credentials.js +27 -0
  93. package/dist/esm/auth/credentials.js.map +1 -0
  94. package/dist/esm/auth/oauth2Flows.d.ts +57 -0
  95. package/dist/{react-native/abort-controller/AbortSignalLike.js → esm/auth/oauth2Flows.js} +1 -1
  96. package/dist/esm/auth/oauth2Flows.js.map +1 -0
  97. package/dist/esm/auth/schemes.d.ts +53 -0
  98. package/dist/esm/auth/schemes.js +4 -0
  99. package/dist/esm/auth/schemes.js.map +1 -0
  100. package/dist/esm/client/clientHelpers.d.ts +1 -20
  101. package/dist/esm/client/clientHelpers.js +21 -30
  102. package/dist/esm/client/clientHelpers.js.map +1 -1
  103. package/dist/esm/client/common.d.ts +13 -15
  104. package/dist/esm/client/common.js.map +1 -1
  105. package/dist/esm/client/getClient.d.ts +1 -9
  106. package/dist/esm/client/getClient.js +8 -16
  107. package/dist/esm/client/getClient.js.map +1 -1
  108. package/dist/esm/constants.js +1 -1
  109. package/dist/esm/constants.js.map +1 -1
  110. package/dist/esm/index.d.ts +3 -3
  111. package/dist/esm/index.js +2 -2
  112. package/dist/esm/index.js.map +1 -1
  113. package/dist/esm/interfaces.d.ts +10 -2
  114. package/dist/esm/interfaces.js.map +1 -1
  115. package/dist/esm/pipelineRequest.d.ts +1 -2
  116. package/dist/esm/pipelineRequest.js.map +1 -1
  117. package/dist/esm/policies/auth/apiKeyAuthenticationPolicy.d.ts +30 -0
  118. package/dist/esm/policies/auth/apiKeyAuthenticationPolicy.js +31 -0
  119. package/dist/esm/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -0
  120. package/dist/esm/policies/auth/basicAuthenticationPolicy.d.ts +30 -0
  121. package/dist/esm/policies/auth/basicAuthenticationPolicy.js +31 -0
  122. package/dist/esm/policies/auth/basicAuthenticationPolicy.js.map +1 -0
  123. package/dist/esm/policies/auth/bearerAuthenticationPolicy.d.ts +30 -0
  124. package/dist/esm/policies/auth/bearerAuthenticationPolicy.js +31 -0
  125. package/dist/esm/policies/auth/bearerAuthenticationPolicy.js.map +1 -0
  126. package/dist/esm/policies/auth/checkInsecureConnection.d.ts +9 -0
  127. package/dist/esm/policies/auth/checkInsecureConnection.js +50 -0
  128. package/dist/esm/policies/auth/checkInsecureConnection.js.map +1 -0
  129. package/dist/esm/policies/auth/oauth2AuthenticationPolicy.d.ts +31 -0
  130. package/dist/esm/policies/auth/oauth2AuthenticationPolicy.js +31 -0
  131. package/dist/esm/policies/auth/oauth2AuthenticationPolicy.js.map +1 -0
  132. package/dist/esm/util/aborterUtils.d.ts +3 -4
  133. package/dist/esm/util/aborterUtils.js.map +1 -1
  134. package/dist/esm/util/helpers.d.ts +1 -2
  135. package/dist/esm/util/helpers.js.map +1 -1
  136. package/dist/react-native/auth/credentials.d.ts +77 -0
  137. package/dist/react-native/auth/credentials.js +27 -0
  138. package/dist/react-native/auth/credentials.js.map +1 -0
  139. package/dist/react-native/auth/oauth2Flows.d.ts +57 -0
  140. package/dist/react-native/auth/oauth2Flows.js +4 -0
  141. package/dist/react-native/auth/oauth2Flows.js.map +1 -0
  142. package/dist/react-native/auth/schemes.d.ts +53 -0
  143. package/dist/react-native/auth/schemes.js +4 -0
  144. package/dist/react-native/auth/schemes.js.map +1 -0
  145. package/dist/react-native/client/clientHelpers.d.ts +1 -20
  146. package/dist/react-native/client/clientHelpers.js +21 -30
  147. package/dist/react-native/client/clientHelpers.js.map +1 -1
  148. package/dist/react-native/client/common.d.ts +13 -15
  149. package/dist/react-native/client/common.js.map +1 -1
  150. package/dist/react-native/client/getClient.d.ts +1 -9
  151. package/dist/react-native/client/getClient.js +8 -16
  152. package/dist/react-native/client/getClient.js.map +1 -1
  153. package/dist/react-native/constants.js +1 -1
  154. package/dist/react-native/constants.js.map +1 -1
  155. package/dist/react-native/index.d.ts +3 -3
  156. package/dist/react-native/index.js +2 -2
  157. package/dist/react-native/index.js.map +1 -1
  158. package/dist/react-native/interfaces.d.ts +10 -2
  159. package/dist/react-native/interfaces.js.map +1 -1
  160. package/dist/react-native/pipelineRequest.d.ts +1 -2
  161. package/dist/react-native/pipelineRequest.js.map +1 -1
  162. package/dist/react-native/policies/auth/apiKeyAuthenticationPolicy.d.ts +30 -0
  163. package/dist/react-native/policies/auth/apiKeyAuthenticationPolicy.js +31 -0
  164. package/dist/react-native/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -0
  165. package/dist/react-native/policies/auth/basicAuthenticationPolicy.d.ts +30 -0
  166. package/dist/react-native/policies/auth/basicAuthenticationPolicy.js +31 -0
  167. package/dist/react-native/policies/auth/basicAuthenticationPolicy.js.map +1 -0
  168. package/dist/react-native/policies/auth/bearerAuthenticationPolicy.d.ts +30 -0
  169. package/dist/react-native/policies/auth/bearerAuthenticationPolicy.js +31 -0
  170. package/dist/react-native/policies/auth/bearerAuthenticationPolicy.js.map +1 -0
  171. package/dist/react-native/policies/auth/checkInsecureConnection.d.ts +9 -0
  172. package/dist/react-native/policies/auth/checkInsecureConnection.js +50 -0
  173. package/dist/react-native/policies/auth/checkInsecureConnection.js.map +1 -0
  174. package/dist/react-native/policies/auth/oauth2AuthenticationPolicy.d.ts +31 -0
  175. package/dist/react-native/policies/auth/oauth2AuthenticationPolicy.js +31 -0
  176. package/dist/react-native/policies/auth/oauth2AuthenticationPolicy.js.map +1 -0
  177. package/dist/react-native/util/aborterUtils.d.ts +3 -4
  178. package/dist/react-native/util/aborterUtils.js.map +1 -1
  179. package/dist/react-native/util/helpers.d.ts +1 -2
  180. package/dist/react-native/util/helpers.js.map +1 -1
  181. package/package.json +1 -1
  182. package/dist/browser/abort-controller/AbortSignalLike.d.ts +0 -19
  183. package/dist/browser/abort-controller/AbortSignalLike.js.map +0 -1
  184. package/dist/browser/accessTokenCache.d.ts +0 -40
  185. package/dist/browser/accessTokenCache.js +0 -32
  186. package/dist/browser/accessTokenCache.js.map +0 -1
  187. package/dist/browser/auth/keyCredential.d.ts +0 -16
  188. package/dist/browser/auth/keyCredential.js +0 -12
  189. package/dist/browser/auth/keyCredential.js.map +0 -1
  190. package/dist/browser/auth/tokenCredential.d.ts +0 -71
  191. package/dist/browser/auth/tokenCredential.js +0 -19
  192. package/dist/browser/auth/tokenCredential.js.map +0 -1
  193. package/dist/browser/client/keyCredentialAuthenticationPolicy.d.ts +0 -8
  194. package/dist/browser/client/keyCredentialAuthenticationPolicy.js +0 -16
  195. package/dist/browser/client/keyCredentialAuthenticationPolicy.js.map +0 -1
  196. package/dist/browser/policies/bearerTokenAuthenticationPolicy.d.ts +0 -99
  197. package/dist/browser/policies/bearerTokenAuthenticationPolicy.js +0 -107
  198. package/dist/browser/policies/bearerTokenAuthenticationPolicy.js.map +0 -1
  199. package/dist/browser/util/tokenCycler.d.ts +0 -45
  200. package/dist/browser/util/tokenCycler.js +0 -162
  201. package/dist/browser/util/tokenCycler.js.map +0 -1
  202. package/dist/commonjs/abort-controller/AbortSignalLike.d.ts +0 -19
  203. package/dist/commonjs/abort-controller/AbortSignalLike.js.map +0 -1
  204. package/dist/commonjs/accessTokenCache.d.ts +0 -40
  205. package/dist/commonjs/accessTokenCache.js +0 -36
  206. package/dist/commonjs/accessTokenCache.js.map +0 -1
  207. package/dist/commonjs/auth/keyCredential.d.ts +0 -16
  208. package/dist/commonjs/auth/keyCredential.js +0 -15
  209. package/dist/commonjs/auth/keyCredential.js.map +0 -1
  210. package/dist/commonjs/auth/tokenCredential.d.ts +0 -71
  211. package/dist/commonjs/auth/tokenCredential.js +0 -22
  212. package/dist/commonjs/auth/tokenCredential.js.map +0 -1
  213. package/dist/commonjs/client/keyCredentialAuthenticationPolicy.d.ts +0 -8
  214. package/dist/commonjs/client/keyCredentialAuthenticationPolicy.js +0 -20
  215. package/dist/commonjs/client/keyCredentialAuthenticationPolicy.js.map +0 -1
  216. package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.d.ts +0 -99
  217. package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.js +0 -111
  218. package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.js.map +0 -1
  219. package/dist/commonjs/util/tokenCycler.d.ts +0 -45
  220. package/dist/commonjs/util/tokenCycler.js +0 -166
  221. package/dist/commonjs/util/tokenCycler.js.map +0 -1
  222. package/dist/esm/abort-controller/AbortSignalLike.d.ts +0 -19
  223. package/dist/esm/abort-controller/AbortSignalLike.js.map +0 -1
  224. package/dist/esm/accessTokenCache.d.ts +0 -40
  225. package/dist/esm/accessTokenCache.js +0 -32
  226. package/dist/esm/accessTokenCache.js.map +0 -1
  227. package/dist/esm/auth/keyCredential.d.ts +0 -16
  228. package/dist/esm/auth/keyCredential.js +0 -12
  229. package/dist/esm/auth/keyCredential.js.map +0 -1
  230. package/dist/esm/auth/tokenCredential.d.ts +0 -71
  231. package/dist/esm/auth/tokenCredential.js +0 -19
  232. package/dist/esm/auth/tokenCredential.js.map +0 -1
  233. package/dist/esm/client/keyCredentialAuthenticationPolicy.d.ts +0 -8
  234. package/dist/esm/client/keyCredentialAuthenticationPolicy.js +0 -16
  235. package/dist/esm/client/keyCredentialAuthenticationPolicy.js.map +0 -1
  236. package/dist/esm/policies/bearerTokenAuthenticationPolicy.d.ts +0 -99
  237. package/dist/esm/policies/bearerTokenAuthenticationPolicy.js +0 -107
  238. package/dist/esm/policies/bearerTokenAuthenticationPolicy.js.map +0 -1
  239. package/dist/esm/util/tokenCycler.d.ts +0 -45
  240. package/dist/esm/util/tokenCycler.js +0 -162
  241. package/dist/esm/util/tokenCycler.js.map +0 -1
  242. package/dist/react-native/abort-controller/AbortSignalLike.d.ts +0 -19
  243. package/dist/react-native/abort-controller/AbortSignalLike.js.map +0 -1
  244. package/dist/react-native/accessTokenCache.d.ts +0 -40
  245. package/dist/react-native/accessTokenCache.js +0 -32
  246. package/dist/react-native/accessTokenCache.js.map +0 -1
  247. package/dist/react-native/auth/keyCredential.d.ts +0 -16
  248. package/dist/react-native/auth/keyCredential.js +0 -12
  249. package/dist/react-native/auth/keyCredential.js.map +0 -1
  250. package/dist/react-native/auth/tokenCredential.d.ts +0 -71
  251. package/dist/react-native/auth/tokenCredential.js +0 -19
  252. package/dist/react-native/auth/tokenCredential.js.map +0 -1
  253. package/dist/react-native/client/keyCredentialAuthenticationPolicy.d.ts +0 -8
  254. package/dist/react-native/client/keyCredentialAuthenticationPolicy.js +0 -16
  255. package/dist/react-native/client/keyCredentialAuthenticationPolicy.js.map +0 -1
  256. package/dist/react-native/policies/bearerTokenAuthenticationPolicy.d.ts +0 -99
  257. package/dist/react-native/policies/bearerTokenAuthenticationPolicy.js +0 -107
  258. package/dist/react-native/policies/bearerTokenAuthenticationPolicy.js.map +0 -1
  259. package/dist/react-native/util/tokenCycler.d.ts +0 -45
  260. package/dist/react-native/util/tokenCycler.js +0 -162
  261. package/dist/react-native/util/tokenCycler.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,OAAO,CAAC;AAE3C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const SDK_VERSION: string = \"0.1.0\";\n\nexport const DEFAULT_RETRY_POLICY_COUNT = 3;\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAW,OAAO,CAAC;AAE3C,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const SDK_VERSION: string = \"0.2.0\";\n\nexport const DEFAULT_RETRY_POLICY_COUNT = 3;\n"]}
@@ -10,13 +10,13 @@ declare global {
10
10
  interface TransformStream<I = any, O = any> {
11
11
  }
12
12
  }
13
- export { AbortSignalLike } from "./abort-controller/AbortSignalLike.js";
14
13
  export { AbortError } from "./abort-controller/AbortError.js";
15
14
  export { createClientLogger, TypeSpecRuntimeLogger, type TypeSpecRuntimeClientLogger, type Debugger, } from "./logger/logger.js";
16
15
  export type { BodyPart, FormDataValue, RawHttpHeaders, KeyObject, PxfObject, HttpClient, PipelineRequest, PipelineResponse, SendRequest, TlsSettings, Agent, RequestBodyType, FormDataMap, HttpHeaders, HttpMethods, MultipartRequestBody, TransferProgressEvent, ProxySettings, RawHttpHeadersInput, PipelineRetryOptions, } from "./interfaces.js";
17
16
  export { createHttpHeaders } from "./httpHeaders.js";
18
- export { isKeyCredential, type KeyCredential } from "./auth/keyCredential.js";
19
- export { isTokenCredential, type TokenCredential, type GetTokenOptions, type AccessToken, } from "./auth/tokenCredential.js";
17
+ export * from "./auth/schemes.js";
18
+ export * from "./auth/oauth2Flows.js";
19
+ export { type BasicCredential, type BearerTokenCredential, type OAuth2TokenCredential, type GetOAuth2TokenOptions, type GetBearerTokenOptions, type ApiKeyCredential, type ClientCredential, } from "./auth/credentials.js";
20
20
  export { createPipelineRequest, type PipelineRequestOptions } from "./pipelineRequest.js";
21
21
  export type { Pipeline, PipelinePolicy, AddPolicyOptions, PipelinePhase } from "./pipeline.js";
22
22
  export { RestError, isRestError, type RestErrorOptions } from "./restError.js";
@@ -3,8 +3,8 @@
3
3
  export { AbortError } from "./abort-controller/AbortError.js";
4
4
  export { createClientLogger, TypeSpecRuntimeLogger, } from "./logger/logger.js";
5
5
  export { createHttpHeaders } from "./httpHeaders.js";
6
- export { isKeyCredential } from "./auth/keyCredential.js";
7
- export { isTokenCredential, } from "./auth/tokenCredential.js";
6
+ export * from "./auth/schemes.js";
7
+ export * from "./auth/oauth2Flows.js";
8
8
  export { createPipelineRequest } from "./pipelineRequest.js";
9
9
  export { RestError, isRestError } from "./restError.js";
10
10
  export { stringToUint8Array, uint8ArrayToString } from "./util/bytesEncoding.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAWlC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,oBAAoB,CAAC;AAuB5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EACL,iBAAiB,GAIlB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAE,SAAS,EAAE,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAqB,MAAM,yBAAyB,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport { AbortSignalLike } from \"./abort-controller/AbortSignalLike.js\";\nexport { AbortError } from \"./abort-controller/AbortError.js\";\nexport {\n createClientLogger,\n TypeSpecRuntimeLogger,\n type TypeSpecRuntimeClientLogger,\n type Debugger,\n} from \"./logger/logger.js\";\nexport type {\n BodyPart,\n FormDataValue,\n RawHttpHeaders,\n KeyObject,\n PxfObject,\n HttpClient,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n TlsSettings,\n Agent,\n RequestBodyType,\n FormDataMap,\n HttpHeaders,\n HttpMethods,\n MultipartRequestBody,\n TransferProgressEvent,\n ProxySettings,\n RawHttpHeadersInput,\n PipelineRetryOptions,\n} from \"./interfaces.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport { isKeyCredential, type KeyCredential } from \"./auth/keyCredential.js\";\nexport {\n isTokenCredential,\n type TokenCredential,\n type GetTokenOptions,\n type AccessToken,\n} from \"./auth/tokenCredential.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport type { Pipeline, PipelinePolicy, AddPolicyOptions, PipelinePhase } from \"./pipeline.js\";\nexport { RestError, isRestError, type RestErrorOptions } from \"./restError.js\";\nexport { stringToUint8Array, uint8ArrayToString, type EncodingType } from \"./util/bytesEncoding.js\";\nexport { getClient } from \"./client/getClient.js\";\nexport { operationOptionsToRequestParameters } from \"./client/operationOptionHelpers.js\";\nexport { createRestError } from \"./client/restError.js\";\nexport type {\n Client,\n ClientOptions,\n OperationOptions,\n AdditionalPolicyConfig,\n PathUnchecked,\n PathUncheckedResponse,\n HttpResponse,\n RawResponseCallback,\n OperationRequestOptions,\n PathParameters,\n ResourceMethods,\n PathParameterWithOptions,\n StreamableMethod,\n RequestParameters,\n HttpNodeStreamResponse,\n HttpBrowserStreamResponse,\n FullOperationResponse,\n} from \"./client/common.js\";\nexport type { PipelineOptions, TelemetryOptions } from \"./createPipelineFromOptions.js\";\nexport type { LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport type { RedirectPolicyOptions } from \"./policies/redirectPolicy.js\";\nexport type { UserAgentPolicyOptions } from \"./policies/userAgentPolicy.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,oBAAoB,CAAC;AAuB5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AAUtC,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAE1F,OAAO,EAAE,SAAS,EAAE,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAqB,MAAM,yBAAyB,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport { AbortError } from \"./abort-controller/AbortError.js\";\nexport {\n createClientLogger,\n TypeSpecRuntimeLogger,\n type TypeSpecRuntimeClientLogger,\n type Debugger,\n} from \"./logger/logger.js\";\nexport type {\n BodyPart,\n FormDataValue,\n RawHttpHeaders,\n KeyObject,\n PxfObject,\n HttpClient,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n TlsSettings,\n Agent,\n RequestBodyType,\n FormDataMap,\n HttpHeaders,\n HttpMethods,\n MultipartRequestBody,\n TransferProgressEvent,\n ProxySettings,\n RawHttpHeadersInput,\n PipelineRetryOptions,\n} from \"./interfaces.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport * from \"./auth/schemes.js\";\nexport * from \"./auth/oauth2Flows.js\";\nexport {\n type BasicCredential,\n type BearerTokenCredential,\n type OAuth2TokenCredential,\n type GetOAuth2TokenOptions,\n type GetBearerTokenOptions,\n type ApiKeyCredential,\n type ClientCredential,\n} from \"./auth/credentials.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport type { Pipeline, PipelinePolicy, AddPolicyOptions, PipelinePhase } from \"./pipeline.js\";\nexport { RestError, isRestError, type RestErrorOptions } from \"./restError.js\";\nexport { stringToUint8Array, uint8ArrayToString, type EncodingType } from \"./util/bytesEncoding.js\";\nexport { getClient } from \"./client/getClient.js\";\nexport { operationOptionsToRequestParameters } from \"./client/operationOptionHelpers.js\";\nexport { createRestError } from \"./client/restError.js\";\nexport type {\n Client,\n ClientOptions,\n OperationOptions,\n AdditionalPolicyConfig,\n PathUnchecked,\n PathUncheckedResponse,\n HttpResponse,\n RawResponseCallback,\n OperationRequestOptions,\n PathParameters,\n ResourceMethods,\n PathParameterWithOptions,\n StreamableMethod,\n RequestParameters,\n HttpNodeStreamResponse,\n HttpBrowserStreamResponse,\n FullOperationResponse,\n} from \"./client/common.js\";\nexport type { PipelineOptions, TelemetryOptions } from \"./createPipelineFromOptions.js\";\nexport type { LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport type { RedirectPolicyOptions } from \"./policies/redirectPolicy.js\";\nexport type { UserAgentPolicyOptions } from \"./policies/userAgentPolicy.js\";\n"]}
@@ -1,4 +1,4 @@
1
- import type { AbortSignalLike } from "./abort-controller/AbortSignalLike.js";
1
+ import type { AuthScheme } from "./auth/schemes.js";
2
2
  /**
3
3
  * A HttpHeaders collection represented as a simple JSON object.
4
4
  */
@@ -109,6 +109,14 @@ export interface Agent {
109
109
  * Metadata about a request being made by the pipeline.
110
110
  */
111
111
  export interface PipelineRequest {
112
+ /**
113
+ * List of authentication schemes used for this specific request.
114
+ * These schemes define how the request will be authenticated.
115
+ * If provided, these schemes override the client level authentication schemes.
116
+ *
117
+ * If no auth schemes are provided at client or request level, defaults to no auth.
118
+ */
119
+ authSchemes?: AuthScheme[];
112
120
  /**
113
121
  * The URL to make the request to.
114
122
  */
@@ -164,7 +172,7 @@ export interface PipelineRequest {
164
172
  /**
165
173
  * Used to abort the request later.
166
174
  */
167
- abortSignal?: AbortSignalLike;
175
+ abortSignal?: AbortSignal;
168
176
  /**
169
177
  * Callback which fires upon upload progress.
170
178
  */
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"./abort-controller/AbortSignalLike.js\";\n\n/**\n * A HttpHeaders collection represented as a simple JSON object.\n */\nexport type RawHttpHeaders = { [headerName: string]: string };\n\n/**\n * A HttpHeaders collection for input, represented as a simple JSON object.\n */\nexport type RawHttpHeadersInput = Record<string, string | number | boolean>;\n\n/**\n * Represents a set of HTTP headers on a request/response.\n * Header names are treated as case insensitive.\n */\nexport interface HttpHeaders extends Iterable<[string, string]> {\n /**\n * Returns the value of a specific header or undefined if not set.\n * @param name - The name of the header to retrieve.\n */\n get(name: string): string | undefined;\n /**\n * Returns true if the specified header exists.\n * @param name - The name of the header to check.\n */\n has(name: string): boolean;\n /**\n * Sets a specific header with a given value.\n * @param name - The name of the header to set.\n * @param value - The value to use for the header.\n */\n set(name: string, value: string | number | boolean): void;\n /**\n * Removes a specific header from the collection.\n * @param name - The name of the header to delete.\n */\n delete(name: string): void;\n /**\n * Accesses a raw JS object that acts as a simple map\n * of header names to values.\n */\n toJSON(options?: { preserveCase?: boolean }): RawHttpHeaders;\n}\n\n/**\n * A part of the request body in a multipart request.\n */\nexport interface BodyPart {\n /**\n * The headers for this part of the multipart request.\n */\n headers: HttpHeaders;\n\n /**\n * The body of this part of the multipart request.\n */\n body:\n | ((() => ReadableStream<Uint8Array>) | (() => NodeJS.ReadableStream))\n | ReadableStream<Uint8Array>\n | NodeJS.ReadableStream\n | Uint8Array\n | Blob;\n}\n\n/**\n * A request body consisting of multiple parts.\n */\nexport interface MultipartRequestBody {\n /**\n * The parts of the request body.\n */\n parts: BodyPart[];\n\n /**\n * The boundary separating each part of the request body.\n * If not specified, a random boundary will be generated.\n *\n * When specified, '--' will be prepended to the boundary in the request to ensure the boundary follows the specification.\n */\n boundary?: string;\n}\n\n/**\n * Types of bodies supported on the request.\n * NodeJS.ReadableStream and () =\\> NodeJS.ReadableStream is Node only.\n * Blob, ReadableStream<Uint8Array>, and () =\\> ReadableStream<Uint8Array> are browser only.\n */\nexport type RequestBodyType =\n | NodeJS.ReadableStream\n | (() => NodeJS.ReadableStream)\n | ReadableStream<Uint8Array>\n | (() => ReadableStream<Uint8Array>)\n | Blob\n | ArrayBuffer\n | ArrayBufferView\n | FormData\n | string\n | null;\n\n/**\n * An interface compatible with NodeJS's `http.Agent`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface Agent {\n /**\n * Destroy any sockets that are currently in use by the agent.\n */\n destroy(): void;\n /**\n * For agents with keepAlive enabled, this sets the maximum number of sockets that will be left open in the free state.\n */\n maxFreeSockets: number;\n /**\n * Determines how many concurrent sockets the agent can have open per origin.\n */\n maxSockets: number;\n /**\n * An object which contains queues of requests that have not yet been assigned to sockets.\n */\n requests: unknown;\n /**\n * An object which contains arrays of sockets currently in use by the agent.\n */\n sockets: unknown;\n}\n\n/**\n * Metadata about a request being made by the pipeline.\n */\nexport interface PipelineRequest {\n /**\n * The URL to make the request to.\n */\n url: string;\n\n /**\n * The HTTP method to use when making the request.\n */\n method: HttpMethods;\n\n /**\n * The HTTP headers to use when making the request.\n */\n headers: HttpHeaders;\n\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n * If the request is terminated, an `AbortError` is thrown.\n * Defaults to 0, which disables the timeout.\n */\n timeout: number;\n\n /**\n * Indicates whether the user agent should send cookies from the other domain in the case of cross-origin requests.\n * Defaults to false.\n */\n withCredentials: boolean;\n\n /**\n * A unique identifier for the request. Used for logging and tracing.\n */\n requestId: string;\n\n /**\n * The HTTP body content (if any)\n */\n body?: RequestBodyType;\n\n /**\n * Body for a multipart request.\n */\n multipartBody?: MultipartRequestBody;\n\n /**\n * To simulate a browser form post\n */\n formData?: FormDataMap;\n\n /**\n * A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.\n * When streamResponseStatusCodes contains the value Number.POSITIVE_INFINITY any status would be treated as a stream.\n */\n streamResponseStatusCodes?: Set<number>;\n\n /**\n * Proxy configuration.\n */\n proxySettings?: ProxySettings;\n\n /**\n * If the connection should not be reused.\n */\n disableKeepAlive?: boolean;\n\n /**\n * Used to abort the request later.\n */\n abortSignal?: AbortSignalLike;\n\n /**\n * Callback which fires upon upload progress.\n */\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Callback which fires upon download progress. */\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Set to true if the request is sent over HTTP instead of HTTPS */\n allowInsecureConnection?: boolean;\n\n /**\n * NODEJS ONLY\n *\n * A Node-only option to provide a custom `http.Agent`/`https.Agent`.\n * Does nothing when running in the browser.\n */\n agent?: Agent;\n\n /**\n * BROWSER ONLY\n *\n * A browser only option to enable browser Streams. If this option is set and a response is a stream\n * the response will have a property `browserStream` instead of `blobBody` which will be undefined.\n *\n * Default value is false\n */\n enableBrowserStreams?: boolean;\n\n /** Settings for configuring TLS authentication */\n tlsSettings?: TlsSettings;\n}\n\n/**\n * Metadata about a response received by the pipeline.\n */\nexport interface PipelineResponse {\n /**\n * The request that generated this response.\n */\n request: PipelineRequest;\n /**\n * The HTTP status code of the response.\n */\n status: number;\n /**\n * The HTTP response headers.\n */\n headers: HttpHeaders;\n\n /**\n * The response body as text (string format)\n */\n bodyAsText?: string | null;\n\n /**\n * BROWSER ONLY\n *\n * The response body as a browser Blob.\n * Always undefined in node.js.\n */\n blobBody?: Promise<Blob>;\n\n /**\n * BROWSER ONLY\n *\n * The response body as a browser ReadableStream.\n * Always undefined in node.js.\n */\n browserStreamBody?: ReadableStream<Uint8Array>;\n\n /**\n * NODEJS ONLY\n *\n * The response body as a node.js Readable stream.\n * Always undefined in the browser.\n */\n readableStreamBody?: NodeJS.ReadableStream;\n}\n\n/**\n * A simple interface for making a pipeline request and receiving a response.\n */\nexport type SendRequest = (request: PipelineRequest) => Promise<PipelineResponse>;\n\n/**\n * The required interface for a client that makes HTTP requests\n * on behalf of a pipeline.\n */\nexport interface HttpClient {\n /**\n * The method that makes the request and returns a response.\n */\n sendRequest: SendRequest;\n}\n\n/**\n * Fired in response to upload or download progress.\n */\nexport type TransferProgressEvent = {\n /**\n * The number of bytes loaded so far.\n */\n loadedBytes: number;\n};\n\n// UNBRANDED DIFFERENCE: HttpMethods are defined at the top level in unbranded instead of core-util since we don't\n// need to worry about creating a cyclic dependency\n/**\n * Supported HTTP methods to use when making requests.\n */\nexport type HttpMethods =\n | \"GET\"\n | \"PUT\"\n | \"POST\"\n | \"DELETE\"\n | \"PATCH\"\n | \"HEAD\"\n | \"OPTIONS\"\n | \"TRACE\";\n\n/**\n * Options to configure a proxy for outgoing requests (Node.js only).\n */\nexport interface ProxySettings {\n /**\n * The proxy's host address.\n * Must include the protocol (e.g., http:// or https://).\n */\n host: string;\n\n /**\n * The proxy host's port.\n */\n port: number;\n\n /**\n * The user name to authenticate with the proxy, if required.\n */\n username?: string;\n\n /**\n * The password to authenticate with the proxy, if required.\n */\n password?: string;\n}\n\n/**\n * Each form data entry can be a string, Blob, or a File. If you wish to pass a file with a name but do not have\n * access to the File class, you can use the createFile helper to create one.\n */\nexport type FormDataValue = string | Blob | File;\n\n/**\n * A simple object that provides form data, as if from a browser form.\n */\nexport type FormDataMap = { [key: string]: FormDataValue | FormDataValue[] };\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface PipelineRetryOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n\n /**\n * The amount of delay in milliseconds between retry attempts. Defaults to 1000\n * (1 second). The delay increases exponentially with each retry up to a maximum\n * specified by maxRetryDelayInMs.\n */\n retryDelayInMs?: number;\n\n /**\n * The maximum delay in milliseconds allowed before retrying an operation. Defaults\n * to 64000 (64 seconds).\n */\n maxRetryDelayInMs?: number;\n}\n\n/**\n * Represents a certificate credential for authentication.\n */\nexport interface CertificateCredential {\n /**\n * Optionally override the trusted CA certificates. Default is to trust\n * the well-known CAs curated by Mozilla. Mozilla's CAs are completely\n * replaced when CAs are explicitly specified using this option.\n */\n ca?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Cert chains in PEM format. One cert chain should be provided per\n * private key. Each cert chain should consist of the PEM formatted\n * certificate for a provided private key, followed by the PEM\n * formatted intermediate certificates (if any), in order, and not\n * including the root CA (the root CA must be pre-known to the peer,\n * see ca). When providing multiple cert chains, they do not have to\n * be in the same order as their private keys in key. If the\n * intermediate certificates are not provided, the peer will not be\n * able to validate the certificate, and the handshake will fail.\n */\n cert?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Private keys in PEM format. PEM allows the option of private keys\n * being encrypted. Encrypted keys will be decrypted with\n * options.passphrase. Multiple keys using different algorithms can be\n * provided either as an array of unencrypted key strings or buffers,\n * or an array of objects in the form `{pem: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n key?: string | Buffer | Array<Buffer | KeyObject> | undefined;\n /**\n * Shared passphrase used for a single private key and/or a PFX.\n */\n passphrase?: string | undefined;\n /**\n * PFX or PKCS12 encoded private key and certificate chain. pfx is an\n * alternative to providing key and cert individually. PFX is usually\n * encrypted, if it is, passphrase will be used to decrypt it. Multiple\n * PFX can be provided either as an array of unencrypted PFX buffers,\n * or an array of objects in the form `{buf: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;\n}\n\n/**\n * Represents a certificate for TLS authentication.\n */\nexport interface TlsSettings {\n /**\n * Optionally override the trusted CA certificates. Default is to trust\n * the well-known CAs curated by Mozilla. Mozilla's CAs are completely\n * replaced when CAs are explicitly specified using this option.\n */\n ca?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Cert chains in PEM format. One cert chain should be provided per\n * private key. Each cert chain should consist of the PEM formatted\n * certificate for a provided private key, followed by the PEM\n * formatted intermediate certificates (if any), in order, and not\n * including the root CA (the root CA must be pre-known to the peer,\n * see ca). When providing multiple cert chains, they do not have to\n * be in the same order as their private keys in key. If the\n * intermediate certificates are not provided, the peer will not be\n * able to validate the certificate, and the handshake will fail.\n */\n cert?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Private keys in PEM format. PEM allows the option of private keys\n * being encrypted. Encrypted keys will be decrypted with\n * options.passphrase. Multiple keys using different algorithms can be\n * provided either as an array of unencrypted key strings or buffers,\n * or an array of objects in the form `{pem: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n key?: string | Buffer | Array<Buffer | KeyObject> | undefined;\n /**\n * Shared passphrase used for a single private key and/or a PFX.\n */\n passphrase?: string | undefined;\n /**\n * PFX or PKCS12 encoded private key and certificate chain. pfx is an\n * alternative to providing key and cert individually. PFX is usually\n * encrypted, if it is, passphrase will be used to decrypt it. Multiple\n * PFX can be provided either as an array of unencrypted PFX buffers,\n * or an array of objects in the form `{buf: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;\n}\n\n/**\n * An interface compatible with NodeJS's `tls.KeyObject`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface KeyObject {\n /**\n * Private keys in PEM format.\n */\n pem: string | Buffer;\n /**\n * Optional passphrase.\n */\n passphrase?: string | undefined;\n}\n\n/**\n * An interface compatible with NodeJS's `tls.PxfObject`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface PxfObject {\n /**\n * PFX or PKCS12 encoded private key and certificate chain.\n */\n buf: string | Buffer;\n /**\n * Optional passphrase.\n */\n passphrase?: string | undefined;\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AuthScheme } from \"./auth/schemes.js\";\n\n/**\n * A HttpHeaders collection represented as a simple JSON object.\n */\nexport type RawHttpHeaders = { [headerName: string]: string };\n\n/**\n * A HttpHeaders collection for input, represented as a simple JSON object.\n */\nexport type RawHttpHeadersInput = Record<string, string | number | boolean>;\n\n/**\n * Represents a set of HTTP headers on a request/response.\n * Header names are treated as case insensitive.\n */\nexport interface HttpHeaders extends Iterable<[string, string]> {\n /**\n * Returns the value of a specific header or undefined if not set.\n * @param name - The name of the header to retrieve.\n */\n get(name: string): string | undefined;\n /**\n * Returns true if the specified header exists.\n * @param name - The name of the header to check.\n */\n has(name: string): boolean;\n /**\n * Sets a specific header with a given value.\n * @param name - The name of the header to set.\n * @param value - The value to use for the header.\n */\n set(name: string, value: string | number | boolean): void;\n /**\n * Removes a specific header from the collection.\n * @param name - The name of the header to delete.\n */\n delete(name: string): void;\n /**\n * Accesses a raw JS object that acts as a simple map\n * of header names to values.\n */\n toJSON(options?: { preserveCase?: boolean }): RawHttpHeaders;\n}\n\n/**\n * A part of the request body in a multipart request.\n */\nexport interface BodyPart {\n /**\n * The headers for this part of the multipart request.\n */\n headers: HttpHeaders;\n\n /**\n * The body of this part of the multipart request.\n */\n body:\n | ((() => ReadableStream<Uint8Array>) | (() => NodeJS.ReadableStream))\n | ReadableStream<Uint8Array>\n | NodeJS.ReadableStream\n | Uint8Array\n | Blob;\n}\n\n/**\n * A request body consisting of multiple parts.\n */\nexport interface MultipartRequestBody {\n /**\n * The parts of the request body.\n */\n parts: BodyPart[];\n\n /**\n * The boundary separating each part of the request body.\n * If not specified, a random boundary will be generated.\n *\n * When specified, '--' will be prepended to the boundary in the request to ensure the boundary follows the specification.\n */\n boundary?: string;\n}\n\n/**\n * Types of bodies supported on the request.\n * NodeJS.ReadableStream and () =\\> NodeJS.ReadableStream is Node only.\n * Blob, ReadableStream<Uint8Array>, and () =\\> ReadableStream<Uint8Array> are browser only.\n */\nexport type RequestBodyType =\n | NodeJS.ReadableStream\n | (() => NodeJS.ReadableStream)\n | ReadableStream<Uint8Array>\n | (() => ReadableStream<Uint8Array>)\n | Blob\n | ArrayBuffer\n | ArrayBufferView\n | FormData\n | string\n | null;\n\n/**\n * An interface compatible with NodeJS's `http.Agent`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface Agent {\n /**\n * Destroy any sockets that are currently in use by the agent.\n */\n destroy(): void;\n /**\n * For agents with keepAlive enabled, this sets the maximum number of sockets that will be left open in the free state.\n */\n maxFreeSockets: number;\n /**\n * Determines how many concurrent sockets the agent can have open per origin.\n */\n maxSockets: number;\n /**\n * An object which contains queues of requests that have not yet been assigned to sockets.\n */\n requests: unknown;\n /**\n * An object which contains arrays of sockets currently in use by the agent.\n */\n sockets: unknown;\n}\n\n/**\n * Metadata about a request being made by the pipeline.\n */\nexport interface PipelineRequest {\n /**\n * List of authentication schemes used for this specific request.\n * These schemes define how the request will be authenticated.\n * If provided, these schemes override the client level authentication schemes.\n *\n * If no auth schemes are provided at client or request level, defaults to no auth.\n */\n authSchemes?: AuthScheme[];\n\n /**\n * The URL to make the request to.\n */\n url: string;\n\n /**\n * The HTTP method to use when making the request.\n */\n method: HttpMethods;\n\n /**\n * The HTTP headers to use when making the request.\n */\n headers: HttpHeaders;\n\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n * If the request is terminated, an `AbortError` is thrown.\n * Defaults to 0, which disables the timeout.\n */\n timeout: number;\n\n /**\n * Indicates whether the user agent should send cookies from the other domain in the case of cross-origin requests.\n * Defaults to false.\n */\n withCredentials: boolean;\n\n /**\n * A unique identifier for the request. Used for logging and tracing.\n */\n requestId: string;\n\n /**\n * The HTTP body content (if any)\n */\n body?: RequestBodyType;\n\n /**\n * Body for a multipart request.\n */\n multipartBody?: MultipartRequestBody;\n\n /**\n * To simulate a browser form post\n */\n formData?: FormDataMap;\n\n /**\n * A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.\n * When streamResponseStatusCodes contains the value Number.POSITIVE_INFINITY any status would be treated as a stream.\n */\n streamResponseStatusCodes?: Set<number>;\n\n /**\n * Proxy configuration.\n */\n proxySettings?: ProxySettings;\n\n /**\n * If the connection should not be reused.\n */\n disableKeepAlive?: boolean;\n\n /**\n * Used to abort the request later.\n */\n abortSignal?: AbortSignal;\n\n /**\n * Callback which fires upon upload progress.\n */\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Callback which fires upon download progress. */\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Set to true if the request is sent over HTTP instead of HTTPS */\n allowInsecureConnection?: boolean;\n\n /**\n * NODEJS ONLY\n *\n * A Node-only option to provide a custom `http.Agent`/`https.Agent`.\n * Does nothing when running in the browser.\n */\n agent?: Agent;\n\n /**\n * BROWSER ONLY\n *\n * A browser only option to enable browser Streams. If this option is set and a response is a stream\n * the response will have a property `browserStream` instead of `blobBody` which will be undefined.\n *\n * Default value is false\n */\n enableBrowserStreams?: boolean;\n\n /** Settings for configuring TLS authentication */\n tlsSettings?: TlsSettings;\n}\n\n/**\n * Metadata about a response received by the pipeline.\n */\nexport interface PipelineResponse {\n /**\n * The request that generated this response.\n */\n request: PipelineRequest;\n /**\n * The HTTP status code of the response.\n */\n status: number;\n /**\n * The HTTP response headers.\n */\n headers: HttpHeaders;\n\n /**\n * The response body as text (string format)\n */\n bodyAsText?: string | null;\n\n /**\n * BROWSER ONLY\n *\n * The response body as a browser Blob.\n * Always undefined in node.js.\n */\n blobBody?: Promise<Blob>;\n\n /**\n * BROWSER ONLY\n *\n * The response body as a browser ReadableStream.\n * Always undefined in node.js.\n */\n browserStreamBody?: ReadableStream<Uint8Array>;\n\n /**\n * NODEJS ONLY\n *\n * The response body as a node.js Readable stream.\n * Always undefined in the browser.\n */\n readableStreamBody?: NodeJS.ReadableStream;\n}\n\n/**\n * A simple interface for making a pipeline request and receiving a response.\n */\nexport type SendRequest = (request: PipelineRequest) => Promise<PipelineResponse>;\n\n/**\n * The required interface for a client that makes HTTP requests\n * on behalf of a pipeline.\n */\nexport interface HttpClient {\n /**\n * The method that makes the request and returns a response.\n */\n sendRequest: SendRequest;\n}\n\n/**\n * Fired in response to upload or download progress.\n */\nexport type TransferProgressEvent = {\n /**\n * The number of bytes loaded so far.\n */\n loadedBytes: number;\n};\n\n// UNBRANDED DIFFERENCE: HttpMethods are defined at the top level in unbranded instead of core-util since we don't\n// need to worry about creating a cyclic dependency\n/**\n * Supported HTTP methods to use when making requests.\n */\nexport type HttpMethods =\n | \"GET\"\n | \"PUT\"\n | \"POST\"\n | \"DELETE\"\n | \"PATCH\"\n | \"HEAD\"\n | \"OPTIONS\"\n | \"TRACE\";\n\n/**\n * Options to configure a proxy for outgoing requests (Node.js only).\n */\nexport interface ProxySettings {\n /**\n * The proxy's host address.\n * Must include the protocol (e.g., http:// or https://).\n */\n host: string;\n\n /**\n * The proxy host's port.\n */\n port: number;\n\n /**\n * The user name to authenticate with the proxy, if required.\n */\n username?: string;\n\n /**\n * The password to authenticate with the proxy, if required.\n */\n password?: string;\n}\n\n/**\n * Each form data entry can be a string, Blob, or a File. If you wish to pass a file with a name but do not have\n * access to the File class, you can use the createFile helper to create one.\n */\nexport type FormDataValue = string | Blob | File;\n\n/**\n * A simple object that provides form data, as if from a browser form.\n */\nexport type FormDataMap = { [key: string]: FormDataValue | FormDataValue[] };\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface PipelineRetryOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n\n /**\n * The amount of delay in milliseconds between retry attempts. Defaults to 1000\n * (1 second). The delay increases exponentially with each retry up to a maximum\n * specified by maxRetryDelayInMs.\n */\n retryDelayInMs?: number;\n\n /**\n * The maximum delay in milliseconds allowed before retrying an operation. Defaults\n * to 64000 (64 seconds).\n */\n maxRetryDelayInMs?: number;\n}\n\n/**\n * Represents a certificate credential for authentication.\n */\nexport interface CertificateCredential {\n /**\n * Optionally override the trusted CA certificates. Default is to trust\n * the well-known CAs curated by Mozilla. Mozilla's CAs are completely\n * replaced when CAs are explicitly specified using this option.\n */\n ca?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Cert chains in PEM format. One cert chain should be provided per\n * private key. Each cert chain should consist of the PEM formatted\n * certificate for a provided private key, followed by the PEM\n * formatted intermediate certificates (if any), in order, and not\n * including the root CA (the root CA must be pre-known to the peer,\n * see ca). When providing multiple cert chains, they do not have to\n * be in the same order as their private keys in key. If the\n * intermediate certificates are not provided, the peer will not be\n * able to validate the certificate, and the handshake will fail.\n */\n cert?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Private keys in PEM format. PEM allows the option of private keys\n * being encrypted. Encrypted keys will be decrypted with\n * options.passphrase. Multiple keys using different algorithms can be\n * provided either as an array of unencrypted key strings or buffers,\n * or an array of objects in the form `{pem: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n key?: string | Buffer | Array<Buffer | KeyObject> | undefined;\n /**\n * Shared passphrase used for a single private key and/or a PFX.\n */\n passphrase?: string | undefined;\n /**\n * PFX or PKCS12 encoded private key and certificate chain. pfx is an\n * alternative to providing key and cert individually. PFX is usually\n * encrypted, if it is, passphrase will be used to decrypt it. Multiple\n * PFX can be provided either as an array of unencrypted PFX buffers,\n * or an array of objects in the form `{buf: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;\n}\n\n/**\n * Represents a certificate for TLS authentication.\n */\nexport interface TlsSettings {\n /**\n * Optionally override the trusted CA certificates. Default is to trust\n * the well-known CAs curated by Mozilla. Mozilla's CAs are completely\n * replaced when CAs are explicitly specified using this option.\n */\n ca?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Cert chains in PEM format. One cert chain should be provided per\n * private key. Each cert chain should consist of the PEM formatted\n * certificate for a provided private key, followed by the PEM\n * formatted intermediate certificates (if any), in order, and not\n * including the root CA (the root CA must be pre-known to the peer,\n * see ca). When providing multiple cert chains, they do not have to\n * be in the same order as their private keys in key. If the\n * intermediate certificates are not provided, the peer will not be\n * able to validate the certificate, and the handshake will fail.\n */\n cert?: string | Buffer | Array<string | Buffer> | undefined;\n /**\n * Private keys in PEM format. PEM allows the option of private keys\n * being encrypted. Encrypted keys will be decrypted with\n * options.passphrase. Multiple keys using different algorithms can be\n * provided either as an array of unencrypted key strings or buffers,\n * or an array of objects in the form `{pem: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n key?: string | Buffer | Array<Buffer | KeyObject> | undefined;\n /**\n * Shared passphrase used for a single private key and/or a PFX.\n */\n passphrase?: string | undefined;\n /**\n * PFX or PKCS12 encoded private key and certificate chain. pfx is an\n * alternative to providing key and cert individually. PFX is usually\n * encrypted, if it is, passphrase will be used to decrypt it. Multiple\n * PFX can be provided either as an array of unencrypted PFX buffers,\n * or an array of objects in the form `{buf: <string|buffer>[,passphrase: <string>]}`.\n * The object form can only occur in an array.object.passphrase is optional.\n * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.\n */\n pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;\n}\n\n/**\n * An interface compatible with NodeJS's `tls.KeyObject`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface KeyObject {\n /**\n * Private keys in PEM format.\n */\n pem: string | Buffer;\n /**\n * Optional passphrase.\n */\n passphrase?: string | undefined;\n}\n\n/**\n * An interface compatible with NodeJS's `tls.PxfObject`.\n * We want to avoid publicly re-exporting the actual interface,\n * since it might vary across runtime versions.\n */\nexport interface PxfObject {\n /**\n * PFX or PKCS12 encoded private key and certificate chain.\n */\n buf: string | Buffer;\n /**\n * Optional passphrase.\n */\n passphrase?: string | undefined;\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import type { FormDataMap, HttpHeaders, HttpMethods, MultipartRequestBody, PipelineRequest, ProxySettings, RequestBodyType, TransferProgressEvent } from "./interfaces.js";
2
- import type { AbortSignalLike } from "./abort-controller/AbortSignalLike.js";
3
2
  /**
4
3
  * Settings to initialize a request.
5
4
  * Almost equivalent to Partial<PipelineRequest>, but url is mandatory.
@@ -69,7 +68,7 @@ export interface PipelineRequestOptions {
69
68
  /**
70
69
  * Used to abort the request later.
71
70
  */
72
- abortSignal?: AbortSignalLike;
71
+ abortSignal?: AbortSignal;
73
72
  /**
74
73
  * Callback which fires upon upload progress.
75
74
  */
@@ -1 +1 @@
1
- {"version":3,"file":"pipelineRequest.js","sourceRoot":"","sources":["../../src/pipelineRequest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAkGjD,MAAM,mBAAmB;IAoBvB,YAAY,OAA+B;;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,iBAAiB,EAAE,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,KAAK,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,MAAA,OAAO,CAAC,gBAAgB,mCAAI,KAAK,CAAC;QAC1D,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC;QACnE,IAAI,CAAC,eAAe,GAAG,MAAA,OAAO,CAAC,eAAe,mCAAI,KAAK,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,UAAU,EAAE,CAAC;QACnD,IAAI,CAAC,uBAAuB,GAAG,MAAA,OAAO,CAAC,uBAAuB,mCAAI,KAAK,CAAC;QACxE,IAAI,CAAC,oBAAoB,GAAG,MAAA,OAAO,CAAC,oBAAoB,mCAAI,KAAK,CAAC;IACpE,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA+B;IACnE,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n FormDataMap,\n HttpHeaders,\n HttpMethods,\n MultipartRequestBody,\n PipelineRequest,\n ProxySettings,\n RequestBodyType,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nimport { createHttpHeaders } from \"./httpHeaders.js\";\nimport type { AbortSignalLike } from \"./abort-controller/AbortSignalLike.js\";\nimport { randomUUID } from \"./util/uuidUtils.js\";\n\n/**\n * Settings to initialize a request.\n * Almost equivalent to Partial<PipelineRequest>, but url is mandatory.\n */\nexport interface PipelineRequestOptions {\n /**\n * The URL to make the request to.\n */\n url: string;\n\n /**\n * The HTTP method to use when making the request.\n */\n method?: HttpMethods;\n\n /**\n * The HTTP headers to use when making the request.\n */\n headers?: HttpHeaders;\n\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n * If the request is terminated, an `AbortError` is thrown.\n * Defaults to 0, which disables the timeout.\n */\n timeout?: number;\n\n /**\n * If credentials (cookies) should be sent along during an XHR.\n * Defaults to false.\n */\n withCredentials?: boolean;\n\n /**\n * A unique identifier for the request. Used for logging and tracing.\n */\n requestId?: string;\n\n /**\n * The HTTP body content (if any)\n */\n body?: RequestBodyType;\n\n /**\n * Body for a multipart request.\n */\n multipartBody?: MultipartRequestBody;\n\n /**\n * To simulate a browser form post\n */\n formData?: FormDataMap;\n\n /**\n * A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.\n */\n streamResponseStatusCodes?: Set<number>;\n\n /**\n * BROWSER ONLY\n *\n * A browser only option to enable use of the Streams API. If this option is set and streaming is used\n * (see `streamResponseStatusCodes`), the response will have a property `browserStream` instead of\n * `blobBody` which will be undefined.\n *\n * Default value is false\n */\n enableBrowserStreams?: boolean;\n\n /**\n * Proxy configuration.\n */\n proxySettings?: ProxySettings;\n\n /**\n * If the connection should not be reused.\n */\n disableKeepAlive?: boolean;\n\n /**\n * Used to abort the request later.\n */\n abortSignal?: AbortSignalLike;\n\n /**\n * Callback which fires upon upload progress.\n */\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Callback which fires upon download progress. */\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Set to true if the request is sent over HTTP instead of HTTPS */\n allowInsecureConnection?: boolean;\n}\n\nclass PipelineRequestImpl implements PipelineRequest {\n public url: string;\n public method: HttpMethods;\n public headers: HttpHeaders;\n public timeout: number;\n public withCredentials: boolean;\n public body?: RequestBodyType;\n public multipartBody?: MultipartRequestBody;\n public formData?: FormDataMap;\n public streamResponseStatusCodes?: Set<number>;\n public enableBrowserStreams: boolean;\n\n public proxySettings?: ProxySettings;\n public disableKeepAlive: boolean;\n public abortSignal?: AbortSignalLike;\n public requestId: string;\n public allowInsecureConnection?: boolean;\n public onUploadProgress?: (progress: TransferProgressEvent) => void;\n public onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n constructor(options: PipelineRequestOptions) {\n this.url = options.url;\n this.body = options.body;\n this.headers = options.headers ?? createHttpHeaders();\n this.method = options.method ?? \"GET\";\n this.timeout = options.timeout ?? 0;\n this.multipartBody = options.multipartBody;\n this.formData = options.formData;\n this.disableKeepAlive = options.disableKeepAlive ?? false;\n this.proxySettings = options.proxySettings;\n this.streamResponseStatusCodes = options.streamResponseStatusCodes;\n this.withCredentials = options.withCredentials ?? false;\n this.abortSignal = options.abortSignal;\n this.onUploadProgress = options.onUploadProgress;\n this.onDownloadProgress = options.onDownloadProgress;\n this.requestId = options.requestId || randomUUID();\n this.allowInsecureConnection = options.allowInsecureConnection ?? false;\n this.enableBrowserStreams = options.enableBrowserStreams ?? false;\n }\n}\n\n/**\n * Creates a new pipeline request with the given options.\n * This method is to allow for the easy setting of default values and not required.\n * @param options - The options to create the request with.\n */\nexport function createPipelineRequest(options: PipelineRequestOptions): PipelineRequest {\n return new PipelineRequestImpl(options);\n}\n"]}
1
+ {"version":3,"file":"pipelineRequest.js","sourceRoot":"","sources":["../../src/pipelineRequest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAkGjD,MAAM,mBAAmB;IAoBvB,YAAY,OAA+B;;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,iBAAiB,EAAE,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,KAAK,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,MAAA,OAAO,CAAC,gBAAgB,mCAAI,KAAK,CAAC;QAC1D,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC;QACnE,IAAI,CAAC,eAAe,GAAG,MAAA,OAAO,CAAC,eAAe,mCAAI,KAAK,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,UAAU,EAAE,CAAC;QACnD,IAAI,CAAC,uBAAuB,GAAG,MAAA,OAAO,CAAC,uBAAuB,mCAAI,KAAK,CAAC;QACxE,IAAI,CAAC,oBAAoB,GAAG,MAAA,OAAO,CAAC,oBAAoB,mCAAI,KAAK,CAAC;IACpE,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA+B;IACnE,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n FormDataMap,\n HttpHeaders,\n HttpMethods,\n MultipartRequestBody,\n PipelineRequest,\n ProxySettings,\n RequestBodyType,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nimport { createHttpHeaders } from \"./httpHeaders.js\";\nimport { randomUUID } from \"./util/uuidUtils.js\";\n\n/**\n * Settings to initialize a request.\n * Almost equivalent to Partial<PipelineRequest>, but url is mandatory.\n */\nexport interface PipelineRequestOptions {\n /**\n * The URL to make the request to.\n */\n url: string;\n\n /**\n * The HTTP method to use when making the request.\n */\n method?: HttpMethods;\n\n /**\n * The HTTP headers to use when making the request.\n */\n headers?: HttpHeaders;\n\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n * If the request is terminated, an `AbortError` is thrown.\n * Defaults to 0, which disables the timeout.\n */\n timeout?: number;\n\n /**\n * If credentials (cookies) should be sent along during an XHR.\n * Defaults to false.\n */\n withCredentials?: boolean;\n\n /**\n * A unique identifier for the request. Used for logging and tracing.\n */\n requestId?: string;\n\n /**\n * The HTTP body content (if any)\n */\n body?: RequestBodyType;\n\n /**\n * Body for a multipart request.\n */\n multipartBody?: MultipartRequestBody;\n\n /**\n * To simulate a browser form post\n */\n formData?: FormDataMap;\n\n /**\n * A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.\n */\n streamResponseStatusCodes?: Set<number>;\n\n /**\n * BROWSER ONLY\n *\n * A browser only option to enable use of the Streams API. If this option is set and streaming is used\n * (see `streamResponseStatusCodes`), the response will have a property `browserStream` instead of\n * `blobBody` which will be undefined.\n *\n * Default value is false\n */\n enableBrowserStreams?: boolean;\n\n /**\n * Proxy configuration.\n */\n proxySettings?: ProxySettings;\n\n /**\n * If the connection should not be reused.\n */\n disableKeepAlive?: boolean;\n\n /**\n * Used to abort the request later.\n */\n abortSignal?: AbortSignal;\n\n /**\n * Callback which fires upon upload progress.\n */\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Callback which fires upon download progress. */\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Set to true if the request is sent over HTTP instead of HTTPS */\n allowInsecureConnection?: boolean;\n}\n\nclass PipelineRequestImpl implements PipelineRequest {\n public url: string;\n public method: HttpMethods;\n public headers: HttpHeaders;\n public timeout: number;\n public withCredentials: boolean;\n public body?: RequestBodyType;\n public multipartBody?: MultipartRequestBody;\n public formData?: FormDataMap;\n public streamResponseStatusCodes?: Set<number>;\n public enableBrowserStreams: boolean;\n\n public proxySettings?: ProxySettings;\n public disableKeepAlive: boolean;\n public abortSignal?: AbortSignal;\n public requestId: string;\n public allowInsecureConnection?: boolean;\n public onUploadProgress?: (progress: TransferProgressEvent) => void;\n public onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n constructor(options: PipelineRequestOptions) {\n this.url = options.url;\n this.body = options.body;\n this.headers = options.headers ?? createHttpHeaders();\n this.method = options.method ?? \"GET\";\n this.timeout = options.timeout ?? 0;\n this.multipartBody = options.multipartBody;\n this.formData = options.formData;\n this.disableKeepAlive = options.disableKeepAlive ?? false;\n this.proxySettings = options.proxySettings;\n this.streamResponseStatusCodes = options.streamResponseStatusCodes;\n this.withCredentials = options.withCredentials ?? false;\n this.abortSignal = options.abortSignal;\n this.onUploadProgress = options.onUploadProgress;\n this.onDownloadProgress = options.onDownloadProgress;\n this.requestId = options.requestId || randomUUID();\n this.allowInsecureConnection = options.allowInsecureConnection ?? false;\n this.enableBrowserStreams = options.enableBrowserStreams ?? false;\n }\n}\n\n/**\n * Creates a new pipeline request with the given options.\n * This method is to allow for the easy setting of default values and not required.\n * @param options - The options to create the request with.\n */\nexport function createPipelineRequest(options: PipelineRequestOptions): PipelineRequest {\n return new PipelineRequestImpl(options);\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import type { ApiKeyCredential } from "../../auth/credentials.js";
2
+ import type { AuthScheme } from "../../auth/schemes.js";
3
+ import type { PipelinePolicy } from "../../pipeline.js";
4
+ /**
5
+ * Name of the API Key Authentication Policy
6
+ */
7
+ export declare const apiKeyAuthenticationPolicyName = "apiKeyAuthenticationPolicy";
8
+ /**
9
+ * Options for configuring the API key authentication policy
10
+ */
11
+ export interface ApiKeyAuthenticationPolicyOptions {
12
+ /**
13
+ * The credential used to authenticate requests
14
+ */
15
+ credential: ApiKeyCredential;
16
+ /**
17
+ * Optional authentication schemes to use. If `authSchemes` is provided in both request and policy options, the request options will take precedence.
18
+ */
19
+ authSchemes?: AuthScheme[];
20
+ /**
21
+ * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.
22
+ * CAUTION: Never use this option in production.
23
+ */
24
+ allowInsecureConnection?: boolean;
25
+ }
26
+ /**
27
+ * Gets a pipeline policy that adds API key authentication to requests
28
+ */
29
+ export declare function apiKeyAuthenticationPolicy(options: ApiKeyAuthenticationPolicyOptions): PipelinePolicy;
30
+ //# sourceMappingURL=apiKeyAuthenticationPolicy.d.ts.map
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { ensureSecureConnection } from "./checkInsecureConnection.js";
4
+ /**
5
+ * Name of the API Key Authentication Policy
6
+ */
7
+ export const apiKeyAuthenticationPolicyName = "apiKeyAuthenticationPolicy";
8
+ /**
9
+ * Gets a pipeline policy that adds API key authentication to requests
10
+ */
11
+ export function apiKeyAuthenticationPolicy(options) {
12
+ return {
13
+ name: apiKeyAuthenticationPolicyName,
14
+ async sendRequest(request, next) {
15
+ var _a, _b;
16
+ // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
17
+ ensureSecureConnection(request, options);
18
+ const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "apiKey");
19
+ // Skip adding authentication header if no API key authentication scheme is found
20
+ if (!scheme) {
21
+ return next(request);
22
+ }
23
+ if (scheme.apiKeyLocation !== "header") {
24
+ throw new Error(`Unsupported API key location: ${scheme.apiKeyLocation}`);
25
+ }
26
+ request.headers.set(scheme.name, options.credential.key);
27
+ return next(request);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=apiKeyAuthenticationPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiKeyAuthenticationPolicy.js","sourceRoot":"","sources":["../../../../src/policies/auth/apiKeyAuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,4BAA4B,CAAC;AAqB3E;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAA0C;IAE1C,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,0FAA0F;YAC1F,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEzC,MAAM,MAAM,GAAG,MAAA,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;YAE9F,iFAAiF;YACjF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;YACD,IAAI,MAAM,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;gBACvC,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;YAC5E,CAAC;YAED,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACzD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ApiKeyCredential } from \"../../auth/credentials.js\";\nimport type { AuthScheme } from \"../../auth/schemes.js\";\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../../interfaces.js\";\nimport type { PipelinePolicy } from \"../../pipeline.js\";\nimport { ensureSecureConnection } from \"./checkInsecureConnection.js\";\n\n/**\n * Name of the API Key Authentication Policy\n */\nexport const apiKeyAuthenticationPolicyName = \"apiKeyAuthenticationPolicy\";\n\n/**\n * Options for configuring the API key authentication policy\n */\nexport interface ApiKeyAuthenticationPolicyOptions {\n /**\n * The credential used to authenticate requests\n */\n credential: ApiKeyCredential;\n /**\n * Optional authentication schemes to use. If `authSchemes` is provided in both request and policy options, the request options will take precedence.\n */\n authSchemes?: AuthScheme[];\n /**\n * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.\n * CAUTION: Never use this option in production.\n */\n allowInsecureConnection?: boolean;\n}\n\n/**\n * Gets a pipeline policy that adds API key authentication to requests\n */\nexport function apiKeyAuthenticationPolicy(\n options: ApiKeyAuthenticationPolicyOptions,\n): PipelinePolicy {\n return {\n name: apiKeyAuthenticationPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs\n ensureSecureConnection(request, options);\n\n const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === \"apiKey\");\n\n // Skip adding authentication header if no API key authentication scheme is found\n if (!scheme) {\n return next(request);\n }\n if (scheme.apiKeyLocation !== \"header\") {\n throw new Error(`Unsupported API key location: ${scheme.apiKeyLocation}`);\n }\n\n request.headers.set(scheme.name, options.credential.key);\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import type { BasicCredential } from "../../auth/credentials.js";
2
+ import type { AuthScheme } from "../../auth/schemes.js";
3
+ import type { PipelinePolicy } from "../../pipeline.js";
4
+ /**
5
+ * Name of the Basic Authentication Policy
6
+ */
7
+ export declare const basicAuthenticationPolicyName = "bearerAuthenticationPolicy";
8
+ /**
9
+ * Options for configuring the basic authentication policy
10
+ */
11
+ export interface BasicAuthenticationPolicyOptions {
12
+ /**
13
+ * The credential used to authenticate requests
14
+ */
15
+ credential: BasicCredential;
16
+ /**
17
+ * Optional authentication schemes to use. If not provided, schemes from the request will be used.
18
+ */
19
+ authSchemes?: AuthScheme[];
20
+ /**
21
+ * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.
22
+ * CAUTION: Never use this option in production.
23
+ */
24
+ allowInsecureConnection?: boolean;
25
+ }
26
+ /**
27
+ * Gets a pipeline policy that adds basic authentication to requests
28
+ */
29
+ export declare function basicAuthenticationPolicy(options: BasicAuthenticationPolicyOptions): PipelinePolicy;
30
+ //# sourceMappingURL=basicAuthenticationPolicy.d.ts.map
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { stringToUint8Array, uint8ArrayToString } from "../../util/bytesEncoding.js";
4
+ import { ensureSecureConnection } from "./checkInsecureConnection.js";
5
+ /**
6
+ * Name of the Basic Authentication Policy
7
+ */
8
+ export const basicAuthenticationPolicyName = "bearerAuthenticationPolicy";
9
+ /**
10
+ * Gets a pipeline policy that adds basic authentication to requests
11
+ */
12
+ export function basicAuthenticationPolicy(options) {
13
+ return {
14
+ name: basicAuthenticationPolicyName,
15
+ async sendRequest(request, next) {
16
+ var _a, _b;
17
+ // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
18
+ ensureSecureConnection(request, options);
19
+ const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "http" && x.scheme === "basic");
20
+ // Skip adding authentication header if no basic authentication scheme is found
21
+ if (!scheme) {
22
+ return next(request);
23
+ }
24
+ const { username, password } = options.credential;
25
+ const headerValue = uint8ArrayToString(stringToUint8Array(`${username}:${password}`, "utf-8"), "base64");
26
+ request.headers.set("Authorization", `Basic ${headerValue}`);
27
+ return next(request);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=basicAuthenticationPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basicAuthenticationPolicy.js","sourceRoot":"","sources":["../../../../src/policies/auth/basicAuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAqB1E;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAyC;IAEzC,OAAO;QACL,IAAI,EAAE,6BAA6B;QACnC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,0FAA0F;YAC1F,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEzC,MAAM,MAAM,GAAG,MAAA,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,0CAAE,IAAI,CAC/D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,OAAO,CACjD,CAAC;YAEF,+EAA+E;YAC/E,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;YAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAClD,MAAM,WAAW,GAAG,kBAAkB,CACpC,kBAAkB,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,EAAE,OAAO,CAAC,EACtD,QAAQ,CACT,CAAC;YACF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,SAAS,WAAW,EAAE,CAAC,CAAC;YAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { BasicCredential } from \"../../auth/credentials.js\";\nimport type { AuthScheme } from \"../../auth/schemes.js\";\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../../interfaces.js\";\nimport type { PipelinePolicy } from \"../../pipeline.js\";\nimport { stringToUint8Array, uint8ArrayToString } from \"../../util/bytesEncoding.js\";\nimport { ensureSecureConnection } from \"./checkInsecureConnection.js\";\n\n/**\n * Name of the Basic Authentication Policy\n */\nexport const basicAuthenticationPolicyName = \"bearerAuthenticationPolicy\";\n\n/**\n * Options for configuring the basic authentication policy\n */\nexport interface BasicAuthenticationPolicyOptions {\n /**\n * The credential used to authenticate requests\n */\n credential: BasicCredential;\n /**\n * Optional authentication schemes to use. If not provided, schemes from the request will be used.\n */\n authSchemes?: AuthScheme[];\n /**\n * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.\n * CAUTION: Never use this option in production.\n */\n allowInsecureConnection?: boolean;\n}\n\n/**\n * Gets a pipeline policy that adds basic authentication to requests\n */\nexport function basicAuthenticationPolicy(\n options: BasicAuthenticationPolicyOptions,\n): PipelinePolicy {\n return {\n name: basicAuthenticationPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs\n ensureSecureConnection(request, options);\n\n const scheme = (request.authSchemes ?? options.authSchemes)?.find(\n (x) => x.kind === \"http\" && x.scheme === \"basic\",\n );\n\n // Skip adding authentication header if no basic authentication scheme is found\n if (!scheme) {\n return next(request);\n }\n\n const { username, password } = options.credential;\n const headerValue = uint8ArrayToString(\n stringToUint8Array(`${username}:${password}`, \"utf-8\"),\n \"base64\",\n );\n request.headers.set(\"Authorization\", `Basic ${headerValue}`);\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import type { BearerTokenCredential } from "../../auth/credentials.js";
2
+ import type { AuthScheme } from "../../auth/schemes.js";
3
+ import type { PipelinePolicy } from "../../pipeline.js";
4
+ /**
5
+ * Name of the Bearer Authentication Policy
6
+ */
7
+ export declare const bearerAuthenticationPolicyName = "bearerAuthenticationPolicy";
8
+ /**
9
+ * Options for configuring the bearer authentication policy
10
+ */
11
+ export interface BearerAuthenticationPolicyOptions {
12
+ /**
13
+ * The BearerTokenCredential implementation that can supply the bearer token.
14
+ */
15
+ credential: BearerTokenCredential;
16
+ /**
17
+ * Optional authentication schemes to use. If not provided, schemes from the request will be used.
18
+ */
19
+ authSchemes?: AuthScheme[];
20
+ /**
21
+ * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.
22
+ * CAUTION: Never use this option in production.
23
+ */
24
+ allowInsecureConnection?: boolean;
25
+ }
26
+ /**
27
+ * Gets a pipeline policy that adds bearer token authentication to requests
28
+ */
29
+ export declare function bearerAuthenticationPolicy(options: BearerAuthenticationPolicyOptions): PipelinePolicy;
30
+ //# sourceMappingURL=bearerAuthenticationPolicy.d.ts.map
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { ensureSecureConnection } from "./checkInsecureConnection.js";
4
+ /**
5
+ * Name of the Bearer Authentication Policy
6
+ */
7
+ export const bearerAuthenticationPolicyName = "bearerAuthenticationPolicy";
8
+ /**
9
+ * Gets a pipeline policy that adds bearer token authentication to requests
10
+ */
11
+ export function bearerAuthenticationPolicy(options) {
12
+ return {
13
+ name: bearerAuthenticationPolicyName,
14
+ async sendRequest(request, next) {
15
+ var _a, _b;
16
+ // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
17
+ ensureSecureConnection(request, options);
18
+ const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "http" && x.scheme === "bearer");
19
+ // Skip adding authentication header if no bearer authentication scheme is found
20
+ if (!scheme) {
21
+ return next(request);
22
+ }
23
+ const token = await options.credential.getBearerToken({
24
+ abortSignal: request.abortSignal,
25
+ });
26
+ request.headers.set("Authorization", `Bearer ${token}`);
27
+ return next(request);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=bearerAuthenticationPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bearerAuthenticationPolicy.js","sourceRoot":"","sources":["../../../../src/policies/auth/bearerAuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,4BAA4B,CAAC;AAqB3E;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAA0C;IAE1C,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,0FAA0F;YAC1F,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEzC,MAAM,MAAM,GAAG,MAAA,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,0CAAE,IAAI,CAC/D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,QAAQ,CAClD,CAAC;YAEF,gFAAgF;YAChF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;YAED,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;gBACpD,WAAW,EAAE,OAAO,CAAC,WAAW;aACjC,CAAC,CAAC;YACH,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,KAAK,EAAE,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { BearerTokenCredential } from \"../../auth/credentials.js\";\nimport type { AuthScheme } from \"../../auth/schemes.js\";\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../../interfaces.js\";\nimport type { PipelinePolicy } from \"../../pipeline.js\";\nimport { ensureSecureConnection } from \"./checkInsecureConnection.js\";\n\n/**\n * Name of the Bearer Authentication Policy\n */\nexport const bearerAuthenticationPolicyName = \"bearerAuthenticationPolicy\";\n\n/**\n * Options for configuring the bearer authentication policy\n */\nexport interface BearerAuthenticationPolicyOptions {\n /**\n * The BearerTokenCredential implementation that can supply the bearer token.\n */\n credential: BearerTokenCredential;\n /**\n * Optional authentication schemes to use. If not provided, schemes from the request will be used.\n */\n authSchemes?: AuthScheme[];\n /**\n * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.\n * CAUTION: Never use this option in production.\n */\n allowInsecureConnection?: boolean;\n}\n\n/**\n * Gets a pipeline policy that adds bearer token authentication to requests\n */\nexport function bearerAuthenticationPolicy(\n options: BearerAuthenticationPolicyOptions,\n): PipelinePolicy {\n return {\n name: bearerAuthenticationPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs\n ensureSecureConnection(request, options);\n\n const scheme = (request.authSchemes ?? options.authSchemes)?.find(\n (x) => x.kind === \"http\" && x.scheme === \"bearer\",\n );\n\n // Skip adding authentication header if no bearer authentication scheme is found\n if (!scheme) {\n return next(request);\n }\n\n const token = await options.credential.getBearerToken({\n abortSignal: request.abortSignal,\n });\n request.headers.set(\"Authorization\", `Bearer ${token}`);\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { PipelineRequest } from "../../interfaces.js";
2
+ /**
3
+ * Ensures that authentication is only allowed over HTTPS unless explicitly allowed.
4
+ * Throws an error if the connection is not secure and not explicitly allowed.
5
+ */
6
+ export declare function ensureSecureConnection(request: PipelineRequest, options: {
7
+ allowInsecureConnection?: boolean;
8
+ }): void;
9
+ //# sourceMappingURL=checkInsecureConnection.d.ts.map
@@ -0,0 +1,50 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { logger } from "../../log.js";
4
+ // Ensure the warining is only emitted once
5
+ let insecureConnectionWarningEmmitted = false;
6
+ /**
7
+ * Checks if the request is allowed to be sent over an insecure connection.
8
+ *
9
+ * A request is allowed to be sent over an insecure connection when:
10
+ * - The `allowInsecureConnection` option is set to `true`.
11
+ * - The request has the `allowInsecureConnection` property set to `true`.
12
+ * - The request is being sent to `localhost` or `127.0.0.1`
13
+ */
14
+ function allowInsecureConnection(request, options) {
15
+ if (options.allowInsecureConnection && request.allowInsecureConnection) {
16
+ const url = new URL(request.url);
17
+ if (url.hostname === "localhost" || url.hostname === "127.0.0.1") {
18
+ return true;
19
+ }
20
+ }
21
+ return false;
22
+ }
23
+ /**
24
+ * Logs a warning about sending a bearer token over an insecure connection.
25
+ *
26
+ * This function will emit a node warning once, but log the warning every time.
27
+ */
28
+ function emitInsecureConnectionWarning() {
29
+ const warning = "Sending bearer token over insecure transport. Assume any token issued is compromised.";
30
+ logger.warning(warning);
31
+ if (typeof (process === null || process === void 0 ? void 0 : process.emitWarning) === "function" && !insecureConnectionWarningEmmitted) {
32
+ insecureConnectionWarningEmmitted = true;
33
+ process.emitWarning(warning);
34
+ }
35
+ }
36
+ /**
37
+ * Ensures that authentication is only allowed over HTTPS unless explicitly allowed.
38
+ * Throws an error if the connection is not secure and not explicitly allowed.
39
+ */
40
+ export function ensureSecureConnection(request, options) {
41
+ if (!request.url.toLowerCase().startsWith("https://")) {
42
+ if (allowInsecureConnection(request, options)) {
43
+ emitInsecureConnectionWarning();
44
+ }
45
+ else {
46
+ throw new Error("Authentication is not permitted for non-TLS protected (non-https) URLs when allowInsecureConnection is false.");
47
+ }
48
+ }
49
+ }
50
+ //# sourceMappingURL=checkInsecureConnection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkInsecureConnection.js","sourceRoot":"","sources":["../../../../src/policies/auth/checkInsecureConnection.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,2CAA2C;AAC3C,IAAI,iCAAiC,GAAG,KAAK,CAAC;AAE9C;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAC9B,OAAwB,EACxB,OAA8C;IAE9C,IAAI,OAAO,CAAC,uBAAuB,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;QACvE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,6BAA6B;IACpC,MAAM,OAAO,GACX,uFAAuF,CAAC;IAE1F,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAExB,IAAI,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAA,KAAK,UAAU,IAAI,CAAC,iCAAiC,EAAE,CAAC;QACrF,iCAAiC,GAAG,IAAI,CAAC;QACzC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAwB,EACxB,OAA8C;IAE9C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACtD,IAAI,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;YAC9C,6BAA6B,EAAE,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CACb,+GAA+G,CAChH,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest } from \"../../interfaces.js\";\nimport { logger } from \"../../log.js\";\n\n// Ensure the warining is only emitted once\nlet insecureConnectionWarningEmmitted = false;\n\n/**\n * Checks if the request is allowed to be sent over an insecure connection.\n *\n * A request is allowed to be sent over an insecure connection when:\n * - The `allowInsecureConnection` option is set to `true`.\n * - The request has the `allowInsecureConnection` property set to `true`.\n * - The request is being sent to `localhost` or `127.0.0.1`\n */\nfunction allowInsecureConnection(\n request: PipelineRequest,\n options: { allowInsecureConnection?: boolean },\n): boolean {\n if (options.allowInsecureConnection && request.allowInsecureConnection) {\n const url = new URL(request.url);\n if (url.hostname === \"localhost\" || url.hostname === \"127.0.0.1\") {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Logs a warning about sending a bearer token over an insecure connection.\n *\n * This function will emit a node warning once, but log the warning every time.\n */\nfunction emitInsecureConnectionWarning(): void {\n const warning =\n \"Sending bearer token over insecure transport. Assume any token issued is compromised.\";\n\n logger.warning(warning);\n\n if (typeof process?.emitWarning === \"function\" && !insecureConnectionWarningEmmitted) {\n insecureConnectionWarningEmmitted = true;\n process.emitWarning(warning);\n }\n}\n\n/**\n * Ensures that authentication is only allowed over HTTPS unless explicitly allowed.\n * Throws an error if the connection is not secure and not explicitly allowed.\n */\nexport function ensureSecureConnection(\n request: PipelineRequest,\n options: { allowInsecureConnection?: boolean },\n): void {\n if (!request.url.toLowerCase().startsWith(\"https://\")) {\n if (allowInsecureConnection(request, options)) {\n emitInsecureConnectionWarning();\n } else {\n throw new Error(\n \"Authentication is not permitted for non-TLS protected (non-https) URLs when allowInsecureConnection is false.\",\n );\n }\n }\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import type { OAuth2Flow } from "../../auth/oauth2Flows.js";
2
+ import type { OAuth2TokenCredential } from "../../auth/credentials.js";
3
+ import type { AuthScheme } from "../../auth/schemes.js";
4
+ import type { PipelinePolicy } from "../../pipeline.js";
5
+ /**
6
+ * Name of the OAuth2 Authentication Policy
7
+ */
8
+ export declare const oauth2AuthenticationPolicyName = "oauth2AuthenticationPolicy";
9
+ /**
10
+ * Options for configuring the OAuth2 authentication policy
11
+ */
12
+ export interface OAuth2AuthenticationPolicyOptions<TFlows extends OAuth2Flow> {
13
+ /**
14
+ * The OAuth2TokenCredential implementation that can supply the bearer token.
15
+ */
16
+ credential: OAuth2TokenCredential<TFlows>;
17
+ /**
18
+ * Optional authentication schemes to use. If not provided, schemes from the request will be used.
19
+ */
20
+ authSchemes?: AuthScheme[];
21
+ /**
22
+ * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.
23
+ * CAUTION: Never use this option in production.
24
+ */
25
+ allowInsecureConnection?: boolean;
26
+ }
27
+ /**
28
+ * Gets a pipeline policy that adds authorization header from OAuth2 schemes
29
+ */
30
+ export declare function oauth2AuthenticationPolicy<TFlows extends OAuth2Flow>(options: OAuth2AuthenticationPolicyOptions<TFlows>): PipelinePolicy;
31
+ //# sourceMappingURL=oauth2AuthenticationPolicy.d.ts.map
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { ensureSecureConnection } from "./checkInsecureConnection.js";
4
+ /**
5
+ * Name of the OAuth2 Authentication Policy
6
+ */
7
+ export const oauth2AuthenticationPolicyName = "oauth2AuthenticationPolicy";
8
+ /**
9
+ * Gets a pipeline policy that adds authorization header from OAuth2 schemes
10
+ */
11
+ export function oauth2AuthenticationPolicy(options) {
12
+ return {
13
+ name: oauth2AuthenticationPolicyName,
14
+ async sendRequest(request, next) {
15
+ var _a, _b;
16
+ // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
17
+ ensureSecureConnection(request, options);
18
+ const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "oauth2");
19
+ // Skip adding authentication header if no OAuth2 authentication scheme is found
20
+ if (!scheme) {
21
+ return next(request);
22
+ }
23
+ const token = await options.credential.getOAuth2Token(scheme.flows, {
24
+ abortSignal: request.abortSignal,
25
+ });
26
+ request.headers.set("Authorization", `Bearer ${token}`);
27
+ return next(request);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=oauth2AuthenticationPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth2AuthenticationPolicy.js","sourceRoot":"","sources":["../../../../src/policies/auth/oauth2AuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,4BAA4B,CAAC;AAqB3E;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAkD;IAElD,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,0FAA0F;YAC1F,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEzC,MAAM,MAAM,GAAG,MAAA,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;YAE9F,gFAAgF;YAChF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,KAAiB,EAAE;gBAC9E,WAAW,EAAE,OAAO,CAAC,WAAW;aACjC,CAAC,CAAC;YACH,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,KAAK,EAAE,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OAuth2Flow } from \"../../auth/oauth2Flows.js\";\nimport type { OAuth2TokenCredential } from \"../../auth/credentials.js\";\nimport type { AuthScheme } from \"../../auth/schemes.js\";\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../../interfaces.js\";\nimport type { PipelinePolicy } from \"../../pipeline.js\";\nimport { ensureSecureConnection } from \"./checkInsecureConnection.js\";\n\n/**\n * Name of the OAuth2 Authentication Policy\n */\nexport const oauth2AuthenticationPolicyName = \"oauth2AuthenticationPolicy\";\n\n/**\n * Options for configuring the OAuth2 authentication policy\n */\nexport interface OAuth2AuthenticationPolicyOptions<TFlows extends OAuth2Flow> {\n /**\n * The OAuth2TokenCredential implementation that can supply the bearer token.\n */\n credential: OAuth2TokenCredential<TFlows>;\n /**\n * Optional authentication schemes to use. If not provided, schemes from the request will be used.\n */\n authSchemes?: AuthScheme[];\n /**\n * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.\n * CAUTION: Never use this option in production.\n */\n allowInsecureConnection?: boolean;\n}\n\n/**\n * Gets a pipeline policy that adds authorization header from OAuth2 schemes\n */\nexport function oauth2AuthenticationPolicy<TFlows extends OAuth2Flow>(\n options: OAuth2AuthenticationPolicyOptions<TFlows>,\n): PipelinePolicy {\n return {\n name: oauth2AuthenticationPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs\n ensureSecureConnection(request, options);\n\n const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === \"oauth2\");\n\n // Skip adding authentication header if no OAuth2 authentication scheme is found\n if (!scheme) {\n return next(request);\n }\n const token = await options.credential.getOAuth2Token(scheme.flows as TFlows[], {\n abortSignal: request.abortSignal,\n });\n request.headers.set(\"Authorization\", `Bearer ${token}`);\n return next(request);\n },\n };\n}\n"]}
@@ -1,4 +1,3 @@
1
- import type { AbortSignalLike } from "../abort-controller/AbortSignalLike.js";
2
1
  /**
3
2
  * Options related to abort controller.
4
3
  */
@@ -6,7 +5,7 @@ export interface AbortOptions {
6
5
  /**
7
6
  * The abortSignal associated with containing operation.
8
7
  */
9
- abortSignal?: AbortSignalLike;
8
+ abortSignal?: AbortSignal;
10
9
  /**
11
10
  * The abort error message associated with containing operation.
12
11
  */
@@ -16,12 +15,12 @@ export interface AbortOptions {
16
15
  * Represents a function that returns a promise that can be aborted.
17
16
  */
18
17
  export type AbortablePromiseBuilder<T> = (abortOptions: {
19
- abortSignal?: AbortSignalLike;
18
+ abortSignal?: AbortSignal;
20
19
  }) => Promise<T>;
21
20
  /**
22
21
  * promise.race() wrapper that aborts rest of promises as soon as the first promise settles.
23
22
  */
24
23
  export declare function cancelablePromiseRace<T extends unknown[]>(abortablePromiseBuilders: AbortablePromiseBuilder<T[number]>[], options?: {
25
- abortSignal?: AbortSignalLike;
24
+ abortSignal?: AbortSignal;
26
25
  }): Promise<T[number]>;
27
26
  //# sourceMappingURL=aborterUtils.d.ts.map