@arbidocs/sdk 0.4.85 → 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 = {};
@@ -7575,25 +7622,22 @@ var Arbi = class {
7575
7622
  return result;
7576
7623
  },
7577
7624
  /**
7578
- * Change (or, after recovery, set) the master password: re-keys the workspaces and direct
7579
- * messages. Omit `currentPassword` in recovery mode. Resolves with the new signing key, whose
7580
- * recovery file the user should save.
7625
+ * Change (or, after recovery, set) the master password. Omit `currentPassword` in recovery
7626
+ * mode. One request: the account identity is re-wrapped under the new password and nothing is
7627
+ * re-encrypted, so the session, the workspace keys and the recovery key all stay as they are.
7581
7628
  */
7582
7629
  changePassword: async (params) => {
7583
7630
  const client$1 = this.requireClient();
7584
7631
  const lr2 = this.requireLogin();
7585
7632
  const email = client$1.session.getState().userEmail ?? this.userProfile?.email;
7586
7633
  if (!email) throw new ArbiError("The account email is unknown; sign in again.");
7587
- const result = await client.changePasswordWithRekey(
7588
- { ...params, email, userExtId: lr2.userExtId },
7634
+ await client.changePassword(
7635
+ { ...params, email, identitySecretKey: lr2.signingPrivateKey },
7589
7636
  {
7590
7637
  fetchClient: client$1.fetch,
7591
7638
  deploymentDomain: this.getDeploymentDomain()
7592
7639
  }
7593
7640
  );
7594
- this.loginResult = { ...lr2, signingPrivateKey: result.newSigningPrivateKey };
7595
- this.wrappedKeys.clear();
7596
- return result;
7597
7641
  },
7598
7642
  /** Close the account (soft delete) and sign out. Refused while a subscription is active. */
7599
7643
  requestDeletion: async () => {
@@ -7673,6 +7717,8 @@ var Arbi = class {
7673
7717
  },
7674
7718
  update: (body) => updateWorkspace(this.requireClient(), body),
7675
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),
7676
7722
  addUsers: (emails, role) => addWorkspaceUsers(this.requireClient(), emails, role),
7677
7723
  /**
7678
7724
  * Grant users a temporary key scoped to ONE session (identified by its public key), for
@@ -8093,7 +8139,11 @@ var Arbi = class {
8093
8139
  // ── Settings ──────────────────────────────────────────────────────────
8094
8140
  settings = {
8095
8141
  get: () => getSettings(this.requireClient()),
8096
- 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)
8097
8147
  };
8098
8148
  // ── Agent Configuration ───────────────────────────────────────────────
8099
8149
  agentConfig = {