@ttoss/appsync-api 0.2.1 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/appsync-api",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -9,6 +9,9 @@
9
9
  ],
10
10
  "main": "dist/index.js",
11
11
  "module": "dist/esm/index.js",
12
+ "bin": {
13
+ "ttoss-appsync-api": "./bin/cli.js"
14
+ },
12
15
  "files": [
13
16
  "dist",
14
17
  "src"
@@ -19,15 +22,18 @@
19
22
  },
20
23
  "typings": "dist/index.d.ts",
21
24
  "dependencies": {
25
+ "@ttoss/cloudformation": "^0.2.0",
22
26
  "graphql": "^16.6.0",
23
- "graphql-compose": "^9.0.10"
27
+ "graphql-compose": "^9.0.10",
28
+ "minimist": "^1.2.7"
24
29
  },
25
30
  "devDependencies": {
31
+ "@ttoss/config": "^1.25.0",
26
32
  "@types/aws-lambda": "^8.10.109"
27
33
  },
28
34
  "keywords": [],
29
35
  "publishConfig": {
30
36
  "access": "public"
31
37
  },
32
- "gitHead": "cb61ddf8cfd902e90262f4a7eb304442baa6d4f6"
38
+ "gitHead": "9ad8b28e9ca906af04b2e0c3743bf453b8701429"
33
39
  }
package/src/cli.ts ADDED
@@ -0,0 +1,27 @@
1
+ // import { AppSyncGraphQLSchemaLogicalId } from './createApiTemplate';
2
+ import * as fs from 'fs';
3
+ import { findAndReadCloudFormationTemplate } from '@ttoss/cloudformation';
4
+ import minimist from 'minimist';
5
+
6
+ const argv = minimist(process.argv.slice(2));
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
+ if (argv._.includes('build-schema')) {
16
+ const template = findAndReadCloudFormationTemplate({});
17
+
18
+ const sdl =
19
+ template.Resources[AppSyncGraphQLSchemaLogicalId].Properties.Definition;
20
+
21
+ /**
22
+ * Save to schema/schema.graphql. schema folder might not exist.
23
+ */
24
+ fs.mkdirSync('schema', { recursive: true });
25
+
26
+ fs.writeFileSync('schema/schema.graphql', sdl);
27
+ }