@stacksjs/buddy 0.63.0 → 0.64.0

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.
Files changed (73) hide show
  1. package/README.md +1 -1
  2. package/dist/chunk-12tkdbmy.js +7 -0
  3. package/dist/{chunk-8420n19j.js.map → chunk-12tkdbmy.js.map} +6 -5
  4. package/dist/chunk-1f6t66bt.js +5 -0
  5. package/dist/{chunk-1f1xhs02.js.map → chunk-1f6t66bt.js.map} +2 -2
  6. package/dist/chunk-463qxvjp.js +5 -0
  7. package/dist/{chunk-7jmyxm7k.js.map → chunk-463qxvjp.js.map} +2 -2
  8. package/dist/chunk-47n7wt6x.js +12 -0
  9. package/dist/{chunk-qx96ff3m.js.map → chunk-47n7wt6x.js.map} +2 -2
  10. package/dist/chunk-97kwnfsa.js +5 -0
  11. package/dist/{chunk-as72s87r.js.map → chunk-97kwnfsa.js.map} +2 -2
  12. package/dist/chunk-a8vj9csq.js +6 -0
  13. package/dist/{chunk-q2vnqdcs.js.map → chunk-a8vj9csq.js.map} +6 -6
  14. package/dist/chunk-b8124fjs.js +9 -0
  15. package/dist/{chunk-afhgv4v9.js.map → chunk-b8124fjs.js.map} +2 -2
  16. package/dist/chunk-cnvpbb2z.js +5 -0
  17. package/dist/{chunk-xhsvfzz8.js.map → chunk-cnvpbb2z.js.map} +4 -4
  18. package/dist/chunk-ehm10xxj.js +21 -0
  19. package/dist/{chunk-tegm7yex.js.map → chunk-ehm10xxj.js.map} +11 -15
  20. package/dist/chunk-f9qdyafb.js +5 -0
  21. package/dist/{chunk-582dnm6a.js.map → chunk-f9qdyafb.js.map} +5 -5
  22. package/dist/chunk-fcgh2sfr.js +5 -0
  23. package/dist/{chunk-mmbfc5ft.js.map → chunk-fcgh2sfr.js.map} +2 -2
  24. package/dist/chunk-fft99hka.js +4 -0
  25. package/dist/chunk-fft99hka.js.map +16 -0
  26. package/dist/chunk-g5tqs4wa.js +5 -0
  27. package/dist/{chunk-03ckp0m6.js.map → chunk-g5tqs4wa.js.map} +4 -4
  28. package/dist/chunk-gvpcxxae.js +5 -0
  29. package/dist/{chunk-6pac0yn5.js.map → chunk-gvpcxxae.js.map} +2 -2
  30. package/dist/chunk-hd0zdkj9.js +4 -0
  31. package/dist/{chunk-zzerxbrm.js.map → chunk-hd0zdkj9.js.map} +2 -2
  32. package/dist/chunk-hj9p7vjp.js +5 -0
  33. package/dist/{chunk-yrsms9d2.js.map → chunk-hj9p7vjp.js.map} +4 -4
  34. package/dist/chunk-hxzqmyb0.js +5 -0
  35. package/dist/{chunk-rt463pw6.js.map → chunk-hxzqmyb0.js.map} +2 -2
  36. package/dist/chunk-pabnt45p.js +5 -0
  37. package/dist/{chunk-nr24kzd1.js.map → chunk-pabnt45p.js.map} +2 -2
  38. package/dist/chunk-svr5ddhq.js +4 -0
  39. package/dist/{chunk-sc3etgb7.js.map → chunk-svr5ddhq.js.map} +2 -2
  40. package/dist/chunk-wmfxrbxe.js +5 -0
  41. package/dist/{chunk-cnvp47g4.js.map → chunk-wmfxrbxe.js.map} +1 -1
  42. package/dist/cli.js +2 -126
  43. package/dist/cli.js.map +3 -3
  44. package/dist/index.js +2 -84
  45. package/dist/index.js.map +1 -1
  46. package/dist/stacks +0 -0
  47. package/package.json +1 -46
  48. package/src/cli.ts +1 -0
  49. package/src/commands/build.ts +5 -4
  50. package/src/commands/index.ts +1 -0
  51. package/src/commands/make.ts +2 -2
  52. package/src/commands/outdated.ts +31 -0
  53. package/dist/chunk-03ckp0m6.js +0 -1222
  54. package/dist/chunk-1f1xhs02.js +0 -2223
  55. package/dist/chunk-582dnm6a.js +0 -664
  56. package/dist/chunk-6pac0yn5.js +0 -126
  57. package/dist/chunk-7jmyxm7k.js +0 -85
  58. package/dist/chunk-8217wvpy.js +0 -108
  59. package/dist/chunk-8217wvpy.js.map +0 -16
  60. package/dist/chunk-8420n19j.js +0 -7417
  61. package/dist/chunk-afhgv4v9.js +0 -164
  62. package/dist/chunk-as72s87r.js +0 -61
  63. package/dist/chunk-cnvp47g4.js +0 -22
  64. package/dist/chunk-mmbfc5ft.js +0 -287
  65. package/dist/chunk-nr24kzd1.js +0 -178
  66. package/dist/chunk-q2vnqdcs.js +0 -1696
  67. package/dist/chunk-qx96ff3m.js +0 -95
  68. package/dist/chunk-rt463pw6.js +0 -46
  69. package/dist/chunk-sc3etgb7.js +0 -208
  70. package/dist/chunk-tegm7yex.js +0 -10767
  71. package/dist/chunk-xhsvfzz8.js +0 -381
  72. package/dist/chunk-yrsms9d2.js +0 -1746
  73. package/dist/chunk-zzerxbrm.js +0 -110
