@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.
Files changed (46) hide show
  1. package/dist/highstate.library.msgpack +0 -0
  2. package/dist/highstate.manifest.json +5 -0
  3. package/dist/index.js +1716 -1166
  4. package/dist/index.js.map +1 -1
  5. package/package.json +8 -6
  6. package/src/abbreviations.ts +35 -0
  7. package/src/apps/code-server.ts +5 -5
  8. package/src/apps/deployment.ts +20 -20
  9. package/src/apps/dns.ts +12 -14
  10. package/src/apps/gitea.ts +2 -2
  11. package/src/apps/grocy.ts +2 -2
  12. package/src/apps/hubble.ts +2 -2
  13. package/src/apps/kubernetes-dashboard.ts +2 -2
  14. package/src/apps/mariadb.ts +10 -10
  15. package/src/apps/maybe.ts +5 -5
  16. package/src/apps/mongodb.ts +10 -10
  17. package/src/apps/network.ts +6 -6
  18. package/src/apps/postgresql.ts +10 -10
  19. package/src/apps/shared.ts +18 -19
  20. package/src/apps/syncthing.ts +6 -6
  21. package/src/apps/traefik.ts +4 -4
  22. package/src/apps/vaultwarden.ts +4 -4
  23. package/src/apps/zitadel.ts +2 -2
  24. package/src/cloudflare.ts +4 -4
  25. package/src/common.ts +25 -78
  26. package/src/distributions/index.ts +1 -0
  27. package/src/distributions/ubuntu.ts +32 -0
  28. package/src/dns.ts +10 -18
  29. package/src/files.ts +135 -0
  30. package/src/git.ts +58 -0
  31. package/src/index.ts +5 -0
  32. package/src/k3s.ts +9 -17
  33. package/src/k8s.ts +130 -146
  34. package/src/mullvad.ts +5 -9
  35. package/src/network.ts +69 -44
  36. package/src/nixos.ts +51 -86
  37. package/src/obfuscators/phantun.ts +4 -4
  38. package/src/obfuscators/shared.ts +23 -43
  39. package/src/proxmox.ts +301 -60
  40. package/src/restic.ts +17 -19
  41. package/src/sops.ts +7 -6
  42. package/src/ssh.ts +21 -19
  43. package/src/talos.ts +15 -27
  44. package/src/timeweb.ts +13 -13
  45. package/src/utils.ts +3 -3
  46. 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.15",
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 --library"
22
+ "build": "highstate build"
20
23
  },
21
24
  "dependencies": {
22
- "@highstate/contract": "^0.9.15",
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.15"
29
+ "@highstate/cli": "^0.9.18"
28
30
  },
29
- "gitHead": "f61b9905d4cd50511b03331411f42595403ebc06"
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 = () => {}
@@ -1,4 +1,4 @@
1
- import { defineUnit, Type } from "@highstate/contract"
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: Type.Optional(Type.String()),
13
- sudoPassword: Type.Optional(Type.String()),
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
- displayName: "Code Server",
24
+ title: "Code Server",
25
25
  description: "The Code Server instance deployed on Kubernetes.",
26
- primaryIcon: "material-icon-theme:vscode",
26
+ icon: "material-icon-theme:vscode",
27
27
  category: "Development",
28
28
  },
29
29
 
@@ -1,4 +1,4 @@
1
- import { defineUnit, Type } from "@highstate/contract"
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: Type.Optional(Type.String()),
9
+ appName: z.string().optional(),
10
10
 
11
- fqdn: Type.Optional(Type.String()),
12
- serviceType: Type.Optional(serviceTypeSchema),
11
+ fqdn: z.string().optional(),
12
+ serviceType: serviceTypeSchema.optional(),
13
13
 
14
- image: Type.Optional(Type.String()),
15
- port: Type.Optional(Type.Number()),
16
- replicas: Type.Optional(Type.Number()),
14
+ image: z.string().optional(),
15
+ port: z.number().optional(),
16
+ replicas: z.number().optional(),
17
17
 
18
- dataPath: Type.Optional(Type.String()),
18
+ dataPath: z.string().optional(),
19
19
 
20
- env: Type.Optional(Type.Record(Type.String(), Type.Any())),
20
+ env: z.record(z.string(), z.any()).optional(),
21
21
 
