wirejs-deploy-amplify-basic 0.0.5-alpha → 0.0.7-alpha

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.
@@ -1,36 +1,32 @@
1
1
  import {
2
2
  defineBackend,
3
- defineStorage,
4
- defineFunction
5
3
  } from '@aws-amplify/backend';
6
4
  import { RemovalPolicy } from "aws-cdk-lib";
7
5
  import { FunctionUrlAuthType } from 'aws-cdk-lib/aws-lambda';
8
-
9
- const api = defineFunction({
10
- entry: './api-lambda.ts',
11
- })
12
-
13
- const storage = defineStorage({
14
- name: 'app-data',
15
- access: allow => allow.resource(api)
16
- });
6
+ import { Bucket, BlockPublicAccess } from 'aws-cdk-lib/aws-s3';
7
+ import { api } from './functions/api/resource';
17
8
 
18
9
  const backend = defineBackend({
19
10
  api,
20
- storage,
21
11
  });
22
12
 
13
+ const bucket = new Bucket(backend.stack, 'data', {
14
+ blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
15
+ versioned: true,
16
+ removalPolicy: RemovalPolicy.RETAIN,
17
+ });
18
+ bucket.grantReadWrite(backend.api.resources.lambda);
19
+
23
20
  backend.api.addEnvironment(
24
- 'BUCKET', backend.storage.resources.bucket.bucketName
21
+ 'BUCKET', bucket.bucketName
25
22
  );
23
+
26
24
  const apiUrl = backend.api.resources.lambda.addFunctionUrl({
27
25
  authType: FunctionUrlAuthType.NONE
28
26
  });
29
27
 
30
- backend.storage.resources.bucket.applyRemovalPolicy(RemovalPolicy.RETAIN);
31
-
32
28
  backend.addOutput({
33
29
  custom: {
34
30
  api: apiUrl.url
35
31
  }
36
- });
32
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ defineFunction
3
+ } from '@aws-amplify/backend';
4
+
5
+ const api = defineFunction({
6
+ entry: './handler.ts',
7
+ });
8
+
9
+ export { api };
@@ -3,7 +3,7 @@
3
3
  "framework": { "name": "express", "version": "4.18.2" },
4
4
  "routes": [
5
5
  {
6
- "path": "/*.*",
6
+ "path": "/*",
7
7
  "target": {
8
8
  "kind": "Static",
9
9
  "cacheControl": "public, max-age=2"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-deploy-amplify-basic",
3
- "version": "0.0.5-alpha",
3
+ "version": "0.0.7-alpha",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wirejs-deploy-amplify-basic": "./build.js"