arkormx 2.0.0-next.13 → 2.0.0-next.14

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/cli.mjs CHANGED
@@ -1,18 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
- import * as path from "node:path";
5
4
  import { dirname, extname, join, resolve } from "node:path";
6
5
  import { spawnSync } from "node:child_process";
7
6
  import { str } from "@h3ravel/support";
8
- import { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
7
+ import path, { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
9
8
  import { copyFileSync, existsSync as existsSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, rmSync as rmSync$1, writeFileSync as writeFileSync$1 } from "fs";
10
9
  import { AsyncLocalStorage } from "async_hooks";
11
10
  import { createJiti } from "@rexxars/jiti";
12
11
  import { pathToFileURL } from "node:url";
12
+ import { createRequire } from "module";
13
13
  import { fileURLToPath } from "url";
14
14
  import { Logger } from "@h3ravel/shared";
15
- import { createRequire } from "module";
16
15
  import { Command, Kernel } from "@h3ravel/musket";
17
16
 
18
17
  //#region src/Exceptions/ArkormException.ts
@@ -1458,29 +1457,6 @@ const applyMigrationRollbackToPrismaSchema = async (migration, options = {}) =>
1458
1457
  };
1459
1458
  };
1460
1459
 
1461
- //#endregion
1462
- //#region src/helpers/runtime-module-loader.ts
1463
- var RuntimeModuleLoader = class {
1464
- static async load(filePath) {
1465
- const resolvedPath = resolve(filePath);
1466
- return await createJiti(pathToFileURL(resolvedPath).href, {
1467
- fsCache: false,
1468
- interopDefault: false,
1469
- moduleCache: false,
1470
- tsconfigPaths: true
1471
- }).import(resolvedPath);
1472
- }
1473
- static loadSync(filePath) {
1474
- const resolvedPath = resolve(filePath);
1475
- return createJiti(pathToFileURL(resolvedPath).href, {
1476
- fsCache: false,
1477
- interopDefault: false,
1478
- moduleCache: false,
1479
- tsconfigPaths: true
1480
- })(resolvedPath);
1481
- }
1482
- };
1483
-
1484
1460
  //#endregion
1485
1461
  //#region src/helpers/migration-history.ts
