@ldsg/form 0.3.31 → 0.3.33
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/__tests__/unit.js +68 -68
- package/dist/constants.d.ts +3 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +8 -8
- 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 +3 -3
- package/dist/resource.d.ts.map +1 -1
- package/dist/resource.js +7 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/specific-resource-settings.d.ts +3 -3
- package/dist/types/specific-resource-settings.js +3 -3
- package/package.json +22 -16
package/dist/__tests__/unit.js
CHANGED
|
@@ -6,107 +6,107 @@ const object_1 = require("@ldsg/object");
|
|
|
6
6
|
const object_field_1 = require("@ldsg/object-field");
|
|
7
7
|
const workflow_1 = require("@ldsg/workflow");
|
|
8
8
|
const resource_1 = require("../resource");
|
|
9
|
-
test(
|
|
9
|
+
test("unit", () => {
|
|
10
10
|
new handler_1.HandlerResource(field_type_1.stringFieldTypeHandlerResourceRecord);
|
|
11
11
|
new field_type_1.FieldTypeResource(field_type_1.stringFieldTypeResourceRecord);
|
|
12
12
|
new object_1.ObjectResource({
|
|
13
|
-
id:
|
|
14
|
-
kind:
|
|
15
|
-
parentId:
|
|
13
|
+
id: "test-object-1",
|
|
14
|
+
kind: "object",
|
|
15
|
+
parentId: "root",
|
|
16
16
|
settings: {
|
|
17
|
-
title:
|
|
18
|
-
description:
|
|
19
|
-
|
|
20
|
-
}
|
|
17
|
+
title: "测试对象1",
|
|
18
|
+
description: "",
|
|
19
|
+
slug: "test-object-1",
|
|
20
|
+
},
|
|
21
21
|
});
|
|
22
22
|
new object_field_1.ObjectFieldResource({
|
|
23
|
-
id:
|
|
24
|
-
kind:
|
|
25
|
-
parentId:
|
|
23
|
+
id: "test-object-1-field-1",
|
|
24
|
+
kind: "object_field",
|
|
25
|
+
parentId: "test-object-1",
|
|
26
26
|
settings: {
|
|
27
|
-
title:
|
|
28
|
-
description:
|
|
29
|
-
|
|
27
|
+
title: "测试对象1测试字段1",
|
|
28
|
+
description: "",
|
|
29
|
+
slug: "test-1",
|
|
30
30
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
31
31
|
properties: {
|
|
32
|
-
max:
|
|
33
|
-
}
|
|
34
|
-
}
|
|
32
|
+
max: "10",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
35
|
});
|
|
36
36
|
new object_field_1.ObjectFieldResource({
|
|
37
|
-
id:
|
|
38
|
-
kind:
|
|
39
|
-
parentId:
|
|
37
|
+
id: "test-object-1-field-2",
|
|
38
|
+
kind: "object_field",
|
|
39
|
+
parentId: "test-object-1",
|
|
40
40
|
settings: {
|
|
41
|
-
title:
|
|
42
|
-
description:
|
|
43
|
-
|
|
41
|
+
title: "测试对象1测试字段2",
|
|
42
|
+
description: "",
|
|
43
|
+
slug: "test-2",
|
|
44
44
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
45
45
|
properties: {
|
|
46
|
-
max:
|
|
47
|
-
}
|
|
48
|
-
}
|
|
46
|
+
max: "10",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
49
|
});
|
|
50
50
|
new object_field_1.ObjectFieldResource({
|
|
51
|
-
id:
|
|
52
|
-
kind:
|
|
53
|
-
parentId:
|
|
51
|
+
id: "test-object-1-field-3",
|
|
52
|
+
kind: "object_field",
|
|
53
|
+
parentId: "test-object-1",
|
|
54
54
|
settings: {
|
|
55
|
-
title:
|
|
56
|
-
description:
|
|
57
|
-
|
|
55
|
+
title: "测试对象1测试字段3",
|
|
56
|
+
description: "",
|
|
57
|
+
slug: "test-3",
|
|
58
58
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
59
59
|
properties: {
|
|
60
|
-
max:
|
|
61
|
-
}
|
|
62
|
-
}
|
|
60
|
+
max: "10",
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
63
|
});
|
|
64
64
|
new object_1.ObjectResource({
|
|
65
|
-
id:
|
|
66
|
-
kind:
|
|
67
|
-
parentId:
|
|
65
|
+
id: "test-object-2",
|
|
66
|
+
kind: "object",
|
|
67
|
+
parentId: "root",
|
|
68
68
|
settings: {
|
|
69
|
-
title:
|
|
70
|
-
description:
|
|
71
|
-
|
|
72
|
-
}
|
|
69
|
+
title: "测试对象2",
|
|
70
|
+
description: "",
|
|
71
|
+
slug: "test-object-2",
|
|
72
|
+
},
|
|
73
73
|
});
|
|
74
74
|
new object_field_1.ObjectFieldResource({
|
|
75
|
-
id:
|
|
76
|
-
kind:
|
|
77
|
-
parentId:
|
|
75
|
+
id: "test-object-2-field-1",
|
|
76
|
+
kind: "object_field",
|
|
77
|
+
parentId: "test-object-2",
|
|
78
78
|
settings: {
|
|
79
|
-
title:
|
|
80
|
-
description:
|
|
81
|
-
|
|
79
|
+
title: "测试对象2测试字段1",
|
|
80
|
+
description: "",
|
|
81
|
+
slug: "test-1",
|
|
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 workflow_1.WorkflowResource({
|
|
89
|
-
id:
|
|
90
|
-
kind:
|
|
91
|
-
parentId:
|
|
89
|
+
id: "test-workflow",
|
|
90
|
+
kind: "workflow",
|
|
91
|
+
parentId: "root",
|
|
92
92
|
settings: {
|
|
93
|
-
title:
|
|
94
|
-
description:
|
|
95
|
-
startWorkflowNodeResourceId:
|
|
96
|
-
endWorkflowNodeResourceId:
|
|
97
|
-
}
|
|
93
|
+
title: "测试工作流",
|
|
94
|
+
description: "",
|
|
95
|
+
startWorkflowNodeResourceId: "",
|
|
96
|
+
endWorkflowNodeResourceId: "",
|
|
97
|
+
},
|
|
98
98
|
});
|
|
99
99
|
const formResource = new resource_1.FormResource({
|
|
100
|
-
id:
|
|
101
|
-
kind:
|
|
102
|
-
parentId:
|
|
100
|
+
id: "test-form",
|
|
101
|
+
kind: "form",
|
|
102
|
+
parentId: "forms",
|
|
103
103
|
settings: {
|
|
104
|
-
title:
|
|
105
|
-
description:
|
|
106
|
-
|
|
107
|
-
inputObjectResourceId:
|
|
108
|
-
outputObjectResourceId:
|
|
109
|
-
}
|
|
104
|
+
title: "测试表单",
|
|
105
|
+
description: "",
|
|
106
|
+
slug: "test-form",
|
|
107
|
+
inputObjectResourceId: "test-object-1",
|
|
108
|
+
outputObjectResourceId: "test-object-2",
|
|
109
|
+
},
|
|
110
110
|
});
|
|
111
111
|
const getFormInfoRes = formResource.getFormInfo();
|
|
112
112
|
expect(getFormInfoRes).toMatchSnapshot();
|
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"}
|
package/dist/constants.js
CHANGED
|
@@ -6,8 +6,8 @@ exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = exports.RESOURCE_DEFINI
|
|
|
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,14 +18,14 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
|
|
|
18
18
|
code: `export * from "@ldsg/form";`,
|
|
19
19
|
dependencies: [
|
|
20
20
|
{
|
|
21
|
-
name:
|
|
22
|
-
}
|
|
23
|
-
]
|
|
21
|
+
name: "@ldsg/form",
|
|
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: "form",
|
|
31
31
|
};
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Handler, HandlerExtendedResourceSettings } from
|
|
2
|
-
import { InstantiateResourceParams, InstantiateResourceRes } from
|
|
3
|
-
import { FormResource } from
|
|
4
|
-
import { FormSpecificResourceSettings } from
|
|
1
|
+
import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
|
|
3
|
+
import { FormResource } from "./resource";
|
|
4
|
+
import { FormSpecificResourceSettings } from "./types";
|
|
5
5
|
export declare const handler: Handler<InstantiateResourceParams<HandlerExtendedResourceSettings<FormSpecificResourceSettings>>, InstantiateResourceRes<FormResource>>;
|
|
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 { FormResource } from
|
|
4
|
-
import { FormSpecificResourceSettings } from
|
|
1
|
+
import { HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResource } from "@ldsg/resource";
|
|
3
|
+
import { FormResource } from "./resource";
|
|
4
|
+
import { FormSpecificResourceSettings } from "./types";
|
|
5
5
|
export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<FormSpecificResourceSettings>, FormResource>;
|
|
6
6
|
//# sourceMappingURL=instantiate-resource.d.ts.map
|
package/dist/resource.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { GetFormInfo } from
|
|
2
|
-
import { Resource } from
|
|
3
|
-
import { FormSpecificResourceSettings } from
|
|
1
|
+
import { GetFormInfo } from "@ldsg/forms";
|
|
2
|
+
import { Resource } from "@ldsg/resource";
|
|
3
|
+
import { FormSpecificResourceSettings } from "./types";
|
|
4
4
|
export declare class FormResource extends Resource<FormSpecificResourceSettings> {
|
|
5
5
|
getFormInfo: GetFormInfo;
|
|
6
6
|
}
|
package/dist/resource.d.ts.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/resource.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.FormResource = void 0;
|
|
4
7
|
const resource_1 = require("@ldsg/resource");
|
|
8
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
5
9
|
class FormResource extends resource_1.Resource {
|
|
6
10
|
constructor() {
|
|
7
11
|
super(...arguments);
|
|
8
12
|
this.getFormInfo = (params) => {
|
|
9
|
-
const { id, settings: { title, description,
|
|
13
|
+
const { id, settings: { title, description, slug }, getResourcesFromSettings, } = this;
|
|
14
|
+
const name = lodash_1.default.camelCase(slug);
|
|
10
15
|
const { inputObjectResource, outputObjectResource } = getResourcesFromSettings();
|
|
11
16
|
const { objectInfo: inputObjectInfo } = inputObjectResource.getObjectInfo(params);
|
|
12
17
|
const { objectInfo: outputObjectInfo } = outputObjectResource.getObjectInfo(params);
|
|
@@ -16,7 +21,7 @@ class FormResource extends resource_1.Resource {
|
|
|
16
21
|
description,
|
|
17
22
|
name,
|
|
18
23
|
inputObjectInfo,
|
|
19
|
-
outputObjectInfo
|
|
24
|
+
outputObjectInfo,
|
|
20
25
|
};
|
|
21
26
|
return res;
|
|
22
27
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from "./specific-resource-settings";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const FormSpecificResourceSettingsSchema: z.ZodObject<{
|
|
3
|
-
|
|
3
|
+
slug: z.ZodString;
|
|
4
4
|
inputObjectResourceId: z.ZodString;
|
|
5
5
|
outputObjectResourceId: z.ZodString;
|
|
6
6
|
}, z.core.$catchall<z.ZodAny>>;
|
|
7
7
|
export declare const SpecificResourceSettingsSchema: z.ZodObject<{
|
|
8
|
-
|
|
8
|
+
slug: z.ZodString;
|
|
9
9
|
inputObjectResourceId: z.ZodString;
|
|
10
10
|
outputObjectResourceId: z.ZodString;
|
|
11
11
|
}, z.core.$catchall<z.ZodAny>>;
|
|
@@ -5,9 +5,9 @@ const zod_1 = require("zod");
|
|
|
5
5
|
exports.FormSpecificResourceSettingsSchema = zod_1.z
|
|
6
6
|
.object({
|
|
7
7
|
/**
|
|
8
|
-
* Form
|
|
8
|
+
* Form Slug
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
slug: zod_1.z.string(),
|
|
11
11
|
/**
|
|
12
12
|
* Input Object Resource Id
|
|
13
13
|
*/
|
|
@@ -15,7 +15,7 @@ exports.FormSpecificResourceSettingsSchema = zod_1.z
|
|
|
15
15
|
/**
|
|
16
16
|
* Output Object Resource Id
|
|
17
17
|
*/
|
|
18
|
-
outputObjectResourceId: zod_1.z.string()
|
|
18
|
+
outputObjectResourceId: zod_1.z.string(),
|
|
19
19
|
})
|
|
20
20
|
.catchall(zod_1.z.any());
|
|
21
21
|
exports.SpecificResourceSettingsSchema = exports.FormSpecificResourceSettingsSchema;
|
package/package.json
CHANGED
|
@@ -1,41 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/form",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.33",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "wanxger",
|
|
8
|
-
"main": "dist/index.js",
|
|
9
|
-
"types": "dist",
|
|
10
8
|
"files": [
|
|
11
9
|
"dist/"
|
|
12
10
|
],
|
|
11
|
+
"main": "dist/index.js",
|
|
12
|
+
"types": "dist",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
13
16
|
"dependencies": {
|
|
17
|
+
"lodash": "^4.17.21",
|
|
14
18
|
"zod": "^4.1.11",
|
|
15
|
-
"@ldsg/handler": "0.3.
|
|
16
|
-
"@ldsg/resource": "0.3.
|
|
17
|
-
"@ldsg/resource-definition": "0.3.
|
|
19
|
+
"@ldsg/handler": "0.3.33",
|
|
20
|
+
"@ldsg/resource": "0.3.33",
|
|
21
|
+
"@ldsg/resource-definition": "0.3.33"
|
|
18
22
|
},
|
|
19
23
|
"devDependencies": {
|
|
20
24
|
"@types/jest": "^29.5.2",
|
|
25
|
+
"@types/lodash": "^4.17.0",
|
|
21
26
|
"@types/supertest": "^6.0.0",
|
|
22
27
|
"jest": "^29.5.0",
|
|
28
|
+
"oxfmt": "latest",
|
|
29
|
+
"oxlint": "latest",
|
|
23
30
|
"supertest": "^6.3.4",
|
|
24
31
|
"ts-jest": "^29.1.5",
|
|
25
32
|
"ts-node": "^10.9.2",
|
|
26
33
|
"typescript": "^5.8.3",
|
|
27
|
-
"@ldsg/field-type": "0.3.
|
|
28
|
-
"@ldsg/forms": "0.3.
|
|
29
|
-
"@ldsg/object": "0.3.
|
|
30
|
-
"@ldsg/object-field": "0.3.
|
|
31
|
-
"@ldsg/
|
|
32
|
-
"@ldsg/
|
|
33
|
-
},
|
|
34
|
-
"publishConfig": {
|
|
35
|
-
"access": "public"
|
|
34
|
+
"@ldsg/field-type": "0.3.33",
|
|
35
|
+
"@ldsg/forms": "0.3.33",
|
|
36
|
+
"@ldsg/object": "0.3.33",
|
|
37
|
+
"@ldsg/object-field": "0.3.33",
|
|
38
|
+
"@ldsg/workflow": "0.3.33",
|
|
39
|
+
"@ldsg/types": "0.3.33"
|
|
36
40
|
},
|
|
37
41
|
"scripts": {
|
|
38
42
|
"build": "tsc --project tsconfig.build.json",
|
|
39
|
-
"clean": "rm -rf dist"
|
|
43
|
+
"clean": "rm -rf dist",
|
|
44
|
+
"format": "oxfmt --write src/",
|
|
45
|
+
"lint": "oxlint src/"
|
|
40
46
|
}
|
|
41
47
|
}
|