@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,271 +1,271 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import { convertHttpClient, createRequestPolicyFactoryPolicy, } from "@azure/core-http-compat";
4
- import { bearerTokenAuthenticationPolicy, decompressResponsePolicyName, } from "@azure/core-rest-pipeline";
1
+ import {
2
+ convertHttpClient,
3
+ createRequestPolicyFactoryPolicy
4
+ } from "@azure/core-http-compat";
5
+ import {
6
+ bearerTokenAuthenticationPolicy,
7
+ decompressResponsePolicyName
8
+ } from "@azure/core-rest-pipeline";
5
9
  import { authorizeRequestOnTenantChallenge, createClientPipeline } from "@azure/core-client";
6
10
  import { parseXML, stringifyXML } from "@azure/core-xml";
7
11
  import { isTokenCredential } from "@azure/core-auth";
8
12
  import { logger } from "./log.js";
9
- import { StorageRetryPolicyFactory, StorageSharedKeyCredential, AnonymousCredential, getCachedDefaultHttpClient, storageBrowserPolicy, storageRetryPolicy, storageSharedKeyCredentialPolicy, StorageBrowserPolicyFactory, storageCorrectContentLengthPolicy, storageRequestFailureDetailsParserPolicy, } from "@azure/storage-common";
10
- import { StorageOAuthScopes, StorageQueueLoggingAllowedHeaderNames, StorageQueueLoggingAllowedQueryParameters, SDK_VERSION, } from "./utils/constants.js";
11
- // Export following interfaces and types for customers who want to implement their
12
- // own RequestPolicy or HTTPClient
13
- export { StorageOAuthScopes, };
14
- /**
15
- * A helper to decide if a given argument satisfies the Pipeline contract
16
- * @param pipeline - An argument that may be a Pipeline
17
- * @returns true when the argument satisfies the Pipeline contract
18
- */
19
- export function isPipelineLike(pipeline) {
20
- if (!pipeline || typeof pipeline !== "object") {
21
- return false;
22
- }
23
- const castPipeline = pipeline;
24
- return (Array.isArray(castPipeline.factories) &&
25
- typeof castPipeline.options === "object" &&
26
- typeof castPipeline.toServiceClientOptions === "function");
13
+ import {
14
+ StorageRetryPolicyFactory,
15
+ StorageSharedKeyCredential,
16
+ AnonymousCredential,
17
+ getCachedDefaultHttpClient,
18
+ storageBrowserPolicy,
19
+ storageRetryPolicy,
20
+ storageSharedKeyCredentialPolicy,
21
+ StorageBrowserPolicyFactory,
22
+ storageCorrectContentLengthPolicy,
23
+ storageRequestFailureDetailsParserPolicy
24
+ } from "@azure/storage-common";
25
+ import {
26
+ StorageOAuthScopes,
27
+ StorageQueueLoggingAllowedHeaderNames,
28
+ StorageQueueLoggingAllowedQueryParameters,
29
+ SDK_VERSION
30
+ } from "./utils/constants.js";
31
+ function isPipelineLike(pipeline) {
32
+ if (!pipeline || typeof pipeline !== "object") {
33
+ return false;
34
+ }
35
+ const castPipeline = pipeline;
36
+ return Array.isArray(castPipeline.factories) && typeof castPipeline.options === "object" && typeof castPipeline.toServiceClientOptions === "function";
27
37
  }
28
- /**
29
- * A Pipeline class containing HTTP request policies.
30
- * You can create a default Pipeline by calling {@link newPipeline}.
31
- * Or you can create a Pipeline with your own policies by the constructor of Pipeline.
32
- *
33
- * Refer to {@link newPipeline} and provided policies before implementing your
34
- * customized Pipeline.
35
- */
36
- export class Pipeline {
37
- /**
38
- * A list of chained request policy factories.
39
- */
40
- factories;
41
- /**
42
- * Configures pipeline logger and HTTP client.
43
- */
44
- options;
45
- /**
46
- * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.
47
- *
48
- * @param factories -
49
- * @param options -
50
- */
51
- constructor(factories, options = {}) {
52
- this.factories = factories;
53
- this.options = options;
54
- }
55
- /**
56
- * Transfer Pipeline object to ServiceClientOptions object which is required by
57
- * ServiceClient constructor.
58
- *
59
- * @returns The ServiceClientOptions object from this Pipeline.
60
- */
61
- toServiceClientOptions() {
62
- return {
63
- httpClient: this.options.httpClient,
64
- requestPolicyFactories: this.factories,
65
- };
66
- }
38
+ class Pipeline {
39
+ /**
40
+ * A list of chained request policy factories.
41
+ */
42
+ factories;
43
+ /**
44
+ * Configures pipeline logger and HTTP client.
45
+ */
46
+ options;
47
+ /**
48
+ * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.
49
+ *
50
+ * @param factories -
51
+ * @param options -
52
+ */
53
+ constructor(factories, options = {}) {
54
+ this.factories = factories;
55
+ this.options = options;
56
+ }
57
+ /**
58
+ * Transfer Pipeline object to ServiceClientOptions object which is required by
59
+ * ServiceClient constructor.
60
+ *
61
+ * @returns The ServiceClientOptions object from this Pipeline.
62
+ */
63
+ toServiceClientOptions() {
64
+ return {
65
+ httpClient: this.options.httpClient,
66
+ requestPolicyFactories: this.factories
67
+ };
68
+ }
67
69
  }
68
- /**
69
- * Creates a new Pipeline object with Credential provided.
70
- *
71
- * @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.
72
- * @param pipelineOptions - Optional. Options.
73
- * @returns A new Pipeline object.
74
- */
75
- export function newPipeline(credential, pipelineOptions = {}) {
76
- if (!credential) {
77
- credential = new AnonymousCredential();
78
- }
79
- const pipeline = new Pipeline([], pipelineOptions);
80
- pipeline._credential = credential;
81
- return pipeline;
70
+ function newPipeline(credential, pipelineOptions = {}) {
71
+ if (!credential) {
72
+ credential = new AnonymousCredential();
73
+ }
74
+ const pipeline = new Pipeline([], pipelineOptions);
75
+ pipeline._credential = credential;
76
+ return pipeline;
82
77
  }
83
78
  function processDownlevelPipeline(pipeline) {
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
- // if there are any left over, wrap in a requestPolicyFactoryPolicy
100
- return {
101
- wrappedPolicies: createRequestPolicyFactoryPolicy(novelFactories),
102
- afterRetry: hasInjector,
103
- };
104
- }
79
+ const knownFactoryFunctions = [
80
+ isAnonymousCredential,
81
+ isStorageSharedKeyCredential,
82
+ isCoreHttpBearerTokenFactory,
83
+ isStorageBrowserPolicyFactory,
84
+ isStorageRetryPolicyFactory,
85
+ isStorageTelemetryPolicyFactory,
86
+ isCoreHttpPolicyFactory
87
+ ];
88
+ if (pipeline.factories.length) {
89
+ const novelFactories = pipeline.factories.filter((factory) => {
90
+ return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));
91
+ });
92
+ if (novelFactories.length) {
93
+ const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));
94
+ return {
95
+ wrappedPolicies: createRequestPolicyFactoryPolicy(novelFactories),
96
+ afterRetry: hasInjector
97
+ };
105
98
  }
