@highstate/library 0.9.16 → 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/src/k8s.ts CHANGED
@@ -1,37 +1,36 @@
1
- import { defineEntity, defineUnit, Type, type Static } from "@highstate/contract"
2
- import { Literal } from "@sinclair/typebox"
1
+ import { $args, defineEntity, defineUnit, z } from "@highstate/contract"
3
2
  import * as dns from "./dns"
4
3
  import { l3EndpointEntity, l4EndpointEntity } from "./network"
5
4
  import { serverEntity } from "./common"
6
5
  import { arrayPatchModeSchema } from "./utils"
7
6
 
8
- export const fallbackKubeApiAccessSchema = Type.Object({
9
- serverIp: Type.String(),
10
- serverPort: Type.Number(),
7
+ export const fallbackKubeApiAccessSchema = z.object({
8
+ serverIp: z.string(),
9
+ serverPort: z.number(),
11
10
  })
12
11
 
13
- export const tunDevicePolicySchema = Type.Union([
14
- Type.Object({
15
- type: Literal("host"),
12
+ export const tunDevicePolicySchema = z.union([
13
+ z.object({
14
+ type: z.literal("host"),
16
15
  }),
17
- Type.Object({
18
- type: Literal("plugin"),
19
- resourceName: Type.String(),
20
- resourceValue: Type.String(),
16
+ z.object({
17
+ type: z.literal("plugin"),
18
+ resourceName: z.string(),
19
+ resourceValue: z.string(),
21
20
  }),
22
21
  ])
23
22
 
24
- export const externalServiceTypeSchema = Type.StringEnum(["NodePort", "LoadBalancer"])
25
- export const scheduleOnMastersPolicySchema = Type.StringEnum(["always", "when-no-workers", "never"])
26
- export const cniSchema = Type.StringEnum(["cilium", "other"])
23
+ export const externalServiceTypeSchema = z.enum(["NodePort", "LoadBalancer"])
24
+ export const scheduleOnMastersPolicySchema = z.enum(["always", "when-no-workers", "never"])
25
+ export const cniSchema = z.enum(["cilium", "other"])
27
26
 
28
- export const clusterQuirksSchema = Type.Object({
27
+ export const clusterQuirksSchema = z.object({
29
28
  /**
30
29
  * The IP and port of the kube-apiserver available from the cluster.
31
30
  *
32
31
  * Will be used to create fallback network policy in CNIs which does not support allowing access to the kube-apiserver.
33
32
  */
34
- fallbackKubeApiAccess: Type.Optional(fallbackKubeApiAccessSchema),
33
+ fallbackKubeApiAccess: fallbackKubeApiAccessSchema.optional(),
35
34
 
36
35
  /**
37
36
  * Specifies the policy for using the tun device inside containers.
@@ -40,14 +39,14 @@ export const clusterQuirksSchema = Type.Object({
40
39
  *
41
40
  * For some runtimes, like Talos's one, the /dev/net/tun device is not available in the host, so the plugin policy should be used.
42
41
  */
43
- tunDevicePolicy: Type.Optional(tunDevicePolicySchema),
42
+ tunDevicePolicy: tunDevicePolicySchema.optional(),
44
43
 
45
44
  /**
46
45
  * The service type to use for external services.
47
46
  *
48
47
  * If not provided, the default service type is `NodePort` since `LoadBalancer` may not be available.
49
48
  */
50
- externalServiceType: Type.Optional(externalServiceTypeSchema),
49
+ externalServiceType: externalServiceTypeSchema.optional(),
51
50
  })
52
51
 
53
52
  export const clusterInfoProperties = {
@@ -56,12 +55,12 @@ export const clusterInfoProperties = {
56
55
  *
57
56
  * Should be defined as a UUID of the `kube-system` namespace which is always present in the cluster.
58
57
  */
59
- id: Type.String(),
58
+ id: z.string(),
60
59
 
61
60
  /**
62
61
  * The name of the cluster.
63
62
  */
64
- name: Type.String(),
63
+ name: z.string(),
65
64
 
66
65
  /**
67
66
  * The name of the CNI plugin used by the cluster.
@@ -79,7 +78,7 @@ export const clusterInfoProperties = {
79
78
  *
80
79
  * The same node may also be represented by multiple entries (e.g. a node with private and public IP).
81
80
  */
82
- endpoints: Type.Array(l3EndpointEntity.schema),
81
+ endpoints: l3EndpointEntity.schema.array(),
83
82
 
84
83
  /**
85
84
  * The endpoints of the API server.
@@ -88,45 +87,45 @@ export const clusterInfoProperties = {
88
87
  *
89
88
  * The same node may also be represented by multiple entries (e.g. a node with private and public IP).
90
89
  */
91
- apiEndpoints: Type.Array(l4EndpointEntity.schema),
90
+ apiEndpoints: l4EndpointEntity.schema.array(),
92
91
 
93
92
  /**
94
93
  * The external IPs of the cluster nodes allowed to be used for external access.
95
94
  */
96
- externalIps: Type.Array(Type.String()),
95
+ externalIps: z.string().array(),
97
96
 
98
97
  /**
99
98
  * The extra quirks of the cluster to improve compatibility.
100
99
  */
101
- quirks: Type.Optional(clusterQuirksSchema),
100
+ quirks: clusterQuirksSchema.optional(),
102
101
 
103
102
  /**
104
103
  * The extra metadata to attach to the cluster.
105
104
  */
106
- metadata: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
105
+ metadata: z.record(z.string(), z.unknown()).optional(),
107
106
  } as const
108
107
 
109
- export const serviceTypeSchema = Type.StringEnum(["NodePort", "LoadBalancer", "ClusterIP"])
108
+ export const serviceTypeSchema = z.enum(["NodePort", "LoadBalancer", "ClusterIP"])
110
109
 
111
- export const metadataSchema = Type.Object({
112
- name: Type.String(),
113
- namespace: Type.String(),
114
- labels: Type.Optional(Type.Record(Type.String(), Type.String())),
115
- annotations: Type.Optional(Type.Record(Type.String(), Type.String())),
110
+ export const metadataSchema = z.object({
111
+ name: z.string(),
112
+ namespace: z.string(),
113
+ labels: z.record(z.string(), z.string()).optional(),
114
+ annotations: z.record(z.string(), z.string()).optional(),
116
115
  })
117
116
 
118
- export const resourceSchema = Type.Object({
119
- clusterId: Type.String(),
117
+ export const resourceSchema = z.object({
118
+ clusterId: z.string(),
120
119
  metadata: metadataSchema,
121
120
  })
122
121
 
123
122
  export const serviceEntity = defineEntity({
124
123
  type: "k8s.service",
125
124
 
126
- schema: Type.Object({
127
- type: Type.Literal("k8s.service"),
128
- ...resourceSchema.properties,
129
- endpoints: Type.Array(l4EndpointEntity.schema),
125
+ schema: z.object({
126
+ type: z.literal("k8s.service"),
127
+ ...resourceSchema.shape,
128
+ endpoints: l4EndpointEntity.schema.array(),
130
129
  }),
131
130
 
132
131
  meta: {
@@ -137,9 +136,9 @@ export const serviceEntity = defineEntity({
137
136
  export const clusterEntity = defineEntity({
138
137
  type: "k8s.cluster",
139
138
 
140
- schema: Type.Object({
139
+ schema: z.object({
141
140
  ...clusterInfoProperties,
142
- kubeconfig: Type.String(),
141
+ kubeconfig: z.string(),
143
142
  }),
144
143
 
145
144
  meta: {
@@ -147,9 +146,9 @@ export const clusterEntity = defineEntity({
147
146
  },
148
147
  })
149
148
 
150
- export const internalIpsPolicySchema = Type.StringEnum(["always", "public", "never"])
149
+ export const internalIpsPolicySchema = z.enum(["always", "public", "never"])
151
150
 
152
- export const scheduleOnMastersPolicyArgs = {
151
+ export const scheduleOnMastersPolicyArgs = $args({
153
152
  /**
154
153
  * The policy for scheduling workloads on master nodes.
155
154
  *
@@ -157,8 +156,8 @@ export const scheduleOnMastersPolicyArgs = {
157
156
  * - `when-no-workers`: schedule workloads on master nodes only if there are no workers (default);
158
157
  * - `never`: never schedule workloads on master nodes.
159
158
  */
160
- scheduleOnMastersPolicy: Type.Default(scheduleOnMastersPolicySchema, "when-no-workers"),
161
- }
159
+ scheduleOnMastersPolicy: scheduleOnMastersPolicySchema.default("when-no-workers"),
160
+ })
162
161
 
163
162
  export const clusterInputs = {
164
163
  masters: {
@@ -193,7 +192,7 @@ export const existingCluster = defineUnit({
193
192
  *
194
193
  * If not provided, will be automatically detected by querying the cluster nodes.
195
194
  */
196
- externalIps: Type.Optional(Type.Array(Type.String())),
195
+ externalIps: z.string().array().optional(),
197
196
 
198
197
  /**
199
198
  * The policy for using internal IPs of the nodes as external IPs.
@@ -202,12 +201,12 @@ export const existingCluster = defineUnit({
202
201
  * - `public`: use internal IPs as external IPs only if they are (theoretically) routable from the public internet **(default)**;
203
202
  * - `never`: never use internal IPs as external IPs.
204
203
  */
205
- internalIpsPolicy: Type.Default(internalIpsPolicySchema, "public"),
204
+ internalIpsPolicy: internalIpsPolicySchema.default("public"),
206
205
 
207
206
  /**
208
207
  * The extra quirks of the cluster to improve compatibility.
209
208
  */
210
- quirks: Type.Optional(clusterQuirksSchema),
209
+ quirks: clusterQuirksSchema.optional(),
211
210
  },
212
211
 
213
212
  secrets: {
@@ -216,15 +215,15 @@ export const existingCluster = defineUnit({
216
215
  *
217
216
  * Will be available for all components using `cluster` output of this unit.
218
217
  */
219
- kubeconfig: Type.Record(Type.String(), Type.Any()),
218
+ kubeconfig: z.record(z.string(), z.unknown()),
220
219
  },
221
220
 
222
221
  outputs: clusterOutputs,
223
222
 
224
223
  meta: {
225
- displayName: "Existing Cluster",
224
+ title: "Existing Cluster",
226
225
  description: "An existing Kubernetes cluster.",
227
- primaryIcon: "devicon:kubernetes",
226
+ icon: "devicon:kubernetes",
228
227
  category: "Kubernetes",
229
228
  },
230
229
 
@@ -245,7 +244,7 @@ export const clusterPatch = defineUnit({
245
244
  *
246
245
  * The same node may also be represented by multiple entries (e.g. a node with private and public IP).
247
246
  */
248
- apiEndpoints: Type.Default(Type.Array(Type.String()), []),
247
+ apiEndpoints: z.string().array().default([]),
249
248
 
250
249
  /**
251
250
  * The mode to use for patching the API endpoints.
@@ -253,7 +252,7 @@ export const clusterPatch = defineUnit({
253
252
  * - `prepend`: prepend the new endpoints to the existing ones (default);
254
253
  * - `replace`: replace the existing endpoints with the new ones.
255
254
  */
256
- apiEndpointsPatchMode: Type.Default(arrayPatchModeSchema, "prepend"),
255
+ apiEndpointsPatchMode: arrayPatchModeSchema.default("prepend"),
257
256
 
258
257
  /**
259
258
  * The endpoints of the cluster nodes.
@@ -262,7 +261,7 @@ export const clusterPatch = defineUnit({
262
261
  *
263
262
  * The same node may also be represented by multiple entries (e.g. a node with private and public IP).
264
263
  */
265
- endpoints: Type.Default(Type.Array(Type.String()), []),
264
+ endpoints: z.string().array().default([]),
266
265
 
267
266
  /**
268
267
  * The mode to use for patching the endpoints.
@@ -270,7 +269,7 @@ export const clusterPatch = defineUnit({
270
269
  * - `prepend`: prepend the new endpoints to the existing ones (default);
271
270
  * - `replace`: replace the existing endpoints with the new ones.
272
271
  */
273
- endpointsPatchMode: Type.Default(arrayPatchModeSchema, "prepend"),
272
+ endpointsPatchMode: arrayPatchModeSchema.default("prepend"),
274
273
  },
275
274
 
276
275
  inputs: {
@@ -290,9 +289,9 @@ export const clusterPatch = defineUnit({
290
289
  outputs: clusterOutputs,
291
290
 
292
291
  meta: {
293
- displayName: "Cluster Patch",
292
+ title: "Cluster Patch",
294
293
  description: "Patches some properties of the cluster.",
295
- primaryIcon: "devicon:kubernetes",
294
+ icon: "devicon:kubernetes",
296
295
  secondaryIcon: "fluent:patch-20-filled",
297
296
  category: "Kubernetes",
298
297
  },
@@ -319,9 +318,9 @@ export const clusterDns = defineUnit({
319
318
  outputs: clusterOutputs,
320
319
 
321
320
  meta: {
322
- displayName: "Cluster DNS",
321
+ title: "Cluster DNS",
323
322
  description: "Creates DNS records for the cluster and updates endpoints.",
324
- primaryIcon: "devicon:kubernetes",
323
+ icon: "devicon:kubernetes",
325
324
  secondaryIcon: "mdi:dns",
326
325
  category: "Kubernetes",
327
326
  },
@@ -335,12 +334,12 @@ export const clusterDns = defineUnit({
335
334
  export const gatewayEntity = defineEntity({
336
335
  type: "k8s.gateway",
337
336
 
338
- schema: Type.Object({
339
- clusterId: Type.String(),
340
- gatewayClassName: Type.String(),
341
- httpListenerPort: Type.Number(),
342
- httpsListenerPort: Type.Number(),
343
- endpoints: Type.Array(l3EndpointEntity.schema),
337
+ schema: z.object({
338
+ clusterId: z.string(),
339
+ gatewayClassName: z.string(),
340
+ httpListenerPort: z.number(),
341
+ httpsListenerPort: z.number(),
342
+ endpoints: l3EndpointEntity.schema.array(),
344
343
  }),
345
344
 
346
345
  meta: {
@@ -351,9 +350,9 @@ export const gatewayEntity = defineEntity({
351
350
  export const tlsIssuerEntity = defineEntity({
352
351
  type: "k8s.tls-issuer",
353
352
 
354
- schema: Type.Object({
355
- clusterId: Type.String(),
356
- clusterIssuerName: Type.String(),
353
+ schema: z.object({
354
+ clusterId: z.string(),
355
+ clusterIssuerName: z.string(),
357
356
  }),
358
357
 
359
358
  meta: {
@@ -364,11 +363,11 @@ export const tlsIssuerEntity = defineEntity({
364
363
  export const accessPointEntity = defineEntity({
365
364
  type: "k8s.access-point",
366
365
 
367
- schema: Type.Object({
368
- clusterId: Type.String(),
366
+ schema: z.object({
367
+ clusterId: z.string(),
369
368
  gateway: gatewayEntity.schema,
370
369
  tlsIssuer: tlsIssuerEntity.schema,
371
- dnsProviders: Type.Array(dns.providerEntity.schema),
370
+ dnsProviders: dns.providerEntity.schema.array(),
372
371
  }),
373
372
 
374
373
  meta: {
@@ -393,9 +392,9 @@ export const accessPoint = defineUnit({
393
392
  },
394
393
 
395
394
  meta: {
396
- displayName: "Access Point",
395
+ title: "Access Point",
397
396
  description: "An access point which can be used to connect to services.",
398
- primaryIcon: "mdi:access-point",
397
+ icon: "mdi:access-point",
399
398
  category: "Kubernetes",
400
399
  },
401
400
 
@@ -417,9 +416,9 @@ export const certManager = defineUnit({
417
416
  },
418
417
 
419
418
  meta: {
420
- displayName: "Cert Manager",
419
+ title: "Cert Manager",
421
420
  description: "A certificate manager for managing TLS certificates.",
422
- primaryIcon: "simple-icons:letsencrypt",
421
+ icon: "simple-icons:letsencrypt",
423
422
  category: "Kubernetes",
424
423
  },
425
424
 
@@ -438,7 +437,7 @@ export const dns01TlsIssuer = defineUnit({
438
437
  *
439
438
  * If not provided, will use all domains passed to the DNS providers.
440
439
  */
441
- domains: Type.Optional(Type.Array(Type.String())),
440
+ domains: z.string().array().optional(),
442
441
  },
443
442
 
444
443
  inputs: {
@@ -454,9 +453,9 @@ export const dns01TlsIssuer = defineUnit({
454
453
  },
455
454
 
456
455
  meta: {
457
- displayName: "DNS01 Issuer",
456
+ title: "DNS01 Issuer",
458
457
  description: "A TLS issuer for issuing certificate using DNS01 challenge.",
459
- primaryIcon: "mdi:certificate",
458
+ icon: "mdi:certificate",
460
459
  category: "Kubernetes",
461
460
  },
462
461
 
@@ -469,10 +468,10 @@ export const dns01TlsIssuer = defineUnit({
469
468
  export const deploymentEntity = defineEntity({
470
469
  type: "k8s.deployment",
471
470
 
472
- schema: Type.Object({
473
- type: Type.Literal("k8s.deployment"),
474
- ...resourceSchema.properties,
475
- service: Type.Optional(serviceEntity.schema),
471
+ schema: z.object({
472
+ type: z.literal("k8s.deployment"),
473
+ ...resourceSchema.shape,
474
+ service: serviceEntity.schema.optional(),
476
475
  }),
477
476
 
478
477
  meta: {
@@ -483,9 +482,9 @@ export const deploymentEntity = defineEntity({
483
482
  export const statefulSetEntity = defineEntity({
484
483
  type: "k8s.stateful-set",
485
484
 
486
- schema: Type.Object({
487
- type: Type.Literal("k8s.stateful-set"),
488
- ...resourceSchema.properties,
485
+ schema: z.object({
486
+ type: z.literal("k8s.stateful-set"),
487
+ ...resourceSchema.shape,
489
488
  service: serviceEntity.schema,
490
489
  }),
491
490
 
@@ -497,7 +496,7 @@ export const statefulSetEntity = defineEntity({
497
496
  export const exposableWorkloadEntity = defineEntity({
498
497
  type: "k8s.exposable-workload",
499
498
 
500
- schema: Type.Union([deploymentEntity.schema, statefulSetEntity.schema]),
499
+ schema: z.union([deploymentEntity.schema, statefulSetEntity.schema]),
501
500
 
502
501
  meta: {
503
502
  color: "#4CAF50",
@@ -507,9 +506,9 @@ export const exposableWorkloadEntity = defineEntity({
507
506
  export const persistentVolumeClaimEntity = defineEntity({
508
507
  type: "k8s.persistent-volume-claim",
509
508
 
510
- schema: Type.Object({
511
- type: Type.Literal("k8s.persistent-volume-claim"),
512
- ...resourceSchema.properties,
509
+ schema: z.object({
510
+ type: z.literal("k8s.persistent-volume-claim"),
511
+ ...resourceSchema.shape,
513
512
  }),
514
513
 
515
514
  meta: {
@@ -520,8 +519,8 @@ export const persistentVolumeClaimEntity = defineEntity({
520
519
  export const interfaceEntity = defineEntity({
521
520
  type: "k8s.interface",
522
521
 
523
- schema: Type.Object({
524
- name: Type.String(),
522
+ schema: z.object({
523
+ name: z.string(),
525
524
  workload: exposableWorkloadEntity.schema,
526
525
  }),
527
526
 
@@ -544,9 +543,9 @@ export const gatewayApi = defineUnit({
544
543
  },
545
544
 
546
545
  meta: {
547
- displayName: "Gateway API",
546
+ title: "Gateway API",
548
547
  description: "Installs the Gateway API CRDs to the cluster.",
549
- primaryIcon: "devicon:kubernetes",
548
+ icon: "devicon:kubernetes",
550
549
  secondaryIcon: "mdi:api",
551
550
  secondaryIconColor: "#4CAF50",
552
551
  category: "Kubernetes",
@@ -569,7 +568,7 @@ export const cilium = defineUnit({
569
568
  *
570
569
  * By default, is `false`.
571
570
  */
572
- allowForbiddenFqdnResolution: Type.Default(Type.Boolean(), false),
571
+ allowForbiddenFqdnResolution: z.boolean().default(false),
573
572
  },
574
573
 
575
574
  inputs: {
@@ -581,9 +580,9 @@ export const cilium = defineUnit({
581
580
  },
582
581
 
583
582
  meta: {
584
- displayName: "Cilium",
583
+ title: "Cilium",
585
584
  description: "The Cilium CNI deployed on Kubernetes.",
586
- primaryIcon: "simple-icons:cilium",
585
+ icon: "simple-icons:cilium",
587
586
  secondaryIcon: "devicon:kubernetes",
588
587
  category: "Kubernetes",
589
588
  },
@@ -594,45 +593,45 @@ export const cilium = defineUnit({
594
593
  },
595
594
  })
596
595
 
597
- export const monitorWorkerResourceGroupSchema = Type.Object({
598
- type: Type.StringEnum(["deployment", "statefulset", "pod", "service"]),
599
- namespace: Type.String(),
600
- names: Type.Optional(Type.Array(Type.String())),
596
+ export const monitorWorkerResourceGroupSchema = z.object({
597
+ type: z.enum(["deployment", "statefulset", "pod", "service"]),
598
+ namespace: z.string(),
599
+ names: z.string().array().optional(),
601
600
  })
602
601
 
603
- export const monitorWorkerParamsSchema = Type.Object({
602
+ export const monitorWorkerParamsSchema = z.object({
604
603
  /**
605
604
  * The ID of the secret containing the kubeconfig of the cluster.
606
605
  */
607
- kubeconfigSecretId: Type.String(),
606
+ kubeconfigSecretId: z.string(),
608
607
 
609
608
  /**
610
609
  * The resources to monitor in the cluster.
611
610
  */
612
- resourceGroups: Type.Array(monitorWorkerResourceGroupSchema),
611
+ resourceGroups: monitorWorkerResourceGroupSchema.array(),
613
612
  })
614
613
 
615
- export type CNI = Static<typeof cniSchema>
616
- export type Cluster = Static<typeof clusterEntity.schema>
614
+ export type CNI = z.infer<typeof cniSchema>
615
+ export type Cluster = z.infer<typeof clusterEntity.schema>
617
616
 
618
- export type Gateway = Static<typeof gatewayEntity.schema>
619
- export type TlsIssuer = Static<typeof tlsIssuerEntity.schema>
620
- export type AccessPoint = Static<typeof accessPointEntity.schema>
617
+ export type Gateway = z.infer<typeof gatewayEntity.schema>
618
+ export type TlsIssuer = z.infer<typeof tlsIssuerEntity.schema>
619
+ export type AccessPoint = z.infer<typeof accessPointEntity.schema>
621
620
 
622
- export type Metadata = Static<typeof metadataSchema>
623
- export type Resource = Static<typeof resourceSchema>
621
+ export type Metadata = z.infer<typeof metadataSchema>
622
+ export type Resource = z.infer<typeof resourceSchema>
624
623
 
625
- export type ServiceType = Static<typeof serviceTypeSchema>
626
- export type Service = Static<typeof serviceEntity.schema>
624
+ export type ServiceType = z.infer<typeof serviceTypeSchema>
625
+ export type Service = z.infer<typeof serviceEntity.schema>
627
626
 
628
- export type Deployment = Static<typeof deploymentEntity.schema>
629
- export type ExposableWorkload = Static<typeof exposableWorkloadEntity.schema>
627
+ export type Deployment = z.infer<typeof deploymentEntity.schema>
628
+ export type ExposableWorkload = z.infer<typeof exposableWorkloadEntity.schema>
630
629
 
631
- export type PersistentVolumeClaim = Static<typeof persistentVolumeClaimEntity.schema>
632
- export type StatefulSet = Static<typeof statefulSetEntity.schema>
630
+ export type PersistentVolumeClaim = z.infer<typeof persistentVolumeClaimEntity.schema>
631
+ export type StatefulSet = z.infer<typeof statefulSetEntity.schema>
633
632
 
634
- export type Interface = Static<typeof interfaceEntity.schema>
635
- export type InternalIpsPolicy = Static<typeof internalIpsPolicySchema>
633
+ export type Interface = z.infer<typeof interfaceEntity.schema>
634
+ export type InternalIpsPolicy = z.infer<typeof internalIpsPolicySchema>
636
635
 
637
- export type MonitorWorkerParams = Static<typeof monitorWorkerParamsSchema>
638
- export type MonitorWorkerResourceGroup = Static<typeof monitorWorkerResourceGroupSchema>
636
+ export type MonitorWorkerParams = z.infer<typeof monitorWorkerParamsSchema>
637
+ export type MonitorWorkerResourceGroup = z.infer<typeof monitorWorkerResourceGroupSchema>
package/src/mullvad.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { defineUnit, Type } from "@highstate/contract"
1
+ import { defineUnit, z } from "@highstate/contract"
2
2
  import { networkEntity, peerEntity } from "./wireguard"
3
3
  import { l4EndpointEntity } from "./network"
4
4
 
@@ -6,12 +6,12 @@ export const peer = defineUnit({
6
6
  type: "mullvad.peer",
7
7
 
8
8
  args: {
9
- hostname: Type.Optional(Type.String()),
9
+ hostname: z.string().optional(),
10
10
 
11
11
  /**
12
12
  * Whether to include Mullvad DNS servers in the peer configuration.
13
13
  */
14
- includeDns: Type.Default(Type.Boolean(), true),
14
+ includeDns: z.boolean().default(true),
15
15
  },
16
16
 
17
17
  inputs: {
@@ -36,9 +36,9 @@ export const peer = defineUnit({
36
36
  },
37
37
 
38
38
  meta: {
39
- displayName: "Mullvad Peer",
39
+ title: "Mullvad Peer",
40
40
  description: "The Mullvad WireGuard peer fetched from the Mullvad API.",
41
- primaryIcon: "simple-icons:mullvad",
41
+ icon: "simple-icons:mullvad",
42
42
  secondaryIcon: "cib:wireguard",
43
43
  secondaryIconColor: "#88171a",
44
44
  category: "VPN",