@xylex-group/athena 3.1.0 → 3.5.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.
Files changed (100) hide show
  1. package/README.md +17 -1
  2. package/dist/admin.cjs +55 -1
  3. package/dist/admin.cjs.map +1 -1
  4. package/dist/admin.d.cts +32 -8
  5. package/dist/admin.d.ts +32 -8
  6. package/dist/admin.js +54 -2
  7. package/dist/admin.js.map +1 -1
  8. package/dist/athena-auth-url-C1FbVmN6.d.cts +200 -0
  9. package/dist/athena-auth-url-C1FbVmN6.d.ts +200 -0
  10. package/dist/{athena-request-headers-C7Jy-c_D.d.ts → athena-request-headers-BnFN2mbd.d.cts} +49 -201
  11. package/dist/{athena-request-headers-DujFFyMU.d.cts → athena-request-headers-Dwdkq2WR.d.ts} +49 -201
  12. package/dist/billing.cjs +1 -1
  13. package/dist/billing.cjs.map +1 -1
  14. package/dist/billing.js +1 -1
  15. package/dist/billing.js.map +1 -1
  16. package/dist/browser.cjs +3735 -248
  17. package/dist/browser.cjs.map +1 -1
  18. package/dist/browser.d.cts +11 -10
  19. package/dist/browser.d.ts +11 -10
  20. package/dist/browser.js +3726 -249
  21. package/dist/browser.js.map +1 -1
  22. package/dist/cli/index.cjs +3232 -190
  23. package/dist/cli/index.cjs.map +1 -1
  24. package/dist/cli/index.d.cts +4 -4
  25. package/dist/cli/index.d.ts +4 -4
  26. package/dist/cli/index.js +3232 -190
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/cloudflare.cjs +12914 -0
  29. package/dist/cloudflare.cjs.map +1 -0
  30. package/dist/cloudflare.d.cts +368 -0
  31. package/dist/cloudflare.d.ts +368 -0
  32. package/dist/cloudflare.js +12885 -0
  33. package/dist/cloudflare.js.map +1 -0
  34. package/dist/cookies.cjs +4 -3
  35. package/dist/cookies.cjs.map +1 -1
  36. package/dist/cookies.js +4 -3
  37. package/dist/cookies.js.map +1 -1
  38. package/dist/env.cjs +130 -0
  39. package/dist/env.cjs.map +1 -0
  40. package/dist/env.d.cts +70 -0
  41. package/dist/env.d.ts +70 -0
  42. package/dist/env.js +122 -0
  43. package/dist/env.js.map +1 -0
  44. package/dist/index.cjs +3749 -241
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.cts +11 -10
  47. package/dist/index.d.ts +11 -10
  48. package/dist/index.js +3739 -242
  49. package/dist/index.js.map +1 -1
  50. package/dist/{model-form-BhWWsA-7.d.cts → model-form-D0ykVVOs.d.cts} +26 -4
  51. package/dist/{model-form-BbdzJ9Uh.d.ts → model-form-U8NVtfSA.d.ts} +26 -4
  52. package/dist/{module-xFd7_Igv.d.cts → module-CMWlJ1z3.d.cts} +5 -5
  53. package/dist/{module-DKkJKOuJ.d.ts → module-CZ-wPcf2.d.ts} +5 -5
  54. package/dist/next/client.cjs +3212 -196
  55. package/dist/next/client.cjs.map +1 -1
  56. package/dist/next/client.d.cts +6 -5
  57. package/dist/next/client.d.ts +6 -5
  58. package/dist/next/client.js +3212 -196
  59. package/dist/next/client.js.map +1 -1
  60. package/dist/next/server.cjs +4461 -781
  61. package/dist/next/server.cjs.map +1 -1
  62. package/dist/next/server.d.cts +139 -13
  63. package/dist/next/server.d.ts +139 -13
  64. package/dist/next/server.js +4451 -782
  65. package/dist/next/server.js.map +1 -1
  66. package/dist/{pipeline-DuKzYGia.d.cts → pipeline-BCpb4BX1.d.cts} +1 -1
  67. package/dist/{pipeline-wer2G9xW.d.ts → pipeline-CgmXwMeX.d.ts} +1 -1
  68. package/dist/{proxy-request-headers-m4D2Tduy.d.ts → proxy-request-headers-CttlcuRb.d.ts} +1 -1
  69. package/dist/{proxy-request-headers-DGxdoyA0.d.cts → proxy-request-headers-pIBSn1Fw.d.cts} +1 -1
  70. package/dist/react.cjs +290 -31
  71. package/dist/react.cjs.map +1 -1
  72. package/dist/react.d.cts +62 -12
  73. package/dist/react.d.ts +62 -12
  74. package/dist/react.js +290 -32
  75. package/dist/react.js.map +1 -1
  76. package/dist/schema-handlers-CvWqF-dW.d.ts +138 -0
  77. package/dist/schema-handlers-Dr8h9Jg-.d.cts +138 -0
  78. package/dist/social-providers.cjs +1 -1
  79. package/dist/social-providers.cjs.map +1 -1
  80. package/dist/social-providers.d.cts +1 -1
  81. package/dist/social-providers.d.ts +1 -1
  82. package/dist/social-providers.js +1 -1
  83. package/dist/social-providers.js.map +1 -1
  84. package/dist/{types-Bltx6iL6.d.ts → types-B2RZPivM.d.cts} +8 -1
  85. package/dist/{types-Bltx6iL6.d.cts → types-B2RZPivM.d.ts} +8 -1
  86. package/dist/{types-1ztXDgPa.d.cts → types-BKklrX4J.d.ts} +14 -2
  87. package/dist/{types-AOY-GLu8.d.cts → types-BVKpQmfY.d.cts} +11 -0
  88. package/dist/{types-AOY-GLu8.d.ts → types-BVKpQmfY.d.ts} +11 -0
  89. package/dist/{types-CgCv5o6R.d.cts → types-D5dj1v5Z.d.cts} +1 -1
  90. package/dist/{types-CccOiXPo.d.ts → types-DqBFwfhn.d.cts} +14 -2
  91. package/dist/{types-B75PdABb.d.ts → types-S-bTMPiM.d.ts} +1 -1
  92. package/dist/utils.cjs +30 -0
  93. package/dist/utils.cjs.map +1 -1
  94. package/dist/utils.d.cts +4 -3
  95. package/dist/utils.d.ts +4 -3
  96. package/dist/utils.js +30 -1
  97. package/dist/utils.js.map +1 -1
  98. package/dist/{v3-client-CWfZHcKL.d.cts → v3-client-DP-qg82X.d.cts} +323 -5
  99. package/dist/{v3-client-DZp2NEhK.d.ts → v3-client-OAai_JNs.d.ts} +323 -5
  100. package/package.json +25 -4
