@balena/abstract-sql-compiler 11.0.0-build-11-x-45529f014aa1c181f338c0f7348767f2990a9084-1 → 11.0.0
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/package.json +5 -2
- package/.github/workflows/flowzone.yml +0 -21
- package/.husky/pre-commit +0 -2
- package/.versionbot/CHANGELOG.yml +0 -10729
- package/CHANGELOG.md +0 -3515
- package/repo.yml +0 -12
- package/src/abstract-sql-compiler.ts +0 -1138
- package/src/abstract-sql-optimizer.ts +0 -1632
- package/src/abstract-sql-rules-to-sql.ts +0 -1730
- package/src/abstract-sql-schema-optimizer.ts +0 -172
- package/src/referenced-fields.ts +0 -600
- package/test/abstract-sql/aggregate-json.ts +0 -49
- package/test/abstract-sql/aggregate.ts +0 -161
- package/test/abstract-sql/and-or-boolean-optimisations.ts +0 -115
- package/test/abstract-sql/case-when-else.ts +0 -48
- package/test/abstract-sql/cast.ts +0 -25
- package/test/abstract-sql/coalesce.ts +0 -24
- package/test/abstract-sql/comparisons.ts +0 -360
- package/test/abstract-sql/dates.ts +0 -512
- package/test/abstract-sql/duration.ts +0 -56
- package/test/abstract-sql/empty-query-optimisations.ts +0 -54
- package/test/abstract-sql/functions-wrapper.ts +0 -70
- package/test/abstract-sql/get-referenced-fields.ts +0 -674
- package/test/abstract-sql/get-rule-referenced-fields.ts +0 -345
- package/test/abstract-sql/insert-query.ts +0 -22
- package/test/abstract-sql/is-distinct.ts +0 -102
- package/test/abstract-sql/joins.ts +0 -84
- package/test/abstract-sql/json.ts +0 -58
- package/test/abstract-sql/math.ts +0 -467
- package/test/abstract-sql/nested-in-optimisations.ts +0 -200
- package/test/abstract-sql/not-not-optimisations.ts +0 -15
- package/test/abstract-sql/schema-checks.ts +0 -168
- package/test/abstract-sql/schema-informative-reference.ts +0 -420
- package/test/abstract-sql/schema-rule-optimization.ts +0 -120
- package/test/abstract-sql/schema-rule-to-check.ts +0 -393
- package/test/abstract-sql/schema-views.ts +0 -73
- package/test/abstract-sql/test.ts +0 -192
- package/test/abstract-sql/text.ts +0 -168
- package/test/model.sbvr +0 -60
- package/test/odata/expand.ts +0 -674
- package/test/odata/fields.ts +0 -59
- package/test/odata/filterby.ts +0 -1517
- package/test/odata/orderby.ts +0 -96
- package/test/odata/paging.ts +0 -48
- package/test/odata/resource-parsing.ts +0 -568
- package/test/odata/select.ts +0 -119
- package/test/odata/stress.ts +0 -93
- package/test/odata/test.ts +0 -297
- package/test/sbvr/pilots.ts +0 -1097
- package/test/sbvr/reference-type.ts +0 -211
- package/test/sbvr/test.ts +0 -101
- package/tsconfig.build.json +0 -6
- package/tsconfig.json +0 -25
@@ -1,168 +0,0 @@
|
|
1
|
-
import test from './test.js';
|
2
|
-
|
3
|
-
describe('Concatenate', () => {
|
4
|
-
test(
|
5
|
-
[
|
6
|
-
'SelectQuery',
|
7
|
-
[
|
8
|
-
'Select',
|
9
|
-
[['Concatenate', ['EmbeddedText', 'foo'], ['EmbeddedText', 'bar']]],
|
10
|
-
],
|
11
|
-
],
|
12
|
-
(result, sqlEquals) => {
|
13
|
-
it('should produce a valid Concatenate statement', () => {
|
14
|
-
sqlEquals(result, `SELECT ('foo' || 'bar')`);
|
15
|
-
});
|
16
|
-
},
|
17
|
-
);
|
18
|
-
});
|
19
|
-
|
20
|
-
describe('ConcatenateWithSeparator', () => {
|
21
|
-
test(
|
22
|
-
[
|
23
|
-
'SelectQuery',
|
24
|
-
[
|
25
|
-
'Select',
|
26
|
-
[
|
27
|
-
[
|
28
|
-
'ConcatenateWithSeparator',
|
29
|
-
['EmbeddedText', '|'],
|
30
|
-
['EmbeddedText', 'foo'],
|
31
|
-
['EmbeddedText', 'bar'],
|
32
|
-
],
|
33
|
-
],
|
34
|
-
],
|
35
|
-
],
|
36
|
-
(result, sqlEquals) => {
|
37
|
-
it('should produce a valid ConcatenateWithSeparator statement', () => {
|
38
|
-
sqlEquals(result, `SELECT CONCAT_WS('|', 'foo', 'bar')`);
|
39
|
-
});
|
40
|
-
},
|
41
|
-
);
|
42
|
-
});
|
43
|
-
|
44
|
-
describe('Replace', () => {
|
45
|
-
test(
|
46
|
-
[
|
47
|
-
'SelectQuery',
|
48
|
-
[
|
49
|
-
'Select',
|
50
|
-
[
|
51
|
-
[
|
52
|
-
'Replace',
|
53
|
-
['EmbeddedText', 'foobar'],
|
54
|
-
['EmbeddedText', 'bar'],
|
55
|
-
['EmbeddedText', 'baz'],
|
56
|
-
],
|
57
|
-
],
|
58
|
-
],
|
59
|
-
],
|
60
|
-
(result, sqlEquals) => {
|
61
|
-
it('should produce a valid Replace statement', () => {
|
62
|
-
sqlEquals(result, `SELECT REPLACE('foobar', 'bar', 'baz')`);
|
63
|
-
});
|
64
|
-
},
|
65
|
-
);
|
66
|
-
});
|
67
|
-
|
68
|
-
describe('CharacterLength', () => {
|
69
|
-
test(
|
70
|
-
[
|
71
|
-
'SelectQuery',
|
72
|
-
['Select', [['CharacterLength', ['EmbeddedText', 'foobar']]]],
|
73
|
-
],
|
74
|
-
(result, sqlEquals) => {
|
75
|
-
it('should produce a valid CharacterLength statement', () => {
|
76
|
-
sqlEquals(result, `SELECT LENGTH('foobar')`);
|
77
|
-
});
|
78
|
-
},
|
79
|
-
);
|
80
|
-
});
|
81
|
-
|
82
|
-
describe('StrPos', () => {
|
83
|
-
test(
|
84
|
-
[
|
85
|
-
'SelectQuery',
|
86
|
-
[
|
87
|
-
'Select',
|
88
|
-
[['StrPos', ['EmbeddedText', 'foobar'], ['EmbeddedText', 'b']]],
|
89
|
-
],
|
90
|
-
],
|
91
|
-
(result, sqlEquals) => {
|
92
|
-
it('should produce a valid StrPos statement', () => {
|
93
|
-
sqlEquals(result, `SELECT STRPOS('foobar', 'b')`);
|
94
|
-
});
|
95
|
-
},
|
96
|
-
);
|
97
|
-
});
|
98
|
-
|
99
|
-
describe('Substring', () => {
|
100
|
-
test(
|
101
|
-
[
|
102
|
-
'SelectQuery',
|
103
|
-
[
|
104
|
-
'Select',
|
105
|
-
[
|
106
|
-
[
|
107
|
-
'Substring',
|
108
|
-
['EmbeddedText', 'foobar'],
|
109
|
-
['Number', 0],
|
110
|
-
['Number', 5],
|
111
|
-
],
|
112
|
-
],
|
113
|
-
],
|
114
|
-
],
|
115
|
-
(result, sqlEquals) => {
|
116
|
-
it('should produce a valid Substring statement', () => {
|
117
|
-
sqlEquals(result, `SELECT SUBSTRING('foobar', 0, 5)`);
|
118
|
-
});
|
119
|
-
},
|
120
|
-
);
|
121
|
-
});
|
122
|
-
|
123
|
-
describe('Right', () => {
|
124
|
-
test(
|
125
|
-
[
|
126
|
-
'SelectQuery',
|
127
|
-
['Select', [['Right', ['EmbeddedText', 'foobar'], ['Number', 1]]]],
|
128
|
-
],
|
129
|
-
(result, sqlEquals) => {
|
130
|
-
it('should produce a valid Right statement', () => {
|
131
|
-
sqlEquals(result, `SELECT RIGHT('foobar', 1)`);
|
132
|
-
});
|
133
|
-
},
|
134
|
-
);
|
135
|
-
});
|
136
|
-
|
137
|
-
describe('Lower', () => {
|
138
|
-
test(
|
139
|
-
['SelectQuery', ['Select', [['Lower', ['EmbeddedText', 'FOOBAR']]]]],
|
140
|
-
(result, sqlEquals) => {
|
141
|
-
it('should produce a valid Lower statement', () => {
|
142
|
-
sqlEquals(result, `SELECT LOWER('FOOBAR')`);
|
143
|
-
});
|
144
|
-
},
|
145
|
-
);
|
146
|
-
});
|
147
|
-
|
148
|
-
describe('Upper', () => {
|
149
|
-
test(
|
150
|
-
['SelectQuery', ['Select', [['Upper', ['EmbeddedText', 'foobar']]]]],
|
151
|
-
(result, sqlEquals) => {
|
152
|
-
it('should produce a valid Upper statement', () => {
|
153
|
-
sqlEquals(result, `SELECT UPPER('foobar')`);
|
154
|
-
});
|
155
|
-
},
|
156
|
-
);
|
157
|
-
});
|
158
|
-
|
159
|
-
describe('Trim', () => {
|
160
|
-
test(
|
161
|
-
['SelectQuery', ['Select', [['Trim', ['EmbeddedText', ' foobar ']]]]],
|
162
|
-
(result, sqlEquals) => {
|
163
|
-
it('should produce a valid Trim statement', () => {
|
164
|
-
sqlEquals(result, `SELECT TRIM(' foobar ')`);
|
165
|
-
});
|
166
|
-
},
|
167
|
-
);
|
168
|
-
});
|
package/test/model.sbvr
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
Term: name
|
2
|
-
Concept Type: Short Text (Type)
|
3
|
-
|
4
|
-
Term: age
|
5
|
-
Concept Type: Integer (Type)
|
6
|
-
|
7
|
-
Term: favourite colour
|
8
|
-
Concept Type: Color (Type)
|
9
|
-
|
10
|
-
Term: hire date
|
11
|
-
Concept Type: Date Time (Type)
|
12
|
-
|
13
|
-
Term: licence
|
14
|
-
|
15
|
-
Fact type: licence has name
|
16
|
-
Necessity: each licence has exactly one name
|
17
|
-
|
18
|
-
Term: team
|
19
|
-
Database ID Field: favourite colour
|
20
|
-
Fact type: team has favourite colour
|
21
|
-
Necessity: each team has exactly one favourite colour
|
22
|
-
|
23
|
-
Term: plane
|
24
|
-
Synonym: aircraft
|
25
|
-
|
26
|
-
Fact type: plane has name
|
27
|
-
Necessity: each plane has exactly one name
|
28
|
-
|
29
|
-
Term: person
|
30
|
-
|
31
|
-
Term: pilot
|
32
|
-
Concept Type: person
|
33
|
-
|
34
|
-
Fact type: pilot is experienced
|
35
|
-
|
36
|
-
Fact type: pilot has name
|
37
|
-
Necessity: each pilot has exactly one name
|
38
|
-
|
39
|
-
Fact type: pilot has age
|
40
|
-
Necessity: each pilot has exactly one age
|
41
|
-
|
42
|
-
Fact type: pilot has favourite colour
|
43
|
-
Necessity: each pilot has exactly one favourite colour
|
44
|
-
|
45
|
-
Fact type: pilot can fly plane
|
46
|
-
Synonymous Form: plane can be flown by pilot
|
47
|
-
|
48
|
-
Fact type: pilot is on team
|
49
|
-
Synonymous Form: team includes pilot
|
50
|
-
Necessity: each pilot is on exactly one team
|
51
|
-
|
52
|
-
Fact type: pilot has licence
|
53
|
-
Necessity: each pilot has exactly one licence
|
54
|
-
|
55
|
-
Fact type: pilot has hire date
|
56
|
-
Necessity: each pilot has exactly one hire date
|
57
|
-
|
58
|
-
Fact type: pilot1 was trained by pilot2
|
59
|
-
Synonymous Form: pilot2 trained pilot1
|
60
|
-
Necessity: each pilot was trained by exactly one pilot
|