@highstate/library 0.9.18 → 0.9.19
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 +3467 -3083
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/src/common/access-point.ts +105 -0
- package/src/{files.ts → common/files.ts} +10 -8
- package/src/common/index.ts +3 -0
- package/src/{common.ts → common/server.ts} +69 -38
- package/src/databases/index.ts +4 -0
- package/src/databases/mariadb.ts +37 -0
- package/src/databases/mongodb.ts +37 -0
- package/src/databases/postgresql.ts +37 -0
- package/src/databases/shared.ts +61 -0
- package/src/distributions/ubuntu.ts +6 -4
- package/src/dns.ts +110 -12
- package/src/git.ts +7 -3
- package/src/impl-ref.ts +26 -0
- package/src/index.ts +14 -15
- package/src/k3s.ts +7 -5
- package/src/k8s/apps/code-server.ts +48 -0
- package/src/k8s/apps/gitea.ts +25 -0
- package/src/k8s/apps/grocy.ts +39 -0
- package/src/k8s/apps/hubble.ts +30 -0
- package/src/{apps → k8s/apps}/index.ts +16 -13
- package/src/k8s/apps/kubernetes-dashboard.ts +28 -0
- package/src/k8s/apps/mariadb.ts +83 -0
- package/src/k8s/apps/maybe.ts +39 -0
- package/src/k8s/apps/mongodb.ts +84 -0
- package/src/k8s/apps/postgresql.ts +86 -0
- package/src/k8s/apps/shared.ts +149 -0
- package/src/{apps → k8s/apps}/syncthing.ts +27 -9
- package/src/k8s/apps/traefik.ts +40 -0
- package/src/k8s/apps/vaultwarden.ts +31 -0
- package/src/k8s/apps/workload.ts +214 -0
- package/src/k8s/apps/zitadel.ts +26 -0
- package/src/k8s/cert-manager.ts +80 -0
- package/src/k8s/cilium.ts +64 -0
- package/src/k8s/gateway.ts +70 -0
- package/src/k8s/index.ts +9 -0
- package/src/{obfuscators → k8s/obfuscators}/phantun.ts +10 -6
- package/src/{obfuscators → k8s/obfuscators}/shared.ts +11 -5
- package/src/k8s/resources.ts +111 -0
- package/src/k8s/service.ts +65 -0
- package/src/{k8s.ts → k8s/shared.ts} +35 -329
- package/src/k8s/workload.ts +77 -0
- package/src/network.ts +208 -22
- package/src/nixos.ts +23 -8
- package/src/proxmox.ts +62 -75
- package/src/restic.ts +15 -6
- package/src/sops.ts +16 -5
- package/src/ssh.ts +107 -9
- package/src/talos.ts +6 -4
- package/src/third-party/cloudflare.ts +59 -0
- package/src/third-party/index.ts +3 -0
- package/src/{mullvad.ts → third-party/mullvad.ts} +6 -4
- package/src/third-party/timeweb.ts +99 -0
- package/src/utils.ts +24 -3
- package/src/wireguard.ts +171 -48
- package/src/apps/code-server.ts +0 -34
- package/src/apps/deployment.ts +0 -60
- package/src/apps/dns.ts +0 -107
- package/src/apps/gitea.ts +0 -18
- package/src/apps/grocy.ts +0 -20
- package/src/apps/hubble.ts +0 -20
- package/src/apps/kubernetes-dashboard.ts +0 -19
- package/src/apps/mariadb.ts +0 -81
- package/src/apps/maybe.ts +0 -25
- package/src/apps/mongodb.ts +0 -81
- package/src/apps/network.ts +0 -55
- package/src/apps/postgresql.ts +0 -81
- package/src/apps/shared.ts +0 -289
- package/src/apps/test.ts +0 -19
- package/src/apps/traefik.ts +0 -36
- package/src/apps/vaultwarden.ts +0 -23
- package/src/apps/zitadel.ts +0 -21
- package/src/cloudflare.ts +0 -26
- package/src/timeweb.ts +0 -75
- package/src/{obfuscators → k8s/obfuscators}/index.ts +1 -1
package/src/apps/gitea.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
import { defineUnit } from "@highstate/contract"
|
2
|
-
import { createArgs, createInputs, createSource } from "./shared"
|
3
|
-
|
4
|
-
export const gitea = defineUnit({
|
5
|
-
type: "apps.gitea",
|
6
|
-
|
7
|
-
args: createArgs("gitea"),
|
8
|
-
inputs: createInputs(["accessPoint", "mariadb"]),
|
9
|
-
|
10
|
-
meta: {
|
11
|
-
title: "Gitea",
|
12
|
-
description: "The Gitea Git server deployed on Kubernetes.",
|
13
|
-
icon: "simple-icons:gitea",
|
14
|
-
category: "Development",
|
15
|
-
},
|
16
|
-
|
17
|
-
source: createSource("gitea"),
|
18
|
-
})
|
package/src/apps/grocy.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import { defineUnit } from "@highstate/contract"
|
2
|
-
import { createArgs, createInputs, createSecrets, createSource } from "./shared"
|
3
|
-
|
4
|
-
export const grocy = defineUnit({
|
5
|
-
type: "apps.grocy",
|
6
|
-
|
7
|
-
args: createArgs("grocy", ["fqdn"]),
|
8
|
-
secrets: createSecrets(["backupPassword"]),
|
9
|
-
inputs: createInputs(["accessPoint", "resticRepo"]),
|
10
|
-
|
11
|
-
meta: {
|
12
|
-
title: "Grocy",
|
13
|
-
description:
|
14
|
-
"Grocy is a web-based self-hosted groceries & household management solution for your home.",
|
15
|
-
icon: "simple-icons:grocy",
|
16
|
-
category: "Productivity",
|
17
|
-
},
|
18
|
-
|
19
|
-
source: createSource("grocy"),
|
20
|
-
})
|
package/src/apps/hubble.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import { defineUnit } from "@highstate/contract"
|
2
|
-
import { createArgs, createInputs, createSource } from "./shared"
|
3
|
-
|
4
|
-
export const hubble = defineUnit({
|
5
|
-
type: "apps.hubble",
|
6
|
-
|
7
|
-
args: createArgs("hubble", ["fqdn"]),
|
8
|
-
inputs: createInputs(["accessPoint"]),
|
9
|
-
|
10
|
-
meta: {
|
11
|
-
title: "Hubble",
|
12
|
-
description:
|
13
|
-
"Exposes Hubble UI to the user. It must be already installed in the cluster as part of the Cilium.",
|
14
|
-
icon: "mdi:eye",
|
15
|
-
secondaryIcon: "simple-icons:cilium",
|
16
|
-
category: "Observability",
|
17
|
-
},
|
18
|
-
|
19
|
-
source: createSource("hubble"),
|
20
|
-
})
|
@@ -1,19 +0,0 @@
|
|
1
|
-
import { defineUnit } from "@highstate/contract"
|
2
|
-
import { createArgs, createInputs, createSource } from "./shared"
|
3
|
-
|
4
|
-
export const kubernetesDashboard = defineUnit({
|
5
|
-
type: "apps.kubernetes-dashboard",
|
6
|
-
|
7
|
-
args: createArgs("kubernetes-dashboard", ["fqdn"]),
|
8
|
-
inputs: createInputs(["accessPoint"]),
|
9
|
-
|
10
|
-
meta: {
|
11
|
-
title: "Kubernetes Dashboard",
|
12
|
-
description: "The Kubernetes Dashboard deployed on Kubernetes.",
|
13
|
-
icon: "devicon:kubernetes",
|
14
|
-
secondaryIcon: "material-symbols:dashboard",
|
15
|
-
category: "Kubernetes",
|
16
|
-
},
|
17
|
-
|
18
|
-
source: createSource("kubernetes-dashboard"),
|
19
|
-
})
|
package/src/apps/mariadb.ts
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
|
-
import { serviceEntity } from "../k8s"
|
3
|
-
import { l4EndpointEntity } from "../network"
|
4
|
-
import {
|
5
|
-
createArgs,
|
6
|
-
createInputs,
|
7
|
-
createSecrets,
|
8
|
-
createSource,
|
9
|
-
databaseSchema,
|
10
|
-
extraInputDefinitions,
|
11
|
-
} from "./shared"
|
12
|
-
|
13
|
-
export const mariadbEntity = defineEntity({
|
14
|
-
type: "apps.mariadb",
|
15
|
-
|
16
|
-
schema: databaseSchema,
|
17
|
-
|
18
|
-
meta: {
|
19
|
-
color: "#f06292",
|
20
|
-
},
|
21
|
-
})
|
22
|
-
|
23
|
-
export const mariadb = defineUnit({
|
24
|
-
type: "apps.mariadb",
|
25
|
-
|
26
|
-
args: createArgs("mariadb", ["external"]),
|
27
|
-
secrets: createSecrets(["rootPassword", "backupPassword"]),
|
28
|
-
inputs: createInputs(["resticRepo"]),
|
29
|
-
|
30
|
-
outputs: {
|
31
|
-
mariadb: mariadbEntity,
|
32
|
-
service: serviceEntity,
|
33
|
-
endpoints: {
|
34
|
-
entity: l4EndpointEntity,
|
35
|
-
multiple: true,
|
36
|
-
},
|
37
|
-
},
|
38
|
-
|
39
|
-
meta: {
|
40
|
-
title: "MariaDB",
|
41
|
-
description: "The MariaDB database deployed on Kubernetes.",
|
42
|
-
icon: "simple-icons:mariadb",
|
43
|
-
secondaryIcon: "mdi:database",
|
44
|
-
category: "Databases",
|
45
|
-
},
|
46
|
-
|
47
|
-
source: createSource("mariadb/app"),
|
48
|
-
})
|
49
|
-
|
50
|
-
extraInputDefinitions.mariadb = {
|
51
|
-
entity: mariadbEntity,
|
52
|
-
title: "MariaDB",
|
53
|
-
}
|
54
|
-
|
55
|
-
export const mariadbDatabase = defineUnit({
|
56
|
-
type: "apps.mariadb.database",
|
57
|
-
|
58
|
-
args: {
|
59
|
-
database: z.string().optional(),
|
60
|
-
username: z.string().optional(),
|
61
|
-
},
|
62
|
-
|
63
|
-
inputs: createInputs(["mariadb"]),
|
64
|
-
|
65
|
-
secrets: {
|
66
|
-
password: z.string().optional(),
|
67
|
-
},
|
68
|
-
|
69
|
-
meta: {
|
70
|
-
title: "MariaDB Database",
|
71
|
-
description:
|
72
|
-
"The virtual MariaDB database created on the MariaDB instance. Works only for MariaDB instances deployed on Kubernetes.",
|
73
|
-
icon: "simple-icons:mariadb",
|
74
|
-
secondaryIcon: "mdi:database-plus",
|
75
|
-
category: "Databases",
|
76
|
-
},
|
77
|
-
|
78
|
-
source: createSource("mariadb/database"),
|
79
|
-
})
|
80
|
-
|
81
|
-
export type MariaDB = z.infer<typeof mariadbEntity.schema>
|
package/src/apps/maybe.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
import { defineUnit, z } from "@highstate/contract"
|
2
|
-
import { createArgs, createInputs, createSecrets, createSource } from "./shared"
|
3
|
-
|
4
|
-
export const maybe = defineUnit({
|
5
|
-
type: "apps.maybe",
|
6
|
-
|
7
|
-
args: createArgs("maybe", ["fqdn"]),
|
8
|
-
|
9
|
-
secrets: {
|
10
|
-
...createSecrets(["backupPassword"]),
|
11
|
-
postgresqlPassword: z.string().optional(),
|
12
|
-
secretKey: z.string().optional(),
|
13
|
-
},
|
14
|
-
|
15
|
-
inputs: createInputs(["accessPoint", "resticRepo", "postgresql"]),
|
16
|
-
|
17
|
-
meta: {
|
18
|
-
title: "Maybe",
|
19
|
-
description: "The OS for your personal finances.",
|
20
|
-
icon: "arcticons:finance-manager",
|
21
|
-
category: "Finance",
|
22
|
-
},
|
23
|
-
|
24
|
-
source: createSource("maybe"),
|
25
|
-
})
|
package/src/apps/mongodb.ts
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
|
-
import { serviceEntity } from "../k8s"
|
3
|
-
import { l4EndpointEntity } from "../network"
|
4
|
-
import {
|
5
|
-
createArgs,
|
6
|
-
createInputs,
|
7
|
-
createSecrets,
|
8
|
-
createSource,
|
9
|
-
databaseSchema,
|
10
|
-
extraInputDefinitions,
|
11
|
-
} from "./shared"
|
12
|
-
|
13
|
-
export const mongodbEntity = defineEntity({
|
14
|
-
type: "apps.mongodb",
|
15
|
-
|
16
|
-
schema: databaseSchema,
|
17
|
-
|
18
|
-
meta: {
|
19
|
-
color: "#13aa52",
|
20
|
-
},
|
21
|
-
})
|
22
|
-
|
23
|
-
export const mongodb = defineUnit({
|
24
|
-
type: "apps.mongodb",
|
25
|
-
|
26
|
-
args: createArgs("mongodb", ["external"]),
|
27
|
-
secrets: createSecrets(["rootPassword", "backupPassword"]),
|
28
|
-
inputs: createInputs(["resticRepo"]),
|
29
|
-
|
30
|
-
outputs: {
|
31
|
-
mongodb: mongodbEntity,
|
32
|
-
service: serviceEntity,
|
33
|
-
endpoints: {
|
34
|
-
entity: l4EndpointEntity,
|
35
|
-
multiple: true,
|
36
|
-
},
|
37
|
-
},
|
38
|
-
|
39
|
-
meta: {
|
40
|
-
title: "MongoDB",
|
41
|
-
description: "The MongoDB instance deployed on Kubernetes.",
|
42
|
-
icon: "simple-icons:mongodb",
|
43
|
-
secondaryIcon: "mdi:database",
|
44
|
-
category: "Databases",
|
45
|
-
},
|
46
|
-
|
47
|
-
source: createSource("mongodb/app"),
|
48
|
-
})
|
49
|
-
|
50
|
-
extraInputDefinitions.mongodb = {
|
51
|
-
entity: mongodbEntity,
|
52
|
-
title: "MongoDB",
|
53
|
-
}
|
54
|
-
|
55
|
-
export const mongodbDatabase = defineUnit({
|
56
|
-
type: "apps.mongodb.database",
|
57
|
-
|
58
|
-
args: {
|
59
|
-
database: z.string().optional(),
|
60
|
-
username: z.string().optional(),
|
61
|
-
},
|
62
|
-
|
63
|
-
secrets: {
|
64
|
-
password: z.string().optional(),
|
65
|
-
},
|
66
|
-
|
67
|
-
inputs: createInputs(["mongodb"]),
|
68
|
-
|
69
|
-
meta: {
|
70
|
-
title: "MongoDB Database",
|
71
|
-
description:
|
72
|
-
"The virtual MongoDB database created on the MongoDB instance. Works only for MongoDB instances deployed on Kubernetes.",
|
73
|
-
icon: "simple-icons:mongodb",
|
74
|
-
secondaryIcon: "mdi:database-plus",
|
75
|
-
category: "Databases",
|
76
|
-
},
|
77
|
-
|
78
|
-
source: createSource("mongodb/database"),
|
79
|
-
})
|
80
|
-
|
81
|
-
export type MongoDB = z.infer<typeof mongodbEntity.schema>
|
package/src/apps/network.ts
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
import { defineUnit, z } from "@highstate/contract"
|
2
|
-
import { l3EndpointEntity, l4EndpointEntity } from "../network"
|
3
|
-
import { createSource } from "./shared"
|
4
|
-
|
5
|
-
export const explicitEndpointFilterSchema = z.enum(["public", "external", "internal"])
|
6
|
-
|
7
|
-
export const endpointFilter = defineUnit({
|
8
|
-
type: "apps.endpoint-filter",
|
9
|
-
|
10
|
-
args: {
|
11
|
-
/**
|
12
|
-
* The filter to apply to the endpoints.
|
13
|
-
*
|
14
|
-
* - `public`: Only public endpoints accessible from the internet.
|
15
|
-
* - `external`: Only external endpoints (e.g. NodePort, LoadBalancer) accessible from outside the cluster, but not from the internet.
|
16
|
-
* - `internal`: Only internal endpoints (e.g. ClusterIP) accessible from within the cluster.
|
17
|
-
*/
|
18
|
-
filter: explicitEndpointFilterSchema.default("public"),
|
19
|
-
},
|
20
|
-
|
21
|
-
inputs: {
|
22
|
-
l3Endpoints: {
|
23
|
-
entity: l3EndpointEntity,
|
24
|
-
multiple: true,
|
25
|
-
required: false,
|
26
|
-
},
|
27
|
-
l4Endpoints: {
|
28
|
-
entity: l4EndpointEntity,
|
29
|
-
multiple: true,
|
30
|
-
required: false,
|
31
|
-
},
|
32
|
-
},
|
33
|
-
|
34
|
-
outputs: {
|
35
|
-
l3Endpoints: {
|
36
|
-
entity: l3EndpointEntity,
|
37
|
-
multiple: true,
|
38
|
-
},
|
39
|
-
l4Endpoints: {
|
40
|
-
entity: l4EndpointEntity,
|
41
|
-
multiple: true,
|
42
|
-
},
|
43
|
-
},
|
44
|
-
|
45
|
-
meta: {
|
46
|
-
title: "Endpoint Filter",
|
47
|
-
description: "Explicitly filter endpoints by their accessibility.",
|
48
|
-
icon: "mdi:network-outline",
|
49
|
-
iconColor: "#FF9800",
|
50
|
-
secondaryIcon: "mdi:filter-outline",
|
51
|
-
category: "Network",
|
52
|
-
},
|
53
|
-
|
54
|
-
source: createSource("endpoint-filter"),
|
55
|
-
})
|
package/src/apps/postgresql.ts
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
|
-
import { serviceEntity } from "../k8s"
|
3
|
-
import { l4EndpointEntity } from "../network"
|
4
|
-
import {
|
5
|
-
createArgs,
|
6
|
-
createInputs,
|
7
|
-
createSecrets,
|
8
|
-
createSource,
|
9
|
-
databaseSchema,
|
10
|
-
extraInputDefinitions,
|
11
|
-
} from "./shared"
|
12
|
-
|
13
|
-
export const postgresqlEntity = defineEntity({
|
14
|
-
type: "apps.postgresql",
|
15
|
-
|
16
|
-
schema: databaseSchema,
|
17
|
-
|
18
|
-
meta: {
|
19
|
-
color: "#336791",
|
20
|
-
},
|
21
|
-
})
|
22
|
-
|
23
|
-
export const postgresql = defineUnit({
|
24
|
-
type: "apps.postgresql",
|
25
|
-
|
26
|
-
args: createArgs("postgresql", ["external"]),
|
27
|
-
secrets: createSecrets(["rootPassword", "backupPassword"]),
|
28
|
-
inputs: createInputs(["resticRepo", "dnsProviders"]),
|
29
|
-
|
30
|
-
outputs: {
|
31
|
-
postgresql: postgresqlEntity,
|
32
|
-
service: serviceEntity,
|
33
|
-
endpoints: {
|
34
|
-
entity: l4EndpointEntity,
|
35
|
-
multiple: true,
|
36
|
-
},
|
37
|
-
},
|
38
|
-
|
39
|
-
meta: {
|
40
|
-
title: "PostgreSQL",
|
41
|
-
description: "The PostgreSQL database deployed on Kubernetes.",
|
42
|
-
icon: "simple-icons:postgresql",
|
43
|
-
secondaryIcon: "mdi:database",
|
44
|
-
category: "Databases",
|
45
|
-
},
|
46
|
-
|
47
|
-
source: createSource("postgresql/app"),
|
48
|
-
})
|
49
|
-
|
50
|
-
extraInputDefinitions.postgresql = {
|
51
|
-
entity: postgresqlEntity,
|
52
|
-
title: "PostgreSQL",
|
53
|
-
}
|
54
|
-
|
55
|
-
export const postgresqlDatabase = defineUnit({
|
56
|
-
type: "apps.postgresql.database",
|
57
|
-
|
58
|
-
args: {
|
59
|
-
database: z.string().optional(),
|
60
|
-
username: z.string().optional(),
|
61
|
-
},
|
62
|
-
|
63
|
-
secrets: {
|
64
|
-
password: z.string().optional(),
|
65
|
-
},
|
66
|
-
|
67
|
-
inputs: createInputs(["postgresql"]),
|
68
|
-
|
69
|
-
meta: {
|
70
|
-
title: "PostgreSQL Database",
|
71
|
-
description:
|
72
|
-
"The virtual PostgreSQL database created on the PostgreSQL instance. Works only for PostgreSQL instances deployed on Kubernetes.",
|
73
|
-
icon: "simple-icons:postgresql",
|
74
|
-
secondaryIcon: "mdi:database-plus",
|
75
|
-
category: "Databases",
|
76
|
-
},
|
77
|
-
|
78
|
-
source: createSource("postgresql/database"),
|
79
|
-
})
|
80
|
-
|
81
|
-
export type PostgreSQL = z.infer<typeof postgresqlEntity.schema>
|
package/src/apps/shared.ts
DELETED
@@ -1,289 +0,0 @@
|
|
1
|
-
import type { mariadbEntity } from "./mariadb"
|
2
|
-
import type { postgresqlEntity } from "./postgresql"
|
3
|
-
import type { mongodbEntity } from "./mongodb"
|
4
|
-
import { z } from "@highstate/contract"
|
5
|
-
import {
|
6
|
-
accessPointEntity,
|
7
|
-
clusterEntity,
|
8
|
-
persistentVolumeClaimEntity,
|
9
|
-
serviceEntity,
|
10
|
-
} from "../k8s"
|
11
|
-
import { repositoryEntity } from "../restic"
|
12
|
-
import { providerEntity } from "../dns"
|
13
|
-
import { l4EndpointEntity } from "../network"
|
14
|
-
|
15
|
-
const extraArgsDefinitions = {
|
16
|
-
fqdn: {
|
17
|
-
schema: z.string(),
|
18
|
-
},
|
19
|
-
endpoints: {
|
20
|
-
schema: z.string().array(),
|
21
|
-
required: false,
|
22
|
-
},
|
23
|
-
external: {
|
24
|
-
schema: z.boolean(),
|
25
|
-
required: false,
|
26
|
-
},
|
27
|
-
} as const
|
28
|
-
|
29
|
-
const extraSecretsDefinitions = {
|
30
|
-
rootPassword: {
|
31
|
-
schema: z.string(),
|
32
|
-
required: false,
|
33
|
-
},
|
34
|
-
backupPassword: {
|
35
|
-
schema: z.string(),
|
36
|
-
required: false,
|
37
|
-
},
|
38
|
-
}
|
39
|
-
|
40
|
-
type LazyExtraInputDefinitions = {
|
41
|
-
mariadb: {
|
42
|
-
entity: typeof mariadbEntity
|
43
|
-
title: "MariaDB"
|
44
|
-
}
|
45
|
-
postgresql: {
|
46
|
-
entity: typeof postgresqlEntity
|
47
|
-
title: "PostgreSQL"
|
48
|
-
}
|
49
|
-
mongodb: {
|
50
|
-
entity: typeof mongodbEntity
|
51
|
-
title: "MongoDB"
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
const eagerExtraInputDefinitions = {
|
56
|
-
accessPoint: {
|
57
|
-
entity: accessPointEntity,
|
58
|
-
},
|
59
|
-
resticRepo: {
|
60
|
-
entity: repositoryEntity,
|
61
|
-
required: false,
|
62
|
-
},
|
63
|
-
dnsProviders: {
|
64
|
-
entity: providerEntity,
|
65
|
-
required: false,
|
66
|
-
multiple: true,
|
67
|
-
},
|
68
|
-
volume: {
|
69
|
-
entity: persistentVolumeClaimEntity,
|
70
|
-
required: false,
|
71
|
-
},
|
72
|
-
} as const
|
73
|
-
|
74
|
-
export const extraInputDefinitions = {
|
75
|
-
...eagerExtraInputDefinitions,
|
76
|
-
} as typeof eagerExtraInputDefinitions & LazyExtraInputDefinitions
|
77
|
-
|
78
|
-
type ExtraArgsDefinitions = typeof extraArgsDefinitions
|
79
|
-
type ExtraSecretsDefinitions = typeof extraSecretsDefinitions
|
80
|
-
type ExtraArgsName = keyof ExtraArgsDefinitions
|
81
|
-
type ExtraSecretsName = keyof ExtraSecretsDefinitions
|
82
|
-
|
83
|
-
type CreateArgsOptions<R extends readonly ExtraArgsName[], O extends readonly ExtraArgsName[]> = {
|
84
|
-
required?: R
|
85
|
-
optional?: O
|
86
|
-
}
|
87
|
-
|
88
|
-
type CreateSecretsOptions<
|
89
|
-
R extends readonly ExtraSecretsName[],
|
90
|
-
O extends readonly ExtraSecretsName[],
|
91
|
-
> = {
|
92
|
-
required?: R
|
93
|
-
optional?: O
|
94
|
-
}
|
95
|
-
|
96
|
-
export function createArgs<T extends readonly ExtraArgsName[] = []>(
|
97
|
-
defaultAppName: string,
|
98
|
-
extraArgs?: T,
|
99
|
-
): {
|
100
|
-
appName: z.ZodDefault<z.ZodString>
|
101
|
-
} & {
|
102
|
-
[K in T[number]]: ExtraArgsDefinitions[K]
|
103
|
-
}
|
104
|
-
|
105
|
-
export function createArgs<
|
106
|
-
R extends readonly ExtraArgsName[] = [],
|
107
|
-
O extends readonly ExtraArgsName[] = [],
|
108
|
-
>(
|
109
|
-
defaultAppName: string,
|
110
|
-
extraArgs?: CreateArgsOptions<R, O>,
|
111
|
-
): {
|
112
|
-
appName: z.ZodDefault<z.ZodString>
|
113
|
-
} & {
|
114
|
-
[K in R[number]]: ExtraArgsDefinitions[K] & { required: true }
|
115
|
-
} & {
|
116
|
-
[K in O[number]]: ExtraArgsDefinitions[K] & { required: false }
|
117
|
-
}
|
118
|
-
|
119
|
-
export function createArgs<
|
120
|
-
R extends readonly ExtraArgsName[] = [],
|
121
|
-
O extends readonly ExtraArgsName[] = [],
|
122
|
-
>(defaultAppName: string, extraArgs?: readonly ExtraArgsName[] | CreateArgsOptions<R, O>) {
|
123
|
-
const base = {
|
124
|
-
appName: z.string().default(defaultAppName),
|
125
|
-
}
|
126
|
-
|
127
|
-
const dynamicArgs: Partial<Record<ExtraArgsName, object>> = {}
|
128
|
-
|
129
|
-
if (Array.isArray(extraArgs)) {
|
130
|
-
for (const name of extraArgs as readonly ExtraArgsName[]) {
|
131
|
-
dynamicArgs[name] = extraArgsDefinitions[name]
|
132
|
-
}
|
133
|
-
} else {
|
134
|
-
const { required, optional } = (extraArgs as CreateArgsOptions<R, O>) ?? {}
|
135
|
-
|
136
|
-
for (const name of required ?? []) {
|
137
|
-
dynamicArgs[name] = {
|
138
|
-
...extraArgsDefinitions[name],
|
139
|
-
required: true,
|
140
|
-
}
|
141
|
-
}
|
142
|
-
|
143
|
-
for (const name of optional ?? []) {
|
144
|
-
dynamicArgs[name] = {
|
145
|
-
...extraArgsDefinitions[name],
|
146
|
-
required: false,
|
147
|
-
}
|
148
|
-
}
|
149
|
-
}
|
150
|
-
|
151
|
-
return {
|
152
|
-
...base,
|
153
|
-
...dynamicArgs,
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
export function createSecrets<T extends readonly ExtraSecretsName[] = []>(
|
158
|
-
extraSecrets?: T,
|
159
|
-
): {
|
160
|
-
[K in T[number]]: ExtraSecretsDefinitions[K]
|
161
|
-
}
|
162
|
-
|
163
|
-
export function createSecrets<
|
164
|
-
R extends readonly ExtraSecretsName[] = [],
|
165
|
-
O extends readonly ExtraSecretsName[] = [],
|
166
|
-
>(
|
167
|
-
extraSecrets?: CreateSecretsOptions<R, O>,
|
168
|
-
): {
|
169
|
-
[K in R[number]]: ExtraSecretsDefinitions[K] & { required: true }
|
170
|
-
} & {
|
171
|
-
[K in O[number]]: ExtraSecretsDefinitions[K] & { required: false }
|
172
|
-
}
|
173
|
-
|
174
|
-
export function createSecrets<
|
175
|
-
R extends readonly ExtraSecretsName[] = [],
|
176
|
-
O extends readonly ExtraSecretsName[] = [],
|
177
|
-
>(extraSecrets?: readonly ExtraSecretsName[] | CreateSecretsOptions<R, O>) {
|
178
|
-
const dynamicSecrets: Partial<Record<ExtraSecretsName, object>> = {}
|
179
|
-
|
180
|
-
if (Array.isArray(extraSecrets)) {
|
181
|
-
for (const name of extraSecrets as readonly ExtraSecretsName[]) {
|
182
|
-
dynamicSecrets[name] = extraSecretsDefinitions[name]
|
183
|
-
}
|
184
|
-
} else {
|
185
|
-
const { required, optional } = (extraSecrets as CreateSecretsOptions<R, O>) ?? {}
|
186
|
-
|
187
|
-
for (const name of required ?? []) {
|
188
|
-
dynamicSecrets[name] = {
|
189
|
-
...extraSecretsDefinitions[name],
|
190
|
-
required: true,
|
191
|
-
}
|
192
|
-
}
|
193
|
-
|
194
|
-
for (const name of optional ?? []) {
|
195
|
-
dynamicSecrets[name] = {
|
196
|
-
...extraSecretsDefinitions[name],
|
197
|
-
required: false,
|
198
|
-
}
|
199
|
-
}
|
200
|
-
}
|
201
|
-
|
202
|
-
return dynamicSecrets as {
|
203
|
-
[K in R[number]]: ExtraSecretsDefinitions[K] & { required: true }
|
204
|
-
} & {
|
205
|
-
[K in O[number]]: ExtraSecretsDefinitions[K] & { required: false }
|
206
|
-
}
|
207
|
-
}
|
208
|
-
|
209
|
-
type ExtraInputDefinitions = typeof extraInputDefinitions
|
210
|
-
type ExtraInputName = keyof ExtraInputDefinitions
|
211
|
-
|
212
|
-
type CreateInputsOptions<
|
213
|
-
R extends readonly ExtraInputName[],
|
214
|
-
O extends readonly ExtraInputName[],
|
215
|
-
> = {
|
216
|
-
required?: R
|
217
|
-
optional?: O
|
218
|
-
}
|
219
|
-
|
220
|
-
export function createInputs<T extends readonly ExtraInputName[] = []>(
|
221
|
-
inputs?: T,
|
222
|
-
): {
|
223
|
-
k8sCluster: typeof clusterEntity
|
224
|
-
} & {
|
225
|
-
[K in T[number]]: ExtraInputDefinitions[K]
|
226
|
-
}
|
227
|
-
|
228
|
-
export function createInputs<
|
229
|
-
R extends readonly ExtraInputName[] = [],
|
230
|
-
O extends readonly ExtraInputName[] = [],
|
231
|
-
>(
|
232
|
-
inputs?: CreateInputsOptions<R, O>,
|
233
|
-
): {
|
234
|
-
k8sCluster: typeof clusterEntity
|
235
|
-
} & {
|
236
|
-
[K in R[number]]: ExtraInputDefinitions[K] & { required: true }
|
237
|
-
} & {
|
238
|
-
[K in O[number]]: ExtraInputDefinitions[K] & { required: false }
|
239
|
-
}
|
240
|
-
|
241
|
-
export function createInputs<
|
242
|
-
R extends readonly ExtraInputName[] = [],
|
243
|
-
O extends readonly ExtraInputName[] = [],
|
244
|
-
>(inputs?: readonly ExtraInputName[] | CreateInputsOptions<R, O>) {
|
245
|
-
const base = {
|
246
|
-
k8sCluster: clusterEntity,
|
247
|
-
}
|
248
|
-
|
249
|
-
const dynamicInputs: Partial<Record<ExtraInputName, object>> = {}
|
250
|
-
|
251
|
-
if (Array.isArray(inputs)) {
|
252
|
-
for (const name of inputs as readonly ExtraInputName[]) {
|
253
|
-
dynamicInputs[name] = extraInputDefinitions[name]
|
254
|
-
}
|
255
|
-
} else {
|
256
|
-
const { required, optional } = (inputs as CreateInputsOptions<R, O>) ?? {}
|
257
|
-
|
258
|
-
for (const name of required ?? []) {
|
259
|
-
dynamicInputs[name] = {
|
260
|
-
...extraInputDefinitions[name],
|
261
|
-
required: true,
|
262
|
-
}
|
263
|
-
}
|
264
|
-
for (const name of optional ?? []) {
|
265
|
-
dynamicInputs[name] = {
|
266
|
-
...extraInputDefinitions[name],
|
267
|
-
required: false,
|
268
|
-
}
|
269
|
-
}
|
270
|
-
}
|
271
|
-
|
272
|
-
return {
|
273
|
-
...base,
|
274
|
-
...dynamicInputs,
|
275
|
-
}
|
276
|
-
}
|
277
|
-
|
278
|
-
export function createSource(path: string) {
|
279
|
-
return {
|
280
|
-
package: "@highstate/apps",
|
281
|
-
path,
|
282
|
-
}
|
283
|
-
}
|
284
|
-
|
285
|
-
export const databaseSchema = z.object({
|
286
|
-
endpoints: l4EndpointEntity.schema.array(),
|
287
|
-
service: serviceEntity.schema.optional(),
|
288
|
-
rootPassword: z.string(),
|
289
|
-
})
|