@gpt-platform/admin 0.10.3 → 0.10.4

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.js CHANGED
@@ -855,7 +855,7 @@ var createClient = (config = {}) => {
855
855
  };
856
856
 
857
857
  // src/version.ts
858
- var SDK_VERSION = "0.10.3";
858
+ var SDK_VERSION = "0.10.4";
859
859
  var DEFAULT_API_VERSION = "2026-03-23";
860
860
 
861
861
  // src/base-client.ts
@@ -1317,6 +1317,31 @@ var RequestBuilder = class {
1317
1317
  throw handleApiError(error);
1318
1318
  }
1319
1319
  }
1320
+ /**
1321
+ * Execute a raw POST to a custom endpoint that returns flat JSON (no data wrapper).
1322
+ * Unlike rawPost (which unwraps data.data), this returns the response body directly.
1323
+ * Used for hand-written Phoenix controllers like DocumentsController.
1324
+ */
1325
+ async rawPostDirect(url, body, options) {
1326
+ const headers = buildHeaders(this.getHeaders, options);
1327
+ try {
1328
+ const result = await this.requestWithRetry(
1329
+ () => this.clientInstance.post({
1330
+ url,
1331
+ headers,
1332
+ ...body !== void 0 && { body },
1333
+ ...options?.signal && { signal: options.signal }
1334
+ })
1335
+ );
1336
+ const { data, error } = result;
1337
+ if (error) {
1338
+ throw handleApiError(enrichError(error, result));
1339
+ }
1340
+ return data;
1341
+ } catch (error) {
1342
+ throw handleApiError(error);
1343
+ }
1344
+ }
1320
1345
  /**
1321
1346
  * Execute a raw PATCH request to a custom (non-generated) endpoint.
1322
1347
  * Used for endpoints implemented as custom Phoenix controllers.
@@ -2144,6 +2169,11 @@ var patchAdminIsvCrmEntityTypesById = (options) => (options.client ?? client).pa
2144
2169
  ...options.headers
2145
2170
  }
2146
2171
  });
2172
+ var getAdminWorkspacesByWorkspaceIdTrainingAnalytics = (options) => (options.client ?? client).get({
2173
+ security: [{ scheme: "bearer", type: "http" }],
2174
+ url: "/admin/workspaces/{workspace_id}/training/analytics",
2175
+ ...options
2176
+ });
2147
2177
  var getAdminClinicalMealPlansByPatient = (options) => (options.client ?? client).get({
2148
2178
  security: [{ scheme: "bearer", type: "http" }],
2149
2179
  url: "/admin/clinical/meal-plans/by-patient",
@@ -2902,6 +2932,25 @@ var getAdminClinicalPracticeToolsCatalogArchived = (options) => (options.client
2902
2932
  url: "/admin/clinical/practice-tools/catalog/archived",
2903
2933
  ...options
2904
2934
  });
2935
+ var deleteAdminPostProcessingHooksById = (options) => (options.client ?? client).delete({
2936
+ security: [{ scheme: "bearer", type: "http" }],
2937
+ url: "/admin/post-processing-hooks/{id}",
2938
+ ...options
2939
+ });
2940
+ var getAdminPostProcessingHooksById = (options) => (options.client ?? client).get({
2941
+ security: [{ scheme: "bearer", type: "http" }],
2942
+ url: "/admin/post-processing-hooks/{id}",
2943
+ ...options
2944
+ });
2945
+ var patchAdminPostProcessingHooksById = (options) => (options.client ?? client).patch({
2946
+ security: [{ scheme: "bearer", type: "http" }],
2947
+ url: "/admin/post-processing-hooks/{id}",
2948
+ ...options,
2949
+ headers: {
2950
+ "Content-Type": "application/vnd.api+json",
2951
+ ...options.headers
2952
+ }
2953
+ });
2905
2954
  var getAdminVoiceRecordingsSessionBySessionId = (options) => (options.client ?? client).get({
2906
2955
  security: [{ scheme: "bearer", type: "http" }],
2907
2956
  url: "/admin/voice/recordings/session/{session_id}",
@@ -4037,6 +4086,15 @@ var getAdminEmailMarketingTemplatesWorkspaceByWorkspaceId = (options) => (option
4037
4086
  url: "/admin/email-marketing/templates/workspace/{workspace_id}",
4038
4087
  ...options
4039
4088
  });
4089
+ var postAdminExtractionAgentsPredict = (options) => (options.client ?? client).post({
4090
+ security: [{ scheme: "bearer", type: "http" }],
4091
+ url: "/admin/extraction/agents/predict",
4092
+ ...options,
4093
+ headers: {
4094
+ "Content-Type": "application/vnd.api+json",
4095
+ ...options.headers
4096
+ }
4097
+ });
4040
4098
  var postAdminSocialCampaignsByIdGenerateMasterCopy = (options) => (options.client ?? client).post({
4041
4099
  security: [{ scheme: "bearer", type: "http" }],
4042
4100
  url: "/admin/social/campaigns/{id}/generate-master-copy",
@@ -4214,6 +4272,11 @@ var patchAdminLegalDocumentsByIdUnpublish = (options) => (options.client ?? clie
4214
4272
  ...options.headers
4215
4273
  }
4216
4274
  });
4275
+ var getAdminExtractionAgents = (options) => (options.client ?? client).get({
4276
+ security: [{ scheme: "bearer", type: "http" }],
4277
+ url: "/admin/extraction/agents",
4278
+ ...options
4279
+ });
4217
4280
  var getAdminWalletUsage = (options) => (options.client ?? client).get({
4218
4281
  security: [{ scheme: "bearer", type: "http" }],
4219
4282
  url: "/admin/wallet/usage",
@@ -4846,6 +4909,11 @@ var getAdminAgentVersionRevisionsById = (options) => (options.client ?? client).
4846
4909
  url: "/admin/agent-version-revisions/{id}",
4847
4910
  ...options
4848
4911
  });
4912
+ var getAdminExtractionAgentsById = (options) => (options.client ?? client).get({
4913
+ security: [{ scheme: "bearer", type: "http" }],
4914
+ url: "/admin/extraction/agents/{id}",
4915
+ ...options
4916
+ });
4849
4917
  var getAdminSchedulingEventsByDateRange = (options) => (options.client ?? client).get({
4850
4918
  security: [{ scheme: "bearer", type: "http" }],
4851
4919
  url: "/admin/scheduling/events/by_date_range",
@@ -4994,6 +5062,11 @@ var postAdminWebhookConfigs = (options) => (options.client ?? client).post({
4994
5062
  ...options.headers
4995
5063
  }
4996
5064
  });
5065
+ var getAdminWorkspacesAnalyticsBatch = (options) => (options.client ?? client).get({
5066
+ security: [{ scheme: "bearer", type: "http" }],
5067
+ url: "/admin/workspaces/analytics-batch",
5068
+ ...options
5069
+ });
4997
5070
  var getAdminExtractionConfigEnums = (options) => (options.client ?? client).get({
4998
5071
  security: [{ scheme: "bearer", type: "http" }],
4999
5072
  url: "/admin/extraction/config-enums",
@@ -6029,6 +6102,15 @@ var postAdminEmailMarketingTemplatesCompile = (options) => (options.client ?? cl
6029
6102
  ...options.headers
6030
6103
  }
6031
6104
  });
6105
+ var postAdminSocialCampaignsByIdPreviewAdaptations = (options) => (options.client ?? client).post({
6106
+ security: [{ scheme: "bearer", type: "http" }],
6107
+ url: "/admin/social/campaigns/{id}/preview-adaptations",
6108
+ ...options,
6109
+ headers: {
6110
+ "Content-Type": "application/vnd.api+json",
6111
+ ...options.headers
6112
+ }
6113
+ });
6032
6114
  var getAdminClinicalNotesArchived = (options) => (options.client ?? client).get({
6033
6115
  security: [{ scheme: "bearer", type: "http" }],
6034
6116
  url: "/admin/clinical/notes/archived",
@@ -6648,6 +6730,20 @@ var patchAdminCrawlerSchedulesByIdEnable = (options) => (options.client ?? clien
6648
6730
  ...options.headers
6649
6731
  }
6650
6732
  });
6733
+ var getAdminPostProcessingHooks = (options) => (options.client ?? client).get({
6734
+ security: [{ scheme: "bearer", type: "http" }],
6735
+ url: "/admin/post-processing-hooks",
6736
+ ...options
6737
+ });
6738
+ var postAdminPostProcessingHooks = (options) => (options.client ?? client).post({
6739
+ security: [{ scheme: "bearer", type: "http" }],
6740
+ url: "/admin/post-processing-hooks",
6741
+ ...options,
6742
+ headers: {
6743
+ "Content-Type": "application/vnd.api+json",
6744
+ ...options.headers
6745
+ }
6746
+ });
6651
6747
  var postAdminAgentsByIdAnalyzeTraining = (options) => (options.client ?? client).post({
6652
6748
  security: [{ scheme: "bearer", type: "http" }],
6653
6749
  url: "/admin/agents/{id}/analyze-training",
@@ -9797,6 +9893,21 @@ function createStorageNamespace(rb) {
9797
9893
  { query: { parent_id: parentId } },
9798
9894
  options
9799
9895
  );
9896
+ },
9897
+ /**
9898
+ * Generate a short-lived presigned download URL for a file.
9899
+ *
9900
+ * @param id - The UUID of the file to download.
9901
+ * @param params - Optional parameters (e.g., custom `expires_in` seconds).
9902
+ * @param options - Optional request options.
9903
+ * @returns A promise resolving to the presigned URL and its expiry.
9904
+ */
9905
+ requestDownloadUrl: async (id, params, options) => {
9906
+ return rb.rawPostDirect(
9907
+ `/isv/storage-files/${id}/download-url`,
9908
+ params?.expires_in != null ? { data: { expires_in: params.expires_in } } : void 0,
9909
+ options
9910
+ );
9800
9911
  }
9801
9912
  },
9802
9913
  /**
@@ -13385,6 +13496,32 @@ function createSocialNamespace(rb) {
13385
13496
  },
13386
13497
  options
13387
13498
  );
13499
+ },
13500
+ /**
13501
+ * Preview adapted copy per platform without creating SocialPost records.
13502
+ *
13503
+ * Returns the AI-adapted text for each target platform so the user can
13504
+ * review before committing via `adaptForPlatforms`.
13505
+ *
13506
+ * @param id - Campaign UUID.
13507
+ * @param workspaceId - Workspace UUID.
13508
+ * @param options - Optional request options.
13509
+ * @returns `{ adaptations: [{ platform: string, content: string }] }`
13510
+ */
13511
+ previewAdaptations: async (id, workspaceId, options) => {
13512
+ return rb.execute(
13513
+ postAdminSocialCampaignsByIdPreviewAdaptations,
13514
+ {
13515
+ path: { id },
13516
+ body: {
13517
+ data: {
13518
+ campaign_id: id,
13519
+ workspace_id: workspaceId
13520
+ }
13521
+ }
13522
+ },
13523
+ options
13524
+ );
13388
13525
  }
13389
13526
  },
13390
13527
  /** Trending content discovery — snapshots, items, and watch alerts. */
