@ttoss/appsync-api 0.2.0 → 0.2.2
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/esm/index.js +4294 -1
- package/dist/index.js +4278 -4
- package/package.json +3 -2
- package/src/createApiTemplate.ts +21 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/appsync-api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
"graphql-compose": "^9.0.10"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
+
"@ttoss/config": "^1.25.0",
|
|
26
27
|
"@types/aws-lambda": "^8.10.109"
|
|
27
28
|
},
|
|
28
29
|
"keywords": [],
|
|
29
30
|
"publishConfig": {
|
|
30
31
|
"access": "public"
|
|
31
32
|
},
|
|
32
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "88b98945c469cdfdece6b12ce41243403ad2c242"
|
|
33
34
|
}
|
package/src/createApiTemplate.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { getPackageLambdaLayerStackName } from 'carlin/src/deploy/lambdaLayer/getPackageLambdaLayerStackName';
|
|
2
|
+
import { readPackageJson } from 'carlin/src/utils/packageJson';
|
|
3
|
+
import packageJson from '../package.json';
|
|
1
4
|
import type { CloudFormationTemplate } from 'carlin/src/utils/cloudFormationTemplate';
|
|
2
5
|
import type { SchemaComposer } from 'graphql-compose';
|
|
3
6
|
|
|
@@ -7,7 +10,7 @@ const AppSyncGraphQLSchemaLogicalId = 'AppSyncGraphQLSchema';
|
|
|
7
10
|
|
|
8
11
|
const AppSyncLambdaFunctionIAMRoleLogicalId = 'AppSyncLambdaFunctionIAMRole';
|
|
9
12
|
|
|
10
|
-
const AppSyncLambdaFunctionLogicalId = 'AppSyncLambdaFunction';
|
|
13
|
+
export const AppSyncLambdaFunctionLogicalId = 'AppSyncLambdaFunction';
|
|
11
14
|
|
|
12
15
|
const AppSyncLambdaFunctionAppSyncDataSourceIAMRoleLogicalId =
|
|
13
16
|
'AppSyncLambdaFunctionAppSyncDataSourceIAMRole';
|
|
@@ -43,6 +46,22 @@ export const createApiTemplate = ({
|
|
|
43
46
|
}
|
|
44
47
|
);
|
|
45
48
|
|
|
49
|
+
const { name } = packageJson;
|
|
50
|
+
|
|
51
|
+
const { dependencies } = readPackageJson();
|
|
52
|
+
|
|
53
|
+
const dependencyVersion = dependencies[name];
|
|
54
|
+
|
|
55
|
+
if (!dependencyVersion) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`The package ${name} is not installed in the project. Please install it with "yarn add ${name}".`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const lambdaLayerStackName = getPackageLambdaLayerStackName(
|
|
62
|
+
[name, dependencyVersion].join('@')
|
|
63
|
+
);
|
|
64
|
+
|
|
46
65
|
const template: CloudFormationTemplate = {
|
|
47
66
|
AWSTemplateFormatVersion: '2010-09-09',
|
|
48
67
|
Parameters: {
|
|
@@ -113,7 +132,7 @@ export const createApiTemplate = ({
|
|
|
113
132
|
Handler: 'index.handler',
|
|
114
133
|
Layers: [
|
|
115
134
|
{
|
|
116
|
-
'Fn::ImportValue':
|
|
135
|
+
'Fn::ImportValue': lambdaLayerStackName,
|
|
117
136
|
},
|
|
118
137
|
],
|
|
119
138
|
MemorySize: 512,
|