@foxnose/sdk 0.6.0 → 0.7.0

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.d.ts CHANGED
@@ -93,8 +93,8 @@ interface RetryConfig {
93
93
  methods: readonly string[];
94
94
  }
95
95
  declare const DEFAULT_RETRY_CONFIG: Readonly<RetryConfig>;
96
- declare const SDK_VERSION = "0.6.0";
97
- declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.6.0";
96
+ declare const SDK_VERSION = "0.7.0";
97
+ declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.7.0";
98
98
  /**
99
99
  * General transport-level configuration shared by all clients.
100
100
  */
@@ -185,6 +185,42 @@ declare class PlanExhaustedError extends FoxnoseAPIError {
185
185
  upgradeUrl?: string;
186
186
  });
187
187
  }
188
+ /**
189
+ * Raised on HTTP 402 `files_quota_exceeded` when no file processing units are left.
190
+ *
191
+ * `reason` says what ran out, and the matching link is `upgradeUrl` or `raiseCapUrl`.
192
+ * A refusal relayed by Flux carries the code only, so these fields are undefined there.
193
+ */
194
+ declare class FilesQuotaExceededError extends FoxnoseAPIError {
195
+ readonly axis?: string;
196
+ readonly reason?: string;
197
+ readonly usedUnits?: number;
198
+ readonly includedUnits?: number | null;
199
+ readonly capUsd?: number | null;
200
+ readonly windowResetsAt?: string | null;
201
+ readonly upgradeUrl?: string;
202
+ readonly raiseCapUrl?: string;
203
+ constructor(options: APIErrorOptions & {
204
+ axis?: string;
205
+ reason?: string;
206
+ usedUnits?: number;
207
+ includedUnits?: number | null;
208
+ capUsd?: number | null;
209
+ windowResetsAt?: string | null;
210
+ upgradeUrl?: string;
211
+ raiseCapUrl?: string;
212
+ });
213
+ }
214
+ /**
215
+ * Raised on HTTP 503 `files_quota_unavailable` when the file processing quota could
216
+ * not be read, so nothing was started. Retry after `retryAfter` seconds.
217
+ */
218
+ declare class FilesQuotaUnavailableError extends FoxnoseAPIError {
219
+ readonly retryAfter?: number;
220
+ constructor(options: APIErrorOptions & {
221
+ retryAfter?: number;
222
+ });
223
+ }
188
224
  /**
189
225
  * Raised on HTTP 403 when a plan entity limit is exceeded.
190
226
  */
@@ -229,6 +265,12 @@ declare class ExternalIdConflictError extends FoxnoseAPIError {
229
265
  }
230
266
  /**
231
267
  * Raised on HTTP 422 when submitted `data` fails the collection's schema.
268
+ *
269
+ * Two server error codes mean this, and both map here:
270
+ * `content_validation_failed` and `data_validation_error`. The latter is what
271
+ * a Flux resource write returns, so leaving it unmapped meant the most common
272
+ * way to hit a schema violation raised a bare {@link FoxnoseAPIError}, and
273
+ * `instanceof ContentValidationFailedError` never matched it.
232
274
  */
