@azure/storage-common 12.4.1 → 12.6.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.
- package/dist/browser/StorageResponseFormat.d.ts +22 -0
- package/dist/browser/StorageResponseFormat.d.ts.map +1 -0
- package/dist/browser/StorageResponseFormat.js +20 -0
- package/dist/browser/StorageResponseFormat.js.map +1 -0
- package/dist/browser/StructuredMessageEncodingStream-browser.d.mts.map +1 -1
- package/dist/browser/StructuredMessageEncodingStream-browser.mjs +1 -2
- package/dist/browser/StructuredMessageEncodingStream-browser.mjs.map +1 -1
- package/dist/browser/crc64.js +6 -93
- package/dist/browser/indexPlatform-browser.d.mts +2 -0
- package/dist/browser/indexPlatform-browser.d.mts.map +1 -1
- package/dist/browser/indexPlatform-browser.mjs +2 -0
- package/dist/browser/indexPlatform-browser.mjs.map +1 -1
- package/dist/browser/package.json +6 -1
- package/dist/browser/policies/StorageRedirectRangeHeaderPolicy.d.ts +10 -0
- package/dist/browser/policies/StorageRedirectRangeHeaderPolicy.d.ts.map +1 -0
- package/dist/browser/policies/StorageRedirectRangeHeaderPolicy.js +22 -0
- package/dist/browser/policies/StorageRedirectRangeHeaderPolicy.js.map +1 -0
- package/dist/browser/policies/StorageRequestFailureDetailsParserPolicy.d.ts.map +1 -1
- package/dist/browser/policies/StorageRequestFailureDetailsParserPolicy.js +12 -0
- package/dist/browser/policies/StorageRequestFailureDetailsParserPolicy.js.map +1 -1
- package/dist/browser/policies/StorageRetryPolicy.d.ts.map +1 -1
- package/dist/browser/policies/StorageRetryPolicy.js +2 -3
- package/dist/browser/policies/StorageRetryPolicy.js.map +1 -1
- package/dist/browser/policies/StorageRetryPolicyV2.d.ts.map +1 -1
- package/dist/browser/policies/StorageRetryPolicyV2.js +28 -0
- package/dist/browser/policies/StorageRetryPolicyV2.js.map +1 -1
- package/dist/browser/utils/constants.d.ts.map +1 -1
- package/dist/browser/utils/constants.js +1 -1
- package/dist/browser/utils/constants.js.map +1 -1
- package/dist/browser/utils/utils.common.d.ts.map +1 -1
- package/dist/browser/utils/utils.common.js +5 -9
- package/dist/browser/utils/utils.common.js.map +1 -1
- package/dist/commonjs/BufferScheduler.d.ts.map +1 -1
- package/dist/commonjs/BufferScheduler.js +24 -7
- package/dist/commonjs/BufferScheduler.js.map +2 -2
- package/dist/commonjs/BuffersStream.d.ts.map +1 -1
- package/dist/commonjs/BuffersStream.js +0 -1
- package/dist/commonjs/BuffersStream.js.map +2 -2
- package/dist/commonjs/StorageResponseFormat.d.ts +22 -0
- package/dist/commonjs/StorageResponseFormat.d.ts.map +1 -0
- package/dist/commonjs/StorageResponseFormat.js +41 -0
- package/dist/commonjs/StorageResponseFormat.js.map +7 -0
- package/dist/commonjs/crc64.js +6 -134
- package/dist/commonjs/indexPlatform.d.ts +3 -0
- package/dist/commonjs/indexPlatform.d.ts.map +1 -1
- package/dist/commonjs/indexPlatform.js +7 -0
- package/dist/commonjs/indexPlatform.js.map +2 -2
- package/dist/commonjs/package.json +6 -1
- package/dist/commonjs/policies/SharedKeySigning.d.ts +32 -0
- package/dist/commonjs/policies/SharedKeySigning.d.ts.map +1 -0
- package/dist/commonjs/policies/SharedKeySigning.js +125 -0
- package/dist/commonjs/policies/SharedKeySigning.js.map +7 -0
- package/dist/commonjs/policies/StorageRedirectRangeHeaderPolicy.d.ts +10 -0
- package/dist/commonjs/policies/StorageRedirectRangeHeaderPolicy.d.ts.map +1 -0
- package/dist/commonjs/policies/StorageRedirectRangeHeaderPolicy.js +42 -0
- package/dist/commonjs/policies/StorageRedirectRangeHeaderPolicy.js.map +7 -0
- package/dist/commonjs/policies/StorageRequestFailureDetailsParserPolicy.d.ts.map +1 -1
- package/dist/commonjs/policies/StorageRequestFailureDetailsParserPolicy.js +6 -0
- package/dist/commonjs/policies/StorageRequestFailureDetailsParserPolicy.js.map +2 -2
- package/dist/commonjs/policies/StorageRetryPolicy.d.ts.map +1 -1
- package/dist/commonjs/policies/StorageRetryPolicy.js +1 -1
- package/dist/commonjs/policies/StorageRetryPolicy.js.map +2 -2
- package/dist/commonjs/policies/StorageRetryPolicyV2.d.ts.map +1 -1
- package/dist/commonjs/policies/StorageRetryPolicyV2.js +16 -0
- package/dist/commonjs/policies/StorageRetryPolicyV2.js.map +2 -2
- package/dist/commonjs/policies/StorageSharedKeyCredentialPolicy.d.ts +0 -28
- package/dist/commonjs/policies/StorageSharedKeyCredentialPolicy.d.ts.map +1 -1
- package/dist/commonjs/policies/StorageSharedKeyCredentialPolicy.js +10 -94
- package/dist/commonjs/policies/StorageSharedKeyCredentialPolicy.js.map +2 -2
- package/dist/commonjs/policies/StorageSharedKeyCredentialPolicyV2.d.ts.map +1 -1
- package/dist/commonjs/policies/StorageSharedKeyCredentialPolicyV2.js +2 -76
- package/dist/commonjs/policies/StorageSharedKeyCredentialPolicyV2.js.map +2 -2
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/utils/constants.d.ts.map +1 -1
- package/dist/commonjs/utils/constants.js +1 -1
- package/dist/commonjs/utils/constants.js.map +1 -1
- package/dist/commonjs/utils/utils.common.d.ts.map +1 -1
- package/dist/commonjs/utils/utils.common.js +11 -9
- package/dist/commonjs/utils/utils.common.js.map +2 -2
- package/dist/esm/BufferScheduler.d.ts.map +1 -1
- package/dist/esm/BufferScheduler.js +29 -7
- package/dist/esm/BufferScheduler.js.map +1 -1
- package/dist/esm/BuffersStream.d.ts.map +1 -1
- package/dist/esm/BuffersStream.js +0 -1
- package/dist/esm/BuffersStream.js.map +1 -1
- package/dist/esm/StorageResponseFormat.d.ts +22 -0
- package/dist/esm/StorageResponseFormat.d.ts.map +1 -0
- package/dist/esm/StorageResponseFormat.js +20 -0
- package/dist/esm/StorageResponseFormat.js.map +1 -0
- package/dist/esm/crc64.js +6 -156
- package/dist/esm/indexPlatform.d.ts +3 -0
- package/dist/esm/indexPlatform.d.ts.map +1 -1
- package/dist/esm/indexPlatform.js +3 -0
- package/dist/esm/indexPlatform.js.map +1 -1
- package/dist/esm/package.json +6 -1
- package/dist/esm/policies/SharedKeySigning.d.ts +32 -0
- package/dist/esm/policies/SharedKeySigning.d.ts.map +1 -0
- package/dist/esm/policies/SharedKeySigning.js +156 -0
- package/dist/esm/policies/SharedKeySigning.js.map +1 -0
- package/dist/esm/policies/StorageRedirectRangeHeaderPolicy.d.ts +10 -0
- package/dist/esm/policies/StorageRedirectRangeHeaderPolicy.d.ts.map +1 -0
- package/dist/esm/policies/StorageRedirectRangeHeaderPolicy.js +22 -0
- package/dist/esm/policies/StorageRedirectRangeHeaderPolicy.js.map +1 -0
- package/dist/esm/policies/StorageRequestFailureDetailsParserPolicy.d.ts.map +1 -1
- package/dist/esm/policies/StorageRequestFailureDetailsParserPolicy.js +12 -0
- package/dist/esm/policies/StorageRequestFailureDetailsParserPolicy.js.map +1 -1
- package/dist/esm/policies/StorageRetryPolicy.d.ts.map +1 -1
- package/dist/esm/policies/StorageRetryPolicy.js +2 -3
- package/dist/esm/policies/StorageRetryPolicy.js.map +1 -1
- package/dist/esm/policies/StorageRetryPolicyV2.d.ts.map +1 -1
- package/dist/esm/policies/StorageRetryPolicyV2.js +28 -0
- package/dist/esm/policies/StorageRetryPolicyV2.js.map +1 -1
- package/dist/esm/policies/StorageSharedKeyCredentialPolicy.d.ts +0 -28
- package/dist/esm/policies/StorageSharedKeyCredentialPolicy.d.ts.map +1 -1
- package/dist/esm/policies/StorageSharedKeyCredentialPolicy.js +9 -105
- package/dist/esm/policies/StorageSharedKeyCredentialPolicy.js.map +1 -1
- package/dist/esm/policies/StorageSharedKeyCredentialPolicyV2.d.ts.map +1 -1
- package/dist/esm/policies/StorageSharedKeyCredentialPolicyV2.js +2 -101
- package/dist/esm/policies/StorageSharedKeyCredentialPolicyV2.js.map +1 -1
- package/dist/esm/utils/constants.d.ts.map +1 -1
- package/dist/esm/utils/constants.js +1 -1
- package/dist/esm/utils/constants.js.map +1 -1
- package/dist/esm/utils/utils.common.d.ts.map +1 -1
- package/dist/esm/utils/utils.common.js +5 -9
- package/dist/esm/utils/utils.common.js.map +1 -1
- package/dist/react-native/StorageResponseFormat.d.ts +22 -0
- package/dist/react-native/StorageResponseFormat.d.ts.map +1 -0
- package/dist/react-native/StorageResponseFormat.js +20 -0
- package/dist/react-native/StorageResponseFormat.js.map +1 -0
- package/dist/react-native/crc64.js +6 -93
- package/dist/react-native/indexPlatform-browser.d.mts +2 -0
- package/dist/react-native/indexPlatform-browser.d.mts.map +1 -1
- package/dist/react-native/indexPlatform-browser.mjs +2 -0
- package/dist/react-native/indexPlatform-browser.mjs.map +1 -1
- package/dist/react-native/package.json +6 -1
- package/dist/react-native/policies/StorageRedirectRangeHeaderPolicy.d.ts +10 -0
- package/dist/react-native/policies/StorageRedirectRangeHeaderPolicy.d.ts.map +1 -0
- package/dist/react-native/policies/StorageRedirectRangeHeaderPolicy.js +22 -0
- package/dist/react-native/policies/StorageRedirectRangeHeaderPolicy.js.map +1 -0
- package/dist/react-native/policies/StorageRequestFailureDetailsParserPolicy.d.ts.map +1 -1
- package/dist/react-native/policies/StorageRequestFailureDetailsParserPolicy.js +12 -0
- package/dist/react-native/policies/StorageRequestFailureDetailsParserPolicy.js.map +1 -1
- package/dist/react-native/policies/StorageRetryPolicy.d.ts.map +1 -1
- package/dist/react-native/policies/StorageRetryPolicy.js +2 -3
- package/dist/react-native/policies/StorageRetryPolicy.js.map +1 -1
- package/dist/react-native/policies/StorageRetryPolicyV2.d.ts.map +1 -1
- package/dist/react-native/policies/StorageRetryPolicyV2.js +28 -0
- package/dist/react-native/policies/StorageRetryPolicyV2.js.map +1 -1
- package/dist/react-native/utils/constants.d.ts.map +1 -1
- package/dist/react-native/utils/constants.js +1 -1
- package/dist/react-native/utils/constants.js.map +1 -1
- package/dist/react-native/utils/utils.common.d.ts.map +1 -1
- package/dist/react-native/utils/utils.common.js +5 -9
- package/dist/react-native/utils/utils.common.js.map +1 -1
- package/package.json +14 -14
|
@@ -0,0 +1,41 @@
|
|
|
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 StorageResponseFormat_exports = {};
|
|
19
|
+
__export(StorageResponseFormat_exports, {
|
|
20
|
+
StorageResponseFormat: () => StorageResponseFormat
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(StorageResponseFormat_exports);
|
|
23
|
+
const StorageResponseFormat = {
|
|
24
|
+
/**
|
|
25
|
+
* Default. Currently maps to {@link StorageResponseFormat.Arrow}, but may be updated in future releases.
|
|
26
|
+
*/
|
|
27
|
+
Auto: "Auto",
|
|
28
|
+
/**
|
|
29
|
+
* Use XML to return list results.
|
|
30
|
+
*/
|
|
31
|
+
Xml: "Xml",
|
|
32
|
+
/**
|
|
33
|
+
* Use Apache Arrow to return list results.
|
|
34
|
+
*/
|
|
35
|
+
Arrow: "Arrow"
|
|
36
|
+
};
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
StorageResponseFormat
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=StorageResponseFormat.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/StorageResponseFormat.ts"],
|
|
4
|
+
"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.Arrow}, 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"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,MAAM,wBAAwB;AAAA;AAAA;AAAA;AAAA,EAInC,MAAM;AAAA;AAAA;AAAA;AAAA,EAIN,KAAK;AAAA;AAAA;AAAA;AAAA,EAIL,OAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/commonjs/crc64.js
CHANGED
|
@@ -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,52 +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
|
-
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
// TODO: Swap all `require()`'s with `import()`'s?
|
|
119
|
-
// These modules will usually be used on Node.js. Load them eagerly to avoid
|
|
120
|
-
// the complexity of lazy-loading.
|
|
121
|
-
var fs = require('fs');
|
|
122
|
-
var nodePath = require('path');
|
|
123
|
-
|
|
124
|
-
if (ENVIRONMENT_IS_WORKER) {
|
|
125
|
-
scriptDirectory = nodePath.dirname(scriptDirectory) + '/';
|
|
126
|
-
} else {
|
|
127
|
-
scriptDirectory = __dirname + '/';
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// include: node_shell_read.js
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
read_ = (filename, binary) => {
|
|
134
|
-
// We need to re-wrap `file://` strings to URLs. Normalizing isn't
|
|
135
|
-
// necessary in that case, the path should already be absolute.
|
|
136
|
-
filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
|
|
137
|
-
return fs.readFileSync(filename, binary ? undefined : 'utf8');
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
readBinary = (filename) => {
|
|
141
|
-
var ret = read_(filename, true);
|
|
142
|
-
if (!ret.buffer) {
|
|
143
|
-
ret = new Uint8Array(ret);
|
|
144
|
-
}
|
|
145
|
-
assert(ret.buffer);
|
|
146
|
-
return ret;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
readAsync = (filename, onload, onerror) => {
|
|
150
|
-
// See the comment in the `read_` function.
|
|
151
|
-
filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
|
|
152
|
-
fs.readFile(filename, function(err, data) {
|
|
153
|
-
if (err) onerror(err);
|
|
154
|
-
else onload(data.buffer);
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// end include: node_shell_read.js
|
|
159
|
-
// NODE-READ-END
|
|
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).
|
|
160
115
|
if (process['argv'].length > 1) {
|
|
161
116
|
thisProgram = process['argv'][1].replace(/\\/g, '/');
|
|
162
117
|
}
|
|
@@ -195,26 +150,6 @@ if (ENVIRONMENT_IS_SHELL) {
|
|
|
195
150
|
|
|
196
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?)');
|
|
197
152
|
|
|
198
|
-
if (typeof read != 'undefined') {
|
|
199
|
-
read_ = function shell_read(f) {
|
|
200
|
-
return read(f);
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
readBinary = function readBinary(f) {
|
|
205
|
-
let data;
|
|
206
|
-
if (typeof readbuffer == 'function') {
|
|
207
|
-
return new Uint8Array(readbuffer(f));
|
|
208
|
-
}
|
|
209
|
-
data = read(f, 'binary');
|
|
210
|
-
assert(typeof data == 'object');
|
|
211
|
-
return data;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
readAsync = function readAsync(f, onload, onerror) {
|
|
215
|
-
setTimeout(() => onload(readBinary(f)), 0);
|
|
216
|
-
};
|
|
217
|
-
|
|
218
153
|
if (typeof scriptArgs != 'undefined') {
|
|
219
154
|
arguments_ = scriptArgs;
|
|
220
155
|
} else if (typeof arguments != 'undefined') {
|
|
@@ -241,72 +176,9 @@ if (ENVIRONMENT_IS_SHELL) {
|
|
|
241
176
|
// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
|
|
242
177
|
// ENVIRONMENT_IS_NODE.
|
|
243
178
|
if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
244
|
-
if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled
|
|
245
|
-
scriptDirectory = self.location.href;
|
|
246
|
-
} else if (typeof document != 'undefined' && document.currentScript) { // web
|
|
247
|
-
scriptDirectory = document.currentScript.src;
|
|
248
|
-
}
|
|
249
|
-
// When MODULARIZE, this JS may be executed later, after document.currentScript
|
|
250
|
-
// is gone, so we saved it, and we use it here instead of any other info.
|
|
251
|
-
if (_scriptDir) {
|
|
252
|
-
scriptDirectory = _scriptDir;
|
|
253
|
-
}
|
|
254
|
-
// blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.
|
|
255
|
-
// otherwise, slice off the final part of the url to find the script directory.
|
|
256
|
-
// if scriptDirectory does not contain a slash, lastIndexOf will return -1,
|
|
257
|
-
// and scriptDirectory will correctly be replaced with an empty string.
|
|
258
|
-
// If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),
|
|
259
|
-
// they are removed because they could contain a slash.
|
|
260
|
-
if (scriptDirectory.indexOf('blob:') !== 0) {
|
|
261
|
-
scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf('/')+1);
|
|
262
|
-
} else {
|
|
263
|
-
scriptDirectory = '';
|
|
264
|
-
}
|
|
265
|
-
|
|
266
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?)');
|
|
267
|
-
|
|
268
|
-
//
|
|
269
|
-
// be done differently.
|
|
270
|
-
{
|
|
271
|
-
// include: web_or_worker_shell_read.js
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
read_ = (url) => {
|
|
275
|
-
var xhr = new XMLHttpRequest();
|
|
276
|
-
xhr.open('GET', url, false);
|
|
277
|
-
xhr.send(null);
|
|
278
|
-
return xhr.responseText;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (ENVIRONMENT_IS_WORKER) {
|
|
282
|
-
readBinary = (url) => {
|
|
283
|
-
var xhr = new XMLHttpRequest();
|
|
284
|
-
xhr.open('GET', url, false);
|
|
285
|
-
xhr.responseType = 'arraybuffer';
|
|
286
|
-
xhr.send(null);
|
|
287
|
-
return new Uint8Array(/** @type{!ArrayBuffer} */(xhr.response));
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
readAsync = (url, onload, onerror) => {
|
|
292
|
-
var xhr = new XMLHttpRequest();
|
|
293
|
-
xhr.open('GET', url, true);
|
|
294
|
-
xhr.responseType = 'arraybuffer';
|
|
295
|
-
xhr.onload = () => {
|
|
296
|
-
if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) { // file URLs can return 0
|
|
297
|
-
onload(xhr.response);
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
onerror();
|
|
301
|
-
};
|
|
302
|
-
xhr.onerror = onerror;
|
|
303
|
-
xhr.send(null);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// end include: web_or_worker_shell_read.js
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
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.
|
|
310
182
|
} else
|
|
311
183
|
{
|
|
312
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,8 @@ 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 { buildStorageSharedKeyStringToSign } from "./policies/SharedKeySigning.js";
|
|
24
|
+
export * from "./policies/StorageRedirectRangeHeaderPolicy.js";
|
|
22
25
|
export * from "./policies/StorageRequestFailureDetailsParserPolicy.js";
|
|
23
26
|
export * from "./credentials/UserDelegationKeyCredential.js";
|
|
24
27
|
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;
|
|
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;AAC1C,cAAc,4BAA4B,CAAC;AAE3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kDAAkD,CAAC;AAEjE,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sDAAsD,CAAC;AACrE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uDAAuD,CAAC;AACtE,OAAO,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAC;AACnF,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wDAAwD,CAAC;AACvE,cAAc,mDAAmD,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAG5E,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var indexPlatform_exports = {};
|
|
20
20
|
__export(indexPlatform_exports, {
|
|
21
21
|
BaseRequestPolicy: () => import_RequestPolicy.BaseRequestPolicy,
|
|
22
|
+
buildStorageSharedKeyStringToSign: () => import_SharedKeySigning.buildStorageSharedKeyStringToSign,
|
|
22
23
|
createBlobFromData: () => import_bufferHelpers_common.createBlobFromData,
|
|
23
24
|
getCachedDefaultHttpClient: () => import_cache.getCachedDefaultHttpClient
|
|
24
25
|
});
|
|
@@ -30,6 +31,7 @@ __reExport(indexPlatform_exports, require("./StructuredMessageEncodingStream.js"
|
|
|
30
31
|
__reExport(indexPlatform_exports, require("./StructuredMessageDecodingStream.js"), module.exports);
|
|
31
32
|
__reExport(indexPlatform_exports, require("./StorageCRC64Calculator.js"), module.exports);
|
|
32
33
|
var import_cache = require("./cache.js");
|
|
34
|
+
__reExport(indexPlatform_exports, require("./StorageResponseFormat.js"), module.exports);
|
|
33
35
|
__reExport(indexPlatform_exports, require("./StorageBrowserPolicyFactory.js"), module.exports);
|
|
34
36
|
__reExport(indexPlatform_exports, require("./credentials/AnonymousCredential.js"), module.exports);
|
|
35
37
|
__reExport(indexPlatform_exports, require("./credentials/Credential.js"), module.exports);
|
|
@@ -43,11 +45,14 @@ __reExport(indexPlatform_exports, require("./policies/StorageCorrectContentLengt
|
|
|
43
45
|
__reExport(indexPlatform_exports, require("./policies/StorageRetryPolicyV2.js"), module.exports);
|
|
44
46
|
__reExport(indexPlatform_exports, require("./policies/StorageSharedKeyCredentialPolicy.js"), module.exports);
|
|
45
47
|
__reExport(indexPlatform_exports, require("./policies/StorageSharedKeyCredentialPolicyV2.js"), module.exports);
|
|
48
|
+
var import_SharedKeySigning = require("./policies/SharedKeySigning.js");
|
|
49
|
+
__reExport(indexPlatform_exports, require("./policies/StorageRedirectRangeHeaderPolicy.js"), module.exports);
|
|
46
50
|
__reExport(indexPlatform_exports, require("./policies/StorageRequestFailureDetailsParserPolicy.js"), module.exports);
|
|
47
51
|
__reExport(indexPlatform_exports, require("./credentials/UserDelegationKeyCredential.js"), module.exports);
|
|
48
52
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
53
|
0 && (module.exports = {
|
|
50
54
|
BaseRequestPolicy,
|
|
55
|
+
buildStorageSharedKeyStringToSign,
|
|
51
56
|
createBlobFromData,
|
|
52
57
|
getCachedDefaultHttpClient,
|
|
53
58
|
...require("./BufferScheduler.js"),
|
|
@@ -55,6 +60,7 @@ __reExport(indexPlatform_exports, require("./credentials/UserDelegationKeyCreden
|
|
|
55
60
|
...require("./StructuredMessageEncodingStream.js"),
|
|
56
61
|
...require("./StructuredMessageDecodingStream.js"),
|
|
57
62
|
...require("./StorageCRC64Calculator.js"),
|
|
63
|
+
...require("./StorageResponseFormat.js"),
|
|
58
64
|
...require("./StorageBrowserPolicyFactory.js"),
|
|
59
65
|
...require("./credentials/AnonymousCredential.js"),
|
|
60
66
|
...require("./credentials/Credential.js"),
|
|
@@ -67,6 +73,7 @@ __reExport(indexPlatform_exports, require("./credentials/UserDelegationKeyCreden
|
|
|
67
73
|
...require("./policies/StorageRetryPolicyV2.js"),
|
|
68
74
|
...require("./policies/StorageSharedKeyCredentialPolicy.js"),
|
|
69
75
|
...require("./policies/StorageSharedKeyCredentialPolicyV2.js"),
|
|
76
|
+
...require("./policies/StorageRedirectRangeHeaderPolicy.js"),
|
|
70
77
|
...require("./policies/StorageRequestFailureDetailsParserPolicy.js"),
|
|
71
78
|
...require("./credentials/UserDelegationKeyCredential.js")
|
|
72
79
|
});
|
|
@@ -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 \"
|
|
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;
|
|
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 { buildStorageSharedKeyStringToSign } from \"./policies/SharedKeySigning.js\";\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;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,8BAAkD;AAClD,kCAAc,2DA5Bd;AA6BA,kCAAc,mEA7Bd;AA8BA,kCAAc,8DA9Bd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { PipelineRequest } from "@azure/core-rest-pipeline";
|
|
2
|
+
/**
|
|
3
|
+
* Sets the request headers that participate in the Shared Key signature and are derived from
|
|
4
|
+
* the request itself: `x-ms-date`, and `Content-Length` for a string or Buffer body.
|
|
5
|
+
*
|
|
6
|
+
* `Content-Length` is a signed field: a request with a body whose `Content-Length` isn't set
|
|
7
|
+
* gets a signature the service rejects.
|
|
8
|
+
*/
|
|
9
|
+
export declare function prepareSharedKeyHeaders(request: PipelineRequest): void;
|
|
10
|
+
/**
|
|
11
|
+
* Builds the string to sign for the Azure Storage Shared Key authorization scheme.
|
|
12
|
+
*
|
|
13
|
+
* Before building it, sets the request headers that the signature covers and that come from
|
|
14
|
+
* the request itself: `x-ms-date`, and `Content-Length` for a string or Buffer body. Send the
|
|
15
|
+
* request with these headers, since the signature depends on them.
|
|
16
|
+
*
|
|
17
|
+
* @param request - The request to sign. Its `x-ms-date` header is set, and so is its
|
|
18
|
+
* `Content-Length` header when the body is a string or a Buffer.
|
|
19
|
+
* @param accountName - The storage account name used to build the canonicalized resource.
|
|
20
|
+
* @returns The string to sign, ready to be signed with HMAC-SHA256.
|
|
21
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/authorize-with-shared-key
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildStorageSharedKeyStringToSign(request: PipelineRequest, accountName: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Builds the string to sign from the request as it is, without setting any header. For a caller
|
|
26
|
+
* that sets the signed headers itself on the request it sends.
|
|
27
|
+
*
|
|
28
|
+
* @param request - The request whose headers and URL form the string to sign.
|
|
29
|
+
* @param accountName - The storage account name used to build the canonicalized resource.
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildStringToSign(request: PipelineRequest, accountName: string): string;
|
|
32
|
+
//# sourceMappingURL=SharedKeySigning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SharedKeySigning.d.ts","sourceRoot":"","sources":["../../../src/policies/SharedKeySigning.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAmHjE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAUtE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,MAAM,GAClB,MAAM,CAGR;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAqBvF"}
|
|
@@ -0,0 +1,125 @@
|
|
|
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 SharedKeySigning_exports = {};
|
|
19
|
+
__export(SharedKeySigning_exports, {
|
|
20
|
+
buildStorageSharedKeyStringToSign: () => buildStorageSharedKeyStringToSign,
|
|
21
|
+
buildStringToSign: () => buildStringToSign,
|
|
22
|
+
prepareSharedKeyHeaders: () => prepareSharedKeyHeaders
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(SharedKeySigning_exports);
|
|
25
|
+
var import_constants = require("../utils/constants.js");
|
|
26
|
+
var import_utils_common = require("../utils/utils.common.js");
|
|
27
|
+
var import_SharedKeyComparator = require("../utils/SharedKeyComparator.js");
|
|
28
|
+
function getHeaderValueToSign(request, headerName) {
|
|
29
|
+
const value = request.headers.get(headerName);
|
|
30
|
+
if (!value) {
|
|
31
|
+
return "";
|
|
32
|
+
}
|
|
33
|
+
if (headerName === import_constants.HeaderConstants.CONTENT_LENGTH && value === "0") {
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
function getCanonicalizedHeadersString(request) {
|
|
39
|
+
let headersArray = [];
|
|
40
|
+
for (const [name, value] of request.headers) {
|
|
41
|
+
if (name.toLowerCase().startsWith(import_constants.HeaderConstants.PREFIX_FOR_STORAGE)) {
|
|
42
|
+
headersArray.push({ name, value });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
headersArray.sort((a, b) => {
|
|
46
|
+
return (0, import_SharedKeyComparator.compareHeader)(a.name.toLowerCase(), b.name.toLowerCase());
|
|
47
|
+
});
|
|
48
|
+
headersArray = headersArray.filter((value, index, array) => {
|
|
49
|
+
if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return true;
|
|
53
|
+
});
|
|
54
|
+
let canonicalizedHeadersStringToSign = "";
|
|
55
|
+
headersArray.forEach((header) => {
|
|
56
|
+
canonicalizedHeadersStringToSign += `${header.name.toLowerCase().trimRight()}:${header.value.trimLeft()}
|
|
57
|
+
`;
|
|
58
|
+
});
|
|
59
|
+
return canonicalizedHeadersStringToSign;
|
|
60
|
+
}
|
|
61
|
+
function getCanonicalizedResourceString(request, accountName) {
|
|
62
|
+
const path = (0, import_utils_common.getURLPath)(request.url) || "/";
|
|
63
|
+
let canonicalizedResourceString = "";
|
|
64
|
+
canonicalizedResourceString += `/${accountName}${path}`;
|
|
65
|
+
const valuesByKey = getCanonicalizedQueryValues(request.url);
|
|
66
|
+
for (const key of [...valuesByKey.keys()].sort()) {
|
|
67
|
+
canonicalizedResourceString += `
|
|
68
|
+
${key}:${valuesByKey.get(key).sort().join(",")}`;
|
|
69
|
+
}
|
|
70
|
+
return canonicalizedResourceString;
|
|
71
|
+
}
|
|
72
|
+
function getCanonicalizedQueryValues(url) {
|
|
73
|
+
const valuesByKey = /* @__PURE__ */ new Map();
|
|
74
|
+
const queryString = new URL(url).search.replace(/^\?/, "").trim();
|
|
75
|
+
if (!queryString) {
|
|
76
|
+
return valuesByKey;
|
|
77
|
+
}
|
|
78
|
+
for (const pair of queryString.split("&")) {
|
|
79
|
+
if (!pair) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const separator = pair.indexOf("=");
|
|
83
|
+
const key = decodeURIComponent(
|
|
84
|
+
separator === -1 ? pair : pair.substring(0, separator)
|
|
85
|
+
).toLowerCase();
|
|
86
|
+
const values = valuesByKey.get(key) ?? [];
|
|
87
|
+
values.push(separator === -1 ? "" : decodeURIComponent(pair.substring(separator + 1)));
|
|
88
|
+
valuesByKey.set(key, values);
|
|
89
|
+
}
|
|
90
|
+
return valuesByKey;
|
|
91
|
+
}
|
|
92
|
+
function prepareSharedKeyHeaders(request) {
|
|
93
|
+
request.headers.set(import_constants.HeaderConstants.X_MS_DATE, (/* @__PURE__ */ new Date()).toUTCString());
|
|
94
|
+
if (request.body && (typeof request.body === "string" || Buffer.isBuffer(request.body)) && request.body.length > 0) {
|
|
95
|
+
request.headers.set(import_constants.HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function buildStorageSharedKeyStringToSign(request, accountName) {
|
|
99
|
+
prepareSharedKeyHeaders(request);
|
|
100
|
+
return buildStringToSign(request, accountName);
|
|
101
|
+
}
|
|
102
|
+
function buildStringToSign(request, accountName) {
|
|
103
|
+
return [
|
|
104
|
+
request.method.toUpperCase(),
|
|
105
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.CONTENT_ENCODING),
|
|
106
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.CONTENT_LANGUAGE),
|
|
107
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.CONTENT_LENGTH),
|
|
108
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.CONTENT_MD5),
|
|
109
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.CONTENT_TYPE),
|
|
110
|
+
// Signed requests always carry x-ms-date, which requires this slot to stay empty.
|
|
111
|
+
"",
|
|
112
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.IF_MODIFIED_SINCE),
|
|
113
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.IF_MATCH),
|
|
114
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.IF_NONE_MATCH),
|
|
115
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.IF_UNMODIFIED_SINCE),
|
|
116
|
+
getHeaderValueToSign(request, import_constants.HeaderConstants.RANGE)
|
|
117
|
+
].join("\n") + "\n" + getCanonicalizedHeadersString(request) + getCanonicalizedResourceString(request, accountName);
|
|
118
|
+
}
|
|
119
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
120
|
+
0 && (module.exports = {
|
|
121
|
+
buildStorageSharedKeyStringToSign,
|
|
122
|
+
buildStringToSign,
|
|
123
|
+
prepareSharedKeyHeaders
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=SharedKeySigning.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/policies/SharedKeySigning.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest } from \"@azure/core-rest-pipeline\";\nimport { HeaderConstants } from \"../utils/constants.js\";\nimport { getURLPath } from \"../utils/utils.common.js\";\nimport { compareHeader } from \"../utils/SharedKeyComparator.js\";\n\n/**\n * Retrieve header value according to shared key sign rules.\n * @see https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key\n */\nfunction getHeaderValueToSign(request: PipelineRequest, headerName: string): string {\n const value = request.headers.get(headerName);\n\n if (!value) {\n return \"\";\n }\n\n // When using version 2015-02-21 or later, if Content-Length is zero, then\n // set the Content-Length part of the StringToSign to an empty string.\n // https://learn.microsoft.com/rest/api/storageservices/authenticate-with-shared-key\n if (headerName === HeaderConstants.CONTENT_LENGTH && value === \"0\") {\n return \"\";\n }\n\n return value;\n}\n\n/**\n * To construct the CanonicalizedHeaders portion of the signature string, follow these steps:\n * 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header.\n * 2. Convert each HTTP header name to lowercase.\n * 3. Sort the headers lexicographically by header name, in ascending order.\n * Each header may appear only once in the string.\n * 4. Replace any linear whitespace in the header value with a single space.\n * 5. Trim any whitespace around the colon in the header.\n * 6. Finally, append a new-line character to each canonicalized header in the resulting list.\n * Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string.\n *\n */\nfunction getCanonicalizedHeadersString(request: PipelineRequest): string {\n let headersArray: Array<{ name: string; value: string }> = [];\n for (const [name, value] of request.headers) {\n if (name.toLowerCase().startsWith(HeaderConstants.PREFIX_FOR_STORAGE)) {\n headersArray.push({ name, value });\n }\n }\n\n headersArray.sort((a, b): number => {\n return compareHeader(a.name.toLowerCase(), b.name.toLowerCase());\n });\n\n // Remove duplicate headers\n headersArray = headersArray.filter((value, index, array) => {\n if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) {\n return false;\n }\n return true;\n });\n\n let canonicalizedHeadersStringToSign: string = \"\";\n headersArray.forEach((header) => {\n canonicalizedHeadersStringToSign += `${header.name\n .toLowerCase()\n .trimRight()}:${header.value.trimLeft()}\\n`;\n });\n\n return canonicalizedHeadersStringToSign;\n}\n\nfunction getCanonicalizedResourceString(request: PipelineRequest, accountName: string): string {\n const path = getURLPath(request.url) || \"/\";\n\n let canonicalizedResourceString: string = \"\";\n canonicalizedResourceString += `/${accountName}${path}`;\n\n // A name that repeats, whether spelled identically or differing only by case, contributes all\n // of its values as one sorted, comma-joined line.\n const valuesByKey = getCanonicalizedQueryValues(request.url);\n for (const key of [...valuesByKey.keys()].sort()) {\n canonicalizedResourceString += `\\n${key}:${valuesByKey.get(key)!.sort().join(\",\")}`;\n }\n\n return canonicalizedResourceString;\n}\n\n/**\n * Groups query parameter values by lowercased name. Parses the raw query rather than reusing\n * `getURLQueries`, which keeps only the last value for a repeated name and discards parameters\n * that the service still canonicalizes.\n */\nfunction getCanonicalizedQueryValues(url: string): Map<string, string[]> {\n const valuesByKey = new Map<string, string[]>();\n const queryString = new URL(url).search.replace(/^\\?/, \"\").trim();\n if (!queryString) {\n return valuesByKey;\n }\n\n for (const pair of queryString.split(\"&\")) {\n if (!pair) {\n continue;\n }\n\n // Split at the first \"=\" only: \"=\" is legal inside a value, and a name carried without one\n // still participates in the signature.\n const separator = pair.indexOf(\"=\");\n const key = decodeURIComponent(\n separator === -1 ? pair : pair.substring(0, separator),\n ).toLowerCase();\n const values = valuesByKey.get(key) ?? [];\n values.push(separator === -1 ? \"\" : decodeURIComponent(pair.substring(separator + 1)));\n valuesByKey.set(key, values);\n }\n\n return valuesByKey;\n}\n\n/**\n * Sets the request headers that participate in the Shared Key signature and are derived from\n * the request itself: `x-ms-date`, and `Content-Length` for a string or Buffer body.\n *\n * `Content-Length` is a signed field: a request with a body whose `Content-Length` isn't set\n * gets a signature the service rejects.\n */\nexport function prepareSharedKeyHeaders(request: PipelineRequest): void {\n request.headers.set(HeaderConstants.X_MS_DATE, new Date().toUTCString());\n\n if (\n request.body &&\n (typeof request.body === \"string\" || Buffer.isBuffer(request.body)) &&\n request.body.length > 0\n ) {\n request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));\n }\n}\n\n/**\n * Builds the string to sign for the Azure Storage Shared Key authorization scheme.\n *\n * Before building it, sets the request headers that the signature covers and that come from\n * the request itself: `x-ms-date`, and `Content-Length` for a string or Buffer body. Send the\n * request with these headers, since the signature depends on them.\n *\n * @param request - The request to sign. Its `x-ms-date` header is set, and so is its\n * `Content-Length` header when the body is a string or a Buffer.\n * @param accountName - The storage account name used to build the canonicalized resource.\n * @returns The string to sign, ready to be signed with HMAC-SHA256.\n * @see https://learn.microsoft.com/rest/api/storageservices/authorize-with-shared-key\n */\nexport function buildStorageSharedKeyStringToSign(\n request: PipelineRequest,\n accountName: string,\n): string {\n prepareSharedKeyHeaders(request);\n return buildStringToSign(request, accountName);\n}\n\n/**\n * Builds the string to sign from the request as it is, without setting any header. For a caller\n * that sets the signed headers itself on the request it sends.\n *\n * @param request - The request whose headers and URL form the string to sign.\n * @param accountName - The storage account name used to build the canonicalized resource.\n */\nexport function buildStringToSign(request: PipelineRequest, accountName: string): string {\n return (\n [\n request.method.toUpperCase(),\n getHeaderValueToSign(request, HeaderConstants.CONTENT_ENCODING),\n getHeaderValueToSign(request, HeaderConstants.CONTENT_LANGUAGE),\n getHeaderValueToSign(request, HeaderConstants.CONTENT_LENGTH),\n getHeaderValueToSign(request, HeaderConstants.CONTENT_MD5),\n getHeaderValueToSign(request, HeaderConstants.CONTENT_TYPE),\n // Signed requests always carry x-ms-date, which requires this slot to stay empty.\n \"\",\n getHeaderValueToSign(request, HeaderConstants.IF_MODIFIED_SINCE),\n getHeaderValueToSign(request, HeaderConstants.IF_MATCH),\n getHeaderValueToSign(request, HeaderConstants.IF_NONE_MATCH),\n getHeaderValueToSign(request, HeaderConstants.IF_UNMODIFIED_SINCE),\n getHeaderValueToSign(request, HeaderConstants.RANGE),\n ].join(\"\\n\") +\n \"\\n\" +\n getCanonicalizedHeadersString(request) +\n getCanonicalizedResourceString(request, accountName)\n );\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
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,
|
|
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
|
}
|