replicas-cli 0.2.120 → 0.2.122

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,242 @@
1
+ #!/usr/bin/env bun
2
+
3
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getProfileName.js
4
+ var ENV_PROFILE = "AWS_PROFILE";
5
+ var DEFAULT_PROFILE = "default";
6
+ var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
7
+
8
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getConfigFilepath.js
9
+ import { join } from "path";
10
+
11
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getHomeDir.js
12
+ import { homedir } from "os";
13
+ import { sep } from "path";
14
+ var homeDirCache = {};
15
+ var getHomeDirCacheKey = () => {
16
+ if (process && process.geteuid) {
17
+ return `${process.geteuid()}`;
18
+ }
19
+ return "DEFAULT";
20
+ };
21
+ var getHomeDir = () => {
22
+ const { HOME, USERPROFILE, HOMEPATH, HOMEDRIVE = `C:${sep}` } = process.env;
23
+ if (HOME)
24
+ return HOME;
25
+ if (USERPROFILE)
26
+ return USERPROFILE;
27
+ if (HOMEPATH)
28
+ return `${HOMEDRIVE}${HOMEPATH}`;
29
+ const homeDirCacheKey = getHomeDirCacheKey();
30
+ if (!homeDirCache[homeDirCacheKey])
31
+ homeDirCache[homeDirCacheKey] = homedir();
32
+ return homeDirCache[homeDirCacheKey];
33
+ };
34
+
35
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getConfigFilepath.js
36
+ var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
37
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join(getHomeDir(), ".aws", "config");
38
+
39
+ // ../node_modules/.bun/@smithy+types@4.14.1/node_modules/@smithy/types/dist-es/profile.js
40
+ var IniSectionType;
41
+ (function(IniSectionType2) {
42
+ IniSectionType2["PROFILE"] = "profile";
43
+ IniSectionType2["SSO_SESSION"] = "sso-session";
44
+ IniSectionType2["SERVICES"] = "services";
45
+ })(IniSectionType || (IniSectionType = {}));
46
+
47
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/loadSharedConfigFiles.js
48
+ import { join as join3 } from "path";
49
+
50
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/constants.js
51
+ var CONFIG_PREFIX_SEPARATOR = ".";
52
+
53
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getConfigData.js
54
+ var getConfigData = (data) => Object.entries(data).filter(([key]) => {
55
+ const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
56
+ if (indexOfSeparator === -1) {
57
+ return false;
58
+ }
59
+ return Object.values(IniSectionType).includes(key.substring(0, indexOfSeparator));
60
+ }).reduce((acc, [key, value]) => {
61
+ const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);
62
+ const updatedKey = key.substring(0, indexOfSeparator) === IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;
63
+ acc[updatedKey] = value;
64
+ return acc;
65
+ }, {
66
+ ...data.default && { default: data.default }
67
+ });
68
+
69
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getCredentialsFilepath.js
70
+ import { join as join2 } from "path";
71
+ var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
72
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join2(getHomeDir(), ".aws", "credentials");
73
+
74
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/parseIni.js
75
+ var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
76
+ var profileNameBlockList = ["__proto__", "profile __proto__"];
77
+ var parseIni = (iniData) => {
78
+ const map = {};
79
+ let currentSection;
80
+ let currentSubSection;
81
+ for (const iniLine of iniData.split(/\r?\n/)) {
82
+ const trimmedLine = iniLine.split(/(^|\s)[;#]/)[0].trim();
83
+ const isSection = trimmedLine[0] === "[" && trimmedLine[trimmedLine.length - 1] === "]";
84
+ if (isSection) {
85
+ currentSection = void 0;
86
+ currentSubSection = void 0;
87
+ const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);
88
+ const matches = prefixKeyRegex.exec(sectionName);
89
+ if (matches) {
90
+ const [, prefix, , name] = matches;
91
+ if (Object.values(IniSectionType).includes(prefix)) {
92
+ currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);
93
+ }
94
+ } else {
95
+ currentSection = sectionName;
96
+ }
97
+ if (profileNameBlockList.includes(sectionName)) {
98
+ throw new Error(`Found invalid profile name "${sectionName}"`);
99
+ }
100
+ } else if (currentSection) {
101
+ const indexOfEqualsSign = trimmedLine.indexOf("=");
102
+ if (![0, -1].includes(indexOfEqualsSign)) {
103
+ const [name, value] = [
104
+ trimmedLine.substring(0, indexOfEqualsSign).trim(),
105
+ trimmedLine.substring(indexOfEqualsSign + 1).trim()
106
+ ];
107
+ if (value === "") {
108
+ currentSubSection = name;
109
+ } else {
110
+ if (currentSubSection && iniLine.trimStart() === iniLine) {
111
+ currentSubSection = void 0;
112
+ }
113
+ map[currentSection] = map[currentSection] || {};
114
+ const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;
115
+ map[currentSection][key] = value;
116
+ }
117
+ }
118
+ }
119
+ }
120
+ return map;
121
+ };
122
+
123
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/readFile.js
124
+ import { readFile as fsReadFile } from "fs/promises";
125
+ var filePromises = {};
126
+ var fileIntercept = {};
127
+ var readFile = (path, options) => {
128
+ if (fileIntercept[path] !== void 0) {
129
+ return fileIntercept[path];
130
+ }
131
+ if (!filePromises[path] || options?.ignoreCache) {
132
+ filePromises[path] = fsReadFile(path, "utf8");
133
+ }
134
+ return filePromises[path];
135
+ };
136
+
137
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/loadSharedConfigFiles.js
138
+ var swallowError = () => ({});
139
+ var loadSharedConfigFiles = async (init = {}) => {
140
+ const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;
141
+ const homeDir = getHomeDir();
142
+ const relativeHomeDirPrefix = "~/";
143
+ let resolvedFilepath = filepath;
144
+ if (filepath.startsWith(relativeHomeDirPrefix)) {
145
+ resolvedFilepath = join3(homeDir, filepath.slice(2));
146
+ }
147
+ let resolvedConfigFilepath = configFilepath;
148
+ if (configFilepath.startsWith(relativeHomeDirPrefix)) {
149
+ resolvedConfigFilepath = join3(homeDir, configFilepath.slice(2));
150
+ }
151
+ const parsedFiles = await Promise.all([
152
+ readFile(resolvedConfigFilepath, {
153
+ ignoreCache: init.ignoreCache
154
+ }).then(parseIni).then(getConfigData).catch(swallowError),
155
+ readFile(resolvedFilepath, {
156
+ ignoreCache: init.ignoreCache
157
+ }).then(parseIni).catch(swallowError)
158
+ ]);
159
+ return {
160
+ configFile: parsedFiles[0],
161
+ credentialsFile: parsedFiles[1]
162
+ };
163
+ };
164
+
165
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getSsoSessionData.js
166
+ var getSsoSessionData = (data) => Object.entries(data).filter(([key]) => key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR)).reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {});
167
+
168
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/loadSsoSessionData.js
169
+ var swallowError2 = () => ({});
170
+ var loadSsoSessionData = async (init = {}) => readFile(init.configFilepath ?? getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError2);
171
+
172
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/mergeConfigFiles.js
173
+ var mergeConfigFiles = (...files) => {
174
+ const merged = {};
175
+ for (const file of files) {
176
+ for (const [key, values] of Object.entries(file)) {
177
+ if (merged[key] !== void 0) {
178
+ Object.assign(merged[key], values);
179
+ } else {
180
+ merged[key] = values;
181
+ }
182
+ }
183
+ }
184
+ return merged;
185
+ };
186
+
187
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/parseKnownFiles.js
188
+ var parseKnownFiles = async (init) => {
189
+ const parsedFiles = await loadSharedConfigFiles(init);
190
+ return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);
191
+ };
192
+
193
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getSSOTokenFromFile.js
194
+ import { readFile as readFile2 } from "fs/promises";
195
+
196
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getSSOTokenFilepath.js
197
+ import { createHash } from "crypto";
198
+ import { join as join4 } from "path";
199
+ var getSSOTokenFilepath = (id) => {
200
+ const hasher = createHash("sha1");
201
+ const cacheName = hasher.update(id).digest("hex");
202
+ return join4(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
203
+ };
204
+
205
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getSSOTokenFromFile.js
206
+ var tokenIntercept = {};
207
+ var getSSOTokenFromFile = async (id) => {
208
+ if (tokenIntercept[id]) {
209
+ return tokenIntercept[id];
210
+ }
211
+ const ssoTokenFilepath = getSSOTokenFilepath(id);
212
+ const ssoTokenText = await readFile2(ssoTokenFilepath, "utf8");
213
+ return JSON.parse(ssoTokenText);
214
+ };
215
+
216
+ // ../node_modules/.bun/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/externalDataInterceptor.js
217
+ var externalDataInterceptor = {
218
+ getFileRecord() {
219
+ return fileIntercept;
220
+ },
221
+ interceptFile(path, contents) {
222
+ fileIntercept[path] = Promise.resolve(contents);
223
+ },
224
+ getTokenRecord() {
225
+ return tokenIntercept;
226
+ },
227
+ interceptToken(id, contents) {
228
+ tokenIntercept[id] = contents;
229
+ }
230
+ };
231
+
232
+ export {
233
+ getProfileName,
234
+ getSSOTokenFilepath,
235
+ getSSOTokenFromFile,
236
+ CONFIG_PREFIX_SEPARATOR,
237
+ readFile,
238
+ loadSharedConfigFiles,
239
+ loadSsoSessionData,
240
+ parseKnownFiles,
241
+ externalDataInterceptor
242
+ };
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env bun
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
+ };
@@ -1,35 +1,9 @@
1
1
  #!/usr/bin/env bun
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined") return require.apply(this, arguments);
12
- throw Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __commonJS = (cb, mod) => function __require2() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
- };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") {
19
- for (let key of __getOwnPropNames(from))
20
- if (!__hasOwnProp.call(to, key) && key !== except)
21
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
- // If the importer is in node compatibility mode or this is not an ESM
27
- // file that has been converted to a CommonJS file using a Babel-
28
- // compatible transform (i.e. "__esModule" has not been set), then set
29
- // "default" to the CommonJS "module.exports" for node compatibility.
30
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
- mod
32
- ));
2
+ import {
3
+ __commonJS,
4
+ __require,
5
+ __toESM
6
+ } from "./chunk-FFDYI4OH.mjs";
33
7
 
