@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/src/apps/syncthing.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { persistentVolumeClaimEntity, serviceEntity } from "../k8s"
|
3
3
|
import { l4EndpointEntity } from "../network"
|
4
4
|
import { createArgs, createInputs, createSecrets, createSource } from "./shared"
|
5
5
|
|
6
|
-
export const backupModeSchema =
|
6
|
+
export const backupModeSchema = z.enum(["state", "full"])
|
7
7
|
|
8
8
|
export const syncthing = defineUnit({
|
9
9
|
type: "apps.syncthing",
|
@@ -17,7 +17,7 @@ export const syncthing = defineUnit({
|
|
17
17
|
* The `fqdn` argument unlike this one points to the gateway and used to
|
18
18
|
* access the Syncthing Web UI.
|
19
19
|
*/
|
20
|
-
deviceFqdn:
|
20
|
+
deviceFqdn: z.string().optional(),
|
21
21
|
|
22
22
|
/**
|
23
23
|
* The backup mode to use for the Syncthing instance.
|
@@ -28,7 +28,7 @@ export const syncthing = defineUnit({
|
|
28
28
|
*
|
29
29
|
* The default is `state`.
|
30
30
|
*/
|
31
|
-
backupMode:
|
31
|
+
backupMode: backupModeSchema.default("state"),
|
32
32
|
},
|
33
33
|
|
34
34
|
secrets: createSecrets(["backupPassword"]),
|
@@ -44,9 +44,9 @@ export const syncthing = defineUnit({
|
|
44
44
|
},
|
45
45
|
|
46
46
|
meta: {
|
47
|
-
|
47
|
+
title: "Syncthing",
|
48
48
|
description: "The Syncthing instance deployed on Kubernetes.",
|
49
|
-
|
49
|
+
icon: "simple-icons:syncthing",
|
50
50
|
category: "File Sync",
|
51
51
|
},
|
52
52
|
|
package/src/apps/traefik.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { gatewayEntity, serviceEntity } from "../k8s"
|
3
3
|
import { l4EndpointEntity } from "../network"
|
4
4
|
import { createArgs, createInputs } from "./shared"
|
@@ -8,7 +8,7 @@ export const traefikGateway = defineUnit({
|
|
8
8
|
|
9
9
|
args: {
|
10
10
|
...createArgs("traefik", ["external"]),
|
11
|
-
className:
|
11
|
+
className: z.string().optional(),
|
12
12
|
},
|
13
13
|
|
14
14
|
inputs: createInputs(),
|
@@ -23,9 +23,9 @@ export const traefikGateway = defineUnit({
|
|
23
23
|
},
|
24
24
|
|
25
25
|
meta: {
|
26
|
-
|
26
|
+
title: "Traefik Gateway",
|
27
27
|
description: "A Traefik gateway for routing traffic to services.",
|
28
|
-
|
28
|
+
icon: "simple-icons:traefikproxy",
|
29
29
|
category: "Network",
|
30
30
|
},
|
31
31
|
|
package/src/apps/vaultwarden.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { createArgs, createInputs, createSource } from "./shared"
|
3
3
|
|
4
4
|
export const vaultwarden = defineUnit({
|
@@ -7,15 +7,15 @@ export const vaultwarden = defineUnit({
|
|
7
7
|
args: createArgs("vaultwarden", ["fqdn"]),
|
8
8
|
|
9
9
|
secrets: {
|
10
|
-
mariadbPassword:
|
10
|
+
mariadbPassword: z.string().optional(),
|
11
11
|
},
|
12
12
|
|
13
13
|
inputs: createInputs(["accessPoint", "mariadb"]),
|
14
14
|
|
15
15
|
meta: {
|
16
|
-
|
16
|
+
title: "Vaultwarden",
|
17
17
|
description: "The Vaultwarden password manager deployed on Kubernetes.",
|
18
|
-
|
18
|
+
icon: "simple-icons:vaultwarden",
|
19
19
|
category: "Security",
|
20
20
|
},
|
21
21
|
|
package/src/apps/zitadel.ts
CHANGED
@@ -9,9 +9,9 @@ export const zitadel = defineUnit({
|
|
9
9
|
inputs: createInputs(["accessPoint", "postgresql"]),
|
10
10
|
|
11
11
|
meta: {
|
12
|
-
|
12
|
+
title: "Zitadel",
|
13
13
|
description: "The Zitadel IAM deployed on Kubernetes.",
|
14
|
-
|
14
|
+
icon: "hugeicons:access",
|
15
15
|
},
|
16
16
|
|
17
17
|
source: {
|
package/src/cloudflare.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
import { defineUnit,
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
2
|
import { providerEntity } from "./dns"
|
3
3
|
|
4
4
|
export const connection = defineUnit({
|
5
5
|
type: "cloudflare.connection",
|
6
6
|
|
7
7
|
secrets: {
|
8
|
-
apiToken:
|
8
|
+
apiToken: z.string(),
|
9
9
|
},
|
10
10
|
|
11
11
|
outputs: {
|
@@ -13,9 +13,9 @@ export const connection = defineUnit({
|
|
13
13
|
},
|
14
14
|
|
15
15
|
meta: {
|
16
|
-
|
16
|
+
title: "Cloudflare Connection",
|
17
17
|
description: "Creates a new Cloudflare connection for one zone.",
|
18
|
-
|
18
|
+
icon: "simple-icons:cloudflare",
|
19
19
|
category: "Cloudflare",
|
20
20
|
},
|
21
21
|
|
package/src/common.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineEntity, defineUnit,
|
1
|
+
import { defineEntity, defineUnit, z } from "@highstate/contract"
|
2
2
|
import { credentialsSchema, keyPairEntity } from "./ssh"
|
3
3
|
import { l3EndpointEntity } from "./network"
|
4
4
|
import * as dns from "./dns"
|
@@ -7,10 +7,10 @@ import { arrayPatchModeSchema } from "./utils"
|
|
7
7
|
export const serverEntity = defineEntity({
|
8
8
|
type: "common.server",
|
9
9
|
|
10
|
-
schema:
|
11
|
-
hostname:
|
12
|
-
endpoints:
|
13
|
-
ssh:
|
10
|
+
schema: z.object({
|
11
|
+
hostname: z.string(),
|
12
|
+
endpoints: l3EndpointEntity.schema.array(),
|
13
|
+
ssh: credentialsSchema.optional(),
|
14
14
|
}),
|
15
15
|
|
16
16
|
meta: {
|
@@ -35,22 +35,22 @@ export const existingServer = defineUnit({
|
|
35
35
|
*
|
36
36
|
* Takes precedence over the `endpoint` input.
|
37
37
|
*/
|
38
|
-
endpoint:
|
38
|
+
endpoint: z.string().optional(),
|
39
39
|
|
40
40
|
/**
|
41
41
|
* The SSH user to use for connecting to the server.
|
42
42
|
*/
|
43
|
-
sshUser:
|
43
|
+
sshUser: z.string().default("root"),
|
44
44
|
|
45
45
|
/**
|
46
46
|
* The SSH port to use for connecting to the server.
|
47
47
|
*/
|
48
|
-
sshPort:
|
48
|
+
sshPort: z.number().default(22),
|
49
49
|
},
|
50
50
|
|
51
51
|
secrets: {
|
52
|
-
sshPassword:
|
53
|
-
sshPrivateKey:
|
52
|
+
sshPassword: z.string().optional(),
|
53
|
+
sshPrivateKey: z.string().optional(),
|
54
54
|
},
|
55
55
|
|
56
56
|
inputs: {
|
@@ -67,9 +67,9 @@ export const existingServer = defineUnit({
|
|
67
67
|
outputs: serverOutputs,
|
68
68
|
|
69
69
|
meta: {
|
70
|
-
|
70
|
+
title: "Existing Server",
|
71
71
|
description: "An existing server that can be used in the configuration.",
|
72
|
-
|
72
|
+
icon: "mdi:server",
|
73
73
|
defaultNamePrefix: "server",
|
74
74
|
category: "Infrastructure",
|
75
75
|
},
|
@@ -90,10 +90,8 @@ export const serverPatch = defineUnit({
|
|
90
90
|
* The entry may represent real node endpoint or virtual endpoint (like a load balancer).
|
91
91
|
*
|
92
92
|
* The same server may also be represented by multiple entries (e.g. a node with private and public IP).
|
93
|
-
*
|
94
|
-
* @schema
|
95
93
|
*/
|
96
|
-
endpoints:
|
94
|
+
endpoints: z.string().array().default([]),
|
97
95
|
|
98
96
|
/**
|
99
97
|
* The mode to use for patching the endpoints.
|
@@ -101,7 +99,7 @@ export const serverPatch = defineUnit({
|
|
101
99
|
* - `prepend`: prepend the new endpoints to the existing ones (default);
|
102
100
|
* - `replace`: replace the existing endpoints with the new ones.
|
103
101
|
*/
|
104
|
-
endpointsPatchMode:
|
102
|
+
endpointsPatchMode: arrayPatchModeSchema.default("prepend"),
|
105
103
|
},
|
106
104
|
|
107
105
|
inputs: {
|
@@ -122,9 +120,9 @@ export const serverPatch = defineUnit({
|
|
122
120
|
},
|
123
121
|
|
124
122
|
meta: {
|
125
|
-
|
123
|
+
title: "Server Patch",
|
126
124
|
description: "Patches some properties of the server.",
|
127
|
-
|
125
|
+
icon: "mdi:server",
|
128
126
|
secondaryIcon: "fluent:patch-20-filled",
|
129
127
|
category: "Infrastructure",
|
130
128
|
},
|
@@ -154,9 +152,9 @@ export const serverDns = defineUnit({
|
|
154
152
|
},
|
155
153
|
|
156
154
|
meta: {
|
157
|
-
|
155
|
+
title: "Server DNS",
|
158
156
|
description: "Creates DNS records for the server and updates endpoints.",
|
159
|
-
|
157
|
+
icon: "mdi:server",
|
160
158
|
secondaryIcon: "mdi:dns",
|
161
159
|
category: "Infrastructure",
|
162
160
|
},
|
@@ -171,9 +169,9 @@ export const script = defineUnit({
|
|
171
169
|
type: "common.script",
|
172
170
|
|
173
171
|
args: {
|
174
|
-
script:
|
175
|
-
updateScript:
|
176
|
-
deleteScript:
|
172
|
+
script: z.string().meta({ language: "shell" }),
|
173
|
+
updateScript: z.string().optional().meta({ language: "shell" }),
|
174
|
+
deleteScript: z.string().optional().meta({ language: "shell" }),
|
177
175
|
},
|
178
176
|
|
179
177
|
inputs: {
|
@@ -185,9 +183,9 @@ export const script = defineUnit({
|
|
185
183
|
},
|
186
184
|
|
187
185
|
meta: {
|
188
|
-
|
186
|
+
title: "Shell Script",
|
189
187
|
description: "Run a shell script on the server.",
|
190
|
-
|
188
|
+
icon: "mdi:bash",
|
191
189
|
category: "Infrastructure",
|
192
190
|
},
|
193
191
|
|
@@ -197,57 +195,6 @@ export const script = defineUnit({
|
|
197
195
|
},
|
198
196
|
})
|
199
197
|
|
200
|
-
export
|
201
|
-
type: "common.file-meta",
|
202
|
-
|
203
|
-
schema: Type.Object({
|
204
|
-
name: Type.String(),
|
205
|
-
size: Type.Number(),
|
206
|
-
mode: Type.Number(),
|
207
|
-
isBinary: Type.Optional(Type.Boolean()),
|
208
|
-
}),
|
209
|
-
|
210
|
-
meta: {
|
211
|
-
color: "#FF5722",
|
212
|
-
description: "Metadata for a file.",
|
213
|
-
},
|
214
|
-
})
|
215
|
-
|
216
|
-
export const fileContentEntity = defineEntity({
|
217
|
-
type: "common.file-content",
|
218
|
-
|
219
|
-
schema: Type.Union([
|
220
|
-
Type.Object({
|
221
|
-
type: Type.Literal("inline"),
|
222
|
-
content: Type.String(),
|
223
|
-
}),
|
224
|
-
Type.Object({
|
225
|
-
type: Type.Literal("remote"),
|
226
|
-
url: Type.String(),
|
227
|
-
}),
|
228
|
-
]),
|
229
|
-
|
230
|
-
meta: {
|
231
|
-
color: "#FF5722",
|
232
|
-
description: "The content of a file.",
|
233
|
-
},
|
234
|
-
})
|
235
|
-
|
236
|
-
export const fileEntity = defineEntity({
|
237
|
-
type: "common.file",
|
238
|
-
|
239
|
-
schema: Type.Object({
|
240
|
-
meta: fileMetaEntity.schema,
|
241
|
-
content: fileContentEntity.schema,
|
242
|
-
}),
|
243
|
-
|
244
|
-
meta: {
|
245
|
-
color: "#FF5722",
|
246
|
-
},
|
247
|
-
})
|
248
|
-
|
249
|
-
export type Server = Static<typeof serverEntity.schema>
|
198
|
+
export type Server = z.infer<typeof serverEntity.schema>
|
250
199
|
|
251
|
-
export
|
252
|
-
export type FileMeta = Static<typeof fileMetaEntity.schema>
|
253
|
-
export type FileContent = Static<typeof fileContentEntity.schema>
|
200
|
+
export * from "./files"
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./ubuntu"
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
|
+
import { fileEntity } from "../files"
|
3
|
+
|
4
|
+
export const ubuntuVersionSchema = z.enum(["22.04", "24.04", "24.10", "25.04", "25.10"])
|
5
|
+
export const ubuntuArchitectureSchema = z.enum(["amd64", "arm64"])
|
6
|
+
|
7
|
+
export const ubuntu = defineUnit({
|
8
|
+
type: "distributions.ubuntu",
|
9
|
+
|
10
|
+
args: {
|
11
|
+
version: ubuntuVersionSchema.default("24.04"),
|
12
|
+
architecture: ubuntuArchitectureSchema.default("amd64"),
|
13
|
+
},
|
14
|
+
|
15
|
+
outputs: {
|
16
|
+
image: fileEntity,
|
17
|
+
cloudConfig: fileEntity,
|
18
|
+
},
|
19
|
+
|
20
|
+
meta: {
|
21
|
+
title: "Ubuntu",
|
22
|
+
description: "Ubuntu distribution with image and cloud-config.",
|
23
|
+
icon: "mdi:ubuntu",
|
24
|
+
iconColor: "#E95420",
|
25
|
+
category: "Distributions",
|
26
|
+
},
|
27
|
+
|
28
|
+
source: {
|
29
|
+
package: "@highstate/distributions",
|
30
|
+
path: "ubuntu",
|
31
|
+
},
|
32
|
+
})
|
package/src/dns.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
import { defineEntity,
|
1
|
+
import { defineEntity, z } from "@highstate/contract"
|
2
2
|
import { endpointFilterSchema } from "./network"
|
3
3
|
import { arrayPatchModeSchema, prefixKeysWith } from "./utils"
|
4
4
|
|
5
5
|
export const providerEntity = defineEntity({
|
6
6
|
type: "dns.provider",
|
7
7
|
|
8
|
-
schema:
|
9
|
-
name:
|
10
|
-
type:
|
11
|
-
data:
|
12
|
-
domain:
|
8
|
+
schema: z.object({
|
9
|
+
name: z.string(),
|
10
|
+
type: z.string(),
|
11
|
+
data: z.record(z.string(), z.unknown()),
|
12
|
+
domain: z.string(),
|
13
13
|
}),
|
14
14
|
|
15
15
|
meta: {
|
@@ -25,10 +25,8 @@ export function createArgs<TPrefix extends string = "">(prefix?: TPrefix) {
|
|
25
25
|
* Will be inserted at the beginning of the resulting endpoint list.
|
26
26
|
*
|
27
27
|
* Will throw an error if no matching provider is found.
|
28
|
-
*
|
29
|
-
* @schema
|
30
28
|
*/
|
31
|
-
fqdn:
|
29
|
+
fqdn: z.string().optional(),
|
32
30
|
|
33
31
|
/**
|
34
32
|
* The endpoint filter to filter the endpoints before creating the DNS records.
|
@@ -46,10 +44,8 @@ export function createArgs<TPrefix extends string = "">(prefix?: TPrefix) {
|
|
46
44
|
* - If any public endpoints exist, all public endpoints are selected;
|
47
45
|
* - Otherwise, if any external endpoints exist, all external endpoints are selected;
|
48
46
|
* - If neither exist, all internal endpoints are selected.
|
49
|
-
*
|
50
|
-
* @schema
|
51
47
|
*/
|
52
|
-
endpointFilter:
|
48
|
+
endpointFilter: endpointFilterSchema.default([]),
|
53
49
|
|
54
50
|
/**
|
55
51
|
* The mode to use for patching the existing endpoints.
|
@@ -58,10 +54,8 @@ export function createArgs<TPrefix extends string = "">(prefix?: TPrefix) {
|
|
58
54
|
* - `replace`: Replace the existing endpoints with the FQDN. It will ensure that the only the FQDN is used.
|
59
55
|
*
|
60
56
|
* The default is `prepend`.
|
61
|
-
*
|
62
|
-
* @schema
|
63
57
|
*/
|
64
|
-
patchMode:
|
58
|
+
patchMode: arrayPatchModeSchema.default("prepend"),
|
65
59
|
})
|
66
60
|
}
|
67
61
|
|
@@ -70,8 +64,6 @@ export const inputs = {
|
|
70
64
|
* The DNS providers to use to create the DNS records.
|
71
65
|
*
|
72
66
|
* If multiple providers match the domain, all of them will be used and multiple DNS records will be created.
|
73
|
-
*
|
74
|
-
* @schema
|
75
67
|
*/
|
76
68
|
dnsProviders: {
|
77
69
|
entity: providerEntity,
|
@@ -79,4 +71,4 @@ export const inputs = {
|
|
79
71
|
},
|
80
72
|
} as const
|
81
73
|
|
82
|
-
export type Provider =
|
74
|
+
export type Provider = z.infer<typeof providerEntity.schema>
|
package/src/files.ts
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
import {
|
2
|
+
defineEntity,
|
3
|
+
defineUnit,
|
4
|
+
z,
|
5
|
+
fileContentSchema as baseFileContentSchema,
|
6
|
+
fileMetaSchema as baseFileMetaSchema,
|
7
|
+
unitArtifactSchema,
|
8
|
+
} from "@highstate/contract"
|
9
|
+
import { l7EndpointEntity } from "./network"
|
10
|
+
|
11
|
+
export const checksumAlgorithmSchema = z.enum(["md5", "sha1", "sha256", "sha384", "sha512"])
|
12
|
+
|
13
|
+
export const checksumSchema = z.object({
|
14
|
+
algorithm: checksumAlgorithmSchema,
|
15
|
+
value: z.string(),
|
16
|
+
})
|
17
|
+
|
18
|
+
export const fileContentSchema = z.union([
|
19
|
+
baseFileContentSchema,
|
20
|
+
z.object({
|
21
|
+
type: z.literal("local"),
|
22
|
+
path: z.string(),
|
23
|
+
}),
|
24
|
+
z.object({
|
25
|
+
type: z.literal("remote"),
|
26
|
+
endpoint: l7EndpointEntity.schema,
|
27
|
+
checksum: checksumSchema.optional(),
|
28
|
+
}),
|
29
|
+
])
|
30
|
+
|
31
|
+
export const fileEntity = defineEntity({
|
32
|
+
type: "common.file",
|
33
|
+
|
34
|
+
schema: z.object({
|
35
|
+
meta: baseFileMetaSchema,
|
36
|
+
content: fileContentSchema,
|
37
|
+
}),
|
38
|
+
|
39
|
+
meta: {
|
40
|
+
color: "#FF5722",
|
41
|
+
},
|
42
|
+
})
|
43
|
+
|
44
|
+
export const folderMetaSchema = z.object({
|
45
|
+
name: z.string(),
|
46
|
+
mode: z.number().optional(),
|
47
|
+
})
|
48
|
+
|
49
|
+
export const folderContentSchema = z.union([
|
50
|
+
z.object({
|
51
|
+
type: z.literal("embedded"),
|
52
|
+
files: fileEntity.schema.array(),
|
53
|
+
folders: z
|
54
|
+
.object({
|
55
|
+
meta: folderMetaSchema,
|
56
|
+
get content() {
|
57
|
+
return folderContentSchema
|
58
|
+
},
|
59
|
+
})
|
60
|
+
.array(),
|
61
|
+
}),
|
62
|
+
z.object({
|
63
|
+
type: z.literal("artifact"),
|
64
|
+
...unitArtifactSchema.shape,
|
65
|
+
}),
|
66
|
+
z.object({
|
67
|
+
type: z.literal("local"),
|
68
|
+
path: z.string(),
|
69
|
+
}),
|
70
|
+
z.object({
|
71
|
+
type: z.literal("remote"),
|
72
|
+
endpoint: l7EndpointEntity.schema,
|
73
|
+
}),
|
74
|
+
])
|
75
|
+
|
76
|
+
export const folderEntity = defineEntity({
|
77
|
+
type: "common.folder",
|
78
|
+
|
79
|
+
schema: z.object({
|
80
|
+
meta: folderMetaSchema,
|
81
|
+
content: folderContentSchema,
|
82
|
+
}),
|
83
|
+
|
84
|
+
meta: {
|
85
|
+
color: "#FF9800",
|
86
|
+
},
|
87
|
+
})
|
88
|
+
|
89
|
+
export const remoteFile = defineUnit({
|
90
|
+
type: "common.remote-file",
|
91
|
+
|
92
|
+
args: {
|
93
|
+
/**
|
94
|
+
* The URL of the remote file.
|
95
|
+
*/
|
96
|
+
url: z.string().optional(),
|
97
|
+
},
|
98
|
+
|
99
|
+
inputs: {
|
100
|
+
/**
|
101
|
+
* The L7 endpoint of the remote file.
|
102
|
+
*/
|
103
|
+
endpoint: {
|
104
|
+
entity: l7EndpointEntity,
|
105
|
+
required: false,
|
106
|
+
},
|
107
|
+
},
|
108
|
+
|
109
|
+
outputs: {
|
110
|
+
file: fileEntity,
|
111
|
+
},
|
112
|
+
|
113
|
+
meta: {
|
114
|
+
title: "Remote File",
|
115
|
+
description: "References a file from a remote URL.",
|
116
|
+
icon: "mdi:file-download",
|
117
|
+
category: "Files",
|
118
|
+
},
|
119
|
+
|
120
|
+
source: {
|
121
|
+
package: "@highstate/common",
|
122
|
+
path: "units/remote-file",
|
123
|
+
},
|
124
|
+
})
|
125
|
+
|
126
|
+
export type File = z.infer<typeof fileEntity.schema>
|
127
|
+
export type FileMeta = z.infer<typeof baseFileMetaSchema>
|
128
|
+
export type FileContent = z.infer<typeof fileContentSchema>
|
129
|
+
|
130
|
+
export type Folder = z.infer<typeof folderEntity.schema>
|
131
|
+
export type FolderMeta = z.infer<typeof folderMetaSchema>
|
132
|
+
export type FolderContent = z.infer<typeof folderContentSchema>
|
133
|
+
|
134
|
+
export type Checksum = z.infer<typeof checksumSchema>
|
135
|
+
export type ChecksumAlgorithm = z.infer<typeof checksumAlgorithmSchema>
|
package/src/git.ts
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
import { defineUnit, z } from "@highstate/contract"
|
2
|
+
import { l7EndpointEntity } from "./network"
|
3
|
+
import { folderEntity } from "./files"
|
4
|
+
|
5
|
+
export const remoteRepository = defineUnit({
|
6
|
+
type: "git.remote-repository",
|
7
|
+
|
8
|
+
args: {
|
9
|
+
/**
|
10
|
+
* The URL of the remote repository.
|
11
|
+
*/
|
12
|
+
url: z.string().optional(),
|
13
|
+
|
14
|
+
/**
|
15
|
+
* The ref of the remote repository to checkout.
|
16
|
+
*
|
17
|
+
* If not specified, the default branch will be used.
|
18
|
+
*/
|
19
|
+
ref: z.string().optional(),
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Whether to include the .git directory in the packed artifact.
|
23
|
+
*
|
24
|
+
* Do not enable this unless you need the full git history.
|
25
|
+
*/
|
26
|
+
includeGit: z.boolean().default(false),
|
27
|
+
},
|
28
|
+
|
29
|
+
inputs: {
|
30
|
+
/**
|
31
|
+
* The L7 endpoint of the remote repository.
|
32
|
+
*/
|
33
|
+
endpoint: {
|
34
|
+
entity: l7EndpointEntity,
|
35
|
+
required: false,
|
36
|
+
},
|
37
|
+
},
|
38
|
+
|
39
|
+
outputs: {
|
40
|
+
/**
|
41
|
+
* The folder containing the repository content.
|
42
|
+
*/
|
43
|
+
folder: folderEntity,
|
44
|
+
},
|
45
|
+
|
46
|
+
meta: {
|
47
|
+
title: "Git Remote Repository",
|
48
|
+
description: "References a remote Git repository.",
|
49
|
+
icon: "simple-icons:git",
|
50
|
+
iconColor: "#f1502f",
|
51
|
+
category: "Git",
|
52
|
+
},
|
53
|
+
|
54
|
+
source: {
|
55
|
+
package: "@highstate/git",
|
56
|
+
path: "remote-repository",
|
57
|
+
},
|
58
|
+
})
|
package/src/index.ts
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
import { noop } from "./abbreviations"
|
2
|
+
noop()
|
3
|
+
|
1
4
|
export * as common from "./common"
|
2
5
|
export * as proxmox from "./proxmox"
|
3
6
|
export * as ssh from "./ssh"
|
@@ -14,5 +17,7 @@ export * as timeweb from "./timeweb"
|
|
14
17
|
export * as nixos from "./nixos"
|
15
18
|
export * as sops from "./sops"
|
16
19
|
export * as obfuscators from "./obfuscators"
|
20
|
+
export * as distributions from "./distributions"
|
17
21
|
export * as network from "./network"
|
22
|
+
export * as git from "./git"
|
18
23
|
export * from "./utils"
|