@faststore/api 1.3.19 → 1.3.23

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +1 -113
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,44 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.3.23 (2021-12-09)
7
+
8
+ **Note:** Version bump only for package @faststore/api
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.3.22 (2021-12-07)
15
+
16
+ **Note:** Version bump only for package @faststore/api
17
+
18
+
19
+
20
+
21
+
22
+ ## 1.3.21 (2021-12-07)
23
+
24
+
25
+ ### Features
26
+
27
+ * add docs ([#1058](https://github.com/vtex/faststore/issues/1058)) ([35f3e62](https://github.com/vtex/faststore/commit/35f3e62ae09c350632479742c9ce2c22e8862b23))
28
+
29
+
30
+
31
+
32
+
33
+ ## 1.3.20 (2021-12-07)
34
+
35
+
36
+ ### Features
37
+
38
+ * **store-ui:** Banner component ([#1048](https://github.com/vtex/faststore/issues/1048)) ([b65d8e5](https://github.com/vtex/faststore/commit/b65d8e574598f8bf8494aac478e4bec4d774ec86))
39
+
40
+
41
+
42
+
43
+
6
44
  ## 1.3.19 (2021-12-07)
7
45
 
8
46
 
package/README.md CHANGED
@@ -1,115 +1,3 @@
1
1
  # @faststore/api
2
2
 
3
- The only API you need for building your next ecommerce.
4
-
5
- This package defines a front-end first, GraphQL API inspired by clean architecture and schema.org.
6
-
7
- GraphQL types defined in this repo extends and simplifies schema.org. This makes it easier to make your frontend search friendly.
8
- Also, by using the clean architecture, all types defined on this schema are not platform specific, but created to resolve an specific business case on your frontend, like rendering listprices, sellers etc.
9
-
10
- Alongside the GraphQL type definitions, we provide standard implementations for common ecommerce platforms. Currently we support:
11
- 1. VTEX
12
- 2. Maybe add yours?
13
-
14
- With the typedefs and resolvers, you can create an executable schema and deploy anywhere you want. For instance, one use case would be:
15
- 1. Create an Apollo Server instane on Heroku
16
- 2. Run the executable schema in a function on Next.JS
17
- 3. Run the executable schema during a Gatsby build.
18
-
19
- ## Install
20
-
21
- ```bash
22
- yarn add @faststore/api
23
- ```
24
-
25
- ## Usage
26
- GraphQL is very versatile and can run in many places. To setup the schema in an apollo server, just:
27
- ```ts
28
- import { getSchema } from '@faststore/api'
29
- import { ApolloServer } from 'apollo-server'
30
-
31
- // Get the Store schema
32
- const schema = await getSchema({ platform: 'vtex', account: 'my-account', environment: 'vtexcommercestable' })
33
-
34
- // Setup Apollo Server
35
- const server = new ApolloServer({ schema });
36
-
37
- // The `listen` method launches a web server.
38
- server.listen().then(({ url }) => {
39
- console.log(`🚀 Server ready at ${url}`);
40
- });
41
- ```
42
-
43
- ## Extending the schema
44
- GraphQL is a very versatile language. By using the exported `getSchema` function, you can not only extend the base schema but also redefine the whole resolvers implementation.
45
-
46
- To extend the schema, one can:
47
- ```ts
48
- import { getSchema } from '@faststore/api'
49
- import { makeExecutableSchema, mergeSchemas } from '@graphql-tools/schema'
50
- import { ApolloServer } from 'apollo-server'
51
-
52
- // Setup type extensions
53
- const typeDefs = `
54
- extend type Product {
55
- customField: String!
56
- }
57
- `
58
-
59
- // Setup custom resolvers
60
- const resolvers = {
61
- Product: {
62
- customField: async () => {
63
- ...
64
- // Your code goes here
65
- ...
66
- }
67
- }
68
- }
69
-
70
- // Create custom schema
71
- const customSchema = makeExecutableSchema({ resolvers, typeDefs })
72
- const storeApiSchema = await getSchema({ platform: 'vtex', ...})
73
-
74
- // Merge schemas into a final schema
75
- const finalSchema = mergeSchemas(schemas: [
76
- storeApiSchema,
77
- customSchema
78
- ])
79
-
80
- // Setup Apollo Server
81
- const server = new ApolloServer({ schema });
82
-
83
- // The `listen` method launches a web server.
84
- server.listen().then(({ url }) => {
85
- console.log(`🚀 Server ready at ${url}`);
86
- });
87
- ```
88
-
89
- ## Inline platform
90
- If your ecommerce platform is not supported you have two options.
91
- 1. Make a contribution
92
- 2. Create inline resolvers for your platform
93
-
94
- Inline resolves means you are going to write all resolvers for the api schema in your project or in an external library. This is recommended if you are supporting a niche platform and want to have full control over how each field is processed.
95
-
96
- To create your own resolvers, you can:
97
- ```ts
98
- import { getTypeDefs } from '@faststore/api'
99
- import { ApolloServer } from 'apollo-server'
100
- import { makeExecutableSchema } from '@graphql-tools/schema'
101
-
102
- // Get the Store API TypeDefs
103
- const typeDefs = getTypeDefs()
104
-
105
- const resolvers = {
106
- ...
107
- // add your resolvers
108
- ...
109
- }
110
-
111
- // Create a runnable schema
112
- const schema = makeExecutableSchema({ resolvers, typeDefs })
113
-
114
- // You now have a runnable GraphQL schema, you can create a server or run queries locally.
115
- ```
3
+ Docs moved to: https://faststore.dev/reference/api/overview
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/api",
3
- "version": "1.3.19",
3
+ "version": "1.3.23",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -42,5 +42,5 @@
42
42
  "peerDependencies": {
43
43
  "graphql": "^15.6.0"
44
44
  },
45
- "gitHead": "91a6fb184450fe935dc2f9b86c7258623a771cfa"
45
+ "gitHead": "07ba569df47fc87a9f22e0060073678f05b697f8"
46
46
  }