@awsless/awsless 0.0.599 → 0.0.601
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/app.json +1 -1
- package/dist/bin.js +338 -86
- package/dist/build-json-schema.js +1 -0
- 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 +16 -16
package/dist/bin.js
CHANGED
|
@@ -826,6 +826,7 @@ var AuthDefaultSchema = z9.record(
|
|
|
826
826
|
// .optional()
|
|
827
827
|
// .describe('The email configuration for sending messages.'),
|
|
828
828
|
// secret: z.boolean().default(false).describe('Specifies whether you want to generate a client secret.'),
|
|
829
|
+
groups: z9.string().array().default([]).describe("Specifies a list of groups that a user can belong to."),
|
|
829
830
|
username: z9.object({
|
|
830
831
|
// emailAlias: z.boolean().default(true).describe('Allow the user email to be used as username.'),
|
|
831
832
|
caseSensitive: z9.boolean().default(false).describe(
|
|
@@ -1084,11 +1085,11 @@ var FunctionDefaultSchema = z15.object({
|
|
|
1084
1085
|
// container
|
|
1085
1086
|
warm: WarmSchema.default(0),
|
|
1086
1087
|
vpc: VPCSchema.default(false),
|
|
1087
|
-
log: LogSchema.default(true).transform((
|
|
1088
|
-
retention:
|
|
1089
|
-
level: "level" in
|
|
1090
|
-
system: "system" in
|
|
1091
|
-
format: "format" in
|
|
1088
|
+
log: LogSchema.default(true).transform((log29) => ({
|
|
1089
|
+
retention: log29.retention ?? days(7),
|
|
1090
|
+
level: "level" in log29 ? log29.level : "error",
|
|
1091
|
+
system: "system" in log29 ? log29.system : "warn",
|
|
1092
|
+
format: "format" in log29 ? log29.format : "json"
|
|
1092
1093
|
})),
|
|
1093
1094
|
timeout: TimeoutSchema.default("10 seconds"),
|
|
1094
1095
|
memorySize: MemorySizeSchema.default("128 MB"),
|
|
@@ -1616,8 +1617,8 @@ var InstanceDefaultSchema = z25.object({
|
|
|
1616
1617
|
permissions: PermissionsSchema2.optional(),
|
|
1617
1618
|
healthCheck: HealthCheckSchema.optional(),
|
|
1618
1619
|
// restartPolicy: RestartPolicySchema.default({ enabled: true }),
|
|
1619
|
-
log: LogSchema2.default(true).transform((
|
|
1620
|
-
retention:
|
|
1620
|
+
log: LogSchema2.default(true).transform((log29) => ({
|
|
1621
|
+
retention: log29.retention ?? days4(7)
|
|
1621
1622
|
}))
|
|
1622
1623
|
}).default({});
|
|
1623
1624
|
|
|
@@ -2738,6 +2739,12 @@ var authFeature = defineFeature({
|
|
|
2738
2739
|
explicitAuthFlows: ["ALLOW_USER_SRP_AUTH", "ALLOW_REFRESH_TOKEN_AUTH"],
|
|
2739
2740
|
preventUserExistenceErrors: "ENABLED"
|
|
2740
2741
|
});
|
|
2742
|
+
for (const name2 of props.groups) {
|
|
2743
|
+
new aws2.cognito.UserGroup(group, name2, {
|
|
2744
|
+
name: name2,
|
|
2745
|
+
userPoolId: userPool.id
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2741
2748
|
ctx.bind(`AUTH_${constantCase2(id)}_USER_POOL_ID`, userPool.id);
|
|
2742
2749
|
ctx.bind(`AUTH_${constantCase2(id)}_CLIENT_ID`, client.id);
|
|
2743
2750
|
ctx.shared.add("auth", "user-pool-arn", id, userPool.arn);
|
|
@@ -6528,7 +6535,7 @@ var buildExecutable = async (input, outputPath, architecture) => {
|
|
|
6528
6535
|
}
|
|
6529
6536
|
if (!result.success) {
|
|
6530
6537
|
throw new ExpectedError(`Executable build failed:
|
|
6531
|
-
${result.logs?.map((
|
|
6538
|
+
${result.logs?.map((log29) => log29.message).join("\n")}`);
|
|
6532
6539
|
}
|
|
6533
6540
|
const file = await readFile4(filePath);
|
|
6534
6541
|
return {
|
|
@@ -8627,12 +8634,12 @@ var del2 = (program2) => {
|
|
|
8627
8634
|
profile,
|
|
8628
8635
|
region
|
|
8629
8636
|
});
|
|
8630
|
-
await task("Deleting the stacks to AWS", async (
|
|
8637
|
+
await task("Deleting the stacks to AWS", async (update2) => {
|
|
8631
8638
|
await workspace.delete(app, {
|
|
8632
8639
|
filters: stackNames
|
|
8633
8640
|
});
|
|
8634
8641
|
await pullRemoteState(app, state2);
|
|
8635
|
-
|
|
8642
|
+
update2("Done deleting the stacks to AWS.");
|
|
8636
8643
|
});
|
|
8637
8644
|
playSuccessSound();
|
|
8638
8645
|
return "Your app has been deleted!";
|
|
@@ -8821,10 +8828,10 @@ var startTest = async (props) => {
|
|
|
8821
8828
|
tests.push(entry);
|
|
8822
8829
|
if ("task" in test2) {
|
|
8823
8830
|
const task2 = test2.task;
|
|
8824
|
-
for (const
|
|
8831
|
+
for (const log29 of task2.logs ?? []) {
|
|
8825
8832
|
entry.logs.push({
|
|
8826
|
-
time:
|
|
8827
|
-
text:
|
|
8833
|
+
time: log29.time,
|
|
8834
|
+
text: log29.content
|
|
8828
8835
|
});
|
|
8829
8836
|
}
|
|
8830
8837
|
}
|
|
@@ -8892,7 +8899,7 @@ var logTestLogs = (event) => {
|
|
|
8892
8899
|
].join(" "),
|
|
8893
8900
|
color.line(icon.dot)
|
|
8894
8901
|
);
|
|
8895
|
-
log16.message(test2.logs.map((
|
|
8902
|
+
log16.message(test2.logs.map((log29) => log29.text).join("\n"));
|
|
8896
8903
|
}
|
|
8897
8904
|
}
|
|
8898
8905
|
};
|
|
@@ -9109,13 +9116,15 @@ var deploy = (program2) => {
|
|
|
9109
9116
|
|
|
9110
9117
|
// src/cli/command/auth/user/create.ts
|
|
9111
9118
|
import {
|
|
9119
|
+
AdminAddUserToGroupCommand,
|
|
9112
9120
|
AdminCreateUserCommand,
|
|
9113
9121
|
AdminSetUserPasswordCommand,
|
|
9114
|
-
CognitoIdentityProviderClient
|
|
9122
|
+
CognitoIdentityProviderClient,
|
|
9123
|
+
UsernameExistsException
|
|
9115
9124
|
} from "@aws-sdk/client-cognito-identity-provider";
|
|
9116
|
-
import { prompt as prompt8 } from "@awsless/clui";
|
|
9125
|
+
import { log as log19, prompt as prompt8 } from "@awsless/clui";
|
|
9117
9126
|
var create = (program2) => {
|
|
9118
|
-
program2.command("create").argument("[name]", "The name of the auth instance").description("Create an user
|
|
9127
|
+
program2.command("create").argument("[name]", "The name of the auth instance").description("Create an user in your userpool").action(async (name) => {
|
|
9119
9128
|
await layout("auth user create", async ({ appConfig, stackConfigs }) => {
|
|
9120
9129
|
const region = appConfig.region;
|
|
9121
9130
|
const profile = appConfig.profile;
|
|
@@ -9134,24 +9143,31 @@ var create = (program2) => {
|
|
|
9134
9143
|
}))
|
|
9135
9144
|
});
|
|
9136
9145
|
}
|
|
9137
|
-
|
|
9146
|
+
const props = appConfig.defaults.auth[name];
|
|
9147
|
+
if (!props) {
|
|
9138
9148
|
throw new ExpectedError(`Provided auth name doesn't exist inside your app config.`);
|
|
9139
9149
|
}
|
|
9140
|
-
const
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9150
|
+
const userPoolId = await log19.task({
|
|
9151
|
+
initialMessage: "Loading auth userpool...",
|
|
9152
|
+
successMessage: "Done loading auth userpool.",
|
|
9153
|
+
errorMessage: "Failed loading auth userpool.",
|
|
9154
|
+
async task() {
|
|
9155
|
+
const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9156
|
+
const { workspace } = await createWorkSpace({
|
|
9157
|
+
credentials,
|
|
9158
|
+
accountId,
|
|
9159
|
+
profile,
|
|
9160
|
+
region
|
|
9161
|
+
});
|
|
9162
|
+
await workspace.hydrate(app);
|
|
9163
|
+
try {
|
|
9164
|
+
return await shared.entry("auth", `user-pool-id`, name);
|
|
9165
|
+
} catch (_) {
|
|
9166
|
+
throw new ExpectedError(`The auth userpool hasn't been deployed yet.`);
|
|
9167
|
+
}
|
|
9168
|
+
}
|
|
9146
9169
|
});
|
|
9147
|
-
await
|
|
9148
|
-
let userPoolId;
|
|
9149
|
-
try {
|
|
9150
|
-
userPoolId = await shared.entry("auth", `user-pool-id`, name);
|
|
9151
|
-
} catch (_) {
|
|
9152
|
-
throw new ExpectedError(`The auth userpool hasn't been deployed yet.`);
|
|
9153
|
-
}
|
|
9154
|
-
const user2 = await prompt8.text({
|
|
9170
|
+
const username = await prompt8.text({
|
|
9155
9171
|
message: "Username:",
|
|
9156
9172
|
validate(value) {
|
|
9157
9173
|
if (!value) {
|
|
@@ -9160,41 +9176,277 @@ var create = (program2) => {
|
|
|
9160
9176
|
return;
|
|
9161
9177
|
}
|
|
9162
9178
|
});
|
|
9163
|
-
const
|
|
9179
|
+
const password = await prompt8.password({
|
|
9164
9180
|
message: "Password:",
|
|
9165
9181
|
validate(value) {
|
|
9166
9182
|
if (!value) {
|
|
9167
9183
|
return "Required";
|
|
9168
9184
|
}
|
|
9185
|
+
if (value.length < props.password.minLength) {
|
|
9186
|
+
return `Min length is ${props.password.minLength}`;
|
|
9187
|
+
}
|
|
9188
|
+
if (props.password.lowercase && value.toUpperCase() === value) {
|
|
9189
|
+
return `Should include lowercase characters`;
|
|
9190
|
+
}
|
|
9191
|
+
if (props.password.uppercase && value.toLowerCase() === value) {
|
|
9192
|
+
return `Should include uppercase characters`;
|
|
9193
|
+
}
|
|
9194
|
+
if (props.password.numbers && !/\d/.test(value)) {
|
|
9195
|
+
return `Should include numbers`;
|
|
9196
|
+
}
|
|
9197
|
+
if (props.password.symbols && !/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(value)) {
|
|
9198
|
+
return `Should include symbols`;
|
|
9199
|
+
}
|
|
9169
9200
|
return;
|
|
9170
9201
|
}
|
|
9171
9202
|
});
|
|
9203
|
+
let groups = [];
|
|
9204
|
+
if (props.groups.length > 0) {
|
|
9205
|
+
groups = await prompt8.multiSelect({
|
|
9206
|
+
message: "Groups:",
|
|
9207
|
+
required: false,
|
|
9208
|
+
options: props.groups.map((g) => ({
|
|
9209
|
+
value: g
|
|
9210
|
+
}))
|
|
9211
|
+
});
|
|
9212
|
+
}
|
|
9172
9213
|
const client = new CognitoIdentityProviderClient({
|
|
9173
9214
|
region,
|
|
9174
9215
|
credentials
|
|
9175
9216
|
});
|
|
9176
|
-
await
|
|
9177
|
-
|
|
9178
|
-
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
|
|
9188
|
-
|
|
9189
|
-
|
|
9190
|
-
|
|
9191
|
-
|
|
9217
|
+
await log19.task({
|
|
9218
|
+
initialMessage: "Creating user...",
|
|
9219
|
+
successMessage: "User created.",
|
|
9220
|
+
errorMessage: "Failed creating user.",
|
|
9221
|
+
async task() {
|
|
9222
|
+
try {
|
|
9223
|
+
await client.send(
|
|
9224
|
+
new AdminCreateUserCommand({
|
|
9225
|
+
UserPoolId: userPoolId,
|
|
9226
|
+
Username: username,
|
|
9227
|
+
TemporaryPassword: password
|
|
9228
|
+
})
|
|
9229
|
+
);
|
|
9230
|
+
} catch (error) {
|
|
9231
|
+
if (error instanceof UsernameExistsException) {
|
|
9232
|
+
throw new ExpectedError("User already exists");
|
|
9233
|
+
}
|
|
9234
|
+
throw error;
|
|
9235
|
+
}
|
|
9236
|
+
await client.send(
|
|
9237
|
+
new AdminSetUserPasswordCommand({
|
|
9238
|
+
UserPoolId: userPoolId,
|
|
9239
|
+
Username: username,
|
|
9240
|
+
Password: password,
|
|
9241
|
+
Permanent: true
|
|
9242
|
+
})
|
|
9243
|
+
);
|
|
9244
|
+
if (groups.length > 0) {
|
|
9245
|
+
for (const group of groups) {
|
|
9246
|
+
await client.send(
|
|
9247
|
+
new AdminAddUserToGroupCommand({
|
|
9248
|
+
UserPoolId: userPoolId,
|
|
9249
|
+
Username: username,
|
|
9250
|
+
GroupName: group
|
|
9251
|
+
})
|
|
9252
|
+
);
|
|
9253
|
+
}
|
|
9254
|
+
}
|
|
9255
|
+
}
|
|
9256
|
+
});
|
|
9257
|
+
});
|
|
9258
|
+
});
|
|
9259
|
+
};
|
|
9260
|
+
|
|
9261
|
+
// src/cli/command/auth/user/update.ts
|
|
9262
|
+
import {
|
|
9263
|
+
AdminAddUserToGroupCommand as AdminAddUserToGroupCommand2,
|
|
9264
|
+
AdminGetUserCommand,
|
|
9265
|
+
AdminListGroupsForUserCommand,
|
|
9266
|
+
AdminRemoveUserFromGroupCommand,
|
|
9267
|
+
AdminSetUserPasswordCommand as AdminSetUserPasswordCommand2,
|
|
9268
|
+
CognitoIdentityProviderClient as CognitoIdentityProviderClient2,
|
|
9269
|
+
UserNotFoundException
|
|
9270
|
+
} from "@aws-sdk/client-cognito-identity-provider";
|
|
9271
|
+
import { log as log20, prompt as prompt9 } from "@awsless/clui";
|
|
9272
|
+
var update = (program2) => {
|
|
9273
|
+
program2.command("update").argument("[name]", "The name of the auth instance").description("Update an user in your userpool").action(async (name) => {
|
|
9274
|
+
await layout("auth user update", async ({ appConfig, stackConfigs }) => {
|
|
9275
|
+
const region = appConfig.region;
|
|
9276
|
+
const profile = appConfig.profile;
|
|
9277
|
+
const credentials = await getCredentials(profile);
|
|
9278
|
+
const accountId = await getAccountId(credentials, region);
|
|
9279
|
+
if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
|
|
9280
|
+
throw new ExpectedError("No auth resources are defined.");
|
|
9281
|
+
}
|
|
9282
|
+
if (!name) {
|
|
9283
|
+
name = await prompt9.select({
|
|
9284
|
+
message: "Select the auth userpool:",
|
|
9285
|
+
initialValue: Object.keys(appConfig.defaults.auth).at(0),
|
|
9286
|
+
options: Object.keys(appConfig.defaults.auth).map((name2) => ({
|
|
9287
|
+
label: name2,
|
|
9288
|
+
value: name2
|
|
9289
|
+
}))
|
|
9290
|
+
});
|
|
9291
|
+
}
|
|
9292
|
+
const props = appConfig.defaults.auth[name];
|
|
9293
|
+
if (!props) {
|
|
9294
|
+
throw new ExpectedError(`Provided auth name doesn't exist inside your app config.`);
|
|
9295
|
+
}
|
|
9296
|
+
const userPoolId = await log20.task({
|
|
9297
|
+
initialMessage: "Loading auth userpool...",
|
|
9298
|
+
successMessage: "Done loading auth userpool.",
|
|
9299
|
+
errorMessage: "Failed loading auth userpool.",
|
|
9300
|
+
async task() {
|
|
9301
|
+
const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9302
|
+
const { workspace } = await createWorkSpace({
|
|
9303
|
+
credentials,
|
|
9304
|
+
accountId,
|
|
9305
|
+
profile,
|
|
9306
|
+
region
|
|
9307
|
+
});
|
|
9308
|
+
await workspace.hydrate(app);
|
|
9309
|
+
try {
|
|
9310
|
+
return await shared.entry("auth", `user-pool-id`, name);
|
|
9311
|
+
} catch (_) {
|
|
9312
|
+
throw new ExpectedError(`The auth userpool hasn't been deployed yet.`);
|
|
9313
|
+
}
|
|
9314
|
+
}
|
|
9315
|
+
});
|
|
9316
|
+
const username = await prompt9.text({
|
|
9317
|
+
message: "Username:",
|
|
9318
|
+
validate(value) {
|
|
9319
|
+
if (!value) {
|
|
9320
|
+
return "Required";
|
|
9321
|
+
}
|
|
9322
|
+
return;
|
|
9323
|
+
}
|
|
9324
|
+
});
|
|
9325
|
+
const client = new CognitoIdentityProviderClient2({
|
|
9326
|
+
region,
|
|
9327
|
+
credentials
|
|
9328
|
+
});
|
|
9329
|
+
const oldGroups = await log20.task({
|
|
9330
|
+
initialMessage: "Fetching user info...",
|
|
9331
|
+
successMessage: "Done fetching user info.",
|
|
9332
|
+
errorMessage: `Failed fetching user info.`,
|
|
9333
|
+
async task() {
|
|
9334
|
+
try {
|
|
9335
|
+
await client.send(
|
|
9336
|
+
new AdminGetUserCommand({
|
|
9337
|
+
UserPoolId: userPoolId,
|
|
9338
|
+
Username: username
|
|
9339
|
+
})
|
|
9340
|
+
);
|
|
9341
|
+
} catch (error) {
|
|
9342
|
+
if (error instanceof UserNotFoundException) {
|
|
9343
|
+
throw new ExpectedError("User does not exist");
|
|
9344
|
+
}
|
|
9345
|
+
throw error;
|
|
9346
|
+
}
|
|
9347
|
+
const groups = [];
|
|
9348
|
+
let token;
|
|
9349
|
+
do {
|
|
9350
|
+
const result = await client.send(
|
|
9351
|
+
new AdminListGroupsForUserCommand({
|
|
9352
|
+
UserPoolId: userPoolId,
|
|
9353
|
+
Username: username,
|
|
9354
|
+
NextToken: token
|
|
9355
|
+
})
|
|
9356
|
+
);
|
|
9357
|
+
groups.push(...result.Groups?.map((g) => g.GroupName) ?? []);
|
|
9358
|
+
token = result.NextToken;
|
|
9359
|
+
} while (token);
|
|
9360
|
+
return groups;
|
|
9361
|
+
}
|
|
9362
|
+
});
|
|
9363
|
+
const changePass = await prompt9.confirm({
|
|
9364
|
+
message: `Do you wanna change the user's password`,
|
|
9365
|
+
initialValue: false
|
|
9366
|
+
});
|
|
9367
|
+
let password;
|
|
9368
|
+
if (changePass) {
|
|
9369
|
+
password = await prompt9.password({
|
|
9370
|
+
message: "New Password:",
|
|
9371
|
+
validate(value) {
|
|
9372
|
+
if (!value) {
|
|
9373
|
+
return "Required";
|
|
9374
|
+
}
|
|
9375
|
+
if (value.length < props.password.minLength) {
|
|
9376
|
+
return `Min length is ${props.password.minLength}`;
|
|
9377
|
+
}
|
|
9378
|
+
if (props.password.lowercase && value.toUpperCase() === value) {
|
|
9379
|
+
return `Should include lowercase characters`;
|
|
9380
|
+
}
|
|
9381
|
+
if (props.password.uppercase && value.toLowerCase() === value) {
|
|
9382
|
+
return `Should include uppercase characters`;
|
|
9383
|
+
}
|
|
9384
|
+
if (props.password.numbers && !/\d/.test(value)) {
|
|
9385
|
+
return `Should include numbers`;
|
|
9386
|
+
}
|
|
9387
|
+
if (props.password.symbols && !/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(value)) {
|
|
9388
|
+
return `Should include symbols`;
|
|
9389
|
+
}
|
|
9390
|
+
return;
|
|
9391
|
+
}
|
|
9392
|
+
});
|
|
9393
|
+
}
|
|
9394
|
+
let newGroups = [];
|
|
9395
|
+
if (props.groups.length > 0) {
|
|
9396
|
+
newGroups = await prompt9.multiSelect({
|
|
9397
|
+
message: "Groups:",
|
|
9398
|
+
required: false,
|
|
9399
|
+
initialValues: oldGroups,
|
|
9400
|
+
options: props.groups.map((g) => ({
|
|
9401
|
+
value: g
|
|
9402
|
+
}))
|
|
9403
|
+
});
|
|
9404
|
+
}
|
|
9405
|
+
await log20.task({
|
|
9406
|
+
initialMessage: "Updating user...",
|
|
9407
|
+
successMessage: "User updated.",
|
|
9408
|
+
errorMessage: "Failed updating user.",
|
|
9409
|
+
async task() {
|
|
9410
|
+
if (changePass && password) {
|
|
9411
|
+
await client.send(
|
|
9412
|
+
new AdminSetUserPasswordCommand2({
|
|
9413
|
+
UserPoolId: userPoolId,
|
|
9414
|
+
Username: username,
|
|
9415
|
+
Password: password,
|
|
9416
|
+
Permanent: true
|
|
9417
|
+
})
|
|
9418
|
+
);
|
|
9419
|
+
}
|
|
9420
|
+
const oldGroupSet = new Set(oldGroups);
|
|
9421
|
+
const newGroupSet = new Set(newGroups);
|
|
9422
|
+
const removedGroups = oldGroupSet.difference(newGroupSet);
|
|
9423
|
+
const addedGroups = newGroupSet.difference(oldGroupSet);
|
|
9424
|
+
for (const group of removedGroups) {
|
|
9425
|
+
await client.send(
|
|
9426
|
+
new AdminRemoveUserFromGroupCommand({
|
|
9427
|
+
UserPoolId: userPoolId,
|
|
9428
|
+
Username: username,
|
|
9429
|
+
GroupName: group
|
|
9430
|
+
})
|
|
9431
|
+
);
|
|
9432
|
+
}
|
|
9433
|
+
for (const group of addedGroups) {
|
|
9434
|
+
await client.send(
|
|
9435
|
+
new AdminAddUserToGroupCommand2({
|
|
9436
|
+
UserPoolId: userPoolId,
|
|
9437
|
+
Username: username,
|
|
9438
|
+
GroupName: group
|
|
9439
|
+
})
|
|
9440
|
+
);
|
|
9441
|
+
}
|
|
9442
|
+
}
|
|
9443
|
+
});
|
|
9192
9444
|
});
|
|
9193
9445
|
});
|
|
9194
9446
|
};
|
|
9195
9447
|
|
|
9196
9448
|
// src/cli/command/auth/user/index.ts
|
|
9197
|
-
var commands2 = [create];
|
|
9449
|
+
var commands2 = [create, update];
|
|
9198
9450
|
var user = (program2) => {
|
|
9199
9451
|
const command = program2.command("user").description(`Manage auth users`);
|
|
9200
9452
|
commands2.forEach((cb) => cb(command));
|
|
@@ -9208,7 +9460,7 @@ var auth = (program2) => {
|
|
|
9208
9460
|
};
|
|
9209
9461
|
|
|
9210
9462
|
// src/cli/command/bind.ts
|
|
9211
|
-
import { log as
|
|
9463
|
+
import { log as log21 } from "@awsless/clui";
|
|
9212
9464
|
import { constantCase as constantCase15 } from "change-case";
|
|
9213
9465
|
import { spawn } from "child_process";
|
|
9214
9466
|
var bind = (program2) => {
|
|
@@ -9231,9 +9483,9 @@ var bind = (program2) => {
|
|
|
9231
9483
|
env[name] = await value;
|
|
9232
9484
|
}
|
|
9233
9485
|
if (Object.keys(env).length > 0) {
|
|
9234
|
-
|
|
9486
|
+
log21.list("Bind Env", env);
|
|
9235
9487
|
} else {
|
|
9236
|
-
|
|
9488
|
+
log21.warning("No bindings available.");
|
|
9237
9489
|
}
|
|
9238
9490
|
const configList = opts.config ?? [];
|
|
9239
9491
|
const configs = {};
|
|
@@ -9241,7 +9493,7 @@ var bind = (program2) => {
|
|
|
9241
9493
|
configs[`CONFIG_${constantCase15(name)}`] = name;
|
|
9242
9494
|
}
|
|
9243
9495
|
if (configList.length ?? 0 > 0) {
|
|
9244
|
-
|
|
9496
|
+
log21.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
|
|
9245
9497
|
}
|
|
9246
9498
|
if (commands9.length === 0) {
|
|
9247
9499
|
return "No command to execute.";
|
|
@@ -9300,7 +9552,7 @@ var watchConfig = async (options, resolve, reject) => {
|
|
|
9300
9552
|
};
|
|
9301
9553
|
|
|
9302
9554
|
// src/cli/ui/complex/build-types.ts
|
|
9303
|
-
import { log as
|
|
9555
|
+
import { log as log22 } from "@awsless/clui";
|
|
9304
9556
|
|
|
9305
9557
|
// src/type-gen/generate.ts
|
|
9306
9558
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
@@ -9334,7 +9586,7 @@ var generateTypes = async (props) => {
|
|
|
9334
9586
|
// src/cli/ui/complex/build-types.ts
|
|
9335
9587
|
var buildTypes = async (props) => {
|
|
9336
9588
|
await generateTypes(props);
|
|
9337
|
-
|
|
9589
|
+
log22.step("Done generating type definition files.");
|
|
9338
9590
|
};
|
|
9339
9591
|
|
|
9340
9592
|
// src/cli/command/dev.ts
|
|
@@ -9358,7 +9610,7 @@ var dev = (program2) => {
|
|
|
9358
9610
|
};
|
|
9359
9611
|
|
|
9360
9612
|
// src/cli/command/resources.ts
|
|
9361
|
-
import { log as
|
|
9613
|
+
import { log as log23 } from "@awsless/clui";
|
|
9362
9614
|
import chalk4 from "chalk";
|
|
9363
9615
|
import wildstring5 from "wildstring";
|
|
9364
9616
|
var resources = (program2) => {
|
|
@@ -9401,9 +9653,9 @@ var resources = (program2) => {
|
|
|
9401
9653
|
continue;
|
|
9402
9654
|
}
|
|
9403
9655
|
}
|
|
9404
|
-
|
|
9656
|
+
log23.step(chalk4.magenta(stack.name));
|
|
9405
9657
|
if (stack.resources.length) {
|
|
9406
|
-
|
|
9658
|
+
log23.message(
|
|
9407
9659
|
stack.resources.map((r) => {
|
|
9408
9660
|
return [
|
|
9409
9661
|
//
|
|
@@ -9414,7 +9666,7 @@ var resources = (program2) => {
|
|
|
9414
9666
|
}).join("\n")
|
|
9415
9667
|
);
|
|
9416
9668
|
} else {
|
|
9417
|
-
|
|
9669
|
+
log23.message(color.line(`(empty)`));
|
|
9418
9670
|
}
|
|
9419
9671
|
}
|
|
9420
9672
|
});
|
|
@@ -9422,7 +9674,7 @@ var resources = (program2) => {
|
|
|
9422
9674
|
};
|
|
9423
9675
|
|
|
9424
9676
|
// src/cli/command/run.ts
|
|
9425
|
-
import { prompt as
|
|
9677
|
+
import { prompt as prompt10 } from "@awsless/clui";
|
|
9426
9678
|
import { DynamoDBClient, dynamoDBClient } from "@awsless/dynamodb";
|
|
9427
9679
|
import { iotClient, IoTDataPlaneClient } from "@awsless/iot";
|
|
9428
9680
|
import { LambdaClient as LambdaClient3, lambdaClient } from "@awsless/lambda";
|
|
@@ -9442,7 +9694,7 @@ var run = (program2) => {
|
|
|
9442
9694
|
return cmd.name === selected;
|
|
9443
9695
|
});
|
|
9444
9696
|
} else {
|
|
9445
|
-
command = await
|
|
9697
|
+
command = await prompt10.select({
|
|
9446
9698
|
message: "Pick the command you want to run:",
|
|
9447
9699
|
initialValue: commands9[0],
|
|
9448
9700
|
options: commands9.map((cmd) => ({
|
|
@@ -9497,7 +9749,7 @@ var pull = (program2) => {
|
|
|
9497
9749
|
};
|
|
9498
9750
|
|
|
9499
9751
|
// src/cli/command/state/push.ts
|
|
9500
|
-
import { prompt as
|
|
9752
|
+
import { prompt as prompt11 } from "@awsless/clui";
|
|
9501
9753
|
var push = (program2) => {
|
|
9502
9754
|
program2.command("push").description("Push the local state to the remote server").action(async () => {
|
|
9503
9755
|
await layout("state pull", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9507,7 +9759,7 @@ var push = (program2) => {
|
|
|
9507
9759
|
const accountId = await getAccountId(credentials, region);
|
|
9508
9760
|
const { app } = createApp({ appConfig, stackConfigs, accountId });
|
|
9509
9761
|
const { state: state2 } = await createWorkSpace({ credentials, region, accountId, profile });
|
|
9510
|
-
const ok = await
|
|
9762
|
+
const ok = await prompt11.confirm({
|
|
9511
9763
|
message: "Pushing up the local state might corrupt your remote state. Are you sure?",
|
|
9512
9764
|
initialValue: false
|
|
9513
9765
|
});
|
|
@@ -9521,7 +9773,7 @@ var push = (program2) => {
|
|
|
9521
9773
|
};
|
|
9522
9774
|
|
|
9523
9775
|
// src/cli/command/state/unlock.ts
|
|
9524
|
-
import { prompt as
|
|
9776
|
+
import { prompt as prompt12 } from "@awsless/clui";
|
|
9525
9777
|
var unlock = (program2) => {
|
|
9526
9778
|
program2.command("unlock").description("Release the lock that ensures sequential deployments").action(async () => {
|
|
9527
9779
|
await layout("state unlock", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9535,7 +9787,7 @@ var unlock = (program2) => {
|
|
|
9535
9787
|
if (!isLocked) {
|
|
9536
9788
|
return "No lock is exists.";
|
|
9537
9789
|
}
|
|
9538
|
-
const ok = await
|
|
9790
|
+
const ok = await prompt12.confirm({
|
|
9539
9791
|
message: "Releasing the lock that ensures sequential deployments might result in corrupt state if a deployment is still running. Are you sure?",
|
|
9540
9792
|
initialValue: false
|
|
9541
9793
|
});
|
|
@@ -9585,7 +9837,7 @@ var types = (program2) => {
|
|
|
9585
9837
|
};
|
|
9586
9838
|
|
|
9587
9839
|
// src/cli/command/domain/list.ts
|
|
9588
|
-
import { log as
|
|
9840
|
+
import { log as log24 } from "@awsless/clui";
|
|
9589
9841
|
var list2 = (program2) => {
|
|
9590
9842
|
program2.command("list").description("List all domains").action(async () => {
|
|
9591
9843
|
await layout("domain list", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9607,7 +9859,7 @@ var list2 = (program2) => {
|
|
|
9607
9859
|
});
|
|
9608
9860
|
await workspace.hydrate(app);
|
|
9609
9861
|
for (const zone of domainZones) {
|
|
9610
|
-
|
|
9862
|
+
log24.step(
|
|
9611
9863
|
[
|
|
9612
9864
|
//
|
|
9613
9865
|
color.label.green(await zone.name),
|
|
@@ -9615,14 +9867,14 @@ var list2 = (program2) => {
|
|
|
9615
9867
|
color.dim(await zone.id)
|
|
9616
9868
|
].join(" ")
|
|
9617
9869
|
);
|
|
9618
|
-
|
|
9870
|
+
log24.message((await zone.nameServers).join("\n"));
|
|
9619
9871
|
}
|
|
9620
9872
|
});
|
|
9621
9873
|
});
|
|
9622
9874
|
};
|
|
9623
9875
|
|
|
9624
9876
|
// src/cli/command/domain/deploy.ts
|
|
9625
|
-
import { log as
|
|
9877
|
+
import { log as log25 } from "@awsless/clui";
|
|
9626
9878
|
var deploy2 = (program2) => {
|
|
9627
9879
|
program2.command("deploy").description("Deploy the domain zones to AWS").action(async () => {
|
|
9628
9880
|
await layout("domain deploy", async ({ appConfig, stackConfigs }) => {
|
|
@@ -9642,7 +9894,7 @@ var deploy2 = (program2) => {
|
|
|
9642
9894
|
profile,
|
|
9643
9895
|
region
|
|
9644
9896
|
});
|
|
9645
|
-
await
|
|
9897
|
+
await log25.task({
|
|
9646
9898
|
initialMessage: "Deploying the domain zones to AWS...",
|
|
9647
9899
|
successMessage: "Done deploying the domain zones to AWS.",
|
|
9648
9900
|
errorMessage: "Failed deploying the domain zones to AWS.",
|
|
@@ -9651,7 +9903,7 @@ var deploy2 = (program2) => {
|
|
|
9651
9903
|
}
|
|
9652
9904
|
});
|
|
9653
9905
|
for (const zone of domainZones) {
|
|
9654
|
-
|
|
9906
|
+
log25.step(
|
|
9655
9907
|
[
|
|
9656
9908
|
//
|
|
9657
9909
|
color.label.green(await zone.name),
|
|
@@ -9659,7 +9911,7 @@ var deploy2 = (program2) => {
|
|
|
9659
9911
|
color.dim(await zone.id)
|
|
9660
9912
|
].join(" ")
|
|
9661
9913
|
);
|
|
9662
|
-
|
|
9914
|
+
log25.message((await zone.nameServers).join("\n"));
|
|
9663
9915
|
}
|
|
9664
9916
|
});
|
|
9665
9917
|
});
|
|
@@ -9678,7 +9930,7 @@ var domain = (program2) => {
|
|
|
9678
9930
|
|
|
9679
9931
|
// src/cli/command/logs.ts
|
|
9680
9932
|
import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
|
|
9681
|
-
import { log as
|
|
9933
|
+
import { log as log26 } from "@awsless/clui";
|
|
9682
9934
|
import { aws as aws30 } from "@terraforge/aws";
|
|
9683
9935
|
import chalk5 from "chalk";
|
|
9684
9936
|
import chunk2 from "chunk";
|
|
@@ -9720,7 +9972,7 @@ var logs = (program2) => {
|
|
|
9720
9972
|
process.once("SIGINT", () => {
|
|
9721
9973
|
abort.abort();
|
|
9722
9974
|
});
|
|
9723
|
-
const streams = await
|
|
9975
|
+
const streams = await log26.task({
|
|
9724
9976
|
initialMessage: "Connecting to the log stream...",
|
|
9725
9977
|
errorMessage: "Failed to connect to the log stream.",
|
|
9726
9978
|
async task(ctx) {
|
|
@@ -9777,7 +10029,7 @@ var formatLog = (level, date, group, message) => {
|
|
|
9777
10029
|
SYSTEM: chalk5.blue
|
|
9778
10030
|
};
|
|
9779
10031
|
const levelColor = levels[level] ?? chalk5.cyan;
|
|
9780
|
-
|
|
10032
|
+
log26.message(
|
|
9781
10033
|
[
|
|
9782
10034
|
[
|
|
9783
10035
|
//
|
|
@@ -9819,7 +10071,7 @@ var parseJsonLog = (message) => {
|
|
|
9819
10071
|
// src/cli/command/image/clear-cache.ts
|
|
9820
10072
|
import { CloudFrontClient as CloudFrontClient2, CreateInvalidationCommand as CreateInvalidationCommand2 } from "@aws-sdk/client-cloudfront";
|
|
9821
10073
|
import { DeleteObjectsCommand, ListObjectsV2Command, S3Client as S3Client3 } from "@aws-sdk/client-s3";
|
|
9822
|
-
import { Cancelled as Cancelled2, log as
|
|
10074
|
+
import { Cancelled as Cancelled2, log as log27, prompt as prompt13 } from "@awsless/clui";
|
|
9823
10075
|
import { randomUUID } from "crypto";
|
|
9824
10076
|
var clearCache = (program2) => {
|
|
9825
10077
|
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) => {
|
|
@@ -9835,7 +10087,7 @@ var clearCache = (program2) => {
|
|
|
9835
10087
|
}
|
|
9836
10088
|
return;
|
|
9837
10089
|
});
|
|
9838
|
-
stack = await
|
|
10090
|
+
stack = await prompt13.select({
|
|
9839
10091
|
message: "Select the stack:",
|
|
9840
10092
|
options: imageStacks.map((stack2) => ({
|
|
9841
10093
|
label: stack2.name,
|
|
@@ -9852,7 +10104,7 @@ var clearCache = (program2) => {
|
|
|
9852
10104
|
if (!names) {
|
|
9853
10105
|
throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
|
|
9854
10106
|
}
|
|
9855
|
-
name = await
|
|
10107
|
+
name = await prompt13.select({
|
|
9856
10108
|
message: "Select the image resource:",
|
|
9857
10109
|
options: names.map((name2) => ({
|
|
9858
10110
|
label: name2,
|
|
@@ -9860,7 +10112,7 @@ var clearCache = (program2) => {
|
|
|
9860
10112
|
}))
|
|
9861
10113
|
});
|
|
9862
10114
|
}
|
|
9863
|
-
const ok = await
|
|
10115
|
+
const ok = await prompt13.confirm({
|
|
9864
10116
|
message: `Are you sure you want to clear the cache`
|
|
9865
10117
|
});
|
|
9866
10118
|
if (!ok) {
|
|
@@ -9891,7 +10143,7 @@ var clearCache = (program2) => {
|
|
|
9891
10143
|
region: "us-east-1"
|
|
9892
10144
|
});
|
|
9893
10145
|
let totalDeleted = 0;
|
|
9894
|
-
await
|
|
10146
|
+
await log27.task({
|
|
9895
10147
|
initialMessage: "Clearing cache...",
|
|
9896
10148
|
successMessage: "Cache successfully cleared.",
|
|
9897
10149
|
task: async () => {
|
|
@@ -9953,7 +10205,7 @@ var image = (program2) => {
|
|
|
9953
10205
|
// src/cli/command/icon/clear-cache.ts
|
|
9954
10206
|
import { CloudFrontClient as CloudFrontClient3, CreateInvalidationCommand as CreateInvalidationCommand3 } from "@aws-sdk/client-cloudfront";
|
|
9955
10207
|
import { DeleteObjectsCommand as DeleteObjectsCommand2, ListObjectsV2Command as ListObjectsV2Command2, S3Client as S3Client4 } from "@aws-sdk/client-s3";
|
|
9956
|
-
import { Cancelled as Cancelled3, log as
|
|
10208
|
+
import { Cancelled as Cancelled3, log as log28, prompt as prompt14 } from "@awsless/clui";
|
|
9957
10209
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
9958
10210
|
var clearCache2 = (program2) => {
|
|
9959
10211
|
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) => {
|
|
@@ -9969,7 +10221,7 @@ var clearCache2 = (program2) => {
|
|
|
9969
10221
|
}
|
|
9970
10222
|
return;
|
|
9971
10223
|
});
|
|
9972
|
-
stack = await
|
|
10224
|
+
stack = await prompt14.select({
|
|
9973
10225
|
message: "Select the stack:",
|
|
9974
10226
|
options: iconStacks.map((stack2) => ({
|
|
9975
10227
|
label: stack2.name,
|
|
@@ -9986,7 +10238,7 @@ var clearCache2 = (program2) => {
|
|
|
9986
10238
|
if (!names) {
|
|
9987
10239
|
throw new ExpectedError(`No icon resources are defined in stack "${stack}".`);
|
|
9988
10240
|
}
|
|
9989
|
-
name = await
|
|
10241
|
+
name = await prompt14.select({
|
|
9990
10242
|
message: "Select the icon resource:",
|
|
9991
10243
|
options: names.map((name2) => ({
|
|
9992
10244
|
label: name2,
|
|
@@ -9994,7 +10246,7 @@ var clearCache2 = (program2) => {
|
|
|
9994
10246
|
}))
|
|
9995
10247
|
});
|
|
9996
10248
|
}
|
|
9997
|
-
const ok = await
|
|
10249
|
+
const ok = await prompt14.confirm({
|
|
9998
10250
|
message: `Are you sure you want to clear the cache`
|
|
9999
10251
|
});
|
|
10000
10252
|
if (!ok) {
|
|
@@ -10025,7 +10277,7 @@ var clearCache2 = (program2) => {
|
|
|
10025
10277
|
region: "us-east-1"
|
|
10026
10278
|
});
|
|
10027
10279
|
let totalDeleted = 0;
|
|
10028
|
-
await
|
|
10280
|
+
await log28.task({
|
|
10029
10281
|
initialMessage: "Clearing cache...",
|
|
10030
10282
|
successMessage: "Cache successfully cleared.",
|
|
10031
10283
|
task: async () => {
|