@baeta/plugin-graphql 2.0.0-next.1 → 2.0.0-next.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,50 @@
1
1
  # @baeta/plugin-graphql
2
2
 
3
+ ## 2.0.0-next.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [`ed81033`](https://github.com/andreisergiu98/baeta/commit/ed81033dc30b5a57f2358e4645ff3f717856cc21) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Generate starter index.ts file for new modules
8
+
9
+ ## 2.0.0-next.10
10
+
11
+ ## 2.0.0-next.9
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`831cfa2`](https://github.com/andreisergiu98/baeta/commit/831cfa2a11445aaf7f2d1a1d7ddf073db9bb8008), [`831cfa2`](https://github.com/andreisergiu98/baeta/commit/831cfa2a11445aaf7f2d1a1d7ddf073db9bb8008)]:
16
+ - @baeta/generator-sdk@2.0.0-next.4
17
+ - @baeta/util-path@2.0.0-next.3
18
+
19
+ ## 2.0.0-next.8
20
+
21
+ ## 2.0.0-next.7
22
+
23
+ ### Patch Changes
24
+
25
+ - [#214](https://github.com/andreisergiu98/baeta/pull/214) [`c47665a`](https://github.com/andreisergiu98/baeta/commit/c47665a76a0f88bae07f42983b380361e4f0843a) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Improve typesafety by type checking the exported module
26
+
27
+ ## 2.0.0-next.3
28
+
29
+ ### Patch Changes
30
+
31
+ - [#214](https://github.com/andreisergiu98/baeta/pull/214) [`6de5d15`](https://github.com/andreisergiu98/baeta/commit/6de5d15484d341a1717a1b2f3f45272912e6a886) Thanks [@andreisergiu98](https://github.com/andreisergiu98)! - Fix generated import paths with custom config
32
+
33
+ - Update generator-sdk package
34
+
35
+ - Updated dependencies [[`6de5d15`](https://github.com/andreisergiu98/baeta/commit/6de5d15484d341a1717a1b2f3f45272912e6a886)]:
36
+ - @baeta/generator-sdk@2.0.0-next.3
37
+
38
+ ## 2.0.0-next.2
39
+
40
+ ### Patch Changes
41
+
42
+ - Fix broken types
43
+
44
+ - Updated dependencies []:
45
+ - @baeta/generator-sdk@2.0.0-next.2
46
+ - @baeta/util-path@2.0.0-next.2
47
+
3
48
  ## 2.0.0-next.1
4
49
 
5
50
  ### Patch Changes
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <div align="center">
6
6
  <h1>Baeta</h1>
7
7
  <a href="https://www.npmjs.com/package/@baeta/cli"><img src="https://img.shields.io/npm/v/@baeta/cli.svg?style=flat" /></a>
8
- <a href="https://github.com/andreisergiu98/baeta/actions/workflows/testing.yml"><img src="https://img.shields.io/github/actions/workflow/status/andreisergiu98/baeta/testing.yml" /></a>
8
+ <a href="https://github.com/andreisergiu98/baeta/actions/workflows/checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/andreisergiu98/baeta/checks.yml" /></a>
9
9
  <a href="https://github.com/andreisergiu98/baeta/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" /></a>
10
10
  <a href="https://github.com/andreisergiu98/baeta/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" /></a>
11
11
  <br />
@@ -77,43 +77,68 @@ type Query {
77
77
  #### 2. Implement your resolvers
78
78
 
79
79
  ```typescript
80
- import { getUserModule } from "./typedef";
80
+ import { UserModule } from "./typedef.ts";
81
81
 
82
- const { Query } = getUserModule();
82
+ const { Query } = UserModule;
83
83
 
84
- Query.user(({ args }) => {
84
+ const userQuery = Query.user.resolve(({ args }) => {
85
85
  return dataSource.user.find(args.where);
86
86
  });
87
87
 
88
- Query.users(() => {
88
+ const usersQuery = Query.users.resolve(() => {
89
89
  return dataSource.user.findMany();
90
90
  });
91
+
92
+ Query.$fields({
93
+ user: userQuery,
94
+ users: usersQuery,
95
+ });
91
96
  ```
92
97
 
93
98
  #### 3. Add authorization
94
99
 
95
100
  ```typescript
96
- const { Query, Mutation } = getUserModule();
97
-
98
- Query.users.$auth({
99
- $or: {
100
- isPublic: true,
101
- isLoggedIn: true,
102
- },
103
- });
101
+ import { UserModule } from "./typedef.ts";
102
+
103
+ const { Query } = UserModule;
104
+
105
+ const userQuery = Query.user
106
+ .$auth({
107
+ $or: {
108
+ isPublic: true,
109
+ isLoggedIn: true,
110
+ },
111
+ })
112
+ .resolve(async ({ args }) => {
113
+ // ...
114
+ });
104
115
  ```
105
116
 
106
117
  #### 4. Add caching
107
118
 
108
119
  ```typescript
109
- import { getUserModule } from "./typedef";
110
-
111
- const { User, Query } = getUserModule();
120
+ const { Query, Mutation, User } = UserModule;
112
121
 
113
122
  export const userCache = User.$createCache();
114
123
 
115
- Query.user.$useCache(userCache);
116
- Query.users.$useCache(userCache);
124
+ const userQuery = Query.user
125
+ .$auth({
126
+ // ...
127
+ })
128
+ .$useCache(userCache)
129
+ .resolve(async ({ args }) => {
130
+ // ...
131
+ });
132
+
133
+ const updateUserMutation = Mutation.updateUser
134
+ .$use(async (next) => {
135
+ const user = await next();
136
+ await userCache.save(user);
137
+ return user;
138
+ })
139
+ .resolve(async ({ args }) => {
140
+ // ...
141
+ });
117
142
  ```
118
143
 
119
144
  ## Compatibility
@@ -0,0 +1,7 @@
1
+ import * as _baeta_generator_sdk0 from "@baeta/generator-sdk";
2
+
3
+ //#region index.d.ts
4
+ declare function graphqlPlugin(): _baeta_generator_sdk0.GeneratorPluginV1<unknown>;
5
+ //#endregion
6
+ export { graphqlPlugin };
7
+ //# sourceMappingURL=index.d.ts.map