@balena/odata-to-abstract-sql
Advanced tools
Comparing version 6.1.0 to 6.1.1-build-fisehara-update-dependencies-b84e6d41bf3e2f72c44bc1e17df83d15413be7e5-1
338
CHANGELOG.md
@@ -7,2 +7,340 @@ # Change Log | ||
## 6.1.1 - 2023-10-17 | ||
<details> | ||
<summary> Update dependencies eslint, sbvrTypes, abstract-sql-compiler [Harald Fischer] </summary> | ||
> ### abstract-sql-compiler-9.0.3 - 2023-08-09 | ||
> | ||
> | ||
> <details> | ||
> <summary> Update @balena/sbvr-types to 6.0.0 [Otávio Jacobi] </summary> | ||
> | ||
>> #### sbvr-types-6.0.0 - 2023-08-09 | ||
>> | ||
>> * Change contents to snake_case [Otávio Jacobi] | ||
>> | ||
>> #### sbvr-types-5.2.0 - 2023-08-08 | ||
>> | ||
>> * Expose WebResource as WebResourceType [Otávio Jacobi] | ||
>> | ||
>> #### sbvr-types-5.1.0 - 2023-08-03 | ||
>> | ||
>> * Adds WebResource type [Otávio Jacobi] | ||
>> | ||
> | ||
> </details> | ||
> | ||
> | ||
> ### abstract-sql-compiler-9.0.2 - 2023-05-16 | ||
> | ||
> | ||
> <details> | ||
> <summary> Update @balena/sbvr-types to 5.0.0 [Pagan Gazzard] </summary> | ||
> | ||
>> #### sbvr-types-5.0.0 - 2023-05-16 | ||
>> | ||
>> * Switch from `export =` to `export default` [Pagan Gazzard] | ||
>> | ||
>> #### sbvr-types-4.0.2 - 2023-05-03 | ||
>> | ||
>> * Improve typings [Pagan Gazzard] | ||
>> | ||
>> #### sbvr-types-4.0.1 - 2023-05-02 | ||
>> | ||
>> * boolean: Avoid unnecessary array creation to reduce GCs [Thodoris Greasidis] | ||
>> | ||
> | ||
> </details> | ||
> | ||
> | ||
> ### abstract-sql-compiler-9.0.1 - 2023-05-15 | ||
> | ||
> * Fix TS errors for the latest sbvrTypes [Thodoris Greasidis] | ||
> | ||
> ### abstract-sql-compiler-9.0.0 - 2023-05-02 | ||
> | ||
> * Drop `require-npm4-to-publish` as `engines` used [fisehara] | ||
> | ||
> <details> | ||
> <summary> Update @balena/odata-to-abstract-sql to 6.x [Pagan Gazzard] </summary> | ||
> | ||
>> #### odata-to-abstract-sql-6.0.1 - 2023-04-27 | ||
>> | ||
>> | ||
>> <details> | ||
>> <summary> Update dependencies [Pagan Gazzard] </summary> | ||
>> | ||
>>> ##### odata-parser-3.0.0 - 2023-04-26 | ||
>>> | ||
>>> * Use optional chaining operator [Pagan Gazzard] | ||
>>> * Set minimum supported nodejs version to 16.13.0 [Pagan Gazzard] | ||
>>> | ||
>>> ##### odata-parser-2.5.0 - 2023-04-26 | ||
>>> | ||
>>> * Update to peggy 3 and make us of the repetition operator [Pagan Gazzard] | ||
>>> | ||
>>> ##### sbvr-types-4.0.0 - 2023-04-26 | ||
>>> | ||
>>> * Add test cases for Objects in JSON validate [fisehara] | ||
>>> * Drop `require-npm4-to-publish` devDependency [fisehara] | ||
>>> * Set minimum supported nodejs version to 16.13.0 and tsconfig to es2021 [Pagan Gazzard] | ||
>>> * Switch `JSON` to use `JSON` db type instead of `TEXT` [Pagan Gazzard] | ||
>>> * Switch `Boolean` to use `BOOLEAN` db type instead of `INTEGER` [Pagan Gazzard] | ||
>>> * Assert that JSON input typeof is object [Josh Bowling] | ||
>>> | ||
>> | ||
>> </details> | ||
>> | ||
>> | ||
>> #### odata-to-abstract-sql-6.0.0 - 2023-04-26 | ||
>> | ||
>> * Set minimum supported nodejs version to 16.13.0 and tsconfig to es2021 [Pagan Gazzard] | ||
>> * Switch `AggregateJSON` to use the newer `ReferencedField` format [Pagan Gazzard] | ||
>> | ||
>> #### odata-to-abstract-sql-5.9.6 - 2023-04-25 | ||
>> | ||
>> * Collapse `AliasedFunction` into `FunctionMatch` [Pagan Gazzard] | ||
>> | ||
>> #### odata-to-abstract-sql-5.9.5 - 2023-04-25 | ||
>> | ||
>> | ||
>> <details> | ||
>> <summary> Improve typings [Pagan Gazzard] </summary> | ||
>> | ||
>>> ##### abstract-sql-compiler-8.4.1 - 2023-04-25 | ||
>>> | ||
>>> * Add much finer grained typings for abstract-sql-optimizer [Pagan Gazzard] | ||
>>> | ||
>> | ||
>> </details> | ||
>> | ||
>> | ||
>> #### odata-to-abstract-sql-5.9.4 - 2023-04-24 | ||
>> | ||
>> | ||
>> <details> | ||
>> <summary> Update dependencies [Pagan Gazzard] </summary> | ||
>> | ||
>>> ##### abstract-sql-compiler-8.4.0 - 2023-04-24 | ||
>>> | ||
>>> * Add support for using field type nodes with an AggregateJSON node [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.13 - 2023-04-24 | ||
>>> | ||
>>> * Deprecate `AliasableFromTypeNodes` type as it's redundant [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.12 - 2023-04-17 | ||
>>> | ||
>>> * Revert tightening of `OrderBy` to only field nodes [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.11 - 2023-04-13 | ||
>>> | ||
>>> * Do not allow ON clauses for CROSS JOIN as it is invalid [Pagan Gazzard] | ||
>>> * Stop accepting `ExtractJSONPathAsText`/`ToJSON` as unknown node types [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.10 - 2023-04-13 | ||
>>> | ||
>>> * Fix DateNode/AnyNode typings [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.9 - 2023-04-13 | ||
>>> | ||
>>> | ||
>>> <details> | ||
>>> <summary> Update dependencies [Pagan Gazzard] </summary> | ||
>>> | ||
>>>> ###### sbvr-types-3.5.0 - 2023-03-21 | ||
>>>> | ||
>>>> * Add Big Serial type [Josh Bowling] | ||
>>>> | ||
>>>> ###### sbvr-types-3.4.19 - 2022-12-08 | ||
>>>> | ||
>>>> * Flowzone: Allow external contributions [Josh Bowling] | ||
>>>> | ||
>>> | ||
>>> </details> | ||
>>> | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.8 - 2023-04-12 | ||
>>> | ||
>>> * Improve typings [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.7 - 2023-04-12 | ||
>>> | ||
>>> * Remove typing for non-existent JSON node [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.6 - 2023-04-12 | ||
>>> | ||
>>> * Tighten the `isXValue` function typings [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.5 - 2023-04-12 | ||
>>> | ||
>>> * Correctly treat `Value` nodes as rewritten to `Text` by the optimizer [Pagan Gazzard] | ||
>>> * Add EmbeddedTextNode typing [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.4 - 2023-04-12 | ||
>>> | ||
>>> * Enforce the first argument of ExtractJSONPathAsText is a JSON type node [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.3 - 2023-04-12 | ||
>>> | ||
>>> * Improve node typings [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.2 - 2023-04-12 | ||
>>> | ||
>>> * Add more node typings [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.1 - 2023-04-12 | ||
>>> | ||
>>> * Add more node typings [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.3.0 - 2023-04-11 | ||
>>> | ||
>>> * Support boolean nodes in a ValuesNode [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.2.0 - 2023-04-11 | ||
>>> | ||
>>> * Add `Between` node type [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.1.0 - 2023-04-11 | ||
>>> | ||
>>> * Add `BitwiseAnd`/`BitwiseShiftRight` node types [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.0.2 - 2023-04-06 | ||
>>> | ||
>>> * Add `NotInNode` type [Pagan Gazzard] | ||
>>> * Add `IsDistinctFromNode`/`IsNotDistinctFromNode` types [Pagan Gazzard] | ||
>>> * Add `CharacterLengthNode` type [Pagan Gazzard] | ||
>>> | ||
>>> ##### abstract-sql-compiler-8.0.1 - 2023-04-06 | ||
>>> | ||
>>> * Adds Cast node type to tree parsing [Otávio Jacobi] | ||
>>> | ||
>>> ##### odata-parser-2.4.6 - 2023-02-24 | ||
>>> | ||
>>> * Improve typings [Pagan Gazzard] | ||
>>> | ||
>>> ##### odata-parser-2.4.5 - 2023-02-23 | ||
>>> | ||
>>> * Use const/let as appropriate [Pagan Gazzard] | ||
>>> | ||
>>> ##### odata-parser-2.4.4 - 2023-02-23 | ||
>>> | ||
>>> * Use shorthand object notation [Pagan Gazzard] | ||
>>> | ||
>>> ##### odata-parser-2.4.3 - 2023-02-23 | ||
>>> | ||
>>> * Update dependencies [Pagan Gazzard] | ||
>>> | ||
>> | ||
>> </details> | ||
>> | ||
>> | ||
> | ||
> </details> | ||
> | ||
> * Remove support for the legacy AggregateJSON format of `[tableName, fieldName]` [Pagan Gazzard] | ||
> * Remove support for the legacy boolean format of `true|false` [Pagan Gazzard] | ||
> * Set minimum supported nodejs version to 16.13.0 and tsconfig to es2021 [Pagan Gazzard] | ||
> * Remove support for the legacy alias format of `[node, alias]` [Pagan Gazzard] | ||
> * Remove support for the legacy table format of `tableName` [Pagan Gazzard] | ||
> * Remove support for the legacy null formats of `null` and `'Null'` [Pagan Gazzard] | ||
> * Reflect the usage of BOOLEAN db type [Pagan Gazzard] | ||
> | ||
> <details> | ||
> <summary> Update @balena/sbvr-types to 4.x [Pagan Gazzard] </summary> | ||
> | ||
>> #### sbvr-types-4.0.0 - 2023-04-26 | ||
>> | ||
>> * Add test cases for Objects in JSON validate [fisehara] | ||
>> * Drop `require-npm4-to-publish` devDependency [fisehara] | ||
>> * Set minimum supported nodejs version to 16.13.0 and tsconfig to es2021 [Pagan Gazzard] | ||
>> * Switch `JSON` to use `JSON` db type instead of `TEXT` [Pagan Gazzard] | ||
>> * Switch `Boolean` to use `BOOLEAN` db type instead of `INTEGER` [Pagan Gazzard] | ||
>> * Assert that JSON input typeof is object [Josh Bowling] | ||
>> | ||
> | ||
> </details> | ||
> | ||
> | ||
> ### abstract-sql-compiler-8.5.0 - 2023-04-27 | ||
> | ||
> * Use native `StartsWith` node type for postgres [Pagan Gazzard] | ||
> * Convert `EscapeForLike` into a standalone node type [Pagan Gazzard] | ||
> | ||
> ### lf-to-abstract-sql-5.0.1 - 2023-05-16 | ||
> | ||
> | ||
> <details> | ||
> <summary> Update @balena/sbvr-types to 5.0.0 [Pagan Gazzard] </summary> | ||
> | ||
>> #### sbvr-types-5.0.0 - 2023-05-16 | ||
>> | ||
>> * Switch from `export =` to `export default` [Pagan Gazzard] | ||
>> | ||
>> #### sbvr-types-4.0.2 - 2023-05-03 | ||
>> | ||
>> * Improve typings [Pagan Gazzard] | ||
>> | ||
>> #### sbvr-types-4.0.1 - 2023-05-02 | ||
>> | ||
>> * boolean: Avoid unnecessary array creation to reduce GCs [Thodoris Greasidis] | ||
>> | ||
>> #### sbvr-types-4.0.0 - 2023-04-26 | ||
>> | ||
>> * Add test cases for Objects in JSON validate [fisehara] | ||
>> * Drop `require-npm4-to-publish` devDependency [fisehara] | ||
>> * Set minimum supported nodejs version to 16.13.0 and tsconfig to es2021 [Pagan Gazzard] | ||
>> * Switch `JSON` to use `JSON` db type instead of `TEXT` [Pagan Gazzard] | ||
>> * Switch `Boolean` to use `BOOLEAN` db type instead of `INTEGER` [Pagan Gazzard] | ||
>> * Assert that JSON input typeof is object [Josh Bowling] | ||
>> | ||
>> #### sbvr-types-3.5.0 - 2023-03-21 | ||
>> | ||
>> * Add Big Serial type [Josh Bowling] | ||
>> | ||
>> #### sbvr-types-3.4.19 - 2022-12-08 | ||
>> | ||
>> * Flowzone: Allow external contributions [Josh Bowling] | ||
>> | ||
> | ||
> </details> | ||
> | ||
> | ||
> ### odata-parser-3.0.1 - 2023-09-25 | ||
> | ||
> * Allow running CI on external PRs [Pagan Gazzard] | ||
> | ||
> ### sbvr-types-6.1.0 - 2023-10-03 | ||
> | ||
> * Add checksum to WebResource [Otávio Jacobi] | ||
> | ||
> ### sbvr-types-6.0.0 - 2023-08-09 | ||
> | ||
> * Change contents to snake_case [Otávio Jacobi] | ||
> | ||
> ### sbvr-types-5.2.0 - 2023-08-08 | ||
> | ||
> * Expose WebResource as WebResourceType [Otávio Jacobi] | ||
> | ||
> ### sbvr-types-5.1.0 - 2023-08-03 | ||
> | ||
> * Adds WebResource type [Otávio Jacobi] | ||
> | ||
> ### sbvr-types-5.0.0 - 2023-05-16 | ||
> | ||
> * Switch from `export =` to `export default` [Pagan Gazzard] | ||
> | ||
> ### sbvr-types-4.0.2 - 2023-05-03 | ||
> | ||
> * Improve typings [Pagan Gazzard] | ||
> | ||
> ### sbvr-types-4.0.1 - 2023-05-02 | ||
> | ||
> * boolean: Avoid unnecessary array creation to reduce GCs [Thodoris Greasidis] | ||
> | ||
</details> | ||
## 6.1.0 - 2023-08-16 | ||
@@ -9,0 +347,0 @@ |
@@ -90,3 +90,3 @@ import * as memoize from 'memoizee'; | ||
FunctionMatch<T extends string, U extends string>(name: T, match: any, sqlName: U): [U, ...AnyTypeNodes[]]; | ||
FunctionMatch<T extends string, U extends string>(name: T, match: any): [Capitalize<T>, ...AnyTypeNodes[]]; | ||
FunctionMatch<T extends string>(name: T, match: any): [Capitalize<T>, ...AnyTypeNodes[]]; | ||
Operand(match: any): BindNode | NullNode | BooleanTypeNodes | NumberTypeNodes | TextTypeNodes | StrictDateTypeNodes | DurationTypeNodes; | ||
@@ -93,0 +93,0 @@ Math(match: any): AddNode | SubtractNode | MultiplyNode | DivideNode | undefined; |
@@ -203,3 +203,3 @@ "use strict"; | ||
switch (method) { | ||
case 'PUT': | ||
case 'PUT': { | ||
this.putReset(); | ||
@@ -213,2 +213,3 @@ const insertQuery = this.PathSegment('PUT-INSERT', bodyKeys, path); | ||
break; | ||
} | ||
case 'GET': | ||
@@ -711,6 +712,7 @@ tree = query.compile('SelectQuery'); | ||
case 'lt': | ||
case 'le': | ||
case 'le': { | ||
const op1 = this.Operand(rest[0]); | ||
const op2 = this.Operand(rest[1]); | ||
return [comparison[type], op1, op2]; | ||
} | ||
case 'and': | ||
@@ -722,6 +724,7 @@ case 'or': | ||
]; | ||
case 'not': | ||
case 'not': { | ||
const bool = this.BooleanMatch(rest[0]); | ||
return ['Not', bool]; | ||
case 'in': | ||
} | ||
case 'in': { | ||
return [ | ||
@@ -732,3 +735,4 @@ 'In', | ||
]; | ||
case 'call': | ||
} | ||
case 'call': { | ||
const { method } = match[1]; | ||
@@ -748,2 +752,3 @@ switch (method) { | ||
} | ||
} | ||
default: | ||
@@ -877,3 +882,3 @@ if (optional) { | ||
const { method } = prop.method[1]; | ||
if (!this.methods.hasOwnProperty(method)) { | ||
if (!Object.prototype.hasOwnProperty.call(this.methods, method)) { | ||
throw new SyntaxError(`Method ${method} is unknown`); | ||
@@ -941,3 +946,2 @@ } | ||
case 'day': | ||
case 'day': | ||
case 'hour': | ||
@@ -990,6 +994,7 @@ case 'minute': | ||
return this.FunctionMatch(method, match); | ||
case 'substring': | ||
case 'substring': { | ||
const fn = this.FunctionMatch(method, match); | ||
fn[2] = ['Add', fn[2], ['Number', 1]]; | ||
return fn; | ||
} | ||
default: | ||
@@ -996,0 +1001,0 @@ if (optional) { |
{ | ||
"name": "@balena/odata-to-abstract-sql", | ||
"version": "6.1.0", | ||
"version": "6.1.1-build-fisehara-update-dependencies-b84e6d41bf3e2f72c44bc1e17df83d15413be7e5-1", | ||
"description": "A consumer of the OData parser, written in OMeta", | ||
@@ -18,6 +18,6 @@ "main": "out/odata-to-abstract-sql.js", | ||
"dependencies": { | ||
"@balena/abstract-sql-compiler": "^8.4.1", | ||
"@balena/odata-parser": "^3.0.0", | ||
"@types/lodash": "^4.14.194", | ||
"@types/memoizee": "^0.4.8", | ||
"@balena/abstract-sql-compiler": "^9.0.3", | ||
"@balena/odata-parser": "^3.0.1", | ||
"@types/lodash": "^4.14.199", | ||
"@types/memoizee": "^0.4.9", | ||
"@types/string-hash": "^1.1.1", | ||
@@ -29,17 +29,17 @@ "lodash": "^4.17.21", | ||
"devDependencies": { | ||
"@balena/lf-to-abstract-sql": "^5.0.0", | ||
"@balena/lint": "^6.2.2", | ||
"@balena/lf-to-abstract-sql": "^5.0.1", | ||
"@balena/lint": "^7.2.0", | ||
"@balena/sbvr-parser": "^1.4.3", | ||
"@balena/sbvr-types": "^4.0.0", | ||
"@types/chai": "^4.3.4", | ||
"@types/chai-things": "0.0.35", | ||
"@types/mocha": "^10.0.1", | ||
"chai": "^4.3.7", | ||
"@balena/sbvr-types": "^6.1.0", | ||
"@types/chai": "^4.3.8", | ||
"@types/chai-things": "0.0.36", | ||
"@types/mocha": "^10.0.2", | ||
"chai": "^4.3.10", | ||
"chai-things": "~0.2.0", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.2.2", | ||
"lint-staged": "^15.0.1", | ||
"mocha": "^10.2.0", | ||
"require-npm4-to-publish": "^1.0.0", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.4" | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -58,4 +58,4 @@ "mocha": { | ||
"versionist": { | ||
"publishedAt": "2023-08-16T14:48:08.294Z" | ||
"publishedAt": "2023-10-17T11:30:27.511Z" | ||
} | ||
} |
@@ -411,3 +411,3 @@ import * as _ from 'lodash'; | ||
switch (method) { | ||
case 'PUT': | ||
case 'PUT': { | ||
// For PUT the initial pass generates the update query, | ||
@@ -424,2 +424,3 @@ // so we run it through the parser a second time to get the insert query, | ||
break; | ||
} | ||
case 'GET': | ||
@@ -1065,3 +1066,3 @@ tree = query.compile('SelectQuery'); | ||
case 'lt': | ||
case 'le': | ||
case 'le': { | ||
const op1 = this.Operand(rest[0]); | ||
@@ -1076,2 +1077,3 @@ const op2 = this.Operand(rest[1]); | ||
| LessThanOrEqualNode; | ||
} | ||
case 'and': | ||
@@ -1083,6 +1085,7 @@ case 'or': | ||
] as AndNode | OrNode; | ||
case 'not': | ||
case 'not': { | ||
const bool = this.BooleanMatch(rest[0]); | ||
return ['Not', bool]; | ||
case 'in': | ||
} | ||
case 'in': { | ||
return [ | ||
@@ -1093,3 +1096,4 @@ 'In', | ||
] as InNode; | ||
case 'call': | ||
} | ||
case 'call': { | ||
const { method } = match[1]; | ||
@@ -1112,2 +1116,3 @@ switch (method) { | ||
} | ||
} | ||
default: | ||
@@ -1138,3 +1143,3 @@ if (optional) { | ||
): [U, ...AnyTypeNodes[]]; | ||
FunctionMatch<T extends string, U extends string>( | ||
FunctionMatch<T extends string>( | ||
name: T, | ||
@@ -1304,3 +1309,3 @@ match: any, | ||
const { method } = prop.method[1]; | ||
if (!this.methods.hasOwnProperty(method)) { | ||
if (!Object.prototype.hasOwnProperty.call(this.methods, method)) { | ||
throw new SyntaxError(`Method ${method} is unknown`); | ||
@@ -1369,3 +1374,2 @@ } | ||
case 'day': | ||
case 'day': | ||
case 'hour': | ||
@@ -1425,3 +1429,3 @@ case 'minute': | ||
return this.FunctionMatch(method, match) as TrimNode | ReplaceNode; | ||
case 'substring': | ||
case 'substring': { | ||
const fn = this.FunctionMatch(method, match) as SubstringNode; | ||
@@ -1431,2 +1435,3 @@ // First parameter needs to be increased by 1. | ||
return fn; | ||
} | ||
default: | ||
@@ -1433,0 +1438,0 @@ if (optional) { |
@@ -5,2 +5,5 @@ import * as _ from 'lodash'; | ||
import * as fs from 'fs'; | ||
import { createTranslator } from '@balena/lf-to-abstract-sql'; | ||
import { SBVRParser } from '@balena/sbvr-parser'; | ||
import * as sbvrTypes from '@balena/sbvr-types'; | ||
@@ -87,3 +90,2 @@ chai.use(chaiThings); | ||
const generateClientModel = function (input) { | ||
const sbvrTypes = require('@balena/sbvr-types'); | ||
const typeVocab = fs.readFileSync( | ||
@@ -94,12 +96,13 @@ require.resolve('@balena/sbvr-types/Type.sbvr'), | ||
const SBVRParser = require('@balena/sbvr-parser').SBVRParser.createInstance(); | ||
SBVRParser.enableReusingMemoizations(SBVRParser._sideEffectingRules); | ||
SBVRParser.AddCustomAttribute('Database ID Field:'); | ||
SBVRParser.AddCustomAttribute('Database Table Name:'); | ||
SBVRParser.AddBuiltInVocab(typeVocab); | ||
const SBVRParserInstance = SBVRParser.createInstance(); | ||
SBVRParserInstance.enableReusingMemoizations( | ||
SBVRParserInstance._sideEffectingRules, | ||
); | ||
SBVRParserInstance.AddCustomAttribute('Database ID Field:'); | ||
SBVRParserInstance.AddCustomAttribute('Database Table Name:'); | ||
SBVRParserInstance.AddBuiltInVocab(typeVocab); | ||
const LF2AbstractSQL = require('@balena/lf-to-abstract-sql'); | ||
const LF2AbstractSQLTranslator = LF2AbstractSQL.createTranslator(sbvrTypes); | ||
const LF2AbstractSQLTranslator = createTranslator(sbvrTypes); | ||
const lf = SBVRParser.matchAll(input, 'Process'); | ||
const lf = SBVRParserInstance.matchAll(input, 'Process'); | ||
return LF2AbstractSQLTranslator(lf, 'Process'); | ||
@@ -174,3 +177,3 @@ }; | ||
let previousResource = _(parentAlias).split('.').last(); | ||
for (let resourceName of fieldParts.slice(0, -1)) { | ||
for (const resourceName of fieldParts.slice(0, -1)) { | ||
const sqlName = odataNameToSqlName(resourceName); | ||
@@ -269,3 +272,3 @@ const sqlNameParts = sqlName.split('-'); | ||
.replace(/(^|[^-])pilot/, '$1pi') | ||
.replace(/trained\-pilot/, 'tr-pi'); | ||
.replace(/trained-pilot/, 'tr-pi'); | ||
} | ||
@@ -275,4 +278,4 @@ return alias; | ||
export let aliasFields = (function () { | ||
var aliasField = function (resourceAlias, verb, field) { | ||
export const aliasFields = (function () { | ||
const aliasField = function (resourceAlias, verb, field) { | ||
if (field[0] === 'ReferencedField') { | ||
@@ -301,3 +304,3 @@ return [ | ||
export let pilotFields = [ | ||
export const pilotFields = [ | ||
['Alias', ['ReferencedField', 'pilot', 'created at'], 'created_at'], | ||
@@ -325,3 +328,3 @@ ['Alias', ['ReferencedField', 'pilot', 'modified at'], 'modified_at'], | ||
export let licenceFields = [ | ||
export const licenceFields = [ | ||
['Alias', ['ReferencedField', 'licence', 'created at'], 'created_at'], | ||
@@ -333,3 +336,3 @@ ['Alias', ['ReferencedField', 'licence', 'modified at'], 'modified_at'], | ||
export let planeFields = [ | ||
export const planeFields = [ | ||
['Alias', ['ReferencedField', 'plane', 'created at'], 'created_at'], | ||
@@ -341,3 +344,3 @@ ['Alias', ['ReferencedField', 'plane', 'modified at'], 'modified_at'], | ||
export let pilotCanFlyPlaneFields = [ | ||
export const pilotCanFlyPlaneFields = [ | ||
[ | ||
@@ -362,3 +365,3 @@ 'Alias', | ||
export let teamFields = [ | ||
export const teamFields = [ | ||
['Alias', ['ReferencedField', 'team', 'created at'], 'created_at'], | ||
@@ -373,2 +376,2 @@ ['Alias', ['ReferencedField', 'team', 'modified at'], 'modified_at'], | ||
export let $count = [['Alias', ['Count', '*'], '$count']]; | ||
export const $count = [['Alias', ['Count', '*'], '$count']]; |
@@ -203,3 +203,3 @@ import * as _ from 'lodash'; | ||
.find({ 0: 'SelectQuery' }) | ||
// @ts-expect-error | ||
// @ts-expect-error AbstractSql array being an array having .find | ||
.find({ 0: 'From' }) | ||
@@ -236,3 +236,3 @@ .find({ 2: 'pilot.licence' }) | ||
.find({ 0: 'SelectQuery' }) | ||
// @ts-expect-error | ||
// @ts-expect-error AbstractSql array being an array having .find | ||
.find({ 0: 'From' }) | ||
@@ -280,3 +280,3 @@ .find({ 2: 'pilot.licence' }) | ||
.find({ 0: 'SelectQuery' }) | ||
// @ts-expect-error | ||
// @ts-expect-error AbstractSql array being an array having .find | ||
.find({ 0: 'From' }) | ||
@@ -300,3 +300,3 @@ .find({ 2: 'pilot.licence' }) | ||
.find({ 0: 'SelectQuery' }) | ||
// @ts-expect-error | ||
// @ts-expect-error AbstractSql array being an array having .find | ||
.find({ 0: 'From' }) | ||
@@ -320,3 +320,3 @@ .find({ 2: 'pilot.licence' }) | ||
.find({ 0: 'SelectQuery' }) | ||
// @ts-expect-error | ||
// @ts-expect-error AbstractSql array being an array having .find | ||
.find({ 0: 'From' }) | ||
@@ -340,3 +340,3 @@ .find({ 2: 'pilot.licence' }) | ||
.find({ 0: 'SelectQuery' }) | ||
// @ts-expect-error | ||
// @ts-expect-error AbstractSql array being an array having .find | ||
.find({ 0: 'From' }) | ||
@@ -438,3 +438,3 @@ .find({ 2: 'pilot.licence' }) | ||
.find({ 0: 'SelectQuery' }) | ||
// @ts-expect-error | ||
// @ts-expect-error AbstractSql array being an array having .find | ||
.find({ 0: 'From' }) | ||
@@ -501,3 +501,3 @@ .find({ 2: 'pilot.licence' }) | ||
if (field.length === 2) { | ||
// @ts-expect-error | ||
// @ts-expect-error Assign field with stil valid AbstractSql | ||
field = field[1]; | ||
@@ -510,3 +510,3 @@ } | ||
const expandString = (function () { | ||
var recurse = function (i) { | ||
const recurse = function (i) { | ||
if (i <= 0) { | ||
@@ -523,3 +523,3 @@ return '$expand=trained__pilot'; | ||
test(url, function (result) { | ||
var recurse = function (i, parentAlias) { | ||
const recurse = function (i, parentAlias) { | ||
let aliasedFields; | ||
@@ -526,0 +526,0 @@ const alias = shortenAlias(`${parentAlias}.trained-pilot`); |
@@ -111,3 +111,3 @@ import { expect } from 'chai'; | ||
abstractsql: (function () { | ||
if (methodMaps.hasOwnProperty(method)) { | ||
if (Object.prototype.hasOwnProperty.call(methodMaps, method)) { | ||
method = methodMaps[method]; | ||
@@ -1183,6 +1183,6 @@ } else { | ||
if (methodName === 'all') { | ||
// @ts-expect-error | ||
// @ts-expect-error Pushing valid AbstractSql | ||
subWhere.push(['Not', filterWhere]); | ||
} else { | ||
// @ts-expect-error | ||
// @ts-expect-error Pushing valid AbstractSql | ||
subWhere.push(filterWhere); | ||
@@ -1260,6 +1260,6 @@ } | ||
if (methodName === 'all') { | ||
// @ts-expect-error | ||
// @ts-expect-error Pushing valid AbstractSql | ||
subWhere.push(['Not', filterWhere]); | ||
} else { | ||
// @ts-expect-error | ||
// @ts-expect-error Pushing valid AbstractSql | ||
subWhere.push(filterWhere); | ||
@@ -1266,0 +1266,0 @@ } |
@@ -1,2 +0,1 @@ | ||
import * as _ from 'lodash'; | ||
import { clientModel } from './chai-sql'; | ||
@@ -66,4 +65,5 @@ import * as ODataParser from '@balena/odata-parser'; | ||
test.skip = runExpectation.bind(null, describe.skip); | ||
// eslint-disable-next-line no-only-tests/no-only-tests | ||
test.only = runExpectation.bind(null, describe.only); | ||
export default test; |
@@ -10,2 +10,3 @@ { | ||
"include": [ | ||
"*", | ||
"src/*", | ||
@@ -12,0 +13,0 @@ "test/**/*" |
@@ -18,3 +18,3 @@ { | ||
"include": [ | ||
"src/**/*" | ||
"src/**/*", | ||
], | ||
@@ -21,0 +21,0 @@ "exclude": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
567824
26
6699
2
+ Added@balena/abstract-sql-compiler@9.2.0(transitive)
+ Added@balena/sbvr-types@7.1.3(transitive)
- Removed@balena/abstract-sql-compiler@8.5.0(transitive)
- Removed@balena/sbvr-types@3.5.0(transitive)
Updated@balena/odata-parser@^3.0.1
Updated@types/lodash@^4.14.199
Updated@types/memoizee@^0.4.9