express-ext 0.4.0 → 0.4.1
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/GenericSearchController.js +38 -41
- package/lib/LoadSearchController.js +73 -80
- package/lib/LowCodeController.js +61 -68
- package/lib/SearchController.js +26 -29
- package/lib/resources.js +58 -56
- package/lib/search.js +348 -477
- package/package.json +1 -1
- package/src/GenericController.ts +101 -101
- package/src/GenericSearchController.ts +25 -30
- package/src/HealthController.ts +8 -8
- package/src/LoadController.ts +55 -48
- package/src/LoadSearchController.ts +63 -72
- package/src/LogController.ts +86 -84
- package/src/LowCodeController.ts +44 -54
- package/src/SearchController.ts +19 -23
- package/src/client.ts +46 -46
- package/src/edit.ts +45 -45
- package/src/health.ts +26 -26
- package/src/http.ts +139 -139
- package/src/index.ts +197 -197
- package/src/log.ts +155 -151
- package/src/metadata.ts +44 -27
- package/src/resources.ts +71 -69
- package/src/search.ts +342 -502
- package/src/view.ts +33 -33
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict"
|
|
2
2
|
var __extends =
|
|
3
3
|
(this && this.__extends) ||
|
|
4
4
|
(function () {
|
|
@@ -7,60 +7,57 @@ var __extends =
|
|
|
7
7
|
Object.setPrototypeOf ||
|
|
8
8
|
({ __proto__: [] } instanceof Array &&
|
|
9
9
|
function (d, b) {
|
|
10
|
-
d.__proto__ = b
|
|
10
|
+
d.__proto__ = b
|
|
11
11
|
}) ||
|
|
12
12
|
function (d, b) {
|
|
13
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]
|
|
14
|
-
}
|
|
15
|
-
return extendStatics(d, b)
|
|
16
|
-
}
|
|
13
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]
|
|
14
|
+
}
|
|
15
|
+
return extendStatics(d, b)
|
|
16
|
+
}
|
|
17
17
|
return function (d, b) {
|
|
18
|
-
extendStatics(d, b)
|
|
18
|
+
extendStatics(d, b)
|
|
19
19
|
function __() {
|
|
20
|
-
this.constructor = d
|
|
20
|
+
this.constructor = d
|
|
21
21
|
}
|
|
22
|
-
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __())
|
|
23
|
-
}
|
|
24
|
-
})()
|
|
25
|
-
Object.defineProperty(exports,
|
|
26
|
-
var GenericController_1 = require(
|
|
27
|
-
var http_1 = require(
|
|
28
|
-
var
|
|
22
|
+
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __())
|
|
23
|
+
}
|
|
24
|
+
})()
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
26
|
+
var GenericController_1 = require("./GenericController")
|
|
27
|
+
var http_1 = require("./http")
|
|
28
|
+
var resources_1 = require("./resources")
|
|
29
|
+
var search_1 = require("./search")
|
|
29
30
|
var GenericSearchController = (function (_super) {
|
|
30
|
-
__extends(GenericSearchController, _super)
|
|
31
|
+
__extends(GenericSearchController, _super)
|
|
31
32
|
function GenericSearchController(log, find, service, config, build, validate, dates, numbers) {
|
|
32
|
-
var _this = _super.call(this, log, service, build, validate) || this
|
|
33
|
-
_this.find = find
|
|
34
|
-
_this.search = _this.search.bind(_this)
|
|
35
|
-
_this.config = search_1.initializeConfig(config)
|
|
33
|
+
var _this = _super.call(this, log, service, build, validate) || this
|
|
34
|
+
_this.find = find
|
|
35
|
+
_this.search = _this.search.bind(_this)
|
|
36
|
+
_this.config = search_1.initializeConfig(config)
|
|
36
37
|
if (_this.config) {
|
|
37
|
-
_this.csv = _this.config.csv
|
|
38
|
-
_this.
|
|
39
|
-
_this.excluding = _this.config.excluding;
|
|
40
|
-
}
|
|
41
|
-
if (!_this.fields || _this.fields.length === 0) {
|
|
42
|
-
_this.fields = 'fields';
|
|
38
|
+
_this.csv = _this.config.csv
|
|
39
|
+
_this.excluding = _this.config.excluding
|
|
43
40
|
}
|
|
44
|
-
var m = search_1.getMetadataFunc(service, dates, numbers)
|
|
41
|
+
var m = search_1.getMetadataFunc(service, dates, numbers)
|
|
45
42
|
if (m) {
|
|
46
|
-
_this.dates = m.dates
|
|
47
|
-
_this.numbers = m.numbers
|
|
43
|
+
_this.dates = m.dates
|
|
44
|
+
_this.numbers = m.numbers
|
|
48
45
|
}
|
|
49
|
-
return _this
|
|
46
|
+
return _this
|
|
50
47
|
}
|
|
51
48
|
GenericSearchController.prototype.search = function (req, res) {
|
|
52
|
-
var _this = this
|
|
53
|
-
var s = search_1.fromRequest(req, search_1.buildArray(this.array,
|
|
54
|
-
var l = search_1.getParameters(s, this.config)
|
|
55
|
-
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
49
|
+
var _this = this
|
|
50
|
+
var s = search_1.fromRequest(req, search_1.buildArray(this.array, resources_1.resources.fields, this.excluding))
|
|
51
|
+
var l = search_1.getParameters(s, this.config)
|
|
52
|
+
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
56
53
|
this.find(s2, l.limit, l.pageOrNextPageToken, l.fields)
|
|
57
54
|
.then(function (result) {
|
|
58
|
-
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
55
|
+
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
59
56
|
})
|
|
60
57
|
.catch(function (err) {
|
|
61
|
-
return http_1.handleError(err, res, _this.log)
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
return GenericSearchController
|
|
65
|
-
})(GenericController_1.GenericController)
|
|
66
|
-
exports.GenericSearchController = GenericSearchController
|
|
58
|
+
return http_1.handleError(err, res, _this.log)
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
return GenericSearchController
|
|
62
|
+
})(GenericController_1.GenericController)
|
|
63
|
+
exports.GenericSearchController = GenericSearchController
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict"
|
|
2
2
|
var __extends =
|
|
3
3
|
(this && this.__extends) ||
|
|
4
4
|
(function () {
|
|
@@ -7,122 +7,115 @@ var __extends =
|
|
|
7
7
|
Object.setPrototypeOf ||
|
|
8
8
|
({ __proto__: [] } instanceof Array &&
|
|
9
9
|
function (d, b) {
|
|
10
|
-
d.__proto__ = b
|
|
10
|
+
d.__proto__ = b
|
|
11
11
|
}) ||
|
|
12
12
|
function (d, b) {
|
|
13
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]
|
|
14
|
-
}
|
|
15
|
-
return extendStatics(d, b)
|
|
16
|
-
}
|
|
13
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]
|
|
14
|
+
}
|
|
15
|
+
return extendStatics(d, b)
|
|
16
|
+
}
|
|
17
17
|
return function (d, b) {
|
|
18
|
-
extendStatics(d, b)
|
|
18
|
+
extendStatics(d, b)
|
|
19
19
|
function __() {
|
|
20
|
-
this.constructor = d
|
|
20
|
+
this.constructor = d
|
|
21
21
|
}
|
|
22
|
-
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __())
|
|
23
|
-
}
|
|
24
|
-
})()
|
|
25
|
-
Object.defineProperty(exports,
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
22
|
+
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __())
|
|
23
|
+
}
|
|
24
|
+
})()
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
26
|
+
var resources_1 = require("resources")
|
|
27
|
+
var http_1 = require("./http")
|
|
28
|
+
var LoadController_1 = require("./LoadController")
|
|
29
|
+
var search_1 = require("./search")
|
|
29
30
|
function useSearchController(log, find, viewService, array, dates, numbers, keys, config) {
|
|
30
|
-
var c = new LoadSearchController(log, find, viewService, keys, config, dates, numbers)
|
|
31
|
-
c.array = array
|
|
32
|
-
return c
|
|
31
|
+
var c = new LoadSearchController(log, find, viewService, keys, config, dates, numbers)
|
|
32
|
+
c.array = array
|
|
33
|
+
return c
|
|
33
34
|
}
|
|
34
|
-
exports.useSearchController = useSearchController
|
|
35
|
-
exports.useSearchHandler = useSearchController
|
|
36
|
-
exports.createSearchController = useSearchController
|
|
37
|
-
exports.createSearchHandler = useSearchController
|
|
35
|
+
exports.useSearchController = useSearchController
|
|
36
|
+
exports.useSearchHandler = useSearchController
|
|
37
|
+
exports.createSearchController = useSearchController
|
|
38
|
+
exports.createSearchHandler = useSearchController
|
|
38
39
|
var LoadSearchController = (function (_super) {
|
|
39
|
-
__extends(LoadSearchController, _super)
|
|
40
|
+
__extends(LoadSearchController, _super)
|
|
40
41
|
function LoadSearchController(log, find, viewService, keys, config, dates, numbers) {
|
|
41
|
-
var _this = _super.call(this, log, viewService, keys) || this
|
|
42
|
-
_this.find = find
|
|
43
|
-
_this.search = _this.search.bind(_this)
|
|
42
|
+
var _this = _super.call(this, log, viewService, keys) || this
|
|
43
|
+
_this.find = find
|
|
44
|
+
_this.search = _this.search.bind(_this)
|
|
44
45
|
if (config) {
|
|
45
|
-
if (typeof config ===
|
|
46
|
-
_this.csv = config
|
|
46
|
+
if (typeof config === "boolean") {
|
|
47
|
+
_this.csv = config
|
|
47
48
|
} else {
|
|
48
|
-
_this.config = search_1.initializeConfig(config)
|
|
49
|
+
_this.config = search_1.initializeConfig(config)
|
|
49
50
|
if (_this.config) {
|
|
50
|
-
_this.csv = _this.config.csv
|
|
51
|
-
_this.
|
|
52
|
-
_this.excluding = _this.config.excluding;
|
|
51
|
+
_this.csv = _this.config.csv
|
|
52
|
+
_this.excluding = _this.config.excluding
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
_this.fields = 'fields';
|
|
58
|
-
}
|
|
59
|
-
var m = search_1.getMetadataFunc(viewService, dates, numbers, keys);
|
|
56
|
+
var m = search_1.getMetadataFunc(viewService, dates, numbers, keys)
|
|
60
57
|
if (m) {
|
|
61
|
-
_this.dates = m.dates
|
|
62
|
-
_this.numbers = m.numbers
|
|
58
|
+
_this.dates = m.dates
|
|
59
|
+
_this.numbers = m.numbers
|
|
63
60
|
}
|
|
64
|
-
return _this
|
|
61
|
+
return _this
|
|
65
62
|
}
|
|
66
63
|
LoadSearchController.prototype.search = function (req, res) {
|
|
67
|
-
var _this = this
|
|
68
|
-
var s = search_1.fromRequest(req, search_1.buildArray(this.array,
|
|
69
|
-
var l = search_1.getParameters(s, this.config)
|
|
70
|
-
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
64
|
+
var _this = this
|
|
65
|
+
var s = search_1.fromRequest(req, search_1.buildArray(this.array, resources_1.resources.fields, this.excluding))
|
|
66
|
+
var l = search_1.getParameters(s, this.config)
|
|
67
|
+
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
71
68
|
this.find(s2, l.limit, l.pageOrNextPageToken, l.fields)
|
|
72
69
|
.then(function (result) {
|
|
73
|
-
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
70
|
+
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
74
71
|
})
|
|
75
72
|
.catch(function (err) {
|
|
76
|
-
return http_1.handleError(err, res, _this.log)
|
|
77
|
-
})
|
|
78
|
-
}
|
|
79
|
-
return LoadSearchController
|
|
80
|
-
})(LoadController_1.LoadController)
|
|
81
|
-
exports.LoadSearchController = LoadSearchController
|
|
73
|
+
return http_1.handleError(err, res, _this.log)
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
return LoadSearchController
|
|
77
|
+
})(LoadController_1.LoadController)
|
|
78
|
+
exports.LoadSearchController = LoadSearchController
|
|
82
79
|
var QueryController = (function (_super) {
|
|
83
|
-
__extends(QueryController, _super)
|
|
80
|
+
__extends(QueryController, _super)
|
|
84
81
|
function QueryController(log, query, config, dates, numbers, array) {
|
|
85
|
-
var _this = _super.call(this, log, query) || this
|
|
86
|
-
_this.query = query
|
|
87
|
-
_this.search = _this.search.bind(_this)
|
|
88
|
-
_this.array = array
|
|
82
|
+
var _this = _super.call(this, log, query) || this
|
|
83
|
+
_this.query = query
|
|
84
|
+
_this.search = _this.search.bind(_this)
|
|
85
|
+
_this.array = array
|
|
89
86
|
if (config) {
|
|
90
|
-
if (typeof config ===
|
|
91
|
-
_this.csv = config
|
|
87
|
+
if (typeof config === "boolean") {
|
|
88
|
+
_this.csv = config
|
|
92
89
|
} else {
|
|
93
|
-
_this.config = search_1.initializeConfig(config)
|
|
90
|
+
_this.config = search_1.initializeConfig(config)
|
|
94
91
|
if (_this.config) {
|
|
95
|
-
_this.csv = _this.config.csv
|
|
96
|
-
_this.
|
|
97
|
-
_this.excluding = _this.config.excluding;
|
|
92
|
+
_this.csv = _this.config.csv
|
|
93
|
+
_this.excluding = _this.config.excluding
|
|
98
94
|
}
|
|
99
95
|
}
|
|
100
96
|
}
|
|
101
|
-
|
|
102
|
-
_this.fields = 'fields';
|
|
103
|
-
}
|
|
104
|
-
var m = search_1.getMetadataFunc(query, dates, numbers);
|
|
97
|
+
var m = search_1.getMetadataFunc(query, dates, numbers)
|
|
105
98
|
if (m) {
|
|
106
|
-
_this.dates = m.dates
|
|
107
|
-
_this.numbers = m.numbers
|
|
99
|
+
_this.dates = m.dates
|
|
100
|
+
_this.numbers = m.numbers
|
|
108
101
|
}
|
|
109
|
-
return _this
|
|
102
|
+
return _this
|
|
110
103
|
}
|
|
111
104
|
QueryController.prototype.search = function (req, res) {
|
|
112
|
-
var _this = this
|
|
113
|
-
var s = search_1.fromRequest(req, search_1.buildArray(this.array,
|
|
114
|
-
var l = search_1.getParameters(s, this.config)
|
|
115
|
-
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
105
|
+
var _this = this
|
|
106
|
+
var s = search_1.fromRequest(req, search_1.buildArray(this.array, resources_1.resources.fields, this.excluding))
|
|
107
|
+
var l = search_1.getParameters(s, this.config)
|
|
108
|
+
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
116
109
|
this.query
|
|
117
110
|
.search(s2, l.limit, l.pageOrNextPageToken, l.fields)
|
|
118
111
|
.then(function (result) {
|
|
119
|
-
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
112
|
+
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
120
113
|
})
|
|
121
114
|
.catch(function (err) {
|
|
122
|
-
return http_1.handleError(err, res, _this.log)
|
|
123
|
-
})
|
|
124
|
-
}
|
|
125
|
-
return QueryController
|
|
126
|
-
})(LoadController_1.LoadController)
|
|
127
|
-
exports.QueryController = QueryController
|
|
128
|
-
exports.QueryHandler = QueryController
|
|
115
|
+
return http_1.handleError(err, res, _this.log)
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
return QueryController
|
|
119
|
+
})(LoadController_1.LoadController)
|
|
120
|
+
exports.QueryController = QueryController
|
|
121
|
+
exports.QueryHandler = QueryController
|
package/lib/LowCodeController.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict"
|
|
2
2
|
var __extends =
|
|
3
3
|
(this && this.__extends) ||
|
|
4
4
|
(function () {
|
|
@@ -7,101 +7,94 @@ var __extends =
|
|
|
7
7
|
Object.setPrototypeOf ||
|
|
8
8
|
({ __proto__: [] } instanceof Array &&
|
|
9
9
|
function (d, b) {
|
|
10
|
-
d.__proto__ = b
|
|
10
|
+
d.__proto__ = b
|
|
11
11
|
}) ||
|
|
12
12
|
function (d, b) {
|
|
13
|
-
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]
|
|
14
|
-
}
|
|
15
|
-
return extendStatics(d, b)
|
|
16
|
-
}
|
|
13
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]
|
|
14
|
+
}
|
|
15
|
+
return extendStatics(d, b)
|
|
16
|
+
}
|
|
17
17
|
return function (d, b) {
|
|
18
|
-
extendStatics(d, b)
|
|
18
|
+
extendStatics(d, b)
|
|
19
19
|
function __() {
|
|
20
|
-
this.constructor = d
|
|
20
|
+
this.constructor = d
|
|
21
21
|
}
|
|
22
|
-
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __())
|
|
23
|
-
}
|
|
24
|
-
})()
|
|
25
|
-
Object.defineProperty(exports,
|
|
26
|
-
var GenericController_1 = require(
|
|
27
|
-
var http_1 = require(
|
|
28
|
-
var
|
|
22
|
+
d.prototype = b === null ? Object.create(b) : ((__.prototype = b.prototype), new __())
|
|
23
|
+
}
|
|
24
|
+
})()
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
26
|
+
var GenericController_1 = require("./GenericController")
|
|
27
|
+
var http_1 = require("./http")
|
|
28
|
+
var resources_1 = require("./resources")
|
|
29
|
+
var search_1 = require("./search")
|
|
29
30
|
var LowcodeController = (function (_super) {
|
|
30
|
-
__extends(LowcodeController, _super)
|
|
31
|
+
__extends(LowcodeController, _super)
|
|
31
32
|
function LowcodeController(log, lowCodeService, config, build, validate, dates, numbers) {
|
|
32
|
-
var _this = _super.call(this, log, lowCodeService, build, validate) || this
|
|
33
|
-
_this.lowCodeService = lowCodeService
|
|
34
|
-
_this.search = _this.search.bind(_this)
|
|
35
|
-
_this.config = search_1.initializeConfig(config)
|
|
33
|
+
var _this = _super.call(this, log, lowCodeService, build, validate) || this
|
|
34
|
+
_this.lowCodeService = lowCodeService
|
|
35
|
+
_this.search = _this.search.bind(_this)
|
|
36
|
+
_this.config = search_1.initializeConfig(config)
|
|
36
37
|
if (_this.config) {
|
|
37
|
-
_this.csv = _this.config.csv
|
|
38
|
-
_this.
|
|
39
|
-
_this.excluding = _this.config.excluding;
|
|
38
|
+
_this.csv = _this.config.csv
|
|
39
|
+
_this.excluding = _this.config.excluding
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
_this.fields = 'fields';
|
|
43
|
-
}
|
|
44
|
-
var m = search_1.getMetadataFunc(lowCodeService, dates, numbers);
|
|
41
|
+
var m = search_1.getMetadataFunc(lowCodeService, dates, numbers)
|
|
45
42
|
if (m) {
|
|
46
|
-
_this.dates = m.dates
|
|
47
|
-
_this.numbers = m.numbers
|
|
43
|
+
_this.dates = m.dates
|
|
44
|
+
_this.numbers = m.numbers
|
|
48
45
|
}
|
|
49
|
-
return _this
|
|
46
|
+
return _this
|
|
50
47
|
}
|
|
51
48
|
LowcodeController.prototype.search = function (req, res) {
|
|
52
|
-
var _this = this
|
|
53
|
-
var s = search_1.fromRequest(req, search_1.buildArray(this.array,
|
|
54
|
-
var l = search_1.getParameters(s, this.config)
|
|
55
|
-
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
49
|
+
var _this = this
|
|
50
|
+
var s = search_1.fromRequest(req, search_1.buildArray(this.array, resources_1.resources.fields, this.excluding))
|
|
51
|
+
var l = search_1.getParameters(s, this.config)
|
|
52
|
+
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
56
53
|
this.lowCodeService
|
|
57
54
|
.search(s2, l.limit, l.pageOrNextPageToken, l.fields)
|
|
58
55
|
.then(function (result) {
|
|
59
|
-
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
56
|
+
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
60
57
|
})
|
|
61
58
|
.catch(function (err) {
|
|
62
|
-
return http_1.handleError(err, res, _this.log)
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
return LowcodeController
|
|
66
|
-
})(GenericController_1.GenericController)
|
|
67
|
-
exports.LowcodeController = LowcodeController
|
|
68
|
-
exports.LowcodeHandler = LowcodeController
|
|
59
|
+
return http_1.handleError(err, res, _this.log)
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
return LowcodeController
|
|
63
|
+
})(GenericController_1.GenericController)
|
|
64
|
+
exports.LowcodeController = LowcodeController
|
|
65
|
+
exports.LowcodeHandler = LowcodeController
|
|
69
66
|
var Controller = (function (_super) {
|
|
70
|
-
__extends(Controller, _super)
|
|
67
|
+
__extends(Controller, _super)
|
|
71
68
|
function Controller(log, lowCodeService, build, validate, config, dates, numbers) {
|
|
72
|
-
var _this = _super.call(this, log, lowCodeService, build, validate) || this
|
|
73
|
-
_this.lowCodeService = lowCodeService
|
|
74
|
-
_this.search = _this.search.bind(_this)
|
|
75
|
-
_this.config = search_1.initializeConfig(config)
|
|
69
|
+
var _this = _super.call(this, log, lowCodeService, build, validate) || this
|
|
70
|
+
_this.lowCodeService = lowCodeService
|
|
71
|
+
_this.search = _this.search.bind(_this)
|
|
72
|
+
_this.config = search_1.initializeConfig(config)
|
|
76
73
|
if (_this.config) {
|
|
77
|
-
_this.csv = _this.config.csv
|
|
78
|
-
_this.
|
|
79
|
-
_this.excluding = _this.config.excluding;
|
|
80
|
-
}
|
|
81
|
-
if (!_this.fields || _this.fields.length === 0) {
|
|
82
|
-
_this.fields = 'fields';
|
|
74
|
+
_this.csv = _this.config.csv
|
|
75
|
+
_this.excluding = _this.config.excluding
|
|
83
76
|
}
|
|
84
|
-
var m = search_1.getMetadataFunc(lowCodeService, dates, numbers)
|
|
77
|
+
var m = search_1.getMetadataFunc(lowCodeService, dates, numbers)
|
|
85
78
|
if (m) {
|
|
86
|
-
_this.dates = m.dates
|
|
87
|
-
_this.numbers = m.numbers
|
|
79
|
+
_this.dates = m.dates
|
|
80
|
+
_this.numbers = m.numbers
|
|
88
81
|
}
|
|
89
|
-
return _this
|
|
82
|
+
return _this
|
|
90
83
|
}
|
|
91
84
|
Controller.prototype.search = function (req, res) {
|
|
92
|
-
var _this = this
|
|
93
|
-
var s = search_1.fromRequest(req, search_1.buildArray(this.array,
|
|
94
|
-
var l = search_1.getParameters(s, this.config)
|
|
95
|
-
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
85
|
+
var _this = this
|
|
86
|
+
var s = search_1.fromRequest(req, search_1.buildArray(this.array, resources_1.resources.fields, this.excluding))
|
|
87
|
+
var l = search_1.getParameters(s, this.config)
|
|
88
|
+
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
96
89
|
this.lowCodeService
|
|
97
90
|
.search(s2, l.limit, l.pageOrNextPageToken, l.fields)
|
|
98
91
|
.then(function (result) {
|
|
99
|
-
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
92
|
+
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
100
93
|
})
|
|
101
94
|
.catch(function (err) {
|
|
102
|
-
return http_1.handleError(err, res, _this.log)
|
|
103
|
-
})
|
|
104
|
-
}
|
|
105
|
-
return Controller
|
|
106
|
-
})(GenericController_1.GenericController)
|
|
107
|
-
exports.Controller = Controller
|
|
95
|
+
return http_1.handleError(err, res, _this.log)
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
return Controller
|
|
99
|
+
})(GenericController_1.GenericController)
|
|
100
|
+
exports.Controller = Controller
|
package/lib/SearchController.js
CHANGED
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
"use strict"
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
3
|
+
var resources_1 = require("resources")
|
|
4
|
+
var http_1 = require("./http")
|
|
5
|
+
var search_1 = require("./search")
|
|
5
6
|
var SearchController = (function () {
|
|
6
7
|
function SearchController(log, find, config, dates, numbers) {
|
|
7
|
-
this.log = log
|
|
8
|
-
this.find = find
|
|
9
|
-
this.dates = dates
|
|
10
|
-
this.numbers = numbers
|
|
11
|
-
this.search = this.search.bind(this)
|
|
8
|
+
this.log = log
|
|
9
|
+
this.find = find
|
|
10
|
+
this.dates = dates
|
|
11
|
+
this.numbers = numbers
|
|
12
|
+
this.search = this.search.bind(this)
|
|
12
13
|
if (config) {
|
|
13
|
-
if (typeof config ===
|
|
14
|
-
this.csv = config
|
|
14
|
+
if (typeof config === "boolean") {
|
|
15
|
+
this.csv = config
|
|
15
16
|
} else {
|
|
16
|
-
this.config = search_1.initializeConfig(config)
|
|
17
|
+
this.config = search_1.initializeConfig(config)
|
|
17
18
|
if (this.config) {
|
|
18
|
-
this.csv = this.config.csv
|
|
19
|
-
this.
|
|
20
|
-
this.excluding = this.config.excluding;
|
|
19
|
+
this.csv = this.config.csv
|
|
20
|
+
this.excluding = this.config.excluding
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
if (!this.fields || this.fields.length === 0) {
|
|
25
|
-
this.fields = 'fields';
|
|
26
|
-
}
|
|
27
24
|
}
|
|
28
25
|
SearchController.prototype.search = function (req, res) {
|
|
29
|
-
var _this = this
|
|
30
|
-
var s = search_1.fromRequest(req, search_1.buildArray(this.array,
|
|
31
|
-
var l = search_1.getParameters(s, this.config)
|
|
32
|
-
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
26
|
+
var _this = this
|
|
27
|
+
var s = search_1.fromRequest(req, search_1.buildArray(this.array, resources_1.resources.fields, this.excluding))
|
|
28
|
+
var l = search_1.getParameters(s, this.config)
|
|
29
|
+
var s2 = search_1.format(s, this.dates, this.numbers)
|
|
33
30
|
this.find(s2, l.limit, l.pageOrNextPageToken, l.fields)
|
|
34
31
|
.then(function (result) {
|
|
35
|
-
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
32
|
+
return search_1.jsonResult(res, result, _this.csv, l.fields, _this.config)
|
|
36
33
|
})
|
|
37
34
|
.catch(function (err) {
|
|
38
|
-
return http_1.handleError(err, res, _this.log)
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
return SearchController
|
|
42
|
-
})()
|
|
43
|
-
exports.SearchController = SearchController
|
|
35
|
+
return http_1.handleError(err, res, _this.log)
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
return SearchController
|
|
39
|
+
})()
|
|
40
|
+
exports.SearchController = SearchController
|