apiblaze 0.1.21 → 0.2.0
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 +33 -13
- package/dist/index.js +13 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ npm install -g apiblaze
|
|
|
11
11
|
Or run without installing:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npx apiblaze
|
|
14
|
+
npx apiblaze --help
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Requirements
|
|
@@ -21,14 +21,29 @@ npx apiblaze dev
|
|
|
21
21
|
## Quick start
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
#
|
|
25
|
-
apiblaze
|
|
24
|
+
# Create a proxy (no account needed)
|
|
25
|
+
npx apiblaze create --target https://api.example.com
|
|
26
|
+
|
|
27
|
+
# Optional: sign in if you want it under your team
|
|
28
|
+
npx apiblaze login
|
|
29
|
+
|
|
30
|
+
# Create a proxy under your team
|
|
31
|
+
npx apiblaze create --name myapi --target https://api.example.com --auth api_key
|
|
32
|
+
|
|
33
|
+
# Start a dev tunnel (defaults to port 3000)
|
|
34
|
+
npx apiblaze dev
|
|
26
35
|
|
|
27
|
-
#
|
|
28
|
-
apiblaze dev
|
|
36
|
+
# Or specify a port
|
|
37
|
+
npx apiblaze dev 3000
|
|
29
38
|
|
|
30
|
-
|
|
31
|
-
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Help
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
apiblaze --help
|
|
45
|
+
apiblaze help create
|
|
46
|
+
apiblaze help dev
|
|
32
47
|
```
|
|
33
48
|
|
|
34
49
|
## Commands
|
|
@@ -36,20 +51,25 @@ apiblaze dev --port 8080
|
|
|
36
51
|
| Command | Description |
|
|
37
52
|
|---|---|
|
|
38
53
|
| `apiblaze login` | Authenticate with your APIblaze account |
|
|
39
|
-
| `apiblaze
|
|
54
|
+
| `apiblaze create [options]` | Create a new API proxy (anonymous if not logged in) |
|
|
55
|
+
| `apiblaze claim [code]` | Claim an anonymously-created proxy into your team |
|
|
56
|
+
| `apiblaze projects` | List your team projects |
|
|
57
|
+
| `apiblaze dev [port]` | Start a dev tunnel for your localhost projects |
|
|
58
|
+
| `apiblaze team [team]` | Switch the active team |
|
|
59
|
+
| `apiblaze whoami` | Show the signed-in identity and active team |
|
|
60
|
+
| `apiblaze logout` | Sign out and remove stored credentials |
|
|
40
61
|
|
|
41
62
|
## How it works
|
|
42
63
|
|
|
43
64
|
`apiblaze dev` automatically:
|
|
44
65
|
|
|
45
|
-
1.
|
|
46
|
-
2.
|
|
47
|
-
3.
|
|
48
|
-
4. Streams live traffic logs to your terminal in real
|
|
66
|
+
1. Fetches your APIblaze projects that target `localhost` (or other internal targets)
|
|
67
|
+
2. Registers a temporary dev tunnel with APIblaze
|
|
68
|
+
3. Opens a secure connection and forwards incoming requests to your local server
|
|
69
|
+
4. Streams live traffic logs to your terminal in real time
|
|
49
70
|
|
|
50
71
|
On Ctrl+C the tunnel is cleanly deregistered.
|
|
51
72
|
|
|
52
73
|
## License
|
|
53
74
|
|
|
54
75
|
MIT
|
|
55
|
-
# npm-apiblaze
|
package/dist/index.js
CHANGED
|
@@ -206,7 +206,7 @@ var import_commander = require("commander");
|
|
|
206
206
|
var import_chalk10 = __toESM(require("chalk"));
|
|
207
207
|
|
|
208
208
|
// package.json
|
|
209
|
-
var version = "0.
|
|
209
|
+
var version = "0.2.0";
|
|
210
210
|
|
|
211
211
|
// src/index.ts
|
|
212
212
|
init_types();
|
|
@@ -719,6 +719,16 @@ function fail(message) {
|
|
|
719
719
|
console.error(import_chalk5.default.red(`Error: ${message}`));
|
|
720
720
|
process.exit(1);
|
|
721
721
|
}
|
|
722
|
+
function printCurlExample(url, apiKey) {
|
|
723
|
+
console.log();
|
|
724
|
+
console.log(` ${import_chalk5.default.dim("Try it with curl:")}`);
|
|
725
|
+
if (apiKey) {
|
|
726
|
+
console.log(` ${import_chalk5.default.cyan(`curl ${url} \\`)}`);
|
|
727
|
+
console.log(` ${import_chalk5.default.cyan(` -H "X-API-Key: ${apiKey}"`)}`);
|
|
728
|
+
} else {
|
|
729
|
+
console.log(` ${import_chalk5.default.cyan(`curl ${url}`)}`);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
722
732
|
var VALID_AUTH = ["api_key", "none", "oauth"];
|
|
723
733
|
async function runCreate(opts = {}) {
|
|
724
734
|
const creds = loadCredentials();
|
|
@@ -899,6 +909,7 @@ async function runCreate(opts = {}) {
|
|
|
899
909
|
console.log(import_chalk5.default.dim(` (Separate keys were also created for: ${otherEnvs.join(", ")}.)`));
|
|
900
910
|
}
|
|
901
911
|
}
|
|
912
|
+
printCurlExample(proxyUrl, auth === "none" ? void 0 : adminKey);
|
|
902
913
|
console.log();
|
|
903
914
|
}
|
|
904
915
|
async function runAnonymousCreate(opts) {
|
|
@@ -1009,6 +1020,7 @@ async function runAnonymousCreate(opts) {
|
|
|
1009
1020
|
console.log(` ${import_chalk5.default.bold.green(apiKey)}`);
|
|
1010
1021
|
console.log(import_chalk5.default.dim("\n Save this now \u2014 send it as the X-API-Key header. It may not be shown again."));
|
|
1011
1022
|
}
|
|
1023
|
+
if (prodEndpoint) printCurlExample(prodEndpoint, apiKey);
|
|
1012
1024
|
if (result.claim_url) {
|
|
1013
1025
|
console.log();
|
|
1014
1026
|
console.log(` ${import_chalk5.default.yellow("\u26A0 Anonymous proxy \u2014 claim it to your account within 30 days or it expires:")}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apiblaze",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Dev tunnel CLI for APIblaze — route localhost projects through your APIblaze endpoints",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"apiblaze",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"build": "tsup",
|
|
27
27
|
"build:watch": "tsup --watch",
|
|
28
28
|
"typecheck": "tsc --noEmit",
|
|
29
|
-
"prepublishOnly": "npm run build && npm run typecheck"
|
|
29
|
+
"prepublishOnly": "npm run build && npm run typecheck",
|
|
30
|
+
"release": "bash release.sh"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"chalk": "^4.1.2",
|