@nocobase/plugin-ui-schema-storage 0.7.0-alpha.0
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/LICENSE +201 -0
- package/esm/actions/ui-schema-action.d.ts +16 -0
- package/esm/actions/ui-schema-action.js +100 -0
- package/esm/actions/ui-schema-action.js.map +1 -0
- package/esm/collections/uiSchemaServerHooks.d.ts +3 -0
- package/esm/collections/uiSchemaServerHooks.js +27 -0
- package/esm/collections/uiSchemaServerHooks.js.map +1 -0
- package/esm/collections/uiSchemaTemplates.d.ts +2 -0
- package/esm/collections/uiSchemaTemplates.js +39 -0
- package/esm/collections/uiSchemaTemplates.js.map +1 -0
- package/esm/collections/uiSchemaTreePath.d.ts +3 -0
- package/esm/collections/uiSchemaTreePath.js +42 -0
- package/esm/collections/uiSchemaTreePath.js.map +1 -0
- package/esm/collections/uiSchemas.d.ts +3 -0
- package/esm/collections/uiSchemas.js +32 -0
- package/esm/collections/uiSchemas.js.map +1 -0
- package/esm/dao/ui_schema_dao.d.ts +4 -0
- package/esm/dao/ui_schema_dao.js +6 -0
- package/esm/dao/ui_schema_dao.js.map +1 -0
- package/esm/dao/ui_schema_node_dao.d.ts +22 -0
- package/esm/dao/ui_schema_node_dao.js +6 -0
- package/esm/dao/ui_schema_node_dao.js.map +1 -0
- package/esm/helper.d.ts +0 -0
- package/esm/helper.js +1 -0
- package/esm/helper.js.map +1 -0
- package/esm/index.d.ts +3 -0
- package/esm/index.js +4 -0
- package/esm/index.js.map +1 -0
- package/esm/model.d.ts +6 -0
- package/esm/model.js +9 -0
- package/esm/model.js.map +1 -0
- package/esm/repository.d.ts +72 -0
- package/esm/repository.js +858 -0
- package/esm/repository.js.map +1 -0
- package/esm/server-hooks/hooks/bind-menu-to-role.d.ts +5 -0
- package/esm/server-hooks/hooks/bind-menu-to-role.js +26 -0
- package/esm/server-hooks/hooks/bind-menu-to-role.js.map +1 -0
- package/esm/server-hooks/hooks/factory.d.ts +6 -0
- package/esm/server-hooks/hooks/factory.js +8 -0
- package/esm/server-hooks/hooks/factory.js.map +1 -0
- package/esm/server-hooks/hooks/index.d.ts +6 -0
- package/esm/server-hooks/hooks/index.js +12 -0
- package/esm/server-hooks/hooks/index.js.map +1 -0
- package/esm/server-hooks/hooks/remove-parents-if-no-children.d.ts +6 -0
- package/esm/server-hooks/hooks/remove-parents-if-no-children.js +21 -0
- package/esm/server-hooks/hooks/remove-parents-if-no-children.js.map +1 -0
- package/esm/server-hooks/hooks/remove-schema.d.ts +6 -0
- package/esm/server-hooks/hooks/remove-schema.js +29 -0
- package/esm/server-hooks/hooks/remove-schema.js.map +1 -0
- package/esm/server-hooks/index.d.ts +23 -0
- package/esm/server-hooks/index.js +133 -0
- package/esm/server-hooks/index.js.map +1 -0
- package/esm/server-hooks/model.d.ts +3 -0
- package/esm/server-hooks/model.js +4 -0
- package/esm/server-hooks/model.js.map +1 -0
- package/esm/server.d.ts +10 -0
- package/esm/server.js +78 -0
- package/esm/server.js.map +1 -0
- package/lib/actions/ui-schema-action.d.ts +16 -0
- package/lib/actions/ui-schema-action.js +106 -0
- package/lib/actions/ui-schema-action.js.map +1 -0
- package/lib/collections/uiSchemaServerHooks.d.ts +3 -0
- package/lib/collections/uiSchemaServerHooks.js +29 -0
- package/lib/collections/uiSchemaServerHooks.js.map +1 -0
- package/lib/collections/uiSchemaTemplates.d.ts +2 -0
- package/lib/collections/uiSchemaTemplates.js +41 -0
- package/lib/collections/uiSchemaTemplates.js.map +1 -0
- package/lib/collections/uiSchemaTreePath.d.ts +3 -0
- package/lib/collections/uiSchemaTreePath.js +44 -0
- package/lib/collections/uiSchemaTreePath.js.map +1 -0
- package/lib/collections/uiSchemas.d.ts +3 -0
- package/lib/collections/uiSchemas.js +34 -0
- package/lib/collections/uiSchemas.js.map +1 -0
- package/lib/dao/ui_schema_dao.d.ts +4 -0
- package/lib/dao/ui_schema_dao.js +10 -0
- package/lib/dao/ui_schema_dao.js.map +1 -0
- package/lib/dao/ui_schema_node_dao.d.ts +22 -0
- package/lib/dao/ui_schema_node_dao.js +10 -0
- package/lib/dao/ui_schema_node_dao.js.map +1 -0
- package/lib/helper.d.ts +0 -0
- package/lib/helper.js +1 -0
- package/lib/helper.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/model.d.ts +6 -0
- package/lib/model.js +12 -0
- package/lib/model.js.map +1 -0
- package/lib/repository.d.ts +72 -0
- package/lib/repository.js +865 -0
- package/lib/repository.js.map +1 -0
- package/lib/server-hooks/hooks/bind-menu-to-role.d.ts +5 -0
- package/lib/server-hooks/hooks/bind-menu-to-role.js +30 -0
- package/lib/server-hooks/hooks/bind-menu-to-role.js.map +1 -0
- package/lib/server-hooks/hooks/factory.d.ts +6 -0
- package/lib/server-hooks/hooks/factory.js +12 -0
- package/lib/server-hooks/hooks/factory.js.map +1 -0
- package/lib/server-hooks/hooks/index.d.ts +6 -0
- package/lib/server-hooks/hooks/index.js +15 -0
- package/lib/server-hooks/hooks/index.js.map +1 -0
- package/lib/server-hooks/hooks/remove-parents-if-no-children.d.ts +6 -0
- package/lib/server-hooks/hooks/remove-parents-if-no-children.js +25 -0
- package/lib/server-hooks/hooks/remove-parents-if-no-children.js.map +1 -0
- package/lib/server-hooks/hooks/remove-schema.d.ts +6 -0
- package/lib/server-hooks/hooks/remove-schema.js +33 -0
- package/lib/server-hooks/hooks/remove-schema.js.map +1 -0
- package/lib/server-hooks/index.d.ts +23 -0
- package/lib/server-hooks/index.js +137 -0
- package/lib/server-hooks/index.js.map +1 -0
- package/lib/server-hooks/model.d.ts +3 -0
- package/lib/server-hooks/model.js +8 -0
- package/lib/server-hooks/model.js.map +1 -0
- package/lib/server.d.ts +10 -0
- package/lib/server.js +85 -0
- package/lib/server.js.map +1 -0
- package/package.json +22 -0
- package/tsconfig.build.json +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"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AE,iBAAiB,EAAE;wBAC9B,OAAO;qBACR;oBAED,MAAM,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE;wBAC9C,WAAW;qBACZ,CAAC,CAAC;gBACL,CAAC;aAAA,CAAC,CAAC;YAEH,EAAE,CAAC,EAAE,CAAC,uBAAuB,EAAE,SAAe,WAAW,CAAC,KAAK,EAAE,OAAO;;oBACtE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;oBAChC,MAAM,kBAAkB,GAAG,EAAE,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,UAAgC,CAAC;oBAE1F,MAAM,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE;wBAC7C,WAAW;qBACZ,CAAC,CAAC;gBACL,CAAC;aAAA,CAAC,CAAC;YAEH,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC;gBACxB,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,kCAAe;aACzB,CAAC,CAAC;YAEH,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;YACjD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC;KAAA;IAEK,IAAI;;YACR,MAAM,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;gBACnB,SAAS,EAAE,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC;aAClD,CAAC,CAAC;QACL,CAAC;KAAA;IAED,OAAO;QACL,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;CACF;AAlED,sDAkEC;AAED,kBAAe,qBAAqB,CAAC","sourcesContent":["import { MagicAttributeModel } from '@nocobase/database';\nimport { Plugin } from '@nocobase/server';\nimport { uid } from '@nocobase/utils';\nimport path from 'path';\nimport { uiSchemaActions } from './actions/ui-schema-action';\nimport { UiSchemaModel } from './model';\nimport UiSchemaRepository from './repository';\nimport { ServerHooks } from './server-hooks';\nimport { ServerHookModel } from './server-hooks/model';\n\nexport class UiSchemaStoragePlugin extends Plugin {\n serverHooks: ServerHooks;\n\n registerRepository() {\n this.app.db.registerRepositories({\n UiSchemaRepository,\n });\n }\n\n async beforeLoad() {\n const db = this.app.db;\n\n this.serverHooks = new ServerHooks(db);\n\n this.app.db.registerModels({ MagicAttributeModel, UiSchemaModel, ServerHookModel });\n\n this.registerRepository();\n\n db.on('uiSchemas.beforeCreate', function setUid(model) {\n if (!model.get('name')) {\n model.set('name', uid());\n }\n });\n\n db.on('uiSchemas.afterCreate', async function insertSchema(model, options) {\n const { transaction } = options;\n const uiSchemaRepository = db.getCollection('uiSchemas').repository as UiSchemaRepository;\n\n const context = options.context;\n\n if (context?.disableInsertHook) {\n return;\n }\n\n await uiSchemaRepository.insert(model.toJSON(), {\n transaction,\n });\n });\n\n db.on('uiSchemas.afterUpdate', async function patchSchema(model, options) {\n const { transaction } = options;\n const uiSchemaRepository = db.getCollection('uiSchemas').repository as UiSchemaRepository;\n\n await uiSchemaRepository.patch(model.toJSON(), {\n transaction,\n });\n });\n\n this.app.resourcer.define({\n name: 'uiSchemas',\n actions: uiSchemaActions,\n });\n\n this.app.acl.allow('uiSchemas', '*', 'loggedIn');\n this.app.acl.allow('uiSchemaTemplates', '*', 'loggedIn');\n }\n\n async load() {\n await this.db.import({\n directory: path.resolve(__dirname, 'collections'),\n });\n }\n\n getName(): string {\n return this.getPackageName(__dirname);\n }\n}\n\nexport default UiSchemaStoragePlugin;\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nocobase/plugin-ui-schema-storage",
|
|
3
|
+
"version": "0.7.0-alpha.0",
|
|
4
|
+
"main": "lib/index.js",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"licenses": [
|
|
7
|
+
{
|
|
8
|
+
"type": "Apache-2.0",
|
|
9
|
+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "rimraf -rf lib esm dist && npm run build:cjs && npm run build:esm",
|
|
14
|
+
"build:cjs": "tsc --project tsconfig.build.json",
|
|
15
|
+
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir esm"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@formily/json-schema": "^2.0.15",
|
|
19
|
+
"@nocobase/test": "0.7.0-alpha.0"
|
|
20
|
+
},
|
|
21
|
+
"gitHead": "82167c6c4781195ae536cbc35c3c0006f655e044"
|
|
22
|
+
}
|