@foxnose/sdk 0.2.3 → 0.4.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.2.1";
97
- declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.2.1";
96
+ declare const SDK_VERSION = "0.4.0";
97
+ declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.4.0";
98
98
  /**
99
99
  * General transport-level configuration shared by all clients.
100
100
  */
@@ -142,6 +142,78 @@ declare class FoxnoseAPIError extends FoxnoseError {
142
142
  responseBody?: unknown;
143
143
  });
144
144
  }
145
+ /**
146
+ * Options shared by every {@link FoxnoseAPIError} subclass.
147
+ */
148
+ type APIErrorOptions = {
149
+ message: string;
150
+ statusCode: number;
151
+ errorCode?: string;
152
+ detail?: unknown;
153
+ responseHeaders?: Record<string, string>;
154
+ responseBody?: unknown;
155
+ };
156
+ /**
157
+ * Raised on HTTP 402 when a configured spend cap has been reached.
158
+ */
159
+ declare class SpendCapExceededError extends FoxnoseAPIError {
160
+ /** Spend cap in USD, or null when unset on the server side. */
161
+ readonly capUsd?: number | null;
162
+ /** ISO timestamp when the current billing cycle resets. */
163
+ readonly cycleResetsAt?: string;
164
+ /** URL where the spend cap can be raised. */
165
+ readonly raiseCapUrl?: string;
166
+ constructor(options: APIErrorOptions & {
167
+ capUsd?: number | null;
168
+ cycleResetsAt?: string;
169
+ raiseCapUrl?: string;
170
+ });
171
+ }
172
+ /**
173
+ * Raised on HTTP 402 when the plan allowance for a usage axis is exhausted.
174
+ */
175
+ declare class PlanExhaustedError extends FoxnoseAPIError {
176
+ /** Usage axis that was exhausted (e.g. retrievals, writes, data_storage, vector_storage). */
177
+ readonly axis?: string;
178
+ /** ISO timestamp when the usage window resets. */
179
+ readonly windowResetsAt?: string;
180
+ /** URL where the plan can be upgraded. */
181
+ readonly upgradeUrl?: string;
182
+ constructor(options: APIErrorOptions & {
183
+ axis?: string;
184
+ windowResetsAt?: string;
185
+ upgradeUrl?: string;
186
+ });
187
+ }
188
+ /**
189
+ * Raised on HTTP 403 when a plan entity limit is exceeded.
190
+ */
191
+ declare class PlanLimitExceededError extends FoxnoseAPIError {
192
+ /** Entity whose limit was exceeded (e.g. collections, environments, api_keys). */
193
+ readonly entity?: string;
194
+ /** Maximum allowed by the current plan. */
195
+ readonly limit?: number;
196
+ /** Current count that triggered the error. */
197
+ readonly current?: number;
198
+ /** URL where the plan can be upgraded, if provided. */
199
+ readonly upgradeUrl?: string;
200
+ constructor(options: APIErrorOptions & {
201
+ entity?: string;
202
+ limit?: number;
203
+ current?: number;
204
+ upgradeUrl?: string;
205
+ });
206
+ }
207
+ /**
208
+ * Raised on HTTP 429 when the request rate limit is exceeded.
209
+ */
210
+ declare class RateLimitExceededError extends FoxnoseAPIError {
211
+ /** Seconds to wait before retrying, from the Retry-After header. */
212
+ readonly retryAfter?: number;
213
+ constructor(options: APIErrorOptions & {
214
+ retryAfter?: number;
215
+ });
216
+ }
145
217
  /**
146
218
  * Raised when authentication headers cannot be generated.
147
219
  */
