@aura-stack/auth 0.5.0 → 0.6.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 (215) hide show
  1. package/README.md +36 -1
  2. package/dist/@types/index.cjs +0 -18
  3. package/dist/@types/index.d.ts +2 -12
  4. package/dist/@types/index.js +0 -1
  5. package/dist/assert-B3iQSYlK.js +3 -0
  6. package/dist/assert-NJGroSJd.cjs +3 -0
  7. package/dist/client/index.cjs +1 -135
  8. package/dist/client/index.d.ts +11 -14
  9. package/dist/client/index.js +1 -10
  10. package/dist/crypto-Bz8nIciY.js +1 -0
  11. package/dist/crypto-CoXA5w_4.cjs +1 -0
  12. package/dist/env-bq387KyP.cjs +1 -0
  13. package/dist/env-nvh8QBNz.js +1 -0
  14. package/dist/errors-CCYPHuBO.cjs +1 -0
  15. package/dist/errors-DFWHOho6.js +1 -0
  16. package/dist/index-BkpwQ0l4.d.cts +2279 -0
  17. package/dist/index-nqLV2t91.d.ts +2279 -0
  18. package/dist/index.cjs +1 -2427
  19. package/dist/index.d.cts +2 -0
  20. package/dist/index.d.ts +2 -14
  21. package/dist/index.js +1 -59
  22. package/dist/logger-C59_CDMk.js +1 -0
  23. package/dist/logger-UnUhYL2V.cjs +1 -0
  24. package/dist/oauth/atlassian.cjs +1 -57
  25. package/dist/oauth/atlassian.d.ts +2 -12
  26. package/dist/oauth/atlassian.js +1 -6
  27. package/dist/oauth/bitbucket.cjs +1 -49
  28. package/dist/oauth/bitbucket.d.ts +2 -12
  29. package/dist/oauth/bitbucket.js +1 -6
  30. package/dist/oauth/discord.cjs +1 -57
  31. package/dist/oauth/discord.d.ts +2 -12
  32. package/dist/oauth/discord.js +1 -6
  33. package/dist/oauth/dropbox.cjs +1 -53
  34. package/dist/oauth/dropbox.d.ts +2 -12
  35. package/dist/oauth/dropbox.js +1 -6
  36. package/dist/oauth/figma.cjs +1 -49
  37. package/dist/oauth/figma.d.ts +2 -12
  38. package/dist/oauth/figma.js +1 -6
  39. package/dist/oauth/github.cjs +1 -49
  40. package/dist/oauth/github.d.ts +2 -12
  41. package/dist/oauth/github.js +1 -6
  42. package/dist/oauth/gitlab.cjs +1 -49
  43. package/dist/oauth/gitlab.d.ts +2 -12
  44. package/dist/oauth/gitlab.js +1 -6
  45. package/dist/oauth/index.cjs +1 -673
  46. package/dist/oauth/index.d.ts +2 -12
  47. package/dist/oauth/index.js +1 -68
  48. package/dist/oauth/mailchimp.cjs +1 -49
  49. package/dist/oauth/mailchimp.d.ts +2 -12
  50. package/dist/oauth/mailchimp.js +1 -6
  51. package/dist/oauth/notion.cjs +1 -131
  52. package/dist/oauth/notion.d.ts +2 -12
  53. package/dist/oauth/notion.js +1 -9
  54. package/dist/oauth/pinterest.cjs +1 -49
  55. package/dist/oauth/pinterest.d.ts +2 -12
  56. package/dist/oauth/pinterest.js +1 -6
  57. package/dist/oauth/spotify.cjs +1 -49
  58. package/dist/oauth/spotify.d.ts +2 -12
  59. package/dist/oauth/spotify.js +1 -6
  60. package/dist/oauth/strava.cjs +1 -49
  61. package/dist/oauth/strava.d.ts +2 -12
  62. package/dist/oauth/strava.js +1 -6
  63. package/dist/oauth/twitch.cjs +1 -95
  64. package/dist/oauth/twitch.d.ts +2 -12
  65. package/dist/oauth/twitch.js +1 -7
  66. package/dist/oauth/x.cjs +1 -49
  67. package/dist/oauth/x.d.ts +2 -12
  68. package/dist/oauth/x.js +1 -6
  69. package/dist/oauth-BntNm6aE.cjs +1 -0
  70. package/dist/oauth-DmHy9VrB.js +1 -0
  71. package/dist/shared/crypto.cjs +1 -0
  72. package/dist/shared/crypto.d.ts +47 -0
  73. package/dist/shared/crypto.js +1 -0
  74. package/dist/shared/identity.cjs +1 -0
  75. package/dist/shared/identity.d.ts +2 -0
  76. package/dist/shared/identity.js +1 -0
  77. package/dist/shared/index.cjs +1 -0
  78. package/dist/shared/index.d.ts +5 -0
  79. package/dist/shared/index.js +1 -0
  80. package/package.json +32 -9
  81. package/dist/@types/router.d.cjs +0 -1
  82. package/dist/@types/router.d.d.ts +0 -16
  83. package/dist/@types/router.d.js +0 -0
  84. package/dist/@types/utility.cjs +0 -18
  85. package/dist/@types/utility.d.ts +0 -6
  86. package/dist/@types/utility.js +0 -1
  87. package/dist/actions/callback/access-token.cjs +0 -250
  88. package/dist/actions/callback/access-token.d.ts +0 -33
  89. package/dist/actions/callback/access-token.js +0 -9
  90. package/dist/actions/callback/callback.cjs +0 -715
  91. package/dist/actions/callback/callback.d.ts +0 -42
  92. package/dist/actions/callback/callback.js +0 -18
  93. package/dist/actions/callback/userinfo.cjs +0 -283
  94. package/dist/actions/callback/userinfo.d.ts +0 -25
  95. package/dist/actions/callback/userinfo.js +0 -13
  96. package/dist/actions/csrfToken/csrfToken.cjs +0 -189
  97. package/dist/actions/csrfToken/csrfToken.d.ts +0 -7
  98. package/dist/actions/csrfToken/csrfToken.js +0 -13
  99. package/dist/actions/index.cjs +0 -1161
  100. package/dist/actions/index.d.ts +0 -17
  101. package/dist/actions/index.js +0 -39
  102. package/dist/actions/session/session.cjs +0 -188
  103. package/dist/actions/session/session.d.ts +0 -7
  104. package/dist/actions/session/session.js +0 -12
  105. package/dist/actions/signIn/authorization-url.cjs +0 -288
  106. package/dist/actions/signIn/authorization-url.d.ts +0 -31
  107. package/dist/actions/signIn/authorization-url.js +0 -16
  108. package/dist/actions/signIn/authorization.cjs +0 -281
  109. package/dist/actions/signIn/authorization.d.ts +0 -54
  110. package/dist/actions/signIn/authorization.js +0 -19
  111. package/dist/actions/signIn/signIn.cjs +0 -595
  112. package/dist/actions/signIn/signIn.d.ts +0 -42
  113. package/dist/actions/signIn/signIn.js +0 -16
  114. package/dist/actions/signOut/signOut.cjs +0 -492
  115. package/dist/actions/signOut/signOut.d.ts +0 -16
  116. package/dist/actions/signOut/signOut.js +0 -15
  117. package/dist/api/createApi.cjs +0 -750
  118. package/dist/api/createApi.d.ts +0 -12
  119. package/dist/api/createApi.js +0 -19
  120. package/dist/api/getSession.cjs +0 -141
  121. package/dist/api/getSession.d.ts +0 -16
  122. package/dist/api/getSession.js +0 -10
  123. package/dist/api/signIn.cjs +0 -549
  124. package/dist/api/signIn.d.ts +0 -26
  125. package/dist/api/signIn.js +0 -15
  126. package/dist/api/signOut.cjs +0 -279
  127. package/dist/api/signOut.d.ts +0 -16
  128. package/dist/api/signOut.js +0 -13
  129. package/dist/assert.cjs +0 -194
  130. package/dist/assert.d.ts +0 -37
  131. package/dist/assert.js +0 -26
  132. package/dist/chunk-2A5B7GWR.js +0 -125
  133. package/dist/chunk-2GQLSIJ2.js +0 -40
  134. package/dist/chunk-2IR674WX.js +0 -44
  135. package/dist/chunk-3J5TUH2I.js +0 -50
  136. package/dist/chunk-4RWSYUKX.js +0 -98
  137. package/dist/chunk-4YHJ4IEQ.js +0 -25
  138. package/dist/chunk-54CZPKR4.js +0 -25
  139. package/dist/chunk-5LZ7TOM3.js +0 -25
  140. package/dist/chunk-5X7JZMEF.js +0 -0
  141. package/dist/chunk-7BE46WWS.js +0 -88
  142. package/dist/chunk-7YYXFKLR.js +0 -35
  143. package/dist/chunk-C3A37LQC.js +0 -33
  144. package/dist/chunk-CITNGXDA.js +0 -31
  145. package/dist/chunk-CWX724AG.js +0 -78
  146. package/dist/chunk-D2CSIUKP.js +0 -74
  147. package/dist/chunk-E6G5YCI6.js +0 -25
  148. package/dist/chunk-EBAMFRB7.js +0 -34
  149. package/dist/chunk-EEE7UM5T.js +0 -25
  150. package/dist/chunk-FPCVZUVG.js +0 -37
  151. package/dist/chunk-FW4W3REU.js +0 -25
  152. package/dist/chunk-GNNBM2WJ.js +0 -83
  153. package/dist/chunk-IPKO6UQN.js +0 -25
  154. package/dist/chunk-ITQ7352M.js +0 -0
  155. package/dist/chunk-JOCGX3RP.js +0 -59
  156. package/dist/chunk-KBXWTD6E.js +0 -94
  157. package/dist/chunk-KMMAZFSJ.js +0 -25
  158. package/dist/chunk-LATR3NIV.js +0 -117
  159. package/dist/chunk-LAYPUDQF.js +0 -39
  160. package/dist/chunk-LDU7A2JE.js +0 -25
  161. package/dist/chunk-LX3TJ2TJ.js +0 -294
  162. package/dist/chunk-NHZBQNRR.js +0 -143
  163. package/dist/chunk-OVHNRULD.js +0 -33
  164. package/dist/chunk-PDP3PHB3.js +0 -127
  165. package/dist/chunk-PG7UYFG5.js +0 -0
  166. package/dist/chunk-PHYNROD4.js +0 -47
  167. package/dist/chunk-QQEKY4XP.js +0 -29
  168. package/dist/chunk-U4RK4LKJ.js +0 -348
  169. package/dist/chunk-U5663F2U.js +0 -70
  170. package/dist/chunk-UN7X6SU5.js +0 -53
  171. package/dist/chunk-UZQJJD6A.js +0 -100
  172. package/dist/chunk-V6LLEAR4.js +0 -80
  173. package/dist/chunk-WHNDRO3N.js +0 -50
  174. package/dist/chunk-XY5R3EHH.js +0 -204
  175. package/dist/chunk-ZNCZVF6U.js +0 -14
  176. package/dist/client/client.cjs +0 -135
  177. package/dist/client/client.d.ts +0 -85
  178. package/dist/client/client.js +0 -9
  179. package/dist/context.cjs +0 -1237
  180. package/dist/context.d.ts +0 -16
  181. package/dist/context.js +0 -28
  182. package/dist/cookie.cjs +0 -277
  183. package/dist/cookie.d.ts +0 -89
  184. package/dist/cookie.js +0 -30
  185. package/dist/createAuth.cjs +0 -2320
  186. package/dist/createAuth.d.ts +0 -12
  187. package/dist/createAuth.js +0 -48
  188. package/dist/env.cjs +0 -78
  189. package/dist/env.d.ts +0 -10
  190. package/dist/env.js +0 -12
  191. package/dist/errors.cjs +0 -102
  192. package/dist/errors.d.ts +0 -60
  193. package/dist/errors.js +0 -22
  194. package/dist/headers.cjs +0 -61
  195. package/dist/headers.d.ts +0 -33
  196. package/dist/headers.js +0 -12
  197. package/dist/index-_aXtxb_s.d.ts +0 -1377
  198. package/dist/jose.cjs +0 -166
  199. package/dist/jose.d.ts +0 -12
  200. package/dist/jose.js +0 -20
  201. package/dist/logger.cjs +0 -424
  202. package/dist/logger.d.ts +0 -12
  203. package/dist/logger.js +0 -17
  204. package/dist/request.cjs +0 -38
  205. package/dist/request.d.ts +0 -13
  206. package/dist/request.js +0 -6
  207. package/dist/schemas.cjs +0 -158
  208. package/dist/schemas.d.ts +0 -229
  209. package/dist/schemas.js +0 -24
  210. package/dist/secure.cjs +0 -170
  211. package/dist/secure.d.ts +0 -41
  212. package/dist/secure.js +0 -20
  213. package/dist/utils.cjs +0 -329
  214. package/dist/utils.d.ts +0 -35
  215. package/dist/utils.js +0 -36
