statcon 0.1.0 → 0.2.0
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Base, Serialize } from "./Base.js";
|
|
2
|
-
export type
|
|
2
|
+
export type EndpointAlertingConfiguration = {
|
|
3
3
|
type?: string;
|
|
4
4
|
enabled?: boolean;
|
|
5
5
|
failureThreshold?: number;
|
|
@@ -8,11 +8,11 @@ export type AlertingConfiguration = {
|
|
|
8
8
|
sendOnResolved?: boolean;
|
|
9
9
|
description?: string;
|
|
10
10
|
[additional: string]: any;
|
|
11
|
-
providerOverride?: Partial<
|
|
11
|
+
providerOverride?: Partial<EndpointAlertingConfiguration>;
|
|
12
12
|
};
|
|
13
13
|
export declare class Alerting extends Base implements Serialize {
|
|
14
|
-
data:
|
|
15
|
-
constructor(data:
|
|
14
|
+
data: EndpointAlertingConfiguration;
|
|
15
|
+
constructor(data: EndpointAlertingConfiguration);
|
|
16
16
|
type(type: string): this;
|
|
17
17
|
enabled(enabled: boolean): this;
|
|
18
18
|
failureThreshold(threshold: number): this;
|
|
@@ -21,6 +21,6 @@ export declare class Alerting extends Base implements Serialize {
|
|
|
21
21
|
sendOnResolved(send: boolean): this;
|
|
22
22
|
description(description: string): this;
|
|
23
23
|
set(key: string, value: any): this;
|
|
24
|
-
providerOverride(override: Partial<
|
|
24
|
+
providerOverride(override: Partial<EndpointAlertingConfiguration>): this;
|
|
25
25
|
serialize(): Record<string, any>;
|
|
26
26
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Alerting, AlertingConfiguration } from "./Alerting.js";
|
|
2
1
|
import { Announcement, AnnouncementConfiguration } from "./Announcement.js";
|
|
3
2
|
import { Base, Serialize } from "./Base.js";
|
|
4
3
|
import { Endpoint, EndpointConfiguration } from "./Endpoint.js";
|
|
@@ -12,7 +11,7 @@ import { Web, WebConfiguration } from "./Web.js";
|
|
|
12
11
|
export type ConfigurationConfiguration = {
|
|
13
12
|
metrics?: boolean;
|
|
14
13
|
storage?: Storage;
|
|
15
|
-
alerting?:
|
|
14
|
+
alerting?: Record<string, unknown>;
|
|
16
15
|
announcements?: Announcement[];
|
|
17
16
|
endpoints?: Endpoint[];
|
|
18
17
|
externalEndpoints?: ExternalEndpoint[];
|
|
@@ -38,8 +37,7 @@ export declare class Configuration extends Base implements Serialize {
|
|
|
38
37
|
ui(ui: (ui: UI) => UI): this;
|
|
39
38
|
security(base: SecurityConfiguration, security?: (security: Security) => Security): this;
|
|
40
39
|
security(security: (security: Security) => Security): this;
|
|
41
|
-
|
|
42
|
-
alert(alert: (alert: Alerting) => Alerting): this;
|
|
40
|
+
alerting(base: Record<string, unknown>): this;
|
|
43
41
|
announcement(base: AnnouncementConfiguration, announcement?: (announcement: Announcement) => Announcement): this;
|
|
44
42
|
announcement(announcement: (announcement: Announcement) => Announcement): this;
|
|
45
43
|
maintenance(base: MaintenanceConfiguration, maintenance?: (maintenance: Maintenance) => Maintenance): this;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Alerting } from "./Alerting.js";
|
|
2
1
|
import { Announcement } from "./Announcement.js";
|
|
3
2
|
import { Base } from "./Base.js";
|
|
4
3
|
import { Endpoint } from "./Endpoint.js";
|
|
@@ -79,20 +78,8 @@ export class Configuration extends Base {
|
|
|
79
78
|
this.data.security = securityInstance;
|
|
80
79
|
return this;
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (typeof baseOrAlert === "function") {
|
|
85
|
-
alertInstance = baseOrAlert(new Alerting({}));
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
alertInstance = new Alerting(baseOrAlert);
|
|
89
|
-
if (alert)
|
|
90
|
-
alertInstance = alert(alertInstance);
|
|
91
|
-
}
|
|
92
|
-
if (!this.data.alerting) {
|
|
93
|
-
this.data.alerting = [];
|
|
94
|
-
}
|
|
95
|
-
this.data.alerting.push(alertInstance);
|
|
81
|
+
alerting(base) {
|
|
82
|
+
this.data.alerting = base;
|
|
96
83
|
return this;
|
|
97
84
|
}
|
|
98
85
|
announcement(baseOrAnnouncement, announcement) {
|
|
@@ -177,9 +164,6 @@ export class Configuration extends Base {
|
|
|
177
164
|
}
|
|
178
165
|
serialize() {
|
|
179
166
|
let output = { ...this.data };
|
|
180
|
-
if (this.data.alerting) {
|
|
181
|
-
output.alerting = this.data.alerting.map((alert) => alert.serialize());
|
|
182
|
-
}
|
|
183
167
|
if (this.data.announcements) {
|
|
184
168
|
output.announcements = this.data.announcements.map((announcement) => announcement.serialize());
|
|
185
169
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Alerting,
|
|
1
|
+
import { Alerting, EndpointAlertingConfiguration } from "./Alerting.js";
|
|
2
2
|
import { Base, Serialize } from "./Base.js";
|
|
3
3
|
import { Client, ClientConfiguration } from "./Client.js";
|
|
4
4
|
import { Maintenance, MaintenanceConfiguration } from "./Maintenance.js";
|
|
@@ -75,7 +75,7 @@ export declare class Endpoint extends Base implements Serialize {
|
|
|
75
75
|
header(key: string, value: string): this;
|
|
76
76
|
dns(queryName: string, queryType: DnsRecordType): this;
|
|
77
77
|
ssh(username: string, password: string): this;
|
|
78
|
-
alert(base:
|
|
78
|
+
alert(base: EndpointAlertingConfiguration, cb?: (alert: Alerting) => Alerting): this;
|
|
79
79
|
maintenance(base: MaintenanceConfiguration, cb?: (maintenance: Maintenance) => Maintenance): this;
|
|
80
80
|
client(base: ClientConfiguration, cb?: (client: Client) => Client): this;
|
|
81
81
|
ui(base: NonNullable<EndpointConfiguration["ui"]>, cb?: (ui: EndpointUI) => EndpointUI): this;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Alerting,
|
|
1
|
+
import { Alerting, EndpointAlertingConfiguration } from "./Alerting.js";
|
|
2
2
|
import { Base, Serialize } from "./Base.js";
|
|
3
3
|
export type ExternalEndpointConfiguration = {
|
|
4
4
|
enabled?: boolean;
|
|
@@ -17,6 +17,6 @@ export declare class ExternalEndpoint extends Base implements Serialize {
|
|
|
17
17
|
group(group: string): this;
|
|
18
18
|
token(token: string): this;
|
|
19
19
|
heartbeatInterval(interval: string): this;
|
|
20
|
-
alert(base:
|
|
20
|
+
alert(base: EndpointAlertingConfiguration, alert?: (alert: Alerting) => Alerting): this;
|
|
21
21
|
serialize(): Record<string, any>;
|
|
22
22
|
}
|