@draftlab/auth 0.13.1 → 0.15.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.
- package/dist/core.d.mts +1 -1
- package/dist/core.mjs +3 -3
- package/dist/provider/code.mjs +88 -0
- package/dist/provider/magiclink.mjs +58 -0
- package/dist/provider/oauth2.mjs +57 -0
- package/dist/provider/passkey.mjs +1 -1
- package/dist/provider/password.mjs +9 -0
- package/dist/provider/provider.d.mts +2 -2
- package/dist/router/context.d.mts +21 -0
- package/dist/router/context.mjs +193 -0
- package/dist/router/cookies.d.mts +8 -0
- package/dist/router/cookies.mjs +13 -0
- package/dist/router/index.d.mts +21 -0
- package/dist/router/index.mjs +107 -0
- package/dist/router/matcher.d.mts +15 -0
- package/dist/router/matcher.mjs +76 -0
- package/dist/router/middleware/cors.d.mts +15 -0
- package/dist/router/middleware/cors.mjs +114 -0
- package/dist/router/safe-request.d.mts +52 -0
- package/dist/router/safe-request.mjs +160 -0
- package/dist/router/types.d.mts +67 -0
- package/dist/router/types.mjs +1 -0
- package/dist/router/variables.d.mts +12 -0
- package/dist/router/variables.mjs +20 -0
- package/dist/ui/code.mjs +15 -8
- package/dist/ui/magiclink.mjs +15 -8
- package/dist/ui/passkey.d.mts +5 -3
- package/dist/ui/passkey.mjs +34 -8
- package/dist/ui/password.d.mts +0 -4
- package/dist/ui/password.mjs +259 -243
- package/dist/util.d.mts +25 -2
- package/dist/util.mjs +24 -1
- package/package.json +5 -6
package/dist/util.mjs
CHANGED
|
@@ -100,6 +100,29 @@ const lazy = (fn) => {
|
|
|
100
100
|
return value;
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
|
+
/**
|
|
104
|
+
* Utility function to immediately invoke a function and return its result.
|
|
105
|
+
* Useful for complex conditional rendering logic in JSX/TSX where you want
|
|
106
|
+
* to use if/else statements instead of ternary operators.
|
|
107
|
+
*
|
|
108
|
+
* @template T - The return type of the function
|
|
109
|
+
* @param fn - Function to execute immediately
|
|
110
|
+
* @returns The result of executing the function
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```tsx
|
|
114
|
+
* return (
|
|
115
|
+
* <div>
|
|
116
|
+
* {run(() => {
|
|
117
|
+
* if (state === "loading") return <Spinner />
|
|
118
|
+
* if (state === "error") return <Error />
|
|
119
|
+
* return <Content />
|
|
120
|
+
* })}
|
|
121
|
+
* </div>
|
|
122
|
+
* )
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
const run = (fn) => fn();
|
|
103
126
|
|
|
104
127
|
//#endregion
|
|
105
|
-
export { getRelativeUrl, isDomainMatch, lazy };
|
|
128
|
+
export { getRelativeUrl, isDomainMatch, lazy, run };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftlab/auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core implementation for @draftlab/auth",
|
|
6
6
|
"author": "Matheus Pergoli",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^25.0.3",
|
|
41
41
|
"@types/qrcode": "^1.5.6",
|
|
42
|
-
"tsdown": "
|
|
42
|
+
"tsdown": "0.19.0-beta.5",
|
|
43
43
|
"typescript": "^5.9.3",
|
|
44
44
|
"@draftlab/tsconfig": "0.1.0"
|
|
45
45
|
},
|
|
@@ -60,10 +60,9 @@
|
|
|
60
60
|
"@standard-schema/spec": "^1.1.0",
|
|
61
61
|
"jose": "^6.1.3",
|
|
62
62
|
"otpauth": "^9.4.1",
|
|
63
|
-
"preact": "^10.28.
|
|
64
|
-
"preact-render-to-string": "^6.6.
|
|
65
|
-
"qrcode": "^1.5.4"
|
|
66
|
-
"@draftlab/auth-router": "0.5.0"
|
|
63
|
+
"preact": "^10.28.2",
|
|
64
|
+
"preact-render-to-string": "^6.6.5",
|
|
65
|
+
"qrcode": "^1.5.4"
|
|
67
66
|
},
|
|
68
67
|
"engines": {
|
|
69
68
|
"node": ">=18"
|