Skip to content

Commit 709039e

Browse files
committed
Update spatial queries
1 parent f43598e commit 709039e

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/query.ts

Lines changed: 17 additions & 17 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

@@ -33,10 +33,10 @@ export class Query {
3333
});
3434
}
3535

36-
static equal = (attribute: string, value: QueryTypes): string =>
36+
static equal = (attribute: string, value: QueryTypes | any[]): string =>
3737
new Query("equal", attribute, value).toString();
3838

39-
static notEqual = (attribute: string, value: QueryTypes): string =>
39+
static notEqual = (attribute: string, value: QueryTypes | any[]): string =>
4040
new Query("notEqual", attribute, value).toString();
4141

4242
static lessThan = (attribute: string, value: QueryTypes): string =>
@@ -100,7 +100,7 @@ export class Query {
100100
* @param {string | string[]} value
101101
* @returns {string}
102102
*/
103-
static contains = (attribute: string, value: string | string[]): string =>
103+
static contains = (attribute: string, value: string | any[]): string =>
104104
new Query("contains", attribute, value).toString();
105105

106106
/**
@@ -110,7 +110,7 @@ export class Query {
110110
* @param {string | string[]} value
111111
* @returns {string}
112112
*/
113-
static notContains = (attribute: string, value: string | string[]): string =>
113+
static notContains = (attribute: string, value: string | any[]): string =>
114114
new Query("notContains", attribute, value).toString();
115115

116116
/**
@@ -227,7 +227,7 @@ export class Query {
227227
* @returns {string}
228228
*/
229229
static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
230-
new Query("distanceEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
230+
new Query("distanceEqual", attribute, [[values, distance, meters]]).toString();
231231

232232
/**
233233
* Filter resources where attribute is not at a specific distance from the given coordinates.
@@ -239,7 +239,7 @@ export class Query {
239239
* @returns {string}
240240
*/
241241
static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
242-
new Query("distanceNotEqual", attribute, [values, distance, meters] as QueryTypesList).toString();
242+
new Query("distanceNotEqual", attribute, [[values, distance, meters]]).toString();
243243

244244
/**
245245
* Filter resources where attribute is at a distance greater than the specified value from the given coordinates.
@@ -251,7 +251,7 @@ export class Query {
251251
* @returns {string}
252252
*/
253253
static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
254-
new Query("distanceGreaterThan", attribute, [values, distance, meters] as QueryTypesList).toString();
254+
new Query("distanceGreaterThan", attribute, [[values, distance, meters]]).toString();
255255

256256
/**
257257
* Filter resources where attribute is at a distance less than the specified value from the given coordinates.
@@ -263,7 +263,7 @@ export class Query {
263263
* @returns {string}
264264
*/
265265
static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string =>
266-
new Query("distanceLessThan", attribute, [values, distance, meters] as QueryTypesList).toString();
266+
new Query("distanceLessThan", attribute, [[values, distance, meters]]).toString();
267267

268268
/**
269269
* Filter resources where attribute intersects with the given geometry.
@@ -273,7 +273,7 @@ export class Query {
273273
* @returns {string}
274274
*/
275275
static intersects = (attribute: string, values: any[]): string =>
276-
new Query("intersects", attribute, values).toString();
276+
new Query("intersects", attribute, [values]).toString();
277277

278278
/**
279279
* Filter resources where attribute does not intersect with the given geometry.
@@ -283,7 +283,7 @@ export class Query {
283283
* @returns {string}
284284
*/
285285
static notIntersects = (attribute: string, values: any[]): string =>
286-
new Query("notIntersects", attribute, values).toString();
286+
new Query("notIntersects", attribute, [values]).toString();
287287

288288
/**
289289
* Filter resources where attribute crosses the given geometry.
@@ -293,7 +293,7 @@ export class Query {
293293
* @returns {string}
294294
*/
295295
static crosses = (attribute: string, values: any[]): string =>
296-
new Query("crosses", attribute, values).toString();
296+
new Query("crosses", attribute, [values]).toString();
297297

298298
/**
299299
* Filter resources where attribute does not cross the given geometry.
@@ -303,7 +303,7 @@ export class Query {
303303
* @returns {string}
304304
*/
305305
static notCrosses = (attribute: string, values: any[]): string =>
306-
new Query("notCrosses", attribute, values).toString();
306+
new Query("notCrosses", attribute, [values]).toString();
307307

308308
/**
309309
* Filter resources where attribute overlaps with the given geometry.
@@ -313,7 +313,7 @@ export class Query {
313313
* @returns {string}
314314
*/
315315
static overlaps = (attribute: string, values: any[]): string =>
316-
new Query("overlaps", attribute, values).toString();
316+
new Query("overlaps", attribute, [values]).toString();
317317

318318
/**
319319
* Filter resources where attribute does not overlap with the given geometry.
@@ -323,7 +323,7 @@ export class Query {
323323
* @returns {string}
324324
*/
325325
static notOverlaps = (attribute: string, values: any[]): string =>
326-
new Query("notOverlaps", attribute, values).toString();
326+
new Query("notOverlaps", attribute, [values]).toString();
327327

328328
/**
329329
* Filter resources where attribute touches the given geometry.
@@ -333,7 +333,7 @@ export class Query {
333333
* @returns {string}
334334
*/
335335
static touches = (attribute: string, values: any[]): string =>
336-
new Query("touches", attribute, values).toString();
336+
new Query("touches", attribute, [values]).toString();
337337

338338
/**
339339
* Filter resources where attribute does not touch the given geometry.
@@ -343,5 +343,5 @@ export class Query {
343343
* @returns {string}
344344
*/
345345
static notTouches = (attribute: string, values: any[]): string =>
346-
new Query("notTouches", attribute, values).toString();
346+
new Query("notTouches", attribute, [values]).toString();
347347
}

0 commit comments

Comments
 (0)