22
- mariadbEnvMapping: Type.Optional(Type.Record(Type.String(), Type.Any())),
23
- postgresqlEnvMapping: Type.Optional(Type.Record(Type.String(), Type.Any())),
24
- mongodbEnvMapping: Type.Optional(Type.Record(Type.String(), Type.Any())),
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: Type.Optional(Type.Record(Type.String(), Type.Any())),
27
- serviceManifest: Type.Optional(Type.Record(Type.String(), Type.Any())),
28
- httpRouteManifest: Type.Optional(Type.Record(Type.String(), Type.Any())),
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: Type.Optional(Type.String()),
33
- postgresqlPassword: Type.Optional(Type.String()),
34
- mongodbPassword: Type.Optional(Type.String()),
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
- displayName: "Kubernetes Deployment",
52
+ title: "Kubernetes Deployment",
53
53
  description: "A generic Kubernetes deployment with optional service and gateway routes.",
54
- primaryIcon: "devicon:kubernetes",
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, Type } from "@highstate/contract"
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 = Type.StringEnum(["all", "public", "external", "internal"])
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: Type.Optional(Type.String()),
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: Type.Optional(Type.String()),
24
+ type: z.string().optional(),
25
25
 
26
26
  /**
27
27
  * The values of the DNS record.
28
28
  */
29
- values: Type.Array(Type.String()),
29
+ values: z.string().array(),
30
30
 
31
31
  /**
32
32
  * The TTL of the DNS record.
33
33
  */
34
- ttl: Type.Optional(Type.Number()),
34
+ ttl: z.number().optional(),
35
35
 
36
36
  /**
37
37
  * The priority of the DNS record.
38
38
  */
39
- priority: Type.Optional(Type.Number()),
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: Type.Optional(Type.Boolean()),
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: Type.Default(endpointFilterSchema, "public"),
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
- displayName: "DNS Record Set",
92
+ title: "DNS Record Set",
93
93
  description: "A set of DNS records to be created.",
94
- primaryIcon: "mdi:server",
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: Type.Optional(Type.String()),
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
- displayName: "Gitea",
11
+ title: "Gitea",
12
12
  description: "The Gitea Git server deployed on Kubernetes.",
13
- primaryIcon: "simple-icons:gitea",
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
- displayName: "Grocy",
12
+ title: "Grocy",
13
13
  description:
14
14
  "Grocy is a web-based self-hosted groceries & household management solution for your home.",
15
- primaryIcon: "simple-icons:grocy",
15
+ icon: "simple-icons:grocy",
16
16
  category: "Productivity",
17
17
  },
18
18
 
@@ -8,10 +8,10 @@ export const hubble = defineUnit({
8
8
  inputs: createInputs(["accessPoint"]),
9
9
 
10
10
  meta: {
11
- displayName: "Hubble",
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
- primaryIcon: "mdi:eye",
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
- displayName: "Kubernetes Dashboard",
11
+ title: "Kubernetes Dashboard",
12
12
  description: "The Kubernetes Dashboard deployed on Kubernetes.",
13
- primaryIcon: "devicon:kubernetes",
13
+ icon: "devicon:kubernetes",
14
14
  secondaryIcon: "material-symbols:dashboard",
15
15
  category: "Kubernetes",
16
16
  },
@@ -1,4 +1,4 @@
1
- import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
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
- displayName: "MariaDB",
40
+ title: "MariaDB",
41
41
  description: "The MariaDB database deployed on Kubernetes.",
42
- primaryIcon: "simple-icons:mariadb",
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
- displayName: "MariaDB",
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: Type.Optional(Type.String()),
60
- username: Type.Optional(Type.String()),
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: Type.Optional(Type.String()),
66
+ password: z.string().optional(),
67
67
  },
68
68
 
69
69
  meta: {
70
- displayName: "MariaDB Database",
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
- primaryIcon: "simple-icons:mariadb",
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 = Static<typeof mariadbEntity.schema>
81
+ export type MariaDB = z.infer<typeof mariadbEntity.schema>
package/src/apps/maybe.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { defineUnit, Type } from "@highstate/contract"
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: Type.Optional(Type.String()),
12
- secretKey: Type.Optional(Type.String()),
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
- displayName: "Maybe",
18
+ title: "Maybe",
19
19
  description: "The OS for your personal finances.",
20
- primaryIcon: "arcticons:finance-manager",
20
+ icon: "arcticons:finance-manager",
21
21
  category: "Finance",
22
22
  },
23
23
 
@@ -1,4 +1,4 @@
1
- import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
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
- displayName: "MongoDB",
40
+ title: "MongoDB",
41
41
  description: "The MongoDB instance deployed on Kubernetes.",
42
- primaryIcon: "simple-icons:mongodb",
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
- displayName: "MongoDB",
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: Type.Optional(Type.String()),
60
- username: Type.Optional(Type.String()),
59
+ database: z.string().optional(),
60
+ username: z.string().optional(),
61
61
  },
