@nocobase/plugin-ui-schema-storage 1.4.0-alpha.20240906133133 → 1.4.0-alpha.20240910145333

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.
@@ -8,13 +8,13 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.4.0-alpha.20240906133133",
12
- "@nocobase/database": "1.4.0-alpha.20240906133133",
13
- "@nocobase/cache": "1.4.0-alpha.20240906133133",
14
- "@nocobase/utils": "1.4.0-alpha.20240906133133",
11
+ "@nocobase/client": "1.4.0-alpha.20240910145333",
12
+ "@nocobase/database": "1.4.0-alpha.20240910145333",
13
+ "@nocobase/cache": "1.4.0-alpha.20240910145333",
14
+ "@nocobase/utils": "1.4.0-alpha.20240910145333",
15
15
  "lodash": "4.17.21",
16
- "@nocobase/server": "1.4.0-alpha.20240906133133",
17
- "@nocobase/actions": "1.4.0-alpha.20240906133133",
18
- "@nocobase/resourcer": "1.4.0-alpha.20240906133133",
16
+ "@nocobase/server": "1.4.0-alpha.20240910145333",
17
+ "@nocobase/actions": "1.4.0-alpha.20240910145333",
18
+ "@nocobase/resourcer": "1.4.0-alpha.20240910145333",
19
19
  "@formily/json-schema": "2.3.0"
20
20
  };
@@ -16,6 +16,7 @@ export declare const uiSchemaActions: {
16
16
  insertNewSchema: (ctx: any, next: any) => Promise<void>;
17
17
  remove: (ctx: any, next: any) => Promise<void>;
18
18
  patch: (ctx: any, next: any) => Promise<void>;
19
+ initializeActionContext: (ctx: any, next: any) => Promise<void>;
19
20
  batchPatch: (ctx: any, next: any) => Promise<void>;
20
21
  clearAncestor: (ctx: any, next: any) => Promise<void>;
21
22
  insertAdjacent: (ctx: Context, next: any) => Promise<void>;
@@ -84,6 +84,7 @@ const uiSchemaActions = {
84
84
  insertNewSchema: callRepositoryMethod("insertNewSchema", "values"),
85
85
  remove: callRepositoryMethod("remove", "resourceIndex"),
86
86
  patch: callRepositoryMethod("patch", "values"),
87
+ initializeActionContext: callRepositoryMethod("initializeActionContext", "values"),
87
88
  batchPatch: callRepositoryMethod("batchPatch", "values"),
88
89
  clearAncestor: callRepositoryMethod("clearAncestor", "resourceIndex"),
89
90
  insertAdjacent: insertPositionActionBuilder(),
@@ -56,6 +56,7 @@ export declare class UiSchemaRepository extends Repository {
56
56
  };
57
57
  clearAncestor(uid: string, options?: Transactionable): Promise<void>;
58
58
  patch(newSchema: any, options?: any): Promise<void>;
59
+ initializeActionContext(newSchema: any, options?: any): Promise<void>;
59
60
  batchPatch(schemas: any[], options?: any): Promise<void>;
60
61
  removeEmptyParents(options: Transactionable & {
61
62
  uid: string;
@@ -282,6 +282,22 @@ const _UiSchemaRepository = class _UiSchemaRepository extends import_database.Re
282
282
  };
283
283
  await traverSchemaTree(newSchema);
284
284
  }
285
+ async initializeActionContext(newSchema, options = {}) {
286
+ if (!newSchema["x-uid"] || !newSchema["x-action-context"]) {
287
+ return;
288
+ }
289
+ const { transaction: transaction2 } = options;
290
+ const nodeModel = await this.findOne({
291
+ filter: {
292
+ "x-uid": newSchema["x-uid"]
293
+ },
294
+ transaction: transaction2
295
+ });
296
+ if (!import_lodash.default.isEmpty(nodeModel == null ? void 0 : nodeModel.get("schema")["x-action-context"])) {
297
+ return;
298
+ }
299
+ return this.patch(import_lodash.default.pick(newSchema, ["x-uid", "x-action-context"]), options);
300
+ }
285
301
  async batchPatch(schemas, options) {
286
302
  const { transaction: transaction2 } = options;
287
303
  for (const schema of schemas) {
@@ -932,6 +948,9 @@ __decorateClass([
932
948
  __decorateClass([
933
949
  transaction()
934
950
  ], _UiSchemaRepository.prototype, "patch", 1);
951
+ __decorateClass([
952
+ transaction()
953
+ ], _UiSchemaRepository.prototype, "initializeActionContext", 1);
935
954
  __decorateClass([
936
955
  transaction()
937
956
  ], _UiSchemaRepository.prototype, "batchPatch", 1);
@@ -96,7 +96,11 @@ class PluginUISchemaStorageServer extends import_server.Plugin {
96
96
  name: "uiSchemas",
97
97
  actions: import_ui_schema_action.uiSchemaActions
98
98
  });
99
- this.app.acl.allow("uiSchemas", ["getProperties", "getJsonSchema", "getParentJsonSchema"], "loggedIn");
99
+ this.app.acl.allow(
100
+ "uiSchemas",
101
+ ["getProperties", "getJsonSchema", "getParentJsonSchema", "initializeActionContext"],
102
+ "loggedIn"
103
+ );
100
104
  this.app.acl.allow("uiSchemaTemplates", ["get", "list"], "loggedIn");
101
105
  }
102
106
  async load() {
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": "1.4.0-alpha.20240906133133",
7
+ "version": "1.4.0-alpha.20240910145333",
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": "1.x",
25
25
  "@nocobase/utils": "1.x"
26
26
  },
27
- "gitHead": "e87488347b8376ba6877306986ecc0c1d2d41542",
27
+ "gitHead": "87807593da799e557718f8e69172244c28c08d98",
28
28
  "keywords": [
29
29
  "System & security"
30
30
  ]