recess-cli 3.56.0 → 3.58.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.
package/dist/cli.js CHANGED
@@ -26,6 +26,7 @@ import { runFamilyCommand, runKidCommand, runMeCommand, } from "./commands/famil
26
26
  import { runStudentsTextsCommand, runUsersPhoneCommand, runUsersTextCommand, runStudentsTextParentCommand, } from "./commands/phone-and-texts.js";
27
27
  import { hasCommunityHour, runUsersCommunityHourCommand, } from "./commands/community-hour.js";
28
28
  import { runUsersBirthdayCommand } from "./commands/birthday.js";
29
+ import { runUsersHostMultipleCommand } from "./commands/host-multiple.js";
29
30
  import { runTuitionPlansCommand } from "./commands/tuition-plans.js";
30
31
  import { runTuitionCommand } from "./commands/tuition.js";
31
32
  import { runReportsCommand } from "./commands/reports.js";
@@ -3527,6 +3528,9 @@ export async function executeRecessCommand(argv, options = {}) {
3527
3528
  if (noun === "users" && verb === "community-hour") {
3528
3529
  return runUsersCommunityHourCommand({ parsed, api, writeCommand });
3529
3530
  }
3531
+ if (noun === "users" && verb === "host-multiple") {
3532
+ return runUsersHostMultipleCommand({ parsed, api, writeCommand });
3533
+ }
3530
3534
  if (noun === "users" && verb === "get") {
3531
3535
  const userId = positional(parsed, 2, "user ID");
3532
3536
  return unwrap(await api.client.GET("/admin/users/{userId}", {
@@ -0,0 +1,43 @@
1
+ import { unwrap } from "../api.js";
2
+ import { CliError } from "../errors.js";
3
+ import { positional } from "./shared.js";
4
+ const HOST_MULTIPLE_ROLE = "recess:host-multiple";
5
+ /**
6
+ * `users host-multiple get|grant|revoke` — whether someone may host more than
7
+ * one group at a time (the `recess:host-multiple` access role). One person per
8
+ * run; the server's PATCH is a set-to, so a rerun is harmless.
9
+ */
10
+ export async function runUsersHostMultipleCommand({ parsed, api, writeCommand, }) {
11
+ const action = positional(parsed, 2, "users host-multiple action");
12
+ if (!["get", "grant", "revoke"].includes(action)) {
13
+ throw new CliError("invalid_arguments", "Use users host-multiple get|grant|revoke.");
14
+ }
15
+ const userId = positional(parsed, 3, "user ID");
16
+ const { user } = unwrap(await api.client.GET("/admin/users/{userId}", {
17
+ params: { path: { userId } },
18
+ }));
19
+ const current = {
20
+ userId: user.id,
21
+ name: [user.firstName, user.lastName].filter(Boolean).join(" "),
22
+ role: user.role,
23
+ canHostMultiple: (user.accessRoles ?? []).some((role) => role.name === HOST_MULTIPLE_ROLE),
24
+ };
25
+ if (action === "get")
26
+ return current;
27
+ const enabled = action === "grant";
28
+ return writeCommand(parsed, {
29
+ action: enabled
30
+ ? "let this person host more than one group at a time on Events. Their other access and restrictions are unchanged"
31
+ : "put this person back on the one-group-at-a-time limit on Events. Groups they already posted stay up; their other access and restrictions are unchanged",
32
+ target: { userId: user.id },
33
+ request: { enabled },
34
+ details: { current, canHostMultipleAfter: enabled },
35
+ }, async () => {
36
+ unwrap(await api.client.PATCH("/admin/users/{userId}/host-multiple", {
37
+ params: { path: { userId: user.id } },
38
+ body: { enabled },
39
+ }));
40
+ return { ...current, canHostMultiple: enabled };
41
+ });
42
+ }
43
+ //# sourceMappingURL=host-multiple.js.map
@@ -329,6 +329,9 @@ export async function runTuitionCommand({ parsed, api, writeCommand, }) {
329
329
  };
330
330
  });
331
331
  const note = textFlag(parsed, "note");
332
+ const annualCents = centsFlag(parsed, "annual");
333
+ const startDate = dateFlag(parsed, "start");
334
+ const endDate = dateFlag(parsed, "end");
332
335
  const body = {
333
336
  kidUserId,
334
337
  institutionSlug: textFlag(parsed, "school") ?? "recess-academy",
@@ -339,6 +342,9 @@ export async function runTuitionCommand({ parsed, api, writeCommand, }) {
339
342
  defaultCollection,
340
343
  installments,
341
344
  ...(note ? { note } : {}),
345
+ ...(annualCents !== undefined ? { annualTuitionCents: annualCents } : {}),
346
+ ...(startDate ? { startDate } : {}),
347
+ ...(endDate ? { endDate } : {}),
342
348
  };
343
349
  const { preview } = unwrap(await api.client.POST("/admin/tuition-billing/", {
344
350
  body: { ...body, dryRun: true },
@@ -435,6 +441,28 @@ export async function runTuitionCommand({ parsed, api, writeCommand, }) {
435
441
  on: "on",
436
442
  off: "off",
437
443
  });
444
+ const enrollmentType = choiceFlag(parsed, "enrollment", {
445
+ direct: "DIRECT",
446
+ "partner-school": "PARTNER_SCHOOL",
447
+ program: "PROGRAM",
448
+ });
449
+ const partnerSlug = textFlag(parsed, "partner-school");
450
+ const annualCents = centsFlag(parsed, "annual");
451
+ const startDate = dateFlag(parsed, "start");
452
+ const endRaw = flagString(parsed, "end")?.trim();
453
+ const endDate = endRaw === "none" ? null : dateFlag(parsed, "end");
454
+ const term = annualCents !== undefined || startDate || endRaw !== undefined
455
+ ? {
456
+ ...(annualCents !== undefined
457
+ ? { annualTuitionCents: annualCents }
458
+ : {}),
459
+ ...(startDate ? { startDate } : {}),
460
+ ...(endRaw !== undefined ? { endDate } : {}),
461
+ }
462
+ : null;
463
+ if (enrollmentType === "PARTNER_SCHOOL" && !partnerSlug) {
464
+ throw new CliError("invalid_arguments", "--enrollment partner-school needs --partner-school <slug>.");
465
+ }
438
466
  const body = verb === "pause"
439
467
  ? { paused: true, ...(note ? { pausedNote: note } : {}) }
440
468
  : verb === "resume"
@@ -443,16 +471,27 @@ export async function runTuitionCommand({ parsed, api, writeCommand, }) {
443
471
  ...(payer ? { payer } : {}),
444
472
  ...(defaultCollection ? { defaultCollection } : {}),
445
473
  ...(auto ? { autoInvoice: auto === "on" } : {}),
474
+ ...(term ? { term } : {}),
475
+ ...(enrollmentType
476
+ ? {
477
+ enrollment: {
478
+ type: enrollmentType,
479
+ ...(enrollmentType === "PARTNER_SCHOOL"
480
+ ? { partnerSchoolSlug: partnerSlug }
481
+ : {}),
482
+ },
483
+ }
484
+ : {}),
446
485
  };
447
486
  if (Object.keys(body).length === 0) {
448
- throw new CliError("invalid_arguments", "Nothing to change. Use --payer family|az-esa|fl-scholarship|partner-school, --collection invoice|auto-charge|out-of-band, or --auto-invoice on|off.");
487
+ throw new CliError("invalid_arguments", "Nothing to change. Use --payer family|az-esa|fl-scholarship|partner-school, --collection invoice|auto-charge|out-of-band, --auto-invoice on|off, --enrollment direct|partner-school|program, or --annual/--start/--end.");
449
488
  }
450
489
  return writeCommand(parsed, {
451
490
  action: verb === "pause"
452
491
  ? `pause tuition schedule ${scheduleId}: nothing on it is drafted or sent while paused`
453
492
  : verb === "resume"
454
493
  ? `resume tuition schedule ${scheduleId}`
455
- : `change tuition schedule ${scheduleId}'s settings${"autoInvoice" in body ? ` (automatic invoicing ${body.autoInvoice ? "ON: the daily run drafts, sends and chases its invoices" : "OFF"})` : ""}`,
494
+ : `change tuition schedule ${scheduleId}'s settings${"autoInvoice" in body ? ` (automatic invoicing ${body.autoInvoice ? "ON: the daily run drafts, sends and chases its invoices" : "OFF"})` : ""}${"enrollment" in body && body.enrollment ? ` (enrollment → ${body.enrollment.type}${body.enrollment.type === "PARTNER_SCHOOL" ? ` ${partnerSlug}` : ""})` : ""}`,
456
495
  target: { scheduleId },
457
496
  request: body,
458
497
  }, async () => shown(unwrap(await api.client.PATCH("/admin/tuition-billing/{scheduleId}", {
package/dist/help.js CHANGED
@@ -61,6 +61,9 @@ Usage:
61
61
  recess [--json] users community-hour get <kid-id>
62
62
  recess [--json] users community-hour unlock <kid-id> [--confirm]
63
63
  recess [--json] users community-hour lock <kid-id> [--confirm]
64
+ recess [--json] users host-multiple get <user-id>
65
+ recess [--json] users host-multiple grant <user-id> [--confirm]
66
+ recess [--json] users host-multiple revoke <user-id> [--confirm]
64
67
  recess [--json] users disable <user-id> [--whole-family] [--allow-billing] [--confirm]
65
68
  recess [--json] users restore <user-id> --role kid|guardian|guide|program [--confirm]
66
69
  recess [--json] users tier list-tiers
@@ -391,7 +394,7 @@ Usage:
391
394
  recess [--json] tuition list [--status NEEDS_REVIEW|SCHEDULED|DRAFTED|SENT|PAID|PAID_OUT_OF_BAND|VOID] [--family <family-id>] [--packet <packet-id>] [--q TEXT] [--limit N]
392
395
  recess [--json] tuition show <schedule-id>
393
396
  recess [--json] tuition edit <installment-id> [--amount DOLLARS] [--invoice-date YYYY-MM-DD] [--due-date YYYY-MM-DD] [--label TEXT] [--collection invoice|auto-charge|out-of-band|default] [--note TEXT] [--ask-family [--family-note TEXT]] [--confirm]
394
- recess [--json] tuition create --student <kid-id> --state XX --enrollment direct|partner-school|program [--partner-school <slug>] [--school <institution-slug>] [--payer family|az-esa|fl-scholarship|partner-school] [--collection invoice|auto-charge|out-of-band] --installment "LABEL|DOLLARS|INVOICE-DATE|DUE-DATE[|SERVICE-START|SERVICE-END]"... [--note TEXT] [--confirm]
397
+ recess [--json] tuition create --student <kid-id> --state XX --enrollment direct|partner-school|program [--partner-school <slug>] [--school <institution-slug>] [--payer family|az-esa|fl-scholarship|partner-school] [--collection invoice|auto-charge|out-of-band] --installment "LABEL|DOLLARS|INVOICE-DATE|DUE-DATE[|SERVICE-START|SERVICE-END]"... [--annual DOLLARS] [--start YYYY-MM-DD] [--end YYYY-MM-DD] [--note TEXT] [--confirm]
395
398
  recess [--json] tuition add <schedule-id> --label TEXT --amount DOLLARS --invoice-date YYYY-MM-DD --due-date YYYY-MM-DD [--collection invoice|auto-charge|out-of-band] [--note TEXT] [--ask-family [--family-note TEXT]] [--confirm]
396
399
  recess [--json] tuition release <installment-id> [--note TEXT] [--confirm]
397
400
  recess [--json] tuition void <installment-id> --reason TEXT [--ask-family [--family-note TEXT]] [--confirm]
@@ -408,7 +411,7 @@ Usage:
408
411
  recess [--json] tuition auto-invoice on|off (<schedule-id>... | --all) [--confirm]
409
412
  recess [--json] tuition pause <schedule-id> [--note TEXT] [--confirm]
410
413
  recess [--json] tuition resume <schedule-id> [--confirm]
411
- recess [--json] tuition set <schedule-id> [--payer family|az-esa|fl-scholarship|partner-school] [--collection invoice|auto-charge|out-of-band] [--auto-invoice on|off] [--confirm]
414
+ recess [--json] tuition set <schedule-id> [--payer family|az-esa|fl-scholarship|partner-school] [--collection invoice|auto-charge|out-of-band] [--auto-invoice on|off] [--enrollment direct|partner-school|program [--partner-school <slug>]] [--annual DOLLARS] [--start YYYY-MM-DD] [--end YYYY-MM-DD|none] [--confirm]
412
415
  recess [--json] admissions create --school <institution-slug> --enrollment direct|partner-school|program
413
416
  [--partner-school <slug|id>] --parent "First Last" --email EMAIL [--phone TEXT] --state XX
414
417
  --kid "First Last:YYYY-MM-DD[:grade]" (repeat per child) [--existing-kid USER_ID[:grade]]...
@@ -937,6 +940,11 @@ room; the Village picks the change up within about 30 seconds. "users unlock"
937
940
  does not grant it and "users lock" removes it. "users community-hour get" (or
938
941
  "users get": accessRoles contains recess:participant) is the read.
939
942
 
943
+ "users host-multiple grant|revoke" sets whether one person may host more than
944
+ one group at a time on Events (the recess:host-multiple access role). Without
945
+ it a kid or parent hosts one group until it ends; staff and Sparks are never
946
+ limited. One person per run. "users host-multiple get" is the read.
947
+
940
948
  "users disable" is the harder stop, and a different mechanism: it sets
941
949
  User.role to DISABLED, so the account stops resolving in every dashboard,
942
950
  search, chat, and todo query at the database layer, and its coherent-feed
@@ -1353,6 +1361,9 @@ export const COMMAND_SUMMARIES = {
1353
1361
  "users community-hour get": "Show whether a kid can join Community Hour.",
1354
1362
  "users community-hour unlock": "Let a kid join Community Hour and enter the Village.",
1355
1363
  "users community-hour lock": "Stop a kid joining Community Hour or the Village.",
1364
+ "users host-multiple get": "Show whether someone may host more than one group at a time.",
1365
+ "users host-multiple grant": "Let someone host more than one group at a time.",
1366
+ "users host-multiple revoke": "Put someone back on one group at a time.",
1356
1367
  "users lock": "Lock a kid's account with their guardians (removes Community Hour).",
1357
1368
  "users unlock": "Unlock a kid's account with guardians (not Community Hour); rerun = refresh.",
1358
1369
  "users disable": "Soft-disable an account or whole family (reversible; refuses live billing).",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recess-cli",
3
- "version": "3.56.0",
3
+ "version": "3.58.0",
4
4
  "description": "Safe Recess administration and family AI tools from the command line.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -46,8 +46,8 @@
46
46
  "oxlint-tsgolint": "^0.6.0",
47
47
  "typescript": "^5.9.2",
48
48
  "vitest": "^1.6.0",
49
- "@tryrecess/api-types": "0.0.0",
50
- "@tryrecess/typescript-config": "0.0.0"
49
+ "@tryrecess/typescript-config": "0.0.0",
50
+ "@tryrecess/api-types": "0.0.0"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "node node_modules/@tryrecess/typescript-config/bin/tsc-fast.mjs",