@draftlab/auth 0.0.3 → 0.1.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/allow.d.ts +58 -1
- package/dist/allow.js +61 -2
- package/dist/client.d.ts +2 -3
- package/dist/client.js +2 -2
- package/dist/core.d.ts +128 -8
- package/dist/core.js +496 -12
- package/dist/error.d.ts +242 -1
- package/dist/error.js +235 -1
- package/dist/index.d.ts +1 -8
- package/dist/index.js +1 -12
- package/dist/keys.d.ts +1 -1
- package/dist/keys.js +138 -3
- package/dist/pkce.js +160 -1
- package/dist/provider/code.d.ts +227 -3
- package/dist/provider/code.js +27 -14
- package/dist/provider/facebook.d.ts +2 -3
- package/dist/provider/facebook.js +1 -5
- package/dist/provider/github.d.ts +2 -3
- package/dist/provider/github.js +1 -5
- package/dist/provider/google.d.ts +2 -3
- package/dist/provider/google.js +1 -5
- package/dist/provider/oauth2.d.ts +175 -3
- package/dist/provider/oauth2.js +153 -5
- package/dist/provider/password.d.ts +384 -3
- package/dist/provider/password.js +4 -4
- package/dist/provider/provider.d.ts +226 -2
- package/dist/random.js +85 -1
- package/dist/storage/memory.d.ts +2 -2
- package/dist/storage/memory.js +1 -1
- package/dist/storage/storage.d.ts +161 -1
- package/dist/storage/storage.js +60 -1
- package/dist/storage/turso.d.ts +1 -1
- package/dist/storage/turso.js +1 -1
- package/dist/storage/unstorage.d.ts +2 -2
- package/dist/storage/unstorage.js +2 -2
- package/dist/subject.d.ts +61 -2
- package/dist/themes/theme.d.ts +208 -1
- package/dist/themes/theme.js +118 -1
- package/dist/ui/base.d.ts +22 -35
- package/dist/ui/base.js +388 -3
- package/dist/ui/code.d.ts +22 -137
- package/dist/ui/code.js +199 -161
- package/dist/ui/form.d.ts +8 -6
- package/dist/ui/form.js +57 -1
- package/dist/ui/icon.d.ts +7 -84
- package/dist/ui/icon.js +69 -2
- package/dist/ui/password.d.ts +30 -37
- package/dist/ui/password.js +340 -237
- package/dist/ui/select.d.ts +19 -218
- package/dist/ui/select.js +91 -4
- package/dist/util.d.ts +71 -1
- package/dist/util.js +106 -1
- package/package.json +5 -3
- package/dist/allow-CixonwTW.d.ts +0 -59
- package/dist/allow-DX5cehSc.js +0 -63
- package/dist/base-DRutbxgL.js +0 -422
- package/dist/code-DJxdFR7p.d.ts +0 -212
- package/dist/core-BZHEAefX.d.ts +0 -129
- package/dist/core-CDM5o4rs.js +0 -498
- package/dist/error-CWAdNAzm.d.ts +0 -243
- package/dist/error-DgAKK7b2.js +0 -237
- package/dist/form-6XKM_cOk.js +0 -61
- package/dist/icon-Ci5uqGB_.js +0 -192
- package/dist/keys-EEfxEGfO.js +0 -140
- package/dist/oauth2-B7-6Z7Lc.js +0 -155
- package/dist/oauth2-CXHukHf2.d.ts +0 -176
- package/dist/password-C4KLmO0O.d.ts +0 -385
- package/dist/pkce-276Za_rZ.js +0 -162
- package/dist/provider-tndlqCzp.d.ts +0 -227
- package/dist/random-SXMYlaVr.js +0 -87
- package/dist/select-BjySLL8I.js +0 -280
- package/dist/storage-BEaqEPNQ.js +0 -62
- package/dist/storage-CxKerLlc.d.ts +0 -162
- package/dist/subject-DMIMVtaT.d.ts +0 -62
- package/dist/theme-C9by7VXf.d.ts +0 -209
- package/dist/theme-CswaLtbW.js +0 -120
- package/dist/util-CSdHUFOo.js +0 -108
- package/dist/util-DbSKG1Xm.d.ts +0 -72
package/dist/util-DbSKG1Xm.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { RouterContext } from "@draftlab/auth-router/types";
|
|
2
|
-
|
|
3
|
-
//#region src/util.d.ts
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Utility type that flattens complex types for better IntelliSense display.
|
|
7
|
-
* Converts intersections and complex mapped types into cleaner object types.
|
|
8
|
-
*
|
|
9
|
-
* @template T - The type to prettify
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* type Complex = { a: string } & { b: number }
|
|
14
|
-
* type Clean = Prettify<Complex> // { a: string; b: number }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
18
|
-
/**
|
|
19
|
-
* Constructs a complete URL relative to the current request context.
|
|
20
|
-
* Handles proxy headers (x-forwarded-*) to ensure correct URL generation
|
|
21
|
-
* in containerized and load-balanced environments.
|
|
22
|
-
*
|
|
23
|
-
* @param ctx - Router context containing request information
|
|
24
|
-
* @param path - Relative path to append to the base URL
|
|
25
|
-
* @returns Complete URL string with proper protocol, host, and port
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* const callbackUrl = getRelativeUrl(ctx, "/callback")
|
|
30
|
-
* // Returns: "https://myapp.com/auth/callback"
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
declare const getRelativeUrl: (ctx: RouterContext, path: string) => string;
|
|
34
|
-
/**
|
|
35
|
-
* Determines if two domain names are considered a match for security purposes.
|
|
36
|
-
* Uses effective TLD+1 matching to allow subdomains while preventing
|
|
37
|
-
* unauthorized cross-domain requests.
|
|
38
|
-
*
|
|
39
|
-
* @param a - First domain name to compare
|
|
40
|
-
* @param b - Second domain name to compare
|
|
41
|
-
* @returns True if domains are considered a security match
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```ts
|
|
45
|
-
* isDomainMatch("app.example.com", "auth.example.com") // true
|
|
46
|
-
* isDomainMatch("example.com", "evil.com") // false
|
|
47
|
-
* isDomainMatch("app.co.uk", "auth.co.uk") // true (handles two-part TLD)
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
declare const isDomainMatch: (a: string, b: string) => boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Creates a lazy-evaluated function that caches the result of the first execution.
|
|
53
|
-
* Subsequent calls return the cached value without re-executing the function.
|
|
54
|
-
*
|
|
55
|
-
* @template T - The return type of the lazy function
|
|
56
|
-
* @param fn - Function to execute lazily
|
|
57
|
-
* @returns Function that returns the cached result
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```ts
|
|
61
|
-
* const expensiveOperation = lazy(() => {
|
|
62
|
-
* // Computing... (only logs once)
|
|
63
|
-
* return heavyComputation()
|
|
64
|
-
* })
|
|
65
|
-
*
|
|
66
|
-
* const result1 = expensiveOperation() // Executes and caches
|
|
67
|
-
* const result2 = expensiveOperation() // Returns cached value
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
declare const lazy: <T>(fn: () => T) => (() => T);
|
|
71
|
-
//#endregion
|
|
72
|
-
export { Prettify, getRelativeUrl, isDomainMatch, lazy };
|