@llmops/core 0.1.9-beta.1 → 0.1.9-beta.3

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-CpVh76Wq.cjs');
1
+ const require_db = require('./db-1Ar4ItM_.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-CpVh76Wq.cjs');
1
+ const require_db = require('../db-1Ar4ItM_.cjs');
2
2
 
3
3
  exports.SCHEMA_METADATA = require_db.SCHEMA_METADATA;
4
4
  exports.configVariantsSchema = require_db.configVariantsSchema;
package/dist/db/index.mjs CHANGED
@@ -1,3 +1,3 @@
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";
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-BokBhuLo.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 };
@@ -12868,14 +12868,16 @@ const logger = (0, pino.default)();
12868
12868
  /**
12869
12869
  * Get Better Auth client options
12870
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
12871
+ * @param options - Auth client options including database config and hooks
12874
12872
  */
12875
- const getAuthClientOptions = (database) => {
12873
+ const getAuthClientOptions = (options) => {
12874
+ const { database, onUserCreated } = options;
12876
12875
  return {
12877
12876
  database,
12878
- emailAndPassword: { enabled: true }
12877
+ emailAndPassword: { enabled: true },
12878
+ databaseHooks: onUserCreated ? { user: { create: { after: async (user) => {
12879
+ await onUserCreated(user.id);
12880
+ } } } } : void 0
12879
12881
  };
12880
12882
  };
12881
12883
 
@@ -13118,7 +13120,7 @@ async function getMigrations(db, dbType, options) {
13118
13120
  });
13119
13121
  migrations.push(builder);
13120
13122
  }
