@nodefony/framework 10.0.0-alpha.6 → 10.0.0-alpha.7
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.
- package/dist/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.149.0 → _@oxc-project_runtime@0.150.0}/helpers/esm/decorateMetadata.js +1 -1
- package/dist/index.js +2 -2
- package/dist/nodefony/service/AdminBroker.js +2 -2
- package/dist/nodefony/service/IdempotencyStore.js +2 -2
- package/dist/nodefony/service/router.js +2 -2
- package/dist/nodefony/src/FrameworkAdminApi.js +30 -11
- package/package.json +9 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/decorate.js
|
|
2
2
|
function __decorate(decorators, target, key, desc) {
|
|
3
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.150.0/helpers/esm/decorateMetadata.js
|
|
2
2
|
function __decorateMetadata(k, v) {
|
|
3
3
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4
4
|
}
|
package/dist/index.js
CHANGED
|
@@ -7,8 +7,8 @@ import Route from "./nodefony/src/Route.js";
|
|
|
7
7
|
import Controller from "./nodefony/src/Controller.js";
|
|
8
8
|
import { All, Anonymous, Body, BypassFirewall, Cookie, Csp, CsrfExempt, CsrfProtect, CurrentUser, Delete, Domain, Get, Head, Header, Headers, HttpCode, Idempotent, IsGranted, Options, Param, Patch, Post, Put, Query, Redirect, Req, RequireScope, Res, Scope, Session, UploadedFile, UploadedFiles, UseSession, controller, controllers, route, routeExpectsBodyStream } from "./nodefony/decorators/routerDecorators.js";
|
|
9
9
|
import Resolver from "./nodefony/src/Resolver.js";
|
|
10
|
-
import __decorateMetadata from "./_virtual/_@oxc-project_runtime@0.
|
|
11
|
-
import __decorate from "./_virtual/_@oxc-project_runtime@0.
|
|
10
|
+
import __decorateMetadata from "./_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorateMetadata.js";
|
|
11
|
+
import __decorate from "./_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js";
|
|
12
12
|
import router_default from "./nodefony/service/router.js";
|
|
13
13
|
import ResourceController from "./nodefony/src/ResourceController.js";
|
|
14
14
|
import AdminApiController from "./nodefony/controller/AdminApiController.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js";
|
|
3
3
|
import router_default from "./router.js";
|
|
4
4
|
import AdminApiController from "../controller/AdminApiController.js";
|
|
5
5
|
import { ADMIN_DEFAULT_ROLE, Module, Service, injectable, resolveAdminRole } from "nodefony";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js";
|
|
3
3
|
import { Module, Service, assertPageQuery, injectable } from "nodefony";
|
|
4
4
|
//#region nodefony/service/IdempotencyStore.ts
|
|
5
5
|
const serviceName = "idempotencyStore";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Route from "../src/Route.js";
|
|
2
2
|
import { routeExpectsBodyStream } from "../decorators/routerDecorators.js";
|
|
3
3
|
import Resolver from "../src/Resolver.js";
|
|
4
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
5
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
4
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorateMetadata.js";
|
|
5
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js";
|
|
6
6
|
import { Module, Service, injectable } from "nodefony";
|
|
7
7
|
import { HttpError, isDomainAllowed } from "@nodefony/http";
|
|
8
8
|
//#region nodefony/service/router.ts
|
|
@@ -101,6 +101,29 @@ function createFrameworkAdminApi(broker, opts) {
|
|
|
101
101
|
* une barre de recherche que le serveur refuse en 400.
|
|
102
102
|
*/
|
|
103
103
|
const SEARCHABLE = true;
|
|
104
|
+
/**
|
|
105
|
+
* **Le** prédicat de recherche des routes — UNE implémentation, deux appels.
|
|
106
|
+
*
|
|
107
|
+
* `routes/page` s'en sert pour son `q`, et `routes` (le dump plat) pour le
|
|
108
|
+
* `q` que la commande `inspect` lui passe. Recopier la liste des champs
|
|
109
|
+
* balayés ferait diverger les deux portes en silence : on chercherait dans
|
|
110
|
+
* la console sur un champ que la ligne de commande ignore, sans qu'aucune
|
|
111
|
+
* erreur ne le dise.
|
|
112
|
+
*
|
|
113
|
+
* @param r - la route sérialisée.
|
|
114
|
+
* @param needle - le motif, DÉJÀ en minuscules (le comparer est le travail
|
|
115
|
+
* de l'appelant, qui l'a normalisé une fois pour toute la collection).
|
|
116
|
+
* @returns `true` si le motif apparaît dans l'un des champs balayés.
|
|
117
|
+
*/
|
|
118
|
+
const matchesSearch = (r, needle) => [
|
|
119
|
+
r.methods.join(","),
|
|
120
|
+
r.path,
|
|
121
|
+
r.name,
|
|
122
|
+
r.controller,
|
|
123
|
+
r.action,
|
|
124
|
+
r.module,
|
|
125
|
+
r.bypassFirewall ? "bypass" : "protected"
|
|
126
|
+
].filter(Boolean).join(" ").toLowerCase().includes(needle);
|
|
104
127
|
/** Valeur d'une colonne pour le tri/filtre serveur (clés = colonnes du front). */
|
|
105
128
|
const cell = (r, key) => {
|
|
106
129
|
switch (key) {
|
|
@@ -146,8 +169,12 @@ function createFrameworkAdminApi(broker, opts) {
|
|
|
146
169
|
const endpoints = [
|
|
147
170
|
{
|
|
148
171
|
path: "routes",
|
|
149
|
-
summary: "All registered routes (Router dump) — name, path, methods, controller",
|
|
150
|
-
handler: () =>
|
|
172
|
+
summary: "All registered routes (Router dump) — name, path, methods, controller. Optional ?q= narrows the dump (path, name, controller, action, module, methods).",
|
|
173
|
+
handler: (request) => {
|
|
174
|
+
const needle = one(request.query.q)?.toLowerCase() ?? "";
|
|
175
|
+
const rows = router_default.routes.map(serializeRoute);
|
|
176
|
+
return needle === "" ? rows : rows.filter((r) => matchesSearch(r, needle));
|
|
177
|
+
}
|
|
151
178
|
},
|
|
152
179
|
{
|
|
153
180
|
path: "routes/page",
|
|
@@ -172,15 +199,7 @@ function createFrameworkAdminApi(broker, opts) {
|
|
|
172
199
|
filters = [];
|
|
173
200
|
}
|
|
174
201
|
let rows = router_default.routes.map(serializeRoute);
|
|
175
|
-
if (search) rows = rows.filter((r) =>
|
|
176
|
-
r.methods.join(","),
|
|
177
|
-
r.path,
|
|
178
|
-
r.name,
|
|
179
|
-
r.controller,
|
|
180
|
-
r.action,
|
|
181
|
-
r.module,
|
|
182
|
-
r.bypassFirewall ? "bypass" : "protected"
|
|
183
|
-
].filter(Boolean).join(" ").toLowerCase().includes(search));
|
|
202
|
+
if (search) rows = rows.filter((r) => matchesSearch(r, search));
|
|
184
203
|
for (const f of filters) rows = rows.filter((r) => matchOp(cell(r, f.key), f.op, f.value));
|
|
185
204
|
const total = rows.length;
|
|
186
205
|
if (query.order?.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodefony/framework",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.7",
|
|
4
4
|
"description": "Le modèle de programmation Nodefony : routeur, contrôleurs, décorateurs et vues — HTTP et WebSocket dans le même contexte",
|
|
5
5
|
"author": "Christophe CAMENSULI <ccamensuli@gmail.com>",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,23 +51,23 @@
|
|
|
51
51
|
"tslib": "2.8.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@nodefony/http": "^10.0.0-alpha.
|
|
54
|
+
"@nodefony/http": "^10.0.0-alpha.7",
|
|
55
55
|
"@types/chai": "5.2.3",
|
|
56
|
-
"@types/node": "26.
|
|
57
|
-
"@vitest/coverage-v8": "5.0.
|
|
56
|
+
"@types/node": "26.6.1",
|
|
57
|
+
"@vitest/coverage-v8": "5.0.1",
|
|
58
58
|
"chai": "6.2.2",
|
|
59
|
-
"nodefony": "^10.0.0-alpha.
|
|
59
|
+
"nodefony": "^10.0.0-alpha.7",
|
|
60
60
|
"rimraf": "6.1.3",
|
|
61
61
|
"tsx": "4.23.13",
|
|
62
|
-
"vitest": "5.0.
|
|
62
|
+
"vitest": "5.0.1"
|
|
63
63
|
},
|
|
64
64
|
"license": "Apache-2.0",
|
|
65
65
|
"readmeFilename": "README.md",
|
|
66
66
|
"contributors": [],
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@nodefony/http": "^10.0.0-alpha.
|
|
69
|
-
"nodefony": "^10.0.0-alpha.
|
|
70
|
-
"zod": "^4.6.
|
|
68
|
+
"@nodefony/http": "^10.0.0-alpha.7",
|
|
69
|
+
"nodefony": "^10.0.0-alpha.7",
|
|
70
|
+
"zod": "^4.6.5"
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
73
73
|
"dist",
|