@aws-sdk/util-endpoints
Advanced tools
Comparing version 3.292.0 to 3.293.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.partition = void 0; | ||
exports.getUserAgentPrefix = exports.useDefaultPartitionInfo = exports.setPartitionInfo = exports.partition = void 0; | ||
const tslib_1 = require("tslib"); | ||
const partitions_json_1 = tslib_1.__importDefault(require("./partitions.json")); | ||
const { partitions } = partitions_json_1.default; | ||
const DEFAULT_PARTITION = partitions.find((partition) => partition.id === "aws"); | ||
let selectedPartitionsInfo = partitions_json_1.default; | ||
let selectedUserAgentPrefix = ""; | ||
const partition = (value) => { | ||
const { partitions } = selectedPartitionsInfo; | ||
for (const partition of partitions) { | ||
@@ -28,2 +29,3 @@ const { regions, outputs } = partition; | ||
} | ||
const DEFAULT_PARTITION = partitions.find((partition) => partition.id === "aws"); | ||
if (!DEFAULT_PARTITION) { | ||
@@ -38,1 +40,12 @@ throw new Error("Provided region was not found in the partition array or regex," + | ||
exports.partition = partition; | ||
const setPartitionInfo = (partitionsInfo, userAgentPrefix = "") => { | ||
selectedPartitionsInfo = partitionsInfo; | ||
selectedUserAgentPrefix = userAgentPrefix; | ||
}; | ||
exports.setPartitionInfo = setPartitionInfo; | ||
const useDefaultPartitionInfo = () => { | ||
(0, exports.setPartitionInfo)(partitions_json_1.default, ""); | ||
}; | ||
exports.useDefaultPartitionInfo = useDefaultPartitionInfo; | ||
const getUserAgentPrefix = () => selectedUserAgentPrefix; | ||
exports.getUserAgentPrefix = getUserAgentPrefix; |
import partitionsInfo from "./partitions.json"; | ||
const { partitions } = partitionsInfo; | ||
const DEFAULT_PARTITION = partitions.find((partition) => partition.id === "aws"); | ||
let selectedPartitionsInfo = partitionsInfo; | ||
let selectedUserAgentPrefix = ""; | ||
export const partition = (value) => { | ||
const { partitions } = selectedPartitionsInfo; | ||
for (const partition of partitions) { | ||
@@ -24,2 +25,3 @@ const { regions, outputs } = partition; | ||
} | ||
const DEFAULT_PARTITION = partitions.find((partition) => partition.id === "aws"); | ||
if (!DEFAULT_PARTITION) { | ||
@@ -33,1 +35,9 @@ throw new Error("Provided region was not found in the partition array or regex," + | ||
}; | ||
export const setPartitionInfo = (partitionsInfo, userAgentPrefix = "") => { | ||
selectedPartitionsInfo = partitionsInfo; | ||
selectedUserAgentPrefix = userAgentPrefix; | ||
}; | ||
export const useDefaultPartitionInfo = () => { | ||
setPartitionInfo(partitionsInfo, ""); | ||
}; | ||
export const getUserAgentPrefix = () => selectedUserAgentPrefix; |
import { EndpointPartition } from "@aws-sdk/types"; | ||
export declare type PartitionsInfo = { | ||
partitions: Array<{ | ||
id: string; | ||
outputs: { | ||
dnsSuffix: string; | ||
dualStackDnsSuffix: string; | ||
name: string; | ||
supportsDualStack: boolean; | ||
supportsFIPS: boolean; | ||
}; | ||
regionRegex: string; | ||
regions: Record<string, { | ||
description?: string; | ||
} | undefined>; | ||
}>; | ||
}; | ||
/** | ||
@@ -9,1 +25,15 @@ * Evaluates a single string argument value as a region, and matches the | ||
export declare const partition: (value: string) => EndpointPartition; | ||
/** | ||
* Set custom partitions.json data. | ||
* @internal | ||
*/ | ||
export declare const setPartitionInfo: (partitionsInfo: PartitionsInfo, userAgentPrefix?: string) => void; | ||
/** | ||
* Reset to the default partitions.json data. | ||
* @internal | ||
*/ | ||
export declare const useDefaultPartitionInfo: () => void; | ||
/** | ||
* @internal | ||
*/ | ||
export declare const getUserAgentPrefix: () => string; |
import { EndpointPartition } from "@aws-sdk/types"; | ||
export declare type PartitionsInfo = { | ||
partitions: Array<{ | ||
id: string; | ||
outputs: { | ||
dnsSuffix: string; | ||
dualStackDnsSuffix: string; | ||
name: string; | ||
supportsDualStack: boolean; | ||
supportsFIPS: boolean; | ||
}; | ||
regionRegex: string; | ||
regions: Record< | ||
string, | ||
| { | ||
description?: string; | ||
} | ||
| undefined | ||
>; | ||
}>; | ||
}; | ||
export declare const partition: (value: string) => EndpointPartition; | ||
export declare const setPartitionInfo: ( | ||
partitionsInfo: PartitionsInfo, | ||
userAgentPrefix?: string | ||
) => void; | ||
export declare const useDefaultPartitionInfo: () => void; | ||
export declare const getUserAgentPrefix: () => string; |
{ | ||
"name": "@aws-sdk/util-endpoints", | ||
"version": "3.292.0", | ||
"version": "3.293.0", | ||
"description": "Utilities to help with endpoint resolution", | ||
@@ -5,0 +5,0 @@ "main": "./dist-cjs/index.js", |
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
94463
2120