@ronin/compiler 0.18.2-triggers-experimental-440 → 0.18.3-invalid-json-experimental-441
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/dist/index.d.ts +1 -1
- package/dist/index.js +11 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -392,7 +392,7 @@ type ExpandedResult<T = ResultRecord> = {
|
|
392
392
|
};
|
393
393
|
type Result<T = ResultRecord> = RegularResult<T> | ExpandedResult<T>;
|
394
394
|
|
395
|
-
type RoninErrorCode = 'MODEL_NOT_FOUND' | 'FIELD_NOT_FOUND' | 'INDEX_NOT_FOUND' | 'TRIGGER_NOT_FOUND' | 'PRESET_NOT_FOUND' | 'INVALID_WITH_VALUE' | 'INVALID_TO_VALUE' | 'INVALID_INCLUDING_VALUE' | 'INVALID_FOR_VALUE' | 'INVALID_BEFORE_OR_AFTER_INSTRUCTION' | 'INVALID_MODEL_VALUE' | 'EXISTING_MODEL_ENTITY' | 'REQUIRED_MODEL_ENTITY' | 'MUTUALLY_EXCLUSIVE_INSTRUCTIONS' | 'MISSING_INSTRUCTION' | 'MISSING_FIELD';
|
395
|
+
type RoninErrorCode = 'MODEL_NOT_FOUND' | 'FIELD_NOT_FOUND' | 'INDEX_NOT_FOUND' | 'TRIGGER_NOT_FOUND' | 'PRESET_NOT_FOUND' | 'INVALID_WITH_VALUE' | 'INVALID_TO_VALUE' | 'INVALID_INCLUDING_VALUE' | 'INVALID_FOR_VALUE' | 'INVALID_BEFORE_OR_AFTER_INSTRUCTION' | 'INVALID_MODEL_VALUE' | 'INVALID_FIELD_VALUE' | 'EXISTING_MODEL_ENTITY' | 'REQUIRED_MODEL_ENTITY' | 'MUTUALLY_EXCLUSIVE_INSTRUCTIONS' | 'MISSING_INSTRUCTION' | 'MISSING_FIELD';
|
396
396
|
interface Issue {
|
397
397
|
message: string;
|
398
398
|
path: Array<string | number>;
|
package/dist/index.js
CHANGED
@@ -1371,8 +1371,17 @@ var composeConditions = (models, model, statementParams, instructionName, value,
|
|
1371
1371
|
instructionName
|
1372
1372
|
});
|
1373
1373
|
const { field: modelField } = fieldDetails || {};
|
1374
|
-
const
|
1375
|
-
|
1374
|
+
const fieldIsJSON = (modelField?.type === "json" || modelField?.type === "blob") && instructionName === "to";
|
1375
|
+
const valueIsJSON = isObject(value) || (modelField?.type === "blob" ? null : Array.isArray(value));
|
1376
|
+
if (!valueIsJSON || getQuerySymbol(value) || fieldIsJSON) {
|
1377
|
+
if (modelField && fieldIsJSON && !valueIsJSON) {
|
1378
|
+
const message = modelField.type === "json" ? "The provided field value is not valid JSON. Only objects and arrays should be provided. Other types of values should be stored in their respective primitive field types." : "The provided field value is not a valid Blob reference.";
|
1379
|
+
throw new RoninError({
|
1380
|
+
message,
|
1381
|
+
field: modelField?.slug,
|
1382
|
+
code: "INVALID_FIELD_VALUE"
|
1383
|
+
});
|
1384
|
+
}
|
1376
1385
|
return composeFieldValues(
|
1377
1386
|
models,
|
1378
1387
|
model,
|