@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/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 = {};
@@ -8139,25 +8186,22 @@ var Arbi = class {
8139
8186
  return result;
8140
8187
  },
8141
8188
  /**
8142
- * Change (or, after recovery, set) the master password: re-keys the workspaces and direct
8143
- * messages. Omit `currentPassword` in recovery mode. Resolves with the new signing key, whose
8144
- * recovery file the user should save.
8189
+ * Change (or, after recovery, set) the master password. Omit `currentPassword` in recovery
8190
+ * mode. One request: the account identity is re-wrapped under the new password and nothing is
8191
+ * re-encrypted, so the session, the workspace keys and the recovery key all stay as they are.
8145
8192
  */
8146
8193
  changePassword: async (params) => {
8147
8194
  const client$1 = this.requireClient();
8148
8195
  const lr2 = this.requireLogin();
8149
8196
  const email = client$1.session.getState().userEmail ?? this.userProfile?.email;
8150
8197
  if (!email) throw new ArbiError("The account email is unknown; sign in again.");
8151
- const result = await client.changePasswordWithRekey(
8152
- { ...params, email, userExtId: lr2.userExtId },
8198
+ await client.changePassword(
8199
+ { ...params, email, identitySecretKey: lr2.signingPrivateKey },
8153
8200
  {
8154
8201
  fetchClient: client$1.fetch,
8155
8202
  deploymentDomain: this.getDeploymentDomain()
8156
8203
  }
8157
8204
  );
8158
- this.loginResult = { ...lr2, signingPrivateKey: result.newSigningPrivateKey };
8159
- this.wrappedKeys.clear();
8160
- return result;
8161
8205
  },
8162
8206
  /** Close the account (soft delete) and sign out. Refused while a subscription is active. */
8163
8207
  requestDeletion: async () => {
@@ -8237,6 +8281,8 @@ var Arbi = class {
8237
8281
  },
8238
8282
  update: (body) => updateWorkspace(this.requireClient(), body),
8239
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),
8240
8286
  addUsers: (emails, role) => addWorkspaceUsers(this.requireClient(), emails, role),
8241
8287
  /**
8242
8288
  * Grant users a temporary key scoped to ONE session (identified by its public key), for
@@ -8657,7 +8703,11 @@ var Arbi = class {
8657
8703
  // ── Settings ──────────────────────────────────────────────────────────
8658
8704
  settings = {
8659
8705
  get: () => getSettings(this.requireClient()),
8660
- 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)
8661
8711
  };
8662
8712
  // ── Agent Configuration ───────────────────────────────────────────────
8663
8713
  agentConfig = {