@ldsg/object 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/__tests__/unit.js +38 -38
- 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 +4 -4
- package/dist/resource.js +5 -5
- package/dist/types/get-field-info.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/specific-resource-settings.d.ts +1 -1
- package/dist/types/specific-resource-settings.js +1 -1
- package/package.json +11 -7
package/dist/__tests__/unit.js
CHANGED
|
@@ -9,80 +9,80 @@ class MockObjectFieldResource extends resource_1.Resource {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.getFieldInfo = (params) => {
|
|
12
|
-
const { id, settings: { title, description, name, properties }, getResourcesFromSettings } = this;
|
|
12
|
+
const { id, settings: { title, description, name, properties }, getResourcesFromSettings, } = this;
|
|
13
13
|
const { fieldTypeResource } = getResourcesFromSettings();
|
|
14
14
|
const { fieldTypeInfo } = fieldTypeResource.getFieldTypeInfo({
|
|
15
15
|
...params,
|
|
16
|
-
fieldProperties: properties
|
|
16
|
+
fieldProperties: properties,
|
|
17
17
|
});
|
|
18
18
|
const fieldInfo = {
|
|
19
19
|
id,
|
|
20
20
|
title,
|
|
21
21
|
description,
|
|
22
22
|
name,
|
|
23
|
-
typeInfo: fieldTypeInfo
|
|
23
|
+
typeInfo: fieldTypeInfo,
|
|
24
24
|
};
|
|
25
25
|
const res = {
|
|
26
|
-
fieldInfo
|
|
26
|
+
fieldInfo,
|
|
27
27
|
};
|
|
28
28
|
return res;
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
test(
|
|
32
|
+
test("object", () => {
|
|
33
33
|
new handler_1.HandlerResource(field_type_1.stringFieldTypeHandlerResourceRecord);
|
|
34
34
|
new field_type_1.FieldTypeResource(field_type_1.stringFieldTypeResourceRecord);
|
|
35
35
|
const testObject = new resource_2.ObjectResource({
|
|
36
|
-
id:
|
|
37
|
-
kind:
|
|
36
|
+
id: "test-object",
|
|
37
|
+
kind: "object",
|
|
38
38
|
parentId: constants_1.ROOT_RESOURCE_ID,
|
|
39
39
|
settings: {
|
|
40
|
-
title:
|
|
41
|
-
description:
|
|
42
|
-
name:
|
|
43
|
-
}
|
|
40
|
+
title: "测试对象",
|
|
41
|
+
description: "",
|
|
42
|
+
name: "test",
|
|
43
|
+
},
|
|
44
44
|
});
|
|
45
45
|
new MockObjectFieldResource({
|
|
46
|
-
id:
|
|
47
|
-
kind:
|
|
48
|
-
parentId:
|
|
46
|
+
id: "test-object-test-1-object-field",
|
|
47
|
+
kind: "object_field",
|
|
48
|
+
parentId: "test-object",
|
|
49
49
|
settings: {
|
|
50
|
-
title:
|
|
51
|
-
description:
|
|
52
|
-
name:
|
|
50
|
+
title: "测试对象测试1对象字段",
|
|
51
|
+
description: "",
|
|
52
|
+
name: "test1",
|
|
53
53
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
54
54
|
properties: {
|
|
55
|
-
max:
|
|
56
|
-
}
|
|
57
|
-
}
|
|
55
|
+
max: "10",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
58
|
});
|
|
59
59
|
new MockObjectFieldResource({
|
|
60
|
-
id:
|
|
61
|
-
kind:
|
|
62
|
-
parentId:
|
|
60
|
+
id: "test-object-test-2-object-field",
|
|
61
|
+
kind: "object_field",
|
|
62
|
+
parentId: "test-object",
|
|
63
63
|
settings: {
|
|
64
|
-
title:
|
|
65
|
-
description:
|
|
66
|
-
name:
|
|
64
|
+
title: "测试对象测试2对象字段",
|
|
65
|
+
description: "",
|
|
66
|
+
name: "test2",
|
|
67
67
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
68
68
|
properties: {
|
|
69
|
-
max:
|
|
70
|
-
}
|
|
71
|
-
}
|
|
69
|
+
max: "10",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
72
|
});
|
|
73
73
|
new MockObjectFieldResource({
|
|
74
|
-
id:
|
|
75
|
-
kind:
|
|
76
|
-
parentId:
|
|
74
|
+
id: "test-object-test-3-object-field",
|
|
75
|
+
kind: "object_field",
|
|
76
|
+
parentId: "test-object",
|
|
77
77
|
settings: {
|
|
78
|
-
title:
|
|
79
|
-
description:
|
|
80
|
-
name:
|
|
78
|
+
title: "测试对象测试3对象字段",
|
|
79
|
+
description: "",
|
|
80
|
+
name: "test3",
|
|
81
81
|
fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
|
|
82
82
|
properties: {
|
|
83
|
-
max:
|
|
84
|
-
}
|
|
85
|
-
}
|
|
83
|
+
max: "10",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
86
|
});
|
|
87
87
|
const getObjectInfoRes = testObject.getObjectInfo();
|
|
88
88
|
expect(getObjectInfoRes).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/object";`,
|
|
19
19
|
dependencies: [
|
|
20
20
|
{
|
|
21
|
-
name:
|
|
22
|
-
}
|
|
23
|
-
]
|
|
21
|
+
name: "@ldsg/object",
|
|
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: "object",
|
|
31
31
|
};
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Handler, HandlerExtendedResourceSettings } from
|
|
2
|
-
import { InstantiateResourceParams, InstantiateResourceRes } from
|
|
3
|
-
import { ObjectResource } from
|
|
4
|
-
import { ObjectSpecificResourceSettings } from
|
|
1
|
+
import { Handler, HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResourceParams, InstantiateResourceRes } from "@ldsg/resource";
|
|
3
|
+
import { ObjectResource } from "./resource";
|
|
4
|
+
import { ObjectSpecificResourceSettings } from "./types";
|
|
5
5
|
export declare const handler: Handler<InstantiateResourceParams<HandlerExtendedResourceSettings<ObjectSpecificResourceSettings>>, InstantiateResourceRes<ObjectResource>>;
|
|
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 { ObjectResource } from
|
|
4
|
-
import { ObjectSpecificResourceSettings } from
|
|
1
|
+
import { HandlerExtendedResourceSettings } from "@ldsg/handler";
|
|
2
|
+
import { InstantiateResource } from "@ldsg/resource";
|
|
3
|
+
import { ObjectResource } from "./resource";
|
|
4
|
+
import { ObjectSpecificResourceSettings } from "./types";
|
|
5
5
|
export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<ObjectSpecificResourceSettings>, ObjectResource>;
|
|
6
6
|
//# sourceMappingURL=instantiate-resource.d.ts.map
|
package/dist/resource.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { PlatformsParams } from
|
|
2
|
-
import { Resource } from
|
|
3
|
-
import { GeneralResourceSettings } from
|
|
4
|
-
import { FieldInfo, ObjectSpecificResourceSettings } from
|
|
1
|
+
import { PlatformsParams } from "@ldsg/field-type";
|
|
2
|
+
import { Resource } from "@ldsg/resource";
|
|
3
|
+
import { GeneralResourceSettings } from "@ldsg/types";
|
|
4
|
+
import { FieldInfo, ObjectSpecificResourceSettings } from "./types";
|
|
5
5
|
export interface ObjectInfo extends GeneralResourceSettings {
|
|
6
6
|
/**
|
|
7
7
|
* Object Name
|
package/dist/resource.js
CHANGED
|
@@ -10,9 +10,9 @@ class ObjectResource extends resource_1.Resource {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
12
|
this.getObjectInfo = (params) => {
|
|
13
|
-
const { id, settings: { title, description, name }, getFilteredResources } = this;
|
|
13
|
+
const { id, settings: { title, description, name }, getFilteredResources, } = this;
|
|
14
14
|
const { resources } = getFilteredResources({
|
|
15
|
-
parentId: id
|
|
15
|
+
parentId: id,
|
|
16
16
|
});
|
|
17
17
|
const mapRes = resources.map((resource) => {
|
|
18
18
|
var _a;
|
|
@@ -20,15 +20,15 @@ class ObjectResource extends resource_1.Resource {
|
|
|
20
20
|
return fieldInfo;
|
|
21
21
|
});
|
|
22
22
|
const filterRes = lodash_1.default.filter(mapRes, (value) => !lodash_1.default.isUndefined(value));
|
|
23
|
-
const fieldInfoList = lodash_1.default.map(filterRes,
|
|
23
|
+
const fieldInfoList = lodash_1.default.map(filterRes, "fieldInfo");
|
|
24
24
|
const objectInfo = {
|
|
25
25
|
title,
|
|
26
26
|
description,
|
|
27
27
|
name,
|
|
28
|
-
fieldInfoList
|
|
28
|
+
fieldInfoList,
|
|
29
29
|
};
|
|
30
30
|
const res = {
|
|
31
|
-
objectInfo
|
|
31
|
+
objectInfo,
|
|
32
32
|
};
|
|
33
33
|
return res;
|
|
34
34
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldTypeInfo, PlatformsParams } from
|
|
2
|
-
import { GeneralResourceSettings } from
|
|
1
|
+
import { FieldTypeInfo, PlatformsParams } from "@ldsg/field-type";
|
|
2
|
+
import { GeneralResourceSettings } from "@ldsg/types";
|
|
3
3
|
export interface FieldInfo extends GeneralResourceSettings {
|
|
4
4
|
/**
|
|
5
5
|
* Field ID
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./get-field-info";
|
|
2
|
+
export * from "./specific-resource-settings";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ldsg/object",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,21 +13,23 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"lodash": "^4.17.21",
|
|
15
15
|
"zod": "^4.1.11",
|
|
16
|
-
"@ldsg/
|
|
17
|
-
"@ldsg/
|
|
18
|
-
"@ldsg/
|
|
19
|
-
"@ldsg/resource
|
|
16
|
+
"@ldsg/handler": "0.3.32",
|
|
17
|
+
"@ldsg/resource-definition": "0.3.32",
|
|
18
|
+
"@ldsg/constants": "0.3.32",
|
|
19
|
+
"@ldsg/resource": "0.3.32"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/jest": "^29.5.2",
|
|
23
23
|
"@types/lodash": "^4.14.202",
|
|
24
24
|
"jest": "^29.5.0",
|
|
25
|
+
"oxfmt": "latest",
|
|
26
|
+
"oxlint": "latest",
|
|
25
27
|
"supertest": "^6.3.4",
|
|
26
28
|
"ts-jest": "^29.1.5",
|
|
27
29
|
"ts-node": "^10.9.2",
|
|
28
30
|
"typescript": "^5.8.3",
|
|
29
|
-
"@ldsg/field-type": "0.3.
|
|
30
|
-
"@ldsg/types": "0.3.
|
|
31
|
+
"@ldsg/field-type": "0.3.32",
|
|
32
|
+
"@ldsg/types": "0.3.32"
|
|
31
33
|
},
|
|
32
34
|
"publishConfig": {
|
|
33
35
|
"access": "public"
|
|
@@ -35,6 +37,8 @@
|
|
|
35
37
|
"scripts": {
|
|
36
38
|
"build": "tsc --project tsconfig.build.json",
|
|
37
39
|
"clean": "rm -rf dist",
|
|
40
|
+
"format": "oxfmt --write src/",
|
|
41
|
+
"lint": "oxlint src/",
|
|
38
42
|
"test": "jest"
|
|
39
43
|
}
|
|
40
44
|
}
|