@xylex-group/athena 2.4.1 → 2.6.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 (41) hide show
  1. package/README.md +52 -1
  2. package/bin/athena-js.js +0 -0
  3. package/dist/browser.cjs +1912 -49
  4. package/dist/browser.cjs.map +1 -1
  5. package/dist/browser.d.cts +8 -7
  6. package/dist/browser.d.ts +8 -7
  7. package/dist/browser.js +1905 -50
  8. package/dist/browser.js.map +1 -1
  9. package/dist/cli/index.cjs +708 -22
  10. package/dist/cli/index.cjs.map +1 -1
  11. package/dist/cli/index.d.cts +3 -3
  12. package/dist/cli/index.d.ts +3 -3
  13. package/dist/cli/index.js +708 -22
  14. package/dist/cli/index.js.map +1 -1
  15. package/dist/cookies.d.cts +1 -174
  16. package/dist/cookies.d.ts +1 -174
  17. package/dist/index-CVcQCGyG.d.cts +174 -0
  18. package/dist/index-CVcQCGyG.d.ts +174 -0
  19. package/dist/index.cjs +1912 -49
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +8 -7
  22. package/dist/index.d.ts +8 -7
  23. package/dist/index.js +1905 -50
  24. package/dist/index.js.map +1 -1
  25. package/dist/{model-form-4LPnOPAF.d.cts → model-form-BaHWi3gm.d.cts} +1 -1
  26. package/dist/{model-form-CO4-LmNC.d.ts → model-form-Dh6gWjL0.d.ts} +1 -1
  27. package/dist/{pipeline-CR4V15jF.d.ts → pipeline-Ce3pTw5h.d.ts} +1 -1
  28. package/dist/{pipeline-DZeExYMA.d.cts → pipeline-D1ZYeoH7.d.cts} +1 -1
  29. package/dist/{react-email-Buhcpglm.d.ts → react-email-B8O1Jeff.d.cts} +596 -23
  30. package/dist/{react-email-6mOyxBo4.d.cts → react-email-CDEF0jij.d.ts} +596 -23
  31. package/dist/react.cjs +1 -1
  32. package/dist/react.cjs.map +1 -1
  33. package/dist/react.d.cts +4 -4
  34. package/dist/react.d.ts +4 -4
  35. package/dist/react.js +1 -1
  36. package/dist/react.js.map +1 -1
  37. package/dist/{types-D1JvL21V.d.cts → types-CUuo4NDi.d.cts} +1 -1
  38. package/dist/{types-09Q4D86N.d.cts → types-DSX6AT5B.d.cts} +3 -3
  39. package/dist/{types-09Q4D86N.d.ts → types-DSX6AT5B.d.ts} +3 -3
  40. package/dist/{types-DU3gNdFv.d.ts → types-DapchQY5.d.ts} +1 -1
  41. package/package.json +193 -192
