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