@xylex-group/athena 2.12.1 → 2.13.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 (96) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1190 -1184
  3. package/bin/athena-js.js +104 -76
  4. package/dist/admin.cjs +45 -0
  5. package/dist/admin.cjs.map +1 -0
  6. package/dist/admin.d.cts +64 -0
  7. package/dist/admin.d.ts +64 -0
  8. package/dist/admin.js +41 -0
  9. package/dist/admin.js.map +1 -0
  10. package/dist/athena-auth-url-oLux_57a.d.cts +377 -0
  11. package/dist/athena-auth-url-oLux_57a.d.ts +377 -0
  12. package/dist/browser.cjs +33 -49
  13. package/dist/browser.cjs.map +1 -1
  14. package/dist/browser.d.cts +12 -10
  15. package/dist/browser.d.ts +12 -10
  16. package/dist/browser.js +33 -49
  17. package/dist/browser.js.map +1 -1
  18. package/dist/cli/index.cjs +150 -51
  19. package/dist/cli/index.cjs.map +1 -1
  20. package/dist/cli/index.d.cts +14 -5
  21. package/dist/cli/index.d.ts +14 -5
  22. package/dist/cli/index.js +150 -52
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/{client-CMtx5P4D.d.cts → client-BJjUwDSg.d.cts} +109 -1448
  25. package/dist/{client-Dre8H24u.d.ts → client-DVOKSYDI.d.ts} +109 -1448
  26. package/dist/cookies.cjs +18 -0
  27. package/dist/cookies.cjs.map +1 -1
  28. package/dist/cookies.d.cts +2 -1
  29. package/dist/cookies.d.ts +2 -1
  30. package/dist/cookies.js +17 -1
  31. package/dist/cookies.js.map +1 -1
  32. package/dist/{index-CVcQCGyG.d.ts → index-CFL9xbFR.d.cts} +2 -0
  33. package/dist/{index-CVcQCGyG.d.cts → index-UKJpunc6.d.ts} +2 -0
  34. package/dist/index.cjs +101 -49
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +13 -10
  37. package/dist/index.d.ts +13 -10
  38. package/dist/index.js +101 -50
  39. package/dist/index.js.map +1 -1
  40. package/dist/{model-form-DfTi8-D1.d.cts → model-form-Dw4zEL5a.d.cts} +2 -2
  41. package/dist/{model-form-CU0mWrF9.d.ts → model-form-yRg71q3H.d.ts} +2 -2
  42. package/dist/{module-DBGmbIuh.d.ts → module-DBteUIob.d.ts} +12 -9
  43. package/dist/{module-GoijrBXV.d.cts → module-yoX49uQC.d.cts} +12 -9
  44. package/dist/next/client.cjs +452 -49
  45. package/dist/next/client.cjs.map +1 -1
  46. package/dist/next/client.d.cts +7 -4
  47. package/dist/next/client.d.ts +7 -4
  48. package/dist/next/client.js +430 -50
  49. package/dist/next/client.js.map +1 -1
  50. package/dist/next/server.cjs +292 -49
  51. package/dist/next/server.cjs.map +1 -1
  52. package/dist/next/server.d.cts +81 -5
  53. package/dist/next/server.d.ts +81 -5
  54. package/dist/next/server.js +280 -50
  55. package/dist/next/server.js.map +1 -1
  56. package/dist/organization.cjs +72 -0
  57. package/dist/organization.cjs.map +1 -0
  58. package/dist/organization.d.cts +43 -0
  59. package/dist/organization.d.ts +43 -0
  60. package/dist/organization.js +70 -0
  61. package/dist/organization.js.map +1 -0
  62. package/dist/payload-BzVbUgY_.d.cts +219 -0
  63. package/dist/payload-DEOWN_oo.d.ts +219 -0
  64. package/dist/{pipeline-DrjU2vNA.d.ts → pipeline-Bj6RWt1A.d.ts} +1 -1
  65. package/dist/{pipeline-c7Gdm0qv.d.cts → pipeline-Dwck-wZO.d.cts} +1 -1
  66. package/dist/react.cjs +2 -13
  67. package/dist/react.cjs.map +1 -1
  68. package/dist/react.d.cts +26 -7
  69. package/dist/react.d.ts +26 -7
  70. package/dist/react.js +2 -13
  71. package/dist/react.js.map +1 -1
  72. package/dist/session-cookie-detection-BqOp9mO6.d.cts +46 -0
  73. package/dist/session-cookie-detection-BqOp9mO6.d.ts +46 -0
  74. package/dist/social-providers.cjs +4189 -0
  75. package/dist/social-providers.cjs.map +1 -0
  76. package/dist/social-providers.d.cts +4948 -0
  77. package/dist/social-providers.d.ts +4948 -0
  78. package/dist/social-providers.js +4117 -0
  79. package/dist/social-providers.js.map +1 -0
  80. package/dist/{types-Bez4HSbI.d.cts → types-BRP7sfSF.d.ts} +50 -2
  81. package/dist/{types-kPaHUqUa.d.ts → types-BU8uJH_b.d.cts} +50 -2
  82. package/dist/{types-BRUHGXo2.d.ts → types-CH78O90i.d.cts} +2 -2
  83. package/dist/{types-BRUHGXo2.d.cts → types-CH78O90i.d.ts} +2 -2
  84. package/dist/{types-BLizCLd1.d.cts → types-CjC9_5ZQ.d.cts} +3 -3
  85. package/dist/{types-DRRb0Fd0.d.ts → types-DPgejxYC.d.ts} +3 -3
  86. package/dist/types-eAKAh71s.d.cts +1476 -0
  87. package/dist/types-eAKAh71s.d.ts +1476 -0
  88. package/dist/utils.cjs +438 -15
  89. package/dist/utils.cjs.map +1 -1
  90. package/dist/utils.d.cts +76 -11
  91. package/dist/utils.d.ts +76 -11
  92. package/dist/utils.js +390 -16
  93. package/dist/utils.js.map +1 -1
  94. package/package.json +49 -22
  95. package/dist/shared-DZSGAmXs.d.cts +0 -35
  96. package/dist/shared-MMnVBBfy.d.ts +0 -35
