feat(api): @xenia/api + @xenia/access; the manager logs in and loads bootstrap through them
Platform-v2 step 2.5 (APPS_PLATFORM D-7, D-10, §9): - @xenia/api: createApiClient (app passes its axios; session/device headers, err.xenia codes, 401/offline hooks, manager-override retry: ask PIN, grant, retry once with X-Xenia-Override); errorMessage; createLiveClient = the waiter's WebSocket logic (cursor replay, backoff, online) moved unchanged - @xenia/access: AccessProvider (bootstrap per session token, language + venue formats, translated ui labels, approval dialog), useAccess/useCan/ useModule, Can, RequireModule - i18n: errors namespace for every backend code (en/el, test vs core/errors.py), override/access texts - manager: client from createApiClient, AccessProvider in a layout route, /kds behind RequireModule, usePermissions from bootstrap keys; login and unlock no longer treat a wrong password/PIN as "session ended" (a wrong lock-screen PIN used to log the manager out) - waiter: useWebSocket is a thin wrapper over createLiveClient - tests: api/access unit tests; new e2e suite tests/e2e/manager.mjs; CS-18 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -17,7 +17,9 @@ npm test # server rediscovery scan
|
||||
|
||||
cd ..
|
||||
npm test -w @xenia/ui # PIN rules + WCAG contrast of every token pair (light/dark × venue themes)
|
||||
npm test -w @xenia/i18n # venue-time formatting (DST), money/numbers, comma-or-dot parsing, language order, check-i18n guard
|
||||
npm test -w @xenia/i18n # venue-time formatting (DST), money/numbers, comma-or-dot parsing, language order, check-i18n guard, error texts vs core/errors.py
|
||||
npm test -w @xenia/api # live client = the waiter's old WebSocket behaviour (backoff, cursor, online); HTTP client vs a fake backend (headers, codes, 401, offline, approval retry)
|
||||
npm test -w @xenia/access # can(): one key, any/all
|
||||
```
|
||||
|
||||
**DB tests** (`local_backend/tests/conftest.py`) run the real FastAPI app against a throwaway SQLite database in a temp folder (never your dev or venue DB). Fixtures: `db` (session, rolled back after each test even if the code commits), `client` (TestClient with `get_db` overridden, license check open, no lifespan), `make_user(role=..., perms=...)` (password `password`, PIN `1234`), `login(user)` (auth headers). A test that uses any of them is marked `db` automatically.
|
||||
@@ -38,6 +40,7 @@ Or run one suite at a time:
|
||||
| `node install.mjs` | `install.sh`: VPN-safe `HOST_IP` detection (simulated WireGuard/WiFi hosts); fresh install, upgrade, re-run; proxy config identical to `nginx-proxy/nginx.conf` | Docker | ~1 min |
|
||||
| `python license_e2e.py` | Offline licensing with a real cloud + site process: 400 days offline, tampered file, clock set back, expiry deferred to workday close, renewal, remote lock | Python deps of both backends | ~2 min |
|
||||
| `node ui.mjs` | `@xenia/ui` components on the dev-only gallery (`/ui-gallery`, manager Vite :5185): dialog focus/Escape/backdrop, sheet, toasts, field wiring, switch, InfoTip, PinPad, themes; `@xenia/i18n` on `/i18n-sample` with the browser in New York: venue time, live language switch, el/en money and numbers, price input, translated component labels | Edge | ~40 s |
|
||||
| `node manager.mjs` | Manager on `@xenia/api`/`@xenia/access` (backend :8057 on a demo DB, manager Vite :5186): bootstrap before/after login, wrong password and wrong lock PIN stay on screen, sidebar from keys, KDS module off → "turned off" screen, session ended elsewhere → /login, a waiter's cancel approved by a manager PIN (wrong PIN first) and audited | Edge | ~1 min |
|
||||
| `node browser.mjs` | Waiter web modes (same-origin, plain HTTP by LAN IP, venue mode), install dialog + drawer entry (Android / iPhone / desktop / no APK) | Docker, Edge | ~2 min |
|
||||
| `node android.mjs basics` | Pairing, wrong address / other venue's QR, login + live WS, back button, restart, two venues, camera permission | Android emulator | ~5 min |
|
||||
| `node android.mjs rediscovery` | Server IP change (logged in / out), server down + manual search, cold start while offline | Android emulator | ~4 min |
|
||||
|
||||
Reference in New Issue
Block a user