query-core 0.2.5 → 0.2.6

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.
@@ -34,6 +34,7 @@ var SearchBuilder = (function () {
34
34
  this.map = meta.map;
35
35
  this.bools = meta.bools;
36
36
  }
37
+ this.deleteSort = buildQ ? true : undefined;
37
38
  this.buildQuery = buildQ ? buildQ : query_1.buildQuery;
38
39
  this.buildSort = buildSort ? buildSort : query_1.buildSort;
39
40
  this.q = q && q.length > 0 ? q : "q";
@@ -65,7 +66,9 @@ var SearchBuilder = (function () {
65
66
  }
66
67
  var st = this.sort ? this.sort : "sort";
67
68
  var sn = filter[st];
68
- delete filter[st];
69
+ if (this.deleteSort) {
70
+ delete filter[st];
71
+ }
69
72
  var x = this.provider === exports.postgres ? "ilike" : this.param;
70
73
  var q2 = this.buildQuery(filter, x, sn, this.buildSort, this.attributes, this.table, fields, this.q, this.excluding);
71
74
  if (!q2) {
package/lib/index.js CHANGED
@@ -13,6 +13,8 @@ exports.SqlViewService = services_1.SqlLoader;
13
13
  exports.Repository = services_1.SqlWriter;
14
14
  exports.SqlGenericRepository = services_1.SqlWriter;
15
15
  exports.SqlGenericService = services_1.SqlWriter;
16
+ var SearchBuilder_1 = require("./SearchBuilder");
17
+ exports.SearchRepository = SearchBuilder_1.SearchBuilder;
16
18
  __export(require("./batch"));
17
19
  __export(require("./build"));
18
20
  __export(require("./client"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "query-core",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "query",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
@@ -10,6 +10,7 @@ export const sqlite = "sqlite"
10
10
  export class SearchBuilder<T, S> {
11
11
  map?: StringMap
12
12
  bools?: Attribute[]
13
+ protected deleteSort?: boolean
13
14
  buildQuery: (
14
15
  s: S,
15
16
  bparam: LikeType | ((i: number) => string),
@@ -56,6 +57,7 @@ export class SearchBuilder<T, S> {
56
57
  this.map = meta.map
57
58
  this.bools = meta.bools
58
59
  }
60
+ this.deleteSort = buildQ ? true: undefined
59
61
  this.buildQuery = buildQ ? buildQ : buildQuery
60
62
  this.buildSort = buildSort ? buildSort : bs
61
63
  this.q = q && q.length > 0 ? q : "q"
@@ -83,7 +85,9 @@ export class SearchBuilder<T, S> {
83
85
  }
84
86
  const st = this.sort ? this.sort : "sort"
85
87
  const sn = (filter as any)[st] as string
86
- delete (filter as any)[st]
88
+ if (this.deleteSort) {
89
+ delete (filter as any)[st]
90
+ }
87
91
  const x = this.provider === postgres ? "ilike" : this.param
88
92
  const q2 = this.buildQuery(filter, x, sn, this.buildSort, this.attributes, this.table, fields, this.q, this.excluding)
89
93
  if (!q2) {
package/src/index.ts CHANGED
@@ -9,6 +9,9 @@ export { SqlWriter as Repository, SqlWriter as SqlGenericRepository, SqlLoader a
9
9
 
10
10
  export { SqlWriter as SqlGenericService, SqlLoader as SqlLoadService, SqlLoader as SqlViewService }
11
11
 
12
+ import { SearchBuilder } from "./SearchBuilder"
13
+ export { SearchBuilder as SearchRepository}
14
+
12
15
  export * from "./batch"
13
16
  export * from "./build"
14
17
  export * from "./client"