@balena/abstract-sql-compiler
Advanced tools
Comparing version 7.2.0 to 7.2.1-improve-typings-22764a4675ef385a1ef8ce10e633364449ae22b5
@@ -7,2 +7,6 @@ # Change Log | ||
## 7.2.1 - 2020-12-18 | ||
* Improve typings for compilation results [Pagan Gazzard] | ||
## 7.2.0 - 2020-12-16 | ||
@@ -9,0 +13,0 @@ |
@@ -81,2 +81,6 @@ export declare const enum Engines { | ||
]; | ||
export declare type InsertQueryNode = ['InsertQuery', ...AbstractSqlType[]]; | ||
export declare type UpdateQueryNode = ['UpdateQuery', ...AbstractSqlType[]]; | ||
export declare type DeleteQueryNode = ['DeleteQuery', ...AbstractSqlType[]]; | ||
export declare type UpsertQueryNode = ['UpsertQuery', InsertQueryNode, UpdateQueryNode]; | ||
export interface FromTypeNode { | ||
@@ -115,3 +119,3 @@ SelectQueryNode: SelectQueryNode; | ||
export declare type AliasNode<T> = ['Alias', T, string]; | ||
export declare type AbstractSqlType = string | NullNode | DateNode | BooleanTypeNodes | NumberTypeNodes | TextTypeNodes | UnknownTypeNodes | DurationNode | SelectQueryNode | SelectNode | ValuesNode | UnknownNode; | ||
export declare type AbstractSqlType = string | NullNode | DateNode | BooleanTypeNodes | NumberTypeNodes | TextTypeNodes | UnknownTypeNodes | DurationNode | SelectQueryNode | InsertQueryNode | UpdateQueryNode | DeleteQueryNode | UpsertQueryNode | SelectNode | ValuesNode | InnerJoinNode | LeftJoinNode | RightJoinNode | FullJoinNode | CrossJoinNode | GroupByNode | UnknownNode; | ||
export declare type UnknownNode = AbstractSqlQuery; | ||
@@ -209,3 +213,3 @@ export interface AbstractSqlQuery extends Array<AbstractSqlType> { | ||
compileSchema: (abstractSqlModel: AbstractSqlModel) => SqlModel; | ||
compileRule: (abstractSQL: AbstractSqlQuery) => SqlResult | SqlResult[]; | ||
compileRule: (abstractSQL: AbstractSqlQuery) => SqlResult | [SqlResult, SqlResult]; | ||
dataTypeValidate: (value: any, field: Pick<AbstractSqlField, 'dataType' | 'required'>) => Promise<any>; | ||
@@ -217,8 +221,10 @@ getReferencedFields: (ruleBody: AbstractSqlQuery) => ReferencedFields; | ||
export declare function compileRule(abstractSQL: AbstractSqlQuery, engine: Engines, noBinds: true): string; | ||
export declare function compileRule(abstractSQL: AbstractSqlQuery, engine: Engines, noBinds?: false): SqlResult | SqlResult[]; | ||
export declare function compileRule(abstractSQL: AbstractSqlQuery, engine: Engines, noBinds?: boolean): SqlResult | SqlResult[] | string; | ||
export declare function compileRule(abstractSQL: UpsertQueryNode, engine: Engines, noBinds?: false): [SqlResult, SqlResult]; | ||
export declare function compileRule(abstractSQL: SelectQueryNode | UnionQueryNode | InsertQueryNode | UpdateQueryNode | DeleteQueryNode, engine: Engines, noBinds?: false): SqlResult; | ||
export declare function compileRule(abstractSQL: AbstractSqlQuery, engine: Engines, noBinds?: false): SqlResult | [SqlResult, SqlResult]; | ||
export declare function compileRule(abstractSQL: AbstractSqlQuery, engine: Engines, noBinds?: boolean): SqlResult | [SqlResult, SqlResult] | string; | ||
export declare const postgres: { | ||
optimizeSchema: (abstractSqlModel: AbstractSqlModel) => AbstractSqlModel; | ||
compileSchema: _.Function1<AbstractSqlModel, SqlModel>; | ||
compileRule: (abstractSQL: AbstractSqlQuery) => SqlResult | SqlResult[]; | ||
compileRule: (abstractSQL: AbstractSqlQuery) => SqlResult | [SqlResult, SqlResult]; | ||
dataTypeValidate: (value: any, field: Pick<AbstractSqlField, 'dataType' | 'required'>) => Promise<any>; | ||
@@ -231,3 +237,3 @@ getReferencedFields: (ruleBody: AbstractSqlQuery) => ReferencedFields; | ||
compileSchema: _.Function1<AbstractSqlModel, SqlModel>; | ||
compileRule: (abstractSQL: AbstractSqlQuery) => SqlResult | SqlResult[]; | ||
compileRule: (abstractSQL: AbstractSqlQuery) => SqlResult | [SqlResult, SqlResult]; | ||
dataTypeValidate: (value: any, field: Pick<AbstractSqlField, 'dataType' | 'required'>) => Promise<any>; | ||
@@ -240,3 +246,3 @@ getReferencedFields: (ruleBody: AbstractSqlQuery) => ReferencedFields; | ||
compileSchema: _.Function1<AbstractSqlModel, SqlModel>; | ||
compileRule: (abstractSQL: AbstractSqlQuery) => SqlResult | SqlResult[]; | ||
compileRule: (abstractSQL: AbstractSqlQuery) => SqlResult | [SqlResult, SqlResult]; | ||
dataTypeValidate: (value: any, field: Pick<AbstractSqlField, 'dataType' | 'required'>) => Promise<any>; | ||
@@ -243,0 +249,0 @@ getReferencedFields: (ruleBody: AbstractSqlQuery) => ReferencedFields; |
@@ -1,2 +0,2 @@ | ||
import { AbstractSqlQuery, AbstractSqlType, Engines } from './AbstractSQLCompiler'; | ||
import { AbstractSqlQuery, AbstractSqlType, Engines, InsertQueryNode, SelectQueryNode, UnionQueryNode, UpdateQueryNode, DeleteQueryNode, UpsertQueryNode } from './AbstractSQLCompiler'; | ||
export declare type Binding = [string, any] | ['Bind', number | string | [string, string]]; | ||
@@ -28,3 +28,5 @@ export interface SqlResult { | ||
export declare function AbstractSQLRules2SQL(abstractSQL: AbstractSqlQuery, $engine: Engines, $noBinds: true): string; | ||
export declare function AbstractSQLRules2SQL(abstractSQL: AbstractSqlQuery, $engine: Engines, $noBinds?: false): SqlResult | SqlResult[]; | ||
export declare function AbstractSQLRules2SQL(abstractSQL: AbstractSqlQuery, $engine: Engines, $noBinds?: boolean): SqlResult | SqlResult[] | string; | ||
export declare function AbstractSQLRules2SQL(abstractSQL: UpsertQueryNode, $engine: Engines, $noBinds?: false): [SqlResult, SqlResult]; | ||
export declare function AbstractSQLRules2SQL(abstractSQL: SelectQueryNode | UnionQueryNode | InsertQueryNode | UpdateQueryNode | DeleteQueryNode, $engine: Engines, $noBinds?: false): SqlResult; | ||
export declare function AbstractSQLRules2SQL(abstractSQL: AbstractSqlQuery, $engine: Engines, $noBinds?: false): SqlResult | [SqlResult, SqlResult]; | ||
export declare function AbstractSQLRules2SQL(abstractSQL: AbstractSqlQuery, $engine: Engines, $noBinds?: boolean): SqlResult | [SqlResult, SqlResult] | string; |
{ | ||
"name": "@balena/abstract-sql-compiler", | ||
"version": "7.2.0", | ||
"version": "7.2.1-improve-typings-22764a4675ef385a1ef8ce10e633364449ae22b5", | ||
"description": "A translator for abstract sql into sql.", | ||
@@ -5,0 +5,0 @@ "main": "out/AbstractSQLCompiler.js", |
@@ -137,2 +137,6 @@ export const enum Engines { | ||
]; | ||
export type InsertQueryNode = ['InsertQuery', ...AbstractSqlType[]]; | ||
export type UpdateQueryNode = ['UpdateQuery', ...AbstractSqlType[]]; | ||
export type DeleteQueryNode = ['DeleteQuery', ...AbstractSqlType[]]; | ||
export type UpsertQueryNode = ['UpsertQuery', InsertQueryNode, UpdateQueryNode]; | ||
@@ -201,4 +205,14 @@ /** | ||
| SelectQueryNode | ||
| InsertQueryNode | ||
| UpdateQueryNode | ||
| DeleteQueryNode | ||
| UpsertQueryNode | ||
| SelectNode | ||
| ValuesNode | ||
| InnerJoinNode | ||
| LeftJoinNode | ||
| RightJoinNode | ||
| FullJoinNode | ||
| CrossJoinNode | ||
| GroupByNode | ||
| UnknownNode; | ||
@@ -314,3 +328,5 @@ export type UnknownNode = AbstractSqlQuery; | ||
compileSchema: (abstractSqlModel: AbstractSqlModel) => SqlModel; | ||
compileRule: (abstractSQL: AbstractSqlQuery) => SqlResult | SqlResult[]; | ||
compileRule: ( | ||
abstractSQL: AbstractSqlQuery, | ||
) => SqlResult | [SqlResult, SqlResult]; | ||
dataTypeValidate: ( | ||
@@ -519,6 +535,21 @@ value: any, | ||
export function compileRule( | ||
abstractSQL: UpsertQueryNode, | ||
engine: Engines, | ||
noBinds?: false, | ||
): [SqlResult, SqlResult]; | ||
export function compileRule( | ||
abstractSQL: | ||
| SelectQueryNode | ||
| UnionQueryNode | ||
| InsertQueryNode | ||
| UpdateQueryNode | ||
| DeleteQueryNode, | ||
engine: Engines, | ||
noBinds?: false, | ||
): SqlResult; | ||
export function compileRule( | ||
abstractSQL: AbstractSqlQuery, | ||
engine: Engines, | ||
noBinds?: false, | ||
): SqlResult | SqlResult[]; | ||
): SqlResult | [SqlResult, SqlResult]; | ||
export function compileRule( | ||
@@ -528,3 +559,3 @@ abstractSQL: AbstractSqlQuery, | ||
noBinds?: boolean, | ||
): SqlResult | SqlResult[] | string; | ||
): SqlResult | [SqlResult, SqlResult] | string; | ||
export function compileRule( | ||
@@ -534,3 +565,3 @@ abstractSQL: AbstractSqlQuery, | ||
noBinds = false, | ||
): SqlResult | SqlResult[] | string { | ||
): SqlResult | [SqlResult, SqlResult] | string { | ||
abstractSQL = AbstractSQLOptimiser(abstractSQL, noBinds); | ||
@@ -537,0 +568,0 @@ return AbstractSQLRules2SQL(abstractSQL, engine, noBinds); |
@@ -10,2 +10,8 @@ import * as _ from 'lodash'; | ||
Engines, | ||
InsertQueryNode, | ||
SelectQueryNode, | ||
UnionQueryNode, | ||
UpdateQueryNode, | ||
DeleteQueryNode, | ||
UpsertQueryNode, | ||
} from './AbstractSQLCompiler'; | ||
@@ -1269,6 +1275,21 @@ | ||
export function AbstractSQLRules2SQL( | ||
abstractSQL: UpsertQueryNode, | ||
$engine: Engines, | ||
$noBinds?: false, | ||
): [SqlResult, SqlResult]; | ||
export function AbstractSQLRules2SQL( | ||
abstractSQL: | ||
| SelectQueryNode | ||
| UnionQueryNode | ||
| InsertQueryNode | ||
| UpdateQueryNode | ||
| DeleteQueryNode, | ||
$engine: Engines, | ||
$noBinds?: false, | ||
): SqlResult; | ||
export function AbstractSQLRules2SQL( | ||
abstractSQL: AbstractSqlQuery, | ||
$engine: Engines, | ||
$noBinds?: false, | ||
): SqlResult | SqlResult[]; | ||
): SqlResult | [SqlResult, SqlResult]; | ||
export function AbstractSQLRules2SQL( | ||
@@ -1278,3 +1299,3 @@ abstractSQL: AbstractSqlQuery, | ||
$noBinds?: boolean, | ||
): SqlResult | SqlResult[] | string; | ||
): SqlResult | [SqlResult, SqlResult] | string; | ||
export function AbstractSQLRules2SQL( | ||
@@ -1284,3 +1305,3 @@ abstractSQL: AbstractSqlQuery, | ||
$noBinds = false, | ||
): SqlResult | SqlResult[] | string { | ||
): SqlResult | [SqlResult, SqlResult] | string { | ||
engine = $engine; | ||
@@ -1287,0 +1308,0 @@ noBinds = $noBinds; |
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
552275
12087
2