@highstate/library 0.9.19 → 0.9.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highstate/library",
3
- "version": "0.9.19",
3
+ "version": "0.9.21",
4
4
  "type": "module",
5
5
  "highstate": {
6
6
  "type": "library"
@@ -19,15 +19,20 @@
19
19
  "access": "public"
20
20
  },
21
21
  "scripts": {
22
- "build": "highstate build"
22
+ "build": "highstate build",
23
+ "typecheck": "tsgo --noEmit --skipLibCheck",
24
+ "biome": "biome check --write --unsafe --error-on-warnings",
25
+ "biome:check": "biome check --error-on-warnings"
23
26
  },
24
27
  "dependencies": {
25
- "@highstate/contract": "^0.9.19",
28
+ "@highstate/contract": "^0.9.21",
26
29
  "remeda": "^2.21.0"
27
30
  },
28
31
  "devDependencies": {
29
- "@highstate/cli": "^0.9.19",
32
+ "@biomejs/biome": "2.2.0",
33
+ "@highstate/cli": "^0.9.21",
34
+ "@typescript/native-preview": "^7.0.0-dev.20250920.1",
30
35
  "type-fest": "^4.41.0"
31
36
  },
32
- "gitHead": "e77d292335556c6e5b6275acda1a3d1609d786a1"
37
+ "gitHead": "390ff15c0e0076822a682f9d4e19260942a8d6c2"
33
38
  }
@@ -1,3 +1,4 @@
1
1
  export * as cloudflare from "./cloudflare"
2
2
  export * as mullvad from "./mullvad"
3
3
  export * as timeweb from "./timeweb"