@@ -0,0 +1,219 @@
1
+ import { an as AthenaCreateClientAuthOptions, af as AthenaClientExperimentalOptions, aI as AthenaHeaderBag } from './client-DVOKSYDI.js';
2
+ import { o as BackendConfig, p as BackendType } from './types-CH78O90i.js';
3
+
4
+ interface AthenaRequestCookiesBag {
5
+ getAll(): Array<{
6
+ name: string;
7
+ value: string;
8
+ }>;
9
+ }
10
+ type AthenaRequestHeadersInput = AthenaHeaderBag | Record<string, string | null | undefined>;
11
+ type AthenaRequestCookiesInput = AthenaRequestCookiesBag | string | null | undefined;
12
+ type AthenaAdapterExperimentalOptions = Omit<AthenaClientExperimentalOptions, 'athenaStorageBackend'>;
13
+ interface AthenaAdapterBaseOptions {
14
+ env?: Record<string, string | undefined>;
15
+ url?: string | null | undefined;
16
+ gatewayUrl?: string | null | undefined;
17
+ authUrl?: string | null | undefined;
18
+ chatUrl?: string | null | undefined;
19
+ chatWsUrl?: string | null | undefined;
20
+ storageUrl?: string | null | undefined;
21
+ key?: string | null | undefined;
22
+ client?: string | null | undefined;
23
+ backend?: BackendConfig | BackendType;
24
+ headers?: Record<string, string>;
25
+ auth?: AthenaCreateClientAuthOptions;
26
+ forceNoCache?: boolean;
27
+ storage?: boolean;
28
+ experimental?: AthenaAdapterExperimentalOptions;
29
+ }
30
+ interface AthenaServerRequestOptions {
31
+ requestHeaders?: AthenaRequestHeadersInput;
32
+ requestCookies?: AthenaRequestCookiesInput;
33
+ }
34
+
35
+ /**
36
+ * Default App Router path for the Athena Auth session cookie bridge.
37
+ *
38
+ * Mount as `app/api/athena-auth/session/route.ts`, or configure another path
39
+ * such as `/api/auth/session` when using catch-all handlers.
40
+ *
41
+ * @see {@link createAthenaAuthSessionBridgeHandlers}
42
+ * @see {@link createAthenaAuthSessionBridgePathHandlers}
43
+ */
44
+ declare const ATHENA_AUTH_SESSION_BRIDGE_ROUTE = "/api/athena-auth/session";
45
+ /**
46
+ * Primary host-app session cookie written by the bridge.
47
+ *
48
+ * Hyphen form (`session-token`) matches Athena Auth UI and several consumer
49
+ * apps. Underscore form is also cleared on DELETE for cookie-helper parity.
50
+ *
51
+ * @see {@link ATHENA_AUTH_SESSION_COOKIE_NAMES}
52
+ */
53
+ declare const ATHENA_AUTH_SESSION_COOKIE_NAME = "athena-auth.session-token";
54
+ /**
55
+ * Cookie names cleared on logout / bridge `DELETE`.
56
+ *
57
+ * Includes both hyphen and underscore variants so bridge clear stays aligned
58
+ * with `@xylex-group/athena/cookies` session token lookup.
59
+ */
60
+ declare const ATHENA_AUTH_SESSION_COOKIE_NAMES: readonly ["athena-auth.session-token", "athena-auth.session_token"];
61
+
62
+ /**
63
+ * Minimal session shape accepted when deriving a bridge payload from
64
+ * `auth.getSession()`-style responses.
65
+ *
66
+ * Either nested `session.token` or a top-level `token` may be present depending
67
+ * on the Athena Auth response envelope version.
68
+ */
69
+ interface AthenaAuthSessionBridgeSource {
70
+ session?: {
71
+ /** ISO-8601 expiry when provided by the auth server. */
72
+ expiresAt?: string | null;
73
+ /** Opaque session token string. */
74
+ token?: string | null;
75
+ } | null;
76
+ /** Some clients surface the token at the envelope root. */
77
+ token?: string | null;
78
+ }
79
+ /**
80
+ * Body accepted by the session bridge `POST` handler and by
81
+ * {@link persistAthenaAuthSessionOnAppHost}.
82
+ */
83
+ interface AthenaAuthSessionBridgePayload {
84
+ /** Non-empty session token to store in the app-host httpOnly cookie. */
85
+ token: string;
86
+ /**
87
+ * Optional cookie `Expires` value (ISO-8601 string).
88
+ * When omitted, the cookie is a session cookie (browser-lifetime).
89
+ */
90
+ expiresAt?: string | undefined;
91
+ }
92
+ /**
93
+ * Configuration for bridge route handlers and cookie attributes.
94
+ *
95
+ * All fields are optional; defaults match speedrun-formations /
96
+ * Athena Auth UI conventions.
97
+ */
98
+ interface AthenaAuthSessionBridgeOptions {
99
+ /**
100
+ * Route reported in JSON responses and used by client helpers when not
101
+ * overridden.
102
+ *
103
+ * @defaultValue `/api/athena-auth/session`
104
+ */
105
+ route?: string | undefined;
106
+ /**
107
+ * Cookie name written on successful `POST`.
108
+ *
109
+ * @defaultValue `athena-auth.session-token`
110
+ */
111
+ cookieName?: string | undefined;
112
+ /**
113
+ * Cookie names cleared on `DELETE` (aliases).
114
+ *
115
+ * @defaultValue hyphen + underscore session token names
116
+ */
117
+ cookieNames?: readonly string[] | undefined;
118
+ /**
119
+ * Path attribute for the session cookie.
120
+ *
121
+ * @defaultValue `/`
122
+ */
123
+ cookiePath?: string | undefined;
124
+ /**
125
+ * Cookie SameSite attribute.
126
+ *
127
+ * @defaultValue `lax`
128
+ */
129
+ sameSite?: 'lax' | 'strict' | 'none' | undefined;
130
+ /**
131
+ * Force the `Secure` flag. When omitted, the handlers derive Secure from the
132
+ * request URL scheme and `x-forwarded-proto`.
133
+ */
134
+ secure?: boolean | undefined;
135
+ }
136
+ /**
137
+ * Options for catch-all / dynamic-segment handlers under `/api/auth/*`.
138
+ *
139
+ * Extends {@link AthenaAuthSessionBridgeOptions} with path matching.
140
+ */
141
+ interface AthenaAuthSessionBridgePathOptions extends AthenaAuthSessionBridgeOptions {
142
+ /**
143
+ * Pathname suffixes (final URL segments) that activate the bridge.
144
+ *
145
+ * @defaultValue `['session']` — covers `/api/auth/session` and
146
+ * `/api/athena-auth/session`
147
+ */
148
+ matchPaths?: readonly string[] | undefined;
149
+ }
150
+
151
+ /**
152
+ * Options for browser-side bridge fetch helpers.
153
+ */
154
+ interface AthenaAuthSessionBridgeClientOptions {
155
+ /**
156
+ * Bridge route on the app host.
157
+ *
158
+ * @defaultValue {@link ATHENA_AUTH_SESSION_BRIDGE_ROUTE}
159
+ */
160
+ route?: string | undefined;
161
+ /**
162
+ * Optional fetch implementation (defaults to global `fetch`).
163
+ * Useful in tests.
164
+ */
165
+ fetch?: typeof fetch | undefined;
166
+ }
167
+ /**
168
+ * Persist an Athena Auth session token on the app host via the bridge `POST` route.
169
+ *
170
+ * Sends a same-origin JSON POST with `credentials: "same-origin"`. No-ops when
171
+ * `payload` is null/undefined or when not running in a browser.
172
+ *
173
+ * @param payload - Token (+ optional expiry) from {@link resolveSessionBridgePayload}
174
+ * @param options - Route override and fetch implementation
175
+ * @throws {Error} When the bridge responds with a non-OK status
176
+ *
177
+ * @example
178
+ * ```ts
179
+ * await persistAthenaAuthSessionOnAppHost({
180
+ * token: session.session.token,
181
+ * expiresAt: session.session.expiresAt,
182
+ * })
183
+ * ```
184
+ */
185
+ declare function persistAthenaAuthSessionOnAppHost(payload: AthenaAuthSessionBridgePayload | null, options?: AthenaAuthSessionBridgeClientOptions): Promise<void>;
186
+ /**
187
+ * Clear the bridged session cookie on the app host via `DELETE`.
188
+ *
189
+ * No-ops outside the browser. Pair with `auth.signOut()` so the app-host
190
+ * cookie does not outlive the auth session.
191
+ *
192
+ * @param options - Route override and fetch implementation
193
+ * @throws {Error} When the bridge responds with a non-OK status
194
+ */
195
+ declare function clearAthenaAuthSessionOnAppHost(options?: AthenaAuthSessionBridgeClientOptions): Promise<void>;
196
+
197
+ /**
198
+ * Extract a bridge payload from a session response envelope.
199
+ *
200
+ * Preference order for the token:
201
+ * 1. `payload.session.token`
202
+ * 2. `payload.token`
203
+ *
204
+ * Returns `null` when no non-empty token string is available after trim.
205
+ *
206
+ * @param payload - Result of `auth.getSession()` data or a compatible object
207
+ * @returns Payload suitable for bridge `POST`, or `null`
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * const { data, ok } = await client.auth.getSession()
212
+ * if (ok) {
213
+ * await persistAthenaAuthSessionOnAppHost(resolveSessionBridgePayload(data))
214
+ * }
215
+ * ```
216
+ */
217
+ declare function resolveSessionBridgePayload(payload: AthenaAuthSessionBridgeSource | null | undefined): AthenaAuthSessionBridgePayload | null;
218
+
219
+ export { type AthenaAdapterBaseOptions as A, type AthenaAdapterExperimentalOptions as a, ATHENA_AUTH_SESSION_BRIDGE_ROUTE as b, ATHENA_AUTH_SESSION_COOKIE_NAME as c, ATHENA_AUTH_SESSION_COOKIE_NAMES as d, type AthenaAuthSessionBridgeClientOptions as e, type AthenaAuthSessionBridgePayload as f, type AthenaAuthSessionBridgeSource as g, clearAthenaAuthSessionOnAppHost as h, type AthenaAuthSessionBridgeOptions as i, type AthenaAuthSessionBridgePathOptions as j, type AthenaServerRequestOptions as k, persistAthenaAuthSessionOnAppHost as p, resolveSessionBridgePayload as r };
@@ -1,4 +1,4 @@
1
- import { R as RunGeneratorOptions, s as RunGeneratorResult } from './types-DRRb0Fd0.js';
1
+ import { R as RunGeneratorOptions, d as RunGeneratorResult } from './types-DPgejxYC.js';
2
2
 
