@llmops/app 0.2.1 → 0.2.3-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/index.cjs CHANGED
@@ -11275,7 +11275,7 @@ function initializeContext(params) {
11275
11275
  external: params?.external ?? void 0
11276
11276
  };
11277
11277
  }
11278
- function process(schema, ctx, _params = {
11278
+ function process$1(schema, ctx, _params = {
11279
11279
  path: [],
11280
11280
  schemaPath: []
11281
11281
  }) {
@@ -11312,7 +11312,7 @@ function process(schema, ctx, _params = {
11312
11312
  const parent = schema._zod.parent;
11313
11313
  if (parent) {
11314
11314
  if (!result.ref) result.ref = parent;
11315
- process(parent, ctx, params);
11315
+ process$1(parent, ctx, params);
11316
11316
  ctx.seen.get(parent).isParent = true;
11317
11317
  }
11318
11318
  }
@@ -11524,7 +11524,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
11524
11524
  ...params,
11525
11525
  processors
11526
11526
  });
11527
- process(schema, ctx);
11527
+ process$1(schema, ctx);
11528
11528
  extractDefs(ctx, schema);
11529
11529
  return finalize(ctx, schema);
11530
11530
  };
@@ -11536,7 +11536,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
11536
11536
  io,
11537
11537
  processors
11538
11538
  });
11539
- process(schema, ctx);
11539
+ process$1(schema, ctx);
11540
11540
  extractDefs(ctx, schema);
11541
11541
  return finalize(ctx, schema);
11542
11542
  };
