unkey 2.0.107-rc.3 → 2.0.145
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 +65 -29
- 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),
|
|
@@ -173,7 +179,7 @@ const verify = (filename, checksum) => {
|
|
|
173
179
|
}
|
|
174
180
|
};
|
|
175
181
|
|
|
176
|
-
const download = async (url, filename) => {
|
|
182
|
+
const download = async (url, filename, maxRedirects = 10) => {
|
|
177
183
|
try {
|
|
178
184
|
console.log(`Downloading ${url} to ${filename}...`);
|
|
179
185
|
const dir = path.dirname(filename);
|
|
@@ -181,27 +187,56 @@ const download = async (url, filename) => {
|
|
|
181
187
|
fs.mkdirSync(dir, { recursive: true });
|
|
182
188
|
}
|
|
183
189
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
responseType: "stream",
|
|
188
|
-
timeout: 300000, // 5min
|
|
189
|
-
httpAgent: agent,
|
|
190
|
-
httpsAgent: agent,
|
|
191
|
-
});
|
|
190
|
+
return new Promise((resolve, reject) => {
|
|
191
|
+
const parsedUrl = new URL(url);
|
|
192
|
+
const mod = parsedUrl.protocol === "https:" ? https : http;
|
|
192
193
|
|
|
193
|
-
|
|
194
|
-
|
|
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
|
+
}
|
|
195
209
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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}`));
|
|
200
235
|
});
|
|
201
236
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
reject(
|
|
237
|
+
request.setTimeout(300000, () => {
|
|
238
|
+
request.destroy();
|
|
239
|
+
reject(new Error("Request timed out"));
|
|
205
240
|
});
|
|
206
241
|
});
|
|
207
242
|
} catch (err) {
|
|
@@ -216,8 +251,9 @@ function exists(archive) {
|
|
|
216
251
|
return archive.bins.every((bin) => fs.existsSync(path.join(binDir, bin)));
|
|
217
252
|
}
|
|
218
253
|
|
|
219
|
-
|
|
254
|
+
export {
|
|
220
255
|
install,
|
|
221
256
|
run,
|
|
222
257
|
getArchive,
|
|
258
|
+
download,
|
|
223
259
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unkey",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.0.145",
|
|
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.145/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": "87e59bd23c78d64ebbbe9de544ed137bc2901b2a3830d18dfd04956070a6ff3a"
|
|
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.145/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": "0756d040f74ca7d9d5a9ef415b3735dec7dbd1d2330d51ada73d76e745f6495b"
|
|
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.145/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": "45ec4effac57eb0ae5f64b598da998220818b763084eba2d0fbc25cb8b7ee258"
|
|
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.145/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": "5bbaeaf99e14ea7c08338abb5594874d38cb436091dffe5c97cdc7a2503eb7a5"
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
package/run-unkey.js
CHANGED