remove node_modules and .gitignore them
This commit is contained in:
Generated
Vendored
-30
@@ -1,30 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createConfigValueProvider = void 0;
|
||||
const createConfigValueProvider = (configKey, canonicalEndpointParamKey, config) => {
|
||||
const configProvider = async () => {
|
||||
var _a;
|
||||
const configValue = (_a = config[configKey]) !== null && _a !== void 0 ? _a : config[canonicalEndpointParamKey];
|
||||
if (typeof configValue === "function") {
|
||||
return configValue();
|
||||
}
|
||||
return configValue;
|
||||
};
|
||||
if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") {
|
||||
return async () => {
|
||||
const endpoint = await configProvider();
|
||||
if (endpoint && typeof endpoint === "object") {
|
||||
if ("url" in endpoint) {
|
||||
return endpoint.url.href;
|
||||
}
|
||||
if ("hostname" in endpoint) {
|
||||
const { protocol, hostname, port, path } = endpoint;
|
||||
return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`;
|
||||
}
|
||||
}
|
||||
return endpoint;
|
||||
};
|
||||
}
|
||||
return configProvider;
|
||||
};
|
||||
exports.createConfigValueProvider = createConfigValueProvider;
|
||||
Generated
Vendored
-5
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEndpointFromConfig = void 0;
|
||||
const getEndpointFromConfig = async (serviceId) => undefined;
|
||||
exports.getEndpointFromConfig = getEndpointFromConfig;
|
||||
Generated
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEndpointFromConfig = void 0;
|
||||
const node_config_provider_1 = require("@smithy/node-config-provider");
|
||||
const getEndpointUrlConfig_1 = require("./getEndpointUrlConfig");
|
||||
const getEndpointFromConfig = async (serviceId) => (0, node_config_provider_1.loadConfig)((0, getEndpointUrlConfig_1.getEndpointUrlConfig)(serviceId))();
|
||||
exports.getEndpointFromConfig = getEndpointFromConfig;
|
||||
Generated
Vendored
-51
@@ -1,51 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveParams = exports.getEndpointFromInstructions = void 0;
|
||||
const service_customizations_1 = require("../service-customizations");
|
||||
const createConfigValueProvider_1 = require("./createConfigValueProvider");
|
||||
const getEndpointFromConfig_1 = require("./getEndpointFromConfig");
|
||||
const toEndpointV1_1 = require("./toEndpointV1");
|
||||
const getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context) => {
|
||||
if (!clientConfig.endpoint) {
|
||||
const endpointFromConfig = await (0, getEndpointFromConfig_1.getEndpointFromConfig)(clientConfig.serviceId || "");
|
||||
if (endpointFromConfig) {
|
||||
clientConfig.endpoint = () => Promise.resolve((0, toEndpointV1_1.toEndpointV1)(endpointFromConfig));
|
||||
}
|
||||
}
|
||||
const endpointParams = await (0, exports.resolveParams)(commandInput, instructionsSupplier, clientConfig);
|
||||
if (typeof clientConfig.endpointProvider !== "function") {
|
||||
throw new Error("config.endpointProvider is not set.");
|
||||
}
|
||||
const endpoint = clientConfig.endpointProvider(endpointParams, context);
|
||||
return endpoint;
|
||||
};
|
||||
exports.getEndpointFromInstructions = getEndpointFromInstructions;
|
||||
const resolveParams = async (commandInput, instructionsSupplier, clientConfig) => {
|
||||
var _a;
|
||||
const endpointParams = {};
|
||||
const instructions = ((_a = instructionsSupplier === null || instructionsSupplier === void 0 ? void 0 : instructionsSupplier.getEndpointParameterInstructions) === null || _a === void 0 ? void 0 : _a.call(instructionsSupplier)) || {};
|
||||
for (const [name, instruction] of Object.entries(instructions)) {
|
||||
switch (instruction.type) {
|
||||
case "staticContextParams":
|
||||
endpointParams[name] = instruction.value;
|
||||
break;
|
||||
case "contextParams":
|
||||
endpointParams[name] = commandInput[instruction.name];
|
||||
break;
|
||||
case "clientContextParams":
|
||||
case "builtInParams":
|
||||
endpointParams[name] = await (0, createConfigValueProvider_1.createConfigValueProvider)(instruction.name, name, clientConfig)();
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction));
|
||||
}
|
||||
}
|
||||
if (Object.keys(instructions).length === 0) {
|
||||
Object.assign(endpointParams, clientConfig);
|
||||
}
|
||||
if (String(clientConfig.serviceId).toLowerCase() === "s3") {
|
||||
await (0, service_customizations_1.resolveParamsForS3)(endpointParams);
|
||||
}
|
||||
return endpointParams;
|
||||
};
|
||||
exports.resolveParams = resolveParams;
|
||||
Generated
Vendored
-35
@@ -1,35 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEndpointUrlConfig = void 0;
|
||||
const shared_ini_file_loader_1 = require("@smithy/shared-ini-file-loader");
|
||||
const ENV_ENDPOINT_URL = "AWS_ENDPOINT_URL";
|
||||
const CONFIG_ENDPOINT_URL = "endpoint_url";
|
||||
const getEndpointUrlConfig = (serviceId) => ({
|
||||
environmentVariableSelector: (env) => {
|
||||
const serviceSuffixParts = serviceId.split(" ").map((w) => w.toUpperCase());
|
||||
const serviceEndpointUrl = env[[ENV_ENDPOINT_URL, ...serviceSuffixParts].join("_")];
|
||||
if (serviceEndpointUrl)
|
||||
return serviceEndpointUrl;
|
||||
const endpointUrl = env[ENV_ENDPOINT_URL];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
return undefined;
|
||||
},
|
||||
configFileSelector: (profile, config) => {
|
||||
if (config && profile.services) {
|
||||
const servicesSection = config[["services", profile.services].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)];
|
||||
if (servicesSection) {
|
||||
const servicePrefixParts = serviceId.split(" ").map((w) => w.toLowerCase());
|
||||
const endpointUrl = servicesSection[[servicePrefixParts.join("_"), CONFIG_ENDPOINT_URL].join(shared_ini_file_loader_1.CONFIG_PREFIX_SEPARATOR)];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
}
|
||||
}
|
||||
const endpointUrl = profile[CONFIG_ENDPOINT_URL];
|
||||
if (endpointUrl)
|
||||
return endpointUrl;
|
||||
return undefined;
|
||||
},
|
||||
default: undefined,
|
||||
});
|
||||
exports.getEndpointUrlConfig = getEndpointUrlConfig;
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./getEndpointFromInstructions"), exports);
|
||||
tslib_1.__exportStar(require("./toEndpointV1"), exports);
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toEndpointV1 = void 0;
|
||||
const url_parser_1 = require("@smithy/url-parser");
|
||||
const toEndpointV1 = (endpoint) => {
|
||||
if (typeof endpoint === "object") {
|
||||
if ("url" in endpoint) {
|
||||
return (0, url_parser_1.parseUrl)(endpoint.url);
|
||||
}
|
||||
return endpoint;
|
||||
}
|
||||
return (0, url_parser_1.parseUrl)(endpoint);
|
||||
};
|
||||
exports.toEndpointV1 = toEndpointV1;
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.endpointMiddleware = void 0;
|
||||
const util_middleware_1 = require("@smithy/util-middleware");
|
||||
const getEndpointFromInstructions_1 = require("./adaptors/getEndpointFromInstructions");
|
||||
const endpointMiddleware = ({ config, instructions, }) => {
|
||||
return (next, context) => async (args) => {
|
||||
var _a, _b, _c;
|
||||
const endpoint = await (0, getEndpointFromInstructions_1.getEndpointFromInstructions)(args.input, {
|
||||
getEndpointParameterInstructions() {
|
||||
return instructions;
|
||||
},
|
||||
}, { ...config }, context);
|
||||
context.endpointV2 = endpoint;
|
||||
context.authSchemes = (_a = endpoint.properties) === null || _a === void 0 ? void 0 : _a.authSchemes;
|
||||
const authScheme = (_b = context.authSchemes) === null || _b === void 0 ? void 0 : _b[0];
|
||||
if (authScheme) {
|
||||
context["signing_region"] = authScheme.signingRegion;
|
||||
context["signing_service"] = authScheme.signingName;
|
||||
const smithyContext = (0, util_middleware_1.getSmithyContext)(context);
|
||||
const httpAuthOption = (_c = smithyContext === null || smithyContext === void 0 ? void 0 : smithyContext.selectedHttpAuthScheme) === null || _c === void 0 ? void 0 : _c.httpAuthOption;
|
||||
if (httpAuthOption) {
|
||||
httpAuthOption.signingProperties = Object.assign(httpAuthOption.signingProperties || {}, {
|
||||
signing_region: authScheme.signingRegion,
|
||||
signingRegion: authScheme.signingRegion,
|
||||
signing_service: authScheme.signingName,
|
||||
signingName: authScheme.signingName,
|
||||
signingRegionSet: authScheme.signingRegionSet,
|
||||
}, authScheme.properties);
|
||||
}
|
||||
}
|
||||
return next({
|
||||
...args,
|
||||
});
|
||||
};
|
||||
};
|
||||
exports.endpointMiddleware = endpointMiddleware;
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEndpointPlugin = exports.endpointMiddlewareOptions = void 0;
|
||||
const middleware_serde_1 = require("@smithy/middleware-serde");
|
||||
const endpointMiddleware_1 = require("./endpointMiddleware");
|
||||
exports.endpointMiddlewareOptions = {
|
||||
step: "serialize",
|
||||
tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"],
|
||||
name: "endpointV2Middleware",
|
||||
override: true,
|
||||
relation: "before",
|
||||
toMiddleware: middleware_serde_1.serializerMiddlewareOption.name,
|
||||
};
|
||||
const getEndpointPlugin = (config, instructions) => ({
|
||||
applyToStack: (clientStack) => {
|
||||
clientStack.addRelativeTo((0, endpointMiddleware_1.endpointMiddleware)({
|
||||
config,
|
||||
instructions,
|
||||
}), exports.endpointMiddlewareOptions);
|
||||
},
|
||||
});
|
||||
exports.getEndpointPlugin = getEndpointPlugin;
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./adaptors"), exports);
|
||||
tslib_1.__exportStar(require("./endpointMiddleware"), exports);
|
||||
tslib_1.__exportStar(require("./getEndpointPlugin"), exports);
|
||||
tslib_1.__exportStar(require("./resolveEndpointConfig"), exports);
|
||||
tslib_1.__exportStar(require("./types"), exports);
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveEndpointConfig = void 0;
|
||||
const util_middleware_1 = require("@smithy/util-middleware");
|
||||
const toEndpointV1_1 = require("./adaptors/toEndpointV1");
|
||||
const resolveEndpointConfig = (input) => {
|
||||
var _a, _b, _c;
|
||||
const tls = (_a = input.tls) !== null && _a !== void 0 ? _a : true;
|
||||
const { endpoint } = input;
|
||||
const customEndpointProvider = endpoint != null ? async () => (0, toEndpointV1_1.toEndpointV1)(await (0, util_middleware_1.normalizeProvider)(endpoint)()) : undefined;
|
||||
const isCustomEndpoint = !!endpoint;
|
||||
return {
|
||||
...input,
|
||||
endpoint: customEndpointProvider,
|
||||
tls,
|
||||
isCustomEndpoint,
|
||||
useDualstackEndpoint: (0, util_middleware_1.normalizeProvider)((_b = input.useDualstackEndpoint) !== null && _b !== void 0 ? _b : false),
|
||||
useFipsEndpoint: (0, util_middleware_1.normalizeProvider)((_c = input.useFipsEndpoint) !== null && _c !== void 0 ? _c : false),
|
||||
};
|
||||
};
|
||||
exports.resolveEndpointConfig = resolveEndpointConfig;
|
||||
Generated
Vendored
-4
@@ -1,4 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./s3"), exports);
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isArnBucketName = exports.isDnsCompatibleBucketName = exports.S3_HOSTNAME_PATTERN = exports.DOT_PATTERN = exports.resolveParamsForS3 = void 0;
|
||||
const resolveParamsForS3 = async (endpointParams) => {
|
||||
const bucket = (endpointParams === null || endpointParams === void 0 ? void 0 : endpointParams.Bucket) || "";
|
||||
if (typeof endpointParams.Bucket === "string") {
|
||||
endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?"));
|
||||
}
|
||||
if ((0, exports.isArnBucketName)(bucket)) {
|
||||
if (endpointParams.ForcePathStyle === true) {
|
||||
throw new Error("Path-style addressing cannot be used with ARN buckets");
|
||||
}
|
||||
}
|
||||
else if (!(0, exports.isDnsCompatibleBucketName)(bucket) ||
|
||||
(bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:")) ||
|
||||
bucket.toLowerCase() !== bucket ||
|
||||
bucket.length < 3) {
|
||||
endpointParams.ForcePathStyle = true;
|
||||
}
|
||||
if (endpointParams.DisableMultiRegionAccessPoints) {
|
||||
endpointParams.disableMultiRegionAccessPoints = true;
|
||||
endpointParams.DisableMRAP = true;
|
||||
}
|
||||
return endpointParams;
|
||||
};
|
||||
exports.resolveParamsForS3 = resolveParamsForS3;
|
||||
const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/;
|
||||
const IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/;
|
||||
const DOTS_PATTERN = /\.\./;
|
||||
exports.DOT_PATTERN = /\./;
|
||||
exports.S3_HOSTNAME_PATTERN = /^(.+\.)?s3(-fips)?(\.dualstack)?[.-]([a-z0-9-]+)\./;
|
||||
const isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName);
|
||||
exports.isDnsCompatibleBucketName = isDnsCompatibleBucketName;
|
||||
const isArnBucketName = (bucketName) => {
|
||||
const [arn, partition, service, region, account, typeOrId] = bucketName.split(":");
|
||||
const isArn = arn === "arn" && bucketName.split(":").length >= 6;
|
||||
const isValidArn = [arn, partition, service, account, typeOrId].filter(Boolean).length === 5;
|
||||
if (isArn && !isValidArn) {
|
||||
throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`);
|
||||
}
|
||||
return arn === "arn" && !!partition && !!service && !!account && !!typeOrId;
|
||||
};
|
||||
exports.isArnBucketName = isArnBucketName;
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
Reference in New Issue
Block a user