@highstate/library 0.12.0 → 0.12.1

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,6 +2046,7 @@ __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,
1919
2052
  optionalSharedArgs: () => optionalSharedArgs,
@@ -1925,6 +2058,7 @@ __export(apps_exports, {
1925
2058
  sharedSecrets: () => sharedSecrets2,
1926
2059
  syncthing: () => syncthing,
1927
2060
  traefik: () => traefik,
2061
+ valkey: () => valkey,
1928
2062
  vaultwarden: () => vaultwarden,
1929
2063
  workload: () => workload
1930
2064
  });
@@ -2220,6 +2354,9 @@ var sharedInputs2 = $inputs({
2220
2354
  },
2221
2355
  mongodb: {
2222
2356
  entity: mongodbEntity
2357
+ },
2358
+ redis: {
2359
+ entity: redisEntity
2223
2360
  }
2224
2361
  });
2225
2362
  var optionalSharedInputs = mapValues(sharedInputs2, (input) => ({
@@ -2386,7 +2523,7 @@ var maybe = defineUnit({
2386
2523
  secretKey: z.string().optional()
2387
2524
  },
2388
2525
  inputs: {
2389
- ...pick(sharedInputs2, ["k8sCluster", "accessPoint", "postgresql"]),
2526
+ ...pick(sharedInputs2, ["k8sCluster", "accessPoint", "postgresql", "redis"]),
2390
2527
  ...pick(optionalSharedInputs, ["resticRepo"])
2391
2528
  },
2392
2529
  meta: {
@@ -2397,6 +2534,68 @@ var maybe = defineUnit({
2397
2534
  },
2398
2535
  source: source("maybe")
2399
2536
  });
2537
+ var minioSecrets = $secrets({
2538
+ /**
2539
+ * The secret key used to authenticate with MinIO.
2540
+ */
2541
+ secretKey: $addArgumentDescription(z.string().optional(), `The secret key used to authenticate with MinIO.`),
2542
+ /**
2543
+ * The key that protects Restic backups.
2544
+ */
2545
+ backupKey: $addArgumentDescription(z.string().optional(), `The key that protects Restic backups.`)
2546
+ });
2547
+ var minio = defineUnit({
2548
+ type: "k8s.apps.minio.v1",
2549
+ args: {
2550
+ ...appName("minio"),
2551
+ ...pick(sharedArgs2, ["external"]),
2552
+ accessKey: {
2553
+ schema: z.string().default("admin"),
2554
+ meta: {
2555
+ description: text`
2556
+ The access key used to authenticate with MinIO.
2557
+ If not provided, defaults to "admin".
2558
+ `
2559
+ }
2560
+ },
2561
+ region: {
2562
+ schema: z.string().optional(),
2563
+ meta: {
2564
+ description: text`The region associated with the MinIO deployment.`
2565
+ }
2566
+ },
2567
+ buckets: {
2568
+ schema: s3BucketSchema.array().default([]),
2569
+ meta: {
2570
+ description: text`
2571
+ The buckets that must exist on the MinIO instance.
2572
+ Each entry can optionally include a bucket policy: none, download, upload, or public.
2573
+ `
2574
+ }
2575
+ }
2576
+ },
2577
+ secrets: minioSecrets,
2578
+ inputs: {
2579
+ ...pick(sharedInputs2, ["k8sCluster"]),
2580
+ ...pick(optionalSharedInputs, ["resticRepo"])
2581
+ },
2582
+ outputs: {
2583
+ s3: s3Entity,
2584
+ service: serviceEntity,
2585
+ endpoints: {
2586
+ entity: l4EndpointEntity,
2587
+ multiple: true
2588
+ }
2589
+ },
2590
+ meta: {
2591
+ description: `The MinIO object storage deployed on Kubernetes.`,
2592
+ title: "MinIO",
2593
+ icon: "simple-icons:minio",
2594
+ secondaryIcon: "mdi:bucket",
2595
+ category: "Databases"
2596
+ },
2597
+ source: source("minio/app")
2598
+ });
2400
2599
  var mongodb = defineUnit({
2401
2600
  type: "k8s.apps.mongodb.v1",
2402
2601
  args: {
@@ -2564,7 +2763,14 @@ var traefik = defineUnit({
2564
2763
  args: {
2565
2764
  ...appName("traefik"),
2566
2765
  ...pick(sharedArgs2, ["external", "replicas", "endpoints"]),
2567
- className: z.string().optional()
2766
+ /**
2767
+ * The name of the class to configure for ingress and gateway resources.
2768
+ *
2769
+ * Defaults to "traefik".
2770
+ */
2771
+ className: $addArgumentDescription(z.string().default("traefik"), `The name of the class to configure for ingress and gateway resources.
2772
+
2773
+ Defaults to "traefik".`)
2568
2774
  },
2569
2775
  inputs: {
2570
2776
  ...pick(sharedInputs2, ["k8sCluster"])
@@ -2585,6 +2791,36 @@ var traefik = defineUnit({
2585
2791
  },
2586
2792
  source: source("traefik")
2587
2793
  });
2794
+ var valkey = defineUnit({
2795
+ type: "k8s.apps.valkey.v1",
2796
+ args: {
2797
+ ...appName("valkey"),
2798
+ ...pick(sharedArgs2, ["external"])
2799
+ },
2800
+ secrets: {
2801
+ ...pick(sharedSecrets2, ["backupKey"])
2802
+ },
2803
+ inputs: {
2804
+ ...pick(sharedInputs2, ["k8sCluster"]),
2805
+ ...pick(optionalSharedInputs, ["resticRepo"])
2806
+ },
2807
+ outputs: {
2808
+ redis: databases_exports.redisEntity,
2809
+ service: serviceEntity,
2810
+ endpoints: {
2811
+ entity: l4EndpointEntity,
2812
+ multiple: true
2813
+ }
2814
+ },
2815
+ meta: {
2816
+ description: `The Valkey instance deployed on Kubernetes.`,
2817
+ title: "Valkey (Redis)",
2818
+ icon: "simple-icons:redis",
2819
+ secondaryIcon: "mdi:database",
2820
+ category: "Databases"
2821
+ },
2822
+ source: source("valkey/app")
2823
+ });
2588
2824
  var vaultwarden = defineUnit({
2589
2825
  type: "k8s.apps.vaultwarden.v1",
2590
2826
  args: {
@@ -3664,6 +3900,14 @@ var existingImage = defineUnit({
3664
3900
  var virtualMachine = defineUnit({
3665
3901
  type: "proxmox.virtual-machine.v1",
3666
3902
  args: {
3903
+ /**
3904
+ * The name of the virtual machine.
3905
+ *
3906
+ * If not specified, the unit name will be used.
3907
+ */
3908
+ vmName: $addArgumentDescription(z.string().optional(), `The name of the virtual machine.
3909
+
3910
+ If not specified, the unit name will be used.`),
3667
3911
  /**
3668
3912
  * The name of the node to create the virtual machine on.
3669
3913
  *
@@ -4810,6 +5054,14 @@ var connection3 = defineUnit({
4810
5054
  var virtualMachine2 = defineUnit({
4811
5055
  type: "timeweb.virtual-machine.v1",
4812
5056
  args: {
5057
+ /**
5058
+ * The name of the virtual machine.
5059
+ *
5060
+ * If not provided, the name of the unit will be used.
5061
+ */
5062
+ vmName: $addArgumentDescription(z.string().optional(), `The name of the virtual machine.
5063
+
5064
+ If not provided, the name of the unit will be used.`),
4813
5065
  /**
4814
5066
  * The ID of the preset to use for the virtual machine.
4815
5067
  *
@@ -5165,7 +5417,19 @@ var virtualMachine3 = defineUnit({
5165
5417
  /**
5166
5418
  * Whether to assign a public IP.
5167
5419
  */
5168
- assignPublicIp: z.boolean().default(true).meta({ title: camelCaseToHumanReadable("assignPublicIp"), description: `Whether to assign a public IP.` })
5420
+ assignPublicIp: z.boolean().default(true).meta({ title: camelCaseToHumanReadable("assignPublicIp"), description: `Whether to assign a public IP.` }),
5421
+ /**
5422
+ * Whether to reserve the public IP permanently.
5423
+ *
5424
+ * If not set, the public IP can be changed when the VM is stopped and started again.
5425
+ *
5426
+ * Makes no sense if `assignPublicIp` is false.
5427
+ */
5428
+ reservePublicIp: z.boolean().default(true).meta({ title: camelCaseToHumanReadable("reservePublicIp"), description: `Whether to reserve the public IP permanently.
5429
+
5430
+ If not set, the public IP can be changed when the VM is stopped and started again.
5431
+
5432
+ Makes no sense if \`assignPublicIp\` is false.` })
5169
5433
  }).prefault({}), `The network configuration.`),
5170
5434
  /**
5171
5435
  * The SSH configuration.