adminforth 1.2.1 → 1.2.2
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/dataConnectors/postgres.ts +12 -0
- package/dist/dataConnectors/postgres.js +13 -0
- package/dist/index.js +12 -1001
- package/dist/modules/configValidator.js +408 -0
- package/dist/modules/restApi.js +625 -0
- package/index.ts +16 -1122
- package/modules/configValidator.ts +452 -0
- package/modules/restApi.ts +709 -0
- package/package.json +1 -1
- package/types/AdminForthConfig.ts +15 -0
|
@@ -151,6 +151,18 @@ class PostgresConnector extends AdminForthBaseConnector implements IAdminForthDa
|
|
|
151
151
|
return dayjs(value).toISOString().split('T')[0];
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
if (field.type == AdminForthDataTypes.JSON) {
|
|
155
|
+
if (typeof value == 'string') {
|
|
156
|
+
return JSON.parse(value);
|
|
157
|
+
} else if (typeof value == 'object') {
|
|
158
|
+
return value;
|
|
159
|
+
} else {
|
|
160
|
+
console.error('JSON field value is not string or object, but has type:', typeof value);
|
|
161
|
+
console.error('Field:', field);
|
|
162
|
+
return {}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
154
166
|
return value;
|
|
155
167
|
}
|
|
156
168
|
|
|
@@ -152,6 +152,19 @@ class PostgresConnector extends AdminForthBaseConnector {
|
|
|
152
152
|
}
|
|
153
153
|
return dayjs(value).toISOString().split('T')[0];
|
|
154
154
|
}
|
|
155
|
+
if (field.type == AdminForthDataTypes.JSON) {
|
|
156
|
+
if (typeof value == 'string') {
|
|
157
|
+
return JSON.parse(value);
|
|
158
|
+
}
|
|
159
|
+
else if (typeof value == 'object') {
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
console.error('JSON field value is not string or object, but has type:', typeof value);
|
|
164
|
+
console.error('Field:', field);
|
|
165
|
+
return {};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
155
168
|
return value;
|
|
156
169
|
}
|
|
157
170
|
getRecordByPrimaryKeyWithOriginalTypes(resource, key) {
|