@azure/storage-common 12.4.0 → 12.5.0

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 (85) hide show
  1. package/dist/browser/StorageResponseFormat.d.ts +22 -0
  2. package/dist/browser/StorageResponseFormat.d.ts.map +1 -0
  3. package/dist/browser/StorageResponseFormat.js +20 -0
  4. package/dist/browser/StorageResponseFormat.js.map +1 -0
  5. package/dist/browser/crc64.js +6 -132
  6. package/dist/browser/indexPlatform-browser.d.mts +2 -0
  7. package/dist/browser/indexPlatform-browser.d.mts.map +1 -1
  8. package/dist/browser/indexPlatform-browser.mjs +2 -0
  9. package/dist/browser/indexPlatform-browser.mjs.map +1 -1
  10. package/dist/browser/policies/StorageRedirectRangeHeaderPolicy.d.ts +10 -0
  11. package/dist/browser/policies/StorageRedirectRangeHeaderPolicy.d.ts.map +1 -0
  12. package/dist/browser/policies/StorageRedirectRangeHeaderPolicy.js +22 -0
  13. package/dist/browser/policies/StorageRedirectRangeHeaderPolicy.js.map +1 -0
  14. package/dist/browser/policies/StorageRequestFailureDetailsParserPolicy.d.ts.map +1 -1
  15. package/dist/browser/policies/StorageRequestFailureDetailsParserPolicy.js +12 -0
  16. package/dist/browser/policies/StorageRequestFailureDetailsParserPolicy.js.map +1 -1
  17. package/dist/browser/policies/StorageRetryPolicy.d.ts.map +1 -1
  18. package/dist/browser/policies/StorageRetryPolicy.js +1 -2
  19. package/dist/browser/policies/StorageRetryPolicy.js.map +1 -1
  20. package/dist/browser/utils/constants.js +1 -1
  21. package/dist/browser/utils/constants.js.map +1 -1
  22. package/dist/commonjs/StorageResponseFormat.d.ts +22 -0
  23. package/dist/commonjs/StorageResponseFormat.d.ts.map +1 -0
  24. package/dist/commonjs/StorageResponseFormat.js +41 -0
  25. package/dist/commonjs/StorageResponseFormat.js.map +7 -0
  26. package/dist/commonjs/crc64.js +6 -132
  27. package/dist/commonjs/indexPlatform.d.ts +2 -0
  28. package/dist/commonjs/indexPlatform.d.ts.map +1 -1
  29. package/dist/commonjs/indexPlatform.js +4 -0
  30. package/dist/commonjs/indexPlatform.js.map +2 -2
  31. package/dist/commonjs/policies/StorageRedirectRangeHeaderPolicy.d.ts +10 -0
  32. package/dist/commonjs/policies/StorageRedirectRangeHeaderPolicy.d.ts.map +1 -0
  33. package/dist/commonjs/policies/StorageRedirectRangeHeaderPolicy.js +42 -0
  34. package/dist/commonjs/policies/StorageRedirectRangeHeaderPolicy.js.map +7 -0
  35. package/dist/commonjs/policies/StorageRequestFailureDetailsParserPolicy.d.ts.map +1 -1
  36. package/dist/commonjs/policies/StorageRequestFailureDetailsParserPolicy.js +6 -0
  37. package/dist/commonjs/policies/StorageRequestFailureDetailsParserPolicy.js.map +2 -2
  38. package/dist/commonjs/policies/StorageRetryPolicy.d.ts.map +1 -1
  39. package/dist/commonjs/policies/StorageRetryPolicy.js.map +2 -2
  40. package/dist/commonjs/tsdoc-metadata.json +1 -1
  41. package/dist/commonjs/utils/constants.js +1 -1
  42. package/dist/commonjs/utils/constants.js.map +1 -1
  43. package/dist/esm/StorageResponseFormat.d.ts +22 -0
  44. package/dist/esm/StorageResponseFormat.d.ts.map +1 -0
  45. package/dist/esm/StorageResponseFormat.js +20 -0
  46. package/dist/esm/StorageResponseFormat.js.map +1 -0
  47. package/dist/esm/crc64.js +6 -154
  48. package/dist/esm/indexPlatform.d.ts +2 -0
  49. package/dist/esm/indexPlatform.d.ts.map +1 -1
  50. package/dist/esm/indexPlatform.js +2 -0
  51. package/dist/esm/indexPlatform.js.map +1 -1
  52. package/dist/esm/policies/StorageRedirectRangeHeaderPolicy.d.ts +10 -0
  53. package/dist/esm/policies/StorageRedirectRangeHeaderPolicy.d.ts.map +1 -0
  54. package/dist/esm/policies/StorageRedirectRangeHeaderPolicy.js +22 -0
  55. package/dist/esm/policies/StorageRedirectRangeHeaderPolicy.js.map +1 -0
  56. package/dist/esm/policies/StorageRequestFailureDetailsParserPolicy.d.ts.map +1 -1
  57. package/dist/esm/policies/StorageRequestFailureDetailsParserPolicy.js +12 -0
  58. package/dist/esm/policies/StorageRequestFailureDetailsParserPolicy.js.map +1 -1
  59. package/dist/esm/policies/StorageRetryPolicy.d.ts.map +1 -1
  60. package/dist/esm/policies/StorageRetryPolicy.js +1 -2
  61. package/dist/esm/policies/StorageRetryPolicy.js.map +1 -1
  62. package/dist/esm/utils/constants.js +1 -1
  63. package/dist/esm/utils/constants.js.map +1 -1
  64. package/dist/react-native/StorageResponseFormat.d.ts +22 -0
  65. package/dist/react-native/StorageResponseFormat.d.ts.map +1 -0
  66. package/dist/react-native/StorageResponseFormat.js +20 -0
  67. package/dist/react-native/StorageResponseFormat.js.map +1 -0
  68. package/dist/react-native/crc64.js +6 -132
  69. package/dist/react-native/indexPlatform-browser.d.mts +2 -0
  70. package/dist/react-native/indexPlatform-browser.d.mts.map +1 -1
  71. package/dist/react-native/indexPlatform-browser.mjs +2 -0
  72. package/dist/react-native/indexPlatform-browser.mjs.map +1 -1
  73. package/dist/react-native/policies/StorageRedirectRangeHeaderPolicy.d.ts +10 -0
  74. package/dist/react-native/policies/StorageRedirectRangeHeaderPolicy.d.ts.map +1 -0
  75. package/dist/react-native/policies/StorageRedirectRangeHeaderPolicy.js +22 -0
  76. package/dist/react-native/policies/StorageRedirectRangeHeaderPolicy.js.map +1 -0
  77. package/dist/react-native/policies/StorageRequestFailureDetailsParserPolicy.d.ts.map +1 -1
  78. package/dist/react-native/policies/StorageRequestFailureDetailsParserPolicy.js +12 -0
  79. package/dist/react-native/policies/StorageRequestFailureDetailsParserPolicy.js.map +1 -1
  80. package/dist/react-native/policies/StorageRetryPolicy.d.ts.map +1 -1
  81. package/dist/react-native/policies/StorageRetryPolicy.js +1 -2
  82. package/dist/react-native/policies/StorageRetryPolicy.js.map +1 -1
  83. package/dist/react-native/utils/constants.js +1 -1
  84. package/dist/react-native/utils/constants.js.map +1 -1
  85. package/package.json +9 -9
@@ -1,11 +1,8 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
 
