@auth/qwik 0.3.3 → 0.4.1
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.
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.qwik.js +4 -6
- package/package.json +3 -3
- package/src/index.ts +4 -9
package/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { AuthConfig } from '@auth/core';
|
|
1
|
+
import { AuthConfig, customFetch } from '@auth/core';
|
|
2
2
|
import { Session } from '@auth/core/types';
|
|
3
3
|
import { z, RequestEventCommon } from '@builder.io/qwik-city';
|
|
4
4
|
import { EnvGetter } from '@builder.io/qwik-city/middleware/request-handler';
|
|
5
5
|
|
|
6
|
+
export { customFetch };
|
|
6
7
|
export { AuthError, CredentialsSignin } from '@auth/core/errors';
|
|
7
8
|
export type { Account, DefaultSession, Profile, Session, User, } from '@auth/core/types';
|
|
8
9
|
/** Configure the {@link QwikAuth$} method. */
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6GG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAqC,WAAW,EAAE,MAAM,YAAY,CAAA;AAC3E,OAAO,EAAc,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAGL,CAAC,EAED,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,kDAAkD,CAAA;AAI5E,OAAO,EAAE,WAAW,EAAE,CAAA;AACtB,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAEhE,YAAY,EACV,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,IAAI,GACL,MAAM,kBAAkB,CAAA;AAEzB,8CAA8C;AAC9C,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;CAAG;AAElE,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,CAAC,CAAA;AAsG7E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,aA/GE,kBAAkB,KAAK,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAiE7B,kBAAkB;CA8CmB,CAAA;AAmFrE,eAAO,MAAM,cAAc,QAAS,SAAS,UAAU,UAAU,SAwChE,CAAA"}
|
package/index.qwik.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { globalActionQrl, zodQrl, z, routeLoaderQrl } from "@builder.io/qwik-city";
|
|
2
2
|
import { inlinedQrl, useLexicalScope, implicit$FirstArg } from "@builder.io/qwik";
|
|
3
3
|
import { Auth, skipCSRFCheck, isAuthAction } from "@auth/core";
|
|
4
|
+
import { customFetch } from "@auth/core";
|
|
4
5
|
import { isServer } from "@builder.io/qwik/build";
|
|
5
6
|
var setCookie = { exports: {} };
|
|
6
7
|
var defaultParseOptions = {
|
|
@@ -297,7 +298,7 @@ function QwikAuthQrl(authOptions) {
|
|
|
297
298
|
const authOpts = await authOptions2(req);
|
|
298
299
|
setEnvDefaults(req.env, authOpts);
|
|
299
300
|
const body = new URLSearchParams({
|
|
300
|
-
redirectTo
|
|
301
|
+
callbackUrl: redirectTo
|
|
301
302
|
});
|
|
302
303
|
Object.entries(rest).forEach(([key, value]) => {
|
|
303
304
|
body.set(key, String(value));
|
|
@@ -305,16 +306,12 @@ function QwikAuthQrl(authOptions) {
|
|
|
305
306
|
const baseSignInUrl = `/auth/${isCredentials ? "callback" : "signin"}${providerId ? `/${providerId}` : ""}`;
|
|
306
307
|
const signInUrl = `${baseSignInUrl}?${new URLSearchParams(authorizationParams)}`;
|
|
307
308
|
const data = await authAction(body, req, signInUrl, authOpts);
|
|
308
|
-
req.cookie.set("authjs.callback-url", redirectTo, {
|
|
309
|
-
path: "/"
|
|
310
|
-
});
|
|
311
309
|
if (data.url)
|
|
312
310
|
throw req.redirect(301, data.url);
|
|
313
311
|
}, "QwikAuthQrl_useSignIn_globalAction_xjVnyrcqS90", [
|
|
314
312
|
authOptions
|
|
315
313
|
]), zodQrl(/* @__PURE__ */ inlinedQrl({
|
|
316
314
|
providerId: z.string().optional(),
|
|
317
|
-
/** Yoooo */
|
|
318
315
|
redirectTo: z.string().optional(),
|
|
319
316
|
options: z.object({
|
|
320
317
|
redirectTo: z.string()
|
|
@@ -331,7 +328,7 @@ function QwikAuthQrl(authOptions) {
|
|
|
331
328
|
const authOpts = await authOptions2(req);
|
|
332
329
|
setEnvDefaults(req.env, authOpts);
|
|
333
330
|
const body = new URLSearchParams({
|
|
334
|
-
redirectTo
|
|
331
|
+
callbackUrl: redirectTo
|
|
335
332
|
});
|
|
336
333
|
await authAction(body, req, `/auth/signout`, authOpts);
|
|
337
334
|
}, "QwikAuthQrl_useSignOut_globalAction_ah1IDwV91Ag", [
|
|
@@ -476,5 +473,6 @@ export {
|
|
|
476
473
|
QwikAuthQrl,
|
|
477
474
|
authAction as _auto_authAction,
|
|
478
475
|
defaultRedirectTo as _auto_defaultRedirectTo,
|
|
476
|
+
customFetch,
|
|
479
477
|
setEnvDefaults
|
|
480
478
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auth/qwik",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Authentication for Qwik.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "gioboa <giorgiob.boa@gmail.com>",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"set-cookie-parser": "^2.6.0",
|
|
52
|
-
"@auth/core": "0.
|
|
52
|
+
"@auth/core": "0.36.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@builder.io/qwik": "1.7.3",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build": "pnpm clean && pnpm providers && vite build --mode lib",
|
|
64
64
|
"clean": "rm -rf *.mjs *.js *.d.ts* providers src/providers",
|
|
65
|
-
"providers": "node ../utils/scripts/providers
|
|
65
|
+
"providers": "node ../utils/scripts/providers"
|
|
66
66
|
}
|
|
67
67
|
}
|
package/src/index.ts
CHANGED
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
*/
|
|
111
111
|
|
|
112
112
|
import type { AuthConfig } from "@auth/core"
|
|
113
|
-
import { Auth, isAuthAction, skipCSRFCheck } from "@auth/core"
|
|
113
|
+
import { Auth, isAuthAction, skipCSRFCheck, customFetch } from "@auth/core"
|
|
114
114
|
import { AuthAction, Session } from "@auth/core/types"
|
|
115
115
|
import { implicit$FirstArg, type QRL } from "@builder.io/qwik"
|
|
116
116
|
import {
|
|
@@ -124,6 +124,7 @@ import { EnvGetter } from "@builder.io/qwik-city/middleware/request-handler"
|
|
|
124
124
|
import { isServer } from "@builder.io/qwik/build"
|
|
125
125
|
import { parseString, splitCookiesString } from "set-cookie-parser"
|
|
126
126
|
|
|
127
|
+
export { customFetch }
|
|
127
128
|
export { AuthError, CredentialsSignin } from "@auth/core/errors"
|
|
128
129
|
|
|
129
130
|
export type {
|
|
@@ -155,7 +156,7 @@ export function QwikAuthQrl(
|
|
|
155
156
|
|
|
156
157
|
const authOpts = await authOptions(req)
|
|
157
158
|
setEnvDefaults(req.env, authOpts)
|
|
158
|
-
const body = new URLSearchParams({ redirectTo })
|
|
159
|
+
const body = new URLSearchParams({ callbackUrl: redirectTo })
|
|
159
160
|
Object.entries(rest).forEach(([key, value]) => {
|
|
160
161
|
body.set(key, String(value))
|
|
161
162
|
})
|
|
@@ -169,18 +170,12 @@ export function QwikAuthQrl(
|
|
|
169
170
|
|
|
170
171
|
const data = await authAction(body, req, signInUrl, authOpts)
|
|
171
172
|
|
|
172
|
-
// set authjs.callback-url cookie. Fix for https://github.com/QwikDev/qwik/issues/5227
|
|
173
|
-
req.cookie.set("authjs.callback-url", redirectTo, {
|
|
174
|
-
path: "/",
|
|
175
|
-
})
|
|
176
|
-
|
|
177
173
|
if (data.url) {
|
|
178
174
|
throw req.redirect(301, data.url)
|
|
179
175
|
}
|
|
180
176
|
},
|
|
181
177
|
zod$({
|
|
182
178
|
providerId: z.string().optional(),
|
|
183
|
-
/** Yoooo */
|
|
184
179
|
redirectTo: z.string().optional(),
|
|
185
180
|
options: z
|
|
186
181
|
.object({
|
|
@@ -200,7 +195,7 @@ export function QwikAuthQrl(
|
|
|
200
195
|
redirectTo ??= defaultRedirectTo(req)
|
|
201
196
|
const authOpts = await authOptions(req)
|
|
202
197
|
setEnvDefaults(req.env, authOpts)
|
|
203
|
-
const body = new URLSearchParams({ redirectTo })
|
|
198
|
+
const body = new URLSearchParams({ callbackUrl: redirectTo })
|
|
204
199
|
await authAction(body, req, `/auth/signout`, authOpts)
|
|
205
200
|
},
|
|
206
201
|
zod$({
|