@aws-sdk/util-endpoints
Advanced tools
Comparing version 3.433.0 to 3.438.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./aws"), exports); | ||
tslib_1.__exportStar(require("./lib/aws/partition"), exports); | ||
@@ -5,0 +6,0 @@ tslib_1.__exportStar(require("./lib/isIpAddress"), exports); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isVirtualHostableS3Bucket = void 0; | ||
const util_endpoints_1 = require("@smithy/util-endpoints"); | ||
const isIpAddress_1 = require("../isIpAddress"); | ||
const isValidHostLabel_1 = require("../isValidHostLabel"); | ||
const isVirtualHostableS3Bucket = (value, allowSubDomains = false) => { | ||
@@ -15,3 +15,3 @@ if (allowSubDomains) { | ||
} | ||
if (!(0, isValidHostLabel_1.isValidHostLabel)(value)) { | ||
if (!(0, util_endpoints_1.isValidHostLabel)(value)) { | ||
return false; | ||
@@ -18,0 +18,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isIpAddress = void 0; | ||
const IP_V4_REGEX = new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`); | ||
const isIpAddress = (value) => IP_V4_REGEX.test(value) || (value.startsWith("[") && value.endsWith("]")); | ||
exports.isIpAddress = isIpAddress; | ||
var util_endpoints_1 = require("@smithy/util-endpoints"); | ||
Object.defineProperty(exports, "isIpAddress", { enumerable: true, get: function () { return util_endpoints_1.isIpAddress; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.resolveEndpoint = void 0; | ||
const debug_1 = require("./debug"); | ||
const types_1 = require("./types"); | ||
const utils_1 = require("./utils"); | ||
const resolveEndpoint = (ruleSetObject, options) => { | ||
var _a, _b, _c, _d, _e, _f; | ||
const { endpointParams, logger } = options; | ||
const { parameters, rules } = ruleSetObject; | ||
(_b = (_a = options.logger) === null || _a === void 0 ? void 0 : _a.debug) === null || _b === void 0 ? void 0 : _b.call(_a, `${debug_1.debugId} Initial EndpointParams: ${(0, debug_1.toDebugString)(endpointParams)}`); | ||
const paramsWithDefault = Object.entries(parameters) | ||
.filter(([, v]) => v.default != null) | ||
.map(([k, v]) => [k, v.default]); | ||
if (paramsWithDefault.length > 0) { | ||
for (const [paramKey, paramDefaultValue] of paramsWithDefault) { | ||
endpointParams[paramKey] = (_c = endpointParams[paramKey]) !== null && _c !== void 0 ? _c : paramDefaultValue; | ||
} | ||
} | ||
const requiredParams = Object.entries(parameters) | ||
.filter(([, v]) => v.required) | ||
.map(([k]) => k); | ||
for (const requiredParam of requiredParams) { | ||
if (endpointParams[requiredParam] == null) { | ||
throw new types_1.EndpointError(`Missing required parameter: '${requiredParam}'`); | ||
} | ||
} | ||
const endpoint = (0, utils_1.evaluateRules)(rules, { endpointParams, logger, referenceRecord: {} }); | ||
if ((_d = options.endpointParams) === null || _d === void 0 ? void 0 : _d.Endpoint) { | ||
try { | ||
const givenEndpoint = new URL(options.endpointParams.Endpoint); | ||
const { protocol, port } = givenEndpoint; | ||
endpoint.url.protocol = protocol; | ||
endpoint.url.port = port; | ||
} | ||
catch (e) { | ||
} | ||
} | ||
(_f = (_e = options.logger) === null || _e === void 0 ? void 0 : _e.debug) === null || _f === void 0 ? void 0 : _f.call(_e, `${debug_1.debugId} Resolved endpoint: ${(0, debug_1.toDebugString)(endpoint)}`); | ||
return endpoint; | ||
}; | ||
exports.resolveEndpoint = resolveEndpoint; | ||
var util_endpoints_1 = require("@smithy/util-endpoints"); | ||
Object.defineProperty(exports, "resolveEndpoint", { enumerable: true, get: function () { return util_endpoints_1.resolveEndpoint; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EndpointError = void 0; | ||
class EndpointError extends Error { | ||
constructor(message) { | ||
super(message); | ||
this.name = "EndpointError"; | ||
} | ||
} | ||
exports.EndpointError = EndpointError; | ||
var util_endpoints_1 = require("@smithy/util-endpoints"); | ||
Object.defineProperty(exports, "EndpointError", { enumerable: true, get: function () { return util_endpoints_1.EndpointError; } }); |
@@ -0,1 +1,2 @@ | ||
export * from "./aws"; | ||
export * from "./lib/aws/partition"; | ||
@@ -2,0 +3,0 @@ export * from "./lib/isIpAddress"; |
@@ -0,3 +1,3 @@ | ||
import { isValidHostLabel } from "@smithy/util-endpoints"; | ||
import { isIpAddress } from "../isIpAddress"; | ||
import { isValidHostLabel } from "../isValidHostLabel"; | ||
export const isVirtualHostableS3Bucket = (value, allowSubDomains = false) => { | ||
@@ -4,0 +4,0 @@ if (allowSubDomains) { |
@@ -1,2 +0,1 @@ | ||
const IP_V4_REGEX = new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`); | ||
export const isIpAddress = (value) => IP_V4_REGEX.test(value) || (value.startsWith("[") && value.endsWith("]")); | ||
export { isIpAddress } from "@smithy/util-endpoints"; |
@@ -1,37 +0,1 @@ | ||
import { debugId, toDebugString } from "./debug"; | ||
import { EndpointError } from "./types"; | ||
import { evaluateRules } from "./utils"; | ||
export const resolveEndpoint = (ruleSetObject, options) => { | ||
const { endpointParams, logger } = options; | ||
const { parameters, rules } = ruleSetObject; | ||
options.logger?.debug?.(`${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`); | ||
const paramsWithDefault = Object.entries(parameters) | ||
.filter(([, v]) => v.default != null) | ||
.map(([k, v]) => [k, v.default]); | ||
if (paramsWithDefault.length > 0) { | ||
for (const [paramKey, paramDefaultValue] of paramsWithDefault) { | ||
endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue; | ||
} | ||
} | ||
const requiredParams = Object.entries(parameters) | ||
.filter(([, v]) => v.required) | ||
.map(([k]) => k); | ||
for (const requiredParam of requiredParams) { | ||
if (endpointParams[requiredParam] == null) { | ||
throw new EndpointError(`Missing required parameter: '${requiredParam}'`); | ||
} | ||
} | ||
const endpoint = evaluateRules(rules, { endpointParams, logger, referenceRecord: {} }); | ||
if (options.endpointParams?.Endpoint) { | ||
try { | ||
const givenEndpoint = new URL(options.endpointParams.Endpoint); | ||
const { protocol, port } = givenEndpoint; | ||
endpoint.url.protocol = protocol; | ||
endpoint.url.port = port; | ||
} | ||
catch (e) { | ||
} | ||
} | ||
options.logger?.debug?.(`${debugId} Resolved endpoint: ${toDebugString(endpoint)}`); | ||
return endpoint; | ||
}; | ||
export { resolveEndpoint } from "@smithy/util-endpoints"; |
@@ -1,6 +0,1 @@ | ||
export class EndpointError extends Error { | ||
constructor(message) { | ||
super(message); | ||
this.name = "EndpointError"; | ||
} | ||
} | ||
export { EndpointError } from "@smithy/util-endpoints"; |
@@ -0,1 +1,2 @@ | ||
export * from "./aws"; | ||
export * from "./lib/aws/partition"; | ||
@@ -2,0 +3,0 @@ export * from "./lib/isIpAddress"; |
@@ -1,2 +0,2 @@ | ||
import { EndpointARN } from "@aws-sdk/types"; | ||
import { EndpointARN } from "@smithy/types"; | ||
/** | ||
@@ -3,0 +3,0 @@ * Evaluates a single string argument value, and returns an object containing |
@@ -1,2 +0,2 @@ | ||
import { EndpointPartition } from "@aws-sdk/types"; | ||
import { EndpointPartition } from "@smithy/types"; | ||
export type PartitionsInfo = { | ||
@@ -3,0 +3,0 @@ partitions: Array<{ |
@@ -1,4 +0,1 @@ | ||
/** | ||
* Validates if the provided value is an IP address. | ||
*/ | ||
export declare const isIpAddress: (value: string) => boolean; | ||
export { isIpAddress } from "@smithy/util-endpoints"; |
@@ -1,6 +0,1 @@ | ||
import { EndpointV2 } from "@aws-sdk/types"; | ||
import { EndpointResolverOptions, RuleSetObject } from "./types"; | ||
/** | ||
* Resolves an endpoint URL by processing the endpoints ruleset and options. | ||
*/ | ||
export declare const resolveEndpoint: (ruleSetObject: RuleSetObject, options: EndpointResolverOptions) => EndpointV2; | ||
export { resolveEndpoint } from "@smithy/util-endpoints"; |
@@ -0,1 +1,2 @@ | ||
export * from "./aws"; | ||
export * from "./lib/aws/partition"; | ||
@@ -2,0 +3,0 @@ export * from "./lib/isIpAddress"; |
@@ -1,2 +0,2 @@ | ||
import { EndpointARN } from "@aws-sdk/types"; | ||
import { EndpointARN } from "@smithy/types"; | ||
export declare const parseArn: (value: string) => EndpointARN | null; |
@@ -1,2 +0,2 @@ | ||
import { EndpointPartition } from "@aws-sdk/types"; | ||
import { EndpointPartition } from "@smithy/types"; | ||
export type PartitionsInfo = { | ||
@@ -3,0 +3,0 @@ partitions: Array<{ |
@@ -1,1 +0,1 @@ | ||
export declare const isIpAddress: (value: string) => boolean; | ||
export { isIpAddress } from "@smithy/util-endpoints"; |
@@ -1,6 +0,1 @@ | ||
import { EndpointV2 } from "@aws-sdk/types"; | ||
import { EndpointResolverOptions, RuleSetObject } from "./types"; | ||
export declare const resolveEndpoint: ( | ||
ruleSetObject: RuleSetObject, | ||
options: EndpointResolverOptions | ||
) => EndpointV2; | ||
export { resolveEndpoint } from "@smithy/util-endpoints"; |
@@ -1,3 +0,1 @@ | ||
export declare class EndpointError extends Error { | ||
constructor(message: string); | ||
} | ||
export { EndpointError } from "@smithy/util-endpoints"; |
@@ -1,15 +0,6 @@ | ||
import { EndpointObjectProperty } from "@aws-sdk/types"; | ||
import { ConditionObject, Expression } from "./shared"; | ||
export type EndpointObjectProperties = Record<string, EndpointObjectProperty>; | ||
export type EndpointObjectHeaders = Record<string, Expression[]>; | ||
export type EndpointObject = { | ||
url: Expression; | ||
properties?: EndpointObjectProperties; | ||
headers?: EndpointObjectHeaders; | ||
}; | ||
export type EndpointRuleObject = { | ||
type: "endpoint"; | ||
conditions?: ConditionObject[]; | ||
endpoint: EndpointObject; | ||
documentation?: string; | ||
}; | ||
export { | ||
EndpointObjectProperties, | ||
EndpointObjectHeaders, | ||
EndpointObject, | ||
EndpointRuleObject, | ||
} from "@smithy/util-endpoints"; |
@@ -1,7 +0,1 @@ | ||
import { ConditionObject, Expression } from "./shared"; | ||
export type ErrorRuleObject = { | ||
type: "error"; | ||
conditions?: ConditionObject[]; | ||
error: Expression; | ||
documentation?: string; | ||
}; | ||
export { ErrorRuleObject } from "@smithy/util-endpoints"; |
@@ -1,19 +0,5 @@ | ||
import { RuleSetRules } from "./TreeRuleObject"; | ||
export type DeprecatedObject = { | ||
message?: string; | ||
since?: string; | ||
}; | ||
export type ParameterObject = { | ||
type: "String" | "string" | "Boolean" | "boolean"; | ||
default?: string | boolean; | ||
required?: boolean; | ||
documentation?: string; | ||
builtIn?: string; | ||
deprecated?: DeprecatedObject; | ||
}; | ||
export type RuleSetObject = { | ||
version: string; | ||
serviceId?: string; | ||
parameters: Record<string, ParameterObject>; | ||
rules: RuleSetRules; | ||
}; | ||
export { | ||
DeprecatedObject, | ||
ParameterObject, | ||
RuleSetObject, | ||
} from "@smithy/util-endpoints"; |
@@ -1,29 +0,12 @@ | ||
import { Logger } from "@aws-sdk/types"; | ||
export type ReferenceObject = { | ||
ref: string; | ||
}; | ||
export type FunctionObject = { | ||
fn: string; | ||
argv: FunctionArgv; | ||
}; | ||
export type FunctionArgv = Array<Expression | boolean | number>; | ||
export type FunctionReturn = | ||
| string | ||
| boolean | ||
| number | ||
| { | ||
[key: string]: FunctionReturn; | ||
}; | ||
export type ConditionObject = FunctionObject & { | ||
assign?: string; | ||
}; | ||
export type Expression = string | ReferenceObject | FunctionObject; | ||
export type EndpointParams = Record<string, string | boolean>; | ||
export type EndpointResolverOptions = { | ||
endpointParams: EndpointParams; | ||
logger?: Logger; | ||
}; | ||
export type ReferenceRecord = Record<string, FunctionReturn>; | ||
export type EvaluateOptions = EndpointResolverOptions & { | ||
referenceRecord: ReferenceRecord; | ||
}; | ||
export { | ||
ReferenceObject, | ||
FunctionObject, | ||
FunctionArgv, | ||
FunctionReturn, | ||
ConditionObject, | ||
Expression, | ||
EndpointParams, | ||
EndpointResolverOptions, | ||
ReferenceRecord, | ||
EvaluateOptions, | ||
} from "@smithy/util-endpoints"; |
@@ -1,12 +0,1 @@ | ||
import { EndpointRuleObject } from "./EndpointRuleObject"; | ||
import { ErrorRuleObject } from "./ErrorRuleObject"; | ||
import { ConditionObject } from "./shared"; | ||
export type RuleSetRules = Array< | ||
EndpointRuleObject | ErrorRuleObject | TreeRuleObject | ||
>; | ||
export type TreeRuleObject = { | ||
type: "tree"; | ||
conditions?: ConditionObject[]; | ||
rules: RuleSetRules; | ||
documentation?: string; | ||
}; | ||
export { RuleSetRules, TreeRuleObject } from "@smithy/util-endpoints"; |
@@ -1,3 +0,1 @@ | ||
export declare class EndpointError extends Error { | ||
constructor(message: string); | ||
} | ||
export { EndpointError } from "@smithy/util-endpoints"; |
@@ -1,15 +0,1 @@ | ||
import { EndpointObjectProperty } from "@aws-sdk/types"; | ||
import { ConditionObject, Expression } from "./shared"; | ||
export type EndpointObjectProperties = Record<string, EndpointObjectProperty>; | ||
export type EndpointObjectHeaders = Record<string, Expression[]>; | ||
export type EndpointObject = { | ||
url: Expression; | ||
properties?: EndpointObjectProperties; | ||
headers?: EndpointObjectHeaders; | ||
}; | ||
export type EndpointRuleObject = { | ||
type: "endpoint"; | ||
conditions?: ConditionObject[]; | ||
endpoint: EndpointObject; | ||
documentation?: string; | ||
}; | ||
export { EndpointObjectProperties, EndpointObjectHeaders, EndpointObject, EndpointRuleObject, } from "@smithy/util-endpoints"; |
@@ -1,7 +0,1 @@ | ||
import { ConditionObject, Expression } from "./shared"; | ||
export type ErrorRuleObject = { | ||
type: "error"; | ||
conditions?: ConditionObject[]; | ||
error: Expression; | ||
documentation?: string; | ||
}; | ||
export { ErrorRuleObject } from "@smithy/util-endpoints"; |
@@ -1,19 +0,1 @@ | ||
import { RuleSetRules } from "./TreeRuleObject"; | ||
export type DeprecatedObject = { | ||
message?: string; | ||
since?: string; | ||
}; | ||
export type ParameterObject = { | ||
type: "String" | "string" | "Boolean" | "boolean"; | ||
default?: string | boolean; | ||
required?: boolean; | ||
documentation?: string; | ||
builtIn?: string; | ||
deprecated?: DeprecatedObject; | ||
}; | ||
export type RuleSetObject = { | ||
version: string; | ||
serviceId?: string; | ||
parameters: Record<string, ParameterObject>; | ||
rules: RuleSetRules; | ||
}; | ||
export { DeprecatedObject, ParameterObject, RuleSetObject } from "@smithy/util-endpoints"; |
@@ -1,25 +0,1 @@ | ||
import { Logger } from "@aws-sdk/types"; | ||
export type ReferenceObject = { | ||
ref: string; | ||
}; | ||
export type FunctionObject = { | ||
fn: string; | ||
argv: FunctionArgv; | ||
}; | ||
export type FunctionArgv = Array<Expression | boolean | number>; | ||
export type FunctionReturn = string | boolean | number | { | ||
[key: string]: FunctionReturn; | ||
}; | ||
export type ConditionObject = FunctionObject & { | ||
assign?: string; | ||
}; | ||
export type Expression = string | ReferenceObject | FunctionObject; | ||
export type EndpointParams = Record<string, string | boolean>; | ||
export type EndpointResolverOptions = { | ||
endpointParams: EndpointParams; | ||
logger?: Logger; | ||
}; | ||
export type ReferenceRecord = Record<string, FunctionReturn>; | ||
export type EvaluateOptions = EndpointResolverOptions & { | ||
referenceRecord: ReferenceRecord; | ||
}; | ||
export { ReferenceObject, FunctionObject, FunctionArgv, FunctionReturn, ConditionObject, Expression, EndpointParams, EndpointResolverOptions, ReferenceRecord, EvaluateOptions, } from "@smithy/util-endpoints"; |
@@ -1,10 +0,1 @@ | ||
import { EndpointRuleObject } from "./EndpointRuleObject"; | ||
import { ErrorRuleObject } from "./ErrorRuleObject"; | ||
import { ConditionObject } from "./shared"; | ||
export type RuleSetRules = Array<EndpointRuleObject | ErrorRuleObject | TreeRuleObject>; | ||
export type TreeRuleObject = { | ||
type: "tree"; | ||
conditions?: ConditionObject[]; | ||
rules: RuleSetRules; | ||
documentation?: string; | ||
}; | ||
export { RuleSetRules, TreeRuleObject } from "@smithy/util-endpoints"; |
{ | ||
"name": "@aws-sdk/util-endpoints", | ||
"version": "3.433.0", | ||
"version": "3.438.0", | ||
"description": "Utilities to help with endpoint resolution", | ||
@@ -26,2 +26,3 @@ "main": "./dist-cjs/index.js", | ||
"@aws-sdk/types": "3.433.0", | ||
"@smithy/util-endpoints": "^1.0.2", | ||
"tslib": "^2.5.0" | ||
@@ -28,0 +29,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43810
3
65
846
+ Added@smithy/node-config-provider@2.3.0(transitive)
+ Added@smithy/property-provider@2.2.0(transitive)
+ Added@smithy/shared-ini-file-loader@2.4.0(transitive)
+ Added@smithy/util-endpoints@1.2.0(transitive)