@webbdays/tailcall 0.0.1-security → 0.0.40
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.
Potentially problematic release.
This version of @webbdays/tailcall might be problematic. Click here for more details.
- package/README.md +132 -3
- package/build-matrix.yaml +80 -0
- package/package.json +40 -4
- package/scripts/post-install.js +71 -0
- package/scripts/pre-install.js +23 -0
- package/scripts/utils.js +24 -0
package/README.md
CHANGED
@@ -1,5 +1,134 @@
|
|
1
|
-
|
1
|
+
[](https://tailcall.run)
|
2
2
|
|
3
|
-
|
3
|
+
Tailcall is an open-source solution for building [high-performance] GraphQL backends.
|
4
4
|
|
5
|
-
Please
|
5
|
+
Please support us by giving the repository a star
|
6
|
+

|
7
|
+
|
8
|
+
[high-performance]: https://github.com/tailcallhq/graphql-benchmarks
|
9
|
+
|
10
|
+
[](https://twitter.com/intent/tweet?text=%40tailcallhq%20is%20building%20a%20high-performance%20API%20Orchestration%20solution%20over%20%23GraphQL.%0A%0ACheck%20it%20out%20at%3A%0A%F0%9F%94%97%20https%3A%2F%2Ftailcall.run%20%0A%F0%9F%94%97%20https%3A%2F%2Fgithub.com%2Ftailcallhq%2Ftailcall%20%0A%0A&hashtags=api,http,rest,grpc,graphql,nocode,microservice,opensource)
|
11
|
+
[](https://discord.gg/kRZBPpkgwq)
|
12
|
+
|
13
|
+
[](https://console.algora.io/org/tailcallhq/bounties?status=open)
|
14
|
+
[](https://console.algora.io/org/tailcallhq/bounties?status=completed)
|
15
|
+
[](https://github.com/tailcallhq/tailcall/actions)
|
16
|
+

|
17
|
+
[](https://discord.gg/kRZBPpkgwq)
|
18
|
+
[](https://app.codecov.io/gh/tailcallhq/tailcall)
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
### NPM
|
23
|
+
|
24
|
+
```bash
|
25
|
+
npm i -g @tailcallhq/tailcall
|
26
|
+
```
|
27
|
+
|
28
|
+
### Yarn
|
29
|
+
|
30
|
+
```bash
|
31
|
+
yarn global add @tailcallhq/tailcall
|
32
|
+
```
|
33
|
+
|
34
|
+
### Home Brew
|
35
|
+
|
36
|
+
```bash
|
37
|
+
brew tap tailcallhq/tailcall
|
38
|
+
brew install tailcall
|
39
|
+
```
|
40
|
+
|
41
|
+
### Curl
|
42
|
+
|
43
|
+
```bash
|
44
|
+
curl -sSL https://raw.githubusercontent.com/tailcallhq/tailcall/master/install.sh | bash
|
45
|
+
```
|
46
|
+
|
47
|
+
### Docker
|
48
|
+
|
49
|
+
```bash
|
50
|
+
docker pull ghcr.io/tailcallhq/tailcall/tc-server
|
51
|
+
docker run -p 8080:8080 -p 8081:8081 ghcr.io/tailcallhq/tailcall/tc-server
|
52
|
+
```
|
53
|
+
|
54
|
+
## Get Started
|
55
|
+
|
56
|
+
The below file is a standard `.graphQL` file, with a few additions such as `@server` and `@http` directives. So, basically, we specify the GraphQL schema and how to resolve that GraphQL schema in the same file, without having to write any code!
|
57
|
+
|
58
|
+
```graphql
|
59
|
+
schema
|
60
|
+
@server(port: 8000, hostname: "0.0.0.0")
|
61
|
+
@upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) {
|
62
|
+
query: Query
|
63
|
+
}
|
64
|
+
|
65
|
+
type Query {
|
66
|
+
posts: [Post] @http(path: "/posts")
|
67
|
+
user(id: Int!): User @http(path: "/users/{{.args.id}}")
|
68
|
+
}
|
69
|
+
|
70
|
+
type User {
|
71
|
+
id: Int!
|
72
|
+
name: String!
|
73
|
+
username: String!
|
74
|
+
email: String!
|
75
|
+
phone: String
|
76
|
+
website: String
|
77
|
+
}
|
78
|
+
|
79
|
+
type Post {
|
80
|
+
id: Int!
|
81
|
+
userId: Int!
|
82
|
+
title: String!
|
83
|
+
body: String!
|
84
|
+
user: User @http(path: "/users/{{.value.userId}}")
|
85
|
+
}
|
86
|
+
```
|
87
|
+
|
88
|
+
Now, run the following command to start the server with the full path to the jsonplaceholder.graphql file that you created above.
|
89
|
+
|
90
|
+
```bash
|
91
|
+
tailcall start ./jsonplaceholder.graphql
|
92
|
+
```
|
93
|
+
|
94
|
+
Head out to [docs] to learn about other powerful tailcall features.
|
95
|
+
|
96
|
+
[docs]: https://tailcall.run/docs
|
97
|
+
|
98
|
+
### Benchmarks
|
99
|
+
|
100
|
+
Throughput comparison of various GraphQL solutions for a N + 1 query:
|
101
|
+
|
102
|
+
```graphql
|
103
|
+
query {
|
104
|
+
posts {
|
105
|
+
title
|
106
|
+
body
|
107
|
+
user {
|
108
|
+
name
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
```
|
113
|
+
|
114
|
+

|
115
|
+
|
116
|
+
Check out detailed benchmarks on our benchmarking [repository](https://github.com/tailcallhq/graphql-benchmarks).
|
117
|
+
|
118
|
+
### Contributing
|
119
|
+
|
120
|
+
Your contributions are invaluable! Kindly go through our [contribution guidelines] if you are a first time contributor.
|
121
|
+
|
122
|
+
[contribution guidelines]: https://tailcall.run/docs/contribution-guidelines
|
123
|
+
|
124
|
+
### Support Us
|
125
|
+
|
126
|
+
⭐️ Give us a star.
|
127
|
+
|
128
|
+
👀 Watch us for updates.
|
129
|
+
|
130
|
+
### License
|
131
|
+
|
132
|
+
This initiative is protected under the Apache 2.0 License.
|
133
|
+
|
134
|
+
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=82cc2ee2-ff41-4844-9ae6-c9face103e81" />
|
@@ -0,0 +1,80 @@
|
|
1
|
+
build:
|
2
|
+
[
|
3
|
+
linux-x64-gnu,
|
4
|
+
linux-x64-musl,
|
5
|
+
linux-arm64-gnu,
|
6
|
+
linux-arm64-musl,
|
7
|
+
linux-ia32-gnu,
|
8
|
+
darwin-arm64,
|
9
|
+
darwin-x64,
|
10
|
+
win32-x64-msvc,
|
11
|
+
win32-arm64-msvc,
|
12
|
+
win32-ia32-msvc,
|
13
|
+
]
|
14
|
+
include:
|
15
|
+
- build: linux-x64-gnu
|
16
|
+
os: ubuntu-latest
|
17
|
+
rust: stable
|
18
|
+
target: x86_64-unknown-linux-gnu
|
19
|
+
libc: glibc
|
20
|
+
|
21
|
+
- build: linux-x64-musl
|
22
|
+
os: ubuntu-latest
|
23
|
+
rust: stable
|
24
|
+
target: x86_64-unknown-linux-musl
|
25
|
+
libc: musl
|
26
|
+
cross: true
|
27
|
+
|
28
|
+
- build: linux-arm64-gnu
|
29
|
+
os: ubuntu-latest
|
30
|
+
rust: stable
|
31
|
+
target: aarch64-unknown-linux-gnu
|
32
|
+
libc: glibc
|
33
|
+
cross: true
|
34
|
+
|
35
|
+
- build: linux-arm64-musl
|
36
|
+
os: ubuntu-latest
|
37
|
+
rust: stable
|
38
|
+
target: aarch64-unknown-linux-musl
|
39
|
+
libc: musl
|
40
|
+
cross: true
|
41
|
+
|
42
|
+
- build: linux-ia32-gnu
|
43
|
+
os: ubuntu-latest
|
44
|
+
rust: stable
|
45
|
+
target: i686-unknown-linux-gnu
|
46
|
+
libc: glibc
|
47
|
+
cross: true
|
48
|
+
|
49
|
+
- build: darwin-arm64
|
50
|
+
os: macos-latest
|
51
|
+
rust: stable
|
52
|
+
target: aarch64-apple-darwin
|
53
|
+
|
54
|
+
- build: darwin-x64
|
55
|
+
os: macos-latest
|
56
|
+
rust: stable
|
57
|
+
target: x86_64-apple-darwin
|
58
|
+
|
59
|
+
- build: win32-x64-msvc
|
60
|
+
os: windows-latest
|
61
|
+
rust: stable
|
62
|
+
target: x86_64-pc-windows-msvc
|
63
|
+
libc: msvc
|
64
|
+
ext: ".exe"
|
65
|
+
|
66
|
+
- build: win32-arm64-msvc
|
67
|
+
os: windows-latest
|
68
|
+
rust: stable
|
69
|
+
target: aarch64-pc-windows-msvc
|
70
|
+
features: --no-default-features --features cli
|
71
|
+
libc: msvc
|
72
|
+
ext: ".exe"
|
73
|
+
test: false # TODO: tests are broken without default features
|
74
|
+
|
75
|
+
- build: win32-ia32-msvc
|
76
|
+
os: windows-latest
|
77
|
+
rust: stable
|
78
|
+
target: i686-pc-windows-msvc
|
79
|
+
libc: msvc
|
80
|
+
ext: ".exe"
|
package/package.json
CHANGED
@@ -1,6 +1,42 @@
|
|
1
1
|
{
|
2
|
+
"description": "A high-performance GraphQL proxy, optimized for cloud-native environments, covering edge, middle, and service layers.",
|
3
|
+
"license": "Apache-2.0",
|
4
|
+
"repository": {
|
5
|
+
"type": "git",
|
6
|
+
"url": "https://github.com/tailcallhq/tailcall"
|
7
|
+
},
|
8
|
+
"homepage": "https://tailcall.run/",
|
9
|
+
"keywords": [
|
10
|
+
"graphql",
|
11
|
+
"proxy",
|
12
|
+
"api-gateway",
|
13
|
+
"rust",
|
14
|
+
"http",
|
15
|
+
"grpc",
|
16
|
+
"bff",
|
17
|
+
"backend-for-frontend",
|
18
|
+
"microservices",
|
19
|
+
"high-performance",
|
20
|
+
"edge"
|
21
|
+
],
|
2
22
|
"name": "@webbdays/tailcall",
|
3
|
-
"
|
4
|
-
"
|
5
|
-
"
|
6
|
-
|
23
|
+
"type": "module",
|
24
|
+
"version": "0.0.40",
|
25
|
+
"scarfSettings": {
|
26
|
+
"defaultOptIn": true,
|
27
|
+
"allowTopLevel": true
|
28
|
+
},
|
29
|
+
"dependencies": {
|
30
|
+
"detect-libc": "^2.0.2",
|
31
|
+
"@scarf/scarf": "^1.3.0",
|
32
|
+
"yaml": "^2.3.3",
|
33
|
+
"axios": "^1.7.4"
|
34
|
+
},
|
35
|
+
"scripts": {
|
36
|
+
"postinstall": "node ./scripts/post-install.js",
|
37
|
+
"preinstall": "node ./scripts/pre-install.js"
|
38
|
+
},
|
39
|
+
"bin": {
|
40
|
+
"tailcall": "bin/tailcall"
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
const version = "0.0.40";
|
2
|
+
// @ts-check
|
3
|
+
import {familySync, GLIBC, MUSL} from "detect-libc"
|
4
|
+
import {exec} from "child_process"
|
5
|
+
import util from "util"
|
6
|
+
import get_matched_platform from "./utils.js"
|
7
|
+
import fs from "fs"
|
8
|
+
import axios from "axios"
|
9
|
+
import {resolve, dirname} from "path"
|
10
|
+
import {fileURLToPath} from "url"
|
11
|
+
|
12
|
+
const execa = util.promisify(exec)
|
13
|
+
const os = process.platform
|
14
|
+
const arch = process.arch
|
15
|
+
const libcFamily = familySync()
|
16
|
+
|
17
|
+
let libc = ""
|
18
|
+
if (os === "win32") {
|
19
|
+
libc = "msvc"
|
20
|
+
} else {
|
21
|
+
libc = libcFamily === GLIBC ? "gnu" : libcFamily === MUSL ? "musl" : ""
|
22
|
+
}
|
23
|
+
|
24
|
+
const matched_platform = get_matched_platform(os, arch, libc)
|
25
|
+
if (matched_platform != null) {
|
26
|
+
console.log("Found matching platform :", matched_platform)
|
27
|
+
const targetPlatform = matched_platform
|
28
|
+
|
29
|
+
let targetPlatformExt = ""
|
30
|
+
console.log("Target platform config : " + targetPlatform);
|
31
|
+
if (targetPlatform.get("ext")!=undefined) {
|
32
|
+
|
33
|
+
targetPlatformExt = targetPlatform.get("ext")
|
34
|
+
}
|
35
|
+
|
36
|
+
const pkg_download_base_url = "https://github.com/tailcallhq/tailcall/releases/download"
|
37
|
+
const binary = `tailcall-${targetPlatform.get("target")}${targetPlatformExt}`
|
38
|
+
const release_binary_url_path = `/v0.104.9/${binary}`
|
39
|
+
const full_url = pkg_download_base_url + release_binary_url_path
|
40
|
+
|
41
|
+
console.log(`Downloading Tailcall for ${binary} ...`)
|
42
|
+
|
43
|
+
const bin_path = `bin/tailcall-${targetPlatform.get("target")}${targetPlatformExt}`
|
44
|
+
download_binary(full_url, bin_path)
|
45
|
+
}
|
46
|
+
|
47
|
+
async function download_binary(full_url, output_path) {
|
48
|
+
const file = fs.createWriteStream(output_path)
|
49
|
+
const _ = await axios({
|
50
|
+
url: full_url,
|
51
|
+
method: "GET",
|
52
|
+
responseType: "stream",
|
53
|
+
}).then((response) => {
|
54
|
+
console.log("resp : ", response);
|
55
|
+
response.data.pipe(file)
|
56
|
+
file.on("finish", async () => {
|
57
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
58
|
+
|
59
|
+
const directoryPath = resolve(__dirname, "../")
|
60
|
+
const packageJsonString = fs.readFileSync(resolve(directoryPath, "./package.json"), "utf8")
|
61
|
+
const packageJson = JSON.parse(packageJsonString)
|
62
|
+
packageJson.bin = {tailcall: output_path}
|
63
|
+
fs.writeFileSync(resolve(directoryPath, "./package.json"), JSON.stringify(packageJson, null, 2), "utf8")
|
64
|
+
|
65
|
+
console.log("Tailcall binary downloaded successfully")
|
66
|
+
})
|
67
|
+
})
|
68
|
+
.catch((error) => {
|
69
|
+
console.error("Error installing package: ", error.message);
|
70
|
+
})
|
71
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
// @ts-check
|
2
|
+
import {familySync, GLIBC, MUSL} from "detect-libc"
|
3
|
+
import get_matched_platform from "./utils.js"
|
4
|
+
|
5
|
+
const os = process.platform
|
6
|
+
const arch = process.arch
|
7
|
+
const libcFamily = familySync()
|
8
|
+
|
9
|
+
let libc = ""
|
10
|
+
if (os === "win32") {
|
11
|
+
libc = "msvc"
|
12
|
+
} else {
|
13
|
+
libc = libcFamily === GLIBC ? "gnu" : libcFamily === MUSL ? "musl" : ""
|
14
|
+
}
|
15
|
+
|
16
|
+
const matched_platform = get_matched_platform(os, arch, libc)
|
17
|
+
|
18
|
+
if (matched_platform == null) {
|
19
|
+
const redColor = "\x1b[31m"
|
20
|
+
const resetColor = "\x1b[0m"
|
21
|
+
console.error(`${redColor} Tailcall does not support platform - ${os}, arch - ${arch}, libc - ${libc} ${resetColor}`)
|
22
|
+
process.exit(1)
|
23
|
+
}
|
package/scripts/utils.js
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
import fs from "fs"
|
2
|
+
import {dirname, resolve} from "path"
|
3
|
+
import {fileURLToPath} from "url"
|
4
|
+
import YML from "yaml"
|
5
|
+
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
7
|
+
|
8
|
+
export default function get_matched_platform(os, arch, libc) {
|
9
|
+
const directoryPath = resolve(__dirname, "../")
|
10
|
+
const file = fs.readFileSync(resolve(directoryPath, "./build-matrix.yaml"), "utf8")
|
11
|
+
const build_matrix = YML.parse(file, {mapAsMap: true})
|
12
|
+
|
13
|
+
let found = null
|
14
|
+
build_matrix.get("include").forEach((platform) => {
|
15
|
+
const split = platform.get("build").split("-")
|
16
|
+
const platform_arch = split.at(1)
|
17
|
+
const platform_os = split.at(0)
|
18
|
+
const platform_libc = split.at(-1)
|
19
|
+
if (platform_arch == arch && platform_os == os && platform_libc == libc) {
|
20
|
+
found = platform
|
21
|
+
}
|
22
|
+
})
|
23
|
+
return found
|
24
|
+
}
|