@highstate/library 0.12.0 → 0.13.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.
Binary file
package/dist/index.js CHANGED
@@ -1149,9 +1149,15 @@ __export(databases_exports, {
1149
1149
  existingMariadb: () => existingMariadb,
1150
1150
  existingMongodb: () => existingMongodb,
1151
1151
  existingPostgresql: () => existingPostgresql,
1152
+ existingRedis: () => existingRedis,
1153
+ existingS3: () => existingS3,
1152
1154
  mariadbEntity: () => mariadbEntity,
1153
1155
  mongodbEntity: () => mongodbEntity,
1154
1156
  postgresqlEntity: () => postgresqlEntity,
1157
+ redisEntity: () => redisEntity,
1158
+ s3BucketPolicySchema: () => s3BucketPolicySchema,
1159
+ s3BucketSchema: () => s3BucketSchema,
1160
+ s3Entity: () => s3Entity,
1155
1161
  sharedArgs: () => sharedArgs,
1156
1162
  sharedInputs: () => sharedInputs,
1157
1163
  sharedSchema: () => sharedSchema,
@@ -1295,6 +1301,132 @@ var existingPostgresql = defineUnit({
1295
1301
  category: "Databases"
1296
1302
  }
1297
1303
  });
1304
+ var redisEntity = defineEntity({
1305
+ type: "databases.redis.v1",
1306
+ schema: sharedSchema.pick({ endpoints: true }).extend({
1307
+ /**
1308
+ * The number of the database to use.
1309
+ */
1310
+ database: z.number().default(0)
1311
+ }),
1312
+ meta: {
1313
+ description: `Represents the Redis database or virtual database behind it.`,
1314
+ color: "#dc382d"
1315
+ }
1316
+ });
1317
+ var existingRedis = defineUnit({
1318
+ type: "databases.redis.existing.v1",
1319
+ args: sharedArgs,
1320
+ inputs: sharedInputs,
1321
+ outputs: {
1322
+ redis: redisEntity
1323
+ },
1324
+ source: {
1325
+ package: "@highstate/common",
1326
+ path: "units/databases/existing-redis"
1327
+ },
1328
+ meta: {
1329
+ description: `The existing Redis database or virtual database behind it.`,
1330
+ title: "Existing Redis Database",
1331
+ icon: "simple-icons:redis",
1332
+ secondaryIcon: "mdi:database",
1333
+ category: "Databases"
1334
+ }
1335
+ });
1336
+ var s3BucketPolicySchema = z.enum(["none", "download", "upload", "public"]);
1337
+ var s3BucketSchema = z.object({
1338
+ /**
1339
+ * The name of the bucket.
1340
+ */
1341
+ name: z.string().meta({ title: camelCaseToHumanReadable("name"), description: `The name of the bucket.` }),
1342
+ /**
1343
+ * The optional policy applied to the bucket.
1344
+ */
1345
+ policy: s3BucketPolicySchema.optional().meta({ title: camelCaseToHumanReadable("policy"), description: `The optional policy applied to the bucket.` })
1346
+ });
1347
+ var s3Args = $args({
1348
+ /**
1349
+ * The endpoints to connect to the S3-compatible API in form of `host:port`.
1350
+ */
1351
+ endpoints: $addArgumentDescription(z.string().array().min(1), `The endpoints to connect to the S3-compatible API in form of \`host:port\`.`),
1352
+ /**
1353
+ * The access key used to authenticate against the S3-compatible API.
1354
+ */
1355
+ accessKey: $addArgumentDescription(z.string(), `The access key used to authenticate against the S3-compatible API.`),
1356
+ /**
1357
+ * The region associated with the S3-compatible deployment.
1358
+ */
1359
+ region: $addArgumentDescription(z.string().optional(), `The region associated with the S3-compatible deployment.`),
1360
+ /**
1361
+ * The buckets that must exist on the instance.
1362
+ */
1363
+ buckets: $addArgumentDescription(s3BucketSchema.array().default([]), `The buckets that must exist on the instance.`)
1364
+ });
1365
+ var s3Secrets = $secrets({
1366
+ /**
1367
+ * The secret key used to authenticate against the S3-compatible API.
1368
+ */
1369
+ secretKey: $addArgumentDescription(z.string(), `The secret key used to authenticate against the S3-compatible API.`)
1370
+ });
1371
+ var s3Inputs = $inputs({
1372
+ /**
1373
+ * The endpoints to connect to the S3-compatible API.
1374
+ */
1375
+ endpoints: $addInputDescription({
1376
+ entity: l4EndpointEntity,
1377
+ multiple: true,
1378
+ required: false
1379
+ }, `The endpoints to connect to the S3-compatible API.`)
1380
+ });
1381
+ var s3Entity = defineEntity({
1382
+ type: "databases.s3.v1",
1383
+ schema: z.object({
1384
+ /**
1385
+ * The endpoints that expose the S3-compatible API.
1386
+ */
1387
+ endpoints: l4EndpointEntity.schema.array().meta({ title: camelCaseToHumanReadable("endpoints"), description: `The endpoints that expose the S3-compatible API.` }),
1388
+ /**
1389
+ * The region associated with the object storage instance.
1390
+ */
1391
+ region: z.string().optional().meta({ title: camelCaseToHumanReadable("region"), description: `The region associated with the object storage instance.` }),
1392
+ /**
1393
+ * The access key used to authenticate against the API.
1394
+ */
1395
+ accessKey: z.string().meta({ title: camelCaseToHumanReadable("accessKey"), description: `The access key used to authenticate against the API.` }),
1396
+ /**
1397
+ * The secret key used to authenticate against the API.
1398
+ */
1399
+ secretKey: z.string().meta({ title: camelCaseToHumanReadable("secretKey"), description: `The secret key used to authenticate against the API.` }),
1400
+ /**
1401
+ * The buckets that must exist on the instance.
1402
+ */
1403
+ buckets: s3BucketSchema.array().meta({ title: camelCaseToHumanReadable("buckets"), description: `The buckets that must exist on the instance.` })
1404
+ }),
1405
+ meta: {
1406
+ description: `Represents an S3-compatible object storage endpoint.`,
1407
+ color: "#ff9900"
1408
+ }
1409
+ });
1410
+ var existingS3 = defineUnit({
1411
+ type: "databases.s3.existing.v1",
1412
+ args: s3Args,
1413
+ secrets: s3Secrets,
1414
+ inputs: s3Inputs,
1415
+ outputs: {
1416
+ s3: s3Entity
1417
+ },
1418
+ source: {
1419
+ package: "@highstate/common",
1420
+ path: "units/databases/existing-s3"
1421
+ },
1422
+ meta: {
1423
+ description: `The existing S3-compatible object storage instance.`,
1424
+ title: "Existing S3-Compatible Storage",
1425
+ icon: "simple-icons:amazons3",
1426
+ secondaryIcon: "mdi:bucket",
1427
+ category: "Databases"
1428
+ }
1429
+ });
1298
1430
 
1299
1431
  // src/distributions/index.ts
1300
1432
  var distributions_exports = {};
@@ -1914,17 +2046,22 @@ __export(apps_exports, {
1914
2046
  mariadb: () => mariadb,
1915
2047
  mariadbDatabase: () => mariadbDatabase,
1916
2048
  maybe: () => maybe,
2049
+ minio: () => minio,
1917
2050
  mongodb: () => mongodb,
1918
2051
  mongodbDatabase: () => mongodbDatabase,
2052
+ node: () => node,
1919
2053
  optionalSharedArgs: () => optionalSharedArgs,
1920
2054
  optionalSharedInputs: () => optionalSharedInputs,
1921
2055
  postgresql: () => postgresql,
1922
2056
  postgresqlDatabase: () => postgresqlDatabase,
2057
+ remnawave: () => remnawave,
2058
+ remnawaveEntity: () => remnawaveEntity,
1923
2059
  sharedArgs: () => sharedArgs2,
1924
2060
  sharedInputs: () => sharedInputs2,
1925
2061
  sharedSecrets: () => sharedSecrets2,
1926
2062
  syncthing: () => syncthing,
1927
2063
  traefik: () => traefik,
2064
+ valkey: () => valkey,
1928
2065
  vaultwarden: () => vaultwarden,
1929
2066
  workload: () => workload
1930
2067
  });
@@ -2220,6 +2357,9 @@ var sharedInputs2 = $inputs({
2220
2357
  },
2221
2358
  mongodb: {
2222
2359
  entity: mongodbEntity
2360
+ },
2361
+ redis: {
2362
+ entity: redisEntity
2223
2363
  }
2224
2364
  });