106
- return undefined;
99
+ }
100
+ return void 0;
107
101
  }
108
- export function getCoreClientOptions(pipeline) {
109
- const { httpClient: v1Client, ...restOptions } = pipeline.options;
110
- let httpClient = pipeline._coreHttpClient;
111
- if (!httpClient) {
112
- httpClient = v1Client ? convertHttpClient(v1Client) : getCachedDefaultHttpClient();
113
- pipeline._coreHttpClient = httpClient;
114
- }
115
- let corePipeline = pipeline._corePipeline;
116
- if (!corePipeline) {
117
- const packageDetails = `azsdk-js-azure-storage-blob/${SDK_VERSION}`;
118
- const userAgentPrefix = restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix
119
- ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`
120
- : `${packageDetails}`;
121
- corePipeline = createClientPipeline({
122
- ...restOptions,
123
- loggingOptions: {
124
- additionalAllowedHeaderNames: StorageQueueLoggingAllowedHeaderNames,
125
- additionalAllowedQueryParameters: StorageQueueLoggingAllowedQueryParameters,
126
- logger: logger.info,
127
- },
128
- userAgentOptions: {
129
- userAgentPrefix,
130
- },
131
- serializationOptions: {
132
- stringifyXML,
133
- serializerOptions: {
134
- xml: {
135
- // Use customized XML char key of "#" so we can deserialize metadata
136
- // with "_" key
137
- xmlCharKey: "#",
138
- },
139
- },
140
- },
141
- deserializationOptions: {
142
- parseXML,
143
- serializerOptions: {
144
- xml: {
145
- // Use customized XML char key of "#" so we can deserialize metadata
146
- // with "_" key
147
- xmlCharKey: "#",
148
- },
149
- },
150
- },
151
- });
152
- corePipeline.removePolicy({ phase: "Retry" });
153
- corePipeline.removePolicy({ name: decompressResponsePolicyName });
154
- corePipeline.addPolicy(storageCorrectContentLengthPolicy());
155
- corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: "Retry" });
156
- corePipeline.addPolicy(storageRequestFailureDetailsParserPolicy());
157
- corePipeline.addPolicy(storageBrowserPolicy());
158
- const downlevelResults = processDownlevelPipeline(pipeline);
159
- if (downlevelResults) {
160
- corePipeline.addPolicy(downlevelResults.wrappedPolicies, downlevelResults.afterRetry ? { afterPhase: "Retry" } : undefined);
161
- }
162
- const credential = getCredentialFromPipeline(pipeline);
163
- if (isTokenCredential(credential)) {
164
- corePipeline.addPolicy(bearerTokenAuthenticationPolicy({
165
- credential,
166
- scopes: restOptions.audience ?? StorageOAuthScopes,
167
- challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge },
168
- }), { phase: "Sign" });
102
+ function getCoreClientOptions(pipeline) {
103
+ const { httpClient: v1Client, ...restOptions } = pipeline.options;
104
+ let httpClient = pipeline._coreHttpClient;
105
+ if (!httpClient) {
106
+ httpClient = v1Client ? convertHttpClient(v1Client) : getCachedDefaultHttpClient();
107
+ pipeline._coreHttpClient = httpClient;
108
+ }
109
+ let corePipeline = pipeline._corePipeline;
110
+ if (!corePipeline) {
111
+ const packageDetails = `azsdk-js-azure-storage-blob/${SDK_VERSION}`;
112
+ const userAgentPrefix = restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`;
113
+ corePipeline = createClientPipeline({
114
+ ...restOptions,
115
+ loggingOptions: {
116
+ additionalAllowedHeaderNames: StorageQueueLoggingAllowedHeaderNames,
117
+ additionalAllowedQueryParameters: StorageQueueLoggingAllowedQueryParameters,
118
+ logger: logger.info
119
+ },
120
+ userAgentOptions: {
121
+ userAgentPrefix
122
+ },
123
+ serializationOptions: {
124
+ stringifyXML,
125
+ serializerOptions: {
126
+ xml: {
127
+ // Use customized XML char key of "#" so we can deserialize metadata
128
+ // with "_" key
129
+ xmlCharKey: "#"
130
+ }
169
131
  }
170
- else if (credential instanceof StorageSharedKeyCredential) {
171
- corePipeline.addPolicy(storageSharedKeyCredentialPolicy({
172
- accountName: credential.accountName,
173
- accountKey: credential.accountKey,
174
- }), { phase: "Sign" });
132
+ },
133
+ deserializationOptions: {
134
+ parseXML,
135
+ serializerOptions: {
136
+ xml: {
137
+ // Use customized XML char key of "#" so we can deserialize metadata
138
+ // with "_" key
139
+ xmlCharKey: "#"
140
+ }
175
141
  }
176
- pipeline._corePipeline = corePipeline;
142
+ }
143
+ });
144
+ corePipeline.removePolicy({ phase: "Retry" });
145
+ corePipeline.removePolicy({ name: decompressResponsePolicyName });
146
+ corePipeline.addPolicy(storageCorrectContentLengthPolicy());
147
+ corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: "Retry" });
148
+ corePipeline.addPolicy(storageRequestFailureDetailsParserPolicy());
149
+ corePipeline.addPolicy(storageBrowserPolicy());
150
+ const downlevelResults = processDownlevelPipeline(pipeline);
151
+ if (downlevelResults) {
152
+ corePipeline.addPolicy(
153
+ downlevelResults.wrappedPolicies,
154
+ downlevelResults.afterRetry ? { afterPhase: "Retry" } : void 0
155
+ );
177
156
  }
178
- return {
179
- ...restOptions,
180
- allowInsecureConnection: true,
181
- httpClient,
182
- pipeline: corePipeline,
183
- };
184
- }
185
- export function getCredentialFromPipeline(pipeline) {
186
- // see if we squirreled one away on the type itself
187
- if (pipeline._credential) {
188
- return pipeline._credential;
157
+ const credential = getCredentialFromPipeline(pipeline);
158
+ if (isTokenCredential(credential)) {
159
+ corePipeline.addPolicy(
160
+ bearerTokenAuthenticationPolicy({
161
+ credential,
162
+ scopes: restOptions.audience ?? StorageOAuthScopes,
163
+ challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge }
164
+ }),
165
+ { phase: "Sign" }
166
+ );
167
+ } else if (credential instanceof StorageSharedKeyCredential) {
168
+ corePipeline.addPolicy(
169
+ storageSharedKeyCredentialPolicy({
170
+ accountName: credential.accountName,
171
+ accountKey: credential.accountKey
172
+ }),
173
+ { phase: "Sign" }
174
+ );
189
175
  }
190
- // if it came from another package, loop over the factories and look for one like before
191
- let credential = new AnonymousCredential();
192
- for (const factory of pipeline.factories) {
193
- if (isTokenCredential(factory.credential)) {
194
- // Only works if the factory has been attached a "credential" property.
195
- // We do that in newPipeline() when using TokenCredential.
196
- credential = factory.credential;
197
- }
198
- else if (isStorageSharedKeyCredential(factory)) {
199
- return factory;
200
- }
176
+ pipeline._corePipeline = corePipeline;
177
+ }
178
+ return {
179
+ ...restOptions,
180
+ allowInsecureConnection: true,
181
+ httpClient,
182
+ pipeline: corePipeline
183
+ };
184
+ }
185
+ function getCredentialFromPipeline(pipeline) {
186
+ if (pipeline._credential) {
187
+ return pipeline._credential;
188
+ }
189
+ let credential = new AnonymousCredential();
190
+ for (const factory of pipeline.factories) {
191
+ if (isTokenCredential(factory.credential)) {
192
+ credential = factory.credential;
193
+ } else if (isStorageSharedKeyCredential(factory)) {
194
+ return factory;
201
195
  }
202
- return credential;
196
+ }
197
+ return credential;
203
198
  }
