@xylex-group/athena 2.8.0 → 2.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.
Files changed (52) hide show
  1. package/README.md +165 -68
  2. package/dist/browser.cjs +1331 -70
  3. package/dist/browser.cjs.map +1 -1
  4. package/dist/browser.d.cts +8 -7
  5. package/dist/browser.d.ts +8 -7
  6. package/dist/browser.js +1325 -71
  7. package/dist/browser.js.map +1 -1
  8. package/dist/cli/index.cjs +1354 -117
  9. package/dist/cli/index.cjs.map +1 -1
  10. package/dist/cli/index.d.cts +3 -3
  11. package/dist/cli/index.d.ts +3 -3
  12. package/dist/cli/index.js +1354 -117
  13. package/dist/cli/index.js.map +1 -1
  14. package/dist/{model-form-DMed05gE.d.cts → client-CfAE_QOj.d.cts} +741 -132
  15. package/dist/{model-form-DXPlOnlI.d.ts → client-D6EIJdQS.d.ts} +741 -132
  16. package/dist/index.cjs +1391 -71
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +8 -7
  19. package/dist/index.d.ts +8 -7
  20. package/dist/index.js +1385 -72
  21. package/dist/index.js.map +1 -1
  22. package/dist/model-form-ByvyyvxB.d.ts +96 -0
  23. package/dist/model-form-DACdBLYG.d.cts +96 -0
  24. package/dist/next/client.cjs +7875 -0
  25. package/dist/next/client.cjs.map +1 -0
  26. package/dist/next/client.d.cts +25 -0
  27. package/dist/next/client.d.ts +25 -0
  28. package/dist/next/client.js +7873 -0
  29. package/dist/next/client.js.map +1 -0
  30. package/dist/next/server.cjs +7993 -0
  31. package/dist/next/server.cjs.map +1 -0
  32. package/dist/next/server.d.cts +52 -0
  33. package/dist/next/server.d.ts +52 -0
  34. package/dist/next/server.js +7990 -0
  35. package/dist/next/server.js.map +1 -0
  36. package/dist/{pipeline-D4sJRKqN.d.cts → pipeline-CmUZsXsi.d.cts} +1 -1
  37. package/dist/{pipeline-CkMnhwPI.d.ts → pipeline-DZMsPxUg.d.ts} +1 -1
  38. package/dist/{react-email-DZhDDlEl.d.cts → react-email-BvJ3fj_F.d.cts} +35 -7
  39. package/dist/{react-email-Lrz9A-BW.d.ts → react-email-PLAJuZuO.d.ts} +35 -7
  40. package/dist/react.cjs +30 -1
  41. package/dist/react.cjs.map +1 -1
  42. package/dist/react.d.cts +39 -10
  43. package/dist/react.d.ts +39 -10
  44. package/dist/react.js +30 -2
  45. package/dist/react.js.map +1 -1
  46. package/dist/shared-BW6hoLBY.d.cts +33 -0
  47. package/dist/shared-BiJvoURI.d.ts +33 -0
  48. package/dist/{types-vikz9YIO.d.cts → types-BeZIHduP.d.cts} +5 -1
  49. package/dist/{types-vikz9YIO.d.ts → types-BeZIHduP.d.ts} +5 -1
  50. package/dist/{types-CAtTGGoz.d.cts → types-C-YvfgYh.d.cts} +27 -2
  51. package/dist/{types-BzY6fETM.d.ts → types-CRjDwmtJ.d.ts} +27 -2
  52. package/package.json +37 -49
@@ -1,4 +1,4 @@
1
- import { R as RunGeneratorOptions, o as RunGeneratorResult } from './types-CAtTGGoz.cjs';
1
+ import { R as RunGeneratorOptions, s as RunGeneratorResult } from './types-C-YvfgYh.cjs';
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, o as RunGeneratorResult } from './types-BzY6fETM.js';
1
+ import { R as RunGeneratorOptions, s as RunGeneratorResult } from './types-CRjDwmtJ.js';
2
2
 
