effortless-aws 0.0.1 → 0.1.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.
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;
@@ -70205,7 +70408,7 @@ var ensureLayer = (config2) => Effect_exports.gen(function* () {
70205
70408
  if (!hash2) {
70206
70409
  return null;
70207
70410
  }
70208
- const layerName = `${config2.project}-deps`;
70411
+ const layerName = `${config2.project}-${config2.stage}-deps`;
70209
70412
  const existing = yield* getExistingLayerByHash(layerName, hash2);
70210
70413
  if (existing) {
70211
70414
  yield* Effect_exports.logInfo(`Layer ${layerName} with hash ${hash2} already exists (version ${existing.version})`);
@@ -70276,6 +70479,7 @@ import { unmarshall, marshall } from "@aws-sdk/util-dynamodb";
70276
70479
  import * as esbuild from "esbuild";
70277
70480
  import * as fsSync2 from "fs";
70278
70481
  import * as path5 from "path";
70482
+ import { fileURLToPath as fileURLToPath2 } from "url";
70279
70483
  import archiver2 from "archiver";
70280
70484
  import { globSync } from "glob";
70281
70485
 
@@ -70285,7 +70489,7 @@ var parseSource = (source) => {
70285
70489
  const project2 = new Project({ useInMemoryFileSystem: true });
70286
70490
  return project2.createSourceFile("input.ts", source);
70287
70491
  };
70288
- var RUNTIME_PROPS = ["onRequest", "onRecord", "onBatchComplete", "context"];
70492
+ var RUNTIME_PROPS = ["onRequest", "onRecord", "onBatchComplete", "onBatch", "context", "schema", "onError", "deps", "params"];
70289
70493
  var buildConfigWithoutRuntime = (obj) => {
70290
70494
  const props = obj.getProperties().filter((p3) => {
70291
70495
  if (p3.getKind() === SyntaxKind.PropertyAssignment) {
@@ -70309,22 +70513,72 @@ var extractPropertyFromObject = (obj, propName) => {
70309
70513
  }
70310
70514
  return void 0;
70311
70515
  };
70516
+ var extractDepsKeys = (obj) => {
70517
+ const depsProp = obj.getProperties().find((p3) => {
70518
+ if (p3.getKind() === SyntaxKind.PropertyAssignment) {
70519
+ return p3.getName() === "deps";
70520
+ }
70521
+ return false;
70522
+ });
70523
+ if (!depsProp || depsProp.getKind() !== SyntaxKind.PropertyAssignment) return [];
70524
+ const init = depsProp.getInitializer();
70525
+ if (!init || init.getKind() !== SyntaxKind.ObjectLiteralExpression) return [];
70526
+ const depsObj = init;
70527
+ return depsObj.getProperties().map((p3) => {
70528
+ if (p3.getKind() === SyntaxKind.ShorthandPropertyAssignment) {
70529
+ return p3.asKindOrThrow(SyntaxKind.ShorthandPropertyAssignment).getName();
70530
+ }
70531
+ if (p3.getKind() === SyntaxKind.PropertyAssignment) {
70532
+ return p3.getName();
70533
+ }
70534
+ return "";
70535
+ }).filter(Boolean);
70536
+ };
70537
+ var extractParamEntries = (obj) => {
70538
+ const paramsProp = obj.getProperties().find((p3) => {
70539
+ if (p3.getKind() === SyntaxKind.PropertyAssignment) {
70540
+ return p3.getName() === "params";
70541
+ }
70542
+ return false;
70543
+ });
70544
+ if (!paramsProp || paramsProp.getKind() !== SyntaxKind.PropertyAssignment) return [];
70545
+ const init = paramsProp.getInitializer();
70546
+ if (!init || init.getKind() !== SyntaxKind.ObjectLiteralExpression) return [];
70547
+ const paramsObj = init;
70548
+ const entries2 = [];
70549
+ for (const p3 of paramsObj.getProperties()) {
70550
+ if (p3.getKind() !== SyntaxKind.PropertyAssignment) continue;
70551
+ const propAssign = p3;
70552
+ const propName = propAssign.getName();
70553
+ const propInit = propAssign.getInitializer();
70554
+ if (!propInit || propInit.getKind() !== SyntaxKind.CallExpression) continue;
70555
+ const callExpr = propInit;
70556
+ const callArgs = callExpr.getArguments();
70557
+ if (callArgs.length === 0) continue;
70558
+ const firstArg = callArgs[0];
70559
+ if (firstArg.getKind() === SyntaxKind.StringLiteral) {
70560
+ const ssmKey = firstArg.asKindOrThrow(SyntaxKind.StringLiteral).getLiteralValue();
70561
+ entries2.push({ propName, ssmKey });
70562
+ }
70563
+ }
70564
+ return entries2;
70565
+ };
70312
70566
  var handlerRegistry = {
70313
70567
  http: {
70314
70568
  defineFn: "defineHttp",
70315
- handlerProp: "onRequest",
70569
+ handlerProps: ["onRequest"],
70316
70570
  wrapperFn: "wrapHttp",
70317
70571
  wrapperPath: "~/runtime/wrap-http"
70318
70572
  },
70319
70573
  table: {
70320
70574
  defineFn: "defineTable",
70321
- handlerProp: "onRecord",
70575
+ handlerProps: ["onRecord", "onBatch"],
70322
70576
  wrapperFn: "wrapTableStream",
70323
70577
  wrapperPath: "~/runtime/wrap-table-stream"
70324
70578
  }
70325
70579
  };
70326
70580
  var extractHandlerConfigs = (source, type2) => {
70327
- const { defineFn, handlerProp } = handlerRegistry[type2];
70581
+ const { defineFn, handlerProps } = handlerRegistry[type2];
70328
70582
  const sourceFile = parseSource(source);
70329
70583
  const results = [];
70330
70584
  const exportDefault = sourceFile.getExportAssignment((e) => !e.isExportEquals());
@@ -70339,8 +70593,10 @@ var extractHandlerConfigs = (source, type2) => {
70339
70593
  const objLiteral = firstArg;
70340
70594
  const configText = buildConfigWithoutRuntime(objLiteral);
70341
70595
  const configObj = new Function(`return ${configText}`)();
70342
- const hasHandler = extractPropertyFromObject(objLiteral, handlerProp) !== void 0;
70343
- results.push({ exportName: "default", config: configObj, hasHandler });
70596
+ const hasHandler = handlerProps.some((p3) => extractPropertyFromObject(objLiteral, p3) !== void 0);
70597
+ const depsKeys = extractDepsKeys(objLiteral);
70598
+ const paramEntries = extractParamEntries(objLiteral);
70599
+ results.push({ exportName: "default", config: configObj, hasHandler, depsKeys, paramEntries });
70344
70600
  }
70345
70601
  }
70346
70602
  }
@@ -70358,19 +70614,22 @@ var extractHandlerConfigs = (source, type2) => {
70358
70614
  const objLiteral = firstArg;
70359
70615
  const configText = buildConfigWithoutRuntime(objLiteral);
70360
70616
  const configObj = new Function(`return ${configText}`)();
70361
- const hasHandler = extractPropertyFromObject(objLiteral, handlerProp) !== void 0;
70362
- results.push({ exportName: decl.getName(), config: configObj, hasHandler });
70617
+ const hasHandler = handlerProps.some((p3) => extractPropertyFromObject(objLiteral, p3) !== void 0);
70618
+ const depsKeys = extractDepsKeys(objLiteral);
70619
+ const paramEntries = extractParamEntries(objLiteral);
70620
+ results.push({ exportName: decl.getName(), config: configObj, hasHandler, depsKeys, paramEntries });
70363
70621
  }
70364
70622
  });
70365
70623
  });
70366
70624
  return results;
70367
70625
  };
