@azure/storage-queue 12.29.0 → 12.30.0-beta.1

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 (256) hide show
  1. package/dist/browser/Pipeline.d.ts +2 -3
  2. package/dist/browser/Pipeline.d.ts.map +1 -1
  3. package/dist/browser/Pipeline.js.map +1 -1
  4. package/dist/browser/QueueClient.d.ts +2 -1
  5. package/dist/browser/QueueClient.d.ts.map +1 -1
  6. package/dist/browser/QueueClient.js.map +1 -1
  7. package/dist/browser/QueueSASSignatureValues.d.ts +2 -1
  8. package/dist/browser/QueueSASSignatureValues.d.ts.map +1 -1
  9. package/dist/browser/QueueSASSignatureValues.js +2 -2
  10. package/dist/browser/QueueSASSignatureValues.js.map +1 -1
  11. package/dist/browser/QueueServiceClient.d.ts +28 -0
  12. package/dist/browser/QueueServiceClient.d.ts.map +1 -1
  13. package/dist/browser/QueueServiceClient.js +21 -13
  14. package/dist/browser/QueueServiceClient.js.map +1 -1
  15. package/dist/browser/SASQueryParameters.d.ts +6 -1
  16. package/dist/browser/SASQueryParameters.d.ts.map +1 -1
  17. package/dist/browser/SASQueryParameters.js +10 -0
  18. package/dist/browser/SASQueryParameters.js.map +1 -1
  19. package/dist/browser/generated/src/models/index.d.ts +4 -0
  20. package/dist/browser/generated/src/models/index.d.ts.map +1 -1
  21. package/dist/browser/generated/src/models/index.js.map +1 -1
  22. package/dist/browser/generated/src/models/mappers.d.ts.map +1 -1
  23. package/dist/browser/generated/src/models/mappers.js +14 -0
  24. package/dist/browser/generated/src/models/mappers.js.map +1 -1
  25. package/dist/browser/generated/src/models/parameters.js +1 -1
  26. package/dist/browser/generated/src/models/parameters.js.map +1 -1
  27. package/dist/browser/generated/src/storageClient.js +2 -2
  28. package/dist/browser/generated/src/storageClient.js.map +1 -1
  29. package/dist/browser/generatedModels.d.ts +2 -2
  30. package/dist/browser/generatedModels.d.ts.map +1 -1
  31. package/dist/browser/generatedModels.js.map +1 -1
  32. package/dist/browser/index.d.ts +8 -8
  33. package/dist/browser/index.d.ts.map +1 -0
  34. package/dist/browser/index.js +1 -2
  35. package/dist/browser/index.js.map +1 -0
  36. package/dist/browser/utils/constants.d.ts.map +1 -1
  37. package/dist/browser/utils/constants.js +2 -2
  38. package/dist/browser/utils/constants.js.map +1 -1
  39. package/dist/commonjs/AccountSASPermissions.js +133 -126
  40. package/dist/commonjs/AccountSASPermissions.js.map +7 -1
  41. package/dist/commonjs/AccountSASResourceTypes.js +80 -70
  42. package/dist/commonjs/AccountSASResourceTypes.js.map +7 -1
  43. package/dist/commonjs/AccountSASServices.js +88 -78
  44. package/dist/commonjs/AccountSASServices.js.map +7 -1
  45. package/dist/commonjs/AccountSASSignatureValues.js +91 -72
  46. package/dist/commonjs/AccountSASSignatureValues.js.map +7 -1
  47. package/dist/commonjs/Pipeline.d.ts +2 -3
  48. package/dist/commonjs/Pipeline.d.ts.map +1 -1
  49. package/dist/commonjs/Pipeline.js +244 -244
  50. package/dist/commonjs/Pipeline.js.map +7 -1
  51. package/dist/commonjs/QueueClient.d.ts +2 -1
  52. package/dist/commonjs/QueueClient.d.ts.map +1 -1
  53. package/dist/commonjs/QueueClient.js +710 -683
  54. package/dist/commonjs/QueueClient.js.map +7 -1
  55. package/dist/commonjs/QueueSASPermissions.js +90 -80
  56. package/dist/commonjs/QueueSASPermissions.js.map +7 -1
  57. package/dist/commonjs/QueueSASSignatureValues.d.ts +2 -1
  58. package/dist/commonjs/QueueSASSignatureValues.d.ts.map +1 -1
  59. package/dist/commonjs/QueueSASSignatureValues.js +151 -111
  60. package/dist/commonjs/QueueSASSignatureValues.js.map +7 -1
  61. package/dist/commonjs/QueueServiceClient.d.ts +28 -0
  62. package/dist/commonjs/QueueServiceClient.d.ts.map +1 -1
  63. package/dist/commonjs/QueueServiceClient.js +532 -472
  64. package/dist/commonjs/QueueServiceClient.js.map +7 -1
  65. package/dist/commonjs/SASQueryParameters.d.ts +6 -1
  66. package/dist/commonjs/SASQueryParameters.d.ts.map +1 -1
  67. package/dist/commonjs/SASQueryParameters.js +308 -267
  68. package/dist/commonjs/SASQueryParameters.js.map +7 -1
  69. package/dist/commonjs/SasIPRange.js +27 -14
  70. package/dist/commonjs/SasIPRange.js.map +7 -1
  71. package/dist/commonjs/StorageClient.js +75 -65
  72. package/dist/commonjs/StorageClient.js.map +7 -1
  73. package/dist/commonjs/StorageContextClient.js +34 -20
  74. package/dist/commonjs/StorageContextClient.js.map +7 -1
  75. package/dist/commonjs/generated/src/index.js +32 -16
  76. package/dist/commonjs/generated/src/index.js.map +7 -1
  77. package/dist/commonjs/generated/src/models/index.d.ts +4 -0
  78. package/dist/commonjs/generated/src/models/index.d.ts.map +1 -1
  79. package/dist/commonjs/generated/src/models/index.js +86 -129
  80. package/dist/commonjs/generated/src/models/index.js.map +7 -1
  81. package/dist/commonjs/generated/src/models/mappers.d.ts.map +1 -1
  82. package/dist/commonjs/generated/src/models/mappers.js +1947 -1817
  83. package/dist/commonjs/generated/src/models/mappers.js.map +7 -1
  84. package/dist/commonjs/generated/src/models/parameters.js +378 -305
  85. package/dist/commonjs/generated/src/models/parameters.js.map +7 -1
  86. package/dist/commonjs/generated/src/operations/index.js +27 -15
  87. package/dist/commonjs/generated/src/operations/index.js.map +7 -1
  88. package/dist/commonjs/generated/src/operations/messageId.js +130 -99
  89. package/dist/commonjs/generated/src/operations/messageId.js.map +7 -1
  90. package/dist/commonjs/generated/src/operations/messages.js +213 -185
  91. package/dist/commonjs/generated/src/operations/messages.js.map +7 -1
  92. package/dist/commonjs/generated/src/operations/queue.js +243 -206
  93. package/dist/commonjs/generated/src/operations/queue.js.map +7 -1
  94. package/dist/commonjs/generated/src/operations/service.js +239 -199
  95. package/dist/commonjs/generated/src/operations/service.js.map +7 -1
  96. package/dist/commonjs/generated/src/operationsInterfaces/index.js +27 -15
  97. package/dist/commonjs/generated/src/operationsInterfaces/index.js.map +7 -1
  98. package/dist/commonjs/generated/src/operationsInterfaces/messageId.js +15 -10
  99. package/dist/commonjs/generated/src/operationsInterfaces/messageId.js.map +7 -1
  100. package/dist/commonjs/generated/src/operationsInterfaces/messages.js +15 -10
  101. package/dist/commonjs/generated/src/operationsInterfaces/messages.js.map +7 -1
  102. package/dist/commonjs/generated/src/operationsInterfaces/queue.js +15 -10
  103. package/dist/commonjs/generated/src/operationsInterfaces/queue.js.map +7 -1
  104. package/dist/commonjs/generated/src/operationsInterfaces/service.js +15 -10
  105. package/dist/commonjs/generated/src/operationsInterfaces/service.js.map +7 -1
  106. package/dist/commonjs/generated/src/storageClient.js +77 -59
  107. package/dist/commonjs/generated/src/storageClient.js.map +7 -1
  108. package/dist/commonjs/generatedModels.d.ts +2 -2
  109. package/dist/commonjs/generatedModels.d.ts.map +1 -1
  110. package/dist/commonjs/generatedModels.js +15 -5
  111. package/dist/commonjs/generatedModels.js.map +7 -1
  112. package/dist/commonjs/index.d.ts +9 -9
  113. package/dist/commonjs/index.d.ts.map +1 -1
  114. package/dist/commonjs/index.js +88 -43
  115. package/dist/commonjs/index.js.map +7 -1
  116. package/dist/commonjs/log.js +28 -11
  117. package/dist/commonjs/log.js.map +7 -1
  118. package/dist/commonjs/models.js +33 -21
  119. package/dist/commonjs/models.js.map +7 -1
  120. package/dist/commonjs/tsdoc-metadata.json +1 -1
  121. package/dist/commonjs/utils/constants.d.ts.map +1 -1
  122. package/dist/commonjs/utils/constants.js +151 -114
  123. package/dist/commonjs/utils/constants.js.map +7 -1
  124. package/dist/commonjs/utils/tracing.js +32 -16
  125. package/dist/commonjs/utils/tracing.js.map +7 -1
  126. package/dist/commonjs/utils/utils.common.js +242 -338
  127. package/dist/commonjs/utils/utils.common.js.map +7 -1
  128. package/dist/esm/AccountSASPermissions.js +111 -123
  129. package/dist/esm/AccountSASPermissions.js.map +7 -1
  130. package/dist/esm/AccountSASResourceTypes.js +58 -67
  131. package/dist/esm/AccountSASResourceTypes.js.map +7 -1
  132. package/dist/esm/AccountSASServices.js +66 -75
  133. package/dist/esm/AccountSASServices.js.map +7 -1
  134. package/dist/esm/AccountSASSignatureValues.js +62 -63
  135. package/dist/esm/AccountSASSignatureValues.js.map +7 -1
  136. package/dist/esm/Pipeline.d.ts +2 -3
  137. package/dist/esm/Pipeline.d.ts.map +1 -1
  138. package/dist/esm/Pipeline.js +239 -239
  139. package/dist/esm/Pipeline.js.map +7 -1
  140. package/dist/esm/QueueClient.d.ts +2 -1
  141. package/dist/esm/QueueClient.d.ts.map +1 -1
  142. package/dist/esm/QueueClient.js +689 -671
  143. package/dist/esm/QueueClient.js.map +7 -1
  144. package/dist/esm/QueueSASPermissions.js +68 -77
  145. package/dist/esm/QueueSASPermissions.js.map +7 -1
  146. package/dist/esm/QueueSASSignatureValues.d.ts +2 -1
  147. package/dist/esm/QueueSASSignatureValues.d.ts.map +1 -1
  148. package/dist/esm/QueueSASSignatureValues.js +124 -104
  149. package/dist/esm/QueueSASSignatureValues.js.map +7 -1
  150. package/dist/esm/QueueServiceClient.d.ts +28 -0
  151. package/dist/esm/QueueServiceClient.d.ts.map +1 -1
  152. package/dist/esm/QueueServiceClient.js +507 -457
  153. package/dist/esm/QueueServiceClient.js.map +7 -1
  154. package/dist/esm/SASQueryParameters.d.ts +6 -1
  155. package/dist/esm/SASQueryParameters.d.ts.map +1 -1
  156. package/dist/esm/SASQueryParameters.js +283 -262
  157. package/dist/esm/SASQueryParameters.js.map +7 -1
  158. package/dist/esm/SasIPRange.js +5 -12
  159. package/dist/esm/SasIPRange.js.map +7 -1
  160. package/dist/esm/StorageClient.js +50 -59
  161. package/dist/esm/StorageClient.js.map +7 -1
  162. package/dist/esm/StorageContextClient.js +10 -15
  163. package/dist/esm/StorageContextClient.js.map +7 -1
  164. package/dist/esm/generated/src/index.js +4 -9
  165. package/dist/esm/generated/src/index.js.map +7 -1
  166. package/dist/esm/generated/src/models/index.d.ts +4 -0
  167. package/dist/esm/generated/src/models/index.d.ts.map +1 -1
  168. package/dist/esm/generated/src/models/index.js +63 -126
  169. package/dist/esm/generated/src/models/index.js.map +7 -1
  170. package/dist/esm/generated/src/models/mappers.d.ts.map +1 -1
  171. package/dist/esm/generated/src/models/mappers.js +1873 -1813
  172. package/dist/esm/generated/src/models/mappers.js.map +7 -1
  173. package/dist/esm/generated/src/models/parameters.js +330 -302
  174. package/dist/esm/generated/src/models/parameters.js.map +7 -1
  175. package/dist/esm/generated/src/operations/index.js +0 -8
  176. package/dist/esm/generated/src/operations/index.js.map +7 -1
  177. package/dist/esm/generated/src/operations/messageId.js +95 -92
  178. package/dist/esm/generated/src/operations/messageId.js.map +7 -1
  179. package/dist/esm/generated/src/operations/messages.js +178 -178
  180. package/dist/esm/generated/src/operations/messages.js.map +7 -1
  181. package/dist/esm/generated/src/operations/queue.js +208 -199
  182. package/dist/esm/generated/src/operations/queue.js.map +7 -1
  183. package/dist/esm/generated/src/operations/service.js +204 -192
  184. package/dist/esm/generated/src/operations/service.js.map +7 -1
  185. package/dist/esm/generated/src/operationsInterfaces/index.js +0 -8
  186. package/dist/esm/generated/src/operationsInterfaces/index.js.map +7 -1
  187. package/dist/esm/generated/src/operationsInterfaces/messageId.js +0 -9
  188. package/dist/esm/generated/src/operationsInterfaces/messageId.js.map +7 -1
  189. package/dist/esm/generated/src/operationsInterfaces/messages.js +0 -9
  190. package/dist/esm/generated/src/operationsInterfaces/messages.js.map +7 -1
  191. package/dist/esm/generated/src/operationsInterfaces/queue.js +0 -9
  192. package/dist/esm/generated/src/operationsInterfaces/queue.js.map +7 -1
  193. package/dist/esm/generated/src/operationsInterfaces/service.js +0 -9
  194. package/dist/esm/generated/src/operationsInterfaces/service.js.map +7 -1
  195. package/dist/esm/generated/src/storageClient.js +49 -54
  196. package/dist/esm/generated/src/storageClient.js.map +7 -1
  197. package/dist/esm/generatedModels.d.ts +2 -2
  198. package/dist/esm/generatedModels.d.ts.map +1 -1
  199. package/dist/esm/generatedModels.js +0 -4
  200. package/dist/esm/generatedModels.js.map +7 -1
  201. package/dist/esm/index.d.ts +9 -9
  202. package/dist/esm/index.d.ts.map +1 -1
  203. package/dist/esm/index.js +50 -11
  204. package/dist/esm/index.js.map +7 -1
  205. package/dist/esm/log.js +4 -7
  206. package/dist/esm/log.js.map +7 -1
  207. package/dist/esm/models.js +10 -18
  208. package/dist/esm/models.js.map +7 -1
  209. package/dist/esm/utils/constants.d.ts.map +1 -1
  210. package/dist/esm/utils/constants.js +117 -111
  211. package/dist/esm/utils/constants.js.map +7 -1
  212. package/dist/esm/utils/tracing.js +7 -11
  213. package/dist/esm/utils/tracing.js.map +7 -1
  214. package/dist/esm/utils/utils.common.js +247 -358
  215. package/dist/esm/utils/utils.common.js.map +7 -1
  216. package/dist/react-native/Pipeline.d.ts +2 -3
  217. package/dist/react-native/Pipeline.d.ts.map +1 -1
  218. package/dist/react-native/Pipeline.js.map +1 -1
  219. package/dist/react-native/QueueClient.d.ts +2 -1
  220. package/dist/react-native/QueueClient.d.ts.map +1 -1
  221. package/dist/react-native/QueueClient.js.map +1 -1
  222. package/dist/react-native/QueueSASSignatureValues.d.ts +2 -1
  223. package/dist/react-native/QueueSASSignatureValues.d.ts.map +1 -1
  224. package/dist/react-native/QueueSASSignatureValues.js +2 -2
  225. package/dist/react-native/QueueSASSignatureValues.js.map +1 -1
  226. package/dist/react-native/QueueServiceClient.d.ts +28 -0
  227. package/dist/react-native/QueueServiceClient.d.ts.map +1 -1
  228. package/dist/react-native/QueueServiceClient.js +21 -13
  229. package/dist/react-native/QueueServiceClient.js.map +1 -1
  230. package/dist/react-native/SASQueryParameters.d.ts +6 -1
  231. package/dist/react-native/SASQueryParameters.d.ts.map +1 -1
  232. package/dist/react-native/SASQueryParameters.js +10 -0
  233. package/dist/react-native/SASQueryParameters.js.map +1 -1
  234. package/dist/react-native/generated/src/models/index.d.ts +4 -0
  235. package/dist/react-native/generated/src/models/index.d.ts.map +1 -1
  236. package/dist/react-native/generated/src/models/index.js.map +1 -1
  237. package/dist/react-native/generated/src/models/mappers.d.ts.map +1 -1
  238. package/dist/react-native/generated/src/models/mappers.js +14 -0
  239. package/dist/react-native/generated/src/models/mappers.js.map +1 -1
  240. package/dist/react-native/generated/src/models/parameters.js +1 -1
  241. package/dist/react-native/generated/src/models/parameters.js.map +1 -1
  242. package/dist/react-native/generated/src/storageClient.js +2 -2
  243. package/dist/react-native/generated/src/storageClient.js.map +1 -1
  244. package/dist/react-native/generatedModels.d.ts +2 -2
  245. package/dist/react-native/generatedModels.d.ts.map +1 -1
  246. package/dist/react-native/generatedModels.js.map +1 -1
  247. package/dist/react-native/index.d.ts +9 -9
  248. package/dist/react-native/index.d.ts.map +1 -1
  249. package/dist/react-native/index.js +0 -1
  250. package/dist/react-native/index.js.map +1 -1
  251. package/dist/react-native/utils/constants.d.ts.map +1 -1
  252. package/dist/react-native/utils/constants.js +2 -2
  253. package/dist/react-native/utils/constants.js.map +1 -1
  254. package/package.json +2 -19
  255. package/dist/browser/index-browser.d.mts.map +0 -1
  256. package/dist/browser/index-browser.mjs.map +0 -1
