@arbidocs/sdk 0.3.107 → 0.3.108

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.
@@ -1009,6 +1009,15 @@ declare function uploadUrl(arbi: ArbiClient, urls: string[], shared?: boolean):
1009
1009
  * Get parsed document content.
1010
1010
  */
1011
1011
  declare function getParsedContent(auth: AuthHeaders, docId: string, stage: string): Promise<Record<string, unknown>>;
1012
+ /**
1013
+ * Batch-fetch first-page thumbnails for many documents in one request.
1014
+ *
1015
+ * Returns a map of document external id → `data:image/webp;base64` URI, or
1016
+ * `null` when a document has no thumbnail (media, not yet generated, or not
1017
+ * accessible to the caller). Purpose-built for a gallery grid that loads a whole
1018
+ * window of tiles in a single call rather than one request per document.
1019
+ */
1020
+ declare function getThumbnails(auth: AuthHeaders, docIds: string[]): Promise<Record<string, string | null>>;
1012
1021
  /**
1013
1022
  * Upload a file. Uses raw fetch for multipart upload. The active workspace is
1014
1023
  * resolved server-side from the open session.
@@ -1133,6 +1142,7 @@ declare const documents_deleteDocuments: typeof deleteDocuments;
1133
1142
  declare const documents_downloadDocument: typeof downloadDocument;
1134
1143
  declare const documents_getDocuments: typeof getDocuments;
1135
1144
  declare const documents_getParsedContent: typeof getParsedContent;
1145
+ declare const documents_getThumbnails: typeof getThumbnails;
1136
1146
  declare const documents_listAll: typeof listAll;
1137
1147
  declare const documents_listDocuments: typeof listDocuments;
1138
1148
  declare const documents_listPaginated: typeof listPaginated;
@@ -1143,7 +1153,7 @@ declare const documents_uploadDocumentsDirect: typeof uploadDocumentsDirect;
1143
1153
  declare const documents_uploadFiles: typeof uploadFiles;
1144
1154
  declare const documents_uploadUrl: typeof uploadUrl;
1145
1155
  declare namespace documents {
1146
- export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_mimeFromName as mimeFromName, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1156
+ export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_mimeFromName as mimeFromName, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1147
1157
  }
1148
1158
 
1149
1159
  /**
@@ -2192,6 +2202,7 @@ declare class Arbi {
2192
2202
  }) => Promise<UploadResult>;
2193
2203
  download: (docId: string) => Promise<Response>;
2194
2204
  getParsedContent: (docId: string, stage: string) => Promise<Record<string, unknown>>;
2205
+ getThumbnails: (docIds: string[]) => Promise<Record<string, string | null>>;
2195
2206
  };
2196
2207
  readonly conversations: {
2197
2208
  list: () => Promise<{
@@ -1009,6 +1009,15 @@ declare function uploadUrl(arbi: ArbiClient, urls: string[], shared?: boolean):
1009
1009
  * Get parsed document content.
1010
1010
  */
1011
1011
  declare function getParsedContent(auth: AuthHeaders, docId: string, stage: string): Promise<Record<string, unknown>>;
