@awsless/awsless 0.0.148 → 0.0.149

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
@@ -311,13 +311,15 @@ var Role = class extends Resource {
311
311
  ...this.props.assumedBy ? {
312
312
  AssumeRolePolicyDocument: {
313
313
  Version: "2012-10-17",
314
- Statement: [{
315
- Action: "sts:AssumeRole",
316
- Effect: "Allow",
317
- Principal: {
318
- Service: this.props.assumedBy
314
+ Statement: [
315
+ {
316
+ Action: "sts:AssumeRole",
317
+ Effect: "Allow",
318
+ Principal: {
319
+ Service: this.props.assumedBy
320
+ }
319
321
  }
320
- }]
322
+ ]
321
323
  }
322
324
  } : {},
323
325
  ManagedPolicyArns: [...this.managedPolicies].map((policy) => policy.arn),
@@ -1770,8 +1772,28 @@ var authPlugin = definePlugin({
1770
1772
  // }
1771
1773
  // }
1772
1774
  // },
1775
+ onStack({ config: config2, bootstrap: bootstrap2, bind: bind2 }) {
1776
+ for (const [id, props] of Object.entries(config2.app.defaults.auth)) {
1777
+ bind2((lambda) => {
1778
+ const userPoolArn = bootstrap2.import(`auth-${id}-user-pool-arn`);
1779
+ const userPoolId = bootstrap2.import(`auth-${id}-user-pool-id`);
1780
+ const clientId = bootstrap2.import(`auth-${id}-client-id`);
1781
+ const name = constantCase6(id);
1782
+ lambda.addEnvironment(`AUTH_${name}_USER_POOL_ID`, userPoolId);
1783
+ lambda.addEnvironment(`AUTH_${name}_CLIENT_ID`, clientId);
1784
+ if (props.secret) {
1785
+ const clientSecret = bootstrap2.import(`auth-${id}-client-secret`);
1786
+ lambda.addEnvironment(`AUTH_${name}_CLIENT_SECRET`, clientSecret);
1787
+ }
1788
+ lambda.addPermissions({
1789
+ actions: ["cognito:*"],
1790
+ resources: [userPoolArn]
1791
+ });
1792
+ });
1793
+ }
1794
+ },
1773
1795
  onApp(ctx) {
1774
- const { config: config2, bootstrap: bootstrap2, bind: bind2 } = ctx;
1796
+ const { config: config2, bootstrap: bootstrap2 } = ctx;
1775
1797
  if (Object.keys(config2.app.defaults.auth).length === 0) {
1776
1798
  return;
1777
1799
  }
@@ -1857,22 +1879,6 @@ var authPlugin = definePlugin({
1857
1879
  }).dependsOn(lambda);
1858
1880
  bootstrap2.add(lambda, permission);
1859
1881
  }
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
- });
1876
1882
  }
1877
1883
  }
1878
1884
  });
@@ -3327,12 +3333,15 @@ var Listener = class extends Resource {
3327
3333
  Certificates: this.props.certificates.map((arn) => ({
3328
3334
  CertificateArn: arn
3329
3335
  })),
3330
- ...this.attr("DefaultActions", this.props.defaultActions?.map((action, i) => {
3331
- return {
3332
- Order: i + 1,
3333
- ...action.toJSON()
3334
- };
3335
- }))
3336
+ ...this.attr(
3337
+ "DefaultActions",
3338
+ this.props.defaultActions?.map((action, i) => {
3339
+ return {
3340
+ Order: i + 1,
3341
+ ...action.toJSON()
3342
+ };
3343
+ })
3344
+ )
3336
3345
  };
3337
3346
  }
3338
3347
  };
