@ldsg/forms 0.3.9 → 0.3.10
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 +11 -10
- package/dist/handler.d.ts +5 -7
- package/dist/handler.d.ts.map +1 -1
- 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 +101 -131
- package/dist/types/get-form-info.d.ts +3 -3
- package/dist/types/index.d.ts +2 -2
- package/dist/types/specific-resource-settings.d.ts +1 -1
- package/dist/types/specific-resource-settings.d.ts.map +1 -1
- package/dist/utils/get-new-fields/index.d.ts +3 -3
- package/dist/utils/get-new-fields/index.d.ts.map +1 -1
- package/dist/utils/get-new-fields/index.js +3 -3
- package/dist/utils/get-new-fields/utils/get-field-config-map-definition.d.ts +1 -1
- package/dist/utils/get-new-fields/utils/get-field-config-map-definition.d.ts.map +1 -1
- package/dist/utils/get-new-fields/utils/get-field-config-map-definition.js +3 -3
- package/dist/utils/get-new-fields/utils/get-graphql-type-by-common-type.d.ts.map +1 -1
- package/dist/utils/get-new-fields/utils/get-graphql-type-by-common-type.js +3 -3
- package/dist/utils/get-new-fields/utils/get-graphql-type-by-type-info.d.ts +1 -1
- package/dist/utils/get-new-fields/utils/get-graphql-type-by-type-info.d.ts.map +1 -1
- package/dist/utils/get-new-fields/utils/get-graphql-type-by-type-info.js +2 -2
- package/dist/utils/get-new-fields/utils/get-input-itc.d.ts +3 -3
- package/dist/utils/get-new-fields/utils/get-input-itc.d.ts.map +1 -1
- package/dist/utils/get-new-fields/utils/get-input-itc.js +4 -4
- package/dist/utils/get-new-fields/utils/get-output-otc.d.ts +3 -3
- package/dist/utils/get-new-fields/utils/get-output-otc.d.ts.map +1 -1
- package/dist/utils/get-new-fields/utils/get-output-otc.js +4 -4
- package/dist/utils/get-new-fields/utils/index.d.ts +2 -2
- package/dist/utils/index.d.ts +1 -1
- package/package.json +22 -18
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":"
|
|
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,+BAOrE,CAAC;AAEF,eAAO,MAAM,6CAA6C,EAAE,uBAG3D,CAAC;AAEF,eAAO,MAAM,8CAA8C,EAAE,0CAE5D,CAAC;AAEF,eAAO,MAAM,WAAW,WAAW,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FORMS_ROUTE = exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = void 0;
|
|
4
|
-
const application_1 = require("@ldsg/application");
|
|
5
4
|
/**
|
|
6
5
|
* Instantiate Resource Handler General Resource Settings
|
|
7
6
|
* 实例化资源处理程序普通资源配置
|
|
8
7
|
*/
|
|
9
8
|
exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = {
|
|
10
|
-
title:
|
|
11
|
-
description:
|
|
9
|
+
title: '表单组实例化资源处理程序',
|
|
10
|
+
description: ''
|
|
12
11
|
};
|
|
13
12
|
/**
|
|
14
13
|
* Instantiate Resource Handler Specific Resource Settings
|
|
@@ -19,13 +18,15 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
|
|
|
19
18
|
code: `export * from "@ldsg/forms";`,
|
|
20
19
|
dependencies: [
|
|
21
20
|
{
|
|
22
|
-
name:
|
|
23
|
-
}
|
|
24
|
-
]
|
|
21
|
+
name: '@ldsg/forms'
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = {
|
|
26
|
+
title: '表单组资源定义',
|
|
27
|
+
description: ''
|
|
25
28
|
};
|
|
26
|
-
exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = { title: "表单组资源定义", description: "" };
|
|
27
29
|
exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
|
|
28
|
-
kind:
|
|
29
|
-
parentKind: application_1.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS.kind,
|
|
30
|
+
kind: 'forms'
|
|
30
31
|
};
|
|
31
|
-
exports.FORMS_ROUTE =
|
|
32
|
+
exports.FORMS_ROUTE = '/forms';
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { Handler, HandlerExtendedResourceSettings } from
|
|
2
|
-
import { InstantiateResourceParams, InstantiateResourceRes } from
|
|
3
|
-
import { FormsResource } from
|
|
4
|
-
import { FormsSpecificResourceSettings } from
|
|
5
|
-
export declare const handler: Handler<
|
|
6
|
-
InstantiateResourceParams<HandlerExtendedResourceSettings<FormsSpecificResourceSettings>>
|
|
7
|
-
], InstantiateResourceRes<FormsResource>>;
|
|
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
|
+
export declare const handler: Handler<InstantiateResourceParams<HandlerExtendedResourceSettings<FormsSpecificResourceSettings>>, InstantiateResourceRes<FormsResource>>;
|
|
8
6
|
//# sourceMappingURL=handler.d.ts.map
|
package/dist/handler.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../src/handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAExD,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B,yBAAyB,CAAC,+BAA+B,CAAC,6BAA6B,CAAC,CAAC,EACzF,sBAAsB,CAAC,aAAa,CAAC,CAChB,CAAC"}
|
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
|
};
|
|
@@ -36,7 +36,7 @@ class FormsResource extends resource_1.Resource {
|
|
|
36
36
|
const { formInfoList } = this.getFormInfoList();
|
|
37
37
|
const { newFields } = (0, utils_1.getNewFields)({
|
|
38
38
|
formInfoList,
|
|
39
|
-
schemaComposer
|
|
39
|
+
schemaComposer
|
|
40
40
|
});
|
|
41
41
|
[Mutation, Query].forEach((value) => {
|
|
42
42
|
value.addFields(newFields);
|
|
@@ -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
|
|
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,186 +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
|
-
|
|
33
|
-
const { fieldProperties, platform } = params;
|
|
34
|
-
const { max } = fieldProperties;
|
|
35
|
-
let res;
|
|
36
|
-
switch (platform) {
|
|
37
|
-
case "graphql": {
|
|
38
|
-
const type = "String";
|
|
39
|
-
res = {
|
|
40
|
-
type,
|
|
41
|
-
};
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
case "mongoose": {
|
|
45
|
-
res = {
|
|
46
|
-
type: "String",
|
|
47
|
-
...(max
|
|
48
|
-
? {
|
|
49
|
-
maxLength: max,
|
|
50
|
-
}
|
|
51
|
-
: {}),
|
|
52
|
-
};
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
default: {
|
|
56
|
-
res = {};
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return res;
|
|
61
|
-
};
|
|
62
|
-
test("forms", () => {
|
|
32
|
+
test('forms', () => {
|
|
63
33
|
const graphqlResource = new graphql_1.GraphqlResource({
|
|
64
|
-
id:
|
|
65
|
-
kind:
|
|
66
|
-
parentId:
|
|
34
|
+
id: 'test-graphql',
|
|
35
|
+
kind: 'graphql',
|
|
36
|
+
parentId: 'test-application',
|
|
67
37
|
settings: {
|
|
68
|
-
title:
|
|
69
|
-
description:
|
|
70
|
-
code:
|
|
71
|
-
dependencies: []
|
|
72
|
-
}
|
|
38
|
+
title: '测试GraphQL',
|
|
39
|
+
description: '',
|
|
40
|
+
code: '',
|
|
41
|
+
dependencies: []
|
|
42
|
+
}
|
|
73
43
|
});
|
|
74
44
|
new handler_1.HandlerResource(field_type_1.stringFieldTypeHandlerResourceRecord);
|
|
75
45
|
new field_type_1.FieldTypeResource(field_type_1.stringFieldTypeResourceRecord);
|
|
76
46
|
new object_field_1.ObjectFieldResource({
|
|
77
|
-
id:
|
|
78
|
-
kind:
|
|
79
|
-
parentId:
|
|
47
|
+
id: 'test-object-1-field-1',
|
|
48
|
+
kind: 'object_field',
|
|
49
|
+
parentId: 'test-object-1',
|
|
80
50
|
settings: {
|
|
81
|
-
title:
|
|
82
|
-
description:
|
|
83
|
-
name:
|
|
51
|
+
title: '测试对象1测试字段1',
|
|
52
|
+
description: '',
|
|
53
|
+
name: 'test-1',
|
|
84
54
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
85
55
|
properties: {
|
|
86
|
-
max:
|
|
87
|
-
}
|
|
88
|
-
}
|
|
56
|
+
max: '10'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
89
59
|
});
|
|
90
60
|
new object_field_1.ObjectFieldResource({
|
|
91
|
-
id:
|
|
92
|
-
kind:
|
|
93
|
-
parentId:
|
|
61
|
+
id: 'test-object-1-field-2',
|
|
62
|
+
kind: 'object_field',
|
|
63
|
+
parentId: 'test-object-1',
|
|
94
64
|
settings: {
|
|
95
|
-
title:
|
|
96
|
-
description:
|
|
97
|
-
name:
|
|
65
|
+
title: '测试对象1测试字段2',
|
|
66
|
+
description: '',
|
|
67
|
+
name: 'test-2',
|
|
98
68
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
99
69
|
properties: {
|
|
100
|
-
max:
|
|
101
|
-
}
|
|
102
|
-
}
|
|
70
|
+
max: '10'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
103
73
|
});
|
|
104
74
|
new object_field_1.ObjectFieldResource({
|
|
105
|
-
id:
|
|
106
|
-
kind:
|
|
107
|
-
parentId:
|
|
75
|
+
id: 'test-object-1-field-3',
|
|
76
|
+
kind: 'object_field',
|
|
77
|
+
parentId: 'test-object-1',
|
|
108
78
|
settings: {
|
|
109
|
-
title:
|
|
110
|
-
description:
|
|
111
|
-
name:
|
|
79
|
+
title: '测试对象1测试字段3',
|
|
80
|
+
description: '',
|
|
81
|
+
name: 'test-3',
|
|
112
82
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
113
83
|
properties: {
|
|
114
|
-
max:
|
|
115
|
-
}
|
|
116
|
-
}
|
|
84
|
+
max: '10'
|
|
85
|
+
}
|
|
86
|
+
}
|
|
117
87
|
});
|
|
118
88
|
new object_1.ObjectResource({
|
|
119
|
-
id:
|
|
120
|
-
kind:
|
|
121
|
-
parentId:
|
|
89
|
+
id: 'test-object-1',
|
|
90
|
+
kind: 'object',
|
|
91
|
+
parentId: 'root',
|
|
122
92
|
settings: {
|
|
123
|
-
title:
|
|
124
|
-
description:
|
|
125
|
-
name:
|
|
126
|
-
}
|
|
93
|
+
title: '测试对象1',
|
|
94
|
+
description: '',
|
|
95
|
+
name: 'test-object-1'
|
|
96
|
+
}
|
|
127
97
|
});
|
|
128
98
|
new object_field_1.ObjectFieldResource({
|
|
129
|
-
id:
|
|
130
|
-
kind:
|
|
131
|
-
parentId:
|
|
99
|
+
id: 'test-object-2-field-1',
|
|
100
|
+
kind: 'object_field',
|
|
101
|
+
parentId: 'test-object-2',
|
|
132
102
|
settings: {
|
|
133
|
-
title:
|
|
134
|
-
description:
|
|
135
|
-
name:
|
|
103
|
+
title: '测试对象2测试字段1',
|
|
104
|
+
description: '',
|
|
105
|
+
name: 'test-1',
|
|
136
106
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
137
107
|
properties: {
|
|
138
|
-
max:
|
|
139
|
-
}
|
|
140
|
-
}
|
|
108
|
+
max: '10'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
141
111
|
});
|
|
142
112
|
new object_1.ObjectResource({
|
|
143
|
-
id:
|
|
144
|
-
kind:
|
|
145
|
-
parentId:
|
|
113
|
+
id: 'test-object-2',
|
|
114
|
+
kind: 'object',
|
|
115
|
+
parentId: 'root',
|
|
146
116
|
settings: {
|
|
147
|
-
title:
|
|
148
|
-
description:
|
|
149
|
-
name:
|
|
150
|
-
}
|
|
117
|
+
title: '测试对象2',
|
|
118
|
+
description: '',
|
|
119
|
+
name: 'test-object-2'
|
|
120
|
+
}
|
|
151
121
|
});
|
|
152
122
|
const formsResource = new resource_2.FormsResource({
|
|
153
|
-
id:
|
|
154
|
-
kind:
|
|
155
|
-
parentId:
|
|
123
|
+
id: 'test-forms',
|
|
124
|
+
kind: 'form',
|
|
125
|
+
parentId: 'test-application',
|
|
156
126
|
settings: {
|
|
157
|
-
title:
|
|
158
|
-
description:
|
|
159
|
-
}
|
|
127
|
+
title: '测试表单组',
|
|
128
|
+
description: ''
|
|
129
|
+
}
|
|
160
130
|
});
|
|
161
131
|
new workflow_1.WorkflowResource({
|
|
162
|
-
id:
|
|
163
|
-
kind:
|
|
164
|
-
parentId:
|
|
132
|
+
id: 'test-workflow-1',
|
|
133
|
+
kind: 'workflow',
|
|
134
|
+
parentId: 'root',
|
|
165
135
|
settings: {
|
|
166
|
-
title:
|
|
167
|
-
description:
|
|
168
|
-
startWorkflowNodeResourceId:
|
|
169
|
-
endWorkflowNodeResourceId:
|
|
170
|
-
}
|
|
136
|
+
title: '测试工作流1',
|
|
137
|
+
description: '',
|
|
138
|
+
startWorkflowNodeResourceId: '',
|
|
139
|
+
endWorkflowNodeResourceId: ''
|
|
140
|
+
}
|
|
171
141
|
});
|
|
172
142
|
new workflow_1.WorkflowResource({
|
|
173
|
-
id:
|
|
174
|
-
kind:
|
|
175
|
-
parentId:
|
|
143
|
+
id: 'test-workflow-2',
|
|
144
|
+
kind: 'workflow',
|
|
145
|
+
parentId: 'root',
|
|
176
146
|
settings: {
|
|
177
|
-
title:
|
|
178
|
-
description:
|
|
179
|
-
startWorkflowNodeResourceId:
|
|
180
|
-
endWorkflowNodeResourceId:
|
|
181
|
-
}
|
|
147
|
+
title: '测试工作流2',
|
|
148
|
+
description: '',
|
|
149
|
+
startWorkflowNodeResourceId: '',
|
|
150
|
+
endWorkflowNodeResourceId: ''
|
|
151
|
+
}
|
|
182
152
|
});
|
|
183
153
|
new MockFormResource({
|
|
184
|
-
id:
|
|
185
|
-
kind:
|
|
186
|
-
parentId:
|
|
154
|
+
id: 'test-form-1',
|
|
155
|
+
kind: 'form',
|
|
156
|
+
parentId: 'test-forms',
|
|
187
157
|
settings: {
|
|
188
|
-
title:
|
|
189
|
-
description:
|
|
190
|
-
name:
|
|
191
|
-
inputObjectResourceId:
|
|
192
|
-
outputObjectResourceId:
|
|
193
|
-
}
|
|
158
|
+
title: '测试表单1',
|
|
159
|
+
description: '',
|
|
160
|
+
name: 'test-a-1',
|
|
161
|
+
inputObjectResourceId: 'test-object-1',
|
|
162
|
+
outputObjectResourceId: 'test-object-2'
|
|
163
|
+
}
|
|
194
164
|
});
|
|
195
165
|
new MockFormResource({
|
|
196
|
-
id:
|
|
197
|
-
kind:
|
|
198
|
-
parentId:
|
|
166
|
+
id: 'test-form-2',
|
|
167
|
+
kind: 'form',
|
|
168
|
+
parentId: 'test-forms',
|
|
199
169
|
settings: {
|
|
200
|
-
title:
|
|
201
|
-
description:
|
|
202
|
-
name:
|
|
203
|
-
inputObjectResourceId:
|
|
204
|
-
outputObjectResourceId:
|
|
205
|
-
}
|
|
170
|
+
title: '测试表单2',
|
|
171
|
+
description: '',
|
|
172
|
+
name: 'test-a-2',
|
|
173
|
+
inputObjectResourceId: 'test-object-2',
|
|
174
|
+
outputObjectResourceId: 'test-object-1'
|
|
175
|
+
}
|
|
206
176
|
});
|
|
207
177
|
const getFormInfoListRes = formsResource.getFormInfoList();
|
|
208
178
|
expect(getFormInfoListRes).toMatchSnapshot();
|
|
@@ -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,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './get-form-info';
|
|
2
|
+
export * from './specific-resource-settings';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,WAAW,6BAA8B,SAAQ,wBAAwB;CAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SchemaComposerParams } from
|
|
2
|
-
import { ObjectTypeComposerFieldConfigMapDefinition } from
|
|
3
|
-
import { FormInfo } from
|
|
1
|
+
import { SchemaComposerParams } from '@ldsg/graphql';
|
|
2
|
+
import { ObjectTypeComposerFieldConfigMapDefinition } from 'graphql-compose';
|
|
3
|
+
import { FormInfo } from '../../types';
|
|
4
4
|
interface GetNewFieldsParams extends SchemaComposerParams {
|
|
5
5
|
formInfoList: FormInfo[];
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/get-new-fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/get-new-fields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,0CAA0C,EAAsB,MAAM,iBAAiB,CAAC;AAEjG,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,UAAU,kBAAmB,SAAQ,oBAAoB;IACvD,YAAY,EAAE,QAAQ,EAAE,CAAC;CAC1B;AAED,UAAU,eAAe;IACvB,SAAS,EAAE,0CAA0C,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CACjE;AAED,KAAK,YAAY,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,eAAe,CAAC;AAEpE,eAAO,MAAM,YAAY,EAAE,YA+B1B,CAAC"}
|
|
@@ -16,15 +16,15 @@ const getNewFields = (params) => {
|
|
|
16
16
|
const { inputITC } = (0, utils_1.getInputITC)({ schemaComposer, inputObjectInfo });
|
|
17
17
|
const resolverDefinition = {
|
|
18
18
|
name: graphqlFieldName,
|
|
19
|
-
description: `${title}${description ? `:${description}` :
|
|
19
|
+
description: `${title}${description ? `:${description}` : ''}`,
|
|
20
20
|
type: outputOTC,
|
|
21
|
-
args: inputITC.getFields()
|
|
21
|
+
args: inputITC.getFields()
|
|
22
22
|
};
|
|
23
23
|
const fieldResolver = schemaComposer.createResolver(resolverDefinition);
|
|
24
24
|
newFields[graphqlFieldName] = fieldResolver;
|
|
25
25
|
});
|
|
26
26
|
const res = {
|
|
27
|
-
newFields
|
|
27
|
+
newFields
|
|
28
28
|
};
|
|
29
29
|
return res;
|
|
30
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-field-config-map-definition.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-field-config-map-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,UAAU,iCAAiC;IACzC,aAAa,EAAE,SAAS,EAAE,CAAC;CAC5B;AAED,UAAU,8BAA8B;IACtC,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/C;AAED,KAAK,2BAA2B,GAAG,CACjC,MAAM,EAAE,iCAAiC,KACtC,8BAA8B,CAAC;AAEpC,eAAO,MAAM,2BAA2B,EAAE,
|
|
1
|
+
{"version":3,"file":"get-field-config-map-definition.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-field-config-map-definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,UAAU,iCAAiC;IACzC,aAAa,EAAE,SAAS,EAAE,CAAC;CAC5B;AAED,UAAU,8BAA8B;IACtC,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/C;AAED,KAAK,2BAA2B,GAAG,CACjC,MAAM,EAAE,iCAAiC,KACtC,8BAA8B,CAAC;AAEpC,eAAO,MAAM,2BAA2B,EAAE,2BAyBzC,CAAC"}
|
|
@@ -13,15 +13,15 @@ const getFieldConfigMapDefinition = (params) => {
|
|
|
13
13
|
const { title, description, name, typeInfo } = fieldInfo;
|
|
14
14
|
const camelCaseName = lodash_1.default.camelCase(name);
|
|
15
15
|
const { graphqlType } = (0, get_graphql_type_by_type_info_1.getGraphqlTypeByTypeInfo)({
|
|
16
|
-
typeInfo
|
|
16
|
+
typeInfo
|
|
17
17
|
});
|
|
18
18
|
fieldConfigMapDefinition[camelCaseName] = {
|
|
19
19
|
type: graphqlType,
|
|
20
|
-
description: `${title}${description ? `:${description}` :
|
|
20
|
+
description: `${title}${description ? `:${description}` : ''}`
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
23
|
const res = {
|
|
24
|
-
fieldConfigMapDefinition
|
|
24
|
+
fieldConfigMapDefinition
|
|
25
25
|
};
|
|
26
26
|
return res;
|
|
27
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-graphql-type-by-common-type.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-graphql-type-by-common-type.ts"],"names":[],"mappings":"AAAA,UAAU,gCAAgC;IACxC,UAAU,EAAE,GAAG,CAAC;CACjB;AAED,UAAU,6BAA6B;IACrC,WAAW,EAAE,GAAG,CAAC;CAClB;AAED,KAAK,0BAA0B,GAAG,
|
|
1
|
+
{"version":3,"file":"get-graphql-type-by-common-type.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-graphql-type-by-common-type.ts"],"names":[],"mappings":"AAAA,UAAU,gCAAgC;IACxC,UAAU,EAAE,GAAG,CAAC;CACjB;AAED,UAAU,6BAA6B;IACrC,WAAW,EAAE,GAAG,CAAC;CAClB;AAED,KAAK,0BAA0B,GAAG,CAAC,MAAM,EAAE,gCAAgC,KAAK,6BAA6B,CAAC;AAE9G,eAAO,MAAM,0BAA0B,EAAE,0BAuBxC,CAAC"}
|
|
@@ -6,15 +6,15 @@ const getGraphqlTypeByCommonType = (params) => {
|
|
|
6
6
|
const { type } = commonType;
|
|
7
7
|
let graphqlType;
|
|
8
8
|
switch (type) {
|
|
9
|
-
case
|
|
10
|
-
graphqlType =
|
|
9
|
+
case 'string': {
|
|
10
|
+
graphqlType = 'String';
|
|
11
11
|
break;
|
|
12
12
|
}
|
|
13
13
|
default:
|
|
14
14
|
break;
|
|
15
15
|
}
|
|
16
16
|
const res = {
|
|
17
|
-
graphqlType
|
|
17
|
+
graphqlType
|
|
18
18
|
};
|
|
19
19
|
return res;
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-graphql-type-by-type-info.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-graphql-type-by-type-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGxE,UAAU,8BAA8B;IACtC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,UAAU,2BAA2B;IACnC,WAAW,EAAE,GAAG,CAAC;CAClB;AAED,KAAK,wBAAwB,GAAG,
|
|
1
|
+
{"version":3,"file":"get-graphql-type-by-type-info.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-graphql-type-by-type-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGxE,UAAU,8BAA8B;IACtC,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,UAAU,2BAA2B;IACnC,WAAW,EAAE,GAAG,CAAC;CAClB;AAED,KAAK,wBAAwB,GAAG,CAAC,MAAM,EAAE,8BAA8B,KAAK,2BAA2B,CAAC;AAExG,eAAO,MAAM,wBAAwB,EAAE,wBAoBtC,CAAC"}
|
|
@@ -10,11 +10,11 @@ const getGraphqlTypeByTypeInfo = (params) => {
|
|
|
10
10
|
if (!graphqlType) {
|
|
11
11
|
const commonType = platformToTypeMap[field_type_1.FieldTypeBasePlatform.COMMON];
|
|
12
12
|
graphqlType = (0, get_graphql_type_by_common_type_1.getGraphqlTypeByCommonType)({
|
|
13
|
-
commonType
|
|
13
|
+
commonType
|
|
14
14
|
}).graphqlType;
|
|
15
15
|
}
|
|
16
16
|
const res = {
|
|
17
|
-
graphqlType
|
|
17
|
+
graphqlType
|
|
18
18
|
};
|
|
19
19
|
return res;
|
|
20
20
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SchemaComposerParams } from
|
|
2
|
-
import { ObjectInfo } from
|
|
3
|
-
import { InputTypeComposer } from
|
|
1
|
+
import { SchemaComposerParams } from '@ldsg/graphql';
|
|
2
|
+
import { ObjectInfo } from '@ldsg/object';
|
|
3
|
+
import { InputTypeComposer } from 'graphql-compose';
|
|
4
4
|
interface GetInputITCParams extends SchemaComposerParams {
|
|
5
5
|
inputObjectInfo: ObjectInfo;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-input-itc.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-input-itc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"get-input-itc.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-input-itc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAA+B,MAAM,iBAAiB,CAAC;AAIjF,UAAU,iBAAkB,SAAQ,oBAAoB;IACtD,eAAe,EAAE,UAAU,CAAC;CAC7B;AAED,UAAU,cAAc;IACtB,QAAQ,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC;CAClC;AAED,KAAK,WAAW,GAAG,CAAC,MAAM,EAAE,iBAAiB,KAAK,cAAc,CAAC;AAEjE,eAAO,MAAM,WAAW,EAAE,WAyBzB,CAAC"}
|
|
@@ -11,16 +11,16 @@ const getInputITC = (params) => {
|
|
|
11
11
|
const { title, description, name, fieldInfoList } = inputObjectInfo;
|
|
12
12
|
const upperFirstCamelCaseName = lodash_1.default.upperFirst(lodash_1.default.camelCase(name));
|
|
13
13
|
const { fieldConfigMapDefinition } = (0, get_field_config_map_definition_1.getFieldConfigMapDefinition)({
|
|
14
|
-
fieldInfoList
|
|
14
|
+
fieldInfoList
|
|
15
15
|
});
|
|
16
16
|
const definition = {
|
|
17
17
|
name: upperFirstCamelCaseName,
|
|
18
|
-
fields: fieldConfigMapDefinition
|
|
18
|
+
fields: fieldConfigMapDefinition
|
|
19
19
|
};
|
|
20
20
|
const inputITC = schemaComposer.createInputTC(definition);
|
|
21
|
-
inputITC.setDescription(`${title}${description ? `:${description}` :
|
|
21
|
+
inputITC.setDescription(`${title}${description ? `:${description}` : ''}`);
|
|
22
22
|
const res = {
|
|
23
|
-
inputITC
|
|
23
|
+
inputITC
|
|
24
24
|
};
|
|
25
25
|
return res;
|
|
26
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SchemaComposerParams } from
|
|
2
|
-
import { ObjectInfo } from
|
|
3
|
-
import { ObjectTypeComposer } from
|
|
1
|
+
import { SchemaComposerParams } from '@ldsg/graphql';
|
|
2
|
+
import { ObjectInfo } from '@ldsg/object';
|
|
3
|
+
import { ObjectTypeComposer } from 'graphql-compose';
|
|
4
4
|
interface GetOutputOTCParams extends SchemaComposerParams {
|
|
5
5
|
outputObjectInfo: ObjectInfo;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-output-otc.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-output-otc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"get-output-otc.d.ts","sourceRoot":"","sources":["../../../../src/utils/get-new-fields/utils/get-output-otc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAgC,MAAM,iBAAiB,CAAC;AAInF,UAAU,kBAAmB,SAAQ,oBAAoB;IACvD,gBAAgB,EAAE,UAAU,CAAC;CAC9B;AAED,UAAU,eAAe;IACvB,SAAS,EAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CACzC;AAED,KAAK,YAAY,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,eAAe,CAAC;AAEpE,eAAO,MAAM,YAAY,EAAE,YAyB1B,CAAC"}
|
|
@@ -11,16 +11,16 @@ const getOutputOTC = (params) => {
|
|
|
11
11
|
const { title, description, name, fieldInfoList } = outputObjectInfo;
|
|
12
12
|
const upperFirstCamelCaseName = lodash_1.default.upperFirst(lodash_1.default.camelCase(name));
|
|
13
13
|
const { fieldConfigMapDefinition } = (0, get_field_config_map_definition_1.getFieldConfigMapDefinition)({
|
|
14
|
-
fieldInfoList
|
|
14
|
+
fieldInfoList
|
|
15
15
|
});
|
|
16
16
|
const definition = {
|
|
17
17
|
name: upperFirstCamelCaseName,
|
|
18
|
-
fields: fieldConfigMapDefinition
|
|
18
|
+
fields: fieldConfigMapDefinition
|
|
19
19
|
};
|
|
20
20
|
const outputOTC = schemaComposer.createObjectTC(definition);
|
|
21
|
-
outputOTC.setDescription(`${title}${description ? `:${description}` :
|
|
21
|
+
outputOTC.setDescription(`${title}${description ? `:${description}` : ''}`);
|
|
22
22
|
const res = {
|
|
23
|
-
outputOTC
|
|
23
|
+
outputOTC
|
|
24
24
|
};
|
|
25
25
|
return res;
|
|
26
26
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from './get-input-itc';
|
|
2
|
+
export * from './get-output-otc';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './get-new-fields';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/forms",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"description": "",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "wanxger",
|
|
5
8
|
"main": "dist/index.js",
|
|
9
|
+
"types": "dist",
|
|
6
10
|
"files": [
|
|
7
11
|
"dist/"
|
|
8
12
|
],
|
|
9
|
-
"types": "dist",
|
|
10
|
-
"keywords": [],
|
|
11
|
-
"author": "wanxger",
|
|
12
|
-
"license": "MIT",
|
|
13
|
-
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
15
|
-
},
|
|
16
13
|
"dependencies": {
|
|
17
14
|
"lodash": "^4.17.21",
|
|
18
|
-
"@ldsg/
|
|
19
|
-
"@ldsg/resource": "0.3.
|
|
20
|
-
"@ldsg/resource
|
|
15
|
+
"@ldsg/field-type": "0.3.10",
|
|
16
|
+
"@ldsg/resource-definition": "0.3.10",
|
|
17
|
+
"@ldsg/resource": "0.3.10",
|
|
18
|
+
"@ldsg/handler": "0.3.10"
|
|
21
19
|
},
|
|
22
20
|
"devDependencies": {
|
|
21
|
+
"@types/jest": "^29.5.2",
|
|
23
22
|
"@types/lodash": "^4.14.202",
|
|
24
23
|
"@types/supertest": "^6.0.0",
|
|
25
24
|
"graphql": "16.11.0",
|
|
26
25
|
"graphql-compose": "^9.1.0",
|
|
26
|
+
"jest": "^29.5.0",
|
|
27
27
|
"supertest": "^6.3.4",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"@ldsg/
|
|
32
|
-
"@ldsg/object
|
|
33
|
-
"@ldsg/
|
|
34
|
-
"@ldsg/
|
|
28
|
+
"ts-jest": "^29.1.5",
|
|
29
|
+
"ts-node": "^10.9.2",
|
|
30
|
+
"typescript": "^5.8.3",
|
|
31
|
+
"@ldsg/graphql": "0.3.10",
|
|
32
|
+
"@ldsg/object": "0.3.10",
|
|
33
|
+
"@ldsg/workflow": "0.3.10",
|
|
34
|
+
"@ldsg/object-field": "0.3.10",
|
|
35
|
+
"@ldsg/types": "0.3.10"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
35
39
|
},
|
|
36
40
|
"scripts": {
|
|
37
41
|
"build": "tsc --project tsconfig.build.json",
|