query-core 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/SearchBuilder.js +0 -4
- package/lib/query.js +0 -2
- package/package.json +1 -1
- package/src/SearchBuilder.ts +0 -5
- package/src/query.ts +2 -2
package/lib/SearchBuilder.js
CHANGED
|
@@ -38,7 +38,6 @@ var SearchBuilder = (function () {
|
|
|
38
38
|
else {
|
|
39
39
|
this.primaryKeys = [];
|
|
40
40
|
}
|
|
41
|
-
this.deleteSort = buildQ ? undefined : true;
|
|
42
41
|
this.buildQuery = buildQ ? buildQ : query_1.buildQuery;
|
|
43
42
|
this.buildSort = buildSort ? buildSort : query_1.buildSort;
|
|
44
43
|
this.q = q && q.length > 0 ? q : "q";
|
|
@@ -70,9 +69,6 @@ var SearchBuilder = (function () {
|
|
|
70
69
|
}
|
|
71
70
|
var st = this.sort ? this.sort : "sort";
|
|
72
71
|
var sn = filter[st];
|
|
73
|
-
if (this.deleteSort) {
|
|
74
|
-
delete filter[st];
|
|
75
|
-
}
|
|
76
72
|
var likeType = this.provider === exports.postgres ? "ilike" : "like";
|
|
77
73
|
var q2 = this.buildQuery(filter, this.param, sn, this.buildSort, this.attrs, this.table, fields, this.q, this.excluding, likeType);
|
|
78
74
|
if (!q2) {
|
package/lib/query.js
CHANGED
|
@@ -68,14 +68,12 @@ function buildQuery(filter, param, sort, buildSort3, attrs, table, fields, sq, s
|
|
|
68
68
|
var args = [];
|
|
69
69
|
if (sq && sq.length > 0) {
|
|
70
70
|
q = s[sq];
|
|
71
|
-
delete s[sq];
|
|
72
71
|
if (q === "") {
|
|
73
72
|
q = undefined;
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
if (strExcluding && strExcluding.length > 0) {
|
|
77
76
|
excluding = s[strExcluding];
|
|
78
|
-
delete s[strExcluding];
|
|
79
77
|
if (typeof excluding === "string") {
|
|
80
78
|
excluding = excluding.split(",");
|
|
81
79
|
}
|
package/package.json
CHANGED
package/src/SearchBuilder.ts
CHANGED
|
@@ -12,7 +12,6 @@ export class SearchBuilder<T, S> {
|
|
|
12
12
|
map?: StringMap
|
|
13
13
|
bools?: Attribute[]
|
|
14
14
|
primaryKeys: Attribute[]
|
|
15
|
-
protected deleteSort?: boolean
|
|
16
15
|
buildQuery: (
|
|
17
16
|
s: S,
|
|
18
17
|
param: (i: number) => string,
|
|
@@ -64,7 +63,6 @@ export class SearchBuilder<T, S> {
|
|
|
64
63
|
} else {
|
|
65
64
|
this.primaryKeys = []
|
|
66
65
|
}
|
|
67
|
-
this.deleteSort = buildQ ? undefined : true
|
|
68
66
|
this.buildQuery = buildQ ? buildQ : buildQuery
|
|
69
67
|
this.buildSort = buildSort ? buildSort : bs
|
|
70
68
|
this.q = q && q.length > 0 ? q : "q"
|
|
@@ -92,9 +90,6 @@ export class SearchBuilder<T, S> {
|
|
|
92
90
|
}
|
|
93
91
|
const st = this.sort ? this.sort : "sort"
|
|
94
92
|
const sn = (filter as any)[st] as string
|
|
95
|
-
if (this.deleteSort) {
|
|
96
|
-
delete (filter as any)[st]
|
|
97
|
-
}
|
|
98
93
|
const likeType = this.provider === postgres ? "ilike" : "like"
|
|
99
94
|
const q2 = this.buildQuery(filter, this.param, sn, this.buildSort, this.attrs, this.table, fields, this.q, this.excluding, likeType)
|
|
100
95
|
if (!q2) {
|
package/src/query.ts
CHANGED
|
@@ -76,14 +76,14 @@ export function buildQuery<S>(
|
|
|
76
76
|
const args: any[] = []
|
|
77
77
|
if (sq && sq.length > 0) {
|
|
78
78
|
q = s[sq]
|
|
79
|
-
delete s[sq]
|
|
79
|
+
//delete s[sq]
|
|
80
80
|
if (q === "") {
|
|
81
81
|
q = undefined
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
if (strExcluding && strExcluding.length > 0) {
|
|
85
85
|
excluding = s[strExcluding]
|
|
86
|
-
delete s[strExcluding]
|
|
86
|
+
//delete s[strExcluding]
|
|
87
87
|
if (typeof excluding === "string") {
|
|
88
88
|
excluding = (excluding as string).split(",")
|
|
89
89
|
}
|