@balena/odata-to-abstract-sql
Advanced tools
Comparing version 5.5.2-web-resource-2-0cafc655ff515d4d5e4b76b14e2a0ce69803b701-1 to 5.6.0-minimized-aliases-dd7994b908b2eed0f084fb173b100dfe6c651913-1
@@ -7,5 +7,5 @@ # Change Log | ||
## 5.5.2 - 2022-11-18 | ||
## 5.6.0 - 2022-11-22 | ||
* Integrate beta version of sbvr-types supporting WebResource [Ramiro González Maciel] | ||
* Add an option to always use minimized aliases [Pagan Gazzard] | ||
@@ -12,0 +12,0 @@ ## 5.5.1 - 2022-10-14 |
@@ -56,3 +56,5 @@ import * as memoize from 'memoizee'; | ||
private checkAlias; | ||
constructor(clientModel: AbstractSqlModel, methods?: Dictionary<ResourceFunction>); | ||
constructor(clientModel: AbstractSqlModel, methods?: Dictionary<ResourceFunction>, { minimizeAliases }?: { | ||
minimizeAliases?: boolean | undefined; | ||
}); | ||
match(path: ODataQuery, method: SupportedMethod, bodyKeys: string[], bindVarsLength: number, methods?: OData2AbstractSQL['methods']): { | ||
@@ -59,0 +61,0 @@ tree: AbstractSqlQuery; |
@@ -133,3 +133,3 @@ "use strict"; | ||
class OData2AbstractSQL { | ||
constructor(clientModel, methods = {}) { | ||
constructor(clientModel, methods = {}, { minimizeAliases = false } = {}) { | ||
this.clientModel = clientModel; | ||
@@ -145,3 +145,3 @@ this.methods = methods; | ||
let aliasLength = alias.length; | ||
if (aliasLength <= MAX_ALIAS_LENGTH) { | ||
if (minimizeAliases === false && aliasLength <= MAX_ALIAS_LENGTH) { | ||
return alias; | ||
@@ -152,3 +152,3 @@ } | ||
.map((part) => { | ||
if (aliasLength <= MAX_ALIAS_LENGTH) { | ||
if (minimizeAliases === false && aliasLength <= MAX_ALIAS_LENGTH) { | ||
return part; | ||
@@ -155,0 +155,0 @@ } |
{ | ||
"name": "@balena/odata-to-abstract-sql", | ||
"version": "5.5.2-web-resource-2-0cafc655ff515d4d5e4b76b14e2a0ce69803b701-1", | ||
"version": "5.6.0-minimized-aliases-dd7994b908b2eed0f084fb173b100dfe6c651913-1", | ||
"description": "A consumer of the OData parser, written in OMeta", | ||
@@ -18,3 +18,3 @@ "main": "out/odata-to-abstract-sql.js", | ||
"dependencies": { | ||
"@balena/abstract-sql-compiler": "^7.20.24-web-resource-2-b0902e6810d79237e5dd54026402ba4ee30e37c3-1", | ||
"@balena/abstract-sql-compiler": "^7.20.0", | ||
"@balena/odata-parser": "^2.4.0", | ||
@@ -32,3 +32,3 @@ "@types/lodash": "^4.14.182", | ||
"@balena/sbvr-parser": "^1.4.1", | ||
"@balena/sbvr-types": "^3.4.16-web-resource-2-72be0ce20f07e8ff31df8456f134da5c0719103c-1", | ||
"@balena/sbvr-types": "^3.4.7", | ||
"@types/chai": "^4.3.1", | ||
@@ -59,4 +59,4 @@ "@types/chai-things": "0.0.35", | ||
"versionist": { | ||
"publishedAt": "2022-11-18T10:40:35.714Z" | ||
"publishedAt": "2022-11-22T18:59:29.037Z" | ||
} | ||
} |
@@ -277,2 +277,3 @@ import * as _ from 'lodash'; | ||
private methods: Dictionary<ResourceFunction> = {}, | ||
{ minimizeAliases = false } = {}, | ||
) { | ||
@@ -283,3 +284,3 @@ const MAX_ALIAS_LENGTH = 63; | ||
let aliasLength = alias.length; | ||
if (aliasLength <= MAX_ALIAS_LENGTH) { | ||
if (minimizeAliases === false && aliasLength <= MAX_ALIAS_LENGTH) { | ||
return alias; | ||
@@ -290,3 +291,3 @@ } | ||
.map((part) => { | ||
if (aliasLength <= MAX_ALIAS_LENGTH) { | ||
if (minimizeAliases === false && aliasLength <= MAX_ALIAS_LENGTH) { | ||
return part; | ||
@@ -293,0 +294,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
453251
6302