@ldsg/object 0.3.9 → 0.3.17

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.
@@ -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("object", () => {
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: "test-object",
37
- kind: "object",
36
+ id: 'test-object',
37
+ kind: 'object',
38
38
  parentId: constants_1.ROOT_RESOURCE_ID,
39
39
  settings: {
40
- title: "测试对象",
41
- description: "",
42
- name: "test",
43
- },
40
+ title: '测试对象',
41
+ description: '',
42
+ name: 'test'
43
+ }
44
44
  });
45
45
  new MockObjectFieldResource({
46
- id: "test-object-test-1-object-field",
47
- kind: "object_field",
48
- parentId: "test-object",
46
+ id: 'test-object-test-1-object-field',
47
+ kind: 'object_field',
48
+ parentId: 'test-object',
49
49
  settings: {
50
- title: "测试对象测试1对象字段",
51
- description: "",
52
- name: "test1",
50
+ title: '测试对象测试1对象字段',
51
+ description: '',
52
+ name: 'test1',
53
53
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
54
54
  properties: {
55
- max: "10",
56
- },
57
- },
55
+ max: '10'
56
+ }
57
+ }
58
58
  });
59
59
  new MockObjectFieldResource({
60
- id: "test-object-test-2-object-field",
61
- kind: "object_field",
62
- parentId: "test-object",
60
+ id: 'test-object-test-2-object-field',
61
+ kind: 'object_field',
62
+ parentId: 'test-object',
63
63
  settings: {
64
- title: "测试对象测试2对象字段",
65
- description: "",
66
- name: "test2",
64
+ title: '测试对象测试2对象字段',
65
+ description: '',
66
+ name: 'test2',
67
67
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
68
68
  properties: {
69
- max: "10",
70
- },
71
- },
69
+ max: '10'
70
+ }
71
+ }
72
72
  });
73
73
  new MockObjectFieldResource({
74
- id: "test-object-test-3-object-field",
75
- kind: "object_field",
76
- parentId: "test-object",
74
+ id: 'test-object-test-3-object-field',
75
+ kind: 'object_field',
76
+ parentId: 'test-object',
77
77
  settings: {
78
- title: "测试对象测试3对象字段",
79
- description: "",
80
- name: "test3",
78
+ title: '测试对象测试3对象字段',
79
+ description: '',
80
+ name: 'test3',
81
81
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
82
82
  properties: {
83
- max: "10",
84
- },
85
- },
83
+ max: '10'
84
+ }
85
+ }
86
86
  });
87
87
  const getObjectInfoRes = testObject.getObjectInfo();
88
88
  expect(getObjectInfoRes).toMatchSnapshot();
@@ -1,6 +1,6 @@
1
- import { HandlerSpecificResourceSettings } from "@ldsg/handler";
2
- import { ResourceDefinitionSpecificResourceSettings } from "@ldsg/resource-definition";
3
- import { GeneralResourceSettings } from "@ldsg/types";
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
  * 实例化资源处理程序普通资源配置
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,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,uBAIlE,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,uDAAuD,EAAE,+BAQnE,CAAC;AAEJ,eAAO,MAAM,6CAA6C,EAAE,uBACtB,CAAC;AAEvC,eAAO,MAAM,8CAA8C,EAAE,0CAI1D,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,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,0CAG5D,CAAC"}
package/dist/constants.js CHANGED
@@ -7,8 +7,8 @@ const constants_1 = require("@ldsg/constants");
7
7
  * 实例化资源处理程序普通资源配置
8
8
  */
9
9
  exports.INSTANTIATE_RESOURCE_HANDLER_GENERAL_RESOURCE_SETTINGS = {
10
- title: "对象实例化资源处理程序",
11
- description: "",
10
+ title: '对象实例化资源处理程序',
11
+ description: ''
12
12
  };