package/dist/react.d.cts CHANGED
@@ -1,13 +1,14 @@
1
- import { u as AthenaGatewayHookConfig, v as AthenaGatewayHookResult } from './types-Bltx6iL6.cjs';
2
- export { w as AthenaDeletePayload, x as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, s as AthenaGatewayResponse, y as AthenaInsertPayload, f as AthenaJsonArray, g as AthenaJsonObject, h as AthenaJsonPrimitive, i as AthenaJsonValue, j as AthenaRpcCallOptions, k as AthenaRpcFilter, l as AthenaRpcFilterOperator, m as AthenaRpcOrder, n as AthenaRpcPayload, z as AthenaUpdatePayload } from './types-Bltx6iL6.cjs';
3
- import { a as AthenaReadQueryClient, c as AthenaReadQueryDefinition, e as AthenaReadQueryExecutionResult, i as AthenaReadQueryFlatRow } from './model-form-BhWWsA-7.cjs';
4
- export { A as AthenaGatewayError, M as ModelFormAdapter, D as ModelFormDefaults, E as ModelFormNullishMode, G as ModelFormValues, T as ToModelFormDefaultsOptions, H as ToModelPayloadOptions, _ as createModelFormAdapter, a3 as isAthenaGatewayError, a6 as toModelFormDefaults, a7 as toModelPayload } from './model-form-BhWWsA-7.cjs';
1
+ import { y as AthenaGatewayHookConfig, z as AthenaGatewayHookResult } from './types-B2RZPivM.cjs';
2
+ export { v as AthenaDeletePayload, u as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, s as AthenaGatewayResponse, w as AthenaInsertPayload, f as AthenaJsonArray, g as AthenaJsonObject, h as AthenaJsonPrimitive, i as AthenaJsonValue, j as AthenaRpcCallOptions, k as AthenaRpcFilter, l as AthenaRpcFilterOperator, m as AthenaRpcOrder, n as AthenaRpcPayload, x as AthenaUpdatePayload } from './types-B2RZPivM.cjs';
3
+ import { a as AthenaReadQueryClient, c as AthenaReadQueryDefinition, e as AthenaReadQueryExecutionResult, i as AthenaReadQueryFlatRow } from './model-form-D0ykVVOs.cjs';
4
+ export { A as AthenaGatewayError, M as ModelFormAdapter, D as ModelFormDefaults, E as ModelFormNullishMode, G as ModelFormValues, T as ToModelFormDefaultsOptions, H as ToModelPayloadOptions, _ as createModelFormAdapter, a3 as isAthenaGatewayError, a7 as toModelFormDefaults, a8 as toModelPayload } from './model-form-D0ykVVOs.cjs';
5
5
  import * as react from 'react';
