@vibiz/cli 0.3.23 → 0.3.25
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
|
|
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
|
-
|
|
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,
|
|
@@ -853,7 +857,33 @@ var Vibiz = class {
|
|
|
853
857
|
/** Visitors, pageviews, top pages, sources, countries, events and a timeseries. */
|
|
854
858
|
get: (projectId, opts = {}) => this.request(
|
|
855
859
|
`/projects/${projectId}/analytics?period=${opts.period ?? "7d"}`
|
|
856
|
-
)
|
|
860
|
+
),
|
|
861
|
+
/**
|
|
862
|
+
* Visitor journeys, newest first: each visitor-day's source, landing page,
|
|
863
|
+
* pages in order, events, and whether it converted (a sale or a goal event).
|
|
864
|
+
*/
|
|
865
|
+
visitors: (projectId, opts = {}) => {
|
|
866
|
+
const q = new URLSearchParams();
|
|
867
|
+
q.set("period", opts.period ?? "7d");
|
|
868
|
+
if (opts.source) q.set("source", opts.source);
|
|
869
|
+
if (opts.landing) q.set("landing", opts.landing);
|
|
870
|
+
if (opts.country) q.set("country", opts.country);
|
|
871
|
+
if (opts.converted) q.set("converted", "true");
|
|
872
|
+
if (opts.goals?.length) q.set("goals", opts.goals.join(","));
|
|
873
|
+
if (opts.limit) q.set("limit", String(opts.limit));
|
|
874
|
+
if (opts.cursor) q.set("cursor", opts.cursor);
|
|
875
|
+
return this.request(`/projects/${projectId}/analytics/visitors?${q}`);
|
|
876
|
+
},
|
|
877
|
+
/** One visitor's path on one UTC day: the timeline, its replays and the sales it led to. */
|
|
878
|
+
visitor: (projectId, visitorId, opts = {}) => {
|
|
879
|
+
const q = new URLSearchParams();
|
|
880
|
+
if (opts.day) q.set("day", opts.day);
|
|
881
|
+
if (opts.goals?.length) q.set("goals", opts.goals.join(","));
|
|
882
|
+
const qs2 = q.size ? `?${q}` : "";
|
|
883
|
+
return this.request(
|
|
884
|
+
`/projects/${projectId}/analytics/visitors/${encodeURIComponent(visitorId)}${qs2}`
|
|
885
|
+
);
|
|
886
|
+
}
|
|
857
887
|
};
|
|
858
888
|
/**
|
|
859
889
|
* Mission Control (docs: Mission Control and health checks): every business
|
|
@@ -1766,6 +1796,48 @@ var Vibiz = class {
|
|
|
1766
1796
|
{ method: "POST", body }
|
|
1767
1797
|
)
|
|
1768
1798
|
};
|
|
1799
|
+
/**
|
|
1800
|
+
* The Library (docs: library): the account's (no `project_id`) or a
|
|
1801
|
+
* project's folders and text files (scripts, agent skills, notes). Stored
|
|
1802
|
+
* only: nothing in it runs or is public. Writing a file makes its folders.
|
|
1803
|
+
*/
|
|
1804
|
+
library = {
|
|
1805
|
+
/** One folder's entries (`recursive`: everything below it), with sizes, no text. */
|
|
1806
|
+
list: (opts = {}) => this.request(
|
|
1807
|
+
`/library${qs({
|
|
1808
|
+
project_id: opts.project_id,
|
|
1809
|
+
path: opts.path,
|
|
1810
|
+
recursive: opts.recursive ? "1" : void 0
|
|
1811
|
+
})}`
|
|
1812
|
+
),
|
|
1813
|
+
/** One file, with its `content`. */
|
|
1814
|
+
read: (path, opts = {}) => this.request(`/library/file${qs({ project_id: opts.project_id, path })}`),
|
|
1815
|
+
/** Creates or overwrites a file (`create_only`: refuse an existing one). */
|
|
1816
|
+
write: (body) => this.request("/library/file", {
|
|
1817
|
+
method: "PUT",
|
|
1818
|
+
body
|
|
1819
|
+
}),
|
|
1820
|
+
/** Makes a folder and the ones above it; an existing folder is fine. */
|
|
1821
|
+
mkdir: (path, opts = {}) => this.request("/library/folders", {
|
|
1822
|
+
method: "POST",
|
|
1823
|
+
body: { path, ...opts.project_id ? { project_id: opts.project_id } : {} }
|
|
1824
|
+
}),
|
|
1825
|
+
/** Moves or renames (a folder takes what is in it); `overwrite` replaces what is at `to`. */
|
|
1826
|
+
move: (body) => this.request("/library/move", { method: "POST", body }),
|
|
1827
|
+
/** Deletes a file or folder; a folder that isn't empty needs `recursive`. */
|
|
1828
|
+
delete: (path, opts = {}) => this.request(
|
|
1829
|
+
`/library${qs({
|
|
1830
|
+
project_id: opts.project_id,
|
|
1831
|
+
path,
|
|
1832
|
+
recursive: opts.recursive ? "1" : void 0
|
|
1833
|
+
})}`,
|
|
1834
|
+
{ method: "DELETE" }
|
|
1835
|
+
),
|
|
1836
|
+
/** Many files into one folder at once (a skill's folder); replaces existing files unless `overwrite: false`. */
|
|
1837
|
+
import: (body) => this.request("/library/import", { method: "POST", body }),
|
|
1838
|
+
/** A folder (or one file) back as files, paths relative to it. */
|
|
1839
|
+
export: (path = "", opts = {}) => this.request(`/library/export${qs({ project_id: opts.project_id, path })}`)
|
|
1840
|
+
};
|
|
1769
1841
|
/** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
|
|
1770
1842
|
dashboard = {
|
|
1771
1843
|
link: (opts = {}) => this.request("/dashboard/link", { method: "POST", body: opts })
|
|
@@ -1787,6 +1859,14 @@ var Vibiz = class {
|
|
|
1787
1859
|
capabilities() {
|
|
1788
1860
|
return this.request("/capabilities");
|
|
1789
1861
|
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Tell the thelastapi team something: a capability that's missing, an error
|
|
1864
|
+
* that didn't say how to fix it, docs that were wrong. The team reads every
|
|
1865
|
+
* report. `user_quote` only with the person's agreement.
|
|
1866
|
+
*/
|
|
1867
|
+
feedback(input) {
|
|
1868
|
+
return this.request("/feedback", { method: "POST", body: input });
|
|
1869
|
+
}
|
|
1790
1870
|
/** The account and key this client acts as. */
|
|
1791
1871
|
whoami() {
|
|
1792
1872
|
return this.request("/whoami");
|
|
@@ -2174,7 +2254,7 @@ function formatMinor(minor, currency) {
|
|
|
2174
2254
|
}
|
|
2175
2255
|
|
|
2176
2256
|
// packages/sdk/src/one-key.ts
|
|
2177
|
-
var APP_SDK_VERSION = "0.3.
|
|
2257
|
+
var APP_SDK_VERSION = "0.3.25";
|
|
2178
2258
|
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
2259
|
function oneKeyMessage(url, host) {
|
|
2180
2260
|
const where = host ?? "your host";
|