@@ -1,277 +1,277 @@
1
- "use strict";
2
- // Copyright (c) Microsoft Corporation.
3
- // Licensed under the MIT License.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.Pipeline = exports.StorageOAuthScopes = void 0;
6
- exports.isPipelineLike = isPipelineLike;
7
- exports.newPipeline = newPipeline;
8
- exports.getCoreClientOptions = getCoreClientOptions;
9
- exports.getCredentialFromPipeline = getCredentialFromPipeline;
10
- const core_http_compat_1 = require("@azure/core-http-compat");
11
- const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
12
- const core_client_1 = require("@azure/core-client");
13
- const core_xml_1 = require("@azure/core-xml");
14
- const core_auth_1 = require("@azure/core-auth");
15
- const log_js_1 = require("./log.js");
16
- const storage_common_1 = require("@azure/storage-common");
17
- const constants_js_1 = require("./utils/constants.js");
18
- Object.defineProperty(exports, "StorageOAuthScopes", { enumerable: true, get: function () { return constants_js_1.StorageOAuthScopes; } });
19
- /**
20
- * A helper to decide if a given argument satisfies the Pipeline contract
21
- * @param pipeline - An argument that may be a Pipeline
22
- * @returns true when the argument satisfies the Pipeline contract
23
- */
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var Pipeline_exports = {};
19
+ __export(Pipeline_exports, {
20
+ Pipeline: () => Pipeline,
21
+ StorageOAuthScopes: () => import_constants.StorageOAuthScopes,
22
+ getCoreClientOptions: () => getCoreClientOptions,
23
+ getCredentialFromPipeline: () => getCredentialFromPipeline,
24
+ isPipelineLike: () => isPipelineLike,
25
+ newPipeline: () => newPipeline
26
+ });
27
+ module.exports = __toCommonJS(Pipeline_exports);
28
+ var import_core_http_compat = require("@azure/core-http-compat");
29
+ var import_core_rest_pipeline = require("@azure/core-rest-pipeline");
30
+ var import_core_client = require("@azure/core-client");
31
+ var import_core_xml = require("@azure/core-xml");
32
+ var import_core_auth = require("@azure/core-auth");
33
+ var import_log = require("./log.js");
34
+ var import_storage_common = require("@azure/storage-common");
35
+ var import_constants = require("./utils/constants.js");
24
36
  function isPipelineLike(pipeline) {
25
- if (!pipeline || typeof pipeline !== "object") {
26
- return false;
27
- }
28
- const castPipeline = pipeline;
29
- return (Array.isArray(castPipeline.factories) &&
30
- typeof castPipeline.options === "object" &&
31
- typeof castPipeline.toServiceClientOptions === "function");
37
+ if (!pipeline || typeof pipeline !== "object") {
38
+ return false;
39
+ }
40
+ const castPipeline = pipeline;
41
+ return Array.isArray(castPipeline.factories) && typeof castPipeline.options === "object" && typeof castPipeline.toServiceClientOptions === "function";
32
42
  }
