graphjin 2.0.2 → 2.0.4

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,7 +1,7 @@
1
1
  # GraphJin, Build APIs in 5 minutes not weeks
2
2
 
3
3
  [![Apache 2.0](https://img.shields.io/github/license/dosco/graphjin.svg?style=for-the-badge)](https://github.com/dosco/graphjin/blob/master/LICENSE)
4
- [!![Docker Pulls](https://img.shields.io/docker/pulls/dosco/graphjin?style=for-the-badge)](https://hub.docker.com/r/dosco/graphjin/builds)
4
+ [![Docker Pulls](https://img.shields.io/docker/pulls/dosco/graphjin?style=for-the-badge)](https://hub.docker.com/r/dosco/graphjin/builds)
5
5
  [![Discord Chat](https://img.shields.io/discord/628796009539043348.svg?style=for-the-badge&logo=appveyor)](https://discord.gg/6pSWCTZ)
6
6
  [![GoDoc](https://img.shields.io/badge/godoc-reference-5272B4.svg?style=for-the-badge&logo=appveyor&logo=appveyor)](https://pkg.go.dev/github.com/dosco/graphjin)
7
7
  [![GoReport](https://goreportcard.com/badge/github.com/gojp/goreportcard?style=for-the-badge)](https://goreportcard.com/report/github.com/dosco/graphjin)
@@ -9,39 +9,12 @@
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.
13
-
14
- Works with NodeJS and GO. Supports several databases, Postgres, MySQL, YugabyteDB Cockroach, etc.
15
-
16
- ## Quick install
17
-
18
- NPM
19
-
20
- ```
21
- npm install graphjin
22
- ```
23
-
24
- Mac (Homebrew)
25
-
26
- ```
27
- brew install dosco/graphjin/graphjin
28
- ```
29
-
30
- Ubuntu (Snap)
31
-
32
- ```
33
- sudo snap install --classic graphjin
34
- ```
35
-
36
- Debian and Redhat ([releases](https://github.com/dosco/graphjin/releases))
37
-
38
- ```
39
- Download the .deb or .rpm from the releases page and install with dpkg -i and rpm -i respectively.
40
- ```
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.
41
13
 
42
14
  ## Secure out of the box
43
15
 
44
- When you use a query in development it's saved to an allow list and only queries from this allow list can be run in production. In production these allowed queries are converted into prepared statments in the database to protect against sql injection, etc. This makes GraphJin very secure and also very fast since no compiling happens in production all queries go directly to the database. GraphJin is built in Go a language designed by Google to be fast and secure.
16
+ In production all queries are always read from locally saved copies not from what the client sends hence clients cannot modify the query. This makes
17
+ GraphJin very secure as its similiar to building APIs by hand. The idea that GraphQL means that clients can change the query as they wish **does not** apply to GraphJin
45
18
 
46
19
  ---
47
20
 
@@ -108,6 +81,32 @@ console.log("Express server started on port %s", server.address().port);
108
81
 
109
82
  ## Use with GO / Standalone service
110
83
 
84
+ ### Quick install
85
+
86
+ Mac (Homebrew)
87
+
88
+ ```
89
+ brew install dosco/graphjin/graphjin
90
+ ```
91
+
92
+ Ubuntu (Snap)
93
+
94
+ ```
95
+ sudo snap install --classic graphjin
96
+ ```
97
+
98
+ Debian and Redhat ([releases](https://github.com/dosco/graphjin/releases))
99
+
100
+ ```
101
+ 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
+
111
110
  ### Quickly create and deploy new apps
112
111
 
113
112
  ```bash
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "graphjin",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "GraphJin - Build APIs in 5 minutes with GraphQL. An instant GraphQL to SQL compiler.",
5
5
  "type": "module",
6
- "main": "wasm/graphjin.js",
6
+ "main": "wasm/js/graphjin.js",
7
7
  "files": [
8
+ "./wasm/config",
9
+ "./wasm/runtime",
8
10
  "./wasm/graphjin.wasm",
9
- "./wasm/*.js",
10
- "./wasm/runtime"
11
+ "./wasm/js/*.js"
11
12
  ],
12
13
  "scripts": {
13
- "postinstall": "go-npm install",
14
- "preuninstall": "go-npm uninstall"
14
+ "postinstall": "node ./wasm/js/install.js"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -29,12 +29,7 @@
29
29
  "url": "https://github.com/dosco/graphjin/issues"
30
30
  },
31
31
  "homepage": "https://github.com/dosco/graphjin#readme",
32
- "goBinary": {
33
- "name": "graphjin",
34
- "path": "./bin",
35
- "url": "https://github.com/dosco/graphjin/releases/download/v{{version}}/graphjin_{{version}}_{{platform}}_{{arch}}.tar.gz"
36
- },
37
- "dependencies": {
38
- "@go-task/cli": "^3.16.0"
32
+ "devDependencies": {
33
+ "fs-extra": "^11.1.0"
39
34
  }
40
35
  }
Binary file
File without changes
@@ -1,6 +1,7 @@
1
1
  import "./globals.js"
2
+ import * as _ from "./wasm_exec.js";
3
+
2
4
  import fs from "fs"
3
- import * as _ from "./runtime/wasm_exec.js";
4
5
 
5
6
  import { fileURLToPath } from 'url';
6
7
  import { dirname, join } from 'path';
@@ -9,7 +10,7 @@ const __filename = fileURLToPath(import.meta.url);
9
10
  const __dirname = dirname(__filename);
10
11
 
11
12
  const go = new Go();
12
- const f = fs.readFileSync(join(__dirname,"./graphjin.wasm"));
13
+ const f = fs.readFileSync(join(__dirname,"../graphjin.wasm"));
13
14
  const inst = await WebAssembly.instantiate(f, go.importObject);
14
15
  go.run(inst.instance);
15
16
 
@@ -0,0 +1,27 @@
1
+ import fs from "fs-extra"
2
+
3
+ import { fileURLToPath } from 'url';
4
+ import { basename, dirname, join } from 'path';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = dirname(__filename);
8
+
9
+ const src = join(__dirname,"../config")
10
+ const dst = process.env.INIT_CWD
11
+
12
+ const newDst = join(dst, basename(src));
13
+
14
+ const opt = {
15
+ overwrite: false,
16
+ errorOnExist: false,
17
+ dereference: true
18
+ }
19
+
20
+ try {
21
+ await fs.emptyDir(newDst)
22
+ await fs.copy(src, newDst, opt)
23
+ } catch (err) {
24
+ console.error(err)
25
+ process.exit(1);
26
+ }
27
+
File without changes