Skip to content

Commit 49cdf79

Browse files
committed
Update spatial queries
1 parent ffe3b29 commit 49cdf79

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/query.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
type QueryTypesSingle = string | number | boolean;
2-
export type QueryTypesList = string[] | number[] | boolean[] | Query[];
2+
export type QueryTypesList = string[] | number[] | boolean[] | Query[] | any[];
33
export type QueryTypes = QueryTypesSingle | QueryTypesList;
44
type AttributesTypes = string | string[];
55

@@ -52,20 +52,20 @@ export class Query {
5252
* Filter resources where attribute is equal to value.
5353
*
5454
* @param {string} attribute
55-
* @param {QueryTypes} value
55+
* @param {QueryTypes | any[]} value
5656
* @returns {string}
5757
*/
58-
static equal = (attribute: string, value: QueryTypes): string =>
58+
static equal = (attribute: string, value: QueryTypes | any[]): string =>
5959
new Query("equal", attribute, value).toString();
6060

6161
/**
6262
* Filter resources where attribute is not equal to value.
6363
*
6464
* @param {string} attribute
65-
* @param {QueryTypes} value
65+
* @param {QueryTypes | any[]} value
6666
* @returns {string}
6767
*/
68-
static notEqual = (attribute: string, value: QueryTypes): string =>
68+
static notEqual = (attribute: string, value: QueryTypes | any[]): string =>
6969
new Query("notEqual", attribute, value).toString();
7070

7171
/**
@@ -238,17 +238,17 @@ export class Query {
238238
* @param {string | string[]} value
239239
* @returns {string}
240240
*/
241-
static contains = (attribute: string, value: string | string[]): string =>
241+
static contains = (attribute: string, value: string | any[]): string =>
242242
new Query("contains", attribute, value).toString();
243243

244244
/**
245245
* Filter resources where attribute does not contain the specified value.
246246
*
247247
* @param {string} attribute
248-
* @param {string | string[]} value
248+
* @param {string | any[]} value
249249
* @returns {string}
250250
*/
251-
static notContains = (attribute: string, value: string | string[]): string =>
251+
static notContains = (attribute: string, value: string | any[]): string =>
252252
new Query("notContains", attribute, value).toString();
253253

254254
/**
@@ -377,7 +377,7 @@ export class Query {
377377
* @returns {string}
378378
*/
379379
static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
380-
new Query("distanceEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
380+
new Query("distanceEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString();
381381

382382
/**
383383
* Filter resources where attribute is not at a specific distance from the given coordinates.
@@ -389,7 +389,7 @@ export class Query {
389389
* @returns {string}
390390
*/
391391
static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
392-
new Query("distanceNotEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
392+
new Query("distanceNotEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString();
393393

394394
/**
395395
* Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
@@ -401,7 +401,7 @@ export class Query {
401401
* @returns {string}
402402
*/
403403
static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
404-
new Query("distanceGreaterThan", attribute, [values, distance, meters] as QueryTypesList).toString();
404+
new Query("distanceGreaterThan", attribute, [[values, distance, meters]] as QueryTypesList).toString();
405405

406406
/**
407407
* Filter resources where attribute is at a distance less than the specified value from the given coordinates.
@@ -413,7 +413,7 @@ export class Query {
413413
* @returns {string}
414414
*/
415415
static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
416-
new Query("distanceLessThan", attribute, [values, distance, meters] as QueryTypesList).toString();
416+
new Query("distanceLessThan", attribute, [[values, distance, meters]] as QueryTypesList).toString();
417417

418418
/**
419419
* Filter resources where attribute intersects with the given geometry.
@@ -423,7 +423,7 @@ export class Query {
423423
* @returns {string}
424424
*/
425425
static intersects = (attribute: string, values: any[]): string =>
426-
new Query("intersects", attribute, values).toString();
426+
new Query("intersects", attribute, [values]).toString();
427427

428428
/**
429429
* Filter resources where attribute does not intersect with the given geometry.
@@ -433,7 +433,7 @@ export class Query {
433433
* @returns {string}
434434
*/
435435
static notIntersects = (attribute: string, values: any[]): string =>
436-
new Query("notIntersects", attribute, values).toString();
436+
new Query("notIntersects", attribute, [values]).toString();
437437

438438
/**
439439
* Filter resources where attribute crosses the given geometry.
@@ -443,7 +443,7 @@ export class Query {
443443
* @returns {string}
444444
*/
445445
static crosses = (attribute: string, values: any[]): string =>
446-
new Query("crosses", attribute, values).toString();
446+
new Query("crosses", attribute, [values]).toString();
447447

448448
/**
449449
* Filter resources where attribute does not cross the given geometry.
@@ -453,7 +453,7 @@ export class Query {
453453
* @returns {string}
454454
*/
455455
static notCrosses = (attribute: string, values: any[]): string =>
456-
new Query("notCrosses", attribute, values).toString();
456+
new Query("notCrosses", attribute, [values]).toString();
457457

458458
/**
459459
* Filter resources where attribute overlaps with the given geometry.
@@ -463,7 +463,7 @@ export class Query {
463463
* @returns {string}
464464
*/
465465
static overlaps = (attribute: string, values: any[]): string =>
466-
new Query("overlaps", attribute, values).toString();
466+
new Query("overlaps", attribute, [values]).toString();
467467

468468
/**
469469
* Filter resources where attribute does not overlap with the given geometry.
@@ -473,7 +473,7 @@ export class Query {
473473
* @returns {string}
474474
*/
475475
static notOverlaps = (attribute: string, values: any[]): string =>
476-
new Query("notOverlaps", attribute, values).toString();
476+
new Query("notOverlaps", attribute, [values]).toString();
477477

478478
/**
479479
* Filter resources where attribute touches the given geometry.
@@ -483,7 +483,7 @@ export class Query {
483483
* @returns {string}
484484
*/
485485
static touches = (attribute: string, values: any[]): string =>
486-
new Query("touches", attribute, values).toString();
486+
new Query("touches", attribute, [values]).toString();
487487

488488
/**
489489
* Filter resources where attribute does not touch the given geometry.
@@ -493,5 +493,5 @@ export class Query {
493493
* @returns {string}
494494
*/
495495
static notTouches = (attribute: string, values: any[]): string =>
496-
new Query("notTouches", attribute, values).toString();
496+
new Query("notTouches", attribute, [values]).toString();
497497
}

0 commit comments

Comments
 (0)