@balena/abstract-sql-compiler 10.2.4-build-tests-ts-beb2503119ff2e479e1da25051d33a021129a9d7-1 → 10.2.4

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.
@@ -1,12 +1,4 @@
1
1
  - commits:
2
- - subject: "Tests: convert test/odata/test to typescript"
3
- hash: beb2503119ff2e479e1da25051d33a021129a9d7
4
- body: ""
5
- footer:
6
- Change-type: patch
7
- change-type: patch
8
- author: Pagan Gazzard
9
- nested: []
10
2
  - subject: Update dev dependencies
11
3
  hash: 703263fa73aff2253d1a931a5946a027d20c9ff6
12
4
  body: ""
@@ -17,7 +9,7 @@
17
9
  nested: []
18
10
  version: 10.2.4
19
11
  title: ""
20
- date: 2025-04-04T13:16:10.504Z
12
+ date: 2025-04-04T13:13:39.664Z
21
13
  - commits:
22
14
  - subject: "Tests: convert test/abstract-sql/case-when-else.js to typescript"
23
15
  hash: 0edb21cc4ee30ead2a6eeb290623f3a0adc7a0fe
package/CHANGELOG.md CHANGED
@@ -6,7 +6,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
7
  ## 10.2.4 - 2025-04-04
8
8
 
9
- * Tests: convert test/odata/test to typescript [Pagan Gazzard]
10
9
  * Update dev dependencies [Pagan Gazzard]
11
10
 
12
11
  ## 10.2.3 - 2025-03-19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/abstract-sql-compiler",
3
- "version": "10.2.4-build-tests-ts-beb2503119ff2e479e1da25051d33a021129a9d7-1",
3
+ "version": "10.2.4",
4
4
  "description": "A translator for abstract sql into sql.",
5
5
  "type": "commonjs",
6
6
  "main": "out/AbstractSQLCompiler.js",
@@ -64,6 +64,6 @@
64
64
  "npm": ">=10.7.0"
65
65
  },
66
66
  "versionist": {
67
- "publishedAt": "2025-04-04T13:16:10.931Z"
67
+ "publishedAt": "2025-04-04T13:13:40.067Z"
68
68
  }
69
69
  }
@@ -18,9 +18,9 @@ const websqlAgg = mysqlAgg;
18
18
  (field) => field === '"pilot"."licence"',
19
19
  ).join(', ');
20
20
  const testFunc = (aggFunc, fields) => (result, sqlEquals) => {
21
- it('should select from pilot.*, aggregated licence', () => {
22
- sqlEquals?.(
23
- result,
21
+ it('should select from pilot.*, aggregated licence', () =>
22
+ sqlEquals(
23
+ result.query,
24
24
  `\
25
25
  SELECT (
26
26
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -31,17 +31,16 @@ SELECT (
31
31
  ) AS "pilot.licence"
32
32
  ) AS "licence", ${remainingPilotFields}
33
33
  FROM "pilot"`,
34
- );
35
- });
34
+ ));
36
35
  };
37
36
  const url = '/pilot?$expand=licence';
38
37
  const urlCount = '/pilot?$expand=licence/$count';
39
38
  test.postgres(url, testFunc(postgresAgg, aliasLicenceFields.join(', ')));
40
39
  test.postgres(urlCount, testFunc(postgresAgg, 'COUNT(*) AS "$count"'));
41
- test.mysql.fail(url, testFunc(mysqlAgg, aliasLicenceFields.join(', ')));
42
- test.mysql.fail(urlCount, testFunc(mysqlAgg, 'COUNT(*) AS "$count"'));
43
- test.websql.fail(url, testFunc(websqlAgg, aliasLicenceFields.join(', ')));
44
- test.websql.fail(urlCount, testFunc(websqlAgg, 'COUNT(*) AS "$count"'));
40
+ test.mysql.skip(url, testFunc(mysqlAgg, aliasLicenceFields.join(', ')));
41
+ test.mysql.skip(urlCount, testFunc(mysqlAgg, 'COUNT(*) AS "$count"'));
42
+ test.websql.skip(url, testFunc(websqlAgg, aliasLicenceFields.join(', ')));
43
+ test.websql.skip(urlCount, testFunc(websqlAgg, 'COUNT(*) AS "$count"'));
45
44
  })();
46
45
 
