@awsless/awsless 0.0.639 → 0.0.641

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,88 @@ 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
+ console.log("");
8938
+ console.log(JSON.stringify(values));
8939
+ console.log("");
8940
+ process.exit();
8941
+ });
8942
+ });
8943
+ };
8944
+
8945
+ // src/cli/command/config/import.ts
8946
+ import { Cancelled as Cancelled2, log as log16, prompt as prompt5 } from "@awsless/clui";
8947
+ var import_ = (program2) => {
8948
+ program2.command("import").description("Import config values").action(async () => {
8949
+ await layout("import", async ({ appConfig }) => {
8950
+ const credentials = await getCredentials(appConfig.profile);
8951
+ const params = new SsmStore({
8952
+ credentials,
8953
+ appConfig
8954
+ });
8955
+ const json = await prompt5.text({
8956
+ message: "The config values in JSON format",
8957
+ validate: (value) => {
8958
+ try {
8959
+ JSON.parse(value);
8960
+ } catch {
8961
+ return "Invalid JSON";
8962
+ }
8963
+ return;
8964
+ }
8965
+ });
8966
+ const values = JSON.parse(json);
8967
+ log16.table({
8968
+ head: ["Name", "Value"],
8969
+ body: Object.entries(values)
8970
+ });
8971
+ const confirm = await prompt5.confirm({
8972
+ message: "Are you sure you want to import the config values?",
8973
+ initialValue: false
8974
+ });
8975
+ if (!confirm) {
8976
+ throw new Cancelled2();
8977
+ }
8978
+ await log16.task({
8979
+ initialMessage: "Importing config parameters...",
8980
+ successMessage: "Done importing config values.",
8981
+ errorMessage: "Failed importing config values.",
8982
+ async task() {
8983
+ for (const [name, value] of Object.entries(values)) {
8984
+ await params.set(name, value);
8985
+ }
8986
+ }
8987
+ });
8988
+ });
8989
+ });
8990
+ };
8991
+
8919
8992
  // src/cli/command/config/index.ts
8920
8993
  var commands = [
8921
8994
  //
8922
8995
  set,
8923
8996
  get,
8924
8997
  del,
8925
- list
8998
+ list,
8999
+ export_,
9000
+ import_
8926
9001
  ];
