@webtypen/webframez-core 0.2.38 → 0.2.40

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.
@@ -63,10 +63,11 @@ class DataBuilder {
63
63
  return __awaiter(this, void 0, void 0, function* () {
64
64
  const out = {};
65
65
  for (let key in fields) {
66
- if (fields[key].type === "object") {
67
- out[key] =
68
- typeof fields[key].schema === "object" && Object.keys(fields[key].schema).length > 0
69
- ? Object.assign({}, (yield this.getFieldsFrontend(fields[key].schema, payload))) : fields[key];
66
+ if (false && fields[key].type === "object") {
67
+ // out[key] =
68
+ // typeof fields[key].schema === "object" && Object.keys(fields[key].schema).length > 0
69
+ // ? { ...(await this.getFieldsFrontend(fields[key].schema, payload)) }
70
+ // : fields[key];
70
71
  }
71
72
  else {
72
73
  out[key] =
@@ -137,12 +138,17 @@ class DataBuilder {
137
138
  }
138
139
  }
139
140
  if (typeof fields[key].schema === "object") {
140
- if (value && value.length > 0) {
141
- for (let i in value) {
142
- const entryPath = fieldPath + "[" + i + "]";
143
- errors = yield this.validateFields(db, type, fields[key].schema, req.body.data, errors, entryPath);
141
+ if (fields[key].type === "array") {
142
+ if (value && value.length > 0) {
143
+ for (let i in value) {
144
+ const entryPath = fieldPath + "[" + i + "]";
145
+ errors = yield this.validateFields(db, type, fields[key].schema, req, errors, entryPath);
146
+ }
144
147
  }
145
148
  }
149
+ else if (fields[key].type === "object") {
150
+ errors = yield this.validateFields(db, type, fields[key].schema, req, errors, fieldPath);
151
+ }
146
152
  }
147
153
  if (fields[key].validation && fields[key].validation.trim() !== "") {
148
154
  // @ToDo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webtypen/webframez-core",
3
- "version": "0.2.38",
3
+ "version": "0.2.40",
4
4
  "description": "The core package of the typescript based webframez (web-framework) by webtypen.de",
5
5
  "homepage": "https://webtypen.de/",
6
6
  "license": "MIT",
@@ -95,11 +95,11 @@ export class DataBuilder {
95
95
  async getFieldsFrontend(fields: any, payload?: any) {
96
96
  const out: any = {};
97
97
  for (let key in fields) {
98
- if (fields[key].type === "object") {
99
- out[key] =
100
- typeof fields[key].schema === "object" && Object.keys(fields[key].schema).length > 0
101
- ? { ...(await this.getFieldsFrontend(fields[key].schema, payload)) }
102
- : fields[key];
98
+ if (false && fields[key].type === "object") {
99
+ // out[key] =
100
+ // typeof fields[key].schema === "object" && Object.keys(fields[key].schema).length > 0
101
+ // ? { ...(await this.getFieldsFrontend(fields[key].schema, payload)) }
102
+ // : fields[key];
103
103
  } else {
104
104
  out[key] =
105
105
  typeof fields[key].schema === "object" && Object.keys(fields[key].schema).length > 0
@@ -183,11 +183,15 @@ export class DataBuilder {
183
183
  }
184
184
 
185
185
  if (typeof fields[key].schema === "object") {
186
- if (value && value.length > 0) {
187
- for (let i in value) {
188
- const entryPath = fieldPath + "[" + i + "]";
189
- errors = await this.validateFields(db, type, fields[key].schema, req.body.data, errors, entryPath);
186
+ if (fields[key].type === "array") {
187
+ if (value && value.length > 0) {
188
+ for (let i in value) {
189
+ const entryPath = fieldPath + "[" + i + "]";
190
+ errors = await this.validateFields(db, type, fields[key].schema, req, errors, entryPath);
191
+ }
190
192
  }
193
+ } else if (fields[key].type === "object") {
194
+ errors = await this.validateFields(db, type, fields[key].schema, req, errors, fieldPath);
191
195
  }
192
196
  }
193
197