@seip/bluebird-js 0.0.1 → 0.1.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.
Files changed (81) hide show
  1. package/.env_example +53 -53
  2. package/AGENTS.md +426 -403
  3. package/LICENSE +1 -1
  4. package/README.md +292 -285
  5. package/app/routes/api.js +50 -50
  6. package/app/routes/web.js +55 -53
  7. package/app/views/about.js +63 -0
  8. package/app/views/dashboard.js +147 -0
  9. package/app/views/index.js +80 -0
  10. package/app/views/layouts/main/view.js +81 -0
  11. package/app/views/legal/terms.html +19 -0
  12. package/app/views/login.js +80 -0
  13. package/core/app.d.ts +18 -18
  14. package/core/app.js +684 -644
  15. package/core/auth.d.ts +13 -13
  16. package/core/auth.js +326 -326
  17. package/core/cache.d.ts +17 -17
  18. package/core/cache.js +475 -475
  19. package/core/cli/doctor.js +287 -287
  20. package/core/cli/ecosystem.js +162 -162
  21. package/core/cli/init.js +779 -779
  22. package/core/cli/migrate.js +541 -541
  23. package/core/cli/model.js +66 -66
  24. package/core/cli/nginx.js +199 -199
  25. package/core/cli/route.js +120 -120
  26. package/core/cli/view.js +55 -36
  27. package/core/config.d.ts +3 -3
  28. package/core/config.js +111 -111
  29. package/core/csrf.d.ts +3 -3
  30. package/core/csrf.js +114 -114
  31. package/core/database.d.ts +15 -15
  32. package/core/database.js +636 -636
  33. package/core/debug.d.ts +3 -3
  34. package/core/debug.js +249 -249
  35. package/core/hash.d.ts +3 -3
  36. package/core/hash.js +194 -194
  37. package/core/html.d.ts +42 -0
  38. package/core/html.js +217 -0
  39. package/core/index.d.ts +1176 -1071
  40. package/core/logger.d.ts +3 -3
  41. package/core/logger.js +127 -124
  42. package/core/middleware.d.ts +3 -3
  43. package/core/middleware.js +28 -28
  44. package/core/model.d.ts +19 -19
  45. package/core/model.js +600 -600
  46. package/core/queue.d.ts +13 -13
  47. package/core/queue.js +172 -172
  48. package/core/ratelimit.d.ts +3 -3
  49. package/core/ratelimit.js +145 -145
  50. package/core/redis.d.ts +21 -21
  51. package/core/redis.js +230 -230
  52. package/core/render-cache.js +212 -0
  53. package/core/render.d.ts +3 -3
  54. package/core/render.js +199 -555
  55. package/core/router.d.ts +3 -3
  56. package/core/router.js +171 -171
  57. package/core/seo.d.ts +3 -3
  58. package/core/seo.js +106 -106
  59. package/core/swagger.d.ts +3 -3
  60. package/core/swagger.js +60 -60
  61. package/core/upload.d.ts +13 -13
  62. package/core/upload.js +102 -102
  63. package/core/util/colors.js +82 -82
  64. package/core/validate.d.ts +15 -15
  65. package/core/validate.js +364 -364
  66. package/core/view-loader.js +162 -0
  67. package/core/vite.d.ts +3 -3
  68. package/core/vite.js +145 -145
  69. package/core/ws.d.ts +13 -13
  70. package/core/ws.js +245 -245
  71. package/index.js +18 -18
  72. package/jsconfig.json +15 -15
  73. package/package.json +85 -86
  74. package/production.md +273 -273
  75. package/public/css/bluebird.min.css +1 -1
  76. package/public/js/bluebird-client.js +1780 -1662
  77. package/public/js/bluebird.min.js +1072 -1072
  78. package/app/views/about.html +0 -161
  79. package/app/views/dashboard.html +0 -140
  80. package/app/views/index.html +0 -150
  81. package/app/views/login.html +0 -144
