@kvbox/server 0.5.45 → 0.5.47

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.
@@ -1235,6 +1235,11 @@ var CreateMachineRequest = z4.object({
1235
1235
  * `@kvbox/shared/country`. Only the control plane reads it.
1236
1236
  */
1237
1237
  country: z4.string().optional(),
1238
+ /**
1239
+ * Place the box on the host of this name and nowhere else (`kvbox new --host kvbox2`, a hidden flag):
1240
+ * an admin's, to try a host out. Only the control plane reads it, and refuses it from anyone else.
1241
+ */
1242
+ host: z4.string().optional(),
1238
1243
  /** The image to boot (#87, `kvbox new --base postgres`). Absent: the base image. */
1239
1244
  image: z4.string().optional(),
1240
1245
  /** The box's own environment variables (#87, `kvbox new -e NAME=value`), over its owner's. */
@@ -1500,7 +1505,9 @@ var CloudUserSchema = z4.object({
1500
1505
  * gates nobody, hence the defaults: a newer CLI must still parse its answers.
1501
1506
  */
1502
1507
  active: z4.boolean().default(true),
1503
- activatedBy: ActivatedBySchema.nullable().default(null)
1508
+ activatedBy: ActivatedBySchema.nullable().default(null),
1509
+ /** When too many wrong passwords locked the account (#161); null when it is not locked. Older control planes omit it. */
1510
+ lockedAt: z4.string().nullable().default(null)
1504
1511
  });
1505
1512
  var ORG_ROLES = ["owner", "admin", "member"];
1506
1513
  var OrgRoleSchema = z4.enum(ORG_ROLES);
@@ -1538,10 +1545,14 @@ var BalanceSchema = z4.object({
1538
1545
  currency: z4.string(),
1539
1546
  topUps: z4.number(),
1540
1547
  spent: z4.number(),
1541
- /** The first moment usage counts from: the slug's first top-up; null when it has none. */
1548
+ /** The first moment usage counts from: the slug's first top-up or redeemed code; null when it has none. */
1542
1549
  since: z4.string().nullable(),
1543
1550
  /** When the slug ran out and its boxes were hibernated (the `sweep-credit` job); null in good standing. Absent from a control plane older than this field. */
1544
- suspendedAt: z4.string().nullable().default(null)
1551
+ suspendedAt: z4.string().nullable().default(null),
1552
+ /** Promo credit left (#163), already counted in `balance`; 0 with none. Absent from a control plane older than this field. */
1553
+ promo: z4.number().default(0),
1554
+ /** When the next promo credit expires; null with none left. */
1555
+ promoExpiresAt: z4.string().nullable().default(null)
1545
1556
  });
1546
1557
  var TopUpRequestSchema = z4.object({
1547
1558
  slug: z4.string().min(1),
@@ -1559,6 +1570,41 @@ var TopUpSchema = z4.object({
1559
1570
  note: z4.string().nullable(),
1560
1571
  at: z4.string()
1561
1572
  });
1573
+ var CreateCodeRequestSchema = z4.object({
1574
+ /** In the control plane's currency, cents at most. */
1575
+ amount: z4.number().positive().multipleOf(0.01, "amount is in cents at most"),
1576
+ /** A day (`2026-12-11`, through the end of it, UTC) or an ISO time. The credit is gone then, and so is the code. */
1577
+ expiresAt: z4.string().min(1),
1578
+ note: z4.string().max(200).optional()
1579
+ });
1580
+ var CreditCodeSchema = z4.object({
1581
+ code: z4.string(),
1582
+ amount: z4.number(),
1583
+ currency: z4.string(),
1584
+ expiresAt: z4.string(),
1585
+ note: z4.string().nullable(),
1586
+ status: z4.enum(["unused", "redeemed", "expired", "revoked"]),
1587
+ createdBy: z4.string(),
1588
+ createdAt: z4.string(),
1589
+ /** Who redeemed it and the slug the credit went to (their own, or an org they own). */
1590
+ redeemedBy: z4.string().nullable(),
1591
+ redeemedSlug: z4.string().nullable(),
1592
+ redeemedAt: z4.string().nullable(),
1593
+ revokedAt: z4.string().nullable()
1594
+ });
1595
+ var RedeemRequestSchema = z4.object({
1596
+ code: z4.string().min(1).max(64),
1597
+ org: z4.string().min(1).optional()
1598
+ });
1599
+ var RedeemResponseSchema = z4.object({
1600
+ slug: z4.string(),
1601
+ amount: z4.number(),
1602
+ currency: z4.string(),
1603
+ expiresAt: z4.string(),
1604
+ balance: BalanceSchema,
1605
+ /** The slug was out of credit and this put it back above zero: it may start boxes again. */
1606
+ reinstated: z4.boolean()
1607
+ });
1562
1608
  var TOP_UP_AMOUNTS = [10, 25, 50, 100];
1563
1609
  var BillingInfoSchema = z4.object({
1564
1610
  card: z4.object({ brand: z4.string(), last4: z4.string() }).nullable(),
@@ -5121,7 +5167,7 @@ function versionOf(srcFileUrl, injected) {
5121
5167
  }
5122
5168
 
5123
5169
  // src/version.ts
5124
- var VERSION = versionOf(import.meta.url, true ? "0.5.45" : void 0);
5170
+ var VERSION = versionOf(import.meta.url, true ? "0.5.47" : void 0);
5125
5171
 
5126
5172
  // src/caller.ts
5127
5173
  import { createHash as createHash2, timingSafeEqual } from "node:crypto";