47
46
  (function () {
@@ -51,8 +50,8 @@ FROM "pilot"`,
51
50
  ).join(', ');
52
51
  const testFunc = (aggFunc) => (result, sqlEquals) => {
53
52
  it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane)', () => {
54
- sqlEquals?.(
55
- result,
53
+ sqlEquals(
54
+ result.query,
56
55
  `\
57
56
  SELECT (
58
57
  SELECT ${aggFunc('"pilot.pilot-can fly-plane".*')} AS "can_fly__plane"
@@ -79,8 +78,8 @@ FROM "pilot"`,
79
78
  '/pilot?$expand=can_fly__plane($expand=plane)',
80
79
  ]) {
81
80
  test.postgres(url, testFunc(postgresAgg));
82
- test.mysql.fail(url, testFunc(mysqlAgg));
83
- test.websql.fail(url, testFunc(websqlAgg));
81
+ test.mysql.skip(url, testFunc(mysqlAgg));
82
+ test.websql.skip(url, testFunc(websqlAgg));
84
83
  }
85
84
  })();
86
85
 
@@ -95,8 +94,8 @@ FROM "pilot"`,
95
94
  ).join(', ');
96
95
  const testFunc = (aggFunc) => (result, sqlEquals) => {
97
96
  it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane), aggregated licence', () => {
98
- sqlEquals?.(
99
- result,
97
+ sqlEquals(
98
+ result.query,
100
99
  `\
101
100
  SELECT (
102
101
  SELECT ${aggFunc('"pilot.pilot-can fly-plane".*')} AS "can_fly__plane"
@@ -130,16 +129,16 @@ FROM "pilot"`,
130
129
  '/pilot?$expand=can_fly__plane($expand=plane),licence',
131
130
  ]) {
132
131
  test.postgres(url, testFunc(postgresAgg));
133
- test.mysql.fail(url, testFunc(mysqlAgg));
134
- test.websql.fail(url, testFunc(websqlAgg));
132
+ test.mysql.skip(url, testFunc(mysqlAgg));
133
+ test.websql.skip(url, testFunc(websqlAgg));
135
134
  }
136
135
  })();
137
136
 
