Some checks are pending
CI / Lint bridge (Biome) (push) Waiting to run
CI / Type-check bridge (push) Blocked by required conditions
CI / Tests unit bridge (push) Blocked by required conditions
CI / Tests integration bridge (push) Blocked by required conditions
CI / Security scan (push) Waiting to run
CI / Docker build + healthcheck (push) Blocked by required conditions
Pivot strategique : DocAdenice = produit Notion-like generique. Le bridge
est livre vide a un user qui cree ses tables Baserow comme il veut. Code
sans aucune ontologie metier.
Suppressions :
- 9 entites domain metier (Personne, Formation, Bloc, Module, Attribution,
Client, Projet, Tache, Intervention) + types.ts (Role, statuts)
- baserow-repo.ts (mega-fichier 554 LOC avec 9 repos heritant BaseRepo)
- 6 routes metier (personnes, formations, projets, modules, interventions,
attributions) + tests associes
- Lookup PersonneRepo.findByEmail dans middleware auth
- Mapping DEFAULT_ROLE_SCOPES dans middleware/scopes.ts
- Cascade rollup metier dans webhooks/baserow-handler.ts
Ajouts :
- Domain generique : Table, Row, Field, View + schemas zod refondus
- 4 repos generiques : tables / rows / fields / views
- Route unique routes/tables.ts avec 9 endpoints REST CRUD generiques
- Claim JWT acadenice_permissions[] lu directement dans le middleware auth
(alimente par RBAC dynamique cote DocAdenice en R2)
- examples/acadenice-formation-hub/ : README + seed-baserow.md schema
9 tables + example-roles.md (Formateur, Developpeur, Direction, Support,
Admin avec permissions generiques)
Refactors :
- BaserowClient etendu : listTables, getTable, listFields, listViews,
getGridViewRows
- middleware/auth.ts : extractPermissions(payload), AuthenticatedUser
remplace roles[] par permissions[]
- middleware/scopes.ts : computeOidcScopes(groups, permissions, map)
- webhooks/baserow-handler.ts : invalidation generique
bridge:tables:<tableId>:* sans cascade cross-table
- lib/cache.ts : invalidateEntity -> invalidateTable(redis, tableId, rowId?)
- container.ts : drop tableIds, RepoSet={tables, rows, fields, views}
- 501 NOT_IMPLEMENTED si DB token sur endpoints /tables qui exigent JWT
Tests : 250/250 verts (depuis 319). Coverage : domain 98.9%, adapters 89%,
auth 97.08%, rate-limit 100%, cache 100%, webhooks 100%.
Quality gates verts : typecheck, lint biome, vitest, coverage thresholds.
Refs: R1 dans le pivot strategique DocAdenice Notion-like generique.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
52 lines
2.2 KiB
Text
52 lines
2.2 KiB
Text
# Bridge service — variables d'environnement
|
|
# Copier vers .env et remplir avec valeurs reelles.
|
|
|
|
# Server
|
|
NODE_ENV=development
|
|
PORT=4000
|
|
LOG_LEVEL=debug
|
|
|
|
# Baserow API
|
|
BASEROW_API_URL=http://baserow:80/api
|
|
BASEROW_API_TOKEN=
|
|
|
|
# Docmost API (optionnel — pas utilise par le bridge generique R1)
|
|
# DOCMOST_API_URL=http://docmost:3000/api
|
|
# DOCMOST_API_TOKEN=
|
|
|
|
# Redis (cache + idempotence webhooks + rate limit)
|
|
REDIS_URL=redis://docmost-redis:6379
|
|
|
|
# Webhooks Baserow signature secret (HMAC-SHA256, header X-Baserow-Signature)
|
|
BASEROW_WEBHOOK_SECRET=
|
|
|
|
# Webhooks Docmost signature secret (HMAC-SHA256, header X-Docmost-Signature)
|
|
# Stub Bloc 7b — handlers metier viennent en Bloc 8 (Tiptap node-views)
|
|
# DOCMOST_WEBHOOK_SECRET=
|
|
|
|
# Auth tokens bridge — JSON serialise (Phase 2 simple)
|
|
# Format: [{"token":"brg_xxx","name":"label","scopes":["read:tables",...]}]
|
|
# Scopes generiques R1 : read:tables, write:tables, admin:*
|
|
BRIDGE_API_TOKENS=
|
|
|
|
# Authentik OIDC (optional — laisse vide pour mode local-only avec service tokens)
|
|
# Active uniquement si AUTHENTIK_ISSUER + AUTHENTIK_JWKS_URI + AUTHENTIK_AUDIENCE sont set.
|
|
# AUTHENTIK_ISSUER=https://auth.acadenice.com/application/o/formation-hub/
|
|
# AUTHENTIK_JWKS_URI=https://auth.acadenice.com/application/o/formation-hub/jwks/
|
|
# AUTHENTIK_AUDIENCE=formation-hub-bridge
|
|
# Mapping group Authentik -> scopes bridge (optionnel).
|
|
# AUTH_GROUPS_SCOPES_MAP={"acadenice-admins":["admin:*"],"acadenice-formateurs":["read:tables","write:tables"]}
|
|
#
|
|
# R1 generique : le bridge lit aussi le claim JWT `acadenice_permissions[]`
|
|
# qui alimente directement les scopes (alimente cote DocAdenice par le RBAC R2).
|
|
|
|
# Rate limiting (Bloc 5) — sliding window Redis sur /api/v1/*
|
|
# (hors /api/health, /api/ready, /api/webhooks/* qui ont leur propre defense).
|
|
# Global s'applique sur tous les verbes ; Mutation s'ajoute sur POST/PATCH/PUT/DELETE
|
|
# avec un compteur Redis distinct (suffixe `:mut`) volontairement plus strict.
|
|
# Cle derivee de l'identite : tokenId (service token) > email OIDC > sub OIDC > IP > anonymous.
|
|
# Defauts conservateurs ci-dessous, override si besoin.
|
|
# RATE_LIMIT_GLOBAL_MAX=100
|
|
# RATE_LIMIT_GLOBAL_WINDOW=60
|
|
# RATE_LIMIT_MUTATION_MAX=30
|
|
# RATE_LIMIT_MUTATION_WINDOW=60
|