204
199
  function isStorageSharedKeyCredential(factory) {
205
- if (factory instanceof StorageSharedKeyCredential) {
206
- return true;
207
- }
208
- return factory.constructor.name === "StorageSharedKeyCredential";
200
+ if (factory instanceof StorageSharedKeyCredential) {
201
+ return true;
202
+ }
203
+ return factory.constructor.name === "StorageSharedKeyCredential";
209
204
  }
210
205
  function isAnonymousCredential(factory) {
211
- if (factory instanceof AnonymousCredential) {
212
- return true;
213
- }
214
- return factory.constructor.name === "AnonymousCredential";
206
+ if (factory instanceof AnonymousCredential) {
207
+ return true;
208
+ }
209
+ return factory.constructor.name === "AnonymousCredential";
215
210
  }
216
211
  function isCoreHttpBearerTokenFactory(factory) {
217
- return isTokenCredential(factory.credential);
212
+ return isTokenCredential(factory.credential);
218
213
  }
219
214
  function isStorageBrowserPolicyFactory(factory) {
220
- if (factory instanceof StorageBrowserPolicyFactory) {
221
- return true;
222
- }
223
- return factory.constructor.name === "StorageBrowserPolicyFactory";
215
+ if (factory instanceof StorageBrowserPolicyFactory) {
216
+ return true;
217
+ }
218
+ return factory.constructor.name === "StorageBrowserPolicyFactory";
224
219
  }
