replicas-engine 0.1.142 → 0.1.143

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.
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ chain
4
+ } from "./chunk-MCYTXPBZ.js";
5
+ import {
6
+ getProfileName,
7
+ loadSharedConfigFiles
8
+ } from "./chunk-JFXVYYQY.js";
9
+ import {
10
+ CredentialsProviderError
11
+ } from "./chunk-YDW6RZI2.js";
12
+
13
+ // ../node_modules/.bun/@smithy+querystring-parser@4.2.12/node_modules/@smithy/querystring-parser/dist-es/index.js
14
+ function parseQueryString(querystring) {
15
+ const query = {};
16
+ querystring = querystring.replace(/^\?/, "");
17
+ if (querystring) {
18
+ for (const pair of querystring.split("&")) {
19
+ let [key, value = null] = pair.split("=");
20
+ key = decodeURIComponent(key);
21
+ if (value) {
22
+ value = decodeURIComponent(value);
23
+ }
24
+ if (!(key in query)) {
25
+ query[key] = value;
26
+ } else if (Array.isArray(query[key])) {
27
+ query[key].push(value);
28
+ } else {
29
+ query[key] = [query[key], value];
30
+ }
31
+ }
32
+ }
33
+ return query;
34
+ }
35
+
36
+ // ../node_modules/.bun/@smithy+url-parser@4.2.12/node_modules/@smithy/url-parser/dist-es/index.js
37
+ var parseUrl = (url) => {
38
+ if (typeof url === "string") {
39
+ return parseUrl(new URL(url));
40
+ }
41
+ const { hostname, pathname, port, protocol, search } = url;
42
+ let query;
43
+ if (search) {
44
+ query = parseQueryString(search);
45
+ }
46
+ return {
47
+ hostname,
48
+ port: port ? parseInt(port) : void 0,
49
+ protocol,
50
+ path: pathname,
51
+ query
52
+ };
53
+ };
54
+
55
+ // ../node_modules/.bun/@smithy+property-provider@4.2.12/node_modules/@smithy/property-provider/dist-es/fromStatic.js
56
+ var fromStatic = (staticValue) => () => Promise.resolve(staticValue);
57
+
58
+ // ../node_modules/.bun/@smithy+property-provider@4.2.12/node_modules/@smithy/property-provider/dist-es/memoize.js
59
+ var memoize = (provider, isExpired, requiresRefresh) => {
60
+ let resolved;
61
+ let pending;
62
+ let hasResult;
63
+ let isConstant = false;
64
+ const coalesceProvider = async () => {
65
+ if (!pending) {
66
+ pending = provider();
67
+ }
68
+ try {
69
+ resolved = await pending;
70
+ hasResult = true;
71
+ isConstant = false;
72
+ } finally {
73
+ pending = void 0;
74
+ }
75
+ return resolved;
76
+ };
77
+ if (isExpired === void 0) {
78
+ return async (options) => {
79
+ if (!hasResult || options?.forceRefresh) {
80
+ resolved = await coalesceProvider();
81
+ }
82
+ return resolved;
83
+ };
84
+ }
85
+ return async (options) => {
86
+ if (!hasResult || options?.forceRefresh) {
87
+ resolved = await coalesceProvider();
88
+ }
89
+ if (isConstant) {
90
+ return resolved;
91
+ }
92
+ if (requiresRefresh && !requiresRefresh(resolved)) {
93
+ isConstant = true;
94
+ return resolved;
95
+ }
96
+ if (isExpired(resolved)) {
97
+ await coalesceProvider();
98
+ return resolved;
99
+ }
100
+ return resolved;
101
+ };
102
+ };
103
+
104
+ // ../node_modules/.bun/@smithy+node-config-provider@4.3.12/node_modules/@smithy/node-config-provider/dist-es/getSelectorName.js
105
+ function getSelectorName(functionString) {
106
+ try {
107
+ const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));
108
+ constants.delete("CONFIG");
109
+ constants.delete("CONFIG_PREFIX_SEPARATOR");
110
+ constants.delete("ENV");
111
+ return [...constants].join(", ");
112
+ } catch (e) {
113
+ return functionString;
114
+ }
115
+ }
116
+
117
+ // ../node_modules/.bun/@smithy+node-config-provider@4.3.12/node_modules/@smithy/node-config-provider/dist-es/fromEnv.js
118
+ var fromEnv = (envVarSelector, options) => async () => {
119
+ try {
120
+ const config = envVarSelector(process.env, options);
121
+ if (config === void 0) {
122
+ throw new Error();
123
+ }
124
+ return config;
125
+ } catch (e) {
126
+ throw new CredentialsProviderError(e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, { logger: options?.logger });
127
+ }
128
+ };
129
+
130
+ // ../node_modules/.bun/@smithy+node-config-provider@4.3.12/node_modules/@smithy/node-config-provider/dist-es/fromSharedConfigFiles.js
131
+ var fromSharedConfigFiles = (configSelector, { preferredFile = "config", ...init } = {}) => async () => {
132
+ const profile = getProfileName(init);
133
+ const { configFile, credentialsFile } = await loadSharedConfigFiles(init);
134
+ const profileFromCredentials = credentialsFile[profile] || {};
135
+ const profileFromConfig = configFile[profile] || {};
136
+ const mergedProfile = preferredFile === "config" ? { ...profileFromCredentials, ...profileFromConfig } : { ...profileFromConfig, ...profileFromCredentials };
137
+ try {
138
+ const cfgFile = preferredFile === "config" ? configFile : credentialsFile;
139
+ const configValue = configSelector(mergedProfile, cfgFile);
140
+ if (configValue === void 0) {
141
+ throw new Error();
142
+ }
143
+ return configValue;
144
+ } catch (e) {
145
+ throw new CredentialsProviderError(e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, { logger: init.logger });
146
+ }
147
+ };
148
+
149
+ // ../node_modules/.bun/@smithy+node-config-provider@4.3.12/node_modules/@smithy/node-config-provider/dist-es/fromStatic.js
150
+ var isFunction = (func) => typeof func === "function";
151
+ var fromStatic2 = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : fromStatic(defaultValue);
152
+
153
+ // ../node_modules/.bun/@smithy+node-config-provider@4.3.12/node_modules/@smithy/node-config-provider/dist-es/configLoader.js
154
+ var loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {
155
+ const { signingName, logger } = configuration;
156
+ const envOptions = { signingName, logger };
157
+ return memoize(chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic2(defaultValue)));
158
+ };
159
+
160
+ export {
161
+ parseUrl,
162
+ memoize,
163
+ loadConfig
164
+ };
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+
3
+ // ../node_modules/.bun/@smithy+property-provider@4.2.12/node_modules/@smithy/property-provider/dist-es/ProviderError.js
4
+ var ProviderError = class _ProviderError extends Error {
5
+ name = "ProviderError";
6
+ tryNextLink;
7
+ constructor(message, options = true) {
8
+ let logger;
9
+ let tryNextLink = true;
10
+ if (typeof options === "boolean") {
11
+ logger = void 0;
12
+ tryNextLink = options;
13
+ } else if (options != null && typeof options === "object") {
14
+ logger = options.logger;
15
+ tryNextLink = options.tryNextLink ?? true;
16
+ }
17
+ super(message);
18
+ this.tryNextLink = tryNextLink;
19
+ Object.setPrototypeOf(this, _ProviderError.prototype);
20
+ logger?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
21
+ }
22
+ static from(error, options = true) {
23
+ return Object.assign(new this(error.message, options), error);
24
+ }
25
+ };
26
+
27
+ // ../node_modules/.bun/@smithy+property-provider@4.2.12/node_modules/@smithy/property-provider/dist-es/CredentialsProviderError.js
28
+ var CredentialsProviderError = class _CredentialsProviderError extends ProviderError {
29
+ name = "CredentialsProviderError";
30
+ constructor(message, options = true) {
31
+ super(message, options);
32
+ Object.setPrototypeOf(this, _CredentialsProviderError.prototype);
33
+ }
34
+ };
35
+
36
+ export {
37
+ ProviderError,
38
+ CredentialsProviderError
39
+ };
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+
3
+ // ../node_modules/.bun/@smithy+smithy-client@4.12.13/node_modules/@smithy/smithy-client/dist-es/create-aggregated-client.js
4
+ var createAggregatedClient = (commands, Client, options) => {
5
+ for (const [command, CommandCtor] of Object.entries(commands)) {
6
+ const methodImpl = async function(args, optionsOrCb, cb) {
7
+ const command2 = new CommandCtor(args);
8
+ if (typeof optionsOrCb === "function") {
9
+ this.send(command2, optionsOrCb);
10
+ } else if (typeof cb === "function") {
11
+ if (typeof optionsOrCb !== "object")
12
+ throw new Error(`Expected http options but got ${typeof optionsOrCb}`);
13
+ this.send(command2, optionsOrCb || {}, cb);
14
+ } else {
15
+ return this.send(command2, optionsOrCb);
16
+ }
17
+ };
18
+ const methodName = (command[0].toLowerCase() + command.slice(1)).replace(/Command$/, "");
19
+ Client.prototype[methodName] = methodImpl;
20
+ }
21
+ const { paginators = {}, waiters = {} } = options ?? {};
22
+ for (const [paginatorName, paginatorFn] of Object.entries(paginators)) {
23
+ if (Client.prototype[paginatorName] === void 0) {
24
+ Client.prototype[paginatorName] = function(commandInput = {}, paginationConfiguration, ...rest) {
25
+ return paginatorFn({
26
+ ...paginationConfiguration,
27
+ client: this
28
+ }, commandInput, ...rest);
29
+ };
30
+ }
31
+ }
32
+ for (const [waiterName, waiterFn] of Object.entries(waiters)) {
33
+ if (Client.prototype[waiterName] === void 0) {
34
+ Client.prototype[waiterName] = async function(commandInput = {}, waiterConfiguration, ...rest) {
35
+ let config = waiterConfiguration;
36
+ if (typeof waiterConfiguration === "number") {
37
+ config = {
38
+ maxWaitTime: waiterConfiguration
39
+ };
40
+ }
41
+ return waiterFn({
42
+ ...config,
43
+ client: this
44
+ }, commandInput, ...rest);
45
+ };
46
+ }
47
+ }
48
+ };
49
+
50
+ export {
51
+ createAggregatedClient
52
+ };
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ parseRfc3339DateTime
4
+ } from "./chunk-5V5ZNFZK.js";
5
+ import {
6
+ sdkStreamMixin
7
+ } from "./chunk-NPXMDMPW.js";
8
+ import {
9
+ NodeHttpHandler
10
+ } from "./chunk-TY2FR253.js";
11
+ import {
12
+ HttpRequest
13
+ } from "./chunk-WCAERHFE.js";
14
+ import "./chunk-ERL3EC7G.js";
15
+ import {
16
+ setCredentialFeature
17
+ } from "./chunk-N2BGF5AZ.js";
18
+ import {
19
+ CredentialsProviderError
20
+ } from "./chunk-YDW6RZI2.js";
21
+
22
+ // ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.26/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
23
+ import fs from "fs/promises";
24
+
25
+ // ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.26/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
26
+ var ECS_CONTAINER_HOST = "169.254.170.2";
27
+ var EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
28
+ var EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
29
+ var checkUrl = (url, logger) => {
30
+ if (url.protocol === "https:") {
31
+ return;
32
+ }
33
+ if (url.hostname === ECS_CONTAINER_HOST || url.hostname === EKS_CONTAINER_HOST_IPv4 || url.hostname === EKS_CONTAINER_HOST_IPv6) {
34
+ return;
35
+ }
36
+ if (url.hostname.includes("[")) {
37
+ if (url.hostname === "[::1]" || url.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") {
38
+ return;
39
+ }
40
+ } else {
41
+ if (url.hostname === "localhost") {
42
+ return;
43
+ }
44
+ const ipComponents = url.hostname.split(".");
45
+ const inRange = (component) => {
46
+ const num = parseInt(component, 10);
47
+ return 0 <= num && num <= 255;
48
+ };
49
+ if (ipComponents[0] === "127" && inRange(ipComponents[1]) && inRange(ipComponents[2]) && inRange(ipComponents[3]) && ipComponents.length === 4) {
50
+ return;
51
+ }
52
+ }
53
+ throw new CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
54
+ - loopback CIDR 127.0.0.0/8 or [::1/128]
55
+ - ECS container host 169.254.170.2
56
+ - EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
57
+ };
58
+
59
+ // ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.26/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js
60
+ function createGetRequest(url) {
61
+ return new HttpRequest({
62
+ protocol: url.protocol,
63
+ hostname: url.hostname,
64
+ port: Number(url.port),
65
+ path: url.pathname,
66
+ query: Array.from(url.searchParams.entries()).reduce((acc, [k, v]) => {
67
+ acc[k] = v;
68
+ return acc;
69
+ }, {}),
70
+ fragment: url.hash
71
+ });
72
+ }
73
+ async function getCredentials(response, logger) {
74
+ const stream = sdkStreamMixin(response.body);
75
+ const str = await stream.transformToString();
76
+ if (response.statusCode === 200) {
77
+ const parsed = JSON.parse(str);
78
+ if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") {
79
+ throw new CredentialsProviderError("HTTP credential provider response not of the required format, an object matching: { AccessKeyId: string, SecretAccessKey: string, Token: string, Expiration: string(rfc3339) }", { logger });
80
+ }
81
+ return {
82
+ accessKeyId: parsed.AccessKeyId,
83
+ secretAccessKey: parsed.SecretAccessKey,
84
+ sessionToken: parsed.Token,
85
+ expiration: parseRfc3339DateTime(parsed.Expiration)
86
+ };
87
+ }
88
+ if (response.statusCode >= 400 && response.statusCode < 500) {
89
+ let parsedBody = {};
90
+ try {
91
+ parsedBody = JSON.parse(str);
92
+ } catch (e) {
93
+ }
94
+ throw Object.assign(new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
95
+ Code: parsedBody.Code,
96
+ Message: parsedBody.Message
97
+ });
98
+ }
99
+ throw new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
100
+ }
101
+
102
+ // ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.26/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/retry-wrapper.js
103
+ var retryWrapper = (toRetry, maxRetries, delayMs) => {
104
+ return async () => {
105
+ for (let i = 0; i < maxRetries; ++i) {
106
+ try {
107
+ return await toRetry();
108
+ } catch (e) {
109
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
110
+ }
111
+ }
112
+ return await toRetry();
113
+ };
114
+ };
115
+
116
+ // ../node_modules/.bun/@aws-sdk+credential-provider-http@3.972.26/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
117
+ var AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
118
+ var DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2";
119
+ var AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
120
+ var AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";
121
+ var AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
122
+ var fromHttp = (options = {}) => {
123
+ options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
124
+ let host;
125
+ const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
126
+ const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
127
+ const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
128
+ const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
129
+ const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger?.warn ? console.warn : options.logger.warn.bind(options.logger);
130
+ if (relative && full) {
131
+ warn("@aws-sdk/credential-provider-http: you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
132
+ warn("awsContainerCredentialsFullUri will take precedence.");
133
+ }
134
+ if (token && tokenFile) {
135
+ warn("@aws-sdk/credential-provider-http: you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
136
+ warn("awsContainerAuthorizationToken will take precedence.");
137
+ }
138
+ if (full) {
139
+ host = full;
140
+ } else if (relative) {
141
+ host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;
142
+ } else {
143
+ throw new CredentialsProviderError(`No HTTP credential provider host provided.
144
+ Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
145
+ }
146
+ const url = new URL(host);
147
+ checkUrl(url, options.logger);
148
+ const requestHandler = NodeHttpHandler.create({
149
+ requestTimeout: options.timeout ?? 1e3,
150
+ connectionTimeout: options.timeout ?? 1e3
151
+ });
152
+ return retryWrapper(async () => {
153
+ const request = createGetRequest(url);
154
+ if (token) {
155
+ request.headers.Authorization = token;
156
+ } else if (tokenFile) {
157
+ request.headers.Authorization = (await fs.readFile(tokenFile)).toString();
158
+ }
159
+ try {
160
+ const result = await requestHandler.handle(request);
161
+ return getCredentials(result.response).then((creds) => setCredentialFeature(creds, "CREDENTIALS_HTTP", "z"));
162
+ } catch (e) {
163
+ throw new CredentialsProviderError(String(e), { logger: options.logger });
164
+ }
165
+ }, options.maxRetries ?? 3, options.timeout ?? 1e3);
166
+ };
167
+ export {
168
+ fromHttp
169
+ };