@effortless-aws/cli 0.2.2 → 0.3.0

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +270 -638
  2. package/package.json +2 -2
package/dist/cli/index.js CHANGED
@@ -8,16 +8,16 @@ var __export = (target, all) => {
8
8
  // src/cli/index.ts
9
9
  import { CliConfig, Command as Command7 } from "@effect/cli";
10
10
  import { NodeContext, NodeRuntime } from "@effect/platform-node";
11
- import { Effect as Effect45 } from "effect";
11
+ import { Effect as Effect44 } from "effect";
12
12
  import { createRequire as createRequire2 } from "module";
13
13
 
14
14
  // src/cli/commands/deploy.ts
15
15
  import { Args, Command } from "@effect/cli";
16
- import { Effect as Effect38, Console as Console3, Logger, LogLevel, Option } from "effect";
16
+ import { Effect as Effect37, Console as Console3, Logger, LogLevel, Option } from "effect";
17
17
  import * as path9 from "path";
18
18
 
19
19
  // src/deploy/deploy.ts
20
- import { Effect as Effect35, Console as Console2 } from "effect";
20
+ import { Effect as Effect34, Console as Console2 } from "effect";
21
21
 
22
22
  // src/cli/colors.ts
23
23
  var wrap = (code) => (s) => `\x1B[${code}m${s}\x1B[0m`;
@@ -1933,6 +1933,11 @@ var publishVersion = (functionName) => Effect13.gen(function* () {
1933
1933
  version: result.Version
1934
1934
  };
1935
1935
  });
