fix: convert endpoint kebab-case to camelCase in createReportController handlerMethod — v1.9.1

This commit is contained in:
Кирилл Осипков 2026-06-01 11:27:41 +03:00
parent 3136f0b5f4
commit 04cbcb791e
3 changed files with 6 additions and 4 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@erp/plugin-sdk", "name": "@erp/plugin-sdk",
"version": "1.9.0", "version": "1.9.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@erp/plugin-sdk", "name": "@erp/plugin-sdk",
"version": "1.9.0", "version": "1.9.1",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"uuid": "^9.0.1" "uuid": "^9.0.1"

View File

@ -1,6 +1,6 @@
{ {
"name": "@erp/plugin-sdk", "name": "@erp/plugin-sdk",
"version": "1.9.0", "version": "1.9.1",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
"bin": { "bin": {

View File

@ -27,7 +27,9 @@ export function createReportController(options: ReportControllerOptions): Type<a
const pattern = `plugin.${pluginId}.report.${ep.endpoint}`; const pattern = `plugin.${pluginId}.report.${ep.endpoint}`;
const safeName = ep.endpoint.replace(/[^a-zA-Z0-9_]/g, '_'); const safeName = ep.endpoint.replace(/[^a-zA-Z0-9_]/g, '_');
const methodName = `handle_${safeName}`; const methodName = `handle_${safeName}`;
const handlerMethod = `${methodPrefix}${ep.endpoint.charAt(0).toUpperCase()}${ep.endpoint.slice(1)}`; const handlerMethod = `${methodPrefix}${ep.endpoint
.replace(/[-_](.)/g, (_, c) => c.toUpperCase())
.replace(/^([a-z])/, (_, c) => c.toUpperCase())}`;
Object.defineProperty(ReportCapabilityController.prototype, methodName, { Object.defineProperty(ReportCapabilityController.prototype, methodName, {
value: async function (this: any, payload: any) { value: async function (this: any, payload: any) {