@highstate/library 0.7.9 → 0.7.11

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.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "sourceHashes": {
3
- "./dist/index.js": "9e8fd106576bdc6b9bfb2d0b046e01c7eda0f428d752a27e63209a3a52c5acd7"
3
+ "./dist/index.js": "18b6ba66694ed7562b0dc266bffe004fe89874e2f494ea45ecbf2dd6f2ea754a"
4
4
  }
5
5
  }
package/dist/index.js CHANGED
@@ -9,6 +9,10 @@ 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,
15
+ script: () => script,
12
16
  serverEntity: () => serverEntity
13
17
  });
14
18
  import { defineEntity as defineEntity2, defineUnit as defineUnit2, Type as Type2 } from "@highstate/contract";
@@ -121,6 +125,69 @@ var existingServer = defineUnit2({
121
125
  path: "existing-server"
122
126
  }
123
127
  });
128
+ var script = defineUnit2({
129
+ type: "common.script",
130
+ args: {
131
+ script: Type2.String({ language: "shell" }),
132
+ updateScript: Type2.Optional(Type2.String({ language: "shell" })),
133
+ deleteScript: Type2.Optional(Type2.String({ language: "shell" }))
134
+ },
135
+ inputs: {
136
+ server: serverEntity
137
+ },
138
+ outputs: {
139
+ server: serverEntity
140
+ },
141
+ meta: {
142
+ displayName: "Shell Script",
143
+ description: "Run a shell script on the server.",
144
+ primaryIcon: "mdi:bash"
145
+ },
146
+ source: {
147
+ package: "@highstate/common",
148
+ path: "script"
149
+ }
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
+ });
124
191
 
125
192
  // src/proxmox.ts
126
193
  var proxmox_exports = {};
@@ -303,6 +370,7 @@ __export(k8s_exports, {
303
370
  servicePortSchema: () => servicePortSchema,
304
371
  serviceSpecSchema: () => serviceSpecSchema,
305
372
  serviceTypeSchema: () => serviceTypeSchema,
373
+ sharedClusterArgs: () => sharedClusterArgs,
306
374
  statefulSetEntity: () => statefulSetEntity,
307
375
  tlsIssuerEntity: () => tlsIssuerEntity
308
376
  });
@@ -401,65 +469,68 @@ var clusterEntity2 = defineEntity5({
401
469
  }
402
470
  });
403
471
  var internalIpsPolicySchema = Type5.StringEnum(["always", "public", "never"]);