@@ -1,164 +0,0 @@
1
- // @bun
2
- import"./chunk-cnvp47g4.js";
3
- import {
4
- HttpRequest,
5
- NodeHttpHandler,
6
- parseRfc3339DateTime,
7
- sdkStreamMixin
8
- } from "./chunk-q2vnqdcs.js";
9
- import"./chunk-6pac0yn5.js";
10
- import {
11
- CredentialsProviderError
12
- } from "./chunk-zzerxbrm.js";
13
-
14
- // ../../../../node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
15
- import fs from "fs/promises";
16
-
17
- // ../../../../node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/checkUrl.js
18
- var ECS_CONTAINER_HOST = "169.254.170.2";
19
- var EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
20
- var EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
21
- var checkUrl = (url, logger) => {
22
- if (url.protocol === "https:") {
23
- return;
24
- }
25
- if (url.hostname === ECS_CONTAINER_HOST || url.hostname === EKS_CONTAINER_HOST_IPv4 || url.hostname === EKS_CONTAINER_HOST_IPv6) {
26
- return;
27
- }
28
- if (url.hostname.includes("[")) {
29
- if (url.hostname === "[::1]" || url.hostname === "[0000:0000:0000:0000:0000:0000:0000:0001]") {
30
- return;
31
- }
32
- } else {
33
- if (url.hostname === "localhost") {
34
- return;
35
- }
36
- const ipComponents = url.hostname.split(".");
37
- const inRange = (component) => {
38
- const num = parseInt(component, 10);
39
- return 0 <= num && num <= 255;
40
- };
41
- if (ipComponents[0] === "127" && inRange(ipComponents[1]) && inRange(ipComponents[2]) && inRange(ipComponents[3]) && ipComponents.length === 4) {
42
- return;
43
- }
44
- }
45
- throw new CredentialsProviderError(`URL not accepted. It must either be HTTPS or match one of the following:
46
- - loopback CIDR 127.0.0.0/8 or [::1/128]
47
- - ECS container host 169.254.170.2
48
- - EKS container host 169.254.170.23 or [fd00:ec2::23]`, { logger });
49
- };
50
-
51
- // ../../../../node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/requestHelpers.js
52
- function createGetRequest(url) {
53
- return new HttpRequest({
54
- protocol: url.protocol,
55
- hostname: url.hostname,
56
- port: Number(url.port),
57
- path: url.pathname,
58
- query: Array.from(url.searchParams.entries()).reduce((acc, [k, v]) => {
59
- acc[k] = v;
60
- return acc;
61
- }, {}),
62
- fragment: url.hash
63
- });
64
- }
65
- async function getCredentials(response, logger) {
66
- const stream = sdkStreamMixin(response.body);
67
- const str = await stream.transformToString();
68
- if (response.statusCode === 200) {
69
- const parsed = JSON.parse(str);
70
- if (typeof parsed.AccessKeyId !== "string" || typeof parsed.SecretAccessKey !== "string" || typeof parsed.Token !== "string" || typeof parsed.Expiration !== "string") {
71
- 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 });
72
- }
73
- return {
74
- accessKeyId: parsed.AccessKeyId,
75
- secretAccessKey: parsed.SecretAccessKey,
76
- sessionToken: parsed.Token,
77
- expiration: parseRfc3339DateTime(parsed.Expiration)
78
- };
79
- }
80
- if (response.statusCode >= 400 && response.statusCode < 500) {
81
- let parsedBody = {};
82
- try {
83
- parsedBody = JSON.parse(str);
84
- } catch (e) {
85
- }
86
- throw Object.assign(new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger }), {
87
- Code: parsedBody.Code,
88
- Message: parsedBody.Message
89
- });
90
- }
91
- throw new CredentialsProviderError(`Server responded with status: ${response.statusCode}`, { logger });
92
- }
93
-
94
- // ../../../../node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/retry-wrapper.js
95
- var retryWrapper = (toRetry, maxRetries, delayMs) => {
96
- return async () => {
97
- for (let i = 0;i < maxRetries; ++i) {
98
- try {
99
- return await toRetry();
100
- } catch (e) {
101
- await new Promise((resolve) => setTimeout(resolve, delayMs));
102
- }
103
- }
104
- return await toRetry();
105
- };
106
- };
107
-
108
- // ../../../../node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js
109
- var AWS_CONTAINER_CREDENTIALS_RELATIVE_URI = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI";
110
- var DEFAULT_LINK_LOCAL_HOST = "http://169.254.170.2";
111
- var AWS_CONTAINER_CREDENTIALS_FULL_URI = "AWS_CONTAINER_CREDENTIALS_FULL_URI";
112
- var AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE = "AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE";
113
- var AWS_CONTAINER_AUTHORIZATION_TOKEN = "AWS_CONTAINER_AUTHORIZATION_TOKEN";
114
- var fromHttp = (options = {}) => {
115
- options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
116
- let host;
117
- const relative = options.awsContainerCredentialsRelativeUri ?? process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
118
- const full = options.awsContainerCredentialsFullUri ?? process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
119
- const token = options.awsContainerAuthorizationToken ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
120
- const tokenFile = options.awsContainerAuthorizationTokenFile ?? process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
121
- const warn = options.logger?.constructor?.name === "NoOpLogger" || !options.logger ? console.warn : options.logger.warn;
122
- if (relative && full) {
123
- warn("@aws-sdk/credential-provider-http: " + "you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
124
- warn("awsContainerCredentialsFullUri will take precedence.");
125
- }
126
- if (token && tokenFile) {
127
- warn("@aws-sdk/credential-provider-http: " + "you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
128
- warn("awsContainerAuthorizationToken will take precedence.");
129
- }
130
- if (full) {
131
- host = full;
132
- } else if (relative) {
133
- host = `${DEFAULT_LINK_LOCAL_HOST}${relative}`;
134
- } else {
135
- throw new CredentialsProviderError(`No HTTP credential provider host provided.
136
- Set AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.`, { logger: options.logger });
137
- }
138
- const url = new URL(host);
139
- checkUrl(url, options.logger);
140
- const requestHandler = new NodeHttpHandler({
141
- requestTimeout: options.timeout ?? 1000,
142
- connectionTimeout: options.timeout ?? 1000
143
- });
144
- return retryWrapper(async () => {
145
- const request = createGetRequest(url);
146
- if (token) {
147
- request.headers.Authorization = token;
148
- } else if (tokenFile) {
149
- request.headers.Authorization = (await fs.readFile(tokenFile)).toString();
150
- }
151
- try {
152
- const result = await requestHandler.handle(request);
153
- return getCredentials(result.response);
154
- } catch (e) {
155
- throw new CredentialsProviderError(String(e), { logger: options.logger });
156
- }
157
- }, options.maxRetries ?? 3, options.timeout ?? 1000);
158
- };
159
- export {
160
- fromHttp
161
- };
162
-
163
- //# debugId=A0179AFA0CF1E59A64756E2164756E21
164
- //# sourceMappingURL=chunk-afhgv4v9.js.map
@@ -1,61 +0,0 @@
1
- // @bun
2
- import"./chunk-cnvp47g4.js";
3
- import {
4
- CredentialsProviderError
5
- } from "./chunk-zzerxbrm.js";
6
-
7
- // ../../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
8
- import {readFileSync} from "fs";
9
-
10
- // ../../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromWebToken.js
11
- var fromWebToken = (init) => async () => {
12
- init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");
13
- const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;
14
- let { roleAssumerWithWebIdentity } = init;
15
- if (!roleAssumerWithWebIdentity) {
16
- const { getDefaultRoleAssumerWithWebIdentity } = await import("./chunk-yrsms9d2.js");
17
- roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
18
- ...init.clientConfig,
19
- credentialProviderLogger: init.logger,
20
- parentClientConfig: init.parentClientConfig
21
- }, init.clientPlugins);
22
- }
23
- return roleAssumerWithWebIdentity({
24
- RoleArn: roleArn,
25
- RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`,
26
- WebIdentityToken: webIdentityToken,
27
- ProviderId: providerId,
28
- PolicyArns: policyArns,
29
- Policy: policy,
30
- DurationSeconds: durationSeconds
31
- });
32
- };
33
-
34
- // ../../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
35
- var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
36
- var ENV_ROLE_ARN = "AWS_ROLE_ARN";
37
- var ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
38
- var fromTokenFile = (init = {}) => async () => {
39
- init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
40
- const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
41
- const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
42
- const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
43
- if (!webIdentityTokenFile || !roleArn) {
44
- throw new CredentialsProviderError("Web identity configuration not specified", {
45
- logger: init.logger
46
- });
47
- }
48
- return fromWebToken({
49
- ...init,
50
- webIdentityToken: readFileSync(webIdentityTokenFile, { encoding: "ascii" }),
51
- roleArn,
52
- roleSessionName
53
- })();
54
- };
55
- export {
56
- fromWebToken,
57
- fromTokenFile
58
- };
59
-
60
- //# debugId=7BD116942640C8F864756E2164756E21
61
- //# sourceMappingURL=chunk-as72s87r.js.map
@@ -1,22 +0,0 @@
1
- var __create = Object.create;
2
- var __getProtoOf = Object.getPrototypeOf;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __toESM = (mod, isNodeMode, target) => {
7
- target = mod != null ? __create(__getProtoOf(mod)) : {};
8
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
- for (let key of __getOwnPropNames(mod))
10
- if (!__hasOwnProp.call(to, key))
11
- __defProp(to, key, {
12
- get: () => mod[key],
13
- enumerable: true
14
- });
15
- return to;
16
- };
17
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18
-
19
- export { __toESM, __commonJS };
20
-
21
- //# debugId=DFDD8EDE8332004064756E2164756E21
22
- //# sourceMappingURL=chunk-cnvp47g4.js.map
@@ -1,287 +0,0 @@
1
- // @bun
2
- import"./chunk-cnvp47g4.js";
3
- import"./chunk-6pac0yn5.js";
4
- import {
5
- CredentialsProviderError,
6
- TokenProviderError
7
- } from "./chunk-zzerxbrm.js";
8
- import {
9
- getProfileName,
10
- getSSOTokenFilepath,
11
- getSSOTokenFromFile,
12
- loadSsoSessionData,
13
- parseKnownFiles
14
- } from "./chunk-sc3etgb7.js";
15
-
16
- // ../../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/isSsoProfile.js
17
- 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");
18
-
19
- // ../../../../node_modules/@aws-sdk/token-providers/dist-es/constants.js
20
- var EXPIRE_WINDOW_MS = 5 * 60 * 1000;
21
- var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
22
-
23
- // ../../../../node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js
24
- var ssoOidcClientsHash = {};
25
- var getSsoOidcClient = async (ssoRegion) => {
26
- const { SSOOIDCClient } = await import("./chunk-03ckp0m6.js");
27
- if (ssoOidcClientsHash[ssoRegion]) {
28
- return ssoOidcClientsHash[ssoRegion];
29
- }
30
- const ssoOidcClient = new SSOOIDCClient({ region: ssoRegion });
31
- ssoOidcClientsHash[ssoRegion] = ssoOidcClient;
32
- return ssoOidcClient;
33
- };
34
-
35
- // ../../../../node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js
36
- var getNewSsoOidcToken = async (ssoToken, ssoRegion) => {
37
- const { CreateTokenCommand } = await import("./chunk-03ckp0m6.js");
38
- const ssoOidcClient = await getSsoOidcClient(ssoRegion);
39
- return ssoOidcClient.send(new CreateTokenCommand({
40
- clientId: ssoToken.clientId,
41
- clientSecret: ssoToken.clientSecret,
42
- refreshToken: ssoToken.refreshToken,
43
- grantType: "refresh_token"
44
- }));
45
- };
46
-
47
- // ../../../../node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js
48
- var validateTokenExpiry = (token) => {
49
- if (token.expiration && token.expiration.getTime() < Date.now()) {
50
- throw new TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
51
- }
52
- };
53
-
54
- // ../../../../node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js
55
- var validateTokenKey = (key, value, forRefresh = false) => {
56
- if (typeof value === "undefined") {
57
- throw new TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
58
- }
59
- };
60
-
61
- // ../../../../node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js
62
- import {promises as fsPromises} from "fs";
63
- var { writeFile } = fsPromises;
64
- var writeSSOTokenToFile = (id, ssoToken) => {
65
- const tokenFilepath = getSSOTokenFilepath(id);
66
- const tokenString = JSON.stringify(ssoToken, null, 2);
67
- return writeFile(tokenFilepath, tokenString);
68
- };
69
-
70
- // ../../../../node_modules/@aws-sdk/token-providers/dist-es/fromSso.js
71
- var lastRefreshAttemptTime = new Date(0);
72
- var fromSso = (init = {}) => async () => {
73
- init.logger?.debug("@aws-sdk/token-providers - fromSso");
74
- const profiles = await parseKnownFiles(init);
75
- const profileName = getProfileName(init);
76
- const profile = profiles[profileName];
77
- if (!profile) {
78
- throw new TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
79
- } else if (!profile["sso_session"]) {
80
- throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
81
- }
82
- const ssoSessionName = profile["sso_session"];
83
- const ssoSessions = await loadSsoSessionData(init);
84
- const ssoSession = ssoSessions[ssoSessionName];
85
- if (!ssoSession) {
86
- throw new TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
87
- }
88
- for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
89
- if (!ssoSession[ssoSessionRequiredKey]) {
90
- throw new TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
91
- }
92
- }
93
- const ssoStartUrl = ssoSession["sso_start_url"];
94
- const ssoRegion = ssoSession["sso_region"];
95
- let ssoToken;
96
- try {
97
- ssoToken = await getSSOTokenFromFile(ssoSessionName);
98
- } catch (e) {
99
- throw new TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
100
- }
101
- validateTokenKey("accessToken", ssoToken.accessToken);
102
- validateTokenKey("expiresAt", ssoToken.expiresAt);
103
- const { accessToken, expiresAt } = ssoToken;
104
- const existingToken = { token: accessToken, expiration: new Date(expiresAt) };
105
- if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
106
- return existingToken;
107
- }
108
- if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1000) {
109
- validateTokenExpiry(existingToken);
110
- return existingToken;
111
- }
112
- validateTokenKey("clientId", ssoToken.clientId, true);
113
- validateTokenKey("clientSecret", ssoToken.clientSecret, true);
114
- validateTokenKey("refreshToken", ssoToken.refreshToken, true);
115
- try {
116
- lastRefreshAttemptTime.setTime(Date.now());
117
- const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion);
118
- validateTokenKey("accessToken", newSsoOidcToken.accessToken);
119
- validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
120
- const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
121
- try {
122
- await writeSSOTokenToFile(ssoSessionName, {
123
- ...ssoToken,
124
- accessToken: newSsoOidcToken.accessToken,
125
- expiresAt: newTokenExpiration.toISOString(),
126
- refreshToken: newSsoOidcToken.refreshToken
127
- });
128
- } catch (error) {
129
- }
130
- return {
131
- token: newSsoOidcToken.accessToken,
132
- expiration: newTokenExpiration
133
- };
134
- } catch (error) {
135
- validateTokenExpiry(existingToken);
136
- return existingToken;
137
- }
138
- };
139
-
140
- // ../../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js
141
- var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
142
- var resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, profile, logger }) => {
143
- let token;
144
- const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
145
- if (ssoSession) {
146
- try {
147
- const _token = await fromSso({ profile })();
148
- token = {
149
- accessToken: _token.token,
150
- expiresAt: new Date(_token.expiration).toISOString()
151
- };
152
- } catch (e) {
153
- throw new CredentialsProviderError(e.message, {
154
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
155
- logger
156
- });
157
- }
158
- } else {
159
- try {
160
- token = await getSSOTokenFromFile(ssoStartUrl);
161
- } catch (e) {
162
- throw new CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
163
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
164
- logger
165
- });
166
- }
167
- }
168
- if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
169
- throw new CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
170
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
171
- logger
172
- });
173
- }
174
- const { accessToken } = token;
175
- const { SSOClient, GetRoleCredentialsCommand } = await import("./chunk-582dnm6a.js");
176
- const sso = ssoClient || new SSOClient(Object.assign({}, clientConfig ?? {}, {
177
- region: clientConfig?.region ?? ssoRegion
178
- }));
179
- let ssoResp;
180
- try {
181
- ssoResp = await sso.send(new GetRoleCredentialsCommand({
182
- accountId: ssoAccountId,
183
- roleName: ssoRoleName,
184
- accessToken
185
- }));
186
- } catch (e) {
187
- throw new CredentialsProviderError(e, {
188
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
189
- logger
190
- });
191
- }
192
- const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} } = ssoResp;
193
- if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
194
- throw new CredentialsProviderError("SSO returns an invalid temporary credential.", {
195
- tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
196
- logger
197
- });
198
- }
199
- return {
200
- accessKeyId,
201
- secretAccessKey,
202
- sessionToken,
203
- expiration: new Date(expiration),
204
- ...credentialScope && { credentialScope },
205
- ...accountId && { accountId }
206
- };
207
- };
208
-
209
- // ../../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/validateSsoProfile.js
210
- var validateSsoProfile = (profile, logger) => {
211
- const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
212
- if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
213
- 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(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, { tryNextLink: false, logger });
214
- }
215
- return profile;
216
- };
217
-
218
- // ../../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/fromSSO.js
219
- var fromSSO = (init = {}) => async () => {
220
- init.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");
221
- const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
222
- const { ssoClient } = init;
223
- const profileName = getProfileName(init);
224
- if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
225
- const profiles = await parseKnownFiles(init);
226
- const profile = profiles[profileName];
227
- if (!profile) {
228
- throw new CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });
229
- }
230
- if (!isSsoProfile(profile)) {
231
- throw new CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, {
232
- logger: init.logger
233
- });
234
- }
235
- if (profile?.sso_session) {
236
- const ssoSessions = await loadSsoSessionData(init);
237
- const session = ssoSessions[profile.sso_session];
238
- const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
239
- if (ssoRegion && ssoRegion !== session.sso_region) {
240
- throw new CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {
241
- tryNextLink: false,
242
- logger: init.logger
243
- });
244
- }
245
- if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
246
- throw new CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
247
- tryNextLink: false,
248
- logger: init.logger
249
- });
250
- }
251
- profile.sso_region = session.sso_region;
252
- profile.sso_start_url = session.sso_start_url;
253
- }
254
- const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile(profile, init.logger);
255
- return resolveSSOCredentials({
256
- ssoStartUrl: sso_start_url,
257
- ssoSession: sso_session,
258
- ssoAccountId: sso_account_id,
259
- ssoRegion: sso_region,
260
- ssoRoleName: sso_role_name,
261
- ssoClient,
262
- clientConfig: init.clientConfig,
263
- profile: profileName
264
- });
265
- } else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
266
- throw new CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " + '"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', { tryNextLink: false, logger: init.logger });
267
- } else {
268
- return resolveSSOCredentials({
269
- ssoStartUrl,
270
- ssoSession,
271
- ssoAccountId,
272
- ssoRegion,
273
- ssoRoleName,
274
- ssoClient,
275
- clientConfig: init.clientConfig,
276
- profile: profileName
277
- });
278
- }
279
- };
280
- export {
281
- validateSsoProfile,
282
- isSsoProfile,
283
- fromSSO
284
- };
285
-
286
- //# debugId=458DE9E44574CC8D64756E2164756E21
287
- //# sourceMappingURL=chunk-mmbfc5ft.js.map