@xylex-group/athena 2.6.0 → 2.8.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 +210 -17
- package/dist/browser.cjs +2102 -527
- 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 +2096 -528
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +2116 -559
- 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 +2116 -559
- package/dist/cli/index.js.map +1 -1
- package/dist/cookies.cjs +10 -3
- package/dist/cookies.cjs.map +1 -1
- package/dist/cookies.js +10 -3
- package/dist/cookies.js.map +1 -1
- package/dist/index.cjs +2694 -748
- 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 +2688 -749
- package/dist/index.js.map +1 -1
- package/dist/model-form-DMed05gE.d.cts +3037 -0
- package/dist/model-form-DXPlOnlI.d.ts +3037 -0
- package/dist/{pipeline-Ce3pTw5h.d.ts → pipeline-CkMnhwPI.d.ts} +1 -1
- package/dist/{pipeline-D1ZYeoH7.d.cts → pipeline-D4sJRKqN.d.cts} +1 -1
- package/dist/react-email-DZhDDlEl.d.cts +417 -0
- package/dist/react-email-Lrz9A-BW.d.ts +417 -0
- package/dist/react.cjs +178 -71
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +22 -5
- package/dist/react.d.ts +22 -5
- package/dist/react.js +92 -5
- package/dist/react.js.map +1 -1
- package/dist/{types-CUuo4NDi.d.cts → types-BzY6fETM.d.ts} +47 -5
- package/dist/{types-DapchQY5.d.ts → types-CAtTGGoz.d.cts} +47 -5
- package/dist/{types-DSX6AT5B.d.cts → types-vikz9YIO.d.cts} +23 -1
- package/dist/{types-DSX6AT5B.d.ts → types-vikz9YIO.d.ts} +23 -1
- package/package.json +194 -193
- package/dist/model-form-BaHWi3gm.d.cts +0 -1383
- package/dist/model-form-Dh6gWjL0.d.ts +0 -1383
- package/dist/react-email-B8O1Jeff.d.cts +0 -1230
- package/dist/react-email-CDEF0jij.d.ts +0 -1230
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RunGeneratorOptions,
|
|
1
|
+
import { R as RunGeneratorOptions, o as RunGeneratorResult } from './types-BzY6fETM.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* End-to-end generator execution: load config, introspect, render, and optionally write files.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RunGeneratorOptions,
|
|
1
|
+
import { R as RunGeneratorOptions, o as RunGeneratorResult } from './types-CAtTGGoz.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* End-to-end generator execution: load config, introspect, render, and optionally write files.
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { b as AthenaGatewayConnectionOptions, c as AthenaGatewayConnectionResult, J as SchemaDef, N as AnyModelDef, D as DatabaseDef, E as ModelMetadata, C as ModelDef, R as RegistryDef, y as ModelColumnKind, L as TenantKeyMap, T as TenantContext, H as RowOf, M as ModelAt, r as InsertOf, U as UpdateOf, a as AthenaGatewayCallOptions, S as SchemaIntrospectionProvider, s as IntrospectionColumn } from './types-vikz9YIO.cjs';
|
|
2
|
+
import { bB as ModelFormNullishMode, bC as ModelFormValues, aK as AthenaSdkClient, bU as TableQueryBuilder, $ as AthenaClientExperimentalOptions, f as AthenaAuthClientConfig, N as AthenaAuthSdkClient, F as AthenaAuthReactEmailProps, C as AthenaAuthReactEmailComponent, H as AthenaAuthReactEmailRenderInput, k as AthenaAuthEmailTemplateDefinition, i as AthenaAuthEmailTemplateBuilder, I as AthenaAuthReactEmailRenderOptions, G as AthenaAuthReactEmailRenderEvent, D as AthenaAuthReactEmailConfig } from './model-form-DMed05gE.cjs';
|
|
3
|
+
import { ZodType } from 'zod';
|
|
4
|
+
import { l as GeneratorSchemaSelection, b as GeneratorProviderConfig } from './types-CAtTGGoz.cjs';
|
|
5
|
+
import { A as AthenaCookiesOptions, a as AthenaSessionPair, b as AthenaCookieOptions, c as AthenaAuthCookies, g as getCookieCache, d as getSessionCookie, e as AthenaCookieContextRuntime } from './index-CVcQCGyG.cjs';
|
|
6
|
+
|
|
7
|
+
declare function verifyAthenaGatewayUrl(baseUrl: string, options?: AthenaGatewayConnectionOptions): Promise<AthenaGatewayConnectionResult>;
|
|
8
|
+
|
|
9
|
+
interface NormalizeAthenaGatewayBaseUrlOptions {
|
|
10
|
+
defaultBaseUrl?: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function normalizeAthenaGatewayBaseUrl(input: string | null | undefined, options?: NormalizeAthenaGatewayBaseUrlOptions): string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Immutable identifier object with consistent SQL rendering.
|
|
17
|
+
*/
|
|
18
|
+
interface SqlIdentifier {
|
|
19
|
+
readonly segments: string[];
|
|
20
|
+
toSql(): string;
|
|
21
|
+
toString(): string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates a quoted identifier object from segment or dotted inputs.
|
|
25
|
+
*/
|
|
26
|
+
declare function identifier(...segments: string[]): SqlIdentifier;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Declares a model contract with explicit metadata and typed row/insert/update shapes.
|
|
30
|
+
*/
|
|
31
|
+
declare function defineModel<Row, Insert = Partial<Row>, Update = Partial<Insert>, Meta extends ModelMetadata<Row> = ModelMetadata<Row>>(input: {
|
|
32
|
+
meta: Meta;
|
|
33
|
+
}): ModelDef<Row, Insert, Update, Meta>;
|
|
34
|
+
/**
|
|
35
|
+
* Declares a schema-level model map.
|
|
36
|
+
*/
|
|
37
|
+
declare function defineSchema<Models extends Record<string, AnyModelDef>>(models: Models): SchemaDef<Models>;
|
|
38
|
+
/**
|
|
39
|
+
* Declares a database-level schema map.
|
|
40
|
+
*/
|
|
41
|
+
declare function defineDatabase<Schemas extends Record<string, SchemaDef<Record<string, AnyModelDef>>>>(schemas: Schemas): DatabaseDef<Schemas>;
|
|
42
|
+
/**
|
|
43
|
+
* Declares a top-level multi-database registry.
|
|
44
|
+
*/
|
|
45
|
+
declare function defineRegistry<Databases extends Record<string, DatabaseDef<Record<string, SchemaDef<Record<string, AnyModelDef>>>>>>(databases: Databases): RegistryDef<Databases>;
|
|
46
|
+
|
|
47
|
+
declare const COLUMN_CONFIG: unique symbol;
|
|
48
|
+
interface ColumnRuntimeConfig<TValue, TNullable extends boolean = false, THasDefault extends boolean = false, TGenerated extends boolean = false, TColumnName extends string | undefined = undefined, TKind extends ModelColumnKind = ModelColumnKind> {
|
|
49
|
+
readonly kind: TKind;
|
|
50
|
+
readonly columnName?: TColumnName;
|
|
51
|
+
readonly nullable: TNullable;
|
|
52
|
+
readonly hasDefault: THasDefault;
|
|
53
|
+
readonly isGenerated: TGenerated;
|
|
54
|
+
readonly enumValues?: readonly string[];
|
|
55
|
+
readonly jsonSchema?: ZodType<TValue>;
|
|
56
|
+
readonly __value?: TValue;
|
|
57
|
+
}
|
|
58
|
+
interface AthenaColumnBuilder<TValue, TNullable extends boolean = false, THasDefault extends boolean = false, TGenerated extends boolean = false, TColumnName extends string | undefined = undefined, TKind extends ModelColumnKind = ModelColumnKind> {
|
|
59
|
+
readonly [COLUMN_CONFIG]: ColumnRuntimeConfig<TValue, TNullable, THasDefault, TGenerated, TColumnName, TKind>;
|
|
60
|
+
optional(): AthenaColumnBuilder<TValue, true, THasDefault, TGenerated, TColumnName, TKind>;
|
|
61
|
+
from<TNextColumnName extends string>(columnName: TNextColumnName): AthenaColumnBuilder<TValue, TNullable, THasDefault, TGenerated, TNextColumnName, TKind>;
|
|
62
|
+
defaulted(): AthenaColumnBuilder<TValue, TNullable, true, TGenerated, TColumnName, TKind>;
|
|
63
|
+
generated(): AthenaColumnBuilder<TValue, TNullable, THasDefault, true, TColumnName, TKind>;
|
|
64
|
+
}
|
|
65
|
+
type AnyColumnBuilder = AthenaColumnBuilder<unknown, boolean, boolean, boolean, string | undefined, ModelColumnKind>;
|
|
66
|
+
declare function string(): AthenaColumnBuilder<string, false, false, false, undefined, 'string'>;
|
|
67
|
+
declare function number(): AthenaColumnBuilder<number, false, false, false, undefined, 'number'>;
|
|
68
|
+
declare function boolean(): AthenaColumnBuilder<boolean, false, false, false, undefined, 'boolean'>;
|
|
69
|
+
declare function json<TValue = unknown>(schema?: ZodType<TValue>): AthenaColumnBuilder<TValue, false, false, false, undefined, 'json'>;
|
|
70
|
+
declare function enumeration<const TValues extends readonly [string, ...string[]]>(values: TValues): AthenaColumnBuilder<TValues[number], false, false, false, undefined, 'enumeration'>;
|
|
71
|
+
|
|
72
|
+
interface AthenaTableSchemaBundle<Row, Insert, Update> {
|
|
73
|
+
readonly row: ZodType<Row>;
|
|
74
|
+
readonly insert: ZodType<Insert>;
|
|
75
|
+
readonly update: ZodType<Update>;
|
|
76
|
+
readonly form: ZodType<Insert>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type Simplify<T> = {
|
|
80
|
+
[K in keyof T]: T[K];
|
|
81
|
+
} & {};
|
|
82
|
+
type ExtractColumnConfig<TColumn extends AnyColumnBuilder> = TColumn[typeof COLUMN_CONFIG];
|
|
83
|
+
type ColumnValue<TColumn extends AnyColumnBuilder> = ExtractColumnConfig<TColumn> extends {
|
|
84
|
+
__value?: infer TValue;
|
|
85
|
+
} ? TValue : never;
|
|
86
|
+
type ColumnNullable<TColumn extends AnyColumnBuilder> = ExtractColumnConfig<TColumn> extends {
|
|
87
|
+
nullable: infer TNullable extends boolean;
|
|
88
|
+
} ? TNullable : never;
|
|
89
|
+
type ColumnHasDefault<TColumn extends AnyColumnBuilder> = ExtractColumnConfig<TColumn> extends {
|
|
90
|
+
hasDefault: infer THasDefault extends boolean;
|
|
91
|
+
} ? THasDefault : never;
|
|
92
|
+
type ColumnGenerated<TColumn extends AnyColumnBuilder> = ExtractColumnConfig<TColumn> extends {
|
|
93
|
+
isGenerated: infer TGenerated extends boolean;
|
|
94
|
+
} ? TGenerated : never;
|
|
95
|
+
type RowFieldType<TColumn extends AnyColumnBuilder> = ColumnNullable<TColumn> extends true ? ColumnValue<TColumn> | null : ColumnValue<TColumn>;
|
|
96
|
+
type WritableColumnKeys<TColumns extends Record<string, AnyColumnBuilder>> = Extract<{
|
|
97
|
+
[K in keyof TColumns]-?: ColumnGenerated<TColumns[K]> extends true ? never : K;
|
|
98
|
+
}[keyof TColumns], string>;
|
|
99
|
+
type InsertRequiredKeys<TColumns extends Record<string, AnyColumnBuilder>> = Extract<{
|
|
100
|
+
[K in keyof TColumns]-?: ColumnGenerated<TColumns[K]> extends true ? never : ColumnHasDefault<TColumns[K]> extends true ? never : ColumnNullable<TColumns[K]> extends true ? never : K;
|
|
101
|
+
}[keyof TColumns], string>;
|
|
102
|
+
type InsertOptionalKeys<TColumns extends Record<string, AnyColumnBuilder>> = Exclude<WritableColumnKeys<TColumns>, InsertRequiredKeys<TColumns>>;
|
|
103
|
+
type ExtractMappedSchemaName<TMappedName extends string | undefined> = TMappedName extends `${infer TSchema}.${string}` ? TSchema : undefined;
|
|
104
|
+
type ExtractMappedTableName<TMappedName extends string | undefined> = TMappedName extends `${string}.${infer TTable}` ? TTable : TMappedName extends string ? TMappedName : undefined;
|
|
105
|
+
type ResolvedSchemaName<TSchemaName extends string | undefined, TMappedName extends string | undefined> = TSchemaName extends string ? TSchemaName : ExtractMappedSchemaName<TMappedName>;
|
|
106
|
+
type ResolvedTableName<TName extends string, TMappedName extends string | undefined> = ExtractMappedTableName<TMappedName> extends string ? ExtractMappedTableName<TMappedName> : TName;
|
|
107
|
+
type QualifiedTableName<TName extends string, TMappedName extends string | undefined, TSchemaName extends string | undefined> = ResolvedSchemaName<TSchemaName, TMappedName> extends infer TResolvedSchema extends string | undefined ? TResolvedSchema extends string ? `${TResolvedSchema}.${ResolvedTableName<TName, TMappedName>}` : ResolvedTableName<TName, TMappedName> : never;
|
|
108
|
+
type RowFromColumns<TColumns extends Record<string, AnyColumnBuilder>> = Simplify<{
|
|
109
|
+
[K in keyof TColumns]: RowFieldType<TColumns[K]>;
|
|
110
|
+
}>;
|
|
111
|
+
type InsertFromColumns<TColumns extends Record<string, AnyColumnBuilder>> = Simplify<{
|
|
112
|
+
[K in InsertRequiredKeys<TColumns>]: ColumnValue<TColumns[K]>;
|
|
113
|
+
} & {
|
|
114
|
+
[K in InsertOptionalKeys<TColumns>]?: RowFieldType<TColumns[K]>;
|
|
115
|
+
}>;
|
|
116
|
+
type UpdateFromColumns<TColumns extends Record<string, AnyColumnBuilder>> = Simplify<{
|
|
117
|
+
[K in WritableColumnKeys<TColumns>]?: RowFieldType<TColumns[K]>;
|
|
118
|
+
}>;
|
|
119
|
+
type FormValuesFromColumns<TColumns extends Record<string, AnyColumnBuilder>, TMode extends ModelFormNullishMode = 'empty-string'> = ModelFormValues<AthenaTableDef<TColumns>, TMode>;
|
|
120
|
+
interface AthenaTableDef<TColumns extends Record<string, AnyColumnBuilder>, TName extends string = string, TMappedName extends string | undefined = undefined, TSchemaName extends string | undefined = undefined> extends ModelDef<RowFromColumns<TColumns>, InsertFromColumns<TColumns>, UpdateFromColumns<TColumns>, ModelMetadata<RowFromColumns<TColumns>>> {
|
|
121
|
+
readonly kind: 'table';
|
|
122
|
+
readonly name: TName;
|
|
123
|
+
readonly mappedName: TMappedName;
|
|
124
|
+
readonly schemaName: ResolvedSchemaName<TSchemaName, TMappedName>;
|
|
125
|
+
readonly tableName: ResolvedTableName<TName, TMappedName>;
|
|
126
|
+
readonly qualifiedName: QualifiedTableName<TName, TMappedName, TSchemaName>;
|
|
127
|
+
readonly columns: Readonly<TColumns>;
|
|
128
|
+
readonly schemas: AthenaTableSchemaBundle<RowFromColumns<TColumns>, InsertFromColumns<TColumns>, UpdateFromColumns<TColumns>>;
|
|
129
|
+
}
|
|
130
|
+
interface AthenaTableBuilder<TName extends string, TMappedName extends string | undefined = undefined, TSchemaName extends string | undefined = undefined> {
|
|
131
|
+
readonly name: TName;
|
|
132
|
+
readonly mappedName: TMappedName;
|
|
133
|
+
readonly schemaName: TSchemaName;
|
|
134
|
+
from<TNextMappedName extends string>(tableName: TNextMappedName): AthenaTableBuilder<TName, TNextMappedName, TSchemaName>;
|
|
135
|
+
schema<TNextSchemaName extends string>(schemaName: TNextSchemaName): AthenaTableBuilder<TName, TMappedName, TNextSchemaName>;
|
|
136
|
+
columns<TColumns extends Record<string, AnyColumnBuilder>>(columns: TColumns): AthenaTableColumnsBuilder<TName, TMappedName, TSchemaName, TColumns>;
|
|
137
|
+
}
|
|
138
|
+
interface AthenaTableColumnsBuilder<TName extends string, TMappedName extends string | undefined, TSchemaName extends string | undefined, TColumns extends Record<string, AnyColumnBuilder>> {
|
|
139
|
+
readonly name: TName;
|
|
140
|
+
readonly mappedName: TMappedName;
|
|
141
|
+
readonly schemaName: TSchemaName;
|
|
142
|
+
readonly columns: Readonly<TColumns>;
|
|
143
|
+
from<TNextMappedName extends string>(tableName: TNextMappedName): AthenaTableColumnsBuilder<TName, TNextMappedName, TSchemaName, TColumns>;
|
|
144
|
+
schema<TNextSchemaName extends string>(schemaName: TNextSchemaName): AthenaTableColumnsBuilder<TName, TMappedName, TNextSchemaName, TColumns>;
|
|
145
|
+
primaryKey<TPrimaryKey extends readonly [
|
|
146
|
+
Extract<keyof TColumns, string>,
|
|
147
|
+
...Array<Extract<keyof TColumns, string>>
|
|
148
|
+
]>(...keys: TPrimaryKey): AthenaTableDef<TColumns, TName, TMappedName, TSchemaName>;
|
|
149
|
+
}
|
|
150
|
+
declare function table<TName extends string>(name: TName): AthenaTableBuilder<TName, undefined>;
|
|
151
|
+
|
|
152
|
+
type RegistryConstraint = RegistryDef<Record<string, DatabaseDef<Record<string, SchemaDef<Record<string, AnyModelDef>>>>>>;
|
|
153
|
+
/**
|
|
154
|
+
* Options for creating typed Athena clients.
|
|
155
|
+
*/
|
|
156
|
+
interface TypedClientOptions<TMap extends TenantKeyMap = TenantKeyMap> extends Pick<AthenaGatewayCallOptions, 'backend' | 'client' | 'headers'> {
|
|
157
|
+
tenantKeyMap?: TMap;
|
|
158
|
+
tenantContext?: TenantContext<TMap>;
|
|
159
|
+
experimental?: AthenaClientExperimentalOptions;
|
|
160
|
+
}
|
|
161
|
+
interface TypedClientOptionsWithTypecheckedColumns<TMap extends TenantKeyMap = TenantKeyMap> extends TypedClientOptions<TMap> {
|
|
162
|
+
experimental: AthenaClientExperimentalOptions & {
|
|
163
|
+
typecheckColumns: true;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Typed Athena client with registry-driven model resolution and tenant-context propagation.
|
|
168
|
+
*/
|
|
169
|
+
interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap extends TenantKeyMap = Record<never, string>, TStrict extends boolean = false> extends AthenaSdkClient<TStrict> {
|
|
170
|
+
readonly registry: TRegistry;
|
|
171
|
+
readonly tenantKeyMap: Readonly<TTenantMap>;
|
|
172
|
+
readonly tenantContext: TenantContext<TTenantMap>;
|
|
173
|
+
withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
|
|
174
|
+
fromModel<TDatabase extends keyof TRegistry & string, TSchema extends keyof TRegistry[TDatabase]['schemas'] & string, TModel extends keyof TRegistry[TDatabase]['schemas'][TSchema]['models'] & string>(database: TDatabase, schema: TSchema, model: TModel): TableQueryBuilder<RowOf<ModelAt<TRegistry, TDatabase, TSchema, TModel>>, InsertOf<ModelAt<TRegistry, TDatabase, TSchema, TModel>>, UpdateOf<ModelAt<TRegistry, TDatabase, TSchema, TModel>>, {
|
|
175
|
+
registry: TRegistry;
|
|
176
|
+
database: TDatabase;
|
|
177
|
+
schema: TSchema;
|
|
178
|
+
model: ModelAt<TRegistry, TDatabase, TSchema, TModel>;
|
|
179
|
+
}, TStrict>;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Creates a typed client bound to a registry contract and optional tenant header mapping.
|
|
183
|
+
*/
|
|
184
|
+
declare function createTypedClient<TRegistry extends RegistryConstraint, TTenantMap extends TenantKeyMap = Record<never, string>>(registry: TRegistry, url: string, apiKey: string, options: TypedClientOptionsWithTypecheckedColumns<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap, true>;
|
|
185
|
+
declare function createTypedClient<TRegistry extends RegistryConstraint, TTenantMap extends TenantKeyMap = Record<never, string>>(registry: TRegistry, url: string, apiKey: string, options?: TypedClientOptions<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap, false>;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Constructor options for the PostgreSQL introspection provider.
|
|
189
|
+
*/
|
|
190
|
+
interface PostgresIntrospectionProviderOptions {
|
|
191
|
+
connectionString: string;
|
|
192
|
+
database?: string;
|
|
193
|
+
schemas?: readonly string[];
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Creates a PostgreSQL-backed schema introspection provider.
|
|
197
|
+
*/
|
|
198
|
+
declare function createPostgresIntrospectionProvider(options: PostgresIntrospectionProviderOptions): SchemaIntrospectionProvider;
|
|
199
|
+
|
|
200
|
+
interface GeneratorEnvBaseOptions<T> {
|
|
201
|
+
default?: T;
|
|
202
|
+
optional?: boolean;
|
|
203
|
+
}
|
|
204
|
+
type GeneratorEnvStringOptions = GeneratorEnvBaseOptions<string>;
|
|
205
|
+
type GeneratorEnvBooleanOptions = GeneratorEnvBaseOptions<boolean>;
|
|
206
|
+
interface GeneratorEnvListOptions extends GeneratorEnvBaseOptions<readonly string[]> {
|
|
207
|
+
separator?: string;
|
|
208
|
+
}
|
|
209
|
+
type GeneratorEnvJsonOptions<T> = GeneratorEnvBaseOptions<T>;
|
|
210
|
+
type GeneratorEnvOneOfOptions<T extends string> = GeneratorEnvBaseOptions<T>;
|
|
211
|
+
type GeneratorEnvHelper = {
|
|
212
|
+
(key: string, options?: GeneratorEnvStringOptions): string;
|
|
213
|
+
(key: string, options: GeneratorEnvStringOptions & {
|
|
214
|
+
optional: true;
|
|
215
|
+
}): string | undefined;
|
|
216
|
+
boolean(key: string, options?: GeneratorEnvBooleanOptions): boolean;
|
|
217
|
+
boolean(key: string, options: GeneratorEnvBooleanOptions & {
|
|
218
|
+
optional: true;
|
|
219
|
+
}): boolean | undefined;
|
|
220
|
+
list(key: string, options?: GeneratorEnvListOptions): string[];
|
|
221
|
+
list(key: string, options: GeneratorEnvListOptions & {
|
|
222
|
+
optional: true;
|
|
223
|
+
}): string[] | undefined;
|
|
224
|
+
json<T>(key: string, options?: GeneratorEnvJsonOptions<T>): T;
|
|
225
|
+
json<T>(key: string, options: GeneratorEnvJsonOptions<T> & {
|
|
226
|
+
optional: true;
|
|
227
|
+
}): T | undefined;
|
|
228
|
+
oneOf<const T extends string>(key: string, allowedValues: readonly T[], options?: GeneratorEnvOneOfOptions<T>): T;
|
|
229
|
+
oneOf<const T extends string>(key: string, allowedValues: readonly T[], options: GeneratorEnvOneOfOptions<T> & {
|
|
230
|
+
optional: true;
|
|
231
|
+
}): T | undefined;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Typed env reader for generator configs. This keeps `athena.config.*` files
|
|
235
|
+
* declarative while preserving exact field types for booleans, lists, unions,
|
|
236
|
+
* and JSON-backed objects.
|
|
237
|
+
*/
|
|
238
|
+
declare const generatorEnv: GeneratorEnvHelper;
|
|
239
|
+
|
|
240
|
+
declare function resolvePostgresColumnType(column: IntrospectionColumn): string;
|
|
241
|
+
|
|
242
|
+
declare const DEFAULT_POSTGRES_SCHEMAS: readonly ["public"];
|
|
243
|
+
/**
|
|
244
|
+
* Normalizes schema selection from config or env-backed strings into a stable,
|
|
245
|
+
* deduplicated list. Empty selections fall back to PostgreSQL's public schema.
|
|
246
|
+
*/
|
|
247
|
+
declare function normalizeSchemaSelection(input: GeneratorSchemaSelection | undefined): string[];
|
|
248
|
+
/**
|
|
249
|
+
* Resolves the effective schema list for provider-backed generator runs.
|
|
250
|
+
*/
|
|
251
|
+
declare function resolveProviderSchemas(providerConfig: GeneratorProviderConfig): string[];
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* @deprecated Prefer `createClient(...).auth` from `@xylex-group/athena`.
|
|
255
|
+
*/
|
|
256
|
+
declare function createAuthClient(config?: AthenaAuthClientConfig): AthenaAuthSdkClient;
|
|
257
|
+
|
|
258
|
+
type AthenaMaybePromise<T> = T | Promise<T>;
|
|
259
|
+
type AthenaAuthServerCookieOptions = Pick<AthenaCookiesOptions, 'session' | 'advanced'>;
|
|
260
|
+
declare const ATHENA_AUTH_BASE_ERROR_CODES: {
|
|
261
|
+
readonly HANDLER_NOT_CONFIGURED: "HANDLER_NOT_CONFIGURED";
|
|
262
|
+
readonly INVALID_BASE_URL: "INVALID_BASE_URL";
|
|
263
|
+
readonly UNTRUSTED_HOST: "UNTRUSTED_HOST";
|
|
264
|
+
};
|
|
265
|
+
interface AthenaAuthSocialProviderConfig {
|
|
266
|
+
clientId: string;
|
|
267
|
+
clientSecret: string;
|
|
268
|
+
scope?: string[];
|
|
269
|
+
[key: string]: unknown;
|
|
270
|
+
}
|
|
271
|
+
interface AthenaAuthPluginContext {
|
|
272
|
+
path?: string;
|
|
273
|
+
headers?: Headers;
|
|
274
|
+
context: {
|
|
275
|
+
returned?: unknown;
|
|
276
|
+
responseHeaders?: Headers;
|
|
277
|
+
setSession?: AthenaSessionPair | null;
|
|
278
|
+
clearSession?: boolean;
|
|
279
|
+
dontRememberMe?: boolean;
|
|
280
|
+
cookieOverrides?: Partial<AthenaCookieOptions>;
|
|
281
|
+
[key: string]: unknown;
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
interface AthenaAuthPluginHandlerContext extends AthenaAuthPluginContext {
|
|
285
|
+
auth: AthenaAuthServer;
|
|
286
|
+
}
|
|
287
|
+
interface AthenaAuthPlugin {
|
|
288
|
+
id: string;
|
|
289
|
+
version: string;
|
|
290
|
+
$ERROR_CODES?: Record<string, string>;
|
|
291
|
+
hooks?: {
|
|
292
|
+
after?: Array<{
|
|
293
|
+
matcher: (ctx: AthenaAuthPluginContext) => boolean;
|
|
294
|
+
handler: (ctx: AthenaAuthPluginHandlerContext) => Promise<void> | void;
|
|
295
|
+
}>;
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
interface AthenaAuthCookieRuntimeInput {
|
|
299
|
+
headers?: Headers;
|
|
300
|
+
responseHeaders?: Headers;
|
|
301
|
+
cookies?: AthenaAuthCookies;
|
|
302
|
+
getCookie?: (name: string) => string | null | undefined;
|
|
303
|
+
setCookie?: (name: string, value: string, attributes: AthenaCookieOptions) => void;
|
|
304
|
+
logger?: AthenaCookieContextRuntime['logger'];
|
|
305
|
+
setSignedCookie?: AthenaCookieContextRuntime['setSignedCookie'];
|
|
306
|
+
getSignedCookie?: AthenaCookieContextRuntime['getSignedCookie'];
|
|
307
|
+
setNewSession?: AthenaCookieContextRuntime['context']['setNewSession'];
|
|
308
|
+
}
|
|
309
|
+
interface AthenaAuthServerRuntimeOptions {
|
|
310
|
+
baseURL?: string;
|
|
311
|
+
basePath: string;
|
|
312
|
+
secret: string;
|
|
313
|
+
cookies: AthenaAuthServerCookieOptions;
|
|
314
|
+
}
|
|
315
|
+
type AthenaAuthDatabaseFactory<TDatabase = unknown> = (options: AthenaAuthServerRuntimeOptions) => TDatabase;
|
|
316
|
+
type AthenaAuthBaseURLConfig = AthenaCookiesOptions['baseURL'];
|
|
317
|
+
type AthenaAuthTrustedOrigins = string[] | ((request?: Request) => AthenaMaybePromise<string[]>);
|
|
318
|
+
type AthenaAuthTrustedProviders = string[] | ((request?: Request) => AthenaMaybePromise<string[]>);
|
|
319
|
+
interface AthenaAuthHandlerResult {
|
|
320
|
+
response?: Response;
|
|
321
|
+
returned?: unknown;
|
|
322
|
+
setSession?: AthenaSessionPair | null;
|
|
323
|
+
clearSession?: boolean;
|
|
324
|
+
dontRememberMe?: boolean;
|
|
325
|
+
cookieOverrides?: Partial<AthenaCookieOptions>;
|
|
326
|
+
}
|
|
327
|
+
interface AthenaAuthServerConfig<TDatabase = unknown> extends AthenaAuthServerCookieOptions {
|
|
328
|
+
baseURL?: AthenaAuthBaseURLConfig;
|
|
329
|
+
basePath?: string;
|
|
330
|
+
secret: string;
|
|
331
|
+
database: TDatabase | AthenaAuthDatabaseFactory<TDatabase>;
|
|
332
|
+
socialProviders?: Record<string, AthenaAuthSocialProviderConfig>;
|
|
333
|
+
trustedOrigins?: AthenaAuthTrustedOrigins;
|
|
334
|
+
trustedProviders?: AthenaAuthTrustedProviders;
|
|
335
|
+
api?: Record<string, unknown>;
|
|
336
|
+
errorCodes?: Record<string, string>;
|
|
337
|
+
handler?: (ctx: AthenaAuthRequestContext) => AthenaMaybePromise<Response | AthenaAuthHandlerResult>;
|
|
338
|
+
plugins?: AthenaAuthPlugin[];
|
|
339
|
+
}
|
|
340
|
+
type ResolveAthenaAuthDatabase<TConfig extends AthenaAuthServerConfig> = TConfig['database'] extends (...args: never[]) => infer TResult ? TResult : TConfig['database'];
|
|
341
|
+
interface AthenaAuthRequestContext<TConfig extends AthenaAuthServerConfig = AthenaAuthServerConfig> {
|
|
342
|
+
auth: AthenaAuthServer<TConfig>;
|
|
343
|
+
request: Request;
|
|
344
|
+
url: URL;
|
|
345
|
+
path: string;
|
|
346
|
+
basePath: string;
|
|
347
|
+
baseURL: string;
|
|
348
|
+
origin: string;
|
|
349
|
+
headers: Headers;
|
|
350
|
+
cookies: AthenaAuthCookies;
|
|
351
|
+
trustedOrigins: string[];
|
|
352
|
+
trustedProviders: string[];
|
|
353
|
+
options: TConfig;
|
|
354
|
+
runtime: AthenaAuthServerRuntimeOptions;
|
|
355
|
+
database: ResolveAthenaAuthDatabase<TConfig>;
|
|
356
|
+
socialProviders: NonNullable<TConfig['socialProviders']>;
|
|
357
|
+
}
|
|
358
|
+
interface AthenaAuthContext<TConfig extends AthenaAuthServerConfig = AthenaAuthServerConfig> {
|
|
359
|
+
auth: AthenaAuthServer<TConfig>;
|
|
360
|
+
options: TConfig;
|
|
361
|
+
runtime: AthenaAuthServerRuntimeOptions;
|
|
362
|
+
basePath: string;
|
|
363
|
+
baseURL?: string;
|
|
364
|
+
origin?: string;
|
|
365
|
+
database: ResolveAthenaAuthDatabase<TConfig>;
|
|
366
|
+
socialProviders: NonNullable<TConfig['socialProviders']>;
|
|
367
|
+
plugins: AthenaAuthPlugin[];
|
|
368
|
+
cookies: AthenaAuthCookies;
|
|
369
|
+
trustedOrigins: string[];
|
|
370
|
+
trustedProviders: string[];
|
|
371
|
+
}
|
|
372
|
+
interface AthenaAuthServerApi<TConfig extends AthenaAuthServerConfig = AthenaAuthServerConfig> {
|
|
373
|
+
applyResponseCookies: AthenaAuthServer<TConfig>['applyResponseCookies'];
|
|
374
|
+
clearSession: AthenaAuthServer<TConfig>['clearSession'];
|
|
375
|
+
createCookieContext: AthenaAuthServer<TConfig>['createCookieContext'];
|
|
376
|
+
getCookieCache: typeof getCookieCache;
|
|
377
|
+
getSessionCookie: typeof getSessionCookie;
|
|
378
|
+
resolveRequestContext: AthenaAuthServer<TConfig>['resolveRequestContext'];
|
|
379
|
+
runAfterHooks: AthenaAuthServer<TConfig>['runAfterHooks'];
|
|
380
|
+
setSession: AthenaAuthServer<TConfig>['setSession'];
|
|
381
|
+
}
|
|
382
|
+
interface AthenaAuthServer<TConfig extends AthenaAuthServerConfig = AthenaAuthServerConfig> {
|
|
383
|
+
config: TConfig;
|
|
384
|
+
options: TConfig;
|
|
385
|
+
runtime: AthenaAuthServerRuntimeOptions;
|
|
386
|
+
database: ResolveAthenaAuthDatabase<TConfig>;
|
|
387
|
+
socialProviders: NonNullable<TConfig['socialProviders']>;
|
|
388
|
+
plugins: AthenaAuthPlugin[];
|
|
389
|
+
cookies: AthenaAuthCookies;
|
|
390
|
+
api: AthenaAuthServerApi<TConfig> & Record<string, unknown>;
|
|
391
|
+
$context: Promise<AthenaAuthContext<TConfig>>;
|
|
392
|
+
$ERROR_CODES: Record<string, string>;
|
|
393
|
+
createCookieContext: (input?: AthenaAuthCookieRuntimeInput) => AthenaCookieContextRuntime;
|
|
394
|
+
setSession: (input: AthenaAuthCookieRuntimeInput | undefined, session: AthenaSessionPair, dontRememberMe?: boolean, overrides?: Partial<AthenaCookieOptions>) => Promise<void>;
|
|
395
|
+
clearSession: (input?: AthenaAuthCookieRuntimeInput, skipDontRememberMe?: boolean) => void;
|
|
396
|
+
applyResponseCookies: (ctx: AthenaAuthPluginContext) => Promise<Headers>;
|
|
397
|
+
runAfterHooks: (ctx: AthenaAuthPluginContext) => Promise<AthenaAuthPluginContext>;
|
|
398
|
+
resolveRequestContext: (request: Request) => Promise<AthenaAuthRequestContext<TConfig>>;
|
|
399
|
+
handler: (request: Request) => Promise<Response>;
|
|
400
|
+
}
|
|
401
|
+
declare function defineAthenaAuthConfig<TConfig extends AthenaAuthServerConfig>(config: TConfig): TConfig;
|
|
402
|
+
declare function athenaAuth<TConfig extends AthenaAuthServerConfig>(config: TConfig): AthenaAuthServer<TConfig>;
|
|
403
|
+
|
|
404
|
+
interface AthenaAuthRenderedReactEmail {
|
|
405
|
+
html: string;
|
|
406
|
+
text?: string;
|
|
407
|
+
}
|
|
408
|
+
interface AthenaAuthReactEmailRuntimeOptions {
|
|
409
|
+
route?: string;
|
|
410
|
+
defaults?: AthenaAuthReactEmailRenderOptions;
|
|
411
|
+
observe?: (event: AthenaAuthReactEmailRenderEvent) => void;
|
|
412
|
+
}
|
|
413
|
+
declare function createAuthReactEmailInput<TProps extends AthenaAuthReactEmailProps = AthenaAuthReactEmailProps>(component: AthenaAuthReactEmailComponent<TProps>, props: TProps, overrides?: Omit<AthenaAuthReactEmailRenderInput, 'component' | 'props' | 'element'>): AthenaAuthReactEmailRenderInput;
|
|
414
|
+
declare function defineAuthEmailTemplate<TProps extends AthenaAuthReactEmailProps = AthenaAuthReactEmailProps>(definition: AthenaAuthEmailTemplateDefinition<TProps>): AthenaAuthEmailTemplateBuilder<TProps>;
|
|
415
|
+
declare function renderAthenaReactEmail(input: AthenaAuthReactEmailRenderInput, options?: AthenaAuthReactEmailRuntimeOptions | AthenaAuthReactEmailConfig): Promise<AthenaAuthRenderedReactEmail>;
|
|
416
|
+
|
|
417
|
+
export { normalizeSchemaSelection as $, ATHENA_AUTH_BASE_ERROR_CODES as A, athenaAuth as B, type ColumnRuntimeConfig as C, DEFAULT_POSTGRES_SCHEMAS as D, boolean as E, type FormValuesFromColumns as F, type GeneratorEnvBooleanOptions as G, createAuthClient as H, type InsertFromColumns as I, createAuthReactEmailInput as J, createPostgresIntrospectionProvider as K, createTypedClient as L, defineAthenaAuthConfig as M, defineAuthEmailTemplate as N, defineDatabase as O, type PostgresIntrospectionProviderOptions as P, defineModel as Q, type RowFromColumns as R, defineRegistry as S, type TypedAthenaClient as T, type UpdateFromColumns as U, defineSchema as V, enumeration as W, generatorEnv as X, identifier as Y, json as Z, normalizeAthenaGatewayBaseUrl as _, type AnyColumnBuilder as a, number as a0, renderAthenaReactEmail as a1, resolvePostgresColumnType as a2, resolveProviderSchemas as a3, string as a4, table as a5, verifyAthenaGatewayUrl as a6, type AthenaAuthBaseURLConfig as b, type AthenaAuthContext as c, type AthenaAuthCookieRuntimeInput as d, type AthenaAuthDatabaseFactory as e, type AthenaAuthHandlerResult as f, type AthenaAuthPlugin as g, type AthenaAuthPluginContext as h, type AthenaAuthPluginHandlerContext as i, type AthenaAuthRequestContext as j, type AthenaAuthServer as k, type AthenaAuthServerApi as l, type AthenaAuthServerConfig as m, type AthenaAuthServerRuntimeOptions as n, type AthenaAuthSocialProviderConfig as o, type AthenaAuthTrustedOrigins as p, type AthenaAuthTrustedProviders as q, type AthenaColumnBuilder as r, type AthenaTableDef as s, type AthenaTableSchemaBundle as t, type GeneratorEnvJsonOptions as u, type GeneratorEnvListOptions as v, type GeneratorEnvOneOfOptions as w, type GeneratorEnvStringOptions as x, type TypedClientOptions as y, type TypedClientOptionsWithTypecheckedColumns as z };
|