@xylex-group/athena 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BackendConfig, a as BackendType, A as AthenaConditionValue, b as AthenaConditionCastType, c as AthenaConditionArrayValue, d as AthenaConditionOperator, e as AthenaGatewayCallOptions, f as AthenaGatewayErrorDetails, g as AthenaRpcCallOptions } from './errors-DQerAaXC.cjs';
2
- export { h as AthenaGatewayError, i as AthenaGatewayErrorCode, j as AthenaRpcFilter, k as AthenaRpcFilterOperator, l as AthenaRpcOrder, m as AthenaRpcPayload, n as Backend, o as isAthenaGatewayError } from './errors-DQerAaXC.cjs';
1
+ import { A as AthenaGatewayCallOptions, a as AthenaConditionValue, b as AthenaConditionCastType, c as AthenaConditionArrayValue, d as AthenaConditionOperator, e as AthenaGatewayErrorDetails, f as AthenaRpcCallOptions, B as BackendConfig, g as BackendType } from './errors-C4GJaFI_.cjs';
2
+ export { i as AthenaGatewayError, o as AthenaGatewayErrorCode, k as AthenaRpcFilter, l as AthenaRpcFilterOperator, m as AthenaRpcOrder, n as AthenaRpcPayload, h as Backend, j as isAthenaGatewayError } from './errors-C4GJaFI_.cjs';
3
3
 
4
4
  interface AthenaResult<T> {
5
5
  data: T | null;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BackendConfig, a as BackendType, A as AthenaConditionValue, b as AthenaConditionCastType, c as AthenaConditionArrayValue, d as AthenaConditionOperator, e as AthenaGatewayCallOptions, f as AthenaGatewayErrorDetails, g as AthenaRpcCallOptions } from './errors-DQerAaXC.js';
2
- export { h as AthenaGatewayError, i as AthenaGatewayErrorCode, j as AthenaRpcFilter, k as AthenaRpcFilterOperator, l as AthenaRpcOrder, m as AthenaRpcPayload, n as Backend, o as isAthenaGatewayError } from './errors-DQerAaXC.js';
1
+ import { A as AthenaGatewayCallOptions, a as AthenaConditionValue, b as AthenaConditionCastType, c as AthenaConditionArrayValue, d as AthenaConditionOperator, e as AthenaGatewayErrorDetails, f as AthenaRpcCallOptions, B as BackendConfig, g as BackendType } from './errors-C4GJaFI_.js';
2
+ export { i as AthenaGatewayError, o as AthenaGatewayErrorCode, k as AthenaRpcFilter, l as AthenaRpcFilterOperator, m as AthenaRpcOrder, n as AthenaRpcPayload, h as Backend, j as isAthenaGatewayError } from './errors-C4GJaFI_.js';
3
3
 
4
4
  interface AthenaResult<T> {
5
5
  data: T | null;
package/dist/index.js CHANGED
@@ -2238,6 +2238,13 @@ function normalizeOutputConfig(output) {
2238
2238
  }
2239
2239
  };
2240
2240
  }
2241
+ function isAthenaGeneratorConfig(value) {
2242
+ if (!value || typeof value !== "object") {
2243
+ return false;
2244
+ }
2245
+ const record = value;
2246
+ return Boolean(record.provider && typeof record.provider === "object") && Boolean(record.output && typeof record.output === "object");
2247
+ }
2241
2248
  function normalizeGeneratorConfig(input) {
2242
2249
  return {
2243
2250
  provider: input.provider,
@@ -2269,18 +2276,41 @@ function findGeneratorConfigPath(cwd = process.cwd()) {
2269
2276
  return void 0;
2270
2277
  }
2271
2278
  function extractConfigExport(module) {
2272
- if (module && typeof module === "object") {
2273
- const record = module;
2279
+ const visited = /* @__PURE__ */ new Set();
2280
+ const queue = [module];
2281
+ while (queue.length > 0) {
2282
+ const current = queue.shift();
2283
+ if (!current || typeof current !== "object" || visited.has(current)) {
2284
+ continue;
2285
+ }
2286
+ visited.add(current);
2287
+ const record = current;
2288
+ if (isAthenaGeneratorConfig(record)) {
2289
+ return record;
2290
+ }
2274
2291
  const defaultExport = record.default;
2275
2292
  if (defaultExport && typeof defaultExport === "object") {
2276
- return defaultExport;
2293
+ queue.push(defaultExport);
2277
2294
  }
2278
2295
  const namedConfigExport = record.config;
2279
2296
  if (namedConfigExport && typeof namedConfigExport === "object") {
2280
- return namedConfigExport;
2297
+ queue.push(namedConfigExport);
2298
+ }
2299
+ const moduleExports = record["module.exports"];
2300
+ if (moduleExports && typeof moduleExports === "object") {
2301
+ queue.push(moduleExports);
2281
2302
  }
2282
2303
  }
2283
- throw new Error("Generator config file must export a config object as default export or `config`.");
2304
+ throw new Error(
2305
+ "Generator config file must export a config object as default export or `config`."
2306
+ );
2307
+ }
2308
+ function importConfigModule(moduleSpecifier) {
2309
+ const runtimeImport = new Function(
2310
+ "moduleSpecifier",
2311
+ "return import(moduleSpecifier)"
2312
+ );
2313
+ return runtimeImport(moduleSpecifier);
2284
2314
  }
2285
2315
  async function loadGeneratorConfig(options = {}) {
2286
2316
  const cwd = options.cwd ?? process.cwd();
@@ -2291,7 +2321,7 @@ async function loadGeneratorConfig(options = {}) {
2291
2321
  );
2292
2322
  }
2293
2323
  const moduleUrl = pathToFileURL(resolvedPath);
2294
- const module = await import(`${moduleUrl.href}?cacheBust=${Date.now()}`);
2324
+ const module = await importConfigModule(`${moduleUrl.href}?cacheBust=${Date.now()}`);
2295
2325
  const rawConfig = extractConfigExport(module);
2296
2326
  return {
2297
2327
  configPath: resolvedPath,