fix(plugin-error-handler): cannot find module '@formily/json-schema'

This commit is contained in:
chenos 2022-04-26 00:35:40 +08:00
parent 2b3cd45ca1
commit 14f30e61e8
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@nocobase/plugin-error-handler", "name": "@nocobase/plugin-error-handler",
"version": "0.7.0-alpha.7", "version": "0.7.0-alpha.9",
"description": "", "description": "",
"license": "Apache-2.0", "license": "Apache-2.0",
"licenses": [ "licenses": [
@ -17,7 +17,8 @@
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm" "build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm"
}, },
"dependencies": { "dependencies": {
"@nocobase/server": "0.7.0-alpha.7" "@formily/json-schema": "^2.0.15",
"@nocobase/server": "0.7.0-alpha.9"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,4 +1,4 @@
import { compile } from '@formily/json-schema/lib/compiler'; import { Schema } from '@formily/json-schema';
import { Plugin } from '@nocobase/server'; import { Plugin } from '@nocobase/server';
import lodash from 'lodash'; import lodash from 'lodash';
import { BaseError } from 'sequelize'; import { BaseError } from 'sequelize';
@ -27,7 +27,7 @@ export class PluginErrorHandler extends Plugin {
const model = instance.constructor; const model = instance.constructor;
const collection = this.db.modelCollection.get(model); const collection = this.db.modelCollection.get(model);
const field = collection.getField(path); const field = collection.getField(path);
const fieldOptions = compile(field.options, { t: tFunc }); const fieldOptions = Schema.compile(field.options, { t: tFunc });
const title = lodash.get(fieldOptions, 'uiSchema.title', path); const title = lodash.get(fieldOptions, 'uiSchema.title', path);
return title; return title;
}; };