@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/index.cjs CHANGED
@@ -5279,6 +5279,7 @@ __export(workspaces_exports, {
5279
5279
  copyDocuments: () => copyDocuments,
5280
5280
  createWorkspace: () => createWorkspace,
5281
5281
  deleteWorkspaces: () => deleteWorkspaces,
5282
+ getWorkspaceActivity: () => getWorkspaceActivity,
5282
5283
  grantTemporaryWorkspaceAccess: () => grantTemporaryWorkspaceAccess,
5283
5284
  listWorkspaceUsers: () => listWorkspaceUsers,
5284
5285
  listWorkspaces: () => listWorkspaces,
@@ -5375,6 +5376,17 @@ async function copyDocuments(arbi, targetWorkspaceId, docIds, targetWorkspaceKey
5375
5376
  "Failed to copy documents"
5376
5377
  );
5377
5378
  }
5379
+ async function getWorkspaceActivity(arbi, workspaceExtId, options = {}) {
5380
+ return requireData(
5381
+ await arbi.fetch.GET("/v1/workspace/{workspace_ext_id}/activity", {
5382
+ params: {
5383
+ path: { workspace_ext_id: workspaceExtId },
5384
+ query: { cursor: options.cursor ?? void 0, limit: options.limit }
5385
+ }
5386
+ }),
5387
+ "Failed to fetch workspace activity"
5388
+ );
5389
+ }
5378
5390
 
5379
5391
  // src/operations/conversations.ts
5380
5392
  var conversations_exports = {};
@@ -6372,7 +6384,12 @@ async function deleteDMs(arbi, messageIds) {
6372
6384
  var settings_exports = {};
6373
6385
  __export(settings_exports, {
6374
6386
  getSettings: () => getSettings,
6375
- updateSettings: () => updateSettings
6387
+ setListMembership: () => setListMembership,
6388
+ setWorkspaceNotificationLevel: () => setWorkspaceNotificationLevel,
6389
+ updateSettings: () => updateSettings,
6390
+ withMembership: () => withMembership,
6391
+ workspaceLevelPatch: () => workspaceLevelPatch,
6392
+ workspaceNotificationLevel: () => workspaceNotificationLevel
6376
6393
  });
6377
6394
  async function getSettings(arbi) {
6378
6395
  return requireData(await arbi.fetch.GET("/v1/user/settings"), "Failed to fetch settings");
@@ -6380,6 +6397,36 @@ async function getSettings(arbi) {
6380
6397
  async function updateSettings(arbi, body) {
6381
6398
  requireOk(await arbi.fetch.PATCH("/v1/user/settings", { body }), "Failed to update settings");
6382
6399
  }
6400
+ function withMembership(list, id, on) {
6401
+ const rest = (list ?? []).filter((x2) => x2 !== id);
6402
+ return on ? [...rest, id] : rest;
6403
+ }
6404
+ async function setListMembership(arbi, list, id, on) {
6405
+ const settings = await getSettings(arbi);
6406
+ const next = withMembership(settings[list], id, on);
6407
+ await updateSettings(arbi, { [list]: next });
6408
+ return next;
6409
+ }
6410
+ function workspaceNotificationLevel(lists, workspaceId) {
6411
+ if (lists?.muted_workspaces?.includes(workspaceId)) return "muted";
6412
+ if (lists?.followed_workspaces?.includes(workspaceId)) return "following";
6413
+ return "default";
6414
+ }
6415
+ function workspaceLevelPatch(lists, workspaceId, level) {
6416
+ return {
6417
+ muted_workspaces: withMembership(lists?.muted_workspaces, workspaceId, level === "muted"),
6418
+ followed_workspaces: withMembership(
6419
+ lists?.followed_workspaces,
6420
+ workspaceId,
6421
+ level === "following"
6422
+ )
6423
+ };
6424
+ }
6425
+ async function setWorkspaceNotificationLevel(arbi, workspaceId, level) {
6426
+ const patch = workspaceLevelPatch(await getSettings(arbi), workspaceId, level);
6427
+ await updateSettings(arbi, patch);
6428
+ return patch;
6429
+ }
6383
6430
 
6384
6431
  // src/operations/agentconfig.ts
6385
6432
  var agentconfig_exports = {};
@@ -8234,6 +8281,8 @@ var Arbi = class {
8234
8281
  },
8235
8282
  update: (body) => updateWorkspace(this.requireClient(), body),
8236
8283
  listUsers: () => listWorkspaceUsers(this.requireClient()),
8284
+ /** One page of a workspace's activity feed, newest first (see `getWorkspaceActivity`). */
8285
+ activity: (workspaceId, options) => getWorkspaceActivity(this.requireClient(), workspaceId, options),
8237
8286
  addUsers: (emails, role) => addWorkspaceUsers(this.requireClient(), emails, role),
8238
8287
  /**
8239
8288
  * Grant users a temporary key scoped to ONE session (identified by its public key), for
@@ -8654,7 +8703,11 @@ var Arbi = class {
8654
8703
  // ── Settings ──────────────────────────────────────────────────────────
8655
8704
  settings = {
8656
8705
  get: () => getSettings(this.requireClient()),
8657
- update: (body) => updateSettings(this.requireClient(), body)
8706
+ update: (body) => updateSettings(this.requireClient(), body),
8707
+ /** Add or remove one id in a follow / mute list (the full list is sent). */
8708
+ setListMembership: (list, id, on) => setListMembership(this.requireClient(), list, id, on),
8709
+ /** A workspace's notification level: default, following or muted. */
8710
+ setWorkspaceNotificationLevel: (workspaceId, level) => setWorkspaceNotificationLevel(this.requireClient(), workspaceId, level)
8658
8711
  };
8659
8712
  // ── Agent Configuration ───────────────────────────────────────────────
8660
8713
  agentConfig = {