@foxnose/sdk 0.3.0 → 0.5.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/README.md +139 -5
- package/dist/index.cjs +623 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +348 -11
- package/dist/index.d.ts +348 -11
- package/dist/index.js +614 -25
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
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.
|
|
97
|
-
declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.
|
|
96
|
+
declare const SDK_VERSION = "0.5.0";
|
|
97
|
+
declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.5.0";
|
|
98
98
|
/**
|
|
99
99
|
* General transport-level configuration shared by all clients.
|
|
100
100
|
*/
|
|
@@ -142,6 +142,111 @@ 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
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Raised on HTTP 403 when the target collection does not accept writes (or the
|
|
219
|
+
* key in use lacks write access).
|
|
220
|
+
*/
|
|
221
|
+
declare class CollectionNotWritableError extends FoxnoseAPIError {
|
|
222
|
+
constructor(options: APIErrorOptions);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Raised on HTTP 409 when the supplied `key` already identifies a resource.
|
|
226
|
+
*/
|
|
227
|
+
declare class ExternalIdConflictError extends FoxnoseAPIError {
|
|
228
|
+
constructor(options: APIErrorOptions);
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Raised on HTTP 422 when submitted `data` fails the collection's schema.
|
|
232
|
+
*/
|
|
233
|
+
declare class ContentValidationFailedError extends FoxnoseAPIError {
|
|
234
|
+
/** Individual validation problems; each includes a `json_path`. */
|
|
235
|
+
readonly errors: unknown[];
|
|
236
|
+
/** True when the server capped a very large error list. */
|
|
237
|
+
readonly errorsTruncated: boolean;
|
|
238
|
+
constructor(options: APIErrorOptions & {
|
|
239
|
+
errors?: unknown[];
|
|
240
|
+
errorsTruncated?: boolean;
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Raised on HTTP 502 when a write could not be confirmed. The write may or may
|
|
245
|
+
* not have been applied — re-read the resource with a GET before retrying.
|
|
246
|
+
*/
|
|
247
|
+
declare class UpstreamError extends FoxnoseAPIError {
|
|
248
|
+
constructor(options: APIErrorOptions);
|
|
249
|
+
}
|
|
145
250
|
/**
|
|
146
251
|
* Raised when authentication headers cannot be generated.
|
|
147
252
|
*/
|
|
@@ -173,6 +278,7 @@ declare class HttpTransport {
|
|
|
173
278
|
content?: Uint8Array;
|
|
174
279
|
headers?: Record<string, string>;
|
|
175
280
|
parseJson?: boolean;
|
|
281
|
+
allowRetries?: boolean;
|
|
176
282
|
}): Promise<any>;
|
|
177
283
|
close(): void;
|
|
178
284
|
private buildUrl;
|
|
@@ -200,7 +306,6 @@ interface ResourceSummary {
|
|
|
200
306
|
created_at: string;
|
|
201
307
|
vectors_size: number;
|
|
202
308
|
name?: string | null;
|
|
203
|
-
component?: string | null;
|
|
204
309
|
resource_owner?: string | null;
|
|
205
310
|
current_revision?: string | null;
|
|
206
311
|
external_id?: string | null;
|
|
@@ -223,7 +328,6 @@ interface FolderSummary {
|
|
|
223
328
|
key: string;
|
|
224
329
|
name: string;
|
|
225
330
|
alias: string;
|
|
226
|
-
folder_type: string;
|
|
227
331
|
content_type: string;
|
|
228
332
|
strict_reference: boolean;
|
|
229
333
|
created_at: string;
|
|
@@ -236,6 +340,10 @@ interface FolderSummary {
|
|
|
236
340
|
embedding_dimension?: number | null;
|
|
237
341
|
}
|
|
238
342
|
type FolderList = PaginatedResponse<FolderSummary>;
|
|
343
|
+
/** @public Alias of {@link FolderSummary}. */
|
|
344
|
+
type CollectionSummary = FolderSummary;
|
|
345
|
+
/** @public Alias of {@link FolderList}. */
|
|
346
|
+
type CollectionList = FolderList;
|
|
239
347
|
interface ComponentSummary {
|
|
240
348
|
key: string;
|
|
241
349
|
name: string;
|
|
@@ -276,6 +384,103 @@ interface FieldSummary {
|
|
|
276
384
|
}
|
|
277
385
|
type SchemaVersionList = PaginatedResponse<SchemaVersionSummary>;
|
|
278
386
|
type FieldList = PaginatedResponse<FieldSummary>;
|
|
387
|
+
/**
|
|
388
|
+
* Helper shape for the `meta` block of a Collection `nested` field.
|
|
389
|
+
*
|
|
390
|
+
* A `nested` field on a Collection schema embeds a Component schema at a
|
|
391
|
+
* specific published version. The pin is required: even in auto-update
|
|
392
|
+
* mode, `component_version` stores the most recently resolved version and
|
|
393
|
+
* acts as a fallback if a future Component publish fails compatibility.
|
|
394
|
+
*
|
|
395
|
+
* Pass an object of this shape (or use {@link nestedFieldMeta}) as the
|
|
396
|
+
* `meta` value when calling
|
|
397
|
+
* {@link ManagementClient.createCollectionField} or
|
|
398
|
+
* {@link ManagementClient.updateCollectionField}.
|
|
399
|
+
*
|
|
400
|
+
* @example
|
|
401
|
+
* ```ts
|
|
402
|
+
* await client.createCollectionField('articles', 'v1-draft', {
|
|
403
|
+
* key: 'seo',
|
|
404
|
+
* name: 'SEO',
|
|
405
|
+
* type: 'nested',
|
|
406
|
+
* required: true,
|
|
407
|
+
* meta: nestedFieldMeta({
|
|
408
|
+
* component: 'cmp-seo-metadata',
|
|
409
|
+
* componentVersion: 'ver-abc12345',
|
|
410
|
+
* autoUpdate: true,
|
|
411
|
+
* }),
|
|
412
|
+
* });
|
|
413
|
+
* ```
|
|
414
|
+
*/
|
|
415
|
+
interface NestedFieldMeta {
|
|
416
|
+
component: string;
|
|
417
|
+
component_version: string;
|
|
418
|
+
auto_update?: boolean;
|
|
419
|
+
[extra: string]: any;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Build a {@link NestedFieldMeta} payload from camelCase ergonomics.
|
|
423
|
+
*
|
|
424
|
+
* The wire shape uses snake_case keys (`component_version`, `auto_update`);
|
|
425
|
+
* this helper lets callers pass `componentVersion` / `autoUpdate` and
|
|
426
|
+
* emits the right object.
|
|
427
|
+
*/
|
|
428
|
+
declare function nestedFieldMeta(opts: {
|
|
429
|
+
component: string;
|
|
430
|
+
componentVersion: string;
|
|
431
|
+
autoUpdate?: boolean;
|
|
432
|
+
/**
|
|
433
|
+
* Any additional meta keys (title, description, …) the API accepts.
|
|
434
|
+
* `component`, `component_version`, and `auto_update` are reserved and
|
|
435
|
+
* cannot be overridden via `extra` — passing them throws so callers see
|
|
436
|
+
* the conflict at the call-site rather than silently winning the merge.
|
|
437
|
+
*/
|
|
438
|
+
extra?: Record<string, any>;
|
|
439
|
+
}): NestedFieldMeta;
|
|
440
|
+
/**
|
|
441
|
+
* One entry in the `skipped` list of a sync_component response.
|
|
442
|
+
*
|
|
443
|
+
* `reason` is one of:
|
|
444
|
+
* - `"not_requested"` — `field_paths` was supplied and this path was not in it.
|
|
445
|
+
* - `"auto_update_mode"` — the field has `meta.auto_update=true`.
|
|
446
|
+
* - `"already_at_target"` — the field is already pinned to the requested
|
|
447
|
+
* target version.
|
|
448
|
+
* - `"component_not_found"` — referenced Component does not exist in this
|
|
449
|
+
* environment.
|
|
450
|
+
* - `"component_unpublished"` — Component has no published `current_version`.
|
|
451
|
+
*/
|
|
452
|
+
interface SyncComponentSkippedItem {
|
|
453
|
+
path: string;
|
|
454
|
+
reason: string;
|
|
455
|
+
[extra: string]: any;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Response payload from
|
|
459
|
+
* `POST /v1/{env}/collections/{key}/sync_component/`.
|
|
460
|
+
*
|
|
461
|
+
* - `syncedPaths` — field paths whose `meta.component_version` was advanced.
|
|
462
|
+
* - `skipped` — per-path skip records explaining why each was left alone.
|
|
463
|
+
* - `schemaVersion` — UID of the newly published Collection schema version.
|
|
464
|
+
* `null` when no advance was needed (every requested path was skipped).
|
|
465
|
+
*/
|
|
466
|
+
interface SyncComponentResponse {
|
|
467
|
+
synced_paths: string[];
|
|
468
|
+
skipped: SyncComponentSkippedItem[];
|
|
469
|
+
schema_version: string | null;
|
|
470
|
+
[extra: string]: any;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* One structured conflict entry inside a 409 `component_sync_conflict`
|
|
474
|
+
* error detail. `blocking_reason` is one of:
|
|
475
|
+
* - `"required_field_added_no_default"`
|
|
476
|
+
* - `"type_narrowed"`
|
|
477
|
+
* - `"field_removed"`
|
|
478
|
+
*/
|
|
479
|
+
interface ComponentSyncConflictDetail {
|
|
480
|
+
field_path: string;
|
|
481
|
+
blocking_reason: string;
|
|
482
|
+
[extra: string]: any;
|
|
483
|
+
}
|
|
279
484
|
interface RegionInfo {
|
|
280
485
|
location: string;
|
|
281
486
|
name: string;
|
|
@@ -392,6 +597,10 @@ interface APIFolderSummary {
|
|
|
392
597
|
created_at?: string | null;
|
|
393
598
|
}
|
|
394
599
|
type APIFolderList = PaginatedResponse<APIFolderSummary>;
|
|
600
|
+
/** @public Alias of {@link APIFolderSummary}. */
|
|
601
|
+
type APICollectionSummary = APIFolderSummary;
|
|
602
|
+
/** @public Alias of {@link APIFolderList}. */
|
|
603
|
+
type APICollectionList = APIFolderList;
|
|
395
604
|
interface OrganizationOwner {
|
|
396
605
|
key: string;
|
|
397
606
|
email: string;
|
|
@@ -464,11 +673,8 @@ interface UsageMetric {
|
|
|
464
673
|
}
|
|
465
674
|
interface UsageBreakdown {
|
|
466
675
|
projects: UsageMetric;
|
|
467
|
-
environments: UsageMetric;
|
|
468
|
-
folders: UsageMetric;
|
|
469
676
|
resources: UsageMetric;
|
|
470
677
|
users: UsageMetric;
|
|
471
|
-
components: UsageMetric;
|
|
472
678
|
}
|
|
473
679
|
interface CurrentUsage {
|
|
474
680
|
api_requests: number;
|
|
@@ -483,7 +689,6 @@ interface OrganizationUsage {
|
|
|
483
689
|
interface BatchUpsertItem {
|
|
484
690
|
external_id: string;
|
|
485
691
|
payload: Record<string, any>;
|
|
486
|
-
component?: string | null;
|
|
487
692
|
}
|
|
488
693
|
interface BatchItemError {
|
|
489
694
|
index: number;
|
|
@@ -495,6 +700,8 @@ interface BatchUpsertResult {
|
|
|
495
700
|
failed: BatchItemError[];
|
|
496
701
|
}
|
|
497
702
|
type FolderRef = string | FolderSummary;
|
|
703
|
+
/** @public Alias of {@link FolderRef} — preferred name in new code. */
|
|
704
|
+
type CollectionRef = FolderRef;
|
|
498
705
|
type ResourceRef = string | ResourceSummary;
|
|
499
706
|
type RevisionRef = string | RevisionSummary;
|
|
500
707
|
type ComponentRef = string | ComponentSummary;
|
|
@@ -578,10 +785,20 @@ declare class ManagementClient {
|
|
|
578
785
|
getApi(apiKey: APIRef): Promise<APIInfo>;
|
|
579
786
|
updateApi(apiKey: APIRef, payload: Record<string, any>): Promise<APIInfo>;
|
|
580
787
|
deleteApi(apiKey: APIRef): Promise<void>;
|
|
788
|
+
listApiCollections(apiKey: APIRef, params?: Record<string, any>): Promise<APICollectionList>;
|
|
789
|
+
addApiCollection(apiKey: APIRef, collectionKey: CollectionRef, options?: ApiFolderOptions): Promise<APICollectionSummary>;
|
|
790
|
+
getApiCollection(apiKey: APIRef, collectionKey: CollectionRef): Promise<APICollectionSummary>;
|
|
791
|
+
updateApiCollection(apiKey: APIRef, collectionKey: CollectionRef, options?: ApiFolderOptions): Promise<APICollectionSummary>;
|
|
792
|
+
removeApiCollection(apiKey: APIRef, collectionKey: CollectionRef): Promise<void>;
|
|
793
|
+
/** @deprecated Use {@link listApiCollections} instead. */
|
|
581
794
|
listApiFolders(apiKey: APIRef, params?: Record<string, any>): Promise<APIFolderList>;
|
|
795
|
+
/** @deprecated Use {@link addApiCollection} instead. */
|
|
582
796
|
addApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: ApiFolderOptions): Promise<APIFolderSummary>;
|
|
797
|
+
/** @deprecated Use {@link getApiCollection} instead. */
|
|
583
798
|
getApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<APIFolderSummary>;
|
|
799
|
+
/** @deprecated Use {@link updateApiCollection} instead. */
|
|
584
800
|
updateApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: ApiFolderOptions): Promise<APIFolderSummary>;
|
|
801
|
+
/** @deprecated Use {@link removeApiCollection} instead. */
|
|
585
802
|
removeApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<void>;
|
|
586
803
|
listManagementRoles(params?: Record<string, any>): Promise<ManagementRoleList>;
|
|
587
804
|
createManagementRole(payload: Record<string, any>): Promise<ManagementRoleSummary>;
|
|
@@ -607,30 +824,120 @@ declare class ManagementClient {
|
|
|
607
824
|
listFluxPermissionObjects(roleKey: FluxRoleRef, contentType: string): Promise<RolePermissionObject[]>;
|
|
608
825
|
addFluxPermissionObject(roleKey: FluxRoleRef, payload: Record<string, any>): Promise<RolePermissionObject>;
|
|
609
826
|
deleteFluxPermissionObject(roleKey: FluxRoleRef, payload: Record<string, any>): Promise<void>;
|
|
827
|
+
listCollections(params?: Record<string, any>): Promise<CollectionList>;
|
|
828
|
+
getCollection(collectionKey: CollectionRef): Promise<CollectionSummary>;
|
|
829
|
+
getCollectionByPath(path: string): Promise<CollectionSummary>;
|
|
830
|
+
listCollectionTree(options?: {
|
|
831
|
+
key?: string;
|
|
832
|
+
mode?: string;
|
|
833
|
+
}): Promise<CollectionList>;
|
|
834
|
+
createCollection(payload: Record<string, any>): Promise<CollectionSummary>;
|
|
835
|
+
updateCollection(collectionKey: CollectionRef, payload: Record<string, any>): Promise<CollectionSummary>;
|
|
836
|
+
deleteCollection(collectionKey: CollectionRef): Promise<void>;
|
|
837
|
+
listCollectionVersions(collectionKey: CollectionRef, params?: Record<string, any>): Promise<SchemaVersionList>;
|
|
838
|
+
createCollectionVersion(collectionKey: CollectionRef, payload: Record<string, any>, options?: {
|
|
839
|
+
copyFrom?: SchemaVersionRef;
|
|
840
|
+
}): Promise<SchemaVersionSummary>;
|
|
841
|
+
getCollectionVersion(collectionKey: CollectionRef, versionKey: SchemaVersionRef, options?: {
|
|
842
|
+
includeSchema?: boolean;
|
|
843
|
+
}): Promise<SchemaVersionSummary>;
|
|
844
|
+
updateCollectionVersion(collectionKey: CollectionRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<SchemaVersionSummary>;
|
|
845
|
+
deleteCollectionVersion(collectionKey: CollectionRef, versionKey: SchemaVersionRef): Promise<void>;
|
|
846
|
+
publishCollectionVersion(collectionKey: CollectionRef, versionKey: SchemaVersionRef): Promise<SchemaVersionSummary>;
|
|
847
|
+
/**
|
|
848
|
+
* Advance pinned nested fields on a Collection to a target Component version.
|
|
849
|
+
*
|
|
850
|
+
* Creates a new published Collection schema version with the affected
|
|
851
|
+
* `meta.component_version` pins advanced. Fields with `auto_update=true`
|
|
852
|
+
* and fields already at the requested target version are reported in
|
|
853
|
+
* `skipped` rather than advanced.
|
|
854
|
+
*
|
|
855
|
+
* @param collectionKey The Collection to sync.
|
|
856
|
+
* @param options.fieldPaths Optional list of nested field paths to advance.
|
|
857
|
+
* When omitted, every pinned (`auto_update=false`) nested field on the
|
|
858
|
+
* Collection's current version is considered.
|
|
859
|
+
* @param options.toVersions Optional per-path override mapping field path
|
|
860
|
+
* to target Component Version UID. Paths not in this mapping advance to
|
|
861
|
+
* the referenced Component's `current_version`. When both `fieldPaths`
|
|
862
|
+
* and `toVersions` are supplied, every key in `toVersions` must also
|
|
863
|
+
* appear in `fieldPaths`.
|
|
864
|
+
*
|
|
865
|
+
* @returns Summary of synced and skipped paths, plus the new
|
|
866
|
+
* `schema_version` UID (`null` if no paths were advanced).
|
|
867
|
+
*
|
|
868
|
+
* @throws `Error` locally (before any HTTP request) when both `fieldPaths`
|
|
869
|
+
* and `toVersions` are supplied AND `toVersions` contains a key that is
|
|
870
|
+
* not in `fieldPaths` (mirrors the server-side validator so the misuse
|
|
871
|
+
* surfaces at the call-site).
|
|
872
|
+
* @throws `FoxnoseApiError` on:
|
|
873
|
+
* - 409 `component_sync_conflict` — target version would break existing resources
|
|
874
|
+
* - 422 `too_many_versions` — Collection schema quota exhausted
|
|
875
|
+
* - 422 `validation_error` — request body invalid
|
|
876
|
+
* - 404 — Collection or specified target version missing
|
|
877
|
+
*
|
|
878
|
+
* @example
|
|
879
|
+
* ```ts
|
|
880
|
+
* // Advance every pinned nested field to its Component's current version.
|
|
881
|
+
* await client.syncCollectionComponent('articles');
|
|
882
|
+
*
|
|
883
|
+
* // Advance a specific path to a chosen Component version.
|
|
884
|
+
* await client.syncCollectionComponent('articles', {
|
|
885
|
+
* fieldPaths: ['seo'],
|
|
886
|
+
* toVersions: { seo: 'ver-def67890' },
|
|
887
|
+
* });
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
890
|
+
syncCollectionComponent(collectionKey: CollectionRef, options?: {
|
|
891
|
+
fieldPaths?: string[];
|
|
892
|
+
toVersions?: Record<string, string>;
|
|
893
|
+
}): Promise<SyncComponentResponse>;
|
|
894
|
+
listCollectionFields(collectionKey: CollectionRef, versionKey: SchemaVersionRef, params?: Record<string, any>): Promise<FieldList>;
|
|
895
|
+
createCollectionField(collectionKey: CollectionRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<FieldSummary>;
|
|
896
|
+
getCollectionField(collectionKey: CollectionRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<FieldSummary>;
|
|
897
|
+
updateCollectionField(collectionKey: CollectionRef, versionKey: SchemaVersionRef, fieldPath: string, payload: Record<string, any>): Promise<FieldSummary>;
|
|
898
|
+
deleteCollectionField(collectionKey: CollectionRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<void>;
|
|
899
|
+
/** @deprecated Use {@link listCollections} instead. */
|
|
610
900
|
listFolders(params?: Record<string, any>): Promise<FolderList>;
|
|
901
|
+
/** @deprecated Use {@link getCollection} instead. */
|
|
611
902
|
getFolder(folderKey: FolderRef): Promise<FolderSummary>;
|
|
903
|
+
/** @deprecated Use {@link getCollectionByPath} instead. */
|
|
612
904
|
getFolderByPath(path: string): Promise<FolderSummary>;
|
|
905
|
+
/** @deprecated Use {@link listCollectionTree} instead. */
|
|
613
906
|
listFolderTree(options?: {
|
|
614
907
|
key?: string;
|
|
615
908
|
mode?: string;
|
|
616
909
|
}): Promise<FolderList>;
|
|
910
|
+
/** @deprecated Use {@link createCollection} instead. */
|
|
617
911
|
createFolder(payload: Record<string, any>): Promise<FolderSummary>;
|
|
912
|
+
/** @deprecated Use {@link updateCollection} instead. */
|
|
618
913
|
updateFolder(folderKey: FolderRef, payload: Record<string, any>): Promise<FolderSummary>;
|
|
914
|
+
/** @deprecated Use {@link deleteCollection} instead. */
|
|
619
915
|
deleteFolder(folderKey: FolderRef): Promise<void>;
|
|
916
|
+
/** @deprecated Use {@link listCollectionVersions} instead. */
|
|
620
917
|
listFolderVersions(folderKey: FolderRef, params?: Record<string, any>): Promise<SchemaVersionList>;
|
|
918
|
+
/** @deprecated Use {@link createCollectionVersion} instead. */
|
|
621
919
|
createFolderVersion(folderKey: FolderRef, payload: Record<string, any>, options?: {
|
|
622
920
|
copyFrom?: SchemaVersionRef;
|
|
623
921
|
}): Promise<SchemaVersionSummary>;
|
|
922
|
+
/** @deprecated Use {@link getCollectionVersion} instead. */
|
|
624
923
|
getFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef, options?: {
|
|
625
924
|
includeSchema?: boolean;
|
|
626
925
|
}): Promise<SchemaVersionSummary>;
|
|
926
|
+
/** @deprecated Use {@link updateCollectionVersion} instead. */
|
|
627
927
|
updateFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<SchemaVersionSummary>;
|
|
928
|
+
/** @deprecated Use {@link deleteCollectionVersion} instead. */
|
|
628
929
|
deleteFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef): Promise<void>;
|
|
930
|
+
/** @deprecated Use {@link publishCollectionVersion} instead. */
|
|
629
931
|
publishFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef): Promise<SchemaVersionSummary>;
|
|
932
|
+
/** @deprecated Use {@link listCollectionFields} instead. */
|
|
630
933
|
listFolderFields(folderKey: FolderRef, versionKey: SchemaVersionRef, params?: Record<string, any>): Promise<FieldList>;
|
|
934
|
+
/** @deprecated Use {@link createCollectionField} instead. */
|
|
631
935
|
createFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<FieldSummary>;
|
|
936
|
+
/** @deprecated Use {@link getCollectionField} instead. */
|
|
632
937
|
getFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<FieldSummary>;
|
|
938
|
+
/** @deprecated Use {@link updateCollectionField} instead. */
|
|
633
939
|
updateFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, fieldPath: string, payload: Record<string, any>): Promise<FieldSummary>;
|
|
940
|
+
/** @deprecated Use {@link deleteCollectionField} instead. */
|
|
634
941
|
deleteFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<void>;
|
|
635
942
|
listComponents(params?: Record<string, any>): Promise<ComponentList>;
|
|
636
943
|
getComponent(componentKey: ComponentRef): Promise<ComponentSummary>;
|
|
@@ -655,12 +962,10 @@ declare class ManagementClient {
|
|
|
655
962
|
listResources(folderKey: FolderRef, params?: Record<string, any>): Promise<ResourceList>;
|
|
656
963
|
getResource(folderKey: FolderRef, resourceKey: ResourceRef): Promise<ResourceSummary>;
|
|
657
964
|
createResource(folderKey: FolderRef, payload: Record<string, any>, options?: {
|
|
658
|
-
component?: ComponentRef;
|
|
659
965
|
externalId?: string;
|
|
660
966
|
}): Promise<ResourceSummary>;
|
|
661
967
|
upsertResource(folderKey: FolderRef, payload: Record<string, any>, options: {
|
|
662
968
|
externalId: string;
|
|
663
|
-
component?: ComponentRef;
|
|
664
969
|
}): Promise<ResourceSummary>;
|
|
665
970
|
batchUpsertResources(folderKey: FolderRef, items: BatchUpsertItem[], options?: {
|
|
666
971
|
maxConcurrency?: number;
|
|
@@ -767,6 +1072,38 @@ declare class FluxClient {
|
|
|
767
1072
|
listResources<T = any>(folderPath: string, params?: Record<string, any>): Promise<T>;
|
|
768
1073
|
getResource<T = any>(folderPath: string, resourceKey: string, params?: Record<string, any>): Promise<T>;
|
|
769
1074
|
search<T = any>(folderPath: string, body: Record<string, any>): Promise<T>;
|
|
1075
|
+
/**
|
|
1076
|
+
* Create a resource in a collection and publish it immediately.
|
|
1077
|
+
*
|
|
1078
|
+
* `folderPath` is the collection path (e.g. `articles` or a nested path such
|
|
1079
|
+
* as `users/usr_1/memories`). `options.key` is an optional external
|
|
1080
|
+
* identifier for deduplication — reusing an existing key raises
|
|
1081
|
+
* {@link ExternalIdConflictError}. The response carries `resource_key`,
|
|
1082
|
+
* `revision_key`, `write_units`, and `published`.
|
|
1083
|
+
*
|
|
1084
|
+
* Writes require an authenticated key with write access: an anonymous caller
|
|
1085
|
+
* gets 401, a key without the `create` grant gets a generic 403
|
|
1086
|
+
* (`access_denied`), and a collection whose connection does not allow writes
|
|
1087
|
+
* raises {@link CollectionNotWritableError}.
|
|
1088
|
+
*
|
|
1089
|
+
* Writes are never retried automatically: a failed write's outcome is
|
|
1090
|
+
* unknown, so re-read with a GET before retrying.
|
|
1091
|
+
*/
|
|
1092
|
+
createResource<T = any>(folderPath: string, data: Record<string, any>, options?: {
|
|
1093
|
+
key?: string;
|
|
1094
|
+
}): Promise<T>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Replace a resource's document and publish a new revision. This is a
|
|
1097
|
+
* full-document replace, not a partial merge: fields absent from `data` are
|
|
1098
|
+
* removed.
|
|
1099
|
+
*
|
|
1100
|
+
* Writes require an authenticated key with write access: an anonymous caller
|
|
1101
|
+
* gets 401, a key without the `update` grant gets a generic 403
|
|
1102
|
+
* (`access_denied`), and a collection whose connection does not allow writes
|
|
1103
|
+
* raises {@link CollectionNotWritableError}. Like {@link createResource}, it
|
|
1104
|
+
* is never retried automatically.
|
|
1105
|
+
*/
|
|
1106
|
+
updateResource<T = any>(folderPath: string, resourceKey: string, data: Record<string, any>): Promise<T>;
|
|
770
1107
|
/** Semantic search using auto-generated embeddings. */
|
|
771
1108
|
vectorSearch<T = any>(folderPath: string, options: VectorSearchOptions): Promise<T>;
|
|
772
1109
|
/** Search using custom pre-computed embeddings. */
|
|
@@ -839,4 +1176,4 @@ interface SearchRequest {
|
|
|
839
1176
|
*/
|
|
840
1177
|
declare function buildSearchBody(req: SearchRequest): Record<string, any>;
|
|
841
1178
|
|
|
842
|
-
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 BoostedSearchOptions, 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, 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 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, SearchMode, type SearchRequest, SecureKeyAuth, SimpleKeyAuth, StaticTokenProvider, type StorageUsage, 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, resolveKey };
|
|
1179
|
+
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 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 };
|