@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,380 +1,284 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.appendToURLPath = appendToURLPath;
4
- exports.setURLParameter = setURLParameter;
5
- exports.getURLParameter = getURLParameter;
6
- exports.setURLHost = setURLHost;
7
- exports.getURLPath = getURLPath;
8
- exports.getURLQueries = getURLQueries;
9
- exports.getValueInConnString = getValueInConnString;
10
- exports.extractConnectionStringParts = extractConnectionStringParts;
11
- exports.truncatedISO8061Date = truncatedISO8061Date;
12
- exports.delay = delay;
13
- exports.sanitizeURL = sanitizeURL;
14
- exports.sanitizeHeaders = sanitizeHeaders;
15
- exports.getAccountNameFromUrl = getAccountNameFromUrl;
16
- exports.isIpEndpointStyle = isIpEndpointStyle;
17
- exports.appendToURLQuery = appendToURLQuery;
18
- exports.assertResponse = assertResponse;
19
- const core_rest_pipeline_1 = require("@azure/core-rest-pipeline");
20
- const constants_js_1 = require("./constants.js");
21
- /**
22
- * Append a string to URL path. Will remove duplicated "/" in front of the string
23
- * when URL path ends with a "/".
24
- *
25
- * @param url - Source URL string
26
- * @param name - String to be appended to URL
27
- * @returns An updated URL string
28
- */
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 utils_common_exports = {};
19
+ __export(utils_common_exports, {
20
+ appendToURLPath: () => appendToURLPath,
21
+ appendToURLQuery: () => appendToURLQuery,
22
+ assertResponse: () => assertResponse,
23
+ delay: () => delay,
24
+ extractConnectionStringParts: () => extractConnectionStringParts,
25
+ getAccountNameFromUrl: () => getAccountNameFromUrl,
26
+ getURLParameter: () => getURLParameter,
27
+ getURLPath: () => getURLPath,
28
+ getURLQueries: () => getURLQueries,
29
+ getValueInConnString: () => getValueInConnString,
30
+ isIpEndpointStyle: () => isIpEndpointStyle,
31
+ sanitizeHeaders: () => sanitizeHeaders,
32
+ sanitizeURL: () => sanitizeURL,
33
+ setURLHost: () => setURLHost,
34
+ setURLParameter: () => setURLParameter,
35
+ truncatedISO8061Date: () => truncatedISO8061Date
36
+ });
37
+ module.exports = __toCommonJS(utils_common_exports);
38
+ var import_core_rest_pipeline = require("@azure/core-rest-pipeline");
39
+ var import_constants = require("./constants.js");
29
40
  function appendToURLPath(url, name) {
30
- const urlParsed = new URL(url);
31
- let path = urlParsed.pathname;
32
- path = path ? (path.endsWith("/") ? `${path}${name}` : `${path}/${name}`) : name;
33
- urlParsed.pathname = path;
34
- return urlParsed.toString();
41
+ const urlParsed = new URL(url);
42
+ let path = urlParsed.pathname;
43
+ path = path ? path.endsWith("/") ? `${path}${name}` : `${path}/${name}` : name;
44
+ urlParsed.pathname = path;
45
+ return urlParsed.toString();
35
46
  }
