@awsless/awsless 0.0.638 → 0.0.640

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 CHANGED
@@ -1258,11 +1258,11 @@ var FunctionDefaultSchema = z15.object({
1258
1258
  // container
1259
1259
  warm: WarmSchema.default(0),
1260
1260
  vpc: VPCSchema.default(false),
1261
- log: LogSchema.default(true).transform((log32) => ({
1262
- retention: log32.retention ?? days(7),
1263
- level: "level" in log32 ? log32.level : "error",
1264
- system: "system" in log32 ? log32.system : "warn",
1265
- format: "format" in log32 ? log32.format : "json"
1261
+ log: LogSchema.default(true).transform((log34) => ({
1262
+ retention: log34.retention ?? days(7),
1263
+ level: "level" in log34 ? log34.level : "error",
1264
+ system: "system" in log34 ? log34.system : "warn",
1265
+ format: "format" in log34 ? log34.format : "json"
1266
1266
  })),
1267
1267
  timeout: TimeoutSchema.default("10 seconds"),
1268
1268
  memorySize: MemorySizeSchema.default("128 MB"),
@@ -1810,8 +1810,8 @@ var InstanceDefaultSchema = z25.object({
1810
1810
  permissions: PermissionsSchema2.optional(),
1811
1811
  healthCheck: HealthCheckSchema.optional(),
1812
1812
  // restartPolicy: RestartPolicySchema.default({ enabled: true }),
1813
- log: LogSchema2.default(true).transform((log32) => ({
1814
- retention: log32.retention ?? days4(7)
1813
+ log: LogSchema2.default(true).transform((log34) => ({
1814
+ retention: log34.retention ?? days4(7)
1815
1815
  }))
1816
1816
  }).default({});
1817
1817
 
@@ -1867,8 +1867,8 @@ var AppSchema = z28.object({
1867
1867
  [
1868
1868
  "Configure how your resources are handled when they have to be removed.",
1869
1869
  "",
1870
- "remove: Removes the underlying resource.",
1871
- "retain: Retains resources like S3 stores and DynamoDB tables. Removes everything else."
1870
+ "remove: Removes all underlying resources.",
1871
+ "retain: Retains the following resources: stores, tables, auth, searchs, and caches."
1872
1872
  ].join("\n")
1873
1873
  ),
1874
1874
  // stage: z
@@ -2976,7 +2976,7 @@ var authFeature = defineFeature({
2976
2976
  requireSymbols: props.password.symbols,
2977
2977
  temporaryPasswordValidityDays: toDays3(props.password.temporaryPasswordValidity)
2978
2978
  },
2979
- deletionProtection: ctx.appConfig.protect ? "ACTIVE" : "INACTIVE"
2979
+ deletionProtection: ctx.appConfig.removal === "retain" ? "ACTIVE" : "INACTIVE"
2980
2980
  },
2981
2981
  {
2982
2982
  retainOnDelete: ctx.appConfig.removal === "retain",
@@ -3062,32 +3062,40 @@ var cacheFeature = defineFeature({
3062
3062
  vpcId: ctx.shared.get("vpc", "id"),
3063
3063
  description: name
3064
3064
  });
3065
- const cache = new aws3.elasticache.ServerlessCache(group, "cache", {
3066
- name,
3067
- engine: "valkey",
3068
- dailySnapshotTime: "02:00",
3069
- majorEngineVersion: "8",
3070
- snapshotRetentionLimit: props.snapshotRetentionLimit,
3071
- securityGroupIds: [securityGroup.id],
3072
- subnetIds: ctx.shared.get("vpc", "private-subnets"),
3073
- cacheUsageLimits: [
3074
- {
3075
- dataStorage: props.minStorage || props.maxStorage ? [
3076
- {
3077
- minimum: props.minStorage && toGibibytes(props.minStorage),
3078
- maximum: props.maxStorage && toGibibytes(props.maxStorage),
3079
- unit: "GB"
3080
- }
3081
- ] : [],
3082
- ecpuPerSecond: props.minECPU || props.maxECPU ? [
3083
- {
3084
- minimum: props.minECPU,
3085
- maximum: props.maxECPU
3086
- }
3087
- ] : []
3088
- }
3089
- ]
3090
- });
3065
+ const cache = new aws3.elasticache.ServerlessCache(
3066
+ group,
3067
+ "cache",
3068
+ {
3069
+ name,
3070
+ engine: "valkey",
3071
+ dailySnapshotTime: "02:00",
3072
+ majorEngineVersion: "8",
3073
+ snapshotRetentionLimit: props.snapshotRetentionLimit,
3074
+ securityGroupIds: [securityGroup.id],
3075
+ subnetIds: ctx.shared.get("vpc", "private-subnets"),
3076
+ cacheUsageLimits: [
3077
+ {
3078
+ dataStorage: props.minStorage || props.maxStorage ? [
3079
+ {
3080
+ minimum: props.minStorage && toGibibytes(props.minStorage),
3081
+ maximum: props.maxStorage && toGibibytes(props.maxStorage),
3082
+ unit: "GB"
3083
+ }
3084
+ ] : [],
3085
+ ecpuPerSecond: props.minECPU || props.maxECPU ? [
3086
+ {
3087
+ minimum: props.minECPU,
3088
+ maximum: props.maxECPU
3089
+ }
3090
+ ] : []
3091
+ }
3092
+ ]
3093
+ },
3094
+ {
3095
+ retainOnDelete: ctx.appConfig.removal === "retain",
3096
+ import: ctx.import ? name : void 0
3097
+ }
3098
+ );
3091
3099
  const masterHost = cache.endpoint.pipe((v) => v.at(0).address);
3092
3100
  const masterPort = cache.endpoint.pipe((v) => v.at(0).port);
3093
3101
  new aws3.vpc.SecurityGroupIngressRule(group, "master-rule-ip-v4", {
@@ -5361,8 +5369,8 @@ var searchFeature = defineFeature({
5361
5369
  })
5362
5370
  },
5363
5371
  {
5364
- import: ctx.import ? name : void 0,
5365
- retainOnDelete: ctx.appConfig.removal === "retain"
5372
+ retainOnDelete: ctx.appConfig.removal === "retain",
5373
+ import: ctx.import ? name : void 0
5366
5374
  }
5367
5375
  );
5368
5376
  ctx.addEnv(`SEARCH_${constantCase9(ctx.stack.name)}_${constantCase9(id)}_DOMAIN`, openSearch.endpoint);
@@ -6865,7 +6873,7 @@ var buildExecutable = async (input, outputPath, architecture) => {
6865
6873
  }
6866
6874
  if (!result.success) {
6867
6875
  throw new ExpectedError(`Executable build failed:
6868
- ${result.logs?.map((log32) => log32.message).join("\n")}`);
6876
+ ${result.logs?.map((log34) => log34.message).join("\n")}`);
6869
6877
  }
6870
6878
  const file = await readFile4(filePath);
6871
6879
  return {
@@ -8908,13 +8916,85 @@ var list = (program2) => {
8908
8916
  });
8909
8917
  };
8910
8918
 
8919
+ // src/cli/command/config/export.ts
8920
+ import { log as log15 } from "@awsless/clui";
8921
+ var export_ = (program2) => {
8922
+ program2.command("export").description("Export all config values").action(async () => {
8923
+ await layout("export", async ({ appConfig }) => {
8924
+ const credentials = await getCredentials(appConfig.profile);
8925
+ const params = new SsmStore({
8926
+ credentials,
8927
+ appConfig
8928
+ });
8929
+ const values = await log15.task({
8930
+ initialMessage: "Exporting config parameters...",
8931
+ successMessage: "Done exporting config values.",
8932
+ errorMessage: "Failed exporting config values.",
8933
+ task() {
8934
+ return params.list();
8935
+ }
8936
+ });
8937
+ return "\n\n" + JSON.stringify(values);
8938
+ });
8939
+ });
8940
+ };
8941
+
8942
+ // src/cli/command/config/import.ts
8943
+ import { Cancelled as Cancelled2, log as log16, prompt as prompt5 } from "@awsless/clui";
8944
+ var import_ = (program2) => {
8945
+ program2.command("import").description("Import config values").action(async () => {
8946
+ await layout("import", async ({ appConfig }) => {
8947
+ const credentials = await getCredentials(appConfig.profile);
8948
+ const params = new SsmStore({
8949
+ credentials,
8950
+ appConfig
8951
+ });
8952
+ const json = await prompt5.text({
8953
+ message: "The config values in JSON format",
8954
+ validate: (value) => {
8955
+ try {
8956
+ JSON.parse(value);
8957
+ } catch {
8958
+ return "Invalid JSON";
8959
+ }
8960
+ return;
8961
+ }
8962
+ });
8963
+ const values = JSON.parse(json);
8964
+ log16.table({
8965
+ head: ["Name", "Value"],
8966
+ body: Object.entries(values)
8967
+ });
8968
+ const confirm = await prompt5.confirm({
8969
+ message: "Are you sure you want to import the config values?",
8970
+ initialValue: false
8971
+ });
8972
+ if (!confirm) {
8973
+ throw new Cancelled2();
8974
+ }
8975
+ await log16.task({
8976
+ initialMessage: "Importing config parameters...",
8977
+ successMessage: "Done importing config values.",
8978
+ errorMessage: "Failed importing config values.",
8979
+ async task() {
8980
+ for (const [name, value] of Object.entries(values)) {
8981
+ await params.set(name, value);
8982
+ }
8983
+ }
8984
+ });
8985
+ });
8986
+ });
8987
+ };
8988
+
8911
8989
  // src/cli/command/config/index.ts
8912
8990
  var commands = [
8913
8991
  //
8914
8992
  set,
8915
8993
  get,
8916
8994
  del,
8917
- list
8995
+ list,
8996
+ export_,
8997
+ import_
8918
8998
  ];
8919
8999
  var config = (program2) => {
8920
9000
  const command = program2.command("config").description(`Manage app config parameters`);
@@ -8922,13 +9002,13 @@ var config = (program2) => {
8922
9002
  };
8923
9003
 
8924
9004
  // src/cli/command/delete.ts
8925
- import { log as log15, prompt as prompt5 } from "@awsless/clui";
9005
+ import { log as log17, prompt as prompt6 } from "@awsless/clui";
8926
9006
  import wildstring2 from "wildstring";
8927
9007
  var del2 = (program2) => {
8928
9008
  program2.command("delete").argument("[stacks...]", "Optionally filter stacks to delete").description("Delete your app from AWS").action(async (filters) => {
8929
9009
  await layout("delete", async ({ appConfig, stackConfigs }) => {
8930
9010
  if (appConfig.protect) {
8931
- log15.warning("Your app is protected against deletion.");
9011
+ log17.warning("Your app is protected against deletion.");
8932
9012
  return "Disable the protect flag and try again.";
8933
9013
  }
8934
9014
  const region = appConfig.region;
@@ -8948,7 +9028,7 @@ var del2 = (program2) => {
8948
9028
  if (!process.env.SKIP_PROMPT) {
8949
9029
  const deployAll = filters.length === 0;
8950
9030
  const deploySingle = filters.length === 1;
8951
- const ok = await prompt5.confirm({
9031
+ const ok = await prompt6.confirm({
8952
9032
  message: deployAll ? `Are you sure you want to ${color.error("delete")} ${color.warning("all")} stacks?` : deploySingle ? `Are you sure you want to ${color.error("delete")} the ${formattedFilter} stack?` : `Are you sure you want to ${color.error(
8953
9033
  "delete"
8954
9034
  )} the [ ${formattedFilter} ] stacks?`
@@ -8976,11 +9056,11 @@ var del2 = (program2) => {
8976
9056
  };
8977
9057
 
8978
9058
  // src/cli/command/deploy.ts
8979
- import { log as log18, prompt as prompt7 } from "@awsless/clui";
9059
+ import { log as log20, prompt as prompt8 } from "@awsless/clui";
8980
9060
  import wildstring4 from "wildstring";
8981
9061
 
8982
9062
  // src/cli/ui/complex/run-tests.ts
8983
- import { log as log16 } from "@awsless/clui";
9063
+ import { log as log18 } from "@awsless/clui";
8984
9064
  import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
8985
9065
  import { join as join18 } from "path";
8986
9066
  import wildstring3 from "wildstring";
@@ -9098,10 +9178,10 @@ var startTest = async (props) => {
9098
9178
  tests.push(entry);
9099
9179
  if ("task" in test2) {
9100
9180
  const task2 = test2.task;
9101
- for (const log32 of task2.logs ?? []) {
9181
+ for (const log34 of task2.logs ?? []) {
9102
9182
  entry.logs.push({
9103
- time: log32.time,
9104
- text: log32.content
9183
+ time: log34.time,
9184
+ text: log34.content
9105
9185
  });
9106
9186
  }
9107
9187
  }
@@ -9159,7 +9239,7 @@ var formatResult = (props) => {
9159
9239
  var logTestLogs = (event) => {
9160
9240
  for (const test2 of event.tests) {
9161
9241
  if (test2.logs.length > 0) {
9162
- log16.message(
9242
+ log18.message(
9163
9243
  [
9164
9244
  color.info.bold.inverse(" LOGS "),
9165
9245
  color.dim(icon.arrow.right),
@@ -9169,7 +9249,7 @@ var logTestLogs = (event) => {
9169
9249
  ].join(" "),
9170
9250
  color.line(icon.dot)
9171
9251
  );
9172
- log16.message(test2.logs.map((log32) => log32.text).join("\n"));
9252
+ log18.message(test2.logs.map((log34) => log34.text).join("\n"));
9173
9253
  }
9174
9254
  }
9175
9255
  };
@@ -9193,7 +9273,7 @@ var logTestError = (index, event, test2, error) => {
9193
9273
  message,
9194
9274
  comment.length > 0 ? color.dim(`//${comment}`) : ""
9195
9275
  ].join(" ");
9196
- log16.error(
9276
+ log18.error(
9197
9277
  [
9198
9278
  //
9199
9279
  color.error.inverse.bold(` FAIL `),
@@ -9228,7 +9308,7 @@ var runTest = async (stack, dir, filters, workspace, opts) => {
9228
9308
  const raw = await readFile5(file, { encoding: "utf8" });
9229
9309
  const data = parse4(raw);
9230
9310
  if (data.fingerprint === fingerprint) {
9231
- log16.step(
9311
+ log18.step(
9232
9312
  formatResult({
9233
9313
  stack,
9234
9314
  cached: true,
@@ -9243,7 +9323,7 @@ var runTest = async (stack, dir, filters, workspace, opts) => {
9243
9323
  }
9244
9324
  }
9245
9325
  }
9246
- const result = await log16.task({
9326
+ const result = await log18.task({
9247
9327
  initialMessage: `Run tests for the ${color.info(stack)} stack`,
9248
9328
  errorMessage: `Running tests for the ${color.info(stack)} stack failed`,
9249
9329
  async task(ctx) {
@@ -9297,10 +9377,10 @@ var runTests = async (tests, stackFilters = [], testFilters = [], opts) => {
9297
9377
  };
9298
9378
 
9299
9379
  // src/cli/ui/complex/show-warnings.ts
9300
- import { log as log17, prompt as prompt6 } from "@awsless/clui";
9380
+ import { log as log19, prompt as prompt7 } from "@awsless/clui";
9301
9381
  var showWarnings = async (warnings) => {
9302
9382
  for (const warning of warnings) {
9303
- log17.warning(
9383
+ log19.warning(
9304
9384
  [
9305
9385
  //
9306
9386
  color.warning("Warning!"),
@@ -9309,7 +9389,7 @@ var showWarnings = async (warnings) => {
9309
9389
  );
9310
9390
  }
9311
9391
  if (warnings.length > 0) {
9312
- const result = await prompt6.confirm({
9392
+ const result = await prompt7.confirm({
9313
9393
  initialValue: false,
9314
9394
  message: `Some issues remain unresolved. If you continue, your app may not function correctly. Do you still want to proceed?`
9315
9395
  });
@@ -9346,7 +9426,7 @@ var deploy = (program2) => {
9346
9426
  if (!process.env.SKIP_PROMPT) {
9347
9427
  const deployAll = filters.length === 0;
9348
9428
  const deploySingle = filters.length === 1;
9349
- const ok = await prompt7.confirm({
9429
+ const ok = await prompt8.confirm({
9350
9430
  message: deployAll ? `Are you sure you want to deploy ${color.warning("all")} stacks?` : deploySingle ? `Are you sure you want to deploy the ${formattedFilter} stack?` : `Are you sure you want to deploy the [ ${formattedFilter} ] stacks?`
9351
9431
  });
9352
9432
  if (!ok) {
@@ -9368,7 +9448,7 @@ var deploy = (program2) => {
9368
9448
  accountId,
9369
9449
  region
9370
9450
  });
9371
- await log18.task({
9451
+ await log20.task({
9372
9452
  initialMessage: "Deploying the stacks to AWS",
9373
9453
  successMessage: "Done deploying the stacks to AWS.",
9374
9454
  async task() {
@@ -9392,7 +9472,7 @@ import {
9392
9472
  CognitoIdentityProviderClient,
9393
9473
  UsernameExistsException
9394
9474
  } from "@aws-sdk/client-cognito-identity-provider";
9395
- import { log as log19, prompt as prompt8 } from "@awsless/clui";
9475
+ import { log as log21, prompt as prompt9 } from "@awsless/clui";
9396
9476
  var create = (program2) => {
9397
9477
  program2.command("create").description("Create an user in your userpool").action(async () => {
9398
9478
  await layout("auth user create", async ({ appConfig, stackConfigs }) => {
@@ -9403,7 +9483,7 @@ var create = (program2) => {
9403
9483
  if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
9404
9484
  throw new ExpectedError("No auth resources are defined.");
9405
9485
  }
9406
- const name = await prompt8.select({
9486
+ const name = await prompt9.select({
9407
9487
  message: "Select the auth userpool:",
9408
9488
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
9409
9489
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -9412,7 +9492,7 @@ var create = (program2) => {
9412
9492
  }))
9413
9493
  });
9414
9494
  const props = appConfig.defaults.auth[name];
9415
- const userPoolId = await log19.task({
9495
+ const userPoolId = await log21.task({
9416
9496
  initialMessage: "Loading auth userpool...",
9417
9497
  successMessage: "Done loading auth userpool.",
9418
9498
  errorMessage: "Failed loading auth userpool.",
@@ -9431,7 +9511,7 @@ var create = (program2) => {
9431
9511
  }
9432
9512
  }
9433
9513
  });
9434
- const username = await prompt8.text({
9514
+ const username = await prompt9.text({
9435
9515
  message: "Username:",
9436
9516
  validate(value) {
9437
9517
  if (!value) {
@@ -9440,7 +9520,7 @@ var create = (program2) => {
9440
9520
  return;
9441
9521
  }
9442
9522
  });
9443
- const password = await prompt8.password({
9523
+ const password = await prompt9.password({
9444
9524
  message: "Password:",
9445
9525
  validate(value) {
9446
9526
  if (!value) {
@@ -9466,7 +9546,7 @@ var create = (program2) => {
9466
9546
  });
9467
9547
  let groups = [];
9468
9548
  if (props.groups.length > 0) {
9469
- groups = await prompt8.multiSelect({
9549
+ groups = await prompt9.multiSelect({
9470
9550
  message: "Groups:",
9471
9551
  required: false,
9472
9552
  options: props.groups.map((g) => ({
@@ -9478,7 +9558,7 @@ var create = (program2) => {
9478
9558
  region,
9479
9559
  credentials
9480
9560
  });
9481
- await log19.task({
9561
+ await log21.task({
9482
9562
  initialMessage: "Creating user...",
9483
9563
  successMessage: "User created.",
9484
9564
  errorMessage: "Failed creating user.",
@@ -9532,7 +9612,7 @@ import {
9532
9612
  CognitoIdentityProviderClient as CognitoIdentityProviderClient2,
9533
9613
  UserNotFoundException
9534
9614
  } from "@aws-sdk/client-cognito-identity-provider";
9535
- import { log as log20, prompt as prompt9 } from "@awsless/clui";
9615
+ import { log as log22, prompt as prompt10 } from "@awsless/clui";
9536
9616
  var update = (program2) => {
9537
9617
  program2.command("update").description("Update an user in your userpool").action(async () => {
9538
9618
  await layout("auth user update", async ({ appConfig, stackConfigs }) => {
@@ -9543,7 +9623,7 @@ var update = (program2) => {
9543
9623
  if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
9544
9624
  throw new ExpectedError("No auth resources are defined.");
9545
9625
  }
9546
- const name = await prompt9.select({
9626
+ const name = await prompt10.select({
9547
9627
  message: "Select the auth userpool:",
9548
9628
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
9549
9629
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -9552,7 +9632,7 @@ var update = (program2) => {
9552
9632
  }))
9553
9633
  });
9554
9634
  const props = appConfig.defaults.auth[name];
9555
- const userPoolId = await log20.task({
9635
+ const userPoolId = await log22.task({
9556
9636
  initialMessage: "Loading auth userpool...",
9557
9637
  successMessage: "Done loading auth userpool.",
9558
9638
  errorMessage: "Failed loading auth userpool.",
@@ -9571,7 +9651,7 @@ var update = (program2) => {
9571
9651
  }
9572
9652
  }
9573
9653
  });
9574
- const username = await prompt9.text({
9654
+ const username = await prompt10.text({
9575
9655
  message: "Username:",
9576
9656
  validate(value) {
9577
9657
  if (!value) {
@@ -9584,7 +9664,7 @@ var update = (program2) => {
9584
9664
  region,
9585
9665
  credentials
9586
9666
  });
9587
- const oldGroups = await log20.task({
9667
+ const oldGroups = await log22.task({
9588
9668
  initialMessage: "Fetching user info...",
9589
9669
  successMessage: "Done fetching user info.",
9590
9670
  errorMessage: `Failed fetching user info.`,
@@ -9618,13 +9698,13 @@ var update = (program2) => {
9618
9698
  return groups;
9619
9699
  }
9620
9700
  });
9621
- const changePass = await prompt9.confirm({
9701
+ const changePass = await prompt10.confirm({
9622
9702
  message: `Do you wanna change the user's password`,
9623
9703
  initialValue: false
9624
9704
  });
9625
9705
  let password;
9626
9706
  if (changePass) {
9627
- password = await prompt9.password({
9707
+ password = await prompt10.password({
9628
9708
  message: "New Password:",
9629
9709
  validate(value) {
9630
9710
  if (!value) {
@@ -9651,7 +9731,7 @@ var update = (program2) => {
9651
9731
  }
9652
9732
  let newGroups = [];
9653
9733
  if (props.groups.length > 0) {
9654
- newGroups = await prompt9.multiSelect({
9734
+ newGroups = await prompt10.multiSelect({
9655
9735
  message: "Groups:",
9656
9736
  required: false,
9657
9737
  initialValues: oldGroups,
@@ -9660,7 +9740,7 @@ var update = (program2) => {
9660
9740
  }))
9661
9741
  });
9662
9742
  }
9663
- await log20.task({
9743
+ await log22.task({
9664
9744
  initialMessage: "Updating user...",
9665
9745
  successMessage: "User updated.",
9666
9746
  errorMessage: "Failed updating user.",
@@ -9709,7 +9789,7 @@ import {
9709
9789
  CognitoIdentityProviderClient as CognitoIdentityProviderClient3,
9710
9790
  UserNotFoundException as UserNotFoundException2
9711
9791
  } from "@aws-sdk/client-cognito-identity-provider";
9712
- import { Cancelled as Cancelled2, log as log21, prompt as prompt10 } from "@awsless/clui";
9792
+ import { Cancelled as Cancelled3, log as log23, prompt as prompt11 } from "@awsless/clui";
9713
9793
  var del3 = (program2) => {
9714
9794
  program2.command("delete").description("Delete an user from your userpool").action(async () => {
9715
9795
  await layout("auth user delete", async ({ appConfig, stackConfigs }) => {
@@ -9720,7 +9800,7 @@ var del3 = (program2) => {
9720
9800
  if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
9721
9801
  throw new ExpectedError("No auth resources are defined.");
9722
9802
  }
9723
- const name = await prompt10.select({
9803
+ const name = await prompt11.select({
9724
9804
  message: "Select the auth userpool:",
9725
9805
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
9726
9806
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -9728,7 +9808,7 @@ var del3 = (program2) => {
9728
9808
  value: name2
9729
9809
  }))
9730
9810
  });
9731
- const userPoolId = await log21.task({
9811
+ const userPoolId = await log23.task({
9732
9812
  initialMessage: "Loading auth userpool...",
9733
9813
  successMessage: "Done loading auth userpool.",
9734
9814
  errorMessage: "Failed loading auth userpool.",
@@ -9747,7 +9827,7 @@ var del3 = (program2) => {
9747
9827
  }
9748
9828
  }
9749
9829
  });
9750
- const username = await prompt10.text({
9830
+ const username = await prompt11.text({
9751
9831
  message: "Username:",
9752
9832
  validate(value) {
9753
9833
  if (!value) {
@@ -9756,18 +9836,18 @@ var del3 = (program2) => {
9756
9836
  return;
9757
9837
  }
9758
9838
  });
9759
- const confirm = await prompt10.confirm({
9839
+ const confirm = await prompt11.confirm({
9760
9840
  message: "Are you sure you want to delete this user?",
9761
9841
  initialValue: false
9762
9842
  });
9763
9843
  if (!confirm) {
9764
- throw new Cancelled2();
9844
+ throw new Cancelled3();
9765
9845
  }
9766
9846
  const client = new CognitoIdentityProviderClient3({
9767
9847
  region,
9768
9848
  credentials
9769
9849
  });
9770
- await log21.task({
9850
+ await log23.task({
9771
9851
  initialMessage: "Deleting user...",
9772
9852
  successMessage: "User deleted.",
9773
9853
  errorMessage: "Failed deleting user.",
@@ -9806,7 +9886,7 @@ var auth = (program2) => {
9806
9886
  };
9807
9887
 
9808
9888
  // src/cli/command/bind.ts
9809
- import { log as log22 } from "@awsless/clui";
9889
+ import { log as log24 } from "@awsless/clui";
9810
9890
  import chalk4 from "chalk";
9811
9891
  import { constantCase as constantCase15 } from "change-case";
9812
9892
  var bind = (program2) => {
@@ -9828,9 +9908,9 @@ var bind = (program2) => {
9828
9908
  env[name] = await value;
9829
9909
  }
9830
9910
  if (Object.keys(env).length > 0) {
9831
- log22.list("Bind Env", env);
9911
+ log24.list("Bind Env", env);
9832
9912
  } else {
9833
- log22.warning("No bindings available.");
9913
+ log24.warning("No bindings available.");
9834
9914
  }
9835
9915
  const configList = opts.config ?? [];
9836
9916
  const configs = {};
@@ -9838,7 +9918,7 @@ var bind = (program2) => {
9838
9918
  configs[`CONFIG_${constantCase15(name)}`] = name;
9839
9919
  }
9840
9920
  if (configList.length ?? 0 > 0) {
9841
- log22.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
9921
+ log24.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
9842
9922
  }
9843
9923
  if (commands11.length === 0) {
9844
9924
  return "No command to execute.";
@@ -9901,7 +9981,7 @@ var watchConfig = async (options, resolve, reject) => {
9901
9981
  };
9902
9982
 
9903
9983
  // src/cli/ui/complex/build-types.ts
9904
- import { log as log23 } from "@awsless/clui";
9984
+ import { log as log25 } from "@awsless/clui";
9905
9985
 
9906
9986
  // src/type-gen/generate.ts
9907
9987
  import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
@@ -9935,7 +10015,7 @@ var generateTypes = async (props) => {
9935
10015
  // src/cli/ui/complex/build-types.ts
9936
10016
  var buildTypes = async (props) => {
9937
10017
  await generateTypes(props);
9938
- log23.step("Done generating type definition files.");
10018
+ log25.step("Done generating type definition files.");
9939
10019
  };
9940
10020
 
9941
10021
  // src/cli/command/dev.ts
@@ -9961,7 +10041,7 @@ var dev = (program2) => {
9961
10041
  };
9962
10042
 
9963
10043
  // src/cli/command/resources.ts
9964
- import { log as log24 } from "@awsless/clui";
10044
+ import { log as log26 } from "@awsless/clui";
9965
10045
  import chalk5 from "chalk";
9966
10046
  import wildstring5 from "wildstring";
9967
10047
  var resources = (program2) => {
@@ -10003,9 +10083,9 @@ var resources = (program2) => {
10003
10083
  continue;
10004
10084
  }
10005
10085
  }
10006
- log24.step(chalk5.magenta(stack.name));
10086
+ log26.step(chalk5.magenta(stack.name));
10007
10087
  if (stack.resources.length) {
10008
- log24.message(
10088
+ log26.message(
10009
10089
  stack.resources.map((r) => {
10010
10090
  return [
10011
10091
  //
@@ -10016,7 +10096,7 @@ var resources = (program2) => {
10016
10096
  }).join("\n")
10017
10097
  );
10018
10098
  } else {
10019
- log24.message(color.line(`(empty)`));
10099
+ log26.message(color.line(`(empty)`));
10020
10100
  }
10021
10101
  }
10022
10102
  });
@@ -10024,7 +10104,7 @@ var resources = (program2) => {
10024
10104
  };
10025
10105
 
10026
10106
  // src/cli/command/run.ts
10027
- import { prompt as prompt11 } from "@awsless/clui";
10107
+ import { prompt as prompt12 } from "@awsless/clui";
10028
10108
  import { DynamoDBClient, dynamoDBClient } from "@awsless/dynamodb";
10029
10109
  import { iotClient, IoTDataPlaneClient } from "@awsless/iot";
10030
10110
  import { LambdaClient as LambdaClient3, lambdaClient } from "@awsless/lambda";
@@ -10044,7 +10124,7 @@ var run = (program2) => {
10044
10124
  return cmd.name === selected;
10045
10125
  });
10046
10126
  } else {
10047
- command = await prompt11.select({
10127
+ command = await prompt12.select({
10048
10128
  message: "Pick the command you want to run:",
10049
10129
  initialValue: commands11[0],
10050
10130
  options: commands11.map((cmd) => ({
@@ -10098,7 +10178,7 @@ var pull = (program2) => {
10098
10178
  };
10099
10179
 
10100
10180
  // src/cli/command/state/push.ts
10101
- import { prompt as prompt12 } from "@awsless/clui";
10181
+ import { prompt as prompt13 } from "@awsless/clui";
10102
10182
  var push = (program2) => {
10103
10183
  program2.command("push").description("Push the local state to the remote server").action(async () => {
10104
10184
  await layout("state pull", async ({ appConfig, stackConfigs }) => {
@@ -10108,7 +10188,7 @@ var push = (program2) => {
10108
10188
  const accountId = await getAccountId(credentials, region);
10109
10189
  const { app } = createApp({ appConfig, stackConfigs, accountId });
10110
10190
  const { state: state2 } = await createWorkSpace({ credentials, region, accountId });
10111
- const ok = await prompt12.confirm({
10191
+ const ok = await prompt13.confirm({
10112
10192
  message: "Pushing up the local state might corrupt your remote state. Are you sure?",
10113
10193
  initialValue: false
10114
10194
  });
@@ -10122,7 +10202,7 @@ var push = (program2) => {
10122
10202
  };
10123
10203
 
10124
10204
  // src/cli/command/state/unlock.ts
10125
- import { prompt as prompt13 } from "@awsless/clui";
10205
+ import { prompt as prompt14 } from "@awsless/clui";
10126
10206
  var unlock = (program2) => {
10127
10207
  program2.command("unlock").description("Release the lock that ensures sequential deployments").action(async () => {
10128
10208
  await layout("state unlock", async ({ appConfig, stackConfigs }) => {
@@ -10136,7 +10216,7 @@ var unlock = (program2) => {
10136
10216
  if (!isLocked) {
10137
10217
  return "No lock is exists.";
10138
10218
  }
10139
- const ok = await prompt13.confirm({
10219
+ const ok = await prompt14.confirm({
10140
10220
  message: "Releasing the lock that ensures sequential deployments might result in corrupt state if a deployment is still running. Are you sure?",
10141
10221
  initialValue: false
10142
10222
  });
@@ -10186,7 +10266,7 @@ var types = (program2) => {
10186
10266
  };
10187
10267
 
10188
10268
  // src/cli/command/domain/list.ts
10189
- import { log as log25 } from "@awsless/clui";
10269
+ import { log as log27 } from "@awsless/clui";
10190
10270
  var list2 = (program2) => {
10191
10271
  program2.command("list").description("List all domains").action(async () => {
10192
10272
  await layout("domain list", async ({ appConfig, stackConfigs }) => {
@@ -10207,7 +10287,7 @@ var list2 = (program2) => {
10207
10287
  });
10208
10288
  await workspace.hydrate(app);
10209
10289
  for (const zone of domainZones) {
10210
- log25.step(
10290
+ log27.step(
10211
10291
  [
10212
10292
  //
10213
10293
  color.label.green(await zone.name),
@@ -10215,14 +10295,14 @@ var list2 = (program2) => {
10215
10295
  color.dim(await zone.id)
10216
10296
  ].join(" ")
10217
10297
  );
10218
- log25.message((await zone.nameServers).join("\n"));
10298
+ log27.message((await zone.nameServers).join("\n"));
10219
10299
  }
10220
10300
  });
10221
10301
  });
10222
10302
  };
10223
10303
 
10224
10304
  // src/cli/command/domain/deploy.ts
10225
- import { log as log26 } from "@awsless/clui";
10305
+ import { log as log28 } from "@awsless/clui";
10226
10306
  var deploy2 = (program2) => {
10227
10307
  program2.command("deploy").description("Deploy the domain zones to AWS").action(async () => {
10228
10308
  await layout("domain deploy", async ({ appConfig, stackConfigs }) => {
@@ -10241,7 +10321,7 @@ var deploy2 = (program2) => {
10241
10321
  accountId,
10242
10322
  region
10243
10323
  });
10244
- await log26.task({
10324
+ await log28.task({
10245
10325
  initialMessage: "Deploying the domain zones to AWS...",
10246
10326
  successMessage: "Done deploying the domain zones to AWS.",
10247
10327
  errorMessage: "Failed deploying the domain zones to AWS.",
@@ -10250,7 +10330,7 @@ var deploy2 = (program2) => {
10250
10330
  }
10251
10331
  });
10252
10332
  for (const zone of domainZones) {
10253
- log26.step(
10333
+ log28.step(
10254
10334
  [
10255
10335
  //
10256
10336
  color.label.green(await zone.name),
@@ -10258,7 +10338,7 @@ var deploy2 = (program2) => {
10258
10338
  color.dim(await zone.id)
10259
10339
  ].join(" ")
10260
10340
  );
10261
- log26.message((await zone.nameServers).join("\n"));
10341
+ log28.message((await zone.nameServers).join("\n"));
10262
10342
  }
10263
10343
  });
10264
10344
  });
@@ -10277,7 +10357,7 @@ var domain = (program2) => {
10277
10357
 
10278
10358
  // src/cli/command/logs.ts
10279
10359
  import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
10280
- import { log as log27 } from "@awsless/clui";
10360
+ import { log as log29 } from "@awsless/clui";
10281
10361
  import { aws as aws30 } from "@terraforge/aws";
10282
10362
  import chalk6 from "chalk";
10283
10363
  import chunk2 from "chunk";
@@ -10318,7 +10398,7 @@ var logs = (program2) => {
10318
10398
  process.once("SIGINT", () => {
10319
10399
  controller.abort();
10320
10400
  });
10321
- const streams = await log27.task({
10401
+ const streams = await log29.task({
10322
10402
  initialMessage: "Connecting to the log stream...",
10323
10403
  errorMessage: "Failed to connect to the log stream.",
10324
10404
  async task(ctx) {
@@ -10375,7 +10455,7 @@ var formatLog = (level, date, group, message) => {
10375
10455
  SYSTEM: chalk6.blue
10376
10456
  };
10377
10457
  const levelColor = levels[level] ?? chalk6.cyan;
10378
- log27.message(
10458
+ log29.message(
10379
10459
  [
10380
10460
  [
10381
10461
  //
@@ -10416,7 +10496,7 @@ var parseJsonLog = (message) => {
10416
10496
 
10417
10497
  // src/cli/command/image/clear-cache.ts
10418
10498
  import { DeleteObjectsCommand, ListObjectsV2Command, S3Client as S3Client3 } from "@aws-sdk/client-s3";
10419
- import { Cancelled as Cancelled3, log as log28, prompt as prompt14 } from "@awsless/clui";
10499
+ import { Cancelled as Cancelled4, log as log30, prompt as prompt15 } from "@awsless/clui";
10420
10500
  import { CloudFrontClient as CloudFrontClient2 } from "@aws-sdk/client-cloudfront";
10421
10501
  var clearCache = (program2) => {
10422
10502
  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) => {
@@ -10432,7 +10512,7 @@ var clearCache = (program2) => {
10432
10512
  }
10433
10513
  return;
10434
10514
  });
10435
- stack = await prompt14.select({
10515
+ stack = await prompt15.select({
10436
10516
  message: "Select the stack:",
10437
10517
  options: imageStacks.map((stack2) => ({
10438
10518
  label: stack2.name,
@@ -10449,7 +10529,7 @@ var clearCache = (program2) => {
10449
10529
  if (!names) {
10450
10530
  throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
10451
10531
  }
10452
- name = await prompt14.select({
10532
+ name = await prompt15.select({
10453
10533
  message: "Select the image resource:",
10454
10534
  options: names.map((name2) => ({
10455
10535
  label: name2,
@@ -10457,11 +10537,11 @@ var clearCache = (program2) => {
10457
10537
  }))
10458
10538
  });
10459
10539
  }
10460
- const ok = await prompt14.confirm({
10540
+ const ok = await prompt15.confirm({
10461
10541
  message: `Are you sure you want to clear the cache`
10462
10542
  });
10463
10543
  if (!ok) {
10464
- throw new Cancelled3();
10544
+ throw new Cancelled4();
10465
10545
  }
10466
10546
  const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
10467
10547
  const { workspace } = await createWorkSpace({
@@ -10487,7 +10567,7 @@ var clearCache = (program2) => {
10487
10567
  region
10488
10568
  });
10489
10569
  let totalDeleted = 0;
10490
- await log28.task({
10570
+ await log30.task({
10491
10571
  initialMessage: "Clearing cache...",
10492
10572
  successMessage: "Cache successfully cleared.",
10493
10573
  task: async () => {
@@ -10540,7 +10620,7 @@ var image = (program2) => {
10540
10620
 
10541
10621
  // src/cli/command/icon/clear-cache.ts
10542
10622
  import { DeleteObjectsCommand as DeleteObjectsCommand2, ListObjectsV2Command as ListObjectsV2Command2, S3Client as S3Client4 } from "@aws-sdk/client-s3";
10543
- import { Cancelled as Cancelled4, log as log29, prompt as prompt15 } from "@awsless/clui";
10623
+ import { Cancelled as Cancelled5, log as log31, prompt as prompt16 } from "@awsless/clui";
10544
10624
  import { CloudFrontClient as CloudFrontClient3 } from "@aws-sdk/client-cloudfront";
10545
10625
  var clearCache2 = (program2) => {
10546
10626
  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) => {
@@ -10556,7 +10636,7 @@ var clearCache2 = (program2) => {
10556
10636
  }
10557
10637
  return;
10558
10638
  });
10559
- stack = await prompt15.select({
10639
+ stack = await prompt16.select({
10560
10640
  message: "Select the stack:",
10561
10641
  options: iconStacks.map((stack2) => ({
10562
10642
  label: stack2.name,
@@ -10573,7 +10653,7 @@ var clearCache2 = (program2) => {
10573
10653
  if (!names) {
10574
10654
  throw new ExpectedError(`No icon resources are defined in stack "${stack}".`);
10575
10655
  }
10576
- name = await prompt15.select({
10656
+ name = await prompt16.select({
10577
10657
  message: "Select the icon resource:",
10578
10658
  options: names.map((name2) => ({
10579
10659
  label: name2,
@@ -10581,11 +10661,11 @@ var clearCache2 = (program2) => {
10581
10661
  }))
10582
10662
  });
10583
10663
  }
10584
- const ok = await prompt15.confirm({
10664
+ const ok = await prompt16.confirm({
10585
10665
  message: `Are you sure you want to clear the cache`
10586
10666
  });
10587
10667
  if (!ok) {
10588
- throw new Cancelled4();
10668
+ throw new Cancelled5();
10589
10669
  }
10590
10670
  const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
10591
10671
  const { workspace } = await createWorkSpace({
@@ -10611,7 +10691,7 @@ var clearCache2 = (program2) => {
10611
10691
  region
10612
10692
  });
10613
10693
  let totalDeleted = 0;
10614
- await log29.task({
10694
+ await log31.task({
10615
10695
  initialMessage: "Clearing cache...",
10616
10696
  successMessage: "Cache successfully cleared.",
10617
10697
  task: async () => {
@@ -10663,7 +10743,7 @@ var icon2 = (program2) => {
10663
10743
  };
10664
10744
 
10665
10745
  // src/cli/command/cron/invoke.ts
10666
- import { log as log30, prompt as prompt16 } from "@awsless/clui";
10746
+ import { log as log32, prompt as prompt17 } from "@awsless/clui";
10667
10747
  import { invoke as invokeLambda, LambdaClient as LambdaClient4 } from "@awsless/lambda";
10668
10748
  var invoke = (program2) => {
10669
10749
  program2.command("invoke").description("Invoke a cronjob").argument("[stack]", "The stack name of the cronjob").argument("[name]", "The name of the cronjob").action(async (stack, name) => {
@@ -10681,7 +10761,7 @@ var invoke = (program2) => {
10681
10761
  if (cronStacks.length === 0) {
10682
10762
  throw new ExpectedError("There are no crons defined inside your app.");
10683
10763
  }
10684
- stack = await prompt16.select({
10764
+ stack = await prompt17.select({
10685
10765
  message: "Select the stack:",
10686
10766
  options: cronStacks.map((stack2) => ({
10687
10767
  label: stack2.name,
@@ -10695,7 +10775,7 @@ var invoke = (program2) => {
10695
10775
  }
10696
10776
  const names = Object.keys(stackConfig.crons ?? {});
10697
10777
  if (!name) {
10698
- name = await prompt16.select({
10778
+ name = await prompt17.select({
10699
10779
  message: "Select the cron:",
10700
10780
  options: names.map((name2) => ({
10701
10781
  label: name2,
@@ -10713,7 +10793,7 @@ var invoke = (program2) => {
10713
10793
  resourceName: name
10714
10794
  });
10715
10795
  const payload = stackConfig.crons?.[name]?.payload ?? {};
10716
- const response = await log30.task({
10796
+ const response = await log32.task({
10717
10797
  initialMessage: "Invoking cron...",
10718
10798
  successMessage: "Done invoking cron.",
10719
10799
  errorMessage: "Failed invoking cron.",
@@ -10728,7 +10808,7 @@ var invoke = (program2) => {
10728
10808
  });
10729
10809
  }
10730
10810
  });
10731
- log30.note("Response", JSON.stringify(response, void 0, 4));
10811
+ log32.note("Response", JSON.stringify(response, void 0, 4));
10732
10812
  });
10733
10813
  });
10734
10814
  };
@@ -10744,7 +10824,7 @@ var cron = (program2) => {
10744
10824
  };
10745
10825
 
10746
10826
  // src/cli/command/activity/logs.ts
10747
- import { log as log31 } from "@awsless/clui";
10827
+ import { log as log33 } from "@awsless/clui";
10748
10828
  import { format as format2 } from "date-fns";
10749
10829
  var logs2 = (program2) => {
10750
10830
  program2.command("logs").option("--limit <number>", "The size limit of logs to tail", "10").description("Tail the activity logs").action(async (options) => {
@@ -10754,7 +10834,7 @@ var logs2 = (program2) => {
10754
10834
  const credentials = await getCredentials(profile);
10755
10835
  const accountId = await getAccountId(credentials, region);
10756
10836
  await bootstrapAwsless({ credentials, region, accountId });
10757
- const logs3 = await log31.task({
10837
+ const logs3 = await log33.task({
10758
10838
  initialMessage: "Loading activity logs",
10759
10839
  successMessage: "Done loading activity logs.",
10760
10840
  errorMessage: "Failed loading activity logs.",
@@ -10775,7 +10855,7 @@ var logs2 = (program2) => {
10775
10855
  };
10776
10856
  for (const item of logs3) {
10777
10857
  const date = new Date(item.date);
10778
- log31.info(
10858
+ log33.info(
10779
10859
  [
10780
10860
  [
10781
10861
  color.line.dim(format2(date, "yyyy-MM-dd")),