6
6
  import { ReactNode } from 'react';
7
- import { aE as AthenaAuthFetchCompatibleInput, E as AthenaAuthCallOptions, ad as AthenaAuthSessionResponse, R as AthenaAuthErrorDetails, aa as AthenaAuthResult } from './types-AOY-GLu8.cjs';
8
- export { D as AthenaAuthBindings, aC as AuthBindings } from './types-AOY-GLu8.cjs';
9
- import { ax as AthenaRequestContext, b5 as AthenaStorageFileUploadInput, bp as AthenaStorageUploadSource, bb as AthenaStorageModule, bo as AthenaStorageUploadProgressHandler, bn as AthenaStorageUploadProgress, b8 as AthenaStorageFileUploadResult, aP as AthenaStorageCallOptions, b2 as AthenaStorageFileListInput, ck as StorageListFilesResponse, cf as StorageFileMutationResponse } from './v3-client-CWfZHcKL.cjs';
10
- import './types-CgCv5o6R.cjs';
7
+ import { aE as AthenaAuthFetchCompatibleInput, E as AthenaAuthCallOptions, ad as AthenaAuthSessionResponse, R as AthenaAuthErrorDetails, aa as AthenaAuthResult, aD as AthenaAdminHasPermissionRequest } from './types-BVKpQmfY.cjs';
8
+ export { D as AthenaAuthBindings, aC as AuthBindings } from './types-BVKpQmfY.cjs';
9
+ import { AthenaAdminSessionLike, AthenaAdminPermissionCheckInput } from './admin.cjs';
10
+ import { aA as AthenaRequestContext, b8 as AthenaStorageFileUploadInput, bs as AthenaStorageUploadSource, be as AthenaStorageModule, br as AthenaStorageUploadProgressHandler, bq as AthenaStorageUploadProgress, bb as AthenaStorageFileUploadResult, aS as AthenaStorageCallOptions, b5 as AthenaStorageFileListInput, cn as StorageListFilesResponse, ci as StorageFileMutationResponse } from './v3-client-DP-qg82X.cjs';
11
+ import './types-D5dj1v5Z.cjs';
11
12
  import './module-C_ab-MM1.cjs';
12
13
 
13
14
  declare function useAthenaGateway(config?: AthenaGatewayHookConfig): AthenaGatewayHookResult;
@@ -230,9 +231,9 @@ declare function createAthenaQueryClient(config?: AthenaQueryClientConfig): Athe
230
231
  declare function attachStateAdapter(client: AthenaQueryClient, adapter: AthenaStateAdapter): AthenaUnsubscribe;
231
232
 
232
233
  interface AthenaQueryClientProviderProps {
234
+ children: ReactNode;
233
235
  client?: AthenaQueryClient;
234
236
  config?: AthenaQueryClientConfig;
235
- children: ReactNode;
236
237
  }