225
220
  function isStorageRetryPolicyFactory(factory) {
226
- if (factory instanceof StorageRetryPolicyFactory) {
227
- return true;
228
- }
229
- return factory.constructor.name === "StorageRetryPolicyFactory";
221
+ if (factory instanceof StorageRetryPolicyFactory) {
222
+ return true;
223
+ }
224
+ return factory.constructor.name === "StorageRetryPolicyFactory";
230
225
  }
231
226
  function isStorageTelemetryPolicyFactory(factory) {
232
- return factory.constructor.name === "TelemetryPolicyFactory";
227
+ return factory.constructor.name === "TelemetryPolicyFactory";
233
228
  }
234
229
  function isInjectorPolicyFactory(factory) {
235
- return factory.constructor.name === "InjectorPolicyFactory";
230
+ return factory.constructor.name === "InjectorPolicyFactory";
236
231
  }
237
232
  function isCoreHttpPolicyFactory(factory) {
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
- /* do nothing */
259
- },
260
- shouldLog(_logLevel) {
261
- return false;
262
- },
263
- };
264
- const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);
265
- const policyName = policyInstance.constructor.name;
266
- // bundlers sometimes add a custom suffix to the class name to make it unique
267
- return knownPolicies.some((knownPolicyName) => {
268
- return policyName.startsWith(knownPolicyName);
269
- });
233
+ const knownPolicies = [
234
+ "GenerateClientRequestIdPolicy",
235
+ "TracingPolicy",
236
+ "LogPolicy",
237
+ "ProxyPolicy",
238
+ "DisableResponseDecompressionPolicy",
239
+ "KeepAlivePolicy",
240
+ "DeserializationPolicy"
241
+ ];
242
+ const mockHttpClient = {
243
+ sendRequest: async (request) => {
244
+ return {
245
+ request,
246
+ headers: request.headers.clone(),
247
+ status: 500
248
+ };
249
+ }
250
+ };
251
+ const mockRequestPolicyOptions = {
252
+ log(_logLevel, _message) {
253
+ },
254
+ shouldLog(_logLevel) {
255
+ return false;
256
+ }
257
+ };
258
+ const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);
259
+ const policyName = policyInstance.constructor.name;
260
+ return knownPolicies.some((knownPolicyName) => {
261
+ return policyName.startsWith(knownPolicyName);
262
+ });
270
263
  }
