@highstate/library 0.7.10 → 0.8.0
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.manifest.json +1 -1
- package/dist/index.js +326 -26
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/common.ts +53 -0
- package/src/index.ts +2 -0
- package/src/k3s.ts +8 -0
- package/src/k8s.ts +50 -5
- package/src/nixos.ts +167 -0
- package/src/sops.ts +33 -0
- package/src/wireguard.ts +21 -1
package/dist/index.js
CHANGED
@@ -9,6 +9,9 @@ var common_exports = {};
|
|
9
9
|
__export(common_exports, {
|
10
10
|
endpointEntity: () => endpointEntity,
|
11
11
|
existingServer: () => existingServer,
|
12
|
+
fileContentEntity: () => fileContentEntity,
|
13
|
+
fileEntity: () => fileEntity,
|
14
|
+
fileMetaEntity: () => fileMetaEntity,
|
12
15
|
script: () => script,
|
13
16
|
serverEntity: () => serverEntity
|
14
17
|
});
|
@@ -145,6 +148,46 @@ var script = defineUnit2({
|
|
145
148
|
path: "script"
|
146
149
|
}
|
147
150
|
});
|
151
|
+
var fileMetaEntity = defineEntity2({
|
152
|
+
type: "common.file-meta",
|
153
|
+
schema: Type2.Object({
|
154
|
+
name: Type2.String(),
|
155
|
+
size: Type2.Number(),
|
156
|
+
isBinary: Type2.Optional(Type2.Boolean()),
|
157
|
+
isExecutable: Type2.Optional(Type2.Boolean())
|
158
|
+
}),
|
159
|
+
meta: {
|
160
|
+
color: "#FF5722",
|
161
|
+
description: "Metadata for a file."
|
162
|
+
}
|
163
|
+
});
|
164
|
+
var fileContentEntity = defineEntity2({
|
165
|
+
type: "common.file-content",
|
166
|
+
schema: Type2.Union([
|
167
|
+
Type2.Object({
|
168
|
+
type: Type2.Literal("inline"),
|
169
|
+
content: Type2.String()
|
170
|
+
}),
|
171
|
+
Type2.Object({
|
172
|
+
type: Type2.Literal("remote"),
|
173
|
+
url: Type2.String()
|
174
|
+
})
|
175
|
+
]),
|
176
|
+
meta: {
|
177
|
+
color: "#FF5722",
|
178
|
+
description: "The content of a file."
|
179
|
+
}
|
180
|
+
});
|
181
|
+
var fileEntity = defineEntity2({
|
182
|
+
type: "common.file",
|
183
|
+
schema: Type2.Object({
|
184
|
+
meta: fileMetaEntity.schema,
|
185
|
+
content: fileContentEntity.schema
|
186
|
+
}),
|
187
|
+
meta: {
|
188
|
+
color: "#FF5722"
|
189
|
+
}
|
190
|
+
});
|
148
191
|
|
149
192
|
// src/proxmox.ts
|
150
193
|
var proxmox_exports = {};
|
@@ -317,6 +360,7 @@ __export(k8s_exports, {
|
|
317
360
|
deploymentSpecSchema: () => deploymentSpecSchema,
|
318
361
|
dns01TlsIssuer: () => dns01TlsIssuer,
|
319
362
|
existingCluster: () => existingCluster,
|
363
|
+
gatewayApi: () => gatewayApi,
|
320
364
|
gatewayEntity: () => gatewayEntity,
|
321
365
|
interfaceEntity: () => interfaceEntity,
|
322
366
|
internalIpsPolicySchema: () => internalIpsPolicySchema,
|
@@ -380,7 +424,10 @@ var clusterInfoSchema = Type5.Object({
|
|
380
424
|
id: Type5.String(),
|
381
425
|
name: Type5.String(),
|
382
426
|
cni: Type5.Optional(Type5.String()),
|
383
|
-
externalIps: Type5.Array(Type5.String())
|
427
|
+
externalIps: Type5.Array(Type5.String()),
|
428
|
+
fqdn: Type5.Optional(Type5.String()),
|
429
|
+
kubeApiServerIp: Type5.Optional(Type5.String()),
|
430
|
+
kubeApiServerPort: Type5.Optional(Type5.Number())
|
384
431
|
});
|
385
432
|
var serviceTypeSchema = Type5.StringEnum(["NodePort", "LoadBalancer", "ClusterIP"]);
|
386
433
|
var metadataSchema = Type5.Object({
|
@@ -542,14 +589,14 @@ var tlsIssuerEntity = defineEntity5({
|
|
542
589
|
}
|
543
590
|
});
|
544
591
|
var accessPointEntity = defineEntity5({
|
545
|
-
type: "
|
592
|
+
type: "k8s.access-point",
|
546
593
|
schema: Type5.Object({
|
547
594
|
gateway: gatewayEntity.schema,
|
548
595
|
tlsIssuer: tlsIssuerEntity.schema,
|
549
|
-
|
596
|
+
dnsProviders: Type5.Array(providerEntity.schema)
|
550
597
|
}),
|
551
598
|
meta: {
|
552
|
-
color: "#
|
599
|
+
color: "#F57F17"
|
553
600
|
}
|
554
601
|
});
|
555
602
|
var accessPoint = defineUnit5({
|
@@ -557,7 +604,10 @@ var accessPoint = defineUnit5({
|
|
557
604
|
inputs: {
|
558
605
|
gateway: gatewayEntity,
|
559
606
|
tlsIssuer: tlsIssuerEntity,
|
560
|
-
|
607
|
+
dnsProviders: {
|
608
|
+
entity: providerEntity,
|
609
|
+
multiple: true
|
610
|
+
}
|
561
611
|
},
|
562
612
|
outputs: {
|
563
613
|
accessPoint: accessPointEntity
|
@@ -592,9 +642,27 @@ var certManager = defineUnit5({
|
|
592
642
|
});
|
593
643
|
var dns01TlsIssuer = defineUnit5({
|
594
644
|
type: "k8s.dns01-issuer",
|
645
|
+
args: {
|
646
|
+
/**
|
647
|
+
* The top-level domains to filter the DNS01 challenge for.
|
648
|
+
*
|
649
|
+
* If not provided, will use all domains passed to the DNS providers.
|
650
|
+
*
|
651
|
+
* @schema
|
652
|
+
*/
|
653
|
+
domains: {
|
654
|
+
...Type5.Optional(Type5.Array(Type5.String())),
|
655
|
+
description: `The top-level domains to filter the DNS01 challenge for.
|
656
|
+
|
657
|
+
If not provided, will use all domains passed to the DNS providers.`
|
658
|
+
}
|
659
|
+
},
|
595
660
|
inputs: {
|
596
661
|
k8sCluster: clusterEntity2,
|
597
|
-
|
662
|
+
dnsProviders: {
|
663
|
+
entity: providerEntity,
|
664
|
+
multiple: true
|
665
|
+
}
|
598
666
|
},
|
599
667
|
outputs: {
|
600
668
|
tlsIssuer: tlsIssuerEntity
|
@@ -672,6 +740,25 @@ var interfaceEntity = defineEntity5({
|
|
672
740
|
description: "The interface in a network space of pod kernel which can accept or transmit packets."
|
673
741
|
}
|
674
742
|
});
|
743
|
+
var gatewayApi = defineUnit5({
|
744
|
+
type: "k8s.gateway-api",
|
745
|
+
inputs: {
|
746
|
+
k8sCluster: clusterEntity2
|
747
|
+
},
|
748
|
+
outputs: {
|
749
|
+
k8sCluster: clusterEntity2
|
750
|
+
},
|
751
|
+
meta: {
|
752
|
+
displayName: "Gateway API",
|
753
|
+
description: "Installs the Gateway API CRDs to the cluster.",
|
754
|
+
primaryIcon: "mdi:kubernetes",
|
755
|
+
primaryIconColor: "#4CAF50"
|
756
|
+
},
|
757
|
+
source: {
|
758
|
+
package: "@highstate/k8s",
|
759
|
+
path: "units/gateway-api"
|
760
|
+
}
|
761
|
+
});
|
675
762
|
|
676
763
|
// src/talos.ts
|
677
764
|
var talos_exports = {};
|
@@ -1216,7 +1303,8 @@ var identity = defineUnit7({
|
|
1216
1303
|
* The FQDN of the WireGuard identity.
|
1217
1304
|
* Will be used as endpoint for the peer.
|
1218
1305
|
*
|
1219
|
-
* If `dnsProvider` is provided and `
|
1306
|
+
* If `dnsProvider` is provided, external IP is available and `registerFqdn` is set to `true`, and FQDN is provided explicitly (not obtained from the k8s cluster),
|
1307
|
+
* the FQDN will be registered with the DNS provider.
|
1220
1308
|
*
|
1221
1309
|
* @schema
|
1222
1310
|
*/
|
@@ -1225,7 +1313,21 @@ var identity = defineUnit7({
|
|
1225
1313
|
description: `The FQDN of the WireGuard identity.
|
1226
1314
|
Will be used as endpoint for the peer.
|
1227
1315
|
|
1228
|
-
If \`dnsProvider\` is provided and \`
|
1316
|
+
If \`dnsProvider\` is provided, external IP is available and \`registerFqdn\` is set to \`true\`, and FQDN is provided explicitly (not obtained from the k8s cluster),
|
1317
|
+
the FQDN will be registered with the DNS provider.`
|
1318
|
+
},
|
1319
|
+
/**
|
1320
|
+
* Whether to register the FQDN of the identity with the DNS provider.
|
1321
|
+
*
|
1322
|
+
* By default, `true`.
|
1323
|
+
*
|
1324
|
+
* @schema
|
1325
|
+
*/
|
1326
|
+
registerFqdn: {
|
1327
|
+
...Type7.Default(Type7.Boolean(), true),
|
1328
|
+
description: `Whether to register the FQDN of the identity with the DNS provider.
|
1329
|
+
|
1330
|
+
By default, \`true\`.`
|
1229
1331
|
}
|
1230
1332
|
},
|
1231
1333
|
secrets: {
|
@@ -1290,6 +1392,15 @@ var identity = defineUnit7({
|
|
1290
1392
|
|
1291
1393
|
Their IP addresses will be added to the \`allowedIps\` of the identity and passed to the node to set up network policies.`
|
1292
1394
|
},
|
1395
|
+
/**
|
1396
|
+
* The Kubernetes cluster associated with the identity.
|
1397
|
+
*
|
1398
|
+
* If provided, will be used to obtain the external IP or FQDN of the identity.
|
1399
|
+
*/
|
1400
|
+
k8sCluster: {
|
1401
|
+
entity: clusterEntity2,
|
1402
|
+
required: false
|
1403
|
+
},
|
1293
1404
|
dnsProvider: {
|
1294
1405
|
entity: providerEntity,
|
1295
1406
|
required: false
|
@@ -2057,13 +2168,20 @@ __export(k3s_exports, {
|
|
2057
2168
|
cluster: () => cluster2
|
2058
2169
|
});
|
2059
2170
|
import { defineUnit as defineUnit21 } from "@highstate/contract";
|
2171
|
+
import { Type as Type21 } from "@sinclair/typebox";
|
2060
2172
|
var cluster2 = defineUnit21({
|
2061
2173
|
type: "k3s.cluster",
|
2062
2174
|
args: {
|
2063
|
-
...sharedClusterArgs
|
2175
|
+
...sharedClusterArgs,
|
2176
|
+
config: Type21.Optional(Type21.Record(Type21.String(), Type21.Any()))
|
2064
2177
|
},
|
2065
2178
|
inputs: {
|
2066
|
-
server: serverEntity
|
2179
|
+
server: serverEntity,
|
2180
|
+
dnsProviders: {
|
2181
|
+
entity: providerEntity,
|
2182
|
+
required: false,
|
2183
|
+
multiple: true
|
2184
|
+
}
|
2067
2185
|
},
|
2068
2186
|
outputs: {
|
2069
2187
|
k8sCluster: clusterEntity2
|
@@ -2087,17 +2205,17 @@ __export(mullvad_exports, {
|
|
2087
2205
|
endpointType: () => endpointType,
|
2088
2206
|
peer: () => peer2
|
2089
2207
|
});
|
2090
|
-
import { defineUnit as defineUnit22, Type as
|
2091
|
-
var endpointType =
|
2092
|
-
|
2093
|
-
|
2094
|
-
|
2208
|
+
import { defineUnit as defineUnit22, Type as Type22 } from "@highstate/contract";
|
2209
|
+
var endpointType = Type22.Union([
|
2210
|
+
Type22.Literal("fqdn"),
|
2211
|
+
Type22.Literal("ipv4"),
|
2212
|
+
Type22.Literal("ipv6")
|
2095
2213
|
]);
|
2096
2214
|
var peer2 = defineUnit22({
|
2097
2215
|
type: "mullvad.peer",
|
2098
2216
|
args: {
|
2099
|
-
hostname:
|
2100
|
-
endpointType:
|
2217
|
+
hostname: Type22.Optional(Type22.String()),
|
2218
|
+
endpointType: Type22.Optional({ ...endpointType, default: "fqdn" })
|
2101
2219
|
},
|
2102
2220
|
inputs: {
|
2103
2221
|
/**
|
@@ -2133,18 +2251,18 @@ __export(timeweb_exports, {
|
|
2133
2251
|
connectionEntity: () => connectionEntity,
|
2134
2252
|
virtualMachine: () => virtualMachine2
|
2135
2253
|
});
|
2136
|
-
import { defineEntity as defineEntity12, defineUnit as defineUnit23, Type as
|
2254
|
+
import { defineEntity as defineEntity12, defineUnit as defineUnit23, Type as Type23 } from "@highstate/contract";
|
2137
2255
|
var connectionEntity = defineEntity12({
|
2138
2256
|
type: "timeweb.connection",
|
2139
|
-
schema:
|
2140
|
-
name:
|
2141
|
-
apiToken:
|
2257
|
+
schema: Type23.Object({
|
2258
|
+
name: Type23.String(),
|
2259
|
+
apiToken: Type23.String()
|
2142
2260
|
})
|
2143
2261
|
});
|
2144
2262
|
var connection3 = defineUnit23({
|
2145
2263
|
type: "timeweb.connection",
|
2146
2264
|
secrets: {
|
2147
|
-
apiToken:
|
2265
|
+
apiToken: Type23.String()
|
2148
2266
|
},
|
2149
2267
|
outputs: {
|
2150
2268
|
connection: connectionEntity
|
@@ -2162,9 +2280,9 @@ var connection3 = defineUnit23({
|
|
2162
2280
|
var virtualMachine2 = defineUnit23({
|
2163
2281
|
type: "timeweb.virtual-machine",
|
2164
2282
|
args: {
|
2165
|
-
presetId:
|
2166
|
-
osId:
|
2167
|
-
availabilityZone:
|
2283
|
+
presetId: Type23.Optional(Type23.Number()),
|
2284
|
+
osId: Type23.Optional(Type23.Number()),
|
2285
|
+
availabilityZone: Type23.String()
|
2168
2286
|
},
|
2169
2287
|
inputs: {
|
2170
2288
|
connection: connectionEntity,
|
@@ -2174,7 +2292,7 @@ var virtualMachine2 = defineUnit23({
|
|
2174
2292
|
}
|
2175
2293
|
},
|
2176
2294
|
secrets: {
|
2177
|
-
sshPrivateKey:
|
2295
|
+
sshPrivateKey: Type23.Optional(Type23.String())
|
2178
2296
|
},
|
2179
2297
|
outputs: {
|
2180
2298
|
server: serverEntity
|
@@ -2190,6 +2308,186 @@ var virtualMachine2 = defineUnit23({
|
|
2190
2308
|
path: "virtual-machine"
|
2191
2309
|
}
|
2192
2310
|
});
|
2311
|
+
|
2312
|
+
// src/nixos.ts
|
2313
|
+
var nixos_exports = {};
|
2314
|
+
__export(nixos_exports, {
|
2315
|
+
flakeEntity: () => flakeEntity,
|
2316
|
+
inlineFlake: () => inlineFlake,
|
2317
|
+
inlineModule: () => inlineModule,
|
2318
|
+
inlineModuleEntity: () => inlineModuleEntity,
|
2319
|
+
remoteFlake: () => remoteFlake,
|
2320
|
+
system: () => system
|
2321
|
+
});
|
2322
|
+
import { defineEntity as defineEntity13, defineUnit as defineUnit24, Type as Type24 } from "@highstate/contract";
|
2323
|
+
var inlineModuleEntity = defineEntity13({
|
2324
|
+
type: "nixos.inline-module",
|
2325
|
+
schema: Type24.Object({
|
2326
|
+
code: Type24.String()
|
2327
|
+
}),
|
2328
|
+
meta: {
|
2329
|
+
displayName: "NixOS Inline Module",
|
2330
|
+
description: "The NixOS module reference.",
|
2331
|
+
color: "#5277c3"
|
2332
|
+
}
|
2333
|
+
});
|
2334
|
+
var inlineModule = defineUnit24({
|
2335
|
+
type: "nixos.inline-module",
|
2336
|
+
args: {
|
2337
|
+
code: Type24.String({ language: "nix" })
|
2338
|
+
},
|
2339
|
+
inputs: {
|
2340
|
+
files: {
|
2341
|
+
entity: fileEntity,
|
2342
|
+
required: false,
|
2343
|
+
multiple: true
|
2344
|
+
}
|
2345
|
+
},
|
2346
|
+
outputs: {
|
2347
|
+
module: inlineModuleEntity
|
2348
|
+
},
|
2349
|
+
meta: {
|
2350
|
+
displayName: "NixOS Inline Module",
|
2351
|
+
description: "Creates a NixOS module from inline code.",
|
2352
|
+
primaryIcon: "simple-icons:nixos",
|
2353
|
+
primaryIconColor: "#7ebae4",
|
2354
|
+
secondaryIcon: "mdi:file-code"
|
2355
|
+
},
|
2356
|
+
source: {
|
2357
|
+
package: "@highstate/nixos",
|
2358
|
+
path: "inline-module"
|
2359
|
+
}
|
2360
|
+
});
|
2361
|
+
var flakeEntity = defineEntity13({
|
2362
|
+
type: "nixos.flake",
|
2363
|
+
schema: Type24.Object({
|
2364
|
+
url: Type24.String()
|
2365
|
+
}),
|
2366
|
+
meta: {
|
2367
|
+
displayName: "NixOS Flake",
|
2368
|
+
description: "The NixOS flake reference.",
|
2369
|
+
color: "#5277c3"
|
2370
|
+
}
|
2371
|
+
});
|
2372
|
+
var remoteFlake = defineUnit24({
|
2373
|
+
type: "nixos.remote-flake",
|
2374
|
+
args: {
|
2375
|
+
url: Type24.String()
|
2376
|
+
},
|
2377
|
+
outputs: {
|
2378
|
+
flake: flakeEntity
|
2379
|
+
},
|
2380
|
+
meta: {
|
2381
|
+
displayName: "NixOS Remote Flake",
|
2382
|
+
description: "References a remote NixOS flake.",
|
2383
|
+
primaryIcon: "simple-icons:nixos",
|
2384
|
+
primaryIconColor: "#7ebae4",
|
2385
|
+
secondaryIcon: "simple-icons:git",
|
2386
|
+
secondaryIconColor: "#f1502f"
|
2387
|
+
},
|
2388
|
+
source: {
|
2389
|
+
package: "@highstate/nixos",
|
2390
|
+
path: "flake"
|
2391
|
+
}
|
2392
|
+
});
|
2393
|
+
var inlineFlake = defineUnit24({
|
2394
|
+
type: "nixos.inline-flake",
|
2395
|
+
args: {
|
2396
|
+
code: Type24.String({ language: "nix" })
|
2397
|
+
},
|
2398
|
+
inputs: {
|
2399
|
+
flakes: {
|
2400
|
+
entity: flakeEntity,
|
2401
|
+
required: false,
|
2402
|
+
multiple: true
|
2403
|
+
},
|
2404
|
+
modules: {
|
2405
|
+
entity: inlineModuleEntity,
|
2406
|
+
required: false,
|
2407
|
+
multiple: true
|
2408
|
+
},
|
2409
|
+
files: {
|
2410
|
+
entity: fileEntity,
|
2411
|
+
required: false,
|
2412
|
+
multiple: true
|
2413
|
+
}
|
2414
|
+
},
|
2415
|
+
outputs: {
|
2416
|
+
flake: flakeEntity
|
2417
|
+
},
|
2418
|
+
meta: {
|
2419
|
+
displayName: "NixOS Inline Flake",
|
2420
|
+
description: "Creates a NixOS flake from inline code.",
|
2421
|
+
primaryIcon: "simple-icons:nixos",
|
2422
|
+
primaryIconColor: "#7ebae4",
|
2423
|
+
secondaryIcon: "mdi:file-code"
|
2424
|
+
},
|
2425
|
+
source: {
|
2426
|
+
package: "@highstate/nixos",
|
2427
|
+
path: "inline-flake"
|
2428
|
+
}
|
2429
|
+
});
|
2430
|
+
var system = defineUnit24({
|
2431
|
+
type: "nixos.system",
|
2432
|
+
args: {
|
2433
|
+
system: Type24.Optional(Type24.String())
|
2434
|
+
},
|
2435
|
+
inputs: {
|
2436
|
+
flake: flakeEntity,
|
2437
|
+
server: serverEntity,
|
2438
|
+
modules: {
|
2439
|
+
entity: inlineModuleEntity,
|
2440
|
+
required: false,
|
2441
|
+
multiple: true
|
2442
|
+
}
|
2443
|
+
},
|
2444
|
+
outputs: {
|
2445
|
+
server: serverEntity
|
2446
|
+
},
|
2447
|
+
meta: {
|
2448
|
+
displayName: "NixOS System",
|
2449
|
+
description: "Creates a NixOS system on top of any server.",
|
2450
|
+
primaryIcon: "simple-icons:nixos",
|
2451
|
+
primaryIconColor: "#7ebae4",
|
2452
|
+
secondaryIcon: "codicon:vm"
|
2453
|
+
},
|
2454
|
+
source: {
|
2455
|
+
package: "@highstate/nixos",
|
2456
|
+
path: "system"
|
2457
|
+
}
|
2458
|
+
});
|
2459
|
+
|
2460
|
+
// src/sops.ts
|
2461
|
+
var sops_exports = {};
|
2462
|
+
__export(sops_exports, {
|
2463
|
+
secrets: () => secrets
|
2464
|
+
});
|
2465
|
+
import { defineUnit as defineUnit25, Type as Type25 } from "@highstate/contract";
|
2466
|
+
var secrets = defineUnit25({
|
2467
|
+
type: "sops.secrets",
|
2468
|
+
args: {
|
2469
|
+
secrets: Type25.Record(Type25.String(), Type25.Any())
|
2470
|
+
},
|
2471
|
+
inputs: {
|
2472
|
+
servers: {
|
2473
|
+
entity: serverEntity,
|
2474
|
+
required: false,
|
2475
|
+
multiple: true
|
2476
|
+
}
|
2477
|
+
},
|
2478
|
+
outputs: {
|
2479
|
+
file: fileEntity
|
2480
|
+
},
|
2481
|
+
meta: {
|
2482
|
+
displayName: "SOPS Secrets",
|
2483
|
+
description: "Encrypts secrets using SOPS for the specified servers.",
|
2484
|
+
primaryIcon: "mdi:file-lock"
|
2485
|
+
},
|
2486
|
+
source: {
|
2487
|
+
package: "@highstate/sops",
|
2488
|
+
path: "secrets"
|
2489
|
+
}
|
2490
|
+
});
|
2193
2491
|
export {
|
2194
2492
|
apps_exports as apps,
|
2195
2493
|
cloudflare_exports as cloudflare,
|
@@ -2198,8 +2496,10 @@ export {
|
|
2198
2496
|
k3s_exports as k3s,
|
2199
2497
|
k8s_exports as k8s,
|
2200
2498
|
mullvad_exports as mullvad,
|
2499
|
+
nixos_exports as nixos,
|
2201
2500
|
proxmox_exports as proxmox,
|
2202
2501
|
restic_exports as restic,
|
2502
|
+
sops_exports as sops,
|
2203
2503
|
ssh_exports as ssh,
|
2204
2504
|
talos_exports as talos,
|
2205
2505
|
timeweb_exports as timeweb,
|