@almadar/orb 2.47.1 → 3.0.2

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 (32) hide show
  1. package/package.json +6 -6
  2. package/shells/almadar-shell/package.json +1 -1
  3. package/shells/almadar-shell/packages/client/package.json +7 -7
  4. package/shells/almadar-shell/packages/client/src/App.tsx +22 -0
  5. package/shells/almadar-shell/packages/client/src/config/firebase.ts +23 -2
  6. package/shells/almadar-shell/packages/client/src/config/mockAuth.ts +257 -0
  7. package/shells/almadar-shell/packages/client/src/features/auth/AuthContext.tsx +16 -3
  8. package/shells/almadar-shell/packages/client/src/features/auth/authService.ts +28 -7
  9. package/shells/almadar-shell/packages/client/src/features/auth/components/PersonaSwitcher.tsx +50 -0
  10. package/shells/almadar-shell/packages/client/src/features/auth/components/ProtectedRoute.tsx +9 -0
  11. package/shells/almadar-shell/packages/client/src/features/auth/index.ts +2 -1
  12. package/shells/almadar-shell/packages/client/src/features/auth/types.ts +18 -2
  13. package/shells/almadar-shell/packages/server/package.json +7 -7
  14. package/shells/almadar-shell/packages/server/src/app.ts +6 -0
  15. package/shells/almadar-shell/packages/server/src/index.ts +16 -2
  16. package/shells/almadar-shell/packages/shared/package.json +1 -1
  17. package/shells/almadar-shell/pnpm-lock.yaml +9661 -0
  18. package/shells/almadar-shell/tsup.config.ts +13 -0
  19. package/shells/almadar-shell/vitest.config.ts +8 -0
  20. package/shells/almadar-shell-hono/package.json +5 -4
  21. package/shells/almadar-shell-hono/packages/client/package.json +6 -6
  22. package/shells/almadar-shell-hono/packages/client/src/App.tsx +0 -3
  23. package/shells/almadar-shell-hono/packages/client/src/config/firebase.ts +23 -2
  24. package/shells/almadar-shell-hono/packages/client/src/features/auth/AuthContext.tsx +5 -0
  25. package/shells/almadar-shell-hono/packages/client/src/features/auth/authService.ts +10 -7
  26. package/shells/almadar-shell-hono/packages/client/src/features/auth/components/ProtectedRoute.tsx +9 -0
  27. package/shells/almadar-shell-hono/packages/server/package.json +5 -5
  28. package/shells/almadar-shell-hono/packages/server/src/index.ts +16 -2
  29. package/shells/almadar-shell-hono/packages/server/src/serve.ts +4 -2
  30. package/shells/almadar-shell-hono/pnpm-lock.yaml +10538 -0
  31. package/shells/almadar-shell-hono/tsup.config.ts +13 -0
  32. package/shells/almadar-shell-hono/vitest.config.ts +8 -0
@@ -13,12 +13,12 @@
13
13
  "test:watch": "vitest"
14
14
  },
15
15
  "dependencies": {
16
- "@almadar/core": ">=10.0.0",
17
- "@almadar/evaluator": "^2.12.1",
18
- "@almadar/integrations": "^2.12.0",
19
- "@almadar/logger": "^1.3.0",
20
- "@almadar/runtime": "^6.9.3",
21
- "@almadar/server": "^2.13.0",
16
+ "@almadar/core": "^10.52.0",
17
+ "@almadar/evaluator": "^2.39.0",
18
+ "@almadar/integrations": "^2.22.0",
19
+ "@almadar/logger": "^1.11.0",
20
+ "@almadar/runtime": "^6.51.0",
21
+ "@almadar/server": "^2.34.0",
22
22
  "cors": "^2.8.5",
23
23
  "dotenv": "^16.4.7",
24
24
  "express": "^4.21.2",
@@ -28,7 +28,7 @@
28
28
  "zod": "^3.22.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@almadar/eslint-plugin": "^2.8.1",
31
+ "@almadar/eslint-plugin": "^2.15.0",
32
32
  "@types/cors": "^2.8.17",
33
33
  "@types/express": "^5.0.0",
34
34
  "@types/node": "^20.17.19",
@@ -12,6 +12,7 @@ import {
12
12
  errorHandler,
13
13
  notFoundHandler,
14
14
  debugEventsRouter,
15
+ personasRouter,
15
16
  } from '@almadar/server';
16
17
  import { registerRoutes } from './routes.js';
17
18
 
@@ -33,6 +34,11 @@ app.get('/health', (_req, res) => {
33
34
  // Debug event bus endpoints (dev-only, no-op in production)
34
35
  app.use('/api/debug', debugEventsRouter());
35
36
 
37
+ // Dev persona roster (no-op unless ALLOW_DEV_AUTH_BYPASS). Mounted BEFORE
38
+ // registerRoutes, which applies authenticateFirebase to /api — a pre-login
39
+ // persona picker cannot present a token it does not have yet.
40
+ app.use('/api', personasRouter());
41
+
36
42
  // Register generated routes
37
43
  registerRoutes(app);
38
44
 
@@ -4,8 +4,22 @@
4
4
 
5
5
  import { initializeFirebase, env, logger } from '@almadar/server';
6
6
 
7
- // Initialize Firebase before anything else uses it
8
- initializeFirebase();
7
+ // Initialize Firebase before anything else uses it. When no credentials
8
+ // are configured (local dev without FIREBASE_*/FIRESTORE_EMULATOR_HOST),
9
+ // boot anyway — a purely client-side app must still serve.
10
+ try {
11
+ initializeFirebase();
12
+ } catch (e) {
13
+ const message = e instanceof Error ? e.message : String(e);
14
+ // In production the real data source IS Firebase (env.ts refuses to boot with
15
+ // USE_MOCK_DATA=true there), so swallowing this leaves a server that starts
16
+ // cleanly and then throws on the first request. Fail at boot instead.
17
+ if (env.NODE_ENV === 'production') {
18
+ logger.error(`Firebase is required when NODE_ENV=production — refusing to start: ${message}`);
19
+ throw e;
20
+ }
21
+ logger.warn(`Firebase not configured — auth/db routes disabled: ${message}`);
22
+ }
9
23
 
10
24
  import { app } from './app.js';
11
25
 
@@ -5,7 +5,7 @@
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
7
7
  "dependencies": {
8
- "@almadar/core": ">=10.0.0",
8
+ "@almadar/core": "^10.52.0",
9
9
  "zod": "^3.22.0"
10
10
  }
11
11
  }