@@ -11708,7 +11708,7 @@ const arrayProcessor = (schema, ctx, _json, params) => {
11708
11708
  if (typeof minimum === "number") json$1.minItems = minimum;
11709
11709
  if (typeof maximum === "number") json$1.maxItems = maximum;
11710
11710
  json$1.type = "array";
11711
- json$1.items = process(def.element, ctx, {
11711
+ json$1.items = process$1(def.element, ctx, {
11712
11712
  ...params,
11713
11713
  path: [...params.path, "items"]
11714
11714
  });
@@ -11719,7 +11719,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
11719
11719
  json$1.type = "object";
11720
11720
  json$1.properties = {};
11721
11721
  const shape = def.shape;
11722
- for (const key in shape) json$1.properties[key] = process(shape[key], ctx, {
11722
+ for (const key in shape) json$1.properties[key] = process$1(shape[key], ctx, {
11723
11723
  ...params,
11724
11724
  path: [
11725
11725
  ...params.path,
@@ -11737,7 +11737,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
11737
11737
  if (def.catchall?._zod.def.type === "never") json$1.additionalProperties = false;
11738
11738
  else if (!def.catchall) {
11739
11739
  if (ctx.io === "output") json$1.additionalProperties = false;
11740
- } else if (def.catchall) json$1.additionalProperties = process(def.catchall, ctx, {
11740
+ } else if (def.catchall) json$1.additionalProperties = process$1(def.catchall, ctx, {
11741
11741
  ...params,
11742
11742
  path: [...params.path, "additionalProperties"]
11743
11743
  });
@@ -11745,7 +11745,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
11745
11745
  const unionProcessor = (schema, ctx, json$1, params) => {
11746
11746
  const def = schema._zod.def;
11747
11747
  const isExclusive = def.inclusive === false;
11748
- const options = def.options.map((x, i) => process(x, ctx, {
11748
+ const options = def.options.map((x, i) => process$1(x, ctx, {
11749
11749
  ...params,
11750
11750
  path: [
11751
11751
  ...params.path,
@@ -11758,7 +11758,7 @@ const unionProcessor = (schema, ctx, json$1, params) => {
11758
11758
  };
11759
11759
  const intersectionProcessor = (schema, ctx, json$1, params) => {
11760
11760
  const def = schema._zod.def;
11761
- const a = process(def.left, ctx, {
11761
+ const a = process$1(def.left, ctx, {
11762
11762
  ...params,
11763
11763
  path: [
11764
11764
  ...params.path,
@@ -11766,7 +11766,7 @@ const intersectionProcessor = (schema, ctx, json$1, params) => {
11766
11766
  0
11767
11767
  ]
11768
11768
  });
11769
- const b = process(def.right, ctx, {
11769
+ const b = process$1(def.right, ctx, {
11770
11770
  ...params,
11771
11771
  path: [
11772
11772
  ...params.path,
@@ -11783,7 +11783,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
11783
11783
  json$1.type = "array";
11784
11784
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
11785
11785
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
11786
- const prefixItems = def.items.map((x, i) => process(x, ctx, {
11786
+ const prefixItems = def.items.map((x, i) => process$1(x, ctx, {
11787
11787
  ...params,
11788
11788
  path: [
11789
11789
  ...params.path,
@@ -11791,7 +11791,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
11791
11791
  i
11792
11792
  ]
11793
11793
  }));
11794
- const rest = def.rest ? process(def.rest, ctx, {
11794
+ const rest = def.rest ? process$1(def.rest, ctx, {
11795
11795
  ...params,
11796
11796
  path: [
11797
11797
  ...params.path,
@@ -11822,7 +11822,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
11822
11822
  const keyType = def.keyType;
11823
11823
  const patterns = keyType._zod.bag?.patterns;
11824
11824
  if (def.mode === "loose" && patterns && patterns.size > 0) {
11825
- const valueSchema = process(def.valueType, ctx, {
11825
+ const valueSchema = process$1(def.valueType, ctx, {
11826
11826
  ...params,
11827
11827
  path: [
11828
11828
  ...params.path,
@@ -11833,11 +11833,11 @@ const recordProcessor = (schema, ctx, _json, params) => {
11833
11833
  json$1.patternProperties = {};
11834
11834
  for (const pattern of patterns) json$1.patternProperties[pattern.source] = valueSchema;
11835
11835
  } else {
11836
- if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json$1.propertyNames = process(def.keyType, ctx, {
11836
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json$1.propertyNames = process$1(def.keyType, ctx, {
11837
11837
  ...params,
11838
11838
  path: [...params.path, "propertyNames"]
11839
11839
  });
11840
- json$1.additionalProperties = process(def.valueType, ctx, {
11840
+ json$1.additionalProperties = process$1(def.valueType, ctx, {
11841
11841
  ...params,
11842
11842
  path: [...params.path, "additionalProperties"]
11843
11843
  });
@@ -11850,7 +11850,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
11850
11850
  };
11851
11851
  const nullableProcessor = (schema, ctx, json$1, params) => {
11852
11852
  const def = schema._zod.def;
11853
- const inner = process(def.innerType, ctx, params);
11853
+ const inner = process$1(def.innerType, ctx, params);
11854
11854
  const seen = ctx.seen.get(schema);
11855
11855
  if (ctx.target === "openapi-3.0") {
11856
11856
  seen.ref = def.innerType;
@@ -11859,27 +11859,27 @@ const nullableProcessor = (schema, ctx, json$1, params) => {
11859
11859
  };
11860
11860
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
11861
11861
  const def = schema._zod.def;
11862
- process(def.innerType, ctx, params);
11862
+ process$1(def.innerType, ctx, params);
11863
11863
  const seen = ctx.seen.get(schema);
11864
11864
  seen.ref = def.innerType;
11865
11865
  };
11866
11866
  const defaultProcessor = (schema, ctx, json$1, params) => {
11867
11867
  const def = schema._zod.def;
11868
- process(def.innerType, ctx, params);
11868
+ process$1(def.innerType, ctx, params);
11869
11869
  const seen = ctx.seen.get(schema);
11870
11870
  seen.ref = def.innerType;
11871
11871
  json$1.default = JSON.parse(JSON.stringify(def.defaultValue));
11872
11872
  };
11873
11873
  const prefaultProcessor = (schema, ctx, json$1, params) => {
11874
11874
  const def = schema._zod.def;
11875
- process(def.innerType, ctx, params);
11875
+ process$1(def.innerType, ctx, params);
11876
11876
  const seen = ctx.seen.get(schema);
11877
11877
  seen.ref = def.innerType;
11878
11878
  if (ctx.io === "input") json$1._prefault = JSON.parse(JSON.stringify(def.defaultValue));
11879
11879
  };
11880
11880
  const catchProcessor = (schema, ctx, json$1, params) => {
11881
11881
  const def = schema._zod.def;
11882
- process(def.innerType, ctx, params);
11882
+ process$1(def.innerType, ctx, params);
11883
11883
  const seen = ctx.seen.get(schema);
11884
11884
  seen.ref = def.innerType;
11885
11885
  let catchValue;
@@ -11893,32 +11893,32 @@ const catchProcessor = (schema, ctx, json$1, params) => {
11893
11893
  const pipeProcessor = (schema, ctx, _json, params) => {
11894
11894
  const def = schema._zod.def;
11895
11895
  const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
11896
- process(innerType, ctx, params);
11896
+ process$1(innerType, ctx, params);
11897
11897
  const seen = ctx.seen.get(schema);
11898
11898
  seen.ref = innerType;
11899
11899
  };
11900
11900
  const readonlyProcessor = (schema, ctx, json$1, params) => {
11901
11901
  const def = schema._zod.def;
11902
- process(def.innerType, ctx, params);
11902
+ process$1(def.innerType, ctx, params);
11903
11903
  const seen = ctx.seen.get(schema);
11904
11904
  seen.ref = def.innerType;
11905
11905
  json$1.readOnly = true;
11906
11906
  };
11907
11907
  const promiseProcessor = (schema, ctx, _json, params) => {
11908
11908
  const def = schema._zod.def;
11909
- process(def.innerType, ctx, params);
11909
+ process$1(def.innerType, ctx, params);
11910
11910
  const seen = ctx.seen.get(schema);
11911
11911
  seen.ref = def.innerType;
11912
11912
  };
11913
11913
  const optionalProcessor = (schema, ctx, _json, params) => {
11914
11914
  const def = schema._zod.def;
11915
- process(def.innerType, ctx, params);
11915
+ process$1(def.innerType, ctx, params);
11916
11916
  const seen = ctx.seen.get(schema);
11917
11917
  seen.ref = def.innerType;
11918
11918
  };
11919
11919
  const lazyProcessor = (schema, ctx, _json, params) => {
11920
11920
  const innerType = schema._zod.innerType;
11921
- process(innerType, ctx, params);
11921
+ process$1(innerType, ctx, params);
11922
11922
  const seen = ctx.seen.get(schema);
11923
11923
  seen.ref = innerType;
11924
11924
  };
@@ -11973,7 +11973,7 @@ function toJSONSchema(input, params) {
11973
11973
  const defs = {};
11974
11974
  for (const entry of registry$1._idmap.entries()) {
11975
11975
  const [_, schema] = entry;
11976
- process(schema, ctx$1);
11976
+ process$1(schema, ctx$1);
11977
11977
  }
11978
11978
  const schemas = {};
11979
11979
  ctx$1.external = {
@@ -11993,7 +11993,7 @@ function toJSONSchema(input, params) {
11993
11993
  ...params,
11994
11994
  processors: allProcessors
11995
11995
  });
11996
- process(input, ctx);
11996
+ process$1(input, ctx);
11997
11997
  extractDefs(ctx, input);
11998
11998
  return finalize(ctx, input);
11999
11999
  }
@@ -12070,7 +12070,7 @@ var JSONSchemaGenerator = class {
12070
12070
  path: [],
12071
12071
  schemaPath: []
12072
12072
  }) {
12073
- return process(schema, this.ctx, _params);
12073
+ return process$1(schema, this.ctx, _params);
12074
12074
  }
12075
12075
  /**
12076
12076
  * Emit the final JSON Schema after processing.
@@ -12354,7 +12354,7 @@ var core_exports = /* @__PURE__ */ __export({
12354
12354
  parse: () => parse$1,
12355
12355
  parseAsync: () => parseAsync$1,
12356
12356
  prettifyError: () => prettifyError,
12357
- process: () => process,
12357
+ process: () => process$1,
12358
12358
  regexes: () => regexes_exports,
12359
12359
  registry: () => registry,
12360
12360
  safeDecode: () => safeDecode$1,
@@ -16325,17 +16325,34 @@ const createMigrationMiddleware = (config$1) => {
16325
16325
  * Creates auth client middleware that uses the pre-configured Kysely instance
16326
16326
  * from context. This ensures Better Auth uses the same database connection
16327
16327
  * with the correct schema (search_path) configuration.
16328
+ *
16329
+ * Only initializes the auth client for /api/* routes where it's actually needed.
16330
+ *
16331
+ * Origin validation:
16332
+ * - Local dev: Works automatically via baseURL derived from request
16333
+ * - Production: Set AUTH_TRUSTED_ORIGINS env var (comma-separated)
16334
+ * e.g., AUTH_TRUSTED_ORIGINS=https://myapp.railway.app,https://myapp.com
16328
16335
  */
16329
16336
  const createAuthClientMiddleware = () => {
16330
16337
  return async (c, next) => {
16338
+ if (!c.req.path.startsWith("/api")) {
16339
+ await next();
16340
+ return;
16341
+ }
16331
16342
  const kyselyDb = c.get("kyselyDb");
16332
16343
  const dbType = c.get("dbType");
16333
16344
  const workspaceSettings = (0, __llmops_core.createWorkspaceSettingsDataLayer)(kyselyDb);
16345
+ const url$2 = new URL(c.req.url);
16346
+ const baseURL = `${url$2.protocol}//${url$2.host}`;
16347
+ const trustedOriginsEnv = process.env.AUTH_TRUSTED_ORIGINS;
16348
+ const trustedOrigins = trustedOriginsEnv ? trustedOriginsEnv.split(",").map((origin) => origin.trim()) : [];
16334
16349
  const authClient = (0, better_auth.betterAuth)((0, __llmops_core.getAuthClientOptions)({
16335
16350
  database: {
16336
16351
  db: kyselyDb,
16337
16352
  type: dbType
16338
16353
  },
16354
+ baseURL,
16355
+ trustedOrigins,
16339
16356
  onUserCreated: async (userId) => {
16340
16357
  await workspaceSettings.setSuperAdminId(userId);
16341
16358
  await workspaceSettings.markSetupComplete();
package/dist/index.mjs CHANGED
@@ -11249,7 +11249,7 @@ function initializeContext(params) {
11249
11249
  external: params?.external ?? void 0
11250
11250
  };
11251
11251
  }
11252
- function process(schema, ctx, _params = {
11252
+ function process$1(schema, ctx, _params = {
11253
11253
  path: [],
11254
11254
  schemaPath: []
11255
11255
  }) {
@@ -11286,7 +11286,7 @@ function process(schema, ctx, _params = {
11286
11286
  const parent = schema._zod.parent;
11287
11287
  if (parent) {
11288
11288
  if (!result.ref) result.ref = parent;
11289
- process(parent, ctx, params);
11289
+ process$1(parent, ctx, params);
11290
11290
  ctx.seen.get(parent).isParent = true;
11291
11291
  }
11292
11292
  }
@@ -11498,7 +11498,7 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
11498
11498
  ...params,
11499
11499
  processors
11500
11500
  });
11501
- process(schema, ctx);
11501
+ process$1(schema, ctx);
11502
11502
  extractDefs(ctx, schema);
11503
11503
  return finalize(ctx, schema);
11504
11504
  };
@@ -11510,7 +11510,7 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
11510
11510
  io,
11511
11511
  processors
11512
11512
  });
11513
- process(schema, ctx);
11513
+ process$1(schema, ctx);
11514
11514
  extractDefs(ctx, schema);
11515
11515
  return finalize(ctx, schema);
11516
11516
  };
@@ -11682,7 +11682,7 @@ const arrayProcessor = (schema, ctx, _json, params) => {
11682
11682
  if (typeof minimum === "number") json$1.minItems = minimum;
11683
11683
  if (typeof maximum === "number") json$1.maxItems = maximum;
11684
11684
  json$1.type = "array";
11685
- json$1.items = process(def.element, ctx, {
11685
+ json$1.items = process$1(def.element, ctx, {
11686
11686
  ...params,
11687
11687
  path: [...params.path, "items"]
11688
11688
  });
@@ -11693,7 +11693,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
11693
11693
  json$1.type = "object";
11694
11694
  json$1.properties = {};
11695
11695
  const shape = def.shape;
11696
- for (const key in shape) json$1.properties[key] = process(shape[key], ctx, {
11696
+ for (const key in shape) json$1.properties[key] = process$1(shape[key], ctx, {
11697
11697
  ...params,
11698
11698
  path: [
11699
11699
  ...params.path,
@@ -11711,7 +11711,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
11711
11711
  if (def.catchall?._zod.def.type === "never") json$1.additionalProperties = false;
11712
11712
  else if (!def.catchall) {
11713
11713
  if (ctx.io === "output") json$1.additionalProperties = false;
11714
- } else if (def.catchall) json$1.additionalProperties = process(def.catchall, ctx, {
11714
+ } else if (def.catchall) json$1.additionalProperties = process$1(def.catchall, ctx, {
11715
11715
  ...params,
11716
11716
  path: [...params.path, "additionalProperties"]
11717
11717
  });
@@ -11719,7 +11719,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
11719
11719
  const unionProcessor = (schema, ctx, json$1, params) => {
11720
11720
  const def = schema._zod.def;
11721
11721
  const isExclusive = def.inclusive === false;
11722
- const options = def.options.map((x, i) => process(x, ctx, {
11722
+ const options = def.options.map((x, i) => process$1(x, ctx, {
11723
11723
  ...params,
11724
11724
  path: [
11725
11725
  ...params.path,
@@ -11732,7 +11732,7 @@ const unionProcessor = (schema, ctx, json$1, params) => {
11732
11732
  };
11733
11733
  const intersectionProcessor = (schema, ctx, json$1, params) => {
11734
11734
  const def = schema._zod.def;
11735
- const a = process(def.left, ctx, {
11735
+ const a = process$1(def.left, ctx, {
11736
11736
  ...params,
11737
11737
  path: [
11738
11738
  ...params.path,
@@ -11740,7 +11740,7 @@ const intersectionProcessor = (schema, ctx, json$1, params) => {
11740
11740
  0
11741
11741
  ]
11742
11742
  });
11743
- const b = process(def.right, ctx, {
11743
+ const b = process$1(def.right, ctx, {
11744
11744
  ...params,
11745
11745
  path: [
11746
11746
  ...params.path,
@@ -11757,7 +11757,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
11757
11757
  json$1.type = "array";
11758
11758
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
11759
11759
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
11760
- const prefixItems = def.items.map((x, i) => process(x, ctx, {
11760
+ const prefixItems = def.items.map((x, i) => process$1(x, ctx, {
11761
11761
  ...params,
11762
11762
  path: [
11763
11763
  ...params.path,
@@ -11765,7 +11765,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
11765
11765
  i
11766
11766
  ]
11767
11767
  }));
11768
- const rest = def.rest ? process(def.rest, ctx, {
11768
+ const rest = def.rest ? process$1(def.rest, ctx, {
11769
11769
  ...params,
11770
11770
  path: [
11771
11771
  ...params.path,
@@ -11796,7 +11796,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
11796
11796
  const keyType = def.keyType;
11797
11797
  const patterns = keyType._zod.bag?.patterns;
11798
11798
  if (def.mode === "loose" && patterns && patterns.size > 0) {
11799
- const valueSchema = process(def.valueType, ctx, {
11799
+ const valueSchema = process$1(def.valueType, ctx, {
11800
11800
  ...params,
11801
11801
  path: [
11802
11802
  ...params.path,
@@ -11807,11 +11807,11 @@ const recordProcessor = (schema, ctx, _json, params) => {
11807
11807
  json$1.patternProperties = {};
11808
11808
  for (const pattern of patterns) json$1.patternProperties[pattern.source] = valueSchema;
11809
11809
  } else {
11810
- if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json$1.propertyNames = process(def.keyType, ctx, {
11810
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json$1.propertyNames = process$1(def.keyType, ctx, {
11811
11811
  ...params,
11812
11812
  path: [...params.path, "propertyNames"]
11813
11813
  });
11814
- json$1.additionalProperties = process(def.valueType, ctx, {
11814
+ json$1.additionalProperties = process$1(def.valueType, ctx, {
11815
11815
  ...params,
11816
11816
  path: [...params.path, "additionalProperties"]
11817
11817
  });
@@ -11824,7 +11824,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
11824
11824
  };
11825
11825
  const nullableProcessor = (schema, ctx, json$1, params) => {
11826
11826
  const def = schema._zod.def;
11827
- const inner = process(def.innerType, ctx, params);
11827
+ const inner = process$1(def.innerType, ctx, params);
11828
11828
  const seen = ctx.seen.get(schema);
11829
11829
  if (ctx.target === "openapi-3.0") {
11830
11830
  seen.ref = def.innerType;
@@ -11833,27 +11833,27 @@ const nullableProcessor = (schema, ctx, json$1, params) => {
11833
11833
  };
11834
11834
  const nonoptionalProcessor = (schema, ctx, _json, params) => {
11835
11835
  const def = schema._zod.def;
11836
- process(def.innerType, ctx, params);
11836
+ process$1(def.innerType, ctx, params);
11837
11837
  const seen = ctx.seen.get(schema);
11838
11838
  seen.ref = def.innerType;
11839
11839
  };
11840
11840
  const defaultProcessor = (schema, ctx, json$1, params) => {
11841
11841
  const def = schema._zod.def;
11842
- process(def.innerType, ctx, params);
11842
+ process$1(def.innerType, ctx, params);
11843
11843
  const seen = ctx.seen.get(schema);
11844
11844
  seen.ref = def.innerType;
11845
11845
  json$1.default = JSON.parse(JSON.stringify(def.defaultValue));
11846
11846
  };
11847
11847
  const prefaultProcessor = (schema, ctx, json$1, params) => {
11848
11848
  const def = schema._zod.def;
11849
- process(def.innerType, ctx, params);
11849
+ process$1(def.innerType, ctx, params);
11850
11850
  const seen = ctx.seen.get(schema);
11851
11851
  seen.ref = def.innerType;
11852
11852
  if (ctx.io === "input") json$1._prefault = JSON.parse(JSON.stringify(def.defaultValue));
11853
11853
  };
11854
11854
  const catchProcessor = (schema, ctx, json$1, params) => {
11855
11855
  const def = schema._zod.def;
11856
- process(def.innerType, ctx, params);
11856
+ process$1(def.innerType, ctx, params);
11857
11857
  const seen = ctx.seen.get(schema);
11858
11858
  seen.ref = def.innerType;
11859
11859
  let catchValue;
@@ -11867,32 +11867,32 @@ const catchProcessor = (schema, ctx, json$1, params) => {
11867
11867
  const pipeProcessor = (schema, ctx, _json, params) => {
11868
11868
  const def = schema._zod.def;
11869
11869
  const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
11870
- process(innerType, ctx, params);
11870
+ process$1(innerType, ctx, params);
11871
11871
  const seen = ctx.seen.get(schema);
11872
11872
  seen.ref = innerType;
11873
11873
  };
11874
11874
  const readonlyProcessor = (schema, ctx, json$1, params) => {
11875
11875
  const def = schema._zod.def;
11876
- process(def.innerType, ctx, params);
11876
+ process$1(def.innerType, ctx, params);
11877
11877
  const seen = ctx.seen.get(schema);
11878
11878
  seen.ref = def.innerType;
11879
11879
  json$1.readOnly = true;
11880
11880
  };
11881
11881
  const promiseProcessor = (schema, ctx, _json, params) => {
11882
11882
  const def = schema._zod.def;
11883
- process(def.innerType, ctx, params);
11883
+ process$1(def.innerType, ctx, params);
11884
11884
  const seen = ctx.seen.get(schema);
11885
11885
  seen.ref = def.innerType;
11886
11886
  };
11887
11887
  const optionalProcessor = (schema, ctx, _json, params) => {
11888
11888
  const def = schema._zod.def;
11889
- process(def.innerType, ctx, params);
11889
+ process$1(def.innerType, ctx, params);
11890
11890
  const seen = ctx.seen.get(schema);
11891
11891
  seen.ref = def.innerType;
11892
11892
  };
11893
11893
  const lazyProcessor = (schema, ctx, _json, params) => {
11894
11894
  const innerType = schema._zod.innerType;
11895
- process(innerType, ctx, params);
11895
+ process$1(innerType, ctx, params);
11896
11896
  const seen = ctx.seen.get(schema);
11897
11897
  seen.ref = innerType;
11898
11898
  };
@@ -11947,7 +11947,7 @@ function toJSONSchema(input, params) {
11947
11947
  const defs = {};
11948
11948
  for (const entry of registry$1._idmap.entries()) {
11949
11949
  const [_, schema] = entry;
11950
- process(schema, ctx$1);
11950
+ process$1(schema, ctx$1);
11951
11951
  }
11952
11952
  const schemas = {};
11953
11953
  ctx$1.external = {
@@ -11967,7 +11967,7 @@ function toJSONSchema(input, params) {
11967
11967
  ...params,
11968
11968
  processors: allProcessors
11969
11969
  });
11970
- process(input, ctx);
11970
+ process$1(input, ctx);
11971
11971
  extractDefs(ctx, input);
11972
11972
  return finalize(ctx, input);
11973
11973
  }
@@ -12044,7 +12044,7 @@ var JSONSchemaGenerator = class {
12044
12044
  path: [],
12045
12045
  schemaPath: []
12046
12046
  }) {
12047
- return process(schema, this.ctx, _params);
12047
+ return process$1(schema, this.ctx, _params);
12048
12048
  }
12049
12049
  /**
12050
12050
  * Emit the final JSON Schema after processing.
@@ -12328,7 +12328,7 @@ var core_exports = /* @__PURE__ */ __export({
12328
12328
  parse: () => parse$1,
12329
12329
  parseAsync: () => parseAsync$1,
12330
12330
  prettifyError: () => prettifyError,
12331
- process: () => process,
12331
+ process: () => process$1,
12332
12332
  regexes: () => regexes_exports,
12333
12333
  registry: () => registry,
12334
12334
  safeDecode: () => safeDecode$1,
@@ -16299,17 +16299,34 @@ const createMigrationMiddleware = (config$1) => {
16299
16299
  * Creates auth client middleware that uses the pre-configured Kysely instance
16300
16300
  * from context. This ensures Better Auth uses the same database connection
16301
16301
  * with the correct schema (search_path) configuration.
16302
+ *
16303
+ * Only initializes the auth client for /api/* routes where it's actually needed.
16304
+ *
16305
+ * Origin validation:
16306
+ * - Local dev: Works automatically via baseURL derived from request
16307
+ * - Production: Set AUTH_TRUSTED_ORIGINS env var (comma-separated)
16308
+ * e.g., AUTH_TRUSTED_ORIGINS=https://myapp.railway.app,https://myapp.com
16302
16309
  */
16303
16310
  const createAuthClientMiddleware = () => {
16304
16311
  return async (c, next) => {
16312
+ if (!c.req.path.startsWith("/api")) {
16313
+ await next();
16314
+ return;
16315
+ }
16305
16316
  const kyselyDb = c.get("kyselyDb");
16306
16317
  const dbType = c.get("dbType");
16307
16318
  const workspaceSettings = createWorkspaceSettingsDataLayer(kyselyDb);
16319
+ const url$1 = new URL(c.req.url);
16320
+ const baseURL = `${url$1.protocol}//${url$1.host}`;
16321
+ const trustedOriginsEnv = process.env.AUTH_TRUSTED_ORIGINS;
16322
+ const trustedOrigins = trustedOriginsEnv ? trustedOriginsEnv.split(",").map((origin) => origin.trim()) : [];
16308
16323
  const authClient = betterAuth(getAuthClientOptions({
16309
16324
  database: {
16310
16325
  db: kyselyDb,
16311
16326
  type: dbType
16312
16327
  },
16328
+ baseURL,
16329
+ trustedOrigins,
16313
16330
  onUserCreated: async (userId) => {
16314
16331
  await workspaceSettings.setSuperAdminId(userId);
16315
16332
  await workspaceSettings.markSetupComplete();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/app",
3
- "version": "0.2.1",
3
+ "version": "0.2.3-beta.1",
4
4
  "description": "LLMOps application with server and client",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -66,8 +66,8 @@
66
66
  "react-aria-components": "^1.13.0",
67
67
  "react-hook-form": "^7.68.0",
68
68
  "recharts": "^3.6.0",
69
- "@llmops/core": "^0.2.1",
70
- "@llmops/gateway": "^0.2.1"
69
+ "@llmops/gateway": "^0.2.3-beta.1",
70
+ "@llmops/core": "^0.2.3-beta.1"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "react": "^19.2.1",