138
137
  (function () {
139
138
  const testFunc = (aggFunc) => (result, sqlEquals) => {
140
139
  it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane), aggregated licence', () => {
141
- sqlEquals?.(
142
- result,
140
+ sqlEquals(
141
+ result.query,
143
142
  `\
144
143
  SELECT (
145
144
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -155,8 +154,8 @@ FROM "pilot"`,
155
154
  };
156
155
  const url = '/pilot?$select=licence&$expand=licence';
157
156
  test.postgres(url, testFunc(postgresAgg));
158
- test.mysql.fail(url, testFunc(mysqlAgg));
159
- test.websql.fail(url, testFunc(websqlAgg));
157
+ test.mysql.skip(url, testFunc(mysqlAgg));
158
+ test.websql.skip(url, testFunc(websqlAgg));
160
159
  })();
161
160
 
162
161
  (function () {
@@ -166,8 +165,8 @@ FROM "pilot"`,
166
165
  ).join(', ');
167
166
  const testFunc = (aggFunc) => (result, sqlEquals) => {
168
167
  it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane)', () => {
169
- sqlEquals?.(
170
- result,
168
+ sqlEquals(
169
+ result.query,
171
170
  `\
172
171
  SELECT (
173
172
  SELECT ${aggFunc('"pilot.pilot-can fly-plane".*')} AS "can_fly__plane"
@@ -194,8 +193,8 @@ FROM "pilot"`,
194
193
  '/pilot?$select=id&$expand=can_fly__plane($expand=plane)',
195
194
  ]) {
196
195
  test.postgres(url, testFunc(postgresAgg));
197
- test.mysql.fail(url, testFunc(mysqlAgg));
198
- test.websql.fail(url, testFunc(websqlAgg));
196
+ test.mysql.skip(url, testFunc(mysqlAgg));
197
+ test.websql.skip(url, testFunc(websqlAgg));
199
198
  }
200
199
  })();
201
200
 
@@ -206,8 +205,8 @@ FROM "pilot"`,
206
205
  ).join(', ');
207
206
  const testFunc = (aggFunc) => (result, sqlEquals) => {
208
207
  it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane), aggregated licence', () => {
209
- sqlEquals?.(
210
- result,
208
+ sqlEquals(
209
+ result.query,
211
210
  `\
212
211
  SELECT (
213
212
  SELECT ${aggFunc('"pilot.pilot-can fly-plane".*')} AS "can_fly__plane"
@@ -241,16 +240,16 @@ FROM "pilot"`,
241
240
  '/pilot?$select=id,licence&$expand=can_fly__plane($expand=plane),licence',
242
241
  ]) {
243
242
  test.postgres(url, testFunc(postgresAgg));
244
- test.mysql.fail(url, testFunc(mysqlAgg));
245
- test.websql.fail(url, testFunc(websqlAgg));
243
+ test.mysql.skip(url, testFunc(mysqlAgg));
244
+ test.websql.skip(url, testFunc(websqlAgg));
246
245
  }
247
246
  })();
248
247
 
249
248
  (function () {
250
249
  const testFunc = (aggFunc) => (result, sqlEquals) => {
251
250
  it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane)', () => {
252
- sqlEquals?.(
253
- result,
251
+ sqlEquals(
252
+ result.query,
254
253
  `\
255
254
  SELECT (
256
255
  SELECT ${aggFunc('"pilot.pilot-can fly-plane".*')} AS "can_fly__plane"
@@ -266,8 +265,8 @@ FROM "pilot"`,
266
265
  };
267
266
  const url = '/pilot?$expand=can_fly__plane($select=id)';
268
267
  test.postgres(url, testFunc(postgresAgg));
269
- test.mysql.fail(url, testFunc(mysqlAgg));
270
- test.websql.fail(url, testFunc(websqlAgg));
268
+ test.mysql.skip(url, testFunc(mysqlAgg));
269
+ test.websql.skip(url, testFunc(websqlAgg));
271
270
  })();
272
271
 
273
272
  (function () {
@@ -277,8 +276,8 @@ FROM "pilot"`,
277
276
  ).join(', ');
278
277
  const testFunc = (aggFunc, fields) => (result, sqlEquals) => {
279
278
  it('should select from pilot.*, aggregated licence', () => {
280
- sqlEquals?.(
281
- result,
279
+ sqlEquals(
280
+ result.query,
282
281
  `\
283
282
  SELECT (
284
283
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -307,25 +306,25 @@ FROM "pilot"`,
307
306
  [['Bind', 0]],
308
307
  testFunc(postgresAgg, 'COUNT(*) AS "$count"'),
309
308
  );
310
- test.mysql.fail(
309
+ test.mysql.skip(
311
310
  url,
312
311
  'GET',
313
312
  [['Bind', 0]],
314
313
  testFunc(mysqlAgg, aliasLicenceFields.join(', ')),
315
314
  );
316
- test.mysql.fail(
315
+ test.mysql.skip(
317
316
  urlCount,
318
317
  'GET',
319
318
  [['Bind', 0]],
320
319
  testFunc(mysqlAgg, 'COUNT(*) AS "$count"'),
321
320
  );
322
- test.websql.fail(
321
+ test.websql.skip(
323
322
  url,
324
323
  'GET',
325
324
  [['Bind', 0]],
326
325
  testFunc(websqlAgg, aliasLicenceFields.join(', ')),
327
326
  );
328
- test.websql.fail(
327
+ test.websql.skip(
329
328
  urlCount,
330
329
  'GET',
331
330
  [['Bind', 0]],
@@ -340,8 +339,8 @@ FROM "pilot"`,
340
339
  ).join(', ');
341
340
  const testFunc = (aggFunc) => (result, sqlEquals) => {
342
341
  it('should select from pilot.*, aggregated licence', () => {
343
- sqlEquals?.(
344
- result,
342
+ sqlEquals(
343
+ result.query,
345
344
  `\
346
345
  SELECT (
347
346
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -359,8 +358,8 @@ FROM "pilot"`,
359
358
  };
360
359
  const url = '/pilot?$expand=licence($filter=is_of__pilot/id eq 1)';
361
360
  test.postgres(url, 'GET', [['Bind', 0]], testFunc(postgresAgg));
362
- test.mysql.fail(url, 'GET', [['Bind', 0]], testFunc(mysqlAgg));
363
- test.websql.fail(url, 'GET', [['Bind', 0]], testFunc(websqlAgg));
361
+ test.mysql.skip(url, 'GET', [['Bind', 0]], testFunc(mysqlAgg));
362
+ test.websql.skip(url, 'GET', [['Bind', 0]], testFunc(websqlAgg));
364
363
  })();
365
364
 
366
365
  (function () {
@@ -370,8 +369,8 @@ FROM "pilot"`,
370
369
  ).join(', ');
371
370
  const testFunc = (aggFunc) => (result, sqlEquals) => {
372
371
  it('should select from pilot.*, aggregated licence', () => {
373
- sqlEquals?.(
374
- result,
372
+ sqlEquals(
373
+ result.query,
375
374
  `\
376
375
  SELECT (
377
376
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -388,8 +387,8 @@ FROM "pilot"`,
388
387
  };
389
388
  const url = '/pilot?$expand=licence($orderby=id)';
390
389
  test.postgres(url, testFunc(postgresAgg));
391
- test.mysql.fail(url, testFunc(mysqlAgg));
392
- test.websql.fail(url, testFunc(websqlAgg));
390
+ test.mysql.skip(url, testFunc(mysqlAgg));
391
+ test.websql.skip(url, testFunc(websqlAgg));
393
392
  })();
394
393
 
395
394
  (function () {
@@ -399,8 +398,8 @@ FROM "pilot"`,
399
398
  ).join(', ');
400
399
  const testFunc = (aggFunc) => (result, sqlEquals) => {
401
400
  it('should select from pilot.*, aggregated count(*) licence and ignore orderby', () => {
402
- sqlEquals?.(
403
- result,
401
+ sqlEquals(
402
+ result.query,
404
403
  `\
405
404
  SELECT (
406
405
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -416,8 +415,8 @@ FROM "pilot"`,
416
415
  };
417
416
  const urlCount = '/pilot?$expand=licence/$count($orderby=id)';
418
417
  test.postgres(urlCount, testFunc(postgresAgg));
419
- test.mysql.fail(urlCount, testFunc(mysqlAgg));
420
- test.websql.fail(urlCount, testFunc(websqlAgg));
418
+ test.mysql.skip(urlCount, testFunc(mysqlAgg));
419
+ test.websql.skip(urlCount, testFunc(websqlAgg));
421
420
  })();
422
421
 
423
422
  (function () {
@@ -427,8 +426,8 @@ FROM "pilot"`,
427
426
  ).join(', ');
428
427
  const testFunc = (aggFunc) => (result, sqlEquals) => {
429
428
  it('should select from pilot.*, aggregated licence', () => {
430
- sqlEquals?.(
431
- result,
429
+ sqlEquals(
430
+ result.query,
432
431
  `\
433
432
  SELECT (
434
433
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -445,8 +444,8 @@ FROM "pilot"`,
445
444
  };
446
445
  const url = '/pilot?$expand=licence($top=10)';
447
446
  test.postgres(url, 'GET', [['Bind', 0]], testFunc(postgresAgg));
448
- test.mysql.fail(url, 'GET', [['Bind', 0]], testFunc(mysqlAgg));
449
- test.websql.fail(url, 'GET', [['Bind', 0]], testFunc(websqlAgg));
447
+ test.mysql.skip(url, 'GET', [['Bind', 0]], testFunc(mysqlAgg));
448
+ test.websql.skip(url, 'GET', [['Bind', 0]], testFunc(websqlAgg));
450
449
  })();
451
450
 
452
451
  (function () {
@@ -456,8 +455,8 @@ FROM "pilot"`,
456
455
  ).join(', ');
457
456
  const testFunc = (aggFunc) => (result, sqlEquals) => {
458
457
  it('should select from pilot.*, aggregated count(*) licence and ignore top', () => {
459
- sqlEquals?.(
460
- result,
458
+ sqlEquals(
459
+ result.query,
461
460
  `\
462
461
  SELECT (
463
462
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -473,8 +472,8 @@ FROM "pilot"`,
473
472
  };
474
473
  const urlCount = '/pilot?$expand=licence/$count($top=10)';
475
474
  test.postgres(urlCount, testFunc(postgresAgg));
476
- test.mysql.fail(urlCount, testFunc(mysqlAgg));
477
- test.websql.fail(urlCount, testFunc(websqlAgg));
475
+ test.mysql.skip(urlCount, testFunc(mysqlAgg));
476
+ test.websql.skip(urlCount, testFunc(websqlAgg));
478
477
  })();
479
478
 
480
479
  (function () {
@@ -484,8 +483,8 @@ FROM "pilot"`,
484
483
  ).join(', ');
485
484
  const testFunc = (aggFunc) => (result, sqlEquals) => {
486
485
  it('should select from pilot.*, aggregated licence', () => {
487
- sqlEquals?.(
488
- result,
486
+ sqlEquals(
487
+ result.query,
489
488
  `\
490
489
  SELECT (
491
490
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -502,8 +501,8 @@ FROM "pilot"`,
502
501
  };
503
502
  const url = '/pilot?$expand=licence($skip=10)';
504
503
  test.postgres(url, 'GET', [['Bind', 0]], testFunc(postgresAgg));
505
- test.mysql.fail(url, 'GET', [['Bind', 0]], testFunc(mysqlAgg));
506
- test.websql.fail(url, 'GET', [['Bind', 0]], testFunc(websqlAgg));
504
+ test.mysql.skip(url, 'GET', [['Bind', 0]], testFunc(mysqlAgg));
505
+ test.websql.skip(url, 'GET', [['Bind', 0]], testFunc(websqlAgg));
507
506
  })();
508
507
 
509
508
  (function () {
@@ -513,8 +512,8 @@ FROM "pilot"`,
513
512
  ).join(', ');
514
513
  const testFunc = (aggFunc) => (result, sqlEquals) => {
515
514
  it('should select from pilot.*, aggregated count(*) licence and ignore skip', () => {
516
- sqlEquals?.(
517
- result,
515
+ sqlEquals(
516
+ result.query,
518
517
  `\
519
518
  SELECT (
520
519
  SELECT ${aggFunc('"pilot.licence".*')} AS "licence"
@@ -530,15 +529,15 @@ FROM "pilot"`,
530
529
  };
531
530
  const urlCount = '/pilot?$expand=licence/$count($skip=10)';
532
531
  test.postgres(urlCount, testFunc(postgresAgg));
533
- test.mysql.fail(urlCount, testFunc(mysqlAgg));
534
- test.websql.fail(urlCount, testFunc(websqlAgg));
532
+ test.mysql.skip(urlCount, testFunc(mysqlAgg));
533
+ test.websql.skip(urlCount, testFunc(websqlAgg));
535
534
  })();
536
535
 
537
536
  (function () {
538
537
  const testFunc = (aggFunc) => (result, sqlEquals) => {
539
538
  it('should select from pilot.*, aggregated(pilot-can fly-plane, aggregated plane)', () => {
540
- sqlEquals?.(
541
- result,
539
+ sqlEquals(
540
+ result.query,
542
541
  `\
543
542
  SELECT (
544
543
  SELECT ${aggFunc('"pilot.pilot-can fly-plane".*')} AS "can_fly__plane"
@@ -554,15 +553,15 @@ FROM "pilot"`,
554
553
  };
555
554
  const url = '/pilot?$expand=can_fly__plane($select=plane)';
556
555
  test.postgres(url, testFunc(postgresAgg));
557
- test.mysql.fail(url, testFunc(mysqlAgg));
558
- test.websql.fail(url, testFunc(websqlAgg));
556
+ test.mysql.skip(url, testFunc(mysqlAgg));
557
+ test.websql.skip(url, testFunc(websqlAgg));
559
558
  })();
560
559
 
561
560
  (function () {
562
561
  const testFunc = (aggFunc) => (result, sqlEquals) => {
563
562
  it('should select from pilot.*, aggregated count(*) pilot-can fly-plane and ignore select', () => {
564
- sqlEquals?.(
565
- result,
563
+ sqlEquals(
564
+ result.query,
566
565
  `\
567
566
  SELECT (
568
567
  SELECT ${aggFunc('"pilot.pilot-can fly-plane".*')} AS "can_fly__plane"
@@ -578,8 +577,8 @@ FROM "pilot"`,
578
577
  };
579
578
  const urlCount = '/pilot?$expand=can_fly__plane/$count($select=plane)';
580
579
  test.postgres(urlCount, testFunc(postgresAgg));
581
- test.mysql.fail(urlCount, testFunc(mysqlAgg));
582
- test.websql.fail(urlCount, testFunc(websqlAgg));
580
+ test.mysql.skip(urlCount, testFunc(mysqlAgg));
581
+ test.websql.skip(urlCount, testFunc(websqlAgg));
583
582
  })();
584
583
 
585
584
  (function () {
@@ -590,8 +589,8 @@ FROM "pilot"`,
590
589
  ).join(', ');
591
590
  const testFunc = (aggFunc) => (result, sqlEquals) => {
592
591
  it('should select from pilot.*, aggregated pilot', () => {
593
- sqlEquals?.(
594
- result,
592
+ sqlEquals(
593
+ result.query,
595
594
  `\
596
595
  SELECT (
597
596
  SELECT ${aggFunc('"pilot.trained-pilot".*')} AS "trained__pilot"
@@ -607,6 +606,6 @@ FROM "pilot"`,
607
606
  };
608
607
  const url = '/pilot?$expand=trained__pilot';
609
608
  test.postgres(url, testFunc(postgresAgg));
610
- test.mysql.fail(url, testFunc(mysqlAgg));
611
- test.websql.fail(url, testFunc(websqlAgg));
609
+ test.mysql.skip(url, testFunc(mysqlAgg));
610
+ test.websql.skip(url, testFunc(websqlAgg));
612
611
  })();