@@ -3698,7 +3707,10 @@ var EventSourceMapping = class extends Resource {
3698
3707
  ...this.attr("ParallelizationFactor", this.props.parallelizationFactor),
3699
3708
  ...this.attr("TumblingWindowInSeconds", this.props.tumblingWindow?.toSeconds()),
3700
3709
  ...this.attr("BisectBatchOnFunctionError", this.props.bisectBatchOnError),
3701
- ...this.attr("StartingPosition", this.props.startingPosition && constantCase10(this.props.startingPosition)),
3710
+ ...this.attr(
3711
+ "StartingPosition",
3712
+ this.props.startingPosition && constantCase10(this.props.startingPosition)
3713
+ ),
3702
3714
  ...this.attr("StartingPositionTimestamp", this.props.startingPositionTimestamp),
3703
3715
  ...this.props.maxConcurrency ? {
3704
3716
  ScalingConfig: {
@@ -3759,12 +3771,7 @@ var Queue = class extends Resource {
3759
3771
  }
3760
3772
  get permissions() {
3761
3773
  return {
3762
- actions: [
3763
- "sqs:SendMessage",
3764
- "sqs:ReceiveMessage",
3765
- "sqs:GetQueueUrl",
3766
- "sqs:GetQueueAttributes"
3767
- ],
3774
+ actions: ["sqs:SendMessage", "sqs:ReceiveMessage", "sqs:GetQueueUrl", "sqs:GetQueueAttributes"],
3768
3775
  resources: [
3769
3776
  formatArn({
3770
3777
  service: "sqs",
@@ -4085,9 +4092,11 @@ var DomainName2 = class extends Resource {
4085
4092
  properties() {
4086
4093
  return {
4087
4094
  DomainName: this.props.name,
4088
- DomainNameConfigurations: [{
4089
- CertificateArn: this.props.certificateArn
4090
- }]
4095
+ DomainNameConfigurations: [
4096
+ {
4097
+ CertificateArn: this.props.certificateArn
4098
+ }
4099
+ ]
4091
4100
  };
4092
4101
  }
4093
4102
  };
@@ -4407,12 +4416,7 @@ var Bucket = class extends Resource {
4407
4416
  }
4408
4417
  get permissions() {
4409
4418
  return {
4410
- actions: [
4411
- "s3:SendMessage",
4412
- "s3:ReceiveMessage",
4413
- "s3:GetQueueUrl",
4414
- "s3:GetQueueAttributes"
4415
- ],
4419
+ actions: ["s3:SendMessage", "s3:ReceiveMessage", "s3:GetQueueUrl", "s3:GetQueueAttributes"],
4416
4420
  resources: [
4417
4421
  formatArn({
4418
4422
  service: "s3",
@@ -4527,7 +4531,7 @@ var Files = class extends Asset {
4527
4531
  hash;
4528
4532
  bundle;
4529
4533
  s3;
4530
- async build({ read, write }) {
4534
+ async build({ write }) {
4531
4535
  const glob2 = new Glob(this.props.pattern ?? "**/*", {
4532
4536
  nodir: true,
4533
4537
  cwd: this.props.directory
@@ -4943,50 +4947,53 @@ var Table = class extends Resource {
4943
4947
  return getAtt(this.logicalId, "StreamArn");
4944
4948
  }
4945
4949
  get permissions() {
4946
- const permissions = [{
4947
- actions: [
4948
- "dynamodb:DescribeTable",
4949
- "dynamodb:PutItem",
4950
- "dynamodb:GetItem",
4951
- "dynamodb:DeleteItem",
4952
- "dynamodb:TransactWrite",
4953
- "dynamodb:BatchWriteItem",
4954
- "dynamodb:BatchGetItem",
4955
- "dynamodb:ConditionCheckItem",
4956
- "dynamodb:Query",
4957
- "dynamodb:Scan"
4958
- ],
4959
- resources: [
4960
- formatArn({
4961
- service: "dynamodb",
4962
- resource: "table",
4963
- resourceName: this.name
4964
- })
4965
- ]
4966
- }];
4950
+ const permissions = [
4951
+ {
4952
+ actions: [
4953
+ "dynamodb:DescribeTable",
4954
+ "dynamodb:PutItem",
4955
+ "dynamodb:GetItem",
4956
+ "dynamodb:DeleteItem",
4957
+ "dynamodb:TransactWrite",
4958
+ "dynamodb:BatchWriteItem",
4959
+ "dynamodb:BatchGetItem",
4960
+ "dynamodb:ConditionCheckItem",
4961
+ "dynamodb:Query",
4962
+ "dynamodb:Scan"
4963
+ ],
4964
+ resources: [
4965
+ formatArn({
4966
+ service: "dynamodb",
4967
+ resource: "table",
4968
+ resourceName: this.name
4969
+ })
4970
+ ]
4971
+ }
4972
+ ];
4967
4973
  const indexNames = Object.keys(this.indexes ?? {});
4968
4974
  if (indexNames.length > 0) {
4969
4975
  permissions.push({
4970
4976
  actions: ["dynamodb:Query"],
4971
- resources: indexNames.map((indexName) => formatArn({
4972
- service: "dynamodb",
4973
- resource: "table",
4974
- resourceName: `${this.name}/index/${indexName}`
4975
- }))
4977
+ resources: indexNames.map(
4978
+ (indexName) => formatArn({
4979
+ service: "dynamodb",
4980
+ resource: "table",
4981
+ resourceName: `${this.name}/index/${indexName}`
4982
+ })
4983
+ )
4976
4984
  });
4977
4985
  }
4978
4986
  return permissions;
4979
4987
  }
4980
4988
  attributeDefinitions() {
4981
4989
  const fields = this.props.fields || {};
4982
- const attributes = new Set([
4983
- this.props.hash,
4984
- this.props.sort,
4985
- ...Object.values(this.props.indexes || {}).map((index) => [
4986
- index.hash,
4987
- index.sort
4988
- ])
4989
- ].flat().filter(Boolean));
4990
+ const attributes = new Set(
4991
+ [
4992
+ this.props.hash,
4993
+ this.props.sort,
4994
+ ...Object.values(this.props.indexes || {}).map((index) => [index.hash, index.sort])
4995
+ ].flat().filter(Boolean)
4996
+ );
4990
4997
  const types2 = {
4991
4998
  string: "S",
4992
4999
  number: "N",
package/dist/index.d.ts CHANGED
@@ -10904,7 +10904,7 @@ declare abstract class Resource {
10904
10904
  };
10905
10905
  };
10906
10906
  };
10907
- abstract properties(): object;
10907
+ protected abstract properties(): object;
10908
10908
  }
10909
10909
  declare class Group {
10910
10910
  readonly children: Array<Resource | Asset>;
@@ -10987,7 +10987,7 @@ declare class Url extends Resource {
10987
10987
  private props;
10988
10988
  constructor(logicalId: string, props: UrlProps);
10989
10989
  get url(): string;
10990
- properties(): {
10990
+ protected properties(): {
10991
10991
  Cors: {
10992
10992
  [x: string]: unknown;
10993
10993
  };
@@ -11044,7 +11044,7 @@ declare class Function$1 extends Resource {
11044
11044
  actions: string[];
11045
11045
  resources: string[];
11046
11046
  };
11047
- properties(): {
11047
+ protected properties(): {
11048
11048
  Environment: {
11049
11049
  Variables: Record<string, string>;
11050
11050
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.148",
3
+ "version": "0.0.149",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,