@ronin/compiler 0.14.5-leo-ron-1099-1-experimental-330 → 0.14.5
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 +2 -16
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -57,21 +57,7 @@ type QueryTypeEnum = 'get' | 'set' | 'add' | 'remove' | 'count';
|
|
57
57
|
type ModelQueryTypeEnum = 'create' | 'alter' | 'drop';
|
58
58
|
type ModelEntityEnum = 'field' | 'index' | 'trigger' | 'preset';
|
59
59
|
type FieldValue = string | number | boolean | null | unknown;
|
60
|
-
type FieldSelector = Record<string, FieldValue
|
61
|
-
type StoredObject = {
|
62
|
-
key: string;
|
63
|
-
src: string;
|
64
|
-
name: string | null;
|
65
|
-
placeholder: {
|
66
|
-
base64: string | null;
|
67
|
-
} | null;
|
68
|
-
meta: {
|
69
|
-
size: number;
|
70
|
-
type: string;
|
71
|
-
width?: number;
|
72
|
-
height?: number;
|
73
|
-
};
|
74
|
-
};
|
60
|
+
type FieldSelector = Record<string, FieldValue>;
|
75
61
|
type Expression = {
|
76
62
|
[QUERY_SYMBOLS.EXPRESSION]: string;
|
77
63
|
};
|
@@ -408,4 +394,4 @@ declare class Transaction {
|
|
408
394
|
|
409
395
|
declare const CLEAN_ROOT_MODEL: PublicModel;
|
410
396
|
|
411
|
-
export { type AddInstructions, type AddQuery, type AddInstructions as AddQueryInstructions, type AlterQuery, type CombinedInstructions, type CountInstructions, type CountQuery, type CountInstructions as CountQueryInstructions, type CreateQuery, type DropQuery, type GetInstructions, type GetQuery, type GetInstructions as GetQueryInstructions, type PublicModel as Model, type ModelField, type ModelIndex, type ModelPreset, type ModelTrigger, QUERY_SYMBOLS, type Query, type QueryInstructionType as QueryInstruction, type QuerySchemaType, type QueryType, CLEAN_ROOT_MODEL as ROOT_MODEL, type RemoveInstructions, type RemoveQuery, type RemoveInstructions as RemoveQueryInstructions, type Result, RoninError, type SetInstructions, type SetQuery, type SetInstructions as SetQueryInstructions, type Statement,
|
397
|
+
export { type AddInstructions, type AddQuery, type AddInstructions as AddQueryInstructions, type AlterQuery, type CombinedInstructions, type CountInstructions, type CountQuery, type CountInstructions as CountQueryInstructions, type CreateQuery, type DropQuery, type GetInstructions, type GetQuery, type GetInstructions as GetQueryInstructions, type PublicModel as Model, type ModelField, type ModelIndex, type ModelPreset, type ModelTrigger, QUERY_SYMBOLS, type Query, type QueryInstructionType as QueryInstruction, type QuerySchemaType, type QueryType, CLEAN_ROOT_MODEL as ROOT_MODEL, type RemoveInstructions, type RemoveQuery, type RemoveInstructions as RemoveQueryInstructions, type Result, RoninError, type SetInstructions, type SetQuery, type SetInstructions as SetQueryInstructions, type Statement, Transaction, type WithInstruction, getQuerySymbol };
|
package/dist/index.js
CHANGED
@@ -882,7 +882,7 @@ var composeConditions = (models, model, statementParams, instructionName, value,
|
|
882
882
|
instructionName
|
883
883
|
});
|
884
884
|
const { field: modelField } = fieldDetails || {};
|
885
|
-
const consumeJSON =
|
885
|
+
const consumeJSON = modelField?.type === "json" && instructionName === "to";
|
886
886
|
if (modelField && !(isObject(value) || Array.isArray(value)) || getQuerySymbol(value) || consumeJSON) {
|
887
887
|
return composeFieldValues(
|
888
888
|
models,
|
@@ -1389,7 +1389,7 @@ var composeAssociationModelSlug = (model, field) => convertToCamelCase(`ronin_li
|
|
1389
1389
|
var getFieldSelector = (model, field, fieldPath, writing) => {
|
1390
1390
|
const symbol = model.tableAlias?.startsWith(QUERY_SYMBOLS.FIELD_PARENT) ? `${model.tableAlias.replace(QUERY_SYMBOLS.FIELD_PARENT, "").slice(0, -1)}.` : "";
|
1391
1391
|
const tablePrefix = symbol || (model.tableAlias ? `"${model.tableAlias}".` : "");
|
1392
|
-
if (
|
1392
|
+
if (field.type === "json" && !writing) {
|
1393
1393
|
const dotParts = fieldPath.split(".");
|
1394
1394
|
const columnName = tablePrefix + dotParts.shift();
|
1395
1395
|
if (dotParts.length > 0) {
|
@@ -1407,7 +1407,7 @@ function getFieldFromModel(model, fieldPath, source, shouldThrow = true) {
|
|
1407
1407
|
let modelField;
|
1408
1408
|
if (fieldPath.includes(".")) {
|
1409
1409
|
modelField = modelFields.find((field) => field.slug === fieldPath.split(".")[0]);
|
1410
|
-
if (modelField?.type === "json"
|
1410
|
+
if (modelField?.type === "json") {
|
1411
1411
|
const fieldSelector2 = getFieldSelector(model, modelField, fieldPath, writingField);
|
1412
1412
|
return { field: modelField, fieldSelector: fieldSelector2 };
|
1413
1413
|
}
|
@@ -2009,7 +2009,7 @@ var Transaction = class {
|
|
2009
2009
|
const record = fields.reduce((acc, field, fieldIndex) => {
|
2010
2010
|
let newSlug = field.mountingPath;
|
2011
2011
|
let newValue = row[fieldIndex];
|
2012
|
-
if (field.type === "json"
|
2012
|
+
if (field.type === "json") {
|
2013
2013
|
newValue = JSON.parse(newValue);
|
2014
2014
|
} else if (field.type === "boolean") {
|
2015
2015
|
newValue = Boolean(newValue);
|