@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,483 +1,533 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
1
  import { isTokenCredential } from "@azure/core-auth";
4
2
  import { isNodeLike } from "@azure/core-util";
5
3
  import { newPipeline, isPipelineLike } from "./Pipeline.js";
6
4
  import { StorageClient } from "./StorageClient.js";
7
- import { appendToURLPath, appendToURLQuery, extractConnectionStringParts, assertResponse, truncatedISO8061Date, } from "./utils/utils.common.js";
5
+ import {
6
+ appendToURLPath,
7
+ appendToURLQuery,
8
+ extractConnectionStringParts,
9
+ assertResponse,
10
+ truncatedISO8061Date
11
+ } from "./utils/utils.common.js";
8
12
  import { StorageSharedKeyCredential } from "@azure/storage-common";
9
13
  import { AnonymousCredential } from "@azure/storage-common";
10
14
  import { tracingClient } from "./utils/tracing.js";
11
15
  import { QueueClient } from "./QueueClient.js";
12
16
  import { AccountSASPermissions } from "./AccountSASPermissions.js";
13
- import { generateAccountSASQueryParameters, generateAccountSASQueryParametersInternal, } from "./AccountSASSignatureValues.js";
17
+ import {
18
+ generateAccountSASQueryParameters,
19
+ generateAccountSASQueryParametersInternal
20
+ } from "./AccountSASSignatureValues.js";
14
21
  import { AccountSASServices } from "./AccountSASServices.js";
15
22
  import { getDefaultProxySettings } from "@azure/core-rest-pipeline";
