@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.
Files changed (82) hide show
  1. package/README.md +109 -1402
  2. package/dist/admin.d.cts +1 -1
  3. package/dist/admin.d.ts +1 -1
  4. package/dist/{athena-auth-url-oLux_57a.d.cts → athena-request-headers-C7Jy-c_D.d.ts} +85 -1
  5. package/dist/{athena-auth-url-oLux_57a.d.ts → athena-request-headers-DujFFyMU.d.cts} +85 -1
  6. package/dist/billing.cjs +1311 -0
  7. package/dist/billing.cjs.map +1 -0
  8. package/dist/billing.d.cts +270 -0
  9. package/dist/billing.d.ts +270 -0
  10. package/dist/billing.js +1306 -0
  11. package/dist/billing.js.map +1 -0
  12. package/dist/browser.cjs +9695 -9243
  13. package/dist/browser.cjs.map +1 -1
  14. package/dist/browser.d.cts +11 -10
  15. package/dist/browser.d.ts +11 -10
  16. package/dist/browser.js +9692 -9241
  17. package/dist/browser.js.map +1 -1
  18. package/dist/cli/index.cjs +8137 -7286
  19. package/dist/cli/index.cjs.map +1 -1
  20. package/dist/cli/index.d.cts +4 -4
  21. package/dist/cli/index.d.ts +4 -4
  22. package/dist/cli/index.js +8137 -7286
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/index.cjs +9718 -9260
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +11 -10
  27. package/dist/index.d.ts +11 -10
  28. package/dist/index.js +9711 -9258
  29. package/dist/index.js.map +1 -1
  30. package/dist/{model-form-DcH3R7WD.d.ts → model-form-Dh0sisdL.d.ts} +2 -2
  31. package/dist/{model-form-BE1_Bmdd.d.cts → model-form-oOAJUVd4.d.cts} +2 -2
  32. package/dist/{module-DFGZXCtt.d.cts → module-CB25egcO.d.cts} +18 -52
  33. package/dist/module-C_ab-MM1.d.cts +360 -0
  34. package/dist/module-C_ab-MM1.d.ts +360 -0
  35. package/dist/{module-Ca3_OQqR.d.ts → module-CkUM6v58.d.ts} +18 -52
  36. package/dist/next/client.cjs +9116 -8468
  37. package/dist/next/client.cjs.map +1 -1
  38. package/dist/next/client.d.cts +24 -25
  39. package/dist/next/client.d.ts +24 -25
  40. package/dist/next/client.js +9088 -8469
  41. package/dist/next/client.js.map +1 -1
  42. package/dist/next/server.cjs +8932 -7776
  43. package/dist/next/server.cjs.map +1 -1
  44. package/dist/next/server.d.cts +62 -43
  45. package/dist/next/server.d.ts +62 -43
  46. package/dist/next/server.js +8873 -7777
  47. package/dist/next/server.js.map +1 -1
  48. package/dist/{payload-BbSCmILD.d.ts → payload-DWI1rw-e.d.cts} +1 -35
  49. package/dist/{payload-zXIwKTQf.d.cts → payload-DWI1rw-e.d.ts} +1 -35
  50. package/dist/{pipeline-DqwehoQV.d.ts → pipeline-B8aN2EHe.d.ts} +1 -1
  51. package/dist/{pipeline-CwQoD5G9.d.cts → pipeline-D4W-Cc-A.d.cts} +1 -1
  52. package/dist/proxy-request-headers-DGxdoyA0.d.cts +59 -0
  53. package/dist/proxy-request-headers-m4D2Tduy.d.ts +59 -0
  54. package/dist/react.cjs +118 -17
  55. package/dist/react.cjs.map +1 -1
  56. package/dist/react.d.cts +46 -16
  57. package/dist/react.d.ts +46 -16
  58. package/dist/react.js +117 -18
  59. package/dist/react.js.map +1 -1
  60. package/dist/social-providers.cjs +24 -20
  61. package/dist/social-providers.cjs.map +1 -1
  62. package/dist/social-providers.d.cts +96 -139
  63. package/dist/social-providers.d.ts +96 -139
  64. package/dist/social-providers.js +24 -20
  65. package/dist/social-providers.js.map +1 -1
  66. package/dist/{types-eAKAh71s.d.cts → types-AOY-GLu8.d.cts} +27 -54
  67. package/dist/{types-eAKAh71s.d.ts → types-AOY-GLu8.d.ts} +27 -54
  68. package/dist/{types-CD6K05JQ.d.ts → types-B75PdABb.d.ts} +3 -3
  69. package/dist/{types-dHnjluBC.d.cts → types-BBm-kEBL.d.cts} +2 -2
  70. package/dist/{types-C1swabT5.d.ts → types-BaAMXCqK.d.ts} +2 -2
  71. package/dist/{types-YQUR7wu0.d.cts → types-Bltx6iL6.d.cts} +3 -5
  72. package/dist/{types-YQUR7wu0.d.ts → types-Bltx6iL6.d.ts} +3 -5
  73. package/dist/{types-6H575ITc.d.cts → types-CgCv5o6R.d.cts} +3 -3
  74. package/dist/utils.cjs +7 -8
  75. package/dist/utils.cjs.map +1 -1
  76. package/dist/utils.d.cts +4 -145
  77. package/dist/utils.d.ts +4 -145
  78. package/dist/utils.js +7 -8
  79. package/dist/utils.js.map +1 -1
  80. package/dist/{client-wU2J9yqb.d.cts → v3-client-CWfZHcKL.d.cts} +402 -521
  81. package/dist/{client-uthENhaf.d.ts → v3-client-DZp2NEhK.d.ts} +402 -521
  82. package/package.json +15 -3
