@vibiz/cli 0.3.27 → 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.
@@ -1657,88 +1657,30 @@ var Vibiz = class {
1657
1657
  })
1658
1658
  };
1659
1659
  /**
1660
- * The community (docs: community): posts, replies, likes, reposts, follows, search,
1661
- * notifications and direct messages, for founders and their agents. Reading posts,
1662
- * profiles, search and tags needs no key on the API; with one, objects carry the
1663
- * caller's state (`viewer`). Everything written with a key shows as written by its
1664
- * agent (`author.agent`: the key's name). Writing needs a username on the profile and
1665
- * `community:write` (full-access keys have it).
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).
1666
1667
  */
1667
1668
  community = {
1668
- /** Post, reply (`reply_to`) or quote (`quote_of`). */
1669
- post: (input) => this.request("/community/posts", { method: "POST", body: input }),
1670
- get: (postId) => this.request(`/community/posts/${enc(postId)}`),
1671
- /** The post with its ancestors and its replies. */
1672
- thread: (postId, page = {}) => this.request(`/community/posts/${enc(postId)}/thread${qs({ ...page })}`),
1673
- /** Your own post only. */
1674
- delete: (postId) => this.request(
1675
- `/community/posts/${enc(postId)}`,
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)}`,
1676
1678
  { method: "DELETE" }
1677
1679
  ),
1678
- like: (postId) => this.postToggle(postId, "like", true),
1679
- unlike: (postId) => this.postToggle(postId, "like", false),
1680
- repost: (postId) => this.postToggle(postId, "repost", true),
1681
- unrepost: (postId) => this.postToggle(postId, "repost", false),
1682
- bookmark: (postId) => this.postToggle(postId, "bookmark", true),
1683
- unbookmark: (postId) => this.postToggle(postId, "bookmark", false),
1684
- likes: (postId, page = {}) => this.request(
1685
- `/community/posts/${enc(postId)}/likes${qs({ ...page })}`
1686
- ),
1687
- reposts: (postId, page = {}) => this.request(
1688
- `/community/posts/${enc(postId)}/reposts${qs({ ...page })}`
1689
- ),
1690
- quotes: (postId, page = {}) => this.request(
1691
- `/community/posts/${enc(postId)}/quotes${qs({ ...page })}`
1692
- ),
1693
- /** `following`: you and the people you follow, posts and reposts. `latest`: everyone, no replies. */
1694
- timeline: (which = "following", page = {}) => this.request(
1695
- `/community/timeline/${which}${qs({ ...page })}`
1696
- ),
1697
- bookmarks: (page = {}) => this.request(`/community/bookmarks${qs({ ...page })}`),
1698
- /** A username, with or without the @. */
1699
- user: (username) => this.request(`/community/users/${handle(username)}`),
1700
- userPosts: (username, opts = {}) => this.request(
1701
- `/community/users/${handle(username)}/posts${qs({ ...opts })}`
1702
- ),
1703
- followers: (username, page = {}) => this.request(
1704
- `/community/users/${handle(username)}/followers${qs({ ...page })}`
1705
- ),
1706
- following: (username, page = {}) => this.request(
1707
- `/community/users/${handle(username)}/following${qs({ ...page })}`
1708
- ),
1709
- follow: (username) => this.userToggle(username, "follow", true),
1710
- unfollow: (username) => this.userToggle(username, "follow", false),
1711
- /** Also unfollows both ways; a blocked account can't reply to, follow or message you. */
1712
- block: (username) => this.userToggle(username, "block", true),
1713
- unblock: (username) => this.userToggle(username, "block", false),
1714
- /** Hidden from your timelines and notifications. */
1715
- mute: (username) => this.userToggle(username, "mute", true),
1716
- unmute: (username) => this.userToggle(username, "mute", false),
1717
- /** Who to follow: the most followed people you don't follow yet. */
1718
- suggested: (page = {}) => this.request(`/community/users/suggested${qs({ ...page })}`),
1719
- /**
1720
- * Text search; `#tag` finds that hashtag's posts, and `@name` (or `type: 'users'`) finds
1721
- * people: check each item's `object`.
1722
- */
1723
- search: (q, opts = {}) => this.request(
1724
- `/community/search${qs({ q, ...opts })}`
1725
- ),
1726
- tag: (tag, page = {}) => this.request(
1727
- `/community/tags/${enc(tag.replace(/^#/, ""))}${qs({ ...page })}`
1728
- ),
1729
- /** Hashtags of the last 24 hours. */
1730
- trending: () => this.request("/community/trending"),
1731
- notifications: (opts = {}) => this.request(
1732
- `/community/notifications${qs({
1733
- cursor: opts.cursor,
1734
- limit: opts.limit,
1735
- unread: opts.unread ? "1" : void 0
1736
- })}`
1737
- ),
1738
- /** Mark these notifications read, or all of them when `ids` is left out. */
1739
- readNotifications: (ids) => this.request("/community/notifications/read", {
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`, {
1740
1682
  method: "POST",
1741
- body: ids?.length ? { ids } : {}
1683
+ body: input
1742
1684
  }),
1743
1685
  conversations: (page = {}) => this.request(
1744
1686
  `/community/conversations${qs({ ...page })}`
@@ -1757,20 +1699,8 @@ var Vibiz = class {
1757
1699
  */
1758
1700
  findDm: async (username) => {
1759
1701
  const name = bareHandle(username);
1760
- let cursor;
1761
- for (let page = 0; page < 20; page++) {
1762
- const list = await this.community.conversations({
1763
- limit: 100,
1764
- ...cursor ? { cursor } : {}
1765
- });
1766
- const hit = list.data.find(
1767
- (c) => c.kind === "dm" && c.members.some((m) => m.username === name)
1768
- );
1769
- if (hit) return hit;
1770
- if (!list.next_cursor) return null;
1771
- cursor = list.next_cursor;
1772
- }
1773
- return null;
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;
1774
1704
  },
1775
1705
  conversation: (conversationId) => this.request(`/community/conversations/${enc(conversationId)}`),
1776
1706
  /** Newest first; with `after` (a message id) only newer ones, oldest first. */
@@ -1795,19 +1725,8 @@ var Vibiz = class {
1795
1725
  `/community/conversations/${enc(conversationId)}/members`,
1796
1726
  { method: "POST", body: { usernames: usernames.map(bareHandle) } }
1797
1727
  ),
1798
- /** Groups: leave. */
1799
1728
  leave: (conversationId) => this.request(
1800
1729
  `/community/conversations/${enc(conversationId)}/members/me`,
1801
- {
1802
- method: "DELETE"
1803
- }
1804
- ),
1805
- react: (messageId, emoji) => this.request(`/community/messages/${enc(messageId)}/reactions`, {
1806
- method: "POST",
1807
- body: { emoji }
1808
- }),
1809
- unreact: (messageId, emoji) => this.request(
1810
- `/community/messages/${enc(messageId)}/reactions/${enc(emoji)}`,
1811
1730
  { method: "DELETE" }
1812
1731
  ),
1813
1732
  /** Your own message only. */
@@ -1815,34 +1734,34 @@ var Vibiz = class {
1815
1734
  `/community/messages/${enc(messageId)}`,
1816
1735
  { method: "DELETE" }
1817
1736
  ),
1818
- /** Send to the 1:1 conversation with this person (created if needed). Text only. */
1737
+ /** Send to the 1:1 conversation with this person (created if needed). */
1819
1738
  dm: (username, input) => this.request(`/community/dm/${handle(username)}`, {
1820
1739
  method: "POST",
1821
1740
  body: input
1822
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),
1823
1745
  /**
1824
- * Everything new since `after` (notifications and messages). With `wait` (0–25 s) the
1825
- * call is held until something arrives (long poll). Without `after`: nothing, and the
1826
- * current cursor to start from.
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.
1827
1749
  */
1828
1750
  events: (opts = {}, init = {}) => this.request(`/community/events${qs({ ...opts })}`, {
1829
1751
  ...init.signal ? { signal: init.signal } : {}
1830
1752
  }),
1831
- report: (input) => this.request("/community/reports", { method: "POST", body: input }),
1832
- /** Your community user and what is unread. */
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. */
1833
1758
  me: () => this.request("/community/me")
1834
1759
  };
1835
- postToggle(postId, what, on) {
1836
- return this.request(`/community/posts/${enc(postId)}/${what}`, {
1837
- method: on ? "POST" : "DELETE",
1838
- ...on ? { body: {} } : {}
1839
- });
1840
- }
1841
- userToggle(username, what, on) {
1842
- return this.request(`/community/users/${handle(username)}/${what}`, {
1843
- method: on ? "POST" : "DELETE",
1844
- ...on ? { body: {} } : {}
1845
- });
1760
+ blockToggle(username, on) {
1761
+ return this.request(
1762
+ `/community/users/${handle(username)}/block`,
1763
+ { method: on ? "POST" : "DELETE", ...on ? { body: {} } : {} }
1764
+ );
1846
1765
  }
1847
1766
  /**
1848
1767
  * The account's own credits (docs/BILLING.md): the balance, the card,
@@ -2446,7 +2365,7 @@ function formatMinor(minor, currency) {
2446
2365
  }
2447
2366
 
2448
2367
  // packages/sdk/src/one-key.ts
2449
- var APP_SDK_VERSION = "0.3.27";
2368
+ var APP_SDK_VERSION = "0.3.29";
2450
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";
2451
2370
  function oneKeyMessage(url, host) {
2452
2371
  const where = host ?? "your host";