@highstate/library 0.9.15 → 0.9.18
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/dist/highstate.library.msgpack +0 -0
- package/dist/highstate.manifest.json +5 -0
- package/dist/index.js +1716 -1166
- package/dist/index.js.map +1 -1
- package/package.json +8 -6
- package/src/abbreviations.ts +35 -0
- package/src/apps/code-server.ts +5 -5
- package/src/apps/deployment.ts +20 -20
- package/src/apps/dns.ts +12 -14
- package/src/apps/gitea.ts +2 -2
- package/src/apps/grocy.ts +2 -2
- package/src/apps/hubble.ts +2 -2
- package/src/apps/kubernetes-dashboard.ts +2 -2
- package/src/apps/mariadb.ts +10 -10
- package/src/apps/maybe.ts +5 -5
- package/src/apps/mongodb.ts +10 -10
- package/src/apps/network.ts +6 -6
- package/src/apps/postgresql.ts +10 -10
- package/src/apps/shared.ts +18 -19
- package/src/apps/syncthing.ts +6 -6
- package/src/apps/traefik.ts +4 -4
- package/src/apps/vaultwarden.ts +4 -4
- package/src/apps/zitadel.ts +2 -2
- package/src/cloudflare.ts +4 -4
- package/src/common.ts +25 -78
- package/src/distributions/index.ts +1 -0
- package/src/distributions/ubuntu.ts +32 -0
- package/src/dns.ts +10 -18
- package/src/files.ts +135 -0
- package/src/git.ts +58 -0
- package/src/index.ts +5 -0
- package/src/k3s.ts +9 -17
- package/src/k8s.ts +130 -146
- package/src/mullvad.ts +5 -9
- package/src/network.ts +69 -44
- package/src/nixos.ts +51 -86
- package/src/obfuscators/phantun.ts +4 -4
- package/src/obfuscators/shared.ts +23 -43
- package/src/proxmox.ts +301 -60
- package/src/restic.ts +17 -19
- package/src/sops.ts +7 -6
- package/src/ssh.ts +21 -19
- package/src/talos.ts +15 -27
- package/src/timeweb.ts +13 -13
- package/src/utils.ts +3 -3
- package/src/wireguard.ts +90 -127
package/package.json
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@highstate/library",
|
3
|
-
"version": "0.9.
|
3
|
+
"version": "0.9.18",
|
4
4
|
"type": "module",
|
5
|
+
"highstate": {
|
6
|
+
"type": "library"
|
7
|
+
},
|
5
8
|
"files": [
|
6
9
|
"dist",
|
7
10
|
"src"
|
@@ -16,15 +19,14 @@
|
|
16
19
|
"access": "public"
|
17
20
|
},
|
18
21
|
"scripts": {
|
19
|
-
"build": "highstate build
|
22
|
+
"build": "highstate build"
|
20
23
|
},
|
21
24
|
"dependencies": {
|
22
|
-
"@highstate/contract": "^0.9.
|
23
|
-
"@sinclair/typebox": "^0.34.11",
|
25
|
+
"@highstate/contract": "^0.9.18",
|
24
26
|
"remeda": "^2.21.0"
|
25
27
|
},
|
26
28
|
"devDependencies": {
|
27
|
-
"@highstate/cli": "^0.9.
|
29
|
+
"@highstate/cli": "^0.9.18"
|
28
30
|
},
|
29
|
-
"gitHead": "
|
31
|
+
"gitHead": "9ebcd7da56b00b8ca08bf52cc8438f527338cd64"
|
30
32
|
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { registerKnownAbbreviations } from "@highstate/contract"
|
2
|
+
|
3
|
+
registerKnownAbbreviations([
|
4
|
+
"ID",
|
5
|
+
"URL",
|
6
|
+
"IP",
|
7
|
+
"IPs",
|
8
|
+
"IPv4",
|
9
|
+
"IPv6",
|
10
|
+
"DNS",
|
11
|
+
"FQDN",
|
12
|
+
"SSH",
|
13
|
+
"WireGuard",
|
14
|
+
"API",
|
15
|
+
"k8s",
|
16
|
+
"TLS",
|
17
|
+
"HTTP",
|
18
|
+
"HTTPS",
|
19
|
+
"TCP",
|
20
|
+
"UDP",
|
21
|
+
"CIDR",
|
22
|
+
"CPU",
|
23
|
+
"RAM",
|
24
|
+
"GPU",
|
25
|
+
"SSD",
|
26
|
+
"HDD",
|
27
|
+
"VM",
|
28
|
+
"CNI",
|
29
|
+
"CSI",
|
30
|
+
"MariaDB",
|
31
|
+
"PostgreSQL",
|
32
|
+
"MongoDB",
|
33
|
+
])
|
34
|
+
|
35
|
+
export const noop = () => {}
|
package/src/apps/code-server.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { persistentVolumeClaimEntity, statefulSetEntity } from "../k8s"
|
3
3
|
import { createArgs, createInputs, createSecrets } from "./shared"
|
4
4
|
|
@@ -9,8 +9,8 @@ export const codeServer = defineUnit({
|
|
9
9
|
|
10
10
|
secrets: {
|
11
11
|
...createSecrets(["backupPassword"]),
|
12
|
-
password:
|
13
|
-
sudoPassword:
|
12
|
+
password: z.string().optional(),
|
13
|
+
sudoPassword: z.string().optional(),
|
14
14
|
},
|
15
15
|
|
16
16
|
inputs: createInputs(["accessPoint", "resticRepo", "dnsProviders", "volume"]),
|
@@ -21,9 +21,9 @@ export const codeServer = defineUnit({
|
|
21
21
|
},
|
22
22
|
|
23
23
|
meta: {
|
24
|
-
|
24
|
+
title: "Code Server",
|
25
25
|
description: "The Code Server instance deployed on Kubernetes.",
|
26
|
-
|
26
|
+
icon: "material-icon-theme:vscode",
|
27
27
|
category: "Development",
|
28
28
|
},
|
29
29
|
|
package/src/apps/deployment.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { deploymentEntity, serviceEntity, serviceTypeSchema } from "../k8s"
|
3
3
|
import { createInputs, createSource } from "./shared"
|
4
4
|
|
@@ -6,32 +6,32 @@ export const deployment = defineUnit({
|
|
6
6
|
type: "apps.deployment",
|
7
7
|
|
8
8
|
args: {
|
9
|
-
appName:
|
9
|
+
appName: z.string().optional(),
|
10
10
|
|
11
|
-
fqdn:
|
12
|
-
serviceType:
|
11
|
+
fqdn: z.string().optional(),
|
12
|
+
serviceType: serviceTypeSchema.optional(),
|
13
13
|
|
14
|
-
image:
|
15
|
-
port:
|
16
|
-
replicas:
|
14
|
+
image: z.string().optional(),
|
15
|
+
port: z.number().optional(),
|
16
|
+
replicas: z.number().optional(),
|
17
17
|
|
18
|
-
dataPath:
|
18
|
+
dataPath: z.string().optional(),
|
19
19
|
|
20
|
-
env:
|
20
|
+
env: z.record(z.string(), z.any()).optional(),
|
21
21
|
|
22
|
-
mariadbEnvMapping:
|
23
|
-
postgresqlEnvMapping:
|
24
|
-
mongodbEnvMapping:
|
22
|
+
mariadbEnvMapping: z.record(z.string(), z.any()).optional(),
|
23
|
+
postgresqlEnvMapping: z.record(z.string(), z.any()).optional(),
|
24
|
+
mongodbEnvMapping: z.record(z.string(), z.any()).optional(),
|
25
25
|
|
26
|
-
manifest:
|
27
|
-
serviceManifest:
|
28
|
-
httpRouteManifest:
|
26
|
+
manifest: z.record(z.string(), z.any()).optional(),
|
27
|
+
serviceManifest: z.record(z.string(), z.any()).optional(),
|
28
|
+
httpRouteManifest: z.record(z.string(), z.any()).optional(),
|
29
29
|
},
|
30
30
|
|
31
31
|
secrets: {
|
32
|
-
mariadbPassword:
|
33
|
-
postgresqlPassword:
|
34
|
-
mongodbPassword:
|
32
|
+
mariadbPassword: z.string().optional(),
|
33
|
+
postgresqlPassword: z.string().optional(),
|
34
|
+
mongodbPassword: z.string().optional(),
|
35
35
|
},
|
36
36
|
|
37
37
|
inputs: createInputs([
|
@@ -49,9 +49,9 @@ export const deployment = defineUnit({
|
|
49
49
|
},
|
50
50
|
|
51
51
|
meta: {
|
52
|
-
|
52
|
+
title: "Kubernetes Deployment",
|
53
53
|
description: "A generic Kubernetes deployment with optional service and gateway routes.",
|
54
|
-
|
54
|
+
icon: "devicon:kubernetes",
|
55
55
|
secondaryIcon: "mdi:cube-outline",
|
56
56
|
category: "Kubernetes",
|
57
57
|
},
|
package/src/apps/dns.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { l3EndpointEntity, l4EndpointEntity } from "../network"
|
3
3
|
import { providerEntity } from "../dns"
|
4
4
|
import { createSource } from "./shared"
|
5
5
|
|
6
|
-
const endpointFilterSchema =
|
6
|
+
const endpointFilterSchema = z.enum(["all", "public", "external", "internal"])
|
7
7
|
|
8
8
|
export const recordSet = defineUnit({
|
9
9
|
type: "apps.dns-record-set",
|
@@ -14,36 +14,36 @@ export const recordSet = defineUnit({
|
|
14
14
|
*
|
15
15
|
* If not provided, will use the name of the unit.
|
16
16
|
*/
|
17
|
-
recordName:
|
17
|
+
recordName: z.string().optional(),
|
18
18
|
|
19
19
|
/**
|
20
20
|
* The type of the DNS record.
|
21
21
|
*
|
22
22
|
* If not specified, will use the default type for the provider.
|
23
23
|
*/
|
24
|
-
type:
|
24
|
+
type: z.string().optional(),
|
25
25
|
|
26
26
|
/**
|
27
27
|
* The values of the DNS record.
|
28
28
|
*/
|
29
|
-
values:
|
29
|
+
values: z.string().array(),
|
30
30
|
|
31
31
|
/**
|
32
32
|
* The TTL of the DNS record.
|
33
33
|
*/
|
34
|
-
ttl:
|
34
|
+
ttl: z.number().optional(),
|
35
35
|
|
36
36
|
/**
|
37
37
|
* The priority of the DNS record.
|
38
38
|
*/
|
39
|
-
priority:
|
39
|
+
priority: z.number().optional(),
|
40
40
|
|
41
41
|
/**
|
42
42
|
* Whether the DNS record is proxied.
|
43
43
|
*
|
44
44
|
* Available only for public IPs and some DNS providers like Cloudflare.
|
45
45
|
*/
|
46
|
-
proxied:
|
46
|
+
proxied: z.boolean().optional(),
|
47
47
|
|
48
48
|
/**
|
49
49
|
* The filter to apply to the endpoints.
|
@@ -53,7 +53,7 @@ export const recordSet = defineUnit({
|
|
53
53
|
* - `external`: Only external endpoints (e.g. NodePort, LoadBalancer) accessible from outside the cluster, but not from the internet.
|
54
54
|
* - `internal`: Only internal endpoints (e.g. ClusterIP) accessible from within the cluster.
|
55
55
|
*/
|
56
|
-
endpointFilter:
|
56
|
+
endpointFilter: endpointFilterSchema.default("public"),
|
57
57
|
},
|
58
58
|
|
59
59
|
inputs: {
|
@@ -89,9 +89,9 @@ export const recordSet = defineUnit({
|
|
89
89
|
},
|
90
90
|
|
91
91
|
meta: {
|
92
|
-
|
92
|
+
title: "DNS Record Set",
|
93
93
|
description: "A set of DNS records to be created.",
|
94
|
-
|
94
|
+
icon: "mdi:server",
|
95
95
|
defaultNamePrefix: "record",
|
96
96
|
category: "Network",
|
97
97
|
},
|
@@ -102,8 +102,6 @@ export const recordSet = defineUnit({
|
|
102
102
|
export const sharedArgs = {
|
103
103
|
/**
|
104
104
|
* The FQDN to register the cluster nodes with.
|
105
|
-
*
|
106
|
-
* @schema
|
107
105
|
*/
|
108
|
-
fqdn:
|
106
|
+
fqdn: z.string().optional(),
|
109
107
|
}
|
package/src/apps/gitea.ts
CHANGED
@@ -8,9 +8,9 @@ export const gitea = defineUnit({
|
|
8
8
|
inputs: createInputs(["accessPoint", "mariadb"]),
|
9
9
|
|
10
10
|
meta: {
|
11
|
-
|
11
|
+
title: "Gitea",
|
12
12
|
description: "The Gitea Git server deployed on Kubernetes.",
|
13
|
-
|
13
|
+
icon: "simple-icons:gitea",
|
14
14
|
category: "Development",
|
15
15
|
},
|
16
16
|
|
package/src/apps/grocy.ts
CHANGED
@@ -9,10 +9,10 @@ export const grocy = defineUnit({
|
|
9
9
|
inputs: createInputs(["accessPoint", "resticRepo"]),
|
10
10
|
|
11
11
|
meta: {
|
12
|
-
|
12
|
+
title: "Grocy",
|
13
13
|
description:
|
14
14
|
"Grocy is a web-based self-hosted groceries & household management solution for your home.",
|
15
|
-
|
15
|
+
icon: "simple-icons:grocy",
|
16
16
|
category: "Productivity",
|
17
17
|
},
|
18
18
|
|
package/src/apps/hubble.ts
CHANGED
@@ -8,10 +8,10 @@ export const hubble = defineUnit({
|
|
8
8
|
inputs: createInputs(["accessPoint"]),
|
9
9
|
|
10
10
|
meta: {
|
11
|
-
|
11
|
+
title: "Hubble",
|
12
12
|
description:
|
13
13
|
"Exposes Hubble UI to the user. It must be already installed in the cluster as part of the Cilium.",
|
14
|
-
|
14
|
+
icon: "mdi:eye",
|
15
15
|
secondaryIcon: "simple-icons:cilium",
|
16
16
|
category: "Observability",
|
17
17
|
},
|
@@ -8,9 +8,9 @@ export const kubernetesDashboard = defineUnit({
|
|
8
8
|
inputs: createInputs(["accessPoint"]),
|
9
9
|
|
10
10
|
meta: {
|
11
|
-
|
11
|
+
title: "Kubernetes Dashboard",
|
12
12
|
description: "The Kubernetes Dashboard deployed on Kubernetes.",
|
13
|
-
|
13
|
+
icon: "devicon:kubernetes",
|
14
14
|
secondaryIcon: "material-symbols:dashboard",
|
15
15
|
category: "Kubernetes",
|
16
16
|
},
|
package/src/apps/mariadb.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineEntity, defineUnit,
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
2
|
import { serviceEntity } from "../k8s"
|
3
3
|
import { l4EndpointEntity } from "../network"
|
4
4
|
import {
|
@@ -37,9 +37,9 @@ export const mariadb = defineUnit({
|
|
37
37
|
},
|
38
38
|
|
39
39
|
meta: {
|
40
|
-
|
40
|
+
title: "MariaDB",
|
41
41
|
description: "The MariaDB database deployed on Kubernetes.",
|
42
|
-
|
42
|
+
icon: "simple-icons:mariadb",
|
43
43
|
secondaryIcon: "mdi:database",
|
44
44
|
category: "Databases",
|
45
45
|
},
|
@@ -49,28 +49,28 @@ export const mariadb = defineUnit({
|
|
49
49
|
|
50
50
|
extraInputDefinitions.mariadb = {
|
51
51
|
entity: mariadbEntity,
|
52
|
-
|
52
|
+
title: "MariaDB",
|
53
53
|
}
|
54
54
|
|
55
55
|
export const mariadbDatabase = defineUnit({
|
56
56
|
type: "apps.mariadb.database",
|
57
57
|
|
58
58
|
args: {
|
59
|
-
database:
|
60
|
-
username:
|
59
|
+
database: z.string().optional(),
|
60
|
+
username: z.string().optional(),
|
61
61
|
},
|
62
62
|
|
63
63
|
inputs: createInputs(["mariadb"]),
|
64
64
|
|
65
65
|
secrets: {
|
66
|
-
password:
|
66
|
+
password: z.string().optional(),
|
67
67
|
},
|
68
68
|
|
69
69
|
meta: {
|
70
|
-
|
70
|
+
title: "MariaDB Database",
|
71
71
|
description:
|
72
72
|
"The virtual MariaDB database created on the MariaDB instance. Works only for MariaDB instances deployed on Kubernetes.",
|
73
|
-
|
73
|
+
icon: "simple-icons:mariadb",
|
74
74
|
secondaryIcon: "mdi:database-plus",
|
75
75
|
category: "Databases",
|
76
76
|
},
|
@@ -78,4 +78,4 @@ export const mariadbDatabase = defineUnit({
|
|
78
78
|
source: createSource("mariadb/database"),
|
79
79
|
})
|
80
80
|
|
81
|
-
export type MariaDB =
|
81
|
+
export type MariaDB = z.infer<typeof mariadbEntity.schema>
|
package/src/apps/maybe.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { createArgs, createInputs, createSecrets, createSource } from "./shared"
|
3
3
|
|
4
4
|
export const maybe = defineUnit({
|
@@ -8,16 +8,16 @@ export const maybe = defineUnit({
|
|
8
8
|
|
9
9
|
secrets: {
|
10
10
|
...createSecrets(["backupPassword"]),
|
11
|
-
postgresqlPassword:
|
12
|
-
secretKey:
|
11
|
+
postgresqlPassword: z.string().optional(),
|
12
|
+
secretKey: z.string().optional(),
|
13
13
|
},
|
14
14
|
|
15
15
|
inputs: createInputs(["accessPoint", "resticRepo", "postgresql"]),
|
16
16
|
|
17
17
|
meta: {
|
18
|
-
|
18
|
+
title: "Maybe",
|
19
19
|
description: "The OS for your personal finances.",
|
20
|
-
|
20
|
+
icon: "arcticons:finance-manager",
|
21
21
|
category: "Finance",
|
22
22
|
},
|
23
23
|
|
package/src/apps/mongodb.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineEntity, defineUnit,
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
2
|
import { serviceEntity } from "../k8s"
|
3
3
|
import { l4EndpointEntity } from "../network"
|
4
4
|
import {
|
@@ -37,9 +37,9 @@ export const mongodb = defineUnit({
|
|
37
37
|
},
|
38
38
|
|
39
39
|
meta: {
|
40
|
-
|
40
|
+
title: "MongoDB",
|
41
41
|
description: "The MongoDB instance deployed on Kubernetes.",
|
42
|
-
|
42
|
+
icon: "simple-icons:mongodb",
|
43
43
|
secondaryIcon: "mdi:database",
|
44
44
|
category: "Databases",
|
45
45
|
},
|
@@ -49,28 +49,28 @@ export const mongodb = defineUnit({
|
|
49
49
|
|
50
50
|
extraInputDefinitions.mongodb = {
|
51
51
|
entity: mongodbEntity,
|
52
|
-
|
52
|
+
title: "MongoDB",
|
53
53
|
}
|
54
54
|
|
55
55
|
export const mongodbDatabase = defineUnit({
|
56
56
|
type: "apps.mongodb.database",
|
57
57
|
|
58
58
|
args: {
|
59
|
-
database:
|
60
|
-
username:
|
59
|
+
database: z.string().optional(),
|
60
|
+
username: z.string().optional(),
|
61
61
|
},
|
62
62
|
|
63
63
|
secrets: {
|
64
|
-
password:
|
64
|
+
password: z.string().optional(),
|
65
65
|
},
|
66
66
|
|
67
67
|
inputs: createInputs(["mongodb"]),
|
68
68
|
|
69
69
|
meta: {
|
70
|
-
|
70
|
+
title: "MongoDB Database",
|
71
71
|
description:
|
72
72
|
"The virtual MongoDB database created on the MongoDB instance. Works only for MongoDB instances deployed on Kubernetes.",
|
73
|
-
|
73
|
+
icon: "simple-icons:mongodb",
|
74
74
|
secondaryIcon: "mdi:database-plus",
|
75
75
|
category: "Databases",
|
76
76
|
},
|
@@ -78,4 +78,4 @@ export const mongodbDatabase = defineUnit({
|
|
78
78
|
source: createSource("mongodb/database"),
|
79
79
|
})
|
80
80
|
|
81
|
-
export type MongoDB =
|
81
|
+
export type MongoDB = z.infer<typeof mongodbEntity.schema>
|
package/src/apps/network.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { l3EndpointEntity, l4EndpointEntity } from "../network"
|
3
3
|
import { createSource } from "./shared"
|
4
4
|
|
5
|
-
export const explicitEndpointFilterSchema =
|
5
|
+
export const explicitEndpointFilterSchema = z.enum(["public", "external", "internal"])
|
6
6
|
|
7
7
|
export const endpointFilter = defineUnit({
|
8
8
|
type: "apps.endpoint-filter",
|
@@ -15,7 +15,7 @@ export const endpointFilter = defineUnit({
|
|
15
15
|
* - `external`: Only external endpoints (e.g. NodePort, LoadBalancer) accessible from outside the cluster, but not from the internet.
|
16
16
|
* - `internal`: Only internal endpoints (e.g. ClusterIP) accessible from within the cluster.
|
17
17
|
*/
|
18
|
-
filter:
|
18
|
+
filter: explicitEndpointFilterSchema.default("public"),
|
19
19
|
},
|
20
20
|
|
21
21
|
inputs: {
|
@@ -43,10 +43,10 @@ export const endpointFilter = defineUnit({
|
|
43
43
|
},
|
44
44
|
|
45
45
|
meta: {
|
46
|
-
|
46
|
+
title: "Endpoint Filter",
|
47
47
|
description: "Explicitly filter endpoints by their accessibility.",
|
48
|
-
|
49
|
-
|
48
|
+
icon: "mdi:network-outline",
|
49
|
+
iconColor: "#FF9800",
|
50
50
|
secondaryIcon: "mdi:filter-outline",
|
51
51
|
category: "Network",
|
52
52
|
},
|
package/src/apps/postgresql.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineEntity, defineUnit,
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
2
|
import { serviceEntity } from "../k8s"
|
3
3
|
import { l4EndpointEntity } from "../network"
|
4
4
|
import {
|
@@ -37,9 +37,9 @@ export const postgresql = defineUnit({
|
|
37
37
|
},
|
38
38
|
|
39
39
|
meta: {
|
40
|
-
|
40
|
+
title: "PostgreSQL",
|
41
41
|
description: "The PostgreSQL database deployed on Kubernetes.",
|
42
|
-
|
42
|
+
icon: "simple-icons:postgresql",
|
43
43
|
secondaryIcon: "mdi:database",
|
44
44
|
category: "Databases",
|
45
45
|
},
|
@@ -49,28 +49,28 @@ export const postgresql = defineUnit({
|
|
49
49
|
|
50
50
|
extraInputDefinitions.postgresql = {
|
51
51
|
entity: postgresqlEntity,
|
52
|
-
|
52
|
+
title: "PostgreSQL",
|
53
53
|
}
|
54
54
|
|
55
55
|
export const postgresqlDatabase = defineUnit({
|
56
56
|
type: "apps.postgresql.database",
|
57
57
|
|
58
58
|
args: {
|
59
|
-
database:
|
60
|
-
username:
|
59
|
+
database: z.string().optional(),
|
60
|
+
username: z.string().optional(),
|
61
61
|
},
|
62
62
|
|
63
63
|
secrets: {
|
64
|
-
password:
|
64
|
+
password: z.string().optional(),
|
65
65
|
},
|
66
66
|
|
67
67
|
inputs: createInputs(["postgresql"]),
|
68
68
|
|
69
69
|
meta: {
|
70
|
-
|
70
|
+
title: "PostgreSQL Database",
|
71
71
|
description:
|
72
72
|
"The virtual PostgreSQL database created on the PostgreSQL instance. Works only for PostgreSQL instances deployed on Kubernetes.",
|
73
|
-
|
73
|
+
icon: "simple-icons:postgresql",
|
74
74
|
secondaryIcon: "mdi:database-plus",
|
75
75
|
category: "Databases",
|
76
76
|
},
|
@@ -78,4 +78,4 @@ export const postgresqlDatabase = defineUnit({
|
|
78
78
|
source: createSource("postgresql/database"),
|
79
79
|
})
|
80
80
|
|
81
|
-
export type PostgreSQL =
|
81
|
+
export type PostgreSQL = z.infer<typeof postgresqlEntity.schema>
|
package/src/apps/shared.ts
CHANGED
@@ -1,39 +1,38 @@
|
|
1
|
-
import type { TString } from "@sinclair/typebox"
|
2
1
|
import type { mariadbEntity } from "./mariadb"
|
3
2
|
import type { postgresqlEntity } from "./postgresql"
|
4
3
|
import type { mongodbEntity } from "./mongodb"
|
5
|
-
import {
|
4
|
+
import { z } from "@highstate/contract"
|
6
5
|
import {
|
7
6
|
accessPointEntity,
|
8
7
|
clusterEntity,
|
9
8
|
persistentVolumeClaimEntity,
|
10
9
|
serviceEntity,
|
11
10
|
} from "../k8s"
|
12
|
-
import {
|
11
|
+
import { repositoryEntity } from "../restic"
|
13
12
|
import { providerEntity } from "../dns"
|
14
13
|
import { l4EndpointEntity } from "../network"
|
15
14
|
|
16
15
|
const extraArgsDefinitions = {
|
17
16
|
fqdn: {
|
18
|
-
schema:
|
17
|
+
schema: z.string(),
|
19
18
|
},
|
20
19
|
endpoints: {
|
21
|
-
schema:
|
20
|
+
schema: z.string().array(),
|
22
21
|
required: false,
|
23
22
|
},
|
24
23
|
external: {
|
25
|
-
schema:
|
24
|
+
schema: z.boolean(),
|
26
25
|
required: false,
|
27
26
|
},
|
28
27
|
} as const
|
29
28
|
|
30
29
|
const extraSecretsDefinitions = {
|
31
30
|
rootPassword: {
|
32
|
-
schema:
|
31
|
+
schema: z.string(),
|
33
32
|
required: false,
|
34
33
|
},
|
35
34
|
backupPassword: {
|
36
|
-
schema:
|
35
|
+
schema: z.string(),
|
37
36
|
required: false,
|
38
37
|
},
|
39
38
|
}
|
@@ -41,15 +40,15 @@ const extraSecretsDefinitions = {
|
|
41
40
|
type LazyExtraInputDefinitions = {
|
42
41
|
mariadb: {
|
43
42
|
entity: typeof mariadbEntity
|
44
|
-
|
43
|
+
title: "MariaDB"
|
45
44
|
}
|
46
45
|
postgresql: {
|
47
46
|
entity: typeof postgresqlEntity
|
48
|
-
|
47
|
+
title: "PostgreSQL"
|
49
48
|
}
|
50
49
|
mongodb: {
|
51
50
|
entity: typeof mongodbEntity
|
52
|
-
|
51
|
+
title: "MongoDB"
|
53
52
|
}
|
54
53
|
}
|
55
54
|
|
@@ -58,7 +57,7 @@ const eagerExtraInputDefinitions = {
|
|
58
57
|
entity: accessPointEntity,
|
59
58
|
},
|
60
59
|
resticRepo: {
|
61
|
-
entity:
|
60
|
+
entity: repositoryEntity,
|
62
61
|
required: false,
|
63
62
|
},
|
64
63
|
dnsProviders: {
|
@@ -98,7 +97,7 @@ export function createArgs<T extends readonly ExtraArgsName[] = []>(
|
|
98
97
|
defaultAppName: string,
|
99
98
|
extraArgs?: T,
|
100
99
|
): {
|
101
|
-
appName:
|
100
|
+
appName: z.ZodDefault<z.ZodString>
|
102
101
|
} & {
|
103
102
|
[K in T[number]]: ExtraArgsDefinitions[K]
|
104
103
|
}
|
@@ -110,7 +109,7 @@ export function createArgs<
|
|
110
109
|
defaultAppName: string,
|
111
110
|
extraArgs?: CreateArgsOptions<R, O>,
|
112
111
|
): {
|
113
|
-
appName:
|
112
|
+
appName: z.ZodDefault<z.ZodString>
|
114
113
|
} & {
|
115
114
|
[K in R[number]]: ExtraArgsDefinitions[K] & { required: true }
|
116
115
|
} & {
|
@@ -122,7 +121,7 @@ export function createArgs<
|
|
122
121
|
O extends readonly ExtraArgsName[] = [],
|
123
122
|
>(defaultAppName: string, extraArgs?: readonly ExtraArgsName[] | CreateArgsOptions<R, O>) {
|
124
123
|
const base = {
|
125
|
-
appName:
|
124
|
+
appName: z.string().default(defaultAppName),
|
126
125
|
}
|
127
126
|
|
128
127
|
const dynamicArgs: Partial<Record<ExtraArgsName, object>> = {}
|
@@ -283,8 +282,8 @@ export function createSource(path: string) {
|
|
283
282
|
}
|
284
283
|
}
|
285
284
|
|
286
|
-
export const databaseSchema =
|
287
|
-
endpoints:
|
288
|
-
service:
|
289
|
-
rootPassword:
|
285
|
+
export const databaseSchema = z.object({
|
286
|
+
endpoints: l4EndpointEntity.schema.array(),
|
287
|
+
service: serviceEntity.schema.optional(),
|
288
|
+
rootPassword: z.string(),
|
290
289
|
})
|