pqb 0.48.3 → 0.48.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 +20 -9
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -4335,7 +4335,7 @@ function queryFrom(self, arg) {
|
|
|
4335
4335
|
data.batchParsers = q.q.batchParsers;
|
|
4336
4336
|
}
|
|
4337
4337
|
data.from = arg;
|
|
4338
|
-
data.selectAllColumns = data.selectAllKeys = void 0;
|
|
4338
|
+
data.selectAllColumns = data.selectAllKeys = data.scopes = void 0;
|
|
4339
4339
|
return self;
|
|
4340
4340
|
}
|
|
4341
4341
|
function queryFromSql(self, args) {
|
|
@@ -6980,30 +6980,39 @@ const _chain = (fromQuery, toQuery, rel) => {
|
|
|
6980
6980
|
const self = fromQuery;
|
|
6981
6981
|
const toTable = toQuery;
|
|
6982
6982
|
let query;
|
|
6983
|
+
let q;
|
|
6983
6984
|
if (self.q.subQuery) {
|
|
6984
6985
|
query = toTable;
|
|
6985
6986
|
query.q.subQuery = 2;
|
|
6987
|
+
q = query.q;
|
|
6988
|
+
if (
|
|
6989
|
+
// `select({ q => q.rel })`: on the first relation it doesn't matter if the parent has chainMultiple
|
|
6990
|
+
self.q.subQuery > 1 && self.q.chainMultiple
|
|
6991
|
+
) ; else if (!rel.query.q.returnsOne) {
|
|
6992
|
+
q.chainMultiple = true;
|
|
6993
|
+
}
|
|
6986
6994
|
} else {
|
|
6987
6995
|
query = _queryWhere(_queryAll(toTable), [
|
|
6988
6996
|
{
|
|
6989
6997
|
EXISTS: { q: rel.reverseJoin(self, toTable) }
|
|
6990
6998
|
}
|
|
6991
6999
|
]);
|
|
7000
|
+
q = query.q;
|
|
7001
|
+
q.returnType = q.returnsOne = q.limit = void 0;
|
|
6992
7002
|
}
|
|
6993
7003
|
if (self.q.relChain) {
|
|
6994
|
-
|
|
6995
|
-
query.q.returnType = "all";
|
|
7004
|
+
q.relChain = [...self.q.relChain, self];
|
|
6996
7005
|
} else {
|
|
6997
|
-
|
|
7006
|
+
q.relChain = [self];
|
|
6998
7007
|
}
|
|
6999
7008
|
const aliases = self.q.as ? { ...self.q.aliases } : { ...self.q.aliases, [self.table]: self.table };
|
|
7000
|
-
const relAliases =
|
|
7009
|
+
const relAliases = q.aliases;
|
|
7001
7010
|
for (const as in relAliases) {
|
|
7002
7011
|
aliases[as] = _queryResolveAlias(aliases, as);
|
|
7003
7012
|
}
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7013
|
+
q.as = aliases[q.as];
|
|
7014
|
+
q.aliases = aliases;
|
|
7015
|
+
q.joinedShapes = {
|
|
7007
7016
|
[getQueryAs(self)]: self.q.shape,
|
|
7008
7017
|
...self.q.joinedShapes
|
|
7009
7018
|
};
|