@awsless/awsless 0.0.55 → 0.0.57

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.
Files changed (2) hide show
  1. package/dist/bin.js +36 -5
  2. package/package.json +4 -4
package/dist/bin.js CHANGED
@@ -832,7 +832,8 @@ var rollupBundle = ({ format: format2 = "esm", minify = true, handler = "default
832
832
  }),
833
833
  minify ? swcMinify({
834
834
  module: format2 === "esm",
835
- sourceMap: true
835
+ sourceMap: true,
836
+ compress: true
836
837
  }) : void 0,
837
838
  // @ts-ignore
838
839
  json()
@@ -1914,7 +1915,7 @@ var Table = class extends Resource {
1914
1915
  return getAtt(this.logicalId, "StreamArn");
1915
1916
  }
1916
1917
  get permissions() {
1917
- return {
1918
+ const permissions = [{
1918
1919
  actions: [
1919
1920
  "dynamodb:DescribeTable",
1920
1921
  "dynamodb:PutItem",
@@ -1934,7 +1935,19 @@ var Table = class extends Resource {
1934
1935
  resourceName: this.name
1935
1936
  })
1936
1937
  ]
1937
- };
1938
+ }];
1939
+ const indexNames = Object.keys(this.indexes ?? {});
1940
+ if (indexNames.length > 0) {
1941
+ permissions.push({
1942
+ actions: ["dynamodb:Query"],
1943
+ resources: indexNames.map((indexName) => formatArn({
1944
+ service: "dynamodb",
1945
+ resource: "table",
1946
+ resourceName: `${this.name}/index/${indexName}`
1947
+ }))
1948
+ });
1949
+ }
1950
+ return permissions;
1938
1951
  }
1939
1952
  attributeDefinitions() {
1940
1953
  const fields = this.props.fields || {};
@@ -5248,6 +5261,15 @@ var sitePlugin = definePlugin({
5248
5261
  };
5249
5262
  })
5250
5263
  }).dependsOn(originRequest, responseHeaders, cache, ...deps);
5264
+ const invalidateCache = new CustomResource(id, {
5265
+ serviceToken: bootstrap2.import("feature-invalidate-cache"),
5266
+ properties: {
5267
+ key: (/* @__PURE__ */ new Date()).toISOString(),
5268
+ distributionId: distribution.id,
5269
+ waitForInvalidation: false,
5270
+ paths: ["/*"]
5271
+ }
5272
+ }).dependsOn(distribution);
5251
5273
  if (props.static) {
5252
5274
  const bucketPolicy = new BucketPolicy(`site-${id}`, {
5253
5275
  bucketName: bucket.name,
@@ -5278,6 +5300,7 @@ var sitePlugin = definePlugin({
5278
5300
  }).dependsOn(distribution);
5279
5301
  stack.add(
5280
5302
  distribution,
5303
+ invalidateCache,
5281
5304
  responseHeaders,
5282
5305
  originRequest,
5283
5306
  cache,
@@ -5306,11 +5329,19 @@ var featurePlugin = definePlugin({
5306
5329
  actions: ["s3:*"],
5307
5330
  resources: ["*"]
5308
5331
  });
5332
+ const invalidateCacheLambda = new Function("invalidate-cache", {
5333
+ name: `${config.name}-invalidate-cache`,
5334
+ code: Code.fromFeature("invalidate-cache")
5335
+ }).enableLogs(Duration.days(3)).addPermissions({
5336
+ actions: ["cloudfront:*"],
5337
+ resources: ["*"]
5338
+ });
5309
5339
  bootstrap2.add(
5310
5340
  deleteBucketLambda,
5311
- uploadBucketAssetLambda
5341
+ uploadBucketAssetLambda,
5342
+ invalidateCacheLambda
5312
5343
  );
5313
- bootstrap2.export("feature-delete-bucket", deleteBucketLambda.arn).export("feature-upload-bucket-asset", uploadBucketAssetLambda.arn);
5344
+ bootstrap2.export("feature-delete-bucket", deleteBucketLambda.arn).export("feature-upload-bucket-asset", uploadBucketAssetLambda.arn).export("feature-invalidate-cache", invalidateCacheLambda.arn);
5314
5345
  }
5315
5346
  });
5316
5347
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.55",
3
+ "version": "0.0.57",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -23,10 +23,10 @@
23
23
  }
24
24
  },
25
25
  "peerDependencies": {
26
- "@awsless/sns": "^0.0.6",
27
- "@awsless/sqs": "^0.0.6",
28
26
  "@awsless/lambda": "^0.0.6",
29
- "@awsless/ssm": "^0.0.7"
27
+ "@awsless/sns": "^0.0.6",
28
+ "@awsless/ssm": "^0.0.7",
29
+ "@awsless/sqs": "^0.0.6"
30
30
  },
31
31
  "dependencies": {
32
32
  "@aws-sdk/client-cloudformation": "^3.369.0",