@xylex-group/athena 2.8.2 → 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.
- package/README.md +154 -64
- package/dist/browser.cjs +636 -21
- 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 +630 -22
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +591 -29
- 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 +591 -29
- package/dist/cli/index.js.map +1 -1
- package/dist/{model-form-Cx3wtvi8.d.ts → client-CfAE_QOj.d.cts} +101 -97
- package/dist/{model-form-_ugfOXao.d.cts → client-D6EIJdQS.d.ts} +101 -97
- package/dist/index.cjs +714 -41
- 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 +708 -42
- package/dist/index.js.map +1 -1
- package/dist/model-form-ByvyyvxB.d.ts +96 -0
- package/dist/model-form-DACdBLYG.d.cts +96 -0
- package/dist/next/client.cjs +7875 -0
- package/dist/next/client.cjs.map +1 -0
- package/dist/next/client.d.cts +25 -0
- package/dist/next/client.d.ts +25 -0
- package/dist/next/client.js +7873 -0
- package/dist/next/client.js.map +1 -0
- package/dist/next/server.cjs +7993 -0
- package/dist/next/server.cjs.map +1 -0
- package/dist/next/server.d.cts +52 -0
- package/dist/next/server.d.ts +52 -0
- package/dist/next/server.js +7990 -0
- package/dist/next/server.js.map +1 -0
- package/dist/{pipeline-BtD-Uo5X.d.cts → pipeline-CmUZsXsi.d.cts} +1 -1
- package/dist/{pipeline-yCIZNJHE.d.ts → pipeline-DZMsPxUg.d.ts} +1 -1
- package/dist/{react-email-CiiSVa9F.d.cts → react-email-BvJ3fj_F.d.cts} +35 -5
- package/dist/{react-email-WN8UU3AL.d.ts → react-email-PLAJuZuO.d.ts} +35 -5
- package/dist/react.cjs +30 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +39 -10
- package/dist/react.d.ts +39 -10
- package/dist/react.js +30 -2
- package/dist/react.js.map +1 -1
- package/dist/shared-BW6hoLBY.d.cts +33 -0
- package/dist/shared-BiJvoURI.d.ts +33 -0
- package/dist/{types-g8G6J0xE.d.cts → types-BeZIHduP.d.cts} +2 -1
- package/dist/{types-g8G6J0xE.d.ts → types-BeZIHduP.d.ts} +2 -1
- package/dist/{types-C2kiTt6-.d.ts → types-C-YvfgYh.d.cts} +26 -2
- package/dist/{types-89EfjLjV.d.cts → types-CRjDwmtJ.d.ts} +26 -2
- package/package.json +32 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RunGeneratorOptions,
|
|
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,
|
|
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,7 +1,8 @@
|
|
|
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 } from './types-
|
|
2
|
-
import {
|
|
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 {
|
|
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
8
|
interface NormalizeAthenaGatewayBaseUrlOptions {
|
|
@@ -24,6 +25,10 @@ interface SqlIdentifier {
|
|
|
24
25
|
declare function identifier(...segments: string[]): SqlIdentifier;
|
|
25
26
|
|
|
26
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
|
+
*
|
|
27
32
|
* Declares a model contract with explicit metadata and typed row/insert/update shapes.
|
|
28
33
|
*/
|
|
29
34
|
declare function defineModel<Row, Insert = Partial<Row>, Update = Partial<Insert>, Meta extends ModelMetadata<Row> = ModelMetadata<Row>>(input: {
|
|
@@ -140,6 +145,8 @@ interface AthenaTableColumnsBuilder<TName extends string, TMappedName extends st
|
|
|
140
145
|
readonly columns: Readonly<TColumns>;
|
|
141
146
|
from<TNextMappedName extends string>(tableName: TNextMappedName): AthenaTableColumnsBuilder<TName, TNextMappedName, TSchemaName, TColumns>;
|
|
142
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>;
|
|
143
150
|
primaryKey<TPrimaryKey extends readonly [
|
|
144
151
|
Extract<keyof TColumns, string>,
|
|
145
152
|
...Array<Extract<keyof TColumns, string>>
|
|
@@ -151,7 +158,8 @@ type RegistryConstraint = RegistryDef<Record<string, DatabaseDef<Record<string,
|
|
|
151
158
|
/**
|
|
152
159
|
* Options for creating typed Athena clients.
|
|
153
160
|
*/
|
|
154
|
-
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'>;
|
|
155
163
|
tenantKeyMap?: TMap;
|
|
156
164
|
tenantContext?: TenantContext<TMap>;
|
|
157
165
|
experimental?: AthenaClientExperimentalOptions;
|
|
@@ -168,6 +176,8 @@ interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap ext
|
|
|
168
176
|
readonly registry: TRegistry;
|
|
169
177
|
readonly tenantKeyMap: Readonly<TTenantMap>;
|
|
170
178
|
readonly tenantContext: TenantContext<TTenantMap>;
|
|
179
|
+
withContext(context?: AthenaClientContextOptions): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
|
|
180
|
+
withSession(session?: AthenaClientSessionLike | null, options?: AthenaClientSessionOptions): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
|
|
171
181
|
withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
|
|
172
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>>, {
|
|
173
183
|
registry: TRegistry;
|
|
@@ -248,11 +258,31 @@ declare function normalizeSchemaSelection(input: GeneratorSchemaSelection | unde
|
|
|
248
258
|
*/
|
|
249
259
|
declare function resolveProviderSchemas(providerConfig: GeneratorProviderConfig): string[];
|
|
250
260
|
|
|
261
|
+
declare function normalizeTableSelection(value: GeneratorTableSelection | undefined): string[];
|
|
262
|
+
declare function filterIntrospectionSnapshot(snapshot: IntrospectionSnapshot, filter: NormalizedGeneratorFilterConfig): IntrospectionSnapshot;
|
|
263
|
+
|
|
251
264
|
/**
|
|
252
265
|
* @deprecated Prefer `createClient(...).auth` from `@xylex-group/athena`.
|
|
253
266
|
*/
|
|
254
267
|
declare function createAuthClient(config?: AthenaAuthClientConfig): AthenaAuthSdkClient;
|
|
255
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
|
+
|
|
256
286
|
type AthenaMaybePromise<T> = T | Promise<T>;
|
|
257
287
|
type AthenaAuthServerCookieOptions = Pick<AthenaCookiesOptions, 'session' | 'advanced'>;
|
|
258
288
|
declare const ATHENA_AUTH_BASE_ERROR_CODES: {
|
|
@@ -412,4 +442,4 @@ declare function createAuthReactEmailInput<TProps extends AthenaAuthReactEmailPr
|
|
|
412
442
|
declare function defineAuthEmailTemplate<TProps extends AthenaAuthReactEmailProps = AthenaAuthReactEmailProps>(definition: AthenaAuthEmailTemplateDefinition<TProps>): AthenaAuthEmailTemplateBuilder<TProps>;
|
|
413
443
|
declare function renderAthenaReactEmail(input: AthenaAuthReactEmailRenderInput, options?: AthenaAuthReactEmailRuntimeOptions | AthenaAuthReactEmailConfig): Promise<AthenaAuthRenderedReactEmail>;
|
|
414
444
|
|
|
415
|
-
export {
|
|
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,7 +1,8 @@
|
|
|
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 } from './types-
|
|
2
|
-
import {
|
|
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 {
|
|
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
8
|
interface NormalizeAthenaGatewayBaseUrlOptions {
|
|
@@ -24,6 +25,10 @@ interface SqlIdentifier {
|
|
|
24
25
|
declare function identifier(...segments: string[]): SqlIdentifier;
|
|
25
26
|
|
|
26
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
|
+
*
|
|
27
32
|
* Declares a model contract with explicit metadata and typed row/insert/update shapes.
|
|
28
33
|
*/
|
|
29
34
|
declare function defineModel<Row, Insert = Partial<Row>, Update = Partial<Insert>, Meta extends ModelMetadata<Row> = ModelMetadata<Row>>(input: {
|
|
@@ -140,6 +145,8 @@ interface AthenaTableColumnsBuilder<TName extends string, TMappedName extends st
|
|
|
140
145
|
readonly columns: Readonly<TColumns>;
|
|
141
146
|
from<TNextMappedName extends string>(tableName: TNextMappedName): AthenaTableColumnsBuilder<TName, TNextMappedName, TSchemaName, TColumns>;
|
|
142
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>;
|
|
143
150
|
primaryKey<TPrimaryKey extends readonly [
|
|
144
151
|
Extract<keyof TColumns, string>,
|
|
145
152
|
...Array<Extract<keyof TColumns, string>>
|
|
@@ -151,7 +158,8 @@ type RegistryConstraint = RegistryDef<Record<string, DatabaseDef<Record<string,
|
|
|
151
158
|
/**
|
|
152
159
|
* Options for creating typed Athena clients.
|
|
153
160
|
*/
|
|
154
|
-
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'>;
|
|
155
163
|
tenantKeyMap?: TMap;
|
|
156
164
|
tenantContext?: TenantContext<TMap>;
|
|
157
165
|
experimental?: AthenaClientExperimentalOptions;
|
|
@@ -168,6 +176,8 @@ interface TypedAthenaClient<TRegistry extends RegistryConstraint, TTenantMap ext
|
|
|
168
176
|
readonly registry: TRegistry;
|
|
169
177
|
readonly tenantKeyMap: Readonly<TTenantMap>;
|
|
170
178
|
readonly tenantContext: TenantContext<TTenantMap>;
|
|
179
|
+
withContext(context?: AthenaClientContextOptions): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
|
|
180
|
+
withSession(session?: AthenaClientSessionLike | null, options?: AthenaClientSessionOptions): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
|
|
171
181
|
withTenantContext(context: TenantContext<TTenantMap>): TypedAthenaClient<TRegistry, TTenantMap, TStrict>;
|
|
172
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>>, {
|
|
173
183
|
registry: TRegistry;
|
|
@@ -248,11 +258,31 @@ declare function normalizeSchemaSelection(input: GeneratorSchemaSelection | unde
|
|
|
248
258
|
*/
|
|
249
259
|
declare function resolveProviderSchemas(providerConfig: GeneratorProviderConfig): string[];
|
|
250
260
|
|
|
261
|
+
declare function normalizeTableSelection(value: GeneratorTableSelection | undefined): string[];
|
|
262
|
+
declare function filterIntrospectionSnapshot(snapshot: IntrospectionSnapshot, filter: NormalizedGeneratorFilterConfig): IntrospectionSnapshot;
|
|
263
|
+
|
|
251
264
|
/**
|
|
252
265
|
* @deprecated Prefer `createClient(...).auth` from `@xylex-group/athena`.
|
|
253
266
|
*/
|
|
254
267
|
declare function createAuthClient(config?: AthenaAuthClientConfig): AthenaAuthSdkClient;
|
|
255
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
|
+
|
|
256
286
|
type AthenaMaybePromise<T> = T | Promise<T>;
|
|
257
287
|
type AthenaAuthServerCookieOptions = Pick<AthenaCookiesOptions, 'session' | 'advanced'>;
|
|
258
288
|
declare const ATHENA_AUTH_BASE_ERROR_CODES: {
|
|
@@ -412,4 +442,4 @@ declare function createAuthReactEmailInput<TProps extends AthenaAuthReactEmailPr
|
|
|
412
442
|
declare function defineAuthEmailTemplate<TProps extends AthenaAuthReactEmailProps = AthenaAuthReactEmailProps>(definition: AthenaAuthEmailTemplateDefinition<TProps>): AthenaAuthEmailTemplateBuilder<TProps>;
|
|
413
443
|
declare function renderAthenaReactEmail(input: AthenaAuthReactEmailRenderInput, options?: AthenaAuthReactEmailRuntimeOptions | AthenaAuthReactEmailConfig): Promise<AthenaAuthRenderedReactEmail>;
|
|
414
444
|
|
|
415
|
-
export {
|
|
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.
|
|
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;
|