@azure/storage-queue 12.29.0 → 12.30.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/Pipeline.d.ts +2 -3
- package/dist/browser/Pipeline.d.ts.map +1 -1
- package/dist/browser/Pipeline.js.map +1 -1
- package/dist/browser/QueueClient.d.ts +2 -1
- package/dist/browser/QueueClient.d.ts.map +1 -1
- package/dist/browser/QueueClient.js.map +1 -1
- package/dist/browser/QueueSASSignatureValues.d.ts +2 -1
- package/dist/browser/QueueSASSignatureValues.d.ts.map +1 -1
- package/dist/browser/QueueSASSignatureValues.js +2 -2
- package/dist/browser/QueueSASSignatureValues.js.map +1 -1
- package/dist/browser/QueueServiceClient.d.ts +28 -0
- package/dist/browser/QueueServiceClient.d.ts.map +1 -1
- package/dist/browser/QueueServiceClient.js +21 -13
- package/dist/browser/QueueServiceClient.js.map +1 -1
- package/dist/browser/SASQueryParameters.d.ts +6 -1
- package/dist/browser/SASQueryParameters.d.ts.map +1 -1
- package/dist/browser/SASQueryParameters.js +10 -0
- package/dist/browser/SASQueryParameters.js.map +1 -1
- package/dist/browser/generated/src/models/index.d.ts +4 -0
- package/dist/browser/generated/src/models/index.d.ts.map +1 -1
- package/dist/browser/generated/src/models/index.js.map +1 -1
- package/dist/browser/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/browser/generated/src/models/mappers.js +14 -0
- package/dist/browser/generated/src/models/mappers.js.map +1 -1
- package/dist/browser/generated/src/models/parameters.js +1 -1
- package/dist/browser/generated/src/models/parameters.js.map +1 -1
- package/dist/browser/generated/src/storageClient.js +2 -2
- package/dist/browser/generated/src/storageClient.js.map +1 -1
- package/dist/browser/generatedModels.d.ts +2 -2
- package/dist/browser/generatedModels.d.ts.map +1 -1
- package/dist/browser/generatedModels.js.map +1 -1
- package/dist/browser/index.d.ts +8 -8
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +1 -2
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/utils/constants.d.ts.map +1 -1
- package/dist/browser/utils/constants.js +2 -2
- package/dist/browser/utils/constants.js.map +1 -1
- package/dist/commonjs/AccountSASPermissions.js +133 -126
- package/dist/commonjs/AccountSASPermissions.js.map +7 -1
- package/dist/commonjs/AccountSASResourceTypes.js +80 -70
- package/dist/commonjs/AccountSASResourceTypes.js.map +7 -1
- package/dist/commonjs/AccountSASServices.js +88 -78
- package/dist/commonjs/AccountSASServices.js.map +7 -1
- package/dist/commonjs/AccountSASSignatureValues.js +91 -72
- package/dist/commonjs/AccountSASSignatureValues.js.map +7 -1
- package/dist/commonjs/Pipeline.d.ts +2 -3
- package/dist/commonjs/Pipeline.d.ts.map +1 -1
- package/dist/commonjs/Pipeline.js +244 -244
- package/dist/commonjs/Pipeline.js.map +7 -1
- package/dist/commonjs/QueueClient.d.ts +2 -1
- package/dist/commonjs/QueueClient.d.ts.map +1 -1
- package/dist/commonjs/QueueClient.js +710 -683
- package/dist/commonjs/QueueClient.js.map +7 -1
- package/dist/commonjs/QueueSASPermissions.js +90 -80
- package/dist/commonjs/QueueSASPermissions.js.map +7 -1
- package/dist/commonjs/QueueSASSignatureValues.d.ts +2 -1
- package/dist/commonjs/QueueSASSignatureValues.d.ts.map +1 -1
- package/dist/commonjs/QueueSASSignatureValues.js +151 -111
- package/dist/commonjs/QueueSASSignatureValues.js.map +7 -1
- package/dist/commonjs/QueueServiceClient.d.ts +28 -0
- package/dist/commonjs/QueueServiceClient.d.ts.map +1 -1
- package/dist/commonjs/QueueServiceClient.js +532 -472
- package/dist/commonjs/QueueServiceClient.js.map +7 -1
- package/dist/commonjs/SASQueryParameters.d.ts +6 -1
- package/dist/commonjs/SASQueryParameters.d.ts.map +1 -1
- package/dist/commonjs/SASQueryParameters.js +308 -267
- package/dist/commonjs/SASQueryParameters.js.map +7 -1
- package/dist/commonjs/SasIPRange.js +27 -14
- package/dist/commonjs/SasIPRange.js.map +7 -1
- package/dist/commonjs/StorageClient.js +75 -65
- package/dist/commonjs/StorageClient.js.map +7 -1
- package/dist/commonjs/StorageContextClient.js +34 -20
- package/dist/commonjs/StorageContextClient.js.map +7 -1
- package/dist/commonjs/generated/src/index.js +32 -16
- package/dist/commonjs/generated/src/index.js.map +7 -1
- package/dist/commonjs/generated/src/models/index.d.ts +4 -0
- package/dist/commonjs/generated/src/models/index.d.ts.map +1 -1
- package/dist/commonjs/generated/src/models/index.js +86 -129
- package/dist/commonjs/generated/src/models/index.js.map +7 -1
- package/dist/commonjs/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/commonjs/generated/src/models/mappers.js +1947 -1817
- package/dist/commonjs/generated/src/models/mappers.js.map +7 -1
- package/dist/commonjs/generated/src/models/parameters.js +378 -305
- package/dist/commonjs/generated/src/models/parameters.js.map +7 -1
- package/dist/commonjs/generated/src/operations/index.js +27 -15
- package/dist/commonjs/generated/src/operations/index.js.map +7 -1
- package/dist/commonjs/generated/src/operations/messageId.js +130 -99
- package/dist/commonjs/generated/src/operations/messageId.js.map +7 -1
- package/dist/commonjs/generated/src/operations/messages.js +213 -185
- package/dist/commonjs/generated/src/operations/messages.js.map +7 -1
- package/dist/commonjs/generated/src/operations/queue.js +243 -206
- package/dist/commonjs/generated/src/operations/queue.js.map +7 -1
- package/dist/commonjs/generated/src/operations/service.js +239 -199
- package/dist/commonjs/generated/src/operations/service.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/index.js +27 -15
- package/dist/commonjs/generated/src/operationsInterfaces/index.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/messageId.js +15 -10
- package/dist/commonjs/generated/src/operationsInterfaces/messageId.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/messages.js +15 -10
- package/dist/commonjs/generated/src/operationsInterfaces/messages.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/queue.js +15 -10
- package/dist/commonjs/generated/src/operationsInterfaces/queue.js.map +7 -1
- package/dist/commonjs/generated/src/operationsInterfaces/service.js +15 -10
- package/dist/commonjs/generated/src/operationsInterfaces/service.js.map +7 -1
- package/dist/commonjs/generated/src/storageClient.js +77 -59
- package/dist/commonjs/generated/src/storageClient.js.map +7 -1
- package/dist/commonjs/generatedModels.d.ts +2 -2
- package/dist/commonjs/generatedModels.d.ts.map +1 -1
- package/dist/commonjs/generatedModels.js +15 -5
- package/dist/commonjs/generatedModels.js.map +7 -1
- package/dist/commonjs/index.d.ts +9 -9
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +88 -43
- package/dist/commonjs/index.js.map +7 -1
- package/dist/commonjs/log.js +28 -11
- package/dist/commonjs/log.js.map +7 -1
- package/dist/commonjs/models.js +33 -21
- package/dist/commonjs/models.js.map +7 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/commonjs/utils/constants.d.ts.map +1 -1
- package/dist/commonjs/utils/constants.js +151 -114
- package/dist/commonjs/utils/constants.js.map +7 -1
- package/dist/commonjs/utils/tracing.js +32 -16
- package/dist/commonjs/utils/tracing.js.map +7 -1
- package/dist/commonjs/utils/utils.common.js +242 -338
- package/dist/commonjs/utils/utils.common.js.map +7 -1
- package/dist/esm/AccountSASPermissions.js +111 -123
- package/dist/esm/AccountSASPermissions.js.map +7 -1
- package/dist/esm/AccountSASResourceTypes.js +58 -67
- package/dist/esm/AccountSASResourceTypes.js.map +7 -1
- package/dist/esm/AccountSASServices.js +66 -75
- package/dist/esm/AccountSASServices.js.map +7 -1
- package/dist/esm/AccountSASSignatureValues.js +62 -63
- package/dist/esm/AccountSASSignatureValues.js.map +7 -1
- package/dist/esm/Pipeline.d.ts +2 -3
- package/dist/esm/Pipeline.d.ts.map +1 -1
- package/dist/esm/Pipeline.js +239 -239
- package/dist/esm/Pipeline.js.map +7 -1
- package/dist/esm/QueueClient.d.ts +2 -1
- package/dist/esm/QueueClient.d.ts.map +1 -1
- package/dist/esm/QueueClient.js +689 -671
- package/dist/esm/QueueClient.js.map +7 -1
- package/dist/esm/QueueSASPermissions.js +68 -77
- package/dist/esm/QueueSASPermissions.js.map +7 -1
- package/dist/esm/QueueSASSignatureValues.d.ts +2 -1
- package/dist/esm/QueueSASSignatureValues.d.ts.map +1 -1
- package/dist/esm/QueueSASSignatureValues.js +124 -104
- package/dist/esm/QueueSASSignatureValues.js.map +7 -1
- package/dist/esm/QueueServiceClient.d.ts +28 -0
- package/dist/esm/QueueServiceClient.d.ts.map +1 -1
- package/dist/esm/QueueServiceClient.js +507 -457
- package/dist/esm/QueueServiceClient.js.map +7 -1
- package/dist/esm/SASQueryParameters.d.ts +6 -1
- package/dist/esm/SASQueryParameters.d.ts.map +1 -1
- package/dist/esm/SASQueryParameters.js +283 -262
- package/dist/esm/SASQueryParameters.js.map +7 -1
- package/dist/esm/SasIPRange.js +5 -12
- package/dist/esm/SasIPRange.js.map +7 -1
- package/dist/esm/StorageClient.js +50 -59
- package/dist/esm/StorageClient.js.map +7 -1
- package/dist/esm/StorageContextClient.js +10 -15
- package/dist/esm/StorageContextClient.js.map +7 -1
- package/dist/esm/generated/src/index.js +4 -9
- package/dist/esm/generated/src/index.js.map +7 -1
- package/dist/esm/generated/src/models/index.d.ts +4 -0
- package/dist/esm/generated/src/models/index.d.ts.map +1 -1
- package/dist/esm/generated/src/models/index.js +63 -126
- package/dist/esm/generated/src/models/index.js.map +7 -1
- package/dist/esm/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/esm/generated/src/models/mappers.js +1873 -1813
- package/dist/esm/generated/src/models/mappers.js.map +7 -1
- package/dist/esm/generated/src/models/parameters.js +330 -302
- package/dist/esm/generated/src/models/parameters.js.map +7 -1
- package/dist/esm/generated/src/operations/index.js +0 -8
- package/dist/esm/generated/src/operations/index.js.map +7 -1
- package/dist/esm/generated/src/operations/messageId.js +95 -92
- package/dist/esm/generated/src/operations/messageId.js.map +7 -1
- package/dist/esm/generated/src/operations/messages.js +178 -178
- package/dist/esm/generated/src/operations/messages.js.map +7 -1
- package/dist/esm/generated/src/operations/queue.js +208 -199
- package/dist/esm/generated/src/operations/queue.js.map +7 -1
- package/dist/esm/generated/src/operations/service.js +204 -192
- package/dist/esm/generated/src/operations/service.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/index.js +0 -8
- package/dist/esm/generated/src/operationsInterfaces/index.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/messageId.js +0 -9
- package/dist/esm/generated/src/operationsInterfaces/messageId.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/messages.js +0 -9
- package/dist/esm/generated/src/operationsInterfaces/messages.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/queue.js +0 -9
- package/dist/esm/generated/src/operationsInterfaces/queue.js.map +7 -1
- package/dist/esm/generated/src/operationsInterfaces/service.js +0 -9
- package/dist/esm/generated/src/operationsInterfaces/service.js.map +7 -1
- package/dist/esm/generated/src/storageClient.js +49 -54
- package/dist/esm/generated/src/storageClient.js.map +7 -1
- package/dist/esm/generatedModels.d.ts +2 -2
- package/dist/esm/generatedModels.d.ts.map +1 -1
- package/dist/esm/generatedModels.js +0 -4
- package/dist/esm/generatedModels.js.map +7 -1
- package/dist/esm/index.d.ts +9 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +50 -11
- package/dist/esm/index.js.map +7 -1
- package/dist/esm/log.js +4 -7
- package/dist/esm/log.js.map +7 -1
- package/dist/esm/models.js +10 -18
- package/dist/esm/models.js.map +7 -1
- package/dist/esm/utils/constants.d.ts.map +1 -1
- package/dist/esm/utils/constants.js +117 -111
- package/dist/esm/utils/constants.js.map +7 -1
- package/dist/esm/utils/tracing.js +7 -11
- package/dist/esm/utils/tracing.js.map +7 -1
- package/dist/esm/utils/utils.common.js +247 -358
- package/dist/esm/utils/utils.common.js.map +7 -1
- package/dist/react-native/Pipeline.d.ts +2 -3
- package/dist/react-native/Pipeline.d.ts.map +1 -1
- package/dist/react-native/Pipeline.js.map +1 -1
- package/dist/react-native/QueueClient.d.ts +2 -1
- package/dist/react-native/QueueClient.d.ts.map +1 -1
- package/dist/react-native/QueueClient.js.map +1 -1
- package/dist/react-native/QueueSASSignatureValues.d.ts +2 -1
- package/dist/react-native/QueueSASSignatureValues.d.ts.map +1 -1
- package/dist/react-native/QueueSASSignatureValues.js +2 -2
- package/dist/react-native/QueueSASSignatureValues.js.map +1 -1
- package/dist/react-native/QueueServiceClient.d.ts +28 -0
- package/dist/react-native/QueueServiceClient.d.ts.map +1 -1
- package/dist/react-native/QueueServiceClient.js +21 -13
- package/dist/react-native/QueueServiceClient.js.map +1 -1
- package/dist/react-native/SASQueryParameters.d.ts +6 -1
- package/dist/react-native/SASQueryParameters.d.ts.map +1 -1
- package/dist/react-native/SASQueryParameters.js +10 -0
- package/dist/react-native/SASQueryParameters.js.map +1 -1
- package/dist/react-native/generated/src/models/index.d.ts +4 -0
- package/dist/react-native/generated/src/models/index.d.ts.map +1 -1
- package/dist/react-native/generated/src/models/index.js.map +1 -1
- package/dist/react-native/generated/src/models/mappers.d.ts.map +1 -1
- package/dist/react-native/generated/src/models/mappers.js +14 -0
- package/dist/react-native/generated/src/models/mappers.js.map +1 -1
- package/dist/react-native/generated/src/models/parameters.js +1 -1
- package/dist/react-native/generated/src/models/parameters.js.map +1 -1
- package/dist/react-native/generated/src/storageClient.js +2 -2
- package/dist/react-native/generated/src/storageClient.js.map +1 -1
- package/dist/react-native/generatedModels.d.ts +2 -2
- package/dist/react-native/generatedModels.d.ts.map +1 -1
- package/dist/react-native/generatedModels.js.map +1 -1
- package/dist/react-native/index.d.ts +9 -9
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +0 -1
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/utils/constants.d.ts.map +1 -1
- package/dist/react-native/utils/constants.js +2 -2
- package/dist/react-native/utils/constants.js.map +1 -1
- package/package.json +2 -19
- package/dist/browser/index-browser.d.mts.map +0 -1
- package/dist/browser/index-browser.mjs.map +0 -1
|
@@ -1,277 +1,277 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 Pipeline_exports = {};
|
|
19
|
+
__export(Pipeline_exports, {
|
|
20
|
+
Pipeline: () => Pipeline,
|
|
21
|
+
StorageOAuthScopes: () => import_constants.StorageOAuthScopes,
|
|
22
|
+
getCoreClientOptions: () => getCoreClientOptions,
|
|
23
|
+
getCredentialFromPipeline: () => getCredentialFromPipeline,
|
|
24
|
+
isPipelineLike: () => isPipelineLike,
|
|
25
|
+
newPipeline: () => newPipeline
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(Pipeline_exports);
|
|
28
|
+
var import_core_http_compat = require("@azure/core-http-compat");
|
|
29
|
+
var import_core_rest_pipeline = require("@azure/core-rest-pipeline");
|
|
30
|
+
var import_core_client = require("@azure/core-client");
|
|
31
|
+
var import_core_xml = require("@azure/core-xml");
|
|
32
|
+
var import_core_auth = require("@azure/core-auth");
|
|
33
|
+
var import_log = require("./log.js");
|
|
34
|
+
var import_storage_common = require("@azure/storage-common");
|
|
35
|
+
var import_constants = require("./utils/constants.js");
|
|
24
36
|
function isPipelineLike(pipeline) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
typeof castPipeline.options === "object" &&
|
|
31
|
-
typeof castPipeline.toServiceClientOptions === "function");
|
|
37
|
+
if (!pipeline || typeof pipeline !== "object") {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const castPipeline = pipeline;
|
|
41
|
+
return Array.isArray(castPipeline.factories) && typeof castPipeline.options === "object" && typeof castPipeline.toServiceClientOptions === "function";
|
|
32
42
|
}
|
|
33
|
-
/**
|
|
34
|
-
* A Pipeline class containing HTTP request policies.
|
|
35
|
-
* You can create a default Pipeline by calling {@link newPipeline}.
|
|
36
|
-
* Or you can create a Pipeline with your own policies by the constructor of Pipeline.
|
|
37
|
-
*
|
|
38
|
-
* Refer to {@link newPipeline} and provided policies before implementing your
|
|
39
|
-
* customized Pipeline.
|
|
40
|
-
*/
|
|
41
43
|
class Pipeline {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
44
|
+
/**
|
|
45
|
+
* A list of chained request policy factories.
|
|
46
|
+
*/
|
|
47
|
+
factories;
|
|
48
|
+
/**
|
|
49
|
+
* Configures pipeline logger and HTTP client.
|
|
50
|
+
*/
|
|
51
|
+
options;
|
|
52
|
+
/**
|
|
53
|
+
* Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.
|
|
54
|
+
*
|
|
55
|
+
* @param factories -
|
|
56
|
+
* @param options -
|
|
57
|
+
*/
|
|
58
|
+
constructor(factories, options = {}) {
|
|
59
|
+
this.factories = factories;
|
|
60
|
+
this.options = options;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Transfer Pipeline object to ServiceClientOptions object which is required by
|
|
64
|
+
* ServiceClient constructor.
|
|
65
|
+
*
|
|
66
|
+
* @returns The ServiceClientOptions object from this Pipeline.
|
|
67
|
+
*/
|
|
68
|
+
toServiceClientOptions() {
|
|
69
|
+
return {
|
|
70
|
+
httpClient: this.options.httpClient,
|
|
71
|
+
requestPolicyFactories: this.factories
|
|
72
|
+
};
|
|
73
|
+
}
|
|
72
74
|
}
|
|
73
|
-
exports.Pipeline = Pipeline;
|
|
74
|
-
/**
|
|
75
|
-
* Creates a new Pipeline object with Credential provided.
|
|
76
|
-
*
|
|
77
|
-
* @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
|
|
78
|
-
* @param pipelineOptions - Optional. Options.
|
|
79
|
-
* @returns A new Pipeline object.
|
|
80
|
-
*/
|
|
81
75
|
function newPipeline(credential, pipelineOptions = {}) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
if (!credential) {
|
|
77
|
+
credential = new import_storage_common.AnonymousCredential();
|
|
78
|
+
}
|
|
79
|
+
const pipeline = new Pipeline([], pipelineOptions);
|
|
80
|
+
pipeline._credential = credential;
|
|
81
|
+
return pipeline;
|
|
88
82
|
}
|
|
89
83
|
function processDownlevelPipeline(pipeline) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
};
|
|
110
|
-
}
|
|
84
|
+
const knownFactoryFunctions = [
|
|
85
|
+
isAnonymousCredential,
|
|
86
|
+
isStorageSharedKeyCredential,
|
|
87
|
+
isCoreHttpBearerTokenFactory,
|
|
88
|
+
isStorageBrowserPolicyFactory,
|
|
89
|
+
isStorageRetryPolicyFactory,
|
|
90
|
+
isStorageTelemetryPolicyFactory,
|
|
91
|
+
isCoreHttpPolicyFactory
|
|
92
|
+
];
|
|
93
|
+
if (pipeline.factories.length) {
|
|
94
|
+
const novelFactories = pipeline.factories.filter((factory) => {
|
|
95
|
+
return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));
|
|
96
|
+
});
|
|
97
|
+
if (novelFactories.length) {
|
|
98
|
+
const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));
|
|
99
|
+
return {
|
|
100
|
+
wrappedPolicies: (0, import_core_http_compat.createRequestPolicyFactoryPolicy)(novelFactories),
|
|
101
|
+
afterRetry: hasInjector
|
|
102
|
+
};
|
|
111
103
|
}
|
|
112
|
-
|
|
104
|
+
}
|
|
105
|
+
return void 0;
|
|
113
106
|
}
|
|
114
107
|
function getCoreClientOptions(pipeline) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
xmlCharKey: "#",
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
deserializationOptions: {
|
|
148
|
-
parseXML: core_xml_1.parseXML,
|
|
149
|
-
serializerOptions: {
|
|
150
|
-
xml: {
|
|
151
|
-
// Use customized XML char key of "#" so we can deserialize metadata
|
|
152
|
-
// with "_" key
|
|
153
|
-
xmlCharKey: "#",
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
corePipeline.removePolicy({ phase: "Retry" });
|
|
159
|
-
corePipeline.removePolicy({ name: core_rest_pipeline_1.decompressResponsePolicyName });
|
|
160
|
-
corePipeline.addPolicy((0, storage_common_1.storageCorrectContentLengthPolicy)());
|
|
161
|
-
corePipeline.addPolicy((0, storage_common_1.storageRetryPolicy)(restOptions.retryOptions), { phase: "Retry" });
|
|
162
|
-
corePipeline.addPolicy((0, storage_common_1.storageRequestFailureDetailsParserPolicy)());
|
|
163
|
-
corePipeline.addPolicy((0, storage_common_1.storageBrowserPolicy)());
|
|
164
|
-
const downlevelResults = processDownlevelPipeline(pipeline);
|
|
165
|
-
if (downlevelResults) {
|
|
166
|
-
corePipeline.addPolicy(downlevelResults.wrappedPolicies, downlevelResults.afterRetry ? { afterPhase: "Retry" } : undefined);
|
|
167
|
-
}
|
|
168
|
-
const credential = getCredentialFromPipeline(pipeline);
|
|
169
|
-
if ((0, core_auth_1.isTokenCredential)(credential)) {
|
|
170
|
-
corePipeline.addPolicy((0, core_rest_pipeline_1.bearerTokenAuthenticationPolicy)({
|
|
171
|
-
credential,
|
|
172
|
-
scopes: restOptions.audience ?? constants_js_1.StorageOAuthScopes,
|
|
173
|
-
challengeCallbacks: { authorizeRequestOnChallenge: core_client_1.authorizeRequestOnTenantChallenge },
|
|
174
|
-
}), { phase: "Sign" });
|
|
108
|
+
const { httpClient: v1Client, ...restOptions } = pipeline.options;
|
|
109
|
+
let httpClient = pipeline._coreHttpClient;
|
|
110
|
+
if (!httpClient) {
|
|
111
|
+
httpClient = v1Client ? (0, import_core_http_compat.convertHttpClient)(v1Client) : (0, import_storage_common.getCachedDefaultHttpClient)();
|
|
112
|
+
pipeline._coreHttpClient = httpClient;
|
|
113
|
+
}
|
|
114
|
+
let corePipeline = pipeline._corePipeline;
|
|
115
|
+
if (!corePipeline) {
|
|
116
|
+
const packageDetails = `azsdk-js-azure-storage-blob/${import_constants.SDK_VERSION}`;
|
|
117
|
+
const userAgentPrefix = restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}` : `${packageDetails}`;
|
|
118
|
+
corePipeline = (0, import_core_client.createClientPipeline)({
|
|
119
|
+
...restOptions,
|
|
120
|
+
loggingOptions: {
|
|
121
|
+
additionalAllowedHeaderNames: import_constants.StorageQueueLoggingAllowedHeaderNames,
|
|
122
|
+
additionalAllowedQueryParameters: import_constants.StorageQueueLoggingAllowedQueryParameters,
|
|
123
|
+
logger: import_log.logger.info
|
|
124
|
+
},
|
|
125
|
+
userAgentOptions: {
|
|
126
|
+
userAgentPrefix
|
|
127
|
+
},
|
|
128
|
+
serializationOptions: {
|
|
129
|
+
stringifyXML: import_core_xml.stringifyXML,
|
|
130
|
+
serializerOptions: {
|
|
131
|
+
xml: {
|
|
132
|
+
// Use customized XML char key of "#" so we can deserialize metadata
|
|
133
|
+
// with "_" key
|
|
134
|
+
xmlCharKey: "#"
|
|
135
|
+
}
|
|
175
136
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
137
|
+
},
|
|
138
|
+
deserializationOptions: {
|
|
139
|
+
parseXML: import_core_xml.parseXML,
|
|
140
|
+
serializerOptions: {
|
|
141
|
+
xml: {
|
|
142
|
+
// Use customized XML char key of "#" so we can deserialize metadata
|
|
143
|
+
// with "_" key
|
|
144
|
+
xmlCharKey: "#"
|
|
145
|
+
}
|
|
181
146
|
}
|
|
182
|
-
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
corePipeline.removePolicy({ phase: "Retry" });
|
|
150
|
+
corePipeline.removePolicy({ name: import_core_rest_pipeline.decompressResponsePolicyName });
|
|
151
|
+
corePipeline.addPolicy((0, import_storage_common.storageCorrectContentLengthPolicy)());
|
|
152
|
+
corePipeline.addPolicy((0, import_storage_common.storageRetryPolicy)(restOptions.retryOptions), { phase: "Retry" });
|
|
153
|
+
corePipeline.addPolicy((0, import_storage_common.storageRequestFailureDetailsParserPolicy)());
|
|
154
|
+
corePipeline.addPolicy((0, import_storage_common.storageBrowserPolicy)());
|
|
155
|
+
const downlevelResults = processDownlevelPipeline(pipeline);
|
|
156
|
+
if (downlevelResults) {
|
|
157
|
+
corePipeline.addPolicy(
|
|
158
|
+
downlevelResults.wrappedPolicies,
|
|
159
|
+
downlevelResults.afterRetry ? { afterPhase: "Retry" } : void 0
|
|
160
|
+
);
|
|
183
161
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
162
|
+
const credential = getCredentialFromPipeline(pipeline);
|
|
163
|
+
if ((0, import_core_auth.isTokenCredential)(credential)) {
|
|
164
|
+
corePipeline.addPolicy(
|
|
165
|
+
(0, import_core_rest_pipeline.bearerTokenAuthenticationPolicy)({
|
|
166
|
+
credential,
|
|
167
|
+
scopes: restOptions.audience ?? import_constants.StorageOAuthScopes,
|
|
168
|
+
challengeCallbacks: { authorizeRequestOnChallenge: import_core_client.authorizeRequestOnTenantChallenge }
|
|
169
|
+
}),
|
|
170
|
+
{ phase: "Sign" }
|
|
171
|
+
);
|
|
172
|
+
} else if (credential instanceof import_storage_common.StorageSharedKeyCredential) {
|
|
173
|
+
corePipeline.addPolicy(
|
|
174
|
+
(0, import_storage_common.storageSharedKeyCredentialPolicy)({
|
|
175
|
+
accountName: credential.accountName,
|
|
176
|
+
accountKey: credential.accountKey
|
|
177
|
+
}),
|
|
178
|
+
{ phase: "Sign" }
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
pipeline._corePipeline = corePipeline;
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
...restOptions,
|
|
185
|
+
allowInsecureConnection: true,
|
|
186
|
+
httpClient,
|
|
187
|
+
pipeline: corePipeline
|
|
188
|
+
};
|
|
190
189
|
}
|
|
191
190
|
function getCredentialFromPipeline(pipeline) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
// We do that in newPipeline() when using TokenCredential.
|
|
202
|
-
credential = factory.credential;
|
|
203
|
-
}
|
|
204
|
-
else if (isStorageSharedKeyCredential(factory)) {
|
|
205
|
-
return factory;
|
|
206
|
-
}
|
|
191
|
+
if (pipeline._credential) {
|
|
192
|
+
return pipeline._credential;
|
|
193
|
+
}
|
|
194
|
+
let credential = new import_storage_common.AnonymousCredential();
|
|
195
|
+
for (const factory of pipeline.factories) {
|
|
196
|
+
if ((0, import_core_auth.isTokenCredential)(factory.credential)) {
|
|
197
|
+
credential = factory.credential;
|
|
198
|
+
} else if (isStorageSharedKeyCredential(factory)) {
|
|
199
|
+
return factory;
|
|
207
200
|
}
|
|
208
|
-
|
|
201
|
+
}
|
|
202
|
+
return credential;
|
|
209
203
|
}
|
|
210
204
|
function isStorageSharedKeyCredential(factory) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
205
|
+
if (factory instanceof import_storage_common.StorageSharedKeyCredential) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
return factory.constructor.name === "StorageSharedKeyCredential";
|
|
215
209
|
}
|
|
216
210
|
function isAnonymousCredential(factory) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
211
|
+
if (factory instanceof import_storage_common.AnonymousCredential) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
return factory.constructor.name === "AnonymousCredential";
|
|
221
215
|
}
|
|
222
216
|
function isCoreHttpBearerTokenFactory(factory) {
|
|
223
|
-
|
|
217
|
+
return (0, import_core_auth.isTokenCredential)(factory.credential);
|
|
224
218
|
}
|
|
225
219
|
function isStorageBrowserPolicyFactory(factory) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
220
|
+
if (factory instanceof import_storage_common.StorageBrowserPolicyFactory) {
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
return factory.constructor.name === "StorageBrowserPolicyFactory";
|
|
230
224
|
}
|
|
231
225
|
function isStorageRetryPolicyFactory(factory) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
226
|
+
if (factory instanceof import_storage_common.StorageRetryPolicyFactory) {
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
return factory.constructor.name === "StorageRetryPolicyFactory";
|
|
236
230
|
}
|
|
237
231
|
function isStorageTelemetryPolicyFactory(factory) {
|
|
238
|
-
|
|
232
|
+
return factory.constructor.name === "TelemetryPolicyFactory";
|
|
239
233
|
}
|
|
240
234
|
function isInjectorPolicyFactory(factory) {
|
|
241
|
-
|
|
235
|
+
return factory.constructor.name === "InjectorPolicyFactory";
|
|
242
236
|
}
|
|
243
237
|
function isCoreHttpPolicyFactory(factory) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return policyName.startsWith(knownPolicyName);
|
|
275
|
-
});
|
|
238
|
+
const knownPolicies = [
|
|
239
|
+
"GenerateClientRequestIdPolicy",
|
|
240
|
+
"TracingPolicy",
|
|
241
|
+
"LogPolicy",
|
|
242
|
+
"ProxyPolicy",
|
|
243
|
+
"DisableResponseDecompressionPolicy",
|
|
244
|
+
"KeepAlivePolicy",
|
|
245
|
+
"DeserializationPolicy"
|
|
246
|
+
];
|
|
247
|
+
const mockHttpClient = {
|
|
248
|
+
sendRequest: async (request) => {
|
|
249
|
+
return {
|
|
250
|
+
request,
|
|
251
|
+
headers: request.headers.clone(),
|
|
252
|
+
status: 500
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
const mockRequestPolicyOptions = {
|
|
257
|
+
log(_logLevel, _message) {
|
|
258
|
+
},
|
|
259
|
+
shouldLog(_logLevel) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);
|
|
264
|
+
const policyName = policyInstance.constructor.name;
|
|
265
|
+
return knownPolicies.some((knownPolicyName) => {
|
|
266
|
+
return policyName.startsWith(knownPolicyName);
|
|
267
|
+
});
|
|
276
268
|
}
|
|
277
|
-
|
|
269
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
270
|
+
0 && (module.exports = {
|
|
271
|
+
Pipeline,
|
|
272
|
+
StorageOAuthScopes,
|
|
273
|
+
getCoreClientOptions,
|
|
274
|
+
getCredentialFromPipeline,
|
|
275
|
+
isPipelineLike,
|
|
276
|
+
newPipeline
|
|
277
|
+
});
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{"version":3,"file":"Pipeline.js","sourceRoot":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AAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n KeepAliveOptions,\n ExtendedServiceClientOptions,\n HttpPipelineLogLevel,\n} from \"@azure/core-http-compat\";\nimport {\n CompatResponse as HttpOperationResponse,\n RequestPolicy as IHttpClient,\n HttpHeadersLike as HttpHeaders,\n RequestPolicy,\n RequestPolicyFactory,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n WebResourceLike as WebResource,\n convertHttpClient,\n createRequestPolicyFactoryPolicy,\n} from \"@azure/core-http-compat\";\nimport type {\n ProxySettings as ProxyOptions,\n UserAgentPolicyOptions as UserAgentOptions,\n Pipeline as CorePipeline,\n PipelinePolicy,\n HttpClient,\n} from \"@azure/core-rest-pipeline\";\nimport {\n RequestBodyType as HttpRequestBody,\n bearerTokenAuthenticationPolicy,\n decompressResponsePolicyName,\n} from \"@azure/core-rest-pipeline\";\nimport { authorizeRequestOnTenantChallenge, createClientPipeline } from \"@azure/core-client\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\n\nimport { logger } from \"./log.js\";\nimport type { StorageRetryOptions } from \"@azure/storage-common\";\nimport {\n StorageRetryPolicyFactory,\n StorageSharedKeyCredential,\n AnonymousCredential,\n getCachedDefaultHttpClient,\n storageBrowserPolicy,\n storageRetryPolicy,\n storageSharedKeyCredentialPolicy,\n StorageBrowserPolicyFactory,\n storageCorrectContentLengthPolicy,\n storageRequestFailureDetailsParserPolicy,\n} from \"@azure/storage-common\";\nimport {\n StorageOAuthScopes,\n StorageQueueLoggingAllowedHeaderNames,\n StorageQueueLoggingAllowedQueryParameters,\n SDK_VERSION,\n} from \"./utils/constants.js\";\n\n// Export following interfaces and types for customers who want to implement their\n// own RequestPolicy or HTTPClient\nexport {\n StorageOAuthScopes,\n IHttpClient,\n HttpHeaders,\n HttpRequestBody,\n HttpOperationResponse,\n WebResource,\n RequestPolicyFactory,\n RequestPolicy,\n RequestPolicyOptions,\n};\n\n/**\n * A subset of `@azure/core-http` ServiceClientOptions\n */\nexport interface ServiceClientOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * Optional. Overrides the default policy factories.\n */\n requestPolicyFactories?:\n | RequestPolicyFactory[]\n | ((defaultRequestPolicyFactories: RequestPolicyFactory[]) => void | RequestPolicyFactory[]);\n}\n\n/**\n * Option interface for Pipeline constructor.\n */\nexport interface PipelineOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n}\n\n/**\n * An interface for the {@link Pipeline} class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport interface PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n readonly options: PipelineOptions;\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n toServiceClientOptions(): ServiceClientOptions;\n}\n\n/**\n * A helper to decide if a given argument satisfies the Pipeline contract\n * @param pipeline - An argument that may be a Pipeline\n * @returns true when the argument satisfies the Pipeline contract\n */\nexport function isPipelineLike(pipeline: unknown): pipeline is PipelineLike {\n if (!pipeline || typeof pipeline !== \"object\") {\n return false;\n }\n\n const castPipeline = pipeline as PipelineLike;\n\n return (\n Array.isArray(castPipeline.factories) &&\n typeof castPipeline.options === \"object\" &&\n typeof castPipeline.toServiceClientOptions === \"function\"\n );\n}\n\n/**\n * A Pipeline class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport class Pipeline implements PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n public readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n public readonly options: PipelineOptions;\n\n /**\n * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.\n *\n * @param factories -\n * @param options -\n */\n constructor(factories: RequestPolicyFactory[], options: PipelineOptions = {}) {\n this.factories = factories;\n this.options = options;\n }\n\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n public toServiceClientOptions(): ServiceClientOptions {\n return {\n httpClient: this.options.httpClient,\n requestPolicyFactories: this.factories,\n };\n }\n}\n\n/**\n * Options interface for the {@link newPipeline} function.\n */\nexport interface StoragePipelineOptions {\n /**\n * Options to configure a proxy for outgoing requests.\n */\n proxyOptions?: ProxyOptions;\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentOptions;\n /**\n * Configures the built-in retry policy behavior.\n */\n retryOptions?: StorageRetryOptions;\n /**\n * Keep alive configurations. Default keep-alive is enabled.\n */\n keepAliveOptions?: KeepAliveOptions;\n /**\n * Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * The audience used to retrieve an AAD token.\n * By default, audience 'https://storage.azure.com/.default' will be used.\n */\n audience?: string;\n}\n\n/**\n * Creates a new Pipeline object with Credential provided.\n *\n * @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.\n * @param pipelineOptions - Optional. Options.\n * @returns A new Pipeline object.\n */\nexport function newPipeline(\n credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential,\n pipelineOptions: StoragePipelineOptions = {},\n): Pipeline {\n if (!credential) {\n credential = new AnonymousCredential();\n }\n const pipeline = new Pipeline([], pipelineOptions);\n (pipeline as any)._credential = credential;\n return pipeline;\n}\n\nfunction processDownlevelPipeline(\n pipeline: PipelineLike,\n): { wrappedPolicies: PipelinePolicy; afterRetry: boolean } | undefined {\n const knownFactoryFunctions = [\n isAnonymousCredential,\n isStorageSharedKeyCredential,\n isCoreHttpBearerTokenFactory,\n isStorageBrowserPolicyFactory,\n isStorageRetryPolicyFactory,\n isStorageTelemetryPolicyFactory,\n isCoreHttpPolicyFactory,\n ];\n if (pipeline.factories.length) {\n const novelFactories = pipeline.factories.filter((factory) => {\n return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));\n });\n if (novelFactories.length) {\n const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));\n // if there are any left over, wrap in a requestPolicyFactoryPolicy\n return {\n wrappedPolicies: createRequestPolicyFactoryPolicy(novelFactories),\n afterRetry: hasInjector,\n };\n }\n }\n return undefined;\n}\n\nexport function getCoreClientOptions(pipeline: PipelineLike): ExtendedServiceClientOptions {\n const { httpClient: v1Client, ...restOptions } = pipeline.options as StoragePipelineOptions;\n\n let httpClient: HttpClient = (pipeline as any)._coreHttpClient;\n if (!httpClient) {\n httpClient = v1Client ? convertHttpClient(v1Client) : getCachedDefaultHttpClient();\n (pipeline as any)._coreHttpClient = httpClient;\n }\n\n let corePipeline: CorePipeline = (pipeline as any)._corePipeline;\n if (!corePipeline) {\n const packageDetails = `azsdk-js-azure-storage-blob/${SDK_VERSION}`;\n const userAgentPrefix =\n restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix\n ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n corePipeline = createClientPipeline({\n ...restOptions,\n loggingOptions: {\n additionalAllowedHeaderNames: StorageQueueLoggingAllowedHeaderNames,\n additionalAllowedQueryParameters: StorageQueueLoggingAllowedQueryParameters,\n logger: logger.info,\n },\n userAgentOptions: {\n userAgentPrefix,\n },\n serializationOptions: {\n stringifyXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n deserializationOptions: {\n parseXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n });\n corePipeline.removePolicy({ phase: \"Retry\" });\n corePipeline.removePolicy({ name: decompressResponsePolicyName });\n corePipeline.addPolicy(storageCorrectContentLengthPolicy());\n corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: \"Retry\" });\n corePipeline.addPolicy(storageRequestFailureDetailsParserPolicy());\n corePipeline.addPolicy(storageBrowserPolicy());\n const downlevelResults = processDownlevelPipeline(pipeline);\n if (downlevelResults) {\n corePipeline.addPolicy(\n downlevelResults.wrappedPolicies,\n downlevelResults.afterRetry ? { afterPhase: \"Retry\" } : undefined,\n );\n }\n const credential = getCredentialFromPipeline(pipeline);\n if (isTokenCredential(credential)) {\n corePipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: restOptions.audience ?? StorageOAuthScopes,\n challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge },\n }),\n { phase: \"Sign\" },\n );\n } else if (credential instanceof StorageSharedKeyCredential) {\n corePipeline.addPolicy(\n storageSharedKeyCredentialPolicy({\n accountName: credential.accountName,\n accountKey: (credential as any).accountKey,\n }),\n { phase: \"Sign\" },\n );\n }\n (pipeline as any)._corePipeline = corePipeline;\n }\n return {\n ...restOptions,\n allowInsecureConnection: true,\n httpClient,\n pipeline: corePipeline,\n };\n}\n\nexport function getCredentialFromPipeline(\n pipeline: PipelineLike,\n): StorageSharedKeyCredential | AnonymousCredential | TokenCredential {\n // see if we squirreled one away on the type itself\n if ((pipeline as any)._credential) {\n return (pipeline as any)._credential;\n }\n // if it came from another package, loop over the factories and look for one like before\n let credential = new AnonymousCredential();\n for (const factory of pipeline.factories) {\n if (isTokenCredential((factory as any).credential)) {\n // Only works if the factory has been attached a \"credential\" property.\n // We do that in newPipeline() when using TokenCredential.\n credential = (factory as any).credential;\n } else if (isStorageSharedKeyCredential(factory)) {\n return factory;\n }\n }\n return credential;\n}\n\nfunction isStorageSharedKeyCredential(\n factory: RequestPolicyFactory,\n): factory is StorageSharedKeyCredential {\n if (factory instanceof StorageSharedKeyCredential) {\n return true;\n }\n return factory.constructor.name === \"StorageSharedKeyCredential\";\n}\n\nfunction isAnonymousCredential(factory: RequestPolicyFactory): factory is AnonymousCredential {\n if (factory instanceof AnonymousCredential) {\n return true;\n }\n return factory.constructor.name === \"AnonymousCredential\";\n}\n\nfunction isCoreHttpBearerTokenFactory(factory: RequestPolicyFactory): boolean {\n return isTokenCredential((factory as any).credential);\n}\n\nfunction isStorageBrowserPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageBrowserPolicyFactory {\n if (factory instanceof StorageBrowserPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageBrowserPolicyFactory\";\n}\n\nfunction isStorageRetryPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageRetryPolicyFactory {\n if (factory instanceof StorageRetryPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageRetryPolicyFactory\";\n}\n\nfunction isStorageTelemetryPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"TelemetryPolicyFactory\";\n}\n\nfunction isInjectorPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"InjectorPolicyFactory\";\n}\n\nfunction isCoreHttpPolicyFactory(factory: RequestPolicyFactory): boolean {\n const knownPolicies = [\n \"GenerateClientRequestIdPolicy\",\n \"TracingPolicy\",\n \"LogPolicy\",\n \"ProxyPolicy\",\n \"DisableResponseDecompressionPolicy\",\n \"KeepAlivePolicy\",\n \"DeserializationPolicy\",\n ];\n\n const mockHttpClient: IHttpClient = {\n sendRequest: async (request: WebResource) => {\n return {\n request,\n headers: request.headers.clone(),\n status: 500,\n };\n },\n };\n const mockRequestPolicyOptions: RequestPolicyOptions = {\n log(_logLevel: HttpPipelineLogLevel, _message: string): void {\n /* do nothing */\n },\n shouldLog(_logLevel: HttpPipelineLogLevel): boolean {\n return false;\n },\n };\n const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);\n const policyName = policyInstance.constructor.name;\n // bundlers sometimes add a custom suffix to the class name to make it unique\n return knownPolicies.some((knownPolicyName) => {\n return policyName.startsWith(knownPolicyName);\n });\n}\n"]}
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["/mnt/vss/_work/1/s/sdk/storage/storage-queue/src/Pipeline.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n KeepAliveOptions,\n ExtendedServiceClientOptions,\n HttpPipelineLogLevel,\n} from \"@azure/core-http-compat\";\nimport {\n CompatResponse as HttpOperationResponse,\n RequestPolicy as IHttpClient,\n HttpHeadersLike as HttpHeaders,\n RequestPolicy,\n RequestPolicyFactory,\n RequestPolicyOptionsLike as RequestPolicyOptions,\n WebResourceLike as WebResource,\n convertHttpClient,\n createRequestPolicyFactoryPolicy,\n} from \"@azure/core-http-compat\";\nimport type {\n ProxySettings as ProxyOptions,\n UserAgentPolicyOptions as UserAgentOptions,\n Pipeline as CorePipeline,\n PipelinePolicy,\n HttpClient,\n RequestBodyType as HttpRequestBody,\n} from \"@azure/core-rest-pipeline\";\nimport {\n bearerTokenAuthenticationPolicy,\n decompressResponsePolicyName,\n} from \"@azure/core-rest-pipeline\";\nimport { authorizeRequestOnTenantChallenge, createClientPipeline } from \"@azure/core-client\";\nimport { parseXML, stringifyXML } from \"@azure/core-xml\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\n\nimport { logger } from \"./log.js\";\nimport type { StorageRetryOptions } from \"@azure/storage-common\";\nimport {\n StorageRetryPolicyFactory,\n StorageSharedKeyCredential,\n AnonymousCredential,\n getCachedDefaultHttpClient,\n storageBrowserPolicy,\n storageRetryPolicy,\n storageSharedKeyCredentialPolicy,\n StorageBrowserPolicyFactory,\n storageCorrectContentLengthPolicy,\n storageRequestFailureDetailsParserPolicy,\n} from \"@azure/storage-common\";\nimport {\n StorageOAuthScopes,\n StorageQueueLoggingAllowedHeaderNames,\n StorageQueueLoggingAllowedQueryParameters,\n SDK_VERSION,\n} from \"./utils/constants.js\";\n\n// Export following interfaces and types for customers who want to implement their\n// own RequestPolicy or HTTPClient\nexport {\n StorageOAuthScopes,\n type IHttpClient,\n type HttpHeaders,\n type HttpRequestBody,\n type HttpOperationResponse,\n type WebResource,\n type RequestPolicyFactory,\n type RequestPolicy,\n type RequestPolicyOptions,\n};\n\n/**\n * A subset of `@azure/core-http` ServiceClientOptions\n */\nexport interface ServiceClientOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * Optional. Overrides the default policy factories.\n */\n requestPolicyFactories?:\n | RequestPolicyFactory[]\n | ((defaultRequestPolicyFactories: RequestPolicyFactory[]) => void | RequestPolicyFactory[]);\n}\n\n/**\n * Option interface for Pipeline constructor.\n */\nexport interface PipelineOptions {\n /**\n * Optional. Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n}\n\n/**\n * An interface for the {@link Pipeline} class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport interface PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n readonly options: PipelineOptions;\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n toServiceClientOptions(): ServiceClientOptions;\n}\n\n/**\n * A helper to decide if a given argument satisfies the Pipeline contract\n * @param pipeline - An argument that may be a Pipeline\n * @returns true when the argument satisfies the Pipeline contract\n */\nexport function isPipelineLike(pipeline: unknown): pipeline is PipelineLike {\n if (!pipeline || typeof pipeline !== \"object\") {\n return false;\n }\n\n const castPipeline = pipeline as PipelineLike;\n\n return (\n Array.isArray(castPipeline.factories) &&\n typeof castPipeline.options === \"object\" &&\n typeof castPipeline.toServiceClientOptions === \"function\"\n );\n}\n\n/**\n * A Pipeline class containing HTTP request policies.\n * You can create a default Pipeline by calling {@link newPipeline}.\n * Or you can create a Pipeline with your own policies by the constructor of Pipeline.\n *\n * Refer to {@link newPipeline} and provided policies before implementing your\n * customized Pipeline.\n */\nexport class Pipeline implements PipelineLike {\n /**\n * A list of chained request policy factories.\n */\n public readonly factories: RequestPolicyFactory[];\n /**\n * Configures pipeline logger and HTTP client.\n */\n public readonly options: PipelineOptions;\n\n /**\n * Creates an instance of Pipeline. Customize HTTPClient by implementing IHttpClient interface.\n *\n * @param factories -\n * @param options -\n */\n constructor(factories: RequestPolicyFactory[], options: PipelineOptions = {}) {\n this.factories = factories;\n this.options = options;\n }\n\n /**\n * Transfer Pipeline object to ServiceClientOptions object which is required by\n * ServiceClient constructor.\n *\n * @returns The ServiceClientOptions object from this Pipeline.\n */\n public toServiceClientOptions(): ServiceClientOptions {\n return {\n httpClient: this.options.httpClient,\n requestPolicyFactories: this.factories,\n };\n }\n}\n\n/**\n * Options interface for the {@link newPipeline} function.\n */\nexport interface StoragePipelineOptions {\n /**\n * Options to configure a proxy for outgoing requests.\n */\n proxyOptions?: ProxyOptions;\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentOptions;\n /**\n * Configures the built-in retry policy behavior.\n */\n retryOptions?: StorageRetryOptions;\n /**\n * Keep alive configurations. Default keep-alive is enabled.\n */\n keepAliveOptions?: KeepAliveOptions;\n /**\n * Configures the HTTP client to send requests and receive responses.\n */\n httpClient?: IHttpClient;\n /**\n * The audience used to retrieve an AAD token.\n * By default, audience 'https://storage.azure.com/.default' will be used.\n */\n audience?: string;\n}\n\n/**\n * Creates a new Pipeline object with Credential provided.\n *\n * @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.\n * @param pipelineOptions - Optional. Options.\n * @returns A new Pipeline object.\n */\nexport function newPipeline(\n credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential,\n pipelineOptions: StoragePipelineOptions = {},\n): Pipeline {\n if (!credential) {\n credential = new AnonymousCredential();\n }\n const pipeline = new Pipeline([], pipelineOptions);\n (pipeline as any)._credential = credential;\n return pipeline;\n}\n\nfunction processDownlevelPipeline(\n pipeline: PipelineLike,\n): { wrappedPolicies: PipelinePolicy; afterRetry: boolean } | undefined {\n const knownFactoryFunctions = [\n isAnonymousCredential,\n isStorageSharedKeyCredential,\n isCoreHttpBearerTokenFactory,\n isStorageBrowserPolicyFactory,\n isStorageRetryPolicyFactory,\n isStorageTelemetryPolicyFactory,\n isCoreHttpPolicyFactory,\n ];\n if (pipeline.factories.length) {\n const novelFactories = pipeline.factories.filter((factory) => {\n return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));\n });\n if (novelFactories.length) {\n const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));\n // if there are any left over, wrap in a requestPolicyFactoryPolicy\n return {\n wrappedPolicies: createRequestPolicyFactoryPolicy(novelFactories),\n afterRetry: hasInjector,\n };\n }\n }\n return undefined;\n}\n\nexport function getCoreClientOptions(pipeline: PipelineLike): ExtendedServiceClientOptions {\n const { httpClient: v1Client, ...restOptions } = pipeline.options as StoragePipelineOptions;\n\n let httpClient: HttpClient = (pipeline as any)._coreHttpClient;\n if (!httpClient) {\n httpClient = v1Client ? convertHttpClient(v1Client) : getCachedDefaultHttpClient();\n (pipeline as any)._coreHttpClient = httpClient;\n }\n\n let corePipeline: CorePipeline = (pipeline as any)._corePipeline;\n if (!corePipeline) {\n const packageDetails = `azsdk-js-azure-storage-blob/${SDK_VERSION}`;\n const userAgentPrefix =\n restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix\n ? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n corePipeline = createClientPipeline({\n ...restOptions,\n loggingOptions: {\n additionalAllowedHeaderNames: StorageQueueLoggingAllowedHeaderNames,\n additionalAllowedQueryParameters: StorageQueueLoggingAllowedQueryParameters,\n logger: logger.info,\n },\n userAgentOptions: {\n userAgentPrefix,\n },\n serializationOptions: {\n stringifyXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n deserializationOptions: {\n parseXML,\n serializerOptions: {\n xml: {\n // Use customized XML char key of \"#\" so we can deserialize metadata\n // with \"_\" key\n xmlCharKey: \"#\",\n },\n },\n },\n });\n corePipeline.removePolicy({ phase: \"Retry\" });\n corePipeline.removePolicy({ name: decompressResponsePolicyName });\n corePipeline.addPolicy(storageCorrectContentLengthPolicy());\n corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: \"Retry\" });\n corePipeline.addPolicy(storageRequestFailureDetailsParserPolicy());\n corePipeline.addPolicy(storageBrowserPolicy());\n const downlevelResults = processDownlevelPipeline(pipeline);\n if (downlevelResults) {\n corePipeline.addPolicy(\n downlevelResults.wrappedPolicies,\n downlevelResults.afterRetry ? { afterPhase: \"Retry\" } : undefined,\n );\n }\n const credential = getCredentialFromPipeline(pipeline);\n if (isTokenCredential(credential)) {\n corePipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: restOptions.audience ?? StorageOAuthScopes,\n challengeCallbacks: { authorizeRequestOnChallenge: authorizeRequestOnTenantChallenge },\n }),\n { phase: \"Sign\" },\n );\n } else if (credential instanceof StorageSharedKeyCredential) {\n corePipeline.addPolicy(\n storageSharedKeyCredentialPolicy({\n accountName: credential.accountName,\n accountKey: (credential as any).accountKey,\n }),\n { phase: \"Sign\" },\n );\n }\n (pipeline as any)._corePipeline = corePipeline;\n }\n return {\n ...restOptions,\n allowInsecureConnection: true,\n httpClient,\n pipeline: corePipeline,\n };\n}\n\nexport function getCredentialFromPipeline(\n pipeline: PipelineLike,\n): StorageSharedKeyCredential | AnonymousCredential | TokenCredential {\n // see if we squirreled one away on the type itself\n if ((pipeline as any)._credential) {\n return (pipeline as any)._credential;\n }\n // if it came from another package, loop over the factories and look for one like before\n let credential = new AnonymousCredential();\n for (const factory of pipeline.factories) {\n if (isTokenCredential((factory as any).credential)) {\n // Only works if the factory has been attached a \"credential\" property.\n // We do that in newPipeline() when using TokenCredential.\n credential = (factory as any).credential;\n } else if (isStorageSharedKeyCredential(factory)) {\n return factory;\n }\n }\n return credential;\n}\n\nfunction isStorageSharedKeyCredential(\n factory: RequestPolicyFactory,\n): factory is StorageSharedKeyCredential {\n if (factory instanceof StorageSharedKeyCredential) {\n return true;\n }\n return factory.constructor.name === \"StorageSharedKeyCredential\";\n}\n\nfunction isAnonymousCredential(factory: RequestPolicyFactory): factory is AnonymousCredential {\n if (factory instanceof AnonymousCredential) {\n return true;\n }\n return factory.constructor.name === \"AnonymousCredential\";\n}\n\nfunction isCoreHttpBearerTokenFactory(factory: RequestPolicyFactory): boolean {\n return isTokenCredential((factory as any).credential);\n}\n\nfunction isStorageBrowserPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageBrowserPolicyFactory {\n if (factory instanceof StorageBrowserPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageBrowserPolicyFactory\";\n}\n\nfunction isStorageRetryPolicyFactory(\n factory: RequestPolicyFactory,\n): factory is StorageRetryPolicyFactory {\n if (factory instanceof StorageRetryPolicyFactory) {\n return true;\n }\n return factory.constructor.name === \"StorageRetryPolicyFactory\";\n}\n\nfunction isStorageTelemetryPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"TelemetryPolicyFactory\";\n}\n\nfunction isInjectorPolicyFactory(factory: RequestPolicyFactory): boolean {\n return factory.constructor.name === \"InjectorPolicyFactory\";\n}\n\nfunction isCoreHttpPolicyFactory(factory: RequestPolicyFactory): boolean {\n const knownPolicies = [\n \"GenerateClientRequestIdPolicy\",\n \"TracingPolicy\",\n \"LogPolicy\",\n \"ProxyPolicy\",\n \"DisableResponseDecompressionPolicy\",\n \"KeepAlivePolicy\",\n \"DeserializationPolicy\",\n ];\n\n const mockHttpClient: IHttpClient = {\n sendRequest: async (request: WebResource) => {\n return {\n request,\n headers: request.headers.clone(),\n status: 500,\n };\n },\n };\n const mockRequestPolicyOptions: RequestPolicyOptions = {\n log(_logLevel: HttpPipelineLogLevel, _message: string): void {\n /* do nothing */\n },\n shouldLog(_logLevel: HttpPipelineLogLevel): boolean {\n return false;\n },\n };\n const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);\n const policyName = policyInstance.constructor.name;\n // bundlers sometimes add a custom suffix to the class name to make it unique\n return knownPolicies.some((knownPolicyName) => {\n return policyName.startsWith(knownPolicyName);\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,8BAUO;AASP,gCAGO;AACP,yBAAwE;AACxE,sBAAuC;AAEvC,uBAAkC;AAElC,iBAAuB;AAEvB,4BAWO;AACP,uBAKO;AAyEA,SAAS,eAAe,UAA6C;AAC1E,MAAI,CAAC,YAAY,OAAO,aAAa,UAAU;AAC7C,WAAO;AAAA,EACT;AAEA,QAAM,eAAe;AAErB,SACE,MAAM,QAAQ,aAAa,SAAS,KACpC,OAAO,aAAa,YAAY,YAChC,OAAO,aAAa,2BAA2B;AAEnD;AAUO,MAAM,SAAiC;AAAA;AAAA;AAAA;AAAA,EAI5B;AAAA;AAAA;AAAA;AAAA,EAIA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhB,YAAY,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AwB,SAAwC;AACvE,SAAO,QAAQ,YAAY,SAAS;AACtC;AAEA,SAAS,wBAAwB,SAAwC;AACvE,QAAM,gBAAgB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,QAAM,iBAA8B;AAAA,IAClC,aAAa,OAAO,YAAyB;AAC3C,aAAO;AAAA,QACL;AAAA,QACA,SAAS,QAAQ,QAAQ,MAAM;AAAA,QAC/B,QAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACA,QAAM,2BAAiD;AAAA,IACrD,IAAI,WAAiC,UAAwB;AAAA,IAE7D;AAAA,IACA,UAAU,WAA0C;AAClD,aAAO;AAAA,IACT;AAAA,EACF;AACA,QAAM,iBAAiB,QAAQ,OAAO,gBAAgB,wBAAwB;AAC9E,QAAM,aAAa,eAAe,YAAY;AAE9C,SAAO,cAAc,KAAK,CAAC,oBAAoB;AAC7C,WAAO,WAAW,WAAW,eAAe;AAAA,EAC9C,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -5,7 +5,8 @@ import type { StoragePipelineOptions, Pipeline } from "./Pipeline.js";
|
|
|
5
5
|
import type { CommonOptions } from "./StorageClient.js";
|
|
6
6
|
import { StorageClient } from "./StorageClient.js";
|
|
7
7
|
import type { WithResponse } from "./utils/utils.common.js";
|
|
8
|
-
import {
|
|
8
|
+
import type { UserDelegationKey } from "@azure/storage-common";
|
|
9
|
+
import { StorageSharedKeyCredential } from "@azure/storage-common";
|
|
9
10
|
import { AnonymousCredential } from "@azure/storage-common";
|
|
10
11
|
import type { Metadata } from "./models.js";
|
|
11
12
|
import type { SasIPRange } from "./SasIPRange.js";
|