@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.
@@ -1,4 +1,4 @@
1
- const require_db = require('./db-C_u1BuaR.cjs');
1
+ const require_db = require('./db-CpVh76Wq.cjs');
2
2
  let kysely = require("kysely");
3
3
 
4
4
  //#region src/db/bun-sqlite-dialect.ts
package/dist/db/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_db = require('../db-C_u1BuaR.cjs');
1
+ const require_db = require('../db-CpVh76Wq.cjs');
2
2
 
3
3
  exports.SCHEMA_METADATA = require_db.SCHEMA_METADATA;
4
4
  exports.configVariantsSchema = require_db.configVariantsSchema;
@@ -1,2 +1,2 @@
1
- import { A as TableName, B as configVariantsSchema, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as VariantVersion, G as schemas, H as environmentSecretsSchema, I as VariantVersionsTable, J as variantsSchema, K as targetingRulesSchema, L as VariantsTable, M as TargetingRulesTable, N as Updateable, O as SCHEMA_METADATA, P as Variant, R as WorkspaceSettings, S as EnvironmentSecret, T as Insertable, U as environmentsSchema, V as configsSchema, W as llmRequestsSchema, Y as workspaceSettingsSchema, _ 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 TargetingRule, k as Selectable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as variantVersionsSchema, 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 WorkspaceSettingsTable } from "../index-CCfvTBvD.cjs";
1
+ import { A as TableName, B as configVariantsSchema, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as VariantVersion, G as schemas, H as environmentSecretsSchema, I as VariantVersionsTable, J as variantsSchema, K as targetingRulesSchema, L as VariantsTable, M as TargetingRulesTable, N as Updateable, O as SCHEMA_METADATA, P as Variant, R as WorkspaceSettings, S as EnvironmentSecret, T as Insertable, U as environmentsSchema, V as configsSchema, W as llmRequestsSchema, Y as workspaceSettingsSchema, _ 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 TargetingRule, k as Selectable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as variantVersionsSchema, 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 WorkspaceSettingsTable } from "../index-DLavG1bA.cjs";
2
2
  export { Config, ConfigVariant, ConfigVariantsTable, ConfigsTable, Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, EnvironmentSecretsTable, EnvironmentsTable, Insertable, LLMRequest, LLMRequestsTable, MigrationOptions, MigrationResult, SCHEMA_METADATA, Selectable, TableName, TargetingRule, TargetingRulesTable, Updateable, Variant, VariantVersion, VariantVersionsTable, VariantsTable, WorkspaceSettings, WorkspaceSettingsTable, configVariantsSchema, configsSchema, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, getMigrations, llmRequestsSchema, matchType, parsePartialTableData, parseTableData, runAutoMigrations, schemas, targetingRulesSchema, validatePartialTableData, validateTableData, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
@@ -1,2 +1,2 @@
1
- import { A as TableName, B as configVariantsSchema, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as VariantVersion, G as schemas, H as environmentSecretsSchema, I as VariantVersionsTable, J as variantsSchema, K as targetingRulesSchema, L as VariantsTable, M as TargetingRulesTable, N as Updateable, O as SCHEMA_METADATA, P as Variant, R as WorkspaceSettings, S as EnvironmentSecret, T as Insertable, U as environmentsSchema, V as configsSchema, W as llmRequestsSchema, Y as workspaceSettingsSchema, _ 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 TargetingRule, k as Selectable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as variantVersionsSchema, 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 WorkspaceSettingsTable } from "../index-fgiyw393.mjs";
1
+ import { A as TableName, B as configVariantsSchema, C as EnvironmentSecretsTable, D as LLMRequestsTable, E as LLMRequest, F as VariantVersion, G as schemas, H as environmentSecretsSchema, I as VariantVersionsTable, J as variantsSchema, K as targetingRulesSchema, L as VariantsTable, M as TargetingRulesTable, N as Updateable, O as SCHEMA_METADATA, P as Variant, R as WorkspaceSettings, S as EnvironmentSecret, T as Insertable, U as environmentsSchema, V as configsSchema, W as llmRequestsSchema, Y as workspaceSettingsSchema, _ 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 TargetingRule, k as Selectable, l as getMigrations, m as validatePartialTableData, n as DatabaseOptions, o as detectDatabaseType, p as parseTableData, q as variantVersionsSchema, 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 WorkspaceSettingsTable } from "../index-DILebhD2.mjs";
2
2
  export { Config, ConfigVariant, ConfigVariantsTable, ConfigsTable, Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, EnvironmentSecretsTable, EnvironmentsTable, Insertable, LLMRequest, LLMRequestsTable, MigrationOptions, MigrationResult, SCHEMA_METADATA, Selectable, TableName, TargetingRule, TargetingRulesTable, Updateable, Variant, VariantVersion, VariantVersionsTable, VariantsTable, WorkspaceSettings, WorkspaceSettingsTable, configVariantsSchema, configsSchema, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, getMigrations, llmRequestsSchema, matchType, parsePartialTableData, parseTableData, runAutoMigrations, schemas, targetingRulesSchema, validatePartialTableData, validateTableData, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
package/dist/db/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { S as workspaceSettingsSchema, _ as llmRequestsSchema, a as matchType, b as variantVersionsSchema, c as parsePartialTableData, d as validateTableData, f as SCHEMA_METADATA, g as environmentsSchema, h as environmentSecretsSchema, i as getMigrations, l as parseTableData, m as configsSchema, n as createDatabaseFromConnection, o as runAutoMigrations, p as configVariantsSchema, r as detectDatabaseType, t as createDatabase, u as validatePartialTableData, v as schemas, x as variantsSchema, y as targetingRulesSchema } from "../db-D78x_Elf.mjs";
1
+ import { C as workspaceSettingsSchema, S as variantsSchema, _ as environmentsSchema, a as matchType, b as targetingRulesSchema, d as validatePartialTableData, f as validateTableData, g as environmentSecretsSchema, h as configsSchema, i as getMigrations, l as parsePartialTableData, m as configVariantsSchema, n as createDatabaseFromConnection, o as runAutoMigrations, p as SCHEMA_METADATA, r as detectDatabaseType, t as createDatabase, u as parseTableData, v as llmRequestsSchema, x as variantVersionsSchema, y as schemas } from "../db-WrnSOT3M.mjs";
2
2
 
3
3
  export { SCHEMA_METADATA, configVariantsSchema, configsSchema, createDatabase, createDatabaseFromConnection, detectDatabaseType, environmentSecretsSchema, environmentsSchema, getMigrations, llmRequestsSchema, matchType, parsePartialTableData, parseTableData, runAutoMigrations, schemas, targetingRulesSchema, validatePartialTableData, validateTableData, variantVersionsSchema, variantsSchema, workspaceSettingsSchema };
@@ -39,6 +39,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
39
39
 
40
40
  //#endregion
41
41
  let kysely = require("kysely");
42
+ let better_auth_db = require("better-auth/db");
42
43
  let pino = require("pino");
43
44
  pino = __toESM(pino);
44
45
 
@@ -9453,7 +9454,7 @@ function initializeContext(params) {
9453
9454
  external: params?.external ?? void 0
9454
9455
  };
9455
9456
  }
9456
- function process$1(schema, ctx, _params = {
9457
+ function process(schema, ctx, _params = {
9457
9458
  path: [],
9458
9459
  schemaPath: []
9459
9460
  }) {
@@ -9483,7 +9484,7 @@ function process$1(schema, ctx, _params = {
9483
9484
  const parent = schema._zod.parent;
9484
9485
  if (parent) {
9485
9486
  result.ref = parent;
9486
- process$1(parent, ctx, params);
9487
+ process(parent, ctx, params);
9487
9488
  ctx.seen.get(parent).isParent = true;
9488
9489
  } else if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
9489
9490
  else {
@@ -9673,7 +9674,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
9673
9674
  ...params,
9674
9675
  processors
9675
9676
  });
9676
- process$1(schema, ctx);
9677
+ process(schema, ctx);
9677
9678
  extractDefs(ctx, schema);
9678
9679
  return finalize(ctx, schema);
9679
9680
  };
@@ -9685,7 +9686,7 @@ const createStandardJSONSchemaMethod = (schema, io) => (params) => {
9685
9686
  io,
9686
9687
  processors: {}
9687
9688
  });
9688
- process$1(schema, ctx);
9689
+ process(schema, ctx);
9689
9690
  extractDefs(ctx, schema);
9690
9691
  return finalize(ctx, schema);
9691
9692
  };
@@ -9858,7 +9859,7 @@ const arrayProcessor = (schema, ctx, _json, params) => {
9858
9859
  if (typeof minimum === "number") json$1.minItems = minimum;
9859
9860
  if (typeof maximum === "number") json$1.maxItems = maximum;
9860
9861
  json$1.type = "array";
9861
- json$1.items = process$1(def.element, ctx, {
9862
+ json$1.items = process(def.element, ctx, {
9862
9863
  ...params,
9863
9864
  path: [...params.path, "items"]
9864
9865
  });
@@ -9869,7 +9870,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
9869
9870
  json$1.type = "object";
9870
9871
  json$1.properties = {};
9871
9872
  const shape = def.shape;
9872
- for (const key in shape) json$1.properties[key] = process$1(shape[key], ctx, {
9873
+ for (const key in shape) json$1.properties[key] = process(shape[key], ctx, {
9873
9874
  ...params,
9874
9875
  path: [
9875
9876
  ...params.path,
@@ -9887,7 +9888,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
9887
9888
  if (def.catchall?._zod.def.type === "never") json$1.additionalProperties = false;
9888
9889
  else if (!def.catchall) {
9889
9890
  if (ctx.io === "output") json$1.additionalProperties = false;
9890
- } else if (def.catchall) json$1.additionalProperties = process$1(def.catchall, ctx, {
9891
+ } else if (def.catchall) json$1.additionalProperties = process(def.catchall, ctx, {
9891
9892
  ...params,
9892
9893
  path: [...params.path, "additionalProperties"]
9893
9894
  });
@@ -9895,7 +9896,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
9895
9896
  const unionProcessor = (schema, ctx, json$1, params) => {
9896
9897
  const def = schema._zod.def;
9897
9898
  const isExclusive = def.inclusive === false;
9898
- const options = def.options.map((x, i) => process$1(x, ctx, {
9899
+ const options = def.options.map((x, i) => process(x, ctx, {
9899
9900
  ...params,
9900
9901
  path: [
9901
9902
  ...params.path,
@@ -9908,7 +9909,7 @@ const unionProcessor = (schema, ctx, json$1, params) => {
9908
9909
  };
9909
9910
  const intersectionProcessor = (schema, ctx, json$1, params) => {
9910
9911
  const def = schema._zod.def;
9911
- const a = process$1(def.left, ctx, {
9912
+ const a = process(def.left, ctx, {
9912
9913
  ...params,
9913
9914
  path: [
9914
9915
  ...params.path,
@@ -9916,7 +9917,7 @@ const intersectionProcessor = (schema, ctx, json$1, params) => {
9916
9917
  0
9917
9918
  ]
9918
9919
  });
9919
- const b = process$1(def.right, ctx, {
9920
+ const b = process(def.right, ctx, {
9920
9921
  ...params,
9921
9922
  path: [
9922
9923
  ...params.path,
@@ -9933,7 +9934,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
9933
9934
  json$1.type = "array";
9934
9935
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
9935
9936
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
9936
- const prefixItems = def.items.map((x, i) => process$1(x, ctx, {
9937
+ const prefixItems = def.items.map((x, i) => process(x, ctx, {
9937
9938
  ...params,
9938
9939
  path: [
9939
9940
  ...params.path,
@@ -9941,7 +9942,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
9941
9942
  i
9942
9943
  ]
9943
9944
  }));
9944
- const rest = def.rest ? process$1(def.rest, ctx, {
9945
+ const rest = def.rest ? process(def.rest, ctx, {
9945
9946
  ...params,
9946
9947
  path: [
9947
9948
  ...params.path,
@@ -9969,18 +9970,18 @@ const recordProcessor = (schema, ctx, _json, params) => {
9969
9970
  const json$1 = _json;
9970
9971
  const def = schema._zod.def;
9971
9972
  json$1.type = "object";
9972
- if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json$1.propertyNames = process$1(def.keyType, ctx, {
9973
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json$1.propertyNames = process(def.keyType, ctx, {
9973
9974
  ...params,
9974
9975
  path: [...params.path, "propertyNames"]
9975
9976
  });
9976
- json$1.additionalProperties = process$1(def.valueType, ctx, {
9977
+ json$1.additionalProperties = process(def.valueType, ctx, {
9977
9978
  ...params,
9978
9979
  path: [...params.path, "additionalProperties"]
9979
9980
  });
9980
9981
  };
9981
9982
  const nullableProcessor = (schema, ctx, json$1, params) => {
9982
9983
  const def = schema._zod.def;
9983
- const inner = process$1(def.innerType, ctx, params);
9984
+ const inner = process(def.innerType, ctx, params);
9984
9985
  const seen = ctx.seen.get(schema);
9985
9986
  if (ctx.target === "openapi-3.0") {
9986
9987
  seen.ref = def.innerType;
@@ -9989,27 +9990,27 @@ const nullableProcessor = (schema, ctx, json$1, params) => {
9989
9990
  };
9990
9991
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
9991
9992
  const def = schema._zod.def;
9992
- process$1(def.innerType, ctx, params);
9993
+ process(def.innerType, ctx, params);
9993
9994
  const seen = ctx.seen.get(schema);
9994
9995
  seen.ref = def.innerType;
9995
9996
  };
9996
9997
  const defaultProcessor = (schema, ctx, json$1, params) => {
9997
9998
  const def = schema._zod.def;
9998
- process$1(def.innerType, ctx, params);
9999
+ process(def.innerType, ctx, params);
9999
10000
  const seen = ctx.seen.get(schema);
10000
10001
  seen.ref = def.innerType;
10001
10002
  json$1.default = JSON.parse(JSON.stringify(def.defaultValue));
10002
10003
  };
10003
10004
  const prefaultProcessor = (schema, ctx, json$1, params) => {
10004
10005
  const def = schema._zod.def;
10005
- process$1(def.innerType, ctx, params);
10006
+ process(def.innerType, ctx, params);
10006
10007
  const seen = ctx.seen.get(schema);
10007
10008
  seen.ref = def.innerType;
10008
10009
  if (ctx.io === "input") json$1._prefault = JSON.parse(JSON.stringify(def.defaultValue));
10009
10010
  };
10010
10011
  const catchProcessor = (schema, ctx, json$1, params) => {
10011
10012
  const def = schema._zod.def;
10012
- process$1(def.innerType, ctx, params);
10013
+ process(def.innerType, ctx, params);
10013
10014
  const seen = ctx.seen.get(schema);
10014
10015
  seen.ref = def.innerType;
10015
10016
  let catchValue;
@@ -10023,32 +10024,32 @@ const catchProcessor = (schema, ctx, json$1, params) => {
10023
10024
  const pipeProcessor = (schema, ctx, _json, params) => {
10024
10025
  const def = schema._zod.def;
10025
10026
  const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
10026
- process$1(innerType, ctx, params);
10027
+ process(innerType, ctx, params);
10027
10028
  const seen = ctx.seen.get(schema);
10028
10029
  seen.ref = innerType;
10029
10030
  };
10030
10031
  const readonlyProcessor = (schema, ctx, json$1, params) => {
10031
10032
  const def = schema._zod.def;
10032
- process$1(def.innerType, ctx, params);
10033
+ process(def.innerType, ctx, params);
10033
10034
  const seen = ctx.seen.get(schema);
10034
10035
  seen.ref = def.innerType;
10035
10036
  json$1.readOnly = true;
10036
10037
  };
10037
10038
  const promiseProcessor = (schema, ctx, _json, params) => {
10038
10039
  const def = schema._zod.def;
10039
- process$1(def.innerType, ctx, params);
10040
+ process(def.innerType, ctx, params);
10040
10041
  const seen = ctx.seen.get(schema);
10041
10042
  seen.ref = def.innerType;
10042
10043
  };
10043
10044
  const optionalProcessor = (schema, ctx, _json, params) => {
10044
10045
  const def = schema._zod.def;
10045
- process$1(def.innerType, ctx, params);
10046
+ process(def.innerType, ctx, params);
10046
10047
  const seen = ctx.seen.get(schema);
10047
10048
  seen.ref = def.innerType;
10048
10049
  };
10049
10050
  const lazyProcessor = (schema, ctx, _json, params) => {
10050
10051
  const innerType = schema._zod.innerType;
10051
- process$1(innerType, ctx, params);
10052
+ process(innerType, ctx, params);
10052
10053
  const seen = ctx.seen.get(schema);
10053
10054
  seen.ref = innerType;
10054
10055
  };
@@ -10103,7 +10104,7 @@ function toJSONSchema(input, params) {
10103
10104
  const defs = {};
10104
10105
  for (const entry of registry$1._idmap.entries()) {
10105
10106
  const [_, schema] = entry;
10106
- process$1(schema, ctx$1);
10107
+ process(schema, ctx$1);
10107
10108
  }
10108
10109
  const schemas$1 = {};
10109
10110
  ctx$1.external = {
@@ -10123,7 +10124,7 @@ function toJSONSchema(input, params) {
10123
10124
  ...params,
10124
10125
  processors: allProcessors
10125
10126
  });
10126
- process$1(input, ctx);
10127
+ process(input, ctx);
10127
10128
  extractDefs(ctx, input);
10128
10129
  return finalize(ctx, input);
10129
10130
  }
@@ -10200,7 +10201,7 @@ var JSONSchemaGenerator = class {
10200
10201
  path: [],
10201
10202
  schemaPath: []
10202
10203
  }) {
10203
- return process$1(schema, this.ctx, _params);
10204
+ return process(schema, this.ctx, _params);
10204
10205
  }
10205
10206
  /**
10206
10207
  * Emit the final JSON Schema after processing.
@@ -10483,7 +10484,7 @@ var core_exports = /* @__PURE__ */ __export({
10483
10484
  parse: () => parse$1,
10484
10485
  parseAsync: () => parseAsync$1,
10485
10486
  prettifyError: () => prettifyError,
10486
- process: () => process$1,
10487
+ process: () => process,
10487
10488
  regexes: () => regexes_exports,
10488
10489
  registry: () => registry,
10489
10490
  safeDecode: () => safeDecode$1,
@@ -12429,7 +12430,9 @@ const targetingRulesSchema = object({
12429
12430
  });
12430
12431
  const workspaceSettingsSchema = object({
12431
12432
  ...baseSchema,
12432
- name: string$1().nullable().optional()
12433
+ name: string$1().nullable().optional(),
12434
+ setupComplete: boolean$1().default(false),
12435
+ superAdminId: string$1().nullable().optional()
12433
12436
  });
12434
12437
  const llmRequestsSchema = object({
12435
12438
  ...baseSchema,
@@ -12701,6 +12704,14 @@ const SCHEMA_METADATA = { tables: {
12701
12704
  type: "text",
12702
12705
  nullable: true
12703
12706
  },
12707
+ setupComplete: {
12708
+ type: "boolean",
12709
+ default: false
12710
+ },
12711
+ superAdminId: {
12712
+ type: "text",
12713
+ nullable: true
12714
+ },
12704
12715
  createdAt: {
12705
12716
  type: "timestamp",
12706
12717
  default: "now()"
@@ -12852,6 +12863,22 @@ function parsePartialTableData(table, data) {
12852
12863
  //#region src/utils/logger.ts
12853
12864
  const logger = (0, pino.default)();
12854
12865
 
12866
+ //#endregion
12867
+ //#region src/auth/get-auth-client-options.ts
12868
+ /**
12869
+ * Get Better Auth client options
12870
+ *
12871
+ * @param database - Either a raw database connection or a pre-configured Kysely instance
12872
+ * When using PostgreSQL with custom schema, pass { db, type } to ensure
12873
+ * Better Auth uses the correctly configured Kysely instance
12874
+ */
12875
+ const getAuthClientOptions = (database) => {
12876
+ return {
12877
+ database,
12878
+ emailAndPassword: { enabled: true }
12879
+ };
12880
+ };
12881
+
12855
12882
  //#endregion
12856
12883
  //#region src/db/migrations.ts
12857
12884
  const typeMap = {
@@ -12942,7 +12969,7 @@ async function ensurePostgresSchemaExists(db, schema) {
12942
12969
  try {
12943
12970
  if (!(await kysely.sql`
12944
12971
  SELECT EXISTS (
12945
- SELECT 1 FROM information_schema.schemata
12972
+ SELECT 1 FROM information_schema.schemata
12946
12973
  WHERE schema_name = ${schema}
12947
12974
  ) as exists
12948
12975
  `.execute(db)).rows[0]?.exists) {
@@ -13091,35 +13118,31 @@ async function getMigrations(db, dbType, options) {
13091
13118
  });
13092
13119
  migrations.push(builder);
13093
13120
  }
13121
+ const { toBeAdded: authChangesToBeAdded, toBeCreated: authChangesToBeCreated, runMigrations: runAuthMigrations } = await (0, better_auth_db.getMigrations)(getAuthClientOptions(options?.rawConnection));
13094
13122
  async function runMigrations() {
13095
13123
  for (const migration of migrations) await migration.execute();
13124
+ await runAuthMigrations();
13096
13125
  }
13097
13126
  async function compileMigrations() {
13098
13127
  return migrations.map((m) => m.compile().sql).join(";\n\n") + ";";
13099
13128
  }
13100
13129
  return {
13101
- toBeCreated,
13102
- toBeAdded,
13130
+ toBeCreated: [...toBeCreated, ...authChangesToBeCreated],
13131
+ toBeAdded: [...toBeAdded, ...authChangesToBeAdded],
13103
13132
  runMigrations,
13104
13133
  compileMigrations,
13105
13134
  migrations,
13106
- needsMigration: toBeCreated.length > 0 || toBeAdded.length > 0
13135
+ needsMigration: toBeCreated.length > 0 || toBeAdded.length > 0 || authChangesToBeCreated.length > 0 || authChangesToBeAdded.length > 0
13107
13136
  };
13108
13137
  }
13109
13138
  /**
13110
- * Run migrations if needed based on autoMigrate config
13139
+ * Run migrations if needed
13111
13140
  * @param db - Kysely database instance
13112
13141
  * @param dbType - Database type
13113
- * @param autoMigrate - Auto-migrate configuration
13114
13142
  * @param options - Migration options (schema, etc.)
13115
13143
  * @returns true if migrations were run, false otherwise
13116
13144
  */
13117
- async function runAutoMigrations(db, dbType, autoMigrate, options) {
13118
- if (!(autoMigrate === true || autoMigrate === "development" && process.env.NODE_ENV === "development")) return {
13119
- ran: false,
13120
- tables: [],
13121
- fields: []
13122
- };
13145
+ async function runAutoMigrations(db, dbType, options) {
13123
13146
  const { toBeCreated, toBeAdded, runMigrations, needsMigration } = await getMigrations(db, dbType, options);
13124
13147
  if (!needsMigration) {
13125
13148
  logger.debug("Auto-migration: No migrations needed");
@@ -13185,12 +13208,12 @@ async function createDatabaseFromConnection(rawConnection, options) {
13185
13208
  case "sqlite":
13186
13209
  if ("aggregate" in rawConnection && !("createSession" in rawConnection)) dialect = new kysely.SqliteDialect({ database: rawConnection });
13187
13210
  else if ("fileControl" in rawConnection) {
13188
- const { BunSqliteDialect } = await Promise.resolve().then(() => require("./bun-sqlite-dialect-CYbkeI0s.cjs"));
13211
+ const { BunSqliteDialect } = await Promise.resolve().then(() => require("./bun-sqlite-dialect-Kl6MiKeQ.cjs"));
13189
13212
  dialect = new BunSqliteDialect({ database: rawConnection });
13190
13213
  } else if ("createSession" in rawConnection && typeof window === "undefined") try {
13191
13214
  const { DatabaseSync } = await import("node:sqlite");
13192
13215
  if (rawConnection instanceof DatabaseSync) {
13193
- const { NodeSqliteDialect } = await Promise.resolve().then(() => require("./node-sqlite-dialect-BSbNUAzj.cjs"));
13216
+ const { NodeSqliteDialect } = await Promise.resolve().then(() => require("./node-sqlite-dialect-BkZpAjVL.cjs"));
13194
13217
  dialect = new NodeSqliteDialect({ database: rawConnection });
13195
13218
  }
13196
13219
  } catch {}
@@ -13292,6 +13315,12 @@ Object.defineProperty(exports, 'environmentsSchema', {
13292
13315
  return environmentsSchema;
13293
13316
  }
13294
13317
  });
13318
+ Object.defineProperty(exports, 'getAuthClientOptions', {
13319
+ enumerable: true,
13320
+ get: function () {
13321
+ return getAuthClientOptions;
13322
+ }
13323
+ });
13295
13324
  Object.defineProperty(exports, 'getMigrations', {
13296
13325
  enumerable: true,
13297
13326
  get: function () {