4
- // ESM compatibility block omitted in CommonJS build.
5
-
6
4
  var NativeCRC64 = (() => {
7
5
  var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
8
- if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
9
6
  return (
10
7
  function(NativeCRC64) {
11
8
  NativeCRC64 = NativeCRC64 || {};
@@ -111,50 +108,10 @@ function logExceptionOnExit(e) {
111
108
 
112
109
  if (ENVIRONMENT_IS_NODE) {
113
110
  if (typeof process == 'undefined' || !process.release || process.release.name !== 'node') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
114
- // `require()` is no-op in an ESM module, use `createRequire()` to construct
115
- // the require()` function. This is only necessary for multi-environment
116
- // builds, `-sENVIRONMENT=node` emits a static import declaration instead.
117
- // TODO: Swap all `require()`'s with `import()`'s?
118
- // These modules will usually be used on Node.js. Load them eagerly to avoid
119
- // the complexity of lazy-loading.
120
- var fs = require('fs');
121
- var nodePath = require('path');
122
-
123
- if (ENVIRONMENT_IS_WORKER) {
124
- scriptDirectory = nodePath.dirname(scriptDirectory) + '/';
125
- } else {
126
- scriptDirectory = __dirname + '/';
127
- }
128
-
129
- // include: node_shell_read.js
130
-
131
-
132
- read_ = (filename, binary) => {
133
- // We need to re-wrap `file://` strings to URLs. Normalizing isn't
134
- // necessary in that case, the path should already be absolute.
135
- filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
136
- return fs.readFileSync(filename, binary ? undefined : 'utf8');
137
- };
138
-
139
- readBinary = (filename) => {
140
- var ret = read_(filename, true);
141
- if (!ret.buffer) {
142
- ret = new Uint8Array(ret);
143
- }
144
- assert(ret.buffer);
145
- return ret;
146
- };
147
-
148
- readAsync = (filename, onload, onerror) => {
149
- // See the comment in the `read_` function.
150
- filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
151
- fs.readFile(filename, function(err, data) {
152
- if (err) onerror(err);
153
- else onload(data.buffer);
154
- });
155
- };
156
-
157
- // end include: node_shell_read.js
111
+ // The wasm is base64-embedded (see `binaryInString`) and loaded via `getBinary()`,
112
+ // so the Node fs/path read hooks emitted by Emscripten are never exercised and
113
+ // have been removed. This keeps the file free of Node built-in imports so it can be
114
+ // consumed as-is by web bundlers and by ESM-to-CommonJS bundlers (see issue #39057).
158
115
  if (process['argv'].length > 1) {
159
116
  thisProgram = process['argv'][1].replace(/\\/g, '/');
160
117
  }
@@ -193,26 +150,6 @@ if (ENVIRONMENT_IS_SHELL) {
193
150
 
194
151
  if ((typeof process == 'object' && typeof require === 'function') || typeof window == 'object' || typeof importScripts == 'function') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
195
152
 
196
- if (typeof read != 'undefined') {
197
- read_ = function shell_read(f) {
198
- return read(f);
199
- };
200
- }
201
-
202
- readBinary = function readBinary(f) {
203
- let data;
204
- if (typeof readbuffer == 'function') {
205
- return new Uint8Array(readbuffer(f));
206
- }
207
- data = read(f, 'binary');
208
- assert(typeof data == 'object');
209
- return data;
210
- };
211
-
212
- readAsync = function readAsync(f, onload, onerror) {
213
- setTimeout(() => onload(readBinary(f)), 0);
214
- };
215
-
216
153
  if (typeof scriptArgs != 'undefined') {
217
154
  arguments_ = scriptArgs;
218
155
  } else if (typeof arguments != 'undefined') {
@@ -239,72 +176,9 @@ if (ENVIRONMENT_IS_SHELL) {
239
176
  // Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
240
177
  // ENVIRONMENT_IS_NODE.
241
178
  if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
242
- if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled
243
- scriptDirectory = self.location.href;
244
- } else if (typeof document != 'undefined' && document.currentScript) { // web
245
- scriptDirectory = document.currentScript.src;
246
- }
247
- // When MODULARIZE, this JS may be executed later, after document.currentScript
248
- // is gone, so we saved it, and we use it here instead of any other info.
249
- if (_scriptDir) {
250
- scriptDirectory = _scriptDir;
251
- }
252
- // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.
253
- // otherwise, slice off the final part of the url to find the script directory.
254
- // if scriptDirectory does not contain a slash, lastIndexOf will return -1,
255
- // and scriptDirectory will correctly be replaced with an empty string.
256
- // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),
257
- // they are removed because they could contain a slash.
258
- if (scriptDirectory.indexOf('blob:') !== 0) {
259
- scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf('/')+1);
260
- } else {
261
- scriptDirectory = '';
262
- }
263
-
264
179
  if (!(typeof window == 'object' || typeof importScripts == 'function')) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
265
-
266
- // Differentiate the Web Worker from the Node Worker case, as reading must
267
- // be done differently.
268
- {
269
- // include: web_or_worker_shell_read.js
270
-
271
-
272
- read_ = (url) => {
273
- var xhr = new XMLHttpRequest();
274
- xhr.open('GET', url, false);
275
- xhr.send(null);
276
- return xhr.responseText;
277
- }
278
-
279
- if (ENVIRONMENT_IS_WORKER) {
280
- readBinary = (url) => {
281
- var xhr = new XMLHttpRequest();
282
- xhr.open('GET', url, false);
283
- xhr.responseType = 'arraybuffer';
284
- xhr.send(null);
285
- return new Uint8Array(/** @type{!ArrayBuffer} */(xhr.response));
286
- };
287
- }
288
-
289
- readAsync = (url, onload, onerror) => {
290
- var xhr = new XMLHttpRequest();
291
- xhr.open('GET', url, true);
292
- xhr.responseType = 'arraybuffer';
293
- xhr.onload = () => {
294
- if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
295
- onload(xhr.response);
296
- return;
297
- }
298
- onerror();
299
- };
300
- xhr.onerror = onerror;
301
- xhr.send(null);
302
- }
303
-
304
- // end include: web_or_worker_shell_read.js
305
- }
306
-
307
- setWindowTitle = (title) => document.title = title;
180
+ // The XHR-based read hooks emitted by Emscripten are unused because the wasm is
181
+ // base64-embedded; they have been removed so the file contains no DOM/XHR I/O.
308
182
  } else
309
183
  {
310
184
  throw new Error('environment detection error');
@@ -6,6 +6,7 @@ export * from "./StructuredMessageDecodingStream.js";
6
6
  export * from "./StorageCRC64Calculator.js";
7
7
  export { getCachedDefaultHttpClient } from "./cache.js";
8
8
  export type * from "./interfaces.js";
9
+ export * from "./StorageResponseFormat.js";
9
10
  export * from "./StorageBrowserPolicyFactory.js";
10
11
  export * from "./credentials/AnonymousCredential.js";
11
12
  export * from "./credentials/Credential.js";
@@ -19,6 +20,7 @@ export * from "./policies/StorageCorrectContentLengthPolicy.js";
19
20
  export * from "./policies/StorageRetryPolicyV2.js";
20
21
  export * from "./policies/StorageSharedKeyCredentialPolicy.js";
21
22
  export * from "./policies/StorageSharedKeyCredentialPolicyV2.js";
23
+ export * from "./policies/StorageRedirectRangeHeaderPolicy.js";
22
24
  export * from "./policies/StorageRequestFailureDetailsParserPolicy.js";
23
25
  export * from "./credentials/UserDelegationKeyCredential.js";
24
26
  export type { UserDelegationKey } from "./credentials/UserDelegationKey.js";
@@ -1 +1 @@
1
- {"version":3,"file":"indexPlatform.d.ts","sourceRoot":"","sources":["../../src/indexPlatform.ts"],"names":[],"mappings":"AAGA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AACxD,mBAAmB,sBAAsB,CAAC;AAE1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kDAAkD,CAAC;AAEjE,cAAc,gCAAgC,CAAC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D,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAG5E,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
@@ -30,6 +30,7 @@ __reExport(indexPlatform_exports, require("./StructuredMessageEncodingStream.js"
30
30
  __reExport(indexPlatform_exports, require("./StructuredMessageDecodingStream.js"), module.exports);
31
31
  __reExport(indexPlatform_exports, require("./StorageCRC64Calculator.js"), module.exports);
32
32
  var import_cache = require("./cache.js");
33
+ __reExport(indexPlatform_exports, require("./StorageResponseFormat.js"), module.exports);
33
34
  __reExport(indexPlatform_exports, require("./StorageBrowserPolicyFactory.js"), module.exports);
34
35
  __reExport(indexPlatform_exports, require("./credentials/AnonymousCredential.js"), module.exports);
35
36
  __reExport(indexPlatform_exports, require("./credentials/Credential.js"), module.exports);
@@ -43,6 +44,7 @@ __reExport(indexPlatform_exports, require("./policies/StorageCorrectContentLengt
43
44
  __reExport(indexPlatform_exports, require("./policies/StorageRetryPolicyV2.js"), module.exports);
44
45
  __reExport(indexPlatform_exports, require("./policies/StorageSharedKeyCredentialPolicy.js"), module.exports);
45
46
  __reExport(indexPlatform_exports, require("./policies/StorageSharedKeyCredentialPolicyV2.js"), module.exports);
47
+ __reExport(indexPlatform_exports, require("./policies/StorageRedirectRangeHeaderPolicy.js"), module.exports);
46
48
  __reExport(indexPlatform_exports, require("./policies/StorageRequestFailureDetailsParserPolicy.js"), module.exports);
47
49
  __reExport(indexPlatform_exports, require("./credentials/UserDelegationKeyCredential.js"), module.exports);
48
50
  // Annotate the CommonJS export names for ESM import in node:
@@ -55,6 +57,7 @@ __reExport(indexPlatform_exports, require("./credentials/UserDelegationKeyCreden
55
57
  ...require("./StructuredMessageEncodingStream.js"),
56
58
  ...require("./StructuredMessageDecodingStream.js"),
57
59
  ...require("./StorageCRC64Calculator.js"),
60
+ ...require("./StorageResponseFormat.js"),
58
61
  ...require("./StorageBrowserPolicyFactory.js"),
59
62
  ...require("./credentials/AnonymousCredential.js"),
60
63
  ...require("./credentials/Credential.js"),
@@ -67,6 +70,7 @@ __reExport(indexPlatform_exports, require("./credentials/UserDelegationKeyCreden
67
70
  ...require("./policies/StorageRetryPolicyV2.js"),
68
71
  ...require("./policies/StorageSharedKeyCredentialPolicy.js"),
69
72
  ...require("./policies/StorageSharedKeyCredentialPolicyV2.js"),
73
+ ...require("./policies/StorageRedirectRangeHeaderPolicy.js"),
70
74
  ...require("./policies/StorageRequestFailureDetailsParserPolicy.js"),
71
75
  ...require("./credentials/UserDelegationKeyCredential.js")
72
76
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/indexPlatform.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"#platform/BufferScheduler\";\nexport * from \"#platform/bufferHelpers\";\nexport { createBlobFromData } from \"./bufferHelpers.common.js\";\nexport * from \"#platform/StructuredMessageEncodingStream\";\nexport * from \"#platform/StructuredMessageDecodingStream\";\nexport * from \"./StorageCRC64Calculator.js\";\nexport { getCachedDefaultHttpClient } from \"./cache.js\";\nexport type * from \"#platform/interfaces\";\n\nexport * from \"./StorageBrowserPolicyFactory.js\";\nexport * from \"./credentials/AnonymousCredential.js\";\nexport * from \"./credentials/Credential.js\";\nexport * from \"#platform/credentials/StorageSharedKeyCredential\";\n\nexport * from \"./StorageRetryPolicyFactory.js\";\nexport { BaseRequestPolicy } from \"./policies/RequestPolicy.js\";\nexport * from \"./policies/AnonymousCredentialPolicy.js\";\nexport * from \"./policies/CredentialPolicy.js\";\nexport * from \"#platform/policies/StorageBrowserPolicyV2\";\nexport * from \"#platform/policies/StorageCorrectContentLengthPolicy\";\nexport * from \"./policies/StorageRetryPolicyV2.js\";\nexport * from \"./policies/StorageSharedKeyCredentialPolicy.js\";\nexport * from \"#platform/policies/StorageSharedKeyCredentialPolicyV2\";\nexport * from \"#platform/policies/StorageRequestFailureDetailsParserPolicy\";\nexport * from \"#platform/credentials/UserDelegationKeyCredential\";\nexport type { UserDelegationKey } from \"./credentials/UserDelegationKey.js\";\n\n// Re-export Readable stream type for Node.js (never in browser/react-native)\nexport type { Readable } from \"node:stream\";\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kCAAc,sCAHd;AAIA,kCAAc,oCAJd;AAKA,kCAAmC;AACnC,kCAAc,sDANd;AAOA,kCAAc,sDAPd;AAQA,kCAAc,wCARd;AASA,mBAA2C;AAG3C,kCAAc,6CAZd;AAaA,kCAAc,iDAbd;AAcA,kCAAc,wCAdd;AAeA,kCAAc,6DAfd;AAiBA,kCAAc,2CAjBd;AAkBA,2BAAkC;AAClC,kCAAc,oDAnBd;AAoBA,kCAAc,2CApBd;AAqBA,kCAAc,sDArBd;AAsBA,kCAAc,iEAtBd;AAuBA,kCAAc,+CAvBd;AAwBA,kCAAc,2DAxBd;AAyBA,kCAAc,kEAzBd;AA0BA,kCAAc,wEA1Bd;AA2BA,kCAAc,8DA3Bd;",
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from \"#platform/BufferScheduler\";\nexport * from \"#platform/bufferHelpers\";\nexport { createBlobFromData } from \"./bufferHelpers.common.js\";\nexport * from \"#platform/StructuredMessageEncodingStream\";\nexport * from \"#platform/StructuredMessageDecodingStream\";\nexport * from \"./StorageCRC64Calculator.js\";\nexport { getCachedDefaultHttpClient } from \"./cache.js\";\nexport type * from \"#platform/interfaces\";\nexport * from \"./StorageResponseFormat.js\";\n\nexport * from \"./StorageBrowserPolicyFactory.js\";\nexport * from \"./credentials/AnonymousCredential.js\";\nexport * from \"./credentials/Credential.js\";\nexport * from \"#platform/credentials/StorageSharedKeyCredential\";\n\nexport * from \"./StorageRetryPolicyFactory.js\";\nexport { BaseRequestPolicy } from \"./policies/RequestPolicy.js\";\nexport * from \"./policies/AnonymousCredentialPolicy.js\";\nexport * from \"./policies/CredentialPolicy.js\";\nexport * from \"#platform/policies/StorageBrowserPolicyV2\";\nexport * from \"#platform/policies/StorageCorrectContentLengthPolicy\";\nexport * from \"./policies/StorageRetryPolicyV2.js\";\nexport * from \"./policies/StorageSharedKeyCredentialPolicy.js\";\nexport * from \"#platform/policies/StorageSharedKeyCredentialPolicyV2\";\nexport * from \"./policies/StorageRedirectRangeHeaderPolicy.js\";\nexport * from \"./policies/StorageRequestFailureDetailsParserPolicy.js\";\nexport * from \"#platform/credentials/UserDelegationKeyCredential\";\nexport type { UserDelegationKey } from \"./credentials/UserDelegationKey.js\";\n\n// Re-export Readable stream type for Node.js (never in browser/react-native)\nexport type { Readable } from \"node:stream\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kCAAc,sCAHd;AAIA,kCAAc,oCAJd;AAKA,kCAAmC;AACnC,kCAAc,sDANd;AAOA,kCAAc,sDAPd;AAQA,kCAAc,wCARd;AASA,mBAA2C;AAE3C,kCAAc,uCAXd;AAaA,kCAAc,6CAbd;AAcA,kCAAc,iDAdd;AAeA,kCAAc,wCAfd;AAgBA,kCAAc,6DAhBd;AAkBA,kCAAc,2CAlBd;AAmBA,2BAAkC;AAClC,kCAAc,oDApBd;AAqBA,kCAAc,2CArBd;AAsBA,kCAAc,sDAtBd;AAuBA,kCAAc,iEAvBd;AAwBA,kCAAc,+CAxBd;AAyBA,kCAAc,2DAzBd;AA0BA,kCAAc,kEA1Bd;AA2BA,kCAAc,2DA3Bd;AA4BA,kCAAc,mEA5Bd;AA6BA,kCAAc,8DA7Bd;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,10 @@
1
+ import type { PipelinePolicy } from "@azure/core-rest-pipeline";
2
+ /**
3
+ * Redirects the "range" header to "x-ms-range" for Azure Storage requests as the latter is preferred.
4
+ */
5
+ export declare const storageRedirectRangeHeaderPolicyName = "storageRedirectRangeHeaderPolicy";
6
+ /**
7
+ * StorageRedirectRangeHeaderPolicy
8
+ */
9
+ export declare function storageRedirectRangeHeaderPolicy(): PipelinePolicy;
10
+ //# sourceMappingURL=StorageRedirectRangeHeaderPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageRedirectRangeHeaderPolicy.d.ts","sourceRoot":"","sources":["../../../src/policies/StorageRedirectRangeHeaderPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,oCAAoC,qCAAqC,CAAC;AAEvF;;GAEG;AACH,wBAAgB,gCAAgC,IAAI,cAAc,CAWjE"}
@@ -0,0 +1,42 @@
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 StorageRedirectRangeHeaderPolicy_exports = {};
19
+ __export(StorageRedirectRangeHeaderPolicy_exports, {
20
+ storageRedirectRangeHeaderPolicy: () => storageRedirectRangeHeaderPolicy,
21
+ storageRedirectRangeHeaderPolicyName: () => storageRedirectRangeHeaderPolicyName
22
+ });
23
+ module.exports = __toCommonJS(StorageRedirectRangeHeaderPolicy_exports);
24
+ const storageRedirectRangeHeaderPolicyName = "storageRedirectRangeHeaderPolicy";
25
+ function storageRedirectRangeHeaderPolicy() {
26
+ return {
27
+ name: storageRedirectRangeHeaderPolicyName,
28
+ async sendRequest(request, next) {
29
+ if (request.headers.has("range")) {
30
+ request.headers.set("x-ms-range", request.headers.get("range"));
31
+ request.headers.delete("range");
32
+ }
33
+ return next(request);
34
+ }
35
+ };
36
+ }
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ storageRedirectRangeHeaderPolicy,
40
+ storageRedirectRangeHeaderPolicyName
41
+ });
42
+ //# sourceMappingURL=StorageRedirectRangeHeaderPolicy.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/policies/StorageRedirectRangeHeaderPolicy.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\n\n/**\n * Redirects the \"range\" header to \"x-ms-range\" for Azure Storage requests as the latter is preferred.\n */\nexport const storageRedirectRangeHeaderPolicyName = \"storageRedirectRangeHeaderPolicy\";\n\n/**\n * StorageRedirectRangeHeaderPolicy\n */\nexport function storageRedirectRangeHeaderPolicy(): PipelinePolicy {\n return {\n name: storageRedirectRangeHeaderPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (request.headers.has(\"range\")) {\n request.headers.set(\"x-ms-range\", request.headers.get(\"range\")!);\n request.headers.delete(\"range\");\n }\n return next(request);\n },\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,MAAM,uCAAuC;AAK7C,SAAS,mCAAmD;AACjE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,UAAI,QAAQ,QAAQ,IAAI,OAAO,GAAG;AAChC,gBAAQ,QAAQ,IAAI,cAAc,QAAQ,QAAQ,IAAI,OAAO,CAAE;AAC/D,gBAAQ,QAAQ,OAAO,OAAO;AAAA,MAChC;AACA,aAAO,KAAK,OAAO;AAAA,IACrB;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"StorageRequestFailureDetailsParserPolicy.d.ts","sourceRoot":"","sources":["../../../src/policies/StorageRequestFailureDetailsParserPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,4CAA4C,6CACb,CAAC;AAE7C;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,cAAc,CA0BzE"}
1
+ {"version":3,"file":"StorageRequestFailureDetailsParserPolicy.d.ts","sourceRoot":"","sources":["../../../src/policies/StorageRequestFailureDetailsParserPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,4CAA4C,6CACb,CAAC;AAE7C;;GAEG;AACH,wBAAgB,wCAAwC,IAAI,cAAc,CA2CzE"}
@@ -28,6 +28,12 @@ function storageRequestFailureDetailsParserPolicy() {
28
28
  async sendRequest(request, next) {
29
29
  try {
30
30
  const response = await next(request);
31
+ if (response.status === 400 && response.bodyAsText?.includes("<Error><Code>InvalidHeaderValue</Code>") && response.bodyAsText.includes("<HeaderName>x-ms-version</HeaderName>")) {
32
+ response.bodyAsText = response.bodyAsText.replace(
33
+ /<Message>.*<\/Message>/s,
34
+ "<Message>The provided service version is not enabled on this storage account. Please see https://learn.microsoft.com/rest/api/storageservices/versioning-for-the-azure-storage-services for additional information.</Message>"
35
+ );
36
+ }
31
37
  return response;
32
38
  } catch (err) {
33
39
  if (typeof err === "object" && err !== null && err.response && err.response.parsedBody) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/policies/StorageRequestFailureDetailsParserPolicy.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\n\n/**\n * The programmatic identifier of the StorageRequestFailureDetailsParserPolicy.\n */\nexport const storageRequestFailureDetailsParserPolicyName =\n \"storageRequestFailureDetailsParserPolicy\";\n\n/**\n * StorageRequestFailureDetailsParserPolicy\n */\nexport function storageRequestFailureDetailsParserPolicy(): PipelinePolicy {\n return {\n name: storageRequestFailureDetailsParserPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n try {\n const response = await next(request);\n return response;\n } catch (err) {\n if (\n typeof err === \"object\" &&\n err !== null &&\n (err as any).response &&\n (err as any).response.parsedBody\n ) {\n if (\n (err as any).response.parsedBody.code === \"InvalidHeaderValue\" &&\n (err as any).response.parsedBody.HeaderName === \"x-ms-version\"\n ) {\n (err as any).message =\n \"The provided service version is not enabled on this storage account. Please see https://learn.microsoft.com/rest/api/storageservices/versioning-for-the-azure-storage-services for additional information.\\n\";\n }\n }\n throw err;\n }\n },\n };\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,MAAM,+CACX;AAKK,SAAS,2CAA2D;AACzE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,OAAO;AACnC,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,YACE,OAAO,QAAQ,YACf,QAAQ,QACP,IAAY,YACZ,IAAY,SAAS,YACtB;AACA,cACG,IAAY,SAAS,WAAW,SAAS,wBACzC,IAAY,SAAS,WAAW,eAAe,gBAChD;AACA,YAAC,IAAY,UACX;AAAA,UACJ;AAAA,QACF;AACA,cAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\n\n/**\n * The programmatic identifier of the StorageRequestFailureDetailsParserPolicy.\n */\nexport const storageRequestFailureDetailsParserPolicyName =\n \"storageRequestFailureDetailsParserPolicy\";\n\n/**\n * StorageRequestFailureDetailsParserPolicy\n */\nexport function storageRequestFailureDetailsParserPolicy(): PipelinePolicy {\n return {\n name: storageRequestFailureDetailsParserPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n try {\n const response = await next(request);\n if (\n response.status === 400 &&\n response.bodyAsText?.includes(\"<Error><Code>InvalidHeaderValue</Code>\") &&\n response.bodyAsText.includes(\"<HeaderName>x-ms-version</HeaderName>\")\n ) {\n // replace the error message with a more user-friendly one that includes a link to documentation\n /* example response text:\n `<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Error><Code>InvalidHeaderValue</Code><Message>The value for one of the HTTP headers is not in the correct format.\nRequestId:e5ea566c-101e-001c-1ec4-acf180000000\nTime:2026-03-05T17:24:34.6688015Z</Message><HeaderName>x-ms-version</HeaderName><HeaderValue>3025-01-01</HeaderValue></Error>`\n */\n response.bodyAsText = response.bodyAsText.replace(\n /<Message>.*<\\/Message>/s,\n \"<Message>The provided service version is not enabled on this storage account. Please see https://learn.microsoft.com/rest/api/storageservices/versioning-for-the-azure-storage-services for additional information.</Message>\",\n );\n }\n return response;\n } catch (err) {\n if (\n typeof err === \"object\" &&\n err !== null &&\n (err as any).response &&\n (err as any).response.parsedBody\n ) {\n if (\n (err as any).response.parsedBody.code === \"InvalidHeaderValue\" &&\n (err as any).response.parsedBody.HeaderName === \"x-ms-version\"\n ) {\n (err as any).message =\n \"The provided service version is not enabled on this storage account. Please see https://learn.microsoft.com/rest/api/storageservices/versioning-for-the-azure-storage-services for additional information.\\n\";\n }\n }\n throw err;\n }\n },\n };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,MAAM,+CACX;AAKK,SAAS,2CAA2D;AACzE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,YAAY,SAA0B,MAA8C;AACxF,UAAI;AACF,cAAM,WAAW,MAAM,KAAK,OAAO;AACnC,YACE,SAAS,WAAW,OACpB,SAAS,YAAY,SAAS,wCAAwC,KACtE,SAAS,WAAW,SAAS,uCAAuC,GACpE;AAQA,mBAAS,aAAa,SAAS,WAAW;AAAA,YACxC;AAAA,YACA;AAAA,UACF;AAAA,QACF;AACA,eAAO;AAAA,MACT,SAAS,KAAK;AACZ,YACE,OAAO,QAAQ,YACf,QAAQ,QACP,IAAY,YACZ,IAAY,SAAS,YACtB;AACA,cACG,IAAY,SAAS,WAAW,SAAS,wBACzC,IAAY,SAAS,WAAW,eAAe,gBAChD;AACA,YAAC,IAAY,UACX;AAAA,UACJ;AAAA,QACF;AACA,cAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StorageRetryPolicy.d.ts","sourceRoot":"","sources":["../../../src/policies/StorageRetryPolicy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,IAAI,oBAAoB,EAChD,oBAAoB,EACpB,eAAe,IAAI,WAAW,EAC9B,cAAc,IAAI,qBAAqB,EACxC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAM3E;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,CAAC,EAAE,mBAAmB,GAAG,oBAAoB,CAM9F;AAcD;;GAEG;AACH,qBAAa,kBAAmB,SAAQ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AU,EAAE,aAAa,EACzB,OAAO,EAAE,oBAAoB,EAC7B,YAAY,GAAE,mBAA2C;IAyC3D;;;;OAIG;IACU,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI9E;;;;;;;;;OASG;cACa,kBAAkB,CAChC,OAAO,EAAE,WAAW,EACpB,eAAe,EAAE,OAAO,EACxB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,qBAAqB,CAAC;IA0CjC;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,CACnB,cAAc,EAAE,OAAO,EACvB,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,qBAAqB,EAChC,GAAG,CAAC,EAAE,SAAS,GACd,OAAO;IA8EV;;;;;;OAMG;YACW,KAAK;CA0BpB"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/policies/StorageRetryPolicy.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport { AbortError } from \"@azure/abort-controller\";\nimport type {\n RequestPolicy,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n RequestPolicyFactory,\n WebResourceLike as WebResource,\n CompatResponse as HttpOperationResponse,\n} from \"@azure/core-http-compat\";\nimport { BaseRequestPolicy } from \"./RequestPolicy.js\";\nimport type { RestError } from \"@azure/core-rest-pipeline\";\n\nimport type { StorageRetryOptions } from \"../StorageRetryPolicyFactory.js\";\nimport { HeaderConstants, URLConstants } from \"../utils/constants.js\";\nimport { delay, setURLHost, setURLParameter } from \"../utils/utils.common.js\";\nimport { logger } from \"../log.js\";\nimport { StorageRetryPolicyType } from \"./StorageRetryPolicyType.js\";\n\n/**\n * A factory method used to generated a RetryPolicy factory.\n *\n * @param retryOptions -\n */\nexport function NewRetryPolicyFactory(retryOptions?: StorageRetryOptions): RequestPolicyFactory {\n return {\n create: (nextPolicy: RequestPolicy, options: RequestPolicyOptions): StorageRetryPolicy => {\n return new StorageRetryPolicy(nextPolicy, options, retryOptions);\n },\n };\n}\n\n// Default values of StorageRetryOptions\nconst DEFAULT_RETRY_OPTIONS: StorageRetryOptions = {\n maxRetryDelayInMs: 120 * 1000,\n maxTries: 4,\n retryDelayInMs: 4 * 1000,\n retryPolicyType: StorageRetryPolicyType.EXPONENTIAL,\n secondaryHost: \"\",\n tryTimeoutInMs: undefined, // Use server side default timeout strategy\n};\n\nconst RETRY_ABORT_ERROR = new AbortError(\"The operation was aborted.\");\n\n/**\n * Retry policy with exponential retry and linear retry implemented.\n */\nexport class StorageRetryPolicy extends BaseRequestPolicy {\n /**\n * RetryOptions.\n */\n private readonly retryOptions: StorageRetryOptions;\n\n /**\n * Creates an instance of RetryPolicy.\n *\n * @param nextPolicy -\n * @param options -\n * @param retryOptions -\n */\n constructor(\n nextPolicy: RequestPolicy,\n options: RequestPolicyOptions,\n retryOptions: StorageRetryOptions = DEFAULT_RETRY_OPTIONS,\n ) {\n super(nextPolicy, options);\n\n // Initialize retry options\n this.retryOptions = {\n retryPolicyType: retryOptions.retryPolicyType\n ? retryOptions.retryPolicyType\n : DEFAULT_RETRY_OPTIONS.retryPolicyType,\n\n maxTries:\n retryOptions.maxTries && retryOptions.maxTries >= 1\n ? Math.floor(retryOptions.maxTries)\n : DEFAULT_RETRY_OPTIONS.maxTries,\n\n tryTimeoutInMs:\n retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0\n ? retryOptions.tryTimeoutInMs\n : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs,\n\n retryDelayInMs:\n retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0\n ? Math.min(\n retryOptions.retryDelayInMs,\n retryOptions.maxRetryDelayInMs\n ? retryOptions.maxRetryDelayInMs\n : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs!,\n )\n : DEFAULT_RETRY_OPTIONS.retryDelayInMs,\n\n maxRetryDelayInMs:\n retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0\n ? retryOptions.maxRetryDelayInMs\n : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs,\n\n secondaryHost: retryOptions.secondaryHost\n ? retryOptions.secondaryHost\n : DEFAULT_RETRY_OPTIONS.secondaryHost,\n };\n }\n\n /**\n * Sends request.\n *\n * @param request -\n */\n public async sendRequest(request: WebResource): Promise<HttpOperationResponse> {\n return this.attemptSendRequest(request, false, 1);\n }\n\n /**\n * Decide and perform next retry. Won't mutate request parameter.\n *\n * @param request -\n * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then\n * the resource was not found. This may be due to replication delay. So, in this\n * case, we'll never try the secondary again for this operation.\n * @param attempt - How many retries has been attempted to performed, starting from 1, which includes\n * the attempt will be performed by this method call.\n */\n protected async attemptSendRequest(\n request: WebResource,\n secondaryHas404: boolean,\n attempt: number,\n ): Promise<HttpOperationResponse> {\n const newRequest: WebResource = request.clone();\n\n const isPrimaryRetry =\n secondaryHas404 ||\n !this.retryOptions.secondaryHost ||\n !(request.method === \"GET\" || request.method === \"HEAD\" || request.method === \"OPTIONS\") ||\n attempt % 2 === 1;\n\n if (!isPrimaryRetry) {\n newRequest.url = setURLHost(newRequest.url, this.retryOptions.secondaryHost!);\n }\n\n // Set the server-side timeout query parameter \"timeout=[seconds]\"\n if (this.retryOptions.tryTimeoutInMs) {\n newRequest.url = setURLParameter(\n newRequest.url,\n URLConstants.Parameters.TIMEOUT,\n Math.floor(this.retryOptions.tryTimeoutInMs! / 1000).toString(),\n );\n }\n\n let response: HttpOperationResponse | undefined;\n try {\n logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? \"Primary\" : \"Secondary\"}`);\n response = await this._nextPolicy.sendRequest(newRequest);\n if (!this.shouldRetry(isPrimaryRetry, attempt, response)) {\n return response;\n }\n\n secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404);\n } catch (err: any) {\n logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`);\n if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) {\n throw err;\n }\n }\n\n await this.delay(isPrimaryRetry, attempt, request.abortSignal);\n return this.attemptSendRequest(request, secondaryHas404, ++attempt);\n }\n\n /**\n * Decide whether to retry according to last HTTP response and retry counters.\n *\n * @param isPrimaryRetry -\n * @param attempt -\n * @param response -\n * @param err -\n */\n protected shouldRetry(\n isPrimaryRetry: boolean,\n attempt: number,\n response?: HttpOperationResponse,\n err?: RestError,\n ): boolean {\n if (attempt >= this.retryOptions.maxTries!) {\n logger.info(\n `RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions\n .maxTries!}, no further try.`,\n );\n return false;\n }\n\n // Handle network failures, you may need to customize the list when you implement\n // your own http client\n const retriableErrors = [\n \"ETIMEDOUT\",\n \"ESOCKETTIMEDOUT\",\n \"ECONNREFUSED\",\n \"ECONNRESET\",\n \"ENOENT\",\n \"ENOTFOUND\",\n \"TIMEOUT\",\n \"EPIPE\",\n \"REQUEST_SEND_ERROR\", // For default xhr based http client provided in ms-rest-js\n ];\n if (err) {\n for (const retriableError of retriableErrors) {\n if (\n err.name.toUpperCase().includes(retriableError) ||\n err.message.toUpperCase().includes(retriableError) ||\n (err.code && err.code.toString().toUpperCase() === retriableError)\n ) {\n logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`);\n return true;\n }\n }\n }\n\n // If attempt was against the secondary & it returned a StatusNotFound (404), then\n // the resource was not found. This may be due to replication delay. So, in this\n // case, we'll never try the secondary again for this operation.\n if (response || err) {\n const statusCode = response ? response.status : err ? err.statusCode : 0;\n if (!isPrimaryRetry && statusCode === 404) {\n logger.info(`RetryPolicy: Secondary access with 404, will retry.`);\n return true;\n }\n\n // Server internal error or server timeout\n if (statusCode === 503 || statusCode === 500) {\n logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`);\n return true;\n }\n }\n\n if (response) {\n // Retry select Copy Source Error Codes.\n if (response?.status >= 400) {\n const copySourceError = response.headers.get(HeaderConstants.X_MS_CopySourceErrorCode);\n if (copySourceError !== undefined) {\n switch (copySourceError) {\n case \"InternalError\":\n case \"OperationTimedOut\":\n case \"ServerBusy\":\n return true;\n }\n }\n }\n }\n\n if (err?.code === \"PARSE_ERROR\" && err?.message.startsWith(`Error \"Error: Unclosed root tag`)) {\n logger.info(\n \"RetryPolicy: Incomplete XML response likely due to service timeout, will retry.\",\n );\n return true;\n }\n\n return false;\n }\n\n /**\n * Delay a calculated time between retries.\n *\n * @param isPrimaryRetry -\n * @param attempt -\n * @param abortSignal -\n */\n private async delay(\n isPrimaryRetry: boolean,\n attempt: number,\n abortSignal?: AbortSignalLike,\n ): Promise<void> {\n let delayTimeInMs: number = 0;\n\n if (isPrimaryRetry) {\n switch (this.retryOptions.retryPolicyType) {\n case StorageRetryPolicyType.EXPONENTIAL:\n delayTimeInMs = Math.min(\n (Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs!,\n this.retryOptions.maxRetryDelayInMs!,\n );\n break;\n case StorageRetryPolicyType.FIXED:\n delayTimeInMs = this.retryOptions.retryDelayInMs!;\n break;\n }\n } else {\n delayTimeInMs = Math.random() * 1000;\n }\n\n logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`);\n return delay(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR);\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,8BAA2B;AAQ3B,2BAAkC;AAIlC,uBAA8C;AAC9C,0BAAmD;AACnD,iBAAuB;AACvB,oCAAuC;AAOhC,SAAS,sBAAsB,cAA0D;AAC9F,SAAO;AAAA,IACL,QAAQ,CAAC,YAA2B,YAAsD;AACxF,aAAO,IAAI,mBAAmB,YAAY,SAAS,YAAY;AAAA,IACjE;AAAA,EACF;AACF;AAGA,MAAM,wBAA6C;AAAA,EACjD,mBAAmB,MAAM;AAAA,EACzB,UAAU;AAAA,E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AAA,UACpB;AACA;AAAA,QACF,KAAK,qDAAuB;AAC1B,0BAAgB,KAAK,aAAa;AAClC;AAAA,MACJ;AAAA,IACF,OAAO;AACL,sBAAgB,KAAK,OAAO,IAAI;AAAA,IAClC;AAEA,sBAAO,KAAK,0BAA0B,aAAa,IAAI;AACvD,eAAO,2BAAM,eAAe,aAAa,iBAAiB;AAAA,EAC5D;AACF;",
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport { AbortError } from \"@azure/abort-controller\";\nimport type {\n RequestPolicy,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n RequestPolicyFactory,\n WebResourceLike as WebResource,\n CompatResponse as HttpOperationResponse,\n} from \"@azure/core-http-compat\";\nimport { BaseRequestPolicy } from \"./RequestPolicy.js\";\nimport type { RestError } from \"@azure/core-rest-pipeline\";\n\nimport type { StorageRetryOptions } from \"../StorageRetryPolicyFactory.js\";\nimport { HeaderConstants, URLConstants } from \"../utils/constants.js\";\nimport { delay, setURLHost, setURLParameter } from \"../utils/utils.common.js\";\nimport { logger } from \"../log.js\";\nimport { StorageRetryPolicyType } from \"./StorageRetryPolicyType.js\";\n\n/**\n * A factory method used to generated a RetryPolicy factory.\n *\n * @param retryOptions -\n */\nexport function NewRetryPolicyFactory(retryOptions?: StorageRetryOptions): RequestPolicyFactory {\n return {\n create: (nextPolicy: RequestPolicy, options: RequestPolicyOptions): StorageRetryPolicy => {\n return new StorageRetryPolicy(nextPolicy, options, retryOptions);\n },\n };\n}\n\n// Default values of StorageRetryOptions\nconst DEFAULT_RETRY_OPTIONS: StorageRetryOptions = {\n maxRetryDelayInMs: 120 * 1000,\n maxTries: 4,\n retryDelayInMs: 4 * 1000,\n retryPolicyType: StorageRetryPolicyType.EXPONENTIAL,\n secondaryHost: \"\",\n tryTimeoutInMs: undefined, // Use server side default timeout strategy\n};\n\nconst RETRY_ABORT_ERROR = new AbortError(\"The operation was aborted.\");\n\n/**\n * Retry policy with exponential retry and linear retry implemented.\n */\nexport class StorageRetryPolicy extends BaseRequestPolicy {\n /**\n * RetryOptions.\n */\n private readonly retryOptions: StorageRetryOptions;\n\n /**\n * Creates an instance of RetryPolicy.\n *\n * @param nextPolicy -\n * @param options -\n * @param retryOptions -\n */\n constructor(\n nextPolicy: RequestPolicy,\n options: RequestPolicyOptions,\n retryOptions: StorageRetryOptions = DEFAULT_RETRY_OPTIONS,\n ) {\n super(nextPolicy, options);\n\n // Initialize retry options\n this.retryOptions = {\n retryPolicyType: retryOptions.retryPolicyType\n ? retryOptions.retryPolicyType\n : DEFAULT_RETRY_OPTIONS.retryPolicyType,\n\n maxTries:\n retryOptions.maxTries && retryOptions.maxTries >= 1\n ? Math.floor(retryOptions.maxTries)\n : DEFAULT_RETRY_OPTIONS.maxTries,\n\n tryTimeoutInMs:\n retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0\n ? retryOptions.tryTimeoutInMs\n : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs,\n\n retryDelayInMs:\n retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0\n ? Math.min(\n retryOptions.retryDelayInMs,\n retryOptions.maxRetryDelayInMs\n ? retryOptions.maxRetryDelayInMs\n : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs!,\n )\n : DEFAULT_RETRY_OPTIONS.retryDelayInMs,\n\n maxRetryDelayInMs:\n retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0\n ? retryOptions.maxRetryDelayInMs\n : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs,\n\n secondaryHost: retryOptions.secondaryHost\n ? retryOptions.secondaryHost\n : DEFAULT_RETRY_OPTIONS.secondaryHost,\n };\n }\n\n /**\n * Sends request.\n *\n * @param request -\n */\n public async sendRequest(request: WebResource): Promise<HttpOperationResponse> {\n return this.attemptSendRequest(request, false, 1);\n }\n\n /**\n * Decide and perform next retry. Won't mutate request parameter.\n *\n * @param request -\n * @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then\n * the resource was not found. This may be due to replication delay. So, in this\n * case, we'll never try the secondary again for this operation.\n * @param attempt - How many retries has been attempted to performed, starting from 1, which includes\n * the attempt will be performed by this method call.\n */\n protected async attemptSendRequest(\n request: WebResource,\n secondaryHas404: boolean,\n attempt: number,\n ): Promise<HttpOperationResponse> {\n const newRequest: WebResource = request.clone();\n\n const isPrimaryRetry =\n secondaryHas404 ||\n !this.retryOptions.secondaryHost ||\n !(request.method === \"GET\" || request.method === \"HEAD\" || request.method === \"OPTIONS\") ||\n attempt % 2 === 1;\n\n if (!isPrimaryRetry) {\n newRequest.url = setURLHost(newRequest.url, this.retryOptions.secondaryHost!);\n }\n\n // Set the server-side timeout query parameter \"timeout=[seconds]\"\n if (this.retryOptions.tryTimeoutInMs) {\n newRequest.url = setURLParameter(\n newRequest.url,\n URLConstants.Parameters.TIMEOUT,\n Math.floor(this.retryOptions.tryTimeoutInMs! / 1000).toString(),\n );\n }\n\n let response: HttpOperationResponse | undefined;\n try {\n logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? \"Primary\" : \"Secondary\"}`);\n response = await this._nextPolicy.sendRequest(newRequest);\n if (!this.shouldRetry(isPrimaryRetry, attempt, response)) {\n return response;\n }\n\n secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404);\n } catch (err: any) {\n logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`);\n if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) {\n throw err;\n }\n }\n\n await this.delay(isPrimaryRetry, attempt, request.abortSignal);\n return this.attemptSendRequest(request, secondaryHas404, ++attempt);\n }\n\n /**\n * Decide whether to retry according to last HTTP response and retry counters.\n *\n * @param isPrimaryRetry -\n * @param attempt -\n * @param response -\n * @param err -\n */\n protected shouldRetry(\n isPrimaryRetry: boolean,\n attempt: number,\n response?: HttpOperationResponse,\n err?: RestError,\n ): boolean {\n if (attempt >= this.retryOptions.maxTries!) {\n logger.info(\n `RetryPolicy: Attempt(s) ${attempt} >= maxTries ${\n this.retryOptions.maxTries!\n }, no further try.`,\n );\n return false;\n }\n\n // Handle network failures, you may need to customize the list when you implement\n // your own http client\n const retriableErrors = [\n \"ETIMEDOUT\",\n \"ESOCKETTIMEDOUT\",\n \"ECONNREFUSED\",\n \"ECONNRESET\",\n \"ENOENT\",\n \"ENOTFOUND\",\n \"TIMEOUT\",\n \"EPIPE\",\n \"REQUEST_SEND_ERROR\", // For default xhr based http client provided in ms-rest-js\n ];\n if (err) {\n for (const retriableError of retriableErrors) {\n if (\n err.name.toUpperCase().includes(retriableError) ||\n err.message.toUpperCase().includes(retriableError) ||\n (err.code && err.code.toString().toUpperCase() === retriableError)\n ) {\n logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`);\n return true;\n }\n }\n }\n\n // If attempt was against the secondary & it returned a StatusNotFound (404), then\n // the resource was not found. This may be due to replication delay. So, in this\n // case, we'll never try the secondary again for this operation.\n if (response || err) {\n const statusCode = response ? response.status : err ? err.statusCode : 0;\n if (!isPrimaryRetry && statusCode === 404) {\n logger.info(`RetryPolicy: Secondary access with 404, will retry.`);\n return true;\n }\n\n // Server internal error or server timeout\n if (statusCode === 503 || statusCode === 500) {\n logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`);\n return true;\n }\n }\n\n if (response) {\n // Retry select Copy Source Error Codes.\n if (response?.status >= 400) {\n const copySourceError = response.headers.get(HeaderConstants.X_MS_CopySourceErrorCode);\n if (copySourceError !== undefined) {\n switch (copySourceError) {\n case \"InternalError\":\n case \"OperationTimedOut\":\n case \"ServerBusy\":\n return true;\n }\n }\n }\n }\n\n if (err?.code === \"PARSE_ERROR\" && err?.message.startsWith(`Error \"Error: Unclosed root tag`)) {\n logger.info(\n \"RetryPolicy: Incomplete XML response likely due to service timeout, will retry.\",\n );\n return true;\n }\n\n return false;\n }\n\n /**\n * Delay a calculated time between retries.\n *\n * @param isPrimaryRetry -\n * @param attempt -\n * @param abortSignal -\n */\n private async delay(\n isPrimaryRetry: boolean,\n attempt: number,\n abortSignal?: AbortSignalLike,\n ): Promise<void> {\n let delayTimeInMs: number = 0;\n\n if (isPrimaryRetry) {\n switch (this.retryOptions.retryPolicyType) {\n case StorageRetryPolicyType.EXPONENTIAL:\n delayTimeInMs = Math.min(\n (Math.pow(2, attempt - 1) - 1) * this.retryOptions.retryDelayInMs!,\n this.retryOptions.maxRetryDelayInMs!,\n );\n break;\n case StorageRetryPolicyType.FIXED:\n delayTimeInMs = this.retryOptions.retryDelayInMs!;\n break;\n }\n } else {\n delayTimeInMs = Math.random() * 1000;\n }\n\n logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`);\n return delay(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,8BAA2B;AAQ3B,2BAAkC;AAIlC,uBAA8C;AAC9C,0BAAmD;AACnD,iBAAuB;AACvB,oCAAuC;AAOhC,SAAS,sBAAsB,cAA0D;AAC9F,SAAO;AAAA,IACL,QAAQ,CAAC,YAA2B,YAAsD;AACxF,aAAO,IAAI,mBAAmB,YAAY,SAAS,YAAY;AAAA,IACjE;AAAA,EACF;AACF;AAGA,MAAM,wBAA6C;AAAA,EACjD,mBAAmB,MAAM;AAAA,EACzB,UAAU;AAAA,EACV,gBAAgB,IAAI;AAAA,EACpB,iBAAiB,qDAAuB;AAAA,EACxC,eAAe;AAAA,EACf,gBAAgB;AAAA;AAClB;AAEA,MAAM,oBAAoB,IAAI,mCAAW,4BAA4B;AAK9D,MAAM,2BAA2B,uCAAkB;AAAA;AAAA;AAAA;AAAA,EAIvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASjB,YACE,YACA,SACA,eAAoC,uBACpC;AACA,UAAM,YAAY,OAAO;AAGzB,SAAK,eAAe;AAAA,MA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extractor",
8
- "packageVersion": "7.58.7"
8
+ "packageVersion": "7.58.9"
9
9
  }
10
10
  ]
11
11
  }
@@ -24,7 +24,7 @@ __export(constants_exports, {
24
24
  URLConstants: () => URLConstants
25
25
  });
26
26
  module.exports = __toCommonJS(constants_exports);
27
- const SDK_VERSION = "12.4.0";
27
+ const SDK_VERSION = "12.5.0";
28
28
  const URLConstants = {
29
29
  Parameters: {
30
30
  FORCE_BROWSER_NO_CACHE: "_",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/constants.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const SDK_VERSION: string = \"12.4.0\";\n\nexport const URLConstants = {\n Parameters: {\n FORCE_BROWSER_NO_CACHE: \"_\",\n SIGNATURE: \"sig\",\n SNAPSHOT: \"snapshot\",\n VERSIONID: \"versionid\",\n TIMEOUT: \"timeout\",\n },\n};\n\nexport const HeaderConstants = {\n AUTHORIZATION: \"Authorization\",\n AUTHORIZATION_SCHEME: \"Bearer\",\n CONTENT_ENCODING: \"Content-Encoding\",\n CONTENT_ID: \"Content-ID\",\n CONTENT_LANGUAGE: \"Content-Language\",\n CONTENT_LENGTH: \"Content-Length\",\n CONTENT_MD5: \"Content-Md5\",\n CONTENT_TRANSFER_ENCODING: \"Content-Transfer-Encoding\",\n CONTENT_TYPE: \"Content-Type\",\n COOKIE: \"Cookie\",\n DATE: \"date\",\n IF_MATCH: \"if-match\",\n IF_MODIFIED_SINCE: \"if-modified-since\",\n IF_NONE_MATCH: \"if-none-match\",\n IF_UNMODIFIED_SINCE: \"if-unmodified-since\",\n PREFIX_FOR_STORAGE: \"x-ms-\",\n RANGE: \"Range\",\n USER_AGENT: \"User-Agent\",\n X_MS_CLIENT_REQUEST_ID: \"x-ms-client-request-id\",\n X_MS_COPY_SOURCE: \"x-ms-copy-source\",\n X_MS_DATE: \"x-ms-date\",\n X_MS_ERROR_CODE: \"x-ms-error-code\",\n X_MS_VERSION: \"x-ms-version\",\n X_MS_CopySourceErrorCode: \"x-ms-copy-source-error-code\",\n};\nexport const DevelopmentConnectionString = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;`;\n\n/// List of ports used for path style addressing.\n/// Path style addressing means that storage account is put in URI's Path segment in instead of in host.\nexport const PathStylePorts = [\n \"10000\",\n \"10001\",\n \"10002\",\n \"10003\",\n \"10004\",\n \"10100\",\n \"10101\",\n \"10102\",\n \"10103\",\n \"10104\",\n \"11000\",\n \"11001\",\n \"11002\",\n \"11003\",\n \"11004\",\n \"11100\",\n \"11101\",\n \"11102\",\n \"11103\",\n \"11104\",\n];\n"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const SDK_VERSION: string = \"12.5.0\";\n\nexport const URLConstants = {\n Parameters: {\n FORCE_BROWSER_NO_CACHE: \"_\",\n SIGNATURE: \"sig\",\n SNAPSHOT: \"snapshot\",\n VERSIONID: \"versionid\",\n TIMEOUT: \"timeout\",\n },\n};\n\nexport const HeaderConstants = {\n AUTHORIZATION: \"Authorization\",\n AUTHORIZATION_SCHEME: \"Bearer\",\n CONTENT_ENCODING: \"Content-Encoding\",\n CONTENT_ID: \"Content-ID\",\n CONTENT_LANGUAGE: \"Content-Language\",\n CONTENT_LENGTH: \"Content-Length\",\n CONTENT_MD5: \"Content-Md5\",\n CONTENT_TRANSFER_ENCODING: \"Content-Transfer-Encoding\",\n CONTENT_TYPE: \"Content-Type\",\n COOKIE: \"Cookie\",\n DATE: \"date\",\n IF_MATCH: \"if-match\",\n IF_MODIFIED_SINCE: \"if-modified-since\",\n IF_NONE_MATCH: \"if-none-match\",\n IF_UNMODIFIED_SINCE: \"if-unmodified-since\",\n PREFIX_FOR_STORAGE: \"x-ms-\",\n RANGE: \"Range\",\n USER_AGENT: \"User-Agent\",\n X_MS_CLIENT_REQUEST_ID: \"x-ms-client-request-id\",\n X_MS_COPY_SOURCE: \"x-ms-copy-source\",\n X_MS_DATE: \"x-ms-date\",\n X_MS_ERROR_CODE: \"x-ms-error-code\",\n X_MS_VERSION: \"x-ms-version\",\n X_MS_CopySourceErrorCode: \"x-ms-copy-source-error-code\",\n};\nexport const DevelopmentConnectionString = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;`;\n\n/// List of ports used for path style addressing.\n/// Path style addressing means that storage account is put in URI's Path segment in instead of in host.\nexport const PathStylePorts = [\n \"10000\",\n \"10001\",\n \"10002\",\n \"10003\",\n \"10004\",\n \"10100\",\n \"10101\",\n \"10102\",\n \"10103\",\n \"10104\",\n \"11000\",\n \"11001\",\n \"11002\",\n \"11003\",\n \"11004\",\n \"11100\",\n \"11101\",\n \"11102\",\n \"11103\",\n \"11104\",\n];\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,cAAsB;AAE5B,MAAM,eAAe;AAAA,EAC1B,YAAY;AAAA,IACV,wBAAwB;AAAA,IACxB,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,IACX,SAAS;AAAA,EACX;AACF;AAEO,MAAM,kBAAkB;AAAA,EAC7B,eAAe;AAAA,EACf,sBAAsB;AAAA,EACtB,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,2BAA2B;AAAA,EAC3B,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AAAA,EACV,mBAAmB;AAAA,EACnB,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,wBAAwB;AAAA,EACxB,kBAAkB;AAAA,EAClB,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,0BAA0B;AAC5B;AACO,MAAM,8BAA8B;AAIpC,MAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Specifies the format the service should use to return list results.
3
+ */
4
+ export declare const StorageResponseFormat: {
5
+ /**
6
+ * Default. Currently maps to {@link StorageResponseFormat.Xml}, but may be updated in future releases.
7
+ */
8
+ readonly Auto: "Auto";
9
+ /**
10
+ * Use XML to return list results.
11
+ */
12
+ readonly Xml: "Xml";
13
+ /**
14
+ * Use Apache Arrow to return list results.
15
+ */
16
+ readonly Arrow: "Arrow";
17
+ };
18
+ /**
19
+ * Specifies the format the service should use to return list results.
20
+ */
21
+ export type StorageResponseFormat = (typeof StorageResponseFormat)[keyof typeof StorageResponseFormat];
22
+ //# sourceMappingURL=StorageResponseFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageResponseFormat.d.ts","sourceRoot":"","sources":["../../src/StorageResponseFormat.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,qBAAqB;IAChC;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;CAEK,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC/B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * Specifies the format the service should use to return list results.
5
+ */
6
+ export const StorageResponseFormat = {
7
+ /**
8
+ * Default. Currently maps to {@link StorageResponseFormat.Xml}, but may be updated in future releases.
9
+ */
10
+ Auto: "Auto",
11
+ /**
12
+ * Use XML to return list results.
13
+ */
14
+ Xml: "Xml",
15
+ /**
16
+ * Use Apache Arrow to return list results.
17
+ */
18
+ Arrow: "Arrow",
19
+ };
20
+ //# sourceMappingURL=StorageResponseFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StorageResponseFormat.js","sourceRoot":"","sources":["../../src/StorageResponseFormat.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC;;OAEG;IACH,IAAI,EAAE,MAAM;IACZ;;OAEG;IACH,GAAG,EAAE,KAAK;IACV;;OAEG;IACH,KAAK,EAAE,OAAO;CACN,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Specifies the format the service should use to return list results.\n */\nexport const StorageResponseFormat = {\n /**\n * Default. Currently maps to {@link StorageResponseFormat.Xml}, but may be updated in future releases.\n */\n Auto: \"Auto\",\n /**\n * Use XML to return list results.\n */\n Xml: \"Xml\",\n /**\n * Use Apache Arrow to return list results.\n */\n Arrow: \"Arrow\",\n} as const;\n\n/**\n * Specifies the format the service should use to return list results.\n */\nexport type StorageResponseFormat =\n (typeof StorageResponseFormat)[keyof typeof StorageResponseFormat];\n"]}