271
- //# sourceMappingURL=Pipeline.js.map
264
+ export {
265
+ Pipeline,
266
+ StorageOAuthScopes,
267
+ getCoreClientOptions,
268
+ getCredentialFromPipeline,
269
+ isPipelineLike,
270
+ newPipeline
271
+ };
@@ -1 +1,7 @@
1
- {"version":3,"file":"Pipeline.js","sourceRoot":"","sources":["../../src/Pipeline.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAQL,iBAAiB,EACjB,gCAAgC,GACjC,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EAEL,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,iCAAiC,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,mBAAmB,EACnB,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EAClB,gCAAgC,EAChC,2BAA2B,EAC3B,iCAAiC,EACjC,wCAAwC,GACzC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,kBAAkB,EAClB,qCAAqC,EACrC,yCAAyC,EACzC,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,kFAAkF;AAClF,kCAAkC;AAClC,OAAO,EACL,kBAAkB,GASnB,CAAC;AAsDF;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,QAAiB;IAC9C,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,YAAY,GAAG,QAAwB,CAAC;IAE9C,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,YAAY,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ClC,WAAW,EAAE,KAAK,EAAE,OAAoB,EAAE,EAAE;YAC1C,OAAO;gBACL,OAAO;gBACP,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE;gBAChC,MAAM,EAAE,GAAG;aACZ,CAAC;QACJ,CAAC;KACF,CAAC;IACF,MAAM,wBAAwB,GAAyB;QACrD,GAAG,CAAC,SAA+B,EAAE,QAAgB;YACnD,gBAAgB;QAClB,CAAC;QACD,SAAS,CAAC,SAA+B;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;IACF,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC;IAChF,MAAM,UAAU,GAAG,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC;IACnD,6EAA6E;IAC7E,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,EAAE;QAC5C,OAAO,UAAU,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC","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} 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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B,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";