sasat 0.18.4 → 0.18.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/lib/runtime/field.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ const notTypeName = (fieldName) => fieldName !== '__typename';
|
|
|
7
7
|
export const createQuery = (baseTableName, fields, options, tableInfo, relationMap, context) => {
|
|
8
8
|
let tableCount = 0;
|
|
9
9
|
const select = [];
|
|
10
|
-
const where = [options?.where];
|
|
11
10
|
const resolveFields = (tableName, table) => {
|
|
12
11
|
const tableAlias = table.tableAlias || 't' + tableCount;
|
|
13
12
|
table.tableAlias = tableAlias;
|
|
@@ -20,11 +19,10 @@ export const createQuery = (baseTableName, fields, options, tableInfo, relationM
|
|
|
20
19
|
const realName = info.columnMap[it] || it;
|
|
21
20
|
return QExpr.field(tableAlias, realName, tableAlias + SELECT_ALIAS_SEPARATOR + it);
|
|
22
21
|
}));
|
|
23
|
-
where.push(table.where);
|
|
24
22
|
return QExpr.table(tableName, Object.entries(table.relations || {}).map(([relationName, table]) => {
|
|
25
23
|
const current = tableCount;
|
|
26
24
|
const rel = relationMap[tableName][relationName];
|
|
27
|
-
return QExpr.join(resolveFields(rel.table, table), rel.on(tableAlias, table.tableAlias || 't' + current, context), 'LEFT');
|
|
25
|
+
return QExpr.join(resolveFields(rel.table, table), QExpr.conditions.and(rel.on(tableAlias, table.tableAlias || 't' + current, context), table.joinOn), 'LEFT');
|
|
28
26
|
}), tableAlias);
|
|
29
27
|
};
|
|
30
28
|
const from = resolveFields(baseTableName, fields);
|
|
@@ -32,7 +30,6 @@ export const createQuery = (baseTableName, fields, options, tableInfo, relationM
|
|
|
32
30
|
select,
|
|
33
31
|
from,
|
|
34
32
|
...options,
|
|
35
|
-
where: where.filter(it => !it).length !== 0 ? QExpr.conditions.and(...where) : undefined,
|
|
36
33
|
};
|
|
37
34
|
};
|
|
38
35
|
export const createPagingInnerQuery = (tableName, tableAlias, fields, option, tableInfo) => {
|