wirejs-deploy-amplify-basic 0.0.85-table-resource → 0.0.87-table-resource

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.
@@ -9,10 +9,10 @@ import { api } from './functions/api/resource';
9
9
  import { auth } from './auth/resource';
10
10
  import { TableDefinition, indexName } from 'wirejs-resources';
11
11
  import { TableIndexes } from './constructs/table-indexes';
12
+ import { PolicyStatement } from 'aws-cdk-lib/aws-iam';
12
13
 
13
14
  // @ts-ignore
14
15
  import generated from './generated-resources';
15
- import { Key } from 'aws-cdk-lib/aws-kms';
16
16
 
17
17
  const APP_ID = process.env.AWS_APP_ID ?? process.env.PWD?.replace(/[^a-zA-Z0-9-_]/g, '_');
18
18
  const BRANCH_ID = process.env.AWS_BRANCH ?? process.env.USER ?? 'anonymous';
@@ -109,6 +109,21 @@ for (const resource of generated) {
109
109
  );
110
110
 
111
111
  table.grantReadWriteData(backend.api.resources.lambda);
112
+
113
+ // indexes created by custom resource and require explicit
114
+ // permissions to be added to the lambda role (apparently).
115
+ backend.api.resources.lambda.addToRolePolicy(new PolicyStatement({
116
+ actions: [
117
+ "dynamodb:Query",
118
+ "dynamodb:Scan",
119
+ "dynamodb:GetItem",
120
+ "dynamodb:BatchGetItem",
121
+ ],
122
+ resources: [
123
+ table.tableArn,
124
+ `${table.tableArn}/index/*`,
125
+ ],
126
+ }))
112
127
  }
113
128
  }
114
129
 
@@ -99,7 +99,7 @@ export const handler = async (event: CloudFormationCustomResourceEvent) => {
99
99
  }] : []),
100
100
  ],
101
101
  Projection: {
102
- ProjectionType: gsi.projectionType,
102
+ ProjectionType: gsi.projectionType ?? 'ALL',
103
103
  }
104
104
  }
105
105
  }],
@@ -3,6 +3,6 @@
3
3
  "dependencies": {
4
4
  "jsdom": "^25.0.1",
5
5
  "wirejs-dom": "^1.0.38",
6
- "wirejs-resources": "^0.1.53-table-resource"
6
+ "wirejs-resources": "^0.1.55-table-resource"
7
7
  }
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-deploy-amplify-basic",
3
- "version": "0.0.85-table-resource",
3
+ "version": "0.0.87-table-resource",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "recursive-copy": "^2.0.14",
33
33
  "rimraf": "^6.0.1",
34
34
  "wirejs-dom": "^1.0.38",
35
- "wirejs-resources": "^0.1.53-table-resource"
35
+ "wirejs-resources": "^0.1.55-table-resource"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@aws-amplify/backend": "^1.14.0",