@xylex-group/athena 2.6.0 → 2.7.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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.cjs +837 -114
  3. package/dist/browser.cjs.map +1 -1
  4. package/dist/browser.d.cts +7 -7
  5. package/dist/browser.d.ts +7 -7
  6. package/dist/browser.js +837 -114
  7. package/dist/browser.js.map +1 -1
  8. package/dist/cli/index.cjs +830 -107
  9. package/dist/cli/index.cjs.map +1 -1
  10. package/dist/cli/index.d.cts +3 -3
  11. package/dist/cli/index.d.ts +3 -3
  12. package/dist/cli/index.js +830 -107
  13. package/dist/cli/index.js.map +1 -1
  14. package/dist/cookies.cjs +10 -3
  15. package/dist/cookies.cjs.map +1 -1
  16. package/dist/cookies.js +10 -3
  17. package/dist/cookies.js.map +1 -1
  18. package/dist/index.cjs +837 -114
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +7 -7
  21. package/dist/index.d.ts +7 -7
  22. package/dist/index.js +837 -114
  23. package/dist/index.js.map +1 -1
  24. package/dist/model-form-AKYrgede.d.ts +2772 -0
  25. package/dist/model-form-ehfqLuG7.d.cts +2772 -0
  26. package/dist/{pipeline-Ce3pTw5h.d.ts → pipeline-BUsR9XlO.d.ts} +1 -1
  27. package/dist/{pipeline-D1ZYeoH7.d.cts → pipeline-BfCWSRYl.d.cts} +1 -1
  28. package/dist/react-email-BQzmXBDE.d.cts +304 -0
  29. package/dist/react-email-BrVRp80B.d.ts +304 -0
  30. package/dist/react.cjs +178 -71
  31. package/dist/react.cjs.map +1 -1
  32. package/dist/react.d.cts +22 -5
  33. package/dist/react.d.ts +22 -5
  34. package/dist/react.js +92 -5
  35. package/dist/react.js.map +1 -1
  36. package/dist/{types-CUuo4NDi.d.cts → types-BSIsyss1.d.cts} +1 -1
  37. package/dist/{types-DSX6AT5B.d.cts → types-BsyRW49r.d.cts} +1 -1
  38. package/dist/{types-DSX6AT5B.d.ts → types-BsyRW49r.d.ts} +1 -1
  39. package/dist/{types-DapchQY5.d.ts → types-t_TVqnmp.d.ts} +1 -1
  40. package/package.json +193 -193
  41. package/dist/model-form-BaHWi3gm.d.cts +0 -1383
  42. package/dist/model-form-Dh6gWjL0.d.ts +0 -1383
  43. package/dist/react-email-B8O1Jeff.d.cts +0 -1230
  44. package/dist/react-email-CDEF0jij.d.ts +0 -1230
