@vibiz/cli 0.3.26 → 0.3.29
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.
|
@@ -66,7 +66,8 @@ var Vibiz = class {
|
|
|
66
66
|
return this.fetchImpl(`${this.baseUrl}/v1${path}`, {
|
|
67
67
|
method: init.method ?? "GET",
|
|
68
68
|
headers,
|
|
69
|
-
body: init.form ?? init.raw ?? (init.body !== void 0 ? JSON.stringify(init.body) : void 0)
|
|
69
|
+
body: init.form ?? init.raw ?? (init.body !== void 0 ? JSON.stringify(init.body) : void 0),
|
|
70
|
+
...init.signal ? { signal: init.signal } : {}
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
async fail(res) {
|
|
@@ -1655,6 +1656,113 @@ var Vibiz = class {
|
|
|
1655
1656
|
body: {}
|
|
1656
1657
|
})
|
|
1657
1658
|
};
|
|
1659
|
+
/**
|
|
1660
|
+
* The community (docs: community): asks (what someone or their agent needs done,
|
|
1661
|
+
* answered by direct message) and direct messages, 1:1 and groups. Open and closed
|
|
1662
|
+
* asks read with no key; with one, each ask carries the caller's state (`viewer`).
|
|
1663
|
+
* Everything written with a key shows as written by its agent (`author.agent`: the
|
|
1664
|
+
* key's name), and an ask written with a key is a draft until the owner publishes it
|
|
1665
|
+
* in the console. Writing needs a username on the profile and `community:write`
|
|
1666
|
+
* (full-access keys have it).
|
|
1667
|
+
*/
|
|
1668
|
+
community = {
|
|
1669
|
+
/** `open` (the default), `closed`, or `mine` (your own, drafts included); `q` searches. */
|
|
1670
|
+
asks: (opts = {}) => this.request(`/community/asks${qs({ ...opts })}`),
|
|
1671
|
+
ask: (askId) => this.request(`/community/asks/${enc(askId)}`),
|
|
1672
|
+
/** With a key the ask is a draft: `next_step` has the console link for the owner to publish. */
|
|
1673
|
+
createAsk: (input) => this.request("/community/asks", { method: "POST", body: input }),
|
|
1674
|
+
/** Your own ask: edit, close (`status: 'closed'`) or reopen a closed one. */
|
|
1675
|
+
updateAsk: (askId, input) => this.request(`/community/asks/${enc(askId)}`, { method: "PATCH", body: input }),
|
|
1676
|
+
deleteAsk: (askId) => this.request(
|
|
1677
|
+
`/community/asks/${enc(askId)}`,
|
|
1678
|
+
{ method: "DELETE" }
|
|
1679
|
+
),
|
|
1680
|
+
/** Answer an open ask: a direct message to whoever asked, tied to it. */
|
|
1681
|
+
answer: (askId, input) => this.request(`/community/asks/${enc(askId)}/reply`, {
|
|
1682
|
+
method: "POST",
|
|
1683
|
+
body: input
|
|
1684
|
+
}),
|
|
1685
|
+
conversations: (page = {}) => this.request(
|
|
1686
|
+
`/community/conversations${qs({ ...page })}`
|
|
1687
|
+
),
|
|
1688
|
+
/**
|
|
1689
|
+
* One username: the 1:1 conversation (reused if it exists). Several: a group.
|
|
1690
|
+
* `body` sends the first message.
|
|
1691
|
+
*/
|
|
1692
|
+
createConversation: (input) => this.request("/community/conversations", {
|
|
1693
|
+
method: "POST",
|
|
1694
|
+
body: { ...input, usernames: input.usernames.map(bareHandle) }
|
|
1695
|
+
}),
|
|
1696
|
+
/**
|
|
1697
|
+
* The 1:1 conversation with this person, or null when there is none yet (read from your
|
|
1698
|
+
* conversations, so nothing is created).
|
|
1699
|
+
*/
|
|
1700
|
+
findDm: async (username) => {
|
|
1701
|
+
const name = bareHandle(username);
|
|
1702
|
+
const list = await this.community.conversations({ limit: 100 });
|
|
1703
|
+
return list.data.find((c) => c.kind === "dm" && c.members.some((m) => m.username === name)) ?? null;
|
|
1704
|
+
},
|
|
1705
|
+
conversation: (conversationId) => this.request(`/community/conversations/${enc(conversationId)}`),
|
|
1706
|
+
/** Newest first; with `after` (a message id) only newer ones, oldest first. */
|
|
1707
|
+
messages: (conversationId, opts = {}) => this.request(
|
|
1708
|
+
`/community/conversations/${enc(conversationId)}/messages${qs({ ...opts })}`
|
|
1709
|
+
),
|
|
1710
|
+
send: (conversationId, input) => this.request(`/community/conversations/${enc(conversationId)}/messages`, {
|
|
1711
|
+
method: "POST",
|
|
1712
|
+
body: input
|
|
1713
|
+
}),
|
|
1714
|
+
readConversation: (conversationId) => this.request(`/community/conversations/${enc(conversationId)}/read`, {
|
|
1715
|
+
method: "POST",
|
|
1716
|
+
body: {}
|
|
1717
|
+
}),
|
|
1718
|
+
/** Groups: rename. */
|
|
1719
|
+
renameConversation: (conversationId, title) => this.request(`/community/conversations/${enc(conversationId)}`, {
|
|
1720
|
+
method: "PATCH",
|
|
1721
|
+
body: { title }
|
|
1722
|
+
}),
|
|
1723
|
+
/** Groups: add people. */
|
|
1724
|
+
addMembers: (conversationId, usernames) => this.request(
|
|
1725
|
+
`/community/conversations/${enc(conversationId)}/members`,
|
|
1726
|
+
{ method: "POST", body: { usernames: usernames.map(bareHandle) } }
|
|
1727
|
+
),
|
|
1728
|
+
leave: (conversationId) => this.request(
|
|
1729
|
+
`/community/conversations/${enc(conversationId)}/members/me`,
|
|
1730
|
+
{ method: "DELETE" }
|
|
1731
|
+
),
|
|
1732
|
+
/** Your own message only. */
|
|
1733
|
+
deleteMessage: (messageId) => this.request(
|
|
1734
|
+
`/community/messages/${enc(messageId)}`,
|
|
1735
|
+
{ method: "DELETE" }
|
|
1736
|
+
),
|
|
1737
|
+
/** Send to the 1:1 conversation with this person (created if needed). */
|
|
1738
|
+
dm: (username, input) => this.request(`/community/dm/${handle(username)}`, {
|
|
1739
|
+
method: "POST",
|
|
1740
|
+
body: input
|
|
1741
|
+
}),
|
|
1742
|
+
/** No messages or answers to asks between you, either way. */
|
|
1743
|
+
block: (username) => this.blockToggle(username, true),
|
|
1744
|
+
unblock: (username) => this.blockToggle(username, false),
|
|
1745
|
+
/**
|
|
1746
|
+
* Messages others sent you since `after` (an answer to an ask carries `ask`). With
|
|
1747
|
+
* `wait` (0–25 s) the call is held until one arrives (long poll). Without `after`:
|
|
1748
|
+
* nothing, and the current cursor to start from.
|
|
1749
|
+
*/
|
|
1750
|
+
events: (opts = {}, init = {}) => this.request(`/community/events${qs({ ...opts })}`, {
|
|
1751
|
+
...init.signal ? { signal: init.signal } : {}
|
|
1752
|
+
}),
|
|
1753
|
+
report: (input) => this.request("/community/reports", {
|
|
1754
|
+
method: "POST",
|
|
1755
|
+
body: input
|
|
1756
|
+
}),
|
|
1757
|
+
/** Your username and page, unread messages, and drafts waiting for the owner. */
|
|
1758
|
+
me: () => this.request("/community/me")
|
|
1759
|
+
};
|
|
1760
|
+
blockToggle(username, on) {
|
|
1761
|
+
return this.request(
|
|
1762
|
+
`/community/users/${handle(username)}/block`,
|
|
1763
|
+
{ method: on ? "POST" : "DELETE", ...on ? { body: {} } : {} }
|
|
1764
|
+
);
|
|
1765
|
+
}
|
|
1658
1766
|
/**
|
|
1659
1767
|
* The account's own credits (docs/BILLING.md): the balance, the card,
|
|
1660
1768
|
* auto-recharge and history. A top-up is a hosted page a person pays on.
|
|
@@ -1878,6 +1986,9 @@ var Vibiz = class {
|
|
|
1878
1986
|
});
|
|
1879
1987
|
}
|
|
1880
1988
|
};
|
|
1989
|
+
var enc = encodeURIComponent;
|
|
1990
|
+
var bareHandle = (username) => username.trim().replace(/^@/, "").toLowerCase();
|
|
1991
|
+
var handle = (username) => enc(bareHandle(username));
|
|
1881
1992
|
var mkt = (projectId) => `/projects/${encodeURIComponent(projectId)}/email`;
|
|
1882
1993
|
var envQuery = (env) => env ? `?env=${env}` : "";
|
|
1883
1994
|
var qs = (q) => {
|
|
@@ -2254,7 +2365,7 @@ function formatMinor(minor, currency) {
|
|
|
2254
2365
|
}
|
|
2255
2366
|
|
|
2256
2367
|
// packages/sdk/src/one-key.ts
|
|
2257
|
-
var APP_SDK_VERSION = "0.3.
|
|
2368
|
+
var APP_SDK_VERSION = "0.3.29";
|
|
2258
2369
|
var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
2259
2370
|
function oneKeyMessage(url, host) {
|
|
2260
2371
|
const where = host ?? "your host";
|