@azure/storage-queue 12.30.0-alpha.20260310.1 → 12.31.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 (158) hide show
  1. package/dist/browser/generated/src/storageClient.js +2 -2
  2. package/dist/browser/generated/src/storageClient.js.map +1 -1
  3. package/dist/browser/utils/constants.js +2 -2
  4. package/dist/browser/utils/constants.js.map +1 -1
  5. package/dist/browser/utils/utils.common.d.ts.map +1 -1
  6. package/dist/browser/utils/utils.common.js +14 -0
  7. package/dist/browser/utils/utils.common.js.map +1 -1
  8. package/dist/commonjs/AccountSASPermissions.js +1 -0
  9. package/dist/commonjs/AccountSASPermissions.js.map +1 -1
  10. package/dist/commonjs/AccountSASResourceTypes.js +1 -0
  11. package/dist/commonjs/AccountSASResourceTypes.js.map +1 -1
  12. package/dist/commonjs/AccountSASServices.js +1 -0
  13. package/dist/commonjs/AccountSASServices.js.map +1 -1
  14. package/dist/commonjs/AccountSASSignatureValues.js +1 -0
  15. package/dist/commonjs/AccountSASSignatureValues.js.map +1 -1
  16. package/dist/commonjs/Pipeline.js +1 -0
  17. package/dist/commonjs/Pipeline.js.map +1 -1
  18. package/dist/commonjs/QueueClient.js +1 -0
  19. package/dist/commonjs/QueueClient.js.map +1 -1
  20. package/dist/commonjs/QueueSASPermissions.js +1 -0
  21. package/dist/commonjs/QueueSASPermissions.js.map +1 -1
  22. package/dist/commonjs/QueueSASSignatureValues.js +1 -0
  23. package/dist/commonjs/QueueSASSignatureValues.js.map +1 -1
  24. package/dist/commonjs/QueueServiceClient.js +1 -0
  25. package/dist/commonjs/QueueServiceClient.js.map +1 -1
  26. package/dist/commonjs/SASQueryParameters.js +1 -0
  27. package/dist/commonjs/SASQueryParameters.js.map +1 -1
  28. package/dist/commonjs/SasIPRange.js +1 -0
  29. package/dist/commonjs/SasIPRange.js.map +1 -1
  30. package/dist/commonjs/StorageClient.js +1 -0
  31. package/dist/commonjs/StorageClient.js.map +1 -1
  32. package/dist/commonjs/StorageContextClient.js +1 -0
  33. package/dist/commonjs/StorageContextClient.js.map +1 -1
  34. package/dist/commonjs/generated/src/index.js +1 -0
  35. package/dist/commonjs/generated/src/index.js.map +1 -1
  36. package/dist/commonjs/generated/src/models/index.js +1 -0
  37. package/dist/commonjs/generated/src/models/index.js.map +1 -1
  38. package/dist/commonjs/generated/src/models/mappers.js +1 -0
  39. package/dist/commonjs/generated/src/models/mappers.js.map +1 -1
  40. package/dist/commonjs/generated/src/models/parameters.js +1 -0
  41. package/dist/commonjs/generated/src/models/parameters.js.map +1 -1
  42. package/dist/commonjs/generated/src/operations/index.js +1 -0
  43. package/dist/commonjs/generated/src/operations/index.js.map +1 -1
  44. package/dist/commonjs/generated/src/operations/messageId.js +1 -0
  45. package/dist/commonjs/generated/src/operations/messageId.js.map +1 -1
  46. package/dist/commonjs/generated/src/operations/messages.js +1 -0
  47. package/dist/commonjs/generated/src/operations/messages.js.map +1 -1
  48. package/dist/commonjs/generated/src/operations/queue.js +1 -0
  49. package/dist/commonjs/generated/src/operations/queue.js.map +1 -1
  50. package/dist/commonjs/generated/src/operations/service.js +1 -0
  51. package/dist/commonjs/generated/src/operations/service.js.map +1 -1
  52. package/dist/commonjs/generated/src/operationsInterfaces/index.js +1 -0
  53. package/dist/commonjs/generated/src/operationsInterfaces/index.js.map +1 -1
  54. package/dist/commonjs/generated/src/operationsInterfaces/messageId.js +1 -0
  55. package/dist/commonjs/generated/src/operationsInterfaces/messageId.js.map +1 -1
  56. package/dist/commonjs/generated/src/operationsInterfaces/messages.js +1 -0
  57. package/dist/commonjs/generated/src/operationsInterfaces/messages.js.map +1 -1
  58. package/dist/commonjs/generated/src/operationsInterfaces/queue.js +1 -0
  59. package/dist/commonjs/generated/src/operationsInterfaces/queue.js.map +1 -1
  60. package/dist/commonjs/generated/src/operationsInterfaces/service.js +1 -0
  61. package/dist/commonjs/generated/src/operationsInterfaces/service.js.map +1 -1
  62. package/dist/commonjs/generated/src/storageClient.js +3 -2
  63. package/dist/commonjs/generated/src/storageClient.js.map +2 -2
  64. package/dist/commonjs/generatedModels.js +1 -0
  65. package/dist/commonjs/generatedModels.js.map +1 -1
  66. package/dist/commonjs/index.js +1 -0
  67. package/dist/commonjs/index.js.map +1 -1
  68. package/dist/commonjs/log.js +1 -0
  69. package/dist/commonjs/log.js.map +1 -1
  70. package/dist/commonjs/models.js +1 -0
  71. package/dist/commonjs/models.js.map +1 -1
  72. package/dist/commonjs/tsdoc-metadata.json +1 -1
  73. package/dist/commonjs/utils/constants.js +3 -2
  74. package/dist/commonjs/utils/constants.js.map +2 -2
  75. package/dist/commonjs/utils/tracing.js +1 -0
  76. package/dist/commonjs/utils/tracing.js.map +1 -1
  77. package/dist/commonjs/utils/utils.common.d.ts.map +1 -1
  78. package/dist/commonjs/utils/utils.common.js +14 -0
  79. package/dist/commonjs/utils/utils.common.js.map +3 -3
  80. package/dist/esm/AccountSASPermissions.js +123 -111
  81. package/dist/esm/AccountSASPermissions.js.map +1 -7
  82. package/dist/esm/AccountSASResourceTypes.js +67 -58
  83. package/dist/esm/AccountSASResourceTypes.js.map +1 -7
  84. package/dist/esm/AccountSASServices.js +75 -66
  85. package/dist/esm/AccountSASServices.js.map +1 -7
  86. package/dist/esm/AccountSASSignatureValues.js +63 -62
  87. package/dist/esm/AccountSASSignatureValues.js.map +1 -7
  88. package/dist/esm/Pipeline.js +239 -239
  89. package/dist/esm/Pipeline.js.map +1 -7
  90. package/dist/esm/QueueClient.js +671 -689
  91. package/dist/esm/QueueClient.js.map +1 -7
  92. package/dist/esm/QueueSASPermissions.js +77 -68
  93. package/dist/esm/QueueSASPermissions.js.map +1 -7
  94. package/dist/esm/QueueSASSignatureValues.js +103 -123
  95. package/dist/esm/QueueSASSignatureValues.js.map +1 -7
  96. package/dist/esm/QueueServiceClient.js +463 -505
  97. package/dist/esm/QueueServiceClient.js.map +1 -7
  98. package/dist/esm/SASQueryParameters.js +272 -283
  99. package/dist/esm/SASQueryParameters.js.map +1 -7
  100. package/dist/esm/SasIPRange.js +12 -5
  101. package/dist/esm/SasIPRange.js.map +1 -7
  102. package/dist/esm/StorageClient.js +59 -50
  103. package/dist/esm/StorageClient.js.map +1 -7
  104. package/dist/esm/StorageContextClient.js +15 -10
  105. package/dist/esm/StorageContextClient.js.map +1 -7
  106. package/dist/esm/generated/src/index.js +9 -4
  107. package/dist/esm/generated/src/index.js.map +1 -7
  108. package/dist/esm/generated/src/models/index.js +126 -63
  109. package/dist/esm/generated/src/models/index.js.map +1 -7
  110. package/dist/esm/generated/src/models/mappers.js +1827 -1873
  111. package/dist/esm/generated/src/models/mappers.js.map +1 -7
  112. package/dist/esm/generated/src/models/parameters.js +302 -330
  113. package/dist/esm/generated/src/models/parameters.js.map +1 -7
  114. package/dist/esm/generated/src/operations/index.js +8 -0
  115. package/dist/esm/generated/src/operations/index.js.map +1 -7
  116. package/dist/esm/generated/src/operations/messageId.js +92 -95
  117. package/dist/esm/generated/src/operations/messageId.js.map +1 -7
  118. package/dist/esm/generated/src/operations/messages.js +178 -178
  119. package/dist/esm/generated/src/operations/messages.js.map +1 -7
  120. package/dist/esm/generated/src/operations/queue.js +199 -208
  121. package/dist/esm/generated/src/operations/queue.js.map +1 -7
  122. package/dist/esm/generated/src/operations/service.js +192 -204
  123. package/dist/esm/generated/src/operations/service.js.map +1 -7
  124. package/dist/esm/generated/src/operationsInterfaces/index.js +8 -0
  125. package/dist/esm/generated/src/operationsInterfaces/index.js.map +1 -7
  126. package/dist/esm/generated/src/operationsInterfaces/messageId.js +9 -0
  127. package/dist/esm/generated/src/operationsInterfaces/messageId.js.map +1 -7
  128. package/dist/esm/generated/src/operationsInterfaces/messages.js +9 -0
  129. package/dist/esm/generated/src/operationsInterfaces/messages.js.map +1 -7
  130. package/dist/esm/generated/src/operationsInterfaces/queue.js +9 -0
  131. package/dist/esm/generated/src/operationsInterfaces/queue.js.map +1 -7
  132. package/dist/esm/generated/src/operationsInterfaces/service.js +9 -0
  133. package/dist/esm/generated/src/operationsInterfaces/service.js.map +1 -7
  134. package/dist/esm/generated/src/storageClient.js +54 -49
  135. package/dist/esm/generated/src/storageClient.js.map +1 -7
  136. package/dist/esm/generatedModels.js +4 -0
  137. package/dist/esm/generatedModels.js.map +1 -7
  138. package/dist/esm/index.js +10 -50
  139. package/dist/esm/index.js.map +1 -7
  140. package/dist/esm/log.js +7 -4
  141. package/dist/esm/log.js.map +1 -7
  142. package/dist/esm/models.js +18 -10
  143. package/dist/esm/models.js.map +1 -7
  144. package/dist/esm/utils/constants.js +111 -117
  145. package/dist/esm/utils/constants.js.map +1 -7
  146. package/dist/esm/utils/tracing.js +11 -7
  147. package/dist/esm/utils/tracing.js.map +1 -7
  148. package/dist/esm/utils/utils.common.d.ts.map +1 -1
  149. package/dist/esm/utils/utils.common.js +372 -247
  150. package/dist/esm/utils/utils.common.js.map +1 -7
  151. package/dist/react-native/generated/src/storageClient.js +2 -2
  152. package/dist/react-native/generated/src/storageClient.js.map +1 -1
  153. package/dist/react-native/utils/constants.js +2 -2
  154. package/dist/react-native/utils/constants.js.map +1 -1
  155. package/dist/react-native/utils/utils.common.d.ts.map +1 -1
  156. package/dist/react-native/utils/utils.common.js +14 -0
  157. package/dist/react-native/utils/utils.common.js.map +1 -1
  158. package/package.json +26 -22