package/dist/react.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { Q as AthenaGatewayHookConfig, V as AthenaGatewayHookResult } from './types-DSX6AT5B.cjs';
2
- export { W as AthenaDeletePayload, X as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, Y as AthenaGatewayResponse, Z 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, _ as AthenaUpdatePayload } from './types-DSX6AT5B.cjs';
3
- import { ao as AthenaAuthFetchCompatibleInput, e as AthenaAuthCallOptions, Q as AthenaAuthSessionResponse, p as AthenaAuthErrorDetails, L as AthenaAuthResult } from './model-form-BaHWi3gm.cjs';
4
- export { a3 as AthenaGatewayError, ae as ModelFormAdapter, af as ModelFormDefaults, ag as ModelFormNullishMode, ah as ModelFormValues, ai as ToModelFormDefaultsOptions, aj as ToModelPayloadOptions, ak as createModelFormAdapter, al as isAthenaGatewayError, am as toModelFormDefaults, an as toModelPayload } from './model-form-BaHWi3gm.cjs';
1
+ import { K as AthenaGatewayHookConfig, L as AthenaGatewayHookResult } from './types-BsyRW49r.cjs';
2
+ export { N as AthenaDeletePayload, O as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, P as AthenaGatewayResponse, Q 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, V as AthenaUpdatePayload } from './types-BsyRW49r.cjs';
3
+ import { bY as AthenaAuthFetchCompatibleInput, e as AthenaAuthCallOptions, Q as AthenaAuthSessionResponse, p as AthenaAuthErrorDetails, L as AthenaAuthResult, aP as AthenaStorageFileUploadInput, aZ as AthenaStorageUploadSource, aR as AthenaStorageModule, aY as AthenaStorageUploadProgressHandler, aX as AthenaStorageUploadProgress, aQ as AthenaStorageFileUploadResult, aC as AthenaStorageCallOptions } from './model-form-ehfqLuG7.cjs';
4
+ export { ai as AthenaGatewayError, be as ModelFormAdapter, bf as ModelFormDefaults, bg as ModelFormNullishMode, bh as ModelFormValues, bA as ToModelFormDefaultsOptions, bB as ToModelPayloadOptions, bK as createModelFormAdapter, bL as isAthenaGatewayError, bS as toModelFormDefaults, bT as toModelPayload } from './model-form-ehfqLuG7.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
- 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, attachStateAdapter, createAthenaQueryClient, useAthenaGateway, useAthenaQueryClient, useMutation, useQuery, useSession };
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 { Q as AthenaGatewayHookConfig, V as AthenaGatewayHookResult } from './types-DSX6AT5B.js';
2
- export { W as AthenaDeletePayload, X as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, Y as AthenaGatewayResponse, Z 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, _ as AthenaUpdatePayload } from './types-DSX6AT5B.js';
3
- import { ao as AthenaAuthFetchCompatibleInput, e as AthenaAuthCallOptions, Q as AthenaAuthSessionResponse, p as AthenaAuthErrorDetails, L as AthenaAuthResult } from './model-form-Dh6gWjL0.js';
4
- export { a3 as AthenaGatewayError, ae as ModelFormAdapter, af as ModelFormDefaults, ag as ModelFormNullishMode, ah as ModelFormValues, ai as ToModelFormDefaultsOptions, aj as ToModelPayloadOptions, ak as createModelFormAdapter, al as isAthenaGatewayError, am as toModelFormDefaults, an as toModelPayload } from './model-form-Dh6gWjL0.js';
1
+ import { K as AthenaGatewayHookConfig, L as AthenaGatewayHookResult } from './types-BsyRW49r.js';
2
+ export { N as AthenaDeletePayload, O as AthenaFetchPayload, a as AthenaGatewayCallOptions, d as AthenaGatewayErrorCode, e as AthenaGatewayErrorDetails, P as AthenaGatewayResponse, Q 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, V as AthenaUpdatePayload } from './types-BsyRW49r.js';
3
+ import { bY as AthenaAuthFetchCompatibleInput, e as AthenaAuthCallOptions, Q as AthenaAuthSessionResponse, p as AthenaAuthErrorDetails, L as AthenaAuthResult, aP as AthenaStorageFileUploadInput, aZ as AthenaStorageUploadSource, aR as AthenaStorageModule, aY as AthenaStorageUploadProgressHandler, aX as AthenaStorageUploadProgress, aQ as AthenaStorageFileUploadResult, aC as AthenaStorageCallOptions } from './model-form-AKYrgede.js';
4
+ export { ai as AthenaGatewayError, be as ModelFormAdapter, bf as ModelFormDefaults, bg as ModelFormNullishMode, bh as ModelFormValues, bA as ToModelFormDefaultsOptions, bB as ToModelPayloadOptions, bK as createModelFormAdapter, bL as isAthenaGatewayError, bS as toModelFormDefaults, bT as toModelPayload } from './model-form-AKYrgede.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
- 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, attachStateAdapter, createAthenaQueryClient, useAthenaGateway, useAthenaQueryClient, useMutation, useQuery, useSession };
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 sessionToken = getCookie(`${cookiePrefix}.${cookieName}`) || getCookie(`${cookiePrefix}-${cookieName}`);
153
- if (sessionToken) {
154
- return sessionToken;
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.6.0"
169
+ version: "2.7.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