@llmops/core 0.2.0-beta.2 → 0.2.1-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/{bun-sqlite-dialect-BxlwYxpt.cjs → bun-sqlite-dialect-BGVtWUJq.cjs} +1 -1
- package/dist/db/index.cjs +1 -1
- package/dist/db/index.d.cts +1 -1
- package/dist/db/index.mjs +1 -1
- package/dist/{db-BdclKAD3.cjs → db-BHO_R4JC.cjs} +32 -32
- package/dist/{db-BCHs_i6m.mjs → db-BbGik_bQ.mjs} +30 -30
- package/dist/{index-CV79zoS6.d.cts → index-zQzOuWsM.d.cts} +35 -35
- package/dist/index.cjs +20 -4
- package/dist/index.d.cts +269 -265
- package/dist/index.d.mts +5 -1
- package/dist/index.mjs +20 -4
- package/dist/{node-sqlite-dialect-DjW-cdIu.cjs → node-sqlite-dialect-3Zf-dlQA.cjs} +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -942,12 +942,16 @@ declare const MS: {
|
|
|
942
942
|
};
|
|
943
943
|
//#endregion
|
|
944
944
|
//#region src/cache/backends/memory.d.ts
|
|
945
|
+
interface MemoryCacheOptions {
|
|
946
|
+
maxSize?: number;
|
|
947
|
+
cleanupIntervalMs?: number;
|
|
948
|
+
}
|
|
945
949
|
declare class MemoryCacheBackend implements CacheBackend {
|
|
946
950
|
private cache;
|
|
947
951
|
private stats;
|
|
948
952
|
private cleanupInterval?;
|
|
949
953
|
private maxSize;
|
|
950
|
-
constructor(
|
|
954
|
+
constructor(options?: MemoryCacheOptions);
|
|
951
955
|
private startCleanup;
|
|
952
956
|
private getFullKey;
|
|
953
957
|
private isExpired;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as literal, C as variantsSchema, D as any, E as _enum, F as union, I as unknown, M as object, N as record, O as array, P as string, S as variantVersionsSchema, T as zod_default, _ as environmentsSchema, a as matchType, b as schemas, c as logger, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, j as number, k as boolean, l as parsePartialTableData, m as configVariantsSchema, n as createDatabaseFromConnection, o as runAutoMigrations, p as SCHEMA_METADATA, r as detectDatabaseType, s as getAuthClientOptions, t as createDatabase, u as parseTableData, v as llmRequestsSchema, w as workspaceSettingsSchema, x as targetingRulesSchema, y as providerConfigsSchema } from "./db-
|
|
1
|
+
import { A as literal, C as variantsSchema, D as any, E as _enum, F as union, I as unknown, M as object, N as record, O as array, P as string, S as variantVersionsSchema, T as zod_default, _ as environmentsSchema, a as matchType, b as schemas, c as logger, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, j as number, k as boolean, l as parsePartialTableData, m as configVariantsSchema, n as createDatabaseFromConnection, o as runAutoMigrations, p as SCHEMA_METADATA, r as detectDatabaseType, s as getAuthClientOptions, t as createDatabase, u as parseTableData, v as llmRequestsSchema, w as workspaceSettingsSchema, x as targetingRulesSchema, y as providerConfigsSchema } from "./db-BbGik_bQ.mjs";
|
|
2
2
|
import gateway from "@llmops/gateway";
|
|
3
3
|
import { sql } from "kysely";
|
|
4
4
|
import * as fs from "node:fs/promises";
|
|
@@ -462,7 +462,8 @@ var MemoryCacheBackend = class {
|
|
|
462
462
|
};
|
|
463
463
|
cleanupInterval;
|
|
464
464
|
maxSize;
|
|
465
|
-
constructor(
|
|
465
|
+
constructor(options = {}) {
|
|
466
|
+
const { maxSize = 1e4, cleanupIntervalMs = 6e4 } = options;
|
|
466
467
|
this.maxSize = maxSize;
|
|
467
468
|
this.startCleanup(cleanupIntervalMs);
|
|
468
469
|
}
|
|
@@ -490,15 +491,18 @@ var MemoryCacheBackend = class {
|
|
|
490
491
|
const entry = this.cache.get(fullKey);
|
|
491
492
|
if (!entry) {
|
|
492
493
|
this.stats.misses++;
|
|
494
|
+
logger.debug({ key: fullKey }, "[MemoryCache] GET miss");
|
|
493
495
|
return null;
|
|
494
496
|
}
|
|
495
497
|
if (this.isExpired(entry)) {
|
|
496
498
|
this.cache.delete(fullKey);
|
|
497
499
|
this.stats.expired++;
|
|
498
500
|
this.stats.misses++;
|
|
501
|
+
logger.debug({ key: fullKey }, "[MemoryCache] GET expired");
|
|
499
502
|
return null;
|
|
500
503
|
}
|
|
501
504
|
this.stats.hits++;
|
|
505
|
+
logger.debug({ key: fullKey }, "[MemoryCache] GET hit");
|
|
502
506
|
return entry;
|
|
503
507
|
}
|
|
504
508
|
async set(key, value, options = {}) {
|
|
@@ -514,6 +518,11 @@ var MemoryCacheBackend = class {
|
|
|
514
518
|
this.cache.set(fullKey, entry);
|
|
515
519
|
this.stats.sets++;
|
|
516
520
|
this.stats.size = this.cache.size;
|
|
521
|
+
logger.debug({
|
|
522
|
+
key: fullKey,
|
|
523
|
+
ttl: options.ttl,
|
|
524
|
+
namespace: options.namespace
|
|
525
|
+
}, "[MemoryCache] SET");
|
|
517
526
|
}
|
|
518
527
|
async delete(key, namespace) {
|
|
519
528
|
const fullKey = this.getFullKey(key, namespace);
|
|
@@ -521,7 +530,8 @@ var MemoryCacheBackend = class {
|
|
|
521
530
|
if (deleted) {
|
|
522
531
|
this.stats.deletes++;
|
|
523
532
|
this.stats.size = this.cache.size;
|
|
524
|
-
|
|
533
|
+
logger.debug({ key: fullKey }, "[MemoryCache] DELETE");
|
|
534
|
+
} else logger.debug({ key: fullKey }, "[MemoryCache] DELETE not found");
|
|
525
535
|
return deleted;
|
|
526
536
|
}
|
|
527
537
|
async clear(namespace) {
|
|
@@ -530,9 +540,15 @@ var MemoryCacheBackend = class {
|
|
|
530
540
|
const keysToDelete = Array.from(this.cache.keys()).filter((key) => key.startsWith(prefix));
|
|
531
541
|
for (const key of keysToDelete) this.cache.delete(key);
|
|
532
542
|
this.stats.deletes += keysToDelete.length;
|
|
543
|
+
logger.debug({
|
|
544
|
+
namespace,
|
|
545
|
+
deletedCount: keysToDelete.length
|
|
546
|
+
}, "[MemoryCache] CLEAR namespace");
|
|
533
547
|
} else {
|
|
534
|
-
|
|
548
|
+
const count = this.cache.size;
|
|
549
|
+
this.stats.deletes += count;
|
|
535
550
|
this.cache.clear();
|
|
551
|
+
logger.debug({ deletedCount: count }, "[MemoryCache] CLEAR all");
|
|
536
552
|
}
|
|
537
553
|
this.stats.size = this.cache.size;
|
|
538
554
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmops/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-beta.1",
|
|
4
4
|
"description": "Core LLMOps functionality and utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"hono": "^4.10.7",
|
|
53
53
|
"kysely": "^0.28.8",
|
|
54
54
|
"pino": "^10.1.0",
|
|
55
|
-
"@llmops/gateway": "^0.2.
|
|
55
|
+
"@llmops/gateway": "^0.2.1-beta.1"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsdown",
|