@@ -1,533 +1,491 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
1
3
  import { isTokenCredential } from "@azure/core-auth";
2
4
  import { isNodeLike } from "@azure/core-util";
3
5
  import { newPipeline, isPipelineLike } from "./Pipeline.js";
4
6
  import { StorageClient } from "./StorageClient.js";
5
- import {
6
- appendToURLPath,
7
- appendToURLQuery,
8
- extractConnectionStringParts,
9
- assertResponse,
10
- truncatedISO8061Date
11
- } from "./utils/utils.common.js";
7
+ import { appendToURLPath, appendToURLQuery, extractConnectionStringParts, assertResponse, truncatedISO8061Date, } from "./utils/utils.common.js";
12
8
  import { StorageSharedKeyCredential } from "@azure/storage-common";
13
9
  import { AnonymousCredential } from "@azure/storage-common";
14
10
  import { tracingClient } from "./utils/tracing.js";
15
11
  import { QueueClient } from "./QueueClient.js";
16
12
  import { AccountSASPermissions } from "./AccountSASPermissions.js";
17
- import {
18
- generateAccountSASQueryParameters,
19
- generateAccountSASQueryParametersInternal
20
- } from "./AccountSASSignatureValues.js";
13
+ import { generateAccountSASQueryParameters, generateAccountSASQueryParametersInternal, } from "./AccountSASSignatureValues.js";
21
14
  import { AccountSASServices } from "./AccountSASServices.js";
