unkey 2.0.65 → 2.0.144
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 +29 -9
- package/install.js +1 -1
- package/lib.js +71 -32
- package/package.json +13 -13
- package/run-unkey.js +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,44 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<h1 align="center">Unkey</h1>
|
|
3
|
-
<h5>
|
|
3
|
+
<h5>The Developer Platform for Modern APIs</h5>
|
|
4
4
|
</div>
|
|
5
5
|
|
|
6
6
|
<div align="center">
|
|
7
|
-
<a href="https://go.unkey.com">unkey.com</a>
|
|
7
|
+
<a href="https://go.unkey.com">unkey.com</a> ·
|
|
8
|
+
<a href="https://www.unkey.com/docs">Docs</a> ·
|
|
9
|
+
<a href="https://engineering.unkey.com">Engineering</a> ·
|
|
10
|
+
<a href="https://go.unkey.com/discord">Discord</a>
|
|
8
11
|
</div>
|
|
9
12
|
<br/>
|
|
10
13
|
|
|
11
|
-
##
|
|
14
|
+
## What is Unkey?
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
**Unkey is the developer platform for modern APIs.** We unify your infrastructure so you can ship faster: deploy APIs instantly, route traffic through global gateways, and understand usage — all in one place.
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
- **Deploy** — push an API to production in seconds, with zero infrastructure to manage
|
|
19
|
+
- **Gateway** — route, authenticate, and shape traffic through globally distributed gateways
|
|
20
|
+
- **API Keys** — issue, verify, and revoke keys with fast global verification
|
|
21
|
+
- **Ratelimiting** — globally consistent, durable ratelimiting for any identifier
|
|
22
|
+
- **Permissions & RBAC** — per-key permissions, roles, and fine-grained access control
|
|
23
|
+
- **Analytics** — usage, latency, and per-key insights across every request
|
|
24
|
+
- **Audit logs** — immutable history of every action across your workspace
|
|
18
25
|
|
|
19
|
-
This helps us align efforts and prevents duplicated or conflicting work.
|
|
20
26
|
|
|
21
|
-
##
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
Please find the license under the [LICENSE](./LICENSE) file.
|
|
30
|
+
|
|
31
|
+
## Pull requests
|
|
32
|
+
|
|
33
|
+
**Unkey is not accepting external pull requests at this time.**
|
|
34
|
+
|
|
35
|
+
Unkey has paused external code contributions while the team focuses on platform direction and stability. Pull requests opened by people outside the Unkey team will not be reviewed or merged.
|
|
36
|
+
|
|
37
|
+
Issues remain open for bug reports, feature requests, and documentation feedback. This repository remains public and source-available so you can read the code, fork it under the terms of the AGPL, and self-host. Unkey may revisit this policy in the future, and any change will be announced here.
|
|
38
|
+
|
|
39
|
+
If you've found a security issue, please email [security@unkey.com](mailto:security@unkey.com) instead of opening a public issue.
|
|
40
|
+
|
|
41
|
+
## Let's Talk
|
|
22
42
|
|
|
23
43
|
<a href="https://unkey.cal.com/unkey/user-interview?utm_source=banner&utm_campaign=oss"><img alt="Book us with Cal.com" src="https://cal.com/book-with-cal-dark.svg" /></a>
|
|
24
44
|
|
package/install.js
CHANGED
package/lib.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
// This file was generated by GoReleaser. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import crypto from "crypto";
|
|
4
|
+
import http from "http";
|
|
5
|
+
import https from "https";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import JSZip from "jszip";
|
|
8
|
+
import { x as tarExtract } from "tar";
|
|
9
|
+
import { ProxyAgent } from "proxy-agent";
|
|
10
|
+
import { spawnSync } from "child_process";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
|
|
13
|
+
const { archives, name, version } = JSON.parse(
|
|
14
|
+
fs.readFileSync(new URL("./package.json", import.meta.url), "utf8"),
|
|
15
|
+
);
|
|
11
16
|
|
|
12
17
|
const agent = new ProxyAgent();
|
|
18
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
13
19
|
|
|
14
20
|
const getArchive = () => {
|
|
15
21
|
let target = `${process.platform}-${process.arch}`;
|
|
@@ -30,7 +36,7 @@ async function extractTar(tarPath, binaries, dir, wrappedIn) {
|
|
|
30
36
|
)
|
|
31
37
|
: binaries;
|
|
32
38
|
|
|
33
|
-
await
|
|
39
|
+
await tarExtract({
|
|
34
40
|
file: tarPath,
|
|
35
41
|
cwd: dir,
|
|
36
42
|
filter: (path) => filesToExtract.includes(path),
|
|
@@ -125,23 +131,25 @@ const install = async () => {
|
|
|
125
131
|
const bin = path.join(binDir, archive.bins[0]);
|
|
126
132
|
fs.copyFileSync(archivePath, bin);
|
|
127
133
|
fs.chmodSync(bin, 0o755);
|
|
128
|
-
|
|
134
|
+
break;
|
|
129
135
|
case "zip":
|
|
130
|
-
|
|
136
|
+
await extractZip(
|
|
131
137
|
archivePath,
|
|
132
138
|
archive.bins,
|
|
133
139
|
binDir,
|
|
134
140
|
archive.wrappedIn,
|
|
135
141
|
);
|
|
142
|
+
break;
|
|
136
143
|
case "tar":
|
|
137
144
|
case "tar.gz":
|
|
138
145
|
case "tgz":
|
|
139
|
-
|
|
146
|
+
await extractTar(
|
|
140
147
|
archivePath,
|
|
141
148
|
archive.bins,
|
|
142
149
|
binDir,
|
|
143
150
|
archive.wrappedIn,
|
|
144
151
|
);
|
|
152
|
+
break;
|
|
145
153
|
case "tar.zst":
|
|
146
154
|
case "tzst":
|
|
147
155
|
case "tar.xz":
|
|
@@ -149,6 +157,7 @@ const install = async () => {
|
|
|
149
157
|
default:
|
|
150
158
|
throw new Error(`unsupported format: ${archive.format}`);
|
|
151
159
|
}
|
|
160
|
+
console.log(`Installed ${name} ${version} to ${binDir}`);
|
|
152
161
|
} catch (err) {
|
|
153
162
|
throw new Error(`Installation failed: ${err.message}`);
|
|
154
163
|
}
|
|
@@ -170,7 +179,7 @@ const verify = (filename, checksum) => {
|
|
|
170
179
|
}
|
|
171
180
|
};
|
|
172
181
|
|
|
173
|
-
const download = async (url, filename) => {
|
|
182
|
+
const download = async (url, filename, maxRedirects = 10) => {
|
|
174
183
|
try {
|
|
175
184
|
console.log(`Downloading ${url} to ${filename}...`);
|
|
176
185
|
const dir = path.dirname(filename);
|
|
@@ -178,27 +187,56 @@ const download = async (url, filename) => {
|
|
|
178
187
|
fs.mkdirSync(dir, { recursive: true });
|
|
179
188
|
}
|
|
180
189
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
responseType: "stream",
|
|
185
|
-
timeout: 300000, // 5min
|
|
186
|
-
httpAgent: agent,
|
|
187
|
-
httpsAgent: agent,
|
|
188
|
-
});
|
|
190
|
+
return new Promise((resolve, reject) => {
|
|
191
|
+
const parsedUrl = new URL(url);
|
|
192
|
+
const mod = parsedUrl.protocol === "https:" ? https : http;
|
|
189
193
|
|
|
190
|
-
|
|
191
|
-
|
|
194
|
+
const request = mod.get(url, { agent }, (response) => {
|
|
195
|
+
if (
|
|
196
|
+
response.statusCode >= 300 &&
|
|
197
|
+
response.statusCode < 400 &&
|
|
198
|
+
response.headers.location
|
|
199
|
+
) {
|
|
200
|
+
if (maxRedirects <= 0) {
|
|
201
|
+
reject(new Error("Too many redirects"));
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
download(response.headers.location, filename, maxRedirects - 1)
|
|
205
|
+
.then(resolve)
|
|
206
|
+
.catch(reject);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
192
209
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
210
|
+
if (response.statusCode !== 200) {
|
|
211
|
+
reject(
|
|
212
|
+
new Error(
|
|
213
|
+
`HTTP ${response.statusCode}: ${response.statusMessage}`,
|
|
214
|
+
),
|
|
215
|
+
);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const writer = fs.createWriteStream(filename);
|
|
220
|
+
response.pipe(writer);
|
|
221
|
+
|
|
222
|
+
writer.on("finish", () => {
|
|
223
|
+
console.log(`Download complete: ${filename}`);
|
|
224
|
+
resolve(dir);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
writer.on("error", (err) => {
|
|
228
|
+
console.error(`Error writing file: ${err.message}`);
|
|
229
|
+
reject(err);
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
request.on("error", (err) => {
|
|
234
|
+
reject(new Error(`Request failed: ${err.message}`));
|
|
197
235
|
});
|
|
198
236
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
reject(
|
|
237
|
+
request.setTimeout(300000, () => {
|
|
238
|
+
request.destroy();
|
|
239
|
+
reject(new Error("Request timed out"));
|
|
202
240
|
});
|
|
203
241
|
});
|
|
204
242
|
} catch (err) {
|
|
@@ -213,8 +251,9 @@ function exists(archive) {
|
|
|
213
251
|
return archive.bins.every((bin) => fs.existsSync(path.join(binDir, bin)));
|
|
214
252
|
}
|
|
215
253
|
|
|
216
|
-
|
|
254
|
+
export {
|
|
217
255
|
install,
|
|
218
256
|
run,
|
|
219
257
|
getArchive,
|
|
258
|
+
download,
|
|
220
259
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unkey",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.0.144",
|
|
4
5
|
"description": "Unkey CLI",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"postinstall": "node install.js",
|
|
@@ -18,58 +19,57 @@
|
|
|
18
19
|
"unkey": "run-unkey.js"
|
|
19
20
|
},
|
|
20
21
|
"dependencies": {
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"tar": "^7.4.3"
|
|
22
|
+
"jszip": "3.10.1",
|
|
23
|
+
"proxy-agent": "8.0.1",
|
|
24
|
+
"tar": "7.5.13"
|
|
25
25
|
},
|
|
26
26
|
"archives": {
|
|
27
27
|
"darwin-arm64": {
|
|
28
28
|
"name": "unkey_Darwin_arm64.tar.gz",
|
|
29
|
-
"url": "https://github.com/unkeyed/unkey/releases/download/v2.0.
|
|
29
|
+
"url": "https://github.com/unkeyed/unkey/releases/download/v2.0.144/unkey_Darwin_arm64.tar.gz",
|
|
30
30
|
"bins": [
|
|
31
31
|
"unkey"
|
|
32
32
|
],
|
|
33
33
|
"format": "tar.gz",
|
|
34
34
|
"checksum": {
|
|
35
35
|
"algorithm": "sha256",
|
|
36
|
-
"digest": "
|
|
36
|
+
"digest": "1952e53e057fbeb1cd0c2e1bfcb75c7a4d5a6e7364086adc250445c907dd8f10"
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"darwin-x64": {
|
|
40
40
|
"name": "unkey_Darwin_x86_64.tar.gz",
|
|
41
|
-
"url": "https://github.com/unkeyed/unkey/releases/download/v2.0.
|
|
41
|
+
"url": "https://github.com/unkeyed/unkey/releases/download/v2.0.144/unkey_Darwin_x86_64.tar.gz",
|
|
42
42
|
"bins": [
|
|
43
43
|
"unkey"
|
|
44
44
|
],
|
|
45
45
|
"format": "tar.gz",
|
|
46
46
|
"checksum": {
|
|
47
47
|
"algorithm": "sha256",
|
|
48
|
-
"digest": "
|
|
48
|
+
"digest": "9f5787407cd4197de12c7d013f6eed0ee0b1ab138cc7f3d5a0decdcccbacbb62"
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"linux-arm64": {
|
|
52
52
|
"name": "unkey_Linux_arm64.tar.gz",
|
|
53
|
-
"url": "https://github.com/unkeyed/unkey/releases/download/v2.0.
|
|
53
|
+
"url": "https://github.com/unkeyed/unkey/releases/download/v2.0.144/unkey_Linux_arm64.tar.gz",
|
|
54
54
|
"bins": [
|
|
55
55
|
"unkey"
|
|
56
56
|
],
|
|
57
57
|
"format": "tar.gz",
|
|
58
58
|
"checksum": {
|
|
59
59
|
"algorithm": "sha256",
|
|
60
|
-
"digest": "
|
|
60
|
+
"digest": "5308f8448d4554a22a502210bf623cc2b2b4bfb47d1c70f4bb8f286142a54ce9"
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"linux-x64": {
|
|
64
64
|
"name": "unkey_Linux_x86_64.tar.gz",
|
|
65
|
-
"url": "https://github.com/unkeyed/unkey/releases/download/v2.0.
|
|
65
|
+
"url": "https://github.com/unkeyed/unkey/releases/download/v2.0.144/unkey_Linux_x86_64.tar.gz",
|
|
66
66
|
"bins": [
|
|
67
67
|
"unkey"
|
|
68
68
|
],
|
|
69
69
|
"format": "tar.gz",
|
|
70
70
|
"checksum": {
|
|
71
71
|
"algorithm": "sha256",
|
|
72
|
-
"digest": "
|
|
72
|
+
"digest": "833f452bb0ab0c33d8c82edea11b795998275385942718ec4cbb7966a0c9290b"
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
package/run-unkey.js
CHANGED