@ldsg/forms 0.3.31 → 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
|
@@ -8,10 +8,10 @@ const map_form_info_1 = require("./map-form-info");
|
|
|
8
8
|
*/
|
|
9
9
|
function createFormResolver(formInfoList) {
|
|
10
10
|
return {
|
|
11
|
-
name:
|
|
12
|
-
type:
|
|
11
|
+
name: "form",
|
|
12
|
+
type: "FormDetail",
|
|
13
13
|
args: {
|
|
14
|
-
name:
|
|
14
|
+
name: "String!",
|
|
15
15
|
},
|
|
16
16
|
resolve: async (_root, args) => {
|
|
17
17
|
const { name } = args;
|
|
@@ -20,7 +20,7 @@ function createFormResolver(formInfoList) {
|
|
|
20
20
|
throw new Error(`Form not found: ${name}`);
|
|
21
21
|
}
|
|
22
22
|
return (0, map_form_info_1.mapFormInfoToDetail)(formInfo);
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -28,10 +28,10 @@ function createFormResolver(formInfoList) {
|
|
|
28
28
|
*/
|
|
29
29
|
function createFormsResolver(formInfoList) {
|
|
30
30
|
return {
|
|
31
|
-
name:
|
|
32
|
-
type:
|
|
31
|
+
name: "forms",
|
|
32
|
+
type: "[FormMetadata!]!",
|
|
33
33
|
resolve: async () => {
|
|
34
34
|
return formInfoList.map((f) => (0, map_form_info_1.mapFormInfoToMetadata)(f));
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -6,95 +6,95 @@ exports.createFormDetailTC = createFormDetailTC;
|
|
|
6
6
|
* Creates GraphQL type for ObjectInfo (used in inputObject and outputObject)
|
|
7
7
|
*/
|
|
8
8
|
function createObjectInfoTC(schemaComposer) {
|
|
9
|
-
if (schemaComposer.has(
|
|
10
|
-
return schemaComposer.getOTC(
|
|
9
|
+
if (schemaComposer.has("FormObjectInfo")) {
|
|
10
|
+
return schemaComposer.getOTC("FormObjectInfo");
|
|
11
11
|
}
|
|
12
12
|
return schemaComposer.createObjectTC({
|
|
13
|
-
name:
|
|
13
|
+
name: "FormObjectInfo",
|
|
14
14
|
fields: {
|
|
15
15
|
name: {
|
|
16
|
-
type:
|
|
17
|
-
description:
|
|
16
|
+
type: "String",
|
|
17
|
+
description: "Object name",
|
|
18
18
|
},
|
|
19
19
|
title: {
|
|
20
|
-
type:
|
|
21
|
-
description:
|
|
20
|
+
type: "String",
|
|
21
|
+
description: "Object title",
|
|
22
22
|
},
|
|
23
23
|
description: {
|
|
24
|
-
type:
|
|
25
|
-
description:
|
|
24
|
+
type: "String",
|
|
25
|
+
description: "Object description",
|
|
26
26
|
},
|
|
27
27
|
fieldInfoList: {
|
|
28
|
-
type:
|
|
29
|
-
description:
|
|
28
|
+
type: "JSON",
|
|
29
|
+
description: "List of field information",
|
|
30
30
|
},
|
|
31
31
|
jsonSchema: {
|
|
32
|
-
type:
|
|
33
|
-
description:
|
|
32
|
+
type: "JSON",
|
|
33
|
+
description: "JSON Schema for the object",
|
|
34
34
|
},
|
|
35
35
|
formilyJsonSchema: {
|
|
36
|
-
type:
|
|
37
|
-
description:
|
|
38
|
-
}
|
|
39
|
-
}
|
|
36
|
+
type: "JSON",
|
|
37
|
+
description: "Formily JSON Schema for the object",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Creates GraphQL type for FormMetadata
|
|
44
44
|
*/
|
|
45
45
|
function createFormMetadataTC(schemaComposer) {
|
|
46
|
-
if (schemaComposer.has(
|
|
47
|
-
return schemaComposer.getOTC(
|
|
46
|
+
if (schemaComposer.has("FormMetadata")) {
|
|
47
|
+
return schemaComposer.getOTC("FormMetadata");
|
|
48
48
|
}
|
|
49
49
|
return schemaComposer.createObjectTC({
|
|
50
|
-
name:
|
|
50
|
+
name: "FormMetadata",
|
|
51
51
|
fields: {
|
|
52
52
|
name: {
|
|
53
|
-
type:
|
|
54
|
-
description:
|
|
53
|
+
type: "String!",
|
|
54
|
+
description: "Form name",
|
|
55
55
|
},
|
|
56
56
|
title: {
|
|
57
|
-
type:
|
|
58
|
-
description:
|
|
57
|
+
type: "String",
|
|
58
|
+
description: "Human-readable form title",
|
|
59
59
|
},
|
|
60
60
|
description: {
|
|
61
|
-
type:
|
|
62
|
-
description:
|
|
63
|
-
}
|
|
64
|
-
}
|
|
61
|
+
type: "String",
|
|
62
|
+
description: "Optional form description",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Creates GraphQL type for FormDetail
|
|
69
69
|
*/
|
|
70
70
|
function createFormDetailTC(schemaComposer) {
|
|
71
|
-
if (schemaComposer.has(
|
|
72
|
-
return schemaComposer.getOTC(
|
|
71
|
+
if (schemaComposer.has("FormDetail")) {
|
|
72
|
+
return schemaComposer.getOTC("FormDetail");
|
|
73
73
|
}
|
|
74
74
|
const objectInfoTC = createObjectInfoTC(schemaComposer);
|
|
75
75
|
return schemaComposer.createObjectTC({
|
|
76
|
-
name:
|
|
76
|
+
name: "FormDetail",
|
|
77
77
|
fields: {
|
|
78
78
|
name: {
|
|
79
|
-
type:
|
|
80
|
-
description:
|
|
79
|
+
type: "String!",
|
|
80
|
+
description: "Form name",
|
|
81
81
|
},
|
|
82
82
|
title: {
|
|
83
|
-
type:
|
|
84
|
-
description:
|
|
83
|
+
type: "String",
|
|
84
|
+
description: "Human-readable form title",
|
|
85
85
|
},
|
|
86
86
|
description: {
|
|
87
|
-
type:
|
|
88
|
-
description:
|
|
87
|
+
type: "String",
|
|
88
|
+
description: "Optional form description",
|
|
89
89
|
},
|
|
90
90
|
inputObjectInfo: {
|
|
91
91
|
type: objectInfoTC,
|
|
92
|
-
description:
|
|
92
|
+
description: "Input object information",
|
|
93
93
|
},
|
|
94
94
|
outputObjectInfo: {
|
|
95
95
|
type: objectInfoTC,
|
|
96
|
-
description:
|
|
97
|
-
}
|
|
98
|
-
}
|
|
96
|
+
description: "Output object information",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
99
|
});
|
|
100
100
|
}
|
|
@@ -20,19 +20,19 @@ function getJsonSchemaForField(fieldInfo) {
|
|
|
20
20
|
const commonType = platformToTypeMap[field_type_1.FieldTypeBasePlatform.COMMON];
|
|
21
21
|
if (!commonType) {
|
|
22
22
|
return {
|
|
23
|
-
type:
|
|
24
|
-
title: fieldInfo.title || fieldInfo.name
|
|
23
|
+
type: "string",
|
|
24
|
+
title: fieldInfo.title || fieldInfo.name,
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
// Basic type mapping
|
|
28
28
|
const typeMap = {
|
|
29
|
-
string: { type:
|
|
30
|
-
number: { type:
|
|
31
|
-
boolean: { type:
|
|
32
|
-
array: { type:
|
|
33
|
-
object: { type:
|
|
29
|
+
string: { type: "string", title: fieldInfo.title || fieldInfo.name },
|
|
30
|
+
number: { type: "number", title: fieldInfo.title || fieldInfo.name },
|
|
31
|
+
boolean: { type: "boolean", title: fieldInfo.title || fieldInfo.name },
|
|
32
|
+
array: { type: "array", title: fieldInfo.title || fieldInfo.name },
|
|
33
|
+
object: { type: "object", title: fieldInfo.title || fieldInfo.name },
|
|
34
34
|
};
|
|
35
|
-
return typeMap[commonType] || { type:
|
|
35
|
+
return typeMap[commonType] || { type: "string", title: fieldInfo.title || fieldInfo.name };
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Generates Formily JSON Schema for a field based on its type info
|
|
@@ -64,8 +64,8 @@ function getJsonSchemaByFieldInfoList(fieldInfoList) {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
return {
|
|
67
|
-
type:
|
|
68
|
-
properties
|
|
67
|
+
type: "object",
|
|
68
|
+
properties,
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -79,11 +79,11 @@ function getFormilyJsonSchemaByFieldInfoList(fieldInfoList) {
|
|
|
79
79
|
properties[fieldInfo.name] = formilySchema;
|
|
80
80
|
});
|
|
81
81
|
const schema = new json_schema_1.Schema({
|
|
82
|
-
type:
|
|
83
|
-
properties
|
|
82
|
+
type: "object",
|
|
83
|
+
properties,
|
|
84
84
|
});
|
|
85
85
|
const { schemaForFormily } = (0, get_schema_for_formily_1.getSchemaForFormily)({
|
|
86
|
-
schema
|
|
86
|
+
schema,
|
|
87
87
|
});
|
|
88
88
|
const res = schemaForFormily;
|
|
89
89
|
return res;
|
|
@@ -3,27 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SchemaTypeMap = void 0;
|
|
4
4
|
exports.SchemaTypeMap = {
|
|
5
5
|
boolean: {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
"x-decorator": "FormItem",
|
|
7
|
+
"x-component": "Checkbox",
|
|
8
8
|
},
|
|
9
9
|
integer: {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
"x-decorator": "FormItem",
|
|
11
|
+
"x-component": "NumberPicker",
|
|
12
12
|
},
|
|
13
13
|
number: {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
"x-decorator": "FormItem",
|
|
15
|
+
"x-component": "NumberPicker",
|
|
16
16
|
},
|
|
17
17
|
object: {},
|
|
18
18
|
objectWithoutProperties: {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
"x-decorator": "FormItem",
|
|
20
|
+
"x-component": "JsonInput",
|
|
21
21
|
},
|
|
22
22
|
string: {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
"x-decorator": "FormItem",
|
|
24
|
+
"x-component": "Input",
|
|
25
25
|
},
|
|
26
26
|
array: {
|
|
27
|
-
|
|
28
|
-
}
|
|
27
|
+
"x-decorator": "FormItem",
|
|
28
|
+
},
|
|
29
29
|
};
|
|
@@ -5,10 +5,10 @@ const process_object_schema_1 = require("./utils/process-object-schema");
|
|
|
5
5
|
const getSchemaForFormily = (params) => {
|
|
6
6
|
const { schema } = params;
|
|
7
7
|
(0, process_object_schema_1.processObjectSchema)({
|
|
8
|
-
schema
|
|
8
|
+
schema,
|
|
9
9
|
});
|
|
10
10
|
const res = {
|
|
11
|
-
schemaForFormily: schema
|
|
11
|
+
schemaForFormily: schema,
|
|
12
12
|
};
|
|
13
13
|
return res;
|
|
14
14
|
};
|
package/dist/utils/add-query-fields/utils/get-schema-for-formily/utils/process-object-schema.js
CHANGED
|
@@ -10,28 +10,28 @@ const processObjectSchema = (params) => {
|
|
|
10
10
|
const { schema } = params;
|
|
11
11
|
const { type, properties } = schema;
|
|
12
12
|
switch (type) {
|
|
13
|
-
case
|
|
13
|
+
case "object": {
|
|
14
14
|
if (properties && lodash_1.default.keys(properties).length) {
|
|
15
|
-
const schemaTypeMapValue = constants_1.SchemaTypeMap[
|
|
15
|
+
const schemaTypeMapValue = constants_1.SchemaTypeMap["object"];
|
|
16
16
|
lodash_1.default.defaults(schema, schemaTypeMapValue);
|
|
17
17
|
schema.mapProperties((property) => {
|
|
18
18
|
(0, exports.processObjectSchema)({
|
|
19
|
-
schema: property
|
|
19
|
+
schema: property,
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
const schemaTypeMapValue = constants_1.SchemaTypeMap[
|
|
24
|
+
const schemaTypeMapValue = constants_1.SchemaTypeMap["objectWithoutProperties"];
|
|
25
25
|
lodash_1.default.defaults(schema, schemaTypeMapValue);
|
|
26
26
|
}
|
|
27
27
|
break;
|
|
28
28
|
}
|
|
29
29
|
default: {
|
|
30
|
-
if (schema.enum && schema.enum.length && !schema[
|
|
30
|
+
if (schema.enum && schema.enum.length && !schema["x-component"]) {
|
|
31
31
|
/**
|
|
32
32
|
* TODO:应改成 Select,但在此 react 版本中 Select 功能异常
|
|
33
33
|
*/
|
|
34
|
-
schema[
|
|
34
|
+
schema["x-component"] = "Radio.Group";
|
|
35
35
|
}
|
|
36
36
|
const schemaTypeMapValue = constants_1.SchemaTypeMap[type];
|
|
37
37
|
if (schemaTypeMapValue) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormInfo } from
|
|
2
|
-
import { FormDetail, FormMetadata } from
|
|
1
|
+
import { FormInfo } from "../../../types";
|
|
2
|
+
import { FormDetail, FormMetadata } from "../../../types/query-types";
|
|
3
3
|
/**
|
|
4
4
|
* Maps FormInfo to FormMetadata (lightweight version without schemas)
|
|
5
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-form-info.d.ts","sourceRoot":"","sources":["../../../../src/utils/add-query-fields/utils/map-form-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"map-form-info.d.ts","sourceRoot":"","sources":["../../../../src/utils/add-query-fields/utils/map-form-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAMtE;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY,CAMtE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,CA4BlE"}
|
|
@@ -10,7 +10,7 @@ function mapFormInfoToMetadata(formInfo) {
|
|
|
10
10
|
return {
|
|
11
11
|
name: formInfo.name,
|
|
12
12
|
title: formInfo.title,
|
|
13
|
-
description: formInfo.description
|
|
13
|
+
description: formInfo.description,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -31,12 +31,12 @@ function mapFormInfoToDetail(formInfo) {
|
|
|
31
31
|
inputObjectInfo: {
|
|
32
32
|
...inputObjectInfo,
|
|
33
33
|
jsonSchema: inputJsonSchema,
|
|
34
|
-
formilyJsonSchema: inputFormilyJsonSchema
|
|
34
|
+
formilyJsonSchema: inputFormilyJsonSchema,
|
|
35
35
|
},
|
|
36
36
|
outputObjectInfo: {
|
|
37
37
|
...outputObjectInfo,
|
|
38
38
|
jsonSchema: outputJsonSchema,
|
|
39
|
-
formilyJsonSchema: outputFormilyJsonSchema
|
|
40
|
-
}
|
|
39
|
+
formilyJsonSchema: outputFormilyJsonSchema,
|
|
40
|
+
},
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -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
|
interface HandleFormInfoListParams extends SchemaComposerParams {
|
|
4
4
|
formInfoList: FormInfo[];
|
|
5
5
|
}
|
|
@@ -10,10 +10,10 @@ const handleFormInfoList = (params) => {
|
|
|
10
10
|
const { outputOTC } = (0, get_output_otc_1.getOutputOTC)({ schemaComposer, outputObjectInfo });
|
|
11
11
|
const { inputITC } = (0, get_input_itc_1.getInputITC)({ schemaComposer, inputObjectInfo });
|
|
12
12
|
outputOTC.addResolver({
|
|
13
|
-
name:
|
|
13
|
+
name: "submit",
|
|
14
14
|
type: outputOTC,
|
|
15
15
|
args: inputITC.getFields(),
|
|
16
|
-
resolve: undefined
|
|
16
|
+
resolve: undefined,
|
|
17
17
|
});
|
|
18
18
|
schemaComposer.addSchemaMustHaveType(outputOTC);
|
|
19
19
|
});
|
|
@@ -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/handle-form-info-list/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/handle-form-info-list/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,CAChC,MAAM,EAAE,gCAAgC,KACrC,6BAA6B,CAAC;AAEnC,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/handle-form-info-list/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/handle-form-info-list/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,CAC9B,MAAM,EAAE,8BAA8B,KACnC,2BAA2B,CAAC;AAEjC,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
|
}
|
|
@@ -6,16 +6,16 @@ const getInputITC = (params) => {
|
|
|
6
6
|
const { schemaComposer, inputObjectInfo } = params;
|
|
7
7
|
const { title, description, name, fieldInfoList } = inputObjectInfo;
|
|
8
8
|
const { fieldConfigMapDefinition } = (0, get_field_config_map_definition_1.getFieldConfigMapDefinition)({
|
|
9
|
-
fieldInfoList
|
|
9
|
+
fieldInfoList,
|
|
10
10
|
});
|
|
11
11
|
const definition = {
|
|
12
12
|
name,
|
|
13
|
-
fields: fieldConfigMapDefinition
|
|
13
|
+
fields: fieldConfigMapDefinition,
|
|
14
14
|
};
|
|
15
15
|
const inputITC = schemaComposer.createInputTC(definition);
|
|
16
|
-
inputITC.setDescription(`${title}${description ? `:${description}` :
|
|
16
|
+
inputITC.setDescription(`${title}${description ? `:${description}` : ""}`);
|
|
17
17
|
const res = {
|
|
18
|
-
inputITC
|
|
18
|
+
inputITC,
|
|
19
19
|
};
|
|
20
20
|
return res;
|
|
21
21
|
};
|
|
@@ -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
|
}
|
|
@@ -6,16 +6,16 @@ const getOutputOTC = (params) => {
|
|
|
6
6
|
const { schemaComposer, outputObjectInfo } = params;
|
|
7
7
|
const { title, description, name, fieldInfoList } = outputObjectInfo;
|
|
8
8
|
const { fieldConfigMapDefinition } = (0, get_field_config_map_definition_1.getFieldConfigMapDefinition)({
|
|
9
|
-
fieldInfoList
|
|
9
|
+
fieldInfoList,
|
|
10
10
|
});
|
|
11
11
|
const definition = {
|
|
12
12
|
name,
|
|
13
|
-
fields: fieldConfigMapDefinition
|
|
13
|
+
fields: fieldConfigMapDefinition,
|
|
14
14
|
};
|
|
15
15
|
const outputOTC = schemaComposer.createObjectTC(definition);
|
|
16
|
-
outputOTC.setDescription(`${title}${description ? `:${description}` :
|
|
16
|
+
outputOTC.setDescription(`${title}${description ? `:${description}` : ""}`);
|
|
17
17
|
const res = {
|
|
18
|
-
outputOTC
|
|
18
|
+
outputOTC,
|
|
19
19
|
};
|
|
20
20
|
return res;
|
|
21
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/forms",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"json-schema": "^0.4.0",
|
|
16
16
|
"lodash": "^4.17.21",
|
|
17
17
|
"zod": "^4.1.11",
|
|
18
|
-
"@ldsg/field-type": "0.3.
|
|
19
|
-
"@ldsg/
|
|
20
|
-
"@ldsg/resource": "0.3.
|
|
21
|
-
"@ldsg/
|
|
18
|
+
"@ldsg/field-type": "0.3.32",
|
|
19
|
+
"@ldsg/handler": "0.3.32",
|
|
20
|
+
"@ldsg/resource": "0.3.32",
|
|
21
|
+
"@ldsg/resource-definition": "0.3.32"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/jest": "^29.5.2",
|
|
@@ -26,17 +26,19 @@
|
|
|
26
26
|
"@types/lodash": "^4.14.202",
|
|
27
27
|
"@types/supertest": "^6.0.0",
|
|
28
28
|
"graphql": "16.11.0",
|
|
29
|
-
"graphql-compose": "
|
|
29
|
+
"graphql-compose": "9.1.0",
|
|
30
30
|
"jest": "^29.5.0",
|
|
31
|
+
"oxfmt": "latest",
|
|
32
|
+
"oxlint": "latest",
|
|
31
33
|
"supertest": "^6.3.4",
|
|
32
34
|
"ts-jest": "^29.1.5",
|
|
33
35
|
"ts-node": "^10.9.2",
|
|
34
36
|
"typescript": "^5.8.3",
|
|
35
|
-
"@ldsg/graphql": "0.3.
|
|
36
|
-
"@ldsg/object": "0.3.
|
|
37
|
-
"@ldsg/
|
|
38
|
-
"@ldsg/
|
|
39
|
-
"@ldsg/workflow": "0.3.
|
|
37
|
+
"@ldsg/graphql": "0.3.32",
|
|
38
|
+
"@ldsg/object": "0.3.32",
|
|
39
|
+
"@ldsg/object-field": "0.3.32",
|
|
40
|
+
"@ldsg/types": "0.3.32",
|
|
41
|
+
"@ldsg/workflow": "0.3.32"
|
|
40
42
|
},
|
|
41
43
|
"publishConfig": {
|
|
42
44
|
"access": "public"
|
|
@@ -44,6 +46,8 @@
|
|
|
44
46
|
"scripts": {
|
|
45
47
|
"build": "tsc --project tsconfig.build.json",
|
|
46
48
|
"clean": "rm -rf dist",
|
|
49
|
+
"format": "oxfmt --write src/",
|
|
50
|
+
"lint": "oxlint src/",
|
|
47
51
|
"test": "jest"
|
|
48
52
|
}
|
|
49
53
|
}
|