@balena/abstract-sql-compiler 10.6.3-build-tests-update-66ee93652310d4add5b0c8c09843dc052d796f5e-1 → 11.0.0-build-11-x-9f16483079cd561a9fdaa741cd830c2c5eb2065a-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 +57 -2
- package/CHANGELOG.md +8 -2
- package/out/AbstractSQLCompiler.d.ts +15 -16
- package/out/AbstractSQLCompiler.js +50 -62
- package/out/AbstractSQLCompiler.js.map +1 -1
- package/out/AbstractSQLOptimiser.d.ts +1 -1
- package/out/AbstractSQLOptimiser.js +9 -54
- package/out/AbstractSQLOptimiser.js.map +1 -1
- package/out/AbstractSQLRules2SQL.d.ts +2 -2
- package/out/AbstractSQLRules2SQL.js +206 -224
- package/out/AbstractSQLRules2SQL.js.map +1 -1
- package/out/AbstractSQLSchemaOptimiser.d.ts +5 -3
- package/out/AbstractSQLSchemaOptimiser.js +14 -21
- package/out/AbstractSQLSchemaOptimiser.js.map +1 -1
- package/out/referenced-fields.d.ts +1 -1
- package/out/referenced-fields.js +17 -24
- package/out/referenced-fields.js.map +1 -1
- package/package.json +4 -4
- package/src/AbstractSQLCompiler.ts +28 -30
- package/src/AbstractSQLOptimiser.ts +11 -27
- package/src/AbstractSQLRules2SQL.ts +4 -3
- package/src/AbstractSQLSchemaOptimiser.ts +7 -6
- package/src/referenced-fields.ts +4 -4
- package/test/abstract-sql/aggregate-json.ts +1 -1
- package/test/abstract-sql/aggregate.ts +25 -10
- package/test/abstract-sql/and-or-boolean-optimisations.ts +1 -1
- package/test/abstract-sql/case-when-else.ts +5 -2
- package/test/abstract-sql/cast.ts +1 -1
- package/test/abstract-sql/coalesce.ts +1 -1
- package/test/abstract-sql/comparisons.ts +1 -1
- package/test/abstract-sql/dates.ts +10 -4
- package/test/abstract-sql/duration.ts +1 -1
- package/test/abstract-sql/empty-query-optimisations.ts +2 -2
- package/test/abstract-sql/functions_wrapper.ts +1 -1
- package/test/abstract-sql/get-referenced-fields.ts +1 -1
- package/test/abstract-sql/get-rule-referenced-fields.ts +1 -1
- package/test/abstract-sql/insert-query.ts +1 -1
- package/test/abstract-sql/is-distinct.ts +1 -1
- package/test/abstract-sql/joins.ts +1 -1
- package/test/abstract-sql/json.ts +1 -1
- package/test/abstract-sql/math.ts +1 -1
- package/test/abstract-sql/nested-in-optimisations.ts +1 -1
- package/test/abstract-sql/not-not-optimisations.ts +1 -1
- package/test/abstract-sql/schema-checks.ts +1 -1
- package/test/abstract-sql/schema-informative-reference.ts +1 -1
- package/test/abstract-sql/schema-rule-optimization.ts +1 -1
- package/test/abstract-sql/schema-rule-to-check.ts +1 -1
- package/test/abstract-sql/schema-views.ts +37 -2
- package/test/abstract-sql/test.ts +1 -1
- package/test/abstract-sql/text.ts +1 -1
- package/test/odata/expand.ts +3 -3
- package/test/odata/filterby.ts +8 -4
- package/test/odata/orderby.ts +2 -2
- package/test/odata/paging.ts +2 -2
- package/test/odata/resource_parsing.ts +5 -5
- package/test/odata/select.ts +2 -2
- package/test/odata/stress.ts +2 -2
- package/test/odata/test.ts +24 -20
- package/test/sbvr/pilots.ts +3 -3
- package/test/sbvr/reference-type.ts +3 -3
- package/test/sbvr/test.ts +12 -10
package/test/odata/orderby.ts
CHANGED
package/test/odata/paging.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { expect } from 'chai';
|
2
|
-
import type { ExpectationSuccessFn } from './test';
|
3
|
-
import test from './test';
|
4
|
-
import
|
2
|
+
import type { ExpectationSuccessFn } from './test.js';
|
3
|
+
import test from './test.js';
|
4
|
+
import ODataParser from '@balena/odata-parser';
|
5
5
|
import {
|
6
6
|
pilotFields,
|
7
7
|
teamFields,
|
@@ -9,8 +9,8 @@ import {
|
|
9
9
|
aliasPlaneFields,
|
10
10
|
aliasPilotLicenceFields,
|
11
11
|
aliasLicenceFields,
|
12
|
-
} from './fields';
|
13
|
-
import type { SqlResult } from '../../
|
12
|
+
} from './fields.js';
|
13
|
+
import type { SqlResult } from '../../out/AbstractSQLCompiler.js';
|
14
14
|
const aliasPilotFields = aliasFields(
|
15
15
|
'plane.pilot-can fly-plane.pilot',
|
16
16
|
pilotFields,
|
package/test/odata/select.ts
CHANGED
package/test/odata/stress.ts
CHANGED
package/test/odata/test.ts
CHANGED
@@ -1,33 +1,37 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import fs from 'node:fs';
|
2
|
+
import ODataParser from '@balena/odata-parser';
|
3
3
|
import { OData2AbstractSQL } from '@balena/odata-to-abstract-sql';
|
4
|
-
|
4
|
+
import $sbvrTypes from '@balena/sbvr-types';
|
5
|
+
const { default: sbvrTypes } = $sbvrTypes;
|
6
|
+
// @ts-expect-error @balena/sbvr-parser doesn't have types
|
7
|
+
import { SBVRParser } from '@balena/sbvr-parser';
|
8
|
+
// @ts-expect-error @balena/lf-to-abstract-sql doesn't have types
|
9
|
+
import LF2AbstractSQL from '@balena/lf-to-abstract-sql';
|
5
10
|
|
6
|
-
|
11
|
+
const sbvrModel = await fs.promises.readFile(
|
12
|
+
new URL(import.meta.resolve('../model.sbvr')),
|
13
|
+
'utf8',
|
14
|
+
);
|
15
|
+
const typeVocab = await fs.promises.readFile(
|
16
|
+
new URL(import.meta.resolve('@balena/sbvr-types/Type.sbvr')),
|
17
|
+
'utf8',
|
18
|
+
);
|
19
|
+
|
20
|
+
import * as AbstractSQLCompiler from '../../out/AbstractSQLCompiler.js';
|
7
21
|
|
8
22
|
import { expect } from 'chai';
|
9
23
|
import _ from 'lodash';
|
10
24
|
|
11
25
|
const generateClientModel = function (input: string) {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
);
|
18
|
-
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
20
|
-
const SBVRParser = require('@balena/sbvr-parser').SBVRParser.createInstance();
|
21
|
-
SBVRParser.enableReusingMemoizations(SBVRParser._sideEffectingRules);
|
22
|
-
SBVRParser.AddCustomAttribute('Database ID Field:');
|
23
|
-
SBVRParser.AddCustomAttribute('Database Table Name:');
|
24
|
-
SBVRParser.AddBuiltInVocab(typeVocab);
|
26
|
+
const sbvrParser = SBVRParser.createInstance();
|
27
|
+
sbvrParser.enableReusingMemoizations(sbvrParser._sideEffectingRules);
|
28
|
+
sbvrParser.AddCustomAttribute('Database ID Field:');
|
29
|
+
sbvrParser.AddCustomAttribute('Database Table Name:');
|
30
|
+
sbvrParser.AddBuiltInVocab(typeVocab);
|
25
31
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
27
|
-
const LF2AbstractSQL = require('@balena/lf-to-abstract-sql');
|
28
32
|
const LF2AbstractSQLTranslator = LF2AbstractSQL.createTranslator(sbvrTypes);
|
29
33
|
|
30
|
-
const lf =
|
34
|
+
const lf = sbvrParser.matchAll(input, 'Process');
|
31
35
|
const abstractSql = LF2AbstractSQLTranslator(lf, 'Process');
|
32
36
|
return abstractSql;
|
33
37
|
};
|
package/test/sbvr/pilots.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import
|
1
|
+
import fs from 'node:fs';
|
2
2
|
const typeVocab = fs.readFileSync(
|
3
|
-
|
3
|
+
new URL(import.meta.resolve('@balena/sbvr-types/Type.sbvr')),
|
4
4
|
'utf8',
|
5
5
|
);
|
6
|
-
import { getTestHelpers } from './test';
|
6
|
+
import { getTestHelpers } from './test.js';
|
7
7
|
const test = getTestHelpers(typeVocab);
|
8
8
|
|
9
9
|
const modifiedAtTrigger = (tableName: string) => `\
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import
|
2
|
-
import { getTestHelpers } from './test';
|
1
|
+
import fs from 'node:fs';
|
2
|
+
import { getTestHelpers } from './test.js';
|
3
3
|
|
4
4
|
const typeVocab = fs.readFileSync(
|
5
|
-
|
5
|
+
new URL(import.meta.resolve('@balena/sbvr-types/Type.sbvr')),
|
6
6
|
'utf8',
|
7
7
|
);
|
8
8
|
|
package/test/sbvr/test.ts
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
-
import sbvrTypes from '@balena/sbvr-types';
|
2
|
+
import $sbvrTypes from '@balena/sbvr-types';
|
3
|
+
const { default: sbvrTypes } = $sbvrTypes;
|
4
|
+
// @ts-expect-error @balena/sbvr-parser doesn't have types
|
5
|
+
import { SBVRParser } from '@balena/sbvr-parser';
|
6
|
+
// @ts-expect-error @balena/lf-to-abstract-sql doesn't have types
|
7
|
+
import LF2AbstractSQL from '@balena/lf-to-abstract-sql';
|
3
8
|
|
4
9
|
import { expect } from 'chai';
|
5
|
-
import * as AbstractSQLCompiler from '
|
10
|
+
import * as AbstractSQLCompiler from '../../out/AbstractSQLCompiler.js';
|
6
11
|
|
7
12
|
export function getTestHelpers(builtInVocab: string | boolean = false) {
|
8
|
-
|
9
|
-
|
10
|
-
SBVRParser.enableReusingMemoizations(SBVRParser._sideEffectingRules);
|
13
|
+
const sbvrParser = SBVRParser.createInstance();
|
14
|
+
sbvrParser.enableReusingMemoizations(sbvrParser._sideEffectingRules);
|
11
15
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
13
|
-
const LF2AbstractSQL = require('@balena/lf-to-abstract-sql');
|
14
16
|
const LF2AbstractSQLTranslator = LF2AbstractSQL.createTranslator(sbvrTypes);
|
15
17
|
|
16
18
|
if (builtInVocab) {
|
17
|
-
|
19
|
+
sbvrParser.AddBuiltInVocab(builtInVocab);
|
18
20
|
}
|
19
21
|
|
20
22
|
let seSoFar = '';
|
@@ -27,8 +29,8 @@ export function getTestHelpers(builtInVocab: string | boolean = false) {
|
|
27
29
|
it(input, function () {
|
28
30
|
let result;
|
29
31
|
try {
|
30
|
-
|
31
|
-
const lf =
|
32
|
+
sbvrParser.reset();
|
33
|
+
const lf = sbvrParser.matchAll(seSoFar + input, 'Process');
|
32
34
|
const schema = LF2AbstractSQLTranslator(lf, 'Process');
|
33
35
|
result = AbstractSQLCompiler.postgres.compileSchema(schema);
|
34
36
|
} catch (e: any) {
|