replicas-mcp 0.1.7 → 0.2.1

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,39 @@
1
+ #!/usr/bin/env node
2
+
3
+ // ../node_modules/.bun/@smithy+property-provider@4.2.14/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.14/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,62 @@
1
+ #!/usr/bin/env node
2
+
3
+ // ../node_modules/.bun/@smithy+protocol-http@5.3.14/node_modules/@smithy/protocol-http/dist-es/httpRequest.js
4
+ var HttpRequest = class _HttpRequest {
5
+ method;
6
+ protocol;
7
+ hostname;
8
+ port;
9
+ path;
10
+ query;
11
+ headers;
12
+ username;
13
+ password;
14
+ fragment;
15
+ body;
16
+ constructor(options) {
17
+ this.method = options.method || "GET";
18
+ this.hostname = options.hostname || "localhost";
19
+ this.port = options.port;
20
+ this.query = options.query || {};
21
+ this.headers = options.headers || {};
22
+ this.body = options.body;
23
+ this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:";
24
+ this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/";
25
+ this.username = options.username;
26
+ this.password = options.password;
27
+ this.fragment = options.fragment;
28
+ }
29
+ static clone(request) {
30
+ const cloned = new _HttpRequest({
31
+ ...request,
32
+ headers: { ...request.headers }
33
+ });
34
+ if (cloned.query) {
35
+ cloned.query = cloneQuery(cloned.query);
36
+ }
37
+ return cloned;
38
+ }
39
+ static isInstance(request) {
40
+ if (!request) {
41
+ return false;
42
+ }
43
+ const req = request;
44
+ return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object";
45
+ }
46
+ clone() {
47
+ return _HttpRequest.clone(this);
48
+ }
49
+ };
50
+ function cloneQuery(query) {
51
+ return Object.keys(query).reduce((carry, paramName) => {
52
+ const param = query[paramName];
53
+ return {
54
+ ...carry,
55
+ [paramName]: Array.isArray(param) ? [...param] : param
56
+ };
57
+ }, {});
58
+ }
59
+
60
+ export {
61
+ HttpRequest
62
+ };
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ ProviderError
4
+ } from "./chunk-ST5JVROM.js";
5
+
6
+ // ../node_modules/.bun/@smithy+property-provider@4.2.14/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,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,14 @@
1
+ #!/usr/bin/env node
2
+
3
+ // ../node_modules/.bun/@aws-sdk+core@3.974.8/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,89 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ externalDataInterceptor,
4
+ getProfileName,
5
+ parseKnownFiles
6
+ } from "./chunk-5VUQ55WW.js";
7
+ import {
8
+ setCredentialFeature
9
+ } from "./chunk-ZNARSMJG.js";
10
+ import {
11
+ CredentialsProviderError
12
+ } from "./chunk-ST5JVROM.js";
13
+ import "./chunk-MO4EEYFW.js";
14
+
15
+ // ../node_modules/.bun/@aws-sdk+credential-provider-process@3.972.34/node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
16
+ import { exec } from "child_process";
17
+ import { promisify } from "util";
18
+
19
+ // ../node_modules/.bun/@aws-sdk+credential-provider-process@3.972.34/node_modules/@aws-sdk/credential-provider-process/dist-es/getValidatedProcessCredentials.js
20
+ var getValidatedProcessCredentials = (profileName, data, profiles) => {
21
+ if (data.Version !== 1) {
22
+ throw Error(`Profile ${profileName} credential_process did not return Version 1.`);
23
+ }
24
+ if (data.AccessKeyId === void 0 || data.SecretAccessKey === void 0) {
25
+ throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);
26
+ }
27
+ if (data.Expiration) {
28
+ const currentTime = /* @__PURE__ */ new Date();
29
+ const expireTime = new Date(data.Expiration);
30
+ if (expireTime < currentTime) {
31
+ throw Error(`Profile ${profileName} credential_process returned expired credentials.`);
32
+ }
33
+ }
34
+ let accountId = data.AccountId;
35
+ if (!accountId && profiles?.[profileName]?.aws_account_id) {
36
+ accountId = profiles[profileName].aws_account_id;
37
+ }
38
+ const credentials = {
39
+ accessKeyId: data.AccessKeyId,
40
+ secretAccessKey: data.SecretAccessKey,
41
+ ...data.SessionToken && { sessionToken: data.SessionToken },
42
+ ...data.Expiration && { expiration: new Date(data.Expiration) },
43
+ ...data.CredentialScope && { credentialScope: data.CredentialScope },
44
+ ...accountId && { accountId }
45
+ };
46
+ setCredentialFeature(credentials, "CREDENTIALS_PROCESS", "w");
47
+ return credentials;
48
+ };
49
+
50
+ // ../node_modules/.bun/@aws-sdk+credential-provider-process@3.972.34/node_modules/@aws-sdk/credential-provider-process/dist-es/resolveProcessCredentials.js
51
+ var resolveProcessCredentials = async (profileName, profiles, logger) => {
52
+ const profile = profiles[profileName];
53
+ if (profiles[profileName]) {
54
+ const credentialProcess = profile["credential_process"];
55
+ if (credentialProcess !== void 0) {
56
+ const execPromise = promisify(externalDataInterceptor?.getTokenRecord?.().exec ?? exec);
57
+ try {
58
+ const { stdout } = await execPromise(credentialProcess);
59
+ let data;
60
+ try {
61
+ data = JSON.parse(stdout.trim());
62
+ } catch {
63
+ throw Error(`Profile ${profileName} credential_process returned invalid JSON.`);
64
+ }
65
+ return getValidatedProcessCredentials(profileName, data, profiles);
66
+ } catch (error) {
67
+ throw new CredentialsProviderError(error.message, { logger });
68
+ }
69
+ } else {
70
+ throw new CredentialsProviderError(`Profile ${profileName} did not contain credential_process.`, { logger });
71
+ }
72
+ } else {
73
+ throw new CredentialsProviderError(`Profile ${profileName} could not be found in shared credentials file.`, {
74
+ logger
75
+ });
76
+ }
77
+ };
78
+
79
+ // ../node_modules/.bun/@aws-sdk+credential-provider-process@3.972.34/node_modules/@aws-sdk/credential-provider-process/dist-es/fromProcess.js
80
+ var fromProcess = (init = {}) => async ({ callerClientConfig } = {}) => {
81
+ init.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");
82
+ const profiles = await parseKnownFiles(init);
83
+ return resolveProcessCredentials(getProfileName({
84
+ profile: init.profile ?? callerClientConfig?.profile
85
+ }), profiles, init.logger);
86
+ };
87
+ export {
88
+ fromProcess
89
+ };
@@ -0,0 +1,325 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ getProfileName,
4
+ getSSOTokenFilepath,
5
+ getSSOTokenFromFile,
6
+ loadSsoSessionData,
7
+ parseKnownFiles
8
+ } from "./chunk-5VUQ55WW.js";
9
+ import {
10
+ setCredentialFeature
11
+ } from "./chunk-ZNARSMJG.js";
12
+ import {
13
+ CredentialsProviderError,
14
+ ProviderError
15
+ } from "./chunk-ST5JVROM.js";
16
+ import "./chunk-MO4EEYFW.js";
17
+
18
+ // ../node_modules/.bun/@smithy+property-provider@4.2.14/node_modules/@smithy/property-provider/dist-es/TokenProviderError.js
19
+ var TokenProviderError = class _TokenProviderError extends ProviderError {
20
+ name = "TokenProviderError";
21
+ constructor(message, options = true) {
22
+ super(message, options);
23
+ Object.setPrototypeOf(this, _TokenProviderError.prototype);
24
+ }
25
+ };
26
+
27
+ // ../node_modules/.bun/@aws-sdk+credential-provider-sso@3.972.38/node_modules/@aws-sdk/credential-provider-sso/dist-es/isSsoProfile.js
28
+ 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");
29
+
30
+ // ../node_modules/.bun/@aws-sdk+token-providers@3.1041.0/node_modules/@aws-sdk/token-providers/dist-es/constants.js
31
+ var EXPIRE_WINDOW_MS = 5 * 60 * 1e3;
32
+ var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
33
+
34
+ // ../node_modules/.bun/@aws-sdk+token-providers@3.1041.0/node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js
35
+ var getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
36
+ const { SSOOIDCClient } = await import("./sso-oidc-JF4BALR2.js");
37
+ const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
38
+ const ssoOidcClient = new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {
39
+ region: ssoRegion ?? init.clientConfig?.region,
40
+ logger: coalesce("logger"),
41
+ userAgentAppId: coalesce("userAgentAppId")
42
+ }));
43
+ return ssoOidcClient;
44
+ };
45
+
46
+ // ../node_modules/.bun/@aws-sdk+token-providers@3.1041.0/node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js
47
+ var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
48
+ const { CreateTokenCommand } = await import("./sso-oidc-JF4BALR2.js");
49
+ const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);
50
+ return ssoOidcClient.send(new CreateTokenCommand({
51
+ clientId: ssoToken.clientId,
52
+ clientSecret: ssoToken.clientSecret,
53
+ refreshToken: ssoToken.refreshToken,
54
+ grantType: "refresh_token"
55
+ }));
56
+ };
57
+
58
+ // ../node_modules/.bun/@aws-sdk+token-providers@3.1041.0/node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js
59
+ var validateTokenExpiry = (token) => {
60
+ if (token.expiration && token.expiration.getTime() < Date.now()) {
61
+ throw new TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
62
+ }
63
+ };
64
+
65
+ // ../node_modules/.bun/@aws-sdk+token-providers@3.1041.0/node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js
66
+ var validateTokenKey = (key, value, forRefresh = false) => {
67
+ if (typeof value === "undefined") {
68
+ throw new TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
69
+ }
70
+ };
71
+
72
+ // ../node_modules/.bun/@aws-sdk+token-providers@3.1041.0/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js
73
+ import { promises as fsPromises } from "fs";
74
+ var { writeFile } = fsPromises;
75
+ var writeSSOTokenToFile = (id, ssoToken) => {
76
+ const tokenFilepath = getSSOTokenFilepath(id);
77
+ const tokenString = JSON.stringify(ssoToken, null, 2);
78
+ return writeFile(tokenFilepath, tokenString);
79
+ };
80
+
81
+ // ../node_modules/.bun/@aws-sdk+token-providers@3.1041.0/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js
82
+ var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0);
83
+ var fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
84
+ init.logger?.debug("@aws-sdk/token-providers - fromSso");
85
+ const profiles = await parseKnownFiles(init);
86
+ const profileName = getProfileName({
87
+ profile: init.profile ?? callerClientConfig?.profile
88
+ });
89
+ const profile = profiles[profileName];
90
+ if (!profile) {
91
+ throw new TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
92
+ } else if (!profile["sso_session"]) {
93
+ throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
94
+ }
95
+ const ssoSessionName = profile["sso_session"];
96
+ const ssoSessions = await loadSsoSessionData(init);
97
+ const ssoSession = ssoSessions[ssoSessionName];
98
+ if (!ssoSession) {
99
+ throw new TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
100
+ }
101
+ for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
102
+ if (!ssoSession[ssoSessionRequiredKey]) {
103
+ throw new TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
104
+ }
105
+ }
106
+ const ssoStartUrl = ssoSession["sso_start_url"];
107
+ const ssoRegion = ssoSession["sso_region"];
108
+ let ssoToken;
109
+ try {
110
+ ssoToken = await getSSOTokenFromFile(ssoSessionName);
111
+ } catch (e) {
112
+ throw new TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
113
+ }
114
+ validateTokenKey("accessToken", ssoToken.accessToken);
115
+ validateTokenKey("expiresAt", ssoToken.expiresAt);
116
+ const { accessToken, expiresAt } = ssoToken;
117
+ const existingToken = { token: accessToken, expiration: new Date(expiresAt) };
118
+ if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
119
+ return existingToken;
120
+ }
121
+ if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) {
122
+ validateTokenExpiry(existingToken);
123
+ return existingToken;
124
+ }
125
+ validateTokenKey("clientId", ssoToken.clientId, true);
126
+ validateTokenKey("clientSecret", ssoToken.clientSecret, true);
127
+ validateTokenKey("refreshToken", ssoToken.refreshToken, true);
128
+ try {
129
+ lastRefreshAttemptTime.setTime(Date.now());
130
+ const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
131
+ validateTokenKey("accessToken", newSsoOidcToken.accessToken);
132
+ validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
133
+ const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3);
134
+ try {
135
+ await writeSSOTokenToFile(ssoSessionName, {
136
+ ...ssoToken,
137
+ accessToken: newSsoOidcToken.accessToken,
138
+ expiresAt: newTokenExpiration.toISOString(),
139
+ refreshToken: newSsoOidcToken.refreshToken
140
+ });
141
+ } catch (error) {
142
+ }
143
+ return {
144
+ token: newSsoOidcToken.accessToken,
145
+ expiration: newTokenExpiration
146
+ };
147
+ } catch (error) {
148
+ validateTokenExpiry(existingToken);
149
+ return existingToken;
150
+ }
151
+ };
152
+
153
+ // ../node_modules/.bun/@aws-sdk+credential-provider-sso@3.972.38/node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js
154
+ var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
155
+ var resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
156
+ let token;
157
+ const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
158
+ if (ssoSession) {
159
+ try {
160
+ const _token = await fromSso({
161
+ profile,
162
+ filepath,
163
+ configFilepath,
164
+ ignoreCache
165
+ })();
166
+ token = {
167
+ accessToken: _token.token,
168
+ expiresAt: new Date(_token.expiration).toISOString()
169
+ };
170
+ } catch (e) {
171
+ throw new CredentialsProviderError(e.message, {
172
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
173
+ logger
174
+ });
175
+ }
176
+ } else {
177
+ try {
178
+ token = await getSSOTokenFromFile(ssoStartUrl);
179
+ } catch (e) {
180
+ throw new CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
181
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
182
+ logger
183
+ });
184
+ }
185
+ }
186
+ if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
187
+ throw new CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
188
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
189
+ logger
190
+ });
191
+ }
192
+ const { accessToken } = token;
193
+ const { SSOClient, GetRoleCredentialsCommand } = await import("./loadSso-XSERNFCM.js");
194
+ const sso = ssoClient || new SSOClient(Object.assign({}, clientConfig ?? {}, {
195
+ logger: clientConfig?.logger ?? callerClientConfig?.logger ?? parentClientConfig?.logger,
196
+ region: clientConfig?.region ?? ssoRegion,
197
+ userAgentAppId: clientConfig?.userAgentAppId ?? callerClientConfig?.userAgentAppId ?? parentClientConfig?.userAgentAppId
198
+ }));
199
+ let ssoResp;
200
+ try {
201
+ ssoResp = await sso.send(new GetRoleCredentialsCommand({
202
+ accountId: ssoAccountId,
203
+ roleName: ssoRoleName,
204
+ accessToken
205
+ }));
206
+ } catch (e) {
207
+ throw new CredentialsProviderError(e, {
208
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
209
+ logger
210
+ });
211
+ }
212
+ const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} } = ssoResp;
213
+ if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
214
+ throw new CredentialsProviderError("SSO returns an invalid temporary credential.", {
215
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
216
+ logger
217
+ });
218
+ }
219
+ const credentials = {
220
+ accessKeyId,
221
+ secretAccessKey,
222
+ sessionToken,
223
+ expiration: new Date(expiration),
224
+ ...credentialScope && { credentialScope },
225
+ ...accountId && { accountId }
226
+ };
227
+ if (ssoSession) {
228
+ setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
229
+ } else {
230
+ setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
231
+ }
232
+ return credentials;
233
+ };
234
+
235
+ // ../node_modules/.bun/@aws-sdk+credential-provider-sso@3.972.38/node_modules/@aws-sdk/credential-provider-sso/dist-es/validateSsoProfile.js
236
+ var validateSsoProfile = (profile, logger) => {
237
+ const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
238
+ if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
239
+ throw new CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}
240
+ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });
241
+ }
242
+ return profile;
243
+ };
244
+
245
+ // ../node_modules/.bun/@aws-sdk+credential-provider-sso@3.972.38/node_modules/@aws-sdk/credential-provider-sso/dist-es/fromSSO.js
246
+ var fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {
247
+ init.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");
248
+ const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
249
+ const { ssoClient } = init;
250
+ const profileName = getProfileName({
251
+ profile: init.profile ?? callerClientConfig?.profile
252
+ });
253
+ if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
254
+ const profiles = await parseKnownFiles(init);
255
+ const profile = profiles[profileName];
256
+ if (!profile) {
257
+ throw new CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });
258
+ }
259
+ if (!isSsoProfile(profile)) {
260
+ throw new CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, {
261
+ logger: init.logger
262
+ });
263
+ }
264
+ if (profile?.sso_session) {
265
+ const ssoSessions = await loadSsoSessionData(init);
266
+ const session = ssoSessions[profile.sso_session];
267
+ const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
268
+ if (ssoRegion && ssoRegion !== session.sso_region) {
269
+ throw new CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {
270
+ tryNextLink: false,
271
+ logger: init.logger
272
+ });
273
+ }
274
+ if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
275
+ throw new CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
276
+ tryNextLink: false,
277
+ logger: init.logger
278
+ });
279
+ }
280
+ profile.sso_region = session.sso_region;
281
+ profile.sso_start_url = session.sso_start_url;
282
+ }
283
+ const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile(profile, init.logger);
284
+ return resolveSSOCredentials({
285
+ ssoStartUrl: sso_start_url,
286
+ ssoSession: sso_session,
287
+ ssoAccountId: sso_account_id,
288
+ ssoRegion: sso_region,
289
+ ssoRoleName: sso_role_name,
290
+ ssoClient,
291
+ clientConfig: init.clientConfig,
292
+ parentClientConfig: init.parentClientConfig,
293
+ callerClientConfig: init.callerClientConfig,
294
+ profile: profileName,
295
+ filepath: init.filepath,
296
+ configFilepath: init.configFilepath,
297
+ ignoreCache: init.ignoreCache,
298
+ logger: init.logger
299
+ });
300
+ } else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
301
+ throw new CredentialsProviderError('Incomplete configuration. The fromSSO() argument hash must include "ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', { tryNextLink: false, logger: init.logger });
302
+ } else {
303
+ return resolveSSOCredentials({
304
+ ssoStartUrl,
305
+ ssoSession,
306
+ ssoAccountId,
307
+ ssoRegion,
308
+ ssoRoleName,
309
+ ssoClient,
310
+ clientConfig: init.clientConfig,
311
+ parentClientConfig: init.parentClientConfig,
312
+ callerClientConfig: init.callerClientConfig,
313
+ profile: profileName,
314
+ filepath: init.filepath,
315
+ configFilepath: init.configFilepath,
316
+ ignoreCache: init.ignoreCache,
317
+ logger: init.logger
318
+ });
319
+ }
320
+ };
321
+ export {
322
+ fromSSO,
323
+ isSsoProfile,
324
+ validateSsoProfile
325
+ };