233
275
  declare class ContentValidationFailedError extends FoxnoseAPIError {
234
276
  /** Individual validation problems; each includes a `json_path`. */
@@ -299,6 +341,39 @@ interface PaginatedResponse<T> {
299
341
  previous: string | null;
300
342
  results: T[];
301
343
  }
344
+ /** Where a file stands in the processing steps. */
345
+ interface UploadFileProgress {
346
+ step: number;
347
+ of: number;
348
+ step_name: string | null;
349
+ }
350
+ /** The file attached to a record or a revision. */
351
+ interface FileSummary {
352
+ uuid: string | null;
353
+ mime: string | null;
354
+ width: number | null;
355
+ height: number | null;
356
+ cdn_url_base: string | null;
357
+ filename: string | null;
358
+ size: number | null;
359
+ page_count: number | null;
360
+ }
361
+ /**
362
+ * The parent record of a file record. `title` is `null` when the caller may not
363
+ * read the owner, and `deleted` is `true` for a parent that was deleted.
364
+ */
365
+ interface FileRecordOwner {
366
+ key: string;
367
+ title: string | null;
368
+ deleted?: boolean;
369
+ }
370
+ /** A file record's newest file, published or not. */
371
+ interface FileInfo {
372
+ filename: string | null;
373
+ mime: string | null;
374
+ size: number | null;
375
+ page_count: number | null;
376
+ }
302
377
  interface ResourceSummary {
303
378
  key: string;
304
379
  folder: string;
@@ -306,14 +381,34 @@ interface ResourceSummary {
306
381
  created_at: string;
307
382
  vectors_size: number;
308
383
  name?: string | null;
384
+ name_is_auto?: boolean;
309
385
  resource_owner?: string | null;
310
386
  current_revision?: string | null;
311
387
  external_id?: string | null;
388
+ file?: FileSummary | null;
389
+ /** Set on a record of a files collection, like the fields below it. */
390
+ owner?: FileRecordOwner | null;
391
+ status?: string | null;
392
+ progress?: UploadFileProgress | null;
393
+ analysis_state?: string | null;
394
+ /** Short-lived. Keep it out of logs. */
395
+ thumbnail_url?: string | null;
396
+ file_info?: FileInfo | null;
397
+ verdict?: string | null;
398
+ verdict_reasons?: unknown[];
399
+ /** The record's trust summary, where the API computes one. */
400
+ guardrails?: Record<string, unknown> | null;
312
401
  }
313
402
  interface RevisionSummary {
314
403
  key: string;
315
404
  resource: string;
316
- schema_version: string;
405
+ /** `null` when the schema version is gone. */
406
+ schema_version: string | null;
407
+ /** `null` for a draft version, and when the schema version is gone. */
408
+ schema_version_number?: number | null;
409
+ file?: FileSummary | null;
410
+ /** The revision's trust summary, where the API computes one. */
411
+ guardrails?: Record<string, unknown> | null;
317
412
  number: number;
318
413
  size: number;
319
414
  created_at: string;
@@ -726,6 +821,8 @@ interface OrganizationSummary {
726
821
  block_dt?: string | null;
727
822
  block_reason?: string | null;
728
823
  is_blocked: boolean;
824
+ is_verified?: boolean;
825
+ verification_method?: string | null;
729
826
  }
730
827
  type OrganizationList = OrganizationSummary[];
731
828
  interface PlanLimits {
@@ -802,6 +899,408 @@ interface BatchUpsertResult {
802
899
  succeeded: ResourceSummary[];
803
900
  failed: BatchItemError[];
804
901
  }
902
+ /** A kind of file a collection or an upload link accepts. */
903
+ type FileKind = 'image' | 'document' | 'archive';
904
+ /** Body of {@link ManagementClient.createUploadLink}. */
905
+ interface UploadLinkCreateRequest {
906
+ /** The parent record that owns the uploaded files; the caller must be able to read it. */
907
+ owner: ResourceRef;
908
+ /** Heading of the hosted page: 1 to 80 characters, one line. */
909
+ title: string;
910
+ /** Plain text under the heading, up to 500 characters. */
911
+ instructions?: string;
912
+ /** How many files the link accepts, from 1 to 10. Defaults to 1. */
913
+ max_files?: number;
914
+ /** Narrows the collection's kinds for this link. */
915
+ allowed_kinds?: FileKind[];
916
+ /** The link's lifetime in seconds, from 300 to 86400. Defaults to 30 minutes. */
917
+ expires_in?: number;
918
+ }
919
+ /** Who created an upload link. */
920
+ interface UploadLinkCreator {
921
+ kind: 'user' | 'api_key';
922
+ label: string | null;
923
+ /** The user's uid, for `kind: 'user'`. */
924
+ user?: string;
925
+ /** The key's uid, for `kind: 'api_key'`. */
926
+ key?: string;
927
+ }
928
+ /** One file uploaded through a link, as the link's owner sees it. */
929
+ interface UploadLinkFile {
930
+ state: 'processing' | 'ready' | 'pending_review' | 'rejected';
931
+ record_key?: string | null;
932
+ public_reason?: string;
933
+ file_name?: string | null;
934
+ progress?: UploadFileProgress;
935
+ }
936
+ /** One visit to a link's hosted page and the files it uploaded. */
937
+ interface UploadLinkSession {
938
+ created_at: string | null;
939
+ expires_at: string | null;
940
+ files: UploadLinkFile[];
941
+ }
942
+ /** An upload link with its sessions and the status of each file. */
943
+ interface UploadLink {
944
+ upload_id: string;
945
+ created_by: UploadLinkCreator | null;
946
+ owner_key: string | null;
947
+ title: string | null;
948
+ instructions: string | null;
949
+ max_files: number;
950
+ allowed_kinds: string[];
951
+ consumed_count: number;
952
+ created_at: string;
953
+ expires_at: string;
954
+ revoked_at: string | null;
955
+ state: 'active' | 'consumed' | 'expired' | 'revoked';
956
+ sessions: UploadLinkSession[];
957
+ }
958
+ type UploadLinkList = PaginatedResponse<UploadLink>;
959
+ /**
960
+ * The answer to creating an upload link. `upload_url` carries the link's token
961
+ * and is returned only here: no later read reproduces it. Keep it out of logs.
962
+ */
963
+ interface UploadLinkCreated {
964
+ upload_id: string;
965
+ title: string;
966
+ instructions: string | null;
967
+ upload_url: string;
968
+ expires_at: string;
969
+ max_files: number;
970
+ allowed_kinds: string[];
971
+ }
972
+ /** The active analysis of a file. */
973
+ interface FileAnalysis {
974
+ generation: number;
975
+ state: string;
976
+ verdict: string | null;
977
+ verdict_reasons: unknown[];
978
+ public_reason: string | null;
979
+ error_code: string | null;
980
+ in_review: boolean;
981
+ publish_requested_by: string | null;
982
+ policy_version: number | null;
983
+ pipeline_version: string | null;
984
+ source_format: string | null;
985
+ scanned_at: string | null;
986
+ step_times: Record<string, unknown>;
987
+ state_changed_at: string | null;
988
+ created_at: string | null;
989
+ }
990
+ /** The receipt of one check that ran on a file. */
991
+ interface FileCheck {
992
+ detector: string;
993
+ detector_version: string | null;
994
+ status: string;
995
+ started_at: string | null;
996
+ finished_at: string | null;
997
+ }
998
+ /** The text of one zone of a finding. */
999
+ interface FileEvidencePart {
1000
+ box?: unknown;
1001
+ text?: string;
1002
+ }
1003
+ /**
1004
+ * The concealed or withheld text a finding holds, as it was in the file.
1005
+ *
1006
+ * `parts` says which text lies in which box of the page. It is empty for a finding
1007
+ * that does not carry it, so fall back to `text`.
1008
+ */
1009
+ interface FileTextEvidence {
1010
+ page?: number;
1011
+ box?: unknown;
1012
+ tokens?: number;
1013
+ text?: string;
1014
+ samples?: string[];
1015
+ reason?: string;
1016
+ parts: FileEvidencePart[];
1017
+ truncated?: boolean;
1018
+ list_truncated?: boolean;
1019
+ omitted?: number;
1020
+ }
1021
+ /** One finding of an analysis. */
1022
+ interface FileFinding {
1023
+ kind: string;
1024
+ sub_kind: string | null;
1025
+ severity: string;
1026
+ page: number | null;
1027
+ box: unknown;
1028
+ detector: string | null;
1029
+ detector_version: string | null;
1030
+ score: number | null;
1031
+ /**
1032
+ * The stored string, `null` once a blocked or rejected file's personal data is
1033
+ * redacted. It can quote text from the file. {@link parseFindingEvidence} reads it
1034
+ * for a finding that holds text.
1035
+ */
1036
+ evidence: string | null;
1037
+ detail: Record<string, unknown> | null;
1038
+ rule_id: string | null;
1039
+ }
1040
+ /** Whether one copy of a file can be downloaded now, and why not if it cannot. */
1041
+ interface FileCopyAvailability {
1042
+ available: boolean;
1043
+ reason: string | null;
1044
+ }
1045
+ /** Active content found in a file. `present` is `null` when it is unknown. */
1046
+ interface FileActiveContent {
1047
+ present?: boolean | null;
1048
+ kinds?: Record<string, number>;
1049
+ truncated?: boolean;
1050
+ }
1051
+ /** Who started an upload. `name` is `null` when it cannot be found. */
1052
+ interface FileOriginActor {
1053
+ kind: 'user' | 'management_key' | 'flux_key';
1054
+ name: string | null;
1055
+ }
1056
+ /** The upload link a file came through. */
1057
+ interface FileOriginLink {
1058
+ upload_id: string;
1059
+ title: string | null;
1060
+ }
1061
+ /**
1062
+ * Where a record's file came from. `external` is true for a file that came from
1063
+ * outside the team. `end_user` is the identifier given when an end user's upload was
1064
+ * signed: personal data, so keep it out of logs.
1065
+ */
1066
+ interface FileOrigin {
1067
+ channel: 'upload_link' | 'signed_upload' | 'management_api' | 'dashboard' | null;
1068
+ external: boolean;
1069
+ created_by: FileOriginActor | null;
1070
+ upload_link: FileOriginLink | null;
1071
+ end_user: string | null;
1072
+ }
1073
+ /**
1074
+ * What the caller may download of a record's file, and where it came from. `origin`
1075
+ * is set on `getFileAnalysis` for a file bound to the record, and `null` for a record
1076
+ * uploaded without an intent.
1077
+ */
1078
+ interface FileDownloadOptions {
1079
+ original: FileCopyAvailability;
1080
+ safe_copy: FileCopyAvailability;
1081
+ active_content: FileActiveContent;
1082
+ original_access: string;
1083
+ origin?: FileOrigin | null;
1084
+ }
1085
+ /** How agent surfaces mark the file's content. */
1086
+ interface FileTrust {
1087
+ processing: string;
1088
+ content_tainted: boolean;
1089
+ tainted_paths: string[];
1090
+ }
1091
+ /** A record's file, its active analysis, check receipts and findings. */
1092
+ interface FileRecordView {
1093
+ resource_key: string;
1094
+ file_uuid: string | null;
1095
+ page_count: number | null;
1096
+ asset_state: string | null;
1097
+ tombstone: boolean;
1098
+ trust: FileTrust | null;
1099
+ analysis: FileAnalysis | null;
1100
+ checks: FileCheck[];
1101
+ findings: FileFinding[];
1102
+ file: FileDownloadOptions | null;
1103
+ /** Set on the answer to an approval only. */
1104
+ outcome?: string;
1105
+ /** Set on the answer to an approval only. */
1106
+ reason?: string | null;
1107
+ }
1108
+ /** A short-lived link to one copy of a file. Keep `url` out of logs. */
1109
+ interface FileDownload {
1110
+ url: string;
1111
+ expires_in: number | null;
1112
+ expires_at: string | null;
1113
+ kind: 'original' | 'safe_copy' | 'page';
1114
+ filename: string | null;
1115
+ content_type: string | null;
1116
+ generation: number | null;
1117
+ state: string | null;
1118
+ active_content: FileActiveContent | null;
1119
+ warnings: Record<string, unknown>[];
1120
+ }
1121
+ /** A region withheld from a page image. */
1122
+ interface FilePageRedaction {
1123
+ reason: string;
1124
+ box: number[];
1125
+ label: string | null;
1126
+ }
1127
+ /** A table found on a page. */
1128
+ interface FilePageTable {
1129
+ box: unknown;
1130
+ }
1131
+ /**
1132
+ * Where personal data stands on a page. `unreliable` marks data found only in text
1133
+ * read with low confidence. The matched text is never included.
1134
+ */
1135
+ interface FilePagePii {
1136
+ type: string;
1137
+ label: string | null;
1138
+ box: number[];
1139
+ unreliable?: boolean;
1140
+ }
1141
+ /** The findings of a file that share a kind, severity and source. */
1142
+ interface FileFindingGroup {
1143
+ code: string;
1144
+ sub_kind: string | null;
1145
+ severity: string;
1146
+ source: string;
1147
+ pages: number[];
1148
+ removed_from_agents: boolean;
1149
+ label?: string;
1150
+ rule_id?: string;
1151
+ }
1152
+ /** A finding of one page. `box` is `null` when it has no place on the page. */
1153
+ interface FilePageFinding {
1154
+ code: string;
1155
+ sub_kind: string | null;
1156
+ severity: string;
1157
+ source: string;
1158
+ box: number[] | null;
1159
+ removed_from_agents: boolean;
1160
+ label?: string;
1161
+ rule_id?: string;
1162
+ }
1163
+ /**
1164
+ * One page of a file. `image_url` is short-lived. `redactions`, `tables`, `text`,
1165
+ * `content_flags`, `pii` and `pii_truncated` are `null` for a page without extracted
1166
+ * text. With `pii_truncated` true, an empty `pii` means locations were discarded, not
1167
+ * that none were found.
1168
+ *
1169
+ * `findings` covers the whole file and `page_findings` this page. Neither carries
1170
+ * evidence. `removed_passages` counts the file's findings whose text is withheld from
1171
+ * agents.
1172
+ */
1173
+ interface FilePageDetail {
1174
+ page: number;
1175
+ of: number | null;
1176
+ image_url: string;
1177
+ image_width: number | null;
1178
+ image_height: number | null;
1179
+ expires_in: number | null;
1180
+ redactions: FilePageRedaction[] | null;
1181
+ tables: FilePageTable[] | null;
1182
+ text: string | null;
1183
+ content_flags: Record<string, unknown>[] | null;
1184
+ pii: FilePagePii[] | null;
1185
+ pii_truncated: boolean | null;
1186
+ findings: FileFindingGroup[];
1187
+ page_findings: FilePageFinding[];
1188
+ removed_passages: number;
1189
+ trust: FileTrust;
1190
+ verdict: string | null;
1191
+ reasons: unknown[];
1192
+ generation: number | null;
1193
+ state: string | null;
1194
+ }
1195
+ /**
1196
+ * A blocked or rejected file. `original_filename`, `raw_payload`, `uploaded_by`,
1197
+ * `owner_key` and each finding's `evidence` are `null` once `redacted` is true.
1198
+ */
1199
+ interface FileTombstone {
1200
+ resource_key: string | null;
1201
+ file_uuid: string | null;
1202
+ reason: string;
1203
+ public_reason: string | null;
1204
+ error_code: string | null;
1205
+ verdict_reasons: unknown[];
1206
+ generation: number | null;
1207
+ asset_state: string | null;
1208
+ blocked_at: string | null;
1209
+ purge_completed_at: string | null;
1210
+ redacts_at: string | null;
1211
+ redacted: boolean;
1212
+ original_filename: string | null;
1213
+ raw_payload: unknown;
1214
+ uploaded_by: string | null;
1215
+ owner_key: string | null;
1216
+ findings: FileFinding[];
1217
+ }
1218
+ type FileTombstoneList = PaginatedResponse<FileTombstone>;
1219
+ /** Counts of a file's findings. */
1220
+ interface FileFindingsSummary {
1221
+ total: number;
1222
+ by_kind: Record<string, number>;
1223
+ by_severity: Record<string, number>;
1224
+ }
1225
+ /**
1226
+ * A file held for a reviewer. `owner` is `null` outside a strict collection.
1227
+ * `thumbnail_url` is short-lived; it is `null` for a caller who is not the record's
1228
+ * reviewer, for a file held by moderation and over the project's view budget.
1229
+ */
1230
+ interface FileReviewItem {
1231
+ resource_key: string;
1232
+ file_uuid: string | null;
1233
+ collection: string;
1234
+ file_name: string | null;
1235
+ generation: number | null;
1236
+ state: string | null;
1237
+ verdict: string | null;
1238
+ verdict_reasons: unknown[];
1239
+ public_reason: string | null;
1240
+ findings: FileFindingsSummary;
1241
+ owner: Record<string, unknown> | null;
1242
+ held_at: string | null;
1243
+ thumbnail_url: string | null;
1244
+ }
1245
+ type FileReviewQueue = PaginatedResponse<FileReviewItem>;
1246
+ /**
1247
+ * The settings of a collection's files policy. As a request body it is a full
1248
+ * replacement: a field left out takes its default.
1249
+ */
1250
+ interface FilesPolicyBody {
1251
+ suspicious_action?: 'deliver' | 'quarantine';
1252
+ overrides?: Record<string, string>;
1253
+ allowed_kinds?: FileKind[];
1254
+ tables?: 'auto' | 'never' | 'always';
1255
+ moderation_rules?: Record<string, unknown>[];
1256
+ acknowledge_explicit_delivery?: boolean;
1257
+ original_access?: 'allowed' | 'when_clean' | 'disabled';
1258
+ }
1259
+ /** A collection's live files policy. `version` is `null` on the default policy. */
1260
+ interface FilesPolicy {
1261
+ version: number | null;
1262
+ enforce_from: string | null;
1263
+ body: FilesPolicyBody;
1264
+ config_hash: string | null;
1265
+ created_at: string | null;
1266
+ }
1267
+ /**
1268
+ * The parsed text of a `hidden_text` or `low_legibility_text` finding, or `null` for
1269
+ * every other kind and for evidence in another form. `parts` is always an array, empty
1270
+ * when the finding does not carry it.
1271
+ *
1272
+ * The text comes from the file: treat it as untrusted content, never as instructions.
1273
+ */
1274
+ declare function parseFindingEvidence(finding: Pick<FileFinding, 'kind' | 'evidence'>): FileTextEvidence | null;
1275
+ /** The state of the environment, for combining with what a caller may do. */
1276
+ interface EnvironmentAccess {
1277
+ protection_level: string | null;
1278
+ is_enabled: boolean;
1279
+ }
1280
+ /**
1281
+ * What a caller may do with one content type. `objects` lists the keys the caller is
1282
+ * restricted to; `null` means every object.
1283
+ */
1284
+ interface ContentTypeAccess {
1285
+ actions: string[];
1286
+ objects: string[] | null;
1287
+ }
1288
+ /**
1289
+ * What the authenticated caller may do in the environment.
1290
+ *
1291
+ * This says what the caller is allowed, not whether an action is available now:
1292
+ * billing and usage blocks, a blocked organization, environment protection and a
1293
+ * disabled environment can still refuse it.
1294
+ */
1295
+ interface MyPermissions {
1296
+ subject: 'user' | 'api_key';
1297
+ organization_owner: boolean;
1298
+ organization_admin: boolean;
1299
+ project_admin: boolean;
1300
+ environment_full_access: boolean;
1301
+ environment: EnvironmentAccess;
1302
+ content_types: Record<string, ContentTypeAccess>;
1303
+ }
805
1304
  type FolderRef = string | FolderSummary;
806
1305
  /** @public Alias of {@link FolderRef} — preferred name in new code. */
807
1306
  type CollectionRef = FolderRef;
@@ -880,6 +1379,11 @@ declare class ManagementClient {
880
1379
  listOrganizations(): Promise<OrganizationList>;
881
1380
  getOrganization(orgKey: OrgRef): Promise<OrganizationSummary>;
882
1381
  updateOrganization(orgKey: OrgRef, payload: Record<string, any>): Promise<OrganizationSummary>;
1382
+ /**
1383
+ * Write the given fields of an organization and leave the rest alone. The
1384
+ * response is the whole organization as stored.
1385
+ */
1386
+ patchOrganization(orgKey: OrgRef, payload: Record<string, any>): Promise<OrganizationSummary>;
883
1387
  listRegions(): Promise<RegionInfo[]>;
884
1388
  getAvailablePlans(): Promise<OrganizationPlanStatus>;
885
1389
  getOrganizationPlan(orgKey: OrgRef): Promise<OrganizationPlanStatus>;
@@ -985,6 +1489,14 @@ declare class ManagementClient {
985
1489
  }): Promise<CollectionList>;
986
1490
  createCollection(payload: Record<string, any>): Promise<CollectionSummary>;
987
1491
  updateCollection(collectionKey: CollectionRef, payload: Record<string, any>): Promise<CollectionSummary>;
1492
+ /**
1493
+ * Write the given fields of a collection and leave the rest alone.
1494
+ *
1495
+ * `updateCollection` replaces the whole record; this does not. An omitted
1496
+ * `parent` keeps the collection where it is, and `{ parent: null }` moves it
1497
+ * to the root. The response is the whole collection as stored.
1498
+ */
1499
+ patchCollection(collectionKey: CollectionRef, payload: Record<string, any>): Promise<CollectionSummary>;
988
1500
  deleteCollection(collectionKey: CollectionRef): Promise<void>;
989
1501
  listCollectionVersions(collectionKey: CollectionRef, params?: Record<string, any>): Promise<SchemaVersionList>;
990
1502
  createCollectionVersion(collectionKey: CollectionRef, payload: Record<string, any>, options?: {
@@ -1095,6 +1607,11 @@ declare class ManagementClient {
1095
1607
  getComponent(componentKey: ComponentRef): Promise<ComponentSummary>;
1096
1608
  createComponent(payload: Record<string, any>): Promise<ComponentSummary>;
1097
1609
  updateComponent(componentKey: ComponentRef, payload: Record<string, any>): Promise<ComponentSummary>;
1610
+ /**
1611
+ * Write the given fields of a component and leave the rest alone. The response
1612
+ * is the whole component as stored.
1613
+ */
1614
+ patchComponent(componentKey: ComponentRef, payload: Record<string, any>): Promise<ComponentSummary>;
1098
1615
  deleteComponent(componentKey: ComponentRef): Promise<void>;
1099
1616
  listComponentVersions(componentKey: ComponentRef, params?: Record<string, any>): Promise<SchemaVersionList>;
1100
1617
  createComponentVersion(componentKey: ComponentRef, payload: Record<string, any>, options?: {
@@ -1156,6 +1673,214 @@ declare class ManagementClient {
1156
1673
  protectionReason?: string;
1157
1674
  }): Promise<EnvironmentSummary>;
1158
1675
  clearEnvironmentProtection(orgKey: OrgRef, projectKey: ProjectRef, envKey: EnvironmentRef): Promise<EnvironmentSummary>;
1676
+ /**
1677
+ * List a files collection's upload links, newest first. `params` carries `limit` (at
1678
+ * most 100), `offset` and `state`: `active`, `ended` or `all` (the default).
1679
+ */
1680
+ listUploadLinks(collectionKey: CollectionRef, params?: Record<string, any>): Promise<UploadLinkList>;
1681
+ /**
1682
+ * Create an upload link: a hosted page where an end user adds files.
1683
+ *
1684
+ * The collection must be strict. Works with a user token or a Management API
1685
+ * key of this environment. Read the link back with {@link getUploadLink}; the
1686
+ * Flux upload status answers only the Flux key that started an upload, never
1687
+ * a link made here.
1688
+ *
1689
+ * `upload_url` carries the link's token and is returned only by this call.
1690
+ */
1691
+ createUploadLink(collectionKey: CollectionRef, request: UploadLinkCreateRequest): Promise<UploadLinkCreated>;
1692
+ /** Read one upload link with its sessions and the status of each file. */
1693
+ getUploadLink(collectionKey: CollectionRef, uploadId: string): Promise<UploadLink>;
1694
+ /**
1695
+ * Revoke an upload link. Revoking a revoked link returns the same state. Files
1696
+ * already uploaded through the link are not affected.
1697
+ */
1698
+ revokeUploadLink(collectionKey: CollectionRef, uploadId: string): Promise<UploadLink>;
1699
+ /** Read a record's file: its verdict, the checks that ran and every finding. */
1700
+ getFileAnalysis(collectionKey: CollectionRef, resourceKey: ResourceRef): Promise<FileRecordView>;
1701
+ /**
1702
+ * Release a file held for a reviewer.
1703
+ *
1704
+ * The answer's `outcome` says what happened; a publish that goes back through
1705
+ * processing completes on its own. A file no reviewer holds is
1706
+ * `409 file_not_in_review`, `file_not_ready` or `file_erased`.
1707
+ */
1708
+ approveFile(collectionKey: CollectionRef, resourceKey: ResourceRef): Promise<FileRecordView>;
1709
+ /** Reject a file held for a reviewer. Repeating it returns the same state. */
1710
+ rejectFile(collectionKey: CollectionRef, resourceKey: ResourceRef): Promise<FileRecordView>;
1711
+ /**
1712
+ * Analyze a file again under the collection's live policy.
1713
+ *
1714
+ * Accepted work runs in the background; a published generation keeps serving
1715
+ * until the new one publishes. A `storage_only` collection answers
1716
+ * `409 reanalysis_requires_agent_ready`. This is paid processing: a refusal over
1717
+ * the plan throws {@link FilesQuotaExceededError}, a quota that cannot be read
1718
+ * throws {@link FilesQuotaUnavailableError}, and over a budget is `429`.
1719
+ */
1720
+ reanalyzeFile(collectionKey: CollectionRef, resourceKey: ResourceRef): Promise<FileRecordView>;
1721
+ /**
1722
+ * Get a short-lived link to a record's original file.
1723
+ *
1724
+ * A state that cannot be downloaded now is a `409`: `detail.reason` of the
1725
+ * thrown error names it. Check `warnings` before opening the file.
1726
+ */
1727
+ getFileOriginal(collectionKey: CollectionRef, resourceKey: ResourceRef): Promise<FileDownload>;
1728
+ /**
1729
+ * Get a short-lived link to a record's safe copy. It is an image-only PDF, or a PNG
1730
+ * for an image: read `content_type`.
1731
+ */
1732
+ getFileSafeCopy(collectionKey: CollectionRef, resourceKey: ResourceRef): Promise<FileDownload>;
1733
+ /** Get a short-lived link to the redacted PNG of one page. */
1734
+ getFilePage(collectionKey: CollectionRef, resourceKey: ResourceRef, page: number): Promise<FileDownload>;
1735
+ /**
1736
+ * Read one page: its redacted image, what was withheld, its tables and the
1737
+ * text an agent receives.
1738
+ */
1739
+ getFilePageDetail(collectionKey: CollectionRef, resourceKey: ResourceRef, page: number): Promise<FilePageDetail>;
1740
+ /** List a collection's blocked and rejected files, newest first. */
1741
+ listFileTombstones(collectionKey: CollectionRef, params?: Record<string, any>): Promise<FileTombstoneList>;
1742
+ /** Read a collection's live files policy. */
1743
+ getFilesPolicy(collectionKey: CollectionRef): Promise<FilesPolicy>;
1744
+ /**
1745
+ * Replace a collection's files policy with a new version.
1746
+ *
1747
+ * A full replacement: an omitted field takes its default. Sending the live
1748
+ * body again creates no version.
1749
+ */
1750
+ updateFilesPolicy(collectionKey: CollectionRef, payload: FilesPolicyBody): Promise<FilesPolicy>;
1751
+ /**
1752
+ * List the files held for a reviewer in this environment, newest first.
1753
+ *
1754
+ * `collection` narrows the queue to one collection; one the caller cannot read,
1755
+ * or that does not exist, is an empty page. `params` carries `limit` (at most
1756
+ * 100) and `offset`.
1757
+ */
1758
+ listFileReviewQueue(options?: {
1759
+ collection?: CollectionRef;
1760
+ params?: Record<string, any>;
1761
+ }): Promise<FileReviewQueue>;
1762
+ /**
1763
+ * Read what the authenticated caller may do in this environment.
1764
+ *
1765
+ * Works for a user token and for a Management API key of this environment. A caller
1766
+ * with no grants at all is a `403`; a key of another environment is a
1767
+ * `404 environment_not_found`.
1768
+ */
1769
+ getMyPermissions(): Promise<MyPermissions>;
1770
+ private fileRoot;
1771
+ }
1772
+
1773
+ /**
1774
+ * Types and validation for Flux vector search requests.
1775
+ */
1776
+ /** Search mode for the Flux search endpoint. */
1777
+ declare const SearchMode: {
1778
+ readonly TEXT: "text";
1779
+ readonly VECTOR: "vector";
1780
+ readonly VECTOR_BOOSTED: "vector_boosted";
1781
+ readonly HYBRID: "hybrid";
1782
+ };
1783
+ type SearchMode = (typeof SearchMode)[keyof typeof SearchMode];
1784
+ /** Configuration for auto-generated embedding search. */
1785
+ interface VectorSearch {
1786
+ query: string;
1787
+ fields?: string[];
1788
+ top_k?: number;
1789
+ similarity_threshold?: number;
1790
+ }
1791
+ /** Configuration for custom pre-computed embedding search. */
1792
+ interface VectorFieldSearch {
1793
+ field: string;
1794
+ query_vector: number[];
1795
+ top_k?: number;
1796
+ similarity_threshold?: number;
1797
+ }
1798
+ /** Configuration for vector-boosted search mode. */
1799
+ interface VectorBoostConfig {
1800
+ boost_factor?: number;
1801
+ similarity_threshold?: number;
1802
+ max_boost_results?: number;
1803
+ }
1804
+ /** Configuration for hybrid (text + vector) search mode. */
1805
+ interface HybridConfig {
1806
+ vector_weight?: number;
1807
+ text_weight?: number;
1808
+ rerank_results?: boolean;
1809
+ }
1810
+ /** Full search request payload for the Flux search endpoint. */
1811
+ interface SearchRequest {
1812
+ search_mode?: SearchMode;
1813
+ find_text?: Record<string, any>;
1814
+ find_phrase?: Record<string, any>;
1815
+ vector_search?: VectorSearch;
1816
+ vector_field_search?: VectorFieldSearch;
1817
+ vector_boost_config?: VectorBoostConfig;
1818
+ hybrid_config?: HybridConfig;
1819
+ limit?: number;
1820
+ offset?: number;
1821
+ [extra: string]: any;
1822
+ }
1823
+ /**
1824
+ * Validate a {@link SearchRequest} and return a clean body object (no undefined values).
1825
+ *
1826
+ * Enforces cross-field constraints:
1827
+ * - `vector_search` and `vector_field_search` are mutually exclusive
1828
+ * - Each search mode has specific required/forbidden fields
1829
+ */
1830
+ declare function buildSearchBody(req: SearchRequest): Record<string, any>;
1831
+ /**
1832
+ * A grant for one upload to a files collection.
1833
+ *
1834
+ * The grant is a credential. The field names are the wire names, so the object
1835
+ * can go to a browser as it is, and that same object prints every token: keep it
1836
+ * out of logs and error reports.
1837
+ */
1838
+ interface UploadSignature {
1839
+ publicKey: string;
1840
+ /** The upload host. */
1841
+ uploadBaseUrl: string;
1842
+ authToken: string;
1843
+ /** When the token ends, in Unix seconds. */
1844
+ tokenExpire: number;
1845
+ /** Passed to the upload unchanged. */
1846
+ store: string;
1847
+ /** Passed to the upload unchanged. */
1848
+ metadata: Record<string, unknown>;
1849
+ /** The id to poll with {@link FluxClient.getUploadStatus}. */
1850
+ upload_id: string;
1851
+ /** The end user's token for reading the status. */
1852
+ status_token: string;
1853
+ /** The order of status tokens in a session. */
1854
+ rotation: number;
1855
+ }
1856
+ /**
1857
+ * The status of one file of an upload.
1858
+ *
1859
+ * A key sees `state` as `processing`, `ready` (with `record_key`),
1860
+ * `pending_review` or `rejected` (with `public_reason`). A status token sees
1861
+ * `processing`, `accepted` or `rejected`, with `user_status`, `reason` and `slot`.
1862
+ */
1863
+ interface UploadFileStatus {
1864
+ state: string;
1865
+ record_key?: string | null;
1866
+ public_reason?: string;
1867
+ user_status?: string;
1868
+ reason?: string;
1869
+ slot?: number;
1870
+ }
1871
+ /**
1872
+ * The status of an upload.
1873
+ *
1874
+ * For an upload of one file these are that file's fields. For a link of several
1875
+ * files, `state` is `processing` or `done` and `files` and `remaining` are set; a
1876
+ * status token also gets `slots_uploading`.
1877
+ */
1878
+ interface UploadStatus extends UploadFileStatus {
1879
+ files?: UploadFileStatus[];
1880
+ remaining?: number;
1881
+ slots_uploading?: {
1882
+ slot: number;
1883
+ }[];
1159
1884
  }
1160
1885
 
1161
1886
  interface FluxClientOptions {
@@ -1272,6 +1997,36 @@ declare class FluxClient {
1272
1997
  * is never retried automatically.
1273
1998
  */
1274
1999
  updateResource<T = any>(folderPath: string, resourceKey: string, data: Record<string, any>): Promise<T>;
2000
+ /**
2001
+ * Get a grant for one upload to a files collection.
2002
+ *
2003
+ * The grant is a credential: pass it on, do not log it. For a strict collection
2004
+ * `folderPath` names the owner, e.g. `support/tickets/tk_1/attachments`. Needs a
2005
+ * key with create access to the collection.
2006
+ *
2007
+ * `options.sessionKey` is an optional idempotency key of 43 URL-safe characters:
2008
+ * a repeat with the same key, collection and owner reaches the same upload
2009
+ * session. A failed request is never retried automatically, so send one to
2010
+ * retry safely.
2011
+ */
2012
+ createUploadSignature(folderPath: string, options?: {
2013
+ sessionKey?: string;
2014
+ }): Promise<UploadSignature>;
2015
+ /**
2016
+ * Read the status of an upload.
2017
+ *
2018
+ * A key reads the uploads that key started, and the path must name the same
2019
+ * collection and owner. Any other combination is `404 not_found`, which includes
2020
+ * a link made through the Management API: read that one with
2021
+ * `ManagementClient.getUploadLink`.
2022
+ *
2023
+ * `options.statusToken` is the end user's token from the grant, for a client that
2024
+ * holds no key (use `AnonymousAuth`). It answers the end user's view, which never
2025
+ * carries a record key. A request authenticated by a key ignores it.
2026
+ */
2027
+ getUploadStatus(folderPath: string, uploadId: string, options?: {
2028
+ statusToken?: string;
2029
+ }): Promise<UploadStatus>;
1275
2030
  /** Semantic search using auto-generated embeddings. */
1276
2031
  vectorSearch<T = any>(folderPath: string, options: VectorSearchOptions): Promise<T>;
1277
2032
  /** Search using custom pre-computed embeddings. */
@@ -1285,63 +2040,4 @@ declare class FluxClient {
1285
2040
  close(): void;
1286
2041
  }
1287
2042
 
1288
- /**
1289
- * Types and validation for Flux vector search requests.
1290
- */
1291
- /** Search mode for the Flux search endpoint. */
1292
- declare const SearchMode: {
1293
- readonly TEXT: "text";
1294
- readonly VECTOR: "vector";
1295
- readonly VECTOR_BOOSTED: "vector_boosted";
1296
- readonly HYBRID: "hybrid";
1297
- };
1298
- type SearchMode = (typeof SearchMode)[keyof typeof SearchMode];
1299
- /** Configuration for auto-generated embedding search. */
1300
- interface VectorSearch {
1301
- query: string;
1302
- fields?: string[];
1303
- top_k?: number;
1304
- similarity_threshold?: number;
1305
- }
1306
- /** Configuration for custom pre-computed embedding search. */
1307
- interface VectorFieldSearch {
1308
- field: string;
1309
- query_vector: number[];
1310
- top_k?: number;
1311
- similarity_threshold?: number;
1312
- }
1313
- /** Configuration for vector-boosted search mode. */
1314
- interface VectorBoostConfig {
1315
- boost_factor?: number;
1316
- similarity_threshold?: number;
1317
- max_boost_results?: number;
1318
- }
1319
- /** Configuration for hybrid (text + vector) search mode. */
1320
- interface HybridConfig {
1321
- vector_weight?: number;
1322
- text_weight?: number;
1323
- rerank_results?: boolean;
1324
- }
1325
- /** Full search request payload for the Flux search endpoint. */
1326
- interface SearchRequest {
1327
- search_mode?: SearchMode;
1328
- find_text?: Record<string, any>;
1329
- find_phrase?: Record<string, any>;
1330
- vector_search?: VectorSearch;
1331
- vector_field_search?: VectorFieldSearch;
1332
- vector_boost_config?: VectorBoostConfig;
1333
- hybrid_config?: HybridConfig;
1334
- limit?: number;
1335
- offset?: number;
1336
- [extra: string]: any;
1337
- }
1338
- /**
1339
- * Validate a {@link SearchRequest} and return a clean body object (no undefined values).
1340
- *
1341
- * Enforces cross-field constraints:
1342
- * - `vector_search` and `vector_field_search` are mutually exclusive
1343
- * - Each search mode has specific required/forbidden fields
1344
- */
1345
- declare function buildSearchBody(req: SearchRequest): Record<string, any>;
1346
-
1347
- export { type APICollectionList, type APICollectionSummary, type APIFolderList, type APIFolderSummary, type APIInfo, type APIList, type APIRef, AnonymousAuth, type ApiFolderOptions, type ApiFolderRouteDescriptionOptions, type AuthStrategy, type BatchItemError, type BatchUpsertItem, type BatchUpsertResult, type BoostedSearchOptions, type CollectionList, CollectionNotWritableError, type CollectionRef, type CollectionSummary, type ComponentList, type ComponentRef, type ComponentSummary, type ComponentSyncConflictDetail, ContentValidationFailedError, type CurrentUsage, DEFAULT_RETRY_CONFIG, DEFAULT_USER_AGENT, type EnvironmentList, type EnvironmentRef, type EnvironmentSummary, ExternalIdConflictError, type FieldList, type FieldSummary, type FlatRoute, type FlatRouteSummary, type FluxAPIKeyBearerToken, type FluxAPIKeyList, type FluxAPIKeyRef, type FluxAPIKeySummary, FluxClient, type FluxClientOptions, type FluxRoleList, type FluxRoleRef, type FluxRoleSummary, type FolderList, type FolderRef, type FolderSummary, FoxnoseAPIError, FoxnoseAuthError, type FoxnoseConfig, FoxnoseError, FoxnoseTransportError, HttpTransport, type HybridConfig, type HybridSearchOptions, JWTAuth, type LocaleList, type LocaleSummary, type ManagementAPIKeyList, type ManagementAPIKeyRef, type ManagementAPIKeySummary, ManagementClient, type ManagementClientOptions, type ManagementRoleList, type ManagementRoleRef, type ManagementRoleSummary, type NestedFieldMeta, type OrgRef, type OrganizationList, type OrganizationOwner, type OrganizationPlanStatus, type OrganizationSummary, type OrganizationUsage, type PaginatedResponse, type PlanDetails, PlanExhaustedError, PlanLimitExceededError, type PlanLimits, type ProjectList, type ProjectRef, type ProjectSummary, RateLimitExceededError, type RegionInfo, type RequestData, type ResourceList, type ResourceRef, type ResourceSummary, type RetryConfig, type RevisionList, type RevisionRef, type RevisionSummary, type RolePermission, type RolePermissionObject, SDK_VERSION, type SchemaVersionList, type SchemaVersionRef, type SchemaVersionSummary, SearchMode, type SearchRequest, SecureKeyAuth, SimpleKeyAuth, SpendCapExceededError, StaticTokenProvider, type StorageUsage, type SyncComponentResponse, type SyncComponentSkippedItem, type TokenProvider, type UnitsUsage, UpstreamError, type UsageBreakdown, type UsageMetric, type UserReference, SDK_VERSION as VERSION, type VectorBoostConfig, type VectorFieldSearch, type VectorFieldSearchOptions, type VectorSearch, type VectorSearchOptions, buildSearchBody, createConfig, nestedFieldMeta, resolveKey };
2043
+ export { type APICollectionList, type APICollectionSummary, type APIFolderList, type APIFolderSummary, type APIInfo, type APIList, type APIRef, AnonymousAuth, type ApiFolderOptions, type ApiFolderRouteDescriptionOptions, type AuthStrategy, type BatchItemError, type BatchUpsertItem, type BatchUpsertResult, type BoostedSearchOptions, type CollectionList, CollectionNotWritableError, type CollectionRef, type CollectionSummary, type ComponentList, type ComponentRef, type ComponentSummary, type ComponentSyncConflictDetail, type ContentTypeAccess, ContentValidationFailedError, type CurrentUsage, DEFAULT_RETRY_CONFIG, DEFAULT_USER_AGENT, type EnvironmentAccess, type EnvironmentList, type EnvironmentRef, type EnvironmentSummary, ExternalIdConflictError, type FieldList, type FieldSummary, type FileActiveContent, type FileAnalysis, type FileCheck, type FileCopyAvailability, type FileDownload, type FileDownloadOptions, type FileEvidencePart, type FileFinding, type FileFindingGroup, type FileFindingsSummary, type FileInfo, type FileKind, type FileOrigin, type FileOriginActor, type FileOriginLink, type FilePageDetail, type FilePageFinding, type FilePagePii, type FilePageRedaction, type FilePageTable, type FileRecordOwner, type FileRecordView, type FileReviewItem, type FileReviewQueue, type FileSummary, type FileTextEvidence, type FileTombstone, type FileTombstoneList, type FileTrust, type FilesPolicy, type FilesPolicyBody, FilesQuotaExceededError, FilesQuotaUnavailableError, type FlatRoute, type FlatRouteSummary, type FluxAPIKeyBearerToken, type FluxAPIKeyList, type FluxAPIKeyRef, type FluxAPIKeySummary, FluxClient, type FluxClientOptions, type FluxRoleList, type FluxRoleRef, type FluxRoleSummary, type FolderList, type FolderRef, type FolderSummary, FoxnoseAPIError, FoxnoseAuthError, type FoxnoseConfig, FoxnoseError, FoxnoseTransportError, HttpTransport, type HybridConfig, type HybridSearchOptions, JWTAuth, type LocaleList, type LocaleSummary, type ManagementAPIKeyList, type ManagementAPIKeyRef, type ManagementAPIKeySummary, ManagementClient, type ManagementClientOptions, type ManagementRoleList, type ManagementRoleRef, type ManagementRoleSummary, type MyPermissions, type NestedFieldMeta, type OrgRef, type OrganizationList, type OrganizationOwner, type OrganizationPlanStatus, type OrganizationSummary, type OrganizationUsage, type PaginatedResponse, type PlanDetails, PlanExhaustedError, PlanLimitExceededError, type PlanLimits, type ProjectList, type ProjectRef, type ProjectSummary, RateLimitExceededError, type RegionInfo, type RequestData, type ResourceList, type ResourceRef, type ResourceSummary, type RetryConfig, type RevisionList, type RevisionRef, type RevisionSummary, type RolePermission, type RolePermissionObject, SDK_VERSION, type SchemaVersionList, type SchemaVersionRef, type SchemaVersionSummary, SearchMode, type SearchRequest, SecureKeyAuth, SimpleKeyAuth, SpendCapExceededError, StaticTokenProvider, type StorageUsage, type SyncComponentResponse, type SyncComponentSkippedItem, type TokenProvider, type UnitsUsage, type UploadFileProgress, type UploadFileStatus, type UploadLink, type UploadLinkCreateRequest, type UploadLinkCreated, type UploadLinkCreator, type UploadLinkFile, type UploadLinkList, type UploadLinkSession, type UploadSignature, type UploadStatus, UpstreamError, type UsageBreakdown, type UsageMetric, type UserReference, SDK_VERSION as VERSION, type VectorBoostConfig, type VectorFieldSearch, type VectorFieldSearchOptions, type VectorSearch, type VectorSearchOptions, buildSearchBody, createConfig, nestedFieldMeta, parseFindingEvidence, resolveKey };