@xylex-group/athena 2.12.1 → 2.14.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 +580 -96
  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 +580 -96
  17. package/dist/browser.js.map +1 -1
  18. package/dist/cli/index.cjs +690 -91
  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 +690 -92
  23. package/dist/cli/index.js.map +1 -1
  24. package/dist/{client-CMtx5P4D.d.cts → client-uthENhaf.d.ts} +346 -1488
  25. package/dist/{client-Dre8H24u.d.ts → client-wU2J9yqb.d.cts} +346 -1488
  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 +648 -96
  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 +648 -97
  39. package/dist/index.js.map +1 -1
  40. package/dist/{model-form-DfTi8-D1.d.cts → model-form-BE1_Bmdd.d.cts} +2 -2
  41. package/dist/{model-form-CU0mWrF9.d.ts → model-form-DcH3R7WD.d.ts} +2 -2
  42. package/dist/{module-DBGmbIuh.d.ts → module-Ca3_OQqR.d.ts} +12 -9
  43. package/dist/{module-GoijrBXV.d.cts → module-DFGZXCtt.d.cts} +12 -9
  44. package/dist/next/client.cjs +992 -89
  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 +970 -90
  49. package/dist/next/client.js.map +1 -1
  50. package/dist/next/server.cjs +832 -89
  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 +820 -90
  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-BbSCmILD.d.ts +219 -0
  63. package/dist/payload-zXIwKTQf.d.cts +219 -0
  64. package/dist/{pipeline-c7Gdm0qv.d.cts → pipeline-CwQoD5G9.d.cts} +1 -1
  65. package/dist/{pipeline-DrjU2vNA.d.ts → pipeline-DqwehoQV.d.ts} +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 +4198 -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 +4126 -0
  79. package/dist/social-providers.js.map +1 -0
  80. package/dist/{types-kPaHUqUa.d.ts → types-6H575ITc.d.cts} +50 -2
  81. package/dist/{types-DRRb0Fd0.d.ts → types-C1swabT5.d.ts} +3 -3
  82. package/dist/{types-Bez4HSbI.d.cts → types-CD6K05JQ.d.ts} +50 -2
  83. package/dist/{types-BRUHGXo2.d.ts → types-YQUR7wu0.d.cts} +3 -3
  84. package/dist/{types-BRUHGXo2.d.cts → types-YQUR7wu0.d.ts} +3 -3
  85. package/dist/{types-BLizCLd1.d.cts → types-dHnjluBC.d.cts} +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 +29 -1
  95. package/dist/shared-DZSGAmXs.d.cts +0 -35
  96. package/dist/shared-MMnVBBfy.d.ts +0 -35