62
62
 
63
63
  secrets: {
64
- password: Type.Optional(Type.String()),
64
+ password: z.string().optional(),
65
65
  },
66
66
 
67
67
  inputs: createInputs(["mongodb"]),
68
68
 
69
69
  meta: {
70
- displayName: "MongoDB Database",
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
- primaryIcon: "simple-icons:mongodb",
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 = Static<typeof mongodbEntity.schema>
81
+ export type MongoDB = z.infer<typeof mongodbEntity.schema>
@@ -1,8 +1,8 @@
1
- import { defineUnit, Type } from "@highstate/contract"
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 = Type.StringEnum(["public", "external", "internal"])
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: Type.Default(explicitEndpointFilterSchema, "public"),
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
- displayName: "Endpoint Filter",
46
+ title: "Endpoint Filter",
47
47
  description: "Explicitly filter endpoints by their accessibility.",
48
- primaryIcon: "mdi:network-outline",
49
- primaryIconColor: "#FF9800",
48
+ icon: "mdi:network-outline",
49
+ iconColor: "#FF9800",
50
50
  secondaryIcon: "mdi:filter-outline",
51
51
  category: "Network",
52
52
  },
@@ -1,4 +1,4 @@
1
- import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
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
- displayName: "PostgreSQL",
40
+ title: "PostgreSQL",
41
41
  description: "The PostgreSQL database deployed on Kubernetes.",
42
- primaryIcon: "simple-icons:postgresql",
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
- displayName: "PostgreSQL",
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: Type.Optional(Type.String()),
60
- username: Type.Optional(Type.String()),
59
+ database: z.string().optional(),
60
+ username: z.string().optional(),
61
61
  },
62
62
 
63
63
  secrets: {
64
- password: Type.Optional(Type.String()),
64
+ password: z.string().optional(),
65
65
  },
66
66
 
67
67
  inputs: createInputs(["postgresql"]),
68
68
 
69
69
  meta: {
70
- displayName: "PostgreSQL Database",
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
- primaryIcon: "simple-icons:postgresql",
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 = Static<typeof postgresqlEntity.schema>
81
+ export type PostgreSQL = z.infer<typeof postgresqlEntity.schema>
@@ -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 { Type } from "@highstate/contract"
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 { repoEntity } from "../restic"
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: Type.String(),
17
+ schema: z.string(),
19
18
  },
20
19
  endpoints: {
21
- schema: Type.Array(Type.String()),
20
+ schema: z.string().array(),
22
21
  required: false,
23
22
  },
24
23
  external: {
25
- schema: Type.Boolean(),
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: Type.String(),
31
+ schema: z.string(),
33
32
  required: false,
34
33
  },
35
34
  backupPassword: {
36
- schema: Type.String(),
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
- displayName: "MariaDB"
43
+ title: "MariaDB"
45
44
  }
46
45
  postgresql: {
47
46
  entity: typeof postgresqlEntity
48
- displayName: "PostgreSQL"
47
+ title: "PostgreSQL"
49
48
  }
50
49
  mongodb: {
51
50
  entity: typeof mongodbEntity
52
- displayName: "MongoDB"
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: repoEntity,
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: TString & { default: string }
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: TString & { default: string }
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: Type.Default(Type.String(), defaultAppName),
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 = Type.Object({
287
- endpoints: Type.Array(l4EndpointEntity.schema),
288
- service: Type.Optional(serviceEntity.schema),
289
- rootPassword: Type.String(),
285
+ export const databaseSchema = z.object({
286
+ endpoints: l4EndpointEntity.schema.array(),
287
+ service: serviceEntity.schema.optional(),
288
+ rootPassword: z.string(),
290
289
  })