@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CompiledQuery, Kysely, MssqlDialect, MysqlDialect, PostgresDialect, SqliteDialect, sql } from "kysely";
|
|
2
|
+
import { getMigrations } from "better-auth/db";
|
|
2
3
|
import pino from "pino";
|
|
3
4
|
|
|
4
5
|
//#region rolldown:runtime
|
|
@@ -9429,7 +9430,7 @@ function initializeContext(params) {
|
|
|
9429
9430
|
external: params?.external ?? void 0
|
|
9430
9431
|
};
|
|
9431
9432
|
}
|
|
9432
|
-
function process
|
|
9433
|
+
function process(schema, ctx, _params = {
|
|
9433
9434
|
path: [],
|
|
9434
9435
|
schemaPath: []
|
|
9435
9436
|
}) {
|
|
@@ -9459,7 +9460,7 @@ function process$1(schema, ctx, _params = {
|
|
|
9459
9460
|
const parent = schema._zod.parent;
|
|
9460
9461
|
if (parent) {
|
|
9461
9462
|
result.ref = parent;
|
|
9462
|
-
process
|
|
9463
|
+
process(parent, ctx, params);
|
|
9463
9464
|
ctx.seen.get(parent).isParent = true;
|
|
9464
9465
|
} else if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
9465
9466
|
else {
|
|
@@ -9649,7 +9650,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
9649
9650
|
...params,
|
|
9650
9651
|
processors
|
|
9651
9652
|
});
|
|
9652
|
-
process
|
|
9653
|
+
process(schema, ctx);
|
|
9653
9654
|
extractDefs(ctx, schema);
|
|
9654
9655
|
return finalize(ctx, schema);
|
|
9655
9656
|
};
|
|
@@ -9661,7 +9662,7 @@ const createStandardJSONSchemaMethod = (schema, io) => (params) => {
|
|
|
9661
9662
|
io,
|
|
9662
9663
|
processors: {}
|
|
9663
9664
|
});
|
|
9664
|
-
process
|
|
9665
|
+
process(schema, ctx);
|
|
9665
9666
|
extractDefs(ctx, schema);
|
|
9666
9667
|
return finalize(ctx, schema);
|
|
9667
9668
|
};
|
|
@@ -9834,7 +9835,7 @@ const arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
9834
9835
|
if (typeof minimum === "number") json$1.minItems = minimum;
|
|
9835
9836
|
if (typeof maximum === "number") json$1.maxItems = maximum;
|
|
9836
9837
|
json$1.type = "array";
|
|
9837
|
-
json$1.items = process
|
|
9838
|
+
json$1.items = process(def.element, ctx, {
|
|
9838
9839
|
...params,
|
|
9839
9840
|
path: [...params.path, "items"]
|
|
9840
9841
|
});
|
|
@@ -9845,7 +9846,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
9845
9846
|
json$1.type = "object";
|
|
9846
9847
|
json$1.properties = {};
|
|
9847
9848
|
const shape = def.shape;
|
|
9848
|
-
for (const key in shape) json$1.properties[key] = process
|
|
9849
|
+
for (const key in shape) json$1.properties[key] = process(shape[key], ctx, {
|
|
9849
9850
|
...params,
|
|
9850
9851
|
path: [
|
|
9851
9852
|
...params.path,
|
|
@@ -9863,7 +9864,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
9863
9864
|
if (def.catchall?._zod.def.type === "never") json$1.additionalProperties = false;
|
|
9864
9865
|
else if (!def.catchall) {
|
|
9865
9866
|
if (ctx.io === "output") json$1.additionalProperties = false;
|
|
9866
|
-
} else if (def.catchall) json$1.additionalProperties = process
|
|
9867
|
+
} else if (def.catchall) json$1.additionalProperties = process(def.catchall, ctx, {
|
|
9867
9868
|
...params,
|
|
9868
9869
|
path: [...params.path, "additionalProperties"]
|
|
9869
9870
|
});
|
|
@@ -9871,7 +9872,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
9871
9872
|
const unionProcessor = (schema, ctx, json$1, params) => {
|
|
9872
9873
|
const def = schema._zod.def;
|
|
9873
9874
|
const isExclusive = def.inclusive === false;
|
|
9874
|
-
const options = def.options.map((x, i) => process
|
|
9875
|
+
const options = def.options.map((x, i) => process(x, ctx, {
|
|
9875
9876
|
...params,
|
|
9876
9877
|
path: [
|
|
9877
9878
|
...params.path,
|
|
@@ -9884,7 +9885,7 @@ const unionProcessor = (schema, ctx, json$1, params) => {
|
|
|
9884
9885
|
};
|
|
9885
9886
|
const intersectionProcessor = (schema, ctx, json$1, params) => {
|
|
9886
9887
|
const def = schema._zod.def;
|
|
9887
|
-
const a = process
|
|
9888
|
+
const a = process(def.left, ctx, {
|
|
9888
9889
|
...params,
|
|
9889
9890
|
path: [
|
|
9890
9891
|
...params.path,
|
|
@@ -9892,7 +9893,7 @@ const intersectionProcessor = (schema, ctx, json$1, params) => {
|
|
|
9892
9893
|
0
|
|
9893
9894
|
]
|
|
9894
9895
|
});
|
|
9895
|
-
const b = process
|
|
9896
|
+
const b = process(def.right, ctx, {
|
|
9896
9897
|
...params,
|
|
9897
9898
|
path: [
|
|
9898
9899
|
...params.path,
|
|
@@ -9909,7 +9910,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
9909
9910
|
json$1.type = "array";
|
|
9910
9911
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
9911
9912
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
9912
|
-
const prefixItems = def.items.map((x, i) => process
|
|
9913
|
+
const prefixItems = def.items.map((x, i) => process(x, ctx, {
|
|
9913
9914
|
...params,
|
|
9914
9915
|
path: [
|
|
9915
9916
|
...params.path,
|
|
@@ -9917,7 +9918,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
9917
9918
|
i
|
|
9918
9919
|
]
|
|
9919
9920
|
}));
|
|
9920
|
-
const rest = def.rest ? process
|
|
9921
|
+
const rest = def.rest ? process(def.rest, ctx, {
|
|
9921
9922
|
...params,
|
|
9922
9923
|
path: [
|
|
9923
9924
|
...params.path,
|
|
@@ -9945,18 +9946,18 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
9945
9946
|
const json$1 = _json;
|
|
9946
9947
|
const def = schema._zod.def;
|
|
9947
9948
|
json$1.type = "object";
|
|
9948
|
-
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json$1.propertyNames = process
|
|
9949
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json$1.propertyNames = process(def.keyType, ctx, {
|
|
9949
9950
|
...params,
|
|
9950
9951
|
path: [...params.path, "propertyNames"]
|
|
9951
9952
|
});
|
|
9952
|
-
json$1.additionalProperties = process
|
|
9953
|
+
json$1.additionalProperties = process(def.valueType, ctx, {
|
|
9953
9954
|
...params,
|
|
9954
9955
|
path: [...params.path, "additionalProperties"]
|
|
9955
9956
|
});
|
|
9956
9957
|
};
|
|
9957
9958
|
const nullableProcessor = (schema, ctx, json$1, params) => {
|
|
9958
9959
|
const def = schema._zod.def;
|
|
9959
|
-
const inner = process
|
|
9960
|
+
const inner = process(def.innerType, ctx, params);
|
|
9960
9961
|
const seen = ctx.seen.get(schema);
|
|
9961
9962
|
if (ctx.target === "openapi-3.0") {
|
|
9962
9963
|
seen.ref = def.innerType;
|
|
@@ -9965,27 +9966,27 @@ const nullableProcessor = (schema, ctx, json$1, params) => {
|
|
|
9965
9966
|
};
|
|
9966
9967
|
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
9967
9968
|
const def = schema._zod.def;
|
|
9968
|
-
process
|
|
9969
|
+
process(def.innerType, ctx, params);
|
|
9969
9970
|
const seen = ctx.seen.get(schema);
|
|
9970
9971
|
seen.ref = def.innerType;
|
|
9971
9972
|
};
|
|
9972
9973
|
const defaultProcessor = (schema, ctx, json$1, params) => {
|
|
9973
9974
|
const def = schema._zod.def;
|
|
9974
|
-
process
|
|
9975
|
+
process(def.innerType, ctx, params);
|
|
9975
9976
|
const seen = ctx.seen.get(schema);
|
|
9976
9977
|
seen.ref = def.innerType;
|
|
9977
9978
|
json$1.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
9978
9979
|
};
|
|
9979
9980
|
const prefaultProcessor = (schema, ctx, json$1, params) => {
|
|
9980
9981
|
const def = schema._zod.def;
|
|
9981
|
-
process
|
|
9982
|
+
process(def.innerType, ctx, params);
|
|
9982
9983
|
const seen = ctx.seen.get(schema);
|
|
9983
9984
|
seen.ref = def.innerType;
|
|
9984
9985
|
if (ctx.io === "input") json$1._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
9985
9986
|
};
|
|
9986
9987
|
const catchProcessor = (schema, ctx, json$1, params) => {
|
|
9987
9988
|
const def = schema._zod.def;
|
|
9988
|
-
process
|
|
9989
|
+
process(def.innerType, ctx, params);
|
|
9989
9990
|
const seen = ctx.seen.get(schema);
|
|
9990
9991
|
seen.ref = def.innerType;
|
|
9991
9992
|
let catchValue;
|
|
@@ -9999,32 +10000,32 @@ const catchProcessor = (schema, ctx, json$1, params) => {
|
|
|
9999
10000
|
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
10000
10001
|
const def = schema._zod.def;
|
|
10001
10002
|
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
10002
|
-
process
|
|
10003
|
+
process(innerType, ctx, params);
|
|
10003
10004
|
const seen = ctx.seen.get(schema);
|
|
10004
10005
|
seen.ref = innerType;
|
|
10005
10006
|
};
|
|
10006
10007
|
const readonlyProcessor = (schema, ctx, json$1, params) => {
|
|
10007
10008
|
const def = schema._zod.def;
|
|
10008
|
-
process
|
|
10009
|
+
process(def.innerType, ctx, params);
|
|
10009
10010
|
const seen = ctx.seen.get(schema);
|
|
10010
10011
|
seen.ref = def.innerType;
|
|
10011
10012
|
json$1.readOnly = true;
|
|
10012
10013
|
};
|
|
10013
10014
|
const promiseProcessor = (schema, ctx, _json, params) => {
|
|
10014
10015
|
const def = schema._zod.def;
|
|
10015
|
-
process
|
|
10016
|
+
process(def.innerType, ctx, params);
|
|
10016
10017
|
const seen = ctx.seen.get(schema);
|
|
10017
10018
|
seen.ref = def.innerType;
|
|
10018
10019
|
};
|
|
10019
10020
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
10020
10021
|
const def = schema._zod.def;
|
|
10021
|
-
process
|
|
10022
|
+
process(def.innerType, ctx, params);
|
|
10022
10023
|
const seen = ctx.seen.get(schema);
|
|
10023
10024
|
seen.ref = def.innerType;
|
|
10024
10025
|
};
|
|
10025
10026
|
const lazyProcessor = (schema, ctx, _json, params) => {
|
|
10026
10027
|
const innerType = schema._zod.innerType;
|
|
10027
|
-
process
|
|
10028
|
+
process(innerType, ctx, params);
|
|
10028
10029
|
const seen = ctx.seen.get(schema);
|
|
10029
10030
|
seen.ref = innerType;
|
|
10030
10031
|
};
|
|
@@ -10079,7 +10080,7 @@ function toJSONSchema(input, params) {
|
|
|
10079
10080
|
const defs = {};
|
|
10080
10081
|
for (const entry of registry$1._idmap.entries()) {
|
|
10081
10082
|
const [_, schema] = entry;
|
|
10082
|
-
process
|
|
10083
|
+
process(schema, ctx$1);
|
|
10083
10084
|
}
|
|
10084
10085
|
const schemas$1 = {};
|
|
10085
10086
|
ctx$1.external = {
|
|
@@ -10099,7 +10100,7 @@ function toJSONSchema(input, params) {
|
|
|
10099
10100
|
...params,
|
|
10100
10101
|
processors: allProcessors
|
|
10101
10102
|
});
|
|
10102
|
-
process
|
|
10103
|
+
process(input, ctx);
|
|
10103
10104
|
extractDefs(ctx, input);
|
|
10104
10105
|
return finalize(ctx, input);
|
|
10105
10106
|
}
|
|
@@ -10176,7 +10177,7 @@ var JSONSchemaGenerator = class {
|
|
|
10176
10177
|
path: [],
|
|
10177
10178
|
schemaPath: []
|
|
10178
10179
|
}) {
|
|
10179
|
-
return process
|
|
10180
|
+
return process(schema, this.ctx, _params);
|
|
10180
10181
|
}
|
|
10181
10182
|
/**
|
|
10182
10183
|
* Emit the final JSON Schema after processing.
|
|
@@ -10459,7 +10460,7 @@ var core_exports = /* @__PURE__ */ __export({
|
|
|
10459
10460
|
parse: () => parse$1,
|
|
10460
10461
|
parseAsync: () => parseAsync$1,
|
|
10461
10462
|
prettifyError: () => prettifyError,
|
|
10462
|
-
process: () => process
|
|
10463
|
+
process: () => process,
|
|
10463
10464
|
regexes: () => regexes_exports,
|
|
10464
10465
|
registry: () => registry,
|
|
10465
10466
|
safeDecode: () => safeDecode$1,
|
|
@@ -12405,7 +12406,9 @@ const targetingRulesSchema = object({
|
|
|
12405
12406
|
});
|
|
12406
12407
|
const workspaceSettingsSchema = object({
|
|
12407
12408
|
...baseSchema,
|
|
12408
|
-
name: string$1().nullable().optional()
|
|
12409
|
+
name: string$1().nullable().optional(),
|
|
12410
|
+
setupComplete: boolean$1().default(false),
|
|
12411
|
+
superAdminId: string$1().nullable().optional()
|
|
12409
12412
|
});
|
|
12410
12413
|
const llmRequestsSchema = object({
|
|
12411
12414
|
...baseSchema,
|
|
@@ -12677,6 +12680,14 @@ const SCHEMA_METADATA = { tables: {
|
|
|
12677
12680
|
type: "text",
|
|
12678
12681
|
nullable: true
|
|
12679
12682
|
},
|
|
12683
|
+
setupComplete: {
|
|
12684
|
+
type: "boolean",
|
|
12685
|
+
default: false
|
|
12686
|
+
},
|
|
12687
|
+
superAdminId: {
|
|
12688
|
+
type: "text",
|
|
12689
|
+
nullable: true
|
|
12690
|
+
},
|
|
12680
12691
|
createdAt: {
|
|
12681
12692
|
type: "timestamp",
|
|
12682
12693
|
default: "now()"
|
|
@@ -12828,6 +12839,22 @@ function parsePartialTableData(table, data) {
|
|
|
12828
12839
|
//#region src/utils/logger.ts
|
|
12829
12840
|
const logger = pino();
|
|
12830
12841
|
|
|
12842
|
+
//#endregion
|
|
12843
|
+
//#region src/auth/get-auth-client-options.ts
|
|
12844
|
+
/**
|
|
12845
|
+
* Get Better Auth client options
|
|
12846
|
+
*
|
|
12847
|
+
* @param database - Either a raw database connection or a pre-configured Kysely instance
|
|
12848
|
+
* When using PostgreSQL with custom schema, pass { db, type } to ensure
|
|
12849
|
+
* Better Auth uses the correctly configured Kysely instance
|
|
12850
|
+
*/
|
|
12851
|
+
const getAuthClientOptions = (database) => {
|
|
12852
|
+
return {
|
|
12853
|
+
database,
|
|
12854
|
+
emailAndPassword: { enabled: true }
|
|
12855
|
+
};
|
|
12856
|
+
};
|
|
12857
|
+
|
|
12831
12858
|
//#endregion
|
|
12832
12859
|
//#region src/db/migrations.ts
|
|
12833
12860
|
const typeMap = {
|
|
@@ -12918,7 +12945,7 @@ async function ensurePostgresSchemaExists(db, schema) {
|
|
|
12918
12945
|
try {
|
|
12919
12946
|
if (!(await sql`
|
|
12920
12947
|
SELECT EXISTS (
|
|
12921
|
-
SELECT 1 FROM information_schema.schemata
|
|
12948
|
+
SELECT 1 FROM information_schema.schemata
|
|
12922
12949
|
WHERE schema_name = ${schema}
|
|
12923
12950
|
) as exists
|
|
12924
12951
|
`.execute(db)).rows[0]?.exists) {
|
|
@@ -12932,7 +12959,7 @@ async function ensurePostgresSchemaExists(db, schema) {
|
|
|
12932
12959
|
} catch {}
|
|
12933
12960
|
}
|
|
12934
12961
|
}
|
|
12935
|
-
async function getMigrations(db, dbType, options) {
|
|
12962
|
+
async function getMigrations$1(db, dbType, options) {
|
|
12936
12963
|
let currentSchema = "public";
|
|
12937
12964
|
if (dbType === "postgres") {
|
|
12938
12965
|
if (options?.schema) {
|
|
@@ -13067,36 +13094,32 @@ async function getMigrations(db, dbType, options) {
|
|
|
13067
13094
|
});
|
|
13068
13095
|
migrations.push(builder);
|
|
13069
13096
|
}
|
|
13097
|
+
const { toBeAdded: authChangesToBeAdded, toBeCreated: authChangesToBeCreated, runMigrations: runAuthMigrations } = await getMigrations(getAuthClientOptions(options?.rawConnection));
|
|
13070
13098
|
async function runMigrations() {
|
|
13071
13099
|
for (const migration of migrations) await migration.execute();
|
|
13100
|
+
await runAuthMigrations();
|
|
13072
13101
|
}
|
|
13073
13102
|
async function compileMigrations() {
|
|
13074
13103
|
return migrations.map((m) => m.compile().sql).join(";\n\n") + ";";
|
|
13075
13104
|
}
|
|
13076
13105
|
return {
|
|
13077
|
-
toBeCreated,
|
|
13078
|
-
toBeAdded,
|
|
13106
|
+
toBeCreated: [...toBeCreated, ...authChangesToBeCreated],
|
|
13107
|
+
toBeAdded: [...toBeAdded, ...authChangesToBeAdded],
|
|
13079
13108
|
runMigrations,
|
|
13080
13109
|
compileMigrations,
|
|
13081
13110
|
migrations,
|
|
13082
|
-
needsMigration: toBeCreated.length > 0 || toBeAdded.length > 0
|
|
13111
|
+
needsMigration: toBeCreated.length > 0 || toBeAdded.length > 0 || authChangesToBeCreated.length > 0 || authChangesToBeAdded.length > 0
|
|
13083
13112
|
};
|
|
13084
13113
|
}
|
|
13085
13114
|
/**
|
|
13086
|
-
* Run migrations if needed
|
|
13115
|
+
* Run migrations if needed
|
|
13087
13116
|
* @param db - Kysely database instance
|
|
13088
13117
|
* @param dbType - Database type
|
|
13089
|
-
* @param autoMigrate - Auto-migrate configuration
|
|
13090
13118
|
* @param options - Migration options (schema, etc.)
|
|
13091
13119
|
* @returns true if migrations were run, false otherwise
|
|
13092
13120
|
*/
|
|
13093
|
-
async function runAutoMigrations(db, dbType,
|
|
13094
|
-
|
|
13095
|
-
ran: false,
|
|
13096
|
-
tables: [],
|
|
13097
|
-
fields: []
|
|
13098
|
-
};
|
|
13099
|
-
const { toBeCreated, toBeAdded, runMigrations, needsMigration } = await getMigrations(db, dbType, options);
|
|
13121
|
+
async function runAutoMigrations(db, dbType, options) {
|
|
13122
|
+
const { toBeCreated, toBeAdded, runMigrations, needsMigration } = await getMigrations$1(db, dbType, options);
|
|
13100
13123
|
if (!needsMigration) {
|
|
13101
13124
|
logger.debug("Auto-migration: No migrations needed");
|
|
13102
13125
|
return {
|
|
@@ -13190,4 +13213,4 @@ async function createDatabaseFromConnection(rawConnection, options) {
|
|
|
13190
13213
|
}
|
|
13191
13214
|
|
|
13192
13215
|
//#endregion
|
|
13193
|
-
export {
|
|
13216
|
+
export { number$1 as A, workspaceSettingsSchema as C, array as D, any as E, unknown as F, record as M, string$1 as N, boolean$1 as O, union as P, variantsSchema as S, _enum as T, environmentsSchema as _, matchType as a, targetingRulesSchema as b, logger as c, validatePartialTableData as d, validateTableData as f, environmentSecretsSchema as g, configsSchema as h, getMigrations$1 as i, object as j, literal as k, parsePartialTableData as l, configVariantsSchema as m, createDatabaseFromConnection as n, runAutoMigrations as o, SCHEMA_METADATA as p, detectDatabaseType as r, getAuthClientOptions as s, createDatabase as t, parseTableData as u, llmRequestsSchema as v, zod_default as w, variantVersionsSchema as x, schemas as y };
|