3
3
  /**
4
4
  * End-to-end generator execution: load config, introspect, render, and optionally write files.
@@ -1,11 +1,10 @@
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';
1
+ import { 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, I as IntrospectionSnapshot } from './types-BeZIHduP.cjs';
2
+ import { b as ModelFormNullishMode, c as ModelFormValues } from './model-form-DACdBLYG.cjs';
3
3
  import { ZodType } from 'zod';
4
- import { l as GeneratorSchemaSelection, b as GeneratorProviderConfig } from './types-CAtTGGoz.cjs';
4
+ import { bi as AthenaSdkClient, ar as AthenaClientContextOptions, ay as AthenaClientSessionLike, az as AthenaClientSessionOptions, dt as TableQueryBuilder, aA as AthenaCreateClientAuthOptions, as as AthenaClientExperimentalOptions, D as AthenaAuthClientConfig, ad as AthenaAuthSdkClient, a5 as AthenaAuthReactEmailProps, a2 as AthenaAuthReactEmailComponent, a7 as AthenaAuthReactEmailRenderInput, I as AthenaAuthEmailTemplateDefinition, G as AthenaAuthEmailTemplateBuilder, a8 as AthenaAuthReactEmailRenderOptions, a6 as AthenaAuthReactEmailRenderEvent, a3 as AthenaAuthReactEmailConfig } from './client-CfAE_QOj.cjs';
5
+ import { n as GeneratorSchemaSelection, b as GeneratorProviderConfig, q as NormalizedGeneratorFilterConfig, o as GeneratorTableSelection } from './types-C-YvfgYh.cjs';
5
6
  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
 
7
- declare function verifyAthenaGatewayUrl(baseUrl: string, options?: AthenaGatewayConnectionOptions): Promise<AthenaGatewayConnectionResult>;
8
-
9
8
  interface NormalizeAthenaGatewayBaseUrlOptions {
10
9
  defaultBaseUrl?: string;
11
10
  label?: string;
@@ -26,6 +25,10 @@ interface SqlIdentifier {
26
25
  declare function identifier(...segments: string[]): SqlIdentifier;
27
26
 
28
27
  /**
28
+ * @deprecated Prefer `table(...).schema(...).columns(...).primaryKey(...)` for
29
+ * new model contracts. `defineModel(...)` is retained for legacy compatibility,
30
+ * manual low-level contracts, and legacy generator output.
31
+ *
29
32
  * Declares a model contract with explicit metadata and typed row/insert/update shapes.
30
33
  */
