@awsless/awsless 0.0.287 → 0.0.289

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
@@ -938,7 +938,7 @@ var AppSchema = z17.object({
938
938
  import { glob } from "glob";
939
939
 
940
940
  // src/config/stack.ts
941
- import { z as z31 } from "zod";
941
+ import { z as z32 } from "zod";
942
942
 
943
943
  // src/feature/cache/schema.ts
944
944
  import { z as z18 } from "zod";
@@ -973,20 +973,38 @@ var CachesSchema = z18.record(
973
973
  })
974
974
  ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
975
975
 
976
- // src/feature/config/schema.ts
976
+ // src/feature/command/schema.ts
977
977
  import { z as z19 } from "zod";
978
- var ConfigNameSchema = z19.string().regex(/[a-z0-9\-]/g, "Invalid config name");
979
- var ConfigsSchema = z19.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
978
+ var CommandSchema2 = z19.union([
979
+ z19.object({
980
+ file: LocalFileSchema,
981
+ handler: z19.string().default("default"),
982
+ description: z19.string().optional()
983
+ // options: z.record(ResourceIdSchema, OptionSchema).optional(),
984
+ // arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
985
+ }),
986
+ z19.string().transform((file) => ({
987
+ file,
988
+ handler: "default",
989
+ description: void 0
990
+ }))
991
+ ]);
992
+ var CommandsSchema = z19.record(ResourceIdSchema, CommandSchema2).optional().describe("Define the config values for your stack.");
993
+
994
+ // src/feature/config/schema.ts
995
+ import { z as z20 } from "zod";
996
+ var ConfigNameSchema = z20.string().regex(/[a-z0-9\-]/g, "Invalid config name");
997
+ var ConfigsSchema = z20.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
980
998
 
981
999
  // src/feature/cron/schema/index.ts
982
- import { z as z21 } from "zod";
1000
+ import { z as z22 } from "zod";
983
1001
 
984
1002
  // src/feature/cron/schema/schedule.ts
985
- import { z as z20 } from "zod";
1003
+ import { z as z21 } from "zod";
986
1004
  import { awsCronExpressionValidator } from "aws-cron-expression-validator";
987
- var RateExpressionSchema = z20.custom(
1005
+ var RateExpressionSchema = z21.custom(
988
1006
  (value) => {
989
- return z20.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
1007
+ return z21.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
990
1008
  const [str] = rate.split(" ");
991
1009
  const number = parseInt(str);
992
1010
  return number > 0;
@@ -1002,9 +1020,9 @@ var RateExpressionSchema = z20.custom(
1002
1020
  }
1003
1021
  return `rate(${rate})`;
1004
1022
  });
1005
- var CronExpressionSchema = z20.custom(
1023
+ var CronExpressionSchema = z21.custom(
1006
1024
  (value) => {
1007
- return z20.string().safeParse(value).success;
1025
+ return z21.string().safeParse(value).success;
1008
1026
  },
1009
1027
  { message: "Invalid cron expression" }
1010
1028
  ).superRefine((value, ctx) => {
@@ -1013,12 +1031,12 @@ var CronExpressionSchema = z20.custom(
1013
1031
  } catch (error) {
1014
1032
  if (error instanceof Error) {
1015
1033
  ctx.addIssue({
1016
- code: z20.ZodIssueCode.custom,
1034
+ code: z21.ZodIssueCode.custom,
1017
1035
  message: `Invalid cron expression: ${error.message}`
1018
1036
  });
1019
1037
  } else {
1020
1038
  ctx.addIssue({
1021
- code: z20.ZodIssueCode.custom,
1039
+ code: z21.ZodIssueCode.custom,
1022
1040
  message: "Invalid cron expression"
1023
1041
  });
1024
1042
  }
@@ -1029,15 +1047,15 @@ var CronExpressionSchema = z20.custom(
1029
1047
  var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
1030
1048
 
1031
1049
  // src/feature/cron/schema/index.ts
1032
- var CronsSchema = z21.record(
1050
+ var CronsSchema = z22.record(
1033
1051
  ResourceIdSchema,
1034
- z21.object({
1035
- enabled: z21.boolean().default(true).describe("If the cron is enabled."),
1052
+ z22.object({
1053
+ enabled: z22.boolean().default(true).describe("If the cron is enabled."),
1036
1054
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
1037
1055
  schedule: ScheduleExpressionSchema.describe(
1038
1056
  'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
1039
1057
  ),
1040
- payload: z21.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
1058
+ payload: z22.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
1041
1059
  })
1042
1060
  ).optional();
1043
1061
 
@@ -1047,21 +1065,21 @@ var OnFailureSchema = FunctionSchema.optional().describe(
1047
1065
  );
1048
1066
 
1049
1067
  // src/feature/pubsub/schema.ts
1050
- import { z as z22 } from "zod";
1051
- var PubSubSchema = z22.record(
1068
+ import { z as z23 } from "zod";
1069
+ var PubSubSchema = z23.record(
1052
1070
  ResourceIdSchema,
1053
- z22.object({
1054
- sql: z22.string().describe("The SQL statement used to query the IOT topic."),
1055
- sqlVersion: z22.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."),
1071
+ z23.object({
1072
+ sql: z23.string().describe("The SQL statement used to query the IOT topic."),
1073
+ sqlVersion: z23.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."),
1056
1074
  consumer: FunctionSchema.describe("The consuming lambda function properties.")
1057
1075
  })
1058
1076
  ).optional().describe("Define the pubsub subscriber in your stack.");
1059
1077
 
1060
1078
  // src/feature/search/schema.ts
1061
1079
  import { gibibytes as gibibytes2 } from "@awsless/size";
1062
- import { z as z23 } from "zod";
1063
- var VersionSchema = z23.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
1064
- var TypeSchema3 = z23.enum([
1080
+ import { z as z24 } from "zod";
1081
+ var VersionSchema = z24.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
1082
+ var TypeSchema3 = z24.enum([
1065
1083
  "t3.small",
1066
1084
  "t3.medium",
1067
1085
  "m3.medium",
@@ -1136,41 +1154,41 @@ var TypeSchema3 = z23.enum([
1136
1154
  "r6gd.16xlarge"
1137
1155
  ]);
1138
1156
  var StorageSizeSchema = SizeSchema.refine(sizeMin(gibibytes2(10)), "Minimum storage size is 10 GB").refine(sizeMax(gibibytes2(100)), "Maximum storage size is 100 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GiB.");
1139
- var SearchsSchema = z23.record(
1157
+ var SearchsSchema = z24.record(
1140
1158
  ResourceIdSchema,
1141
- z23.object({
1159
+ z24.object({
1142
1160
  type: TypeSchema3.default("t3.small"),
1143
- count: z23.number().int().min(1).default(1),
1161
+ count: z24.number().int().min(1).default(1),
1144
1162
  version: VersionSchema.default("2.13"),
1145
1163
  storage: StorageSizeSchema.default("10 GB"),
1146
- vpc: z23.boolean().default(false)
1164
+ vpc: z24.boolean().default(false)
1147
1165
  })
1148
1166
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
1149
1167
 
1150
1168
  // src/feature/site/schema.ts
1151
- import { z as z24 } from "zod";
1152
- var ErrorResponsePathSchema = z24.string().describe(
1169
+ import { z as z25 } from "zod";
1170
+ var ErrorResponsePathSchema = z25.string().describe(
1153
1171
  "The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.\n - We recommend that you store custom error pages in an Amazon S3 bucket. If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable."
1154
1172
  );
1155
- var StatusCodeSchema = z24.number().int().positive().optional().describe(
1173
+ var StatusCodeSchema = z25.number().int().positive().optional().describe(
1156
1174
  "The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:\n- Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200, the response typically won't be intercepted.\n- If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.\n- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down."
1157
1175
  );
1158
1176
  var MinTTLSchema = DurationSchema.describe(
1159
1177
  "The minimum amount of time, that you want to cache the error response. When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available."
1160
1178
  );
1161
- var ErrorResponseSchema = z24.union([
1179
+ var ErrorResponseSchema = z25.union([
1162
1180
  ErrorResponsePathSchema,
1163
- z24.object({
1181
+ z25.object({
1164
1182
  path: ErrorResponsePathSchema,
1165
1183
  statusCode: StatusCodeSchema.optional(),
1166
1184
  minTTL: MinTTLSchema.optional()
1167
1185
  })
1168
1186
  ]).optional();
1169
- var SitesSchema = z24.record(
1187
+ var SitesSchema = z25.record(
1170
1188
  ResourceIdSchema,
1171
- z24.object({
1189
+ z25.object({
1172
1190
  domain: ResourceIdSchema.describe("The domain id to link your site with."),
1173
- subDomain: z24.string().optional(),
1191
+ subDomain: z25.string().optional(),
1174
1192
  // bind: z
1175
1193
  // .object({
1176
1194
  // auth: z.array(ResourceIdSchema),
@@ -1193,7 +1211,7 @@ var SitesSchema = z24.record(
1193
1211
  // build: z.string().optional(),
1194
1212
  // }),
1195
1213
  // ]),
1196
- errors: z24.object({
1214
+ errors: z25.object({
1197
1215
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
1198
1216
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
1199
1217
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -1206,16 +1224,16 @@ var SitesSchema = z24.record(
1206
1224
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
1207
1225
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
1208
1226
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
1209
- cors: z24.object({
1210
- override: z24.boolean().default(false),
1227
+ cors: z25.object({
1228
+ override: z25.boolean().default(false),
1211
1229
  maxAge: DurationSchema.default("365 days"),
1212
- exposeHeaders: z24.string().array().optional(),
1213
- credentials: z24.boolean().default(false),
1214
- headers: z24.string().array().default(["*"]),
1215
- origins: z24.string().array().default(["*"]),
1216
- methods: z24.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
1230
+ exposeHeaders: z25.string().array().optional(),
1231
+ credentials: z25.boolean().default(false),
1232
+ headers: z25.string().array().default(["*"]),
1233
+ origins: z25.string().array().default(["*"]),
1234
+ methods: z25.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
1217
1235
  }).optional().describe("Define the cors headers."),
1218
- security: z24.object({
1236
+ security: z25.object({
1219
1237
  // contentSecurityPolicy: z.object({
1220
1238
  // override: z.boolean().default(false),
1221
1239
  // policy: z.string(),
@@ -1257,10 +1275,10 @@ var SitesSchema = z24.record(
1257
1275
  // reportUri?: string
1258
1276
  // }
1259
1277
  }).optional().describe("Define the security policy."),
1260
- cache: z24.object({
1261
- cookies: z24.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
1262
- headers: z24.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
1263
- queries: z24.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
1278
+ cache: z25.object({
1279
+ cookies: z25.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
1280
+ headers: z25.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
1281
+ queries: z25.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
1264
1282
  }).optional().describe(
1265
1283
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
1266
1284
  )
@@ -1268,21 +1286,21 @@ var SitesSchema = z24.record(
1268
1286
  ).optional().describe("Define the sites in your stack.");
1269
1287
 
1270
1288
  // src/feature/store/schema.ts
1271
- import { z as z25 } from "zod";
1272
- var StoresSchema = z25.union([
1273
- z25.array(ResourceIdSchema).transform((list4) => {
1289
+ import { z as z26 } from "zod";
1290
+ var StoresSchema = z26.union([
1291
+ z26.array(ResourceIdSchema).transform((list4) => {
1274
1292
  const stores = {};
1275
1293
  for (const key of list4) {
1276
1294
  stores[key] = {};
1277
1295
  }
1278
1296
  return stores;
1279
1297
  }),
1280
- z25.record(
1298
+ z26.record(
1281
1299
  ResourceIdSchema,
1282
- z25.object({
1300
+ z26.object({
1283
1301
  // cors: CorsSchema,
1284
- versioning: z25.boolean().default(false).describe("Enable versioning of your store."),
1285
- events: z25.object({
1302
+ versioning: z26.boolean().default(false).describe("Enable versioning of your store."),
1303
+ events: z26.object({
1286
1304
  // create
1287
1305
  "created:*": FunctionSchema.optional().describe(
1288
1306
  "Subscribe to notifications regardless of the API that was used to create an object."
@@ -1315,22 +1333,22 @@ var StoresSchema = z25.union([
1315
1333
  ]).optional().describe("Define the stores in your stack.");
1316
1334
 
1317
1335
  // src/feature/stream/schema.ts
1318
- import { z as z26 } from "zod";
1319
- var LatencyModeSchema = z26.enum(["low", "normal"]).describe(
1336
+ import { z as z27 } from "zod";
1337
+ var LatencyModeSchema = z27.enum(["low", "normal"]).describe(
1320
1338
  `Channel latency mode. Valid values:
1321
1339
  - normal: Use "normal" to broadcast and deliver live video up to Full HD.
1322
1340
  - low: Use "low" for near real-time interactions with viewers.`
1323
1341
  );
1324
- var TypeSchema4 = z26.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
1342
+ var TypeSchema4 = z27.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
1325
1343
  If you exceed the allowable resolution or bitrate, the stream probably will disconnect immediately. Valid values:
1326
1344
  - standard: Video is transcoded: multiple qualities are generated from the original input to automatically give viewers the best experience for their devices and network conditions. Transcoding allows higher playback quality across a range of download speeds. Resolution can be up to 1080p and bitrate can be up to 8.5 Mbps. Audio is transcoded only for renditions 360p and below; above that, audio is passed through.
1327
1345
  - basic: Video is transmuxed: Amazon IVS delivers the original input to viewers. The viewer's video-quality choice is limited to the original input. Resolution can be up to 1080p and bitrate can be up to 1.5 Mbps for 480p and up to 3.5 Mbps for resolutions between 480p and 1080p.
1328
1346
  - advanced-sd: Video is transcoded; multiple qualities are generated from the original input, to automatically give viewers the best experience for their devices and network conditions. Input resolution can be up to 1080p and bitrate can be up to 8.5 Mbps; output is capped at SD quality (480p). You can select an optional transcode preset (see below). Audio for all renditions is transcoded, and an audio-only rendition is available.
1329
1347
  - advanced-hd: Video is transcoded; multiple qualities are generated from the original input, to automatically give viewers the best experience for their devices and network conditions. Input resolution can be up to 1080p and bitrate can be up to 8.5 Mbps; output is capped at HD quality (720p). You can select an optional transcode preset (see below). Audio for all renditions is transcoded, and an audio-only rendition is available.
1330
1348
  `);
1331
- var StreamsSchema = z26.record(
1349
+ var StreamsSchema = z27.record(
1332
1350
  ResourceIdSchema,
1333
- z26.object({
1351
+ z27.object({
1334
1352
  type: TypeSchema4.default("standard"),
1335
1353
  // preset: PresetSchema.optional(),
1336
1354
  latencyMode: LatencyModeSchema.default("low")
@@ -1338,36 +1356,36 @@ var StreamsSchema = z26.record(
1338
1356
  ).optional().describe("Define the streams in your stack.");
1339
1357
 
1340
1358
  // src/feature/table/schema.ts
1341
- import { z as z27 } from "zod";
1342
- var KeySchema = z27.string().min(1).max(255);
1343
- var TablesSchema = z27.record(
1359
+ import { z as z28 } from "zod";
1360
+ var KeySchema = z28.string().min(1).max(255);
1361
+ var TablesSchema = z28.record(
1344
1362
  ResourceIdSchema,
1345
- z27.object({
1363
+ z28.object({
1346
1364
  hash: KeySchema.describe(
1347
1365
  "Specifies the name of the partition / hash key that makes up the primary key for the table."
1348
1366
  ),
1349
1367
  sort: KeySchema.optional().describe(
1350
1368
  "Specifies the name of the range / sort key that makes up the primary key for the table."
1351
1369
  ),
1352
- fields: z27.record(z27.string(), z27.enum(["string", "number", "binary"])).optional().describe(
1370
+ fields: z28.record(z28.string(), z28.enum(["string", "number", "binary"])).optional().describe(
1353
1371
  'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
1354
1372
  ),
1355
- class: z27.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1356
- pointInTimeRecovery: z27.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1373
+ class: z28.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1374
+ pointInTimeRecovery: z28.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1357
1375
  timeToLiveAttribute: KeySchema.optional().describe(
1358
1376
  "The name of the TTL attribute used to store the expiration time for items in the table. To update this property, you must first disable TTL and then enable TTL with the new attribute name."
1359
1377
  ),
1360
- stream: z27.object({
1361
- type: z27.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1378
+ stream: z28.object({
1379
+ type: z28.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1362
1380
  "When an item in the table is modified, stream.type determines what information is written to the stream for this table. Valid values are:\n- keys-only - Only the key attributes of the modified item are written to the stream.\n- new-image - The entire item, as it appears after it was modified, is written to the stream.\n- old-image - The entire item, as it appeared before it was modified, is written to the stream.\n- new-and-old-images - Both the new and the old item images of the item are written to the stream."
1363
1381
  ),
1364
1382
  consumer: FunctionSchema.describe("The consuming lambda function for the stream")
1365
1383
  }).optional().describe(
1366
1384
  "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
1367
1385
  ),
1368
- indexes: z27.record(
1369
- z27.string(),
1370
- z27.object({
1386
+ indexes: z28.record(
1387
+ z28.string(),
1388
+ z28.object({
1371
1389
  /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
1372
1390
  hash: KeySchema,
1373
1391
  /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
@@ -1377,51 +1395,52 @@ var TablesSchema = z27.record(
1377
1395
  * - keys-only - Only the index and primary keys are projected into the index.
1378
1396
  * @default 'all'
1379
1397
  */
1380
- projection: z27.enum(["all", "keys-only"]).default("all")
1398
+ projection: z28.enum(["all", "keys-only"]).default("all")
1381
1399
  })
1382
1400
  ).optional().describe("Specifies the global secondary indexes to be created on the table.")
1383
1401
  })
1384
1402
  ).optional().describe("Define the tables in your stack.");
1385
1403
 
1386
1404
  // src/feature/task/schema.ts
1387
- import { z as z28 } from "zod";
1388
- var RetryAttemptsSchema2 = z28.number().int().min(0).max(2).describe(
1405
+ import { z as z29 } from "zod";
1406
+ var RetryAttemptsSchema2 = z29.number().int().min(0).max(2).describe(
1389
1407
  "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1390
1408
  );
1391
- var TaskSchema = z28.union([
1409
+ var TaskSchema = z29.union([
1392
1410
  LocalFileSchema.transform((file) => ({
1393
1411
  consumer: { file },
1394
1412
  retryAttempts: void 0
1395
1413
  })),
1396
- z28.object({
1414
+ z29.object({
1397
1415
  consumer: FunctionSchema,
1398
1416
  retryAttempts: RetryAttemptsSchema2.optional()
1399
1417
  })
1400
1418
  ]);
1401
- var TasksSchema = z28.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1419
+ var TasksSchema = z29.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1402
1420
 
1403
1421
  // src/feature/test/schema.ts
1404
- import { z as z29 } from "zod";
1405
- var TestsSchema = z29.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1422
+ import { z as z30 } from "zod";
1423
+ var TestsSchema = z30.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
1406
1424
 
1407
1425
  // src/feature/topic/schema.ts
1408
1426
  import { paramCase as paramCase2 } from "change-case";
1409
- import { z as z30 } from "zod";
1410
- var TopicNameSchema = z30.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase2(value)).describe("Define event topic name.");
1411
- var TopicsSchema = z30.array(TopicNameSchema).refine((topics) => {
1427
+ import { z as z31 } from "zod";
1428
+ var TopicNameSchema = z31.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => paramCase2(value)).describe("Define event topic name.");
1429
+ var TopicsSchema = z31.array(TopicNameSchema).refine((topics) => {
1412
1430
  return topics.length === new Set(topics).size;
1413
1431
  }, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
1414
- var SubscribersSchema = z30.record(TopicNameSchema, z30.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
1432
+ var SubscribersSchema = z31.record(TopicNameSchema, z31.union([EmailSchema, FunctionSchema])).optional().describe("Define the event topics to subscribe too in your stack.");
1415
1433
 
1416
1434
  // src/config/stack.ts
1417
1435
  var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
1418
1436
  var NameSchema = ResourceIdSchema.refine((name) => !["base"].includes(name), {
1419
1437
  message: `Stack name can't be a reserved name.`
1420
1438
  }).describe("Stack name.");
1421
- var StackSchema = z31.object({
1422
- $schema: z31.string().optional(),
1439
+ var StackSchema = z32.object({
1440
+ $schema: z32.string().optional(),
1423
1441
  name: NameSchema,
1424
1442
  depends: DependsSchema,
1443
+ commands: CommandsSchema,
1425
1444
  onFailure: OnFailureSchema,
1426
1445
  auth: AuthSchema,
1427
1446
  graphql: GraphQLSchema,
@@ -1477,13 +1496,13 @@ var readConfigWithStage = async (file, stage) => {
1477
1496
  };
1478
1497
 
1479
1498
  // src/config/load/validate.ts
1480
- import { z as z32 } from "zod";
1499
+ import { z as z33 } from "zod";
1481
1500
  var validateConfig = async (schema, file, data) => {
1482
1501
  try {
1483
1502
  const result = await schema.parseAsync(data);
1484
1503
  return result;
1485
1504
  } catch (error) {
1486
- if (error instanceof z32.ZodError) {
1505
+ if (error instanceof z33.ZodError) {
1487
1506
  throw new ConfigError(file, error, data);
1488
1507
  }
1489
1508
  throw error;
@@ -2545,6 +2564,16 @@ var cacheFeature = defineFeature({
2545
2564
  }
2546
2565
  });
2547
2566
 
2567
+ // src/feature/command/index.ts
2568
+ var commandFeature = defineFeature({
2569
+ name: "command",
2570
+ onStack(ctx) {
2571
+ for (const [name, props] of Object.entries(ctx.stackConfig.commands ?? {})) {
2572
+ ctx.registerCommand({ name, ...props });
2573
+ }
2574
+ }
2575
+ });
2576
+
2548
2577
  // src/feature/config/index.ts
2549
2578
  import { paramCase as paramCase4 } from "change-case";
2550
2579
 
@@ -3538,6 +3567,7 @@ var instanceFeature = defineFeature({
3538
3567
  ...Object.entries(env).map(([key, value]) => {
3539
3568
  return `echo export ${key}="${unwrap(value)}" >> /etc/profile`;
3540
3569
  }),
3570
+ // log group name
3541
3571
  `echo export CLOUDWATCH_LOG_GROUP_NAME="/awsless/instance/${name}" >> /etc/profile`,
3542
3572
  // user environment vars
3543
3573
  ...Object.entries(props.environment ?? {}).map(([key, value]) => {
@@ -4539,6 +4569,7 @@ var features = [
4539
4569
  // 1
4540
4570
  vpcFeature,
4541
4571
  domainFeature,
4572
+ commandFeature,
4542
4573
  onFailureFeature,
4543
4574
  // 2
4544
4575
  authFeature,
@@ -4598,7 +4629,7 @@ var createApp = (props, filters = []) => {
4598
4629
  const app = new App2(props.appConfig.name);
4599
4630
  const base = new Stack(app, "base");
4600
4631
  const shared = new SharedData();
4601
- const siteFunctions = [];
4632
+ const commands7 = [];
4602
4633
  const configs = /* @__PURE__ */ new Set();
4603
4634
  const tests = [];
4604
4635
  const builders = [];
@@ -4638,6 +4669,9 @@ var createApp = (props, filters = []) => {
4638
4669
  registerBuild(type, name, builder) {
4639
4670
  builders.push({ type, name, builder });
4640
4671
  },
4672
+ registerCommand(command) {
4673
+ commands7.push(command);
4674
+ },
4641
4675
  // registerSiteFunction(lambda) {
4642
4676
  // siteFunctions.push(lambda)
4643
4677
  // },
@@ -4705,6 +4739,9 @@ var createApp = (props, filters = []) => {
4705
4739
  registerConfig(name) {
4706
4740
  configs.add(name);
4707
4741
  },
4742
+ registerCommand(command) {
4743
+ commands7.push(command);
4744
+ },
4708
4745
  // registerSiteFunction(lambda) {
4709
4746
  // siteFunctions.push(lambda)
4710
4747
  // },
@@ -4777,7 +4814,8 @@ var createApp = (props, filters = []) => {
4777
4814
  binds,
4778
4815
  shared,
4779
4816
  configs,
4780
- builders
4817
+ builders,
4818
+ commands: commands7
4781
4819
  // deploymentLine,
4782
4820
  };
4783
4821
  };
@@ -5571,6 +5609,63 @@ var resource = (program2) => {
5571
5609
  commands4.forEach((cb) => cb(command));
5572
5610
  };
5573
5611
 
5612
+ // src/cli/command/run.ts
5613
+ import { isCancel, select as select2 } from "@clack/prompts";
5614
+ import minimist from "minimist";
5615
+ import { tsImport } from "tsx/esm/api";
5616
+ var run = (program2) => {
5617
+ program2.command("run").allowUnknownOption(true).argument("[command]", "The command you want to run").description("Run one of your defined commands.").action(async (selected) => {
5618
+ await layout(`run ${selected}`, async ({ appConfig, stackConfigs }) => {
5619
+ const region = appConfig.region;
5620
+ const credentials = getCredentials(appConfig.profile);
5621
+ const accountId = await getAccountId(credentials, region);
5622
+ const { commands: commands7 } = createApp({ appConfig, stackConfigs, accountId });
5623
+ let command;
5624
+ if (selected) {
5625
+ command = commands7.find((cmd) => {
5626
+ return cmd.name === selected;
5627
+ });
5628
+ } else {
5629
+ const selected2 = await select2({
5630
+ message: "Pick the command you want to run:",
5631
+ initialValue: commands7[0],
5632
+ options: commands7.map((cmd) => ({
5633
+ value: cmd,
5634
+ label: cmd.name,
5635
+ hint: cmd.description
5636
+ }))
5637
+ });
5638
+ if (isCancel(selected2)) {
5639
+ throw new Cancelled();
5640
+ }
5641
+ command = selected2;
5642
+ }
5643
+ if (!command) {
5644
+ throw new Error(`The provided command doesn't exist.`);
5645
+ }
5646
+ process.env.APP = appConfig.name;
5647
+ const module = await tsImport(command.file, {
5648
+ parentURL: import.meta.url
5649
+ });
5650
+ const handler = module[command.handler];
5651
+ if (!handler) {
5652
+ throw new Error(`No "${command.handler}" handler found.`);
5653
+ }
5654
+ const result = await task("Running", (update) => {
5655
+ const options = minimist(program2.args);
5656
+ delete options._;
5657
+ return handler(options, {
5658
+ region,
5659
+ credentials,
5660
+ accountId,
5661
+ update
5662
+ });
5663
+ });
5664
+ return result;
5665
+ });
5666
+ });
5667
+ };
5668
+
5574
5669
  // src/cli/command/state/pull.ts
5575
5670
  var pull = (program2) => {
5576
5671
  program2.command("pull").description("Pull the remote state and store it locally").action(async () => {
@@ -5680,6 +5775,7 @@ var commands6 = [
5680
5775
  del2,
5681
5776
  dev,
5682
5777
  bind,
5778
+ run,
5683
5779
  auth,
5684
5780
  state,
5685
5781
  resource,