22
15
  import { getDefaultProxySettings } from "@azure/core-rest-pipeline";
23
16
  function isQueueGetUserDelegationKeyParameters(parameter) {
24
- if (!parameter || typeof parameter !== "object") {
25
- return false;
26
- }
27
- const castParameter = parameter;
28
- return castParameter.expiresOn instanceof Date;
17
+ if (!parameter || typeof parameter !== "object") {
18
+ return false;
19
+ }
20
+ const castParameter = parameter;
21
+ return castParameter.expiresOn instanceof Date;
29
22
  }
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);
23
+ /**
24
+ * A QueueServiceClient represents a URL to the Azure Storage Queue service allowing you
25
+ * to manipulate queues.
26
+ */
27
+ export class QueueServiceClient extends StorageClient {
28
+ /**
29
+ * Creates an instance of QueueServiceClient.
30
+ *
31
+ * @param connectionString - Account connection string or a SAS connection string of an Azure storage account.
32
+ * [ Note - Account connection string can only be used in NODE.JS runtime. ]
33
+ * Account connection string example -
34
+ * `DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net`
35
+ * SAS connection string example -
36
+ * `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`
37
+ * @param options - Options to configure the HTTP pipeline.
38
+ * @returns A new QueueServiceClient object from the given connection string.
39
+ */
40
+ static fromConnectionString(connectionString,
41
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
42
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
43
+ options) {
44
+ options = options || {};
45
+ const extractedCreds = extractConnectionStringParts(connectionString);
46
+ if (extractedCreds.kind === "AccountConnString") {
47
+ if (isNodeLike) {
48
+ const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
49
+ if (!options.proxyOptions) {
50
+ options.proxyOptions = getDefaultProxySettings(extractedCreds.proxyUri);
51
+ }
52
+ const pipeline = newPipeline(sharedKeyCredential, options);
53
+ return new QueueServiceClient(extractedCreds.url, pipeline);
54
+ }
55
+ else {
56
+ throw new Error("Account connection string is only supported in Node.js environment");
57
+ }
58
+ }
59
+ else if (extractedCreds.kind === "SASConnString") {
60
+ const pipeline = newPipeline(new AnonymousCredential(), options);
61
+ return new QueueServiceClient(extractedCreds.url + "?" + extractedCreds.accountSas, pipeline);
62
+ }
63
+ else {
64
+ throw new Error("Connection string must be either an Account connection string or a SAS connection string");
54
65
  }
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
- );
67
66
  }
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);
67
+ /**
68
+ * serviceContext provided by protocol layer.
69
+ */
70
+ serviceContext;
71
+ constructor(url, credentialOrPipeline,
72
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
73
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
74
+ options) {
75
+ let pipeline;
76
+ if (isPipelineLike(credentialOrPipeline)) {
77
+ pipeline = credentialOrPipeline;
78
+ }
79
+ else if ((isNodeLike && credentialOrPipeline instanceof StorageSharedKeyCredential) ||
80
+ credentialOrPipeline instanceof AnonymousCredential ||
81
+ isTokenCredential(credentialOrPipeline)) {
82
+ pipeline = newPipeline(credentialOrPipeline, options);
83
+ }
84
+ else {
85
+ // The second parameter is undefined. Use anonymous credential.
86
+ pipeline = newPipeline(new AnonymousCredential(), options);
87
+ }
88
+ super(url, pipeline);
89
+ this.serviceContext = this.storageClientContext.service;
81
90
  }
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;
91
+ /**
92
+ * Creates a {@link QueueClient} object.
93
+ *
94
+ * @param queueName -
95
+ * @returns a new QueueClient
96
+ *
97
+ * Example usage:
98
+ *
99
+ * ```ts snippet:ReadmeSampleCreateQueue
100
+ * import { QueueServiceClient } from "@azure/storage-queue";
101
+ * import { DefaultAzureCredential } from "@azure/identity";
102
+ *
103
+ * const account = "<account>";
104
+ * const queueServiceClient = new QueueServiceClient(
105
+ * `https://${account}.queue.core.windows.net`,
106
+ * new DefaultAzureCredential(),
107
+ * );
108
+ *
109
+ * const queueName = "<valid queue name>";
110
+ * const queueClient = queueServiceClient.getQueueClient(queueName);
111
+ * const createQueueResponse = await queueClient.create();
112
+ * console.log(
113
+ * `Created queue ${queueName} successfully, service assigned request Id: ${createQueueResponse.requestId}`,
114
+ * );
115
+ * ```
116
+ */
117
+ getQueueClient(queueName) {
118
+ return new QueueClient(appendToURLPath(this.url, queueName), this.pipeline);
131
119
  }
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;
120
+ /**
121
+ * Returns a list of the queues under the specified account.
122
+ * @see https://learn.microsoft.com/rest/api/storageservices/list-queues1
123
+ *
124
+ * @param marker - A string value that identifies the portion of
125
+ * the list of queues to be returned with the next listing operation. The
126
+ * operation returns the continuationToken value within the response body if the
127
+ * listing operation did not return all queues remaining to be listed
128
+ * with the current page. The continuationToken value can be used as the value for
129
+ * the marker parameter in a subsequent call to request the next page of list
130
+ * items. The marker value is opaque to the client.
131
+ * @param options - Options to list queues operation.
132
+ * @returns Response data for the list queues segment operation.
133
+ */
134
+ async listQueuesSegment(marker, options = {}) {
135
+ if (options.prefix === "") {
136
+ options.prefix = undefined;
137
+ }
138
+ return tracingClient.withSpan("QueueServiceClient-listQueuesSegment", options, async (updatedOptions) => {
139
+ return assertResponse(await this.serviceContext.listQueuesSegment({
140
+ ...updatedOptions,
141
+ marker,
142
+ include: options.include === undefined ? undefined : [options.include],
143
+ }));
144
+ });
161
145
  }
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;
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 = undefined;
161
+ }
162
+ let listQueuesResponse;
163
+ do {
164
+ listQueuesResponse = await this.listQueuesSegment(marker, options);
165
+ marker = listQueuesResponse.continuationToken;
166
+ yield await listQueuesResponse;
167
+ } while (marker);
177
168
  }
