@xylex-group/athena 3.1.0 → 3.3.0
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/README.md +1 -1
- package/dist/admin.cjs +55 -1
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +32 -8
- package/dist/admin.d.ts +32 -8
- package/dist/admin.js +54 -2
- package/dist/admin.js.map +1 -1
- package/dist/athena-auth-url-C1FbVmN6.d.cts +200 -0
- package/dist/athena-auth-url-C1FbVmN6.d.ts +200 -0
- package/dist/{athena-request-headers-C7Jy-c_D.d.ts → athena-request-headers-DzimbvOA.d.ts} +48 -200
- package/dist/{athena-request-headers-DujFFyMU.d.cts → athena-request-headers-Lr_m8xCV.d.cts} +48 -200
- package/dist/billing.cjs +1 -1
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.js +1 -1
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +602 -16
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +8 -7
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +593 -17
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +141 -6
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +141 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/env.cjs +130 -0
- package/dist/env.cjs.map +1 -0
- package/dist/env.d.cts +70 -0
- package/dist/env.d.ts +70 -0
- package/dist/env.js +122 -0
- package/dist/env.js.map +1 -0
- package/dist/index.cjs +624 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +615 -20
- package/dist/index.js.map +1 -1
- package/dist/{model-form-BhWWsA-7.d.cts → model-form-3Gr8rkdT.d.cts} +24 -2
- package/dist/{model-form-BbdzJ9Uh.d.ts → model-form-CotpEL7z.d.ts} +24 -2
- package/dist/{module-xFd7_Igv.d.cts → module-CQmOaDzP.d.cts} +4 -4
- package/dist/{module-DKkJKOuJ.d.ts → module-CWkUTcUc.d.ts} +4 -4
- package/dist/next/client.cjs +123 -7
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +4 -3
- package/dist/next/client.d.ts +4 -3
- package/dist/next/client.js +123 -7
- package/dist/next/client.js.map +1 -1
- package/dist/next/server.cjs +1130 -364
- package/dist/next/server.cjs.map +1 -1
- package/dist/next/server.d.cts +121 -8
- package/dist/next/server.d.ts +121 -8
- package/dist/next/server.js +1120 -365
- package/dist/next/server.js.map +1 -1
- package/dist/{pipeline-DuKzYGia.d.cts → pipeline-BnRKO_Pd.d.cts} +1 -1
- package/dist/{pipeline-wer2G9xW.d.ts → pipeline-sWCmlFqu.d.ts} +1 -1
- package/dist/{proxy-request-headers-m4D2Tduy.d.ts → proxy-request-headers-CttlcuRb.d.ts} +1 -1
- package/dist/{proxy-request-headers-DGxdoyA0.d.cts → proxy-request-headers-pIBSn1Fw.d.cts} +1 -1
- package/dist/react.cjs +290 -31
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +59 -9
- package/dist/react.d.ts +59 -9
- package/dist/react.js +290 -32
- package/dist/react.js.map +1 -1
- package/dist/schema-handlers-BtT_IQFi.d.cts +138 -0
- package/dist/schema-handlers-VjFDhIMw.d.ts +138 -0
- package/dist/social-providers.d.cts +1 -1
- package/dist/social-providers.d.ts +1 -1
- package/dist/{types-CccOiXPo.d.ts → types-BDX8zS7w.d.ts} +12 -0
- package/dist/{types-AOY-GLu8.d.cts → types-BVKpQmfY.d.cts} +11 -0
- package/dist/{types-AOY-GLu8.d.ts → types-BVKpQmfY.d.ts} +11 -0
- package/dist/{types-1ztXDgPa.d.cts → types-D-Am7YSd.d.cts} +12 -0
- package/dist/utils.cjs +30 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +3 -2
- package/dist/utils.d.ts +3 -2
- package/dist/utils.js +30 -1
- package/dist/utils.js.map +1 -1
- package/dist/{v3-client-CWfZHcKL.d.cts → v3-client-G1SLeHRa.d.cts} +23 -1
- package/dist/{v3-client-DZp2NEhK.d.ts → v3-client-ao8BWQ8v.d.ts} +23 -1
- package/package.json +16 -2
package/dist/cli/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as runSchemaGenerator, e as ensureGeneratorConfigFile } from '../pipeline-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { r as runSchemaGenerator, e as ensureGeneratorConfigFile } from '../pipeline-BnRKO_Pd.cjs';
|
|
2
|
+
import '../types-D-Am7YSd.cjs';
|
|
3
3
|
import '../types-Bltx6iL6.cjs';
|
|
4
4
|
import '../types-CgCv5o6R.cjs';
|
|
5
5
|
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as runSchemaGenerator, e as ensureGeneratorConfigFile } from '../pipeline-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { r as runSchemaGenerator, e as ensureGeneratorConfigFile } from '../pipeline-sWCmlFqu.js';
|
|
2
|
+
import '../types-BDX8zS7w.js';
|
|
3
3
|
import '../types-Bltx6iL6.js';
|
|
4
4
|
import '../types-B75PdABb.js';
|
|
5
5
|
|
package/dist/cli/index.js
CHANGED
|
@@ -585,6 +585,13 @@ var GATEWAY_API_KEY_ENV_KEYS = [
|
|
|
585
585
|
"ATHENA_GATEWAY_API_KEY",
|
|
586
586
|
"ATHENA_GENERATOR_API_KEY"
|
|
587
587
|
];
|
|
588
|
+
var GATEWAY_CLIENT_ENV_KEYS = [
|
|
589
|
+
"ATHENA_CLIENT",
|
|
590
|
+
"ATHENA_GATEWAY_CLIENT",
|
|
591
|
+
"ATHENA_GENERATOR_CLIENT",
|
|
592
|
+
"NEXT_PUBLIC_ATHENA_CLIENT",
|
|
593
|
+
"NEXT_PUBLIC_ATHENA_GATEWAY_CLIENT"
|
|
594
|
+
];
|
|
588
595
|
var GENERATOR_SCHEMA_ENV_KEYS = ["ATHENA_GENERATOR_SCHEMAS"];
|
|
589
596
|
var OUTPUT_FORMAT_ENV_KEYS = ["ATHENA_GENERATOR_OUTPUT_FORMAT"];
|
|
590
597
|
var OUTPUT_PRESET_ENV_KEYS = ["ATHENA_GENERATOR_OUTPUT_PRESET"];
|
|
@@ -885,11 +892,13 @@ function normalizeProviderConfig(provider) {
|
|
|
885
892
|
GATEWAY_API_KEY_ENV_KEYS
|
|
886
893
|
);
|
|
887
894
|
const database = normalizeOptionalString(provider.database, POSTGRES_DATABASE_ENV_KEYS) ?? "postgres";
|
|
895
|
+
const client = normalizeOptionalString(provider.client, GATEWAY_CLIENT_ENV_KEYS);
|
|
888
896
|
return {
|
|
889
897
|
...provider,
|
|
890
898
|
gatewayUrl,
|
|
891
899
|
apiKey,
|
|
892
900
|
database,
|
|
901
|
+
...client ? { client } : {},
|
|
893
902
|
schemas: normalizeSchemaSelection(provider.schemas)
|
|
894
903
|
};
|
|
895
904
|
}
|
|
@@ -1080,6 +1089,7 @@ function buildEnvironmentProviderConfig() {
|
|
|
1080
1089
|
const apiKey = resolveFallbackValue(GATEWAY_API_KEY_ENV_KEYS);
|
|
1081
1090
|
if (gatewayUrl && apiKey) {
|
|
1082
1091
|
const backend = resolveOptionalOneOf(GATEWAY_BACKEND_ENV_KEYS, BACKEND_TYPE_VALUES);
|
|
1092
|
+
const client = resolveFallbackValue(GATEWAY_CLIENT_ENV_KEYS);
|
|
1083
1093
|
return {
|
|
1084
1094
|
kind: "postgres",
|
|
1085
1095
|
mode: "gateway",
|
|
@@ -1087,7 +1097,8 @@ function buildEnvironmentProviderConfig() {
|
|
|
1087
1097
|
apiKey,
|
|
1088
1098
|
database: normalizeOptionalString(void 0, POSTGRES_DATABASE_ENV_KEYS),
|
|
1089
1099
|
schemas: normalizeSchemaSelection(resolveFallbackValue(GENERATOR_SCHEMA_ENV_KEYS)),
|
|
1090
|
-
backend
|
|
1100
|
+
backend,
|
|
1101
|
+
...client ? { client } : {}
|
|
1091
1102
|
};
|
|
1092
1103
|
}
|
|
1093
1104
|
return void 0;
|
|
@@ -2523,7 +2534,7 @@ function buildAthenaGatewayUrl(baseUrl, path) {
|
|
|
2523
2534
|
|
|
2524
2535
|
// package.json
|
|
2525
2536
|
var package_default = {
|
|
2526
|
-
version: "3.
|
|
2537
|
+
version: "3.3.0"
|
|
2527
2538
|
};
|
|
2528
2539
|
|
|
2529
2540
|
// src/sdk-version.ts
|
|
@@ -4590,6 +4601,14 @@ function createAuthModule(config = {}, runtimeOptions = {}) {
|
|
|
4590
4601
|
changeEmailVerify: (input, options) => getWithQuery("/change-email/verify", input, options),
|
|
4591
4602
|
deleteUserVerify: (input, options) => getWithQuery("/delete-user/verify", input, options),
|
|
4592
4603
|
changePassword: (input, options) => postGeneric("/change-password", input, options),
|
|
4604
|
+
// Better Auth UI flat method aliases (also nested under session/account/social/user).
|
|
4605
|
+
listSessions: (input, options) => getGeneric("/list-sessions", input, options),
|
|
4606
|
+
revokeSession: sessionRevokeBinding,
|
|
4607
|
+
revokeOtherSessions,
|
|
4608
|
+
listAccounts: (input, options) => getGeneric("/list-accounts", input, options),
|
|
4609
|
+
unlinkAccount: (input, options) => postGeneric("/unlink-account", input, options),
|
|
4610
|
+
linkSocial: (input, options) => postGeneric("/link-social", input, options),
|
|
4611
|
+
updateUser: (input, options) => postGeneric("/update-user", input, options),
|
|
4593
4612
|
user: {
|
|
4594
4613
|
update: (input, options) => postGeneric("/update-user", input, options),
|
|
4595
4614
|
delete: (input, options) => postGeneric("/delete-user", input, options),
|
|
@@ -10252,6 +10271,82 @@ function mergeAthenaRequestContexts(base, override) {
|
|
|
10252
10271
|
};
|
|
10253
10272
|
}
|
|
10254
10273
|
|
|
10274
|
+
// src/diagnostics.ts
|
|
10275
|
+
function readProcessEnv2() {
|
|
10276
|
+
try {
|
|
10277
|
+
return globalThis.process?.env ?? {};
|
|
10278
|
+
} catch {
|
|
10279
|
+
return {};
|
|
10280
|
+
}
|
|
10281
|
+
}
|
|
10282
|
+
function isTruthyEnv(value) {
|
|
10283
|
+
if (!value) return false;
|
|
10284
|
+
const normalized = value.trim().toLowerCase();
|
|
10285
|
+
return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
|
|
10286
|
+
}
|
|
10287
|
+
function isQuietAthenaDiagnosticsEnvironment(env = readProcessEnv2()) {
|
|
10288
|
+
const nodeEnv = env.NODE_ENV?.trim().toLowerCase();
|
|
10289
|
+
if (nodeEnv === "production") {
|
|
10290
|
+
return true;
|
|
10291
|
+
}
|
|
10292
|
+
if (isTruthyEnv(env.OPENNEXT_BUILD)) {
|
|
10293
|
+
return true;
|
|
10294
|
+
}
|
|
10295
|
+
const nextPhase = env.NEXT_PHASE?.trim();
|
|
10296
|
+
if (nextPhase === "phase-production-build") {
|
|
10297
|
+
return true;
|
|
10298
|
+
}
|
|
10299
|
+
if (isTruthyEnv(env.CI) && nodeEnv !== "test") {
|
|
10300
|
+
if (nodeEnv === "production" || isTruthyEnv(env.OPENNEXT_BUILD)) {
|
|
10301
|
+
return true;
|
|
10302
|
+
}
|
|
10303
|
+
}
|
|
10304
|
+
return false;
|
|
10305
|
+
}
|
|
10306
|
+
function resolveBooleanFlag(explicit, mode, quiet) {
|
|
10307
|
+
if (typeof explicit === "boolean") {
|
|
10308
|
+
return explicit;
|
|
10309
|
+
}
|
|
10310
|
+
if (mode === true) {
|
|
10311
|
+
return true;
|
|
10312
|
+
}
|
|
10313
|
+
if (mode === false) {
|
|
10314
|
+
return false;
|
|
10315
|
+
}
|
|
10316
|
+
if (mode === "auto") {
|
|
10317
|
+
return false;
|
|
10318
|
+
}
|
|
10319
|
+
return false;
|
|
10320
|
+
}
|
|
10321
|
+
function resolveAthenaClientDiagnostics(input) {
|
|
10322
|
+
const env = input.env ?? readProcessEnv2();
|
|
10323
|
+
const quiet = isQuietAthenaDiagnosticsEnvironment(env);
|
|
10324
|
+
const mode = input.diagnostics;
|
|
10325
|
+
const effectiveMode = mode === "auto" && quiet ? false : mode;
|
|
10326
|
+
const debugAst = resolveBooleanFlag(input.debugAst, effectiveMode);
|
|
10327
|
+
const findManyAst = resolveBooleanFlag(input.findManyAst, effectiveMode);
|
|
10328
|
+
let traceQueries;
|
|
10329
|
+
if (input.traceQueries !== void 0) {
|
|
10330
|
+
if (typeof input.traceQueries === "boolean") {
|
|
10331
|
+
traceQueries = input.traceQueries;
|
|
10332
|
+
} else if (effectiveMode === false || mode === "auto" && quiet) {
|
|
10333
|
+
const enabled = input.traceQueries.enabled;
|
|
10334
|
+
traceQueries = typeof enabled === "boolean" ? enabled ? input.traceQueries : false : false;
|
|
10335
|
+
} else {
|
|
10336
|
+
traceQueries = input.traceQueries;
|
|
10337
|
+
}
|
|
10338
|
+
} else if (effectiveMode === true) {
|
|
10339
|
+
traceQueries = true;
|
|
10340
|
+
} else {
|
|
10341
|
+
traceQueries = false;
|
|
10342
|
+
}
|
|
10343
|
+
return {
|
|
10344
|
+
debugAst,
|
|
10345
|
+
findManyAst,
|
|
10346
|
+
traceQueries
|
|
10347
|
+
};
|
|
10348
|
+
}
|
|
10349
|
+
|
|
10255
10350
|
// src/v3-client.ts
|
|
10256
10351
|
var ENV_URL_KEYS = ["ATHENA_URL", "NEXT_PUBLIC_ATHENA_URL"];
|
|
10257
10352
|
var ENV_DB_URL_KEYS = ["ATHENA_DB_URL", "ATHENA_GATEWAY_URL", "NEXT_PUBLIC_ATHENA_DB_API_URL"];
|
|
@@ -10260,7 +10355,13 @@ var ENV_CHAT_URL_KEYS = ["ATHENA_CHAT_URL", "NEXT_PUBLIC_ATHENA_CHAT_URL"];
|
|
|
10260
10355
|
var ENV_CHAT_WS_URL_KEYS = ["ATHENA_CHAT_WS_URL", "NEXT_PUBLIC_ATHENA_CHAT_WS_URL"];
|
|
10261
10356
|
var ENV_STORAGE_URL_KEYS = ["ATHENA_STORAGE_URL", "NEXT_PUBLIC_ATHENA_STORAGE_URL"];
|
|
10262
10357
|
var ENV_KEY_KEYS = ["ATHENA_API_KEY", "NEXT_PUBLIC_ATHENA_API_KEY", "ATHENA_GATEWAY_API_KEY", "X_API_KEY"];
|
|
10263
|
-
var ENV_CLIENT_KEYS = [
|
|
10358
|
+
var ENV_CLIENT_KEYS = [
|
|
10359
|
+
"ATHENA_CLIENT",
|
|
10360
|
+
"ATHENA_GATEWAY_CLIENT",
|
|
10361
|
+
"ATHENA_GENERATOR_CLIENT",
|
|
10362
|
+
"NEXT_PUBLIC_ATHENA_CLIENT",
|
|
10363
|
+
"NEXT_PUBLIC_ATHENA_GATEWAY_CLIENT"
|
|
10364
|
+
];
|
|
10264
10365
|
var MISSING_DB_SENTINEL = "https://athena.invalid/db";
|
|
10265
10366
|
function readFirstEnv(env, keys) {
|
|
10266
10367
|
for (const key of keys) {
|
|
@@ -10335,6 +10436,13 @@ function createInternalConfig(core) {
|
|
|
10335
10436
|
const { config, urls } = core;
|
|
10336
10437
|
const { url: _authUrl, ...authOptions } = config.auth ?? {};
|
|
10337
10438
|
const { url: _storageUrl, directUpload, ...storageOptions } = config.storage ?? {};
|
|
10439
|
+
const diagnostics = resolveAthenaClientDiagnostics({
|
|
10440
|
+
diagnostics: config.diagnostics,
|
|
10441
|
+
debugAst: config.debugAst,
|
|
10442
|
+
findManyAst: config.findManyAst,
|
|
10443
|
+
traceQueries: config.traceQueries,
|
|
10444
|
+
env: config.env
|
|
10445
|
+
});
|
|
10338
10446
|
return {
|
|
10339
10447
|
baseUrl: urls.db ?? MISSING_DB_SENTINEL,
|
|
10340
10448
|
apiKey: core.key,
|
|
@@ -10351,9 +10459,9 @@ function createInternalConfig(core) {
|
|
|
10351
10459
|
models: config.models,
|
|
10352
10460
|
behavior: {
|
|
10353
10461
|
retryReads: config.retryReads,
|
|
10354
|
-
traceQueries:
|
|
10355
|
-
debugAst:
|
|
10356
|
-
findManyAst:
|
|
10462
|
+
traceQueries: diagnostics.traceQueries,
|
|
10463
|
+
debugAst: diagnostics.debugAst,
|
|
10464
|
+
findManyAst: diagnostics.findManyAst
|
|
10357
10465
|
},
|
|
10358
10466
|
storage: {
|
|
10359
10467
|
...storageOptions,
|
|
@@ -10427,11 +10535,30 @@ function createClientView(core, viewContext) {
|
|
|
10427
10535
|
return resolved.verifyConnection(options);
|
|
10428
10536
|
},
|
|
10429
10537
|
withContext(context) {
|
|
10538
|
+
warnIfEmptyRequestContext(context);
|
|
10430
10539
|
return createClientView(core, mergeAthenaRequestContexts(viewContext, context));
|
|
10431
10540
|
}
|
|
10432
10541
|
};
|
|
10433
10542
|
return Object.freeze(client);
|
|
10434
10543
|
}
|
|
10544
|
+
function isEmptyAthenaRequestContext(context) {
|
|
10545
|
+
if (!context) return true;
|
|
10546
|
+
const hasHeaders = context.headers != null && Object.keys(context.headers).length > 0;
|
|
10547
|
+
return context.userId == null && context.organizationId == null && !normalizeOptionalContextString(context.cookie) && !normalizeOptionalContextString(context.bearerToken) && !normalizeOptionalContextString(context.sessionToken) && !context.forceNoCache && !hasHeaders;
|
|
10548
|
+
}
|
|
10549
|
+
function normalizeOptionalContextString(value) {
|
|
10550
|
+
const trimmed = value?.trim();
|
|
10551
|
+
return trimmed || void 0;
|
|
10552
|
+
}
|
|
10553
|
+
function warnIfEmptyRequestContext(context) {
|
|
10554
|
+
if (!isEmptyAthenaRequestContext(context)) return;
|
|
10555
|
+
if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") {
|
|
10556
|
+
return;
|
|
10557
|
+
}
|
|
10558
|
+
console.warn(
|
|
10559
|
+
"[athena] withContext({}) has no userId, organizationId, cookie, bearerToken, sessionToken, headers, or forceNoCache. Gateway scope headers will not change. Pass identity fields, or use createAthenaServerClient({ session, scope })."
|
|
10560
|
+
);
|
|
10561
|
+
}
|
|
10435
10562
|
function createClient(config) {
|
|
10436
10563
|
return createClientView(resolveCore(config));
|
|
10437
10564
|
}
|
|
@@ -10532,6 +10659,8 @@ async function discoverGatewaySchemas(config) {
|
|
|
10532
10659
|
const client = createClient({
|
|
10533
10660
|
db: { url: config.gatewayUrl },
|
|
10534
10661
|
key: config.apiKey,
|
|
10662
|
+
client: config.client,
|
|
10663
|
+
env: typeof process !== "undefined" ? process.env : void 0,
|
|
10535
10664
|
backend: {
|
|
10536
10665
|
type: config.backend ?? "postgresql"
|
|
10537
10666
|
}
|
|
@@ -10618,6 +10747,7 @@ function buildGatewayProviderBlock(schemas) {
|
|
|
10618
10747
|
mode: "gateway",
|
|
10619
10748
|
gatewayUrl: generatorEnv("ATHENA_URL"),
|
|
10620
10749
|
apiKey: generatorEnv("ATHENA_API_KEY"),
|
|
10750
|
+
client: generatorEnv("ATHENA_CLIENT", { optional: true }),
|
|
10621
10751
|
database: generatorEnv("ATHENA_GENERATOR_DB", { default: "postgres" }),
|
|
10622
10752
|
schemas: ${formatStringArray(schemas, " ")},
|
|
10623
10753
|
}`;
|
|
@@ -12934,6 +13064,11 @@ var AthenaGatewayPostgresIntrospectionProvider = class {
|
|
|
12934
13064
|
this.client = createClient({
|
|
12935
13065
|
db: { url: this.config.gatewayUrl },
|
|
12936
13066
|
key: this.config.apiKey,
|
|
13067
|
+
// Multi-tenant gateways reject DEFAULT_CLIENT; prefer explicit config.
|
|
13068
|
+
// Also pass process.env so ATHENA_CLIENT / ATHENA_GATEWAY_CLIENT still resolve
|
|
13069
|
+
// when the field was not normalized into provider config.
|
|
13070
|
+
client: this.config.client,
|
|
13071
|
+
env: typeof process !== "undefined" ? process.env : void 0,
|
|
12937
13072
|
backend: {
|
|
12938
13073
|
type: this.config.backend ?? "postgresql"
|
|
12939
13074
|
}
|