@awsless/awsless 0.0.325 → 0.0.327

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
@@ -370,7 +370,7 @@ var debug = (...parts) => {
370
370
  };
371
371
 
372
372
  // src/config/app.ts
373
- import { z as z18 } from "zod";
373
+ import { z as z20 } from "zod";
374
374
 
375
375
  // src/feature/auth/schema.ts
376
376
  import { z as z7 } from "zod";
@@ -915,8 +915,111 @@ var RestDefaultSchema = z16.record(
915
915
  ).optional().describe("Define your global REST API's.");
916
916
  var RestSchema = z16.record(ResourceIdSchema, z16.record(RouteSchema2, FunctionSchema)).optional().describe("Define routes in your stack for your global REST API.");
917
917
 
918
- // src/config/schema/region.ts
918
+ // src/feature/store/schema.ts
919
919
  import { z as z17 } from "zod";
920
+ var DeletionProtectionSchema = z17.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
921
+ var StoreDefaultSchema = z17.object({
922
+ deletionProtection: DeletionProtectionSchema.optional()
923
+ }).optional();
924
+ var StoresSchema = z17.union([
925
+ z17.array(ResourceIdSchema).transform((list4) => {
926
+ const stores = {};
927
+ for (const key of list4) {
928
+ stores[key] = {};
929
+ }
930
+ return stores;
931
+ }),
932
+ z17.record(
933
+ ResourceIdSchema,
934
+ z17.object({
935
+ // cors: CorsSchema,
936
+ deletionProtection: DeletionProtectionSchema.optional(),
937
+ versioning: z17.boolean().default(false).describe("Enable versioning of your store."),
938
+ events: z17.object({
939
+ // create
940
+ "created:*": FunctionSchema.optional().describe(
941
+ "Subscribe to notifications regardless of the API that was used to create an object."
942
+ ),
943
+ "created:put": FunctionSchema.optional().describe(
944
+ "Subscribe to notifications when an object is created using the PUT API operation."
945
+ ),
946
+ "created:post": FunctionSchema.optional().describe(
947
+ "Subscribe to notifications when an object is created using the POST API operation."
948
+ ),
949
+ "created:copy": FunctionSchema.optional().describe(
950
+ "Subscribe to notifications when an object is created using the COPY API operation."
951
+ ),
952
+ "created:upload": FunctionSchema.optional().describe(
953
+ "Subscribe to notifications when an object multipart upload has been completed."
954
+ ),
955
+ // remove
956
+ "removed:*": FunctionSchema.optional().describe(
957
+ "Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
958
+ ),
959
+ "removed:delete": FunctionSchema.optional().describe(
960
+ "Subscribe to notifications when an object is deleted"
961
+ ),
962
+ "removed:marker": FunctionSchema.optional().describe(
963
+ "Subscribe to notifications when a delete marker for a versioned object is created."
964
+ )
965
+ }).optional().describe("Describes the store events you want to subscribe too.")
966
+ })
967
+ )
968
+ ]).optional().describe("Define the stores in your stack.");
969
+
970
+ // src/feature/table/schema.ts
971
+ import { z as z18 } from "zod";
972
+ var KeySchema = z18.string().min(1).max(255);
973
+ var DeletionProtectionSchema2 = z18.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
974
+ var TableDefaultSchema = z18.object({
975
+ deletionProtection: DeletionProtectionSchema2.optional()
976
+ }).optional();
977
+ var TablesSchema = z18.record(
978
+ ResourceIdSchema,
979
+ z18.object({
980
+ hash: KeySchema.describe(
981
+ "Specifies the name of the partition / hash key that makes up the primary key for the table."
982
+ ),
983
+ sort: KeySchema.optional().describe(
984
+ "Specifies the name of the range / sort key that makes up the primary key for the table."
985
+ ),
986
+ fields: z18.record(z18.string(), z18.enum(["string", "number", "binary"])).optional().describe(
987
+ 'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
988
+ ),
989
+ class: z18.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
990
+ pointInTimeRecovery: z18.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
991
+ timeToLiveAttribute: KeySchema.optional().describe(
992
+ "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."
993
+ ),
994
+ deletionProtection: DeletionProtectionSchema2.optional(),
995
+ stream: z18.object({
996
+ type: z18.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
997
+ "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."
998
+ ),
999
+ consumer: FunctionSchema.describe("The consuming lambda function for the stream")
1000
+ }).optional().describe(
1001
+ "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
1002
+ ),
1003
+ indexes: z18.record(
1004
+ z18.string(),
1005
+ z18.object({
1006
+ /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
1007
+ hash: KeySchema,
1008
+ /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
1009
+ sort: KeySchema.optional(),
1010
+ /** The set of attributes that are projected into the index:
1011
+ * - all - All of the table attributes are projected into the index.
1012
+ * - keys-only - Only the index and primary keys are projected into the index.
1013
+ * @default 'all'
1014
+ */
1015
+ projection: z18.enum(["all", "keys-only"]).default("all")
1016
+ })
1017
+ ).optional().describe("Specifies the global secondary indexes to be created on the table.")
1018
+ })
1019
+ ).optional().describe("Define the tables in your stack.");
1020
+
1021
+ // src/config/schema/region.ts
1022
+ import { z as z19 } from "zod";
920
1023
  var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
