@xylex-group/athena 2.4.0 → 2.4.1
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 +73 -2
- package/dist/browser.cjs +331 -100
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +331 -100
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +377 -92
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +377 -92
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +331 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +331 -100
- package/dist/index.js.map +1 -1
- package/dist/{model-form-GzTqhEzM.d.cts → model-form-4LPnOPAF.d.cts} +8 -4
- package/dist/{model-form-C0FAbOaf.d.ts → model-form-CO4-LmNC.d.ts} +8 -4
- package/dist/{react-email-CQJq92zQ.d.cts → react-email-6mOyxBo4.d.cts} +42 -8
- package/dist/{react-email-BuApZuyG.d.ts → react-email-Buhcpglm.d.ts} +42 -8
- package/dist/react.cjs +84 -4
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +84 -4
- package/dist/react.js.map +1 -1
- package/dist/utils.cjs +131 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +42 -1
- package/dist/utils.d.ts +42 -1
- package/dist/utils.js +117 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -399,17 +399,21 @@ interface AthenaAdminBanUserRequest extends AthenaAdminTargetUserRequest {
|
|
|
399
399
|
banReason?: string;
|
|
400
400
|
banExpiresIn?: string;
|
|
401
401
|
}
|
|
402
|
+
type AthenaAuthSearchOperator = 'contains' | 'starts_with' | 'ends_with';
|
|
403
|
+
type AthenaAuthFilterOperator = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not_in' | 'contains' | 'starts_with' | 'ends_with';
|
|
404
|
+
type AthenaAdminListUsersSearchOperator = AthenaAuthSearchOperator;
|
|
405
|
+
type AthenaAdminListUsersFilterOperator = AthenaAuthFilterOperator;
|
|
402
406
|
interface AthenaAdminListUsersQuery {
|
|
403
407
|
searchValue?: string;
|
|
404
408
|
searchField?: string;
|
|
405
|
-
searchOperator?:
|
|
409
|
+
searchOperator?: AthenaAdminListUsersSearchOperator;
|
|
406
410
|
limit?: number | string;
|
|
407
411
|
offset?: number | string;
|
|
408
412
|
sortBy?: string;
|
|
409
413
|
sortDirection?: string;
|
|
410
414
|
filterField?: string;
|
|
411
415
|
filterValue?: string;
|
|
412
|
-
filterOperator?:
|
|
416
|
+
filterOperator?: AthenaAdminListUsersFilterOperator;
|
|
413
417
|
}
|
|
414
418
|
interface AthenaAdminListUsersResponse {
|
|
415
419
|
users: AthenaAuthUser[];
|
|
@@ -820,7 +824,7 @@ interface AthenaAuthOrganizationListInvitationsQuery {
|
|
|
820
824
|
interface AthenaAuthOrganizationListUserInvitationsQuery {
|
|
821
825
|
email?: string;
|
|
822
826
|
}
|
|
823
|
-
type AthenaAuthOrganizationListMembersFilterOperator =
|
|
827
|
+
type AthenaAuthOrganizationListMembersFilterOperator = AthenaAuthFilterOperator;
|
|
824
828
|
interface AthenaAuthOrganizationListMembersQuery {
|
|
825
829
|
organizationId?: string;
|
|
826
830
|
limit?: number;
|
|
@@ -1376,4 +1380,4 @@ interface ModelFormAdapter<TModel extends AnyModelDef> {
|
|
|
1376
1380
|
*/
|
|
1377
1381
|
declare function createModelFormAdapter<TModel extends AnyModelDef>(model: TModel): ModelFormAdapter<TModel>;
|
|
1378
1382
|
|
|
1379
|
-
export { type
|
|
1383
|
+
export { type AthenaDeleteUserResponse as $, type AthenaAdminListUsersFilterOperator as A, type AthenaAuthQueryValue as B, type AthenaAuthReactEmailComponent as C, type AthenaAuthReactEmailConfig as D, type AthenaAuthReactEmailEventPhase as E, type AthenaAuthReactEmailProps as F, type AthenaAuthReactEmailRenderEvent as G, type AthenaAuthReactEmailRenderInput as H, type AthenaAuthReactEmailRenderOptions as I, type AthenaAuthRequestInput as J, type AthenaAuthResetPasswordBinding as K, type AthenaAuthResult as L, type AthenaAuthRevokeSessionRequest as M, type AthenaAuthSdkClient as N, type AthenaAuthSearchOperator as O, type AthenaAuthSession as P, type AthenaAuthSessionResponse as Q, type AthenaAuthSessionRevokeBinding as R, type AthenaAuthSignInResponse as S, type AthenaAuthSignOutResponse as T, type AthenaAuthSocialRedirectResponse as U, type AthenaAuthStatusResponse as V, type AthenaAuthUser as W, type AthenaChangeEmailRequest as X, type AthenaChangePasswordRequest as Y, type AthenaDeleteUserCallbackRequest as Z, type AthenaDeleteUserRequest as _, type AthenaAdminListUsersQuery as a, type AthenaEmailSignInRequest as a0, type AthenaEmailSignUpRequest as a1, type AthenaForgetPasswordRequest as a2, AthenaGatewayError as a3, type AthenaLinkSocialRequest as a4, type AthenaOAuthAccountTokenRequest as a5, type AthenaOAuthTokenBundle as a6, type AthenaResetPasswordRequest as a7, type AthenaSendVerificationEmailRequest as a8, type AthenaSocialSignInRequest as a9, type AthenaUnlinkAccountRequest as aa, type AthenaUpdateUserRequest as ab, type AthenaUsernameSignInRequest as ac, type AthenaVerifyEmailRequest as ad, type ModelFormAdapter as ae, type ModelFormDefaults as af, type ModelFormNullishMode as ag, type ModelFormValues as ah, type ToModelFormDefaultsOptions as ai, type ToModelPayloadOptions as aj, createModelFormAdapter as ak, isAthenaGatewayError as al, toModelFormDefaults as am, toModelPayload as an, type AthenaAuthFetchCompatibleInput as ao, type AthenaAdminListUsersSearchOperator as b, type AthenaAuthAdminUserSessionRevokeBinding as c, type AthenaAuthBindings as d, type AthenaAuthCallOptions as e, type AthenaAuthClientConfig as f, type AthenaAuthCredentials as g, type AthenaAuthEmailChangeResponse as h, type AthenaAuthEmailTemplateBuilder as i, type AthenaAuthEmailTemplateCreateFromDefinitionInput as j, type AthenaAuthEmailTemplateDefinition as k, type AthenaAuthEmailTemplateReactOverrides as l, type AthenaAuthEmailTemplateUpdateFromDefinitionInput as m, type AthenaAuthEndpointPath as n, type AthenaAuthErrorCode as o, type AthenaAuthErrorDetails as p, type AthenaAuthFilterOperator as q, type AthenaAuthGenericInput as r, type AthenaAuthGenericQueryInput as s, type AthenaAuthLinkedAccount as t, type AthenaAuthMethod as u, type AthenaAuthOrganization as v, type AthenaAuthOrganizationBindings as w, type AthenaAuthOrganizationInvitation as x, type AthenaAuthOrganizationMember as y, type AthenaAuthQueryPrimitive as z };
|
|
@@ -399,17 +399,21 @@ interface AthenaAdminBanUserRequest extends AthenaAdminTargetUserRequest {
|
|
|
399
399
|
banReason?: string;
|
|
400
400
|
banExpiresIn?: string;
|
|
401
401
|
}
|
|
402
|
+
type AthenaAuthSearchOperator = 'contains' | 'starts_with' | 'ends_with';
|
|
403
|
+
type AthenaAuthFilterOperator = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not_in' | 'contains' | 'starts_with' | 'ends_with';
|
|
404
|
+
type AthenaAdminListUsersSearchOperator = AthenaAuthSearchOperator;
|
|
405
|
+
type AthenaAdminListUsersFilterOperator = AthenaAuthFilterOperator;
|
|
402
406
|
interface AthenaAdminListUsersQuery {
|
|
403
407
|
searchValue?: string;
|
|
404
408
|
searchField?: string;
|
|
405
|
-
searchOperator?:
|
|
409
|
+
searchOperator?: AthenaAdminListUsersSearchOperator;
|
|
406
410
|
limit?: number | string;
|
|
407
411
|
offset?: number | string;
|
|
408
412
|
sortBy?: string;
|
|
409
413
|
sortDirection?: string;
|
|
410
414
|
filterField?: string;
|
|
411
415
|
filterValue?: string;
|
|
412
|
-
filterOperator?:
|
|
416
|
+
filterOperator?: AthenaAdminListUsersFilterOperator;
|
|
413
417
|
}
|
|
414
418
|
interface AthenaAdminListUsersResponse {
|
|
415
419
|
users: AthenaAuthUser[];
|
|
@@ -820,7 +824,7 @@ interface AthenaAuthOrganizationListInvitationsQuery {
|
|
|
820
824
|
interface AthenaAuthOrganizationListUserInvitationsQuery {
|
|
821
825
|
email?: string;
|
|
822
826
|
}
|
|
823
|
-
type AthenaAuthOrganizationListMembersFilterOperator =
|
|
827
|
+
type AthenaAuthOrganizationListMembersFilterOperator = AthenaAuthFilterOperator;
|
|
824
828
|
interface AthenaAuthOrganizationListMembersQuery {
|
|
825
829
|
organizationId?: string;
|
|
826
830
|
limit?: number;
|
|
@@ -1376,4 +1380,4 @@ interface ModelFormAdapter<TModel extends AnyModelDef> {
|
|
|
1376
1380
|
*/
|
|
1377
1381
|
declare function createModelFormAdapter<TModel extends AnyModelDef>(model: TModel): ModelFormAdapter<TModel>;
|
|
1378
1382
|
|
|
1379
|
-
export { type
|
|
1383
|
+
export { type AthenaDeleteUserResponse as $, type AthenaAdminListUsersFilterOperator as A, type AthenaAuthQueryValue as B, type AthenaAuthReactEmailComponent as C, type AthenaAuthReactEmailConfig as D, type AthenaAuthReactEmailEventPhase as E, type AthenaAuthReactEmailProps as F, type AthenaAuthReactEmailRenderEvent as G, type AthenaAuthReactEmailRenderInput as H, type AthenaAuthReactEmailRenderOptions as I, type AthenaAuthRequestInput as J, type AthenaAuthResetPasswordBinding as K, type AthenaAuthResult as L, type AthenaAuthRevokeSessionRequest as M, type AthenaAuthSdkClient as N, type AthenaAuthSearchOperator as O, type AthenaAuthSession as P, type AthenaAuthSessionResponse as Q, type AthenaAuthSessionRevokeBinding as R, type AthenaAuthSignInResponse as S, type AthenaAuthSignOutResponse as T, type AthenaAuthSocialRedirectResponse as U, type AthenaAuthStatusResponse as V, type AthenaAuthUser as W, type AthenaChangeEmailRequest as X, type AthenaChangePasswordRequest as Y, type AthenaDeleteUserCallbackRequest as Z, type AthenaDeleteUserRequest as _, type AthenaAdminListUsersQuery as a, type AthenaEmailSignInRequest as a0, type AthenaEmailSignUpRequest as a1, type AthenaForgetPasswordRequest as a2, AthenaGatewayError as a3, type AthenaLinkSocialRequest as a4, type AthenaOAuthAccountTokenRequest as a5, type AthenaOAuthTokenBundle as a6, type AthenaResetPasswordRequest as a7, type AthenaSendVerificationEmailRequest as a8, type AthenaSocialSignInRequest as a9, type AthenaUnlinkAccountRequest as aa, type AthenaUpdateUserRequest as ab, type AthenaUsernameSignInRequest as ac, type AthenaVerifyEmailRequest as ad, type ModelFormAdapter as ae, type ModelFormDefaults as af, type ModelFormNullishMode as ag, type ModelFormValues as ah, type ToModelFormDefaultsOptions as ai, type ToModelPayloadOptions as aj, createModelFormAdapter as ak, isAthenaGatewayError as al, toModelFormDefaults as am, toModelPayload as an, type AthenaAuthFetchCompatibleInput as ao, type AthenaAdminListUsersSearchOperator as b, type AthenaAuthAdminUserSessionRevokeBinding as c, type AthenaAuthBindings as d, type AthenaAuthCallOptions as e, type AthenaAuthClientConfig as f, type AthenaAuthCredentials as g, type AthenaAuthEmailChangeResponse as h, type AthenaAuthEmailTemplateBuilder as i, type AthenaAuthEmailTemplateCreateFromDefinitionInput as j, type AthenaAuthEmailTemplateDefinition as k, type AthenaAuthEmailTemplateReactOverrides as l, type AthenaAuthEmailTemplateUpdateFromDefinitionInput as m, type AthenaAuthEndpointPath as n, type AthenaAuthErrorCode as o, type AthenaAuthErrorDetails as p, type AthenaAuthFilterOperator as q, type AthenaAuthGenericInput as r, type AthenaAuthGenericQueryInput as s, type AthenaAuthLinkedAccount as t, type AthenaAuthMethod as u, type AthenaAuthOrganization as v, type AthenaAuthOrganizationBindings as w, type AthenaAuthOrganizationInvitation as x, type AthenaAuthOrganizationMember as y, type AthenaAuthQueryPrimitive as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as AthenaJsonValue, a as AthenaGatewayCallOptions, g as AthenaJsonObject, j as AthenaRpcCallOptions, J as AthenaConditionValue, K as AthenaConditionArrayValue, R as RegistryDef, D as DatabaseDef, F as SchemaDef, L as AnyModelDef, x as ModelDef, C as ModelRelationMetadata, E as RowOf, o as BackendConfig, p as BackendType, e as AthenaGatewayErrorDetails, A as AthenaConditionCastType, N as AthenaConditionOperator, b as AthenaGatewayConnectionOptions, c as AthenaGatewayConnectionResult, y as ModelMetadata, H as TenantKeyMap, T as TenantContext, M as ModelAt, q as InsertOf, U as UpdateOf, S as SchemaIntrospectionProvider, r as IntrospectionColumn } from './types-09Q4D86N.cjs';
|
|
2
|
-
import {
|
|
2
|
+
import { f as AthenaAuthClientConfig, d as AthenaAuthBindings, 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-4LPnOPAF.cjs';
|
|
3
3
|
import { j as GeneratorSchemaSelection, b as GeneratorProviderConfig } from './types-D1JvL21V.cjs';
|
|
4
4
|
|
|
5
5
|
type AthenaErrorKind = 'unique_violation' | 'not_found' | 'validation' | 'auth' | 'rate_limit' | 'transient' | 'unknown';
|
|
@@ -200,6 +200,7 @@ interface AthenaDbModule {
|
|
|
200
200
|
type AthenaRowShape$1 = Record<string, AthenaJsonValue | undefined>;
|
|
201
201
|
type FilterColumnKey$1<Row> = Extract<keyof NonNullable<Row>, string>;
|
|
202
202
|
type ResolvedFilterColumnKey$1<Row> = [FilterColumnKey$1<Row>] extends [never] ? string : FilterColumnKey$1<Row>;
|
|
203
|
+
type AthenaFilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'contains' | 'containedBy';
|
|
203
204
|
type AthenaWherePrimitive = AthenaConditionValue;
|
|
204
205
|
type AthenaWhereOperatorInput = {
|
|
205
206
|
eq?: AthenaConditionValue;
|
|
@@ -215,10 +216,25 @@ type AthenaWhereOperatorInput = {
|
|
|
215
216
|
contains?: AthenaConditionArrayValue;
|
|
216
217
|
containedBy?: AthenaConditionArrayValue;
|
|
217
218
|
};
|
|
218
|
-
type
|
|
219
|
-
type
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
type AthenaWhereColumnInput<Row = AthenaRowShape$1> = Partial<Record<ResolvedFilterColumnKey$1<Row>, AthenaWherePrimitive | AthenaWhereOperatorInput>>;
|
|
220
|
+
type AthenaBooleanSafeOperator = Exclude<AthenaFilterOperator, 'in' | 'contains' | 'containedBy'>;
|
|
221
|
+
type AthenaWhereBooleanSafeOperatorInput = Partial<Record<AthenaBooleanSafeOperator, AthenaConditionValue>>;
|
|
222
|
+
type AthenaWhereBooleanNotOperatorInput = {
|
|
223
|
+
[K in AthenaBooleanSafeOperator]: {
|
|
224
|
+
[P in K]: AthenaConditionValue;
|
|
225
|
+
} & Partial<Record<Exclude<AthenaBooleanSafeOperator, K>, never>>;
|
|
226
|
+
}[AthenaBooleanSafeOperator];
|
|
227
|
+
type AthenaStrictBooleanOperand<Keys extends string, Value> = {
|
|
228
|
+
[K in Keys]: {
|
|
229
|
+
[P in K]: Value;
|
|
230
|
+
} & Partial<Record<Exclude<Keys, K>, never>>;
|
|
231
|
+
}[Keys];
|
|
232
|
+
type AthenaNonEmptyArray<T> = [T, ...T[]];
|
|
233
|
+
type AthenaWhereBooleanOperand<Row = AthenaRowShape$1> = string extends ResolvedFilterColumnKey$1<Row> ? AthenaWhereColumnInput<Row> : AthenaStrictBooleanOperand<ResolvedFilterColumnKey$1<Row>, AthenaWherePrimitive | AthenaWhereBooleanSafeOperatorInput>;
|
|
234
|
+
type AthenaWhereNotOperand<Row = AthenaRowShape$1> = string extends ResolvedFilterColumnKey$1<Row> ? AthenaWhereColumnInput<Row> : AthenaStrictBooleanOperand<ResolvedFilterColumnKey$1<Row>, AthenaWherePrimitive | AthenaWhereBooleanNotOperatorInput>;
|
|
235
|
+
type AthenaWhere<Row = AthenaRowShape$1> = AthenaWhereColumnInput<Row> & {
|
|
236
|
+
or?: string extends ResolvedFilterColumnKey$1<Row> ? Array<AthenaWhereColumnInput<Row>> : AthenaNonEmptyArray<AthenaWhereBooleanOperand<Row>>;
|
|
237
|
+
not?: AthenaWhereNotOperand<Row>;
|
|
222
238
|
};
|
|
223
239
|
interface AthenaRelationSelectNode<TSelect extends AthenaSelectShape = AthenaSelectShape> {
|
|
224
240
|
select: TSelect;
|
|
@@ -227,6 +243,18 @@ interface AthenaRelationSelectNode<TSelect extends AthenaSelectShape = AthenaSel
|
|
|
227
243
|
schema?: string;
|
|
228
244
|
}
|
|
229
245
|
type AthenaSelectShape = Record<string, true | AthenaRelationSelectNode<AthenaSelectShape>>;
|
|
246
|
+
type AthenaAllowedRelationSelectNodeKey = 'select' | 'as' | 'via' | 'schema';
|
|
247
|
+
type AthenaValidatedRelationSelectNode<TNode> = TNode extends {
|
|
248
|
+
select: infer TChild;
|
|
249
|
+
} ? Exclude<keyof TNode, AthenaAllowedRelationSelectNodeKey> extends never ? TNode extends {
|
|
250
|
+
schema: string;
|
|
251
|
+
via: string;
|
|
252
|
+
} ? never : TChild extends Record<string, unknown> ? {
|
|
253
|
+
[K in keyof TNode]: K extends 'select' ? AthenaValidatedSelectShape<TChild> : K extends AthenaAllowedRelationSelectNodeKey ? TNode[K] : never;
|
|
254
|
+
} : never : never : never;
|
|
255
|
+
type AthenaValidatedSelectShape<TSelect> = {
|
|
256
|
+
[K in keyof TSelect]: TSelect[K] extends true ? true : AthenaValidatedRelationSelectNode<TSelect[K]>;
|
|
257
|
+
};
|
|
230
258
|
type GenericRegistryDef = RegistryDef<Record<string, DatabaseDef<Record<string, SchemaDef<Record<string, AnyModelDef>>>>>>;
|
|
231
259
|
type AthenaOrderByDirectionInput = 'asc' | 'desc' | 'ascending' | 'descending' | boolean | {
|
|
232
260
|
ascending?: boolean;
|
|
@@ -315,6 +343,12 @@ interface AthenaClientExperimentalOptions {
|
|
|
315
343
|
* envelopes by default. This flag is retained as a no-op compatibility switch.
|
|
316
344
|
*/
|
|
317
345
|
enableErrorNormalization?: boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Retry retryable read failures (`select`, `findMany`, `query`) with a fixed internal policy.
|
|
348
|
+
*
|
|
349
|
+
* Applies two additional attempts with exponential backoff and jitter.
|
|
350
|
+
*/
|
|
351
|
+
retryReads?: boolean;
|
|
318
352
|
/**
|
|
319
353
|
* Emit execution diagnostics for every query/mutation/RPC invocation.
|
|
320
354
|
* Includes payload, synthesized SQL, full outcome, and best-effort callsite metadata.
|
|
@@ -443,7 +477,9 @@ interface AthenaFromOptions {
|
|
|
443
477
|
}
|
|
444
478
|
interface TableQueryBuilder<Row, Insert = Partial<Row>, Update = Partial<Insert>, TContext = unknown> extends FilterChain<TableQueryBuilder<Row, Insert, Update, TContext>, Row> {
|
|
445
479
|
select<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): SelectChain<Row, T>;
|
|
446
|
-
findMany<const TSelect extends AthenaSelectShape>(options: AthenaFindManyOptions<Row, TSelect>
|
|
480
|
+
findMany<const TSelect extends AthenaSelectShape>(options: AthenaFindManyOptions<Row, TSelect> & {
|
|
481
|
+
select: AthenaValidatedSelectShape<TSelect>;
|
|
482
|
+
}): Promise<AthenaResult<Array<AthenaFindManyResult<Row, TSelect, TContext>>>>;
|
|
447
483
|
insert(values: Insert, options?: AthenaGatewayCallOptions): MutationQuery<Row>;
|
|
448
484
|
insert(values: Insert[], options?: AthenaGatewayCallOptions): MutationQuery<Row[]>;
|
|
449
485
|
upsert(values: Insert, options?: AthenaGatewayCallOptions & {
|
|
@@ -489,8 +525,6 @@ interface AthenaClientBuilder {
|
|
|
489
525
|
experimental(options: AthenaClientExperimentalOptions): AthenaClientBuilder;
|
|
490
526
|
/** Apply the same options object accepted by `createClient(url, key, options)`. */
|
|
491
527
|
options(options: AthenaCreateClientOptions): AthenaClientBuilder;
|
|
492
|
-
/** Enable or disable health tracking metadata. */
|
|
493
|
-
healthTracking(enabled: boolean): AthenaClientBuilder;
|
|
494
528
|
/** Build the immutable Athena SDK client. */
|
|
495
529
|
build(): AthenaSdkClientWithAuth;
|
|
496
530
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as AthenaJsonValue, a as AthenaGatewayCallOptions, g as AthenaJsonObject, j as AthenaRpcCallOptions, J as AthenaConditionValue, K as AthenaConditionArrayValue, R as RegistryDef, D as DatabaseDef, F as SchemaDef, L as AnyModelDef, x as ModelDef, C as ModelRelationMetadata, E as RowOf, o as BackendConfig, p as BackendType, e as AthenaGatewayErrorDetails, A as AthenaConditionCastType, N as AthenaConditionOperator, b as AthenaGatewayConnectionOptions, c as AthenaGatewayConnectionResult, y as ModelMetadata, H as TenantKeyMap, T as TenantContext, M as ModelAt, q as InsertOf, U as UpdateOf, S as SchemaIntrospectionProvider, r as IntrospectionColumn } from './types-09Q4D86N.js';
|
|
2
|
-
import {
|
|
2
|
+
import { f as AthenaAuthClientConfig, d as AthenaAuthBindings, 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-CO4-LmNC.js';
|
|
3
3
|
import { j as GeneratorSchemaSelection, b as GeneratorProviderConfig } from './types-DU3gNdFv.js';
|
|
4
4
|
|
|
5
5
|
type AthenaErrorKind = 'unique_violation' | 'not_found' | 'validation' | 'auth' | 'rate_limit' | 'transient' | 'unknown';
|
|
@@ -200,6 +200,7 @@ interface AthenaDbModule {
|
|
|
200
200
|
type AthenaRowShape$1 = Record<string, AthenaJsonValue | undefined>;
|
|
201
201
|
type FilterColumnKey$1<Row> = Extract<keyof NonNullable<Row>, string>;
|
|
202
202
|
type ResolvedFilterColumnKey$1<Row> = [FilterColumnKey$1<Row>] extends [never] ? string : FilterColumnKey$1<Row>;
|
|
203
|
+
type AthenaFilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'contains' | 'containedBy';
|
|
203
204
|
type AthenaWherePrimitive = AthenaConditionValue;
|
|
204
205
|
type AthenaWhereOperatorInput = {
|
|
205
206
|
eq?: AthenaConditionValue;
|
|
@@ -215,10 +216,25 @@ type AthenaWhereOperatorInput = {
|
|
|
215
216
|
contains?: AthenaConditionArrayValue;
|
|
216
217
|
containedBy?: AthenaConditionArrayValue;
|
|
217
218
|
};
|
|
218
|
-
type
|
|
219
|
-
type
|
|
220
|
-
|
|
221
|
-
|
|
219
|
+
type AthenaWhereColumnInput<Row = AthenaRowShape$1> = Partial<Record<ResolvedFilterColumnKey$1<Row>, AthenaWherePrimitive | AthenaWhereOperatorInput>>;
|
|
220
|
+
type AthenaBooleanSafeOperator = Exclude<AthenaFilterOperator, 'in' | 'contains' | 'containedBy'>;
|
|
221
|
+
type AthenaWhereBooleanSafeOperatorInput = Partial<Record<AthenaBooleanSafeOperator, AthenaConditionValue>>;
|
|
222
|
+
type AthenaWhereBooleanNotOperatorInput = {
|
|
223
|
+
[K in AthenaBooleanSafeOperator]: {
|
|
224
|
+
[P in K]: AthenaConditionValue;
|
|
225
|
+
} & Partial<Record<Exclude<AthenaBooleanSafeOperator, K>, never>>;
|
|
226
|
+
}[AthenaBooleanSafeOperator];
|
|
227
|
+
type AthenaStrictBooleanOperand<Keys extends string, Value> = {
|
|
228
|
+
[K in Keys]: {
|
|
229
|
+
[P in K]: Value;
|
|
230
|
+
} & Partial<Record<Exclude<Keys, K>, never>>;
|
|
231
|
+
}[Keys];
|
|
232
|
+
type AthenaNonEmptyArray<T> = [T, ...T[]];
|
|
233
|
+
type AthenaWhereBooleanOperand<Row = AthenaRowShape$1> = string extends ResolvedFilterColumnKey$1<Row> ? AthenaWhereColumnInput<Row> : AthenaStrictBooleanOperand<ResolvedFilterColumnKey$1<Row>, AthenaWherePrimitive | AthenaWhereBooleanSafeOperatorInput>;
|
|
234
|
+
type AthenaWhereNotOperand<Row = AthenaRowShape$1> = string extends ResolvedFilterColumnKey$1<Row> ? AthenaWhereColumnInput<Row> : AthenaStrictBooleanOperand<ResolvedFilterColumnKey$1<Row>, AthenaWherePrimitive | AthenaWhereBooleanNotOperatorInput>;
|
|
235
|
+
type AthenaWhere<Row = AthenaRowShape$1> = AthenaWhereColumnInput<Row> & {
|
|
236
|
+
or?: string extends ResolvedFilterColumnKey$1<Row> ? Array<AthenaWhereColumnInput<Row>> : AthenaNonEmptyArray<AthenaWhereBooleanOperand<Row>>;
|
|
237
|
+
not?: AthenaWhereNotOperand<Row>;
|
|
222
238
|
};
|
|
223
239
|
interface AthenaRelationSelectNode<TSelect extends AthenaSelectShape = AthenaSelectShape> {
|
|
224
240
|
select: TSelect;
|
|
@@ -227,6 +243,18 @@ interface AthenaRelationSelectNode<TSelect extends AthenaSelectShape = AthenaSel
|
|
|
227
243
|
schema?: string;
|
|
228
244
|
}
|
|
229
245
|
type AthenaSelectShape = Record<string, true | AthenaRelationSelectNode<AthenaSelectShape>>;
|
|
246
|
+
type AthenaAllowedRelationSelectNodeKey = 'select' | 'as' | 'via' | 'schema';
|
|
247
|
+
type AthenaValidatedRelationSelectNode<TNode> = TNode extends {
|
|
248
|
+
select: infer TChild;
|
|
249
|
+
} ? Exclude<keyof TNode, AthenaAllowedRelationSelectNodeKey> extends never ? TNode extends {
|
|
250
|
+
schema: string;
|
|
251
|
+
via: string;
|
|
252
|
+
} ? never : TChild extends Record<string, unknown> ? {
|
|
253
|
+
[K in keyof TNode]: K extends 'select' ? AthenaValidatedSelectShape<TChild> : K extends AthenaAllowedRelationSelectNodeKey ? TNode[K] : never;
|
|
254
|
+
} : never : never : never;
|
|
255
|
+
type AthenaValidatedSelectShape<TSelect> = {
|
|
256
|
+
[K in keyof TSelect]: TSelect[K] extends true ? true : AthenaValidatedRelationSelectNode<TSelect[K]>;
|
|
257
|
+
};
|
|
230
258
|
type GenericRegistryDef = RegistryDef<Record<string, DatabaseDef<Record<string, SchemaDef<Record<string, AnyModelDef>>>>>>;
|
|
231
259
|
type AthenaOrderByDirectionInput = 'asc' | 'desc' | 'ascending' | 'descending' | boolean | {
|
|
232
260
|
ascending?: boolean;
|
|
@@ -315,6 +343,12 @@ interface AthenaClientExperimentalOptions {
|
|
|
315
343
|
* envelopes by default. This flag is retained as a no-op compatibility switch.
|
|
316
344
|
*/
|
|
317
345
|
enableErrorNormalization?: boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Retry retryable read failures (`select`, `findMany`, `query`) with a fixed internal policy.
|
|
348
|
+
*
|
|
349
|
+
* Applies two additional attempts with exponential backoff and jitter.
|
|
350
|
+
*/
|
|
351
|
+
retryReads?: boolean;
|
|
318
352
|
/**
|
|
319
353
|
* Emit execution diagnostics for every query/mutation/RPC invocation.
|
|
320
354
|
* Includes payload, synthesized SQL, full outcome, and best-effort callsite metadata.
|
|
@@ -443,7 +477,9 @@ interface AthenaFromOptions {
|
|
|
443
477
|
}
|
|
444
478
|
interface TableQueryBuilder<Row, Insert = Partial<Row>, Update = Partial<Insert>, TContext = unknown> extends FilterChain<TableQueryBuilder<Row, Insert, Update, TContext>, Row> {
|
|
445
479
|
select<T = Row>(columns?: string | string[], options?: AthenaGatewayCallOptions): SelectChain<Row, T>;
|
|
446
|
-
findMany<const TSelect extends AthenaSelectShape>(options: AthenaFindManyOptions<Row, TSelect>
|
|
480
|
+
findMany<const TSelect extends AthenaSelectShape>(options: AthenaFindManyOptions<Row, TSelect> & {
|
|
481
|
+
select: AthenaValidatedSelectShape<TSelect>;
|
|
482
|
+
}): Promise<AthenaResult<Array<AthenaFindManyResult<Row, TSelect, TContext>>>>;
|
|
447
483
|
insert(values: Insert, options?: AthenaGatewayCallOptions): MutationQuery<Row>;
|
|
448
484
|
insert(values: Insert[], options?: AthenaGatewayCallOptions): MutationQuery<Row[]>;
|
|
449
485
|
upsert(values: Insert, options?: AthenaGatewayCallOptions & {
|
|
@@ -489,8 +525,6 @@ interface AthenaClientBuilder {
|
|
|
489
525
|
experimental(options: AthenaClientExperimentalOptions): AthenaClientBuilder;
|
|
490
526
|
/** Apply the same options object accepted by `createClient(url, key, options)`. */
|
|
491
527
|
options(options: AthenaCreateClientOptions): AthenaClientBuilder;
|
|
492
|
-
/** Enable or disable health tracking metadata. */
|
|
493
|
-
healthTracking(enabled: boolean): AthenaClientBuilder;
|
|
494
528
|
/** Build the immutable Athena SDK client. */
|
|
495
529
|
build(): AthenaSdkClientWithAuth;
|
|
496
530
|
}
|
package/dist/react.cjs
CHANGED
|
@@ -132,12 +132,47 @@ function buildAthenaGatewayUrl(baseUrl, path) {
|
|
|
132
132
|
return `${baseUrl}${path}`;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
// src/cookies/cookie-utils.ts
|
|
136
|
+
var SECURE_COOKIE_PREFIX = "__Secure-";
|
|
137
|
+
function parseCookies(cookieHeader) {
|
|
138
|
+
const cookies = cookieHeader.split("; ");
|
|
139
|
+
const cookieMap = /* @__PURE__ */ new Map();
|
|
140
|
+
cookies.forEach((cookie) => {
|
|
141
|
+
const [name, value] = cookie.split(/=(.*)/s);
|
|
142
|
+
cookieMap.set(name, value);
|
|
143
|
+
});
|
|
144
|
+
return cookieMap;
|
|
145
|
+
}
|
|
146
|
+
var getSessionCookie = (request, config) => {
|
|
147
|
+
const cookies = (request instanceof Headers || !("headers" in request) ? request : request.headers).get("cookie");
|
|
148
|
+
if (!cookies) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
const { cookieName = "session_token", cookiePrefix = "athena-auth" } = {};
|
|
152
|
+
const parsedCookie = parseCookies(cookies);
|
|
153
|
+
const getCookie = (name) => parsedCookie.get(name) || parsedCookie.get(`${SECURE_COOKIE_PREFIX}${name}`);
|
|
154
|
+
const sessionToken = getCookie(`${cookiePrefix}.${cookieName}`) || getCookie(`${cookiePrefix}-${cookieName}`);
|
|
155
|
+
if (sessionToken) {
|
|
156
|
+
return sessionToken;
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// package.json
|
|
162
|
+
var package_default = {
|
|
163
|
+
version: "2.4.1"
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// src/sdk-version.ts
|
|
167
|
+
var PACKAGE_VERSION = package_default.version;
|
|
168
|
+
function buildSdkHeaderValue(sdkName) {
|
|
169
|
+
return `${sdkName} ${PACKAGE_VERSION}`;
|
|
170
|
+
}
|
|
171
|
+
|
|
135
172
|
// src/gateway/client.ts
|
|
136
173
|
var DEFAULT_CLIENT = "railway_direct";
|
|
137
|
-
var FALLBACK_SDK_VERSION = "1.3.0";
|
|
138
174
|
var SDK_NAME = "xylex-group/athena";
|
|
139
|
-
var
|
|
140
|
-
var SDK_HEADER_VALUE = `${SDK_NAME} ${SDK_VERSION}`;
|
|
175
|
+
var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
|
|
141
176
|
function parseResponseBody(rawText, contentType) {
|
|
142
177
|
if (!rawText) {
|
|
143
178
|
return { parsed: null, parseFailed: false };
|
|
@@ -156,6 +191,37 @@ function parseResponseBody(rawText, contentType) {
|
|
|
156
191
|
function normalizeHeaderValue(value) {
|
|
157
192
|
return value ? value : void 0;
|
|
158
193
|
}
|
|
194
|
+
function resolveHeaderValue(headers, candidates) {
|
|
195
|
+
for (const candidate of candidates) {
|
|
196
|
+
const direct = normalizeHeaderValue(headers[candidate]);
|
|
197
|
+
if (direct) return direct;
|
|
198
|
+
}
|
|
199
|
+
const loweredCandidates = new Set(candidates.map((candidate) => candidate.toLowerCase()));
|
|
200
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
201
|
+
if (!loweredCandidates.has(key.toLowerCase())) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
const normalized = normalizeHeaderValue(value);
|
|
205
|
+
if (normalized) return normalized;
|
|
206
|
+
}
|
|
207
|
+
return void 0;
|
|
208
|
+
}
|
|
209
|
+
function resolveBearerTokenFromAuthorizationHeader(headers) {
|
|
210
|
+
const authorization = resolveHeaderValue(headers, ["Authorization"]);
|
|
211
|
+
if (!authorization) {
|
|
212
|
+
return void 0;
|
|
213
|
+
}
|
|
214
|
+
const match = authorization.match(/^Bearer\s+(.+)$/i);
|
|
215
|
+
const token = match?.[1]?.trim();
|
|
216
|
+
return token ? token : void 0;
|
|
217
|
+
}
|
|
218
|
+
function resolveSessionTokenFromCookieHeader(headers) {
|
|
219
|
+
const cookie = resolveHeaderValue(headers, ["Cookie"]);
|
|
220
|
+
if (!cookie) {
|
|
221
|
+
return void 0;
|
|
222
|
+
}
|
|
223
|
+
return getSessionCookie(new Headers({ cookie })) ?? void 0;
|
|
224
|
+
}
|
|
159
225
|
function isRecord(value) {
|
|
160
226
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
161
227
|
}
|
|
@@ -273,7 +339,7 @@ function buildRpcGetEndpoint(payload) {
|
|
|
273
339
|
status: 0
|
|
274
340
|
});
|
|
275
341
|
}
|
|
276
|
-
query.
|
|
342
|
+
query.append(filter.column, toRpcFilterQueryValue(filter));
|
|
277
343
|
}
|
|
278
344
|
}
|
|
279
345
|
const endpoint = `/rpc/${encodeURIComponent(functionName)}`;
|
|
@@ -319,6 +385,20 @@ function buildHeaders(config, options) {
|
|
|
319
385
|
headers["apikey"] = finalApiKey;
|
|
320
386
|
headers["x-api-key"] = headers["x-api-key"] ?? finalApiKey;
|
|
321
387
|
}
|
|
388
|
+
const explicitSessionToken = resolveHeaderValue(extraHeaders, [
|
|
389
|
+
"X-Athena-Auth-Session-Token"
|
|
390
|
+
]);
|
|
391
|
+
const derivedSessionToken = explicitSessionToken ?? resolveSessionTokenFromCookieHeader(extraHeaders);
|
|
392
|
+
if (derivedSessionToken) {
|
|
393
|
+
headers["X-Athena-Auth-Session-Token"] = derivedSessionToken;
|
|
394
|
+
}
|
|
395
|
+
const explicitBearerToken = resolveHeaderValue(extraHeaders, [
|
|
396
|
+
"X-Athena-Auth-Bearer-Token"
|
|
397
|
+
]);
|
|
398
|
+
const derivedBearerToken = explicitBearerToken ?? resolveBearerTokenFromAuthorizationHeader(extraHeaders);
|
|
399
|
+
if (derivedBearerToken) {
|
|
400
|
+
headers["X-Athena-Auth-Bearer-Token"] = derivedBearerToken;
|
|
401
|
+
}
|
|
322
402
|
const athenaClientKeys = ["x-athena-client", "X-Athena-Client"];
|
|
323
403
|
Object.entries(extraHeaders).forEach(([key, value]) => {
|
|
324
404
|
if (athenaClientKeys.includes(key)) return;
|