@awsless/awsless 0.0.639 → 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
 
@@ -6873,7 +6873,7 @@ var buildExecutable = async (input, outputPath, architecture) => {
6873
6873
  }
6874
6874
  if (!result.success) {
6875
6875
  throw new ExpectedError(`Executable build failed:
6876
- ${result.logs?.map((log32) => log32.message).join("\n")}`);
6876
+ ${result.logs?.map((log34) => log34.message).join("\n")}`);
6877
6877
  }
6878
6878
  const file = await readFile4(filePath);
6879
6879
  return {
@@ -8916,13 +8916,85 @@ var list = (program2) => {
8916
8916
  });
8917
8917
  };
8918
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
+
8919
8989
  // src/cli/command/config/index.ts
8920
8990
  var commands = [
8921
8991
  //
8922
8992
  set,
8923
8993
  get,
8924
8994
  del,
8925
- list
8995
+ list,
8996
+ export_,
8997
+ import_
8926
8998
  ];
8927
8999
  var config = (program2) => {
8928
9000
  const command = program2.command("config").description(`Manage app config parameters`);
@@ -8930,13 +9002,13 @@ var config = (program2) => {
8930
9002
  };
8931
9003
 
8932
9004
  // src/cli/command/delete.ts
8933
- import { log as log15, prompt as prompt5 } from "@awsless/clui";
9005
+ import { log as log17, prompt as prompt6 } from "@awsless/clui";
8934
9006
  import wildstring2 from "wildstring";
8935
9007
  var del2 = (program2) => {
8936
9008
  program2.command("delete").argument("[stacks...]", "Optionally filter stacks to delete").description("Delete your app from AWS").action(async (filters) => {
8937
9009
  await layout("delete", async ({ appConfig, stackConfigs }) => {
8938
9010
  if (appConfig.protect) {
8939
- log15.warning("Your app is protected against deletion.");
9011
+ log17.warning("Your app is protected against deletion.");
8940
9012
  return "Disable the protect flag and try again.";
8941
9013
  }
8942
9014
  const region = appConfig.region;
@@ -8956,7 +9028,7 @@ var del2 = (program2) => {
8956
9028
  if (!process.env.SKIP_PROMPT) {
8957
9029
  const deployAll = filters.length === 0;
8958
9030
  const deploySingle = filters.length === 1;
8959
- const ok = await prompt5.confirm({
9031
+ const ok = await prompt6.confirm({
8960
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(
8961
9033
  "delete"
8962
9034
  )} the [ ${formattedFilter} ] stacks?`
@@ -8984,11 +9056,11 @@ var del2 = (program2) => {
8984
9056
  };
8985
9057
 
8986
9058
  // src/cli/command/deploy.ts
8987
- import { log as log18, prompt as prompt7 } from "@awsless/clui";
9059
+ import { log as log20, prompt as prompt8 } from "@awsless/clui";
8988
9060
  import wildstring4 from "wildstring";
8989
9061
 
8990
9062
  // src/cli/ui/complex/run-tests.ts
8991
- import { log as log16 } from "@awsless/clui";
9063
+ import { log as log18 } from "@awsless/clui";
8992
9064
  import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
8993
9065
  import { join as join18 } from "path";
8994
9066
  import wildstring3 from "wildstring";
@@ -9106,10 +9178,10 @@ var startTest = async (props) => {
9106
9178
  tests.push(entry);
9107
9179
  if ("task" in test2) {
9108
9180
  const task2 = test2.task;
9109
- for (const log32 of task2.logs ?? []) {
9181
+ for (const log34 of task2.logs ?? []) {
9110
9182
  entry.logs.push({
9111
- time: log32.time,
9112
- text: log32.content
9183
+ time: log34.time,
9184
+ text: log34.content
9113
9185
  });
9114
9186
  }
9115
9187
  }
@@ -9167,7 +9239,7 @@ var formatResult = (props) => {
9167
9239
  var logTestLogs = (event) => {
9168
9240
  for (const test2 of event.tests) {
9169
9241
  if (test2.logs.length > 0) {
9170
- log16.message(
9242
+ log18.message(
9171
9243
  [
9172
9244
  color.info.bold.inverse(" LOGS "),
9173
9245
  color.dim(icon.arrow.right),
@@ -9177,7 +9249,7 @@ var logTestLogs = (event) => {
9177
9249
  ].join(" "),
9178
9250
  color.line(icon.dot)
9179
9251
  );
9180
- log16.message(test2.logs.map((log32) => log32.text).join("\n"));
9252
+ log18.message(test2.logs.map((log34) => log34.text).join("\n"));
9181
9253
  }
9182
9254
  }
9183
9255
  };
@@ -9201,7 +9273,7 @@ var logTestError = (index, event, test2, error) => {
9201
9273
  message,
9202
9274
  comment.length > 0 ? color.dim(`//${comment}`) : ""
9203
9275
  ].join(" ");
9204
- log16.error(
9276
+ log18.error(
9205
9277
  [
9206
9278
  //
9207
9279
  color.error.inverse.bold(` FAIL `),
@@ -9236,7 +9308,7 @@ var runTest = async (stack, dir, filters, workspace, opts) => {
9236
9308
  const raw = await readFile5(file, { encoding: "utf8" });
9237
9309
  const data = parse4(raw);
9238
9310
  if (data.fingerprint === fingerprint) {
9239
- log16.step(
9311
+ log18.step(
9240
9312
  formatResult({
9241
9313
  stack,
9242
9314
  cached: true,
@@ -9251,7 +9323,7 @@ var runTest = async (stack, dir, filters, workspace, opts) => {
9251
9323
  }
9252
9324
  }
9253
9325
  }
9254
- const result = await log16.task({
9326
+ const result = await log18.task({
9255
9327
  initialMessage: `Run tests for the ${color.info(stack)} stack`,
9256
9328
  errorMessage: `Running tests for the ${color.info(stack)} stack failed`,
9257
9329
  async task(ctx) {
@@ -9305,10 +9377,10 @@ var runTests = async (tests, stackFilters = [], testFilters = [], opts) => {
9305
9377
  };
9306
9378
 
9307
9379
  // src/cli/ui/complex/show-warnings.ts
9308
- import { log as log17, prompt as prompt6 } from "@awsless/clui";
9380
+ import { log as log19, prompt as prompt7 } from "@awsless/clui";
9309
9381
  var showWarnings = async (warnings) => {
9310
9382
  for (const warning of warnings) {
9311
- log17.warning(
9383
+ log19.warning(
9312
9384
  [
9313
9385
  //
9314
9386
  color.warning("Warning!"),
@@ -9317,7 +9389,7 @@ var showWarnings = async (warnings) => {
9317
9389
  );
9318
9390
  }
9319
9391
  if (warnings.length > 0) {
9320
- const result = await prompt6.confirm({
9392
+ const result = await prompt7.confirm({
9321
9393
  initialValue: false,
9322
9394
  message: `Some issues remain unresolved. If you continue, your app may not function correctly. Do you still want to proceed?`
9323
9395
  });
@@ -9354,7 +9426,7 @@ var deploy = (program2) => {
9354
9426
  if (!process.env.SKIP_PROMPT) {
9355
9427
  const deployAll = filters.length === 0;
9356
9428
  const deploySingle = filters.length === 1;
9357
- const ok = await prompt7.confirm({
9429
+ const ok = await prompt8.confirm({
9358
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?`
9359
9431
  });
9360
9432
  if (!ok) {
@@ -9376,7 +9448,7 @@ var deploy = (program2) => {
9376
9448
  accountId,
9377
9449
  region
9378
9450
  });
9379
- await log18.task({
9451
+ await log20.task({
9380
9452
  initialMessage: "Deploying the stacks to AWS",
9381
9453
  successMessage: "Done deploying the stacks to AWS.",
9382
9454
  async task() {
@@ -9400,7 +9472,7 @@ import {
9400
9472
  CognitoIdentityProviderClient,
9401
9473
  UsernameExistsException
9402
9474
  } from "@aws-sdk/client-cognito-identity-provider";
9403
- import { log as log19, prompt as prompt8 } from "@awsless/clui";
9475
+ import { log as log21, prompt as prompt9 } from "@awsless/clui";
9404
9476
  var create = (program2) => {
9405
9477
  program2.command("create").description("Create an user in your userpool").action(async () => {
9406
9478
  await layout("auth user create", async ({ appConfig, stackConfigs }) => {
@@ -9411,7 +9483,7 @@ var create = (program2) => {
9411
9483
  if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
9412
9484
  throw new ExpectedError("No auth resources are defined.");
9413
9485
  }
9414
- const name = await prompt8.select({
9486
+ const name = await prompt9.select({
9415
9487
  message: "Select the auth userpool:",
9416
9488
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
9417
9489
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -9420,7 +9492,7 @@ var create = (program2) => {
9420
9492
  }))
9421
9493
  });
9422
9494
  const props = appConfig.defaults.auth[name];
9423
- const userPoolId = await log19.task({
9495
+ const userPoolId = await log21.task({
9424
9496
  initialMessage: "Loading auth userpool...",
9425
9497
  successMessage: "Done loading auth userpool.",
9426
9498
  errorMessage: "Failed loading auth userpool.",
@@ -9439,7 +9511,7 @@ var create = (program2) => {
9439
9511
  }
9440
9512
  }
9441
9513
  });
9442
- const username = await prompt8.text({
9514
+ const username = await prompt9.text({
9443
9515
  message: "Username:",
9444
9516
  validate(value) {
9445
9517
  if (!value) {
@@ -9448,7 +9520,7 @@ var create = (program2) => {
9448
9520
  return;
9449
9521
  }
9450
9522
  });
9451
- const password = await prompt8.password({
9523
+ const password = await prompt9.password({
9452
9524
  message: "Password:",
9453
9525
  validate(value) {
9454
9526
  if (!value) {
@@ -9474,7 +9546,7 @@ var create = (program2) => {
9474
9546
  });
9475
9547
  let groups = [];
9476
9548
  if (props.groups.length > 0) {
9477
- groups = await prompt8.multiSelect({
9549
+ groups = await prompt9.multiSelect({
9478
9550
  message: "Groups:",
9479
9551
  required: false,
9480
9552
  options: props.groups.map((g) => ({
@@ -9486,7 +9558,7 @@ var create = (program2) => {
9486
9558
  region,
9487
9559
  credentials
9488
9560
  });
9489
- await log19.task({
9561
+ await log21.task({
9490
9562
  initialMessage: "Creating user...",
9491
9563
  successMessage: "User created.",
9492
9564
  errorMessage: "Failed creating user.",
@@ -9540,7 +9612,7 @@ import {
9540
9612
  CognitoIdentityProviderClient as CognitoIdentityProviderClient2,
9541
9613
  UserNotFoundException
9542
9614
  } from "@aws-sdk/client-cognito-identity-provider";
9543
- import { log as log20, prompt as prompt9 } from "@awsless/clui";
9615
+ import { log as log22, prompt as prompt10 } from "@awsless/clui";
9544
9616
  var update = (program2) => {
9545
9617
  program2.command("update").description("Update an user in your userpool").action(async () => {
9546
9618
  await layout("auth user update", async ({ appConfig, stackConfigs }) => {
@@ -9551,7 +9623,7 @@ var update = (program2) => {
9551
9623
  if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
9552
9624
  throw new ExpectedError("No auth resources are defined.");
9553
9625
  }
9554
- const name = await prompt9.select({
9626
+ const name = await prompt10.select({
9555
9627
  message: "Select the auth userpool:",
9556
9628
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
9557
9629
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -9560,7 +9632,7 @@ var update = (program2) => {
9560
9632
  }))
9561
9633
  });
9562
9634
  const props = appConfig.defaults.auth[name];
9563
- const userPoolId = await log20.task({
9635
+ const userPoolId = await log22.task({
9564
9636
  initialMessage: "Loading auth userpool...",
9565
9637
  successMessage: "Done loading auth userpool.",
9566
9638
  errorMessage: "Failed loading auth userpool.",
@@ -9579,7 +9651,7 @@ var update = (program2) => {
9579
9651
  }
9580
9652
  }
9581
9653
  });
9582
- const username = await prompt9.text({
9654
+ const username = await prompt10.text({
9583
9655
  message: "Username:",
9584
9656
  validate(value) {
9585
9657
  if (!value) {
@@ -9592,7 +9664,7 @@ var update = (program2) => {
9592
9664
  region,
9593
9665
  credentials
9594
9666
  });
9595
- const oldGroups = await log20.task({
9667
+ const oldGroups = await log22.task({
9596
9668
  initialMessage: "Fetching user info...",
9597
9669
  successMessage: "Done fetching user info.",
9598
9670
  errorMessage: `Failed fetching user info.`,
@@ -9626,13 +9698,13 @@ var update = (program2) => {
9626
9698
  return groups;
9627
9699
  }
9628
9700
  });
9629
- const changePass = await prompt9.confirm({
9701
+ const changePass = await prompt10.confirm({
9630
9702
  message: `Do you wanna change the user's password`,
9631
9703
  initialValue: false
9632
9704
  });
9633
9705
  let password;
9634
9706
  if (changePass) {
9635
- password = await prompt9.password({
9707
+ password = await prompt10.password({
9636
9708
  message: "New Password:",
9637
9709
  validate(value) {
9638
9710
  if (!value) {
@@ -9659,7 +9731,7 @@ var update = (program2) => {
9659
9731
  }
9660
9732
  let newGroups = [];
9661
9733
  if (props.groups.length > 0) {
9662
- newGroups = await prompt9.multiSelect({
9734
+ newGroups = await prompt10.multiSelect({
9663
9735
  message: "Groups:",
9664
9736
  required: false,
9665
9737
  initialValues: oldGroups,
@@ -9668,7 +9740,7 @@ var update = (program2) => {
9668
9740
  }))
9669
9741
  });
9670
9742
  }
9671
- await log20.task({
9743
+ await log22.task({
9672
9744
  initialMessage: "Updating user...",
9673
9745
  successMessage: "User updated.",
9674
9746
  errorMessage: "Failed updating user.",
@@ -9717,7 +9789,7 @@ import {
9717
9789
  CognitoIdentityProviderClient as CognitoIdentityProviderClient3,
9718
9790
  UserNotFoundException as UserNotFoundException2
9719
9791
  } from "@aws-sdk/client-cognito-identity-provider";
9720
- 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";
9721
9793
  var del3 = (program2) => {
9722
9794
  program2.command("delete").description("Delete an user from your userpool").action(async () => {
9723
9795
  await layout("auth user delete", async ({ appConfig, stackConfigs }) => {
@@ -9728,7 +9800,7 @@ var del3 = (program2) => {
9728
9800
  if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
9729
9801
  throw new ExpectedError("No auth resources are defined.");
9730
9802
  }
9731
- const name = await prompt10.select({
9803
+ const name = await prompt11.select({
9732
9804
  message: "Select the auth userpool:",
9733
9805
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
9734
9806
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -9736,7 +9808,7 @@ var del3 = (program2) => {
9736
9808
  value: name2
9737
9809
  }))
9738
9810
  });
9739
- const userPoolId = await log21.task({
9811
+ const userPoolId = await log23.task({
9740
9812
  initialMessage: "Loading auth userpool...",
9741
9813
  successMessage: "Done loading auth userpool.",
9742
9814
  errorMessage: "Failed loading auth userpool.",
@@ -9755,7 +9827,7 @@ var del3 = (program2) => {
9755
9827
  }
9756
9828
  }
9757
9829
  });
9758
- const username = await prompt10.text({
9830
+ const username = await prompt11.text({
9759
9831
  message: "Username:",
9760
9832
  validate(value) {
9761
9833
  if (!value) {
@@ -9764,18 +9836,18 @@ var del3 = (program2) => {
9764
9836
  return;
9765
9837
  }
9766
9838
  });
9767
- const confirm = await prompt10.confirm({
9839
+ const confirm = await prompt11.confirm({
9768
9840
  message: "Are you sure you want to delete this user?",
9769
9841
  initialValue: false
9770
9842
  });
9771
9843
  if (!confirm) {
9772
- throw new Cancelled2();
9844
+ throw new Cancelled3();
9773
9845
  }
9774
9846
  const client = new CognitoIdentityProviderClient3({
9775
9847
  region,
9776
9848
  credentials
9777
9849
  });
9778
- await log21.task({
9850
+ await log23.task({
9779
9851
  initialMessage: "Deleting user...",
9780
9852
  successMessage: "User deleted.",
9781
9853
  errorMessage: "Failed deleting user.",
@@ -9814,7 +9886,7 @@ var auth = (program2) => {
9814
9886
  };
9815
9887
 
9816
9888
  // src/cli/command/bind.ts
9817
- import { log as log22 } from "@awsless/clui";
9889
+ import { log as log24 } from "@awsless/clui";
9818
9890
  import chalk4 from "chalk";
9819
9891
  import { constantCase as constantCase15 } from "change-case";
9820
9892
  var bind = (program2) => {
@@ -9836,9 +9908,9 @@ var bind = (program2) => {
9836
9908
  env[name] = await value;
9837
9909
  }
9838
9910
  if (Object.keys(env).length > 0) {
9839
- log22.list("Bind Env", env);
9911
+ log24.list("Bind Env", env);
9840
9912
  } else {
9841
- log22.warning("No bindings available.");
9913
+ log24.warning("No bindings available.");
9842
9914
  }
9843
9915
  const configList = opts.config ?? [];
9844
9916
  const configs = {};
@@ -9846,7 +9918,7 @@ var bind = (program2) => {
9846
9918
  configs[`CONFIG_${constantCase15(name)}`] = name;
9847
9919
  }
9848
9920
  if (configList.length ?? 0 > 0) {
9849
- 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"));
9850
9922
  }
9851
9923
  if (commands11.length === 0) {
9852
9924
  return "No command to execute.";
@@ -9909,7 +9981,7 @@ var watchConfig = async (options, resolve, reject) => {
9909
9981
  };
9910
9982
 
9911
9983
  // src/cli/ui/complex/build-types.ts
9912
- import { log as log23 } from "@awsless/clui";
9984
+ import { log as log25 } from "@awsless/clui";
9913
9985
 
9914
9986
  // src/type-gen/generate.ts
9915
9987
  import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
@@ -9943,7 +10015,7 @@ var generateTypes = async (props) => {
9943
10015
  // src/cli/ui/complex/build-types.ts
9944
10016
  var buildTypes = async (props) => {
9945
10017
  await generateTypes(props);
9946
- log23.step("Done generating type definition files.");
10018
+ log25.step("Done generating type definition files.");
9947
10019
  };
9948
10020
 
9949
10021
  // src/cli/command/dev.ts
@@ -9969,7 +10041,7 @@ var dev = (program2) => {
9969
10041
  };
9970
10042
 
9971
10043
  // src/cli/command/resources.ts
9972
- import { log as log24 } from "@awsless/clui";
10044
+ import { log as log26 } from "@awsless/clui";
9973
10045
  import chalk5 from "chalk";
9974
10046
  import wildstring5 from "wildstring";
9975
10047
  var resources = (program2) => {
@@ -10011,9 +10083,9 @@ var resources = (program2) => {
10011
10083
  continue;
10012
10084
  }
10013
10085
  }
10014
- log24.step(chalk5.magenta(stack.name));
10086
+ log26.step(chalk5.magenta(stack.name));
10015
10087
  if (stack.resources.length) {
10016
- log24.message(
10088
+ log26.message(
10017
10089
  stack.resources.map((r) => {
10018
10090
  return [
10019
10091
  //
@@ -10024,7 +10096,7 @@ var resources = (program2) => {
10024
10096
  }).join("\n")
10025
10097
  );
10026
10098
  } else {
10027
- log24.message(color.line(`(empty)`));
10099
+ log26.message(color.line(`(empty)`));
10028
10100
  }
10029
10101
  }
10030
10102
  });
@@ -10032,7 +10104,7 @@ var resources = (program2) => {
10032
10104
  };
10033
10105
 
10034
10106
  // src/cli/command/run.ts
10035
- import { prompt as prompt11 } from "@awsless/clui";
10107
+ import { prompt as prompt12 } from "@awsless/clui";
10036
10108
  import { DynamoDBClient, dynamoDBClient } from "@awsless/dynamodb";
10037
10109
  import { iotClient, IoTDataPlaneClient } from "@awsless/iot";
10038
10110
  import { LambdaClient as LambdaClient3, lambdaClient } from "@awsless/lambda";
@@ -10052,7 +10124,7 @@ var run = (program2) => {
10052
10124
  return cmd.name === selected;
10053
10125
  });
10054
10126
  } else {
10055
- command = await prompt11.select({
10127
+ command = await prompt12.select({
10056
10128
  message: "Pick the command you want to run:",
10057
10129
  initialValue: commands11[0],
10058
10130
  options: commands11.map((cmd) => ({
@@ -10106,7 +10178,7 @@ var pull = (program2) => {
10106
10178
  };
10107
10179
 
10108
10180
  // src/cli/command/state/push.ts
10109
- import { prompt as prompt12 } from "@awsless/clui";
10181
+ import { prompt as prompt13 } from "@awsless/clui";
10110
10182
  var push = (program2) => {
10111
10183
  program2.command("push").description("Push the local state to the remote server").action(async () => {
10112
10184
  await layout("state pull", async ({ appConfig, stackConfigs }) => {
@@ -10116,7 +10188,7 @@ var push = (program2) => {
10116
10188
  const accountId = await getAccountId(credentials, region);
10117
10189
  const { app } = createApp({ appConfig, stackConfigs, accountId });
10118
10190
  const { state: state2 } = await createWorkSpace({ credentials, region, accountId });
10119
- const ok = await prompt12.confirm({
10191
+ const ok = await prompt13.confirm({
10120
10192
  message: "Pushing up the local state might corrupt your remote state. Are you sure?",
10121
10193
  initialValue: false
10122
10194
  });
@@ -10130,7 +10202,7 @@ var push = (program2) => {
10130
10202
  };
10131
10203
 
10132
10204
  // src/cli/command/state/unlock.ts
10133
- import { prompt as prompt13 } from "@awsless/clui";
10205
+ import { prompt as prompt14 } from "@awsless/clui";
10134
10206
  var unlock = (program2) => {
10135
10207
  program2.command("unlock").description("Release the lock that ensures sequential deployments").action(async () => {
10136
10208
  await layout("state unlock", async ({ appConfig, stackConfigs }) => {
@@ -10144,7 +10216,7 @@ var unlock = (program2) => {
10144
10216
  if (!isLocked) {
10145
10217
  return "No lock is exists.";
10146
10218
  }
10147
- const ok = await prompt13.confirm({
10219
+ const ok = await prompt14.confirm({
10148
10220
  message: "Releasing the lock that ensures sequential deployments might result in corrupt state if a deployment is still running. Are you sure?",
10149
10221
  initialValue: false
10150
10222
  });
@@ -10194,7 +10266,7 @@ var types = (program2) => {
10194
10266
  };
10195
10267
 
10196
10268
  // src/cli/command/domain/list.ts
10197
- import { log as log25 } from "@awsless/clui";
10269
+ import { log as log27 } from "@awsless/clui";
10198
10270
  var list2 = (program2) => {
10199
10271
  program2.command("list").description("List all domains").action(async () => {
10200
10272
  await layout("domain list", async ({ appConfig, stackConfigs }) => {
@@ -10215,7 +10287,7 @@ var list2 = (program2) => {
10215
10287
  });
10216
10288
  await workspace.hydrate(app);
10217
10289
  for (const zone of domainZones) {
10218
- log25.step(
10290
+ log27.step(
10219
10291
  [
10220
10292
  //
10221
10293
  color.label.green(await zone.name),
@@ -10223,14 +10295,14 @@ var list2 = (program2) => {
10223
10295
  color.dim(await zone.id)
10224
10296
  ].join(" ")
10225
10297
  );
10226
- log25.message((await zone.nameServers).join("\n"));
10298
+ log27.message((await zone.nameServers).join("\n"));
10227
10299
  }
10228
10300
  });
10229
10301
  });
10230
10302
  };
10231
10303
 
10232
10304
  // src/cli/command/domain/deploy.ts
10233
- import { log as log26 } from "@awsless/clui";
10305
+ import { log as log28 } from "@awsless/clui";
10234
10306
  var deploy2 = (program2) => {
10235
10307
  program2.command("deploy").description("Deploy the domain zones to AWS").action(async () => {
10236
10308
  await layout("domain deploy", async ({ appConfig, stackConfigs }) => {
@@ -10249,7 +10321,7 @@ var deploy2 = (program2) => {
10249
10321
  accountId,
10250
10322
  region
10251
10323
  });
10252
- await log26.task({
10324
+ await log28.task({
10253
10325
  initialMessage: "Deploying the domain zones to AWS...",
10254
10326
  successMessage: "Done deploying the domain zones to AWS.",
10255
10327
  errorMessage: "Failed deploying the domain zones to AWS.",
@@ -10258,7 +10330,7 @@ var deploy2 = (program2) => {
10258
10330
  }
10259
10331
  });
10260
10332
  for (const zone of domainZones) {
10261
- log26.step(
10333
+ log28.step(
10262
10334
  [
10263
10335
  //
10264
10336
  color.label.green(await zone.name),
@@ -10266,7 +10338,7 @@ var deploy2 = (program2) => {
10266
10338
  color.dim(await zone.id)
10267
10339
  ].join(" ")
10268
10340
  );
10269
- log26.message((await zone.nameServers).join("\n"));
10341
+ log28.message((await zone.nameServers).join("\n"));
10270
10342
  }
10271
10343
  });
10272
10344
  });
@@ -10285,7 +10357,7 @@ var domain = (program2) => {
10285
10357
 
10286
10358
  // src/cli/command/logs.ts
10287
10359
  import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
10288
- import { log as log27 } from "@awsless/clui";
10360
+ import { log as log29 } from "@awsless/clui";
10289
10361
  import { aws as aws30 } from "@terraforge/aws";
10290
10362
  import chalk6 from "chalk";
10291
10363
  import chunk2 from "chunk";
@@ -10326,7 +10398,7 @@ var logs = (program2) => {
10326
10398
  process.once("SIGINT", () => {
10327
10399
  controller.abort();
10328
10400
  });
10329
- const streams = await log27.task({
10401
+ const streams = await log29.task({
10330
10402
  initialMessage: "Connecting to the log stream...",
10331
10403
  errorMessage: "Failed to connect to the log stream.",
10332
10404
  async task(ctx) {
@@ -10383,7 +10455,7 @@ var formatLog = (level, date, group, message) => {
10383
10455
  SYSTEM: chalk6.blue
10384
10456
  };
10385
10457
  const levelColor = levels[level] ?? chalk6.cyan;
10386
- log27.message(
10458
+ log29.message(
10387
10459
  [
10388
10460
  [
10389
10461
  //
@@ -10424,7 +10496,7 @@ var parseJsonLog = (message) => {
10424
10496
 
10425
10497
  // src/cli/command/image/clear-cache.ts
10426
10498
  import { DeleteObjectsCommand, ListObjectsV2Command, S3Client as S3Client3 } from "@aws-sdk/client-s3";
10427
- 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";
10428
10500
  import { CloudFrontClient as CloudFrontClient2 } from "@aws-sdk/client-cloudfront";
10429
10501
  var clearCache = (program2) => {
10430
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) => {
@@ -10440,7 +10512,7 @@ var clearCache = (program2) => {
10440
10512
  }
10441
10513
  return;
10442
10514
  });
10443
- stack = await prompt14.select({
10515
+ stack = await prompt15.select({
10444
10516
  message: "Select the stack:",
10445
10517
  options: imageStacks.map((stack2) => ({
10446
10518
  label: stack2.name,
@@ -10457,7 +10529,7 @@ var clearCache = (program2) => {
10457
10529
  if (!names) {
10458
10530
  throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
10459
10531
  }
10460
- name = await prompt14.select({
10532
+ name = await prompt15.select({
10461
10533
  message: "Select the image resource:",
10462
10534
  options: names.map((name2) => ({
10463
10535
  label: name2,
@@ -10465,11 +10537,11 @@ var clearCache = (program2) => {
10465
10537
  }))
10466
10538
  });
10467
10539
  }
10468
- const ok = await prompt14.confirm({
10540
+ const ok = await prompt15.confirm({
10469
10541
  message: `Are you sure you want to clear the cache`
10470
10542
  });
10471
10543
  if (!ok) {
10472
- throw new Cancelled3();
10544
+ throw new Cancelled4();
10473
10545
  }
10474
10546
  const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
10475
10547
  const { workspace } = await createWorkSpace({
@@ -10495,7 +10567,7 @@ var clearCache = (program2) => {
10495
10567
  region
10496
10568
  });
10497
10569
  let totalDeleted = 0;
10498
- await log28.task({
10570
+ await log30.task({
10499
10571
  initialMessage: "Clearing cache...",
10500
10572
  successMessage: "Cache successfully cleared.",
10501
10573
  task: async () => {
@@ -10548,7 +10620,7 @@ var image = (program2) => {
10548
10620
 
10549
10621
  // src/cli/command/icon/clear-cache.ts
10550
10622
  import { DeleteObjectsCommand as DeleteObjectsCommand2, ListObjectsV2Command as ListObjectsV2Command2, S3Client as S3Client4 } from "@aws-sdk/client-s3";
10551
- 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";
10552
10624
  import { CloudFrontClient as CloudFrontClient3 } from "@aws-sdk/client-cloudfront";
10553
10625
  var clearCache2 = (program2) => {
10554
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) => {
@@ -10564,7 +10636,7 @@ var clearCache2 = (program2) => {
10564
10636
  }
10565
10637
  return;
10566
10638
  });
10567
- stack = await prompt15.select({
10639
+ stack = await prompt16.select({
10568
10640
  message: "Select the stack:",
10569
10641
  options: iconStacks.map((stack2) => ({
10570
10642
  label: stack2.name,
@@ -10581,7 +10653,7 @@ var clearCache2 = (program2) => {
10581
10653
  if (!names) {
10582
10654
  throw new ExpectedError(`No icon resources are defined in stack "${stack}".`);
10583
10655
  }
10584
- name = await prompt15.select({
10656
+ name = await prompt16.select({
10585
10657
  message: "Select the icon resource:",
10586
10658
  options: names.map((name2) => ({
10587
10659
  label: name2,
@@ -10589,11 +10661,11 @@ var clearCache2 = (program2) => {
10589
10661
  }))
10590
10662
  });
10591
10663
  }
10592
- const ok = await prompt15.confirm({
10664
+ const ok = await prompt16.confirm({
10593
10665
  message: `Are you sure you want to clear the cache`
10594
10666
  });
10595
10667
  if (!ok) {
10596
- throw new Cancelled4();
10668
+ throw new Cancelled5();
10597
10669
  }
10598
10670
  const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
10599
10671
  const { workspace } = await createWorkSpace({
@@ -10619,7 +10691,7 @@ var clearCache2 = (program2) => {
10619
10691
  region
10620
10692
  });
10621
10693
  let totalDeleted = 0;
10622
- await log29.task({
10694
+ await log31.task({
10623
10695
  initialMessage: "Clearing cache...",
10624
10696
  successMessage: "Cache successfully cleared.",
10625
10697
  task: async () => {
@@ -10671,7 +10743,7 @@ var icon2 = (program2) => {
10671
10743
  };
10672
10744
 
10673
10745
  // src/cli/command/cron/invoke.ts
10674
- import { log as log30, prompt as prompt16 } from "@awsless/clui";
10746
+ import { log as log32, prompt as prompt17 } from "@awsless/clui";
10675
10747
  import { invoke as invokeLambda, LambdaClient as LambdaClient4 } from "@awsless/lambda";
10676
10748
  var invoke = (program2) => {
10677
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) => {
@@ -10689,7 +10761,7 @@ var invoke = (program2) => {
10689
10761
  if (cronStacks.length === 0) {
10690
10762
  throw new ExpectedError("There are no crons defined inside your app.");
10691
10763
  }
10692
- stack = await prompt16.select({
10764
+ stack = await prompt17.select({
10693
10765
  message: "Select the stack:",
10694
10766
  options: cronStacks.map((stack2) => ({
10695
10767
  label: stack2.name,
@@ -10703,7 +10775,7 @@ var invoke = (program2) => {
10703
10775
  }
10704
10776
  const names = Object.keys(stackConfig.crons ?? {});
10705
10777
  if (!name) {
10706
- name = await prompt16.select({
10778
+ name = await prompt17.select({
10707
10779
  message: "Select the cron:",
10708
10780
  options: names.map((name2) => ({
10709
10781
  label: name2,
@@ -10721,7 +10793,7 @@ var invoke = (program2) => {
10721
10793
  resourceName: name
10722
10794
  });
10723
10795
  const payload = stackConfig.crons?.[name]?.payload ?? {};
10724
- const response = await log30.task({
10796
+ const response = await log32.task({
10725
10797
  initialMessage: "Invoking cron...",
10726
10798
  successMessage: "Done invoking cron.",
10727
10799
  errorMessage: "Failed invoking cron.",
@@ -10736,7 +10808,7 @@ var invoke = (program2) => {
10736
10808
  });
10737
10809
  }
10738
10810
  });
10739
- log30.note("Response", JSON.stringify(response, void 0, 4));
10811
+ log32.note("Response", JSON.stringify(response, void 0, 4));
10740
10812
  });
10741
10813
  });
10742
10814
  };
@@ -10752,7 +10824,7 @@ var cron = (program2) => {
10752
10824
  };
10753
10825
 
10754
10826
  // src/cli/command/activity/logs.ts
10755
- import { log as log31 } from "@awsless/clui";
10827
+ import { log as log33 } from "@awsless/clui";
10756
10828
  import { format as format2 } from "date-fns";
10757
10829
  var logs2 = (program2) => {
10758
10830
  program2.command("logs").option("--limit <number>", "The size limit of logs to tail", "10").description("Tail the activity logs").action(async (options) => {
@@ -10762,7 +10834,7 @@ var logs2 = (program2) => {
10762
10834
  const credentials = await getCredentials(profile);
10763
10835
  const accountId = await getAccountId(credentials, region);
10764
10836
  await bootstrapAwsless({ credentials, region, accountId });
10765
- const logs3 = await log31.task({
10837
+ const logs3 = await log33.task({
10766
10838
  initialMessage: "Loading activity logs",
10767
10839
  successMessage: "Done loading activity logs.",
10768
10840
  errorMessage: "Failed loading activity logs.",
@@ -10783,7 +10855,7 @@ var logs2 = (program2) => {
10783
10855
  };
10784
10856
  for (const item of logs3) {
10785
10857
  const date = new Date(item.date);
10786
- log31.info(
10858
+ log33.info(
10787
10859
  [
10788
10860
  [
10789
10861
  color.line.dim(format2(date, "yyyy-MM-dd")),
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.639",
3
+ "version": "0.0.640",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -34,22 +34,22 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@awsless/big-float": "^0.1.5",
37
- "@awsless/clui": "^0.0.8",
38
37
  "@awsless/cloudwatch": "^0.0.1",
39
- "@awsless/duration": "^0.0.4",
40
38
  "@awsless/iot": "^0.0.3",
41
- "@awsless/dynamodb": "^0.3.14",
42
39
  "@awsless/lambda": "^0.0.37",
43
- "@awsless/s3": "^0.0.21",
44
- "@awsless/mqtt": "^0.0.2",
45
- "@awsless/redis": "^0.0.14",
46
40
  "@awsless/open-search": "^0.0.21",
41
+ "@awsless/redis": "^0.0.14",
42
+ "@awsless/duration": "^0.0.4",
43
+ "@awsless/json": "^0.0.11",
44
+ "@awsless/dynamodb": "^0.3.14",
47
45
  "@awsless/validate": "^0.1.5",
48
- "@awsless/sns": "^0.0.10",
49
46
  "@awsless/sqs": "^0.0.16",
50
- "@awsless/ssm": "^0.0.7",
51
- "@awsless/json": "^0.0.11",
52
- "@awsless/weak-cache": "^0.0.1"
47
+ "@awsless/clui": "^0.0.8",
48
+ "@awsless/s3": "^0.0.21",
49
+ "@awsless/mqtt": "^0.0.2",
50
+ "@awsless/sns": "^0.0.10",
51
+ "@awsless/weak-cache": "^0.0.1",
52
+ "@awsless/ssm": "^0.0.7"
53
53
  },
54
54
  "dependencies": {
55
55
  "@aws-sdk/client-cloudformation": "^3.369.0",
@@ -113,15 +113,15 @@
113
113
  "zip-a-folder": "^3.1.6",
114
114
  "zod": "^3.24.2",
115
115
  "zod-to-json-schema": "^3.24.3",
116
- "@awsless/big-float": "^0.1.5",
117
116
  "@awsless/cloudwatch": "^0.0.1",
117
+ "@awsless/big-float": "^0.1.5",
118
+ "@awsless/clui": "^0.0.8",
118
119
  "@awsless/duration": "^0.0.4",
119
120
  "@awsless/json": "^0.0.11",
120
- "@awsless/size": "^0.0.2",
121
121
  "@awsless/scheduler": "^0.0.4",
122
- "@awsless/validate": "^0.1.5",
123
- "@awsless/clui": "^0.0.8",
124
- "@awsless/ts-file-cache": "^0.0.12"
122
+ "@awsless/ts-file-cache": "^0.0.12",
123
+ "@awsless/size": "^0.0.2",
124
+ "@awsless/validate": "^0.1.5"
125
125
  },
126
126
  "devDependencies": {
127
127
  "@hono/node-server": "1.19.9",