@ldsg/form 0.3.38 → 0.3.41

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.
@@ -0,0 +1,105 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`unit 1`] = `
4
+ {
5
+ "description": "",
6
+ "id": "test-form",
7
+ "inputObjectInfo": {
8
+ "description": "",
9
+ "fieldInfoList": [
10
+ {
11
+ "dbKey": "test_1",
12
+ "description": "",
13
+ "id": "test-object-1-field-1",
14
+ "name": "test1",
15
+ "slug": "test-1",
16
+ "title": "测试对象1测试字段1",
17
+ "typeInfo": {
18
+ "platformToTypeMap": {
19
+ "COMMON": {
20
+ "max": "10",
21
+ "type": "string",
22
+ },
23
+ "GRAPHQL": "String",
24
+ "JSON": undefined,
25
+ "MONGOOSE": undefined,
26
+ },
27
+ },
28
+ },
29
+ {
30
+ "dbKey": "test_2",
31
+ "description": "",
32
+ "id": "test-object-1-field-2",
33
+ "name": "test2",
34
+ "slug": "test-2",
35
+ "title": "测试对象1测试字段2",
36
+ "typeInfo": {
37
+ "platformToTypeMap": {
38
+ "COMMON": {
39
+ "max": "10",
40
+ "type": "string",
41
+ },
42
+ "GRAPHQL": "String",
43
+ "JSON": undefined,
44
+ "MONGOOSE": undefined,
45
+ },
46
+ },
47
+ },
48
+ {
49
+ "dbKey": "test_3",
50
+ "description": "",
51
+ "id": "test-object-1-field-3",
52
+ "name": "test3",
53
+ "slug": "test-3",
54
+ "title": "测试对象1测试字段3",
55
+ "typeInfo": {
56
+ "platformToTypeMap": {
57
+ "COMMON": {
58
+ "max": "10",
59
+ "type": "string",
60
+ },
61
+ "GRAPHQL": "String",
62
+ "JSON": undefined,
63
+ "MONGOOSE": undefined,
64
+ },
65
+ },
66
+ },
67
+ ],
68
+ "name": "testObject1",
69
+ "objectTypeName": "TestObject1",
70
+ "slug": "test-object-1",
71
+ "title": "测试对象1",
72
+ },
73
+ "name": "testForm",
74
+ "outputObjectInfo": {
75
+ "description": "",
76
+ "fieldInfoList": [
77
+ {
78
+ "dbKey": "test_1",
79
+ "description": "",
80
+ "id": "test-object-2-field-1",
81
+ "name": "test1",
82
+ "slug": "test-1",
83
+ "title": "测试对象2测试字段1",
84
+ "typeInfo": {
85
+ "platformToTypeMap": {
86
+ "COMMON": {
87
+ "max": "10",
88
+ "type": "string",
89
+ },
90
+ "GRAPHQL": "String",
91
+ "JSON": undefined,
92
+ "MONGOOSE": undefined,
93
+ },
94
+ },
95
+ },
96
+ ],
97
+ "name": "testObject2",
98
+ "objectTypeName": "TestObject2",
99
+ "slug": "test-object-2",
100
+ "title": "测试对象2",
101
+ },
102
+ "slug": "test-form",
103
+ "title": "测试表单",
104
+ }
105
+ `;
@@ -90,6 +90,7 @@ test("unit", () => {
90
90
  kind: "workflow",
91
91
  parentId: "root",
92
92
  settings: {
93
+ slug: "test-workflow",
93
94
  title: "测试工作流",
94
95
  description: "",
95
96
  startWorkflowNodeResourceId: "",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,sDAAsD,EAAE,uBAGpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+BAQnE,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBAG3D,CAAC;AAEF,eAAO,MAAM,8CAA8C,EAAE,0CAG1D,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,0CAA0C,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,sDAAsD,EAAE,uBAIpE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+BAQnE,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBAI3D,CAAC;AAEF,eAAO,MAAM,8CAA8C,EAAE,0CAG1D,CAAC"}
package/dist/constants.js CHANGED
@@ -6,6 +6,7 @@ exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = exports.RESOURCE_DEFINI
6
6
  * 实例化资源处理程序普通资源配置
7
7
  */
8
8
  exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = {
9
+ slug: "form-instantiate-resource-handler",
9
10
  title: "表单资源处理程序",
10
11
  description: "",
11
12
  };
@@ -23,6 +24,7 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
23
24
  ],
24
25
  };
25
26
  exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = {
27
+ slug: "form-resource-definition",
26
28
  title: "表单资源定义",
27
29
  description: "",
28
30
  };
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvD,qBAAa,YAAa,SAAQ,QAAQ,CAAC,4BAA4B,CAAC;IACtE,WAAW,EAAE,WAAW,CA6BtB;CACH"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvD,qBAAa,YAAa,SAAQ,QAAQ,CAAC,4BAA4B,CAAC;IACtE,WAAW,EAAE,WAAW,CAiCtB;CACH"}
package/dist/resource.js CHANGED
@@ -1,25 +1,25 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.FormResource = void 0;
7
4
  const resource_1 = require("@ldsg/resource");
8
- const lodash_1 = __importDefault(require("lodash"));
9
5
  class FormResource extends resource_1.Resource {
10
6
  constructor() {
11
7
  super(...arguments);
12
8
  this.getFormInfo = (params) => {
13
- const { id, settings: { title, description, slug }, getResourcesFromSettings, } = this;
14
- const name = lodash_1.default.camelCase(slug);
9
+ const { settings: { title, description, slug }, getResourcesFromSettings, } = this;
15
10
  const { inputObjectResource, outputObjectResource } = getResourcesFromSettings();
11
+ if (!inputObjectResource) {
12
+ throw new Error("invalid input object resource");
13
+ }
14
+ if (!outputObjectResource) {
15
+ throw new Error("invalid output object resource");
16
+ }
16
17
  const { objectInfo: inputObjectInfo } = inputObjectResource.getObjectInfo(params);
17
18
  const { objectInfo: outputObjectInfo } = outputObjectResource.getObjectInfo(params);
18
19
  const res = {
19
- id,
20
+ slug,
20
21
  title,
21
22
  description,
22
- name,
23
23
  inputObjectInfo,
24
24
  outputObjectInfo,
25
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldsg/form",
3
- "version": "0.3.38",
3
+ "version": "0.3.41",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -16,15 +16,15 @@
16
16
  "dependencies": {
17
17
  "lodash": "^4.17.21",
18
18
  "zod": "^4.1.11",
19
- "@ldsg/field-type": "0.3.38",
20
- "@ldsg/handler": "0.3.38",
21
- "@ldsg/object": "0.3.38",
22
- "@ldsg/forms": "0.3.38",
23
- "@ldsg/object-field": "0.3.38",
24
- "@ldsg/resource": "0.3.38",
25
- "@ldsg/resource-definition": "0.3.38",
26
- "@ldsg/types": "0.3.38",
27
- "@ldsg/workflow": "0.3.38"
19
+ "@ldsg/field-type": "0.3.41",
20
+ "@ldsg/forms": "0.3.41",
21
+ "@ldsg/handler": "0.3.41",
22
+ "@ldsg/object": "0.3.41",
23
+ "@ldsg/object-field": "0.3.41",
24
+ "@ldsg/resource": "0.3.41",
25
+ "@ldsg/resource-definition": "0.3.41",
26
+ "@ldsg/types": "0.3.41",
27
+ "@ldsg/workflow": "0.3.41"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/jest": "^29.5.2",