@@ -0,0 +1,80 @@
1
+ import { html, script } from "@seip/bluebird-js/core/html.js";
2
+
3
+ export const layout = "main";
4
+
5
+ export const head = () => ({
6
+ title: "Sign In — Blue Bird Framework",
7
+ description: "Test native JWT authentication, encrypted cookies, and protected routes.",
8
+ });
9
+
10
+ /**
11
+ * Login page view module.
12
+ * @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
13
+ */
14
+ export default function LoginView() {
15
+ return html`
16
+ <section class="hero">
17
+ <h1 class="mt-3 text-gradient font-bold">Authentication Demo</h1>
18
+ <p class="lead">Test native AES-256-GCM JWT auth cookies, Auth.protect middleware, and seamless View Transitions.</p>
19
+ </section>
20
+
21
+ <div class="mt-6">
22
+ <div class="alert alert-info mb-6">
23
+ <div>
24
+ <strong class="alert-title">Interactive Auth Testing</strong>
25
+ <p class="alert-description">
26
+ Submit credentials below to generate an encrypted JWT session cookie with <code>Auth.login(res, user)</code>.
27
+ Try visiting <strong>/dashboard</strong> directly before and after logging in to verify the <code>Auth.protect({ redirect: "/login" })</code> middleware!
28
+ </p>
29
+ </div>
30
+ </div>
31
+
32
+ <article class="card">
33
+ <header class="card-header">
34
+ <h3 class="card-title">Sign In</h3>
35
+ <p class="card-description">Enter your test credentials below to start a secure session.</p>
36
+ </header>
37
+
38
+ <form action="/login" method="POST" id="loginForm">
39
+ <label for="email">Email Address</label>
40
+ <input type="email" id="email" name="email" value="alex@example.com" placeholder="alex@example.com" required />
41
+
42
+ <label for="password">Password</label>
43
+ <input type="password" id="password" name="password" value="password123" placeholder="••••••••" required />
44
+
45
+ <div class="flex items-center justify-between gap-4 mt-6">
46
+ <button type="submit" id="submitBtn" class="glow-blue">Sign In &rarr;</button>
47
+ <a href="/dashboard" role="button" class="outline">Try /dashboard (Protected)</a>
48
+ </div>
49
+ </form>
50
+ </article>
51
+
52
+ <article class="mt-6">
53
+ <header>
54
+ <h4 class="font-bold">What is being tested here?</h4>
55
+ </header>
56
+ <div class="grid cols-2 gap-4 mt-4">
57
+ <div class="card">
58
+ <h5 class="font-bold mb-2">1. Auth.protect Middleware</h5>
59
+ <p class="text-sm">When an unauthenticated client requests <code>/dashboard</code>, the server issues a 302 redirect to <code>/login</code>. The client router automatically follows the transition smoothly.</p>
60
+ </div>
61
+ <div class="card">
62
+ <h5 class="font-bold mb-2">2. Encrypted JWT Cookies</h5>
63
+ <p class="text-sm">Session cookies are encrypted with AES-256-GCM and marked HttpOnly and SameSite=Lax to protect against token exfiltration.</p>
64
+ </div>
65
+ </div>
66
+ </article>
67
+ </div>
68
+
69
+ <script>
70
+ const form = document.getElementById("loginForm");
71
+ const btn = document.getElementById("submitBtn");
72
+ form?.addEventListener("submit", () => {
73
+ if (btn) {
74
+ btn.textContent = "Signing In...";
75
+ btn.setAttribute("disabled", "true");
76
+ }
77
+ });
78
+ </script>
79
+ `;
80
+ }
package/core/app.d.ts CHANGED
@@ -1,18 +1,18 @@
1
- import App, {
2
- AppError,
3
- WebSocketManager,
4
- AppOptions,
5
- CorsOptions,
6
- SecurityHeadersOptions,
7
- AppStaticOptions,
8
- } from "./index.js";
9
- export default App;
10
- export {
11
- App,
12
- AppError,
13
- WebSocketManager,
14
- AppOptions,
15
- CorsOptions,
16
- SecurityHeadersOptions,
17
- AppStaticOptions,
18
- };
1
+ import App, {
2
+ AppError,
3
+ WebSocketManager,
4
+ AppOptions,
5
+ CorsOptions,
6
+ SecurityHeadersOptions,
7
+ AppStaticOptions,
8
+ } from "./index.js";
9
+ export default App;
10
+ export {
11
+ App,
12
+ AppError,
13
+ WebSocketManager,
14
+ AppOptions,
15
+ CorsOptions,
16
+ SecurityHeadersOptions,
17
+ AppStaticOptions,
18
+ };