@llmops/core 0.1.3 → 0.1.5-beta.1
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/db/index.d.cts +1 -1
- package/dist/db/index.d.mts +1 -1
- package/dist/{index-BVOY5y9k.d.mts → index-D3ncxgf2.d.mts} +21 -21
- package/dist/{index-D8DWyBKi.d.cts → index-DTHo2J3v.d.cts} +21 -21
- package/dist/index.cjs +528 -1
- package/dist/index.d.cts +198 -2
- package/dist/index.d.mts +198 -2
- package/dist/index.mjs +524 -3
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as TargetingRulesTable, B as environmentSecretsSchema, C as EnvironmentSecretsTable, D as Selectable, E as SCHEMA_METADATA, F as VariantsTable, G as variantsSchema, H as schemas, I as WorkspaceSettings, K as workspaceSettingsSchema, L as WorkspaceSettingsTable, M as Variant, N as VariantVersion, O as TableName, P as VariantVersionsTable, R as configVariantsSchema, S as EnvironmentSecret, T as Insertable, U as targetingRulesSchema, V as environmentsSchema, W as variantVersionsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Updateable, k as TargetingRule, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as configsSchema } from "./index-
|
|
1
|
+
import { A as TargetingRulesTable, B as environmentSecretsSchema, C as EnvironmentSecretsTable, D as Selectable, E as SCHEMA_METADATA, F as VariantsTable, G as variantsSchema, H as schemas, I as WorkspaceSettings, K as workspaceSettingsSchema, L as WorkspaceSettingsTable, M as Variant, N as VariantVersion, O as TableName, P as VariantVersionsTable, R as configVariantsSchema, S as EnvironmentSecret, T as Insertable, U as targetingRulesSchema, V as environmentsSchema, W as variantVersionsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Updateable, k as TargetingRule, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as configsSchema } from "./index-DTHo2J3v.cjs";
|
|
2
2
|
import { Kysely } from "kysely";
|
|
3
3
|
import * as zod0 from "zod";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -1323,6 +1323,188 @@ declare const variantJsonDataSchema: z.ZodObject<{
|
|
|
1323
1323
|
}, z.core.$strip>;
|
|
1324
1324
|
type VariantJsonData = z.infer<typeof variantJsonDataSchema>;
|
|
1325
1325
|
//#endregion
|
|
1326
|
+
//#region src/cache/types.d.ts
|
|
1327
|
+
/**
|
|
1328
|
+
* @file src/cache/types.ts
|
|
1329
|
+
* Type definitions for the unified cache system
|
|
1330
|
+
*/
|
|
1331
|
+
interface CacheEntry<T = unknown> {
|
|
1332
|
+
value: T;
|
|
1333
|
+
expiresAt?: number;
|
|
1334
|
+
createdAt: number;
|
|
1335
|
+
metadata?: Record<string, unknown>;
|
|
1336
|
+
}
|
|
1337
|
+
interface CacheOptions {
|
|
1338
|
+
/** Time to live in milliseconds */
|
|
1339
|
+
ttl?: number;
|
|
1340
|
+
/** Cache namespace for organization */
|
|
1341
|
+
namespace?: string;
|
|
1342
|
+
/** Additional metadata */
|
|
1343
|
+
metadata?: Record<string, unknown>;
|
|
1344
|
+
}
|
|
1345
|
+
interface CacheStats {
|
|
1346
|
+
hits: number;
|
|
1347
|
+
misses: number;
|
|
1348
|
+
sets: number;
|
|
1349
|
+
deletes: number;
|
|
1350
|
+
size: number;
|
|
1351
|
+
expired: number;
|
|
1352
|
+
}
|
|
1353
|
+
interface CacheBackend {
|
|
1354
|
+
get<T = unknown>(key: string, namespace?: string): Promise<CacheEntry<T> | null>;
|
|
1355
|
+
set<T = unknown>(key: string, value: T, options?: CacheOptions): Promise<void>;
|
|
1356
|
+
delete(key: string, namespace?: string): Promise<boolean>;
|
|
1357
|
+
clear(namespace?: string): Promise<void>;
|
|
1358
|
+
has(key: string, namespace?: string): Promise<boolean>;
|
|
1359
|
+
keys(namespace?: string): Promise<string[]>;
|
|
1360
|
+
getStats(namespace?: string): Promise<CacheStats>;
|
|
1361
|
+
/** Remove expired entries */
|
|
1362
|
+
cleanup(): Promise<void>;
|
|
1363
|
+
/** Cleanup resources */
|
|
1364
|
+
close(): Promise<void>;
|
|
1365
|
+
}
|
|
1366
|
+
type CacheBackendType = 'memory' | 'file';
|
|
1367
|
+
interface BaseCacheConfig {
|
|
1368
|
+
backend: CacheBackendType;
|
|
1369
|
+
/** Default TTL in milliseconds */
|
|
1370
|
+
defaultTtl?: number;
|
|
1371
|
+
/** Cleanup interval in milliseconds */
|
|
1372
|
+
cleanupInterval?: number;
|
|
1373
|
+
}
|
|
1374
|
+
interface MemoryCacheConfig extends BaseCacheConfig {
|
|
1375
|
+
backend: 'memory';
|
|
1376
|
+
/** Maximum number of entries */
|
|
1377
|
+
maxSize?: number;
|
|
1378
|
+
}
|
|
1379
|
+
interface FileCacheConfig extends BaseCacheConfig {
|
|
1380
|
+
backend: 'file';
|
|
1381
|
+
/** Data directory path */
|
|
1382
|
+
dataDir?: string;
|
|
1383
|
+
/** Cache file name */
|
|
1384
|
+
fileName?: string;
|
|
1385
|
+
/** Debounce save interval in milliseconds */
|
|
1386
|
+
saveInterval?: number;
|
|
1387
|
+
}
|
|
1388
|
+
type CacheConfig = MemoryCacheConfig | FileCacheConfig;
|
|
1389
|
+
/** Time constants in milliseconds for convenience */
|
|
1390
|
+
declare const MS: {
|
|
1391
|
+
readonly '1_MINUTE': number;
|
|
1392
|
+
readonly '5_MINUTES': number;
|
|
1393
|
+
readonly '10_MINUTES': number;
|
|
1394
|
+
readonly '30_MINUTES': number;
|
|
1395
|
+
readonly '1_HOUR': number;
|
|
1396
|
+
readonly '6_HOURS': number;
|
|
1397
|
+
readonly '12_HOURS': number;
|
|
1398
|
+
readonly '1_DAY': number;
|
|
1399
|
+
readonly '7_DAYS': number;
|
|
1400
|
+
readonly '30_DAYS': number;
|
|
1401
|
+
};
|
|
1402
|
+
//#endregion
|
|
1403
|
+
//#region src/cache/backends/memory.d.ts
|
|
1404
|
+
declare class MemoryCacheBackend implements CacheBackend {
|
|
1405
|
+
private cache;
|
|
1406
|
+
private stats;
|
|
1407
|
+
private cleanupInterval?;
|
|
1408
|
+
private maxSize;
|
|
1409
|
+
constructor(maxSize?: number, cleanupIntervalMs?: number);
|
|
1410
|
+
private startCleanup;
|
|
1411
|
+
private getFullKey;
|
|
1412
|
+
private isExpired;
|
|
1413
|
+
private evictIfNeeded;
|
|
1414
|
+
get<T = unknown>(key: string, namespace?: string): Promise<CacheEntry<T> | null>;
|
|
1415
|
+
set<T = unknown>(key: string, value: T, options?: CacheOptions): Promise<void>;
|
|
1416
|
+
delete(key: string, namespace?: string): Promise<boolean>;
|
|
1417
|
+
clear(namespace?: string): Promise<void>;
|
|
1418
|
+
has(key: string, namespace?: string): Promise<boolean>;
|
|
1419
|
+
keys(namespace?: string): Promise<string[]>;
|
|
1420
|
+
getStats(namespace?: string): Promise<CacheStats>;
|
|
1421
|
+
cleanup(): Promise<void>;
|
|
1422
|
+
close(): Promise<void>;
|
|
1423
|
+
}
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region src/cache/backends/file.d.ts
|
|
1426
|
+
declare class FileCacheBackend implements CacheBackend {
|
|
1427
|
+
private cacheFile;
|
|
1428
|
+
private data;
|
|
1429
|
+
private saveTimer?;
|
|
1430
|
+
private cleanupInterval?;
|
|
1431
|
+
private loaded;
|
|
1432
|
+
private loadPromise;
|
|
1433
|
+
private stats;
|
|
1434
|
+
private saveInterval;
|
|
1435
|
+
constructor(dataDir?: string, fileName?: string, saveIntervalMs?: number, cleanupIntervalMs?: number);
|
|
1436
|
+
/** Ensure cache is loaded before any operation */
|
|
1437
|
+
private ensureLoaded;
|
|
1438
|
+
private ensureDataDir;
|
|
1439
|
+
private loadCache;
|
|
1440
|
+
private saveCache;
|
|
1441
|
+
private scheduleSave;
|
|
1442
|
+
private startCleanup;
|
|
1443
|
+
private isExpired;
|
|
1444
|
+
private updateStats;
|
|
1445
|
+
private getNamespaceData;
|
|
1446
|
+
get<T = unknown>(key: string, namespace?: string): Promise<CacheEntry<T> | null>;
|
|
1447
|
+
set<T = unknown>(key: string, value: T, options?: CacheOptions): Promise<void>;
|
|
1448
|
+
delete(key: string, namespace?: string): Promise<boolean>;
|
|
1449
|
+
clear(namespace?: string): Promise<void>;
|
|
1450
|
+
has(key: string, namespace?: string): Promise<boolean>;
|
|
1451
|
+
keys(namespace?: string): Promise<string[]>;
|
|
1452
|
+
getStats(namespace?: string): Promise<CacheStats>;
|
|
1453
|
+
cleanup(): Promise<void>;
|
|
1454
|
+
/** Wait for the cache to be ready (file loaded) */
|
|
1455
|
+
waitForReady(): Promise<void>;
|
|
1456
|
+
close(): Promise<void>;
|
|
1457
|
+
}
|
|
1458
|
+
//#endregion
|
|
1459
|
+
//#region src/cache/service.d.ts
|
|
1460
|
+
declare class CacheService {
|
|
1461
|
+
private backend;
|
|
1462
|
+
private defaultTtl?;
|
|
1463
|
+
constructor(config: CacheConfig);
|
|
1464
|
+
private createBackend;
|
|
1465
|
+
/** Get a value from the cache */
|
|
1466
|
+
get<T = unknown>(key: string, namespace?: string): Promise<T | null>;
|
|
1467
|
+
/** Get the full cache entry (with metadata) */
|
|
1468
|
+
getEntry<T = unknown>(key: string, namespace?: string): Promise<CacheEntry<T> | null>;
|
|
1469
|
+
/** Set a value in the cache */
|
|
1470
|
+
set<T = unknown>(key: string, value: T, options?: CacheOptions): Promise<void>;
|
|
1471
|
+
/** Set a value with TTL in seconds (convenience method) */
|
|
1472
|
+
setWithTtl<T = unknown>(key: string, value: T, ttlSeconds: number, namespace?: string): Promise<void>;
|
|
1473
|
+
/** Delete a value from the cache */
|
|
1474
|
+
delete(key: string, namespace?: string): Promise<boolean>;
|
|
1475
|
+
/** Check if a key exists in the cache */
|
|
1476
|
+
has(key: string, namespace?: string): Promise<boolean>;
|
|
1477
|
+
/** Get all keys in a namespace */
|
|
1478
|
+
keys(namespace?: string): Promise<string[]>;
|
|
1479
|
+
/** Clear all entries in a namespace (or all entries if no namespace) */
|
|
1480
|
+
clear(namespace?: string): Promise<void>;
|
|
1481
|
+
/** Get cache statistics */
|
|
1482
|
+
getStats(namespace?: string): Promise<CacheStats>;
|
|
1483
|
+
/** Manually trigger cleanup of expired entries */
|
|
1484
|
+
cleanup(): Promise<void>;
|
|
1485
|
+
/** Wait for the backend to be ready */
|
|
1486
|
+
waitForReady(): Promise<void>;
|
|
1487
|
+
/** Close the cache and cleanup resources */
|
|
1488
|
+
close(): Promise<void>;
|
|
1489
|
+
/** Get or set pattern - get value, or compute and cache it if not found */
|
|
1490
|
+
getOrSet<T = unknown>(key: string, factory: () => Promise<T> | T, options?: CacheOptions): Promise<T>;
|
|
1491
|
+
/** Increment a numeric value (simulated atomic operation) */
|
|
1492
|
+
increment(key: string, delta?: number, options?: CacheOptions): Promise<number>;
|
|
1493
|
+
/** Set multiple values at once */
|
|
1494
|
+
setMany<T = unknown>(entries: Array<{
|
|
1495
|
+
key: string;
|
|
1496
|
+
value: T;
|
|
1497
|
+
options?: CacheOptions;
|
|
1498
|
+
}>, defaultOptions?: CacheOptions): Promise<void>;
|
|
1499
|
+
/** Get multiple values at once */
|
|
1500
|
+
getMany<T = unknown>(keys: string[], namespace?: string): Promise<Array<{
|
|
1501
|
+
key: string;
|
|
1502
|
+
value: T | null;
|
|
1503
|
+
}>>;
|
|
1504
|
+
/** Get the underlying backend (for advanced use cases) */
|
|
1505
|
+
getBackend(): CacheBackend;
|
|
1506
|
+
}
|
|
1507
|
+
//#endregion
|
|
1326
1508
|
//#region src/utils/logger.d.ts
|
|
1327
1509
|
declare const logger: pino.Logger<never, boolean>;
|
|
1328
1510
|
//#endregion
|
|
@@ -1331,6 +1513,20 @@ declare const generateId: (size?: number) => string;
|
|
|
1331
1513
|
//#endregion
|
|
1332
1514
|
//#region src/datalayer/index.d.ts
|
|
1333
1515
|
declare const createDataLayer: (db: Kysely<Database>) => Promise<{
|
|
1516
|
+
getWorkspaceSettings: () => Promise<{
|
|
1517
|
+
name: string | null;
|
|
1518
|
+
id: string;
|
|
1519
|
+
createdAt: Date;
|
|
1520
|
+
updatedAt: Date;
|
|
1521
|
+
} | undefined>;
|
|
1522
|
+
updateWorkspaceSettings: (params: zod0.infer<zod0.ZodObject<{
|
|
1523
|
+
name: zod0.ZodOptional<zod0.ZodNullable<zod0.ZodString>>;
|
|
1524
|
+
}, zod_v4_core0.$strip>>) => Promise<{
|
|
1525
|
+
name: string | null;
|
|
1526
|
+
id: string;
|
|
1527
|
+
createdAt: Date;
|
|
1528
|
+
updatedAt: Date;
|
|
1529
|
+
} | undefined>;
|
|
1334
1530
|
createVariantVersion: (params: zod0.infer<zod0.ZodObject<{
|
|
1335
1531
|
variantId: zod0.ZodString;
|
|
1336
1532
|
provider: zod0.ZodString;
|
|
@@ -2100,4 +2296,4 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
|
|
|
2100
2296
|
}[]>;
|
|
2101
2297
|
}>;
|
|
2102
2298
|
//#endregion
|
|
2103
|
-
export { type AnthropicProviderConfig, type AnyProviderConfig, type AuthConfig, AutoMigrateConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, type BaseProviderConfig, type BasicAuthConfig, type BedrockProviderConfig, ChatCompletionCreateParamsBase, Config, ConfigVariant, ConfigVariantsTable, ConfigsTable, type CortexProviderConfig, Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, EnvironmentSecretsTable, EnvironmentsTable, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, Insertable, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, MigrationOptions, MigrationResult, type MistralAIProviderConfig, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, type ProviderConfigMap, type ProvidersConfig, SCHEMA_METADATA, type SagemakerProviderConfig, Selectable, type StabilityAIProviderConfig, SupportedProviders, TableName, TargetingRule, TargetingRulesTable, Updateable, type ValidatedLLMOpsConfig, Variant, VariantJsonData, VariantVersion, VariantVersionsTable, VariantsTable, type VertexAIProviderConfig, type WorkersAIProviderConfig, WorkspaceSettings, WorkspaceSettingsTable, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, gateway, generateId, getMigrations, llmopsConfigSchema, logger, matchType, parsePartialTableData, parseTableData, runAutoMigrations, schemas, targetingRulesSchema, validateLLMOpsConfig, validatePartialTableData, validateTableData, variantJsonDataSchema, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
|
|
2299
|
+
export { type AnthropicProviderConfig, type AnyProviderConfig, type AuthConfig, AutoMigrateConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BasicAuthConfig, type BedrockProviderConfig, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, Config, ConfigVariant, ConfigVariantsTable, ConfigsTable, type CortexProviderConfig, Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, EnvironmentSecretsTable, EnvironmentsTable, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, Insertable, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, MS, MemoryCacheBackend, MemoryCacheConfig, MigrationOptions, MigrationResult, type MistralAIProviderConfig, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, type ProviderConfigMap, type ProvidersConfig, SCHEMA_METADATA, type SagemakerProviderConfig, Selectable, type StabilityAIProviderConfig, SupportedProviders, TableName, TargetingRule, TargetingRulesTable, Updateable, type ValidatedLLMOpsConfig, Variant, VariantJsonData, VariantVersion, VariantVersionsTable, VariantsTable, type VertexAIProviderConfig, type WorkersAIProviderConfig, WorkspaceSettings, WorkspaceSettingsTable, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, gateway, generateId, getMigrations, llmopsConfigSchema, logger, matchType, parsePartialTableData, parseTableData, runAutoMigrations, schemas, targetingRulesSchema, validateLLMOpsConfig, validatePartialTableData, validateTableData, variantJsonDataSchema, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as TargetingRulesTable, B as environmentSecretsSchema, C as EnvironmentSecretsTable, D as Selectable, E as SCHEMA_METADATA, F as VariantsTable, G as variantsSchema, H as schemas, I as WorkspaceSettings, K as workspaceSettingsSchema, L as WorkspaceSettingsTable, M as Variant, N as VariantVersion, O as TableName, P as VariantVersionsTable, R as configVariantsSchema, S as EnvironmentSecret, T as Insertable, U as targetingRulesSchema, V as environmentsSchema, W as variantVersionsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Updateable, k as TargetingRule, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as configsSchema } from "./index-
|
|
1
|
+
import { A as TargetingRulesTable, B as environmentSecretsSchema, C as EnvironmentSecretsTable, D as Selectable, E as SCHEMA_METADATA, F as VariantsTable, G as variantsSchema, H as schemas, I as WorkspaceSettings, K as workspaceSettingsSchema, L as WorkspaceSettingsTable, M as Variant, N as VariantVersion, O as TableName, P as VariantVersionsTable, R as configVariantsSchema, S as EnvironmentSecret, T as Insertable, U as targetingRulesSchema, V as environmentsSchema, W as variantVersionsSchema, _ as ConfigVariant, a as createDatabaseFromConnection, b as Database, c as MigrationResult, d as runAutoMigrations, f as parsePartialTableData, g as Config, h as validateTableData, i as createDatabase, j as Updateable, k as TargetingRule, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, r as DatabaseType, s as MigrationOptions, t as DatabaseConnection, u as matchType, v as ConfigVariantsTable, w as EnvironmentsTable, x as Environment, y as ConfigsTable, z as configsSchema } from "./index-D3ncxgf2.mjs";
|
|
2
2
|
import gateway from "@llmops/gateway";
|
|
3
3
|
import { Kysely } from "kysely";
|
|
4
4
|
import pino from "pino";
|
|
@@ -1323,6 +1323,188 @@ declare const variantJsonDataSchema: z.ZodObject<{
|
|
|
1323
1323
|
}, z.core.$strip>;
|
|
1324
1324
|
type VariantJsonData = z.infer<typeof variantJsonDataSchema>;
|
|
1325
1325
|
//#endregion
|
|
1326
|
+
//#region src/cache/types.d.ts
|
|
1327
|
+
/**
|
|
1328
|
+
* @file src/cache/types.ts
|
|
1329
|
+
* Type definitions for the unified cache system
|
|
1330
|
+
*/
|
|
1331
|
+
interface CacheEntry<T = unknown> {
|
|
1332
|
+
value: T;
|
|
1333
|
+
expiresAt?: number;
|
|
1334
|
+
createdAt: number;
|
|
1335
|
+
metadata?: Record<string, unknown>;
|
|
1336
|
+
}
|
|
1337
|
+
interface CacheOptions {
|
|
1338
|
+
/** Time to live in milliseconds */
|
|
1339
|
+
ttl?: number;
|
|
1340
|
+
/** Cache namespace for organization */
|
|
1341
|
+
namespace?: string;
|
|
1342
|
+
/** Additional metadata */
|
|
1343
|
+
metadata?: Record<string, unknown>;
|
|
1344
|
+
}
|
|
1345
|
+
interface CacheStats {
|
|
1346
|
+
hits: number;
|
|
1347
|
+
misses: number;
|
|
1348
|
+
sets: number;
|
|
1349
|
+
deletes: number;
|
|
1350
|
+
size: number;
|
|
1351
|
+
expired: number;
|
|
1352
|
+
}
|
|
1353
|
+
interface CacheBackend {
|
|
1354
|
+
get<T = unknown>(key: string, namespace?: string): Promise<CacheEntry<T> | null>;
|
|
1355
|
+
set<T = unknown>(key: string, value: T, options?: CacheOptions): Promise<void>;
|
|
1356
|
+
delete(key: string, namespace?: string): Promise<boolean>;
|
|
1357
|
+
clear(namespace?: string): Promise<void>;
|
|
1358
|
+
has(key: string, namespace?: string): Promise<boolean>;
|
|
1359
|
+
keys(namespace?: string): Promise<string[]>;
|
|
1360
|
+
getStats(namespace?: string): Promise<CacheStats>;
|
|
1361
|
+
/** Remove expired entries */
|
|
1362
|
+
cleanup(): Promise<void>;
|
|
1363
|
+
/** Cleanup resources */
|
|
1364
|
+
close(): Promise<void>;
|
|
1365
|
+
}
|
|
1366
|
+
type CacheBackendType = 'memory' | 'file';
|
|
1367
|
+
interface BaseCacheConfig {
|
|
1368
|
+
backend: CacheBackendType;
|
|
1369
|
+
/** Default TTL in milliseconds */
|
|
1370
|
+
defaultTtl?: number;
|
|
1371
|
+
/** Cleanup interval in milliseconds */
|
|
1372
|
+
cleanupInterval?: number;
|
|
1373
|
+
}
|
|
1374
|
+
interface MemoryCacheConfig extends BaseCacheConfig {
|
|
1375
|
+
backend: 'memory';
|
|
1376
|
+
/** Maximum number of entries */
|
|
1377
|
+
maxSize?: number;
|
|
1378
|
+
}
|
|
1379
|
+
interface FileCacheConfig extends BaseCacheConfig {
|
|
1380
|
+
backend: 'file';
|
|
1381
|
+
/** Data directory path */
|
|
1382
|
+
dataDir?: string;
|
|
1383
|
+
/** Cache file name */
|
|
1384
|
+
fileName?: string;
|
|
1385
|
+
/** Debounce save interval in milliseconds */
|
|
1386
|
+
saveInterval?: number;
|
|
1387
|
+
}
|
|
1388
|
+
type CacheConfig = MemoryCacheConfig | FileCacheConfig;
|
|
1389
|
+
/** Time constants in milliseconds for convenience */
|
|
1390
|
+
declare const MS: {
|
|
1391
|
+
readonly '1_MINUTE': number;
|
|
1392
|
+
readonly '5_MINUTES': number;
|
|
1393
|
+
readonly '10_MINUTES': number;
|
|
1394
|
+
readonly '30_MINUTES': number;
|
|
1395
|
+
readonly '1_HOUR': number;
|
|
1396
|
+
readonly '6_HOURS': number;
|
|
1397
|
+
readonly '12_HOURS': number;
|
|
1398
|
+
readonly '1_DAY': number;
|
|
1399
|
+
readonly '7_DAYS': number;
|
|
1400
|
+
readonly '30_DAYS': number;
|
|
1401
|
+
};
|
|
1402
|
+
//#endregion
|
|
1403
|
+
//#region src/cache/backends/memory.d.ts
|
|
1404
|
+
declare class MemoryCacheBackend implements CacheBackend {
|
|
1405
|
+
private cache;
|
|
1406
|
+
private stats;
|
|
1407
|
+
private cleanupInterval?;
|
|
1408
|
+
private maxSize;
|
|
1409
|
+
constructor(maxSize?: number, cleanupIntervalMs?: number);
|
|
1410
|
+
private startCleanup;
|
|
1411
|
+
private getFullKey;
|
|
1412
|
+
private isExpired;
|
|
1413
|
+
private evictIfNeeded;
|
|
1414
|
+
get<T = unknown>(key: string, namespace?: string): Promise<CacheEntry<T> | null>;
|
|
1415
|
+
set<T = unknown>(key: string, value: T, options?: CacheOptions): Promise<void>;
|
|
1416
|
+
delete(key: string, namespace?: string): Promise<boolean>;
|
|
1417
|
+
clear(namespace?: string): Promise<void>;
|
|
1418
|
+
has(key: string, namespace?: string): Promise<boolean>;
|
|
1419
|
+
keys(namespace?: string): Promise<string[]>;
|
|
1420
|
+
getStats(namespace?: string): Promise<CacheStats>;
|
|
1421
|
+
cleanup(): Promise<void>;
|
|
1422
|
+
close(): Promise<void>;
|
|
1423
|
+
}
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region src/cache/backends/file.d.ts
|
|
1426
|
+
declare class FileCacheBackend implements CacheBackend {
|
|
1427
|
+
private cacheFile;
|
|
1428
|
+
private data;
|
|
1429
|
+
private saveTimer?;
|
|
1430
|
+
private cleanupInterval?;
|
|
1431
|
+
private loaded;
|
|
1432
|
+
private loadPromise;
|
|
1433
|
+
private stats;
|
|
1434
|
+
private saveInterval;
|
|
1435
|
+
constructor(dataDir?: string, fileName?: string, saveIntervalMs?: number, cleanupIntervalMs?: number);
|
|
1436
|
+
/** Ensure cache is loaded before any operation */
|
|
1437
|
+
private ensureLoaded;
|
|
1438
|
+
private ensureDataDir;
|
|
1439
|
+
private loadCache;
|
|
1440
|
+
private saveCache;
|
|
1441
|
+
private scheduleSave;
|
|
1442
|
+
private startCleanup;
|
|
1443
|
+
private isExpired;
|
|
1444
|
+
private updateStats;
|
|
1445
|
+
private getNamespaceData;
|
|
1446
|
+
get<T = unknown>(key: string, namespace?: string): Promise<CacheEntry<T> | null>;
|
|
1447
|
+
set<T = unknown>(key: string, value: T, options?: CacheOptions): Promise<void>;
|
|
1448
|
+
delete(key: string, namespace?: string): Promise<boolean>;
|
|
1449
|
+
clear(namespace?: string): Promise<void>;
|
|
1450
|
+
has(key: string, namespace?: string): Promise<boolean>;
|
|
1451
|
+
keys(namespace?: string): Promise<string[]>;
|
|
1452
|
+
getStats(namespace?: string): Promise<CacheStats>;
|
|
1453
|
+
cleanup(): Promise<void>;
|
|
1454
|
+
/** Wait for the cache to be ready (file loaded) */
|
|
1455
|
+
waitForReady(): Promise<void>;
|
|
1456
|
+
close(): Promise<void>;
|
|
1457
|
+
}
|
|
1458
|
+
//#endregion
|
|
1459
|
+
//#region src/cache/service.d.ts
|
|
1460
|
+
declare class CacheService {
|
|
1461
|
+
private backend;
|
|
1462
|
+
private defaultTtl?;
|
|
1463
|
+
constructor(config: CacheConfig);
|
|
1464
|
+
private createBackend;
|
|
1465
|
+
/** Get a value from the cache */
|
|
1466
|
+
get<T = unknown>(key: string, namespace?: string): Promise<T | null>;
|
|
1467
|
+
/** Get the full cache entry (with metadata) */
|
|
1468
|
+
getEntry<T = unknown>(key: string, namespace?: string): Promise<CacheEntry<T> | null>;
|
|
1469
|
+
/** Set a value in the cache */
|
|
1470
|
+
set<T = unknown>(key: string, value: T, options?: CacheOptions): Promise<void>;
|
|
1471
|
+
/** Set a value with TTL in seconds (convenience method) */
|
|
1472
|
+
setWithTtl<T = unknown>(key: string, value: T, ttlSeconds: number, namespace?: string): Promise<void>;
|
|
1473
|
+
/** Delete a value from the cache */
|
|
1474
|
+
delete(key: string, namespace?: string): Promise<boolean>;
|
|
1475
|
+
/** Check if a key exists in the cache */
|
|
1476
|
+
has(key: string, namespace?: string): Promise<boolean>;
|
|
1477
|
+
/** Get all keys in a namespace */
|
|
1478
|
+
keys(namespace?: string): Promise<string[]>;
|
|
1479
|
+
/** Clear all entries in a namespace (or all entries if no namespace) */
|
|
1480
|
+
clear(namespace?: string): Promise<void>;
|
|
1481
|
+
/** Get cache statistics */
|
|
1482
|
+
getStats(namespace?: string): Promise<CacheStats>;
|
|
1483
|
+
/** Manually trigger cleanup of expired entries */
|
|
1484
|
+
cleanup(): Promise<void>;
|
|
1485
|
+
/** Wait for the backend to be ready */
|
|
1486
|
+
waitForReady(): Promise<void>;
|
|
1487
|
+
/** Close the cache and cleanup resources */
|
|
1488
|
+
close(): Promise<void>;
|
|
1489
|
+
/** Get or set pattern - get value, or compute and cache it if not found */
|
|
1490
|
+
getOrSet<T = unknown>(key: string, factory: () => Promise<T> | T, options?: CacheOptions): Promise<T>;
|
|
1491
|
+
/** Increment a numeric value (simulated atomic operation) */
|
|
1492
|
+
increment(key: string, delta?: number, options?: CacheOptions): Promise<number>;
|
|
1493
|
+
/** Set multiple values at once */
|
|
1494
|
+
setMany<T = unknown>(entries: Array<{
|
|
1495
|
+
key: string;
|
|
1496
|
+
value: T;
|
|
1497
|
+
options?: CacheOptions;
|
|
1498
|
+
}>, defaultOptions?: CacheOptions): Promise<void>;
|
|
1499
|
+
/** Get multiple values at once */
|
|
1500
|
+
getMany<T = unknown>(keys: string[], namespace?: string): Promise<Array<{
|
|
1501
|
+
key: string;
|
|
1502
|
+
value: T | null;
|
|
1503
|
+
}>>;
|
|
1504
|
+
/** Get the underlying backend (for advanced use cases) */
|
|
1505
|
+
getBackend(): CacheBackend;
|
|
1506
|
+
}
|
|
1507
|
+
//#endregion
|
|
1326
1508
|
//#region src/utils/logger.d.ts
|
|
1327
1509
|
declare const logger: pino.Logger<never, boolean>;
|
|
1328
1510
|
//#endregion
|
|
@@ -1331,6 +1513,20 @@ declare const generateId: (size?: number) => string;
|
|
|
1331
1513
|
//#endregion
|
|
1332
1514
|
//#region src/datalayer/index.d.ts
|
|
1333
1515
|
declare const createDataLayer: (db: Kysely<Database>) => Promise<{
|
|
1516
|
+
getWorkspaceSettings: () => Promise<{
|
|
1517
|
+
name: string | null;
|
|
1518
|
+
id: string;
|
|
1519
|
+
createdAt: Date;
|
|
1520
|
+
updatedAt: Date;
|
|
1521
|
+
} | undefined>;
|
|
1522
|
+
updateWorkspaceSettings: (params: zod0.infer<zod0.ZodObject<{
|
|
1523
|
+
name: zod0.ZodOptional<zod0.ZodNullable<zod0.ZodString>>;
|
|
1524
|
+
}, zod_v4_core0.$strip>>) => Promise<{
|
|
1525
|
+
name: string | null;
|
|
1526
|
+
id: string;
|
|
1527
|
+
createdAt: Date;
|
|
1528
|
+
updatedAt: Date;
|
|
1529
|
+
} | undefined>;
|
|
1334
1530
|
createVariantVersion: (params: zod0.infer<zod0.ZodObject<{
|
|
1335
1531
|
variantId: zod0.ZodString;
|
|
1336
1532
|
provider: zod0.ZodString;
|
|
@@ -2100,4 +2296,4 @@ declare const createDataLayer: (db: Kysely<Database>) => Promise<{
|
|
|
2100
2296
|
}[]>;
|
|
2101
2297
|
}>;
|
|
2102
2298
|
//#endregion
|
|
2103
|
-
export { type AnthropicProviderConfig, type AnyProviderConfig, type AuthConfig, AutoMigrateConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, type BaseProviderConfig, type BasicAuthConfig, type BedrockProviderConfig, ChatCompletionCreateParamsBase, Config, ConfigVariant, type ConfigVariantsTable, type ConfigsTable, type CortexProviderConfig, type Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, type EnvironmentSecretsTable, type EnvironmentsTable, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, Insertable, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, MigrationOptions, MigrationResult, type MistralAIProviderConfig, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, type ProviderConfigMap, type ProvidersConfig, SCHEMA_METADATA, type SagemakerProviderConfig, Selectable, type StabilityAIProviderConfig, SupportedProviders, type TableName, TargetingRule, type TargetingRulesTable, Updateable, type ValidatedLLMOpsConfig, Variant, VariantJsonData, VariantVersion, VariantVersionsTable, type VariantsTable, type VertexAIProviderConfig, type WorkersAIProviderConfig, WorkspaceSettings, WorkspaceSettingsTable, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, gateway, generateId, getMigrations, llmopsConfigSchema, logger, matchType, parsePartialTableData, parseTableData, runAutoMigrations, schemas, targetingRulesSchema, validateLLMOpsConfig, validatePartialTableData, validateTableData, variantJsonDataSchema, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
|
|
2299
|
+
export { type AnthropicProviderConfig, type AnyProviderConfig, type AuthConfig, AutoMigrateConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BasicAuthConfig, type BedrockProviderConfig, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, Config, ConfigVariant, type ConfigVariantsTable, type ConfigsTable, type CortexProviderConfig, type Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, type EnvironmentSecretsTable, type EnvironmentsTable, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, Insertable, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, MS, MemoryCacheBackend, MemoryCacheConfig, MigrationOptions, MigrationResult, type MistralAIProviderConfig, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, type ProviderConfigMap, type ProvidersConfig, SCHEMA_METADATA, type SagemakerProviderConfig, Selectable, type StabilityAIProviderConfig, SupportedProviders, type TableName, TargetingRule, type TargetingRulesTable, Updateable, type ValidatedLLMOpsConfig, Variant, VariantJsonData, VariantVersion, VariantVersionsTable, type VariantsTable, type VertexAIProviderConfig, type WorkersAIProviderConfig, WorkspaceSettings, WorkspaceSettingsTable, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, gateway, generateId, getMigrations, llmopsConfigSchema, logger, matchType, parsePartialTableData, parseTableData, runAutoMigrations, schemas, targetingRulesSchema, validateLLMOpsConfig, validatePartialTableData, validateTableData, variantJsonDataSchema, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
|