33
- /**
34
- * A Pipeline class containing HTTP request policies.
35
- * You can create a default Pipeline by calling {@link newPipeline}.
36
- * Or you can create a Pipeline with your own policies by the constructor of Pipeline.
37
- *
38
- * Refer to {@link newPipeline} and provided policies before implementing your
39
- * customized Pipeline.
40
- */
41
43
  class Pipeline {
42
- /**
43
- * A list of chained request policy factories.
44
- */
45
- factories;
46
- /**
47
- * Configures pipeline logger and HTTP client.
48
- */
49
- options;
50
- /**
51
- * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.
52
- *
53
- * @param factories -
54
- * @param options -
55
- */
56
- constructor(factories, options = {}) {
57
- this.factories = factories;
58
- this.options = options;
59
- }
60
- /**
61
- * Transfer Pipeline object to ServiceClientOptions object which is required by
62
- * ServiceClient constructor.
63
- *
64
- * @returns The ServiceClientOptions object from this Pipeline.
65
- */
66
- toServiceClientOptions() {
67
- return {
68
- httpClient: this.options.httpClient,
69
- requestPolicyFactories: this.factories,
70
- };
71
- }
44
+ /**
45
+ * A list of chained request policy factories.
46
+ */
47
+ factories;
48
+ /**
49
+ * Configures pipeline logger and HTTP client.
50
+ */
51
+ options;
52
+ /**
53
+ * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.
54
+ *
55
+ * @param factories -
56
+ * @param options -
57
+ */
58
+ constructor(factories, options = {}) {
59
+ this.factories = factories;
60
+ this.options = options;
61
+ }
62
+ /**
63
+ * Transfer Pipeline object to ServiceClientOptions object which is required by
64
+ * ServiceClient constructor.
65
+ *
66
+ * @returns The ServiceClientOptions object from this Pipeline.
67
+ */
68
+ toServiceClientOptions() {
69
+ return {
70
+ httpClient: this.options.httpClient,
71
+ requestPolicyFactories: this.factories
72
+ };
73
+ }
72
74
  }
73
- exports.Pipeline = Pipeline;
74
- /**
75
- * Creates a new Pipeline object with Credential provided.
76
- *
77
- * @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
78
- * @param pipelineOptions - Optional. Options.
79
- * @returns A new Pipeline object.
80
- */
81
75
  function newPipeline(credential, pipelineOptions = {}) {
82
- if (!credential) {
83
- credential = new storage_common_1.AnonymousCredential();
84
- }
85
- const pipeline = new Pipeline([], pipelineOptions);
86
- pipeline._credential = credential;
87
- return pipeline;
76
+ if (!credential) {
77
+ credential = new import_storage_common.AnonymousCredential();
78
+ }
79
+ const pipeline = new Pipeline([], pipelineOptions);
80
+ pipeline._credential = credential;
81
+ return pipeline;
88
82
  }
