@xylex-group/athena 2.6.0 → 2.8.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 +210 -17
- package/dist/browser.cjs +2102 -527
- 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 +2096 -528
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +2116 -559
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -3
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +2116 -559
- package/dist/cli/index.js.map +1 -1
- package/dist/cookies.cjs +10 -3
- package/dist/cookies.cjs.map +1 -1
- package/dist/cookies.js +10 -3
- package/dist/cookies.js.map +1 -1
- package/dist/index.cjs +2694 -748
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +2688 -749
- package/dist/index.js.map +1 -1
- package/dist/model-form-DMed05gE.d.cts +3037 -0
- package/dist/model-form-DXPlOnlI.d.ts +3037 -0
- package/dist/{pipeline-Ce3pTw5h.d.ts → pipeline-CkMnhwPI.d.ts} +1 -1
- package/dist/{pipeline-D1ZYeoH7.d.cts → pipeline-D4sJRKqN.d.cts} +1 -1
- package/dist/react-email-DZhDDlEl.d.cts +417 -0
- package/dist/react-email-Lrz9A-BW.d.ts +417 -0
- package/dist/react.cjs +178 -71
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +22 -5
- package/dist/react.d.ts +22 -5
- package/dist/react.js +92 -5
- package/dist/react.js.map +1 -1
- package/dist/{types-CUuo4NDi.d.cts → types-BzY6fETM.d.ts} +47 -5
- package/dist/{types-DapchQY5.d.ts → types-CAtTGGoz.d.cts} +47 -5
- package/dist/{types-DSX6AT5B.d.cts → types-vikz9YIO.d.cts} +23 -1
- package/dist/{types-DSX6AT5B.d.ts → types-vikz9YIO.d.ts} +23 -1
- package/package.json +194 -193
- package/dist/model-form-BaHWi3gm.d.cts +0 -1383
- package/dist/model-form-Dh6gWjL0.d.ts +0 -1383
- package/dist/react-email-B8O1Jeff.d.cts +0 -1230
- package/dist/react-email-CDEF0jij.d.ts +0 -1230
package/dist/react.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { O as AthenaGatewayHookConfig, P as AthenaGatewayHookResult } from './types-vikz9YIO.cjs';
|
|
2
|
+
export { Q as AthenaDeletePayload, V as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, W as AthenaGatewayResponse, X as AthenaInsertPayload, f as AthenaJsonArray, g as AthenaJsonObject, h as AthenaJsonPrimitive, i as AthenaJsonValue, k as AthenaRpcCallOptions, l as AthenaRpcFilter, m as AthenaRpcFilterOperator, n as AthenaRpcOrder, o as AthenaRpcPayload, Y as AthenaUpdatePayload } from './types-vikz9YIO.cjs';
|
|
3
|
+
import { ci as AthenaAuthFetchCompatibleInput, e as AthenaAuthCallOptions, Q as AthenaAuthSessionResponse, p as AthenaAuthErrorDetails, L as AthenaAuthResult, b4 as AthenaStorageFileUploadInput, be as AthenaStorageUploadSource, b6 as AthenaStorageModule, bd as AthenaStorageUploadProgressHandler, bc as AthenaStorageUploadProgress, b5 as AthenaStorageFileUploadResult, aT as AthenaStorageCallOptions } from './model-form-DMed05gE.cjs';
|
|
4
|
+
export { as as AthenaGatewayError, bz as ModelFormAdapter, bA as ModelFormDefaults, bB as ModelFormNullishMode, bC as ModelFormValues, bV as ToModelFormDefaultsOptions, bW as ToModelPayloadOptions, c3 as createModelFormAdapter, c5 as isAthenaGatewayError, cc as toModelFormDefaults, cd as toModelPayload } from './model-form-DMed05gE.cjs';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
|
@@ -269,4 +269,21 @@ type InferSessionData<TClient> = TClient extends {
|
|
|
269
269
|
*/
|
|
270
270
|
declare function useSession<TClient extends UseSessionAuthClient>(authClient: TClient, options?: UseSessionOptions): UseSessionResult<InferSessionData<TClient>>;
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
type UseStorageUploadInput = AthenaStorageFileUploadInput | AthenaStorageUploadSource | readonly AthenaStorageUploadSource[] | ArrayLike<AthenaStorageUploadSource>;
|
|
273
|
+
interface UseStorageUploadOptions extends Omit<Partial<AthenaStorageFileUploadInput>, 'files' | 'onProgress'> {
|
|
274
|
+
storage: Pick<AthenaStorageModule, 'file'>;
|
|
275
|
+
onProgress?: AthenaStorageUploadProgressHandler;
|
|
276
|
+
}
|
|
277
|
+
interface UseStorageUploadResult {
|
|
278
|
+
uploading: boolean;
|
|
279
|
+
progress: AthenaStorageUploadProgress | null;
|
|
280
|
+
percent: number;
|
|
281
|
+
error: unknown;
|
|
282
|
+
result: AthenaStorageFileUploadResult | null;
|
|
283
|
+
upload(input: UseStorageUploadInput, options?: AthenaStorageCallOptions): Promise<AthenaStorageFileUploadResult>;
|
|
284
|
+
abort(): void;
|
|
285
|
+
reset(): void;
|
|
286
|
+
}
|
|
287
|
+
declare function useStorageUpload(options: UseStorageUploadOptions): UseStorageUploadResult;
|
|
288
|
+
|
|
289
|
+
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 UseMutationOptions, type UseMutationResult, type UseQueryOptions, type UseQueryResult, type UseSessionOptions, type UseSessionResult, type UseStorageUploadInput, type UseStorageUploadOptions, type UseStorageUploadResult, attachStateAdapter, createAthenaQueryClient, useAthenaGateway, useAthenaQueryClient, useMutation, useQuery, useSession, useStorageUpload };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
1
|
+
import { O as AthenaGatewayHookConfig, P as AthenaGatewayHookResult } from './types-vikz9YIO.js';
|
|
2
|
+
export { Q as AthenaDeletePayload, V as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, W as AthenaGatewayResponse, X as AthenaInsertPayload, f as AthenaJsonArray, g as AthenaJsonObject, h as AthenaJsonPrimitive, i as AthenaJsonValue, k as AthenaRpcCallOptions, l as AthenaRpcFilter, m as AthenaRpcFilterOperator, n as AthenaRpcOrder, o as AthenaRpcPayload, Y as AthenaUpdatePayload } from './types-vikz9YIO.js';
|
|
3
|
+
import { ci as AthenaAuthFetchCompatibleInput, e as AthenaAuthCallOptions, Q as AthenaAuthSessionResponse, p as AthenaAuthErrorDetails, L as AthenaAuthResult, b4 as AthenaStorageFileUploadInput, be as AthenaStorageUploadSource, b6 as AthenaStorageModule, bd as AthenaStorageUploadProgressHandler, bc as AthenaStorageUploadProgress, b5 as AthenaStorageFileUploadResult, aT as AthenaStorageCallOptions } from './model-form-DXPlOnlI.js';
|
|
4
|
+
export { as as AthenaGatewayError, bz as ModelFormAdapter, bA as ModelFormDefaults, bB as ModelFormNullishMode, bC as ModelFormValues, bV as ToModelFormDefaultsOptions, bW as ToModelPayloadOptions, c3 as createModelFormAdapter, c5 as isAthenaGatewayError, cc as toModelFormDefaults, cd as toModelPayload } from './model-form-DXPlOnlI.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
7
|
|
|
@@ -269,4 +269,21 @@ type InferSessionData<TClient> = TClient extends {
|
|
|
269
269
|
*/
|
|
270
270
|
declare function useSession<TClient extends UseSessionAuthClient>(authClient: TClient, options?: UseSessionOptions): UseSessionResult<InferSessionData<TClient>>;
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
type UseStorageUploadInput = AthenaStorageFileUploadInput | AthenaStorageUploadSource | readonly AthenaStorageUploadSource[] | ArrayLike<AthenaStorageUploadSource>;
|
|
273
|
+
interface UseStorageUploadOptions extends Omit<Partial<AthenaStorageFileUploadInput>, 'files' | 'onProgress'> {
|
|
274
|
+
storage: Pick<AthenaStorageModule, 'file'>;
|
|
275
|
+
onProgress?: AthenaStorageUploadProgressHandler;
|
|
276
|
+
}
|
|
277
|
+
interface UseStorageUploadResult {
|
|
278
|
+
uploading: boolean;
|
|
279
|
+
progress: AthenaStorageUploadProgress | null;
|
|
280
|
+
percent: number;
|
|
281
|
+
error: unknown;
|
|
282
|
+
result: AthenaStorageFileUploadResult | null;
|
|
283
|
+
upload(input: UseStorageUploadInput, options?: AthenaStorageCallOptions): Promise<AthenaStorageFileUploadResult>;
|
|
284
|
+
abort(): void;
|
|
285
|
+
reset(): void;
|
|
286
|
+
}
|
|
287
|
+
declare function useStorageUpload(options: UseStorageUploadOptions): UseStorageUploadResult;
|
|
288
|
+
|
|
289
|
+
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 UseMutationOptions, type UseMutationResult, type UseQueryOptions, type UseQueryResult, type UseSessionOptions, type UseSessionResult, type UseStorageUploadInput, type UseStorageUploadOptions, type UseStorageUploadResult, attachStateAdapter, createAthenaQueryClient, useAthenaGateway, useAthenaQueryClient, useMutation, useQuery, useSession, useStorageUpload };
|
package/dist/react.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { createContext, useState, useMemo, useCallback, createElement, useContext, useRef, useEffect } from 'react';
|
|
2
3
|
import { useSyncExternalStore } from 'use-sync-external-store/shim';
|
|
3
4
|
|
|
@@ -149,16 +150,23 @@ var getSessionCookie = (request, config) => {
|
|
|
149
150
|
const { cookieName = "session_token", cookiePrefix = "athena-auth" } = {};
|
|
150
151
|
const parsedCookie = parseCookies(cookies);
|
|
151
152
|
const getCookie = (name) => parsedCookie.get(name) || parsedCookie.get(`${SECURE_COOKIE_PREFIX}${name}`);
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
const candidateCookieNames = Array.from(/* @__PURE__ */ new Set([
|
|
154
|
+
cookieName,
|
|
155
|
+
cookieName.replace(/_/g, "-"),
|
|
156
|
+
cookieName.replace(/-/g, "_")
|
|
157
|
+
])).filter(Boolean);
|
|
158
|
+
for (const candidateName of candidateCookieNames) {
|
|
159
|
+
const sessionToken = getCookie(`${cookiePrefix}.${candidateName}`) || getCookie(`${cookiePrefix}-${candidateName}`);
|
|
160
|
+
if (sessionToken) {
|
|
161
|
+
return sessionToken;
|
|
162
|
+
}
|
|
155
163
|
}
|
|
156
164
|
return null;
|
|
157
165
|
};
|
|
158
166
|
|
|
159
167
|
// package.json
|
|
160
168
|
var package_default = {
|
|
161
|
-
version: "2.
|
|
169
|
+
version: "2.8.0"
|
|
162
170
|
};
|
|
163
171
|
|
|
164
172
|
// src/sdk-version.ts
|
|
@@ -1921,6 +1929,85 @@ function useSession(authClient, options = {}) {
|
|
|
1921
1929
|
refetch
|
|
1922
1930
|
};
|
|
1923
1931
|
}
|
|
1932
|
+
function useStorageUpload(options) {
|
|
1933
|
+
const {
|
|
1934
|
+
storage,
|
|
1935
|
+
onProgress,
|
|
1936
|
+
...defaults
|
|
1937
|
+
} = options;
|
|
1938
|
+
const [uploading, setUploading] = React.useState(false);
|
|
1939
|
+
const [progress, setProgress] = React.useState(null);
|
|
1940
|
+
const [error, setError] = React.useState(null);
|
|
1941
|
+
const [result, setResult] = React.useState(null);
|
|
1942
|
+
const controllerRef = React.useRef(null);
|
|
1943
|
+
const reset = React.useCallback(() => {
|
|
1944
|
+
setUploading(false);
|
|
1945
|
+
setProgress(null);
|
|
1946
|
+
setError(null);
|
|
1947
|
+
setResult(null);
|
|
1948
|
+
}, []);
|
|
1949
|
+
const abort = React.useCallback(() => {
|
|
1950
|
+
controllerRef.current?.abort();
|
|
1951
|
+
controllerRef.current = null;
|
|
1952
|
+
}, []);
|
|
1953
|
+
const upload = React.useCallback(async (input, callOptions) => {
|
|
1954
|
+
const controller = callOptions?.signal ? null : new AbortController();
|
|
1955
|
+
controllerRef.current = controller;
|
|
1956
|
+
setUploading(true);
|
|
1957
|
+
setError(null);
|
|
1958
|
+
setResult(null);
|
|
1959
|
+
const request = normalizeHookUploadInput(defaults, input, (progressEvent) => {
|
|
1960
|
+
setProgress(progressEvent);
|
|
1961
|
+
onProgress?.(progressEvent);
|
|
1962
|
+
if (isStorageUploadInput(input)) {
|
|
1963
|
+
input.onProgress?.(progressEvent);
|
|
1964
|
+
}
|
|
1965
|
+
});
|
|
1966
|
+
try {
|
|
1967
|
+
const uploaded = await storage.file.upload(request, {
|
|
1968
|
+
...callOptions,
|
|
1969
|
+
signal: callOptions?.signal ?? controller?.signal
|
|
1970
|
+
});
|
|
1971
|
+
setResult(uploaded);
|
|
1972
|
+
return uploaded;
|
|
1973
|
+
} catch (uploadError) {
|
|
1974
|
+
setError(uploadError);
|
|
1975
|
+
throw uploadError;
|
|
1976
|
+
} finally {
|
|
1977
|
+
setUploading(false);
|
|
1978
|
+
if (controllerRef.current === controller) {
|
|
1979
|
+
controllerRef.current = null;
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
}, [defaults, onProgress, storage]);
|
|
1983
|
+
return {
|
|
1984
|
+
uploading,
|
|
1985
|
+
progress,
|
|
1986
|
+
percent: progress?.aggregatePercent ?? 0,
|
|
1987
|
+
error,
|
|
1988
|
+
result,
|
|
1989
|
+
upload,
|
|
1990
|
+
abort,
|
|
1991
|
+
reset
|
|
1992
|
+
};
|
|
1993
|
+
}
|
|
1994
|
+
function normalizeHookUploadInput(defaults, input, onProgress) {
|
|
1995
|
+
if (isStorageUploadInput(input)) {
|
|
1996
|
+
return {
|
|
1997
|
+
...defaults,
|
|
1998
|
+
...input,
|
|
1999
|
+
onProgress
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
return {
|
|
2003
|
+
...defaults,
|
|
2004
|
+
files: input,
|
|
2005
|
+
onProgress
|
|
2006
|
+
};
|
|
2007
|
+
}
|
|
2008
|
+
function isStorageUploadInput(input) {
|
|
2009
|
+
return Boolean(input) && typeof input === "object" && "files" in input && "s3_id" in input;
|
|
2010
|
+
}
|
|
1924
2011
|
|
|
1925
2012
|
// src/schema/model-form.ts
|
|
1926
2013
|
function resolveNullishValue(mode) {
|
|
@@ -1983,6 +2070,6 @@ function createModelFormAdapter(model) {
|
|
|
1983
2070
|
};
|
|
1984
2071
|
}
|
|
1985
2072
|
|
|
1986
|
-
export { AthenaGatewayError, AthenaQueryClient, AthenaQueryClientProvider, attachStateAdapter, createAthenaQueryClient, createModelFormAdapter, isAthenaGatewayError, toModelFormDefaults, toModelPayload, useAthenaGateway, useAthenaQueryClient, useMutation, useQuery, useSession };
|
|
2073
|
+
export { AthenaGatewayError, AthenaQueryClient, AthenaQueryClientProvider, attachStateAdapter, createAthenaQueryClient, createModelFormAdapter, isAthenaGatewayError, toModelFormDefaults, toModelPayload, useAthenaGateway, useAthenaQueryClient, useMutation, useQuery, useSession, useStorageUpload };
|
|
1987
2074
|
//# sourceMappingURL=react.js.map
|
|
1988
2075
|
//# sourceMappingURL=react.js.map
|