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,42 @@
1
+ #!/usr/bin/env bun
2
+ import {
3
+ __publicField
4
+ } from "./chunk-FFDYI4OH.mjs";
5
+
6
+ // ../node_modules/.bun/@smithy+property-provider@4.2.12/node_modules/@smithy/property-provider/dist-es/ProviderError.js
7
+ var ProviderError = class _ProviderError extends Error {
8
+ constructor(message, options = true) {
9
+ let logger;
10
+ let tryNextLink = true;
11
+ if (typeof options === "boolean") {
12
+ logger = void 0;
13
+ tryNextLink = options;
14
+ } else if (options != null && typeof options === "object") {
15
+ logger = options.logger;
16
+ tryNextLink = options.tryNextLink ?? true;
17
+ }
18
+ super(message);
19
+ __publicField(this, "name", "ProviderError");
20
+ __publicField(this, "tryNextLink");
21
+ this.tryNextLink = tryNextLink;
22
+ Object.setPrototypeOf(this, _ProviderError.prototype);
23
+ logger?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
24
+ }
25
+ static from(error, options = true) {
26
+ return Object.assign(new this(error.message, options), error);
27
+ }
28
+ };
29
+
30
+ // ../node_modules/.bun/@smithy+property-provider@4.2.12/node_modules/@smithy/property-provider/dist-es/CredentialsProviderError.js
31
+ var CredentialsProviderError = class _CredentialsProviderError extends ProviderError {
32
+ constructor(message, options = true) {
33
+ super(message, options);
34
+ __publicField(this, "name", "CredentialsProviderError");
35
+ Object.setPrototypeOf(this, _CredentialsProviderError.prototype);
36
+ }
37
+ };
38
+
39
+ export {
40
+ ProviderError,
41
+ CredentialsProviderError
42
+ };
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env bun
2
+ import {
3
+ ProviderError
4
+ } from "./chunk-OMR2FLSI.mjs";
5
+
6
+ // ../node_modules/.bun/@smithy+property-provider@4.2.12/node_modules/@smithy/property-provider/dist-es/chain.js
7
+ var chain = (...providers) => async () => {
8
+ if (providers.length === 0) {
9
+ throw new ProviderError("No providers in chain");
10
+ }
11
+ let lastProviderError;
12
+ for (const provider of providers) {
13
+ try {
14
+ const credentials = await provider();
15
+ return credentials;
16
+ } catch (err) {
17
+ lastProviderError = err;
18
+ if (err?.tryNextLink) {
19
+ continue;
20
+ }
21
+ throw err;
22
+ }
23
+ }
24
+ throw lastProviderError;
25
+ };
26
+
27
+ export {
28
+ chain
29
+ };
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env bun
2
+
3
+ // ../node_modules/.bun/@aws-sdk+core@3.973.26/node_modules/@aws-sdk/core/dist-es/submodules/client/setCredentialFeature.js
4
+ function setCredentialFeature(credentials, feature, value) {
5
+ if (!credentials.$source) {
6
+ credentials.$source = {};
7
+ }
8
+ credentials.$source[feature] = value;
9
+ return credentials;
10
+ }
11
+
12
+ export {
13
+ setCredentialFeature
14
+ };
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bun
2
+
3
+ // ../node_modules/.bun/@smithy+is-array-buffer@4.2.2/node_modules/@smithy/is-array-buffer/dist-es/index.js
4
+ var isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
5
+
6
+ // ../node_modules/.bun/@smithy+util-buffer-from@4.2.2/node_modules/@smithy/util-buffer-from/dist-es/index.js
7
+ import { Buffer } from "buffer";
8
+ var fromArrayBuffer = (input, offset = 0, length = input.byteLength - offset) => {
9
+ if (!isArrayBuffer(input)) {
10
+ throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`);
11
+ }
12
+ return Buffer.from(input, offset, length);
13
+ };
14
+ var fromString = (input, encoding) => {
15
+ if (typeof input !== "string") {
16
+ throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`);
17
+ }
18
+ return encoding ? Buffer.from(input, encoding) : Buffer.from(input);
19
+ };
20
+
21
+ // ../node_modules/.bun/@smithy+util-utf8@4.2.2/node_modules/@smithy/util-utf8/dist-es/fromUtf8.js
22
+ var fromUtf8 = (input) => {
23
+ const buf = fromString(input, "utf8");
24
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
25
+ };
26
+
27
+ // ../node_modules/.bun/@smithy+util-utf8@4.2.2/node_modules/@smithy/util-utf8/dist-es/toUtf8.js
28
+ var toUtf8 = (input) => {
29
+ if (typeof input === "string") {
30
+ return input;
31
+ }
32
+ if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
33
+ throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
34
+ }
35
+ return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
36
+ };
37
+
38
+ export {
39
+ isArrayBuffer,
40
+ fromArrayBuffer,
41
+ fromString,
42
+ fromUtf8,
43
+ toUtf8
44
+ };
@@ -0,0 +1,493 @@
1
+ #!/usr/bin/env bun
2
+ import {
3
+ chain
4
+ } from "./chunk-PNVVO6MW.mjs";
5
+ import {
6
+ getProfileName,
7
+ parseKnownFiles,
8
+ readFile
9
+ } from "./chunk-43COQWMG.mjs";
10
+ import {
11
+ HttpRequest
12
+ } from "./chunk-HDHAEUVR.mjs";
13
+ import {
14
+ setCredentialFeature
15
+ } from "./chunk-R7VCWGZ2.mjs";
16
+ import {
17
+ CredentialsProviderError
18
+ } from "./chunk-OMR2FLSI.mjs";
19
+ import {
20
+ __publicField
21
+ } from "./chunk-FFDYI4OH.mjs";
22
+
23
+ // ../node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.28/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveCredentialSource.js
24
+ var resolveCredentialSource = (credentialSource, profileName, logger) => {
25
+ const sourceProvidersMap = {
26
+ EcsContainer: async (options) => {
27
+ const { fromHttp } = await import("./dist-es-URIWYPPF.mjs");
28
+ const { fromContainerMetadata } = await import("./dist-es-XKOZULQT.mjs");
29
+ logger?.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
30
+ return async () => chain(fromHttp(options ?? {}), fromContainerMetadata(options))().then(setNamedProvider);
31
+ },
32
+ Ec2InstanceMetadata: async (options) => {
33
+ logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
34
+ const { fromInstanceMetadata } = await import("./dist-es-XKOZULQT.mjs");
35
+ return async () => fromInstanceMetadata(options)().then(setNamedProvider);
36
+ },
37
+ Environment: async (options) => {
38
+ logger?.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
39
+ const { fromEnv } = await import("./dist-es-VFOQQKFA.mjs");
40
+ return async () => fromEnv(options)().then(setNamedProvider);
41
+ }
42
+ };
43
+ if (credentialSource in sourceProvidersMap) {
44
+ return sourceProvidersMap[credentialSource];
45
+ } else {
46
+ throw new CredentialsProviderError(`Unsupported credential source in profile ${profileName}. Got ${credentialSource}, expected EcsContainer or Ec2InstanceMetadata or Environment.`, { logger });
47
+ }
48
+ };
49
+ var setNamedProvider = (creds) => setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
50
+
51
+ // ../node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.28/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveAssumeRoleCredentials.js
52
+ var isAssumeRoleProfile = (arg, { profile = "default", logger } = {}) => {
53
+ return Boolean(arg) && typeof arg === "object" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1 && ["undefined", "string"].indexOf(typeof arg.external_id) > -1 && ["undefined", "string"].indexOf(typeof arg.mfa_serial) > -1 && (isAssumeRoleWithSourceProfile(arg, { profile, logger }) || isCredentialSourceProfile(arg, { profile, logger }));
54
+ };
55
+ var isAssumeRoleWithSourceProfile = (arg, { profile, logger }) => {
56
+ const withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
57
+ if (withSourceProfile) {
58
+ logger?.debug?.(` ${profile} isAssumeRoleWithSourceProfile source_profile=${arg.source_profile}`);
59
+ }
60
+ return withSourceProfile;
61
+ };
62
+ var isCredentialSourceProfile = (arg, { profile, logger }) => {
63
+ const withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined";
64
+ if (withProviderProfile) {
65
+ logger?.debug?.(` ${profile} isCredentialSourceProfile credential_source=${arg.credential_source}`);
66
+ }
67
+ return withProviderProfile;
68
+ };
69
+ var resolveAssumeRoleCredentials = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, resolveProfileData2) => {
70
+ options.logger?.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");
71
+ const profileData = profiles[profileName];
72
+ const { source_profile, region } = profileData;
73
+ if (!options.roleAssumer) {
74
+ const { getDefaultRoleAssumer } = await import("./sts-7OF5CJSW.mjs");
75
+ options.roleAssumer = getDefaultRoleAssumer({
76
+ ...options.clientConfig,
77
+ credentialProviderLogger: options.logger,
78
+ parentClientConfig: {
79
+ ...callerClientConfig,
80
+ ...options?.parentClientConfig,
81
+ region: region ?? options?.parentClientConfig?.region ?? callerClientConfig?.region
82
+ }
83
+ }, options.clientPlugins);
84
+ }
85
+ if (source_profile && source_profile in visitedProfiles) {
86
+ throw new CredentialsProviderError(`Detected a cycle attempting to resolve credentials for profile ${getProfileName(options)}. Profiles visited: ` + Object.keys(visitedProfiles).join(", "), { logger: options.logger });
87
+ }
88
+ options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
89
+ const sourceCredsProvider = source_profile ? resolveProfileData2(source_profile, profiles, options, callerClientConfig, {
90
+ ...visitedProfiles,
91
+ [source_profile]: true
92
+ }, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {})) : (await resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options))();
93
+ if (isCredentialSourceWithoutRoleArn(profileData)) {
94
+ return sourceCredsProvider.then((creds) => setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
95
+ } else {
96
+ const params = {
97
+ RoleArn: profileData.role_arn,
98
+ RoleSessionName: profileData.role_session_name || `aws-sdk-js-${Date.now()}`,
99
+ ExternalId: profileData.external_id,
100
+ DurationSeconds: parseInt(profileData.duration_seconds || "3600", 10)
101
+ };
102
+ const { mfa_serial } = profileData;
103
+ if (mfa_serial) {
104
+ if (!options.mfaCodeProvider) {
105
+ throw new CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
106
+ }
107
+ params.SerialNumber = mfa_serial;
108
+ params.TokenCode = await options.mfaCodeProvider(mfa_serial);
109
+ }
110
+ const sourceCreds = await sourceCredsProvider;
111
+ return options.roleAssumer(sourceCreds, params).then((creds) => setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o"));
112
+ }
113
+ };
114
+ var isCredentialSourceWithoutRoleArn = (section) => {
115
+ return !section.role_arn && !!section.credential_source;
116
+ };
117
+
118
+ // ../node_modules/.bun/@aws-sdk+credential-provider-login@3.972.28/node_modules/@aws-sdk/credential-provider-login/dist-es/LoginCredentialsFetcher.js
119
+ import { createHash, createPrivateKey, createPublicKey, sign } from "crypto";
120
+ import { promises as fs } from "fs";
121
+ import { homedir } from "os";
122
+ import { dirname, join } from "path";
123
+ var _LoginCredentialsFetcher = class _LoginCredentialsFetcher {
124
+ constructor(profileData, init, callerClientConfig) {
125
+ __publicField(this, "profileData");
126
+ __publicField(this, "init");
127
+ __publicField(this, "callerClientConfig");
128
+ this.profileData = profileData;
129
+ this.init = init;
130
+ this.callerClientConfig = callerClientConfig;
131
+ }
132
+ async loadCredentials() {
133
+ const token = await this.loadToken();
134
+ if (!token) {
135
+ throw new CredentialsProviderError(`Failed to load a token for session ${this.loginSession}, please re-authenticate using aws login`, { tryNextLink: false, logger: this.logger });
136
+ }
137
+ const accessToken = token.accessToken;
138
+ const now = Date.now();
139
+ const expiryTime = new Date(accessToken.expiresAt).getTime();
140
+ const timeUntilExpiry = expiryTime - now;
141
+ if (timeUntilExpiry <= _LoginCredentialsFetcher.REFRESH_THRESHOLD) {
142
+ return this.refresh(token);
143
+ }
144
+ return {
145
+ accessKeyId: accessToken.accessKeyId,
146
+ secretAccessKey: accessToken.secretAccessKey,
147
+ sessionToken: accessToken.sessionToken,
148
+ accountId: accessToken.accountId,
149
+ expiration: new Date(accessToken.expiresAt)
150
+ };
151
+ }
152
+ get logger() {
153
+ return this.init?.logger;
154
+ }
155
+ get loginSession() {
156
+ return this.profileData.login_session;
157
+ }
158
+ async refresh(token) {
159
+ const { SigninClient, CreateOAuth2TokenCommand } = await import("./signin-QNS25VI4.mjs");
160
+ const { logger, userAgentAppId } = this.callerClientConfig ?? {};
161
+ const isH2 = (requestHandler2) => {
162
+ return requestHandler2?.metadata?.handlerProtocol === "h2";
163
+ };
164
+ const requestHandler = isH2(this.callerClientConfig?.requestHandler) ? void 0 : this.callerClientConfig?.requestHandler;
165
+ const region = this.profileData.region ?? await this.callerClientConfig?.region?.() ?? process.env.AWS_REGION;
166
+ const client = new SigninClient({
167
+ credentials: {
168
+ accessKeyId: "",
169
+ secretAccessKey: ""
170
+ },
171
+ region,
172
+ requestHandler,
173
+ logger,
174
+ userAgentAppId,
175
+ ...this.init?.clientConfig
176
+ });
177
+ this.createDPoPInterceptor(client.middlewareStack);
178
+ const commandInput = {
179
+ tokenInput: {
180
+ clientId: token.clientId,
181
+ refreshToken: token.refreshToken,
182
+ grantType: "refresh_token"
183
+ }
184
+ };
185
+ try {
186
+ const response = await client.send(new CreateOAuth2TokenCommand(commandInput));
187
+ const { accessKeyId, secretAccessKey, sessionToken } = response.tokenOutput?.accessToken ?? {};
188
+ const { refreshToken, expiresIn } = response.tokenOutput ?? {};
189
+ if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
190
+ throw new CredentialsProviderError("Token refresh response missing required fields", {
191
+ logger: this.logger,
192
+ tryNextLink: false
193
+ });
194
+ }
195
+ const expiresInMs = (expiresIn ?? 900) * 1e3;
196
+ const expiration = new Date(Date.now() + expiresInMs);
197
+ const updatedToken = {
198
+ ...token,
199
+ accessToken: {
200
+ ...token.accessToken,
201
+ accessKeyId,
202
+ secretAccessKey,
203
+ sessionToken,
204
+ expiresAt: expiration.toISOString()
205
+ },
206
+ refreshToken
207
+ };
208
+ await this.saveToken(updatedToken);
209
+ const newAccessToken = updatedToken.accessToken;
210
+ return {
211
+ accessKeyId: newAccessToken.accessKeyId,
212
+ secretAccessKey: newAccessToken.secretAccessKey,
213
+ sessionToken: newAccessToken.sessionToken,
214
+ accountId: newAccessToken.accountId,
215
+ expiration
216
+ };
217
+ } catch (error) {
218
+ if (error.name === "AccessDeniedException") {
219
+ const errorType = error.error;
220
+ let message;
221
+ switch (errorType) {
222
+ case "TOKEN_EXPIRED":
223
+ message = "Your session has expired. Please reauthenticate.";
224
+ break;
225
+ case "USER_CREDENTIALS_CHANGED":
226
+ message = "Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";
227
+ break;
228
+ case "INSUFFICIENT_PERMISSIONS":
229
+ message = "Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";
230
+ break;
231
+ default:
232
+ message = `Failed to refresh token: ${String(error)}. Please re-authenticate using \`aws login\``;
233
+ }
234
+ throw new CredentialsProviderError(message, { logger: this.logger, tryNextLink: false });
235
+ }
236
+ throw new CredentialsProviderError(`Failed to refresh token: ${String(error)}. Please re-authenticate using aws login`, { logger: this.logger });
237
+ }
238
+ }
239
+ async loadToken() {
240
+ const tokenFilePath = this.getTokenFilePath();
241
+ try {
242
+ let tokenData;
243
+ try {
244
+ tokenData = await readFile(tokenFilePath, { ignoreCache: this.init?.ignoreCache });
245
+ } catch {
246
+ tokenData = await fs.readFile(tokenFilePath, "utf8");
247
+ }
248
+ const token = JSON.parse(tokenData);
249
+ const missingFields = ["accessToken", "clientId", "refreshToken", "dpopKey"].filter((k) => !token[k]);
250
+ if (!token.accessToken?.accountId) {
251
+ missingFields.push("accountId");
252
+ }
253
+ if (missingFields.length > 0) {
254
+ throw new CredentialsProviderError(`Token validation failed, missing fields: ${missingFields.join(", ")}`, {
255
+ logger: this.logger,
256
+ tryNextLink: false
257
+ });
258
+ }
259
+ return token;
260
+ } catch (error) {
261
+ throw new CredentialsProviderError(`Failed to load token from ${tokenFilePath}: ${String(error)}`, {
262
+ logger: this.logger,
263
+ tryNextLink: false
264
+ });
265
+ }
266
+ }
267
+ async saveToken(token) {
268
+ const tokenFilePath = this.getTokenFilePath();
269
+ const directory = dirname(tokenFilePath);
270
+ try {
271
+ await fs.mkdir(directory, { recursive: true });
272
+ } catch (error) {
273
+ }
274
+ await fs.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
275
+ }
276
+ getTokenFilePath() {
277
+ const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join(homedir(), ".aws", "login", "cache");
278
+ const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
279
+ const loginSessionSha256 = createHash("sha256").update(loginSessionBytes).digest("hex");
280
+ return join(directory, `${loginSessionSha256}.json`);
281
+ }
282
+ derToRawSignature(derSignature) {
283
+ let offset = 2;
284
+ if (derSignature[offset] !== 2) {
285
+ throw new Error("Invalid DER signature");
286
+ }
287
+ offset++;
288
+ const rLength = derSignature[offset++];
289
+ let r = derSignature.subarray(offset, offset + rLength);
290
+ offset += rLength;
291
+ if (derSignature[offset] !== 2) {
292
+ throw new Error("Invalid DER signature");
293
+ }
294
+ offset++;
295
+ const sLength = derSignature[offset++];
296
+ let s = derSignature.subarray(offset, offset + sLength);
297
+ r = r[0] === 0 ? r.subarray(1) : r;
298
+ s = s[0] === 0 ? s.subarray(1) : s;
299
+ const rPadded = Buffer.concat([Buffer.alloc(32 - r.length), r]);
300
+ const sPadded = Buffer.concat([Buffer.alloc(32 - s.length), s]);
301
+ return Buffer.concat([rPadded, sPadded]);
302
+ }
303
+ createDPoPInterceptor(middlewareStack) {
304
+ middlewareStack.add((next) => async (args) => {
305
+ if (HttpRequest.isInstance(args.request)) {
306
+ const request = args.request;
307
+ const actualEndpoint = `${request.protocol}//${request.hostname}${request.port ? `:${request.port}` : ""}${request.path}`;
308
+ const dpop = await this.generateDpop(request.method, actualEndpoint);
309
+ request.headers = {
310
+ ...request.headers,
311
+ DPoP: dpop
312
+ };
313
+ }
314
+ return next(args);
315
+ }, {
316
+ step: "finalizeRequest",
317
+ name: "dpopInterceptor",
318
+ override: true
319
+ });
320
+ }
321
+ async generateDpop(method = "POST", endpoint) {
322
+ const token = await this.loadToken();
323
+ try {
324
+ const privateKey = createPrivateKey({
325
+ key: token.dpopKey,
326
+ format: "pem",
327
+ type: "sec1"
328
+ });
329
+ const publicKey = createPublicKey(privateKey);
330
+ const publicDer = publicKey.export({ format: "der", type: "spki" });
331
+ let pointStart = -1;
332
+ for (let i = 0; i < publicDer.length; i++) {
333
+ if (publicDer[i] === 4) {
334
+ pointStart = i;
335
+ break;
336
+ }
337
+ }
338
+ const x = publicDer.slice(pointStart + 1, pointStart + 33);
339
+ const y = publicDer.slice(pointStart + 33, pointStart + 65);
340
+ const header = {
341
+ alg: "ES256",
342
+ typ: "dpop+jwt",
343
+ jwk: {
344
+ kty: "EC",
345
+ crv: "P-256",
346
+ x: x.toString("base64url"),
347
+ y: y.toString("base64url")
348
+ }
349
+ };
350
+ const payload = {
351
+ jti: crypto.randomUUID(),
352
+ htm: method,
353
+ htu: endpoint,
354
+ iat: Math.floor(Date.now() / 1e3)
355
+ };
356
+ const headerB64 = Buffer.from(JSON.stringify(header)).toString("base64url");
357
+ const payloadB64 = Buffer.from(JSON.stringify(payload)).toString("base64url");
358
+ const message = `${headerB64}.${payloadB64}`;
359
+ const asn1Signature = sign("sha256", Buffer.from(message), privateKey);
360
+ const rawSignature = this.derToRawSignature(asn1Signature);
361
+ const signatureB64 = rawSignature.toString("base64url");
362
+ return `${message}.${signatureB64}`;
363
+ } catch (error) {
364
+ throw new CredentialsProviderError(`Failed to generate Dpop proof: ${error instanceof Error ? error.message : String(error)}`, { logger: this.logger, tryNextLink: false });
365
+ }
366
+ }
367
+ };
368
+ __publicField(_LoginCredentialsFetcher, "REFRESH_THRESHOLD", 5 * 60 * 1e3);
369
+ var LoginCredentialsFetcher = _LoginCredentialsFetcher;
370
+
371
+ // ../node_modules/.bun/@aws-sdk+credential-provider-login@3.972.28/node_modules/@aws-sdk/credential-provider-login/dist-es/fromLoginCredentials.js
372
+ var fromLoginCredentials = (init) => async ({ callerClientConfig } = {}) => {
373
+ init?.logger?.debug?.("@aws-sdk/credential-providers - fromLoginCredentials");
374
+ const profiles = await parseKnownFiles(init || {});
375
+ const profileName = getProfileName({
376
+ profile: init?.profile ?? callerClientConfig?.profile
377
+ });
378
+ const profile = profiles[profileName];
379
+ if (!profile?.login_session) {
380
+ throw new CredentialsProviderError(`Profile ${profileName} does not contain login_session.`, {
381
+ tryNextLink: true,
382
+ logger: init?.logger
383
+ });
384
+ }
385
+ const fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);
386
+ const credentials = await fetcher.loadCredentials();
387
+ return setCredentialFeature(credentials, "CREDENTIALS_LOGIN", "AD");
388
+ };
389
+
390
+ // ../node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.28/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveLoginCredentials.js
391
+ var isLoginProfile = (data) => {
392
+ return Boolean(data && data.login_session);
393
+ };
394
+ var resolveLoginCredentials = async (profileName, options, callerClientConfig) => {
395
+ const credentials = await fromLoginCredentials({
396
+ ...options,
397
+ profile: profileName
398
+ })({ callerClientConfig });
399
+ return setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC");
400
+ };
401
+
402
+ // ../node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.28/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js
403
+ var isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string";
404
+ var resolveProcessCredentials = async (options, profile) => import("./dist-es-I6P57CZS.mjs").then(({ fromProcess }) => fromProcess({
405
+ ...options,
406
+ profile
407
+ })().then((creds) => setCredentialFeature(creds, "CREDENTIALS_PROFILE_PROCESS", "v")));
408
+
409
+ // ../node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.28/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveSsoCredentials.js
410
+ var resolveSsoCredentials = async (profile, profileData, options = {}, callerClientConfig) => {
411
+ const { fromSSO } = await import("./dist-es-HC7MGS4M.mjs");
412
+ return fromSSO({
413
+ profile,
414
+ logger: options.logger,
415
+ parentClientConfig: options.parentClientConfig,
416
+ clientConfig: options.clientConfig
417
+ })({
418
+ callerClientConfig
419
+ }).then((creds) => {
420
+ if (profileData.sso_session) {
421
+ return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
422
+ } else {
423
+ return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
424
+ }
425
+ });
426
+ };
427
+ var isSsoProfile = (arg) => arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string");
428
+
429
+ // ../node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.28/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveStaticCredentials.js
430
+ var isStaticCredsProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.aws_access_key_id === "string" && typeof arg.aws_secret_access_key === "string" && ["undefined", "string"].indexOf(typeof arg.aws_session_token) > -1 && ["undefined", "string"].indexOf(typeof arg.aws_account_id) > -1;
431
+ var resolveStaticCredentials = async (profile, options) => {
432
+ options?.logger?.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");
433
+ const credentials = {
434
+ accessKeyId: profile.aws_access_key_id,
435
+ secretAccessKey: profile.aws_secret_access_key,
436
+ sessionToken: profile.aws_session_token,
437
+ ...profile.aws_credential_scope && { credentialScope: profile.aws_credential_scope },
438
+ ...profile.aws_account_id && { accountId: profile.aws_account_id }
439
+ };
440
+ return setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n");
441
+ };
442
+
443
+ // ../node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.28/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js
444
+ var isWebIdentityProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && ["undefined", "string"].indexOf(typeof arg.role_session_name) > -1;
445
+ var resolveWebIdentityCredentials = async (profile, options, callerClientConfig) => import("./dist-es-WSBAYZQI.mjs").then(({ fromTokenFile }) => fromTokenFile({
446
+ webIdentityTokenFile: profile.web_identity_token_file,
447
+ roleArn: profile.role_arn,
448
+ roleSessionName: profile.role_session_name,
449
+ roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity,
450
+ logger: options.logger,
451
+ parentClientConfig: options.parentClientConfig
452
+ })({
453
+ callerClientConfig
454
+ }).then((creds) => setCredentialFeature(creds, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q")));
455
+
456
+ // ../node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.28/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProfileData.js
457
+ var resolveProfileData = async (profileName, profiles, options, callerClientConfig, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
458
+ const data = profiles[profileName];
459
+ if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
460
+ return resolveStaticCredentials(data, options);
461
+ }
462
+ if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) {
463
+ return resolveAssumeRoleCredentials(profileName, profiles, options, callerClientConfig, visitedProfiles, resolveProfileData);
464
+ }
465
+ if (isStaticCredsProfile(data)) {
466
+ return resolveStaticCredentials(data, options);
467
+ }
468
+ if (isWebIdentityProfile(data)) {
469
+ return resolveWebIdentityCredentials(data, options, callerClientConfig);
470
+ }
471
+ if (isProcessProfile(data)) {
472
+ return resolveProcessCredentials(options, profileName);
473
+ }
474
+ if (isSsoProfile(data)) {
475
+ return await resolveSsoCredentials(profileName, data, options, callerClientConfig);
476
+ }
477
+ if (isLoginProfile(data)) {
478
+ return resolveLoginCredentials(profileName, options, callerClientConfig);
479
+ }
480
+ throw new CredentialsProviderError(`Could not resolve credentials using profile: [${profileName}] in configuration/credentials file(s).`, { logger: options.logger });
481
+ };
482
+
483
+ // ../node_modules/.bun/@aws-sdk+credential-provider-ini@3.972.28/node_modules/@aws-sdk/credential-provider-ini/dist-es/fromIni.js
484
+ var fromIni = (init = {}) => async ({ callerClientConfig } = {}) => {
485
+ init.logger?.debug("@aws-sdk/credential-provider-ini - fromIni");
486
+ const profiles = await parseKnownFiles(init);
487
+ return resolveProfileData(getProfileName({
488
+ profile: init.profile ?? callerClientConfig?.profile
489
+ }), profiles, init, callerClientConfig);
490
+ };
491
+ export {
492
+ fromIni
493
+ };