@xylex-group/athena 2.7.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 +1253 -401
- 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 +1247 -402
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +1285 -451
- 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 +1285 -451
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +1921 -698
- 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 +1915 -699
- package/dist/index.js.map +1 -1
- package/dist/{model-form-AKYrgede.d.ts → model-form-DMed05gE.d.cts} +347 -82
- package/dist/{model-form-ehfqLuG7.d.cts → model-form-DXPlOnlI.d.ts} +347 -82
- package/dist/{pipeline-BUsR9XlO.d.ts → pipeline-CkMnhwPI.d.ts} +1 -1
- package/dist/{pipeline-BfCWSRYl.d.cts → pipeline-D4sJRKqN.d.cts} +1 -1
- package/dist/{react-email-BQzmXBDE.d.cts → react-email-DZhDDlEl.d.cts} +121 -8
- package/dist/{react-email-BrVRp80B.d.ts → react-email-Lrz9A-BW.d.ts} +121 -8
- package/dist/react.cjs +1 -1
- 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 +1 -1
- package/dist/react.js.map +1 -1
- package/dist/{types-BSIsyss1.d.cts → types-BzY6fETM.d.ts} +47 -5
- package/dist/{types-t_TVqnmp.d.ts → types-CAtTGGoz.d.cts} +47 -5
- package/dist/{types-BsyRW49r.d.cts → types-vikz9YIO.d.cts} +23 -1
- package/dist/{types-BsyRW49r.d.ts → types-vikz9YIO.d.ts} +23 -1
- package/package.json +3 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { b as AthenaGatewayConnectionOptions, c as AthenaGatewayConnectionResult,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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';
|
|
4
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';
|
|
5
6
|
|
|
6
7
|
declare function verifyAthenaGatewayUrl(baseUrl: string, options?: AthenaGatewayConnectionOptions): Promise<AthenaGatewayConnectionResult>;
|
|
@@ -43,6 +44,111 @@ declare function defineDatabase<Schemas extends Record<string, SchemaDef<Record<
|
|
|
43
44
|
*/
|
|
44
45
|
declare function defineRegistry<Databases extends Record<string, DatabaseDef<Record<string, SchemaDef<Record<string, AnyModelDef>>>>>>(databases: Databases): RegistryDef<Databases>;
|
|
45
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
|
+
|
|
46
152
|
type RegistryConstraint = RegistryDef<Record<string, DatabaseDef<Record<string, SchemaDef<Record<string, AnyModelDef>>>>>>;
|
|
47
153
|
/**
|
|
48
154
|
* Options for creating typed Athena clients.
|
|
@@ -50,26 +156,33 @@ type RegistryConstraint = RegistryDef<Record<string, DatabaseDef<Record<string,
|
|
|
50
156
|
interface TypedClientOptions<TMap extends TenantKeyMap = TenantKeyMap> extends Pick<AthenaGatewayCallOptions, 'backend' | 'client' | 'headers'> {
|
|
51
157
|
tenantKeyMap?: TMap;
|
|
52
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
|
+
};
|
|
53
165
|
}
|
|
54
166
|
/**
|
|
55
167
|
* Typed Athena client with registry-driven model resolution and tenant-context propagation.
|
|
56
168
|
*/
|
|
57
|
-
interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap extends TenantKeyMap = Record<never, string
|
|
169
|
+
interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap extends TenantKeyMap = Record<never, string>, TStrict extends boolean = false> extends AthenaSdkClient<TStrict> {
|
|
58
170
|
readonly registry: TRegistry;
|
|
59
171
|
readonly tenantKeyMap: Readonly<TTenantMap>;
|
|
60
172
|
readonly tenantContext: TenantContext<TTenantMap>;
|
|
61
|
-
withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap>;
|
|
173
|
+
withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
|
|
62
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>>, {
|
|
63
175
|
registry: TRegistry;
|
|
64
176
|
database: TDatabase;
|
|
65
177
|
schema: TSchema;
|
|
66
178
|
model: ModelAt<TRegistry, TDatabase, TSchema, TModel>;
|
|
67
|
-
}>;
|
|
179
|
+
}, TStrict>;
|
|
68
180
|
}
|
|
69
181
|
/**
|
|
70
182
|
* Creates a typed client bound to a registry contract and optional tenant header mapping.
|
|
71
183
|
*/
|
|
72
|
-
declare function createTypedClient<TRegistry extends RegistryConstraint, TTenantMap extends TenantKeyMap = Record<never, string>>(registry: TRegistry, url: string, apiKey: string, options
|
|
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>;
|
|
73
186
|
|
|
74
187
|
/**
|
|
75
188
|
* Constructor options for the PostgreSQL introspection provider.
|
|
@@ -301,4 +414,4 @@ declare function createAuthReactEmailInput<TProps extends AthenaAuthReactEmailPr
|
|
|
301
414
|
declare function defineAuthEmailTemplate<TProps extends AthenaAuthReactEmailProps = AthenaAuthReactEmailProps>(definition: AthenaAuthEmailTemplateDefinition<TProps>): AthenaAuthEmailTemplateBuilder<TProps>;
|
|
302
415
|
declare function renderAthenaReactEmail(input: AthenaAuthReactEmailRenderInput, options?: AthenaAuthReactEmailRuntimeOptions | AthenaAuthReactEmailConfig): Promise<AthenaAuthRenderedReactEmail>;
|
|
303
416
|
|
|
304
|
-
export { ATHENA_AUTH_BASE_ERROR_CODES as A,
|
|
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 };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { b as AthenaGatewayConnectionOptions, c as AthenaGatewayConnectionResult,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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.js';
|
|
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-DXPlOnlI.js';
|
|
3
|
+
import { ZodType } from 'zod';
|
|
4
|
+
import { l as GeneratorSchemaSelection, b as GeneratorProviderConfig } from './types-BzY6fETM.js';
|
|
4
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.js';
|
|
5
6
|
|
|
6
7
|
declare function verifyAthenaGatewayUrl(baseUrl: string, options?: AthenaGatewayConnectionOptions): Promise<AthenaGatewayConnectionResult>;
|
|
@@ -43,6 +44,111 @@ declare function defineDatabase<Schemas extends Record<string, SchemaDef<Record<
|
|
|
43
44
|
*/
|
|
44
45
|
declare function defineRegistry<Databases extends Record<string, DatabaseDef<Record<string, SchemaDef<Record<string, AnyModelDef>>>>>>(databases: Databases): RegistryDef<Databases>;
|
|
45
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
|
+
|
|
46
152
|
type RegistryConstraint = RegistryDef<Record<string, DatabaseDef<Record<string, SchemaDef<Record<string, AnyModelDef>>>>>>;
|
|
47
153
|
/**
|
|
48
154
|
* Options for creating typed Athena clients.
|
|
@@ -50,26 +156,33 @@ type RegistryConstraint = RegistryDef<Record<string, DatabaseDef<Record<string,
|
|
|
50
156
|
interface TypedClientOptions<TMap extends TenantKeyMap = TenantKeyMap> extends Pick<AthenaGatewayCallOptions, 'backend' | 'client' | 'headers'> {
|
|
51
157
|
tenantKeyMap?: TMap;
|
|
52
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
|
+
};
|
|
53
165
|
}
|
|
54
166
|
/**
|
|
55
167
|
* Typed Athena client with registry-driven model resolution and tenant-context propagation.
|
|
56
168
|
*/
|
|
57
|
-
interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap extends TenantKeyMap = Record<never, string
|
|
169
|
+
interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap extends TenantKeyMap = Record<never, string>, TStrict extends boolean = false> extends AthenaSdkClient<TStrict> {
|
|
58
170
|
readonly registry: TRegistry;
|
|
59
171
|
readonly tenantKeyMap: Readonly<TTenantMap>;
|
|
60
172
|
readonly tenantContext: TenantContext<TTenantMap>;
|
|
61
|
-
withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap>;
|
|
173
|
+
withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
|
|
62
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>>, {
|
|
63
175
|
registry: TRegistry;
|
|
64
176
|
database: TDatabase;
|
|
65
177
|
schema: TSchema;
|
|
66
178
|
model: ModelAt<TRegistry, TDatabase, TSchema, TModel>;
|
|
67
|
-
}>;
|
|
179
|
+
}, TStrict>;
|
|
68
180
|
}
|
|
69
181
|
/**
|
|
70
182
|
* Creates a typed client bound to a registry contract and optional tenant header mapping.
|
|
71
183
|
*/
|
|
72
|
-
declare function createTypedClient<TRegistry extends RegistryConstraint, TTenantMap extends TenantKeyMap = Record<never, string>>(registry: TRegistry, url: string, apiKey: string, options
|
|
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>;
|
|
73
186
|
|
|
74
187
|
/**
|
|
75
188
|
* Constructor options for the PostgreSQL introspection provider.
|
|
@@ -301,4 +414,4 @@ declare function createAuthReactEmailInput<TProps extends AthenaAuthReactEmailPr
|
|
|
301
414
|
declare function defineAuthEmailTemplate<TProps extends AthenaAuthReactEmailProps = AthenaAuthReactEmailProps>(definition: AthenaAuthEmailTemplateDefinition<TProps>): AthenaAuthEmailTemplateBuilder<TProps>;
|
|
302
415
|
declare function renderAthenaReactEmail(input: AthenaAuthReactEmailRenderInput, options?: AthenaAuthReactEmailRuntimeOptions | AthenaAuthReactEmailConfig): Promise<AthenaAuthRenderedReactEmail>;
|
|
303
416
|
|
|
304
|
-
export { ATHENA_AUTH_BASE_ERROR_CODES as A,
|
|
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 };
|