@xylex-group/athena 3.0.0 → 3.0.3
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 +24 -10
- package/dist/{athena-auth-url-oLux_57a.d.cts → athena-request-headers-C7Jy-c_D.d.ts} +85 -1
- package/dist/{athena-auth-url-oLux_57a.d.ts → athena-request-headers-DujFFyMU.d.cts} +85 -1
- package/dist/billing.cjs +133 -21
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +41 -1
- package/dist/billing.d.ts +41 -1
- package/dist/billing.js +133 -21
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +138 -45
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +9 -9
- package/dist/browser.d.ts +9 -9
- package/dist/browser.js +138 -45
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +1038 -57
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -3
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +1039 -58
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +977 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +978 -55
- package/dist/index.js.map +1 -1
- package/dist/{model-form-BKetpu6Q.d.ts → model-form-Dh0sisdL.d.ts} +1 -1
- package/dist/{model-form-BEfCGB5b.d.cts → model-form-oOAJUVd4.d.cts} +1 -1
- package/dist/{module-Bef_MAPO.d.ts → module-BruTcxe0.d.ts} +17 -5
- package/dist/{module-CrrSmpML.d.cts → module-CPG3ULxQ.d.cts} +17 -5
- package/dist/{module-8dSMcy0K.d.cts → module-C_ab-MM1.d.cts} +46 -12
- package/dist/{module-8dSMcy0K.d.ts → module-C_ab-MM1.d.ts} +46 -12
- package/dist/next/client.cjs +9817 -3
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +26 -1
- package/dist/next/client.d.ts +26 -1
- package/dist/next/client.js +9788 -4
- package/dist/next/client.js.map +1 -1
- package/dist/next/server.cjs +10398 -42
- package/dist/next/server.cjs.map +1 -1
- package/dist/next/server.d.cts +39 -4
- package/dist/next/server.d.ts +39 -4
- package/dist/next/server.js +10339 -43
- package/dist/next/server.js.map +1 -1
- package/dist/{pipeline-Dfsed4VD.d.cts → pipeline-CIzV9f7b.d.cts} +1 -1
- package/dist/{pipeline-BXFQbsUW.d.ts → pipeline-DNlc8Ayn.d.ts} +1 -1
- package/dist/proxy-request-headers-DGxdoyA0.d.cts +59 -0
- package/dist/proxy-request-headers-m4D2Tduy.d.ts +59 -0
- package/dist/react.cjs +7 -7
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +4 -4
- package/dist/react.d.ts +4 -4
- package/dist/react.js +7 -7
- package/dist/react.js.map +1 -1
- package/dist/social-providers.cjs +15 -11
- package/dist/social-providers.cjs.map +1 -1
- package/dist/social-providers.d.cts +17 -57
- package/dist/social-providers.d.ts +17 -57
- package/dist/social-providers.js +15 -11
- package/dist/social-providers.js.map +1 -1
- package/dist/{types-jClgDy1J.d.ts → types-B75PdABb.d.ts} +1 -1
- package/dist/{types-kO_Ut5wU.d.cts → types-CgCv5o6R.d.cts} +1 -1
- package/dist/{types-CK7cBQbC.d.ts → types-D6tZ9aoq.d.ts} +35 -2
- package/dist/{types-Z3-rsiM3.d.cts → types-DFr2cL1N.d.cts} +35 -2
- package/dist/utils.d.cts +4 -142
- package/dist/utils.d.ts +4 -142
- package/dist/{v3-client-G8JMOilK.d.cts → v3-client-CWfZHcKL.d.cts} +37 -21
- package/dist/{v3-client-CuCNy-JJ.d.ts → v3-client-DZp2NEhK.d.ts} +37 -21
- package/package.json +6 -3
|
@@ -249,4 +249,4 @@ interface SchemaIntrospectionProvider {
|
|
|
249
249
|
inspect(options?: IntrospectionInspectOptions): Promise<IntrospectionSnapshot>;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
export type { AthenaModelTarget as A, DatabaseDef as D, IntrospectionSnapshot as I, ModelAt as M, RegistryDef as R, SchemaIntrospectionProvider as S, TenantContext as T, UpdateOf as U, InsertOf as a, IntrospectionColumn as b, IntrospectionInspectOptions as c, IntrospectionRelation as d, IntrospectionSchema as e, IntrospectionTable as f, IntrospectionTypeKind as g, ModelColumnKind as h, ModelColumnMetadata as i, ModelDef as j, ModelMetadata as k, ModelRelationKind as l, ModelRelationMetadata as m, RowOf as n, SchemaDef as o, TenantContextValue as p, TenantKeyMap as q,
|
|
252
|
+
export type { AthenaModelTarget as A, DatabaseDef as D, IntrospectionSnapshot as I, ModelAt as M, RegistryDef as R, SchemaIntrospectionProvider as S, TenantContext as T, UpdateOf as U, InsertOf as a, IntrospectionColumn as b, IntrospectionInspectOptions as c, IntrospectionRelation as d, IntrospectionSchema as e, IntrospectionTable as f, IntrospectionTypeKind as g, ModelColumnKind as h, ModelColumnMetadata as i, ModelDef as j, ModelMetadata as k, ModelRelationKind as l, ModelRelationMetadata as m, RowOf as n, SchemaDef as o, TenantContextValue as p, TenantKeyMap as q, AthenaClientModelsInput as r, AnyModelDef as s, AthenaClientModelForTableName as t, AthenaClientTableName as u };
|
|
@@ -249,4 +249,4 @@ interface SchemaIntrospectionProvider {
|
|
|
249
249
|
inspect(options?: IntrospectionInspectOptions): Promise<IntrospectionSnapshot>;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
export type { AthenaModelTarget as A, DatabaseDef as D, IntrospectionSnapshot as I, ModelAt as M, RegistryDef as R, SchemaIntrospectionProvider as S, TenantContext as T, UpdateOf as U, InsertOf as a, IntrospectionColumn as b, IntrospectionInspectOptions as c, IntrospectionRelation as d, IntrospectionSchema as e, IntrospectionTable as f, IntrospectionTypeKind as g, ModelColumnKind as h, ModelColumnMetadata as i, ModelDef as j, ModelMetadata as k, ModelRelationKind as l, ModelRelationMetadata as m, RowOf as n, SchemaDef as o, TenantContextValue as p, TenantKeyMap as q,
|
|
252
|
+
export type { AthenaModelTarget as A, DatabaseDef as D, IntrospectionSnapshot as I, ModelAt as M, RegistryDef as R, SchemaIntrospectionProvider as S, TenantContext as T, UpdateOf as U, InsertOf as a, IntrospectionColumn as b, IntrospectionInspectOptions as c, IntrospectionRelation as d, IntrospectionSchema as e, IntrospectionTable as f, IntrospectionTypeKind as g, ModelColumnKind as h, ModelColumnMetadata as i, ModelDef as j, ModelMetadata as k, ModelRelationKind as l, ModelRelationMetadata as m, RowOf as n, SchemaDef as o, TenantContextValue as p, TenantKeyMap as q, AthenaClientModelsInput as r, AnyModelDef as s, AthenaClientModelForTableName as t, AthenaClientTableName as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as BackendType } from './types-Bltx6iL6.js';
|
|
2
|
-
import { I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-
|
|
2
|
+
import { I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-B75PdABb.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Supported case transformations for generated symbols and path token variants.
|
|
@@ -54,6 +54,21 @@ interface GeneratorOutputTargets {
|
|
|
54
54
|
}
|
|
55
55
|
type GeneratorOutputPreset = 'legacy' | 'athena-direct';
|
|
56
56
|
type GeneratorOutputFormat = 'define-model' | 'table-builder';
|
|
57
|
+
/**
|
|
58
|
+
* How existing database/registry artifacts are handled on regenerate.
|
|
59
|
+
*
|
|
60
|
+
* - `merge` (default): additive smart merge — append missing imports/keys, preserve custom code
|
|
61
|
+
* - `skip`: never rewrite existing files (legacy protect behavior)
|
|
62
|
+
* - `overwrite`: always replace with pure generated content
|
|
63
|
+
*/
|
|
64
|
+
type GeneratorArtifactWritePolicy = 'merge' | 'skip' | 'overwrite';
|
|
65
|
+
/**
|
|
66
|
+
* Per-kind write policy for protected generator artifacts.
|
|
67
|
+
*/
|
|
68
|
+
interface GeneratorArtifactWriteConfig {
|
|
69
|
+
database?: GeneratorArtifactWritePolicy;
|
|
70
|
+
registry?: GeneratorArtifactWritePolicy;
|
|
71
|
+
}
|
|
57
72
|
/**
|
|
58
73
|
* Output configuration including dynamic placeholder aliases.
|
|
59
74
|
*/
|
|
@@ -62,6 +77,7 @@ interface GeneratorOutputConfig {
|
|
|
62
77
|
preset?: GeneratorOutputPreset;
|
|
63
78
|
targets?: Partial<GeneratorOutputTargets>;
|
|
64
79
|
placeholderMap?: Record<string, string>;
|
|
80
|
+
artifactWrite?: GeneratorArtifactWriteConfig;
|
|
65
81
|
}
|
|
66
82
|
/**
|
|
67
83
|
* Normalized output configuration with defaults applied.
|
|
@@ -71,6 +87,10 @@ interface NormalizedGeneratorOutputConfig {
|
|
|
71
87
|
preset: GeneratorOutputPreset;
|
|
72
88
|
targets: GeneratorOutputTargets;
|
|
73
89
|
placeholderMap: Record<string, string>;
|
|
90
|
+
artifactWrite: {
|
|
91
|
+
database: GeneratorArtifactWritePolicy;
|
|
92
|
+
registry: GeneratorArtifactWritePolicy;
|
|
93
|
+
};
|
|
74
94
|
}
|
|
75
95
|
/**
|
|
76
96
|
* Schemas selected for PostgreSQL introspection. Strings may be comma-separated
|
|
@@ -215,13 +235,26 @@ interface RunGeneratorResult extends GeneratedArtifacts {
|
|
|
215
235
|
configPath: string;
|
|
216
236
|
config: NormalizedAthenaGeneratorConfig;
|
|
217
237
|
writtenFiles: string[];
|
|
238
|
+
writtenDetails: WrittenGeneratedArtifact[];
|
|
218
239
|
skippedFiles: SkippedGeneratedArtifact[];
|
|
219
240
|
}
|
|
220
|
-
type SkippedGeneratedArtifactReason = 'protected-existing-file';
|
|
241
|
+
type SkippedGeneratedArtifactReason = 'protected-existing-file' | 'merge-conflict' | 'merge-lint-failed' | 'merge-unparseable' | 'already-current';
|
|
242
|
+
type WrittenGeneratedArtifactReason = 'created' | 'overwritten' | 'merged';
|
|
221
243
|
interface SkippedGeneratedArtifact {
|
|
222
244
|
kind: GeneratorArtifactKind;
|
|
223
245
|
path: string;
|
|
224
246
|
reason: SkippedGeneratedArtifactReason;
|
|
247
|
+
detail?: string;
|
|
248
|
+
preservedCustom?: string[];
|
|
249
|
+
conflicts?: string[];
|
|
250
|
+
lintErrors?: string[];
|
|
251
|
+
}
|
|
252
|
+
interface WrittenGeneratedArtifact {
|
|
253
|
+
kind: GeneratorArtifactKind;
|
|
254
|
+
path: string;
|
|
255
|
+
reason: WrittenGeneratedArtifactReason;
|
|
256
|
+
added?: string[];
|
|
257
|
+
preservedCustom?: string[];
|
|
225
258
|
}
|
|
226
259
|
|
|
227
260
|
export type { AthenaGeneratorConfig as A, GeneratedArtifacts as G, LoadGeneratorConfigOptions as L, NormalizedAthenaGeneratorConfig as N, RunGeneratorOptions as R, SkippedGeneratedArtifact as S, LoadedGeneratorConfig as a, GeneratorProviderConfig as b, GeneratorExperimentalFlags as c, RunGeneratorResult as d, GeneratedArtifact as e, GeneratorArtifactKind as f, GeneratorFeatureFlags as g, GeneratorFilterConfig as h, GeneratorInternalConfig as i, GeneratorNamingConfig as j, GeneratorOutputConfig as k, GeneratorOutputFormat as l, GeneratorOutputPreset as m, GeneratorOutputTargets as n, GeneratorSchemaSelection as o, GeneratorTableSelection as p, NamingStyle as q, NormalizedGeneratorFilterConfig as r, NormalizedGeneratorOutputConfig as s, SkippedGeneratedArtifactReason as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as BackendType } from './types-Bltx6iL6.cjs';
|
|
2
|
-
import { I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-
|
|
2
|
+
import { I as IntrospectionSnapshot, S as SchemaIntrospectionProvider } from './types-CgCv5o6R.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Supported case transformations for generated symbols and path token variants.
|
|
@@ -54,6 +54,21 @@ interface GeneratorOutputTargets {
|
|
|
54
54
|
}
|
|
55
55
|
type GeneratorOutputPreset = 'legacy' | 'athena-direct';
|
|
56
56
|
type GeneratorOutputFormat = 'define-model' | 'table-builder';
|
|
57
|
+
/**
|
|
58
|
+
* How existing database/registry artifacts are handled on regenerate.
|
|
59
|
+
*
|
|
60
|
+
* - `merge` (default): additive smart merge — append missing imports/keys, preserve custom code
|
|
61
|
+
* - `skip`: never rewrite existing files (legacy protect behavior)
|
|
62
|
+
* - `overwrite`: always replace with pure generated content
|
|
63
|
+
*/
|
|
64
|
+
type GeneratorArtifactWritePolicy = 'merge' | 'skip' | 'overwrite';
|
|
65
|
+
/**
|
|
66
|
+
* Per-kind write policy for protected generator artifacts.
|
|
67
|
+
*/
|
|
68
|
+
interface GeneratorArtifactWriteConfig {
|
|
69
|
+
database?: GeneratorArtifactWritePolicy;
|
|
70
|
+
registry?: GeneratorArtifactWritePolicy;
|
|
71
|
+
}
|
|
57
72
|
/**
|
|
58
73
|
* Output configuration including dynamic placeholder aliases.
|
|
59
74
|
*/
|
|
@@ -62,6 +77,7 @@ interface GeneratorOutputConfig {
|
|
|
62
77
|
preset?: GeneratorOutputPreset;
|
|
63
78
|
targets?: Partial<GeneratorOutputTargets>;
|
|
64
79
|
placeholderMap?: Record<string, string>;
|
|
80
|
+
artifactWrite?: GeneratorArtifactWriteConfig;
|
|
65
81
|
}
|
|
66
82
|
/**
|
|
67
83
|
* Normalized output configuration with defaults applied.
|
|
@@ -71,6 +87,10 @@ interface NormalizedGeneratorOutputConfig {
|
|
|
71
87
|
preset: GeneratorOutputPreset;
|
|
72
88
|
targets: GeneratorOutputTargets;
|
|
73
89
|
placeholderMap: Record<string, string>;
|
|
90
|
+
artifactWrite: {
|
|
91
|
+
database: GeneratorArtifactWritePolicy;
|
|
92
|
+
registry: GeneratorArtifactWritePolicy;
|
|
93
|
+
};
|
|
74
94
|
}
|
|
75
95
|
/**
|
|
76
96
|
* Schemas selected for PostgreSQL introspection. Strings may be comma-separated
|
|
@@ -215,13 +235,26 @@ interface RunGeneratorResult extends GeneratedArtifacts {
|
|
|
215
235
|
configPath: string;
|
|
216
236
|
config: NormalizedAthenaGeneratorConfig;
|
|
217
237
|
writtenFiles: string[];
|
|
238
|
+
writtenDetails: WrittenGeneratedArtifact[];
|
|
218
239
|
skippedFiles: SkippedGeneratedArtifact[];
|
|
219
240
|
}
|
|
220
|
-
type SkippedGeneratedArtifactReason = 'protected-existing-file';
|
|
241
|
+
type SkippedGeneratedArtifactReason = 'protected-existing-file' | 'merge-conflict' | 'merge-lint-failed' | 'merge-unparseable' | 'already-current';
|
|
242
|
+
type WrittenGeneratedArtifactReason = 'created' | 'overwritten' | 'merged';
|
|
221
243
|
interface SkippedGeneratedArtifact {
|
|
222
244
|
kind: GeneratorArtifactKind;
|
|
223
245
|
path: string;
|
|
224
246
|
reason: SkippedGeneratedArtifactReason;
|
|
247
|
+
detail?: string;
|
|
248
|
+
preservedCustom?: string[];
|
|
249
|
+
conflicts?: string[];
|
|
250
|
+
lintErrors?: string[];
|
|
251
|
+
}
|
|
252
|
+
interface WrittenGeneratedArtifact {
|
|
253
|
+
kind: GeneratorArtifactKind;
|
|
254
|
+
path: string;
|
|
255
|
+
reason: WrittenGeneratedArtifactReason;
|
|
256
|
+
added?: string[];
|
|
257
|
+
preservedCustom?: string[];
|
|
225
258
|
}
|
|
226
259
|
|
|
227
260
|
export type { AthenaGeneratorConfig as A, GeneratedArtifacts as G, LoadGeneratorConfigOptions as L, NormalizedAthenaGeneratorConfig as N, RunGeneratorOptions as R, SkippedGeneratedArtifact as S, LoadedGeneratorConfig as a, GeneratorProviderConfig as b, GeneratorExperimentalFlags as c, RunGeneratorResult as d, GeneratedArtifact as e, GeneratorArtifactKind as f, GeneratorFeatureFlags as g, GeneratorFilterConfig as h, GeneratorInternalConfig as i, GeneratorNamingConfig as j, GeneratorOutputConfig as k, GeneratorOutputFormat as l, GeneratorOutputPreset as m, GeneratorOutputTargets as n, GeneratorSchemaSelection as o, GeneratorTableSelection as p, NamingStyle as q, NormalizedGeneratorFilterConfig as r, NormalizedGeneratorOutputConfig as s, SkippedGeneratedArtifactReason as t };
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,154 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
export { A as ATHENA_AUTH_COOKIE_PREFIXES, a as ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_PARAM, b as ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_VALUE, c as ATHENA_AUTH_GET_SESSION_ABSOLUTE_PATH, d as ATHENA_AUTH_GET_SESSION_PATH, e as ATHENA_AUTH_PATH, f as ATHENA_AUTH_UPSTREAM_ENV_KEYS, g as ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES, h as ATHENA_AUTH_VERIFY_EMAIL_PATH, i as ATHENA_SESSION_DATA_HEADER, j as AUTHENTICATED_REDIRECT_MODE_SET, k as AUTHENTICATED_REDIRECT_VIEW_SET, l as AUTH_DEFAULT_VIEW, m as AUTH_MODE_REDIRECTS, n as AUTH_MODE_SET, o as AUTH_ROUTES, p as AUTH_SESSION_PATH, q as AUTH_TWO_FACTOR_SEGMENT, r as AUTH_VIEW_BY_SEGMENT, s as AthenaAuthClientBaseUrlOptions, t as AthenaAuthUpstreamEnv, u as AthenaAuthUpstreamEnvKey, v as AthenaRequestHeaderOverrideFields, w as AthenaRequestHeaderProfile, x as AuthMode, y as AuthModeRedirects, z as AuthRoutes, B as AuthView, C as BuildAthenaRequestHeadersInput, D as ClearAuthCookiesOptions, E as DEFAULT_ATHENA_AUTH_ORIGIN, F as DEFAULT_ATHENA_AUTH_UPSTREAM_URL, ac as DEFAULT_AUTH_COOKIE_PREFIXES, G as DISABLE_COOKIE_CACHE_QUERY_PARAM, H as DISABLE_COOKIE_CACHE_QUERY_VALUE, I as EnvLike, L as LOCAL_DEV_ORIGIN, a4 as ResolvedRequestHeaderOverrides, S as SESSION_DATA_HEADER, a5 as applyAthenaApiKeyHeaders, a6 as applyAthenaAuthContextHeaders, a7 as applyAthenaPgUriHeaders, ad as asBoolean, ae as asBooleanOrNull, af as asIdentifier, J as asNonEmptyString, ag as asNumber, ah as asRecord, K as asString, ai as asStringArray, M as buildAthenaGatewayHeaders, N as buildAthenaRequestHeaders, a8 as buildServiceRequestHeaders, O as clearAuthCookies, P as createAuthModeRedirects, Q as createAuthRoutes, R as createFreshSessionLookupUrl, aj as firstString, a9 as hasHeaderIgnoreCase, T as isAbsoluteUrl, U as isAuthMode, V as normalizeAthenaAuthBaseUrl, W as readAthenaAuthUpstreamUrlFromEnv, X as readTrimmedString, Y as resolveAthenaAuthClientBaseUrl, Z as resolveAthenaAuthRequestUrl, _ as resolveAthenaAuthUpstreamUrl, $ as resolveAuthModeRedirect, a0 as resolveAuthViewFromSegment, a1 as resolveEmailVerificationCallbackUrl, aa as resolveHeaderValue, ab as resolveRequestHeaderOverrides, a2 as shouldRedirectAuthenticatedAuthMode, a3 as shouldRedirectAuthenticatedAuthView } from './athena-request-headers-DujFFyMU.cjs';
|
|
2
|
+
export { G as GetOriginFromHeadersOptions, g as getOriginFromHeaders, i as isDynamicServerUsageError, p as proxyRequestHeaders, r as readEnv, a as requireEnv } from './proxy-request-headers-DGxdoyA0.cjs';
|
|
3
3
|
export { S as SESSION_COOKIE_PATTERNS, h as hasAuthSessionCookie } from './session-cookie-detection-BqOp9mO6.cjs';
|
|
4
|
-
import
|
|
4
|
+
import './types-Bltx6iL6.cjs';
|
|
5
5
|
|
|
6
6
|
declare function slugify(input: string): string;
|
|
7
7
|
|
|
8
8
|
declare function trimTrailingSlashes(value: string): string;
|
|
9
9
|
|
|
10
|
-
declare function asString(value: unknown): string | null;
|
|
11
|
-
declare function asBoolean(value: unknown): boolean;
|
|
12
|
-
declare function asBooleanOrNull(value: unknown): boolean | null;
|
|
13
|
-
declare function asRecord(value: unknown): Record<string, unknown> | null;
|
|
14
|
-
declare function asIdentifier(value: unknown): string | null;
|
|
15
|
-
declare function firstString(record: Record<string, unknown> | null | undefined, keys: readonly string[]): string | null;
|
|
16
|
-
declare function readTrimmedString(value: unknown): string | null;
|
|
17
|
-
/**
|
|
18
|
-
* Trim a string value; return `undefined` when not a non-empty string.
|
|
19
|
-
*
|
|
20
|
-
* Unlike {@link asString}, does not coerce numbers/bigints.
|
|
21
|
-
* Unlike {@link readTrimmedString}, returns `undefined` instead of `null`
|
|
22
|
-
* (handy for optional fields and `??` defaults).
|
|
23
|
-
*/
|
|
24
|
-
declare function asNonEmptyString(value: unknown): string | undefined;
|
|
25
|
-
declare function asNumber(value: unknown): number | null;
|
|
26
|
-
declare function asStringArray(value: unknown): string[];
|
|
27
|
-
|
|
28
10
|
declare function parseBooleanFlag(rawValue: string | undefined, fallback: boolean): boolean;
|
|
29
11
|
|
|
30
|
-
/**
|
|
31
|
-
* Read the first non-empty trimmed environment variable from a name list.
|
|
32
|
-
*
|
|
33
|
-
* @param names - Candidate env keys in priority order
|
|
34
|
-
* @param env - Optional env map (defaults to `process.env`)
|
|
35
|
-
* @returns Trimmed value of the first key that is set and non-empty
|
|
36
|
-
* @throws {Error} When none of the keys yield a non-empty value
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* import { requireEnv } from "@xylex-group/athena/utils"
|
|
41
|
-
*
|
|
42
|
-
* const authUrl = requireEnv([
|
|
43
|
-
* "ATHENA_AUTH_UPSTREAM_URL",
|
|
44
|
-
* "ATHENA_AUTH_URL",
|
|
45
|
-
* "NEXT_PUBLIC_ATHENA_AUTH_URL",
|
|
46
|
-
* ])
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
declare function requireEnv(names: readonly string[], env?: EnvLike): string;
|
|
50
|
-
/**
|
|
51
|
-
* Like {@link requireEnv}, but returns `undefined` instead of throwing when
|
|
52
|
-
* none of the keys are set.
|
|
53
|
-
*/
|
|
54
|
-
declare function readEnv(names: readonly string[], env?: EnvLike): string | undefined;
|
|
55
|
-
|
|
56
12
|
declare function isLocalHostname(hostname: string): boolean;
|
|
57
13
|
|
|
58
|
-
/**
|
|
59
|
-
* Request header / Next.js helpers used by middleware and RSC session loaders.
|
|
60
|
-
* Framework-agnostic (no Next imports).
|
|
61
|
-
*/
|
|
62
|
-
/**
|
|
63
|
-
* True when Next.js threw because the route used dynamic APIs during static
|
|
64
|
-
* generation (`DYNAMIC_SERVER_USAGE` digest or matching message).
|
|
65
|
-
*
|
|
66
|
-
* Catch and rethrow (or handle) so Next can mark the route dynamic.
|
|
67
|
-
*/
|
|
68
|
-
declare function isDynamicServerUsageError(error: unknown): boolean;
|
|
69
|
-
interface GetOriginFromHeadersOptions {
|
|
70
|
-
/**
|
|
71
|
-
* When `x-forwarded-proto` / scheme is missing, use `http` if true else `https`.
|
|
72
|
-
* Typical: `process.env.NODE_ENV !== "production"`.
|
|
73
|
-
*/
|
|
74
|
-
preferHttpWhenMissingProto?: boolean;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Reconstruct public origin from request headers (Origin, or Host + proto).
|
|
78
|
-
*
|
|
79
|
-
* Prefers `Origin`, then `x-forwarded-host` / `host` with
|
|
80
|
-
* `x-forwarded-proto` (first value when comma-separated).
|
|
81
|
-
*/
|
|
82
|
-
declare function getOriginFromHeaders(headersList: {
|
|
83
|
-
get: (name: string) => string | null;
|
|
84
|
-
}, options?: GetOriginFromHeadersOptions): string | null;
|
|
85
|
-
|
|
86
|
-
declare function proxyRequestHeaders(request: Request): Headers;
|
|
87
|
-
|
|
88
|
-
type AthenaRequestHeaderProfile = 'gateway' | 'auth' | 'chat' | 'storage' | 'minimal';
|
|
89
|
-
interface BuildAthenaRequestHeadersInput {
|
|
90
|
-
profile: AthenaRequestHeaderProfile;
|
|
91
|
-
sdkHeaderValue: string;
|
|
92
|
-
apiKey?: string | null;
|
|
93
|
-
client?: string | null;
|
|
94
|
-
userId?: string | null;
|
|
95
|
-
organizationId?: string | null;
|
|
96
|
-
backend?: BackendOption;
|
|
97
|
-
publishEvent?: string | null;
|
|
98
|
-
stripNulls?: boolean;
|
|
99
|
-
bearerToken?: string | null;
|
|
100
|
-
cookie?: string | null;
|
|
101
|
-
sessionToken?: string | null;
|
|
102
|
-
pgUri?: string | null;
|
|
103
|
-
jdbcUrl?: string | null;
|
|
104
|
-
forceNoCache?: boolean;
|
|
105
|
-
configHeaders?: Record<string, string>;
|
|
106
|
-
callHeaders?: Record<string, string>;
|
|
107
|
-
contentType?: string | null;
|
|
108
|
-
accept?: string | null;
|
|
109
|
-
}
|
|
110
|
-
/** Shared config/call fields consumed by gateway, chat, auth, and `client.request(...)`. */
|
|
111
|
-
interface AthenaRequestHeaderOverrideFields {
|
|
112
|
-
apiKey?: string | null;
|
|
113
|
-
client?: string | null;
|
|
114
|
-
userId?: string | null;
|
|
115
|
-
organizationId?: string | null;
|
|
116
|
-
backend?: BackendOption;
|
|
117
|
-
publishEvent?: string | null;
|
|
118
|
-
stripNulls?: boolean;
|
|
119
|
-
bearerToken?: string | null;
|
|
120
|
-
cookie?: string | null;
|
|
121
|
-
sessionToken?: string | null;
|
|
122
|
-
pgUri?: string | null;
|
|
123
|
-
jdbcUrl?: string | null;
|
|
124
|
-
forceNoCache?: boolean;
|
|
125
|
-
headers?: Record<string, string>;
|
|
126
|
-
}
|
|
127
|
-
type ResolvedRequestHeaderOverrides = Omit<BuildAthenaRequestHeadersInput, 'profile' | 'sdkHeaderValue' | 'contentType' | 'accept'>;
|
|
128
|
-
declare function hasHeaderIgnoreCase(headers: Record<string, string>, targetKey: string): boolean;
|
|
129
|
-
declare function resolveHeaderValue(headers: Record<string, string>, candidates: readonly string[]): string | undefined;
|
|
130
|
-
declare function resolveRequestHeaderOverrides(config: AthenaRequestHeaderOverrideFields, options?: AthenaRequestHeaderOverrideFields, defaults?: Pick<AthenaRequestHeaderOverrideFields, 'client' | 'stripNulls'>): ResolvedRequestHeaderOverrides;
|
|
131
|
-
declare function buildServiceRequestHeaders(profile: Exclude<AthenaRequestHeaderProfile, 'minimal'>, sdkHeaderValue: string, config: AthenaRequestHeaderOverrideFields, options?: AthenaRequestHeaderOverrideFields, extras?: Pick<BuildAthenaRequestHeadersInput, 'contentType' | 'accept'> & {
|
|
132
|
-
client?: string | null;
|
|
133
|
-
stripNulls?: boolean;
|
|
134
|
-
}): Record<string, string>;
|
|
135
|
-
declare function applyAthenaApiKeyHeaders(headers: Record<string, string>, apiKey?: string | null): void;
|
|
136
|
-
declare function applyAthenaAuthContextHeaders(headers: Record<string, string>, input: Pick<BuildAthenaRequestHeadersInput, 'bearerToken' | 'cookie' | 'sessionToken' | 'profile' | 'configHeaders' | 'callHeaders'>): void;
|
|
137
|
-
declare function applyAthenaPgUriHeaders(headers: Record<string, string>, input: Pick<BuildAthenaRequestHeadersInput, 'pgUri' | 'jdbcUrl' | 'configHeaders' | 'callHeaders'>): void;
|
|
138
|
-
/**
|
|
139
|
-
* Minimal gateway/data request headers used by many apps before they adopt
|
|
140
|
-
* the full {@link buildAthenaRequestHeaders} profile model.
|
|
141
|
-
*
|
|
142
|
-
* Additive convenience — does not replace client-built headers. Prefer
|
|
143
|
-
* `createClient({ client, key })` so the SDK sets these on every call.
|
|
144
|
-
*/
|
|
145
|
-
declare function buildAthenaGatewayHeaders(input: {
|
|
146
|
-
clientName?: string | null;
|
|
147
|
-
gatewayKey?: string | null;
|
|
148
|
-
headers?: Record<string, string | null | undefined>;
|
|
149
|
-
}): Record<string, string>;
|
|
150
|
-
declare function buildAthenaRequestHeaders(input: BuildAthenaRequestHeadersInput): Record<string, string>;
|
|
151
|
-
|
|
152
14
|
/**
|
|
153
15
|
* Wraps a string in a PostgreSQL dollar-quoted literal.
|
|
154
16
|
*
|
|
@@ -180,4 +42,4 @@ declare function sqlJsonbLiteral(value: unknown): string;
|
|
|
180
42
|
*/
|
|
181
43
|
declare function sqlBigInt(value: bigint | number): string;
|
|
182
44
|
|
|
183
|
-
export {
|
|
45
|
+
export { escapeLikePatternValue, isLocalHostname, parseBooleanFlag, quoteSqlStringLiteral, slugify, sqlBigInt, sqlJsonbLiteral, sqlNullableText, sqlText, trimTrailingSlashes };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,154 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
export { A as ATHENA_AUTH_COOKIE_PREFIXES, a as ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_PARAM, b as ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_VALUE, c as ATHENA_AUTH_GET_SESSION_ABSOLUTE_PATH, d as ATHENA_AUTH_GET_SESSION_PATH, e as ATHENA_AUTH_PATH, f as ATHENA_AUTH_UPSTREAM_ENV_KEYS, g as ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES, h as ATHENA_AUTH_VERIFY_EMAIL_PATH, i as ATHENA_SESSION_DATA_HEADER, j as AUTHENTICATED_REDIRECT_MODE_SET, k as AUTHENTICATED_REDIRECT_VIEW_SET, l as AUTH_DEFAULT_VIEW, m as AUTH_MODE_REDIRECTS, n as AUTH_MODE_SET, o as AUTH_ROUTES, p as AUTH_SESSION_PATH, q as AUTH_TWO_FACTOR_SEGMENT, r as AUTH_VIEW_BY_SEGMENT, s as AthenaAuthClientBaseUrlOptions, t as AthenaAuthUpstreamEnv, u as AthenaAuthUpstreamEnvKey, v as AthenaRequestHeaderOverrideFields, w as AthenaRequestHeaderProfile, x as AuthMode, y as AuthModeRedirects, z as AuthRoutes, B as AuthView, C as BuildAthenaRequestHeadersInput, D as ClearAuthCookiesOptions, E as DEFAULT_ATHENA_AUTH_ORIGIN, F as DEFAULT_ATHENA_AUTH_UPSTREAM_URL, ac as DEFAULT_AUTH_COOKIE_PREFIXES, G as DISABLE_COOKIE_CACHE_QUERY_PARAM, H as DISABLE_COOKIE_CACHE_QUERY_VALUE, I as EnvLike, L as LOCAL_DEV_ORIGIN, a4 as ResolvedRequestHeaderOverrides, S as SESSION_DATA_HEADER, a5 as applyAthenaApiKeyHeaders, a6 as applyAthenaAuthContextHeaders, a7 as applyAthenaPgUriHeaders, ad as asBoolean, ae as asBooleanOrNull, af as asIdentifier, J as asNonEmptyString, ag as asNumber, ah as asRecord, K as asString, ai as asStringArray, M as buildAthenaGatewayHeaders, N as buildAthenaRequestHeaders, a8 as buildServiceRequestHeaders, O as clearAuthCookies, P as createAuthModeRedirects, Q as createAuthRoutes, R as createFreshSessionLookupUrl, aj as firstString, a9 as hasHeaderIgnoreCase, T as isAbsoluteUrl, U as isAuthMode, V as normalizeAthenaAuthBaseUrl, W as readAthenaAuthUpstreamUrlFromEnv, X as readTrimmedString, Y as resolveAthenaAuthClientBaseUrl, Z as resolveAthenaAuthRequestUrl, _ as resolveAthenaAuthUpstreamUrl, $ as resolveAuthModeRedirect, a0 as resolveAuthViewFromSegment, a1 as resolveEmailVerificationCallbackUrl, aa as resolveHeaderValue, ab as resolveRequestHeaderOverrides, a2 as shouldRedirectAuthenticatedAuthMode, a3 as shouldRedirectAuthenticatedAuthView } from './athena-request-headers-C7Jy-c_D.js';
|
|
2
|
+
export { G as GetOriginFromHeadersOptions, g as getOriginFromHeaders, i as isDynamicServerUsageError, p as proxyRequestHeaders, r as readEnv, a as requireEnv } from './proxy-request-headers-m4D2Tduy.js';
|
|
3
3
|
export { S as SESSION_COOKIE_PATTERNS, h as hasAuthSessionCookie } from './session-cookie-detection-BqOp9mO6.js';
|
|
4
|
-
import
|
|
4
|
+
import './types-Bltx6iL6.js';
|
|
5
5
|
|
|
6
6
|
declare function slugify(input: string): string;
|
|
7
7
|
|
|
8
8
|
declare function trimTrailingSlashes(value: string): string;
|
|
9
9
|
|
|
10
|
-
declare function asString(value: unknown): string | null;
|
|
11
|
-
declare function asBoolean(value: unknown): boolean;
|
|
12
|
-
declare function asBooleanOrNull(value: unknown): boolean | null;
|
|
13
|
-
declare function asRecord(value: unknown): Record<string, unknown> | null;
|
|
14
|
-
declare function asIdentifier(value: unknown): string | null;
|
|
15
|
-
declare function firstString(record: Record<string, unknown> | null | undefined, keys: readonly string[]): string | null;
|
|
16
|
-
declare function readTrimmedString(value: unknown): string | null;
|
|
17
|
-
/**
|
|
18
|
-
* Trim a string value; return `undefined` when not a non-empty string.
|
|
19
|
-
*
|
|
20
|
-
* Unlike {@link asString}, does not coerce numbers/bigints.
|
|
21
|
-
* Unlike {@link readTrimmedString}, returns `undefined` instead of `null`
|
|
22
|
-
* (handy for optional fields and `??` defaults).
|
|
23
|
-
*/
|
|
24
|
-
declare function asNonEmptyString(value: unknown): string | undefined;
|
|
25
|
-
declare function asNumber(value: unknown): number | null;
|
|
26
|
-
declare function asStringArray(value: unknown): string[];
|
|
27
|
-
|
|
28
10
|
declare function parseBooleanFlag(rawValue: string | undefined, fallback: boolean): boolean;
|
|
29
11
|
|
|
30
|
-
/**
|
|
31
|
-
* Read the first non-empty trimmed environment variable from a name list.
|
|
32
|
-
*
|
|
33
|
-
* @param names - Candidate env keys in priority order
|
|
34
|
-
* @param env - Optional env map (defaults to `process.env`)
|
|
35
|
-
* @returns Trimmed value of the first key that is set and non-empty
|
|
36
|
-
* @throws {Error} When none of the keys yield a non-empty value
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```ts
|
|
40
|
-
* import { requireEnv } from "@xylex-group/athena/utils"
|
|
41
|
-
*
|
|
42
|
-
* const authUrl = requireEnv([
|
|
43
|
-
* "ATHENA_AUTH_UPSTREAM_URL",
|
|
44
|
-
* "ATHENA_AUTH_URL",
|
|
45
|
-
* "NEXT_PUBLIC_ATHENA_AUTH_URL",
|
|
46
|
-
* ])
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
declare function requireEnv(names: readonly string[], env?: EnvLike): string;
|
|
50
|
-
/**
|
|
51
|
-
* Like {@link requireEnv}, but returns `undefined` instead of throwing when
|
|
52
|
-
* none of the keys are set.
|
|
53
|
-
*/
|
|
54
|
-
declare function readEnv(names: readonly string[], env?: EnvLike): string | undefined;
|
|
55
|
-
|
|
56
12
|
declare function isLocalHostname(hostname: string): boolean;
|
|
57
13
|
|
|
58
|
-
/**
|
|
59
|
-
* Request header / Next.js helpers used by middleware and RSC session loaders.
|
|
60
|
-
* Framework-agnostic (no Next imports).
|
|
61
|
-
*/
|
|
62
|
-
/**
|
|
63
|
-
* True when Next.js threw because the route used dynamic APIs during static
|
|
64
|
-
* generation (`DYNAMIC_SERVER_USAGE` digest or matching message).
|
|
65
|
-
*
|
|
66
|
-
* Catch and rethrow (or handle) so Next can mark the route dynamic.
|
|
67
|
-
*/
|
|
68
|
-
declare function isDynamicServerUsageError(error: unknown): boolean;
|
|
69
|
-
interface GetOriginFromHeadersOptions {
|
|
70
|
-
/**
|
|
71
|
-
* When `x-forwarded-proto` / scheme is missing, use `http` if true else `https`.
|
|
72
|
-
* Typical: `process.env.NODE_ENV !== "production"`.
|
|
73
|
-
*/
|
|
74
|
-
preferHttpWhenMissingProto?: boolean;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Reconstruct public origin from request headers (Origin, or Host + proto).
|
|
78
|
-
*
|
|
79
|
-
* Prefers `Origin`, then `x-forwarded-host` / `host` with
|
|
80
|
-
* `x-forwarded-proto` (first value when comma-separated).
|
|
81
|
-
*/
|
|
82
|
-
declare function getOriginFromHeaders(headersList: {
|
|
83
|
-
get: (name: string) => string | null;
|
|
84
|
-
}, options?: GetOriginFromHeadersOptions): string | null;
|
|
85
|
-
|
|
86
|
-
declare function proxyRequestHeaders(request: Request): Headers;
|
|
87
|
-
|
|
88
|
-
type AthenaRequestHeaderProfile = 'gateway' | 'auth' | 'chat' | 'storage' | 'minimal';
|
|
89
|
-
interface BuildAthenaRequestHeadersInput {
|
|
90
|
-
profile: AthenaRequestHeaderProfile;
|
|
91
|
-
sdkHeaderValue: string;
|
|
92
|
-
apiKey?: string | null;
|
|
93
|
-
client?: string | null;
|
|
94
|
-
userId?: string | null;
|
|
95
|
-
organizationId?: string | null;
|
|
96
|
-
backend?: BackendOption;
|
|
97
|
-
publishEvent?: string | null;
|
|
98
|
-
stripNulls?: boolean;
|
|
99
|
-
bearerToken?: string | null;
|
|
100
|
-
cookie?: string | null;
|
|
101
|
-
sessionToken?: string | null;
|
|
102
|
-
pgUri?: string | null;
|
|
103
|
-
jdbcUrl?: string | null;
|
|
104
|
-
forceNoCache?: boolean;
|
|
105
|
-
configHeaders?: Record<string, string>;
|
|
106
|
-
callHeaders?: Record<string, string>;
|
|
107
|
-
contentType?: string | null;
|
|
108
|
-
accept?: string | null;
|
|
109
|
-
}
|
|
110
|
-
/** Shared config/call fields consumed by gateway, chat, auth, and `client.request(...)`. */
|
|
111
|
-
interface AthenaRequestHeaderOverrideFields {
|
|
112
|
-
apiKey?: string | null;
|
|
113
|
-
client?: string | null;
|
|
114
|
-
userId?: string | null;
|
|
115
|
-
organizationId?: string | null;
|
|
116
|
-
backend?: BackendOption;
|
|
117
|
-
publishEvent?: string | null;
|
|
118
|
-
stripNulls?: boolean;
|
|
119
|
-
bearerToken?: string | null;
|
|
120
|
-
cookie?: string | null;
|
|
121
|
-
sessionToken?: string | null;
|
|
122
|
-
pgUri?: string | null;
|
|
123
|
-
jdbcUrl?: string | null;
|
|
124
|
-
forceNoCache?: boolean;
|
|
125
|
-
headers?: Record<string, string>;
|
|
126
|
-
}
|
|
127
|
-
type ResolvedRequestHeaderOverrides = Omit<BuildAthenaRequestHeadersInput, 'profile' | 'sdkHeaderValue' | 'contentType' | 'accept'>;
|
|
128
|
-
declare function hasHeaderIgnoreCase(headers: Record<string, string>, targetKey: string): boolean;
|
|
129
|
-
declare function resolveHeaderValue(headers: Record<string, string>, candidates: readonly string[]): string | undefined;
|
|
130
|
-
declare function resolveRequestHeaderOverrides(config: AthenaRequestHeaderOverrideFields, options?: AthenaRequestHeaderOverrideFields, defaults?: Pick<AthenaRequestHeaderOverrideFields, 'client' | 'stripNulls'>): ResolvedRequestHeaderOverrides;
|
|
131
|
-
declare function buildServiceRequestHeaders(profile: Exclude<AthenaRequestHeaderProfile, 'minimal'>, sdkHeaderValue: string, config: AthenaRequestHeaderOverrideFields, options?: AthenaRequestHeaderOverrideFields, extras?: Pick<BuildAthenaRequestHeadersInput, 'contentType' | 'accept'> & {
|
|
132
|
-
client?: string | null;
|
|
133
|
-
stripNulls?: boolean;
|
|
134
|
-
}): Record<string, string>;
|
|
135
|
-
declare function applyAthenaApiKeyHeaders(headers: Record<string, string>, apiKey?: string | null): void;
|
|
136
|
-
declare function applyAthenaAuthContextHeaders(headers: Record<string, string>, input: Pick<BuildAthenaRequestHeadersInput, 'bearerToken' | 'cookie' | 'sessionToken' | 'profile' | 'configHeaders' | 'callHeaders'>): void;
|
|
137
|
-
declare function applyAthenaPgUriHeaders(headers: Record<string, string>, input: Pick<BuildAthenaRequestHeadersInput, 'pgUri' | 'jdbcUrl' | 'configHeaders' | 'callHeaders'>): void;
|
|
138
|
-
/**
|
|
139
|
-
* Minimal gateway/data request headers used by many apps before they adopt
|
|
140
|
-
* the full {@link buildAthenaRequestHeaders} profile model.
|
|
141
|
-
*
|
|
142
|
-
* Additive convenience — does not replace client-built headers. Prefer
|
|
143
|
-
* `createClient({ client, key })` so the SDK sets these on every call.
|
|
144
|
-
*/
|
|
145
|
-
declare function buildAthenaGatewayHeaders(input: {
|
|
146
|
-
clientName?: string | null;
|
|
147
|
-
gatewayKey?: string | null;
|
|
148
|
-
headers?: Record<string, string | null | undefined>;
|
|
149
|
-
}): Record<string, string>;
|
|
150
|
-
declare function buildAthenaRequestHeaders(input: BuildAthenaRequestHeadersInput): Record<string, string>;
|
|
151
|
-
|
|
152
14
|
/**
|
|
153
15
|
* Wraps a string in a PostgreSQL dollar-quoted literal.
|
|
154
16
|
*
|
|
@@ -180,4 +42,4 @@ declare function sqlJsonbLiteral(value: unknown): string;
|
|
|
180
42
|
*/
|
|
181
43
|
declare function sqlBigInt(value: bigint | number): string;
|
|
182
44
|
|
|
183
|
-
export {
|
|
45
|
+
export { escapeLikePatternValue, isLocalHostname, parseBooleanFlag, quoteSqlStringLiteral, slugify, sqlBigInt, sqlJsonbLiteral, sqlNullableText, sqlText, trimTrailingSlashes };
|