@kvbox/server 0.5.6 → 0.5.7

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.
@@ -502,6 +502,8 @@ var UsageEventsResponseSchema = z3.object({
502
502
  var ApiErrorSchema = z3.object({
503
503
  error: z3.string()
504
504
  });
505
+ var ACTIVATED_BY = ["card", "admin"];
506
+ var ActivatedBySchema = z3.enum(ACTIVATED_BY);
505
507
  var CloudUserSchema = z3.object({
506
508
  /** The handle: what hosts file boxes under (`<username>@<control plane>`). Lowercase, no `@` or `/`. */
507
509
  username: z3.string(),
@@ -510,7 +512,14 @@ var CloudUserSchema = z3.object({
510
512
  /** Login identity, unique. */
511
513
  email: z3.string(),
512
514
  role: z3.enum(["admin", "user"]),
513
- createdAt: z3.string()
515
+ createdAt: z3.string(),
516
+ /**
517
+ * False until a card is on file or an admin activates the account (#74): then only `/me` and
518
+ * `/logout` answer. Admins are never gated. A control plane older than #74 does not send these and
519
+ * gates nobody, hence the defaults: a newer CLI must still parse its answers.
520
+ */
521
+ active: z3.boolean().default(true),
522
+ activatedBy: ActivatedBySchema.nullable().default(null)
514
523
  });
515
524
  var ORG_ROLES = ["owner", "admin", "member"];
516
525
  var OrgRoleSchema = z3.enum(ORG_ROLES);
@@ -518,7 +527,10 @@ var CloudOrgSchema = z3.object({
518
527
  slug: z3.string(),
519
528
  /** Display name; the slug never changes, this may. */
520
529
  name: z3.string(),
521
- createdAt: z3.string()
530
+ createdAt: z3.string(),
531
+ /** An org pays for itself (#74): off until it has a card or an admin activates it; its boxes are 402. Defaults as on CloudUser. */
532
+ active: z3.boolean().default(true),
533
+ activatedBy: ActivatedBySchema.nullable().default(null)
522
534
  });
523
535
  var OrgMembershipSchema = CloudOrgSchema.extend({ role: OrgRoleSchema });
524
536
  var OrgMemberSchema = z3.object({
@@ -539,6 +551,32 @@ var AddMemberRequestSchema = z3.object({
539
551
  });
540
552
  var SetRoleRequestSchema = z3.object({ role: OrgRoleSchema });
541
553
  var MeResponseSchema = CloudUserSchema.extend({ orgs: z3.array(OrgMembershipSchema) });
554
+ var BalanceSchema = z3.object({
555
+ slug: z3.string(),
556
+ balance: z3.number(),
557
+ currency: z3.string(),
558
+ topUps: z3.number(),
559
+ spent: z3.number(),
560
+ /** The first moment usage counts from: the slug's first top-up; null when it has none. */
561
+ since: z3.string().nullable(),
562
+ /** 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. */
563
+ suspendedAt: z3.string().nullable().default(null)
564
+ });
565
+ var TopUpRequestSchema = z3.object({
566
+ slug: z3.string().min(1),
567
+ /** In the control plane's currency; negative corrects a mistake. */
568
+ amount: z3.number().finite(),
569
+ note: z3.string().max(200).optional()
570
+ });
571
+ var TopUpSchema = z3.object({
572
+ id: z3.string(),
573
+ slug: z3.string(),
574
+ amount: z3.number(),
575
+ currency: z3.string(),
576
+ source: z3.enum(["admin", "card", "trial"]),
577
+ note: z3.string().nullable(),
578
+ at: z3.string()
579
+ });
542
580
  var LoginRequestSchema = z3.object({
543
581
  email: z3.string().min(1),
544
582
  password: z3.string().min(1),
@@ -1162,7 +1200,7 @@ function versionOf(srcFileUrl, injected) {
1162
1200
  }
1163
1201
 
1164
1202
  // src/version.ts
1165
- var VERSION = versionOf(import.meta.url, true ? "0.5.6" : void 0);
1203
+ var VERSION = versionOf(import.meta.url, true ? "0.5.7" : void 0);
1166
1204
 
1167
1205
  // src/caller.ts
1168
1206
  import { createHash as createHash2, timingSafeEqual } from "node:crypto";