@@ -1,10 +1,14 @@
1
- import { al as AthenaClientSessionLike, aX as AthenaSdkClientWithStorage, aW as AthenaSdkClientWithAuth } from '../client-wU2J9yqb.cjs';
2
- import { ae as AthenaAuthSessionResponse } from '../types-eAKAh71s.cjs';
3
- import { i as AthenaAuthSessionBridgeOptions, j as AthenaAuthSessionBridgePathOptions, A as AthenaAdapterBaseOptions, k as AthenaServerRequestOptions, a as AthenaAdapterExperimentalOptions } from '../payload-zXIwKTQf.cjs';
4
- export { b as ATHENA_AUTH_SESSION_BRIDGE_ROUTE, c as ATHENA_AUTH_SESSION_COOKIE_NAME, d as ATHENA_AUTH_SESSION_COOKIE_NAMES, e as AthenaAuthSessionBridgeClientOptions, f as AthenaAuthSessionBridgePayload, g as AthenaAuthSessionBridgeSource, h as clearAthenaAuthSessionOnAppHost, p as persistAthenaAuthSessionOnAppHost, r as resolveSessionBridgePayload } from '../payload-zXIwKTQf.cjs';
1
+ import { ad as AthenaAuthSessionResponse } from '../types-AOY-GLu8.cjs';
2
+ import { r as AthenaClientModelsInput } from '../types-CgCv5o6R.cjs';
3
+ import { ax as AthenaRequestContext, ah as AthenaClientConfig, ag as AthenaClient } from '../v3-client-CWfZHcKL.cjs';
4
+ import { g as AthenaAuthSessionBridgeOptions, h as AthenaAuthSessionBridgePathOptions } from '../payload-DWI1rw-e.cjs';
5
+ export { A as ATHENA_AUTH_SESSION_BRIDGE_ROUTE, a as ATHENA_AUTH_SESSION_COOKIE_NAME, b as ATHENA_AUTH_SESSION_COOKIE_NAMES, c as AthenaAuthSessionBridgeClientOptions, d as AthenaAuthSessionBridgePayload, e as AthenaAuthSessionBridgeSource, f as clearAthenaAuthSessionOnAppHost, p as persistAthenaAuthSessionOnAppHost, r as resolveSessionBridgePayload } from '../payload-DWI1rw-e.cjs';
5
6
  export { S as SESSION_COOKIE_PATTERNS, h as hasAuthSessionCookie } from '../session-cookie-detection-BqOp9mO6.cjs';