1936
+ var DEFAULT_CORS = {
1937
+ AllowOrigins: ["*"],
1938
+ AllowMethods: ["*"],
1939
+ AllowHeaders: ["*"]
1940
+ };
1936
1941
  var ensureFunctionUrl = (functionName) => Effect13.gen(function* () {
1937
1942
  const existing = yield* lambda_exports.make("get_function_url_config", {
1938
1943
  FunctionName: functionName
@@ -1945,7 +1950,8 @@ var ensureFunctionUrl = (functionName) => Effect13.gen(function* () {
1945
1950
  if (existing) {
1946
1951
  yield* lambda_exports.make("update_function_url_config", {
1947
1952
  FunctionName: functionName,
1948
- AuthType: "NONE"
1953
+ AuthType: "NONE",
1954
+ Cors: DEFAULT_CORS
1949
1955
  });
1950
1956
  return { functionUrl: existing.FunctionUrl };
1951
1957
  }
@@ -1953,7 +1959,8 @@ var ensureFunctionUrl = (functionName) => Effect13.gen(function* () {
1953
1959
  const result = yield* lambda_exports.make("create_function_url_config", {
1954
1960
  FunctionName: functionName,
1955
1961
  AuthType: "NONE",
1956
- InvokeMode: "BUFFERED"
1962
+ InvokeMode: "BUFFERED",
1963
+ Cors: DEFAULT_CORS
1957
1964
  });
1958
1965
  return { functionUrl: result.FunctionUrl };
1959
1966
  });
@@ -2419,133 +2426,6 @@ var deleteTable = (tableName) => Effect16.gen(function* () {
2419
2426
 
2420
2427
  // src/aws/apigateway.ts
2421
2428
  import { Effect as Effect17 } from "effect";
2422
- var ensureProjectApi = (config) => Effect17.gen(function* () {
2423
- const apiName = `${config.projectName}-${config.stage}`;
2424
- const existingApis = yield* apigatewayv2_exports.make("get_apis", {});
2425
- const existingApi = existingApis.Items?.find((api) => api.Name === apiName);
2426
- let apiId;
2427
- if (existingApi) {
2428
- yield* Effect17.logDebug(`Using existing API Gateway: ${apiName}`);
2429
- apiId = existingApi.ApiId;
2430
- if (config.tags) {
2431
- const apiArn = `arn:aws:apigateway:${config.region}::/apis/${apiId}`;
2432
- yield* apigatewayv2_exports.make("tag_resource", {
2433
- ResourceArn: apiArn,
2434
- Tags: config.tags
2435
- });
2436
- }
2437
- } else {
2438
- yield* Effect17.logDebug(`Creating API Gateway: ${apiName}`);
2439
- const createResult = yield* apigatewayv2_exports.make("create_api", {
2440
- Name: apiName,
2441
- ProtocolType: "HTTP",
2442
- CorsConfiguration: {
2443
- AllowOrigins: ["*"],
2444
- AllowMethods: ["*"],
2445
- AllowHeaders: ["*"]
2446
- },
2447
- Tags: config.tags
2448
- });
2449
- apiId = createResult.ApiId;
2450
- yield* apigatewayv2_exports.make("create_stage", {
2451
- ApiId: apiId,
2452
- StageName: "$default",
2453
- AutoDeploy: true
2454
- });
2455
- }
2456
- return { apiId };
2457
- });
2458
- var addRouteToApi = (config) => Effect17.gen(function* () {
2459
- const integrationUri = `arn:aws:apigateway:${config.region}:lambda:path/2015-03-31/functions/${config.functionArn}/invocations`;
2460
- const existingIntegrations = yield* apigatewayv2_exports.make("get_integrations", { ApiId: config.apiId });
2461
- let integrationId = existingIntegrations.Items?.find(
2462
- (i) => i.IntegrationUri === integrationUri
2463
- )?.IntegrationId;
2464
- if (!integrationId) {
2465
- yield* Effect17.logDebug("Creating integration");
2466
- const integrationResult = yield* apigatewayv2_exports.make("create_integration", {
2467
- ApiId: config.apiId,
2468
- IntegrationType: "AWS_PROXY",
2469
- IntegrationUri: integrationUri,
2470
- IntegrationMethod: "POST",
2471
- PayloadFormatVersion: "2.0"
2472
- });
2473
- integrationId = integrationResult.IntegrationId;
2474
- }
2475
- const routeKey = `${config.method} ${config.path}`;
2476
- const existingRoutes = yield* apigatewayv2_exports.make("get_routes", { ApiId: config.apiId });
2477
- const existingRoute = existingRoutes.Items?.find((r) => r.RouteKey === routeKey);
2478
- const target = `integrations/${integrationId}`;
2479
- if (!existingRoute) {
2480
- yield* Effect17.logDebug(`Creating route: ${routeKey}`);
2481
- yield* apigatewayv2_exports.make("create_route", {
2482
- ApiId: config.apiId,
2483
- RouteKey: routeKey,
2484
- Target: target
2485
- });
2486
- } else if (existingRoute.Target !== target) {
2487
- yield* Effect17.logDebug(`Updating route target: ${routeKey}`);
2488
- yield* apigatewayv2_exports.make("update_route", {
2489
- ApiId: config.apiId,
2490
- RouteId: existingRoute.RouteId,
2491
- RouteKey: routeKey,
2492
- Target: target
2493
- });
2494
- } else {
2495
- yield* Effect17.logDebug(`Route already exists: ${routeKey}`);
2496
- }
2497
- yield* addLambdaPermission(config.functionArn, config.apiId, config.region);
2498
- const apiUrl = `https://${config.apiId}.execute-api.${config.region}.amazonaws.com${config.path}`;
2499
- return { apiUrl };
2500
- });
2501
- var addLambdaPermission = (functionArn, apiId, region) => Effect17.gen(function* () {
2502
- const statementId = `apigateway-${apiId}`;
2503
- const accountId = functionArn.split(":")[4];
2504
- const sourceArn = `arn:aws:execute-api:${region}:${accountId}:${apiId}/*/*`;
2505
- yield* lambda_exports.make("add_permission", {
2506
- FunctionName: functionArn,
2507
- StatementId: statementId,
2508
- Action: "lambda:InvokeFunction",
2509
- Principal: "apigateway.amazonaws.com",
2510
- SourceArn: sourceArn
2511
- }).pipe(
2512
- Effect17.catchIf(
2513
- (e) => e._tag === "LambdaError" && e.is("ResourceConflictException"),
2514
- () => {
2515
- return Effect17.logDebug("Permission already exists");
2516
- }
2517
- )
2518
- );
2519
- });
2520
- var removeStaleRoutes = (apiId, activeRouteKeys) => Effect17.gen(function* () {
2521
- const existingRoutes = yield* apigatewayv2_exports.make("get_routes", { ApiId: apiId });
2522
- for (const route of existingRoutes.Items ?? []) {
2523
- if (route.RouteKey && !activeRouteKeys.has(route.RouteKey)) {
2524
- yield* Effect17.logDebug(`Removing stale route: ${route.RouteKey}`);
2525
- yield* apigatewayv2_exports.make("delete_route", {
2526
- ApiId: apiId,
2527
- RouteId: route.RouteId
2528
- });
2529
- const integrationId = route.Target?.replace("integrations/", "");
2530
- if (integrationId) {
2531
- const remainingRoutes = yield* apigatewayv2_exports.make("get_routes", { ApiId: apiId });
2532
- const stillUsed = remainingRoutes.Items?.some((r) => r.Target === route.Target);
2533
- if (!stillUsed) {
2534
- yield* Effect17.logDebug(`Removing orphaned integration: ${integrationId}`);
2535
- yield* apigatewayv2_exports.make("delete_integration", {
2536
- ApiId: apiId,
2537
- IntegrationId: integrationId
2538
- }).pipe(
2539
- Effect17.catchIf(
2540
- (e) => e._tag === "ApiGatewayV2Error" && e.is("NotFoundException"),
2541
- () => Effect17.logDebug(`Integration ${integrationId} already removed`)
2542
- )
2543
- );
2544
- }
2545
- }
2546
- }
2547
- }
2548
- });
2549
2429
  var deleteApi = (apiId) => Effect17.gen(function* () {
2550
2430
  yield* Effect17.logDebug(`Deleting API Gateway: ${apiId}`);
2551
2431
  yield* apigatewayv2_exports.make("delete_api", {
@@ -2584,7 +2464,7 @@ var computeLockfileHash = (projectDir) => Effect18.gen(function* () {
2584
2464
  }
2585
2465
  const { packages: allPackages, resolvedPaths } = collectTransitiveDeps(projectDir, prodDeps);
2586
2466
  const packageVersions = [];
2587
- for (const pkgName of Array.from(allPackages).sort()) {
2467
+ for (const pkgName of Array.from(allPackages).filter((p) => !isAwsRuntime(p)).sort()) {
2588
2468
  const pkgPath = resolvedPaths.get(pkgName) ?? findInPnpmStore(projectDir, pkgName) ?? getPackageRealPath(projectDir, pkgName);
2589
2469
  if (pkgPath) {
2590
2470
  const version2 = getPackageVersion(pkgPath);
@@ -2785,7 +2665,7 @@ var collectTransitiveDeps = (projectDir, rootDeps, searchPath = path.join(projec
2785
2665
  }
2786
2666
  return { packages: visited, resolvedPaths, warnings };
2787
2667
  };
2788
- var isAwsRuntime = (pkg) => pkg.startsWith("@aws-sdk/") || pkg.startsWith("@smithy/");
2668
+ var isAwsRuntime = (pkg) => pkg.startsWith("@aws-sdk/") || pkg.startsWith("@smithy/") || pkg.startsWith("@aws-crypto/") || pkg.startsWith("@aws/");
2789
2669
  var collectLayerPackages = (projectDir, dependencies) => {
2790
2670
  if (dependencies.length === 0) return { packages: [], resolvedPaths: /* @__PURE__ */ new Map(), warnings: [] };
2791
2671
  const { packages, resolvedPaths, warnings } = collectTransitiveDeps(projectDir, dependencies);
@@ -2826,7 +2706,8 @@ var collectLayerPackages = (projectDir, dependencies) => {
2826
2706
  }
2827
2707
  }
2828
2708
  }
2829
- return { packages: Array.from(packages), resolvedPaths, warnings };
2709
+ const filtered = Array.from(packages).filter((pkg) => !isAwsRuntime(pkg));
2710
+ return { packages: filtered, resolvedPaths, warnings };
2830
2711
  };
2831
2712
  var findPackagePath = (projectDir, pkgName) => {
2832
2713
  const rootPath = getPackageRealPath(projectDir, pkgName);
@@ -4124,7 +4005,7 @@ var parseSource = (source) => {
4124
4005
  const project = new Project({ useInMemoryFileSystem: true });
4125
4006
  return project.createSourceFile("input.ts", source);
4126
4007
  };
4127
- var RUNTIME_PROPS = ["onRequest", "onRecord", "onBatchComplete", "onBatch", "onMessage", "onObjectCreated", "onObjectRemoved", "setup", "schema", "onError", "deps", "config", "static", "middleware", "routes", "get", "post"];
4008
+ var RUNTIME_PROPS = ["onRecord", "onBatchComplete", "onBatch", "onMessage", "onObjectCreated", "onObjectRemoved", "setup", "schema", "onError", "deps", "config", "static", "middleware", "routes", "get", "post"];
4128
4009
  var evalConfig = (configText, exportName) => {
4129
4010
  try {
4130
4011
  return new Function(`return ${configText}`)();
@@ -4249,12 +4130,6 @@ var extractRoutePatterns = (obj) => {
4249
4130
  }).filter(Boolean);
4250
4131
  };
4251
4132
  var handlerRegistry = {
4252
- http: {
4253
- defineFn: "defineHttp",
4254
- handlerProps: ["onRequest"],
4255
- wrapperFn: "wrapHttp",
4256
- wrapperPath: "~/runtime/wrap-http"
4257
- },
4258
4133
  table: {
4259
4134
  defineFn: "defineTable",
4260
4135
  handlerProps: ["onRecord", "onBatch"],
@@ -4361,7 +4236,6 @@ export const handler = ${wrapperFn}(${importName});
4361
4236
  };
4362
4237
 
4363
4238
  // src/build/bundle.ts
4364
- var extractConfigs = (source) => extractHandlerConfigs(source, "http");
4365
4239
  var extractTableConfigs = (source) => extractHandlerConfigs(source, "table");
4366
4240
  var extractAppConfigs = (source) => extractHandlerConfigs(source, "app");
4367
4241
  var extractStaticSiteConfigs = (source) => extractHandlerConfigs(source, "staticSite");
@@ -4373,7 +4247,7 @@ var _require = createRequire(import.meta.url);
4373
4247
  var runtimeDir = path3.join(path3.dirname(_require.resolve("effortless-aws/package.json")), "dist/runtime");
4374
4248
  var bundle = (input) => Effect24.gen(function* () {
4375
4249
  const exportName = input.exportName ?? "default";
4376
- const type = input.type ?? "http";
4250
+ const type = input.type ?? "api";
4377
4251
  const externals = input.external ?? [];
4378
4252
  const sourcePath = path3.isAbsolute(input.file) ? input.file : `./${input.file}`;
4379
4253
  const entryPoint = generateEntryPoint(sourcePath, exportName, type, runtimeDir);
@@ -4462,7 +4336,6 @@ var findHandlerFiles = (patterns, cwd) => {
4462
4336
  return Array.from(files);
4463
4337
  };
4464
4338
  var discoverHandlers = (files) => {
4465
- const httpHandlers = [];
4466
4339
  const tableHandlers = [];
4467
4340
  const appHandlers = [];
4468
4341
  const staticSiteHandlers = [];
@@ -4473,7 +4346,6 @@ var discoverHandlers = (files) => {
4473
4346
  for (const file of files) {
4474
4347
  if (!fsSync2.statSync(file).isFile()) continue;
4475
4348
  const source = fsSync2.readFileSync(file, "utf-8");
4476
- const http = extractConfigs(source);
4477
4349
  const table = extractTableConfigs(source);
4478
4350
  const app = extractAppConfigs(source);
4479
4351
  const staticSite = extractStaticSiteConfigs(source);
@@ -4481,7 +4353,6 @@ var discoverHandlers = (files) => {
4481
4353
  const bucket = extractBucketConfigs(source);
4482
4354
  const mailer = extractMailerConfigs(source);
4483
4355
  const api = extractApiConfigs(source);
4484
- if (http.length > 0) httpHandlers.push({ file, exports: http });
4485
4356
  if (table.length > 0) tableHandlers.push({ file, exports: table });
4486
4357
  if (app.length > 0) appHandlers.push({ file, exports: app });
4487
4358
  if (staticSite.length > 0) staticSiteHandlers.push({ file, exports: staticSite });
@@ -4490,12 +4361,11 @@ var discoverHandlers = (files) => {
4490
4361
  if (mailer.length > 0) mailerHandlers.push({ file, exports: mailer });
4491
4362
  if (api.length > 0) apiHandlers.push({ file, exports: api });
4492
4363
  }
4493
- return { httpHandlers, tableHandlers, appHandlers, staticSiteHandlers, fifoQueueHandlers, bucketHandlers, mailerHandlers, apiHandlers };
4364
+ return { tableHandlers, appHandlers, staticSiteHandlers, fifoQueueHandlers, bucketHandlers, mailerHandlers, apiHandlers };
4494
4365
  };
4495
4366
  var flattenHandlers = (discovered) => {
4496
4367
  const entries = (type, handlers) => handlers.flatMap((h) => h.exports.map((e) => ({ exportName: e.exportName, file: h.file, type })));
4497
4368
  return [
4498
- ...entries("http", discovered.httpHandlers),
4499
4369
  ...entries("table", discovered.tableHandlers),
4500
4370
  ...entries("app", discovered.appHandlers),
4501
4371
  ...entries("site", discovered.staticSiteHandlers),
@@ -4527,7 +4397,6 @@ var collectRequiredParams = (handlers, project, stage) => {
4527
4397
  }
4528
4398
  }
4529
4399
  };
4530
- collect(handlers.httpHandlers);
4531
4400
  collect(handlers.tableHandlers);
4532
4401
  collect(handlers.fifoQueueHandlers);
4533
4402
  collect(handlers.bucketHandlers);
@@ -4559,7 +4428,7 @@ var checkMissingParams = (params) => Effect25.gen(function* () {
4559
4428
  return { existing, missing };
4560
4429
  });
4561
4430
 
4562
- // src/deploy/deploy-http.ts
4431
+ // src/deploy/deploy-table.ts
4563
4432
  import { Effect as Effect27 } from "effect";
4564
4433
 
4565
4434
  // src/deploy/shared.ts
@@ -4656,151 +4525,9 @@ var deployCoreLambda = ({
4656
4525
  return { functionArn, status, tagCtx };
4657
4526
  });
4658
4527
 
4659
- // src/deploy/deploy-http.ts
4660
- var deployLambda = ({ input, fn: fn13, layerArn, external, depsEnv, depsPermissions, staticGlobs }) => Effect27.gen(function* () {
4661
- const { exportName, config } = fn13;
4662
- const handlerName = exportName;
4663
- const { functionArn, status } = yield* deployCoreLambda({
4664
- input,
4665
- exportName,
4666
- handlerName,
4667
- bundleType: "http",
4668
- ...config.permissions ? { permissions: config.permissions } : {},
4669
- ...config.memory ? { memory: config.memory } : {},
4670
- ...config.timeout ? { timeout: config.timeout } : {},
4671
- ...layerArn ? { layerArn } : {},
4672
- ...external ? { external } : {},
4673
- ...depsEnv ? { depsEnv } : {},
4674
- ...depsPermissions ? { depsPermissions } : {},
4675
- ...staticGlobs && staticGlobs.length > 0 ? { staticGlobs } : {}
4676
- });
4677
- return { exportName, functionArn, status, config, handlerName };
4678
- });
4679
- var deploy = (input) => Effect27.gen(function* () {
4680
- const source = yield* readSource(input);
4681
- const configs = extractConfigs(source);
4682
- if (configs.length === 0) {
4683
- return yield* Effect27.fail(new Error("Could not extract defineHttp config from source"));
4684
- }
4685
- const targetExport = input.exportName ?? "default";
4686
- const fn13 = configs.find((c2) => c2.exportName === targetExport) ?? configs[0];
4687
- const config = fn13.config;
4688
- const handlerName = fn13.exportName;
4689
- const tagCtx = {
4690
- project: input.project,
4691
- stage: resolveStage(input.stage),
4692
- handler: handlerName
4693
- };
4694
- yield* Effect27.logDebug(`Deploying ${handlerName} to ${input.region} (${tagCtx.project}/${tagCtx.stage})`);
4695
- const { layerArn, external } = yield* ensureLayerAndExternal({
4696
- project: input.project,
4697
- stage: tagCtx.stage,
4698
- region: input.region,
4699
- packageDir: input.packageDir ?? input.projectDir
4700
- });
4701
- const { functionArn } = yield* deployLambda({
4702
- input,
4703
- fn: fn13,
4704
- ...layerArn ? { layerArn } : {},
4705
- ...external.length > 0 ? { external } : {}
4706
- });
4707
- yield* Effect27.logDebug("Setting up API Gateway...");
4708
- const { apiId } = yield* ensureProjectApi({
4709
- projectName: input.project,
4710
- stage: tagCtx.stage,
4711
- region: input.region,
4712
- tags: makeTags(tagCtx, "api-gateway")
4713
- });
4714
- const { apiUrl } = yield* addRouteToApi({
4715
- apiId,
4716
- region: input.region,
4717
- functionArn,
4718
- method: config.method,
4719
- path: config.path
4720
- });
4721
- yield* Effect27.logDebug(`Deployment complete! URL: ${apiUrl}`);
4722
- return {
4723
- exportName: fn13.exportName,
4724
- url: apiUrl,
4725
- functionArn
4726
- };
4727
- }).pipe(
4728
- Effect27.provide(
4729
- clients_exports.makeClients({
4730
- lambda: { region: input.region },
4731
- iam: { region: input.region },
4732
- apigatewayv2: { region: input.region }
4733
- })
4734
- )
4735
- );
4736
- var deployAll = (input) => Effect27.gen(function* () {
4737
- const source = yield* readSource(input);
4738
- const functions = extractConfigs(source);
4739
- if (functions.length === 0) {
4740
- return yield* Effect27.fail(new Error("No defineHttp exports found in source"));
4741
- }
4742
- yield* Effect27.logDebug(`Found ${functions.length} HTTP handler(s) to deploy`);
4743
- const tagCtx = {
4744
- project: input.project,
4745
- stage: resolveStage(input.stage),
4746
- handler: "api"
4747
- };
4748
- const { layerArn, external } = yield* ensureLayerAndExternal({
4749
- project: input.project,
4750
- stage: tagCtx.stage,
4751
- region: input.region,
4752
- packageDir: input.packageDir ?? input.projectDir
4753
- });
4754
- yield* Effect27.logDebug("Setting up API Gateway...");
4755
- const { apiId } = yield* ensureProjectApi({
4756
- projectName: input.project,
4757
- stage: tagCtx.stage,
4758
- region: input.region,
4759
- tags: makeTags(tagCtx, "api-gateway")
4760
- });
4761
- const apiUrl = `https://${apiId}.execute-api.${input.region}.amazonaws.com`;
4762
- const results = [];
4763
- const activeRouteKeys = /* @__PURE__ */ new Set();
4764
- for (const fn13 of functions) {
4765
- const { exportName, functionArn, config, handlerName: fnName } = yield* deployLambda({
4766
- input,
4767
- fn: fn13,
4768
- ...layerArn ? { layerArn } : {},
4769
- ...external.length > 0 ? { external } : {}
4770
- });
4771
- const routeKey = `${config.method} ${config.path}`;
4772
- activeRouteKeys.add(routeKey);
4773
- const { apiUrl: handlerUrl } = yield* addRouteToApi({
4774
- apiId,
4775
- region: input.region,
4776
- functionArn,
4777
- method: config.method,
4778
- path: config.path
4779
- });
4780
- results.push({ exportName, url: handlerUrl, functionArn });
4781
- yield* Effect27.logDebug(` ${config.method} ${config.path} \u2192 ${fn13.exportName}`);
4782
- }
4783
- yield* removeStaleRoutes(apiId, activeRouteKeys);
4784
- yield* Effect27.logDebug(`Deployment complete! API: ${apiUrl}`);
4785
- return {
4786
- apiId,
4787
- apiUrl,
4788
- handlers: results
4789
- };
4790
- }).pipe(
4791
- Effect27.provide(
4792
- clients_exports.makeClients({
4793
- lambda: { region: input.region },
4794
- iam: { region: input.region },
4795
- apigatewayv2: { region: input.region }
4796
- })
4797
- )
4798
- );
4799
-
4800
4528
  // src/deploy/deploy-table.ts
4801
- import { Effect as Effect28 } from "effect";
4802
4529
  var TABLE_DEFAULT_PERMISSIONS = ["dynamodb:*", "logs:*"];
4803
- var deployTableFunction = ({ input, fn: fn13, layerArn, external, depsEnv, depsPermissions, staticGlobs }) => Effect28.gen(function* () {
4530
+ var deployTableFunction = ({ input, fn: fn13, layerArn, external, depsEnv, depsPermissions, staticGlobs }) => Effect27.gen(function* () {
4804
4531
  const { exportName, config } = fn13;
4805
4532
  const handlerName = exportName;
4806
4533
  const tagCtx = {
@@ -4808,7 +4535,7 @@ var deployTableFunction = ({ input, fn: fn13, layerArn, external, depsEnv, depsP
4808
4535
  stage: resolveStage(input.stage),
4809
4536
  handler: handlerName
4810
4537
  };
4811
- yield* Effect28.logDebug("Creating DynamoDB table...");
4538
+ yield* Effect27.logDebug("Creating DynamoDB table...");
4812
4539
  const tableName = `${input.project}-${tagCtx.stage}-${handlerName}`;
4813
4540
  const { tableArn, streamArn } = yield* ensureTable({
4814
4541
  name: tableName,
@@ -4832,7 +4559,7 @@ var deployTableFunction = ({ input, fn: fn13, layerArn, external, depsEnv, depsP
4832
4559
  ...depsPermissions ? { depsPermissions } : {},
4833
4560
  ...staticGlobs && staticGlobs.length > 0 ? { staticGlobs } : {}
4834
4561
  });
4835
- yield* Effect28.logDebug("Setting up event source mapping...");
4562
+ yield* Effect27.logDebug("Setting up event source mapping...");
4836
4563
  yield* ensureEventSourceMapping({
4837
4564
  functionArn,
4838
4565
  streamArn,
@@ -4840,7 +4567,7 @@ var deployTableFunction = ({ input, fn: fn13, layerArn, external, depsEnv, depsP
4840
4567
  batchWindow: config.batchWindow ?? 2,
4841
4568
  startingPosition: config.startingPosition ?? "LATEST"
4842
4569
  });
4843
- yield* Effect28.logDebug(`Table deployment complete! Table: ${tableArn}`);
4570
+ yield* Effect27.logDebug(`Table deployment complete! Table: ${tableArn}`);
4844
4571
  return {
4845
4572
  exportName,
4846
4573
  functionArn,
@@ -4849,11 +4576,11 @@ var deployTableFunction = ({ input, fn: fn13, layerArn, external, depsEnv, depsP
4849
4576
  streamArn
4850
4577
  };
4851
4578
  });
4852
- var deployTable = (input) => Effect28.gen(function* () {
4579
+ var deployTable = (input) => Effect27.gen(function* () {
4853
4580
  const source = yield* readSource(input);
4854
4581
  const configs = extractTableConfigs(source);
4855
4582
  if (configs.length === 0) {
4856
- return yield* Effect28.fail(new Error("No defineTable exports found in source"));
4583
+ return yield* Effect27.fail(new Error("No defineTable exports found in source"));
4857
4584
  }
4858
4585
  const targetExport = input.exportName ?? "default";
4859
4586
  const fn13 = configs.find((c2) => c2.exportName === targetExport) ?? configs[0];
@@ -4871,7 +4598,7 @@ var deployTable = (input) => Effect28.gen(function* () {
4871
4598
  });
4872
4599
  return result;
4873
4600
  }).pipe(
4874
- Effect28.provide(
4601
+ Effect27.provide(
4875
4602
  clients_exports.makeClients({
4876
4603
  lambda: { region: input.region },
4877
4604
  iam: { region: input.region },
@@ -4879,20 +4606,20 @@ var deployTable = (input) => Effect28.gen(function* () {
4879
4606
  })
4880
4607
  )
4881
4608
  );
4882
- var deployAllTables = (input) => Effect28.gen(function* () {
4609
+ var deployAllTables = (input) => Effect27.gen(function* () {
4883
4610
  const source = yield* readSource(input);
4884
4611
  const functions = extractTableConfigs(source);
4885
4612
  if (functions.length === 0) {
4886
- return yield* Effect28.fail(new Error("No defineTable exports found in source"));
4613
+ return yield* Effect27.fail(new Error("No defineTable exports found in source"));
4887
4614
  }
4888
- yield* Effect28.logDebug(`Found ${functions.length} table handler(s) to deploy`);
4615
+ yield* Effect27.logDebug(`Found ${functions.length} table handler(s) to deploy`);
4889
4616
  const { layerArn, external } = yield* ensureLayerAndExternal({
4890
4617
  project: input.project,
4891
4618
  stage: resolveStage(input.stage),
4892
4619
  region: input.region,
4893
4620
  packageDir: input.packageDir ?? input.projectDir
4894
4621
  });
4895
- const results = yield* Effect28.forEach(
4622
+ const results = yield* Effect27.forEach(
4896
4623
  functions,
4897
4624
  (fn13) => deployTableFunction({
4898
4625
  input,
@@ -4904,7 +4631,7 @@ var deployAllTables = (input) => Effect28.gen(function* () {
4904
4631
  );
4905
4632
  return results;
4906
4633
  }).pipe(
4907
- Effect28.provide(
4634
+ Effect27.provide(
4908
4635
  clients_exports.makeClients({
4909
4636
  lambda: { region: input.region },
4910
4637
  iam: { region: input.region },
@@ -4913,6 +4640,72 @@ var deployAllTables = (input) => Effect28.gen(function* () {
4913
4640
  )
4914
4641
  );
4915
4642
 
4643
+ // src/deploy/deploy-api.ts
4644
+ import { Effect as Effect28 } from "effect";
4645
+ var deployApiFunction = ({ input, fn: fn13, layerArn, external, depsEnv, depsPermissions, staticGlobs }) => Effect28.gen(function* () {
4646
+ const { exportName, config } = fn13;
4647
+ const handlerName = exportName;
4648
+ const { functionArn, status } = yield* deployCoreLambda({
4649
+ input,
4650
+ exportName,
4651
+ handlerName,
4652
+ bundleType: "api",
4653
+ ...config.permissions ? { permissions: config.permissions } : {},
4654
+ ...config.memory ? { memory: config.memory } : {},
4655
+ ...config.timeout ? { timeout: config.timeout } : {},
4656
+ ...layerArn ? { layerArn } : {},
4657
+ ...external ? { external } : {},
4658
+ ...depsEnv ? { depsEnv } : {},
4659
+ ...depsPermissions ? { depsPermissions } : {},
4660
+ ...staticGlobs && staticGlobs.length > 0 ? { staticGlobs } : {}
4661
+ });
4662
+ return { exportName, functionArn, status, config, handlerName };
4663
+ });
4664
+ var deploy = (input) => Effect28.gen(function* () {
4665
+ const source = yield* readSource(input);
4666
+ const configs = extractApiConfigs(source);
4667
+ if (configs.length === 0) {
4668
+ return yield* Effect28.fail(new Error("Could not extract defineApi config from source"));
4669
+ }
4670
+ const targetExport = input.exportName ?? "default";
4671
+ const fn13 = configs.find((c2) => c2.exportName === targetExport) ?? configs[0];
4672
+ const handlerName = fn13.exportName;
4673
+ const tagCtx = {
4674
+ project: input.project,
4675
+ stage: resolveStage(input.stage),
4676
+ handler: handlerName
4677
+ };
4678
+ yield* Effect28.logDebug(`Deploying API handler ${handlerName} to ${input.region}`);
4679
+ const { layerArn, external } = yield* ensureLayerAndExternal({
4680
+ project: input.project,
4681
+ stage: tagCtx.stage,
4682
+ region: input.region,
4683
+ packageDir: input.packageDir ?? input.projectDir
4684
+ });
4685
+ const { functionArn } = yield* deployApiFunction({
4686
+ input,
4687
+ fn: fn13,
4688
+ ...layerArn ? { layerArn } : {},
4689
+ ...external.length > 0 ? { external } : {}
4690
+ });
4691
+ const lambdaName = `${input.project}-${tagCtx.stage}-${handlerName}`;
4692
+ const { functionUrl } = yield* ensureFunctionUrl(lambdaName);
4693
+ yield* addFunctionUrlPublicAccess(lambdaName);
4694
+ yield* Effect28.logDebug(`Deployment complete! URL: ${functionUrl}`);
4695
+ return {
4696
+ exportName: fn13.exportName,
4697
+ url: functionUrl,
4698
+ functionArn
4699
+ };
4700
+ }).pipe(
4701
+ Effect28.provide(
4702
+ clients_exports.makeClients({
4703
+ lambda: { region: input.region },
4704
+ iam: { region: input.region }
4705
+ })
4706
+ )
4707
+ );
4708
+
4916
4709
  // src/deploy/deploy-app.ts
4917
4710
  import { Effect as Effect29 } from "effect";
4918
4711
  import { execSync } from "child_process";
@@ -4927,7 +4720,7 @@ var deployApp = (input) => Effect29.gen(function* () {
4927
4720
  if (routePatterns.length > 0 && !input.apiOriginDomain) {
4928
4721
  return yield* Effect29.fail(
4929
4722
  new Error(
4930
- `App "${exportName}" has routes but no API Gateway exists. Ensure defineHttp() or defineApi() handlers are included in the discovery patterns.`
4723
+ `App "${exportName}" has routes but no API handler was deployed. Ensure defineApi() handlers are included in the discovery patterns.`
4931
4724
  )
4932
4725
  );
4933
4726
  }
@@ -5119,7 +4912,7 @@ var deployStaticSite = (input) => Effect30.gen(function* () {
5119
4912
  if (routePatterns.length > 0 && !input.apiOriginDomain) {
5120
4913
  return yield* Effect30.fail(
5121
4914
  new Error(
5122
- `Static site "${exportName}" has routes but no API Gateway exists. Ensure defineHttp() handlers are included in the discovery patterns.`
4915
+ `Static site "${exportName}" has routes but no API handler was deployed. Ensure defineApi() handlers are included in the discovery patterns.`
5123
4916
  )
5124
4917
  );
5125
4918
  }
@@ -5397,28 +5190,6 @@ var deployMailer = ({ project, stage, region, fn: fn13 }) => Effect33.gen(functi
5397
5190
  };
5398
5191
  });
5399
5192
 
5400
- // src/deploy/deploy-api.ts
5401
- import { Effect as Effect34 } from "effect";
5402
- var deployApiFunction = ({ input, fn: fn13, layerArn, external, depsEnv, depsPermissions, staticGlobs }) => Effect34.gen(function* () {
5403
- const { exportName, config } = fn13;
5404
- const handlerName = exportName;
5405
- const { functionArn, status } = yield* deployCoreLambda({
5406
- input,
5407
- exportName,
5408
- handlerName,
5409
- bundleType: "api",
5410
- ...config.permissions ? { permissions: config.permissions } : {},
5411
- ...config.memory ? { memory: config.memory } : {},
5412
- ...config.timeout ? { timeout: config.timeout } : {},
5413
- ...layerArn ? { layerArn } : {},
5414
- ...external ? { external } : {},
5415
- ...depsEnv ? { depsEnv } : {},
5416
- ...depsPermissions ? { depsPermissions } : {},
5417
- ...staticGlobs && staticGlobs.length > 0 ? { staticGlobs } : {}
5418
- });
5419
- return { exportName, functionArn, status, config, handlerName };
5420
- });
5421
-
5422
5193
  // src/deploy/deploy.ts
5423
5194
  var statusLabel = (status) => {
5424
5195
  switch (status) {
@@ -5460,7 +5231,7 @@ var createLiveProgress = (manifest) => {
5460
5231
  const sec = ((Date.now() - startTime) / 1e3).toFixed(1);
5461
5232
  return c.dim(`${sec}s`);
5462
5233
  };
5463
- return (name, type, status) => Effect35.sync(() => {
5234
+ return (name, type, status) => Effect34.sync(() => {
5464
5235
  const key = `${name}:${type}`;
5465
5236
  results.set(key, status);
5466
5237
  const line = ` ${name} ${c.dim(`(${type})`)} ${statusLabel(status)} ${formatDuration()}`;
@@ -5478,27 +5249,27 @@ var createLiveProgress = (manifest) => {
5478
5249
  });
5479
5250
  };
5480
5251
  var DEPLOY_CONCURRENCY = 5;
5481
- var prepareLayer = (input) => Effect35.gen(function* () {
5252
+ var prepareLayer = (input) => Effect34.gen(function* () {
5482
5253
  const layerResult = yield* ensureLayer({
5483
5254
  project: input.project,
5484
5255
  stage: input.stage,
5485
5256
  region: input.region,
5486
5257
  projectDir: input.packageDir
5487
5258
  }).pipe(
5488
- Effect35.provide(
5259
+ Effect34.provide(
5489
5260
  clients_exports.makeClients({
5490
5261
  lambda: { region: input.region }
5491
5262
  })
5492
5263
  )
5493
5264
  );
5494
5265
  const prodDeps = layerResult ? yield* readProductionDependencies(input.packageDir) : [];
5495
- const { packages: external, warnings: layerWarnings } = prodDeps.length > 0 ? yield* Effect35.sync(() => collectLayerPackages(input.packageDir, prodDeps)) : { packages: [], warnings: [] };
5266
+ const { packages: external, warnings: layerWarnings } = prodDeps.length > 0 ? yield* Effect34.sync(() => collectLayerPackages(input.packageDir, prodDeps)) : { packages: [], warnings: [] };
5496
5267
  for (const warning of layerWarnings) {
5497
- yield* Effect35.logWarning(`[layer] ${warning}`);
5268
+ yield* Effect34.logWarning(`[layer] ${warning}`);
5498
5269
  }
5499
- yield* Effect35.logDebug(`Layer result: ${layerResult ? "exists" : "null"}, external packages: ${external.length}`);
5270
+ yield* Effect34.logDebug(`Layer result: ${layerResult ? "exists" : "null"}, external packages: ${external.length}`);
5500
5271
  if (external.length > 0) {
5501
- yield* Effect35.logDebug(`Bundling with ${external.length} external packages from layer`);
5272
+ yield* Effect34.logDebug(`Bundling with ${external.length} external packages from layer`);
5502
5273
  }
5503
5274
  return {
5504
5275
  layerArn: layerResult?.layerVersionArn,
@@ -5559,7 +5330,6 @@ var buildBucketNameMap = (bucketHandlers, project, stage) => {
5559
5330
  var validateDeps = (discovered, tableNameMap, bucketNameMap, mailerDomainMap) => {
5560
5331
  const errors = [];
5561
5332
  const allGroups = [
5562
- ...discovered.httpHandlers,
5563
5333
  ...discovered.apiHandlers,
5564
5334
  ...discovered.tableHandlers,
5565
5335
  ...discovered.fifoQueueHandlers,
@@ -5649,45 +5419,13 @@ var resolveHandlerEnv = (depsKeys, paramEntries, ctx) => {
5649
5419
  depsPermissions: resolved?.depsPermissions ?? []
5650
5420
  };
5651
5421
  };
5652
- var buildHttpTasks = (ctx, handlers, apiId, results) => {
5653
- const tasks = [];
5654
- const { region } = ctx.input;
5655
- for (const { file, exports } of handlers) {
5656
- for (const fn13 of exports) {
5657
- tasks.push(
5658
- Effect35.gen(function* () {
5659
- const env = resolveHandlerEnv(fn13.depsKeys, fn13.paramEntries, ctx);
5660
- const { exportName, functionArn, status, config, handlerName } = yield* deployLambda({
5661
- input: makeDeployInput(ctx, file),
5662
- fn: fn13,
5663
- ...ctx.layerArn ? { layerArn: ctx.layerArn } : {},
5664
- ...ctx.external.length > 0 ? { external: ctx.external } : {},
5665
- depsEnv: env.depsEnv,
5666
- depsPermissions: env.depsPermissions,
5667
- ...fn13.staticGlobs.length > 0 ? { staticGlobs: fn13.staticGlobs } : {}
5668
- }).pipe(Effect35.provide(clients_exports.makeClients({ lambda: { region }, iam: { region } })));
5669
- const { apiUrl: handlerUrl } = yield* addRouteToApi({
5670
- apiId,
5671
- region,
5672
- functionArn,
5673
- method: config.method,
5674
- path: config.path
5675
- }).pipe(Effect35.provide(clients_exports.makeClients({ lambda: { region }, apigatewayv2: { region } })));
5676
- results.push({ exportName, url: handlerUrl, functionArn });
5677
- yield* ctx.logComplete(exportName, "http", status);
5678
- })
5679
- );
5680
- }
5681
- }
5682
- return tasks;
5683
- };
5684
5422
  var buildTableTasks = (ctx, handlers, results) => {
5685
5423
  const tasks = [];
5686
5424
  const { region } = ctx.input;
5687
5425
  for (const { file, exports } of handlers) {
5688
5426
  for (const fn13 of exports) {
5689
5427
  tasks.push(
5690
- Effect35.gen(function* () {
5428
+ Effect34.gen(function* () {
5691
5429
  const env = resolveHandlerEnv(fn13.depsKeys, fn13.paramEntries, ctx);
5692
5430
  const result = yield* deployTableFunction({
5693
5431
  input: makeDeployInput(ctx, file),
@@ -5697,7 +5435,7 @@ var buildTableTasks = (ctx, handlers, results) => {
5697
5435
  depsEnv: env.depsEnv,
5698
5436
  depsPermissions: env.depsPermissions,
5699
5437
  ...fn13.staticGlobs.length > 0 ? { staticGlobs: fn13.staticGlobs } : {}
5700
- }).pipe(Effect35.provide(clients_exports.makeClients({ lambda: { region }, iam: { region }, dynamodb: { region } })));
5438
+ }).pipe(Effect34.provide(clients_exports.makeClients({ lambda: { region }, iam: { region }, dynamodb: { region } })));
5701
5439
  results.push(result);
5702
5440
  yield* ctx.logComplete(fn13.exportName, "table", result.status);
5703
5441
  })
@@ -5706,14 +5444,13 @@ var buildTableTasks = (ctx, handlers, results) => {
5706
5444
  }
5707
5445
  return tasks;
5708
5446
  };
5709
- var buildAppTasks = (ctx, handlers, results, apiId) => {
5447
+ var buildAppTasks = (ctx, handlers, results, apiOriginDomain) => {
5710
5448
  const tasks = [];
5711
5449
  const { region } = ctx.input;
5712
- const apiOriginDomain = apiId ? `${apiId}.execute-api.${region}.amazonaws.com` : void 0;
5713
5450
  for (const { exports } of handlers) {
5714
5451
  for (const fn13 of exports) {
5715
5452
  tasks.push(
5716
- Effect35.gen(function* () {
5453
+ Effect34.gen(function* () {
5717
5454
  const result = yield* deployApp({
5718
5455
  projectDir: ctx.input.projectDir,
5719
5456
  project: ctx.input.project,
@@ -5722,7 +5459,7 @@ var buildAppTasks = (ctx, handlers, results, apiId) => {
5722
5459
  fn: fn13,
5723
5460
  verbose: ctx.input.verbose,
5724
5461
  ...apiOriginDomain ? { apiOriginDomain } : {}
5725
- }).pipe(Effect35.provide(clients_exports.makeClients({
5462
+ }).pipe(Effect34.provide(clients_exports.makeClients({
5726
5463
  lambda: { region },
5727
5464
  iam: { region },
5728
5465
  s3: { region },
@@ -5738,14 +5475,13 @@ var buildAppTasks = (ctx, handlers, results, apiId) => {
5738
5475
  }
5739
5476
  return tasks;
5740
5477
  };
5741
- var buildStaticSiteTasks = (ctx, handlers, results, apiId) => {
5478
+ var buildStaticSiteTasks = (ctx, handlers, results, apiOriginDomain) => {
5742
5479
  const tasks = [];
5743
5480
  const { region } = ctx.input;
5744
- const apiOriginDomain = apiId ? `${apiId}.execute-api.${region}.amazonaws.com` : void 0;
5745
5481
  for (const { file, exports } of handlers) {
5746
5482
  for (const fn13 of exports) {
5747
5483
  tasks.push(
5748
- Effect35.gen(function* () {
5484
+ Effect34.gen(function* () {
5749
5485
  const result = yield* deployStaticSite({
5750
5486
  projectDir: ctx.input.projectDir,
5751
5487
  project: ctx.input.project,
@@ -5755,7 +5491,7 @@ var buildStaticSiteTasks = (ctx, handlers, results, apiId) => {
5755
5491
  verbose: ctx.input.verbose,
5756
5492
  ...fn13.hasHandler ? { file } : {},
5757
5493
  ...apiOriginDomain ? { apiOriginDomain } : {}
5758
- }).pipe(Effect35.provide(clients_exports.makeClients({
5494
+ }).pipe(Effect34.provide(clients_exports.makeClients({
5759
5495
  s3: { region },
5760
5496
  cloudfront: { region: "us-east-1" },
5761
5497
  resource_groups_tagging_api: { region: "us-east-1" },
@@ -5775,7 +5511,7 @@ var buildFifoQueueTasks = (ctx, handlers, results) => {
5775
5511
  for (const { file, exports } of handlers) {
5776
5512
  for (const fn13 of exports) {
5777
5513
  tasks.push(
5778
- Effect35.gen(function* () {
5514
+ Effect34.gen(function* () {
5779
5515
  const env = resolveHandlerEnv(fn13.depsKeys, fn13.paramEntries, ctx);
5780
5516
  const result = yield* deployFifoQueueFunction({
5781
5517
  input: makeDeployInput(ctx, file),
@@ -5785,7 +5521,7 @@ var buildFifoQueueTasks = (ctx, handlers, results) => {
5785
5521
  depsEnv: env.depsEnv,
5786
5522
  depsPermissions: env.depsPermissions,
5787
5523
  ...fn13.staticGlobs.length > 0 ? { staticGlobs: fn13.staticGlobs } : {}
5788
- }).pipe(Effect35.provide(clients_exports.makeClients({ lambda: { region }, iam: { region }, sqs: { region } })));
5524
+ }).pipe(Effect34.provide(clients_exports.makeClients({ lambda: { region }, iam: { region }, sqs: { region } })));
5789
5525
  results.push(result);
5790
5526
  yield* ctx.logComplete(fn13.exportName, "queue", result.status);
5791
5527
  })
@@ -5800,7 +5536,7 @@ var buildBucketTasks = (ctx, handlers, results) => {
5800
5536
  for (const { file, exports } of handlers) {
5801
5537
  for (const fn13 of exports) {
5802
5538
  tasks.push(
5803
- Effect35.gen(function* () {
5539
+ Effect34.gen(function* () {
5804
5540
  const env = resolveHandlerEnv(fn13.depsKeys, fn13.paramEntries, ctx);
5805
5541
  const result = yield* deployBucketFunction({
5806
5542
  input: makeDeployInput(ctx, file),
@@ -5810,7 +5546,7 @@ var buildBucketTasks = (ctx, handlers, results) => {
5810
5546
  depsEnv: env.depsEnv,
5811
5547
  depsPermissions: env.depsPermissions,
5812
5548
  ...fn13.staticGlobs.length > 0 ? { staticGlobs: fn13.staticGlobs } : {}
5813
- }).pipe(Effect35.provide(clients_exports.makeClients({ lambda: { region }, iam: { region }, s3: { region } })));
5549
+ }).pipe(Effect34.provide(clients_exports.makeClients({ lambda: { region }, iam: { region }, s3: { region } })));
5814
5550
  results.push(result);
5815
5551
  const status = result.status === "resource-only" ? "created" : result.status;
5816
5552
  yield* ctx.logComplete(fn13.exportName, "bucket", status);
@@ -5826,13 +5562,13 @@ var buildMailerTasks = (ctx, handlers, results) => {
5826
5562
  for (const { exports } of handlers) {
5827
5563
  for (const fn13 of exports) {
5828
5564
  tasks.push(
5829
- Effect35.gen(function* () {
5565
+ Effect34.gen(function* () {
5830
5566
  const result = yield* deployMailer({
5831
5567
  project: ctx.input.project,
5832
5568
  stage: ctx.input.stage,
5833
5569
  region,
5834
5570
  fn: fn13
5835
- }).pipe(Effect35.provide(clients_exports.makeClients({ sesv2: { region } })));
5571
+ }).pipe(Effect34.provide(clients_exports.makeClients({ sesv2: { region } })));
5836
5572
  results.push(result);
5837
5573
  yield* ctx.logComplete(fn13.exportName, "mailer", result.verified ? "unchanged" : "created");
5838
5574
  })
@@ -5841,15 +5577,15 @@ var buildMailerTasks = (ctx, handlers, results) => {
5841
5577
  }
5842
5578
  return tasks;
5843
5579
  };
5844
- var buildApiTasks = (ctx, handlers, apiId, results) => {
5580
+ var buildApiTasks = (ctx, handlers, results) => {
5845
5581
  const tasks = [];
5846
5582
  const { region } = ctx.input;
5847
5583
  for (const { file, exports } of handlers) {
5848
5584
  for (const fn13 of exports) {
5849
5585
  tasks.push(
5850
- Effect35.gen(function* () {
5586
+ Effect34.gen(function* () {
5851
5587
  const env = resolveHandlerEnv(fn13.depsKeys, fn13.paramEntries, ctx);
5852
- const { exportName, functionArn, status, config } = yield* deployApiFunction({
5588
+ const { exportName, functionArn, status, handlerName } = yield* deployApiFunction({
5853
5589
  input: makeDeployInput(ctx, file),
5854
5590
  fn: fn13,
5855
5591
  ...ctx.layerArn ? { layerArn: ctx.layerArn } : {},
@@ -5857,22 +5593,15 @@ var buildApiTasks = (ctx, handlers, apiId, results) => {
5857
5593
  depsEnv: env.depsEnv,
5858
5594
  depsPermissions: env.depsPermissions,
5859
5595
  ...fn13.staticGlobs.length > 0 ? { staticGlobs: fn13.staticGlobs } : {}
5860
- }).pipe(Effect35.provide(clients_exports.makeClients({ lambda: { region }, iam: { region } })));
5861
- yield* addRouteToApi({
5862
- apiId,
5863
- region,
5864
- functionArn,
5865
- method: "ANY",
5866
- path: config.basePath
5867
- }).pipe(Effect35.provide(clients_exports.makeClients({ lambda: { region }, apigatewayv2: { region } })));
5868
- const { apiUrl: handlerUrl } = yield* addRouteToApi({
5869
- apiId,
5870
- region,
5871
- functionArn,
5872
- method: "ANY",
5873
- path: `${config.basePath}/{proxy+}`
5874
- }).pipe(Effect35.provide(clients_exports.makeClients({ lambda: { region }, apigatewayv2: { region } })));
5875
- results.push({ exportName, url: handlerUrl, functionArn });
5596
+ }).pipe(Effect34.provide(clients_exports.makeClients({ lambda: { region }, iam: { region } })));
5597
+ const lambdaName = `${ctx.input.project}-${ctx.stage}-${handlerName}`;
5598
+ const { functionUrl } = yield* ensureFunctionUrl(lambdaName).pipe(
5599
+ Effect34.provide(clients_exports.makeClients({ lambda: { region } }))
5600
+ );
5601
+ yield* addFunctionUrlPublicAccess(lambdaName).pipe(
5602
+ Effect34.provide(clients_exports.makeClients({ lambda: { region } }))
5603
+ );
5604
+ results.push({ exportName, url: functionUrl, functionArn });
5876
5605
  yield* ctx.logComplete(exportName, "api", status);
5877
5606
  })
5878
5607
  );
@@ -5880,15 +5609,14 @@ var buildApiTasks = (ctx, handlers, apiId, results) => {
5880
5609
  }
5881
5610
  return tasks;
5882
5611
  };
5883
- var deployProject = (input) => Effect35.gen(function* () {
5612
+ var deployProject = (input) => Effect34.gen(function* () {
5884
5613
  const stage = resolveStage(input.stage);
5885
5614
  const files = findHandlerFiles(input.patterns, input.projectDir);
5886
5615
  if (files.length === 0) {
5887
- return yield* Effect35.fail(new Error(`No files match patterns: ${input.patterns.join(", ")}`));
5616
+ return yield* Effect34.fail(new Error(`No files match patterns: ${input.patterns.join(", ")}`));
5888
5617
  }
5889
- yield* Effect35.logDebug(`Found ${files.length} file(s) matching patterns`);
5890
- const { httpHandlers, tableHandlers, appHandlers, staticSiteHandlers, fifoQueueHandlers, bucketHandlers, mailerHandlers, apiHandlers } = discoverHandlers(files);
5891
- const totalHttpHandlers = httpHandlers.reduce((acc, h) => acc + h.exports.length, 0);
5618
+ yield* Effect34.logDebug(`Found ${files.length} file(s) matching patterns`);
5619
+ const { tableHandlers, appHandlers, staticSiteHandlers, fifoQueueHandlers, bucketHandlers, mailerHandlers, apiHandlers } = discoverHandlers(files);
5892
5620
  const totalTableHandlers = tableHandlers.reduce((acc, h) => acc + h.exports.length, 0);
5893
5621
  const totalAppHandlers = appHandlers.reduce((acc, h) => acc + h.exports.length, 0);
5894
5622
  const totalStaticSiteHandlers = input.noSites ? 0 : staticSiteHandlers.reduce((acc, h) => acc + h.exports.length, 0);
@@ -5896,12 +5624,11 @@ var deployProject = (input) => Effect35.gen(function* () {
5896
5624
  const totalBucketHandlers = bucketHandlers.reduce((acc, h) => acc + h.exports.length, 0);
5897
5625
  const totalMailerHandlers = mailerHandlers.reduce((acc, h) => acc + h.exports.length, 0);
5898
5626
  const totalApiHandlers = apiHandlers.reduce((acc, h) => acc + h.exports.length, 0);
5899
- const totalAllHandlers = totalHttpHandlers + totalTableHandlers + totalAppHandlers + totalStaticSiteHandlers + totalFifoQueueHandlers + totalBucketHandlers + totalMailerHandlers + totalApiHandlers;
5627
+ const totalAllHandlers = totalTableHandlers + totalAppHandlers + totalStaticSiteHandlers + totalFifoQueueHandlers + totalBucketHandlers + totalMailerHandlers + totalApiHandlers;
5900
5628
  if (totalAllHandlers === 0) {
5901
- return yield* Effect35.fail(new Error("No handlers found in matched files"));
5629
+ return yield* Effect34.fail(new Error("No handlers found in matched files"));
5902
5630
  }
5903
5631
  const parts = [];
5904
- if (totalHttpHandlers > 0) parts.push(`${totalHttpHandlers} http`);
5905
5632
  if (totalTableHandlers > 0) parts.push(`${totalTableHandlers} table`);
5906
5633
  if (totalAppHandlers > 0) parts.push(`${totalAppHandlers} app`);
5907
5634
  if (totalStaticSiteHandlers > 0) parts.push(`${totalStaticSiteHandlers} site`);
@@ -5911,11 +5638,11 @@ var deployProject = (input) => Effect35.gen(function* () {
5911
5638
  if (totalApiHandlers > 0) parts.push(`${totalApiHandlers} api`);
5912
5639
  yield* Console2.log(`
5913
5640
  ${c.dim("Handlers:")} ${parts.join(", ")}`);
5914
- const discovered = { httpHandlers, tableHandlers, appHandlers, staticSiteHandlers, fifoQueueHandlers, bucketHandlers, mailerHandlers, apiHandlers };
5641
+ const discovered = { tableHandlers, appHandlers, staticSiteHandlers, fifoQueueHandlers, bucketHandlers, mailerHandlers, apiHandlers };
5915
5642
  const requiredParams = collectRequiredParams(discovered, input.project, stage);
5916
5643
  if (requiredParams.length > 0) {
5917
5644
  const { missing } = yield* checkMissingParams(requiredParams).pipe(
5918
- Effect35.provide(clients_exports.makeClients({ ssm: { region: input.region } }))
5645
+ Effect34.provide(clients_exports.makeClients({ ssm: { region: input.region } }))
5919
5646
  );
5920
5647
  if (missing.length > 0) {
5921
5648
  yield* Console2.log(`
@@ -5937,7 +5664,7 @@ var deployProject = (input) => Effect35.gen(function* () {
5937
5664
  for (const err of depsErrors) {
5938
5665
  yield* Console2.log(` ${c.red("\u2717")} ${err}`);
5939
5666
  }
5940
- return yield* Effect35.fail(new Error("Unresolved deps \u2014 aborting deploy"));
5667
+ return yield* Effect34.fail(new Error("Unresolved deps \u2014 aborting deploy"));
5941
5668
  }
5942
5669
  const { layerArn, layerVersion, layerStatus, external } = yield* prepareLayer({
5943
5670
  project: input.project,
@@ -5949,40 +5676,8 @@ var deployProject = (input) => Effect35.gen(function* () {
5949
5676
  const status = layerStatus === "cached" ? c.dim("cached") : c.green("created");
5950
5677
  yield* Console2.log(` ${c.dim("Layer:")} ${status} ${c.dim(`v${layerVersion}`)} (${external.length} packages)`);
5951
5678
  }
5952
- let apiId;
5953
- let apiUrl;
5954
- const staticSitesNeedApi = !input.noSites && staticSiteHandlers.some(
5955
- ({ exports }) => exports.some((fn13) => fn13.routePatterns.length > 0)
5956
- );
5957
- const appsNeedApi = appHandlers.some(
5958
- ({ exports }) => exports.some((fn13) => fn13.routePatterns.length > 0)
5959
- );
5960
- if (totalHttpHandlers > 0 || totalApiHandlers > 0 || staticSitesNeedApi || appsNeedApi) {
5961
- const tagCtx = {
5962
- project: input.project,
5963
- stage,
5964
- handler: "api"
5965
- };
5966
- const api = yield* ensureProjectApi({
5967
- projectName: input.project,
5968
- stage: tagCtx.stage,
5969
- region: input.region,
5970
- tags: makeTags(tagCtx, "api-gateway")
5971
- }).pipe(
5972
- Effect35.provide(
5973
- clients_exports.makeClients({
5974
- apigatewayv2: { region: input.region }
5975
- })
5976
- )
5977
- );
5978
- apiId = api.apiId;
5979
- apiUrl = `https://${apiId}.execute-api.${input.region}.amazonaws.com`;
5980
- yield* Console2.log(` ${c.dim("API Gateway:")} ${apiId}`);
5981
- }
5982
5679
  yield* Console2.log("");
5983
5680
  const manifest = [];
5984
- for (const { exports } of httpHandlers)
5985
- for (const fn13 of exports) manifest.push({ name: fn13.exportName, type: "http" });
5986
5681
  for (const { exports } of tableHandlers)
5987
5682
  for (const fn13 of exports) manifest.push({ name: fn13.exportName, type: "table" });
5988
5683
  for (const { exports } of appHandlers)
@@ -6011,7 +5706,6 @@ var deployProject = (input) => Effect35.gen(function* () {
6011
5706
  mailerDomainMap,
6012
5707
  logComplete
6013
5708
  };
6014
- const httpResults = [];
6015
5709
  const tableResults = [];
6016
5710
  const appResults = [];
6017
5711
  const staticSiteResults = [];
@@ -6019,53 +5713,55 @@ var deployProject = (input) => Effect35.gen(function* () {
6019
5713
  const bucketResults = [];
6020
5714
  const mailerResults = [];
6021
5715
  const apiResults = [];
6022
- const tasks = [
6023
- ...apiId ? buildHttpTasks(ctx, httpHandlers, apiId, httpResults) : [],
6024
- ...buildTableTasks(ctx, tableHandlers, tableResults),
6025
- ...buildAppTasks(ctx, appHandlers, appResults, apiId),
6026
- ...input.noSites ? [] : buildStaticSiteTasks(ctx, staticSiteHandlers, staticSiteResults, apiId),
6027
- ...buildFifoQueueTasks(ctx, fifoQueueHandlers, fifoQueueResults),
6028
- ...buildBucketTasks(ctx, bucketHandlers, bucketResults),
6029
- ...buildMailerTasks(ctx, mailerHandlers, mailerResults),
6030
- ...apiId ? buildApiTasks(ctx, apiHandlers, apiId, apiResults) : []
6031
- ];
6032
- yield* Effect35.all(tasks, { concurrency: DEPLOY_CONCURRENCY, discard: true });
5716
+ const staticSitesNeedApi = !input.noSites && staticSiteHandlers.some(
5717
+ ({ exports }) => exports.some((fn13) => fn13.routePatterns.length > 0)
5718
+ );
5719
+ const appsNeedApi = appHandlers.some(
5720
+ ({ exports }) => exports.some((fn13) => fn13.routePatterns.length > 0)
5721
+ );
5722
+ const needsTwoPhase = (staticSitesNeedApi || appsNeedApi) && totalApiHandlers > 0;
5723
+ if (needsTwoPhase) {
5724
+ const phase1Tasks = [
5725
+ ...buildApiTasks(ctx, apiHandlers, apiResults),
5726
+ ...buildTableTasks(ctx, tableHandlers, tableResults),
5727
+ ...buildFifoQueueTasks(ctx, fifoQueueHandlers, fifoQueueResults),
5728
+ ...buildBucketTasks(ctx, bucketHandlers, bucketResults),
5729
+ ...buildMailerTasks(ctx, mailerHandlers, mailerResults)
5730
+ ];
5731
+ yield* Effect34.all(phase1Tasks, { concurrency: DEPLOY_CONCURRENCY, discard: true });
5732
+ const firstApiUrl = apiResults[0]?.url;
5733
+ const apiOriginDomain = firstApiUrl ? firstApiUrl.replace("https://", "").replace(/\/$/, "") : void 0;
5734
+ const phase2Tasks = [
5735
+ ...buildAppTasks(ctx, appHandlers, appResults, apiOriginDomain),
5736
+ ...input.noSites ? [] : buildStaticSiteTasks(ctx, staticSiteHandlers, staticSiteResults, apiOriginDomain)
5737
+ ];
5738
+ if (phase2Tasks.length > 0) {
5739
+ yield* Effect34.all(phase2Tasks, { concurrency: DEPLOY_CONCURRENCY, discard: true });
5740
+ }
5741
+ } else {
5742
+ const tasks = [
5743
+ ...buildApiTasks(ctx, apiHandlers, apiResults),
5744
+ ...buildTableTasks(ctx, tableHandlers, tableResults),
5745
+ ...buildAppTasks(ctx, appHandlers, appResults),
5746
+ ...input.noSites ? [] : buildStaticSiteTasks(ctx, staticSiteHandlers, staticSiteResults),
5747
+ ...buildFifoQueueTasks(ctx, fifoQueueHandlers, fifoQueueResults),
5748
+ ...buildBucketTasks(ctx, bucketHandlers, bucketResults),
5749
+ ...buildMailerTasks(ctx, mailerHandlers, mailerResults)
5750
+ ];
5751
+ yield* Effect34.all(tasks, { concurrency: DEPLOY_CONCURRENCY, discard: true });
5752
+ }
6033
5753
  if (!input.noSites && staticSiteResults.length > 0 || appResults.length > 0) {
6034
5754
  yield* cleanupOrphanedFunctions(input.project, stage).pipe(
6035
- Effect35.provide(clients_exports.makeClients({
5755
+ Effect34.provide(clients_exports.makeClients({
6036
5756
  cloudfront: { region: "us-east-1" },
6037
5757
  resource_groups_tagging_api: { region: "us-east-1" }
6038
5758
  })),
6039
- Effect35.catchAll(
6040
- (error) => Effect35.logDebug(`CloudFront Function cleanup failed (non-fatal): ${error}`)
6041
- )
6042
- );
6043
- }
6044
- if (apiId) {
6045
- const activeRouteKeys = /* @__PURE__ */ new Set();
6046
- for (const { exports } of httpHandlers) {
6047
- for (const fn13 of exports) {
6048
- activeRouteKeys.add(`${fn13.config.method} ${fn13.config.path}`);
6049
- }
6050
- }
6051
- for (const { exports } of apiHandlers) {
6052
- for (const fn13 of exports) {
6053
- activeRouteKeys.add(`ANY ${fn13.config.basePath}`);
6054
- activeRouteKeys.add(`ANY ${fn13.config.basePath}/{proxy+}`);
6055
- }
6056
- }
6057
- yield* removeStaleRoutes(apiId, activeRouteKeys).pipe(
6058
- Effect35.provide(
6059
- clients_exports.makeClients({
6060
- apigatewayv2: { region: input.region }
6061
- })
5759
+ Effect34.catchAll(
5760
+ (error) => Effect34.logDebug(`CloudFront Function cleanup failed (non-fatal): ${error}`)
6062
5761
  )
6063
5762
  );
6064
5763
  }
6065
- if (apiUrl) {
6066
- yield* Effect35.logDebug(`Deployment complete! API: ${apiUrl}`);
6067
- }
6068
- return { apiId, apiUrl, httpResults, tableResults, appResults, staticSiteResults, fifoQueueResults, bucketResults, mailerResults, apiResults };
5764
+ return { tableResults, appResults, staticSiteResults, fifoQueueResults, bucketResults, mailerResults, apiResults };
6069
5765
  });
6070
5766
 
6071
5767
  // src/cli/config.ts
@@ -6074,13 +5770,13 @@ import * as path7 from "path";
6074
5770
  import * as fs4 from "fs";
6075
5771
  import { pathToFileURL } from "url";
6076
5772
  import * as esbuild2 from "esbuild";
6077
- import { Effect as Effect36 } from "effect";
6078
- var loadConfig = Effect36.fn("loadConfig")(function* () {
5773
+ import { Effect as Effect35 } from "effect";
5774
+ var loadConfig = Effect35.fn("loadConfig")(function* () {
6079
5775
  const configPath = path7.resolve(process.cwd(), "effortless.config.ts");
6080
5776
  if (!fs4.existsSync(configPath)) {
6081
5777
  return null;
6082
5778
  }
6083
- const result = yield* Effect36.tryPromise({
5779
+ const result = yield* Effect35.tryPromise({
6084
5780
  try: () => esbuild2.build({
6085
5781
  entryPoints: [configPath],
6086
5782
  bundle: true,
@@ -6098,10 +5794,10 @@ var loadConfig = Effect36.fn("loadConfig")(function* () {
6098
5794
  const code = output.text;
6099
5795
  const tempFile = path7.join(process.cwd(), ".effortless-config.mjs");
6100
5796
  fs4.writeFileSync(tempFile, code);
6101
- const mod = yield* Effect36.tryPromise({
5797
+ const mod = yield* Effect35.tryPromise({
6102
5798
  try: () => import(pathToFileURL(tempFile).href),
6103
5799
  catch: (error) => new Error(`Failed to load config: ${error}`)
6104
- }).pipe(Effect36.ensuring(Effect36.sync(() => fs4.unlinkSync(tempFile))));
5800
+ }).pipe(Effect35.ensuring(Effect35.sync(() => fs4.unlinkSync(tempFile))));
6105
5801
  return mod.default;
6106
5802
  });
6107
5803
  var projectOption = Options.text("project").pipe(
@@ -6152,12 +5848,12 @@ var getPatternsFromConfig = (config) => {
6152
5848
  // src/cli/project-config.ts
6153
5849
  import * as Context13 from "effect/Context";
6154
5850
  import * as Layer14 from "effect/Layer";
6155
- import * as Effect37 from "effect/Effect";
5851
+ import * as Effect36 from "effect/Effect";
6156
5852
  import * as path8 from "path";
6157
5853
  var ProjectConfig = class _ProjectConfig extends Context13.Tag("ProjectConfig")() {
6158
5854
  static Live = Layer14.effect(
6159
5855
  _ProjectConfig,
6160
- Effect37.gen(function* () {
5856
+ Effect36.gen(function* () {
6161
5857
  const config = yield* loadConfig();
6162
5858
  const cwd = process.cwd();
6163
5859
  const projectDir = config?.root ? path8.resolve(cwd, config.root) : cwd;
@@ -6177,7 +5873,7 @@ var isFilePath = (target) => {
6177
5873
  var deployCommand = Command.make(
6178
5874
  "deploy",
6179
5875
  { target: deployTargetArg, project: projectOption, stage: stageOption, region: regionOption, verbose: verboseOption, noSites: noSitesOption },
6180
- ({ target, project: projectOpt, stage, region, verbose, noSites }) => Effect38.gen(function* () {
5876
+ ({ target, project: projectOpt, stage, region, verbose, noSites }) => Effect37.gen(function* () {
6181
5877
  const { config, cwd, projectDir } = yield* ProjectConfig;
6182
5878
  const project = Option.getOrElse(projectOpt, () => config?.name ?? "");
6183
5879
  const finalStage = config?.stage ?? stage;
@@ -6189,7 +5885,6 @@ var deployCommand = Command.make(
6189
5885
  const clientsLayer = clients_exports.makeClients({
6190
5886
  lambda: { region: finalRegion },
6191
5887
  iam: { region: finalRegion },
6192
- apigatewayv2: { region: finalRegion },
6193
5888
  dynamodb: { region: finalRegion },
6194
5889
  resource_groups_tagging_api: { region: finalRegion },
6195
5890
  s3: { region: finalRegion },
@@ -6198,7 +5893,7 @@ var deployCommand = Command.make(
6198
5893
  });
6199
5894
  const logLevel = verbose ? LogLevel.Debug : LogLevel.Warning;
6200
5895
  yield* Option.match(target, {
6201
- onNone: () => Effect38.gen(function* () {
5896
+ onNone: () => Effect37.gen(function* () {
6202
5897
  const patterns = getPatternsFromConfig(config);
6203
5898
  if (!patterns) {
6204
5899
  yield* Console3.error("Error: No target specified and no 'handlers' patterns in config");
@@ -6214,28 +5909,18 @@ var deployCommand = Command.make(
6214
5909
  noSites,
6215
5910
  verbose
6216
5911
  });
6217
- const total = results.httpResults.length + results.tableResults.length + results.appResults.length + results.staticSiteResults.length + results.apiResults.length;
5912
+ const total = results.tableResults.length + results.appResults.length + results.staticSiteResults.length + results.apiResults.length;
6218
5913
  yield* Console3.log(`
6219
5914
  ${c.green(`Deployed ${total} handler(s):`)}`);
6220
- if (results.apiUrl) {
6221
- yield* Console3.log(`
6222
- API: ${c.cyan(results.apiUrl)}`);
6223
- }
6224
5915
  const summaryLines = [];
6225
- for (const r of results.httpResults) {
6226
- const pathPart = results.apiUrl ? r.url.replace(results.apiUrl, "") : r.url;
6227
- summaryLines.push({ name: r.exportName, line: ` ${c.cyan("[http]")} ${c.bold(r.exportName)} ${c.dim(pathPart)}` });
6228
- }
6229
5916
  for (const r of results.appResults) {
6230
- const pathPart = results.apiUrl ? r.url.replace(results.apiUrl, "") : r.url;
6231
- summaryLines.push({ name: r.exportName, line: ` ${c.cyan("[app]")} ${c.bold(r.exportName)} ${c.dim(pathPart)}` });
5917
+ summaryLines.push({ name: r.exportName, line: ` ${c.cyan("[app]")} ${c.bold(r.exportName)} ${c.dim(r.url)}` });
6232
5918
  }
6233
5919
  for (const r of results.tableResults) {
6234
5920
  summaryLines.push({ name: r.exportName, line: ` ${c.cyan("[table]")} ${c.bold(r.exportName)}` });
6235
5921
  }
6236
5922
  for (const r of results.apiResults) {
6237
- const pathPart = results.apiUrl ? r.url.replace(results.apiUrl, "") : r.url;
6238
- summaryLines.push({ name: r.exportName, line: ` ${c.cyan("[api]")} ${c.bold(r.exportName)} ${c.dim(pathPart)}` });
5923
+ summaryLines.push({ name: r.exportName, line: ` ${c.cyan("[api]")} ${c.bold(r.exportName)} ${c.dim(r.url)}` });
6239
5924
  }
6240
5925
  for (const r of results.staticSiteResults) {
6241
5926
  summaryLines.push({ name: r.exportName, line: ` ${c.cyan("[site]")} ${c.bold(r.exportName)}: ${c.cyan(r.url)}` });
@@ -6245,7 +5930,7 @@ ${c.green(`Deployed ${total} handler(s):`)}`);
6245
5930
  yield* Console3.log(line);
6246
5931
  }
6247
5932
  }),
6248
- onSome: (targetValue) => Effect38.gen(function* () {
5933
+ onSome: (targetValue) => Effect37.gen(function* () {
6249
5934
  if (isFilePath(targetValue)) {
6250
5935
  const fullPath = path9.isAbsolute(targetValue) ? targetValue : path9.resolve(projectDir, targetValue);
6251
5936
  const input = {
@@ -6256,30 +5941,16 @@ ${c.green(`Deployed ${total} handler(s):`)}`);
6256
5941
  stage: finalStage,
6257
5942
  region: finalRegion
6258
5943
  };
6259
- const httpResult = yield* deployAll(input).pipe(
6260
- Effect38.catchIf(
6261
- (e) => e instanceof Error && e.message.includes("No defineHttp"),
6262
- () => Effect38.succeed(null)
6263
- )
6264
- );
6265
5944
  const tableResults = yield* deployAllTables(input).pipe(
6266
- Effect38.catchIf(
5945
+ Effect37.catchIf(
6267
5946
  (e) => e instanceof Error && e.message.includes("No defineTable"),
6268
- () => Effect38.succeed([])
5947
+ () => Effect37.succeed([])
6269
5948
  )
6270
5949
  );
6271
- if (!httpResult && tableResults.length === 0) {
5950
+ if (tableResults.length === 0) {
6272
5951
  yield* Console3.error("No handlers found in file");
6273
5952
  return;
6274
5953
  }
6275
- if (httpResult) {
6276
- yield* Console3.log(`
6277
- API Gateway: ${c.cyan(httpResult.apiUrl)}`);
6278
- yield* Console3.log(c.green(`Deployed ${httpResult.handlers.length} HTTP handler(s):`));
6279
- for (const r of httpResult.handlers) {
6280
- yield* Console3.log(` ${c.bold(r.exportName)}: ${c.cyan(r.url)}`);
6281
- }
6282
- }
6283
5954
  if (tableResults.length > 0) {
6284
5955
  yield* Console3.log(c.green(`
6285
5956
  Deployed ${tableResults.length} table handler(s):`));
@@ -6330,25 +6001,21 @@ ${c.green("Deployed:")} ${c.cyan(result.url)}`);
6330
6001
  }
6331
6002
  })
6332
6003
  }).pipe(
6333
- Effect38.provide(clientsLayer),
6004
+ Effect37.provide(clientsLayer),
6334
6005
  Logger.withMinimumLogLevel(logLevel)
6335
6006
  );
6336
- }).pipe(Effect38.provide(ProjectConfig.Live))
6007
+ }).pipe(Effect37.provide(ProjectConfig.Live))
6337
6008
  ).pipe(Command.withDescription("Deploy handlers to AWS Lambda. Accepts a handler name, file path, or deploys all from config"));
6338
6009
 
6339
6010
  // src/cli/commands/status.ts
6340
6011
  import { Command as Command2 } from "@effect/cli";
6341
- import { Effect as Effect39, Console as Console4, Logger as Logger2, LogLevel as LogLevel2, Option as Option2 } from "effect";
6342
- var { lambda, apigatewayv2: apigateway } = clients_exports;
6012
+ import { Effect as Effect38, Console as Console4, Logger as Logger2, LogLevel as LogLevel2, Option as Option2 } from "effect";
6013
+ var { lambda } = clients_exports;
6343
6014
  var INTERNAL_HANDLERS = /* @__PURE__ */ new Set(["api", "platform"]);
6344
6015
  var extractFunctionName = (arn) => {
6345
6016
  const match = arn.match(/:function:([^:]+)$/);
6346
6017
  return match?.[1];
6347
6018
  };
6348
- var extractApiId = (arn) => {
6349
- const match = arn.match(/\/apis\/([a-z0-9]+)$/);
6350
- return match?.[1];
6351
- };
6352
6019
  var formatDate = (date) => {
6353
6020
  if (!date) return "";
6354
6021
  const d = typeof date === "string" ? new Date(date) : date;
@@ -6363,7 +6030,7 @@ var formatDate = (date) => {
6363
6030
  if (days < 7) return `${days}d ago`;
6364
6031
  return d.toLocaleDateString("en-US", { month: "short", day: "numeric" });
6365
6032
  };
6366
- var getLambdaDetails = (functionName) => Effect39.gen(function* () {
6033
+ var getLambdaDetails = (functionName) => Effect38.gen(function* () {
6367
6034
  const config = yield* lambda.make("get_function_configuration", {
6368
6035
  FunctionName: functionName
6369
6036
  });
@@ -6373,13 +6040,7 @@ var getLambdaDetails = (functionName) => Effect39.gen(function* () {
6373
6040
  timeout: config.Timeout
6374
6041
  };
6375
6042
  }).pipe(
6376
- Effect39.catchAll(() => Effect39.succeed({}))
6377
- );
6378
- var getApiUrl = (apiId) => Effect39.gen(function* () {
6379
- const api = yield* apigateway.make("get_api", { ApiId: apiId });
6380
- return api.ApiEndpoint;
6381
- }).pipe(
6382
- Effect39.catchAll(() => Effect39.succeed(void 0))
6043
+ Effect38.catchAll(() => Effect38.succeed({}))
6383
6044
  );
6384
6045
  var discoverCodeHandlers = (projectDir, patterns) => {
6385
6046
  const files = findHandlerFiles(patterns, projectDir);
@@ -6397,22 +6058,17 @@ var discoverAwsHandlers = (resources) => {
6397
6058
  const lambdaResource = handlerResources.find(
6398
6059
  (r) => r.Tags?.find((t) => t.Key === "effortless:type" && t.Value === "lambda")
6399
6060
  );
6400
- const apiResource = handlerResources.find(
6401
- (r) => r.Tags?.find((t) => t.Key === "effortless:type" && t.Value === "api-gateway")
6402
- );
6403
6061
  const typeTag = handlerResources[0]?.Tags?.find((t) => t.Key === "effortless:type");
6404
6062
  const type = typeTag?.Value ?? "unknown";
6405
6063
  handlers.push({
6406
6064
  name,
6407
6065
  type,
6408
- lambdaArn: lambdaResource?.ResourceARN ?? void 0,
6409
- apiArn: apiResource?.ResourceARN ?? void 0
6066
+ lambdaArn: lambdaResource?.ResourceARN ?? void 0
6410
6067
  });
6411
6068
  }
6412
6069
  return handlers;
6413
6070
  };
6414
6071
  var TYPE_LABELS = {
6415
- http: "http",
6416
6072
  table: "table",
6417
6073
  app: "app",
6418
6074
  api: "api",
@@ -6460,7 +6116,7 @@ var formatEntry = (entry) => {
6460
6116
  var statusCommand = Command2.make(
6461
6117
  "status",
6462
6118
  { project: projectOption, stage: stageOption, region: regionOption, verbose: verboseOption },
6463
- ({ project: projectOpt, stage, region, verbose }) => Effect39.gen(function* () {
6119
+ ({ project: projectOpt, stage, region, verbose }) => Effect38.gen(function* () {
6464
6120
  const { config, projectDir } = yield* ProjectConfig;
6465
6121
  const project = Option2.getOrElse(projectOpt, () => config?.name ?? "");
6466
6122
  const finalStage = config?.stage ?? stage;
@@ -6471,39 +6127,19 @@ var statusCommand = Command2.make(
6471
6127
  }
6472
6128
  const clientsLayer = clients_exports.makeClients({
6473
6129
  lambda: { region: finalRegion },
6474
- apigatewayv2: { region: finalRegion },
6475
6130
  resource_groups_tagging_api: { region: finalRegion }
6476
6131
  });
6477
6132
  const logLevel = verbose ? LogLevel2.Debug : LogLevel2.Info;
6478
6133
  const patterns = getPatternsFromConfig(config);
6479
6134
  const codeHandlers = patterns ? discoverCodeHandlers(projectDir, patterns) : [];
6480
6135
  const codeHandlerNames = new Set(codeHandlers.map((h) => h.name));
6481
- yield* Effect39.gen(function* () {
6136
+ yield* Effect38.gen(function* () {
6482
6137
  yield* Console4.log(`
6483
6138
  Status for ${c.bold(project + "/" + finalStage)}:
6484
6139
  `);
6485
6140
  const resources = yield* getAllResourcesByTags(project, finalStage, finalRegion);
6486
6141
  const awsHandlers = discoverAwsHandlers(resources);
6487
6142
  const awsHandlerNames = new Set(awsHandlers.map((h) => h.name));
6488
- let apiUrl;
6489
- for (const handler of awsHandlers) {
6490
- if (handler.apiArn) {
6491
- const apiId = extractApiId(handler.apiArn);
6492
- if (apiId) {
6493
- apiUrl = yield* getApiUrl(apiId);
6494
- break;
6495
- }
6496
- }
6497
- }
6498
- const apiResource = resources.find(
6499
- (r) => r.Tags?.find((t) => t.Key === "effortless:handler" && t.Value === "api") && r.Tags?.find((t) => t.Key === "effortless:type" && t.Value === "api-gateway")
6500
- );
6501
- if (!apiUrl && apiResource?.ResourceARN) {
6502
- const apiId = extractApiId(apiResource.ResourceARN);
6503
- if (apiId) {
6504
- apiUrl = yield* getApiUrl(apiId);
6505
- }
6506
- }
6507
6143
  const entries = [];
6508
6144
  for (const handler of codeHandlers) {
6509
6145
  const inAws = awsHandlers.find((h) => h.name === handler.name);
@@ -6559,10 +6195,6 @@ Status for ${c.bold(project + "/" + finalStage)}:
6559
6195
  for (const entry of entries) {
6560
6196
  yield* Console4.log(formatEntry(entry));
6561
6197
  }
6562
- if (apiUrl) {
6563
- yield* Console4.log(`
6564
- API: ${c.cyan(apiUrl)}`);
6565
- }
6566
6198
  const counts = {
6567
6199
  new: entries.filter((e) => e.status === "new").length,
6568
6200
  deployed: entries.filter((e) => e.status === "deployed").length,
@@ -6575,7 +6207,7 @@ API: ${c.cyan(apiUrl)}`);
6575
6207
  yield* Console4.log(`
6576
6208
  Total: ${parts.join(", ")}`);
6577
6209
  const depWarnings = yield* checkDependencyWarnings(projectDir).pipe(
6578
- Effect39.catchAll(() => Effect39.succeed([]))
6210
+ Effect38.catchAll(() => Effect38.succeed([]))
6579
6211
  );
6580
6212
  if (depWarnings.length > 0) {
6581
6213
  yield* Console4.log("");
@@ -6584,18 +6216,18 @@ Total: ${parts.join(", ")}`);
6584
6216
  }
6585
6217
  }
6586
6218
  }).pipe(
6587
- Effect39.provide(clientsLayer),
6219
+ Effect38.provide(clientsLayer),
6588
6220
  Logger2.withMinimumLogLevel(logLevel)
6589
6221
  );
6590
- }).pipe(Effect39.provide(ProjectConfig.Live))
6222
+ }).pipe(Effect38.provide(ProjectConfig.Live))
6591
6223
  ).pipe(Command2.withDescription("Compare local handlers with deployed AWS resources. Shows new, deployed, and orphaned handlers"));
6592
6224
 
6593
6225
  // src/cli/commands/cleanup.ts
6594
6226
  import { Command as Command3, Options as Options2 } from "@effect/cli";
6595
- import { Effect as Effect41, Console as Console5, Logger as Logger3, LogLevel as LogLevel3, Option as Option3 } from "effect";
6227
+ import { Effect as Effect40, Console as Console5, Logger as Logger3, LogLevel as LogLevel3, Option as Option3 } from "effect";
6596
6228
 
6597
6229
  // src/deploy/cleanup.ts
6598
- import { Effect as Effect40 } from "effect";
6230
+ import { Effect as Effect39 } from "effect";
6599
6231
  var extractResourceName = (arn, type) => {
6600
6232
  switch (type) {
6601
6233
  case "lambda": {
@@ -6638,7 +6270,7 @@ var extractLayerInfo = (arn) => {
6638
6270
  version: parseInt(parts[parts.length - 1] ?? "0", 10)
6639
6271
  };
6640
6272
  };
6641
- var deleteResource = (resource) => Effect40.gen(function* () {
6273
+ var deleteResource = (resource) => Effect39.gen(function* () {
6642
6274
  const name = extractResourceName(resource.arn, resource.type);
6643
6275
  switch (resource.type) {
6644
6276
  case "lambda":
@@ -6671,18 +6303,18 @@ var deleteResource = (resource) => Effect40.gen(function* () {
6671
6303
  yield* deleteSesIdentity(name);
6672
6304
  break;
6673
6305
  default:
6674
- yield* Effect40.logWarning(`Unknown resource type: ${resource.type}, skipping ${resource.arn}`);
6306
+ yield* Effect39.logWarning(`Unknown resource type: ${resource.type}, skipping ${resource.arn}`);
6675
6307
  }
6676
6308
  });
6677
- var deleteResources = (resources) => Effect40.gen(function* () {
6309
+ var deleteResources = (resources) => Effect39.gen(function* () {
6678
6310
  const orderedTypes = ["lambda", "api-gateway", "cloudfront-distribution", "sqs", "ses", "dynamodb", "s3-bucket", "lambda-layer", "iam-role"];
6679
6311
  const iamRolesToDelete = /* @__PURE__ */ new Set();
6680
6312
  for (const type of orderedTypes) {
6681
6313
  const resourcesOfType = resources.filter((r) => r.type === type);
6682
6314
  for (const resource of resourcesOfType) {
6683
6315
  yield* deleteResource(resource).pipe(
6684
- Effect40.catchAll(
6685
- (error) => Effect40.logError(`Failed to delete ${resource.type} ${resource.arn}: ${error}`)
6316
+ Effect39.catchAll(
6317
+ (error) => Effect39.logError(`Failed to delete ${resource.type} ${resource.arn}: ${error}`)
6686
6318
  )
6687
6319
  );
6688
6320
  if (resource.type === "lambda") {
@@ -6694,8 +6326,8 @@ var deleteResources = (resources) => Effect40.gen(function* () {
6694
6326
  }
6695
6327
  for (const roleName of iamRolesToDelete) {
6696
6328
  yield* deleteRole(roleName).pipe(
6697
- Effect40.catchAll(
6698
- (error) => Effect40.logError(`Failed to delete IAM role ${roleName}: ${error}`)
6329
+ Effect39.catchAll(
6330
+ (error) => Effect39.logError(`Failed to delete IAM role ${roleName}: ${error}`)
6699
6331
  )
6700
6332
  );
6701
6333
  }
@@ -6722,7 +6354,7 @@ var orphanedOption = Options2.boolean("orphaned").pipe(
6722
6354
  var cleanupCommand = Command3.make(
6723
6355
  "cleanup",
6724
6356
  { project: projectOption, stage: stageOption, region: regionOption, handler: handlerOption, layer: layerOption, roles: rolesOption, orphaned: orphanedOption, all: cleanupAllOption, dryRun: dryRunOption, verbose: verboseOption },
6725
- ({ project: projectOpt, stage, region, handler: handlerOpt, layer: cleanupLayer, roles: cleanupRoles, orphaned: cleanupOrphaned, all: deleteAll, dryRun, verbose }) => Effect41.gen(function* () {
6357
+ ({ project: projectOpt, stage, region, handler: handlerOpt, layer: cleanupLayer, roles: cleanupRoles, orphaned: cleanupOrphaned, all: deleteAll, dryRun, verbose }) => Effect40.gen(function* () {
6726
6358
  const { config, projectDir } = yield* ProjectConfig;
6727
6359
  const project = Option3.getOrElse(projectOpt, () => config?.name ?? "");
6728
6360
  const finalStage = config?.stage ?? stage;
@@ -6734,14 +6366,14 @@ var cleanupCommand = Command3.make(
6734
6366
  const logLevel = verbose ? LogLevel3.Debug : LogLevel3.Info;
6735
6367
  if (cleanupLayer) {
6736
6368
  yield* cleanupLayerVersions({ project, region: finalRegion, deleteAll, dryRun }).pipe(
6737
- Effect41.provide(clients_exports.makeClients({ lambda: { region: finalRegion } })),
6369
+ Effect40.provide(clients_exports.makeClients({ lambda: { region: finalRegion } })),
6738
6370
  Logger3.withMinimumLogLevel(logLevel)
6739
6371
  );
6740
6372
  return;
6741
6373
  }
6742
6374
  if (cleanupRoles) {
6743
6375
  yield* cleanupIamRoles({ project, stage: finalStage, region: finalRegion, deleteAll, dryRun }).pipe(
6744
- Effect41.provide(clients_exports.makeClients({ iam: { region: finalRegion } })),
6376
+ Effect40.provide(clients_exports.makeClients({ iam: { region: finalRegion } })),
6745
6377
  Logger3.withMinimumLogLevel(logLevel)
6746
6378
  );
6747
6379
  return;
@@ -6756,7 +6388,7 @@ var cleanupCommand = Command3.make(
6756
6388
  s3: { region: finalRegion },
6757
6389
  cloudfront: { region: "us-east-1" }
6758
6390
  });
6759
- yield* Effect41.gen(function* () {
6391
+ yield* Effect40.gen(function* () {
6760
6392
  yield* Console5.log(`
6761
6393
  Looking for resources in ${c.bold(project + "/" + finalStage)}...
6762
6394
  `);
@@ -6836,12 +6468,12 @@ ${c.yellow("[DRY RUN]")} No resources were deleted.`);
6836
6468
  yield* deleteResources(resourcesToDelete);
6837
6469
  yield* Console5.log(c.green("\nDone!"));
6838
6470
  }).pipe(
6839
- Effect41.provide(clientsLayer),
6471
+ Effect40.provide(clientsLayer),
6840
6472
  Logger3.withMinimumLogLevel(logLevel)
6841
6473
  );
6842
- }).pipe(Effect41.provide(ProjectConfig.Live))
6474
+ }).pipe(Effect40.provide(ProjectConfig.Live))
6843
6475
  ).pipe(Command3.withDescription("Delete deployed resources (Lambda, API Gateway, DynamoDB, IAM roles, layers)"));
6844
- var cleanupLayerVersions = (input) => Effect41.gen(function* () {
6476
+ var cleanupLayerVersions = (input) => Effect40.gen(function* () {
6845
6477
  const layerName = `${input.project}-deps`;
6846
6478
  yield* Console5.log(`
6847
6479
  Searching for layer versions: ${layerName}
@@ -6873,7 +6505,7 @@ ${c.yellow("[DRY RUN]")} No layers were deleted.`);
6873
6505
  yield* Console5.log(c.green(`
6874
6506
  Deleted ${deleted} layer version(s).`));
6875
6507
  });
6876
- var cleanupIamRoles = (input) => Effect41.gen(function* () {
6508
+ var cleanupIamRoles = (input) => Effect40.gen(function* () {
6877
6509
  yield* Console5.log("\nSearching for effortless IAM roles...\n");
6878
6510
  const allRoles = yield* listEffortlessRoles();
6879
6511
  if (allRoles.length === 0) {
@@ -6922,8 +6554,8 @@ ${c.yellow("[DRY RUN]")} No roles were deleted.`);
6922
6554
  yield* Console5.log(c.red("\nDeleting roles..."));
6923
6555
  for (const role of roles) {
6924
6556
  yield* deleteRole(role.name).pipe(
6925
- Effect41.catchAll(
6926
- (error) => Effect41.logError(`Failed to delete ${role.name}: ${error}`)
6557
+ Effect40.catchAll(
6558
+ (error) => Effect40.logError(`Failed to delete ${role.name}: ${error}`)
6927
6559
  )
6928
6560
  );
6929
6561
  }
@@ -6932,7 +6564,7 @@ ${c.yellow("[DRY RUN]")} No roles were deleted.`);
6932
6564
 
6933
6565
  // src/cli/commands/logs.ts
6934
6566
  import { Args as Args2, Command as Command4, Options as Options3 } from "@effect/cli";
6935
- import { Effect as Effect42, Console as Console6, Logger as Logger4, LogLevel as LogLevel4, Option as Option4, Schedule as Schedule4 } from "effect";
6567
+ import { Effect as Effect41, Console as Console6, Logger as Logger4, LogLevel as LogLevel4, Option as Option4, Schedule as Schedule4 } from "effect";
6936
6568
  var { cloudwatch_logs } = clients_exports;
6937
6569
  var handlerArg = Args2.text({ name: "handler" }).pipe(
6938
6570
  Args2.withDescription("Handler name to show logs for")
@@ -7003,7 +6635,7 @@ var fetchLogs = (logGroupName, startTime, nextToken) => cloudwatch_logs.make("fi
7003
6635
  var logsCommand = Command4.make(
7004
6636
  "logs",
7005
6637
  { handler: handlerArg, project: projectOption, stage: stageOption, region: regionOption, tail: tailOption, since: sinceOption, verbose: verboseOption },
7006
- ({ handler: handlerName, project: projectOpt, stage, region, tail, since, verbose }) => Effect42.gen(function* () {
6638
+ ({ handler: handlerName, project: projectOpt, stage, region, tail, since, verbose }) => Effect41.gen(function* () {
7007
6639
  const { config, projectDir } = yield* ProjectConfig;
7008
6640
  const project = Option4.getOrElse(projectOpt, () => config?.name ?? "");
7009
6641
  const finalStage = config?.stage ?? stage;
@@ -7034,18 +6666,18 @@ var logsCommand = Command4.make(
7034
6666
  cloudwatch_logs: { region: finalRegion }
7035
6667
  });
7036
6668
  const logLevel = verbose ? LogLevel4.Debug : LogLevel4.Info;
7037
- yield* Effect42.gen(function* () {
6669
+ yield* Effect41.gen(function* () {
7038
6670
  const durationMs = parseDuration(since);
7039
6671
  let startTime = Date.now() - durationMs;
7040
6672
  yield* Console6.log(`Logs for ${c.bold(handlerName)} ${c.dim(`(${logGroupName})`)}:
7041
6673
  `);
7042
6674
  let hasLogs = false;
7043
6675
  const result = yield* fetchLogs(logGroupName, startTime).pipe(
7044
- Effect42.catchAll((error) => {
6676
+ Effect41.catchAll((error) => {
7045
6677
  if (error instanceof clients_exports.cloudwatch_logs.CloudWatchLogsError && error.cause.name === "ResourceNotFoundException") {
7046
- return Effect42.succeed({ events: void 0, nextToken: void 0 });
6678
+ return Effect41.succeed({ events: void 0, nextToken: void 0 });
7047
6679
  }
7048
- return Effect42.fail(error);
6680
+ return Effect41.fail(error);
7049
6681
  })
7050
6682
  );
7051
6683
  if (result.events && result.events.length > 0) {
@@ -7069,10 +6701,10 @@ var logsCommand = Command4.make(
7069
6701
  if (!hasLogs) {
7070
6702
  yield* Console6.log("Waiting for logs... (Ctrl+C to stop)\n");
7071
6703
  }
7072
- yield* Effect42.repeat(
7073
- Effect42.gen(function* () {
6704
+ yield* Effect41.repeat(
6705
+ Effect41.gen(function* () {
7074
6706
  const result2 = yield* fetchLogs(logGroupName, startTime).pipe(
7075
- Effect42.catchAll(() => Effect42.succeed({ events: void 0, nextToken: void 0 }))
6707
+ Effect41.catchAll(() => Effect41.succeed({ events: void 0, nextToken: void 0 }))
7076
6708
  );
7077
6709
  if (result2.events && result2.events.length > 0) {
7078
6710
  for (const event of result2.events) {
@@ -7090,15 +6722,15 @@ var logsCommand = Command4.make(
7090
6722
  Schedule4.spaced("2 seconds")
7091
6723
  );
7092
6724
  }).pipe(
7093
- Effect42.provide(clientsLayer),
6725
+ Effect41.provide(clientsLayer),
7094
6726
  Logger4.withMinimumLogLevel(logLevel)
7095
6727
  );
7096
- }).pipe(Effect42.provide(ProjectConfig.Live))
6728
+ }).pipe(Effect41.provide(ProjectConfig.Live))
7097
6729
  ).pipe(Command4.withDescription("Stream CloudWatch logs for a handler. Supports --tail for live tailing and --since for time range"));
7098
6730
 
7099
6731
  // src/cli/commands/layer.ts
7100
6732
  import { Command as Command5, Options as Options4 } from "@effect/cli";
7101
- import { Effect as Effect43, Console as Console7 } from "effect";
6733
+ import { Effect as Effect42, Console as Console7 } from "effect";
7102
6734
  import * as path10 from "path";
7103
6735
  import * as fs5 from "fs";
7104
6736
  var buildOption = Options4.boolean("build").pipe(
@@ -7107,28 +6739,28 @@ var buildOption = Options4.boolean("build").pipe(
7107
6739
  var layerCommand = Command5.make(
7108
6740
  "layer",
7109
6741
  { build: buildOption, output: outputOption, verbose: verboseOption },
7110
- ({ build: build3, output, verbose }) => Effect43.gen(function* () {
6742
+ ({ build: build3, output, verbose }) => Effect42.gen(function* () {
7111
6743
  const { config, cwd } = yield* ProjectConfig;
7112
6744
  if (build3) {
7113
6745
  yield* buildLayer(cwd, output, verbose);
7114
6746
  } else {
7115
6747
  yield* showLayerInfo(cwd, config?.name, verbose);
7116
6748
  }
7117
- }).pipe(Effect43.provide(ProjectConfig.Live))
6749
+ }).pipe(Effect42.provide(ProjectConfig.Live))
7118
6750
  ).pipe(Command5.withDescription("Inspect or locally build the shared Lambda dependency layer from package.json"));
7119
- var showLayerInfo = (projectDir, projectName, verbose) => Effect43.gen(function* () {
6751
+ var showLayerInfo = (projectDir, projectName, verbose) => Effect42.gen(function* () {
7120
6752
  yield* Console7.log(`
7121
6753
  ${c.bold("=== Layer Packages Preview ===")}
7122
6754
  `);
7123
6755
  const depWarnings = yield* checkDependencyWarnings(projectDir).pipe(
7124
- Effect43.catchAll(() => Effect43.succeed([]))
6756
+ Effect42.catchAll(() => Effect42.succeed([]))
7125
6757
  );
7126
6758
  for (const w of depWarnings) {
7127
6759
  yield* Console7.log(c.yellow(` \u26A0 ${w}`));
7128
6760
  }
7129
6761
  if (depWarnings.length > 0) yield* Console7.log("");
7130
6762
  const prodDeps = yield* readProductionDependencies(projectDir).pipe(
7131
- Effect43.catchAll(() => Effect43.succeed([]))
6763
+ Effect42.catchAll(() => Effect42.succeed([]))
7132
6764
  );
7133
6765
  if (prodDeps.length === 0) {
7134
6766
  yield* Console7.log("No production dependencies found in package.json");
@@ -7140,7 +6772,7 @@ ${c.bold("=== Layer Packages Preview ===")}
7140
6772
  yield* Console7.log(` ${dep}`);
7141
6773
  }
7142
6774
  const hash = yield* computeLockfileHash(projectDir).pipe(
7143
- Effect43.catchAll(() => Effect43.succeed(null))
6775
+ Effect42.catchAll(() => Effect42.succeed(null))
7144
6776
  );
7145
6777
  if (hash) {
7146
6778
  yield* Console7.log(`
@@ -7148,7 +6780,7 @@ Lockfile hash: ${hash}`);
7148
6780
  } else {
7149
6781
  yield* Console7.log("\nNo lockfile found (package-lock.json, pnpm-lock.yaml, or yarn.lock)");
7150
6782
  }
7151
- const { packages: allPackages, warnings: layerWarnings } = yield* Effect43.sync(() => collectLayerPackages(projectDir, prodDeps));
6783
+ const { packages: allPackages, warnings: layerWarnings } = yield* Effect42.sync(() => collectLayerPackages(projectDir, prodDeps));
7152
6784
  if (layerWarnings.length > 0) {
7153
6785
  yield* Console7.log(c.yellow(`
7154
6786
  Warnings (${layerWarnings.length}):`));
@@ -7177,7 +6809,7 @@ Total packages for layer ${c.dim(`(${allPackages.length})`)}:`);
7177
6809
  Layer name: ${projectName}-deps`);
7178
6810
  }
7179
6811
  });
7180
- var buildLayer = (projectDir, output, verbose) => Effect43.gen(function* () {
6812
+ var buildLayer = (projectDir, output, verbose) => Effect42.gen(function* () {
7181
6813
  const outputDir = path10.isAbsolute(output) ? output : path10.resolve(projectDir, output);
7182
6814
  const layerDir = path10.join(outputDir, "nodejs", "node_modules");
7183
6815
  const layerRoot = path10.join(outputDir, "nodejs");
@@ -7189,14 +6821,14 @@ var buildLayer = (projectDir, output, verbose) => Effect43.gen(function* () {
7189
6821
  ${c.bold("=== Building Layer Locally ===")}
7190
6822
  `);
7191
6823
  const depWarnings = yield* checkDependencyWarnings(projectDir).pipe(
7192
- Effect43.catchAll(() => Effect43.succeed([]))
6824
+ Effect42.catchAll(() => Effect42.succeed([]))
7193
6825
  );
7194
6826
  for (const w of depWarnings) {
7195
6827
  yield* Console7.log(c.yellow(` \u26A0 ${w}`));
7196
6828
  }
7197
6829
  if (depWarnings.length > 0) yield* Console7.log("");
7198
6830
  const prodDeps = yield* readProductionDependencies(projectDir).pipe(
7199
- Effect43.catchAll(() => Effect43.succeed([]))
6831
+ Effect42.catchAll(() => Effect42.succeed([]))
7200
6832
  );
7201
6833
  if (prodDeps.length === 0) {
7202
6834
  yield* Console7.log("No production dependencies found in package.json");
@@ -7208,11 +6840,11 @@ ${c.bold("=== Building Layer Locally ===")}
7208
6840
  yield* Console7.log(` ${dep}`);
7209
6841
  }
7210
6842
  const hash = yield* computeLockfileHash(projectDir).pipe(
7211
- Effect43.catchAll(() => Effect43.succeed("unknown"))
6843
+ Effect42.catchAll(() => Effect42.succeed("unknown"))
7212
6844
  );
7213
6845
  yield* Console7.log(`
7214
6846
  Lockfile hash: ${hash}`);
7215
- const { packages: allPackages, resolvedPaths, warnings: layerWarnings } = yield* Effect43.sync(() => collectLayerPackages(projectDir, prodDeps));
6847
+ const { packages: allPackages, resolvedPaths, warnings: layerWarnings } = yield* Effect42.sync(() => collectLayerPackages(projectDir, prodDeps));
7216
6848
  if (layerWarnings.length > 0) {
7217
6849
  yield* Console7.log(`
7218
6850
  Warnings (${layerWarnings.length}):`);
@@ -7262,18 +6894,18 @@ To inspect: ls ${layerDir}`);
7262
6894
  // src/cli/commands/config.ts
7263
6895
  import { Args as Args3, Command as Command6 } from "@effect/cli";
7264
6896
  import { Prompt } from "@effect/cli";
7265
- import { Effect as Effect44, Console as Console8, Logger as Logger5, LogLevel as LogLevel5, Option as Option5 } from "effect";
7266
- var loadRequiredParams = (projectOpt, stage, region) => Effect44.gen(function* () {
6897
+ import { Effect as Effect43, Console as Console8, Logger as Logger5, LogLevel as LogLevel5, Option as Option5 } from "effect";
6898
+ var loadRequiredParams = (projectOpt, stage, region) => Effect43.gen(function* () {
7267
6899
  const { config, projectDir } = yield* ProjectConfig;
7268
6900
  const project = Option5.getOrElse(projectOpt, () => config?.name ?? "");
7269
6901
  if (!project) {
7270
6902
  yield* Console8.error("Error: --project is required (or set 'name' in effortless.config.ts)");
7271
- return yield* Effect44.fail(new Error("Missing project name"));
6903
+ return yield* Effect43.fail(new Error("Missing project name"));
7272
6904
  }
7273
6905
  const patterns = getPatternsFromConfig(config);
7274
6906
  if (!patterns) {
7275
6907
  yield* Console8.error("Error: No 'handlers' patterns in config");
7276
- return yield* Effect44.fail(new Error("Missing handler patterns"));
6908
+ return yield* Effect43.fail(new Error("Missing handler patterns"));
7277
6909
  }
7278
6910
  const files = findHandlerFiles(patterns, projectDir);
7279
6911
  const handlers = discoverHandlers(files);
@@ -7285,7 +6917,7 @@ var loadRequiredParams = (projectOpt, stage, region) => Effect44.gen(function* (
7285
6917
  var listCommand = Command6.make(
7286
6918
  "list",
7287
6919
  { project: projectOption, stage: stageOption, region: regionOption, verbose: verboseOption },
7288
- ({ project: projectOpt, stage, region, verbose }) => Effect44.gen(function* () {
6920
+ ({ project: projectOpt, stage, region, verbose }) => Effect43.gen(function* () {
7289
6921
  const ctx = yield* loadRequiredParams(projectOpt, stage, region);
7290
6922
  const { params } = ctx;
7291
6923
  if (params.length === 0) {
@@ -7293,7 +6925,7 @@ var listCommand = Command6.make(
7293
6925
  return;
7294
6926
  }
7295
6927
  const { existing, missing } = yield* checkMissingParams(params).pipe(
7296
- Effect44.provide(clients_exports.makeClients({ ssm: { region: ctx.region } }))
6928
+ Effect43.provide(clients_exports.makeClients({ ssm: { region: ctx.region } }))
7297
6929
  );
7298
6930
  yield* Console8.log(`
7299
6931
  ${c.bold("Config parameters")} ${c.dim(`(${ctx.project} / ${ctx.stage})`)}
@@ -7317,7 +6949,7 @@ ${c.bold("Config parameters")} ${c.dim(`(${ctx.project} / ${ctx.stage})`)}
7317
6949
  }
7318
6950
  yield* Console8.log("");
7319
6951
  }).pipe(
7320
- Effect44.provide(ProjectConfig.Live),
6952
+ Effect43.provide(ProjectConfig.Live),
7321
6953
  Logger5.withMinimumLogLevel(LogLevel5.Warning)
7322
6954
  )
7323
6955
  ).pipe(Command6.withDescription("List all declared config parameters and show which are set vs missing"));
@@ -7327,7 +6959,7 @@ var setKeyArg = Args3.text({ name: "key" }).pipe(
7327
6959
  var setCommand = Command6.make(
7328
6960
  "set",
7329
6961
  { key: setKeyArg, project: projectOption, stage: stageOption, region: regionOption, verbose: verboseOption },
7330
- ({ key, project: projectOpt, stage, region, verbose }) => Effect44.gen(function* () {
6962
+ ({ key, project: projectOpt, stage, region, verbose }) => Effect43.gen(function* () {
7331
6963
  const { config } = yield* ProjectConfig;
7332
6964
  const project = Option5.getOrElse(projectOpt, () => config?.name ?? "");
7333
6965
  if (!project) {
@@ -7345,18 +6977,18 @@ var setCommand = Command6.make(
7345
6977
  Value: value,
7346
6978
  Type: "SecureString",
7347
6979
  Overwrite: true
7348
- }).pipe(Effect44.provide(clients_exports.makeClients({ ssm: { region: finalRegion } })));
6980
+ }).pipe(Effect43.provide(clients_exports.makeClients({ ssm: { region: finalRegion } })));
7349
6981
  yield* Console8.log(`
7350
6982
  ${c.green("\u2713")} ${c.cyan(ssmPath)} ${c.dim("(SecureString)")}`);
7351
6983
  }).pipe(
7352
- Effect44.provide(ProjectConfig.Live),
6984
+ Effect43.provide(ProjectConfig.Live),
7353
6985
  Logger5.withMinimumLogLevel(LogLevel5.Warning)
7354
6986
  )
7355
6987
  ).pipe(Command6.withDescription("Set a config parameter value (stored encrypted in AWS)"));
7356
6988
  var configRootCommand = Command6.make(
7357
6989
  "config",
7358
6990
  { project: projectOption, stage: stageOption, region: regionOption, verbose: verboseOption },
7359
- ({ project: projectOpt, stage, region, verbose }) => Effect44.gen(function* () {
6991
+ ({ project: projectOpt, stage, region, verbose }) => Effect43.gen(function* () {
7360
6992
  const ctx = yield* loadRequiredParams(projectOpt, stage, region);
7361
6993
  const { params } = ctx;
7362
6994
  if (params.length === 0) {
@@ -7364,7 +6996,7 @@ var configRootCommand = Command6.make(
7364
6996
  return;
7365
6997
  }
7366
6998
  const { missing } = yield* checkMissingParams(params).pipe(
7367
- Effect44.provide(clients_exports.makeClients({ ssm: { region: ctx.region } }))
6999
+ Effect43.provide(clients_exports.makeClients({ ssm: { region: ctx.region } }))
7368
7000
  );
7369
7001
  if (missing.length === 0) {
7370
7002
  yield* Console8.log(`
@@ -7389,7 +7021,7 @@ ${c.bold("Missing parameters")} ${c.dim(`(${ctx.project} / ${ctx.stage})`)}
7389
7021
  Value: value,
7390
7022
  Type: "SecureString",
7391
7023
  Overwrite: false
7392
- }).pipe(Effect44.provide(clients_exports.makeClients({ ssm: { region: ctx.region } })));
7024
+ }).pipe(Effect43.provide(clients_exports.makeClients({ ssm: { region: ctx.region } })));
7393
7025
  yield* Console8.log(` ${c.green("\u2713")} created`);
7394
7026
  created++;
7395
7027
  }
@@ -7403,7 +7035,7 @@ ${c.bold("Missing parameters")} ${c.dim(`(${ctx.project} / ${ctx.stage})`)}
7403
7035
  `);
7404
7036
  }
7405
7037
  }).pipe(
7406
- Effect44.provide(ProjectConfig.Live),
7038
+ Effect43.provide(ProjectConfig.Live),
7407
7039
  Logger5.withMinimumLogLevel(LogLevel5.Warning)
7408
7040
  )
7409
7041
  ).pipe(
@@ -7424,7 +7056,7 @@ var cli = Command7.run(mainCommand, {
7424
7056
  version
7425
7057
  });
7426
7058
  cli(process.argv).pipe(
7427
- Effect45.provide(NodeContext.layer),
7428
- Effect45.provide(CliConfig.layer({ showBuiltIns: false, showTypes: false })),
7059
+ Effect44.provide(NodeContext.layer),
7060
+ Effect44.provide(CliConfig.layer({ showBuiltIns: false, showTypes: false })),
7429
7061
  NodeRuntime.runMain
7430
7062
  );