@arbidocs/sdk 0.5.129 → 0.5.131

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
@@ -6365,6 +6365,7 @@ __export(documents_exports, {
6365
6365
  listVersions: () => listVersions,
6366
6366
  mimeFromName: () => mimeFromName,
6367
6367
  presignedPut: () => presignedPut,
6368
+ restoreVersion: () => restoreVersion,
6368
6369
  sanitizeFolderPath: () => sanitizeFolderPath,
6369
6370
  similarDocuments: () => similarDocuments,
6370
6371
  updateDocuments: () => updateDocuments,
@@ -6534,6 +6535,19 @@ async function listVersions(arbi, docId) {
6534
6535
  "Failed to fetch document versions"
6535
6536
  );
6536
6537
  }
6538
+ async function restoreVersion(arbi, docId, version, expectedCurrentVersion, workspaceExtId, signal) {
6539
+ const query2 = {
6540
+ expected_current_version: expectedCurrentVersion,
6541
+ workspace_ext_id: workspaceExtId
6542
+ };
6543
+ return requireData(
6544
+ await arbi.fetch.POST("/v1/document/{document_ext_id}/versions/{n}/restore", {
6545
+ params: { path: { document_ext_id: docId, n: version }, query: query2 },
6546
+ signal
6547
+ }),
6548
+ "Failed to restore document version"
6549
+ );
6550
+ }
6537
6551
  async function finaliseTranslation(arbi, docId) {
6538
6552
  return requireData(
6539
6553
  await arbi.fetch.POST("/v1/document/{document_ext_id}/finalise-translation", {
@@ -7099,6 +7113,62 @@ async function unlockModelConnections(arbi, keys, onlyId) {
7099
7113
  }
7100
7114
  }
7101
7115
 
7116
+ // src/operations/workspace-assistant.ts
7117
+ var workspace_assistant_exports = {};
7118
+ __export(workspace_assistant_exports, {
7119
+ getBrief: () => getBrief,
7120
+ getStatus: () => getStatus,
7121
+ listArrivals: () => listArrivals,
7122
+ markArrivalWrong: () => markArrivalWrong,
7123
+ markMessageDraftSent: () => markMessageDraftSent,
7124
+ updateBrief: () => updateBrief
7125
+ });
7126
+ var FAILED2 = "Could not update the workspace Assistant";
7127
+ async function getBrief(arbi, workspaceExtId) {
7128
+ return requireData(
7129
+ await arbi.fetch.GET("/v1/workspace-assistant/brief", {
7130
+ params: { query: { workspace_ext_id: workspaceExtId } }
7131
+ }),
7132
+ FAILED2
7133
+ );
7134
+ }
7135
+ async function updateBrief(arbi, body) {
7136
+ return requireData(await arbi.fetch.PUT("/v1/workspace-assistant/brief", { body }), FAILED2);
7137
+ }
7138
+ async function listArrivals(arbi, workspaceExtId, limit = 50) {
7139
+ return requireData(
7140
+ await arbi.fetch.GET("/v1/workspace-assistant/arrivals", {
7141
+ params: { query: { workspace_ext_id: workspaceExtId, limit } }
7142
+ }),
7143
+ FAILED2
7144
+ );
7145
+ }
7146
+ async function markArrivalWrong(arbi, arrivalExtId) {
7147
+ return requireData(
7148
+ await arbi.fetch.POST("/v1/workspace-assistant/arrivals/{arrival_ext_id}/wrong", {
7149
+ params: { path: { arrival_ext_id: arrivalExtId } }
7150
+ }),
7151
+ FAILED2
7152
+ );
7153
+ }
7154
+ async function markMessageDraftSent(arbi, arrivalExtId, index) {
7155
+ requireOk(
7156
+ await arbi.fetch.POST(
7157
+ "/v1/workspace-assistant/arrivals/{arrival_ext_id}/message-drafts/{index}/sent",
7158
+ { params: { path: { arrival_ext_id: arrivalExtId, index } } }
7159
+ ),
7160
+ FAILED2
7161
+ );
7162
+ }
7163
+ async function getStatus(arbi, workspaceExtId) {
7164
+ return requireData(
7165
+ await arbi.fetch.GET("/v1/workspace-assistant/status", {
7166
+ params: { query: { workspace_ext_id: workspaceExtId } }
7167
+ }),
7168
+ FAILED2
7169
+ );
7170
+ }
7171
+
7102
7172
  // src/operations/secure-mail.ts
7103
7173
  var secure_mail_exports = {};
7104
7174
  __export(secure_mail_exports, {
@@ -7877,6 +7947,7 @@ __export(contacts_exports, {
7877
7947
  inviteContacts: () => inviteContacts,
7878
7948
  linkContact: () => linkContact,
7879
7949
  listContacts: () => listContacts,
7950
+ referralSummary: () => referralSummary,
7880
7951
  searchContacts: () => searchContacts,
7881
7952
  updateContact: () => updateContact
7882
7953
  });
@@ -7993,6 +8064,12 @@ function groupContactsByStatus(contactList) {
7993
8064
  }
7994
8065
  return { registered, pending, cards };
7995
8066
  }
8067
+ async function referralSummary(client) {
8068
+ return requireData(
8069
+ await client.fetch.GET("/v1/user/referrals"),
8070
+ "Failed to fetch invitation progress"
8071
+ );
8072
+ }
7996
8073
 
7997
8074
  // src/operations/doctags.ts
7998
8075
  var doctags_exports = {};
@@ -9272,7 +9349,7 @@ async function requestDeletion(arbi) {
9272
9349
  var identity_exports = {};
9273
9350
  __export(identity_exports, {
9274
9351
  acceptName: () => acceptName,
9275
- getStatus: () => getStatus,
9352
+ getStatus: () => getStatus2,
9276
9353
  identityErrorCode: () => identityErrorCode,
9277
9354
  purchase: () => purchase,
9278
9355
  refresh: () => refresh,
@@ -9304,7 +9381,7 @@ function unwrap(result, fallback) {
9304
9381
  }
9305
9382
  return result.data;
9306
9383
  }
9307
- async function getStatus(arbi) {
9384
+ async function getStatus2(arbi) {
9308
9385
  return unwrap(await arbi.fetch.GET("/v1/user/identity"), "Failed to load identity verification");
9309
9386
  }
9310
9387
  async function purchase(arbi, projectExtId) {
@@ -12821,7 +12898,7 @@ var Arbi = class {
12821
12898
  // ── Identity verification ─────────────────────────────────────────────
12822
12899
  identity = {
12823
12900
  /** Whether the ID check is offered (Pro plans), its price, and where the user's check stands. */
12824
- status: () => getStatus(this.requireClient()),
12901
+ status: () => getStatus2(this.requireClient()),
12825
12902
  /** Charge the one-time fee to an own Pro project; `requires_action` carries a payment URL. */
12826
12903
  purchase: (projectExtId) => purchase(this.requireClient(), projectExtId),
12827
12904
  /** The Didit session URL to run the web SDK on. */
@@ -12835,7 +12912,7 @@ var Arbi = class {
12835
12912
  /** Take the name on the document as the account name; the profile follows. */
12836
12913
  acceptName: async () => {
12837
12914
  const client = this.requireClient();
12838
- const offered = await getStatus(client);
12915
+ const offered = await getStatus2(client);
12839
12916
  const status = await acceptName(client);
12840
12917
  if (this.userProfile && offered.document_given_name) {
12841
12918
  this.setUserProfile({
@@ -13063,6 +13140,25 @@ var Arbi = class {
13063
13140
  get: (externalIds) => getDocuments(this.requireClient(), externalIds),
13064
13141
  /** Every version of a document, oldest first; `is_current` marks the current one. */
13065
13142
  versions: (docId) => listVersions(this.requireClient(), docId),
13143
+ /** Restore an earlier snapshot as a new version, retaining history and rejecting concurrent edits. */
13144
+ restoreVersion: (docId, version, expectedCurrentVersion) => {
13145
+ const workspaceExtId = this.requireWorkspace();
13146
+ const signal = this.requireClient().auth.sessionSignal();
13147
+ return this.recovering(() => {
13148
+ signal.throwIfAborted();
13149
+ if (this.currentWorkspaceId !== workspaceExtId) {
13150
+ throw new ArbiWorkspaceChangedError(workspaceExtId, "restoring a document in");
13151
+ }
13152
+ return restoreVersion(
13153
+ this.requireClient(),
13154
+ docId,
13155
+ version,
13156
+ expectedCurrentVersion,
13157
+ workspaceExtId,
13158
+ signal
13159
+ );
13160
+ });
13161
+ },
13066
13162
  /** Save a translation's current version as a new PDF document linked to its original. */
13067
13163
  finaliseTranslation: (docId) => finaliseTranslation(this.requireClient(), docId),
13068
13164
  delete: (externalIds) => deleteDocuments(this.requireClient(), externalIds),
@@ -13767,6 +13863,7 @@ var Arbi = class {
13767
13863
  // A card is sealed under its address book's key, which the contacts key bridge carries: without
13768
13864
  // it the server returns `card: null` and refuses card writes.
13769
13865
  contacts = {
13866
+ referrals: () => referralSummary(this.requireClient()),
13770
13867
  list: () => this.withContactKeys((c2) => listContacts(c2)),
13771
13868
  invite: (emails) => inviteContacts(this.requireClient(), emails),
13772
13869
  create: (body) => this.withContactKeys((c2) => createContact(c2, body)),
@@ -14437,6 +14534,17 @@ var Arbi = class {
14437
14534
  /** The documents the open workspace may use as its house template. */
14438
14535
  candidates: () => listHouseTemplateCandidates(this.requireClient())
14439
14536
  };
14537
+ // ── Workspace Assistant ─────────────────────────────────────────────
14538
+ /** The workspace's standing instructions for its Assistant, and what it did with each arrival. */
14539
+ workspaceAssistant = {
14540
+ brief: (workspaceExtId) => getBrief(this.requireClient(), workspaceExtId),
14541
+ updateBrief: (body) => updateBrief(this.requireClient(), body),
14542
+ arrivals: (workspaceExtId, limit) => listArrivals(this.requireClient(), workspaceExtId, limit),
14543
+ status: (workspaceExtId) => getStatus(this.requireClient(), workspaceExtId),
14544
+ markWrong: (arrivalExtId) => markArrivalWrong(this.requireClient(), arrivalExtId),
14545
+ /** Record that a message the Assistant drafted was sent, so it is not offered again. */
14546
+ markMessageSent: (arrivalExtId, index) => markMessageDraftSent(this.requireClient(), arrivalExtId, index)
14547
+ };
14440
14548
  // ── Model connections ───────────────────────────────────────────────
14441
14549
  /**
14442
14550
  * The main agent's OpenAI-compatible endpoints: the box's and the user's own. A personal key is
@@ -16565,6 +16673,7 @@ exports.usdToGbp = usdToGbp;
16565
16673
  exports.work = work_exports;
16566
16674
  exports.workflowSteps = workflow_steps_exports;
16567
16675
  exports.workflows = workflows_exports;
16676
+ exports.workspaceAssistant = workspace_assistant_exports;
16568
16677
  exports.workspaceConflictOf = workspaceConflictOf;
16569
16678
  exports.workspaces = workspaces_exports;
16570
16679
  exports.wouldCreateTagCycle = wouldCreateTagCycle;