1012
+ /**
1013
+ * Batch-fetch first-page thumbnails for many documents in one request.
1014
+ *
1015
+ * Returns a map of document external id → `data:image/webp;base64` URI, or
1016
+ * `null` when a document has no thumbnail (media, not yet generated, or not
1017
+ * accessible to the caller). Purpose-built for a gallery grid that loads a whole
1018
+ * window of tiles in a single call rather than one request per document.
1019
+ */
1020
+ declare function getThumbnails(auth: AuthHeaders, docIds: string[]): Promise<Record<string, string | null>>;
1012
1021
  /**
1013
1022
  * Upload a file. Uses raw fetch for multipart upload. The active workspace is
1014
1023
  * resolved server-side from the open session.
@@ -1133,6 +1142,7 @@ declare const documents_deleteDocuments: typeof deleteDocuments;
1133
1142
  declare const documents_downloadDocument: typeof downloadDocument;
1134
1143
  declare const documents_getDocuments: typeof getDocuments;
1135
1144
  declare const documents_getParsedContent: typeof getParsedContent;
1145
+ declare const documents_getThumbnails: typeof getThumbnails;
1136
1146
  declare const documents_listAll: typeof listAll;
1137
1147
  declare const documents_listDocuments: typeof listDocuments;
1138
1148
  declare const documents_listPaginated: typeof listPaginated;
@@ -1143,7 +1153,7 @@ declare const documents_uploadDocumentsDirect: typeof uploadDocumentsDirect;
1143
1153
  declare const documents_uploadFiles: typeof uploadFiles;
1144
1154
  declare const documents_uploadUrl: typeof uploadUrl;
1145
1155
  declare namespace documents {
1146
- export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_mimeFromName as mimeFromName, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1156
+ export { type documents_DirectUploadClient as DirectUploadClient, type documents_DirectUploadFile as DirectUploadFile, type documents_DirectUploadProgress as DirectUploadProgress, type documents_DocumentListFields as DocumentListFields, type documents_DocumentListOrder as DocumentListOrder, type documents_ListAllOptions as ListAllOptions, type documents_ListPaginatedOptions as ListPaginatedOptions, documents_MAX_PAGES as MAX_PAGES, documents_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documents_SkippedFile as SkippedFile, type documents_UploadBatchResult as UploadBatchResult, type documents_UploadDirectOptions as UploadDirectOptions, type documents_UploadDirectResult as UploadDirectResult, type documents_UploadOptions as UploadOptions, type documents_UploadResult as UploadResult, documents_deleteDocuments as deleteDocuments, documents_downloadDocument as downloadDocument, documents_getDocuments as getDocuments, documents_getParsedContent as getParsedContent, documents_getThumbnails as getThumbnails, documents_listAll as listAll, documents_listDocuments as listDocuments, documents_listPaginated as listPaginated, documents_mimeFromName as mimeFromName, documents_sanitizeFolderPath as sanitizeFolderPath, documents_updateDocuments as updateDocuments, documents_uploadDocumentsDirect as uploadDocumentsDirect, uploadFile$1 as uploadFile, documents_uploadFiles as uploadFiles, documents_uploadUrl as uploadUrl };
1147
1157
  }
1148
1158
 
1149
1159
  /**
@@ -2192,6 +2202,7 @@ declare class Arbi {
2192
2202
  }) => Promise<UploadResult>;
2193
2203
  download: (docId: string) => Promise<Response>;
2194
2204
  getParsedContent: (docId: string, stage: string) => Promise<Record<string, unknown>>;
2205
+ getThumbnails: (docIds: string[]) => Promise<Record<string, string | null>>;
2195
2206
  };
2196
2207
  readonly conversations: {
2197
2208
  list: () => Promise<{
package/dist/browser.cjs CHANGED
@@ -4240,6 +4240,7 @@ __export(documents_exports, {
4240
4240
  downloadDocument: () => downloadDocument,
4241
4241
  getDocuments: () => getDocuments,
4242
4242
  getParsedContent: () => getParsedContent,
4243
+ getThumbnails: () => getThumbnails,
4243
4244
  listAll: () => listAll,
4244
4245
  listDocuments: () => listDocuments,
4245
4246
  listPaginated: () => listPaginated,
@@ -4414,6 +4415,18 @@ async function getParsedContent(auth, docId, stage) {
4414
4415
  });
4415
4416
  return res.json();
4416
4417
  }
4418
+ async function getThumbnails(auth, docIds) {
4419
+ if (docIds.length === 0) return {};
4420
+ const res = await authenticatedFetch({
4421
+ ...auth,
4422
+ path: `/v1/document/thumbnails`,
4423
+ method: "POST",
4424
+ headers: { "Content-Type": "application/json" },
4425
+ body: JSON.stringify({ document_ext_ids: docIds })
4426
+ });
4427
+ const json = await res.json();
4428
+ return json.thumbnails ?? {};
4429
+ }
4417
4430
  async function uploadFile(auth, fileData, fileName, options) {
4418
4431
  const formData = new FormData();
4419
4432
  formData.append("files", fileData, fileName);
@@ -5649,7 +5662,8 @@ var Arbi = class {
5649
5662
  );
5650
5663
  },
5651
5664
  download: (docId) => downloadDocument(this.getAuthHeaders(), docId),
5652
- getParsedContent: (docId, stage) => getParsedContent(this.getAuthHeaders(), docId, stage)
5665
+ getParsedContent: (docId, stage) => getParsedContent(this.getAuthHeaders(), docId, stage),
5666
+ getThumbnails: (docIds) => getThumbnails(this.getAuthHeaders(), docIds)
5653
5667
  };
5654
5668
  // ── Conversations ─────────────────────────────────────────────────────
5655
5669
  conversations = {