@balena/abstract-sql-compiler 10.2.5 → 10.2.6-build-is-field-type-node-9aead5476c82d21b8287f191c64f812239eaf109-1
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/.versionbot/CHANGELOG.yml +93 -1
- package/CHANGELOG.md +14 -0
- package/out/AbstractSQLCompiler.d.ts +1 -0
- package/out/AbstractSQLCompiler.js +3 -1
- package/out/AbstractSQLCompiler.js.map +1 -1
- package/out/AbstractSQLOptimiser.js +6 -6
- package/out/AbstractSQLOptimiser.js.map +1 -1
- package/out/AbstractSQLRules2SQL.d.ts +0 -1
- package/out/AbstractSQLRules2SQL.js +5 -8
- package/out/AbstractSQLRules2SQL.js.map +1 -1
- package/package.json +5 -11
- package/src/AbstractSQLCompiler.ts +4 -0
- package/src/AbstractSQLOptimiser.ts +6 -6
- package/src/AbstractSQLRules2SQL.ts +4 -9
- package/test/odata/{expand.js → expand.ts} +122 -60
- package/test/odata/{filterby.js → filterby.ts} +105 -79
- package/test/odata/{resource_parsing.js → resource_parsing.ts} +12 -12
- package/test/odata/{stress.js → stress.ts} +1 -2
- package/test/odata/test.ts +4 -3
- package/test/sbvr/{pilots.js → pilots.ts} +2 -1
- package/test/sbvr/{reference-type.js → reference-type.ts} +5 -4
- package/test/sbvr/{test.js → test.ts} +21 -8
- package/tsconfig.json +1 -2
- package/.eslintrc.js +0 -12
- package/tsconfig.js.json +0 -12
- /package/test/odata/{orderby.js → orderby.ts} +0 -0
- /package/test/odata/{paging.js → paging.ts} +0 -0
- /package/test/odata/{select.js → select.ts} +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { ExpectationFailFn, ExpectationSuccessFn } from './test';
|
1
2
|
import test from './test';
|
2
3
|
import {
|
3
4
|
pilotFields,
|
@@ -8,8 +9,15 @@ import {
|
|
8
9
|
} from './fields';
|
9
10
|
import _ from 'lodash';
|
10
11
|
|
11
|
-
|
12
|
-
|
12
|
+
type TestFn = (
|
13
|
+
aggFunc: (field: string) => string,
|
14
|
+
fields?: string,
|
15
|
+
) => ExpectationSuccessFn;
|
16
|
+
|
17
|
+
const postgresAgg = (field: string) =>
|
18
|
+
'COALESCE(JSON_AGG(' + field + "), '[]')";
|
19
|
+
const mysqlAgg = (field: string) =>
|
20
|
+
"'[' || group_concat(" + field + ", ',') || ']'";
|
13
21
|
const websqlAgg = mysqlAgg;
|
14
22
|
|
15
23
|
(function () {
|
@@ -17,7 +25,7 @@ const websqlAgg = mysqlAgg;
|
|
17
25
|
pilotFields,
|
18
26
|
(field) => field === '"pilot"."licence"',
|
19
27
|
).join(', ');
|
20
|
-
const testFunc = (aggFunc, fields) => (result, sqlEquals) => {
|
28
|
+
const testFunc: TestFn = (aggFunc, fields) => (result, sqlEquals) => {
|
21
29
|
it('should select from pilot.*, aggregated licence', () => {
|
22
30
|
sqlEquals?.(
|
23
31
|
result,
|
@@ -38,10 +46,28 @@ FROM "pilot"`,
|
|
38
46
|
const urlCount = '/pilot?$expand=licence/$count';
|
39
47
|
test.postgres(url, testFunc(postgresAgg, aliasLicenceFields.join(', ')));
|
40
48
|
test.postgres(urlCount, testFunc(postgresAgg, 'COUNT(*) AS "$count"'));
|
41
|
-
test.mysql.fail(
|
42
|
-
|
43
|
-
|
44
|
-
|
49
|
+
test.mysql.fail(
|
50
|
+
url,
|
51
|
+
testFunc(
|
52
|
+
mysqlAgg,
|
53
|
+
aliasLicenceFields.join(', '),
|
54
|
+
) as any as ExpectationFailFn,
|
55
|
+
);
|
56
|
+
test.mysql.fail(
|
57
|
+
urlCount,
|
58
|
+
testFunc(mysqlAgg, 'COUNT(*) AS "$count"') as any as ExpectationFailFn,
|
59
|
+
);
|
60
|
+
test.websql.fail(
|
61
|
+
url,
|
62
|
+
testFunc(
|
63
|
+
websqlAgg,
|
64
|
+
aliasLicenceFields.join(', '),
|
65
|
+
) as any as ExpectationFailFn,
|
66
|
+
);
|
67
|
+
test.websql.fail(
|
68
|
+
urlCount,
|
69
|
+
testFunc(websqlAgg, 'COUNT(*) AS "$count"') as any as ExpectationFailFn,
|
70
|
+
);
|
45
71
|
})();
|
46
72
|
|
47
73
|
(function () {
|
@@ -49,7 +75,7 @@ FROM "pilot"`,
|
|
49
75
|
aliasPilotCanFlyPlaneFields,
|
50
76
|
(field) => field === '"pilot.pilot-can fly-plane"."can fly-plane"',
|
51
77
|
).join(', ');
|
52
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
78
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
53
79
|
it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane)', () => {
|
54
80
|
sqlEquals?.(
|
55
81
|
result,
|
@@ -79,8 +105,8 @@ FROM "pilot"`,
|
|
79
105
|
'/pilot?$expand=can_fly__plane($expand=plane)',
|
80
106
|
]) {
|
81
107
|
test.postgres(url, testFunc(postgresAgg));
|
82
|
-
test.mysql.fail(url, testFunc(mysqlAgg));
|
83
|
-
test.websql.fail(url, testFunc(websqlAgg));
|
108
|
+
test.mysql.fail(url, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
109
|
+
test.websql.fail(url, testFunc(websqlAgg) as any as ExpectationFailFn);
|
84
110
|
}
|
85
111
|
})();
|
86
112
|
|
@@ -93,7 +119,7 @@ FROM "pilot"`,
|
|
93
119
|
pilotFields,
|
94
120
|
(field) => field === '"pilot"."licence"',
|
95
121
|
).join(', ');
|
96
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
122
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
97
123
|
it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane), aggregated licence', () => {
|
98
124
|
sqlEquals?.(
|
99
125
|
result,
|
@@ -130,13 +156,13 @@ FROM "pilot"`,
|
|
130
156
|
'/pilot?$expand=can_fly__plane($expand=plane),licence',
|
131
157
|
]) {
|
132
158
|
test.postgres(url, testFunc(postgresAgg));
|
133
|
-
test.mysql.fail(url, testFunc(mysqlAgg));
|
134
|
-
test.websql.fail(url, testFunc(websqlAgg));
|
159
|
+
test.mysql.fail(url, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
160
|
+
test.websql.fail(url, testFunc(websqlAgg) as any as ExpectationFailFn);
|
135
161
|
}
|
136
162
|
})();
|
137
163
|
|
138
164
|
(function () {
|
139
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
165
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
140
166
|
it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane), aggregated licence', () => {
|
141
167
|
sqlEquals?.(
|
142
168
|
result,
|
@@ -155,8 +181,8 @@ FROM "pilot"`,
|
|
155
181
|
};
|
156
182
|
const url = '/pilot?$select=licence&$expand=licence';
|
157
183
|
test.postgres(url, testFunc(postgresAgg));
|
158
|
-
test.mysql.fail(url, testFunc(mysqlAgg));
|
159
|
-
test.websql.fail(url, testFunc(websqlAgg));
|
184
|
+
test.mysql.fail(url, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
185
|
+
test.websql.fail(url, testFunc(websqlAgg) as any as ExpectationFailFn);
|
160
186
|
})();
|
161
187
|
|
162
188
|
(function () {
|
@@ -164,7 +190,7 @@ FROM "pilot"`,
|
|
164
190
|
aliasPilotCanFlyPlaneFields,
|
165
191
|
(field) => field === '"pilot.pilot-can fly-plane"."can fly-plane"',
|
166
192
|
).join(', ');
|
167
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
193
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
168
194
|
it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane)', () => {
|
169
195
|
sqlEquals?.(
|
170
196
|
result,
|
@@ -194,8 +220,8 @@ FROM "pilot"`,
|
|
194
220
|
'/pilot?$select=id&$expand=can_fly__plane($expand=plane)',
|
195
221
|
]) {
|
196
222
|
test.postgres(url, testFunc(postgresAgg));
|
197
|
-
test.mysql.fail(url, testFunc(mysqlAgg));
|
198
|
-
test.websql.fail(url, testFunc(websqlAgg));
|
223
|
+
test.mysql.fail(url, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
224
|
+
test.websql.fail(url, testFunc(websqlAgg) as any as ExpectationFailFn);
|
199
225
|
}
|
200
226
|
})();
|
201
227
|
|
@@ -204,7 +230,7 @@ FROM "pilot"`,
|
|
204
230
|
aliasPilotCanFlyPlaneFields,
|
205
231
|
(field) => field === '"pilot.pilot-can fly-plane"."can fly-plane"',
|
206
232
|
).join(', ');
|
207
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
233
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
208
234
|
it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane), aggregated licence', () => {
|
209
235
|
sqlEquals?.(
|
210
236
|
result,
|
@@ -241,13 +267,13 @@ FROM "pilot"`,
|
|
241
267
|
'/pilot?$select=id,licence&$expand=can_fly__plane($expand=plane),licence',
|
242
268
|
]) {
|
243
269
|
test.postgres(url, testFunc(postgresAgg));
|
244
|
-
test.mysql.fail(url, testFunc(mysqlAgg));
|
245
|
-
test.websql.fail(url, testFunc(websqlAgg));
|
270
|
+
test.mysql.fail(url, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
271
|
+
test.websql.fail(url, testFunc(websqlAgg) as any as ExpectationFailFn);
|
246
272
|
}
|
247
273
|
})();
|
248
274
|
|
249
275
|
(function () {
|
250
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
276
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
251
277
|
it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane)', () => {
|
252
278
|
sqlEquals?.(
|
253
279
|
result,
|
@@ -266,8 +292,8 @@ FROM "pilot"`,
|
|
266
292
|
};
|
267
293
|
const url = '/pilot?$expand=can_fly__plane($select=id)';
|
268
294
|
test.postgres(url, testFunc(postgresAgg));
|
269
|
-
test.mysql.fail(url, testFunc(mysqlAgg));
|
270
|
-
test.websql.fail(url, testFunc(websqlAgg));
|
295
|
+
test.mysql.fail(url, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
296
|
+
test.websql.fail(url, testFunc(websqlAgg) as any as ExpectationFailFn);
|
271
297
|
})();
|
272
298
|
|
273
299
|
(function () {
|
@@ -275,7 +301,7 @@ FROM "pilot"`,
|
|
275
301
|
pilotFields,
|
276
302
|
(field) => field === '"pilot"."licence"',
|
277
303
|
).join(', ');
|
278
|
-
const testFunc = (aggFunc, fields) => (result, sqlEquals) => {
|
304
|
+
const testFunc: TestFn = (aggFunc, fields) => (result, sqlEquals) => {
|
279
305
|
it('should select from pilot.*, aggregated licence', () => {
|
280
306
|
sqlEquals?.(
|
281
307
|
result,
|
@@ -311,25 +337,31 @@ FROM "pilot"`,
|
|
311
337
|
url,
|
312
338
|
'GET',
|
313
339
|
[['Bind', 0]],
|
314
|
-
testFunc(
|
340
|
+
testFunc(
|
341
|
+
mysqlAgg,
|
342
|
+
aliasLicenceFields.join(', '),
|
343
|
+
) as any as ExpectationFailFn,
|
315
344
|
);
|
316
345
|
test.mysql.fail(
|
317
346
|
urlCount,
|
318
347
|
'GET',
|
319
348
|
[['Bind', 0]],
|
320
|
-
testFunc(mysqlAgg, 'COUNT(*) AS "$count"'),
|
349
|
+
testFunc(mysqlAgg, 'COUNT(*) AS "$count"') as any as ExpectationFailFn,
|
321
350
|
);
|
322
351
|
test.websql.fail(
|
323
352
|
url,
|
324
353
|
'GET',
|
325
354
|
[['Bind', 0]],
|
326
|
-
testFunc(
|
355
|
+
testFunc(
|
356
|
+
websqlAgg,
|
357
|
+
aliasLicenceFields.join(', '),
|
358
|
+
) as any as ExpectationFailFn,
|
327
359
|
);
|
328
360
|
test.websql.fail(
|
329
361
|
urlCount,
|
330
362
|
'GET',
|
331
363
|
[['Bind', 0]],
|
332
|
-
testFunc(websqlAgg, 'COUNT(*) AS "$count'),
|
364
|
+
testFunc(websqlAgg, 'COUNT(*) AS "$count') as any as ExpectationFailFn,
|
333
365
|
);
|
334
366
|
})();
|
335
367
|
|
@@ -338,7 +370,7 @@ FROM "pilot"`,
|
|
338
370
|
pilotFields,
|
339
371
|
(field) => field === '"pilot"."licence"',
|
340
372
|
).join(', ');
|
341
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
373
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
342
374
|
it('should select from pilot.*, aggregated licence', () => {
|
343
375
|
sqlEquals?.(
|
344
376
|
result,
|
@@ -359,8 +391,18 @@ FROM "pilot"`,
|
|
359
391
|
};
|
360
392
|
const url = '/pilot?$expand=licence($filter=is_of__pilot/id eq 1)';
|
361
393
|
test.postgres(url, 'GET', [['Bind', 0]], testFunc(postgresAgg));
|
362
|
-
test.mysql.fail(
|
363
|
-
|
394
|
+
test.mysql.fail(
|
395
|
+
url,
|
396
|
+
'GET',
|
397
|
+
[['Bind', 0]],
|
398
|
+
testFunc(mysqlAgg) as any as ExpectationFailFn,
|
399
|
+
);
|
400
|
+
test.websql.fail(
|
401
|
+
url,
|
402
|
+
'GET',
|
403
|
+
[['Bind', 0]],
|
404
|
+
testFunc(websqlAgg) as any as ExpectationFailFn,
|
405
|
+
);
|
364
406
|
})();
|
365
407
|
|
366
408
|
(function () {
|
@@ -368,7 +410,7 @@ FROM "pilot"`,
|
|
368
410
|
pilotFields,
|
369
411
|
(field) => field === '"pilot"."licence"',
|
370
412
|
).join(', ');
|
371
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
413
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
372
414
|
it('should select from pilot.*, aggregated licence', () => {
|
373
415
|
sqlEquals?.(
|
374
416
|
result,
|
@@ -388,8 +430,8 @@ FROM "pilot"`,
|
|
388
430
|
};
|
389
431
|
const url = '/pilot?$expand=licence($orderby=id)';
|
390
432
|
test.postgres(url, testFunc(postgresAgg));
|
391
|
-
test.mysql.fail(url, testFunc(mysqlAgg));
|
392
|
-
test.websql.fail(url, testFunc(websqlAgg));
|
433
|
+
test.mysql.fail(url, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
434
|
+
test.websql.fail(url, testFunc(websqlAgg) as any as ExpectationFailFn);
|
393
435
|
})();
|
394
436
|
|
395
437
|
(function () {
|
@@ -397,7 +439,7 @@ FROM "pilot"`,
|
|
397
439
|
pilotFields,
|
398
440
|
(field) => field === '"pilot"."licence"',
|
399
441
|
).join(', ');
|
400
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
442
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
401
443
|
it('should select from pilot.*, aggregated count(*) licence and ignore orderby', () => {
|
402
444
|
sqlEquals?.(
|
403
445
|
result,
|
@@ -416,8 +458,8 @@ FROM "pilot"`,
|
|
416
458
|
};
|
417
459
|
const urlCount = '/pilot?$expand=licence/$count($orderby=id)';
|
418
460
|
test.postgres(urlCount, testFunc(postgresAgg));
|
419
|
-
test.mysql.fail(urlCount, testFunc(mysqlAgg));
|
420
|
-
test.websql.fail(urlCount, testFunc(websqlAgg));
|
461
|
+
test.mysql.fail(urlCount, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
462
|
+
test.websql.fail(urlCount, testFunc(websqlAgg) as any as ExpectationFailFn);
|
421
463
|
})();
|
422
464
|
|
423
465
|
(function () {
|
@@ -425,7 +467,7 @@ FROM "pilot"`,
|
|
425
467
|
pilotFields,
|
426
468
|
(field) => field === '"pilot"."licence"',
|
427
469
|
).join(', ');
|
428
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
470
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
429
471
|
it('should select from pilot.*, aggregated licence', () => {
|
430
472
|
sqlEquals?.(
|
431
473
|
result,
|
@@ -445,8 +487,18 @@ FROM "pilot"`,
|
|
445
487
|
};
|
446
488
|
const url = '/pilot?$expand=licence($top=10)';
|
447
489
|
test.postgres(url, 'GET', [['Bind', 0]], testFunc(postgresAgg));
|
448
|
-
test.mysql.fail(
|
449
|
-
|
490
|
+
test.mysql.fail(
|
491
|
+
url,
|
492
|
+
'GET',
|
493
|
+
[['Bind', 0]],
|
494
|
+
testFunc(mysqlAgg) as any as ExpectationFailFn,
|
495
|
+
);
|
496
|
+
test.websql.fail(
|
497
|
+
url,
|
498
|
+
'GET',
|
499
|
+
[['Bind', 0]],
|
500
|
+
testFunc(websqlAgg) as any as ExpectationFailFn,
|
501
|
+
);
|
450
502
|
})();
|
451
503
|
|
452
504
|
(function () {
|
@@ -454,7 +506,7 @@ FROM "pilot"`,
|
|
454
506
|
pilotFields,
|
455
507
|
(field) => field === '"pilot"."licence"',
|
456
508
|
).join(', ');
|
457
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
509
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
458
510
|
it('should select from pilot.*, aggregated count(*) licence and ignore top', () => {
|
459
511
|
sqlEquals?.(
|
460
512
|
result,
|
@@ -473,8 +525,8 @@ FROM "pilot"`,
|
|
473
525
|
};
|
474
526
|
const urlCount = '/pilot?$expand=licence/$count($top=10)';
|
475
527
|
test.postgres(urlCount, testFunc(postgresAgg));
|
476
|
-
test.mysql.fail(urlCount, testFunc(mysqlAgg));
|
477
|
-
test.websql.fail(urlCount, testFunc(websqlAgg));
|
528
|
+
test.mysql.fail(urlCount, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
529
|
+
test.websql.fail(urlCount, testFunc(websqlAgg) as any as ExpectationFailFn);
|
478
530
|
})();
|
479
531
|
|
480
532
|
(function () {
|
@@ -482,7 +534,7 @@ FROM "pilot"`,
|
|
482
534
|
pilotFields,
|
483
535
|
(field) => field === '"pilot"."licence"',
|
484
536
|
).join(', ');
|
485
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
537
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
486
538
|
it('should select from pilot.*, aggregated licence', () => {
|
487
539
|
sqlEquals?.(
|
488
540
|
result,
|
@@ -502,8 +554,18 @@ FROM "pilot"`,
|
|
502
554
|
};
|
503
555
|
const url = '/pilot?$expand=licence($skip=10)';
|
504
556
|
test.postgres(url, 'GET', [['Bind', 0]], testFunc(postgresAgg));
|
505
|
-
test.mysql.fail(
|
506
|
-
|
557
|
+
test.mysql.fail(
|
558
|
+
url,
|
559
|
+
'GET',
|
560
|
+
[['Bind', 0]],
|
561
|
+
testFunc(mysqlAgg) as any as ExpectationFailFn,
|
562
|
+
);
|
563
|
+
test.websql.fail(
|
564
|
+
url,
|
565
|
+
'GET',
|
566
|
+
[['Bind', 0]],
|
567
|
+
testFunc(websqlAgg) as any as ExpectationFailFn,
|
568
|
+
);
|
507
569
|
})();
|
508
570
|
|
509
571
|
(function () {
|
@@ -511,7 +573,7 @@ FROM "pilot"`,
|
|
511
573
|
pilotFields,
|
512
574
|
(field) => field === '"pilot"."licence"',
|
513
575
|
).join(', ');
|
514
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
576
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
515
577
|
it('should select from pilot.*, aggregated count(*) licence and ignore skip', () => {
|
516
578
|
sqlEquals?.(
|
517
579
|
result,
|
@@ -530,12 +592,12 @@ FROM "pilot"`,
|
|
530
592
|
};
|
531
593
|
const urlCount = '/pilot?$expand=licence/$count($skip=10)';
|
532
594
|
test.postgres(urlCount, testFunc(postgresAgg));
|
533
|
-
test.mysql.fail(urlCount, testFunc(mysqlAgg));
|
534
|
-
test.websql.fail(urlCount, testFunc(websqlAgg));
|
595
|
+
test.mysql.fail(urlCount, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
596
|
+
test.websql.fail(urlCount, testFunc(websqlAgg) as any as ExpectationFailFn);
|
535
597
|
})();
|
536
598
|
|
537
599
|
(function () {
|
538
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
600
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
539
601
|
it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane)', () => {
|
540
602
|
sqlEquals?.(
|
541
603
|
result,
|
@@ -554,12 +616,12 @@ FROM "pilot"`,
|
|
554
616
|
};
|
555
617
|
const url = '/pilot?$expand=can_fly__plane($select=plane)';
|
556
618
|
test.postgres(url, testFunc(postgresAgg));
|
557
|
-
test.mysql.fail(url, testFunc(mysqlAgg));
|
558
|
-
test.websql.fail(url, testFunc(websqlAgg));
|
619
|
+
test.mysql.fail(url, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
620
|
+
test.websql.fail(url, testFunc(websqlAgg) as any as ExpectationFailFn);
|
559
621
|
})();
|
560
622
|
|
561
623
|
(function () {
|
562
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
624
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
563
625
|
it('should select from pilot.*, aggregated count(*) pilot-can fly-plane and ignore select', () => {
|
564
626
|
sqlEquals?.(
|
565
627
|
result,
|
@@ -578,8 +640,8 @@ FROM "pilot"`,
|
|
578
640
|
};
|
579
641
|
const urlCount = '/pilot?$expand=can_fly__plane/$count($select=plane)';
|
580
642
|
test.postgres(urlCount, testFunc(postgresAgg));
|
581
|
-
test.mysql.fail(urlCount, testFunc(mysqlAgg));
|
582
|
-
test.websql.fail(urlCount, testFunc(websqlAgg));
|
643
|
+
test.mysql.fail(urlCount, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
644
|
+
test.websql.fail(urlCount, testFunc(websqlAgg) as any as ExpectationFailFn);
|
583
645
|
})();
|
584
646
|
|
585
647
|
(function () {
|
@@ -588,7 +650,7 @@ FROM "pilot"`,
|
|
588
650
|
pilotFields,
|
589
651
|
(field) => field === '"pilot"."trained-pilot"',
|
590
652
|
).join(', ');
|
591
|
-
const testFunc = (aggFunc) => (result, sqlEquals) => {
|
653
|
+
const testFunc: TestFn = (aggFunc) => (result, sqlEquals) => {
|
592
654
|
it('should select from pilot.*, aggregated pilot', () => {
|
593
655
|
sqlEquals?.(
|
594
656
|
result,
|
@@ -607,6 +669,6 @@ FROM "pilot"`,
|
|
607
669
|
};
|
608
670
|
const url = '/pilot?$expand=trained__pilot';
|
609
671
|
test.postgres(url, testFunc(postgresAgg));
|
610
|
-
test.mysql.fail(url, testFunc(mysqlAgg));
|
611
|
-
test.websql.fail(url, testFunc(websqlAgg));
|
672
|
+
test.mysql.fail(url, testFunc(mysqlAgg) as any as ExpectationFailFn);
|
673
|
+
test.websql.fail(url, testFunc(websqlAgg) as any as ExpectationFailFn);
|
612
674
|
})();
|