1486
1462
  const createEmptyAppliedMigrationsState = () => ({
@@ -1917,18 +1893,19 @@ const getPersistedEnumTsType = (values) => {
1917
1893
  };
1918
1894
 
1919
1895
  //#endregion
1920
- //#region src/helpers/runtime-config.ts
1921
- const supportedConfigExtensions = [
1922
- "cjs",
1923
- "js",
1924
- "mjs",
1925
- "ts",
1926
- "cts",
1927
- "mts"
1928
- ];
1929
- const getRuntimeConfigPaths = () => {
1930
- return supportedConfigExtensions.map((extension) => path.join(process.cwd(), `arkormx.config.${extension}`));
1896
+ //#region src/helpers/runtime-module-loader.ts
1897
+ var RuntimeModuleLoader = class {
1898
+ static async load(filePath) {
1899
+ const resolvedPath = resolve(filePath);
1900
+ return await createJiti(pathToFileURL(resolvedPath).href, {
1901
+ interopDefault: false,
1902
+ tsconfigPaths: true
1903
+ }).import(resolvedPath);
1904
+ }
1931
1905
  };
1906
+
1907
+ //#endregion
1908
+ //#region src/helpers/runtime-config.ts
1932
1909
  const resolveDefaultStubsPath = () => {
1933
1910
  let current = path.dirname(fileURLToPath(import.meta.url));
1934
1911
  while (true) {
@@ -2002,7 +1979,6 @@ const bindAdapterToModels = (adapter, models) => {
2002
1979
  * @returns The user-provided ArkORM configuration object.
2003
1980
  */
2004
1981
  const getUserConfig = (key) => {
2005
- if (!runtimeConfigLoaded) loadRuntimeConfigSync();
2006
1982
  if (key) return userConfig[key];
2007
1983
  return userConfig;
2008
1984
  };
@@ -2029,8 +2005,6 @@ const configureArkormRuntime = (prisma, options = {}) => {
2029
2005
  runtimeAdapter = options.adapter;
2030
2006
  runtimePaginationURLDriverFactory = nextConfig.pagination?.urlDriver;
2031
2007
  runtimePaginationCurrentPageResolver = nextConfig.pagination?.resolveCurrentPage;
2032
- runtimeConfigLoaded = true;
2033
- runtimeConfigLoadingPromise = void 0;
2034
2008
  options.boot?.({
2035
2009
  prisma: resolveClient(prisma),
2036
2010
  bindAdapter: bindAdapterToModels
@@ -2059,7 +2033,7 @@ const resolveClient = (resolver) => {
2059
2033
  */
2060
2034
  const resolveAndApplyConfig = (imported) => {
2061
2035
  const config = imported?.default ?? imported;
2062
- if (!config || typeof config !== "object") return false;
2036
+ if (!config || typeof config !== "object") return;
2063
2037
  configureArkormRuntime(config.prisma, {
2064
2038
  adapter: config.adapter,
2065
2039
  boot: config.boot,
@@ -2069,7 +2043,6 @@ const resolveAndApplyConfig = (imported) => {
2069
2043
  outputExt: config.outputExt
2070
2044
  });
2071
2045
  runtimeConfigLoaded = true;
2072
- return true;
2073
2046
  };
2074
2047
  /**
2075
2048
  * Dynamically import a configuration file.
@@ -2082,11 +2055,13 @@ const importConfigFile = (configPath) => {
2082
2055
  return RuntimeModuleLoader.load(configPath);
2083
2056
  };
2084
2057
  const loadRuntimeConfigSync = () => {
2085
- const syncConfigPaths = getRuntimeConfigPaths();
2058
+ const require = createRequire(import.meta.url);
2059
+ const syncConfigPaths = [path.join(process.cwd(), "arkormx.config.cjs")];
2086
2060
  for (const configPath of syncConfigPaths) {
2087
2061
  if (!existsSync$1(configPath)) continue;
2088
2062
  try {
2089
- if (resolveAndApplyConfig(RuntimeModuleLoader.loadSync(configPath))) return true;
2063
+ resolveAndApplyConfig(require(configPath));
2064
+ return true;
2090
2065
  } catch {
2091
2066
  continue;
2092
2067
  }
@@ -2101,12 +2076,14 @@ const loadRuntimeConfigSync = () => {
2101
2076
  const loadArkormConfig = async () => {
2102
2077
  if (runtimeConfigLoaded) return;
2103
2078
  if (runtimeConfigLoadingPromise) return await runtimeConfigLoadingPromise;
2079
+ if (loadRuntimeConfigSync()) return;
2104
2080
  runtimeConfigLoadingPromise = (async () => {
2105
- const configPaths = getRuntimeConfigPaths();
2081
+ const configPaths = [path.join(process.cwd(), "arkormx.config.js"), path.join(process.cwd(), "arkormx.config.ts")];
2106
2082
  for (const configPath of configPaths) {
2107
2083
  if (!existsSync$1(configPath)) continue;
2108
2084
  try {
2109
- if (resolveAndApplyConfig(await importConfigFile(configPath))) return;
2085
+ resolveAndApplyConfig(await importConfigFile(configPath));
2086
+ return;
2110
2087
  } catch {
2111
2088
  continue;
2112
2089
  }
@@ -2118,6 +2095,7 @@ const loadArkormConfig = async () => {
2118
2095
  const getDefaultStubsPath = () => {
2119
2096
  return resolveDefaultStubsPath();
2120
2097
  };
2098
+ loadArkormConfig();
2121
2099
 
2122
2100
  //#endregion
2123
2101
  //#region src/cli/CliApp.ts
@@ -3677,7 +3655,6 @@ var logo_default = String.raw`
3677
3655
 
3678
3656
  //#endregion
3679
3657
  //#region src/cli/index.ts
3680
- await loadArkormConfig();
3681
3658
  const app = new CliApp();
3682
3659
  await Kernel.init(app, {
3683
3660
  logo: logo_default,
package/dist/index.cjs CHANGED
@@ -28,19 +28,19 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  //#endregion
29
29
  let kysely = require("kysely");
30
30
  let _h3ravel_support = require("@h3ravel/support");
31
- let node_path = require("node:path");
32
- node_path = __toESM(node_path);
33
31
  let async_hooks = require("async_hooks");
32
+ let node_path = require("node:path");
33
+ let node_fs = require("node:fs");
34
+ let node_crypto = require("node:crypto");
35
+ let node_child_process = require("node:child_process");
34
36
  let _rexxars_jiti = require("@rexxars/jiti");
35
37
  let node_url = require("node:url");
38
+ let module$1 = require("module");
36
39
  let fs = require("fs");
37
40
  let url = require("url");
38
- let node_fs = require("node:fs");
39
- let node_crypto = require("node:crypto");
40
- let node_child_process = require("node:child_process");
41
41
  let path = require("path");
42
+ path = __toESM(path);
42
43
  let _h3ravel_shared = require("@h3ravel/shared");
43
- let module$1 = require("module");
44
44
  let _h3ravel_musket = require("@h3ravel/musket");
45
45
  let _h3ravel_collect_js = require("@h3ravel/collect.js");
46
46
 
@@ -1019,29 +1019,6 @@ var MissingDelegateException = class extends ArkormException {
1019
1019
  }
1020
1020
  };
1021
1021
 
1022
- //#endregion
1023
- //#region src/helpers/runtime-module-loader.ts
1024
- var RuntimeModuleLoader = class {
1025
- static async load(filePath) {
1026
- const resolvedPath = (0, node_path.resolve)(filePath);
1027
- return await (0, _rexxars_jiti.createJiti)((0, node_url.pathToFileURL)(resolvedPath).href, {
1028
- fsCache: false,
1029
- interopDefault: false,
1030
- moduleCache: false,
1031
- tsconfigPaths: true
1032
- }).import(resolvedPath);
1033
- }
1034
- static loadSync(filePath) {
1035
- const resolvedPath = (0, node_path.resolve)(filePath);
1036
- return (0, _rexxars_jiti.createJiti)((0, node_url.pathToFileURL)(resolvedPath).href, {
1037
- fsCache: false,
1038
- interopDefault: false,
1039
- moduleCache: false,
1040
- tsconfigPaths: true
1041
- })(resolvedPath);
1042
- }
1043
- };
1044
-
1045
1022
  //#endregion
1046
1023
  //#region src/helpers/migration-history.ts
1047
1024
  const createEmptyAppliedMigrationsState = () => ({
@@ -2933,29 +2910,30 @@ const getPersistedEnumTsType = (values) => {
2933
2910
  };
2934
2911
 
2935
2912
  //#endregion
2936
- //#region src/helpers/runtime-config.ts
2937
- const supportedConfigExtensions = [
2938
- "cjs",
2939
- "js",
2940
- "mjs",
2941
- "ts",
2942
- "cts",
2943
- "mts"
2944
- ];
2945
- const getRuntimeConfigPaths = () => {
2946
- return supportedConfigExtensions.map((extension) => node_path.join(process.cwd(), `arkormx.config.${extension}`));
2913
+ //#region src/helpers/runtime-module-loader.ts
2914
+ var RuntimeModuleLoader = class {
2915
+ static async load(filePath) {
2916
+ const resolvedPath = (0, node_path.resolve)(filePath);
2917
+ return await (0, _rexxars_jiti.createJiti)((0, node_url.pathToFileURL)(resolvedPath).href, {
2918
+ interopDefault: false,
2919
+ tsconfigPaths: true
2920
+ }).import(resolvedPath);
2921
+ }
2947
2922
  };
2923
+
2924
+ //#endregion
2925
+ //#region src/helpers/runtime-config.ts
2948
2926
  const resolveDefaultStubsPath = () => {
2949
- let current = node_path.dirname((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
2927
+ let current = path.default.dirname((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
2950
2928
  while (true) {
2951
- const packageJsonPath = node_path.join(current, "package.json");
2952
- const stubsPath = node_path.join(current, "stubs");
2929
+ const packageJsonPath = path.default.join(current, "package.json");
2930
+ const stubsPath = path.default.join(current, "stubs");
2953
2931
  if ((0, fs.existsSync)(packageJsonPath) && (0, fs.existsSync)(stubsPath)) return stubsPath;
2954
- const parent = node_path.dirname(current);
2932
+ const parent = path.default.dirname(current);
2955
2933
  if (parent === current) break;
2956
2934
  current = parent;
2957
2935
  }
2958
- return node_path.join(process.cwd(), "stubs");
2936
+ return path.default.join(process.cwd(), "stubs");
2959
2937
  };
2960
2938
  const baseConfig = {
2961
2939
  features: {
@@ -2964,11 +2942,11 @@ const baseConfig = {
2964
2942
  },
2965
2943
  paths: {
2966
2944
  stubs: resolveDefaultStubsPath(),
2967
- seeders: node_path.join(process.cwd(), "database", "seeders"),
2968
- models: node_path.join(process.cwd(), "src", "models"),
2969
- migrations: node_path.join(process.cwd(), "database", "migrations"),
2970
- factories: node_path.join(process.cwd(), "database", "factories"),
2971
- buildOutput: node_path.join(process.cwd(), "dist")
2945
+ seeders: path.default.join(process.cwd(), "database", "seeders"),
2946
+ models: path.default.join(process.cwd(), "src", "models"),
2947
+ migrations: path.default.join(process.cwd(), "database", "migrations"),
2948
+ factories: path.default.join(process.cwd(), "database", "factories"),
2949
+ buildOutput: path.default.join(process.cwd(), "dist")
2972
2950
  },
2973
2951
  outputExt: "ts"
2974
2952
  };
@@ -2988,7 +2966,7 @@ const mergePathConfig = (paths) => {
2988
2966
  const defaults = baseConfig.paths ?? {};
2989
2967
  const current = userConfig.paths ?? {};
2990
2968
  const incoming = Object.entries(paths ?? {}).reduce((all, [key, value]) => {
2991
- if (typeof value === "string" && value.trim().length > 0) all[key] = node_path.isAbsolute(value) ? value : node_path.resolve(process.cwd(), value);
2969
+ if (typeof value === "string" && value.trim().length > 0) all[key] = path.default.isAbsolute(value) ? value : path.default.resolve(process.cwd(), value);
2992
2970
  return all;
2993
2971
  }, {});
2994
2972
  return {
@@ -3027,7 +3005,6 @@ const bindAdapterToModels = (adapter, models) => {
3027
3005
  * @returns The user-provided ArkORM configuration object.
3028
3006
  */
3029
3007
  const getUserConfig = (key) => {
3030
- if (!runtimeConfigLoaded) loadRuntimeConfigSync();
3031
3008
  if (key) return userConfig[key];
3032
3009
  return userConfig;
3033
3010
  };
@@ -3054,8 +3031,6 @@ const configureArkormRuntime = (prisma, options = {}) => {
3054
3031
  runtimeAdapter = options.adapter;
3055
3032
  runtimePaginationURLDriverFactory = nextConfig.pagination?.urlDriver;
3056
3033
  runtimePaginationCurrentPageResolver = nextConfig.pagination?.resolveCurrentPage;
3057
- runtimeConfigLoaded = true;
3058
- runtimeConfigLoadingPromise = void 0;
3059
3034
  options.boot?.({
3060
3035
  prisma: resolveClient(prisma),
3061
3036
  bindAdapter: bindAdapterToModels
@@ -3066,9 +3041,6 @@ const configureArkormRuntime = (prisma, options = {}) => {
3066
3041
  * This is primarily intended for testing purposes.
3067
3042
  */
3068
3043
  const resetArkormRuntimeForTests = () => {
3069
- Object.keys(userConfig).forEach((key) => {
3070
- delete userConfig[key];
3071
- });
3072
3044
  Object.assign(userConfig, {
3073
3045
  ...baseConfig,
3074
3046
  features: { ...baseConfig.features ?? {} },
@@ -3105,7 +3077,7 @@ const resolveClient = (resolver) => {
3105
3077
  */
3106
3078
  const resolveAndApplyConfig = (imported) => {
3107
3079
  const config = imported?.default ?? imported;
3108
- if (!config || typeof config !== "object") return false;
3080
+ if (!config || typeof config !== "object") return;
3109
3081
  configureArkormRuntime(config.prisma, {
3110
3082
  adapter: config.adapter,
3111
3083
  boot: config.boot,
@@ -3115,7 +3087,6 @@ const resolveAndApplyConfig = (imported) => {
3115
3087
  outputExt: config.outputExt
3116
3088
  });
3117
3089
  runtimeConfigLoaded = true;
3118
- return true;
3119
3090
  };
3120
3091
  /**
3121
3092
  * Dynamically import a configuration file.
@@ -3128,11 +3099,13 @@ const importConfigFile = (configPath) => {
3128
3099
  return RuntimeModuleLoader.load(configPath);
3129
3100
  };
3130
3101
  const loadRuntimeConfigSync = () => {
3131
- const syncConfigPaths = getRuntimeConfigPaths();
3102
+ const require = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
3103
+ const syncConfigPaths = [path.default.join(process.cwd(), "arkormx.config.cjs")];
3132
3104
  for (const configPath of syncConfigPaths) {
3133
3105
  if (!(0, fs.existsSync)(configPath)) continue;
3134
3106
  try {
3135
- if (resolveAndApplyConfig(RuntimeModuleLoader.loadSync(configPath))) return true;
3107
+ resolveAndApplyConfig(require(configPath));
3108
+ return true;
3136
3109
  } catch {
3137
3110
  continue;
3138
3111
  }
@@ -3147,12 +3120,14 @@ const loadRuntimeConfigSync = () => {
3147
3120
  const loadArkormConfig = async () => {
3148
3121
  if (runtimeConfigLoaded) return;
3149
3122
  if (runtimeConfigLoadingPromise) return await runtimeConfigLoadingPromise;
3123
+ if (loadRuntimeConfigSync()) return;
3150
3124
  runtimeConfigLoadingPromise = (async () => {
3151
- const configPaths = getRuntimeConfigPaths();
3125
+ const configPaths = [path.default.join(process.cwd(), "arkormx.config.js"), path.default.join(process.cwd(), "arkormx.config.ts")];
3152
3126
  for (const configPath of configPaths) {
3153
3127
  if (!(0, fs.existsSync)(configPath)) continue;
3154
3128
  try {
3155
- if (resolveAndApplyConfig(await importConfigFile(configPath))) return;
3129
+ resolveAndApplyConfig(await importConfigFile(configPath));
3130
+ return;
3156
3131
  } catch {
3157
3132
  continue;
3158
3133
  }
@@ -3254,6 +3229,7 @@ const isDelegateLike = (value) => {
3254
3229
  "count"
3255
3230
  ].every((method) => typeof candidate[method] === "function");
3256
3231
  };
3232
+ loadArkormConfig();
3257
3233
 
3258
3234
  //#endregion
3259
3235
  //#region src/helpers/prisma.ts
@@ -3893,7 +3869,7 @@ var CliApp = class {
3893
3869
  } else candidates.push(mappedFile);
3894
3870
  }
3895
3871
  }
3896
- const runtimeMatch = candidates.find((path$1) => (0, fs.existsSync)(path$1));
3872
+ const runtimeMatch = candidates.find((path$2) => (0, fs.existsSync)(path$2));
3897
3873
  if (runtimeMatch) return runtimeMatch;
3898
3874
  return filePath;
3899
3875
  }
@@ -8389,28 +8365,16 @@ var DB = class DB {
8389
8365
  }
8390
8366
  static createTableModel(table, options, adapter) {
8391
8367
  const primaryKey = options.primaryKey ?? "id";
8392
- const resolvedAdapter = options.adapter ?? adapter ?? DB.getAdapter();
8393
- const persistedMetadata = DB.resolvePersistedTableMetadata(table, options, resolvedAdapter);
8394
- const columns = {
8395
- ...persistedMetadata.columns,
8396
- ...options.columns ?? {}
8397
- };
8368
+ const columns = { ...options.columns ?? {} };
8398
8369
  const softDelete = options.softDelete ?? defaultSoftDeleteConfig;
8399
- const primaryKeyGeneration = options.primaryKeyGeneration ? { ...options.primaryKeyGeneration } : persistedMetadata.primaryKeyGeneration?.column === primaryKey ? {
8400
- strategy: persistedMetadata.primaryKeyGeneration.strategy,
8401
- prismaDefault: persistedMetadata.primaryKeyGeneration.prismaDefault,
8402
- databaseDefault: persistedMetadata.primaryKeyGeneration.databaseDefault,
8403
- runtimeFactory: persistedMetadata.primaryKeyGeneration.runtimeFactory
8404
- } : void 0;
8405
- const timestampColumns = options.timestampColumns?.map((column) => ({ ...column })) ?? persistedMetadata.timestampColumns?.map((column) => ({ ...column }));
8406
8370
  const buildMetadata = () => {
8407
8371
  return {
8408
8372
  table,
8409
8373
  primaryKey,
8410
8374
  columns: { ...columns },
8411
8375
  softDelete: { ...softDelete },
8412
- primaryKeyGeneration,
8413
- timestampColumns
8376
+ primaryKeyGeneration: options.primaryKeyGeneration ? { ...options.primaryKeyGeneration } : void 0,
8377
+ timestampColumns: options.timestampColumns?.map((column) => ({ ...column }))
8414
8378
  };
8415
8379
  };
8416
8380
  const modelStatic = {
@@ -8419,7 +8383,7 @@ var DB = class DB {
8419
8383
  hydrateMany: (attributes) => attributes.map((attribute) => ({ ...attribute })),
8420
8384
  hydrateRetrieved: async (attributes) => ({ ...attributes }),
8421
8385
  hydrateManyRetrieved: async (attributes) => attributes.map((attribute) => ({ ...attribute })),
8422
- getAdapter: () => resolvedAdapter,
8386
+ getAdapter: () => options.adapter ?? adapter ?? DB.getAdapter(),
8423
8387
  getColumnMap: () => ({ ...columns }),
8424
8388
  getColumnName: (attribute) => columns[attribute] ?? attribute,
8425
8389
  getDelegate: () => noopDelegate,
@@ -8432,19 +8396,6 @@ var DB = class DB {
8432
8396
  };
8433
8397
  return modelStatic;
8434
8398
  }
8435
- static resolvePersistedTableMetadata(table, options, adapter) {
8436
- if (options.persistedMetadata === false) return {
8437
- columns: {},
8438
- enums: {}
8439
- };
8440
- const persistedMetadataOptions = typeof options.persistedMetadata === "object" ? options.persistedMetadata : {};
8441
- return getPersistedTableMetadata(table, {
8442
- cwd: persistedMetadataOptions.cwd,
8443
- configuredPath: persistedMetadataOptions.configuredPath,
8444
- features: resolvePersistedMetadataFeatures(getUserConfig("features")),
8445
- strict: persistedMetadataOptions.strict ?? (Boolean(adapter) && !(adapter instanceof PrismaDatabaseAdapter))
8446
- });
8447
- }
8448
8399
  };
8449
8400
 
8450
8401
  //#endregion
package/dist/index.d.cts CHANGED
@@ -411,18 +411,12 @@ interface MorphToManyRelationMetadata extends BaseRelationMetadata {
411
411
  type RelationMetadata = HasOneRelationMetadata | HasManyRelationMetadata | BelongsToRelationMetadata | BelongsToManyRelationMetadata | HasOneThroughRelationMetadata | HasManyThroughRelationMetadata | MorphOneRelationMetadata | MorphManyRelationMetadata | MorphToManyRelationMetadata;
412
412
  //#endregion
413
413
  //#region src/types/db.d.ts
414
- interface DatabaseTablePersistedMetadataOptions {
415
- cwd?: string;
416
- configuredPath?: string;
417
- strict?: boolean;
418
- }
419
414
  interface DatabaseTableOptions {
420
415
  adapter?: DatabaseAdapter;
421
416
  primaryKey?: string;
422
417
  columns?: Record<string, string>;
423
418
  softDelete?: SoftDeleteConfig;
424
419
  primaryKeyGeneration?: PrimaryKeyGeneration;
425
- persistedMetadata?: boolean | DatabaseTablePersistedMetadataOptions;
426
420
  timestampColumns?: TimestampColumnBehavior[];
427
421
  }
428
422
  //#endregion
@@ -4136,7 +4130,6 @@ declare class DB {
4136
4130
  static transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
4137
4131
  transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
4138
4132
  private static createTableModel;
4139
- private static resolvePersistedTableMetadata;
4140
4133
  }
4141
4134
  //#endregion
4142
4135
  //#region src/Exceptions/ArkormException.d.ts
@@ -4711,7 +4704,6 @@ declare function inferDelegateName(modelName: string): string;
4711
4704
  //#region src/helpers/runtime-module-loader.d.ts
4712
4705
  declare class RuntimeModuleLoader {
4713
4706
  static load<T = unknown>(filePath: string): Promise<T>;
4714
- static loadSync<T = unknown>(filePath: string): T;
4715
4707
  }
4716
4708
  //#endregion
4717
4709
  //#region src/URLDriver.d.ts
@@ -4732,4 +4724,4 @@ declare class URLDriver {
4732
4724
  url(page: number): string;
4733
4725
  }
4734
4726
  //#endregion
4735
- export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DB, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseTableOptions, DatabaseTablePersistedMetadataOptions, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PersistedTimestampColumn, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, TimestampColumnBehavior, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
4727
+ export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DB, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseTableOptions, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PersistedTimestampColumn, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, TimestampColumnBehavior, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
package/dist/index.d.mts CHANGED
@@ -411,18 +411,12 @@ interface MorphToManyRelationMetadata extends BaseRelationMetadata {
411
411
  type RelationMetadata = HasOneRelationMetadata | HasManyRelationMetadata | BelongsToRelationMetadata | BelongsToManyRelationMetadata | HasOneThroughRelationMetadata | HasManyThroughRelationMetadata | MorphOneRelationMetadata | MorphManyRelationMetadata | MorphToManyRelationMetadata;
412
412
  //#endregion
413
413
  //#region src/types/db.d.ts
414
- interface DatabaseTablePersistedMetadataOptions {
415
- cwd?: string;
416
- configuredPath?: string;
417
- strict?: boolean;
418
- }
419
414
  interface DatabaseTableOptions {
420
415
  adapter?: DatabaseAdapter;
421
416
  primaryKey?: string;
422
417
  columns?: Record<string, string>;
423
418
  softDelete?: SoftDeleteConfig;
424
419
  primaryKeyGeneration?: PrimaryKeyGeneration;
425
- persistedMetadata?: boolean | DatabaseTablePersistedMetadataOptions;
426
420
  timestampColumns?: TimestampColumnBehavior[];
427
421
  }
428
422
  //#endregion
@@ -4136,7 +4130,6 @@ declare class DB {
4136
4130
  static transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
4137
4131
  transaction<TResult>(callback: (db: DB) => TResult | Promise<TResult>, context?: AdapterTransactionContext): Promise<TResult>;
4138
4132
  private static createTableModel;
4139
- private static resolvePersistedTableMetadata;
4140
4133
  }
4141
4134
  //#endregion
4142
4135
  //#region src/Exceptions/ArkormException.d.ts
@@ -4711,7 +4704,6 @@ declare function inferDelegateName(modelName: string): string;
4711
4704
  //#region src/helpers/runtime-module-loader.d.ts
4712
4705
  declare class RuntimeModuleLoader {
4713
4706
  static load<T = unknown>(filePath: string): Promise<T>;
4714
- static loadSync<T = unknown>(filePath: string): T;
4715
4707
  }
4716
4708
  //#endregion
4717
4709
  //#region src/URLDriver.d.ts
@@ -4732,4 +4724,4 @@ declare class URLDriver {
4732
4724
  url(page: number): string;
4733
4725
  }
4734
4726
  //#endregion
4735
- export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DB, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseTableOptions, DatabaseTablePersistedMetadataOptions, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PersistedTimestampColumn, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, TimestampColumnBehavior, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
4727
+ export { AdapterBindableModel, AdapterCapabilities, AdapterCapability, AdapterModelFieldStructure, AdapterModelIntrospectionOptions, AdapterModelStructure, AdapterTransactionContext, AggregateOperation, AggregateSelection, AggregateSpec, AppliedMigrationEntry, AppliedMigrationRun, AppliedMigrationsState, ArkormBootContext, ArkormCollection, ArkormConfig, ArkormErrorContext, ArkormException, Attribute, AttributeCreateInput, AttributeOptions, AttributeOrderBy, AttributeSchemaDelegate, AttributeSelect, AttributeUpdateInput, AttributeWhereInput, BelongsToManyRelationMetadata, BelongsToRelationMetadata, CastDefinition, CastHandler, CastMap, CastType, CliApp, ClientResolver, ColumnMap, DB, DatabaseAdapter, DatabasePrimitive, DatabaseRow, DatabaseRows, DatabaseTableOptions, DatabaseValue, DelegateCreateData, DelegateFindManyArgs, DelegateForModelSchema, DelegateInclude, DelegateOrderBy, DelegateRow, DelegateRows, DelegateSelect, DelegateUniqueWhere, DelegateUpdateArgs, DelegateUpdateData, DelegateWhere, DeleteManySpec, DeleteSpec, EagerLoadConstraint, EagerLoadMap, EnumBuilder, FactoryAttributes, FactoryDefinition, FactoryModelConstructor, FactoryState, ForeignKeyBuilder, GenerateMigrationOptions, GeneratedMigrationFile, GetUserConfig, GlobalScope, HasManyRelationMetadata, HasManyThroughRelationMetadata, HasOneRelationMetadata, HasOneThroughRelationMetadata, InitCommand, InlineFactory, InsertManySpec, InsertSpec, KyselyDatabaseAdapter, LengthAwarePaginator, MIGRATION_BRAND, MakeFactoryCommand, MakeMigrationCommand, MakeModelCommand, MakeSeederCommand, MigrateCommand, MigrateFreshCommand, MigrateRollbackCommand, Migration, MigrationClass, MigrationHistoryCommand, MigrationInstanceLike, MissingDelegateException, Model, ModelAttributes, ModelAttributesOf, ModelCreateData, ModelEventDispatcher, ModelEventHandler, ModelEventHandlerConstructor, ModelEventListener, ModelEventName, ModelFactory, ModelLifecycleState, ModelMetadata, ModelNotFoundException, ModelStatic, ModelUpdateData, ModelsSyncCommand, MorphManyRelationMetadata, MorphOneRelationMetadata, MorphToManyRelationMetadata, PRISMA_ENUM_MEMBER_REGEX, PRISMA_ENUM_REGEX, PRISMA_MODEL_REGEX, PaginationCurrentPageResolver, PaginationMeta, PaginationOptions, PaginationURLDriver, PaginationURLDriverFactory, Paginator, PersistedColumnMappingsState, PersistedMetadataFeatures, PersistedPrimaryKeyGeneration, PersistedTableMetadata, PersistedTimestampColumn, PrimaryKeyGeneration, PrimaryKeyGenerationPlanner, PrismaClientLike, PrismaDatabaseAdapter, PrismaDelegateLike, PrismaDelegateMap, PrismaDelegateNameMapping, PrismaFindManyArgsLike, PrismaLikeInclude, PrismaLikeOrderBy, PrismaLikeScalarFilter, PrismaLikeSelect, PrismaLikeSortOrder, PrismaLikeWhereInput, PrismaMigrationWorkflowOptions, PrismaSchemaSyncOptions, PrismaTransactionCallback, PrismaTransactionCapableClient, PrismaTransactionOptions, QueryBuilder, QueryComparisonCondition, QueryComparisonOperator, QueryCondition, QueryConstraintException, QueryGroupCondition, QueryLogicalOperator, QueryNotCondition, QueryOrderBy, QueryRawCondition, QuerySelectColumn, QueryTarget, RelatedModelClass, RelationAggregateSpec, RelationColumnLookupSpec, RelationConstraint, RelationDefaultResolver, RelationDefaultValue, RelationFilterSpec, RelationLoadPlan, RelationLoadSpec, RelationMetadata, RelationMetadataProvider, RelationMetadataType, RelationResolutionException, RelationTableLookupSpec, RelationshipModelStatic, RuntimeModuleLoader, SEEDER_BRAND, SchemaBuilder, SchemaColumn, SchemaColumnType, SchemaForeignKey, SchemaForeignKeyAction, SchemaIndex, SchemaOperation, SchemaTableAlterOperation, SchemaTableCreateOperation, SchemaTableDropOperation, ScopeNotDefinedException, SeedCommand, Seeder, SeederCallArgument, SeederConstructor, SeederInput, SelectSpec, Serializable, SimplePaginationMeta, SoftDeleteConfig, SoftDeleteQueryMode, SortDirection, TableBuilder, TimestampColumnBehavior, URLDriver, UniqueConstraintResolutionException, UnsupportedAdapterFeatureException, UpdateManySpec, UpdateSpec, UpsertSpec, applyAlterTableOperation, applyCreateTableOperation, applyDropTableOperation, applyMigrationRollbackToDatabase, applyMigrationRollbackToPrismaSchema, applyMigrationToDatabase, applyMigrationToPrismaSchema, applyOperationsToPersistedColumnMappingsState, applyOperationsToPrismaSchema, bindAdapterToModels, buildEnumBlock, buildFieldLine, buildIndexLine, buildInverseRelationLine, buildMigrationIdentity, buildMigrationRunId, buildMigrationSource, buildModelBlock, buildRelationLine, computeMigrationChecksum, configureArkormRuntime, createEmptyAppliedMigrationsState, createEmptyPersistedColumnMappingsState, createKyselyAdapter, createMigrationTimestamp, createPrismaAdapter, createPrismaCompatibilityAdapter, createPrismaDatabaseAdapter, createPrismaDelegateMap, defineConfig, defineFactory, deleteAppliedMigrationsStateFromStore, deletePersistedColumnMappingsState, deriveCollectionFieldName, deriveInverseRelationAlias, deriveRelationAlias, deriveRelationFieldName, deriveSingularFieldName, ensureArkormConfigLoading, escapeRegex, findAppliedMigration, findEnumBlock, findModelBlock, formatDefaultValue, formatEnumDefaultValue, formatRelationAction, generateMigrationFile, getActiveTransactionClient, getDefaultStubsPath, getLastMigrationRun, getLatestAppliedMigrations, getMigrationPlan, getPersistedColumnMap, getPersistedEnumMap, getPersistedEnumTsType, getPersistedPrimaryKeyGeneration, getPersistedTableMetadata, getPersistedTimestampColumns, getRuntimeAdapter, getRuntimePaginationCurrentPageResolver, getRuntimePaginationURLDriverFactory, getRuntimePrismaClient, getUserConfig, inferDelegateName, isDelegateLike, isMigrationApplied, isTransactionCapableClient, loadArkormConfig, markMigrationApplied, markMigrationRun, pad, readAppliedMigrationsState, readAppliedMigrationsStateFromStore, readPersistedColumnMappingsState, rebuildPersistedColumnMappingsState, removeAppliedMigration, resetArkormRuntimeForTests, resetPersistedColumnMappingsCache, resolveCast, resolveColumnMappingsFilePath, resolveEnumName, resolveMigrationClassName, resolveMigrationStateFilePath, resolvePersistedMetadataFeatures, resolvePrismaType, runArkormTransaction, runMigrationWithPrisma, runPrismaCommand, stripPrismaSchemaModelsAndEnums, supportsDatabaseMigrationExecution, supportsDatabaseMigrationState, supportsDatabaseReset, syncPersistedColumnMappingsFromState, toMigrationFileSlug, toModelName, validatePersistedMetadataFeaturesForMigrations, writeAppliedMigrationsState, writeAppliedMigrationsStateToStore, writePersistedColumnMappingsState };
package/dist/index.mjs CHANGED
@@ -1,18 +1,17 @@
1
1
  import { sql } from "kysely";
2
2
  import { str } from "@h3ravel/support";
3
- import * as path from "node:path";
4
- import { dirname, extname, join, resolve } from "node:path";
5
3
  import { AsyncLocalStorage } from "async_hooks";
4
+ import { dirname, extname, join, resolve } from "node:path";
5
+ import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
6
+ import { createHash, randomUUID } from "node:crypto";
7
+ import { spawnSync } from "node:child_process";
6
8
  import { createJiti } from "@rexxars/jiti";
7
9
  import { pathToFileURL } from "node:url";
8
- import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "fs";
10
+ import { createRequire } from "module";
11
+ import { copyFileSync, existsSync as existsSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, rmSync as rmSync$1, writeFileSync as writeFileSync$1 } from "fs";
9
12
  import { fileURLToPath } from "url";
10
- import { existsSync as existsSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, rmSync as rmSync$1, writeFileSync as writeFileSync$1 } from "node:fs";
11
- import { createHash, randomUUID } from "node:crypto";
12
- import { spawnSync } from "node:child_process";
13
- import { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
13
+ import path, { dirname as dirname$1, extname as extname$1, join as join$1, relative } from "path";
14
14
  import { Logger } from "@h3ravel/shared";
15
- import { createRequire } from "module";
16
15
  import { Command } from "@h3ravel/musket";
17
16
  import { Collection } from "@h3ravel/collect.js";
18
17
 
@@ -991,29 +990,6 @@ var MissingDelegateException = class extends ArkormException {
991
990
  }
992
991
  };
993
992
 
994
- //#endregion
995
- //#region src/helpers/runtime-module-loader.ts
996
- var RuntimeModuleLoader = class {
997
- static async load(filePath) {
998
- const resolvedPath = resolve(filePath);
999
- return await createJiti(pathToFileURL(resolvedPath).href, {
1000
- fsCache: false,
1001
- interopDefault: false,
1002
- moduleCache: false,
1003
- tsconfigPaths: true
1004
- }).import(resolvedPath);
1005
- }
1006
- static loadSync(filePath) {
1007
- const resolvedPath = resolve(filePath);
1008
- return createJiti(pathToFileURL(resolvedPath).href, {
1009
- fsCache: false,
1010
- interopDefault: false,
1011
- moduleCache: false,
1012
- tsconfigPaths: true
1013
- })(resolvedPath);
1014
- }
1015
- };
1016
-
1017
993
  //#endregion
1018
994
  //#region src/helpers/migration-history.ts
1019
995
  const createEmptyAppliedMigrationsState = () => ({
@@ -1033,13 +1009,13 @@ const buildMigrationIdentity = (filePath, className) => {
1033
1009
  return `${fileName.slice(0, fileName.length - extname(fileName).length)}:${className}`;
1034
1010
  };
1035
1011
  const computeMigrationChecksum = (filePath) => {
1036
- const source = readFileSync$1(filePath, "utf-8");
1012
+ const source = readFileSync(filePath, "utf-8");
1037
1013
  return createHash("sha256").update(source).digest("hex");
1038
1014
  };
1039
1015
  const readAppliedMigrationsState = (stateFilePath) => {
1040
- if (!existsSync$1(stateFilePath)) return createEmptyAppliedMigrationsState();
1016
+ if (!existsSync(stateFilePath)) return createEmptyAppliedMigrationsState();
1041
1017
  try {
1042
- const parsed = JSON.parse(readFileSync$1(stateFilePath, "utf-8"));
1018
+ const parsed = JSON.parse(readFileSync(stateFilePath, "utf-8"));
1043
1019
  if (!Array.isArray(parsed.migrations)) return createEmptyAppliedMigrationsState();
1044
1020
  return {
1045
1021
  version: 1,
@@ -1060,8 +1036,8 @@ const readAppliedMigrationsStateFromStore = async (adapter, stateFilePath) => {
1060
1036
  };
1061
1037
  const writeAppliedMigrationsState = (stateFilePath, state) => {
1062
1038
  const directory = dirname(stateFilePath);
1063
- if (!existsSync$1(directory)) mkdirSync$1(directory, { recursive: true });
1064
- writeFileSync$1(stateFilePath, JSON.stringify(state, null, 2));
1039
+ if (!existsSync(directory)) mkdirSync(directory, { recursive: true });
1040
+ writeFileSync(stateFilePath, JSON.stringify(state, null, 2));
1065
1041
  };
1066
1042
  const writeAppliedMigrationsStateToStore = async (adapter, stateFilePath, state) => {
1067
1043
  if (supportsDatabaseMigrationState(adapter)) {
@@ -1075,7 +1051,7 @@ const deleteAppliedMigrationsStateFromStore = async (adapter, stateFilePath) =>
1075
1051
  await adapter.writeAppliedMigrationsState(createEmptyAppliedMigrationsState());
1076
1052
  return "database";
1077
1053
  }
1078
- if (!existsSync$1(stateFilePath)) return "missing-file";
1054
+ if (!existsSync(stateFilePath)) return "missing-file";
1079
1055
  writeAppliedMigrationsState(stateFilePath, createEmptyAppliedMigrationsState());
1080
1056
  return "file";
1081
1057
  };
@@ -2456,9 +2432,9 @@ const generateMigrationFile = (name, options = {}) => {
2456
2432
  const filePath = join(directory, fileName);
2457
2433
  const content = buildMigrationSource(className, extension);
2458
2434
  if (options.write ?? true) {
2459
- if (!existsSync$1(directory)) mkdirSync$1(directory, { recursive: true });
2460
- if (existsSync$1(filePath)) throw new ArkormException(`Migration file already exists: ${filePath}`);
2461
- writeFileSync$1(filePath, content);
2435
+ if (!existsSync(directory)) mkdirSync(directory, { recursive: true });
2436
+ if (existsSync(filePath)) throw new ArkormException(`Migration file already exists: ${filePath}`);
2437
+ writeFileSync(filePath, content);
2462
2438
  }
2463
2439
  return {
2464
2440
  fileName,
@@ -2514,11 +2490,11 @@ const applyMigrationRollbackToDatabase = async (adapter, migration) => {
2514
2490
  */
2515
2491
  const applyMigrationToPrismaSchema = async (migration, options = {}) => {
2516
2492
  const schemaPath = options.schemaPath ?? join(process.cwd(), "prisma", "schema.prisma");
2517
- if (!existsSync$1(schemaPath)) throw new ArkormException(`Prisma schema file not found: ${schemaPath}`);
2518
- const source = readFileSync$1(schemaPath, "utf-8");
2493
+ if (!existsSync(schemaPath)) throw new ArkormException(`Prisma schema file not found: ${schemaPath}`);
2494
+ const source = readFileSync(schemaPath, "utf-8");
2519
2495
  const operations = await getMigrationPlan(migration, "up");
2520
2496
  const schema = applyOperationsToPrismaSchema(source, operations);
2521
- if (options.write ?? true) writeFileSync$1(schemaPath, schema);
2497
+ if (options.write ?? true) writeFileSync(schemaPath, schema);
2522
2498
  return {
2523
2499
  schema,
2524
2500
  schemaPath,
@@ -2534,11 +2510,11 @@ const applyMigrationToPrismaSchema = async (migration, options = {}) => {
2534
2510
  */
2535
2511
  const applyMigrationRollbackToPrismaSchema = async (migration, options = {}) => {
2536
2512
  const schemaPath = options.schemaPath ?? join(process.cwd(), "prisma", "schema.prisma");
2537
- if (!existsSync$1(schemaPath)) throw new ArkormException(`Prisma schema file not found: ${schemaPath}`);
2538
- const source = readFileSync$1(schemaPath, "utf-8");
2513
+ if (!existsSync(schemaPath)) throw new ArkormException(`Prisma schema file not found: ${schemaPath}`);
2514
+ const source = readFileSync(schemaPath, "utf-8");
2539
2515
  const operations = await getMigrationPlan(migration, "down");
2540
2516
  const schema = applyOperationsToPrismaSchema(source, operations);
2541
- if (options.write ?? true) writeFileSync$1(schemaPath, schema);
2517
+ if (options.write ?? true) writeFileSync(schemaPath, schema);
2542
2518
  return {
2543
2519
  schema,
2544
2520
  schemaPath,
@@ -2692,14 +2668,14 @@ const resetPersistedColumnMappingsCache = () => {
2692
2668
  };
2693
2669
  const readPersistedColumnMappingsState = (filePath) => {
2694
2670
  if (cachedColumnMappingsPath === filePath && cachedColumnMappingsState) return cachedColumnMappingsState;
2695
- if (!existsSync$1(filePath)) {
2671
+ if (!existsSync(filePath)) {
2696
2672
  const empty = createEmptyPersistedColumnMappingsState();
2697
2673
  cachedColumnMappingsPath = filePath;
2698
2674
  cachedColumnMappingsState = empty;
2699
2675
  return empty;
2700
2676
  }
2701
2677
  try {
2702
- const normalized = normalizePersistedColumnMappingsState(JSON.parse(readFileSync$1(filePath, "utf-8")));
2678
+ const normalized = normalizePersistedColumnMappingsState(JSON.parse(readFileSync(filePath, "utf-8")));
2703
2679
  cachedColumnMappingsPath = filePath;
2704
2680
  cachedColumnMappingsState = normalized;
2705
2681
  return normalized;
@@ -2713,13 +2689,13 @@ const readPersistedColumnMappingsState = (filePath) => {
2713
2689
  const writePersistedColumnMappingsState = (filePath, state) => {
2714
2690
  const normalized = normalizePersistedColumnMappingsState(state);
2715
2691
  const directory = dirname(filePath);
2716
- if (!existsSync$1(directory)) mkdirSync$1(directory, { recursive: true });
2717
- writeFileSync$1(filePath, JSON.stringify(normalized, null, 2));
2692
+ if (!existsSync(directory)) mkdirSync(directory, { recursive: true });
2693
+ writeFileSync(filePath, JSON.stringify(normalized, null, 2));
2718
2694
  cachedColumnMappingsPath = filePath;
2719
2695
  cachedColumnMappingsState = normalized;
2720
2696
  };
2721
2697
  const deletePersistedColumnMappingsState = (filePath) => {
2722
- if (existsSync$1(filePath)) rmSync$1(filePath, { force: true });
2698
+ if (existsSync(filePath)) rmSync(filePath, { force: true });
2723
2699
  resetPersistedColumnMappingsCache();
2724
2700
  };
2725
2701
  const getPersistedTableMetadata = (table, options = {}) => {
@@ -2905,24 +2881,25 @@ const getPersistedEnumTsType = (values) => {
2905
2881
  };
2906
2882
 
2907
2883
  //#endregion
2908
- //#region src/helpers/runtime-config.ts
2909
- const supportedConfigExtensions = [
2910
- "cjs",
2911
- "js",
2912
- "mjs",
2913
- "ts",
2914
- "cts",
2915
- "mts"
2916
- ];
2917
- const getRuntimeConfigPaths = () => {
2918
- return supportedConfigExtensions.map((extension) => path.join(process.cwd(), `arkormx.config.${extension}`));
2884
+ //#region src/helpers/runtime-module-loader.ts
2885
+ var RuntimeModuleLoader = class {
2886
+ static async load(filePath) {
2887
+ const resolvedPath = resolve(filePath);
2888
+ return await createJiti(pathToFileURL(resolvedPath).href, {
2889
+ interopDefault: false,
2890
+ tsconfigPaths: true
2891
+ }).import(resolvedPath);
2892
+ }
2919
2893
  };
2894
+
2895
+ //#endregion
2896
+ //#region src/helpers/runtime-config.ts
2920
2897
  const resolveDefaultStubsPath = () => {
2921
2898
  let current = path.dirname(fileURLToPath(import.meta.url));
2922
2899
  while (true) {
2923
2900
  const packageJsonPath = path.join(current, "package.json");
2924
2901
  const stubsPath = path.join(current, "stubs");
2925
- if (existsSync(packageJsonPath) && existsSync(stubsPath)) return stubsPath;
2902
+ if (existsSync$1(packageJsonPath) && existsSync$1(stubsPath)) return stubsPath;
2926
2903
  const parent = path.dirname(current);
2927
2904
  if (parent === current) break;
2928
2905
  current = parent;
@@ -2999,7 +2976,6 @@ const bindAdapterToModels = (adapter, models) => {
2999
2976
  * @returns The user-provided ArkORM configuration object.
3000
2977
  */
3001
2978
  const getUserConfig = (key) => {
3002
- if (!runtimeConfigLoaded) loadRuntimeConfigSync();
3003
2979
  if (key) return userConfig[key];
3004
2980
  return userConfig;
3005
2981
  };
@@ -3026,8 +3002,6 @@ const configureArkormRuntime = (prisma, options = {}) => {
3026
3002
  runtimeAdapter = options.adapter;
3027
3003
  runtimePaginationURLDriverFactory = nextConfig.pagination?.urlDriver;
3028
3004
  runtimePaginationCurrentPageResolver = nextConfig.pagination?.resolveCurrentPage;
3029
- runtimeConfigLoaded = true;
3030
- runtimeConfigLoadingPromise = void 0;
3031
3005
  options.boot?.({
3032
3006
  prisma: resolveClient(prisma),
3033
3007
  bindAdapter: bindAdapterToModels
@@ -3038,9 +3012,6 @@ const configureArkormRuntime = (prisma, options = {}) => {
3038
3012
  * This is primarily intended for testing purposes.
3039
3013
  */
3040
3014
  const resetArkormRuntimeForTests = () => {
3041
- Object.keys(userConfig).forEach((key) => {
3042
- delete userConfig[key];
3043
- });
3044
3015
  Object.assign(userConfig, {
3045
3016
  ...baseConfig,
3046
3017
  features: { ...baseConfig.features ?? {} },
@@ -3077,7 +3048,7 @@ const resolveClient = (resolver) => {
3077
3048
  */
3078
3049
  const resolveAndApplyConfig = (imported) => {
3079
3050
  const config = imported?.default ?? imported;
3080
- if (!config || typeof config !== "object") return false;
3051
+ if (!config || typeof config !== "object") return;
3081
3052
  configureArkormRuntime(config.prisma, {
3082
3053
  adapter: config.adapter,
3083
3054
  boot: config.boot,
@@ -3087,7 +3058,6 @@ const resolveAndApplyConfig = (imported) => {
3087
3058
  outputExt: config.outputExt
3088
3059
  });
3089
3060
  runtimeConfigLoaded = true;
3090
- return true;
3091
3061
  };
3092
3062
  /**
3093
3063
  * Dynamically import a configuration file.
@@ -3100,11 +3070,13 @@ const importConfigFile = (configPath) => {
3100
3070
  return RuntimeModuleLoader.load(configPath);
3101
3071
  };
3102
3072
  const loadRuntimeConfigSync = () => {
3103
- const syncConfigPaths = getRuntimeConfigPaths();
3073
+ const require = createRequire(import.meta.url);
3074
+ const syncConfigPaths = [path.join(process.cwd(), "arkormx.config.cjs")];
3104
3075
  for (const configPath of syncConfigPaths) {
3105
- if (!existsSync(configPath)) continue;
3076
+ if (!existsSync$1(configPath)) continue;
3106
3077
  try {
3107
- if (resolveAndApplyConfig(RuntimeModuleLoader.loadSync(configPath))) return true;
3078
+ resolveAndApplyConfig(require(configPath));
3079
+ return true;
3108
3080
  } catch {
3109
3081
  continue;
3110
3082
  }
@@ -3119,12 +3091,14 @@ const loadRuntimeConfigSync = () => {
3119
3091
  const loadArkormConfig = async () => {
3120
3092
  if (runtimeConfigLoaded) return;
3121
3093
  if (runtimeConfigLoadingPromise) return await runtimeConfigLoadingPromise;
3094
+ if (loadRuntimeConfigSync()) return;
3122
3095
  runtimeConfigLoadingPromise = (async () => {
3123
- const configPaths = getRuntimeConfigPaths();
3096
+ const configPaths = [path.join(process.cwd(), "arkormx.config.js"), path.join(process.cwd(), "arkormx.config.ts")];
3124
3097
  for (const configPath of configPaths) {
3125
- if (!existsSync(configPath)) continue;
3098
+ if (!existsSync$1(configPath)) continue;
3126
3099
  try {
3127
- if (resolveAndApplyConfig(await importConfigFile(configPath))) return;
3100
+ resolveAndApplyConfig(await importConfigFile(configPath));
3101
+ return;
3128
3102
  } catch {
3129
3103
  continue;
3130
3104
  }
@@ -3226,6 +3200,7 @@ const isDelegateLike = (value) => {
3226
3200
  "count"
3227
3201
  ].every((method) => typeof candidate[method] === "function");
3228
3202
  };
3203
+ loadArkormConfig();
3229
3204
 
3230
3205
  //#endregion
3231
3206
  //#region src/helpers/prisma.ts
@@ -3780,7 +3755,7 @@ var CliApp = class {
3780
3755
  */
3781
3756
  ensureDirectory(filePath) {
3782
3757
  const dir = dirname$1(filePath);
3783
- if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
3758
+ if (!existsSync$1(dir)) mkdirSync$1(dir, { recursive: true });
3784
3759
  }
3785
3760
  /**
3786
3761
  * Convert absolute paths under current working directory into relative display paths.
@@ -3829,13 +3804,13 @@ var CliApp = class {
3829
3804
  * @returns
3830
3805
  */
3831
3806
  resolveRuntimeDirectoryPath(directoryPath) {
3832
- if (existsSync(directoryPath)) return directoryPath;
3807
+ if (existsSync$1(directoryPath)) return directoryPath;
3833
3808
  const { buildOutput } = this.getConfig("paths") || {};
3834
3809
  if (typeof buildOutput !== "string" || buildOutput.trim().length === 0) return directoryPath;
3835
3810
  const relativeSource = relative(process.cwd(), directoryPath);
3836
3811
  if (!relativeSource || relativeSource.startsWith("..")) return directoryPath;
3837
3812
  const mappedDirectory = join$1(buildOutput, relativeSource);
3838
- return existsSync(mappedDirectory) ? mappedDirectory : directoryPath;
3813
+ return existsSync$1(mappedDirectory) ? mappedDirectory : directoryPath;
3839
3814
  }
3840
3815
  /**
3841
3816
  * Resolve a script file path for runtime execution.
@@ -3865,7 +3840,7 @@ var CliApp = class {
3865
3840
  } else candidates.push(mappedFile);
3866
3841
  }
3867
3842
  }
3868
- const runtimeMatch = candidates.find((path) => existsSync(path));
3843
+ const runtimeMatch = candidates.find((path) => existsSync$1(path));
3869
3844
  if (runtimeMatch) return runtimeMatch;
3870
3845
  return filePath;
3871
3846
  }
@@ -3877,14 +3852,14 @@ var CliApp = class {
3877
3852
  * @param replacements
3878
3853
  */
3879
3854
  generateFile(stubPath, outputPath, replacements, options) {
3880
- if (existsSync(outputPath) && !options?.force) {
3855
+ if (existsSync$1(outputPath) && !options?.force) {
3881
3856
  this.command.error(`Error: ${this.formatPathForLog(outputPath)} already exists.`);
3882
3857
  process.exit(1);
3883
- } else if (existsSync(outputPath) && options?.force) rmSync(outputPath);
3884
- let content = readFileSync(stubPath, "utf-8");
3858
+ } else if (existsSync$1(outputPath) && options?.force) rmSync$1(outputPath);
3859
+ let content = readFileSync$1(stubPath, "utf-8");
3885
3860
  for (const [key, value] of Object.entries(replacements)) content = content.replace(new RegExp(`{{${key}}}`, "g"), value);
3886
3861
  this.ensureDirectory(outputPath);
3887
- writeFileSync(outputPath, content);
3862
+ writeFileSync$1(outputPath, content);
3888
3863
  return outputPath;
3889
3864
  }
3890
3865
  /**
@@ -4022,18 +3997,18 @@ var CliApp = class {
4022
3997
  */
4023
3998
  ensurePrismaModelEntry(modelName, delegateName) {
4024
3999
  const schemaPath = join$1(process.cwd(), "prisma", "schema.prisma");
4025
- if (!existsSync(schemaPath)) return {
4000
+ if (!existsSync$1(schemaPath)) return {
4026
4001
  path: schemaPath,
4027
4002
  updated: false
4028
4003
  };
4029
- const source = readFileSync(schemaPath, "utf-8");
4004
+ const source = readFileSync$1(schemaPath, "utf-8");
4030
4005
  const existingByTable = findModelBlock(source, delegateName);
4031
4006
  const existingByName = new RegExp(`model\\s+${modelName}\\s*\\{`, "m").test(source);
4032
4007
  if (existingByTable || existingByName) return {
4033
4008
  path: schemaPath,
4034
4009
  updated: false
4035
4010
  };
4036
- writeFileSync(schemaPath, applyCreateTableOperation(source, {
4011
+ writeFileSync$1(schemaPath, applyCreateTableOperation(source, {
4037
4012
  type: "createTable",
4038
4013
  table: delegateName,
4039
4014
  columns: [{
@@ -4265,7 +4240,7 @@ var CliApp = class {
4265
4240
  const updated = [];
4266
4241
  const skipped = [];
4267
4242
  modelFiles.forEach((filePath) => {
4268
- const source = readFileSync(filePath, "utf-8");
4243
+ const source = readFileSync$1(filePath, "utf-8");
4269
4244
  const structure = resolveStructure(filePath, source);
4270
4245
  if (!structure || structure.fields.length === 0) {
4271
4246
  skipped.push(filePath);
@@ -4276,7 +4251,7 @@ var CliApp = class {
4276
4251
  skipped.push(filePath);
4277
4252
  return;
4278
4253
  }
4279
- writeFileSync(filePath, synced.content);
4254
+ writeFileSync$1(filePath, synced.content);
4280
4255
  updated.push(filePath);
4281
4256
  });
4282
4257
  return {
@@ -4461,12 +4436,12 @@ var CliApp = class {
4461
4436
  }
4462
4437
  async syncModels(options = {}) {
4463
4438
  const modelsDir = options.modelsDir ?? this.resolveConfigPath("models", join$1(process.cwd(), "src", "models"));
4464
- if (!existsSync(modelsDir)) throw new Error(`Models directory not found: ${modelsDir}`);
4465
- const modelFiles = readdirSync(modelsDir).filter((file) => file.endsWith(".ts")).map((file) => join$1(modelsDir, file));
4439
+ if (!existsSync$1(modelsDir)) throw new Error(`Models directory not found: ${modelsDir}`);
4440
+ const modelFiles = readdirSync$1(modelsDir).filter((file) => file.endsWith(".ts")).map((file) => join$1(modelsDir, file));
4466
4441
  const adapter = this.getConfig("adapter");
4467
4442
  if (adapter && typeof adapter.introspectModels === "function") {
4468
4443
  const sources = modelFiles.reduce((all, filePath) => {
4469
- const parsed = this.parseModelSyncSource(readFileSync(filePath, "utf-8"));
4444
+ const parsed = this.parseModelSyncSource(readFileSync$1(filePath, "utf-8"));
4470
4445
  if (parsed) all.set(filePath, parsed);
4471
4446
  return all;
4472
4447
  }, /* @__PURE__ */ new Map());
@@ -4506,12 +4481,12 @@ var CliApp = class {
4506
4481
  syncModelsFromPrisma(options = {}) {
4507
4482
  const schemaPath = options.schemaPath ?? join$1(process.cwd(), "prisma", "schema.prisma");
4508
4483
  const modelsDir = options.modelsDir ?? this.resolveConfigPath("models", join$1(process.cwd(), "src", "models"));
4509
- if (!existsSync(schemaPath)) throw new Error(`Prisma schema file not found: ${schemaPath}`);
4510
- if (!existsSync(modelsDir)) throw new Error(`Models directory not found: ${modelsDir}`);
4511
- const schema = readFileSync(schemaPath, "utf-8");
4484
+ if (!existsSync$1(schemaPath)) throw new Error(`Prisma schema file not found: ${schemaPath}`);
4485
+ if (!existsSync$1(modelsDir)) throw new Error(`Models directory not found: ${modelsDir}`);
4486
+ const schema = readFileSync$1(schemaPath, "utf-8");
4512
4487
  const prismaEnums = this.parsePrismaEnums(schema);
4513
4488
  const prismaModels = this.parsePrismaModels(schema);
4514
- const modelFiles = readdirSync(modelsDir).filter((file) => file.endsWith(".ts")).map((file) => join$1(modelsDir, file));
4489
+ const modelFiles = readdirSync$1(modelsDir).filter((file) => file.endsWith(".ts")).map((file) => join$1(modelsDir, file));
4515
4490
  const result = this.syncModelFiles(modelFiles, (filePath, source) => {
4516
4491
  const parsed = this.parseModelSyncSource(source);
4517
4492
  if (!parsed) return void 0;
@@ -4551,18 +4526,18 @@ var InitCommand = class extends Command {
4551
4526
  const stubsDir = typeof stubs === "string" && stubs.trim().length > 0 ? stubs : getDefaultStubsPath();
4552
4527
  const preferredStubPath = join(stubsDir, "arkormx.config.stub");
4553
4528
  const legacyStubPath = join(stubsDir, "arkorm.config.stub");
4554
- const stubPath = existsSync(preferredStubPath) ? preferredStubPath : legacyStubPath;
4555
- if (existsSync(outputDir) && !this.option("force")) {
4529
+ const stubPath = existsSync$1(preferredStubPath) ? preferredStubPath : legacyStubPath;
4530
+ if (existsSync$1(outputDir) && !this.option("force")) {
4556
4531
  this.error("Error: Arkormˣ has already been initialized. Use --force to reinitialize.");
4557
4532
  process.exit(1);
4558
4533
  }
4559
4534
  this.app.ensureDirectory(outputDir);
4560
- if (existsSync(outputDir) && this.option("force")) copyFileSync(outputDir, outputDir.replace(/\.js$/, `.backup.${Date.now()}.js`));
4561
- if (!existsSync(stubPath)) {
4535
+ if (existsSync$1(outputDir) && this.option("force")) copyFileSync(outputDir, outputDir.replace(/\.js$/, `.backup.${Date.now()}.js`));
4536
+ if (!existsSync$1(stubPath)) {
4562
4537
  this.error(`Error: Missing config stub at ${preferredStubPath} (or ${legacyStubPath})`);
4563
4538
  process.exit(1);
4564
4539
  }
4565
- writeFileSync(outputDir, readFileSync(stubPath, "utf-8"));
4540
+ writeFileSync$1(outputDir, readFileSync$1(stubPath, "utf-8"));
4566
4541
  this.success("Arkormˣ initialized successfully!");
4567
4542
  }
4568
4543
  };
@@ -4737,7 +4712,7 @@ var MigrateCommand = class extends Command {
4737
4712
  this.app.command = this;
4738
4713
  const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
4739
4714
  const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
4740
- if (!existsSync$1(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
4715
+ if (!existsSync(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
4741
4716
  const schemaPath = this.option("schema") ? resolve(String(this.option("schema"))) : join(process.cwd(), "prisma", "schema.prisma");
4742
4717
  const classes = this.option("all") || !this.argument("name") ? await this.loadAllMigrations(migrationsDir) : (await this.loadNamedMigration(migrationsDir, this.argument("name"))).filter(([cls]) => cls !== void 0);
4743
4718
  if (classes.length === 0) return void this.error("Error: No migration classes found to run.");
@@ -4832,7 +4807,7 @@ var MigrateCommand = class extends Command {
4832
4807
  * @param migrationsDir The directory to load migration classes from.
4833
4808
  */
4834
4809
  async loadAllMigrations(migrationsDir) {
4835
- const files = readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
4810
+ const files = readdirSync(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
4836
4811
  return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
4837
4812
  }
4838
4813
  /**
@@ -4854,7 +4829,7 @@ var MigrateCommand = class extends Command {
4854
4829
  `${base}Migration.js`,
4855
4830
  `${base}Migration.mjs`,
4856
4831
  `${base}Migration.cjs`
4857
- ].map((file) => join(migrationsDir, file)).find((file) => existsSync$1(file));
4832
+ ].map((file) => join(migrationsDir, file)).find((file) => existsSync(file));
4858
4833
  if (!target) return [[void 0, name]];
4859
4834
  const runtimeTarget = this.app.resolveRuntimeScriptPath(target);
4860
4835
  return (await this.loadMigrationClassesFromFile(runtimeTarget)).map((cls) => [cls, runtimeTarget]);
@@ -4890,7 +4865,7 @@ var MigrateFreshCommand = class extends Command {
4890
4865
  this.app.command = this;
4891
4866
  const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
4892
4867
  const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
4893
- if (!existsSync$1(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
4868
+ if (!existsSync(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
4894
4869
  const adapter = this.app.getConfig("adapter");
4895
4870
  const useDatabaseMigrations = supportsDatabaseMigrationExecution(adapter);
4896
4871
  const persistedFeatures = resolvePersistedMetadataFeatures(this.app.getConfig("features"));
@@ -4911,8 +4886,8 @@ var MigrateFreshCommand = class extends Command {
4911
4886
  }
4912
4887
  await adapter.resetDatabase();
4913
4888
  } else {
4914
- if (!existsSync$1(schemaPath)) return void this.error(`Error: Prisma schema file not found: ${this.app.formatPathForLog(schemaPath)}`);
4915
- writeFileSync$1(schemaPath, stripPrismaSchemaModelsAndEnums(readFileSync$1(schemaPath, "utf-8")));
4889
+ if (!existsSync(schemaPath)) return void this.error(`Error: Prisma schema file not found: ${this.app.formatPathForLog(schemaPath)}`);
4890
+ writeFileSync(schemaPath, stripPrismaSchemaModelsAndEnums(readFileSync(schemaPath, "utf-8")));
4916
4891
  }
4917
4892
  let appliedState = createEmptyAppliedMigrationsState();
4918
4893
  await writeAppliedMigrationsStateToStore(adapter, stateFilePath, appliedState);
@@ -4959,7 +4934,7 @@ var MigrateFreshCommand = class extends Command {
4959
4934
  migrations.forEach(([_, file]) => this.success(this.app.splitLogger("Migrated", file)));
4960
4935
  }
4961
4936
  async loadAllMigrations(migrationsDir) {
4962
- const files = readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
4937
+ const files = readdirSync(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
4963
4938
  return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
4964
4939
  }
4965
4940
  async loadMigrationClassesFromFile(filePath) {
@@ -4998,7 +4973,7 @@ var MigrateRollbackCommand = class extends Command {
4998
4973
  this.app.command = this;
4999
4974
  const configuredMigrationsDir = this.app.getConfig("paths")?.migrations ?? join(process.cwd(), "database", "migrations");
5000
4975
  const migrationsDir = this.app.resolveRuntimeDirectoryPath(configuredMigrationsDir);
5001
- if (!existsSync$1(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
4976
+ if (!existsSync(migrationsDir)) return void this.error(`Error: Migrations directory not found: ${this.app.formatPathForLog(configuredMigrationsDir)}`);
5002
4977
  const schemaPath = this.option("schema") ? resolve(String(this.option("schema"))) : join(process.cwd(), "prisma", "schema.prisma");
5003
4978
  const stateFilePath = resolveMigrationStateFilePath(process.cwd(), this.option("state-file") ? String(this.option("state-file")) : void 0);
5004
4979
  const adapter = this.app.getConfig("adapter");
@@ -5059,7 +5034,7 @@ var MigrateRollbackCommand = class extends Command {
5059
5034
  rollbackClasses.forEach(([_, file]) => this.success(this.app.splitLogger("RolledBack", file)));
5060
5035
  }
5061
5036
  async loadAllMigrations(migrationsDir) {
5062
- const files = readdirSync$1(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
5037
+ const files = readdirSync(migrationsDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).sort((left, right) => left.localeCompare(right)).map((file) => this.app.resolveRuntimeScriptPath(join(migrationsDir, file)));
5063
5038
  return (await Promise.all(files.map(async (file) => (await this.loadMigrationClassesFromFile(file)).map((cls) => [cls, file])))).flat();
5064
5039
  }
5065
5040
  async loadMigrationClassesFromFile(filePath) {
@@ -5101,11 +5076,11 @@ var MigrationHistoryCommand = class extends Command {
5101
5076
  this.success("Deleted tracked migration state from database.");
5102
5077
  return;
5103
5078
  }
5104
- if (!existsSync$1(stateFilePath)) {
5079
+ if (!existsSync(stateFilePath)) {
5105
5080
  this.success(`No migration state file found at ${this.app.formatPathForLog(stateFilePath)}`);
5106
5081
  return;
5107
5082
  }
5108
- rmSync$1(stateFilePath);
5083
+ rmSync(stateFilePath);
5109
5084
  deletePersistedColumnMappingsState(resolveColumnMappingsFilePath(process.cwd()));
5110
5085
  this.success(`Deleted migration state file: ${this.app.formatPathForLog(stateFilePath)}`);
5111
5086
  return;
@@ -5240,7 +5215,7 @@ var SeedCommand = class extends Command {
5240
5215
  this.app.command = this;
5241
5216
  const configuredSeedersDir = this.app.getConfig("paths")?.seeders ?? join(process.cwd(), "database", "seeders");
5242
5217
  const seedersDir = this.app.resolveRuntimeDirectoryPath(configuredSeedersDir);
5243
- if (!existsSync$1(seedersDir)) return void this.error(`ERROR: Seeders directory not found: ${this.app.formatPathForLog(configuredSeedersDir)}`);
5218
+ if (!existsSync(seedersDir)) return void this.error(`ERROR: Seeders directory not found: ${this.app.formatPathForLog(configuredSeedersDir)}`);
5244
5219
  const classes = this.option("all") ? await this.loadAllSeeders(seedersDir) : await this.loadNamedSeeder(seedersDir, this.argument("name") ?? "DatabaseSeeder");
5245
5220
  if (classes.length === 0) return void this.error("ERROR: No seeder classes found to run.");
5246
5221
  for (const SeederClassItem of classes) await new SeederClassItem().run();
@@ -5254,7 +5229,7 @@ var SeedCommand = class extends Command {
5254
5229
  * @returns
5255
5230
  */
5256
5231
  async loadAllSeeders(seedersDir) {
5257
- const files = readdirSync$1(seedersDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).map((file) => this.app.resolveRuntimeScriptPath(join(seedersDir, file)));
5232
+ const files = readdirSync(seedersDir).filter((file) => /\.(ts|js|mjs|cjs)$/i.test(file)).map((file) => this.app.resolveRuntimeScriptPath(join(seedersDir, file)));
5258
5233
  return (await Promise.all(files.map(async (file) => await this.loadSeederClassesFromFile(file)))).flat();
5259
5234
  }
5260
5235
  /**
@@ -5275,7 +5250,7 @@ var SeedCommand = class extends Command {
5275
5250
  `${base}Seeder.js`,
5276
5251
  `${base}Seeder.mjs`,
5277
5252
  `${base}Seeder.cjs`
5278
- ].map((file) => join(seedersDir, file)).find((file) => existsSync$1(file));
5253
+ ].map((file) => join(seedersDir, file)).find((file) => existsSync(file));
5279
5254
  if (!target) return [];
5280
5255
  const runtimeTarget = this.app.resolveRuntimeScriptPath(target);
5281
5256
  return await this.loadSeederClassesFromFile(runtimeTarget);
@@ -8361,28 +8336,16 @@ var DB = class DB {
8361
8336
  }
8362
8337
  static createTableModel(table, options, adapter) {
8363
8338
  const primaryKey = options.primaryKey ?? "id";
8364
- const resolvedAdapter = options.adapter ?? adapter ?? DB.getAdapter();
8365
- const persistedMetadata = DB.resolvePersistedTableMetadata(table, options, resolvedAdapter);
8366
- const columns = {
8367
- ...persistedMetadata.columns,
8368
- ...options.columns ?? {}
8369
- };
8339
+ const columns = { ...options.columns ?? {} };
8370
8340
  const softDelete = options.softDelete ?? defaultSoftDeleteConfig;
8371
- const primaryKeyGeneration = options.primaryKeyGeneration ? { ...options.primaryKeyGeneration } : persistedMetadata.primaryKeyGeneration?.column === primaryKey ? {
8372
- strategy: persistedMetadata.primaryKeyGeneration.strategy,
8373
- prismaDefault: persistedMetadata.primaryKeyGeneration.prismaDefault,
8374
- databaseDefault: persistedMetadata.primaryKeyGeneration.databaseDefault,
8375
- runtimeFactory: persistedMetadata.primaryKeyGeneration.runtimeFactory
8376
- } : void 0;
8377
- const timestampColumns = options.timestampColumns?.map((column) => ({ ...column })) ?? persistedMetadata.timestampColumns?.map((column) => ({ ...column }));
8378
8341
  const buildMetadata = () => {
8379
8342
  return {
8380
8343
  table,
8381
8344
  primaryKey,
8382
8345
  columns: { ...columns },
8383
8346
  softDelete: { ...softDelete },
8384
- primaryKeyGeneration,
8385
- timestampColumns
8347
+ primaryKeyGeneration: options.primaryKeyGeneration ? { ...options.primaryKeyGeneration } : void 0,
8348
+ timestampColumns: options.timestampColumns?.map((column) => ({ ...column }))
8386
8349
  };
8387
8350
  };
8388
8351
  const modelStatic = {
@@ -8391,7 +8354,7 @@ var DB = class DB {
8391
8354
  hydrateMany: (attributes) => attributes.map((attribute) => ({ ...attribute })),
8392
8355
  hydrateRetrieved: async (attributes) => ({ ...attributes }),
8393
8356
  hydrateManyRetrieved: async (attributes) => attributes.map((attribute) => ({ ...attribute })),
8394
- getAdapter: () => resolvedAdapter,
8357
+ getAdapter: () => options.adapter ?? adapter ?? DB.getAdapter(),
8395
8358
  getColumnMap: () => ({ ...columns }),
8396
8359
  getColumnName: (attribute) => columns[attribute] ?? attribute,
8397
8360
  getDelegate: () => noopDelegate,
@@ -8404,19 +8367,6 @@ var DB = class DB {
8404
8367
  };
8405
8368
  return modelStatic;
8406
8369
  }
8407
- static resolvePersistedTableMetadata(table, options, adapter) {
8408
- if (options.persistedMetadata === false) return {
8409
- columns: {},
8410
- enums: {}
8411
- };
8412
- const persistedMetadataOptions = typeof options.persistedMetadata === "object" ? options.persistedMetadata : {};
8413
- return getPersistedTableMetadata(table, {
8414
- cwd: persistedMetadataOptions.cwd,
8415
- configuredPath: persistedMetadataOptions.configuredPath,
8416
- features: resolvePersistedMetadataFeatures(getUserConfig("features")),
8417
- strict: persistedMetadataOptions.strict ?? (Boolean(adapter) && !(adapter instanceof PrismaDatabaseAdapter))
8418
- });
8419
- }
8420
8370
  };
8421
8371
 
8422
8372
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkormx",
3
- "version": "2.0.0-next.13",
3
+ "version": "2.0.0-next.14",
4
4
  "description": "Modern TypeScript-first ORM for Node.js.",
5
5
  "keywords": [
6
6
  "orm",