@awsless/awsless 0.0.274 → 0.0.277

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
@@ -91,6 +91,113 @@ var Cancelled = class extends Error {
91
91
  }
92
92
  };
93
93
 
94
+ // src/util/workspace.ts
95
+ import { minutes } from "@awsless/duration";
96
+ import { aws, local, WorkSpace } from "@awsless/formation";
97
+ import { mkdir, readFile, rm, writeFile } from "fs/promises";
98
+ import { dirname, join as join2 } from "path";
99
+
100
+ // src/util/path.ts
101
+ import { lstat } from "fs/promises";
102
+ import { join, normalize } from "path";
103
+ var root = process.cwd();
104
+ var directories = {
105
+ root,
106
+ get output() {
107
+ return join(this.root, ".awsless");
108
+ },
109
+ get cache() {
110
+ return join(this.output, "cache");
111
+ },
112
+ get state() {
113
+ return join(this.output, "state");
114
+ },
115
+ get build() {
116
+ return join(this.output, "build");
117
+ },
118
+ get types() {
119
+ return join(this.output, "types");
120
+ },
121
+ // get template() {
122
+ // return join(this.output, 'template')
123
+ // },
124
+ get test() {
125
+ return join(this.output, "test");
126
+ }
127
+ };
128
+ var setRoot = (path = root) => {
129
+ directories.root = path;
130
+ };
131
+ var findRootDir = async (path, configFiles, level = 5) => {
132
+ if (!level) {
133
+ throw new TypeError("No awsless project found");
134
+ }
135
+ for (const configFile of configFiles) {
136
+ const file = join(path, configFile);
137
+ const exists = await fileExist(file);
138
+ if (exists) {
139
+ return [file, path];
140
+ }
141
+ }
142
+ return findRootDir(normalize(join(path, "..")), configFiles, level - 1);
143
+ };
144
+ var fileExist = async (file) => {
145
+ try {
146
+ const stat5 = await lstat(file);
147
+ if (stat5.isFile()) {
148
+ return true;
149
+ }
150
+ } catch (error) {
151
+ }
152
+ return false;
153
+ };
154
+
155
+ // src/util/workspace.ts
156
+ var getStateBucketName = (accountId) => {
157
+ return `awsless-state-${accountId}`;
158
+ };
159
+ var createWorkSpace = (props) => {
160
+ const lockProvider = new aws.dynamodb.LockProvider({
161
+ ...props,
162
+ tableName: "awsless-locks"
163
+ });
164
+ const stateProvider = new aws.s3.StateProvider({
165
+ ...props,
166
+ bucket: getStateBucketName(props.accountId)
167
+ });
168
+ const cloudProviders = aws.createCloudProviders({
169
+ ...props,
170
+ timeout: minutes(60)
171
+ });
172
+ const workspace = new WorkSpace({
173
+ lockProvider,
174
+ stateProvider,
175
+ cloudProviders,
176
+ concurrency: 15
177
+ });
178
+ return {
179
+ workspace,
180
+ lockProvider,
181
+ stateProvider
182
+ };
183
+ };
184
+ var pullRemoteState = async (app, stateProvider) => {
185
+ const file = join2(directories.state, `${app.urn}.json`);
186
+ const state2 = await stateProvider.get(app.urn);
187
+ await mkdir(dirname(file), { recursive: true });
188
+ if (typeof state2 === "undefined") {
189
+ await rm(file);
190
+ } else {
191
+ await writeFile(file, JSON.stringify(state2, void 0, 2));
192
+ }
193
+ };
194
+ var pushRemoteState = async (app, stateProvider) => {
195
+ const file = join2(directories.state, `${app.urn}.json`);
196
+ const data = await readFile(file, "utf8");
197
+ const state2 = JSON.parse(data);
198
+ await stateProvider.update(app.urn, state2);
199
+ };
200
+
94
201
  // src/cli/ui/util.ts
95
202
  import wrapAnsi from "wrap-ansi";
96
203
  import Table from "cli-table3";