6
- import '../types-YQUR7wu0.cjs';
7
- import '../types-6H575ITc.cjs';
7
+ export { A as ATHENA_AUTH_COOKIE_PREFIXES, a as ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_PARAM, b as ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_VALUE, c as ATHENA_AUTH_GET_SESSION_ABSOLUTE_PATH, d as ATHENA_AUTH_GET_SESSION_PATH, e as ATHENA_AUTH_PATH, f as ATHENA_AUTH_UPSTREAM_ENV_KEYS, g as ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES, h as ATHENA_AUTH_VERIFY_EMAIL_PATH, i as ATHENA_SESSION_DATA_HEADER, j as AUTHENTICATED_REDIRECT_MODE_SET, k as AUTHENTICATED_REDIRECT_VIEW_SET, l as AUTH_DEFAULT_VIEW, m as AUTH_MODE_REDIRECTS, n as AUTH_MODE_SET, o as AUTH_ROUTES, p as AUTH_SESSION_PATH, q as AUTH_TWO_FACTOR_SEGMENT, r as AUTH_VIEW_BY_SEGMENT, s as AthenaAuthClientBaseUrlOptions, t as AthenaAuthUpstreamEnv, u as AthenaAuthUpstreamEnvKey, v as AthenaRequestHeaderOverrideFields, w as AthenaRequestHeaderProfile, x as AuthMode, y as AuthModeRedirects, z as AuthRoutes, B as AuthView, C as BuildAthenaRequestHeadersInput, D as ClearAuthCookiesOptions, E as DEFAULT_ATHENA_AUTH_ORIGIN, F as DEFAULT_ATHENA_AUTH_UPSTREAM_URL, G as DISABLE_COOKIE_CACHE_QUERY_PARAM, H as DISABLE_COOKIE_CACHE_QUERY_VALUE, I as EnvLike, L as LOCAL_DEV_ORIGIN, a4 as ResolvedRequestHeaderOverrides, S as SESSION_DATA_HEADER, a5 as applyAthenaApiKeyHeaders, a6 as applyAthenaAuthContextHeaders, a7 as applyAthenaPgUriHeaders, J as asNonEmptyString, K as asString, M as buildAthenaGatewayHeaders, N as buildAthenaRequestHeaders, a8 as buildServiceRequestHeaders, O as clearAuthCookies, P as createAuthModeRedirects, Q as createAuthRoutes, R as createFreshSessionLookupUrl, a9 as hasHeaderIgnoreCase, T as isAbsoluteUrl, U as isAuthMode, V as normalizeAthenaAuthBaseUrl, W as readAthenaAuthUpstreamUrlFromEnv, X as readTrimmedString, Y as resolveAthenaAuthClientBaseUrl, Z as resolveAthenaAuthRequestUrl, _ as resolveAthenaAuthUpstreamUrl, $ as resolveAuthModeRedirect, a0 as resolveAuthViewFromSegment, a1 as resolveEmailVerificationCallbackUrl, aa as resolveHeaderValue, ab as resolveRequestHeaderOverrides, a2 as shouldRedirectAuthenticatedAuthMode, a3 as shouldRedirectAuthenticatedAuthView } from '../athena-request-headers-DujFFyMU.cjs';
8
+ export { G as GetOriginFromHeadersOptions, g as getOriginFromHeaders, i as isDynamicServerUsageError, p as proxyRequestHeaders, r as readEnv, a as requireEnv } from '../proxy-request-headers-DGxdoyA0.cjs';
9
+ export { ActiveOrganizationSessionLike, EnsureActiveOrganizationOptions, EnsureActiveOrganizationResult, OrganizationLike, ensureActiveOrganization } from '../organization.cjs';
10
+ import '../types-Bltx6iL6.cjs';
11
+ import '../module-C_ab-MM1.cjs';
8
12
 
