@awsless/awsless 0.0.550 → 0.0.552

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
@@ -922,11 +922,11 @@ var FunctionDefaultSchema = z14.object({
922
922
  // container
923
923
  warm: WarmSchema.default(0),
924
924
  vpc: VPCSchema.default(false),
925
- log: LogSchema.default(true).transform((log25) => ({
926
- retention: log25.retention ?? days(7),
927
- level: "level" in log25 ? log25.level : "error",
928
- system: "system" in log25 ? log25.system : "warn",
929
- format: "format" in log25 ? log25.format : "json"
925
+ log: LogSchema.default(true).transform((log26) => ({
926
+ retention: log26.retention ?? days(7),
927
+ level: "level" in log26 ? log26.level : "error",
928
+ system: "system" in log26 ? log26.system : "warn",
929
+ format: "format" in log26 ? log26.format : "json"
930
930
  })),
931
931
  timeout: TimeoutSchema.default("10 seconds"),
932
932
  memorySize: MemorySizeSchema.default("128 MB"),
@@ -998,30 +998,32 @@ var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub
998
998
  var PubSubDefaultSchema = z18.record(
999
999
  ResourceIdSchema,
1000
1000
  z18.object({
1001
- auth: FunctionSchema.describe("The authentication function for the pubsub API."),
1001
+ auth: FunctionSchema,
1002
1002
  domain: DomainSchema.optional(),
1003
- subDomain: z18.string().optional(),
1004
- namespaces: z18.array(z18.string()).optional().describe('The namespaces for the PubSub API. If not set, a single "default" namespace is created.'),
1005
- logLevel: z18.enum(["none", "info", "error", "debug", "all"]).optional().describe("The logging level for AppSync API. When set, logging is enabled.")
1003
+ subDomain: z18.string().optional()
1004
+ // auth: z.union([
1005
+ // ResourceIdSchema,
1006
+ // z.object({
1007
+ // authorizer: FunctionSchema,
1008
+ // // ttl: AuthorizerTtl.default('1 hour'),
1009
+ // }),
1010
+ // ]),
1011
+ // policy: z
1012
+ // .object({
1013
+ // publish: z.array(z.string()).optional(),
1014
+ // subscribe: z.array(z.string()).optional(),
1015
+ // })
1016
+ // .optional(),
1006
1017
  })
1007
- ).optional().describe("Define the pubsub API configuration in your stack.");
1018
+ ).optional().describe("Define the pubsub subscriber in your stack.");
1008
1019
  var PubSubSchema = z18.record(
1009
1020
  ResourceIdSchema,
1010
1021
  z18.object({
1011
- channels: z18.array(z18.string()).describe("The event channels this subscriber listens to."),
1012
- filter: z18.object({
1013
- eventType: z18.string().optional().describe("Filter events by event type.")
1014
- // Add more filter options as needed
1015
- // userId: z.string().optional(),
1016
- // custom: z.record(z.string(), z.any()).optional(),
1017
- }).optional().describe("Event filtering options."),
1018
- consumer: FunctionSchema.describe("The consuming lambda function properties."),
1019
- batchSize: z18.number().int().min(1).max(100).default(1).describe("Number of events to batch before invoking the consumer function."),
1020
- retryPolicy: z18.object({
1021
- maxRetries: z18.number().int().min(0).max(3).default(2).describe("Maximum number of retry attempts.")
1022
- }).optional().describe("Retry policy for failed event processing.")
1022
+ sql: z18.string().describe("The SQL statement used to query the IOT topic."),
1023
+ sqlVersion: z18.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
1024
+ consumer: FunctionSchema.describe("The consuming lambda function properties.")
1023
1025
  })
1024
- ).optional().describe("Define the pubsub event subscribers in your stack.");
1026
+ ).optional().describe("Define the pubsub subscriber in your stack.");
1025
1027
 
1026
1028
  // src/feature/queue/schema.ts
1027
1029
  import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
@@ -1284,8 +1286,8 @@ var InstanceDefaultSchema = z23.object({
1284
1286
  permissions: PermissionsSchema2.optional(),
1285
1287
  healthCheck: HealthCheckSchema.optional(),
1286
1288
  // restartPolicy: RestartPolicySchema.default({ enabled: true }),
1287
- log: LogSchema2.default(true).transform((log25) => ({
1288
- retention: log25.retention ?? days3(7)
1289
+ log: LogSchema2.default(true).transform((log26) => ({
1290
+ retention: log26.retention ?? days3(7)
1289
1291
  }))
1290
1292
  }).default({});
1291
1293
 
@@ -3974,137 +3976,87 @@ var formatFullDomainName = (config2, id, subDomain) => {
3974
3976
  var pubsubFeature = defineFeature({
3975
3977
  name: "pubsub",
3976
3978
  onApp(ctx) {
3977
- for (const [id, props] of Object.entries(ctx.appConfig.defaults?.pubsub ?? {})) {
3979
+ for (const [id, props] of Object.entries(ctx.appConfig.defaults.pubsub ?? {})) {
3978
3980
  const group = new Group9(ctx.base, "pubsub", id);
3979
- const shortName = `${ctx.app.name}--${id}`;
3981
+ const { lambda } = createLambdaFunction(group, ctx, "pubsub-authorizer", id, props.auth);
3980
3982
  const name = formatGlobalResourceName({
3981
3983
  appName: ctx.app.name,
3982
3984
  resourceType: "pubsub",
3983
3985
  resourceName: id
3984
3986
  });
3985
- const authGroup = new Group9(group, "auth", "lambda");
3986
- const { lambda: authLambda } = createLambdaFunction(authGroup, ctx, "pubsub", `${id}-auth`, {
3987
- ...props.auth,
3988
- description: `PubSub ${id} authorizer`
3989
- });
3990
- let loggingRole;
3991
- if (props.logLevel) {
3992
- loggingRole = new $9.aws.iam.Role(group, "logging-role", {
3993
- name: shortId(`${name}-logging-role`),
3994
- assumeRolePolicy: JSON.stringify({
3995
- Version: "2012-10-17",
3996
- Statement: [
3997
- {
3998
- Effect: "Allow",
3999
- Principal: {
4000
- Service: "appsync.amazonaws.com"
4001
- },
4002
- Action: "sts:AssumeRole"
4003
- }
4004
- ]
4005
- })
4006
- });
4007
- new $9.aws.iam.RolePolicyAttachment(group, "logs-policy", {
4008
- role: loggingRole.name,
4009
- policyArn: "arn:aws:iam::aws:policy/service-role/AWSAppSyncPushToCloudWatchLogs"
4010
- });
4011
- }
4012
- const api = new $9.aws.appsync.Api(group, "api", {
4013
- name: shortName,
4014
- eventConfig: [
4015
- {
4016
- connectionAuthMode: [{ authType: "AWS_IAM" }, { authType: "AWS_LAMBDA" }],
4017
- authProvider: [
4018
- {
4019
- authType: "AWS_LAMBDA",
4020
- lambdaAuthorizerConfig: [
4021
- {
4022
- authorizerUri: authLambda.arn,
4023
- authorizerResultTtlInSeconds: 300
4024
- }
4025
- ]
4026
- },
4027
- {
4028
- authType: "AWS_IAM"
4029
- }
4030
- ],
4031
- defaultPublishAuthMode: [
4032
- {
4033
- authType: "AWS_IAM"
4034
- }
4035
- ],
4036
- defaultSubscribeAuthMode: [
4037
- {
4038
- authType: "AWS_LAMBDA"
4039
- },
4040
- {
4041
- authType: "AWS_IAM"
4042
- }
4043
- ],
4044
- logConfig: props.logLevel ? [
4045
- {
4046
- logLevel: props.logLevel.toUpperCase(),
4047
- cloudwatchLogsRoleArn: loggingRole.arn
4048
- }
4049
- ] : void 0
4050
- }
4051
- ]
3987
+ const authorizer = new $9.aws.iot.Authorizer(group, "authorizer", {
3988
+ name,
3989
+ authorizerFunctionArn: lambda.arn,
3990
+ status: "ACTIVE",
3991
+ signingDisabled: true,
3992
+ enableCachingForHttp: false
4052
3993
  });
4053
- const namespaces = props.namespaces ?? ["default"];
4054
- for (const namespace of namespaces) {
4055
- new $9.aws.appsync.ChannelNamespace(group, `namespace-${namespace}`, {
4056
- name: namespace,
4057
- apiId: api.apiId
4058
- });
4059
- }
4060
- new $9.aws.lambda.Permission(group, "auth-permission", {
3994
+ new $9.aws.lambda.Permission(group, "permission", {
3995
+ functionName: lambda.functionName,
4061
3996
  action: "lambda:InvokeFunction",
4062
- principal: "appsync.amazonaws.com",
4063
- functionName: authLambda.functionName,
4064
- sourceArn: api.apiArn
3997
+ principal: "iot.amazonaws.com",
3998
+ sourceArn: authorizer.arn
3999
+ });
4000
+ ctx.bind(`PUBSUB_${constantCase5(id)}_AUTHORIZER`, name);
4001
+ const endpoint = $9.aws.iot.getEndpoint(group, "endpoint", {
4002
+ endpointType: "iot:Data-ATS"
4065
4003
  });
4066
4004
  if (props.domain) {
4067
4005
  const domainName = formatFullDomainName(ctx.appConfig, props.domain, props.subDomain);
4068
- const zoneId = ctx.shared.entry("domain", `zone-id`, props.domain);
4069
- const certificateArn = ctx.shared.entry("domain", `certificate-arn`, props.domain);
4070
- const apiDomain = new $9.aws.appsync.DomainName(group, "domain", {
4006
+ new $9.aws.iot.DomainConfiguration(group, "domain", {
4007
+ name,
4071
4008
  domainName,
4072
- certificateArn
4073
- });
4074
- new $9.aws.appsync.DomainNameApiAssociation(group, "domain-association", {
4075
- apiId: api.apiArn,
4076
- domainName: apiDomain.domainName
4009
+ serverCertificateArns: [ctx.shared.entry("domain", `certificate-arn`, props.domain)],
4010
+ authorizerConfig: {
4011
+ defaultAuthorizerName: authorizer.name
4012
+ }
4013
+ // validationCertificate: ctx.shared.get(`global-certificate-${props.domain}-arn`),
4077
4014
  });
4078
4015
  new $9.aws.route53.Record(group, "record", {
4079
- zoneId,
4080
- type: "CNAME",
4016
+ zoneId: ctx.shared.entry("domain", `zone-id`, props.domain),
4081
4017
  name: domainName,
4082
- records: [apiDomain.appsyncDomainName],
4083
- ttl: 300
4018
+ type: "CNAME",
4019
+ records: [endpoint.endpointAddress]
4084
4020
  });
4085
- ctx.bind(`PUBSUB_${constantCase5(id)}_ENDPOINT`, `${domainName}/event`);
4086
- ctx.bind(`PUBSUB_${constantCase5(id)}_REALTIME_ENDPOINT`, `${domainName}/event/realtime`);
4021
+ ctx.bind(`PUBSUB_${constantCase5(id)}_ENDPOINT`, domainName);
4087
4022
  } else {
4088
- ctx.bind(
4089
- `PUBSUB_${constantCase5(id)}_ENDPOINT`,
4090
- api.dns.pipe((dns) => dns.HTTP)
4091
- );
4092
- ctx.bind(
4093
- `PUBSUB_${constantCase5(id)}_REALTIME_ENDPOINT`,
4094
- api.dns.pipe((dns) => dns.REALTIME)
4095
- );
4023
+ ctx.bind(`PUBSUB_${constantCase5(id)}_ENDPOINT`, endpoint.endpointAddress);
4096
4024
  }
4097
4025
  }
4026
+ ctx.addGlobalPermission({
4027
+ actions: [`iot:Publish`],
4028
+ resources: [
4029
+ //
4030
+ `arn:aws:iot:${ctx.appConfig.region}:${ctx.accountId}:topic/*`,
4031
+ `arn:aws:iot:${ctx.appConfig.region}:${ctx.accountId}:topic/${ctx.app.name}/pubsub/*`
4032
+ ]
4033
+ });
4034
+ },
4035
+ onStack(ctx) {
4036
+ for (const [id, props] of Object.entries(ctx.stackConfig.pubsub ?? {})) {
4037
+ const group = new Group9(ctx.stack, "pubsub", id);
4038
+ const { lambda } = createAsyncLambdaFunction(group, ctx, `pubsub`, id, props.consumer);
4039
+ const name = formatLocalResourceName({
4040
+ appName: ctx.app.name,
4041
+ stackName: ctx.stack.name,
4042
+ resourceType: "pubsub",
4043
+ resourceName: id
4044
+ });
4045
+ const topic = new $9.aws.iot.TopicRule(group, "rule", {
4046
+ name: name.replaceAll("-", "_"),
4047
+ enabled: true,
4048
+ sql: props.sql,
4049
+ sqlVersion: props.sqlVersion,
4050
+ lambda: [{ functionArn: lambda.arn }]
4051
+ });
4052
+ new $9.aws.lambda.Permission(group, "permission", {
4053
+ action: "lambda:InvokeFunction",
4054
+ principal: "iot.amazonaws.com",
4055
+ functionName: lambda.functionName,
4056
+ sourceArn: topic.arn
4057
+ });
4058
+ }
4098
4059
  }
4099
- // Note: The onStack method would handle channel namespaces and subscriptions
4100
- // but is commented out for now as it needs to be refactored for AppSync Event API
4101
- // onStack(ctx) {
4102
- // // Channel namespaces and event handlers would be configured here
4103
- // // This would include:
4104
- // // 1. Creating channel namespaces with their own auth modes (overriding defaults)
4105
- // // 2. Setting up event handlers (Lambda functions) for specific channels
4106
- // // 3. Configuring event filtering and routing rules
4107
- // },
4108
4060
  });
4109
4061
 
4110
4062
  // src/feature/queue/index.ts
@@ -5984,6 +5936,10 @@ var testFeature = defineFeature({
5984
5936
  onStack(ctx) {
5985
5937
  if (ctx.stackConfig.tests) {
5986
5938
  ctx.registerTest(ctx.stackConfig.name, ctx.stackConfig.tests);
5939
+ } else {
5940
+ ctx.addWarning({
5941
+ message: `Stack ${color.info(ctx.stack.name)} has no tests defined. Consider adding test cases to ensure stability.`
5942
+ });
5987
5943
  }
5988
5944
  }
5989
5945
  });
@@ -7318,6 +7274,8 @@ import { kebabCase as kebabCase8, constantCase as constantCase15 } from "change-
7318
7274
  import { toSeconds as toSeconds11 } from "@awsless/duration";
7319
7275
  var typeGenCode9 = `
7320
7276
  import { type PutDataProps, putData, batchPutData } from '@awsless/cloudwatch'
7277
+ import { type Duration } from '@awsless/duration'
7278
+ import { type Size } from '@awsless/size'
7321
7279
 
7322
7280
  type PutResponse = ReturnType<typeof putData>
7323
7281
  type Batch = typeof batchPutData
@@ -7822,6 +7780,7 @@ var createApp = (props) => {
7822
7780
  const commands9 = [];
7823
7781
  const configs = /* @__PURE__ */ new Set();
7824
7782
  const tests = [];
7783
+ const warnings = [];
7825
7784
  const builders = [];
7826
7785
  const domainZones = [];
7827
7786
  const readyListeners = [];
@@ -7848,7 +7807,10 @@ var createApp = (props) => {
7848
7807
  appId,
7849
7808
  base,
7850
7809
  zones,
7851
- shared
7810
+ shared,
7811
+ addWarning(props2) {
7812
+ warnings.push(props2);
7813
+ }
7852
7814
  });
7853
7815
  }
7854
7816
  for (const feature of features) {
@@ -7870,6 +7832,9 @@ var createApp = (props) => {
7870
7832
  addAppPermission(permission) {
7871
7833
  appPermissions.push(permission);
7872
7834
  },
7835
+ addWarning(props2) {
7836
+ warnings.push(props2);
7837
+ },
7873
7838
  registerBuild(type, name, builder) {
7874
7839
  builders.push({
7875
7840
  stackName: base.name,
@@ -7935,6 +7900,9 @@ var createApp = (props) => {
7935
7900
  addStackPermission(permission) {
7936
7901
  stackPermissions.push(permission);
7937
7902
  },
7903
+ addWarning(props2) {
7904
+ warnings.push(props2);
7905
+ },
7938
7906
  // onGlobalPolicy(callback) {
7939
7907
  // globalPoliciesListeners.push(callback)
7940
7908
  // },
@@ -8063,6 +8031,7 @@ var createApp = (props) => {
8063
8031
  binds,
8064
8032
  shared,
8065
8033
  configs,
8034
+ warnings,
8066
8035
  builders,
8067
8036
  commands: commands9
8068
8037
  // deploymentLine,
@@ -8331,7 +8300,7 @@ var del2 = (program2) => {
8331
8300
  };
8332
8301
 
8333
8302
  // src/cli/command/deploy.ts
8334
- import { log as log16, prompt as prompt5 } from "@awsless/clui";
8303
+ import { log as log17, prompt as prompt6 } from "@awsless/clui";
8335
8304
  import wildstring4 from "wildstring";
8336
8305
 
8337
8306
  // src/cli/ui/complex/run-tests.ts
@@ -8458,8 +8427,8 @@ var CustomReporter = class {
8458
8427
  this.cache = cache;
8459
8428
  }
8460
8429
  }
8461
- onUserConsoleLog(log25) {
8462
- this.logs.push(log25.content.trimEnd());
8430
+ onUserConsoleLog(log26) {
8431
+ this.logs.push(log26.content.trimEnd());
8463
8432
  }
8464
8433
  runningTask(tasks) {
8465
8434
  return tasks.find((t) => t.result?.state === "run");
@@ -8561,7 +8530,7 @@ var formatResult = (props) => {
8561
8530
  var logTestLogs = (event) => {
8562
8531
  if (event.logs.length > 0) {
8563
8532
  log15.message(color.info.bold.inverse(" LOGS "), color.dim(icon.dot));
8564
- log15.message(event.logs.map((log25) => wrap(log25, { hard: true })).join("\n"));
8533
+ log15.message(event.logs.map((log26) => wrap(log26, { hard: true })).join("\n"));
8565
8534
  }
8566
8535
  };
8567
8536
  var logTestErrors = (event) => {
@@ -8668,6 +8637,29 @@ var runTests = async (tests, stackFilters = [], testFilters = [], opts) => {
8668
8637
  return true;
8669
8638
  };
8670
8639
 
8640
+ // src/cli/ui/complex/show-warnings.ts
8641
+ import { log as log16, prompt as prompt5 } from "@awsless/clui";
8642
+ var showWarnings = async (warnings) => {
8643
+ for (const warning of warnings) {
8644
+ log16.warning(
8645
+ [
8646
+ //
8647
+ color.warning("Warning!"),
8648
+ warning.message
8649
+ ].join("\n")
8650
+ );
8651
+ }
8652
+ if (warnings.length > 0) {
8653
+ const result = await prompt5.confirm({
8654
+ initialValue: false,
8655
+ message: `Some issues remain unresolved. If you continue, your app may not function correctly. Do you still want to proceed?`
8656
+ });
8657
+ if (!result) {
8658
+ throw new Cancelled();
8659
+ }
8660
+ }
8661
+ };
8662
+
8671
8663
  // src/cli/command/deploy.ts
8672
8664
  var deploy = (program2) => {
8673
8665
  program2.command("deploy").argument("[stacks...]", "Optionally filter stacks to deploy").option("--skip-tests", "Skip tests").option("--import", "Import already existing resources").description("Deploy your app to AWS").action(async (filters, options) => {
@@ -8677,12 +8669,13 @@ var deploy = (program2) => {
8677
8669
  const credentials = getCredentials(profile);
8678
8670
  const accountId = await getAccountId(credentials, region);
8679
8671
  await bootstrapAwsless({ credentials, region, accountId });
8680
- const { app, tests, builders, ready } = createApp({
8672
+ const { app, tests, warnings, builders, ready } = createApp({
8681
8673
  appConfig,
8682
8674
  stackConfigs,
8683
8675
  accountId,
8684
8676
  import: options.import
8685
8677
  });
8678
+ await showWarnings(warnings);
8686
8679
  const stackNames = app.stacks.filter((stack) => {
8687
8680
  return !!filters.find((f) => wildstring4.match(f, stack.name));
8688
8681
  }).map((s) => s.name);
@@ -8694,7 +8687,7 @@ var deploy = (program2) => {
8694
8687
  if (!process.env.SKIP_PROMPT) {
8695
8688
  const deployAll = filters.length === 0;
8696
8689
  const deploySingle = filters.length === 1;
8697
- const ok = await prompt5.confirm({
8690
+ const ok = await prompt6.confirm({
8698
8691
  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?`
8699
8692
  });
8700
8693
  if (!ok) {
@@ -8717,7 +8710,7 @@ var deploy = (program2) => {
8717
8710
  profile,
8718
8711
  region
8719
8712
  });
8720
- await log16.task({
8713
+ await log17.task({
8721
8714
  initialMessage: "Deploying the stacks to AWS",
8722
8715
  successMessage: "Done deploying the stacks to AWS.",
8723
8716
  async task() {
@@ -8739,7 +8732,7 @@ import {
8739
8732
  AdminSetUserPasswordCommand,
8740
8733
  CognitoIdentityProviderClient
8741
8734
  } from "@aws-sdk/client-cognito-identity-provider";
8742
- import { prompt as prompt6 } from "@awsless/clui";
8735
+ import { prompt as prompt7 } from "@awsless/clui";
8743
8736
  var create = (program2) => {
8744
8737
  program2.command("create").argument("[name]", "The name of the auth instance").description("Create an user for your userpool").action(async (name) => {
8745
8738
  await layout("auth user create", async ({ appConfig, stackConfigs }) => {
@@ -8751,7 +8744,7 @@ var create = (program2) => {
8751
8744
  throw new ExpectedError("No auth resources are defined.");
8752
8745
  }
8753
8746
  if (!name) {
8754
- name = await prompt6.select({
8747
+ name = await prompt7.select({
8755
8748
  message: "Select the auth userpool:",
8756
8749
  initialValue: Object.keys(appConfig.defaults.auth).at(0),
8757
8750
  options: Object.keys(appConfig.defaults.auth).map((name2) => ({
@@ -8777,7 +8770,7 @@ var create = (program2) => {
8777
8770
  } catch (_) {
8778
8771
  throw new ExpectedError(`The auth userpool hasn't been deployed yet.`);
8779
8772
  }
8780
- const user2 = await prompt6.text({
8773
+ const user2 = await prompt7.text({
8781
8774
  message: "Username:",
8782
8775
  validate(value) {
8783
8776
  if (!value) {
@@ -8786,7 +8779,7 @@ var create = (program2) => {
8786
8779
  return;
8787
8780
  }
8788
8781
  });
8789
- const pass = await prompt6.password({
8782
+ const pass = await prompt7.password({
8790
8783
  message: "Password:",
8791
8784
  validate(value) {
8792
8785
  if (!value) {
@@ -8834,7 +8827,7 @@ var auth = (program2) => {
8834
8827
  };
8835
8828
 
8836
8829
  // src/cli/command/bind.ts
8837
- import { log as log17 } from "@awsless/clui";
8830
+ import { log as log18 } from "@awsless/clui";
8838
8831
  import { constantCase as constantCase16 } from "change-case";
8839
8832
  import { spawn } from "child_process";
8840
8833
  var bind = (program2) => {
@@ -8857,9 +8850,9 @@ var bind = (program2) => {
8857
8850
  env[name] = await value;
8858
8851
  }
8859
8852
  if (Object.keys(env).length > 0) {
8860
- log17.list("Bind Env", env);
8853
+ log18.list("Bind Env", env);
8861
8854
  } else {
8862
- log17.warning("No bindings available.");
8855
+ log18.warning("No bindings available.");
8863
8856
  }
8864
8857
  const configList = opts.config ?? [];
8865
8858
  const configs = {};
@@ -8867,7 +8860,7 @@ var bind = (program2) => {
8867
8860
  configs[`CONFIG_${constantCase16(name)}`] = name;
8868
8861
  }
8869
8862
  if (configList.length ?? 0 > 0) {
8870
- log17.note("Bind Config", configList.map((v) => color.label(constantCase16(v))).join("\n"));
8863
+ log18.note("Bind Config", configList.map((v) => color.label(constantCase16(v))).join("\n"));
8871
8864
  }
8872
8865
  if (commands9.length === 0) {
8873
8866
  return "No command to execute.";
@@ -8926,7 +8919,7 @@ var watchConfig = async (options, resolve, reject) => {
8926
8919
  };
8927
8920
 
8928
8921
  // src/cli/ui/complex/build-types.ts
8929
- import { log as log18 } from "@awsless/clui";
8922
+ import { log as log19 } from "@awsless/clui";
8930
8923
 
8931
8924
  // src/type-gen/generate.ts
8932
8925
  import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
@@ -8960,7 +8953,7 @@ var generateTypes = async (props) => {
8960
8953
  // src/cli/ui/complex/build-types.ts
8961
8954
  var buildTypes = async (props) => {
8962
8955
  await generateTypes(props);
8963
- log18.step("Done generating type definition files.");
8956
+ log19.step("Done generating type definition files.");
8964
8957
  };
8965
8958
 
8966
8959
  // src/cli/command/dev.ts
@@ -8984,7 +8977,7 @@ var dev = (program2) => {
8984
8977
  };
8985
8978
 
8986
8979
  // src/cli/command/resources.ts
8987
- import { log as log19 } from "@awsless/clui";
8980
+ import { log as log20 } from "@awsless/clui";
8988
8981
  import chalk5 from "chalk";
8989
8982
  import wildstring5 from "wildstring";
8990
8983
  var resources = (program2) => {
@@ -9006,15 +8999,15 @@ var resources = (program2) => {
9006
8999
  continue;
9007
9000
  }
9008
9001
  }
9009
- log19.step(chalk5.magenta(stack.name));
9010
- log19.message(stack.resources.map((resource) => formatResource(stack, resource.$.urn)).join("\n"));
9002
+ log20.step(chalk5.magenta(stack.name));
9003
+ log20.message(stack.resources.map((resource) => formatResource(stack, resource.$.urn)).join("\n"));
9011
9004
  }
9012
9005
  });
9013
9006
  });
9014
9007
  };
9015
9008
 
9016
9009
  // src/cli/command/run.ts
9017
- import { prompt as prompt7 } from "@awsless/clui";
9010
+ import { prompt as prompt8 } from "@awsless/clui";
9018
9011
  import { DynamoDBClient, dynamoDBClient } from "@awsless/dynamodb";
9019
9012
  import { iotClient, IoTDataPlaneClient } from "@awsless/iot";
9020
9013
  import { LambdaClient as LambdaClient2, lambdaClient } from "@awsless/lambda";
@@ -9035,7 +9028,7 @@ var run = (program2) => {
9035
9028
  return cmd.name === selected;
9036
9029
  });
9037
9030
  } else {
9038
- command = await prompt7.select({
9031
+ command = await prompt8.select({
9039
9032
  message: "Pick the command you want to run:",
9040
9033
  initialValue: commands9[0],
9041
9034
  options: commands9.map((cmd) => ({
@@ -9091,7 +9084,7 @@ var pull = (program2) => {
9091
9084
  };
9092
9085
 
9093
9086
  // src/cli/command/state/push.ts
9094
- import { prompt as prompt8 } from "@awsless/clui";
9087
+ import { prompt as prompt9 } from "@awsless/clui";
9095
9088
  var push = (program2) => {
9096
9089
  program2.command("push").description("Push the local state to the remote server").action(async () => {
9097
9090
  await layout("state pull", async ({ appConfig, stackConfigs }) => {
@@ -9101,7 +9094,7 @@ var push = (program2) => {
9101
9094
  const accountId = await getAccountId(credentials, region);
9102
9095
  const { app } = createApp({ appConfig, stackConfigs, accountId });
9103
9096
  const { state: state2 } = await createWorkSpace({ credentials, region, accountId, profile });
9104
- const ok = await prompt8.confirm({
9097
+ const ok = await prompt9.confirm({
9105
9098
  message: "Pushing up the local state might corrupt your remote state. Are you sure?",
9106
9099
  initialValue: false
9107
9100
  });
@@ -9115,7 +9108,7 @@ var push = (program2) => {
9115
9108
  };
9116
9109
 
9117
9110
  // src/cli/command/state/unlock.ts
9118
- import { prompt as prompt9 } from "@awsless/clui";
9111
+ import { prompt as prompt10 } from "@awsless/clui";
9119
9112
  var unlock = (program2) => {
9120
9113
  program2.command("unlock").description("Release the lock that ensures sequential deployments").action(async () => {
9121
9114
  await layout("state unlock", async ({ appConfig, stackConfigs }) => {
@@ -9129,7 +9122,7 @@ var unlock = (program2) => {
9129
9122
  if (!isLocked) {
9130
9123
  return "No lock is exists.";
9131
9124
  }
9132
- const ok = await prompt9.confirm({
9125
+ const ok = await prompt10.confirm({
9133
9126
  message: "Releasing the lock that ensures sequential deployments might result in corrupt state if a deployment is still running. Are you sure?",
9134
9127
  initialValue: false
9135
9128
  });
@@ -9179,7 +9172,7 @@ var types = (program2) => {
9179
9172
  };
9180
9173
 
9181
9174
  // src/cli/command/domain/list.ts
9182
- import { log as log20 } from "@awsless/clui";
9175
+ import { log as log21 } from "@awsless/clui";
9183
9176
  var list2 = (program2) => {
9184
9177
  program2.command("list").description("List all domains").action(async () => {
9185
9178
  await layout("domain list", async ({ appConfig, stackConfigs }) => {
@@ -9201,7 +9194,7 @@ var list2 = (program2) => {
9201
9194
  });
9202
9195
  await workspace.hydrate(app);
9203
9196
  for (const zone of domainZones) {
9204
- log20.step(
9197
+ log21.step(
9205
9198
  [
9206
9199
  //
9207
9200
  color.label.green(await zone.name),
@@ -9209,14 +9202,14 @@ var list2 = (program2) => {
9209
9202
  color.dim(await zone.id)
9210
9203
  ].join(" ")
9211
9204
  );
9212
- log20.message((await zone.nameServers).join("\n"));
9205
+ log21.message((await zone.nameServers).join("\n"));
9213
9206
  }
9214
9207
  });
9215
9208
  });
9216
9209
  };
9217
9210
 
9218
9211
  // src/cli/command/domain/deploy.ts
9219
- import { log as log21 } from "@awsless/clui";
9212
+ import { log as log22 } from "@awsless/clui";
9220
9213
  var deploy2 = (program2) => {
9221
9214
  program2.command("deploy").description("Deploy the domain zones to AWS").action(async () => {
9222
9215
  await layout("domain deploy", async ({ appConfig, stackConfigs }) => {
@@ -9236,7 +9229,7 @@ var deploy2 = (program2) => {
9236
9229
  profile,
9237
9230
  region
9238
9231
  });
9239
- await log21.task({
9232
+ await log22.task({
9240
9233
  initialMessage: "Deploying the domain zones to AWS...",
9241
9234
  successMessage: "Done deploying the domain zones to AWS.",
9242
9235
  errorMessage: "Failed deploying the domain zones to AWS.",
@@ -9245,7 +9238,7 @@ var deploy2 = (program2) => {
9245
9238
  }
9246
9239
  });
9247
9240
  for (const zone of domainZones) {
9248
- log21.step(
9241
+ log22.step(
9249
9242
  [
9250
9243
  //
9251
9244
  color.label.green(await zone.name),
@@ -9253,7 +9246,7 @@ var deploy2 = (program2) => {
9253
9246
  color.dim(await zone.id)
9254
9247
  ].join(" ")
9255
9248
  );
9256
- log21.message((await zone.nameServers).join("\n"));
9249
+ log22.message((await zone.nameServers).join("\n"));
9257
9250
  }
9258
9251
  });
9259
9252
  });
@@ -9272,7 +9265,7 @@ var domain = (program2) => {
9272
9265
 
9273
9266
  // src/cli/command/logs.ts
9274
9267
  import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
9275
- import { log as log22 } from "@awsless/clui";
9268
+ import { log as log23 } from "@awsless/clui";
9276
9269
  import chalk6 from "chalk";
9277
9270
  import chunk2 from "chunk";
9278
9271
  import { formatDate } from "date-fns";
@@ -9314,7 +9307,7 @@ var logs = (program2) => {
9314
9307
  process.once("SIGINT", () => {
9315
9308
  abort.abort();
9316
9309
  });
9317
- const streams = await log22.task({
9310
+ const streams = await log23.task({
9318
9311
  initialMessage: "Connecting to the log stream...",
9319
9312
  errorMessage: "Failed to connect to the log stream.",
9320
9313
  async task(update) {
@@ -9371,7 +9364,7 @@ var formatLog = (level, date, group, message) => {
9371
9364
  SYSTEM: chalk6.blue
9372
9365
  };
9373
9366
  const levelColor = levels[level] ?? chalk6.cyan;
9374
- log22.message(
9367
+ log23.message(
9375
9368
  [
9376
9369
  [
9377
9370
  //
@@ -9413,7 +9406,7 @@ var parseJsonLog = (message) => {
9413
9406
  // src/cli/command/image/clear-cache.ts
9414
9407
  import { CloudFrontClient as CloudFrontClient2, CreateInvalidationCommand as CreateInvalidationCommand2 } from "@aws-sdk/client-cloudfront";
9415
9408
  import { DeleteObjectsCommand, ListObjectsV2Command, S3Client as S3Client3 } from "@aws-sdk/client-s3";
9416
- import { Cancelled as Cancelled2, log as log23, prompt as prompt10 } from "@awsless/clui";
9409
+ import { Cancelled as Cancelled2, log as log24, prompt as prompt11 } from "@awsless/clui";
9417
9410
  import { randomUUID } from "crypto";
9418
9411
  var clearCache = (program2) => {
9419
9412
  program2.command("cache-clear").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) => {
@@ -9429,7 +9422,7 @@ var clearCache = (program2) => {
9429
9422
  }
9430
9423
  return;
9431
9424
  });
9432
- stack = await prompt10.select({
9425
+ stack = await prompt11.select({
9433
9426
  message: "Select the stack:",
9434
9427
  options: imageStacks.map((stack2) => ({
9435
9428
  label: stack2.name,
@@ -9446,7 +9439,7 @@ var clearCache = (program2) => {
9446
9439
  if (!names) {
9447
9440
  throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
9448
9441
  }
9449
- name = await prompt10.select({
9442
+ name = await prompt11.select({
9450
9443
  message: "Select the image resource:",
9451
9444
  options: names.map((name2) => ({
9452
9445
  label: name2,
@@ -9454,7 +9447,7 @@ var clearCache = (program2) => {
9454
9447
  }))
9455
9448
  });
9456
9449
  }
9457
- const ok = await prompt10.confirm({
9450
+ const ok = await prompt11.confirm({
9458
9451
  message: `Are you sure you want to clear the cache`
9459
9452
  });
9460
9453
  if (!ok) {
@@ -9485,7 +9478,7 @@ var clearCache = (program2) => {
9485
9478
  region: "us-east-1"
9486
9479
  });
9487
9480
  let totalDeleted = 0;
9488
- await log23.task({
9481
+ await log24.task({
9489
9482
  initialMessage: "Clearing cache...",
9490
9483
  successMessage: "Cache successfully cleared.",
9491
9484
  task: async () => {
@@ -9547,7 +9540,7 @@ var image = (program2) => {
9547
9540
  // src/cli/command/icon/clear-cache.ts
9548
9541
  import { CloudFrontClient as CloudFrontClient3, CreateInvalidationCommand as CreateInvalidationCommand3 } from "@aws-sdk/client-cloudfront";
9549
9542
  import { DeleteObjectsCommand as DeleteObjectsCommand2, ListObjectsV2Command as ListObjectsV2Command2, S3Client as S3Client4 } from "@aws-sdk/client-s3";
9550
- import { Cancelled as Cancelled3, log as log24, prompt as prompt11 } from "@awsless/clui";
9543
+ import { Cancelled as Cancelled3, log as log25, prompt as prompt12 } from "@awsless/clui";
9551
9544
  import { randomUUID as randomUUID2 } from "crypto";
9552
9545
  var clearCache2 = (program2) => {
9553
9546
  program2.command("cache-clear").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) => {
@@ -9563,7 +9556,7 @@ var clearCache2 = (program2) => {
9563
9556
  }
9564
9557
  return;
9565
9558
  });
9566
- stack = await prompt11.select({
9559
+ stack = await prompt12.select({
9567
9560
  message: "Select the stack:",
9568
9561
  options: iconStacks.map((stack2) => ({
9569
9562
  label: stack2.name,
@@ -9580,7 +9573,7 @@ var clearCache2 = (program2) => {
9580
9573
  if (!names) {
9581
9574
  throw new ExpectedError(`No icon resources are defined in stack "${stack}".`);
9582
9575
  }
9583
- name = await prompt11.select({
9576
+ name = await prompt12.select({
9584
9577
  message: "Select the icon resource:",
9585
9578
  options: names.map((name2) => ({
9586
9579
  label: name2,
@@ -9588,7 +9581,7 @@ var clearCache2 = (program2) => {
9588
9581
  }))
9589
9582
  });
9590
9583
  }
9591
- const ok = await prompt11.confirm({
9584
+ const ok = await prompt12.confirm({
9592
9585
  message: `Are you sure you want to clear the cache`
9593
9586
  });
9594
9587
  if (!ok) {
@@ -9619,7 +9612,7 @@ var clearCache2 = (program2) => {
9619
9612
  region: "us-east-1"
9620
9613
  });
9621
9614
  let totalDeleted = 0;
9622
- await log24.task({
9615
+ await log25.task({
9623
9616
  initialMessage: "Clearing cache...",
9624
9617
  successMessage: "Cache successfully cleared.",
9625
9618
  task: async () => {