@vibiz/cli 0.3.9 → 0.3.12

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.
@@ -22,6 +22,21 @@ 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 {
@@ -862,6 +877,14 @@ var Vibiz = class {
862
877
  method: "POST",
863
878
  body: { api_key: apiKey }
864
879
  }),
880
+ /**
881
+ * Owner: push pages Google hasn't crawled yet to Google's Indexing API
882
+ * (off by default; up to 200 a day per Google Cloud project).
883
+ */
884
+ setGooglePush: (enabled) => this.request("/search/settings", {
885
+ method: "PATCH",
886
+ body: { google_push: enabled }
887
+ }),
865
888
  /** Owner: disconnect a Google account or the Bing key. */
866
889
  disconnect: (id) => this.request(
867
890
  `/search/connections/${id}`,
@@ -1522,17 +1545,31 @@ var Vibiz = class {
1522
1545
  /**
1523
1546
  * The secret is returned once, here. Full access (`owner`) by default;
1524
1547
  * `access: 'agent'` makes it Limited (builds and runs, never reads
1525
- * production secrets nor moves live money). Needs a full-access key.
1548
+ * production secrets nor moves live money), `preset: 'read_all'` Limited
1549
+ * that reads everything, `grants` Limited with those permissions
1550
+ * (`permissions()`). A Limited caller never gives more than it has.
1526
1551
  */
1527
1552
  create: (name, opts = {}) => this.request("/api-keys", {
1528
1553
  method: "POST",
1529
- body: { name, ...opts.access ? { access: opts.access } : {} }
1554
+ body: { name, ...opts }
1530
1555
  }),
1531
- /** Full access (`owner`) or Limited (`agent`), afterwards. Needs a full-access key, not this one. */
1556
+ /** Full access (`owner`) or Limited (`agent`), afterwards. Needs `keys:write`, and not this key. */
1532
1557
  setAccess: (id, access) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
1533
1558
  method: "PATCH",
1534
1559
  body: { access }
1535
1560
  }),
1561
+ /** Full access, Read everything or Limited (`full`, `read_all`, `limited`), afterwards. */
1562
+ setPreset: (id, preset) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
1563
+ method: "PATCH",
1564
+ body: { preset }
1565
+ }),
1566
+ /** A Limited key with exactly these permissions (replaces its list). */
1567
+ setGrants: (id, grants) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
1568
+ method: "PATCH",
1569
+ body: { grants }
1570
+ }),
1571
+ /** Every permission a Limited key can be given, with its plain-words label. */
1572
+ permissions: () => this.request("/api-keys/permissions").then((r) => r.data),
1536
1573
  revoke: (id) => this.request(`/api-keys/${id}`, { method: "DELETE" })
1537
1574
  };
1538
1575
  /** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
@@ -1943,7 +1980,7 @@ function formatMinor(minor, currency) {
1943
1980
  }
1944
1981
 
1945
1982
  // packages/sdk/src/one-key.ts
1946
- var APP_SDK_VERSION = "0.3.9";
1983
+ var APP_SDK_VERSION = "0.3.12";
1947
1984
  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
1985
  function oneKeyMessage(url, host) {
1949
1986
  const where = host ?? "your host";