@arbidocs/sdk 0.4.62 → 0.4.64

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
@@ -5031,10 +5031,10 @@ async function uploadUrl(arbi, urls, shared = false) {
5031
5031
  "Failed to upload from URLs"
5032
5032
  );
5033
5033
  }
5034
- async function getParsedContent(auth, docId, stage) {
5034
+ async function getParsedContent(auth, docId, stage, version) {
5035
5035
  const res = await authenticatedFetch({
5036
5036
  ...auth,
5037
- path: `/v1/document/${docId}/parsed-${stage}`
5037
+ path: `/v1/document/${docId}/parsed-${stage}${version ? `?version=${version}` : ""}`
5038
5038
  });
5039
5039
  return res.json();
5040
5040
  }
@@ -5092,10 +5092,10 @@ async function uploadFiles(auth, files, options) {
5092
5092
  });
5093
5093
  return res.json();
5094
5094
  }
5095
- async function downloadDocument(auth, docId) {
5095
+ async function downloadDocument(auth, docId, version) {
5096
5096
  return authenticatedFetch({
5097
5097
  ...auth,
5098
- path: `/v1/document/${docId}/download`
5098
+ path: `/v1/document/${docId}/download${version ? `?version=${version}` : ""}`
5099
5099
  });
5100
5100
  }
5101
5101
  function mimeFromName(name) {
@@ -5254,6 +5254,7 @@ async function uploadDocumentsDirect(arbi, workspaceKey, files, options) {
5254
5254
  );
5255
5255
  return {
5256
5256
  doc_ext_ids: commitResult.doc_ext_ids ?? [],
5257
+ version: commitResult.version ?? null,
5257
5258
  skipped: [...skipped, ...commitResult.skipped ?? []]
5258
5259
  };
5259
5260
  }
@@ -7149,7 +7150,7 @@ var Arbi = class {
7149
7150
  */
7150
7151
  listAll: (options) => listAll(this.requireClient(), options),
7151
7152
  get: (externalIds) => getDocuments(this.requireClient(), externalIds),
7152
- /** Every version of a document (any version's id), oldest first; `is_current` marks the current one. */
7153
+ /** Every version of a document, oldest first; `is_current` marks the current one. */
7153
7154
  versions: (docId) => listVersions(this.requireClient(), docId),
7154
7155
  delete: (externalIds) => deleteDocuments(this.requireClient(), externalIds),
7155
7156
  update: (documents) => updateDocuments(this.requireClient(), documents),
@@ -7163,8 +7164,11 @@ var Arbi = class {
7163
7164
  () => uploadFile(this.getAuthHeaders(), fileData, fileName, options)
7164
7165
  );
7165
7166
  },
7166
- download: (docId) => this.recovering(() => downloadDocument(this.getAuthHeaders(), docId)),
7167
- getParsedContent: (docId, stage) => this.recovering(() => getParsedContent(this.getAuthHeaders(), docId, stage)),
7167
+ /** Download a document's original file — its current version, or `version`. */
7168
+ download: (docId, version) => this.recovering(() => downloadDocument(this.getAuthHeaders(), docId, version)),
7169
+ getParsedContent: (docId, stage, version) => this.recovering(
7170
+ () => getParsedContent(this.getAuthHeaders(), docId, stage, version)
7171
+ ),
7168
7172
  getThumbnails: (docIds) => this.recovering(() => getThumbnails(this.getAuthHeaders(), docIds))
7169
7173
  };
7170
7174
  // ── Conversations ─────────────────────────────────────────────────────