@nocobase/plugin-ui-schema-storage 0.21.0-alpha.5 → 0.21.0-alpha.6

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.
@@ -1,11 +1,11 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.21.0-alpha.5",
3
- "@nocobase/database": "0.21.0-alpha.5",
4
- "@nocobase/cache": "0.21.0-alpha.5",
5
- "@nocobase/utils": "0.21.0-alpha.5",
2
+ "@nocobase/client": "0.21.0-alpha.6",
3
+ "@nocobase/database": "0.21.0-alpha.6",
4
+ "@nocobase/cache": "0.21.0-alpha.6",
5
+ "@nocobase/utils": "0.21.0-alpha.6",
6
6
  "lodash": "4.17.21",
7
- "@nocobase/server": "0.21.0-alpha.5",
8
- "@nocobase/actions": "0.21.0-alpha.5",
9
- "@nocobase/resourcer": "0.21.0-alpha.5",
7
+ "@nocobase/server": "0.21.0-alpha.6",
8
+ "@nocobase/actions": "0.21.0-alpha.6",
9
+ "@nocobase/resourcer": "0.21.0-alpha.6",
10
10
  "@formily/json-schema": "2.3.0"
11
11
  };
@@ -2,6 +2,8 @@ import { Context } from '@nocobase/actions';
2
2
  export declare const uiSchemaActions: {
3
3
  getJsonSchema: (ctx: any, next: any) => Promise<void>;
4
4
  getProperties: (ctx: any, next: any) => Promise<void>;
5
+ getParentJsonSchema: (ctx: any, next: any) => Promise<void>;
6
+ getParentProperty: (ctx: any, next: any) => Promise<void>;
5
7
  insert: (ctx: any, next: any) => Promise<void>;
6
8
  insertNewSchema: (ctx: any, next: any) => Promise<void>;
7
9
  remove: (ctx: any, next: any) => Promise<void>;
@@ -69,6 +69,8 @@ const uiSchemaActions = {
69
69
  readFromCache: true
70
70
  })
71
71
  ),
72
+ getParentJsonSchema: callRepositoryMethod("getParentJsonSchema", "resourceIndex"),
73
+ getParentProperty: callRepositoryMethod("getParentProperty", "resourceIndex"),
72
74
  insert: callRepositoryMethod("insert", "values"),
73
75
  insertNewSchema: callRepositoryMethod("insertNewSchema", "values"),
74
76
  remove: callRepositoryMethod("remove", "resourceIndex"),
@@ -39,6 +39,8 @@ export declare class UiSchemaRepository extends Repository {
39
39
  "x-uid": any;
40
40
  "x-async": boolean;
41
41
  }>>;
42
+ getParentJsonSchema(uid: string, options?: GetJsonSchemaOptions): Promise<any>;
43
+ getParentProperty(uid: string, options?: GetPropertiesOptions): Promise<any>;
42
44
  getJsonSchema(uid: string, options?: GetJsonSchemaOptions): Promise<any>;
43
45
  nodesToSchema(nodes: any, rootUid: any): {
44
46
  "x-uid": any;
@@ -173,6 +173,20 @@ const _UiSchemaRepository = class _UiSchemaRepository extends import_database.Re
173
173
  }
174
174
  return this.doGetProperties(uid2, options);
175
175
  }
176
+ async getParentJsonSchema(uid2, options = {}) {
177
+ const parentUid = await this.findParentUid(uid2, options.transaction);
178
+ if (!parentUid) {
179
+ return null;
180
+ }
181
+ return this.getJsonSchema(parentUid, options);
182
+ }
183
+ async getParentProperty(uid2, options = {}) {
184
+ const parentUid = await this.findParentUid(uid2, options.transaction);
185
+ if (!parentUid) {
186
+ return null;
187
+ }
188
+ return this.getJsonSchema(parentUid, options);
189
+ }
176
190
  async getJsonSchema(uid2, options) {
177
191
  if ((options == null ? void 0 : options.readFromCache) && this.cache) {
178
192
  return this.cache.wrap(`s_${uid2}`, () => {
@@ -58,20 +58,7 @@ class UiSchemaStoragePlugin extends import_server.Plugin {
58
58
  });
59
59
  this.app.acl.registerSnippet({
60
60
  name: "ui.uiSchemas",
61
- actions: [
62
- "uiSchemas:insert",
63
- "uiSchemas:insertNewSchema",
64
- "uiSchemas:remove",
65
- "uiSchemas:patch",
66
- "uiSchemas:batchPatch",
67
- "uiSchemas:clearAncestor",
68
- "uiSchemas:insertBeforeBegin",
69
- "uiSchemas:insertAfterBegin",
70
- "uiSchemas:insertBeforeEnd",
71
- "uiSchemas:insertAfterEnd",
72
- "uiSchemas:insertAdjacent",
73
- "uiSchemas:saveAsTemplate"
74
- ]
61
+ actions: ["uiSchemas:*"]
75
62
  });
76
63
  db.on("uiSchemas.beforeCreate", function setUid(model) {
77
64
  if (!model.get("name")) {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "UI schema 存储服务",
5
5
  "description": "Provides centralized UI schema storage service.",
6
6
  "description.zh-CN": "提供中心化的 UI schema 存储服务。",
7
- "version": "0.21.0-alpha.5",
7
+ "version": "0.21.0-alpha.6",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/ui-schema-storage",
@@ -24,7 +24,7 @@
24
24
  "@nocobase/test": "0.x",
25
25
  "@nocobase/utils": "0.x"
26
26
  },
27
- "gitHead": "20ed1453da807587b0dc628d167c815156bf9ad4",
27
+ "gitHead": "25eaaf1bdf44d2b457a3a3742532db9d2008216b",
28
28
  "keywords": [
29
29
  "System & security"
30
30
  ]