31
34
  declare function defineModel<Row, Insert = Partial<Row>, Update = Partial<Insert>, Meta extends ModelMetadata<Row> = ModelMetadata<Row>>(input: {
@@ -142,6 +145,8 @@ interface AthenaTableColumnsBuilder<TName extends string, TMappedName extends st
142
145
  readonly columns: Readonly<TColumns>;
143
146
  from<TNextMappedName extends string>(tableName: TNextMappedName): AthenaTableColumnsBuilder<TName, TNextMappedName, TSchemaName, TColumns>;
144
147
  schema<TNextSchemaName extends string>(schemaName: TNextSchemaName): AthenaTableColumnsBuilder<TName, TMappedName, TNextSchemaName, TColumns>;
148
+ withoutPrimaryKey(): AthenaTableDef<TColumns, TName, TMappedName, TSchemaName>;
149
+ primaryKey(): AthenaTableDef<TColumns, TName, TMappedName, TSchemaName>;
145
150
  primaryKey<TPrimaryKey extends readonly [
146
151
  Extract<keyof TColumns, string>,
147
152
  ...Array<Extract<keyof TColumns, string>>
@@ -153,7 +158,8 @@ type RegistryConstraint = RegistryDef<Record<string, DatabaseDef<Record<string,
153
158
  /**
154
159
  * Options for creating typed Athena clients.
155
160
  */
156
- interface TypedClientOptions<TMap extends TenantKeyMap = TenantKeyMap> extends Pick<AthenaGatewayCallOptions, 'backend' | 'client' | 'headers'> {
161
+ interface TypedClientOptions<TMap extends TenantKeyMap = TenantKeyMap> extends Pick<AthenaGatewayCallOptions, 'backend' | 'client' | 'headers' | 'forceNoCache' | 'userId' | 'organizationId'> {
162
+ auth?: Omit<AthenaCreateClientAuthOptions, 'url' | 'baseUrl' | 'apiKey'>;
157
163
  tenantKeyMap?: TMap;
158
164
  tenantContext?: TenantContext<TMap>;
159
165
  experimental?: AthenaClientExperimentalOptions;
@@ -170,6 +176,8 @@ interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap ext
170
176
  readonly registry: TRegistry;
171
177
  readonly tenantKeyMap: Readonly<TTenantMap>;
172
178
  readonly tenantContext: TenantContext<TTenantMap>;
179
+ withContext(context?: AthenaClientContextOptions): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
180
+ withSession(session?: AthenaClientSessionLike | null, options?: AthenaClientSessionOptions): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
173
181
  withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
174
182
  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
183
  registry: TRegistry;
@@ -250,11 +258,31 @@ declare function normalizeSchemaSelection(input: GeneratorSchemaSelection | unde
250
258
  */
251
259
  declare function resolveProviderSchemas(providerConfig: GeneratorProviderConfig): string[];
252
260
 
261
+ declare function normalizeTableSelection(value: GeneratorTableSelection | undefined): string[];
262
+ declare function filterIntrospectionSnapshot(snapshot: IntrospectionSnapshot, filter: NormalizedGeneratorFilterConfig): IntrospectionSnapshot;
263
+
253
264
  /**
254
265
  * @deprecated Prefer `createClient(...).auth` from `@xylex-group/athena`.
255
266
  */
256
267
  declare function createAuthClient(config?: AthenaAuthClientConfig): AthenaAuthSdkClient;
257
268
 
269
+ interface AthenaAuthAdminLimits {
270
+ maxAdminJsonBytes: number;
271
+ maxAdminJsonDepth: number;
272
+ maxTemplateVariables: number;
273
+ maxTemplateVariableLength: number;
274
+ }
275
+ declare const ATHENA_AUTH_MAX_ADMIN_JSON_BYTES: number;
276
+ declare const ATHENA_AUTH_MAX_ADMIN_JSON_DEPTH = 8;
277
+ declare const ATHENA_AUTH_MAX_TEMPLATE_VARIABLES = 64;
278
+ declare const ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH = 128;
279
+ declare const ATHENA_AUTH_ADMIN_LIMITS: {
280
+ readonly maxAdminJsonBytes: number;
281
+ readonly maxAdminJsonDepth: 8;
282
+ readonly maxTemplateVariables: 64;
283
+ readonly maxTemplateVariableLength: 128;
284
+ };
285
+
258
286
  type AthenaMaybePromise<T> = T | Promise<T>;
259
287
  type AthenaAuthServerCookieOptions = Pick<AthenaCookiesOptions, 'session' | 'advanced'>;
260
288
  declare const ATHENA_AUTH_BASE_ERROR_CODES: {
@@ -414,4 +442,4 @@ declare function createAuthReactEmailInput<TProps extends AthenaAuthReactEmailPr
414
442
  declare function defineAuthEmailTemplate<TProps extends AthenaAuthReactEmailProps = AthenaAuthReactEmailProps>(definition: AthenaAuthEmailTemplateDefinition<TProps>): AthenaAuthEmailTemplateBuilder<TProps>;
415
443
  declare function renderAthenaReactEmail(input: AthenaAuthReactEmailRenderInput, options?: AthenaAuthReactEmailRuntimeOptions | AthenaAuthReactEmailConfig): Promise<AthenaAuthRenderedReactEmail>;
416
444
 
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 };
445
+ export { defineSchema as $, ATHENA_AUTH_ADMIN_LIMITS as A, type GeneratorEnvJsonOptions as B, type ColumnRuntimeConfig as C, DEFAULT_POSTGRES_SCHEMAS as D, type GeneratorEnvListOptions as E, type FormValuesFromColumns as F, type GeneratorEnvBooleanOptions as G, type GeneratorEnvOneOfOptions as H, type GeneratorEnvStringOptions as I, type InsertFromColumns as J, type TypedClientOptions as K, type TypedClientOptionsWithTypecheckedColumns as L, athenaAuth as M, boolean as N, createAuthClient as O, type PostgresIntrospectionProviderOptions as P, createAuthReactEmailInput as Q, type RowFromColumns as R, createPostgresIntrospectionProvider as S, type TypedAthenaClient as T, type UpdateFromColumns as U, createTypedClient as V, defineAthenaAuthConfig as W, defineAuthEmailTemplate as X, defineDatabase as Y, defineModel as Z, defineRegistry as _, ATHENA_AUTH_BASE_ERROR_CODES as a, enumeration as a0, filterIntrospectionSnapshot as a1, generatorEnv as a2, identifier as a3, json as a4, normalizeAthenaGatewayBaseUrl as a5, normalizeSchemaSelection as a6, normalizeTableSelection as a7, number as a8, renderAthenaReactEmail as a9, resolvePostgresColumnType as aa, resolveProviderSchemas as ab, string as ac, table as ad, ATHENA_AUTH_MAX_ADMIN_JSON_BYTES as b, ATHENA_AUTH_MAX_ADMIN_JSON_DEPTH as c, ATHENA_AUTH_MAX_TEMPLATE_VARIABLES as d, ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH as e, type AnyColumnBuilder as f, type AthenaAuthAdminLimits as g, type AthenaAuthBaseURLConfig as h, type AthenaAuthContext as i, type AthenaAuthCookieRuntimeInput as j, type AthenaAuthDatabaseFactory as k, type AthenaAuthHandlerResult as l, type AthenaAuthPlugin as m, type AthenaAuthPluginContext as n, type AthenaAuthPluginHandlerContext as o, type AthenaAuthRequestContext as p, type AthenaAuthServer as q, type AthenaAuthServerApi as r, type AthenaAuthServerConfig as s, type AthenaAuthServerRuntimeOptions as t, type AthenaAuthSocialProviderConfig as u, type AthenaAuthTrustedOrigins as v, type AthenaAuthTrustedProviders as w, type AthenaColumnBuilder as x, type AthenaTableDef as y, type AthenaTableSchemaBundle as z };
@@ -1,11 +1,10 @@
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';
1
+ import { 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, I as IntrospectionSnapshot } from './types-BeZIHduP.js';
2
+ import { b as ModelFormNullishMode, c as ModelFormValues } from './model-form-ByvyyvxB.js';
3
3
  import { ZodType } from 'zod';
4
- import { l as GeneratorSchemaSelection, b as GeneratorProviderConfig } from './types-BzY6fETM.js';
4
+ import { bi as AthenaSdkClient, ar as AthenaClientContextOptions, ay as AthenaClientSessionLike, az as AthenaClientSessionOptions, dt as TableQueryBuilder, aA as AthenaCreateClientAuthOptions, as as AthenaClientExperimentalOptions, D as AthenaAuthClientConfig, ad as AthenaAuthSdkClient, a5 as AthenaAuthReactEmailProps, a2 as AthenaAuthReactEmailComponent, a7 as AthenaAuthReactEmailRenderInput, I as AthenaAuthEmailTemplateDefinition, G as AthenaAuthEmailTemplateBuilder, a8 as AthenaAuthReactEmailRenderOptions, a6 as AthenaAuthReactEmailRenderEvent, a3 as AthenaAuthReactEmailConfig } from './client-D6EIJdQS.js';
5
+ import { n as GeneratorSchemaSelection, b as GeneratorProviderConfig, q as NormalizedGeneratorFilterConfig, o as GeneratorTableSelection } from './types-CRjDwmtJ.js';
5
6
  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';
6
7
 
7
- declare function verifyAthenaGatewayUrl(baseUrl: string, options?: AthenaGatewayConnectionOptions): Promise<AthenaGatewayConnectionResult>;
8
-
9
8
  interface NormalizeAthenaGatewayBaseUrlOptions {
10
9
  defaultBaseUrl?: string;
11
10
  label?: string;
@@ -26,6 +25,10 @@ interface SqlIdentifier {
26
25
  declare function identifier(...segments: string[]): SqlIdentifier;
27
26
 
28
27
  /**
28
+ * @deprecated Prefer `table(...).schema(...).columns(...).primaryKey(...)` for
29
+ * new model contracts. `defineModel(...)` is retained for legacy compatibility,
30
+ * manual low-level contracts, and legacy generator output.
31
+ *
29
32
  * Declares a model contract with explicit metadata and typed row/insert/update shapes.
30
33
  */
31
34
  declare function defineModel<Row, Insert = Partial<Row>, Update = Partial<Insert>, Meta extends ModelMetadata<Row> = ModelMetadata<Row>>(input: {
@@ -142,6 +145,8 @@ interface AthenaTableColumnsBuilder<TName extends string, TMappedName extends st
142
145
  readonly columns: Readonly<TColumns>;
143
146
  from<TNextMappedName extends string>(tableName: TNextMappedName): AthenaTableColumnsBuilder<TName, TNextMappedName, TSchemaName, TColumns>;
144
147
  schema<TNextSchemaName extends string>(schemaName: TNextSchemaName): AthenaTableColumnsBuilder<TName, TMappedName, TNextSchemaName, TColumns>;
148
+ withoutPrimaryKey(): AthenaTableDef<TColumns, TName, TMappedName, TSchemaName>;
149
+ primaryKey(): AthenaTableDef<TColumns, TName, TMappedName, TSchemaName>;
145
150
  primaryKey<TPrimaryKey extends readonly [
146
151
  Extract<keyof TColumns, string>,
147
152
  ...Array<Extract<keyof TColumns, string>>
@@ -153,7 +158,8 @@ type RegistryConstraint = RegistryDef<Record<string, DatabaseDef<Record<string,
153
158
  /**
154
159
  * Options for creating typed Athena clients.
155
160
  */
156
- interface TypedClientOptions<TMap extends TenantKeyMap = TenantKeyMap> extends Pick<AthenaGatewayCallOptions, 'backend' | 'client' | 'headers'> {
161
+ interface TypedClientOptions<TMap extends TenantKeyMap = TenantKeyMap> extends Pick<AthenaGatewayCallOptions, 'backend' | 'client' | 'headers' | 'forceNoCache' | 'userId' | 'organizationId'> {
162
+ auth?: Omit<AthenaCreateClientAuthOptions, 'url' | 'baseUrl' | 'apiKey'>;
157
163
  tenantKeyMap?: TMap;
158
164
  tenantContext?: TenantContext<TMap>;
159
165
  experimental?: AthenaClientExperimentalOptions;
@@ -170,6 +176,8 @@ interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap ext
170
176
  readonly registry: TRegistry;
171
177
  readonly tenantKeyMap: Readonly<TTenantMap>;
172
178
  readonly tenantContext: TenantContext<TTenantMap>;
179
+ withContext(context?: AthenaClientContextOptions): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
180
+ withSession(session?: AthenaClientSessionLike | null, options?: AthenaClientSessionOptions): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
173
181
  withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
174
182
  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
183
  registry: TRegistry;
@@ -250,11 +258,31 @@ declare function normalizeSchemaSelection(input: GeneratorSchemaSelection | unde
250
258
  */
251
259
  declare function resolveProviderSchemas(providerConfig: GeneratorProviderConfig): string[];
252
260
 
261
+ declare function normalizeTableSelection(value: GeneratorTableSelection | undefined): string[];
262
+ declare function filterIntrospectionSnapshot(snapshot: IntrospectionSnapshot, filter: NormalizedGeneratorFilterConfig): IntrospectionSnapshot;
263
+
253
264
  /**
254
265
  * @deprecated Prefer `createClient(...).auth` from `@xylex-group/athena`.
255
266
  */
256
267
  declare function createAuthClient(config?: AthenaAuthClientConfig): AthenaAuthSdkClient;
257
268
 
269
+ interface AthenaAuthAdminLimits {
270
+ maxAdminJsonBytes: number;
271
+ maxAdminJsonDepth: number;
272
+ maxTemplateVariables: number;
273
+ maxTemplateVariableLength: number;
274
+ }
275
+ declare const ATHENA_AUTH_MAX_ADMIN_JSON_BYTES: number;
276
+ declare const ATHENA_AUTH_MAX_ADMIN_JSON_DEPTH = 8;
277
+ declare const ATHENA_AUTH_MAX_TEMPLATE_VARIABLES = 64;
278
+ declare const ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH = 128;
279
+ declare const ATHENA_AUTH_ADMIN_LIMITS: {
280
+ readonly maxAdminJsonBytes: number;
281
+ readonly maxAdminJsonDepth: 8;
282
+ readonly maxTemplateVariables: 64;
283
+ readonly maxTemplateVariableLength: 128;
284
+ };
285
+
258
286
  type AthenaMaybePromise<T> = T | Promise<T>;
259
287
  type AthenaAuthServerCookieOptions = Pick<AthenaCookiesOptions, 'session' | 'advanced'>;
260
288
  declare const ATHENA_AUTH_BASE_ERROR_CODES: {
@@ -414,4 +442,4 @@ declare function createAuthReactEmailInput<TProps extends AthenaAuthReactEmailPr
414
442
  declare function defineAuthEmailTemplate<TProps extends AthenaAuthReactEmailProps = AthenaAuthReactEmailProps>(definition: AthenaAuthEmailTemplateDefinition<TProps>): AthenaAuthEmailTemplateBuilder<TProps>;
415
443
  declare function renderAthenaReactEmail(input: AthenaAuthReactEmailRenderInput, options?: AthenaAuthReactEmailRuntimeOptions | AthenaAuthReactEmailConfig): Promise<AthenaAuthRenderedReactEmail>;
416
444
 
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 };
445
+ export { defineSchema as $, ATHENA_AUTH_ADMIN_LIMITS as A, type GeneratorEnvJsonOptions as B, type ColumnRuntimeConfig as C, DEFAULT_POSTGRES_SCHEMAS as D, type GeneratorEnvListOptions as E, type FormValuesFromColumns as F, type GeneratorEnvBooleanOptions as G, type GeneratorEnvOneOfOptions as H, type GeneratorEnvStringOptions as I, type InsertFromColumns as J, type TypedClientOptions as K, type TypedClientOptionsWithTypecheckedColumns as L, athenaAuth as M, boolean as N, createAuthClient as O, type PostgresIntrospectionProviderOptions as P, createAuthReactEmailInput as Q, type RowFromColumns as R, createPostgresIntrospectionProvider as S, type TypedAthenaClient as T, type UpdateFromColumns as U, createTypedClient as V, defineAthenaAuthConfig as W, defineAuthEmailTemplate as X, defineDatabase as Y, defineModel as Z, defineRegistry as _, ATHENA_AUTH_BASE_ERROR_CODES as a, enumeration as a0, filterIntrospectionSnapshot as a1, generatorEnv as a2, identifier as a3, json as a4, normalizeAthenaGatewayBaseUrl as a5, normalizeSchemaSelection as a6, normalizeTableSelection as a7, number as a8, renderAthenaReactEmail as a9, resolvePostgresColumnType as aa, resolveProviderSchemas as ab, string as ac, table as ad, ATHENA_AUTH_MAX_ADMIN_JSON_BYTES as b, ATHENA_AUTH_MAX_ADMIN_JSON_DEPTH as c, ATHENA_AUTH_MAX_TEMPLATE_VARIABLES as d, ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH as e, type AnyColumnBuilder as f, type AthenaAuthAdminLimits as g, type AthenaAuthBaseURLConfig as h, type AthenaAuthContext as i, type AthenaAuthCookieRuntimeInput as j, type AthenaAuthDatabaseFactory as k, type AthenaAuthHandlerResult as l, type AthenaAuthPlugin as m, type AthenaAuthPluginContext as n, type AthenaAuthPluginHandlerContext as o, type AthenaAuthRequestContext as p, type AthenaAuthServer as q, type AthenaAuthServerApi as r, type AthenaAuthServerConfig as s, type AthenaAuthServerRuntimeOptions as t, type AthenaAuthSocialProviderConfig as u, type AthenaAuthTrustedOrigins as v, type AthenaAuthTrustedProviders as w, type AthenaColumnBuilder as x, type AthenaTableDef as y, type AthenaTableSchemaBundle as z };
package/dist/react.cjs CHANGED
@@ -187,7 +187,7 @@ var getSessionCookie = (request, config) => {
187
187
 
188
188
  // package.json
189
189
  var package_default = {
190
- version: "2.8.0"
190
+ version: "2.9.0"
191
191
  };
192
192
 
193
193
  // src/sdk-version.ts
@@ -200,6 +200,7 @@ function buildSdkHeaderValue(sdkName) {
200
200
  var DEFAULT_CLIENT = "railway_direct";
201
201
  var SDK_NAME = "xylex-group/athena";
202
202
  var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
203
+ var NO_CACHE_HEADER_VALUE = "no-cache";
203
204
  function parseResponseBody(rawText, contentType) {
204
205
  if (!rawText) {
205
206
  return { parsed: null, parseFailed: false };
@@ -218,6 +219,9 @@ function parseResponseBody(rawText, contentType) {
218
219
  function normalizeHeaderValue(value) {
219
220
  return value ? value : void 0;
220
221
  }
222
+ function isCacheControlHeaderName(name) {
223
+ return name.toLowerCase() === "cache-control";
224
+ }
221
225
  function resolveHeaderValue(headers, candidates) {
222
226
  for (const candidate of candidates) {
223
227
  const direct = normalizeHeaderValue(headers[candidate]);
@@ -376,6 +380,7 @@ function buildRpcGetEndpoint(payload) {
376
380
  }
377
381
  function buildHeaders(config, options) {
378
382
  const mergedStripNulls = options?.stripNulls ?? true;
383
+ const forceNoCache = Boolean(config.forceNoCache || options?.forceNoCache);
379
384
  const extraHeaders = {
380
385
  ...config.headers ?? {},
381
386
  ...options?.headers ?? {}
@@ -429,11 +434,15 @@ function buildHeaders(config, options) {
429
434
  const athenaClientKeys = ["x-athena-client", "X-Athena-Client"];
430
435
  Object.entries(extraHeaders).forEach(([key, value]) => {
431
436
  if (athenaClientKeys.includes(key)) return;
437
+ if (forceNoCache && isCacheControlHeaderName(key)) return;
432
438
  const normalized = normalizeHeaderValue(value);
433
439
  if (normalized) {
434
440
  headers[key] = normalized;
435
441
  }
436
442
  });
443
+ if (forceNoCache) {
444
+ headers["Cache-Control"] = NO_CACHE_HEADER_VALUE;
445
+ }
437
446
  return headers;
438
447
  }
439
448
  function toInvalidUrlResponse(error, endpoint, method) {
@@ -1950,6 +1959,25 @@ function useSession(authClient, options = {}) {
1950
1959
  refetch
1951
1960
  };
1952
1961
  }
1962
+ function useAthenaSessionClient(baseClient, options = {}) {
1963
+ const sessionState = useSession(baseClient, options);
1964
+ const scopedClient = React.useMemo(
1965
+ () => sessionState.data ? baseClient.withSession(sessionState.data) : baseClient,
1966
+ [baseClient, sessionState.data]
1967
+ );
1968
+ const session = sessionState.data;
1969
+ const refetch = sessionState.refetch;
1970
+ return {
1971
+ client: scopedClient,
1972
+ session,
1973
+ userId: sessionState.data?.user.id ?? null,
1974
+ organizationId: sessionState.data?.session.activeOrganizationId ?? null,
1975
+ error: sessionState.error,
1976
+ isPending: sessionState.isPending,
1977
+ isRefetching: sessionState.isRefetching,
1978
+ refetch
1979
+ };
1980
+ }
1953
1981
  function useStorageUpload(options) {
1954
1982
  const {
1955
1983
  storage,
@@ -2102,6 +2130,7 @@ exports.toModelFormDefaults = toModelFormDefaults;
2102
2130
  exports.toModelPayload = toModelPayload;
2103
2131
  exports.useAthenaGateway = useAthenaGateway;
2104
2132
  exports.useAthenaQueryClient = useAthenaQueryClient;
2133
+ exports.useAthenaSessionClient = useAthenaSessionClient;
2105
2134
  exports.useMutation = useMutation;
2106
2135
  exports.useQuery = useQuery;
2107
2136
  exports.useSession = useSession;