@awsless/awsless 0.0.147 → 0.0.148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -692,11 +692,11 @@ var Stack = class {
692
692
  // src/stack.ts
693
693
  var toStack = ({ config: config2, app, stackConfig, bootstrap: bootstrap2, usEastBootstrap, plugins: plugins2, tests }) => {
694
694
  const name = stackConfig.name;
695
- const stack = new Stack(name, config2.app.region).tag("app", config2.app.name).tag("stage", config2.app.stage).tag("stack", name);
695
+ const stack = new Stack(name, config2.app.region).tag("app", config2.app.name).tag("stage", config2.stage).tag("stack", name);
696
696
  debug("Define stack:", style.info(name));
697
697
  debug("Run plugin onStack listeners");
698
698
  const bindings = [];
699
- const bind = (cb) => {
699
+ const bind2 = (cb) => {
700
700
  bindings.push(cb);
701
701
  };
702
702
  for (const plugin of plugins2) {
@@ -708,16 +708,16 @@ var toStack = ({ config: config2, app, stackConfig, bootstrap: bootstrap2, usEas
708
708
  bootstrap: bootstrap2,
709
709
  usEastBootstrap,
710
710
  tests,
711
- bind
711
+ bind: bind2
712
712
  });
713
713
  }
714
714
  if (stack.size === 0) {
715
715
  throw new Error(`Stack ${style.info(name)} has no resources defined`);
716
716
  }
717
717
  const functions = stack.find(Function);
718
- for (const bind2 of bindings) {
718
+ for (const bind3 of bindings) {
719
719
  for (const fn of functions) {
720
- bind2(fn);
720
+ bind3(fn);
721
721
  }
722
722
  }
723
723
  return {
@@ -1439,7 +1439,7 @@ var toLambdaFunction = (ctx, id, fileOrProps) => {
1439
1439
  if (typeof fileOrProps === "object" && fileOrProps.permissions) {
1440
1440
  lambda.addPermissions(fileOrProps.permissions);
1441
1441
  }
1442
- lambda.addEnvironment("APP", config2.app.name).addEnvironment("STAGE", config2.app.stage).addEnvironment("STACK", stack.name);
1442
+ lambda.addEnvironment("APP", config2.app.name).addEnvironment("STAGE", config2.stage).addEnvironment("STACK", stack.name);
1443
1443
  if (props.warm) {
1444
1444
  lambda.warmUp(props.warm);
1445
1445
  }
@@ -1749,29 +1749,29 @@ var authPlugin = definePlugin({
1749
1749
  gen.addInterface("AuthResources", resources);
1750
1750
  await write("auth.d.ts", gen, true);
1751
1751
  },
1752
- onStack({ config: config2, bootstrap: bootstrap2, stackConfig, bind }) {
1753
- for (const [id, props] of Object.entries(stackConfig.auth ?? {})) {
1754
- if (props.access) {
1755
- const userPoolId = bootstrap2.import(`auth-${id}-user-pool-id`);
1756
- const clientId = bootstrap2.import(`auth-${id}-client-id`);
1757
- const name = constantCase6(id);
1758
- bind((lambda) => {
1759
- lambda.addEnvironment(`AUTH_${name}_USER_POOL_ID`, userPoolId);
1760
- lambda.addEnvironment(`AUTH_${name}_CLIENT_ID`, clientId);
1761
- if (config2.app.defaults.auth?.[id]?.secret) {
1762
- const clientSecret = bootstrap2.import(`auth-${id}-client-secret`);
1763
- lambda.addEnvironment(`AUTH_${name}_CLIENT_SECRET`, clientSecret);
1764
- }
1765
- lambda.addPermissions({
1766
- actions: ["cognito:*"],
1767
- resources: ["*"]
1768
- });
1769
- });
1770
- }
1771
- }
1772
- },
1752
+ // onStack({ config, bootstrap, stackConfig, bind }) {
1753
+ // for (const [id, props] of Object.entries(stackConfig.auth ?? {})) {
1754
+ // if (props.access) {
1755
+ // const userPoolId = bootstrap.import(`auth-${id}-user-pool-id`)
1756
+ // const clientId = bootstrap.import(`auth-${id}-client-id`)
1757
+ // const name = constantCase(id)
1758
+ // bind(lambda => {
1759
+ // lambda.addEnvironment(`AUTH_${name}_USER_POOL_ID`, userPoolId)
1760
+ // lambda.addEnvironment(`AUTH_${name}_CLIENT_ID`, clientId)
1761
+ // if (config.app.defaults.auth?.[id]?.secret) {
1762
+ // const clientSecret = bootstrap.import(`auth-${id}-client-secret`)
1763
+ // lambda.addEnvironment(`AUTH_${name}_CLIENT_SECRET`, clientSecret)
1764
+ // }
1765
+ // lambda.addPermissions({
1766
+ // actions: ['cognito:*'],
1767
+ // resources: ['*'],
1768
+ // })
1769
+ // })
1770
+ // }
1771
+ // }
1772
+ // },
1773
1773
  onApp(ctx) {
1774
- const { config: config2, bootstrap: bootstrap2 } = ctx;
1774
+ const { config: config2, bootstrap: bootstrap2, bind: bind2 } = ctx;
1775
1775
  if (Object.keys(config2.app.defaults.auth).length === 0) {
1776
1776
  return;
1777
1777
  }
@@ -1857,6 +1857,22 @@ var authPlugin = definePlugin({
1857
1857
  }).dependsOn(lambda);
1858
1858
  bootstrap2.add(lambda, permission);
1859
1859
  }
1860
+ bind2((lambda) => {
1861
+ const userPoolArn = bootstrap2.import(`auth-${id}-user-pool-arn`);
1862
+ const userPoolId = bootstrap2.import(`auth-${id}-user-pool-id`);
1863
+ const clientId = bootstrap2.import(`auth-${id}-client-id`);
1864
+ const name = constantCase6(id);
1865
+ lambda.addEnvironment(`AUTH_${name}_USER_POOL_ID`, userPoolId);
1866
+ lambda.addEnvironment(`AUTH_${name}_CLIENT_ID`, clientId);
1867
+ if (props.secret) {
1868
+ const clientSecret = bootstrap2.import(`auth-${id}-client-secret`);
1869
+ lambda.addEnvironment(`AUTH_${name}_CLIENT_SECRET`, clientSecret);
1870
+ }
1871
+ lambda.addPermissions({
1872
+ actions: ["cognito:*"],
1873
+ resources: [userPoolArn]
1874
+ });
1875
+ });
1860
1876
  }
1861
1877
  }
1862
1878
  });
@@ -2092,7 +2108,7 @@ var cachePlugin = definePlugin({
2092
2108
  gen.addInterface("CacheResources", resources);
2093
2109
  await write("cache.d.ts", gen, true);
2094
2110
  },
2095
- onStack({ config: config2, stack, stackConfig, bootstrap: bootstrap2, bind }) {
2111
+ onStack({ config: config2, stack, stackConfig, bootstrap: bootstrap2, bind: bind2 }) {
2096
2112
  for (const [id, props] of Object.entries(stackConfig.caches || {})) {
2097
2113
  const name = `${config2.app.name}-${stack.name}-${id}`;
2098
2114
  const subnetGroup = new SubnetGroup(id, {
@@ -2115,7 +2131,7 @@ var cachePlugin = definePlugin({
2115
2131
  ...props
2116
2132
  }).dependsOn(subnetGroup, securityGroup);
2117
2133
  stack.add(subnetGroup, securityGroup, cluster);
2118
- bind((lambda) => {
2134
+ bind2((lambda) => {
2119
2135
  lambda.addEnvironment(`CACHE_${constantCase7(stack.name)}_${constantCase7(id)}_HOST`, cluster.address).addEnvironment(
2120
2136
  `CACHE_${constantCase7(stack.name)}_${constantCase7(id)}_PORT`,
2121
2137
  props.port.toString()
@@ -2239,9 +2255,9 @@ var configPlugin = definePlugin({
2239
2255
  gen.addInterface("ConfigResources", resources.toString());
2240
2256
  await write("config.d.ts", gen, true);
2241
2257
  },
2242
- onStack({ bind, config: config2, stackConfig }) {
2258
+ onStack({ bind: bind2, config: config2, stackConfig }) {
2243
2259
  const configs = stackConfig.configs;
2244
- bind((lambda) => {
2260
+ bind2((lambda) => {
2245
2261
  if (configs && configs.length) {
2246
2262
  lambda.addEnvironment("CONFIG", configs.join(","));
2247
2263
  lambda.addPermissions({
@@ -2477,7 +2493,7 @@ var EmailIdentity = class extends Resource {
2477
2493
  // src/plugins/domain/index.ts
2478
2494
  var domainPlugin = definePlugin({
2479
2495
  name: "domain",
2480
- onApp({ config: config2, app, bootstrap: bootstrap2, usEastBootstrap, bind }) {
2496
+ onApp({ config: config2, app, bootstrap: bootstrap2, usEastBootstrap, bind: bind2 }) {
2481
2497
  const domains = Object.entries(config2.app.defaults.domains || {});
2482
2498
  if (domains.length === 0) {
2483
2499
  return;
@@ -2541,7 +2557,7 @@ var domainPlugin = definePlugin({
2541
2557
  usEastBootstrap.add(group);
2542
2558
  }
2543
2559
  }
2544
- bind(
2560
+ bind2(
2545
2561
  (lambda) => lambda.addPermissions({
2546
2562
  actions: ["ses:*"],
2547
2563
  resources: ["*"]
@@ -3855,8 +3871,8 @@ var IotEventSource = class extends Group {
3855
3871
  // src/plugins/pubsub/index.ts
3856
3872
  var pubsubPlugin = definePlugin({
3857
3873
  name: "pubsub",
3858
- onApp({ bind }) {
3859
- bind((lambda) => {
3874
+ onApp({ bind: bind2 }) {
3875
+ bind2((lambda) => {
3860
3876
  lambda.addPermissions({
3861
3877
  actions: ["iot:publish"],
3862
3878
  resources: ["*"]
@@ -3889,7 +3905,7 @@ type Payload<F extends Func> = Parameters<F>[0]['Records'][number]['body']
3889
3905
 
3890
3906
  type Send<Name extends string, F extends Func> = {
3891
3907
  readonly name: Name
3892
- readonly batch(items:BatchItem<Payload<F>>[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
3908
+ batch(items:BatchItem<Payload<F>>[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
3893
3909
  (payload: Payload<F>, options?: Omit<SendMessageOptions, 'queue' | 'payload'>): Promise<void>
3894
3910
  }
3895
3911
 
@@ -3929,7 +3945,7 @@ var queuePlugin = definePlugin({
3929
3945
  await write("queue.d.ts", gen, true);
3930
3946
  },
3931
3947
  onStack(ctx) {
3932
- const { stack, config: config2, stackConfig, bind } = ctx;
3948
+ const { stack, config: config2, stackConfig, bind: bind2 } = ctx;
3933
3949
  for (const [id, functionOrProps] of Object.entries(stackConfig.queues || {})) {
3934
3950
  const props = typeof functionOrProps === "string" ? { ...config2.app.defaults.queue, consumer: functionOrProps } : { ...config2.app.defaults.queue, ...functionOrProps };
3935
3951
  const queue2 = new Queue(id, {
@@ -3945,7 +3961,7 @@ var queuePlugin = definePlugin({
3945
3961
  maxBatchingWindow: props.maxBatchingWindow
3946
3962
  });
3947
3963
  stack.add(queue2, lambda, source);
3948
- bind((lambda2) => {
3964
+ bind2((lambda2) => {
3949
3965
  lambda2.addPermissions(queue2.permissions);
3950
3966
  lambda2.addEnvironment(`QUEUE_${constantCase11(stack.name)}_${constantCase11(id)}_URL`, queue2.url);
3951
3967
  });
@@ -4225,13 +4241,13 @@ var searchPlugin = definePlugin({
4225
4241
  gen.addInterface("SearchResources", resources);
4226
4242
  await write("search.d.ts", gen, true);
4227
4243
  },
4228
- onStack({ app, stack, stackConfig, bind }) {
4244
+ onStack({ app, stack, stackConfig, bind: bind2 }) {
4229
4245
  for (const id of stackConfig.searchs || []) {
4230
4246
  const collection = new Collection(id, {
4231
4247
  name: `${app.name}-${stack.name}-${id}`,
4232
4248
  type: "search"
4233
4249
  });
4234
- bind((lambda) => {
4250
+ bind2((lambda) => {
4235
4251
  lambda.addPermissions(collection.permissions);
4236
4252
  });
4237
4253
  }
@@ -4258,6 +4274,9 @@ var Distribution = class extends Resource {
4258
4274
  get domainName() {
4259
4275
  return getAtt(this.logicalId, "DomainName");
4260
4276
  }
4277
+ get hostedZoneId() {
4278
+ return "Z2FDTNDATAQYW2";
4279
+ }
4261
4280
  properties() {
4262
4281
  return {
4263
4282
  DistributionConfig: {
@@ -4851,7 +4870,7 @@ var sitePlugin = definePlugin({
4851
4870
  name: domainName,
4852
4871
  alias: {
4853
4872
  dnsName: distribution.domainName,
4854
- hostedZoneId: "Z2FDTNDATAQYW2"
4873
+ hostedZoneId: distribution.hostedZoneId
4855
4874
  }
4856
4875
  }).dependsOn(distribution);
4857
4876
  stack.add(distribution, invalidateCache, responseHeaders, originRequest, cache, record);
@@ -4876,7 +4895,7 @@ var storePlugin = definePlugin({
4876
4895
  gen.addInterface("StoreResources", resources);
4877
4896
  await write("store.d.ts", gen, true);
4878
4897
  },
4879
- onStack({ config: config2, stack, stackConfig, bootstrap: bootstrap2, bind }) {
4898
+ onStack({ config: config2, stack, stackConfig, bootstrap: bootstrap2, bind: bind2 }) {
4880
4899
  for (const id of stackConfig.stores || []) {
4881
4900
  const bucket = new Bucket(id, {
4882
4901
  name: `store-${config2.app.name}-${stack.name}-${id}`,
@@ -4889,7 +4908,7 @@ var storePlugin = definePlugin({
4889
4908
  }
4890
4909
  }).dependsOn(bucket);
4891
4910
  stack.add(bucket, custom);
4892
- bind((lambda) => {
4911
+ bind2((lambda) => {
4893
4912
  lambda.addPermissions(bucket.permissions);
4894
4913
  });
4895
4914
  }
@@ -5066,7 +5085,7 @@ var tablePlugin = definePlugin({
5066
5085
  await write("table.d.ts", gen, true);
5067
5086
  },
5068
5087
  onStack(ctx) {
5069
- const { config: config2, stack, stackConfig, bind } = ctx;
5088
+ const { config: config2, stack, stackConfig, bind: bind2 } = ctx;
5070
5089
  for (const [id, props] of Object.entries(stackConfig.tables || {})) {
5071
5090
  const table = new Table(id, {
5072
5091
  ...props,
@@ -5091,7 +5110,7 @@ var tablePlugin = definePlugin({
5091
5110
  }
5092
5111
  stack.add(lambda, source);
5093
5112
  }
5094
- bind((lambda) => {
5113
+ bind2((lambda) => {
5095
5114
  lambda.addPermissions(table.permissions);
5096
5115
  });
5097
5116
  }
@@ -5226,9 +5245,9 @@ var topicPlugin = definePlugin({
5226
5245
  }
5227
5246
  },
5228
5247
  onStack(ctx) {
5229
- const { config: config2, stack, stackConfig, bootstrap: bootstrap2, bind } = ctx;
5248
+ const { config: config2, stack, stackConfig, bootstrap: bootstrap2, bind: bind2 } = ctx;
5230
5249
  for (const id of stackConfig.topics || []) {
5231
- bind((lambda) => {
5250
+ bind2((lambda) => {
5232
5251
  lambda.addPermissions({
5233
5252
  actions: ["sns:Publish"],
5234
5253
  resources: [
@@ -5503,7 +5522,7 @@ var toApp = async (config2, filters) => {
5503
5522
  const usEastBootstrap = new Stack("us-east-bootstrap", "us-east-1");
5504
5523
  debug("Run plugin onApp listeners");
5505
5524
  const bindings = [];
5506
- const bind = (cb) => {
5525
+ const bind2 = (cb) => {
5507
5526
  bindings.push(cb);
5508
5527
  };
5509
5528
  for (const plugin of plugins) {
@@ -5512,7 +5531,7 @@ var toApp = async (config2, filters) => {
5512
5531
  app,
5513
5532
  bootstrap: bootstrap2,
5514
5533
  usEastBootstrap,
5515
- bind,
5534
+ bind: bind2,
5516
5535
  tests
5517
5536
  });
5518
5537
  }
@@ -5543,9 +5562,9 @@ var toApp = async (config2, filters) => {
5543
5562
  app.add(usEastBootstrap);
5544
5563
  }
5545
5564
  const functions = app.find(Function);
5546
- for (const bind2 of bindings) {
5565
+ for (const bind3 of bindings) {
5547
5566
  for (const fn of functions) {
5548
- bind2(fn);
5567
+ bind3(fn);
5549
5568
  }
5550
5569
  }
5551
5570
  for (const entry of stacks) {
@@ -5555,9 +5574,9 @@ var toApp = async (config2, filters) => {
5555
5574
  throw new Error(`Stack dependency not found: ${dep}`);
5556
5575
  }
5557
5576
  const functions2 = entry.stack.find(Function);
5558
- for (const bind2 of depStack.bindings) {
5577
+ for (const bind3 of depStack.bindings) {
5559
5578
  for (const fn of functions2) {
5560
- bind2(fn);
5579
+ bind3(fn);
5561
5580
  }
5562
5581
  }
5563
5582
  }
@@ -5835,7 +5854,10 @@ var TriggersSchema = z8.object({
5835
5854
  var AuthSchema = z8.record(
5836
5855
  ResourceIdSchema,
5837
5856
  z8.object({
5838
- access: z8.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
5857
+ // access: z
5858
+ // .boolean()
5859
+ // .default(false)
5860
+ // .describe('Give access to every function in this stack to your cognito instance.'),
5839
5861
  triggers: TriggersSchema.optional()
5840
5862
  })
5841
5863
  ).optional().describe("Define the auth triggers in your stack.");
@@ -6048,7 +6070,11 @@ var AppSchema = z15.object({
6048
6070
  name: ResourceIdSchema.describe("App name."),
6049
6071
  region: RegionSchema.describe("The AWS region to deploy to."),
6050
6072
  profile: z15.string().describe("The AWS profile to deploy to."),
6051
- stage: z15.string().regex(/^[a-z]+$/).default("prod").describe("The deployment stage."),
6073
+ // stage: z
6074
+ // .string()
6075
+ // .regex(/^[a-z]+$/)
6076
+ // .default('prod')
6077
+ // .describe('The deployment stage.'),
6052
6078
  defaults: z15.object({
6053
6079
  auth: AuthDefaultSchema,
6054
6080
  domains: DomainsDefaultSchema,
@@ -6288,6 +6314,10 @@ var SitesSchema = z26.record(
6288
6314
  subDomain: z26.string().optional(),
6289
6315
  static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
6290
6316
  ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
6317
+ // bind: z.object({
6318
+ // auth:
6319
+ // h
6320
+ // }).optional(),
6291
6321
  // ssr: z.union([
6292
6322
  // FunctionSchema.optional(),
6293
6323
  // z.object({
@@ -6492,13 +6522,17 @@ var loadConfig = async (options) => {
6492
6522
  const stackConfig = await readConfigWithStage(file, options.stage);
6493
6523
  setLocalBasePath(join7(process.cwd(), dirname5(file)));
6494
6524
  const stack = await parseConfig(StackSchema, file, stackConfig);
6495
- stacks.push(stack);
6525
+ stacks.push({
6526
+ ...stack,
6527
+ file
6528
+ });
6496
6529
  }
6497
6530
  return {
6498
6531
  app,
6499
6532
  stacks,
6500
6533
  account,
6501
- credentials
6534
+ credentials,
6535
+ stage: options.stage
6502
6536
  };
6503
6537
  };
6504
6538
 
@@ -6539,12 +6573,12 @@ var list = (data) => {
6539
6573
  };
6540
6574
 
6541
6575
  // src/cli/ui/layout/header.ts
6542
- var header = (app) => {
6576
+ var header = (config2) => {
6543
6577
  return list({
6544
- App: app.name,
6545
- Stage: app.stage,
6546
- Region: app.region,
6547
- Profile: app.profile
6578
+ App: config2.app.name,
6579
+ Stage: config2.stage,
6580
+ Region: config2.app.region,
6581
+ Profile: config2.app.profile
6548
6582
  });
6549
6583
  };
6550
6584
 
@@ -7062,7 +7096,7 @@ var layout = async (cb) => {
7062
7096
  try {
7063
7097
  const options = program.optsWithGlobals();
7064
7098
  const config2 = await loadConfig(options);
7065
- term.out.write(header(config2.app));
7099
+ term.out.write(header(config2));
7066
7100
  term.out.gap();
7067
7101
  await cb(config2, term.out.write.bind(term.out), term);
7068
7102
  } catch (error) {
@@ -8516,7 +8550,7 @@ var dev = (program2) => {
8516
8550
  const options = program2.optsWithGlobals();
8517
8551
  await cleanUp();
8518
8552
  await write(typesGenerator(config2));
8519
- const watcher = await watchConfig(
8553
+ await watchConfig(
8520
8554
  options,
8521
8555
  async (config3) => {
8522
8556
  await cleanUp();
@@ -8598,6 +8632,70 @@ var del2 = (program2) => {
8598
8632
  });
8599
8633
  };
8600
8634
 
8635
+ // src/cli/command/bind.ts
8636
+ import { spawn } from "child_process";
8637
+ import { paramCase as paramCase8 } from "change-case";
8638
+ import { GetFunctionCommand, LambdaClient } from "@aws-sdk/client-lambda";
8639
+ var bind = (program2) => {
8640
+ program2.command("bind").argument("stack", "The stack name").argument("site", "The site name").argument("<command...>", "The command to execute").description(`Bind your site environment variables to a command`).action(async (stack, site, commands3) => {
8641
+ await layout(async (config2, write) => {
8642
+ const command = commands3.join(" ");
8643
+ const stackConfig = config2.stacks.find((s) => s.name === stack);
8644
+ if (!stackConfig) {
8645
+ throw new Error(`[${stack}] Stack doesn't exist.`);
8646
+ }
8647
+ const siteConfig = stackConfig.sites?.[site];
8648
+ if (!siteConfig) {
8649
+ throw new Error(`[${site}] Site doesn't exist.`);
8650
+ }
8651
+ let functionEnv = {};
8652
+ if (siteConfig.ssr) {
8653
+ const client = new LambdaClient({
8654
+ credentials: config2.credentials,
8655
+ region: config2.app.region
8656
+ });
8657
+ const lambdaLoader = write(loadingDialog("Loading SSR lambda environment variables..."));
8658
+ try {
8659
+ const result = await client.send(
8660
+ new GetFunctionCommand({
8661
+ FunctionName: paramCase8(`${config2.app.name}-${stack}-site-${site}`)
8662
+ })
8663
+ );
8664
+ functionEnv = result.Configuration?.Environment?.Variables ?? {};
8665
+ } catch (error) {
8666
+ if (error instanceof Error && error.message.includes("not found")) {
8667
+ write(dialog("warning", [`The SSR lambda hasn't been deployed yet.`]));
8668
+ } else {
8669
+ throw error;
8670
+ }
8671
+ } finally {
8672
+ lambdaLoader("Done loading SSR lambda environment variables");
8673
+ }
8674
+ }
8675
+ const credentialsLoader = write(loadingDialog("Loading AWS credentials..."));
8676
+ const credentials = await config2.credentials();
8677
+ credentialsLoader("Done loading AWS credentials");
8678
+ spawn(command, {
8679
+ env: {
8680
+ // Pass the process env vars
8681
+ ...process.env,
8682
+ // Pass the lambda env vars
8683
+ ...functionEnv,
8684
+ // Basic info
8685
+ AWS_REGION: config2.app.region,
8686
+ AWS_ACCOUNT_ID: config2.account,
8687
+ // Give AWS access
8688
+ AWS_ACCESS_KEY_ID: credentials.accessKeyId,
8689
+ AWS_SECRET_ACCESS_KEY: credentials.secretAccessKey,
8690
+ AWS_SESSION_TOKEN: credentials.sessionToken
8691
+ },
8692
+ stdio: "inherit",
8693
+ shell: true
8694
+ });
8695
+ });
8696
+ });
8697
+ };
8698
+
8601
8699
  // src/cli/program.ts
8602
8700
  var program = new Command();
8603
8701
  program.name(logo().join("").replace(/\s+/, ""));
@@ -8626,6 +8724,7 @@ var commands2 = [
8626
8724
  deploy,
8627
8725
  del2,
8628
8726
  dev,
8727
+ bind,
8629
8728
  config,
8630
8729
  test
8631
8730
  // draw,
package/dist/index.d.ts CHANGED
@@ -40,7 +40,6 @@ declare const AppSchema: z.ZodObject<{
40
40
  name: z.ZodEffects<z.ZodString, string, string>;
41
41
  region: z.ZodEnum<["us-east-2", "us-east-1", "us-west-1", "us-west-2", "af-south-1", "ap-east-1", "ap-south-2", "ap-southeast-3", "ap-southeast-4", "ap-south-1", "ap-northeast-3", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ca-central-1", "eu-central-1", "eu-west-1", "eu-west-2", "eu-south-1", "eu-west-3", "eu-south-2", "eu-north-1", "eu-central-2", "me-south-1", "me-central-1", "sa-east-1"]>;
42
42
  profile: z.ZodString;
43
- stage: z.ZodDefault<z.ZodString>;
44
43
  defaults: z.ZodDefault<z.ZodObject<{
45
44
  auth: z.ZodDefault<z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
46
45
  allowUserRegistration: z.ZodDefault<z.ZodBoolean>;
@@ -3220,7 +3219,6 @@ declare const AppSchema: z.ZodObject<{
3220
3219
  name: string;
3221
3220
  region: "us-east-2" | "us-east-1" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-east-1" | "ap-south-2" | "ap-southeast-3" | "ap-southeast-4" | "ap-south-1" | "ap-northeast-3" | "ap-northeast-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ca-central-1" | "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-south-1" | "eu-west-3" | "eu-south-2" | "eu-north-1" | "eu-central-2" | "me-south-1" | "me-central-1" | "sa-east-1";
3222
3221
  profile: string;
3223
- stage: string;
3224
3222
  defaults: {
3225
3223
  function: {
3226
3224
  handler: string;
@@ -3595,7 +3593,6 @@ declare const AppSchema: z.ZodObject<{
3595
3593
  region: "us-east-2" | "us-east-1" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-east-1" | "ap-south-2" | "ap-southeast-3" | "ap-southeast-4" | "ap-south-1" | "ap-northeast-3" | "ap-northeast-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ca-central-1" | "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-south-1" | "eu-west-3" | "eu-south-2" | "eu-north-1" | "eu-central-2" | "me-south-1" | "me-central-1" | "sa-east-1";
3596
3594
  profile: string;
3597
3595
  $schema?: string | undefined;
3598
- stage?: string | undefined;
3599
3596
  defaults?: {
3600
3597
  auth?: Record<string, {
3601
3598
  allowUserRegistration?: boolean | undefined;
@@ -4081,7 +4078,6 @@ declare const StackSchema: z.ZodObject<{
4081
4078
  }[] | undefined;
4082
4079
  }>]>>;
4083
4080
  auth: z.ZodOptional<z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodObject<{
4084
- access: z.ZodDefault<z.ZodBoolean>;
4085
4081
  triggers: z.ZodOptional<z.ZodObject<{
4086
4082
  beforeToken: z.ZodOptional<z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, z.ZodObject<{
4087
4083
  file: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
@@ -5653,7 +5649,6 @@ declare const StackSchema: z.ZodObject<{
5653
5649
  } | undefined;
5654
5650
  }>>;
5655
5651
  }, "strip", z.ZodTypeAny, {
5656
- access: boolean;
5657
5652
  triggers?: {
5658
5653
  beforeToken?: string | {
5659
5654
  file: string;
@@ -5927,7 +5922,6 @@ declare const StackSchema: z.ZodObject<{
5927
5922
  } | undefined;
5928
5923
  } | undefined;
5929
5924
  }, {
5930
- access?: boolean | undefined;
5931
5925
  triggers?: {
5932
5926
  beforeToken?: string | {
5933
5927
  file: string;
@@ -9042,7 +9036,6 @@ declare const StackSchema: z.ZodObject<{
9042
9036
  }[] | undefined;
9043
9037
  } | undefined;
9044
9038
  auth?: Record<string, {
9045
- access: boolean;
9046
9039
  triggers?: {
9047
9040
  beforeToken?: string | {
9048
9041
  file: string;
@@ -9956,7 +9949,6 @@ declare const StackSchema: z.ZodObject<{
9956
9949
  }[] | undefined;
9957
9950
  } | undefined;
9958
9951
  auth?: Record<string, {
9959
- access?: boolean | undefined;
9960
9952
  triggers?: {
9961
9953
  beforeToken?: string | {
9962
9954
  file: string;
@@ -10836,10 +10828,13 @@ declare const StackSchema: z.ZodObject<{
10836
10828
  }> | undefined;
10837
10829
  tests?: string | string[] | undefined;
10838
10830
  }>;
10839
- type StackConfig = z.output<typeof StackSchema>;
10831
+ type StackConfig = z.output<typeof StackSchema> & {
10832
+ file: string;
10833
+ };
10840
10834
 
10841
10835
  type Config$1 = {
10842
10836
  app: AppConfig;
10837
+ stage: string;
10843
10838
  stacks: StackConfig[];
10844
10839
  account: string;
10845
10840
  credentials: Credentials;
package/dist/index.js CHANGED
@@ -85,6 +85,9 @@ var getAuthProps = (name) => {
85
85
  const id = constantCase(name);
86
86
  return {
87
87
  name: getAuthName(name),
88
+ // userPoolId: env[`AWSLESS_CLIENT_AUTH_${id}_USER_POOL_ID`]!,
89
+ // clientId: env[`AWSLESS_CLIENT_AUTH_${id}_CLIENT_ID`]!,
90
+ // clientSecret: env[`AWSLESS_CLIENT_AUTH_${id}_CLIENT_SECRET`]!,
88
91
  userPoolId: env[`AUTH_${id}_USER_POOL_ID`],
89
92
  clientId: env[`AUTH_${id}_CLIENT_ID`],
90
93
  clientSecret: env[`AUTH_${id}_CLIENT_SECRET`]
package/dist/json.js CHANGED
@@ -385,7 +385,10 @@ var TriggersSchema = z10.object({
385
385
  var AuthSchema = z10.record(
386
386
  ResourceIdSchema,
387
387
  z10.object({
388
- access: z10.boolean().default(false).describe("Give access to every function in this stack to your cognito instance."),
388
+ // access: z
389
+ // .boolean()
390
+ // .default(false)
391
+ // .describe('Give access to every function in this stack to your cognito instance.'),
389
392
  triggers: TriggersSchema.optional()
390
393
  })
391
394
  ).optional().describe("Define the auth triggers in your stack.");
@@ -714,6 +717,10 @@ var SitesSchema = z23.record(
714
717
  subDomain: z23.string().optional(),
715
718
  static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
716
719
  ssr: FunctionSchema.optional().describe("Specifies the ssr file."),
720
+ // bind: z.object({
721
+ // auth:
722
+ // h
723
+ // }).optional(),
717
724
  // ssr: z.union([
718
725
  // FunctionSchema.optional(),
719
726
  // z.object({
@@ -888,7 +895,11 @@ var AppSchema = z28.object({
888
895
  name: ResourceIdSchema.describe("App name."),
889
896
  region: RegionSchema.describe("The AWS region to deploy to."),
890
897
  profile: z28.string().describe("The AWS profile to deploy to."),
891
- stage: z28.string().regex(/^[a-z]+$/).default("prod").describe("The deployment stage."),
898
+ // stage: z
899
+ // .string()
900
+ // .regex(/^[a-z]+$/)
901
+ // .default('prod')
902
+ // .describe('The deployment stage.'),
892
903
  defaults: z28.object({
893
904
  auth: AuthDefaultSchema,
894
905
  domains: DomainsDefaultSchema,