13
13
  /**
14
14
  * Instantiate Resource Handler Specific Resource Settings
@@ -19,12 +19,15 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
19
19
  code: `export * from "@ldsg/object";`,
20
20
  dependencies: [
21
21
  {
22
- name: "@ldsg/object",
23
- },
24
- ],
22
+ name: '@ldsg/object'
23
+ }
24
+ ]
25
+ };
26
+ exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = {
27
+ title: '对象资源定义',
28
+ description: ''
25
29
  };
26
- exports.RESOURCE_DEFINITION_GENERAL_RESOURCE_SETTINGS = { title: "对象资源定义", description: "" };
27
30
  exports.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS = {
28
- kind: "object",
29
- parentKind: constants_1.ROOT_RESOURCE_KIND,
31
+ kind: 'object',
32
+ parentKind: constants_1.ROOT_RESOURCE_KIND
30
33
  };
package/dist/handler.d.ts CHANGED
@@ -1,8 +1,6 @@
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
- export declare const handler: Handler<[
6
- InstantiateResourceParams<HandlerExtendedResourceSettings<ObjectSpecificResourceSettings>>
7
- ], InstantiateResourceRes<ObjectResource>>;
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
+ export declare const handler: Handler<InstantiateResourceParams<HandlerExtendedResourceSettings<ObjectSpecificResourceSettings>>, InstantiateResourceRes<ObjectResource>>;
8
6
  //# sourceMappingURL=handler.d.ts.map
@@ -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,EACL,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAEzD,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B;IACE,yBAAyB,CACvB,+BAA+B,CAAC,8BAA8B,CAAC,CAChE;CACF,EACD,sBAAsB,CAAC,cAAc,CAAC,CACjB,CAAC"}
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,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAEzD,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B,yBAAyB,CAAC,+BAA+B,CAAC,8BAA8B,CAAC,CAAC,EAC1F,sBAAsB,CAAC,cAAc,CAAC,CACjB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export * from "./constants";
2
- export * from "./handler";
3
- export * from "./instantiate-resource";
4
- export * from "./resource";
5
- export * from "./types";
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 "@ldsg/handler";
2
- import { InstantiateResource } from "@ldsg/resource";
3
- import { ObjectResource } from "./resource";
4
- import { ObjectSpecificResourceSettings } from "./types";
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
@@ -6,7 +6,7 @@ const instantiateResource = (params) => {
6
6
  const { resourceConstructorParams } = params;
7
7
  const resource = new resource_1.ObjectResource(resourceConstructorParams);
8
8
  const res = {
9
- resource,
9
+ resource
10
10
  };
11
11
  return res;
12
12
  };
@@ -1,7 +1,7 @@
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";
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
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EACL,SAAS,EAET,8BAA8B,EAC/B,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,UAAW,SAAQ,uBAAuB;IACzD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,aAAa,EAAE,SAAS,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,KAAK,aAAa,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,KAAK,gBAAgB,CAAC;AAEpE,qBAAa,cAAe,SAAQ,QAAQ,CAAC,8BAA8B,CAAC;IAC1E,aAAa,EAAE,aAAa,CAmC1B;CACH"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,SAAS,EAAgB,8BAA8B,EAAE,MAAM,SAAS,CAAC;AAElF,MAAM,WAAW,UAAW,SAAQ,uBAAuB;IACzD;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,aAAa,EAAE,SAAS,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,KAAK,aAAa,GAAG,CAAC,MAAM,CAAC,EAAE,eAAe,KAAK,gBAAgB,CAAC;AAEpE,qBAAa,cAAe,SAAQ,QAAQ,CAAC,8BAA8B,CAAC;IAC1E,aAAa,EAAE,aAAa,CAiC1B;CACH"}
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, "fieldInfo");
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 "@ldsg/field-type";
2
- import { GeneralResourceSettings } from "@ldsg/types";
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
@@ -1,3 +1,3 @@
1
- export * from "./get-field-info";
2
- export * from "./specific-resource-settings";
1
+ export * from './get-field-info';
2
+ export * from './specific-resource-settings';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { SpecificResourceSettings } from "@ldsg/types";
1
+ import { SpecificResourceSettings } from '@ldsg/types';
2
2
  export interface ObjectSpecificResourceSettings extends SpecificResourceSettings {
3
3
  /**
4
4
  * Object Name
@@ -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,8BACf,SAAQ,wBAAwB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
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,8BAA+B,SAAQ,wBAAwB;IAC9E;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
package/package.json CHANGED
@@ -1,31 +1,39 @@
1
1
  {
2
2
  "name": "@ldsg/object",
3
- "version": "0.3.9",
3
+ "version": "0.3.17",
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/handler": "0.3.9",
19
- "@ldsg/resource": "0.3.9",
20
- "@ldsg/resource-definition": "0.3.9"
15
+ "@ldsg/handler": "0.3.17",
16
+ "@ldsg/constants": "0.3.17",
17
+ "@ldsg/resource": "0.3.17",
18
+ "@ldsg/resource-definition": "0.3.17"
21
19
  },
22
20
  "devDependencies": {
21
+ "@types/jest": "^29.5.2",
23
22
  "@types/lodash": "^4.14.202",
24
- "@ldsg/types": "0.3.9",
25
- "@ldsg/field-type": "0.3.9"
23
+ "jest": "^29.5.0",
24
+ "supertest": "^6.3.4",
25
+ "ts-jest": "^29.1.5",
26
+ "ts-node": "^10.9.2",
27
+ "typescript": "^5.8.3",
28
+ "@ldsg/types": "0.3.17",
29
+ "@ldsg/field-type": "0.3.17"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
26
33
  },
27
34
  "scripts": {
28
35
  "build": "tsc --project tsconfig.build.json",
29
- "clean": "rm -rf dist"
36
+ "clean": "rm -rf dist",
37
+ "test": "jest"
30
38
  }
31
39
  }