8927
9002
  var config = (program2) => {
8928
9003
  const command = program2.command("config").description(`Manage app config parameters`);
@@ -8930,13 +9005,13 @@ var config = (program2) => {
8930
9005
  };
8931
9006
 
8932
9007
  // src/cli/command/delete.ts
8933
- import { log as log15, prompt as prompt5 } from "@awsless/clui";
9008
+ import { log as log17, prompt as prompt6 } from "@awsless/clui";
8934
9009
  import wildstring2 from "wildstring";
8935
9010
  var del2 = (program2) => {
8936
9011
  program2.command("delete").argument("[stacks...]", "Optionally filter stacks to delete").description("Delete your app from AWS").action(async (filters) => {
8937
9012
  await layout("delete", async ({ appConfig, stackConfigs }) => {
8938
9013
  if (appConfig.protect) {
8939
- log15.warning("Your app is protected against deletion.");
9014
+ log17.warning("Your app is protected against deletion.");
8940
9015
  return "Disable the protect flag and try again.";
8941
9016
  }
8942
9017
  const region = appConfig.region;
@@ -8956,7 +9031,7 @@ var del2 = (program2) => {
8956
9031
  if (!process.env.SKIP_PROMPT) {
8957
9032
  const deployAll = filters.length === 0;
8958
9033
  const deploySingle = filters.length === 1;
8959
- const ok = await prompt5.confirm({
9034
+ const ok = await prompt6.confirm({
8960
9035
  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
9036
  "delete"
8962
9037
  )} the [ ${formattedFilter} ] stacks?`
@@ -8984,11 +9059,11 @@ var del2 = (program2) => {
8984
9059
  };
8985
9060
 
8986
9061
  // src/cli/command/deploy.ts
8987
- import { log as log18, prompt as prompt7 } from "@awsless/clui";
9062
+ import { log as log20, prompt as prompt8 } from "@awsless/clui";
8988
9063
  import wildstring4 from "wildstring";
8989
9064
 
8990
9065
  // src/cli/ui/complex/run-tests.ts
8991
- import { log as log16 } from "@awsless/clui";
9066
+ import { log as log18 } from "@awsless/clui";
8992
9067
  import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
8993
9068
  import { join as join18 } from "path";
8994
9069
  import wildstring3 from "wildstring";
@@ -9106,10 +9181,10 @@ var startTest = async (props) => {
9106
9181
  tests.push(entry);
9107
9182
  if ("task" in test2) {
9108
9183
  const task2 = test2.task;
9109
- for (const log32 of task2.logs ?? []) {
9184
+ for (const log34 of task2.logs ?? []) {
9110
9185
  entry.logs.push({
9111
- time: log32.time,
9112
- text: log32.content
9186
+ time: log34.time,
9187
+ text: log34.content
9113
9188
  });
9114
9189
  }
9115
9190
  }
@@ -9167,7 +9242,7 @@ var formatResult = (props) => {
9167
9242
  var logTestLogs = (event) => {
9168
9243
  for (const test2 of event.tests) {
9169
9244
  if (test2.logs.length > 0) {
9170
- log16.message(
9245
+ log18.message(
9171
9246
  [
9172
9247
  color.info.bold.inverse(" LOGS "),
9173
9248
  color.dim(icon.arrow.right),
@@ -9177,7 +9252,7 @@ var logTestLogs = (event) => {
9177
9252
  ].join(" "),
9178
9253
  color.line(icon.dot)
9179
9254
  );
9180
- log16.message(test2.logs.map((log32) => log32.text).join("\n"));
9255
+ log18.message(test2.logs.map((log34) => log34.text).join("\n"));
9181
9256
  }
9182
9257
  }
9183
9258
  };
@@ -9201,7 +9276,7 @@ var logTestError = (index, event, test2, error) => {
9201
9276
  message,
9202
9277
  comment.length > 0 ? color.dim(`//${comment}`) : ""
9203
9278
  ].join(" ");
9204
- log16.error(
9279
+ log18.error(
9205
9280
  [
9206
9281
  //
9207
9282
  color.error.inverse.bold(` FAIL `),
@@ -9236,7 +9311,7 @@ var runTest = async (stack, dir, filters, workspace, opts) => {
9236
9311
  const raw = await readFile5(file, { encoding: "utf8" });
9237
9312
  const data = parse4(raw);
9238
9313
  if (data.fingerprint === fingerprint) {
9239
- log16.step(
9314
+ log18.step(
9240
9315
  formatResult({
9241
9316
  stack,
9242
9317
  cached: true,
@@ -9251,7 +9326,7 @@ var runTest = async (stack, dir, filters, workspace, opts) => {
9251
9326
  }
9252
9327
  }
9253
9328
  }
9254
- const result = await log16.task({
9329
+ const result = await log18.task({
9255
9330
  initialMessage: `Run tests for the ${color.info(stack)} stack`,
9256
9331
  errorMessage: `Running tests for the ${color.info(stack)} stack failed`,
9257
9332
  async task(ctx) {
@@ -9305,10 +9380,10 @@ var runTests = async (tests, stackFilters = [], testFilters = [], opts) => {
9305
9380
  };
9306
9381
 
9307
9382
  // src/cli/ui/complex/show-warnings.ts
9308
- import { log as log17, prompt as prompt6 } from "@awsless/clui";
9383
+ import { log as log19, prompt as prompt7 } from "@awsless/clui";
9309
9384
  var showWarnings = async (warnings) => {
9310
9385
  for (const warning of warnings) {
9311
- log17.warning(
9386
+ log19.warning(
9312
9387
  [
9313
9388
  //
9314
9389
  color.warning("Warning!"),
@@ -9317,7 +9392,7 @@ var showWarnings = async (warnings) => {
9317
9392
  );
9318
9393
  }
9319
9394
  if (warnings.length > 0) {
9320
- const result = await prompt6.confirm({
9395
+ const result = await prompt7.confirm({
9321
9396
  initialValue: false,
9322
9397
  message: `Some issues remain unresolved. If you continue, your app may not function correctly. Do you still want to proceed?`
9323
9398
  });
@@ -9354,7 +9429,7 @@ var deploy = (program2) => {
9354
9429
  if (!process.env.SKIP_PROMPT) {
9355
9430
  const deployAll = filters.length === 0;
9356
9431
  const deploySingle = filters.length === 1;
9357
- const ok = await prompt7.confirm({
9432
+ const ok = await prompt8.confirm({
9358
9433
  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
9434
  });
9360
9435
  if (!ok) {
@@ -9376,7 +9451,7 @@ var deploy = (program2) => {
9376
9451
  accountId,
9377
9452
  region
9378
9453
  });
9379
- await log18.task({
9454
+ await log20.task({
9380
9455
  initialMessage: "Deploying the stacks to AWS",
9381
9456
  successMessage: "Done deploying the stacks to AWS.",
9382
9457
  async task() {
@@ -9400,7 +9475,7 @@ import {
9400
9475
  CognitoIdentityProviderClient,
9401
9476
  UsernameExistsException
9402
9477
  } from "@aws-sdk/client-cognito-identity-provider";
9403
- import { log as log19, prompt as prompt8 } from "@awsless/clui";
9478
+ import { log as log21, prompt as prompt9 } from "@awsless/clui";
9404
9479
  var create = (program2) => {
9405
9480
  program2.command("create").description("Create an user in your userpool").action(async () => {
9406
9481
  await layout("auth user create", async ({ appConfig, stackConfigs }) => {
@@ -9411,7 +9486,7 @@ var create = (program2) => {
9411
9486
  if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
9412
9487
  throw new ExpectedError("No auth resources are defined.");
9413
9488
  }
9414
- const name = await prompt8.select({
9489
+ const name = await prompt9.select({
9415
9490
  message: "Select the auth userpool:",
9416
9491
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
9417
9492
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -9420,7 +9495,7 @@ var create = (program2) => {
9420
9495
  }))
9421
9496
  });
9422
9497
  const props = appConfig.defaults.auth[name];
9423
- const userPoolId = await log19.task({
9498
+ const userPoolId = await log21.task({
9424
9499
  initialMessage: "Loading auth userpool...",
9425
9500
  successMessage: "Done loading auth userpool.",
9426
9501
  errorMessage: "Failed loading auth userpool.",
@@ -9439,7 +9514,7 @@ var create = (program2) => {
9439
9514
  }
9440
9515
  }
9441
9516
  });
9442
- const username = await prompt8.text({
9517
+ const username = await prompt9.text({
9443
9518
  message: "Username:",
9444
9519
  validate(value) {
9445
9520
  if (!value) {
@@ -9448,7 +9523,7 @@ var create = (program2) => {
9448
9523
  return;
9449
9524
  }
9450
9525
  });
9451
- const password = await prompt8.password({
9526
+ const password = await prompt9.password({
9452
9527
  message: "Password:",
9453
9528
  validate(value) {
9454
9529
  if (!value) {
@@ -9474,7 +9549,7 @@ var create = (program2) => {
9474
9549
  });
9475
9550
  let groups = [];
9476
9551
  if (props.groups.length > 0) {
9477
- groups = await prompt8.multiSelect({
9552
+ groups = await prompt9.multiSelect({
9478
9553
  message: "Groups:",
9479
9554
  required: false,
9480
9555
  options: props.groups.map((g) => ({
@@ -9486,7 +9561,7 @@ var create = (program2) => {
9486
9561
  region,
9487
9562
  credentials
9488
9563
  });
9489
- await log19.task({
9564
+ await log21.task({
9490
9565
  initialMessage: "Creating user...",
9491
9566
  successMessage: "User created.",
9492
9567
  errorMessage: "Failed creating user.",
@@ -9540,7 +9615,7 @@ import {
9540
9615
  CognitoIdentityProviderClient as CognitoIdentityProviderClient2,
9541
9616
  UserNotFoundException
9542
9617
  } from "@aws-sdk/client-cognito-identity-provider";
9543
- import { log as log20, prompt as prompt9 } from "@awsless/clui";
9618
+ import { log as log22, prompt as prompt10 } from "@awsless/clui";
9544
9619
  var update = (program2) => {
9545
9620
  program2.command("update").description("Update an user in your userpool").action(async () => {
9546
9621
  await layout("auth user update", async ({ appConfig, stackConfigs }) => {
@@ -9551,7 +9626,7 @@ var update = (program2) => {
9551
9626
  if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
9552
9627
  throw new ExpectedError("No auth resources are defined.");
9553
9628
  }
9554
- const name = await prompt9.select({
9629
+ const name = await prompt10.select({
9555
9630
  message: "Select the auth userpool:",
9556
9631
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
9557
9632
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -9560,7 +9635,7 @@ var update = (program2) => {
9560
9635
  }))
9561
9636
  });
9562
9637
  const props = appConfig.defaults.auth[name];
9563
- const userPoolId = await log20.task({
9638
+ const userPoolId = await log22.task({
9564
9639
  initialMessage: "Loading auth userpool...",
9565
9640
  successMessage: "Done loading auth userpool.",
9566
9641
  errorMessage: "Failed loading auth userpool.",
@@ -9579,7 +9654,7 @@ var update = (program2) => {
9579
9654
  }
9580
9655
  }
9581
9656
  });
9582
- const username = await prompt9.text({
9657
+ const username = await prompt10.text({
9583
9658
  message: "Username:",
9584
9659
  validate(value) {
9585
9660
  if (!value) {
@@ -9592,7 +9667,7 @@ var update = (program2) => {
9592
9667
  region,
9593
9668
  credentials
9594
9669
  });
9595
- const oldGroups = await log20.task({
9670
+ const oldGroups = await log22.task({
9596
9671
  initialMessage: "Fetching user info...",
9597
9672
  successMessage: "Done fetching user info.",
9598
9673
  errorMessage: `Failed fetching user info.`,
@@ -9626,13 +9701,13 @@ var update = (program2) => {
9626
9701
  return groups;
9627
9702
  }
9628
9703
  });
9629
- const changePass = await prompt9.confirm({
9704
+ const changePass = await prompt10.confirm({
9630
9705
  message: `Do you wanna change the user's password`,
9631
9706
  initialValue: false
9632
9707
  });
9633
9708
  let password;
9634
9709
  if (changePass) {
9635
- password = await prompt9.password({
9710
+ password = await prompt10.password({
9636
9711
  message: "New Password:",
9637
9712
  validate(value) {
9638
9713
  if (!value) {
@@ -9659,7 +9734,7 @@ var update = (program2) => {
9659
9734
  }
9660
9735
  let newGroups = [];
9661
9736
  if (props.groups.length > 0) {
9662
- newGroups = await prompt9.multiSelect({
9737
+ newGroups = await prompt10.multiSelect({
9663
9738
  message: "Groups:",
9664
9739
  required: false,
9665
9740
  initialValues: oldGroups,
@@ -9668,7 +9743,7 @@ var update = (program2) => {
9668
9743
  }))
9669
9744
  });
9670
9745
  }
9671
- await log20.task({
9746
+ await log22.task({
9672
9747
  initialMessage: "Updating user...",
9673
9748
  successMessage: "User updated.",
9674
9749
  errorMessage: "Failed updating user.",
@@ -9717,7 +9792,7 @@ import {
9717
9792
  CognitoIdentityProviderClient as CognitoIdentityProviderClient3,
9718
9793
  UserNotFoundException as UserNotFoundException2
9719
9794
  } from "@aws-sdk/client-cognito-identity-provider";
9720
- import { Cancelled as Cancelled2, log as log21, prompt as prompt10 } from "@awsless/clui";
9795
+ import { Cancelled as Cancelled3, log as log23, prompt as prompt11 } from "@awsless/clui";
9721
9796
  var del3 = (program2) => {
9722
9797
  program2.command("delete").description("Delete an user from your userpool").action(async () => {
9723
9798
  await layout("auth user delete", async ({ appConfig, stackConfigs }) => {
@@ -9728,7 +9803,7 @@ var del3 = (program2) => {
9728
9803
  if (Object.keys(appConfig.defaults.auth ?? {}).length === 0) {
9729
9804
  throw new ExpectedError("No auth resources are defined.");
9730
9805
  }
9731
- const name = await prompt10.select({
9806
+ const name = await prompt11.select({
9732
9807
  message: "Select the auth userpool:",
9733
9808
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
9734
9809
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -9736,7 +9811,7 @@ var del3 = (program2) => {
9736
9811
  value: name2
9737
9812
  }))
9738
9813
  });
9739
- const userPoolId = await log21.task({
9814
+ const userPoolId = await log23.task({
9740
9815
  initialMessage: "Loading auth userpool...",
9741
9816
  successMessage: "Done loading auth userpool.",
9742
9817
  errorMessage: "Failed loading auth userpool.",
@@ -9755,7 +9830,7 @@ var del3 = (program2) => {
9755
9830
  }
9756
9831
  }
9757
9832
  });
9758
- const username = await prompt10.text({
9833
+ const username = await prompt11.text({
9759
9834
  message: "Username:",
9760
9835
  validate(value) {
9761
9836
  if (!value) {
@@ -9764,18 +9839,18 @@ var del3 = (program2) => {
9764
9839
  return;
9765
9840
  }
9766
9841
  });
9767
- const confirm = await prompt10.confirm({
9842
+ const confirm = await prompt11.confirm({
9768
9843
  message: "Are you sure you want to delete this user?",
9769
9844
  initialValue: false
9770
9845
  });
9771
9846
  if (!confirm) {
9772
- throw new Cancelled2();
9847
+ throw new Cancelled3();
9773
9848
  }
9774
9849
  const client = new CognitoIdentityProviderClient3({
9775
9850
  region,
9776
9851
  credentials
9777
9852
  });
9778
- await log21.task({
9853
+ await log23.task({
9779
9854
  initialMessage: "Deleting user...",
9780
9855
  successMessage: "User deleted.",
9781
9856
  errorMessage: "Failed deleting user.",
@@ -9814,7 +9889,7 @@ var auth = (program2) => {
9814
9889
  };
9815
9890
 
9816
9891
  // src/cli/command/bind.ts
9817
- import { log as log22 } from "@awsless/clui";
9892
+ import { log as log24 } from "@awsless/clui";
9818
9893
  import chalk4 from "chalk";
9819
9894
  import { constantCase as constantCase15 } from "change-case";
9820
9895
  var bind = (program2) => {
@@ -9836,9 +9911,9 @@ var bind = (program2) => {
9836
9911
  env[name] = await value;
9837
9912
  }
9838
9913
  if (Object.keys(env).length > 0) {
9839
- log22.list("Bind Env", env);
9914
+ log24.list("Bind Env", env);
9840
9915
  } else {
9841
- log22.warning("No bindings available.");
9916
+ log24.warning("No bindings available.");
9842
9917
  }
9843
9918
  const configList = opts.config ?? [];
9844
9919
  const configs = {};
@@ -9846,7 +9921,7 @@ var bind = (program2) => {
9846
9921
  configs[`CONFIG_${constantCase15(name)}`] = name;
9847
9922
  }
9848
9923
  if (configList.length ?? 0 > 0) {
9849
- log22.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
9924
+ log24.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
9850
9925
  }
9851
9926
  if (commands11.length === 0) {
9852
9927
  return "No command to execute.";
@@ -9909,7 +9984,7 @@ var watchConfig = async (options, resolve, reject) => {
9909
9984
  };
9910
9985
 
9911
9986
  // src/cli/ui/complex/build-types.ts
9912
- import { log as log23 } from "@awsless/clui";
9987
+ import { log as log25 } from "@awsless/clui";
9913
9988
 
9914
9989
  // src/type-gen/generate.ts
9915
9990
  import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
@@ -9943,7 +10018,7 @@ var generateTypes = async (props) => {
9943
10018
  // src/cli/ui/complex/build-types.ts
9944
10019
  var buildTypes = async (props) => {
9945
10020
  await generateTypes(props);
9946
- log23.step("Done generating type definition files.");
10021
+ log25.step("Done generating type definition files.");
9947
10022
  };
9948
10023
 
9949
10024
  // src/cli/command/dev.ts
@@ -9969,7 +10044,7 @@ var dev = (program2) => {
9969
10044
  };
9970
10045
 
9971
10046
  // src/cli/command/resources.ts
9972
- import { log as log24 } from "@awsless/clui";
10047
+ import { log as log26 } from "@awsless/clui";
9973
10048
  import chalk5 from "chalk";
9974
10049
  import wildstring5 from "wildstring";
9975
10050
  var resources = (program2) => {
@@ -10011,9 +10086,9 @@ var resources = (program2) => {
10011
10086
  continue;
10012
10087
  }
10013
10088
  }
10014
- log24.step(chalk5.magenta(stack.name));
10089
+ log26.step(chalk5.magenta(stack.name));
10015
10090
  if (stack.resources.length) {
10016
- log24.message(
10091
+ log26.message(
10017
10092
  stack.resources.map((r) => {
10018
10093
  return [
10019
10094
  //
@@ -10024,7 +10099,7 @@ var resources = (program2) => {
10024
10099
  }).join("\n")
10025
10100
  );
10026
10101
  } else {
10027
- log24.message(color.line(`(empty)`));
10102
+ log26.message(color.line(`(empty)`));
10028
10103
  }
10029
10104
  }
10030
10105
  });
@@ -10032,7 +10107,7 @@ var resources = (program2) => {
10032
10107
  };
10033
10108
 
10034
10109
  // src/cli/command/run.ts
10035
- import { prompt as prompt11 } from "@awsless/clui";
10110
+ import { prompt as prompt12 } from "@awsless/clui";
10036
10111
  import { DynamoDBClient, dynamoDBClient } from "@awsless/dynamodb";
10037
10112
  import { iotClient, IoTDataPlaneClient } from "@awsless/iot";
10038
10113
  import { LambdaClient as LambdaClient3, lambdaClient } from "@awsless/lambda";
@@ -10052,7 +10127,7 @@ var run = (program2) => {
10052
10127
  return cmd.name === selected;
10053
10128
  });
10054
10129
  } else {
10055
- command = await prompt11.select({
10130
+ command = await prompt12.select({
10056
10131
  message: "Pick the command you want to run:",
10057
10132
  initialValue: commands11[0],
10058
10133
  options: commands11.map((cmd) => ({
@@ -10106,7 +10181,7 @@ var pull = (program2) => {
10106
10181
  };
10107
10182
 
10108
10183
  // src/cli/command/state/push.ts
10109
- import { prompt as prompt12 } from "@awsless/clui";
10184
+ import { prompt as prompt13 } from "@awsless/clui";
10110
10185
  var push = (program2) => {
10111
10186
  program2.command("push").description("Push the local state to the remote server").action(async () => {
10112
10187
  await layout("state pull", async ({ appConfig, stackConfigs }) => {
@@ -10116,7 +10191,7 @@ var push = (program2) => {
10116
10191
  const accountId = await getAccountId(credentials, region);
10117
10192
  const { app } = createApp({ appConfig, stackConfigs, accountId });
10118
10193
  const { state: state2 } = await createWorkSpace({ credentials, region, accountId });
10119
- const ok = await prompt12.confirm({
10194
+ const ok = await prompt13.confirm({
10120
10195
  message: "Pushing up the local state might corrupt your remote state. Are you sure?",
10121
10196
  initialValue: false
10122
10197
  });
@@ -10130,7 +10205,7 @@ var push = (program2) => {
10130
10205
  };
10131
10206
 
10132
10207
  // src/cli/command/state/unlock.ts
10133
- import { prompt as prompt13 } from "@awsless/clui";
10208
+ import { prompt as prompt14 } from "@awsless/clui";
10134
10209
  var unlock = (program2) => {
10135
10210
  program2.command("unlock").description("Release the lock that ensures sequential deployments").action(async () => {
10136
10211
  await layout("state unlock", async ({ appConfig, stackConfigs }) => {
@@ -10144,7 +10219,7 @@ var unlock = (program2) => {
10144
10219
  if (!isLocked) {
10145
10220
  return "No lock is exists.";
10146
10221
  }
10147
- const ok = await prompt13.confirm({
10222
+ const ok = await prompt14.confirm({
10148
10223
  message: "Releasing the lock that ensures sequential deployments might result in corrupt state if a deployment is still running. Are you sure?",
10149
10224
  initialValue: false
10150
10225
  });
@@ -10194,7 +10269,7 @@ var types = (program2) => {
10194
10269
  };
10195
10270
 
10196
10271
  // src/cli/command/domain/list.ts
10197
- import { log as log25 } from "@awsless/clui";
10272
+ import { log as log27 } from "@awsless/clui";
10198
10273
  var list2 = (program2) => {
10199
10274
  program2.command("list").description("List all domains").action(async () => {
10200
10275
  await layout("domain list", async ({ appConfig, stackConfigs }) => {
@@ -10215,7 +10290,7 @@ var list2 = (program2) => {
10215
10290
  });
10216
10291
  await workspace.hydrate(app);
10217
10292
  for (const zone of domainZones) {
10218
- log25.step(
10293
+ log27.step(
10219
10294
  [
10220
10295
  //
10221
10296
  color.label.green(await zone.name),
@@ -10223,14 +10298,14 @@ var list2 = (program2) => {
10223
10298
  color.dim(await zone.id)
10224
10299
  ].join(" ")
10225
10300
  );
10226
- log25.message((await zone.nameServers).join("\n"));
10301
+ log27.message((await zone.nameServers).join("\n"));
10227
10302
  }
10228
10303
  });
10229
10304
  });
10230
10305
  };
10231
10306
 
10232
10307
  // src/cli/command/domain/deploy.ts
10233
- import { log as log26 } from "@awsless/clui";
10308
+ import { log as log28 } from "@awsless/clui";
10234
10309
  var deploy2 = (program2) => {
10235
10310
  program2.command("deploy").description("Deploy the domain zones to AWS").action(async () => {
10236
10311
  await layout("domain deploy", async ({ appConfig, stackConfigs }) => {
@@ -10249,7 +10324,7 @@ var deploy2 = (program2) => {
10249
10324
  accountId,
10250
10325
  region
10251
10326
  });
10252
- await log26.task({
10327
+ await log28.task({
10253
10328
  initialMessage: "Deploying the domain zones to AWS...",
10254
10329
  successMessage: "Done deploying the domain zones to AWS.",
10255
10330
  errorMessage: "Failed deploying the domain zones to AWS.",
@@ -10258,7 +10333,7 @@ var deploy2 = (program2) => {
10258
10333
  }
10259
10334
  });
10260
10335
  for (const zone of domainZones) {
10261
- log26.step(
10336
+ log28.step(
10262
10337
  [
10263
10338
  //
10264
10339
  color.label.green(await zone.name),
@@ -10266,7 +10341,7 @@ var deploy2 = (program2) => {
10266
10341
  color.dim(await zone.id)
10267
10342
  ].join(" ")
10268
10343
  );
10269
- log26.message((await zone.nameServers).join("\n"));
10344
+ log28.message((await zone.nameServers).join("\n"));
10270
10345
  }
10271
10346
  });
10272
10347
  });
@@ -10285,7 +10360,7 @@ var domain = (program2) => {
10285
10360
 
10286
10361
  // src/cli/command/logs.ts
10287
10362
  import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
10288
- import { log as log27 } from "@awsless/clui";
10363
+ import { log as log29 } from "@awsless/clui";
10289
10364
  import { aws as aws30 } from "@terraforge/aws";
10290
10365
  import chalk6 from "chalk";
10291
10366
  import chunk2 from "chunk";
@@ -10326,7 +10401,7 @@ var logs = (program2) => {
10326
10401
  process.once("SIGINT", () => {
10327
10402
  controller.abort();
10328
10403
  });
10329
- const streams = await log27.task({
10404
+ const streams = await log29.task({
10330
10405
  initialMessage: "Connecting to the log stream...",
10331
10406
  errorMessage: "Failed to connect to the log stream.",
10332
10407
  async task(ctx) {
@@ -10383,7 +10458,7 @@ var formatLog = (level, date, group, message) => {
10383
10458
  SYSTEM: chalk6.blue
10384
10459
  };
10385
10460
  const levelColor = levels[level] ?? chalk6.cyan;
10386
- log27.message(
10461
+ log29.message(
10387
10462
  [
10388
10463
  [
10389
10464
  //
@@ -10424,7 +10499,7 @@ var parseJsonLog = (message) => {
10424
10499
 
10425
10500
  // src/cli/command/image/clear-cache.ts
10426
10501
  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";
10502
+ import { Cancelled as Cancelled4, log as log30, prompt as prompt15 } from "@awsless/clui";
10428
10503
  import { CloudFrontClient as CloudFrontClient2 } from "@aws-sdk/client-cloudfront";
10429
10504
  var clearCache = (program2) => {
10430
10505
  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 +10515,7 @@ var clearCache = (program2) => {
10440
10515
  }
10441
10516
  return;
10442
10517
  });
10443
- stack = await prompt14.select({
10518
+ stack = await prompt15.select({
10444
10519
  message: "Select the stack:",
10445
10520
  options: imageStacks.map((stack2) => ({
10446
10521
  label: stack2.name,
@@ -10457,7 +10532,7 @@ var clearCache = (program2) => {
10457
10532
  if (!names) {
10458
10533
  throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
10459
10534
  }
10460
- name = await prompt14.select({
10535
+ name = await prompt15.select({
10461
10536
  message: "Select the image resource:",
10462
10537
  options: names.map((name2) => ({
10463
10538
  label: name2,
@@ -10465,11 +10540,11 @@ var clearCache = (program2) => {
10465
10540
  }))
10466
10541
  });
10467
10542
  }
10468
- const ok = await prompt14.confirm({
10543
+ const ok = await prompt15.confirm({
10469
10544
  message: `Are you sure you want to clear the cache`
10470
10545
  });
10471
10546
  if (!ok) {
10472
- throw new Cancelled3();
10547
+ throw new Cancelled4();
10473
10548
  }
10474
10549
  const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
10475
10550
  const { workspace } = await createWorkSpace({
@@ -10495,7 +10570,7 @@ var clearCache = (program2) => {
10495
10570
  region
10496
10571
  });
10497
10572
  let totalDeleted = 0;
10498
- await log28.task({
10573
+ await log30.task({
10499
10574
  initialMessage: "Clearing cache...",
10500
10575
  successMessage: "Cache successfully cleared.",
10501
10576
  task: async () => {
@@ -10548,7 +10623,7 @@ var image = (program2) => {
10548
10623
 
10549
10624
  // src/cli/command/icon/clear-cache.ts
10550
10625
  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";
10626
+ import { Cancelled as Cancelled5, log as log31, prompt as prompt16 } from "@awsless/clui";
10552
10627
  import { CloudFrontClient as CloudFrontClient3 } from "@aws-sdk/client-cloudfront";
10553
10628
  var clearCache2 = (program2) => {
10554
10629
  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 +10639,7 @@ var clearCache2 = (program2) => {
10564
10639
  }
10565
10640
  return;
10566
10641
  });
10567
- stack = await prompt15.select({
10642
+ stack = await prompt16.select({
10568
10643
  message: "Select the stack:",
10569
10644
  options: iconStacks.map((stack2) => ({
10570
10645
  label: stack2.name,
@@ -10581,7 +10656,7 @@ var clearCache2 = (program2) => {
10581
10656
  if (!names) {
10582
10657
  throw new ExpectedError(`No icon resources are defined in stack "${stack}".`);
10583
10658
  }
10584
- name = await prompt15.select({
10659
+ name = await prompt16.select({
10585
10660
  message: "Select the icon resource:",
10586
10661
  options: names.map((name2) => ({
10587
10662
  label: name2,
@@ -10589,11 +10664,11 @@ var clearCache2 = (program2) => {
10589
10664
  }))
10590
10665
  });
10591
10666
  }
10592
- const ok = await prompt15.confirm({
10667
+ const ok = await prompt16.confirm({
10593
10668
  message: `Are you sure you want to clear the cache`
10594
10669
  });
10595
10670
  if (!ok) {
10596
- throw new Cancelled4();
10671
+ throw new Cancelled5();
10597
10672
  }
10598
10673
  const { shared, app } = createApp({ appConfig, stackConfigs, accountId });
10599
10674
  const { workspace } = await createWorkSpace({
@@ -10619,7 +10694,7 @@ var clearCache2 = (program2) => {
10619
10694
  region
10620
10695
  });
10621
10696
  let totalDeleted = 0;
10622
- await log29.task({
10697
+ await log31.task({
10623
10698
  initialMessage: "Clearing cache...",
10624
10699
  successMessage: "Cache successfully cleared.",
10625
10700
  task: async () => {
@@ -10671,7 +10746,7 @@ var icon2 = (program2) => {
10671
10746
  };
10672
10747
 
10673
10748
  // src/cli/command/cron/invoke.ts
10674
- import { log as log30, prompt as prompt16 } from "@awsless/clui";
10749
+ import { log as log32, prompt as prompt17 } from "@awsless/clui";
10675
10750
  import { invoke as invokeLambda, LambdaClient as LambdaClient4 } from "@awsless/lambda";
10676
10751
  var invoke = (program2) => {
10677
10752
  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 +10764,7 @@ var invoke = (program2) => {
10689
10764
  if (cronStacks.length === 0) {
10690
10765
  throw new ExpectedError("There are no crons defined inside your app.");
10691
10766
  }
10692
- stack = await prompt16.select({
10767
+ stack = await prompt17.select({
10693
10768
  message: "Select the stack:",
10694
10769
  options: cronStacks.map((stack2) => ({
10695
10770
  label: stack2.name,
@@ -10703,7 +10778,7 @@ var invoke = (program2) => {
10703
10778
  }
10704
10779
  const names = Object.keys(stackConfig.crons ?? {});
10705
10780
  if (!name) {
10706
- name = await prompt16.select({
10781
+ name = await prompt17.select({
10707
10782
  message: "Select the cron:",
10708
10783
  options: names.map((name2) => ({
10709
10784
  label: name2,
@@ -10721,7 +10796,7 @@ var invoke = (program2) => {
10721
10796
  resourceName: name
10722
10797
  });
10723
10798
  const payload = stackConfig.crons?.[name]?.payload ?? {};
10724
- const response = await log30.task({
10799
+ const response = await log32.task({
10725
10800
  initialMessage: "Invoking cron...",
10726
10801
  successMessage: "Done invoking cron.",
10727
10802
  errorMessage: "Failed invoking cron.",
@@ -10736,7 +10811,7 @@ var invoke = (program2) => {
10736
10811
  });
10737
10812
  }
10738
10813
  });
10739
- log30.note("Response", JSON.stringify(response, void 0, 4));
10814
+ log32.note("Response", JSON.stringify(response, void 0, 4));
10740
10815
  });
10741
10816
  });
10742
10817
  };
@@ -10752,7 +10827,7 @@ var cron = (program2) => {
10752
10827
  };
10753
10828
 
10754
10829
  // src/cli/command/activity/logs.ts
10755
- import { log as log31 } from "@awsless/clui";
10830
+ import { log as log33 } from "@awsless/clui";
10756
10831
  import { format as format2 } from "date-fns";
10757
10832
  var logs2 = (program2) => {
10758
10833
  program2.command("logs").option("--limit <number>", "The size limit of logs to tail", "10").description("Tail the activity logs").action(async (options) => {
@@ -10762,7 +10837,7 @@ var logs2 = (program2) => {
10762
10837
  const credentials = await getCredentials(profile);
10763
10838
  const accountId = await getAccountId(credentials, region);
10764
10839
  await bootstrapAwsless({ credentials, region, accountId });
10765
- const logs3 = await log31.task({
10840
+ const logs3 = await log33.task({
10766
10841
  initialMessage: "Loading activity logs",
10767
10842
  successMessage: "Done loading activity logs.",
10768
10843
  errorMessage: "Failed loading activity logs.",
@@ -10783,7 +10858,7 @@ var logs2 = (program2) => {
10783
10858
  };
10784
10859
  for (const item of logs3) {
10785
10860
  const date = new Date(item.date);
10786
- log31.info(
10861
+ log33.info(
10787
10862
  [
10788
10863
  [
10789
10864
  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.641",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -35,21 +35,21 @@
35
35
  "peerDependencies": {
36
36
  "@awsless/big-float": "^0.1.5",
37
37
  "@awsless/clui": "^0.0.8",
38
- "@awsless/cloudwatch": "^0.0.1",
38
+ "@awsless/dynamodb": "^0.3.14",
39
39
  "@awsless/duration": "^0.0.4",
40
40
  "@awsless/iot": "^0.0.3",
41
- "@awsless/dynamodb": "^0.3.14",
41
+ "@awsless/cloudwatch": "^0.0.1",
42
+ "@awsless/json": "^0.0.11",
42
43
  "@awsless/lambda": "^0.0.37",
43
- "@awsless/s3": "^0.0.21",
44
44
  "@awsless/mqtt": "^0.0.2",
45
- "@awsless/redis": "^0.0.14",
46
45
  "@awsless/open-search": "^0.0.21",
47
- "@awsless/validate": "^0.1.5",
46
+ "@awsless/redis": "^0.0.14",
47
+ "@awsless/s3": "^0.0.21",
48
48
  "@awsless/sns": "^0.0.10",
49
49
  "@awsless/sqs": "^0.0.16",
50
- "@awsless/ssm": "^0.0.7",
51
- "@awsless/json": "^0.0.11",
52
- "@awsless/weak-cache": "^0.0.1"
50
+ "@awsless/validate": "^0.1.5",
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",
@@ -114,13 +114,13 @@
114
114
  "zod": "^3.24.2",
115
115
  "zod-to-json-schema": "^3.24.3",
116
116
  "@awsless/big-float": "^0.1.5",
117
+ "@awsless/clui": "^0.0.8",
117
118
  "@awsless/cloudwatch": "^0.0.1",
118
119
  "@awsless/duration": "^0.0.4",
119
120
  "@awsless/json": "^0.0.11",
120
- "@awsless/size": "^0.0.2",
121
- "@awsless/scheduler": "^0.0.4",
122
121
  "@awsless/validate": "^0.1.5",
123
- "@awsless/clui": "^0.0.8",
122
+ "@awsless/scheduler": "^0.0.4",
123
+ "@awsless/size": "^0.0.2",
124
124
  "@awsless/ts-file-cache": "^0.0.12"
125
125
  },
126
126
  "devDependencies": {