@entity-access/entity-access 1.0.225 → 1.0.227
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/drivers/sql-server/ExpressionToSqlServer.js +1 -1
- package/dist/drivers/sql-server/ExpressionToSqlServer.js.map +1 -1
- package/dist/model/EntityQuery.d.ts.map +1 -1
- package/dist/model/EntityQuery.js +29 -4
- package/dist/model/EntityQuery.js.map +1 -1
- package/dist/model/changes/ChangeEntry.d.ts +1 -0
- package/dist/model/changes/ChangeEntry.d.ts.map +1 -1
- package/dist/model/changes/ChangeEntry.js +17 -2
- package/dist/model/changes/ChangeEntry.js.map +1 -1
- package/dist/model/changes/ChangeSet.js +2 -2
- package/dist/model/changes/ChangeSet.js.map +1 -1
- package/dist/query/ast/ExpressionToSql.js +2 -2
- package/dist/query/ast/ExpressionToSql.js.map +1 -1
- package/dist/tests/db-tests/tests/update-items.d.ts.map +1 -1
- package/dist/tests/db-tests/tests/update-items.js +5 -2
- package/dist/tests/db-tests/tests/update-items.js.map +1 -1
- package/dist/tests/expressions/left-joins/child-joins.d.ts.map +1 -1
- package/dist/tests/expressions/left-joins/child-joins.js +22 -5
- package/dist/tests/expressions/left-joins/child-joins.js.map +1 -1
- package/dist/tests/expressions/trimInternal.d.ts.map +1 -1
- package/dist/tests/expressions/trimInternal.js +8 -6
- package/dist/tests/expressions/trimInternal.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/drivers/sql-server/ExpressionToSqlServer.ts +1 -1
- package/src/model/EntityQuery.ts +35 -4
- package/src/model/changes/ChangeEntry.ts +18 -2
- package/src/model/changes/ChangeSet.ts +2 -2
- package/src/query/ast/ExpressionToSql.ts +2 -2
- package/src/tests/db-tests/tests/update-items.ts +6 -2
- package/src/tests/expressions/left-joins/child-joins.ts +22 -5
- package/src/tests/expressions/trimInternal.ts +8 -6
|
@@ -8,7 +8,8 @@ const sql1 = `SELECT
|
|
|
8
8
|
p1.product_id,
|
|
9
9
|
p1.name,
|
|
10
10
|
p1.owner_id,
|
|
11
|
-
p1.status
|
|
11
|
+
p1.status,
|
|
12
|
+
p1.product_description
|
|
12
13
|
FROM products AS p1
|
|
13
14
|
WHERE EXISTS (SELECT
|
|
14
15
|
1
|
|
@@ -19,7 +20,8 @@ const sql2 = `SELECT
|
|
|
19
20
|
p1.product_id,
|
|
20
21
|
p1.name,
|
|
21
22
|
p1.owner_id,
|
|
22
|
-
p1.status
|
|
23
|
+
p1.status,
|
|
24
|
+
p1.product_description
|
|
23
25
|
FROM products AS p1
|
|
24
26
|
WHERE EXISTS (SELECT
|
|
25
27
|
1
|
|
@@ -33,7 +35,8 @@ const sql3 = `SELECT
|
|
|
33
35
|
p1.product_id,
|
|
34
36
|
p1.name,
|
|
35
37
|
p1.owner_id,
|
|
36
|
-
p1.status
|
|
38
|
+
p1.status,
|
|
39
|
+
p1.product_description
|
|
37
40
|
FROM products AS p1
|
|
38
41
|
WHERE EXISTS (SELECT
|
|
39
42
|
1
|
|
@@ -48,7 +51,8 @@ const productJoin = `SELECT
|
|
|
48
51
|
p1.product_id,
|
|
49
52
|
p1.name,
|
|
50
53
|
p1.owner_id,
|
|
51
|
-
p1.status
|
|
54
|
+
p1.status,
|
|
55
|
+
p1.product_description
|
|
52
56
|
FROM products AS p1
|
|
53
57
|
LEFT JOIN users AS u ON p1.owner_id = u.user_id
|
|
54
58
|
WHERE u.date_created > $1`;
|
|
@@ -64,7 +68,20 @@ FROM order_items AS o1
|
|
|
64
68
|
LEFT JOIN products AS p ON o1.product_id = p.product_id
|
|
65
69
|
WHERE (o1.product_id = $1) OR (p.owner_id = $2)`;
|
|
66
70
|
|
|
67
|
-
const notExp =
|
|
71
|
+
const notExp = `SELECT
|
|
72
|
+
p1.product_id,
|
|
73
|
+
p1.name,
|
|
74
|
+
p1.owner_id,
|
|
75
|
+
p1.status,
|
|
76
|
+
p1.product_description
|
|
77
|
+
FROM products AS p1
|
|
78
|
+
WHERE EXISTS
|
|
79
|
+
(SELECT 1 FROM order_items AS o
|
|
80
|
+
WHERE (p1.product_id = o.product_id) AND (o.product_id = $1)) AND
|
|
81
|
+
NOT (EXISTS (SELECT 1 FROM order_items AS o1
|
|
82
|
+
INNER JOIN orders AS o2 ON o1.order_id = o2.order_id
|
|
83
|
+
WHERE (p1.product_id = o1.product_id) AND (o2.order_date > $2)))
|
|
84
|
+
`;
|
|
68
85
|
|
|
69
86
|
export default function() {
|
|
70
87
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AssertionError } from "assert";
|
|
1
|
+
import assert, { AssertionError } from "assert";
|
|
2
2
|
|
|
3
3
|
export const trimInternal = (text: string) => {
|
|
4
4
|
let r = "";
|
|
@@ -8,16 +8,18 @@ export const trimInternal = (text: string) => {
|
|
|
8
8
|
case "\t":
|
|
9
9
|
case "\r":
|
|
10
10
|
case " ":
|
|
11
|
+
if (!r.endsWith(" ")) {
|
|
12
|
+
r += " ";
|
|
13
|
+
}
|
|
11
14
|
continue;
|
|
12
15
|
}
|
|
13
16
|
r += iterator;
|
|
14
17
|
}
|
|
15
|
-
return r;
|
|
18
|
+
return r.trim();
|
|
16
19
|
};
|
|
17
20
|
|
|
18
21
|
export const assertSqlMatch = (expected: string, actual: string) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
throw new AssertionError({ expected, actual, operator: "===" });
|
|
22
|
+
const expectedTrimmed = trimInternal(expected);
|
|
23
|
+
const actualTrimmed = trimInternal(actual);
|
|
24
|
+
assert.strictEqual(actualTrimmed, expectedTrimmed);
|
|
23
25
|
};
|