adminforth 1.3.43 → 1.3.45

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.
@@ -125,6 +125,12 @@ export default class AdminForthBaseConnector implements IAdminForthDataSourceCon
125
125
 
126
126
  for (const field of Object.keys(newValues)) {
127
127
  const col = resource.dataSourceColumns.find((col) => col.name == field);
128
+ if (!col) {
129
+ const similar = suggestIfTypo(resource.dataSourceColumns.map((col) => col.name), field);
130
+ throw new Error(`
131
+ Update record received field '${field}' (with value ${newValues[field]}), but such column not found in resource '${resource.resourceId}'. ${similar ? `Did you mean '${similar}'?` : ''}
132
+ `);
133
+ }
128
134
  recordWithOriginalValues[col.name] = this.setFieldValue(col, newValues[col.name]);
129
135
  }
130
136
 
@@ -110,6 +110,12 @@ export default class AdminForthBaseConnector {
110
110
  const recordWithOriginalValues = Object.assign({}, newValues);
111
111
  for (const field of Object.keys(newValues)) {
112
112
  const col = resource.dataSourceColumns.find((col) => col.name == field);
113
+ if (!col) {
114
+ const similar = suggestIfTypo(resource.dataSourceColumns.map((col) => col.name), field);
115
+ throw new Error(`
116
+ Update record received field '${field}' (with value ${newValues[field]}), but such column not found in resource '${resource.resourceId}'. ${similar ? `Did you mean '${similar}'?` : ''}
117
+ `);
118
+ }
113
119
  recordWithOriginalValues[col.name] = this.setFieldValue(col, newValues[col.name]);
114
120
  }
115
121
  process.env.HEAVY_DEBUG && console.log(`🪲✏️ updating record id:${recordId}, values: ${JSON.stringify(recordWithOriginalValues)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.3.43",
3
+ "version": "1.3.45",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",