effortless-aws 0.0.2 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -13872,9 +13872,9 @@ var require_dispatcher_base = __commonJS({
13872
13872
  }
13873
13873
  close(callback) {
13874
13874
  if (callback === void 0) {
13875
- return new Promise((resolve7, reject) => {
13875
+ return new Promise((resolve8, reject) => {
13876
13876
  this.close((err, data) => {
13877
- return err ? reject(err) : resolve7(data);
13877
+ return err ? reject(err) : resolve8(data);
13878
13878
  });
13879
13879
  });
13880
13880
  }
@@ -13912,9 +13912,9 @@ var require_dispatcher_base = __commonJS({
13912
13912
  err = null;
13913
13913
  }
13914
13914
  if (callback === void 0) {
13915
- return new Promise((resolve7, reject) => {
13915
+ return new Promise((resolve8, reject) => {
13916
13916
  this.destroy(err, (err2, data) => {
13917
- return err2 ? reject(err2) : resolve7(data);
13917
+ return err2 ? reject(err2) : resolve8(data);
13918
13918
  });
13919
13919
  });
13920
13920
  }
@@ -17390,8 +17390,8 @@ var require_promise = __commonJS({
17390
17390
  function createDeferredPromise() {
17391
17391
  let res;
17392
17392
  let rej;
17393
- const promise3 = new Promise((resolve7, reject) => {
17394
- res = resolve7;
17393
+ const promise3 = new Promise((resolve8, reject) => {
17394
+ res = resolve8;
17395
17395
  rej = reject;
17396
17396
  });
17397
17397
  return { promise: promise3, resolve: res, reject: rej };
@@ -18689,12 +18689,12 @@ upgrade: ${upgrade}\r
18689
18689
  cb();
18690
18690
  }
18691
18691
  }
18692
- const waitForDrain = () => new Promise((resolve7, reject) => {
18692
+ const waitForDrain = () => new Promise((resolve8, reject) => {
18693
18693
  assert3(callback === null);
18694
18694
  if (socket[kError]) {
18695
18695
  reject(socket[kError]);
18696
18696
  } else {
18697
- callback = resolve7;
18697
+ callback = resolve8;
18698
18698
  }
18699
18699
  });
18700
18700
  socket.on("close", onDrain).on("drain", onDrain);
@@ -19535,12 +19535,12 @@ var require_client_h2 = __commonJS({
19535
19535
  cb();
19536
19536
  }
19537
19537
  }
19538
- const waitForDrain = () => new Promise((resolve7, reject) => {
19538
+ const waitForDrain = () => new Promise((resolve8, reject) => {
19539
19539
  assert3(callback === null);
19540
19540
  if (socket[kError]) {
19541
19541
  reject(socket[kError]);
19542
19542
  } else {
19543
- callback = resolve7;
19543
+ callback = resolve8;
19544
19544
  }
19545
19545
  });
19546
19546
  h2stream.on("close", onDrain).on("drain", onDrain);
@@ -19848,16 +19848,16 @@ var require_client = __commonJS({
19848
19848
  return this[kNeedDrain] < 2;
19849
19849
  }
19850
19850
  [kClose]() {
19851
- return new Promise((resolve7) => {
19851
+ return new Promise((resolve8) => {
19852
19852
  if (this[kSize]) {
19853
- this[kClosedResolve] = resolve7;
19853
+ this[kClosedResolve] = resolve8;
19854
19854
  } else {
19855
- resolve7(null);
19855
+ resolve8(null);
19856
19856
  }
19857
19857
  });
19858
19858
  }
19859
19859
  [kDestroy](err) {
19860
- return new Promise((resolve7) => {
19860
+ return new Promise((resolve8) => {
19861
19861
  const requests = this[kQueue].splice(this[kPendingIdx]);
19862
19862
  for (let i = 0; i < requests.length; i++) {
19863
19863
  const request2 = requests[i];
@@ -19868,7 +19868,7 @@ var require_client = __commonJS({
19868
19868
  this[kClosedResolve]();
19869
19869
  this[kClosedResolve] = null;
19870
19870
  }
19871
- resolve7(null);
19871
+ resolve8(null);
19872
19872
  };
19873
19873
  if (this[kHTTPContext]) {
19874
19874
  this[kHTTPContext].destroy(err, callback);
@@ -20265,8 +20265,8 @@ var require_pool_base = __commonJS({
20265
20265
  }
20266
20266
  return Promise.all(closeAll);
20267
20267
  } else {
20268
- return new Promise((resolve7) => {
20269
- this[kClosedResolve] = resolve7;
20268
+ return new Promise((resolve8) => {
20269
+ this[kClosedResolve] = resolve8;
20270
20270
  });
20271
20271
  }
20272
20272
  }
@@ -21797,7 +21797,7 @@ var require_readable = __commonJS({
21797
21797
  if (this._readableState.closeEmitted) {
21798
21798
  return Promise.resolve(null);
21799
21799
  }
21800
- return new Promise((resolve7, reject) => {
21800
+ return new Promise((resolve8, reject) => {
21801
21801
  if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
21802
21802
  this.destroy(new AbortError());
21803
21803
  }
@@ -21811,11 +21811,11 @@ var require_readable = __commonJS({
21811
21811
  if (signal.aborted) {
21812
21812
  reject(signal.reason ?? new AbortError());
21813
21813
  } else {
21814
- resolve7(null);
21814
+ resolve8(null);
21815
21815
  }
21816
21816
  });
21817
21817
  } else {
21818
- this.on("close", resolve7);
21818
+ this.on("close", resolve8);
21819
21819
  }
21820
21820
  this.on("error", noop).on("data", () => {
21821
21821
  if (this[kBytesRead] > limit) {
@@ -21843,7 +21843,7 @@ var require_readable = __commonJS({
21843
21843
  }
21844
21844
  function consume(stream3, type2) {
21845
21845
  assert3(!stream3[kConsume]);
21846
- return new Promise((resolve7, reject) => {
21846
+ return new Promise((resolve8, reject) => {
21847
21847
  if (isUnusable(stream3)) {
21848
21848
  const rState = stream3._readableState;
21849
21849
  if (rState.destroyed && rState.closeEmitted === false) {
@@ -21858,7 +21858,7 @@ var require_readable = __commonJS({
21858
21858
  stream3[kConsume] = {
21859
21859
  type: type2,
21860
21860
  stream: stream3,
21861
- resolve: resolve7,
21861
+ resolve: resolve8,
21862
21862
  reject,
21863
21863
  length: 0,
21864
21864
  body: []
@@ -21932,18 +21932,18 @@ var require_readable = __commonJS({
21932
21932
  return buffer3;
21933
21933
  }
21934
21934
  function consumeEnd(consume2, encoding) {
21935
- const { type: type2, body, resolve: resolve7, stream: stream3, length: length3 } = consume2;
21935
+ const { type: type2, body, resolve: resolve8, stream: stream3, length: length3 } = consume2;
21936
21936
  try {
21937
21937
  if (type2 === "text") {
21938
- resolve7(chunksDecode(body, length3, encoding));
21938
+ resolve8(chunksDecode(body, length3, encoding));
21939
21939
  } else if (type2 === "json") {
21940
- resolve7(JSON.parse(chunksDecode(body, length3, encoding)));
21940
+ resolve8(JSON.parse(chunksDecode(body, length3, encoding)));
21941
21941
  } else if (type2 === "arrayBuffer") {
21942
- resolve7(chunksConcat(body, length3).buffer);
21942
+ resolve8(chunksConcat(body, length3).buffer);
21943
21943
  } else if (type2 === "blob") {
21944
- resolve7(new Blob(body, { type: stream3[kContentType] }));
21944
+ resolve8(new Blob(body, { type: stream3[kContentType] }));
21945
21945
  } else if (type2 === "bytes") {
21946
- resolve7(chunksConcat(body, length3));
21946
+ resolve8(chunksConcat(body, length3));
21947
21947
  }
21948
21948
  consumeFinish(consume2);
21949
21949
  } catch (err) {
@@ -22133,9 +22133,9 @@ var require_api_request = __commonJS({
22133
22133
  };
22134
22134
  function request2(opts, callback) {
22135
22135
  if (callback === void 0) {
22136
- return new Promise((resolve7, reject) => {
22136
+ return new Promise((resolve8, reject) => {
22137
22137
  request2.call(this, opts, (err, data) => {
22138
- return err ? reject(err) : resolve7(data);
22138
+ return err ? reject(err) : resolve8(data);
22139
22139
  });
22140
22140
  });
22141
22141
  }
@@ -22347,9 +22347,9 @@ var require_api_stream = __commonJS({
22347
22347
  };
22348
22348
  function stream3(opts, factory, callback) {
22349
22349
  if (callback === void 0) {
22350
- return new Promise((resolve7, reject) => {
22350
+ return new Promise((resolve8, reject) => {
22351
22351
  stream3.call(this, opts, factory, (err, data) => {
22352
- return err ? reject(err) : resolve7(data);
22352
+ return err ? reject(err) : resolve8(data);
22353
22353
  });
22354
22354
  });
22355
22355
  }
@@ -22637,9 +22637,9 @@ var require_api_upgrade = __commonJS({
22637
22637
  };
22638
22638
  function upgrade(opts, callback) {
22639
22639
  if (callback === void 0) {
22640
- return new Promise((resolve7, reject) => {
22640
+ return new Promise((resolve8, reject) => {
22641
22641
  upgrade.call(this, opts, (err, data) => {
22642
- return err ? reject(err) : resolve7(data);
22642
+ return err ? reject(err) : resolve8(data);
22643
22643
  });
22644
22644
  });
22645
22645
  }
@@ -22732,9 +22732,9 @@ var require_api_connect = __commonJS({
22732
22732
  };
22733
22733
  function connect(opts, callback) {
22734
22734
  if (callback === void 0) {
22735
- return new Promise((resolve7, reject) => {
22735
+ return new Promise((resolve8, reject) => {
22736
22736
  connect.call(this, opts, (err, data) => {
22737
- return err ? reject(err) : resolve7(data);
22737
+ return err ? reject(err) : resolve8(data);
22738
22738
  });
22739
22739
  });
22740
22740
  }
@@ -24002,7 +24002,7 @@ var require_snapshot_recorder = __commonJS({
24002
24002
  "node_modules/.pnpm/undici@7.21.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
24003
24003
  "use strict";
24004
24004
  var { writeFile: writeFile3, readFile: readFile5, mkdir: mkdir2 } = __require("fs/promises");
24005
- var { dirname: dirname3, resolve: resolve7 } = __require("path");
24005
+ var { dirname: dirname4, resolve: resolve8 } = __require("path");
24006
24006
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("timers");
24007
24007
  var { InvalidArgumentError, UndiciError } = require_errors2();
24008
24008
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -24203,7 +24203,7 @@ var require_snapshot_recorder = __commonJS({
24203
24203
  throw new InvalidArgumentError("Snapshot path is required");
24204
24204
  }
24205
24205
  try {
24206
- const data = await readFile5(resolve7(path12), "utf8");
24206
+ const data = await readFile5(resolve8(path12), "utf8");
24207
24207
  const parsed = JSON.parse(data);
24208
24208
  if (Array.isArray(parsed)) {
24209
24209
  this.#snapshots.clear();
@@ -24232,8 +24232,8 @@ var require_snapshot_recorder = __commonJS({
24232
24232
  if (!path12) {
24233
24233
  throw new InvalidArgumentError("Snapshot path is required");
24234
24234
  }
24235
- const resolvedPath = resolve7(path12);
24236
- await mkdir2(dirname3(resolvedPath), { recursive: true });
24235
+ const resolvedPath = resolve8(path12);
24236
+ await mkdir2(dirname4(resolvedPath), { recursive: true });
24237
24237
  const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
24238
24238
  hash: hash2,
24239
24239
  snapshot
@@ -30781,7 +30781,7 @@ var require_fetch = __commonJS({
30781
30781
  function dispatch({ body }) {
30782
30782
  const url2 = requestCurrentURL(request2);
30783
30783
  const agent = fetchParams.controller.dispatcher;
30784
- return new Promise((resolve7, reject) => agent.dispatch(
30784
+ return new Promise((resolve8, reject) => agent.dispatch(
30785
30785
  {
30786
30786
  path: url2.pathname + url2.search,
30787
30787
  origin: url2.origin,
@@ -30861,7 +30861,7 @@ var require_fetch = __commonJS({
30861
30861
  }
30862
30862
  }
30863
30863
  const onError4 = this.onError.bind(this);
30864
- resolve7({
30864
+ resolve8({
30865
30865
  status: status2,
30866
30866
  statusText,
30867
30867
  headersList,
@@ -30904,7 +30904,7 @@ var require_fetch = __commonJS({
30904
30904
  for (let i = 0; i < rawHeaders.length; i += 2) {
30905
30905
  headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i]), rawHeaders[i + 1].toString("latin1"), true);
30906
30906
  }
30907
- resolve7({
30907
+ resolve8({
30908
30908
  status: status2,
30909
30909
  statusText: STATUS_CODES[status2],
30910
30910
  headersList,
@@ -43439,18 +43439,18 @@ var parallelErrors = (self) => matchCauseEffect(self, {
43439
43439
  onSuccess: succeed
43440
43440
  });
43441
43441
  var patchFiberRefs = (patch9) => updateFiberRefs((fiberId3, fiberRefs3) => pipe(patch9, patch6(fiberId3, fiberRefs3)));
43442
- var promise = (evaluate2) => evaluate2.length >= 1 ? async_((resolve7, signal) => {
43442
+ var promise = (evaluate2) => evaluate2.length >= 1 ? async_((resolve8, signal) => {
43443
43443
  try {
43444
- evaluate2(signal).then((a) => resolve7(succeed(a)), (e) => resolve7(die2(e)));
43444
+ evaluate2(signal).then((a) => resolve8(succeed(a)), (e) => resolve8(die2(e)));
43445
43445
  } catch (e) {
43446
- resolve7(die2(e));
43446
+ resolve8(die2(e));
43447
43447
  }
43448
- }) : async_((resolve7) => {
43448
+ }) : async_((resolve8) => {
43449
43449
  try {
43450
43450
  ;
43451
- evaluate2().then((a) => resolve7(succeed(a)), (e) => resolve7(die2(e)));
43451
+ evaluate2().then((a) => resolve8(succeed(a)), (e) => resolve8(die2(e)));
43452
43452
  } catch (e) {
43453
- resolve7(die2(e));
43453
+ resolve8(die2(e));
43454
43454
  }
43455
43455
  });
43456
43456
  var provideService = /* @__PURE__ */ dual(3, (self, tag4, service2) => contextWithEffect((env2) => provideContext(self, add2(env2, tag4, service2))));
@@ -43576,19 +43576,19 @@ var tryPromise = (arg) => {
43576
43576
  }
43577
43577
  const fail19 = (e) => catcher ? failSync(() => catcher(e)) : fail2(new UnknownException(e, "An unknown error occurred in Effect.tryPromise"));
43578
43578
  if (evaluate2.length >= 1) {
43579
- return async_((resolve7, signal) => {
43579
+ return async_((resolve8, signal) => {
43580
43580
  try {
43581
- evaluate2(signal).then((a) => resolve7(succeed(a)), (e) => resolve7(fail19(e)));
43581
+ evaluate2(signal).then((a) => resolve8(succeed(a)), (e) => resolve8(fail19(e)));
43582
43582
  } catch (e) {
43583
- resolve7(fail19(e));
43583
+ resolve8(fail19(e));
43584
43584
  }
43585
43585
  });
43586
43586
  }
43587
- return async_((resolve7) => {
43587
+ return async_((resolve8) => {
43588
43588
  try {
43589
- evaluate2().then((a) => resolve7(succeed(a)), (e) => resolve7(fail19(e)));
43589
+ evaluate2().then((a) => resolve8(succeed(a)), (e) => resolve8(fail19(e)));
43590
43590
  } catch (e) {
43591
- resolve7(fail19(e));
43591
+ resolve8(fail19(e));
43592
43592
  }
43593
43593
  });
43594
43594
  };
@@ -48957,14 +48957,14 @@ var unsafeRunPromise = /* @__PURE__ */ makeDual((runtime5, effect3, options3) =>
48957
48957
  }
48958
48958
  }
48959
48959
  }));
48960
- var unsafeRunPromiseExit = /* @__PURE__ */ makeDual((runtime5, effect3, options3) => new Promise((resolve7) => {
48960
+ var unsafeRunPromiseExit = /* @__PURE__ */ makeDual((runtime5, effect3, options3) => new Promise((resolve8) => {
48961
48961
  const op = fastPath(effect3);
48962
48962
  if (op) {
48963
- resolve7(op);
48963
+ resolve8(op);
48964
48964
  }
48965
48965
  const fiber = unsafeFork3(runtime5)(effect3);
48966
48966
  fiber.addObserver((exit4) => {
48967
- resolve7(exit4);
48967
+ resolve8(exit4);
48968
48968
  });
48969
48969
  if (options3?.signal !== void 0) {
48970
48970
  if (options3.signal.aborted) {
@@ -68719,7 +68719,8 @@ __export(clients_exports, {
68719
68719
  iam: () => iam_exports,
68720
68720
  lambda: () => lambda_exports,
68721
68721
  makeClients: () => makeClients,
68722
- resource_groups_tagging_api: () => resource_groups_tagging_api_exports
68722
+ resource_groups_tagging_api: () => resource_groups_tagging_api_exports,
68723
+ ssm: () => ssm_exports
68723
68724
  });
68724
68725
 
68725
68726
  // src/aws/clients/apigatewayv2.ts
@@ -69392,20 +69393,216 @@ var ResourceGroupsTaggingAPICommandFactory = {
69392
69393
  untag_resources: Sdk5.UntagResourcesCommand
69393
69394
  };
69394
69395
 
69396
+ // src/aws/clients/ssm.ts
69397
+ var ssm_exports = {};
69398
+ __export(ssm_exports, {
69399
+ SSMClient: () => SSMClient2,
69400
+ SSMError: () => SSMError,
69401
+ make: () => make73
69402
+ });
69403
+ import * as Sdk6 from "@aws-sdk/client-ssm";
69404
+ var SSMClient2 = class _SSMClient extends Tag2("SSMClient")() {
69405
+ static Default = (config2) => effect(
69406
+ _SSMClient,
69407
+ gen3(function* () {
69408
+ return new Sdk6.SSMClient(config2 ?? {});
69409
+ })
69410
+ );
69411
+ };
69412
+ var make73 = fn("aws_SSM")(function* (actionName, actionInput) {
69413
+ yield* logDebug2(`aws_SSM.${actionName}`, { input: actionInput });
69414
+ const client = yield* SSMClient2;
69415
+ const command = new SSMCommandFactory[actionName](actionInput);
69416
+ const result = yield* tryPromise2({
69417
+ try: () => client.send(command),
69418
+ catch: (error4) => {
69419
+ if (error4 instanceof Sdk6.SSMServiceException) {
69420
+ return new SSMError(error4, actionName);
69421
+ }
69422
+ throw error4;
69423
+ }
69424
+ });
69425
+ yield* logDebug2(`aws_SSM.${actionName} completed`);
69426
+ return result;
69427
+ });
69428
+ var SSMError = class {
69429
+ constructor(cause3, command) {
69430
+ this.cause = cause3;
69431
+ this.command = command;
69432
+ }
69433
+ _tag = "SSMError";
69434
+ $is(name) {
69435
+ return this.cause.name == name;
69436
+ }
69437
+ is(name) {
69438
+ return this.cause.name == name;
69439
+ }
69440
+ };
69441
+ var SSMCommandFactory = {
69442
+ add_tags_to_resource: Sdk6.AddTagsToResourceCommand,
69443
+ associate_ops_item_related_item: Sdk6.AssociateOpsItemRelatedItemCommand,
69444
+ cancel_command: Sdk6.CancelCommandCommand,
69445
+ cancel_maintenance_window_execution: Sdk6.CancelMaintenanceWindowExecutionCommand,
69446
+ create_activation: Sdk6.CreateActivationCommand,
69447
+ create_association: Sdk6.CreateAssociationCommand,
69448
+ create_association_batch: Sdk6.CreateAssociationBatchCommand,
69449
+ create_document: Sdk6.CreateDocumentCommand,
69450
+ create_maintenance_window: Sdk6.CreateMaintenanceWindowCommand,
69451
+ create_ops_item: Sdk6.CreateOpsItemCommand,
69452
+ create_ops_metadata: Sdk6.CreateOpsMetadataCommand,
69453
+ create_patch_baseline: Sdk6.CreatePatchBaselineCommand,
69454
+ create_resource_data_sync: Sdk6.CreateResourceDataSyncCommand,
69455
+ delete_activation: Sdk6.DeleteActivationCommand,
69456
+ delete_association: Sdk6.DeleteAssociationCommand,
69457
+ delete_document: Sdk6.DeleteDocumentCommand,
69458
+ delete_inventory: Sdk6.DeleteInventoryCommand,
69459
+ delete_maintenance_window: Sdk6.DeleteMaintenanceWindowCommand,
69460
+ delete_ops_item: Sdk6.DeleteOpsItemCommand,
69461
+ delete_ops_metadata: Sdk6.DeleteOpsMetadataCommand,
69462
+ delete_parameter: Sdk6.DeleteParameterCommand,
69463
+ delete_parameters: Sdk6.DeleteParametersCommand,
69464
+ delete_patch_baseline: Sdk6.DeletePatchBaselineCommand,
69465
+ delete_resource_data_sync: Sdk6.DeleteResourceDataSyncCommand,
69466
+ delete_resource_policy: Sdk6.DeleteResourcePolicyCommand,
69467
+ deregister_managed_instance: Sdk6.DeregisterManagedInstanceCommand,
69468
+ deregister_patch_baseline_for_patch_group: Sdk6.DeregisterPatchBaselineForPatchGroupCommand,
69469
+ deregister_target_from_maintenance_window: Sdk6.DeregisterTargetFromMaintenanceWindowCommand,
69470
+ deregister_task_from_maintenance_window: Sdk6.DeregisterTaskFromMaintenanceWindowCommand,
69471
+ describe_activations: Sdk6.DescribeActivationsCommand,
69472
+ describe_association: Sdk6.DescribeAssociationCommand,
69473
+ describe_association_execution_targets: Sdk6.DescribeAssociationExecutionTargetsCommand,
69474
+ describe_association_executions: Sdk6.DescribeAssociationExecutionsCommand,
69475
+ describe_automation_executions: Sdk6.DescribeAutomationExecutionsCommand,
69476
+ describe_automation_step_executions: Sdk6.DescribeAutomationStepExecutionsCommand,
69477
+ describe_available_patches: Sdk6.DescribeAvailablePatchesCommand,
69478
+ describe_document: Sdk6.DescribeDocumentCommand,
69479
+ describe_document_permission: Sdk6.DescribeDocumentPermissionCommand,
69480
+ describe_effective_instance_associations: Sdk6.DescribeEffectiveInstanceAssociationsCommand,
69481
+ describe_effective_patches_for_patch_baseline: Sdk6.DescribeEffectivePatchesForPatchBaselineCommand,
69482
+ describe_instance_associations_status: Sdk6.DescribeInstanceAssociationsStatusCommand,
69483
+ describe_instance_information: Sdk6.DescribeInstanceInformationCommand,
69484
+ describe_instance_patch_states: Sdk6.DescribeInstancePatchStatesCommand,
69485
+ describe_instance_patch_states_for_patch_group: Sdk6.DescribeInstancePatchStatesForPatchGroupCommand,
69486
+ describe_instance_patches: Sdk6.DescribeInstancePatchesCommand,
69487
+ describe_instance_properties: Sdk6.DescribeInstancePropertiesCommand,
69488
+ describe_inventory_deletions: Sdk6.DescribeInventoryDeletionsCommand,
69489
+ describe_maintenance_window_execution_task_invocations: Sdk6.DescribeMaintenanceWindowExecutionTaskInvocationsCommand,
69490
+ describe_maintenance_window_execution_tasks: Sdk6.DescribeMaintenanceWindowExecutionTasksCommand,
69491
+ describe_maintenance_window_executions: Sdk6.DescribeMaintenanceWindowExecutionsCommand,
69492
+ describe_maintenance_window_schedule: Sdk6.DescribeMaintenanceWindowScheduleCommand,
69493
+ describe_maintenance_window_targets: Sdk6.DescribeMaintenanceWindowTargetsCommand,
69494
+ describe_maintenance_window_tasks: Sdk6.DescribeMaintenanceWindowTasksCommand,
69495
+ describe_maintenance_windows: Sdk6.DescribeMaintenanceWindowsCommand,
69496
+ describe_maintenance_windows_for_target: Sdk6.DescribeMaintenanceWindowsForTargetCommand,
69497
+ describe_ops_items: Sdk6.DescribeOpsItemsCommand,
69498
+ describe_parameters: Sdk6.DescribeParametersCommand,
69499
+ describe_patch_baselines: Sdk6.DescribePatchBaselinesCommand,
69500
+ describe_patch_group_state: Sdk6.DescribePatchGroupStateCommand,
69501
+ describe_patch_groups: Sdk6.DescribePatchGroupsCommand,
69502
+ describe_patch_properties: Sdk6.DescribePatchPropertiesCommand,
69503
+ describe_sessions: Sdk6.DescribeSessionsCommand,
69504
+ disassociate_ops_item_related_item: Sdk6.DisassociateOpsItemRelatedItemCommand,
69505
+ get_access_token: Sdk6.GetAccessTokenCommand,
69506
+ get_automation_execution: Sdk6.GetAutomationExecutionCommand,
69507
+ get_calendar_state: Sdk6.GetCalendarStateCommand,
69508
+ get_command_invocation: Sdk6.GetCommandInvocationCommand,
69509
+ get_connection_status: Sdk6.GetConnectionStatusCommand,
69510
+ get_default_patch_baseline: Sdk6.GetDefaultPatchBaselineCommand,
69511
+ get_deployable_patch_snapshot_for_instance: Sdk6.GetDeployablePatchSnapshotForInstanceCommand,
69512
+ get_document: Sdk6.GetDocumentCommand,
69513
+ get_execution_preview: Sdk6.GetExecutionPreviewCommand,
69514
+ get_inventory: Sdk6.GetInventoryCommand,
69515
+ get_inventory_schema: Sdk6.GetInventorySchemaCommand,
69516
+ get_maintenance_window: Sdk6.GetMaintenanceWindowCommand,
69517
+ get_maintenance_window_execution: Sdk6.GetMaintenanceWindowExecutionCommand,
69518
+ get_maintenance_window_execution_task: Sdk6.GetMaintenanceWindowExecutionTaskCommand,
69519
+ get_maintenance_window_execution_task_invocation: Sdk6.GetMaintenanceWindowExecutionTaskInvocationCommand,
69520
+ get_maintenance_window_task: Sdk6.GetMaintenanceWindowTaskCommand,
69521
+ get_ops_item: Sdk6.GetOpsItemCommand,
69522
+ get_ops_metadata: Sdk6.GetOpsMetadataCommand,
69523
+ get_ops_summary: Sdk6.GetOpsSummaryCommand,
69524
+ get_parameter: Sdk6.GetParameterCommand,
69525
+ get_parameter_history: Sdk6.GetParameterHistoryCommand,
69526
+ get_parameters: Sdk6.GetParametersCommand,
69527
+ get_parameters_by_path: Sdk6.GetParametersByPathCommand,
69528
+ get_patch_baseline: Sdk6.GetPatchBaselineCommand,
69529
+ get_patch_baseline_for_patch_group: Sdk6.GetPatchBaselineForPatchGroupCommand,
69530
+ get_resource_policies: Sdk6.GetResourcePoliciesCommand,
69531
+ get_service_setting: Sdk6.GetServiceSettingCommand,
69532
+ label_parameter_version: Sdk6.LabelParameterVersionCommand,
69533
+ list_association_versions: Sdk6.ListAssociationVersionsCommand,
69534
+ list_associations: Sdk6.ListAssociationsCommand,
69535
+ list_command_invocations: Sdk6.ListCommandInvocationsCommand,
69536
+ list_commands: Sdk6.ListCommandsCommand,
69537
+ list_compliance_items: Sdk6.ListComplianceItemsCommand,
69538
+ list_compliance_summaries: Sdk6.ListComplianceSummariesCommand,
69539
+ list_document_metadata_history: Sdk6.ListDocumentMetadataHistoryCommand,
69540
+ list_document_versions: Sdk6.ListDocumentVersionsCommand,
69541
+ list_documents: Sdk6.ListDocumentsCommand,
69542
+ list_inventory_entries: Sdk6.ListInventoryEntriesCommand,
69543
+ list_nodes: Sdk6.ListNodesCommand,
69544
+ list_nodes_summary: Sdk6.ListNodesSummaryCommand,
69545
+ list_ops_item_events: Sdk6.ListOpsItemEventsCommand,
69546
+ list_ops_item_related_items: Sdk6.ListOpsItemRelatedItemsCommand,
69547
+ list_ops_metadata: Sdk6.ListOpsMetadataCommand,
69548
+ list_resource_compliance_summaries: Sdk6.ListResourceComplianceSummariesCommand,
69549
+ list_resource_data_sync: Sdk6.ListResourceDataSyncCommand,
69550
+ list_tags_for_resource: Sdk6.ListTagsForResourceCommand,
69551
+ modify_document_permission: Sdk6.ModifyDocumentPermissionCommand,
69552
+ put_compliance_items: Sdk6.PutComplianceItemsCommand,
69553
+ put_inventory: Sdk6.PutInventoryCommand,
69554
+ put_parameter: Sdk6.PutParameterCommand,
69555
+ put_resource_policy: Sdk6.PutResourcePolicyCommand,
69556
+ register_default_patch_baseline: Sdk6.RegisterDefaultPatchBaselineCommand,
69557
+ register_patch_baseline_for_patch_group: Sdk6.RegisterPatchBaselineForPatchGroupCommand,
69558
+ register_target_with_maintenance_window: Sdk6.RegisterTargetWithMaintenanceWindowCommand,
69559
+ register_task_with_maintenance_window: Sdk6.RegisterTaskWithMaintenanceWindowCommand,
69560
+ remove_tags_from_resource: Sdk6.RemoveTagsFromResourceCommand,
69561
+ reset_service_setting: Sdk6.ResetServiceSettingCommand,
69562
+ resume_session: Sdk6.ResumeSessionCommand,
69563
+ send_automation_signal: Sdk6.SendAutomationSignalCommand,
69564
+ send_command: Sdk6.SendCommandCommand,
69565
+ start_access_request: Sdk6.StartAccessRequestCommand,
69566
+ start_associations_once: Sdk6.StartAssociationsOnceCommand,
69567
+ start_automation_execution: Sdk6.StartAutomationExecutionCommand,
69568
+ start_change_request_execution: Sdk6.StartChangeRequestExecutionCommand,
69569
+ start_execution_preview: Sdk6.StartExecutionPreviewCommand,
69570
+ start_session: Sdk6.StartSessionCommand,
69571
+ stop_automation_execution: Sdk6.StopAutomationExecutionCommand,
69572
+ terminate_session: Sdk6.TerminateSessionCommand,
69573
+ unlabel_parameter_version: Sdk6.UnlabelParameterVersionCommand,
69574
+ update_association: Sdk6.UpdateAssociationCommand,
69575
+ update_association_status: Sdk6.UpdateAssociationStatusCommand,
69576
+ update_document: Sdk6.UpdateDocumentCommand,
69577
+ update_document_default_version: Sdk6.UpdateDocumentDefaultVersionCommand,
69578
+ update_document_metadata: Sdk6.UpdateDocumentMetadataCommand,
69579
+ update_maintenance_window: Sdk6.UpdateMaintenanceWindowCommand,
69580
+ update_maintenance_window_target: Sdk6.UpdateMaintenanceWindowTargetCommand,
69581
+ update_maintenance_window_task: Sdk6.UpdateMaintenanceWindowTaskCommand,
69582
+ update_managed_instance_role: Sdk6.UpdateManagedInstanceRoleCommand,
69583
+ update_ops_item: Sdk6.UpdateOpsItemCommand,
69584
+ update_ops_metadata: Sdk6.UpdateOpsMetadataCommand,
69585
+ update_patch_baseline: Sdk6.UpdatePatchBaselineCommand,
69586
+ update_resource_data_sync: Sdk6.UpdateResourceDataSyncCommand,
69587
+ update_service_setting: Sdk6.UpdateServiceSettingCommand
69588
+ };
69589
+
69395
69590
  // src/aws/clients/index.ts
69396
69591
  var AllClientsDefault = mergeAll6(
69397
69592
  ApiGatewayV2Client2.Default(),
69398
69593
  DynamoDBClient2.Default(),
69399
69594
  IAMClient2.Default(),
69400
69595
  LambdaClient2.Default(),
69401
- ResourceGroupsTaggingAPIClient2.Default()
69596
+ ResourceGroupsTaggingAPIClient2.Default(),
69597
+ SSMClient2.Default()
69402
69598
  );
69403
69599
  var makeClients = (config2) => mergeAll6(
69404
69600
  ApiGatewayV2Client2.Default(config2?.apigatewayv2),
69405
69601
  DynamoDBClient2.Default(config2?.dynamodb),
69406
69602
  IAMClient2.Default(config2?.iam),
69407
69603
  LambdaClient2.Default(config2?.lambda),
69408
- ResourceGroupsTaggingAPIClient2.Default(config2?.resource_groups_tagging_api)
69604
+ ResourceGroupsTaggingAPIClient2.Default(config2?.resource_groups_tagging_api),
69605
+ SSMClient2.Default(config2?.ssm)
69409
69606
  );
69410
69607
 
69411
69608
  // src/aws/lambda.ts
@@ -69417,12 +69614,13 @@ var arraysEqual = (a, b) => {
69417
69614
  return sortedA.every((v, i) => v === sortedB[i]);
69418
69615
  };
69419
69616
  var ensureLambda = (config2) => Effect_exports.gen(function* () {
69420
- const functionName = `${config2.project}-${config2.name}`;
69617
+ const functionName = `${config2.project}-${config2.stage}-${config2.name}`;
69421
69618
  const memory = config2.memory;
69422
69619
  const timeout4 = config2.timeout;
69423
69620
  const handler = config2.handler ?? "index.handler";
69424
69621
  const runtime5 = config2.runtime ?? Runtime2.nodejs22x;
69425
69622
  const layers = config2.layers ?? [];
69623
+ const environment2 = config2.environment ?? {};
69426
69624
  const existingFunction = yield* lambda_exports.make("get_function", {
69427
69625
  FunctionName: functionName
69428
69626
  }).pipe(
@@ -69438,7 +69636,10 @@ var ensureLambda = (config2) => Effect_exports.gen(function* () {
69438
69636
  const codeChanged = existingHash !== newHash;
69439
69637
  const existingLayers = existingFunction.Layers?.map((l) => l.Arn).filter(Boolean) ?? [];
69440
69638
  const layersChanged = !arraysEqual(existingLayers, layers);
69441
- const configChanged = existingFunction.MemorySize !== memory || existingFunction.Timeout !== timeout4 || existingFunction.Handler !== handler || existingFunction.Runtime !== runtime5 || layersChanged;
69639
+ const existingEnv = existingFunction.Environment?.Variables ?? {};
69640
+ const envKeys = [.../* @__PURE__ */ new Set([...Object.keys(existingEnv), ...Object.keys(environment2)])].sort();
69641
+ const envChanged = envKeys.some((k) => existingEnv[k] !== environment2[k]);
69642
+ const configChanged = existingFunction.MemorySize !== memory || existingFunction.Timeout !== timeout4 || existingFunction.Handler !== handler || existingFunction.Runtime !== runtime5 || layersChanged || envChanged;
69442
69643
  if (!codeChanged && !configChanged) {
69443
69644
  yield* Effect_exports.logInfo(`Function ${functionName} unchanged, skipping update`);
69444
69645
  return existingFunction.FunctionArn;
@@ -69461,7 +69662,8 @@ var ensureLambda = (config2) => Effect_exports.gen(function* () {
69461
69662
  Timeout: timeout4,
69462
69663
  Handler: handler,
69463
69664
  Runtime: runtime5,
69464
- Layers: layers.length > 0 ? layers : void 0
69665
+ Layers: layers.length > 0 ? layers : void 0,
69666
+ Environment: Object.keys(environment2).length > 0 ? { Variables: environment2 } : void 0
69465
69667
  });
69466
69668
  yield* updateConfig.pipe(
69467
69669
  Effect_exports.catchIf(
@@ -69491,7 +69693,8 @@ var ensureLambda = (config2) => Effect_exports.gen(function* () {
69491
69693
  MemorySize: memory,
69492
69694
  Timeout: timeout4,
69493
69695
  Tags: config2.tags,
69494
- Layers: layers.length > 0 ? layers : void 0
69696
+ Layers: layers.length > 0 ? layers : void 0,
69697
+ Environment: Object.keys(environment2).length > 0 ? { Variables: environment2 } : void 0
69495
69698
  });
69496
69699
  yield* waitForFunctionActive(functionName);
69497
69700
  return createResult.FunctionArn;
@@ -69573,8 +69776,8 @@ var LAMBDA_ASSUME_ROLE_POLICY = JSON.stringify({
69573
69776
  ]
69574
69777
  });
69575
69778
  var BASIC_EXECUTION_POLICY_ARN = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole";
69576
- var ensureRole = (project2, name, additionalActions, tags2) => Effect_exports.gen(function* () {
69577
- const roleName = `${project2}-${name}-role`;
69779
+ var ensureRole = (project2, stage, name, additionalActions, tags2) => Effect_exports.gen(function* () {
69780
+ const roleName = `${project2}-${stage}-${name}-role`;
69578
69781
  const existingRole = yield* iam_exports.make("get_role", { RoleName: roleName }).pipe(
69579
69782
  Effect_exports.map((r) => r.Role),
69580
69783
  Effect_exports.catchIf(
@@ -69836,7 +70039,7 @@ var deleteTable = (tableName) => Effect_exports.gen(function* () {
69836
70039
 
69837
70040
  // src/aws/apigateway.ts
69838
70041
  var ensureProjectApi = (config2) => Effect_exports.gen(function* () {
69839
- const apiName = config2.projectName;
70042
+ const apiName = `${config2.projectName}-${config2.stage}`;
69840
70043
  const existingApis = yield* apigatewayv2_exports.make("get_apis", {});
69841
70044
  const existingApi = existingApis.Items?.find((api) => api.Name === apiName);
69842
70045
  let apiId;
@@ -69943,7 +70146,6 @@ import * as fs from "fs/promises";
69943
70146
  import * as fsSync from "fs";
69944
70147
  import * as path4 from "path";
69945
70148
  import archiver from "archiver";
69946
- import { nodeFileTrace } from "@vercel/nft";
69947
70149
  var FIXED_DATE = /* @__PURE__ */ new Date(0);
69948
70150
  var getPackageVersion = (pkgPath) => {
69949
70151
  const pkgJsonPath = path4.join(pkgPath, "package.json");
@@ -69960,7 +70162,7 @@ var computeLockfileHash = (projectDir) => Effect_exports.gen(function* () {
69960
70162
  if (prodDeps.length === 0) {
69961
70163
  return yield* Effect_exports.fail(new Error("No production dependencies"));
69962
70164
  }
69963
- const allPackages = collectTransitiveDeps(projectDir, prodDeps);
70165
+ const { packages: allPackages } = collectTransitiveDeps(projectDir, prodDeps);
69964
70166
  const packageVersions = [];
69965
70167
  for (const pkgName of Array.from(allPackages).sort()) {
69966
70168
  const pkgPath = findInPnpmStore(projectDir, pkgName) ?? getPackageRealPath(projectDir, pkgName);
@@ -69986,20 +70188,6 @@ var readProductionDependencies = (projectDir) => Effect_exports.gen(function* ()
69986
70188
  const pkg = JSON.parse(content);
69987
70189
  return Object.keys(pkg.dependencies ?? {});
69988
70190
  });
69989
- var extractPackageName = (filePath) => {
69990
- const nodeModulesIndex = filePath.lastIndexOf("node_modules");
69991
- if (nodeModulesIndex === -1) return null;
69992
- const afterNodeModules = filePath.slice(nodeModulesIndex + "node_modules/".length);
69993
- const parts2 = afterNodeModules.split("/");
69994
- const firstPart = parts2[0];
69995
- if (!firstPart) return null;
69996
- if (firstPart.startsWith("@") && parts2.length >= 2) {
69997
- const secondPart = parts2[1];
69998
- if (!secondPart) return null;
69999
- return `${firstPart}/${secondPart}`;
70000
- }
70001
- return firstPart;
70002
- };
70003
70191
  var getPackageRealPath = (projectDir, pkgName) => {
70004
70192
  const pkgPath = path4.join(projectDir, "node_modules", pkgName);
70005
70193
  if (!fsSync.existsSync(pkgPath)) return null;
@@ -70009,33 +70197,6 @@ var getPackageRealPath = (projectDir, pkgName) => {
70009
70197
  return null;
70010
70198
  }
70011
70199
  };
70012
- var findPackageEntryPoint = (depPath) => {
70013
- const pkgJsonPath = path4.join(depPath, "package.json");
70014
- if (!fsSync.existsSync(pkgJsonPath)) return null;
70015
- try {
70016
- const pkgJson = JSON.parse(fsSync.readFileSync(pkgJsonPath, "utf-8"));
70017
- const candidates = [
70018
- pkgJson.main,
70019
- pkgJson.module,
70020
- pkgJson.exports?.["."]?.require,
70021
- pkgJson.exports?.["."]?.import,
70022
- pkgJson.exports?.["."]?.default,
70023
- typeof pkgJson.exports === "string" ? pkgJson.exports : null,
70024
- "index.js",
70025
- "index.cjs",
70026
- "index.mjs"
70027
- ].filter(Boolean);
70028
- for (const candidate of candidates) {
70029
- const entryPath = path4.join(depPath, candidate);
70030
- if (fsSync.existsSync(entryPath) && fsSync.statSync(entryPath).isFile()) {
70031
- return entryPath;
70032
- }
70033
- }
70034
- return null;
70035
- } catch {
70036
- return null;
70037
- }
70038
- };
70039
70200
  var getPackageDeps = (pkgPath) => {
70040
70201
  const pkgJsonPath = path4.join(pkgPath, "package.json");
70041
70202
  if (!fsSync.existsSync(pkgJsonPath)) return [];
@@ -70070,7 +70231,7 @@ var findInPnpmStore = (projectDir, pkgName) => {
70070
70231
  }
70071
70232
  return null;
70072
70233
  };
70073
- var collectTransitiveDeps = (projectDir, rootDeps, searchPath = path4.join(projectDir, "node_modules"), visited = /* @__PURE__ */ new Set()) => {
70234
+ var collectTransitiveDeps = (projectDir, rootDeps, searchPath = path4.join(projectDir, "node_modules"), visited = /* @__PURE__ */ new Set(), warnings = []) => {
70074
70235
  const rootNodeModules = path4.join(projectDir, "node_modules");
70075
70236
  for (const dep of rootDeps) {
70076
70237
  if (visited.has(dep)) continue;
@@ -70079,7 +70240,8 @@ var collectTransitiveDeps = (projectDir, rootDeps, searchPath = path4.join(proje
70079
70240
  if (fsSync.existsSync(pkgPath)) {
70080
70241
  try {
70081
70242
  realPath2 = fsSync.realpathSync(pkgPath);
70082
- } catch {
70243
+ } catch (err) {
70244
+ warnings.push(`realpathSync failed for "${dep}" at ${pkgPath}: ${err instanceof Error ? err.message : String(err)}`);
70083
70245
  }
70084
70246
  }
70085
70247
  if (!realPath2 && searchPath !== rootNodeModules) {
@@ -70087,52 +70249,50 @@ var collectTransitiveDeps = (projectDir, rootDeps, searchPath = path4.join(proje
70087
70249
  if (fsSync.existsSync(pkgPath)) {
70088
70250
  try {
70089
70251
  realPath2 = fsSync.realpathSync(pkgPath);
70090
- } catch {
70252
+ } catch (err) {
70253
+ warnings.push(`realpathSync failed for "${dep}" at ${pkgPath}: ${err instanceof Error ? err.message : String(err)}`);
70091
70254
  }
70092
70255
  }
70093
70256
  }
70094
70257
  if (!realPath2) {
70095
70258
  realPath2 = findInPnpmStore(projectDir, dep);
70096
70259
  }
70097
- if (!realPath2) continue;
70260
+ if (!realPath2) {
70261
+ warnings.push(`Package "${dep}" not found (searched: ${searchPath}, root node_modules, pnpm store) \u2014 entire subtree skipped`);
70262
+ continue;
70263
+ }
70098
70264
  visited.add(dep);
70099
70265
  const pkgDeps = getPackageDeps(realPath2);
70100
70266
  if (pkgDeps.length > 0) {
70101
70267
  const isScoped = dep.startsWith("@");
70102
70268
  const pkgNodeModules = isScoped ? path4.dirname(path4.dirname(realPath2)) : path4.dirname(realPath2);
70103
- collectTransitiveDeps(projectDir, pkgDeps, pkgNodeModules, visited);
70269
+ collectTransitiveDeps(projectDir, pkgDeps, pkgNodeModules, visited, warnings);
70104
70270
  }
70105
70271
  }
70106
- return visited;
70272
+ return { packages: visited, warnings };
70107
70273
  };
70108
- var collectLayerPackages = async (projectDir, dependencies) => {
70109
- if (dependencies.length === 0) return [];
70110
- const packages = collectTransitiveDeps(projectDir, dependencies);
70111
- const entryPoints = [];
70112
- for (const dep of dependencies) {
70113
- const pkgPath = path4.join(projectDir, "node_modules", dep);
70114
- if (fsSync.existsSync(pkgPath)) {
70115
- const entryPoint = findPackageEntryPoint(pkgPath);
70116
- if (entryPoint) {
70117
- entryPoints.push(entryPoint);
70118
- }
70119
- }
70120
- }
70121
- if (entryPoints.length > 0) {
70122
- try {
70123
- const { fileList } = await nodeFileTrace(entryPoints, {
70124
- base: projectDir
70125
- });
70126
- for (const file6 of fileList) {
70127
- const pkgName = extractPackageName(path4.join(projectDir, file6));
70128
- if (pkgName) {
70129
- packages.add(pkgName);
70274
+ var isAwsRuntime = (pkg) => pkg.startsWith("@aws-sdk/") || pkg.startsWith("@smithy/");
70275
+ var collectLayerPackages = (projectDir, dependencies) => {
70276
+ if (dependencies.length === 0) return { packages: [], warnings: [] };
70277
+ const { packages, warnings } = collectTransitiveDeps(projectDir, dependencies);
70278
+ let changed = true;
70279
+ while (changed) {
70280
+ changed = false;
70281
+ for (const pkg of [...packages]) {
70282
+ if (isAwsRuntime(pkg)) continue;
70283
+ const pkgPath = findPackagePath(projectDir, pkg);
70284
+ if (!pkgPath) continue;
70285
+ const pkgDeps = getPackageDeps(pkgPath);
70286
+ for (const dep of pkgDeps) {
70287
+ if (!packages.has(dep) && !isAwsRuntime(dep)) {
70288
+ packages.add(dep);
70289
+ warnings.push(`Auto-added missing transitive dep: "${dep}" (required by "${pkg}")`);
70290
+ changed = true;
70130
70291
  }
70131
70292
  }
70132
- } catch {
70133
70293
  }
70134
70294
  }
70135
- return Array.from(packages);
70295
+ return { packages: Array.from(packages), warnings };
70136
70296
  };
70137
70297
  var findPackagePath = (projectDir, pkgName) => {
70138
70298
  const rootPath = getPackageRealPath(projectDir, pkgName);
@@ -70205,13 +70365,16 @@ var ensureLayer = (config2) => Effect_exports.gen(function* () {
70205
70365
  if (!hash2) {
70206
70366
  return null;
70207
70367
  }
70208
- const layerName = `${config2.project}-deps`;
70368
+ const layerName = `${config2.project}-${config2.stage}-deps`;
70209
70369
  const existing = yield* getExistingLayerByHash(layerName, hash2);
70210
70370
  if (existing) {
70211
70371
  yield* Effect_exports.logInfo(`Layer ${layerName} with hash ${hash2} already exists (version ${existing.version})`);
70212
70372
  return existing;
70213
70373
  }
70214
- const allPackages = yield* Effect_exports.promise(() => collectLayerPackages(config2.projectDir, dependencies));
70374
+ const { packages: allPackages, warnings: layerWarnings } = yield* Effect_exports.sync(() => collectLayerPackages(config2.projectDir, dependencies));
70375
+ for (const warning of layerWarnings) {
70376
+ yield* Effect_exports.logWarning(`[layer] ${warning}`);
70377
+ }
70215
70378
  yield* Effect_exports.logInfo(`Creating layer ${layerName} with ${allPackages.length} packages (hash: ${hash2})`);
70216
70379
  yield* Effect_exports.logDebug(`Layer packages: ${allPackages.join(", ")}`);
70217
70380
  const { buffer: layerZip, includedPackages, skippedPackages } = yield* createLayerZip(config2.projectDir, allPackages);
@@ -70276,6 +70439,7 @@ import { unmarshall, marshall } from "@aws-sdk/util-dynamodb";
70276
70439
  import * as esbuild from "esbuild";
70277
70440
  import * as fsSync2 from "fs";
70278
70441
  import * as path5 from "path";
70442
+ import { fileURLToPath as fileURLToPath2 } from "url";
70279
70443
  import archiver2 from "archiver";
70280
70444
  import { globSync } from "glob";
70281
70445
 
@@ -70285,7 +70449,7 @@ var parseSource = (source) => {
70285
70449
  const project2 = new Project({ useInMemoryFileSystem: true });
70286
70450
  return project2.createSourceFile("input.ts", source);
70287
70451
  };
70288
- var RUNTIME_PROPS = ["onRequest", "onRecord", "onBatchComplete", "context"];
70452
+ var RUNTIME_PROPS = ["onRequest", "onRecord", "onBatchComplete", "onBatch", "context", "schema", "onError", "deps", "params"];
70289
70453
  var buildConfigWithoutRuntime = (obj) => {
70290
70454
  const props = obj.getProperties().filter((p3) => {
70291
70455
  if (p3.getKind() === SyntaxKind.PropertyAssignment) {
@@ -70309,22 +70473,72 @@ var extractPropertyFromObject = (obj, propName) => {
70309
70473
  }
70310
70474
  return void 0;
70311
70475
  };
70476
+ var extractDepsKeys = (obj) => {
70477
+ const depsProp = obj.getProperties().find((p3) => {
70478
+ if (p3.getKind() === SyntaxKind.PropertyAssignment) {
70479
+ return p3.getName() === "deps";
70480
+ }
70481
+ return false;
70482
+ });
70483
+ if (!depsProp || depsProp.getKind() !== SyntaxKind.PropertyAssignment) return [];
70484
+ const init = depsProp.getInitializer();
70485
+ if (!init || init.getKind() !== SyntaxKind.ObjectLiteralExpression) return [];
70486
+ const depsObj = init;
70487
+ return depsObj.getProperties().map((p3) => {
70488
+ if (p3.getKind() === SyntaxKind.ShorthandPropertyAssignment) {
70489
+ return p3.asKindOrThrow(SyntaxKind.ShorthandPropertyAssignment).getName();
70490
+ }
70491
+ if (p3.getKind() === SyntaxKind.PropertyAssignment) {
70492
+ return p3.getName();
70493
+ }
70494
+ return "";
70495
+ }).filter(Boolean);
70496
+ };
70497
+ var extractParamEntries = (obj) => {
70498
+ const paramsProp = obj.getProperties().find((p3) => {
70499
+ if (p3.getKind() === SyntaxKind.PropertyAssignment) {
70500
+ return p3.getName() === "params";
70501
+ }
70502
+ return false;
70503
+ });
70504
+ if (!paramsProp || paramsProp.getKind() !== SyntaxKind.PropertyAssignment) return [];
70505
+ const init = paramsProp.getInitializer();
70506
+ if (!init || init.getKind() !== SyntaxKind.ObjectLiteralExpression) return [];
70507
+ const paramsObj = init;
70508
+ const entries2 = [];
70509
+ for (const p3 of paramsObj.getProperties()) {
70510
+ if (p3.getKind() !== SyntaxKind.PropertyAssignment) continue;
70511
+ const propAssign = p3;
70512
+ const propName = propAssign.getName();
70513
+ const propInit = propAssign.getInitializer();
70514
+ if (!propInit || propInit.getKind() !== SyntaxKind.CallExpression) continue;
70515
+ const callExpr = propInit;
70516
+ const callArgs = callExpr.getArguments();
70517
+ if (callArgs.length === 0) continue;
70518
+ const firstArg = callArgs[0];
70519
+ if (firstArg.getKind() === SyntaxKind.StringLiteral) {
70520
+ const ssmKey = firstArg.asKindOrThrow(SyntaxKind.StringLiteral).getLiteralValue();
70521
+ entries2.push({ propName, ssmKey });
70522
+ }
70523
+ }
70524
+ return entries2;
70525
+ };
70312
70526
  var handlerRegistry = {
70313
70527
  http: {
70314
70528
  defineFn: "defineHttp",
70315
- handlerProp: "onRequest",
70529
+ handlerProps: ["onRequest"],
70316
70530
  wrapperFn: "wrapHttp",
70317
70531
  wrapperPath: "~/runtime/wrap-http"
70318
70532
  },
70319
70533
  table: {
70320
70534
  defineFn: "defineTable",
70321
- handlerProp: "onRecord",
70535
+ handlerProps: ["onRecord", "onBatch"],
70322
70536
  wrapperFn: "wrapTableStream",
70323
70537
  wrapperPath: "~/runtime/wrap-table-stream"
70324
70538
  }
70325
70539
  };
70326
70540
  var extractHandlerConfigs = (source, type2) => {
70327
- const { defineFn, handlerProp } = handlerRegistry[type2];
70541
+ const { defineFn, handlerProps } = handlerRegistry[type2];
70328
70542
  const sourceFile = parseSource(source);
70329
70543
  const results = [];
70330
70544
  const exportDefault = sourceFile.getExportAssignment((e) => !e.isExportEquals());
@@ -70339,8 +70553,10 @@ var extractHandlerConfigs = (source, type2) => {
70339
70553
  const objLiteral = firstArg;
70340
70554
  const configText = buildConfigWithoutRuntime(objLiteral);
70341
70555
  const configObj = new Function(`return ${configText}`)();
70342
- const hasHandler = extractPropertyFromObject(objLiteral, handlerProp) !== void 0;
70343
- results.push({ exportName: "default", config: configObj, hasHandler });
70556
+ const hasHandler = handlerProps.some((p3) => extractPropertyFromObject(objLiteral, p3) !== void 0);
70557
+ const depsKeys = extractDepsKeys(objLiteral);
70558
+ const paramEntries = extractParamEntries(objLiteral);
70559
+ results.push({ exportName: "default", config: configObj, hasHandler, depsKeys, paramEntries });
70344
70560
  }
70345
70561
  }
70346
70562
  }
@@ -70358,19 +70574,22 @@ var extractHandlerConfigs = (source, type2) => {
70358
70574
  const objLiteral = firstArg;
70359
70575
  const configText = buildConfigWithoutRuntime(objLiteral);
70360
70576
  const configObj = new Function(`return ${configText}`)();
70361
- const hasHandler = extractPropertyFromObject(objLiteral, handlerProp) !== void 0;
70362
- results.push({ exportName: decl.getName(), config: configObj, hasHandler });
70577
+ const hasHandler = handlerProps.some((p3) => extractPropertyFromObject(objLiteral, p3) !== void 0);
70578
+ const depsKeys = extractDepsKeys(objLiteral);
70579
+ const paramEntries = extractParamEntries(objLiteral);
70580
+ results.push({ exportName: decl.getName(), config: configObj, hasHandler, depsKeys, paramEntries });
70363
70581
  }
70364
70582
  });
70365
70583
  });
70366
70584
  return results;
70367
70585
  };
70368
- var generateEntryPoint = (sourcePath, exportName, type2) => {
70586
+ var generateEntryPoint = (sourcePath, exportName, type2, runtimeDir2) => {
70369
70587
  const { wrapperFn, wrapperPath } = handlerRegistry[type2];
70588
+ const resolvedWrapperPath = runtimeDir2 ? wrapperPath.replace("~/runtime", runtimeDir2) : wrapperPath;
70370
70589
  const importName = exportName === "default" ? "__handler" : exportName;
70371
70590
  const importStmt = exportName === "default" ? `import __handler from "${sourcePath}";` : `import { ${exportName} } from "${sourcePath}";`;
70372
70591
  return `${importStmt}
70373
- import { ${wrapperFn} } from "${wrapperPath}";
70592
+ import { ${wrapperFn} } from "${resolvedWrapperPath}";
70374
70593
  export const handler = ${wrapperFn}(${importName});
70375
70594
  `;
70376
70595
  };
@@ -70378,12 +70597,15 @@ export const handler = ${wrapperFn}(${importName});
70378
70597
  // src/build/bundle.ts
70379
70598
  var extractConfigs = (source) => extractHandlerConfigs(source, "http");
70380
70599
  var extractTableConfigs = (source) => extractHandlerConfigs(source, "table");
70600
+ var runtimeDir = path5.resolve(path5.dirname(fileURLToPath2(import.meta.url)), "../../dist/runtime");
70381
70601
  var bundle = (input) => Effect_exports.gen(function* () {
70382
70602
  const exportName = input.exportName ?? "default";
70383
70603
  const type2 = input.type ?? "http";
70384
70604
  const externals = input.external ?? [];
70385
70605
  const sourcePath = path5.isAbsolute(input.file) ? input.file : `./${input.file}`;
70386
- const entryPoint = generateEntryPoint(sourcePath, exportName, type2);
70606
+ const entryPoint = generateEntryPoint(sourcePath, exportName, type2, runtimeDir);
70607
+ const awsExternals = ["@aws-sdk/*", "@smithy/*"];
70608
+ const allExternals = [.../* @__PURE__ */ new Set([...awsExternals, ...externals])];
70387
70609
  const result = yield* Effect_exports.tryPromise({
70388
70610
  try: () => esbuild.build({
70389
70611
  stdin: {
@@ -70398,7 +70620,7 @@ var bundle = (input) => Effect_exports.gen(function* () {
70398
70620
  minify: false,
70399
70621
  sourcemap: false,
70400
70622
  format: input.format ?? "esm",
70401
- ...externals.length > 0 ? { external: externals } : { packages: "bundle" }
70623
+ external: allExternals
70402
70624
  }),
70403
70625
  catch: (error4) => new Error(`esbuild failed: ${error4}`)
70404
70626
  });
@@ -70453,11 +70675,15 @@ var readSource = (input) => Effect_exports.gen(function* () {
70453
70675
  var ensureLayerAndExternal = (input) => Effect_exports.gen(function* () {
70454
70676
  const layerResult = yield* ensureLayer({
70455
70677
  project: input.project,
70678
+ stage: input.stage,
70456
70679
  region: input.region,
70457
70680
  projectDir: input.projectDir
70458
70681
  });
70459
70682
  const prodDeps = layerResult ? yield* readProductionDependencies(input.projectDir) : [];
70460
- const external = prodDeps.length > 0 ? yield* Effect_exports.promise(() => collectLayerPackages(input.projectDir, prodDeps)) : [];
70683
+ const { packages: external, warnings: layerWarnings } = prodDeps.length > 0 ? yield* Effect_exports.sync(() => collectLayerPackages(input.projectDir, prodDeps)) : { packages: [], warnings: [] };
70684
+ for (const warning of layerWarnings) {
70685
+ yield* Effect_exports.logWarning(`[layer] ${warning}`);
70686
+ }
70461
70687
  return {
70462
70688
  layerArn: layerResult?.layerVersionArn,
70463
70689
  external
@@ -70473,7 +70699,9 @@ var deployCoreLambda = ({
70473
70699
  timeout: timeout4 = 30,
70474
70700
  bundleType,
70475
70701
  layerArn,
70476
- external
70702
+ external,
70703
+ depsEnv,
70704
+ depsPermissions
70477
70705
  }) => Effect_exports.gen(function* () {
70478
70706
  const tagCtx = {
70479
70707
  project: input.project,
@@ -70486,10 +70714,12 @@ var deployCoreLambda = ({
70486
70714
  }
70487
70715
  const mergedPermissions = [
70488
70716
  ...defaultPermissions ?? [],
70489
- ...permissions ?? []
70717
+ ...permissions ?? [],
70718
+ ...depsPermissions ?? []
70490
70719
  ];
70491
70720
  const roleArn = yield* ensureRole(
70492
70721
  input.project,
70722
+ tagCtx.stage,
70493
70723
  handlerName,
70494
70724
  mergedPermissions.length > 0 ? mergedPermissions : void 0,
70495
70725
  makeTags(tagCtx, "iam-role")
@@ -70501,8 +70731,15 @@ var deployCoreLambda = ({
70501
70731
  ...external && external.length > 0 ? { external } : {}
70502
70732
  });
70503
70733
  const code2 = yield* zip12({ content: bundled });
70734
+ const environment2 = {
70735
+ EFF_PROJECT: input.project,
70736
+ EFF_STAGE: tagCtx.stage,
70737
+ EFF_HANDLER: handlerName,
70738
+ ...depsEnv
70739
+ };
70504
70740
  const functionArn = yield* ensureLambda({
70505
70741
  project: input.project,
70742
+ stage: tagCtx.stage,
70506
70743
  name: handlerName,
70507
70744
  region: input.region,
70508
70745
  roleArn,
@@ -70510,13 +70747,14 @@ var deployCoreLambda = ({
70510
70747
  memory,
70511
70748
  timeout: timeout4,
70512
70749
  tags: makeTags(tagCtx, "lambda"),
70513
- ...layerArn ? { layers: [layerArn] } : {}
70750
+ ...layerArn ? { layers: [layerArn] } : {},
70751
+ environment: environment2
70514
70752
  });
70515
70753
  return { functionArn, tagCtx };
70516
70754
  });
70517
70755
 
70518
70756
  // src/deploy/deploy-http.ts
70519
- var deployLambda = ({ input, fn: fn2, layerArn, external }) => Effect_exports.gen(function* () {
70757
+ var deployLambda = ({ input, fn: fn2, layerArn, external, depsEnv, depsPermissions }) => Effect_exports.gen(function* () {
70520
70758
  const { exportName, config: config2 } = fn2;
70521
70759
  const handlerName = config2.name ?? exportName;
70522
70760
  const { functionArn } = yield* deployCoreLambda({
@@ -70528,7 +70766,9 @@ var deployLambda = ({ input, fn: fn2, layerArn, external }) => Effect_exports.ge
70528
70766
  ...config2.memory ? { memory: config2.memory } : {},
70529
70767
  ...config2.timeout ? { timeout: config2.timeout } : {},
70530
70768
  ...layerArn ? { layerArn } : {},
70531
- ...external ? { external } : {}
70769
+ ...external ? { external } : {},
70770
+ ...depsEnv ? { depsEnv } : {},
70771
+ ...depsPermissions ? { depsPermissions } : {}
70532
70772
  });
70533
70773
  return { exportName, functionArn, config: config2, handlerName };
70534
70774
  });
@@ -70550,6 +70790,7 @@ var deploy = (input) => Effect_exports.gen(function* () {
70550
70790
  yield* Effect_exports.logInfo(`Deploying ${handlerName} to ${input.region} (${tagCtx.project}/${tagCtx.stage})`);
70551
70791
  const { layerArn, external } = yield* ensureLayerAndExternal({
70552
70792
  project: input.project,
70793
+ stage: tagCtx.stage,
70553
70794
  region: input.region,
70554
70795
  projectDir: input.projectDir
70555
70796
  });
@@ -70562,6 +70803,7 @@ var deploy = (input) => Effect_exports.gen(function* () {
70562
70803
  yield* Effect_exports.logInfo("Setting up API Gateway...");
70563
70804
  const { apiId } = yield* ensureProjectApi({
70564
70805
  projectName: input.project,
70806
+ stage: tagCtx.stage,
70565
70807
  region: input.region,
70566
70808
  tags: makeTags(tagCtx, "api-gateway")
70567
70809
  });
@@ -70594,19 +70836,21 @@ var deployAll = (input) => Effect_exports.gen(function* () {
70594
70836
  return yield* Effect_exports.fail(new Error("No defineHttp exports found in source"));
70595
70837
  }
70596
70838
  yield* Effect_exports.logInfo(`Found ${functions.length} HTTP handler(s) to deploy`);
70597
- const { layerArn, external } = yield* ensureLayerAndExternal({
70598
- project: input.project,
70599
- region: input.region,
70600
- projectDir: input.projectDir
70601
- });
70602
70839
  const tagCtx = {
70603
70840
  project: input.project,
70604
70841
  stage: resolveStage(input.stage),
70605
70842
  handler: "api"
70606
70843
  };
70844
+ const { layerArn, external } = yield* ensureLayerAndExternal({
70845
+ project: input.project,
70846
+ stage: tagCtx.stage,
70847
+ region: input.region,
70848
+ projectDir: input.projectDir
70849
+ });
70607
70850
  yield* Effect_exports.logInfo("Setting up API Gateway...");
70608
70851
  const { apiId } = yield* ensureProjectApi({
70609
70852
  projectName: input.project,
70853
+ stage: tagCtx.stage,
70610
70854
  region: input.region,
70611
70855
  tags: makeTags(tagCtx, "api-gateway")
70612
70856
  });
@@ -70647,7 +70891,7 @@ var deployAll = (input) => Effect_exports.gen(function* () {
70647
70891
 
70648
70892
  // src/deploy/deploy-table.ts
70649
70893
  var TABLE_DEFAULT_PERMISSIONS = ["dynamodb:*", "logs:*"];
70650
- var deployTableFunction = ({ input, fn: fn2, layerArn, external }) => Effect_exports.gen(function* () {
70894
+ var deployTableFunction = ({ input, fn: fn2, layerArn, external, depsEnv, depsPermissions }) => Effect_exports.gen(function* () {
70651
70895
  const { exportName, config: config2 } = fn2;
70652
70896
  const handlerName = config2.name ?? exportName;
70653
70897
  const tagCtx = {
@@ -70656,7 +70900,7 @@ var deployTableFunction = ({ input, fn: fn2, layerArn, external }) => Effect_exp
70656
70900
  handler: handlerName
70657
70901
  };
70658
70902
  yield* Effect_exports.logInfo("Creating DynamoDB table...");
70659
- const tableName = `${input.project}-${handlerName}`;
70903
+ const tableName = `${input.project}-${tagCtx.stage}-${handlerName}`;
70660
70904
  const { tableArn, streamArn } = yield* ensureTable({
70661
70905
  name: tableName,
70662
70906
  pk: config2.pk,
@@ -70665,6 +70909,7 @@ var deployTableFunction = ({ input, fn: fn2, layerArn, external }) => Effect_exp
70665
70909
  streamView: config2.streamView ?? "NEW_AND_OLD_IMAGES",
70666
70910
  tags: makeTags(tagCtx, "dynamodb")
70667
70911
  });
70912
+ const selfEnv = { EFF_TABLE_SELF: tableName, ...depsEnv };
70668
70913
  const { functionArn } = yield* deployCoreLambda({
70669
70914
  input,
70670
70915
  exportName,
@@ -70675,7 +70920,9 @@ var deployTableFunction = ({ input, fn: fn2, layerArn, external }) => Effect_exp
70675
70920
  ...config2.memory ? { memory: config2.memory } : {},
70676
70921
  ...config2.timeout ? { timeout: config2.timeout } : {},
70677
70922
  ...layerArn ? { layerArn } : {},
70678
- ...external ? { external } : {}
70923
+ ...external ? { external } : {},
70924
+ depsEnv: selfEnv,
70925
+ ...depsPermissions ? { depsPermissions } : {}
70679
70926
  });
70680
70927
  yield* Effect_exports.logInfo("Setting up event source mapping...");
70681
70928
  yield* ensureEventSourceMapping({
@@ -70703,6 +70950,7 @@ var deployTable = (input) => Effect_exports.gen(function* () {
70703
70950
  const fn2 = configs.find((c) => c.exportName === targetExport) ?? configs[0];
70704
70951
  const { layerArn, external } = yield* ensureLayerAndExternal({
70705
70952
  project: input.project,
70953
+ stage: resolveStage(input.stage),
70706
70954
  region: input.region,
70707
70955
  projectDir: input.projectDir
70708
70956
  });
@@ -70731,6 +70979,7 @@ var deployAllTables = (input) => Effect_exports.gen(function* () {
70731
70979
  yield* Effect_exports.logInfo(`Found ${functions.length} table handler(s) to deploy`);
70732
70980
  const { layerArn, external } = yield* ensureLayerAndExternal({
70733
70981
  project: input.project,
70982
+ stage: resolveStage(input.stage),
70734
70983
  region: input.region,
70735
70984
  projectDir: input.projectDir
70736
70985
  });
@@ -70759,6 +71008,7 @@ var deployAllTables = (input) => Effect_exports.gen(function* () {
70759
71008
  var prepareLayer = (input) => Effect_exports.gen(function* () {
70760
71009
  const layerResult = yield* ensureLayer({
70761
71010
  project: input.project,
71011
+ stage: input.stage,
70762
71012
  region: input.region,
70763
71013
  projectDir: input.projectDir
70764
71014
  }).pipe(
@@ -70769,7 +71019,10 @@ var prepareLayer = (input) => Effect_exports.gen(function* () {
70769
71019
  )
70770
71020
  );
70771
71021
  const prodDeps = layerResult ? yield* readProductionDependencies(input.projectDir) : [];
70772
- const external = prodDeps.length > 0 ? yield* Effect_exports.promise(() => collectLayerPackages(input.projectDir, prodDeps)) : [];
71022
+ const { packages: external, warnings: layerWarnings } = prodDeps.length > 0 ? yield* Effect_exports.sync(() => collectLayerPackages(input.projectDir, prodDeps)) : { packages: [], warnings: [] };
71023
+ for (const warning of layerWarnings) {
71024
+ yield* Effect_exports.logWarning(`[layer] ${warning}`);
71025
+ }
70773
71026
  yield* Effect_exports.logDebug(`Layer result: ${layerResult ? "exists" : "null"}, external packages: ${external.length}`);
70774
71027
  if (external.length > 0) {
70775
71028
  yield* Effect_exports.logInfo(`Bundling with ${external.length} external packages from layer`);
@@ -70779,6 +71032,57 @@ var prepareLayer = (input) => Effect_exports.gen(function* () {
70779
71032
  external
70780
71033
  };
70781
71034
  });
71035
+ var TABLE_CLIENT_PERMISSIONS = [
71036
+ "dynamodb:GetItem",
71037
+ "dynamodb:PutItem",
71038
+ "dynamodb:DeleteItem",
71039
+ "dynamodb:Query",
71040
+ "dynamodb:Scan",
71041
+ "dynamodb:UpdateItem",
71042
+ "dynamodb:BatchGetItem",
71043
+ "dynamodb:BatchWriteItem"
71044
+ ];
71045
+ var buildTableNameMap = (tableHandlers, project2, stage) => {
71046
+ const map36 = /* @__PURE__ */ new Map();
71047
+ for (const { exports } of tableHandlers) {
71048
+ for (const fn2 of exports) {
71049
+ const handlerName = fn2.config.name ?? fn2.exportName;
71050
+ map36.set(fn2.exportName, `${project2}-${stage}-${handlerName}`);
71051
+ }
71052
+ }
71053
+ return map36;
71054
+ };
71055
+ var resolveDeps = (depsKeys, tableNameMap) => {
71056
+ if (depsKeys.length === 0) return void 0;
71057
+ const depsEnv = {};
71058
+ for (const key of depsKeys) {
71059
+ const tableName = tableNameMap.get(key);
71060
+ if (tableName) {
71061
+ depsEnv[`EFF_TABLE_${key}`] = tableName;
71062
+ }
71063
+ }
71064
+ if (Object.keys(depsEnv).length === 0) return void 0;
71065
+ return { depsEnv, depsPermissions: TABLE_CLIENT_PERMISSIONS };
71066
+ };
71067
+ var SSM_PERMISSIONS = [
71068
+ "ssm:GetParameter",
71069
+ "ssm:GetParameters"
71070
+ ];
71071
+ var resolveParams = (paramEntries, project2, stage) => {
71072
+ if (paramEntries.length === 0) return void 0;
71073
+ const paramsEnv = {};
71074
+ for (const { propName, ssmKey } of paramEntries) {
71075
+ paramsEnv[`EFF_PARAM_${propName}`] = `/${project2}/${stage}/${ssmKey}`;
71076
+ }
71077
+ return { paramsEnv, paramsPermissions: SSM_PERMISSIONS };
71078
+ };
71079
+ var mergeResolved = (deps, params) => {
71080
+ if (!deps && !params) return void 0;
71081
+ const env2 = { ...deps?.depsEnv, ...params?.paramsEnv };
71082
+ const permissions = [...deps?.depsPermissions ?? [], ...params?.paramsPermissions ?? []];
71083
+ if (Object.keys(env2).length === 0) return void 0;
71084
+ return { depsEnv: env2, depsPermissions: permissions };
71085
+ };
70782
71086
  var deployHttpHandlers = (ctx) => Effect_exports.gen(function* () {
70783
71087
  const results = [];
70784
71088
  for (const { file: file6, exports } of ctx.handlers) {
@@ -70791,11 +71095,17 @@ var deployHttpHandlers = (ctx) => Effect_exports.gen(function* () {
70791
71095
  };
70792
71096
  if (ctx.input.stage) deployInput.stage = ctx.input.stage;
70793
71097
  for (const fn2 of exports) {
71098
+ const stage = resolveStage(ctx.input.stage);
71099
+ const resolved = mergeResolved(
71100
+ resolveDeps(fn2.depsKeys, ctx.tableNameMap),
71101
+ resolveParams(fn2.paramEntries, ctx.input.project, stage)
71102
+ );
70794
71103
  const { exportName, functionArn, config: config2 } = yield* deployLambda({
70795
71104
  input: deployInput,
70796
71105
  fn: fn2,
70797
71106
  ...ctx.layerArn ? { layerArn: ctx.layerArn } : {},
70798
- ...ctx.external.length > 0 ? { external: ctx.external } : {}
71107
+ ...ctx.external.length > 0 ? { external: ctx.external } : {},
71108
+ ...resolved ? { depsEnv: resolved.depsEnv, depsPermissions: resolved.depsPermissions } : {}
70799
71109
  }).pipe(
70800
71110
  Effect_exports.provide(
70801
71111
  clients_exports.makeClients({
@@ -70836,11 +71146,17 @@ var deployTableHandlers = (ctx) => Effect_exports.gen(function* () {
70836
71146
  };
70837
71147
  if (ctx.input.stage) deployInput.stage = ctx.input.stage;
70838
71148
  for (const fn2 of exports) {
71149
+ const stage = resolveStage(ctx.input.stage);
71150
+ const resolved = mergeResolved(
71151
+ resolveDeps(fn2.depsKeys, ctx.tableNameMap),
71152
+ resolveParams(fn2.paramEntries, ctx.input.project, stage)
71153
+ );
70839
71154
  const result = yield* deployTableFunction({
70840
71155
  input: deployInput,
70841
71156
  fn: fn2,
70842
71157
  ...ctx.layerArn ? { layerArn: ctx.layerArn } : {},
70843
- ...ctx.external.length > 0 ? { external: ctx.external } : {}
71158
+ ...ctx.external.length > 0 ? { external: ctx.external } : {},
71159
+ ...resolved ? { depsEnv: resolved.depsEnv, depsPermissions: resolved.depsPermissions } : {}
70844
71160
  }).pipe(
70845
71161
  Effect_exports.provide(
70846
71162
  clients_exports.makeClients({
@@ -70868,8 +71184,10 @@ var deployProject = (input) => Effect_exports.gen(function* () {
70868
71184
  return yield* Effect_exports.fail(new Error("No handlers found in matched files"));
70869
71185
  }
70870
71186
  yield* Effect_exports.logInfo(`Discovered ${totalHttpHandlers} HTTP handler(s) and ${totalTableHandlers} table handler(s)`);
71187
+ const tableNameMap = buildTableNameMap(tableHandlers, input.project, resolveStage(input.stage));
70871
71188
  const { layerArn, external } = yield* prepareLayer({
70872
71189
  project: input.project,
71190
+ stage: resolveStage(input.stage),
70873
71191
  region: input.region,
70874
71192
  projectDir: input.projectDir
70875
71193
  });
@@ -70884,6 +71202,7 @@ var deployProject = (input) => Effect_exports.gen(function* () {
70884
71202
  yield* Effect_exports.logInfo("Setting up API Gateway...");
70885
71203
  const api = yield* ensureProjectApi({
70886
71204
  projectName: input.project,
71205
+ stage: tagCtx.stage,
70887
71206
  region: input.region,
70888
71207
  tags: makeTags(tagCtx, "api-gateway")
70889
71208
  }).pipe(
@@ -70901,13 +71220,15 @@ var deployProject = (input) => Effect_exports.gen(function* () {
70901
71220
  apiId,
70902
71221
  input,
70903
71222
  layerArn,
70904
- external
71223
+ external,
71224
+ tableNameMap
70905
71225
  }) : [];
70906
71226
  const tableResults = yield* deployTableHandlers({
70907
71227
  handlers: tableHandlers,
70908
71228
  input,
70909
71229
  layerArn,
70910
- external
71230
+ external,
71231
+ tableNameMap
70911
71232
  });
70912
71233
  if (apiUrl) {
70913
71234
  yield* Effect_exports.logInfo(`Deployment complete! API: ${apiUrl}`);
@@ -71184,7 +71505,10 @@ var buildCommand = Command_exports.make(
71184
71505
  const prodDeps = yield* readProductionDependencies(projectDir).pipe(
71185
71506
  Effect_exports.catchAll(() => Effect_exports.succeed([]))
71186
71507
  );
71187
- const external = prodDeps.length > 0 ? yield* Effect_exports.promise(() => collectLayerPackages(projectDir, prodDeps)) : [];
71508
+ const { packages: external, warnings: layerWarnings } = prodDeps.length > 0 ? yield* Effect_exports.sync(() => collectLayerPackages(projectDir, prodDeps)) : { packages: [], warnings: [] };
71509
+ for (const warning of layerWarnings) {
71510
+ yield* Effect_exports.logWarning(`[layer] ${warning}`);
71511
+ }
71188
71512
  if (external.length > 0) {
71189
71513
  yield* Console_exports.log(`Using ${external.length} external packages (from layer)
71190
71514
  `);
@@ -71700,7 +72024,14 @@ Lockfile hash: ${hash2}`);
71700
72024
  } else {
71701
72025
  yield* Console_exports.log("\nNo lockfile found (package-lock.json, pnpm-lock.yaml, or yarn.lock)");
71702
72026
  }
71703
- const allPackages = yield* Effect_exports.promise(() => collectLayerPackages(projectDir, prodDeps));
72027
+ const { packages: allPackages, warnings: layerWarnings } = yield* Effect_exports.sync(() => collectLayerPackages(projectDir, prodDeps));
72028
+ if (layerWarnings.length > 0) {
72029
+ yield* Console_exports.log(`
72030
+ Warnings (${layerWarnings.length}):`);
72031
+ for (const w of layerWarnings) {
72032
+ yield* Console_exports.log(` \u26A0 ${w}`);
72033
+ }
72034
+ }
71704
72035
  yield* Console_exports.log(`
71705
72036
  Total packages for layer (${allPackages.length}):`);
71706
72037
  if (verbose) {
@@ -71829,7 +72160,14 @@ var layersBuildCommand = Command_exports.make(
71829
72160
  );
71830
72161
  yield* Console_exports.log(`
71831
72162
  Lockfile hash: ${hash2}`);
71832
- const allPackages = yield* Effect_exports.promise(() => collectLayerPackages(projectDir, prodDeps));
72163
+ const { packages: allPackages, warnings: layerWarnings } = yield* Effect_exports.sync(() => collectLayerPackages(projectDir, prodDeps));
72164
+ if (layerWarnings.length > 0) {
72165
+ yield* Console_exports.log(`
72166
+ Warnings (${layerWarnings.length}):`);
72167
+ for (const w of layerWarnings) {
72168
+ yield* Console_exports.log(` \u26A0 ${w}`);
72169
+ }
72170
+ }
71833
72171
  yield* Console_exports.log(`
71834
72172
  Collected ${allPackages.length} packages for layer`);
71835
72173
  if (verbose) {