237
238
  declare function AthenaQueryClientProvider(props: AthenaQueryClientProviderProps): react.FunctionComponentElement<react.ProviderProps<AthenaQueryClient | null>>;
238
239
  declare function useAthenaQueryClient(): AthenaQueryClient;
@@ -354,6 +355,55 @@ type InferSessionData$1<TClient> = TClient extends {
354
355
  */
355
356
  declare function useSession<TClient extends UseSessionAuthClient>(authClient: TClient, options?: UseSessionOptions): UseSessionResult<InferSessionData$1<TClient>>;
356
357
 
358
+ interface UseAdminPermissionOptions {
359
+ /**
360
+ * Permission set checked via `client.auth.admin.hasPermission`.
361
+ * Defaults to `["admin:read"]`.
362
+ */
363
+ permissions?: AthenaAdminHasPermissionRequest['permissions'];
364
+ permission?: AthenaAdminHasPermissionRequest['permission'];
365
+ /**
366
+ * When provided, skips the internal session fetch.
367
+ * Pass `null` to force a denied result without calling getSession.
368
+ */
369
+ session?: AthenaAdminSessionLike | null;
370
+ allowRoleBypass?: boolean;
371
+ enabled?: boolean;
372
+ fetchOptions?: AthenaAdminPermissionCheckInput['fetchOptions'];
373
+ requestOptions?: AthenaAdminPermissionCheckInput['requestOptions'];
374
+ /** Forwarded to the internal `useSession` when `session` is omitted. */
375
+ sessionOptions?: Omit<UseSessionOptions, 'enabled'>;
376
+ }
377
+ interface UseAdminPermissionResult {
378
+ allowed: boolean;
379
+ isPending: boolean;
380
+ error: Error | null;
381
+ session: AthenaAdminSessionLike | null;
382
+ refetch: () => Promise<boolean>;
383
+ }
384
+ type AdminPermissionAuthClient = UseSessionAuthClient & {
385
+ auth?: {
386
+ admin?: unknown;
387
+ };
388
+ admin?: unknown;
389
+ };
390
+ /**
391
+ * React gate for Athena admin permissions.
392
+ *
393
+ * Uses {@link hasAdminPermission} from `@xylex-group/athena/admin` with an
394
+ * optional local `admin` role short-circuit. When `session` is omitted, loads
395
+ * the current session through {@link useSession}.
396
+ *
397
+ * @example
398
+ * ```tsx
399
+ * const athena = createClient({ url, key, auth: { url: "/api/auth" } })
400
+ * const { allowed, isPending } = useAdminPermission(athena, {
401
+ * permissions: ["admin:read"],
402
+ * })
403
+ * ```
404
+ */
405
+ declare function useAdminPermission(client: AdminPermissionAuthClient | null | undefined, options?: UseAdminPermissionOptions): UseAdminPermissionResult;
406
+
357
407
  type SessionGetter<TSessionData extends AthenaAuthSessionResponse> = (input?: AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<TSessionData>>;
358
408
  type AthenaContextScopedClient<TSessionData extends AthenaAuthSessionResponse = AthenaAuthSessionResponse> = {
359
409
  auth: {
@@ -400,14 +450,14 @@ interface UseStorageUploadResult {
400
450
  declare function useStorageUpload(options: UseStorageUploadOptions): UseStorageUploadResult;
401
451
 
402
452
  interface UseStorageFilesOptions {
403
- storage: Pick<AthenaStorageModule, 'file'>;
453
+ storage: Pick<AthenaStorageModule, "file">;
404
454
  input: AthenaStorageFileListInput | null | undefined;
405
455
  enabled?: boolean;
406
456
  callOptions?: AthenaStorageCallOptions;
407
457
  refreshIntervalMs?: number;
408
458
  }
409
459
  interface UseStorageFilesResult {
410
- files: StorageListFilesResponse['files'];
460
+ files: StorageListFilesResponse["files"];
411
461
  count: number;
412
462
  loading: boolean;
413
463
  error: unknown;
@@ -429,4 +479,4 @@ interface UseStorageFileDeleteResult {
429
479
  }
430
480
  declare function useStorageFileDelete(options: UseStorageFileDeleteOptions): UseStorageFileDeleteResult;
431
481
 
432
- export { type AthenaCacheMode, type AthenaCachePolicy, AthenaGatewayHookConfig, AthenaGatewayHookResult, type AthenaMutationDefaults, type AthenaMutationEvent, type AthenaMutationRequestLog, type AthenaMutationResultData, type AthenaMutationState, AthenaQueryClient, type AthenaQueryClientConfig, AthenaQueryClientProvider, type AthenaQueryDefaults, type AthenaQueryError, type AthenaQueryEvent, type AthenaQueryRequestLog, type AthenaQueryResult, type AthenaQueryState, type AthenaResponseLike, type AthenaRetryCount, type AthenaRetryDelay, type AthenaRuntimeBaseEvent, type AthenaRuntimeEvent, type AthenaRuntimeEventType, type AthenaStateAdapter, type AthenaUnsubscribe, type QueryKey, type QueryStatus, type UseAthenaReadQueryOptions, type UseAthenaReadQueryResult, type UseAthenaSessionClientOptions, type UseAthenaSessionClientResult, type UseMutationOptions, type UseMutationResult, type UseQueryOptions, type UseQueryResult, type UseSessionAuthClient, type UseSessionOptions, type UseSessionResult, type UseStorageFileDeleteOptions, type UseStorageFileDeleteResult, type UseStorageFilesOptions, type UseStorageFilesResult, type UseStorageUploadInput, type UseStorageUploadOptions, type UseStorageUploadResult, attachStateAdapter, createAthenaQueryClient, useAthenaGateway, useAthenaQueryClient, useAthenaReadQuery, useAthenaSessionClient, useMutation, useQuery, useSession, useStorageFileDelete, useStorageFiles, useStorageUpload };
482
+ export { type AthenaCacheMode, type AthenaCachePolicy, AthenaGatewayHookConfig, AthenaGatewayHookResult, type AthenaMutationDefaults, type AthenaMutationEvent, type AthenaMutationRequestLog, type AthenaMutationResultData, type AthenaMutationState, AthenaQueryClient, type AthenaQueryClientConfig, AthenaQueryClientProvider, type AthenaQueryDefaults, type AthenaQueryError, type AthenaQueryEvent, type AthenaQueryRequestLog, type AthenaQueryResult, type AthenaQueryState, type AthenaResponseLike, type AthenaRetryCount, type AthenaRetryDelay, type AthenaRuntimeBaseEvent, type AthenaRuntimeEvent, type AthenaRuntimeEventType, type AthenaStateAdapter, type AthenaUnsubscribe, type QueryKey, type QueryStatus, type UseAdminPermissionOptions, type UseAdminPermissionResult, type UseAthenaReadQueryOptions, type UseAthenaReadQueryResult, type UseAthenaSessionClientOptions, type UseAthenaSessionClientResult, type UseMutationOptions, type UseMutationResult, type UseQueryOptions, type UseQueryResult, type UseSessionAuthClient, type UseSessionOptions, type UseSessionResult, type UseStorageFileDeleteOptions, type UseStorageFileDeleteResult, type UseStorageFilesOptions, type UseStorageFilesResult, type UseStorageUploadInput, type UseStorageUploadOptions, type UseStorageUploadResult, attachStateAdapter, createAthenaQueryClient, useAdminPermission, useAthenaGateway, useAthenaQueryClient, useAthenaReadQuery, useAthenaSessionClient, useMutation, useQuery, useSession, useStorageFileDelete, useStorageFiles, useStorageUpload };
package/dist/react.d.ts CHANGED
@@ -1,13 +1,14 @@
1
- import { u as AthenaGatewayHookConfig, v as AthenaGatewayHookResult } from './types-Bltx6iL6.js';
2
- export { w as AthenaDeletePayload, x as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, s as AthenaGatewayResponse, y as AthenaInsertPayload, f as AthenaJsonArray, g as AthenaJsonObject, h as AthenaJsonPrimitive, i as AthenaJsonValue, j as AthenaRpcCallOptions, k as AthenaRpcFilter, l as AthenaRpcFilterOperator, m as AthenaRpcOrder, n as AthenaRpcPayload, z as AthenaUpdatePayload } from './types-Bltx6iL6.js';
3
- import { a as AthenaReadQueryClient, c as AthenaReadQueryDefinition, e as AthenaReadQueryExecutionResult, i as AthenaReadQueryFlatRow } from './model-form-BbdzJ9Uh.js';
4
- export { A as AthenaGatewayError, M as ModelFormAdapter, D as ModelFormDefaults, E as ModelFormNullishMode, G as ModelFormValues, T as ToModelFormDefaultsOptions, H as ToModelPayloadOptions, _ as createModelFormAdapter, a3 as isAthenaGatewayError, a6 as toModelFormDefaults, a7 as toModelPayload } from './model-form-BbdzJ9Uh.js';
1
+ import { y as AthenaGatewayHookConfig, z as AthenaGatewayHookResult } from './types-B2RZPivM.js';
2
+ export { v as AthenaDeletePayload, u as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, s as AthenaGatewayResponse, w as AthenaInsertPayload, f as AthenaJsonArray, g as AthenaJsonObject, h as AthenaJsonPrimitive, i as AthenaJsonValue, j as AthenaRpcCallOptions, k as AthenaRpcFilter, l as AthenaRpcFilterOperator, m as AthenaRpcOrder, n as AthenaRpcPayload, x as AthenaUpdatePayload } from './types-B2RZPivM.js';
3
+ import { a as AthenaReadQueryClient, c as AthenaReadQueryDefinition, e as AthenaReadQueryExecutionResult, i as AthenaReadQueryFlatRow } from './model-form-U8NVtfSA.js';
4
+ export { A as AthenaGatewayError, M as ModelFormAdapter, D as ModelFormDefaults, E as ModelFormNullishMode, G as ModelFormValues, T as ToModelFormDefaultsOptions, H as ToModelPayloadOptions, _ as createModelFormAdapter, a3 as isAthenaGatewayError, a7 as toModelFormDefaults, a8 as toModelPayload } from './model-form-U8NVtfSA.js';
5
5
  import * as react from 'react';
6
6
  import { ReactNode } from 'react';
7
- import { aE as AthenaAuthFetchCompatibleInput, E as AthenaAuthCallOptions, ad as AthenaAuthSessionResponse, R as AthenaAuthErrorDetails, aa as AthenaAuthResult } from './types-AOY-GLu8.js';
8
- export { D as AthenaAuthBindings, aC as AuthBindings } from './types-AOY-GLu8.js';
9
- import { ax as AthenaRequestContext, b5 as AthenaStorageFileUploadInput, bp as AthenaStorageUploadSource, bb as AthenaStorageModule, bo as AthenaStorageUploadProgressHandler, bn as AthenaStorageUploadProgress, b8 as AthenaStorageFileUploadResult, aP as AthenaStorageCallOptions, b2 as AthenaStorageFileListInput, ck as StorageListFilesResponse, cf as StorageFileMutationResponse } from './v3-client-DZp2NEhK.js';
10
- import './types-B75PdABb.js';
7
+ import { aE as AthenaAuthFetchCompatibleInput, E as AthenaAuthCallOptions, ad as AthenaAuthSessionResponse, R as AthenaAuthErrorDetails, aa as AthenaAuthResult, aD as AthenaAdminHasPermissionRequest } from './types-BVKpQmfY.js';
8
+ export { D as AthenaAuthBindings, aC as AuthBindings } from './types-BVKpQmfY.js';
9
+ import { AthenaAdminSessionLike, AthenaAdminPermissionCheckInput } from './admin.js';
10
+ import { aA as AthenaRequestContext, b8 as AthenaStorageFileUploadInput, bs as AthenaStorageUploadSource, be as AthenaStorageModule, br as AthenaStorageUploadProgressHandler, bq as AthenaStorageUploadProgress, bb as AthenaStorageFileUploadResult, aS as AthenaStorageCallOptions, b5 as AthenaStorageFileListInput, cn as StorageListFilesResponse, ci as StorageFileMutationResponse } from './v3-client-OAai_JNs.js';
11
+ import './types-S-bTMPiM.js';
11
12
  import './module-C_ab-MM1.js';
12
13
 
13
14
  declare function useAthenaGateway(config?: AthenaGatewayHookConfig): AthenaGatewayHookResult;
@@ -230,9 +231,9 @@ declare function createAthenaQueryClient(config?: AthenaQueryClientConfig): Athe
230
231
  declare function attachStateAdapter(client: AthenaQueryClient, adapter: AthenaStateAdapter): AthenaUnsubscribe;
231
232
 
232
233
  interface AthenaQueryClientProviderProps {
234
+ children: ReactNode;
233
235
  client?: AthenaQueryClient;
234
236
  config?: AthenaQueryClientConfig;
235
- children: ReactNode;
236
237
  }
237
238
  declare function AthenaQueryClientProvider(props: AthenaQueryClientProviderProps): react.FunctionComponentElement<react.ProviderProps<AthenaQueryClient | null>>;
238
239
  declare function useAthenaQueryClient(): AthenaQueryClient;
@@ -354,6 +355,55 @@ type InferSessionData$1<TClient> = TClient extends {
354
355
  */
355
356
  declare function useSession<TClient extends UseSessionAuthClient>(authClient: TClient, options?: UseSessionOptions): UseSessionResult<InferSessionData$1<TClient>>;
356
357
 
358
+ interface UseAdminPermissionOptions {
359
+ /**
360
+ * Permission set checked via `client.auth.admin.hasPermission`.
361
+ * Defaults to `["admin:read"]`.
362
+ */
363
+ permissions?: AthenaAdminHasPermissionRequest['permissions'];
364
+ permission?: AthenaAdminHasPermissionRequest['permission'];
365
+ /**
366
+ * When provided, skips the internal session fetch.
367
+ * Pass `null` to force a denied result without calling getSession.
368
+ */
369
+ session?: AthenaAdminSessionLike | null;
370
+ allowRoleBypass?: boolean;
371
+ enabled?: boolean;
372
+ fetchOptions?: AthenaAdminPermissionCheckInput['fetchOptions'];
373
+ requestOptions?: AthenaAdminPermissionCheckInput['requestOptions'];
374
+ /** Forwarded to the internal `useSession` when `session` is omitted. */
375
+ sessionOptions?: Omit<UseSessionOptions, 'enabled'>;
376
+ }
377
+ interface UseAdminPermissionResult {
378
+ allowed: boolean;
379
+ isPending: boolean;
380
+ error: Error | null;
381
+ session: AthenaAdminSessionLike | null;
382
+ refetch: () => Promise<boolean>;
383
+ }
384
+ type AdminPermissionAuthClient = UseSessionAuthClient & {
385
+ auth?: {
386
+ admin?: unknown;
387
+ };
388
+ admin?: unknown;
389
+ };
390
+ /**
391
+ * React gate for Athena admin permissions.
392
+ *
393
+ * Uses {@link hasAdminPermission} from `@xylex-group/athena/admin` with an
394
+ * optional local `admin` role short-circuit. When `session` is omitted, loads
395
+ * the current session through {@link useSession}.
396
+ *
397
+ * @example
398
+ * ```tsx
399
+ * const athena = createClient({ url, key, auth: { url: "/api/auth" } })
400
+ * const { allowed, isPending } = useAdminPermission(athena, {
401
+ * permissions: ["admin:read"],
402
+ * })
403
+ * ```
404
+ */
405
+ declare function useAdminPermission(client: AdminPermissionAuthClient | null | undefined, options?: UseAdminPermissionOptions): UseAdminPermissionResult;
406
+
357
407
  type SessionGetter<TSessionData extends AthenaAuthSessionResponse> = (input?: AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<TSessionData>>;
358
408
  type AthenaContextScopedClient<TSessionData extends AthenaAuthSessionResponse = AthenaAuthSessionResponse> = {
359
409
  auth: {
@@ -400,14 +450,14 @@ interface UseStorageUploadResult {
400
450
  declare function useStorageUpload(options: UseStorageUploadOptions): UseStorageUploadResult;
401
451
 
402
452
  interface UseStorageFilesOptions {
403
- storage: Pick<AthenaStorageModule, 'file'>;
453
+ storage: Pick<AthenaStorageModule, "file">;
404
454
  input: AthenaStorageFileListInput | null | undefined;
405
455
  enabled?: boolean;
406
456
  callOptions?: AthenaStorageCallOptions;
407
457
  refreshIntervalMs?: number;
408
458
  }
409
459
  interface UseStorageFilesResult {
410
- files: StorageListFilesResponse['files'];
460
+ files: StorageListFilesResponse["files"];
411
461
  count: number;
412
462
  loading: boolean;
413
463
  error: unknown;
@@ -429,4 +479,4 @@ interface UseStorageFileDeleteResult {
429
479
  }
430
480
  declare function useStorageFileDelete(options: UseStorageFileDeleteOptions): UseStorageFileDeleteResult;
431
481
 
432
- export { type AthenaCacheMode, type AthenaCachePolicy, AthenaGatewayHookConfig, AthenaGatewayHookResult, type AthenaMutationDefaults, type AthenaMutationEvent, type AthenaMutationRequestLog, type AthenaMutationResultData, type AthenaMutationState, AthenaQueryClient, type AthenaQueryClientConfig, AthenaQueryClientProvider, type AthenaQueryDefaults, type AthenaQueryError, type AthenaQueryEvent, type AthenaQueryRequestLog, type AthenaQueryResult, type AthenaQueryState, type AthenaResponseLike, type AthenaRetryCount, type AthenaRetryDelay, type AthenaRuntimeBaseEvent, type AthenaRuntimeEvent, type AthenaRuntimeEventType, type AthenaStateAdapter, type AthenaUnsubscribe, type QueryKey, type QueryStatus, type UseAthenaReadQueryOptions, type UseAthenaReadQueryResult, type UseAthenaSessionClientOptions, type UseAthenaSessionClientResult, type UseMutationOptions, type UseMutationResult, type UseQueryOptions, type UseQueryResult, type UseSessionAuthClient, type UseSessionOptions, type UseSessionResult, type UseStorageFileDeleteOptions, type UseStorageFileDeleteResult, type UseStorageFilesOptions, type UseStorageFilesResult, type UseStorageUploadInput, type UseStorageUploadOptions, type UseStorageUploadResult, attachStateAdapter, createAthenaQueryClient, useAthenaGateway, useAthenaQueryClient, useAthenaReadQuery, useAthenaSessionClient, useMutation, useQuery, useSession, useStorageFileDelete, useStorageFiles, useStorageUpload };
482
+ export { type AthenaCacheMode, type AthenaCachePolicy, AthenaGatewayHookConfig, AthenaGatewayHookResult, type AthenaMutationDefaults, type AthenaMutationEvent, type AthenaMutationRequestLog, type AthenaMutationResultData, type AthenaMutationState, AthenaQueryClient, type AthenaQueryClientConfig, AthenaQueryClientProvider, type AthenaQueryDefaults, type AthenaQueryError, type AthenaQueryEvent, type AthenaQueryRequestLog, type AthenaQueryResult, type AthenaQueryState, type AthenaResponseLike, type AthenaRetryCount, type AthenaRetryDelay, type AthenaRuntimeBaseEvent, type AthenaRuntimeEvent, type AthenaRuntimeEventType, type AthenaStateAdapter, type AthenaUnsubscribe, type QueryKey, type QueryStatus, type UseAdminPermissionOptions, type UseAdminPermissionResult, type UseAthenaReadQueryOptions, type UseAthenaReadQueryResult, type UseAthenaSessionClientOptions, type UseAthenaSessionClientResult, type UseMutationOptions, type UseMutationResult, type UseQueryOptions, type UseQueryResult, type UseSessionAuthClient, type UseSessionOptions, type UseSessionResult, type UseStorageFileDeleteOptions, type UseStorageFileDeleteResult, type UseStorageFilesOptions, type UseStorageFilesResult, type UseStorageUploadInput, type UseStorageUploadOptions, type UseStorageUploadResult, attachStateAdapter, createAthenaQueryClient, useAdminPermission, useAthenaGateway, useAthenaQueryClient, useAthenaReadQuery, useAthenaSessionClient, useMutation, useQuery, useSession, useStorageFileDelete, useStorageFiles, useStorageUpload };