@arbidocs/sdk 0.4.86 → 0.4.87

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.
package/dist/browser.cjs CHANGED
@@ -4730,6 +4730,7 @@ __export(workspaces_exports, {
4730
4730
  copyDocuments: () => copyDocuments,
4731
4731
  createWorkspace: () => createWorkspace,
4732
4732
  deleteWorkspaces: () => deleteWorkspaces,
4733
+ getWorkspaceActivity: () => getWorkspaceActivity,
4733
4734
  grantTemporaryWorkspaceAccess: () => grantTemporaryWorkspaceAccess,
4734
4735
  listWorkspaceUsers: () => listWorkspaceUsers,
4735
4736
  listWorkspaces: () => listWorkspaces,
@@ -4826,6 +4827,17 @@ async function copyDocuments(arbi, targetWorkspaceId, docIds, targetWorkspaceKey
4826
4827
  "Failed to copy documents"
4827
4828
  );
4828
4829
  }
4830
+ async function getWorkspaceActivity(arbi, workspaceExtId, options = {}) {
4831
+ return requireData(
4832
+ await arbi.fetch.GET("/v1/workspace/{workspace_ext_id}/activity", {
4833
+ params: {
4834
+ path: { workspace_ext_id: workspaceExtId },
4835
+ query: { cursor: options.cursor ?? void 0, limit: options.limit }
4836
+ }
4837
+ }),
4838
+ "Failed to fetch workspace activity"
4839
+ );
4840
+ }
4829
4841
 
4830
4842
  // src/operations/conversations.ts
4831
4843
  var conversations_exports = {};
@@ -5808,7 +5820,12 @@ async function deleteDMs(arbi, messageIds) {
5808
5820
  var settings_exports = {};
5809
5821
  __export(settings_exports, {
5810
5822
  getSettings: () => getSettings,
5811
- updateSettings: () => updateSettings
5823
+ setListMembership: () => setListMembership,
5824
+ setWorkspaceNotificationLevel: () => setWorkspaceNotificationLevel,
5825
+ updateSettings: () => updateSettings,
5826
+ withMembership: () => withMembership,
5827
+ workspaceLevelPatch: () => workspaceLevelPatch,
5828
+ workspaceNotificationLevel: () => workspaceNotificationLevel
5812
5829
  });
5813
5830
  async function getSettings(arbi) {
5814
5831
  return requireData(await arbi.fetch.GET("/v1/user/settings"), "Failed to fetch settings");
@@ -5816,6 +5833,36 @@ async function getSettings(arbi) {
5816
5833
  async function updateSettings(arbi, body) {
5817
5834
  requireOk(await arbi.fetch.PATCH("/v1/user/settings", { body }), "Failed to update settings");
5818
5835
  }
5836
+ function withMembership(list, id, on) {
5837
+ const rest = (list ?? []).filter((x2) => x2 !== id);
5838
+ return on ? [...rest, id] : rest;
5839
+ }
5840
+ async function setListMembership(arbi, list, id, on) {
5841
+ const settings = await getSettings(arbi);
5842
+ const next = withMembership(settings[list], id, on);
5843
+ await updateSettings(arbi, { [list]: next });
5844
+ return next;
5845
+ }
5846
+ function workspaceNotificationLevel(lists, workspaceId) {
5847
+ if (lists?.muted_workspaces?.includes(workspaceId)) return "muted";
5848
+ if (lists?.followed_workspaces?.includes(workspaceId)) return "following";
5849
+ return "default";
5850
+ }
5851
+ function workspaceLevelPatch(lists, workspaceId, level) {
5852
+ return {
5853
+ muted_workspaces: withMembership(lists?.muted_workspaces, workspaceId, level === "muted"),
5854
+ followed_workspaces: withMembership(
5855
+ lists?.followed_workspaces,
5856
+ workspaceId,
5857
+ level === "following"
5858
+ )
5859
+ };
5860
+ }
5861
+ async function setWorkspaceNotificationLevel(arbi, workspaceId, level) {
5862
+ const patch = workspaceLevelPatch(await getSettings(arbi), workspaceId, level);
5863
+ await updateSettings(arbi, patch);
5864
+ return patch;
5865
+ }
5819
5866
 
5820
5867
  // src/operations/agentconfig.ts
5821
5868
  var agentconfig_exports = {};
@@ -7670,6 +7717,8 @@ var Arbi = class {
7670
7717
  },
7671
7718
  update: (body) => updateWorkspace(this.requireClient(), body),
7672
7719
  listUsers: () => listWorkspaceUsers(this.requireClient()),
7720
+ /** One page of a workspace's activity feed, newest first (see `getWorkspaceActivity`). */
7721
+ activity: (workspaceId, options) => getWorkspaceActivity(this.requireClient(), workspaceId, options),
7673
7722
  addUsers: (emails, role) => addWorkspaceUsers(this.requireClient(), emails, role),
7674
7723
  /**
7675
7724
  * Grant users a temporary key scoped to ONE session (identified by its public key), for
@@ -8090,7 +8139,11 @@ var Arbi = class {
8090
8139
  // ── Settings ──────────────────────────────────────────────────────────
8091
8140
  settings = {
8092
8141
  get: () => getSettings(this.requireClient()),
8093
- update: (body) => updateSettings(this.requireClient(), body)
8142
+ update: (body) => updateSettings(this.requireClient(), body),
8143
+ /** Add or remove one id in a follow / mute list (the full list is sent). */
8144
+ setListMembership: (list, id, on) => setListMembership(this.requireClient(), list, id, on),
8145
+ /** A workspace's notification level: default, following or muted. */
8146
+ setWorkspaceNotificationLevel: (workspaceId, level) => setWorkspaceNotificationLevel(this.requireClient(), workspaceId, level)
8094
8147
  };
8095
8148
  // ── Agent Configuration ───────────────────────────────────────────────
8096
8149
  agentConfig = {