4
+ export * as yandex from "./yandex"
@@ -0,0 +1,211 @@
1
+ import { defineEntity, defineUnit, z } from "@highstate/contract"
2
+ import { serverOutputs, vmSecrets, vmSshArgs } from "../common"
3
+ import { ipv4PrefixSchema, ipv46Schema } from "../network"
4
+ import * as ssh from "../ssh"
5
+
6
+ export const cloudEntity = defineEntity({
7
+ type: "yandex.cloud.v1",
8
+
9
+ schema: z.object({
10
+ token: z.string().optional(),
11
+ serviceAccountKeyFile: z.string().optional(),
12
+ cloudId: z.string(),
13
+ defaultFolderId: z.string(),
14
+ defaultZone: z.string(),
15
+ regionId: z.string().optional(),
16
+ }),
17
+
18
+ meta: {
19
+ color: "#0080ff",
20
+ },
21
+ })
22
+
23
+ /**
24
+ * The connection to a Yandex Cloud account.
25
+ */
26
+ export const connection = defineUnit({
27
+ type: "yandex.connection.v1",
28
+
29
+ args: {
30
+ /**
31
+ * The availability zone for resources.
32
+ */
33
+ defaultZone: z.string().default("ru-central1-d"),
34
+
35
+ /**
36
+ * The region ID for resources.
37
+ */
38
+ regionId: z.string().default("ru-central1"),
39
+ },
40
+
41
+ secrets: {
42
+ /**
43
+ * The service account key file content (JSON).
44
+ */
45
+ serviceAccountKeyFile: {
46
+ schema: z.string().meta({ language: "json" }),
47
+ meta: {
48
+ title: "Service Account Key File",
49
+ },
50
+ },
51
+ },
52
+
53
+ inputs: {
54
+ ...ssh.inputs,
55
+ },
56
+
57
+ outputs: {
58
+ /**
59
+ * The Yandex Cloud connection.
60
+ */
61
+ yandexCloud: cloudEntity,
62
+ },
63
+
64
+ meta: {
65
+ title: "Yandex Cloud Connection",
66
+ category: "Yandex Cloud",
67
+ icon: "simple-icons:yandexcloud",
68
+ iconColor: "#0080ff",
69
+ },
70
+
71
+ source: {
72
+ package: "@highstate/yandex",
73
+ path: "connection",
74
+ },
75
+ })
76
+
77
+ /**
78
+ * The virtual machine on Yandex Cloud.
79
+ */
80
+ export const virtualMachine = defineUnit({
81
+ type: "yandex.virtual-machine.v1",
82
+
83
+ args: {
84
+ /**
85
+ * The platform ID for the instance.
86
+ */
87
+ platformId: z.string().default("standard-v3"),
88
+
89
+ /**
90
+ * The resources to allocate to the virtual machine.
91
+ */
92
+ resources: z
93
+ .object({
94
+ /**
95
+ * The number of CPU cores.
96
+ */
97
+ cores: z.number().default(2),
98
+
99
+ /**
100
+ * The amount of memory in GB.
101
+ */
102
+ memory: z.number().default(4),
103
+
104
+ /**
105
+ * The core fraction (10-100).
106
+ */
107
+ coreFraction: z.number().min(10).max(100).optional(),
108
+ })
109
+ .prefault({}),
110
+
111
+ /**
112
+ * The boot disk configuration.
113
+ */
114
+ disk: z
115
+ .object({
116
+ /**
117
+ * The disk size in GB.
118
+ *
119
+ * For `network-ssd-nonreplicated` must be multiple of 93.
120
+ */
121
+ size: z.number().default(20),
122
+
123
+ /**
124
+ * The disk type.
125
+ */
126
+ type: z.string().default("network-ssd-nonreplicated"),
127
+
128
+ /**
129
+ * The image family to use.
130
+ */
131
+ imageFamily: z.string().default("ubuntu-2204-lts"),
132
+ })
133
+ .prefault({}),
134
+
135
+ /**
136
+ * The network configuration.
137
+ */
138
+ network: z
139
+ .object({
140
+ /**
141
+ * The subnet ID to connect to.
142
+ * If not specified, will auto-discover the default subnet for the zone.
143
+ */
144
+ subnetId: z.string().optional(),
145
+
146
+ /**
147
+ * Whether to assign a public IP.
148
+ */
149
+ assignPublicIp: z.boolean().default(true),
150
+
151
+ /**
152
+ * The list of DNS servers.
153
+ */
154
+ dns: ipv46Schema.array().default([]),
155
+ })
156
+ .prefault({}),
157
+
158
+ /**
159
+ * The IPv4 address configuration.
160
+ */
161
+ ipv4: z
162
+ .discriminatedUnion("type", [
163
+ z.object({
164
+ type: z.literal("dhcp"),
165
+ }),
166
+ z.object({
167
+ type: z.literal("static"),
168
+ address: z.string(),
169
+ prefix: ipv4PrefixSchema.default(24),
170
+ gateway: z.string().optional(),
171
+ }),
172
+ ])
173
+ .default({ type: "dhcp" }),
174
+
175
+ /**
176
+ * The SSH configuration.
177
+ */
178
+ ssh: vmSshArgs,
179
+
180
+ /**
181
+ * Additional metadata for cloud-init.
182
+ */
183
+ metadata: z.record(z.string(), z.string()).default({}),
184
+ },
185
+
186
+ secrets: {
187
+ ...vmSecrets,
188
+ },
189
+
190
+ inputs: {
191
+ yandexCloud: cloudEntity,
192
+ ...ssh.inputs,
193
+ },
194
+
195
+ outputs: serverOutputs,
196
+
197
+ meta: {
198
+ title: "Yandex Cloud Virtual Machine",
199
+ category: "Yandex Cloud",
200
+ icon: "simple-icons:yandexcloud",
201
+ iconColor: "#0080ff",
202
+ secondaryIcon: "codicon:vm",
203
+ },
204
+
205
+ source: {
206
+ package: "@highstate/yandex",
207
+ path: "virtual-machine",
208
+ },
209
+ })
210
+
211
+ export type Cloud = z.infer<typeof cloudEntity.schema>
package/src/wireguard.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { defineEntity, defineUnit, z } from "@highstate/contract"
2
2
  import { omit } from "remeda"
3
3
  import { serverEntity } from "./common/server"
4
- import { exposableWorkloadEntity, networkInterfaceEntity } from "./k8s"
4
+ import { clusterEntity, exposableWorkloadEntity, networkInterfaceEntity } from "./k8s"
5
5
  import { l3EndpointEntity, l4EndpointEntity } from "./network"
6
- import { clusterEntity } from "./k8s"
7
6
  import { arrayPatchModeSchema } from "./utils"
8
7
 
9
8
  export const backendSchema = z.enum(["wireguard", "amneziawg"])