@highstate/library 0.19.1 → 0.21.1
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/index.js +2836 -3440
- package/package.json +12 -12
- package/src/abbreviations.ts +3 -0
- package/src/common/access-point.ts +19 -4
- package/src/common/files.ts +24 -17
- package/src/common/server.ts +19 -6
- package/src/databases/etcd.ts +141 -39
- package/src/databases/index.ts +8 -7
- package/src/databases/influxdb3.ts +103 -0
- package/src/databases/minio.ts +157 -0
- package/src/databases/mongodb.ts +122 -41
- package/src/databases/mysql.ts +172 -0
- package/src/databases/postgresql.ts +133 -40
- package/src/databases/redis.ts +118 -44
- package/src/databases/s3.ts +48 -127
- package/src/dns.ts +11 -7
- package/src/index.ts +3 -1
- package/src/k3s.ts +7 -0
- package/src/k8s/apps/etcd.ts +3 -3
- package/src/k8s/apps/gitea.ts +1 -1
- package/src/k8s/apps/grafana.ts +48 -0
- package/src/k8s/apps/index.ts +4 -2
- package/src/k8s/apps/mariadb.ts +7 -38
- package/src/k8s/apps/matrix-stack.ts +62 -0
- package/src/k8s/apps/minio.ts +38 -45
- package/src/k8s/apps/mongodb.ts +6 -38
- package/src/k8s/apps/portal.ts +27 -0
- package/src/k8s/apps/postgresql.ts +7 -41
- package/src/k8s/apps/refluxdb.ts +49 -0
- package/src/k8s/apps/remnawave.ts +15 -2
- package/src/k8s/apps/shared.ts +16 -15
- package/src/k8s/apps/traefik.ts +5 -0
- package/src/k8s/apps/valkey.ts +5 -5
- package/src/k8s/apps/vaultwarden.ts +2 -6
- package/src/k8s/apps/workload.ts +14 -11
- package/src/k8s/cert-manager.ts +22 -0
- package/src/k8s/cilium.ts +17 -2
- package/src/k8s/resources.ts +41 -9
- package/src/k8s/service.ts +6 -2
- package/src/k8s/shared.ts +49 -18
- package/src/k8s/workload.ts +59 -43
- package/src/network/address-space.ts +30 -7
- package/src/network/address.ts +13 -2
- package/src/network/endpoint-container.ts +235 -0
- package/src/network/endpoint-schema.ts +8 -0
- package/src/network/endpoint.ts +20 -39
- package/src/network/index.ts +1 -1
- package/src/network/subnet.ts +4 -2
- package/src/proxmox.ts +24 -7
- package/src/restic.ts +8 -2
- package/src/ssh.ts +52 -30
- package/src/talos.ts +8 -2
- package/src/third-party/cloudflare.ts +4 -4
- package/src/third-party/timeweb.ts +17 -3
- package/src/third-party/yandex.ts +198 -88
- package/src/tls.ts +22 -0
- package/src/utils.ts +16 -1
- package/src/wireguard.ts +362 -120
- package/LICENSE +0 -21
- package/dist/index.js.map +0 -1
- package/src/databases/mariadb.ts +0 -91
- package/src/databases/shared.ts +0 -67
- package/src/k8s/apps/kubernetes-dashboard.ts +0 -28
- package/src/k8s/apps/maybe.ts +0 -39
- package/src/network/dynamic-endpoint.ts +0 -43
package/src/databases/mariadb.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { defineEntity, defineUnit, type EntityInput, z } from "@highstate/contract"
|
|
2
|
-
import { l4EndpointEntity } from "../network"
|
|
3
|
-
import { toPatchArgs } from "../utils"
|
|
4
|
-
import { optionalSharedArgs, sharedArgs, sharedInputs, sharedSchema, sharedSecrets } from "./shared"
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Represents the MariaDB database or virtual database behind it.
|
|
8
|
-
*/
|
|
9
|
-
export const mariadbEntity = defineEntity({
|
|
10
|
-
type: "databases.mariadb.v1",
|
|
11
|
-
|
|
12
|
-
includes: {
|
|
13
|
-
endpoints: {
|
|
14
|
-
entity: l4EndpointEntity,
|
|
15
|
-
multiple: true,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
schema: sharedSchema,
|
|
20
|
-
|
|
21
|
-
meta: {
|
|
22
|
-
color: "#f06292",
|
|
23
|
-
},
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The existing MariaDB database or virtual database behind it.
|
|
28
|
-
*/
|
|
29
|
-
export const existingMariadb = defineUnit({
|
|
30
|
-
type: "databases.mariadb.existing.v1",
|
|
31
|
-
|
|
32
|
-
args: sharedArgs,
|
|
33
|
-
secrets: sharedSecrets,
|
|
34
|
-
inputs: sharedInputs,
|
|
35
|
-
|
|
36
|
-
outputs: {
|
|
37
|
-
mariadb: mariadbEntity,
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
source: {
|
|
41
|
-
package: "@highstate/common",
|
|
42
|
-
path: "units/databases/existing-mariadb",
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
meta: {
|
|
46
|
-
title: "Existing MariaDB Database",
|
|
47
|
-
icon: "simple-icons:mariadb",
|
|
48
|
-
secondaryIcon: "mdi:database",
|
|
49
|
-
category: "Databases",
|
|
50
|
-
},
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Patches some properties of the MariaDB database and outputs the updated database.
|
|
55
|
-
*/
|
|
56
|
-
export const mariadbPatch = defineUnit({
|
|
57
|
-
type: "databases.mariadb-patch.v1",
|
|
58
|
-
|
|
59
|
-
args: {
|
|
60
|
-
...toPatchArgs(optionalSharedArgs),
|
|
61
|
-
|
|
62
|
-
endpoints: {
|
|
63
|
-
...sharedArgs.endpoints,
|
|
64
|
-
schema: z.string().array().default([]),
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
inputs: {
|
|
69
|
-
mariadb: mariadbEntity,
|
|
70
|
-
...sharedInputs,
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
outputs: {
|
|
74
|
-
mariadb: mariadbEntity,
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
source: {
|
|
78
|
-
package: "@highstate/common",
|
|
79
|
-
path: "units/databases/mariadb-patch",
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
meta: {
|
|
83
|
-
title: "MariaDB Patch",
|
|
84
|
-
icon: "simple-icons:mariadb",
|
|
85
|
-
secondaryIcon: "fluent:patch-20-filled",
|
|
86
|
-
category: "Databases",
|
|
87
|
-
},
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
export type MariaDB = z.infer<typeof mariadbEntity.schema>
|
|
91
|
-
export type MariaDBInput = EntityInput<typeof mariadbEntity>
|
package/src/databases/shared.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { Simplify } from "type-fest"
|
|
2
|
-
import { $args, $inputs, $secrets, type FullComponentArgumentOptions, z } from "@highstate/contract"
|
|
3
|
-
import { mapValues } from "remeda"
|
|
4
|
-
import { l4EndpointEntity } from "../network"
|
|
5
|
-
|
|
6
|
-
export const sharedSchema = z.object({
|
|
7
|
-
/**
|
|
8
|
-
* The username to connect to the database with.
|
|
9
|
-
*/
|
|
10
|
-
username: z.string(),
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The password to connect to the database with.
|
|
14
|
-
*/
|
|
15
|
-
password: z.string().optional(),
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The name of the database to connect to.
|
|
19
|
-
*/
|
|
20
|
-
database: z.string().optional(),
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export const sharedArgs = $args({
|
|
24
|
-
/**
|
|
25
|
-
* The endpoints to connect to the database in form of `host:port`.
|
|
26
|
-
*/
|
|
27
|
-
endpoints: z.string().array().min(1),
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The username to connect to the database with.
|
|
31
|
-
*
|
|
32
|
-
* If not provided, defaults to `root`.
|
|
33
|
-
*/
|
|
34
|
-
username: z.string().default("root"),
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* The name of the database to connect to.
|
|
38
|
-
*/
|
|
39
|
-
database: z.string().optional(),
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
type ToOptionalArgs<T extends Record<string, FullComponentArgumentOptions>> = Simplify<{
|
|
43
|
-
[K in keyof T]: Simplify<Omit<T[K], "schema"> & { schema: z.ZodOptional<T[K]["schema"]> }>
|
|
44
|
-
}>
|
|
45
|
-
|
|
46
|
-
export const optionalSharedArgs = mapValues(sharedArgs, arg => ({
|
|
47
|
-
...arg,
|
|
48
|
-
schema: arg.schema.optional(),
|
|
49
|
-
})) as ToOptionalArgs<typeof sharedArgs>
|
|
50
|
-
|
|
51
|
-
export const sharedSecrets = $secrets({
|
|
52
|
-
/**
|
|
53
|
-
* The password to connect to the database with.
|
|
54
|
-
*/
|
|
55
|
-
password: z.string().optional(),
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
export const sharedInputs = $inputs({
|
|
59
|
-
/**
|
|
60
|
-
* The endpoints to connect to the database.
|
|
61
|
-
*/
|
|
62
|
-
endpoints: {
|
|
63
|
-
entity: l4EndpointEntity,
|
|
64
|
-
multiple: true,
|
|
65
|
-
required: false,
|
|
66
|
-
},
|
|
67
|
-
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defineUnit } from "@highstate/contract"
|
|
2
|
-
import { pick } from "remeda"
|
|
3
|
-
import { appName, sharedArgs, sharedInputs, source } from "./shared"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The Kubernetes Dashboard deployed on Kubernetes.
|
|
7
|
-
*/
|
|
8
|
-
export const kubernetesDashboard = defineUnit({
|
|
9
|
-
type: "k8s.apps.kubernetes-dashboard.v1",
|
|
10
|
-
|
|
11
|
-
args: {
|
|
12
|
-
...appName("kubernetes-dashboard"),
|
|
13
|
-
...pick(sharedArgs, ["fqdn"]),
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
inputs: {
|
|
17
|
-
...pick(sharedInputs, ["k8sCluster", "accessPoint"]),
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
meta: {
|
|
21
|
-
title: "Kubernetes Dashboard",
|
|
22
|
-
icon: "devicon:kubernetes",
|
|
23
|
-
secondaryIcon: "material-symbols:dashboard",
|
|
24
|
-
category: "Kubernetes",
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
source: source("kubernetes-dashboard"),
|
|
28
|
-
})
|
package/src/k8s/apps/maybe.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { defineUnit, z } from "@highstate/contract"
|
|
2
|
-
import { pick } from "remeda"
|
|
3
|
-
import {
|
|
4
|
-
appName,
|
|
5
|
-
optionalSharedInputs,
|
|
6
|
-
sharedArgs,
|
|
7
|
-
sharedInputs,
|
|
8
|
-
sharedSecrets,
|
|
9
|
-
source,
|
|
10
|
-
} from "./shared"
|
|
11
|
-
|
|
12
|
-
export const maybe = defineUnit({
|
|
13
|
-
type: "k8s.apps.maybe.v1",
|
|
14
|
-
|
|
15
|
-
args: {
|
|
16
|
-
...appName("maybe"),
|
|
17
|
-
...pick(sharedArgs, ["fqdn"]),
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
secrets: {
|
|
21
|
-
...pick(sharedSecrets, ["backupKey"]),
|
|
22
|
-
postgresqlPassword: z.string().optional(),
|
|
23
|
-
secretKey: z.string().optional(),
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
inputs: {
|
|
27
|
-
...pick(sharedInputs, ["k8sCluster", "accessPoint", "postgresql", "redis"]),
|
|
28
|
-
...pick(optionalSharedInputs, ["resticRepo"]),
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
meta: {
|
|
32
|
-
title: "Maybe",
|
|
33
|
-
description: "The OS for your personal finances.",
|
|
34
|
-
icon: "arcticons:finance-manager",
|
|
35
|
-
category: "Finance",
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
source: source("maybe"),
|
|
39
|
-
})
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { defineEntity, type EntityInput, z } from "@highstate/contract"
|
|
2
|
-
import { implementationReferenceSchema } from "../impl-ref"
|
|
3
|
-
import { l3EndpointSchema } from "./endpoint-schema"
|
|
4
|
-
|
|
5
|
-
export type DynamicL3Endpoint = z.infer<typeof dynamicL3EndpointEntity.schema>
|
|
6
|
-
export type DynamicL4Endpoint = z.infer<typeof dynamicL4EndpointEntity.schema>
|
|
7
|
-
export type DynamicL7Endpoint = z.infer<typeof dynamicL7EndpointEntity.schema>
|
|
8
|
-
|
|
9
|
-
export type DynamicL3EndpointInput = EntityInput<typeof dynamicL3EndpointEntity>
|
|
10
|
-
export type DynamicL4EndpointInput = EntityInput<typeof dynamicL4EndpointEntity>
|
|
11
|
-
export type DynamicL7EndpointInput = EntityInput<typeof dynamicL7EndpointEntity>
|
|
12
|
-
|
|
13
|
-
function defineDynamicEndpointEntity<TLevel extends number, TSchema extends z.ZodType>(
|
|
14
|
-
level: TLevel,
|
|
15
|
-
endpointSchema: TSchema,
|
|
16
|
-
) {
|
|
17
|
-
return defineEntity({
|
|
18
|
-
type: `network.dynamic-l${level}-endpoint.v1`,
|
|
19
|
-
|
|
20
|
-
schema: z.union([
|
|
21
|
-
z.object({
|
|
22
|
-
type: z.literal("static"),
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The static endpoint.
|
|
26
|
-
*/
|
|
27
|
-
endpoint: endpointSchema,
|
|
28
|
-
}),
|
|
29
|
-
z.object({
|
|
30
|
-
type: z.literal("dynamic"),
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The implementation reference to resolve the dynamic endpoint.
|
|
34
|
-
*/
|
|
35
|
-
implRef: implementationReferenceSchema,
|
|
36
|
-
}),
|
|
37
|
-
]),
|
|
38
|
-
})
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const dynamicL3EndpointEntity = defineDynamicEndpointEntity(3, l3EndpointSchema)
|
|
42
|
-
export const dynamicL4EndpointEntity = defineDynamicEndpointEntity(4, l3EndpointSchema)
|
|
43
|
-
export const dynamicL7EndpointEntity = defineDynamicEndpointEntity(7, l3EndpointSchema)
|