2225
2365
  var optionalSharedInputs = mapValues(sharedInputs2, (input) => ({
@@ -2386,7 +2526,7 @@ var maybe = defineUnit({
2386
2526
  secretKey: z.string().optional()
2387
2527
  },
2388
2528
  inputs: {
2389
- ...pick(sharedInputs2, ["k8sCluster", "accessPoint", "postgresql"]),
2529
+ ...pick(sharedInputs2, ["k8sCluster", "accessPoint", "postgresql", "redis"]),
2390
2530
  ...pick(optionalSharedInputs, ["resticRepo"])
2391
2531
  },
2392
2532
  meta: {
@@ -2397,6 +2537,68 @@ var maybe = defineUnit({
2397
2537
  },
2398
2538
  source: source("maybe")
2399
2539
  });
2540
+ var minioSecrets = $secrets({
2541
+ /**
2542
+ * The secret key used to authenticate with MinIO.
2543
+ */
2544
+ secretKey: $addArgumentDescription(z.string().optional(), `The secret key used to authenticate with MinIO.`),
2545
+ /**
2546
+ * The key that protects Restic backups.
2547
+ */
2548
+ backupKey: $addArgumentDescription(z.string().optional(), `The key that protects Restic backups.`)
2549
+ });
2550
+ var minio = defineUnit({
2551
+ type: "k8s.apps.minio.v1",
2552
+ args: {
2553
+ ...appName("minio"),
2554
+ ...pick(sharedArgs2, ["external"]),
2555
+ accessKey: {
2556
+ schema: z.string().default("admin"),
2557
+ meta: {
2558
+ description: text`
2559
+ The access key used to authenticate with MinIO.
2560
+ If not provided, defaults to "admin".
2561
+ `
2562
+ }
2563
+ },
2564
+ region: {
2565
+ schema: z.string().optional(),
2566
+ meta: {
2567
+ description: text`The region associated with the MinIO deployment.`
2568
+ }
2569
+ },
2570
+ buckets: {
2571
+ schema: s3BucketSchema.array().default([]),
2572
+ meta: {
2573
+ description: text`
2574
+ The buckets that must exist on the MinIO instance.
2575
+ Each entry can optionally include a bucket policy: none, download, upload, or public.
2576
+ `
2577
+ }
2578
+ }
2579
+ },
2580
+ secrets: minioSecrets,
2581
+ inputs: {
2582
+ ...pick(sharedInputs2, ["k8sCluster"]),
2583
+ ...pick(optionalSharedInputs, ["resticRepo"])
2584
+ },
2585
+ outputs: {
2586
+ s3: s3Entity,
2587
+ service: serviceEntity,
2588
+ endpoints: {
2589
+ entity: l4EndpointEntity,
2590
+ multiple: true
2591
+ }
2592
+ },
2593
+ meta: {
2594
+ description: `The MinIO object storage deployed on Kubernetes.`,
2595
+ title: "MinIO",
2596
+ icon: "simple-icons:minio",
2597
+ secondaryIcon: "mdi:bucket",
2598
+ category: "Databases"
2599
+ },
2600
+ source: source("minio/app")
2601
+ });
2400
2602
  var mongodb = defineUnit({
2401
2603
  type: "k8s.apps.mongodb.v1",
2402
2604
  args: {
@@ -2503,6 +2705,53 @@ var postgresqlDatabase = defineUnit({
2503
2705
  },
2504
2706
  source: source("postgresql/database")
2505
2707
  });
2708
+ var remnawaveEntity = defineEntity({
2709
+ type: "k8s.apps.remnawave.v1",
2710
+ schema: z.object({
2711
+ /**
2712
+ * The ID of the Remnawave instance.
2713
+ */
2714
+ instanceId: z.string().meta({ title: camelCaseToHumanReadable("instanceId"), description: `The ID of the Remnawave instance.` })
2715
+ })
2716
+ });
2717
+ var remnawave = defineUnit({
2718
+ type: "k8s.apps.remnawave.backend.v1",
2719
+ secrets: {
2720
+ jwtAuthSecret: z.string(),
2721
+ jwtApiTokensSecret: z.string()
2722
+ },
2723
+ inputs: {
2724
+ ...pick(sharedInputs2, ["k8sCluster", "accessPoint", "postgresql", "redis"]),
2725
+ ...pick(optionalSharedInputs, ["resticRepo"])
2726
+ },
2727
+ outputs: {
2728
+ remnawave: remnawaveEntity
2729
+ },
2730
+ meta: {
2731
+ description: `The Remnawave backend deployed on Kubernetes.`,
2732
+ title: "Remnawave Backend",
2733
+ icon: "mdi:waveform",
2734
+ iconColor: "#0066cc",
2735
+ category: "VPN"
2736
+ },
2737
+ source: source("remnawave/backend")
2738
+ });
2739
+ var node = defineUnit({
2740
+ type: "k8s.apps.remnawave.node.v1",
2741
+ inputs: {
2742
+ remnawave: remnawaveEntity,
2743
+ ...pick(sharedInputs2, ["k8sCluster"])
2744
+ },
2745
+ meta: {
2746
+ description: `The Remnawave node deployed on Kubernetes.`,
2747
+ title: "Remnawave Node",
2748
+ icon: "mdi:waveform",
2749
+ iconColor: "#0066cc",
2750
+ secondaryIcon: "mdi:server-network",
2751
+ category: "VPN"
2752
+ },
2753
+ source: source("remnawave/node")
2754
+ });
2506
2755
  var backupModeSchema = z.enum(["state", "full"]);
2507
2756
  var syncthing = defineUnit({
2508
2757
  type: "k8s.apps.syncthing.v1",
@@ -2564,7 +2813,14 @@ var traefik = defineUnit({
2564
2813
  args: {
2565
2814
  ...appName("traefik"),
2566
2815
  ...pick(sharedArgs2, ["external", "replicas", "endpoints"]),
2567
- className: z.string().optional()
2816
+ /**
2817
+ * The name of the class to configure for ingress and gateway resources.
2818
+ *
2819
+ * Defaults to "traefik".
2820
+ */
2821
+ className: $addArgumentDescription(z.string().default("traefik"), `The name of the class to configure for ingress and gateway resources.
2822
+
2823
+ Defaults to "traefik".`)
2568
2824
  },
2569
2825
  inputs: {
2570
2826
  ...pick(sharedInputs2, ["k8sCluster"])
@@ -2585,6 +2841,36 @@ var traefik = defineUnit({
2585
2841
  },
2586
2842
  source: source("traefik")
2587
2843
  });
2844
+ var valkey = defineUnit({
2845
+ type: "k8s.apps.valkey.v1",
2846
+ args: {
2847
+ ...appName("valkey"),
2848
+ ...pick(sharedArgs2, ["external"])
2849
+ },
2850
+ secrets: {
2851
+ ...pick(sharedSecrets2, ["backupKey"])
2852
+ },
2853
+ inputs: {
2854
+ ...pick(sharedInputs2, ["k8sCluster"]),
2855
+ ...pick(optionalSharedInputs, ["resticRepo"])
2856
+ },
2857
+ outputs: {
2858
+ redis: databases_exports.redisEntity,
2859
+ service: serviceEntity,
2860
+ endpoints: {
2861
+ entity: l4EndpointEntity,
2862
+ multiple: true
2863
+ }
2864
+ },
2865
+ meta: {
2866
+ description: `The Valkey instance deployed on Kubernetes.`,
2867
+ title: "Valkey (Redis)",
2868
+ icon: "simple-icons:redis",
2869
+ secondaryIcon: "mdi:database",
2870
+ category: "Databases"
2871
+ },
2872
+ source: source("valkey/app")
2873
+ });
2588
2874
  var vaultwarden = defineUnit({
2589
2875
  type: "k8s.apps.vaultwarden.v1",
2590
2876
  args: {
@@ -3664,6 +3950,14 @@ var existingImage = defineUnit({
3664
3950
  var virtualMachine = defineUnit({
3665
3951
  type: "proxmox.virtual-machine.v1",
3666
3952
  args: {
3953
+ /**
3954
+ * The name of the virtual machine.
3955
+ *
3956
+ * If not specified, the unit name will be used.
3957
+ */
3958
+ vmName: $addArgumentDescription(z.string().optional(), `The name of the virtual machine.
3959
+
3960
+ If not specified, the unit name will be used.`),
3667
3961
  /**
3668
3962
  * The name of the node to create the virtual machine on.
3669
3963
  *
@@ -4062,7 +4356,7 @@ __export(wireguard_exports, {
4062
4356
  identityEntity: () => identityEntity,
4063
4357
  network: () => network,
4064
4358
  networkEntity: () => networkEntity,
4065
- node: () => node,
4359
+ node: () => node2,
4066
4360
  nodeExposePolicySchema: () => nodeExposePolicySchema,
4067
4361
  nodeK8s: () => nodeK8s,
4068
4362
  peer: () => peer,
@@ -4568,7 +4862,7 @@ var nodeK8s = defineUnit({
4568
4862
  path: "node.k8s"
4569
4863
  }
4570
4864
  });
4571
- var node = defineUnit({
4865
+ var node2 = defineUnit({
4572
4866
  type: "wireguard.node.v1",
4573
4867
  args: {
4574
4868
  /**
@@ -4810,6 +5104,14 @@ var connection3 = defineUnit({
4810
5104
  var virtualMachine2 = defineUnit({
4811
5105
  type: "timeweb.virtual-machine.v1",
4812
5106
  args: {
5107
+ /**
5108
+ * The name of the virtual machine.
5109
+ *
5110
+ * If not provided, the name of the unit will be used.
5111
+ */
5112
+ vmName: $addArgumentDescription(z.string().optional(), `The name of the virtual machine.
5113
+
5114
+ If not provided, the name of the unit will be used.`),
4813
5115
  /**
4814
5116
  * The ID of the preset to use for the virtual machine.
4815
5117
  *
@@ -5165,7 +5467,19 @@ var virtualMachine3 = defineUnit({
5165
5467
  /**
5166
5468
  * Whether to assign a public IP.
5167
5469
  */
5168
- assignPublicIp: z.boolean().default(true).meta({ title: camelCaseToHumanReadable("assignPublicIp"), description: `Whether to assign a public IP.` })
5470
+ assignPublicIp: z.boolean().default(true).meta({ title: camelCaseToHumanReadable("assignPublicIp"), description: `Whether to assign a public IP.` }),
5471
+ /**
5472
+ * Whether to reserve the public IP permanently.
5473
+ *
5474
+ * If not set, the public IP can be changed when the VM is stopped and started again.
5475
+ *
5476
+ * Makes no sense if `assignPublicIp` is false.
5477
+ */
5478
+ reservePublicIp: z.boolean().default(true).meta({ title: camelCaseToHumanReadable("reservePublicIp"), description: `Whether to reserve the public IP permanently.
5479
+
5480
+ If not set, the public IP can be changed when the VM is stopped and started again.
5481
+
5482
+ Makes no sense if \`assignPublicIp\` is false.` })
5169
5483
  }).prefault({}), `The network configuration.`),
5170
5484
  /**
5171
5485
  * The SSH configuration.