@awsless/cli 0.0.46-next.20 → 0.0.46-next.22

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
@@ -53724,9 +53724,9 @@ var require_nodefs_handler = __commonJS((exports, module) => {
53724
53724
  if (this.fsw.closed) {
53725
53725
  return;
53726
53726
  }
53727
- const dirname17 = sysPath.dirname(file2);
53727
+ const dirname18 = sysPath.dirname(file2);
53728
53728
  const basename4 = sysPath.basename(file2);
53729
- const parent = this.fsw._getWatchedDir(dirname17);
53729
+ const parent = this.fsw._getWatchedDir(dirname18);
53730
53730
  let prevStats = stats2;
53731
53731
  if (parent.has(basename4))
53732
53732
  return;
@@ -53751,7 +53751,7 @@ var require_nodefs_handler = __commonJS((exports, module) => {
53751
53751
  prevStats = newStats2;
53752
53752
  }
53753
53753
  } catch (error3) {
53754
- this.fsw._remove(dirname17, basename4);
53754
+ this.fsw._remove(dirname18, basename4);
53755
53755
  }
53756
53756
  } else if (parent.has(basename4)) {
53757
53757
  const at = newStats.atimeMs;
@@ -56327,7 +56327,7 @@ var require_client2 = __commonJS((exports) => {
56327
56327
  // ../../node_modules/.pnpm/@smithy+core@3.29.7/node_modules/@smithy/core/dist-cjs/submodules/config/index.js
56328
56328
  var require_config = __commonJS((exports) => {
56329
56329
  var { homedir: homedir2 } = __require("os");
56330
- var { sep: sep2, join: join29 } = __require("path");
56330
+ var { sep: sep2, join: join30 } = __require("path");
56331
56331
  var { createHash: createHash17 } = __require("crypto");
56332
56332
  var { readFile: readFile$1 } = __require("fs/promises");
56333
56333
  var { IniSectionType: IniSectionType2 } = require_dist_cjs();
@@ -56485,7 +56485,7 @@ var require_config = __commonJS((exports) => {
56485
56485
  var getSSOTokenFilepath = (id) => {
56486
56486
  const hasher = createHash17("sha1");
56487
56487
  const cacheName = hasher.update(id).digest("hex");
56488
- return join29(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
56488
+ return join30(getHomeDir(), ".aws", "sso", "cache", `${cacheName}.json`);
56489
56489
  };
56490
56490
  var tokenIntercept = {};
56491
56491
  var getSSOTokenFromFile = async (id) => {
@@ -56512,9 +56512,9 @@ var require_config = __commonJS((exports) => {
56512
56512
  ...data.default && { default: data.default }
56513
56513
  });
56514
56514
  var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
56515
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join29(getHomeDir(), ".aws", "config");
56515
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join30(getHomeDir(), ".aws", "config");
56516
56516
  var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
56517
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join29(getHomeDir(), ".aws", "credentials");
56517
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join30(getHomeDir(), ".aws", "credentials");
56518
56518
  var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@+.%:/]+)\2$/;
56519
56519
  var profileNameBlockList = ["__proto__", "profile __proto__"];
56520
56520
  var parseIni = (iniData) => {
@@ -56580,11 +56580,11 @@ var require_config = __commonJS((exports) => {
56580
56580
  const relativeHomeDirPrefix = "~/";
56581
56581
  let resolvedFilepath = filepath;
56582
56582
  if (filepath.startsWith(relativeHomeDirPrefix)) {
56583
- resolvedFilepath = join29(homeDir, filepath.slice(2));
56583
+ resolvedFilepath = join30(homeDir, filepath.slice(2));
56584
56584
  }
56585
56585
  let resolvedConfigFilepath = configFilepath;
56586
56586
  if (configFilepath.startsWith(relativeHomeDirPrefix)) {
56587
- resolvedConfigFilepath = join29(homeDir, configFilepath.slice(2));
56587
+ resolvedConfigFilepath = join30(homeDir, configFilepath.slice(2));
56588
56588
  }
56589
56589
  const parsedFiles = await Promise.all([
56590
56590
  readFile13(resolvedConfigFilepath, {
@@ -74177,7 +74177,7 @@ var require_signin = __commonJS((exports) => {
74177
74177
  import { createHash as createHash17, createPrivateKey, createPublicKey, sign } from "crypto";
74178
74178
  import { promises as fs3 } from "fs";
74179
74179
  import { homedir as homedir3 } from "os";
74180
- import { dirname as dirname18, join as join32 } from "path";
74180
+ import { dirname as dirname19, join as join33 } from "path";
74181
74181
  var import_config24, import_protocols3, LoginCredentialsFetcher;
74182
74182
  var init_LoginCredentialsFetcher = __esm(() => {
74183
74183
  import_config24 = __toESM(require_config(), 1);
@@ -74329,17 +74329,17 @@ var init_LoginCredentialsFetcher = __esm(() => {
74329
74329
  }
74330
74330
  async saveToken(token) {
74331
74331
  const tokenFilePath = this.getTokenFilePath();
74332
- const directory = dirname18(tokenFilePath);
74332
+ const directory = dirname19(tokenFilePath);
74333
74333
  try {
74334
74334
  await fs3.mkdir(directory, { recursive: true });
74335
74335
  } catch (error3) {}
74336
74336
  await fs3.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8");
74337
74337
  }
74338
74338
  getTokenFilePath() {
74339
- const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join32(homedir3(), ".aws", "login", "cache");
74339
+ const directory = process.env.AWS_LOGIN_CACHE_DIRECTORY ?? join33(homedir3(), ".aws", "login", "cache");
74340
74340
  const loginSessionBytes = Buffer.from(this.loginSession, "utf8");
74341
74341
  const loginSessionSha256 = createHash17("sha256").update(loginSessionBytes).digest("hex");
74342
- return join32(directory, `${loginSessionSha256}.json`);
74342
+ return join33(directory, `${loginSessionSha256}.json`);
74343
74343
  }
74344
74344
  derToRawSignature(derSignature) {
74345
74345
  let offset = 2;
@@ -100753,6 +100753,8 @@ var ReservedConcurrentExecutionsSchema = exports_external.number().int().min(0).
100753
100753
  var VPCSchema = exports_external.boolean().describe("Put the function inside your global VPC.");
100754
100754
  var DescriptionSchema = exports_external.string().describe("A description of the function.");
100755
100755
  var LayersSchema = exports_external.string().array().describe(`A list of function layers to add to the function's execution environment. Specify each layer by its name.`);
100756
+ var SandboxRouteKeySchema = exports_external.string().regex(/^[a-z0-9-]+:[a-z0-9-]+:[a-z0-9-]+$/i, 'Invalid route key. Use the "stack:type:name" format.');
100757
+ var SandboxSchema = exports_external.union([exports_external.boolean(), SandboxRouteKeySchema.array()]).describe('Block the function from invoking other lambdas. Pass a list of route keys like "my-stack:function:my-name" to allow only those routes through a private sandbox gateway.');
100756
100758
  var EnvironmentSchema = exports_external.record(exports_external.string(), exports_external.string()).optional().describe("Environment variable key-value pairs.");
100757
100759
  var ArchitectureSchema = exports_external.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the function supports.");
100758
100760
  var RuntimeSchema = exports_external.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x", "nodejs24.x"]).or(exports_external.literal("container")).or(exports_external.string()).describe("The identifier of the function's runtime.");
@@ -100825,7 +100827,8 @@ var StackFnSchema = exports_external.object({
100825
100827
  reserved: ReservedConcurrentExecutionsSchema.optional(),
100826
100828
  layers: LayersSchema.optional(),
100827
100829
  environment: EnvironmentSchema.optional(),
100828
- permissions: PermissionsSchema.optional()
100830
+ permissions: PermissionsSchema.optional(),
100831
+ sandbox: SandboxSchema.optional()
100829
100832
  }).strict();
100830
100833
  var StackFunctionSchema = exports_external.union([
100831
100834
  LocalFileSchema.transform((code) => ({
@@ -100848,7 +100851,7 @@ var FunctionDefaultSchema = exports_external.object({
100848
100851
  timeout: TimeoutSchema.default("15 minutes"),
100849
100852
  memorySize: MemorySizeSchema.default("1024 MB"),
100850
100853
  architecture: ArchitectureSchema.default("arm64"),
100851
- vpc: VPCSchema.default(true),
100854
+ vpc: VPCSchema.default(false),
100852
100855
  ephemeralStorageSize: EphemeralStorageSizeSchema.default("512 MB"),
100853
100856
  reserved: ReservedConcurrentExecutionsSchema.optional(),
100854
100857
  layers: LayersSchema.optional(),
@@ -101697,7 +101700,7 @@ var SitesSchema = exports_external.record(ResourceIdSchema, exports_external.obj
101697
101700
  configs: exports_external.string().array().optional().describe("Define the config values for your build command.")
101698
101701
  }).optional().describe(`Specifies the build process for sites that need a build step.`),
101699
101702
  static: exports_external.union([LocalDirectorySchema, exports_external.boolean()]).optional().describe("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."),
101700
- ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
101703
+ ssr: StackFunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
101701
101704
  })).optional().describe("Define the sites in your stack.");
101702
101705
 
101703
101706
  // src/feature/store/schema.ts
@@ -104531,10 +104534,12 @@ import { formatRouteEnvName } from "awsless";
104531
104534
  import { relative as relative3 } from "path";
104532
104535
 
104533
104536
  // src/feature/function/util.ts
104534
- import { seconds as seconds4, toDays as toDays6, toSeconds as toSeconds4 } from "@awsless/duration";
104537
+ import { days as days8, seconds as seconds4, toDays as toDays6, toSeconds as toSeconds4 } from "@awsless/duration";
104535
104538
  import { generateFileHash as generateFileHash2 } from "@awsless/ts-file-cache";
104536
104539
  var import_deepmerge = __toESM(require_cjs2(), 1);
104537
104540
  import { createHash as createHash10 } from "crypto";
104541
+ import { dirname as dirname7, join as join12 } from "path";
104542
+ import { fileURLToPath as fileURLToPath4 } from "url";
104538
104543
 
104539
104544
  // src/feature/on-error-log/util.ts
104540
104545
  var filterPattern = `{${[
@@ -104550,7 +104555,6 @@ var filterPattern = `{${[
104550
104555
  var standaloneFields = [
104551
104556
  "runtime",
104552
104557
  "description",
104553
- "vpc",
104554
104558
  "log",
104555
104559
  "timeout",
104556
104560
  "memorySize",
@@ -104559,7 +104563,8 @@ var standaloneFields = [
104559
104563
  "reserved",
104560
104564
  "layers",
104561
104565
  "environment",
104562
- "permissions"
104566
+ "permissions",
104567
+ "sandbox"
104563
104568
  ];
104564
104569
  var isStandaloneFunction = (props) => {
104565
104570
  return standaloneFields.some((field) => typeof props[field] !== "undefined");
@@ -104646,10 +104651,13 @@ var createLambdaFunction = (ctx, id, local) => {
104646
104651
  statementDeps.add(dep);
104647
104652
  }
104648
104653
  };
104649
- addPermission(...props.permissions ?? []);
104650
- ctx.onPermission((statement) => {
104651
- addPermission(statement);
104652
- });
104654
+ const sandboxed = typeof local.sandbox !== "undefined" && local.sandbox !== false;
104655
+ addPermission(...(sandboxed ? local.permissions : props.permissions) ?? []);
104656
+ if (!sandboxed) {
104657
+ ctx.onPermission((statement) => {
104658
+ addPermission(statement);
104659
+ });
104660
+ }
104653
104661
  const policy = new aws.iam.RolePolicy(group, "policy", {
104654
104662
  role: role.name,
104655
104663
  name: "lambda-policy",
@@ -104747,7 +104755,11 @@ var createLambdaFunction = (ctx, id, local) => {
104747
104755
  variables.REGION = ctx.appConfig.region;
104748
104756
  variables.STAGE = ctx.appConfig.stage ?? "default";
104749
104757
  variables.STACK = ctx.stackConfig.name;
104750
- variables.STANDALONE = "true";
104758
+ if (sandboxed) {
104759
+ variables.SANDBOX = "true";
104760
+ } else {
104761
+ variables.STANDALONE = "true";
104762
+ }
104751
104763
  if (props.vpc) {
104752
104764
  variables.AWS_USE_DUALSTACK_ENDPOINT = "true";
104753
104765
  }
@@ -104760,6 +104772,33 @@ var createLambdaFunction = (ctx, id, local) => {
104760
104772
  ctx.onBind((name2, value) => {
104761
104773
  variables[name2] = value;
104762
104774
  });
104775
+ if (Array.isArray(local.sandbox) && local.sandbox.length > 0) {
104776
+ const bundle = ctx.shared.get("bundle", "main");
104777
+ const distDir = dirname7(fileURLToPath4(import.meta.url));
104778
+ const proxy = createPrebuildLambdaFunction(group, ctx, "function", `${id}-proxy`, {
104779
+ bundleFile: join12(distDir, "/prebuild/sandbox-proxy/bundle.zip"),
104780
+ bundleHash: join12(distDir, "/prebuild/sandbox-proxy/HASH"),
104781
+ runtime: "nodejs24.x",
104782
+ handler: "index.default",
104783
+ timeout: ctx.appConfig.defaults.function.timeout,
104784
+ log: {
104785
+ format: "json",
104786
+ level: "warn",
104787
+ system: "warn",
104788
+ retention: days8(3)
104789
+ }
104790
+ });
104791
+ proxy.setEnvironment("SANDBOX_ROUTES", JSON.stringify(local.sandbox));
104792
+ proxy.addPermission({
104793
+ actions: ["lambda:InvokeFunction"],
104794
+ resources: [bundle.alias.arn]
104795
+ });
104796
+ variables.SANDBOX_PROXY = proxy.name;
104797
+ addPermission({
104798
+ actions: ["lambda:InvokeFunction"],
104799
+ resources: [proxy.lambda.arn]
104800
+ });
104801
+ }
104763
104802
  if (props.log.retention.value > 0n) {
104764
104803
  const logGroup = new aws.cloudwatch.LogGroup(group, "log", {
104765
104804
  name: `/aws/lambda/${name}`,
@@ -105089,8 +105128,8 @@ var functionFeature = defineFeature({
105089
105128
 
105090
105129
  // src/feature/on-error-log/index.ts
105091
105130
  import { formatRouteEnvName as formatRouteEnvName2 } from "awsless";
105092
- import { dirname as dirname7, join as join12 } from "path";
105093
- import { fileURLToPath as fileURLToPath4 } from "url";
105131
+ import { dirname as dirname8, join as join13 } from "path";
105132
+ import { fileURLToPath as fileURLToPath5 } from "url";
105094
105133
  var onErrorLogFeature = defineFeature({
105095
105134
  name: "on-error-log",
105096
105135
  onApp(ctx) {
@@ -105105,7 +105144,7 @@ var onErrorLogFeature = defineFeature({
105105
105144
  const consumerRoute = formatRouteKey("base", "on-error-log", "consumer");
105106
105145
  bundle.addHandler({
105107
105146
  routeKey: handlerRoute,
105108
- file: join12(dirname7(fileURLToPath4(import.meta.url)), "/handlers/on-error-log.js"),
105147
+ file: join13(dirname8(fileURLToPath5(import.meta.url)), "/handlers/on-error-log.js"),
105109
105148
  exportName: "default"
105110
105149
  });
105111
105150
  bundle.addEnv(formatRouteEnvName2(handlerRoute, "CONSUMER"), consumerRoute);
@@ -105160,9 +105199,9 @@ var onErrorLogFeature = defineFeature({
105160
105199
  });
105161
105200
 
105162
105201
  // src/feature/on-failure/index.ts
105163
- import { days as days8, toSeconds as toSeconds5 } from "@awsless/duration";
105164
- import { dirname as dirname8, join as join13 } from "path";
105165
- import { fileURLToPath as fileURLToPath5 } from "url";
105202
+ import { days as days9, toSeconds as toSeconds5 } from "@awsless/duration";
105203
+ import { dirname as dirname9, join as join14 } from "path";
105204
+ import { fileURLToPath as fileURLToPath6 } from "url";
105166
105205
  var onFailureFeature = defineFeature({
105167
105206
  name: "on-failure",
105168
105207
  onBefore(ctx) {
@@ -105173,7 +105212,7 @@ var onFailureFeature = defineFeature({
105173
105212
  resourceType: "on-failure",
105174
105213
  resourceName: "deadletter"
105175
105214
  }),
105176
- messageRetentionSeconds: toSeconds5(days8(14))
105215
+ messageRetentionSeconds: toSeconds5(days9(14))
105177
105216
  });
105178
105217
  const bundleTimeout = toSeconds5(ctx.appConfig.defaults.function.timeout);
105179
105218
  const queue2 = new aws.sqs.Queue(group, "on-failure", {
@@ -105310,10 +105349,10 @@ var onFailureFeature = defineFeature({
105310
105349
  const bundle = ctx.shared.get("bundle", "main");
105311
105350
  const { group, bucket, queue: queue2 } = ctx.shared.get("on-failure", "resources");
105312
105351
  registerBundleFunction(ctx, formatRouteKey("base", "on-failure", "consumer"), props.consumer);
105313
- const distDir = dirname8(fileURLToPath5(import.meta.url));
105352
+ const distDir = dirname9(fileURLToPath6(import.meta.url));
105314
105353
  const handler = createPrebuildLambdaFunction(group, ctx, "on-failure", "handler", {
105315
- bundleFile: join13(distDir, "/prebuild/on-failure/bundle.zip"),
105316
- bundleHash: join13(distDir, "/prebuild/on-failure/HASH"),
105354
+ bundleFile: join14(distDir, "/prebuild/on-failure/bundle.zip"),
105355
+ bundleHash: join14(distDir, "/prebuild/on-failure/HASH"),
105317
105356
  runtime: "nodejs24.x",
105318
105357
  handler: "index.default",
105319
105358
  memorySize: mebibytes(256),
@@ -105322,7 +105361,7 @@ var onFailureFeature = defineFeature({
105322
105361
  format: "json",
105323
105362
  level: "warn",
105324
105363
  system: "warn",
105325
- retention: days8(3)
105364
+ retention: days9(3)
105326
105365
  }
105327
105366
  });
105328
105367
  handler.addPermission({
@@ -105387,8 +105426,8 @@ var onFailureFeature = defineFeature({
105387
105426
 
105388
105427
  // src/feature/pubsub/index.ts
105389
105428
  import { createHmac as createHmac2 } from "crypto";
105390
- import { fileURLToPath as fileURLToPath7 } from "url";
105391
- import { dirname as dirname10, join as join16 } from "path";
105429
+ import { fileURLToPath as fileURLToPath8 } from "url";
105430
+ import { dirname as dirname11, join as join17 } from "path";
105392
105431
  import { formatRouteEnvName as formatRouteEnvName3 } from "awsless";
105393
105432
 
105394
105433
  // src/feature/pubsub/util.ts
@@ -105396,15 +105435,15 @@ import { toDays as toDays7 } from "@awsless/duration";
105396
105435
  import { stringify } from "@awsless/json";
105397
105436
  import { createHash as createHash12 } from "crypto";
105398
105437
  import { readFile as readFile10 } from "fs/promises";
105399
- import { fileURLToPath as fileURLToPath6 } from "url";
105400
- import { dirname as dirname9, join as join15 } from "path";
105438
+ import { fileURLToPath as fileURLToPath7 } from "url";
105439
+ import { dirname as dirname10, join as join16 } from "path";
105401
105440
 
105402
105441
  // src/feature/instance/build/executable.ts
105403
105442
  import { createHash as createHash11 } from "crypto";
105404
105443
  import { readFile as readFile9 } from "fs/promises";
105405
- import { join as join14 } from "path";
105444
+ import { join as join15 } from "path";
105406
105445
  var buildExecutable = async (input, outputPath, architecture) => {
105407
- const filePath = join14(outputPath, "program");
105446
+ const filePath = join15(outputPath, "program");
105408
105447
  const target2 = architecture === "x86_64" ? "bun-linux-x64" : "bun-linux-arm64";
105409
105448
  let result;
105410
105449
  try {
@@ -105449,7 +105488,7 @@ ${result.logs?.map((log) => log.message).join(`
105449
105488
  };
105450
105489
 
105451
105490
  // src/feature/pubsub/util.ts
105452
- var __dirname2 = dirname9(fileURLToPath6(import.meta.url));
105491
+ var __dirname2 = dirname10(fileURLToPath7(import.meta.url));
105453
105492
  var WS_PORT = 3000;
105454
105493
  var ARCHITECTURE = "arm64";
105455
105494
  var CPU = "0.25 vCPU";
@@ -105465,7 +105504,7 @@ var createPubSubService = (parentGroup, ctx, id, props, inputs) => {
105465
105504
  });
105466
105505
  const shortName = shortId(`${ctx.app.name}:pubsub:${id}:${ctx.appId}`);
105467
105506
  const image = "public.ecr.aws/aws-cli/aws-cli:arm64";
105468
- const bundleFile = join15(__dirname2, "handlers/pubsub-server.js");
105507
+ const bundleFile = join16(__dirname2, "handlers/pubsub-server.js");
105469
105508
  ctx.registerBuild("pubsub", name, async (build2) => {
105470
105509
  const hash2 = createHash12("sha1").update(await readFile10(bundleFile)).digest("hex");
105471
105510
  const fingerprint = `${hash2}-${ARCHITECTURE}`;
@@ -105753,7 +105792,7 @@ var createPubSubService = (parentGroup, ctx, id, props, inputs) => {
105753
105792
  };
105754
105793
 
105755
105794
  // src/feature/pubsub/index.ts
105756
- var __dirname3 = dirname10(fileURLToPath7(import.meta.url));
105795
+ var __dirname3 = dirname11(fileURLToPath8(import.meta.url));
105757
105796
  var typeGenCode4 = `
105758
105797
  import type { Mock } from 'vitest'
105759
105798
 
@@ -105996,7 +106035,7 @@ var pubsubFeature = defineFeature({
105996
106035
  const publisherRouteKey = formatRouteKey("base", "pubsub", `${id}-publisher`);
105997
106036
  bundle.addHandler({
105998
106037
  routeKey: publisherRouteKey,
105999
- file: join16(__dirname3, "/handlers/pubsub-publisher.js"),
106038
+ file: join17(__dirname3, "/handlers/pubsub-publisher.js"),
106000
106039
  exportName: "default"
106001
106040
  });
106002
106041
  bundle.addEnv(formatRouteEnvName3(publisherRouteKey, "REDIS_HOST"), redisHost);
@@ -106257,8 +106296,8 @@ var restFeature = defineFeature({
106257
106296
 
106258
106297
  // src/feature/rpc/index.ts
106259
106298
  import { formatRouteEnvName as formatRouteEnvName4 } from "awsless";
106260
- import { dirname as dirname11, join as join17, relative as relative5 } from "path";
106261
- import { fileURLToPath as fileURLToPath8 } from "url";
106299
+ import { dirname as dirname12, join as join18, relative as relative5 } from "path";
106300
+ import { fileURLToPath as fileURLToPath9 } from "url";
106262
106301
  import { toSeconds as toSeconds7 } from "@awsless/duration";
106263
106302
  var rpcFeature = defineFeature({
106264
106303
  name: "rpc",
@@ -106310,7 +106349,7 @@ var rpcFeature = defineFeature({
106310
106349
  const serverRouteKey = formatRouteKey("base", "rpc", id);
106311
106350
  bundle.addHandler({
106312
106351
  routeKey: serverRouteKey,
106313
- file: join17(dirname11(fileURLToPath8(import.meta.url)), "/handlers/rpc.js"),
106352
+ file: join18(dirname12(fileURLToPath9(import.meta.url)), "/handlers/rpc.js"),
106314
106353
  exportName: "default"
106315
106354
  });
106316
106355
  bundle.addEnv(formatRouteEnvName4(serverRouteKey, "TIMEOUT"), toSeconds7(ctx.appConfig.defaults.function.timeout).toString());
@@ -106460,11 +106499,11 @@ var searchFeature = defineFeature({
106460
106499
 
106461
106500
  // src/feature/site/index.ts
106462
106501
  import { createHash as createHash13 } from "crypto";
106463
- import { dirname as dirname13, join as join20 } from "path";
106502
+ import { dirname as dirname14, join as join21 } from "path";
106464
106503
 
106465
106504
  // src/util/cache.ts
106466
106505
  import { lstat as lstat3, readdir as readdir4 } from "fs/promises";
106467
- import { join as join18 } from "path";
106506
+ import { join as join19 } from "path";
106468
106507
  var generateCacheKey = async (directories2) => {
106469
106508
  const files = await listAllFiles(directories2);
106470
106509
  const sortedFiles = files.toSorted();
@@ -106491,7 +106530,7 @@ var listAllFiles = async (list2) => {
106491
106530
  recursive: true,
106492
106531
  withFileTypes: true
106493
106532
  });
106494
- files.push(...dirents.filter((d3) => d3.isFile()).map((file2) => join18(file2.parentPath, file2.name)));
106533
+ files.push(...dirents.filter((d3) => d3.isFile()).map((file2) => join19(file2.parentPath, file2.name)));
106495
106534
  } else if (stat5.isFile()) {
106496
106535
  files.push(entry);
106497
106536
  }
@@ -106500,7 +106539,7 @@ var listAllFiles = async (list2) => {
106500
106539
  };
106501
106540
 
106502
106541
  // src/feature/site/static-routes.ts
106503
- import { basename as basename3, dirname as dirname12, join as join19 } from "path";
106542
+ import { basename as basename3, dirname as dirname13, join as join20 } from "path";
106504
106543
  var isPageFile = (file2) => {
106505
106544
  return file2.endsWith(".html") || !basename3(file2).includes(".");
106506
106545
  };
@@ -106510,7 +106549,7 @@ var pageUrl = (file2) => {
106510
106549
  }
106511
106550
  const url = file2.slice(0, -".html".length);
106512
106551
  if (basename3(url) === "index") {
106513
- return dirname12(url);
106552
+ return dirname13(url);
106514
106553
  }
106515
106554
  return url;
106516
106555
  };
@@ -106519,10 +106558,10 @@ var planStaticRoutes = (files, sitePath) => {
106519
106558
  const pages = files.filter((file2) => isPageFile(file2));
106520
106559
  const assets = files.filter((file2) => !isPageFile(file2));
106521
106560
  for (const page of pages) {
106522
- plan.files[join19(sitePath, pageUrl(page))] = page;
106561
+ plan.files[join20(sitePath, pageUrl(page))] = page;
106523
106562
  }
106524
106563
  if (sitePath !== "/") {
106525
- plan.catchAll = join19(sitePath, "*.");
106564
+ plan.catchAll = join20(sitePath, "*.");
106526
106565
  return plan;
106527
106566
  }
106528
106567
  const folders = new Set;
@@ -106532,9 +106571,9 @@ var planStaticRoutes = (files, sitePath) => {
106532
106571
  folders.add(folder);
106533
106572
  continue;
106534
106573
  }
106535
- plan.files[join19(sitePath, asset)] = asset;
106574
+ plan.files[join20(sitePath, asset)] = asset;
106536
106575
  }
106537
- plan.dirs = [...folders].map((folder) => join19(sitePath, folder, "*."));
106576
+ plan.dirs = [...folders].map((folder) => join20(sitePath, folder, "*."));
106538
106577
  return plan;
106539
106578
  };
106540
106579
 
@@ -106559,7 +106598,7 @@ var siteFeature = defineFeature({
106559
106598
  return build2(fingerprint, async (write) => {
106560
106599
  const credentialProvider = await getCredentials(ctx.appConfig.profile);
106561
106600
  const credentials2 = await credentialProvider();
106562
- const cwd = join20(directories.root, dirname13(ctx.stackConfig.file));
106601
+ const cwd = join21(directories.root, dirname14(ctx.stackConfig.file));
106563
106602
  const env2 = {
106564
106603
  ...process.env,
106565
106604
  APP: ctx.appConfig.name,
@@ -106598,7 +106637,37 @@ ${(errors3.trim() || output.trim()).slice(-2000)}`);
106598
106637
  });
106599
106638
  });
106600
106639
  }
106601
- if (props.ssr) {
106640
+ if (props.ssr && isStandaloneFunction(props.ssr)) {
106641
+ const fn = createLambdaFunction(ctx, `${id}-ssr`, props.ssr);
106642
+ const url = new aws.lambda.FunctionUrl(group, "ssr-url", {
106643
+ functionName: fn.lambda.functionName,
106644
+ authorizationType: "AWS_IAM"
106645
+ });
106646
+ new aws.lambda.Permission(group, "ssr-url-permission", {
106647
+ functionName: fn.lambda.functionName,
106648
+ statementId: "cloudfront-url",
106649
+ principal: "cloudfront.amazonaws.com",
106650
+ sourceAccount: ctx.accountId,
106651
+ action: "lambda:InvokeFunctionUrl",
106652
+ functionUrlAuthType: "AWS_IAM"
106653
+ });
106654
+ new aws.lambda.Permission(group, "ssr-invoke-permission", {
106655
+ functionName: fn.lambda.functionName,
106656
+ statementId: "cloudfront-invoke",
106657
+ principal: "cloudfront.amazonaws.com",
106658
+ sourceAccount: ctx.accountId,
106659
+ action: "lambda:InvokeFunction",
106660
+ invokedViaFunctionUrl: true
106661
+ });
106662
+ addRoutes({
106663
+ [routeKey]: {
106664
+ type: "lambda",
106665
+ forwardHost: true,
106666
+ urlEncodedQueryString: true,
106667
+ domainName: url.functionUrl.pipe((url2) => url2.split("/")[2])
106668
+ }
106669
+ });
106670
+ } else if (props.ssr) {
106602
106671
  const ssr = props.ssr;
106603
106672
  const bundleRouteKey = formatRouteKey(ctx.stack.name, "site", id);
106604
106673
  registerBundleFunction(ctx, bundleRouteKey, ssr);
@@ -106623,7 +106692,7 @@ ${(errors3.trim() || output.trim()).slice(-2000)}`);
106623
106692
  cwd: staticDir,
106624
106693
  nodir: true
106625
106694
  }).sort();
106626
- const hashes = files.map((file2) => $hash(join20(staticDir, file2)));
106695
+ const hashes = files.map((file2) => $hash(join21(staticDir, file2)));
106627
106696
  const version = $combine(...hashes).pipe((hashes2) => {
106628
106697
  const hash2 = createHash13("sha1");
106629
106698
  for (const [index, file2] of files.entries()) {
@@ -106671,7 +106740,7 @@ ${(errors3.trim() || output.trim()).slice(-2000)}`);
106671
106740
  });
106672
106741
 
106673
106742
  // src/feature/store/index.ts
106674
- import { join as join21 } from "path";
106743
+ import { join as join22 } from "path";
106675
106744
  import { toDays as toDays8 } from "@awsless/duration";
106676
106745
 
106677
106746
  // src/feature/store/util.ts
@@ -106794,8 +106863,8 @@ var storeFeature = defineFeature({
106794
106863
  key: `${folder}${file2}`,
106795
106864
  cacheControl: getCacheControl(file2),
106796
106865
  contentType: getContentType(file2),
106797
- source: join21(props.static, file2),
106798
- sourceHash: $hash(join21(props.static, file2))
106866
+ source: join22(props.static, file2),
106867
+ sourceHash: $hash(join22(props.static, file2))
106799
106868
  }, {
106800
106869
  replaceOnChanges: ["bucket", "key"]
106801
106870
  });
@@ -107433,7 +107502,7 @@ var layerFeature = defineFeature({
107433
107502
  skipDestroy: true
107434
107503
  }, {
107435
107504
  dependsOn: [zip],
107436
- replaceOnChanges: ["sourceCodeHash", "s3ObjectVersion"]
107505
+ replaceOnChanges: ["sourceCodeHash"]
107437
107506
  });
107438
107507
  ctx.shared.add("layer", "arn", id, layer.arn);
107439
107508
  ctx.shared.add("layer", "packages", id, props.packages ?? [id]);
@@ -107444,8 +107513,8 @@ var layerFeature = defineFeature({
107444
107513
  // src/feature/image/index.ts
107445
107514
  import { toDays as toDays9 } from "@awsless/duration";
107446
107515
  import { formatRouteEnvName as formatRouteEnvName5 } from "awsless";
107447
- import { dirname as dirname14, join as join22 } from "path";
107448
- import { fileURLToPath as fileURLToPath9 } from "url";
107516
+ import { dirname as dirname15, join as join23 } from "path";
107517
+ import { fileURLToPath as fileURLToPath10 } from "url";
107449
107518
  var imageFeature = defineFeature({
107450
107519
  name: "image",
107451
107520
  onApp(ctx) {
@@ -107459,7 +107528,7 @@ var imageFeature = defineFeature({
107459
107528
  throw new FileError("app.json", "The image feature requires an arm64 function bundle.");
107460
107529
  }
107461
107530
  const group = new Group(ctx.base, "image", "layer");
107462
- const path2 = join22(dirname14(fileURLToPath9(import.meta.url)), "/layers/sharp-arm.zip");
107531
+ const path2 = join23(dirname15(fileURLToPath10(import.meta.url)), "/layers/sharp-arm.zip");
107463
107532
  const layerId = formatGlobalResourceName({
107464
107533
  appName: ctx.appConfig.name,
107465
107534
  resourceType: "layer",
@@ -107490,7 +107559,7 @@ var imageFeature = defineFeature({
107490
107559
  skipDestroy: true
107491
107560
  }, {
107492
107561
  dependsOn: [zipFile],
107493
- replaceOnChanges: ["sourceCodeHash", "s3ObjectVersion"]
107562
+ replaceOnChanges: ["sourceCodeHash"]
107494
107563
  });
107495
107564
  ctx.shared.add("layer", "arn", layerId, layer.arn);
107496
107565
  const bundle = ctx.shared.get("bundle", "main");
@@ -107524,7 +107593,7 @@ var imageFeature = defineFeature({
107524
107593
  const serverRouteKey = formatRouteKey(ctx.stack.name, "image", id);
107525
107594
  bundle.addHandler({
107526
107595
  routeKey: serverRouteKey,
107527
- file: join22(dirname14(fileURLToPath9(import.meta.url)), "/handlers/image.js"),
107596
+ file: join23(dirname15(fileURLToPath10(import.meta.url)), "/handlers/image.js"),
107528
107597
  exportName: "default",
107529
107598
  external: ["sharp"]
107530
107599
  });
@@ -107562,8 +107631,8 @@ var imageFeature = defineFeature({
107562
107631
  new aws.s3.BucketObject(group, `static-${file2}`, {
107563
107632
  bucket: bucket.name,
107564
107633
  key: `${folder}origin/${file2}`,
107565
- source: join22(props.origin.static, file2),
107566
- sourceHash: $hash(join22(props.origin.static, file2))
107634
+ source: join23(props.origin.static, file2),
107635
+ sourceHash: $hash(join23(props.origin.static, file2))
107567
107636
  }, {
107568
107637
  replaceOnChanges: ["bucket", "key"]
107569
107638
  });
@@ -107579,8 +107648,8 @@ var imageFeature = defineFeature({
107579
107648
  // src/feature/icon/index.ts
107580
107649
  import { toDays as toDays10 } from "@awsless/duration";
107581
107650
  import { formatRouteEnvName as formatRouteEnvName6 } from "awsless";
107582
- import { dirname as dirname15, join as join23 } from "path";
107583
- import { fileURLToPath as fileURLToPath10 } from "url";
107651
+ import { dirname as dirname16, join as join24 } from "path";
107652
+ import { fileURLToPath as fileURLToPath11 } from "url";
107584
107653
  var iconFeature = defineFeature({
107585
107654
  name: "icon",
107586
107655
  onStack(ctx) {
@@ -107611,7 +107680,7 @@ var iconFeature = defineFeature({
107611
107680
  const serverRouteKey = formatRouteKey(ctx.stack.name, "icon", id);
107612
107681
  bundle.addHandler({
107613
107682
  routeKey: serverRouteKey,
107614
- file: join23(dirname15(fileURLToPath10(import.meta.url)), "/handlers/icon.js"),
107683
+ file: join24(dirname16(fileURLToPath11(import.meta.url)), "/handlers/icon.js"),
107615
107684
  exportName: "default"
107616
107685
  });
107617
107686
  addRoutes({
@@ -107651,8 +107720,8 @@ var iconFeature = defineFeature({
107651
107720
  new aws.s3.BucketObject(group, `static-${file2}`, {
107652
107721
  bucket: bucket.name,
107653
107722
  key: `${folder}origin/${file2}`,
107654
- source: join23(props.origin.static, file2),
107655
- sourceHash: $hash(join23(props.origin.static, file2))
107723
+ source: join24(props.origin.static, file2),
107724
+ sourceHash: $hash(join24(props.origin.static, file2))
107656
107725
  }, {
107657
107726
  replaceOnChanges: ["bucket", "key"]
107658
107727
  });
@@ -107679,10 +107748,10 @@ var import_deepmerge4 = __toESM(require_cjs2(), 1);
107679
107748
  // src/feature/job/build/executable.ts
107680
107749
  import { createHash as createHash14 } from "crypto";
107681
107750
  import { readFile as readFile11, writeFile as writeFile7 } from "fs/promises";
107682
- import { join as join24, resolve as resolve3 } from "path";
107751
+ import { join as join25, resolve as resolve3 } from "path";
107683
107752
  var buildJobExecutable = async (input, outputPath, architecture) => {
107684
- const filePath = join24(outputPath, "program");
107685
- const wrapperPath = join24(outputPath, "wrapper.ts");
107753
+ const filePath = join25(outputPath, "program");
107754
+ const wrapperPath = join25(outputPath, "wrapper.ts");
107686
107755
  const handlerPath = resolve3(input);
107687
107756
  await writeFile7(wrapperPath, `import { parse } from '@awsless/json'
107688
107757
  import { getObject } from '@awsless/s3'
@@ -108186,7 +108255,7 @@ var jobFeature = defineFeature({
108186
108255
  });
108187
108256
 
108188
108257
  // src/feature/instance/index.ts
108189
- import { days as days9, seconds as seconds6, toSeconds as toSeconds11 } from "@awsless/duration";
108258
+ import { days as days10, seconds as seconds6, toSeconds as toSeconds11 } from "@awsless/duration";
108190
108259
 
108191
108260
  // src/feature/instance/util.ts
108192
108261
  import { toDays as toDays12, toSeconds as toSeconds10 } from "@awsless/duration";
@@ -108194,7 +108263,7 @@ import { stringify as stringify3 } from "@awsless/json";
108194
108263
  import { generateFileHash as generateFileHash4 } from "@awsless/ts-file-cache";
108195
108264
  var import_deepmerge6 = __toESM(require_cjs2(), 1);
108196
108265
  import { createHash as createHash16 } from "crypto";
108197
- import { join as join25 } from "path";
108266
+ import { join as join26 } from "path";
108198
108267
  var createFargateTask = (parentGroup, ctx, ns, id, local) => {
108199
108268
  const group = new Group(parentGroup, "instance", ns);
108200
108269
  const name = formatLocalResourceName({
@@ -108399,7 +108468,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
108399
108468
  healthCheck: props.healthCheck ? {
108400
108469
  command: [
108401
108470
  "CMD-SHELL",
108402
- `curl -f http://${join25("localhost", props.healthCheck.path)} || exit 1`
108471
+ `curl -f http://${join26("localhost", props.healthCheck.path)} || exit 1`
108403
108472
  ],
108404
108473
  interval: toSeconds10(props.healthCheck.interval),
108405
108474
  retries: props.healthCheck.retries,
@@ -108570,7 +108639,7 @@ var instanceFeature = defineFeature({
108570
108639
  const queue2 = new aws.sqs.Queue(group, "queue", {
108571
108640
  name: task2.name,
108572
108641
  visibilityTimeoutSeconds: toSeconds11(seconds6(30)),
108573
- messageRetentionSeconds: toSeconds11(days9(4)),
108642
+ messageRetentionSeconds: toSeconds11(days10(4)),
108574
108643
  maxMessageSize: toBytes(kibibytes(256)),
108575
108644
  receiveWaitTimeSeconds: toSeconds11(seconds6(20))
108576
108645
  });
@@ -108728,7 +108797,7 @@ var metricFeature = defineFeature({
108728
108797
  });
108729
108798
 
108730
108799
  // src/feature/router/index.ts
108731
- import { days as days10, seconds as seconds8, toSeconds as toSeconds14, years } from "@awsless/duration";
108800
+ import { days as days11, seconds as seconds8, toSeconds as toSeconds14, years } from "@awsless/duration";
108732
108801
 
108733
108802
  // src/feature/router/router-code.ts
108734
108803
  import { minutes as minutes8, seconds as seconds7, toSeconds as toSeconds13 } from "@awsless/duration";
@@ -109202,7 +109271,7 @@ var MAX_VALUE_SIZE = 1000;
109202
109271
  var ORIGIN_PLACEHOLDER = "x".repeat(64);
109203
109272
  var assertRouteValueSize = (key, route) => {
109204
109273
  const withOrigin = (entry) => {
109205
- return entry.type === "lambda" ? { ...entry, domainName: ORIGIN_PLACEHOLDER } : entry;
109274
+ return entry.type === "lambda" && !entry.domainName ? { ...entry, domainName: ORIGIN_PLACEHOLDER } : entry;
109206
109275
  };
109207
109276
  for (const entry of Array.isArray(route) ? route : [route]) {
109208
109277
  if (Buffer.byteLength(JSON.stringify(withOrigin(entry)), "utf8") > MAX_VALUE_SIZE) {
@@ -109274,15 +109343,15 @@ var routerFeature = defineFeature({
109274
109343
  for (const dependency of options?.dependsOn ?? []) {
109275
109344
  routeDependencies.add(dependency);
109276
109345
  }
109277
- if (Object.values(newRoutes).flat().some((route) => route.type === "lambda")) {
109346
+ if (Object.values(newRoutes).flat().some((route) => route.type === "lambda" && !route.domainName)) {
109278
109347
  hasLambdaRoutes = true;
109279
109348
  }
109280
109349
  });
109281
109350
  const cache = new aws.cloudfront.CachePolicy(group, "cache", {
109282
109351
  name,
109283
109352
  minTtl: toSeconds14(seconds8(0)),
109284
- maxTtl: toSeconds14(days10(365)),
109285
- defaultTtl: toSeconds14(days10(0)),
109353
+ maxTtl: toSeconds14(days11(365)),
109354
+ defaultTtl: toSeconds14(days11(0)),
109286
109355
  parametersInCacheKeyAndForwardedToOrigin: {
109287
109356
  enableAcceptEncodingBrotli: true,
109288
109357
  enableAcceptEncodingGzip: true,
@@ -109653,7 +109722,7 @@ var routerFeature = defineFeature({
109653
109722
  functionVersion: bundle.lambda.version,
109654
109723
  routes: $resolve([routes, lambdaUrlHost], (routes2, lambdaUrlHost2) => {
109655
109724
  const withOrigin = (route) => {
109656
- return route.type === "lambda" ? { ...route, domainName: lambdaUrlHost2 } : route;
109725
+ return route.type === "lambda" && !route.domainName ? { ...route, domainName: lambdaUrlHost2 } : route;
109657
109726
  };
109658
109727
  return Object.entries(routes2).flatMap(([key, route]) => createRouteStoreEntries(key, Array.isArray(route) ? route.map(withOrigin) : withOrigin(route)));
109659
109728
  })
@@ -111099,20 +111168,20 @@ import { DynamoDBClient as DynamoDBClient3 } from "@awsless/dynamodb";
111099
111168
  // src/cli/ui/complex/run-tests.ts
111100
111169
  var import_wildstring3 = __toESM(require_wildstring(), 1);
111101
111170
  import { mkdir as mkdir6, readFile as readFile12, writeFile as writeFile8 } from "fs/promises";
111102
- import { join as join27 } from "path";
111171
+ import { join as join28 } from "path";
111103
111172
  import { parse as parse5, stringify as stringify4 } from "@awsless/json";
111104
111173
  import { generateFolderHash, loadWorkspace as loadWorkspace2 } from "@awsless/ts-file-cache";
111105
111174
 
111106
111175
  // src/test/start.ts
111107
- import { dirname as dirname16, join as join26 } from "path";
111108
- import { fileURLToPath as fileURLToPath11 } from "url";
111176
+ import { dirname as dirname17, join as join27 } from "path";
111177
+ import { fileURLToPath as fileURLToPath12 } from "url";
111109
111178
  import { configDefaults } from "vitest/config";
111110
111179
  import { startVitest } from "vitest/node";
111111
111180
 
111112
111181
  class NullReporter {
111113
111182
  }
111114
111183
  var startTest = async (props) => {
111115
- const __dirname4 = dirname16(fileURLToPath11(import.meta.url));
111184
+ const __dirname4 = dirname17(fileURLToPath12(import.meta.url));
111116
111185
  const startTime = process.hrtime.bigint();
111117
111186
  process.noDeprecation = true;
111118
111187
  const vitest = await startVitest("test", props.filters, {
@@ -111124,8 +111193,9 @@ var startTest = async (props) => {
111124
111193
  exclude: ["**/_*", "**/_*/**", ...configDefaults.exclude],
111125
111194
  globals: true,
111126
111195
  reporters: [new NullReporter],
111196
+ env: props.env,
111127
111197
  setupFiles: [
111128
- join26(__dirname4, "test-global-setup.js")
111198
+ join27(__dirname4, "test-global-setup.js")
111129
111199
  ]
111130
111200
  }, {
111131
111201
  logLevel: "silent",
@@ -111279,7 +111349,7 @@ var logTestErrors = (event) => {
111279
111349
  };
111280
111350
  var runTest = async (stack, dir, filters, workspace, opts) => {
111281
111351
  await mkdir6(directories.test, { recursive: true });
111282
- const file2 = join27(directories.test, `${stack}.json`);
111352
+ const file2 = join28(directories.test, `${stack}.json`);
111283
111353
  const fingerprint = await generateFolderHash(workspace, dir);
111284
111354
  if (!process.env.NO_CACHE) {
111285
111355
  const exists2 = await fileExist(file2);
@@ -111306,7 +111376,8 @@ var runTest = async (stack, dir, filters, workspace, opts) => {
111306
111376
  async task(ctx) {
111307
111377
  const result2 = await startTest({
111308
111378
  dir,
111309
- filters
111379
+ filters,
111380
+ env: opts.env
111310
111381
  });
111311
111382
  if (result2.errors.length > 0) {
111312
111383
  throw result2.errors.map((error3) => new ExpectedError(error3.message));
@@ -111339,7 +111410,13 @@ var runTests = async (tests, stackFilters = [], testFilters = [], opts) => {
111339
111410
  }
111340
111411
  }
111341
111412
  for (const path2 of test.paths) {
111342
- const result = await runTest(test.name, path2, testFilters, workspace, opts);
111413
+ const result = await runTest(test.name, path2, testFilters, workspace, {
111414
+ ...opts,
111415
+ env: {
111416
+ ...opts.env,
111417
+ STACK: test.stackName
111418
+ }
111419
+ });
111343
111420
  if (!result) {
111344
111421
  return false;
111345
111422
  }
@@ -111384,7 +111461,7 @@ var deploy = (program3) => {
111384
111461
  appName: appConfig.name
111385
111462
  });
111386
111463
  const deployment = await claimDeployment({ client: dynamo, appId: globalAppId });
111387
- const { app, tests, warnings, builders, ready } = createApp({
111464
+ const { app, tests, warnings, builders, ready, appId } = createApp({
111388
111465
  appConfig,
111389
111466
  stackConfigs,
111390
111467
  accountId,
@@ -111402,7 +111479,13 @@ var deploy = (program3) => {
111402
111479
  }
111403
111480
  if (!options.skipTests) {
111404
111481
  const passed = await runTests(tests, [], [], {
111405
- showLogs: false
111482
+ showLogs: false,
111483
+ env: {
111484
+ APP: appConfig.name,
111485
+ APP_ID: appId,
111486
+ AWS_REGION: appConfig.region,
111487
+ AWS_ACCOUNT_ID: accountId
111488
+ }
111406
111489
  });
111407
111490
  if (!passed) {
111408
111491
  throw new Cancelled2;
@@ -112633,7 +112716,7 @@ var watchConfig = async (options, resolve4, reject) => {
112633
112716
 
112634
112717
  // src/type-gen/generate.ts
112635
112718
  import { mkdir as mkdir7, writeFile as writeFile9 } from "fs/promises";
112636
- import { dirname as dirname17, join as join28, relative as relative8 } from "path";
112719
+ import { dirname as dirname18, join as join29, relative as relative8 } from "path";
112637
112720
  var generateTypes = async (props) => {
112638
112721
  const files = [];
112639
112722
  await Promise.all(features.map((feature) => {
@@ -112641,12 +112724,12 @@ var generateTypes = async (props) => {
112641
112724
  ...props,
112642
112725
  async write(file2, data, include = false) {
112643
112726
  const code = data?.toString("utf8");
112644
- const path2 = join28(directories.types, file2);
112727
+ const path2 = join29(directories.types, file2);
112645
112728
  if (code) {
112646
112729
  if (include) {
112647
112730
  files.push(relative8(directories.root, path2));
112648
112731
  }
112649
- await mkdir7(dirname17(path2), { recursive: true });
112732
+ await mkdir7(dirname18(path2), { recursive: true });
112650
112733
  await writeFile9(path2, code);
112651
112734
  }
112652
112735
  }
@@ -112655,7 +112738,7 @@ var generateTypes = async (props) => {
112655
112738
  if (files.length) {
112656
112739
  const code = files.map((file2) => `/// <reference path='${file2}' />`).join(`
112657
112740
  `);
112658
- await writeFile9(join28(directories.root, `awsless.d.ts`), code);
112741
+ await writeFile9(join29(directories.root, `awsless.d.ts`), code);
112659
112742
  }
112660
112743
  };
112661
112744
 
@@ -114752,7 +114835,7 @@ var DEFAULT_PROFILE = "default";
114752
114835
  var getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;
114753
114836
 
114754
114837
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/loadSharedConfigFiles.js
114755
- import { join as join31 } from "path";
114838
+ import { join as join32 } from "path";
114756
114839
 
114757
114840
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/constants.js
114758
114841
  var CONFIG_PREFIX_SEPARATOR = ".";
@@ -114774,14 +114857,14 @@ var getConfigData = (data) => Object.entries(data).filter(([key]) => {
114774
114857
  });
114775
114858
 
114776
114859
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getConfigFilepath.js
114777
- import { join as join29 } from "path";
114860
+ import { join as join30 } from "path";
114778
114861
  var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
114779
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join29(getHomeDir(), ".aws", "config");
114862
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || join30(getHomeDir(), ".aws", "config");
114780
114863
 
114781
114864
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/getCredentialsFilepath.js
114782
- import { join as join30 } from "path";
114865
+ import { join as join31 } from "path";
114783
114866
  var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
114784
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join30(getHomeDir(), ".aws", "credentials");
114867
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || join31(getHomeDir(), ".aws", "credentials");
114785
114868
 
114786
114869
  // ../../node_modules/.pnpm/@smithy+shared-ini-file-loader@4.4.7/node_modules/@smithy/shared-ini-file-loader/dist-es/parseIni.js
114787
114870
  var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
@@ -114854,11 +114937,11 @@ var loadSharedConfigFiles = async (init = {}) => {
114854
114937
  const relativeHomeDirPrefix = "~/";
114855
114938
  let resolvedFilepath = filepath;
114856
114939
  if (filepath.startsWith(relativeHomeDirPrefix)) {
114857
- resolvedFilepath = join31(homeDir, filepath.slice(2));
114940
+ resolvedFilepath = join32(homeDir, filepath.slice(2));
114858
114941
  }
114859
114942
  let resolvedConfigFilepath = configFilepath;
114860
114943
  if (configFilepath.startsWith(relativeHomeDirPrefix)) {
114861
- resolvedConfigFilepath = join31(homeDir, configFilepath.slice(2));
114944
+ resolvedConfigFilepath = join32(homeDir, configFilepath.slice(2));
114862
114945
  }
114863
114946
  const parsedFiles = await Promise.all([
114864
114947
  readFile13(resolvedConfigFilepath, {
@@ -115951,16 +116034,16 @@ var getRuntimeUserAgentPair = () => {
115951
116034
 
115952
116035
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptUserAgentPair.js
115953
116036
  import { readFile as readFile15 } from "fs/promises";
115954
- import { join as join33 } from "path";
116037
+ import { join as join34 } from "path";
115955
116038
 
115956
116039
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/util-user-agent-node/dist-es/getNodeModulesParentDirs.js
115957
116040
  import { normalize as normalize3, sep as sep3 } from "path";
115958
- var getNodeModulesParentDirs = (dirname19) => {
116041
+ var getNodeModulesParentDirs = (dirname20) => {
115959
116042
  const cwd = process.cwd();
115960
- if (!dirname19) {
116043
+ if (!dirname20) {
115961
116044
  return [cwd];
115962
116045
  }
115963
- const normalizedPath = normalize3(dirname19);
116046
+ const normalizedPath = normalize3(dirname20);
115964
116047
  const parts = normalizedPath.split(sep3);
115965
116048
  const nodeModulesIndex = parts.indexOf("node_modules");
115966
116049
  const parentDir = nodeModulesIndex !== -1 ? parts.slice(0, nodeModulesIndex).join(sep3) : normalizedPath;
@@ -115999,7 +116082,7 @@ var getSanitizedDevTypeScriptVersion = (version2 = "") => {
115999
116082
  // ../../node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/util-user-agent-node/dist-es/getTypeScriptUserAgentPair.js
116000
116083
  var __dirname = "/Users/work/Code/awsless/node_modules/.pnpm/@aws-sdk+util-user-agent-node@3.973.14_aws-crt@1.30.0_supports-color@8.1.1_/node_modules/@aws-sdk/util-user-agent-node/dist-es";
116001
116084
  var tscVersion;
116002
- var TS_PACKAGE_JSON = join33("node_modules", "typescript", "package.json");
116085
+ var TS_PACKAGE_JSON = join34("node_modules", "typescript", "package.json");
116003
116086
  var getTypeScriptUserAgentPair = async () => {
116004
116087
  if (tscVersion === null) {
116005
116088
  return;
@@ -116014,12 +116097,12 @@ var getTypeScriptUserAgentPair = async () => {
116014
116097
  tscVersion = null;
116015
116098
  return;
116016
116099
  }
116017
- const dirname19 = typeof __dirname !== "undefined" ? __dirname : undefined;
116018
- const nodeModulesParentDirs = getNodeModulesParentDirs(dirname19);
116100
+ const dirname20 = typeof __dirname !== "undefined" ? __dirname : undefined;
116101
+ const nodeModulesParentDirs = getNodeModulesParentDirs(dirname20);
116019
116102
  let versionFromApp;
116020
116103
  for (const nodeModulesParentDir of nodeModulesParentDirs) {
116021
116104
  try {
116022
- const appPackageJsonPath = join33(nodeModulesParentDir, "package.json");
116105
+ const appPackageJsonPath = join34(nodeModulesParentDir, "package.json");
116023
116106
  const packageJson = await readFile15(appPackageJsonPath, "utf-8");
116024
116107
  const { dependencies, devDependencies } = JSON.parse(packageJson);
116025
116108
  const version2 = devDependencies?.typescript ?? dependencies?.typescript;
@@ -116037,7 +116120,7 @@ var getTypeScriptUserAgentPair = async () => {
116037
116120
  let versionFromNodeModules;
116038
116121
  for (const nodeModulesParentDir of nodeModulesParentDirs) {
116039
116122
  try {
116040
- const tsPackageJsonPath = join33(nodeModulesParentDir, TS_PACKAGE_JSON);
116123
+ const tsPackageJsonPath = join34(nodeModulesParentDir, TS_PACKAGE_JSON);
116041
116124
  const packageJson = await readFile15(tsPackageJsonPath, "utf-8");
116042
116125
  const { version: version2 } = JSON.parse(packageJson);
116043
116126
  const sanitizedVersion2 = getSanitizedTypeScriptVersion(version2);
@@ -119098,7 +119181,7 @@ var sinon;
119098
119181
  const arraySlice = arrayProto.slice;
119099
119182
  const concat = arrayProto.concat;
119100
119183
  const forEach = arrayProto.forEach;
119101
- const join34 = arrayProto.join;
119184
+ const join35 = arrayProto.join;
119102
119185
  const splice = arrayProto.splice;
119103
119186
  function applyDefaults(obj, defaults2) {
119104
119187
  for (const key of Object.keys(defaults2)) {
@@ -119134,7 +119217,7 @@ var sinon;
119134
119217
  let actual = "";
119135
119218
  if (!calledInOrder(arguments)) {
119136
119219
  try {
119137
- expected = join34(arguments, ", ");
119220
+ expected = join35(arguments, ", ");
119138
119221
  const calls = arraySlice(arguments);
119139
119222
  let i4 = calls.length;
119140
119223
  while (i4) {
@@ -119142,7 +119225,7 @@ var sinon;
119142
119225
  splice(calls, i4, 1);
119143
119226
  }
119144
119227
  }
119145
- actual = join34(orderByFirstCall(calls), ", ");
119228
+ actual = join35(orderByFirstCall(calls), ", ");
119146
119229
  } catch (e7) {}
119147
119230
  failAssertion(this, `expected ${expected} to be called in order but were called as ${actual}`);
119148
119231
  } else {
@@ -119187,7 +119270,7 @@ var sinon;
119187
119270
  ` expected = ${inspect(expectation)}`,
119188
119271
  ` actual = ${inspect(actual)}`
119189
119272
  ];
119190
- failAssertion(this, join34(formatted, `
119273
+ failAssertion(this, join35(formatted, `
119191
119274
  `));
119192
119275
  }
119193
119276
  }
@@ -119292,7 +119375,7 @@ var sinon;
119292
119375
  const valueToString = require2("@sinonjs/commons").valueToString;
119293
119376
  const exportAsyncBehaviors = require2("./util/core/export-async-behaviors");
119294
119377
  const concat = arrayProto.concat;
119295
- const join34 = arrayProto.join;
119378
+ const join35 = arrayProto.join;
119296
119379
  const reverse = arrayProto.reverse;
119297
119380
  const slice = arrayProto.slice;
119298
119381
  const useLeftMostCallback = -1;
@@ -119329,7 +119412,7 @@ var sinon;
119329
119412
  msg = `${functionName(behavior.stub)} expected to yield, but no callback was passed.`;
119330
119413
  }
119331
119414
  if (args.length > 0) {
119332
- msg += ` Received [${join34(args, ", ")}]`;
119415
+ msg += ` Received [${join35(args, ", ")}]`;
119333
119416
  }
119334
119417
  return msg;
119335
119418
  }
@@ -120139,7 +120222,7 @@ var sinon;
120139
120222
  const filter2 = arrayProto.filter;
120140
120223
  const forEach = arrayProto.forEach;
120141
120224
  const every = arrayProto.every;
120142
- const join34 = arrayProto.join;
120225
+ const join35 = arrayProto.join;
120143
120226
  const push = arrayProto.push;
120144
120227
  const slice = arrayProto.slice;
120145
120228
  const unshift = arrayProto.unshift;
@@ -120216,10 +120299,10 @@ var sinon;
120216
120299
  });
120217
120300
  this.restore();
120218
120301
  if (messages.length > 0) {
120219
- mockExpectation.fail(join34(concat(messages, met), `
120302
+ mockExpectation.fail(join35(concat(messages, met), `
120220
120303
  `));
120221
120304
  } else if (met.length > 0) {
120222
- mockExpectation.pass(join34(concat(messages, met), `
120305
+ mockExpectation.pass(join35(concat(messages, met), `
120223
120306
  `));
120224
120307
  }
120225
120308
  return true;
@@ -120272,7 +120355,7 @@ var sinon;
120272
120355
  args,
120273
120356
  stack: err.stack
120274
120357
  })}`);
120275
- mockExpectation.fail(join34(messages, `
120358
+ mockExpectation.fail(join35(messages, `
120276
120359
  `));
120277
120360
  }
120278
120361
  });
@@ -120379,14 +120462,14 @@ var sinon;
120379
120462
  const valueToString = require2("@sinonjs/commons").valueToString;
120380
120463
  const concat = arrayProto.concat;
120381
120464
  const filter2 = arrayProto.filter;
120382
- const join34 = arrayProto.join;
120465
+ const join35 = arrayProto.join;
120383
120466
  const map = arrayProto.map;
120384
120467
  const reduce = arrayProto.reduce;
120385
120468
  const slice = arrayProto.slice;
120386
120469
  function throwYieldError(proxy, text2, args) {
120387
120470
  let msg = functionName(proxy) + text2;
120388
120471
  if (args.length) {
120389
- msg += ` Received [${join34(slice(args), ", ")}]`;
120472
+ msg += ` Received [${join35(slice(args), ", ")}]`;
120390
120473
  }
120391
120474
  throw new Error(msg);
120392
120475
  }
@@ -120508,7 +120591,7 @@ var sinon;
120508
120591
  const formattedArgs = map(this.args, function(arg) {
120509
120592
  return inspect(arg);
120510
120593
  });
120511
- callStr = `${callStr + join34(formattedArgs, ", ")})`;
120594
+ callStr = `${callStr + join35(formattedArgs, ", ")})`;
120512
120595
  if (typeof this.returnValue !== "undefined") {
120513
120596
  callStr += ` => ${inspect(this.returnValue)}`;
120514
120597
  }
@@ -121239,7 +121322,7 @@ var sinon;
121239
121322
  const timesInWords = require2("./util/core/times-in-words");
121240
121323
  const inspect = require2("util").inspect;
121241
121324
  const jsDiff = require2("diff");
121242
- const join34 = arrayProto.join;
121325
+ const join35 = arrayProto.join;
121243
121326
  const map = arrayProto.map;
121244
121327
  const push = arrayProto.push;
121245
121328
  const slice = arrayProto.slice;
@@ -121267,7 +121350,7 @@ var sinon;
121267
121350
  }
121268
121351
  return text2;
121269
121352
  });
121270
- return join34(objects, "");
121353
+ return join35(objects, "");
121271
121354
  }
121272
121355
  function quoteStringValue(value) {
121273
121356
  if (typeof value === "string") {
@@ -121325,7 +121408,7 @@ ${stringifiedCall}`;
121325
121408
  push(calls, stringifiedCall);
121326
121409
  }
121327
121410
  return calls.length > 0 ? `
121328
- ${join34(calls, `
121411
+ ${join35(calls, `
121329
121412
  `)}` : "";
121330
121413
  },
121331
121414
  t: function(spyInstance) {
@@ -121333,10 +121416,10 @@ ${join34(calls, `
121333
121416
  for (let i4 = 0, l5 = spyInstance.callCount;i4 < l5; ++i4) {
121334
121417
  push(objects, inspect(spyInstance.thisValues[i4]));
121335
121418
  }
121336
- return join34(objects, ", ");
121419
+ return join35(objects, ", ");
121337
121420
  },
121338
121421
  "*": function(spyInstance, args) {
121339
- return join34(map(args, function(arg) {
121422
+ return join35(map(args, function(arg) {
121340
121423
  return inspect(arg);
121341
121424
  }), ", ");
121342
121425
  }
@@ -121668,7 +121751,7 @@ ${join34(calls, `
121668
121751
  }, { "@sinonjs/commons": 48 }], 26: [function(require2, module, exports) {
121669
121752
  const arrayProto = require2("@sinonjs/commons").prototypes.array;
121670
121753
  const hasOwnProperty2 = require2("@sinonjs/commons").prototypes.object.hasOwnProperty;
121671
- const join34 = arrayProto.join;
121754
+ const join35 = arrayProto.join;
121672
121755
  const push = arrayProto.push;
121673
121756
  const hasDontEnumBug = function() {
121674
121757
  const obj = {
@@ -121709,7 +121792,7 @@ ${join34(calls, `
121709
121792
  push(result, obj[prop]());
121710
121793
  }
121711
121794
  }
121712
- return join34(result, "") !== "0123456789";
121795
+ return join35(result, "") !== "0123456789";
121713
121796
  }();
121714
121797
  function extendCommon(target2, sources, doCopy) {
121715
121798
  let source, i4, prop;
@@ -123774,7 +123857,7 @@ ${job.error.stack.split(`
123774
123857
  module.exports = matcherPrototype;
123775
123858
  }, { "../create-matcher": 63 }], 71: [function(require2, module, exports) {
123776
123859
  var functionName = require2("@sinonjs/commons").functionName;
123777
- var join34 = require2("@sinonjs/commons").prototypes.array.join;
123860
+ var join35 = require2("@sinonjs/commons").prototypes.array.join;
123778
123861
  var map = require2("@sinonjs/commons").prototypes.array.map;
123779
123862
  var stringIndexOf = require2("@sinonjs/commons").prototypes.string.indexOf;
123780
123863
  var valueToString = require2("@sinonjs/commons").valueToString;
@@ -123805,7 +123888,7 @@ ${job.error.stack.split(`
123805
123888
  m5.test = function(actual) {
123806
123889
  return matchObject(actual, expectation, match3);
123807
123890
  };
123808
- m5.message = `match(${join34(array, ", ")})`;
123891
+ m5.message = `match(${join35(array, ", ")})`;
123809
123892
  return m5;
123810
123893
  },
123811
123894
  regexp: function(m5, expectation) {
@@ -127129,7 +127212,7 @@ ${job.error.stack.split(`
127129
127212
  tokenize: function tokenize(value) {
127130
127213
  return value.split("");
127131
127214
  },
127132
- join: function join34(chars) {
127215
+ join: function join35(chars) {
127133
127216
  return chars.join("");
127134
127217
  }
127135
127218
  };
@@ -135222,12 +135305,18 @@ var test2 = (program3) => {
135222
135305
  const region = props.appConfig.region;
135223
135306
  const credentials2 = await getCredentials(props.appConfig.profile);
135224
135307
  const accountId = await getAccountId(credentials2, region);
135225
- const { tests } = createApp({ ...props, accountId });
135308
+ const { tests, appId } = createApp({ ...props, accountId });
135226
135309
  if (tests.length === 0) {
135227
135310
  return "No tests found.";
135228
135311
  }
135229
135312
  const passed = await runTests(tests, stacks, options?.filters, {
135230
- showLogs: true
135313
+ showLogs: true,
135314
+ env: {
135315
+ APP: props.appConfig.name,
135316
+ APP_ID: appId,
135317
+ AWS_REGION: region,
135318
+ AWS_ACCOUNT_ID: accountId
135319
+ }
135231
135320
  });
135232
135321
  if (!passed) {
135233
135322
  throw new Cancelled2;