sasat 0.18.3 → 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.
@@ -1,5 +1,7 @@
1
+ import type { BooleanValueExpression } from "./dsl/query/query.js";
1
2
  export declare type Fields<Entity, Relation = Record<string, unknown>> = {
2
3
  fields: Array<keyof Entity & string>;
3
4
  relations?: Relation;
4
5
  tableAlias?: string;
6
+ joinOn?: BooleanValueExpression;
5
7
  };
@@ -22,7 +22,7 @@ export const createQuery = (baseTableName, fields, options, tableInfo, relationM
22
22
  return QExpr.table(tableName, Object.entries(table.relations || {}).map(([relationName, table]) => {
23
23
  const current = tableCount;
24
24
  const rel = relationMap[tableName][relationName];
25
- 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');
26
26
  }), tableAlias);
27
27
  };
28
28
  const from = resolveFields(baseTableName, fields);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sasat",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
4
4
  "repository": "https://github.com/yanokunpei/sasat.git",
5
5
  "author": "yanokunpei <ninian138@gmail.com>",
6
6
  "license": "MIT",