@awsless/awsless 0.0.643 → 0.0.645

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
@@ -1053,7 +1053,7 @@ var DomainsDefaultSchema = z10.record(
1053
1053
  ).optional().describe("Define the domains for your application.");
1054
1054
 
1055
1055
  // src/feature/function/schema.ts
1056
- import { days, minutes, seconds, toDays } from "@awsless/duration";
1056
+ import { days, minutes as minutes2, seconds, toDays } from "@awsless/duration";
1057
1057
  import { gibibytes, mebibytes } from "@awsless/size";
1058
1058
  import { z as z15 } from "zod";
1059
1059
 
@@ -1129,7 +1129,7 @@ var sizeMax = (max) => {
1129
1129
  var MemorySizeSchema = SizeSchema.refine(sizeMin(mebibytes(128)), "Minimum memory size is 128 MB").refine(sizeMax(gibibytes(10)), "Maximum memory size is 10 GB").describe(
1130
1130
  "The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The value can be any multiple of 1 MB. You can specify a size value from 128 MB to 10 GB."
1131
1131
  );
1132
- var TimeoutSchema = DurationSchema.refine(durationMin(seconds(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes(15)), "Maximum timeout duration is 15 minutes").describe(
1132
+ var TimeoutSchema = DurationSchema.refine(durationMin(seconds(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes2(15)), "Maximum timeout duration is 15 minutes").describe(
1133
1133
  "The amount of time that Lambda allows a function to run before stopping it. You can specify a size value from 1 second to 15 minutes."
1134
1134
  );
1135
1135
  var EphemeralStorageSizeSchema = SizeSchema.refine(
@@ -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((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"
1261
+ log: LogSchema.default(true).transform((log35) => ({
1262
+ retention: log35.retention ?? days(7),
1263
+ level: "level" in log35 ? log35.level : "error",
1264
+ system: "system" in log35 ? log35.system : "warn",
1265
+ format: "format" in log35 ? log35.format : "json"
1266
1266
  })),
1267
1267
  timeout: TimeoutSchema.default("10 seconds"),
1268
1268
  memorySize: MemorySizeSchema.default("128 MB"),
@@ -1362,11 +1362,11 @@ var PubSubSchema = z19.record(
1362
1362
  ).optional().describe("Define the pubsub subscriber in your stack.");
1363
1363
 
1364
1364
  // src/feature/queue/schema.ts
1365
- import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
1365
+ import { days as days2, hours, minutes as minutes3, seconds as seconds2 } from "@awsless/duration";
1366
1366
  import { kibibytes } from "@awsless/size";
1367
1367
  import { z as z20 } from "zod";
1368
1368
  var RetentionPeriodSchema = DurationSchema.refine(
1369
- durationMin(minutes2(1)),
1369
+ durationMin(minutes3(1)),
1370
1370
  "Minimum retention period is 1 minute"
1371
1371
  ).refine(durationMax(days2(14)), "Maximum retention period is 14 days").describe(
1372
1372
  "The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
@@ -1378,7 +1378,7 @@ var VisibilityTimeoutSchema = DurationSchema.refine(
1378
1378
  "The length of time during which a message will be unavailable after a message is delivered from the queue. This blocks other components from receiving the same message and gives the initial component time to process and delete the message from the queue. You can specify a duration from 0 to 12 hours."
1379
1379
  );
1380
1380
  var DeliveryDelaySchema = DurationSchema.refine(
1381
- durationMax(minutes2(15)),
1381
+ durationMax(minutes3(15)),
1382
1382
  "Maximum delivery delay is 15 minutes"
1383
1383
  ).describe(
1384
1384
  "The time in seconds for which the delivery of all messages in the queue is delayed. You can specify a duration from 0 to 15 minutes."
@@ -1399,7 +1399,7 @@ var MaxConcurrencySchema = z20.number().int().min(2, "Minimum max concurrency is
1399
1399
  "Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
1400
1400
  );
1401
1401
  var MaxBatchingWindow = DurationSchema.refine(
1402
- durationMax(minutes2(5)),
1402
+ durationMax(minutes3(5)),
1403
1403
  "Maximum max batching window is 5 minutes"
1404
1404
  ).describe(
1405
1405
  "The maximum amount of time, that Lambda spends gathering records before invoking the function. You can specify an duration from 0 seconds to 5 minutes."
@@ -1469,11 +1469,11 @@ var RestSchema = z22.record(
1469
1469
  ).optional().describe("Define routes in your stack for your global REST API.");
1470
1470
 
1471
1471
  // src/feature/rpc/schema.ts
1472
- import { minutes as minutes4, seconds as seconds3 } from "@awsless/duration";
1472
+ import { minutes as minutes5, seconds as seconds3 } from "@awsless/duration";
1473
1473
  import { z as z24 } from "zod";
1474
1474
 
1475
1475
  // src/feature/router/schema.ts
1476
- import { days as days3, minutes as minutes3, parse as parse3 } from "@awsless/duration";
1476
+ import { days as days3, minutes as minutes4, parse as parse3 } from "@awsless/duration";
1477
1477
  import { z as z23 } from "zod";
1478
1478
  var ErrorResponsePathSchema = z23.string().describe(
1479
1479
  [
@@ -1538,10 +1538,10 @@ var WafSettingsSchema = z23.object({
1538
1538
  }).optional().describe(
1539
1539
  "Provides protection against automated bots that can consume excess resources, skew business metrics, cause downtime, or perform malicious activities. Bot Control provides additional visibility through Amazon CloudWatch and generates labels that you can use to control bot traffic to your applications. Uses 50 WCU."
1540
1540
  ),
1541
- captchaImmunityTime: DurationSchema.refine(durationMin(minutes3(1)), "Minimum timeout duration is 1 minute").refine(durationMax(days3(3)), "Maximum timeout duration is 3 days").default("5 minutes").describe(
1541
+ captchaImmunityTime: DurationSchema.refine(durationMin(minutes4(1)), "Minimum timeout duration is 1 minute").refine(durationMax(days3(3)), "Maximum timeout duration is 3 days").default("5 minutes").describe(
1542
1542
  "The amount of time that a CAPTCHA timestamp is considered valid by AWS WAF. The default setting is 5 minutes."
1543
1543
  ),
1544
- challengeImmunityTime: DurationSchema.refine(durationMin(minutes3(1)), "Minimum timeout duration is 1 minute").refine(durationMax(days3(3)), "Maximum timeout duration is 3 days").default("5 minutes").describe(
1544
+ challengeImmunityTime: DurationSchema.refine(durationMin(minutes4(1)), "Minimum timeout duration is 1 minute").refine(durationMax(days3(3)), "Maximum timeout duration is 3 days").default("5 minutes").describe(
1545
1545
  "The amount of time that a challenge timestamp is considered valid by AWS WAF. The default setting is 5 minutes."
1546
1546
  )
1547
1547
  }).describe(
@@ -1636,7 +1636,7 @@ var RouterDefaultSchema = z23.record(
1636
1636
  ).optional().describe(`Define the global Router. Backed by AWS CloudFront.`);
1637
1637
 
1638
1638
  // src/feature/rpc/schema.ts
1639
- var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes4(5)), "Maximum timeout duration is 5 minutes").describe(
1639
+ var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes5(5)), "Maximum timeout duration is 5 minutes").describe(
1640
1640
  [
1641
1641
  "The amount of time that the RPC lambda is allowed run before stopping it.",
1642
1642
  "You can specify a timeout from 10 second to 5 minutes.",
@@ -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((log34) => ({
1814
- retention: log34.retention ?? days4(7)
1813
+ log: LogSchema2.default(true).transform((log35) => ({
1814
+ retention: log35.retention ?? days4(7)
1815
1815
  }))
1816
1816
  }).default({});
1817
1817
 
@@ -2368,7 +2368,7 @@ var MetricsSchema = z40.record(
2368
2368
  ).optional().describe("Define the metrics in your stack.");
2369
2369
 
2370
2370
  // src/feature/table/schema.ts
2371
- import { minutes as minutes5, seconds as seconds4 } from "@awsless/duration";
2371
+ import { minutes as minutes6, seconds as seconds4 } from "@awsless/duration";
2372
2372
  import { z as z41 } from "zod";
2373
2373
  var KeySchema = z41.string().min(1).max(255);
2374
2374
  var TablesSchema = z41.record(
@@ -2413,7 +2413,7 @@ var TablesSchema = z41.record(
2413
2413
  batchWindow: DurationSchema.refine(
2414
2414
  durationMin(seconds4(1)),
2415
2415
  "Minimum batch window duration is 1 second"
2416
- ).refine(durationMax(minutes5(5)), "Maximum batch window duration is 5 minutes").optional().describe(
2416
+ ).refine(durationMax(minutes6(5)), "Maximum batch window duration is 5 minutes").optional().describe(
2417
2417
  [
2418
2418
  "The maximum amount of time that is spend gathering records before invoking the function.",
2419
2419
  "You can specify a duration from 1 seconds to 5 minutes."
@@ -4101,7 +4101,7 @@ var cronFeature = defineFeature({
4101
4101
  });
4102
4102
 
4103
4103
  // src/feature/domain/index.ts
4104
- import { minutes as minutes6, toSeconds as toSeconds2 } from "@awsless/duration";
4104
+ import { minutes as minutes7, toSeconds as toSeconds2 } from "@awsless/duration";
4105
4105
  import { Group as Group5 } from "@terraforge/core";
4106
4106
  import { aws as aws6 } from "@terraforge/aws";
4107
4107
  var domainFeature = defineFeature({
@@ -4143,7 +4143,7 @@ var domainFeature = defineFeature({
4143
4143
  zoneId: zone.id,
4144
4144
  name: option(certificate, 0).pipe((r) => r.resourceRecordName),
4145
4145
  type: option(certificate, 0).pipe((r) => r.resourceRecordType),
4146
- ttl: toSeconds2(minutes6(5)),
4146
+ ttl: toSeconds2(minutes7(5)),
4147
4147
  records: [option(certificate, 0).pipe((r) => r.resourceRecordValue)],
4148
4148
  allowOverwrite: true
4149
4149
  });
@@ -4151,7 +4151,7 @@ var domainFeature = defineFeature({
4151
4151
  zoneId: zone.id,
4152
4152
  name: option(certificate, 1).pipe((r) => r.resourceRecordName),
4153
4153
  type: option(certificate, 1).pipe((r) => r.resourceRecordType),
4154
- ttl: toSeconds2(minutes6(5)),
4154
+ ttl: toSeconds2(minutes7(5)),
4155
4155
  records: [option(certificate, 1).pipe((r) => r.resourceRecordValue)],
4156
4156
  allowOverwrite: true
4157
4157
  });
@@ -4186,7 +4186,7 @@ var domainFeature = defineFeature({
4186
4186
  zoneId: zone.id,
4187
4187
  name: option(globalCertificate, 0).pipe((r) => r.resourceRecordName),
4188
4188
  type: option(globalCertificate, 0).pipe((r) => r.resourceRecordType),
4189
- ttl: toSeconds2(minutes6(5)),
4189
+ ttl: toSeconds2(minutes7(5)),
4190
4190
  records: [option(globalCertificate, 0).pipe((r) => r.resourceRecordValue)],
4191
4191
  allowOverwrite: true
4192
4192
  });
@@ -4194,7 +4194,7 @@ var domainFeature = defineFeature({
4194
4194
  zoneId: zone.id,
4195
4195
  name: option(globalCertificate, 1).pipe((r) => r.resourceRecordName),
4196
4196
  type: option(globalCertificate, 1).pipe((r) => r.resourceRecordType),
4197
- ttl: toSeconds2(minutes6(5)),
4197
+ ttl: toSeconds2(minutes7(5)),
4198
4198
  records: [option(globalCertificate, 1).pipe((r) => r.resourceRecordValue)],
4199
4199
  allowOverwrite: true
4200
4200
  });
@@ -4220,7 +4220,7 @@ var domainFeature = defineFeature({
4220
4220
  zoneId: zone.id,
4221
4221
  name: `_amazonses.${props.domain}`,
4222
4222
  type: "TXT",
4223
- ttl: toSeconds2(minutes6(5)),
4223
+ ttl: toSeconds2(minutes7(5)),
4224
4224
  records: [identity.verificationToken]
4225
4225
  });
4226
4226
  const dkim = new aws6.ses.DomainDkim(group2, "dkim", {
@@ -4231,7 +4231,7 @@ var domainFeature = defineFeature({
4231
4231
  zoneId: zone.id,
4232
4232
  type: "CNAME",
4233
4233
  name: dkim.dkimTokens.pipe((t) => `${t.at(i)}._domainkey`),
4234
- ttl: toSeconds2(minutes6(5)),
4234
+ ttl: toSeconds2(minutes7(5)),
4235
4235
  records: [dkim.dkimTokens.pipe((t) => `${t.at(i)}.dkim.amazonses.com`)]
4236
4236
  });
4237
4237
  }
@@ -4244,21 +4244,21 @@ var domainFeature = defineFeature({
4244
4244
  zoneId: zone.id,
4245
4245
  name: mailFrom.mailFromDomain,
4246
4246
  type: "MX",
4247
- ttl: toSeconds2(minutes6(5)),
4247
+ ttl: toSeconds2(minutes7(5)),
4248
4248
  records: [`10 feedback-smtp.${ctx.appConfig.region}.amazonses.com`]
4249
4249
  });
4250
4250
  new aws6.route53.Record(group2, `SPF`, {
4251
4251
  zoneId: zone.id,
4252
4252
  name: mailFrom.mailFromDomain,
4253
4253
  type: "TXT",
4254
- ttl: toSeconds2(minutes6(5)),
4254
+ ttl: toSeconds2(minutes7(5)),
4255
4255
  records: ["v=spf1 include:amazonses.com -all"]
4256
4256
  });
4257
4257
  new aws6.route53.Record(group2, `DMARC`, {
4258
4258
  zoneId: zone.id,
4259
4259
  name: `_dmarc.${props.domain}`,
4260
4260
  type: "TXT",
4261
- ttl: toSeconds2(minutes6(5)),
4261
+ ttl: toSeconds2(minutes7(5)),
4262
4262
  records: ["v=DMARC1; p=none;"]
4263
4263
  });
4264
4264
  const verification = new aws6.ses.DomainIdentityVerification(
@@ -4583,6 +4583,7 @@ var pubsubFeature = defineFeature({
4583
4583
  zoneId: ctx.shared.entry("domain", `zone-id`, props.domain),
4584
4584
  name: domainName,
4585
4585
  type: "CNAME",
4586
+ ttl: minutes(5),
4586
4587
  records: [endpoint.endpointAddress]
4587
4588
  });
4588
4589
  ctx.bind(`PUBSUB_${constantCase5(id)}_ENDPOINT`, domainName);
@@ -6873,7 +6874,7 @@ var buildExecutable = async (input, outputPath, architecture) => {
6873
6874
  }
6874
6875
  if (!result.success) {
6875
6876
  throw new ExpectedError(`Executable build failed:
6876
- ${result.logs?.map((log34) => log34.message).join("\n")}`);
6877
+ ${result.logs?.map((log35) => log35.message).join("\n")}`);
6877
6878
  }
6878
6879
  const file = await readFile4(filePath);
6879
6880
  return {
@@ -9183,10 +9184,10 @@ var startTest = async (props) => {
9183
9184
  tests.push(entry);
9184
9185
  if ("task" in test2) {
9185
9186
  const task2 = test2.task;
9186
- for (const log34 of task2.logs ?? []) {
9187
+ for (const log35 of task2.logs ?? []) {
9187
9188
  entry.logs.push({
9188
- time: log34.time,
9189
- text: log34.content
9189
+ time: log35.time,
9190
+ text: log35.content
9190
9191
  });
9191
9192
  }
9192
9193
  }
@@ -9254,7 +9255,7 @@ var logTestLogs = (event) => {
9254
9255
  ].join(" "),
9255
9256
  color.line(icon.dot)
9256
9257
  );
9257
- log18.message(test2.logs.map((log34) => log34.text).join("\n"));
9258
+ log18.message(test2.logs.map((log35) => log35.text).join("\n"));
9258
9259
  }
9259
9260
  }
9260
9261
  };
@@ -10234,8 +10235,84 @@ var unlock = (program2) => {
10234
10235
  });
10235
10236
  };
10236
10237
 
10238
+ // src/cli/command/state/refresh.ts
10239
+ import { log as log27, prompt as prompt15 } from "@awsless/clui";
10240
+ import { diff } from "@vitest/utils/diff";
10241
+ import { capitalCase as capitalCase4 } from "change-case";
10242
+ import wildstring6 from "wildstring";
10243
+ var refresh = (program2) => {
10244
+ program2.command("refresh").argument("[stacks...]", "Optionally filter stacks to refresh").description(
10245
+ "Compares & syncs the current resource state with the state known to exist in the actual cloud provider."
10246
+ ).action(async (filters) => {
10247
+ await layout("state refresh", async ({ appConfig, stackConfigs }) => {
10248
+ const region = appConfig.region;
10249
+ const profile = appConfig.profile;
10250
+ const credentials = await getCredentials(profile);
10251
+ const accountId = await getAccountId(credentials, region);
10252
+ const { app } = createApp({ appConfig, stackConfigs, accountId });
10253
+ const { workspace } = await createWorkSpace({ credentials, region, accountId });
10254
+ const stackNames = app.stacks.filter((stack) => {
10255
+ return !!filters.find((f) => wildstring6.match(f, stack.name));
10256
+ }).map((s) => s.name);
10257
+ const formattedFilter = stackNames.map((i) => color.info(i)).join(color.dim(", "));
10258
+ if (filters.length > 0 && stackNames.length === 0) {
10259
+ throw new ExpectedError(`The stack filters provided didn't match.`);
10260
+ }
10261
+ if (!process.env.SKIP_PROMPT) {
10262
+ const refreshAll = filters.length === 0;
10263
+ const refreshSingle = filters.length === 1;
10264
+ const ok = await prompt15.confirm({
10265
+ message: refreshAll ? `Are you sure you want to refresh ${color.warning("all")} stacks?` : refreshSingle ? `Are you sure you want to refresh the ${formattedFilter} stack?` : `Are you sure you want to refresh the [ ${formattedFilter} ] stacks?`
10266
+ });
10267
+ if (!ok) {
10268
+ throw new Cancelled();
10269
+ }
10270
+ }
10271
+ const result = await log27.task({
10272
+ initialMessage: "Retrieving the latest state from AWS...",
10273
+ successMessage: "Done retrieving latest state from AWS.",
10274
+ errorMessage: "Failed retrieving latest state from AWS.",
10275
+ task() {
10276
+ return workspace.refresh(app, {
10277
+ filters: stackNames
10278
+ });
10279
+ }
10280
+ });
10281
+ if (!result) {
10282
+ return "Your state is up to date.";
10283
+ }
10284
+ for (const entry of result.operations) {
10285
+ log27.warning([color.warning.bold.inverse(` ${capitalCase4(entry.operation)} `), entry.urn].join("\n"));
10286
+ if (entry.operation === "update") {
10287
+ const diffResult = diff(entry.before, entry.after);
10288
+ if (diffResult) {
10289
+ log27.message(diffResult);
10290
+ }
10291
+ }
10292
+ const message = entry.operation === "update" ? `Are you sure you want to mark this resource as drifted inside your state file?` : `Are you sure you want to delete this resource from your state file?`;
10293
+ const ok = await prompt15.confirm({
10294
+ message,
10295
+ initialValue: false
10296
+ });
10297
+ if (ok) {
10298
+ entry.commit();
10299
+ }
10300
+ }
10301
+ await log27.task({
10302
+ initialMessage: "Saving state changes...",
10303
+ successMessage: "Done storing state changes.",
10304
+ errorMessage: "Failed storing state changes.",
10305
+ task() {
10306
+ return result.commit();
10307
+ }
10308
+ });
10309
+ return;
10310
+ });
10311
+ });
10312
+ };
10313
+
10237
10314
  // src/cli/command/state/index.ts
10238
- var commands4 = [pull, push, unlock];
10315
+ var commands4 = [pull, push, unlock, refresh];
10239
10316
  var state = (program2) => {
10240
10317
  const command = program2.command("state").description(`Manage app state`);
10241
10318
  commands4.forEach((cb) => cb(command));
@@ -10271,7 +10348,7 @@ var types = (program2) => {
10271
10348
  };
10272
10349
 
10273
10350
  // src/cli/command/domain/list.ts
10274
- import { log as log27 } from "@awsless/clui";
10351
+ import { log as log28 } from "@awsless/clui";
10275
10352
  var list2 = (program2) => {
10276
10353
  program2.command("list").description("List all domains").action(async () => {
10277
10354
  await layout("domain list", async ({ appConfig, stackConfigs }) => {
@@ -10292,7 +10369,7 @@ var list2 = (program2) => {
10292
10369
  });
10293
10370
  await workspace.hydrate(app);
10294
10371
  for (const zone of domainZones) {
10295
- log27.step(
10372
+ log28.step(
10296
10373
  [
10297
10374
  //
10298
10375
  color.label.green(await zone.name),
@@ -10300,14 +10377,14 @@ var list2 = (program2) => {
10300
10377
  color.dim(await zone.id)
10301
10378
  ].join(" ")
10302
10379
  );
10303
- log27.message((await zone.nameServers).join("\n"));
10380
+ log28.message((await zone.nameServers).join("\n"));
10304
10381
  }
10305
10382
  });
10306
10383
  });
10307
10384
  };
10308
10385
 
10309
10386
  // src/cli/command/domain/deploy.ts
10310
- import { log as log28 } from "@awsless/clui";
10387
+ import { log as log29 } from "@awsless/clui";
10311
10388
  var deploy2 = (program2) => {
10312
10389
  program2.command("deploy").description("Deploy the domain zones to AWS").action(async () => {
10313
10390
  await layout("domain deploy", async ({ appConfig, stackConfigs }) => {
@@ -10326,7 +10403,7 @@ var deploy2 = (program2) => {
10326
10403
  accountId,
10327
10404
  region
10328
10405
  });
10329
- await log28.task({
10406
+ await log29.task({
10330
10407
  initialMessage: "Deploying the domain zones to AWS...",
10331
10408
  successMessage: "Done deploying the domain zones to AWS.",
10332
10409
  errorMessage: "Failed deploying the domain zones to AWS.",
@@ -10335,7 +10412,7 @@ var deploy2 = (program2) => {
10335
10412
  }
10336
10413
  });
10337
10414
  for (const zone of domainZones) {
10338
- log28.step(
10415
+ log29.step(
10339
10416
  [
10340
10417
  //
10341
10418
  color.label.green(await zone.name),
@@ -10343,7 +10420,7 @@ var deploy2 = (program2) => {
10343
10420
  color.dim(await zone.id)
10344
10421
  ].join(" ")
10345
10422
  );
10346
- log28.message((await zone.nameServers).join("\n"));
10423
+ log29.message((await zone.nameServers).join("\n"));
10347
10424
  }
10348
10425
  });
10349
10426
  });
@@ -10362,12 +10439,12 @@ var domain = (program2) => {
10362
10439
 
10363
10440
  // src/cli/command/logs.ts
10364
10441
  import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
10365
- import { log as log29 } from "@awsless/clui";
10442
+ import { log as log30 } from "@awsless/clui";
10366
10443
  import { aws as aws30 } from "@terraforge/aws";
10367
10444
  import chalk6 from "chalk";
10368
10445
  import chunk2 from "chunk";
10369
10446
  import { formatDate } from "date-fns";
10370
- import wildstring6 from "wildstring";
10447
+ import wildstring7 from "wildstring";
10371
10448
  var logs = (program2) => {
10372
10449
  program2.command("logs").argument(`<stacks...>`, "Provide a list of stacks to stream logs from.").description("Stream the latest logs from you app.").action(async (filters) => {
10373
10450
  await layout(`logs`, async ({ appConfig, stackConfigs }) => {
@@ -10384,7 +10461,7 @@ var logs = (program2) => {
10384
10461
  await workspace.hydrate(app);
10385
10462
  const logGroupArns = [];
10386
10463
  for (const stack of app.stacks) {
10387
- if (filters.find((f) => wildstring6.match(f, stack.name))) {
10464
+ if (filters.find((f) => wildstring7.match(f, stack.name))) {
10388
10465
  for (const resource of stack.resources) {
10389
10466
  if (resource instanceof aws30.cloudwatch.LogGroup) {
10390
10467
  logGroupArns.push(await resource.arn);
@@ -10403,7 +10480,7 @@ var logs = (program2) => {
10403
10480
  process.once("SIGINT", () => {
10404
10481
  controller.abort();
10405
10482
  });
10406
- const streams = await log29.task({
10483
+ const streams = await log30.task({
10407
10484
  initialMessage: "Connecting to the log stream...",
10408
10485
  errorMessage: "Failed to connect to the log stream.",
10409
10486
  async task(ctx) {
@@ -10460,7 +10537,7 @@ var formatLog = (level, date, group, message) => {
10460
10537
  SYSTEM: chalk6.blue
10461
10538
  };
10462
10539
  const levelColor = levels[level] ?? chalk6.cyan;
10463
- log29.message(
10540
+ log30.message(
10464
10541
  [
10465
10542
  [
10466
10543
  //
@@ -10501,7 +10578,7 @@ var parseJsonLog = (message) => {
10501
10578
 
10502
10579
  // src/cli/command/image/clear-cache.ts
10503
10580
  import { DeleteObjectsCommand, ListObjectsV2Command, S3Client as S3Client3 } from "@aws-sdk/client-s3";
10504
- import { Cancelled as Cancelled4, log as log30, prompt as prompt15 } from "@awsless/clui";
10581
+ import { Cancelled as Cancelled4, log as log31, prompt as prompt16 } from "@awsless/clui";
10505
10582
  import { CloudFrontClient as CloudFrontClient2 } from "@aws-sdk/client-cloudfront";
10506
10583
  var clearCache = (program2) => {
10507
10584
  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) => {
@@ -10517,7 +10594,7 @@ var clearCache = (program2) => {
10517
10594
  }
10518
10595
  return;
10519
10596
  });
10520
- stack = await prompt15.select({
10597
+ stack = await prompt16.select({
10521
10598
  message: "Select the stack:",
10522
10599
  options: imageStacks.map((stack2) => ({
10523
10600
  label: stack2.name,
@@ -10534,7 +10611,7 @@ var clearCache = (program2) => {
10534
10611
  if (!names) {
10535
10612
  throw new ExpectedError(`No image resources are defined in stack "${stack}".`);
10536
10613
  }
10537
- name = await prompt15.select({
10614
+ name = await prompt16.select({
10538
10615
  message: "Select the image resource:",
10539
10616
  options: names.map((name2) => ({
10540
10617
  label: name2,
@@ -10542,7 +10619,7 @@ var clearCache = (program2) => {
10542
10619
  }))
10543
10620
  });
10544
10621
  }
10545
- const ok = await prompt15.confirm({
10622
+ const ok = await prompt16.confirm({
10546
10623
  message: `Are you sure you want to clear the cache`
10547
10624
  });
10548
10625
  if (!ok) {
@@ -10572,7 +10649,7 @@ var clearCache = (program2) => {
10572
10649
  region
10573
10650
  });
10574
10651
  let totalDeleted = 0;
10575
- await log30.task({
10652
+ await log31.task({
10576
10653
  initialMessage: "Clearing cache...",
10577
10654
  successMessage: "Cache successfully cleared.",
10578
10655
  task: async () => {
@@ -10625,7 +10702,7 @@ var image = (program2) => {
10625
10702
 
10626
10703
  // src/cli/command/icon/clear-cache.ts
10627
10704
  import { DeleteObjectsCommand as DeleteObjectsCommand2, ListObjectsV2Command as ListObjectsV2Command2, S3Client as S3Client4 } from "@aws-sdk/client-s3";
10628
- import { Cancelled as Cancelled5, log as log31, prompt as prompt16 } from "@awsless/clui";
10705
+ import { Cancelled as Cancelled5, log as log32, prompt as prompt17 } from "@awsless/clui";
10629
10706
  import { CloudFrontClient as CloudFrontClient3 } from "@aws-sdk/client-cloudfront";
10630
10707
  var clearCache2 = (program2) => {
10631
10708
  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) => {
@@ -10641,7 +10718,7 @@ var clearCache2 = (program2) => {
10641
10718
  }
10642
10719
  return;
10643
10720
  });
10644
- stack = await prompt16.select({
10721
+ stack = await prompt17.select({
10645
10722
  message: "Select the stack:",
10646
10723
  options: iconStacks.map((stack2) => ({
10647
10724
  label: stack2.name,
@@ -10658,7 +10735,7 @@ var clearCache2 = (program2) => {
10658
10735
  if (!names) {
10659
10736
  throw new ExpectedError(`No icon resources are defined in stack "${stack}".`);
10660
10737
  }
10661
- name = await prompt16.select({
10738
+ name = await prompt17.select({
10662
10739
  message: "Select the icon resource:",
10663
10740
  options: names.map((name2) => ({
10664
10741
  label: name2,
@@ -10666,7 +10743,7 @@ var clearCache2 = (program2) => {
10666
10743
  }))
10667
10744
  });
10668
10745
  }
10669
- const ok = await prompt16.confirm({
10746
+ const ok = await prompt17.confirm({
10670
10747
  message: `Are you sure you want to clear the cache`
10671
10748
  });
10672
10749
  if (!ok) {
@@ -10696,7 +10773,7 @@ var clearCache2 = (program2) => {
10696
10773
  region
10697
10774
  });
10698
10775
  let totalDeleted = 0;
10699
- await log31.task({
10776
+ await log32.task({
10700
10777
  initialMessage: "Clearing cache...",
10701
10778
  successMessage: "Cache successfully cleared.",
10702
10779
  task: async () => {
@@ -10748,7 +10825,7 @@ var icon2 = (program2) => {
10748
10825
  };
10749
10826
 
10750
10827
  // src/cli/command/cron/invoke.ts
10751
- import { log as log32, prompt as prompt17 } from "@awsless/clui";
10828
+ import { log as log33, prompt as prompt18 } from "@awsless/clui";
10752
10829
  import { invoke as invokeLambda, LambdaClient as LambdaClient4 } from "@awsless/lambda";
10753
10830
  var invoke = (program2) => {
10754
10831
  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) => {
@@ -10766,7 +10843,7 @@ var invoke = (program2) => {
10766
10843
  if (cronStacks.length === 0) {
10767
10844
  throw new ExpectedError("There are no crons defined inside your app.");
10768
10845
  }
10769
- stack = await prompt17.select({
10846
+ stack = await prompt18.select({
10770
10847
  message: "Select the stack:",
10771
10848
  options: cronStacks.map((stack2) => ({
10772
10849
  label: stack2.name,
@@ -10780,7 +10857,7 @@ var invoke = (program2) => {
10780
10857
  }
10781
10858
  const names = Object.keys(stackConfig.crons ?? {});
10782
10859
  if (!name) {
10783
- name = await prompt17.select({
10860
+ name = await prompt18.select({
10784
10861
  message: "Select the cron:",
10785
10862
  options: names.map((name2) => ({
10786
10863
  label: name2,
@@ -10798,7 +10875,7 @@ var invoke = (program2) => {
10798
10875
  resourceName: name
10799
10876
  });
10800
10877
  const payload = stackConfig.crons?.[name]?.payload ?? {};
10801
- const response = await log32.task({
10878
+ const response = await log33.task({
10802
10879
  initialMessage: "Invoking cron...",
10803
10880
  successMessage: "Done invoking cron.",
10804
10881
  errorMessage: "Failed invoking cron.",
@@ -10813,7 +10890,7 @@ var invoke = (program2) => {
10813
10890
  });
10814
10891
  }
10815
10892
  });
10816
- log32.note("Response", JSON.stringify(response, void 0, 4));
10893
+ log33.note("Response", JSON.stringify(response, void 0, 4));
10817
10894
  });
10818
10895
  });
10819
10896
  };
@@ -10829,7 +10906,7 @@ var cron = (program2) => {
10829
10906
  };
10830
10907
 
10831
10908
  // src/cli/command/activity/logs.ts
10832
- import { log as log33 } from "@awsless/clui";
10909
+ import { log as log34 } from "@awsless/clui";
10833
10910
  import { format as format2 } from "date-fns";
10834
10911
  var logs2 = (program2) => {
10835
10912
  program2.command("logs").option("--limit <number>", "The size limit of logs to tail", "10").description("Tail the activity logs").action(async (options) => {
@@ -10839,7 +10916,7 @@ var logs2 = (program2) => {
10839
10916
  const credentials = await getCredentials(profile);
10840
10917
  const accountId = await getAccountId(credentials, region);
10841
10918
  await bootstrapAwsless({ credentials, region, accountId });
10842
- const logs3 = await log33.task({
10919
+ const logs3 = await log34.task({
10843
10920
  initialMessage: "Loading activity logs",
10844
10921
  successMessage: "Done loading activity logs.",
10845
10922
  errorMessage: "Failed loading activity logs.",
@@ -10860,7 +10937,7 @@ var logs2 = (program2) => {
10860
10937
  };
10861
10938
  for (const item of logs3) {
10862
10939
  const date = new Date(item.date);
10863
- log33.info(
10940
+ log34.info(
10864
10941
  [
10865
10942
  [
10866
10943
  color.line.dim(format2(date, "yyyy-MM-dd")),
Binary file
Binary file
@@ -1 +1 @@
1
- e88dbfaefba22668be356305b684c743e037b04a
1
+ 59f2563b81c3c6d1b94cd5d4313598a21b89b366
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.643",
3
+ "version": "0.0.645",
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/cloudwatch": "^0.0.1",
38
+ "@awsless/clui": "^0.0.8",
38
39
  "@awsless/duration": "^0.0.4",
40
+ "@awsless/dynamodb": "^0.3.18",
39
41
  "@awsless/json": "^0.0.11",
40
- "@awsless/iot": "^0.0.3",
41
- "@awsless/lambda": "^0.0.37",
42
- "@awsless/clui": "^0.0.8",
43
- "@awsless/s3": "^0.0.21",
44
- "@awsless/dynamodb": "^0.3.15",
45
42
  "@awsless/mqtt": "^0.0.2",
43
+ "@awsless/lambda": "^0.0.37",
46
44
  "@awsless/redis": "^0.0.14",
47
- "@awsless/validate": "^0.1.5",
48
- "@awsless/weak-cache": "^0.0.1",
49
45
  "@awsless/open-search": "^0.0.21",
50
- "@awsless/sns": "^0.0.10",
46
+ "@awsless/validate": "^0.1.5",
47
+ "@awsless/s3": "^0.0.21",
51
48
  "@awsless/ssm": "^0.0.7",
52
- "@awsless/sqs": "^0.0.16"
49
+ "@awsless/weak-cache": "^0.0.1",
50
+ "@awsless/iot": "^0.0.3",
51
+ "@awsless/sqs": "^0.0.16",
52
+ "@awsless/sns": "^0.0.10"
53
53
  },
54
54
  "dependencies": {
55
55
  "@aws-sdk/client-cloudformation": "^3.369.0",
@@ -68,8 +68,8 @@
68
68
  "@aws-sdk/signature-v4-crt": "^3.816.0",
69
69
  "@clack/prompts": "^0.7.0",
70
70
  "@terraforge/aws": "^6.35.1",
71
- "@terraforge/core": "^0.0.22",
72
- "@terraforge/terraform": "^0.0.19",
71
+ "@terraforge/core": "^0.0.37",
72
+ "@terraforge/terraform": "^0.0.30",
73
73
  "@types/aws-lambda": "^8.10.110",
74
74
  "@types/bun": "1.3.10",
75
75
  "@types/chunk": "^0.0.0",
@@ -114,12 +114,12 @@
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/cloudwatch": "^0.0.1",
118
117
  "@awsless/duration": "^0.0.4",
118
+ "@awsless/json": "^0.0.11",
119
119
  "@awsless/scheduler": "^0.0.4",
120
120
  "@awsless/size": "^0.0.2",
121
121
  "@awsless/validate": "^0.1.5",
122
- "@awsless/json": "^0.0.11",
122
+ "@awsless/cloudwatch": "^0.0.1",
123
123
  "@awsless/clui": "^0.0.8",
124
124
  "@awsless/ts-file-cache": "^0.0.12"
125
125
  },
@@ -139,9 +139,9 @@
139
139
  "build-test-setup": "pnpm tsup src/test/test-global-setup.ts --format esm",
140
140
  "build-prebuild": "pnpm tsup src/prebuild.ts --format esm; bun ./dist/prebuild.js",
141
141
  "build-layers": "mkdir -p dist/layers && cp -r layers/* dist/layers",
142
- "jack": "pnpm tsup ./example/jack/jack.ts --format esm; bun ./dist/jack.js",
143
- "kennedy": "pnpm tsup ./example/kennedy/kennedy.ts --format esm; bun ./dist/kennedy.js",
144
- "tanmay": "pnpm tsup ./example/tanmay/tanmay.ts --format esm; bun ./dist/tanmay.js",
142
+ "jack": "pnpm tsup ./example/jack/jack.ts --format esm --external bun; bun ./dist/jack.js",
143
+ "kennedy": "pnpm tsup ./example/kennedy/kennedy.ts --format esm --external bun; bun ./dist/kennedy.js",
144
+ "tanmay": "pnpm tsup ./example/tanmay/tanmay.ts --format esm --external bun; bun ./dist/tanmay.js",
145
145
  "prepublish": "if pnpm test; then pnpm build; pnpm build-json-schema; pnpm build-test-setup; pnpm build-prebuild; pnpm build-layers; else exit; fi"
146
146
  }
147
147
  }