@vibiz/cli 0.3.10 → 0.3.14
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 +2 -2
- package/dist/{chunk-DI7GYIZQ.js → chunk-PU7FGYLR.js} +47 -9
- package/dist/{src-BBALUAYI.js → src-H7SRDBOZ.js} +193 -100
- package/dist/vibiz.js +157 -59
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# vibiz
|
|
2
2
|
|
|
3
|
-
The [
|
|
3
|
+
The [thelastapi](https://app.vibiz.app/docs) CLI and MCP server: website, database, sign-in, email
|
|
4
4
|
and AI for a new business, from a terminal or an AI agent.
|
|
5
5
|
|
|
6
6
|
```bash
|
|
@@ -14,7 +14,7 @@ Or install it once: `npm install -g @vibiz/cli`, then run `vibiz …`.
|
|
|
14
14
|
|
|
15
15
|
## MCP server
|
|
16
16
|
|
|
17
|
-
`vibiz mcp` serves the
|
|
17
|
+
`vibiz mcp` serves the thelastapi tools (and the docs, as resources) to any MCP client over stdio. It
|
|
18
18
|
uses the same login as the CLI, or `VIBIZ_API_KEY` / `VIBIZ_API_URL` from its env.
|
|
19
19
|
|
|
20
20
|
```bash
|
|
@@ -7,7 +7,7 @@ function noBodyMessage(status) {
|
|
|
7
7
|
if (status === 413) return "Too large (413): send less at once.";
|
|
8
8
|
if (status === 429) return "Too many requests (429): wait a moment and retry.";
|
|
9
9
|
if (status >= 500) {
|
|
10
|
-
return `The
|
|
10
|
+
return `The thelastapi API did not answer properly (${status}). It is usually brief: retry in a minute.`;
|
|
11
11
|
}
|
|
12
12
|
return `The request failed with ${status} and no explanation from the API.`;
|
|
13
13
|
}
|
|
@@ -22,13 +22,28 @@ var VibizApiError = class extends Error {
|
|
|
22
22
|
status;
|
|
23
23
|
code;
|
|
24
24
|
details;
|
|
25
|
+
detail(k) {
|
|
26
|
+
const d = this.details;
|
|
27
|
+
return d && typeof d[k] === "string" ? d[k] : void 0;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The permission a Limited key was refused for (`database.production:read`,
|
|
31
|
+
* or `*` when it needs Full access); undefined for other errors.
|
|
32
|
+
*/
|
|
33
|
+
get permission() {
|
|
34
|
+
return this.detail("permission");
|
|
35
|
+
}
|
|
36
|
+
/** The console link that opens this key with that permission ready to allow (give it to the user). */
|
|
37
|
+
get grantUrl() {
|
|
38
|
+
return this.detail("grant_url");
|
|
39
|
+
}
|
|
25
40
|
};
|
|
26
41
|
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
27
42
|
var Vibiz = class {
|
|
28
43
|
constructor(options) {
|
|
29
44
|
this.options = options;
|
|
30
45
|
if (!options.baseUrl) {
|
|
31
|
-
throw new Error("No
|
|
46
|
+
throw new Error("No thelastapi API URL: pass baseUrl (CLI: --api, or VIBIZ_API_URL).");
|
|
32
47
|
}
|
|
33
48
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
34
49
|
this.fetchImpl = options.fetch ?? globalThis.fetch;
|
|
@@ -41,6 +56,7 @@ var Vibiz = class {
|
|
|
41
56
|
if (init.body !== void 0) headers["content-type"] = "application/json";
|
|
42
57
|
if (init.raw) headers["content-type"] = init.contentType ?? "application/octet-stream";
|
|
43
58
|
if (init.idempotencyKey) headers["idempotency-key"] = init.idempotencyKey;
|
|
59
|
+
if (init.project) headers["x-vibiz-project"] = init.project;
|
|
44
60
|
if (this.options.user) headers["x-vibiz-user"] = endUserHeader(this.options.user);
|
|
45
61
|
if (this.options.client) headers["x-vibiz-client"] = this.options.client;
|
|
46
62
|
return this.fetchImpl(`${this.baseUrl}/v1${path}`, {
|
|
@@ -862,6 +878,14 @@ var Vibiz = class {
|
|
|
862
878
|
method: "POST",
|
|
863
879
|
body: { api_key: apiKey }
|
|
864
880
|
}),
|
|
881
|
+
/**
|
|
882
|
+
* Owner: push pages Google hasn't crawled yet to Google's Indexing API
|
|
883
|
+
* (off by default; up to 200 a day per Google Cloud project).
|
|
884
|
+
*/
|
|
885
|
+
setGooglePush: (enabled) => this.request("/search/settings", {
|
|
886
|
+
method: "PATCH",
|
|
887
|
+
body: { google_push: enabled }
|
|
888
|
+
}),
|
|
865
889
|
/** Owner: disconnect a Google account or the Bing key. */
|
|
866
890
|
disconnect: (id) => this.request(
|
|
867
891
|
`/search/connections/${id}`,
|
|
@@ -1522,17 +1546,31 @@ var Vibiz = class {
|
|
|
1522
1546
|
/**
|
|
1523
1547
|
* The secret is returned once, here. Full access (`owner`) by default;
|
|
1524
1548
|
* `access: 'agent'` makes it Limited (builds and runs, never reads
|
|
1525
|
-
* production secrets nor moves live money)
|
|
1549
|
+
* production secrets nor moves live money), `preset: 'read_all'` Limited
|
|
1550
|
+
* that reads everything, `grants` Limited with those permissions
|
|
1551
|
+
* (`permissions()`). A Limited caller never gives more than it has.
|
|
1526
1552
|
*/
|
|
1527
1553
|
create: (name, opts = {}) => this.request("/api-keys", {
|
|
1528
1554
|
method: "POST",
|
|
1529
|
-
body: { name, ...opts
|
|
1555
|
+
body: { name, ...opts }
|
|
1530
1556
|
}),
|
|
1531
|
-
/** Full access (`owner`) or Limited (`agent`), afterwards. Needs
|
|
1557
|
+
/** Full access (`owner`) or Limited (`agent`), afterwards. Needs `keys:write`, and not this key. */
|
|
1532
1558
|
setAccess: (id, access) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
|
|
1533
1559
|
method: "PATCH",
|
|
1534
1560
|
body: { access }
|
|
1535
1561
|
}),
|
|
1562
|
+
/** Full access, Read everything or Limited (`full`, `read_all`, `limited`), afterwards. */
|
|
1563
|
+
setPreset: (id, preset) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
|
|
1564
|
+
method: "PATCH",
|
|
1565
|
+
body: { preset }
|
|
1566
|
+
}),
|
|
1567
|
+
/** A Limited key with exactly these permissions (replaces its list). */
|
|
1568
|
+
setGrants: (id, grants) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
|
|
1569
|
+
method: "PATCH",
|
|
1570
|
+
body: { grants }
|
|
1571
|
+
}),
|
|
1572
|
+
/** Every permission a Limited key can be given, with its plain-words label. */
|
|
1573
|
+
permissions: () => this.request("/api-keys/permissions").then((r) => r.data),
|
|
1536
1574
|
revoke: (id) => this.request(`/api-keys/${id}`, { method: "DELETE" })
|
|
1537
1575
|
};
|
|
1538
1576
|
/** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
|
|
@@ -1703,7 +1741,7 @@ function deployPathProblem(path) {
|
|
|
1703
1741
|
return "looks like a credential (a private key or a token file), which is never deployed";
|
|
1704
1742
|
if (PRIVATE_DIRS.includes(part)) return `is inside ${part}, a home or config folder`;
|
|
1705
1743
|
if (IGNORED.has(part))
|
|
1706
|
-
return part === "vibiz.json" ? "is vibiz.json, the local link to the project, which is never deployed" : `is inside ${part}, which is never deployed (dependencies, VCS data or build output:
|
|
1744
|
+
return part === "vibiz.json" ? "is vibiz.json, the local link to the project, which is never deployed" : `is inside ${part}, which is never deployed (dependencies, VCS data or build output: thelastapi installs and builds the app itself)`;
|
|
1707
1745
|
}
|
|
1708
1746
|
return null;
|
|
1709
1747
|
}
|
|
@@ -1943,14 +1981,14 @@ function formatMinor(minor, currency) {
|
|
|
1943
1981
|
}
|
|
1944
1982
|
|
|
1945
1983
|
// packages/sdk/src/one-key.ts
|
|
1946
|
-
var APP_SDK_VERSION = "0.3.
|
|
1984
|
+
var APP_SDK_VERSION = "0.3.14";
|
|
1947
1985
|
var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
1948
1986
|
function oneKeyMessage(url, host) {
|
|
1949
1987
|
const where = host ?? "your host";
|
|
1950
|
-
return `Add one key to ${where} and your app can use everything on
|
|
1988
|
+
return `Add one key to ${where} and your app can use everything on thelastapi (${ONE_KEY_GIVES}): copy VIBIZ_APP_KEY here: ${url} , paste it into ${host ? `${host}'s` : "your host's"} production environment variables, and redeploy.`;
|
|
1951
1989
|
}
|
|
1952
1990
|
function connectHostMessage(kind, host) {
|
|
1953
|
-
return `Or connect ${host ?? "the host"} once (vibiz hosts add ${kind ?? "<host>"} <app>) and
|
|
1991
|
+
return `Or connect ${host ?? "the host"} once (vibiz hosts add ${kind ?? "<host>"} <app>) and thelastapi keeps every variable in sync.`;
|
|
1954
1992
|
}
|
|
1955
1993
|
|
|
1956
1994
|
export {
|