404
- var existingCluster = defineUnit5({
405
- type: "k8s.existing-cluster",
406
- args: {
407
- /**
408
- * The list of external IPs of the cluster nodes allowed to be used for external access.
409
- *
410
- * If not provided, will be automatically detected by querying the cluster nodes.
411
- *
412
- * @schema
413
- */
414
- externalIps: {
415
- ...Type5.Optional(Type5.Array(Type5.String())),
416
- description: `The list of external IPs of the cluster nodes allowed to be used for external access.
472
+ var sharedClusterArgs = {
473
+ /**
474
+ * The list of external IPs of the cluster nodes allowed to be used for external access.
475
+ *
476
+ * If not provided, will be automatically detected by querying the cluster nodes.
477
+ *
478
+ * @schema
479
+ */
480
+ externalIps: {
481
+ ...Type5.Optional(Type5.Array(Type5.String())),
482
+ description: `The list of external IPs of the cluster nodes allowed to be used for external access.
417
483
 
418
484
  If not provided, will be automatically detected by querying the cluster nodes.`
419
- },
420
- /**
421
- * The policy for using internal IPs of the nodes as external IPs.
422
- *
423
- * - `always`: always use internal IPs as external IPs;
424
- * - `public`: use internal IPs as external IPs only if they are (theoretically) routable from the public internet **(default)**;
425
- * - `never`: never use internal IPs as external IPs.
426
- *
427
- * @schema
428
- */
429
- internalIpsPolicy: {
430
- ...{ ...internalIpsPolicySchema, default: "public" },
431
- description: `The policy for using internal IPs of the nodes as external IPs.
485
+ },
486
+ /**
487
+ * The policy for using internal IPs of the nodes as external IPs.
488
+ *
489
+ * - `always`: always use internal IPs as external IPs;
490
+ * - `public`: use internal IPs as external IPs only if they are (theoretically) routable from the public internet **(default)**;
491
+ * - `never`: never use internal IPs as external IPs.
492
+ *
493
+ * @schema
494
+ */
495
+ internalIpsPolicy: {
496
+ ...{ ...internalIpsPolicySchema, default: "public" },
497
+ description: `The policy for using internal IPs of the nodes as external IPs.
432
498
 
433
499
  - \`always\`: always use internal IPs as external IPs;
434
500
  - \`public\`: use internal IPs as external IPs only if they are (theoretically) routable from the public internet **(default)**;
435
501
  - \`never\`: never use internal IPs as external IPs.`
436
- },
437
- /**
438
- * The FQDN to register the cluster nodes with.
439
- *
440
- * If provided and `registerFqdn` is set to `true`, the corresponding DNS provider must be provided to set up the DNS records.
441
- *
442
- * @schema
443
- */
444
- fqdn: {
445
- ...Type5.Optional(Type5.String()),
446
- description: `The FQDN to register the cluster nodes with.
502
+ },
503
+ /**
504
+ * The FQDN to register the cluster nodes with.
505
+ *
506
+ * If provided and `registerFqdn` is set to `true`, the corresponding DNS provider must be provided to set up the DNS records.
507
+ *
508
+ * @schema
509
+ */
510
+ fqdn: {
511
+ ...Type5.Optional(Type5.String()),
512
+ description: `The FQDN to register the cluster nodes with.
447
513
 
448
514
  If provided and \`registerFqdn\` is set to \`true\`, the corresponding DNS provider must be provided to set up the DNS records.`
449
- },
450
- /**
451
- * Whether to register the cluster nodes with the provided FQDN.
452
- *
453
- * By default, `true`.
454
- *
455
- * @schema
456
- */
457
- registerFqdn: {
458
- ...Type5.Boolean({ default: true }),
459
- description: `Whether to register the cluster nodes with the provided FQDN.
515
+ },
516
+ /**
517
+ * Whether to register the cluster nodes with the provided FQDN.
518
+ *
519
+ * By default, `true`.
520
+ *
521
+ * @schema
522
+ */
523
+ registerFqdn: {
524
+ ...Type5.Boolean({ default: true }),
525
+ description: `Whether to register the cluster nodes with the provided FQDN.
460
526
 
461
527
  By default, \`true\`.`
462
- }
528
+ }
529
+ };
530
+ var existingCluster = defineUnit5({
531
+ type: "k8s.existing-cluster",
532
+ args: {
533
+ ...sharedClusterArgs
463
534
  },
464
535
  secrets: {
465
536
  /**
@@ -2031,6 +2102,9 @@ __export(k3s_exports, {
2031
2102
  import { defineUnit as defineUnit21 } from "@highstate/contract";
2032
2103
  var cluster2 = defineUnit21({
2033
2104
  type: "k3s.cluster",
2105
+ args: {
2106
+ ...sharedClusterArgs
2107
+ },
2034
2108
  inputs: {
2035
2109
  server: serverEntity
2036
2110
  },
@@ -2094,6 +2168,251 @@ var peer2 = defineUnit22({
2094
2168
  path: "peer"
2095
2169
  }
2096
2170
  });
2171
+
2172
+ // src/timeweb.ts
2173
+ var timeweb_exports = {};
2174
+ __export(timeweb_exports, {
2175
+ connection: () => connection3,
2176
+ connectionEntity: () => connectionEntity,
2177
+ virtualMachine: () => virtualMachine2
2178
+ });
2179
+ import { defineEntity as defineEntity12, defineUnit as defineUnit23, Type as Type22 } from "@highstate/contract";
2180
+ var connectionEntity = defineEntity12({
2181
+ type: "timeweb.connection",
2182
+ schema: Type22.Object({
2183
+ name: Type22.String(),
2184
+ apiToken: Type22.String()
2185
+ })
2186
+ });
2187
+ var connection3 = defineUnit23({
2188
+ type: "timeweb.connection",
2189
+ secrets: {
2190
+ apiToken: Type22.String()
2191
+ },
2192
+ outputs: {
2193
+ connection: connectionEntity
2194
+ },
2195
+ meta: {
2196
+ displayName: "Timeweb Connection",
2197
+ description: "Creates a new Timeweb connection.",
2198
+ primaryIcon: "material-symbols:cloud"
2199
+ },
2200
+ source: {
2201
+ package: "@highstate/timeweb",
2202
+ path: "connection"
2203
+ }
2204
+ });
2205
+ var virtualMachine2 = defineUnit23({
2206
+ type: "timeweb.virtual-machine",
2207
+ args: {
2208
+ presetId: Type22.Optional(Type22.Number()),
2209
+ osId: Type22.Optional(Type22.Number()),
2210
+ availabilityZone: Type22.String()
2211
+ },
2212
+ inputs: {
2213
+ connection: connectionEntity,
2214
+ sshKeyPair: {
2215
+ entity: keyPairEntity,
2216
+ required: false
2217
+ }
2218
+ },
2219
+ secrets: {
2220
+ sshPrivateKey: Type22.Optional(Type22.String())
2221
+ },
2222
+ outputs: {
2223
+ server: serverEntity
2224
+ },
2225
+ meta: {
2226
+ displayName: "Timeweb Virtual Machine",
2227
+ description: "Creates a new Timeweb virtual machine.",
2228
+ primaryIcon: "material-symbols:cloud",
2229
+ secondaryIcon: "codicon:vm"
2230
+ },
2231
+ source: {
2232
+ package: "@highstate/timeweb",
2233
+ path: "virtual-machine"
2234
+ }
2235
+ });
2236
+
2237
+ // src/nixos.ts
2238
+ var nixos_exports = {};
2239
+ __export(nixos_exports, {
2240
+ flakeEntity: () => flakeEntity,
2241
+ inlineFlake: () => inlineFlake,
2242
+ inlineModule: () => inlineModule,
2243
+ inlineModuleEntity: () => inlineModuleEntity,
2244
+ remoteFlake: () => remoteFlake,
2245
+ system: () => system
2246
+ });
2247
+ import { defineEntity as defineEntity13, defineUnit as defineUnit24, Type as Type23 } from "@highstate/contract";
2248
+ var inlineModuleEntity = defineEntity13({
2249
+ type: "nixos.inline-module",
2250
+ schema: Type23.Object({
2251
+ code: Type23.String()
2252
+ }),
2253
+ meta: {
2254
+ displayName: "NixOS Inline Module",
2255
+ description: "The NixOS module reference.",
2256
+ color: "#5277c3"
2257
+ }
2258
+ });
2259
+ var inlineModule = defineUnit24({
2260
+ type: "nixos.inline-module",
2261
+ args: {
2262
+ code: Type23.String({ language: "nix" })
2263
+ },
2264
+ inputs: {
2265
+ files: {
2266
+ entity: fileEntity,
2267
+ required: false,
2268
+ multiple: true
2269
+ }
2270
+ },
2271
+ outputs: {
2272
+ module: inlineModuleEntity
2273
+ },
2274
+ meta: {
2275
+ displayName: "NixOS Inline Module",
2276
+ description: "Creates a NixOS module from inline code.",
2277
+ primaryIcon: "simple-icons:nixos",
2278
+ primaryIconColor: "#7ebae4",
2279
+ secondaryIcon: "mdi:file-code"
2280
+ },
2281
+ source: {
2282
+ package: "@highstate/nixos",
2283
+ path: "inline-module"
2284
+ }
2285
+ });
2286
+ var flakeEntity = defineEntity13({
2287
+ type: "nixos.flake",
2288
+ schema: Type23.Object({
2289
+ url: Type23.String()
2290
+ }),
2291
+ meta: {
2292
+ displayName: "NixOS Flake",
2293
+ description: "The NixOS flake reference.",
2294
+ color: "#5277c3"
2295
+ }
2296
+ });
2297
+ var remoteFlake = defineUnit24({
2298
+ type: "nixos.remote-flake",
2299
+ args: {
2300
+ url: Type23.String()
2301
+ },
2302
+ outputs: {
2303
+ flake: flakeEntity
2304
+ },
2305
+ meta: {
2306
+ displayName: "NixOS Remote Flake",
2307
+ description: "References a remote NixOS flake.",
2308
+ primaryIcon: "simple-icons:nixos",
2309
+ primaryIconColor: "#7ebae4",
2310
+ secondaryIcon: "simple-icons:git",
2311
+ secondaryIconColor: "#f1502f"
2312
+ },
2313
+ source: {
2314
+ package: "@highstate/nixos",
2315
+ path: "flake"
2316
+ }
2317
+ });
2318
+ var inlineFlake = defineUnit24({
2319
+ type: "nixos.inline-flake",
2320
+ args: {
2321
+ code: Type23.String({ language: "nix" })
2322
+ },
2323
+ inputs: {
2324
+ flakes: {
2325
+ entity: flakeEntity,
2326
+ required: false,
2327
+ multiple: true
2328
+ },
2329
+ modules: {
2330
+ entity: inlineModuleEntity,
2331
+ required: false,
2332
+ multiple: true
2333
+ },
2334
+ files: {
2335
+ entity: fileEntity,
2336
+ required: false,
2337
+ multiple: true
2338
+ }
2339
+ },
2340
+ outputs: {
2341
+ flake: flakeEntity
2342
+ },
2343
+ meta: {
2344
+ displayName: "NixOS Inline Flake",
2345
+ description: "Creates a NixOS flake from inline code.",
2346
+ primaryIcon: "simple-icons:nixos",
2347
+ primaryIconColor: "#7ebae4",
2348
+ secondaryIcon: "mdi:file-code"
2349
+ },
2350
+ source: {
2351
+ package: "@highstate/nixos",
2352
+ path: "inline-flake"
2353
+ }
2354
+ });
2355
+ var system = defineUnit24({
2356
+ type: "nixos.system",
2357
+ args: {
2358
+ system: Type23.Optional(Type23.String())
2359
+ },
2360
+ inputs: {
2361
+ flake: flakeEntity,
2362
+ server: serverEntity,
2363
+ modules: {
2364
+ entity: inlineModuleEntity,
2365
+ required: false,
2366
+ multiple: true
2367
+ }
2368
+ },
2369
+ outputs: {
2370
+ server: serverEntity
2371
+ },
2372
+ meta: {
2373
+ displayName: "NixOS System",
2374
+ description: "Creates a NixOS system on top of any server.",
2375
+ primaryIcon: "simple-icons:nixos",
2376
+ primaryIconColor: "#7ebae4",
2377
+ secondaryIcon: "codicon:vm"
2378
+ },
2379
+ source: {
2380
+ package: "@highstate/nixos",
2381
+ path: "system"
2382
+ }
2383
+ });
2384
+
2385
+ // src/sops.ts
2386
+ var sops_exports = {};
2387
+ __export(sops_exports, {
2388
+ secrets: () => secrets
2389
+ });
2390
+ import { defineUnit as defineUnit25, Type as Type24 } from "@highstate/contract";
2391
+ var secrets = defineUnit25({
2392
+ type: "sops.secrets",
2393
+ args: {
2394
+ secrets: Type24.Record(Type24.String(), Type24.Any())
2395
+ },
2396
+ inputs: {
2397
+ servers: {
2398
+ entity: serverEntity,
2399
+ required: false,
2400
+ multiple: true
2401
+ }
2402
+ },
2403
+ outputs: {
2404
+ file: fileEntity
2405
+ },
2406
+ meta: {
2407
+ displayName: "SOPS Secrets",
2408
+ description: "Encrypts secrets using SOPS for the specified servers.",
2409
+ primaryIcon: "mdi:file-lock"
2410
+ },
2411
+ source: {
2412
+ package: "@highstate/sops",
2413
+ path: "secrets"
2414
+ }
2415
+ });
2097
2416
  export {
2098
2417
  apps_exports as apps,
2099
2418
  cloudflare_exports as cloudflare,
@@ -2102,10 +2421,13 @@ export {
2102
2421
  k3s_exports as k3s,
2103
2422
  k8s_exports as k8s,
2104
2423
  mullvad_exports as mullvad,
2424
+ nixos_exports as nixos,
2105
2425
  proxmox_exports as proxmox,
2106
2426
  restic_exports as restic,
2427
+ sops_exports as sops,
2107
2428
  ssh_exports as ssh,
2108
2429
  talos_exports as talos,
2430
+ timeweb_exports as timeweb,
2109
2431
  wireguard_exports as wireguard
2110
2432
  };
2111
2433
  //# sourceMappingURL=index.js.map