@xylex-group/athena 1.7.0 → 1.9.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/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- import { B as BackendConfig, a as BackendType, A as AthenaConditionValue, b as AthenaConditionCastType, c as AthenaConditionArrayValue, d as AthenaConditionOperator, e as AthenaGatewayCallOptions, f as AthenaGatewayErrorDetails, g as AthenaRpcCallOptions } from './types-wPA1Z4vQ.cjs';
2
- export { h as AthenaGatewayErrorCode, i as AthenaRpcFilter, j as AthenaRpcFilterOperator, k as AthenaRpcOrder, l as AthenaRpcPayload, m as Backend } from './types-wPA1Z4vQ.cjs';
3
- export { A as AthenaGatewayError, i as isAthenaGatewayError } from './errors-BJGgjHcI.cjs';
4
- import { S as SchemaDef, A as AnyModelDef, D as DatabaseDef, M as ModelMetadata, a as ModelDef, R as RegistryDef, T as TenantKeyMap, b as TenantContext, c as RowOf, d as ModelAt, e as SchemaIntrospectionProvider, f as AthenaGeneratorConfig, L as LoadGeneratorConfigOptions, g as LoadedGeneratorConfig, N as NormalizedAthenaGeneratorConfig, I as IntrospectionSnapshot, G as GeneratedArtifacts, h as IntrospectionColumn, i as GeneratorProviderConfig, j as GeneratorExperimentalFlags, k as GeneratorSchemaSelection } from './pipeline-BsKuBqmE.cjs';
5
- export { l as GeneratedArtifact, m as GeneratorArtifactKind, n as GeneratorFeatureFlags, o as GeneratorNamingConfig, p as GeneratorOutputConfig, q as GeneratorOutputTargets, r as InsertOf, s as IntrospectionInspectOptions, t as IntrospectionRelation, u as IntrospectionSchema, v as IntrospectionTable, w as IntrospectionTypeKind, x as ModelRelationKind, y as ModelRelationMetadata, z as NamingStyle, B as RunGeneratorOptions, C as RunGeneratorResult, E as TenantContextValue, U as UpdateOf, F as runSchemaGenerator } from './pipeline-BsKuBqmE.cjs';
1
+ import { B as BackendConfig, a as BackendType, A as AthenaJsonValue, b as AthenaConditionValue, c as AthenaConditionCastType, d as AthenaConditionArrayValue, e as AthenaConditionOperator, f as AthenaGatewayCallOptions, g as AthenaGatewayErrorDetails, h as AthenaJsonObject, i as AthenaRpcCallOptions, S as SchemaDef, j as AnyModelDef, D as DatabaseDef, M as ModelMetadata, k as ModelDef, R as RegistryDef, T as TenantKeyMap, l as TenantContext, m as RowOf, n as ModelAt, I as InsertOf, U as UpdateOf, o as SchemaIntrospectionProvider, p as IntrospectionSnapshot, q as IntrospectionColumn } from './types-BnzoaNRC.cjs';
2
+ export { r as AthenaGatewayErrorCode, s as AthenaJsonArray, t as AthenaJsonPrimitive, u as AthenaRpcFilter, v as AthenaRpcFilterOperator, w as AthenaRpcOrder, x as AthenaRpcPayload, y as Backend, z as IntrospectionInspectOptions, C as IntrospectionRelation, E as IntrospectionSchema, F as IntrospectionTable, G as IntrospectionTypeKind, H as ModelRelationKind, J as ModelRelationMetadata, K as TenantContextValue } from './types-BnzoaNRC.cjs';
3
+ export { A as AthenaGatewayError, M as ModelFormAdapter, a as ModelFormDefaults, b as ModelFormNullishMode, c as ModelFormValues, T as ToModelFormDefaultsOptions, d as ToModelPayloadOptions, e as createModelFormAdapter, i as isAthenaGatewayError, t as toModelFormDefaults, f as toModelPayload } from './model-form-DkS48fsh.cjs';
4
+ import { A as AthenaGeneratorConfig, L as LoadGeneratorConfigOptions, a as LoadedGeneratorConfig, N as NormalizedAthenaGeneratorConfig, G as GeneratedArtifacts, b as GeneratorProviderConfig, c as GeneratorExperimentalFlags, d as GeneratorSchemaSelection } from './pipeline-C-cN0ACi.cjs';
5
+ export { e as GeneratedArtifact, f as GeneratorArtifactKind, g as GeneratorFeatureFlags, h as GeneratorNamingConfig, i as GeneratorOutputConfig, j as GeneratorOutputTargets, k as NamingStyle, R as RunGeneratorOptions, l as RunGeneratorResult, r as runSchemaGenerator } from './pipeline-C-cN0ACi.cjs';
6
6
 
