@vibiz/cli 0.3.23 → 0.3.24

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.
@@ -52,13 +52,17 @@ var Vibiz = class {
52
52
  baseUrl;
53
53
  fetchImpl;
54
54
  async send(path, init = {}) {
55
- const headers = { authorization: `Bearer ${this.options.apiKey}` };
55
+ const extra = this.options.headers;
56
+ const headers = {
57
+ ...typeof extra === "function" ? extra() : extra,
58
+ authorization: `Bearer ${this.options.apiKey}`
59
+ };
56
60
  if (init.body !== void 0) headers["content-type"] = "application/json";
57
61
  if (init.raw) headers["content-type"] = init.contentType ?? "application/octet-stream";
58
62
  if (init.idempotencyKey) headers["idempotency-key"] = init.idempotencyKey;
59
63
  if (init.project) headers["x-vibiz-project"] = init.project;
60
64
  if (this.options.user) headers["x-vibiz-user"] = endUserHeader(this.options.user);
61
- if (this.options.client) headers["x-vibiz-client"] = this.options.client;
65
+ headers["x-vibiz-client"] = this.options.client ?? "vibiz-sdk";
62
66
  return this.fetchImpl(`${this.baseUrl}/v1${path}`, {
63
67
  method: init.method ?? "GET",
64
68
  headers,
@@ -1766,6 +1770,48 @@ var Vibiz = class {
1766
1770
  { method: "POST", body }
1767
1771
  )
1768
1772
  };
1773
+ /**
1774
+ * The Library (docs: library): the account's (no `project_id`) or a
1775
+ * project's folders and text files (scripts, agent skills, notes). Stored
1776
+ * only: nothing in it runs or is public. Writing a file makes its folders.
1777
+ */
1778
+ library = {
1779
+ /** One folder's entries (`recursive`: everything below it), with sizes, no text. */
1780
+ list: (opts = {}) => this.request(
1781
+ `/library${qs({
1782
+ project_id: opts.project_id,
1783
+ path: opts.path,
1784
+ recursive: opts.recursive ? "1" : void 0
1785
+ })}`
1786
+ ),
1787
+ /** One file, with its `content`. */
1788
+ read: (path, opts = {}) => this.request(`/library/file${qs({ project_id: opts.project_id, path })}`),
1789
+ /** Creates or overwrites a file (`create_only`: refuse an existing one). */
1790
+ write: (body) => this.request("/library/file", {
1791
+ method: "PUT",
1792
+ body
1793
+ }),
1794
+ /** Makes a folder and the ones above it; an existing folder is fine. */
1795
+ mkdir: (path, opts = {}) => this.request("/library/folders", {
1796
+ method: "POST",
1797
+ body: { path, ...opts.project_id ? { project_id: opts.project_id } : {} }
1798
+ }),
1799
+ /** Moves or renames (a folder takes what is in it); `overwrite` replaces what is at `to`. */
1800
+ move: (body) => this.request("/library/move", { method: "POST", body }),
1801
+ /** Deletes a file or folder; a folder that isn't empty needs `recursive`. */
1802
+ delete: (path, opts = {}) => this.request(
1803
+ `/library${qs({
1804
+ project_id: opts.project_id,
1805
+ path,
1806
+ recursive: opts.recursive ? "1" : void 0
1807
+ })}`,
1808
+ { method: "DELETE" }
1809
+ ),
1810
+ /** Many files into one folder at once (a skill's folder); replaces existing files unless `overwrite: false`. */
1811
+ import: (body) => this.request("/library/import", { method: "POST", body }),
1812
+ /** A folder (or one file) back as files, paths relative to it. */
1813
+ export: (path = "", opts = {}) => this.request(`/library/export${qs({ project_id: opts.project_id, path })}`)
1814
+ };
1769
1815
  /** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
1770
1816
  dashboard = {
1771
1817
  link: (opts = {}) => this.request("/dashboard/link", { method: "POST", body: opts })
@@ -1787,6 +1833,14 @@ var Vibiz = class {
1787
1833
  capabilities() {
1788
1834
  return this.request("/capabilities");
1789
1835
  }
1836
+ /**
1837
+ * Tell the thelastapi team something: a capability that's missing, an error
1838
+ * that didn't say how to fix it, docs that were wrong. The team reads every
1839
+ * report. `user_quote` only with the person's agreement.
1840
+ */
1841
+ feedback(input) {
1842
+ return this.request("/feedback", { method: "POST", body: input });
1843
+ }
1790
1844
  /** The account and key this client acts as. */
1791
1845
  whoami() {
1792
1846
  return this.request("/whoami");
@@ -2174,7 +2228,7 @@ function formatMinor(minor, currency) {
2174
2228
  }
2175
2229
 
2176
2230
  // packages/sdk/src/one-key.ts
2177
- var APP_SDK_VERSION = "0.3.23";
2231
+ var APP_SDK_VERSION = "0.3.24";
2178
2232
  var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
2179
2233
  function oneKeyMessage(url, host) {
2180
2234
  const where = host ?? "your host";