@jr2804/livesync-cli 1.0.0-cli → 1.0.0-cli.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.
Files changed (33) hide show
  1. package/dist/AwsRestJsonProtocol-BPmCQzXa.cjs +391 -0
  2. package/dist/CredentialsProviderError-DQ_v7TCm.cjs +45 -0
  3. package/dist/XmlShapeDeserializer-B1_gcW92.cjs +2097 -0
  4. package/dist/bundle.cjs +152019 -0
  5. package/dist/chain-D9g13I5f.cjs +21 -0
  6. package/dist/common-B3KclSP_.cjs +375 -0
  7. package/dist/configLoader-Cur07c2S.cjs +149 -0
  8. package/dist/date-utils-Dr5LXq4_.cjs +338 -0
  9. package/dist/dist-es-BU2b9jKG.cjs +274 -0
  10. package/dist/dist-es-CaaxKLO9.cjs +52 -0
  11. package/dist/dist-es-D7nIauPC.cjs +60 -0
  12. package/dist/dist-es-DhxfSNMj.cjs +128 -0
  13. package/dist/dist-es-FcX9AtZC.cjs +433 -0
  14. package/dist/dist-es-vq3O1QUl.cjs +331 -0
  15. package/dist/esbuild.config.cjs +24 -0
  16. package/dist/event-streams-DmrxQXpO.cjs +195 -0
  17. package/dist/extensions-DkDzTVCO.cjs +4823 -0
  18. package/dist/externalDataInterceptor-D7DaIG7M.cjs +24 -0
  19. package/dist/getSSOTokenFromFile-D0KPH2qZ.cjs +36 -0
  20. package/dist/httpRequest-C7Ex2WeE.cjs +59 -0
  21. package/dist/loadSharedConfigFiles-CqEQHuLW.cjs +117 -0
  22. package/dist/loadSso-Dn78jIWR.cjs +639 -0
  23. package/dist/package-BC7A0_n0.cjs +158 -0
  24. package/dist/parseKnownFiles-DLeTaAhg.cjs +21 -0
  25. package/dist/readFile-B3ey_wDD.cjs +46 -0
  26. package/dist/sdk-stream-mixin-YBLWtp6l.cjs +146 -0
  27. package/dist/serde-DtADB-gG.cjs +597 -0
  28. package/dist/setCredentialFeature-qcUbSyqa.cjs +13 -0
  29. package/dist/signin-DHnd2WFx.cjs +715 -0
  30. package/dist/sso-oidc-B4fkm2gn.cjs +901 -0
  31. package/dist/stream-collector-jwXXBEUn.cjs +584 -0
  32. package/dist/sts-C9aqjeec.cjs +1531 -0
  33. package/package.json +2 -4
