@ldsg/forms 0.3.30 → 0.3.32
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/dist/constants.d.ts +3 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +9 -9
- package/dist/handler.d.ts +4 -4
- package/dist/index.d.ts +5 -5
- package/dist/instantiate-resource.d.ts +4 -4
- package/dist/instantiate-resource.js +1 -1
- package/dist/resource.d.ts +4 -4
- package/dist/resource.js +3 -3
- package/dist/test/__tests__/unit.js +163 -163
- package/dist/types/get-form-info.d.ts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/query-types.d.ts +3 -3
- package/dist/types/specific-resource-settings.d.ts +1 -1
- package/dist/utils/add-query-fields/index.d.ts +2 -2
- package/dist/utils/add-query-fields/index.js +1 -1
- package/dist/utils/add-query-fields/utils/create-resolvers.d.ts +1 -1
- package/dist/utils/add-query-fields/utils/create-resolvers.js +7 -7
- package/dist/utils/add-query-fields/utils/create-types.d.ts +1 -1
- package/dist/utils/add-query-fields/utils/create-types.js +41 -41
- package/dist/utils/add-query-fields/utils/get-json-schema.d.ts +1 -1
- package/dist/utils/add-query-fields/utils/get-json-schema.js +13 -13
- package/dist/utils/add-query-fields/utils/get-schema-for-formily/constants.d.ts +1 -1
- package/dist/utils/add-query-fields/utils/get-schema-for-formily/constants.js +12 -12
- package/dist/utils/add-query-fields/utils/get-schema-for-formily/index.d.ts +1 -1
- package/dist/utils/add-query-fields/utils/get-schema-for-formily/index.js +2 -2
- package/dist/utils/add-query-fields/utils/get-schema-for-formily/utils/process-object-schema.d.ts +1 -1
- package/dist/utils/add-query-fields/utils/get-schema-for-formily/utils/process-object-schema.js +6 -6
- package/dist/utils/add-query-fields/utils/map-form-info.d.ts +2 -2
- package/dist/utils/add-query-fields/utils/map-form-info.d.ts.map +1 -1
- package/dist/utils/add-query-fields/utils/map-form-info.js +4 -4
- package/dist/utils/handle-form-info-list/index.d.ts +2 -2
- package/dist/utils/handle-form-info-list/index.js +2 -2
- package/dist/utils/handle-form-info-list/utils/get-field-config-map-definition.d.ts +1 -1
- package/dist/utils/handle-form-info-list/utils/get-field-config-map-definition.js +3 -3
- package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-common-type.d.ts.map +1 -1
- package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-common-type.js +3 -3
- package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-type-info.d.ts +1 -1
- package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-type-info.d.ts.map +1 -1
- package/dist/utils/handle-form-info-list/utils/get-graphql-type-by-type-info.js +2 -2
- package/dist/utils/handle-form-info-list/utils/get-input-itc.d.ts +3 -3
- package/dist/utils/handle-form-info-list/utils/get-input-itc.js +4 -4
- package/dist/utils/handle-form-info-list/utils/get-output-otc.d.ts +3 -3
- package/dist/utils/handle-form-info-list/utils/get-output-otc.js +4 -4
- package/package.json +15 -11
package/dist/constants.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HandlerSpecificResourceSettings } from
|
|
2
|
-
import { ResourceDefinitionSpecificResourceSettings } from
|
|
3
|
-
import { GeneralResourceSettings } from
|
|
1
|
+
import { HandlerSpecificResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { ResourceDefinitionSpecificResourceSettings } from "@ldsg/resource-definition";
|
|
3
|
+
import { GeneralResourceSettings } from "@ldsg/types";
|
|
4
4
|
/**
|
|
5
5
|
* Instantiate Resource Handler General Resource Settings
|
|
6
6
|
* 实例化资源处理程序普通资源配置
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -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,+
|
|
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;AAEJ,eAAO,MAAM,WAAW,WAAW,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -6,8 +6,8 @@ exports.FORMS_ROUTE = exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = e
|
|
|
6
6
|
* 实例化资源处理程序普通资源配置
|
|
7
7
|
*/
|
|
8
8
|
exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = {
|
|
9
|
-
title:
|
|
10
|
-
description:
|
|
9
|
+
title: "表单组实例化资源处理程序",
|
|
10
|
+
description: "",
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* Instantiate Resource Handler Specific Resource Settings
|
|
@@ -18,15 +18,15 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
|
|
|
18
18
|
code: `export * from "@ldsg/forms";`,
|
|
19
19
|
dependencies: [
|
|
20
20
|
{
|
|
21
|
-
name:
|
|
22
|
-
}
|
|
23
|
-
]
|
|
21
|
+
name: "@ldsg/forms",
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
24
|
};
|
|
25
25
|
exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = {
|
|
26
|
-
title:
|
|
27
|
-
description:
|
|
26
|
+
title: "表单组资源定义",
|
|
27
|
+
description: "",
|
|
28
28
|
};
|
|
29
29
|
exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
|
|
30
|
-
kind:
|
|
30
|
+
kind: "forms",
|
|
31
31
|
};
|
|
32
|
-
exports.FORMS_ROUTE =
|
|
32
|
+
exports.FORMS_ROUTE = "/forms";
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Handler, HandlerExtendedResourceSettings } from
|
|
2
|
-
import { InstantiateResourceParams, InstantiateResourceRes } from
|
|
3
|
-
import { FormsResource } from
|
|
4
|
-
import { FormsSpecificResourceSettings } from
|
|
1
|
+
import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
|
|
3
|
+
import { FormsResource } from "./resource";
|
|
4
|
+
import { FormsSpecificResourceSettings } from "./types";
|
|
5
5
|
export declare const handler: Handler<InstantiateResourceParams<HandlerExtendedResourceSettings<FormsSpecificResourceSettings>>, InstantiateResourceRes<FormsResource>>;
|
|
6
6
|
//# sourceMappingURL=handler.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
1
|
+
export * from "./constants";
|
|
2
|
+
export * from "./handler";
|
|
3
|
+
export * from "./instantiate-resource";
|
|
4
|
+
export * from "./resource";
|
|
5
|
+
export * from "./types";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HandlerExtendedResourceSettings } from
|
|
2
|
-
import { InstantiateResource } from
|
|
3
|
-
import { FormsResource } from
|
|
4
|
-
import { FormsSpecificResourceSettings } from
|
|
1
|
+
import { HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResource } from "@ldsg/resource";
|
|
3
|
+
import { FormsResource } from "./resource";
|
|
4
|
+
import { FormsSpecificResourceSettings } from "./types";
|
|
5
5
|
export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<FormsSpecificResourceSettings>, FormsResource>;
|
|
6
6
|
//# sourceMappingURL=instantiate-resource.d.ts.map
|
package/dist/resource.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlatformsParams } from
|
|
2
|
-
import { ModifyGraphQLSchema } from
|
|
3
|
-
import { Resource } from
|
|
4
|
-
import { FormInfo, FormsSpecificResourceSettings } from
|
|
1
|
+
import { PlatformsParams } from "@ldsg/field-type";
|
|
2
|
+
import { ModifyGraphQLSchema } from "@ldsg/graphql";
|
|
3
|
+
import { Resource } from "@ldsg/resource";
|
|
4
|
+
import { FormInfo, FormsSpecificResourceSettings } from "./types";
|
|
5
5
|
interface GetFormInfoListRes {
|
|
6
6
|
/**
|
|
7
7
|
* Form Info List
|
package/dist/resource.js
CHANGED
|
@@ -15,7 +15,7 @@ class FormsResource extends resource_1.Resource {
|
|
|
15
15
|
let formInfoList = thisFormInfoList;
|
|
16
16
|
if (!formInfoList) {
|
|
17
17
|
const { resources } = getFilteredResources({
|
|
18
|
-
parentId: id
|
|
18
|
+
parentId: id,
|
|
19
19
|
});
|
|
20
20
|
const mapRes = resources.map((resource) => {
|
|
21
21
|
var _a;
|
|
@@ -26,7 +26,7 @@ class FormsResource extends resource_1.Resource {
|
|
|
26
26
|
this.formInfoList = formInfoList;
|
|
27
27
|
}
|
|
28
28
|
const res = {
|
|
29
|
-
formInfoList
|
|
29
|
+
formInfoList,
|
|
30
30
|
};
|
|
31
31
|
return res;
|
|
32
32
|
};
|
|
@@ -35,7 +35,7 @@ class FormsResource extends resource_1.Resource {
|
|
|
35
35
|
const { formInfoList } = this.getFormInfoList();
|
|
36
36
|
(0, handle_form_info_list_1.handleFormInfoList)({
|
|
37
37
|
formInfoList,
|
|
38
|
-
schemaComposer
|
|
38
|
+
schemaComposer,
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -13,7 +13,7 @@ class MockFormResource extends resource_1.Resource {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
this.getFormInfo = (params) => {
|
|
16
|
-
const { id, settings: { title, description, name }, getResourcesFromSettings } = this;
|
|
16
|
+
const { id, settings: { title, description, name }, getResourcesFromSettings, } = this;
|
|
17
17
|
const { inputObjectResource, outputObjectResource } = getResourcesFromSettings();
|
|
18
18
|
const { objectInfo: inputObjectInfo } = inputObjectResource.getObjectInfo(params);
|
|
19
19
|
const { objectInfo: outputObjectInfo } = outputObjectResource.getObjectInfo(params);
|
|
@@ -23,156 +23,156 @@ class MockFormResource extends resource_1.Resource {
|
|
|
23
23
|
description,
|
|
24
24
|
name,
|
|
25
25
|
inputObjectInfo,
|
|
26
|
-
outputObjectInfo
|
|
26
|
+
outputObjectInfo,
|
|
27
27
|
};
|
|
28
28
|
return res;
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
test(
|
|
32
|
+
test("forms", () => {
|
|
33
33
|
const graphqlResource = new graphql_1.GraphqlResource({
|
|
34
|
-
id:
|
|
35
|
-
kind:
|
|
36
|
-
parentId:
|
|
34
|
+
id: "test-graphql",
|
|
35
|
+
kind: "graphql",
|
|
36
|
+
parentId: "test-application",
|
|
37
37
|
settings: {
|
|
38
|
-
title:
|
|
39
|
-
description:
|
|
40
|
-
code:
|
|
41
|
-
dependencies: []
|
|
42
|
-
}
|
|
38
|
+
title: "测试GraphQL",
|
|
39
|
+
description: "",
|
|
40
|
+
code: "",
|
|
41
|
+
dependencies: [],
|
|
42
|
+
},
|
|
43
43
|
});
|
|
44
44
|
new handler_1.HandlerResource(field_type_1.stringFieldTypeHandlerResourceRecord);
|
|
45
45
|
new field_type_1.FieldTypeResource(field_type_1.stringFieldTypeResourceRecord);
|
|
46
46
|
new object_field_1.ObjectFieldResource({
|
|
47
|
-
id:
|
|
48
|
-
kind:
|
|
49
|
-
parentId:
|
|
47
|
+
id: "test-object-1-field-1",
|
|
48
|
+
kind: "object_field",
|
|
49
|
+
parentId: "test-object-1",
|
|
50
50
|
settings: {
|
|
51
|
-
title:
|
|
52
|
-
description:
|
|
53
|
-
name:
|
|
51
|
+
title: "测试对象1测试字段1",
|
|
52
|
+
description: "",
|
|
53
|
+
name: "test-1",
|
|
54
54
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
55
55
|
properties: {
|
|
56
|
-
max:
|
|
57
|
-
}
|
|
58
|
-
}
|
|
56
|
+
max: "10",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
59
|
});
|
|
60
60
|
new object_field_1.ObjectFieldResource({
|
|
61
|
-
id:
|
|
62
|
-
kind:
|
|
63
|
-
parentId:
|
|
61
|
+
id: "test-object-1-field-2",
|
|
62
|
+
kind: "object_field",
|
|
63
|
+
parentId: "test-object-1",
|
|
64
64
|
settings: {
|
|
65
|
-
title:
|
|
66
|
-
description:
|
|
67
|
-
name:
|
|
65
|
+
title: "测试对象1测试字段2",
|
|
66
|
+
description: "",
|
|
67
|
+
name: "test-2",
|
|
68
68
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
69
69
|
properties: {
|
|
70
|
-
max:
|
|
71
|
-
}
|
|
72
|
-
}
|
|
70
|
+
max: "10",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
73
|
});
|
|
74
74
|
new object_field_1.ObjectFieldResource({
|
|
75
|
-
id:
|
|
76
|
-
kind:
|
|
77
|
-
parentId:
|
|
75
|
+
id: "test-object-1-field-3",
|
|
76
|
+
kind: "object_field",
|
|
77
|
+
parentId: "test-object-1",
|
|
78
78
|
settings: {
|
|
79
|
-
title:
|
|
80
|
-
description:
|
|
81
|
-
name:
|
|
79
|
+
title: "测试对象1测试字段3",
|
|
80
|
+
description: "",
|
|
81
|
+
name: "test-3",
|
|
82
82
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
83
83
|
properties: {
|
|
84
|
-
max:
|
|
85
|
-
}
|
|
86
|
-
}
|
|
84
|
+
max: "10",
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
87
|
});
|
|
88
88
|
new object_1.ObjectResource({
|
|
89
|
-
id:
|
|
90
|
-
kind:
|
|
91
|
-
parentId:
|
|
89
|
+
id: "test-object-1",
|
|
90
|
+
kind: "object",
|
|
91
|
+
parentId: "root",
|
|
92
92
|
settings: {
|
|
93
|
-
title:
|
|
94
|
-
description:
|
|
95
|
-
name:
|
|
96
|
-
}
|
|
93
|
+
title: "测试对象1",
|
|
94
|
+
description: "",
|
|
95
|
+
name: "test-object-1",
|
|
96
|
+
},
|
|
97
97
|
});
|
|
98
98
|
new object_field_1.ObjectFieldResource({
|
|
99
|
-
id:
|
|
100
|
-
kind:
|
|
101
|
-
parentId:
|
|
99
|
+
id: "test-object-2-field-1",
|
|
100
|
+
kind: "object_field",
|
|
101
|
+
parentId: "test-object-2",
|
|
102
102
|
settings: {
|
|
103
|
-
title:
|
|
104
|
-
description:
|
|
105
|
-
name:
|
|
103
|
+
title: "测试对象2测试字段1",
|
|
104
|
+
description: "",
|
|
105
|
+
name: "test-1",
|
|
106
106
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
107
107
|
properties: {
|
|
108
|
-
max:
|
|
109
|
-
}
|
|
110
|
-
}
|
|
108
|
+
max: "10",
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
111
|
});
|
|
112
112
|
new object_1.ObjectResource({
|
|
113
|
-
id:
|
|
114
|
-
kind:
|
|
115
|
-
parentId:
|
|
113
|
+
id: "test-object-2",
|
|
114
|
+
kind: "object",
|
|
115
|
+
parentId: "root",
|
|
116
116
|
settings: {
|
|
117
|
-
title:
|
|
118
|
-
description:
|
|
119
|
-
name:
|
|
120
|
-
}
|
|
117
|
+
title: "测试对象2",
|
|
118
|
+
description: "",
|
|
119
|
+
name: "test-object-2",
|
|
120
|
+
},
|
|
121
121
|
});
|
|
122
122
|
const formsResource = new resource_2.FormsResource({
|
|
123
|
-
id:
|
|
124
|
-
kind:
|
|
125
|
-
parentId:
|
|
123
|
+
id: "test-forms",
|
|
124
|
+
kind: "form",
|
|
125
|
+
parentId: "test-application",
|
|
126
126
|
settings: {
|
|
127
|
-
title:
|
|
128
|
-
description:
|
|
129
|
-
}
|
|
127
|
+
title: "测试表单组",
|
|
128
|
+
description: "",
|
|
129
|
+
},
|
|
130
130
|
});
|
|
131
131
|
new workflow_1.WorkflowResource({
|
|
132
|
-
id:
|
|
133
|
-
kind:
|
|
134
|
-
parentId:
|
|
132
|
+
id: "test-workflow-1",
|
|
133
|
+
kind: "workflow",
|
|
134
|
+
parentId: "root",
|
|
135
135
|
settings: {
|
|
136
|
-
title:
|
|
137
|
-
description:
|
|
138
|
-
startWorkflowNodeResourceId:
|
|
139
|
-
endWorkflowNodeResourceId:
|
|
140
|
-
}
|
|
136
|
+
title: "测试工作流1",
|
|
137
|
+
description: "",
|
|
138
|
+
startWorkflowNodeResourceId: "",
|
|
139
|
+
endWorkflowNodeResourceId: "",
|
|
140
|
+
},
|
|
141
141
|
});
|
|
142
142
|
new workflow_1.WorkflowResource({
|
|
143
|
-
id:
|
|
144
|
-
kind:
|
|
145
|
-
parentId:
|
|
143
|
+
id: "test-workflow-2",
|
|
144
|
+
kind: "workflow",
|
|
145
|
+
parentId: "root",
|
|
146
146
|
settings: {
|
|
147
|
-
title:
|
|
148
|
-
description:
|
|
149
|
-
startWorkflowNodeResourceId:
|
|
150
|
-
endWorkflowNodeResourceId:
|
|
151
|
-
}
|
|
147
|
+
title: "测试工作流2",
|
|
148
|
+
description: "",
|
|
149
|
+
startWorkflowNodeResourceId: "",
|
|
150
|
+
endWorkflowNodeResourceId: "",
|
|
151
|
+
},
|
|
152
152
|
});
|
|
153
153
|
new MockFormResource({
|
|
154
|
-
id:
|
|
155
|
-
kind:
|
|
156
|
-
parentId:
|
|
154
|
+
id: "test-form-1",
|
|
155
|
+
kind: "form",
|
|
156
|
+
parentId: "test-forms",
|
|
157
157
|
settings: {
|
|
158
|
-
title:
|
|
159
|
-
description:
|
|
160
|
-
name:
|
|
161
|
-
inputObjectResourceId:
|
|
162
|
-
outputObjectResourceId:
|
|
163
|
-
}
|
|
158
|
+
title: "测试表单1",
|
|
159
|
+
description: "",
|
|
160
|
+
name: "test-a-1",
|
|
161
|
+
inputObjectResourceId: "test-object-1",
|
|
162
|
+
outputObjectResourceId: "test-object-2",
|
|
163
|
+
},
|
|
164
164
|
});
|
|
165
165
|
new MockFormResource({
|
|
166
|
-
id:
|
|
167
|
-
kind:
|
|
168
|
-
parentId:
|
|
166
|
+
id: "test-form-2",
|
|
167
|
+
kind: "form",
|
|
168
|
+
parentId: "test-forms",
|
|
169
169
|
settings: {
|
|
170
|
-
title:
|
|
171
|
-
description:
|
|
172
|
-
name:
|
|
173
|
-
inputObjectResourceId:
|
|
174
|
-
outputObjectResourceId:
|
|
175
|
-
}
|
|
170
|
+
title: "测试表单2",
|
|
171
|
+
description: "",
|
|
172
|
+
name: "test-a-2",
|
|
173
|
+
inputObjectResourceId: "test-object-2",
|
|
174
|
+
outputObjectResourceId: "test-object-1",
|
|
175
|
+
},
|
|
176
176
|
});
|
|
177
177
|
const getFormInfoListRes = formsResource.getFormInfoList();
|
|
178
178
|
expect(getFormInfoListRes).toMatchSnapshot();
|
|
@@ -180,101 +180,101 @@ test('forms', () => {
|
|
|
180
180
|
const schemaDSL = (0, graphql_2.printSchema)(schema);
|
|
181
181
|
expect(schemaDSL).toMatchSnapshot();
|
|
182
182
|
});
|
|
183
|
-
test(
|
|
183
|
+
test("form and forms query fields", () => {
|
|
184
184
|
const graphqlResource = new graphql_1.GraphqlResource({
|
|
185
|
-
id:
|
|
186
|
-
kind:
|
|
187
|
-
parentId:
|
|
185
|
+
id: "test-graphql",
|
|
186
|
+
kind: "graphql",
|
|
187
|
+
parentId: "test-application",
|
|
188
188
|
settings: {
|
|
189
|
-
title:
|
|
190
|
-
description:
|
|
191
|
-
code:
|
|
192
|
-
dependencies: []
|
|
193
|
-
}
|
|
189
|
+
title: "测试GraphQL",
|
|
190
|
+
description: "",
|
|
191
|
+
code: "",
|
|
192
|
+
dependencies: [],
|
|
193
|
+
},
|
|
194
194
|
});
|
|
195
195
|
new handler_1.HandlerResource(field_type_1.stringFieldTypeHandlerResourceRecord);
|
|
196
196
|
new field_type_1.FieldTypeResource(field_type_1.stringFieldTypeResourceRecord);
|
|
197
197
|
new object_field_1.ObjectFieldResource({
|
|
198
|
-
id:
|
|
199
|
-
kind:
|
|
200
|
-
parentId:
|
|
198
|
+
id: "test-object-1-field-1",
|
|
199
|
+
kind: "object_field",
|
|
200
|
+
parentId: "test-object-1",
|
|
201
201
|
settings: {
|
|
202
|
-
title:
|
|
203
|
-
description:
|
|
204
|
-
name:
|
|
202
|
+
title: "测试对象字段",
|
|
203
|
+
description: "",
|
|
204
|
+
name: "test_field_1",
|
|
205
205
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
206
206
|
properties: {
|
|
207
|
-
max:
|
|
208
|
-
}
|
|
209
|
-
}
|
|
207
|
+
max: "10",
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
210
|
});
|
|
211
211
|
new object_1.ObjectResource({
|
|
212
|
-
id:
|
|
213
|
-
kind:
|
|
214
|
-
parentId:
|
|
212
|
+
id: "test-object-1",
|
|
213
|
+
kind: "object",
|
|
214
|
+
parentId: "test-application",
|
|
215
215
|
settings: {
|
|
216
|
-
title:
|
|
217
|
-
description:
|
|
218
|
-
name:
|
|
219
|
-
fields: [
|
|
220
|
-
}
|
|
216
|
+
title: "测试对象1",
|
|
217
|
+
description: "",
|
|
218
|
+
name: "test_object_1",
|
|
219
|
+
fields: ["test-object-1-field-1"],
|
|
220
|
+
},
|
|
221
221
|
});
|
|
222
222
|
new object_1.ObjectResource({
|
|
223
|
-
id:
|
|
224
|
-
kind:
|
|
225
|
-
parentId:
|
|
223
|
+
id: "test-object-2",
|
|
224
|
+
kind: "object",
|
|
225
|
+
parentId: "test-application",
|
|
226
226
|
settings: {
|
|
227
|
-
title:
|
|
228
|
-
description:
|
|
229
|
-
name:
|
|
230
|
-
fields: []
|
|
231
|
-
}
|
|
227
|
+
title: "测试对象2",
|
|
228
|
+
description: "",
|
|
229
|
+
name: "test_object_2",
|
|
230
|
+
fields: [],
|
|
231
|
+
},
|
|
232
232
|
});
|
|
233
233
|
const formsResource = new resource_2.FormsResource({
|
|
234
|
-
id:
|
|
235
|
-
kind:
|
|
236
|
-
parentId:
|
|
234
|
+
id: "test-forms",
|
|
235
|
+
kind: "forms",
|
|
236
|
+
parentId: "test-application",
|
|
237
237
|
settings: {
|
|
238
|
-
title:
|
|
239
|
-
description:
|
|
240
|
-
}
|
|
238
|
+
title: "测试表单",
|
|
239
|
+
description: "",
|
|
240
|
+
},
|
|
241
241
|
});
|
|
242
242
|
new MockFormResource({
|
|
243
|
-
id:
|
|
244
|
-
kind:
|
|
245
|
-
parentId:
|
|
243
|
+
id: "test-form-1",
|
|
244
|
+
kind: "form",
|
|
245
|
+
parentId: "test-forms",
|
|
246
246
|
settings: {
|
|
247
|
-
title:
|
|
248
|
-
description:
|
|
249
|
-
name:
|
|
250
|
-
inputObjectResourceId:
|
|
251
|
-
outputObjectResourceId:
|
|
252
|
-
}
|
|
247
|
+
title: "测试表单1",
|
|
248
|
+
description: "Test Form 1",
|
|
249
|
+
name: "test-a-1",
|
|
250
|
+
inputObjectResourceId: "test-object-1",
|
|
251
|
+
outputObjectResourceId: "test-object-2",
|
|
252
|
+
},
|
|
253
253
|
});
|
|
254
254
|
new MockFormResource({
|
|
255
|
-
id:
|
|
256
|
-
kind:
|
|
257
|
-
parentId:
|
|
255
|
+
id: "test-form-2",
|
|
256
|
+
kind: "form",
|
|
257
|
+
parentId: "test-forms",
|
|
258
258
|
settings: {
|
|
259
|
-
title:
|
|
260
|
-
description:
|
|
261
|
-
name:
|
|
262
|
-
inputObjectResourceId:
|
|
263
|
-
outputObjectResourceId:
|
|
264
|
-
}
|
|
259
|
+
title: "测试表单2",
|
|
260
|
+
description: "Test Form 2",
|
|
261
|
+
name: "test-a-2",
|
|
262
|
+
inputObjectResourceId: "test-object-2",
|
|
263
|
+
outputObjectResourceId: "test-object-1",
|
|
264
|
+
},
|
|
265
265
|
});
|
|
266
266
|
const { schema } = graphqlResource.getGraphQLSchema();
|
|
267
267
|
const queryType = schema.getQueryType();
|
|
268
268
|
expect(queryType).toBeDefined();
|
|
269
|
-
const formField = queryType === null || queryType === void 0 ? void 0 : queryType.getFields()[
|
|
269
|
+
const formField = queryType === null || queryType === void 0 ? void 0 : queryType.getFields()["form"];
|
|
270
270
|
expect(formField).toBeDefined();
|
|
271
|
-
const formsField = queryType === null || queryType === void 0 ? void 0 : queryType.getFields()[
|
|
271
|
+
const formsField = queryType === null || queryType === void 0 ? void 0 : queryType.getFields()["forms"];
|
|
272
272
|
expect(formsField).toBeDefined();
|
|
273
273
|
const mutationType = schema.getMutationType();
|
|
274
274
|
expect(mutationType).toBeDefined();
|
|
275
275
|
// Individual form mutations should still exist
|
|
276
|
-
const testA1Field = mutationType === null || mutationType === void 0 ? void 0 : mutationType.getFields()[
|
|
276
|
+
const testA1Field = mutationType === null || mutationType === void 0 ? void 0 : mutationType.getFields()["testA1"];
|
|
277
277
|
expect(testA1Field).toBeDefined();
|
|
278
|
-
const testA2Field = mutationType === null || mutationType === void 0 ? void 0 : mutationType.getFields()[
|
|
278
|
+
const testA2Field = mutationType === null || mutationType === void 0 ? void 0 : mutationType.getFields()["testA2"];
|
|
279
279
|
expect(testA2Field).toBeDefined();
|
|
280
280
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PlatformsParams } from
|
|
2
|
-
import { ObjectInfo } from
|
|
3
|
-
import { GeneralResourceSettings } from
|
|
1
|
+
import { PlatformsParams } from "@ldsg/field-type";
|
|
2
|
+
import { ObjectInfo } from "@ldsg/object";
|
|
3
|
+
import { GeneralResourceSettings } from "@ldsg/types";
|
|
4
4
|
export interface FormInfo extends GeneralResourceSettings {
|
|
5
5
|
/**
|
|
6
6
|
* Form ID
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./get-form-info";
|
|
2
|
+
export * from "./query-types";
|
|
3
|
+
export * from "./specific-resource-settings";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ObjectInfo } from
|
|
1
|
+
import { ObjectInfo } from "@ldsg/object";
|
|
2
2
|
/**
|
|
3
3
|
* Extended ObjectInfo with JSON schemas for form queries
|
|
4
4
|
*/
|
|
5
|
-
export interface FormObjectInfo extends Omit<ObjectInfo,
|
|
5
|
+
export interface FormObjectInfo extends Omit<ObjectInfo, "fieldInfoList"> {
|
|
6
6
|
/**
|
|
7
7
|
* List of field information
|
|
8
8
|
*/
|
|
9
|
-
fieldInfoList?: ObjectInfo[
|
|
9
|
+
fieldInfoList?: ObjectInfo["fieldInfoList"];
|
|
10
10
|
/**
|
|
11
11
|
* JSON Schema for the object
|
|
12
12
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const FormsSpecificResourceSettingsSchema: z.ZodObject<{}, z.core.$catchall<z.ZodAny>>;
|
|
3
3
|
export declare const SpecificResourceSettingsSchema: z.ZodObject<{}, z.core.$catchall<z.ZodAny>>;
|
|
4
4
|
export type FormsSpecificResourceSettings = z.infer<typeof FormsSpecificResourceSettingsSchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SchemaComposerParams } from
|
|
2
|
-
import { FormInfo } from
|
|
1
|
+
import { SchemaComposerParams } from "@ldsg/graphql";
|
|
2
|
+
import { FormInfo } from "../../types";
|
|
3
3
|
export interface AddQueryFieldsParams extends SchemaComposerParams {
|
|
4
4
|
formInfoList: FormInfo[];
|
|
5
5
|
}
|