@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/src/talos.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { defineEntity, defineUnit, Type } from "@highstate/contract"
1
+ import { defineEntity, defineUnit, z } from "@highstate/contract"
2
2
  import { clusterInputs, clusterOutputs, scheduleOnMastersPolicyArgs } from "./k8s"
3
3
 
4
4
  export const clusterEntity = defineEntity({
5
5
  type: "talos.cluster",
6
6
 
7
- schema: Type.Object({
8
- clientConfiguration: Type.String(),
9
- machineSecrets: Type.String(),
7
+ schema: z.object({
8
+ clientConfiguration: z.string(),
9
+ machineSecrets: z.string(),
10
10
  }),
11
11
 
12
12
  meta: {
@@ -14,8 +14,8 @@ export const clusterEntity = defineEntity({
14
14
  },
15
15
  })
16
16
 
17
- export const cniSchema = Type.StringEnum(["none", "cilium", "flannel"])
18
- export const csiSchema = Type.StringEnum(["none", "local-path-provisioner"])
17
+ export const cniSchema = z.enum(["none", "cilium", "flannel"])
18
+ export const csiSchema = z.enum(["none", "local-path-provisioner"])
19
19
 
20
20
  export const cluster = defineUnit({
21
21
  type: "talos.cluster",
@@ -27,10 +27,8 @@ export const cluster = defineUnit({
27
27
  * The name of the cluster.
28
28
  *
29
29
  * By default, the name of the instance is used.
30
- *
31
- * @schema
32
30
  */
33
- clusterName: Type.Optional(Type.String()),
31
+ clusterName: z.string().optional(),
34
32
 
35
33
  /**
36
34
  * The CNI plugin to use.
@@ -41,10 +39,8 @@ export const cluster = defineUnit({
41
39
  * - "none" (disable CNI, must be installed manually)
42
40
  *
43
41
  * The "cilium" CNI plugin is recommended to cover advanced network policies like FQDNs.
44
- *
45
- * @schema
46
42
  */
47
- cni: Type.Default(cniSchema, "cilium"),
43
+ cni: cniSchema.default("cilium"),
48
44
 
49
45
  /**
50
46
  * The CSI plugin to use.
@@ -52,34 +48,26 @@ export const cluster = defineUnit({
52
48
  * The following options are available:
53
49
  * - "local-path-provisioner" (default)
54
50
  * - "none" (disable CSI, must be installed manually if needed)
55
- *
56
- * @schema
57
51
  */
58
- csi: Type.Default(csiSchema, "local-path-provisioner"),
52
+ csi: csiSchema.default("local-path-provisioner"),
59
53
 
60
54
  /**
61
55
  * The shared configuration patch.
62
56
  * It will be applied to all nodes.
63
- *
64
- * @schema
65
57
  */
66
- sharedConfigPatch: Type.Optional(Type.Record(Type.String(), Type.Any())),
58
+ sharedConfigPatch: z.record(z.string(), z.any()).optional(),
67
59
 
68
60
  /**
69
61
  * The master configuration patch.
70
62
  * It will be applied to all master nodes.
71
- *
72
- * @schema
73
63
  */
74
- masterConfigPatch: Type.Optional(Type.Record(Type.String(), Type.Any())),
64
+ masterConfigPatch: z.record(z.string(), z.any()).optional(),
75
65
 
76
66
  /**
77
67
  * The worker configuration patch.
78
68
  * It will be applied to all worker nodes.
79
- *
80
- * @schema
81
69
  */
82
- workerConfigPatch: Type.Optional(Type.Record(Type.String(), Type.Any())),
70
+ workerConfigPatch: z.record(z.string(), z.any()).optional(),
83
71
 
84
72
  /**
85
73
  * Whether to enable the Tun device plugin.
@@ -88,7 +76,7 @@ export const cluster = defineUnit({
88
76
  *
89
77
  * By default, this option is set to true.
90
78
  */
91
- enableTunDevicePlugin: Type.Default(Type.Boolean(), true),
79
+ enableTunDevicePlugin: z.boolean().default(true),
92
80
  },
93
81
 
94
82
  inputs: clusterInputs,
@@ -99,11 +87,11 @@ export const cluster = defineUnit({
99
87
  },
100
88
 
101
89
  meta: {
102
- displayName: "Talos Cluster",
90
+ title: "Talos Cluster",
103
91
  description: "A Kubernetes cluster managed by Talos.",
104
92
  category: "Talos",
105
93
  color: "#2d2d2d",
106
- primaryIcon: "simple-icons:talos",
94
+ icon: "simple-icons:talos",
107
95
  secondaryIcon: "devicon:kubernetes",
108
96
  },
109
97
 
package/src/timeweb.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { defineEntity, defineUnit, Type } from "@highstate/contract"
1
+ import { defineEntity, defineUnit, z } from "@highstate/contract"
2
2
  import { serverEntity } from "./common"
3
3
  import { keyPairEntity } from "./ssh"
4
4
 
5
5
  export const connectionEntity = defineEntity({
6
6
  type: "timeweb.connection",
7
7
 
8
- schema: Type.Object({
9
- name: Type.String(),
10
- apiToken: Type.String(),
8
+ schema: z.object({
9
+ name: z.string(),
10
+ apiToken: z.string(),
11
11
  }),
12
12
  })
13
13
 
@@ -15,7 +15,7 @@ export const connection = defineUnit({
15
15
  type: "timeweb.connection",
16
16
 
17
17
  secrets: {
18
- apiToken: Type.String(),
18
+ apiToken: z.string(),
19
19
  },
20
20
 
21
21
  outputs: {
@@ -23,9 +23,9 @@ export const connection = defineUnit({
23
23
  },
24
24
 
25
25
  meta: {
26
- displayName: "Timeweb Connection",
26
+ title: "Timeweb Connection",
27
27
  description: "Creates a new Timeweb connection.",
28
- primaryIcon: "material-symbols:cloud",
28
+ icon: "material-symbols:cloud",
29
29
  category: "Timeweb",
30
30
  },
31
31
 
@@ -39,9 +39,9 @@ export const virtualMachine = defineUnit({
39
39
  type: "timeweb.virtual-machine",
40
40
 
41
41
  args: {
42
- presetId: Type.Optional(Type.Number()),
43
- osId: Type.Optional(Type.Number()),
44
- availabilityZone: Type.String(),
42
+ presetId: z.number().optional(),
43
+ osId: z.number().optional(),
44
+ availabilityZone: z.string(),
45
45
  },
46
46
 
47
47
  inputs: {
@@ -53,7 +53,7 @@ export const virtualMachine = defineUnit({
53
53
  },
54
54
 
55
55
  secrets: {
56
- sshPrivateKey: Type.Optional(Type.String()),
56
+ sshPrivateKey: z.string().optional(),
57
57
  },
58
58
 
59
59
  outputs: {
@@ -61,9 +61,9 @@ export const virtualMachine = defineUnit({
61
61
  },
62
62
 
63
63
  meta: {
64
- displayName: "Timeweb Virtual Machine",
64
+ title: "Timeweb Virtual Machine",
65
65
  description: "Creates a new Timeweb virtual machine.",
66
- primaryIcon: "material-symbols:cloud",
66
+ icon: "material-symbols:cloud",
67
67
  secondaryIcon: "codicon:vm",
68
68
  category: "Timeweb",
69
69
  },
package/src/utils.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Type, type Static } from "@highstate/contract"
1
+ import { z } from "@highstate/contract"
2
2
 
3
3
  type PrefixWith<TString extends string, TPrefix extends string> = TPrefix extends ""
4
4
  ? TString
@@ -26,7 +26,7 @@ export function prefixKeysWith<T extends Record<string, unknown>, Prefix extends
26
26
  ) as PrefixedKeys<T, Prefix>
27
27
  }
28
28
 
29
- export const arrayPatchModeSchema = Type.StringEnum(["prepend", "replace"])
29
+ export const arrayPatchModeSchema = z.enum(["prepend", "replace"])
30
30
 
31
31
  /**
32
32
  * The mode to use when patching some array.
@@ -34,4 +34,4 @@ export const arrayPatchModeSchema = Type.StringEnum(["prepend", "replace"])
34
34
  * - `prepend`: Prepend the values of the new array to the existing array.
35
35
  * - `replace`: Replace the existing array with the new array.
36
36
  */
37
- export type ArrayPatchMode = Static<typeof arrayPatchModeSchema>
37
+ export type ArrayPatchMode = z.infer<typeof arrayPatchModeSchema>