@ldsg/object-field 0.3.24 → 0.3.26

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014-present Sebastian McKenzie and other contributors
3
+ Copyright (c) 2014-present Wanxger and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
@@ -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,CA2BxB;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,CAkDxB;CACH"}
package/dist/resource.js CHANGED
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ObjectFieldResource = void 0;
4
+ const field_type_1 = require("@ldsg/field-type");
4
5
  const resource_1 = require("@ldsg/resource");
5
6
  class ObjectFieldResource extends resource_1.Resource {
6
7
  constructor() {
7
8
  super(...arguments);
8
9
  this.getFieldInfo = (params) => {
9
- const { id, settings: { title, description, name, properties }, getResourcesFromSettings } = this;
10
+ const { id, settings: { title, description, name, properties }, getResourcesFromSettings, getFilteredResources } = this;
10
11
  const { fieldTypeResource } = getResourcesFromSettings();
11
12
  const { fieldTypeInfo } = fieldTypeResource.getFieldTypeInfo({
12
13
  ...params,
@@ -19,6 +20,23 @@ class ObjectFieldResource extends resource_1.Resource {
19
20
  name,
20
21
  typeInfo: fieldTypeInfo
21
22
  };
23
+ const commonType = fieldTypeInfo.platformToTypeMap[field_type_1.FieldTypeBasePlatform.COMMON];
24
+ if ((commonType === null || commonType === void 0 ? void 0 : commonType.type) === 'object' || (commonType === null || commonType === void 0 ? void 0 : commonType.type) === 'array') {
25
+ const { resources } = getFilteredResources({
26
+ parentId: this.id
27
+ });
28
+ if (resources.length > 0) {
29
+ const nestedFieldInfoList = [];
30
+ resources.forEach((resource) => {
31
+ var _a;
32
+ const fieldInfoRes = (_a = resource.getFieldInfo) === null || _a === void 0 ? void 0 : _a.call(resource, params);
33
+ if (fieldInfoRes) {
34
+ nestedFieldInfoList.push(fieldInfoRes.fieldInfo);
35
+ }
36
+ });
37
+ fieldInfo.fieldInfoList = nestedFieldInfoList;
38
+ }
39
+ }
22
40
  const res = {
23
41
  fieldInfo
24
42
  };
@@ -1,16 +1,13 @@
1
- import { SpecificResourceSettings } from '@ldsg/types';
2
- export interface ObjectFieldSpecificResourceSettings extends SpecificResourceSettings {
3
- /**
4
- * Field Name
5
- */
6
- name: string;
7
- /**
8
- * Field Type Resource ID
9
- */
10
- fieldTypeResourceId: string;
11
- /**
12
- * Field Properties
13
- */
14
- properties: any;
15
- }
1
+ import { z } from 'zod';
2
+ export declare const ObjectFieldSpecificResourceSettingsSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ fieldTypeResourceId: z.ZodString;
5
+ properties: z.ZodAny;
6
+ }, z.core.$catchall<z.ZodAny>>;
7
+ export declare const SpecificResourceSettingsSchema: z.ZodObject<{
8
+ name: z.ZodString;
9
+ fieldTypeResourceId: z.ZodString;
10
+ properties: z.ZodAny;
11
+ }, z.core.$catchall<z.ZodAny>>;
12
+ export type ObjectFieldSpecificResourceSettings = z.infer<typeof ObjectFieldSpecificResourceSettingsSchema>;
16
13
  //# sourceMappingURL=specific-resource-settings.d.ts.map
@@ -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,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"}
1
+ {"version":3,"file":"specific-resource-settings.d.ts","sourceRoot":"","sources":["../../src/types/specific-resource-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,yCAAyC;;;;8BAiBlC,CAAC;AAErB,eAAO,MAAM,8BAA8B;;;;8BAA4C,CAAC;AACxF,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC"}
@@ -1,2 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SpecificResourceSettingsSchema = exports.ObjectFieldSpecificResourceSettingsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.ObjectFieldSpecificResourceSettingsSchema = zod_1.z
6
+ .object({
7
+ /**
8
+ * Field Name
9
+ */
10
+ name: zod_1.z.string(),
11
+ /**
12
+ * Field Type Resource ID
13
+ */
14
+ fieldTypeResourceId: zod_1.z.string(),
15
+ /**
16
+ * Field Properties
17
+ */
18
+ properties: zod_1.z.any()
19
+ })
20
+ .catchall(zod_1.z.any());
21
+ exports.SpecificResourceSettingsSchema = exports.ObjectFieldSpecificResourceSettingsSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ldsg/object-field",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -11,9 +11,11 @@
11
11
  "dist/"
12
12
  ],
13
13
  "dependencies": {
14
- "@ldsg/resource-definition": "0.3.24",
15
- "@ldsg/resource": "0.3.24",
16
- "@ldsg/handler": "0.3.24"
14
+ "zod": "^4.1.11",
15
+ "@ldsg/resource": "0.3.26",
16
+ "@ldsg/handler": "0.3.26",
17
+ "@ldsg/resource-definition": "0.3.26",
18
+ "@ldsg/field-type": "0.3.26"
17
19
  },
18
20
  "devDependencies": {
19
21
  "@types/jest": "^29.5.2",
@@ -22,9 +24,8 @@
22
24
  "ts-jest": "^29.1.5",
23
25
  "ts-node": "^10.9.2",
24
26
  "typescript": "^5.8.3",
25
- "@ldsg/field-type": "0.3.24",
26
- "@ldsg/object": "0.3.24",
27
- "@ldsg/types": "0.3.24"
27
+ "@ldsg/object": "0.3.26",
28
+ "@ldsg/types": "0.3.26"
28
29
  },
29
30
  "publishConfig": {
30
31
  "access": "public"