@xylex-group/athena 3.0.3 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -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-DzimbvOA.d.ts} +48 -200
- package/dist/{athena-request-headers-DujFFyMU.d.cts → athena-request-headers-Lr_m8xCV.d.cts} +48 -200
- 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 +912 -5
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +8 -7
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +881 -6
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +7909 -7061
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +17 -10
- package/dist/cli/index.d.ts +17 -10
- package/dist/cli/index.js +7911 -7063
- package/dist/cli/index.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 +1570 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -8
- package/dist/index.d.ts +31 -8
- package/dist/index.js +1532 -100
- package/dist/index.js.map +1 -1
- package/dist/model-form-3Gr8rkdT.d.cts +281 -0
- package/dist/model-form-CotpEL7z.d.ts +281 -0
- package/dist/{module-CPG3ULxQ.d.cts → module-CQmOaDzP.d.cts} +4 -4
- package/dist/{module-BruTcxe0.d.ts → module-CWkUTcUc.d.ts} +4 -4
- package/dist/next/client.cjs +123 -7
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +4 -3
- package/dist/next/client.d.ts +4 -3
- package/dist/next/client.js +123 -7
- package/dist/next/client.js.map +1 -1
- package/dist/next/server.cjs +1130 -364
- package/dist/next/server.cjs.map +1 -1
- package/dist/next/server.d.cts +121 -8
- package/dist/next/server.d.ts +121 -8
- package/dist/next/server.js +1120 -365
- package/dist/next/server.js.map +1 -1
- package/dist/pipeline-BnRKO_Pd.d.cts +93 -0
- package/dist/pipeline-sWCmlFqu.d.ts +93 -0
- 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 +672 -16
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +123 -8
- package/dist/react.d.ts +123 -8
- package/dist/react.js +671 -17
- package/dist/react.js.map +1 -1
- package/dist/schema-handlers-BtT_IQFi.d.cts +138 -0
- package/dist/schema-handlers-VjFDhIMw.d.ts +138 -0
- package/dist/social-providers.d.cts +1 -1
- package/dist/social-providers.d.ts +1 -1
- package/dist/{types-D6tZ9aoq.d.ts → types-BDX8zS7w.d.ts} +40 -1
- 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-DFr2cL1N.d.cts → types-D-Am7YSd.d.cts} +40 -1
- package/dist/utils.cjs +30 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +3 -2
- package/dist/utils.d.ts +3 -2
- package/dist/utils.js +30 -1
- package/dist/utils.js.map +1 -1
- package/dist/{v3-client-CWfZHcKL.d.cts → v3-client-G1SLeHRa.d.cts} +23 -1
- package/dist/{v3-client-DZp2NEhK.d.ts → v3-client-ao8BWQ8v.d.ts} +23 -1
- package/package.json +16 -2
- package/dist/model-form-Dh0sisdL.d.ts +0 -97
- package/dist/model-form-oOAJUVd4.d.cts +0 -97
- package/dist/pipeline-CIzV9f7b.d.cts +0 -8
- package/dist/pipeline-DNlc8Ayn.d.ts +0 -8
package/dist/react.d.cts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { u as AthenaGatewayHookConfig, v as AthenaGatewayHookResult } from './types-Bltx6iL6.cjs';
|
|
2
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
|
-
|
|
3
|
+
import { a as AthenaReadQueryClient, c as AthenaReadQueryDefinition, e as AthenaReadQueryExecutionResult, i as AthenaReadQueryFlatRow } from './model-form-3Gr8rkdT.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-3Gr8rkdT.cjs';
|
|
4
5
|
import * as react from 'react';
|
|
5
6
|
import { ReactNode } from 'react';
|
|
6
|
-
import { aE as AthenaAuthFetchCompatibleInput, E as AthenaAuthCallOptions, ad as AthenaAuthSessionResponse, R as AthenaAuthErrorDetails, aa as AthenaAuthResult } from './types-
|
|
7
|
-
export { D as AthenaAuthBindings, aC as AuthBindings } from './types-
|
|
8
|
-
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 { 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-G1SLeHRa.cjs';
|
|
9
11
|
import './types-CgCv5o6R.cjs';
|
|
10
12
|
import './module-C_ab-MM1.cjs';
|
|
11
13
|
|
|
@@ -229,9 +231,9 @@ declare function createAthenaQueryClient(config?: AthenaQueryClientConfig): Athe
|
|
|
229
231
|
declare function attachStateAdapter(client: AthenaQueryClient, adapter: AthenaStateAdapter): AthenaUnsubscribe;
|
|
230
232
|
|
|
231
233
|
interface AthenaQueryClientProviderProps {
|
|
234
|
+
children: ReactNode;
|
|
232
235
|
client?: AthenaQueryClient;
|
|
233
236
|
config?: AthenaQueryClientConfig;
|
|
234
|
-
children: ReactNode;
|
|
235
237
|
}
|
|
236
238
|
declare function AthenaQueryClientProvider(props: AthenaQueryClientProviderProps): react.FunctionComponentElement<react.ProviderProps<AthenaQueryClient | null>>;
|
|
237
239
|
declare function useAthenaQueryClient(): AthenaQueryClient;
|
|
@@ -240,6 +242,70 @@ declare function useQuery<TQueryFnData, TData = TQueryFnData>(options: UseQueryO
|
|
|
240
242
|
|
|
241
243
|
declare function useMutation<TVariables, TMutationFnData, TData = TMutationFnData>(options: UseMutationOptions<TVariables, TMutationFnData, TData>): UseMutationResult<TVariables, TData>;
|
|
242
244
|
|
|
245
|
+
interface UseAthenaReadQueryOptions {
|
|
246
|
+
/**
|
|
247
|
+
* v3 Athena client (`createClient(...)` or a `withContext` / session-scoped view).
|
|
248
|
+
* Required for fetches when `enabled` is true.
|
|
249
|
+
*/
|
|
250
|
+
client?: AthenaReadQueryClient | null;
|
|
251
|
+
/** Portable definition (expression columns + aliases). */
|
|
252
|
+
query: AthenaReadQueryDefinition;
|
|
253
|
+
/** 1-based page (default 1). */
|
|
254
|
+
page?: number;
|
|
255
|
+
/** Page size (default 10). */
|
|
256
|
+
pageSize?: number;
|
|
257
|
+
enabled?: boolean;
|
|
258
|
+
/** Full cache key; when set, overrides the default key composition. */
|
|
259
|
+
queryKey?: QueryKey;
|
|
260
|
+
/** Prepended to the default key when `queryKey` is omitted. */
|
|
261
|
+
queryKeyPrefix?: QueryKey;
|
|
262
|
+
refetchOnMount?: boolean;
|
|
263
|
+
refetchOnWindowFocus?: boolean;
|
|
264
|
+
refetchOnReconnect?: boolean;
|
|
265
|
+
retry?: number | false;
|
|
266
|
+
}
|
|
267
|
+
interface UseAthenaReadQueryResult {
|
|
268
|
+
data: AthenaReadQueryExecutionResult | undefined;
|
|
269
|
+
rows: AthenaReadQueryFlatRow[];
|
|
270
|
+
totalItems: number;
|
|
271
|
+
debugAst: AthenaReadQueryExecutionResult['debugAst'];
|
|
272
|
+
page: number;
|
|
273
|
+
pageSize: number;
|
|
274
|
+
error: AthenaQueryError | null;
|
|
275
|
+
isLoading: boolean;
|
|
276
|
+
isFetching: boolean;
|
|
277
|
+
isSuccess: boolean;
|
|
278
|
+
isError: boolean;
|
|
279
|
+
status: QueryStatus;
|
|
280
|
+
refetch: () => Promise<unknown>;
|
|
281
|
+
reset: () => void;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Athena-native React hook for {@link AthenaReadQueryDefinition} page reads.
|
|
285
|
+
*
|
|
286
|
+
* Uses `@xylex-group/athena/react` `useQuery` + `AthenaQueryClient` (not TanStack).
|
|
287
|
+
* Does **not** construct clients, open a data proxy, or manage table UI pagination.
|
|
288
|
+
*
|
|
289
|
+
* For HeroUI tables / TanStack / `dataProxy`, use auth-ui `useAthenaQuery` instead.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```tsx
|
|
293
|
+
* const athena = createClient({ url, key })
|
|
294
|
+
* // under AthenaQueryClientProvider
|
|
295
|
+
* const { rows, totalItems, isLoading } = useAthenaReadQuery({
|
|
296
|
+
* client: athena,
|
|
297
|
+
* page: 1,
|
|
298
|
+
* pageSize: 20,
|
|
299
|
+
* query: {
|
|
300
|
+
* table: 'orders',
|
|
301
|
+
* countColumn: 'id',
|
|
302
|
+
* columns: [{ column: 'id', key: 'id' }],
|
|
303
|
+
* },
|
|
304
|
+
* })
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
declare function useAthenaReadQuery({ client, query, page, pageSize, enabled, queryKey, queryKeyPrefix, refetchOnMount, refetchOnWindowFocus, refetchOnReconnect, retry, }: UseAthenaReadQueryOptions): UseAthenaReadQueryResult;
|
|
308
|
+
|
|
243
309
|
interface UseSessionOptions {
|
|
244
310
|
enabled?: boolean;
|
|
245
311
|
refetchOnMount?: boolean;
|
|
@@ -289,6 +355,55 @@ type InferSessionData$1<TClient> = TClient extends {
|
|
|
289
355
|
*/
|
|
290
356
|
declare function useSession<TClient extends UseSessionAuthClient>(authClient: TClient, options?: UseSessionOptions): UseSessionResult<InferSessionData$1<TClient>>;
|
|
291
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
|
+
|
|
292
407
|
type SessionGetter<TSessionData extends AthenaAuthSessionResponse> = (input?: AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<TSessionData>>;
|
|
293
408
|
type AthenaContextScopedClient<TSessionData extends AthenaAuthSessionResponse = AthenaAuthSessionResponse> = {
|
|
294
409
|
auth: {
|
|
@@ -335,14 +450,14 @@ interface UseStorageUploadResult {
|
|
|
335
450
|
declare function useStorageUpload(options: UseStorageUploadOptions): UseStorageUploadResult;
|
|
336
451
|
|
|
337
452
|
interface UseStorageFilesOptions {
|
|
338
|
-
storage: Pick<AthenaStorageModule,
|
|
453
|
+
storage: Pick<AthenaStorageModule, "file">;
|
|
339
454
|
input: AthenaStorageFileListInput | null | undefined;
|
|
340
455
|
enabled?: boolean;
|
|
341
456
|
callOptions?: AthenaStorageCallOptions;
|
|
342
457
|
refreshIntervalMs?: number;
|
|
343
458
|
}
|
|
344
459
|
interface UseStorageFilesResult {
|
|
345
|
-
files: StorageListFilesResponse[
|
|
460
|
+
files: StorageListFilesResponse["files"];
|
|
346
461
|
count: number;
|
|
347
462
|
loading: boolean;
|
|
348
463
|
error: unknown;
|
|
@@ -364,4 +479,4 @@ interface UseStorageFileDeleteResult {
|
|
|
364
479
|
}
|
|
365
480
|
declare function useStorageFileDelete(options: UseStorageFileDeleteOptions): UseStorageFileDeleteResult;
|
|
366
481
|
|
|
367
|
-
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 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, 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,11 +1,13 @@
|
|
|
1
1
|
import { u as AthenaGatewayHookConfig, v as AthenaGatewayHookResult } from './types-Bltx6iL6.js';
|
|
2
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
|
-
|
|
3
|
+
import { a as AthenaReadQueryClient, c as AthenaReadQueryDefinition, e as AthenaReadQueryExecutionResult, i as AthenaReadQueryFlatRow } from './model-form-CotpEL7z.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-CotpEL7z.js';
|
|
4
5
|
import * as react from 'react';
|
|
5
6
|
import { ReactNode } from 'react';
|
|
6
|
-
import { aE as AthenaAuthFetchCompatibleInput, E as AthenaAuthCallOptions, ad as AthenaAuthSessionResponse, R as AthenaAuthErrorDetails, aa as AthenaAuthResult } from './types-
|
|
7
|
-
export { D as AthenaAuthBindings, aC as AuthBindings } from './types-
|
|
8
|
-
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 { 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-ao8BWQ8v.js';
|
|
9
11
|
import './types-B75PdABb.js';
|
|
10
12
|
import './module-C_ab-MM1.js';
|
|
11
13
|
|
|
@@ -229,9 +231,9 @@ declare function createAthenaQueryClient(config?: AthenaQueryClientConfig): Athe
|
|
|
229
231
|
declare function attachStateAdapter(client: AthenaQueryClient, adapter: AthenaStateAdapter): AthenaUnsubscribe;
|
|
230
232
|
|
|
231
233
|
interface AthenaQueryClientProviderProps {
|
|
234
|
+
children: ReactNode;
|
|
232
235
|
client?: AthenaQueryClient;
|
|
233
236
|
config?: AthenaQueryClientConfig;
|
|
234
|
-
children: ReactNode;
|
|
235
237
|
}
|
|
236
238
|
declare function AthenaQueryClientProvider(props: AthenaQueryClientProviderProps): react.FunctionComponentElement<react.ProviderProps<AthenaQueryClient | null>>;
|
|
237
239
|
declare function useAthenaQueryClient(): AthenaQueryClient;
|
|
@@ -240,6 +242,70 @@ declare function useQuery<TQueryFnData, TData = TQueryFnData>(options: UseQueryO
|
|
|
240
242
|
|
|
241
243
|
declare function useMutation<TVariables, TMutationFnData, TData = TMutationFnData>(options: UseMutationOptions<TVariables, TMutationFnData, TData>): UseMutationResult<TVariables, TData>;
|
|
242
244
|
|
|
245
|
+
interface UseAthenaReadQueryOptions {
|
|
246
|
+
/**
|
|
247
|
+
* v3 Athena client (`createClient(...)` or a `withContext` / session-scoped view).
|
|
248
|
+
* Required for fetches when `enabled` is true.
|
|
249
|
+
*/
|
|
250
|
+
client?: AthenaReadQueryClient | null;
|
|
251
|
+
/** Portable definition (expression columns + aliases). */
|
|
252
|
+
query: AthenaReadQueryDefinition;
|
|
253
|
+
/** 1-based page (default 1). */
|
|
254
|
+
page?: number;
|
|
255
|
+
/** Page size (default 10). */
|
|
256
|
+
pageSize?: number;
|
|
257
|
+
enabled?: boolean;
|
|
258
|
+
/** Full cache key; when set, overrides the default key composition. */
|
|
259
|
+
queryKey?: QueryKey;
|
|
260
|
+
/** Prepended to the default key when `queryKey` is omitted. */
|
|
261
|
+
queryKeyPrefix?: QueryKey;
|
|
262
|
+
refetchOnMount?: boolean;
|
|
263
|
+
refetchOnWindowFocus?: boolean;
|
|
264
|
+
refetchOnReconnect?: boolean;
|
|
265
|
+
retry?: number | false;
|
|
266
|
+
}
|
|
267
|
+
interface UseAthenaReadQueryResult {
|
|
268
|
+
data: AthenaReadQueryExecutionResult | undefined;
|
|
269
|
+
rows: AthenaReadQueryFlatRow[];
|
|
270
|
+
totalItems: number;
|
|
271
|
+
debugAst: AthenaReadQueryExecutionResult['debugAst'];
|
|
272
|
+
page: number;
|
|
273
|
+
pageSize: number;
|
|
274
|
+
error: AthenaQueryError | null;
|
|
275
|
+
isLoading: boolean;
|
|
276
|
+
isFetching: boolean;
|
|
277
|
+
isSuccess: boolean;
|
|
278
|
+
isError: boolean;
|
|
279
|
+
status: QueryStatus;
|
|
280
|
+
refetch: () => Promise<unknown>;
|
|
281
|
+
reset: () => void;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Athena-native React hook for {@link AthenaReadQueryDefinition} page reads.
|
|
285
|
+
*
|
|
286
|
+
* Uses `@xylex-group/athena/react` `useQuery` + `AthenaQueryClient` (not TanStack).
|
|
287
|
+
* Does **not** construct clients, open a data proxy, or manage table UI pagination.
|
|
288
|
+
*
|
|
289
|
+
* For HeroUI tables / TanStack / `dataProxy`, use auth-ui `useAthenaQuery` instead.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```tsx
|
|
293
|
+
* const athena = createClient({ url, key })
|
|
294
|
+
* // under AthenaQueryClientProvider
|
|
295
|
+
* const { rows, totalItems, isLoading } = useAthenaReadQuery({
|
|
296
|
+
* client: athena,
|
|
297
|
+
* page: 1,
|
|
298
|
+
* pageSize: 20,
|
|
299
|
+
* query: {
|
|
300
|
+
* table: 'orders',
|
|
301
|
+
* countColumn: 'id',
|
|
302
|
+
* columns: [{ column: 'id', key: 'id' }],
|
|
303
|
+
* },
|
|
304
|
+
* })
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
declare function useAthenaReadQuery({ client, query, page, pageSize, enabled, queryKey, queryKeyPrefix, refetchOnMount, refetchOnWindowFocus, refetchOnReconnect, retry, }: UseAthenaReadQueryOptions): UseAthenaReadQueryResult;
|
|
308
|
+
|
|
243
309
|
interface UseSessionOptions {
|
|
244
310
|
enabled?: boolean;
|
|
245
311
|
refetchOnMount?: boolean;
|
|
@@ -289,6 +355,55 @@ type InferSessionData$1<TClient> = TClient extends {
|
|
|
289
355
|
*/
|
|
290
356
|
declare function useSession<TClient extends UseSessionAuthClient>(authClient: TClient, options?: UseSessionOptions): UseSessionResult<InferSessionData$1<TClient>>;
|
|
291
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
|
+
|
|
292
407
|
type SessionGetter<TSessionData extends AthenaAuthSessionResponse> = (input?: AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<TSessionData>>;
|
|
293
408
|
type AthenaContextScopedClient<TSessionData extends AthenaAuthSessionResponse = AthenaAuthSessionResponse> = {
|
|
294
409
|
auth: {
|
|
@@ -335,14 +450,14 @@ interface UseStorageUploadResult {
|
|
|
335
450
|
declare function useStorageUpload(options: UseStorageUploadOptions): UseStorageUploadResult;
|
|
336
451
|
|
|
337
452
|
interface UseStorageFilesOptions {
|
|
338
|
-
storage: Pick<AthenaStorageModule,
|
|
453
|
+
storage: Pick<AthenaStorageModule, "file">;
|
|
339
454
|
input: AthenaStorageFileListInput | null | undefined;
|
|
340
455
|
enabled?: boolean;
|
|
341
456
|
callOptions?: AthenaStorageCallOptions;
|
|
342
457
|
refreshIntervalMs?: number;
|
|
343
458
|
}
|
|
344
459
|
interface UseStorageFilesResult {
|
|
345
|
-
files: StorageListFilesResponse[
|
|
460
|
+
files: StorageListFilesResponse["files"];
|
|
346
461
|
count: number;
|
|
347
462
|
loading: boolean;
|
|
348
463
|
error: unknown;
|
|
@@ -364,4 +479,4 @@ interface UseStorageFileDeleteResult {
|
|
|
364
479
|
}
|
|
365
480
|
declare function useStorageFileDelete(options: UseStorageFileDeleteOptions): UseStorageFileDeleteResult;
|
|
366
481
|
|
|
367
|
-
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 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, 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 };
|