@awsless/cli 0.0.46-next.27 → 0.0.46-next.29
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.
- package/dist/bin.js +354 -182
- package/package.json +14 -14
package/dist/bin.js
CHANGED
|
@@ -92768,6 +92768,9 @@ var fetchCredentials = async (profile) => {
|
|
|
92768
92768
|
name: profile
|
|
92769
92769
|
});
|
|
92770
92770
|
if (!credentialsString) {
|
|
92771
|
+
if (process.env.SKIP_PROMPT) {
|
|
92772
|
+
throw new ExpectedError(`No AWS credentials are configured for the ${profile} profile. ` + `Run any awsless command without --skip-prompt to store them.`);
|
|
92773
|
+
}
|
|
92771
92774
|
logs_exports.warning(`You haven't configured AWS credentials for the ${color2.info(profile)} profile.`);
|
|
92772
92775
|
const accessKeyId = await prompts_exports.password({
|
|
92773
92776
|
message: "Enter your AWS access key ID",
|
|
@@ -160729,13 +160732,13 @@ var createWorkSpace = async (props) => {
|
|
|
160729
160732
|
accessKey: cred.accessKeyId,
|
|
160730
160733
|
secretKey: cred.secretAccessKey,
|
|
160731
160734
|
region: props.region,
|
|
160732
|
-
maxRetries:
|
|
160735
|
+
maxRetries: 25
|
|
160733
160736
|
}),
|
|
160734
160737
|
aws3({
|
|
160735
160738
|
accessKey: cred.accessKeyId,
|
|
160736
160739
|
secretKey: cred.secretAccessKey,
|
|
160737
160740
|
region: "us-east-1",
|
|
160738
|
-
maxRetries:
|
|
160741
|
+
maxRetries: 25
|
|
160739
160742
|
}, {
|
|
160740
160743
|
id: "global-aws"
|
|
160741
160744
|
})
|
|
@@ -179384,7 +179387,7 @@ var build2 = (program3) => {
|
|
|
179384
179387
|
|
|
179385
179388
|
// src/cli/command/config/set.ts
|
|
179386
179389
|
var set = (program3) => {
|
|
179387
|
-
program3.command("set <name>").description("Set a config value").action(async (name) => {
|
|
179390
|
+
program3.command("set <name>").description("Set a config value").option("--value <value>", "The config value, skips the interactive prompt").option("--no-restart", `Don't restart active functions that use this config`).action(async (name, options) => {
|
|
179388
179391
|
await layout("config set", async ({ appConfig, stackConfigs }) => {
|
|
179389
179392
|
const region = appConfig.region;
|
|
179390
179393
|
const profile4 = appConfig.profile;
|
|
@@ -179400,17 +179403,26 @@ var set = (program3) => {
|
|
|
179400
179403
|
credentials: credentials4,
|
|
179401
179404
|
appConfig
|
|
179402
179405
|
});
|
|
179403
|
-
|
|
179404
|
-
|
|
179405
|
-
|
|
179406
|
-
|
|
179407
|
-
|
|
179408
|
-
|
|
179409
|
-
|
|
179406
|
+
let value = options.value;
|
|
179407
|
+
if (typeof value === "undefined") {
|
|
179408
|
+
if (process.env.SKIP_PROMPT) {
|
|
179409
|
+
throw new ExpectedError("Pass --value <value> when running with --skip-prompt.");
|
|
179410
|
+
}
|
|
179411
|
+
const initialValue = await params.get(name);
|
|
179412
|
+
value = await prompts_exports.text({
|
|
179413
|
+
message: "Enter the config value:",
|
|
179414
|
+
initialValue,
|
|
179415
|
+
validate(value2) {
|
|
179416
|
+
if (value2 === "") {
|
|
179417
|
+
return `Value can't be empty`;
|
|
179418
|
+
}
|
|
179419
|
+
return;
|
|
179410
179420
|
}
|
|
179411
|
-
|
|
179412
|
-
|
|
179413
|
-
|
|
179421
|
+
});
|
|
179422
|
+
}
|
|
179423
|
+
if (value === "") {
|
|
179424
|
+
throw new ExpectedError(`Value can't be empty`);
|
|
179425
|
+
}
|
|
179414
179426
|
await logs_exports.task({
|
|
179415
179427
|
initialMessage: "Saving remote config parameter...",
|
|
179416
179428
|
successMessage: "Done saving remote config parameter.",
|
|
@@ -179419,10 +179431,13 @@ var set = (program3) => {
|
|
|
179419
179431
|
await params.set(name, value);
|
|
179420
179432
|
}
|
|
179421
179433
|
});
|
|
179422
|
-
|
|
179423
|
-
|
|
179424
|
-
|
|
179425
|
-
|
|
179434
|
+
let restart = options.restart;
|
|
179435
|
+
if (restart && !process.env.SKIP_PROMPT) {
|
|
179436
|
+
restart = await prompts_exports.confirm({
|
|
179437
|
+
message: "Want to restart active functions that are using this config?",
|
|
179438
|
+
initialValue: true
|
|
179439
|
+
});
|
|
179440
|
+
}
|
|
179426
179441
|
if (restart) {
|
|
179427
179442
|
await logs_exports.task({
|
|
179428
179443
|
initialMessage: "Restarting functions...",
|
|
@@ -179487,12 +179502,14 @@ var del = (program3) => {
|
|
|
179487
179502
|
credentials: credentials4,
|
|
179488
179503
|
appConfig
|
|
179489
179504
|
});
|
|
179490
|
-
|
|
179491
|
-
|
|
179492
|
-
|
|
179493
|
-
|
|
179494
|
-
|
|
179495
|
-
|
|
179505
|
+
if (!process.env.SKIP_PROMPT) {
|
|
179506
|
+
const ok = await prompts_exports.confirm({
|
|
179507
|
+
message: `Your deleting the ${color2.info(name)} config parameter. Are you sure?`,
|
|
179508
|
+
initialValue: false
|
|
179509
|
+
});
|
|
179510
|
+
if (!ok) {
|
|
179511
|
+
throw new Cancelled2;
|
|
179512
|
+
}
|
|
179496
179513
|
}
|
|
179497
179514
|
await logs_exports.task({
|
|
179498
179515
|
initialMessage: "Deleting remote config parameter...",
|
|
@@ -179580,35 +179597,48 @@ var export_ = (program3) => {
|
|
|
179580
179597
|
// src/cli/command/config/import.ts
|
|
179581
179598
|
var {sleep: sleep3 } = globalThis.Bun;
|
|
179582
179599
|
var import_ = (program3) => {
|
|
179583
|
-
program3.command("import").description("Import config values").action(async () => {
|
|
179600
|
+
program3.command("import").description("Import config values").option("--json <json>", "The config values as a JSON string, skips the interactive prompt").action(async (options) => {
|
|
179584
179601
|
await layout("import", async ({ appConfig }) => {
|
|
179585
179602
|
const credentials4 = await getCredentials2(appConfig.profile);
|
|
179586
179603
|
const params = new SsmStore({
|
|
179587
179604
|
credentials: credentials4,
|
|
179588
179605
|
appConfig
|
|
179589
179606
|
});
|
|
179590
|
-
|
|
179591
|
-
|
|
179592
|
-
|
|
179593
|
-
|
|
179594
|
-
JSON.parse(value);
|
|
179595
|
-
} catch {
|
|
179596
|
-
return "Invalid JSON";
|
|
179597
|
-
}
|
|
179598
|
-
return;
|
|
179607
|
+
let json = options.json;
|
|
179608
|
+
if (typeof json === "undefined") {
|
|
179609
|
+
if (process.env.SKIP_PROMPT) {
|
|
179610
|
+
throw new ExpectedError("Pass --json <json> when running with --skip-prompt.");
|
|
179599
179611
|
}
|
|
179600
|
-
|
|
179601
|
-
|
|
179612
|
+
json = await prompts_exports.text({
|
|
179613
|
+
message: "The config values in JSON format",
|
|
179614
|
+
validate: (value) => {
|
|
179615
|
+
try {
|
|
179616
|
+
JSON.parse(value);
|
|
179617
|
+
} catch {
|
|
179618
|
+
return "Invalid JSON";
|
|
179619
|
+
}
|
|
179620
|
+
return;
|
|
179621
|
+
}
|
|
179622
|
+
});
|
|
179623
|
+
}
|
|
179624
|
+
let values;
|
|
179625
|
+
try {
|
|
179626
|
+
values = JSON.parse(json);
|
|
179627
|
+
} catch {
|
|
179628
|
+
throw new ExpectedError("Invalid JSON");
|
|
179629
|
+
}
|
|
179602
179630
|
logs_exports.table({
|
|
179603
179631
|
head: ["Name", "Value"],
|
|
179604
179632
|
body: Object.entries(values)
|
|
179605
179633
|
});
|
|
179606
|
-
|
|
179607
|
-
|
|
179608
|
-
|
|
179609
|
-
|
|
179610
|
-
|
|
179611
|
-
|
|
179634
|
+
if (!process.env.SKIP_PROMPT) {
|
|
179635
|
+
const confirm2 = await prompts_exports.confirm({
|
|
179636
|
+
message: "Are you sure you want to import the config values?",
|
|
179637
|
+
initialValue: false
|
|
179638
|
+
});
|
|
179639
|
+
if (!confirm2) {
|
|
179640
|
+
throw new Cancelled;
|
|
179641
|
+
}
|
|
179612
179642
|
}
|
|
179613
179643
|
await logs_exports.task({
|
|
179614
179644
|
initialMessage: "Importing config parameters...",
|
|
@@ -179977,7 +180007,7 @@ var showWarnings = async (warnings) => {
|
|
|
179977
180007
|
].join(`
|
|
179978
180008
|
`));
|
|
179979
180009
|
}
|
|
179980
|
-
if (warnings.length > 0) {
|
|
180010
|
+
if (warnings.length > 0 && !process.env.SKIP_PROMPT) {
|
|
179981
180011
|
const result = await prompts_exports.confirm({
|
|
179982
180012
|
initialValue: false,
|
|
179983
180013
|
message: `Some issues remain unresolved. If you continue, your app may not function correctly. Do you still want to proceed?`
|
|
@@ -183313,23 +183343,36 @@ class AdminSetUserPasswordCommand extends Command2.classBuilder().ep(commonParam
|
|
|
183313
183343
|
|
|
183314
183344
|
// src/cli/command/auth/user/create.ts
|
|
183315
183345
|
var create = (program3) => {
|
|
183316
|
-
program3.command("create").description("Create an user in your userpool").action(async () => {
|
|
183346
|
+
program3.command("create").description("Create an user in your userpool").option("--pool <name>", "The auth userpool name").option("--username <username>", "The username for the new user").option("--password <password>", "The password for the new user").option("--groups <groups...>", "The groups to add the new user to").action(async (options) => {
|
|
183317
183347
|
await layout("auth user create", async ({ appConfig, stackConfigs }) => {
|
|
183318
183348
|
const region = appConfig.region;
|
|
183319
183349
|
const profile4 = appConfig.profile;
|
|
183320
183350
|
const credentials4 = await getCredentials2(profile4);
|
|
183321
183351
|
const accountId = await getAccountId(credentials4, region);
|
|
183322
|
-
|
|
183352
|
+
const pools = Object.keys(appConfig.defaults.auth ?? {});
|
|
183353
|
+
if (pools.length === 0) {
|
|
183323
183354
|
throw new ExpectedError("No auth resources are defined.");
|
|
183324
183355
|
}
|
|
183325
|
-
|
|
183326
|
-
|
|
183327
|
-
|
|
183328
|
-
|
|
183329
|
-
|
|
183330
|
-
|
|
183331
|
-
|
|
183332
|
-
|
|
183356
|
+
let name = options.pool;
|
|
183357
|
+
if (name && !pools.includes(name)) {
|
|
183358
|
+
throw new ExpectedError(`The auth userpool "${name}" doesn't exist.`);
|
|
183359
|
+
}
|
|
183360
|
+
if (!name) {
|
|
183361
|
+
if (pools.length === 1) {
|
|
183362
|
+
name = pools[0];
|
|
183363
|
+
} else if (process.env.SKIP_PROMPT) {
|
|
183364
|
+
throw new ExpectedError(`Pass --pool <name> when running with --skip-prompt: [ ${pools.join(", ")} ]`);
|
|
183365
|
+
} else {
|
|
183366
|
+
name = await prompts_exports.select({
|
|
183367
|
+
message: "Select the auth userpool:",
|
|
183368
|
+
initialValue: pools.at(0),
|
|
183369
|
+
options: pools.map((name2) => ({
|
|
183370
|
+
label: name2,
|
|
183371
|
+
value: name2
|
|
183372
|
+
}))
|
|
183373
|
+
});
|
|
183374
|
+
}
|
|
183375
|
+
}
|
|
183333
183376
|
const props = appConfig.defaults.auth[name];
|
|
183334
183377
|
const userPoolId = await logs_exports.task({
|
|
183335
183378
|
initialMessage: "Loading auth userpool...",
|
|
@@ -183350,41 +183393,64 @@ var create = (program3) => {
|
|
|
183350
183393
|
}
|
|
183351
183394
|
}
|
|
183352
183395
|
});
|
|
183353
|
-
const
|
|
183354
|
-
|
|
183355
|
-
|
|
183356
|
-
if (!value) {
|
|
183357
|
-
return "Required";
|
|
183358
|
-
}
|
|
183359
|
-
return;
|
|
183396
|
+
const validatePassword = (value) => {
|
|
183397
|
+
if (!value) {
|
|
183398
|
+
return "Required";
|
|
183360
183399
|
}
|
|
183361
|
-
|
|
183362
|
-
|
|
183363
|
-
|
|
183364
|
-
|
|
183365
|
-
|
|
183366
|
-
|
|
183367
|
-
|
|
183368
|
-
|
|
183369
|
-
|
|
183370
|
-
|
|
183371
|
-
|
|
183372
|
-
|
|
183373
|
-
|
|
183374
|
-
|
|
183375
|
-
|
|
183376
|
-
|
|
183377
|
-
|
|
183378
|
-
|
|
183379
|
-
|
|
183380
|
-
|
|
183381
|
-
|
|
183400
|
+
if (value.length < props.password.minLength) {
|
|
183401
|
+
return `Min length is ${props.password.minLength}`;
|
|
183402
|
+
}
|
|
183403
|
+
if (props.password.lowercase && value.toUpperCase() === value) {
|
|
183404
|
+
return `Should include lowercase characters`;
|
|
183405
|
+
}
|
|
183406
|
+
if (props.password.uppercase && value.toLowerCase() === value) {
|
|
183407
|
+
return `Should include uppercase characters`;
|
|
183408
|
+
}
|
|
183409
|
+
if (props.password.numbers && !/\d/.test(value)) {
|
|
183410
|
+
return `Should include numbers`;
|
|
183411
|
+
}
|
|
183412
|
+
if (props.password.symbols && !/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(value)) {
|
|
183413
|
+
return `Should include symbols`;
|
|
183414
|
+
}
|
|
183415
|
+
return;
|
|
183416
|
+
};
|
|
183417
|
+
let username = options.username;
|
|
183418
|
+
if (!username) {
|
|
183419
|
+
if (process.env.SKIP_PROMPT) {
|
|
183420
|
+
throw new ExpectedError("Pass --username <username> when running with --skip-prompt.");
|
|
183421
|
+
}
|
|
183422
|
+
username = await prompts_exports.text({
|
|
183423
|
+
message: "Username:",
|
|
183424
|
+
validate(value) {
|
|
183425
|
+
if (!value) {
|
|
183426
|
+
return "Required";
|
|
183427
|
+
}
|
|
183428
|
+
return;
|
|
183382
183429
|
}
|
|
183383
|
-
|
|
183430
|
+
});
|
|
183431
|
+
}
|
|
183432
|
+
let password2 = options.password;
|
|
183433
|
+
if (password2) {
|
|
183434
|
+
const issue = validatePassword(password2);
|
|
183435
|
+
if (issue) {
|
|
183436
|
+
throw new ExpectedError(`Invalid password: ${issue}`);
|
|
183384
183437
|
}
|
|
183385
|
-
}
|
|
183386
|
-
|
|
183387
|
-
|
|
183438
|
+
} else {
|
|
183439
|
+
if (process.env.SKIP_PROMPT) {
|
|
183440
|
+
throw new ExpectedError("Pass --password <password> when running with --skip-prompt.");
|
|
183441
|
+
}
|
|
183442
|
+
password2 = await prompts_exports.password({
|
|
183443
|
+
message: "Password:",
|
|
183444
|
+
validate: validatePassword
|
|
183445
|
+
});
|
|
183446
|
+
}
|
|
183447
|
+
let groups = options.groups ?? [];
|
|
183448
|
+
for (const group4 of groups) {
|
|
183449
|
+
if (!props.groups.includes(group4)) {
|
|
183450
|
+
throw new ExpectedError(`The group "${group4}" doesn't exist.`);
|
|
183451
|
+
}
|
|
183452
|
+
}
|
|
183453
|
+
if (!options.groups && !process.env.SKIP_PROMPT && props.groups.length > 0) {
|
|
183388
183454
|
groups = await prompts_exports.multiSelect({
|
|
183389
183455
|
message: "Groups:",
|
|
183390
183456
|
required: false,
|
|
@@ -183437,23 +183503,36 @@ var create = (program3) => {
|
|
|
183437
183503
|
|
|
183438
183504
|
// src/cli/command/auth/user/update.ts
|
|
183439
183505
|
var update = (program3) => {
|
|
183440
|
-
program3.command("update").description("Update an user in your userpool").action(async () => {
|
|
183506
|
+
program3.command("update").description("Update an user in your userpool").option("--pool <name>", "The auth userpool name").option("--username <username>", "The username of the user").option("--password <password>", "The new password for the user").option("--groups <groups...>", "The groups the user should be in, replacing the current groups").action(async (options) => {
|
|
183441
183507
|
await layout("auth user update", async ({ appConfig, stackConfigs }) => {
|
|
183442
183508
|
const region = appConfig.region;
|
|
183443
183509
|
const profile4 = appConfig.profile;
|
|
183444
183510
|
const credentials4 = await getCredentials2(profile4);
|
|
183445
183511
|
const accountId = await getAccountId(credentials4, region);
|
|
183446
|
-
|
|
183512
|
+
const pools = Object.keys(appConfig.defaults.auth ?? {});
|
|
183513
|
+
if (pools.length === 0) {
|
|
183447
183514
|
throw new ExpectedError("No auth resources are defined.");
|
|
183448
183515
|
}
|
|
183449
|
-
|
|
183450
|
-
|
|
183451
|
-
|
|
183452
|
-
|
|
183453
|
-
|
|
183454
|
-
|
|
183455
|
-
|
|
183456
|
-
|
|
183516
|
+
let name = options.pool;
|
|
183517
|
+
if (name && !pools.includes(name)) {
|
|
183518
|
+
throw new ExpectedError(`The auth userpool "${name}" doesn't exist.`);
|
|
183519
|
+
}
|
|
183520
|
+
if (!name) {
|
|
183521
|
+
if (pools.length === 1) {
|
|
183522
|
+
name = pools[0];
|
|
183523
|
+
} else if (process.env.SKIP_PROMPT) {
|
|
183524
|
+
throw new ExpectedError(`Pass --pool <name> when running with --skip-prompt: [ ${pools.join(", ")} ]`);
|
|
183525
|
+
} else {
|
|
183526
|
+
name = await prompts_exports.select({
|
|
183527
|
+
message: "Select the auth userpool:",
|
|
183528
|
+
initialValue: pools.at(0),
|
|
183529
|
+
options: pools.map((name2) => ({
|
|
183530
|
+
label: name2,
|
|
183531
|
+
value: name2
|
|
183532
|
+
}))
|
|
183533
|
+
});
|
|
183534
|
+
}
|
|
183535
|
+
}
|
|
183457
183536
|
const props = appConfig.defaults.auth[name];
|
|
183458
183537
|
const userPoolId = await logs_exports.task({
|
|
183459
183538
|
initialMessage: "Loading auth userpool...",
|
|
@@ -183474,15 +183553,21 @@ var update = (program3) => {
|
|
|
183474
183553
|
}
|
|
183475
183554
|
}
|
|
183476
183555
|
});
|
|
183477
|
-
|
|
183478
|
-
|
|
183479
|
-
|
|
183480
|
-
|
|
183481
|
-
return "Required";
|
|
183482
|
-
}
|
|
183483
|
-
return;
|
|
183556
|
+
let username = options.username;
|
|
183557
|
+
if (!username) {
|
|
183558
|
+
if (process.env.SKIP_PROMPT) {
|
|
183559
|
+
throw new ExpectedError("Pass --username <username> when running with --skip-prompt.");
|
|
183484
183560
|
}
|
|
183485
|
-
|
|
183561
|
+
username = await prompts_exports.text({
|
|
183562
|
+
message: "Username:",
|
|
183563
|
+
validate(value) {
|
|
183564
|
+
if (!value) {
|
|
183565
|
+
return "Required";
|
|
183566
|
+
}
|
|
183567
|
+
return;
|
|
183568
|
+
}
|
|
183569
|
+
});
|
|
183570
|
+
}
|
|
183486
183571
|
const client6 = new CognitoIdentityProviderClient({
|
|
183487
183572
|
region,
|
|
183488
183573
|
credentials: credentials4
|
|
@@ -183517,39 +183602,54 @@ var update = (program3) => {
|
|
|
183517
183602
|
return groups;
|
|
183518
183603
|
}
|
|
183519
183604
|
});
|
|
183520
|
-
const
|
|
183521
|
-
|
|
183522
|
-
|
|
183523
|
-
|
|
183524
|
-
|
|
183525
|
-
|
|
183526
|
-
|
|
183527
|
-
|
|
183528
|
-
|
|
183529
|
-
|
|
183530
|
-
|
|
183531
|
-
|
|
183532
|
-
|
|
183533
|
-
|
|
183534
|
-
|
|
183535
|
-
|
|
183536
|
-
|
|
183537
|
-
|
|
183538
|
-
|
|
183539
|
-
|
|
183540
|
-
|
|
183541
|
-
|
|
183542
|
-
|
|
183543
|
-
|
|
183544
|
-
|
|
183545
|
-
|
|
183546
|
-
|
|
183547
|
-
|
|
183548
|
-
|
|
183605
|
+
const validatePassword = (value) => {
|
|
183606
|
+
if (!value) {
|
|
183607
|
+
return "Required";
|
|
183608
|
+
}
|
|
183609
|
+
if (value.length < props.password.minLength) {
|
|
183610
|
+
return `Min length is ${props.password.minLength}`;
|
|
183611
|
+
}
|
|
183612
|
+
if (props.password.lowercase && value.toUpperCase() === value) {
|
|
183613
|
+
return `Should include lowercase characters`;
|
|
183614
|
+
}
|
|
183615
|
+
if (props.password.uppercase && value.toLowerCase() === value) {
|
|
183616
|
+
return `Should include uppercase characters`;
|
|
183617
|
+
}
|
|
183618
|
+
if (props.password.numbers && !/\d/.test(value)) {
|
|
183619
|
+
return `Should include numbers`;
|
|
183620
|
+
}
|
|
183621
|
+
if (props.password.symbols && !/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(value)) {
|
|
183622
|
+
return `Should include symbols`;
|
|
183623
|
+
}
|
|
183624
|
+
return;
|
|
183625
|
+
};
|
|
183626
|
+
let password2 = options.password;
|
|
183627
|
+
if (password2) {
|
|
183628
|
+
const issue = validatePassword(password2);
|
|
183629
|
+
if (issue) {
|
|
183630
|
+
throw new ExpectedError(`Invalid password: ${issue}`);
|
|
183631
|
+
}
|
|
183632
|
+
} else if (!process.env.SKIP_PROMPT) {
|
|
183633
|
+
const changePass = await prompts_exports.confirm({
|
|
183634
|
+
message: `Do you wanna change the user's password`,
|
|
183635
|
+
initialValue: false
|
|
183549
183636
|
});
|
|
183637
|
+
if (changePass) {
|
|
183638
|
+
password2 = await prompts_exports.password({
|
|
183639
|
+
message: "New Password:",
|
|
183640
|
+
validate: validatePassword
|
|
183641
|
+
});
|
|
183642
|
+
}
|
|
183550
183643
|
}
|
|
183551
|
-
let newGroups =
|
|
183552
|
-
if (
|
|
183644
|
+
let newGroups = oldGroups;
|
|
183645
|
+
if (options.groups) {
|
|
183646
|
+
newGroups = options.groups;
|
|
183647
|
+
for (const group4 of newGroups) {
|
|
183648
|
+
if (!props.groups.includes(group4)) {
|
|
183649
|
+
throw new ExpectedError(`The group "${group4}" doesn't exist.`);
|
|
183650
|
+
}
|
|
183651
|
+
}
|
|
183652
|
+
} else if (!process.env.SKIP_PROMPT && props.groups.length > 0) {
|
|
183553
183653
|
newGroups = await prompts_exports.multiSelect({
|
|
183554
183654
|
message: "Groups:",
|
|
183555
183655
|
required: false,
|
|
@@ -183564,7 +183664,7 @@ var update = (program3) => {
|
|
|
183564
183664
|
successMessage: "User updated.",
|
|
183565
183665
|
errorMessage: "Failed updating user.",
|
|
183566
183666
|
async task() {
|
|
183567
|
-
if (
|
|
183667
|
+
if (password2) {
|
|
183568
183668
|
await client6.send(new AdminSetUserPasswordCommand({
|
|
183569
183669
|
UserPoolId: userPoolId,
|
|
183570
183670
|
Username: username,
|
|
@@ -183598,23 +183698,36 @@ var update = (program3) => {
|
|
|
183598
183698
|
|
|
183599
183699
|
// src/cli/command/auth/user/delete.ts
|
|
183600
183700
|
var del3 = (program3) => {
|
|
183601
|
-
program3.command("delete").description("Delete an user from your userpool").action(async () => {
|
|
183701
|
+
program3.command("delete").description("Delete an user from your userpool").option("--pool <name>", "The auth userpool name").option("--username <username>", "The username of the user to delete").action(async (options) => {
|
|
183602
183702
|
await layout("auth user delete", async ({ appConfig, stackConfigs }) => {
|
|
183603
183703
|
const region = appConfig.region;
|
|
183604
183704
|
const profile4 = appConfig.profile;
|
|
183605
183705
|
const credentials4 = await getCredentials2(profile4);
|
|
183606
183706
|
const accountId = await getAccountId(credentials4, region);
|
|
183607
|
-
|
|
183707
|
+
const pools = Object.keys(appConfig.defaults.auth ?? {});
|
|
183708
|
+
if (pools.length === 0) {
|
|
183608
183709
|
throw new ExpectedError("No auth resources are defined.");
|
|
183609
183710
|
}
|
|
183610
|
-
|
|
183611
|
-
|
|
183612
|
-
|
|
183613
|
-
|
|
183614
|
-
|
|
183615
|
-
|
|
183616
|
-
|
|
183617
|
-
|
|
183711
|
+
let name = options.pool;
|
|
183712
|
+
if (name && !pools.includes(name)) {
|
|
183713
|
+
throw new ExpectedError(`The auth userpool "${name}" doesn't exist.`);
|
|
183714
|
+
}
|
|
183715
|
+
if (!name) {
|
|
183716
|
+
if (pools.length === 1) {
|
|
183717
|
+
name = pools[0];
|
|
183718
|
+
} else if (process.env.SKIP_PROMPT) {
|
|
183719
|
+
throw new ExpectedError(`Pass --pool <name> when running with --skip-prompt: [ ${pools.join(", ")} ]`);
|
|
183720
|
+
} else {
|
|
183721
|
+
name = await prompts_exports.select({
|
|
183722
|
+
message: "Select the auth userpool:",
|
|
183723
|
+
initialValue: pools.at(0),
|
|
183724
|
+
options: pools.map((name2) => ({
|
|
183725
|
+
label: name2,
|
|
183726
|
+
value: name2
|
|
183727
|
+
}))
|
|
183728
|
+
});
|
|
183729
|
+
}
|
|
183730
|
+
}
|
|
183618
183731
|
const userPoolId = await logs_exports.task({
|
|
183619
183732
|
initialMessage: "Loading auth userpool...",
|
|
183620
183733
|
successMessage: "Done loading auth userpool.",
|
|
@@ -183634,21 +183747,29 @@ var del3 = (program3) => {
|
|
|
183634
183747
|
}
|
|
183635
183748
|
}
|
|
183636
183749
|
});
|
|
183637
|
-
|
|
183638
|
-
|
|
183639
|
-
|
|
183640
|
-
|
|
183641
|
-
|
|
183750
|
+
let username = options.username;
|
|
183751
|
+
if (!username) {
|
|
183752
|
+
if (process.env.SKIP_PROMPT) {
|
|
183753
|
+
throw new ExpectedError("Pass --username <username> when running with --skip-prompt.");
|
|
183754
|
+
}
|
|
183755
|
+
username = await prompts_exports.text({
|
|
183756
|
+
message: "Username:",
|
|
183757
|
+
validate(value) {
|
|
183758
|
+
if (!value) {
|
|
183759
|
+
return "Required";
|
|
183760
|
+
}
|
|
183761
|
+
return;
|
|
183642
183762
|
}
|
|
183643
|
-
|
|
183763
|
+
});
|
|
183764
|
+
}
|
|
183765
|
+
if (!process.env.SKIP_PROMPT) {
|
|
183766
|
+
const confirm2 = await prompts_exports.confirm({
|
|
183767
|
+
message: "Are you sure you want to delete this user?",
|
|
183768
|
+
initialValue: false
|
|
183769
|
+
});
|
|
183770
|
+
if (!confirm2) {
|
|
183771
|
+
throw new Cancelled;
|
|
183644
183772
|
}
|
|
183645
|
-
});
|
|
183646
|
-
const confirm2 = await prompts_exports.confirm({
|
|
183647
|
-
message: "Are you sure you want to delete this user?",
|
|
183648
|
-
initialValue: false
|
|
183649
|
-
});
|
|
183650
|
-
if (!confirm2) {
|
|
183651
|
-
throw new Cancelled;
|
|
183652
183773
|
}
|
|
183653
183774
|
const client6 = new CognitoIdentityProviderClient({
|
|
183654
183775
|
region,
|
|
@@ -200925,6 +201046,8 @@ var run = (program3) => {
|
|
|
200925
201046
|
command7 = commands7.find((cmd) => {
|
|
200926
201047
|
return cmd.name === selected;
|
|
200927
201048
|
});
|
|
201049
|
+
} else if (process.env.SKIP_PROMPT) {
|
|
201050
|
+
throw new ExpectedError(`Pass the command argument when running with --skip-prompt: [ ${commands7.map((cmd) => cmd.name).join(", ")} ]`);
|
|
200928
201051
|
} else {
|
|
200929
201052
|
command7 = await prompts_exports.select({
|
|
200930
201053
|
message: "Pick the command you want to run:",
|
|
@@ -200989,12 +201112,14 @@ var push = (program3) => {
|
|
|
200989
201112
|
const accountId = await getAccountId(credentials4, region);
|
|
200990
201113
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
200991
201114
|
const { state: state2 } = await createWorkSpace({ credentials: credentials4, region, accountId });
|
|
200992
|
-
|
|
200993
|
-
|
|
200994
|
-
|
|
200995
|
-
|
|
200996
|
-
|
|
200997
|
-
|
|
201115
|
+
if (!process.env.SKIP_PROMPT) {
|
|
201116
|
+
const ok = await prompts_exports.confirm({
|
|
201117
|
+
message: "Pushing up the local state might corrupt your remote state. Are you sure?",
|
|
201118
|
+
initialValue: false
|
|
201119
|
+
});
|
|
201120
|
+
if (!ok) {
|
|
201121
|
+
throw new Cancelled2;
|
|
201122
|
+
}
|
|
200998
201123
|
}
|
|
200999
201124
|
await pushRemoteState(app, state2);
|
|
201000
201125
|
return "State push was successful.";
|
|
@@ -201022,12 +201147,14 @@ var unlock2 = (program3) => {
|
|
|
201022
201147
|
if (lockedUrns.length === 0) {
|
|
201023
201148
|
return "No lock exists.";
|
|
201024
201149
|
}
|
|
201025
|
-
|
|
201026
|
-
|
|
201027
|
-
|
|
201028
|
-
|
|
201029
|
-
|
|
201030
|
-
|
|
201150
|
+
if (!process.env.SKIP_PROMPT) {
|
|
201151
|
+
const ok = await prompts_exports.confirm({
|
|
201152
|
+
message: "Releasing the lock that ensures sequential deployments might result in corrupt state if a deployment is still running. Are you sure?",
|
|
201153
|
+
initialValue: false
|
|
201154
|
+
});
|
|
201155
|
+
if (!ok) {
|
|
201156
|
+
throw new Cancelled2;
|
|
201157
|
+
}
|
|
201031
201158
|
}
|
|
201032
201159
|
for (const urn of lockedUrns) {
|
|
201033
201160
|
await lock2.insecureReleaseLock(urn);
|
|
@@ -202989,7 +203116,7 @@ function getObjectsDifference(a20, b23, formatOptions, options, memorize = DEFAU
|
|
|
202989
203116
|
// src/cli/command/state/refresh.ts
|
|
202990
203117
|
var import_wildstring5 = __toESM(require_wildstring(), 1);
|
|
202991
203118
|
var refresh2 = (program3) => {
|
|
202992
|
-
program3.command("refresh").argument("[stacks...]", "Optionally filter stacks to refresh").description("Compares & syncs the current resource state with the state known to exist in the actual cloud provider.").action(async (filters) => {
|
|
203119
|
+
program3.command("refresh").argument("[stacks...]", "Optionally filter stacks to refresh").option("--commit [indexes...]", "Accept the detected state changes without prompting, optionally limited to the listed indexes").description("Compares & syncs the current resource state with the state known to exist in the actual cloud provider.").action(async (filters, options) => {
|
|
202993
203120
|
await layout("state refresh", async ({ appConfig, stackConfigs }) => {
|
|
202994
203121
|
const region = appConfig.region;
|
|
202995
203122
|
const profile4 = appConfig.profile;
|
|
@@ -203027,8 +203154,20 @@ var refresh2 = (program3) => {
|
|
|
203027
203154
|
if (!result) {
|
|
203028
203155
|
return "Your state is up to date.";
|
|
203029
203156
|
}
|
|
203030
|
-
|
|
203031
|
-
|
|
203157
|
+
const commitAll = options.commit === true;
|
|
203158
|
+
const commitIndexes = Array.isArray(options.commit) ? options.commit.flatMap((value) => value.split(",")).filter((value) => value !== "").map((value) => {
|
|
203159
|
+
const index2 = Number(value);
|
|
203160
|
+
if (!Number.isInteger(index2) || index2 < 0 || index2 >= result.operations.length) {
|
|
203161
|
+
throw new ExpectedError(`Invalid state change index: ${value}`);
|
|
203162
|
+
}
|
|
203163
|
+
return index2;
|
|
203164
|
+
}) : [];
|
|
203165
|
+
let skipped = 0;
|
|
203166
|
+
for (const [index2, entry] of result.operations.entries()) {
|
|
203167
|
+
logs_exports.warning([
|
|
203168
|
+
`${color2.warning.bold.inverse(` ${capitalCase(entry.operation)} `)} ${color2.dim(`#${index2}`)}`,
|
|
203169
|
+
entry.urn
|
|
203170
|
+
].join(`
|
|
203032
203171
|
`));
|
|
203033
203172
|
if (entry.operation === "update") {
|
|
203034
203173
|
const diffResult = diff(entry.before, entry.after);
|
|
@@ -203036,6 +203175,14 @@ var refresh2 = (program3) => {
|
|
|
203036
203175
|
logs_exports.message(diffResult);
|
|
203037
203176
|
}
|
|
203038
203177
|
}
|
|
203178
|
+
if (commitAll || commitIndexes.includes(index2)) {
|
|
203179
|
+
entry.commit();
|
|
203180
|
+
continue;
|
|
203181
|
+
}
|
|
203182
|
+
if (process.env.SKIP_PROMPT || commitIndexes.length > 0) {
|
|
203183
|
+
skipped++;
|
|
203184
|
+
continue;
|
|
203185
|
+
}
|
|
203039
203186
|
const message4 = entry.operation === "update" ? `Are you sure you want to mark this resource as drifted inside your state file?` : `Are you sure you want to delete this resource from your state file?`;
|
|
203040
203187
|
const ok = await prompts_exports.confirm({
|
|
203041
203188
|
message: message4,
|
|
@@ -203045,6 +203192,9 @@ var refresh2 = (program3) => {
|
|
|
203045
203192
|
entry.commit();
|
|
203046
203193
|
}
|
|
203047
203194
|
}
|
|
203195
|
+
if (skipped > 0) {
|
|
203196
|
+
logs_exports.warning(`Skipped ${skipped} state changes. Run again with --commit [indexes...] to apply them.`);
|
|
203197
|
+
}
|
|
203048
203198
|
await logs_exports.task({
|
|
203049
203199
|
initialMessage: "Saving state changes...",
|
|
203050
203200
|
successMessage: "Done storing state changes.",
|
|
@@ -205680,6 +205830,9 @@ var clearCache = (program3) => {
|
|
|
205680
205830
|
}
|
|
205681
205831
|
return;
|
|
205682
205832
|
});
|
|
205833
|
+
if (process.env.SKIP_PROMPT) {
|
|
205834
|
+
throw new ExpectedError(`Pass the stack argument when running with --skip-prompt: [ ${imageStacks.map((stack2) => stack2.name).join(", ")} ]`);
|
|
205835
|
+
}
|
|
205683
205836
|
stack = await prompts_exports.select({
|
|
205684
205837
|
message: "Select the stack:",
|
|
205685
205838
|
options: imageStacks.map((stack2) => ({
|
|
@@ -205697,6 +205850,9 @@ var clearCache = (program3) => {
|
|
|
205697
205850
|
if (names.length === 0) {
|
|
205698
205851
|
throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
|
|
205699
205852
|
}
|
|
205853
|
+
if (process.env.SKIP_PROMPT) {
|
|
205854
|
+
throw new ExpectedError(`Pass the image name argument when running with --skip-prompt: [ ${names.join(", ")} ]`);
|
|
205855
|
+
}
|
|
205700
205856
|
name = await prompts_exports.select({
|
|
205701
205857
|
message: "Select the image resource:",
|
|
205702
205858
|
options: names.map((name2) => ({
|
|
@@ -205705,11 +205861,13 @@ var clearCache = (program3) => {
|
|
|
205705
205861
|
}))
|
|
205706
205862
|
});
|
|
205707
205863
|
}
|
|
205708
|
-
|
|
205709
|
-
|
|
205710
|
-
|
|
205711
|
-
|
|
205712
|
-
|
|
205864
|
+
if (!process.env.SKIP_PROMPT) {
|
|
205865
|
+
const ok = await prompts_exports.confirm({
|
|
205866
|
+
message: `Are you sure you want to clear the cache`
|
|
205867
|
+
});
|
|
205868
|
+
if (!ok) {
|
|
205869
|
+
throw new Cancelled;
|
|
205870
|
+
}
|
|
205713
205871
|
}
|
|
205714
205872
|
const { shared: shared6, app } = createApp({ appConfig, stackConfigs, accountId });
|
|
205715
205873
|
const { workspace } = await createWorkSpace({
|
|
@@ -205798,6 +205956,9 @@ var clearCache2 = (program3) => {
|
|
|
205798
205956
|
}
|
|
205799
205957
|
return;
|
|
205800
205958
|
});
|
|
205959
|
+
if (process.env.SKIP_PROMPT) {
|
|
205960
|
+
throw new ExpectedError(`Pass the stack argument when running with --skip-prompt: [ ${iconStacks.map((stack2) => stack2.name).join(", ")} ]`);
|
|
205961
|
+
}
|
|
205801
205962
|
stack = await prompts_exports.select({
|
|
205802
205963
|
message: "Select the stack:",
|
|
205803
205964
|
options: iconStacks.map((stack2) => ({
|
|
@@ -205815,6 +205976,9 @@ var clearCache2 = (program3) => {
|
|
|
205815
205976
|
if (names.length === 0) {
|
|
205816
205977
|
throw new ExpectedError(`No icon resources are defined in stack "${stack}".`);
|
|
205817
205978
|
}
|
|
205979
|
+
if (process.env.SKIP_PROMPT) {
|
|
205980
|
+
throw new ExpectedError(`Pass the icon name argument when running with --skip-prompt: [ ${names.join(", ")} ]`);
|
|
205981
|
+
}
|
|
205818
205982
|
name = await prompts_exports.select({
|
|
205819
205983
|
message: "Select the icon resource:",
|
|
205820
205984
|
options: names.map((name2) => ({
|
|
@@ -205823,11 +205987,13 @@ var clearCache2 = (program3) => {
|
|
|
205823
205987
|
}))
|
|
205824
205988
|
});
|
|
205825
205989
|
}
|
|
205826
|
-
|
|
205827
|
-
|
|
205828
|
-
|
|
205829
|
-
|
|
205830
|
-
|
|
205990
|
+
if (!process.env.SKIP_PROMPT) {
|
|
205991
|
+
const ok = await prompts_exports.confirm({
|
|
205992
|
+
message: `Are you sure you want to clear the cache`
|
|
205993
|
+
});
|
|
205994
|
+
if (!ok) {
|
|
205995
|
+
throw new Cancelled;
|
|
205996
|
+
}
|
|
205831
205997
|
}
|
|
205832
205998
|
const { shared: shared6, app } = createApp({ appConfig, stackConfigs, accountId });
|
|
205833
205999
|
const { workspace } = await createWorkSpace({
|
|
@@ -205920,6 +206086,9 @@ var invoke = (program3) => {
|
|
|
205920
206086
|
if (cronStacks.length === 0) {
|
|
205921
206087
|
throw new ExpectedError("There are no crons defined inside your app.");
|
|
205922
206088
|
}
|
|
206089
|
+
if (process.env.SKIP_PROMPT) {
|
|
206090
|
+
throw new ExpectedError(`Pass the stack argument when running with --skip-prompt: [ ${cronStacks.map((stack2) => stack2.name).join(", ")} ]`);
|
|
206091
|
+
}
|
|
205923
206092
|
stack = await prompts_exports.select({
|
|
205924
206093
|
message: "Select the stack:",
|
|
205925
206094
|
options: cronStacks.map((stack2) => ({
|
|
@@ -205937,6 +206106,9 @@ var invoke = (program3) => {
|
|
|
205937
206106
|
throw new ExpectedError(`No crons are defined in stack "${stack}".`);
|
|
205938
206107
|
}
|
|
205939
206108
|
if (!name) {
|
|
206109
|
+
if (process.env.SKIP_PROMPT) {
|
|
206110
|
+
throw new ExpectedError(`Pass the cron name argument when running with --skip-prompt: [ ${names.join(", ")} ]`);
|
|
206111
|
+
}
|
|
205940
206112
|
name = await prompts_exports.select({
|
|
205941
206113
|
message: "Select the cron:",
|
|
205942
206114
|
options: names.map((name2) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/cli",
|
|
3
|
-
"version": "0.0.46-next.
|
|
3
|
+
"version": "0.0.46-next.29",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@awsless/big-float": "^0.1.7",
|
|
29
|
-
"@awsless/dynamodb": "^0.3.22",
|
|
30
|
-
"@awsless/json": "^0.0.11",
|
|
31
29
|
"@awsless/duration": "^0.0.4",
|
|
30
|
+
"@awsless/dynamodb": "^0.3.22",
|
|
32
31
|
"@awsless/lambda": "^0.0.47",
|
|
32
|
+
"@awsless/json": "^0.0.11",
|
|
33
33
|
"@awsless/s3": "^0.0.22",
|
|
34
34
|
"@awsless/validate": "^0.1.7",
|
|
35
|
-
"
|
|
36
|
-
"awsless": "^0.0.
|
|
35
|
+
"awsless": "^0.0.15-next.8",
|
|
36
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@aws-sdk/client-cloudformation": "^3.369.0",
|
|
@@ -102,24 +102,24 @@
|
|
|
102
102
|
"zod": "^3.24.2",
|
|
103
103
|
"zod-to-json-schema": "^3.24.3",
|
|
104
104
|
"@awsless/big-float": "^0.1.7",
|
|
105
|
-
"@awsless/
|
|
105
|
+
"@awsless/clui": "^0.0.9",
|
|
106
106
|
"@awsless/cloudwatch": "^0.0.1",
|
|
107
|
-
"@awsless/
|
|
107
|
+
"@awsless/duration": "^0.0.4",
|
|
108
108
|
"@awsless/dynamodb": "^0.3.22",
|
|
109
|
+
"@awsless/iot": "^0.0.5",
|
|
109
110
|
"@awsless/json": "^0.0.11",
|
|
111
|
+
"@awsless/lambda": "^0.0.47",
|
|
112
|
+
"@awsless/open-search": "^0.0.24",
|
|
110
113
|
"@awsless/s3": "^0.0.22",
|
|
111
|
-
"@awsless/
|
|
114
|
+
"@awsless/scheduler": "^0.0.5",
|
|
112
115
|
"@awsless/size": "^0.0.2",
|
|
113
|
-
"@awsless/
|
|
116
|
+
"@awsless/redis": "^0.1.13",
|
|
114
117
|
"@awsless/sns": "^0.0.11",
|
|
115
|
-
"@awsless/scheduler": "^0.0.5",
|
|
116
|
-
"@awsless/clui": "^0.0.9",
|
|
117
118
|
"@awsless/sqs": "^0.0.24",
|
|
118
119
|
"@awsless/validate": "^0.1.7",
|
|
120
|
+
"@awsless/ssm": "^0.0.8",
|
|
119
121
|
"@awsless/weak-cache": "^0.0.1",
|
|
120
|
-
"awsless": "^0.0.15-next.8"
|
|
121
|
-
"@awsless/open-search": "^0.0.24",
|
|
122
|
-
"@awsless/ssm": "^0.0.8"
|
|
122
|
+
"awsless": "^0.0.15-next.8"
|
|
123
123
|
},
|
|
124
124
|
"scripts": {
|
|
125
125
|
"test": "bun cli/build-handlers.ts && pnpm vitest",
|