@@ -1,204 +0,0 @@
1
- import {
2
- env
3
- } from "./chunk-WHNDRO3N.js";
4
- import {
5
- AuthInternalError
6
- } from "./chunk-U5663F2U.js";
7
-
8
- // src/cookie.ts
9
- import { parse, parseSetCookie, serialize } from "@aura-stack/router/cookie";
10
- var COOKIE_NAME = "aura-auth";
11
- var defaultCookieOptions = {
12
- httpOnly: true,
13
- sameSite: "lax",
14
- path: "/",
15
- maxAge: 60 * 60 * 24 * 15
16
- };
17
- var defaultStandardCookieConfig = {
18
- secure: false,
19
- httpOnly: true
20
- };
21
- var defaultSecureCookieConfig = {
22
- secure: true,
23
- httpOnly: true
24
- };
25
- var defaultHostCookieConfig = {
26
- secure: true,
27
- httpOnly: true,
28
- path: "/",
29
- domain: void 0
30
- };
31
- var oauthCookieOptions = {
32
- httpOnly: true,
33
- maxAge: 5 * 60,
34
- sameSite: "lax",
35
- expires: new Date(Date.now() + 5 * 60 * 1e3)
36
- };
37
- var setCookie = (cookieName, value, options) => {
38
- return serialize(cookieName, value, options);
39
- };
40
- var expiredCookieAttributes = {
41
- ...defaultCookieOptions,
42
- expires: /* @__PURE__ */ new Date(0),
43
- maxAge: 0,
44
- secure: true
45
- };
46
- var getCookie = (request, cookieName) => {
47
- const cookies = request instanceof Request ? request.headers.get("Cookie") : request.get("Cookie");
48
- if (!cookies) {
49
- throw new AuthInternalError("COOKIE_NOT_FOUND", "No cookies found. There is no active session");
50
- }
51
- const value = parse(cookies)[cookieName];
52
- if (!value) {
53
- throw new AuthInternalError("COOKIE_NOT_FOUND", `Cookie "${cookieName}" not found. There is no active session`);
54
- }
55
- return value;
56
- };
57
- var getSetCookie = (response, cookieName) => {
58
- const cookies = response.headers.getSetCookie();
59
- if (!cookies) {
60
- throw new AuthInternalError("COOKIE_NOT_FOUND", "No cookies found in response.");
61
- }
62
- const strCookie = cookies.find((cookie) => cookie.startsWith(`${cookieName}=`));
63
- if (!strCookie) {
64
- throw new AuthInternalError("COOKIE_NOT_FOUND", `Cookie "${cookieName}" not found in response.`);
65
- }
66
- return parseSetCookie(strCookie).value;
67
- };
68
- var createSessionCookie = async (jose, session) => {
69
- try {
70
- const encoded = await jose.encodeJWT(session);
71
- return encoded;
72
- } catch (error) {
73
- throw new AuthInternalError("INVALID_JWT_TOKEN", "Failed to create session cookie", { cause: error });
74
- }
75
- };
76
- var defineSecureCookieOptions = (useSecure, attributes, strategy, logger) => {
77
- if (!attributes.httpOnly) {
78
- logger?.log("COOKIE_HTTPONLY_DISABLED");
79
- }
80
- if (attributes.domain === "*") {
81
- attributes.domain = void 0;
82
- logger?.log("COOKIE_WILDCARD_DOMAIN");
83
- }
84
- if (!useSecure) {
85
- if (attributes.secure) {
86
- logger?.log("COOKIE_SECURE_DISABLED");
87
- }
88
- if (attributes.sameSite == "none") {
89
- attributes.sameSite = "lax";
90
- logger?.log("COOKIE_SAMESITE_NONE_WITHOUT_SECURE");
91
- }
92
- if (env.NODE_ENV === "production") {
93
- logger?.log("COOKIE_INSECURE_IN_PRODUCTION");
94
- }
95
- if (strategy === "host") {
96
- logger?.log("COOKIE_HOST_STRATEGY_INSECURE");
97
- }
98
- return {
99
- ...defaultCookieOptions,
100
- ...attributes,
101
- ...defaultStandardCookieConfig
102
- };
103
- }
104
- return strategy === "host" ? {
105
- ...defaultCookieOptions,
106
- ...attributes,
107
- ...defaultHostCookieConfig
108
- } : { ...defaultCookieOptions, ...attributes, ...defaultSecureCookieConfig };
109
- };
110
- var createCookieStore = (useSecure, prefix, overrides, logger) => {
111
- prefix ??= COOKIE_NAME;
112
- const securePrefix = useSecure ? "__Secure-" : "";
113
- const hostPrefix = useSecure ? "__Host-" : "";
114
- return {
115
- sessionToken: {
116
- name: `${securePrefix}${prefix}.${overrides?.sessionToken?.name ?? "session_token"}`,
117
- attributes: defineSecureCookieOptions(
118
- useSecure,
119
- {
120
- ...defaultCookieOptions,
121
- ...overrides?.sessionToken?.attributes
122
- },
123
- overrides?.sessionToken?.attributes?.strategy ?? "secure",
124
- logger
125
- )
126
- },
127
- state: {
128
- name: `${securePrefix}${prefix}.${overrides?.state?.name ?? "state"}`,
129
- attributes: defineSecureCookieOptions(
130
- useSecure,
131
- {
132
- ...oauthCookieOptions,
133
- ...overrides?.state?.attributes
134
- },
135
- overrides?.state?.attributes?.strategy ?? "secure",
136
- logger
137
- )
138
- },
139
- csrfToken: {
140
- name: `${hostPrefix}${prefix}.${overrides?.csrfToken?.name ?? "csrf_token"}`,
141
- attributes: defineSecureCookieOptions(
142
- useSecure,
143
- {
144
- ...overrides?.csrfToken?.attributes,
145
- ...defaultHostCookieConfig,
146
- sameSite: "strict"
147
- },
148
- overrides?.csrfToken?.attributes?.strategy ?? "host",
149
- logger
150
- )
151
- },
152
- redirectTo: {
153
- name: `${securePrefix}${prefix}.${overrides?.redirectTo?.name ?? "redirect_to"}`,
154
- attributes: defineSecureCookieOptions(
155
- useSecure,
156
- {
157
- ...oauthCookieOptions,
158
- ...overrides?.redirectTo?.attributes
159
- },
160
- overrides?.redirectTo?.attributes?.strategy ?? "secure",
161
- logger
162
- )
163
- },
164
- redirectURI: {
165
- name: `${securePrefix}${prefix}.${overrides?.redirectURI?.name ?? "redirect_uri"}`,
166
- attributes: defineSecureCookieOptions(
167
- useSecure,
168
- {
169
- ...oauthCookieOptions,
170
- ...overrides?.redirectURI?.attributes
171
- },
172
- overrides?.redirectURI?.attributes?.strategy ?? "secure",
173
- logger
174
- )
175
- },
176
- codeVerifier: {
177
- name: `${securePrefix}${prefix}.${overrides?.codeVerifier?.name ?? "code_verifier"}`,
178
- attributes: defineSecureCookieOptions(
179
- useSecure,
180
- {
181
- ...oauthCookieOptions,
182
- ...overrides?.codeVerifier?.attributes
183
- },
184
- overrides?.codeVerifier?.attributes?.strategy ?? "secure",
185
- logger
186
- )
187
- }
188
- };
189
- };
190
-
191
- export {
192
- COOKIE_NAME,
193
- defaultCookieOptions,
194
- defaultStandardCookieConfig,
195
- defaultSecureCookieConfig,
196
- defaultHostCookieConfig,
197
- setCookie,
198
- expiredCookieAttributes,
199
- getCookie,
200
- getSetCookie,
201
- createSessionCookie,
202
- defineSecureCookieOptions,
203
- createCookieStore
204
- };
@@ -1,14 +0,0 @@
1
- // src/request.ts
2
- var fetchAsync = async (url, options = {}, timeout = 5e3) => {
3
- const controller = new AbortController();
4
- const timeoutId = setTimeout(() => controller.abort(), timeout);
5
- const response = await fetch(url, {
6
- ...options,
7
- signal: controller.signal
8
- }).finally(() => clearTimeout(timeoutId));
9
- return response;
10
- };
11
-
12
- export {
13
- fetchAsync
14
- };
@@ -1,135 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/client/client.ts
21
- var client_exports = {};
22
- __export(client_exports, {
23
- createAuthClient: () => createAuthClient,
24
- createClient: () => createClient
25
- });
26
- module.exports = __toCommonJS(client_exports);
27
-
28
- // src/errors.ts
29
- var AuthClientError = class extends Error {
30
- type = "AUTH_CLIENT_ERROR";
31
- code;
32
- constructor(code, message, options) {
33
- super(message, options);
34
- this.code = code;
35
- this.name = new.target.name;
36
- Error.captureStackTrace(this, new.target);
37
- }
38
- };
39
- var isNativeError = (error) => {
40
- return error instanceof Error;
41
- };
42
-
43
- // src/client/client.ts
44
- var import_router = require("@aura-stack/router");
45
- var createClient = import_router.createClient;
46
- var createAuthClient = (options) => {
47
- if (typeof window === "undefined" && !options.baseURL) {
48
- throw new AuthClientError("`baseURL` is required when createAuthClient is used outside the browser.");
49
- }
50
- const client = createClient({
51
- cache: "no-store",
52
- credentials: "include",
53
- baseURL: options.baseURL ?? window.location.origin,
54
- ...options
55
- });
56
- const getCSRFToken = async () => {
57
- try {
58
- const response = await client.get("/csrfToken");
59
- if (!response.ok) return null;
60
- const data = await response.json();
61
- return data.csrfToken;
62
- } catch (error) {
63
- console.error("Error fetching CSRF token:", error);
64
- return null;
65
- }
66
- };
67
- const getSession = async () => {
68
- try {
69
- const response = await client.get("/session");
70
- if (!response.ok) return null;
71
- const session = await response.json();
72
- if (!session?.authenticated) return null;
73
- return session.session;
74
- } catch (error) {
75
- console.error("Error fetching session:", error);
76
- return null;
77
- }
78
- };
79
- const signIn = async (oauth, options2) => {
80
- try {
81
- const response = await client.get("/signIn/:oauth", {
82
- params: {
83
- oauth
84
- },
85
- searchParams: {
86
- ...options2,
87
- redirect: false
88
- }
89
- });
90
- const json = await response.json();
91
- if ((options2?.redirect ?? true) && typeof window !== "undefined" && json?.signInURL) {
92
- window.location.assign(json.signInURL);
93
- }
94
- return json;
95
- } catch (error) {
96
- console.error("Error during sign-in:", error);
97
- return { redirect: false, signInURL: "/" };
98
- }
99
- };
100
- const signOut = async (options2) => {
101
- try {
102
- const csrfToken = await getCSRFToken();
103
- if (!csrfToken) {
104
- throw new AuthClientError("Failed to fetch CSRF token for sign-out.");
105
- }
106
- const response = await client.post("/signOut", {
107
- searchParams: {
108
- redirectTo: options2?.redirectTo ?? "/",
109
- token_type_hint: "session_token"
110
- },
111
- headers: {
112
- "X-CSRF-Token": csrfToken
113
- }
114
- });
115
- const json = await response.json();
116
- if ((options2?.redirect ?? true) && typeof window !== "undefined" && json?.url) {
117
- window.location.assign(json.url);
118
- }
119
- return json;
120
- } catch (error) {
121
- console.error("Error during sign-out:", error);
122
- throw isNativeError(error) ? error : new AuthClientError("Sign-out failed.", "The sign-out request failed.", { cause: error });
123
- }
124
- };
125
- return {
126
- getSession,
127
- signIn,
128
- signOut
129
- };
130
- };
131
- // Annotate the CommonJS export names for ESM import in node:
132
- 0 && (module.exports = {
133
- createAuthClient,
134
- createClient
135
- });
@@ -1,85 +0,0 @@
1
- import { l as AuthClientOptions, m as Session, B as BuiltInOAuthProvider, n as SignInOptions, o as SignOutOptions } from '../index-_aXtxb_s.js';
2
- import '@aura-stack/router/types';
3
- import * as zod_v4_core from 'zod/v4/core';
4
- import * as zod from 'zod';
5
- import * as _aura_stack_router from '@aura-stack/router';
6
- import { LiteralUnion } from '../@types/utility.js';
7
- import '../schemas.js';
8
- import 'zod/v4';
9
- import '@aura-stack/jose';
10
- import '@aura-stack/jose/jose';
11
- import '@aura-stack/jose/crypto';
12
- import '@aura-stack/router/cookie';
13
- import 'jose';
14
-
15
- declare const createClient: (options: _aura_stack_router.ClientOptions) => _aura_stack_router.Client<[_aura_stack_router.RouteEndpoint<"GET", "/signIn/:oauth", {
16
- schemas?: {
17
- params: zod.ZodObject<{
18
- oauth: zod.ZodEnum<{
19
- [x: string & Record<never, never>]: string & Record<never, never>;
20
- github: "github";
21
- bitbucket: "bitbucket";
22
- figma: "figma";
23
- discord: "discord";
24
- gitlab: "gitlab";
25
- spotify: "spotify";
26
- x: "x";
27
- strava: "strava";
28
- mailchimp: "mailchimp";
29
- pinterest: "pinterest";
30
- twitch: "twitch";
31
- notion: "notion";
32
- dropbox: "dropbox";
33
- atlassian: "atlassian";
34
- }>;
35
- }, zod_v4_core.$strip>;
36
- searchParams: zod.ZodObject<{
37
- redirect: zod.ZodDefault<zod.ZodOptional<zod.ZodCodec<zod.ZodString, zod.ZodBoolean>>>;
38
- redirectTo: zod.ZodOptional<zod.ZodString>;
39
- }, zod_v4_core.$strip>;
40
- } | undefined;
41
- }>, _aura_stack_router.RouteEndpoint<"GET", "/callback/:oauth", {
42
- schemas?: {
43
- params: zod.ZodObject<{
44
- oauth: zod.ZodEnum<{
45
- [x: string & Record<never, never>]: string & Record<never, never>;
46
- github: "github";
47
- bitbucket: "bitbucket";
48
- figma: "figma";
49
- discord: "discord";
50
- gitlab: "gitlab";
51
- spotify: "spotify";
52
- x: "x";
53
- strava: "strava";
54
- mailchimp: "mailchimp";
55
- pinterest: "pinterest";
56
- twitch: "twitch";
57
- notion: "notion";
58
- dropbox: "dropbox";
59
- atlassian: "atlassian";
60
- }>;
61
- }, zod_v4_core.$strip>;
62
- searchParams: zod.ZodObject<{
63
- code: zod.ZodString;
64
- state: zod.ZodString;
65
- }, zod_v4_core.$strip>;
66
- } | undefined;
67
- }>, _aura_stack_router.RouteEndpoint<"GET", "/session", {
68
- schemas?: _aura_stack_router.EndpointSchemas | undefined;
69
- }>, _aura_stack_router.RouteEndpoint<"POST", "/signOut", {
70
- schemas?: {
71
- searchParams: zod.ZodObject<{
72
- token_type_hint: zod.ZodLiteral<"session_token">;
73
- redirectTo: zod.ZodOptional<zod.ZodString>;
74
- }, zod_v4_core.$strip>;
75
- } | undefined;
76
- }>, _aura_stack_router.RouteEndpoint<"GET", "/csrfToken", {
77
- schemas?: _aura_stack_router.EndpointSchemas | undefined;
78
- }>]>;
79
- declare const createAuthClient: (options: AuthClientOptions) => {
80
- getSession: () => Promise<Session | null>;
81
- signIn: (oauth: LiteralUnion<BuiltInOAuthProvider>, options?: SignInOptions) => Promise<any>;
82
- signOut: (options?: SignOutOptions) => Promise<any>;
83
- };
84
-
85
- export { createAuthClient, createClient };
@@ -1,9 +0,0 @@
1
- import {
2
- createAuthClient,
3
- createClient
4
- } from "../chunk-4RWSYUKX.js";
5
- import "../chunk-U5663F2U.js";
6
- export {
7
- createAuthClient,
8
- createClient
9
- };