36
- /**
37
- * Set URL parameter name and value. If name exists in URL parameters, old value
38
- * will be replaced by name key. If not provide value, the parameter will be deleted.
39
- *
40
- * @param url - Source URL string
41
- * @param name - Parameter name
42
- * @param value - Parameter value
43
- * @returns An updated URL string
44
- */
45
47
  function setURLParameter(url, name, value) {
46
- const urlParsed = new URL(url);
47
- const encodedName = encodeURIComponent(name);
48
- const encodedValue = value ? encodeURIComponent(value) : undefined;
49
- // mutating searchParams will change the encoding, so we have to do this ourselves
50
- const searchString = urlParsed.search === "" ? "?" : urlParsed.search;
51
- const searchPieces = [];
52
- for (const pair of searchString.slice(1).split("&")) {
53
- if (pair) {
54
- const [key] = pair.split("=", 2);
55
- if (key !== encodedName) {
56
- searchPieces.push(pair);
57
- }
58
- }
59
- }
60
- if (encodedValue) {
61
- searchPieces.push(`${encodedName}=${encodedValue}`);
48
+ const urlParsed = new URL(url);
49
+ const encodedName = encodeURIComponent(name);
50
+ const encodedValue = value ? encodeURIComponent(value) : void 0;
51
+ const searchString = urlParsed.search === "" ? "?" : urlParsed.search;
52
+ const searchPieces = [];
53
+ for (const pair of searchString.slice(1).split("&")) {
54
+ if (pair) {
55
+ const [key] = pair.split("=", 2);
56
+ if (key !== encodedName) {
57
+ searchPieces.push(pair);
58
+ }
62
59
  }
63
- urlParsed.search = searchPieces.length ? `?${searchPieces.join("&")}` : "";
64
- return urlParsed.toString();
60
+ }
61
+ if (encodedValue) {
62
+ searchPieces.push(`${encodedName}=${encodedValue}`);
63
+ }
64
+ urlParsed.search = searchPieces.length ? `?${searchPieces.join("&")}` : "";
65
+ return urlParsed.toString();
65
66
  }
66
- /**
67
- * Get URL parameter by name.
68
- *
69
- * @param url - URL string
70
- * @param name - Parameter name
71
- * @returns Parameter value(s) for the given parameter name.
72
- */
73
67
  function getURLParameter(url, name) {
74
- const urlParsed = new URL(url);
75
- return urlParsed.searchParams.get(name) ?? undefined;
68
+ const urlParsed = new URL(url);
69
+ return urlParsed.searchParams.get(name) ?? void 0;
76
70
  }
77
- /**
78
- * Set URL host.
79
- *
80
- * @param url - Source URL string
81
- * @param host - New host string
82
- * @returns An updated URL string
83
- */
84
71
  function setURLHost(url, host) {
85
- const urlParsed = new URL(url);
86
- urlParsed.hostname = host;
87
- return urlParsed.toString();
72
+ const urlParsed = new URL(url);
73
+ urlParsed.hostname = host;
74
+ return urlParsed.toString();
88
75
  }
89
- /**
90
- * Gets URL path from an URL string.
91
- *
92
- * @param url - Source URL string
93
- * @returns The path part of the given URL string.
94
- */
95
76
  function getURLPath(url) {
96
- try {
97
- const urlParsed = new URL(url);
98
- return urlParsed.pathname;
99
- }
100
- catch (e) {
101
- return undefined;
102
- }
77
+ try {
78
+ const urlParsed = new URL(url);
79
+ return urlParsed.pathname;
80
+ } catch (e) {
81
+ return void 0;
82
+ }
103
83
  }
104
- /**
105
- * Gets URL query key value pairs from an URL string.
106
- *
107
- * @param url -
108
- * @returns query key value string pairs from the given URL string.
109
- */
110
84
  function getURLQueries(url) {
111
- let queryString = new URL(url).search;
112
- if (!queryString) {
113
- return {};
114
- }
115
- queryString = queryString.trim();
116
- queryString = queryString.startsWith("?") ? queryString.substring(1) : queryString;
117
- let querySubStrings = queryString.split("&");
118
- querySubStrings = querySubStrings.filter((value) => {
119
- const indexOfEqual = value.indexOf("=");
120
- const lastIndexOfEqual = value.lastIndexOf("=");
121
- return (indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1);
122
- });
123
- const queries = {};
124
- for (const querySubString of querySubStrings) {
125
- const splitResults = querySubString.split("=");
126
- const key = splitResults[0];
127
- const value = splitResults[1];
128
- queries[key] = value;
129
- }
130
- return queries;
85
+ let queryString = new URL(url).search;
86
+ if (!queryString) {
87
+ return {};
88
+ }
89
+ queryString = queryString.trim();
90
+ queryString = queryString.startsWith("?") ? queryString.substring(1) : queryString;
91
+ let querySubStrings = queryString.split("&");
92
+ querySubStrings = querySubStrings.filter((value) => {
93
+ const indexOfEqual = value.indexOf("=");
94
+ const lastIndexOfEqual = value.lastIndexOf("=");
95
+ return indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1;
96
+ });
97
+ const queries = {};
98
+ for (const querySubString of querySubStrings) {
99
+ const splitResults = querySubString.split("=");
100
+ const key = splitResults[0];
101
+ const value = splitResults[1];
102
+ queries[key] = value;
103
+ }
104
+ return queries;
131
105
  }
132
106
  function getProxyUriFromDevConnString(connectionString) {
133
- // Development Connection String
134
- // https://learn.microsoft.com/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key
135
- let proxyUri = "";
136
- if (connectionString.search("DevelopmentStorageProxyUri=") !== -1) {
137
- // CONNECTION_STRING=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri
138
- const matchCredentials = connectionString.split(";");
139
- for (const element of matchCredentials) {
140
- if (element.trim().startsWith("DevelopmentStorageProxyUri=")) {
141
- proxyUri = element.trim().match("DevelopmentStorageProxyUri=(.*)")[1];
142
- }
143
- }
107
+ let proxyUri = "";
108
+ if (connectionString.search("DevelopmentStorageProxyUri=") !== -1) {
109
+ const matchCredentials = connectionString.split(";");
110
+ for (const element of matchCredentials) {
111
+ if (element.trim().startsWith("DevelopmentStorageProxyUri=")) {
112
+ proxyUri = element.trim().match("DevelopmentStorageProxyUri=(.*)")[1];
113
+ }
144
114
  }
145
- return proxyUri;
115
+ }
116
+ return proxyUri;
146
117
  }
147
- /**
148
- *
149
- * @param connectionString - Account connection string.
150
- * @param argument - property to get value from the connection string.
151
- * @returns Value of the property specified in argument.
152
- */
153
118
  function getValueInConnString(connectionString, argument) {
154
- const elements = connectionString.split(";");
155
- for (const element of elements) {
156
- if (element.trim().startsWith(argument)) {
157
- return element.trim().match(argument + "=(.*)")[1];
158
- }
119
+ const elements = connectionString.split(";");
120
+ for (const element of elements) {
121
+ if (element.trim().startsWith(argument)) {
122
+ return element.trim().match(argument + "=(.*)")[1];
159
123
  }
160
- return "";
124
+ }
125
+ return "";
161
126
  }
162
- /**
163
- * Extracts the parts of an Azure Storage account connection string.
164
- *
165
- * @param connectionString - Connection string.
166
- * @returns String key value pairs of the storage account's url and credentials.
167
- */
168
127
  function extractConnectionStringParts(connectionString) {
169
- let proxyUri = "";
170
- if (connectionString.startsWith("UseDevelopmentStorage=true")) {
171
- // Development connection string
172
- proxyUri = getProxyUriFromDevConnString(connectionString);
173
- connectionString = constants_js_1.DevelopmentConnectionString;
128
+ let proxyUri = "";
129
+ if (connectionString.startsWith("UseDevelopmentStorage=true")) {
130
+ proxyUri = getProxyUriFromDevConnString(connectionString);
131
+ connectionString = import_constants.DevelopmentConnectionString;
132
+ }
133
+ let queueEndpoint = getValueInConnString(connectionString, "QueueEndpoint");
134
+ queueEndpoint = queueEndpoint.endsWith("/") ? queueEndpoint.slice(0, -1) : queueEndpoint;
135
+ if (connectionString.search("DefaultEndpointsProtocol=") !== -1 && connectionString.search("AccountKey=") !== -1) {
136
+ let defaultEndpointsProtocol = "";
137
+ let accountName = "";
138
+ let accountKey = Buffer.from("accountKey", "base64");
139
+ let endpointSuffix = "";
140
+ accountName = getValueInConnString(connectionString, "AccountName");
141
+ accountKey = Buffer.from(getValueInConnString(connectionString, "AccountKey"), "base64");
142
+ if (!queueEndpoint) {
143
+ defaultEndpointsProtocol = getValueInConnString(connectionString, "DefaultEndpointsProtocol");
144
+ const protocol = defaultEndpointsProtocol.toLowerCase();
145
+ if (protocol !== "https" && protocol !== "http") {
146
+ throw new Error(
147
+ "Invalid DefaultEndpointsProtocol in the provided Connection String. Expecting 'https' or 'http'"
148
+ );
149
+ }
150
+ endpointSuffix = getValueInConnString(connectionString, "EndpointSuffix");
151
+ if (!endpointSuffix) {
152
+ throw new Error("Invalid EndpointSuffix in the provided Connection String");
153
+ }
154
+ queueEndpoint = `${defaultEndpointsProtocol}://${accountName}.queue.${endpointSuffix}`;
155
+ }
156
+ if (!accountName) {
157
+ throw new Error("Invalid AccountName in the provided Connection String");
158
+ } else if (accountKey.length === 0) {
159
+ throw new Error("Invalid AccountKey in the provided Connection String");
174
160
  }
175
- // Matching QueueEndpoint in the Account connection string
176
- let queueEndpoint = getValueInConnString(connectionString, "QueueEndpoint");
177
- // Slicing off '/' at the end if exists
178
- // (The methods that use `extractConnectionStringParts` expect the url to not have `/` at the end)
179
- queueEndpoint = queueEndpoint.endsWith("/") ? queueEndpoint.slice(0, -1) : queueEndpoint;
180
- if (connectionString.search("DefaultEndpointsProtocol=") !== -1 &&
181
- connectionString.search("AccountKey=") !== -1) {
182
- // Account connection string
183
- let defaultEndpointsProtocol = "";
184
- let accountName = "";
185
- let accountKey = Buffer.from("accountKey", "base64");
186
- let endpointSuffix = "";
187
- // Get account name and key
188
- accountName = getValueInConnString(connectionString, "AccountName");
189
- accountKey = Buffer.from(getValueInConnString(connectionString, "AccountKey"), "base64");
190
- if (!queueEndpoint) {
191
- // QueueEndpoint is not present in the Account connection string
192
- // Can be obtained from `${defaultEndpointsProtocol}://${accountName}.queue.${endpointSuffix}`
193
- defaultEndpointsProtocol = getValueInConnString(connectionString, "DefaultEndpointsProtocol");
194
- const protocol = defaultEndpointsProtocol.toLowerCase();
195
- if (protocol !== "https" && protocol !== "http") {
196
- throw new Error("Invalid DefaultEndpointsProtocol in the provided Connection String. Expecting 'https' or 'http'");
197
- }
198
- endpointSuffix = getValueInConnString(connectionString, "EndpointSuffix");
199
- if (!endpointSuffix) {
200
- throw new Error("Invalid EndpointSuffix in the provided Connection String");
201
- }
202
- queueEndpoint = `${defaultEndpointsProtocol}://${accountName}.queue.${endpointSuffix}`;
203
- }
204
- if (!accountName) {
205
- throw new Error("Invalid AccountName in the provided Connection String");
206
- }
207
- else if (accountKey.length === 0) {
208
- throw new Error("Invalid AccountKey in the provided Connection String");
209
- }
210
- return {
211
- kind: "AccountConnString",
212
- url: queueEndpoint,
213
- accountName,
214
- accountKey,
215
- proxyUri,
216
- };
161
+ return {
162
+ kind: "AccountConnString",
163
+ url: queueEndpoint,
164
+ accountName,
165
+ accountKey,
166
+ proxyUri
167
+ };
168
+ } else {
169
+ const accountSas = getValueInConnString(connectionString, "SharedAccessSignature");
170
+ let accountName = getValueInConnString(connectionString, "AccountName");
171
+ if (!accountName) {
172
+ accountName = getAccountNameFromUrl(queueEndpoint);
217
173
  }
218
- else {
219
- // SAS connection string
220
- const accountSas = getValueInConnString(connectionString, "SharedAccessSignature");
221
- let accountName = getValueInConnString(connectionString, "AccountName");
222
- // if accountName is empty, try to read it from BlobEndpoint
223
- if (!accountName) {
224
- accountName = getAccountNameFromUrl(queueEndpoint);
225
- }
226
- if (!queueEndpoint) {
227
- throw new Error("Invalid QueueEndpoint in the provided SAS Connection String");
228
- }
229
- else if (!accountSas) {
230
- throw new Error("Invalid SharedAccessSignature in the provided SAS Connection String");
231
- }
232
- return { kind: "SASConnString", url: queueEndpoint, accountName, accountSas };
174
+ if (!queueEndpoint) {
175
+ throw new Error("Invalid QueueEndpoint in the provided SAS Connection String");
176
+ } else if (!accountSas) {
177
+ throw new Error("Invalid SharedAccessSignature in the provided SAS Connection String");
233
178
  }
179
+ return { kind: "SASConnString", url: queueEndpoint, accountName, accountSas };
180
+ }
234
181
  }
235
- /**
236
- * Rounds a date off to seconds.
237
- *
238
- * @param date -
239
- * @param withMilliseconds - If true, YYYY-MM-DDThh:mm:ss.fffffffZ will be returned;
240
- * If false, YYYY-MM-DDThh:mm:ssZ will be returned.
241
- * @returns Date string in ISO8061 format, with or without 7 milliseconds component
242
- */
243
182
  function truncatedISO8061Date(date, withMilliseconds = true) {
244
- // Date.toISOString() will return like "2018-10-29T06:34:36.139Z"
245
- const dateString = date.toISOString();
246
- return withMilliseconds
247
- ? dateString.substring(0, dateString.length - 1) + "0000" + "Z"
248
- : dateString.substring(0, dateString.length - 5) + "Z";
183
+ const dateString = date.toISOString();
184
+ return withMilliseconds ? dateString.substring(0, dateString.length - 1) + "0000Z" : dateString.substring(0, dateString.length - 5) + "Z";
249
185
  }
250
- /**
251
- * Delay specified time interval.
252
- *
253
- * @param timeInMs -
254
- * @param aborter -
255
- * @param abortError -
256
- */
257
186
  async function delay(timeInMs, aborter, abortError) {
258
- return new Promise((resolve, reject) => {
259
- /* eslint-disable-next-line prefer-const*/
260
- let timeout;
261
- const abortHandler = () => {
262
- if (timeout !== undefined) {
263
- clearTimeout(timeout);
264
- }
265
- reject(abortError);
266
- };
267
- const resolveHandler = () => {
268
- if (aborter !== undefined) {
269
- aborter.removeEventListener("abort", abortHandler);
270
- }
271
- resolve();
272
- };
273
- timeout = setTimeout(resolveHandler, timeInMs);
274
- if (aborter !== undefined) {
275
- aborter.addEventListener("abort", abortHandler);
276
- }
277
- });
187
+ return new Promise((resolve, reject) => {
188
+ let timeout;
189
+ const abortHandler = () => {
190
+ if (timeout !== void 0) {
191
+ clearTimeout(timeout);
192
+ }
193
+ reject(abortError);
194
+ };
195
+ const resolveHandler = () => {
196
+ if (aborter !== void 0) {
197
+ aborter.removeEventListener("abort", abortHandler);
198
+ }
199
+ resolve();
200
+ };
201
+ timeout = setTimeout(resolveHandler, timeInMs);
202
+ if (aborter !== void 0) {
203
+ aborter.addEventListener("abort", abortHandler);
204
+ }
205
+ });
278
206
  }
279
- /**
280
- * Sanitizes a url by removing the Signature parameter
281
- * @param url - to sanitize
282
- * @returns sanitized string
283
- */
284
207
  function sanitizeURL(url) {
285
- let safeURL = url;
286
- if (getURLParameter(safeURL, constants_js_1.URLConstants.Parameters.SIGNATURE)) {
287
- safeURL = setURLParameter(safeURL, constants_js_1.URLConstants.Parameters.SIGNATURE, "*****");
288
- }
289
- return safeURL;
208
+ let safeURL = url;
209
+ if (getURLParameter(safeURL, import_constants.URLConstants.Parameters.SIGNATURE)) {
210
+ safeURL = setURLParameter(safeURL, import_constants.URLConstants.Parameters.SIGNATURE, "*****");
211
+ }
212
+ return safeURL;
290
213
  }
291
- /**
292
- * Sanitize headers by removing sensitive values such as AUTHORIZATION and X_MS_COPY_SOURCE
293
- * @param originalHeader - original headers
294
- * @returns sanitized headers
295
- */
296
214
  function sanitizeHeaders(originalHeader) {
297
- const headers = (0, core_rest_pipeline_1.createHttpHeaders)();
298
- for (const [name, value] of originalHeader) {
299
- if (name.toLowerCase() === constants_js_1.HeaderConstants.AUTHORIZATION) {
300
- headers.set(name, "*****");
301
- }
302
- else if (name.toLowerCase() === constants_js_1.HeaderConstants.X_MS_COPY_SOURCE) {
303
- headers.set(name, sanitizeURL(value));
304
- }
305
- else {
306
- headers.set(name, value);
307
- }
215
+ const headers = (0, import_core_rest_pipeline.createHttpHeaders)();
216
+ for (const [name, value] of originalHeader) {
217
+ if (name.toLowerCase() === import_constants.HeaderConstants.AUTHORIZATION) {
218
+ headers.set(name, "*****");
219
+ } else if (name.toLowerCase() === import_constants.HeaderConstants.X_MS_COPY_SOURCE) {
220
+ headers.set(name, sanitizeURL(value));
221
+ } else {
222
+ headers.set(name, value);
308
223
  }
309
- return headers;
224
+ }
225
+ return headers;
310
226
  }
311
- /**
312
- * Extracts account name from the url
313
- * @param url - url to extract the account name from
314
- * @returns with the account name
315
- */
316
227
  function getAccountNameFromUrl(url) {
317
- const parsedUrl = new URL(url);
318
- let accountName;
319
- try {
320
- if (parsedUrl.hostname.split(".")[1] === "queue") {
321
- // `${defaultEndpointsProtocol}://${accountName}.queue.${endpointSuffix}`;
322
- accountName = parsedUrl.hostname.split(".")[0];
323
- }
324
- else if (isIpEndpointStyle(parsedUrl)) {
325
- // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/
326
- // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/
327
- // .getPath() -> /devstoreaccount1/
328
- accountName = parsedUrl.pathname.split("/")[1];
329
- }
330
- else {
331
- // Custom domain case: "https://customdomain.com/containername/blob".
332
- accountName = "";
333
- }
334
- return accountName;
335
- }
336
- catch (error) {
337
- throw new Error("Unable to extract accountName with provided information.");
228
+ const parsedUrl = new URL(url);
229
+ let accountName;
230
+ try {
231
+ if (parsedUrl.hostname.split(".")[1] === "queue") {
232
+ accountName = parsedUrl.hostname.split(".")[0];
233
+ } else if (isIpEndpointStyle(parsedUrl)) {
234
+ accountName = parsedUrl.pathname.split("/")[1];
235
+ } else {
236
+ accountName = "";
338
237
  }
238
+ return accountName;
239
+ } catch (error) {
240
+ throw new Error("Unable to extract accountName with provided information.");
241
+ }
339
242
  }
340
243
  function isIpEndpointStyle(parsedUrl) {
341
- const host = parsedUrl.host;
342
- // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'.
343
- // Case 2: localhost(:port) or host.docker.internal, use broad regex to match port part.
344
- // Case 3: Ipv4, use broad regex which just check if host contains Ipv4.
345
- // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.
346
- return (/^.*:.*:.*$|^(localhost|host.docker.internal)(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host) ||
347
- (Boolean(parsedUrl.port) && constants_js_1.PathStylePorts.includes(parsedUrl.port)));
244
+ const host = parsedUrl.host;
245
+ return /^.*:.*:.*$|^(localhost|host.docker.internal)(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(
246
+ host
247
+ ) || Boolean(parsedUrl.port) && import_constants.PathStylePorts.includes(parsedUrl.port);
348
248
  }
349
- /**
350
- * Append a string to URL query.
351
- *
352
- * @param url - Source URL string.
353
- * @param queryParts - String to be appended to the URL query.
354
- * @returns An updated URL string.
355
- */
356
249
  function appendToURLQuery(url, queryParts) {
357
- const urlParsed = new URL(url);
358
- let query = urlParsed.search;
359
- if (query) {
360
- query += "&" + queryParts;
361
- }
362
- else {
363
- query = queryParts;
364
- }
365
- urlParsed.search = query;
366
- return urlParsed.toString();
250
+ const urlParsed = new URL(url);
251
+ let query = urlParsed.search;
252
+ if (query) {
253
+ query += "&" + queryParts;
254
+ } else {
255
+ query = queryParts;
256
+ }
257
+ urlParsed.search = query;
258
+ return urlParsed.toString();
367
259
  }
368
- /**
369
- * A typesafe helper for ensuring that a given response object has
370
- * the original _response attached.
371
- * @param response - A response object from calling a client operation
372
- * @returns The same object, but with known _response property
373
- */
374
260
  function assertResponse(response) {
375
- if (`_response` in response) {
376
- return response;
377
- }
378
- throw new TypeError(`Unexpected response object ${response}`);
261
+ if (`_response` in response) {
262
+ return response;
263
+ }
264
+ throw new TypeError(`Unexpected response object ${response}`);
379
265
  }
380
- //# sourceMappingURL=utils.common.js.map
266
+ // Annotate the CommonJS export names for ESM import in node:
267
+ 0 && (module.exports = {
268
+ appendToURLPath,
269
+ appendToURLQuery,
270
+ assertResponse,
271
+ delay,
272
+ extractConnectionStringParts,
273
+ getAccountNameFromUrl,
274
+ getURLParameter,
275
+ getURLPath,
276
+ getURLQueries,
277
+ getValueInConnString,
278
+ isIpEndpointStyle,
279
+ sanitizeHeaders,
280
+ sanitizeURL,
281
+ setURLHost,
282
+ setURLParameter,
283
+ truncatedISO8061Date
284
+ });