@@ -200,7 +272,6 @@ interface ResourceSummary {
200
272
  created_at: string;
201
273
  vectors_size: number;
202
274
  name?: string | null;
203
- component?: string | null;
204
275
  resource_owner?: string | null;
205
276
  current_revision?: string | null;
206
277
  external_id?: string | null;
@@ -223,7 +294,6 @@ interface FolderSummary {
223
294
  key: string;
224
295
  name: string;
225
296
  alias: string;
226
- folder_type: string;
227
297
  content_type: string;
228
298
  strict_reference: boolean;
229
299
  created_at: string;
@@ -236,6 +306,10 @@ interface FolderSummary {
236
306
  embedding_dimension?: number | null;
237
307
  }
238
308
  type FolderList = PaginatedResponse<FolderSummary>;
309
+ /** @public Alias of {@link FolderSummary}. */
310
+ type CollectionSummary = FolderSummary;
311
+ /** @public Alias of {@link FolderList}. */
312
+ type CollectionList = FolderList;
239
313
  interface ComponentSummary {
240
314
  key: string;
241
315
  name: string;
@@ -276,6 +350,103 @@ interface FieldSummary {
276
350
  }
277
351
  type SchemaVersionList = PaginatedResponse<SchemaVersionSummary>;
278
352
  type FieldList = PaginatedResponse<FieldSummary>;
353
+ /**
354
+ * Helper shape for the `meta` block of a Collection `nested` field.
355
+ *
356
+ * A `nested` field on a Collection schema embeds a Component schema at a
357
+ * specific published version. The pin is required: even in auto-update
358
+ * mode, `component_version` stores the most recently resolved version and
359
+ * acts as a fallback if a future Component publish fails compatibility.
360
+ *
361
+ * Pass an object of this shape (or use {@link nestedFieldMeta}) as the
362
+ * `meta` value when calling
363
+ * {@link ManagementClient.createCollectionField} or
364
+ * {@link ManagementClient.updateCollectionField}.
365
+ *
366
+ * @example
367
+ * ```ts
368
+ * await client.createCollectionField('articles', 'v1-draft', {
369
+ * key: 'seo',
370
+ * name: 'SEO',
371
+ * type: 'nested',
372
+ * required: true,
373
+ * meta: nestedFieldMeta({
374
+ * component: 'cmp-seo-metadata',
375
+ * componentVersion: 'ver-abc12345',
376
+ * autoUpdate: true,
377
+ * }),
378
+ * });
379
+ * ```
380
+ */
381
+ interface NestedFieldMeta {
382
+ component: string;
383
+ component_version: string;
384
+ auto_update?: boolean;
385
+ [extra: string]: any;
386
+ }
387
+ /**
388
+ * Build a {@link NestedFieldMeta} payload from camelCase ergonomics.
389
+ *
390
+ * The wire shape uses snake_case keys (`component_version`, `auto_update`);
391
+ * this helper lets callers pass `componentVersion` / `autoUpdate` and
392
+ * emits the right object.
393
+ */
394
+ declare function nestedFieldMeta(opts: {
395
+ component: string;
396
+ componentVersion: string;
397
+ autoUpdate?: boolean;
398
+ /**
399
+ * Any additional meta keys (title, description, …) the API accepts.
400
+ * `component`, `component_version`, and `auto_update` are reserved and
401
+ * cannot be overridden via `extra` — passing them throws so callers see
402
+ * the conflict at the call-site rather than silently winning the merge.
403
+ */
404
+ extra?: Record<string, any>;
405
+ }): NestedFieldMeta;
406
+ /**
407
+ * One entry in the `skipped` list of a sync_component response.
408
+ *
409
+ * `reason` is one of:
410
+ * - `"not_requested"` — `field_paths` was supplied and this path was not in it.
411
+ * - `"auto_update_mode"` — the field has `meta.auto_update=true`.
412
+ * - `"already_at_target"` — the field is already pinned to the requested
413
+ * target version.
414
+ * - `"component_not_found"` — referenced Component does not exist in this
415
+ * environment.
416
+ * - `"component_unpublished"` — Component has no published `current_version`.
417
+ */
418
+ interface SyncComponentSkippedItem {
419
+ path: string;
420
+ reason: string;
421
+ [extra: string]: any;
422
+ }
423
+ /**
424
+ * Response payload from
425
+ * `POST /v1/{env}/collections/{key}/sync_component/`.
426
+ *
427
+ * - `syncedPaths` — field paths whose `meta.component_version` was advanced.
428
+ * - `skipped` — per-path skip records explaining why each was left alone.
429
+ * - `schemaVersion` — UID of the newly published Collection schema version.
430
+ * `null` when no advance was needed (every requested path was skipped).
431
+ */
432
+ interface SyncComponentResponse {
433
+ synced_paths: string[];
434
+ skipped: SyncComponentSkippedItem[];
435
+ schema_version: string | null;
436
+ [extra: string]: any;
437
+ }
438
+ /**
439
+ * One structured conflict entry inside a 409 `component_sync_conflict`
440
+ * error detail. `blocking_reason` is one of:
441
+ * - `"required_field_added_no_default"`
442
+ * - `"type_narrowed"`
443
+ * - `"field_removed"`
444
+ */
445
+ interface ComponentSyncConflictDetail {
446
+ field_path: string;
447
+ blocking_reason: string;
448
+ [extra: string]: any;
449
+ }
279
450
  interface RegionInfo {
280
451
  location: string;
281
452
  name: string;
@@ -392,6 +563,10 @@ interface APIFolderSummary {
392
563
  created_at?: string | null;
393
564
  }
394
565
  type APIFolderList = PaginatedResponse<APIFolderSummary>;
566
+ /** @public Alias of {@link APIFolderSummary}. */
567
+ type APICollectionSummary = APIFolderSummary;
568
+ /** @public Alias of {@link APIFolderList}. */
569
+ type APICollectionList = APIFolderList;
395
570
  interface OrganizationOwner {
396
571
  key: string;
397
572
  email: string;
@@ -483,7 +658,6 @@ interface OrganizationUsage {
483
658
  interface BatchUpsertItem {
484
659
  external_id: string;
485
660
  payload: Record<string, any>;
486
- component?: string | null;
487
661
  }
488
662
  interface BatchItemError {
489
663
  index: number;
@@ -495,6 +669,8 @@ interface BatchUpsertResult {
495
669
  failed: BatchItemError[];
496
670
  }
497
671
  type FolderRef = string | FolderSummary;
672
+ /** @public Alias of {@link FolderRef} — preferred name in new code. */
673
+ type CollectionRef = FolderRef;
498
674
  type ResourceRef = string | ResourceSummary;
499
675
  type RevisionRef = string | RevisionSummary;
500
676
  type ComponentRef = string | ComponentSummary;
@@ -578,10 +754,20 @@ declare class ManagementClient {
578
754
  getApi(apiKey: APIRef): Promise<APIInfo>;
579
755
  updateApi(apiKey: APIRef, payload: Record<string, any>): Promise<APIInfo>;
580
756
  deleteApi(apiKey: APIRef): Promise<void>;
757
+ listApiCollections(apiKey: APIRef, params?: Record<string, any>): Promise<APICollectionList>;
758
+ addApiCollection(apiKey: APIRef, collectionKey: CollectionRef, options?: ApiFolderOptions): Promise<APICollectionSummary>;
759
+ getApiCollection(apiKey: APIRef, collectionKey: CollectionRef): Promise<APICollectionSummary>;
760
+ updateApiCollection(apiKey: APIRef, collectionKey: CollectionRef, options?: ApiFolderOptions): Promise<APICollectionSummary>;
761
+ removeApiCollection(apiKey: APIRef, collectionKey: CollectionRef): Promise<void>;
762
+ /** @deprecated Use {@link listApiCollections} instead. */
581
763
  listApiFolders(apiKey: APIRef, params?: Record<string, any>): Promise<APIFolderList>;
764
+ /** @deprecated Use {@link addApiCollection} instead. */
582
765
  addApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: ApiFolderOptions): Promise<APIFolderSummary>;
766
+ /** @deprecated Use {@link getApiCollection} instead. */
583
767
  getApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<APIFolderSummary>;
768
+ /** @deprecated Use {@link updateApiCollection} instead. */
584
769
  updateApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: ApiFolderOptions): Promise<APIFolderSummary>;
770
+ /** @deprecated Use {@link removeApiCollection} instead. */
585
771
  removeApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<void>;
586
772
  listManagementRoles(params?: Record<string, any>): Promise<ManagementRoleList>;
587
773
  createManagementRole(payload: Record<string, any>): Promise<ManagementRoleSummary>;
@@ -607,30 +793,120 @@ declare class ManagementClient {
607
793
  listFluxPermissionObjects(roleKey: FluxRoleRef, contentType: string): Promise<RolePermissionObject[]>;
608
794
  addFluxPermissionObject(roleKey: FluxRoleRef, payload: Record<string, any>): Promise<RolePermissionObject>;
609
795
  deleteFluxPermissionObject(roleKey: FluxRoleRef, payload: Record<string, any>): Promise<void>;
796
+ listCollections(params?: Record<string, any>): Promise<CollectionList>;
797
+ getCollection(collectionKey: CollectionRef): Promise<CollectionSummary>;
798
+ getCollectionByPath(path: string): Promise<CollectionSummary>;
799
+ listCollectionTree(options?: {
800
+ key?: string;
801
+ mode?: string;
802
+ }): Promise<CollectionList>;
803
+ createCollection(payload: Record<string, any>): Promise<CollectionSummary>;
804
+ updateCollection(collectionKey: CollectionRef, payload: Record<string, any>): Promise<CollectionSummary>;
805
+ deleteCollection(collectionKey: CollectionRef): Promise<void>;
806
+ listCollectionVersions(collectionKey: CollectionRef, params?: Record<string, any>): Promise<SchemaVersionList>;
807
+ createCollectionVersion(collectionKey: CollectionRef, payload: Record<string, any>, options?: {
808
+ copyFrom?: SchemaVersionRef;
809
+ }): Promise<SchemaVersionSummary>;
810
+ getCollectionVersion(collectionKey: CollectionRef, versionKey: SchemaVersionRef, options?: {
811
+ includeSchema?: boolean;
812
+ }): Promise<SchemaVersionSummary>;
813
+ updateCollectionVersion(collectionKey: CollectionRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<SchemaVersionSummary>;
814
+ deleteCollectionVersion(collectionKey: CollectionRef, versionKey: SchemaVersionRef): Promise<void>;
815
+ publishCollectionVersion(collectionKey: CollectionRef, versionKey: SchemaVersionRef): Promise<SchemaVersionSummary>;
816
+ /**
817
+ * Advance pinned nested fields on a Collection to a target Component version.
818
+ *
819
+ * Creates a new published Collection schema version with the affected
820
+ * `meta.component_version` pins advanced. Fields with `auto_update=true`
821
+ * and fields already at the requested target version are reported in
822
+ * `skipped` rather than advanced.
823
+ *
824
+ * @param collectionKey The Collection to sync.
825
+ * @param options.fieldPaths Optional list of nested field paths to advance.
826
+ * When omitted, every pinned (`auto_update=false`) nested field on the
827
+ * Collection's current version is considered.
828
+ * @param options.toVersions Optional per-path override mapping field path
829
+ * to target Component Version UID. Paths not in this mapping advance to
830
+ * the referenced Component's `current_version`. When both `fieldPaths`
831
+ * and `toVersions` are supplied, every key in `toVersions` must also
832
+ * appear in `fieldPaths`.
833
+ *
834
+ * @returns Summary of synced and skipped paths, plus the new
835
+ * `schema_version` UID (`null` if no paths were advanced).
836
+ *
837
+ * @throws `Error` locally (before any HTTP request) when both `fieldPaths`
838
+ * and `toVersions` are supplied AND `toVersions` contains a key that is
839
+ * not in `fieldPaths` (mirrors the server-side validator so the misuse
840
+ * surfaces at the call-site).
841
+ * @throws `FoxnoseApiError` on:
842
+ * - 409 `component_sync_conflict` — target version would break existing resources
843
+ * - 422 `too_many_versions` — Collection schema quota exhausted
844
+ * - 422 `validation_error` — request body invalid
845
+ * - 404 — Collection or specified target version missing
846
+ *
847
+ * @example
848
+ * ```ts
849
+ * // Advance every pinned nested field to its Component's current version.
850
+ * await client.syncCollectionComponent('articles');
851
+ *
852
+ * // Advance a specific path to a chosen Component version.
853
+ * await client.syncCollectionComponent('articles', {
854
+ * fieldPaths: ['seo'],
855
+ * toVersions: { seo: 'ver-def67890' },
856
+ * });
857
+ * ```
858
+ */
859
+ syncCollectionComponent(collectionKey: CollectionRef, options?: {
860
+ fieldPaths?: string[];
861
+ toVersions?: Record<string, string>;
862
+ }): Promise<SyncComponentResponse>;
863
+ listCollectionFields(collectionKey: CollectionRef, versionKey: SchemaVersionRef, params?: Record<string, any>): Promise<FieldList>;
864
+ createCollectionField(collectionKey: CollectionRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<FieldSummary>;
865
+ getCollectionField(collectionKey: CollectionRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<FieldSummary>;
866
+ updateCollectionField(collectionKey: CollectionRef, versionKey: SchemaVersionRef, fieldPath: string, payload: Record<string, any>): Promise<FieldSummary>;
867
+ deleteCollectionField(collectionKey: CollectionRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<void>;
868
+ /** @deprecated Use {@link listCollections} instead. */
610
869
  listFolders(params?: Record<string, any>): Promise<FolderList>;
870
+ /** @deprecated Use {@link getCollection} instead. */
611
871
  getFolder(folderKey: FolderRef): Promise<FolderSummary>;
872
+ /** @deprecated Use {@link getCollectionByPath} instead. */
612
873
  getFolderByPath(path: string): Promise<FolderSummary>;
874
+ /** @deprecated Use {@link listCollectionTree} instead. */
613
875
  listFolderTree(options?: {
614
876
  key?: string;
615
877
  mode?: string;
616
878
  }): Promise<FolderList>;
879
+ /** @deprecated Use {@link createCollection} instead. */
617
880
  createFolder(payload: Record<string, any>): Promise<FolderSummary>;
881
+ /** @deprecated Use {@link updateCollection} instead. */
618
882
  updateFolder(folderKey: FolderRef, payload: Record<string, any>): Promise<FolderSummary>;
883
+ /** @deprecated Use {@link deleteCollection} instead. */
619
884
  deleteFolder(folderKey: FolderRef): Promise<void>;
885
+ /** @deprecated Use {@link listCollectionVersions} instead. */
620
886
  listFolderVersions(folderKey: FolderRef, params?: Record<string, any>): Promise<SchemaVersionList>;
887
+ /** @deprecated Use {@link createCollectionVersion} instead. */
621
888
  createFolderVersion(folderKey: FolderRef, payload: Record<string, any>, options?: {
622
889
  copyFrom?: SchemaVersionRef;
623
890
  }): Promise<SchemaVersionSummary>;
891
+ /** @deprecated Use {@link getCollectionVersion} instead. */
624
892
  getFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef, options?: {
625
893
  includeSchema?: boolean;
626
894
  }): Promise<SchemaVersionSummary>;
895
+ /** @deprecated Use {@link updateCollectionVersion} instead. */
627
896
  updateFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<SchemaVersionSummary>;
897
+ /** @deprecated Use {@link deleteCollectionVersion} instead. */
628
898
  deleteFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef): Promise<void>;
899
+ /** @deprecated Use {@link publishCollectionVersion} instead. */
629
900
  publishFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef): Promise<SchemaVersionSummary>;
901
+ /** @deprecated Use {@link listCollectionFields} instead. */
630
902
  listFolderFields(folderKey: FolderRef, versionKey: SchemaVersionRef, params?: Record<string, any>): Promise<FieldList>;
903
+ /** @deprecated Use {@link createCollectionField} instead. */
631
904
  createFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<FieldSummary>;
905
+ /** @deprecated Use {@link getCollectionField} instead. */
632
906
  getFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<FieldSummary>;
907
+ /** @deprecated Use {@link updateCollectionField} instead. */
633
908
  updateFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, fieldPath: string, payload: Record<string, any>): Promise<FieldSummary>;
909
+ /** @deprecated Use {@link deleteCollectionField} instead. */
634
910
  deleteFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<void>;
635
911
  listComponents(params?: Record<string, any>): Promise<ComponentList>;
636
912
  getComponent(componentKey: ComponentRef): Promise<ComponentSummary>;
@@ -655,12 +931,10 @@ declare class ManagementClient {
655
931
  listResources(folderKey: FolderRef, params?: Record<string, any>): Promise<ResourceList>;
656
932
  getResource(folderKey: FolderRef, resourceKey: ResourceRef): Promise<ResourceSummary>;
657
933
  createResource(folderKey: FolderRef, payload: Record<string, any>, options?: {
658
- component?: ComponentRef;
659
934
  externalId?: string;
660
935
  }): Promise<ResourceSummary>;
661
936
  upsertResource(folderKey: FolderRef, payload: Record<string, any>, options: {
662
937
  externalId: string;
663
- component?: ComponentRef;
664
938
  }): Promise<ResourceSummary>;
665
939
  batchUpsertResources(folderKey: FolderRef, items: BatchUpsertItem[], options?: {
666
940
  maxConcurrency?: number;
@@ -709,6 +983,51 @@ interface FluxClientOptions {
709
983
  retryConfig?: RetryConfig;
710
984
  defaultHeaders?: Record<string, string>;
711
985
  }
986
+ interface VectorSearchOptions {
987
+ query: string;
988
+ fields?: string[];
989
+ top_k?: number;
990
+ similarity_threshold?: number;
991
+ limit?: number;
992
+ offset?: number;
993
+ [extra: string]: any;
994
+ }
995
+ interface VectorFieldSearchOptions {
996
+ field: string;
997
+ query_vector: number[];
998
+ top_k?: number;
999
+ similarity_threshold?: number;
1000
+ limit?: number;
1001
+ offset?: number;
1002
+ [extra: string]: any;
1003
+ }
1004
+ interface HybridSearchOptions {
1005
+ query: string;
1006
+ find_text: Record<string, any>;
1007
+ fields?: string[];
1008
+ top_k?: number;
1009
+ similarity_threshold?: number;
1010
+ vector_weight?: number;
1011
+ text_weight?: number;
1012
+ rerank_results?: boolean;
1013
+ limit?: number;
1014
+ offset?: number;
1015
+ [extra: string]: any;
1016
+ }
1017
+ interface BoostedSearchOptions {
1018
+ find_text: Record<string, any>;
1019
+ query?: string;
1020
+ field?: string;
1021
+ query_vector?: number[];
1022
+ top_k?: number;
1023
+ similarity_threshold?: number;
1024
+ boost_factor?: number;
1025
+ boost_similarity_threshold?: number;
1026
+ max_boost_results?: number;
1027
+ limit?: number;
1028
+ offset?: number;
1029
+ [extra: string]: any;
1030
+ }
712
1031
  /**
713
1032
  * Client for FoxNose Flux delivery APIs.
714
1033
  *
@@ -722,9 +1041,76 @@ declare class FluxClient {
722
1041
  listResources<T = any>(folderPath: string, params?: Record<string, any>): Promise<T>;
723
1042
  getResource<T = any>(folderPath: string, resourceKey: string, params?: Record<string, any>): Promise<T>;
724
1043
  search<T = any>(folderPath: string, body: Record<string, any>): Promise<T>;
1044
+ /** Semantic search using auto-generated embeddings. */
1045
+ vectorSearch<T = any>(folderPath: string, options: VectorSearchOptions): Promise<T>;
1046
+ /** Search using custom pre-computed embeddings. */
1047
+ vectorFieldSearch<T = any>(folderPath: string, options: VectorFieldSearchOptions): Promise<T>;
1048
+ /** Blended text + vector search with configurable weights. */
1049
+ hybridSearch<T = any>(folderPath: string, options: HybridSearchOptions): Promise<T>;
1050
+ /** Text search with results boosted by vector similarity. */
1051
+ boostedSearch<T = any>(folderPath: string, options: BoostedSearchOptions): Promise<T>;
725
1052
  getRouter<T = any>(): Promise<T>;
726
1053
  getSchema<T = any>(folderPath: string): Promise<T>;
727
1054
  close(): void;
728
1055
  }
729
1056
 
730
- export { type APIFolderList, type APIFolderSummary, type APIInfo, type APIList, type APIRef, AnonymousAuth, type ApiFolderOptions, type ApiFolderRouteDescriptionOptions, type AuthStrategy, type BatchItemError, type BatchUpsertItem, type BatchUpsertResult, type ComponentList, type ComponentRef, type ComponentSummary, type CurrentUsage, DEFAULT_RETRY_CONFIG, DEFAULT_USER_AGENT, type EnvironmentList, type EnvironmentRef, type EnvironmentSummary, type FieldList, type FieldSummary, 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, JWTAuth, type LocaleList, type LocaleSummary, type ManagementAPIKeyList, type ManagementAPIKeyRef, type ManagementAPIKeySummary, ManagementClient, type ManagementClientOptions, type ManagementRoleList, type ManagementRoleRef, type ManagementRoleSummary, type OrgRef, type OrganizationList, type OrganizationOwner, type OrganizationPlanStatus, type OrganizationSummary, type OrganizationUsage, type PaginatedResponse, type PlanDetails, type PlanLimits, type ProjectList, type ProjectRef, type ProjectSummary, 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, SecureKeyAuth, SimpleKeyAuth, StaticTokenProvider, type StorageUsage, type TokenProvider, type UnitsUsage, type UsageBreakdown, type UsageMetric, type UserReference, SDK_VERSION as VERSION, createConfig, resolveKey };
1057
+ /**
1058
+ * Types and validation for Flux vector search requests.
1059
+ */
1060
+ /** Search mode for the Flux search endpoint. */
1061
+ declare const SearchMode: {
1062
+ readonly TEXT: "text";
1063
+ readonly VECTOR: "vector";
1064
+ readonly VECTOR_BOOSTED: "vector_boosted";
1065
+ readonly HYBRID: "hybrid";
1066
+ };
1067
+ type SearchMode = (typeof SearchMode)[keyof typeof SearchMode];
1068
+ /** Configuration for auto-generated embedding search. */
1069
+ interface VectorSearch {
1070
+ query: string;
1071
+ fields?: string[];
1072
+ top_k?: number;
1073
+ similarity_threshold?: number;
1074
+ }
1075
+ /** Configuration for custom pre-computed embedding search. */
1076
+ interface VectorFieldSearch {
1077
+ field: string;
1078
+ query_vector: number[];
1079
+ top_k?: number;
1080
+ similarity_threshold?: number;
1081
+ }
1082
+ /** Configuration for vector-boosted search mode. */
1083
+ interface VectorBoostConfig {
1084
+ boost_factor?: number;
1085
+ similarity_threshold?: number;
1086
+ max_boost_results?: number;
1087
+ }
1088
+ /** Configuration for hybrid (text + vector) search mode. */
1089
+ interface HybridConfig {
1090
+ vector_weight?: number;
1091
+ text_weight?: number;
1092
+ rerank_results?: boolean;
1093
+ }
1094
+ /** Full search request payload for the Flux search endpoint. */
1095
+ interface SearchRequest {
1096
+ search_mode?: SearchMode;
1097
+ find_text?: Record<string, any>;
1098
+ find_phrase?: Record<string, any>;
1099
+ vector_search?: VectorSearch;
1100
+ vector_field_search?: VectorFieldSearch;
1101
+ vector_boost_config?: VectorBoostConfig;
1102
+ hybrid_config?: HybridConfig;
1103
+ limit?: number;
1104
+ offset?: number;
1105
+ [extra: string]: any;
1106
+ }
1107
+ /**
1108
+ * Validate a {@link SearchRequest} and return a clean body object (no undefined values).
1109
+ *
1110
+ * Enforces cross-field constraints:
1111
+ * - `vector_search` and `vector_field_search` are mutually exclusive
1112
+ * - Each search mode has specific required/forbidden fields
1113
+ */
1114
+ declare function buildSearchBody(req: SearchRequest): Record<string, any>;
1115
+
1116
+ 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, type CollectionRef, type CollectionSummary, type ComponentList, type ComponentRef, type ComponentSummary, type ComponentSyncConflictDetail, type CurrentUsage, DEFAULT_RETRY_CONFIG, DEFAULT_USER_AGENT, type EnvironmentList, type EnvironmentRef, type EnvironmentSummary, type FieldList, type FieldSummary, 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, type UsageBreakdown, type UsageMetric, type UserReference, SDK_VERSION as VERSION, type VectorBoostConfig, type VectorFieldSearch, type VectorFieldSearchOptions, type VectorSearch, type VectorSearchOptions, buildSearchBody, createConfig, nestedFieldMeta, resolveKey };