7
7
  interface AthenaResult<T> {
8
8
  data: T | null;
@@ -13,6 +13,9 @@ interface AthenaResult<T> {
13
13
  raw: unknown;
14
14
  }
15
15
  type MutationSingleResult<Result> = Result extends Array<infer Item> ? Item | null : Result | null;
16
+ type AthenaRowShape = Record<string, AthenaJsonValue | undefined>;
17
+ type FilterColumnKey<Row> = Extract<keyof NonNullable<Row>, string>;
18
+ type ResolvedFilterColumnKey<Row> = [FilterColumnKey<Row>] extends [never] ? string : FilterColumnKey<Row>;
16
19
  interface MutationQuery<Result> extends PromiseLike<AthenaResult<Result>> {
17
20
  select(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<Result>>;
18
21
  returning(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<Result>>;
@@ -26,39 +29,39 @@ interface OrderOptions {
26
29
  ascending?: boolean;
27
30
  }
28
31
  /** Shared filter chain - supports eq, limit, etc. in any order relative to select/update */
29
- interface FilterChain<Self> {
30
- eq(column: string, value: AthenaConditionValue): Self;
31
- eqCast(column: string, value: AthenaConditionValue, cast: AthenaConditionCastType): Self;
32
- eqUuid(column: string, value: string): Self;
33
- match(filters: Record<string, AthenaConditionValue>): Self;
32
+ interface FilterChain<Self, Row> {
33
+ eq(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
34
+ eqCast(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue, cast: AthenaConditionCastType): Self;
35
+ eqUuid(column: ResolvedFilterColumnKey<Row>, value: string): Self;
36
+ match(filters: Partial<Record<ResolvedFilterColumnKey<Row>, AthenaConditionValue>>): Self;
34
37
  range(from: number, to: number): Self;
35
38
  limit(count: number): Self;
36
39
  offset(count: number): Self;
37
40
  currentPage(value: number): Self;
38
41
  pageSize(value: number): Self;
39
42
  totalPages(value: number): Self;
40
- order(column: string, options?: OrderOptions): Self;
41
- gt(column: string, value: AthenaConditionValue): Self;
42
- gte(column: string, value: AthenaConditionValue): Self;
43
- lt(column: string, value: AthenaConditionValue): Self;
44
- lte(column: string, value: AthenaConditionValue): Self;
45
- neq(column: string, value: AthenaConditionValue): Self;
46
- like(column: string, value: AthenaConditionValue): Self;
47
- ilike(column: string, value: AthenaConditionValue): Self;
48
- is(column: string, value: AthenaConditionValue): Self;
49
- in(column: string, values: AthenaConditionArrayValue): Self;
50
- contains(column: string, values: AthenaConditionArrayValue): Self;
51
- containedBy(column: string, values: AthenaConditionArrayValue): Self;
52
- not(columnOrExpression: string, operator?: AthenaConditionOperator, value?: AthenaConditionValue): Self;
43
+ order(column: ResolvedFilterColumnKey<Row>, options?: OrderOptions): Self;
44
+ gt(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
45
+ gte(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
46
+ lt(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
47
+ lte(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
48
+ neq(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
49
+ like(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
50
+ ilike(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
51
+ is(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
52
+ in(column: ResolvedFilterColumnKey<Row>, values: AthenaConditionArrayValue): Self;
53
+ contains(column: ResolvedFilterColumnKey<Row>, values: AthenaConditionArrayValue): Self;
54
+ containedBy(column: ResolvedFilterColumnKey<Row>, values: AthenaConditionArrayValue): Self;
55
+ not(columnOrExpression: ResolvedFilterColumnKey<Row> | string, operator?: AthenaConditionOperator, value?: AthenaConditionValue): Self;
53
56
  or(expression: string): Self;
54
57
  }
55
58
  /** Chain returned by select() - supports filters and single/maybeSingle before execution */
56
- interface SelectChain<Row> extends FilterChain<SelectChain<Row>>, PromiseLike<AthenaResult<Row[]>> {
57
- single<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
58
- maybeSingle<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
59
+ interface SelectChain<Row, SelectedRow = Row> extends FilterChain<SelectChain<Row, SelectedRow>, Row>, PromiseLike<AthenaResult<SelectedRow[]>> {
60
+ single<T = SelectedRow>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
61
+ maybeSingle<T = SelectedRow>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
59
62
  }
60
63
  /** Chain returned by update() - supports filters before execution, plus select/returning */
61
- interface UpdateChain<Row> extends FilterChain<UpdateChain<Row>>, MutationQuery<Row[]> {
64
+ interface UpdateChain<Row> extends FilterChain<UpdateChain<Row>, Row>, MutationQuery<Row[]> {
62
65
  }
63
66
  interface RpcFilterChain<Self> {
64
67
  eq(column: string, value: AthenaConditionValue): Self;
@@ -84,29 +87,29 @@ interface RpcQueryBuilder<Row> extends RpcFilterChain<RpcQueryBuilder<Row>>, Pro
84
87
  offset(count: number): RpcQueryBuilder<Row>;
85
88
  range(from: number, to: number): RpcQueryBuilder<Row>;
86
89
  }
87
- interface TableQueryBuilder<Row> extends FilterChain<TableQueryBuilder<Row>> {
88
- select<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): SelectChain<T>;
89
- insert(values: Row, options?: AthenaGatewayCallOptions): MutationQuery<Row>;
90
- insert(values: Row[], options?: AthenaGatewayCallOptions): MutationQuery<Row[]>;
91
- upsert(values: Row, options?: AthenaGatewayCallOptions & {
92
- updateBody?: Partial<Row>;
90
+ interface TableQueryBuilder<Row, Insert = Partial<Row>, Update = Partial<Insert>> extends FilterChain<TableQueryBuilder<Row, Insert, Update>, Row> {
91
+ select<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): SelectChain<Row, T>;
92
+ insert(values: Insert, options?: AthenaGatewayCallOptions): MutationQuery<Row>;
93
+ insert(values: Insert[], options?: AthenaGatewayCallOptions): MutationQuery<Row[]>;
94
+ upsert(values: Insert, options?: AthenaGatewayCallOptions & {
95
+ updateBody?: Update;
93
96
  onConflict?: string | string[];
94
97
  }): MutationQuery<Row>;
95
- upsert(values: Row[], options?: AthenaGatewayCallOptions & {
96
- updateBody?: Partial<Row>;
98
+ upsert(values: Insert[], options?: AthenaGatewayCallOptions & {
99
+ updateBody?: Update;
97
100
  onConflict?: string | string[];
98
101
  }): MutationQuery<Row[]>;
99
- update(values: Partial<Row>, options?: AthenaGatewayCallOptions): UpdateChain<Row>;
102
+ update(values: Update, options?: AthenaGatewayCallOptions): UpdateChain<Row>;
100
103
  delete(options?: AthenaGatewayCallOptions & {
101
104
  resourceId?: string;
102
105
  }): MutationQuery<Row | null>;
103
106
  single<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
104
107
  maybeSingle<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
105
- reset(): TableQueryBuilder<Row>;
108
+ reset(): TableQueryBuilder<Row, Insert, Update>;
106
109
  }
107
110
  interface AthenaSdkClient {
108
- from<Row = unknown>(table: string): TableQueryBuilder<Row>;
109
- rpc<Row = unknown, Args extends Record<string, unknown> = Record<string, unknown>>(fn: string, args?: Args, options?: AthenaRpcCallOptions): RpcQueryBuilder<Row>;
111
+ from<Row = AthenaRowShape, Insert = Partial<Row>, Update = Partial<Insert>>(table: string): TableQueryBuilder<Row, Insert, Update>;
112
+ rpc<Row = unknown, Args extends AthenaJsonObject = AthenaJsonObject>(fn: string, args?: Args, options?: AthenaRpcCallOptions): RpcQueryBuilder<Row>;
110
113
  query<Row = unknown>(query: string, options?: AthenaGatewayCallOptions): Promise<AthenaResult<Row[]>>;
111
114
  }
112
115
  interface AthenaClientBuilder {
@@ -352,7 +355,7 @@ interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap ext
352
355
  readonly tenantKeyMap: Readonly<TTenantMap>;
353
356
  readonly tenantContext: TenantContext<TTenantMap>;
354
357
  withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap>;
355
- 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>>>;
358
+ 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>>>;
356
359
  }
357
360
  /**
358
361
  * Creates a typed client bound to a registry contract and optional tenant header mapping.
@@ -660,4 +663,4 @@ interface AthenaAuthSdkClient {
660
663
 
661
664
  declare function createAuthClient(config?: AthenaAuthClientConfig): AthenaAuthSdkClient;
662
665
 
663
- export { type AthenaAuthCallOptions, type AthenaAuthClientConfig, type AthenaAuthCredentials, type AthenaAuthEmailChangeResponse, type AthenaAuthEndpointPath, type AthenaAuthErrorCode, type AthenaAuthErrorDetails, type AthenaAuthLinkedAccount, type AthenaAuthMethod, type AthenaAuthQueryPrimitive, type AthenaAuthQueryValue, type AthenaAuthRequestInput, type AthenaAuthResult, type AthenaAuthRevokeSessionRequest, type AthenaAuthSdkClient, type AthenaAuthSession, type AthenaAuthSessionResponse, type AthenaAuthSignInResponse, type AthenaAuthSignOutResponse, type AthenaAuthSocialRedirectResponse, type AthenaAuthStatusResponse, type AthenaAuthUser, type AthenaChangeEmailRequest, type AthenaChangePasswordRequest, AthenaClient, AthenaConditionCastType, type AthenaDeleteUserCallbackRequest, type AthenaDeleteUserRequest, type AthenaDeleteUserResponse, type AthenaEmailSignInRequest, type AthenaEmailSignUpRequest, AthenaError, AthenaErrorCategory, AthenaErrorCode, type AthenaErrorInput, AthenaErrorKind, type AthenaForgetPasswordRequest, AthenaGatewayCallOptions, AthenaGatewayErrorDetails, AthenaGeneratorConfig, type AthenaLinkSocialRequest, type AthenaOAuthAccountTokenRequest, type AthenaOAuthTokenBundle, type AthenaOperationContext, type AthenaResetPasswordRequest, type AthenaResult, AthenaRpcCallOptions, type AthenaSdkClient, type AthenaSendVerificationEmailRequest, type AthenaSocialSignInRequest, type AthenaUnlinkAccountRequest, type AthenaUpdateUserRequest, type AthenaUsernameSignInRequest, type AthenaVerifyEmailRequest, BackendConfig, BackendType, DEFAULT_POSTGRES_SCHEMAS, DatabaseDef, GeneratedArtifacts, GeneratorExperimentalFlags, GeneratorProviderConfig, GeneratorSchemaSelection, type IntCoercionOptions, IntrospectionColumn, IntrospectionSnapshot, LoadGeneratorConfigOptions, LoadedGeneratorConfig, ModelAt, ModelDef, ModelMetadata, type NormalizedAthenaError, NormalizedAthenaGeneratorConfig, type PostgresIntrospectionProviderOptions, RegistryDef, type RequireAffectedOptions, type RetryBackoffStrategy, type RetryConfig, RowOf, type RpcOrderOptions, type RpcQueryBuilder, SchemaDef, SchemaIntrospectionProvider, type TableQueryBuilder, TenantContext, TenantKeyMap, type TypedAthenaClient, type TypedClientOptions, type UnwrapOneOptions, type UnwrapOptions, assertInt, coerceInt, createAuthClient, createClient, createPostgresIntrospectionProvider, createTypedClient, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, findGeneratorConfigPath, generateArtifactsFromSnapshot, identifier, isOk, loadGeneratorConfig, normalizeAthenaError, normalizeGeneratorConfig, normalizeSchemaSelection, requireAffected, requireSuccess, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, unwrap, unwrapOne, unwrapRows, withRetry };
666
+ export { type AthenaAuthCallOptions, type AthenaAuthClientConfig, type AthenaAuthCredentials, type AthenaAuthEmailChangeResponse, type AthenaAuthEndpointPath, type AthenaAuthErrorCode, type AthenaAuthErrorDetails, type AthenaAuthLinkedAccount, type AthenaAuthMethod, type AthenaAuthQueryPrimitive, type AthenaAuthQueryValue, type AthenaAuthRequestInput, type AthenaAuthResult, type AthenaAuthRevokeSessionRequest, type AthenaAuthSdkClient, type AthenaAuthSession, type AthenaAuthSessionResponse, type AthenaAuthSignInResponse, type AthenaAuthSignOutResponse, type AthenaAuthSocialRedirectResponse, type AthenaAuthStatusResponse, type AthenaAuthUser, type AthenaChangeEmailRequest, type AthenaChangePasswordRequest, AthenaClient, AthenaConditionCastType, type AthenaDeleteUserCallbackRequest, type AthenaDeleteUserRequest, type AthenaDeleteUserResponse, type AthenaEmailSignInRequest, type AthenaEmailSignUpRequest, AthenaError, AthenaErrorCategory, AthenaErrorCode, type AthenaErrorInput, AthenaErrorKind, type AthenaForgetPasswordRequest, AthenaGatewayCallOptions, AthenaGatewayErrorDetails, AthenaGeneratorConfig, AthenaJsonObject, AthenaJsonValue, type AthenaLinkSocialRequest, type AthenaOAuthAccountTokenRequest, type AthenaOAuthTokenBundle, type AthenaOperationContext, type AthenaResetPasswordRequest, type AthenaResult, AthenaRpcCallOptions, type AthenaSdkClient, type AthenaSendVerificationEmailRequest, type AthenaSocialSignInRequest, type AthenaUnlinkAccountRequest, type AthenaUpdateUserRequest, type AthenaUsernameSignInRequest, type AthenaVerifyEmailRequest, BackendConfig, BackendType, DEFAULT_POSTGRES_SCHEMAS, DatabaseDef, GeneratedArtifacts, GeneratorExperimentalFlags, GeneratorProviderConfig, GeneratorSchemaSelection, InsertOf, type IntCoercionOptions, IntrospectionColumn, IntrospectionSnapshot, LoadGeneratorConfigOptions, LoadedGeneratorConfig, ModelAt, ModelDef, ModelMetadata, type NormalizedAthenaError, NormalizedAthenaGeneratorConfig, type PostgresIntrospectionProviderOptions, RegistryDef, type RequireAffectedOptions, type RetryBackoffStrategy, type RetryConfig, RowOf, type RpcOrderOptions, type RpcQueryBuilder, SchemaDef, SchemaIntrospectionProvider, type TableQueryBuilder, TenantContext, TenantKeyMap, type TypedAthenaClient, type TypedClientOptions, type UnwrapOneOptions, type UnwrapOptions, UpdateOf, assertInt, coerceInt, createAuthClient, createClient, createPostgresIntrospectionProvider, createTypedClient, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, findGeneratorConfigPath, generateArtifactsFromSnapshot, identifier, isOk, loadGeneratorConfig, normalizeAthenaError, normalizeGeneratorConfig, normalizeSchemaSelection, requireAffected, requireSuccess, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, unwrap, unwrapOne, unwrapRows, withRetry };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { B as BackendConfig, a as BackendType, A as AthenaConditionValue, b as AthenaConditionCastType, c as AthenaConditionArrayValue, d as AthenaConditionOperator, e as AthenaGatewayCallOptions, f as AthenaGatewayErrorDetails, g as AthenaRpcCallOptions } from './types-wPA1Z4vQ.js';
2
- export { h as AthenaGatewayErrorCode, i as AthenaRpcFilter, j as AthenaRpcFilterOperator, k as AthenaRpcOrder, l as AthenaRpcPayload, m as Backend } from './types-wPA1Z4vQ.js';
3
- export { A as AthenaGatewayError, i as isAthenaGatewayError } from './errors-Bcf5Sftv.js';
4
- import { S as SchemaDef, A as AnyModelDef, D as DatabaseDef, M as ModelMetadata, a as ModelDef, R as RegistryDef, T as TenantKeyMap, b as TenantContext, c as RowOf, d as ModelAt, e as SchemaIntrospectionProvider, f as AthenaGeneratorConfig, L as LoadGeneratorConfigOptions, g as LoadedGeneratorConfig, N as NormalizedAthenaGeneratorConfig, I as IntrospectionSnapshot, G as GeneratedArtifacts, h as IntrospectionColumn, i as GeneratorProviderConfig, j as GeneratorExperimentalFlags, k as GeneratorSchemaSelection } from './pipeline-xQSjGbqF.js';
5
- export { l as GeneratedArtifact, m as GeneratorArtifactKind, n as GeneratorFeatureFlags, o as GeneratorNamingConfig, p as GeneratorOutputConfig, q as GeneratorOutputTargets, r as InsertOf, s as IntrospectionInspectOptions, t as IntrospectionRelation, u as IntrospectionSchema, v as IntrospectionTable, w as IntrospectionTypeKind, x as ModelRelationKind, y as ModelRelationMetadata, z as NamingStyle, B as RunGeneratorOptions, C as RunGeneratorResult, E as TenantContextValue, U as UpdateOf, F as runSchemaGenerator } from './pipeline-xQSjGbqF.js';
1
+ import { B as BackendConfig, a as BackendType, A as AthenaJsonValue, b as AthenaConditionValue, c as AthenaConditionCastType, d as AthenaConditionArrayValue, e as AthenaConditionOperator, f as AthenaGatewayCallOptions, g as AthenaGatewayErrorDetails, h as AthenaJsonObject, i as AthenaRpcCallOptions, S as SchemaDef, j as AnyModelDef, D as DatabaseDef, M as ModelMetadata, k as ModelDef, R as RegistryDef, T as TenantKeyMap, l as TenantContext, m as RowOf, n as ModelAt, I as InsertOf, U as UpdateOf, o as SchemaIntrospectionProvider, p as IntrospectionSnapshot, q as IntrospectionColumn } from './types-BnzoaNRC.js';
2
+ export { r as AthenaGatewayErrorCode, s as AthenaJsonArray, t as AthenaJsonPrimitive, u as AthenaRpcFilter, v as AthenaRpcFilterOperator, w as AthenaRpcOrder, x as AthenaRpcPayload, y as Backend, z as IntrospectionInspectOptions, C as IntrospectionRelation, E as IntrospectionSchema, F as IntrospectionTable, G as IntrospectionTypeKind, H as ModelRelationKind, J as ModelRelationMetadata, K as TenantContextValue } from './types-BnzoaNRC.js';
3
+ export { A as AthenaGatewayError, M as ModelFormAdapter, a as ModelFormDefaults, b as ModelFormNullishMode, c as ModelFormValues, T as ToModelFormDefaultsOptions, d as ToModelPayloadOptions, e as createModelFormAdapter, i as isAthenaGatewayError, t as toModelFormDefaults, f as toModelPayload } from './model-form-Bm_kqCn2.js';
4
+ import { A as AthenaGeneratorConfig, L as LoadGeneratorConfigOptions, a as LoadedGeneratorConfig, N as NormalizedAthenaGeneratorConfig, G as GeneratedArtifacts, b as GeneratorProviderConfig, c as GeneratorExperimentalFlags, d as GeneratorSchemaSelection } from './pipeline-CQgV-Yfo.js';
5
+ export { e as GeneratedArtifact, f as GeneratorArtifactKind, g as GeneratorFeatureFlags, h as GeneratorNamingConfig, i as GeneratorOutputConfig, j as GeneratorOutputTargets, k as NamingStyle, R as RunGeneratorOptions, l as RunGeneratorResult, r as runSchemaGenerator } from './pipeline-CQgV-Yfo.js';
6
6
 
7
7
  interface AthenaResult<T> {
8
8
  data: T | null;
@@ -13,6 +13,9 @@ interface AthenaResult<T> {
13
13
  raw: unknown;
14
14
  }
15
15
  type MutationSingleResult<Result> = Result extends Array<infer Item> ? Item | null : Result | null;
16
+ type AthenaRowShape = Record<string, AthenaJsonValue | undefined>;
17
+ type FilterColumnKey<Row> = Extract<keyof NonNullable<Row>, string>;
18
+ type ResolvedFilterColumnKey<Row> = [FilterColumnKey<Row>] extends [never] ? string : FilterColumnKey<Row>;
16
19
  interface MutationQuery<Result> extends PromiseLike<AthenaResult<Result>> {
17
20
  select(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<Result>>;
18
21
  returning(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<Result>>;
@@ -26,39 +29,39 @@ interface OrderOptions {
26
29
  ascending?: boolean;
27
30
  }
28
31
  /** Shared filter chain - supports eq, limit, etc. in any order relative to select/update */
29
- interface FilterChain<Self> {
30
- eq(column: string, value: AthenaConditionValue): Self;
31
- eqCast(column: string, value: AthenaConditionValue, cast: AthenaConditionCastType): Self;
32
- eqUuid(column: string, value: string): Self;
33
- match(filters: Record<string, AthenaConditionValue>): Self;
32
+ interface FilterChain<Self, Row> {
33
+ eq(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
34
+ eqCast(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue, cast: AthenaConditionCastType): Self;
35
+ eqUuid(column: ResolvedFilterColumnKey<Row>, value: string): Self;
36
+ match(filters: Partial<Record<ResolvedFilterColumnKey<Row>, AthenaConditionValue>>): Self;
34
37
  range(from: number, to: number): Self;
35
38
  limit(count: number): Self;
36
39
  offset(count: number): Self;
37
40
  currentPage(value: number): Self;
38
41
  pageSize(value: number): Self;
39
42
  totalPages(value: number): Self;
40
- order(column: string, options?: OrderOptions): Self;
41
- gt(column: string, value: AthenaConditionValue): Self;
42
- gte(column: string, value: AthenaConditionValue): Self;
43
- lt(column: string, value: AthenaConditionValue): Self;
44
- lte(column: string, value: AthenaConditionValue): Self;
45
- neq(column: string, value: AthenaConditionValue): Self;
46
- like(column: string, value: AthenaConditionValue): Self;
47
- ilike(column: string, value: AthenaConditionValue): Self;
48
- is(column: string, value: AthenaConditionValue): Self;
49
- in(column: string, values: AthenaConditionArrayValue): Self;
50
- contains(column: string, values: AthenaConditionArrayValue): Self;
51
- containedBy(column: string, values: AthenaConditionArrayValue): Self;
52
- not(columnOrExpression: string, operator?: AthenaConditionOperator, value?: AthenaConditionValue): Self;
43
+ order(column: ResolvedFilterColumnKey<Row>, options?: OrderOptions): Self;
44
+ gt(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
45
+ gte(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
46
+ lt(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
47
+ lte(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
48
+ neq(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
49
+ like(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
50
+ ilike(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
51
+ is(column: ResolvedFilterColumnKey<Row>, value: AthenaConditionValue): Self;
52
+ in(column: ResolvedFilterColumnKey<Row>, values: AthenaConditionArrayValue): Self;
53
+ contains(column: ResolvedFilterColumnKey<Row>, values: AthenaConditionArrayValue): Self;
54
+ containedBy(column: ResolvedFilterColumnKey<Row>, values: AthenaConditionArrayValue): Self;
55
+ not(columnOrExpression: ResolvedFilterColumnKey<Row> | string, operator?: AthenaConditionOperator, value?: AthenaConditionValue): Self;
53
56
  or(expression: string): Self;
54
57
  }
55
58
  /** Chain returned by select() - supports filters and single/maybeSingle before execution */
56
- interface SelectChain<Row> extends FilterChain<SelectChain<Row>>, PromiseLike<AthenaResult<Row[]>> {
57
- single<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
58
- maybeSingle<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
59
+ interface SelectChain<Row, SelectedRow = Row> extends FilterChain<SelectChain<Row, SelectedRow>, Row>, PromiseLike<AthenaResult<SelectedRow[]>> {
60
+ single<T = SelectedRow>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
61
+ maybeSingle<T = SelectedRow>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
59
62
  }
60
63
  /** Chain returned by update() - supports filters before execution, plus select/returning */
61
- interface UpdateChain<Row> extends FilterChain<UpdateChain<Row>>, MutationQuery<Row[]> {
64
+ interface UpdateChain<Row> extends FilterChain<UpdateChain<Row>, Row>, MutationQuery<Row[]> {
62
65
  }
63
66
  interface RpcFilterChain<Self> {
64
67
  eq(column: string, value: AthenaConditionValue): Self;
@@ -84,29 +87,29 @@ interface RpcQueryBuilder<Row> extends RpcFilterChain<RpcQueryBuilder<Row>>, Pro
84
87
  offset(count: number): RpcQueryBuilder<Row>;
85
88
  range(from: number, to: number): RpcQueryBuilder<Row>;
86
89
  }
87
- interface TableQueryBuilder<Row> extends FilterChain<TableQueryBuilder<Row>> {
88
- select<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): SelectChain<T>;
89
- insert(values: Row, options?: AthenaGatewayCallOptions): MutationQuery<Row>;
90
- insert(values: Row[], options?: AthenaGatewayCallOptions): MutationQuery<Row[]>;
91
- upsert(values: Row, options?: AthenaGatewayCallOptions & {
92
- updateBody?: Partial<Row>;
90
+ interface TableQueryBuilder<Row, Insert = Partial<Row>, Update = Partial<Insert>> extends FilterChain<TableQueryBuilder<Row, Insert, Update>, Row> {
91
+ select<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): SelectChain<Row, T>;
92
+ insert(values: Insert, options?: AthenaGatewayCallOptions): MutationQuery<Row>;
93
+ insert(values: Insert[], options?: AthenaGatewayCallOptions): MutationQuery<Row[]>;
94
+ upsert(values: Insert, options?: AthenaGatewayCallOptions & {
95
+ updateBody?: Update;
93
96
  onConflict?: string | string[];
94
97
  }): MutationQuery<Row>;
95
- upsert(values: Row[], options?: AthenaGatewayCallOptions & {
96
- updateBody?: Partial<Row>;
98
+ upsert(values: Insert[], options?: AthenaGatewayCallOptions & {
99
+ updateBody?: Update;
97
100
  onConflict?: string | string[];
98
101
  }): MutationQuery<Row[]>;
99
- update(values: Partial<Row>, options?: AthenaGatewayCallOptions): UpdateChain<Row>;
102
+ update(values: Update, options?: AthenaGatewayCallOptions): UpdateChain<Row>;
100
103
  delete(options?: AthenaGatewayCallOptions & {
101
104
  resourceId?: string;
102
105
  }): MutationQuery<Row | null>;
103
106
  single<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
104
107
  maybeSingle<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): Promise<AthenaResult<T | null>>;
105
- reset(): TableQueryBuilder<Row>;
108
+ reset(): TableQueryBuilder<Row, Insert, Update>;
106
109
  }
107
110
  interface AthenaSdkClient {
108
- from<Row = unknown>(table: string): TableQueryBuilder<Row>;
109
- rpc<Row = unknown, Args extends Record<string, unknown> = Record<string, unknown>>(fn: string, args?: Args, options?: AthenaRpcCallOptions): RpcQueryBuilder<Row>;
111
+ from<Row = AthenaRowShape, Insert = Partial<Row>, Update = Partial<Insert>>(table: string): TableQueryBuilder<Row, Insert, Update>;
112
+ rpc<Row = unknown, Args extends AthenaJsonObject = AthenaJsonObject>(fn: string, args?: Args, options?: AthenaRpcCallOptions): RpcQueryBuilder<Row>;
110
113
  query<Row = unknown>(query: string, options?: AthenaGatewayCallOptions): Promise<AthenaResult<Row[]>>;
111
114
  }
112
115
  interface AthenaClientBuilder {
@@ -352,7 +355,7 @@ interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap ext
352
355
  readonly tenantKeyMap: Readonly<TTenantMap>;
353
356
  readonly tenantContext: TenantContext<TTenantMap>;
354
357
  withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap>;
355
- 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>>>;
358
+ 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>>>;
356
359
  }
357
360
  /**
358
361
  * Creates a typed client bound to a registry contract and optional tenant header mapping.
@@ -660,4 +663,4 @@ interface AthenaAuthSdkClient {
660
663
 
661
664
  declare function createAuthClient(config?: AthenaAuthClientConfig): AthenaAuthSdkClient;
662
665
 
663
- export { type AthenaAuthCallOptions, type AthenaAuthClientConfig, type AthenaAuthCredentials, type AthenaAuthEmailChangeResponse, type AthenaAuthEndpointPath, type AthenaAuthErrorCode, type AthenaAuthErrorDetails, type AthenaAuthLinkedAccount, type AthenaAuthMethod, type AthenaAuthQueryPrimitive, type AthenaAuthQueryValue, type AthenaAuthRequestInput, type AthenaAuthResult, type AthenaAuthRevokeSessionRequest, type AthenaAuthSdkClient, type AthenaAuthSession, type AthenaAuthSessionResponse, type AthenaAuthSignInResponse, type AthenaAuthSignOutResponse, type AthenaAuthSocialRedirectResponse, type AthenaAuthStatusResponse, type AthenaAuthUser, type AthenaChangeEmailRequest, type AthenaChangePasswordRequest, AthenaClient, AthenaConditionCastType, type AthenaDeleteUserCallbackRequest, type AthenaDeleteUserRequest, type AthenaDeleteUserResponse, type AthenaEmailSignInRequest, type AthenaEmailSignUpRequest, AthenaError, AthenaErrorCategory, AthenaErrorCode, type AthenaErrorInput, AthenaErrorKind, type AthenaForgetPasswordRequest, AthenaGatewayCallOptions, AthenaGatewayErrorDetails, AthenaGeneratorConfig, type AthenaLinkSocialRequest, type AthenaOAuthAccountTokenRequest, type AthenaOAuthTokenBundle, type AthenaOperationContext, type AthenaResetPasswordRequest, type AthenaResult, AthenaRpcCallOptions, type AthenaSdkClient, type AthenaSendVerificationEmailRequest, type AthenaSocialSignInRequest, type AthenaUnlinkAccountRequest, type AthenaUpdateUserRequest, type AthenaUsernameSignInRequest, type AthenaVerifyEmailRequest, BackendConfig, BackendType, DEFAULT_POSTGRES_SCHEMAS, DatabaseDef, GeneratedArtifacts, GeneratorExperimentalFlags, GeneratorProviderConfig, GeneratorSchemaSelection, type IntCoercionOptions, IntrospectionColumn, IntrospectionSnapshot, LoadGeneratorConfigOptions, LoadedGeneratorConfig, ModelAt, ModelDef, ModelMetadata, type NormalizedAthenaError, NormalizedAthenaGeneratorConfig, type PostgresIntrospectionProviderOptions, RegistryDef, type RequireAffectedOptions, type RetryBackoffStrategy, type RetryConfig, RowOf, type RpcOrderOptions, type RpcQueryBuilder, SchemaDef, SchemaIntrospectionProvider, type TableQueryBuilder, TenantContext, TenantKeyMap, type TypedAthenaClient, type TypedClientOptions, type UnwrapOneOptions, type UnwrapOptions, assertInt, coerceInt, createAuthClient, createClient, createPostgresIntrospectionProvider, createTypedClient, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, findGeneratorConfigPath, generateArtifactsFromSnapshot, identifier, isOk, loadGeneratorConfig, normalizeAthenaError, normalizeGeneratorConfig, normalizeSchemaSelection, requireAffected, requireSuccess, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, unwrap, unwrapOne, unwrapRows, withRetry };
666
+ export { type AthenaAuthCallOptions, type AthenaAuthClientConfig, type AthenaAuthCredentials, type AthenaAuthEmailChangeResponse, type AthenaAuthEndpointPath, type AthenaAuthErrorCode, type AthenaAuthErrorDetails, type AthenaAuthLinkedAccount, type AthenaAuthMethod, type AthenaAuthQueryPrimitive, type AthenaAuthQueryValue, type AthenaAuthRequestInput, type AthenaAuthResult, type AthenaAuthRevokeSessionRequest, type AthenaAuthSdkClient, type AthenaAuthSession, type AthenaAuthSessionResponse, type AthenaAuthSignInResponse, type AthenaAuthSignOutResponse, type AthenaAuthSocialRedirectResponse, type AthenaAuthStatusResponse, type AthenaAuthUser, type AthenaChangeEmailRequest, type AthenaChangePasswordRequest, AthenaClient, AthenaConditionCastType, type AthenaDeleteUserCallbackRequest, type AthenaDeleteUserRequest, type AthenaDeleteUserResponse, type AthenaEmailSignInRequest, type AthenaEmailSignUpRequest, AthenaError, AthenaErrorCategory, AthenaErrorCode, type AthenaErrorInput, AthenaErrorKind, type AthenaForgetPasswordRequest, AthenaGatewayCallOptions, AthenaGatewayErrorDetails, AthenaGeneratorConfig, AthenaJsonObject, AthenaJsonValue, type AthenaLinkSocialRequest, type AthenaOAuthAccountTokenRequest, type AthenaOAuthTokenBundle, type AthenaOperationContext, type AthenaResetPasswordRequest, type AthenaResult, AthenaRpcCallOptions, type AthenaSdkClient, type AthenaSendVerificationEmailRequest, type AthenaSocialSignInRequest, type AthenaUnlinkAccountRequest, type AthenaUpdateUserRequest, type AthenaUsernameSignInRequest, type AthenaVerifyEmailRequest, BackendConfig, BackendType, DEFAULT_POSTGRES_SCHEMAS, DatabaseDef, GeneratedArtifacts, GeneratorExperimentalFlags, GeneratorProviderConfig, GeneratorSchemaSelection, InsertOf, type IntCoercionOptions, IntrospectionColumn, IntrospectionSnapshot, LoadGeneratorConfigOptions, LoadedGeneratorConfig, ModelAt, ModelDef, ModelMetadata, type NormalizedAthenaError, NormalizedAthenaGeneratorConfig, type PostgresIntrospectionProviderOptions, RegistryDef, type RequireAffectedOptions, type RetryBackoffStrategy, type RetryConfig, RowOf, type RpcOrderOptions, type RpcQueryBuilder, SchemaDef, SchemaIntrospectionProvider, type TableQueryBuilder, TenantContext, TenantKeyMap, type TypedAthenaClient, type TypedClientOptions, type UnwrapOneOptions, type UnwrapOptions, UpdateOf, assertInt, coerceInt, createAuthClient, createClient, createPostgresIntrospectionProvider, createTypedClient, defineDatabase, defineGeneratorConfig, defineModel, defineRegistry, defineSchema, findGeneratorConfigPath, generateArtifactsFromSnapshot, identifier, isOk, loadGeneratorConfig, normalizeAthenaError, normalizeGeneratorConfig, normalizeSchemaSelection, requireAffected, requireSuccess, resolveGeneratorProvider, resolvePostgresColumnType, resolveProviderSchemas, unwrap, unwrapOne, unwrapRows, withRetry };