@ttoss/appsync-api 0.2.2 → 0.3.1

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/index.js CHANGED
@@ -179,7 +179,7 @@ var require_tslib = __commonJS({
179
179
  function step(op) {
180
180
  if (f)
181
181
  throw new TypeError("Generator is already executing.");
182
- while (_)
182
+ while (g && (g = 0, op[0] && (_ = 0)), _)
183
183
  try {
184
184
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
185
185
  return t;
@@ -4193,7 +4193,7 @@ var readPackageJson = () => {
4193
4193
  // package.json
4194
4194
  var package_default = {
4195
4195
  name: "@ttoss/appsync-api",
4196
- version: "0.2.2",
4196
+ version: "0.3.1",
4197
4197
  description: "",
4198
4198
  license: "UNLICENSED",
4199
4199
  author: "ttoss",
@@ -4202,6 +4202,9 @@ var package_default = {
4202
4202
  ],
4203
4203
  main: "dist/index.js",
4204
4204
  module: "dist/esm/index.js",
4205
+ bin: {
4206
+ "ttoss-appsync-api": "./bin/cli.js"
4207
+ },
4205
4208
  files: [
4206
4209
  "dist",
4207
4210
  "src"
@@ -4212,12 +4215,15 @@ var package_default = {
4212
4215
  },
4213
4216
  typings: "dist/index.d.ts",
4214
4217
  dependencies: {
4218
+ "@ttoss/cloudformation": "^0.2.0",
4215
4219
  graphql: "^16.6.0",
4216
- "graphql-compose": "^9.0.10"
4220
+ "graphql-compose": "^9.0.10",
4221
+ minimist: "^1.2.7"
4217
4222
  },
4218
4223
  devDependencies: {
4219
4224
  "@ttoss/config": "^1.25.0",
4220
- "@types/aws-lambda": "^8.10.109"
4225
+ "@types/aws-lambda": "^8.10.109",
4226
+ carlin: "^1.21.0"
4221
4227
  },
4222
4228
  keywords: [],
4223
4229
  publishConfig: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/appsync-api",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
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,16 +22,19 @@
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": {
26
31
  "@ttoss/config": "^1.25.0",
27
- "@types/aws-lambda": "^8.10.109"
32
+ "@types/aws-lambda": "^8.10.109",
33
+ "carlin": "^1.21.0"
28
34
  },
29
35
  "keywords": [],
30
36
  "publishConfig": {
31
37
  "access": "public"
32
38
  },
33
- "gitHead": "88b98945c469cdfdece6b12ce41243403ad2c242"
39
+ "gitHead": "a5396840d88867e223247b3fc87188a174c147c7"
34
40
  }
package/src/cli.ts ADDED
@@ -0,0 +1,20 @@
1
+ import * as fs from 'fs';
2
+ import { AppSyncGraphQLSchemaLogicalId } from './createApiTemplate';
3
+ import { findAndReadCloudFormationTemplate } from '@ttoss/cloudformation';
4
+ import minimist from 'minimist';
5
+
6
+ const argv = minimist(process.argv.slice(2));
7
+
8
+ if (argv._.includes('build-schema')) {
9
+ const template = findAndReadCloudFormationTemplate({});
10
+
11
+ const sdl =
12
+ template.Resources[AppSyncGraphQLSchemaLogicalId].Properties.Definition;
13
+
14
+ /**
15
+ * Save to schema/schema.graphql. schema folder might not exist.
16
+ */
17
+ fs.mkdirSync('schema', { recursive: true });
18
+
19
+ fs.writeFileSync('schema/schema.graphql', sdl);
20
+ }
@@ -6,7 +6,7 @@ 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