@llmops/core 0.1.8 → 0.1.9-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-CYbkeI0s.cjs → bun-sqlite-dialect-Kl6MiKeQ.cjs} +1 -1
- package/dist/db/index.cjs +1 -1
- package/dist/db/index.d.cts +1 -1
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.mjs +1 -1
- package/dist/{db-C_u1BuaR.cjs → db-CpVh76Wq.cjs} +72 -43
- package/dist/{db-D78x_Elf.mjs → db-WrnSOT3M.mjs} +67 -44
- package/dist/{index-fgiyw393.d.mts → index-DILebhD2.d.mts} +104 -28
- package/dist/{index-CCfvTBvD.d.cts → index-DLavG1bA.d.cts} +104 -28
- package/dist/index.cjs +51 -4
- package/dist/index.d.cts +108 -84
- package/dist/index.d.mts +108 -84
- package/dist/index.mjs +51 -5
- package/dist/{node-sqlite-dialect-BSbNUAzj.cjs → node-sqlite-dialect-BkZpAjVL.cjs} +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as number, C as workspaceSettingsSchema, D as array, E as any, F as unknown, M as record, N as string, O as boolean, P as union, S as variantsSchema, T as _enum, _ as environmentsSchema, a as matchType, b as targetingRulesSchema, c as logger, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, j as object, k as literal, 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 zod_default, x as variantVersionsSchema, y as schemas } from "./db-WrnSOT3M.mjs";
|
|
2
2
|
import gateway from "@llmops/gateway";
|
|
3
3
|
import { sql } from "kysely";
|
|
4
4
|
import * as fs from "node:fs/promises";
|
|
@@ -455,7 +455,6 @@ const llmopsConfigSchema = object({
|
|
|
455
455
|
auth: authSchema,
|
|
456
456
|
basePath: string().min(1, "Base path is required and cannot be empty").refine((path$1) => path$1.startsWith("/"), "Base path must start with a forward slash"),
|
|
457
457
|
providers: providersSchema,
|
|
458
|
-
autoMigrate: union([boolean(), literal("development")]).optional().default(false),
|
|
459
458
|
schema: string().optional().default("llmops")
|
|
460
459
|
});
|
|
461
460
|
function validateLLMOpsConfig(config) {
|
|
@@ -2182,7 +2181,11 @@ const createVariantVersionsDataLayer = (db) => {
|
|
|
2182
2181
|
|
|
2183
2182
|
//#endregion
|
|
2184
2183
|
//#region src/datalayer/workspaceSettings.ts
|
|
2185
|
-
const updateWorkspaceSettings = zod_default.object({
|
|
2184
|
+
const updateWorkspaceSettings = zod_default.object({
|
|
2185
|
+
name: zod_default.string().nullable().optional(),
|
|
2186
|
+
setupComplete: zod_default.boolean().optional(),
|
|
2187
|
+
superAdminId: zod_default.string().nullable().optional()
|
|
2188
|
+
});
|
|
2186
2189
|
const createWorkspaceSettingsDataLayer = (db) => {
|
|
2187
2190
|
return {
|
|
2188
2191
|
getWorkspaceSettings: async () => {
|
|
@@ -2190,6 +2193,7 @@ const createWorkspaceSettingsDataLayer = (db) => {
|
|
|
2190
2193
|
if (!settings) settings = await db.insertInto("workspace_settings").values({
|
|
2191
2194
|
id: randomUUID(),
|
|
2192
2195
|
name: null,
|
|
2196
|
+
setupComplete: false,
|
|
2193
2197
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2194
2198
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2195
2199
|
}).returningAll().executeTakeFirst();
|
|
@@ -2202,11 +2206,53 @@ const createWorkspaceSettingsDataLayer = (db) => {
|
|
|
2202
2206
|
if (!settings) return db.insertInto("workspace_settings").values({
|
|
2203
2207
|
id: randomUUID(),
|
|
2204
2208
|
name: value.data.name ?? null,
|
|
2209
|
+
setupComplete: value.data.setupComplete ?? false,
|
|
2210
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2211
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2212
|
+
}).returningAll().executeTakeFirst();
|
|
2213
|
+
const updateData = { updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
2214
|
+
if (value.data.name !== void 0) updateData.name = value.data.name ?? null;
|
|
2215
|
+
if (value.data.setupComplete !== void 0) updateData.setupComplete = value.data.setupComplete;
|
|
2216
|
+
if (value.data.superAdminId !== void 0) updateData.superAdminId = value.data.superAdminId ?? null;
|
|
2217
|
+
return db.updateTable("workspace_settings").set(updateData).where("id", "=", settings.id).returningAll().executeTakeFirst();
|
|
2218
|
+
},
|
|
2219
|
+
getSuperAdminId: async () => {
|
|
2220
|
+
return (await db.selectFrom("workspace_settings").select("superAdminId").executeTakeFirst())?.superAdminId ?? null;
|
|
2221
|
+
},
|
|
2222
|
+
setSuperAdminId: async (userId) => {
|
|
2223
|
+
let settings = await db.selectFrom("workspace_settings").selectAll().executeTakeFirst();
|
|
2224
|
+
if (settings?.superAdminId) return false;
|
|
2225
|
+
if (!settings) {
|
|
2226
|
+
await db.insertInto("workspace_settings").values({
|
|
2227
|
+
id: randomUUID(),
|
|
2228
|
+
name: null,
|
|
2229
|
+
setupComplete: false,
|
|
2230
|
+
superAdminId: userId,
|
|
2231
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2232
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2233
|
+
}).execute();
|
|
2234
|
+
return true;
|
|
2235
|
+
}
|
|
2236
|
+
await db.updateTable("workspace_settings").set({
|
|
2237
|
+
superAdminId: userId,
|
|
2238
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2239
|
+
}).where("id", "=", settings.id).execute();
|
|
2240
|
+
return true;
|
|
2241
|
+
},
|
|
2242
|
+
isSetupComplete: async () => {
|
|
2243
|
+
return (await db.selectFrom("workspace_settings").select("setupComplete").executeTakeFirst())?.setupComplete ?? false;
|
|
2244
|
+
},
|
|
2245
|
+
markSetupComplete: async () => {
|
|
2246
|
+
let settings = await db.selectFrom("workspace_settings").selectAll().executeTakeFirst();
|
|
2247
|
+
if (!settings) return db.insertInto("workspace_settings").values({
|
|
2248
|
+
id: randomUUID(),
|
|
2249
|
+
name: null,
|
|
2250
|
+
setupComplete: true,
|
|
2205
2251
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2206
2252
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2207
2253
|
}).returningAll().executeTakeFirst();
|
|
2208
2254
|
return db.updateTable("workspace_settings").set({
|
|
2209
|
-
|
|
2255
|
+
setupComplete: true,
|
|
2210
2256
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2211
2257
|
}).where("id", "=", settings.id).returningAll().executeTakeFirst();
|
|
2212
2258
|
}
|
|
@@ -2433,4 +2479,4 @@ function getDefaultPricingProvider() {
|
|
|
2433
2479
|
}
|
|
2434
2480
|
|
|
2435
2481
|
//#endregion
|
|
2436
|
-
export { CacheService, FileCacheBackend, MS, MemoryCacheBackend, ModelsDevPricingProvider, SCHEMA_METADATA, SupportedProviders, calculateCost, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, createLLMRequestsDataLayer, detectDatabaseType, dollarsToMicroDollars, environmentSecretsSchema, environmentsSchema, formatCost, gateway, generateId, getDefaultPricingProvider, getMigrations, llmRequestsSchema, llmopsConfigSchema, logger, matchType, microDollarsToDollars, parsePartialTableData, parseTableData, runAutoMigrations, schemas, targetingRulesSchema, validateLLMOpsConfig, validatePartialTableData, validateTableData, variantJsonDataSchema, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
|
|
2482
|
+
export { CacheService, FileCacheBackend, MS, MemoryCacheBackend, ModelsDevPricingProvider, SCHEMA_METADATA, SupportedProviders, calculateCost, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, createLLMRequestsDataLayer, detectDatabaseType, dollarsToMicroDollars, environmentSecretsSchema, environmentsSchema, formatCost, gateway, generateId, getAuthClientOptions, getDefaultPricingProvider, getMigrations, llmRequestsSchema, llmopsConfigSchema, logger, matchType, microDollarsToDollars, parsePartialTableData, parseTableData, runAutoMigrations, schemas, targetingRulesSchema, validateLLMOpsConfig, validatePartialTableData, validateTableData, variantJsonDataSchema, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmops/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9-beta.1",
|
|
4
4
|
"description": "Core LLMOps functionality and utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,10 +48,11 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@better-auth/utils": "^0.3.0",
|
|
51
|
+
"better-auth": "^1.4.10",
|
|
51
52
|
"hono": "^4.10.7",
|
|
52
53
|
"kysely": "^0.28.8",
|
|
53
54
|
"pino": "^10.1.0",
|
|
54
|
-
"@llmops/gateway": "^0.1.
|
|
55
|
+
"@llmops/gateway": "^0.1.9-beta.1"
|
|
55
56
|
},
|
|
56
57
|
"scripts": {
|
|
57
58
|
"build": "tsdown",
|