@foxnose/sdk 0.1.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/LICENSE +190 -0
- package/README.md +213 -0
- package/dist/index.cjs +1397 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +716 -0
- package/dist/index.d.ts +716 -0
- package/dist/index.js +1353 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable view of the outbound request used when applying auth.
|
|
3
|
+
*/
|
|
4
|
+
interface RequestData {
|
|
5
|
+
method: string;
|
|
6
|
+
url: string;
|
|
7
|
+
path: string;
|
|
8
|
+
body: Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Interface implemented by every authentication strategy.
|
|
12
|
+
*/
|
|
13
|
+
interface AuthStrategy {
|
|
14
|
+
buildHeaders(request: RequestData): Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Provides access tokens for JWT auth.
|
|
18
|
+
*/
|
|
19
|
+
interface TokenProvider {
|
|
20
|
+
getToken(): string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Placeholder auth strategy when no credentials are required.
|
|
25
|
+
*/
|
|
26
|
+
declare class AnonymousAuth implements AuthStrategy {
|
|
27
|
+
buildHeaders(_request: RequestData): Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Simple token provider that always returns the same token.
|
|
32
|
+
*/
|
|
33
|
+
declare class StaticTokenProvider implements TokenProvider {
|
|
34
|
+
private readonly token;
|
|
35
|
+
constructor(token: string);
|
|
36
|
+
getToken(): string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Adds `Authorization: Bearer` headers using a token provider.
|
|
40
|
+
*/
|
|
41
|
+
declare class JWTAuth implements AuthStrategy {
|
|
42
|
+
private readonly provider;
|
|
43
|
+
private readonly scheme;
|
|
44
|
+
constructor(provider: TokenProvider, options?: {
|
|
45
|
+
scheme?: string;
|
|
46
|
+
});
|
|
47
|
+
buildHeaders(_request: RequestData): Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
* Convenience constructor for scripts with manual token management.
|
|
50
|
+
*/
|
|
51
|
+
static fromStaticToken(token: string, options?: {
|
|
52
|
+
scheme?: string;
|
|
53
|
+
}): JWTAuth;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type Clock = () => Date;
|
|
57
|
+
/**
|
|
58
|
+
* Implements the `Secure <public>:<signature>` header used by both APIs.
|
|
59
|
+
*
|
|
60
|
+
* The signature uses ECDSA P-256 over `<path>|<sha256(body)>|<timestamp>`.
|
|
61
|
+
*/
|
|
62
|
+
declare class SecureKeyAuth implements AuthStrategy {
|
|
63
|
+
private readonly publicKey;
|
|
64
|
+
private readonly privateKeyPem;
|
|
65
|
+
private readonly clock;
|
|
66
|
+
constructor(publicKey: string, privateKey: string, options?: {
|
|
67
|
+
clock?: Clock;
|
|
68
|
+
});
|
|
69
|
+
buildHeaders(request: RequestData): Record<string, string>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Adds `Authorization: Simple` headers for development usage.
|
|
74
|
+
*/
|
|
75
|
+
declare class SimpleKeyAuth implements AuthStrategy {
|
|
76
|
+
private readonly publicKey;
|
|
77
|
+
private readonly secretKey;
|
|
78
|
+
constructor(publicKey: string, secretKey: string);
|
|
79
|
+
buildHeaders(_request: RequestData): Record<string, string>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Controls HTTP retry behavior for idempotent requests.
|
|
84
|
+
*/
|
|
85
|
+
interface RetryConfig {
|
|
86
|
+
/** Total number of attempts (original request + retries). */
|
|
87
|
+
attempts: number;
|
|
88
|
+
/** Multiplier for exponential backoff delays. */
|
|
89
|
+
backoffFactor: number;
|
|
90
|
+
/** Response statuses that should be retried. */
|
|
91
|
+
statusCodes: readonly number[];
|
|
92
|
+
/** HTTP methods that are eligible for retrying. */
|
|
93
|
+
methods: readonly string[];
|
|
94
|
+
}
|
|
95
|
+
declare const DEFAULT_RETRY_CONFIG: Readonly<RetryConfig>;
|
|
96
|
+
declare const SDK_VERSION = "0.1.0";
|
|
97
|
+
declare const DEFAULT_USER_AGENT = "foxnose-sdk-js/0.1.0";
|
|
98
|
+
/**
|
|
99
|
+
* General transport-level configuration shared by all clients.
|
|
100
|
+
*/
|
|
101
|
+
interface FoxnoseConfig {
|
|
102
|
+
/** Root URL (including scheme) for the API. */
|
|
103
|
+
baseUrl: string;
|
|
104
|
+
/** Request timeout in milliseconds. */
|
|
105
|
+
timeout: number;
|
|
106
|
+
/** Headers applied to every request (lower priority than per-call headers). */
|
|
107
|
+
defaultHeaders?: Record<string, string>;
|
|
108
|
+
/** User agent string reported to the API. */
|
|
109
|
+
userAgent: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Creates a validated FoxnoseConfig with defaults applied.
|
|
113
|
+
*/
|
|
114
|
+
declare function createConfig(options: {
|
|
115
|
+
baseUrl: string;
|
|
116
|
+
timeout?: number;
|
|
117
|
+
defaultHeaders?: Record<string, string>;
|
|
118
|
+
userAgent?: string;
|
|
119
|
+
}): FoxnoseConfig;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Base class for all SDK errors.
|
|
123
|
+
*/
|
|
124
|
+
declare class FoxnoseError extends Error {
|
|
125
|
+
constructor(message: string);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Raised when the API responds with an error status (4xx/5xx).
|
|
129
|
+
*/
|
|
130
|
+
declare class FoxnoseAPIError extends FoxnoseError {
|
|
131
|
+
readonly statusCode: number;
|
|
132
|
+
readonly errorCode?: string;
|
|
133
|
+
readonly detail?: unknown;
|
|
134
|
+
readonly responseHeaders?: Record<string, string>;
|
|
135
|
+
readonly responseBody?: unknown;
|
|
136
|
+
constructor(options: {
|
|
137
|
+
message: string;
|
|
138
|
+
statusCode: number;
|
|
139
|
+
errorCode?: string;
|
|
140
|
+
detail?: unknown;
|
|
141
|
+
responseHeaders?: Record<string, string>;
|
|
142
|
+
responseBody?: unknown;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Raised when authentication headers cannot be generated.
|
|
147
|
+
*/
|
|
148
|
+
declare class FoxnoseAuthError extends FoxnoseError {
|
|
149
|
+
constructor(message: string);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Raised when the HTTP layer fails before receiving a response.
|
|
153
|
+
*/
|
|
154
|
+
declare class FoxnoseTransportError extends FoxnoseError {
|
|
155
|
+
constructor(message: string);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Shared HTTP transport with retry logic built on native `fetch`.
|
|
160
|
+
*/
|
|
161
|
+
declare class HttpTransport {
|
|
162
|
+
private readonly config;
|
|
163
|
+
private readonly auth;
|
|
164
|
+
private readonly retry;
|
|
165
|
+
constructor(options: {
|
|
166
|
+
config: FoxnoseConfig;
|
|
167
|
+
auth?: AuthStrategy;
|
|
168
|
+
retryConfig?: RetryConfig;
|
|
169
|
+
});
|
|
170
|
+
request(method: string, path: string, options?: {
|
|
171
|
+
params?: Record<string, any>;
|
|
172
|
+
jsonBody?: any;
|
|
173
|
+
content?: Uint8Array;
|
|
174
|
+
headers?: Record<string, string>;
|
|
175
|
+
parseJson?: boolean;
|
|
176
|
+
}): Promise<any>;
|
|
177
|
+
close(): void;
|
|
178
|
+
private buildUrl;
|
|
179
|
+
private buildRequest;
|
|
180
|
+
private buildSigningPath;
|
|
181
|
+
private shouldRetry;
|
|
182
|
+
private computeDelay;
|
|
183
|
+
private maybeDecodeResponse;
|
|
184
|
+
private sendWithRetries;
|
|
185
|
+
private handleTransportError;
|
|
186
|
+
private raiseAPIError;
|
|
187
|
+
private sleep;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
interface PaginatedResponse<T> {
|
|
191
|
+
count: number;
|
|
192
|
+
next: string | null;
|
|
193
|
+
previous: string | null;
|
|
194
|
+
results: T[];
|
|
195
|
+
}
|
|
196
|
+
interface ResourceSummary {
|
|
197
|
+
key: string;
|
|
198
|
+
folder: string;
|
|
199
|
+
content_type: string;
|
|
200
|
+
created_at: string;
|
|
201
|
+
vectors_size: number;
|
|
202
|
+
name?: string | null;
|
|
203
|
+
component?: string | null;
|
|
204
|
+
resource_owner?: string | null;
|
|
205
|
+
current_revision?: string | null;
|
|
206
|
+
external_id?: string | null;
|
|
207
|
+
}
|
|
208
|
+
interface RevisionSummary {
|
|
209
|
+
key: string;
|
|
210
|
+
resource: string;
|
|
211
|
+
schema_version: string;
|
|
212
|
+
number: number;
|
|
213
|
+
size: number;
|
|
214
|
+
created_at: string;
|
|
215
|
+
status: string;
|
|
216
|
+
is_valid: boolean | null;
|
|
217
|
+
published_at: string | null;
|
|
218
|
+
unpublished_at: string | null;
|
|
219
|
+
}
|
|
220
|
+
type ResourceList = PaginatedResponse<ResourceSummary>;
|
|
221
|
+
type RevisionList = PaginatedResponse<RevisionSummary>;
|
|
222
|
+
interface FolderSummary {
|
|
223
|
+
key: string;
|
|
224
|
+
name: string;
|
|
225
|
+
alias: string;
|
|
226
|
+
folder_type: string;
|
|
227
|
+
content_type: string;
|
|
228
|
+
strict_reference: boolean;
|
|
229
|
+
created_at: string;
|
|
230
|
+
parent?: string | null;
|
|
231
|
+
mode?: string | null;
|
|
232
|
+
path?: string | null;
|
|
233
|
+
auto_remove_revisions?: number | null;
|
|
234
|
+
auto_remove_schema_versions?: number | null;
|
|
235
|
+
embedding_model?: string | null;
|
|
236
|
+
embedding_dimension?: number | null;
|
|
237
|
+
}
|
|
238
|
+
type FolderList = PaginatedResponse<FolderSummary>;
|
|
239
|
+
interface ComponentSummary {
|
|
240
|
+
key: string;
|
|
241
|
+
name: string;
|
|
242
|
+
description?: string | null;
|
|
243
|
+
environment: string;
|
|
244
|
+
content_type: string;
|
|
245
|
+
created_at: string;
|
|
246
|
+
current_version?: string | null;
|
|
247
|
+
}
|
|
248
|
+
type ComponentList = PaginatedResponse<ComponentSummary>;
|
|
249
|
+
interface SchemaVersionSummary {
|
|
250
|
+
key: string;
|
|
251
|
+
name: string;
|
|
252
|
+
description: string | null;
|
|
253
|
+
version_number: number | null;
|
|
254
|
+
created_at: string;
|
|
255
|
+
published_at: string | null;
|
|
256
|
+
archived_at: string | null;
|
|
257
|
+
json_schema?: Record<string, any> | null;
|
|
258
|
+
}
|
|
259
|
+
interface FieldSummary {
|
|
260
|
+
key: string;
|
|
261
|
+
name: string;
|
|
262
|
+
description: string | null;
|
|
263
|
+
path: string;
|
|
264
|
+
parent: string | null;
|
|
265
|
+
type: string;
|
|
266
|
+
meta: Record<string, any>;
|
|
267
|
+
json_schema?: Record<string, any> | null;
|
|
268
|
+
required: boolean;
|
|
269
|
+
nullable: boolean;
|
|
270
|
+
multiple?: boolean | null;
|
|
271
|
+
localizable?: boolean | null;
|
|
272
|
+
searchable?: boolean | null;
|
|
273
|
+
private: boolean;
|
|
274
|
+
vectorizable?: boolean | null;
|
|
275
|
+
[extra: string]: any;
|
|
276
|
+
}
|
|
277
|
+
type SchemaVersionList = PaginatedResponse<SchemaVersionSummary>;
|
|
278
|
+
type FieldList = PaginatedResponse<FieldSummary>;
|
|
279
|
+
interface RegionInfo {
|
|
280
|
+
location: string;
|
|
281
|
+
name: string;
|
|
282
|
+
code: string;
|
|
283
|
+
}
|
|
284
|
+
interface ProjectSummary {
|
|
285
|
+
key: string;
|
|
286
|
+
name: string;
|
|
287
|
+
organization: string;
|
|
288
|
+
region: RegionInfo | string;
|
|
289
|
+
environments: Array<Record<string, any>>;
|
|
290
|
+
gdpr?: boolean | null;
|
|
291
|
+
created_at?: string | null;
|
|
292
|
+
[extra: string]: any;
|
|
293
|
+
}
|
|
294
|
+
type ProjectList = PaginatedResponse<ProjectSummary>;
|
|
295
|
+
interface UserReference {
|
|
296
|
+
key: string;
|
|
297
|
+
email: string;
|
|
298
|
+
first_name: string;
|
|
299
|
+
last_name: string;
|
|
300
|
+
full_name: string;
|
|
301
|
+
}
|
|
302
|
+
interface EnvironmentSummary {
|
|
303
|
+
key: string;
|
|
304
|
+
name: string;
|
|
305
|
+
project: string;
|
|
306
|
+
host: string;
|
|
307
|
+
is_enabled: boolean;
|
|
308
|
+
created_at: string;
|
|
309
|
+
protection_level?: string | null;
|
|
310
|
+
protection_level_display?: string | null;
|
|
311
|
+
protected_by_user?: UserReference | null;
|
|
312
|
+
protected_at?: string | null;
|
|
313
|
+
protection_reason?: string | null;
|
|
314
|
+
}
|
|
315
|
+
type EnvironmentList = EnvironmentSummary[];
|
|
316
|
+
interface LocaleSummary {
|
|
317
|
+
name: string;
|
|
318
|
+
code: string;
|
|
319
|
+
environment: string;
|
|
320
|
+
is_default: boolean;
|
|
321
|
+
created_at: string;
|
|
322
|
+
}
|
|
323
|
+
type LocaleList = LocaleSummary[];
|
|
324
|
+
interface ManagementAPIKeySummary {
|
|
325
|
+
key: string;
|
|
326
|
+
description?: string | null;
|
|
327
|
+
public_key: string;
|
|
328
|
+
secret_key: string;
|
|
329
|
+
role?: string | null;
|
|
330
|
+
environment: string;
|
|
331
|
+
created_at: string;
|
|
332
|
+
}
|
|
333
|
+
type ManagementAPIKeyList = PaginatedResponse<ManagementAPIKeySummary>;
|
|
334
|
+
interface FluxAPIKeySummary {
|
|
335
|
+
key: string;
|
|
336
|
+
description?: string | null;
|
|
337
|
+
public_key: string;
|
|
338
|
+
secret_key: string;
|
|
339
|
+
role?: string | null;
|
|
340
|
+
environment: string;
|
|
341
|
+
created_at: string;
|
|
342
|
+
}
|
|
343
|
+
type FluxAPIKeyList = PaginatedResponse<FluxAPIKeySummary>;
|
|
344
|
+
interface ManagementRoleSummary {
|
|
345
|
+
key: string;
|
|
346
|
+
name: string;
|
|
347
|
+
description?: string | null;
|
|
348
|
+
full_access: boolean;
|
|
349
|
+
environment: string;
|
|
350
|
+
created_at: string;
|
|
351
|
+
}
|
|
352
|
+
type ManagementRoleList = PaginatedResponse<ManagementRoleSummary>;
|
|
353
|
+
interface RolePermission {
|
|
354
|
+
content_type: string;
|
|
355
|
+
actions: string[];
|
|
356
|
+
all_objects: boolean;
|
|
357
|
+
objects?: string[] | null;
|
|
358
|
+
}
|
|
359
|
+
interface RolePermissionObject {
|
|
360
|
+
content_type: string;
|
|
361
|
+
object_key: string;
|
|
362
|
+
}
|
|
363
|
+
interface FluxRoleSummary {
|
|
364
|
+
key: string;
|
|
365
|
+
name: string;
|
|
366
|
+
description?: string | null;
|
|
367
|
+
environment: string;
|
|
368
|
+
created_at: string;
|
|
369
|
+
}
|
|
370
|
+
type FluxRoleList = PaginatedResponse<FluxRoleSummary>;
|
|
371
|
+
interface APIInfo {
|
|
372
|
+
key: string;
|
|
373
|
+
name: string;
|
|
374
|
+
prefix: string;
|
|
375
|
+
description?: string | null;
|
|
376
|
+
environment: string;
|
|
377
|
+
version?: string | null;
|
|
378
|
+
is_auth_required: boolean;
|
|
379
|
+
created_at: string;
|
|
380
|
+
path?: string | null;
|
|
381
|
+
}
|
|
382
|
+
type APIList = PaginatedResponse<APIInfo>;
|
|
383
|
+
interface APIFolderSummary {
|
|
384
|
+
folder: string;
|
|
385
|
+
api?: string | null;
|
|
386
|
+
path?: string | null;
|
|
387
|
+
allowed_methods?: string[] | null;
|
|
388
|
+
created_at?: string | null;
|
|
389
|
+
}
|
|
390
|
+
type APIFolderList = PaginatedResponse<APIFolderSummary>;
|
|
391
|
+
interface OrganizationOwner {
|
|
392
|
+
key: string;
|
|
393
|
+
email: string;
|
|
394
|
+
first_name: string;
|
|
395
|
+
last_name: string;
|
|
396
|
+
full_name: string;
|
|
397
|
+
}
|
|
398
|
+
interface OrganizationSummary {
|
|
399
|
+
key: string;
|
|
400
|
+
name: string;
|
|
401
|
+
owner: OrganizationOwner;
|
|
402
|
+
tax_num: string;
|
|
403
|
+
city: string;
|
|
404
|
+
province: string;
|
|
405
|
+
address: string;
|
|
406
|
+
country_iso: string | null;
|
|
407
|
+
zip_code: string;
|
|
408
|
+
legal_name: string;
|
|
409
|
+
created_at: string;
|
|
410
|
+
block_dt?: string | null;
|
|
411
|
+
block_reason?: string | null;
|
|
412
|
+
is_blocked: boolean;
|
|
413
|
+
}
|
|
414
|
+
type OrganizationList = OrganizationSummary[];
|
|
415
|
+
interface PlanLimits {
|
|
416
|
+
units_included?: string | null;
|
|
417
|
+
projects?: number | null;
|
|
418
|
+
environments?: number | null;
|
|
419
|
+
folders?: number | null;
|
|
420
|
+
resources?: number | null;
|
|
421
|
+
users?: number | null;
|
|
422
|
+
components?: number | null;
|
|
423
|
+
allow_negative?: boolean | null;
|
|
424
|
+
negative_limit?: number | null;
|
|
425
|
+
unit_cost?: number | null;
|
|
426
|
+
api_keys_max_count?: number | null;
|
|
427
|
+
roles_max_count?: number | null;
|
|
428
|
+
locales_max_count?: number | null;
|
|
429
|
+
schemas_max_count?: number | null;
|
|
430
|
+
schemas_fields_max_count?: number | null;
|
|
431
|
+
flux_api_max_count?: number | null;
|
|
432
|
+
max_component_inheritance_depth?: number | null;
|
|
433
|
+
}
|
|
434
|
+
interface PlanDetails {
|
|
435
|
+
code: string;
|
|
436
|
+
name: string;
|
|
437
|
+
price: number;
|
|
438
|
+
from?: string | null;
|
|
439
|
+
to?: string | null;
|
|
440
|
+
transferred?: string | null;
|
|
441
|
+
limits: PlanLimits;
|
|
442
|
+
}
|
|
443
|
+
interface OrganizationPlanStatus {
|
|
444
|
+
active_plan: PlanDetails;
|
|
445
|
+
next_plan: PlanDetails;
|
|
446
|
+
}
|
|
447
|
+
interface UnitsUsage {
|
|
448
|
+
remained?: string | number | null;
|
|
449
|
+
unit_cost?: number | null;
|
|
450
|
+
allow_negative: boolean;
|
|
451
|
+
negative_limit?: string | null;
|
|
452
|
+
}
|
|
453
|
+
interface StorageUsage {
|
|
454
|
+
data_storage: number;
|
|
455
|
+
vector_storage: number;
|
|
456
|
+
}
|
|
457
|
+
interface UsageMetric {
|
|
458
|
+
max: number | null;
|
|
459
|
+
current: number;
|
|
460
|
+
}
|
|
461
|
+
interface UsageBreakdown {
|
|
462
|
+
projects: UsageMetric;
|
|
463
|
+
environments: UsageMetric;
|
|
464
|
+
folders: UsageMetric;
|
|
465
|
+
resources: UsageMetric;
|
|
466
|
+
users: UsageMetric;
|
|
467
|
+
components: UsageMetric;
|
|
468
|
+
}
|
|
469
|
+
interface CurrentUsage {
|
|
470
|
+
api_requests: number;
|
|
471
|
+
embedding_tokens: Record<string, any>;
|
|
472
|
+
}
|
|
473
|
+
interface OrganizationUsage {
|
|
474
|
+
units: UnitsUsage;
|
|
475
|
+
storage: StorageUsage;
|
|
476
|
+
usage: UsageBreakdown;
|
|
477
|
+
current_usage: CurrentUsage;
|
|
478
|
+
}
|
|
479
|
+
interface BatchUpsertItem {
|
|
480
|
+
external_id: string;
|
|
481
|
+
payload: Record<string, any>;
|
|
482
|
+
component?: string | null;
|
|
483
|
+
}
|
|
484
|
+
interface BatchItemError {
|
|
485
|
+
index: number;
|
|
486
|
+
external_id: string;
|
|
487
|
+
error: Error;
|
|
488
|
+
}
|
|
489
|
+
interface BatchUpsertResult {
|
|
490
|
+
succeeded: ResourceSummary[];
|
|
491
|
+
failed: BatchItemError[];
|
|
492
|
+
}
|
|
493
|
+
type FolderRef = string | FolderSummary;
|
|
494
|
+
type ResourceRef = string | ResourceSummary;
|
|
495
|
+
type RevisionRef = string | RevisionSummary;
|
|
496
|
+
type ComponentRef = string | ComponentSummary;
|
|
497
|
+
type SchemaVersionRef = string | SchemaVersionSummary;
|
|
498
|
+
type OrgRef = string | OrganizationSummary;
|
|
499
|
+
type ProjectRef = string | ProjectSummary;
|
|
500
|
+
type EnvironmentRef = string | EnvironmentSummary;
|
|
501
|
+
type ManagementRoleRef = string | ManagementRoleSummary;
|
|
502
|
+
type FluxRoleRef = string | FluxRoleSummary;
|
|
503
|
+
type ManagementAPIKeyRef = string | ManagementAPIKeySummary;
|
|
504
|
+
type FluxAPIKeyRef = string | FluxAPIKeySummary;
|
|
505
|
+
type APIRef = string | APIInfo;
|
|
506
|
+
/**
|
|
507
|
+
* Extract a string key from a value that is either a string or
|
|
508
|
+
* an object with a `key` attribute.
|
|
509
|
+
*/
|
|
510
|
+
declare function resolveKey(value: string | {
|
|
511
|
+
key: string;
|
|
512
|
+
}): string;
|
|
513
|
+
|
|
514
|
+
interface ManagementClientOptions {
|
|
515
|
+
baseUrl?: string;
|
|
516
|
+
environmentKey: string;
|
|
517
|
+
auth: AuthStrategy;
|
|
518
|
+
timeout?: number;
|
|
519
|
+
retryConfig?: RetryConfig;
|
|
520
|
+
defaultHeaders?: Record<string, string>;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Client for the FoxNose Management API.
|
|
524
|
+
*
|
|
525
|
+
* All methods are async and return parsed response objects.
|
|
526
|
+
*/
|
|
527
|
+
declare class ManagementClient {
|
|
528
|
+
readonly environmentKey: string;
|
|
529
|
+
private readonly transport;
|
|
530
|
+
private readonly paths;
|
|
531
|
+
constructor(options: ManagementClientOptions);
|
|
532
|
+
/**
|
|
533
|
+
* Low-level escape hatch for calling arbitrary endpoints.
|
|
534
|
+
*/
|
|
535
|
+
request(method: string, path: string, options?: {
|
|
536
|
+
params?: Record<string, any>;
|
|
537
|
+
jsonBody?: any;
|
|
538
|
+
headers?: Record<string, string>;
|
|
539
|
+
parseJson?: boolean;
|
|
540
|
+
}): Promise<any>;
|
|
541
|
+
close(): void;
|
|
542
|
+
listOrganizations(): Promise<OrganizationList>;
|
|
543
|
+
getOrganization(orgKey: OrgRef): Promise<OrganizationSummary>;
|
|
544
|
+
updateOrganization(orgKey: OrgRef, payload: Record<string, any>): Promise<OrganizationSummary>;
|
|
545
|
+
listRegions(): Promise<RegionInfo[]>;
|
|
546
|
+
getAvailablePlans(): Promise<OrganizationPlanStatus>;
|
|
547
|
+
getOrganizationPlan(orgKey: OrgRef): Promise<OrganizationPlanStatus>;
|
|
548
|
+
setOrganizationPlan(orgKey: OrgRef, planCode: string): Promise<OrganizationPlanStatus>;
|
|
549
|
+
getOrganizationUsage(orgKey: OrgRef): Promise<OrganizationUsage>;
|
|
550
|
+
listManagementApiKeys(params?: Record<string, any>): Promise<ManagementAPIKeyList>;
|
|
551
|
+
createManagementApiKey(payload: Record<string, any>): Promise<ManagementAPIKeySummary>;
|
|
552
|
+
getManagementApiKey(key: ManagementAPIKeyRef): Promise<ManagementAPIKeySummary>;
|
|
553
|
+
updateManagementApiKey(key: ManagementAPIKeyRef, payload: Record<string, any>): Promise<ManagementAPIKeySummary>;
|
|
554
|
+
deleteManagementApiKey(key: ManagementAPIKeyRef): Promise<void>;
|
|
555
|
+
listFluxApiKeys(params?: Record<string, any>): Promise<FluxAPIKeyList>;
|
|
556
|
+
createFluxApiKey(payload: Record<string, any>): Promise<FluxAPIKeySummary>;
|
|
557
|
+
getFluxApiKey(key: FluxAPIKeyRef): Promise<FluxAPIKeySummary>;
|
|
558
|
+
updateFluxApiKey(key: FluxAPIKeyRef, payload: Record<string, any>): Promise<FluxAPIKeySummary>;
|
|
559
|
+
deleteFluxApiKey(key: FluxAPIKeyRef): Promise<void>;
|
|
560
|
+
listApis(params?: Record<string, any>): Promise<APIList>;
|
|
561
|
+
createApi(payload: Record<string, any>): Promise<APIInfo>;
|
|
562
|
+
getApi(apiKey: APIRef): Promise<APIInfo>;
|
|
563
|
+
updateApi(apiKey: APIRef, payload: Record<string, any>): Promise<APIInfo>;
|
|
564
|
+
deleteApi(apiKey: APIRef): Promise<void>;
|
|
565
|
+
listApiFolders(apiKey: APIRef, params?: Record<string, any>): Promise<APIFolderList>;
|
|
566
|
+
addApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: {
|
|
567
|
+
allowedMethods?: string[];
|
|
568
|
+
}): Promise<APIFolderSummary>;
|
|
569
|
+
getApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<APIFolderSummary>;
|
|
570
|
+
updateApiFolder(apiKey: APIRef, folderKey: FolderRef, options?: {
|
|
571
|
+
allowedMethods?: string[];
|
|
572
|
+
}): Promise<APIFolderSummary>;
|
|
573
|
+
removeApiFolder(apiKey: APIRef, folderKey: FolderRef): Promise<void>;
|
|
574
|
+
listManagementRoles(params?: Record<string, any>): Promise<ManagementRoleList>;
|
|
575
|
+
createManagementRole(payload: Record<string, any>): Promise<ManagementRoleSummary>;
|
|
576
|
+
getManagementRole(roleKey: ManagementRoleRef): Promise<ManagementRoleSummary>;
|
|
577
|
+
updateManagementRole(roleKey: ManagementRoleRef, payload: Record<string, any>): Promise<ManagementRoleSummary>;
|
|
578
|
+
deleteManagementRole(roleKey: ManagementRoleRef): Promise<void>;
|
|
579
|
+
listManagementRolePermissions(roleKey: ManagementRoleRef): Promise<RolePermission[]>;
|
|
580
|
+
upsertManagementRolePermission(roleKey: ManagementRoleRef, payload: Record<string, any>): Promise<RolePermission>;
|
|
581
|
+
deleteManagementRolePermission(roleKey: ManagementRoleRef, contentType: string): Promise<void>;
|
|
582
|
+
replaceManagementRolePermissions(roleKey: ManagementRoleRef, permissions: Array<Record<string, any>>): Promise<RolePermission[]>;
|
|
583
|
+
listManagementPermissionObjects(roleKey: ManagementRoleRef, contentType: string): Promise<RolePermissionObject[]>;
|
|
584
|
+
addManagementPermissionObject(roleKey: ManagementRoleRef, payload: Record<string, any>): Promise<RolePermissionObject>;
|
|
585
|
+
deleteManagementPermissionObject(roleKey: ManagementRoleRef, payload: Record<string, any>): Promise<void>;
|
|
586
|
+
listFluxRoles(params?: Record<string, any>): Promise<FluxRoleList>;
|
|
587
|
+
createFluxRole(payload: Record<string, any>): Promise<FluxRoleSummary>;
|
|
588
|
+
getFluxRole(roleKey: FluxRoleRef): Promise<FluxRoleSummary>;
|
|
589
|
+
updateFluxRole(roleKey: FluxRoleRef, payload: Record<string, any>): Promise<FluxRoleSummary>;
|
|
590
|
+
deleteFluxRole(roleKey: FluxRoleRef): Promise<void>;
|
|
591
|
+
listFluxRolePermissions(roleKey: FluxRoleRef): Promise<RolePermission[]>;
|
|
592
|
+
upsertFluxRolePermission(roleKey: FluxRoleRef, payload: Record<string, any>): Promise<RolePermission>;
|
|
593
|
+
deleteFluxRolePermission(roleKey: FluxRoleRef, contentType: string): Promise<void>;
|
|
594
|
+
replaceFluxRolePermissions(roleKey: FluxRoleRef, permissions: Array<Record<string, any>>): Promise<RolePermission[]>;
|
|
595
|
+
listFluxPermissionObjects(roleKey: FluxRoleRef, contentType: string): Promise<RolePermissionObject[]>;
|
|
596
|
+
addFluxPermissionObject(roleKey: FluxRoleRef, payload: Record<string, any>): Promise<RolePermissionObject>;
|
|
597
|
+
deleteFluxPermissionObject(roleKey: FluxRoleRef, payload: Record<string, any>): Promise<void>;
|
|
598
|
+
listFolders(params?: Record<string, any>): Promise<FolderList>;
|
|
599
|
+
getFolder(folderKey: FolderRef): Promise<FolderSummary>;
|
|
600
|
+
getFolderByPath(path: string): Promise<FolderSummary>;
|
|
601
|
+
listFolderTree(options?: {
|
|
602
|
+
key?: string;
|
|
603
|
+
mode?: string;
|
|
604
|
+
}): Promise<FolderList>;
|
|
605
|
+
createFolder(payload: Record<string, any>): Promise<FolderSummary>;
|
|
606
|
+
updateFolder(folderKey: FolderRef, payload: Record<string, any>): Promise<FolderSummary>;
|
|
607
|
+
deleteFolder(folderKey: FolderRef): Promise<void>;
|
|
608
|
+
listFolderVersions(folderKey: FolderRef, params?: Record<string, any>): Promise<SchemaVersionList>;
|
|
609
|
+
createFolderVersion(folderKey: FolderRef, payload: Record<string, any>, options?: {
|
|
610
|
+
copyFrom?: SchemaVersionRef;
|
|
611
|
+
}): Promise<SchemaVersionSummary>;
|
|
612
|
+
getFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef, options?: {
|
|
613
|
+
includeSchema?: boolean;
|
|
614
|
+
}): Promise<SchemaVersionSummary>;
|
|
615
|
+
updateFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<SchemaVersionSummary>;
|
|
616
|
+
deleteFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef): Promise<void>;
|
|
617
|
+
publishFolderVersion(folderKey: FolderRef, versionKey: SchemaVersionRef): Promise<SchemaVersionSummary>;
|
|
618
|
+
listFolderFields(folderKey: FolderRef, versionKey: SchemaVersionRef, params?: Record<string, any>): Promise<FieldList>;
|
|
619
|
+
createFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<FieldSummary>;
|
|
620
|
+
getFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<FieldSummary>;
|
|
621
|
+
updateFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, fieldPath: string, payload: Record<string, any>): Promise<FieldSummary>;
|
|
622
|
+
deleteFolderField(folderKey: FolderRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<void>;
|
|
623
|
+
listComponents(params?: Record<string, any>): Promise<ComponentList>;
|
|
624
|
+
getComponent(componentKey: ComponentRef): Promise<ComponentSummary>;
|
|
625
|
+
createComponent(payload: Record<string, any>): Promise<ComponentSummary>;
|
|
626
|
+
updateComponent(componentKey: ComponentRef, payload: Record<string, any>): Promise<ComponentSummary>;
|
|
627
|
+
deleteComponent(componentKey: ComponentRef): Promise<void>;
|
|
628
|
+
listComponentVersions(componentKey: ComponentRef, params?: Record<string, any>): Promise<SchemaVersionList>;
|
|
629
|
+
createComponentVersion(componentKey: ComponentRef, payload: Record<string, any>, options?: {
|
|
630
|
+
copyFrom?: SchemaVersionRef;
|
|
631
|
+
}): Promise<SchemaVersionSummary>;
|
|
632
|
+
getComponentVersion(componentKey: ComponentRef, versionKey: SchemaVersionRef, options?: {
|
|
633
|
+
includeSchema?: boolean;
|
|
634
|
+
}): Promise<SchemaVersionSummary>;
|
|
635
|
+
publishComponentVersion(componentKey: ComponentRef, versionKey: SchemaVersionRef): Promise<SchemaVersionSummary>;
|
|
636
|
+
updateComponentVersion(componentKey: ComponentRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<SchemaVersionSummary>;
|
|
637
|
+
deleteComponentVersion(componentKey: ComponentRef, versionKey: SchemaVersionRef): Promise<void>;
|
|
638
|
+
listComponentFields(componentKey: ComponentRef, versionKey: SchemaVersionRef, params?: Record<string, any>): Promise<FieldList>;
|
|
639
|
+
createComponentField(componentKey: ComponentRef, versionKey: SchemaVersionRef, payload: Record<string, any>): Promise<FieldSummary>;
|
|
640
|
+
getComponentField(componentKey: ComponentRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<FieldSummary>;
|
|
641
|
+
updateComponentField(componentKey: ComponentRef, versionKey: SchemaVersionRef, fieldPath: string, payload: Record<string, any>): Promise<FieldSummary>;
|
|
642
|
+
deleteComponentField(componentKey: ComponentRef, versionKey: SchemaVersionRef, fieldPath: string): Promise<void>;
|
|
643
|
+
listResources(folderKey: FolderRef, params?: Record<string, any>): Promise<ResourceList>;
|
|
644
|
+
getResource(folderKey: FolderRef, resourceKey: ResourceRef): Promise<ResourceSummary>;
|
|
645
|
+
createResource(folderKey: FolderRef, payload: Record<string, any>, options?: {
|
|
646
|
+
component?: ComponentRef;
|
|
647
|
+
externalId?: string;
|
|
648
|
+
}): Promise<ResourceSummary>;
|
|
649
|
+
upsertResource(folderKey: FolderRef, payload: Record<string, any>, options: {
|
|
650
|
+
externalId: string;
|
|
651
|
+
component?: ComponentRef;
|
|
652
|
+
}): Promise<ResourceSummary>;
|
|
653
|
+
batchUpsertResources(folderKey: FolderRef, items: BatchUpsertItem[], options?: {
|
|
654
|
+
maxConcurrency?: number;
|
|
655
|
+
failFast?: boolean;
|
|
656
|
+
onProgress?: (completed: number, total: number) => void;
|
|
657
|
+
}): Promise<BatchUpsertResult>;
|
|
658
|
+
updateResource(folderKey: FolderRef, resourceKey: ResourceRef, payload: Record<string, any>): Promise<ResourceSummary>;
|
|
659
|
+
deleteResource(folderKey: FolderRef, resourceKey: ResourceRef): Promise<void>;
|
|
660
|
+
getResourceData(folderKey: FolderRef, resourceKey: ResourceRef): Promise<Record<string, any>>;
|
|
661
|
+
listRevisions(folderKey: FolderRef, resourceKey: ResourceRef, params?: Record<string, any>): Promise<RevisionList>;
|
|
662
|
+
createRevision(folderKey: FolderRef, resourceKey: ResourceRef, payload: Record<string, any>): Promise<RevisionSummary>;
|
|
663
|
+
getRevision(folderKey: FolderRef, resourceKey: ResourceRef, revisionKey: RevisionRef): Promise<RevisionSummary>;
|
|
664
|
+
updateRevision(folderKey: FolderRef, resourceKey: ResourceRef, revisionKey: RevisionRef, payload: Record<string, any>): Promise<RevisionSummary>;
|
|
665
|
+
deleteRevision(folderKey: FolderRef, resourceKey: ResourceRef, revisionKey: RevisionRef): Promise<void>;
|
|
666
|
+
publishRevision(folderKey: FolderRef, resourceKey: ResourceRef, revisionKey: RevisionRef, payload?: Record<string, any>): Promise<RevisionSummary>;
|
|
667
|
+
validateRevision(folderKey: FolderRef, resourceKey: ResourceRef, revisionKey: RevisionRef): Promise<Record<string, any>>;
|
|
668
|
+
getRevisionData(folderKey: FolderRef, resourceKey: ResourceRef, revisionKey: RevisionRef): Promise<Record<string, any>>;
|
|
669
|
+
listLocales(): Promise<LocaleList>;
|
|
670
|
+
createLocale(payload: Record<string, any>): Promise<LocaleSummary>;
|
|
671
|
+
getLocale(code: string): Promise<LocaleSummary>;
|
|
672
|
+
updateLocale(code: string, payload: Record<string, any>): Promise<LocaleSummary>;
|
|
673
|
+
deleteLocale(code: string): Promise<void>;
|
|
674
|
+
listProjects(orgKey: OrgRef, params?: Record<string, any>): Promise<ProjectList>;
|
|
675
|
+
getProject(orgKey: OrgRef, projectKey: ProjectRef): Promise<ProjectSummary>;
|
|
676
|
+
createProject(orgKey: OrgRef, payload: Record<string, any>): Promise<ProjectSummary>;
|
|
677
|
+
updateProject(orgKey: OrgRef, projectKey: ProjectRef, payload: Record<string, any>): Promise<ProjectSummary>;
|
|
678
|
+
deleteProject(orgKey: OrgRef, projectKey: ProjectRef): Promise<void>;
|
|
679
|
+
listEnvironments(orgKey: OrgRef, projectKey: ProjectRef): Promise<EnvironmentList>;
|
|
680
|
+
getEnvironment(orgKey: OrgRef, projectKey: ProjectRef, envKey: EnvironmentRef): Promise<EnvironmentSummary>;
|
|
681
|
+
createEnvironment(orgKey: OrgRef, projectKey: ProjectRef, payload: Record<string, any>): Promise<EnvironmentSummary>;
|
|
682
|
+
updateEnvironment(orgKey: OrgRef, projectKey: ProjectRef, envKey: EnvironmentRef, payload: Record<string, any>): Promise<EnvironmentSummary>;
|
|
683
|
+
deleteEnvironment(orgKey: OrgRef, projectKey: ProjectRef, envKey: EnvironmentRef): Promise<void>;
|
|
684
|
+
toggleEnvironment(orgKey: OrgRef, projectKey: ProjectRef, envKey: EnvironmentRef, isEnabled: boolean): Promise<void>;
|
|
685
|
+
updateEnvironmentProtection(orgKey: OrgRef, projectKey: ProjectRef, envKey: EnvironmentRef, options: {
|
|
686
|
+
protectionLevel: string;
|
|
687
|
+
protectionReason?: string;
|
|
688
|
+
}): Promise<EnvironmentSummary>;
|
|
689
|
+
clearEnvironmentProtection(orgKey: OrgRef, projectKey: ProjectRef, envKey: EnvironmentRef): Promise<EnvironmentSummary>;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
interface FluxClientOptions {
|
|
693
|
+
baseUrl: string;
|
|
694
|
+
apiPrefix: string;
|
|
695
|
+
auth: AuthStrategy;
|
|
696
|
+
timeout?: number;
|
|
697
|
+
retryConfig?: RetryConfig;
|
|
698
|
+
defaultHeaders?: Record<string, string>;
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Client for FoxNose Flux delivery APIs.
|
|
702
|
+
*
|
|
703
|
+
* All methods are async and return parsed JSON responses.
|
|
704
|
+
*/
|
|
705
|
+
declare class FluxClient {
|
|
706
|
+
readonly apiPrefix: string;
|
|
707
|
+
private readonly transport;
|
|
708
|
+
constructor(options: FluxClientOptions);
|
|
709
|
+
private buildPath;
|
|
710
|
+
listResources<T = any>(folderPath: string, params?: Record<string, any>): Promise<T>;
|
|
711
|
+
getResource<T = any>(folderPath: string, resourceKey: string, params?: Record<string, any>): Promise<T>;
|
|
712
|
+
search<T = any>(folderPath: string, body: Record<string, any>): Promise<T>;
|
|
713
|
+
close(): void;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
export { type APIFolderList, type APIFolderSummary, type APIInfo, type APIList, type APIRef, AnonymousAuth, 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 };
|