@ldsg/object-field 0.3.8 → 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.
@@ -3,45 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const field_type_1 = require("@ldsg/field-type");
4
4
  const handler_1 = require("@ldsg/handler");
5
5
  const resource_1 = require("../resource");
6
- const handler = (params) => {
7
- const { fieldProperties, platform } = params;
8
- const { max } = fieldProperties;
9
- let res;
10
- switch (platform) {
11
- case "mongoose": {
12
- res = {
13
- type: "String",
14
- ...(max
15
- ? {
16
- maxLength: max,
17
- }
18
- : {}),
19
- };
20
- break;
21
- }
22
- default: {
23
- res = {};
24
- break;
25
- }
26
- }
27
- return res;
28
- };
29
- test("object field", () => {
6
+ test('object field', () => {
30
7
  new handler_1.HandlerResource(field_type_1.stringFieldTypeHandlerResourceRecord);
31
8
  new field_type_1.FieldTypeResource(field_type_1.stringFieldTypeResourceRecord);
32
9
  const objectFieldResource = new resource_1.ObjectFieldResource({
33
- id: "object-field",
34
- kind: "object_field",
35
- parentId: "application",
10
+ id: 'object-field',
11
+ kind: 'object_field',
12
+ parentId: 'application',
36
13
  settings: {
37
- title: "测试字段",
38
- description: "",
39
- name: "test",
14
+ title: '测试字段',
15
+ description: '',
16
+ name: 'test',
40
17
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
41
18
  properties: {
42
- max: "10",
43
- },
44
- },
19
+ max: '10'
20
+ }
21
+ }
45
22
  });
46
23
  const getFieldInfoRes = objectFieldResource.getFieldInfo();
47
24
  expect(getFieldInfoRes).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":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAEhE,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,uBACpB,CAAC;AAEzC,eAAO,MAAM,8CAA8C,EAAE,0CAI1D,CAAC"}
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"}
package/dist/constants.js CHANGED
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  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 object_1 = require("@ldsg/object");
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,12 +18,14 @@ exports.INSTANTIATE_RESOURCE_HANDLER_SPECIFIC_RESOURCE_SETTINGS = {
19
18
  code: `export * from "@ldsg/object-field";`,
20
19
  dependencies: [
21
20
  {
22
- name: "@ldsg/object-field",
23
- },
24
- ],
21
+ name: '@ldsg/object-field'
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: "object_field",
29
- parentKind: object_1.RESOURCE_DEFINITION_SPECIFIC_RESOURCE_SETTINGS.kind,
30
+ kind: 'object_field'
30
31
  };
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 { ObjectFieldResource } from "./resource";
4
- import { ObjectFieldSpecificResourceSettings } from "./types";
5
- export declare const handler: Handler<[
6
- InstantiateResourceParams<HandlerExtendedResourceSettings<ObjectFieldSpecificResourceSettings>>
7
- ], InstantiateResourceRes<ObjectFieldResource>>;
1
+ import { Handler, HandlerExtendedResourceSettings } from '@ldsg/handler';
2
+ import { InstantiateResourceParams, InstantiateResourceRes } from '@ldsg/resource';
3
+ import { ObjectFieldResource } from './resource';
4
+ import { ObjectFieldSpecificResourceSettings } from './types';
5
+ export declare const handler: Handler<InstantiateResourceParams<HandlerExtendedResourceSettings<ObjectFieldSpecificResourceSettings>>, InstantiateResourceRes<ObjectFieldResource>>;
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,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAE9D,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B;IACE,yBAAyB,CACvB,+BAA+B,CAAC,mCAAmC,CAAC,CACrE;CACF,EACD,sBAAsB,CAAC,mBAAmB,CAAC,CACtB,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,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAE9D,eAAO,MAAM,OAAO,EAAE,OAAO,CAC3B,yBAAyB,CAAC,+BAA+B,CAAC,mCAAmC,CAAC,CAAC,EAC/F,sBAAsB,CAAC,mBAAmB,CAAC,CACtB,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 { ObjectFieldResource } from "./resource";
4
- import { ObjectFieldSpecificResourceSettings } from "./types";
1
+ import { HandlerExtendedResourceSettings } from '@ldsg/handler';
2
+ import { InstantiateResource } from '@ldsg/resource';
3
+ import { ObjectFieldResource } from './resource';
4
+ import { ObjectFieldSpecificResourceSettings } from './types';
5
5
  export declare const instantiateResource: InstantiateResource<HandlerExtendedResourceSettings<ObjectFieldSpecificResourceSettings>, ObjectFieldResource>;
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.ObjectFieldResource(resourceConstructorParams);
8
8
  const res = {
9
- resource,
9
+ resource
10
10
  };
11
11
  return res;
12
12
  };
