@antelopejs/dms-api 0.6.1 → 0.6.3
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/README.md +43 -21
- package/dist/automation/get-api-health.d.ts +2 -2
- package/dist/automation/query-request-logs.d.ts +7 -3
- package/dist/automation/query-request-logs.js +9 -1
- package/dist/automation/query-request-logs.js.map +1 -1
- package/dist/automation/route-unhealthy.d.ts +6 -1
- package/dist/automation/route-unhealthy.js +2 -5
- package/dist/automation/route-unhealthy.js.map +1 -1
- package/dist/db/models/api_settings.model.d.ts +7 -5
- package/dist/db/models/request_log.model.d.ts +7 -5
- package/dist/db/models/routes.model.d.ts +7 -5
- package/dist/db/models/routes_statistics.model.d.ts +9 -6
- package/dist/db/models/routes_statistics.model.js +11 -9
- package/dist/db/models/routes_statistics.model.js.map +1 -1
- package/dist/db/tables/request_log.table.d.ts +4 -4
- package/dist/db/tables/routes_statistics.table.d.ts +1 -1
- package/dist/db/tables/routes_statistics.table.js.map +1 -1
- package/dist/guards.d.ts +2 -1
- package/dist/guards.js +25 -12
- package/dist/guards.js.map +1 -1
- package/dist/memo.js +2 -1
- package/dist/memo.js.map +1 -1
- package/dist/routes/settings.js +5 -2
- package/dist/routes/settings.js.map +1 -1
- package/dist/services/introspection/decorators.d.ts +1 -2
- package/dist/services/introspection/decorators.js +2 -7
- package/dist/services/introspection/decorators.js.map +1 -1
- package/dist/services/introspection/index.d.ts +2 -1
- package/dist/services/introspection/index.js +15 -13
- package/dist/services/introspection/index.js.map +1 -1
- package/dist/services/live.d.ts +7 -2
- package/dist/services/live.js +17 -13
- package/dist/services/live.js.map +1 -1
- package/dist/services/request-log/capture.js +35 -29
- package/dist/services/request-log/capture.js.map +1 -1
- package/dist/services/request-log/list.js +12 -12
- package/dist/services/request-log/list.js.map +1 -1
- package/dist/services/request-log/redaction.d.ts +2 -1
- package/dist/services/request-log/redaction.js +8 -2
- package/dist/services/request-log/redaction.js.map +1 -1
- package/dist/services/request-log/util.js +13 -13
- package/dist/services/request-log/util.js.map +1 -1
- package/dist/services/route-catalog.js +1 -2
- package/dist/services/route-catalog.js.map +1 -1
- package/dist/services/route-contract.js +7 -1
- package/dist/services/route-contract.js.map +1 -1
- package/dist/services/settings-form.d.ts +2 -2
- package/dist/services/settings-form.js +2 -1
- package/dist/services/settings-form.js.map +1 -1
- package/dist/services/statistics-aggregate.d.ts +6 -6
- package/dist/services/window.js +1 -2
- package/dist/services/window.js.map +1 -1
- package/dist/services/zod-json.d.ts +3 -0
- package/dist/services/zod-json.js +21 -0
- package/dist/services/zod-json.js.map +1 -0
- package/frontend-vue/i18n/locales/api-en-GB.json +1 -1
- package/frontend-vue/i18n/locales/api-fr-FR.json +1 -1
- package/frontend-vue/package.json +2 -2
- package/frontend-vue/pnpm-lock.yaml +17 -5
- package/frontend-vue/tests/testerRequest.test.ts +12 -0
- package/package.json +12 -13
- package/skills/dms-api/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
<a href="https://github.com/AntelopeJS/dms"><img data-illustration src="./.github/readme/strip.svg" width="100%" alt="DMS API CONSOLE: part of AntelopeJS DMS, the open-source back office. A glowing button reads Star AntelopeJS DMS."></a>
|
|
2
|
+
|
|
1
3
|
<div align="center">
|
|
2
4
|
|
|
3
|
-
#
|
|
5
|
+
# `@antelopejs/dms-api`
|
|
6
|
+
|
|
7
|
+
<a href="https://www.npmjs.com/package/@antelopejs/dms-api"><img alt="npm" src="https://img.shields.io/npm/v/@antelopejs/dms-api?style=for-the-badge&labelColor=000000&color=000000" data-illustration></a> <a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/dms-api?style=for-the-badge&labelColor=000000&color=000000" data-illustration></a> <a href="https://discord.gg/g4pFt6eXqu"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000" data-illustration></a> <a href="https://dms.antelopejs.com/docs/modules/api"><img alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000" data-illustration></a> <a href="https://github.com/AntelopeJS/dms"><img data-illustration alt="Star AntelopeJS DMS" src="https://img.shields.io/github/stars/AntelopeJS/dms?label=Star%20AntelopeJS%20DMS&style=for-the-badge&labelColor=000000&color=000000&logo=github"></a>
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/npm/l/@antelopejs/dms-api?style=for-the-badge&labelColor=000000&color=000000"></a>
|
|
7
|
-
<a href="https://discord.gg/g4pFt6eXqu"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
|
|
8
|
-
<a href="https://dms.antelopejs.com/docs/modules/api"><img alt="Documentation" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
|
|
9
|
+
**See whether your API is healthy, which routes fail or slow down and why, and test any route from the dashboard.**
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
[Try it in the live demo](https://dms-demo.antelopejs.com/modules/api) · [Documentation](https://dms.antelopejs.com/docs/modules/api) · [All modules](https://github.com/AntelopeJS/dms#modules)
|
|
11
12
|
|
|
12
13
|
</div>
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
<img data-illustration alt="The API Overview in the dark theme, from the live demo. The API health card reads Healthy with 0% server errors, with panels for routes needing attention, the slowest routes by latency and the error share over the last 24 hours." src="./.github/readme/hero.png">
|
|
15
16
|
|
|
16
17
|
## What it does
|
|
17
18
|
|
|
@@ -51,23 +52,22 @@ pnpm --dir playground traffic # a few hundred demo requests
|
|
|
51
52
|
|
|
52
53
|
| Package | Supported | Tested with |
|
|
53
54
|
| ------------------------------------------- | ----------------- | ----------- |
|
|
54
|
-
| `@antelopejs/interface-api` | `>=0.0
|
|
55
|
-
| `@antelopejs/interface-api-util` | `>=0.
|
|
56
|
-
| `@antelopejs/interface-core` | `>=0.
|
|
57
|
-
| `@antelopejs/interface-database` | `>=0.
|
|
58
|
-
| `@antelopejs/interface-database-decorators` | `>=0.
|
|
59
|
-
| `@antelopejs/interface-dms` | `>=0.
|
|
60
|
-
| `@antelopejs/interface-dms-automation` | `>=0.
|
|
55
|
+
| `@antelopejs/interface-api` | `>=0.2.0 <1.0.0` | `0.2.0` |
|
|
56
|
+
| `@antelopejs/interface-api-util` | `>=0.3.0 <1.0.0` | `0.3.0` |
|
|
57
|
+
| `@antelopejs/interface-core` | `>=0.4.0 <1.0.0` | `0.4.0` |
|
|
58
|
+
| `@antelopejs/interface-database` | `>=0.3.0 <1.0.0` | `0.3.0` |
|
|
59
|
+
| `@antelopejs/interface-database-decorators` | `>=0.2.0 <1.0.0` | `0.2.0` |
|
|
60
|
+
| `@antelopejs/interface-dms` | `>=0.12.0 <1.0.0` | `0.12.0` |
|
|
61
|
+
| `@antelopejs/interface-dms-automation` | `>=0.6.0 <1.0.0` | `0.6.0` |
|
|
61
62
|
|
|
62
63
|
<!-- antelopejs-docs-compat:end -->
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
| Database | an `@antelopejs/interface-database` implementation, such as `@antelopejs/mongodb` |
|
|
65
|
+
The module also needs a DMS backend in a release that implements the `@antelopejs/interface-dms` range above, and the `@antelopejs/dms-frontend` renderer in the range its frontend module declares in `engines["@antelopejs/dms-frontend"]` of `frontend-vue/package.json`; the `ajs dms` CLI refuses to build it with a renderer outside that range. It runs on these providers:
|
|
66
|
+
|
|
67
|
+
- API provider: `@antelopejs/api`.
|
|
68
|
+
- Database: an `@antelopejs/interface-database` implementation, such as `@antelopejs/mongodb`.
|
|
69
|
+
|
|
70
|
+
Upgrading from 0.1? Read the [FAQ](https://dms.antelopejs.com/docs/modules/api/faq#upgrading-from-01).
|
|
71
71
|
|
|
72
72
|
## Documentation
|
|
73
73
|
|
|
@@ -103,6 +103,28 @@ pnpm knip
|
|
|
103
103
|
|
|
104
104
|
</details>
|
|
105
105
|
|
|
106
|
+
## Part of AntelopeJS DMS
|
|
107
|
+
|
|
108
|
+
This module installs into [AntelopeJS DMS](https://github.com/AntelopeJS/dms), the open-source back office. Every module adds its pages to the same dashboard, behind the same sign-in and roles.
|
|
109
|
+
|
|
110
|
+
<!-- antelopejs-dms-modules:start -->
|
|
111
|
+
|
|
112
|
+
| Module | What it adds |
|
|
113
|
+
| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
114
|
+
| [`dms-builder`](https://github.com/AntelopeJS/dms-builder) | Edit pages, tables and data sources by clicking, as TypeScript that compiles |
|
|
115
|
+
| [`dms-ai`](https://github.com/AntelopeJS/dms-ai) | An assistant chat in the dashboard, on your own Claude Code or Codex |
|
|
116
|
+
| [`dms-database`](https://github.com/AntelopeJS/dms-database) | Schemas, relation diagrams, a data browser and a query console |
|
|
117
|
+
| [`dms-api`](https://github.com/AntelopeJS/dms-api) | API health, request logs, per-route statistics and a request tester |
|
|
118
|
+
| [`dms-automation`](https://github.com/AntelopeJS/dms-automation) | Node-graph automations on schedules, webhooks and DMS events, with a trace for every run |
|
|
119
|
+
| [`dms-mailing`](https://github.com/AntelopeJS/dms-mailing) | E-mail templates in a block editor, versions, a send log and delivery metrics |
|
|
120
|
+
| [`dms-lang`](https://github.com/AntelopeJS/dms-lang) | Translation coverage, a translation matrix and a translation queue |
|
|
121
|
+
| [`dms-media`](https://github.com/AntelopeJS/dms-media) | A media library with folders, per-folder permissions, image sizes and light editing |
|
|
122
|
+
| [`dms-saas`](https://github.com/AntelopeJS/dms-saas) | Self-service sign-up, plans that gate features, and Stripe billing |
|
|
123
|
+
| [`dms-marketing`](https://github.com/AntelopeJS/dms-marketing) | Traffic, conversion funnels with A/B splits and click heatmaps, without cookies |
|
|
124
|
+
| [`dms-frontend`](https://github.com/AntelopeJS/dms-frontend) | The `ajs dms` CLI, the Vue renderer and the SDK every frontend module builds on |
|
|
125
|
+
|
|
126
|
+
<!-- antelopejs-dms-modules:end -->
|
|
127
|
+
|
|
106
128
|
## License
|
|
107
129
|
|
|
108
130
|
[Apache-2.0](./LICENSE)
|
|
@@ -3,8 +3,8 @@ import { type StatusBreakdown, type SummaryKpis } from "@/services/statistics-ag
|
|
|
3
3
|
interface GetApiHealthInput {
|
|
4
4
|
days?: number;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
type GetApiHealthOutput = SummaryKpis & {
|
|
7
7
|
statusBreakdown: StatusBreakdown;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
export declare const getApiHealthAction: ActionType<GetApiHealthInput, GetApiHealthOutput>;
|
|
10
10
|
export {};
|
|
@@ -10,9 +10,13 @@ interface QueryRequestLogsInput {
|
|
|
10
10
|
statusMax?: number;
|
|
11
11
|
limit?: number;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
type RequestLogEntry = Omit<RequestLog, "timestamp"> & {
|
|
14
|
+
timestamp: string;
|
|
15
|
+
};
|
|
16
|
+
type QueryRequestLogsOutput = {
|
|
17
|
+
results: RequestLogEntry[];
|
|
15
18
|
nextCursor?: string;
|
|
16
|
-
}
|
|
19
|
+
};
|
|
20
|
+
export declare function requestLogEntry(log: RequestLog): RequestLogEntry;
|
|
17
21
|
export declare const queryRequestLogsAction: ActionType<QueryRequestLogsInput, QueryRequestLogsOutput>;
|
|
18
22
|
export {};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.queryRequestLogsAction = void 0;
|
|
4
|
+
exports.requestLogEntry = requestLogEntry;
|
|
4
5
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
5
6
|
const db_1 = require("@/db");
|
|
6
7
|
const request_log_model_1 = require("@/db/models/request_log.model");
|
|
7
8
|
const read_1 = require("@/services/request-log/read");
|
|
8
9
|
const scope_1 = require("./scope");
|
|
10
|
+
function requestLogEntry(log) {
|
|
11
|
+
const { timestamp, ...fields } = log;
|
|
12
|
+
return { ...fields, timestamp: timestamp.toISOString() };
|
|
13
|
+
}
|
|
9
14
|
exports.queryRequestLogsAction = {
|
|
10
15
|
id: "api.query-request-logs",
|
|
11
16
|
name: "Query request logs",
|
|
@@ -44,7 +49,10 @@ exports.queryRequestLogsAction = {
|
|
|
44
49
|
statusMax: input.statusMax,
|
|
45
50
|
limit: input.limit,
|
|
46
51
|
}, keys);
|
|
47
|
-
return {
|
|
52
|
+
return {
|
|
53
|
+
results: page.results.map(requestLogEntry),
|
|
54
|
+
nextCursor: page.nextCursor ?? undefined,
|
|
55
|
+
};
|
|
48
56
|
},
|
|
49
57
|
};
|
|
50
58
|
//# sourceMappingURL=query-request-logs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-request-logs.js","sourceRoot":"","sources":["../../src/automation/query-request-logs.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"query-request-logs.js","sourceRoot":"","sources":["../../src/automation/query-request-logs.ts"],"names":[],"mappings":";;;AA8BA,0CAGC;AAjCD,6FAAqE;AAErE,6BAAuC;AACvC,qEAGuC;AAEvC,sDAAqE;AACrE,mCAA0C;AAqB1C,SAAgB,eAAe,CAAC,GAAe;IAC7C,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,GAAG,CAAC;IACrC,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;AAC3D,CAAC;AAEY,QAAA,sBAAsB,GAG/B;IACF,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,8DAA8D;IAC3E,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACvB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face RouteUnhealthyConfig {
|
|
|
5
5
|
intervalSeconds?: number;
|
|
6
6
|
flags?: Flag[];
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
interface RouteUnhealthyHandle {
|
|
9
|
+
timer?: NodeJS.Timeout;
|
|
10
|
+
previousFlags: Map<string, Flag>;
|
|
11
|
+
stopped: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const routeUnhealthyTrigger: TriggerType<RouteUnhealthyConfig, WatchListItem, RouteUnhealthyHandle>;
|
|
9
14
|
export {};
|
|
@@ -92,11 +92,8 @@ exports.routeUnhealthyTrigger = {
|
|
|
92
92
|
return handle;
|
|
93
93
|
},
|
|
94
94
|
async deactivate(handle) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return;
|
|
98
|
-
h.stopped = true;
|
|
99
|
-
clearInterval(h.timer);
|
|
95
|
+
handle.stopped = true;
|
|
96
|
+
clearInterval(handle.timer);
|
|
100
97
|
},
|
|
101
98
|
};
|
|
102
99
|
//# sourceMappingURL=route-unhealthy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-unhealthy.js","sourceRoot":"","sources":["../../src/automation/route-unhealthy.ts"],"names":[],"mappings":";;;AAAA,gEAA6D;AAC7D,6FAAqE;AAErE,6BAAuC;AACvC,0EAGyC;AACzC,mCAA0C;AAkB1C,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,aAAa,GAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAEpC,QAAA,qBAAqB,
|
|
1
|
+
{"version":3,"file":"route-unhealthy.js","sourceRoot":"","sources":["../../src/automation/route-unhealthy.ts"],"names":[],"mappings":";;;AAAA,gEAA6D;AAC7D,6FAAqE;AAErE,6BAAuC;AACvC,0EAGyC;AACzC,mCAA0C;AAkB1C,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,oBAAoB,GAAG,EAAE,CA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BACD,IAAI,CAAC,IAAI,CAAC,CAAC;oBACb,CAAC;gBACH,CAAC;gBACD,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC;oBACvC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;wBAAE,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAChD,CAAC;gBACD,MAAM,GAAG,IAAI,CAAC;YAChB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,iBAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,GAAG,CAAC,CAAC;YAC/D,CAAC;oBAAS,CAAC;gBACT,OAAO,GAAG,KAAK,CAAC;YAClB,CAAC;QACH,CAAC,CAAC;QAEF,KAAK,IAAI,EAAE,CAAC;QACZ,MAAM,CAAC,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE,EAAE,UAAU,CAAC,CAAC;QAC1D,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,CAAC,UAAU,CAAC,MAAM;QACrB,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC"}
|
|
@@ -4,18 +4,20 @@ declare const ApiSettingsModel_base: {
|
|
|
4
4
|
readonly table: import("@antelopejs/interface-database").Table<ApiSettings>;
|
|
5
5
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
6
|
get(id: string): PromiseLike<ApiSettings | undefined>;
|
|
7
|
-
getBy(index: keyof ApiSettings, ...keys:
|
|
7
|
+
getBy(index: keyof ApiSettings, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<ApiSettings[]>;
|
|
8
8
|
getAll(): PromiseLike<ApiSettings[]>;
|
|
9
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
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
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<ApiSettings> & {
|
|
12
|
+
_id: string;
|
|
13
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
14
|
delete(id: string): Promise<number>;
|
|
13
15
|
};
|
|
14
|
-
readonly schemaName: string;
|
|
16
|
+
readonly schemaName: string | undefined;
|
|
15
17
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<ApiSettings>;
|
|
16
|
-
fromPlainData(obj:
|
|
18
|
+
fromPlainData(obj: ApiSettings | import("@antelopejs/interface-database-decorators").PlainData<ApiSettings>): ApiSettings;
|
|
17
19
|
fromDatabase(obj: any): ApiSettings | undefined;
|
|
18
|
-
toDatabase(obj:
|
|
20
|
+
toDatabase(obj: ApiSettings | import("@antelopejs/interface-database-decorators").PlainData<ApiSettings>): import("@antelopejs/interface-database-decorators").StoredRow<ApiSettings>;
|
|
19
21
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
22
|
};
|
|
21
23
|
export declare class ApiSettingsModel extends ApiSettingsModel_base {
|
|
@@ -56,18 +56,20 @@ declare const RequestLogModel_base: {
|
|
|
56
56
|
readonly table: import("@antelopejs/interface-database").Table<RequestLog>;
|
|
57
57
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
58
58
|
get(id: string): PromiseLike<RequestLog | undefined>;
|
|
59
|
-
getBy(index: keyof RequestLog, ...keys:
|
|
59
|
+
getBy(index: keyof RequestLog, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<RequestLog[]>;
|
|
60
60
|
getAll(): PromiseLike<RequestLog[]>;
|
|
61
61
|
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[]>;
|
|
62
62
|
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<RequestLog>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
63
|
-
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<RequestLog
|
|
63
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<RequestLog> & {
|
|
64
|
+
_id: string;
|
|
65
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
64
66
|
delete(id: string): Promise<number>;
|
|
65
67
|
};
|
|
66
|
-
readonly schemaName: string;
|
|
68
|
+
readonly schemaName: string | undefined;
|
|
67
69
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<RequestLog>;
|
|
68
|
-
fromPlainData(obj:
|
|
70
|
+
fromPlainData(obj: RequestLog | import("@antelopejs/interface-database-decorators").PlainData<RequestLog>): RequestLog;
|
|
69
71
|
fromDatabase(obj: any): RequestLog | undefined;
|
|
70
|
-
toDatabase(obj:
|
|
72
|
+
toDatabase(obj: RequestLog | import("@antelopejs/interface-database-decorators").PlainData<RequestLog>): import("@antelopejs/interface-database-decorators").StoredRow<RequestLog>;
|
|
71
73
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
72
74
|
};
|
|
73
75
|
export declare class RequestLogModel extends RequestLogModel_base {
|
|
@@ -4,18 +4,20 @@ declare const RouteModel_base: {
|
|
|
4
4
|
readonly table: import("@antelopejs/interface-database").Table<Route>;
|
|
5
5
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
6
|
get(id: string): PromiseLike<Route | undefined>;
|
|
7
|
-
getBy(index: keyof Route, ...keys:
|
|
7
|
+
getBy(index: keyof Route, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<Route[]>;
|
|
8
8
|
getAll(): PromiseLike<Route[]>;
|
|
9
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
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
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<Route> & {
|
|
12
|
+
_id: string;
|
|
13
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
14
|
delete(id: string): Promise<number>;
|
|
13
15
|
};
|
|
14
|
-
readonly schemaName: string;
|
|
16
|
+
readonly schemaName: string | undefined;
|
|
15
17
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<Route>;
|
|
16
|
-
fromPlainData(obj:
|
|
18
|
+
fromPlainData(obj: Route | import("@antelopejs/interface-database-decorators").PlainData<Route>): Route;
|
|
17
19
|
fromDatabase(obj: any): Route | undefined;
|
|
18
|
-
toDatabase(obj:
|
|
20
|
+
toDatabase(obj: Route | import("@antelopejs/interface-database-decorators").PlainData<Route>): import("@antelopejs/interface-database-decorators").StoredRow<Route>;
|
|
19
21
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
22
|
};
|
|
21
23
|
export declare class RouteModel extends RouteModel_base {
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import type { AtomicMutationOutcome } from "@antelopejs/interface-database/atomic";
|
|
1
|
+
import type { AtomicMutation, AtomicMutationOutcome } from "@antelopejs/interface-database/atomic";
|
|
2
2
|
import { RouteStatistics } from "../tables/routes_statistics.table";
|
|
3
|
+
export declare function statisticsMutation(doc: RouteStatistics): AtomicMutation<RouteStatistics>;
|
|
3
4
|
declare const RouteStatisticsModel_base: {
|
|
4
5
|
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
5
6
|
readonly table: import("@antelopejs/interface-database").Table<RouteStatistics>;
|
|
6
7
|
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
8
|
get(id: string): PromiseLike<RouteStatistics | undefined>;
|
|
8
|
-
getBy(index: keyof RouteStatistics, ...keys:
|
|
9
|
+
getBy(index: keyof RouteStatistics, ...keys: import("@antelopejs/interface-database-decorators").IndexKey[]): PromiseLike<RouteStatistics[]>;
|
|
9
10
|
getAll(): PromiseLike<RouteStatistics[]>;
|
|
10
11
|
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[]>;
|
|
11
12
|
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<RouteStatistics>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
|
-
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<RouteStatistics
|
|
13
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<RouteStatistics> & {
|
|
14
|
+
_id: string;
|
|
15
|
+
}, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
13
16
|
delete(id: string): Promise<number>;
|
|
14
17
|
};
|
|
15
|
-
readonly schemaName: string;
|
|
18
|
+
readonly schemaName: string | undefined;
|
|
16
19
|
readonly tableClass: import("@antelopejs/interface-database-decorators").Constructible<RouteStatistics>;
|
|
17
|
-
fromPlainData(obj:
|
|
20
|
+
fromPlainData(obj: RouteStatistics | import("@antelopejs/interface-database-decorators").PlainData<RouteStatistics>): RouteStatistics;
|
|
18
21
|
fromDatabase(obj: any): RouteStatistics | undefined;
|
|
19
|
-
toDatabase(obj:
|
|
22
|
+
toDatabase(obj: RouteStatistics | import("@antelopejs/interface-database-decorators").PlainData<RouteStatistics>): import("@antelopejs/interface-database-decorators").StoredRow<RouteStatistics>;
|
|
20
23
|
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
21
24
|
};
|
|
22
25
|
export declare class RouteStatisticsModel extends RouteStatisticsModel_base {
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RouteStatisticsModel = void 0;
|
|
4
|
+
exports.statisticsMutation = statisticsMutation;
|
|
4
5
|
const node_crypto_1 = require("node:crypto");
|
|
5
6
|
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
6
7
|
const routes_statistics_table_1 = require("../tables/routes_statistics.table");
|
|
8
|
+
function statisticsMutation(doc) {
|
|
9
|
+
return {
|
|
10
|
+
type: "update",
|
|
11
|
+
revisionField: "revision",
|
|
12
|
+
expectedRevision: doc.revision ?? { kind: "missing" },
|
|
13
|
+
nextRevision: (0, node_crypto_1.randomUUID)(),
|
|
14
|
+
patch: { statistics: doc.statistics },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
7
17
|
class RouteStatisticsModel extends (0, interface_database_decorators_1.BasicDataModel)(routes_statistics_table_1.RouteStatistics, routes_statistics_table_1.routesStatisticsTableName) {
|
|
8
18
|
async getByRoute(method, uri) {
|
|
9
19
|
const id = (0, routes_statistics_table_1.getRouteStatsKey)(method, uri);
|
|
10
20
|
return this.get(id);
|
|
11
21
|
}
|
|
12
22
|
async replaceStatistics(doc) {
|
|
13
|
-
return this.table
|
|
14
|
-
.atomicMutation(doc._id, {
|
|
15
|
-
type: "update",
|
|
16
|
-
revisionField: "revision",
|
|
17
|
-
expectedRevision: doc.revision,
|
|
18
|
-
nextRevision: (0, node_crypto_1.randomUUID)(),
|
|
19
|
-
patch: { statistics: doc.statistics },
|
|
20
|
-
})
|
|
21
|
-
.run();
|
|
23
|
+
return this.table.atomicMutation(doc._id, statisticsMutation(doc)).run();
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
exports.RouteStatisticsModel = RouteStatisticsModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes_statistics.model.js","sourceRoot":"","sources":["../../../src/db/models/routes_statistics.model.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"routes_statistics.model.js","sourceRoot":"","sources":["../../../src/db/models/routes_statistics.model.ts"],"names":[],"mappings":";;;AAaA,gDAUC;AAvBD,6CAAyC;AAKzC,6FAA2E;AAC3E,+EAI2C;AAG3C,SAAgB,kBAAkB,CAChC,GAAoB;IAEpB,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,aAAa,EAAE,UAAU;QACzB,gBAAgB,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;QACrD,YAAY,EAAE,IAAA,wBAAU,GAAE;QAC1B,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE;KACtC,CAAC;AACJ,CAAC;AAED,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;IAQD,KAAK,CAAC,iBAAiB,CACrB,GAAoB;QAEpB,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAC3E,CAAC;CACF;AA1BD,oDA0BC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Table } from "@antelopejs/interface-database-decorators";
|
|
2
2
|
export declare const requestLogTableName = "request_log";
|
|
3
3
|
export declare const REQUEST_LOG_ORDER_INDEX = "timestamp_id";
|
|
4
|
-
export
|
|
4
|
+
export type RequestLogError = {
|
|
5
5
|
message: string;
|
|
6
6
|
stack?: string;
|
|
7
|
-
}
|
|
7
|
+
};
|
|
8
8
|
export type RequestLogBodyOmission = "disabled" | "too-large" | "not-json" | "malformed" | "empty" | "not-read";
|
|
9
9
|
export type RequestLogSource = "tester";
|
|
10
|
-
export
|
|
10
|
+
export type RequestLogRedactions = {
|
|
11
11
|
query: number;
|
|
12
12
|
requestBody: number;
|
|
13
13
|
responseBody: number;
|
|
14
14
|
headers: string[];
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
export declare class RequestLog extends Table {
|
|
17
17
|
timestamp: Date;
|
|
18
18
|
_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes_statistics.table.js","sourceRoot":"","sources":["../../../src/db/tables/routes_statistics.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAcA,oDAEC;AAQD,gDAEC;AAQD,4CAEC;AApCD,6FAImD;AAEnD,qDAAoD;AAEvC,QAAA,yBAAyB,GAAG,mBAAmB,CAAC;AAM7D,SAAgB,oBAAoB,CAAC,MAAc;IACjD,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC;AAC9B,CAAC;AAQD,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/D,CAAC;AAQD,SAAgB,gBAAgB,CAAC,MAAc,EAAE,GAAW;IAC1D,OAAO,GAAG,oBAAoB,CAAC,MAAM,CAAC,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;AACtE,CAAC;AAGM,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,qCAAK;
|
|
1
|
+
{"version":3,"file":"routes_statistics.table.js","sourceRoot":"","sources":["../../../src/db/tables/routes_statistics.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAcA,oDAEC;AAQD,gDAEC;AAQD,4CAEC;AApCD,6FAImD;AAEnD,qDAAoD;AAEvC,QAAA,yBAAyB,GAAG,mBAAmB,CAAC;AAM7D,SAAgB,oBAAoB,CAAC,MAAc;IACjD,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC;AAC9B,CAAC;AAQD,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC/D,CAAC;AAQD,SAAgB,gBAAgB,CAAC,MAAc,EAAE,GAAW;IAC1D,OAAO,GAAG,oBAAoB,CAAC,MAAM,CAAC,IAAI,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;AACtE,CAAC;AAGM,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,qCAAK;CAiBzC,CAAA;AAjBY,0CAAe;AAElB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;+CACO;AAGf;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;4CACI;AAGZ;IADP,IAAA,qCAAK,EAAC,CAAC,KAAK,CAAC,CAAC;;mDACqB;AAQ5B;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;iDACU;0BAhBf,eAAe;IAD3B,IAAA,6CAAa,EAAC,iCAAyB,EAAE,uBAAW,CAAC;GACzC,eAAe,CAiB3B"}
|
package/dist/guards.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare function isString(value: unknown): value is string;
|
|
|
3
3
|
export declare function isNumber(value: unknown): value is number;
|
|
4
4
|
export declare function isFunction(value: unknown): value is Function;
|
|
5
5
|
export declare function isObject(value: unknown): value is object;
|
|
6
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
6
7
|
export declare function isMessageBody(value: unknown): value is {
|
|
7
8
|
error?: unknown;
|
|
8
9
|
message?: unknown;
|
|
@@ -12,7 +13,7 @@ export declare function isBodyCarrier(value: unknown): value is {
|
|
|
12
13
|
body?: unknown;
|
|
13
14
|
};
|
|
14
15
|
export declare function hasStatusGetter(value: unknown): value is {
|
|
15
|
-
getStatus:
|
|
16
|
+
getStatus: Function;
|
|
16
17
|
};
|
|
17
18
|
export declare function isJsonValue(value: unknown): value is JsonValue;
|
|
18
19
|
export declare function isTextOrBuffer(value: unknown): value is string | Buffer;
|
package/dist/guards.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.isString = isString;
|
|
|
4
4
|
exports.isNumber = isNumber;
|
|
5
5
|
exports.isFunction = isFunction;
|
|
6
6
|
exports.isObject = isObject;
|
|
7
|
+
exports.isRecord = isRecord;
|
|
7
8
|
exports.isMessageBody = isMessageBody;
|
|
8
9
|
exports.isBodyCarrier = isBodyCarrier;
|
|
9
10
|
exports.hasStatusGetter = hasStatusGetter;
|
|
@@ -22,6 +23,9 @@ function isFunction(value) {
|
|
|
22
23
|
function isObject(value) {
|
|
23
24
|
return typeof value === "object" && value !== null;
|
|
24
25
|
}
|
|
26
|
+
function isRecord(value) {
|
|
27
|
+
return typeof value === "object" && value !== null;
|
|
28
|
+
}
|
|
25
29
|
function isMessageBody(value) {
|
|
26
30
|
return typeof value === "object" && value !== null;
|
|
27
31
|
}
|
|
@@ -35,18 +39,27 @@ function hasStatusGetter(value) {
|
|
|
35
39
|
typeof value.getStatus === "function");
|
|
36
40
|
}
|
|
37
41
|
function isJsonValue(value) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
const pending = [value];
|
|
43
|
+
while (pending.length > 0) {
|
|
44
|
+
const current = pending.pop();
|
|
45
|
+
if (current === null || isString(current) || isNumber(current))
|
|
46
|
+
continue;
|
|
47
|
+
if (typeof current === "boolean")
|
|
48
|
+
continue;
|
|
49
|
+
if (Array.isArray(current)) {
|
|
50
|
+
for (const item of current)
|
|
51
|
+
pending.push(item);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (!isObject(current))
|
|
55
|
+
return false;
|
|
56
|
+
const prototype = Object.getPrototypeOf(current);
|
|
57
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
58
|
+
return false;
|
|
59
|
+
for (const item of Object.values(current))
|
|
60
|
+
pending.push(item);
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
50
63
|
}
|
|
51
64
|
function isTextOrBuffer(value) {
|
|
52
65
|
return typeof value === "string" || Buffer.isBuffer(value);
|
package/dist/guards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":";;AAGA,4BAEC;AAGD,4BAEC;AAGD,gCAEC;AAGD,4BAEC;AAGD,sCAIC;AAGD,sCAIC;AAGD,0CASC;
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":";;AAGA,4BAEC;AAGD,4BAEC;AAGD,gCAEC;AAGD,4BAEC;AAGD,4BAEC;AAGD,sCAIC;AAGD,sCAIC;AAGD,0CASC;AAQD,kCAgBC;AAGD,wCAEC;AAGD,kCAIC;AApFD,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAGD,SAAgB,QAAQ,CAAC,KAA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,KAAK,MAAM,IAAI,IAAI,OAAO;gBAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,SAAS;QACX,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;QACrC,MAAM,SAAS,GAAY,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QACvE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAGD,SAAgB,cAAc,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC;AAGD,SAAgB,WAAW,CACzB,KAAc;IAEd,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/memo.js
CHANGED
|
@@ -19,8 +19,9 @@ function createMemo(maxEntries, defaultTtlMs) {
|
|
|
19
19
|
cached(key, load, ttlMs = defaultTtlMs) {
|
|
20
20
|
const now = Date.now();
|
|
21
21
|
const hit = entries.get(key);
|
|
22
|
-
if (hit && hit.expires > now)
|
|
22
|
+
if (hit && hit.expires > now) {
|
|
23
23
|
return hit.value;
|
|
24
|
+
}
|
|
24
25
|
evictExpired(now);
|
|
25
26
|
const value = load();
|
|
26
27
|
entries.set(key, { expires: now + ttlMs, value });
|
package/dist/memo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memo.js","sourceRoot":"","sources":["../src/memo.ts"],"names":[],"mappings":";;AAoBA,
|
|
1
|
+
{"version":3,"file":"memo.js","s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AO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;YACH,OAAO,KAAK,CAAC;QACf,CAAC;QACD,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE;KAC7B,CAAC;AACJ,CAAC"}
|
package/dist/routes/settings.js
CHANGED
|
@@ -25,6 +25,7 @@ const route_catalog_1 = require("@/services/route-catalog");
|
|
|
25
25
|
const scope_1 = require("@/services/scope");
|
|
26
26
|
const settings_2 = require("@/services/settings");
|
|
27
27
|
const settings_form_1 = require("@/services/settings-form");
|
|
28
|
+
const zod_json_1 = require("@/services/zod-json");
|
|
28
29
|
const types_1 = require("@/types");
|
|
29
30
|
const HTTP_BAD_REQUEST = 400;
|
|
30
31
|
function settingsValues() {
|
|
@@ -44,8 +45,10 @@ class SettingsController extends (0, interface_api_1.Controller)("/api/monitorin
|
|
|
44
45
|
}
|
|
45
46
|
async submitSettings(_user, body) {
|
|
46
47
|
const result = (0, settings_form_1.validateSettings)(body, redaction_1.isSensitiveHeader);
|
|
47
|
-
if (!result.ok)
|
|
48
|
-
|
|
48
|
+
if (!result.ok) {
|
|
49
|
+
const { error } = result;
|
|
50
|
+
throw new interface_api_1.HTTPResult(HTTP_BAD_REQUEST, Array.isArray(error) ? (0, zod_json_1.zodIssuesJson)(error) : error);
|
|
51
|
+
}
|
|
49
52
|
await (0, settings_2.updateSettings)((0, interface_database_decorators_1.GetModel)(db_1.ApiSettingsModel), (0, settings_form_1.toSettingsUpdate)(result.data));
|
|
50
53
|
return settingsValues();
|
|
51
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/routes/settings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAOmC;AACnC,uEAAwD;AACxD,6FAAqE;AACrE,yDAA+D;AAE/D,6DAA0E;AAC1E,6BAKc;AACd,+CAAgD;AAChD,gEAG0C;AAC1C,4DAAuD;AACv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AA,yBAAS,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC3B,WAAA,IAAA,yBAAS,EAAC,MAAM,EAAE,OAAO,CAAC,CAAA;;;;4DAc5B;AASK;IADL,IAAA,mBAAG,EAAC,SAAS,CAAC;IACG,WAAA,IAAA,oBAAa,GAAE,CAAA;;;;oDAIhC"}
|
|
@@ -11,6 +11,5 @@ export interface ControllerDecorators {
|
|
|
11
11
|
methods: Record<string, DecoratedParameter[]>;
|
|
12
12
|
}
|
|
13
13
|
export declare function parseControllerDecorators(source: string, className: string): ControllerDecorators;
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function controllerDecorators(handler: Pick<RouteHandler, "proto">): ControllerDecorators | undefined;
|
|
14
|
+
export declare function controllerDecorators(handler: Pick<RouteHandler, "controller">): ControllerDecorators | undefined;
|
|
16
15
|
export declare function isAuthDecorator(name: string): boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseControllerDecorators = parseControllerDecorators;
|
|
4
|
-
exports.controllerClass = controllerClass;
|
|
5
4
|
exports.controllerDecorators = controllerDecorators;
|
|
6
5
|
exports.isAuthDecorator = isAuthDecorator;
|
|
7
6
|
const node_fs_1 = require("node:fs");
|
|
@@ -182,13 +181,9 @@ function definingSource(ctor) {
|
|
|
182
181
|
}
|
|
183
182
|
return undefined;
|
|
184
183
|
}
|
|
185
|
-
function controllerClass(handler) {
|
|
186
|
-
const ctor = handler.proto?.constructor;
|
|
187
|
-
return (0, guards_1.isFunction)(ctor) ? ctor : undefined;
|
|
188
|
-
}
|
|
189
184
|
function controllerDecorators(handler) {
|
|
190
|
-
const ctor =
|
|
191
|
-
if (!
|
|
185
|
+
const ctor = handler.controller;
|
|
186
|
+
if (!IDENTIFIER.test(ctor.name))
|
|
192
187
|
return undefined;
|
|
193
188
|
if (!parsed.has(ctor)) {
|
|
194
189
|
const source = definingSource(ctor);
|