docs/refactor: rename getModuleMetadata and update route auth format

- Rename `getModuleMetadata` to `getModuleMetadataGenerator` in registry,
  index, and client exports to clarify its purpose (returns a generator
  function, not a metadata object)
- Add new `getModuleMetadata` and `getMetadataGenerator` exports from
  `modules.metadata.js` for server-side metadata object retrieval
- Update route auth format in docs from `requireAuth`/`requireAdmin`
  flags to a single `auth` field with values: `'admin'`, `'user'`,
  or `'public'`
- Fix `isModuleEnabledInEnv` to replace hyphens with underscores in
  env var names (e.g. `my-module` → `ZEN_MODULE_MY_MODULE`)
- Replace `useState` initializer in `ZenProvider` with `useRef` guard
  to avoid React strict mode double-invocation issues
This commit is contained in:
2026-04-12 18:58:01 -04:00
parent c806c8d8d4
commit 3e633e981a
11 changed files with 68 additions and 38 deletions
+4 -7
View File
@@ -132,17 +132,14 @@ async function handleList(request) {
export default {
routes: [
{
path: 'mon-module/list',
method: 'GET',
handler: handleList,
requireAuth: true,
requireAdmin: false,
},
{ path: '/admin/mon-module/list', method: 'GET', handler: handleList, auth: 'admin' },
{ path: '/mon-module/list', method: 'GET', handler: handleList, auth: 'public' },
],
};
```
Valeurs acceptées pour `auth` : `'admin'` (JWT admin requis), `'user'` (JWT utilisateur requis), `'public'` (aucune auth).
---
## cron.config.js