178
- let marker;
179
- for await (const segment of this.listSegments(marker, options)) {
180
- if (segment.queueItems) {
181
- yield* segment.queueItems;
182
- }
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 = undefined;
177
+ }
178
+ let marker;
179
+ for await (const segment of this.listSegments(marker, options)) {
180
+ if (segment.queueItems) {
181
+ yield* segment.queueItems;
182
+ }
183
+ }
183
184
  }
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;
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 = undefined;
290
+ }
291
+ const updatedOptions = {
292
+ ...options,
293
+ ...(options.includeMetadata ? { include: "metadata" } : {}),
294
+ };
295
+ // AsyncIterableIterator to iterate over queues
296
+ const iter = this.listItems(updatedOptions);
297
+ return {
298
+ /**
299
+ * The next method, part of the iteration protocol
300
+ */
301
+ next() {
302
+ return iter.next();
303
+ },
304
+ /**
305
+ * The connection to the async iterator, part of the iteration protocol
306
+ */
307
+ [Symbol.asyncIterator]() {
308
+ return this;
309
+ },
310
+ /**
311
+ * Return an AsyncIterableIterator that works a page at a time
312
+ */
313
+ byPage: (settings = {}) => {
314
+ return this.listSegments(settings.continuationToken, {
315
+ maxPageSize: settings.maxPageSize,
316
+ ...updatedOptions,
317
+ });
318
+ },
319
+ };
290
320
  }
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
321
+ /**
322
+ * Gets the properties of a storage account’s Queue service, including properties
323
+ * for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
324
+ * @see https://learn.microsoft.com/rest/api/storageservices/get-queue-service-properties
325
+ *
326
+ * @param options - Options to get properties operation.
327
+ * @returns Response data including the queue service properties.
328
+ */
329
+ async getProperties(options = {}) {
330
+ return tracingClient.withSpan("QueueServiceClient-getProperties", options, async (updatedOptions) => {
331
+ return assertResponse(await this.serviceContext.getProperties(updatedOptions));
316
332
  });
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
- );
428
333
  }
