@auth/qwik 0.6.0 → 0.7.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 -2
- package/index.d.ts.map +1 -1
- package/index.qwik.js +7 -2
- package/package.json +2 -2
- package/providers/huggingface.d.ts +3 -0
- package/providers/huggingface.d.ts.map +1 -0
- package/providers/huggingface.js +2 -0
- package/src/index.ts +12 -2
package/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AuthConfig, customFetch } from '@auth/core';
|
|
1
|
+
import { AuthConfig, customFetch as _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
|
|
6
|
+
export declare const customFetch: typeof _customFetch | undefined;
|
|
7
7
|
export { AuthError, CredentialsSignin } from '@auth/core/errors';
|
|
8
8
|
export type { Account, DefaultSession, Profile, Session, User, } from '@auth/core/types';
|
|
9
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;AAC5C,OAAO,
|
|
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,EAIL,WAAW,IAAI,YAAY,EAC5B,MAAM,YAAY,CAAA;AACnB,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,eAAO,MAAM,WAAW,iCAAsC,CAAA;AAE9D,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;AAwG7E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,aAjHE,kBAAkB,KAAK,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmE7B,kBAAkB;CA8CmB,CAAA;AAoFrE,eAAO,MAAM,cAAc,QAAS,SAAS,UAAU,UAAU,SAyChE,CAAA"}
|
package/index.qwik.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { globalActionQrl, zodQrl, z, routeLoaderQrl } from "@builder.io/qwik-city";
|
|
2
2
|
import { inlinedQrl, useLexicalScope, implicit$FirstArg } from "@builder.io/qwik";
|
|
3
|
-
import { Auth, skipCSRFCheck, isAuthAction } from "@auth/core";
|
|
4
|
-
import { customFetch } from "@auth/core";
|
|
3
|
+
import { customFetch as customFetch$1, Auth, skipCSRFCheck, isAuthAction } from "@auth/core";
|
|
5
4
|
import { isServer } from "@builder.io/qwik/build";
|
|
6
5
|
var setCookie = { exports: {} };
|
|
7
6
|
var defaultParseOptions = {
|
|
@@ -168,6 +167,7 @@ setCookie.exports.parse = parse;
|
|
|
168
167
|
var parseString_1 = setCookie.exports.parseString = parseString;
|
|
169
168
|
var splitCookiesString_1 = setCookie.exports.splitCookiesString = splitCookiesString;
|
|
170
169
|
class AuthError extends Error {
|
|
170
|
+
/** @internal */
|
|
171
171
|
constructor(message, errorOptions) {
|
|
172
172
|
if (message instanceof Error) {
|
|
173
173
|
super(void 0, {
|
|
@@ -292,9 +292,11 @@ AccountNotLinked.type = "AccountNotLinked";
|
|
|
292
292
|
class ExperimentalFeatureNotEnabled extends AuthError {
|
|
293
293
|
}
|
|
294
294
|
ExperimentalFeatureNotEnabled.type = "ExperimentalFeatureNotEnabled";
|
|
295
|
+
const customFetch = isServer ? customFetch$1 : void 0;
|
|
295
296
|
function QwikAuthQrl(authOptions) {
|
|
296
297
|
const useSignIn = globalActionQrl(/* @__PURE__ */ inlinedQrl(async ({ providerId, redirectTo: _redirectTo, options, authorizationParams }, req) => {
|
|
297
298
|
const [authOptions2] = useLexicalScope();
|
|
299
|
+
if (!isServer) return;
|
|
298
300
|
const { redirectTo = _redirectTo ?? defaultRedirectTo(req), ...rest } = options ?? {};
|
|
299
301
|
const isCredentials = providerId === "credentials";
|
|
300
302
|
const authOpts = await authOptions2(req);
|
|
@@ -325,6 +327,7 @@ function QwikAuthQrl(authOptions) {
|
|
|
325
327
|
}, "QwikAuthQrl_useSignIn_globalAction_zod_X0EcrMISJRM")));
|
|
326
328
|
const useSignOut = globalActionQrl(/* @__PURE__ */ inlinedQrl(async ({ redirectTo }, req) => {
|
|
327
329
|
const [authOptions2] = useLexicalScope();
|
|
330
|
+
if (!isServer) return;
|
|
328
331
|
redirectTo ?? (redirectTo = defaultRedirectTo(req));
|
|
329
332
|
const authOpts = await authOptions2(req);
|
|
330
333
|
setEnvDefaults(req.env, authOpts);
|
|
@@ -374,6 +377,7 @@ function QwikAuthQrl(authOptions) {
|
|
|
374
377
|
}
|
|
375
378
|
const QwikAuth$ = /* @__PURE__ */ implicit$FirstArg(QwikAuthQrl);
|
|
376
379
|
async function authAction(body, req, path, authOptions) {
|
|
380
|
+
if (!isServer) return;
|
|
377
381
|
const request = new Request(new URL(path, req.request.url), {
|
|
378
382
|
method: req.request.method,
|
|
379
383
|
headers: req.request.headers,
|
|
@@ -431,6 +435,7 @@ async function getSessionData(req, options) {
|
|
|
431
435
|
throw new Error(data.message);
|
|
432
436
|
}
|
|
433
437
|
const setEnvDefaults = (env, config) => {
|
|
438
|
+
if (!isServer) return;
|
|
434
439
|
config.basePath = "/auth";
|
|
435
440
|
if (!config.secret?.length) {
|
|
436
441
|
config.secret = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auth/qwik",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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.39.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@builder.io/qwik": "1.7.3",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"huggingface.d.ts","sourceRoot":"","sources":["../src/providers/huggingface.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAA"}
|
package/src/index.ts
CHANGED
|
@@ -110,7 +110,12 @@
|
|
|
110
110
|
*/
|
|
111
111
|
|
|
112
112
|
import type { AuthConfig } from "@auth/core"
|
|
113
|
-
import {
|
|
113
|
+
import {
|
|
114
|
+
Auth,
|
|
115
|
+
isAuthAction,
|
|
116
|
+
skipCSRFCheck,
|
|
117
|
+
customFetch as _customFetch,
|
|
118
|
+
} from "@auth/core"
|
|
114
119
|
import { AuthAction, Session } from "@auth/core/types"
|
|
115
120
|
import { implicit$FirstArg, type QRL } from "@builder.io/qwik"
|
|
116
121
|
import {
|
|
@@ -124,7 +129,8 @@ import { EnvGetter } from "@builder.io/qwik-city/middleware/request-handler"
|
|
|
124
129
|
import { isServer } from "@builder.io/qwik/build"
|
|
125
130
|
import { parseString, splitCookiesString } from "set-cookie-parser"
|
|
126
131
|
|
|
127
|
-
export
|
|
132
|
+
export const customFetch = isServer ? _customFetch : undefined
|
|
133
|
+
|
|
128
134
|
export { AuthError, CredentialsSignin } from "@auth/core/errors"
|
|
129
135
|
|
|
130
136
|
export type {
|
|
@@ -149,6 +155,7 @@ export function QwikAuthQrl(
|
|
|
149
155
|
{ providerId, redirectTo: _redirectTo, options, authorizationParams },
|
|
150
156
|
req
|
|
151
157
|
) => {
|
|
158
|
+
if (!isServer) return
|
|
152
159
|
const { redirectTo = _redirectTo ?? defaultRedirectTo(req), ...rest } =
|
|
153
160
|
options ?? {}
|
|
154
161
|
|
|
@@ -192,6 +199,7 @@ export function QwikAuthQrl(
|
|
|
192
199
|
|
|
193
200
|
const useSignOut = globalAction$(
|
|
194
201
|
async ({ redirectTo }, req) => {
|
|
202
|
+
if (!isServer) return
|
|
195
203
|
redirectTo ??= defaultRedirectTo(req)
|
|
196
204
|
const authOpts = await authOptions(req)
|
|
197
205
|
setEnvDefaults(req.env, authOpts)
|
|
@@ -261,6 +269,7 @@ async function authAction(
|
|
|
261
269
|
path: string,
|
|
262
270
|
authOptions: QwikAuthConfig
|
|
263
271
|
) {
|
|
272
|
+
if (!isServer) return
|
|
264
273
|
const request = new Request(new URL(path, req.request.url), {
|
|
265
274
|
method: req.request.method,
|
|
266
275
|
headers: req.request.headers,
|
|
@@ -337,6 +346,7 @@ async function getSessionData(
|
|
|
337
346
|
}
|
|
338
347
|
|
|
339
348
|
export const setEnvDefaults = (env: EnvGetter, config: AuthConfig) => {
|
|
349
|
+
if (!isServer) return
|
|
340
350
|
config.basePath = "/auth"
|
|
341
351
|
if (!config.secret?.length) {
|
|
342
352
|
config.secret = []
|