@ttoss/appsync-api 0.3.0 → 0.4.0
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/cli.js +3694 -1
- package/dist/esm/chunk-AZQ4OFLJ.js +4498 -0
- package/dist/esm/cli.js +4 -1
- package/dist/esm/index.js +3 -244
- package/dist/index.js +4244 -15
- package/package.json +4 -3
- package/src/cli.ts +4 -8
- package/src/createApiTemplate.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/appsync-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@ttoss/config": "^1.25.0",
|
|
32
|
-
"@types/aws-lambda": "^8.10.109"
|
|
32
|
+
"@types/aws-lambda": "^8.10.109",
|
|
33
|
+
"carlin": "^1.21.0"
|
|
33
34
|
},
|
|
34
35
|
"keywords": [],
|
|
35
36
|
"publishConfig": {
|
|
36
37
|
"access": "public"
|
|
37
38
|
},
|
|
38
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "ce54241307f6953a4e3b34ce7e24d71aadf12dca"
|
|
39
40
|
}
|
package/src/cli.ts
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
// import { AppSyncGraphQLSchemaLogicalId } from './createApiTemplate';
|
|
2
1
|
import * as fs from 'fs';
|
|
2
|
+
import { AppSyncGraphQLSchemaLogicalId } from './createApiTemplate';
|
|
3
3
|
import { findAndReadCloudFormationTemplate } from '@ttoss/cloudformation';
|
|
4
4
|
import minimist from 'minimist';
|
|
5
5
|
|
|
6
6
|
const argv = minimist(process.argv.slice(2));
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* TODO: fix Error: Cannot find module 'carlin/src/deploy/lambdaLayer/getPackageLambdaLayerStackName'
|
|
10
|
-
* passing all carlin cloudformation methods to @ttoss/cloudformation and
|
|
11
|
-
* import AppSyncGraphQLSchemaLogicalId from './createApiTemplate';
|
|
12
|
-
*/
|
|
13
|
-
const AppSyncGraphQLSchemaLogicalId = 'AppSyncGraphQLSchema';
|
|
14
|
-
|
|
15
8
|
if (argv._.includes('build-schema')) {
|
|
16
9
|
const template = findAndReadCloudFormationTemplate({});
|
|
17
10
|
|
|
18
11
|
const sdl =
|
|
19
12
|
template.Resources[AppSyncGraphQLSchemaLogicalId].Properties.Definition;
|
|
20
13
|
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.log(sdl);
|
|
16
|
+
|
|
21
17
|
/**
|
|
22
18
|
* Save to schema/schema.graphql. schema folder might not exist.
|
|
23
19
|
*/
|
package/src/createApiTemplate.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { type SchemaComposer, graphql } from 'graphql-compose';
|
|
1
2
|
import { getPackageLambdaLayerStackName } from 'carlin/src/deploy/lambdaLayer/getPackageLambdaLayerStackName';
|
|
2
3
|
import { readPackageJson } from 'carlin/src/utils/packageJson';
|
|
3
4
|
import packageJson from '../package.json';
|
|
4
5
|
import type { CloudFormationTemplate } from 'carlin/src/utils/cloudFormationTemplate';
|
|
5
|
-
import type { SchemaComposer } from 'graphql-compose';
|
|
6
6
|
|
|
7
7
|
const AppSyncGraphQLApiLogicalId = 'AppSyncGraphQLApi';
|
|
8
8
|
|
|
9
|
-
const AppSyncGraphQLSchemaLogicalId = 'AppSyncGraphQLSchema';
|
|
9
|
+
export const AppSyncGraphQLSchemaLogicalId = 'AppSyncGraphQLSchema';
|
|
10
10
|
|
|
11
11
|
const AppSyncLambdaFunctionIAMRoleLogicalId = 'AppSyncLambdaFunctionIAMRole';
|
|
12
12
|
|
|
@@ -29,6 +29,8 @@ export const createApiTemplate = ({
|
|
|
29
29
|
*/
|
|
30
30
|
const sdl = schemaComposer.toSDL();
|
|
31
31
|
|
|
32
|
+
graphql.validateSchema(schemaComposer.buildSchema());
|
|
33
|
+
|
|
32
34
|
/**
|
|
33
35
|
* Get FieldName and TypeName. `resolveMethods` is a Map of
|
|
34
36
|
* `typeName: { fieldName: resolverFn }`
|