@awsless/awsless 0.0.655 → 0.0.657

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
@@ -939,7 +939,7 @@ var debug = (...parts) => {
939
939
  };
940
940
 
941
941
  // src/config/app.ts
942
- import { z as z29 } from "zod";
942
+ import { z as z30 } from "zod";
943
943
 
944
944
  // src/feature/alert/schema.ts
945
945
  import { kebabCase } from "change-case";
@@ -1139,9 +1139,6 @@ var EphemeralStorageSizeSchema = SizeSchema.refine(
1139
1139
  var ReservedConcurrentExecutionsSchema = z15.number().int().min(0).describe("The number of simultaneous executions to reserve for the function. You can specify a number from 0.");
1140
1140
  var EnvironmentSchema = z15.record(z15.string(), z15.string()).optional().describe("Environment variable key-value pairs.");
1141
1141
  var ArchitectureSchema = z15.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
1142
- var RetryAttemptsSchema = z15.number().int().min(0).max(2).describe(
1143
- "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1144
- );
1145
1142
  var NodeRuntimeSchema = z15.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x", "nodejs24.x"]);
1146
1143
  var ContainerRuntimeSchema = z15.literal("container");
1147
1144
  var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).or(z15.string()).describe("The identifier of the function's runtime.");
@@ -1234,7 +1231,7 @@ var FnSchema = z15.object({
1234
1231
  memorySize: MemorySizeSchema.optional(),
1235
1232
  architecture: ArchitectureSchema.optional(),
1236
1233
  ephemeralStorageSize: EphemeralStorageSizeSchema.optional(),
1237
- retryAttempts: RetryAttemptsSchema.optional(),
1234
+ // retryAttempts: RetryAttemptsSchema.optional(),
1238
1235
  reserved: ReservedConcurrentExecutionsSchema.optional(),
1239
1236
  layers: LayersSchema.optional(),
1240
1237
  environment: EnvironmentSchema.optional(),
@@ -1268,7 +1265,7 @@ var FunctionDefaultSchema = z15.object({
1268
1265
  memorySize: MemorySizeSchema.default("128 MB"),
1269
1266
  architecture: ArchitectureSchema.default("arm64"),
1270
1267
  ephemeralStorageSize: EphemeralStorageSizeSchema.default("512 MB"),
1271
- retryAttempts: RetryAttemptsSchema.default(2),
1268
+ // retryAttempts: RetryAttemptsSchema.default(2),
1272
1269
  reserved: ReservedConcurrentExecutionsSchema.optional(),
1273
1270
  layers: LayersSchema.optional(),
1274
1271
  environment: EnvironmentSchema.optional(),
@@ -1310,10 +1307,16 @@ var NotifySchema = z18.union([
1310
1307
  EmailSchema.transform((v) => [v]),
1311
1308
  EmailSchema.array()
1312
1309
  ]).describe("Receive an email notification when consuming failure entries goes wrong.");
1313
- var OnFailureDefaultSchema = z18.object({
1314
- consumer: FunctionSchema,
1315
- notify: NotifySchema.optional()
1316
- }).optional().describe(
1310
+ var OnFailureDefaultSchema = z18.union([
1311
+ FunctionSchema.transform((consumer) => ({
1312
+ consumer,
1313
+ notify: []
1314
+ })),
1315
+ z18.object({
1316
+ consumer: FunctionSchema,
1317
+ notify: NotifySchema.optional()
1318
+ })
1319
+ ]).optional().describe(
1317
1320
  [
1318
1321
  "Defining a onFailure handler will add a global onFailure handler for the following resources:",
1319
1322
  "- Tasks",
@@ -1363,12 +1366,16 @@ var PubSubDefaultSchema = z20.record(
1363
1366
  // .optional(),
1364
1367
  })
1365
1368
  ).optional().describe("Define the pubsub subscriber in your stack.");
1369
+ var RetryAttemptsSchema = z20.number().int().min(0).max(2).describe(
1370
+ "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1371
+ );
1366
1372
  var PubSubSchema = z20.record(
1367
1373
  ResourceIdSchema,
1368
1374
  z20.object({
1369
1375
  sql: z20.string().describe("The SQL statement used to query the IOT topic."),
1370
1376
  sqlVersion: z20.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."),
1371
- consumer: FunctionSchema.describe("The consuming lambda function properties.")
1377
+ consumer: FunctionSchema.describe("The consuming lambda function properties."),
1378
+ retryAttempts: RetryAttemptsSchema.default(2)
1372
1379
  })
1373
1380
  ).optional().describe("Define the pubsub subscriber in your stack.");
1374
1381
 
@@ -1835,15 +1842,34 @@ var InstanceDefaultSchema = z26.object({
1835
1842
 
1836
1843
  // src/feature/topic/schema.ts
1837
1844
  import { kebabCase as kebabCase3 } from "change-case";
1845
+ import { z as z28 } from "zod";
1846
+
1847
+ // src/feature/task/schema.ts
1838
1848
  import { z as z27 } from "zod";
1839
- var TopicNameSchema = z27.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
1840
- var TopicsDefaultSchema = z27.array(TopicNameSchema).refine((topics) => {
1849
+ var RetryAttemptsSchema3 = z27.number().int().min(0).max(2).describe(
1850
+ "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
1851
+ );
1852
+ var TaskSchema = z27.union([
1853
+ FunctionSchema.transform((consumer) => ({
1854
+ consumer,
1855
+ retryAttempts: 2
1856
+ })),
1857
+ z27.object({
1858
+ consumer: FunctionSchema,
1859
+ retryAttempts: RetryAttemptsSchema3.default(2)
1860
+ })
1861
+ ]);
1862
+ var TasksSchema = z27.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
1863
+
1864
+ // src/feature/topic/schema.ts
1865
+ var TopicNameSchema = z28.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
1866
+ var TopicsDefaultSchema = z28.array(TopicNameSchema).refine((topics) => {
1841
1867
  return topics.length === new Set(topics).size;
1842
1868
  }, "Must be a list of unique topic names").optional().describe("Define the event topics for your app.");
1843
- var SubscribersSchema = z27.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
1869
+ var SubscribersSchema = z28.record(TopicNameSchema, TaskSchema).optional().describe("Define the event topics to subscribe too in your stack.");
1844
1870
 
1845
1871
  // src/config/schema/region.ts
1846
- import { z as z28 } from "zod";
1872
+ import { z as z29 } from "zod";
1847
1873
  var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
1848
1874
  var AF = ["af-south-1"];
1849
1875
  var AP = [
@@ -1872,16 +1898,16 @@ var EU = [
1872
1898
  var ME = ["me-south-1", "me-central-1"];
1873
1899
  var SA = ["sa-east-1"];
1874
1900
  var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
1875
- var RegionSchema = z28.enum(regions);
1901
+ var RegionSchema = z29.enum(regions);
1876
1902
 
1877
1903
  // src/config/app.ts
1878
- var AppSchema = z29.object({
1879
- $schema: z29.string().optional(),
1904
+ var AppSchema = z30.object({
1905
+ $schema: z30.string().optional(),
1880
1906
  name: ResourceIdSchema.describe("App name."),
1881
1907
  region: RegionSchema.describe("The AWS region to deploy to."),
1882
- profile: z29.string().describe("The AWS profile to deploy to."),
1883
- protect: z29.boolean().default(false).describe("Protect your app & stacks from being deleted."),
1884
- removal: z29.enum(["remove", "retain"]).default("remove").describe(
1908
+ profile: z30.string().describe("The AWS profile to deploy to."),
1909
+ protect: z30.boolean().default(false).describe("Protect your app & stacks from being deleted."),
1910
+ removal: z30.enum(["remove", "retain"]).default("remove").describe(
1885
1911
  [
1886
1912
  "Configure how your resources are handled when they have to be removed.",
1887
1913
  "",
@@ -1895,7 +1921,7 @@ var AppSchema = z29.object({
1895
1921
  // .default('prod')
1896
1922
  // .describe('The deployment stage.'),
1897
1923
  // onFailure: OnFailureSchema,
1898
- defaults: z29.object({
1924
+ defaults: z30.object({
1899
1925
  onFailure: OnFailureDefaultSchema,
1900
1926
  onLog: OnLogDefaultSchema,
1901
1927
  auth: AuthDefaultSchema,
@@ -1923,7 +1949,7 @@ import { z as z45 } from "zod";
1923
1949
 
1924
1950
  // src/feature/cache/schema.ts
1925
1951
  import { gibibytes as gibibytes2 } from "@awsless/size";
1926
- import { z as z30 } from "zod";
1952
+ import { z as z31 } from "zod";
1927
1953
  var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
1928
1954
  sizeMax(gibibytes2(5e3)),
1929
1955
  "Maximum storage size is 5000 GB"
@@ -1934,31 +1960,31 @@ var MinimumStorageSchema = StorageSchema.describe(
1934
1960
  var MaximumStorageSchema = StorageSchema.describe(
1935
1961
  "The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
1936
1962
  );
1937
- var EcpuSchema = z30.number().int().min(1e3).max(15e6);
1963
+ var EcpuSchema = z31.number().int().min(1e3).max(15e6);
1938
1964
  var MinimumEcpuSchema = EcpuSchema.describe(
1939
1965
  "The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
1940
1966
  );
1941
1967
  var MaximumEcpuSchema = EcpuSchema.describe(
1942
1968
  "The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
1943
1969
  );
1944
- var CachesSchema = z30.record(
1970
+ var CachesSchema = z31.record(
1945
1971
  ResourceIdSchema,
1946
- z30.object({
1972
+ z31.object({
1947
1973
  minStorage: MinimumStorageSchema.optional(),
1948
1974
  maxStorage: MaximumStorageSchema.optional(),
1949
1975
  minECPU: MinimumEcpuSchema.optional(),
1950
1976
  maxECPU: MaximumEcpuSchema.optional(),
1951
- snapshotRetentionLimit: z30.number().int().positive().default(1)
1977
+ snapshotRetentionLimit: z31.number().int().positive().default(1)
1952
1978
  })
1953
1979
  ).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
1954
1980
 
1955
1981
  // src/feature/command/schema.ts
1956
- import { z as z31 } from "zod";
1957
- var CommandSchema = z31.union([
1958
- z31.object({
1982
+ import { z as z32 } from "zod";
1983
+ var CommandSchema = z32.union([
1984
+ z32.object({
1959
1985
  file: LocalFileSchema,
1960
- handler: z31.string().default("default").describe("The name of the handler that needs to run"),
1961
- description: z31.string().optional().describe("A description of the command")
1986
+ handler: z32.string().default("default").describe("The name of the handler that needs to run"),
1987
+ description: z32.string().optional().describe("A description of the command")
1962
1988
  // options: z.record(ResourceIdSchema, OptionSchema).optional(),
1963
1989
  // arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
1964
1990
  }),
@@ -1968,22 +1994,22 @@ var CommandSchema = z31.union([
1968
1994
  description: void 0
1969
1995
  }))
1970
1996
  ]);
1971
- var CommandsSchema = z31.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
1997
+ var CommandsSchema = z32.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
1972
1998
 
1973
1999
  // src/feature/config/schema.ts
1974
- import { z as z32 } from "zod";
1975
- var ConfigNameSchema = z32.string().regex(/[a-z0-9\-]/g, "Invalid config name");
1976
- var ConfigsSchema = z32.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
2000
+ import { z as z33 } from "zod";
2001
+ var ConfigNameSchema = z33.string().regex(/[a-z0-9\-]/g, "Invalid config name");
2002
+ var ConfigsSchema = z33.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
1977
2003
 
1978
2004
  // src/feature/cron/schema/index.ts
1979
- import { z as z34 } from "zod";
2005
+ import { z as z35 } from "zod";
1980
2006
 
1981
2007
  // src/feature/cron/schema/schedule.ts
1982
- import { z as z33 } from "zod";
2008
+ import { z as z34 } from "zod";
1983
2009
  import { awsCronExpressionValidator } from "aws-cron-expression-validator";
1984
- var RateExpressionSchema = z33.custom(
2010
+ var RateExpressionSchema = z34.custom(
1985
2011
  (value) => {
1986
- return z33.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
2012
+ return z34.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
1987
2013
  const [str] = rate.split(" ");
1988
2014
  const number = parseInt(str);
1989
2015
  return number > 0;
@@ -1999,9 +2025,9 @@ var RateExpressionSchema = z33.custom(
1999
2025
  }
2000
2026
  return `rate(${rate})`;
2001
2027
  });
2002
- var CronExpressionSchema = z33.custom(
2028
+ var CronExpressionSchema = z34.custom(
2003
2029
  (value) => {
2004
- return z33.string().safeParse(value).success;
2030
+ return z34.string().safeParse(value).success;
2005
2031
  },
2006
2032
  { message: "Invalid cron expression" }
2007
2033
  ).superRefine((value, ctx) => {
@@ -2010,12 +2036,12 @@ var CronExpressionSchema = z33.custom(
2010
2036
  } catch (error) {
2011
2037
  if (error instanceof Error) {
2012
2038
  ctx.addIssue({
2013
- code: z33.ZodIssueCode.custom,
2039
+ code: z34.ZodIssueCode.custom,
2014
2040
  message: `Invalid cron expression: ${error.message}`
2015
2041
  });
2016
2042
  } else {
2017
2043
  ctx.addIssue({
2018
- code: z33.ZodIssueCode.custom,
2044
+ code: z34.ZodIssueCode.custom,
2019
2045
  message: "Invalid cron expression"
2020
2046
  });
2021
2047
  }
@@ -2026,28 +2052,32 @@ var CronExpressionSchema = z33.custom(
2026
2052
  var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
2027
2053
 
2028
2054
  // src/feature/cron/schema/index.ts
2029
- var CronsSchema = z34.record(
2055
+ var RetryAttemptsSchema4 = z35.number().int().min(0).max(2).describe(
2056
+ "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
2057
+ );
2058
+ var CronsSchema = z35.record(
2030
2059
  ResourceIdSchema,
2031
- z34.object({
2032
- enabled: z34.boolean().default(true).describe("If the cron is enabled."),
2060
+ z35.object({
2061
+ enabled: z35.boolean().default(true).describe("If the cron is enabled."),
2033
2062
  consumer: FunctionSchema.describe("The consuming lambda function properties."),
2034
2063
  schedule: ScheduleExpressionSchema.describe(
2035
2064
  'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
2036
2065
  ),
2037
- payload: z34.unknown().optional().describe("The JSON payload that will be passed to the consumer.")
2066
+ payload: z35.unknown().optional().describe("The JSON payload that will be passed to the consumer."),
2067
+ retryAttempts: RetryAttemptsSchema4.default(2)
2038
2068
  })
2039
2069
  ).optional().describe(`Define the cron jobs in your stack.`);
2040
2070
 
2041
2071
  // src/feature/search/schema.ts
2042
2072
  import { gibibytes as gibibytes3 } from "@awsless/size";
2043
- import { z as z35 } from "zod";
2044
- var VersionSchema = z35.union([
2073
+ import { z as z36 } from "zod";
2074
+ var VersionSchema = z36.union([
2045
2075
  //
2046
- z35.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
2047
- z35.string()
2076
+ z36.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
2077
+ z36.string()
2048
2078
  ]).describe("Specify the OpenSearch engine version.");
2049
- var TypeSchema = z35.union([
2050
- z35.enum([
2079
+ var TypeSchema = z36.union([
2080
+ z36.enum([
2051
2081
  "t3.small",
2052
2082
  "t3.medium",
2053
2083
  "m3.medium",
@@ -2121,13 +2151,13 @@ var TypeSchema = z35.union([
2121
2151
  "r6gd.12xlarge",
2122
2152
  "r6gd.16xlarge"
2123
2153
  ]),
2124
- z35.string()
2154
+ z36.string()
2125
2155
  ]).describe("Instance type of data nodes in the cluster.");
2126
- var CountSchema = z35.number().int().min(1).describe("Number of instances in the cluster.");
2156
+ var CountSchema = z36.number().int().min(1).describe("Number of instances in the cluster.");
2127
2157
  var StorageSizeSchema = SizeSchema.refine(sizeMin(gibibytes3(10)), "Minimum storage size is 10 GB").refine(sizeMax(gibibytes3(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.");
2128
- var SearchsSchema = z35.record(
2158
+ var SearchsSchema = z36.record(
2129
2159
  ResourceIdSchema,
2130
- z35.object({
2160
+ z36.object({
2131
2161
  type: TypeSchema.default("t3.small"),
2132
2162
  count: CountSchema.default(1),
2133
2163
  version: VersionSchema.default("2.13"),
@@ -2138,12 +2168,12 @@ var SearchsSchema = z35.record(
2138
2168
  ).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
2139
2169
 
2140
2170
  // src/feature/site/schema.ts
2141
- import { z as z37 } from "zod";
2171
+ import { z as z38 } from "zod";
2142
2172
 
2143
2173
  // src/config/schema/local-entry.ts
2144
2174
  import { stat as stat3 } from "fs/promises";
2145
- import { z as z36 } from "zod";
2146
- var LocalEntrySchema = z36.union([
2175
+ import { z as z37 } from "zod";
2176
+ var LocalEntrySchema = z37.union([
2147
2177
  RelativePathSchema.refine(async (path) => {
2148
2178
  try {
2149
2179
  const s = await stat3(path);
@@ -2152,7 +2182,7 @@ var LocalEntrySchema = z36.union([
2152
2182
  return false;
2153
2183
  }
2154
2184
  }, `File or directory doesn't exist`),
2155
- z36.object({
2185
+ z37.object({
2156
2186
  nocheck: RelativePathSchema.describe(
2157
2187
  "Specifies a local file or directory without checking if the file or directory exists."
2158
2188
  )
@@ -2160,21 +2190,21 @@ var LocalEntrySchema = z36.union([
2160
2190
  ]);
2161
2191
 
2162
2192
  // src/feature/site/schema.ts
2163
- var SitesSchema = z37.record(
2193
+ var SitesSchema = z38.record(
2164
2194
  ResourceIdSchema,
2165
- z37.object({
2195
+ z38.object({
2166
2196
  router: ResourceIdSchema.describe("The router id to link your site with."),
2167
2197
  path: RouteSchema2.describe("The path inside the router to link your site to."),
2168
- build: z37.object({
2169
- command: z37.string().describe(
2198
+ build: z38.object({
2199
+ command: z38.string().describe(
2170
2200
  `Specifies the files and directories to generate the cache key for your custom build command.`
2171
2201
  ),
2172
- cacheKey: z37.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
2202
+ cacheKey: z38.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
2173
2203
  `Specifies the files and directories to generate the cache key for your custom build command.`
2174
2204
  ),
2175
- configs: z37.string().array().optional().describe("Define the config values for your build command.")
2205
+ configs: z38.string().array().optional().describe("Define the config values for your build command.")
2176
2206
  }).optional().describe(`Specifies the build process for sites that need a build step.`),
2177
- static: z37.union([LocalDirectorySchema, z37.boolean()]).optional().describe(
2207
+ static: z38.union([LocalDirectorySchema, z38.boolean()]).optional().describe(
2178
2208
  "Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."
2179
2209
  ),
2180
2210
  ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
@@ -2182,45 +2212,45 @@ var SitesSchema = z37.record(
2182
2212
  ).optional().describe("Define the sites in your stack.");
2183
2213
 
2184
2214
  // src/feature/store/schema.ts
2185
- import { z as z38 } from "zod";
2186
- var StoresSchema = z38.union([
2187
- z38.array(ResourceIdSchema).transform((list3) => {
2215
+ import { z as z39 } from "zod";
2216
+ var StoresSchema = z39.union([
2217
+ z39.array(ResourceIdSchema).transform((list3) => {
2188
2218
  const stores = {};
2189
2219
  for (const key of list3) {
2190
2220
  stores[key] = {};
2191
2221
  }
2192
2222
  return stores;
2193
2223
  }),
2194
- z38.record(
2224
+ z39.record(
2195
2225
  ResourceIdSchema,
2196
- z38.object({
2226
+ z39.object({
2197
2227
  static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
2198
- versioning: z38.boolean().default(false).describe("Enable versioning of your store."),
2199
- events: z38.object({
2228
+ versioning: z39.boolean().default(false).describe("Enable versioning of your store."),
2229
+ events: z39.object({
2200
2230
  // create
2201
- "created:*": FunctionSchema.optional().describe(
2231
+ "created:*": TaskSchema.optional().describe(
2202
2232
  "Subscribe to notifications regardless of the API that was used to create an object."
2203
2233
  ),
2204
- "created:put": FunctionSchema.optional().describe(
2234
+ "created:put": TaskSchema.optional().describe(
2205
2235
  "Subscribe to notifications when an object is created using the PUT API operation."
2206
2236
  ),
2207
- "created:post": FunctionSchema.optional().describe(
2237
+ "created:post": TaskSchema.optional().describe(
2208
2238
  "Subscribe to notifications when an object is created using the POST API operation."
2209
2239
  ),
2210
- "created:copy": FunctionSchema.optional().describe(
2240
+ "created:copy": TaskSchema.optional().describe(
2211
2241
  "Subscribe to notifications when an object is created using the COPY API operation."
2212
2242
  ),
2213
- "created:upload": FunctionSchema.optional().describe(
2243
+ "created:upload": TaskSchema.optional().describe(
2214
2244
  "Subscribe to notifications when an object multipart upload has been completed."
2215
2245
  ),
2216
2246
  // remove
2217
- "removed:*": FunctionSchema.optional().describe(
2247
+ "removed:*": TaskSchema.optional().describe(
2218
2248
  "Subscribe to notifications when an object is deleted or a delete marker for a versioned object is created."
2219
2249
  ),
2220
- "removed:delete": FunctionSchema.optional().describe(
2250
+ "removed:delete": TaskSchema.optional().describe(
2221
2251
  "Subscribe to notifications when an object is deleted"
2222
2252
  ),
2223
- "removed:marker": FunctionSchema.optional().describe(
2253
+ "removed:marker": TaskSchema.optional().describe(
2224
2254
  "Subscribe to notifications when a delete marker for a versioned object is created."
2225
2255
  )
2226
2256
  }).optional().describe("Describes the store events you want to subscribe too.")
@@ -2229,30 +2259,30 @@ var StoresSchema = z38.union([
2229
2259
  ]).optional().describe("Define the stores in your stack.");
2230
2260
 
2231
2261
  // src/feature/icon/schema.ts
2232
- import { z as z39 } from "zod";
2262
+ import { z as z40 } from "zod";
2233
2263
  var staticOriginSchema = LocalDirectorySchema.describe(
2234
2264
  "Specifies the path to a local image directory that will be uploaded in S3."
2235
2265
  );
2236
2266
  var functionOriginSchema = FunctionSchema.describe(
2237
2267
  "Specifies the file that will be called when an image isn't found in the (cache) bucket."
2238
2268
  );
2239
- var IconsSchema = z39.record(
2269
+ var IconsSchema = z40.record(
2240
2270
  ResourceIdSchema,
2241
- z39.object({
2271
+ z40.object({
2242
2272
  // domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
2243
2273
  // subDomain: z.string().optional(),
2244
2274
  router: ResourceIdSchema.describe("The router id to link your icon proxy."),
2245
2275
  path: RouteSchema2.describe("The path inside the router to link your icon proxy to."),
2246
2276
  log: LogSchema.optional(),
2247
2277
  cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
2248
- preserveIds: z39.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
2249
- symbols: z39.boolean().optional().default(false).describe(`Convert the SVG's to SVG symbols.`),
2250
- origin: z39.union([
2251
- z39.object({
2278
+ preserveIds: z40.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
2279
+ symbols: z40.boolean().optional().default(false).describe(`Convert the SVG's to SVG symbols.`),
2280
+ origin: z40.union([
2281
+ z40.object({
2252
2282
  static: staticOriginSchema,
2253
2283
  function: functionOriginSchema.optional()
2254
2284
  }),
2255
- z39.object({
2285
+ z40.object({
2256
2286
  static: staticOriginSchema.optional(),
2257
2287
  function: functionOriginSchema
2258
2288
  })
@@ -2279,13 +2309,13 @@ var IconsSchema = z39.record(
2279
2309
  ).optional().describe("Define an svg icon proxy in your stack. Store, optimize, and deliver svg icons at scale.");
2280
2310
 
2281
2311
  // src/feature/image/schema.ts
2282
- import { z as z40 } from "zod";
2283
- var transformationOptionsSchema = z40.object({
2284
- width: z40.number().int().positive().optional(),
2285
- height: z40.number().int().positive().optional(),
2286
- fit: z40.enum(["cover", "contain", "fill", "inside", "outside"]).optional(),
2287
- position: z40.enum(["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "center"]).optional(),
2288
- quality: z40.number().int().min(1).max(100).optional()
2312
+ import { z as z41 } from "zod";
2313
+ var transformationOptionsSchema = z41.object({
2314
+ width: z41.number().int().positive().optional(),
2315
+ height: z41.number().int().positive().optional(),
2316
+ fit: z41.enum(["cover", "contain", "fill", "inside", "outside"]).optional(),
2317
+ position: z41.enum(["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "center"]).optional(),
2318
+ quality: z41.number().int().min(1).max(100).optional()
2289
2319
  });
2290
2320
  var staticOriginSchema2 = LocalDirectorySchema.describe(
2291
2321
  "Specifies the path to a local image directory that will be uploaded in S3."
@@ -2293,38 +2323,38 @@ var staticOriginSchema2 = LocalDirectorySchema.describe(
2293
2323
  var functionOriginSchema2 = FunctionSchema.describe(
2294
2324
  "Specifies the file that will be called when an image isn't found in the (cache) bucket."
2295
2325
  );
2296
- var ImagesSchema = z40.record(
2326
+ var ImagesSchema = z41.record(
2297
2327
  ResourceIdSchema,
2298
- z40.object({
2328
+ z41.object({
2299
2329
  // domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
2300
2330
  // subDomain: z.string().optional(),
2301
2331
  router: ResourceIdSchema.describe("The router id to link your image proxy."),
2302
2332
  path: RouteSchema2.describe("The path inside the router to link your image proxy to."),
2303
2333
  log: LogSchema.optional(),
2304
2334
  cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
2305
- presets: z40.record(z40.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
2306
- extensions: z40.object({
2307
- jpg: z40.object({
2308
- mozjpeg: z40.boolean().optional(),
2309
- progressive: z40.boolean().optional()
2335
+ presets: z41.record(z41.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
2336
+ extensions: z41.object({
2337
+ jpg: z41.object({
2338
+ mozjpeg: z41.boolean().optional(),
2339
+ progressive: z41.boolean().optional()
2310
2340
  }).optional(),
2311
- webp: z40.object({
2312
- effort: z40.number().int().min(1).max(10).default(7).optional(),
2313
- lossless: z40.boolean().optional(),
2314
- nearLossless: z40.boolean().optional()
2341
+ webp: z41.object({
2342
+ effort: z41.number().int().min(1).max(10).default(7).optional(),
2343
+ lossless: z41.boolean().optional(),
2344
+ nearLossless: z41.boolean().optional()
2315
2345
  }).optional(),
2316
- png: z40.object({
2317
- compressionLevel: z40.number().int().min(0).max(9).default(6).optional()
2346
+ png: z41.object({
2347
+ compressionLevel: z41.number().int().min(0).max(9).default(6).optional()
2318
2348
  }).optional()
2319
2349
  }).refine((data) => {
2320
2350
  return Object.keys(data).length > 0;
2321
2351
  }, "At least one extension must be defined.").describe("Specify the allowed extensions."),
2322
- origin: z40.union([
2323
- z40.object({
2352
+ origin: z41.union([
2353
+ z41.object({
2324
2354
  static: staticOriginSchema2,
2325
2355
  function: functionOriginSchema2.optional()
2326
2356
  }),
2327
- z40.object({
2357
+ z41.object({
2328
2358
  static: staticOriginSchema2.optional(),
2329
2359
  function: functionOriginSchema2
2330
2360
  })
@@ -2339,7 +2369,7 @@ var ImagesSchema = z40.record(
2339
2369
  ).optional().describe("Define an image proxy in your stack. Store, transform, optimize, and deliver images at scale.");
2340
2370
 
2341
2371
  // src/feature/metric/schema.ts
2342
- import { z as z41 } from "zod";
2372
+ import { z as z42 } from "zod";
2343
2373
  var ops = {
2344
2374
  ">": "GreaterThanThreshold",
2345
2375
  ">=": "GreaterThanOrEqualToThreshold",
@@ -2353,15 +2383,15 @@ var stats = {
2353
2383
  min: "Minimum",
2354
2384
  max: "Maximum"
2355
2385
  };
2356
- var WhereSchema = z41.union([
2357
- z41.string().regex(/(count|avg|sum|min|max) (>|>=|<|<=) (\d)/, "Invalid where query").transform((where) => {
2386
+ var WhereSchema = z42.union([
2387
+ z42.string().regex(/(count|avg|sum|min|max) (>|>=|<|<=) (\d)/, "Invalid where query").transform((where) => {
2358
2388
  const [stat4, op, value] = where.split(" ");
2359
2389
  return { stat: stat4, op, value: parseFloat(value) };
2360
2390
  }),
2361
- z41.object({
2362
- stat: z41.enum(["count", "avg", "sum", "min", "max"]),
2363
- op: z41.enum([">", ">=", "<", "<="]),
2364
- value: z41.number()
2391
+ z42.object({
2392
+ stat: z42.enum(["count", "avg", "sum", "min", "max"]),
2393
+ op: z42.enum([">", ">=", "<", "<="]),
2394
+ value: z42.number()
2365
2395
  })
2366
2396
  ]).transform((where) => {
2367
2397
  return {
@@ -2370,39 +2400,39 @@ var WhereSchema = z41.union([
2370
2400
  value: where.value
2371
2401
  };
2372
2402
  });
2373
- var AlarmSchema = z41.object({
2374
- description: z41.string().optional(),
2403
+ var AlarmSchema = z42.object({
2404
+ description: z42.string().optional(),
2375
2405
  where: WhereSchema,
2376
2406
  period: DurationSchema,
2377
- minDataPoints: z41.number().int().default(1),
2378
- trigger: z41.union([EmailSchema.transform((v) => [v]), EmailSchema.array(), FunctionSchema])
2407
+ minDataPoints: z42.number().int().default(1),
2408
+ trigger: z42.union([EmailSchema.transform((v) => [v]), EmailSchema.array(), FunctionSchema])
2379
2409
  });
2380
- var MetricsSchema = z41.record(
2410
+ var MetricsSchema = z42.record(
2381
2411
  ResourceIdSchema,
2382
- z41.object({
2383
- type: z41.enum(["number", "size", "duration"]),
2412
+ z42.object({
2413
+ type: z42.enum(["number", "size", "duration"]),
2384
2414
  alarms: AlarmSchema.array().optional()
2385
2415
  })
2386
2416
  ).optional().describe("Define the metrics in your stack.");
2387
2417
 
2388
2418
  // src/feature/table/schema.ts
2389
2419
  import { minutes as minutes5, seconds as seconds4 } from "@awsless/duration";
2390
- import { z as z42 } from "zod";
2391
- var KeySchema = z42.string().min(1).max(255);
2392
- var TablesSchema = z42.record(
2420
+ import { z as z43 } from "zod";
2421
+ var KeySchema = z43.string().min(1).max(255);
2422
+ var TablesSchema = z43.record(
2393
2423
  ResourceIdSchema,
2394
- z42.object({
2424
+ z43.object({
2395
2425
  hash: KeySchema.describe(
2396
2426
  "Specifies the name of the partition / hash key that makes up the primary key for the table."
2397
2427
  ),
2398
2428
  sort: KeySchema.optional().describe(
2399
2429
  "Specifies the name of the range / sort key that makes up the primary key for the table."
2400
2430
  ),
2401
- fields: z42.record(z42.string(), z42.enum(["string", "number", "binary"])).optional().describe(
2431
+ fields: z43.record(z43.string(), z43.enum(["string", "number", "binary"])).optional().describe(
2402
2432
  'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
2403
2433
  ),
2404
- class: z42.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
2405
- pointInTimeRecovery: z42.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
2434
+ class: z43.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
2435
+ pointInTimeRecovery: z43.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
2406
2436
  ttl: KeySchema.optional().describe(
2407
2437
  [
2408
2438
  "The name of the TTL attribute used to store the expiration time for items in the table.",
@@ -2410,8 +2440,8 @@ var TablesSchema = z42.record(
2410
2440
  ].join("\n")
2411
2441
  ),
2412
2442
  // deletionProtection: DeletionProtectionSchema.optional(),
2413
- stream: z42.object({
2414
- type: z42.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
2443
+ stream: z43.object({
2444
+ type: z43.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
2415
2445
  [
2416
2446
  "When an item in the table is modified, you can determines what information is written to the stream for this table.",
2417
2447
  "Valid values are:",
@@ -2421,7 +2451,7 @@ var TablesSchema = z42.record(
2421
2451
  "- new-and-old-images - Both the new and the old item images of the item are written to the stream."
2422
2452
  ].join("\n")
2423
2453
  ),
2424
- batchSize: z42.number().min(1).max(1e4).default(1).describe(
2454
+ batchSize: z43.number().min(1).max(1e4).default(1).describe(
2425
2455
  [
2426
2456
  "The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
2427
2457
  "Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).",
@@ -2437,17 +2467,20 @@ var TablesSchema = z42.record(
2437
2467
  "You can specify a duration from 1 seconds to 5 minutes."
2438
2468
  ].join("\n")
2439
2469
  ),
2440
- maxRecordAge: DurationSchema.refine(
2441
- durationMin(seconds4(1)),
2442
- "Minimum record age duration is 1 second"
2443
- ).refine(durationMax(minutes5(1)), "Maximum record age duration is 1 minute").default("60 seconds").describe(
2444
- [
2445
- "Discard records older than the specified age.",
2446
- "The maximum valid value for maximum record age is 60s.",
2447
- "The default value is 60s"
2448
- ].join("\n")
2449
- ),
2450
- retryAttempts: z42.number().min(-1).max(1e4).default(2).describe(
2470
+ // maxRecordAge: DurationSchema.refine(
2471
+ // durationMin(seconds(1)),
2472
+ // 'Minimum record age duration is 1 second'
2473
+ // )
2474
+ // .refine(durationMax(minutes(1)), 'Maximum record age duration is 1 minute')
2475
+ // .default('60 seconds')
2476
+ // .describe(
2477
+ // [
2478
+ // 'Discard records older than the specified age.',
2479
+ // 'The maximum valid value for maximum record age is 60s.',
2480
+ // 'The default value is 60s',
2481
+ // ].join('\n')
2482
+ // ),
2483
+ retryAttempts: z43.number().min(-1).max(1e4).default(2).describe(
2451
2484
  [
2452
2485
  "Discard records after the specified number of retries.",
2453
2486
  "-1 will sets the maximum number of retries to infinite.",
@@ -2456,7 +2489,7 @@ var TablesSchema = z42.record(
2456
2489
  "The default value is 2"
2457
2490
  ].join("\n")
2458
2491
  ),
2459
- concurrencyPerShard: z42.number().min(1).max(10).default(1).describe(
2492
+ concurrencyPerShard: z43.number().min(1).max(10).default(1).describe(
2460
2493
  [
2461
2494
  "The number of batches to process concurrently from each shard.",
2462
2495
  "You can specify a number from 1 to 10."
@@ -2466,16 +2499,16 @@ var TablesSchema = z42.record(
2466
2499
  }).optional().describe(
2467
2500
  "The settings for the DynamoDB table stream, which capture changes to items stored in the table."
2468
2501
  ),
2469
- indexes: z42.record(
2470
- z42.string(),
2471
- z42.object({
2472
- hash: z42.union([KeySchema.transform((v) => [v]), KeySchema.array()]).describe(
2502
+ indexes: z43.record(
2503
+ z43.string(),
2504
+ z43.object({
2505
+ hash: z43.union([KeySchema.transform((v) => [v]), KeySchema.array()]).describe(
2473
2506
  "Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
2474
2507
  ),
2475
- sort: z42.union([KeySchema.transform((v) => [v]), KeySchema.array()]).optional().describe(
2508
+ sort: z43.union([KeySchema.transform((v) => [v]), KeySchema.array()]).optional().describe(
2476
2509
  "Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
2477
2510
  ),
2478
- projection: z42.enum(["all", "keys-only"]).default("all").describe(
2511
+ projection: z43.enum(["all", "keys-only"]).default("all").describe(
2479
2512
  [
2480
2513
  "The set of attributes that are projected into the index:",
2481
2514
  "- all - All of the table attributes are projected into the index.",
@@ -2488,29 +2521,6 @@ var TablesSchema = z42.record(
2488
2521
  })
2489
2522
  ).optional().describe("Define the tables in your stack.");
2490
2523
 
2491
- // src/feature/task/schema.ts
2492
- import { z as z43 } from "zod";
2493
- var RetryAttemptsSchema3 = z43.number().int().min(0).max(2).describe(
2494
- "The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
2495
- );
2496
- var TaskSchema = z43.union([
2497
- LocalFileSchema.transform((file) => ({
2498
- consumer: {
2499
- code: {
2500
- file,
2501
- minify: true,
2502
- external: []
2503
- }
2504
- },
2505
- retryAttempts: void 0
2506
- })),
2507
- z43.object({
2508
- consumer: FunctionSchema,
2509
- retryAttempts: RetryAttemptsSchema3.optional()
2510
- })
2511
- ]);
2512
- var TasksSchema = z43.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
2513
-
2514
2524
  // src/feature/test/schema.ts
2515
2525
  import { z as z44 } from "zod";
2516
2526
  var TestsSchema = z44.union([
@@ -3963,9 +3973,8 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
3963
3973
  }
3964
3974
  };
3965
3975
  };
3966
- var createAsyncLambdaFunction = (group, ctx, ns, id, local) => {
3967
- const result = createLambdaFunction(group, ctx, ns, id, { ...local, warm: 0 });
3968
- const props = deepmerge(ctx.appConfig.defaults.function, local);
3976
+ var createAsyncLambdaFunction = (group, ctx, ns, id, props) => {
3977
+ const result = createLambdaFunction(group, ctx, ns, id, { ...props.consumer, warm: 0 });
3969
3978
  result.setEnvironment("THROW_EXPECTED_ERRORS", "1");
3970
3979
  const onFailure = getGlobalOnFailure(ctx);
3971
3980
  new aws4.lambda.FunctionEventInvokeConfig(
@@ -4065,7 +4074,10 @@ var cronFeature = defineFeature({
4065
4074
  onStack(ctx) {
4066
4075
  for (const [id, props] of Object.entries(ctx.stackConfig.crons ?? {})) {
4067
4076
  const group = new Group4(ctx.stack, "cron", id);
4068
- const { lambda } = createAsyncLambdaFunction(group, ctx, "cron", id, props.consumer);
4077
+ const { lambda } = createAsyncLambdaFunction(group, ctx, "cron", id, {
4078
+ consumer: props.consumer,
4079
+ retryAttempts: props.retryAttempts
4080
+ });
4069
4081
  const name = formatLocalResourceName({
4070
4082
  appName: ctx.app.name,
4071
4083
  stackName: ctx.stack.name,
@@ -4984,7 +4996,7 @@ var pubsubFeature = defineFeature({
4984
4996
  onStack(ctx) {
4985
4997
  for (const [id, props] of Object.entries(ctx.stackConfig.pubsub ?? {})) {
4986
4998
  const group = new Group10(ctx.stack, "pubsub", id);
4987
- const { lambda } = createAsyncLambdaFunction(group, ctx, `pubsub`, id, props.consumer);
4999
+ const { lambda } = createAsyncLambdaFunction(group, ctx, `pubsub`, id, props);
4988
5000
  const name = formatLocalResourceName({
4989
5001
  appName: ctx.app.name,
4990
5002
  stackName: ctx.stack.name,
@@ -5968,12 +5980,15 @@ var storeFeature = defineFeature({
5968
5980
  "removed:delete": "s3:ObjectRemoved:Delete",
5969
5981
  "removed:marker": "s3:ObjectRemoved:DeleteMarkerCreated"
5970
5982
  };
5971
- for (const [event, funcProps] of Object.entries(props.events ?? {})) {
5983
+ for (const [event, taskProps] of Object.entries(props.events ?? {})) {
5972
5984
  const eventGroup = new Group16(group, "event", event);
5973
5985
  const eventId = kebabCase7(`${id}-${shortId(event)}`);
5974
5986
  const { lambda } = createAsyncLambdaFunction(eventGroup, ctx, `store`, eventId, {
5975
- ...funcProps,
5976
- description: `${id} event "${event}"`
5987
+ ...taskProps,
5988
+ consumer: {
5989
+ ...taskProps.consumer,
5990
+ description: `${id} event "${event}"`
5991
+ }
5977
5992
  });
5978
5993
  new aws17.lambda.Permission(eventGroup, "permission", {
5979
5994
  action: "lambda:InvokeFunction",
@@ -6152,7 +6167,7 @@ var tableFeature = defineFeature({
6152
6167
  functionName: result.lambda.functionName,
6153
6168
  eventSourceArn: table.streamArn,
6154
6169
  // tumblingWindowInSeconds
6155
- maximumRecordAgeInSeconds: toSeconds8(props.stream.maxRecordAge),
6170
+ // maximumRecordAgeInSeconds: toSeconds(props.stream.maxRecordAge),
6156
6171
  // bisectBatchOnFunctionError: true,
6157
6172
  batchSize: props.stream.batchSize,
6158
6173
  maximumBatchingWindowInSeconds: props.stream.batchWindow ? toSeconds8(props.stream.batchWindow) : void 0,
@@ -6350,7 +6365,7 @@ var taskFeature = defineFeature({
6350
6365
  onStack(ctx) {
6351
6366
  for (const [id, props] of Object.entries(ctx.stackConfig.tasks ?? {})) {
6352
6367
  const group = new Group18(ctx.stack, "task", id);
6353
- createAsyncLambdaFunction(group, ctx, "task", id, props.consumer);
6368
+ createAsyncLambdaFunction(group, ctx, "task", id, props);
6354
6369
  }
6355
6370
  }
6356
6371
  });