graphjin 2.0.4 → 2.0.7

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
@@ -9,7 +9,7 @@
9
9
  <!-- [![Run on Google Cloud](./.github/deploy-cloud-run-button.svg)](https://deploy.cloud.run)
10
10
  -->
11
11
 
12
- GraphJin gives you an instant secure and fast GraphQL API without code. Just use a GraphQL query to define your API and GraphJin automagically converts it into a full featured API. Build your backend APIs **100X** faster. Works with **NodeJS** and **GO**. Supports several databases, **Postgres**, **MySQL**, **YugabyteDB**, **Cockroach**, etc.
12
+ GraphJin gives you an instant secure and fast GraphQL API without code. Just use a GraphQL query to define your API and GraphJin automagically converts it into a full featured API. Build your backend APIs **100X** faster. Works with **NodeJS** and **GO**. Supports several databases, **Postgres**, **MySQL**, **YugabyteDB**, etc.
13
13
 
14
14
  ## Secure out of the box
15
15
 
@@ -83,38 +83,21 @@ console.log("Express server started on port %s", server.address().port);
83
83
 
84
84
  ### Quick install
85
85
 
86
- Mac (Homebrew)
87
-
88
86
  ```
87
+ # Mac (Homebrew)
89
88
  brew install dosco/graphjin/graphjin
90
- ```
91
89
 
92
- Ubuntu (Snap)
93
-
94
- ```
90
+ # Ubuntu (Snap)
95
91
  sudo snap install --classic graphjin
96
92
  ```
97
93
 
98
94
  Debian and Redhat ([releases](https://github.com/dosco/graphjin/releases))
99
-
100
- ```
101
95
  Download the .deb or .rpm from the releases page and install with dpkg -i and rpm -i respectively.
102
- ```
103
-
104
- NPM
105
-
106
- ```
107
- npm install graphjin
108
- ```
109
96
 
110
97
  ### Quickly create and deploy new apps
111
98
 
112
99
  ```bash
113
100
  graphjin new <app_name>
114
-
115
- cd <app_name>
116
- docker-compose run api db setup
117
- docker-compose up
118
101
  ```
119
102
 
120
103
  ### Instantly deploy new versions
@@ -255,7 +238,7 @@ With GraphJin your web and mobile developers can start building instantly. All t
255
238
 
256
239
  ## Highlevel
257
240
 
258
- - Works with Postgres, MySQL8, YugabyteDB, CockroachDB,
241
+ - Works with Postgres, MySQL8, YugabyteDB
259
242
  - Also works with Amazon Aurora/RDS and Google Cloud SQL
260
243
  - Supports REST, GraphQL and Websocket APIs
261
244
 
@@ -289,15 +272,11 @@ With GraphJin your web and mobile developers can start building instantly. All t
289
272
 
290
273
  ## Documentation
291
274
 
292
- [Quick Start](https://github.com/dosco/graphjin/wiki/Quick-Start)
293
-
294
- [Documentation](https://github.com/dosco/graphjin/wiki)
295
-
296
- [Build APIs in 5 minutes with GraphJin](https://dev.to/dosco/build-high-performance-graphql-apis-in-5-minutes-with-graphjin-261o)
275
+ [Quick Start](https://graphjin.com/posts/1-quick-start)
297
276
 
298
- [GraphQL vs REST](https://dev.to/dosco/rest-vs-graphql-building-startups-in-2021-3k73)
277
+ [Documentation](https://graphjin.com)
299
278
 
300
- [GraphQL Examples](https://pkg.go.dev/github.com/dosco/graphjin/core#pkg-examples)
279
+ [GraphJin GO Examples](https://pkg.go.dev/github.com/dosco/graphjin/core#pkg-examples)
301
280
 
302
281
  ## Reach out
303
282
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "graphjin",
3
- "version": "2.0.4",
4
- "description": "GraphJin - Build APIs in 5 minutes with GraphQL. An instant GraphQL to SQL compiler.",
3
+ "version": "2.0.7",
4
+ "description": "GraphJin - Build APIs in 5 minutes with GraphQL",
5
5
  "type": "module",
6
6
  "main": "wasm/js/graphjin.js",
7
7
  "files": [
@@ -0,0 +1,128 @@
1
+ # When production mode is 'true' only queries
2
+ # from the allow list are permitted.
3
+ production: false
4
+
5
+ # Secret key for general encryption operations like
6
+ # encrypting the cursor data
7
+ secret_key: supercalifajalistics
8
+
9
+ # Subscriptions poll the database to query for updates
10
+ # this sets the duration (in seconds) between requests.
11
+ # Defaults to 5 seconds
12
+ subs_poll_every_seconds: 5
13
+
14
+ # Default limit value to be used on queries and as the max
15
+ # limit on all queries where a limit is defined as a query variable.
16
+ # Defaults to 20
17
+ default_limit: 20
18
+
19
+ # Disables all aggregation functions like count, sum, etc
20
+ # disable_agg_functions: false
21
+
22
+ # Disables all functions like count, length, etc
23
+ # disable_functions: false
24
+
25
+ # Enables using camel case terms in GraphQL which are converted
26
+ # to snake case in SQL
27
+ # enable_camelcase: false
28
+
29
+ # Set session variable "user.id" to the user id
30
+ # Enable this if you need the user id in triggers, etc
31
+ # Note: This will not work with subscriptions
32
+ set_user_id: false
33
+
34
+ # DefaultBlock ensures that in anonymous mode (role 'anon') all tables
35
+ # are blocked from queries and mutations. To open access to tables in
36
+ # anonymous mode they have to be added to the 'anon' role config.
37
+ default_block: false
38
+
39
+ # Define additional variables here to be used with filters
40
+ # Variables used require a type suffix eg. $user_id:bigint
41
+ variables:
42
+ #admin_account_id: "5"
43
+ admin_account_id: "sql:select id from users where admin = true limit 1"
44
+
45
+ # Define variables set to values extracted from http headers
46
+ header_variables:
47
+ remote_ip: "X-Forwarded-For"
48
+
49
+ # Field and table names that you wish to block
50
+ blocklist:
51
+ - ar_internal_metadata
52
+ - schema_migrations
53
+ - secret
54
+ - password
55
+ - encrypted
56
+ - token
57
+
58
+ # resolvers:
59
+ # - name: payments
60
+ # type: remote_api
61
+ # table: customers
62
+ # column: stripe_id
63
+ # json_path: data
64
+ # debug: false
65
+ # url: http://payments/payments/$id
66
+ # pass_headers:
67
+ # - cookie
68
+ # set_headers:
69
+ # - name: Host
70
+ # value: 0.0.0.0
71
+ # # - name: Authorization
72
+ # # value: Bearer <stripe_api_key>
73
+
74
+ tables:
75
+ - # You can create new fields that have a
76
+ # real db table backing them
77
+ name: me
78
+ table: users
79
+
80
+ - name: users
81
+ order_by:
82
+ new_users: ["created_at desc", "id asc"]
83
+ id: ["id asc"]
84
+
85
+ # Variables used require a type suffix eg. $user_id:bigint
86
+ #roles_query: "SELECT * FROM users WHERE id = $user_id:bigint"
87
+
88
+ roles:
89
+ # if `auth.type` is set to a valid auth type then
90
+ # all tables are blocked for the anon role unless
91
+ # added to the role like below.
92
+ # - name: anon
93
+ # tables:
94
+ # - name: users
95
+ # query:
96
+ # limit: 10
97
+
98
+ - name: user
99
+ tables:
100
+ - name: me
101
+ query:
102
+ filters: ["{ id: { _eq: $user_id } }"]
103
+
104
+ # - name: products
105
+ # query:
106
+ # limit: 50
107
+ # filters: ["{ user_id: { eq: $user_id } }"]
108
+ # disable_functions: false
109
+
110
+ # insert:
111
+ # filters: ["{ user_id: { eq: $user_id } }"]
112
+ # presets:
113
+ # - user_id: "$user_id"
114
+ # - created_at: "now"
115
+
116
+ # update:
117
+ # filters: ["{ user_id: { eq: $user_id } }"]
118
+ # presets:
119
+ # - updated_at: "now"
120
+
121
+ # delete:
122
+ # block: true
123
+
124
+ # - name: admin
125
+ # match: id = 1000
126
+ # tables:
127
+ # - name: users
128
+ # filters: []
@@ -0,0 +1,21 @@
1
+ # Inherit config from this other config file
2
+ # so I only need to overwrite some values
3
+ inherits: dev
4
+
5
+ # When production mode is 'true' only queries from the queries
6
+ # folder can be used.
7
+ production: true
8
+
9
+ # Secret key for general encryption operations like
10
+ # encrypting the cursor data
11
+ secret_key: supercalifajalistics
12
+
13
+ # Subscriptions poll the database to query for updates
14
+ # this sets the duration (in seconds) between requests.
15
+ # Defaults to 5 seconds
16
+ subs_poll_every_seconds: 5
17
+
18
+ # Default limit value to be used on queries and as the max
19
+ # limit on all queries where a limit is defined as a query variable.
20
+ # Defaults to 20
21
+ default_limit: 20
Binary file
@@ -14,6 +14,8 @@ const f = fs.readFileSync(join(__dirname,"../graphjin.wasm"));
14
14
  const inst = await WebAssembly.instantiate(f, go.importObject);
15
15
  go.run(inst.instance);
16
16
 
17
+ // TODO: Use NODE_ENV to set production mode
18
+
17
19
  export default async function(configPath, config, db) {
18
20
  if (typeof config === 'string') {
19
21
  const conf = {value: config, isFile: true}