@@ -13987,7 +14124,17 @@ function createExtractionNamespace(rb) {
13987
14124
  return {
13988
14125
  /** Document lifecycle — upload, process, review, train, bulk operations. */
13989
14126
  documents: {
13990
- /** List all extraction documents. */
14127
+ /**
14128
+ * Lists all extraction documents across the platform.
14129
+ *
14130
+ * @param options - Optional request options (abort signal, custom headers).
14131
+ * @returns An array of extraction document objects.
14132
+ *
14133
+ * @example
14134
+ * ```typescript
14135
+ * const docs = await admin.extraction.documents.list();
14136
+ * ```
14137
+ */
13991
14138
  list: async (options) => {
13992
14139
  return rb.execute(
13993
14140
  getAdminExtractionDocuments,
@@ -13995,7 +14142,19 @@ function createExtractionNamespace(rb) {
13995
14142
  options
13996
14143
  );
13997
14144
  },
13998
- /** Get a document by ID. */
14145
+ /**
14146
+ * Retrieves a single extraction document by its unique identifier.
14147
+ *
14148
+ * @param id - The UUID of the document to retrieve.
14149
+ * @param options - Optional request options (abort signal, custom headers).
14150
+ * @returns The matching extraction document object.
14151
+ *
14152
+ * @example
14153
+ * ```typescript
14154
+ * const doc = await admin.extraction.documents.get('doc-uuid');
14155
+ * console.log(doc.status, doc.filename);
14156
+ * ```
14157
+ */
13999
14158
  get: async (id, options) => {
14000
14159
  return rb.execute(
14001
14160
  getAdminExtractionDocumentsById,
@@ -14003,7 +14162,18 @@ function createExtractionNamespace(rb) {
14003
14162
  options
14004
14163
  );
14005
14164
  },
14006
- /** Delete a document. */
14165
+ /**
14166
+ * Permanently deletes an extraction document and its associated results.
14167
+ *
14168
+ * @param id - The UUID of the document to delete.
14169
+ * @param options - Optional request options (abort signal, custom headers).
14170
+ * @returns `true` when the deletion succeeds.
14171
+ *
14172
+ * @example
14173
+ * ```typescript
14174
+ * await admin.extraction.documents.delete('doc-uuid');
14175
+ * ```
14176
+ */
14007
14177
  delete: async (id, options) => {
14008
14178
  return rb.executeDelete(
14009
14179
  deleteAdminExtractionDocumentsById,
@@ -14011,7 +14181,19 @@ function createExtractionNamespace(rb) {
14011
14181
  options
14012
14182
  );
14013
14183
  },
14014
- /** Get the rendered view of a document. */
14184
+ /**
14185
+ * Retrieves the rendered view of a document, including page images and
14186
+ * overlay data for visual inspection.
14187
+ *
14188
+ * @param id - The UUID of the document.
14189
+ * @param options - Optional request options (abort signal, custom headers).
14190
+ * @returns The document object with rendered view data.
14191
+ *
14192
+ * @example
14193
+ * ```typescript
14194
+ * const view = await admin.extraction.documents.view('doc-uuid');
14195
+ * ```
14196
+ */
14015
14197
  view: async (id, options) => {
14016
14198
  return rb.execute(
14017
14199
  getAdminExtractionDocumentsByIdView,
@@ -14019,7 +14201,20 @@ function createExtractionNamespace(rb) {
14019
14201
  options
14020
14202
  );
14021
14203
  },
14022
- /** Get document processing status. */
14204
+ /**
14205
+ * Retrieves the current processing status of a document, including
14206
+ * progress percentage and any error details.
14207
+ *
14208
+ * @param id - The UUID of the document.
14209
+ * @param options - Optional request options (abort signal, custom headers).
14210
+ * @returns The document object with current status fields.
14211
+ *
14212
+ * @example
14213
+ * ```typescript
14214
+ * const { status, progress_percent } = await admin.extraction.documents.status('doc-uuid');
14215
+ * console.log(`Status: ${status} (${progress_percent}%)`);
14216
+ * ```
14217
+ */
14023
14218
  status: async (id, options) => {
14024
14219
  return rb.execute(
14025
14220
  getAdminExtractionDocumentsByIdStatus,
@@ -14027,7 +14222,22 @@ function createExtractionNamespace(rb) {
14027
14222
  options
14028
14223
  );
14029
14224
  },
14030
- /** Update document processing status. */
14225
+ /**
14226
+ * Updates the processing status of a document. Used by admin tooling to
14227
+ * manually transition a document between pipeline states.
14228
+ *
14229
+ * @param id - The UUID of the document to update.
14230
+ * @param attributes - The status attributes to set.
14231
+ * @param options - Optional request options (abort signal, custom headers).
14232
+ * @returns The updated extraction document object.
14233
+ *
14234
+ * @example
14235
+ * ```typescript
14236
+ * const doc = await admin.extraction.documents.updateStatus('doc-uuid', {
14237
+ * status: 'completed',
14238
+ * });
14239
+ * ```
14240
+ */
14031
14241
  updateStatus: async (id, attributes, options) => {
14032
14242
  return rb.execute(
14033
14243
  patchAdminExtractionDocumentsByIdStatus,
@@ -14040,7 +14250,20 @@ function createExtractionNamespace(rb) {
14040
14250
  options
14041
14251
  );
14042
14252
  },
14043
- /** Reprocess a completed document. */
14253
+ /**
14254
+ * Reprocesses a completed or failed document through the extraction
14255
+ * pipeline from scratch.
14256
+ *
14257
+ * @param id - The UUID of the document to reprocess.
14258
+ * @param options - Optional request options (abort signal, custom headers).
14259
+ * @returns The document object with its new processing status.
14260
+ *
14261
+ * @example
14262
+ * ```typescript
14263
+ * const doc = await admin.extraction.documents.reprocess('doc-uuid');
14264
+ * console.log(`Reprocessing: ${doc.status}`);
14265
+ * ```
14266
+ */
14044
14267
  reprocess: async (id, options) => {
14045
14268
  return rb.execute(
14046
14269
  patchAdminExtractionDocumentsByIdReprocess,
@@ -14048,7 +14271,18 @@ function createExtractionNamespace(rb) {
14048
14271
  options
14049
14272
  );
14050
14273
  },
14051
- /** Cancel a queued or processing document. */
14274
+ /**
14275
+ * Cancels a document that is currently queued or being processed.
14276
+ *
14277
+ * @param id - The UUID of the document to cancel.
14278
+ * @param options - Optional request options (abort signal, custom headers).
14279
+ * @returns The document object with its updated (cancelled) status.
14280
+ *
14281
+ * @example
14282
+ * ```typescript
14283
+ * const doc = await admin.extraction.documents.cancel('doc-uuid');
14284
+ * ```
14285
+ */
14052
14286
  cancel: async (id, options) => {
14053
14287
  return rb.execute(
14054
14288
  patchAdminExtractionDocumentsByIdCancel,
@@ -14056,7 +14290,19 @@ function createExtractionNamespace(rb) {
14056
14290
  options
14057
14291
  );
14058
14292
  },
14059
- /** Dismiss a document from the review queue. */
14293
+ /**
14294
+ * Dismisses a document from the review queue without changing its
14295
+ * underlying data or verification status.
14296
+ *
14297
+ * @param id - The UUID of the document to dismiss.
14298
+ * @param options - Optional request options (abort signal, custom headers).
14299
+ * @returns The updated extraction document object.
14300
+ *
14301
+ * @example
14302
+ * ```typescript
14303
+ * await admin.extraction.documents.dismiss('doc-uuid');
14304
+ * ```
14305
+ */
14060
14306
  dismiss: async (id, options) => {
14061
14307
  return rb.execute(
14062
14308
  patchAdminExtractionDocumentsByIdDismiss,
@@ -14064,7 +14310,19 @@ function createExtractionNamespace(rb) {
14064
14310
  options
14065
14311
  );
14066
14312
  },
14067
- /** Exclude a document from training. */
14313
+ /**
14314
+ * Excludes a document from the training dataset. Excluded documents are
14315
+ * not used when retraining extraction models.
14316
+ *
14317
+ * @param id - The UUID of the document to exclude.
14318
+ * @param options - Optional request options (abort signal, custom headers).
14319
+ * @returns The updated extraction document object.
14320
+ *
14321
+ * @example
14322
+ * ```typescript
14323
+ * await admin.extraction.documents.exclude('doc-uuid');
14324
+ * ```
14325
+ */
14068
14326
  exclude: async (id, options) => {
14069
14327
  return rb.execute(
14070
14328
  patchAdminExtractionDocumentsByIdExclude,
@@ -14072,7 +14330,18 @@ function createExtractionNamespace(rb) {
14072
14330
  options
14073
14331
  );
14074
14332
  },
14075
- /** Re-include a previously excluded document. */
14333
+ /**
14334
+ * Re-includes a previously excluded document in the training dataset.
14335
+ *
14336
+ * @param id - The UUID of the document to include.
14337
+ * @param options - Optional request options (abort signal, custom headers).
14338
+ * @returns The updated extraction document object.
14339
+ *
14340
+ * @example
14341
+ * ```typescript
14342
+ * await admin.extraction.documents.include('doc-uuid');
14343
+ * ```
14344
+ */
14076
14345
  include: async (id, options) => {
14077
14346
  return rb.execute(
14078
14347
  patchAdminExtractionDocumentsByIdInclude,
@@ -14080,7 +14349,19 @@ function createExtractionNamespace(rb) {
14080
14349
  options
14081
14350
  );
14082
14351
  },
14083
- /** Restore a soft-deleted document. */
14352
+ /**
14353
+ * Restores a soft-deleted (trashed) document back to active status.
14354
+ *
14355
+ * @param id - The UUID of the document to restore.
14356
+ * @param options - Optional request options (abort signal, custom headers).
14357
+ * @returns The restored extraction document object.
14358
+ *
14359
+ * @example
14360
+ * ```typescript
14361
+ * const doc = await admin.extraction.documents.restore('doc-uuid');
14362
+ * console.log(`Restored: ${doc.filename}`);
14363
+ * ```
14364
+ */
14084
14365
  restore: async (id, options) => {
14085
14366
  return rb.execute(
14086
14367
  patchAdminExtractionDocumentsByIdRestore,
@@ -14088,7 +14369,23 @@ function createExtractionNamespace(rb) {
14088
14369
  options
14089
14370
  );
14090
14371
  },
14091
- /** Update verification status of a document. */
14372
+ /**
14373
+ * Updates the verification status of a document. Used during the human
14374
+ * review step to confirm or reject extracted data.
14375
+ *
14376
+ * @param id - The UUID of the document to update.
14377
+ * @param attributes - Verification attributes to set.
14378
+ * @param options - Optional request options (abort signal, custom headers).
14379
+ * @returns The updated extraction document object.
14380
+ *
14381
+ * @example
14382
+ * ```typescript
14383
+ * const doc = await admin.extraction.documents.updateVerification('doc-uuid', {
14384
+ * verification_status: 'verified',
14385
+ * avg_confidence: 0.95,
14386
+ * });
14387
+ * ```
14388
+ */
14092
14389
  updateVerification: async (id, attributes, options) => {
14093
14390
  return rb.execute(
14094
14391
  patchAdminExtractionDocumentsByIdVerification,
@@ -14101,7 +14398,19 @@ function createExtractionNamespace(rb) {
14101
14398
  options
14102
14399
  );
14103
14400
  },
14104
- /** Mark a document as trained. */
14401
+ /**
14402
+ * Marks a document as trained, indicating its extraction results have been
14403
+ * incorporated into the model training set.
14404
+ *
14405
+ * @param id - The UUID of the document to mark as trained.
14406
+ * @param options - Optional request options (abort signal, custom headers).
14407
+ * @returns The updated extraction document object.
14408
+ *
14409
+ * @example
14410
+ * ```typescript
14411
+ * await admin.extraction.documents.markTrained('doc-uuid');
14412
+ * ```
14413
+ */
14105
14414
  markTrained: async (id, options) => {
14106
14415
  return rb.execute(
14107
14416
  patchAdminExtractionDocumentsByIdMarkTrained,
@@ -14109,7 +14418,19 @@ function createExtractionNamespace(rb) {
14109
14418
  options
14110
14419
  );
14111
14420
  },
14112
- /** Dismiss training flag on a document. */
14421
+ /**
14422
+ * Dismisses the training flag on a document without un-training it.
14423
+ * Useful for clearing training notifications in the review UI.
14424
+ *
14425
+ * @param id - The UUID of the document.
14426
+ * @param options - Optional request options (abort signal, custom headers).
14427
+ * @returns The updated extraction document object.
14428
+ *
14429
+ * @example
14430
+ * ```typescript
14431
+ * await admin.extraction.documents.dismissTraining('doc-uuid');
14432
+ * ```
14433
+ */
14113
14434
  dismissTraining: async (id, options) => {
14114
14435
  return rb.execute(
14115
14436
  patchAdminExtractionDocumentsByIdDismissTraining,
@@ -14117,7 +14438,19 @@ function createExtractionNamespace(rb) {
14117
14438
  options
14118
14439
  );
14119
14440
  },
14120
- /** Finish a multi-part upload. */
14441
+ /**
14442
+ * Signals the server that a multi-part upload has completed and the
14443
+ * document is ready for processing.
14444
+ *
14445
+ * @param id - The UUID of the document whose upload is being finalized.
14446
+ * @param options - Optional request options (abort signal, custom headers).
14447
+ * @returns The document object transitioned to processing state.
14448
+ *
14449
+ * @example
14450
+ * ```typescript
14451
+ * await admin.extraction.documents.finishUpload('doc-uuid');
14452
+ * ```
14453
+ */
14121
14454
  finishUpload: async (id, options) => {
14122
14455
  return rb.execute(
14123
14456
  patchAdminExtractionDocumentsByIdFinishUpload,
@@ -14125,31 +14458,82 @@ function createExtractionNamespace(rb) {
14125
14458
  options
14126
14459
  );
14127
14460
  },
14128
- /** Begin a new document upload and get a presigned URL. */
14461
+ /**
14462
+ * Begins a new document upload and returns a presigned URL for direct
14463
+ * browser-to-storage upload.
14464
+ *
14465
+ * @param attributes - Upload attributes including the filename and optional metadata.
14466
+ * @param options - Optional request options (abort signal, custom headers).
14467
+ * @returns A presigned URL object for uploading the file.
14468
+ *
14469
+ * @example
14470
+ * ```typescript
14471
+ * const presigned = await admin.extraction.documents.beginUpload({
14472
+ * filename: 'invoice-2026.pdf',
14473
+ * content_type: 'application/pdf',
14474
+ * agent_id: 'agent-uuid',
14475
+ * workspace_id: 'ws-uuid',
14476
+ * });
14477
+ * // Upload file to presigned.upload_url
14478
+ * ```
14479
+ */
14129
14480
  beginUpload: async (attributes, options) => {
14130
14481
  return rb.execute(
14131
14482
  postAdminExtractionDocumentsBeginUpload,
14132
14483
  {
14133
14484
  body: {
14134
- data: { type: "presigned-url", attributes }
14485
+ data: { type: "extraction-document", attributes }
14135
14486
  }
14136
14487
  },
14137
14488
  options
14138
14489
  );
14139
14490
  },
14140
- /** Find an existing document by hash or begin a new upload. */
14491
+ /**
14492
+ * Finds an existing document by file hash (for deduplication) or begins a
14493
+ * new upload if no match is found.
14494
+ *
14495
+ * @param attributes - Attributes for finding or beginning the upload.
14496
+ * @param options - Optional request options (abort signal, custom headers).
14497
+ * @returns A presigned URL object (or a reference to the existing document).
14498
+ *
14499
+ * @example
14500
+ * ```typescript
14501
+ * const result = await admin.extraction.documents.findOrBeginUpload({
14502
+ * file_hash: 'sha256:abc123...',
14503
+ * filename: 'invoice-2026.pdf',
14504
+ * content_type: 'application/pdf',
14505
+ * });
14506
+ * ```
14507
+ */
14141
14508
  findOrBeginUpload: async (attributes, options) => {
14142
14509
  return rb.execute(
14143
14510
  postAdminExtractionDocumentsFindOrBeginUpload,
14144
14511
  {
14145
14512
  body: {
14146
- data: { type: "presigned-url", attributes }
14513
+ data: { type: "extraction-document", attributes }
14147
14514
  }
14148
14515
  },
14149
14516
  options
14150
14517
  );
14151
14518
  },
14152
- /** Upload a document directly (single-shot). */
14519
+ /**
14520
+ * Uploads a document directly in a single shot. The server handles storage
14521
+ * placement and immediately enqueues the document for processing.
14522
+ *
14523
+ * @param attributes - Upload attributes including filename and optional storage path.
14524
+ * @param options - Optional request options (abort signal, custom headers).
14525
+ * @returns The created extraction document object.
14526
+ *
14527
+ * @example
14528
+ * ```typescript
14529
+ * const doc = await admin.extraction.documents.upload({
14530
+ * filename: 'contract.pdf',
14531
+ * content_type: 'application/pdf',
14532
+ * agent_id: 'agent-uuid',
14533
+ * workspace_id: 'ws-uuid',
14534
+ * });
14535
+ * ```
14536
+ */
14153
14537
  upload: async (attributes, options) => {
14154
14538
  return rb.execute(
14155
14539
  postAdminExtractionDocumentsUpload,
@@ -14161,7 +14545,22 @@ function createExtractionNamespace(rb) {
14161
14545
  options
14162
14546
  );
14163
14547
  },
14164
- /** Bulk reprocess multiple documents. */
14548
+ /**
14549
+ * Reprocesses multiple documents in a single bulk operation.
14550
+ *
14551
+ * @param ids - An array of document UUIDs to reprocess.
14552
+ * @param options - Optional request options (abort signal, custom headers).
14553
+ * @returns An operation success result with the count of enqueued documents.
14554
+ *
14555
+ * @example
14556
+ * ```typescript
14557
+ * const result = await admin.extraction.documents.bulkReprocess([
14558
+ * 'doc-uuid-1',
14559
+ * 'doc-uuid-2',
14560
+ * ]);
14561
+ * console.log(`Enqueued: ${result.enqueued_count}`);
14562
+ * ```
14563
+ */
14165
14564
  bulkReprocess: async (ids, options) => {
14166
14565
  return rb.execute(
14167
14566
  postAdminExtractionDocumentsBulkReprocess,
@@ -14169,30 +14568,67 @@ function createExtractionNamespace(rb) {
14169
14568
  body: {
14170
14569
  data: {
14171
14570
  type: "bulk-reprocess-result",
14172
- attributes: { ids }
14571
+ attributes: { document_ids: ids }
14173
14572
  }
14174
14573
  }
14175
14574
  },
14176
14575
  options
14177
14576
  );
14178
14577
  },
14179
- /** Bulk delete multiple documents. */
14578
+ /**
14579
+ * Permanently deletes multiple documents in a single bulk operation.
14580
+ *
14581
+ * @param ids - An array of document UUIDs to delete.
14582
+ * @param options - Optional request options (abort signal, custom headers).
14583
+ * @returns An operation success result with the count of deleted documents.
14584
+ *
14585
+ * @example
14586
+ * ```typescript
14587
+ * const result = await admin.extraction.documents.bulkDelete([
14588
+ * 'doc-uuid-1',
14589
+ * 'doc-uuid-2',
14590
+ * ]);
14591
+ * console.log(`Deleted: ${result.deleted_count}`);
14592
+ * ```
14593
+ */
14180
14594
  bulkDelete: async (ids, options) => {
14181
14595
  return rb.execute(
14182
14596
  postAdminDocumentsBulkDelete,
14183
14597
  {
14184
14598
  body: {
14185
- data: { type: "bulk-delete", attributes: { ids } }
14599
+ data: { type: "operation-success", attributes: { ids } }
14186
14600
  }
14187
14601
  },
14188
14602
  options
14189
14603
  );
14190
14604
  },
14191
- /** Get platform-wide document statistics. */
14605
+ /**
14606
+ * Retrieves platform-wide document statistics including counts by status.
14607
+ *
14608
+ * @param options - Optional request options (abort signal, custom headers).
14609
+ * @returns Aggregate document statistics.
14610
+ *
14611
+ * @example
14612
+ * ```typescript
14613
+ * const stats = await admin.extraction.documents.stats();
14614
+ * console.log(`Total: ${stats.total}, Failed: ${stats.failed}`);
14615
+ * ```
14616
+ */
14192
14617
  stats: async (options) => {
14193
14618
  return rb.execute(getAdminDocumentsStats, {}, options);
14194
14619
  },
14195
- /** List documents for a specific workspace. */
14620
+ /**
14621
+ * Lists all extraction documents belonging to a specific workspace.
14622
+ *
14623
+ * @param workspaceId - The UUID of the workspace.
14624
+ * @param options - Optional request options (abort signal, custom headers).
14625
+ * @returns An array of extraction documents for the workspace.
14626
+ *
14627
+ * @example
14628
+ * ```typescript
14629
+ * const docs = await admin.extraction.documents.listByWorkspace('ws-uuid');
14630
+ * ```
14631
+ */
14196
14632
  listByWorkspace: async (workspaceId, options) => {
14197
14633
  return rb.execute(
14198
14634
  getAdminExtractionDocumentsWorkspaceByWorkspaceId,
@@ -14200,7 +14636,20 @@ function createExtractionNamespace(rb) {
14200
14636
  options
14201
14637
  );
14202
14638
  },
14203
- /** List documents by status for a workspace. */
14639
+ /**
14640
+ * Lists documents filtered by processing status within a workspace.
14641
+ *
14642
+ * @param workspaceId - The UUID of the workspace.
14643
+ * @param status - The processing status to filter by (e.g. `"completed"`, `"failed"`).
14644
+ * @param options - Optional request options (abort signal, custom headers).
14645
+ * @returns An array of extraction documents matching the status filter.
14646
+ *
14647
+ * @example
14648
+ * ```typescript
14649
+ * const failed = await admin.extraction.documents.listByStatus('ws-uuid', 'failed');
14650
+ * console.log(`${failed.length} failed documents`);
14651
+ * ```
14652
+ */
14204
14653
  listByStatus: async (workspaceId, status, options) => {
14205
14654
  return rb.execute(
14206
14655
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdByStatusByStatus,
@@ -14208,7 +14657,20 @@ function createExtractionNamespace(rb) {
14208
14657
  options
14209
14658
  );
14210
14659
  },
14211
- /** Get the review queue for a workspace. */
14660
+ /**
14661
+ * Returns the review queue for a workspace — documents awaiting human
14662
+ * verification of their extraction results.
14663
+ *
14664
+ * @param workspaceId - The UUID of the workspace.
14665
+ * @param options - Optional request options (abort signal, custom headers).
14666
+ * @returns An array of documents in the review queue.
14667
+ *
14668
+ * @example
14669
+ * ```typescript
14670
+ * const queue = await admin.extraction.documents.reviewQueue('ws-uuid');
14671
+ * console.log(`${queue.length} documents awaiting review`);
14672
+ * ```
14673
+ */
14212
14674
  reviewQueue: async (workspaceId, options) => {
14213
14675
  return rb.execute(
14214
14676
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdReviewQueue,
@@ -14216,7 +14678,18 @@ function createExtractionNamespace(rb) {
14216
14678
  options
14217
14679
  );
14218
14680
  },
14219
- /** List trained documents for a workspace. */
14681
+ /**
14682
+ * Lists documents that have been marked as trained within a workspace.
14683
+ *
14684
+ * @param workspaceId - The UUID of the workspace.
14685
+ * @param options - Optional request options (abort signal, custom headers).
14686
+ * @returns An array of trained extraction documents.
14687
+ *
14688
+ * @example
14689
+ * ```typescript
14690
+ * const trained = await admin.extraction.documents.listTrained('ws-uuid');
14691
+ * ```
14692
+ */
14220
14693
  listTrained: async (workspaceId, options) => {
14221
14694
  return rb.execute(
14222
14695
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdTrained,
@@ -14224,7 +14697,19 @@ function createExtractionNamespace(rb) {
14224
14697
  options
14225
14698
  );
14226
14699
  },
14227
- /** List trashed (soft-deleted) documents for a workspace. */
14700
+ /**
14701
+ * Lists soft-deleted (trashed) documents for a workspace. These can be
14702
+ * restored via the `restore` method.
14703
+ *
14704
+ * @param workspaceId - The UUID of the workspace.
14705
+ * @param options - Optional request options (abort signal, custom headers).
14706
+ * @returns An array of trashed extraction documents.
14707
+ *
14708
+ * @example
14709
+ * ```typescript
14710
+ * const trashed = await admin.extraction.documents.listTrashed('ws-uuid');
14711
+ * ```
14712
+ */
14228
14713
  listTrashed: async (workspaceId, options) => {
14229
14714
  return rb.execute(
14230
14715
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdTrashed,
@@ -14232,7 +14717,19 @@ function createExtractionNamespace(rb) {
14232
14717
  options
14233
14718
  );
14234
14719
  },
14235
- /** List excluded documents for a workspace. */
14720
+ /**
14721
+ * Lists documents that have been excluded from the training dataset
14722
+ * within a workspace.
14723
+ *
14724
+ * @param workspaceId - The UUID of the workspace.
14725
+ * @param options - Optional request options (abort signal, custom headers).
14726
+ * @returns An array of excluded extraction documents.
14727
+ *
14728
+ * @example
14729
+ * ```typescript
14730
+ * const excluded = await admin.extraction.documents.listExcluded('ws-uuid');
14731
+ * ```
14732
+ */
14236
14733
  listExcluded: async (workspaceId, options) => {
14237
14734
  return rb.execute(
14238
14735
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdExcluded,
@@ -14240,7 +14737,20 @@ function createExtractionNamespace(rb) {
14240
14737
  options
14241
14738
  );
14242
14739
  },
14243
- /** Dismiss all trained documents in a workspace. */
14740
+ /**
14741
+ * Dismisses all trained-flagged documents in a workspace in one operation.
14742
+ * Useful for clearing training notifications after a batch review.
14743
+ *
14744
+ * @param workspaceId - The UUID of the workspace.
14745
+ * @param options - Optional request options (abort signal, custom headers).
14746
+ * @returns An operation success result with the dismissed count.
14747
+ *
14748
+ * @example
14749
+ * ```typescript
14750
+ * const result = await admin.extraction.documents.dismissAllTrained('ws-uuid');
14751
+ * console.log(`Dismissed ${result.dismissed_count} documents`);
14752
+ * ```
14753
+ */
14244
14754
  dismissAllTrained: async (workspaceId, options) => {
14245
14755
  return rb.execute(
14246
14756
  postAdminWorkspacesByWorkspaceIdExtractionDocumentsDismissAllTrained,
@@ -14254,7 +14764,17 @@ function createExtractionNamespace(rb) {
14254
14764
  },
14255
14765
  /** Extraction result management — CRUD, history, corrections, regeneration. */
14256
14766
  results: {
14257
- /** List all extraction results. */
14767
+ /**
14768
+ * Lists all extraction results across the platform.
14769
+ *
14770
+ * @param options - Optional request options (abort signal, custom headers).
14771
+ * @returns An array of extraction result objects.
14772
+ *
14773
+ * @example
14774
+ * ```typescript
14775
+ * const results = await admin.extraction.results.list();
14776
+ * ```
14777
+ */
14258
14778
  list: async (options) => {
14259
14779
  return rb.execute(
14260
14780
  getAdminExtractionResults,
@@ -14262,7 +14782,19 @@ function createExtractionNamespace(rb) {
14262
14782
  options
14263
14783
  );
14264
14784
  },
14265
- /** Get an extraction result by ID. */
14785
+ /**
14786
+ * Retrieves a single extraction result by its unique identifier.
14787
+ *
14788
+ * @param id - The UUID of the extraction result.
14789
+ * @param options - Optional request options (abort signal, custom headers).
14790
+ * @returns The matching extraction result object.
14791
+ *
14792
+ * @example
14793
+ * ```typescript
14794
+ * const result = await admin.extraction.results.get('result-uuid');
14795
+ * console.log(result.extracted_data);
14796
+ * ```
14797
+ */
14266
14798
  get: async (id, options) => {
14267
14799
  return rb.execute(
14268
14800
  getAdminExtractionResultsById,
@@ -14270,7 +14802,21 @@ function createExtractionNamespace(rb) {
14270
14802
  options
14271
14803
  );
14272
14804
  },
14273
- /** Update an extraction result. */
14805
+ /**
14806
+ * Updates an extraction result's metadata (e.g. review status).
14807
+ *
14808
+ * @param id - The UUID of the extraction result to update.
14809
+ * @param attributes - The attributes to update.
14810
+ * @param options - Optional request options (abort signal, custom headers).
14811
+ * @returns The updated extraction result object.
14812
+ *
14813
+ * @example
14814
+ * ```typescript
14815
+ * const result = await admin.extraction.results.update('result-uuid', {
14816
+ * review_status: 'approved',
14817
+ * });
14818
+ * ```
14819
+ */
14274
14820
  update: async (id, attributes, options) => {
14275
14821
  return rb.execute(
14276
14822
  patchAdminExtractionResultsById,
@@ -14283,7 +14829,18 @@ function createExtractionNamespace(rb) {
14283
14829
  options
14284
14830
  );
14285
14831
  },
14286
- /** Delete an extraction result. */
14832
+ /**
14833
+ * Permanently deletes an extraction result.
14834
+ *
14835
+ * @param id - The UUID of the extraction result to delete.
14836
+ * @param options - Optional request options (abort signal, custom headers).
14837
+ * @returns `true` when the deletion succeeds.
14838
+ *
14839
+ * @example
14840
+ * ```typescript
14841
+ * await admin.extraction.results.delete('result-uuid');
14842
+ * ```
14843
+ */
14287
14844
  delete: async (id, options) => {
14288
14845
  return rb.executeDelete(
14289
14846
  deleteAdminExtractionResultsById,
@@ -14291,7 +14848,18 @@ function createExtractionNamespace(rb) {
14291
14848
  options
14292
14849
  );
14293
14850
  },
14294
- /** Get extraction results for a specific document. */
14851
+ /**
14852
+ * Retrieves all extraction results for a specific document.
14853
+ *
14854
+ * @param documentId - The UUID of the parent document.
14855
+ * @param options - Optional request options (abort signal, custom headers).
14856
+ * @returns An array of extraction results for the document.
14857
+ *
14858
+ * @example
14859
+ * ```typescript
14860
+ * const results = await admin.extraction.results.byDocument('doc-uuid');
14861
+ * ```
14862
+ */
14295
14863
  byDocument: async (documentId, options) => {
14296
14864
  return rb.execute(
14297
14865
  getAdminExtractionResultsDocumentByDocumentId,
@@ -14299,7 +14867,20 @@ function createExtractionNamespace(rb) {
14299
14867
  options
14300
14868
  );
14301
14869
  },
14302
- /** Get extraction result version history for a document. */
14870
+ /**
14871
+ * Retrieves the version history of extraction results for a document,
14872
+ * showing how results have changed over reprocessing cycles.
14873
+ *
14874
+ * @param documentId - The UUID of the parent document.
14875
+ * @param options - Optional request options (abort signal, custom headers).
14876
+ * @returns An array of historical extraction result versions.
14877
+ *
14878
+ * @example
14879
+ * ```typescript
14880
+ * const history = await admin.extraction.results.history('doc-uuid');
14881
+ * console.log(`${history.length} result versions`);
14882
+ * ```
14883
+ */
14303
14884
  history: async (documentId, options) => {
14304
14885
  return rb.execute(
14305
14886
  getAdminExtractionResultsDocumentByDocumentIdHistory,
@@ -14307,7 +14888,19 @@ function createExtractionNamespace(rb) {
14307
14888
  options
14308
14889
  );
14309
14890
  },
14310
- /** Get partial extraction results for a document (in-progress). */
14891
+ /**
14892
+ * Retrieves partial (in-progress) extraction results for a document that
14893
+ * is still being processed.
14894
+ *
14895
+ * @param documentId - The UUID of the parent document.
14896
+ * @param options - Optional request options (abort signal, custom headers).
14897
+ * @returns An array of partial extraction results available so far.
14898
+ *
14899
+ * @example
14900
+ * ```typescript
14901
+ * const partial = await admin.extraction.results.partial('doc-uuid');
14902
+ * ```
14903
+ */
14311
14904
  partial: async (documentId, options) => {
14312
14905
  return rb.execute(
14313
14906
  getAdminExtractionResultsDocumentByDocumentIdPartial,
@@ -14315,7 +14908,23 @@ function createExtractionNamespace(rb) {
14315
14908
  options
14316
14909
  );
14317
14910
  },
14318
- /** Regenerate an extraction result with optional feedback. */
14911
+ /**
14912
+ * Regenerates an extraction result, optionally incorporating human
14913
+ * feedback or restricting which fields to retry.
14914
+ *
14915
+ * @param id - The UUID of the extraction result to regenerate.
14916
+ * @param attributes - Regeneration parameters (feedback, fields to retry).
14917
+ * @param options - Optional request options (abort signal, custom headers).
14918
+ * @returns The regenerated extraction result object.
14919
+ *
14920
+ * @example
14921
+ * ```typescript
14922
+ * const result = await admin.extraction.results.regenerate('result-uuid', {
14923
+ * feedback: 'The date field was parsed incorrectly.',
14924
+ * fields_to_retry: ['invoice_date', 'due_date'],
14925
+ * });
14926
+ * ```
14927
+ */
14319
14928
  regenerate: async (id, attributes, options) => {
14320
14929
  return rb.execute(
14321
14930
  patchAdminExtractionResultsByIdRegenerate,
@@ -14328,7 +14937,25 @@ function createExtractionNamespace(rb) {
14328
14937
  options
14329
14938
  );
14330
14939
  },
14331
- /** Save manual corrections to an extraction result. */
14940
+ /**
14941
+ * Saves manual corrections to an extraction result. The corrections are
14942
+ * stored alongside the original data and can be used for model training.
14943
+ *
14944
+ * @param id - The UUID of the extraction result to correct.
14945
+ * @param attributes - The corrections to save.
14946
+ * @param options - Optional request options (abort signal, custom headers).
14947
+ * @returns The updated extraction result object with corrections applied.
14948
+ *
14949
+ * @example
14950
+ * ```typescript
14951
+ * const result = await admin.extraction.results.saveCorrections('result-uuid', {
14952
+ * corrections: [
14953
+ * { field: 'invoice_number', value: 'INV-2026-001' },
14954
+ * { field: 'total_amount', value: 1250.00 },
14955
+ * ],
14956
+ * });
14957
+ * ```
14958
+ */
14332
14959
  saveCorrections: async (id, attributes, options) => {
14333
14960
  return rb.execute(
14334
14961
  patchAdminExtractionResultsByIdSaveCorrections,
@@ -14341,7 +14968,18 @@ function createExtractionNamespace(rb) {
14341
14968
  options
14342
14969
  );
14343
14970
  },
14344
- /** List extraction results for a workspace. */
14971
+ /**
14972
+ * Lists all extraction results belonging to a specific workspace.
14973
+ *
14974
+ * @param workspaceId - The UUID of the workspace.
14975
+ * @param options - Optional request options (abort signal, custom headers).
14976
+ * @returns An array of extraction results for the workspace.
14977
+ *
14978
+ * @example
14979
+ * ```typescript
14980
+ * const results = await admin.extraction.results.listByWorkspace('ws-uuid');
14981
+ * ```
14982
+ */
14345
14983
  listByWorkspace: async (workspaceId, options) => {
14346
14984
  return rb.execute(
14347
14985
  getAdminExtractionResultsWorkspaceByWorkspaceId,
@@ -14352,7 +14990,19 @@ function createExtractionNamespace(rb) {
14352
14990
  },
14353
14991
  /** Batch upload management — create batches, get upload URLs. */
14354
14992
  batches: {
14355
- /** Get a batch by ID. */
14993
+ /**
14994
+ * Retrieves a single extraction batch by its unique identifier.
14995
+ *
14996
+ * @param id - The UUID of the batch.
14997
+ * @param options - Optional request options (abort signal, custom headers).
14998
+ * @returns The matching extraction batch object.
14999
+ *
15000
+ * @example
15001
+ * ```typescript
15002
+ * const batch = await admin.extraction.batches.get('batch-uuid');
15003
+ * console.log(`Batch: ${batch.name}, ${batch.document_count} docs`);
15004
+ * ```
15005
+ */
14356
15006
  get: async (id, options) => {
14357
15007
  return rb.execute(
14358
15008
  getAdminExtractionBatchesById,
@@ -14360,7 +15010,18 @@ function createExtractionNamespace(rb) {
14360
15010
  options
14361
15011
  );
14362
15012
  },
14363
- /** Delete a batch. */
15013
+ /**
15014
+ * Permanently deletes an extraction batch.
15015
+ *
15016
+ * @param id - The UUID of the batch to delete.
15017
+ * @param options - Optional request options (abort signal, custom headers).
15018
+ * @returns `true` when the deletion succeeds.
15019
+ *
15020
+ * @example
15021
+ * ```typescript
15022
+ * await admin.extraction.batches.delete('batch-uuid');
15023
+ * ```
15024
+ */
14364
15025
  delete: async (id, options) => {
14365
15026
  return rb.executeDelete(
14366
15027
  deleteAdminExtractionBatchesById,
@@ -14368,7 +15029,22 @@ function createExtractionNamespace(rb) {
14368
15029
  options
14369
15030
  );
14370
15031
  },
14371
- /** Create a new batch. */
15032
+ /**
15033
+ * Creates a new extraction batch for grouping document uploads.
15034
+ *
15035
+ * @param attributes - Batch creation attributes including workspace ID.
15036
+ * @param options - Optional request options (abort signal, custom headers).
15037
+ * @returns The newly created extraction batch object.
15038
+ *
15039
+ * @example
15040
+ * ```typescript
15041
+ * const batch = await admin.extraction.batches.create({
15042
+ * name: 'Q1 Invoices',
15043
+ * workspace_id: 'ws-uuid',
15044
+ * agent_id: 'agent-uuid',
15045
+ * });
15046
+ * ```
15047
+ */
14372
15048
  create: async (attributes, options) => {
14373
15049
  return rb.execute(
14374
15050
  postAdminExtractionBatches,
@@ -14380,7 +15056,18 @@ function createExtractionNamespace(rb) {
14380
15056
  options
14381
15057
  );
14382
15058
  },
14383
- /** List batches for a workspace. */
15059
+ /**
15060
+ * Lists all extraction batches belonging to a specific workspace.
15061
+ *
15062
+ * @param workspaceId - The UUID of the workspace.
15063
+ * @param options - Optional request options (abort signal, custom headers).
15064
+ * @returns An array of extraction batches for the workspace.
15065
+ *
15066
+ * @example
15067
+ * ```typescript
15068
+ * const batches = await admin.extraction.batches.listByWorkspace('ws-uuid');
15069
+ * ```
15070
+ */
14384
15071
  listByWorkspace: async (workspaceId, options) => {
14385
15072
  return rb.execute(
14386
15073
  getAdminExtractionBatchesWorkspaceByWorkspaceId,
@@ -14388,7 +15075,24 @@ function createExtractionNamespace(rb) {
14388
15075
  options
14389
15076
  );
14390
15077
  },
14391
- /** Get presigned upload URLs for a batch. */
15078
+ /**
15079
+ * Retrieves presigned upload URLs for all documents in a batch, enabling
15080
+ * parallel direct-to-storage uploads.
15081
+ *
15082
+ * @param id - The UUID of the batch.
15083
+ * @param options - Optional request options (abort signal, custom headers).
15084
+ * @returns An array of presigned URL objects, one per document slot.
15085
+ *
15086
+ * @example
15087
+ * ```typescript
15088
+ * const urls = await admin.extraction.batches.getUploadUrls('batch-uuid');
15089
+ * // Upload files in parallel to each presigned URL
15090
+ * await Promise.all(urls.map((u, i) => fetch(u.upload_url, {
15091
+ * method: 'PUT',
15092
+ * body: files[i],
15093
+ * })));
15094
+ * ```
15095
+ */
14392
15096
  getUploadUrls: async (id, options) => {
14393
15097
  return rb.execute(
14394
15098
  getAdminExtractionBatchesByIdUploadUrls,
@@ -14399,7 +15103,18 @@ function createExtractionNamespace(rb) {
14399
15103
  },
14400
15104
  /** Export management — create and retrieve data exports. */
14401
15105
  exports: {
14402
- /** List exports for a workspace. */
15106
+ /**
15107
+ * Lists all extraction exports for a workspace.
15108
+ *
15109
+ * @param workspaceId - The UUID of the workspace.
15110
+ * @param options - Optional request options (abort signal, custom headers).
15111
+ * @returns An array of extraction export objects.
15112
+ *
15113
+ * @example
15114
+ * ```typescript
15115
+ * const exports = await admin.extraction.exports.list('ws-uuid');
15116
+ * ```
15117
+ */
14403
15118
  list: async (workspaceId, options) => {
14404
15119
  return rb.execute(
14405
15120
  getAdminWorkspacesByWorkspaceIdExtractionExports,
@@ -14407,7 +15122,23 @@ function createExtractionNamespace(rb) {
14407
15122
  options
14408
15123
  );
14409
15124
  },
14410
- /** Create a new export for a workspace. */
15125
+ /**
15126
+ * Creates a new data export for a workspace in the specified format.
15127
+ *
15128
+ * @param workspaceId - The UUID of the workspace.
15129
+ * @param attributes - Export creation attributes including format.
15130
+ * @param options - Optional request options (abort signal, custom headers).
15131
+ * @returns The newly created extraction export object.
15132
+ *
15133
+ * @example
15134
+ * ```typescript
15135
+ * const exp = await admin.extraction.exports.create('ws-uuid', {
15136
+ * format: 'csv',
15137
+ * agent_id: 'agent-uuid',
15138
+ * });
15139
+ * console.log(`Export ${exp.id} created, status: ${exp.status}`);
15140
+ * ```
15141
+ */
14411
15142
  create: async (workspaceId, attributes, options) => {
14412
15143
  return rb.execute(
14413
15144
  postAdminWorkspacesByWorkspaceIdExtractionExports,
@@ -14420,7 +15151,23 @@ function createExtractionNamespace(rb) {
14420
15151
  options
14421
15152
  );
14422
15153
  },
14423
- /** Get an export by ID. */
15154
+ /**
15155
+ * Retrieves a single extraction export by ID within a workspace.
15156
+ *
15157
+ * @param workspaceId - The UUID of the workspace.
15158
+ * @param id - The UUID of the export to retrieve.
15159
+ * @param options - Optional request options (abort signal, custom headers).
15160
+ * @returns The matching extraction export object, including download URL
15161
+ * when the export is complete.
15162
+ *
15163
+ * @example
15164
+ * ```typescript
15165
+ * const exp = await admin.extraction.exports.get('ws-uuid', 'export-uuid');
15166
+ * if (exp.status === 'completed') {
15167
+ * console.log(`Download: ${exp.download_url}`);
15168
+ * }
15169
+ * ```
15170
+ */
14424
15171
  get: async (workspaceId, id, options) => {
14425
15172
  return rb.execute(
14426
15173
  getAdminWorkspacesByWorkspaceIdExtractionExportsById,
@@ -14431,7 +15178,17 @@ function createExtractionNamespace(rb) {
14431
15178
  },
14432
15179
  /** Workflow management — configurable extraction pipelines. */
14433
15180
  workflows: {
14434
- /** List all extraction workflows. */
15181
+ /**
15182
+ * Lists all extraction workflows across the platform.
15183
+ *
15184
+ * @param options - Optional request options (abort signal, custom headers).
15185
+ * @returns An array of extraction workflow objects.
15186
+ *
15187
+ * @example
15188
+ * ```typescript
15189
+ * const workflows = await admin.extraction.workflows.list();
15190
+ * ```
15191
+ */
14435
15192
  list: async (options) => {
14436
15193
  return rb.execute(
14437
15194
  getAdminExtractionWorkflows,
@@ -14439,7 +15196,21 @@ function createExtractionNamespace(rb) {
14439
15196
  options
14440
15197
  );
14441
15198
  },
14442
- /** Create a new extraction workflow. */
15199
+ /**
15200
+ * Creates a new extraction workflow with the specified configuration.
15201
+ *
15202
+ * @param attributes - Workflow creation attributes including name.
15203
+ * @param options - Optional request options (abort signal, custom headers).
15204
+ * @returns The newly created extraction workflow object.
15205
+ *
15206
+ * @example
15207
+ * ```typescript
15208
+ * const workflow = await admin.extraction.workflows.create({
15209
+ * name: 'Invoice Processing',
15210
+ * workspace_id: 'ws-uuid',
15211
+ * });
15212
+ * ```
15213
+ */
14443
15214
  create: async (attributes, options) => {
14444
15215
  return rb.execute(
14445
15216
  postAdminExtractionWorkflows,
@@ -14451,7 +15222,18 @@ function createExtractionNamespace(rb) {
14451
15222
  options
14452
15223
  );
14453
15224
  },
14454
- /** Get a workflow by ID. */
15225
+ /**
15226
+ * Retrieves a single extraction workflow by its unique identifier.
15227
+ *
15228
+ * @param id - The UUID of the workflow.
15229
+ * @param options - Optional request options (abort signal, custom headers).
15230
+ * @returns The matching extraction workflow object.
15231
+ *
15232
+ * @example
15233
+ * ```typescript
15234
+ * const workflow = await admin.extraction.workflows.get('workflow-uuid');
15235
+ * ```
15236
+ */
14455
15237
  get: async (id, options) => {
14456
15238
  return rb.execute(
14457
15239
  getAdminExtractionWorkflowsById,
@@ -14459,7 +15241,21 @@ function createExtractionNamespace(rb) {
14459
15241
  options
14460
15242
  );
14461
15243
  },
14462
- /** Update a workflow. */
15244
+ /**
15245
+ * Updates an existing extraction workflow's configuration.
15246
+ *
15247
+ * @param id - The UUID of the workflow to update.
15248
+ * @param attributes - The attributes to update.
15249
+ * @param options - Optional request options (abort signal, custom headers).
15250
+ * @returns The updated extraction workflow object.
15251
+ *
15252
+ * @example
15253
+ * ```typescript
15254
+ * const workflow = await admin.extraction.workflows.update('workflow-uuid', {
15255
+ * name: 'Updated Invoice Pipeline',
15256
+ * });
15257
+ * ```
15258
+ */
14463
15259
  update: async (id, attributes, options) => {
14464
15260
  return rb.execute(
14465
15261
  patchAdminExtractionWorkflowsById,
@@ -14472,7 +15268,18 @@ function createExtractionNamespace(rb) {
14472
15268
  options
14473
15269
  );
14474
15270
  },
14475
- /** Delete a workflow. */
15271
+ /**
15272
+ * Permanently deletes an extraction workflow.
15273
+ *
15274
+ * @param id - The UUID of the workflow to delete.
15275
+ * @param options - Optional request options (abort signal, custom headers).
15276
+ * @returns `true` when the deletion succeeds.
15277
+ *
15278
+ * @example
15279
+ * ```typescript
15280
+ * await admin.extraction.workflows.delete('workflow-uuid');
15281
+ * ```
15282
+ */
14476
15283
  delete: async (id, options) => {
14477
15284
  return rb.executeDelete(
14478
15285
  deleteAdminExtractionWorkflowsById,
@@ -14483,7 +15290,18 @@ function createExtractionNamespace(rb) {
14483
15290
  },
14484
15291
  /** Config enum management — dropdown and validation values. */
14485
15292
  configEnums: {
14486
- /** List all config enums. */
15293
+ /**
15294
+ * Lists all config enums used for extraction field validation and
15295
+ * dropdown options.
15296
+ *
15297
+ * @param options - Optional request options (abort signal, custom headers).
15298
+ * @returns An array of config enum objects.
15299
+ *
15300
+ * @example
15301
+ * ```typescript
15302
+ * const enums = await admin.extraction.configEnums.list();
15303
+ * ```
15304
+ */
14487
15305
  list: async (options) => {
14488
15306
  return rb.execute(
14489
15307
  getAdminExtractionConfigEnums,
@@ -14491,7 +15309,23 @@ function createExtractionNamespace(rb) {
14491
15309
  options
14492
15310
  );
14493
15311
  },
14494
- /** Create a new config enum. */
15312
+ /**
15313
+ * Creates a new config enum value for use in extraction field dropdowns
15314
+ * and validation.
15315
+ *
15316
+ * @param attributes - Config enum creation attributes.
15317
+ * @param options - Optional request options (abort signal, custom headers).
15318
+ * @returns The newly created config enum object.
15319
+ *
15320
+ * @example
15321
+ * ```typescript
15322
+ * const enumVal = await admin.extraction.configEnums.create({
15323
+ * type: 'document_category',
15324
+ * value: 'invoice',
15325
+ * label: 'Invoice',
15326
+ * });
15327
+ * ```
15328
+ */
14495
15329
  create: async (attributes, options) => {
14496
15330
  return rb.execute(
14497
15331
  postAdminExtractionConfigEnums,
@@ -14503,7 +15337,18 @@ function createExtractionNamespace(rb) {
14503
15337
  options
14504
15338
  );
14505
15339
  },
14506
- /** Get a config enum by ID. */
15340
+ /**
15341
+ * Retrieves a single config enum by its unique identifier.
15342
+ *
15343
+ * @param id - The UUID of the config enum.
15344
+ * @param options - Optional request options (abort signal, custom headers).
15345
+ * @returns The matching config enum object.
15346
+ *
15347
+ * @example
15348
+ * ```typescript
15349
+ * const enumVal = await admin.extraction.configEnums.get('enum-uuid');
15350
+ * ```
15351
+ */
14507
15352
  get: async (id, options) => {
14508
15353
  return rb.execute(
14509
15354
  getAdminExtractionConfigEnumsById,
@@ -14511,7 +15356,21 @@ function createExtractionNamespace(rb) {
14511
15356
  options
14512
15357
  );
14513
15358
  },
14514
- /** Update a config enum. */
15359
+ /**
15360
+ * Updates an existing config enum's label or other mutable attributes.
15361
+ *
15362
+ * @param id - The UUID of the config enum to update.
15363
+ * @param attributes - The attributes to update.
15364
+ * @param options - Optional request options (abort signal, custom headers).
15365
+ * @returns The updated config enum object.
15366
+ *
15367
+ * @example
15368
+ * ```typescript
15369
+ * const enumVal = await admin.extraction.configEnums.update('enum-uuid', {
15370
+ * label: 'Updated Label',
15371
+ * });
15372
+ * ```
15373
+ */
14515
15374
  update: async (id, attributes, options) => {
14516
15375
  return rb.execute(
14517
15376
  patchAdminExtractionConfigEnumsById,
@@ -14527,132 +15386,530 @@ function createExtractionNamespace(rb) {
14527
15386
  },
14528
15387
  /** Schema discovery — AI-powered field schema detection. */
14529
15388
  schemaDiscoveries: {
14530
- /** Run schema discovery on documents. */
15389
+ /**
15390
+ * Runs schema discovery on documents to automatically detect extraction
15391
+ * field schemas using AI.
15392
+ *
15393
+ * @param attributes - Schema discovery attributes (document or workspace scope).
15394
+ * @param options - Optional request options (abort signal, custom headers).
15395
+ * @returns The created schema discovery object with detected fields.
15396
+ *
15397
+ * @example
15398
+ * ```typescript
15399
+ * const discovery = await admin.extraction.schemaDiscoveries.create({
15400
+ * document_id: 'doc-uuid',
15401
+ * workspace_id: 'ws-uuid',
15402
+ * });
15403
+ * console.log(discovery.suggested_fields);
15404
+ * ```
15405
+ */
15406
+ create: async (attributes, options) => {
15407
+ return rb.execute(
15408
+ postAdminExtractionSchemaDiscoveries,
15409
+ {
15410
+ body: {
15411
+ data: { type: "schema-discovery", attributes }
15412
+ }
15413
+ },
15414
+ options
15415
+ );
15416
+ },
15417
+ /**
15418
+ * Retrieves a schema discovery result by its unique identifier.
15419
+ *
15420
+ * @param id - The UUID of the schema discovery.
15421
+ * @param options - Optional request options (abort signal, custom headers).
15422
+ * @returns The matching schema discovery object.
15423
+ *
15424
+ * @example
15425
+ * ```typescript
15426
+ * const discovery = await admin.extraction.schemaDiscoveries.get('discovery-uuid');
15427
+ * ```
15428
+ */
15429
+ get: async (id, options) => {
15430
+ return rb.execute(
15431
+ getAdminExtractionSchemaDiscoveriesById,
15432
+ { path: { id } },
15433
+ options
15434
+ );
15435
+ },
15436
+ /**
15437
+ * Bootstraps schema discovery for a workspace, analyzing existing
15438
+ * documents to suggest an initial extraction schema.
15439
+ *
15440
+ * @param attributes - Bootstrap attributes (workspace scope).
15441
+ * @param options - Optional request options (abort signal, custom headers).
15442
+ * @returns The bootstrapped schema discovery object.
15443
+ *
15444
+ * @example
15445
+ * ```typescript
15446
+ * const discovery = await admin.extraction.schemaDiscoveries.bootstrap({
15447
+ * workspace_id: 'ws-uuid',
15448
+ * });
15449
+ * ```
15450
+ */
15451
+ bootstrap: async (attributes, options) => {
15452
+ return rb.execute(
15453
+ postAdminExtractionSchemaDiscoveriesBootstrap,
15454
+ {
15455
+ body: {
15456
+ data: { type: "schema-discovery", attributes }
15457
+ }
15458
+ },
15459
+ options
15460
+ );
15461
+ }
15462
+ },
15463
+ /** Field mapping — document-to-schema field alignment. */
15464
+ fieldMappings: {
15465
+ /**
15466
+ * Retrieves the current field mapping for a document within a workspace,
15467
+ * showing how extracted fields align with the schema.
15468
+ *
15469
+ * @param workspaceId - The UUID of the workspace.
15470
+ * @param documentId - The UUID of the document.
15471
+ * @param options - Optional request options (abort signal, custom headers).
15472
+ * @returns The field mapping result for the document.
15473
+ *
15474
+ * @example
15475
+ * ```typescript
15476
+ * const mapping = await admin.extraction.fieldMappings.get('ws-uuid', 'doc-uuid');
15477
+ * console.log(mapping.mappings);
15478
+ * ```
15479
+ */
15480
+ get: async (workspaceId, documentId, options) => {
15481
+ return rb.execute(
15482
+ getAdminWorkspacesByWorkspaceIdExtractionByDocumentIdMapping,
15483
+ { path: { workspace_id: workspaceId, document_id: documentId } },
15484
+ options
15485
+ );
15486
+ },
15487
+ /**
15488
+ * Creates or updates the field mapping for a document, confirming how
15489
+ * extracted fields should map to schema fields.
15490
+ *
15491
+ * @param workspaceId - The UUID of the workspace.
15492
+ * @param documentId - The UUID of the document.
15493
+ * @param attributes - The mapping attributes including confirmation and mappings.
15494
+ * @param options - Optional request options (abort signal, custom headers).
15495
+ * @returns The created or updated field mapping result.
15496
+ *
15497
+ * @example
15498
+ * ```typescript
15499
+ * const mapping = await admin.extraction.fieldMappings.create(
15500
+ * 'ws-uuid',
15501
+ * 'doc-uuid',
15502
+ * {
15503
+ * confirmed: true,
15504
+ * mappings: [
15505
+ * { source: 'inv_num', target: 'invoice_number' },
15506
+ * { source: 'amt', target: 'total_amount' },
15507
+ * ],
15508
+ * },
15509
+ * );
15510
+ * ```
15511
+ */
15512
+ create: async (workspaceId, documentId, attributes, options) => {
15513
+ return rb.execute(
15514
+ postAdminWorkspacesByWorkspaceIdExtractionByDocumentIdMapping,
15515
+ {
15516
+ path: { workspace_id: workspaceId, document_id: documentId },
15517
+ body: {
15518
+ data: { type: "field-mapping-result", attributes }
15519
+ }
15520
+ },
15521
+ options
15522
+ );
15523
+ }
15524
+ },
15525
+ /** Shadow comparison results — primary vs shadow extractor quality metrics. */
15526
+ shadowComparisons: {
15527
+ /**
15528
+ * Lists all shadow comparison records across the platform.
15529
+ *
15530
+ * @param options - Optional request options (abort signal, custom headers).
15531
+ * @returns An array of shadow comparison objects.
15532
+ *
15533
+ * @example
15534
+ * ```typescript
15535
+ * const comparisons = await admin.extraction.shadowComparisons.list();
15536
+ * ```
15537
+ */
15538
+ list: async (options) => {
15539
+ return rb.execute(
15540
+ getAdminExtractionShadowComparisons,
15541
+ {},
15542
+ options
15543
+ );
15544
+ },
15545
+ /**
15546
+ * Retrieves a single shadow comparison by its unique identifier.
15547
+ *
15548
+ * @param id - The UUID of the shadow comparison.
15549
+ * @param options - Optional request options (abort signal, custom headers).
15550
+ * @returns The matching shadow comparison object.
15551
+ *
15552
+ * @example
15553
+ * ```typescript
15554
+ * const comparison = await admin.extraction.shadowComparisons.get('comparison-uuid');
15555
+ * ```
15556
+ */
15557
+ get: async (id, options) => {
15558
+ return rb.execute(
15559
+ getAdminExtractionShadowComparisonsById,
15560
+ { path: { id } },
15561
+ options
15562
+ );
15563
+ },
15564
+ /**
15565
+ * Creates a new shadow comparison record to compare the output of the
15566
+ * primary extractor against a shadow extractor for quality evaluation.
15567
+ *
15568
+ * @param attributes - Shadow comparison creation attributes.
15569
+ * @param options - Optional request options (abort signal, custom headers).
15570
+ * @returns The newly created shadow comparison object.
15571
+ *
15572
+ * @example
15573
+ * ```typescript
15574
+ * const comparison = await admin.extraction.shadowComparisons.create({
15575
+ * document_id: 'doc-uuid',
15576
+ * workspace_id: 'ws-uuid',
15577
+ * });
15578
+ * ```
15579
+ */
14531
15580
  create: async (attributes, options) => {
14532
15581
  return rb.execute(
14533
- postAdminExtractionSchemaDiscoveries,
15582
+ postAdminExtractionShadowComparisons,
14534
15583
  {
14535
15584
  body: {
14536
- data: { type: "schema-discovery", attributes }
15585
+ data: { type: "shadow-comparison", attributes }
14537
15586
  }
14538
15587
  },
14539
15588
  options
14540
15589
  );
14541
15590
  },
14542
- /** Get a schema discovery result by ID. */
14543
- get: async (id, options) => {
14544
- return rb.execute(
14545
- getAdminExtractionSchemaDiscoveriesById,
15591
+ /**
15592
+ * Permanently deletes a shadow comparison record.
15593
+ *
15594
+ * @param id - The UUID of the shadow comparison to delete.
15595
+ * @param options - Optional request options (abort signal, custom headers).
15596
+ * @returns `true` when the deletion succeeds.
15597
+ *
15598
+ * @example
15599
+ * ```typescript
15600
+ * await admin.extraction.shadowComparisons.delete('comparison-uuid');
15601
+ * ```
15602
+ */
15603
+ delete: async (id, options) => {
15604
+ return rb.executeDelete(
15605
+ deleteAdminExtractionShadowComparisonsById,
14546
15606
  { path: { id } },
14547
15607
  options
14548
15608
  );
14549
15609
  },
14550
- /** Bootstrap schema discovery for a workspace. */
14551
- bootstrap: async (attributes, options) => {
15610
+ /**
15611
+ * Retrieves the aggregated analysis report comparing primary vs shadow
15612
+ * extractor performance across all shadow comparison records.
15613
+ *
15614
+ * @param options - Optional request options (abort signal, custom headers).
15615
+ * @returns An array of shadow comparison analysis results.
15616
+ *
15617
+ * @example
15618
+ * ```typescript
15619
+ * const analysis = await admin.extraction.shadowComparisons.analysis();
15620
+ * ```
15621
+ */
15622
+ analysis: async (options) => {
14552
15623
  return rb.execute(
14553
- postAdminExtractionSchemaDiscoveriesBootstrap,
14554
- {
14555
- body: {
14556
- data: { type: "schema-discovery", attributes }
14557
- }
14558
- },
15624
+ getAdminExtractionShadowComparisonsAnalysis,
15625
+ {},
14559
15626
  options
14560
15627
  );
14561
15628
  }
14562
15629
  },
14563
- /** Field mappingdocument-to-schema field alignment. */
14564
- fieldMappings: {
14565
- /** Get field mapping for a document. */
14566
- get: async (workspaceId, documentId, options) => {
15630
+ /** Content analysis results PII detection, OCR quality, entity extraction. */
15631
+ analyses: {
15632
+ /**
15633
+ * Lists all extraction analysis records across the platform, including
15634
+ * PII detection results and OCR quality metrics.
15635
+ *
15636
+ * @param options - Optional request options (abort signal, custom headers).
15637
+ * @returns An array of extraction analysis objects.
15638
+ *
15639
+ * @example
15640
+ * ```typescript
15641
+ * const analyses = await admin.extraction.analyses.list();
15642
+ * ```
15643
+ */
15644
+ list: async (options) => {
14567
15645
  return rb.execute(
14568
- getAdminWorkspacesByWorkspaceIdExtractionByDocumentIdMapping,
14569
- { path: { workspace_id: workspaceId, document_id: documentId } },
15646
+ getAdminExtractionAnalyses,
15647
+ {},
14570
15648
  options
14571
15649
  );
14572
15650
  },
14573
- /** Create or update field mapping for a document. */
14574
- create: async (workspaceId, documentId, attributes, options) => {
15651
+ /**
15652
+ * Retrieves a single extraction analysis by its unique identifier.
15653
+ *
15654
+ * @param id - The UUID of the extraction analysis.
15655
+ * @param options - Optional request options (abort signal, custom headers).
15656
+ * @returns The matching extraction analysis object.
15657
+ *
15658
+ * @example
15659
+ * ```typescript
15660
+ * const analysis = await admin.extraction.analyses.get('analysis-uuid');
15661
+ * console.log(analysis.pii_detected, analysis.ocr_confidence);
15662
+ * ```
15663
+ */
15664
+ get: async (id, options) => {
14575
15665
  return rb.execute(
14576
- postAdminWorkspacesByWorkspaceIdExtractionByDocumentIdMapping,
14577
- {
14578
- path: { workspace_id: workspaceId, document_id: documentId },
14579
- body: {
14580
- data: { type: "field-mapping-result", attributes }
14581
- }
14582
- },
15666
+ getAdminExtractionAnalysesById,
15667
+ { path: { id } },
14583
15668
  options
14584
15669
  );
14585
15670
  }
14586
15671
  },
14587
- /** Shadow comparison results primary vs shadow extractor quality metrics. */
14588
- shadowComparisons: {
14589
- /** List all shadow comparisons. */
15672
+ /** Post-processing hooksconfigurable hooks that execute after extraction. */
15673
+ postProcessingHooks: {
15674
+ /**
15675
+ * Lists all post-processing hooks across the platform.
15676
+ *
15677
+ * @param options - Optional request options (abort signal, custom headers).
15678
+ * @returns An array of post-processing hook objects.
15679
+ *
15680
+ * @example
15681
+ * ```typescript
15682
+ * const hooks = await admin.extraction.postProcessingHooks.list();
15683
+ * ```
15684
+ */
14590
15685
  list: async (options) => {
14591
15686
  return rb.execute(
14592
- getAdminExtractionShadowComparisons,
15687
+ getAdminPostProcessingHooks,
14593
15688
  {},
14594
15689
  options
14595
15690
  );
14596
15691
  },
14597
- /** Get a shadow comparison by ID. */
15692
+ /**
15693
+ * Retrieves a single post-processing hook by its unique identifier.
15694
+ *
15695
+ * @param id - The UUID of the hook.
15696
+ * @param options - Optional request options (abort signal, custom headers).
15697
+ * @returns The matching post-processing hook object.
15698
+ *
15699
+ * @example
15700
+ * ```typescript
15701
+ * const hook = await admin.extraction.postProcessingHooks.get('hook-uuid');
15702
+ * ```
15703
+ */
14598
15704
  get: async (id, options) => {
14599
15705
  return rb.execute(
14600
- getAdminExtractionShadowComparisonsById,
15706
+ getAdminPostProcessingHooksById,
14601
15707
  { path: { id } },
14602
15708
  options
14603
15709
  );
14604
15710
  },
14605
- /** Create a new shadow comparison record. */
15711
+ /**
15712
+ * Creates a new post-processing hook for the extraction pipeline.
15713
+ *
15714
+ * @param attributes - Hook creation attributes including name, trigger, and type.
15715
+ * @param options - Optional request options (abort signal, custom headers).
15716
+ * @returns The newly created post-processing hook object.
15717
+ *
15718
+ * @example
15719
+ * ```typescript
15720
+ * const hook = await admin.extraction.postProcessingHooks.create({
15721
+ * name: 'Notify on extraction',
15722
+ * trigger: 'after_extraction',
15723
+ * type: 'webhook',
15724
+ * config: { url: 'https://example.com/hook' },
15725
+ * workspace_id: 'ws-uuid',
15726
+ * });
15727
+ * ```
15728
+ */
14606
15729
  create: async (attributes, options) => {
14607
15730
  return rb.execute(
14608
- postAdminExtractionShadowComparisons,
15731
+ postAdminPostProcessingHooks,
14609
15732
  {
14610
15733
  body: {
14611
- data: { type: "shadow-comparison", attributes }
15734
+ data: { type: "post-processing-hook", attributes }
15735
+ }
15736
+ },
15737
+ options
15738
+ );
15739
+ },
15740
+ /**
15741
+ * Updates an existing post-processing hook's configuration.
15742
+ *
15743
+ * @param id - The UUID of the hook to update.
15744
+ * @param attributes - The attributes to update.
15745
+ * @param options - Optional request options (abort signal, custom headers).
15746
+ * @returns The updated post-processing hook object.
15747
+ *
15748
+ * @example
15749
+ * ```typescript
15750
+ * const hook = await admin.extraction.postProcessingHooks.update('hook-uuid', {
15751
+ * enabled: false,
15752
+ * });
15753
+ * ```
15754
+ */
15755
+ update: async (id, attributes, options) => {
15756
+ return rb.execute(
15757
+ patchAdminPostProcessingHooksById,
15758
+ {
15759
+ path: { id },
15760
+ body: {
15761
+ data: { id, type: "post-processing-hook", attributes }
14612
15762
  }
14613
15763
  },
14614
15764
  options
14615
15765
  );
14616
15766
  },
14617
- /** Delete a shadow comparison. */
15767
+ /**
15768
+ * Permanently deletes a post-processing hook.
15769
+ *
15770
+ * @param id - The UUID of the hook to delete.
15771
+ * @param options - Optional request options (abort signal, custom headers).
15772
+ * @returns `true` when the deletion succeeds.
15773
+ *
15774
+ * @example
15775
+ * ```typescript
15776
+ * await admin.extraction.postProcessingHooks.delete('hook-uuid');
15777
+ * ```
15778
+ */
14618
15779
  delete: async (id, options) => {
14619
15780
  return rb.executeDelete(
14620
- deleteAdminExtractionShadowComparisonsById,
15781
+ deleteAdminPostProcessingHooksById,
14621
15782
  { path: { id } },
14622
15783
  options
14623
15784
  );
15785
+ }
15786
+ },
15787
+ /** Training analytics — workspace-level extraction training metrics. */
15788
+ trainingAnalytics: {
15789
+ /**
15790
+ * Retrieves training analytics for a specific workspace, including
15791
+ * accuracy trends, correction counts, and low-confidence documents.
15792
+ *
15793
+ * @param workspaceId - The UUID of the workspace.
15794
+ * @param options - Optional request options (abort signal, custom headers).
15795
+ * @returns The training analytics object for the workspace.
15796
+ *
15797
+ * @example
15798
+ * ```typescript
15799
+ * const analytics = await admin.extraction.trainingAnalytics.forWorkspace('ws-uuid');
15800
+ * console.log(analytics.avg_confidence, analytics.total_examples);
15801
+ * ```
15802
+ */
15803
+ forWorkspace: async (workspaceId, options) => {
15804
+ return rb.execute(
15805
+ getAdminWorkspacesByWorkspaceIdTrainingAnalytics,
15806
+ { path: { workspace_id: workspaceId } },
15807
+ options
15808
+ );
14624
15809
  },
14625
- /** Get the analysis report for shadow comparisons. */
14626
- analysis: async (options) => {
15810
+ /**
15811
+ * Retrieves training analytics for multiple workspaces in a single
15812
+ * request (max 50). Pass workspace IDs as a comma-separated string.
15813
+ *
15814
+ * @param workspaceIds - Comma-separated workspace UUIDs.
15815
+ * @param options - Optional request options (abort signal, custom headers).
15816
+ * @returns An array of training analytics objects.
15817
+ *
15818
+ * @example
15819
+ * ```typescript
15820
+ * const batch = await admin.extraction.trainingAnalytics.batch('ws-1,ws-2,ws-3');
15821
+ * ```
15822
+ */
15823
+ batch: async (workspaceIds, options) => {
14627
15824
  return rb.execute(
14628
- getAdminExtractionShadowComparisonsAnalysis,
14629
- {},
15825
+ getAdminWorkspacesAnalyticsBatch,
15826
+ { query: { workspace_ids: workspaceIds } },
14630
15827
  options
14631
15828
  );
14632
15829
  }
14633
15830
  },
14634
- /** Content analysis results PII detection, OCR quality, entity extraction. */
14635
- analyses: {
14636
- /** List all extraction analyses. */
15831
+ /** Extraction agentslist and predict best extraction agents for documents. */
15832
+ extractionAgents: {
15833
+ /**
15834
+ * Lists all available extraction agents (system agents tagged with
15835
+ * "extraction" category).
15836
+ *
15837
+ * @param options - Optional request options (abort signal, custom headers).
15838
+ * @returns An array of extraction agent objects.
15839
+ *
15840
+ * @example
15841
+ * ```typescript
15842
+ * const agents = await admin.extraction.extractionAgents.list();
15843
+ * ```
15844
+ */
14637
15845
  list: async (options) => {
14638
15846
  return rb.execute(
14639
- getAdminExtractionAnalyses,
15847
+ getAdminExtractionAgents,
14640
15848
  {},
14641
15849
  options
14642
15850
  );
14643
15851
  },
14644
- /** Get an extraction analysis by ID. */
15852
+ /**
15853
+ * Retrieves a single extraction agent by its unique identifier.
15854
+ *
15855
+ * @param id - The UUID of the extraction agent.
15856
+ * @param options - Optional request options (abort signal, custom headers).
15857
+ * @returns The matching extraction agent object.
15858
+ *
15859
+ * @example
15860
+ * ```typescript
15861
+ * const agent = await admin.extraction.extractionAgents.get('agent-uuid');
15862
+ * ```
15863
+ */
14645
15864
  get: async (id, options) => {
14646
15865
  return rb.execute(
14647
- getAdminExtractionAnalysesById,
15866
+ getAdminExtractionAgentsById,
14648
15867
  { path: { id } },
14649
15868
  options
14650
15869
  );
15870
+ },
15871
+ /**
15872
+ * Predicts the best extraction agent for a given document based on its
15873
+ * name, description, or file content.
15874
+ *
15875
+ * @param attributes - Prediction input attributes.
15876
+ * @param options - Optional request options (abort signal, custom headers).
15877
+ * @returns A prediction result with recommended agents.
15878
+ *
15879
+ * @example
15880
+ * ```typescript
15881
+ * const prediction = await admin.extraction.extractionAgents.predict({
15882
+ * name: 'invoice.pdf',
15883
+ * description: 'Monthly vendor invoice',
15884
+ * file_content: 'Invoice #12345...',
15885
+ * });
15886
+ * ```
15887
+ */
15888
+ predict: async (attributes, options) => {
15889
+ return rb.execute(
15890
+ postAdminExtractionAgentsPredict,
15891
+ {
15892
+ body: {
15893
+ data: { type: "extraction-agent", attributes }
15894
+ }
15895
+ },
15896
+ options
15897
+ );
14651
15898
  }
14652
15899
  },
14653
15900
  /** Chunk-entity links — bridge between document chunks and knowledge graph entities. */
14654
15901
  chunkEntityLinks: {
14655
- /** List all chunk-entity links. */
15902
+ /**
15903
+ * Lists all chunk-entity links across the platform.
15904
+ *
15905
+ * @param options - Optional request options (abort signal, custom headers).
15906
+ * @returns An array of chunk-entity link objects.
15907
+ *
15908
+ * @example
15909
+ * ```typescript
15910
+ * const links = await admin.extraction.chunkEntityLinks.list();
15911
+ * ```
15912
+ */
14656
15913
  list: async (options) => {
14657
15914
  return rb.execute(
14658
15915
  getAdminExtractionChunkEntityLinks,
@@ -14660,7 +15917,18 @@ function createExtractionNamespace(rb) {
14660
15917
  options
14661
15918
  );
14662
15919
  },
14663
- /** Get a chunk-entity link by ID. */
15920
+ /**
15921
+ * Retrieves a single chunk-entity link by its unique identifier.
15922
+ *
15923
+ * @param id - The UUID of the chunk-entity link.
15924
+ * @param options - Optional request options (abort signal, custom headers).
15925
+ * @returns The matching chunk-entity link object.
15926
+ *
15927
+ * @example
15928
+ * ```typescript
15929
+ * const link = await admin.extraction.chunkEntityLinks.get('link-uuid');
15930
+ * ```
15931
+ */
14664
15932
  get: async (id, options) => {
14665
15933
  return rb.execute(
14666
15934
  getAdminExtractionChunkEntityLinksById,
@@ -14668,7 +15936,18 @@ function createExtractionNamespace(rb) {
14668
15936
  options
14669
15937
  );
14670
15938
  },
14671
- /** List links for a specific document. */
15939
+ /**
15940
+ * Lists all chunk-entity links for a specific document.
15941
+ *
15942
+ * @param documentId - The UUID of the document.
15943
+ * @param options - Optional request options (abort signal, custom headers).
15944
+ * @returns An array of chunk-entity links for the document.
15945
+ *
15946
+ * @example
15947
+ * ```typescript
15948
+ * const links = await admin.extraction.chunkEntityLinks.byDocument('doc-uuid');
15949
+ * ```
15950
+ */
14672
15951
  byDocument: async (documentId, options) => {
14673
15952
  return rb.execute(
14674
15953
  getAdminExtractionChunkEntityLinksDocumentByDocumentId,
@@ -14676,7 +15955,18 @@ function createExtractionNamespace(rb) {
14676
15955
  options
14677
15956
  );
14678
15957
  },
14679
- /** List links for a specific chunk. */
15958
+ /**
15959
+ * Lists all chunk-entity links for a specific document chunk.
15960
+ *
15961
+ * @param documentChunkId - The UUID of the document chunk.
15962
+ * @param options - Optional request options (abort signal, custom headers).
15963
+ * @returns An array of chunk-entity links for the chunk.
15964
+ *
15965
+ * @example
15966
+ * ```typescript
15967
+ * const links = await admin.extraction.chunkEntityLinks.byChunk('chunk-uuid');
15968
+ * ```
15969
+ */
14680
15970
  byChunk: async (documentChunkId, options) => {
14681
15971
  return rb.execute(
14682
15972
  getAdminExtractionChunkEntityLinksChunkByDocumentChunkId,
@@ -14684,7 +15974,18 @@ function createExtractionNamespace(rb) {
14684
15974
  options
14685
15975
  );
14686
15976
  },
14687
- /** List links for a specific entity. */
15977
+ /**
15978
+ * Lists all chunk-entity links for a specific knowledge graph entity.
15979
+ *
15980
+ * @param graphNodeId - The UUID of the graph node (entity).
15981
+ * @param options - Optional request options (abort signal, custom headers).
15982
+ * @returns An array of chunk-entity links for the entity.
15983
+ *
15984
+ * @example
15985
+ * ```typescript
15986
+ * const links = await admin.extraction.chunkEntityLinks.byEntity('node-uuid');
15987
+ * ```
15988
+ */
14688
15989
  byEntity: async (graphNodeId, options) => {
14689
15990
  return rb.execute(
14690
15991
  getAdminExtractionChunkEntityLinksEntityByGraphNodeId,
@@ -21121,6 +22422,72 @@ function createImportsNamespace(rb) {
21121
22422
  };
21122
22423
  }
21123
22424
 
22425
+ // src/namespaces/documents.ts
22426
+ function createDocumentsNamespace(rb) {
22427
+ return {
22428
+ /**
22429
+ * Generate a PDF from HTML content and store it in platform Storage.
22430
+ *
22431
+ * Always pass `store: true` and `workspace_id` to get a JSON response with
22432
+ * a `storage_key`. Without `store: true`, the server returns raw
22433
+ * `application/pdf` binary which cannot be parsed as JSON by this SDK method.
22434
+ *
22435
+ * HTML input is capped at 2MB by the server.
22436
+ *
22437
+ * @param params - PDF generation parameters. Set `store: true` and provide
22438
+ * `workspace_id` for JSON response.
22439
+ * @param options - Optional request options (abort signal, custom headers).
22440
+ * @returns A storage key reference for the generated PDF.
22441
+ *
22442
+ * @example
22443
+ * ```typescript
22444
+ * const { storage_key } = await admin.documents.generatePdf({
22445
+ * html: '<html><body>Report</body></html>',
22446
+ * store: true,
22447
+ * workspace_id: 'ws-123',
22448
+ * });
22449
+ * ```
22450
+ */
22451
+ generatePdf: async (params, options) => {
22452
+ return rb.rawPostDirect(
22453
+ "/isv/documents/pdf",
22454
+ params,
22455
+ options
22456
+ );
22457
+ },
22458
+ /**
22459
+ * Generate a PDF from HTML and email it as an attachment.
22460
+ *
22461
+ * The PDF is generated server-side and delivered via platform SMTP.
22462
+ * Optionally stores the PDF in platform Storage alongside the email delivery.
22463
+ *
22464
+ * If storage fails but the email succeeds, the response includes
22465
+ * `storage_error` with the failure reason (email is still delivered).
22466
+ *
22467
+ * @param params - Email report parameters.
22468
+ * @param options - Optional request options (abort signal, custom headers).
22469
+ * @returns Delivery status, optional storage key, and any storage error.
22470
+ *
22471
+ * @example
22472
+ * ```typescript
22473
+ * const result = await admin.documents.emailReport({
22474
+ * html: '<html><body><h1>Q1 Summary</h1></body></html>',
22475
+ * to: 'finance@company.com',
22476
+ * subject: 'Q1 Financial Summary',
22477
+ * });
22478
+ * console.log(result.sent); // true
22479
+ * ```
22480
+ */
22481
+ emailReport: async (params, options) => {
22482
+ return rb.rawPostDirect(
22483
+ "/isv/documents/pdf/email",
22484
+ params,
22485
+ options
22486
+ );
22487
+ }
22488
+ };
22489
+ }
22490
+
21124
22491
  // src/gpt-admin.ts
21125
22492
  var GptAdmin = class extends BaseClient {
21126
22493
  constructor(config) {
@@ -21137,7 +22504,7 @@ var GptAdmin = class extends BaseClient {
21137
22504
  this.capabilities = createCapabilitiesNamespace(rb);
21138
22505
  this.apiKeys = createApiKeysNamespace(rb);
21139
22506
  this.extraction = createExtractionNamespace(rb);
21140
- this.documents = this.extraction.documents;
22507
+ this.documents = createDocumentsNamespace(rb);
21141
22508
  this.executions = createExecutionsNamespace(rb);
21142
22509
  this.storage = createStorageNamespace(rb);
21143
22510
  this.users = createUsersNamespace(rb);