@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.
- package/README.md +17 -1
- package/dist/admin.cjs +55 -1
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +32 -8
- package/dist/admin.d.ts +32 -8
- package/dist/admin.js +54 -2
- package/dist/admin.js.map +1 -1
- package/dist/athena-auth-url-C1FbVmN6.d.cts +200 -0
- package/dist/athena-auth-url-C1FbVmN6.d.ts +200 -0
- package/dist/{athena-request-headers-C7Jy-c_D.d.ts → athena-request-headers-BnFN2mbd.d.cts} +49 -201
- package/dist/{athena-request-headers-DujFFyMU.d.cts → athena-request-headers-Dwdkq2WR.d.ts} +49 -201
- package/dist/billing.cjs +1 -1
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.js +1 -1
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +3735 -248
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +11 -10
- package/dist/browser.d.ts +11 -10
- package/dist/browser.js +3726 -249
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +3232 -190
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +4 -4
- package/dist/cli/index.d.ts +4 -4
- package/dist/cli/index.js +3232 -190
- package/dist/cli/index.js.map +1 -1
- package/dist/cloudflare.cjs +12914 -0
- package/dist/cloudflare.cjs.map +1 -0
- package/dist/cloudflare.d.cts +368 -0
- package/dist/cloudflare.d.ts +368 -0
- package/dist/cloudflare.js +12885 -0
- package/dist/cloudflare.js.map +1 -0
- package/dist/cookies.cjs +4 -3
- package/dist/cookies.cjs.map +1 -1
- package/dist/cookies.js +4 -3
- package/dist/cookies.js.map +1 -1
- package/dist/env.cjs +130 -0
- package/dist/env.cjs.map +1 -0
- package/dist/env.d.cts +70 -0
- package/dist/env.d.ts +70 -0
- package/dist/env.js +122 -0
- package/dist/env.js.map +1 -0
- package/dist/index.cjs +3749 -241
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -10
- package/dist/index.d.ts +11 -10
- package/dist/index.js +3739 -242
- package/dist/index.js.map +1 -1
- package/dist/{model-form-BhWWsA-7.d.cts → model-form-D0ykVVOs.d.cts} +26 -4
- package/dist/{model-form-BbdzJ9Uh.d.ts → model-form-U8NVtfSA.d.ts} +26 -4
- package/dist/{module-xFd7_Igv.d.cts → module-CMWlJ1z3.d.cts} +5 -5
- package/dist/{module-DKkJKOuJ.d.ts → module-CZ-wPcf2.d.ts} +5 -5
- package/dist/next/client.cjs +3212 -196
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +6 -5
- package/dist/next/client.d.ts +6 -5
- package/dist/next/client.js +3212 -196
- package/dist/next/client.js.map +1 -1
- package/dist/next/server.cjs +4461 -781
- package/dist/next/server.cjs.map +1 -1
- package/dist/next/server.d.cts +139 -13
- package/dist/next/server.d.ts +139 -13
- package/dist/next/server.js +4451 -782
- package/dist/next/server.js.map +1 -1
- package/dist/{pipeline-DuKzYGia.d.cts → pipeline-BCpb4BX1.d.cts} +1 -1
- package/dist/{pipeline-wer2G9xW.d.ts → pipeline-CgmXwMeX.d.ts} +1 -1
- package/dist/{proxy-request-headers-m4D2Tduy.d.ts → proxy-request-headers-CttlcuRb.d.ts} +1 -1
- package/dist/{proxy-request-headers-DGxdoyA0.d.cts → proxy-request-headers-pIBSn1Fw.d.cts} +1 -1
- package/dist/react.cjs +290 -31
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +62 -12
- package/dist/react.d.ts +62 -12
- package/dist/react.js +290 -32
- package/dist/react.js.map +1 -1
- package/dist/schema-handlers-CvWqF-dW.d.ts +138 -0
- package/dist/schema-handlers-Dr8h9Jg-.d.cts +138 -0
- package/dist/social-providers.cjs +1 -1
- package/dist/social-providers.cjs.map +1 -1
- package/dist/social-providers.d.cts +1 -1
- package/dist/social-providers.d.ts +1 -1
- package/dist/social-providers.js +1 -1
- package/dist/social-providers.js.map +1 -1
- package/dist/{types-Bltx6iL6.d.ts → types-B2RZPivM.d.cts} +8 -1
- package/dist/{types-Bltx6iL6.d.cts → types-B2RZPivM.d.ts} +8 -1
- package/dist/{types-1ztXDgPa.d.cts → types-BKklrX4J.d.ts} +14 -2
- package/dist/{types-AOY-GLu8.d.cts → types-BVKpQmfY.d.cts} +11 -0
- package/dist/{types-AOY-GLu8.d.ts → types-BVKpQmfY.d.ts} +11 -0
- package/dist/{types-CgCv5o6R.d.cts → types-D5dj1v5Z.d.cts} +1 -1
- package/dist/{types-CccOiXPo.d.ts → types-DqBFwfhn.d.cts} +14 -2
- package/dist/{types-B75PdABb.d.ts → types-S-bTMPiM.d.ts} +1 -1
- package/dist/utils.cjs +30 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +4 -3
- package/dist/utils.d.ts +4 -3
- package/dist/utils.js +30 -1
- package/dist/utils.js.map +1 -1
- package/dist/{v3-client-CWfZHcKL.d.cts → v3-client-DP-qg82X.d.cts} +323 -5
- package/dist/{v3-client-DZp2NEhK.d.ts → v3-client-OAai_JNs.d.ts} +323 -5
- package/package.json +25 -4
package/dist/react.d.cts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { a as AthenaReadQueryClient, c as AthenaReadQueryDefinition, e as AthenaReadQueryExecutionResult, i as AthenaReadQueryFlatRow } from './model-form-
|
|
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,
|
|
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-
|
|
8
|
-
export { D as AthenaAuthBindings, aC as AuthBindings } from './types-
|
|
9
|
-
import {
|
|
10
|
-
import './
|
|
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,
|
|
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[
|
|
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 {
|
|
2
|
-
export {
|
|
3
|
-
import { a as AthenaReadQueryClient, c as AthenaReadQueryDefinition, e as AthenaReadQueryExecutionResult, i as AthenaReadQueryFlatRow } from './model-form-
|
|
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,
|
|
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-
|
|
8
|
-
export { D as AthenaAuthBindings, aC as AuthBindings } from './types-
|
|
9
|
-
import {
|
|
10
|
-
import './
|
|
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,
|
|
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[
|
|
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 };
|