statcon 0.1.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.
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +36 -0
- package/dist/serializeCasing.d.ts +10 -0
- package/dist/serializeCasing.js +17 -0
- package/dist/structures/Alerting.d.ts +26 -0
- package/dist/structures/Alerting.js +47 -0
- package/dist/structures/Announcement.d.ts +15 -0
- package/dist/structures/Announcement.js +23 -0
- package/dist/structures/Base.d.ts +6 -0
- package/dist/structures/Base.js +5 -0
- package/dist/structures/Client.d.ts +57 -0
- package/dist/structures/Client.js +126 -0
- package/dist/structures/Configuration.d.ts +54 -0
- package/dist/structures/Configuration.js +215 -0
- package/dist/structures/Endpoint.d.ts +84 -0
- package/dist/structures/Endpoint.js +163 -0
- package/dist/structures/ExternalEndpoint.d.ts +22 -0
- package/dist/structures/ExternalEndpoint.js +44 -0
- package/dist/structures/Maintenance.d.ts +18 -0
- package/dist/structures/Maintenance.js +31 -0
- package/dist/structures/Security.d.ts +44 -0
- package/dist/structures/Security.js +91 -0
- package/dist/structures/Storage.d.ts +18 -0
- package/dist/structures/Storage.js +31 -0
- package/dist/structures/Tunnel.d.ts +20 -0
- package/dist/structures/Tunnel.js +35 -0
- package/dist/structures/UI.d.ts +34 -0
- package/dist/structures/UI.js +55 -0
- package/dist/structures/Web.d.ts +18 -0
- package/dist/structures/Web.js +31 -0
- package/dist/structures/index.d.ts +13 -0
- package/dist/structures/index.js +13 -0
- package/dist/types.d.ts +24 -0
- package/dist/types.js +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Base } from "./Base.js";
|
|
2
|
+
export class BasicSecurity extends Base {
|
|
3
|
+
data;
|
|
4
|
+
constructor(data) {
|
|
5
|
+
super();
|
|
6
|
+
this.data = data;
|
|
7
|
+
}
|
|
8
|
+
username(username) {
|
|
9
|
+
this.data.username = username;
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
passwordBcryptBase64(password) {
|
|
13
|
+
this.data.passwordBcryptBase64 = password;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
serialize() {
|
|
17
|
+
return this.data;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export class OidcSecurity extends Base {
|
|
21
|
+
data;
|
|
22
|
+
constructor(data) {
|
|
23
|
+
super();
|
|
24
|
+
this.data = data;
|
|
25
|
+
}
|
|
26
|
+
issuerUrl(url) {
|
|
27
|
+
this.data.issuerUrl = url;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
redirectUrl(url) {
|
|
31
|
+
this.data.redirectUrl = url;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
clientId(id) {
|
|
35
|
+
this.data.clientId = id;
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
clientSecret(secret) {
|
|
39
|
+
this.data.clientSecret = secret;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
scopes(scopes) {
|
|
43
|
+
this.data.scopes = scopes;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
allowedSubjects(subjects) {
|
|
47
|
+
this.data.allowedSubjects = subjects;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
sessionTtl(ttl) {
|
|
51
|
+
this.data.sessionTtl = ttl;
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
serialize() {
|
|
55
|
+
return this.data;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export class Security extends Base {
|
|
59
|
+
data;
|
|
60
|
+
constructor(data) {
|
|
61
|
+
super();
|
|
62
|
+
this.data = data;
|
|
63
|
+
}
|
|
64
|
+
basic(baseOrCb, cb) {
|
|
65
|
+
let basicSecurity;
|
|
66
|
+
if (typeof baseOrCb === "function") {
|
|
67
|
+
basicSecurity = new BasicSecurity({});
|
|
68
|
+
cb = baseOrCb;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
basicSecurity = new BasicSecurity(baseOrCb);
|
|
72
|
+
}
|
|
73
|
+
this.data.basic = cb(basicSecurity).data;
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
oidc(baseOrCb, cb) {
|
|
77
|
+
let oidcSecurity;
|
|
78
|
+
if (typeof baseOrCb === "function") {
|
|
79
|
+
oidcSecurity = new OidcSecurity({});
|
|
80
|
+
cb = baseOrCb;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
oidcSecurity = new OidcSecurity(baseOrCb);
|
|
84
|
+
}
|
|
85
|
+
this.data.oidc = cb(oidcSecurity).data;
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
serialize() {
|
|
89
|
+
return this.data;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Base, Serialize } from "./Base.js";
|
|
2
|
+
export type StorageConfiguration = {
|
|
3
|
+
path?: string;
|
|
4
|
+
type?: "memory" | "sqlite" | "postgres";
|
|
5
|
+
writeThroughCache?: boolean;
|
|
6
|
+
maximumNumberOfResults?: number;
|
|
7
|
+
maximumNumberOfEvents?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare class Storage extends Base implements Serialize {
|
|
10
|
+
data: StorageConfiguration;
|
|
11
|
+
constructor(data: StorageConfiguration);
|
|
12
|
+
path(path: string): this;
|
|
13
|
+
type(type: StorageConfiguration["type"]): this;
|
|
14
|
+
writeThroughCache(enabled: boolean): this;
|
|
15
|
+
maximumNumberOfResults(max: number): this;
|
|
16
|
+
maximumNumberOfEvents(max: number): this;
|
|
17
|
+
serialize(): Record<string, any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Base } from "./Base.js";
|
|
2
|
+
export class Storage extends Base {
|
|
3
|
+
data;
|
|
4
|
+
constructor(data) {
|
|
5
|
+
super();
|
|
6
|
+
this.data = data;
|
|
7
|
+
}
|
|
8
|
+
path(path) {
|
|
9
|
+
this.data.path = path;
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
type(type) {
|
|
13
|
+
this.data.type = type;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
writeThroughCache(enabled) {
|
|
17
|
+
this.data.writeThroughCache = enabled;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
maximumNumberOfResults(max) {
|
|
21
|
+
this.data.maximumNumberOfResults = max;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
maximumNumberOfEvents(max) {
|
|
25
|
+
this.data.maximumNumberOfEvents = max;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
serialize() {
|
|
29
|
+
return this.data;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Base, Serialize } from "./Base.js";
|
|
2
|
+
export type TunnelingConfiguration = {
|
|
3
|
+
type?: "SSH";
|
|
4
|
+
host?: string;
|
|
5
|
+
port?: number;
|
|
6
|
+
username?: string;
|
|
7
|
+
password?: string;
|
|
8
|
+
privateKey?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare class Tunnel extends Base implements Serialize {
|
|
11
|
+
data: TunnelingConfiguration;
|
|
12
|
+
constructor(data: TunnelingConfiguration);
|
|
13
|
+
type(type: "SSH"): this;
|
|
14
|
+
host(host: string): this;
|
|
15
|
+
port(port: number): this;
|
|
16
|
+
username(username: string): this;
|
|
17
|
+
password(password: string): this;
|
|
18
|
+
privateKey(privateKey: string): this;
|
|
19
|
+
serialize(): Record<string, any>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Base } from "./Base.js";
|
|
2
|
+
export class Tunnel extends Base {
|
|
3
|
+
data;
|
|
4
|
+
constructor(data) {
|
|
5
|
+
super();
|
|
6
|
+
this.data = data;
|
|
7
|
+
}
|
|
8
|
+
type(type) {
|
|
9
|
+
this.data.type = type;
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
host(host) {
|
|
13
|
+
this.data.host = host;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
port(port) {
|
|
17
|
+
this.data.port = port;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
username(username) {
|
|
21
|
+
this.data.username = username;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
password(password) {
|
|
25
|
+
this.data.password = password;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
privateKey(privateKey) {
|
|
29
|
+
this.data.privateKey = privateKey;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
serialize() {
|
|
33
|
+
return this.data;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Base, Serialize } from "./Base.js";
|
|
2
|
+
export type UIConfiguration = {
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
dashboardHeading?: string;
|
|
6
|
+
dashboardSubheading?: string;
|
|
7
|
+
header?: string;
|
|
8
|
+
logo?: string;
|
|
9
|
+
link?: string;
|
|
10
|
+
buttons?: {
|
|
11
|
+
name: string;
|
|
12
|
+
link: string;
|
|
13
|
+
}[];
|
|
14
|
+
customCss?: string;
|
|
15
|
+
darkMode?: boolean;
|
|
16
|
+
defaultSortBy?: "name" | "group" | "health";
|
|
17
|
+
defaultFilterBy?: "none" | "failing" | "unstable";
|
|
18
|
+
};
|
|
19
|
+
export declare class UI extends Base implements Serialize {
|
|
20
|
+
data: UIConfiguration;
|
|
21
|
+
constructor(data: UIConfiguration);
|
|
22
|
+
title(title: string): this;
|
|
23
|
+
description(description: string): this;
|
|
24
|
+
dashboardHeading(heading: string): this;
|
|
25
|
+
dashboardSubheading(subheading: string): this;
|
|
26
|
+
header(header: string): this;
|
|
27
|
+
logo(logo: string): this;
|
|
28
|
+
link(link: string): this;
|
|
29
|
+
customCss(css: string): this;
|
|
30
|
+
darkMode(enabled: boolean): this;
|
|
31
|
+
defaultSortBy(sortBy: UIConfiguration["defaultSortBy"]): this;
|
|
32
|
+
defaultFilterBy(filterBy: UIConfiguration["defaultFilterBy"]): this;
|
|
33
|
+
serialize(): Record<string, any>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Base } from "./Base.js";
|
|
2
|
+
export class UI extends Base {
|
|
3
|
+
data;
|
|
4
|
+
constructor(data) {
|
|
5
|
+
super();
|
|
6
|
+
this.data = data;
|
|
7
|
+
}
|
|
8
|
+
title(title) {
|
|
9
|
+
this.data.title = title;
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
description(description) {
|
|
13
|
+
this.data.description = description;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
dashboardHeading(heading) {
|
|
17
|
+
this.data.dashboardHeading = heading;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
dashboardSubheading(subheading) {
|
|
21
|
+
this.data.dashboardSubheading = subheading;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
header(header) {
|
|
25
|
+
this.data.header = header;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
logo(logo) {
|
|
29
|
+
this.data.logo = logo;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
link(link) {
|
|
33
|
+
this.data.link = link;
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
customCss(css) {
|
|
37
|
+
this.data.customCss = css;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
darkMode(enabled) {
|
|
41
|
+
this.data.darkMode = enabled;
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
defaultSortBy(sortBy) {
|
|
45
|
+
this.data.defaultSortBy = sortBy;
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
defaultFilterBy(filterBy) {
|
|
49
|
+
this.data.defaultFilterBy = filterBy;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
serialize() {
|
|
53
|
+
return this.data;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Base, Serialize } from "./Base.js";
|
|
2
|
+
export type WebConfiguration = {
|
|
3
|
+
address?: string;
|
|
4
|
+
port?: number;
|
|
5
|
+
readBufferSize?: number;
|
|
6
|
+
certificateFile?: string;
|
|
7
|
+
privateKeyFile?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class Web extends Base implements Serialize {
|
|
10
|
+
data: WebConfiguration;
|
|
11
|
+
constructor(data: WebConfiguration);
|
|
12
|
+
address(address: string): this;
|
|
13
|
+
port(port: number): this;
|
|
14
|
+
readBufferSize(size: number): this;
|
|
15
|
+
certificateFile(path: string): this;
|
|
16
|
+
privateKeyFile(path: string): this;
|
|
17
|
+
serialize(): Record<string, any>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Base } from "./Base.js";
|
|
2
|
+
export class Web extends Base {
|
|
3
|
+
data;
|
|
4
|
+
constructor(data) {
|
|
5
|
+
super();
|
|
6
|
+
this.data = data;
|
|
7
|
+
}
|
|
8
|
+
address(address) {
|
|
9
|
+
this.data.address = address;
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
port(port) {
|
|
13
|
+
this.data.port = port;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
readBufferSize(size) {
|
|
17
|
+
this.data.readBufferSize = size;
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
certificateFile(path) {
|
|
21
|
+
this.data.certificateFile = path;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
privateKeyFile(path) {
|
|
25
|
+
this.data.privateKeyFile = path;
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
serialize() {
|
|
29
|
+
return this.data;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./Alerting.js";
|
|
2
|
+
export * from "./Announcement.js";
|
|
3
|
+
export * from "./Base.js";
|
|
4
|
+
export * from "./Client.js";
|
|
5
|
+
export * from "./Configuration.js";
|
|
6
|
+
export * from "./Endpoint.js";
|
|
7
|
+
export * from "./ExternalEndpoint.js";
|
|
8
|
+
export * from "./Maintenance.js";
|
|
9
|
+
export * from "./Security.js";
|
|
10
|
+
export * from "./Storage.js";
|
|
11
|
+
export * from "./Tunnel.js";
|
|
12
|
+
export * from "./UI.js";
|
|
13
|
+
export * from "./Web.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./Alerting.js";
|
|
2
|
+
export * from "./Announcement.js";
|
|
3
|
+
export * from "./Base.js";
|
|
4
|
+
export * from "./Client.js";
|
|
5
|
+
export * from "./Configuration.js";
|
|
6
|
+
export * from "./Endpoint.js";
|
|
7
|
+
export * from "./ExternalEndpoint.js";
|
|
8
|
+
export * from "./Maintenance.js";
|
|
9
|
+
export * from "./Security.js";
|
|
10
|
+
export * from "./Storage.js";
|
|
11
|
+
export * from "./Tunnel.js";
|
|
12
|
+
export * from "./UI.js";
|
|
13
|
+
export * from "./Web.js";
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Alerting } from "./structures/Alerting.js";
|
|
2
|
+
import { Announcement } from "./structures/Announcement.js";
|
|
3
|
+
import { Endpoint } from "./structures/Endpoint.js";
|
|
4
|
+
import { ExternalEndpoint } from "./structures/ExternalEndpoint.js";
|
|
5
|
+
import { Maintenance } from "./structures/Maintenance.js";
|
|
6
|
+
import { Security } from "./structures/Security.js";
|
|
7
|
+
import { Tunnel } from "./structures/Tunnel.js";
|
|
8
|
+
import { UI } from "./structures/UI.js";
|
|
9
|
+
import { Web } from "./structures/Web.js";
|
|
10
|
+
export type Configuration = {
|
|
11
|
+
metrics?: boolean;
|
|
12
|
+
storage?: Storage;
|
|
13
|
+
alerting?: Alerting[];
|
|
14
|
+
announcements?: Announcement[];
|
|
15
|
+
endpoints?: Endpoint[];
|
|
16
|
+
externalEndpoints?: ExternalEndpoint[];
|
|
17
|
+
security?: Security;
|
|
18
|
+
concurrency?: number;
|
|
19
|
+
skipInvalidConfigUpdate?: boolean;
|
|
20
|
+
web?: Web;
|
|
21
|
+
ui?: UI;
|
|
22
|
+
maintenance?: Maintenance[];
|
|
23
|
+
tunneling?: Record<string, Tunnel>;
|
|
24
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "statcon",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The Status Configurator - a declarative configuration generator for Gatus config.yaml",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"start:postbuild": "tsx statcon.conf.js",
|
|
11
|
+
"start": "npm run build && npm run start:postbuild"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/thetayloredman/statcon.git"
|
|
16
|
+
},
|
|
17
|
+
"author": "Logan Devine <logan@zirco.dev>",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/thetayloredman/statcon/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/thetayloredman/statcon#readme",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^25.0.3",
|
|
25
|
+
"tsx": "^4.21.0",
|
|
26
|
+
"typescript": "^5.9.3"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist/**/*",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"README.md",
|
|
32
|
+
"package.json"
|
|
33
|
+
]
|
|
34
|
+
}
|