34
8
  // ../node_modules/.bun/yaml@2.8.3/node_modules/yaml/dist/nodes/identity.js
35
9
  var require_identity = __commonJS({
@@ -7515,6 +7489,27 @@ var SANDBOX_PATHS = {
7515
7489
  REPLICAS_MCPS_FILE: "/home/ubuntu/.replicas/mcps.json"
7516
7490
  };
7517
7491
 
7492
+ // ../shared/src/urls.ts
7493
+ function getWorkspaceDashboardUrl(workspaceId, options = {}) {
7494
+ const { encodeWorkspaceId = true, mode } = options;
7495
+ const workspaceIdValue = encodeWorkspaceId ? encodeURIComponent(workspaceId) : workspaceId;
7496
+ const modeParam = mode ? `?mode=${encodeURIComponent(mode)}` : "";
7497
+ return `https://www.replicas.dev/dashboard/workspaces/${workspaceIdValue}${modeParam}`;
7498
+ }
7499
+ var PR_URL_REGEX = /github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/;
7500
+ function parsePrUrl(url) {
7501
+ const match = url.match(PR_URL_REGEX);
7502
+ if (!match) return null;
7503
+ const [, owner, repo, numberStr] = match;
7504
+ const number = Number.parseInt(numberStr, 10);
7505
+ if (!Number.isFinite(number)) return null;
7506
+ return { owner, repo, number };
7507
+ }
7508
+ function extractPrNumber(url) {
7509
+ const parsed = parsePrUrl(url);
7510
+ return parsed ? String(parsed.number) : null;
7511
+ }
7512
+
7518
7513
  // ../shared/src/replicas-config.ts
7519
7514
  var import_yaml = __toESM(require_dist());
7520
7515
 
@@ -7570,21 +7565,6 @@ var GITHUB_TRIGGER = {
7570
7565
  ]
7571
7566
  };
7572
7567
 
7573
- // ../shared/src/urls.ts
7574
- var PR_URL_REGEX = /github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/;
7575
- function parsePrUrl(url) {
7576
- const match = url.match(PR_URL_REGEX);
7577
- if (!match) return null;
7578
- const [, owner, repo, numberStr] = match;
7579
- const number = Number.parseInt(numberStr, 10);
7580
- if (!Number.isFinite(number)) return null;
7581
- return { owner, repo, number };
7582
- }
7583
- function extractPrNumber(url) {
7584
- const parsed = parsePrUrl(url);
7585
- return parsed ? String(parsed.number) : null;
7586
- }
7587
-
7588
7568
  // ../shared/src/prompts.ts
7589
7569
  var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
7590
7570
  function removeTag(text, tag) {
@@ -8283,6 +8263,14 @@ function createMockWorkspaceRecord(organizationId, name, environmentId) {
8283
8263
  };
8284
8264
  }
8285
8265
 
8266
+ // ../shared/src/object-store/types.ts
8267
+ var MEDIA_KIND = {
8268
+ IMAGE: "image",
8269
+ VIDEO: "video",
8270
+ AUDIO: "audio"
8271
+ };
8272
+ var MEDIA_KINDS = [MEDIA_KIND.IMAGE, MEDIA_KIND.VIDEO, MEDIA_KIND.AUDIO];
8273
+
8286
8274
  // ../shared/src/pricing.ts
8287
8275
  var PLANS = {
8288
8276
  hobby: {
@@ -8729,6 +8717,7 @@ export {
8729
8717
  getValidToken,
8730
8718
  getCurrentUser,
8731
8719
  SANDBOX_PATHS,
8720
+ getWorkspaceDashboardUrl,
8732
8721
  extractPrNumber,
8733
8722
  REPLICAS_CONFIG_FILENAMES,
8734
8723
  getInitialChatId,
@@ -8740,5 +8729,7 @@ export {
8740
8729
  parseUserMessage,
8741
8730
  SOURCE_CONFIG,
8742
8731
  buildGroups,
8743
- createMockWorkspaceRecord
8732
+ createMockWorkspaceRecord,
8733
+ MEDIA_KIND,
8734
+ MEDIA_KINDS
8744
8735
  };
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/env bun
2
+ import {
3
+ chain
4
+ } from "./chunk-PNVVO6MW.mjs";
5
+ import {
6
+ getProfileName,
7
+ loadSharedConfigFiles
8
+ } from "./chunk-43COQWMG.mjs";
9
+ import {
10
+ CredentialsProviderError
11
+ } from "./chunk-OMR2FLSI.mjs";
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
+ };