@antelopejs/dms-api 0.0.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.
Files changed (224) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +61 -0
  3. package/dist/automation/get-api-health.d.ts +10 -0
  4. package/dist/automation/get-api-health.js +53 -0
  5. package/dist/automation/get-api-health.js.map +1 -0
  6. package/dist/automation/index.d.ts +2 -0
  7. package/dist/automation/index.js +19 -0
  8. package/dist/automation/index.js.map +1 -0
  9. package/dist/automation/query-request-logs.d.ts +18 -0
  10. package/dist/automation/query-request-logs.js +50 -0
  11. package/dist/automation/query-request-logs.js.map +1 -0
  12. package/dist/automation/route-unhealthy.d.ts +9 -0
  13. package/dist/automation/route-unhealthy.js +102 -0
  14. package/dist/automation/route-unhealthy.js.map +1 -0
  15. package/dist/automation/scope.d.ts +2 -0
  16. package/dist/automation/scope.js +18 -0
  17. package/dist/automation/scope.js.map +1 -0
  18. package/dist/config.d.ts +12 -0
  19. package/dist/config.js +38 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/db/index.d.ts +2 -0
  22. package/dist/db/index.js +19 -0
  23. package/dist/db/index.js.map +1 -0
  24. package/dist/db/models/api_settings.model.d.ts +23 -0
  25. package/dist/db/models/api_settings.model.js +13 -0
  26. package/dist/db/models/api_settings.model.js.map +1 -0
  27. package/dist/db/models/index.d.ts +4 -0
  28. package/dist/db/models/index.js +21 -0
  29. package/dist/db/models/index.js.map +1 -0
  30. package/dist/db/models/request_log.model.d.ts +47 -0
  31. package/dist/db/models/request_log.model.js +127 -0
  32. package/dist/db/models/request_log.model.js.map +1 -0
  33. package/dist/db/models/routes.model.d.ts +22 -0
  34. package/dist/db/models/routes.model.js +9 -0
  35. package/dist/db/models/routes.model.js.map +1 -0
  36. package/dist/db/models/routes_statistics.model.d.ts +23 -0
  37. package/dist/db/models/routes_statistics.model.js +13 -0
  38. package/dist/db/models/routes_statistics.model.js.map +1 -0
  39. package/dist/db/tables/api_settings.table.d.ts +10 -0
  40. package/dist/db/tables/api_settings.table.js +47 -0
  41. package/dist/db/tables/api_settings.table.js.map +1 -0
  42. package/dist/db/tables/index.d.ts +4 -0
  43. package/dist/db/tables/index.js +21 -0
  44. package/dist/db/tables/index.js.map +1 -0
  45. package/dist/db/tables/request_log.table.d.ts +29 -0
  46. package/dist/db/tables/request_log.table.js +107 -0
  47. package/dist/db/tables/request_log.table.js.map +1 -0
  48. package/dist/db/tables/routes.table.d.ts +11 -0
  49. package/dist/db/tables/routes.table.js +50 -0
  50. package/dist/db/tables/routes.table.js.map +1 -0
  51. package/dist/db/tables/routes_statistics.table.d.ts +9 -0
  52. package/dist/db/tables/routes_statistics.table.js +38 -0
  53. package/dist/db/tables/routes_statistics.table.js.map +1 -0
  54. package/dist/index.d.ts +9 -0
  55. package/dist/index.js +56 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/middlewares/index.d.ts +1 -0
  58. package/dist/middlewares/index.js +18 -0
  59. package/dist/middlewares/index.js.map +1 -0
  60. package/dist/middlewares/request-log-capture.d.ts +1 -0
  61. package/dist/middlewares/request-log-capture.js +6 -0
  62. package/dist/middlewares/request-log-capture.js.map +1 -0
  63. package/dist/pages/all.d.ts +4 -0
  64. package/dist/pages/all.js +21 -0
  65. package/dist/pages/all.js.map +1 -0
  66. package/dist/pages/index.d.ts +4 -0
  67. package/dist/pages/index.js +21 -0
  68. package/dist/pages/index.js.map +1 -0
  69. package/dist/pages/logs/page.d.ts +9 -0
  70. package/dist/pages/logs/page.js +29 -0
  71. package/dist/pages/logs/page.js.map +1 -0
  72. package/dist/pages/module.d.ts +1 -0
  73. package/dist/pages/module.js +12 -0
  74. package/dist/pages/module.js.map +1 -0
  75. package/dist/pages/routes/page.d.ts +9 -0
  76. package/dist/pages/routes/page.js +29 -0
  77. package/dist/pages/routes/page.js.map +1 -0
  78. package/dist/pages/settings/form.d.ts +3 -0
  79. package/dist/pages/settings/form.js +80 -0
  80. package/dist/pages/settings/form.js.map +1 -0
  81. package/dist/pages/settings/page.d.ts +9 -0
  82. package/dist/pages/settings/page.js +26 -0
  83. package/dist/pages/settings/page.js.map +1 -0
  84. package/dist/pages/summary/page.d.ts +9 -0
  85. package/dist/pages/summary/page.js +29 -0
  86. package/dist/pages/summary/page.js.map +1 -0
  87. package/dist/routes/index.d.ts +5 -0
  88. package/dist/routes/index.js +22 -0
  89. package/dist/routes/index.js.map +1 -0
  90. package/dist/routes/logs.d.ts +7 -0
  91. package/dist/routes/logs.js +128 -0
  92. package/dist/routes/logs.js.map +1 -0
  93. package/dist/routes/monitoring.d.ts +17 -0
  94. package/dist/routes/monitoring.js +101 -0
  95. package/dist/routes/monitoring.js.map +1 -0
  96. package/dist/routes/routes.d.ts +37 -0
  97. package/dist/routes/routes.js +153 -0
  98. package/dist/routes/routes.js.map +1 -0
  99. package/dist/routes/settings.d.ts +24 -0
  100. package/dist/routes/settings.js +92 -0
  101. package/dist/routes/settings.js.map +1 -0
  102. package/dist/routes/summary.d.ts +32 -0
  103. package/dist/routes/summary.js +181 -0
  104. package/dist/routes/summary.js.map +1 -0
  105. package/dist/services/index.d.ts +11 -0
  106. package/dist/services/index.js +28 -0
  107. package/dist/services/index.js.map +1 -0
  108. package/dist/services/introspection/auth.d.ts +4 -0
  109. package/dist/services/introspection/auth.js +33 -0
  110. package/dist/services/introspection/auth.js.map +1 -0
  111. package/dist/services/introspection/errors.d.ts +6 -0
  112. package/dist/services/introspection/errors.js +50 -0
  113. package/dist/services/introspection/errors.js.map +1 -0
  114. package/dist/services/introspection/index.d.ts +53 -0
  115. package/dist/services/introspection/index.js +141 -0
  116. package/dist/services/introspection/index.js.map +1 -0
  117. package/dist/services/introspection/probe.d.ts +18 -0
  118. package/dist/services/introspection/probe.js +155 -0
  119. package/dist/services/introspection/probe.js.map +1 -0
  120. package/dist/services/period.d.ts +11 -0
  121. package/dist/services/period.js +68 -0
  122. package/dist/services/period.js.map +1 -0
  123. package/dist/services/request-log/capture.d.ts +10 -0
  124. package/dist/services/request-log/capture.js +189 -0
  125. package/dist/services/request-log/capture.js.map +1 -0
  126. package/dist/services/request-log/index.d.ts +3 -0
  127. package/dist/services/request-log/index.js +12 -0
  128. package/dist/services/request-log/index.js.map +1 -0
  129. package/dist/services/request-log/prune.d.ts +2 -0
  130. package/dist/services/request-log/prune.js +10 -0
  131. package/dist/services/request-log/prune.js.map +1 -0
  132. package/dist/services/request-log/read.d.ts +6 -0
  133. package/dist/services/request-log/read.js +26 -0
  134. package/dist/services/request-log/read.js.map +1 -0
  135. package/dist/services/request-log/redaction.d.ts +4 -0
  136. package/dist/services/request-log/redaction.js +53 -0
  137. package/dist/services/request-log/redaction.js.map +1 -0
  138. package/dist/services/request-log/util.d.ts +13 -0
  139. package/dist/services/request-log/util.js +114 -0
  140. package/dist/services/request-log/util.js.map +1 -0
  141. package/dist/services/routes-sync.d.ts +5 -0
  142. package/dist/services/routes-sync.js +63 -0
  143. package/dist/services/routes-sync.js.map +1 -0
  144. package/dist/services/scope.d.ts +7 -0
  145. package/dist/services/scope.js +40 -0
  146. package/dist/services/scope.js.map +1 -0
  147. package/dist/services/settings.d.ts +20 -0
  148. package/dist/services/settings.js +86 -0
  149. package/dist/services/settings.js.map +1 -0
  150. package/dist/services/statistics-aggregate.d.ts +67 -0
  151. package/dist/services/statistics-aggregate.js +340 -0
  152. package/dist/services/statistics-aggregate.js.map +1 -0
  153. package/dist/services/statistics-prune.d.ts +2 -0
  154. package/dist/services/statistics-prune.js +25 -0
  155. package/dist/services/statistics-prune.js.map +1 -0
  156. package/dist/services/statistics-read.d.ts +4 -0
  157. package/dist/services/statistics-read.js +48 -0
  158. package/dist/services/statistics-read.js.map +1 -0
  159. package/dist/services/statistics-utils.d.ts +14 -0
  160. package/dist/services/statistics-utils.js +65 -0
  161. package/dist/services/statistics-utils.js.map +1 -0
  162. package/dist/services/statistics-write.d.ts +3 -0
  163. package/dist/services/statistics-write.js +84 -0
  164. package/dist/services/statistics-write.js.map +1 -0
  165. package/dist/services/tree.d.ts +10 -0
  166. package/dist/services/tree.js +128 -0
  167. package/dist/services/tree.js.map +1 -0
  168. package/dist/types/charts.d.ts +9 -0
  169. package/dist/types/charts.js +3 -0
  170. package/dist/types/charts.js.map +1 -0
  171. package/dist/types/constants.d.ts +31 -0
  172. package/dist/types/constants.js +49 -0
  173. package/dist/types/constants.js.map +1 -0
  174. package/dist/types/index.d.ts +3 -0
  175. package/dist/types/index.js +20 -0
  176. package/dist/types/index.js.map +1 -0
  177. package/dist/types/statistics.d.ts +17 -0
  178. package/dist/types/statistics.js +3 -0
  179. package/dist/types/statistics.js.map +1 -0
  180. package/frontend-vue/.editorconfig +12 -0
  181. package/frontend-vue/.prettierrc +12 -0
  182. package/frontend-vue/.vscode/settings.json +26 -0
  183. package/frontend-vue/app/components/ConfigurationView.vue +187 -0
  184. package/frontend-vue/app/components/DocumentationView.vue +224 -0
  185. package/frontend-vue/app/components/LogDetailDrawer.vue +178 -0
  186. package/frontend-vue/app/components/LogsView.vue +347 -0
  187. package/frontend-vue/app/components/RouteDetailTabs.vue +179 -0
  188. package/frontend-vue/app/components/RouteTree.vue +196 -0
  189. package/frontend-vue/app/components/RoutesView.vue +82 -0
  190. package/frontend-vue/app/components/StatsView.vue +268 -0
  191. package/frontend-vue/app/components/SummaryView.vue +657 -0
  192. package/frontend-vue/app/components/TesterPanel.vue +499 -0
  193. package/frontend-vue/app/components/internal/ApiMethodBadge.vue +33 -0
  194. package/frontend-vue/app/components/internal/ApiStatusBadge.vue +28 -0
  195. package/frontend-vue/app/components/internal/PeriodSelect.vue +58 -0
  196. package/frontend-vue/app/components/internal/RouteTreeNode.vue +168 -0
  197. package/frontend-vue/app/components/internal/StatusBreakdownBars.vue +162 -0
  198. package/frontend-vue/app/components/internal/StatusDonut.vue +84 -0
  199. package/frontend-vue/app/components/internal/UnitAreaChart.vue +73 -0
  200. package/frontend-vue/app/composables/useApiIntrospection.ts +344 -0
  201. package/frontend-vue/app/composables/useLogDetailDrawer.ts +50 -0
  202. package/frontend-vue/app/composables/useSelectedPeriod.ts +107 -0
  203. package/frontend-vue/app/composables/useStatsPeriods.ts +139 -0
  204. package/frontend-vue/app/custom-layouts/.gitkeep +0 -0
  205. package/frontend-vue/app/custom-pages/.gitkeep +0 -0
  206. package/frontend-vue/app/utils/httpMethod.ts +49 -0
  207. package/frontend-vue/app/utils/statusClass.ts +49 -0
  208. package/frontend-vue/app/utils/testerRequest.ts +50 -0
  209. package/frontend-vue/dms.frontend.ts +25 -0
  210. package/frontend-vue/eslint.config.mjs +16 -0
  211. package/frontend-vue/i18n/locales/en-GB.json +240 -0
  212. package/frontend-vue/i18n/locales/fr-FR.json +240 -0
  213. package/frontend-vue/package.json +35 -0
  214. package/frontend-vue/pnpm-lock.yaml +5796 -0
  215. package/frontend-vue/pnpm-workspace.yaml +2 -0
  216. package/frontend-vue/public/.gitkeep +0 -0
  217. package/frontend-vue/server/.gitkeep +0 -0
  218. package/frontend-vue/tests/periods.test.ts +145 -0
  219. package/frontend-vue/tests/persistence.test.ts +45 -0
  220. package/frontend-vue/tests/registration.test.ts +28 -0
  221. package/frontend-vue/tests/testerRequest.test.ts +95 -0
  222. package/frontend-vue/tsconfig.json +13 -0
  223. package/frontend-vue/vitest.config.ts +8 -0
  224. package/package.json +67 -0
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./models"), exports);
18
+ __exportStar(require("./tables"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,2CAAyB"}
@@ -0,0 +1,23 @@
1
+ import { ApiSettings } from "../tables/api_settings.table";
2
+ declare const ApiSettingsModel_base: {
3
+ new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
4
+ readonly table: import("@antelopejs/interface-database").Table<ApiSettings>;
5
+ readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
6
+ get(id: string): PromiseLike<ApiSettings | undefined>;
7
+ getBy(index: keyof ApiSettings, ...keys: any[]): PromiseLike<ApiSettings[]>;
8
+ getAll(): PromiseLike<ApiSettings[]>;
9
+ insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<ApiSettings> | import("@antelopejs/interface-database-decorators").DeepPartial<ApiSettings>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
10
+ update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<ApiSettings>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
11
+ update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<ApiSettings>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
12
+ delete(id: string): Promise<number>;
13
+ };
14
+ readonly schemaName: string;
15
+ fromPlainData(obj: any): ApiSettings;
16
+ fromDatabase(obj: any): ApiSettings | undefined;
17
+ toDatabase(obj: any): Record<string, any>;
18
+ validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
19
+ };
20
+ export declare class ApiSettingsModel extends ApiSettingsModel_base {
21
+ getSingleton(): Promise<ApiSettings | undefined>;
22
+ }
23
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiSettingsModel = void 0;
4
+ const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
5
+ const api_settings_table_1 = require("../tables/api_settings.table");
6
+ class ApiSettingsModel extends (0, interface_database_decorators_1.BasicDataModel)(api_settings_table_1.ApiSettings, api_settings_table_1.apiSettingsTableName) {
7
+ async getSingleton() {
8
+ const all = await this.getAll();
9
+ return all[0];
10
+ }
11
+ }
12
+ exports.ApiSettingsModel = ApiSettingsModel;
13
+ //# sourceMappingURL=api_settings.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api_settings.model.js","sourceRoot":"","sources":["../../../src/db/models/api_settings.model.ts"],"names":[],"mappings":";;;AAAA,6FAA2E;AAC3E,qEAGsC;AAEtC,MAAa,gBAAiB,SAAQ,IAAA,8CAAc,EAClD,gCAAW,EACX,yCAAoB,CACrB;IAEC,KAAK,CAAC,YAAY;QAChB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QAChC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;IAChB,CAAC;CACF;AATD,4CASC"}
@@ -0,0 +1,4 @@
1
+ export * from "./api_settings.model";
2
+ export * from "./request_log.model";
3
+ export * from "./routes.model";
4
+ export * from "./routes_statistics.model";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api_settings.model"), exports);
18
+ __exportStar(require("./request_log.model"), exports);
19
+ __exportStar(require("./routes.model"), exports);
20
+ __exportStar(require("./routes_statistics.model"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,sDAAoC;AACpC,iDAA+B;AAC/B,4DAA0C"}
@@ -0,0 +1,47 @@
1
+ import { RequestLog } from "../tables/request_log.table";
2
+ export type RequestLogStatusClass = "success" | "client-error" | "server-error";
3
+ export interface RequestLogFilters {
4
+ routeId?: string;
5
+ uri?: string;
6
+ method?: string;
7
+ statusClass?: RequestLogStatusClass;
8
+ statusMin?: number;
9
+ statusMax?: number;
10
+ slowThresholdMs?: number;
11
+ search?: string;
12
+ since?: Date;
13
+ until?: Date;
14
+ cursor?: string;
15
+ limit?: number;
16
+ routeKeys?: string[];
17
+ }
18
+ export interface RequestLogPage {
19
+ results: RequestLog[];
20
+ nextCursor: string | null;
21
+ }
22
+ export declare const REQUEST_LOG_MAX_LIMIT = 200;
23
+ declare const RequestLogModel_base: {
24
+ new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
25
+ readonly table: import("@antelopejs/interface-database").Table<RequestLog>;
26
+ readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
27
+ get(id: string): PromiseLike<RequestLog | undefined>;
28
+ getBy(index: keyof RequestLog, ...keys: any[]): PromiseLike<RequestLog[]>;
29
+ getAll(): PromiseLike<RequestLog[]>;
30
+ insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<RequestLog> | import("@antelopejs/interface-database-decorators").DeepPartial<RequestLog>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
31
+ update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<RequestLog>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
32
+ update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<RequestLog>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
33
+ delete(id: string): Promise<number>;
34
+ };
35
+ readonly schemaName: string;
36
+ fromPlainData(obj: any): RequestLog;
37
+ fromDatabase(obj: any): RequestLog | undefined;
38
+ toDatabase(obj: any): Record<string, any>;
39
+ validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
40
+ };
41
+ export declare class RequestLogModel extends RequestLogModel_base {
42
+ query(filters: RequestLogFilters): Promise<RequestLogPage>;
43
+ private applyScalarFilters;
44
+ private applyStatusFilters;
45
+ deleteOlderThan(cutoff: Date): Promise<number>;
46
+ }
47
+ export {};
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RequestLogModel = exports.REQUEST_LOG_MAX_LIMIT = void 0;
4
+ const interface_database_1 = require("@antelopejs/interface-database");
5
+ const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
6
+ const request_log_table_1 = require("../tables/request_log.table");
7
+ const DEFAULT_LIMIT = 50;
8
+ const CURSOR_SEPARATOR = "|";
9
+ function decodeCursor(raw) {
10
+ if (!raw)
11
+ return undefined;
12
+ const separator = raw.indexOf(CURSOR_SEPARATOR);
13
+ const date = separator < 0 ? raw : raw.slice(0, separator);
14
+ const id = separator < 0 ? undefined : raw.slice(separator + 1);
15
+ const timestamp = new Date(date);
16
+ if (Number.isNaN(+timestamp) || id === "")
17
+ return undefined;
18
+ return { timestamp, id };
19
+ }
20
+ exports.REQUEST_LOG_MAX_LIMIT = 200;
21
+ const STATUS_CLASS_RANGES = {
22
+ success: { min: 200, max: 400 },
23
+ "client-error": { min: 400, max: 500 },
24
+ "server-error": { min: 500 },
25
+ };
26
+ function escapeRegex(input) {
27
+ return input.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
28
+ }
29
+ function paginate(results, limit) {
30
+ if (results.length > limit) {
31
+ const trimmed = results.slice(0, limit);
32
+ const last = trimmed[trimmed.length - 1];
33
+ const nextCursor = `${last.timestamp.toISOString()}${CURSOR_SEPARATOR}${last._id}`;
34
+ return { results: trimmed, nextCursor };
35
+ }
36
+ return { results, nextCursor: null };
37
+ }
38
+ class RequestLogModel extends (0, interface_database_decorators_1.BasicDataModel)(request_log_table_1.RequestLog, request_log_table_1.requestLogTableName) {
39
+ async query(filters) {
40
+ const limit = Math.min(filters.limit ?? DEFAULT_LIMIT, exports.REQUEST_LOG_MAX_LIMIT);
41
+ let q = this.table.orderBy(request_log_table_1.REQUEST_LOG_ORDER_INDEX, "desc");
42
+ q = this.applyScalarFilters(q, filters);
43
+ q = this.applyStatusFilters(q, filters);
44
+ const results = await q.slice(0, limit + 1).run();
45
+ return paginate(results, limit);
46
+ }
47
+ applyScalarFilters(q, filters) {
48
+ const cursor = decodeCursor(filters.cursor);
49
+ if (cursor) {
50
+ q = q.filter((doc) => {
51
+ const older = doc.key("timestamp").lt(cursor.timestamp);
52
+ return cursor.id === undefined
53
+ ? older
54
+ : older.or(doc
55
+ .key("timestamp")
56
+ .eq(cursor.timestamp)
57
+ .and(doc.key("_id").lt(cursor.id)));
58
+ });
59
+ }
60
+ const since = filters.since;
61
+ if (since) {
62
+ q = q.filter((doc) => doc.key("timestamp").ge(since));
63
+ }
64
+ const until = filters.until;
65
+ if (until) {
66
+ q = q.filter((doc) => doc.key("timestamp").le(until));
67
+ }
68
+ const routeId = filters.routeId;
69
+ if (routeId) {
70
+ q = q.filter((doc) => doc.key("routeId").eq(routeId));
71
+ }
72
+ const uri = filters.uri;
73
+ if (uri) {
74
+ q = q.filter((doc) => doc.key("uri").eq(uri));
75
+ }
76
+ if (filters.method) {
77
+ const method = filters.method.toUpperCase();
78
+ q = q.filter((doc) => doc.key("method").eq(method));
79
+ }
80
+ if (filters.search) {
81
+ const needle = escapeRegex(filters.search);
82
+ q = q.filter((doc) => doc.key("uri").match(`(?i)${needle}`));
83
+ }
84
+ const routeKeys = filters.routeKeys;
85
+ if (routeKeys) {
86
+ q = q.filter((doc) => interface_database_1.ValueProxy.constant(routeKeys).includes(doc
87
+ .key("method")
88
+ .cast()
89
+ .upcase()
90
+ .concat(":")
91
+ .concat(doc.key("uri"))));
92
+ }
93
+ return q;
94
+ }
95
+ applyStatusFilters(q, filters) {
96
+ if (filters.statusClass) {
97
+ const { min, max } = STATUS_CLASS_RANGES[filters.statusClass];
98
+ q = q.filter((doc) => {
99
+ const lower = doc.key("statusCode").ge(min);
100
+ return max === undefined
101
+ ? lower
102
+ : lower.and(doc.key("statusCode").lt(max));
103
+ });
104
+ }
105
+ const statusMin = filters.statusMin;
106
+ if (statusMin !== undefined) {
107
+ q = q.filter((doc) => doc.key("statusCode").ge(statusMin));
108
+ }
109
+ const statusMax = filters.statusMax;
110
+ if (statusMax !== undefined) {
111
+ q = q.filter((doc) => doc.key("statusCode").le(statusMax));
112
+ }
113
+ const slowThresholdMs = filters.slowThresholdMs;
114
+ if (slowThresholdMs !== undefined) {
115
+ q = q.filter((doc) => doc.key("responseTimeMs").ge(slowThresholdMs));
116
+ }
117
+ return q;
118
+ }
119
+ async deleteOlderThan(cutoff) {
120
+ return this.table
121
+ .filter((doc) => doc.key("timestamp").lt(cutoff))
122
+ .delete()
123
+ .run();
124
+ }
125
+ }
126
+ exports.RequestLogModel = RequestLogModel;
127
+ //# sourceMappingURL=request_log.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_log.model.js","sourceRoot":"","sources":["../../../src/db/models/request_log.model.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAC5D,6FAA2E;AAC3E,mEAIqC;AA8BrC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,gBAAgB,GAAG,G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,CAAC,eAAe,CAAC,MAAY;QAChC,OAAO,IAAI,CAAC,KAAK;aACd,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;aAChD,MAAM,EAAE;aACR,GAAG,EAAE,CAAC;IACX,CAAC;CACF;AAnHD,0CAmHC"}
@@ -0,0 +1,22 @@
1
+ import { Route } from "../tables/routes.table";
2
+ declare const RouteModel_base: {
3
+ new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
4
+ readonly table: import("@antelopejs/interface-database").Table<Route>;
5
+ readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
6
+ get(id: string): PromiseLike<Route | undefined>;
7
+ getBy(index: keyof Route, ...keys: any[]): PromiseLike<Route[]>;
8
+ getAll(): PromiseLike<Route[]>;
9
+ insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Route> | import("@antelopejs/interface-database-decorators").DeepPartial<Route>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
10
+ update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<Route>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
11
+ update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Route>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
12
+ delete(id: string): Promise<number>;
13
+ };
14
+ readonly schemaName: string;
15
+ fromPlainData(obj: any): Route;
16
+ fromDatabase(obj: any): Route | undefined;
17
+ toDatabase(obj: any): Record<string, any>;
18
+ validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
19
+ };
20
+ export declare class RouteModel extends RouteModel_base {
21
+ }
22
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RouteModel = void 0;
4
+ const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
5
+ const routes_table_1 = require("../tables/routes.table");
6
+ class RouteModel extends (0, interface_database_decorators_1.BasicDataModel)(routes_table_1.Route, routes_table_1.routesTableName) {
7
+ }
8
+ exports.RouteModel = RouteModel;
9
+ //# sourceMappingURL=routes.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.model.js","sourceRoot":"","sources":["../../../src/db/models/routes.model.ts"],"names":[],"mappings":";;;AAAA,6FAA2E;AAC3E,yDAAgE;AAEhE,MAAa,UAAW,SAAQ,IAAA,8CAAc,EAAC,oBAAK,EAAE,8BAAe,CAAC;CAAG;AAAzE,gCAAyE"}
@@ -0,0 +1,23 @@
1
+ import { RouteStatistics } from "../tables/routes_statistics.table";
2
+ declare const RouteStatisticsModel_base: {
3
+ new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
4
+ readonly table: import("@antelopejs/interface-database").Table<RouteStatistics>;
5
+ readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
6
+ get(id: string): PromiseLike<RouteStatistics | undefined>;
7
+ getBy(index: keyof RouteStatistics, ...keys: any[]): PromiseLike<RouteStatistics[]>;
8
+ getAll(): PromiseLike<RouteStatistics[]>;
9
+ insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<RouteStatistics> | import("@antelopejs/interface-database-decorators").DeepPartial<RouteStatistics>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
10
+ update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<RouteStatistics>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
11
+ update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<RouteStatistics>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
12
+ delete(id: string): Promise<number>;
13
+ };
14
+ readonly schemaName: string;
15
+ fromPlainData(obj: any): RouteStatistics;
16
+ fromDatabase(obj: any): RouteStatistics | undefined;
17
+ toDatabase(obj: any): Record<string, any>;
18
+ validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
19
+ };
20
+ export declare class RouteStatisticsModel extends RouteStatisticsModel_base {
21
+ getByRoute(method: string, uri: string): Promise<RouteStatistics | undefined>;
22
+ }
23
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RouteStatisticsModel = void 0;
4
+ const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
5
+ const routes_statistics_table_1 = require("../tables/routes_statistics.table");
6
+ class RouteStatisticsModel extends (0, interface_database_decorators_1.BasicDataModel)(routes_statistics_table_1.RouteStatistics, routes_statistics_table_1.routesStatisticsTableName) {
7
+ async getByRoute(method, uri) {
8
+ const id = (0, routes_statistics_table_1.getRouteStatsKey)(method, uri);
9
+ return this.get(id);
10
+ }
11
+ }
12
+ exports.RouteStatisticsModel = RouteStatisticsModel;
13
+ //# sourceMappingURL=routes_statistics.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes_statistics.model.js","sourceRoot":"","sources":["../../../src/db/models/routes_statistics.model.ts"],"names":[],"mappings":";;;AAAA,6FAA2E;AAC3E,+EAI2C;AAE3C,MAAa,oBAAqB,SAAQ,IAAA,8CAAc,EACtD,yCAAe,EACf,mDAAyB,CAC1B;IAIC,KAAK,CAAC,UAAU,CACd,MAAc,EACd,GAAW;QAEX,MAAM,EAAE,GAAG,IAAA,0CAAgB,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC;CACF;AAdD,oDAcC"}
@@ -0,0 +1,10 @@
1
+ import { Table } from "@antelopejs/interface-database-decorators";
2
+ export declare const apiSettingsTableName = "api_settings";
3
+ export declare class ApiSettings extends Table {
4
+ scope: string;
5
+ statisticsLifetime: number | null;
6
+ requestLogRetention: number | null;
7
+ requestSlownessThreshold: number | null;
8
+ requestLogMaxBodySize: number | null;
9
+ updatedAt: Date;
10
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ApiSettings = exports.apiSettingsTableName = void 0;
13
+ const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
14
+ const constants_1 = require("../../types/constants");
15
+ exports.apiSettingsTableName = "api_settings";
16
+ let ApiSettings = class ApiSettings extends interface_database_decorators_1.Table {
17
+ };
18
+ exports.ApiSettings = ApiSettings;
19
+ __decorate([
20
+ (0, interface_database_decorators_1.Field)("string"),
21
+ __metadata("design:type", String)
22
+ ], ApiSettings.prototype, "scope", void 0);
23
+ __decorate([
24
+ (0, interface_database_decorators_1.Field)("number"),
25
+ __metadata("design:type", Object)
26
+ ], ApiSettings.prototype, "statisticsLifetime", void 0);
27
+ __decorate([
28
+ (0, interface_database_decorators_1.Field)("number"),
29
+ __metadata("design:type", Object)
30
+ ], ApiSettings.prototype, "requestLogRetention", void 0);
31
+ __decorate([
32
+ (0, interface_database_decorators_1.Field)("number"),
33
+ __metadata("design:type", Object)
34
+ ], ApiSettings.prototype, "requestSlownessThreshold", void 0);
35
+ __decorate([
36
+ (0, interface_database_decorators_1.Field)("number"),
37
+ __metadata("design:type", Object)
38
+ ], ApiSettings.prototype, "requestLogMaxBodySize", void 0);
39
+ __decorate([
40
+ (0, interface_database_decorators_1.UpdateTime)(),
41
+ (0, interface_database_decorators_1.Field)("date"),
42
+ __metadata("design:type", Date)
43
+ ], ApiSettings.prototype, "updatedAt", void 0);
44
+ exports.ApiSettings = ApiSettings = __decorate([
45
+ (0, interface_database_decorators_1.RegisterTable)(exports.apiSettingsTableName, constants_1.SCHEMA_NAME)
46
+ ], ApiSettings);
47
+ //# sourceMappingURL=api_settings.table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api_settings.table.js","sourceRoot":"","sources":["../../../src/db/tables/api_settings.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FAKmD;AACnD,qDAAoD;AAEvC,QAAA,oBAAoB,GAAG,cAAc,CAAC;AAS5C,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,qCAAK;CAwBrC,CAAA;AAxBY,kCAAW;AAGd;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;0CACM;AAId;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;uDAC0B;AAIlC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;wDAC2B;AAInC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;6DACgC;AAIxC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;0DAC6B;AAIrC;IAFP,IAAA,0CAAU,GAAE;IACZ,IAAA,qCAAK,EAAC,MAAM,CAAC;8BACK,IAAI;8CAAC;sBAvBb,WAAW;IADvB,IAAA,6CAAa,EAAC,4BAAoB,EAAE,uBAAW,CAAC;GACpC,WAAW,CAwBvB"}
@@ -0,0 +1,4 @@
1
+ export * from "./api_settings.table";
2
+ export * from "./request_log.table";
3
+ export * from "./routes.table";
4
+ export * from "./routes_statistics.table";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api_settings.table"), exports);
18
+ __exportStar(require("./request_log.table"), exports);
19
+ __exportStar(require("./routes.table"), exports);
20
+ __exportStar(require("./routes_statistics.table"), exports);
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/tables/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,sDAAoC;AACpC,iDAA+B;AAC/B,4DAA0C"}
@@ -0,0 +1,29 @@
1
+ import { Table } from "@antelopejs/interface-database-decorators";
2
+ import type { HttpMethod } from "@/types";
3
+ export declare const requestLogTableName = "request_log";
4
+ export declare const REQUEST_LOG_ORDER_INDEX = "timestamp_id";
5
+ export interface RequestLogError {
6
+ message: string;
7
+ stack?: string;
8
+ }
9
+ export declare class RequestLog extends Table {
10
+ timestamp: Date;
11
+ _id: string;
12
+ method: HttpMethod;
13
+ uri: string;
14
+ rawPath: string;
15
+ routeId?: string;
16
+ pathParams: Record<string, string>;
17
+ query: Record<string, string | string[]>;
18
+ requestHeaders: Record<string, string>;
19
+ requestBody?: string;
20
+ requestBodyTruncated: boolean;
21
+ statusCode: number;
22
+ responseTimeMs: number;
23
+ responseHeaders: Record<string, string>;
24
+ responseBody?: string;
25
+ responseBodyTruncated: boolean;
26
+ error?: RequestLogError;
27
+ ip?: string;
28
+ userAgent?: string;
29
+ }
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.RequestLog = exports.REQUEST_LOG_ORDER_INDEX = exports.requestLogTableName = void 0;
13
+ const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
14
+ const constants_1 = require("../../types/constants");
15
+ exports.requestLogTableName = "request_log";
16
+ exports.REQUEST_LOG_ORDER_INDEX = "timestamp_id";
17
+ let RequestLog = class RequestLog extends interface_database_decorators_1.Table {
18
+ };
19
+ exports.RequestLog = RequestLog;
20
+ __decorate([
21
+ (0, interface_database_decorators_1.Index)({ group: exports.REQUEST_LOG_ORDER_INDEX }),
22
+ (0, interface_database_decorators_1.Index)(),
23
+ (0, interface_database_decorators_1.Field)("date"),
24
+ __metadata("design:type", Date)
25
+ ], RequestLog.prototype, "timestamp", void 0);
26
+ __decorate([
27
+ (0, interface_database_decorators_1.Index)({ group: exports.REQUEST_LOG_ORDER_INDEX }),
28
+ (0, interface_database_decorators_1.Field)("string"),
29
+ __metadata("design:type", String)
30
+ ], RequestLog.prototype, "_id", void 0);
31
+ __decorate([
32
+ (0, interface_database_decorators_1.Index)(),
33
+ (0, interface_database_decorators_1.Field)("string"),
34
+ __metadata("design:type", String)
35
+ ], RequestLog.prototype, "method", void 0);
36
+ __decorate([
37
+ (0, interface_database_decorators_1.Index)(),
38
+ (0, interface_database_decorators_1.Field)("string"),
39
+ __metadata("design:type", String)
40
+ ], RequestLog.prototype, "uri", void 0);
41
+ __decorate([
42
+ (0, interface_database_decorators_1.Field)("string"),
43
+ __metadata("design:type", String)
44
+ ], RequestLog.prototype, "rawPath", void 0);
45
+ __decorate([
46
+ (0, interface_database_decorators_1.Index)(),
47
+ (0, interface_database_decorators_1.Field)("string"),
48
+ __metadata("design:type", String)
49
+ ], RequestLog.prototype, "routeId", void 0);
50
+ __decorate([
51
+ (0, interface_database_decorators_1.Field)("any"),
52
+ __metadata("design:type", Object)
53
+ ], RequestLog.prototype, "pathParams", void 0);
54
+ __decorate([
55
+ (0, interface_database_decorators_1.Field)("any"),
56
+ __metadata("design:type", Object)
57
+ ], RequestLog.prototype, "query", void 0);
58
+ __decorate([
59
+ (0, interface_database_decorators_1.Field)("any"),
60
+ __metadata("design:type", Object)
61
+ ], RequestLog.prototype, "requestHeaders", void 0);
62
+ __decorate([
63
+ (0, interface_database_decorators_1.Field)("string"),
64
+ __metadata("design:type", String)
65
+ ], RequestLog.prototype, "requestBody", void 0);
66
+ __decorate([
67
+ (0, interface_database_decorators_1.Field)("boolean"),
68
+ __metadata("design:type", Boolean)
69
+ ], RequestLog.prototype, "requestBodyTruncated", void 0);
70
+ __decorate([
71
+ (0, interface_database_decorators_1.Index)(),
72
+ (0, interface_database_decorators_1.Field)("number"),
73
+ __metadata("design:type", Number)
74
+ ], RequestLog.prototype, "statusCode", void 0);
75
+ __decorate([
76
+ (0, interface_database_decorators_1.Index)(),
77
+ (0, interface_database_decorators_1.Field)("number"),
78
+ __metadata("design:type", Number)
79
+ ], RequestLog.prototype, "responseTimeMs", void 0);
80
+ __decorate([
81
+ (0, interface_database_decorators_1.Field)("any"),
82
+ __metadata("design:type", Object)
83
+ ], RequestLog.prototype, "responseHeaders", void 0);
84
+ __decorate([
85
+ (0, interface_database_decorators_1.Field)("string"),
86
+ __metadata("design:type", String)
87
+ ], RequestLog.prototype, "responseBody", void 0);
88
+ __decorate([
89
+ (0, interface_database_decorators_1.Field)("boolean"),
90
+ __metadata("design:type", Boolean)
91
+ ], RequestLog.prototype, "responseBodyTruncated", void 0);
92
+ __decorate([
93
+ (0, interface_database_decorators_1.Field)("any"),
94
+ __metadata("design:type", Object)
95
+ ], RequestLog.prototype, "error", void 0);
96
+ __decorate([
97
+ (0, interface_database_decorators_1.Field)("string"),
98
+ __metadata("design:type", String)
99
+ ], RequestLog.prototype, "ip", void 0);
100
+ __decorate([
101
+ (0, interface_database_decorators_1.Field)("string"),
102
+ __metadata("design:type", String)
103
+ ], RequestLog.prototype, "userAgent", void 0);
104
+ exports.RequestLog = RequestLog = __decorate([
105
+ (0, interface_database_decorators_1.RegisterTable)(exports.requestLogTableName, constants_1.SCHEMA_NAME)
106
+ ], RequestLog);
107
+ //# sourceMappingURL=request_log.table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request_log.table.js","sourceRoot":"","sources":["../../../src/db/tables/request_log.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FAKmD;AAEnD,qDAAoD;AAEvC,QAAA,mBAAmB,GAAG,aAAa,CAAC;AACpC,QAAA,uBAAuB,GAAG,cAAc,CAAC;AAQ/C,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,qCAAK;CAqEpC,CAAA;AArEY,gCAAU;AAIb;IAHP,IAAA,qCAAK,EAAC,EAAE,KAAK,EAAE,+BAAuB,EAAE,CAAC;IACzC,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,MAAM,CAAC;8BACK,IAAI;6CAAC;AAIhB;IAFP,IAAA,qCAAK,EAAC,EAAE,KAAK,EAAE,+BAAuB,EAAE,CAAC;IACzC,IAAA,qCAAK,EAAC,QAAQ,CAAC;;uCACI;AAIZ;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;0CACW;AAMnB;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;uCACI;AAIZ;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;2CACQ;AAKhB;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;2CACS;AAGjB;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;8CAC8B;AAGnC;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;yCACoC;AAGzC;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;kDACkC;AAGvC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;+CACa;AAGrB;IADP,IAAA,qCAAK,EAAC,SAAS,CAAC;;wDACqB;AAI9B;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;8CACW;AAInB;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;kDACe;AAGvB;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;mDACmC;AAGxC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;gDACc;AAGtB;IADP,IAAA,qCAAK,EAAC,SAAS,CAAC;;yDACsB;AAG/B;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;yCACmB;AAGxB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;sCACI;AAGZ;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;6CACW;qBApEhB,UAAU;IADtB,IAAA,6CAAa,EAAC,2BAAmB,EAAE,uBAAW,CAAC;GACnC,UAAU,CAqEtB"}
@@ -0,0 +1,11 @@
1
+ import { Table } from "@antelopejs/interface-database-decorators";
2
+ import type { HttpMethod } from "@/types";
3
+ export declare const routesTableName = "routes";
4
+ export declare class Route extends Table {
5
+ uri: string;
6
+ method: HttpMethod;
7
+ module: string | null;
8
+ own: boolean;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ }