axe-api 1.4.6 → 1.4.8
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/build/src/Enums.d.ts +2 -0
- package/build/src/Enums.js +2 -0
- package/build/src/Interfaces.d.ts +9 -0
- package/build/src/Server.js +5 -5
- package/build/src/constants.js +8 -8
- package/package.json +1 -1
package/build/src/Enums.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare enum HookFunctionTypes {
|
|
|
40
40
|
onBeforeForceDeleteQuery = "onBeforeForceDeleteQuery",
|
|
41
41
|
onBeforeForceDelete = "onBeforeForceDelete",
|
|
42
42
|
onBeforePaginate = "onBeforePaginate",
|
|
43
|
+
onBeforeSearch = "onBeforeSearch",
|
|
43
44
|
onBeforeAll = "onBeforeAll",
|
|
44
45
|
onBeforeShow = "onBeforeShow",
|
|
45
46
|
onAfterInsert = "onAfterInsert",
|
|
@@ -50,6 +51,7 @@ export declare enum HookFunctionTypes {
|
|
|
50
51
|
onAfterForceDeleteQuery = "onAfterForceDeleteQuery",
|
|
51
52
|
onAfterForceDelete = "onAfterForceDelete",
|
|
52
53
|
onAfterPaginate = "onAfterPaginate",
|
|
54
|
+
onAfterSearch = "onAfterSearch",
|
|
53
55
|
onAfterAll = "onAfterAll",
|
|
54
56
|
onAfterShow = "onAfterShow"
|
|
55
57
|
}
|
package/build/src/Enums.js
CHANGED
|
@@ -47,6 +47,7 @@ var HookFunctionTypes;
|
|
|
47
47
|
HookFunctionTypes["onBeforeForceDeleteQuery"] = "onBeforeForceDeleteQuery";
|
|
48
48
|
HookFunctionTypes["onBeforeForceDelete"] = "onBeforeForceDelete";
|
|
49
49
|
HookFunctionTypes["onBeforePaginate"] = "onBeforePaginate";
|
|
50
|
+
HookFunctionTypes["onBeforeSearch"] = "onBeforeSearch";
|
|
50
51
|
HookFunctionTypes["onBeforeAll"] = "onBeforeAll";
|
|
51
52
|
HookFunctionTypes["onBeforeShow"] = "onBeforeShow";
|
|
52
53
|
HookFunctionTypes["onAfterInsert"] = "onAfterInsert";
|
|
@@ -57,6 +58,7 @@ var HookFunctionTypes;
|
|
|
57
58
|
HookFunctionTypes["onAfterForceDeleteQuery"] = "onAfterForceDeleteQuery";
|
|
58
59
|
HookFunctionTypes["onAfterForceDelete"] = "onAfterForceDelete";
|
|
59
60
|
HookFunctionTypes["onAfterPaginate"] = "onAfterPaginate";
|
|
61
|
+
HookFunctionTypes["onAfterSearch"] = "onAfterSearch";
|
|
60
62
|
HookFunctionTypes["onAfterAll"] = "onAfterAll";
|
|
61
63
|
HookFunctionTypes["onAfterShow"] = "onAfterShow";
|
|
62
64
|
})(HookFunctionTypes || (exports.HookFunctionTypes = HookFunctionTypes = {}));
|
|
@@ -213,6 +213,10 @@ export interface IBeforePaginateContext extends IContext {
|
|
|
213
213
|
query: Knex.QueryBuilder;
|
|
214
214
|
conditions: IQuery;
|
|
215
215
|
}
|
|
216
|
+
export interface IBeforeSearchContext extends IContext {
|
|
217
|
+
query: Knex.QueryBuilder;
|
|
218
|
+
conditions: IQuery;
|
|
219
|
+
}
|
|
216
220
|
export interface IBeforeAllContext extends IContext {
|
|
217
221
|
query: Knex.QueryBuilder;
|
|
218
222
|
conditions: IQuery;
|
|
@@ -258,6 +262,11 @@ export interface IAfterAllContext extends IContext {
|
|
|
258
262
|
conditions: IQuery;
|
|
259
263
|
result: any;
|
|
260
264
|
}
|
|
265
|
+
export interface IAfterSearchContext extends IContext {
|
|
266
|
+
query: Knex.QueryBuilder;
|
|
267
|
+
conditions: IQuery;
|
|
268
|
+
result: any;
|
|
269
|
+
}
|
|
261
270
|
export interface IAfterShowContext extends IContext {
|
|
262
271
|
query: Knex.QueryBuilder;
|
|
263
272
|
conditions: IQuery;
|
package/build/src/Server.js
CHANGED
|
@@ -142,6 +142,11 @@ class Server {
|
|
|
142
142
|
var _a;
|
|
143
143
|
const app = yield Services_1.IoCService.use("App");
|
|
144
144
|
const api = Services_1.APIService.getInstance();
|
|
145
|
+
// Rate limitting should be added before init() functions
|
|
146
|
+
if ((_a = api.config.rateLimit) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
147
|
+
Services_1.LogService.debug("New middleware: rateLimit()");
|
|
148
|
+
app.use(RateLimit_1.default);
|
|
149
|
+
}
|
|
145
150
|
// Adding the default handler for auto-created routes
|
|
146
151
|
app.use(RequestHandler_1.default);
|
|
147
152
|
// Setting the error handler
|
|
@@ -155,11 +160,6 @@ class Server {
|
|
|
155
160
|
app.get("/docs", DocsHandler_1.default);
|
|
156
161
|
app.get("/routes", RoutesHandler_1.default);
|
|
157
162
|
}
|
|
158
|
-
// Rate limitting should be added after init() functions.
|
|
159
|
-
if ((_a = api.config.rateLimit) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
160
|
-
Services_1.LogService.debug("New middleware: rateLimit()");
|
|
161
|
-
app.use(RateLimit_1.default);
|
|
162
|
-
}
|
|
163
163
|
server.listen(api.config.port);
|
|
164
164
|
Services_1.LogService.axe(`Axe API listens requests on http://localhost:${api.config.port}`);
|
|
165
165
|
});
|
package/build/src/constants.js
CHANGED
|
@@ -166,12 +166,12 @@ exports.HANDLER_CYLES = {
|
|
|
166
166
|
new Phase_1.default("search.cache", GetCachePhase_1.default),
|
|
167
167
|
new Phase_1.default("search.URLSearchParamPhase", URLSearchParamPhase_1.default),
|
|
168
168
|
new Phase_1.default("search.prepareQuery", Search_1.default.PreparePhase),
|
|
169
|
-
new Hook_1.default(Enums_1.HookFunctionTypes.
|
|
170
|
-
new Event_1.default(Enums_1.HookFunctionTypes.
|
|
169
|
+
new Hook_1.default(Enums_1.HookFunctionTypes.onBeforeSearch),
|
|
170
|
+
new Event_1.default(Enums_1.HookFunctionTypes.onBeforeSearch),
|
|
171
171
|
new Phase_1.default("search.query", Search_1.default.FetchPhase),
|
|
172
172
|
new Phase_1.default("search.relational", List_1.default.RelationalPhase),
|
|
173
|
-
new Hook_1.default(Enums_1.HookFunctionTypes.
|
|
174
|
-
new Event_1.default(Enums_1.HookFunctionTypes.
|
|
173
|
+
new Hook_1.default(Enums_1.HookFunctionTypes.onAfterSearch),
|
|
174
|
+
new Event_1.default(Enums_1.HookFunctionTypes.onAfterSearch),
|
|
175
175
|
new Phase_1.default("search.serialize", List_1.default.SerializePhase),
|
|
176
176
|
new Phase_1.default("search.response", List_1.default.ResultPhase),
|
|
177
177
|
],
|
|
@@ -260,12 +260,12 @@ exports.HANDLER_CYLES = {
|
|
|
260
260
|
new Phase_1.default("all.cache", GetCachePhase_1.default),
|
|
261
261
|
new Phase_1.default("all.URLSearchParamPhase", URLSearchParamPhase_1.default),
|
|
262
262
|
new Phase_1.default("all.prepareQuery", Paginate_1.default.PreparePhase),
|
|
263
|
-
new Hook_1.default(Enums_1.HookFunctionTypes.
|
|
264
|
-
new Event_1.default(Enums_1.HookFunctionTypes.
|
|
263
|
+
new Hook_1.default(Enums_1.HookFunctionTypes.onBeforeAll),
|
|
264
|
+
new Event_1.default(Enums_1.HookFunctionTypes.onBeforeAll),
|
|
265
265
|
new Phase_1.default("all.query", All_1.default.FetchPhase),
|
|
266
266
|
new Phase_1.default("all.relational", List_1.default.RelationalPhase),
|
|
267
|
-
new Hook_1.default(Enums_1.HookFunctionTypes.
|
|
268
|
-
new Event_1.default(Enums_1.HookFunctionTypes.
|
|
267
|
+
new Hook_1.default(Enums_1.HookFunctionTypes.onAfterAll),
|
|
268
|
+
new Event_1.default(Enums_1.HookFunctionTypes.onAfterAll),
|
|
269
269
|
new Phase_1.default("all.serialize", List_1.default.SerializePhase),
|
|
270
270
|
new Phase_1.default("all.response", List_1.default.ResultPhase),
|
|
271
271
|
],
|