9
13
  /**
10
14
  * Handle bridge `POST` — set an httpOnly session cookie from JSON body.
@@ -79,51 +83,66 @@ declare function createAthenaAuthSessionBridgePathHandlers(options?: AthenaAuthS
79
83
  DELETE: (request: Request) => Response;
80
84
  };
81
85
 
82
- interface AthenaServerClientOptions extends AthenaAdapterBaseOptions, AthenaServerRequestOptions {
83
- session?: AthenaClientSessionLike | AthenaAuthSessionResponse | null;
86
+ interface AthenaRequestHeadersBag {
87
+ get(name: string): string | null;
84
88
  }
85
- interface AthenaServerContextOptions extends AthenaAdapterBaseOptions, AthenaServerRequestOptions {
89
+ interface AthenaRequestCookiesBag {
90
+ getAll(): Array<{
91
+ name: string;
92
+ value: string;
93
+ }>;
94
+ }
95
+ type AthenaRequestHeadersInput = AthenaRequestHeadersBag | Record<string, string | null | undefined>;
96
+ type AthenaRequestCookiesInput = AthenaRequestCookiesBag | string | null | undefined;
97
+ interface AthenaServerRequestOptions {
98
+ requestHeaders?: AthenaRequestHeadersInput;
99
+ requestCookies?: AthenaRequestCookiesInput;
100
+ forceNoCache?: boolean;
101
+ headers?: Record<string, string>;
102
+ }
103
+ declare function resolveNextRequestContext(options?: AthenaServerRequestOptions): Promise<AthenaRequestContext>;
104
+
105
+ interface AthenaServerContextOptions extends AthenaServerRequestOptions {
86
106
  session?: AthenaAuthSessionResponse | null;
87
107
  }
88
- interface AthenaResolvedServerContext<TClient> {
89
- client: TClient;
108
+ interface AthenaResolvedServerContext {
109
+ request: AthenaRequestContext;
90
110
  session: AthenaAuthSessionResponse | null;
91
111
  userId: string | null;
92
112
  organizationId: string | null;
93
113
  }
94
- type AthenaServerClientOptionsWithStorage = AthenaServerClientOptions & {
95
- storage: true;
96
- };
97
- type AthenaServerClientOptionsWithTypecheckedColumns = AthenaServerClientOptions & {
98
- experimental: AthenaAdapterExperimentalOptions & {
99
- typecheckColumns: true;
100
- };
101
- };
102
- type AthenaServerClientOptionsWithStorageAndTypecheckedColumns = AthenaServerClientOptionsWithStorage & {
103
- experimental: AthenaAdapterExperimentalOptions & {
104
- typecheckColumns: true;
105
- };
106
- };
107
- type AthenaServerContextOptionsWithStorage = AthenaServerContextOptions & {
108
- storage: true;
114
+ declare function resolveAthenaServerContext(options?: AthenaServerContextOptions): Promise<AthenaResolvedServerContext>;
115
+ type AthenaBaseServerOptions = AthenaServerRequestOptions & {
116
+ session?: AthenaAuthSessionResponse | null;
109
117
  };
110
- type AthenaServerContextOptionsWithTypecheckedColumns = AthenaServerContextOptions & {
111
- experimental: AthenaAdapterExperimentalOptions & {
112
- typecheckColumns: true;
113
- };
118
+ /**
119
+ * Explicit server config: require url + key at the call site.
120
+ */
121
+ type AthenaExplicitServerConfig<TModels extends AthenaClientModelsInput | undefined = undefined> = AthenaBaseServerOptions & AthenaClientConfig<TModels> & {
122
+ url: string;
123
+ key: string;
114
124
  };