@@ -1,6 +1,7 @@
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 { 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
- import { j as GeneratorSchemaSelection, b as GeneratorProviderConfig } from './types-DU3gNdFv.js';
1
+ import { i as AthenaJsonValue, a as AthenaGatewayCallOptions, g as AthenaJsonObject, j as AthenaRpcCallOptions, b as AthenaGatewayConnectionOptions, c as AthenaGatewayConnectionResult, J as AthenaGatewayEndpointPath, K as AthenaGatewayMethod, L as AthenaConditionValue, N as AthenaConditionArrayValue, R as RegistryDef, D as DatabaseDef, F as SchemaDef, O as AnyModelDef, x as ModelDef, C as ModelRelationMetadata, E as RowOf, o as BackendConfig, p as BackendType, e as AthenaGatewayErrorDetails, A as AthenaConditionCastType, P as AthenaConditionOperator, 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-DSX6AT5B.cjs';
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-BaHWi3gm.cjs';
3
+ import { j as GeneratorSchemaSelection, b as GeneratorProviderConfig } from './types-CUuo4NDi.cjs';
4
+ 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';
4
5
 
5
6
  type AthenaErrorKind = 'unique_violation' | 'not_found' | 'validation' | 'auth' | 'rate_limit' | 'transient' | 'unknown';
6
7
  declare const AthenaErrorKind: {
@@ -197,6 +198,373 @@ interface AthenaDbModule {
197
198
  query<Row = unknown>(query: string, options?: AthenaGatewayCallOptions): Promise<AthenaResult<Row[]>>;
198
199
  }
199
200
 
201
+ declare function verifyAthenaGatewayUrl(baseUrl: string, options?: AthenaGatewayConnectionOptions): Promise<AthenaGatewayConnectionResult>;
202
+
203
+ declare const storageSdkManifest: {
204
+ readonly namespace: "storage";
205
+ readonly basePath: "/storage";
206
+ readonly envelopeKinds: {
207
+ readonly raw: "response body is the payload";
208
+ readonly athena: "response body is { status, message, data }";
209
+ };
210
+ readonly methods: readonly [{
211
+ readonly name: "listStorageCatalogs";
212
+ readonly method: "GET";
213
+ readonly path: "/storage/catalogs";
214
+ readonly responseEnvelope: "raw";
215
+ readonly responseType: "{ data: S3CatalogItem[] }";
216
+ }, {
217
+ readonly name: "createStorageCatalog";
218
+ readonly method: "POST";
219
+ readonly path: "/storage/catalogs";
220
+ readonly requestType: "CreateStorageCatalogRequest";
221
+ readonly responseEnvelope: "raw";
222
+ readonly responseType: "S3CatalogItem";
223
+ }, {
224
+ readonly name: "updateStorageCatalog";
225
+ readonly method: "PATCH";
226
+ readonly path: "/storage/catalogs/{id}";
227
+ readonly pathParams: readonly ["id"];
228
+ readonly requestType: "UpdateStorageCatalogRequest";
229
+ readonly responseEnvelope: "raw";
230
+ readonly responseType: "S3CatalogItem";
231
+ }, {
232
+ readonly name: "deleteStorageCatalog";
233
+ readonly method: "DELETE";
234
+ readonly path: "/storage/catalogs/{id}";
235
+ readonly pathParams: readonly ["id"];
236
+ readonly responseEnvelope: "raw";
237
+ readonly responseType: "{ id: string; deleted: boolean }";
238
+ }, {
239
+ readonly name: "listStorageCredentials";
240
+ readonly method: "GET";
241
+ readonly path: "/storage/credentials";
242
+ readonly responseEnvelope: "raw";
243
+ readonly responseType: "{ data: S3CredentialListItem[] }";
244
+ }, {
245
+ readonly name: "createStorageUploadUrl";
246
+ readonly method: "POST";
247
+ readonly path: "/storage/files/upload-url";
248
+ readonly requestType: "CreateStorageUploadUrlRequest";
249
+ readonly responseEnvelope: "athena";
250
+ readonly responseType: "StorageUploadUrlResponse";
251
+ }, {
252
+ readonly name: "createStorageUploadUrls";
253
+ readonly method: "POST";
254
+ readonly path: "/storage/files/upload-urls";
255
+ readonly requestType: "CreateStorageUploadUrlsRequest";
256
+ readonly responseEnvelope: "athena";
257
+ readonly responseType: "StorageBatchUploadUrlResponse";
258
+ }, {
259
+ readonly name: "listStorageFiles";
260
+ readonly method: "POST";
261
+ readonly path: "/storage/files/list";
262
+ readonly requestType: "ListStorageFilesRequest";
263
+ readonly responseEnvelope: "athena";
264
+ readonly responseType: "StorageListFilesResponse";
265
+ }, {
266
+ readonly name: "getStorageFile";
267
+ readonly method: "GET";
268
+ readonly path: "/storage/files/{file_id}";
269
+ readonly pathParams: readonly ["file_id"];
270
+ readonly responseEnvelope: "athena";
271
+ readonly responseType: "StorageFileMutationResponse";
272
+ }, {
273
+ readonly name: "getStorageFileUrl";
274
+ readonly method: "GET";
275
+ readonly path: "/storage/files/{file_id}/url";
276
+ readonly pathParams: readonly ["file_id"];
277
+ readonly queryParams: readonly ["purpose"];
278
+ readonly responseEnvelope: "athena";
279
+ readonly responseType: "PresignedFileUrlResponse";
280
+ }, {
281
+ readonly name: "getStorageFileProxy";
282
+ readonly method: "GET";
283
+ readonly path: "/storage/files/{file_id}/proxy";
284
+ readonly pathParams: readonly ["file_id"];
285
+ readonly queryParams: readonly ["purpose"];
286
+ readonly responseEnvelope: "raw";
287
+ readonly responseType: "Response";
288
+ readonly binary: true;
289
+ }, {
290
+ readonly name: "updateStorageFile";
291
+ readonly method: "PATCH";
292
+ readonly path: "/storage/files/{file_id}";
293
+ readonly pathParams: readonly ["file_id"];
294
+ readonly requestType: "UpdateStorageFileRequest";
295
+ readonly responseEnvelope: "athena";
296
+ readonly responseType: "StorageFileMutationResponse";
297
+ }, {
298
+ readonly name: "deleteStorageFile";
299
+ readonly method: "DELETE";
300
+ readonly path: "/storage/files/{file_id}";
301
+ readonly pathParams: readonly ["file_id"];
302
+ readonly responseEnvelope: "athena";
303
+ readonly responseType: "StorageFileMutationResponse";
304
+ }, {
305
+ readonly name: "setStorageFileVisibility";
306
+ readonly method: "PATCH";
307
+ readonly path: "/storage/files/{file_id}/visibility";
308
+ readonly pathParams: readonly ["file_id"];
309
+ readonly requestType: "SetStorageFileVisibilityRequest";
310
+ readonly responseEnvelope: "athena";
311
+ readonly responseType: "StorageFileMutationResponse";
312
+ }, {
313
+ readonly name: "deleteStorageFolder";
314
+ readonly method: "POST";
315
+ readonly path: "/storage/folders/delete";
316
+ readonly requestType: "DeleteStorageFolderRequest";
317
+ readonly responseEnvelope: "athena";
318
+ readonly responseType: "StorageFolderMutationResponse";
319
+ }, {
320
+ readonly name: "moveStorageFolder";
321
+ readonly method: "POST";
322
+ readonly path: "/storage/folders/move";
323
+ readonly requestType: "MoveStorageFolderRequest";
324
+ readonly responseEnvelope: "athena";
325
+ readonly responseType: "StorageFolderMutationResponse";
326
+ }];
327
+ };
328
+ interface S3CatalogItem {
329
+ id: string;
330
+ name: string;
331
+ description: string;
332
+ endpoint: string;
333
+ region: string;
334
+ bucket?: string | null;
335
+ provider: string;
336
+ is_active: boolean;
337
+ active_credential_id?: string | null;
338
+ active_access_key?: string | null;
339
+ created_at: string;
340
+ updated_at: string;
341
+ }
342
+ interface S3CredentialListItem {
343
+ id: string;
344
+ s3_id: string;
345
+ name: string;
346
+ description: string;
347
+ endpoint: string;
348
+ region: string;
349
+ bucket?: string | null;
350
+ provider: string;
351
+ access_key: string;
352
+ created_at: string;
353
+ updated_at: string;
354
+ }
355
+ interface ManagedFileRecord {
356
+ id: string;
357
+ name: string;
358
+ original_name?: string | null;
359
+ url?: string | null;
360
+ bucket: string;
361
+ s3_id?: string | null;
362
+ prefix_path?: string | null;
363
+ size_bytes?: number | null;
364
+ mime_type?: string | null;
365
+ resource_id?: string | null;
366
+ organization_id: string;
367
+ metadata: Record<string, unknown>;
368
+ created_at: string;
369
+ updated_at: string;
370
+ storage_key: string;
371
+ uploaded_by_user_id?: string | null;
372
+ extension?: string | null;
373
+ is_public: boolean;
374
+ status: string;
375
+ deleted_at?: string | null;
376
+ }
377
+ interface PresignedFileUrlResponse {
378
+ file_id: string;
379
+ bucket: string;
380
+ storage_key: string;
381
+ purpose: string;
382
+ url: string;
383
+ expires_at: string;
384
+ expires_at_epoch_seconds: number;
385
+ expires_in: number;
386
+ cache_hit: boolean;
387
+ cache_layer: string;
388
+ }
389
+ interface CreateStorageCatalogRequest {
390
+ name: string;
391
+ description?: string;
392
+ endpoint: string;
393
+ region: string;
394
+ bucket?: string;
395
+ provider?: string;
396
+ access_key_id: string;
397
+ secret_key: string;
398
+ session_token?: string;
399
+ metadata?: Record<string, unknown>;
400
+ }
401
+ interface UpdateStorageCatalogRequest {
402
+ name?: string;
403
+ description?: string;
404
+ endpoint?: string;
405
+ region?: string;
406
+ bucket?: string;
407
+ provider?: string;
408
+ access_key_id?: string;
409
+ secret_key?: string;
410
+ session_token?: string;
411
+ is_active?: boolean;
412
+ metadata?: Record<string, unknown>;
413
+ }
414
+ interface CreateStorageUploadUrlRequest {
415
+ s3_id: string;
416
+ bucket?: string;
417
+ storage_key: string;
418
+ name?: string;
419
+ original_name?: string;
420
+ resource_id?: string;
421
+ mime_type?: string;
422
+ content_type?: string;
423
+ size_bytes?: number;
424
+ file_id?: string;
425
+ public?: boolean;
426
+ metadata?: Record<string, unknown>;
427
+ }
428
+ interface CreateStorageUploadUrlsRequest {
429
+ files: CreateStorageUploadUrlRequest[];
430
+ }
431
+ interface StorageUploadUrlResponse {
432
+ file: ManagedFileRecord;
433
+ upload: PresignedFileUrlResponse;
434
+ }
435
+ interface StorageBatchUploadUrlResponse {
436
+ files: StorageUploadUrlResponse[];
437
+ }
438
+ interface ListStorageFilesRequest {
439
+ s3_id: string;
440
+ prefix: string;
441
+ }
442
+ interface StorageListFilesResponse {
443
+ files: ManagedFileRecord[];
444
+ count: number;
445
+ }
446
+ interface UpdateStorageFileRequest {
447
+ storage_key: string;
448
+ bucket?: string;
449
+ }
450
+ interface SetStorageFileVisibilityRequest {
451
+ public: boolean;
452
+ }
453
+ interface DeleteStorageFolderRequest {
454
+ s3_id: string;
455
+ prefix: string;
456
+ }
457
+ interface MoveStorageFolderRequest {
458
+ s3_id: string;
459
+ from_prefix: string;
460
+ to_prefix: string;
461
+ }
462
+ interface StorageFileMutationResponse {
463
+ file: ManagedFileRecord;
464
+ }
465
+ interface StorageFolderMutationResponse {
466
+ s3_id: string;
467
+ prefix: string;
468
+ processed_files: number;
469
+ }
470
+ interface AthenaEnvelope<T> {
471
+ status: string;
472
+ message: string;
473
+ data: T;
474
+ }
475
+ type StorageFileAccessPurpose = 'read' | 'download' | 'stream';
476
+ interface GetStorageFileUrlQuery {
477
+ purpose?: StorageFileAccessPurpose | (string & {});
478
+ }
479
+ type AthenaStorageErrorHandler = (error: AthenaStorageError) => void | Promise<void>;
480
+ interface AthenaStorageClientConfig {
481
+ onError?: AthenaStorageErrorHandler;
482
+ }
483
+ interface AthenaStorageCallOptions extends AthenaGatewayCallOptions {
484
+ signal?: AbortSignal;
485
+ onError?: AthenaStorageErrorHandler;
486
+ }
487
+ type AthenaStorageBinaryCallOptions = AthenaStorageCallOptions;
488
+ type AthenaStorageErrorCode = 'INVALID_URL' | 'NETWORK_ERROR' | 'HTTP_ERROR' | 'INVALID_JSON' | 'INVALID_ATHENA_ENVELOPE' | 'UNKNOWN_ERROR';
489
+ declare const AthenaStorageErrorCode: {
490
+ readonly InvalidUrl: "INVALID_URL";
491
+ readonly NetworkError: "NETWORK_ERROR";
492
+ readonly HttpError: "HTTP_ERROR";
493
+ readonly InvalidJson: "INVALID_JSON";
494
+ readonly InvalidAthenaEnvelope: "INVALID_ATHENA_ENVELOPE";
495
+ readonly UnknownError: "UNKNOWN_ERROR";
496
+ };
497
+ interface AthenaStorageErrorDetails {
498
+ code: AthenaStorageErrorCode;
499
+ athenaCode: AthenaErrorCode;
500
+ kind: AthenaErrorKind;
501
+ category: AthenaErrorCategory;
502
+ retryable: boolean;
503
+ message: string;
504
+ status: number;
505
+ endpoint: AthenaGatewayEndpointPath;
506
+ method: AthenaGatewayMethod;
507
+ requestId?: string;
508
+ hint?: string;
509
+ cause?: string;
510
+ raw: unknown;
511
+ }
512
+ interface AthenaStorageErrorInput {
513
+ code: AthenaStorageErrorCode;
514
+ message: string;
515
+ status: number;
516
+ endpoint: AthenaGatewayEndpointPath;
517
+ method: AthenaGatewayMethod;
518
+ raw?: unknown;
519
+ requestId?: string;
520
+ hint?: string;
521
+ cause?: unknown;
522
+ }
523
+ declare class AthenaStorageError extends Error {
524
+ readonly code: AthenaStorageErrorCode;
525
+ readonly athenaCode: AthenaErrorCode;
526
+ readonly kind: AthenaErrorKind;
527
+ readonly category: AthenaErrorCategory;
528
+ readonly retryable: boolean;
529
+ readonly status: number;
530
+ readonly endpoint: AthenaGatewayEndpointPath;
531
+ readonly method: AthenaGatewayMethod;
532
+ readonly requestId?: string;
533
+ readonly hint?: string;
534
+ readonly causeDetail?: string;
535
+ readonly raw: unknown;
536
+ readonly normalized: NormalizedAthenaError;
537
+ readonly __athenaNormalizedError: NormalizedAthenaError;
538
+ constructor(input: AthenaStorageErrorInput);
539
+ toDetails(): AthenaStorageErrorDetails;
540
+ }
541
+ interface AthenaStorageModule {
542
+ listStorageCatalogs(options?: AthenaStorageCallOptions): Promise<{
543
+ data: S3CatalogItem[];
544
+ }>;
545
+ createStorageCatalog(input: CreateStorageCatalogRequest, options?: AthenaStorageCallOptions): Promise<S3CatalogItem>;
546
+ updateStorageCatalog(id: string, input: UpdateStorageCatalogRequest, options?: AthenaStorageCallOptions): Promise<S3CatalogItem>;
547
+ deleteStorageCatalog(id: string, options?: AthenaStorageCallOptions): Promise<{
548
+ id: string;
549
+ deleted: boolean;
550
+ }>;
551
+ listStorageCredentials(options?: AthenaStorageCallOptions): Promise<{
552
+ data: S3CredentialListItem[];
553
+ }>;
554
+ createStorageUploadUrl(input: CreateStorageUploadUrlRequest, options?: AthenaStorageCallOptions): Promise<StorageUploadUrlResponse>;
555
+ createStorageUploadUrls(input: CreateStorageUploadUrlsRequest, options?: AthenaStorageCallOptions): Promise<StorageBatchUploadUrlResponse>;
556
+ listStorageFiles(input: ListStorageFilesRequest, options?: AthenaStorageCallOptions): Promise<StorageListFilesResponse>;
557
+ getStorageFile(fileId: string, options?: AthenaStorageCallOptions): Promise<StorageFileMutationResponse>;
558
+ getStorageFileUrl(fileId: string, query?: GetStorageFileUrlQuery, options?: AthenaStorageCallOptions): Promise<PresignedFileUrlResponse>;
559
+ getStorageFileProxy(fileId: string, query?: GetStorageFileUrlQuery, options?: AthenaStorageBinaryCallOptions): Promise<Response>;
560
+ updateStorageFile(fileId: string, input: UpdateStorageFileRequest, options?: AthenaStorageCallOptions): Promise<StorageFileMutationResponse>;
561
+ deleteStorageFile(fileId: string, options?: AthenaStorageCallOptions): Promise<StorageFileMutationResponse>;
562
+ setStorageFileVisibility(fileId: string, input: SetStorageFileVisibilityRequest, options?: AthenaStorageCallOptions): Promise<StorageFileMutationResponse>;
563
+ deleteStorageFolder(input: DeleteStorageFolderRequest, options?: AthenaStorageCallOptions): Promise<StorageFolderMutationResponse>;
564
+ moveStorageFolder(input: MoveStorageFolderRequest, options?: AthenaStorageCallOptions): Promise<StorageFolderMutationResponse>;
565
+ }
566
+ declare function createAthenaStorageError(input: AthenaStorageErrorInput): AthenaStorageError;
567
+
200
568
  type AthenaRowShape$1 = Record<string, AthenaJsonValue | undefined>;
201
569
  type FilterColumnKey$1<Row> = Extract<keyof NonNullable<Row>, string>;
202
570
  type ResolvedFilterColumnKey$1<Row> = [FilterColumnKey$1<Row>] extends [never] ? string : FilterColumnKey$1<Row>;
@@ -361,6 +729,14 @@ interface AthenaClientExperimentalOptions {
361
729
  * represent losslessly yet.
362
730
  */
363
731
  findManyAst?: boolean;
732
+ /**
733
+ * Expose the experimental `client.storage.*` bindings for Athena storage APIs.
734
+ */
735
+ athenaStorageBackend?: boolean;
736
+ /**
737
+ * Optional storage SDK runtime hooks. Only used when `athenaStorageBackend` is enabled.
738
+ */
739
+ storage?: AthenaStorageClientConfig;
364
740
  }
365
741
  interface AthenaQueryTraceOptions {
366
742
  /**
@@ -508,42 +884,53 @@ interface AthenaSdkClient {
508
884
  interface AthenaSdkClientWithAuth extends AthenaSdkClient {
509
885
  auth: AthenaAuthBindings;
510
886
  }
511
- interface AthenaClientBuilder {
887
+ interface AthenaSdkClientWithStorage extends AthenaSdkClientWithAuth {
888
+ storage: AthenaStorageModule;
889
+ }
890
+ interface AthenaCreateClientOptions extends Pick<AthenaGatewayCallOptions, 'client' | 'headers' | 'backend'> {
891
+ auth?: AthenaAuthClientConfig;
892
+ experimental?: AthenaClientExperimentalOptions;
893
+ }
894
+ interface AthenaCreateClientOptionsWithStorage extends AthenaCreateClientOptions {
895
+ experimental: AthenaClientExperimentalOptions & {
896
+ athenaStorageBackend: true;
897
+ };
898
+ }
899
+ interface AthenaClientBuilder<StorageEnabled extends boolean = false> {
512
900
  /** Set the gateway base URL. */
513
- url(url: string): AthenaClientBuilder;
901
+ url(url: string): AthenaClientBuilder<StorageEnabled>;
514
902
  /** Set the API key used for all requests. */
515
- key(apiKey: string): AthenaClientBuilder;
903
+ key(apiKey: string): AthenaClientBuilder<StorageEnabled>;
516
904
  /** Set the default backend routing strategy. */
517
- backend(backend: BackendConfig | BackendType): AthenaClientBuilder;
905
+ backend(backend: BackendConfig | BackendType): AthenaClientBuilder<StorageEnabled>;
518
906
  /** Set the default Athena client routing key. */
519
- client(clientName: string): AthenaClientBuilder;
907
+ client(clientName: string): AthenaClientBuilder<StorageEnabled>;
520
908
  /** Attach static headers to every request. */
521
- headers(headers: Record<string, string>): AthenaClientBuilder;
909
+ headers(headers: Record<string, string>): AthenaClientBuilder<StorageEnabled>;
522
910
  /** Configure Athena Auth client behavior for `client.auth.*` methods. */
523
- auth(config: AthenaAuthClientConfig): AthenaClientBuilder;
524
- /** Configure experimental client options (for example query tracing or findMany AST transport). */
525
- experimental(options: AthenaClientExperimentalOptions): AthenaClientBuilder;
526
- /** Apply the same options object accepted by `createClient(url, key, options)`. */
527
- options(options: AthenaCreateClientOptions): AthenaClientBuilder;
911
+ auth(config: AthenaAuthClientConfig): AthenaClientBuilder<StorageEnabled>;
912
+ /** Configure experimental client options and narrow the built client when storage is enabled. */
913
+ experimental(options: AthenaClientExperimentalOptions & {
914
+ athenaStorageBackend: true;
915
+ }): AthenaClientBuilder<true>;
916
+ experimental(options: AthenaClientExperimentalOptions): AthenaClientBuilder<StorageEnabled>;
917
+ /** Apply createClient options and narrow the built client when storage is enabled. */
918
+ options(options: AthenaCreateClientOptionsWithStorage): AthenaClientBuilder<true>;
919
+ options(options: AthenaCreateClientOptions): AthenaClientBuilder<StorageEnabled>;
528
920
  /** Build the immutable Athena SDK client. */
529
- build(): AthenaSdkClientWithAuth;
921
+ build(): StorageEnabled extends true ? AthenaSdkClientWithStorage : AthenaSdkClientWithAuth;
530
922
  }
531
923
  /** Canonical Athena client factory with builder-based configuration. */
532
924
  declare class AthenaClient {
533
925
  /** Create a fluent builder for a strongly-typed Athena SDK client. */
534
- static builder(): AthenaClientBuilder;
926
+ static builder(): AthenaClientBuilder<false>;
535
927
  /** Build a client from process environment variables. */
536
928
  static fromEnvironment(): AthenaSdkClientWithAuth;
537
929
  }
538
- interface AthenaCreateClientOptions extends Pick<AthenaGatewayCallOptions, 'client' | 'headers' | 'backend'> {
539
- auth?: AthenaAuthClientConfig;
540
- experimental?: AthenaClientExperimentalOptions;
541
- }
542
930
  /** Create client (convenience wrapper; use AthenaClient.builder() for full control) */
931
+ declare function createClient(url: string, apiKey: string, options: AthenaCreateClientOptionsWithStorage): AthenaSdkClientWithStorage;
543
932
  declare function createClient(url: string, apiKey: string, options?: AthenaCreateClientOptions): AthenaSdkClientWithAuth;
544
933
 
545
- declare function verifyAthenaGatewayUrl(baseUrl: string, options?: AthenaGatewayConnectionOptions): Promise<AthenaGatewayConnectionResult>;
546
-
547
934
  interface NormalizeAthenaGatewayBaseUrlOptions {
548
935
  defaultBaseUrl?: string;
549
936
  label?: string;
@@ -623,6 +1010,46 @@ interface PostgresIntrospectionProviderOptions {
623
1010
  */
624
1011
  declare function createPostgresIntrospectionProvider(options: PostgresIntrospectionProviderOptions): SchemaIntrospectionProvider;
625
1012
 
1013
+ interface GeneratorEnvBaseOptions<T> {
1014
+ default?: T;
1015
+ optional?: boolean;
1016
+ }
1017
+ type GeneratorEnvStringOptions = GeneratorEnvBaseOptions<string>;
1018
+ type GeneratorEnvBooleanOptions = GeneratorEnvBaseOptions<boolean>;
1019
+ interface GeneratorEnvListOptions extends GeneratorEnvBaseOptions<readonly string[]> {
1020
+ separator?: string;
1021
+ }
1022
+ type GeneratorEnvJsonOptions<T> = GeneratorEnvBaseOptions<T>;
1023
+ type GeneratorEnvOneOfOptions<T extends string> = GeneratorEnvBaseOptions<T>;
1024
+ type GeneratorEnvHelper = {
1025
+ (key: string, options?: GeneratorEnvStringOptions): string;
1026
+ (key: string, options: GeneratorEnvStringOptions & {
1027
+ optional: true;
1028
+ }): string | undefined;
1029
+ boolean(key: string, options?: GeneratorEnvBooleanOptions): boolean;
1030
+ boolean(key: string, options: GeneratorEnvBooleanOptions & {
1031
+ optional: true;
1032
+ }): boolean | undefined;
1033
+ list(key: string, options?: GeneratorEnvListOptions): string[];
1034
+ list(key: string, options: GeneratorEnvListOptions & {
1035
+ optional: true;
1036
+ }): string[] | undefined;
1037
+ json<T>(key: string, options?: GeneratorEnvJsonOptions<T>): T;
1038
+ json<T>(key: string, options: GeneratorEnvJsonOptions<T> & {
1039
+ optional: true;
1040
+ }): T | undefined;
1041
+ oneOf<const T extends string>(key: string, allowedValues: readonly T[], options?: GeneratorEnvOneOfOptions<T>): T;
1042
+ oneOf<const T extends string>(key: string, allowedValues: readonly T[], options: GeneratorEnvOneOfOptions<T> & {
1043
+ optional: true;
1044
+ }): T | undefined;
1045
+ };
1046
+ /**
1047
+ * Typed env reader for generator configs. This keeps `athena.config.*` files
1048
+ * declarative while preserving exact field types for booleans, lists, unions,
1049
+ * and JSON-backed objects.
1050
+ */
1051
+ declare const generatorEnv: GeneratorEnvHelper;
1052
+
626
1053
  declare function resolvePostgresColumnType(column: IntrospectionColumn): string;
627
1054
 
628
1055
  declare const DEFAULT_POSTGRES_SCHEMAS: readonly ["public"];
@@ -641,6 +1068,152 @@ declare function resolveProviderSchemas(providerConfig: GeneratorProviderConfig)
641
1068
  */
642
1069
  declare function createAuthClient(config?: AthenaAuthClientConfig): AthenaAuthSdkClient;
643
1070
 
1071
+ type AthenaMaybePromise<T> = T | Promise<T>;
1072
+ type AthenaAuthServerCookieOptions = Pick<AthenaCookiesOptions, 'session' | 'advanced'>;
1073
+ declare const ATHENA_AUTH_BASE_ERROR_CODES: {
1074
+ readonly HANDLER_NOT_CONFIGURED: "HANDLER_NOT_CONFIGURED";
1075
+ readonly INVALID_BASE_URL: "INVALID_BASE_URL";
1076
+ readonly UNTRUSTED_HOST: "UNTRUSTED_HOST";
1077
+ };
1078
+ interface AthenaAuthSocialProviderConfig {
1079
+ clientId: string;
1080
+ clientSecret: string;
1081
+ scope?: string[];
1082
+ [key: string]: unknown;
1083
+ }
1084
+ interface AthenaAuthPluginContext {
1085
+ path?: string;
1086
+ headers?: Headers;
1087
+ context: {
1088
+ returned?: unknown;
1089
+ responseHeaders?: Headers;
1090
+ setSession?: AthenaSessionPair | null;
1091
+ clearSession?: boolean;
1092
+ dontRememberMe?: boolean;
1093
+ cookieOverrides?: Partial<AthenaCookieOptions>;
1094
+ [key: string]: unknown;
1095
+ };
1096
+ }
1097
+ interface AthenaAuthPluginHandlerContext extends AthenaAuthPluginContext {
1098
+ auth: AthenaAuthServer;
1099
+ }
1100
+ interface AthenaAuthPlugin {
1101
+ id: string;
1102
+ version: string;
1103
+ $ERROR_CODES?: Record<string, string>;
1104
+ hooks?: {
1105
+ after?: Array<{
1106
+ matcher: (ctx: AthenaAuthPluginContext) => boolean;
1107
+ handler: (ctx: AthenaAuthPluginHandlerContext) => Promise<void> | void;
1108
+ }>;
1109
+ };
1110
+ }
1111
+ interface AthenaAuthCookieRuntimeInput {
1112
+ headers?: Headers;
1113
+ responseHeaders?: Headers;
1114
+ cookies?: AthenaAuthCookies;
1115
+ getCookie?: (name: string) => string | null | undefined;
1116
+ setCookie?: (name: string, value: string, attributes: AthenaCookieOptions) => void;
1117
+ logger?: AthenaCookieContextRuntime['logger'];
1118
+ setSignedCookie?: AthenaCookieContextRuntime['setSignedCookie'];
1119
+ getSignedCookie?: AthenaCookieContextRuntime['getSignedCookie'];
1120
+ setNewSession?: AthenaCookieContextRuntime['context']['setNewSession'];
1121
+ }
1122
+ interface AthenaAuthServerRuntimeOptions {
1123
+ baseURL?: string;
1124
+ basePath: string;
1125
+ secret: string;
1126
+ cookies: AthenaAuthServerCookieOptions;
1127
+ }
1128
+ type AthenaAuthDatabaseFactory<TDatabase = unknown> = (options: AthenaAuthServerRuntimeOptions) => TDatabase;
1129
+ type AthenaAuthBaseURLConfig = AthenaCookiesOptions['baseURL'];
1130
+ type AthenaAuthTrustedOrigins = string[] | ((request?: Request) => AthenaMaybePromise<string[]>);
1131
+ type AthenaAuthTrustedProviders = string[] | ((request?: Request) => AthenaMaybePromise<string[]>);
1132
+ interface AthenaAuthHandlerResult {
1133
+ response?: Response;
1134
+ returned?: unknown;
1135
+ setSession?: AthenaSessionPair | null;
1136
+ clearSession?: boolean;
1137
+ dontRememberMe?: boolean;
1138
+ cookieOverrides?: Partial<AthenaCookieOptions>;
1139
+ }
1140
+ interface AthenaAuthServerConfig<TDatabase = unknown> extends AthenaAuthServerCookieOptions {
1141
+ baseURL?: AthenaAuthBaseURLConfig;
1142
+ basePath?: string;
1143
+ secret: string;
1144
+ database: TDatabase | AthenaAuthDatabaseFactory<TDatabase>;
1145
+ socialProviders?: Record<string, AthenaAuthSocialProviderConfig>;
1146
+ trustedOrigins?: AthenaAuthTrustedOrigins;
1147
+ trustedProviders?: AthenaAuthTrustedProviders;
1148
+ api?: Record<string, unknown>;
1149
+ errorCodes?: Record<string, string>;
1150
+ handler?: (ctx: AthenaAuthRequestContext) => AthenaMaybePromise<Response | AthenaAuthHandlerResult>;
1151
+ plugins?: AthenaAuthPlugin[];
1152
+ }
1153
+ type ResolveAthenaAuthDatabase<TConfig extends AthenaAuthServerConfig> = TConfig['database'] extends (...args: never[]) => infer TResult ? TResult : TConfig['database'];
1154
+ interface AthenaAuthRequestContext<TConfig extends AthenaAuthServerConfig = AthenaAuthServerConfig> {
1155
+ auth: AthenaAuthServer<TConfig>;
1156
+ request: Request;
1157
+ url: URL;
1158
+ path: string;
1159
+ basePath: string;
1160
+ baseURL: string;
1161
+ origin: string;
1162
+ headers: Headers;
1163
+ cookies: AthenaAuthCookies;
1164
+ trustedOrigins: string[];
1165
+ trustedProviders: string[];
1166
+ options: TConfig;
1167
+ runtime: AthenaAuthServerRuntimeOptions;
1168
+ database: ResolveAthenaAuthDatabase<TConfig>;
1169
+ socialProviders: NonNullable<TConfig['socialProviders']>;
1170
+ }
1171
+ interface AthenaAuthContext<TConfig extends AthenaAuthServerConfig = AthenaAuthServerConfig> {
1172
+ auth: AthenaAuthServer<TConfig>;
1173
+ options: TConfig;
1174
+ runtime: AthenaAuthServerRuntimeOptions;
1175
+ basePath: string;
1176
+ baseURL?: string;
1177
+ origin?: string;
1178
+ database: ResolveAthenaAuthDatabase<TConfig>;
1179
+ socialProviders: NonNullable<TConfig['socialProviders']>;
1180
+ plugins: AthenaAuthPlugin[];
1181
+ cookies: AthenaAuthCookies;
1182
+ trustedOrigins: string[];
1183
+ trustedProviders: string[];
1184
+ }
1185
+ interface AthenaAuthServerApi<TConfig extends AthenaAuthServerConfig = AthenaAuthServerConfig> {
1186
+ applyResponseCookies: AthenaAuthServer<TConfig>['applyResponseCookies'];
1187
+ clearSession: AthenaAuthServer<TConfig>['clearSession'];
1188
+ createCookieContext: AthenaAuthServer<TConfig>['createCookieContext'];
1189
+ getCookieCache: typeof getCookieCache;
1190
+ getSessionCookie: typeof getSessionCookie;
1191
+ resolveRequestContext: AthenaAuthServer<TConfig>['resolveRequestContext'];
1192
+ runAfterHooks: AthenaAuthServer<TConfig>['runAfterHooks'];
1193
+ setSession: AthenaAuthServer<TConfig>['setSession'];
1194
+ }
1195
+ interface AthenaAuthServer<TConfig extends AthenaAuthServerConfig = AthenaAuthServerConfig> {
1196
+ config: TConfig;
1197
+ options: TConfig;
1198
+ runtime: AthenaAuthServerRuntimeOptions;
1199
+ database: ResolveAthenaAuthDatabase<TConfig>;
1200
+ socialProviders: NonNullable<TConfig['socialProviders']>;
1201
+ plugins: AthenaAuthPlugin[];
1202
+ cookies: AthenaAuthCookies;
1203
+ api: AthenaAuthServerApi<TConfig> & Record<string, unknown>;
1204
+ $context: Promise<AthenaAuthContext<TConfig>>;
1205
+ $ERROR_CODES: Record<string, string>;
1206
+ createCookieContext: (input?: AthenaAuthCookieRuntimeInput) => AthenaCookieContextRuntime;
1207
+ setSession: (input: AthenaAuthCookieRuntimeInput | undefined, session: AthenaSessionPair, dontRememberMe?: boolean, overrides?: Partial<AthenaCookieOptions>) => Promise<void>;
1208
+ clearSession: (input?: AthenaAuthCookieRuntimeInput, skipDontRememberMe?: boolean) => void;
1209
+ applyResponseCookies: (ctx: AthenaAuthPluginContext) => Promise<Headers>;
1210
+ runAfterHooks: (ctx: AthenaAuthPluginContext) => Promise<AthenaAuthPluginContext>;
1211
+ resolveRequestContext: (request: Request) => Promise<AthenaAuthRequestContext<TConfig>>;
1212
+ handler: (request: Request) => Promise<Response>;
1213
+ }
1214
+ declare function defineAthenaAuthConfig<TConfig extends AthenaAuthServerConfig>(config: TConfig): TConfig;
1215
+ declare function athenaAuth<TConfig extends AthenaAuthServerConfig>(config: TConfig): AthenaAuthServer<TConfig>;
1216
+
644
1217
  interface AthenaAuthRenderedReactEmail {
645
1218
  html: string;
646
1219
  text?: string;
@@ -654,4 +1227,4 @@ declare function createAuthReactEmailInput<TProps extends AthenaAuthReactEmailPr
654
1227
  declare function defineAuthEmailTemplate<TProps extends AthenaAuthReactEmailProps = AthenaAuthReactEmailProps>(definition: AthenaAuthEmailTemplateDefinition<TProps>): AthenaAuthEmailTemplateBuilder<TProps>;
655
1228
  declare function renderAthenaReactEmail(input: AthenaAuthReactEmailRenderInput, options?: AthenaAuthReactEmailRuntimeOptions | AthenaAuthReactEmailConfig): Promise<AthenaAuthRenderedReactEmail>;
656
1229
 
657
- export { isOk as $, AthenaClient as A, type RetryConfig as B, type RpcOrderOptions as C, DEFAULT_POSTGRES_SCHEMAS as D, type RpcQueryBuilder as E, type TypedAthenaClient as F, type TypedClientOptions as G, type UnwrapOptions as H, type IntCoercionOptions as I, assertInt as J, coerceInt as K, createAuthClient as L, createAuthReactEmailInput as M, type NormalizedAthenaError as N, createClient as O, type PostgresIntrospectionProviderOptions as P, createPostgresIntrospectionProvider as Q, type RequireAffectedOptions as R, createTypedClient as S, type TableQueryBuilder as T, type UnwrapOneOptions as U, defineAuthEmailTemplate as V, defineDatabase as W, defineModel as X, defineRegistry as Y, defineSchema as Z, identifier as _, type AthenaClientExperimentalOptions as a, normalizeAthenaError as a0, normalizeAthenaGatewayBaseUrl as a1, normalizeSchemaSelection as a2, parseBooleanFlag as a3, renderAthenaReactEmail as a4, requireAffected as a5, requireSuccess as a6, resolvePostgresColumnType as a7, resolveProviderSchemas as a8, unwrap as a9, unwrapOne as aa, unwrapRows as ab, verifyAthenaGatewayUrl as ac, withRetry as ad, type AthenaCreateClientOptions as b, type AthenaDbModule as c, AthenaError as d, AthenaErrorCategory as e, AthenaErrorCode as f, type AthenaErrorInput as g, AthenaErrorKind as h, type AthenaFindManyOptions as i, type AthenaFindManyResult as j, type AthenaFromOptions as k, type AthenaOperationContext as l, type AthenaOrderBy as m, type AthenaQueryTraceCallsite as n, type AthenaQueryTraceEvent as o, type AthenaQueryTraceOptions as p, type AthenaRelationSelectNode as q, type AthenaResult as r, type AthenaResultError as s, type AthenaSdkClient as t, type AthenaSdkClientWithAuth as u, type AthenaSelectShape as v, type AthenaWhere as w, type AthenaWhereBooleanOperand as x, type AthenaWhereOperatorInput as y, type RetryBackoffStrategy as z };
1230
+ export { type AthenaWhere as $, ATHENA_AUTH_BASE_ERROR_CODES as A, type AthenaErrorInput as B, AthenaErrorKind as C, type AthenaFindManyOptions as D, type AthenaFindManyResult as E, type AthenaFromOptions as F, type AthenaOperationContext as G, type AthenaOrderBy as H, type AthenaQueryTraceCallsite as I, type AthenaQueryTraceEvent as J, type AthenaQueryTraceOptions as K, type AthenaRelationSelectNode as L, type AthenaResult as M, type AthenaResultError as N, type AthenaSdkClient as O, type AthenaSdkClientWithAuth as P, type AthenaSdkClientWithStorage as Q, type AthenaSelectShape as R, type AthenaStorageBinaryCallOptions as S, type AthenaStorageCallOptions as T, type AthenaStorageClientConfig as U, AthenaStorageError as V, AthenaStorageErrorCode as W, type AthenaStorageErrorDetails as X, type AthenaStorageErrorHandler as Y, type AthenaStorageErrorInput as Z, type AthenaStorageModule as _, type AthenaAuthBaseURLConfig as a, renderAthenaReactEmail as a$, type AthenaWhereBooleanOperand as a0, type AthenaWhereOperatorInput as a1, type CreateStorageCatalogRequest as a2, type CreateStorageUploadUrlRequest as a3, type CreateStorageUploadUrlsRequest as a4, DEFAULT_POSTGRES_SCHEMAS as a5, type DeleteStorageFolderRequest as a6, type GeneratorEnvBooleanOptions as a7, type GeneratorEnvJsonOptions as a8, type GeneratorEnvListOptions as a9, type TypedClientOptions as aA, type UnwrapOneOptions as aB, type UnwrapOptions as aC, type UpdateStorageCatalogRequest as aD, type UpdateStorageFileRequest as aE, assertInt as aF, athenaAuth as aG, coerceInt as aH, createAthenaStorageError as aI, createAuthClient as aJ, createAuthReactEmailInput as aK, createClient as aL, createPostgresIntrospectionProvider as aM, createTypedClient as aN, defineAthenaAuthConfig as aO, defineAuthEmailTemplate as aP, defineDatabase as aQ, defineModel as aR, defineRegistry as aS, defineSchema as aT, generatorEnv as aU, identifier as aV, isOk as aW, normalizeAthenaError as aX, normalizeAthenaGatewayBaseUrl as aY, normalizeSchemaSelection as aZ, parseBooleanFlag as a_, type GeneratorEnvOneOfOptions as aa, type GeneratorEnvStringOptions as ab, type GetStorageFileUrlQuery as ac, type IntCoercionOptions as ad, type ListStorageFilesRequest as ae, type ManagedFileRecord as af, type MoveStorageFolderRequest as ag, type NormalizedAthenaError as ah, type PostgresIntrospectionProviderOptions as ai, type PresignedFileUrlResponse as aj, type RequireAffectedOptions as ak, type RetryBackoffStrategy as al, type RetryConfig as am, type RpcOrderOptions as an, type RpcQueryBuilder as ao, type S3CatalogItem as ap, type S3CredentialListItem as aq, type SetStorageFileVisibilityRequest as ar, type StorageBatchUploadUrlResponse as as, type StorageFileAccessPurpose as at, type StorageFileMutationResponse as au, type StorageFolderMutationResponse as av, type StorageListFilesResponse as aw, type StorageUploadUrlResponse as ax, type TableQueryBuilder as ay, type TypedAthenaClient as az, type AthenaAuthContext as b, requireAffected as b0, requireSuccess as b1, resolvePostgresColumnType as b2, resolveProviderSchemas as b3, storageSdkManifest as b4, unwrap as b5, unwrapOne as b6, unwrapRows as b7, verifyAthenaGatewayUrl as b8, withRetry as b9, type AthenaAuthCookieRuntimeInput as c, type AthenaAuthDatabaseFactory as d, type AthenaAuthHandlerResult as e, type AthenaAuthPlugin as f, type AthenaAuthPluginContext as g, type AthenaAuthPluginHandlerContext as h, type AthenaAuthRequestContext as i, type AthenaAuthServer as j, type AthenaAuthServerApi as k, type AthenaAuthServerConfig as l, type AthenaAuthServerRuntimeOptions as m, type AthenaAuthSocialProviderConfig as n, type AthenaAuthTrustedOrigins as o, type AthenaAuthTrustedProviders as p, AthenaClient as q, type AthenaClientBuilder as r, type AthenaClientExperimentalOptions as s, type AthenaCreateClientOptions as t, type AthenaCreateClientOptionsWithStorage as u, type AthenaDbModule as v, type AthenaEnvelope as w, AthenaError as x, AthenaErrorCategory as y, AthenaErrorCode as z };