89
83
  function processDownlevelPipeline(pipeline) {
90
- const knownFactoryFunctions = [
91
- isAnonymousCredential,
92
- isStorageSharedKeyCredential,
93
- isCoreHttpBearerTokenFactory,
94
- isStorageBrowserPolicyFactory,
95
- isStorageRetryPolicyFactory,
96
- isStorageTelemetryPolicyFactory,
97
- isCoreHttpPolicyFactory,
98
- ];
99
- if (pipeline.factories.length) {
100
- const novelFactories = pipeline.factories.filter((factory) => {
101
- return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));
102
- });
103
- if (novelFactories.length) {
104
- const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));
105
- // if there are any left over, wrap in a requestPolicyFactoryPolicy
106
- return {
107
- wrappedPolicies: (0, core_http_compat_1.createRequestPolicyFactoryPolicy)(novelFactories),
108
- afterRetry: hasInjector,
109
- };
110
- }
84
+ const knownFactoryFunctions = [
85
+ isAnonymousCredential,
86
+ isStorageSharedKeyCredential,
87
+ isCoreHttpBearerTokenFactory,
88
+ isStorageBrowserPolicyFactory,
89
+ isStorageRetryPolicyFactory,
90
+ isStorageTelemetryPolicyFactory,
91
+ isCoreHttpPolicyFactory
92
+ ];
93
+ if (pipeline.factories.length) {
94
+ const novelFactories = pipeline.factories.filter((factory) => {
95
+ return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));
96
+ });
97
+ if (novelFactories.length) {
98
+ const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));
99
+ return {
100
+ wrappedPolicies: (0, import_core_http_compat.createRequestPolicyFactoryPolicy)(novelFactories),
101
+ afterRetry: hasInjector
102
+ };
111
103
  }
112
- return undefined;
104
+ }
105
+ return void 0;
113
106
  }
114
107
  function getCoreClientOptions(pipeline) {
115
- const { httpClient: v1Client, ...restOptions } = pipeline.options;
116
- let httpClient = pipeline._coreHttpClient;
117
- if (!httpClient) {
118
- httpClient = v1Client ? (0, core_http_compat_1.convertHttpClient)(v1Client) : (0, storage_common_1.getCachedDefaultHttpClient)();
119
- pipeline._coreHttpClient = httpClient;
120
- }
121
- let corePipeline = pipeline._corePipeline;
122
- if (!corePipeline) {
123
- const packageDetails = `azsdk-js-azure-storage-blob/${constants_js_1.SDK_VERSION}`;
124
- const userAgentPrefix = restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix
125
- ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`
126
- : `${packageDetails}`;
127
- corePipeline = (0, core_client_1.createClientPipeline)({
128
- ...restOptions,
129
- loggingOptions: {
130
- additionalAllowedHeaderNames: constants_js_1.StorageQueueLoggingAllowedHeaderNames,
131
- additionalAllowedQueryParameters: constants_js_1.StorageQueueLoggingAllowedQueryParameters,
132
- logger: log_js_1.logger.info,
133
- },
134
- userAgentOptions: {
135
- userAgentPrefix,
136
- },
137
- serializationOptions: {
138
- stringifyXML: core_xml_1.stringifyXML,
139
- serializerOptions: {
140
- xml: {
141
- // Use customized XML char key of "#" so we can deserialize metadata
142
- // with "_" key
143
- xmlCharKey: "#",
144
- },
145
- },
146
- },
147
- deserializationOptions: {
148
- parseXML: core_xml_1.parseXML,
149
- serializerOptions: {
150
- xml: {
151
- // Use customized XML char key of "#" so we can deserialize metadata
152
- // with "_" key
153
- xmlCharKey: "#",
154
- },
155
- },
156
- },
157
- });
158
- corePipeline.removePolicy({ phase: "Retry" });
159
- corePipeline.removePolicy({ name: core_rest_pipeline_1.decompressResponsePolicyName });
160
- corePipeline.addPolicy((0, storage_common_1.storageCorrectContentLengthPolicy)());
161
- corePipeline.addPolicy((0, storage_common_1.storageRetryPolicy)(restOptions.retryOptions), { phase: "Retry" });
162
- corePipeline.addPolicy((0, storage_common_1.storageRequestFailureDetailsParserPolicy)());
163
- corePipeline.addPolicy((0, storage_common_1.storageBrowserPolicy)());
164
- const downlevelResults = processDownlevelPipeline(pipeline);
165
- if (downlevelResults) {
166
- corePipeline.addPolicy(downlevelResults.wrappedPolicies, downlevelResults.afterRetry ? { afterPhase: "Retry" } : undefined);
167
- }
168
- const credential = getCredentialFromPipeline(pipeline);
169
- if ((0, core_auth_1.isTokenCredential)(credential)) {
170
- corePipeline.addPolicy((0, core_rest_pipeline_1.bearerTokenAuthenticationPolicy)({
171
- credential,
172
- scopes: restOptions.audience ?? constants_js_1.StorageOAuthScopes,
173
- challengeCallbacks: { authorizeRequestOnChallenge: core_client_1.authorizeRequestOnTenantChallenge },
174
- }), { phase: "Sign" });
108
+ const { httpClient: v1Client, ...restOptions } = pipeline.options;
109
+ let httpClient = pipeline._coreHttpClient;
110
+ if (!httpClient) {
111
+ httpClient = v1Client ? (0, import_core_http_compat.convertHttpClient)(v1Client) : (0, import_storage_common.getCachedDefaultHttpClient)();
112
+ pipeline._coreHttpClient = httpClient;
113
+ }
114
+ let corePipeline = pipeline._corePipeline;
115
+ if (!corePipeline) {
116
+ const packageDetails = `azsdk-js-azure-storage-blob/${import_constants.SDK_VERSION}`;
117
+ const userAgentPrefix = restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`;
118
+ corePipeline = (0, import_core_client.createClientPipeline)({
119
+ ...restOptions,
120
+ loggingOptions: {
121
+ additionalAllowedHeaderNames: import_constants.StorageQueueLoggingAllowedHeaderNames,
122
+ additionalAllowedQueryParameters: import_constants.StorageQueueLoggingAllowedQueryParameters,
123
+ logger: import_log.logger.info
124
+ },
125
+ userAgentOptions: {
126
+ userAgentPrefix
127
+ },
128
+ serializationOptions: {
129
+ stringifyXML: import_core_xml.stringifyXML,
130
+ serializerOptions: {
131
+ xml: {
132
+ // Use customized XML char key of "#" so we can deserialize metadata
133
+ // with "_" key
134
+ xmlCharKey: "#"
135
+ }
175
136
  }
176
- else if (credential instanceof storage_common_1.StorageSharedKeyCredential) {
177
- corePipeline.addPolicy((0, storage_common_1.storageSharedKeyCredentialPolicy)({
178
- accountName: credential.accountName,
179
- accountKey: credential.accountKey,
180
- }), { phase: "Sign" });
137
+ },
138
+ deserializationOptions: {
139
+ parseXML: import_core_xml.parseXML,
140
+ serializerOptions: {
141
+ xml: {
142
+ // Use customized XML char key of "#" so we can deserialize metadata
143
+ // with "_" key
144
+ xmlCharKey: "#"
145
+ }
181
146
  }
182
- pipeline._corePipeline = corePipeline;
147
+ }
148
+ });
149
+ corePipeline.removePolicy({ phase: "Retry" });
150
+ corePipeline.removePolicy({ name: import_core_rest_pipeline.decompressResponsePolicyName });
151
+ corePipeline.addPolicy((0, import_storage_common.storageCorrectContentLengthPolicy)());
152
+ corePipeline.addPolicy((0, import_storage_common.storageRetryPolicy)(restOptions.retryOptions), { phase: "Retry" });
153
+ corePipeline.addPolicy((0, import_storage_common.storageRequestFailureDetailsParserPolicy)());
154
+ corePipeline.addPolicy((0, import_storage_common.storageBrowserPolicy)());
155
+ const downlevelResults = processDownlevelPipeline(pipeline);
156
+ if (downlevelResults) {
157
+ corePipeline.addPolicy(
158
+ downlevelResults.wrappedPolicies,
159
+ downlevelResults.afterRetry ? { afterPhase: "Retry" } : void 0
160
+ );
183
161
  }
184
- return {
185
- ...restOptions,
186
- allowInsecureConnection: true,
187
- httpClient,
188
- pipeline: corePipeline,
189
- };
162
+ const credential = getCredentialFromPipeline(pipeline);
163
+ if ((0, import_core_auth.isTokenCredential)(credential)) {
164
+ corePipeline.addPolicy(
165
+ (0, import_core_rest_pipeline.bearerTokenAuthenticationPolicy)({
166
+ credential,
167
+ scopes: restOptions.audience ?? import_constants.StorageOAuthScopes,
168
+ challengeCallbacks: { authorizeRequestOnChallenge: import_core_client.authorizeRequestOnTenantChallenge }
169
+ }),
170
+ { phase: "Sign" }
171
+ );
172
+ } else if (credential instanceof import_storage_common.StorageSharedKeyCredential) {
173
+ corePipeline.addPolicy(
174
+ (0, import_storage_common.storageSharedKeyCredentialPolicy)({
175
+ accountName: credential.accountName,
176
+ accountKey: credential.accountKey
177
+ }),
178
+ { phase: "Sign" }
179
+ );
180
+ }
181
+ pipeline._corePipeline = corePipeline;
182
+ }
183
+ return {
184
+ ...restOptions,
185
+ allowInsecureConnection: true,
186
+ httpClient,
187
+ pipeline: corePipeline
188
+ };
190
189
  }
191
190
  function getCredentialFromPipeline(pipeline) {
192
- // see if we squirreled one away on the type itself
193
- if (pipeline._credential) {
194
- return pipeline._credential;
195
- }
196
- // if it came from another package, loop over the factories and look for one like before
197
- let credential = new storage_common_1.AnonymousCredential();
198
- for (const factory of pipeline.factories) {
199
- if ((0, core_auth_1.isTokenCredential)(factory.credential)) {
200
- // Only works if the factory has been attached a "credential" property.
201
- // We do that in newPipeline() when using TokenCredential.
202
- credential = factory.credential;
203
- }
204
- else if (isStorageSharedKeyCredential(factory)) {
205
- return factory;
206
- }
191
+ if (pipeline._credential) {
192
+ return pipeline._credential;
193
+ }
194
+ let credential = new import_storage_common.AnonymousCredential();
195
+ for (const factory of pipeline.factories) {
196
+ if ((0, import_core_auth.isTokenCredential)(factory.credential)) {
197
+ credential = factory.credential;
198
+ } else if (isStorageSharedKeyCredential(factory)) {
199
+ return factory;
207
200
  }
208
- return credential;
201
+ }
202
+ return credential;
209
203
  }
210
204
  function isStorageSharedKeyCredential(factory) {
211
- if (factory instanceof storage_common_1.StorageSharedKeyCredential) {
212
- return true;
213
- }
214
- return factory.constructor.name === "StorageSharedKeyCredential";
205
+ if (factory instanceof import_storage_common.StorageSharedKeyCredential) {
206
+ return true;
207
+ }
208
+ return factory.constructor.name === "StorageSharedKeyCredential";
215
209
  }
216
210
  function isAnonymousCredential(factory) {
217
- if (factory instanceof storage_common_1.AnonymousCredential) {
218
- return true;
219
- }
220
- return factory.constructor.name === "AnonymousCredential";
211
+ if (factory instanceof import_storage_common.AnonymousCredential) {
212
+ return true;
213
+ }
214
+ return factory.constructor.name === "AnonymousCredential";
221
215
  }
222
216
  function isCoreHttpBearerTokenFactory(factory) {
223
- return (0, core_auth_1.isTokenCredential)(factory.credential);
217
+ return (0, import_core_auth.isTokenCredential)(factory.credential);
224
218
  }
225
219
  function isStorageBrowserPolicyFactory(factory) {
226
- if (factory instanceof storage_common_1.StorageBrowserPolicyFactory) {
227
- return true;
228
- }
229
- return factory.constructor.name === "StorageBrowserPolicyFactory";
220
+ if (factory instanceof import_storage_common.StorageBrowserPolicyFactory) {
221
+ return true;
222
+ }
223
+ return factory.constructor.name === "StorageBrowserPolicyFactory";
230
224
  }
231
225
  function isStorageRetryPolicyFactory(factory) {
232
- if (factory instanceof storage_common_1.StorageRetryPolicyFactory) {
233
- return true;
234
- }
235
- return factory.constructor.name === "StorageRetryPolicyFactory";
226
+ if (factory instanceof import_storage_common.StorageRetryPolicyFactory) {
227
+ return true;
228
+ }
229
+ return factory.constructor.name === "StorageRetryPolicyFactory";
236
230
  }
237
231
  function isStorageTelemetryPolicyFactory(factory) {
238
- return factory.constructor.name === "TelemetryPolicyFactory";
232
+ return factory.constructor.name === "TelemetryPolicyFactory";
239
233
  }
240
234
  function isInjectorPolicyFactory(factory) {
241
- return factory.constructor.name === "InjectorPolicyFactory";
235
+ return factory.constructor.name === "InjectorPolicyFactory";
242
236
  }
243
237
  function isCoreHttpPolicyFactory(factory) {
244
- const knownPolicies = [
245
- "GenerateClientRequestIdPolicy",
246
- "TracingPolicy",
247
- "LogPolicy",
248
- "ProxyPolicy",
249
- "DisableResponseDecompressionPolicy",
250
- "KeepAlivePolicy",
251
- "DeserializationPolicy",
252
- ];
253
- const mockHttpClient = {
254
- sendRequest: async (request) => {
255
- return {
256
- request,
257
- headers: request.headers.clone(),
258
- status: 500,
259
- };
260
- },
261
- };
262
- const mockRequestPolicyOptions = {
263
- log(_logLevel, _message) {
264
- /* do nothing */
265
- },
266
- shouldLog(_logLevel) {
267
- return false;
268
- },
269
- };
270
- const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);
271
- const policyName = policyInstance.constructor.name;
272
- // bundlers sometimes add a custom suffix to the class name to make it unique
273
- return knownPolicies.some((knownPolicyName) => {
274
- return policyName.startsWith(knownPolicyName);
275
- });
238
+ const knownPolicies = [
239
+ "GenerateClientRequestIdPolicy",
240
+ "TracingPolicy",
241
+ "LogPolicy",
242
+ "ProxyPolicy",
243
+ "DisableResponseDecompressionPolicy",
244
+ "KeepAlivePolicy",
245
+ "DeserializationPolicy"
246
+ ];
247
+ const mockHttpClient = {
248
+ sendRequest: async (request) => {
249
+ return {
250
+ request,
251
+ headers: request.headers.clone(),
252
+ status: 500
253
+ };
254
+ }
255
+ };
256
+ const mockRequestPolicyOptions = {
257
+ log(_logLevel, _message) {
258
+ },
259
+ shouldLog(_logLevel) {
260
+ return false;
261
+ }
262
+ };
263
+ const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);
264
+ const policyName = policyInstance.constructor.name;
265
+ return knownPolicies.some((knownPolicyName) => {
266
+ return policyName.startsWith(knownPolicyName);
267
+ });
276
268
  }
