@fluxbase/sdk 2026.2.8 → 2026.3.2-rc.3
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 +4 -0
- package/dist/index.cjs +323 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +407 -2
- package/dist/index.d.ts +407 -2
- package/dist/index.js +323 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5591,7 +5591,9 @@ var OAuthProviderManager = class {
|
|
|
5591
5591
|
* ```
|
|
5592
5592
|
*/
|
|
5593
5593
|
async listProviders() {
|
|
5594
|
-
const providers = await this.fetch.get(
|
|
5594
|
+
const providers = await this.fetch.get(
|
|
5595
|
+
"/api/v1/admin/oauth/providers"
|
|
5596
|
+
);
|
|
5595
5597
|
return Array.isArray(providers) ? providers : [];
|
|
5596
5598
|
}
|
|
5597
5599
|
/**
|
|
@@ -5613,7 +5615,9 @@ var OAuthProviderManager = class {
|
|
|
5613
5615
|
* ```
|
|
5614
5616
|
*/
|
|
5615
5617
|
async getProvider(providerId) {
|
|
5616
|
-
return await this.fetch.get(
|
|
5618
|
+
return await this.fetch.get(
|
|
5619
|
+
`/api/v1/admin/oauth/providers/${providerId}`
|
|
5620
|
+
);
|
|
5617
5621
|
}
|
|
5618
5622
|
/**
|
|
5619
5623
|
* Create a new OAuth provider
|
|
@@ -5652,7 +5656,7 @@ var OAuthProviderManager = class {
|
|
|
5652
5656
|
* client_id: 'client-id',
|
|
5653
5657
|
* client_secret: 'client-secret',
|
|
5654
5658
|
* redirect_url: 'https://yourapp.com/auth/callback',
|
|
5655
|
-
* scopes: ['openid', 'profile', 'email'],
|
|
5659
|
+
* scopes: ['openid', 'profile', 'email', 'offline_access'],
|
|
5656
5660
|
* is_custom: true,
|
|
5657
5661
|
* authorization_url: 'https://sso.example.com/oauth/authorize',
|
|
5658
5662
|
* token_url: 'https://sso.example.com/oauth/token',
|
|
@@ -5661,7 +5665,10 @@ var OAuthProviderManager = class {
|
|
|
5661
5665
|
* ```
|
|
5662
5666
|
*/
|
|
5663
5667
|
async createProvider(request) {
|
|
5664
|
-
return await this.fetch.post(
|
|
5668
|
+
return await this.fetch.post(
|
|
5669
|
+
"/api/v1/admin/oauth/providers",
|
|
5670
|
+
request
|
|
5671
|
+
);
|
|
5665
5672
|
}
|
|
5666
5673
|
/**
|
|
5667
5674
|
* Update an existing OAuth provider
|
|
@@ -5831,7 +5838,10 @@ var AuthSettingsManager = class {
|
|
|
5831
5838
|
* ```
|
|
5832
5839
|
*/
|
|
5833
5840
|
async update(request) {
|
|
5834
|
-
return await this.fetch.put(
|
|
5841
|
+
return await this.fetch.put(
|
|
5842
|
+
"/api/v1/admin/auth/settings",
|
|
5843
|
+
request
|
|
5844
|
+
);
|
|
5835
5845
|
}
|
|
5836
5846
|
};
|
|
5837
5847
|
var FluxbaseOAuth = class {
|
|
@@ -10105,6 +10115,312 @@ var FluxbaseAdmin = class {
|
|
|
10105
10115
|
}
|
|
10106
10116
|
};
|
|
10107
10117
|
|
|
10118
|
+
// src/secrets.ts
|
|
10119
|
+
var SecretsManager = class {
|
|
10120
|
+
constructor(fetch2) {
|
|
10121
|
+
this.fetch = fetch2;
|
|
10122
|
+
}
|
|
10123
|
+
/**
|
|
10124
|
+
* Create a new secret
|
|
10125
|
+
*
|
|
10126
|
+
* Creates a new secret with the specified name, value, and scope.
|
|
10127
|
+
* The value is encrypted at rest and never returned by the API.
|
|
10128
|
+
*
|
|
10129
|
+
* @param request - Secret creation request
|
|
10130
|
+
* @returns Promise resolving to the created secret (metadata only)
|
|
10131
|
+
*
|
|
10132
|
+
* @example
|
|
10133
|
+
* ```typescript
|
|
10134
|
+
* // Create a global secret
|
|
10135
|
+
* const secret = await client.secrets.create({
|
|
10136
|
+
* name: 'SENDGRID_API_KEY',
|
|
10137
|
+
* value: 'SG.xxx',
|
|
10138
|
+
* description: 'SendGrid API key for transactional emails'
|
|
10139
|
+
* })
|
|
10140
|
+
*
|
|
10141
|
+
* // Create a namespace-scoped secret
|
|
10142
|
+
* const secret = await client.secrets.create({
|
|
10143
|
+
* name: 'DATABASE_URL',
|
|
10144
|
+
* value: 'postgres://user:pass@host:5432/db',
|
|
10145
|
+
* scope: 'namespace',
|
|
10146
|
+
* namespace: 'production',
|
|
10147
|
+
* description: 'Production database URL'
|
|
10148
|
+
* })
|
|
10149
|
+
*
|
|
10150
|
+
* // Create a secret with expiration
|
|
10151
|
+
* const secret = await client.secrets.create({
|
|
10152
|
+
* name: 'TEMP_TOKEN',
|
|
10153
|
+
* value: 'xyz123',
|
|
10154
|
+
* expires_at: '2025-12-31T23:59:59Z'
|
|
10155
|
+
* })
|
|
10156
|
+
* ```
|
|
10157
|
+
*/
|
|
10158
|
+
async create(request) {
|
|
10159
|
+
return await this.fetch.post("/api/v1/secrets", request);
|
|
10160
|
+
}
|
|
10161
|
+
/**
|
|
10162
|
+
* Get a secret by name (metadata only, never includes value)
|
|
10163
|
+
*
|
|
10164
|
+
* @param name - Secret name
|
|
10165
|
+
* @param options - Optional namespace for namespace-scoped secrets
|
|
10166
|
+
* @returns Promise resolving to the secret
|
|
10167
|
+
*
|
|
10168
|
+
* @example
|
|
10169
|
+
* ```typescript
|
|
10170
|
+
* // Get a global secret
|
|
10171
|
+
* const secret = await client.secrets.get('API_KEY')
|
|
10172
|
+
*
|
|
10173
|
+
* // Get a namespace-scoped secret
|
|
10174
|
+
* const secret = await client.secrets.get('DATABASE_URL', { namespace: 'production' })
|
|
10175
|
+
* ```
|
|
10176
|
+
*/
|
|
10177
|
+
async get(name, options) {
|
|
10178
|
+
const params = new URLSearchParams();
|
|
10179
|
+
if (options?.namespace) {
|
|
10180
|
+
params.set("namespace", options.namespace);
|
|
10181
|
+
}
|
|
10182
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
10183
|
+
return await this.fetch.get(`/api/v1/secrets/by-name/${encodeURIComponent(name)}${query}`);
|
|
10184
|
+
}
|
|
10185
|
+
/**
|
|
10186
|
+
* Update a secret by name
|
|
10187
|
+
*
|
|
10188
|
+
* Updates the secret's value, description, or expiration.
|
|
10189
|
+
* Only provided fields will be updated.
|
|
10190
|
+
*
|
|
10191
|
+
* @param name - Secret name
|
|
10192
|
+
* @param request - Update request
|
|
10193
|
+
* @param options - Optional namespace for namespace-scoped secrets
|
|
10194
|
+
* @returns Promise resolving to the updated secret
|
|
10195
|
+
*
|
|
10196
|
+
* @example
|
|
10197
|
+
* ```typescript
|
|
10198
|
+
* // Update secret value
|
|
10199
|
+
* const secret = await client.secrets.update('API_KEY', { value: 'new-value' })
|
|
10200
|
+
*
|
|
10201
|
+
* // Update description
|
|
10202
|
+
* const secret = await client.secrets.update('API_KEY', { description: 'Updated description' })
|
|
10203
|
+
*
|
|
10204
|
+
* // Update namespace-scoped secret
|
|
10205
|
+
* const secret = await client.secrets.update('DATABASE_URL',
|
|
10206
|
+
* { value: 'postgres://new-host:5432/db' },
|
|
10207
|
+
* { namespace: 'production' }
|
|
10208
|
+
* )
|
|
10209
|
+
* ```
|
|
10210
|
+
*/
|
|
10211
|
+
async update(name, request, options) {
|
|
10212
|
+
const params = new URLSearchParams();
|
|
10213
|
+
if (options?.namespace) {
|
|
10214
|
+
params.set("namespace", options.namespace);
|
|
10215
|
+
}
|
|
10216
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
10217
|
+
return await this.fetch.put(`/api/v1/secrets/by-name/${encodeURIComponent(name)}${query}`, request);
|
|
10218
|
+
}
|
|
10219
|
+
/**
|
|
10220
|
+
* Delete a secret by name
|
|
10221
|
+
*
|
|
10222
|
+
* Permanently deletes the secret and all its versions.
|
|
10223
|
+
*
|
|
10224
|
+
* @param name - Secret name
|
|
10225
|
+
* @param options - Optional namespace for namespace-scoped secrets
|
|
10226
|
+
* @returns Promise resolving when deletion is complete
|
|
10227
|
+
*
|
|
10228
|
+
* @example
|
|
10229
|
+
* ```typescript
|
|
10230
|
+
* // Delete a global secret
|
|
10231
|
+
* await client.secrets.delete('OLD_API_KEY')
|
|
10232
|
+
*
|
|
10233
|
+
* // Delete a namespace-scoped secret
|
|
10234
|
+
* await client.secrets.delete('DATABASE_URL', { namespace: 'staging' })
|
|
10235
|
+
* ```
|
|
10236
|
+
*/
|
|
10237
|
+
async delete(name, options) {
|
|
10238
|
+
const params = new URLSearchParams();
|
|
10239
|
+
if (options?.namespace) {
|
|
10240
|
+
params.set("namespace", options.namespace);
|
|
10241
|
+
}
|
|
10242
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
10243
|
+
await this.fetch.delete(`/api/v1/secrets/by-name/${encodeURIComponent(name)}${query}`);
|
|
10244
|
+
}
|
|
10245
|
+
/**
|
|
10246
|
+
* Get version history for a secret by name
|
|
10247
|
+
*
|
|
10248
|
+
* Returns all historical versions of the secret (values are never included).
|
|
10249
|
+
*
|
|
10250
|
+
* @param name - Secret name
|
|
10251
|
+
* @param options - Optional namespace for namespace-scoped secrets
|
|
10252
|
+
* @returns Promise resolving to array of secret versions
|
|
10253
|
+
*
|
|
10254
|
+
* @example
|
|
10255
|
+
* ```typescript
|
|
10256
|
+
* const versions = await client.secrets.getVersions('API_KEY')
|
|
10257
|
+
*
|
|
10258
|
+
* versions.forEach(v => {
|
|
10259
|
+
* console.log(`Version ${v.version} created at ${v.created_at}`)
|
|
10260
|
+
* })
|
|
10261
|
+
* ```
|
|
10262
|
+
*/
|
|
10263
|
+
async getVersions(name, options) {
|
|
10264
|
+
const params = new URLSearchParams();
|
|
10265
|
+
if (options?.namespace) {
|
|
10266
|
+
params.set("namespace", options.namespace);
|
|
10267
|
+
}
|
|
10268
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
10269
|
+
return await this.fetch.get(`/api/v1/secrets/by-name/${encodeURIComponent(name)}/versions${query}`);
|
|
10270
|
+
}
|
|
10271
|
+
/**
|
|
10272
|
+
* Rollback a secret to a previous version by name
|
|
10273
|
+
*
|
|
10274
|
+
* Restores the secret to a previous version's value.
|
|
10275
|
+
* This creates a new version with the old value.
|
|
10276
|
+
*
|
|
10277
|
+
* @param name - Secret name
|
|
10278
|
+
* @param version - Version number to rollback to
|
|
10279
|
+
* @param options - Optional namespace for namespace-scoped secrets
|
|
10280
|
+
* @returns Promise resolving to the updated secret
|
|
10281
|
+
*
|
|
10282
|
+
* @example
|
|
10283
|
+
* ```typescript
|
|
10284
|
+
* // Rollback to version 2
|
|
10285
|
+
* const secret = await client.secrets.rollback('API_KEY', 2)
|
|
10286
|
+
* console.log(`Secret now at version ${secret.version}`)
|
|
10287
|
+
* ```
|
|
10288
|
+
*/
|
|
10289
|
+
async rollback(name, version, options) {
|
|
10290
|
+
const params = new URLSearchParams();
|
|
10291
|
+
if (options?.namespace) {
|
|
10292
|
+
params.set("namespace", options.namespace);
|
|
10293
|
+
}
|
|
10294
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
10295
|
+
return await this.fetch.post(
|
|
10296
|
+
`/api/v1/secrets/by-name/${encodeURIComponent(name)}/rollback/${version}${query}`,
|
|
10297
|
+
{}
|
|
10298
|
+
);
|
|
10299
|
+
}
|
|
10300
|
+
/**
|
|
10301
|
+
* List all secrets (metadata only, never includes values)
|
|
10302
|
+
*
|
|
10303
|
+
* @param options - Filter options for scope and namespace
|
|
10304
|
+
* @returns Promise resolving to array of secret summaries
|
|
10305
|
+
*
|
|
10306
|
+
* @example
|
|
10307
|
+
* ```typescript
|
|
10308
|
+
* // List all secrets
|
|
10309
|
+
* const secrets = await client.secrets.list()
|
|
10310
|
+
*
|
|
10311
|
+
* // List only global secrets
|
|
10312
|
+
* const secrets = await client.secrets.list({ scope: 'global' })
|
|
10313
|
+
*
|
|
10314
|
+
* // List secrets for a specific namespace
|
|
10315
|
+
* const secrets = await client.secrets.list({ namespace: 'production' })
|
|
10316
|
+
*
|
|
10317
|
+
* secrets.forEach(s => {
|
|
10318
|
+
* console.log(`${s.name}: version ${s.version}, expired: ${s.is_expired}`)
|
|
10319
|
+
* })
|
|
10320
|
+
* ```
|
|
10321
|
+
*/
|
|
10322
|
+
async list(options) {
|
|
10323
|
+
const params = new URLSearchParams();
|
|
10324
|
+
if (options?.scope) {
|
|
10325
|
+
params.set("scope", options.scope);
|
|
10326
|
+
}
|
|
10327
|
+
if (options?.namespace) {
|
|
10328
|
+
params.set("namespace", options.namespace);
|
|
10329
|
+
}
|
|
10330
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
10331
|
+
return await this.fetch.get(`/api/v1/secrets${query}`);
|
|
10332
|
+
}
|
|
10333
|
+
/**
|
|
10334
|
+
* Get statistics about secrets
|
|
10335
|
+
*
|
|
10336
|
+
* @returns Promise resolving to secret statistics
|
|
10337
|
+
*
|
|
10338
|
+
* @example
|
|
10339
|
+
* ```typescript
|
|
10340
|
+
* const stats = await client.secrets.stats()
|
|
10341
|
+
* console.log(`Total: ${stats.total}, Expiring soon: ${stats.expiring_soon}, Expired: ${stats.expired}`)
|
|
10342
|
+
* ```
|
|
10343
|
+
*/
|
|
10344
|
+
async stats() {
|
|
10345
|
+
return await this.fetch.get("/api/v1/secrets/stats");
|
|
10346
|
+
}
|
|
10347
|
+
// UUID-based methods for backward compatibility
|
|
10348
|
+
/**
|
|
10349
|
+
* Get a secret by ID (metadata only)
|
|
10350
|
+
*
|
|
10351
|
+
* @param id - Secret UUID
|
|
10352
|
+
* @returns Promise resolving to the secret
|
|
10353
|
+
*
|
|
10354
|
+
* @example
|
|
10355
|
+
* ```typescript
|
|
10356
|
+
* const secret = await client.secrets.getById('550e8400-e29b-41d4-a716-446655440000')
|
|
10357
|
+
* ```
|
|
10358
|
+
*/
|
|
10359
|
+
async getById(id) {
|
|
10360
|
+
return await this.fetch.get(`/api/v1/secrets/${encodeURIComponent(id)}`);
|
|
10361
|
+
}
|
|
10362
|
+
/**
|
|
10363
|
+
* Update a secret by ID
|
|
10364
|
+
*
|
|
10365
|
+
* @param id - Secret UUID
|
|
10366
|
+
* @param request - Update request
|
|
10367
|
+
* @returns Promise resolving to the updated secret
|
|
10368
|
+
*
|
|
10369
|
+
* @example
|
|
10370
|
+
* ```typescript
|
|
10371
|
+
* const secret = await client.secrets.updateById('550e8400-e29b-41d4-a716-446655440000', {
|
|
10372
|
+
* value: 'new-value'
|
|
10373
|
+
* })
|
|
10374
|
+
* ```
|
|
10375
|
+
*/
|
|
10376
|
+
async updateById(id, request) {
|
|
10377
|
+
return await this.fetch.put(`/api/v1/secrets/${encodeURIComponent(id)}`, request);
|
|
10378
|
+
}
|
|
10379
|
+
/**
|
|
10380
|
+
* Delete a secret by ID
|
|
10381
|
+
*
|
|
10382
|
+
* @param id - Secret UUID
|
|
10383
|
+
* @returns Promise resolving when deletion is complete
|
|
10384
|
+
*
|
|
10385
|
+
* @example
|
|
10386
|
+
* ```typescript
|
|
10387
|
+
* await client.secrets.deleteById('550e8400-e29b-41d4-a716-446655440000')
|
|
10388
|
+
* ```
|
|
10389
|
+
*/
|
|
10390
|
+
async deleteById(id) {
|
|
10391
|
+
await this.fetch.delete(`/api/v1/secrets/${encodeURIComponent(id)}`);
|
|
10392
|
+
}
|
|
10393
|
+
/**
|
|
10394
|
+
* Get version history for a secret by ID
|
|
10395
|
+
*
|
|
10396
|
+
* @param id - Secret UUID
|
|
10397
|
+
* @returns Promise resolving to array of secret versions
|
|
10398
|
+
*
|
|
10399
|
+
* @example
|
|
10400
|
+
* ```typescript
|
|
10401
|
+
* const versions = await client.secrets.getVersionsById('550e8400-e29b-41d4-a716-446655440000')
|
|
10402
|
+
* ```
|
|
10403
|
+
*/
|
|
10404
|
+
async getVersionsById(id) {
|
|
10405
|
+
return await this.fetch.get(`/api/v1/secrets/${encodeURIComponent(id)}/versions`);
|
|
10406
|
+
}
|
|
10407
|
+
/**
|
|
10408
|
+
* Rollback a secret to a previous version by ID
|
|
10409
|
+
*
|
|
10410
|
+
* @param id - Secret UUID
|
|
10411
|
+
* @param version - Version number to rollback to
|
|
10412
|
+
* @returns Promise resolving to the updated secret
|
|
10413
|
+
*
|
|
10414
|
+
* @example
|
|
10415
|
+
* ```typescript
|
|
10416
|
+
* const secret = await client.secrets.rollbackById('550e8400-e29b-41d4-a716-446655440000', 2)
|
|
10417
|
+
* ```
|
|
10418
|
+
*/
|
|
10419
|
+
async rollbackById(id, version) {
|
|
10420
|
+
return await this.fetch.post(`/api/v1/secrets/${encodeURIComponent(id)}/rollback/${version}`, {});
|
|
10421
|
+
}
|
|
10422
|
+
};
|
|
10423
|
+
|
|
10108
10424
|
// src/ai.ts
|
|
10109
10425
|
var FluxbaseAIChat = class {
|
|
10110
10426
|
constructor(options) {
|
|
@@ -12589,6 +12905,7 @@ var FluxbaseClient = class {
|
|
|
12589
12905
|
this.admin = new FluxbaseAdmin(this.fetch);
|
|
12590
12906
|
this.management = new FluxbaseManagement(this.fetch);
|
|
12591
12907
|
this.settings = new SettingsClient(this.fetch);
|
|
12908
|
+
this.secrets = new SecretsManager(this.fetch);
|
|
12592
12909
|
const wsProtocol = fluxbaseUrl.startsWith("https") ? "wss" : "ws";
|
|
12593
12910
|
const wsBaseUrl = fluxbaseUrl.replace(/^https?:/, wsProtocol + ":");
|
|
12594
12911
|
this.ai = new FluxbaseAI(this.fetch, wsBaseUrl);
|
|
@@ -12851,6 +13168,6 @@ function assertType(value, validator, errorMessage = "Type assertion failed") {
|
|
|
12851
13168
|
}
|
|
12852
13169
|
}
|
|
12853
13170
|
|
|
12854
|
-
export { APIKeysManager, AppSettingsManager, AuthSettingsManager, ClientKeysManager, DDLManager, EmailSettingsManager, EmailTemplateManager, ExecutionLogsChannel, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminRealtime, FluxbaseAdminStorage, FluxbaseAuth, FluxbaseBranching, FluxbaseClient, FluxbaseFetch, FluxbaseFunctions, FluxbaseGraphQL, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, ImpersonationManager, InvitationsManager, OAuthProviderManager, QueryBuilder, RealtimeChannel, SchemaQueryBuilder, SettingsClient, StorageBucket, SystemSettingsManager, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };
|
|
13171
|
+
export { APIKeysManager, AppSettingsManager, AuthSettingsManager, ClientKeysManager, DDLManager, EmailSettingsManager, EmailTemplateManager, ExecutionLogsChannel, FluxbaseAI, FluxbaseAIChat, FluxbaseAdmin, FluxbaseAdminAI, FluxbaseAdminFunctions, FluxbaseAdminJobs, FluxbaseAdminMigrations, FluxbaseAdminRPC, FluxbaseAdminRealtime, FluxbaseAdminStorage, FluxbaseAuth, FluxbaseBranching, FluxbaseClient, FluxbaseFetch, FluxbaseFunctions, FluxbaseGraphQL, FluxbaseJobs, FluxbaseManagement, FluxbaseOAuth, FluxbaseRPC, FluxbaseRealtime, FluxbaseSettings, FluxbaseStorage, FluxbaseVector, ImpersonationManager, InvitationsManager, OAuthProviderManager, QueryBuilder, RealtimeChannel, SchemaQueryBuilder, SecretsManager, SettingsClient, StorageBucket, SystemSettingsManager, WebhooksManager, assertType, bundleCode, createClient, denoExternalPlugin, hasPostgrestError, isArray, isAuthError, isAuthSuccess, isBoolean, isFluxbaseError, isFluxbaseSuccess, isNumber, isObject, isPostgrestSuccess, isString, loadImportMap };
|
|
12855
13172
|
//# sourceMappingURL=index.js.map
|
|
12856
13173
|
//# sourceMappingURL=index.js.map
|