115
- type AthenaServerContextOptionsWithStorageAndTypecheckedColumns = AthenaServerContextOptionsWithStorage & {
116
- experimental: AthenaAdapterExperimentalOptions & {
117
- typecheckColumns: true;
118
- };
125
+ /**
126
+ * Environment server config: require an explicit env object (no silent global process.env).
127
+ */
128
+ type AthenaEnvironmentServerConfig<TModels extends AthenaClientModelsInput | undefined = undefined> = AthenaBaseServerOptions & Omit<AthenaClientConfig<TModels>, 'url' | 'key'> & {
129
+ env: Record<string, string | undefined>;
119
130
  };
120
- declare function createAthenaServerClient(options: AthenaServerClientOptionsWithStorageAndTypecheckedColumns): Promise<AthenaSdkClientWithStorage<true>>;
121
- declare function createAthenaServerClient(options: AthenaServerClientOptionsWithStorage): Promise<AthenaSdkClientWithStorage<false>>;
122
- declare function createAthenaServerClient(options: AthenaServerClientOptionsWithTypecheckedColumns): Promise<AthenaSdkClientWithAuth<true>>;
123
- declare function createAthenaServerClient(options?: AthenaServerClientOptions): Promise<AthenaSdkClientWithAuth<false>>;
124
- declare function resolveAthenaServerContext(options: AthenaServerContextOptionsWithStorageAndTypecheckedColumns): Promise<AthenaResolvedServerContext<AthenaSdkClientWithStorage<true>>>;
125
- declare function resolveAthenaServerContext(options: AthenaServerContextOptionsWithStorage): Promise<AthenaResolvedServerContext<AthenaSdkClientWithStorage<false>>>;
126
- declare function resolveAthenaServerContext(options: AthenaServerContextOptionsWithTypecheckedColumns): Promise<AthenaResolvedServerContext<AthenaSdkClientWithAuth<true>>>;
127
- declare function resolveAthenaServerContext(options?: AthenaServerContextOptions): Promise<AthenaResolvedServerContext<AthenaSdkClientWithAuth<false>>>;
131
+ /**
132
+ * Flat Next server client options: client config fields + request context options.
133
+ * Requires either `{ url, key }` or `{ env }`.
134
+ */
135
+ type AthenaServerClientConfig<TModels extends AthenaClientModelsInput | undefined = undefined> = AthenaExplicitServerConfig<TModels> | AthenaEnvironmentServerConfig<TModels>;
136
+ /**
137
+ * Request-scoped Next server façade over {@link createClient}.
138
+ *
139
+ * Resolves cookies, bearer tokens, optional session identity, and cache policy
140
+ * on every invocation, merges with any application-level context, then
141
+ * materializes the client through the singular `createClient` primitive.
142
+ *
143
+ * Does not cache clients. Call once per Server Component / Server Action /
144
+ * Route Handler request (or pass explicit requestHeaders/requestCookies).
145
+ */
146
+ declare function createAthenaServerClient<const TModels extends AthenaClientModelsInput | undefined = undefined>(options: AthenaServerClientConfig<TModels>): Promise<AthenaClient<TModels>>;
128
147
 
129
- export { AthenaAuthSessionBridgeOptions, AthenaAuthSessionBridgePathOptions, type AthenaResolvedServerContext, type AthenaServerClientOptions, type AthenaServerContextOptions, createAthenaAuthSessionBridgeHandlers, createAthenaAuthSessionBridgePathHandlers, createAthenaServerClient, handleAthenaAuthSessionBridgeDelete, handleAthenaAuthSessionBridgePost, isAthenaAuthSessionBridgePath, resolveAthenaServerContext };
148
+ export { AthenaAuthSessionBridgeOptions, AthenaAuthSessionBridgePathOptions, type AthenaEnvironmentServerConfig, type AthenaExplicitServerConfig, type AthenaRequestCookiesBag, type AthenaRequestCookiesInput, type AthenaRequestHeadersBag, type AthenaRequestHeadersInput, type AthenaResolvedServerContext, type AthenaServerClientConfig, type AthenaServerContextOptions, type AthenaServerRequestOptions, createAthenaAuthSessionBridgeHandlers, createAthenaAuthSessionBridgePathHandlers, createAthenaServerClient, handleAthenaAuthSessionBridgeDelete, handleAthenaAuthSessionBridgePost, isAthenaAuthSessionBridgePath, resolveAthenaServerContext, resolveNextRequestContext };
@@ -1,10 +1,14 @@
1
- import { al as AthenaClientSessionLike, aX as AthenaSdkClientWithStorage, aW as AthenaSdkClientWithAuth } from '../client-uthENhaf.js';
2
- import { ae as AthenaAuthSessionResponse } from '../types-eAKAh71s.js';
3
- import { i as AthenaAuthSessionBridgeOptions, j as AthenaAuthSessionBridgePathOptions, A as AthenaAdapterBaseOptions, k as AthenaServerRequestOptions, a as AthenaAdapterExperimentalOptions } from '../payload-BbSCmILD.js';
4
- export { b as ATHENA_AUTH_SESSION_BRIDGE_ROUTE, c as ATHENA_AUTH_SESSION_COOKIE_NAME, d as ATHENA_AUTH_SESSION_COOKIE_NAMES, e as AthenaAuthSessionBridgeClientOptions, f as AthenaAuthSessionBridgePayload, g as AthenaAuthSessionBridgeSource, h as clearAthenaAuthSessionOnAppHost, p as persistAthenaAuthSessionOnAppHost, r as resolveSessionBridgePayload } from '../payload-BbSCmILD.js';
1
+ import { ad as AthenaAuthSessionResponse } from '../types-AOY-GLu8.js';
2
+ import { r as AthenaClientModelsInput } from '../types-B75PdABb.js';
3
+ import { ax as AthenaRequestContext, ah as AthenaClientConfig, ag as AthenaClient } from '../v3-client-DZp2NEhK.js';
4
+ import { g as AthenaAuthSessionBridgeOptions, h as AthenaAuthSessionBridgePathOptions } from '../payload-DWI1rw-e.js';
5
+ export { A as ATHENA_AUTH_SESSION_BRIDGE_ROUTE, a as ATHENA_AUTH_SESSION_COOKIE_NAME, b as ATHENA_AUTH_SESSION_COOKIE_NAMES, c as AthenaAuthSessionBridgeClientOptions, d as AthenaAuthSessionBridgePayload, e as AthenaAuthSessionBridgeSource, f as clearAthenaAuthSessionOnAppHost, p as persistAthenaAuthSessionOnAppHost, r as resolveSessionBridgePayload } from '../payload-DWI1rw-e.js';
5
6
  export { S as SESSION_COOKIE_PATTERNS, h as hasAuthSessionCookie } from '../session-cookie-detection-BqOp9mO6.js';
6
- import '../types-YQUR7wu0.js';
7
- import '../types-CD6K05JQ.js';
7
+ export { A as ATHENA_AUTH_COOKIE_PREFIXES, a as ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_PARAM, b as ATHENA_AUTH_DISABLE_COOKIE_CACHE_QUERY_VALUE, c as ATHENA_AUTH_GET_SESSION_ABSOLUTE_PATH, d as ATHENA_AUTH_GET_SESSION_PATH, e as ATHENA_AUTH_PATH, f as ATHENA_AUTH_UPSTREAM_ENV_KEYS, g as ATHENA_AUTH_UPSTREAM_URL_ENV_NAMES, h as ATHENA_AUTH_VERIFY_EMAIL_PATH, i as ATHENA_SESSION_DATA_HEADER, j as AUTHENTICATED_REDIRECT_MODE_SET, k as AUTHENTICATED_REDIRECT_VIEW_SET, l as AUTH_DEFAULT_VIEW, m as AUTH_MODE_REDIRECTS, n as AUTH_MODE_SET, o as AUTH_ROUTES, p as AUTH_SESSION_PATH, q as AUTH_TWO_FACTOR_SEGMENT, r as AUTH_VIEW_BY_SEGMENT, s as AthenaAuthClientBaseUrlOptions, t as AthenaAuthUpstreamEnv, u as AthenaAuthUpstreamEnvKey, v as AthenaRequestHeaderOverrideFields, w as AthenaRequestHeaderProfile, x as AuthMode, y as AuthModeRedirects, z as AuthRoutes, B as AuthView, C as BuildAthenaRequestHeadersInput, D as ClearAuthCookiesOptions, E as DEFAULT_ATHENA_AUTH_ORIGIN, F as DEFAULT_ATHENA_AUTH_UPSTREAM_URL, G as DISABLE_COOKIE_CACHE_QUERY_PARAM, H as DISABLE_COOKIE_CACHE_QUERY_VALUE, I as EnvLike, L as LOCAL_DEV_ORIGIN, a4 as ResolvedRequestHeaderOverrides, S as SESSION_DATA_HEADER, a5 as applyAthenaApiKeyHeaders, a6 as applyAthenaAuthContextHeaders, a7 as applyAthenaPgUriHeaders, J as asNonEmptyString, K as asString, M as buildAthenaGatewayHeaders, N as buildAthenaRequestHeaders, a8 as buildServiceRequestHeaders, O as clearAuthCookies, P as createAuthModeRedirects, Q as createAuthRoutes, R as createFreshSessionLookupUrl, a9 as hasHeaderIgnoreCase, T as isAbsoluteUrl, U as isAuthMode, V as normalizeAthenaAuthBaseUrl, W as readAthenaAuthUpstreamUrlFromEnv, X as readTrimmedString, Y as resolveAthenaAuthClientBaseUrl, Z as resolveAthenaAuthRequestUrl, _ as resolveAthenaAuthUpstreamUrl, $ as resolveAuthModeRedirect, a0 as resolveAuthViewFromSegment, a1 as resolveEmailVerificationCallbackUrl, aa as resolveHeaderValue, ab as resolveRequestHeaderOverrides, a2 as shouldRedirectAuthenticatedAuthMode, a3 as shouldRedirectAuthenticatedAuthView } from '../athena-request-headers-C7Jy-c_D.js';
8
+ export { G as GetOriginFromHeadersOptions, g as getOriginFromHeaders, i as isDynamicServerUsageError, p as proxyRequestHeaders, r as readEnv, a as requireEnv } from '../proxy-request-headers-m4D2Tduy.js';
9
+ export { ActiveOrganizationSessionLike, EnsureActiveOrganizationOptions, EnsureActiveOrganizationResult, OrganizationLike, ensureActiveOrganization } from '../organization.js';
10
+ import '../types-Bltx6iL6.js';
11
+ import '../module-C_ab-MM1.js';
8
12
 
9
13
  /**
10
14
  * Handle bridge `POST` — set an httpOnly session cookie from JSON body.
@@ -79,51 +83,66 @@ declare function createAthenaAuthSessionBridgePathHandlers(options?: AthenaAuthS
79
83
  DELETE: (request: Request) => Response;
80
84
  };
81
85
 
82
- interface AthenaServerClientOptions extends AthenaAdapterBaseOptions, AthenaServerRequestOptions {
83
- session?: AthenaClientSessionLike | AthenaAuthSessionResponse | null;
86
+ interface AthenaRequestHeadersBag {
87
+ get(name: string): string | null;
84
88
  }
85
- interface AthenaServerContextOptions extends AthenaAdapterBaseOptions, AthenaServerRequestOptions {
89
+ interface AthenaRequestCookiesBag {
90
+ getAll(): Array<{
91
+ name: string;
92
+ value: string;
93
+ }>;
94
+ }
95
+ type AthenaRequestHeadersInput = AthenaRequestHeadersBag | Record<string, string | null | undefined>;
96
+ type AthenaRequestCookiesInput = AthenaRequestCookiesBag | string | null | undefined;
97
+ interface AthenaServerRequestOptions {
98
+ requestHeaders?: AthenaRequestHeadersInput;
99
+ requestCookies?: AthenaRequestCookiesInput;
100
+ forceNoCache?: boolean;
101
+ headers?: Record<string, string>;
102
+ }
103
+ declare function resolveNextRequestContext(options?: AthenaServerRequestOptions): Promise<AthenaRequestContext>;
104
+
105
+ interface AthenaServerContextOptions extends AthenaServerRequestOptions {
86
106
  session?: AthenaAuthSessionResponse | null;
87
107
  }
88
- interface AthenaResolvedServerContext<TClient> {
89
- client: TClient;
108
+ interface AthenaResolvedServerContext {
109
+ request: AthenaRequestContext;
90
110
  session: AthenaAuthSessionResponse | null;
91
111
  userId: string | null;
92
112
  organizationId: string | null;
93
113
  }
94
- type AthenaServerClientOptionsWithStorage = AthenaServerClientOptions & {
95
- storage: true;
96
- };
97
- type AthenaServerClientOptionsWithTypecheckedColumns = AthenaServerClientOptions & {
98
- experimental: AthenaAdapterExperimentalOptions & {
99
- typecheckColumns: true;
100
- };
101
- };
102
- type AthenaServerClientOptionsWithStorageAndTypecheckedColumns = AthenaServerClientOptionsWithStorage & {
103
- experimental: AthenaAdapterExperimentalOptions & {
104
- typecheckColumns: true;
105
- };
106
- };
107
- type AthenaServerContextOptionsWithStorage = AthenaServerContextOptions & {
108
- storage: true;
114
+ declare function resolveAthenaServerContext(options?: AthenaServerContextOptions): Promise<AthenaResolvedServerContext>;
115
+ type AthenaBaseServerOptions = AthenaServerRequestOptions & {
116
+ session?: AthenaAuthSessionResponse | null;
109
117
  };
110
- type AthenaServerContextOptionsWithTypecheckedColumns = AthenaServerContextOptions & {
111
- experimental: AthenaAdapterExperimentalOptions & {
112
- typecheckColumns: true;
113
- };
118
+ /**
119
+ * Explicit server config: require url + key at the call site.
120
+ */
121
+ type AthenaExplicitServerConfig<TModels extends AthenaClientModelsInput | undefined = undefined> = AthenaBaseServerOptions & AthenaClientConfig<TModels> & {
122
+ url: string;
123
+ key: string;
114
124
  };
115
- type AthenaServerContextOptionsWithStorageAndTypecheckedColumns = AthenaServerContextOptionsWithStorage & {
116
- experimental: AthenaAdapterExperimentalOptions & {
117
- typecheckColumns: true;
118
- };
125
+ /**
126
+ * Environment server config: require an explicit env object (no silent global process.env).
127
+ */
128
+ type AthenaEnvironmentServerConfig<TModels extends AthenaClientModelsInput | undefined = undefined> = AthenaBaseServerOptions & Omit<AthenaClientConfig<TModels>, 'url' | 'key'> & {
129
+ env: Record<string, string | undefined>;
119
130
  };
120
- declare function createAthenaServerClient(options: AthenaServerClientOptionsWithStorageAndTypecheckedColumns): Promise<AthenaSdkClientWithStorage<true>>;
121
- declare function createAthenaServerClient(options: AthenaServerClientOptionsWithStorage): Promise<AthenaSdkClientWithStorage<false>>;
122
- declare function createAthenaServerClient(options: AthenaServerClientOptionsWithTypecheckedColumns): Promise<AthenaSdkClientWithAuth<true>>;
123
- declare function createAthenaServerClient(options?: AthenaServerClientOptions): Promise<AthenaSdkClientWithAuth<false>>;
124
- declare function resolveAthenaServerContext(options: AthenaServerContextOptionsWithStorageAndTypecheckedColumns): Promise<AthenaResolvedServerContext<AthenaSdkClientWithStorage<true>>>;
125
- declare function resolveAthenaServerContext(options: AthenaServerContextOptionsWithStorage): Promise<AthenaResolvedServerContext<AthenaSdkClientWithStorage<false>>>;
126
- declare function resolveAthenaServerContext(options: AthenaServerContextOptionsWithTypecheckedColumns): Promise<AthenaResolvedServerContext<AthenaSdkClientWithAuth<true>>>;
127
- declare function resolveAthenaServerContext(options?: AthenaServerContextOptions): Promise<AthenaResolvedServerContext<AthenaSdkClientWithAuth<false>>>;
131
+ /**
132
+ * Flat Next server client options: client config fields + request context options.
133
+ * Requires either `{ url, key }` or `{ env }`.
134
+ */
135
+ type AthenaServerClientConfig<TModels extends AthenaClientModelsInput | undefined = undefined> = AthenaExplicitServerConfig<TModels> | AthenaEnvironmentServerConfig<TModels>;
136
+ /**
137
+ * Request-scoped Next server façade over {@link createClient}.
138
+ *
139
+ * Resolves cookies, bearer tokens, optional session identity, and cache policy
140
+ * on every invocation, merges with any application-level context, then
141
+ * materializes the client through the singular `createClient` primitive.
142
+ *
143
+ * Does not cache clients. Call once per Server Component / Server Action /
144
+ * Route Handler request (or pass explicit requestHeaders/requestCookies).
145
+ */
146
+ declare function createAthenaServerClient<const TModels extends AthenaClientModelsInput | undefined = undefined>(options: AthenaServerClientConfig<TModels>): Promise<AthenaClient<TModels>>;
128
147
 
129
- export { AthenaAuthSessionBridgeOptions, AthenaAuthSessionBridgePathOptions, type AthenaResolvedServerContext, type AthenaServerClientOptions, type AthenaServerContextOptions, createAthenaAuthSessionBridgeHandlers, createAthenaAuthSessionBridgePathHandlers, createAthenaServerClient, handleAthenaAuthSessionBridgeDelete, handleAthenaAuthSessionBridgePost, isAthenaAuthSessionBridgePath, resolveAthenaServerContext };
148
+ export { AthenaAuthSessionBridgeOptions, AthenaAuthSessionBridgePathOptions, type AthenaEnvironmentServerConfig, type AthenaExplicitServerConfig, type AthenaRequestCookiesBag, type AthenaRequestCookiesInput, type AthenaRequestHeadersBag, type AthenaRequestHeadersInput, type AthenaResolvedServerContext, type AthenaServerClientConfig, type AthenaServerContextOptions, type AthenaServerRequestOptions, createAthenaAuthSessionBridgeHandlers, createAthenaAuthSessionBridgePathHandlers, createAthenaServerClient, handleAthenaAuthSessionBridgeDelete, handleAthenaAuthSessionBridgePost, isAthenaAuthSessionBridgePath, resolveAthenaServerContext, resolveNextRequestContext };