70368
- var generateEntryPoint = (sourcePath, exportName, type2) => {
70626
+ var generateEntryPoint = (sourcePath, exportName, type2, runtimeDir2) => {
70369
70627
  const { wrapperFn, wrapperPath } = handlerRegistry[type2];
70628
+ const resolvedWrapperPath = runtimeDir2 ? wrapperPath.replace("~/runtime", runtimeDir2) : wrapperPath;
70370
70629
  const importName = exportName === "default" ? "__handler" : exportName;
70371
70630
  const importStmt = exportName === "default" ? `import __handler from "${sourcePath}";` : `import { ${exportName} } from "${sourcePath}";`;
70372
70631
  return `${importStmt}
70373
- import { ${wrapperFn} } from "${wrapperPath}";
70632
+ import { ${wrapperFn} } from "${resolvedWrapperPath}";
70374
70633
  export const handler = ${wrapperFn}(${importName});
70375
70634
  `;
70376
70635
  };
@@ -70378,12 +70637,15 @@ export const handler = ${wrapperFn}(${importName});
70378
70637
  // src/build/bundle.ts
70379
70638
  var extractConfigs = (source) => extractHandlerConfigs(source, "http");
70380
70639
  var extractTableConfigs = (source) => extractHandlerConfigs(source, "table");
70640
+ var runtimeDir = path5.resolve(path5.dirname(fileURLToPath2(import.meta.url)), "../../dist/runtime");
70381
70641
  var bundle = (input) => Effect_exports.gen(function* () {
70382
70642
  const exportName = input.exportName ?? "default";
70383
70643
  const type2 = input.type ?? "http";
70384
70644
  const externals = input.external ?? [];
70385
70645
  const sourcePath = path5.isAbsolute(input.file) ? input.file : `./${input.file}`;
70386
- const entryPoint = generateEntryPoint(sourcePath, exportName, type2);
70646
+ const entryPoint = generateEntryPoint(sourcePath, exportName, type2, runtimeDir);
70647
+ const awsExternals = ["@aws-sdk/*", "@smithy/*"];
70648
+ const allExternals = [.../* @__PURE__ */ new Set([...awsExternals, ...externals])];
70387
70649
  const result = yield* Effect_exports.tryPromise({
70388
70650
  try: () => esbuild.build({
70389
70651
  stdin: {
@@ -70398,7 +70660,7 @@ var bundle = (input) => Effect_exports.gen(function* () {
70398
70660
  minify: false,
70399
70661
  sourcemap: false,
70400
70662
  format: input.format ?? "esm",
70401
- ...externals.length > 0 ? { external: externals } : { packages: "bundle" }
70663
+ external: allExternals
70402
70664
  }),
70403
70665
  catch: (error4) => new Error(`esbuild failed: ${error4}`)
70404
70666
  });
@@ -70453,6 +70715,7 @@ var readSource = (input) => Effect_exports.gen(function* () {
70453
70715
  var ensureLayerAndExternal = (input) => Effect_exports.gen(function* () {
70454
70716
  const layerResult = yield* ensureLayer({
70455
70717
  project: input.project,
70718
+ stage: input.stage,
70456
70719
  region: input.region,
70457
70720
  projectDir: input.projectDir
70458
70721
  });
@@ -70473,7 +70736,9 @@ var deployCoreLambda = ({
70473
70736
  timeout: timeout4 = 30,
70474
70737
  bundleType,
70475
70738
  layerArn,
70476
- external
70739
+ external,
70740
+ depsEnv,
70741
+ depsPermissions
70477
70742
  }) => Effect_exports.gen(function* () {
70478
70743
  const tagCtx = {
70479
70744
  project: input.project,
@@ -70486,10 +70751,12 @@ var deployCoreLambda = ({
70486
70751
  }
70487
70752
  const mergedPermissions = [
70488
70753
  ...defaultPermissions ?? [],
70489
- ...permissions ?? []
70754
+ ...permissions ?? [],
70755
+ ...depsPermissions ?? []
70490
70756
  ];
70491
70757
  const roleArn = yield* ensureRole(
70492
70758
  input.project,
70759
+ tagCtx.stage,
70493
70760
  handlerName,
70494
70761
  mergedPermissions.length > 0 ? mergedPermissions : void 0,
70495
70762
  makeTags(tagCtx, "iam-role")
@@ -70501,8 +70768,15 @@ var deployCoreLambda = ({
70501
70768
  ...external && external.length > 0 ? { external } : {}
70502
70769
  });
70503
70770
  const code2 = yield* zip12({ content: bundled });
70771
+ const environment2 = {
70772
+ EFF_PROJECT: input.project,
70773
+ EFF_STAGE: tagCtx.stage,
70774
+ EFF_HANDLER: handlerName,
70775
+ ...depsEnv
70776
+ };
70504
70777
  const functionArn = yield* ensureLambda({
70505
70778
  project: input.project,
70779
+ stage: tagCtx.stage,
70506
70780
  name: handlerName,
70507
70781
  region: input.region,
70508
70782
  roleArn,
@@ -70510,13 +70784,14 @@ var deployCoreLambda = ({
70510
70784
  memory,
70511
70785
  timeout: timeout4,
70512
70786
  tags: makeTags(tagCtx, "lambda"),
70513
- ...layerArn ? { layers: [layerArn] } : {}
70787
+ ...layerArn ? { layers: [layerArn] } : {},
70788
+ environment: environment2
70514
70789
  });
70515
70790
  return { functionArn, tagCtx };
70516
70791
  });
70517
70792
 
70518
70793
  // src/deploy/deploy-http.ts
70519
- var deployLambda = ({ input, fn: fn2, layerArn, external }) => Effect_exports.gen(function* () {
70794
+ var deployLambda = ({ input, fn: fn2, layerArn, external, depsEnv, depsPermissions }) => Effect_exports.gen(function* () {
70520
70795
  const { exportName, config: config2 } = fn2;
70521
70796
  const handlerName = config2.name ?? exportName;
70522
70797
  const { functionArn } = yield* deployCoreLambda({
@@ -70528,7 +70803,9 @@ var deployLambda = ({ input, fn: fn2, layerArn, external }) => Effect_exports.ge
70528
70803
  ...config2.memory ? { memory: config2.memory } : {},
70529
70804
  ...config2.timeout ? { timeout: config2.timeout } : {},
70530
70805
  ...layerArn ? { layerArn } : {},
70531
- ...external ? { external } : {}
70806
+ ...external ? { external } : {},
70807
+ ...depsEnv ? { depsEnv } : {},
70808
+ ...depsPermissions ? { depsPermissions } : {}
70532
70809
  });
70533
70810
  return { exportName, functionArn, config: config2, handlerName };
70534
70811
  });
@@ -70550,6 +70827,7 @@ var deploy = (input) => Effect_exports.gen(function* () {
70550
70827
  yield* Effect_exports.logInfo(`Deploying ${handlerName} to ${input.region} (${tagCtx.project}/${tagCtx.stage})`);
70551
70828
  const { layerArn, external } = yield* ensureLayerAndExternal({
70552
70829
  project: input.project,
70830
+ stage: tagCtx.stage,
70553
70831
  region: input.region,
70554
70832
  projectDir: input.projectDir
70555
70833
  });
@@ -70562,6 +70840,7 @@ var deploy = (input) => Effect_exports.gen(function* () {
70562
70840
  yield* Effect_exports.logInfo("Setting up API Gateway...");
70563
70841
  const { apiId } = yield* ensureProjectApi({
70564
70842
  projectName: input.project,
70843
+ stage: tagCtx.stage,
70565
70844
  region: input.region,
70566
70845
  tags: makeTags(tagCtx, "api-gateway")
70567
70846
  });
@@ -70594,19 +70873,21 @@ var deployAll = (input) => Effect_exports.gen(function* () {
70594
70873
  return yield* Effect_exports.fail(new Error("No defineHttp exports found in source"));
70595
70874
  }
70596
70875
  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
70876
  const tagCtx = {
70603
70877
  project: input.project,
70604
70878
  stage: resolveStage(input.stage),
70605
70879
  handler: "api"
70606
70880
  };
70881
+ const { layerArn, external } = yield* ensureLayerAndExternal({
70882
+ project: input.project,
70883
+ stage: tagCtx.stage,
70884
+ region: input.region,
70885
+ projectDir: input.projectDir
70886
+ });
70607
70887
  yield* Effect_exports.logInfo("Setting up API Gateway...");
70608
70888
  const { apiId } = yield* ensureProjectApi({
70609
70889
  projectName: input.project,
70890
+ stage: tagCtx.stage,
70610
70891
  region: input.region,
70611
70892
  tags: makeTags(tagCtx, "api-gateway")
70612
70893
  });
@@ -70647,7 +70928,7 @@ var deployAll = (input) => Effect_exports.gen(function* () {
70647
70928
 
70648
70929
  // src/deploy/deploy-table.ts
70649
70930
  var TABLE_DEFAULT_PERMISSIONS = ["dynamodb:*", "logs:*"];
70650
- var deployTableFunction = ({ input, fn: fn2, layerArn, external }) => Effect_exports.gen(function* () {
70931
+ var deployTableFunction = ({ input, fn: fn2, layerArn, external, depsEnv, depsPermissions }) => Effect_exports.gen(function* () {
70651
70932
  const { exportName, config: config2 } = fn2;
70652
70933
  const handlerName = config2.name ?? exportName;
70653
70934
  const tagCtx = {
@@ -70656,7 +70937,7 @@ var deployTableFunction = ({ input, fn: fn2, layerArn, external }) => Effect_exp
70656
70937
  handler: handlerName
70657
70938
  };
70658
70939
  yield* Effect_exports.logInfo("Creating DynamoDB table...");
70659
- const tableName = `${input.project}-${handlerName}`;
70940
+ const tableName = `${input.project}-${tagCtx.stage}-${handlerName}`;
70660
70941
  const { tableArn, streamArn } = yield* ensureTable({
70661
70942
  name: tableName,
70662
70943
  pk: config2.pk,
@@ -70665,6 +70946,7 @@ var deployTableFunction = ({ input, fn: fn2, layerArn, external }) => Effect_exp
70665
70946
  streamView: config2.streamView ?? "NEW_AND_OLD_IMAGES",
70666
70947
  tags: makeTags(tagCtx, "dynamodb")
70667
70948
  });
70949
+ const selfEnv = { EFF_TABLE_SELF: tableName, ...depsEnv };
70668
70950
  const { functionArn } = yield* deployCoreLambda({
70669
70951
  input,
70670
70952
  exportName,
@@ -70675,7 +70957,9 @@ var deployTableFunction = ({ input, fn: fn2, layerArn, external }) => Effect_exp
70675
70957
  ...config2.memory ? { memory: config2.memory } : {},
70676
70958
  ...config2.timeout ? { timeout: config2.timeout } : {},
70677
70959
  ...layerArn ? { layerArn } : {},
70678
- ...external ? { external } : {}
70960
+ ...external ? { external } : {},
70961
+ depsEnv: selfEnv,
70962
+ ...depsPermissions ? { depsPermissions } : {}
70679
70963
  });
70680
70964
  yield* Effect_exports.logInfo("Setting up event source mapping...");
70681
70965
  yield* ensureEventSourceMapping({
@@ -70703,6 +70987,7 @@ var deployTable = (input) => Effect_exports.gen(function* () {
70703
70987
  const fn2 = configs.find((c) => c.exportName === targetExport) ?? configs[0];
70704
70988
  const { layerArn, external } = yield* ensureLayerAndExternal({
70705
70989
  project: input.project,
70990
+ stage: resolveStage(input.stage),
70706
70991
  region: input.region,
70707
70992
  projectDir: input.projectDir
70708
70993
  });
@@ -70731,6 +71016,7 @@ var deployAllTables = (input) => Effect_exports.gen(function* () {
70731
71016
  yield* Effect_exports.logInfo(`Found ${functions.length} table handler(s) to deploy`);
70732
71017
  const { layerArn, external } = yield* ensureLayerAndExternal({
70733
71018
  project: input.project,
71019
+ stage: resolveStage(input.stage),
70734
71020
  region: input.region,
70735
71021
  projectDir: input.projectDir
70736
71022
  });
@@ -70759,6 +71045,7 @@ var deployAllTables = (input) => Effect_exports.gen(function* () {
70759
71045
  var prepareLayer = (input) => Effect_exports.gen(function* () {
70760
71046
  const layerResult = yield* ensureLayer({
70761
71047
  project: input.project,
71048
+ stage: input.stage,
70762
71049
  region: input.region,
70763
71050
  projectDir: input.projectDir
70764
71051
  }).pipe(
@@ -70779,6 +71066,57 @@ var prepareLayer = (input) => Effect_exports.gen(function* () {
70779
71066
  external
70780
71067
  };
70781
71068
  });
71069
+ var TABLE_CLIENT_PERMISSIONS = [
71070
+ "dynamodb:GetItem",
71071
+ "dynamodb:PutItem",
71072
+ "dynamodb:DeleteItem",
71073
+ "dynamodb:Query",
71074
+ "dynamodb:Scan",
71075
+ "dynamodb:UpdateItem",
71076
+ "dynamodb:BatchGetItem",
71077
+ "dynamodb:BatchWriteItem"
71078
+ ];
71079
+ var buildTableNameMap = (tableHandlers, project2, stage) => {
71080
+ const map36 = /* @__PURE__ */ new Map();
71081
+ for (const { exports } of tableHandlers) {
71082
+ for (const fn2 of exports) {
71083
+ const handlerName = fn2.config.name ?? fn2.exportName;
71084
+ map36.set(fn2.exportName, `${project2}-${stage}-${handlerName}`);
71085
+ }
71086
+ }
71087
+ return map36;
71088
+ };
71089
+ var resolveDeps = (depsKeys, tableNameMap) => {
71090
+ if (depsKeys.length === 0) return void 0;
71091
+ const depsEnv = {};
71092
+ for (const key of depsKeys) {
71093
+ const tableName = tableNameMap.get(key);
71094
+ if (tableName) {
71095
+ depsEnv[`EFF_TABLE_${key}`] = tableName;
71096
+ }
71097
+ }
71098
+ if (Object.keys(depsEnv).length === 0) return void 0;
71099
+ return { depsEnv, depsPermissions: TABLE_CLIENT_PERMISSIONS };
71100
+ };
71101
+ var SSM_PERMISSIONS = [
71102
+ "ssm:GetParameter",
71103
+ "ssm:GetParameters"
71104
+ ];
71105
+ var resolveParams = (paramEntries, project2, stage) => {
71106
+ if (paramEntries.length === 0) return void 0;
71107
+ const paramsEnv = {};
71108
+ for (const { propName, ssmKey } of paramEntries) {
71109
+ paramsEnv[`EFF_PARAM_${propName}`] = `/${project2}/${stage}/${ssmKey}`;
71110
+ }
71111
+ return { paramsEnv, paramsPermissions: SSM_PERMISSIONS };
71112
+ };
71113
+ var mergeResolved = (deps, params) => {
71114
+ if (!deps && !params) return void 0;
71115
+ const env2 = { ...deps?.depsEnv, ...params?.paramsEnv };
71116
+ const permissions = [...deps?.depsPermissions ?? [], ...params?.paramsPermissions ?? []];
71117
+ if (Object.keys(env2).length === 0) return void 0;
71118
+ return { depsEnv: env2, depsPermissions: permissions };
71119
+ };
70782
71120
  var deployHttpHandlers = (ctx) => Effect_exports.gen(function* () {
70783
71121
  const results = [];
70784
71122
  for (const { file: file6, exports } of ctx.handlers) {
@@ -70791,11 +71129,17 @@ var deployHttpHandlers = (ctx) => Effect_exports.gen(function* () {
70791
71129
  };
70792
71130
  if (ctx.input.stage) deployInput.stage = ctx.input.stage;
70793
71131
  for (const fn2 of exports) {
71132
+ const stage = resolveStage(ctx.input.stage);
71133
+ const resolved = mergeResolved(
71134
+ resolveDeps(fn2.depsKeys, ctx.tableNameMap),
71135
+ resolveParams(fn2.paramEntries, ctx.input.project, stage)
71136
+ );
70794
71137
  const { exportName, functionArn, config: config2 } = yield* deployLambda({
70795
71138
  input: deployInput,
70796
71139
  fn: fn2,
70797
71140
  ...ctx.layerArn ? { layerArn: ctx.layerArn } : {},
70798
- ...ctx.external.length > 0 ? { external: ctx.external } : {}
71141
+ ...ctx.external.length > 0 ? { external: ctx.external } : {},
71142
+ ...resolved ? { depsEnv: resolved.depsEnv, depsPermissions: resolved.depsPermissions } : {}
70799
71143
  }).pipe(
70800
71144
  Effect_exports.provide(
70801
71145
  clients_exports.makeClients({
@@ -70836,11 +71180,17 @@ var deployTableHandlers = (ctx) => Effect_exports.gen(function* () {
70836
71180
  };
70837
71181
  if (ctx.input.stage) deployInput.stage = ctx.input.stage;
70838
71182
  for (const fn2 of exports) {
71183
+ const stage = resolveStage(ctx.input.stage);
71184
+ const resolved = mergeResolved(
71185
+ resolveDeps(fn2.depsKeys, ctx.tableNameMap),
71186
+ resolveParams(fn2.paramEntries, ctx.input.project, stage)
71187
+ );
70839
71188
  const result = yield* deployTableFunction({
70840
71189
  input: deployInput,
70841
71190
  fn: fn2,
70842
71191
  ...ctx.layerArn ? { layerArn: ctx.layerArn } : {},
70843
- ...ctx.external.length > 0 ? { external: ctx.external } : {}
71192
+ ...ctx.external.length > 0 ? { external: ctx.external } : {},
71193
+ ...resolved ? { depsEnv: resolved.depsEnv, depsPermissions: resolved.depsPermissions } : {}
70844
71194
  }).pipe(
70845
71195
  Effect_exports.provide(
70846
71196
  clients_exports.makeClients({
@@ -70868,8 +71218,10 @@ var deployProject = (input) => Effect_exports.gen(function* () {
70868
71218
  return yield* Effect_exports.fail(new Error("No handlers found in matched files"));
70869
71219
  }
70870
71220
  yield* Effect_exports.logInfo(`Discovered ${totalHttpHandlers} HTTP handler(s) and ${totalTableHandlers} table handler(s)`);
71221
+ const tableNameMap = buildTableNameMap(tableHandlers, input.project, resolveStage(input.stage));
70871
71222
  const { layerArn, external } = yield* prepareLayer({
70872
71223
  project: input.project,
71224
+ stage: resolveStage(input.stage),
70873
71225
  region: input.region,
70874
71226
  projectDir: input.projectDir
70875
71227
  });
@@ -70884,6 +71236,7 @@ var deployProject = (input) => Effect_exports.gen(function* () {
70884
71236
  yield* Effect_exports.logInfo("Setting up API Gateway...");
70885
71237
  const api = yield* ensureProjectApi({
70886
71238
  projectName: input.project,
71239
+ stage: tagCtx.stage,
70887
71240
  region: input.region,
70888
71241
  tags: makeTags(tagCtx, "api-gateway")
70889
71242
  }).pipe(
@@ -70901,13 +71254,15 @@ var deployProject = (input) => Effect_exports.gen(function* () {
70901
71254
  apiId,
70902
71255
  input,
70903
71256
  layerArn,
70904
- external
71257
+ external,
71258
+ tableNameMap
70905
71259
  }) : [];
70906
71260
  const tableResults = yield* deployTableHandlers({
70907
71261
  handlers: tableHandlers,
70908
71262
  input,
70909
71263
  layerArn,
70910
- external
71264
+ external,
71265
+ tableNameMap
70911
71266
  });
70912
71267
  if (apiUrl) {
70913
71268
  yield* Effect_exports.logInfo(`Deployment complete! API: ${apiUrl}`);