@carbonorm/carbonnode 3.9.5 → 3.9.6
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/api/C6Constants.d.ts +4 -0
- package/dist/api/orm/builders/ConditionBuilder.d.ts +14 -2
- package/dist/index.cjs.js +459 -243
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +459 -243
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/sakila-db/C6.js +1 -1
- package/src/__tests__/sakila-db/C6.ts +1 -1
- package/src/__tests__/sqlBuilders.expressions.test.ts +163 -0
- package/src/api/C6Constants.ts +2 -0
- package/src/api/orm/builders/ConditionBuilder.ts +479 -224
- package/src/api/orm/builders/JoinBuilder.ts +8 -5
|
@@ -14,19 +14,22 @@ export abstract class JoinBuilder<G extends OrmGenerics> extends ConditionBuilde
|
|
|
14
14
|
buildJoinClauses(joinArgs: any, params: any[] | Record<string, any>): string {
|
|
15
15
|
let sql = '';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const joinTypeEntries: Array<[string, any]> = joinArgs instanceof Map
|
|
18
|
+
? Array.from(joinArgs.entries()).map(([key, value]) => [String(key), value])
|
|
19
|
+
: Object.keys(joinArgs).map(key => [key, (joinArgs as Record<string, any>)[key]]);
|
|
20
|
+
|
|
21
|
+
for (const [joinTypeRaw, joinSection] of joinTypeEntries) {
|
|
22
|
+
const joinKind = joinTypeRaw.replace('_', ' ').toUpperCase();
|
|
19
23
|
const entries: Array<[any, any]> = [];
|
|
20
|
-
const joinSection = joinArgs[joinType];
|
|
21
24
|
|
|
22
25
|
if (joinSection instanceof Map) {
|
|
23
26
|
joinSection.forEach((value, key) => {
|
|
24
27
|
entries.push([key, value]);
|
|
25
28
|
});
|
|
26
29
|
} else {
|
|
27
|
-
|
|
30
|
+
Object.keys(joinSection).forEach(raw => {
|
|
28
31
|
entries.push([raw, joinSection[raw]]);
|
|
29
|
-
}
|
|
32
|
+
});
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
for (const [rawKey, conditions] of entries) {
|