3
3
  /**
4
4
  * End-to-end generator execution: load config, introspect, render, and optionally write files.
@@ -1,4 +1,4 @@
1
- import { R as RunGeneratorOptions, s as RunGeneratorResult } from './types-BLizCLd1.cjs';
1
+ import { R as RunGeneratorOptions, d as RunGeneratorResult } from './types-CjC9_5ZQ.cjs';
2
2
 
3
3
  /**
4
4
  * End-to-end generator execution: load config, introspect, render, and optionally write files.
package/dist/react.cjs CHANGED
@@ -187,7 +187,7 @@ var getSessionCookie = (request, config) => {
187
187
 
188
188
  // src/utils/athena-request-headers.ts
189
189
  var NO_CACHE_HEADER_VALUE = "no-cache";
190
- var API_KEY_HEADER_CANDIDATES = ["X-Api-Key", "x-api-key", "apikey"];
190
+ var API_KEY_HEADER_CANDIDATES = ["X-Athena-Key", "x-athena-key", "X-Api-Key", "x-api-key", "apikey"];
191
191
  var ATHENA_KEY_HEADER_CANDIDATES = ["X-Athena-Key", "x-athena-key"];
192
192
  var SESSION_TOKEN_HEADER_CANDIDATES = ["X-Athena-Auth-Session-Token"];
193
193
  var BEARER_MIRROR_HEADER_CANDIDATES = ["X-Athena-Auth-Bearer-Token"];
@@ -289,17 +289,6 @@ function buildServiceRequestHeaders(profile, sdkHeaderValue, config, options, ex
289
289
  });
290
290
  }
291
291
  function applyAthenaApiKeyHeaders(headers, apiKey, athenaKey) {
292
- if (apiKey) {
293
- if (!hasHeaderIgnoreCase(headers, "apikey")) {
294
- headers.apikey = apiKey;
295
- }
296
- if (!Object.hasOwn(headers, "x-api-key")) {
297
- headers["x-api-key"] = apiKey;
298
- }
299
- if (!Object.hasOwn(headers, "X-Api-Key")) {
300
- headers["X-Api-Key"] = apiKey;
301
- }
302
- }
303
292
  const resolvedAthenaKey = normalizeHeaderValue(athenaKey) ?? normalizeHeaderValue(apiKey);
304
293
  if (resolvedAthenaKey && !hasHeaderIgnoreCase(headers, "X-Athena-Key")) {
305
294
  headers["X-Athena-Key"] = resolvedAthenaKey;
@@ -425,7 +414,7 @@ function buildAthenaRequestHeaders(input) {
425
414
 
426
415
  // package.json
427
416
  var package_default = {
428
- version: "2.12.1"
417
+ version: "2.13.0"
429
418
  };
430
419
 
431
420
  // src/sdk-version.ts