@ldsg/object-field 0.3.32 → 0.3.34

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.
@@ -13,7 +13,7 @@ test("object field", () => {
13
13
  settings: {
14
14
  title: "测试字段",
15
15
  description: "",
16
- name: "test",
16
+ slug: "test",
17
17
  fieldTypeResourceId: field_type_1.stringFieldTypeResourceRecord.id,
18
18
  properties: {
19
19
  max: "10",
@@ -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,CAkDxB;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;AAE1C,OAAO,EAAE,mCAAmC,EAAE,MAAM,SAAS,CAAC;AAE9D,qBAAa,mBAAoB,SAAQ,QAAQ,CAAC,mCAAmC,CAAC;IACpF,YAAY,EAAE,YAAY,CAuDxB;CACH"}
package/dist/resource.js CHANGED
@@ -1,13 +1,19 @@
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.ObjectFieldResource = void 0;
4
7
  const field_type_1 = require("@ldsg/field-type");
5
8
  const resource_1 = require("@ldsg/resource");
9
+ const lodash_1 = __importDefault(require("lodash"));
6
10
  class ObjectFieldResource extends resource_1.Resource {
7
11
  constructor() {
8
12
  super(...arguments);
9
13
  this.getFieldInfo = (params) => {
10
- const { id, settings: { title, description, name, properties }, getResourcesFromSettings, getFilteredResources, } = this;
14
+ const { id, settings: { title, description, slug, properties }, getResourcesFromSettings, getFilteredResources, } = this;
15
+ const name = lodash_1.default.camelCase(slug);
16
+ const resolvedDbKey = lodash_1.default.snakeCase(slug);
11
17
  const { fieldTypeResource } = getResourcesFromSettings();
12
18
  const { fieldTypeInfo } = fieldTypeResource.getFieldTypeInfo({
13
19
  ...params,
@@ -18,6 +24,7 @@ class ObjectFieldResource extends resource_1.Resource {
18
24
  title,
19
25
  description,
20
26
  name,
27
+ dbKey: resolvedDbKey,
21
28
  typeInfo: fieldTypeInfo,
22
29
  };
23
30
  const commonType = fieldTypeInfo.platformToTypeMap[field_type_1.FieldTypeBasePlatform.COMMON];
@@ -1,11 +1,11 @@
1
1
  import { z } from "zod";
2
2
  export declare const ObjectFieldSpecificResourceSettingsSchema: z.ZodObject<{
3
- name: z.ZodString;
3
+ slug: z.ZodString;
4
4
  fieldTypeResourceId: z.ZodString;
5
5
  properties: z.ZodAny;
6
6
  }, z.core.$catchall<z.ZodAny>>;
7
7
  export declare const SpecificResourceSettingsSchema: z.ZodObject<{
8
- name: z.ZodString;
8
+ slug: z.ZodString;
9
9
  fieldTypeResourceId: z.ZodString;
10
10
  properties: z.ZodAny;
11
11
  }, z.core.$catchall<z.ZodAny>>;
@@ -1 +1 @@
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,CACvD,OAAO,yCAAyC,CACjD,CAAC"}
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;;;;8BAkBlC,CAAC;AAErB,eAAO,MAAM,8BAA8B;;;;8BAA4C,CAAC;AACxF,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,yCAAyC,CACjD,CAAC"}
@@ -5,9 +5,10 @@ const zod_1 = require("zod");
5
5
  exports.ObjectFieldSpecificResourceSettingsSchema = zod_1.z
6
6
  .object({
7
7
  /**
8
- * Field Name
8
+ * Stable identifier (kebab-case, e.g. "user-id")
9
+ * Primary source for deriving name and dbKey.
9
10
  */
10
- name: zod_1.z.string(),
11
+ slug: zod_1.z.string(),
11
12
  /**
12
13
  * Field Type Resource ID
13
14
  */
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
1
  {
2
2
  "name": "@ldsg/object-field",
3
- "version": "0.3.32",
3
+ "version": "0.3.34",
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.32",
16
- "@ldsg/field-type": "0.3.32",
17
- "@ldsg/resource-definition": "0.3.32",
18
- "@ldsg/resource": "0.3.32"
19
+ "@ldsg/handler": "0.3.34",
20
+ "@ldsg/resource": "0.3.34",
21
+ "@ldsg/resource-definition": "0.3.34",
22
+ "@ldsg/field-type": "0.3.34"
19
23
  },
20
24
  "devDependencies": {
21
25
  "@types/jest": "^29.5.2",
26
+ "@types/lodash": "^4.14.202",
22
27
  "jest": "^29.5.0",
23
- "oxfmt": "latest",
24
- "oxlint": "latest",
25
28
  "supertest": "^6.3.4",
26
29
  "ts-jest": "^29.1.5",
27
30
  "ts-node": "^10.9.2",
28
31
  "typescript": "^5.8.3",
29
- "@ldsg/object": "0.3.32",
30
- "@ldsg/types": "0.3.32"
31
- },
32
- "publishConfig": {
33
- "access": "public"
32
+ "@ldsg/object": "0.3.34",
33
+ "@ldsg/types": "0.3.34"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsc --project tsconfig.build.json",