277
- //# sourceMappingURL=Pipeline.js.map
269
+ // Annotate the CommonJS export names for ESM import in node:
270
+ 0 && (module.exports = {
271
+ Pipeline,
272
+ StorageOAuthScopes,
273
+ getCoreClientOptions,
274
+ getCredentialFromPipeline,
275
+ isPipelineLike,
276
+ newPipeline
277
+ });
@@ -1 +1,7 @@
1
- {"version":3,"file":"Pipeline.js","sourceRoot":"","sources":["../../src/Pipeline.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AA+HlC,wCAYC;AAmFD,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nimport type {\n KeepAliveOptions,\n ExtendedServiceClientOptions,\n HttpPipelineLogLevel,\n} from \"@azure/core-http-compat\";\nimport {\n CompatResponse as HttpOperationResponse,\n RequestPolicy as IHttpClient,\n HttpHeadersLike as HttpHeaders,\n RequestPolicy,\n RequestPolicyFactory,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n WebResourceLike as WebResource,\n convertHttpClient,\n createRequestPolicyFactoryPolicy,\n} from \"@azure/core-http-compat\";\nimport type {\n ProxySettings as ProxyOptions,\n UserAgentPolicyOptions as UserAgentOptions,\n Pipeline as CorePipeline,\n PipelinePolicy,\n HttpClient,\n} from \"@azure/core-rest-pipeline\";\nimport {\n RequestBodyType as HttpRequestBody,\n bearerTokenAuthenticationPolicy,\n decompressResponsePolicyName,\n} from \"@azure/core-rest-pipeline\";\nimport { authorizeRequestOnTenantChallenge, createClientPipeline } from \"@azure/core-client\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\n\nimport { logger } from \"./log.js\";\nimport type { StorageRetryOptions } from \"@azure/storage-common\";\nimport {\n StorageRetryPolicyFactory,\n StorageSharedKeyCredential,\n AnonymousCredential,\n getCachedDefaultHttpClient,\n storageBrowserPolicy,\n storageRetryPolicy,\n storageSharedKeyCredentialPolicy,\n StorageBrowserPolicyFactory,\n storageCorrectContentLengthPolicy,\n storageRequestFailureDetailsParserPolicy,\n} from \"@azure/storage-common\";\nimport {\n StorageOAuthScopes,\n StorageQueueLoggingAllowedHeaderNames,\n StorageQueueLoggingAllowedQueryParameters,\n SDK_VERSION,\n} from \"./utils/constants.js\";\n\n// Export following interfaces and types for customers who want to implement their\n// own RequestPolicy or HTTPClient\nexport {\n StorageOAuthScopes,\n IHttpClient,\n HttpHeaders,\n HttpRequestBody,\n HttpOperationResponse,\n WebResource,\n RequestPolicyFactory,\n RequestPolicy,\n RequestPolicyOptions,\n};\n\n/**\n * A subset of `@azure/core-http` ServiceClientOptions\n */\nexport interface ServiceClientOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * Optional. Overrides the default policy factories.\n */\n requestPolicyFactories?:\n | RequestPolicyFactory[]\n | ((defaultRequestPolicyFactories: RequestPolicyFactory[]) => void | RequestPolicyFactory[]);\n}\n\n/**\n * Option interface for Pipeline constructor.\n */\nexport interface PipelineOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n}\n\n/**\n * An interface for the {@link Pipeline} class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport interface PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n readonly options: PipelineOptions;\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n toServiceClientOptions(): ServiceClientOptions;\n}\n\n/**\n * A helper to decide if a given argument satisfies the Pipeline contract\n * @param pipeline - An argument that may be a Pipeline\n * @returns true when the argument satisfies the Pipeline contract\n */\nexport function isPipelineLike(pipeline: unknown): pipeline is PipelineLike {\n if (!pipeline || typeof pipeline !== \"object\") {\n return false;\n }\n\n const castPipeline = pipeline as PipelineLike;\n\n return (\n Array.isArray(castPipeline.factories) &&\n typeof castPipeline.options === \"object\" &&\n typeof castPipeline.toServiceClientOptions === \"function\"\n );\n}\n\n/**\n * A Pipeline class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport class Pipeline implements PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n public readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n public readonly options: PipelineOptions;\n\n /**\n * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.\n *\n * @param factories -\n * @param options -\n */\n constructor(factories: RequestPolicyFactory[], options: PipelineOptions = {}) {\n this.factories = factories;\n this.options = options;\n }\n\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n public toServiceClientOptions(): ServiceClientOptions {\n return {\n httpClient: this.options.httpClient,\n requestPolicyFactories: this.factories,\n };\n }\n}\n\n/**\n * Options interface for the {@link newPipeline} function.\n */\nexport interface StoragePipelineOptions {\n /**\n * Options to configure a proxy for outgoing requests.\n */\n proxyOptions?: ProxyOptions;\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentOptions;\n /**\n * Configures the built-in retry policy behavior.\n */\n retryOptions?: StorageRetryOptions;\n /**\n * Keep alive configurations. Default keep-alive is enabled.\n */\n keepAliveOptions?: KeepAliveOptions;\n /**\n * Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * The audience used to retrieve an AAD token.\n * By default, audience 'https://storage.azure.com/.default' will be used.\n */\n audience?: string;\n}\n\n/**\n * Creates a new Pipeline object with Credential provided.\n *\n * @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.\n * @param pipelineOptions - Optional. Options.\n * @returns A new Pipeline object.\n */\nexport function newPipeline(\n credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential,\n pipelineOptions: StoragePipelineOptions = {},\n): Pipeline {\n if (!credential) {\n credential = new AnonymousCredential();\n }\n const pipeline = new Pipeline([], pipelineOptions);\n (pipeline as any)._credential = credential;\n return pipeline;\n}\n\nfunction processDownlevelPipeline(\n pipeline: PipelineLike,\n): { wrappedPolicies: PipelinePolicy; afterRetry: boolean } | undefined {\n const knownFactoryFunctions = [\n isAnonymousCredential,\n isStorageSharedKeyCredential,\n isCoreHttpBearerTokenFactory,\n isStorageBrowserPolicyFactory,\n isStorageRetryPolicyFactory,\n isStorageTelemetryPolicyFactory,\n isCoreHttpPolicyFactory,\n ];\n if (pipeline.factories.length) {\n const novelFactories = pipeline.factories.filter((factory) => {\n return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));\n });\n if (novelFactories.length) {\n const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));\n // if there are any left over, wrap in a requestPolicyFactoryPolicy\n return {\n wrappedPolicies: createRequestPolicyFactoryPolicy(novelFactories),\n afterRetry: hasInjector,\n };\n }\n }\n return undefined;\n}\n\nexport function getCoreClientOptions(pipeline: PipelineLike): ExtendedServiceClientOptions {\n const { httpClient: v1Client, ...restOptions } = pipeline.options as StoragePipelineOptions;\n\n let httpClient: HttpClient = (pipeline as any)._coreHttpClient;\n if (!httpClient) {\n httpClient = v1Client ? convertHttpClient(v1Client) : getCachedDefaultHttpClient();\n (pipeline as any)._coreHttpClient = httpClient;\n }\n\n let corePipeline: CorePipeline = (pipeline as any)._corePipeline;\n if (!corePipeline) {\n const packageDetails = `azsdk-js-azure-storage-blob/${SDK_VERSION}`;\n const userAgentPrefix =\n restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix\n ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n corePipeline = createClientPipeline({\n ...restOptions,\n loggingOptions: {\n additionalAllowedHeaderNames: StorageQueueLoggingAllowedHeaderNames,\n additionalAllowedQueryParameters: StorageQueueLoggingAllowedQueryParameters,\n logger: logger.info,\n },\n userAgentOptions: {\n userAgentPrefix,\n },\n serializationOptions: {\n stringifyXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n deserializationOptions: {\n parseXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n });\n corePipeline.removePolicy({ phase: \"Retry\" });\n corePipeline.removePolicy({ name: decompressResponsePolicyName });\n corePipeline.addPolicy(storageCorrectContentLengthPolicy());\n corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: \"Retry\" });\n corePipeline.addPolicy(storageRequestFailureDetailsParserPolicy());\n corePipeline.addPolicy(storageBrowserPolicy());\n const downlevelResults = processDownlevelPipeline(pipeline);\n if (downlevelResults) {\n corePipeline.addPolicy(\n downlevelResults.wrappedPolicies,\n downlevelResults.afterRetry ? { afterPhase: \"Retry\" } : undefined,\n );\n }\n const credential = getCredentialFromPipeline(pipeline);\n if (isTokenCredential(credential)) {\n corePipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: restOptions.audience ?? StorageOAuthScopes,\n challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge },\n }),\n { phase: \"Sign\" },\n );\n } else if (credential instanceof StorageSharedKeyCredential) {\n corePipeline.addPolicy(\n storageSharedKeyCredentialPolicy({\n accountName: credential.accountName,\n accountKey: (credential as any).accountKey,\n }),\n { phase: \"Sign\" },\n );\n }\n (pipeline as any)._corePipeline = corePipeline;\n }\n return {\n ...restOptions,\n allowInsecureConnection: true,\n httpClient,\n pipeline: corePipeline,\n };\n}\n\nexport function getCredentialFromPipeline(\n pipeline: PipelineLike,\n): StorageSharedKeyCredential | AnonymousCredential | TokenCredential {\n // see if we squirreled one away on the type itself\n if ((pipeline as any)._credential) {\n return (pipeline as any)._credential;\n }\n // if it came from another package, loop over the factories and look for one like before\n let credential = new AnonymousCredential();\n for (const factory of pipeline.factories) {\n if (isTokenCredential((factory as any).credential)) {\n // Only works if the factory has been attached a \"credential\" property.\n // We do that in newPipeline() when using TokenCredential.\n credential = (factory as any).credential;\n } else if (isStorageSharedKeyCredential(factory)) {\n return factory;\n }\n }\n return credential;\n}\n\nfunction isStorageSharedKeyCredential(\n factory: RequestPolicyFactory,\n): factory is StorageSharedKeyCredential {\n if (factory instanceof StorageSharedKeyCredential) {\n return true;\n }\n return factory.constructor.name === \"StorageSharedKeyCredential\";\n}\n\nfunction isAnonymousCredential(factory: RequestPolicyFactory): factory is AnonymousCredential {\n if (factory instanceof AnonymousCredential) {\n return true;\n }\n return factory.constructor.name === \"AnonymousCredential\";\n}\n\nfunction isCoreHttpBearerTokenFactory(factory: RequestPolicyFactory): boolean {\n return isTokenCredential((factory as any).credential);\n}\n\nfunction isStorageBrowserPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageBrowserPolicyFactory {\n if (factory instanceof StorageBrowserPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageBrowserPolicyFactory\";\n}\n\nfunction isStorageRetryPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageRetryPolicyFactory {\n if (factory instanceof StorageRetryPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageRetryPolicyFactory\";\n}\n\nfunction isStorageTelemetryPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"TelemetryPolicyFactory\";\n}\n\nfunction isInjectorPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"InjectorPolicyFactory\";\n}\n\nfunction isCoreHttpPolicyFactory(factory: RequestPolicyFactory): boolean {\n const knownPolicies = [\n \"GenerateClientRequestIdPolicy\",\n \"TracingPolicy\",\n \"LogPolicy\",\n \"ProxyPolicy\",\n \"DisableResponseDecompressionPolicy\",\n \"KeepAlivePolicy\",\n \"DeserializationPolicy\",\n ];\n\n const mockHttpClient: IHttpClient = {\n sendRequest: async (request: WebResource) => {\n return {\n request,\n headers: request.headers.clone(),\n status: 500,\n };\n },\n };\n const mockRequestPolicyOptions: RequestPolicyOptions = {\n log(_logLevel: HttpPipelineLogLevel, _message: string): void {\n /* do nothing */\n },\n shouldLog(_logLevel: HttpPipelineLogLevel): boolean {\n return false;\n },\n };\n const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);\n const policyName = policyInstance.constructor.name;\n // bundlers sometimes add a custom suffix to the class name to make it unique\n return knownPolicies.some((knownPolicyName) => {\n return policyName.startsWith(knownPolicyName);\n });\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["/mnt/vss/_work/1/s/sdk/storage/storage-queue/src/Pipeline.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n KeepAliveOptions,\n ExtendedServiceClientOptions,\n HttpPipelineLogLevel,\n} from \"@azure/core-http-compat\";\nimport {\n CompatResponse as HttpOperationResponse,\n RequestPolicy as IHttpClient,\n HttpHeadersLike as HttpHeaders,\n RequestPolicy,\n RequestPolicyFactory,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n WebResourceLike as WebResource,\n convertHttpClient,\n createRequestPolicyFactoryPolicy,\n} from \"@azure/core-http-compat\";\nimport type {\n ProxySettings as ProxyOptions,\n UserAgentPolicyOptions as UserAgentOptions,\n Pipeline as CorePipeline,\n PipelinePolicy,\n HttpClient,\n RequestBodyType as HttpRequestBody,\n} from \"@azure/core-rest-pipeline\";\nimport {\n bearerTokenAuthenticationPolicy,\n decompressResponsePolicyName,\n} from \"@azure/core-rest-pipeline\";\nimport { authorizeRequestOnTenantChallenge, createClientPipeline } from \"@azure/core-client\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\n\nimport { logger } from \"./log.js\";\nimport type { StorageRetryOptions } from \"@azure/storage-common\";\nimport {\n StorageRetryPolicyFactory,\n StorageSharedKeyCredential,\n AnonymousCredential,\n getCachedDefaultHttpClient,\n storageBrowserPolicy,\n storageRetryPolicy,\n storageSharedKeyCredentialPolicy,\n StorageBrowserPolicyFactory,\n storageCorrectContentLengthPolicy,\n storageRequestFailureDetailsParserPolicy,\n} from \"@azure/storage-common\";\nimport {\n StorageOAuthScopes,\n StorageQueueLoggingAllowedHeaderNames,\n StorageQueueLoggingAllowedQueryParameters,\n SDK_VERSION,\n} from \"./utils/constants.js\";\n\n// Export following interfaces and types for customers who want to implement their\n// own RequestPolicy or HTTPClient\nexport {\n StorageOAuthScopes,\n type IHttpClient,\n type HttpHeaders,\n type HttpRequestBody,\n type HttpOperationResponse,\n type WebResource,\n type RequestPolicyFactory,\n type RequestPolicy,\n type RequestPolicyOptions,\n};\n\n/**\n * A subset of `@azure/core-http` ServiceClientOptions\n */\nexport interface ServiceClientOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * Optional. Overrides the default policy factories.\n */\n requestPolicyFactories?:\n | RequestPolicyFactory[]\n | ((defaultRequestPolicyFactories: RequestPolicyFactory[]) => void | RequestPolicyFactory[]);\n}\n\n/**\n * Option interface for Pipeline constructor.\n */\nexport interface PipelineOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n}\n\n/**\n * An interface for the {@link Pipeline} class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport interface PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n readonly options: PipelineOptions;\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n toServiceClientOptions(): ServiceClientOptions;\n}\n\n/**\n * A helper to decide if a given argument satisfies the Pipeline contract\n * @param pipeline - An argument that may be a Pipeline\n * @returns true when the argument satisfies the Pipeline contract\n */\nexport function isPipelineLike(pipeline: unknown): pipeline is PipelineLike {\n if (!pipeline || typeof pipeline !== \"object\") {\n return false;\n }\n\n const castPipeline = pipeline as PipelineLike;\n\n return (\n Array.isArray(castPipeline.factories) &&\n typeof castPipeline.options === \"object\" &&\n typeof castPipeline.toServiceClientOptions === \"function\"\n );\n}\n\n/**\n * A Pipeline class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport class Pipeline implements PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n public readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n public readonly options: PipelineOptions;\n\n /**\n * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.\n *\n * @param factories -\n * @param options -\n */\n constructor(factories: RequestPolicyFactory[], options: PipelineOptions = {}) {\n this.factories = factories;\n this.options = options;\n }\n\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n public toServiceClientOptions(): ServiceClientOptions {\n return {\n httpClient: this.options.httpClient,\n requestPolicyFactories: this.factories,\n };\n }\n}\n\n/**\n * Options interface for the {@link newPipeline} function.\n */\nexport interface StoragePipelineOptions {\n /**\n * Options to configure a proxy for outgoing requests.\n */\n proxyOptions?: ProxyOptions;\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentOptions;\n /**\n * Configures the built-in retry policy behavior.\n */\n retryOptions?: StorageRetryOptions;\n /**\n * Keep alive configurations. Default keep-alive is enabled.\n */\n keepAliveOptions?: KeepAliveOptions;\n /**\n * Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * The audience used to retrieve an AAD token.\n * By default, audience 'https://storage.azure.com/.default' will be used.\n */\n audience?: string;\n}\n\n/**\n * Creates a new Pipeline object with Credential provided.\n *\n * @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.\n * @param pipelineOptions - Optional. Options.\n * @returns A new Pipeline object.\n */\nexport function newPipeline(\n credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential,\n pipelineOptions: StoragePipelineOptions = {},\n): Pipeline {\n if (!credential) {\n credential = new AnonymousCredential();\n }\n const pipeline = new Pipeline([], pipelineOptions);\n (pipeline as any)._credential = credential;\n return pipeline;\n}\n\nfunction processDownlevelPipeline(\n pipeline: PipelineLike,\n): { wrappedPolicies: PipelinePolicy; afterRetry: boolean } | undefined {\n const knownFactoryFunctions = [\n isAnonymousCredential,\n isStorageSharedKeyCredential,\n isCoreHttpBearerTokenFactory,\n isStorageBrowserPolicyFactory,\n isStorageRetryPolicyFactory,\n isStorageTelemetryPolicyFactory,\n isCoreHttpPolicyFactory,\n ];\n if (pipeline.factories.length) {\n const novelFactories = pipeline.factories.filter((factory) => {\n return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));\n });\n if (novelFactories.length) {\n const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));\n // if there are any left over, wrap in a requestPolicyFactoryPolicy\n return {\n wrappedPolicies: createRequestPolicyFactoryPolicy(novelFactories),\n afterRetry: hasInjector,\n };\n }\n }\n return undefined;\n}\n\nexport function getCoreClientOptions(pipeline: PipelineLike): ExtendedServiceClientOptions {\n const { httpClient: v1Client, ...restOptions } = pipeline.options as StoragePipelineOptions;\n\n let httpClient: HttpClient = (pipeline as any)._coreHttpClient;\n if (!httpClient) {\n httpClient = v1Client ? convertHttpClient(v1Client) : getCachedDefaultHttpClient();\n (pipeline as any)._coreHttpClient = httpClient;\n }\n\n let corePipeline: CorePipeline = (pipeline as any)._corePipeline;\n if (!corePipeline) {\n const packageDetails = `azsdk-js-azure-storage-blob/${SDK_VERSION}`;\n const userAgentPrefix =\n restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix\n ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n corePipeline = createClientPipeline({\n ...restOptions,\n loggingOptions: {\n additionalAllowedHeaderNames: StorageQueueLoggingAllowedHeaderNames,\n additionalAllowedQueryParameters: StorageQueueLoggingAllowedQueryParameters,\n logger: logger.info,\n },\n userAgentOptions: {\n userAgentPrefix,\n },\n serializationOptions: {\n stringifyXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n deserializationOptions: {\n parseXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n });\n corePipeline.removePolicy({ phase: \"Retry\" });\n corePipeline.removePolicy({ name: decompressResponsePolicyName });\n corePipeline.addPolicy(storageCorrectContentLengthPolicy());\n corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: \"Retry\" });\n corePipeline.addPolicy(storageRequestFailureDetailsParserPolicy());\n corePipeline.addPolicy(storageBrowserPolicy());\n const downlevelResults = processDownlevelPipeline(pipeline);\n if (downlevelResults) {\n corePipeline.addPolicy(\n downlevelResults.wrappedPolicies,\n downlevelResults.afterRetry ? { afterPhase: \"Retry\" } : undefined,\n );\n }\n const credential = getCredentialFromPipeline(pipeline);\n if (isTokenCredential(credential)) {\n corePipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: restOptions.audience ?? StorageOAuthScopes,\n challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge },\n }),\n { phase: \"Sign\" },\n );\n } else if (credential instanceof StorageSharedKeyCredential) {\n corePipeline.addPolicy(\n storageSharedKeyCredentialPolicy({\n accountName: credential.accountName,\n accountKey: (credential as any).accountKey,\n }),\n { phase: \"Sign\" },\n );\n }\n (pipeline as any)._corePipeline = corePipeline;\n }\n return {\n ...restOptions,\n allowInsecureConnection: true,\n httpClient,\n pipeline: corePipeline,\n };\n}\n\nexport function getCredentialFromPipeline(\n pipeline: PipelineLike,\n): StorageSharedKeyCredential | AnonymousCredential | TokenCredential {\n // see if we squirreled one away on the type itself\n if ((pipeline as any)._credential) {\n return (pipeline as any)._credential;\n }\n // if it came from another package, loop over the factories and look for one like before\n let credential = new AnonymousCredential();\n for (const factory of pipeline.factories) {\n if (isTokenCredential((factory as any).credential)) {\n // Only works if the factory has been attached a \"credential\" property.\n // We do that in newPipeline() when using TokenCredential.\n credential = (factory as any).credential;\n } else if (isStorageSharedKeyCredential(factory)) {\n return factory;\n }\n }\n return credential;\n}\n\nfunction isStorageSharedKeyCredential(\n factory: RequestPolicyFactory,\n): factory is StorageSharedKeyCredential {\n if (factory instanceof StorageSharedKeyCredential) {\n return true;\n }\n return factory.constructor.name === \"StorageSharedKeyCredential\";\n}\n\nfunction isAnonymousCredential(factory: RequestPolicyFactory): factory is AnonymousCredential {\n if (factory instanceof AnonymousCredential) {\n return true;\n }\n return factory.constructor.name === \"AnonymousCredential\";\n}\n\nfunction isCoreHttpBearerTokenFactory(factory: RequestPolicyFactory): boolean {\n return isTokenCredential((factory as any).credential);\n}\n\nfunction isStorageBrowserPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageBrowserPolicyFactory {\n if (factory instanceof StorageBrowserPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageBrowserPolicyFactory\";\n}\n\nfunction isStorageRetryPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageRetryPolicyFactory {\n if (factory instanceof StorageRetryPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageRetryPolicyFactory\";\n}\n\nfunction isStorageTelemetryPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"TelemetryPolicyFactory\";\n}\n\nfunction isInjectorPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"InjectorPolicyFactory\";\n}\n\nfunction isCoreHttpPolicyFactory(factory: RequestPolicyFactory): boolean {\n const knownPolicies = [\n \"GenerateClientRequestIdPolicy\",\n \"TracingPolicy\",\n \"LogPolicy\",\n \"ProxyPolicy\",\n \"DisableResponseDecompressionPolicy\",\n \"KeepAlivePolicy\",\n \"DeserializationPolicy\",\n ];\n\n const mockHttpClient: IHttpClient = {\n sendRequest: async (request: WebResource) => {\n return {\n request,\n headers: request.headers.clone(),\n status: 500,\n };\n },\n };\n const mockRequestPolicyOptions: RequestPolicyOptions = {\n log(_logLevel: HttpPipelineLogLevel, _message: string): void {\n /* do nothing */\n },\n shouldLog(_logLevel: HttpPipelineLogLevel): boolean {\n return false;\n },\n };\n const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);\n const policyName = policyInstance.constructor.name;\n // bundlers sometimes add a custom suffix to the class name to make it unique\n return knownPolicies.some((knownPolicyName) => {\n return policyName.startsWith(knownPolicyName);\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,8BAUO;AASP,gCAGO;AACP,yBAAwE;AACxE,sBAAuC;AAEvC,uBAAkC;AAElC,iBAAuB;AAEvB,4BAWO;AACP,uBAKO;AAyEA,SAAS,eAAe,UAA6C;AAC1E,MAAI,CAAC,YAAY,OAAO,aAAa,UAAU;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,eAAe;AAErB,SACE,MAAM,QAAQ,aAAa,SAAS,KACpC,OAAO,aAAa,YAAY,YAChC,OAAO,aAAa,2BAA2B;AAEnD;AAUO,MAAM,SAAiC;AAAA;AAAA;AAAA;AAAA,EAI5B;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhB,YAAY,WAAmC,UAA2B,CAAC,GAAG;AAC5E,SAAK,YAAY;AACjB,SAAK,UAAU;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,yBA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ACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,iBAA8B;AAAA,IAClC,aAAa,OAAO,YAAyB;AAC3C,aAAO;AAAA,QACL;AAAA,QACA,SAAS,QAAQ,QAAQ,MAAM;AAAA,QAC/B,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACA,QAAM,2BAAiD;AAAA,IACrD,IAAI,WAAiC,UAAwB;AAAA,IAE7D;AAAA,IACA,UAAU,WAA0C;AAClD,aAAO;AAAA,IACT;AAAA,EACF;AACA,QAAM,iBAAiB,QAAQ,OAAO,gBAAgB,wBAAwB;AAC9E,QAAM,aAAa,eAAe,YAAY;AAE9C,SAAO,cAAc,KAAK,CAAC,oBAAoB;AAC7C,WAAO,WAAW,WAAW,eAAe;AAAA,EAC9C,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -5,7 +5,8 @@ import type { StoragePipelineOptions, Pipeline } from "./Pipeline.js";
5
5
  import type { CommonOptions } from "./StorageClient.js";
6
6
  import { StorageClient } from "./StorageClient.js";
7
7
  import type { WithResponse } from "./utils/utils.common.js";
8
- import { StorageSharedKeyCredential, UserDelegationKey } from "@azure/storage-common";
8
+ import type { UserDelegationKey } from "@azure/storage-common";
9
+ import { StorageSharedKeyCredential } from "@azure/storage-common";
9
10
  import { AnonymousCredential } from "@azure/storage-common";
10
11
  import type { Metadata } from "./models.js";
11
12
  import type { SasIPRange } from "./SasIPRange.js";