mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,75 +1,102 @@
|
||||
// Query types
|
||||
export declare type queryIndexSignature = '_field' | '_gt' | '_value' | '_gte' | '_lt' | '_lte' | '_and' | '_or' | '_not' | '_in' | '_contains' | '_id' | '_between' | '_parent' | '_parent' | '_child' | '_type' | '_string' | '_like' | '_wildcard';
|
||||
export declare type queryIndexSignature =
|
||||
| '_field'
|
||||
| '_gt'
|
||||
| '_value'
|
||||
| '_gte'
|
||||
| '_lt'
|
||||
| '_lte'
|
||||
| '_and'
|
||||
| '_or'
|
||||
| '_not'
|
||||
| '_in'
|
||||
| '_contains'
|
||||
| '_id'
|
||||
| '_between'
|
||||
| '_parent'
|
||||
| '_parent'
|
||||
| '_child'
|
||||
| '_type'
|
||||
| '_string'
|
||||
| '_like'
|
||||
| '_wildcard';
|
||||
export type IQueryObject = {
|
||||
[key in queryIndexSignature]?: IQueryObject | IQueryObject[] | string | number | object
|
||||
[key in queryIndexSignature]?: IQueryObject | IQueryObject[] | string | number | object;
|
||||
};
|
||||
|
||||
// Query Functions
|
||||
export function Eq(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_field': field, '_value': value };
|
||||
// tslint:disable-next-line:no-any
|
||||
export function Eq(field: string, value: any): IQueryObject {
|
||||
return { _field: field, _value: value };
|
||||
}
|
||||
export function Gt(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_gt': { field: value } };
|
||||
// tslint:disable-next-line:no-any
|
||||
export function Gt(field: string, value: any): IQueryObject {
|
||||
return { _gt: { field: value } };
|
||||
}
|
||||
export function Gte(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_gte': { field: value } };
|
||||
// tslint:disable-next-line:no-any
|
||||
export function Gte(field: string, value: any): IQueryObject {
|
||||
return { _gte: { field: value } };
|
||||
}
|
||||
export function Lt(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_lt': { field: value } };
|
||||
// tslint:disable-next-line:no-any
|
||||
export function Lt(field: string, value: any): IQueryObject {
|
||||
return { _lt: { field: value } };
|
||||
}
|
||||
export function Lte(field: string, value: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_lte': { field: value } };
|
||||
// tslint:disable-next-line:no-any
|
||||
export function Lte(field: string, value: any): IQueryObject {
|
||||
return { _lte: { field: value } };
|
||||
}
|
||||
export function And(...criteria: IQueryObject[]): IQueryObject {
|
||||
return { '_and': criteria };
|
||||
return { _and: criteria };
|
||||
}
|
||||
export function Or(...criteria: IQueryObject[]): IQueryObject {
|
||||
return { '_or': criteria };
|
||||
return { _or: criteria };
|
||||
}
|
||||
export function Not(criteria: IQueryObject[]): IQueryObject {
|
||||
return { '_not': criteria };
|
||||
return { _not: criteria };
|
||||
}
|
||||
export function In(field: string, values: any[]): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_in': { '_field': field, '_values': values } };
|
||||
// tslint:disable-next-line:no-any
|
||||
export function In(field: string, values: any[]): IQueryObject {
|
||||
return { _in: { _field: field, _values: values } };
|
||||
}
|
||||
export function Contains(field: string): IQueryObject {
|
||||
return { '_contains': field };
|
||||
return { _contains: field };
|
||||
}
|
||||
export function Id(id: string | number): IQueryObject {
|
||||
return { '_id': id };
|
||||
return { _id: id };
|
||||
}
|
||||
export function Between(field: string, fromValue: any, toValue: any): IQueryObject { // tslint:disable-line:no-any
|
||||
return { '_between': { '_field': field, '_from': fromValue, '_to': toValue } };
|
||||
// tslint:disable-next-line:no-any
|
||||
export function Between(field: string, fromValue: any, toValue: any): IQueryObject {
|
||||
return { _between: { _field: field, _from: fromValue, _to: toValue } };
|
||||
}
|
||||
export function ParentId(tpe: string, id: string): IQueryObject {
|
||||
return { '_parent': { '_type': tpe, '_id': id } };
|
||||
return { _parent: { _type: tpe, _id: id } };
|
||||
}
|
||||
export function Parent(tpe: string, criterion: IQueryObject): IQueryObject {
|
||||
return { '_parent': { '_type': tpe, '_query': criterion } };
|
||||
return { _parent: { _type: tpe, _query: criterion } };
|
||||
}
|
||||
export function Child(tpe: string, criterion: IQueryObject): IQueryObject {
|
||||
return { '_child': { '_type': tpe, '_query': criterion } };
|
||||
return { _child: { _type: tpe, _query: criterion } };
|
||||
}
|
||||
export function Type(tpe: string): IQueryObject {
|
||||
return { '_type': tpe };
|
||||
return { _type: tpe };
|
||||
}
|
||||
export function queryString(queryString: string): IQueryObject {
|
||||
return { '_string': queryString };
|
||||
return { _string: queryString };
|
||||
}
|
||||
export function Like(field: string, value: string): IQueryObject {
|
||||
return { '_like': { '_field': field, '_value': value } };
|
||||
return { _like: { _field: field, _value: value } };
|
||||
}
|
||||
export function StartsWith(field: string, value: string) {
|
||||
if (!value.startsWith('*')) {
|
||||
value = value + '*';
|
||||
}
|
||||
return { '_wildcard': { '_field': field, '_value': value } };
|
||||
return { _wildcard: { _field: field, _value: value } };
|
||||
}
|
||||
export function EndsWith(field: string, value: string) {
|
||||
if (!value.endsWith('*')) {
|
||||
value = '*' + value;
|
||||
}
|
||||
return { '_wildcard': { '_field': field, '_value': value } };
|
||||
return { _wildcard: { _field: field, _value: value } };
|
||||
}
|
||||
export function ContainsString(field: string, value: string) {
|
||||
if (!value.endsWith('*')) {
|
||||
@@ -78,5 +105,5 @@ export function ContainsString(field: string, value: string) {
|
||||
if (!value.startsWith('*')) {
|
||||
value = '*' + value;
|
||||
}
|
||||
return { '_wildcard': { '_field': field, '_value': value } };
|
||||
return { _wildcard: { _field: field, _value: value } };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user