@balena/abstract-sql-compiler
Advanced tools
Comparing version 10.2.2-build-renovate-major-22-node-18f5166f6ce426ba473baef55b8870ad484dcb26-1 to 10.2.2
@@ -141,3 +141,4 @@ export declare const enum Engines { | ||
export type CaseNode = ['Case', ...WhenNode[]] | ['Case', ...WhenNode[], ElseNode]; | ||
export type BindNode = ['Bind', number | string] | ['Bind', string, string]; | ||
type BackCompatBindNode = ['Bind', string, string]; | ||
export type BindNode = ['Bind', number | string] | ['Bind', [string, string]] | BackCompatBindNode; | ||
export type CastNode = ['Cast', AnyTypeNodes, string]; | ||
@@ -144,0 +145,0 @@ export type CoalesceNode = [ |
@@ -871,11 +871,14 @@ "use strict"; | ||
}), | ||
Bind: (args) => { | ||
Bind: tryMatches(Helper((args) => { | ||
if (args.length !== 2) { | ||
return false; | ||
} | ||
return ['Bind', args]; | ||
}), (args) => { | ||
if (noBinds) { | ||
throw new SyntaxError('Cannot use a bind whilst they are disabled'); | ||
} | ||
if (args.length !== 1 && args.length !== 2) { | ||
throw new SyntaxError(`"Bind" requires 1/2 arg(s)`); | ||
} | ||
checkArgs('Bind', args, 1); | ||
return ['Bind', ...args]; | ||
}, | ||
}), | ||
Text, | ||
@@ -882,0 +885,0 @@ Value: Text, |
@@ -1131,12 +1131,4 @@ "use strict"; | ||
Bind: (args) => { | ||
let bind; | ||
if (args.length === 2) { | ||
bind = args; | ||
} | ||
else if (args.length === 1) { | ||
bind = args[0]; | ||
} | ||
else { | ||
throw new SyntaxError(`"Bind" requires 1/2 arg(s)`); | ||
} | ||
(0, exports.checkArgs)('Bind', args, 1); | ||
const bind = args[0]; | ||
return AddBind(['Bind', bind]); | ||
@@ -1143,0 +1135,0 @@ }, |
{ | ||
"name": "@balena/abstract-sql-compiler", | ||
"version": "10.2.2-build-renovate-major-22-node-18f5166f6ce426ba473baef55b8870ad484dcb26-1", | ||
"version": "10.2.2", | ||
"description": "A translator for abstract sql into sql.", | ||
@@ -35,3 +35,3 @@ "type": "commonjs", | ||
"@types/mocha": "^10.0.8", | ||
"@types/node": "^22.0.0", | ||
"@types/node": "^20.16.10", | ||
"chai": "^4.3.7", | ||
@@ -68,4 +68,4 @@ "common-tags": "^1.8.2", | ||
"versionist": { | ||
"publishedAt": "2025-01-29T13:44:25.892Z" | ||
"publishedAt": "2025-02-14T17:17:46.595Z" | ||
} | ||
} |
@@ -236,3 +236,10 @@ export const enum Engines { | ||
export type BindNode = ['Bind', number | string] | ['Bind', string, string]; | ||
/** | ||
* @deprecated This gets converted to the `['Bind', [string, string]]` form during compilation | ||
*/ | ||
type BackCompatBindNode = ['Bind', string, string]; | ||
export type BindNode = | ||
| ['Bind', number | string] | ||
| ['Bind', [string, string]] | ||
| BackCompatBindNode; | ||
export type CastNode = ['Cast', AnyTypeNodes, string]; | ||
@@ -239,0 +246,0 @@ export type CoalesceNode = [ |
@@ -1198,11 +1198,17 @@ import _ from 'lodash'; | ||
), | ||
Bind: (args) => { | ||
if (noBinds) { | ||
throw new SyntaxError('Cannot use a bind whilst they are disabled'); | ||
} | ||
if (args.length !== 1 && args.length !== 2) { | ||
throw new SyntaxError(`"Bind" requires 1/2 arg(s)`); | ||
} | ||
return ['Bind', ...args] as BindNode; | ||
}, | ||
Bind: tryMatches<BindNode>( | ||
Helper<OptimisationMatchFn<BindNode>>((args) => { | ||
if (args.length !== 2) { | ||
return false; | ||
} | ||
return ['Bind', args] as BindNode; | ||
}), | ||
(args) => { | ||
if (noBinds) { | ||
throw new SyntaxError('Cannot use a bind whilst they are disabled'); | ||
} | ||
checkArgs('Bind', args, 1); | ||
return ['Bind', ...args] as BindNode; | ||
}, | ||
), | ||
Text, | ||
@@ -1209,0 +1215,0 @@ Value: Text, |
@@ -1333,10 +1333,4 @@ import _ from 'lodash'; | ||
Bind: (args) => { | ||
let bind; | ||
if (args.length === 2) { | ||
bind = args; | ||
} else if (args.length === 1) { | ||
bind = args[0]; | ||
} else { | ||
throw new SyntaxError(`"Bind" requires 1/2 arg(s)`); | ||
} | ||
checkArgs('Bind', args, 1); | ||
const bind = args[0]; | ||
return AddBind(['Bind', bind]); | ||
@@ -1343,0 +1337,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
18389
1
1208638