@nocobase/plugin-ui-schema-storage 0.21.0-alpha.5 → 0.21.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.
@@ -1,5 +1,5 @@
1
1
  import { Plugin } from '@nocobase/client';
2
- declare class UiSchemaStoragePlugin extends Plugin {
2
+ declare class PluginUISchemaStorageClient extends Plugin {
3
3
  load(): Promise<void>;
4
4
  }
5
- export default UiSchemaStoragePlugin;
5
+ export default PluginUISchemaStorageClient;
@@ -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.7",
3
+ "@nocobase/database": "0.21.0-alpha.7",
4
+ "@nocobase/cache": "0.21.0-alpha.7",
5
+ "@nocobase/utils": "0.21.0-alpha.7",
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.7",
8
+ "@nocobase/actions": "0.21.0-alpha.7",
9
+ "@nocobase/resourcer": "0.21.0-alpha.7",
10
10
  "@formily/json-schema": "2.3.0"
11
11
  };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './server';
2
- import { UiSchemaStoragePlugin } from './server';
3
- export default UiSchemaStoragePlugin;
2
+ import { PluginUISchemaStorageServer } from './server';
3
+ export default PluginUISchemaStorageServer;
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ __export(src_exports, {
23
23
  module.exports = __toCommonJS(src_exports);
24
24
  __reExport(src_exports, require("./server"), module.exports);
25
25
  var import_server = require("./server");
26
- var src_default = import_server.UiSchemaStoragePlugin;
26
+ var src_default = import_server.PluginUISchemaStorageServer;
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
29
29
  ...require("./server")
@@ -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"),
@@ -1,4 +1,4 @@
1
- import { UiSchemaStoragePlugin } from './server';
1
+ import { PluginUISchemaStorageServer } from './server';
2
2
  export * from './repository';
3
3
  export * from './server';
4
- export default UiSchemaStoragePlugin;
4
+ export default PluginUISchemaStorageServer;
@@ -24,7 +24,7 @@ module.exports = __toCommonJS(server_exports);
24
24
  var import_server = require("./server");
25
25
  __reExport(server_exports, require("./repository"), module.exports);
26
26
  __reExport(server_exports, require("./server"), module.exports);
27
- var server_default = import_server.UiSchemaStoragePlugin;
27
+ var server_default = import_server.PluginUISchemaStorageServer;
28
28
  // Annotate the CommonJS export names for ESM import in node:
29
29
  0 && (module.exports = {
30
30
  ...require("./repository"),
@@ -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}`, () => {
@@ -1,9 +1,9 @@
1
1
  import { Plugin } from '@nocobase/server';
2
2
  import { ServerHooks } from './server-hooks';
3
- export declare class UiSchemaStoragePlugin extends Plugin {
3
+ export declare class PluginUISchemaStorageServer extends Plugin {
4
4
  serverHooks: ServerHooks;
5
5
  registerRepository(): void;
6
6
  beforeLoad(): Promise<void>;
7
7
  load(): Promise<void>;
8
8
  }
9
- export default UiSchemaStoragePlugin;
9
+ export default PluginUISchemaStorageServer;
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
  var server_exports = {};
29
29
  __export(server_exports, {
30
- UiSchemaStoragePlugin: () => UiSchemaStoragePlugin,
30
+ PluginUISchemaStorageServer: () => PluginUISchemaStorageServer,
31
31
  default: () => server_default
32
32
  });
33
33
  module.exports = __toCommonJS(server_exports);
@@ -40,7 +40,7 @@ var import_model = require("./model");
40
40
  var import_repository = __toESM(require("./repository"));
41
41
  var import_server_hooks = require("./server-hooks");
42
42
  var import_model2 = require("./server-hooks/model");
43
- class UiSchemaStoragePlugin extends import_server.Plugin {
43
+ class PluginUISchemaStorageServer extends import_server.Plugin {
44
44
  serverHooks;
45
45
  registerRepository() {
46
46
  this.app.db.registerRepositories({
@@ -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")) {
@@ -114,8 +101,8 @@ class UiSchemaStoragePlugin extends import_server.Plugin {
114
101
  await this.importCollections((0, import_path.resolve)(__dirname, "collections"));
115
102
  }
116
103
  }
117
- var server_default = UiSchemaStoragePlugin;
104
+ var server_default = PluginUISchemaStorageServer;
118
105
  // Annotate the CommonJS export names for ESM import in node:
119
106
  0 && (module.exports = {
120
- UiSchemaStoragePlugin
107
+ PluginUISchemaStorageServer
121
108
  });
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.7",
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": "b1be3993f8aa81173d01bc390aa8e4c5adcc0e2d",
28
28
  "keywords": [
29
29
  "System & security"
30
30
  ]