921
1024
  var AF = ["af-south-1"];
922
1025
  var AP = [
@@ -945,20 +1048,20 @@ var EU = [
945
1048
  var ME = ["me-south-1", "me-central-1"];
946
1049
  var SA = ["sa-east-1"];
947
1050
  var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
948
- var RegionSchema = z17.enum(regions);
1051
+ var RegionSchema = z19.enum(regions);
949
1052
 
950
1053
  // src/config/app.ts
951
- var AppSchema = z18.object({
952
- $schema: z18.string().optional(),
1054
+ var AppSchema = z20.object({
1055
+ $schema: z20.string().optional(),
953
1056
  name: ResourceIdSchema.describe("App name."),
954
1057
  region: RegionSchema.describe("The AWS region to deploy to."),
955
- profile: z18.string().describe("The AWS profile to deploy to."),
1058
+ profile: z20.string().describe("The AWS profile to deploy to."),
956
1059
  // stage: z
957
1060
  // .string()
958
1061
  // .regex(/^[a-z]+$/)
959
1062
  // .default('prod')
960
1063
  // .describe('The deployment stage.'),
961
- defaults: z18.object({
1064
+ defaults: z20.object({
962
1065
  auth: AuthDefaultSchema,
963
1066
  domains: DomainsDefaultSchema,
964
1067
  function: FunctionDefaultSchema,
@@ -967,7 +1070,9 @@ var AppSchema = z18.object({
967
1070
  graphql: GraphQLDefaultSchema,
968
1071
  http: HttpDefaultSchema,
969
1072
  rest: RestDefaultSchema,
970
- pubsub: PubSubDefaultSchema
1073
+ pubsub: PubSubDefaultSchema,
1074
+ table: TableDefaultSchema,
1075
+ store: StoreDefaultSchema
971
1076
  // dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
972
1077
  }).default({}).describe("Default properties")
973
1078
  });
@@ -976,8 +1081,8 @@ var AppSchema = z18.object({
976
1081
  import { z as z32 } from "zod";
977
1082
 
978
1083
  // src/feature/cache/schema.ts
979
- import { z as z19 } from "zod";
980
- var TypeSchema2 = z19.enum([
1084
+ import { z as z21 } from "zod";
1085
+ var TypeSchema2 = z21.enum([
981
1086
  "t4g.small",
982
1087
  "t4g.medium",
983
1088
  "r6g.large",
@@ -992,29 +1097,29 @@ var TypeSchema2 = z19.enum([
992
1097
  "r6gd.4xlarge",
993
1098
  "r6gd.8xlarge"
994
1099
  ]);
995
- var PortSchema = z19.number().int().min(1).max(5e4);
996
- var ShardsSchema = z19.number().int().min(0).max(100);
997
- var ReplicasPerShardSchema = z19.number().int().min(0).max(5);
998
- var EngineSchema = z19.enum(["7.0", "6.2"]);
999
- var CachesSchema = z19.record(
1100
+ var PortSchema = z21.number().int().min(1).max(5e4);
1101
+ var ShardsSchema = z21.number().int().min(0).max(100);
1102
+ var ReplicasPerShardSchema = z21.number().int().min(0).max(5);
1103
+ var EngineSchema = z21.enum(["7.0", "6.2"]);
1104
+ var CachesSchema = z21.record(
1000
1105
  ResourceIdSchema,
1001
- z19.object({
1106
+ z21.object({
1002
1107
  type: TypeSchema2.default("t4g.small"),
1003
1108
  port: PortSchema.default(6379),
1004
1109
  shards: ShardsSchema.default(1),
1005
1110
  replicasPerShard: ReplicasPerShardSchema.default(1),
1006
1111
  engine: EngineSchema.default("7.0"),
1007
- dataTiering: z19.boolean().default(false)
1112
+ dataTiering: z21.boolean().default(false)
1008
1113
  })
1009
1114
  ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
1010
1115
 
1011
1116
  // src/feature/command/schema.ts
1012
- import { z as z20 } from "zod";
1013
- var CommandSchema2 = z20.union([
1014
- z20.object({
1117
+ import { z as z22 } from "zod";
1118
+ var CommandSchema2 = z22.union([
1119
+ z22.object({
1015
1120
  file: LocalFileSchema,
1016
- handler: z20.string().default("default").describe("The name of the handler that needs to run"),
1017
- description: z20.string().optional().describe("A description of the command")
1121
+ handler: z22.string().default("default").describe("The name of the handler that needs to run"),
1122
+ description: z22.string().optional().describe("A description of the command")
1018
1123
  // options: z.record(ResourceIdSchema, OptionSchema).optional(),
1019
1124
  // arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
1020
1125
  }),
@@ -1024,22 +1129,22 @@ var CommandSchema2 = z20.union([
1024
1129
  description: void 0
1025
1130
  }))
1026
1131
  ]);
1027
- var CommandsSchema = z20.record(ResourceIdSchema, CommandSchema2).optional().describe("Define the custom commands for your stack.");
1132
+ var CommandsSchema = z22.record(ResourceIdSchema, CommandSchema2).optional().describe("Define the custom commands for your stack.");
1028
1133
 
1029
1134
  // src/feature/config/schema.ts
1030
- import { z as z21 } from "zod";
1031
- var ConfigNameSchema = z21.string().regex(/[a-z0-9\-]/g, "Invalid config name");
1032
- var ConfigsSchema = z21.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
1135
+ import { z as z23 } from "zod";
1136
+ var ConfigNameSchema = z23.string().regex(/[a-z0-9\-]/g, "Invalid config name");
1137
+ var ConfigsSchema = z23.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
1033
1138
 
1034
1139
  // src/feature/cron/schema/index.ts
1035
- import { z as z23 } from "zod";
1140
+ import { z as z25 } from "zod";
1036
1141
 
1037
1142
  // src/feature/cron/schema/schedule.ts
1038
- import { z as z22 } from "zod";
1143
+ import { z as z24 } from "zod";
1039
1144
  import { awsCronExpressionValidator } from "aws-cron-expression-validator";
1040
- var RateExpressionSchema = z22.custom(
1145
+ var RateExpressionSchema = z24.custom(
1041
1146
  (value) => {
1042
- return z22.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
1147
+ return z24.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
1043
1148
  const [str] = rate.split(" ");
1044
1149
  const number = parseInt(str);
1045
1150
  return number > 0;
@@ -1055,9 +1160,9 @@ var RateExpressionSchema = z22.custom(
1055
1160
  }
1056
1161
  return `rate(${rate})`;
1057
1162
  });
1058
- var CronExpressionSchema = z22.custom(
1163
+ var CronExpressionSchema = z24.custom(
1059
1164
  (value) => {
1060
- return z22.string().safeParse(value).success;
1165
+ return z24.string().safeParse(value).success;
1061
1166
  },
1062
1167
  { message: "Invalid cron expression" }
1063
1168
  ).superRefine((value, ctx) => {
@@ -1066,12 +1171,12 @@ var CronExpressionSchema = z22.custom(
1066
1171
  } catch (error) {
1067
1172
  if (error instanceof Error) {
1068
1173
  ctx.addIssue({
1069
- code: z22.ZodIssueCode.custom,
1174
+ code: z24.ZodIssueCode.custom,
1070
1175
  message: `Invalid cron expression: ${error.message}`
1071
1176
  });
1072
1177
  } else {
1073
1178
  ctx.addIssue({
1074
- code: z22.ZodIssueCode.custom,
1179
+ code: z24.ZodIssueCode.custom,
1075
1180
  message: "Invalid cron expression"
1076
1181
  });
1077
1182
  }
@@ -1082,15 +1187,15 @@ var CronExpressionSchema = z22.custom(
1082
1187
  var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
1083
1188
 
1084
1189
  // src/feature/cron/schema/index.ts
1085
- var CronsSchema = z23.record(
1190
+ var CronsSchema = z25.record(
1086
1191
  ResourceIdSchema,
1087
- z23.object({
1088
- enabled: z23.boolean().default(true).describe("If the cron is enabled."),
1192
+ z25.object({
1193
+ enabled: z25.boolean().default(true).describe("If the cron is enabled."),
1089
1194
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
1090
1195
  schedule: ScheduleExpressionSchema.describe(
1091
1196
  'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
1092
1197
  ),
1093
- payload: z23.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
1198
+ payload: z25.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
1094
1199
  })
1095
1200
  ).optional().describe(`Define the cron jobs in your stack.`);
1096
1201
 
@@ -1101,9 +1206,9 @@ var OnFailureSchema = FunctionSchema.optional().describe(
1101
1206
 
1102
1207
  // src/feature/search/schema.ts
1103
1208
  import { gibibytes as gibibytes2 } from "@awsless/size";
1104
- import { z as z24 } from "zod";
1105
- var VersionSchema = z24.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
1106
- var TypeSchema3 = z24.enum([
1209
+ import { z as z26 } from "zod";
1210
+ var VersionSchema = z26.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]);
1211
+ var TypeSchema3 = z26.enum([
1107
1212
  "t3.small",
1108
1213
  "t3.medium",
1109
1214
  "m3.medium",
@@ -1178,41 +1283,41 @@ var TypeSchema3 = z24.enum([
1178
1283
  "r6gd.16xlarge"
1179
1284
  ]);
1180
1285
  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.");
1181
- var SearchsSchema = z24.record(
1286
+ var SearchsSchema = z26.record(
1182
1287
  ResourceIdSchema,
1183
- z24.object({
1288
+ z26.object({
1184
1289
  type: TypeSchema3.default("t3.small"),
1185
- count: z24.number().int().min(1).default(1),
1290
+ count: z26.number().int().min(1).default(1),
1186
1291
  version: VersionSchema.default("2.13"),
1187
1292
  storage: StorageSizeSchema.default("10 GB"),
1188
- vpc: z24.boolean().default(false)
1293
+ vpc: z26.boolean().default(false)
1189
1294
  })
1190
1295
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
1191
1296
 
1192
1297
  // src/feature/site/schema.ts
1193
- import { z as z25 } from "zod";
1194
- var ErrorResponsePathSchema = z25.string().describe(
1298
+ import { z as z27 } from "zod";
1299
+ var ErrorResponsePathSchema = z27.string().describe(
1195
1300
  "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."
1196
1301
  );
1197
- var StatusCodeSchema = z25.number().int().positive().optional().describe(
1302
+ var StatusCodeSchema = z27.number().int().positive().optional().describe(
1198
1303
  "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."
1199
1304
  );
1200
1305
  var MinTTLSchema = DurationSchema.describe(
1201
1306
  "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."
1202
1307
  );
1203
- var ErrorResponseSchema = z25.union([
1308
+ var ErrorResponseSchema = z27.union([
1204
1309
  ErrorResponsePathSchema,
1205
- z25.object({
1310
+ z27.object({
1206
1311
  path: ErrorResponsePathSchema,
1207
1312
  statusCode: StatusCodeSchema.optional(),
1208
1313
  minTTL: MinTTLSchema.optional()
1209
1314
  })
1210
1315
  ]).optional();
1211
- var SitesSchema = z25.record(
1316
+ var SitesSchema = z27.record(
1212
1317
  ResourceIdSchema,
1213
- z25.object({
1318
+ z27.object({
1214
1319
  domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
1215
- subDomain: z25.string().optional(),
1320
+ subDomain: z27.string().optional(),
1216
1321
  // bind: z
1217
1322
  // .object({
1218
1323
  // auth: z.array(ResourceIdSchema),
@@ -1235,7 +1340,7 @@ var SitesSchema = z25.record(
1235
1340
  // build: z.string().optional(),
1236
1341
  // }),
1237
1342
  // ]),
1238
- errors: z25.object({
1343
+ errors: z27.object({
1239
1344
  400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
1240
1345
  403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
1241
1346
  404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
@@ -1248,16 +1353,16 @@ var SitesSchema = z25.record(
1248
1353
  503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
1249
1354
  504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
1250
1355
  }).optional().describe("Customize the error responses for specific HTTP status codes."),
1251
- cors: z25.object({
1252
- override: z25.boolean().default(false),
1356
+ cors: z27.object({
1357
+ override: z27.boolean().default(false),
1253
1358
  maxAge: DurationSchema.default("365 days"),
1254
- exposeHeaders: z25.string().array().optional(),
1255
- credentials: z25.boolean().default(false),
1256
- headers: z25.string().array().default(["*"]),
1257
- origins: z25.string().array().default(["*"]),
1258
- methods: z25.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
1359
+ exposeHeaders: z27.string().array().optional(),
1360
+ credentials: z27.boolean().default(false),
1361
+ headers: z27.string().array().default(["*"]),
1362
+ origins: z27.string().array().default(["*"]),
1363
+ methods: z27.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
1259
1364
  }).optional().describe("Define the cors headers."),
1260
- security: z25.object({
1365
+ security: z27.object({
1261
1366
  // contentSecurityPolicy: z.object({
1262
1367
  // override: z.boolean().default(false),
1263
1368
  // policy: z.string(),
@@ -1299,136 +1404,39 @@ var SitesSchema = z25.record(
1299
1404
  // reportUri?: string
1300
1405
  // }
1301
1406
  }).optional().describe("Define the security policy."),
1302
- cache: z25.object({
1303
- cookies: z25.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
1304
- headers: z25.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
1305
- queries: z25.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
1407
+ cache: z27.object({
1408
+ cookies: z27.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
1409
+ headers: z27.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
1410
+ queries: z27.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
1306
1411
  }).optional().describe(
1307
1412
  "Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
1308
1413
  )
1309
1414
  })
1310
1415
  ).optional().describe("Define the sites in your stack.");
1311
1416
 
1312
- // src/feature/store/schema.ts
1313
- import { z as z26 } from "zod";
1314
- var DeletionProtectionSchema = z26.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
1315
- var StoresSchema = z26.union([
1316
- z26.array(ResourceIdSchema).transform((list4) => {
1317
- const stores = {};
1318
- for (const key of list4) {
1319
- stores[key] = {};
1320
- }
1321
- return stores;
1322
- }),
1323
- z26.record(
1324
- ResourceIdSchema,
1325
- z26.object({
1326
- // cors: CorsSchema,
1327
- deletionProtection: DeletionProtectionSchema.optional(),
1328
- versioning: z26.boolean().default(false).describe("Enable versioning of your store."),
1329
- events: z26.object({
1330
- // create
1331
- "created:*": FunctionSchema.optional().describe(
1332
- "Subscribe to notifications regardless of the API that was used to create an object."
1333
- ),
1334
- "created:put": FunctionSchema.optional().describe(
1335
- "Subscribe to notifications when an object is created using the PUT API operation."
1336
- ),
1337
- "created:post": FunctionSchema.optional().describe(
1338
- "Subscribe to notifications when an object is created using the POST API operation."
1339
- ),
1340
- "created:copy": FunctionSchema.optional().describe(
1341
- "Subscribe to notifications when an object is created using the COPY API operation."
1342
- ),
1343
- "created:upload": FunctionSchema.optional().describe(
1344
- "Subscribe to notifications when an object multipart upload has been completed."
1345
- ),
1346
- // remove
1347
- "removed:*": FunctionSchema.optional().describe(
1348
- "Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
1349
- ),
1350
- "removed:delete": FunctionSchema.optional().describe(
1351
- "Subscribe to notifications when an object is deleted"
1352
- ),
1353
- "removed:marker": FunctionSchema.optional().describe(
1354
- "Subscribe to notifications when a delete marker for a versioned object is created."
1355
- )
1356
- }).optional().describe("Describes the store events you want to subscribe too.")
1357
- })
1358
- )
1359
- ]).optional().describe("Define the stores in your stack.");
1360
-
1361
1417
  // src/feature/stream/schema.ts
1362
- import { z as z27 } from "zod";
1363
- var LatencyModeSchema = z27.enum(["low", "normal"]).describe(
1418
+ import { z as z28 } from "zod";
1419
+ var LatencyModeSchema = z28.enum(["low", "normal"]).describe(
1364
1420
  `Channel latency mode. Valid values:
1365
1421
  - normal: Use "normal" to broadcast and deliver live video up to Full HD.
1366
1422
  - low: Use "low" for near real-time interactions with viewers.`
1367
1423
  );
1368
- var TypeSchema4 = z27.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
1424
+ var TypeSchema4 = z28.enum(["standard", "basic", "advanced-sd", "advanced-hd"]).describe(`The channel type, which determines the allowable resolution and bitrate.
1369
1425
  If you exceed the allowable resolution or bitrate, the stream probably will disconnect immediately. Valid values:
1370
1426
  - 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.
1371
1427
  - 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.
1372
1428
  - 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.
1373
1429
  - 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.
1374
1430
  `);
1375
- var StreamsSchema = z27.record(
1431
+ var StreamsSchema = z28.record(
1376
1432
  ResourceIdSchema,
1377
- z27.object({
1433
+ z28.object({
1378
1434
  type: TypeSchema4.default("standard"),
1379
1435
  // preset: PresetSchema.optional(),
1380
1436
  latencyMode: LatencyModeSchema.default("low")
1381
1437
  })
1382
1438
  ).optional().describe("Define the streams in your stack.");
1383
1439
 
1384
- // src/feature/table/schema.ts
1385
- import { z as z28 } from "zod";
1386
- var KeySchema = z28.string().min(1).max(255);
1387
- var DeletionProtectionSchema2 = z28.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
1388
- var TablesSchema = z28.record(
1389
- ResourceIdSchema,
1390
- z28.object({
1391
- hash: KeySchema.describe(
1392
- "Specifies the name of the partition / hash key that makes up the primary key for the table."
1393
- ),
1394
- sort: KeySchema.optional().describe(
1395
- "Specifies the name of the range / sort key that makes up the primary key for the table."
1396
- ),
1397
- fields: z28.record(z28.string(), z28.enum(["string", "number", "binary"])).optional().describe(
1398
- 'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
1399
- ),
1400
- class: z28.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
1401
- pointInTimeRecovery: z28.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
1402
- timeToLiveAttribute: KeySchema.optional().describe(
1403
- "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."
1404
- ),
1405
- deletionProtection: DeletionProtectionSchema2.optional(),
1406
- stream: z28.object({
1407
- type: z28.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
1408
- "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."
1409
- ),
1410
- consumer: FunctionSchema.describe("The consuming lambda function for the stream")
1411
- }).optional().describe(
1412
- "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
1413
- ),
1414
- indexes: z28.record(
1415
- z28.string(),
1416
- z28.object({
1417
- /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
1418
- hash: KeySchema,
1419
- /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
1420
- sort: KeySchema.optional(),
1421
- /** The set of attributes that are projected into the index:
1422
- * - all - All of the table attributes are projected into the index.
1423
- * - keys-only - Only the index and primary keys are projected into the index.
1424
- * @default 'all'
1425
- */
1426
- projection: z28.enum(["all", "keys-only"]).default("all")
1427
- })
1428
- ).optional().describe("Specifies the global secondary indexes to be created on the table.")
1429
- })
1430
- ).optional().describe("Define the tables in your stack.");
1431
-
1432
1440
  // src/feature/task/schema.ts
1433
1441
  import { z as z29 } from "zod";
1434
1442
  var RetryAttemptsSchema2 = z29.number().int().min(0).max(2).describe(
@@ -2969,7 +2977,7 @@ var functionFeature = defineFeature({
2969
2977
  resourceName: "assets",
2970
2978
  postfix: ctx.appId
2971
2979
  }),
2972
- versioning: true,
2980
+ // versioning: true,
2973
2981
  forceDelete: true
2974
2982
  });
2975
2983
  ctx.shared.set("function-bucket-name", bucket.name);
@@ -4411,7 +4419,8 @@ var storeFeature = defineFeature({
4411
4419
  // ---------------------------------------------
4412
4420
  ]
4413
4421
  });
4414
- if (props.deletionProtection) {
4422
+ const deletionProtection = props.deletionProtection ?? ctx.appConfig.defaults.store?.deletionProtection;
4423
+ if (deletionProtection) {
4415
4424
  bucket.deletionPolicy = "retain";
4416
4425
  }
4417
4426
  ctx.onPolicy((policy) => {
@@ -4482,13 +4491,14 @@ var tableFeature = defineFeature({
4482
4491
  resourceType: "table",
4483
4492
  resourceName: id
4484
4493
  });
4494
+ const deletionProtection = props.deletionProtection ?? ctx.appConfig.defaults.table?.deletionProtection;
4485
4495
  const table2 = new aws19.dynamodb.Table(group, "table", {
4486
4496
  ...props,
4487
4497
  name,
4488
4498
  stream: props.stream?.type,
4489
- deletionProtection: props.deletionProtection
4499
+ deletionProtection
4490
4500
  });
4491
- if (props.deletionProtection) {
4501
+ if (deletionProtection) {
4492
4502
  table2.deletionPolicy = "retain";
4493
4503
  }
4494
4504
  if (props.stream) {
@@ -887,6 +887,9 @@ var SitesSchema = z22.record(
887
887
  // src/feature/store/schema.ts
888
888
  import { z as z23 } from "zod";
889
889
  var DeletionProtectionSchema = z23.boolean().describe("Specifies if you want to protect the store from being deleted by awsless.");
890
+ var StoreDefaultSchema = z23.object({
891
+ deletionProtection: DeletionProtectionSchema.optional()
892
+ }).optional();
890
893
  var StoresSchema = z23.union([
891
894
  z23.array(ResourceIdSchema).transform((list) => {
892
895
  const stores = {};
@@ -960,6 +963,9 @@ var StreamsSchema = z24.record(
960
963
  import { z as z25 } from "zod";
961
964
  var KeySchema = z25.string().min(1).max(255);
962
965
  var DeletionProtectionSchema2 = z25.boolean().describe("Specifies if you want to protect the table from being deleted by awsless.");
966
+ var TableDefaultSchema = z25.object({
967
+ deletionProtection: DeletionProtectionSchema2.optional()
968
+ }).optional();
963
969
  var TablesSchema = z25.record(
964
970
  ResourceIdSchema,
965
971
  z25.object({
@@ -1143,7 +1149,9 @@ var AppSchema = z32.object({
1143
1149
  graphql: GraphQLDefaultSchema,
1144
1150
  http: HttpDefaultSchema,
1145
1151
  rest: RestDefaultSchema,
1146
- pubsub: PubSubDefaultSchema
1152
+ pubsub: PubSubDefaultSchema,
1153
+ table: TableDefaultSchema,
1154
+ store: StoreDefaultSchema
1147
1155
  // dataRetention: z.boolean().describe('Configure how your resources are handled on delete.').default(false),
1148
1156
  }).default({}).describe("Default properties")
1149
1157
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.325",
3
+ "version": "0.0.327",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -30,11 +30,11 @@
30
30
  "peerDependencies": {
31
31
  "@awsless/lambda": "^0.0.26",
32
32
  "@awsless/s3": "^0.0.18",
33
- "@awsless/redis": "^0.0.12",
34
- "@awsless/sns": "^0.0.7",
35
33
  "@awsless/open-search": "^0.0.15",
36
- "@awsless/iot": "^0.0.2",
34
+ "@awsless/redis": "^0.0.12",
37
35
  "@awsless/validate": "^0.0.14",
36
+ "@awsless/iot": "^0.0.2",
37
+ "@awsless/sns": "^0.0.7",
38
38
  "@awsless/sqs": "^0.0.7",
39
39
  "@awsless/ssm": "^0.0.7",
40
40
  "@awsless/weak-cache": "^0.0.1"
@@ -106,11 +106,11 @@
106
106
  "zip-a-folder": "^3.1.6",
107
107
  "zod": "^3.21.4",
108
108
  "zod-to-json-schema": "^3.22.3",
109
- "@awsless/formation": "^0.0.46",
110
109
  "@awsless/duration": "^0.0.1",
111
- "@awsless/size": "^0.0.1",
110
+ "@awsless/formation": "^0.0.46",
112
111
  "@awsless/graphql": "^0.0.9",
113
112
  "@awsless/ts-file-cache": "^0.0.1",
113
+ "@awsless/size": "^0.0.1",
114
114
  "@awsless/validate": "^0.0.14",
115
115
  "@awsless/code": "^0.0.10"
116
116
  },