@xylex-group/athena 2.14.0 → 3.0.2
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 +109 -1402
- package/dist/admin.d.cts +1 -1
- package/dist/admin.d.ts +1 -1
- package/dist/{athena-auth-url-oLux_57a.d.cts → athena-request-headers-C7Jy-c_D.d.ts} +85 -1
- package/dist/{athena-auth-url-oLux_57a.d.ts → athena-request-headers-DujFFyMU.d.cts} +85 -1
- package/dist/billing.cjs +1311 -0
- package/dist/billing.cjs.map +1 -0
- package/dist/billing.d.cts +270 -0
- package/dist/billing.d.ts +270 -0
- package/dist/billing.js +1306 -0
- package/dist/billing.js.map +1 -0
- package/dist/browser.cjs +9695 -9243
- 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 +9692 -9241
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +8137 -7286
- 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 +8137 -7286
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +9718 -9260
- 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 +9711 -9258
- package/dist/index.js.map +1 -1
- package/dist/{model-form-DcH3R7WD.d.ts → model-form-Dh0sisdL.d.ts} +2 -2
- package/dist/{model-form-BE1_Bmdd.d.cts → model-form-oOAJUVd4.d.cts} +2 -2
- package/dist/{module-DFGZXCtt.d.cts → module-CB25egcO.d.cts} +18 -52
- package/dist/module-C_ab-MM1.d.cts +360 -0
- package/dist/module-C_ab-MM1.d.ts +360 -0
- package/dist/{module-Ca3_OQqR.d.ts → module-CkUM6v58.d.ts} +18 -52
- package/dist/next/client.cjs +9116 -8468
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +24 -25
- package/dist/next/client.d.ts +24 -25
- package/dist/next/client.js +9088 -8469
- package/dist/next/client.js.map +1 -1
- package/dist/next/server.cjs +8932 -7776
- package/dist/next/server.cjs.map +1 -1
- package/dist/next/server.d.cts +62 -43
- package/dist/next/server.d.ts +62 -43
- package/dist/next/server.js +8873 -7777
- package/dist/next/server.js.map +1 -1
- package/dist/{payload-BbSCmILD.d.ts → payload-DWI1rw-e.d.cts} +1 -35
- package/dist/{payload-zXIwKTQf.d.cts → payload-DWI1rw-e.d.ts} +1 -35
- package/dist/{pipeline-DqwehoQV.d.ts → pipeline-B8aN2EHe.d.ts} +1 -1
- package/dist/{pipeline-CwQoD5G9.d.cts → pipeline-D4W-Cc-A.d.cts} +1 -1
- package/dist/proxy-request-headers-DGxdoyA0.d.cts +59 -0
- package/dist/proxy-request-headers-m4D2Tduy.d.ts +59 -0
- package/dist/react.cjs +118 -17
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +46 -16
- package/dist/react.d.ts +46 -16
- package/dist/react.js +117 -18
- package/dist/react.js.map +1 -1
- package/dist/social-providers.cjs +24 -20
- package/dist/social-providers.cjs.map +1 -1
- package/dist/social-providers.d.cts +96 -139
- package/dist/social-providers.d.ts +96 -139
- package/dist/social-providers.js +24 -20
- package/dist/social-providers.js.map +1 -1
- package/dist/{types-eAKAh71s.d.cts → types-AOY-GLu8.d.cts} +27 -54
- package/dist/{types-eAKAh71s.d.ts → types-AOY-GLu8.d.ts} +27 -54
- package/dist/{types-CD6K05JQ.d.ts → types-B75PdABb.d.ts} +3 -3
- package/dist/{types-dHnjluBC.d.cts → types-BBm-kEBL.d.cts} +2 -2
- package/dist/{types-C1swabT5.d.ts → types-BaAMXCqK.d.ts} +2 -2
- package/dist/{types-YQUR7wu0.d.cts → types-Bltx6iL6.d.cts} +3 -5
- package/dist/{types-YQUR7wu0.d.ts → types-Bltx6iL6.d.ts} +3 -5
- package/dist/{types-6H575ITc.d.cts → types-CgCv5o6R.d.cts} +3 -3
- package/dist/utils.cjs +7 -8
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +4 -145
- package/dist/utils.d.ts +4 -145
- package/dist/utils.js +7 -8
- package/dist/utils.js.map +1 -1
- package/dist/{client-wU2J9yqb.d.cts → v3-client-CWfZHcKL.d.cts} +402 -521
- package/dist/{client-uthENhaf.d.ts → v3-client-DZp2NEhK.d.ts} +402 -521
- package/package.json +15 -3
package/dist/react.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { A as AthenaGatewayError, M as ModelFormAdapter, a as ModelFormDefaults, b as ModelFormNullishMode, c as ModelFormValues, T as ToModelFormDefaultsOptions, d as ToModelPayloadOptions, e as createModelFormAdapter, i as isAthenaGatewayError, t as toModelFormDefaults, f as toModelPayload } from './model-form-
|
|
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
|
+
export { A as AthenaGatewayError, M as ModelFormAdapter, a as ModelFormDefaults, b as ModelFormNullishMode, c as ModelFormValues, T as ToModelFormDefaultsOptions, d as ToModelPayloadOptions, e as createModelFormAdapter, i as isAthenaGatewayError, t as toModelFormDefaults, f as toModelPayload } from './model-form-oOAJUVd4.cjs';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
|
-
import {
|
|
7
|
-
export { D as AthenaAuthBindings,
|
|
8
|
-
import {
|
|
9
|
-
import './types-
|
|
6
|
+
import { aE as AthenaAuthFetchCompatibleInput, E as AthenaAuthCallOptions, ad as AthenaAuthSessionResponse, R as AthenaAuthErrorDetails, aa as AthenaAuthResult } from './types-AOY-GLu8.cjs';
|
|
7
|
+
export { D as AthenaAuthBindings, aC as AuthBindings } from './types-AOY-GLu8.cjs';
|
|
8
|
+
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';
|
|
9
|
+
import './types-CgCv5o6R.cjs';
|
|
10
|
+
import './module-C_ab-MM1.cjs';
|
|
10
11
|
|
|
11
12
|
declare function useAthenaGateway(config?: AthenaGatewayHookConfig): AthenaGatewayHookResult;
|
|
12
13
|
|
|
@@ -255,7 +256,7 @@ interface UseSessionResult<TSessionData extends AthenaAuthSessionResponse = Athe
|
|
|
255
256
|
type SessionGetter$1<TSessionData extends AthenaAuthSessionResponse> = (input?: AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<TSessionData>>;
|
|
256
257
|
/**
|
|
257
258
|
* Anything `useSession` can resolve a `getSession` from:
|
|
258
|
-
* -
|
|
259
|
+
* - auth-ui compatibility client → top-level `getSession`
|
|
259
260
|
* - `createClient(...)` → `auth.getSession`
|
|
260
261
|
* - `createClient(...).auth` → `getSession` on bindings
|
|
261
262
|
*/
|
|
@@ -277,24 +278,23 @@ type InferSessionData$1<TClient> = TClient extends {
|
|
|
277
278
|
* Better Auth style session hook for Athena.
|
|
278
279
|
*
|
|
279
280
|
* Pass any of:
|
|
280
|
-
* - `createClient(url, key,
|
|
281
|
+
* - `createClient({ url, key, auth: { url } })` — uses `client.auth.getSession`
|
|
281
282
|
* - `createClient(...).auth` — auth bindings only
|
|
282
|
-
* - `createAuthClient({ baseUrl })` — standalone auth client
|
|
283
283
|
*
|
|
284
284
|
* @example
|
|
285
285
|
* ```tsx
|
|
286
|
-
* const athena = createClient(url, key,
|
|
286
|
+
* const athena = createClient({ url, key, auth: { url: "/api/auth" } })
|
|
287
287
|
* const { data, isPending } = useSession(athena)
|
|
288
288
|
* ```
|
|
289
289
|
*/
|
|
290
290
|
declare function useSession<TClient extends UseSessionAuthClient>(authClient: TClient, options?: UseSessionOptions): UseSessionResult<InferSessionData$1<TClient>>;
|
|
291
291
|
|
|
292
292
|
type SessionGetter<TSessionData extends AthenaAuthSessionResponse> = (input?: AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<TSessionData>>;
|
|
293
|
-
type
|
|
293
|
+
type AthenaContextScopedClient<TSessionData extends AthenaAuthSessionResponse = AthenaAuthSessionResponse> = {
|
|
294
294
|
auth: {
|
|
295
295
|
getSession: SessionGetter<TSessionData>;
|
|
296
296
|
};
|
|
297
|
-
|
|
297
|
+
withContext(context: AthenaRequestContext): unknown;
|
|
298
298
|
};
|
|
299
299
|
type InferSessionData<TClient> = TClient extends {
|
|
300
300
|
auth: {
|
|
@@ -302,7 +302,7 @@ type InferSessionData<TClient> = TClient extends {
|
|
|
302
302
|
};
|
|
303
303
|
} ? TSessionData extends AthenaAuthSessionResponse ? TSessionData : AthenaAuthSessionResponse : AthenaAuthSessionResponse;
|
|
304
304
|
type InferScopedClient<TClient> = TClient extends {
|
|
305
|
-
|
|
305
|
+
withContext(context: AthenaRequestContext): infer TScopedClient;
|
|
306
306
|
} ? TScopedClient : TClient;
|
|
307
307
|
type UseAthenaSessionClientOptions = UseSessionOptions;
|
|
308
308
|
interface UseAthenaSessionClientResult<TClient> {
|
|
@@ -315,7 +315,7 @@ interface UseAthenaSessionClientResult<TClient> {
|
|
|
315
315
|
isRefetching: boolean;
|
|
316
316
|
refetch: UseSessionResult<InferSessionData<TClient>>['refetch'];
|
|
317
317
|
}
|
|
318
|
-
declare function useAthenaSessionClient<TClient extends
|
|
318
|
+
declare function useAthenaSessionClient<TClient extends AthenaContextScopedClient>(baseClient: TClient, options?: UseAthenaSessionClientOptions): UseAthenaSessionClientResult<TClient>;
|
|
319
319
|
|
|
320
320
|
type UseStorageUploadInput = AthenaStorageFileUploadInput | AthenaStorageUploadSource | readonly AthenaStorageUploadSource[] | ArrayLike<AthenaStorageUploadSource>;
|
|
321
321
|
interface UseStorageUploadOptions extends Omit<Partial<AthenaStorageFileUploadInput>, 'files' | 'onProgress'> {
|
|
@@ -334,4 +334,34 @@ interface UseStorageUploadResult {
|
|
|
334
334
|
}
|
|
335
335
|
declare function useStorageUpload(options: UseStorageUploadOptions): UseStorageUploadResult;
|
|
336
336
|
|
|
337
|
-
|
|
337
|
+
interface UseStorageFilesOptions {
|
|
338
|
+
storage: Pick<AthenaStorageModule, 'file'>;
|
|
339
|
+
input: AthenaStorageFileListInput | null | undefined;
|
|
340
|
+
enabled?: boolean;
|
|
341
|
+
callOptions?: AthenaStorageCallOptions;
|
|
342
|
+
refreshIntervalMs?: number;
|
|
343
|
+
}
|
|
344
|
+
interface UseStorageFilesResult {
|
|
345
|
+
files: StorageListFilesResponse['files'];
|
|
346
|
+
count: number;
|
|
347
|
+
loading: boolean;
|
|
348
|
+
error: unknown;
|
|
349
|
+
data: StorageListFilesResponse | null;
|
|
350
|
+
refetch(): Promise<StorageListFilesResponse | null>;
|
|
351
|
+
}
|
|
352
|
+
declare function useStorageFiles(options: UseStorageFilesOptions): UseStorageFilesResult;
|
|
353
|
+
|
|
354
|
+
interface UseStorageFileDeleteOptions {
|
|
355
|
+
storage: Pick<AthenaStorageModule, 'file'>;
|
|
356
|
+
onSuccess?: (result: StorageFileMutationResponse | StorageFileMutationResponse[]) => void;
|
|
357
|
+
onError?: (error: unknown) => void;
|
|
358
|
+
}
|
|
359
|
+
interface UseStorageFileDeleteResult {
|
|
360
|
+
deleting: boolean;
|
|
361
|
+
error: unknown;
|
|
362
|
+
deleteFile(fileId: string | readonly string[], options?: AthenaStorageCallOptions): Promise<StorageFileMutationResponse | StorageFileMutationResponse[]>;
|
|
363
|
+
reset(): void;
|
|
364
|
+
}
|
|
365
|
+
declare function useStorageFileDelete(options: UseStorageFileDeleteOptions): UseStorageFileDeleteResult;
|
|
366
|
+
|
|
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 };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { A as AthenaGatewayError, M as ModelFormAdapter, a as ModelFormDefaults, b as ModelFormNullishMode, c as ModelFormValues, T as ToModelFormDefaultsOptions, d as ToModelPayloadOptions, e as createModelFormAdapter, i as isAthenaGatewayError, t as toModelFormDefaults, f as toModelPayload } from './model-form-
|
|
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
|
+
export { A as AthenaGatewayError, M as ModelFormAdapter, a as ModelFormDefaults, b as ModelFormNullishMode, c as ModelFormValues, T as ToModelFormDefaultsOptions, d as ToModelPayloadOptions, e as createModelFormAdapter, i as isAthenaGatewayError, t as toModelFormDefaults, f as toModelPayload } from './model-form-Dh0sisdL.js';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
|
-
import {
|
|
7
|
-
export { D as AthenaAuthBindings,
|
|
8
|
-
import {
|
|
9
|
-
import './types-
|
|
6
|
+
import { aE as AthenaAuthFetchCompatibleInput, E as AthenaAuthCallOptions, ad as AthenaAuthSessionResponse, R as AthenaAuthErrorDetails, aa as AthenaAuthResult } from './types-AOY-GLu8.js';
|
|
7
|
+
export { D as AthenaAuthBindings, aC as AuthBindings } from './types-AOY-GLu8.js';
|
|
8
|
+
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';
|
|
9
|
+
import './types-B75PdABb.js';
|
|
10
|
+
import './module-C_ab-MM1.js';
|
|
10
11
|
|
|
11
12
|
declare function useAthenaGateway(config?: AthenaGatewayHookConfig): AthenaGatewayHookResult;
|
|
12
13
|
|
|
@@ -255,7 +256,7 @@ interface UseSessionResult<TSessionData extends AthenaAuthSessionResponse = Athe
|
|
|
255
256
|
type SessionGetter$1<TSessionData extends AthenaAuthSessionResponse> = (input?: AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<TSessionData>>;
|
|
256
257
|
/**
|
|
257
258
|
* Anything `useSession` can resolve a `getSession` from:
|
|
258
|
-
* -
|
|
259
|
+
* - auth-ui compatibility client → top-level `getSession`
|
|
259
260
|
* - `createClient(...)` → `auth.getSession`
|
|
260
261
|
* - `createClient(...).auth` → `getSession` on bindings
|
|
261
262
|
*/
|
|
@@ -277,24 +278,23 @@ type InferSessionData$1<TClient> = TClient extends {
|
|
|
277
278
|
* Better Auth style session hook for Athena.
|
|
278
279
|
*
|
|
279
280
|
* Pass any of:
|
|
280
|
-
* - `createClient(url, key,
|
|
281
|
+
* - `createClient({ url, key, auth: { url } })` — uses `client.auth.getSession`
|
|
281
282
|
* - `createClient(...).auth` — auth bindings only
|
|
282
|
-
* - `createAuthClient({ baseUrl })` — standalone auth client
|
|
283
283
|
*
|
|
284
284
|
* @example
|
|
285
285
|
* ```tsx
|
|
286
|
-
* const athena = createClient(url, key,
|
|
286
|
+
* const athena = createClient({ url, key, auth: { url: "/api/auth" } })
|
|
287
287
|
* const { data, isPending } = useSession(athena)
|
|
288
288
|
* ```
|
|
289
289
|
*/
|
|
290
290
|
declare function useSession<TClient extends UseSessionAuthClient>(authClient: TClient, options?: UseSessionOptions): UseSessionResult<InferSessionData$1<TClient>>;
|
|
291
291
|
|
|
292
292
|
type SessionGetter<TSessionData extends AthenaAuthSessionResponse> = (input?: AthenaAuthFetchCompatibleInput, options?: AthenaAuthCallOptions) => Promise<AthenaAuthResult<TSessionData>>;
|
|
293
|
-
type
|
|
293
|
+
type AthenaContextScopedClient<TSessionData extends AthenaAuthSessionResponse = AthenaAuthSessionResponse> = {
|
|
294
294
|
auth: {
|
|
295
295
|
getSession: SessionGetter<TSessionData>;
|
|
296
296
|
};
|
|
297
|
-
|
|
297
|
+
withContext(context: AthenaRequestContext): unknown;
|
|
298
298
|
};
|
|
299
299
|
type InferSessionData<TClient> = TClient extends {
|
|
300
300
|
auth: {
|
|
@@ -302,7 +302,7 @@ type InferSessionData<TClient> = TClient extends {
|
|
|
302
302
|
};
|
|
303
303
|
} ? TSessionData extends AthenaAuthSessionResponse ? TSessionData : AthenaAuthSessionResponse : AthenaAuthSessionResponse;
|
|
304
304
|
type InferScopedClient<TClient> = TClient extends {
|
|
305
|
-
|
|
305
|
+
withContext(context: AthenaRequestContext): infer TScopedClient;
|
|
306
306
|
} ? TScopedClient : TClient;
|
|
307
307
|
type UseAthenaSessionClientOptions = UseSessionOptions;
|
|
308
308
|
interface UseAthenaSessionClientResult<TClient> {
|
|
@@ -315,7 +315,7 @@ interface UseAthenaSessionClientResult<TClient> {
|
|
|
315
315
|
isRefetching: boolean;
|
|
316
316
|
refetch: UseSessionResult<InferSessionData<TClient>>['refetch'];
|
|
317
317
|
}
|
|
318
|
-
declare function useAthenaSessionClient<TClient extends
|
|
318
|
+
declare function useAthenaSessionClient<TClient extends AthenaContextScopedClient>(baseClient: TClient, options?: UseAthenaSessionClientOptions): UseAthenaSessionClientResult<TClient>;
|
|
319
319
|
|
|
320
320
|
type UseStorageUploadInput = AthenaStorageFileUploadInput | AthenaStorageUploadSource | readonly AthenaStorageUploadSource[] | ArrayLike<AthenaStorageUploadSource>;
|
|
321
321
|
interface UseStorageUploadOptions extends Omit<Partial<AthenaStorageFileUploadInput>, 'files' | 'onProgress'> {
|
|
@@ -334,4 +334,34 @@ interface UseStorageUploadResult {
|
|
|
334
334
|
}
|
|
335
335
|
declare function useStorageUpload(options: UseStorageUploadOptions): UseStorageUploadResult;
|
|
336
336
|
|
|
337
|
-
|
|
337
|
+
interface UseStorageFilesOptions {
|
|
338
|
+
storage: Pick<AthenaStorageModule, 'file'>;
|
|
339
|
+
input: AthenaStorageFileListInput | null | undefined;
|
|
340
|
+
enabled?: boolean;
|
|
341
|
+
callOptions?: AthenaStorageCallOptions;
|
|
342
|
+
refreshIntervalMs?: number;
|
|
343
|
+
}
|
|
344
|
+
interface UseStorageFilesResult {
|
|
345
|
+
files: StorageListFilesResponse['files'];
|
|
346
|
+
count: number;
|
|
347
|
+
loading: boolean;
|
|
348
|
+
error: unknown;
|
|
349
|
+
data: StorageListFilesResponse | null;
|
|
350
|
+
refetch(): Promise<StorageListFilesResponse | null>;
|
|
351
|
+
}
|
|
352
|
+
declare function useStorageFiles(options: UseStorageFilesOptions): UseStorageFilesResult;
|
|
353
|
+
|
|
354
|
+
interface UseStorageFileDeleteOptions {
|
|
355
|
+
storage: Pick<AthenaStorageModule, 'file'>;
|
|
356
|
+
onSuccess?: (result: StorageFileMutationResponse | StorageFileMutationResponse[]) => void;
|
|
357
|
+
onError?: (error: unknown) => void;
|
|
358
|
+
}
|
|
359
|
+
interface UseStorageFileDeleteResult {
|
|
360
|
+
deleting: boolean;
|
|
361
|
+
error: unknown;
|
|
362
|
+
deleteFile(fileId: string | readonly string[], options?: AthenaStorageCallOptions): Promise<StorageFileMutationResponse | StorageFileMutationResponse[]>;
|
|
363
|
+
reset(): void;
|
|
364
|
+
}
|
|
365
|
+
declare function useStorageFileDelete(options: UseStorageFileDeleteOptions): UseStorageFileDeleteResult;
|
|
366
|
+
|
|
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 };
|
package/dist/react.js
CHANGED
|
@@ -65,7 +65,7 @@ function isAthenaGatewayError(error) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// src/gateway/url.ts
|
|
68
|
-
var ATHENA_DEFAULT_BASE_URL = "https://athena-
|
|
68
|
+
var ATHENA_DEFAULT_BASE_URL = "https://mirror2.athena-cluster.com";
|
|
69
69
|
function describeReceivedValue(value) {
|
|
70
70
|
if (value === void 0) return "undefined";
|
|
71
71
|
if (value === null) return "null";
|
|
@@ -88,14 +88,14 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
|
|
|
88
88
|
if (candidate === void 0 || candidate === null) {
|
|
89
89
|
throw invalidBaseUrlError(
|
|
90
90
|
`${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(input)}.`,
|
|
91
|
-
'Set ATHENA_URL (or pass createClient(url,
|
|
91
|
+
'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
const trimmed = candidate.trim();
|
|
95
95
|
if (!trimmed) {
|
|
96
96
|
throw invalidBaseUrlError(
|
|
97
97
|
`${label} must be a non-empty absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
|
|
98
|
-
'Set ATHENA_URL (or pass createClient(url,
|
|
98
|
+
'Set ATHENA_URL in the explicit env object (or pass createClient({ url, key })) to a full URL such as "https://mirror2.athena-cluster.com".'
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
let parsed;
|
|
@@ -104,13 +104,13 @@ function normalizeAthenaGatewayBaseUrl(input, options = {}) {
|
|
|
104
104
|
} catch {
|
|
105
105
|
throw invalidBaseUrlError(
|
|
106
106
|
`${label} must be a valid absolute http(s) URL. Received ${describeReceivedValue(candidate)}.`,
|
|
107
|
-
'Use a full URL including the protocol, for example "https://
|
|
107
|
+
'Use a full URL including the protocol, for example "https://mirror2.athena-cluster.com".'
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
111
111
|
throw invalidBaseUrlError(
|
|
112
112
|
`${label} must use http or https. Received ${JSON.stringify(trimmed)}.`,
|
|
113
|
-
'Use an Athena gateway URL such as "https://
|
|
113
|
+
'Use an Athena gateway URL such as "https://mirror2.athena-cluster.com".'
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
if (parsed.search || parsed.hash) {
|
|
@@ -177,7 +177,7 @@ var PROFILE_RULES = {
|
|
|
177
177
|
gateway: { apiKeys: true, routing: true, authMirror: true, authBearer: false, contentType: true, stripNullsDefault: true },
|
|
178
178
|
chat: { apiKeys: true, routing: true, authMirror: true, authBearer: true, accept: true },
|
|
179
179
|
storage: { apiKeys: true, routing: true, authMirror: true, authBearer: false, contentType: true },
|
|
180
|
-
auth: { apiKeys: true, routing:
|
|
180
|
+
auth: { apiKeys: true, routing: true, authMirror: false, authBearer: true, contentType: true },
|
|
181
181
|
minimal: { apiKeys: false, routing: false, authMirror: false, authBearer: false }
|
|
182
182
|
};
|
|
183
183
|
function normalizeHeaderValue(value) {
|
|
@@ -237,7 +237,6 @@ function resolveBackendType(backend) {
|
|
|
237
237
|
function resolveRequestHeaderOverrides(config, options, defaults) {
|
|
238
238
|
return {
|
|
239
239
|
apiKey: options?.apiKey ?? config.apiKey,
|
|
240
|
-
athenaKey: options?.athenaKey ?? config.athenaKey,
|
|
241
240
|
client: options?.client ?? config.client ?? defaults?.client,
|
|
242
241
|
userId: options?.userId ?? config.userId,
|
|
243
242
|
organizationId: options?.organizationId ?? config.organizationId,
|
|
@@ -267,10 +266,10 @@ function buildServiceRequestHeaders(profile, sdkHeaderValue, config, options, ex
|
|
|
267
266
|
accept: extras?.accept ?? (rules.accept ? "application/json" : void 0)
|
|
268
267
|
});
|
|
269
268
|
}
|
|
270
|
-
function applyAthenaApiKeyHeaders(headers, apiKey
|
|
271
|
-
const
|
|
272
|
-
if (
|
|
273
|
-
headers["X-Athena-Key"] =
|
|
269
|
+
function applyAthenaApiKeyHeaders(headers, apiKey) {
|
|
270
|
+
const resolvedApiKey = normalizeHeaderValue(apiKey);
|
|
271
|
+
if (resolvedApiKey && !hasHeaderIgnoreCase(headers, "X-Athena-Key")) {
|
|
272
|
+
headers["X-Athena-Key"] = resolvedApiKey;
|
|
274
273
|
}
|
|
275
274
|
}
|
|
276
275
|
function applyAthenaAuthContextHeaders(headers, input) {
|
|
@@ -334,7 +333,7 @@ function buildAthenaRequestHeaders(input) {
|
|
|
334
333
|
const headerClient = resolveHeaderValue(mergedExtraHeaders, CLIENT_HEADER_CANDIDATES);
|
|
335
334
|
const finalClient = normalizeHeaderValue(input.client) ?? headerClient;
|
|
336
335
|
const finalApiKey = normalizeHeaderValue(input.apiKey) ?? resolveHeaderValue(mergedExtraHeaders, API_KEY_HEADER_CANDIDATES);
|
|
337
|
-
const finalAthenaKey =
|
|
336
|
+
const finalAthenaKey = resolveHeaderValue(mergedExtraHeaders, ATHENA_KEY_HEADER_CANDIDATES) ?? finalApiKey;
|
|
338
337
|
const headers = {
|
|
339
338
|
"X-Athena-Sdk": input.sdkHeaderValue
|
|
340
339
|
};
|
|
@@ -368,7 +367,7 @@ function buildAthenaRequestHeaders(input) {
|
|
|
368
367
|
}
|
|
369
368
|
}
|
|
370
369
|
if (rules.apiKeys && (finalApiKey || finalAthenaKey)) {
|
|
371
|
-
applyAthenaApiKeyHeaders(headers,
|
|
370
|
+
applyAthenaApiKeyHeaders(headers, finalAthenaKey);
|
|
372
371
|
}
|
|
373
372
|
applyAthenaAuthContextHeaders(headers, input);
|
|
374
373
|
applyAthenaPgUriHeaders(headers, input);
|
|
@@ -393,7 +392,7 @@ function buildAthenaRequestHeaders(input) {
|
|
|
393
392
|
|
|
394
393
|
// package.json
|
|
395
394
|
var package_default = {
|
|
396
|
-
version: "
|
|
395
|
+
version: "3.0.2"
|
|
397
396
|
};
|
|
398
397
|
|
|
399
398
|
// src/sdk-version.ts
|
|
@@ -403,7 +402,7 @@ function buildSdkHeaderValue(sdkName) {
|
|
|
403
402
|
}
|
|
404
403
|
|
|
405
404
|
// src/gateway/client.ts
|
|
406
|
-
var DEFAULT_CLIENT = "
|
|
405
|
+
var DEFAULT_CLIENT = "DEFAULT_CLIENT";
|
|
407
406
|
var SDK_NAME = "xylex-group/athena";
|
|
408
407
|
var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
|
|
409
408
|
function parseResponseBody(rawText, contentType) {
|
|
@@ -820,6 +819,9 @@ function createAthenaGatewayClient(config = {}) {
|
|
|
820
819
|
buildHeaders(options) {
|
|
821
820
|
return buildHeaders(normalizedConfig, options);
|
|
822
821
|
},
|
|
822
|
+
async resolveCallOptions(options) {
|
|
823
|
+
return options;
|
|
824
|
+
},
|
|
823
825
|
verifyConnection(options) {
|
|
824
826
|
return performConnectionCheck(
|
|
825
827
|
normalizedBaseUrl,
|
|
@@ -1981,7 +1983,7 @@ function resolveGetSession(authClient) {
|
|
|
1981
1983
|
if ("auth" in authClient && authClient.auth && typeof authClient.auth.getSession === "function") {
|
|
1982
1984
|
return authClient.auth.getSession;
|
|
1983
1985
|
}
|
|
1984
|
-
throw new Error("useSession requires an auth-capable client (createClient(...).auth
|
|
1986
|
+
throw new Error("useSession requires an auth-capable client (createClient(...).auth)");
|
|
1985
1987
|
}
|
|
1986
1988
|
function useSession(authClient, options = {}) {
|
|
1987
1989
|
const enabled = options.enabled ?? true;
|
|
@@ -2069,7 +2071,12 @@ function useSession(authClient, options = {}) {
|
|
|
2069
2071
|
function useAthenaSessionClient(baseClient, options = {}) {
|
|
2070
2072
|
const sessionState = useSession(baseClient, options);
|
|
2071
2073
|
const scopedClient = useMemo(
|
|
2072
|
-
() => sessionState.data ? baseClient.
|
|
2074
|
+
() => sessionState.data ? baseClient.withContext({
|
|
2075
|
+
userId: sessionState.data.user.id,
|
|
2076
|
+
organizationId: sessionState.data.session.activeOrganizationId,
|
|
2077
|
+
bearerToken: sessionState.data.session.token,
|
|
2078
|
+
sessionToken: sessionState.data.session.token
|
|
2079
|
+
}) : baseClient,
|
|
2073
2080
|
[baseClient, sessionState.data]
|
|
2074
2081
|
);
|
|
2075
2082
|
const session = sessionState.data;
|
|
@@ -2164,6 +2171,98 @@ function normalizeHookUploadInput(defaults, input, onProgress) {
|
|
|
2164
2171
|
function isStorageUploadInput(input) {
|
|
2165
2172
|
return Boolean(input) && typeof input === "object" && "files" in input && "s3_id" in input;
|
|
2166
2173
|
}
|
|
2174
|
+
function useStorageFiles(options) {
|
|
2175
|
+
const { storage, input, enabled = true, callOptions, refreshIntervalMs } = options;
|
|
2176
|
+
const [data, setData] = React.useState(null);
|
|
2177
|
+
const [loading, setLoading] = React.useState(false);
|
|
2178
|
+
const [error, setError] = React.useState(null);
|
|
2179
|
+
const requestIdRef = React.useRef(0);
|
|
2180
|
+
const refetch = React.useCallback(async () => {
|
|
2181
|
+
if (!input || !enabled) {
|
|
2182
|
+
setData(null);
|
|
2183
|
+
setError(null);
|
|
2184
|
+
setLoading(false);
|
|
2185
|
+
return null;
|
|
2186
|
+
}
|
|
2187
|
+
const requestId = requestIdRef.current + 1;
|
|
2188
|
+
requestIdRef.current = requestId;
|
|
2189
|
+
setLoading(true);
|
|
2190
|
+
setError(null);
|
|
2191
|
+
try {
|
|
2192
|
+
const result = await storage.file.list(input, callOptions);
|
|
2193
|
+
if (requestIdRef.current === requestId) {
|
|
2194
|
+
setData(result);
|
|
2195
|
+
}
|
|
2196
|
+
return result;
|
|
2197
|
+
} catch (listError) {
|
|
2198
|
+
if (requestIdRef.current === requestId) {
|
|
2199
|
+
setError(listError);
|
|
2200
|
+
setData(null);
|
|
2201
|
+
}
|
|
2202
|
+
throw listError;
|
|
2203
|
+
} finally {
|
|
2204
|
+
if (requestIdRef.current === requestId) {
|
|
2205
|
+
setLoading(false);
|
|
2206
|
+
}
|
|
2207
|
+
}
|
|
2208
|
+
}, [callOptions, enabled, input, storage]);
|
|
2209
|
+
React.useEffect(() => {
|
|
2210
|
+
void refetch().catch(() => {
|
|
2211
|
+
});
|
|
2212
|
+
}, [refetch]);
|
|
2213
|
+
React.useEffect(() => {
|
|
2214
|
+
if (!enabled || !input || !refreshIntervalMs || refreshIntervalMs <= 0) {
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2217
|
+
const globalObject = globalThis;
|
|
2218
|
+
const timer = globalObject.setInterval(() => {
|
|
2219
|
+
void refetch().catch(() => {
|
|
2220
|
+
});
|
|
2221
|
+
}, refreshIntervalMs);
|
|
2222
|
+
return () => globalObject.clearInterval(timer);
|
|
2223
|
+
}, [enabled, input, refetch, refreshIntervalMs]);
|
|
2224
|
+
return {
|
|
2225
|
+
files: data?.files ?? [],
|
|
2226
|
+
count: data?.count ?? data?.files?.length ?? 0,
|
|
2227
|
+
loading,
|
|
2228
|
+
error,
|
|
2229
|
+
data,
|
|
2230
|
+
refetch
|
|
2231
|
+
};
|
|
2232
|
+
}
|
|
2233
|
+
function useStorageFileDelete(options) {
|
|
2234
|
+
const { storage, onSuccess, onError } = options;
|
|
2235
|
+
const [deleting, setDeleting] = React.useState(false);
|
|
2236
|
+
const [error, setError] = React.useState(null);
|
|
2237
|
+
const reset = React.useCallback(() => {
|
|
2238
|
+
setDeleting(false);
|
|
2239
|
+
setError(null);
|
|
2240
|
+
}, []);
|
|
2241
|
+
const deleteFile = React.useCallback(
|
|
2242
|
+
async (fileId, callOptions) => {
|
|
2243
|
+
setDeleting(true);
|
|
2244
|
+
setError(null);
|
|
2245
|
+
try {
|
|
2246
|
+
const result = await storage.file.delete(fileId, callOptions);
|
|
2247
|
+
onSuccess?.(result);
|
|
2248
|
+
return result;
|
|
2249
|
+
} catch (deleteError) {
|
|
2250
|
+
setError(deleteError);
|
|
2251
|
+
onError?.(deleteError);
|
|
2252
|
+
throw deleteError;
|
|
2253
|
+
} finally {
|
|
2254
|
+
setDeleting(false);
|
|
2255
|
+
}
|
|
2256
|
+
},
|
|
2257
|
+
[onError, onSuccess, storage]
|
|
2258
|
+
);
|
|
2259
|
+
return {
|
|
2260
|
+
deleting,
|
|
2261
|
+
error,
|
|
2262
|
+
deleteFile,
|
|
2263
|
+
reset
|
|
2264
|
+
};
|
|
2265
|
+
}
|
|
2167
2266
|
|
|
2168
2267
|
// src/schema/model-form.ts
|
|
2169
2268
|
function resolveNullishValue(mode) {
|
|
@@ -2226,6 +2325,6 @@ function createModelFormAdapter(model) {
|
|
|
2226
2325
|
};
|
|
2227
2326
|
}
|
|
2228
2327
|
|
|
2229
|
-
export { AthenaGatewayError, AthenaQueryClient, AthenaQueryClientProvider, attachStateAdapter, createAthenaQueryClient, createModelFormAdapter, isAthenaGatewayError, toModelFormDefaults, toModelPayload, useAthenaGateway, useAthenaQueryClient, useAthenaSessionClient, useMutation, useQuery, useSession, useStorageUpload };
|
|
2328
|
+
export { AthenaGatewayError, AthenaQueryClient, AthenaQueryClientProvider, attachStateAdapter, createAthenaQueryClient, createModelFormAdapter, isAthenaGatewayError, toModelFormDefaults, toModelPayload, useAthenaGateway, useAthenaQueryClient, useAthenaSessionClient, useMutation, useQuery, useSession, useStorageFileDelete, useStorageFiles, useStorageUpload };
|
|
2230
2329
|
//# sourceMappingURL=react.js.map
|
|
2231
2330
|
//# sourceMappingURL=react.js.map
|