13121
- const { toBeAdded: authChangesToBeAdded, toBeCreated: authChangesToBeCreated, runMigrations: runAuthMigrations } = await (0, better_auth_db.getMigrations)(getAuthClientOptions(options?.rawConnection));
13123
+ const { toBeAdded: authChangesToBeAdded, toBeCreated: authChangesToBeCreated, runMigrations: runAuthMigrations } = await (0, better_auth_db.getMigrations)(getAuthClientOptions({ database: options?.rawConnection }));
13122
13124
  async function runMigrations() {
13123
13125
  for (const migration of migrations) await migration.execute();
13124
13126
  await runAuthMigrations();
@@ -13208,12 +13210,12 @@ async function createDatabaseFromConnection(rawConnection, options) {
13208
13210
  case "sqlite":
13209
13211
  if ("aggregate" in rawConnection && !("createSession" in rawConnection)) dialect = new kysely.SqliteDialect({ database: rawConnection });
13210
13212
  else if ("fileControl" in rawConnection) {
13211
- const { BunSqliteDialect } = await Promise.resolve().then(() => require("./bun-sqlite-dialect-Kl6MiKeQ.cjs"));
13213
+ const { BunSqliteDialect } = await Promise.resolve().then(() => require("./bun-sqlite-dialect-BsBCR8hT.cjs"));
13212
13214
  dialect = new BunSqliteDialect({ database: rawConnection });
13213
13215
  } else if ("createSession" in rawConnection && typeof window === "undefined") try {
13214
13216
  const { DatabaseSync } = await import("node:sqlite");
13215
13217
  if (rawConnection instanceof DatabaseSync) {
13216
- const { NodeSqliteDialect } = await Promise.resolve().then(() => require("./node-sqlite-dialect-BkZpAjVL.cjs"));
13218
+ const { NodeSqliteDialect } = await Promise.resolve().then(() => require("./node-sqlite-dialect-BnUFpWfa.cjs"));
13217
13219
  dialect = new NodeSqliteDialect({ database: rawConnection });
13218
13220
  }
13219
13221
  } catch {}
@@ -12844,14 +12844,16 @@ const logger = pino();
12844
12844
  /**
12845
12845
  * Get Better Auth client options
12846
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
12847
+ * @param options - Auth client options including database config and hooks
12850
12848
  */
12851
- const getAuthClientOptions = (database) => {
12849
+ const getAuthClientOptions = (options) => {
12850
+ const { database, onUserCreated } = options;
12852
12851
  return {
12853
12852
  database,
12854
- emailAndPassword: { enabled: true }
12853
+ emailAndPassword: { enabled: true },
12854
+ databaseHooks: onUserCreated ? { user: { create: { after: async (user) => {
12855
+ await onUserCreated(user.id);
12856
+ } } } } : void 0
12855
12857
  };
12856
12858
  };
12857
12859
 
@@ -13094,7 +13096,7 @@ async function getMigrations$1(db, dbType, options) {
13094
13096
  });
13095
13097
  migrations.push(builder);
13096
13098
  }
13097
- const { toBeAdded: authChangesToBeAdded, toBeCreated: authChangesToBeCreated, runMigrations: runAuthMigrations } = await getMigrations(getAuthClientOptions(options?.rawConnection));
13099
+ const { toBeAdded: authChangesToBeAdded, toBeCreated: authChangesToBeCreated, runMigrations: runAuthMigrations } = await getMigrations(getAuthClientOptions({ database: options?.rawConnection }));
13098
13100
  async function runMigrations() {
13099
13101
  for (const migration of migrations) await migration.execute();
13100
13102
  await runAuthMigrations();
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_db = require('./db-CpVh76Wq.cjs');
1
+ const require_db = require('./db-1Ar4ItM_.cjs');
2
2
  let __llmops_gateway = require("@llmops/gateway");
3
3
  __llmops_gateway = require_db.__toESM(__llmops_gateway);
4
4
  let kysely = require("kysely");
@@ -444,18 +444,8 @@ const providerEntries = Object.values(SupportedProviders).map((provider) => [pro
444
444
  * All providers are optional, but at least one must be configured
445
445
  */
446
446
  const providersSchema = require_db.object(Object.fromEntries(providerEntries)).refine((providers) => Object.values(providers).some((v) => v !== void 0 && v !== null), "At least one provider must be configured");
447
- /**
448
- * Auth configuration schema
449
- *
450
- * Uses a flexible schema with passthrough to allow different auth providers.
451
- * - Open source: basicAuth() from @llmops/sdk (type: 'basic')
452
- *
453
- * The actual auth handling is done by the auth middleware based on the type.
454
- */
455
- const authSchema = require_db.object({ type: require_db.string().min(1, "Auth type is required") }).passthrough();
456
447
  const llmopsConfigSchema = require_db.object({
457
448
  database: require_db.any(),
458
- auth: authSchema,
459
449
  basePath: require_db.string().min(1, "Base path is required and cannot be empty").refine((path) => path.startsWith("/"), "Base path must start with a forward slash"),
460
450
  providers: providersSchema,
461
451
  schema: require_db.string().optional().default("llmops")
@@ -2497,6 +2487,7 @@ exports.createDataLayer = createDataLayer;
2497
2487
  exports.createDatabase = require_db.createDatabase;
2498
2488
  exports.createDatabaseFromConnection = require_db.createDatabaseFromConnection;
2499
2489
  exports.createLLMRequestsDataLayer = createLLMRequestsDataLayer;
2490
+ exports.createWorkspaceSettingsDataLayer = createWorkspaceSettingsDataLayer;
2500
2491
  exports.detectDatabaseType = require_db.detectDatabaseType;
2501
2492
  exports.dollarsToMicroDollars = dollarsToMicroDollars;
2502
2493
  exports.environmentSecretsSchema = require_db.environmentSecretsSchema;
package/dist/index.d.cts CHANGED
@@ -386,9 +386,6 @@ type ProvidersConfig = { [K in SupportedProviders]?: ProviderConfigMap[K] };
386
386
  //#region src/schemas/config.d.ts
387
387
  declare const llmopsConfigSchema: z.ZodObject<{
388
388
  database: z.ZodAny;
389
- auth: z.ZodObject<{
390
- type: z.ZodString;
391
- }, z.core.$loose>;
392
389
  basePath: z.ZodString;
393
390
  providers: z.ZodObject<{
394
391
  openai: z.ZodOptional<z.ZodObject<{
@@ -820,32 +817,15 @@ declare const llmopsConfigSchema: z.ZodObject<{
820
817
  }, z.core.$strip>;
821
818
  schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
822
819
  }, z.core.$strip>;
823
- /**
824
- * Base auth configuration interface
825
- * All auth providers must have at least a type field
826
- */
827
- interface AuthConfig {
828
- readonly type: string;
829
- [key: string]: unknown;
830
- }
831
- /**
832
- * Basic auth configuration (open source)
833
- */
834
- interface BasicAuthConfig extends AuthConfig {
835
- readonly type: 'basic';
836
- readonly defaultUser: string;
837
- readonly defaultPassword: string;
838
- }
839
820
  /**
840
821
  * Validated LLMOps configuration with typed providers
841
822
  * Uses ProvidersConfig for proper provider-specific typing
842
823
  *
843
824
  * Note: schema is optional in input but always present after validation
844
825
  */
845
- type ValidatedLLMOpsConfig = Omit<z.infer<typeof llmopsConfigSchema>, 'providers' | 'schema' | 'auth'> & {
826
+ type ValidatedLLMOpsConfig = Omit<z.infer<typeof llmopsConfigSchema>, 'providers' | 'schema'> & {
846
827
  providers: ProvidersConfig;
847
828
  schema: string;
848
- auth: AuthConfig;
849
829
  };
850
830
  /**
851
831
  * Input type for LLMOps configuration (before validation)
@@ -1758,6 +1738,60 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1758
1738
  }[]>;
1759
1739
  };
1760
1740
  //#endregion
1741
+ //#region src/datalayer/workspaceSettings.d.ts
1742
+ declare const updateWorkspaceSettings: z$1.ZodObject<{
1743
+ name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1744
+ setupComplete: z$1.ZodOptional<z$1.ZodBoolean>;
1745
+ superAdminId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1746
+ }, z$1.core.$strip>;
1747
+ declare const createWorkspaceSettingsDataLayer: (db: Kysely<Database>) => {
1748
+ /**
1749
+ * Get workspace settings (creates default if not exists)
1750
+ */
1751
+ getWorkspaceSettings: () => Promise<{
1752
+ name: string | null;
1753
+ id: string;
1754
+ setupComplete: boolean;
1755
+ superAdminId: string | null;
1756
+ createdAt: Date;
1757
+ updatedAt: Date;
1758
+ } | undefined>;
1759
+ /**
1760
+ * Update workspace settings
1761
+ */
1762
+ updateWorkspaceSettings: (params: z$1.infer<typeof updateWorkspaceSettings>) => Promise<{
1763
+ name: string | null;
1764
+ id: string;
1765
+ setupComplete: boolean;
1766
+ superAdminId: string | null;
1767
+ createdAt: Date;
1768
+ updatedAt: Date;
1769
+ } | undefined>;
1770
+ /**
1771
+ * Get the super admin user ID
1772
+ */
1773
+ getSuperAdminId: () => Promise<string | null>;
1774
+ /**
1775
+ * Set the super admin user ID (only if not already set)
1776
+ */
1777
+ setSuperAdminId: (userId: string) => Promise<boolean>;
1778
+ /**
1779
+ * Check if initial setup has been completed
1780
+ */
1781
+ isSetupComplete: () => Promise<boolean>;
1782
+ /**
1783
+ * Mark initial setup as complete
1784
+ */
1785
+ markSetupComplete: () => Promise<{
1786
+ name: string | null;
1787
+ id: string;
1788
+ setupComplete: boolean;
1789
+ superAdminId: string | null;
1790
+ createdAt: Date;
1791
+ updatedAt: Date;
1792
+ } | undefined>;
1793
+ };
1794
+ //#endregion
1761
1795
  //#region src/datalayer/index.d.ts
1762
1796
  declare const createDataLayer: (db: Kysely<Database>) => Promise<{
1763
1797
  getWorkspaceSettings: () => Promise<{
@@ -2970,13 +3004,20 @@ interface AuthClientDatabaseConfig {
2970
3004
  /** Database type */
2971
3005
  type: DatabaseType;
2972
3006
  }
3007
+ interface AuthClientOptions {
3008
+ /** Database configuration */
3009
+ database: any | AuthClientDatabaseConfig;
3010
+ /**
3011
+ * Callback fired after a user is created (signs up) successfully.
3012
+ * Use this to set up workspace settings like superAdminId.
3013
+ */
3014
+ onUserCreated?: (userId: string) => Promise<void>;
3015
+ }
2973
3016
  /**
2974
3017
  * Get Better Auth client options
2975
3018
  *
2976
- * @param database - Either a raw database connection or a pre-configured Kysely instance
2977
- * When using PostgreSQL with custom schema, pass { db, type } to ensure
2978
- * Better Auth uses the correctly configured Kysely instance
3019
+ * @param options - Auth client options including database config and hooks
2979
3020
  */
2980
- declare const getAuthClientOptions: (database: any | AuthClientDatabaseConfig) => BetterAuthOptions;
3021
+ declare const getAuthClientOptions: (options: AuthClientOptions) => BetterAuthOptions;
2981
3022
  //#endregion
2982
- export { type AnthropicProviderConfig, type AnyProviderConfig, AuthClientDatabaseConfig, type AuthConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BasicAuthConfig, type BedrockProviderConfig, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, Config, ConfigVariant, ConfigVariantsTable, ConfigsTable, type CortexProviderConfig, CostResult, Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, EnvironmentSecretsTable, EnvironmentsTable, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, Insertable, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, LLMRequest, type LLMRequestInsert, LLMRequestsTable, MS, MemoryCacheBackend, MemoryCacheConfig, MigrationOptions, MigrationResult, type MistralAIProviderConfig, ModelPricing, ModelsDevPricingProvider, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, PricingProvider, type ProviderConfigMap, type ProvidersConfig, SCHEMA_METADATA, type SagemakerProviderConfig, Selectable, type StabilityAIProviderConfig, SupportedProviders, TableName, TargetingRule, TargetingRulesTable, Updateable, UsageData, type ValidatedLLMOpsConfig, Variant, VariantJsonData, VariantVersion, VariantVersionsTable, VariantsTable, type VertexAIProviderConfig, type WorkersAIProviderConfig, WorkspaceSettings, WorkspaceSettingsTable, 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 };
3023
+ export { type AnthropicProviderConfig, type AnyProviderConfig, AuthClientDatabaseConfig, AuthClientOptions, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BedrockProviderConfig, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, Config, ConfigVariant, ConfigVariantsTable, ConfigsTable, type CortexProviderConfig, CostResult, Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, EnvironmentSecretsTable, EnvironmentsTable, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, Insertable, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, LLMRequest, type LLMRequestInsert, LLMRequestsTable, MS, MemoryCacheBackend, MemoryCacheConfig, MigrationOptions, MigrationResult, type MistralAIProviderConfig, ModelPricing, ModelsDevPricingProvider, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, PricingProvider, type ProviderConfigMap, type ProvidersConfig, SCHEMA_METADATA, type SagemakerProviderConfig, Selectable, type StabilityAIProviderConfig, SupportedProviders, TableName, TargetingRule, TargetingRulesTable, Updateable, UsageData, type ValidatedLLMOpsConfig, Variant, VariantJsonData, VariantVersion, VariantVersionsTable, VariantsTable, type VertexAIProviderConfig, type WorkersAIProviderConfig, WorkspaceSettings, WorkspaceSettingsTable, calculateCost, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, createLLMRequestsDataLayer, createWorkspaceSettingsDataLayer, 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/dist/index.d.mts CHANGED
@@ -386,9 +386,6 @@ type ProvidersConfig = { [K in SupportedProviders]?: ProviderConfigMap[K] };
386
386
  //#region src/schemas/config.d.ts
387
387
  declare const llmopsConfigSchema: z.ZodObject<{
388
388
  database: z.ZodAny;
389
- auth: z.ZodObject<{
390
- type: z.ZodString;
391
- }, z.core.$loose>;
392
389
  basePath: z.ZodString;
393
390
  providers: z.ZodObject<{
394
391
  openai: z.ZodOptional<z.ZodObject<{
@@ -820,32 +817,15 @@ declare const llmopsConfigSchema: z.ZodObject<{
820
817
  }, z.core.$strip>;
821
818
  schema: z.ZodDefault<z.ZodOptional<z.ZodString>>;
822
819
  }, z.core.$strip>;
823
- /**
824
- * Base auth configuration interface
825
- * All auth providers must have at least a type field
826
- */
827
- interface AuthConfig {
828
- readonly type: string;
829
- [key: string]: unknown;
830
- }
831
- /**
832
- * Basic auth configuration (open source)
833
- */
834
- interface BasicAuthConfig extends AuthConfig {
835
- readonly type: 'basic';
836
- readonly defaultUser: string;
837
- readonly defaultPassword: string;
838
- }
839
820
  /**
840
821
  * Validated LLMOps configuration with typed providers
841
822
  * Uses ProvidersConfig for proper provider-specific typing
842
823
  *
843
824
  * Note: schema is optional in input but always present after validation
844
825
  */
845
- type ValidatedLLMOpsConfig = Omit<z.infer<typeof llmopsConfigSchema>, 'providers' | 'schema' | 'auth'> & {
826
+ type ValidatedLLMOpsConfig = Omit<z.infer<typeof llmopsConfigSchema>, 'providers' | 'schema'> & {
846
827
  providers: ProvidersConfig;
847
828
  schema: string;
848
- auth: AuthConfig;
849
829
  };
850
830
  /**
851
831
  * Input type for LLMOps configuration (before validation)
@@ -1758,6 +1738,60 @@ declare const createLLMRequestsDataLayer: (db: Kysely<Database>) => {
1758
1738
  }[]>;
1759
1739
  };
1760
1740
  //#endregion
1741
+ //#region src/datalayer/workspaceSettings.d.ts
1742
+ declare const updateWorkspaceSettings: z$1.ZodObject<{
1743
+ name: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1744
+ setupComplete: z$1.ZodOptional<z$1.ZodBoolean>;
1745
+ superAdminId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
1746
+ }, z$1.core.$strip>;
1747
+ declare const createWorkspaceSettingsDataLayer: (db: Kysely<Database>) => {
1748
+ /**
1749
+ * Get workspace settings (creates default if not exists)
1750
+ */
1751
+ getWorkspaceSettings: () => Promise<{
1752
+ name: string | null;
1753
+ id: string;
1754
+ setupComplete: boolean;
1755
+ superAdminId: string | null;
1756
+ createdAt: Date;
1757
+ updatedAt: Date;
1758
+ } | undefined>;
1759
+ /**
1760
+ * Update workspace settings
1761
+ */
1762
+ updateWorkspaceSettings: (params: z$1.infer<typeof updateWorkspaceSettings>) => Promise<{
1763
+ name: string | null;
1764
+ id: string;
1765
+ setupComplete: boolean;
1766
+ superAdminId: string | null;
1767
+ createdAt: Date;
1768
+ updatedAt: Date;
1769
+ } | undefined>;
1770
+ /**
1771
+ * Get the super admin user ID
1772
+ */
1773
+ getSuperAdminId: () => Promise<string | null>;
1774
+ /**
1775
+ * Set the super admin user ID (only if not already set)
1776
+ */
1777
+ setSuperAdminId: (userId: string) => Promise<boolean>;
1778
+ /**
1779
+ * Check if initial setup has been completed
1780
+ */
1781
+ isSetupComplete: () => Promise<boolean>;
1782
+ /**
1783
+ * Mark initial setup as complete
1784
+ */
1785
+ markSetupComplete: () => Promise<{
1786
+ name: string | null;
1787
+ id: string;
1788
+ setupComplete: boolean;
1789
+ superAdminId: string | null;
1790
+ createdAt: Date;
1791
+ updatedAt: Date;
1792
+ } | undefined>;
1793
+ };
1794
+ //#endregion
1761
1795
  //#region src/datalayer/index.d.ts
1762
1796
  declare const createDataLayer: (db: Kysely<Database>) => Promise<{
1763
1797
  getWorkspaceSettings: () => Promise<{
@@ -2970,13 +3004,20 @@ interface AuthClientDatabaseConfig {
2970
3004
  /** Database type */
2971
3005
  type: DatabaseType;
2972
3006
  }
3007
+ interface AuthClientOptions {
3008
+ /** Database configuration */
3009
+ database: any | AuthClientDatabaseConfig;
3010
+ /**
3011
+ * Callback fired after a user is created (signs up) successfully.
3012
+ * Use this to set up workspace settings like superAdminId.
3013
+ */
3014
+ onUserCreated?: (userId: string) => Promise<void>;
3015
+ }
2973
3016
  /**
2974
3017
  * Get Better Auth client options
2975
3018
  *
2976
- * @param database - Either a raw database connection or a pre-configured Kysely instance
2977
- * When using PostgreSQL with custom schema, pass { db, type } to ensure
2978
- * Better Auth uses the correctly configured Kysely instance
3019
+ * @param options - Auth client options including database config and hooks
2979
3020
  */
2980
- declare const getAuthClientOptions: (database: any | AuthClientDatabaseConfig) => BetterAuthOptions;
3021
+ declare const getAuthClientOptions: (options: AuthClientOptions) => BetterAuthOptions;
2981
3022
  //#endregion
2982
- export { type AnthropicProviderConfig, type AnyProviderConfig, AuthClientDatabaseConfig, type AuthConfig, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BasicAuthConfig, type BedrockProviderConfig, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, Config, ConfigVariant, type ConfigVariantsTable, type ConfigsTable, type CortexProviderConfig, CostResult, type Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, type EnvironmentSecretsTable, type EnvironmentsTable, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, Insertable, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, LLMRequest, type LLMRequestInsert, LLMRequestsTable, MS, MemoryCacheBackend, MemoryCacheConfig, MigrationOptions, MigrationResult, type MistralAIProviderConfig, ModelPricing, ModelsDevPricingProvider, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, PricingProvider, type ProviderConfigMap, type ProvidersConfig, SCHEMA_METADATA, type SagemakerProviderConfig, Selectable, type StabilityAIProviderConfig, SupportedProviders, type TableName, TargetingRule, type TargetingRulesTable, Updateable, UsageData, type ValidatedLLMOpsConfig, Variant, VariantJsonData, VariantVersion, VariantVersionsTable, type VariantsTable, type VertexAIProviderConfig, type WorkersAIProviderConfig, WorkspaceSettings, WorkspaceSettingsTable, 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 };
3023
+ export { type AnthropicProviderConfig, type AnyProviderConfig, AuthClientDatabaseConfig, AuthClientOptions, type AzureAIProviderConfig, type AzureOpenAIProviderConfig, BaseCacheConfig, type BaseProviderConfig, type BedrockProviderConfig, CacheBackend, CacheBackendType, CacheConfig, CacheEntry, CacheOptions, CacheService, CacheStats, ChatCompletionCreateParamsBase, Config, ConfigVariant, type ConfigVariantsTable, type ConfigsTable, type CortexProviderConfig, CostResult, type Database, DatabaseConnection, DatabaseOptions, DatabaseType, Environment, EnvironmentSecret, type EnvironmentSecretsTable, type EnvironmentsTable, FileCacheBackend, FileCacheConfig, type FireworksAIProviderConfig, type GoogleProviderConfig, type HuggingFaceProviderConfig, Insertable, LLMOpsClient, LLMOpsConfig, type LLMOpsConfigInput, LLMRequest, type LLMRequestInsert, LLMRequestsTable, MS, MemoryCacheBackend, MemoryCacheConfig, MigrationOptions, MigrationResult, type MistralAIProviderConfig, ModelPricing, ModelsDevPricingProvider, type OpenAIProviderConfig, type OracleProviderConfig, Prettify, PricingProvider, type ProviderConfigMap, type ProvidersConfig, SCHEMA_METADATA, type SagemakerProviderConfig, Selectable, type StabilityAIProviderConfig, SupportedProviders, type TableName, TargetingRule, type TargetingRulesTable, Updateable, UsageData, type ValidatedLLMOpsConfig, Variant, VariantJsonData, VariantVersion, VariantVersionsTable, type VariantsTable, type VertexAIProviderConfig, type WorkersAIProviderConfig, WorkspaceSettings, WorkspaceSettingsTable, calculateCost, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, createLLMRequestsDataLayer, createWorkspaceSettingsDataLayer, 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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
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";
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-BokBhuLo.mjs";
2
2
  import gateway from "@llmops/gateway";
3
3
  import { sql } from "kysely";
4
4
  import * as fs from "node:fs/promises";
@@ -441,18 +441,8 @@ const providerEntries = Object.values(SupportedProviders).map((provider) => [pro
441
441
  * All providers are optional, but at least one must be configured
442
442
  */
443
443
  const providersSchema = object(Object.fromEntries(providerEntries)).refine((providers) => Object.values(providers).some((v) => v !== void 0 && v !== null), "At least one provider must be configured");
444
- /**
445
- * Auth configuration schema
446
- *
447
- * Uses a flexible schema with passthrough to allow different auth providers.
448
- * - Open source: basicAuth() from @llmops/sdk (type: 'basic')
449
- *
450
- * The actual auth handling is done by the auth middleware based on the type.
451
- */
452
- const authSchema = object({ type: string().min(1, "Auth type is required") }).passthrough();
453
444
  const llmopsConfigSchema = object({
454
445
  database: any(),
455
- auth: authSchema,
456
446
  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
447
  providers: providersSchema,
458
448
  schema: string().optional().default("llmops")
@@ -2479,4 +2469,4 @@ function getDefaultPricingProvider() {
2479
2469
  }
2480
2470
 
2481
2471
  //#endregion
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 };
2472
+ export { CacheService, FileCacheBackend, MS, MemoryCacheBackend, ModelsDevPricingProvider, SCHEMA_METADATA, SupportedProviders, calculateCost, chatCompletionCreateParamsBaseSchema, configVariantsSchema, configsSchema, createDataLayer, createDatabase, createDatabaseFromConnection, createLLMRequestsDataLayer, createWorkspaceSettingsDataLayer, 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 };
@@ -1,4 +1,4 @@
1
- const require_db = require('./db-CpVh76Wq.cjs');
1
+ const require_db = require('./db-1Ar4ItM_.cjs');
2
2
  let kysely = require("kysely");
3
3
 
4
4
  //#region src/db/node-sqlite-dialect.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llmops/core",
3
- "version": "0.1.9-beta.1",
3
+ "version": "0.1.9-beta.3",
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.1.9-beta.1"
55
+ "@llmops/gateway": "^0.1.9-beta.3"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsdown",