@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.
@@ -220,4 +220,4 @@ declare class AthenaGatewayError extends Error {
220
220
  }
221
221
  declare function isAthenaGatewayError(error: unknown): error is AthenaGatewayError;
222
222
 
223
- export { type AthenaConditionValue as A, type BackendConfig as B, type BackendType as a, type AthenaConditionCastType as b, type AthenaConditionArrayValue as c, type AthenaConditionOperator as d, type AthenaGatewayCallOptions as e, type AthenaGatewayErrorDetails as f, type AthenaRpcCallOptions as g, AthenaGatewayError as h, type AthenaGatewayErrorCode as i, type AthenaRpcFilter as j, type AthenaRpcFilterOperator as k, type AthenaRpcOrder as l, type AthenaRpcPayload as m, Backend as n, isAthenaGatewayError as o, type AthenaGatewayHookConfig as p, type AthenaGatewayHookResult as q, type AthenaDeletePayload as r, type AthenaFetchPayload as s, type AthenaGatewayResponse as t, type AthenaInsertPayload as u, type AthenaUpdatePayload as v };
223
+ export { type AthenaGatewayCallOptions as A, type BackendConfig as B, type AthenaConditionValue as a, type AthenaConditionCastType as b, type AthenaConditionArrayValue as c, type AthenaConditionOperator as d, type AthenaGatewayErrorDetails as e, type AthenaRpcCallOptions as f, type BackendType as g, Backend as h, AthenaGatewayError as i, isAthenaGatewayError as j, type AthenaRpcFilter as k, type AthenaRpcFilterOperator as l, type AthenaRpcOrder as m, type AthenaRpcPayload as n, type AthenaGatewayErrorCode as o, type AthenaGatewayHookConfig as p, type AthenaGatewayHookResult as q, type AthenaFetchPayload as r, type AthenaInsertPayload as s, type AthenaUpdatePayload as t, type AthenaDeletePayload as u, type AthenaGatewayResponse as v };
@@ -220,4 +220,4 @@ declare class AthenaGatewayError extends Error {
220
220
  }
221
221
  declare function isAthenaGatewayError(error: unknown): error is AthenaGatewayError;
222
222
 
223
- export { type AthenaConditionValue as A, type BackendConfig as B, type BackendType as a, type AthenaConditionCastType as b, type AthenaConditionArrayValue as c, type AthenaConditionOperator as d, type AthenaGatewayCallOptions as e, type AthenaGatewayErrorDetails as f, type AthenaRpcCallOptions as g, AthenaGatewayError as h, type AthenaGatewayErrorCode as i, type AthenaRpcFilter as j, type AthenaRpcFilterOperator as k, type AthenaRpcOrder as l, type AthenaRpcPayload as m, Backend as n, isAthenaGatewayError as o, type AthenaGatewayHookConfig as p, type AthenaGatewayHookResult as q, type AthenaDeletePayload as r, type AthenaFetchPayload as s, type AthenaGatewayResponse as t, type AthenaInsertPayload as u, type AthenaUpdatePayload as v };
223
+ export { type AthenaGatewayCallOptions as A, type BackendConfig as B, type AthenaConditionValue as a, type AthenaConditionCastType as b, type AthenaConditionArrayValue as c, type AthenaConditionOperator as d, type AthenaGatewayErrorDetails as e, type AthenaRpcCallOptions as f, type BackendType as g, Backend as h, AthenaGatewayError as i, isAthenaGatewayError as j, type AthenaRpcFilter as k, type AthenaRpcFilterOperator as l, type AthenaRpcOrder as m, type AthenaRpcPayload as n, type AthenaGatewayErrorCode as o, type AthenaGatewayHookConfig as p, type AthenaGatewayHookResult as q, type AthenaFetchPayload as r, type AthenaInsertPayload as s, type AthenaUpdatePayload as t, type AthenaDeletePayload as u, type AthenaGatewayResponse as v };
package/dist/index.cjs CHANGED
@@ -2240,6 +2240,13 @@ function normalizeOutputConfig(output) {
2240
2240
  }
2241
2241
  };
2242
2242
  }
2243
+ function isAthenaGeneratorConfig(value) {
2244
+ if (!value || typeof value !== "object") {
2245
+ return false;
2246
+ }
2247
+ const record = value;
2248
+ return Boolean(record.provider && typeof record.provider === "object") && Boolean(record.output && typeof record.output === "object");
2249
+ }
2243
2250
  function normalizeGeneratorConfig(input) {
2244
2251
  return {
2245
2252
  provider: input.provider,
@@ -2271,18 +2278,41 @@ function findGeneratorConfigPath(cwd = process.cwd()) {
2271
2278
  return void 0;
2272
2279
  }
2273
2280
  function extractConfigExport(module) {
2274
- if (module && typeof module === "object") {
2275
- const record = module;
2281
+ const visited = /* @__PURE__ */ new Set();
2282
+ const queue = [module];
2283
+ while (queue.length > 0) {
2284
+ const current = queue.shift();
2285
+ if (!current || typeof current !== "object" || visited.has(current)) {
2286
+ continue;
2287
+ }
2288
+ visited.add(current);
2289
+ const record = current;
2290
+ if (isAthenaGeneratorConfig(record)) {
2291
+ return record;
2292
+ }
2276
2293
  const defaultExport = record.default;
2277
2294
  if (defaultExport && typeof defaultExport === "object") {
2278
- return defaultExport;
2295
+ queue.push(defaultExport);
2279
2296
  }
2280
2297
  const namedConfigExport = record.config;
2281
2298
  if (namedConfigExport && typeof namedConfigExport === "object") {
2282
- return namedConfigExport;
2299
+ queue.push(namedConfigExport);
2300
+ }
2301
+ const moduleExports = record["module.exports"];
2302
+ if (moduleExports && typeof moduleExports === "object") {
2303
+ queue.push(moduleExports);
2283
2304
  }
2284
2305
  }
2285
- throw new Error("Generator config file must export a config object as default export or `config`.");
2306
+ throw new Error(
2307
+ "Generator config file must export a config object as default export or `config`."
2308
+ );
2309
+ }
2310
+ function importConfigModule(moduleSpecifier) {
2311
+ const runtimeImport = new Function(
2312
+ "moduleSpecifier",
2313
+ "return import(moduleSpecifier)"
2314
+ );
2315
+ return runtimeImport(moduleSpecifier);
2286
2316
  }
2287
2317
  async function loadGeneratorConfig(options = {}) {
2288
2318
  const cwd = options.cwd ?? process.cwd();
@@ -2293,7 +2323,7 @@ async function loadGeneratorConfig(options = {}) {
2293
2323
  );
2294
2324
  }
2295
2325
  const moduleUrl = url.pathToFileURL(resolvedPath);
2296
- const module = await import(`${moduleUrl.href}?cacheBust=${Date.now()}`);
2326
+ const module = await importConfigModule(`${moduleUrl.href}?cacheBust=${Date.now()}`);
2297
2327
  const rawConfig = extractConfigExport(module);
2298
2328
  return {
2299
2329
  configPath: resolvedPath,