@@ -1,6 +1,6 @@
1
- import { GetFieldInfo } from "@ldsg/object";
2
- import { Resource } from "@ldsg/resource";
3
- import { ObjectFieldSpecificResourceSettings } from "./types";
1
+ import { GetFieldInfo } from '@ldsg/object';
2
+ import { Resource } from '@ldsg/resource';
3
+ import { ObjectFieldSpecificResourceSettings } from './types';
4
4
  export declare class ObjectFieldResource extends Resource<ObjectFieldSpecificResourceSettings> {
5
5
  getFieldInfo: GetFieldInfo;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,YAAY,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAE9D,qBAAa,mBAAoB,SAAQ,QAAQ,CAAC,mCAAmC,CAAC;IACpF,YAAY,EAAE,YAAY,CA6BxB;CACH"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,YAAY,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAE9D,qBAAa,mBAAoB,SAAQ,QAAQ,CAAC,mCAAmC,CAAC;IACpF,YAAY,EAAE,YAAY,CA2BxB;CACH"}
package/dist/resource.js CHANGED
@@ -6,21 +6,21 @@ class ObjectFieldResource extends resource_1.Resource {
6
6
  constructor() {
7
7
  super(...arguments);
8
8
  this.getFieldInfo = (params) => {
9
- const { id, settings: { title, description, name, properties }, getResourcesFromSettings, } = this;
9
+ const { id, settings: { title, description, name, properties }, getResourcesFromSettings } = this;
10
10
  const { fieldTypeResource } = getResourcesFromSettings();
11
11
  const { fieldTypeInfo } = fieldTypeResource.getFieldTypeInfo({
12
12
  ...params,
13
- fieldProperties: properties,
13
+ fieldProperties: properties
14
14
  });
15
15
  const fieldInfo = {
16
16
  id,
17
17
  title,
18
18
  description,
19
19
  name,
20
- typeInfo: fieldTypeInfo,
20
+ typeInfo: fieldTypeInfo
21
21
  };
22
22
  const res = {
23
- fieldInfo,
23
+ fieldInfo
24
24
  };
25
25
  return res;
26
26
  };
@@ -1,2 +1,2 @@
1
- export * from "./specific-resource-settings";
1
+ export * from './specific-resource-settings';
2
2
  //# 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 ObjectFieldSpecificResourceSettings extends SpecificResourceSettings {
3
3
  /**
4
4
  * Field 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,mCACf,SAAQ,wBAAwB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,UAAU,EAAE,GAAG,CAAC;CACjB"}
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,mCAAoC,SAAQ,wBAAwB;IACnF;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,UAAU,EAAE,GAAG,CAAC;CACjB"}
package/package.json CHANGED
@@ -1,27 +1,33 @@
1
1
  {
2
2
  "name": "@ldsg/object-field",
3
- "version": "0.3.8",
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
- "@ldsg/resource-definition": "0.3.8",
18
- "@ldsg/resource": "0.3.8",
19
- "@ldsg/handler": "0.3.8"
14
+ "@ldsg/handler": "0.3.10",
15
+ "@ldsg/resource": "0.3.10",
16
+ "@ldsg/resource-definition": "0.3.10"
20
17
  },
21
18
  "devDependencies": {
22
- "@ldsg/field-type": "0.3.8",
23
- "@ldsg/types": "0.3.8",
24
- "@ldsg/object": "0.3.8"
19
+ "@types/jest": "^29.5.2",
20
+ "jest": "^29.5.0",
21
+ "supertest": "^6.3.4",
22
+ "ts-jest": "^29.1.5",
23
+ "ts-node": "^10.9.2",
24
+ "typescript": "^5.8.3",
25
+ "@ldsg/field-type": "0.3.10",
26
+ "@ldsg/object": "0.3.10",
27
+ "@ldsg/types": "0.3.10"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
25
31
  },
26
32
  "scripts": {
27
33
  "build": "tsc --project tsconfig.build.json",