@@ -0,0 +1,338 @@
1
+ //#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/is-array-buffer/is-array-buffer.js
2
+ var isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]";
3
+ //#endregion
4
+ //#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-buffer-from/buffer-from.js
5
+ var fromArrayBuffer = (input, offset = 0, length = input.byteLength - offset) => {
6
+ if (!isArrayBuffer(input)) throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof input} (${input})`);
7
+ return Buffer.from(input, offset, length);
8
+ };
9
+ var fromString = (input, encoding) => {
10
+ if (typeof input !== "string") throw new TypeError(`The "input" argument must be of type string. Received type ${typeof input} (${input})`);
11
+ return encoding ? Buffer.from(input, encoding) : Buffer.from(input);
12
+ };
13
+ //#endregion
14
+ //#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/fromUtf8.js
15
+ var fromUtf8 = (input) => {
16
+ const buf = fromString(input, "utf8");
17
+ return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength / Uint8Array.BYTES_PER_ELEMENT);
18
+ };
19
+ //#endregion
20
+ //#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/util-utf8/toUtf8.js
21
+ var toUtf8 = (input) => {
22
+ if (typeof input === "string") return input;
23
+ if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
24
+ return fromArrayBuffer(input.buffer, input.byteOffset, input.byteLength).toString("utf8");
25
+ };
26
+ //#endregion
27
+ //#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js
28
+ var expectNumber = (value) => {
29
+ if (value === null || value === void 0) return;
30
+ if (typeof value === "string") {
31
+ const parsed = parseFloat(value);
32
+ if (!Number.isNaN(parsed)) {
33
+ if (String(parsed) !== String(value)) logger.warn(stackTraceWarning(`Expected number but observed string: ${value}`));
34
+ return parsed;
35
+ }
36
+ }
37
+ if (typeof value === "number") return value;
38
+ throw new TypeError(`Expected number, got ${typeof value}: ${value}`);
39
+ };
40
+ var MAX_FLOAT = Math.ceil(2 ** 127 * (2 - 2 ** -23));
41
+ var expectFloat32 = (value) => {
42
+ const expected = expectNumber(value);
43
+ if (expected !== void 0 && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) {
44
+ if (Math.abs(expected) > MAX_FLOAT) throw new TypeError(`Expected 32-bit float, got ${value}`);
45
+ }
46
+ return expected;
47
+ };
48
+ var expectLong = (value) => {
49
+ if (value === null || value === void 0) return;
50
+ if (Number.isInteger(value) && !Number.isNaN(value)) return value;
51
+ throw new TypeError(`Expected integer, got ${typeof value}: ${value}`);
52
+ };
53
+ var expectShort = (value) => expectSizedInt(value, 16);
54
+ var expectByte = (value) => expectSizedInt(value, 8);
55
+ var expectSizedInt = (value, size) => {
56
+ const expected = expectLong(value);
57
+ if (expected !== void 0 && castInt(expected, size) !== expected) throw new TypeError(`Expected ${size}-bit integer, got ${value}`);
58
+ return expected;
59
+ };
60
+ var castInt = (value, size) => {
61
+ switch (size) {
62
+ case 32: return Int32Array.of(value)[0];
63
+ case 16: return Int16Array.of(value)[0];
64
+ case 8: return Int8Array.of(value)[0];
65
+ }
66
+ };
67
+ var strictParseDouble = (value) => {
68
+ if (typeof value == "string") return expectNumber(parseNumber(value));
69
+ return expectNumber(value);
70
+ };
71
+ var strictParseFloat32 = (value) => {
72
+ if (typeof value == "string") return expectFloat32(parseNumber(value));
73
+ return expectFloat32(value);
74
+ };
75
+ var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;
76
+ var parseNumber = (value) => {
77
+ const matches = value.match(NUMBER_REGEX);
78
+ if (matches === null || matches[0].length !== value.length) throw new TypeError(`Expected real number, got implicit NaN`);
79
+ return parseFloat(value);
80
+ };
81
+ var strictParseShort = (value) => {
82
+ if (typeof value === "string") return expectShort(parseNumber(value));
83
+ return expectShort(value);
84
+ };
85
+ var strictParseByte = (value) => {
86
+ if (typeof value === "string") return expectByte(parseNumber(value));
87
+ return expectByte(value);
88
+ };
89
+ var stackTraceWarning = (message) => {
90
+ return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter((s) => !s.includes("stackTraceWarning")).join("\n");
91
+ };
92
+ var logger = { warn: console.warn };
93
+ //#endregion
94
+ //#region ../../../node_modules/@smithy/core/dist-es/submodules/serde/date-utils.js
95
+ var DAYS = [
96
+ "Sun",
97
+ "Mon",
98
+ "Tue",
99
+ "Wed",
100
+ "Thu",
101
+ "Fri",
102
+ "Sat"
103
+ ];
104
+ var MONTHS = [
105
+ "Jan",
106
+ "Feb",
107
+ "Mar",
108
+ "Apr",
109
+ "May",
110
+ "Jun",
111
+ "Jul",
112
+ "Aug",
113
+ "Sep",
114
+ "Oct",
115
+ "Nov",
116
+ "Dec"
117
+ ];
118
+ function dateToUtcString(date) {
119
+ const year = date.getUTCFullYear();
120
+ const month = date.getUTCMonth();
121
+ const dayOfWeek = date.getUTCDay();
122
+ const dayOfMonthInt = date.getUTCDate();
123
+ const hoursInt = date.getUTCHours();
124
+ const minutesInt = date.getUTCMinutes();
125
+ const secondsInt = date.getUTCSeconds();
126
+ const dayOfMonthString = dayOfMonthInt < 10 ? `0${dayOfMonthInt}` : `${dayOfMonthInt}`;
127
+ const hoursString = hoursInt < 10 ? `0${hoursInt}` : `${hoursInt}`;
128
+ const minutesString = minutesInt < 10 ? `0${minutesInt}` : `${minutesInt}`;
129
+ const secondsString = secondsInt < 10 ? `0${secondsInt}` : `${secondsInt}`;
130
+ return `${DAYS[dayOfWeek]}, ${dayOfMonthString} ${MONTHS[month]} ${year} ${hoursString}:${minutesString}:${secondsString} GMT`;
131
+ }
132
+ var RFC3339 = /* @__PURE__ */ new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);
133
+ var parseRfc3339DateTime = (value) => {
134
+ if (value === null || value === void 0) return;
135
+ if (typeof value !== "string") throw new TypeError("RFC-3339 date-times must be expressed as strings");
136
+ const match = RFC3339.exec(value);
137
+ if (!match) throw new TypeError("Invalid RFC-3339 date-time value");
138
+ const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds] = match;
139
+ return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseDateValue(monthStr, "month", 1, 12), parseDateValue(dayStr, "day", 1, 31), {
140
+ hours,
141
+ minutes,
142
+ seconds,
143
+ fractionalMilliseconds
144
+ });
145
+ };
146
+ var RFC3339_WITH_OFFSET = /* @__PURE__ */ new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/);
147
+ var parseRfc3339DateTimeWithOffset = (value) => {
148
+ if (value === null || value === void 0) return;
149
+ if (typeof value !== "string") throw new TypeError("RFC-3339 date-times must be expressed as strings");
150
+ const match = RFC3339_WITH_OFFSET.exec(value);
151
+ if (!match) throw new TypeError("Invalid RFC-3339 date-time value");
152
+ const [_, yearStr, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, offsetStr] = match;
153
+ const date = buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseDateValue(monthStr, "month", 1, 12), parseDateValue(dayStr, "day", 1, 31), {
154
+ hours,
155
+ minutes,
156
+ seconds,
157
+ fractionalMilliseconds
158
+ });
159
+ if (offsetStr.toUpperCase() != "Z") date.setTime(date.getTime() - parseOffsetToMilliseconds(offsetStr));
160
+ return date;
161
+ };
162
+ var IMF_FIXDATE = /* @__PURE__ */ new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
163
+ var RFC_850_DATE = /* @__PURE__ */ new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/);
164
+ var ASC_TIME = /* @__PURE__ */ new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/);
165
+ var parseRfc7231DateTime = (value) => {
166
+ if (value === null || value === void 0) return;
167
+ if (typeof value !== "string") throw new TypeError("RFC-7231 date-times must be expressed as strings");
168
+ let match = IMF_FIXDATE.exec(value);
169
+ if (match) {
170
+ const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
171
+ return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), {
172
+ hours,
173
+ minutes,
174
+ seconds,
175
+ fractionalMilliseconds
176
+ });
177
+ }
178
+ match = RFC_850_DATE.exec(value);
179
+ if (match) {
180
+ const [_, dayStr, monthStr, yearStr, hours, minutes, seconds, fractionalMilliseconds] = match;
181
+ return adjustRfc850Year(buildDate(parseTwoDigitYear(yearStr), parseMonthByShortName(monthStr), parseDateValue(dayStr, "day", 1, 31), {
182
+ hours,
183
+ minutes,
184
+ seconds,
185
+ fractionalMilliseconds
186
+ }));
187
+ }
188
+ match = ASC_TIME.exec(value);
189
+ if (match) {
190
+ const [_, monthStr, dayStr, hours, minutes, seconds, fractionalMilliseconds, yearStr] = match;
191
+ return buildDate(strictParseShort(stripLeadingZeroes(yearStr)), parseMonthByShortName(monthStr), parseDateValue(dayStr.trimLeft(), "day", 1, 31), {
192
+ hours,
193
+ minutes,
194
+ seconds,
195
+ fractionalMilliseconds
196
+ });
197
+ }
198
+ throw new TypeError("Invalid RFC-7231 date-time value");
199
+ };
200
+ var parseEpochTimestamp = (value) => {
201
+ if (value === null || value === void 0) return;
202
+ let valueAsDouble;
203
+ if (typeof value === "number") valueAsDouble = value;
204
+ else if (typeof value === "string") valueAsDouble = strictParseDouble(value);
205
+ else if (typeof value === "object" && value.tag === 1) valueAsDouble = value.value;
206
+ else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");
207
+ if (Number.isNaN(valueAsDouble) || valueAsDouble === Infinity || valueAsDouble === -Infinity) throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");
208
+ return new Date(Math.round(valueAsDouble * 1e3));
209
+ };
210
+ var buildDate = (year, month, day, time) => {
211
+ const adjustedMonth = month - 1;
212
+ validateDayOfMonth(year, adjustedMonth, day);
213
+ return new Date(Date.UTC(year, adjustedMonth, day, parseDateValue(time.hours, "hour", 0, 23), parseDateValue(time.minutes, "minute", 0, 59), parseDateValue(time.seconds, "seconds", 0, 60), parseMilliseconds(time.fractionalMilliseconds)));
214
+ };
215
+ var parseTwoDigitYear = (value) => {
216
+ const thisYear = (/* @__PURE__ */ new Date()).getUTCFullYear();
217
+ const valueInThisCentury = Math.floor(thisYear / 100) * 100 + strictParseShort(stripLeadingZeroes(value));
218
+ if (valueInThisCentury < thisYear) return valueInThisCentury + 100;
219
+ return valueInThisCentury;
220
+ };
221
+ var FIFTY_YEARS_IN_MILLIS = 50 * 365 * 24 * 60 * 60 * 1e3;
222
+ var adjustRfc850Year = (input) => {
223
+ if (input.getTime() - (/* @__PURE__ */ new Date()).getTime() > FIFTY_YEARS_IN_MILLIS) return new Date(Date.UTC(input.getUTCFullYear() - 100, input.getUTCMonth(), input.getUTCDate(), input.getUTCHours(), input.getUTCMinutes(), input.getUTCSeconds(), input.getUTCMilliseconds()));
224
+ return input;
225
+ };
226
+ var parseMonthByShortName = (value) => {
227
+ const monthIdx = MONTHS.indexOf(value);
228
+ if (monthIdx < 0) throw new TypeError(`Invalid month: ${value}`);
229
+ return monthIdx + 1;
230
+ };
231
+ var DAYS_IN_MONTH = [
232
+ 31,
233
+ 28,
234
+ 31,
235
+ 30,
236
+ 31,
237
+ 30,
238
+ 31,
239
+ 31,
240
+ 30,
241
+ 31,
242
+ 30,
243
+ 31
244
+ ];
245
+ var validateDayOfMonth = (year, month, day) => {
246
+ let maxDays = DAYS_IN_MONTH[month];
247
+ if (month === 1 && isLeapYear(year)) maxDays = 29;
248
+ if (day > maxDays) throw new TypeError(`Invalid day for ${MONTHS[month]} in ${year}: ${day}`);
249
+ };
250
+ var isLeapYear = (year) => {
251
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
252
+ };
253
+ var parseDateValue = (value, type, lower, upper) => {
254
+ const dateVal = strictParseByte(stripLeadingZeroes(value));
255
+ if (dateVal < lower || dateVal > upper) throw new TypeError(`${type} must be between ${lower} and ${upper}, inclusive`);
256
+ return dateVal;
257
+ };
258
+ var parseMilliseconds = (value) => {
259
+ if (value === null || value === void 0) return 0;
260
+ return strictParseFloat32("0." + value) * 1e3;
261
+ };
262
+ var parseOffsetToMilliseconds = (value) => {
263
+ const directionStr = value[0];
264
+ let direction = 1;
265
+ if (directionStr == "+") direction = 1;
266
+ else if (directionStr == "-") direction = -1;
267
+ else throw new TypeError(`Offset direction, ${directionStr}, must be "+" or "-"`);
268
+ const hour = Number(value.substring(1, 3));
269
+ const minute = Number(value.substring(4, 6));
270
+ return direction * (hour * 60 + minute) * 60 * 1e3;
271
+ };
272
+ var stripLeadingZeroes = (value) => {
273
+ let idx = 0;
274
+ while (idx < value.length - 1 && value.charAt(idx) === "0") idx++;
275
+ if (idx === 0) return value;
276
+ return value.slice(idx);
277
+ };
278
+ //#endregion
279
+ Object.defineProperty(exports, "dateToUtcString", {
280
+ enumerable: true,
281
+ get: function() {
282
+ return dateToUtcString;
283
+ }
284
+ });
285
+ Object.defineProperty(exports, "fromArrayBuffer", {
286
+ enumerable: true,
287
+ get: function() {
288
+ return fromArrayBuffer;
289
+ }
290
+ });
291
+ Object.defineProperty(exports, "fromString", {
292
+ enumerable: true,
293
+ get: function() {
294
+ return fromString;
295
+ }
296
+ });
297
+ Object.defineProperty(exports, "fromUtf8", {
298
+ enumerable: true,
299
+ get: function() {
300
+ return fromUtf8;
301
+ }
302
+ });
303
+ Object.defineProperty(exports, "isArrayBuffer", {
304
+ enumerable: true,
305
+ get: function() {
306
+ return isArrayBuffer;
307
+ }
308
+ });
309
+ Object.defineProperty(exports, "parseEpochTimestamp", {
310
+ enumerable: true,
311
+ get: function() {
312
+ return parseEpochTimestamp;
313
+ }
314
+ });
315
+ Object.defineProperty(exports, "parseRfc3339DateTime", {
316
+ enumerable: true,
317
+ get: function() {
318
+ return parseRfc3339DateTime;
319
+ }
320
+ });
321
+ Object.defineProperty(exports, "parseRfc3339DateTimeWithOffset", {
322
+ enumerable: true,
323
+ get: function() {
324
+ return parseRfc3339DateTimeWithOffset;
325
+ }
326
+ });
327
+ Object.defineProperty(exports, "parseRfc7231DateTime", {
328
+ enumerable: true,
329
+ get: function() {
330
+ return parseRfc7231DateTime;
331
+ }
332
+ });
333
+ Object.defineProperty(exports, "toUtf8", {
334
+ enumerable: true,
335
+ get: function() {
336
+ return toUtf8;
337
+ }
338
+ });
@@ -0,0 +1,274 @@
1
+ const require_loadSharedConfigFiles = require("./loadSharedConfigFiles-CqEQHuLW.cjs");
2
+ const require_setCredentialFeature = require("./setCredentialFeature-qcUbSyqa.cjs");
3
+ const require_CredentialsProviderError = require("./CredentialsProviderError-DQ_v7TCm.cjs");
4
+ const require_readFile = require("./readFile-B3ey_wDD.cjs");
5
+ const require_getSSOTokenFromFile = require("./getSSOTokenFromFile-D0KPH2qZ.cjs");
6
+ const require_parseKnownFiles = require("./parseKnownFiles-DLeTaAhg.cjs");
7
+ let node_fs = require("node:fs");
8
+ //#region ../../../node_modules/@smithy/property-provider/dist-es/TokenProviderError.js
9
+ var TokenProviderError = class TokenProviderError extends require_CredentialsProviderError.ProviderError {
10
+ name = "TokenProviderError";
11
+ constructor(message, options = true) {
12
+ super(message, options);
13
+ Object.setPrototypeOf(this, TokenProviderError.prototype);
14
+ }
15
+ };
16
+ //#endregion
17
+ //#region ../../../node_modules/@smithy/shared-ini-file-loader/dist-es/getSsoSessionData.js
18
+ var getSsoSessionData = (data) => Object.entries(data).filter(([key]) => key.startsWith(require_loadSharedConfigFiles.IniSectionType.SSO_SESSION + ".")).reduce((acc, [key, value]) => ({
19
+ ...acc,
20
+ [key.substring(key.indexOf(".") + 1)]: value
21
+ }), {});
22
+ //#endregion
23
+ //#region ../../../node_modules/@smithy/shared-ini-file-loader/dist-es/loadSsoSessionData.js
24
+ var swallowError = () => ({});
25
+ var loadSsoSessionData = async (init = {}) => require_readFile.readFile(init.configFilepath ?? require_loadSharedConfigFiles.getConfigFilepath()).then(require_loadSharedConfigFiles.parseIni).then(getSsoSessionData).catch(swallowError);
26
+ //#endregion
27
+ //#region ../../../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
+ var REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
30
+ //#endregion
31
+ //#region ../../../node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js
32
+ var getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
33
+ const { SSOOIDCClient } = await Promise.resolve().then(() => require("./sso-oidc-B4fkm2gn.cjs"));
34
+ const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
35
+ return new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {
36
+ region: ssoRegion ?? init.clientConfig?.region,
37
+ logger: coalesce("logger"),
38
+ userAgentAppId: coalesce("userAgentAppId")
39
+ }));
40
+ };
41
+ //#endregion
42
+ //#region ../../../node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js
43
+ var getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
44
+ const { CreateTokenCommand } = await Promise.resolve().then(() => require("./sso-oidc-B4fkm2gn.cjs"));
45
+ return (await getSsoOidcClient(ssoRegion, init, callerClientConfig)).send(new CreateTokenCommand({
46
+ clientId: ssoToken.clientId,
47
+ clientSecret: ssoToken.clientSecret,
48
+ refreshToken: ssoToken.refreshToken,
49
+ grantType: "refresh_token"
50
+ }));
51
+ };
52
+ //#endregion
53
+ //#region ../../../node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js
54
+ var validateTokenExpiry = (token) => {
55
+ if (token.expiration && token.expiration.getTime() < Date.now()) throw new TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
56
+ };
57
+ //#endregion
58
+ //#region ../../../node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js
59
+ var validateTokenKey = (key, value, forRefresh = false) => {
60
+ if (typeof value === "undefined") throw new TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
61
+ };
62
+ //#endregion
63
+ //#region ../../../node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js
64
+ var { writeFile } = node_fs.promises;
65
+ var writeSSOTokenToFile = (id, ssoToken) => {
66
+ return writeFile(require_getSSOTokenFromFile.getSSOTokenFilepath(id), JSON.stringify(ssoToken, null, 2));
67
+ };
68
+ //#endregion
69
+ //#region ../../../node_modules/@aws-sdk/token-providers/dist-es/fromSso.js
70
+ var lastRefreshAttemptTime = /* @__PURE__ */ new Date(0);
71
+ var fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
72
+ init.logger?.debug("@aws-sdk/token-providers - fromSso");
73
+ const profiles = await require_parseKnownFiles.parseKnownFiles(init);
74
+ const profileName = require_loadSharedConfigFiles.getProfileName({ profile: init.profile ?? callerClientConfig?.profile });
75
+ const profile = profiles[profileName];
76
+ if (!profile) throw new TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
77
+ else if (!profile["sso_session"]) throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
78
+ const ssoSessionName = profile["sso_session"];
79
+ const ssoSession = (await loadSsoSessionData(init))[ssoSessionName];
80
+ if (!ssoSession) throw new TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
81
+ for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) if (!ssoSession[ssoSessionRequiredKey]) throw new TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
82
+ ssoSession["sso_start_url"];
83
+ const ssoRegion = ssoSession["sso_region"];
84
+ let ssoToken;
85
+ try {
86
+ ssoToken = await require_getSSOTokenFromFile.getSSOTokenFromFile(ssoSessionName);
87
+ } catch (e) {
88
+ throw new TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
89
+ }
90
+ validateTokenKey("accessToken", ssoToken.accessToken);
91
+ validateTokenKey("expiresAt", ssoToken.expiresAt);
92
+ const { accessToken, expiresAt } = ssoToken;
93
+ const existingToken = {
94
+ token: accessToken,
95
+ expiration: new Date(expiresAt)
96
+ };
97
+ if (existingToken.expiration.getTime() - Date.now() > 3e5) return existingToken;
98
+ if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) {
99
+ validateTokenExpiry(existingToken);
100
+ return existingToken;
101
+ }
102
+ validateTokenKey("clientId", ssoToken.clientId, true);
103
+ validateTokenKey("clientSecret", ssoToken.clientSecret, true);
104
+ validateTokenKey("refreshToken", ssoToken.refreshToken, true);
105
+ try {
106
+ lastRefreshAttemptTime.setTime(Date.now());
107
+ const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
108
+ validateTokenKey("accessToken", newSsoOidcToken.accessToken);
109
+ validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
110
+ const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3);
111
+ try {
112
+ await writeSSOTokenToFile(ssoSessionName, {
113
+ ...ssoToken,
114
+ accessToken: newSsoOidcToken.accessToken,
115
+ expiresAt: newTokenExpiration.toISOString(),
116
+ refreshToken: newSsoOidcToken.refreshToken
117
+ });
118
+ } catch (error) {}
119
+ return {
120
+ token: newSsoOidcToken.accessToken,
121
+ expiration: newTokenExpiration
122
+ };
123
+ } catch (error) {
124
+ validateTokenExpiry(existingToken);
125
+ return existingToken;
126
+ }
127
+ };
128
+ //#endregion
129
+ //#region ../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/resolveSSOCredentials.js
130
+ var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
131
+ var resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
132
+ let token;
133
+ const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
134
+ if (ssoSession) try {
135
+ const _token = await fromSso({
136
+ profile,
137
+ filepath,
138
+ configFilepath,
139
+ ignoreCache
140
+ })();
141
+ token = {
142
+ accessToken: _token.token,
143
+ expiresAt: new Date(_token.expiration).toISOString()
144
+ };
145
+ } catch (e) {
146
+ throw new require_CredentialsProviderError.CredentialsProviderError(e.message, {
147
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
148
+ logger
149
+ });
150
+ }
151
+ else try {
152
+ token = await require_getSSOTokenFromFile.getSSOTokenFromFile(ssoStartUrl);
153
+ } catch (e) {
154
+ throw new require_CredentialsProviderError.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
155
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
156
+ logger
157
+ });
158
+ }
159
+ if (new Date(token.expiresAt).getTime() - Date.now() <= 0) throw new require_CredentialsProviderError.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
160
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
161
+ logger
162
+ });
163
+ const { accessToken } = token;
164
+ const { SSOClient, GetRoleCredentialsCommand } = await Promise.resolve().then(() => require("./loadSso-Dn78jIWR.cjs"));
165
+ const sso = ssoClient || new SSOClient(Object.assign({}, clientConfig ?? {}, {
166
+ logger: clientConfig?.logger ?? callerClientConfig?.logger ?? parentClientConfig?.logger,
167
+ region: clientConfig?.region ?? ssoRegion,
168
+ userAgentAppId: clientConfig?.userAgentAppId ?? callerClientConfig?.userAgentAppId ?? parentClientConfig?.userAgentAppId
169
+ }));
170
+ let ssoResp;
171
+ try {
172
+ ssoResp = await sso.send(new GetRoleCredentialsCommand({
173
+ accountId: ssoAccountId,
174
+ roleName: ssoRoleName,
175
+ accessToken
176
+ }));
177
+ } catch (e) {
178
+ throw new require_CredentialsProviderError.CredentialsProviderError(e, {
179
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
180
+ logger
181
+ });
182
+ }
183
+ const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} } = ssoResp;
184
+ if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) throw new require_CredentialsProviderError.CredentialsProviderError("SSO returns an invalid temporary credential.", {
185
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
186
+ logger
187
+ });
188
+ const credentials = {
189
+ accessKeyId,
190
+ secretAccessKey,
191
+ sessionToken,
192
+ expiration: new Date(expiration),
193
+ ...credentialScope && { credentialScope },
194
+ ...accountId && { accountId }
195
+ };
196
+ if (ssoSession) require_setCredentialFeature.setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
197
+ else require_setCredentialFeature.setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
198
+ return credentials;
199
+ };
200
+ //#endregion
201
+ //#region ../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/validateSsoProfile.js
202
+ var validateSsoProfile = (profile, logger) => {
203
+ const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
204
+ if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) throw new require_CredentialsProviderError.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`, {
205
+ tryNextLink: false,
206
+ logger
207
+ });
208
+ return profile;
209
+ };
210
+ //#endregion
211
+ //#region ../../../node_modules/@aws-sdk/credential-provider-sso/dist-es/fromSSO.js
212
+ var fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {
213
+ init.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");
214
+ const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
215
+ const { ssoClient } = init;
216
+ const profileName = require_loadSharedConfigFiles.getProfileName({ profile: init.profile ?? callerClientConfig?.profile });
217
+ if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
218
+ const profile = (await require_parseKnownFiles.parseKnownFiles(init))[profileName];
219
+ if (!profile) throw new require_CredentialsProviderError.CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });
220
+ if (!isSsoProfile(profile)) throw new require_CredentialsProviderError.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, { logger: init.logger });
221
+ if (profile?.sso_session) {
222
+ const session = (await loadSsoSessionData(init))[profile.sso_session];
223
+ const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
224
+ if (ssoRegion && ssoRegion !== session.sso_region) throw new require_CredentialsProviderError.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {
225
+ tryNextLink: false,
226
+ logger: init.logger
227
+ });
228
+ if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) throw new require_CredentialsProviderError.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
229
+ tryNextLink: false,
230
+ logger: init.logger
231
+ });
232
+ profile.sso_region = session.sso_region;
233
+ profile.sso_start_url = session.sso_start_url;
234
+ }
235
+ const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile(profile, init.logger);
236
+ return resolveSSOCredentials({
237
+ ssoStartUrl: sso_start_url,
238
+ ssoSession: sso_session,
239
+ ssoAccountId: sso_account_id,
240
+ ssoRegion: sso_region,
241
+ ssoRoleName: sso_role_name,
242
+ ssoClient,
243
+ clientConfig: init.clientConfig,
244
+ parentClientConfig: init.parentClientConfig,
245
+ callerClientConfig: init.callerClientConfig,
246
+ profile: profileName,
247
+ filepath: init.filepath,
248
+ configFilepath: init.configFilepath,
249
+ ignoreCache: init.ignoreCache,
250
+ logger: init.logger
251
+ });
252
+ } else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) throw new require_CredentialsProviderError.CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include \"ssoStartUrl\", \"ssoAccountId\", \"ssoRegion\", \"ssoRoleName\"", {
253
+ tryNextLink: false,
254
+ logger: init.logger
255
+ });
256
+ else return resolveSSOCredentials({
257
+ ssoStartUrl,
258
+ ssoSession,
259
+ ssoAccountId,
260
+ ssoRegion,
261
+ ssoRoleName,
262
+ ssoClient,
263
+ clientConfig: init.clientConfig,
264
+ parentClientConfig: init.parentClientConfig,
265
+ callerClientConfig: init.callerClientConfig,
266
+ profile: profileName,
267
+ filepath: init.filepath,
268
+ configFilepath: init.configFilepath,
269
+ ignoreCache: init.ignoreCache,
270
+ logger: init.logger
271
+ });
272
+ };
273
+ //#endregion
274
+ exports.fromSSO = fromSSO;
@@ -0,0 +1,52 @@
1
+ const require_setCredentialFeature = require("./setCredentialFeature-qcUbSyqa.cjs");
2
+ const require_CredentialsProviderError = require("./CredentialsProviderError-DQ_v7TCm.cjs");
3
+ const require_externalDataInterceptor = require("./externalDataInterceptor-D7DaIG7M.cjs");
4
+ let node_fs = require("node:fs");
5
+ //#region ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromWebToken.js
6
+ var fromWebToken = (init) => async (awsIdentityProperties) => {
7
+ init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromWebToken");
8
+ const { roleArn, roleSessionName, webIdentityToken, providerId, policyArns, policy, durationSeconds } = init;
9
+ let { roleAssumerWithWebIdentity } = init;
10
+ if (!roleAssumerWithWebIdentity) {
11
+ const { getDefaultRoleAssumerWithWebIdentity } = await Promise.resolve().then(() => require("./sts-C9aqjeec.cjs"));
12
+ roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({
13
+ ...init.clientConfig,
14
+ credentialProviderLogger: init.logger,
15
+ parentClientConfig: {
16
+ ...awsIdentityProperties?.callerClientConfig,
17
+ ...init.parentClientConfig
18
+ }
19
+ }, init.clientPlugins);
20
+ }
21
+ return roleAssumerWithWebIdentity({
22
+ RoleArn: roleArn,
23
+ RoleSessionName: roleSessionName ?? `aws-sdk-js-session-${Date.now()}`,
24
+ WebIdentityToken: webIdentityToken,
25
+ ProviderId: providerId,
26
+ PolicyArns: policyArns,
27
+ Policy: policy,
28
+ DurationSeconds: durationSeconds
29
+ });
30
+ };
31
+ //#endregion
32
+ //#region ../../../node_modules/@aws-sdk/credential-provider-web-identity/dist-es/fromTokenFile.js
33
+ var ENV_TOKEN_FILE = "AWS_WEB_IDENTITY_TOKEN_FILE";
34
+ var ENV_ROLE_ARN = "AWS_ROLE_ARN";
35
+ var ENV_ROLE_SESSION_NAME = "AWS_ROLE_SESSION_NAME";
36
+ var fromTokenFile = (init = {}) => async (awsIdentityProperties) => {
37
+ init.logger?.debug("@aws-sdk/credential-provider-web-identity - fromTokenFile");
38
+ const webIdentityTokenFile = init?.webIdentityTokenFile ?? process.env[ENV_TOKEN_FILE];
39
+ const roleArn = init?.roleArn ?? process.env[ENV_ROLE_ARN];
40
+ const roleSessionName = init?.roleSessionName ?? process.env[ENV_ROLE_SESSION_NAME];
41
+ if (!webIdentityTokenFile || !roleArn) throw new require_CredentialsProviderError.CredentialsProviderError("Web identity configuration not specified", { logger: init.logger });
42
+ const credentials = await fromWebToken({
43
+ ...init,
44
+ webIdentityToken: require_externalDataInterceptor.externalDataInterceptor?.getTokenRecord?.()[webIdentityTokenFile] ?? (0, node_fs.readFileSync)(webIdentityTokenFile, { encoding: "ascii" }),
45
+ roleArn,
46
+ roleSessionName
47
+ })(awsIdentityProperties);
48
+ if (webIdentityTokenFile === process.env[ENV_TOKEN_FILE]) require_setCredentialFeature.setCredentialFeature(credentials, "CREDENTIALS_ENV_VARS_STS_WEB_ID_TOKEN", "h");
49
+ return credentials;
50
+ };
51
+ //#endregion
52
+ exports.fromTokenFile = fromTokenFile;