@awsless/awsless 0.0.11 → 0.0.13

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.cjs CHANGED
@@ -83,15 +83,15 @@ var flushDebug = () => {
83
83
 
84
84
  // src/util/param.ts
85
85
  var import_client_ssm = require("@aws-sdk/client-ssm");
86
- var configParameterPrefix = (config2) => {
87
- return `/${config2.stage}/awsless/${config2.name}`;
86
+ var configParameterPrefix = (config) => {
87
+ return `/${config.stage}/awsless/${config.name}`;
88
88
  };
89
89
  var Params = class {
90
- constructor(config2) {
91
- this.config = config2;
90
+ constructor(config) {
91
+ this.config = config;
92
92
  this.client = new import_client_ssm.SSMClient({
93
- credentials: config2.credentials,
94
- region: config2.region
93
+ credentials: config.credentials,
94
+ region: config.region
95
95
  });
96
96
  }
97
97
  client;
@@ -166,13 +166,13 @@ var Params = class {
166
166
  };
167
167
 
168
168
  // src/stack.ts
169
- var toStack = ({ config: config2, assets, app, stackConfig, plugins }) => {
170
- const stackName = `${config2.name}-${stackConfig.name}`;
169
+ var toStack = ({ config, assets, app, stackConfig, plugins }) => {
170
+ const stackName = `${config.name}-${stackConfig.name}`;
171
171
  const stack = new import_aws_cdk_lib.Stack(app, stackConfig.name, {
172
172
  stackName,
173
173
  tags: {
174
- APP: config2.name,
175
- STAGE: config2.stage,
174
+ APP: config.name,
175
+ STAGE: config.stage,
176
176
  STACK: stackConfig.name
177
177
  }
178
178
  });
@@ -183,7 +183,7 @@ var toStack = ({ config: config2, assets, app, stackConfig, plugins }) => {
183
183
  };
184
184
  debug("Run plugin onStack listeners");
185
185
  const functions = plugins.map((plugin) => plugin.onStack?.({
186
- config: config2,
186
+ config,
187
187
  assets,
188
188
  app,
189
189
  stack,
@@ -202,12 +202,12 @@ var toStack = ({ config: config2, assets, app, stackConfig, plugins }) => {
202
202
  ],
203
203
  resources: [
204
204
  import_aws_cdk_lib.Arn.format({
205
- region: config2.region,
206
- account: config2.account,
205
+ region: config.region,
206
+ account: config.account,
207
207
  partition: "aws",
208
208
  service: "ssm",
209
209
  resource: "parameter",
210
- resourceName: configParameterPrefix(config2)
210
+ resourceName: configParameterPrefix(config)
211
211
  })
212
212
  // Fn.sub('arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter' + configParameterPrefix(config)),
213
213
  ]
@@ -400,17 +400,17 @@ var zipFiles = (files) => {
400
400
  }
401
401
  });
402
402
  };
403
- var writeBuildHash = async (config2, stack, id, hash) => {
404
- const funcPath = (0, import_path3.join)(assetDir, "function", config2.name, stack.artifactId, id);
403
+ var writeBuildHash = async (config, stack, id, hash) => {
404
+ const funcPath = (0, import_path3.join)(assetDir, "function", config.name, stack.artifactId, id);
405
405
  const versionFile = (0, import_path3.join)(funcPath, "HASH");
406
406
  await (0, import_promises2.writeFile)(versionFile, hash);
407
407
  };
408
- var writeBuildFiles = async (config2, stack, id, files) => {
408
+ var writeBuildFiles = async (config, stack, id, files) => {
409
409
  const bundle = await zipFiles(files);
410
- const funcPath = (0, import_path3.join)(assetDir, "function", config2.name, stack.artifactId, id);
410
+ const funcPath = (0, import_path3.join)(assetDir, "function", config.name, stack.artifactId, id);
411
411
  const filesPath = (0, import_path3.join)(funcPath, "files");
412
412
  const bundleFile = (0, import_path3.join)(funcPath, "bundle.zip");
413
- debug("Bundle size of", style.info((0, import_path3.join)(config2.name, stack.artifactId, id)), "is", style.attr((0, import_filesize.filesize)(bundle.byteLength)));
413
+ debug("Bundle size of", style.info((0, import_path3.join)(config.name, stack.artifactId, id)), "is", style.attr((0, import_filesize.filesize)(bundle.byteLength)));
414
414
  await (0, import_promises2.mkdir)(filesPath, { recursive: true });
415
415
  await (0, import_promises2.writeFile)(bundleFile, bundle);
416
416
  await Promise.all(files.map(async (file) => {
@@ -436,20 +436,20 @@ var import_client_s3 = require("@aws-sdk/client-s3");
436
436
  // src/stack/bootstrap.ts
437
437
  var import_aws_cdk_lib2 = require("aws-cdk-lib");
438
438
  var import_aws_s3 = require("aws-cdk-lib/aws-s3");
439
- var assetBucketName = (config2) => {
440
- return `awsless-bootstrap-${config2.account}-${config2.region}`;
439
+ var assetBucketName = (config) => {
440
+ return `awsless-bootstrap-${config.account}-${config.region}`;
441
441
  };
442
- var assetBucketUrl = (config2, stackName) => {
443
- const bucket = assetBucketName(config2);
444
- return `https://s3-${config2.region}.amazonaws.com/${bucket}/${stackName}/cloudformation.json`;
442
+ var assetBucketUrl = (config, stackName) => {
443
+ const bucket = assetBucketName(config);
444
+ return `https://s3-${config.region}.amazonaws.com/${bucket}/${stackName}/cloudformation.json`;
445
445
  };
446
446
  var version = "2";
447
- var bootstrapStack = (config2, app) => {
447
+ var bootstrapStack = (config, app) => {
448
448
  const stack = new import_aws_cdk_lib2.Stack(app, "bootstrap", {
449
449
  stackName: `awsless-bootstrap`
450
450
  });
451
451
  new import_aws_s3.Bucket(stack, "assets", {
452
- bucketName: assetBucketName(config2),
452
+ bucketName: assetBucketName(config),
453
453
  versioned: true,
454
454
  accessControl: import_aws_s3.BucketAccessControl.PRIVATE,
455
455
  removalPolicy: import_aws_cdk_lib2.RemovalPolicy.DESTROY
@@ -467,17 +467,17 @@ var shouldDeployBootstrap = async (client, name) => {
467
467
  };
468
468
 
469
469
  // src/plugins/function/util/publish.ts
470
- var publishFunctionAsset = async (config2, stack, id) => {
471
- const bucket = assetBucketName(config2);
472
- const key = `${config2.name}/${stack.artifactId}/function/${id}.zip`;
473
- const funcPath = (0, import_path5.join)(assetDir, "function", config2.name, stack.artifactId, id);
470
+ var publishFunctionAsset = async (config, stack, id) => {
471
+ const bucket = assetBucketName(config);
472
+ const key = `${config.name}/${stack.artifactId}/function/${id}.zip`;
473
+ const funcPath = (0, import_path5.join)(assetDir, "function", config.name, stack.artifactId, id);
474
474
  const bundleFile = (0, import_path5.join)(funcPath, "bundle.zip");
475
475
  const hashFile = (0, import_path5.join)(funcPath, "HASH");
476
476
  const hash = await (0, import_promises3.readFile)(hashFile, "utf8");
477
477
  const file = await (0, import_promises3.readFile)(bundleFile);
478
478
  const client = new import_client_s3.S3Client({
479
- credentials: config2.credentials,
480
- region: config2.region
479
+ credentials: config.credentials,
480
+ region: config.region
481
481
  });
482
482
  let getResult;
483
483
  try {
@@ -550,19 +550,22 @@ var rollupBuild = async (input) => {
550
550
  (0, import_plugin_json.default)()
551
551
  ]
552
552
  });
553
- const { output: [output] } = await bundle.generate({
553
+ const result = await bundle.generate({
554
554
  format: "esm",
555
555
  sourcemap: "hidden",
556
556
  exports: "default"
557
557
  });
558
- const hash = (0, import_crypto.createHash)("sha1").update(output.code).digest("hex");
558
+ const output = result.output[0];
559
+ const code = output.code;
560
+ const map = output.map?.toString();
561
+ const hash = (0, import_crypto.createHash)("sha1").update(code).digest("hex");
559
562
  return {
560
563
  handler: "index.default",
561
564
  hash,
562
565
  files: [{
563
566
  name: "index.mjs",
564
- code: output.code,
565
- map: output.map?.toString()
567
+ code,
568
+ map
566
569
  }]
567
570
  };
568
571
  };
@@ -609,8 +612,8 @@ var functionPlugin = definePlugin({
609
612
  });
610
613
  }
611
614
  });
612
- var toFunction = ({ config: config2, stack, assets }, id, fileOrProps) => {
613
- const props = typeof fileOrProps === "string" ? { ...config2.defaults?.function, file: fileOrProps } : { ...config2.defaults?.function, ...fileOrProps };
615
+ var toFunction = ({ config, stack, assets }, id, fileOrProps) => {
616
+ const props = typeof fileOrProps === "string" ? { ...config.defaults?.function, file: fileOrProps } : { ...config.defaults?.function, ...fileOrProps };
614
617
  const lambda = new import_aws_lambda3.Function(stack, toId("function", id), {
615
618
  functionName: toName(stack, id),
616
619
  handler: "index.default",
@@ -618,8 +621,8 @@ var toFunction = ({ config: config2, stack, assets }, id, fileOrProps) => {
618
621
  ...props,
619
622
  memorySize: props.memorySize.toMebibytes()
620
623
  });
621
- lambda.addEnvironment("APP", config2.name, { removeInEdge: true });
622
- lambda.addEnvironment("STAGE", config2.stage, { removeInEdge: true });
624
+ lambda.addEnvironment("APP", config.name, { removeInEdge: true });
625
+ lambda.addEnvironment("STAGE", config.stage, { removeInEdge: true });
623
626
  lambda.addEnvironment("STACK", stack.artifactId, { removeInEdge: true });
624
627
  if (lambda.runtime.toString().startsWith("nodejs")) {
625
628
  lambda.addEnvironment("AWS_NODEJS_CONNECTION_REUSE_ENABLED", "1", {
@@ -632,8 +635,8 @@ var toFunction = ({ config: config2, stack, assets }, id, fileOrProps) => {
632
635
  resourceName: id,
633
636
  async build() {
634
637
  const result = await rollupBuild(props.file);
635
- const bundle = await writeBuildFiles(config2, stack, id, result.files);
636
- await writeBuildHash(config2, stack, id, result.hash);
638
+ const bundle = await writeBuildFiles(config, stack, id, result.files);
639
+ await writeBuildHash(config, stack, id, result.hash);
637
640
  const func = lambda.node.defaultChild;
638
641
  func.handler = result.handler;
639
642
  return {
@@ -641,11 +644,11 @@ var toFunction = ({ config: config2, stack, assets }, id, fileOrProps) => {
641
644
  };
642
645
  },
643
646
  async publish() {
644
- const version2 = await publishFunctionAsset(config2, stack, id);
647
+ const version2 = await publishFunctionAsset(config, stack, id);
645
648
  const func = lambda.node.defaultChild;
646
649
  func.code = {
647
- s3Bucket: assetBucketName(config2),
648
- s3Key: `${config2.name}/${stack.artifactId}/function/${id}.zip`,
650
+ s3Bucket: assetBucketName(config),
651
+ s3Key: `${config.name}/${stack.artifactId}/function/${id}.zip`,
649
652
  s3ObjectVersion: version2
650
653
  };
651
654
  }
@@ -714,9 +717,9 @@ var queuePlugin = definePlugin({
714
717
  }).array()
715
718
  }),
716
719
  onStack(ctx) {
717
- const { stack, config: config2, stackConfig, bind } = ctx;
720
+ const { stack, config, stackConfig, bind } = ctx;
718
721
  return Object.entries(stackConfig.queues || {}).map(([id, functionOrProps]) => {
719
- const props = typeof functionOrProps === "string" ? { ...config2.defaults.queue, consumer: functionOrProps } : { ...config2.defaults.queue, ...functionOrProps };
722
+ const props = typeof functionOrProps === "string" ? { ...config.defaults.queue, consumer: functionOrProps } : { ...config.defaults.queue, ...functionOrProps };
720
723
  const queue2 = new import_aws_sqs.Queue(stack, toId("queue", id), {
721
724
  queueName: toName(stack, id),
722
725
  ...props,
@@ -880,20 +883,20 @@ var topicPlugin = definePlugin({
880
883
  topics: import_zod18.z.record(ResourceIdSchema, FunctionSchema).optional()
881
884
  }).array()
882
885
  }),
883
- onBootstrap({ config: config2, stack }) {
884
- const allTopicNames = config2.stacks.map((stack2) => {
886
+ onBootstrap({ config, stack }) {
887
+ const allTopicNames = config.stacks.map((stack2) => {
885
888
  return Object.keys(stack2.topics || {});
886
889
  }).flat();
887
890
  const uniqueTopicNames = [...new Set(allTopicNames)];
888
891
  uniqueTopicNames.forEach((id) => {
889
892
  new import_aws_sns.Topic(stack, toId("topic", id), {
890
- topicName: `${config2.name}-${id}`,
893
+ topicName: `${config.name}-${id}`,
891
894
  displayName: id
892
895
  });
893
896
  });
894
897
  },
895
898
  onStack(ctx) {
896
- const { config: config2, stack, stackConfig, bind } = ctx;
899
+ const { config, stack, stackConfig, bind } = ctx;
897
900
  return Object.entries(stackConfig.topics || {}).map(([id, props]) => {
898
901
  const lambda = toFunction(ctx, id, props);
899
902
  const topic = import_aws_sns.Topic.fromTopicArn(
@@ -902,7 +905,7 @@ var topicPlugin = definePlugin({
902
905
  import_aws_cdk_lib4.Arn.format({
903
906
  arnFormat: import_aws_cdk_lib4.ArnFormat.NO_RESOURCE_NAME,
904
907
  service: "sns",
905
- resource: `${config2.name}-${id}`
908
+ resource: `${config.name}-${id}`
906
909
  }, stack)
907
910
  );
908
911
  lambda.addEventSource(new import_aws_lambda_event_sources2.SnsEventSource(topic));
@@ -994,19 +997,19 @@ var graphqlPlugin = definePlugin({
994
997
  })).optional()
995
998
  }).array()
996
999
  }),
997
- onBootstrap({ config: config2, stack, assets }) {
1000
+ onBootstrap({ config, stack, assets }) {
998
1001
  const list3 = /* @__PURE__ */ new Set();
999
- Object.values(config2.stacks).forEach((stackConfig) => {
1002
+ Object.values(config.stacks).forEach((stackConfig) => {
1000
1003
  Object.keys(stackConfig.graphql || {}).forEach((id) => {
1001
1004
  list3.add(id);
1002
1005
  });
1003
1006
  });
1004
1007
  list3.forEach((id) => {
1005
- const file = (0, import_path6.join)(assetDir, "graphql", config2.name, id, "schema.graphql");
1006
- const authorization = config2.defaults.graphql?.[id]?.authorization;
1008
+ const file = (0, import_path6.join)(assetDir, "graphql", config.name, id, "schema.graphql");
1009
+ const authorization = config.defaults.graphql?.[id]?.authorization;
1007
1010
  const authProps = {};
1008
1011
  if (authorization) {
1009
- const authorizer = toFunction({ config: config2, assets, stack }, `${id}-authorizer`, authorization.authorizer);
1012
+ const authorizer = toFunction({ config, assets, stack }, `${id}-authorizer`, authorization.authorizer);
1010
1013
  authProps.additionalAuthenticationProviders = [{
1011
1014
  authenticationType: import_aws_appsync.AuthorizationType.LAMBDA,
1012
1015
  lambdaAuthorizerConfig: {
@@ -1030,7 +1033,7 @@ var graphqlPlugin = definePlugin({
1030
1033
  resourceName: id,
1031
1034
  async build() {
1032
1035
  const schemas = [];
1033
- await Promise.all(Object.values(config2.stacks).map(async (stackConfig) => {
1036
+ await Promise.all(Object.values(config.stacks).map(async (stackConfig) => {
1034
1037
  const schemaFiles = toArray(stackConfig.graphql?.[id].schema || []);
1035
1038
  await Promise.all(schemaFiles.map(async (schemaFile) => {
1036
1039
  const schema3 = await (0, import_promises4.readFile)(schemaFile, "utf8");
@@ -1049,9 +1052,9 @@ var graphqlPlugin = definePlugin({
1049
1052
  });
1050
1053
  },
1051
1054
  onStack(ctx) {
1052
- const { config: config2, stack, stackConfig } = ctx;
1055
+ const { config, stack, stackConfig } = ctx;
1053
1056
  return Object.entries(stackConfig.graphql || {}).map(([id, props]) => {
1054
- const defaults = config2.defaults.graphql?.[id] || {};
1057
+ const defaults = config.defaults.graphql?.[id] || {};
1055
1058
  return Object.entries(props.resolvers || {}).map(([typeAndField, functionProps]) => {
1056
1059
  const api = import_aws_appsync.GraphqlApi.fromGraphqlApiAttributes(stack, toId("graphql", id), {
1057
1060
  graphqlApiId: import_aws_cdk_lib5.Fn.importValue(toId("graphql", id))
@@ -1074,6 +1077,48 @@ var graphqlPlugin = definePlugin({
1074
1077
  }
1075
1078
  });
1076
1079
 
1080
+ // src/plugins/pubsub.ts
1081
+ var import_zod22 = require("zod");
1082
+ var import_aws_iot = require("aws-cdk-lib/aws-iot");
1083
+ var import_aws_iam3 = require("aws-cdk-lib/aws-iam");
1084
+ var pubsubPlugin = definePlugin({
1085
+ name: "pubsub",
1086
+ schema: import_zod22.z.object({
1087
+ stacks: import_zod22.z.object({
1088
+ pubsub: import_zod22.z.record(ResourceIdSchema, import_zod22.z.object({
1089
+ sql: import_zod22.z.string(),
1090
+ sqlVersion: import_zod22.z.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23"),
1091
+ consumer: FunctionSchema
1092
+ })).optional()
1093
+ }).array()
1094
+ }),
1095
+ onStack(ctx) {
1096
+ const { stack, stackConfig, bind } = ctx;
1097
+ bind((lambda) => {
1098
+ lambda.addToRolePolicy(new import_aws_iam3.PolicyStatement({
1099
+ actions: ["iot:publish"],
1100
+ resources: ["*"]
1101
+ }));
1102
+ });
1103
+ return Object.entries(stackConfig.pubsub || {}).map(([id, props]) => {
1104
+ const lambda = toFunction(ctx, id, props.consumer);
1105
+ new import_aws_iot.CfnTopicRule(stack, toId("pubsub", id), {
1106
+ ruleName: toName(stack, id),
1107
+ topicRulePayload: {
1108
+ sql: props.sql,
1109
+ awsIotSqlVersion: props.sqlVersion,
1110
+ actions: [{
1111
+ lambda: {
1112
+ functionArn: lambda.functionArn
1113
+ }
1114
+ }]
1115
+ }
1116
+ });
1117
+ return lambda;
1118
+ });
1119
+ }
1120
+ });
1121
+
1077
1122
  // src/plugins/index.ts
1078
1123
  var defaultPlugins = [
1079
1124
  functionPlugin,
@@ -1083,21 +1128,22 @@ var defaultPlugins = [
1083
1128
  storePlugin,
1084
1129
  topicPlugin,
1085
1130
  searchPlugin,
1086
- graphqlPlugin
1131
+ graphqlPlugin,
1132
+ pubsubPlugin
1087
1133
  ];
1088
1134
 
1089
1135
  // src/stack/app-bootstrap.ts
1090
- var appBootstrapStack = ({ config: config2, app, assets }) => {
1136
+ var appBootstrapStack = ({ config, app, assets }) => {
1091
1137
  const stack = new import_aws_cdk_lib6.Stack(app, "bootstrap", {
1092
- stackName: `${config2.name}-bootstrap`
1138
+ stackName: `${config.name}-bootstrap`
1093
1139
  });
1094
1140
  const plugins = [
1095
1141
  ...defaultPlugins,
1096
- ...config2.plugins || []
1142
+ ...config.plugins || []
1097
1143
  ];
1098
1144
  debug("Run plugin onBootstrap listeners");
1099
1145
  const functions = plugins.map((plugin) => plugin.onBootstrap?.({
1100
- config: config2,
1146
+ config,
1101
1147
  app,
1102
1148
  stack,
1103
1149
  assets
@@ -1121,9 +1167,9 @@ var flattenDependencyTree = (stacks) => {
1121
1167
  return list3;
1122
1168
  };
1123
1169
  var createDependencyTree = (stacks, startingLevel) => {
1124
- const list3 = stacks.map(({ stack, config: config2 }) => ({
1170
+ const list3 = stacks.map(({ stack, config }) => ({
1125
1171
  stack,
1126
- depends: config2?.depends?.map((dep) => dep.name) || []
1172
+ depends: config?.depends?.map((dep) => dep.name) || []
1127
1173
  }));
1128
1174
  const findChildren = (list4, parents, level) => {
1129
1175
  const children = [];
@@ -1195,11 +1241,11 @@ var Assets = class {
1195
1241
  };
1196
1242
 
1197
1243
  // src/app.ts
1198
- var makeApp = (config2) => {
1244
+ var makeApp = (config) => {
1199
1245
  return new import_aws_cdk_lib7.App({
1200
1246
  outdir: assemblyDir,
1201
1247
  defaultStackSynthesizer: new import_aws_cdk_lib7.DefaultStackSynthesizer({
1202
- fileAssetsBucketName: assetBucketName(config2),
1248
+ fileAssetsBucketName: assetBucketName(config),
1203
1249
  fileAssetPublishingRoleArn: "",
1204
1250
  generateBootstrapVersionRule: false
1205
1251
  })
@@ -1216,26 +1262,26 @@ var getAllDepends = (filters) => {
1216
1262
  walk(filters);
1217
1263
  return list3;
1218
1264
  };
1219
- var toApp = async (config2, filters) => {
1265
+ var toApp = async (config, filters) => {
1220
1266
  const assets = new Assets();
1221
- const app = makeApp(config2);
1267
+ const app = makeApp(config);
1222
1268
  const stacks = [];
1223
1269
  const plugins = [
1224
1270
  ...defaultPlugins,
1225
- ...config2.plugins || []
1271
+ ...config.plugins || []
1226
1272
  ];
1227
1273
  debug("Plugins detected:", plugins.map((plugin) => style.info(plugin.name)).join(", "));
1228
1274
  debug("Run plugin onApp listeners");
1229
- plugins.forEach((plugin) => plugin.onApp?.({ config: config2, app, assets }));
1230
- const bootstrap2 = appBootstrapStack({ config: config2, app, assets });
1275
+ plugins.forEach((plugin) => plugin.onApp?.({ config, app, assets }));
1276
+ const bootstrap2 = appBootstrapStack({ config, app, assets });
1231
1277
  debug("Stack filters:", filters.map((filter) => style.info(filter)).join(", "));
1232
- const filterdStacks = filters.length === 0 ? config2.stacks : getAllDepends(
1278
+ const filterdStacks = filters.length === 0 ? config.stacks : getAllDepends(
1233
1279
  // config.stacks,
1234
- config2.stacks.filter((stack) => filters.includes(stack.name))
1280
+ config.stacks.filter((stack) => filters.includes(stack.name))
1235
1281
  );
1236
1282
  for (const stackConfig of filterdStacks) {
1237
1283
  const { stack, bindings } = toStack({
1238
- config: config2,
1284
+ config,
1239
1285
  stackConfig,
1240
1286
  assets,
1241
1287
  plugins,
@@ -1340,17 +1386,17 @@ var getCredentials = (profile) => {
1340
1386
  };
1341
1387
 
1342
1388
  // src/schema/app.ts
1343
- var import_zod25 = require("zod");
1389
+ var import_zod26 = require("zod");
1344
1390
 
1345
1391
  // src/schema/stack.ts
1346
- var import_zod22 = require("zod");
1347
- var StackSchema = import_zod22.z.object({
1392
+ var import_zod23 = require("zod");
1393
+ var StackSchema = import_zod23.z.object({
1348
1394
  name: ResourceIdSchema,
1349
- depends: import_zod22.z.array(import_zod22.z.lazy(() => StackSchema)).optional()
1395
+ depends: import_zod23.z.array(import_zod23.z.lazy(() => StackSchema)).optional()
1350
1396
  });
1351
1397
 
1352
1398
  // src/schema/region.ts
1353
- var import_zod23 = require("zod");
1399
+ var import_zod24 = require("zod");
1354
1400
  var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
1355
1401
  var AF = ["af-south-1"];
1356
1402
  var AP = ["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"];
@@ -1367,29 +1413,29 @@ var regions = [
1367
1413
  ...ME,
1368
1414
  ...SA
1369
1415
  ];
1370
- var RegionSchema = import_zod23.z.enum(regions);
1416
+ var RegionSchema = import_zod24.z.enum(regions);
1371
1417
 
1372
1418
  // src/schema/plugin.ts
1373
- var import_zod24 = require("zod");
1374
- var PluginSchema = import_zod24.z.object({
1375
- name: import_zod24.z.string(),
1376
- schema: import_zod24.z.custom().optional(),
1419
+ var import_zod25 = require("zod");
1420
+ var PluginSchema = import_zod25.z.object({
1421
+ name: import_zod25.z.string(),
1422
+ schema: import_zod25.z.custom().optional(),
1377
1423
  // depends: z.array(z.lazy(() => PluginSchema)).optional(),
1378
- onBootstrap: import_zod24.z.function().returns(import_zod24.z.any()).optional(),
1379
- onStack: import_zod24.z.function().returns(import_zod24.z.any()).optional(),
1380
- onApp: import_zod24.z.function().returns(import_zod24.z.void()).optional()
1424
+ onBootstrap: import_zod25.z.function().returns(import_zod25.z.any()).optional(),
1425
+ onStack: import_zod25.z.function().returns(import_zod25.z.any()).optional(),
1426
+ onApp: import_zod25.z.function().returns(import_zod25.z.void()).optional()
1381
1427
  // bind: z.function().optional(),
1382
1428
  });
1383
1429
 
1384
1430
  // src/schema/app.ts
1385
- var AppSchema = import_zod25.z.object({
1431
+ var AppSchema = import_zod26.z.object({
1386
1432
  name: ResourceIdSchema,
1387
1433
  region: RegionSchema,
1388
- profile: import_zod25.z.string(),
1389
- stage: import_zod25.z.string().regex(/[a-z]+/).default("prod"),
1390
- defaults: import_zod25.z.object({}).default({}),
1391
- stacks: import_zod25.z.array(StackSchema).min(1),
1392
- plugins: import_zod25.z.array(PluginSchema).optional()
1434
+ profile: import_zod26.z.string(),
1435
+ stage: import_zod26.z.string().regex(/[a-z]+/).default("prod"),
1436
+ defaults: import_zod26.z.object({}).default({}),
1437
+ stacks: import_zod26.z.array(StackSchema).min(1),
1438
+ plugins: import_zod26.z.array(PluginSchema).optional()
1393
1439
  });
1394
1440
 
1395
1441
  // src/util/import.ts
@@ -1469,14 +1515,14 @@ var importConfig = async (options) => {
1469
1515
  schema2 = schema2.and(plugin.schema);
1470
1516
  }
1471
1517
  }
1472
- const config2 = await schema2.parseAsync(appConfig);
1473
- debug("Load credentials", style.info(config2.profile));
1474
- const credentials = getCredentials(config2.profile);
1518
+ const config = await schema2.parseAsync(appConfig);
1519
+ debug("Load credentials", style.info(config.profile));
1520
+ const credentials = getCredentials(config.profile);
1475
1521
  debug("Load AWS account ID");
1476
- const account = await getAccountId(credentials, config2.region);
1522
+ const account = await getAccountId(credentials, config.region);
1477
1523
  debug("Account ID:", style.info(account));
1478
1524
  return {
1479
- ...config2,
1525
+ ...config,
1480
1526
  account,
1481
1527
  credentials
1482
1528
  };
@@ -1498,14 +1544,14 @@ var list = (data) => {
1498
1544
  };
1499
1545
 
1500
1546
  // src/cli/ui/layout/header.ts
1501
- var header = (config2) => {
1547
+ var header = (config) => {
1502
1548
  return [
1503
1549
  br(),
1504
1550
  list({
1505
- App: config2.name,
1506
- Stage: config2.stage,
1507
- Region: config2.region,
1508
- Profile: config2.profile
1551
+ App: config.name,
1552
+ Stage: config.stage,
1553
+ Region: config.region,
1554
+ Profile: config.profile
1509
1555
  }),
1510
1556
  br()
1511
1557
  ];
@@ -1823,9 +1869,9 @@ var layout = async (cb) => {
1823
1869
  term.out.write(logo());
1824
1870
  try {
1825
1871
  const options = program.optsWithGlobals();
1826
- const config2 = await importConfig(options);
1827
- term.out.write(header(config2));
1828
- await cb(config2, term.out.write.bind(term.out), term);
1872
+ const config = await importConfig(options);
1873
+ term.out.write(header(config));
1874
+ await cb(config, term.out.write.bind(term.out), term);
1829
1875
  } catch (error) {
1830
1876
  if (error instanceof Error) {
1831
1877
  term.out.write(dialog("error", [error.message]));
@@ -1940,8 +1986,8 @@ var cleanUp = async () => {
1940
1986
  // src/cli/command/build.ts
1941
1987
  var build = (program2) => {
1942
1988
  program2.command("build").argument("[stack...]", "Optionally filter stacks to build").description("Build your app").action(async (filters) => {
1943
- await layout(async (config2, write) => {
1944
- const { app, assets } = await toApp(config2, filters);
1989
+ await layout(async (config, write) => {
1990
+ const { app, assets } = await toApp(config, filters);
1945
1991
  await cleanUp();
1946
1992
  await write(assetBuilder(assets));
1947
1993
  app.synth();
@@ -1954,11 +2000,11 @@ var import_client_cloudformation = require("@aws-sdk/client-cloudformation");
1954
2000
  var import_client_s32 = require("@aws-sdk/client-s3");
1955
2001
  var StackClient = class {
1956
2002
  // 30 seconds
1957
- constructor(config2) {
1958
- this.config = config2;
2003
+ constructor(config) {
2004
+ this.config = config;
1959
2005
  this.client = new import_client_cloudformation.CloudFormationClient({
1960
- credentials: config2.credentials,
1961
- region: config2.region
2006
+ credentials: config.credentials,
2007
+ region: config.region
1962
2008
  });
1963
2009
  }
1964
2010
  client;
@@ -2187,12 +2233,12 @@ var confirmPrompt = (label, options = {}) => {
2187
2233
  };
2188
2234
 
2189
2235
  // src/cli/ui/complex/bootstrap.ts
2190
- var bootstrapDeployer = (config2) => {
2236
+ var bootstrapDeployer = (config) => {
2191
2237
  return async (term) => {
2192
2238
  debug("Initializing bootstrap");
2193
- const app = makeApp(config2);
2194
- const client = new StackClient(config2);
2195
- const bootstrap2 = bootstrapStack(config2, app);
2239
+ const app = makeApp(config);
2240
+ const client = new StackClient(config);
2241
+ const bootstrap2 = bootstrapStack(config, app);
2196
2242
  const shouldDeploy = await shouldDeployBootstrap(client, bootstrap2.stackName);
2197
2243
  if (shouldDeploy) {
2198
2244
  term.out.write(dialog("warning", [`Your app hasn't been bootstrapped yet`]));
@@ -2216,8 +2262,8 @@ var bootstrapDeployer = (config2) => {
2216
2262
  // src/cli/command/bootstrap.ts
2217
2263
  var bootstrap = (program2) => {
2218
2264
  program2.command("bootstrap").description("Create the awsless bootstrap stack").action(async () => {
2219
- await layout(async (config2, write) => {
2220
- await write(bootstrapDeployer(config2));
2265
+ await layout(async (config, write) => {
2266
+ await write(bootstrapDeployer(config));
2221
2267
  });
2222
2268
  });
2223
2269
  };
@@ -2261,14 +2307,14 @@ var stackTree = (nodes, statuses) => {
2261
2307
  // src/cli/command/status.ts
2262
2308
  var status = (program2) => {
2263
2309
  program2.command("status").argument("[stacks...]", "Optionally filter stacks to lookup status").description("View the application status").action(async (filters) => {
2264
- await layout(async (config2, write) => {
2265
- const { app, assets, dependencyTree } = await toApp(config2, filters);
2310
+ await layout(async (config, write) => {
2311
+ const { app, assets, dependencyTree } = await toApp(config, filters);
2266
2312
  await cleanUp();
2267
2313
  await write(assetBuilder(assets));
2268
2314
  write(br());
2269
2315
  const assembly = app.synth();
2270
2316
  const doneLoading = write(loadingDialog("Loading stack information..."));
2271
- const client = new StackClient(config2);
2317
+ const client = new StackClient(config);
2272
2318
  const statuses = [];
2273
2319
  const stackStatuses = {};
2274
2320
  assembly.stacks.forEach((stack) => {
@@ -2308,9 +2354,9 @@ var status = (program2) => {
2308
2354
  // src/cli/command/deploy.ts
2309
2355
  var deploy = (program2) => {
2310
2356
  program2.command("deploy").argument("[stacks...]", "Optionally filter stacks to deploy").description("Deploy your app to AWS").action(async (filters) => {
2311
- await layout(async (config2, write) => {
2312
- await write(bootstrapDeployer(config2));
2313
- const { app, stackNames, assets, dependencyTree } = await toApp(config2, filters);
2357
+ await layout(async (config, write) => {
2358
+ await write(bootstrapDeployer(config));
2359
+ const { app, stackNames, assets, dependencyTree } = await toApp(config, filters);
2314
2360
  const formattedFilter = stackNames.map((i) => style.info(i)).join(style.placeholder(", "));
2315
2361
  debug("Stacks to deploy", formattedFilter);
2316
2362
  const deployAll = filters.length === 0;
@@ -2339,7 +2385,7 @@ var deploy = (program2) => {
2339
2385
  write(br());
2340
2386
  write(stackTree(dependencyTree, statuses));
2341
2387
  write(br());
2342
- const client = new StackClient(config2);
2388
+ const client = new StackClient(config);
2343
2389
  const deploymentLine = createDeploymentLine(dependencyTree);
2344
2390
  for (const stacks of deploymentLine) {
2345
2391
  const results = await Promise.allSettled(stacks.map(async (stack) => {
@@ -2428,35 +2474,35 @@ var textPrompt = (label, options = {}) => {
2428
2474
  };
2429
2475
  };
2430
2476
 
2431
- // src/cli/command/config/set.ts
2477
+ // src/cli/command/secrets/set.ts
2432
2478
  var set = (program2) => {
2433
- program2.command("set <name>").description("Set a config value").action(async (name) => {
2434
- await layout(async (config2, write) => {
2435
- const params = new Params(config2);
2479
+ program2.command("set <name>").description("Set a secret value").action(async (name) => {
2480
+ await layout(async (config, write) => {
2481
+ const params = new Params(config);
2436
2482
  write(list({
2437
- "Set config parameter": style.info(name)
2483
+ "Set secret parameter": style.info(name)
2438
2484
  }));
2439
2485
  write(br());
2440
- const value = await write(textPrompt("Enter config value"));
2486
+ const value = await write(textPrompt("Enter secret value"));
2441
2487
  if (value === "") {
2442
- write(dialog("error", [`Provided config value can't be empty`]));
2488
+ write(dialog("error", [`Provided secret value can't be empty`]));
2443
2489
  } else {
2444
- const done = write(loadingDialog(`Saving remote config parameter`));
2490
+ const done = write(loadingDialog(`Saving remote secret parameter`));
2445
2491
  await params.set(name, value);
2446
- done(`Done saving remote config parameter`);
2492
+ done(`Done saving remote secret parameter`);
2447
2493
  }
2448
2494
  });
2449
2495
  });
2450
2496
  };
2451
2497
 
2452
- // src/cli/command/config/get.ts
2498
+ // src/cli/command/secrets/get.ts
2453
2499
  var get = (program2) => {
2454
- program2.command("get <name>").description("Get a config value").action(async (name) => {
2455
- await layout(async (config2, write) => {
2456
- const params = new Params(config2);
2457
- const done = write(loadingDialog(`Getting remote config parameter`));
2500
+ program2.command("get <name>").description("Get a secret value").action(async (name) => {
2501
+ await layout(async (config, write) => {
2502
+ const params = new Params(config);
2503
+ const done = write(loadingDialog(`Getting remote secret parameter`));
2458
2504
  const value = await params.get(name);
2459
- done(`Done getting remote config parameter`);
2505
+ done(`Done getting remote secret parameter`);
2460
2506
  write(br());
2461
2507
  write(list({
2462
2508
  Name: name,
@@ -2466,20 +2512,20 @@ var get = (program2) => {
2466
2512
  });
2467
2513
  };
2468
2514
 
2469
- // src/cli/command/config/delete.ts
2515
+ // src/cli/command/secrets/delete.ts
2470
2516
  var del = (program2) => {
2471
- program2.command("delete <name>").description("Delete a config value").action(async (name) => {
2472
- await layout(async (config2, write) => {
2473
- const params = new Params(config2);
2474
- write(dialog("warning", [`Your deleting the ${style.info(name)} config parameter`]));
2517
+ program2.command("delete <name>").description("Delete a secret value").action(async (name) => {
2518
+ await layout(async (config, write) => {
2519
+ const params = new Params(config);
2520
+ write(dialog("warning", [`Your deleting the ${style.info(name)} secret parameter`]));
2475
2521
  const confirm = await write(confirmPrompt("Are you sure?"));
2476
2522
  if (!confirm) {
2477
2523
  throw new Cancelled();
2478
2524
  }
2479
- const done = write(loadingDialog(`Deleting remote config parameter`));
2525
+ const done = write(loadingDialog(`Deleting remote secret parameter`));
2480
2526
  const value = await params.get(name);
2481
2527
  await params.delete(name);
2482
- done(`Done deleting remote config parameter`);
2528
+ done(`Done deleting remote secret parameter`);
2483
2529
  write(br());
2484
2530
  write(list({
2485
2531
  Name: name,
@@ -2489,33 +2535,33 @@ var del = (program2) => {
2489
2535
  });
2490
2536
  };
2491
2537
 
2492
- // src/cli/command/config/list.ts
2538
+ // src/cli/command/secrets/list.ts
2493
2539
  var list2 = (program2) => {
2494
- program2.command("list").description(`List all config value's`).action(async () => {
2495
- await layout(async (config2, write) => {
2496
- const params = new Params(config2);
2497
- const done = write(loadingDialog("Loading config parameters..."));
2540
+ program2.command("list").description(`List all secret value's`).action(async () => {
2541
+ await layout(async (config, write) => {
2542
+ const params = new Params(config);
2543
+ const done = write(loadingDialog("Loading secret parameters..."));
2498
2544
  const values = await params.list();
2499
- done("Done loading config values");
2545
+ done("Done loading secret values");
2500
2546
  if (Object.keys(values).length > 0) {
2501
2547
  write(br());
2502
2548
  write(list(values));
2503
2549
  } else {
2504
- write(dialog("warning", ["No config parameters found"]));
2550
+ write(dialog("warning", ["No secret parameters found"]));
2505
2551
  }
2506
2552
  });
2507
2553
  });
2508
2554
  };
2509
2555
 
2510
- // src/cli/command/config/index.ts
2556
+ // src/cli/command/secrets/index.ts
2511
2557
  var commands = [
2512
2558
  set,
2513
2559
  get,
2514
2560
  del,
2515
2561
  list2
2516
2562
  ];
2517
- var config = (program2) => {
2518
- const command = program2.command("config").description("Manage config values");
2563
+ var secrets = (program2) => {
2564
+ const command = program2.command("secrets").description(`Manage app secrets`);
2519
2565
  commands.forEach((cb) => cb(command));
2520
2566
  };
2521
2567
 
@@ -2536,7 +2582,7 @@ var commands2 = [
2536
2582
  status,
2537
2583
  build,
2538
2584
  deploy,
2539
- config
2585
+ secrets
2540
2586
  // diff,
2541
2587
  // remove,
2542
2588
  // test,