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