@awsless/awsless 0.0.600 → 0.0.602
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 +333 -68
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/package.json +12 -12
package/dist/bin.js
CHANGED
|
@@ -1085,11 +1085,11 @@ var FunctionDefaultSchema = z15.object({
|
|
|
1085
1085
|
// container
|
|
1086
1086
|
warm: WarmSchema.default(0),
|
|
1087
1087
|
vpc: VPCSchema.default(false),
|
|
1088
|
-
log: LogSchema.default(true).transform((
|
|
1089
|
-
retention:
|
|
1090
|
-
level: "level" in
|
|
1091
|
-
system: "system" in
|
|
1092
|
-
format: "format" in
|
|
1088
|
+
log: LogSchema.default(true).transform((log30) => ({
|
|
1089
|
+
retention: log30.retention ?? days(7),
|
|
1090
|
+
level: "level" in log30 ? log30.level : "error",
|
|
1091
|
+
system: "system" in log30 ? log30.system : "warn",
|
|
1092
|
+
format: "format" in log30 ? log30.format : "json"
|
|
1093
1093
|
})),
|
|
1094
1094
|
timeout: TimeoutSchema.default("10 seconds"),
|
|
1095
1095
|
memorySize: MemorySizeSchema.default("128 MB"),
|
|
@@ -1617,8 +1617,8 @@ var InstanceDefaultSchema = z25.object({
|
|
|
1617
1617
|
permissions: PermissionsSchema2.optional(),
|
|
1618
1618
|
healthCheck: HealthCheckSchema.optional(),
|
|
1619
1619
|
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
1620
|
-
log: LogSchema2.default(true).transform((
|
|
1621
|
-
retention:
|
|
1620
|
+
log: LogSchema2.default(true).transform((log30) => ({
|
|
1621
|
+
retention: log30.retention ?? days4(7)
|
|
1622
1622
|
}))
|
|
1623
1623
|
}).default({});
|
|
1624
1624
|
|
|
@@ -6535,7 +6535,7 @@ var buildExecutable = async (input, outputPath, architecture) => {
|
|
|
6535
6535
|
}
|
|
6536
6536
|
if (!result.success) {
|
|
6537
6537
|
throw new ExpectedError(`Executable build failed:
|
|
6538
|
-
${result.logs?.map((
|
|
6538
|
+
${result.logs?.map((log30) => log30.message).join("\n")}`);
|
|
6539
6539
|
}
|
|
6540
6540
|
const file = await readFile4(filePath);
|
|
6541
6541
|
return {
|
|
@@ -8634,12 +8634,12 @@ var del2 = (program2) => {
|
|
|
8634
8634
|
profile,
|
|
8635
8635
|
region
|
|
8636
8636
|
});
|
|
8637
|
-
await task("Deleting the stacks to AWS", async (
|
|
8637
|
+
await task("Deleting the stacks to AWS", async (update2) => {
|
|
8638
8638
|
await workspace.delete(app, {
|
|
8639
8639
|
filters: stackNames
|
|
8640
8640
|
});
|
|
8641
8641
|
await pullRemoteState(app, state2);
|
|
8642
|
-
|
|
8642
|
+
update2("Done deleting the stacks to AWS.");
|
|
8643
8643
|
});
|
|
8644
8644
|
playSuccessSound();
|
|
8645
8645
|
return "Your app has been deleted!";
|
|
@@ -8828,10 +8828,10 @@ var startTest = async (props) => {
|
|
|
8828
8828
|
tests.push(entry);
|
|
8829
8829
|
if ("task" in test2) {
|
|
8830
8830
|
const task2 = test2.task;
|
|
8831
|
-
for (const
|
|
8831
|
+
for (const log30 of task2.logs ?? []) {
|
|
8832
8832
|
entry.logs.push({
|
|
8833
|
-
time:
|
|
8834
|
-
text:
|
|
8833
|
+
time: log30.time,
|
|
8834
|
+
text: log30.content
|
|
8835
8835
|
});
|
|
8836
8836
|
}
|
|
8837
8837
|
}
|
|
@@ -8899,7 +8899,7 @@ var logTestLogs = (event) => {
|
|
|
8899
8899
|
].join(" "),
|
|
8900
8900
|
color.line(icon.dot)
|
|
8901
8901
|
);
|
|
8902
|
-
log16.message(test2.logs.map((
|
|
8902
|
+
log16.message(test2.logs.map((log30) => log30.text).join("\n"));
|
|
8903
8903
|
}
|
|
8904
8904
|
}
|
|
8905
8905
|
};
|
|
@@ -9124,7 +9124,7 @@ import {
|
|
|
9124
9124
|
} from "@aws-sdk/client-cognito-identity-provider";
|
|
9125
9125
|
import { log as log19, prompt as prompt8 } from "@awsless/clui";
|
|
9126
9126
|
var create = (program2) => {
|
|
9127
|
-
program2.command("create").
|
|
9127
|
+
program2.command("create").description("Create an user in your userpool").action(async () => {
|
|
9128
9128
|
await layout("auth user create", async ({ appConfig, stackConfigs }) => {
|
|
9129
9129
|
const region = appConfig.region;
|
|
9130
9130
|
const profile = appConfig.profile;
|
|
@@ -9133,20 +9133,15 @@ var create = (program2) => {
|
|
|
9133
9133
|
if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
|
|
9134
9134
|
throw new ExpectedError("No auth resources are defined.");
|
|
9135
9135
|
}
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
});
|
|
9145
|
-
}
|
|
9136
|
+
const name = await prompt8.select({
|
|
9137
|
+
message: "Select the auth userpool:",
|
|
9138
|
+
initialValue: Object.keys(appConfig.defaults.auth).at(0),
|
|
9139
|
+
options: Object.keys(appConfig.defaults.auth).map((name2) => ({
|
|
9140
|
+
label: name2,
|
|
9141
|
+
value: name2
|
|
9142
|
+
}))
|
|
9143
|
+
});
|
|
9146
9144
|
const props = appConfig.defaults.auth[name];
|
|
9147
|
-
if (!props) {
|
|
9148
|
-
throw new ExpectedError(`Provided auth name doesn't exist inside your app config.`);
|
|
9149
|
-
}
|
|
9150
9145
|
const userPoolId = await log19.task({
|
|
9151
9146
|
initialMessage: "Loading auth userpool...",
|
|
9152
9147
|
successMessage: "Done loading auth userpool.",
|
|
@@ -9258,8 +9253,279 @@ var create = (program2) => {
|
|
|
9258
9253
|
});
|
|
9259
9254
|
};
|
|
9260
9255
|
|
|
9256
|
+
// src/cli/command/auth/user/update.ts
|
|
9257
|
+
import {
|
|
9258
|
+
AdminAddUserToGroupCommand as AdminAddUserToGroupCommand2,
|
|
9259
|
+
AdminGetUserCommand,
|
|
9260
|
+
AdminListGroupsForUserCommand,
|
|
9261
|
+
AdminRemoveUserFromGroupCommand,
|
|
9262
|
+
AdminSetUserPasswordCommand as AdminSetUserPasswordCommand2,
|
|
9263
|
+
CognitoIdentityProviderClient as CognitoIdentityProviderClient2,
|
|
9264
|
+
UserNotFoundException
|
|
9265
|
+
} from "@aws-sdk/client-cognito-identity-provider";
|
|
9266
|
+
import { log as log20, prompt as prompt9 } from "@awsless/clui";
|
|
9267
|
+
var update = (program2) => {
|
|
9268
|
+
program2.command("update").description("Update an user in your userpool").action(async () => {
|
|
9269
|
+
await layout("auth user update", async ({ appConfig, stackConfigs }) => {
|
|
9270
|
+
const region = appConfig.region;
|
|
9271
|
+
const profile = appConfig.profile;
|
|
9272
|
+
const credentials = await getCredentials(profile);
|
|
9273
|
+
const accountId = await getAccountId(credentials, region);
|
|
9274
|
+
if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
|
|
9275
|
+
throw new ExpectedError("No auth resources are defined.");
|
|
9276
|
+
}
|
|
9277
|
+
const name = await prompt9.select({
|
|
9278
|
+
message: "Select the auth userpool:",
|
|
9279
|
+
initialValue: Object.keys(appConfig.defaults.auth).at(0),
|
|
9280
|
+
options: Object.keys(appConfig.defaults.auth).map((name2) => ({
|
|
9281
|
+
label: name2,
|
|
9282
|
+
value: name2
|
|
9283
|
+
}))
|
|
9284
|
+
});
|
|
9285
|
+
const props = appConfig.defaults.auth[name];
|
|
9286
|
+
const userPoolId = await log20.task({
|
|
9287
|
+
initialMessage: "Loading auth userpool...",
|
|
9288
|
+
successMessage: "Done loading auth userpool.",
|
|
9289
|
+
errorMessage: "Failed loading auth userpool.",
|
|
9290
|
+
async task() {
|
|
9291
|
+
const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9292
|
+
const { workspace } = await createWorkSpace({
|
|
9293
|
+
credentials,
|
|
9294
|
+
accountId,
|
|
9295
|
+
profile,
|
|
9296
|
+
region
|
|
9297
|
+
});
|
|
9298
|
+
await workspace.hydrate(app);
|
|
9299
|
+
try {
|
|
9300
|
+
return await shared.entry("auth", `user-pool-id`, name);
|
|
9301
|
+
} catch (_) {
|
|
9302
|
+
throw new ExpectedError(`The auth userpool hasn't been deployed yet.`);
|
|
9303
|
+
}
|
|
9304
|
+
}
|
|
9305
|
+
});
|
|
9306
|
+
const username = await prompt9.text({
|
|
9307
|
+
message: "Username:",
|
|
9308
|
+
validate(value) {
|
|
9309
|
+
if (!value) {
|
|
9310
|
+
return "Required";
|
|
9311
|
+
}
|
|
9312
|
+
return;
|
|
9313
|
+
}
|
|
9314
|
+
});
|
|
9315
|
+
const client = new CognitoIdentityProviderClient2({
|
|
9316
|
+
region,
|
|
9317
|
+
credentials
|
|
9318
|
+
});
|
|
9319
|
+
const oldGroups = await log20.task({
|
|
9320
|
+
initialMessage: "Fetching user info...",
|
|
9321
|
+
successMessage: "Done fetching user info.",
|
|
9322
|
+
errorMessage: `Failed fetching user info.`,
|
|
9323
|
+
async task() {
|
|
9324
|
+
try {
|
|
9325
|
+
await client.send(
|
|
9326
|
+
new AdminGetUserCommand({
|
|
9327
|
+
UserPoolId: userPoolId,
|
|
9328
|
+
Username: username
|
|
9329
|
+
})
|
|
9330
|
+
);
|
|
9331
|
+
} catch (error) {
|
|
9332
|
+
if (error instanceof UserNotFoundException) {
|
|
9333
|
+
throw new ExpectedError("User does not exist");
|
|
9334
|
+
}
|
|
9335
|
+
throw error;
|
|
9336
|
+
}
|
|
9337
|
+
const groups = [];
|
|
9338
|
+
let token;
|
|
9339
|
+
do {
|
|
9340
|
+
const result = await client.send(
|
|
9341
|
+
new AdminListGroupsForUserCommand({
|
|
9342
|
+
UserPoolId: userPoolId,
|
|
9343
|
+
Username: username,
|
|
9344
|
+
NextToken: token
|
|
9345
|
+
})
|
|
9346
|
+
);
|
|
9347
|
+
groups.push(...result.Groups?.map((g) => g.GroupName) ?? []);
|
|
9348
|
+
token = result.NextToken;
|
|
9349
|
+
} while (token);
|
|
9350
|
+
return groups;
|
|
9351
|
+
}
|
|
9352
|
+
});
|
|
9353
|
+
const changePass = await prompt9.confirm({
|
|
9354
|
+
message: `Do you wanna change the user's password`,
|
|
9355
|
+
initialValue: false
|
|
9356
|
+
});
|
|
9357
|
+
let password;
|
|
9358
|
+
if (changePass) {
|
|
9359
|
+
password = await prompt9.password({
|
|
9360
|
+
message: "New Password:",
|
|
9361
|
+
validate(value) {
|
|
9362
|
+
if (!value) {
|
|
9363
|
+
return "Required";
|
|
9364
|
+
}
|
|
9365
|
+
if (value.length < props.password.minLength) {
|
|
9366
|
+
return `Min length is ${props.password.minLength}`;
|
|
9367
|
+
}
|
|
9368
|
+
if (props.password.lowercase && value.toUpperCase() === value) {
|
|
9369
|
+
return `Should include lowercase characters`;
|
|
9370
|
+
}
|
|
9371
|
+
if (props.password.uppercase && value.toLowerCase() === value) {
|
|
9372
|
+
return `Should include uppercase characters`;
|
|
9373
|
+
}
|
|
9374
|
+
if (props.password.numbers && !/\d/.test(value)) {
|
|
9375
|
+
return `Should include numbers`;
|
|
9376
|
+
}
|
|
9377
|
+
if (props.password.symbols && !/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(value)) {
|
|
9378
|
+
return `Should include symbols`;
|
|
9379
|
+
}
|
|
9380
|
+
return;
|
|
9381
|
+
}
|
|
9382
|
+
});
|
|
9383
|
+
}
|
|
9384
|
+
let newGroups = [];
|
|
9385
|
+
if (props.groups.length > 0) {
|
|
9386
|
+
newGroups = await prompt9.multiSelect({
|
|
9387
|
+
message: "Groups:",
|
|
9388
|
+
required: false,
|
|
9389
|
+
initialValues: oldGroups,
|
|
9390
|
+
options: props.groups.map((g) => ({
|
|
9391
|
+
value: g
|
|
9392
|
+
}))
|
|
9393
|
+
});
|
|
9394
|
+
}
|
|
9395
|
+
await log20.task({
|
|
9396
|
+
initialMessage: "Updating user...",
|
|
9397
|
+
successMessage: "User updated.",
|
|
9398
|
+
errorMessage: "Failed updating user.",
|
|
9399
|
+
async task() {
|
|
9400
|
+
if (changePass && password) {
|
|
9401
|
+
await client.send(
|
|
9402
|
+
new AdminSetUserPasswordCommand2({
|
|
9403
|
+
UserPoolId: userPoolId,
|
|
9404
|
+
Username: username,
|
|
9405
|
+
Password: password,
|
|
9406
|
+
Permanent: true
|
|
9407
|
+
})
|
|
9408
|
+
);
|
|
9409
|
+
}
|
|
9410
|
+
const oldGroupSet = new Set(oldGroups);
|
|
9411
|
+
const newGroupSet = new Set(newGroups);
|
|
9412
|
+
const removedGroups = oldGroupSet.difference(newGroupSet);
|
|
9413
|
+
const addedGroups = newGroupSet.difference(oldGroupSet);
|
|
9414
|
+
for (const group of removedGroups) {
|
|
9415
|
+
await client.send(
|
|
9416
|
+
new AdminRemoveUserFromGroupCommand({
|
|
9417
|
+
UserPoolId: userPoolId,
|
|
9418
|
+
Username: username,
|
|
9419
|
+
GroupName: group
|
|
9420
|
+
})
|
|
9421
|
+
);
|
|
9422
|
+
}
|
|
9423
|
+
for (const group of addedGroups) {
|
|
9424
|
+
await client.send(
|
|
9425
|
+
new AdminAddUserToGroupCommand2({
|
|
9426
|
+
UserPoolId: userPoolId,
|
|
9427
|
+
Username: username,
|
|
9428
|
+
GroupName: group
|
|
9429
|
+
})
|
|
9430
|
+
);
|
|
9431
|
+
}
|
|
9432
|
+
}
|
|
9433
|
+
});
|
|
9434
|
+
});
|
|
9435
|
+
});
|
|
9436
|
+
};
|
|
9437
|
+
|
|
9438
|
+
// src/cli/command/auth/user/delete.ts
|
|
9439
|
+
import {
|
|
9440
|
+
AdminDeleteUserCommand,
|
|
9441
|
+
CognitoIdentityProviderClient as CognitoIdentityProviderClient3,
|
|
9442
|
+
UserNotFoundException as UserNotFoundException2
|
|
9443
|
+
} from "@aws-sdk/client-cognito-identity-provider";
|
|
9444
|
+
import { Cancelled as Cancelled2, log as log21, prompt as prompt10 } from "@awsless/clui";
|
|
9445
|
+
var del3 = (program2) => {
|
|
9446
|
+
program2.command("delete").description("Delete an user from your userpool").action(async () => {
|
|
9447
|
+
await layout("auth user delete", async ({ appConfig, stackConfigs }) => {
|
|
9448
|
+
const region = appConfig.region;
|
|
9449
|
+
const profile = appConfig.profile;
|
|
9450
|
+
const credentials = await getCredentials(profile);
|
|
9451
|
+
const accountId = await getAccountId(credentials, region);
|
|
9452
|
+
if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
|
|
9453
|
+
throw new ExpectedError("No auth resources are defined.");
|
|
9454
|
+
}
|
|
9455
|
+
const name = await prompt10.select({
|
|
9456
|
+
message: "Select the auth userpool:",
|
|
9457
|
+
initialValue: Object.keys(appConfig.defaults.auth).at(0),
|
|
9458
|
+
options: Object.keys(appConfig.defaults.auth).map((name2) => ({
|
|
9459
|
+
label: name2,
|
|
9460
|
+
value: name2
|
|
9461
|
+
}))
|
|
9462
|
+
});
|
|
9463
|
+
const userPoolId = await log21.task({
|
|
9464
|
+
initialMessage: "Loading auth userpool...",
|
|
9465
|
+
successMessage: "Done loading auth userpool.",
|
|
9466
|
+
errorMessage: "Failed loading auth userpool.",
|
|
9467
|
+
async task() {
|
|
9468
|
+
const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9469
|
+
const { workspace } = await createWorkSpace({
|
|
9470
|
+
credentials,
|
|
9471
|
+
accountId,
|
|
9472
|
+
profile,
|
|
9473
|
+
region
|
|
9474
|
+
});
|
|
9475
|
+
await workspace.hydrate(app);
|
|
9476
|
+
try {
|
|
9477
|
+
return await shared.entry("auth", `user-pool-id`, name);
|
|
9478
|
+
} catch (_) {
|
|
9479
|
+
throw new ExpectedError(`The auth userpool hasn't been deployed yet.`);
|
|
9480
|
+
}
|
|
9481
|
+
}
|
|
9482
|
+
});
|
|
9483
|
+
const username = await prompt10.text({
|
|
9484
|
+
message: "Username:",
|
|
9485
|
+
validate(value) {
|
|
9486
|
+
if (!value) {
|
|
9487
|
+
return "Required";
|
|
9488
|
+
}
|
|
9489
|
+
return;
|
|
9490
|
+
}
|
|
9491
|
+
});
|
|
9492
|
+
const confirm = await prompt10.confirm({
|
|
9493
|
+
message: "Are you sure you want to delete this user?",
|
|
9494
|
+
initialValue: false
|
|
9495
|
+
});
|
|
9496
|
+
if (!confirm) {
|
|
9497
|
+
throw new Cancelled2();
|
|
9498
|
+
}
|
|
9499
|
+
const client = new CognitoIdentityProviderClient3({
|
|
9500
|
+
region,
|
|
9501
|
+
credentials
|
|
9502
|
+
});
|
|
9503
|
+
await log21.task({
|
|
9504
|
+
initialMessage: "Deleting user...",
|
|
9505
|
+
successMessage: "User deleted.",
|
|
9506
|
+
errorMessage: "Failed deleting user.",
|
|
9507
|
+
async task() {
|
|
9508
|
+
try {
|
|
9509
|
+
await client.send(
|
|
9510
|
+
new AdminDeleteUserCommand({
|
|
9511
|
+
UserPoolId: userPoolId,
|
|
9512
|
+
Username: username
|
|
9513
|
+
})
|
|
9514
|
+
);
|
|
9515
|
+
} catch (error) {
|
|
9516
|
+
if (error instanceof UserNotFoundException2) {
|
|
9517
|
+
throw new ExpectedError(`User doesn't exist`);
|
|
9518
|
+
}
|
|
9519
|
+
throw error;
|
|
9520
|
+
}
|
|
9521
|
+
}
|
|
9522
|
+
});
|
|
9523
|
+
});
|
|
9524
|
+
});
|
|
9525
|
+
};
|
|
9526
|
+
|
|
9261
9527
|
// src/cli/command/auth/user/index.ts
|
|
9262
|
-
var commands2 = [create];
|
|
9528
|
+
var commands2 = [create, update, del3];
|
|
9263
9529
|
var user = (program2) => {
|
|
9264
9530
|
const command = program2.command("user").description(`Manage auth users`);
|
|
9265
9531
|
commands2.forEach((cb) => cb(command));
|
|
@@ -9273,7 +9539,7 @@ var auth = (program2) => {
|
|
|
9273
9539
|
};
|
|
9274
9540
|
|
|
9275
9541
|
// src/cli/command/bind.ts
|
|
9276
|
-
import { log as
|
|
9542
|
+
import { log as log22 } from "@awsless/clui";
|
|
9277
9543
|
import { constantCase as constantCase15 } from "change-case";
|
|
9278
9544
|
import { spawn } from "child_process";
|
|
9279
9545
|
var bind = (program2) => {
|
|
@@ -9296,9 +9562,9 @@ var bind = (program2) => {
|
|
|
9296
9562
|
env[name] = await value;
|
|
9297
9563
|
}
|
|
9298
9564
|
if (Object.keys(env).length > 0) {
|
|
9299
|
-
|
|
9565
|
+
log22.list("Bind Env", env);
|
|
9300
9566
|
} else {
|
|
9301
|
-
|
|
9567
|
+
log22.warning("No bindings available.");
|
|
9302
9568
|
}
|
|
9303
9569
|
const configList = opts.config ?? [];
|
|
9304
9570
|
const configs = {};
|
|
@@ -9306,7 +9572,7 @@ var bind = (program2) => {
|
|
|
9306
9572
|
configs[`CONFIG_${constantCase15(name)}`] = name;
|
|
9307
9573
|
}
|
|
9308
9574
|
if (configList.length ?? 0 > 0) {
|
|
9309
|
-
|
|
9575
|
+
log22.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
|
|
9310
9576
|
}
|
|
9311
9577
|
if (commands9.length === 0) {
|
|
9312
9578
|
return "No command to execute.";
|
|
@@ -9365,7 +9631,7 @@ var watchConfig = async (options, resolve, reject) => {
|
|
|
9365
9631
|
};
|
|
9366
9632
|
|
|
9367
9633
|
// src/cli/ui/complex/build-types.ts
|
|
9368
|
-
import { log as
|
|
9634
|
+
import { log as log23 } from "@awsless/clui";
|
|
9369
9635
|
|
|
9370
9636
|
// src/type-gen/generate.ts
|
|
9371
9637
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -9399,7 +9665,7 @@ var generateTypes = async (props) => {
|
|
|
9399
9665
|
// src/cli/ui/complex/build-types.ts
|
|
9400
9666
|
var buildTypes = async (props) => {
|
|
9401
9667
|
await generateTypes(props);
|
|
9402
|
-
|
|
9668
|
+
log23.step("Done generating type definition files.");
|
|
9403
9669
|
};
|
|
9404
9670
|
|
|
9405
9671
|
// src/cli/command/dev.ts
|
|
@@ -9423,7 +9689,7 @@ var dev = (program2) => {
|
|
|
9423
9689
|
};
|
|
9424
9690
|
|
|
9425
9691
|
// src/cli/command/resources.ts
|
|
9426
|
-
import { log as
|
|
9692
|
+
import { log as log24 } from "@awsless/clui";
|
|
9427
9693
|
import chalk4 from "chalk";
|
|
9428
9694
|
import wildstring5 from "wildstring";
|
|
9429
9695
|
var resources = (program2) => {
|
|
@@ -9466,9 +9732,9 @@ var resources = (program2) => {
|
|
|
9466
9732
|
continue;
|
|
9467
9733
|
}
|
|
9468
9734
|
}
|
|
9469
|
-
|
|
9735
|
+
log24.step(chalk4.magenta(stack.name));
|
|
9470
9736
|
if (stack.resources.length) {
|
|
9471
|
-
|
|
9737
|
+
log24.message(
|
|
9472
9738
|
stack.resources.map((r) => {
|
|
9473
9739
|
return [
|
|
9474
9740
|
//
|
|
@@ -9479,7 +9745,7 @@ var resources = (program2) => {
|
|
|
9479
9745
|
}).join("\n")
|
|
9480
9746
|
);
|
|
9481
9747
|
} else {
|
|
9482
|
-
|
|
9748
|
+
log24.message(color.line(`(empty)`));
|
|
9483
9749
|
}
|
|
9484
9750
|
}
|
|
9485
9751
|
});
|
|
@@ -9487,7 +9753,7 @@ var resources = (program2) => {
|
|
|
9487
9753
|
};
|
|
9488
9754
|
|
|
9489
9755
|
// src/cli/command/run.ts
|
|
9490
|
-
import { prompt as
|
|
9756
|
+
import { prompt as prompt11 } from "@awsless/clui";
|
|
9491
9757
|
import { DynamoDBClient, dynamoDBClient } from "@awsless/dynamodb";
|
|
9492
9758
|
import { iotClient, IoTDataPlaneClient } from "@awsless/iot";
|
|
9493
9759
|
import { LambdaClient as LambdaClient3, lambdaClient } from "@awsless/lambda";
|
|
@@ -9507,7 +9773,7 @@ var run = (program2) => {
|
|
|
9507
9773
|
return cmd.name === selected;
|
|
9508
9774
|
});
|
|
9509
9775
|
} else {
|
|
9510
|
-
command = await
|
|
9776
|
+
command = await prompt11.select({
|
|
9511
9777
|
message: "Pick the command you want to run:",
|
|
9512
9778
|
initialValue: commands9[0],
|
|
9513
9779
|
options: commands9.map((cmd) => ({
|
|
@@ -9540,7 +9806,6 @@ var run = (program2) => {
|
|
|
9540
9806
|
credentials,
|
|
9541
9807
|
accountId
|
|
9542
9808
|
});
|
|
9543
|
-
return;
|
|
9544
9809
|
});
|
|
9545
9810
|
});
|
|
9546
9811
|
};
|
|
@@ -9562,7 +9827,7 @@ var pull = (program2) => {
|
|
|
9562
9827
|
};
|
|
9563
9828
|
|
|
9564
9829
|
// src/cli/command/state/push.ts
|
|
9565
|
-
import { prompt as
|
|
9830
|
+
import { prompt as prompt12 } from "@awsless/clui";
|
|
9566
9831
|
var push = (program2) => {
|
|
9567
9832
|
program2.command("push").description("Push the local state to the remote server").action(async () => {
|
|
9568
9833
|
await layout("state pull", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9572,7 +9837,7 @@ var push = (program2) => {
|
|
|
9572
9837
|
const accountId = await getAccountId(credentials, region);
|
|
9573
9838
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9574
9839
|
const { state: state2 } = await createWorkSpace({ credentials, region, accountId, profile });
|
|
9575
|
-
const ok = await
|
|
9840
|
+
const ok = await prompt12.confirm({
|
|
9576
9841
|
message: "Pushing up the local state might corrupt your remote state. Are you sure?",
|
|
9577
9842
|
initialValue: false
|
|
9578
9843
|
});
|
|
@@ -9586,7 +9851,7 @@ var push = (program2) => {
|
|
|
9586
9851
|
};
|
|
9587
9852
|
|
|
9588
9853
|
// src/cli/command/state/unlock.ts
|
|
9589
|
-
import { prompt as
|
|
9854
|
+
import { prompt as prompt13 } from "@awsless/clui";
|
|
9590
9855
|
var unlock = (program2) => {
|
|
9591
9856
|
program2.command("unlock").description("Release the lock that ensures sequential deployments").action(async () => {
|
|
9592
9857
|
await layout("state unlock", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9600,7 +9865,7 @@ var unlock = (program2) => {
|
|
|
9600
9865
|
if (!isLocked) {
|
|
9601
9866
|
return "No lock is exists.";
|
|
9602
9867
|
}
|
|
9603
|
-
const ok = await
|
|
9868
|
+
const ok = await prompt13.confirm({
|
|
9604
9869
|
message: "Releasing the lock that ensures sequential deployments might result in corrupt state if a deployment is still running. Are you sure?",
|
|
9605
9870
|
initialValue: false
|
|
9606
9871
|
});
|
|
@@ -9650,7 +9915,7 @@ var types = (program2) => {
|
|
|
9650
9915
|
};
|
|
9651
9916
|
|
|
9652
9917
|
// src/cli/command/domain/list.ts
|
|
9653
|
-
import { log as
|
|
9918
|
+
import { log as log25 } from "@awsless/clui";
|
|
9654
9919
|
var list2 = (program2) => {
|
|
9655
9920
|
program2.command("list").description("List all domains").action(async () => {
|
|
9656
9921
|
await layout("domain list", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9672,7 +9937,7 @@ var list2 = (program2) => {
|
|
|
9672
9937
|
});
|
|
9673
9938
|
await workspace.hydrate(app);
|
|
9674
9939
|
for (const zone of domainZones) {
|
|
9675
|
-
|
|
9940
|
+
log25.step(
|
|
9676
9941
|
[
|
|
9677
9942
|
//
|
|
9678
9943
|
color.label.green(await zone.name),
|
|
@@ -9680,14 +9945,14 @@ var list2 = (program2) => {
|
|
|
9680
9945
|
color.dim(await zone.id)
|
|
9681
9946
|
].join(" ")
|
|
9682
9947
|
);
|
|
9683
|
-
|
|
9948
|
+
log25.message((await zone.nameServers).join("\n"));
|
|
9684
9949
|
}
|
|
9685
9950
|
});
|
|
9686
9951
|
});
|
|
9687
9952
|
};
|
|
9688
9953
|
|
|
9689
9954
|
// src/cli/command/domain/deploy.ts
|
|
9690
|
-
import { log as
|
|
9955
|
+
import { log as log26 } from "@awsless/clui";
|
|
9691
9956
|
var deploy2 = (program2) => {
|
|
9692
9957
|
program2.command("deploy").description("Deploy the domain zones to AWS").action(async () => {
|
|
9693
9958
|
await layout("domain deploy", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9707,7 +9972,7 @@ var deploy2 = (program2) => {
|
|
|
9707
9972
|
profile,
|
|
9708
9973
|
region
|
|
9709
9974
|
});
|
|
9710
|
-
await
|
|
9975
|
+
await log26.task({
|
|
9711
9976
|
initialMessage: "Deploying the domain zones to AWS...",
|
|
9712
9977
|
successMessage: "Done deploying the domain zones to AWS.",
|
|
9713
9978
|
errorMessage: "Failed deploying the domain zones to AWS.",
|
|
@@ -9716,7 +9981,7 @@ var deploy2 = (program2) => {
|
|
|
9716
9981
|
}
|
|
9717
9982
|
});
|
|
9718
9983
|
for (const zone of domainZones) {
|
|
9719
|
-
|
|
9984
|
+
log26.step(
|
|
9720
9985
|
[
|
|
9721
9986
|
//
|
|
9722
9987
|
color.label.green(await zone.name),
|
|
@@ -9724,7 +9989,7 @@ var deploy2 = (program2) => {
|
|
|
9724
9989
|
color.dim(await zone.id)
|
|
9725
9990
|
].join(" ")
|
|
9726
9991
|
);
|
|
9727
|
-
|
|
9992
|
+
log26.message((await zone.nameServers).join("\n"));
|
|
9728
9993
|
}
|
|
9729
9994
|
});
|
|
9730
9995
|
});
|
|
@@ -9743,7 +10008,7 @@ var domain = (program2) => {
|
|
|
9743
10008
|
|
|
9744
10009
|
// src/cli/command/logs.ts
|
|
9745
10010
|
import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
9746
|
-
import { log as
|
|
10011
|
+
import { log as log27 } from "@awsless/clui";
|
|
9747
10012
|
import { aws as aws30 } from "@terraforge/aws";
|
|
9748
10013
|
import chalk5 from "chalk";
|
|
9749
10014
|
import chunk2 from "chunk";
|
|
@@ -9785,7 +10050,7 @@ var logs = (program2) => {
|
|
|
9785
10050
|
process.once("SIGINT", () => {
|
|
9786
10051
|
abort.abort();
|
|
9787
10052
|
});
|
|
9788
|
-
const streams = await
|
|
10053
|
+
const streams = await log27.task({
|
|
9789
10054
|
initialMessage: "Connecting to the log stream...",
|
|
9790
10055
|
errorMessage: "Failed to connect to the log stream.",
|
|
9791
10056
|
async task(ctx) {
|
|
@@ -9842,7 +10107,7 @@ var formatLog = (level, date, group, message) => {
|
|
|
9842
10107
|
SYSTEM: chalk5.blue
|
|
9843
10108
|
};
|
|
9844
10109
|
const levelColor = levels[level] ?? chalk5.cyan;
|
|
9845
|
-
|
|
10110
|
+
log27.message(
|
|
9846
10111
|
[
|
|
9847
10112
|
[
|
|
9848
10113
|
//
|
|
@@ -9884,7 +10149,7 @@ var parseJsonLog = (message) => {
|
|
|
9884
10149
|
// src/cli/command/image/clear-cache.ts
|
|
9885
10150
|
import { CloudFrontClient as CloudFrontClient2, CreateInvalidationCommand as CreateInvalidationCommand2 } from "@aws-sdk/client-cloudfront";
|
|
9886
10151
|
import { DeleteObjectsCommand, ListObjectsV2Command, S3Client as S3Client3 } from "@aws-sdk/client-s3";
|
|
9887
|
-
import { Cancelled as
|
|
10152
|
+
import { Cancelled as Cancelled3, log as log28, prompt as prompt14 } from "@awsless/clui";
|
|
9888
10153
|
import { randomUUID } from "crypto";
|
|
9889
10154
|
var clearCache = (program2) => {
|
|
9890
10155
|
program2.command("clear-cache").argument("[stack]", "The stack name of the image proxy").argument("[name]", "The name of the image proxy").description("Clears the cache of the image proxy").action(async (stack, name) => {
|
|
@@ -9900,7 +10165,7 @@ var clearCache = (program2) => {
|
|
|
9900
10165
|
}
|
|
9901
10166
|
return;
|
|
9902
10167
|
});
|
|
9903
|
-
stack = await
|
|
10168
|
+
stack = await prompt14.select({
|
|
9904
10169
|
message: "Select the stack:",
|
|
9905
10170
|
options: imageStacks.map((stack2) => ({
|
|
9906
10171
|
label: stack2.name,
|
|
@@ -9917,7 +10182,7 @@ var clearCache = (program2) => {
|
|
|
9917
10182
|
if (!names) {
|
|
9918
10183
|
throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
|
|
9919
10184
|
}
|
|
9920
|
-
name = await
|
|
10185
|
+
name = await prompt14.select({
|
|
9921
10186
|
message: "Select the image resource:",
|
|
9922
10187
|
options: names.map((name2) => ({
|
|
9923
10188
|
label: name2,
|
|
@@ -9925,11 +10190,11 @@ var clearCache = (program2) => {
|
|
|
9925
10190
|
}))
|
|
9926
10191
|
});
|
|
9927
10192
|
}
|
|
9928
|
-
const ok = await
|
|
10193
|
+
const ok = await prompt14.confirm({
|
|
9929
10194
|
message: `Are you sure you want to clear the cache`
|
|
9930
10195
|
});
|
|
9931
10196
|
if (!ok) {
|
|
9932
|
-
throw new
|
|
10197
|
+
throw new Cancelled3();
|
|
9933
10198
|
}
|
|
9934
10199
|
const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9935
10200
|
const { workspace } = await createWorkSpace({
|
|
@@ -9956,7 +10221,7 @@ var clearCache = (program2) => {
|
|
|
9956
10221
|
region: "us-east-1"
|
|
9957
10222
|
});
|
|
9958
10223
|
let totalDeleted = 0;
|
|
9959
|
-
await
|
|
10224
|
+
await log28.task({
|
|
9960
10225
|
initialMessage: "Clearing cache...",
|
|
9961
10226
|
successMessage: "Cache successfully cleared.",
|
|
9962
10227
|
task: async () => {
|
|
@@ -10018,7 +10283,7 @@ var image = (program2) => {
|
|
|
10018
10283
|
// src/cli/command/icon/clear-cache.ts
|
|
10019
10284
|
import { CloudFrontClient as CloudFrontClient3, CreateInvalidationCommand as CreateInvalidationCommand3 } from "@aws-sdk/client-cloudfront";
|
|
10020
10285
|
import { DeleteObjectsCommand as DeleteObjectsCommand2, ListObjectsV2Command as ListObjectsV2Command2, S3Client as S3Client4 } from "@aws-sdk/client-s3";
|
|
10021
|
-
import { Cancelled as
|
|
10286
|
+
import { Cancelled as Cancelled4, log as log29, prompt as prompt15 } from "@awsless/clui";
|
|
10022
10287
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
10023
10288
|
var clearCache2 = (program2) => {
|
|
10024
10289
|
program2.command("clear-cache").argument("[stack]", "The stack name of the icon proxy").argument("[name]", "The name of the icon proxy").description("Clears the cache of the icon proxy").action(async (stack, name) => {
|
|
@@ -10034,7 +10299,7 @@ var clearCache2 = (program2) => {
|
|
|
10034
10299
|
}
|
|
10035
10300
|
return;
|
|
10036
10301
|
});
|
|
10037
|
-
stack = await
|
|
10302
|
+
stack = await prompt15.select({
|
|
10038
10303
|
message: "Select the stack:",
|
|
10039
10304
|
options: iconStacks.map((stack2) => ({
|
|
10040
10305
|
label: stack2.name,
|
|
@@ -10051,7 +10316,7 @@ var clearCache2 = (program2) => {
|
|
|
10051
10316
|
if (!names) {
|
|
10052
10317
|
throw new ExpectedError(`No icon resources are defined in stack "${stack}".`);
|
|
10053
10318
|
}
|
|
10054
|
-
name = await
|
|
10319
|
+
name = await prompt15.select({
|
|
10055
10320
|
message: "Select the icon resource:",
|
|
10056
10321
|
options: names.map((name2) => ({
|
|
10057
10322
|
label: name2,
|
|
@@ -10059,11 +10324,11 @@ var clearCache2 = (program2) => {
|
|
|
10059
10324
|
}))
|
|
10060
10325
|
});
|
|
10061
10326
|
}
|
|
10062
|
-
const ok = await
|
|
10327
|
+
const ok = await prompt15.confirm({
|
|
10063
10328
|
message: `Are you sure you want to clear the cache`
|
|
10064
10329
|
});
|
|
10065
10330
|
if (!ok) {
|
|
10066
|
-
throw new
|
|
10331
|
+
throw new Cancelled4();
|
|
10067
10332
|
}
|
|
10068
10333
|
const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
|
|
10069
10334
|
const { workspace } = await createWorkSpace({
|
|
@@ -10090,7 +10355,7 @@ var clearCache2 = (program2) => {
|
|
|
10090
10355
|
region: "us-east-1"
|
|
10091
10356
|
});
|
|
10092
10357
|
let totalDeleted = 0;
|
|
10093
|
-
await
|
|
10358
|
+
await log29.task({
|
|
10094
10359
|
initialMessage: "Clearing cache...",
|
|
10095
10360
|
successMessage: "Cache successfully cleared.",
|
|
10096
10361
|
task: async () => {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.602",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@awsless/big-float": "^0.1.5",
|
|
37
37
|
"@awsless/cloudwatch": "^0.0.1",
|
|
38
|
-
"@awsless/clui": "^0.0.8",
|
|
39
|
-
"@awsless/dynamodb": "^0.3.8",
|
|
40
38
|
"@awsless/duration": "^0.0.4",
|
|
39
|
+
"@awsless/clui": "^0.0.8",
|
|
41
40
|
"@awsless/json": "^0.0.10",
|
|
41
|
+
"@awsless/dynamodb": "^0.3.8",
|
|
42
42
|
"@awsless/iot": "^0.0.3",
|
|
43
|
-
"@awsless/open-search": "^0.0.21",
|
|
44
43
|
"@awsless/lambda": "^0.0.35",
|
|
45
|
-
"@awsless/
|
|
44
|
+
"@awsless/mqtt": "^0.0.2",
|
|
46
45
|
"@awsless/s3": "^0.0.21",
|
|
47
|
-
"@awsless/
|
|
46
|
+
"@awsless/open-search": "^0.0.21",
|
|
47
|
+
"@awsless/redis": "^0.0.14",
|
|
48
48
|
"@awsless/sqs": "^0.0.16",
|
|
49
|
-
"@awsless/
|
|
50
|
-
"@awsless/weak-cache": "^0.0.1",
|
|
49
|
+
"@awsless/sns": "^0.0.10",
|
|
51
50
|
"@awsless/validate": "^0.1.3",
|
|
52
|
-
"@awsless/
|
|
51
|
+
"@awsless/ssm": "^0.0.7",
|
|
52
|
+
"@awsless/weak-cache": "^0.0.1"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@arcanyx/cidr-slicer": "^0.3.0",
|
|
@@ -141,14 +141,14 @@
|
|
|
141
141
|
"zod-to-json-schema": "^3.24.3",
|
|
142
142
|
"@awsless/big-float": "^0.1.5",
|
|
143
143
|
"@awsless/cloudwatch": "^0.0.1",
|
|
144
|
+
"@awsless/clui": "^0.0.8",
|
|
144
145
|
"@awsless/duration": "^0.0.4",
|
|
145
146
|
"@awsless/graphql": "^0.0.9",
|
|
146
147
|
"@awsless/json": "^0.0.10",
|
|
147
148
|
"@awsless/size": "^0.0.2",
|
|
148
149
|
"@awsless/validate": "^0.1.3",
|
|
149
|
-
"@awsless/
|
|
150
|
-
"@awsless/
|
|
151
|
-
"@awsless/ts-file-cache": "^0.0.12"
|
|
150
|
+
"@awsless/ts-file-cache": "^0.0.12",
|
|
151
|
+
"@awsless/scheduler": "^0.0.4"
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|
|
154
154
|
"@hono/node-server": "1.19.9",
|