@ronin/compiler 0.7.0 → 0.7.1
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.js +14 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1127,16 +1127,25 @@ var handleSelecting = (model, statementParams, instructions) => {
|
|
1127
1127
|
return getFieldFromModel(model, slug, "selecting").fieldSelector;
|
1128
1128
|
}).join(", ") : "*";
|
1129
1129
|
if (instructions.including) {
|
1130
|
-
const filteredObject = Object.entries(instructions.including).
|
1130
|
+
const filteredObject = Object.entries(instructions.including).map(([key, value]) => {
|
1131
1131
|
const symbol = getSymbol(value);
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1132
|
+
if (symbol) {
|
1133
|
+
if (symbol.type === "query") {
|
1134
|
+
isJoining = true;
|
1135
|
+
return null;
|
1136
|
+
}
|
1137
|
+
if (symbol.type === "expression") {
|
1138
|
+
value = parseFieldExpression(model, "including", symbol.value);
|
1139
|
+
}
|
1140
|
+
}
|
1141
|
+
return [key, value];
|
1142
|
+
}).filter((entry) => entry !== null);
|
1136
1143
|
const newObjectEntries = Object.entries(flatten(Object.fromEntries(filteredObject)));
|
1137
1144
|
if (newObjectEntries.length > 0) {
|
1138
1145
|
statement += ", ";
|
1139
1146
|
statement += newObjectEntries.map(([key, value]) => {
|
1147
|
+
if (typeof value === "string" && value.startsWith('"'))
|
1148
|
+
return `(${value}) as "${key}"`;
|
1140
1149
|
return `${prepareStatementValue(statementParams, value)} as "${key}"`;
|
1141
1150
|
}).join(", ");
|
1142
1151
|
}
|