node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import Field from './field.mjs';
class JSONField extends Field {
toDB(value) {
if (value == null) {
return null;
}
if (typeof value === 'object') {
return JSON.stringify(value);
}
return value;
}
fromDB(value) {
try {
if (typeof value === 'string') {
const parsedValue = JSON.parse(value);
/**
* On Strapi 5 until 5.0.0-rc.7, the values were accidentally stringified twice when saved,
* so in those cases we need to parse them twice to retrieve the actual value.
*/ if (typeof parsedValue === 'string') {
return JSON.parse(parsedValue);
}
return parsedValue;
}
} catch (error) {
// Just return the value if it's not a valid JSON string
return value;
}
return value;
}
}
export { JSONField as default };
//# sourceMappingURL=json.mjs.map