16
- /**
17
- * A QueueServiceClient represents a URL to the Azure Storage Queue service allowing you
18
- * to manipulate queues.
19
- */
20
- export class QueueServiceClient extends StorageClient {
21
- /**
22
- * Creates an instance of QueueServiceClient.
23
- *
24
- * @param connectionString - Account connection string or a SAS connection string of an Azure storage account.
25
- * [ Note - Account connection string can only be used in NODE.JS runtime. ]
26
- * Account connection string example -
27
- * `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
28
- * SAS connection string example -
29
- * `BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`
30
- * @param options - Options to configure the HTTP pipeline.
31
- * @returns A new QueueServiceClient object from the given connection string.
32
- */
33
- static fromConnectionString(connectionString,
34
- // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
35
- /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
36
- options) {
37
- options = options || {};
38
- const extractedCreds = extractConnectionStringParts(connectionString);
39
- if (extractedCreds.kind === "AccountConnString") {
40
- if (isNodeLike) {
41
- const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
42
- if (!options.proxyOptions) {
43
- options.proxyOptions = getDefaultProxySettings(extractedCreds.proxyUri);
44
- }
45
- const pipeline = newPipeline(sharedKeyCredential, options);
46
- return new QueueServiceClient(extractedCreds.url, pipeline);
47
- }
48
- else {
49
- throw new Error("Account connection string is only supported in Node.js environment");
50
- }
51
- }
52
- else if (extractedCreds.kind === "SASConnString") {
53
- const pipeline = newPipeline(new AnonymousCredential(), options);
54
- return new QueueServiceClient(extractedCreds.url + "?" + extractedCreds.accountSas, pipeline);
55
- }
56
- else {
57
- throw new Error("Connection string must be either an Account connection string or a SAS connection string");
58
- }
59
- }
60
- /**
61
- * serviceContext provided by protocol layer.
62
- */
63
- serviceContext;
64
- constructor(url, credentialOrPipeline,
65
- // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
66
- /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
67
- options) {
68
- let pipeline;
69
- if (isPipelineLike(credentialOrPipeline)) {
70
- pipeline = credentialOrPipeline;
71
- }
72
- else if ((isNodeLike && credentialOrPipeline instanceof StorageSharedKeyCredential) ||
73
- credentialOrPipeline instanceof AnonymousCredential ||
74
- isTokenCredential(credentialOrPipeline)) {
75
- pipeline = newPipeline(credentialOrPipeline, options);
76
- }
77
- else {
78
- // The second parameter is undefined. Use anonymous credential.
79
- pipeline = newPipeline(new AnonymousCredential(), options);
80
- }
81
- super(url, pipeline);
82
- this.serviceContext = this.storageClientContext.service;
83
- }
84
- /**
85
- * Creates a {@link QueueClient} object.
86
- *
87
- * @param queueName -
88
- * @returns a new QueueClient
89
- *
90
- * Example usage:
91
- *
92
- * ```ts snippet:ReadmeSampleCreateQueue
93
- * import { QueueServiceClient } from "@azure/storage-queue";
94
- * import { DefaultAzureCredential } from "@azure/identity";
95
- *
96
- * const account = "<account>";
97
- * const queueServiceClient = new QueueServiceClient(
98
- * `https://${account}.queue.core.windows.net`,
99
- * new DefaultAzureCredential(),
100
- * );
101
- *
102
- * const queueName = "<valid queue name>";
103
- * const queueClient = queueServiceClient.getQueueClient(queueName);
104
- * const createQueueResponse = await queueClient.create();
105
- * console.log(
106
- * `Created queue ${queueName} successfully, service assigned request Id: ${createQueueResponse.requestId}`,
107
- * );
108
- * ```
109
- */
110
- getQueueClient(queueName) {
111
- return new QueueClient(appendToURLPath(this.url, queueName), this.pipeline);
112
- }
113
- /**
114
- * Returns a list of the queues under the specified account.
115
- * @see https://learn.microsoft.com/rest/api/storageservices/list-queues1
116
- *
117
- * @param marker - A string value that identifies the portion of
118
- * the list of queues to be returned with the next listing operation. The
119
- * operation returns the continuationToken value within the response body if the
120
- * listing operation did not return all queues remaining to be listed
121
- * with the current page. The continuationToken value can be used as the value for
122
- * the marker parameter in a subsequent call to request the next page of list
123
- * items. The marker value is opaque to the client.
124
- * @param options - Options to list queues operation.
125
- * @returns Response data for the list queues segment operation.
126
- */
127
- async listQueuesSegment(marker, options = {}) {
128
- if (options.prefix === "") {
129
- options.prefix = undefined;
23
+ function isQueueGetUserDelegationKeyParameters(parameter) {
24
+ if (!parameter || typeof parameter !== "object") {
25
+ return false;
26
+ }
27
+ const castParameter = parameter;
28
+ return castParameter.expiresOn instanceof Date;
29
+ }
30
+ class QueueServiceClient extends StorageClient {
31
+ /**
32
+ * Creates an instance of QueueServiceClient.
33
+ *
34
+ * @param connectionString - Account connection string or a SAS connection string of an Azure storage account.
35
+ * [ Note - Account connection string can only be used in NODE.JS runtime. ]
36
+ * Account connection string example -
37
+ * `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
38
+ * SAS connection string example -
39
+ * `BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString`
40
+ * @param options - Options to configure the HTTP pipeline.
41
+ * @returns A new QueueServiceClient object from the given connection string.
42
+ */
43
+ static fromConnectionString(connectionString, options) {
44
+ options = options || {};
45
+ const extractedCreds = extractConnectionStringParts(connectionString);
46
+ if (extractedCreds.kind === "AccountConnString") {
47
+ if (isNodeLike) {
48
+ const sharedKeyCredential = new StorageSharedKeyCredential(
49
+ extractedCreds.accountName,
50
+ extractedCreds.accountKey
51
+ );
52
+ if (!options.proxyOptions) {
53
+ options.proxyOptions = getDefaultProxySettings(extractedCreds.proxyUri);
130
54
  }
131
- return tracingClient.withSpan("QueueServiceClient-listQueuesSegment", options, async (updatedOptions) => {
132
- return assertResponse(await this.serviceContext.listQueuesSegment({
133
- ...updatedOptions,
134
- marker,
135
- include: options.include === undefined ? undefined : [options.include],
136
- }));
137
- });
55
+ const pipeline = newPipeline(sharedKeyCredential, options);
56
+ return new QueueServiceClient(extractedCreds.url, pipeline);
57
+ } else {
58
+ throw new Error("Account connection string is only supported in Node.js environment");
59
+ }
60
+ } else if (extractedCreds.kind === "SASConnString") {
61
+ const pipeline = newPipeline(new AnonymousCredential(), options);
62
+ return new QueueServiceClient(extractedCreds.url + "?" + extractedCreds.accountSas, pipeline);
63
+ } else {
64
+ throw new Error(
65
+ "Connection string must be either an Account connection string or a SAS connection string"
66
+ );
138
67
  }
139
- /**
140
- * Returns an AsyncIterableIterator for {@link ServiceListQueuesSegmentResponse} objects
141
- *
142
- * @param marker - A string value that identifies the portion of
143
- * the list of queues to be returned with the next listing operation. The
144
- * operation returns the continuationToken value within the response body if the
145
- * listing operation did not return all queues remaining to be listed
146
- * with the current page. The continuationToken value can be used as the value for
147
- * the marker parameter in a subsequent call to request the next page of list
148
- * items. The marker value is opaque to the client.
149
- * @param options - Options to list queues operation.
150
- */
151
- async *listSegments(marker, options = {}) {
152
- if (options.prefix === "") {
153
- options.prefix = undefined;
154
- }
155
- let listQueuesResponse;
156
- do {
157
- listQueuesResponse = await this.listQueuesSegment(marker, options);
158
- marker = listQueuesResponse.continuationToken;
159
- yield await listQueuesResponse;
160
- } while (marker);
68
+ }
69
+ /**
70
+ * serviceContext provided by protocol layer.
71
+ */
72
+ serviceContext;
73
+ constructor(url, credentialOrPipeline, options) {
74
+ let pipeline;
75
+ if (isPipelineLike(credentialOrPipeline)) {
76
+ pipeline = credentialOrPipeline;
77
+ } else if (isNodeLike && credentialOrPipeline instanceof StorageSharedKeyCredential || credentialOrPipeline instanceof AnonymousCredential || isTokenCredential(credentialOrPipeline)) {
78
+ pipeline = newPipeline(credentialOrPipeline, options);
79
+ } else {
80
+ pipeline = newPipeline(new AnonymousCredential(), options);
161
81
  }
162
- /**
163
- * Returns an AsyncIterableIterator for {@link QueueItem} objects
164
- *
165
- * @param options - Options to list queues operation.
166
- */
167
- async *listItems(options = {}) {
168
- if (options.prefix === "") {
169
- options.prefix = undefined;
170
- }
171
- let marker;
172
- for await (const segment of this.listSegments(marker, options)) {
173
- if (segment.queueItems) {
174
- yield* segment.queueItems;
175
- }
176
- }
82
+ super(url, pipeline);
83
+ this.serviceContext = this.storageClientContext.service;
84
+ }
85
+ /**
86
+ * Creates a {@link QueueClient} object.
87
+ *
88
+ * @param queueName -
89
+ * @returns a new QueueClient
90
+ *
91
+ * Example usage:
92
+ *
93
+ * ```ts snippet:ReadmeSampleCreateQueue
94
+ * import { QueueServiceClient } from "@azure/storage-queue";
95
+ * import { DefaultAzureCredential } from "@azure/identity";
96
+ *
97
+ * const account = "<account>";
98
+ * const queueServiceClient = new QueueServiceClient(
99
+ * `https://${account}.queue.core.windows.net`,
100
+ * new DefaultAzureCredential(),
101
+ * );
102
+ *
103
+ * const queueName = "<valid queue name>";
104
+ * const queueClient = queueServiceClient.getQueueClient(queueName);
105
+ * const createQueueResponse = await queueClient.create();
106
+ * console.log(
107
+ * `Created queue ${queueName} successfully, service assigned request Id: ${createQueueResponse.requestId}`,
108
+ * );
109
+ * ```
110
+ */
111
+ getQueueClient(queueName) {
112
+ return new QueueClient(appendToURLPath(this.url, queueName), this.pipeline);
113
+ }
114
+ /**
115
+ * Returns a list of the queues under the specified account.
116
+ * @see https://learn.microsoft.com/rest/api/storageservices/list-queues1
117
+ *
118
+ * @param marker - A string value that identifies the portion of
119
+ * the list of queues to be returned with the next listing operation. The
120
+ * operation returns the continuationToken value within the response body if the
121
+ * listing operation did not return all queues remaining to be listed
122
+ * with the current page. The continuationToken value can be used as the value for
123
+ * the marker parameter in a subsequent call to request the next page of list
124
+ * items. The marker value is opaque to the client.
125
+ * @param options - Options to list queues operation.
126
+ * @returns Response data for the list queues segment operation.
127
+ */
128
+ async listQueuesSegment(marker, options = {}) {
129
+ if (options.prefix === "") {
130
+ options.prefix = void 0;
177
131
  }
178
- /**
179
- * Returns an async iterable iterator to list all the queues
180
- * under the specified account.
181
- *
182
- * .byPage() returns an async iterable iterator to list the queues in pages.
183
- *
184
- * Example using `for await` syntax:
185
- *
186
- * ```ts snippet:ReadmeSampleListQueues
187
- * import { QueueServiceClient } from "@azure/storage-queue";
188
- * import { DefaultAzureCredential } from "@azure/identity";
189
- *
190
- * const account = "<account>";
191
- * const queueServiceClient = new QueueServiceClient(
192
- * `https://${account}.queue.core.windows.net`,
193
- * new DefaultAzureCredential(),
194
- * );
195
- *
196
- * let i = 1;
197
- * for await (const item of queueServiceClient.listQueues()) {
198
- * console.log(`Queue${i++}: ${item.name}`);
199
- * }
200
- * ```
201
- *
202
- * Example using `iter.next()`:
203
- *
204
- * ```ts snippet:ReadmeSampleListQueues_Iterator
205
- * import { QueueServiceClient } from "@azure/storage-queue";
206
- * import { DefaultAzureCredential } from "@azure/identity";
207
- *
208
- * const account = "<account>";
209
- * const queueServiceClient = new QueueServiceClient(
210
- * `https://${account}.queue.core.windows.net`,
211
- * new DefaultAzureCredential(),
212
- * );
213
- *
214
- * let i = 1;
215
- * const iterator = queueServiceClient.listQueues();
216
- * let { done, value } = await iterator.next();
217
- * while (!done) {
218
- * console.log(`Queue${i++}: ${value.name}`);
219
- * ({ done, value } = await iterator.next());
220
- * }
221
- * ```
222
- *
223
- * Example using `byPage()`:
224
- *
225
- * ```ts snippet:ReadmeSampleListQueues_ByPage
226
- * import { QueueServiceClient } from "@azure/storage-queue";
227
- * import { DefaultAzureCredential } from "@azure/identity";
228
- *
229
- * const account = "<account>";
230
- * const queueServiceClient = new QueueServiceClient(
231
- * `https://${account}.queue.core.windows.net`,
232
- * new DefaultAzureCredential(),
233
- * );
234
- *
235
- * let i = 1;
236
- * for await (const page of queueServiceClient.listQueues().byPage({ maxPageSize: 20 })) {
237
- * for (const item of page.queueItems || []) {
238
- * console.log(`Queue${i++}: ${item.name}`);
239
- * }
240
- * }
241
- * ```
242
- *
243
- * Example using paging with a marker:
244
- *
245
- * ```ts snippet:ReadmeSampleListQueues_Continuation
246
- * import { QueueServiceClient } from "@azure/storage-queue";
247
- * import { DefaultAzureCredential } from "@azure/identity";
248
- *
249
- * const account = "<account>";
250
- * const queueServiceClient = new QueueServiceClient(
251
- * `https://${account}.queue.core.windows.net`,
252
- * new DefaultAzureCredential(),
253
- * );
254
- *
255
- * let i = 1;
256
- * let iterator = queueServiceClient.listQueues().byPage({ maxPageSize: 2 });
257
- * let response = (await iterator.next()).value;
258
- * // Prints 2 queues
259
- * if (response.queueItems) {
260
- * for (const item of response.queueItems) {
261
- * console.log(`Queue${i++}: ${item.name}`);
262
- * }
263
- * }
264
- * // Gets next marker
265
- * let marker = response.continuationToken;
266
- * // Passing next marker as continuationToken
267
- * iterator = queueServiceClient.listQueues().byPage({ continuationToken: marker, maxPageSize: 10 });
268
- * response = (await iterator.next()).value;
269
- * // Prints 10 queues
270
- * if (response.queueItems) {
271
- * for (const item of response.queueItems) {
272
- * console.log(`Queue${i++}: ${item.name}`);
273
- * }
274
- * }
275
- * ```
276
- *
277
- * @param options - Options to list queues operation.
278
- * @returns An asyncIterableIterator that supports paging.
279
- */
280
- listQueues(options = {}) {
281
- if (options.prefix === "") {
282
- options.prefix = undefined;
283
- }
284
- const updatedOptions = {
285
- ...options,
286
- ...(options.includeMetadata ? { include: "metadata" } : {}),
287
- };
288
- // AsyncIterableIterator to iterate over queues
289
- const iter = this.listItems(updatedOptions);
290
- return {
291
- /**
292
- * The next method, part of the iteration protocol
293
- */
294
- next() {
295
- return iter.next();
296
- },
297
- /**
298
- * The connection to the async iterator, part of the iteration protocol
299
- */
300
- [Symbol.asyncIterator]() {
301
- return this;
302
- },
303
- /**
304
- * Return an AsyncIterableIterator that works a page at a time
305
- */
306
- byPage: (settings = {}) => {
307
- return this.listSegments(settings.continuationToken, {
308
- maxPageSize: settings.maxPageSize,
309
- ...updatedOptions,
310
- });
311
- },
312
- };
132
+ return tracingClient.withSpan(
133
+ "QueueServiceClient-listQueuesSegment",
134
+ options,
135
+ async (updatedOptions) => {
136
+ return assertResponse(
137
+ await this.serviceContext.listQueuesSegment({
138
+ ...updatedOptions,
139
+ marker,
140
+ include: options.include === void 0 ? void 0 : [options.include]
141
+ })
142
+ );
143
+ }
144
+ );
145
+ }
146
+ /**
147
+ * Returns an AsyncIterableIterator for {@link ServiceListQueuesSegmentResponse} objects
148
+ *
149
+ * @param marker - A string value that identifies the portion of
150
+ * the list of queues to be returned with the next listing operation. The
151
+ * operation returns the continuationToken value within the response body if the
152
+ * listing operation did not return all queues remaining to be listed
153
+ * with the current page. The continuationToken value can be used as the value for
154
+ * the marker parameter in a subsequent call to request the next page of list
155
+ * items. The marker value is opaque to the client.
156
+ * @param options - Options to list queues operation.
157
+ */
158
+ async *listSegments(marker, options = {}) {
159
+ if (options.prefix === "") {
160
+ options.prefix = void 0;
313
161
  }
314
- /**
315
- * Gets the properties of a storage account’s Queue service, including properties
316
- * for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
317
- * @see https://learn.microsoft.com/rest/api/storageservices/get-queue-service-properties
318
- *
319
- * @param options - Options to get properties operation.
320
- * @returns Response data including the queue service properties.
321
- */
322
- async getProperties(options = {}) {
323
- return tracingClient.withSpan("QueueServiceClient-getProperties", options, async (updatedOptions) => {
324
- return assertResponse(await this.serviceContext.getProperties(updatedOptions));
325
- });
162
+ let listQueuesResponse;
163
+ do {
164
+ listQueuesResponse = await this.listQueuesSegment(marker, options);
165
+ marker = listQueuesResponse.continuationToken;
166
+ yield await listQueuesResponse;
167
+ } while (marker);
168
+ }
169
+ /**
170
+ * Returns an AsyncIterableIterator for {@link QueueItem} objects
171
+ *
172
+ * @param options - Options to list queues operation.
173
+ */
174
+ async *listItems(options = {}) {
175
+ if (options.prefix === "") {
176
+ options.prefix = void 0;
326
177
  }
327
- /**
328
- * Sets properties for a storage account’s Queue service endpoint, including properties
329
- * for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and soft delete settings.
330
- * @see https://learn.microsoft.com/rest/api/storageservices/set-queue-service-properties
331
- *
332
- * @param properties -
333
- * @param options - Options to set properties operation.
334
- * @returns Response data for the Set Properties operation.
335
- */
336
- async setProperties(properties, options = {}) {
337
- return tracingClient.withSpan("QueueServiceClient-setProperties", options, async (updatedOptions) => {
338
- return assertResponse(await this.serviceContext.setProperties(properties, updatedOptions));
339
- });
178
+ let marker;
179
+ for await (const segment of this.listSegments(marker, options)) {
180
+ if (segment.queueItems) {
181
+ yield* segment.queueItems;
182
+ }
340
183
  }
341
- /**
342
- * Retrieves statistics related to replication for the Queue service. It is only
343
- * available on the secondary location endpoint when read-access geo-redundant
344
- * replication is enabled for the storage account.
345
- * @see https://learn.microsoft.com/rest/api/storageservices/get-queue-service-stats
346
- *
347
- * @param options - Options to get statistics operation.
348
- * @returns Response data for get statistics the operation.
349
- */
350
- async getStatistics(options = {}) {
351
- return tracingClient.withSpan("QueueServiceClient-getStatistics", options, async (updatedOptions) => {
352
- return assertResponse(await this.serviceContext.getStatistics(updatedOptions));
353
- });
184
+ }
185
+ /**
186
+ * Returns an async iterable iterator to list all the queues
187
+ * under the specified account.
188
+ *
189
+ * .byPage() returns an async iterable iterator to list the queues in pages.
190
+ *
191
+ * Example using `for await` syntax:
192
+ *
193
+ * ```ts snippet:ReadmeSampleListQueues
194
+ * import { QueueServiceClient } from "@azure/storage-queue";
195
+ * import { DefaultAzureCredential } from "@azure/identity";
196
+ *
197
+ * const account = "<account>";
198
+ * const queueServiceClient = new QueueServiceClient(
199
+ * `https://${account}.queue.core.windows.net`,
200
+ * new DefaultAzureCredential(),
201
+ * );
202
+ *
203
+ * let i = 1;
204
+ * for await (const item of queueServiceClient.listQueues()) {
205
+ * console.log(`Queue${i++}: ${item.name}`);
206
+ * }
207
+ * ```
208
+ *
209
+ * Example using `iter.next()`:
210
+ *
211
+ * ```ts snippet:ReadmeSampleListQueues_Iterator
212
+ * import { QueueServiceClient } from "@azure/storage-queue";
213
+ * import { DefaultAzureCredential } from "@azure/identity";
214
+ *
215
+ * const account = "<account>";
216
+ * const queueServiceClient = new QueueServiceClient(
217
+ * `https://${account}.queue.core.windows.net`,
218
+ * new DefaultAzureCredential(),
219
+ * );
220
+ *
221
+ * let i = 1;
222
+ * const iterator = queueServiceClient.listQueues();
223
+ * let { done, value } = await iterator.next();
224
+ * while (!done) {
225
+ * console.log(`Queue${i++}: ${value.name}`);
226
+ * ({ done, value } = await iterator.next());
227
+ * }
228
+ * ```
229
+ *
230
+ * Example using `byPage()`:
231
+ *
232
+ * ```ts snippet:ReadmeSampleListQueues_ByPage
233
+ * import { QueueServiceClient } from "@azure/storage-queue";
234
+ * import { DefaultAzureCredential } from "@azure/identity";
235
+ *
236
+ * const account = "<account>";
237
+ * const queueServiceClient = new QueueServiceClient(
238
+ * `https://${account}.queue.core.windows.net`,
239
+ * new DefaultAzureCredential(),
240
+ * );
241
+ *
242
+ * let i = 1;
243
+ * for await (const page of queueServiceClient.listQueues().byPage({ maxPageSize: 20 })) {
244
+ * for (const item of page.queueItems || []) {
245
+ * console.log(`Queue${i++}: ${item.name}`);
246
+ * }
247
+ * }
248
+ * ```
249
+ *
250
+ * Example using paging with a marker:
251
+ *
252
+ * ```ts snippet:ReadmeSampleListQueues_Continuation
253
+ * import { QueueServiceClient } from "@azure/storage-queue";
254
+ * import { DefaultAzureCredential } from "@azure/identity";
255
+ *
256
+ * const account = "<account>";
257
+ * const queueServiceClient = new QueueServiceClient(
258
+ * `https://${account}.queue.core.windows.net`,
259
+ * new DefaultAzureCredential(),
260
+ * );
261
+ *
262
+ * let i = 1;
263
+ * let iterator = queueServiceClient.listQueues().byPage({ maxPageSize: 2 });
264
+ * let response = (await iterator.next()).value;
265
+ * // Prints 2 queues
266
+ * if (response.queueItems) {
267
+ * for (const item of response.queueItems) {
268
+ * console.log(`Queue${i++}: ${item.name}`);
269
+ * }
270
+ * }
271
+ * // Gets next marker
272
+ * let marker = response.continuationToken;
273
+ * // Passing next marker as continuationToken
274
+ * iterator = queueServiceClient.listQueues().byPage({ continuationToken: marker, maxPageSize: 10 });
275
+ * response = (await iterator.next()).value;
276
+ * // Prints 10 queues
277
+ * if (response.queueItems) {
278
+ * for (const item of response.queueItems) {
279
+ * console.log(`Queue${i++}: ${item.name}`);
280
+ * }
281
+ * }
282
+ * ```
283
+ *
284
+ * @param options - Options to list queues operation.
285
+ * @returns An asyncIterableIterator that supports paging.
286
+ */
287
+ listQueues(options = {}) {
288
+ if (options.prefix === "") {
289
+ options.prefix = void 0;
354
290
  }
355
- /**
356
- * Creates a new queue under the specified account.
357
- * @see https://learn.microsoft.com/rest/api/storageservices/create-queue4
358
- *
359
- * @param queueName - name of the queue to create
360
- * @param options - Options to Queue create operation.
361
- * @returns Response data for the Queue create operation.
362
- */
363
- async createQueue(queueName, options = {}) {
364
- return tracingClient.withSpan("QueueServiceClient-createQueue", options, async (updatedOptions) => {
365
- return this.getQueueClient(queueName).create(updatedOptions);
291
+ const updatedOptions = {
292
+ ...options,
293
+ ...options.includeMetadata ? { include: "metadata" } : {}
294
+ };
295
+ const iter = this.listItems(updatedOptions);
296
+ return {
297
+ /**
298
+ * The next method, part of the iteration protocol
299
+ */
300
+ next() {
301
+ return iter.next();
302
+ },
303
+ /**
304
+ * The connection to the async iterator, part of the iteration protocol
305
+ */
306
+ [Symbol.asyncIterator]() {
307
+ return this;
308
+ },
309
+ /**
310
+ * Return an AsyncIterableIterator that works a page at a time
311
+ */
312
+ byPage: (settings = {}) => {
313
+ return this.listSegments(settings.continuationToken, {
314
+ maxPageSize: settings.maxPageSize,
315
+ ...updatedOptions
366
316
  });
317
+ }
318
+ };
319
+ }
320
+ /**
321
+ * Gets the properties of a storage account’s Queue service, including properties
322
+ * for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
323
+ * @see https://learn.microsoft.com/rest/api/storageservices/get-queue-service-properties
324
+ *
325
+ * @param options - Options to get properties operation.
326
+ * @returns Response data including the queue service properties.
327
+ */
328
+ async getProperties(options = {}) {
329
+ return tracingClient.withSpan(
330
+ "QueueServiceClient-getProperties",
331
+ options,
332
+ async (updatedOptions) => {
333
+ return assertResponse(await this.serviceContext.getProperties(updatedOptions));
334
+ }
335
+ );
336
+ }
337
+ /**
338
+ * Sets properties for a storage account’s Queue service endpoint, including properties
339
+ * for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and soft delete settings.
340
+ * @see https://learn.microsoft.com/rest/api/storageservices/set-queue-service-properties
341
+ *
342
+ * @param properties -
343
+ * @param options - Options to set properties operation.
344
+ * @returns Response data for the Set Properties operation.
345
+ */
346
+ async setProperties(properties, options = {}) {
347
+ return tracingClient.withSpan(
348
+ "QueueServiceClient-setProperties",
349
+ options,
350
+ async (updatedOptions) => {
351
+ return assertResponse(
352
+ await this.serviceContext.setProperties(properties, updatedOptions)
353
+ );
354
+ }
355
+ );
356
+ }
357
+ /**
358
+ * Retrieves statistics related to replication for the Queue service. It is only
359
+ * available on the secondary location endpoint when read-access geo-redundant
360
+ * replication is enabled for the storage account.
361
+ * @see https://learn.microsoft.com/rest/api/storageservices/get-queue-service-stats
362
+ *
363
+ * @param options - Options to get statistics operation.
364
+ * @returns Response data for get statistics the operation.
365
+ */
366
+ async getStatistics(options = {}) {
367
+ return tracingClient.withSpan(
368
+ "QueueServiceClient-getStatistics",
369
+ options,
370
+ async (updatedOptions) => {
371
+ return assertResponse(await this.serviceContext.getStatistics(updatedOptions));
372
+ }
373
+ );
374
+ }
375
+ /**
376
+ * Creates a new queue under the specified account.
377
+ * @see https://learn.microsoft.com/rest/api/storageservices/create-queue4
378
+ *
379
+ * @param queueName - name of the queue to create
380
+ * @param options - Options to Queue create operation.
381
+ * @returns Response data for the Queue create operation.
382
+ */
383
+ async createQueue(queueName, options = {}) {
384
+ return tracingClient.withSpan(
385
+ "QueueServiceClient-createQueue",
386
+ options,
387
+ async (updatedOptions) => {
388
+ return this.getQueueClient(queueName).create(updatedOptions);
389
+ }
390
+ );
391
+ }
392
+ /**
393
+ * Deletes the specified queue permanently.
394
+ * @see https://learn.microsoft.com/rest/api/storageservices/delete-queue3
395
+ *
396
+ * @param queueName - name of the queue to delete.
397
+ * @param options - Options to Queue delete operation.
398
+ * @returns Response data for the Queue delete operation.
399
+ */
400
+ async deleteQueue(queueName, options = {}) {
401
+ return tracingClient.withSpan(
402
+ "QueueServiceClient-deleteQueue",
403
+ options,
404
+ async (updatedOptions) => {
405
+ return this.getQueueClient(queueName).delete(updatedOptions);
406
+ }
407
+ );
408
+ }
409
+ /**
410
+ * Only available for QueueServiceClient constructed with a shared key credential.
411
+ *
412
+ * Generates an account Shared Access Signature (SAS) URI based on the client properties
413
+ * and parameters passed in. The SAS is signed by the shared key credential of the client.
414
+ *
415
+ * @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
416
+ *
417
+ * @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.
418
+ * @param permissions - Specifies the list of permissions to be associated with the SAS.
419
+ * @param resourceTypes - Specifies the resource types associated with the shared access signature.
420
+ * @param options - Optional parameters.
421
+ * @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
422
+ */
423
+ generateAccountSasUrl(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
424
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
425
+ throw RangeError(
426
+ "Can only generate the account SAS when the client is initialized with a shared key credential"
427
+ );
367
428
  }
368
- /**
369
- * Deletes the specified queue permanently.
370
- * @see https://learn.microsoft.com/rest/api/storageservices/delete-queue3
371
- *
372
- * @param queueName - name of the queue to delete.
373
- * @param options - Options to Queue delete operation.
374
- * @returns Response data for the Queue delete operation.
375
- */
376
- async deleteQueue(queueName, options = {}) {
377
- return tracingClient.withSpan("QueueServiceClient-deleteQueue", options, async (updatedOptions) => {
378
- return this.getQueueClient(queueName).delete(updatedOptions);
379
- });
429
+ if (expiresOn === void 0) {
430
+ const now = /* @__PURE__ */ new Date();
431
+ expiresOn = new Date(now.getTime() + 3600 * 1e3);
380
432
  }
381
- /**
382
- * Only available for QueueServiceClient constructed with a shared key credential.
383
- *
384
- * Generates an account Shared Access Signature (SAS) URI based on the client properties
385
- * and parameters passed in. The SAS is signed by the shared key credential of the client.
386
- *
387
- * @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
388
- *
389
- * @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.
390
- * @param permissions - Specifies the list of permissions to be associated with the SAS.
391
- * @param resourceTypes - Specifies the resource types associated with the shared access signature.
392
- * @param options - Optional parameters.
393
- * @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
394
- */
395
- generateAccountSasUrl(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
396
- if (!(this.credential instanceof StorageSharedKeyCredential)) {
397
- throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");
398
- }
399
- if (expiresOn === undefined) {
400
- const now = new Date();
401
- expiresOn = new Date(now.getTime() + 3600 * 1000);
402
- }
403
- const sas = generateAccountSASQueryParameters({
404
- permissions,
405
- expiresOn,
406
- resourceTypes,
407
- services: AccountSASServices.parse("q").toString(),
408
- ...options,
409
- }, this.credential).toString();
410
- return appendToURLQuery(this.url, sas);
433
+ const sas = generateAccountSASQueryParameters(
434
+ {
435
+ permissions,
436
+ expiresOn,
437
+ resourceTypes,
438
+ services: AccountSASServices.parse("q").toString(),
439
+ ...options
440
+ },
441
+ this.credential
442
+ ).toString();
443
+ return appendToURLQuery(this.url, sas);
444
+ }
445
+ /**
446
+ * Only available for QueueServiceClient constructed with a shared key credential.
447
+ *
448
+ * Generates string to sign for an account Shared Access Signature (SAS) URI based on the client properties
449
+ * and parameters passed in. The SAS is signed by the shared key credential of the client.
450
+ *
451
+ * @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
452
+ *
453
+ * @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.
454
+ * @param permissions - Specifies the list of permissions to be associated with the SAS.
455
+ * @param resourceTypes - Specifies the resource types associated with the shared access signature.
456
+ * @param options - Optional parameters.
457
+ * @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
458
+ */
459
+ generateSasStringToSign(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
460
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
461
+ throw RangeError(
462
+ "Can only generate the account SAS when the client is initialized with a shared key credential"
463
+ );
411
464
  }
412
- /**
413
- * Only available for QueueServiceClient constructed with a shared key credential.
414
- *
415
- * Generates string to sign for an account Shared Access Signature (SAS) URI based on the client properties
416
- * and parameters passed in. The SAS is signed by the shared key credential of the client.
417
- *
418
- * @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
419
- *
420
- * @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.
421
- * @param permissions - Specifies the list of permissions to be associated with the SAS.
422
- * @param resourceTypes - Specifies the resource types associated with the shared access signature.
423
- * @param options - Optional parameters.
424
- * @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
425
- */
426
- generateSasStringToSign(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
427
- if (!(this.credential instanceof StorageSharedKeyCredential)) {
428
- throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");
429
- }
430
- if (expiresOn === undefined) {
431
- const now = new Date();
432
- expiresOn = new Date(now.getTime() + 3600 * 1000);
433
- }
434
- return generateAccountSASQueryParametersInternal({
435
- permissions,
436
- expiresOn,
437
- resourceTypes,
438
- services: AccountSASServices.parse("q").toString(),
439
- ...options,
440
- }, this.credential).stringToSign;
465
+ if (expiresOn === void 0) {
466
+ const now = /* @__PURE__ */ new Date();
467
+ expiresOn = new Date(now.getTime() + 3600 * 1e3);
441
468
  }
442
- /**
443
- * ONLY AVAILABLE WHEN USING BEARER TOKEN AUTHENTICATION (TokenCredential).
444
- *
445
- * Retrieves a user delegation key for the Queue service. This is only a valid operation when using
446
- * bearer token authentication.
447
- *
448
- * @see https://learn.microsoft.com/rest/api/storageservices/get-user-delegation-key
449
- *
450
- * @param startsOn - The start time for the user delegation SAS. Must be within 7 days of the current time
451
- * @param expiresOn - The end time for the user delegation SAS. Must be within 7 days of the current time
452
- */
453
- async getUserDelegationKey(startsOn, expiresOn, options = {}) {
454
- return tracingClient.withSpan("QueueServiceClient-getUserDelegationKey", options, async (updatedOptions) => {
455
- const response = assertResponse(await this.serviceContext.getUserDelegationKey({
456
- start: truncatedISO8061Date(startsOn, false),
457
- expiry: truncatedISO8061Date(expiresOn, false),
458
- }, {
459
- abortSignal: options.abortSignal,
460
- tracingOptions: updatedOptions.tracingOptions,
461
- }));
462
- const userDelegationKey = {
463
- signedObjectId: response.signedObjectId,
464
- signedTenantId: response.signedTenantId,
465
- signedStartsOn: new Date(response.signedStartsOn),
466
- signedExpiresOn: new Date(response.signedExpiresOn),
467
- signedService: response.signedService,
468
- signedVersion: response.signedVersion,
469
- value: response.value,
470
- };
471
- const res = {
472
- _response: response._response,
473
- requestId: response.requestId,
474
- clientRequestId: response.clientRequestId,
475
- version: response.version,
476
- date: response.date,
477
- ...userDelegationKey,
478
- };
479
- return res;
480
- });
469
+ return generateAccountSASQueryParametersInternal(
470
+ {
471
+ permissions,
472
+ expiresOn,
473
+ resourceTypes,
474
+ services: AccountSASServices.parse("q").toString(),
475
+ ...options
476
+ },
477
+ this.credential
478
+ ).stringToSign;
479
+ }
480
+ async getUserDelegationKey(startsOnOrParam, expiresOnOrOption, options = {}) {
481
+ let startsOn = startsOnOrParam;
482
+ let expiresOn = expiresOnOrOption;
483
+ let userDelegationTid = void 0;
484
+ let getUserDelegationKeyOptions = options;
485
+ if (isQueueGetUserDelegationKeyParameters(startsOnOrParam)) {
486
+ startsOn = startsOnOrParam.startsOn;
487
+ expiresOn = startsOnOrParam.expiresOn;
488
+ userDelegationTid = startsOnOrParam.delegatedUserTenantId;
489
+ getUserDelegationKeyOptions = expiresOnOrOption;
481
490
  }
491
+ return tracingClient.withSpan(
492
+ "QueueServiceClient-getUserDelegationKey",
493
+ getUserDelegationKeyOptions,
494
+ async (updatedOptions) => {
495
+ const response = assertResponse(
496
+ await this.serviceContext.getUserDelegationKey(
497
+ {
498
+ start: truncatedISO8061Date(startsOn, false),
499
+ expiry: truncatedISO8061Date(expiresOn, false),
500
+ delegatedUserTid: userDelegationTid
501
+ },
502
+ {
503
+ abortSignal: options.abortSignal,
504
+ tracingOptions: updatedOptions.tracingOptions
505
+ }
506
+ )
507
+ );
508
+ const userDelegationKey = {
509
+ signedObjectId: response.signedObjectId,
510
+ signedTenantId: response.signedTenantId,
511
+ signedStartsOn: new Date(response.signedStartsOn),
512
+ signedExpiresOn: new Date(response.signedExpiresOn),
513
+ signedService: response.signedService,
514
+ signedVersion: response.signedVersion,
515
+ signedDelegatedUserTenantId: response.signedDelegatedUserTenantId,
516
+ value: response.value
517
+ };
518
+ const res = {
519
+ _response: response._response,
520
+ requestId: response.requestId,
521
+ clientRequestId: response.clientRequestId,
522
+ version: response.version,
523
+ date: response.date,
524
+ ...userDelegationKey
525
+ };
526
+ return res;
527
+ }
528
+ );
529
+ }
482
530
  }
483
- //# sourceMappingURL=QueueServiceClient.js.map
531
+ export {
532
+ QueueServiceClient
533
+ };