429
- if (expiresOn === void 0) {
430
- const now = /* @__PURE__ */ new Date();
431
- expiresOn = new Date(now.getTime() + 3600 * 1e3);
334
+ /**
335
+ * Sets properties for a storage account’s Queue service endpoint, including properties
336
+ * for Storage Analytics, CORS (Cross-Origin Resource Sharing) rules and soft delete settings.
337
+ * @see https://learn.microsoft.com/rest/api/storageservices/set-queue-service-properties
338
+ *
339
+ * @param properties -
340
+ * @param options - Options to set properties operation.
341
+ * @returns Response data for the Set Properties operation.
342
+ */
343
+ async setProperties(properties, options = {}) {
344
+ return tracingClient.withSpan("QueueServiceClient-setProperties", options, async (updatedOptions) => {
345
+ return assertResponse(await this.serviceContext.setProperties(properties, updatedOptions));
346
+ });
432
347
  }
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
- );
348
+ /**
349
+ * Retrieves statistics related to replication for the Queue service. It is only
350
+ * available on the secondary location endpoint when read-access geo-redundant
351
+ * replication is enabled for the storage account.
352
+ * @see https://learn.microsoft.com/rest/api/storageservices/get-queue-service-stats
353
+ *
354
+ * @param options - Options to get statistics operation.
355
+ * @returns Response data for get statistics the operation.
356
+ */
357
+ async getStatistics(options = {}) {
358
+ return tracingClient.withSpan("QueueServiceClient-getStatistics", options, async (updatedOptions) => {
359
+ return assertResponse(await this.serviceContext.getStatistics(updatedOptions));
360
+ });
464
361
  }
