arkormx 2.0.0-next.15 → 2.0.0-next.17

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
@@ -1944,7 +1944,27 @@ let runtimeClientResolver;
1944
1944
  let runtimeAdapter;
1945
1945
  let runtimePaginationURLDriverFactory;
1946
1946
  let runtimePaginationCurrentPageResolver;
1947
+ let runtimeDebugHandler;
1947
1948
  const transactionClientStorage = new AsyncLocalStorage();
1949
+ const defaultDebugHandler = (event) => {
1950
+ const prefix = `[arkorm:${event.adapter}] ${event.operation}${event.target ? ` [${event.target}]` : ""}`;
1951
+ const payload = {
1952
+ phase: event.phase,
1953
+ durationMs: event.durationMs,
1954
+ inspection: event.inspection ?? void 0,
1955
+ meta: event.meta,
1956
+ error: event.error
1957
+ };
1958
+ if (event.phase === "error") {
1959
+ console.error(prefix, payload);
1960
+ return;
1961
+ }
1962
+ console.debug(prefix, payload);
1963
+ };
1964
+ const resolveDebugHandler = (debug) => {
1965
+ if (debug === true) return defaultDebugHandler;
1966
+ return typeof debug === "function" ? debug : void 0;
1967
+ };
1948
1968
  const mergePathConfig = (paths) => {
1949
1969
  const defaults = baseConfig.paths ?? {};
1950
1970
  const current = userConfig.paths ?? {};
@@ -1999,12 +2019,14 @@ const configureArkormRuntime = (prisma, options = {}) => {
1999
2019
  if (options.pagination !== void 0) nextConfig.pagination = options.pagination;
2000
2020
  if (options.adapter !== void 0) nextConfig.adapter = options.adapter;
2001
2021
  if (options.boot !== void 0) nextConfig.boot = options.boot;
2022
+ if (options.debug !== void 0) nextConfig.debug = options.debug;
2002
2023
  if (options.outputExt !== void 0) nextConfig.outputExt = options.outputExt;
2003
2024
  Object.assign(userConfig, { ...nextConfig });
2004
2025
  runtimeClientResolver = prisma;
2005
2026
  runtimeAdapter = options.adapter;
2006
2027
  runtimePaginationURLDriverFactory = nextConfig.pagination?.urlDriver;
2007
2028
  runtimePaginationCurrentPageResolver = nextConfig.pagination?.resolveCurrentPage;
2029
+ runtimeDebugHandler = resolveDebugHandler(nextConfig.debug);
2008
2030
  options.boot?.({
2009
2031
  prisma: resolveClient(prisma),
2010
2032
  bindAdapter: bindAdapterToModels
@@ -2037,6 +2059,7 @@ const resolveAndApplyConfig = (imported) => {
2037
2059
  configureArkormRuntime(config.prisma, {
2038
2060
  adapter: config.adapter,
2039
2061
  boot: config.boot,
2062
+ debug: config.debug,
2040
2063
  features: config.features,
2041
2064
  pagination: config.pagination,
2042
2065
  paths: config.paths,