@@ -1,7 +1,83 @@
1
- import { an as AthenaAuthSessionResponse, bI as AthenaClientSessionLike, cA as AthenaSdkClientWithStorage, cz as AthenaSdkClientWithAuth } from '../client-CMtx5P4D.cjs';
2
- import { A as AthenaAdapterBaseOptions, b as AthenaServerRequestOptions, a as AthenaAdapterExperimentalOptions } from '../shared-DZSGAmXs.cjs';
3
- import '../types-BRUHGXo2.cjs';
4
- import '../types-Bez4HSbI.cjs';
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';
5
+ 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';
8
+
9
+ /**
10
+ * Handle bridge `POST` — set an httpOnly session cookie from JSON body.
11
+ *
12
+ * Expected body: `{ "token": string, "expiresAt"?: string }`.
13
+ *
14
+ * @param request - Incoming request (JSON body)
15
+ * @param options - Cookie / route configuration
16
+ * @returns `200` on success, `400` when token is missing
17
+ */
18
+ declare function handleAthenaAuthSessionBridgePost(request: Request, options?: AthenaAuthSessionBridgeOptions): Promise<Response>;
19
+ /**
20
+ * Handle bridge `DELETE` — clear bridged session cookie name variants.
21
+ *
22
+ * @param request - Incoming request (used for Secure detection)
23
+ * @param options - Cookie / route configuration
24
+ * @returns `200` with clear `Set-Cookie` headers
25
+ */
26
+ declare function handleAthenaAuthSessionBridgeDelete(request: Request, options?: AthenaAuthSessionBridgeOptions): Response;
27
+ /**
28
+ * Create dedicated App Router handlers for the session bridge.
29
+ *
30
+ * Drop into a route file with no additional wiring:
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * // app/api/athena-auth/session/route.ts
35
+ * import { createAthenaAuthSessionBridgeHandlers } from '@xylex-group/athena/next/server'
36
+ *
37
+ * export const { POST, DELETE } = createAthenaAuthSessionBridgeHandlers()
38
+ * ```
39
+ *
40
+ * @param options - Optional cookie name, path, SameSite, Secure overrides
41
+ * @returns Object with `POST` and `DELETE` route handlers
42
+ */
43
+ declare function createAthenaAuthSessionBridgeHandlers(options?: AthenaAuthSessionBridgeOptions): {
44
+ POST: (request: Request) => Promise<Response>;
45
+ DELETE: (request: Request) => Response;
46
+ };
47
+ /**
48
+ * Whether this request should be handled as a session bridge call.
49
+ *
50
+ * Returns true when:
51
+ * - the pathname equals the configured `route`, or
52
+ * - the final path segment is listed in `matchPaths` (default `session`)
53
+ *
54
+ * @param request - Incoming request
55
+ * @param options - Route + matchPaths configuration
56
+ */
57
+ declare function isAthenaAuthSessionBridgePath(request: Request, options?: AthenaAuthSessionBridgePathOptions): boolean;
58
+ /**
59
+ * Create catch-all / `[path]` handlers that only service session-bridge paths.
60
+ *
61
+ * Non-matching paths return `404` with `{ error: 'Not found' }` so you can
62
+ * mount under `/api/auth/[...path]` without implementing a full auth proxy.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * // app/api/auth/[...path]/route.ts
67
+ * import { createAthenaAuthSessionBridgePathHandlers } from '@xylex-group/athena/next/server'
68
+ *
69
+ * export const { POST, DELETE } = createAthenaAuthSessionBridgePathHandlers({
70
+ * route: '/api/auth/session',
71
+ * })
72
+ * ```
73
+ *
74
+ * @param options - Bridge options plus `matchPaths`
75
+ * @returns Object with `POST` and `DELETE` route handlers
76
+ */
77
+ declare function createAthenaAuthSessionBridgePathHandlers(options?: AthenaAuthSessionBridgePathOptions): {
78
+ POST: (request: Request) => Promise<Response>;
79
+ DELETE: (request: Request) => Response;
80
+ };
5
81
 