465
- if (expiresOn === void 0) {
466
- const now = /* @__PURE__ */ new Date();
467
- expiresOn = new Date(now.getTime() + 3600 * 1e3);
362
+ /**
363
+ * Creates a new queue under the specified account.
364
+ * @see https://learn.microsoft.com/rest/api/storageservices/create-queue4
365
+ *
366
+ * @param queueName - name of the queue to create
367
+ * @param options - Options to Queue create operation.
368
+ * @returns Response data for the Queue create operation.
369
+ */
370
+ async createQueue(queueName, options = {}) {
371
+ return tracingClient.withSpan("QueueServiceClient-createQueue", options, async (updatedOptions) => {
372
+ return this.getQueueClient(queueName).create(updatedOptions);
373
+ });
468
374
  }
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;
375
+ /**
376
+ * Deletes the specified queue permanently.
377
+ * @see https://learn.microsoft.com/rest/api/storageservices/delete-queue3
378
+ *
379
+ * @param queueName - name of the queue to delete.
380
+ * @param options - Options to Queue delete operation.
381
+ * @returns Response data for the Queue delete operation.
382
+ */
383
+ async deleteQueue(queueName, options = {}) {
384
+ return tracingClient.withSpan("QueueServiceClient-deleteQueue", options, async (updatedOptions) => {
385
+ return this.getQueueClient(queueName).delete(updatedOptions);
386
+ });
387
+ }
388
+ /**
389
+ * Only available for QueueServiceClient constructed with a shared key credential.
390
+ *
391
+ * Generates an account Shared Access Signature (SAS) URI based on the client properties
392
+ * and parameters passed in. The SAS is signed by the shared key credential of the client.
393
+ *
394
+ * @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
395
+ *
396
+ * @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.
397
+ * @param permissions - Specifies the list of permissions to be associated with the SAS.
398
+ * @param resourceTypes - Specifies the resource types associated with the shared access signature.
399
+ * @param options - Optional parameters.
400
+ * @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
401
+ */
402
+ generateAccountSasUrl(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
403
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
404
+ throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");
405
+ }
406
+ if (expiresOn === undefined) {
407
+ const now = new Date();
408
+ expiresOn = new Date(now.getTime() + 3600 * 1000);
409
+ }
410
+ const sas = generateAccountSASQueryParameters({
411
+ permissions,
412
+ expiresOn,
413
+ resourceTypes,
414
+ services: AccountSASServices.parse("q").toString(),
415
+ ...options,
416
+ }, this.credential).toString();
417
+ return appendToURLQuery(this.url, sas);
418
+ }
419
+ /**
420
+ * Only available for QueueServiceClient constructed with a shared key credential.
421
+ *
422
+ * Generates string to sign for an account Shared Access Signature (SAS) URI based on the client properties
423
+ * and parameters passed in. The SAS is signed by the shared key credential of the client.
424
+ *
425
+ * @see https://learn.microsoft.com/rest/api/storageservices/create-account-sas
426
+ *
427
+ * @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not specified.
428
+ * @param permissions - Specifies the list of permissions to be associated with the SAS.
429
+ * @param resourceTypes - Specifies the resource types associated with the shared access signature.
430
+ * @param options - Optional parameters.
431
+ * @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
432
+ */
433
+ generateSasStringToSign(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
434
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
435
+ throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");
436
+ }
437
+ if (expiresOn === undefined) {
438
+ const now = new Date();
439
+ expiresOn = new Date(now.getTime() + 3600 * 1000);
440
+ }
441
+ return generateAccountSASQueryParametersInternal({
442
+ permissions,
443
+ expiresOn,
444
+ resourceTypes,
445
+ services: AccountSASServices.parse("q").toString(),
446
+ ...options,
447
+ }, this.credential).stringToSign;
448
+ }
449
+ async getUserDelegationKey(startsOnOrParam, expiresOnOrOption, options = {}) {
450
+ let startsOn = startsOnOrParam;
451
+ let expiresOn = expiresOnOrOption;
452
+ let userDelegationTid = undefined;
453
+ let getUserDelegationKeyOptions = options;
454
+ if (isQueueGetUserDelegationKeyParameters(startsOnOrParam)) {
455
+ startsOn = startsOnOrParam.startsOn;
456
+ expiresOn = startsOnOrParam.expiresOn;
457
+ userDelegationTid = startsOnOrParam.delegatedUserTenantId;
458
+ getUserDelegationKeyOptions = expiresOnOrOption;
459
+ }
460
+ return tracingClient.withSpan("QueueServiceClient-getUserDelegationKey", getUserDelegationKeyOptions, async (updatedOptions) => {
461
+ const response = assertResponse(await this.serviceContext.getUserDelegationKey({
462
+ start: truncatedISO8061Date(startsOn, false),
463
+ expiry: truncatedISO8061Date(expiresOn, false),
464
+ delegatedUserTid: userDelegationTid,
465
+ }, {
466
+ abortSignal: options.abortSignal,
467
+ tracingOptions: updatedOptions.tracingOptions,
468
+ }));
469
+ const userDelegationKey = {
470
+ signedObjectId: response.signedObjectId,
471
+ signedTenantId: response.signedTenantId,
472
+ signedStartsOn: new Date(response.signedStartsOn),
473
+ signedExpiresOn: new Date(response.signedExpiresOn),
474
+ signedService: response.signedService,
475
+ signedVersion: response.signedVersion,
476
+ signedDelegatedUserTenantId: response.signedDelegatedUserTenantId,
477
+ value: response.value,
478
+ };
479
+ const res = {
480
+ _response: response._response,
481
+ requestId: response.requestId,
482
+ clientRequestId: response.clientRequestId,
483
+ version: response.version,
484
+ date: response.date,
485
+ ...userDelegationKey,
486
+ };
487
+ return res;
488
+ });
490
489
  }
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
- }
530
490
  }
531
- export {
532
- QueueServiceClient
533
- };
491
+ //# sourceMappingURL=QueueServiceClient.js.map