@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/browser.cjs CHANGED
@@ -5823,6 +5823,7 @@ __export(documents_exports, {
5823
5823
  listVersions: () => listVersions,
5824
5824
  mimeFromName: () => mimeFromName,
5825
5825
  presignedPut: () => presignedPut,
5826
+ restoreVersion: () => restoreVersion,
5826
5827
  sanitizeFolderPath: () => sanitizeFolderPath,
5827
5828
  similarDocuments: () => similarDocuments,
5828
5829
  updateDocuments: () => updateDocuments,
@@ -5992,6 +5993,19 @@ async function listVersions(arbi, docId) {
5992
5993
  "Failed to fetch document versions"
5993
5994
  );
5994
5995
  }
5996
+ async function restoreVersion(arbi, docId, version, expectedCurrentVersion, workspaceExtId, signal) {
5997
+ const query2 = {
5998
+ expected_current_version: expectedCurrentVersion,
5999
+ workspace_ext_id: workspaceExtId
6000
+ };
6001
+ return requireData(
6002
+ await arbi.fetch.POST("/v1/document/{document_ext_id}/versions/{n}/restore", {
6003
+ params: { path: { document_ext_id: docId, n: version }, query: query2 },
6004
+ signal
6005
+ }),
6006
+ "Failed to restore document version"
6007
+ );
6008
+ }
5995
6009
  async function finaliseTranslation(arbi, docId) {
5996
6010
  return requireData(
5997
6011
  await arbi.fetch.POST("/v1/document/{document_ext_id}/finalise-translation", {
@@ -6534,6 +6548,62 @@ async function unlockModelConnections(arbi, keys, onlyId) {
6534
6548
  }
6535
6549
  }
6536
6550
 
6551
+ // src/operations/workspace-assistant.ts
6552
+ var workspace_assistant_exports = {};
6553
+ __export(workspace_assistant_exports, {
6554
+ getBrief: () => getBrief,
6555
+ getStatus: () => getStatus,
6556
+ listArrivals: () => listArrivals,
6557
+ markArrivalWrong: () => markArrivalWrong,
6558
+ markMessageDraftSent: () => markMessageDraftSent,
6559
+ updateBrief: () => updateBrief
6560
+ });
6561
+ var FAILED2 = "Could not update the workspace Assistant";
6562
+ async function getBrief(arbi, workspaceExtId) {
6563
+ return requireData(
6564
+ await arbi.fetch.GET("/v1/workspace-assistant/brief", {
6565
+ params: { query: { workspace_ext_id: workspaceExtId } }
6566
+ }),
6567
+ FAILED2
6568
+ );
6569
+ }
6570
+ async function updateBrief(arbi, body) {
6571
+ return requireData(await arbi.fetch.PUT("/v1/workspace-assistant/brief", { body }), FAILED2);
6572
+ }
6573
+ async function listArrivals(arbi, workspaceExtId, limit = 50) {
6574
+ return requireData(
6575
+ await arbi.fetch.GET("/v1/workspace-assistant/arrivals", {
6576
+ params: { query: { workspace_ext_id: workspaceExtId, limit } }
6577
+ }),
6578
+ FAILED2
6579
+ );
6580
+ }
6581
+ async function markArrivalWrong(arbi, arrivalExtId) {
6582
+ return requireData(
6583
+ await arbi.fetch.POST("/v1/workspace-assistant/arrivals/{arrival_ext_id}/wrong", {
6584
+ params: { path: { arrival_ext_id: arrivalExtId } }
6585
+ }),
6586
+ FAILED2
6587
+ );
6588
+ }
6589
+ async function markMessageDraftSent(arbi, arrivalExtId, index) {
6590
+ requireOk(
6591
+ await arbi.fetch.POST(
6592
+ "/v1/workspace-assistant/arrivals/{arrival_ext_id}/message-drafts/{index}/sent",
6593
+ { params: { path: { arrival_ext_id: arrivalExtId, index } } }
6594
+ ),
6595
+ FAILED2
6596
+ );
6597
+ }
6598
+ async function getStatus(arbi, workspaceExtId) {
6599
+ return requireData(
6600
+ await arbi.fetch.GET("/v1/workspace-assistant/status", {
6601
+ params: { query: { workspace_ext_id: workspaceExtId } }
6602
+ }),
6603
+ FAILED2
6604
+ );
6605
+ }
6606
+
6537
6607
  // src/operations/secure-mail.ts
6538
6608
  var secure_mail_exports = {};
6539
6609
  __export(secure_mail_exports, {
@@ -7312,6 +7382,7 @@ __export(contacts_exports, {
7312
7382
  inviteContacts: () => inviteContacts,
7313
7383
  linkContact: () => linkContact,
7314
7384
  listContacts: () => listContacts,
7385
+ referralSummary: () => referralSummary,
7315
7386
  searchContacts: () => searchContacts,
7316
7387
  updateContact: () => updateContact
7317
7388
  });
@@ -7428,6 +7499,12 @@ function groupContactsByStatus(contactList) {
7428
7499
  }
7429
7500
  return { registered, pending, cards };
7430
7501
  }
7502
+ async function referralSummary(client) {
7503
+ return requireData(
7504
+ await client.fetch.GET("/v1/user/referrals"),
7505
+ "Failed to fetch invitation progress"
7506
+ );
7507
+ }
7431
7508
 
7432
7509
  // src/operations/doctags.ts
7433
7510
  var doctags_exports = {};
@@ -8686,7 +8763,7 @@ async function requestDeletion(arbi) {
8686
8763
  var identity_exports = {};
8687
8764
  __export(identity_exports, {
8688
8765
  acceptName: () => acceptName,
8689
- getStatus: () => getStatus,
8766
+ getStatus: () => getStatus2,
8690
8767
  identityErrorCode: () => identityErrorCode,
8691
8768
  purchase: () => purchase,
8692
8769
  refresh: () => refresh,
@@ -8718,7 +8795,7 @@ function unwrap(result, fallback) {
8718
8795
  }
8719
8796
  return result.data;
8720
8797
  }
8721
- async function getStatus(arbi) {
8798
+ async function getStatus2(arbi) {
8722
8799
  return unwrap(await arbi.fetch.GET("/v1/user/identity"), "Failed to load identity verification");
8723
8800
  }
8724
8801
  async function purchase(arbi, projectExtId) {
@@ -12235,7 +12312,7 @@ var Arbi = class {
12235
12312
  // ── Identity verification ─────────────────────────────────────────────
12236
12313
  identity = {
12237
12314
  /** Whether the ID check is offered (Pro plans), its price, and where the user's check stands. */
12238
- status: () => getStatus(this.requireClient()),
12315
+ status: () => getStatus2(this.requireClient()),
12239
12316
  /** Charge the one-time fee to an own Pro project; `requires_action` carries a payment URL. */
12240
12317
  purchase: (projectExtId) => purchase(this.requireClient(), projectExtId),
12241
12318
  /** The Didit session URL to run the web SDK on. */
@@ -12249,7 +12326,7 @@ var Arbi = class {
12249
12326
  /** Take the name on the document as the account name; the profile follows. */
12250
12327
  acceptName: async () => {
12251
12328
  const client = this.requireClient();
12252
- const offered = await getStatus(client);
12329
+ const offered = await getStatus2(client);
12253
12330
  const status = await acceptName(client);
12254
12331
  if (this.userProfile && offered.document_given_name) {
12255
12332
  this.setUserProfile({
@@ -12477,6 +12554,25 @@ var Arbi = class {
12477
12554
  get: (externalIds) => getDocuments(this.requireClient(), externalIds),
12478
12555
  /** Every version of a document, oldest first; `is_current` marks the current one. */
12479
12556
  versions: (docId) => listVersions(this.requireClient(), docId),
12557
+ /** Restore an earlier snapshot as a new version, retaining history and rejecting concurrent edits. */
12558
+ restoreVersion: (docId, version, expectedCurrentVersion) => {
12559
+ const workspaceExtId = this.requireWorkspace();
12560
+ const signal = this.requireClient().auth.sessionSignal();
12561
+ return this.recovering(() => {
12562
+ signal.throwIfAborted();
12563
+ if (this.currentWorkspaceId !== workspaceExtId) {
12564
+ throw new ArbiWorkspaceChangedError(workspaceExtId, "restoring a document in");
12565
+ }
12566
+ return restoreVersion(
12567
+ this.requireClient(),
12568
+ docId,
12569
+ version,
12570
+ expectedCurrentVersion,
12571
+ workspaceExtId,
12572
+ signal
12573
+ );
12574
+ });
12575
+ },
12480
12576
  /** Save a translation's current version as a new PDF document linked to its original. */
12481
12577
  finaliseTranslation: (docId) => finaliseTranslation(this.requireClient(), docId),
12482
12578
  delete: (externalIds) => deleteDocuments(this.requireClient(), externalIds),
@@ -13181,6 +13277,7 @@ var Arbi = class {
13181
13277
  // A card is sealed under its address book's key, which the contacts key bridge carries: without
13182
13278
  // it the server returns `card: null` and refuses card writes.
13183
13279
  contacts = {
13280
+ referrals: () => referralSummary(this.requireClient()),
13184
13281
  list: () => this.withContactKeys((c2) => listContacts(c2)),
13185
13282
  invite: (emails) => inviteContacts(this.requireClient(), emails),
13186
13283
  create: (body) => this.withContactKeys((c2) => createContact(c2, body)),
@@ -13851,6 +13948,17 @@ var Arbi = class {
13851
13948
  /** The documents the open workspace may use as its house template. */
13852
13949
  candidates: () => listHouseTemplateCandidates(this.requireClient())
13853
13950
  };
13951
+ // ── Workspace Assistant ─────────────────────────────────────────────
13952
+ /** The workspace's standing instructions for its Assistant, and what it did with each arrival. */
13953
+ workspaceAssistant = {
13954
+ brief: (workspaceExtId) => getBrief(this.requireClient(), workspaceExtId),
13955
+ updateBrief: (body) => updateBrief(this.requireClient(), body),
13956
+ arrivals: (workspaceExtId, limit) => listArrivals(this.requireClient(), workspaceExtId, limit),
13957
+ status: (workspaceExtId) => getStatus(this.requireClient(), workspaceExtId),
13958
+ markWrong: (arrivalExtId) => markArrivalWrong(this.requireClient(), arrivalExtId),
13959
+ /** Record that a message the Assistant drafted was sent, so it is not offered again. */
13960
+ markMessageSent: (arrivalExtId, index) => markMessageDraftSent(this.requireClient(), arrivalExtId, index)
13961
+ };
13854
13962
  // ── Model connections ───────────────────────────────────────────────
13855
13963
  /**
13856
13964
  * The main agent's OpenAI-compatible endpoints: the box's and the user's own. A personal key is
@@ -14883,6 +14991,7 @@ exports.usdToGbp = usdToGbp;
14883
14991
  exports.work = work_exports;
14884
14992
  exports.workflowSteps = workflow_steps_exports;
14885
14993
  exports.workflows = workflows_exports;
14994
+ exports.workspaceAssistant = workspace_assistant_exports;
14886
14995
  exports.workspaceConflictOf = workspaceConflictOf;
14887
14996
  exports.workspaces = workspaces_exports;
14888
14997
  exports.wouldCreateTagCycle = wouldCreateTagCycle;