@awsless/awsless 0.0.597 → 0.0.599

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
@@ -4543,7 +4543,7 @@ var restFeature = defineFeature({
4543
4543
  });
4544
4544
 
4545
4545
  // src/feature/rpc/index.ts
4546
- import { camelCase as camelCase5, kebabCase as kebabCase6 } from "change-case";
4546
+ import { camelCase as camelCase5, constantCase as constantCase8, kebabCase as kebabCase6 } from "change-case";
4547
4547
  import { Group as Group13 } from "@terraforge/core";
4548
4548
  import { aws as aws14 } from "@terraforge/aws";
4549
4549
  import { mebibytes as mebibytes3 } from "@awsless/size";
@@ -4860,6 +4860,12 @@ var rpcFeature = defineFeature({
4860
4860
  const authGroup = new Group13(group, "auth", "authorizer");
4861
4861
  const auth2 = createLambdaFunction(authGroup, ctx, "rpc", `${id}-auth`, props.auth);
4862
4862
  result.setEnvironment("AUTH", auth2.name);
4863
+ for (const [authId, userPoolId] of ctx.shared.list("auth", "user-pool-id")) {
4864
+ auth2.setEnvironment(`AUTH_${constantCase8(authId.toString())}_USER_POOL_ID`, userPoolId);
4865
+ }
4866
+ for (const [authId, clientId] of ctx.shared.list("auth", "client-id")) {
4867
+ auth2.setEnvironment(`AUTH_${constantCase8(authId.toString())}_CLIENT_ID`, clientId);
4868
+ }
4863
4869
  new UpdateFunctionCode(group, "update", {
4864
4870
  version: auth2.code.sourceHash,
4865
4871
  functionName: result.lambda.functionName,
@@ -4951,7 +4957,7 @@ var rpcFeature = defineFeature({
4951
4957
  // src/feature/search/index.ts
4952
4958
  import { Group as Group14 } from "@terraforge/core";
4953
4959
  import { aws as aws15 } from "@terraforge/aws";
4954
- import { constantCase as constantCase8 } from "change-case";
4960
+ import { constantCase as constantCase9 } from "change-case";
4955
4961
  import { toGibibytes as toGibibytes2 } from "@awsless/size";
4956
4962
  var typeGenCode4 = `
4957
4963
  import { AnyStruct, Table } from '@awsless/open-search'
@@ -5042,7 +5048,7 @@ var searchFeature = defineFeature({
5042
5048
  retainOnDelete: ctx.appConfig.removal === "retain"
5043
5049
  }
5044
5050
  );
5045
- ctx.addEnv(`SEARCH_${constantCase8(ctx.stack.name)}_${constantCase8(id)}_DOMAIN`, openSearch.endpoint);
5051
+ ctx.addEnv(`SEARCH_${constantCase9(ctx.stack.name)}_${constantCase9(id)}_DOMAIN`, openSearch.endpoint);
5046
5052
  ctx.addStackPermission({
5047
5053
  actions: ["es:ESHttp*"],
5048
5054
  resources: [
@@ -5082,7 +5088,7 @@ var getContentType = (file) => {
5082
5088
  };
5083
5089
 
5084
5090
  // src/feature/site/index.ts
5085
- import { constantCase as constantCase9 } from "change-case";
5091
+ import { constantCase as constantCase10 } from "change-case";
5086
5092
 
5087
5093
  // src/util/exec.ts
5088
5094
  import { exec } from "promisify-child-process";
@@ -5132,7 +5138,7 @@ var siteFeature = defineFeature({
5132
5138
  AWS_SESSION_TOKEN: credentials.sessionToken
5133
5139
  };
5134
5140
  for (const name2 of props.build?.configs ?? []) {
5135
- env[`CONFIG_${constantCase9(name2)}`] = name2;
5141
+ env[`CONFIG_${constantCase10(name2)}`] = name2;
5136
5142
  }
5137
5143
  await execCommand({
5138
5144
  cwd,
@@ -5475,7 +5481,7 @@ var storeFeature = defineFeature({
5475
5481
  // src/feature/table/index.ts
5476
5482
  import { Group as Group17 } from "@terraforge/core";
5477
5483
  import { aws as aws18 } from "@terraforge/aws";
5478
- import { constantCase as constantCase10 } from "change-case";
5484
+ import { constantCase as constantCase11 } from "change-case";
5479
5485
  import { toSeconds as toSeconds7 } from "@awsless/duration";
5480
5486
  var tableFeature = defineFeature({
5481
5487
  name: "table",
@@ -5557,8 +5563,8 @@ var tableFeature = defineFeature({
5557
5563
  name,
5558
5564
  billingMode: "PAY_PER_REQUEST",
5559
5565
  streamEnabled: !!props.stream,
5560
- streamViewType: props.stream && constantCase10(props.stream?.type),
5561
- tableClass: constantCase10(props.class),
5566
+ streamViewType: props.stream && constantCase11(props.stream?.type),
5567
+ tableClass: constantCase11(props.class),
5562
5568
  hashKey: props.hash,
5563
5569
  rangeKey: props.sort,
5564
5570
  attribute: attributeDefinitions(),
@@ -5573,7 +5579,7 @@ var tableFeature = defineFeature({
5573
5579
  name: name2,
5574
5580
  hashKey: index.hash,
5575
5581
  rangeKey: index.sort,
5576
- projectionType: constantCase10(index.projection)
5582
+ projectionType: constantCase11(index.projection)
5577
5583
  })),
5578
5584
  deletionProtectionEnabled: ctx.appConfig.removal === "retain"
5579
5585
  },
@@ -6494,7 +6500,7 @@ import { toMebibytes as toMebibytes4 } from "@awsless/size";
6494
6500
  import { generateFileHash as generateFileHash2 } from "@awsless/ts-file-cache";
6495
6501
  import { aws as aws26 } from "@terraforge/aws";
6496
6502
  import { Group as Group25, Output as Output7, findInputDeps as findInputDeps3, resolveInputs as resolveInputs3 } from "@terraforge/core";
6497
- import { constantCase as constantCase11, pascalCase as pascalCase3 } from "change-case";
6503
+ import { constantCase as constantCase12, pascalCase as pascalCase3 } from "change-case";
6498
6504
  import deepmerge4 from "deepmerge";
6499
6505
  import { join as join16 } from "path";
6500
6506
 
@@ -6687,7 +6693,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
6687
6693
  executionRoleArn: executionRole.arn,
6688
6694
  taskRoleArn: role.arn,
6689
6695
  runtimePlatform: {
6690
- cpuArchitecture: constantCase11(props.architecture),
6696
+ cpuArchitecture: constantCase12(props.architecture),
6691
6697
  operatingSystemFamily: "LINUX"
6692
6698
  },
6693
6699
  trackLatest: true,
@@ -6895,7 +6901,7 @@ var instanceFeature = defineFeature({
6895
6901
  // src/feature/metric/index.ts
6896
6902
  import { Group as Group27 } from "@terraforge/core";
6897
6903
  import { aws as aws28 } from "@terraforge/aws";
6898
- import { kebabCase as kebabCase8, constantCase as constantCase12 } from "change-case";
6904
+ import { kebabCase as kebabCase8, constantCase as constantCase13 } from "change-case";
6899
6905
  import { toSeconds as toSeconds9 } from "@awsless/duration";
6900
6906
  var typeGenCode9 = `
6901
6907
  import { type PutDataProps, putData, batchPutData } from '@awsless/cloudwatch'
@@ -6963,7 +6969,7 @@ var metricFeature = defineFeature({
6963
6969
  });
6964
6970
  for (const [id, props] of Object.entries(ctx.stackConfig.metrics ?? {})) {
6965
6971
  const group = new Group27(ctx.stack, "metric", id);
6966
- ctx.addEnv(`METRIC_${constantCase12(id)}`, props.type);
6972
+ ctx.addEnv(`METRIC_${constantCase13(id)}`, props.type);
6967
6973
  for (const alarmId in props.alarms ?? []) {
6968
6974
  const alarmGroup = new Group27(group, "alarm", alarmId);
6969
6975
  const alarmName = kebabCase8(`${id}-${alarmId}`);
@@ -7026,7 +7032,7 @@ var metricFeature = defineFeature({
7026
7032
  import { days as days7, seconds as seconds9, toSeconds as toSeconds10, years } from "@awsless/duration";
7027
7033
  import { Future, Group as Group28 } from "@terraforge/core";
7028
7034
  import { aws as aws29 } from "@terraforge/aws";
7029
- import { camelCase as camelCase7, constantCase as constantCase13 } from "change-case";
7035
+ import { camelCase as camelCase7, constantCase as constantCase14 } from "change-case";
7030
7036
 
7031
7037
  // src/feature/router/router-code.ts
7032
7038
  var getViewerRequestFunctionCode = (props) => {
@@ -7618,7 +7624,7 @@ var routerFeature = defineFeature({
7618
7624
  evaluateTargetHealth: false
7619
7625
  }
7620
7626
  });
7621
- ctx.bind(`ROUTER_${constantCase13(id)}_ENDPOINT`, domainName);
7627
+ ctx.bind(`ROUTER_${constantCase14(id)}_ENDPOINT`, domainName);
7622
7628
  }
7623
7629
  }
7624
7630
  }
@@ -7963,16 +7969,13 @@ import { App as App2, Stack } from "@terraforge/core";
7963
7969
  var SharedData = class {
7964
7970
  data = /* @__PURE__ */ new Map();
7965
7971
  entries = /* @__PURE__ */ new Map();
7966
- #get(key) {
7972
+ get(feature, name) {
7973
+ const key = `${feature}/${name.toString()}`;
7967
7974
  if (!this.data.has(key)) {
7968
7975
  throw new TypeError(`Shared data not found: ${key}`);
7969
7976
  }
7970
7977
  return this.data.get(key);
7971
7978
  }
7972
- get(feature, name) {
7973
- const key = `${feature}/${name.toString()}`;
7974
- return this.#get(key);
7975
- }
7976
7979
  has(feature, name) {
7977
7980
  const key = `${feature}/${name.toString()}`;
7978
7981
  return this.data.has(key);
@@ -7983,14 +7986,28 @@ var SharedData = class {
7983
7986
  return this;
7984
7987
  }
7985
7988
  entry(feature, name, entry) {
7986
- const key = `${feature}/${name.toString()}/${entry}`;
7987
- return this.#get(key);
7989
+ const key = `${feature}/${name.toString()}`;
7990
+ const entries = this.entries.get(key);
7991
+ const value = entries?.get(entry);
7992
+ if (typeof value === "undefined") {
7993
+ throw new TypeError(`Shared data not found: ${key}`);
7994
+ }
7995
+ return value;
7988
7996
  }
7989
7997
  add(feature, name, entry, value) {
7990
- const key = `${feature}/${name.toString()}/${entry}`;
7991
- this.data.set(key, value);
7998
+ const key = `${feature}/${name.toString()}`;
7999
+ if (!this.entries.has(key)) {
8000
+ this.entries.set(key, /* @__PURE__ */ new Map());
8001
+ }
8002
+ const entries = this.entries.get(key);
8003
+ entries.set(entry, value);
7992
8004
  return this;
7993
8005
  }
8006
+ list(feature, name) {
8007
+ const key = `${feature}/${name.toString()}`;
8008
+ const entries = this.entries.get(key) ?? /* @__PURE__ */ new Map();
8009
+ return entries.entries();
8010
+ }
7994
8011
  };
7995
8012
 
7996
8013
  // src/app.ts
@@ -9192,7 +9209,7 @@ var auth = (program2) => {
9192
9209
 
9193
9210
  // src/cli/command/bind.ts
9194
9211
  import { log as log19 } from "@awsless/clui";
9195
- import { constantCase as constantCase14 } from "change-case";
9212
+ import { constantCase as constantCase15 } from "change-case";
9196
9213
  import { spawn } from "child_process";
9197
9214
  var bind = (program2) => {
9198
9215
  program2.command("bind").argument("[command...]", "The command to execute").option("--config <string...>", "List of config values that will be accessable", (v) => v.split(",")).description(`Bind your site environment variables to a command`).action(async (commands9 = [], opts) => {
@@ -9221,10 +9238,10 @@ var bind = (program2) => {
9221
9238
  const configList = opts.config ?? [];
9222
9239
  const configs = {};
9223
9240
  for (const name of configList) {
9224
- configs[`CONFIG_${constantCase14(name)}`] = name;
9241
+ configs[`CONFIG_${constantCase15(name)}`] = name;
9225
9242
  }
9226
9243
  if (configList.length ?? 0 > 0) {
9227
- log19.note("Bind Config", configList.map((v) => color.label(constantCase14(v))).join("\n"));
9244
+ log19.note("Bind Config", configList.map((v) => color.label(constantCase15(v))).join("\n"));
9228
9245
  }
9229
9246
  if (commands9.length === 0) {
9230
9247
  return "No command to execute.";
@@ -9662,6 +9679,7 @@ var domain = (program2) => {
9662
9679
  // src/cli/command/logs.ts
9663
9680
  import { CloudWatchLogsClient, StartLiveTailCommand } from "@aws-sdk/client-cloudwatch-logs";
9664
9681
  import { log as log24 } from "@awsless/clui";
9682
+ import { aws as aws30 } from "@terraforge/aws";
9665
9683
  import chalk5 from "chalk";
9666
9684
  import chunk2 from "chunk";
9667
9685
  import { formatDate } from "date-fns";
@@ -9685,9 +9703,8 @@ var logs = (program2) => {
9685
9703
  for (const stack of app.stacks) {
9686
9704
  if (filters.find((f) => wildstring6.match(f, stack.name))) {
9687
9705
  for (const resource of stack.resources) {
9688
- if (resource.type === "aws_cloudwatch_log_group") {
9689
- const logGroup = resource;
9690
- logGroupArns.push(await logGroup.arn);
9706
+ if (resource instanceof aws30.cloudwatch.LogGroup) {
9707
+ logGroupArns.push(await resource.arn);
9691
9708
  }
9692
9709
  }
9693
9710
  }
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.597",
3
+ "version": "0.0.599",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -36,18 +36,18 @@
36
36
  "@awsless/big-float": "^0.1.5",
37
37
  "@awsless/cloudwatch": "^0.0.1",
38
38
  "@awsless/duration": "^0.0.4",
39
- "@awsless/json": "^0.0.10",
40
39
  "@awsless/clui": "^0.0.8",
41
- "@awsless/dynamodb": "^0.3.8",
42
40
  "@awsless/iot": "^0.0.3",
41
+ "@awsless/dynamodb": "^0.3.8",
43
42
  "@awsless/lambda": "^0.0.35",
43
+ "@awsless/json": "^0.0.10",
44
44
  "@awsless/redis": "^0.0.14",
45
- "@awsless/s3": "^0.0.21",
46
- "@awsless/ssm": "^0.0.7",
47
- "@awsless/sqs": "^0.0.16",
48
- "@awsless/open-search": "^0.0.21",
49
45
  "@awsless/sns": "^0.0.10",
46
+ "@awsless/sqs": "^0.0.16",
50
47
  "@awsless/validate": "^0.1.3",
48
+ "@awsless/open-search": "^0.0.21",
49
+ "@awsless/ssm": "^0.0.7",
50
+ "@awsless/s3": "^0.0.21",
51
51
  "@awsless/weak-cache": "^0.0.1",
52
52
  "@awsless/mqtt": "^0.0.2"
53
53
  },
@@ -76,7 +76,7 @@
76
76
  "@swc/core": "^1.3.70",
77
77
  "@terraforge/aws": "^6.28.0",
78
78
  "@terraforge/core": "^0.0.19",
79
- "@terraforge/terraform": "^0.0.13",
79
+ "@terraforge/terraform": "^0.0.14",
80
80
  "@types/aws-lambda": "^8.10.110",
81
81
  "@types/bun": "1.3.8",
82
82
  "@types/chunk": "^0.0.0",
@@ -143,12 +143,12 @@
143
143
  "@awsless/cloudwatch": "^0.0.1",
144
144
  "@awsless/duration": "^0.0.4",
145
145
  "@awsless/json": "^0.0.10",
146
- "@awsless/graphql": "^0.0.9",
147
- "@awsless/size": "^0.0.2",
148
146
  "@awsless/scheduler": "^0.0.4",
147
+ "@awsless/size": "^0.0.2",
149
148
  "@awsless/validate": "^0.1.3",
150
- "@awsless/ts-file-cache": "^0.0.12",
151
- "@awsless/clui": "^0.0.8"
149
+ "@awsless/clui": "^0.0.8",
150
+ "@awsless/graphql": "^0.0.9",
151
+ "@awsless/ts-file-cache": "^0.0.12"
152
152
  },
153
153
  "devDependencies": {
154
154
  "@hono/node-server": "1.19.9",