sasat 0.22.5 → 0.22.7
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.cjs +3 -2
- package/dist/index.d.cts +4 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -112,6 +112,7 @@ const Sql = {
|
|
|
112
112
|
case 8: return Sql.in(expr);
|
|
113
113
|
case 6: return Sql.isNull(expr);
|
|
114
114
|
case 14: return Sql.exists(expr);
|
|
115
|
+
case 15: return expr.expr;
|
|
115
116
|
}
|
|
116
117
|
},
|
|
117
118
|
exists: (expr) => {
|
|
@@ -146,7 +147,7 @@ const getLock = (lock) => {
|
|
|
146
147
|
};
|
|
147
148
|
const queryToSql = (query) => {
|
|
148
149
|
const select = query.select.map(Sql.select).join(", ");
|
|
149
|
-
const join = getJoin(query.from).map(Sql.join).join(" ");
|
|
150
|
+
const join = [...getJoin(query.from), ...query.join ?? []].map(Sql.join).join(" ");
|
|
150
151
|
const where = query.where ? " WHERE " + Sql.booleanValue(query.where) : "";
|
|
151
152
|
const groupBy = query.groupBy ? " GROUP BY" + query.groupBy.cols.map(Sql.value).join(",") : "";
|
|
152
153
|
const having = query.having ? "HAVING " + Sql.booleanValue(query.having) : "";
|
|
@@ -626,7 +627,7 @@ const createQuery = (baseTableName, fields, options, tableInfo, relationMap, con
|
|
|
626
627
|
parentTableAlias: tableAlias,
|
|
627
628
|
childTableAlias: table.tableAlias || "t" + current,
|
|
628
629
|
context
|
|
629
|
-
}), table.joinOn), "LEFT");
|
|
630
|
+
}), table.joinOn), table.joinType ?? "LEFT");
|
|
630
631
|
}).filter(require_util.nonNullable), tableAlias);
|
|
631
632
|
};
|
|
632
633
|
return {
|
package/dist/index.d.cts
CHANGED
|
@@ -53,6 +53,7 @@ type Query = {
|
|
|
53
53
|
limit?: number;
|
|
54
54
|
offset?: number;
|
|
55
55
|
lock?: LockMode;
|
|
56
|
+
join?: Join[];
|
|
56
57
|
};
|
|
57
58
|
type GroupByExpr = {
|
|
58
59
|
kind: QueryNodeKind.GroupBy;
|
|
@@ -128,7 +129,7 @@ type ExistsExpression = {
|
|
|
128
129
|
kind: QueryNodeKind.Exists;
|
|
129
130
|
query: Query | RawExpression;
|
|
130
131
|
};
|
|
131
|
-
type BooleanValueExpression = CompoundExpression | ComparisonExpression | IsNullExpression | ParenthesisExpression | InExpression | BetweenExpression | ContainsExpression | ExistsExpression;
|
|
132
|
+
type BooleanValueExpression = CompoundExpression | ComparisonExpression | IsNullExpression | ParenthesisExpression | InExpression | BetweenExpression | ContainsExpression | ExistsExpression | RawExpression;
|
|
132
133
|
type IsNullExpression = {
|
|
133
134
|
kind: QueryNodeKind.IsNullExpr;
|
|
134
135
|
expr: Value;
|
|
@@ -195,6 +196,7 @@ type Fields<Entity, Relation = Record<string, unknown>> = {
|
|
|
195
196
|
relations?: Relation;
|
|
196
197
|
tableAlias?: string;
|
|
197
198
|
joinOn?: BooleanValueExpression;
|
|
199
|
+
joinType?: "INNER" | "LEFT";
|
|
198
200
|
};
|
|
199
201
|
//#endregion
|
|
200
202
|
//#region src/runtime/dsl/query/createQueryResolveInfo.d.ts
|
|
@@ -261,6 +263,7 @@ type QueryOptions = {
|
|
|
261
263
|
limit?: number;
|
|
262
264
|
offset?: number;
|
|
263
265
|
lock?: LockMode;
|
|
266
|
+
join?: Join[];
|
|
264
267
|
};
|
|
265
268
|
declare abstract class SasatDBDatasource<Entity extends EntityType, Identifiable extends object, Creatable extends EntityType, Updatable extends Identifiable, EntityFields extends Fields<Entity>, QueryResult extends Partial<Entity> & Identifiable> implements Repository<Entity, Identifiable, Creatable, Updatable> {
|
|
266
269
|
protected client: SQLExecutor;
|
package/dist/index.d.mts
CHANGED
|
@@ -53,6 +53,7 @@ type Query = {
|
|
|
53
53
|
limit?: number;
|
|
54
54
|
offset?: number;
|
|
55
55
|
lock?: LockMode;
|
|
56
|
+
join?: Join[];
|
|
56
57
|
};
|
|
57
58
|
type GroupByExpr = {
|
|
58
59
|
kind: QueryNodeKind.GroupBy;
|
|
@@ -128,7 +129,7 @@ type ExistsExpression = {
|
|
|
128
129
|
kind: QueryNodeKind.Exists;
|
|
129
130
|
query: Query | RawExpression;
|
|
130
131
|
};
|
|
131
|
-
type BooleanValueExpression = CompoundExpression | ComparisonExpression | IsNullExpression | ParenthesisExpression | InExpression | BetweenExpression | ContainsExpression | ExistsExpression;
|
|
132
|
+
type BooleanValueExpression = CompoundExpression | ComparisonExpression | IsNullExpression | ParenthesisExpression | InExpression | BetweenExpression | ContainsExpression | ExistsExpression | RawExpression;
|
|
132
133
|
type IsNullExpression = {
|
|
133
134
|
kind: QueryNodeKind.IsNullExpr;
|
|
134
135
|
expr: Value;
|
|
@@ -195,6 +196,7 @@ type Fields<Entity, Relation = Record<string, unknown>> = {
|
|
|
195
196
|
relations?: Relation;
|
|
196
197
|
tableAlias?: string;
|
|
197
198
|
joinOn?: BooleanValueExpression;
|
|
199
|
+
joinType?: "INNER" | "LEFT";
|
|
198
200
|
};
|
|
199
201
|
//#endregion
|
|
200
202
|
//#region src/runtime/dsl/query/createQueryResolveInfo.d.ts
|
|
@@ -261,6 +263,7 @@ type QueryOptions = {
|
|
|
261
263
|
limit?: number;
|
|
262
264
|
offset?: number;
|
|
263
265
|
lock?: LockMode;
|
|
266
|
+
join?: Join[];
|
|
264
267
|
};
|
|
265
268
|
declare abstract class SasatDBDatasource<Entity extends EntityType, Identifiable extends object, Creatable extends EntityType, Updatable extends Identifiable, EntityFields extends Fields<Entity>, QueryResult extends Partial<Entity> & Identifiable> implements Repository<Entity, Identifiable, Creatable, Updatable> {
|
|
266
269
|
protected client: SQLExecutor;
|
package/dist/index.mjs
CHANGED
|
@@ -110,6 +110,7 @@ const Sql = {
|
|
|
110
110
|
case 8: return Sql.in(expr);
|
|
111
111
|
case 6: return Sql.isNull(expr);
|
|
112
112
|
case 14: return Sql.exists(expr);
|
|
113
|
+
case 15: return expr.expr;
|
|
113
114
|
}
|
|
114
115
|
},
|
|
115
116
|
exists: (expr) => {
|
|
@@ -144,7 +145,7 @@ const getLock = (lock) => {
|
|
|
144
145
|
};
|
|
145
146
|
const queryToSql = (query) => {
|
|
146
147
|
const select = query.select.map(Sql.select).join(", ");
|
|
147
|
-
const join = getJoin(query.from).map(Sql.join).join(" ");
|
|
148
|
+
const join = [...getJoin(query.from), ...query.join ?? []].map(Sql.join).join(" ");
|
|
148
149
|
const where = query.where ? " WHERE " + Sql.booleanValue(query.where) : "";
|
|
149
150
|
const groupBy = query.groupBy ? " GROUP BY" + query.groupBy.cols.map(Sql.value).join(",") : "";
|
|
150
151
|
const having = query.having ? "HAVING " + Sql.booleanValue(query.having) : "";
|
|
@@ -624,7 +625,7 @@ const createQuery = (baseTableName, fields, options, tableInfo, relationMap, con
|
|
|
624
625
|
parentTableAlias: tableAlias,
|
|
625
626
|
childTableAlias: table.tableAlias || "t" + current,
|
|
626
627
|
context
|
|
627
|
-
}), table.joinOn), "LEFT");
|
|
628
|
+
}), table.joinOn), table.joinType ?? "LEFT");
|
|
628
629
|
}).filter(nonNullable), tableAlias);
|
|
629
630
|
};
|
|
630
631
|
return {
|