@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.
Files changed (78) hide show
  1. package/dist/allow.d.ts +58 -1
  2. package/dist/allow.js +61 -2
  3. package/dist/client.d.ts +2 -3
  4. package/dist/client.js +2 -2
  5. package/dist/core.d.ts +128 -8
  6. package/dist/core.js +496 -12
  7. package/dist/error.d.ts +242 -1
  8. package/dist/error.js +235 -1
  9. package/dist/index.d.ts +1 -8
  10. package/dist/index.js +1 -12
  11. package/dist/keys.d.ts +1 -1
  12. package/dist/keys.js +138 -3
  13. package/dist/pkce.js +160 -1
  14. package/dist/provider/code.d.ts +227 -3
  15. package/dist/provider/code.js +27 -14
  16. package/dist/provider/facebook.d.ts +2 -3
  17. package/dist/provider/facebook.js +1 -5
  18. package/dist/provider/github.d.ts +2 -3
  19. package/dist/provider/github.js +1 -5
  20. package/dist/provider/google.d.ts +2 -3
  21. package/dist/provider/google.js +1 -5
  22. package/dist/provider/oauth2.d.ts +175 -3
  23. package/dist/provider/oauth2.js +153 -5
  24. package/dist/provider/password.d.ts +384 -3
  25. package/dist/provider/password.js +4 -4
  26. package/dist/provider/provider.d.ts +226 -2
  27. package/dist/random.js +85 -1
  28. package/dist/storage/memory.d.ts +2 -2
  29. package/dist/storage/memory.js +1 -1
  30. package/dist/storage/storage.d.ts +161 -1
  31. package/dist/storage/storage.js +60 -1
  32. package/dist/storage/turso.d.ts +1 -1
  33. package/dist/storage/turso.js +1 -1
  34. package/dist/storage/unstorage.d.ts +2 -2
  35. package/dist/storage/unstorage.js +2 -2
  36. package/dist/subject.d.ts +61 -2
  37. package/dist/themes/theme.d.ts +208 -1
  38. package/dist/themes/theme.js +118 -1
  39. package/dist/ui/base.d.ts +22 -35
  40. package/dist/ui/base.js +388 -3
  41. package/dist/ui/code.d.ts +22 -137
  42. package/dist/ui/code.js +199 -161
  43. package/dist/ui/form.d.ts +8 -6
  44. package/dist/ui/form.js +57 -1
  45. package/dist/ui/icon.d.ts +7 -84
  46. package/dist/ui/icon.js +69 -2
  47. package/dist/ui/password.d.ts +30 -37
  48. package/dist/ui/password.js +340 -237
  49. package/dist/ui/select.d.ts +19 -218
  50. package/dist/ui/select.js +91 -4
  51. package/dist/util.d.ts +71 -1
  52. package/dist/util.js +106 -1
  53. package/package.json +5 -3
  54. package/dist/allow-CixonwTW.d.ts +0 -59
  55. package/dist/allow-DX5cehSc.js +0 -63
  56. package/dist/base-DRutbxgL.js +0 -422
  57. package/dist/code-DJxdFR7p.d.ts +0 -212
  58. package/dist/core-BZHEAefX.d.ts +0 -129
  59. package/dist/core-CDM5o4rs.js +0 -498
  60. package/dist/error-CWAdNAzm.d.ts +0 -243
  61. package/dist/error-DgAKK7b2.js +0 -237
  62. package/dist/form-6XKM_cOk.js +0 -61
  63. package/dist/icon-Ci5uqGB_.js +0 -192
  64. package/dist/keys-EEfxEGfO.js +0 -140
  65. package/dist/oauth2-B7-6Z7Lc.js +0 -155
  66. package/dist/oauth2-CXHukHf2.d.ts +0 -176
  67. package/dist/password-C4KLmO0O.d.ts +0 -385
  68. package/dist/pkce-276Za_rZ.js +0 -162
  69. package/dist/provider-tndlqCzp.d.ts +0 -227
  70. package/dist/random-SXMYlaVr.js +0 -87
  71. package/dist/select-BjySLL8I.js +0 -280
  72. package/dist/storage-BEaqEPNQ.js +0 -62
  73. package/dist/storage-CxKerLlc.d.ts +0 -162
  74. package/dist/subject-DMIMVtaT.d.ts +0 -62
  75. package/dist/theme-C9by7VXf.d.ts +0 -209
  76. package/dist/theme-CswaLtbW.js +0 -120
  77. package/dist/util-CSdHUFOo.js +0 -108
  78. package/dist/util-DbSKG1Xm.d.ts +0 -72
@@ -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 };