@@ -183,14 +290,15 @@ var hasStateBucket = async (client, accountId) => {
183
290
  try {
184
291
  const result = await client.send(
185
292
  new HeadBucketCommand({
186
- Bucket: `awsless-state-${accountId}`
293
+ Bucket: getStateBucketName(accountId)
187
294
  })
188
295
  );
189
296
  return !!result.BucketRegion;
190
297
  } catch (error) {
191
- console.log(error);
192
298
  if (error instanceof S3ServiceException) {
193
- return false;
299
+ if (error.name === "NotFound") {
300
+ return false;
301
+ }
194
302
  }
195
303
  throw error;
196
304
  }
@@ -218,7 +326,7 @@ var createLockTable = (client) => {
218
326
  var createStateBucket = (client, accountId) => {
219
327
  return client.send(
220
328
  new CreateBucketCommand({
221
- Bucket: `awsless-state-${accountId}`
329
+ Bucket: getStateBucketName(accountId)
222
330
  })
223
331
  );
224
332
  };
@@ -258,7 +366,7 @@ var bootstrapAwsless = async (props) => {
258
366
  import { intro, outro } from "@clack/prompts";
259
367
 
260
368
  // src/config/load/load.ts
261
- import { basename as basename2, dirname as dirname2, join as join4 } from "path";
369
+ import { basename as basename2, dirname as dirname3, join as join5 } from "path";
262
370
 
263
371
  // src/cli/debug.ts
264
372
  var queue = [];
@@ -309,73 +417,16 @@ var durationMax = (max) => {
309
417
  // src/config/schema/local-file.ts
310
418
  import { stat } from "fs/promises";
311
419
  import { z as z3 } from "zod";
312
-
313
- // src/util/path.ts
314
- import { lstat } from "fs/promises";
315
- import { join, normalize } from "path";
316
- var root = process.cwd();
317
- var directories = {
318
- root,
319
- get output() {
320
- return join(this.root, ".awsless");
321
- },
322
- get cache() {
323
- return join(this.output, "cache");
324
- },
325
- get state() {
326
- return join(this.output, "state");
327
- },
328
- get build() {
329
- return join(this.output, "build");
330
- },
331
- get types() {
332
- return join(this.output, "types");
333
- },
334
- // get template() {
335
- // return join(this.output, 'template')
336
- // },
337
- get test() {
338
- return join(this.output, "test");
339
- }
340
- };
341
- var setRoot = (path = root) => {
342
- directories.root = path;
343
- };
344
- var findRootDir = async (path, configFiles, level = 5) => {
345
- if (!level) {
346
- throw new TypeError("No awsless project found");
347
- }
348
- for (const configFile of configFiles) {
349
- const file = join(path, configFile);
350
- const exists = await fileExist(file);
351
- if (exists) {
352
- return [file, path];
353
- }
354
- }
355
- return findRootDir(normalize(join(path, "..")), configFiles, level - 1);
356
- };
357
- var fileExist = async (file) => {
358
- try {
359
- const stat5 = await lstat(file);
360
- if (stat5.isFile()) {
361
- return true;
362
- }
363
- } catch (error) {
364
- }
365
- return false;
366
- };
367
-
368
- // src/config/schema/local-file.ts
369
- import { join as join2 } from "path";
420
+ import { join as join3 } from "path";
370
421
  var basePath;
371
422
  var setLocalBasePath = (path) => {
372
423
  basePath = path;
373
424
  };
374
425
  var resolvePath = (path) => {
375
426
  if (path.startsWith(".") && basePath) {
376
- return join2(basePath, path);
427
+ return join3(basePath, path);
377
428
  }
378
- return join2(directories.root, path);
429
+ return join3(directories.root, path);
379
430
  };
380
431
  var LocalFileSchema = z3.string().transform((path) => resolvePath(path)).refine(async (path) => {
381
432
  try {
@@ -402,12 +453,12 @@ var sizeMax = (max) => {
402
453
  };
403
454
 
404
455
  // src/feature/function/schema.ts
405
- import { days, minutes, seconds } from "@awsless/duration";
456
+ import { days, minutes as minutes2, seconds } from "@awsless/duration";
406
457
  import { gibibytes, mebibytes } from "@awsless/size";
407
458
  var MemorySizeSchema = SizeSchema.refine(sizeMin(mebibytes(128)), "Minimum memory size is 128 MB").refine(sizeMax(gibibytes(10)), "Maximum memory size is 10 GB").describe(
408
459
  "The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The value can be any multiple of 1 MB. You can specify a size value from 128 MB to 10 GB."
409
460
  );
410
- var TimeoutSchema = DurationSchema.refine(durationMin(seconds(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes(15)), "Maximum timeout duration is 15 minutes").describe(
461
+ var TimeoutSchema = DurationSchema.refine(durationMin(seconds(10)), "Minimum timeout duration is 10 seconds").refine(durationMax(minutes2(15)), "Maximum timeout duration is 15 minutes").describe(
411
462
  "The amount of time that Lambda allows a function to run before stopping it. You can specify a size value from 1 second to 15 minutes."
412
463
  );
413
464
  var EphemeralStorageSizeSchema = SizeSchema.refine(
@@ -697,7 +748,8 @@ var TypeSchema = z12.enum([
697
748
  "t4g.large",
698
749
  "t4g.xlarge",
699
750
  "t4g.2xlarge",
700
- "g4ad.xlarge"
751
+ "g4ad.xlarge",
752
+ "g4dn.xlarge"
701
753
  ]).describe(`The instance type.`);
702
754
  var CommandSchema = z12.string().describe(`The script you want to execute when the instance starts up.`);
703
755
  var CodeSchema = LocalDirectorySchema.describe(`The code directory that will be deployed to your instance.`);
@@ -720,10 +772,10 @@ var InstancesSchema = z12.record(
720
772
 
721
773
  // src/feature/queue/schema.ts
722
774
  import { z as z13 } from "zod";
723
- import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
775
+ import { days as days2, hours, minutes as minutes3, seconds as seconds2 } from "@awsless/duration";
724
776
  import { kibibytes } from "@awsless/size";
725
777
  var RetentionPeriodSchema = DurationSchema.refine(
726
- durationMin(minutes2(1)),
778
+ durationMin(minutes3(1)),
727
779
  "Minimum retention period is 1 minute"
728
780
  ).refine(durationMax(days2(14)), "Maximum retention period is 14 days").describe(
729
781
  "The number of seconds that Amazon SQS retains a message. You can specify a duration from 1 minute to 14 days."
@@ -735,7 +787,7 @@ var VisibilityTimeoutSchema = DurationSchema.refine(
735
787
  "The length of time during which a message will be unavailable after a message is delivered from the queue. This blocks other components from receiving the same message and gives the initial component time to process and delete the message from the queue. You can specify a duration from 0 to 12 hours."
736
788
  );
737
789
  var DeliveryDelaySchema = DurationSchema.refine(
738
- durationMax(minutes2(15)),
790
+ durationMax(minutes3(15)),
739
791
  "Maximum delivery delay is 15 minutes"
740
792
  ).describe(
741
793
  "The time in seconds for which the delivery of all messages in the queue is delayed. You can specify a duration from 0 to 15 minutes."
@@ -756,7 +808,7 @@ var MaxConcurrencySchema = z13.number().int().min(2, "Minimum max concurrency is
756
808
  "Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
757
809
  );
758
810
  var MaxBatchingWindow = DurationSchema.refine(
759
- durationMax(minutes2(5)),
811
+ durationMax(minutes3(5)),
760
812
  "Maximum max batching window is 5 minutes"
761
813
  ).describe(
762
814
  "The maximum amount of time, that Lambda spends gathering records before invoking the function. You can specify an duration from 0 seconds to 5 minutes."
@@ -1406,13 +1458,13 @@ var StackSchema = z31.object({
1406
1458
  });
1407
1459
 
1408
1460
  // src/config/load/read.ts
1409
- import { basename, dirname, extname, join as join3 } from "path";
1410
- import { readFile } from "fs/promises";
1461
+ import { basename, dirname as dirname2, extname, join as join4 } from "path";
1462
+ import { readFile as readFile2 } from "fs/promises";
1411
1463
  import JSON5 from "json5";
1412
1464
  import merge from "deepmerge";
1413
1465
  var readConfig = async (file) => {
1414
1466
  try {
1415
- const json4 = await readFile(file, "utf8");
1467
+ const json4 = await readFile2(file, "utf8");
1416
1468
  const data = JSON5.parse(json4);
1417
1469
  return data;
1418
1470
  } catch (error) {
@@ -1426,7 +1478,7 @@ var readConfigWithStage = async (file, stage) => {
1426
1478
  const config2 = await readConfig(file);
1427
1479
  const ext = extname(file);
1428
1480
  const stageFileName = basename(file, ext) + "." + stage + ext;
1429
- const stageFile = join3(dirname(file), stageFileName);
1481
+ const stageFile = join4(dirname2(file), stageFileName);
1430
1482
  const stageFileExists = await fileExist(stageFile);
1431
1483
  if (!stageFileExists) {
1432
1484
  return config2;
@@ -1453,7 +1505,7 @@ var validateConfig = async (schema, file, data) => {
1453
1505
  // src/config/load/load.ts
1454
1506
  var loadAppConfig = async (options) => {
1455
1507
  debug("Find the root directory");
1456
- const cwd = options.configFile ? dirname2(join4(process.cwd(), options.configFile)) : process.cwd();
1508
+ const cwd = options.configFile ? dirname3(join5(process.cwd(), options.configFile)) : process.cwd();
1457
1509
  const configFileOptions = options.configFile ? [basename2(options.configFile)] : ["app.json", "app.jsonc", "app.json5"];
1458
1510
  const [appFileName, root2] = await findRootDir(cwd, configFileOptions);
1459
1511
  setRoot(root2);
@@ -1479,8 +1531,8 @@ var loadStackConfigs = async (options) => {
1479
1531
  continue;
1480
1532
  }
1481
1533
  debug("Load stack file:", color.info(file));
1482
- const stackConfig = await readConfigWithStage(join4(directories.root, file), options.stage);
1483
- setLocalBasePath(join4(directories.root, dirname2(file)));
1534
+ const stackConfig = await readConfigWithStage(join5(directories.root, file), options.stage);
1535
+ setLocalBasePath(join5(directories.root, dirname3(file)));
1484
1536
  const stack = await validateConfig(StackSchema, file, stackConfig);
1485
1537
  stacks.push({
1486
1538
  ...stack,
@@ -1747,10 +1799,10 @@ var bootstrap = (program2) => {
1747
1799
  };
1748
1800
 
1749
1801
  // src/app.ts
1750
- import { App, Stack } from "@awsless/formation";
1802
+ import { App as App2, Stack } from "@awsless/formation";
1751
1803
 
1752
1804
  // src/feature/auth/index.ts
1753
- import { aws as aws2, Node as Node2 } from "@awsless/formation";
1805
+ import { aws as aws3, Node as Node2 } from "@awsless/formation";
1754
1806
  import { constantCase as constantCase2 } from "change-case";
1755
1807
 
1756
1808
  // src/feature.ts
@@ -1884,14 +1936,14 @@ var formatLocalResourceName = (appName, stackName, ns, id, seperator = "--") =>
1884
1936
  };
1885
1937
 
1886
1938
  // src/feature/function/util.ts
1887
- import { Asset, aws } from "@awsless/formation";
1939
+ import { Asset, aws as aws2 } from "@awsless/formation";
1888
1940
  import deepmerge from "deepmerge";
1889
- import { basename as basename4, dirname as dirname6, extname as extname3 } from "path";
1941
+ import { basename as basename4, dirname as dirname7, extname as extname3 } from "path";
1890
1942
  import { exec } from "promisify-child-process";
1891
1943
 
1892
1944
  // src/build/index.ts
1893
- import { mkdir, readFile as readFile2, writeFile } from "fs/promises";
1894
- import { dirname as dirname3, join as join5 } from "path";
1945
+ import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "fs/promises";
1946
+ import { dirname as dirname4, join as join6 } from "path";
1895
1947
 
1896
1948
  // old/util/timer.ts
1897
1949
  import hrtime from "pretty-hrtime";
@@ -1926,7 +1978,7 @@ var createTimer = () => {
1926
1978
  // src/build/index.ts
1927
1979
  var readCache = async (file) => {
1928
1980
  try {
1929
- const value = await readFile2(file, "utf8");
1981
+ const value = await readFile3(file, "utf8");
1930
1982
  return JSON.parse(value);
1931
1983
  } catch (_) {
1932
1984
  return void 0;
@@ -1934,12 +1986,12 @@ var readCache = async (file) => {
1934
1986
  };
1935
1987
  var writeCache = async (file, version, data) => {
1936
1988
  const cache = JSON.stringify({ version, data });
1937
- const base = dirname3(file);
1938
- await mkdir(base, { recursive: true });
1939
- await writeFile(file, cache, "utf8");
1989
+ const base = dirname4(file);
1990
+ await mkdir2(base, { recursive: true });
1991
+ await writeFile2(file, cache, "utf8");
1940
1992
  };
1941
1993
  var getBuildPath = (type, name, file) => {
1942
- return join5(directories.build, type, name, file);
1994
+ return join6(directories.build, type, name, file);
1943
1995
  };
1944
1996
  var build = (type, name, builder) => {
1945
1997
  return builder(async (version, callback) => {
@@ -1954,9 +2006,9 @@ var build = (type, name, builder) => {
1954
2006
  const time = createTimer();
1955
2007
  const meta = await callback(async (file, data2) => {
1956
2008
  const path = getBuildPath(type, name, file);
1957
- const base = dirname3(path);
1958
- await mkdir(base, { recursive: true });
1959
- await writeFile(path, data2);
2009
+ const base = dirname4(path);
2010
+ await mkdir2(base, { recursive: true });
2011
+ await writeFile2(path, data2);
1960
2012
  });
1961
2013
  const data = { ...meta, buildTime: time() };
1962
2014
  await writeCache(cacheFile, version, data);
@@ -1992,7 +2044,7 @@ import { swc, minify as swcMinify } from "rollup-plugin-swc3";
1992
2044
  import json from "@rollup/plugin-json";
1993
2045
  import commonjs from "@rollup/plugin-commonjs";
1994
2046
  import nodeResolve from "@rollup/plugin-node-resolve";
1995
- import { dirname as dirname4 } from "path";
2047
+ import { dirname as dirname5 } from "path";
1996
2048
  var bundleTypeScript = async ({ format: format2 = "esm", minify = true, file }) => {
1997
2049
  const bundle = await rollup({
1998
2050
  input: file,
@@ -2015,7 +2067,7 @@ var bundleTypeScript = async ({ format: format2 = "esm", minify = true, file })
2015
2067
  // minify,
2016
2068
  // module: true,
2017
2069
  jsc: {
2018
- baseUrl: dirname4(file),
2070
+ baseUrl: dirname5(file),
2019
2071
  minify: { sourceMap: true }
2020
2072
  },
2021
2073
  sourceMaps: true
@@ -2061,8 +2113,8 @@ var bundleTypeScript = async ({ format: format2 = "esm", minify = true, file })
2061
2113
 
2062
2114
  // src/feature/function/build/typescript/fingerprint.ts
2063
2115
  import { createHash as createHash2 } from "crypto";
2064
- import { readFile as readFile3, readdir, stat as stat3 } from "fs/promises";
2065
- import { basename as basename3, dirname as dirname5, extname as extname2, join as join6 } from "path";
2116
+ import { readFile as readFile4, readdir, stat as stat3 } from "fs/promises";
2117
+ import { basename as basename3, dirname as dirname6, extname as extname2, join as join7 } from "path";
2066
2118
  import parseStaticImports from "parse-static-imports";
2067
2119
  var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
2068
2120
  var generateFileHashes = async (file, hashes) => {
@@ -2093,17 +2145,17 @@ var readModuleFile = (file) => {
2093
2145
  return readFiles([
2094
2146
  file,
2095
2147
  ...extensions.map((exp) => `${file}.${exp}`),
2096
- ...extensions.map((exp) => join6(file, `/index.${exp}`))
2148
+ ...extensions.map((exp) => join7(file, `/index.${exp}`))
2097
2149
  ]);
2098
2150
  }
2099
- return readFile3(file, "utf8");
2151
+ return readFile4(file, "utf8");
2100
2152
  };
2101
2153
  var readFiles = async (files) => {
2102
2154
  for (const file of files) {
2103
2155
  try {
2104
2156
  const s = await stat3(file);
2105
2157
  if (s.isFile()) {
2106
- return readFile3(file, "utf8");
2158
+ return readFile4(file, "utf8");
2107
2159
  }
2108
2160
  } catch (_) {
2109
2161
  continue;
@@ -2113,7 +2165,7 @@ var readFiles = async (files) => {
2113
2165
  };
2114
2166
  var findDependencies = async (file, code) => {
2115
2167
  const imports = await parseStaticImports(code);
2116
- return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join6(dirname5(file), value) : value);
2168
+ return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join7(dirname6(file), value) : value);
2117
2169
  };
2118
2170
 
2119
2171
  // src/feature/function/build/zip.ts
@@ -2161,14 +2213,14 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
2161
2213
  };
2162
2214
  });
2163
2215
  });
2164
- code = new aws.s3.BucketObject(group, "code", {
2216
+ code = new aws2.s3.BucketObject(group, "code", {
2165
2217
  bucket: ctx.shared.get("function-bucket-name"),
2166
2218
  key: `/lambda/${name}.zip`,
2167
2219
  body: Asset.fromFile(getBuildPath("function", name, "bundle.zip"))
2168
2220
  });
2169
2221
  } else if (basename4(props.file) === "dockerfile") {
2170
2222
  ctx.registerBuild("function", name, async (build3) => {
2171
- const basePath2 = dirname6(props.file);
2223
+ const basePath2 = dirname7(props.file);
2172
2224
  const version = await hashElement(basePath2, {
2173
2225
  files: {
2174
2226
  exclude: ["stack.json"]
@@ -2189,7 +2241,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
2189
2241
  };
2190
2242
  });
2191
2243
  });
2192
- const image = new aws.ecr.Image(group, "image", {
2244
+ const image = new aws2.ecr.Image(group, "image", {
2193
2245
  repository: ctx.shared.get("function-repository-name"),
2194
2246
  hash: Asset.fromFile(getBuildPath("function", name, "HASH")),
2195
2247
  name,
@@ -2202,12 +2254,12 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
2202
2254
  } else {
2203
2255
  throw new Error("Unknown Lambda Function type.");
2204
2256
  }
2205
- const role = new aws.iam.Role(group, "role", {
2257
+ const role = new aws2.iam.Role(group, "role", {
2206
2258
  name,
2207
2259
  assumedBy: "lambda.amazonaws.com"
2208
2260
  // policies: inlinePolicies,
2209
2261
  });
2210
- const policy = new aws.iam.RolePolicy(group, "policy", {
2262
+ const policy = new aws2.iam.RolePolicy(group, "policy", {
2211
2263
  role: role.name,
2212
2264
  name: "lambda-policy",
2213
2265
  version: "2012-10-17"
@@ -2219,7 +2271,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
2219
2271
  // },
2220
2272
  // ],
2221
2273
  });
2222
- const lambda = new aws.lambda.Function(group, `function`, {
2274
+ const lambda = new aws2.lambda.Function(group, `function`, {
2223
2275
  ...props,
2224
2276
  name,
2225
2277
  role: role.arn,
@@ -2238,7 +2290,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
2238
2290
  lambda.addEnvironment("STACK", ctx.stackConfig.name);
2239
2291
  }
2240
2292
  if (props.log.retention.value > 0n) {
2241
- const logGroup = new aws.cloudWatch.LogGroup(group, "log", {
2293
+ const logGroup = new aws2.cloudWatch.LogGroup(group, "log", {
2242
2294
  name: lambda.name.apply((name2) => `/aws/lambda/${name2}`),
2243
2295
  retention: props.log.retention
2244
2296
  });
@@ -2260,7 +2312,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
2260
2312
  policy.addStatement(...local2.permissions);
2261
2313
  }
2262
2314
  if (props.warm) {
2263
- const rule = new aws.events.Rule(group, "warm", {
2315
+ const rule = new aws2.events.Rule(group, "warm", {
2264
2316
  name: `${name}--warm`,
2265
2317
  schedule: "rate(5 minutes)",
2266
2318
  enabled: true,
@@ -2275,7 +2327,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
2275
2327
  }
2276
2328
  ]
2277
2329
  });
2278
- new aws.lambda.Permission(group, `warm`, {
2330
+ new aws2.lambda.Permission(group, `warm`, {
2279
2331
  action: "lambda:InvokeFunction",
2280
2332
  principal: "events.amazonaws.com",
2281
2333
  functionArn: lambda.arn,
@@ -2290,7 +2342,7 @@ var createLambdaFunction = (group, ctx, ns, id, local2) => {
2290
2342
  ctx.shared.get(`vpc-public-subnet-id-2`)
2291
2343
  ]
2292
2344
  });
2293
- const vpcPolicy = new aws.iam.RolePolicy(group, "vpc-policy", {
2345
+ const vpcPolicy = new aws2.iam.RolePolicy(group, "vpc-policy", {
2294
2346
  role: role.name,
2295
2347
  name: "lambda-vpc-policy",
2296
2348
  version: "2012-10-17",
@@ -2319,7 +2371,7 @@ var createAsyncLambdaFunction = (group, ctx, ns, id, local2) => {
2319
2371
  const result = createLambdaFunction(group, ctx, ns, id, local2);
2320
2372
  const props = deepmerge(ctx.appConfig.defaults.function, local2);
2321
2373
  result.lambda.addEnvironment("LOG_VIEWABLE_ERROR", "1");
2322
- const invokeConfig = new aws.lambda.EventInvokeConfig(group, "async", {
2374
+ const invokeConfig = new aws2.lambda.EventInvokeConfig(group, "async", {
2323
2375
  functionArn: result.lambda.arn,
2324
2376
  retryAttempts: props.retryAttempts,
2325
2377
  onFailure: getGlobalOnFailure(ctx)
@@ -2371,12 +2423,12 @@ var authFeature = defineFeature({
2371
2423
  policy
2372
2424
  };
2373
2425
  }
2374
- new aws2.cognito.LambdaTriggers(group, "lambda-triggers", {
2426
+ new aws3.cognito.LambdaTriggers(group, "lambda-triggers", {
2375
2427
  userPoolId,
2376
2428
  triggers
2377
2429
  });
2378
2430
  for (const item of Object.values(list4)) {
2379
- new aws2.lambda.Permission(item.group, `permission`, {
2431
+ new aws3.lambda.Permission(item.group, `permission`, {
2380
2432
  action: "lambda:InvokeFunction",
2381
2433
  principal: "cognito-idp.amazonaws.com",
2382
2434
  functionArn: item.lambda.arn,
@@ -2415,7 +2467,7 @@ var authFeature = defineFeature({
2415
2467
  };
2416
2468
  }
2417
2469
  const name = formatGlobalResourceName(ctx.appConfig.name, "auth", id);
2418
- const userPool = new aws2.cognito.UserPool(group, "user-pool", {
2470
+ const userPool = new aws3.cognito.UserPool(group, "user-pool", {
2419
2471
  name,
2420
2472
  // deletionProtection: true,
2421
2473
  allowUserRegistration: props.allowUserRegistration,
@@ -2423,7 +2475,7 @@ var authFeature = defineFeature({
2423
2475
  password: props.password,
2424
2476
  email: emailConfig
2425
2477
  });
2426
- const client = new aws2.cognito.UserPoolClient(group, "client", {
2478
+ const client = new aws3.cognito.UserPoolClient(group, "client", {
2427
2479
  userPoolId: userPool.id,
2428
2480
  name,
2429
2481
  validity: props.validity,
@@ -2442,7 +2494,7 @@ var authFeature = defineFeature({
2442
2494
  });
2443
2495
 
2444
2496
  // src/feature/cache/index.ts
2445
- import { aws as aws3, Node as Node3 } from "@awsless/formation";
2497
+ import { aws as aws4, Node as Node3 } from "@awsless/formation";
2446
2498
  import { constantCase as constantCase3 } from "change-case";
2447
2499
  var typeGenCode = `
2448
2500
  import { Cluster, CommandOptions } from '@awsless/redis'
@@ -2475,7 +2527,7 @@ var cacheFeature = defineFeature({
2475
2527
  for (const [id, props] of Object.entries(ctx.stackConfig.caches ?? {})) {
2476
2528
  const group = new Node3(ctx.stack, this.name, id);
2477
2529
  const name = formatLocalResourceName(ctx.appConfig.name, ctx.stack.name, this.name, id, "-");
2478
- const subnetGroup = new aws3.memorydb.SubnetGroup(group, "subnets", {
2530
+ const subnetGroup = new aws4.memorydb.SubnetGroup(group, "subnets", {
2479
2531
  name,
2480
2532
  subnetIds: [
2481
2533
  //
@@ -2483,15 +2535,15 @@ var cacheFeature = defineFeature({
2483
2535
  ctx.shared.get("vpc-private-subnet-id-2")
2484
2536
  ]
2485
2537
  });
2486
- const securityGroup = new aws3.ec2.SecurityGroup(group, "security", {
2538
+ const securityGroup = new aws4.ec2.SecurityGroup(group, "security", {
2487
2539
  name,
2488
2540
  vpcId: ctx.shared.get(`vpc-id`),
2489
2541
  description: name
2490
2542
  });
2491
- const port = aws3.ec2.Port.tcp(props.port);
2492
- securityGroup.addIngressRule({ port, peer: aws3.ec2.Peer.anyIpv4() });
2493
- securityGroup.addIngressRule({ port, peer: aws3.ec2.Peer.anyIpv6() });
2494
- const cluster = new aws3.memorydb.Cluster(group, "cluster", {
2543
+ const port = aws4.ec2.Port.tcp(props.port);
2544
+ securityGroup.addIngressRule({ port, peer: aws4.ec2.Peer.anyIpv4() });
2545
+ securityGroup.addIngressRule({ port, peer: aws4.ec2.Peer.anyIpv6() });
2546
+ const cluster = new aws4.memorydb.Cluster(group, "cluster", {
2495
2547
  name,
2496
2548
  aclName: "open-access",
2497
2549
  securityGroupIds: [securityGroup.id],
@@ -2648,14 +2700,14 @@ var configFeature = defineFeature({
2648
2700
  });
2649
2701
 
2650
2702
  // src/feature/cron/index.ts
2651
- import { Node as Node4, aws as aws4 } from "@awsless/formation";
2703
+ import { Node as Node4, aws as aws5 } from "@awsless/formation";
2652
2704
  var cronFeature = defineFeature({
2653
2705
  name: "cron",
2654
2706
  onStack(ctx) {
2655
2707
  for (const [id, props] of Object.entries(ctx.stackConfig.crons ?? {})) {
2656
2708
  const group = new Node4(ctx.stack, "cron", id);
2657
2709
  const { lambda } = createAsyncLambdaFunction(group, ctx, "cron", id, props.consumer);
2658
- const rule = new aws4.events.Rule(group, "rule", {
2710
+ const rule = new aws5.events.Rule(group, "rule", {
2659
2711
  name: formatLocalResourceName(ctx.app.name, ctx.stack.name, this.name, id),
2660
2712
  schedule: props.schedule,
2661
2713
  enabled: props.enabled,
@@ -2667,7 +2719,7 @@ var cronFeature = defineFeature({
2667
2719
  }
2668
2720
  ]
2669
2721
  });
2670
- new aws4.lambda.Permission(group, "permission", {
2722
+ new aws5.lambda.Permission(group, "permission", {
2671
2723
  action: "lambda:InvokeFunction",
2672
2724
  principal: "events.amazonaws.com",
2673
2725
  functionArn: lambda.arn,
@@ -2678,8 +2730,8 @@ var cronFeature = defineFeature({
2678
2730
  });
2679
2731
 
2680
2732
  // src/feature/domain/index.ts
2681
- import { minutes as minutes3 } from "@awsless/duration";
2682
- import { aws as aws5, Node as Node5 } from "@awsless/formation";
2733
+ import { minutes as minutes4 } from "@awsless/duration";
2734
+ import { aws as aws6, Node as Node5 } from "@awsless/formation";
2683
2735
  var domainFeature = defineFeature({
2684
2736
  name: "domain",
2685
2737
  onApp(ctx) {
@@ -2688,7 +2740,7 @@ var domainFeature = defineFeature({
2688
2740
  return;
2689
2741
  }
2690
2742
  const group = new Node5(ctx.base, "domain", "mail");
2691
- const configurationSet = new aws5.ses.ConfigurationSet(group, "config", {
2743
+ const configurationSet = new aws6.ses.ConfigurationSet(group, "config", {
2692
2744
  name: ctx.app.name,
2693
2745
  engagementMetrics: true,
2694
2746
  reputationMetrics: true
@@ -2696,29 +2748,29 @@ var domainFeature = defineFeature({
2696
2748
  ctx.shared.set(`mail-configuration-set`, configurationSet.name);
2697
2749
  for (const [id, props] of domains) {
2698
2750
  const group2 = new Node5(ctx.base, "domain", id);
2699
- const hostedZone = new aws5.route53.HostedZone(group2, "zone", {
2751
+ const hostedZone = new aws6.route53.HostedZone(group2, "zone", {
2700
2752
  name: props.domain
2701
2753
  });
2702
2754
  ctx.shared.set(`hosted-zone-${id}-id`, hostedZone.id);
2703
- const certificate = new aws5.acm.Certificate(group2, "local", {
2755
+ const certificate = new aws6.acm.Certificate(group2, "local", {
2704
2756
  domainName: props.domain,
2705
2757
  alternativeNames: [`*.${props.domain}`]
2706
2758
  });
2707
2759
  hostedZone.addRecord("local-cert-1", certificate.validationRecord(0));
2708
2760
  hostedZone.addRecord("local-cert-2", certificate.validationRecord(1));
2709
- const validation = new aws5.acm.CertificateValidation(group2, "local", {
2761
+ const validation = new aws6.acm.CertificateValidation(group2, "local", {
2710
2762
  certificateArn: certificate.arn
2711
2763
  });
2712
2764
  ctx.shared.set(`local-certificate-${id}-arn`, validation.arn);
2713
2765
  if (ctx.appConfig.region !== "us-east-1") {
2714
- const globalCertificate = new aws5.acm.Certificate(group2, "global", {
2766
+ const globalCertificate = new aws6.acm.Certificate(group2, "global", {
2715
2767
  domainName: props.domain,
2716
2768
  alternativeNames: [`*.${props.domain}`],
2717
2769
  region: "us-east-1"
2718
2770
  });
2719
2771
  hostedZone.addRecord("global-cert-1", globalCertificate.validationRecord(0));
2720
2772
  hostedZone.addRecord("global-cert-2", globalCertificate.validationRecord(1));
2721
- const globalValidation = new aws5.acm.CertificateValidation(group2, "global", {
2773
+ const globalValidation = new aws6.acm.CertificateValidation(group2, "global", {
2722
2774
  certificateArn: globalCertificate.arn,
2723
2775
  region: "us-east-1"
2724
2776
  });
@@ -2726,7 +2778,7 @@ var domainFeature = defineFeature({
2726
2778
  } else {
2727
2779
  ctx.shared.set(`global-certificate-${id}-arn`, validation.arn);
2728
2780
  }
2729
- const emailIdentity = new aws5.ses.EmailIdentity(group2, "mail", {
2781
+ const emailIdentity = new aws6.ses.EmailIdentity(group2, "mail", {
2730
2782
  emailIdentity: props.domain,
2731
2783
  mailFromDomain: `mail.${props.domain}`,
2732
2784
  configurationSetName: configurationSet.name,
@@ -2735,30 +2787,30 @@ var domainFeature = defineFeature({
2735
2787
  });
2736
2788
  let i = 0;
2737
2789
  for (const record of emailIdentity.dkimRecords) {
2738
- new aws5.route53.RecordSet(group2, `dkim-${++i}`, {
2790
+ new aws6.route53.RecordSet(group2, `dkim-${++i}`, {
2739
2791
  hostedZoneId: hostedZone.id,
2740
2792
  ...record
2741
2793
  });
2742
2794
  }
2743
- new aws5.route53.RecordSet(group2, `MX`, {
2795
+ new aws6.route53.RecordSet(group2, `MX`, {
2744
2796
  hostedZoneId: hostedZone.id,
2745
2797
  name: `mail.${props.domain}`,
2746
2798
  type: "MX",
2747
- ttl: minutes3(5),
2799
+ ttl: minutes4(5),
2748
2800
  records: [`10 feedback-smtp.${ctx.appConfig.region}.amazonses.com`]
2749
2801
  });
2750
- new aws5.route53.RecordSet(group2, `SPF`, {
2802
+ new aws6.route53.RecordSet(group2, `SPF`, {
2751
2803
  hostedZoneId: hostedZone.id,
2752
2804
  name: `mail.${props.domain}`,
2753
2805
  type: "TXT",
2754
- ttl: minutes3(5),
2806
+ ttl: minutes4(5),
2755
2807
  records: ['"v=spf1 include:amazonses.com -all"']
2756
2808
  });
2757
- new aws5.route53.RecordSet(group2, `DMARC`, {
2809
+ new aws6.route53.RecordSet(group2, `DMARC`, {
2758
2810
  hostedZoneId: hostedZone.id,
2759
2811
  name: `_dmarc.${props.domain}`,
2760
2812
  type: "TXT",
2761
- ttl: minutes3(5),
2813
+ ttl: minutes4(5),
2762
2814
  records: ['"v=DMARC1; p=none;"']
2763
2815
  });
2764
2816
  const mailIdentityArn = emailIdentity.output(() => {
@@ -2768,7 +2820,7 @@ var domainFeature = defineFeature({
2768
2820
  ctx.shared.set(`mail-${props.domain}-arn`, mailIdentityArn);
2769
2821
  for (const record of props.dns ?? []) {
2770
2822
  const name = record.name ?? props.domain;
2771
- new aws5.route53.RecordSet(group2, `${name}-${record.type}`, {
2823
+ new aws6.route53.RecordSet(group2, `${name}-${record.type}`, {
2772
2824
  hostedZoneId: hostedZone.id,
2773
2825
  name,
2774
2826
  ...record
@@ -2785,7 +2837,7 @@ var domainFeature = defineFeature({
2785
2837
  });
2786
2838
 
2787
2839
  // src/feature/function/index.ts
2788
- import { aws as aws6, Node as Node6 } from "@awsless/formation";
2840
+ import { aws as aws7, Node as Node6 } from "@awsless/formation";
2789
2841
  import { camelCase as camelCase3 } from "change-case";
2790
2842
  import { relative } from "path";
2791
2843
  var typeGenCode2 = `
@@ -2839,13 +2891,13 @@ var functionFeature = defineFeature({
2839
2891
  },
2840
2892
  onApp(ctx) {
2841
2893
  const group = new Node6(ctx.base, "function", "asset");
2842
- const bucket = new aws6.s3.Bucket(group, "bucket", {
2894
+ const bucket = new aws7.s3.Bucket(group, "bucket", {
2843
2895
  name: formatGlobalResourceName(ctx.appConfig.name, "function", "assets"),
2844
2896
  versioning: true,
2845
2897
  forceDelete: true
2846
2898
  });
2847
2899
  ctx.shared.set("function-bucket-name", bucket.name);
2848
- const repository = new aws6.ecr.Repository(group, "repository", {
2900
+ const repository = new aws7.ecr.Repository(group, "repository", {
2849
2901
  name: formatGlobalResourceName(ctx.appConfig.name, "function", "repository", "-"),
2850
2902
  imageTagMutability: true
2851
2903
  });
@@ -2870,15 +2922,15 @@ var functionFeature = defineFeature({
2870
2922
  import { constantCase as constantCase4, paramCase as paramCase5 } from "change-case";
2871
2923
  import { generate } from "@awsless/graphql";
2872
2924
  import { mergeTypeDefs } from "@graphql-tools/merge";
2873
- import { readFile as readFile5 } from "fs/promises";
2925
+ import { readFile as readFile6 } from "fs/promises";
2874
2926
  import { buildSchema, print } from "graphql";
2875
- import { Asset as Asset2, aws as aws7, Node as Node7 } from "@awsless/formation";
2927
+ import { Asset as Asset2, aws as aws8, Node as Node7 } from "@awsless/formation";
2876
2928
  import { createHash as createHash5 } from "crypto";
2877
2929
 
2878
2930
  // src/build/fingerprint.ts
2879
2931
  import { createHash as createHash3 } from "crypto";
2880
- import { readFile as readFile4, readdir as readdir2, stat as stat4 } from "fs/promises";
2881
- import { basename as basename5, dirname as dirname7, extname as extname4, join as join7 } from "path";
2932
+ import { readFile as readFile5, readdir as readdir2, stat as stat4 } from "fs/promises";
2933
+ import { basename as basename5, dirname as dirname8, extname as extname4, join as join8 } from "path";
2882
2934
  import parseStaticImports2 from "parse-static-imports";
2883
2935
  var extensions2 = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
2884
2936
  var generateFileHashes2 = async (file, hashes) => {
@@ -2906,7 +2958,7 @@ var fingerprintFromDirectory = async (dir) => {
2906
2958
  const files = await readdir2(dir, { recursive: true });
2907
2959
  for (const file of files) {
2908
2960
  if (extensions2.includes(extname4(file).substring(1)) && file.at(0) !== "_") {
2909
- await generateFileHashes2(join7(dir, file), hashes);
2961
+ await generateFileHashes2(join8(dir, file), hashes);
2910
2962
  }
2911
2963
  }
2912
2964
  const merge2 = Buffer.concat(Array.from(hashes.values()).sort());
@@ -2920,17 +2972,17 @@ var readModuleFile2 = (file) => {
2920
2972
  return readFiles2([
2921
2973
  file,
2922
2974
  ...extensions2.map((exp) => `${file}.${exp}`),
2923
- ...extensions2.map((exp) => join7(file, `/index.${exp}`))
2975
+ ...extensions2.map((exp) => join8(file, `/index.${exp}`))
2924
2976
  ]);
2925
2977
  }
2926
- return readFile4(file, "utf8");
2978
+ return readFile5(file, "utf8");
2927
2979
  };
2928
2980
  var readFiles2 = async (files) => {
2929
2981
  for (const file of files) {
2930
2982
  try {
2931
2983
  const s = await stat4(file);
2932
2984
  if (s.isFile()) {
2933
- return readFile4(file, "utf8");
2985
+ return readFile5(file, "utf8");
2934
2986
  }
2935
2987
  } catch (_) {
2936
2988
  continue;
@@ -2940,7 +2992,7 @@ var readFiles2 = async (files) => {
2940
2992
  };
2941
2993
  var findDependencies2 = async (file, code) => {
2942
2994
  const imports = await parseStaticImports2(code);
2943
- return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join7(dirname7(file), value) : value);
2995
+ return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join8(dirname8(file), value) : value);
2944
2996
  };
2945
2997
 
2946
2998
  // src/util/id.ts
@@ -2973,7 +3025,7 @@ import { swc as swc2, minify as swcMinify2 } from "rollup-plugin-swc3";
2973
3025
  import json2 from "@rollup/plugin-json";
2974
3026
  import commonjs2 from "@rollup/plugin-commonjs";
2975
3027
  import nodeResolve2 from "@rollup/plugin-node-resolve";
2976
- import { dirname as dirname8 } from "path";
3028
+ import { dirname as dirname9 } from "path";
2977
3029
  var buildTypeScriptResolver = async (input, { minify = true } = {}) => {
2978
3030
  const bundle = await rollup2({
2979
3031
  input,
@@ -2995,7 +3047,7 @@ var buildTypeScriptResolver = async (input, { minify = true } = {}) => {
2995
3047
  // minify,
2996
3048
  // module: true,
2997
3049
  jsc: {
2998
- baseUrl: dirname8(input),
3050
+ baseUrl: dirname9(input),
2999
3051
  minify: { sourceMap: true }
3000
3052
  },
3001
3053
  sourceMaps: true
@@ -3080,7 +3132,7 @@ var graphqlFeature = defineFeature({
3080
3132
  for (const [id, files] of apis) {
3081
3133
  const sources = await Promise.all(
3082
3134
  files.map((file) => {
3083
- return readFile5(file, "utf8");
3135
+ return readFile6(file, "utf8");
3084
3136
  })
3085
3137
  );
3086
3138
  if (sources.length) {
@@ -3118,7 +3170,7 @@ var graphqlFeature = defineFeature({
3118
3170
  authorizer = lambda;
3119
3171
  }
3120
3172
  const name = formatGlobalResourceName(ctx.app.name, "graphql", id);
3121
- const api = new aws7.appsync.GraphQLApi(group, "api", {
3173
+ const api = new aws8.appsync.GraphQLApi(group, "api", {
3122
3174
  name,
3123
3175
  type: "graphql",
3124
3176
  auth: {
@@ -3136,7 +3188,7 @@ var graphqlFeature = defineFeature({
3136
3188
  }
3137
3189
  });
3138
3190
  if (typeof props.auth === "object") {
3139
- new aws7.lambda.Permission(group, "authorizer", {
3191
+ new aws8.lambda.Permission(group, "authorizer", {
3140
3192
  functionArn: authorizer.arn,
3141
3193
  principal: "appsync.amazonaws.com",
3142
3194
  action: "lambda:InvokeFunction"
@@ -3149,7 +3201,7 @@ var graphqlFeature = defineFeature({
3149
3201
  for (const stack of ctx.stackConfigs) {
3150
3202
  const file = stack.graphql?.[id]?.schema;
3151
3203
  if (file) {
3152
- const source = await readFile5(file, "utf8");
3204
+ const source = await readFile6(file, "utf8");
3153
3205
  const finger2 = createHash5("sha1").update(source).digest("hex");
3154
3206
  sources.push(source);
3155
3207
  fingers.push(finger2);
@@ -3165,7 +3217,7 @@ var graphqlFeature = defineFeature({
3165
3217
  };
3166
3218
  });
3167
3219
  });
3168
- new aws7.appsync.GraphQLSchema(group, "schema", {
3220
+ new aws8.appsync.GraphQLSchema(group, "schema", {
3169
3221
  apiId: api.id,
3170
3222
  definition: Asset2.fromFile(getBuildPath("graphql-schema", name, "schema.gql"))
3171
3223
  });
@@ -3188,15 +3240,15 @@ var graphqlFeature = defineFeature({
3188
3240
  if (props.domain) {
3189
3241
  const domainName = formatFullDomainName(ctx.appConfig, props.domain, props.subDomain);
3190
3242
  const domainGroup = new Node7(group, "domain", domainName);
3191
- const domain = new aws7.appsync.DomainName(domainGroup, "domain", {
3243
+ const domain = new aws8.appsync.DomainName(domainGroup, "domain", {
3192
3244
  domainName,
3193
3245
  certificateArn: ctx.shared.get(`global-certificate-${props.domain}-arn`)
3194
3246
  });
3195
- new aws7.appsync.DomainNameApiAssociation(domainGroup, "association", {
3247
+ new aws8.appsync.DomainNameApiAssociation(domainGroup, "association", {
3196
3248
  apiId: api.id,
3197
3249
  domainName: domain.domainName
3198
3250
  });
3199
- new aws7.route53.RecordSet(domainGroup, "record", {
3251
+ new aws8.route53.RecordSet(domainGroup, "record", {
3200
3252
  hostedZoneId: ctx.shared.get(`hosted-zone-${props.domain}-id`),
3201
3253
  type: "A",
3202
3254
  name: domainName,
@@ -3229,7 +3281,7 @@ var graphqlFeature = defineFeature({
3229
3281
  ...props2.consumer,
3230
3282
  description: `${id} ${typeName}.${fieldName}`
3231
3283
  });
3232
- const role = new aws7.iam.Role(resolverGroup, "source-role", {
3284
+ const role = new aws8.iam.Role(resolverGroup, "source-role", {
3233
3285
  assumedBy: "appsync.amazonaws.com",
3234
3286
  policies: [
3235
3287
  {
@@ -3243,7 +3295,7 @@ var graphqlFeature = defineFeature({
3243
3295
  }
3244
3296
  ]
3245
3297
  });
3246
- const source = new aws7.appsync.DataSource(resolverGroup, "source", {
3298
+ const source = new aws8.appsync.DataSource(resolverGroup, "source", {
3247
3299
  apiId,
3248
3300
  name,
3249
3301
  role: role.arn,
@@ -3256,13 +3308,13 @@ var graphqlFeature = defineFeature({
3256
3308
  } else if (defaultProps.resolver) {
3257
3309
  code = Asset2.fromFile(getBuildPath("graphql-resolver", id, "resolver.js"));
3258
3310
  }
3259
- const config2 = new aws7.appsync.FunctionConfiguration(resolverGroup, "config", {
3311
+ const config2 = new aws8.appsync.FunctionConfiguration(resolverGroup, "config", {
3260
3312
  apiId,
3261
3313
  name,
3262
3314
  code,
3263
3315
  dataSourceName: source.name
3264
3316
  });
3265
- new aws7.appsync.Resolver(resolverGroup, "resolver", {
3317
+ new aws8.appsync.Resolver(resolverGroup, "resolver", {
3266
3318
  apiId,
3267
3319
  typeName,
3268
3320
  fieldName,
@@ -3276,7 +3328,7 @@ var graphqlFeature = defineFeature({
3276
3328
  });
3277
3329
 
3278
3330
  // src/feature/http/index.ts
3279
- import { aws as aws8, Node as Node8 } from "@awsless/formation";
3331
+ import { aws as aws9, Node as Node8 } from "@awsless/formation";
3280
3332
  import { camelCase as camelCase4, constantCase as constantCase5 } from "change-case";
3281
3333
  import { relative as relative2 } from "path";
3282
3334
  var parseRoute = (route) => {
@@ -3352,17 +3404,17 @@ var httpFeature = defineFeature({
3352
3404
  return;
3353
3405
  }
3354
3406
  const group = new Node8(ctx.base, "http", "main");
3355
- const securityGroup = new aws8.ec2.SecurityGroup(group, "http", {
3407
+ const securityGroup = new aws9.ec2.SecurityGroup(group, "http", {
3356
3408
  vpcId: ctx.shared.get(`vpc-id`),
3357
3409
  name: formatGlobalResourceName(ctx.app.name, "http", "http"),
3358
3410
  description: `Global security group for HTTP api.`
3359
3411
  });
3360
- const port = aws8.ec2.Port.tcp(443);
3361
- securityGroup.addIngressRule({ port, peer: aws8.ec2.Peer.anyIpv4() });
3362
- securityGroup.addIngressRule({ port, peer: aws8.ec2.Peer.anyIpv6() });
3412
+ const port = aws9.ec2.Port.tcp(443);
3413
+ securityGroup.addIngressRule({ port, peer: aws9.ec2.Peer.anyIpv4() });
3414
+ securityGroup.addIngressRule({ port, peer: aws9.ec2.Peer.anyIpv6() });
3363
3415
  for (const [id, props] of Object.entries(ctx.appConfig.defaults?.http ?? {})) {
3364
3416
  const group2 = new Node8(ctx.base, "http", id);
3365
- const loadBalancer = new aws8.elb.LoadBalancer(group2, "balancer", {
3417
+ const loadBalancer = new aws9.elb.LoadBalancer(group2, "balancer", {
3366
3418
  name: formatGlobalResourceName(ctx.app.name, "http", id),
3367
3419
  type: "application",
3368
3420
  securityGroups: [securityGroup.id],
@@ -3372,13 +3424,13 @@ var httpFeature = defineFeature({
3372
3424
  ctx.shared.get(`vpc-public-subnet-id-2`)
3373
3425
  ]
3374
3426
  });
3375
- const listener = new aws8.elb.Listener(group2, "listener", {
3427
+ const listener = new aws9.elb.Listener(group2, "listener", {
3376
3428
  loadBalancerArn: loadBalancer.arn,
3377
3429
  port: 443,
3378
3430
  protocol: "https",
3379
3431
  certificates: [ctx.shared.get(`local-certificate-${props.domain}-arn`)],
3380
3432
  defaultActions: [
3381
- aws8.elb.ListenerAction.fixedResponse({
3433
+ aws9.elb.ListenerAction.fixedResponse({
3382
3434
  statusCode: 404,
3383
3435
  contentType: "application/json",
3384
3436
  messageBody: JSON.stringify({
@@ -3389,7 +3441,7 @@ var httpFeature = defineFeature({
3389
3441
  });
3390
3442
  ctx.shared.set(`http-${id}-listener-arn`, listener.arn);
3391
3443
  const domainName = formatFullDomainName(ctx.appConfig, props.domain, props.subDomain);
3392
- new aws8.route53.RecordSet(group2, domainName, {
3444
+ new aws9.route53.RecordSet(group2, domainName, {
3393
3445
  hostedZoneId: ctx.shared.get(`hosted-zone-${props.domain}-id`),
3394
3446
  name: domainName,
3395
3447
  type: "A",
@@ -3418,25 +3470,25 @@ var httpFeature = defineFeature({
3418
3470
  description: routeKey
3419
3471
  });
3420
3472
  const name = formatLocalResourceName(ctx.app.name, ctx.stack.name, "http", routeId);
3421
- const permission = new aws8.lambda.Permission(routeGroup, id, {
3473
+ const permission = new aws9.lambda.Permission(routeGroup, id, {
3422
3474
  action: "lambda:InvokeFunction",
3423
3475
  principal: "elasticloadbalancing.amazonaws.com",
3424
3476
  functionArn: lambda.arn
3425
3477
  // sourceArn: `arn:aws:elasticloadbalancing:${ctx.appConfig.region}:*:targetgroup/${name}/*`,
3426
3478
  });
3427
- const target = new aws8.elb.TargetGroup(routeGroup, id, {
3479
+ const target = new aws9.elb.TargetGroup(routeGroup, id, {
3428
3480
  name,
3429
3481
  type: "lambda",
3430
3482
  targets: [lambda.arn]
3431
3483
  }).dependsOn(permission);
3432
- new aws8.elb.ListenerRule(routeGroup, id, {
3484
+ new aws9.elb.ListenerRule(routeGroup, id, {
3433
3485
  listenerArn: ctx.shared.get(`http-${id}-listener-arn`),
3434
3486
  priority: generatePriority(ctx.stackConfig.name, routeKey),
3435
3487
  conditions: [
3436
- aws8.elb.ListenerCondition.httpRequestMethods([method]),
3437
- aws8.elb.ListenerCondition.pathPatterns([path])
3488
+ aws9.elb.ListenerCondition.httpRequestMethods([method]),
3489
+ aws9.elb.ListenerCondition.pathPatterns([path])
3438
3490
  ],
3439
- actions: [aws8.elb.ListenerAction.forward([target.arn])]
3491
+ actions: [aws9.elb.ListenerAction.forward([target.arn])]
3440
3492
  }).dependsOn(target);
3441
3493
  }
3442
3494
  }
@@ -3445,22 +3497,22 @@ var httpFeature = defineFeature({
3445
3497
 
3446
3498
  // src/feature/instance/index.ts
3447
3499
  import { days as days3 } from "@awsless/duration";
3448
- import { Asset as Asset3, aws as aws9, combine, Node as Node9, Output as Output2, unwrap } from "@awsless/formation";
3500
+ import { Asset as Asset3, aws as aws10, combine, Node as Node9, Output as Output2, unwrap } from "@awsless/formation";
3449
3501
  import { hashElement as hashElement2 } from "folder-hash";
3450
- import { mkdir as mkdir2 } from "fs/promises";
3451
- import { dirname as dirname9 } from "path";
3502
+ import { mkdir as mkdir3 } from "fs/promises";
3503
+ import { dirname as dirname10 } from "path";
3452
3504
  import { zip } from "zip-a-folder";
3453
3505
  var instanceFeature = defineFeature({
3454
3506
  name: "instance",
3455
3507
  onApp(ctx) {
3456
3508
  const group = new Node9(ctx.base, "instance", "asset");
3457
- const bucket = new aws9.s3.Bucket(group, "bucket", {
3509
+ const bucket = new aws10.s3.Bucket(group, "bucket", {
3458
3510
  name: formatGlobalResourceName(ctx.appConfig.name, "instance", "assets"),
3459
3511
  forceDelete: true
3460
3512
  });
3461
3513
  ctx.shared.set("instance-bucket-name", bucket.name);
3462
3514
  if (ctx.appConfig.defaults.instance.connect) {
3463
- new aws9.ec2.InstanceConnectEndpoint(group, "connect", {
3515
+ new aws10.ec2.InstanceConnectEndpoint(group, "connect", {
3464
3516
  name: ctx.appConfig.name,
3465
3517
  subnetId: ctx.shared.get(`vpc-public-subnet-id-1`),
3466
3518
  securityGroupIds: [ctx.shared.get("vpc-security-group-id")]
@@ -3516,16 +3568,16 @@ var instanceFeature = defineFeature({
3516
3568
  }
3517
3569
  });
3518
3570
  await build3(version.hash, async () => {
3519
- await mkdir2(dirname9(bundleFile), { recursive: true });
3571
+ await mkdir3(dirname10(bundleFile), { recursive: true });
3520
3572
  await zip(props.code, bundleFile);
3521
3573
  });
3522
3574
  });
3523
- const code = new aws9.s3.BucketObject(group, "code", {
3575
+ const code = new aws10.s3.BucketObject(group, "code", {
3524
3576
  key: name,
3525
3577
  bucket: bucketName,
3526
3578
  body: Asset3.fromFile(bundleFile)
3527
3579
  });
3528
- const template = new aws9.ec2.LaunchTemplate(group, "template", {
3580
+ const template = new aws10.ec2.LaunchTemplate(group, "template", {
3529
3581
  name,
3530
3582
  imageId: props.image,
3531
3583
  instanceType: props.type,
@@ -3533,11 +3585,11 @@ var instanceFeature = defineFeature({
3533
3585
  monitoring: true,
3534
3586
  userData
3535
3587
  });
3536
- const role = new aws9.iam.Role(group, "role", {
3588
+ const role = new aws10.iam.Role(group, "role", {
3537
3589
  name,
3538
3590
  assumedBy: "ec2.amazonaws.com"
3539
3591
  });
3540
- const policy = new aws9.iam.RolePolicy(group, "policy", {
3592
+ const policy = new aws10.iam.RolePolicy(group, "policy", {
3541
3593
  name,
3542
3594
  role: role.name
3543
3595
  });
@@ -3546,18 +3598,18 @@ var instanceFeature = defineFeature({
3546
3598
  resources: [bucketName.apply((bucket) => `arn:aws:s3:::${bucket}/${name}`)]
3547
3599
  });
3548
3600
  ctx.registerPolicy(policy);
3549
- const profile = new aws9.iam.InstanceProfile(group, "profile", {
3601
+ const profile = new aws10.iam.InstanceProfile(group, "profile", {
3550
3602
  name,
3551
3603
  roles: [role.name]
3552
3604
  });
3553
- const instance = new aws9.ec2.Instance(group, "instance", {
3605
+ const instance = new aws10.ec2.Instance(group, "instance", {
3554
3606
  name,
3555
3607
  iamInstanceProfile: profile.arn,
3556
3608
  launchTemplate: template,
3557
3609
  subnetId: ctx.shared.get(`vpc-public-subnet-id-1`)
3558
3610
  });
3559
3611
  instance.dependsOn(code);
3560
- const logGroup = new aws9.cloudWatch.LogGroup(group, "log", {
3612
+ const logGroup = new aws10.cloudWatch.LogGroup(group, "log", {
3561
3613
  name: `/awsless/instance/${name}`,
3562
3614
  retention: days3(3)
3563
3615
  });
@@ -3576,7 +3628,7 @@ var instanceFeature = defineFeature({
3576
3628
  });
3577
3629
 
3578
3630
  // src/feature/on-failure/index.ts
3579
- import { Node as Node10, aws as aws10 } from "@awsless/formation";
3631
+ import { Node as Node10, aws as aws11 } from "@awsless/formation";
3580
3632
  var onFailureFeature = defineFeature({
3581
3633
  name: "on-failure",
3582
3634
  onApp(ctx) {
@@ -3587,7 +3639,7 @@ var onFailureFeature = defineFeature({
3587
3639
  if (count > 1) {
3588
3640
  throw new TypeError("Only 1 onFailure configuration is allowed in your app.");
3589
3641
  }
3590
- const queue2 = new aws10.sqs.Queue(ctx.base, "on-failure", {
3642
+ const queue2 = new aws11.sqs.Queue(ctx.base, "on-failure", {
3591
3643
  name: formatGlobalResourceName(ctx.appConfig.name, "on-failure", "failure")
3592
3644
  });
3593
3645
  ctx.shared.set("on-failure-queue-arn", queue2.arn);
@@ -3600,7 +3652,7 @@ var onFailureFeature = defineFeature({
3600
3652
  const queueArn = ctx.shared.get("on-failure-queue-arn");
3601
3653
  const group = new Node10(ctx.stack, "on-failure", "failure");
3602
3654
  const { lambda, policy } = createLambdaFunction(group, ctx, "on-failure", "failure", onFailure);
3603
- const source = new aws10.lambda.EventSourceMapping(group, "on-failure", {
3655
+ const source = new aws11.lambda.EventSourceMapping(group, "on-failure", {
3604
3656
  functionArn: lambda.arn,
3605
3657
  sourceArn: queueArn,
3606
3658
  batchSize: 10
@@ -3620,7 +3672,7 @@ var onFailureFeature = defineFeature({
3620
3672
  });
3621
3673
 
3622
3674
  // src/feature/pubsub/index.ts
3623
- import { aws as aws11, Node as Node11 } from "@awsless/formation";
3675
+ import { aws as aws12, Node as Node11 } from "@awsless/formation";
3624
3676
  var pubsubFeature = defineFeature({
3625
3677
  name: "pubsub",
3626
3678
  onApp(ctx) {
@@ -3636,13 +3688,13 @@ var pubsubFeature = defineFeature({
3636
3688
  const group = new Node11(ctx.stack, "pubsub", id);
3637
3689
  const { lambda } = createAsyncLambdaFunction(group, ctx, `pubsub`, id, props.consumer);
3638
3690
  const name = formatLocalResourceName(ctx.app.name, ctx.stack.name, "pubsub", id);
3639
- const topic = new aws11.iot.TopicRule(group, "rule", {
3691
+ const topic = new aws12.iot.TopicRule(group, "rule", {
3640
3692
  name: name.replaceAll("-", "_"),
3641
3693
  sql: props.sql,
3642
3694
  sqlVersion: props.sqlVersion,
3643
3695
  actions: [{ lambda: { functionArn: lambda.arn } }]
3644
3696
  });
3645
- new aws11.lambda.Permission(group, "permission", {
3697
+ new aws12.lambda.Permission(group, "permission", {
3646
3698
  action: "lambda:InvokeFunction",
3647
3699
  principal: "iot.amazonaws.com",
3648
3700
  functionArn: lambda.arn,
@@ -3653,7 +3705,7 @@ var pubsubFeature = defineFeature({
3653
3705
  });
3654
3706
 
3655
3707
  // src/feature/queue/index.ts
3656
- import { aws as aws12, Node as Node12 } from "@awsless/formation";
3708
+ import { aws as aws13, Node as Node12 } from "@awsless/formation";
3657
3709
  import { camelCase as camelCase5, constantCase as constantCase6 } from "change-case";
3658
3710
  import deepmerge2 from "deepmerge";
3659
3711
  import { relative as relative3 } from "path";
@@ -3709,14 +3761,14 @@ var queueFeature = defineFeature({
3709
3761
  for (const [id, local2] of Object.entries(ctx.stackConfig.queues || {})) {
3710
3762
  const props = deepmerge2(ctx.appConfig.defaults.queue, local2);
3711
3763
  const group = new Node12(ctx.stack, "queue", id);
3712
- const queue2 = new aws12.sqs.Queue(group, "queue", {
3764
+ const queue2 = new aws13.sqs.Queue(group, "queue", {
3713
3765
  name: formatLocalResourceName(ctx.appConfig.name, ctx.stack.name, "queue", id),
3714
3766
  deadLetterArn: getGlobalOnFailure(ctx),
3715
3767
  ...props
3716
3768
  });
3717
3769
  const { lambda, policy } = createLambdaFunction(group, ctx, `queue`, id, props.consumer);
3718
3770
  lambda.addEnvironment("LOG_VIEWABLE_ERROR", "1");
3719
- new aws12.lambda.EventSourceMapping(group, "event", {
3771
+ new aws13.lambda.EventSourceMapping(group, "event", {
3720
3772
  functionArn: lambda.arn,
3721
3773
  sourceArn: queue2.arn,
3722
3774
  batchSize: props.batchSize,
@@ -3736,18 +3788,18 @@ var queueFeature = defineFeature({
3736
3788
  });
3737
3789
 
3738
3790
  // src/feature/rest/index.ts
3739
- import { aws as aws13, Node as Node13 } from "@awsless/formation";
3791
+ import { aws as aws14, Node as Node13 } from "@awsless/formation";
3740
3792
  import { constantCase as constantCase7 } from "change-case";
3741
3793
  var restFeature = defineFeature({
3742
3794
  name: "rest",
3743
3795
  onApp(ctx) {
3744
3796
  for (const [id, props] of Object.entries(ctx.appConfig.defaults?.rest ?? {})) {
3745
3797
  const group = new Node13(ctx.base, "rest", id);
3746
- const api = new aws13.apiGatewayV2.Api(group, "api", {
3798
+ const api = new aws14.apiGatewayV2.Api(group, "api", {
3747
3799
  name: formatGlobalResourceName(ctx.app.name, "rest", id),
3748
3800
  protocolType: "HTTP"
3749
3801
  });
3750
- const stage = new aws13.apiGatewayV2.Stage(group, "stage", {
3802
+ const stage = new aws14.apiGatewayV2.Stage(group, "stage", {
3751
3803
  name: "v1",
3752
3804
  apiId: api.id
3753
3805
  });
@@ -3756,7 +3808,7 @@ var restFeature = defineFeature({
3756
3808
  const domainName = formatFullDomainName(ctx.appConfig, props.domain, props.subDomain);
3757
3809
  const hostedZoneId = ctx.shared.get(`hosted-zone-${props.domain}-id`);
3758
3810
  const certificateArn = ctx.shared.get(`certificate-${props.domain}-arn`);
3759
- const domain = new aws13.apiGatewayV2.DomainName(group, "domain", {
3811
+ const domain = new aws14.apiGatewayV2.DomainName(group, "domain", {
3760
3812
  name: domainName,
3761
3813
  certificates: [
3762
3814
  {
@@ -3764,12 +3816,12 @@ var restFeature = defineFeature({
3764
3816
  }
3765
3817
  ]
3766
3818
  });
3767
- const mapping = new aws13.apiGatewayV2.ApiMapping(group, "mapping", {
3819
+ const mapping = new aws14.apiGatewayV2.ApiMapping(group, "mapping", {
3768
3820
  apiId: api.id,
3769
3821
  domainName: domain.name,
3770
3822
  stage: stage.name
3771
3823
  });
3772
- const record = new aws13.route53.RecordSet(group, "record", {
3824
+ const record = new aws14.route53.RecordSet(group, "record", {
3773
3825
  hostedZoneId,
3774
3826
  type: "A",
3775
3827
  name: domainName,
@@ -3796,12 +3848,12 @@ var restFeature = defineFeature({
3796
3848
  ...props,
3797
3849
  description: `${id} ${routeKey}`
3798
3850
  });
3799
- const permission = new aws13.lambda.Permission(group, "permission", {
3851
+ const permission = new aws14.lambda.Permission(group, "permission", {
3800
3852
  action: "lambda:InvokeFunction",
3801
3853
  principal: "apigateway.amazonaws.com",
3802
3854
  functionArn: lambda.arn
3803
3855
  });
3804
- const integration = new aws13.apiGatewayV2.Integration(group, "integration", {
3856
+ const integration = new aws14.apiGatewayV2.Integration(group, "integration", {
3805
3857
  apiId,
3806
3858
  description: `${id} ${routeKey}`,
3807
3859
  method: "POST",
@@ -3811,7 +3863,7 @@ var restFeature = defineFeature({
3811
3863
  return `arn:aws:apigateway:${ctx.appConfig.region}:lambda:path/2015-03-31/functions/${arn}/invocations`;
3812
3864
  })
3813
3865
  });
3814
- const route = new aws13.apiGatewayV2.Route(group, "route", {
3866
+ const route = new aws14.apiGatewayV2.Route(group, "route", {
3815
3867
  apiId,
3816
3868
  routeKey,
3817
3869
  target: integration.id.apply((id2) => `integrations/${id2}`)
@@ -3823,7 +3875,7 @@ var restFeature = defineFeature({
3823
3875
  });
3824
3876
 
3825
3877
  // src/feature/search/index.ts
3826
- import { aws as aws14, Node as Node14 } from "@awsless/formation";
3878
+ import { aws as aws15, Node as Node14 } from "@awsless/formation";
3827
3879
  import { constantCase as constantCase8 } from "change-case";
3828
3880
  var typeGenCode4 = `
3829
3881
  import { AnyStruct, Table } from '@awsless/open-search'
@@ -3852,7 +3904,7 @@ var searchFeature = defineFeature({
3852
3904
  onStack(ctx) {
3853
3905
  for (const [id, props] of Object.entries(ctx.stackConfig.searchs ?? {})) {
3854
3906
  const group = new Node14(ctx.stack, "search", id);
3855
- const openSearch = new aws14.openSearch.Domain(group, "domain", {
3907
+ const openSearch = new aws15.openSearch.Domain(group, "domain", {
3856
3908
  // name: formatLocalResourceName(ctx.app.name, ctx.stack.name, this.name, id),
3857
3909
  version: props.version,
3858
3910
  storageSize: props.storage,
@@ -3891,9 +3943,9 @@ var searchFeature = defineFeature({
3891
3943
 
3892
3944
  // src/feature/site/index.ts
3893
3945
  import { days as days4, seconds as seconds3 } from "@awsless/duration";
3894
- import { Asset as Asset4, aws as aws15, Node as Node15 } from "@awsless/formation";
3946
+ import { Asset as Asset4, aws as aws16, Node as Node15 } from "@awsless/formation";
3895
3947
  import { glob as glob2 } from "glob";
3896
- import { join as join8 } from "path";
3948
+ import { join as join9 } from "path";
3897
3949
 
3898
3950
  // src/feature/site/util.ts
3899
3951
  import { lookup, contentType } from "mime-types";
@@ -3932,7 +3984,7 @@ var siteFeature = defineFeature({
3932
3984
  ctx.onBind((name2, value) => {
3933
3985
  lambda.addEnvironment(name2, value);
3934
3986
  });
3935
- new aws15.lambda.Permission(group, "permission", {
3987
+ new aws16.lambda.Permission(group, "permission", {
3936
3988
  principal: "*",
3937
3989
  // principal: 'cloudfront.amazonaws.com',
3938
3990
  action: "lambda:InvokeFunctionUrl",
@@ -3941,7 +3993,7 @@ var siteFeature = defineFeature({
3941
3993
  // urlAuthType: 'aws-iam',
3942
3994
  // sourceArn: distribution.arn,
3943
3995
  });
3944
- const url = new aws15.lambda.Url(group, "url", {
3996
+ const url = new aws16.lambda.Url(group, "url", {
3945
3997
  targetArn: lambda.arn,
3946
3998
  authType: "none"
3947
3999
  // authType: 'aws-iam',
@@ -3953,7 +4005,7 @@ var siteFeature = defineFeature({
3953
4005
  });
3954
4006
  }
3955
4007
  if (props.static) {
3956
- bucket = new aws15.s3.Bucket(group, "bucket", {
4008
+ bucket = new aws16.s3.Bucket(group, "bucket", {
3957
4009
  name,
3958
4010
  forceDelete: true,
3959
4011
  website: {
@@ -3970,7 +4022,7 @@ var siteFeature = defineFeature({
3970
4022
  ]
3971
4023
  });
3972
4024
  bucket.deletionPolicy = "after-deployment";
3973
- const accessControl = new aws15.cloudFront.OriginAccessControl(group, `access`, {
4025
+ const accessControl = new aws16.cloudFront.OriginAccessControl(group, `access`, {
3974
4026
  name,
3975
4027
  type: "s3",
3976
4028
  behavior: "always",
@@ -3982,10 +4034,10 @@ var siteFeature = defineFeature({
3982
4034
  nodir: true
3983
4035
  });
3984
4036
  for (const file of files) {
3985
- const object = new aws15.s3.BucketObject(group, file, {
4037
+ const object = new aws16.s3.BucketObject(group, file, {
3986
4038
  bucket: bucket.name,
3987
4039
  key: file,
3988
- body: Asset4.fromFile(join8(props.static, file)),
4040
+ body: Asset4.fromFile(join9(props.static, file)),
3989
4041
  cacheControl: getCacheControl(file),
3990
4042
  contentType: getContentType(file)
3991
4043
  });
@@ -4005,14 +4057,14 @@ var siteFeature = defineFeature({
4005
4057
  statusCodes: [403, 404]
4006
4058
  });
4007
4059
  }
4008
- const cache = new aws15.cloudFront.CachePolicy(group, "cache", {
4060
+ const cache = new aws16.cloudFront.CachePolicy(group, "cache", {
4009
4061
  name,
4010
4062
  minTtl: seconds3(1),
4011
4063
  maxTtl: days4(365),
4012
4064
  defaultTtl: days4(1),
4013
4065
  ...props.cache
4014
4066
  });
4015
- const originRequest = new aws15.cloudFront.OriginRequestPolicy(group, "request", {
4067
+ const originRequest = new aws16.cloudFront.OriginRequestPolicy(group, "request", {
4016
4068
  name,
4017
4069
  header: {
4018
4070
  behavior: "all-except",
@@ -4020,7 +4072,7 @@ var siteFeature = defineFeature({
4020
4072
  }
4021
4073
  });
4022
4074
  const domainName = formatFullDomainName(ctx.appConfig, props.domain, props.subDomain);
4023
- const responseHeaders = new aws15.cloudFront.ResponseHeadersPolicy(group, "response", {
4075
+ const responseHeaders = new aws16.cloudFront.ResponseHeadersPolicy(group, "response", {
4024
4076
  name,
4025
4077
  cors: props.cors,
4026
4078
  remove: ["server"]
@@ -4028,7 +4080,7 @@ var siteFeature = defineFeature({
4028
4080
  // override: true,
4029
4081
  // },
4030
4082
  });
4031
- const distribution = new aws15.cloudFront.Distribution(group, "distribution", {
4083
+ const distribution = new aws16.cloudFront.Distribution(group, "distribution", {
4032
4084
  name,
4033
4085
  certificateArn: ctx.shared.get(`global-certificate-${props.domain}-arn`),
4034
4086
  compress: true,
@@ -4056,13 +4108,13 @@ var siteFeature = defineFeature({
4056
4108
  };
4057
4109
  })
4058
4110
  });
4059
- new aws15.cloudFront.InvalidateCache(group, "invalidate", {
4111
+ new aws16.cloudFront.InvalidateCache(group, "invalidate", {
4060
4112
  distributionId: distribution.id,
4061
4113
  paths: ["/*"],
4062
4114
  versions
4063
4115
  });
4064
4116
  if (props.static) {
4065
- new aws15.s3.BucketPolicy(group, `policy`, {
4117
+ new aws16.s3.BucketPolicy(group, `policy`, {
4066
4118
  bucketName: bucket.name,
4067
4119
  statements: [
4068
4120
  {
@@ -4088,7 +4140,7 @@ var siteFeature = defineFeature({
4088
4140
  ]
4089
4141
  });
4090
4142
  }
4091
- new aws15.route53.RecordSet(group, `record`, {
4143
+ new aws16.route53.RecordSet(group, `record`, {
4092
4144
  hostedZoneId: ctx.shared.get(`hosted-zone-${props.domain}-id`),
4093
4145
  type: "A",
4094
4146
  name: domainName,
@@ -4103,7 +4155,7 @@ var siteFeature = defineFeature({
4103
4155
  });
4104
4156
 
4105
4157
  // src/feature/store/index.ts
4106
- import { aws as aws16, Node as Node16 } from "@awsless/formation";
4158
+ import { aws as aws17, Node as Node16 } from "@awsless/formation";
4107
4159
  import { paramCase as paramCase6 } from "change-case";
4108
4160
  var typeGenCode5 = `
4109
4161
  import { Body, PutObjectProps, BodyStream, createPresignedPost } from '@awsless/s3'
@@ -4157,7 +4209,7 @@ var storeFeature = defineFeature({
4157
4209
  const eventGroup = new Node16(group, "event", event);
4158
4210
  const eventId = paramCase6(`${id}-${shortId(event)}`);
4159
4211
  const { lambda } = createAsyncLambdaFunction(eventGroup, ctx, `store`, eventId, funcProps);
4160
- new aws16.lambda.Permission(eventGroup, "permission", {
4212
+ new aws17.lambda.Permission(eventGroup, "permission", {
4161
4213
  action: "lambda:InvokeFunction",
4162
4214
  principal: "s3.amazonaws.com",
4163
4215
  functionArn: lambda.arn,
@@ -4168,7 +4220,7 @@ var storeFeature = defineFeature({
4168
4220
  function: lambda.arn
4169
4221
  });
4170
4222
  }
4171
- const bucket = new aws16.s3.Bucket(group, "store", {
4223
+ const bucket = new aws17.s3.Bucket(group, "store", {
4172
4224
  name: bucketName,
4173
4225
  versioning: props.versioning,
4174
4226
  lambdaConfigs,
@@ -4191,7 +4243,7 @@ var storeFeature = defineFeature({
4191
4243
  });
4192
4244
 
4193
4245
  // src/feature/stream/index.ts
4194
- import { aws as aws17, Node as Node17 } from "@awsless/formation";
4246
+ import { aws as aws18, Node as Node17 } from "@awsless/formation";
4195
4247
  import { constantCase as constantCase9 } from "change-case";
4196
4248
  var streamFeature = defineFeature({
4197
4249
  name: "stream",
@@ -4199,11 +4251,11 @@ var streamFeature = defineFeature({
4199
4251
  for (const [id, props] of Object.entries(ctx.stackConfig.streams ?? {})) {
4200
4252
  const group = new Node17(ctx.stack, "stream", id);
4201
4253
  const name = formatLocalResourceName(ctx.appConfig.name, ctx.stack.name, "stream", id);
4202
- const channel = new aws17.ivs.Channel(group, "channel", {
4254
+ const channel = new aws18.ivs.Channel(group, "channel", {
4203
4255
  name,
4204
4256
  ...props
4205
4257
  });
4206
- const streamKey = new aws17.ivs.StreamKey(group, "key", {
4258
+ const streamKey = new aws18.ivs.StreamKey(group, "key", {
4207
4259
  channel: channel.arn
4208
4260
  });
4209
4261
  const prefix = `STREAM_${constantCase9(ctx.stack.name)}_${constantCase9(id)}`;
@@ -4215,7 +4267,7 @@ var streamFeature = defineFeature({
4215
4267
  });
4216
4268
 
4217
4269
  // src/feature/table/index.ts
4218
- import { aws as aws18, Node as Node18 } from "@awsless/formation";
4270
+ import { aws as aws19, Node as Node18 } from "@awsless/formation";
4219
4271
  var tableFeature = defineFeature({
4220
4272
  name: "table",
4221
4273
  async onTypeGen(ctx) {
@@ -4235,7 +4287,7 @@ var tableFeature = defineFeature({
4235
4287
  onStack(ctx) {
4236
4288
  for (const [id, props] of Object.entries(ctx.stackConfig.tables ?? {})) {
4237
4289
  const group = new Node18(ctx.stack, "table", id);
4238
- const table2 = new aws18.dynamodb.Table(group, "table", {
4290
+ const table2 = new aws19.dynamodb.Table(group, "table", {
4239
4291
  ...props,
4240
4292
  name: formatLocalResourceName(ctx.appConfig.name, ctx.stackConfig.name, "table", id),
4241
4293
  stream: props.stream?.type
@@ -4244,7 +4296,7 @@ var tableFeature = defineFeature({
4244
4296
  const { lambda, policy } = createLambdaFunction(group, ctx, "table", id, props.stream.consumer);
4245
4297
  lambda.addEnvironment("LOG_VIEWABLE_ERROR", "1");
4246
4298
  const onFailure = getGlobalOnFailure(ctx);
4247
- const source = new aws18.lambda.EventSourceMapping(group, id, {
4299
+ const source = new aws19.lambda.EventSourceMapping(group, id, {
4248
4300
  functionArn: lambda.arn,
4249
4301
  sourceArn: table2.streamArn,
4250
4302
  batchSize: 100,
@@ -4338,7 +4390,7 @@ var testFeature = defineFeature({
4338
4390
  });
4339
4391
 
4340
4392
  // src/feature/topic/index.ts
4341
- import { aws as aws19, Node as Node20 } from "@awsless/formation";
4393
+ import { aws as aws20, Node as Node20 } from "@awsless/formation";
4342
4394
  var typeGenCode7 = `
4343
4395
  import type { PublishOptions } from '@awsless/sns'
4344
4396
  import type { Mock } from 'vitest'
@@ -4376,7 +4428,7 @@ var topicFeature = defineFeature({
4376
4428
  for (const stack of ctx.stackConfigs) {
4377
4429
  for (const id of stack.topics ?? []) {
4378
4430
  const group = new Node20(ctx.base, "topic", id);
4379
- const topic = new aws19.sns.Topic(group, "topic", {
4431
+ const topic = new aws20.sns.Topic(group, "topic", {
4380
4432
  name: formatGlobalResourceName(ctx.appConfig.name, "topic", id)
4381
4433
  });
4382
4434
  ctx.shared.set(`topic-${id}-arn`, topic.arn);
@@ -4396,19 +4448,19 @@ var topicFeature = defineFeature({
4396
4448
  const group = new Node20(ctx.stack, "topic", id);
4397
4449
  const topicArn = ctx.shared.get(`topic-${id}-arn`);
4398
4450
  if (typeof props === "string" && isEmail(props)) {
4399
- new aws19.sns.Subscription(group, id, {
4451
+ new aws20.sns.Subscription(group, id, {
4400
4452
  topicArn,
4401
4453
  protocol: "email",
4402
4454
  endpoint: props
4403
4455
  });
4404
4456
  } else if (typeof props === "object") {
4405
4457
  const { lambda } = createAsyncLambdaFunction(group, ctx, `topic`, id, props);
4406
- new aws19.sns.Subscription(group, id, {
4458
+ new aws20.sns.Subscription(group, id, {
4407
4459
  topicArn,
4408
4460
  protocol: "lambda",
4409
4461
  endpoint: lambda.arn
4410
4462
  });
4411
- new aws19.lambda.Permission(group, id, {
4463
+ new aws20.lambda.Permission(group, id, {
4412
4464
  action: "lambda:InvokeFunction",
4413
4465
  principal: "sns.amazonaws.com",
4414
4466
  functionArn: lambda.arn,
@@ -4420,45 +4472,37 @@ var topicFeature = defineFeature({
4420
4472
  });
4421
4473
 
4422
4474
  // src/feature/vpc/index.ts
4423
- import { ipv6CidrBlockFromString } from "@arcanyx/cidr-slicer";
4424
- import { aws as aws20, combine as combine2, Node as Node21 } from "@awsless/formation";
4475
+ import { aws as aws21, combine as combine2, Node as Node21 } from "@awsless/formation";
4425
4476
  var vpcFeature = defineFeature({
4426
4477
  name: "vpc",
4427
4478
  onApp(ctx) {
4428
4479
  const group = new Node21(ctx.base, "vpc", "main");
4429
- const vpc = new aws20.ec2.Vpc(group, "vpc", {
4480
+ const vpc = new aws21.ec2.Vpc(group, "vpc", {
4430
4481
  name: ctx.app.name,
4431
- cidrBlock: aws20.ec2.Peer.ipv4("10.0.0.0/16")
4482
+ cidrBlock: aws21.ec2.Peer.ipv4("10.0.0.0/16")
4432
4483
  // cidrBlock: aws.ec2.Peer.ipv6('fd00:10:20::/48'),
4433
4484
  // cidrBlock: aws.ec2.Peer.ipv6('2a05:d018:c69:6600::/56'),
4434
4485
  // enableDnsSupport: true,
4435
4486
  // enableDnsHostnames: true,
4436
4487
  });
4437
- const ipv6CidrBlock = new aws20.ec2.VPCCidrBlock(group, "ipv6", {
4438
- vpcId: vpc.id,
4439
- amazonProvidedIpv6CidrBlock: true
4440
- });
4441
- const slices = ipv6CidrBlock.ipv6CidrBlock.apply((ip) => {
4442
- return ipv6CidrBlockFromString(ip).slice(64);
4443
- });
4444
- const privateRouteTable = new aws20.ec2.RouteTable(group, "private", {
4488
+ const privateRouteTable = new aws21.ec2.RouteTable(group, "private", {
4445
4489
  vpcId: vpc.id,
4446
4490
  name: "private"
4447
4491
  });
4448
- const publicRouteTable = new aws20.ec2.RouteTable(group, "public", {
4492
+ const publicRouteTable = new aws21.ec2.RouteTable(group, "public", {
4449
4493
  vpcId: vpc.id,
4450
4494
  name: "public"
4451
4495
  });
4452
- const gateway = new aws20.ec2.InternetGateway(group, "gateway");
4453
- const attachment = new aws20.ec2.VPCGatewayAttachment(group, "attachment", {
4496
+ const gateway = new aws21.ec2.InternetGateway(group, "gateway");
4497
+ const attachment = new aws21.ec2.VPCGatewayAttachment(group, "attachment", {
4454
4498
  vpcId: vpc.id,
4455
4499
  internetGatewayId: gateway.id
4456
4500
  });
4457
- new aws20.ec2.Route(group, "route", {
4501
+ new aws21.ec2.Route(group, "route", {
4458
4502
  gatewayId: gateway.id,
4459
4503
  routeTableId: publicRouteTable.id,
4460
- // destination: aws.ec2.Peer.anyIpv4(),
4461
- destination: aws20.ec2.Peer.anyIpv6()
4504
+ destination: aws21.ec2.Peer.anyIpv4()
4505
+ // destination: aws.ec2.Peer.anyIpv6(),
4462
4506
  });
4463
4507
  ctx.shared.set(
4464
4508
  "vpc-id",
@@ -4473,19 +4517,20 @@ var vpcFeature = defineFeature({
4473
4517
  for (const i in zones) {
4474
4518
  const index = Number(i) + 1;
4475
4519
  const id = `${table2.identifier}-${index}`;
4476
- const subnet = new aws20.ec2.Subnet(group, id, {
4520
+ const subnet = new aws21.ec2.Subnet(group, id, {
4477
4521
  name: `${ctx.app.name}--${table2.identifier}-${index}`,
4478
4522
  vpcId: vpc.id,
4479
- cidrBlock: aws20.ec2.Peer.ipv4(`10.0.${block++}.0/24`),
4523
+ cidrBlock: aws21.ec2.Peer.ipv4(`10.0.${block++}.0/24`),
4480
4524
  // ipv6CidrBlock: aws.ec2.Peer.ipv6(`fd00:10:20:${++block}::/64`),
4481
4525
  // ipv6CidrBlock: aws.ec2.Peer.ipv6(`2a05:d018:c69:660${++block}::/64`),
4482
4526
  // ipv6CidrBlock: ipv6CidrBlock.ipv6CidrBlock.apply(ip => ),
4483
- ipv6CidrBlock: slices.apply((list4) => aws20.ec2.Peer.ipv6(list4.get(block++).toString())),
4484
- assignIpv6AddressOnCreation: true,
4527
+ // ipv6CidrBlock: slices.apply(list => aws.ec2.Peer.ipv6(list.get(block++).toString())),
4528
+ // assignIpv6AddressOnCreation: true,
4485
4529
  // ipv6Native: true,
4530
+ mapPublicIpOnLaunch: table2.identifier === "public",
4486
4531
  availabilityZone: ctx.appConfig.region + zones[i]
4487
4532
  });
4488
- new aws20.ec2.SubnetRouteTableAssociation(group, id, {
4533
+ new aws21.ec2.SubnetRouteTableAssociation(group, id, {
4489
4534
  routeTableId: table2.id,
4490
4535
  subnetId: subnet.id
4491
4536
  });
@@ -4556,7 +4601,7 @@ var getFiltersWithDeps = (stacks, filters) => {
4556
4601
  return list4;
4557
4602
  };
4558
4603
  var createApp = (props, filters = []) => {
4559
- const app = new App(props.appConfig.name);
4604
+ const app = new App2(props.appConfig.name);
4560
4605
  const base = new Stack(app, "base");
4561
4606
  const shared = new SharedData();
4562
4607
  const siteFunctions = [];
@@ -4921,55 +4966,6 @@ var config = (program2) => {
4921
4966
 
4922
4967
  // src/cli/command/delete.ts
4923
4968
  import { confirm as confirm3 } from "@clack/prompts";
4924
-
4925
- // src/util/workspace.ts
4926
- import { minutes as minutes4 } from "@awsless/duration";
4927
- import { aws as aws22, local, WorkSpace } from "@awsless/formation";
4928
- import { mkdir as mkdir3, readFile as readFile6, rm, writeFile as writeFile2 } from "fs/promises";
4929
- import { dirname as dirname10, join as join9 } from "path";
4930
- var createWorkSpace = (props) => {
4931
- const lockProvider = new aws22.dynamodb.LockProvider({
4932
- ...props,
4933
- tableName: "awsless-locks"
4934
- });
4935
- const stateProvider = new aws22.s3.StateProvider({
4936
- ...props,
4937
- bucket: `awsless-state-${props.accountId}`
4938
- });
4939
- const cloudProviders = aws22.createCloudProviders({
4940
- ...props,
4941
- timeout: minutes4(60)
4942
- });
4943
- const workspace = new WorkSpace({
4944
- lockProvider,
4945
- stateProvider,
4946
- cloudProviders,
4947
- concurrency: 15
4948
- });
4949
- return {
4950
- workspace,
4951
- lockProvider,
4952
- stateProvider
4953
- };
4954
- };
4955
- var pullRemoteState = async (app, stateProvider) => {
4956
- const file = join9(directories.state, `${app.urn}.json`);
4957
- const state2 = await stateProvider.get(app.urn);
4958
- await mkdir3(dirname10(file), { recursive: true });
4959
- if (typeof state2 === "undefined") {
4960
- await rm(file);
4961
- } else {
4962
- await writeFile2(file, JSON.stringify(state2, void 0, 2));
4963
- }
4964
- };
4965
- var pushRemoteState = async (app, stateProvider) => {
4966
- const file = join9(directories.state, `${app.urn}.json`);
4967
- const data = await readFile6(file, "utf8");
4968
- const state2 = JSON.parse(data);
4969
- await stateProvider.update(app.urn, state2);
4970
- };
4971
-
4972
- // src/cli/command/delete.ts
4973
4969
  var del2 = (program2) => {
4974
4970
  program2.command("delete").argument("[stacks...]", "Optionally filter stacks to delete").description("Delete your app from AWS").action(async (filters) => {
4975
4971
  await layout("delete", async ({ appConfig, stackConfigs }) => {