@ttoss/appsync-api 0.13.1 → 0.14.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/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # @ttoss/appsync-api
2
2
 
3
- This package provides a opinionated way to create an AppSync API.
3
+ This package provides a opinionated way to create an AppSync API using [`@ttoss/graphql-api` API](./graphql-api/).
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- yarn add @ttoss/appsync-api graphql-compose graphql
8
+ yarn add @ttoss/appsync-api @ttoss/graphql-api graphql
9
9
  ```
10
10
 
11
11
  ## Quickstart
@@ -18,7 +18,7 @@ You can create and deploy an AppSync API in four steps:
18
18
 
19
19
  ```typescript
20
20
  import { createApiTemplate } from '@ttoss/appsync-api';
21
- import { schemaComposer } from './schemaComposer';
21
+ import { schemaComposer } from '@ttoss/graphql-api';
22
22
 
23
23
  const template = createApiTemplate({
24
24
  schemaComposer,
@@ -41,17 +41,16 @@ export default template;
41
41
 
42
42
  ```typescript
43
43
  import { createAppSyncResolverHandler } from '@ttoss/appsync-api';
44
- import { schemaComposer } from './schemaComposer';
44
+ import { schemaComposer } from '@ttoss/graphql-api';
45
45
 
46
46
  export const handler = createAppSyncResolverHandler({ schemaComposer });
47
47
  ```
48
48
 
49
- 4. Add `graphql` and `graphql-compose` to the `lambdaExternals` array in `carlin.yml`:
49
+ 4. Add `graphql` to the `lambdaExternals` array on `carlin.yml`:
50
50
 
51
51
  ```yml
52
52
  lambdaExternals:
53
53
  - graphql
54
- - graphql-compose
55
54
  ```
56
55
 
57
56
  Now you can deploy your API using `carlin deploy`:
@@ -59,54 +58,3 @@ Now you can deploy your API using `carlin deploy`:
59
58
  ```bash
60
59
  carlin deploy
61
60
  ```
62
-
63
- ## Server
64
-
65
- You can create a local server to test your API using `createServer`:
66
-
67
- ```typescript
68
- import { createServer } from '@ttoss/appsync-api/server';
69
- import { schemaComposer } from '../src/schemaComposer';
70
-
71
- const server = createServer({ schemaComposer });
72
-
73
- server.listen(4000, () => {
74
- // eslint-disable-next-line no-console
75
- console.log(
76
- 'Server is running, GraphQL Playground available at http://localhost:4000/graphql'
77
- );
78
- });
79
- ```
80
-
81
- ## Schema Composer
82
-
83
- The `schemaComposer` object is a [`graphql-compose`](https://graphql-compose.github.io/docs/intro/quick-start.html) object that defines your API's schema and handle resolvers. You can use `schemaComposer` to create types, queries, mutations, and subscriptions.
84
-
85
- ### Connections
86
-
87
- This packages provides the method `composeWithConnection` to create a connection type and queries for a given type, based on [graphql-compose-connection](https://graphql-compose.github.io/docs/plugins/plugin-connection.html) plugin and following the [Relay Connection Specification](https://facebook.github.io/relay/graphql/connections.htm).
88
-
89
- ```typescript
90
- import { composeWithConnection } from '@ttoss/appsync-api';
91
-
92
- composeWithConnection(AuthorTC, {
93
- findManyResolver: AuthorTC.getResolver('findMany'),
94
- countResolver: AuthorTC.getResolver('count'),
95
- sort: {
96
- ASC: {
97
- value: {
98
- scanIndexForward: true,
99
- },
100
- cursorFields: ['id'],
101
- beforeCursorQuery: (rawQuery, cursorData, resolveParams) => {
102
- if (!rawQuery.id) rawQuery.id = {};
103
- rawQuery.id.$lt = cursorData.id;
104
- },
105
- afterCursorQuery: (rawQuery, cursorData, resolveParams) => {
106
- if (!rawQuery.id) rawQuery.id = {};
107
- rawQuery.id.$gt = cursorData.id;
108
- },
109
- },
110
- },
111
- });
112
- ```
package/dist/esm/index.js CHANGED
@@ -80,7 +80,7 @@ var getPackageLambdaLayerStackName = packageName => {
80
80
  // package.json
81
81
  var package_default = {
82
82
  name: "@ttoss/appsync-api",
83
- version: "0.13.1",
83
+ version: "0.14.0",
84
84
  description: "A library for building GraphQL APIs for AWS AppSync.",
85
85
  license: "UNLICENSED",
86
86
  author: "ttoss",
package/dist/index.js CHANGED
@@ -112,7 +112,7 @@ var getPackageLambdaLayerStackName = packageName => {
112
112
  // package.json
113
113
  var package_default = {
114
114
  name: "@ttoss/appsync-api",
115
- version: "0.13.1",
115
+ version: "0.14.0",
116
116
  description: "A library for building GraphQL APIs for AWS AppSync.",
117
117
  license: "UNLICENSED",
118
118
  author: "ttoss",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/appsync-api",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "description": "A library for building GraphQL APIs for AWS AppSync.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -17,7 +17,7 @@
17
17
  "typings": "dist/index.d.ts",
18
18
  "dependencies": {
19
19
  "@ttoss/cloudformation": "^0.7.2",
20
- "@ttoss/graphql-api": "^0.1.0"
20
+ "@ttoss/graphql-api": "^0.2.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "graphql": "^16.6.0",