6
82
  interface AthenaServerClientOptions extends AthenaAdapterBaseOptions, AthenaServerRequestOptions {
7
83
  session?: AthenaClientSessionLike | AthenaAuthSessionResponse | null;
@@ -50,4 +126,4 @@ declare function resolveAthenaServerContext(options: AthenaServerContextOptionsW
50
126
  declare function resolveAthenaServerContext(options: AthenaServerContextOptionsWithTypecheckedColumns): Promise<AthenaResolvedServerContext<AthenaSdkClientWithAuth<true>>>;
51
127
  declare function resolveAthenaServerContext(options?: AthenaServerContextOptions): Promise<AthenaResolvedServerContext<AthenaSdkClientWithAuth<false>>>;
52
128
 
53
- export { type AthenaResolvedServerContext, type AthenaServerClientOptions, type AthenaServerContextOptions, createAthenaServerClient, resolveAthenaServerContext };
129
+ export { AthenaAuthSessionBridgeOptions, AthenaAuthSessionBridgePathOptions, type AthenaResolvedServerContext, type AthenaServerClientOptions, type AthenaServerContextOptions, createAthenaAuthSessionBridgeHandlers, createAthenaAuthSessionBridgePathHandlers, createAthenaServerClient, handleAthenaAuthSessionBridgeDelete, handleAthenaAuthSessionBridgePost, isAthenaAuthSessionBridgePath, resolveAthenaServerContext };
@@ -1,7 +1,83 @@
1
- import { an as AthenaAuthSessionResponse, bI as AthenaClientSessionLike, cA as AthenaSdkClientWithStorage, cz as AthenaSdkClientWithAuth } from '../client-Dre8H24u.js';
2
- import { A as AthenaAdapterBaseOptions, b as AthenaServerRequestOptions, a as AthenaAdapterExperimentalOptions } from '../shared-MMnVBBfy.js';
3
- import '../types-BRUHGXo2.js';
4
- import '../types-kPaHUqUa.js';
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';
5
+ 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';
8
+
9
+ /**
10
+ * Handle bridge `POST` — set an httpOnly session cookie from JSON body.
11
+ *
12
+ * Expected body: `{ "token": string, "expiresAt"?: string }`.
13
+ *
14
+ * @param request - Incoming request (JSON body)
15
+ * @param options - Cookie / route configuration
16
+ * @returns `200` on success, `400` when token is missing
17
+ */
18
+ declare function handleAthenaAuthSessionBridgePost(request: Request, options?: AthenaAuthSessionBridgeOptions): Promise<Response>;
19
+ /**
20
+ * Handle bridge `DELETE` — clear bridged session cookie name variants.
21
+ *
22
+ * @param request - Incoming request (used for Secure detection)
23
+ * @param options - Cookie / route configuration
24
+ * @returns `200` with clear `Set-Cookie` headers
25
+ */
26
+ declare function handleAthenaAuthSessionBridgeDelete(request: Request, options?: AthenaAuthSessionBridgeOptions): Response;
27
+ /**
28
+ * Create dedicated App Router handlers for the session bridge.
29
+ *
30
+ * Drop into a route file with no additional wiring:
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * // app/api/athena-auth/session/route.ts
35
+ * import { createAthenaAuthSessionBridgeHandlers } from '@xylex-group/athena/next/server'
36
+ *
37
+ * export const { POST, DELETE } = createAthenaAuthSessionBridgeHandlers()
38
+ * ```
39
+ *
40
+ * @param options - Optional cookie name, path, SameSite, Secure overrides
41
+ * @returns Object with `POST` and `DELETE` route handlers
42
+ */
43
+ declare function createAthenaAuthSessionBridgeHandlers(options?: AthenaAuthSessionBridgeOptions): {
44
+ POST: (request: Request) => Promise<Response>;
45
+ DELETE: (request: Request) => Response;
46
+ };
47
+ /**
48
+ * Whether this request should be handled as a session bridge call.
49
+ *
50
+ * Returns true when:
51
+ * - the pathname equals the configured `route`, or
52
+ * - the final path segment is listed in `matchPaths` (default `session`)
53
+ *
54
+ * @param request - Incoming request
55
+ * @param options - Route + matchPaths configuration
56
+ */
57
+ declare function isAthenaAuthSessionBridgePath(request: Request, options?: AthenaAuthSessionBridgePathOptions): boolean;
58
+ /**
59
+ * Create catch-all / `[path]` handlers that only service session-bridge paths.
60
+ *
61
+ * Non-matching paths return `404` with `{ error: 'Not found' }` so you can
62
+ * mount under `/api/auth/[...path]` without implementing a full auth proxy.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * // app/api/auth/[...path]/route.ts
67
+ * import { createAthenaAuthSessionBridgePathHandlers } from '@xylex-group/athena/next/server'
68
+ *
69
+ * export const { POST, DELETE } = createAthenaAuthSessionBridgePathHandlers({
70
+ * route: '/api/auth/session',
71
+ * })
72
+ * ```
73
+ *
74
+ * @param options - Bridge options plus `matchPaths`
75
+ * @returns Object with `POST` and `DELETE` route handlers
76
+ */
77
+ declare function createAthenaAuthSessionBridgePathHandlers(options?: AthenaAuthSessionBridgePathOptions): {
78
+ POST: (request: Request) => Promise<Response>;
79
+ DELETE: (request: Request) => Response;
80
+ };
5
81
 
6
82
  interface AthenaServerClientOptions extends AthenaAdapterBaseOptions, AthenaServerRequestOptions {
7
83
  session?: AthenaClientSessionLike | AthenaAuthSessionResponse | null;
@@ -50,4 +126,4 @@ declare function resolveAthenaServerContext(options: AthenaServerContextOptionsW
50
126
  declare function resolveAthenaServerContext(options: AthenaServerContextOptionsWithTypecheckedColumns): Promise<AthenaResolvedServerContext<AthenaSdkClientWithAuth<true>>>;
51
127
  declare function resolveAthenaServerContext(options?: AthenaServerContextOptions): Promise<AthenaResolvedServerContext<AthenaSdkClientWithAuth<false>>>;
52
128
 
53
- export { type AthenaResolvedServerContext, type AthenaServerClientOptions, type AthenaServerContextOptions, createAthenaServerClient, resolveAthenaServerContext };
129
+ export { AthenaAuthSessionBridgeOptions, AthenaAuthSessionBridgePathOptions, type AthenaResolvedServerContext, type AthenaServerClientOptions, type AthenaServerContextOptions, createAthenaAuthSessionBridgeHandlers, createAthenaAuthSessionBridgePathHandlers, createAthenaServerClient, handleAthenaAuthSessionBridgeDelete, handleAthenaAuthSessionBridgePost, isAthenaAuthSessionBridgePath, resolveAthenaServerContext };