recess-cli 3.48.0 → 3.50.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 +8 -18
- package/dist/command-schema.js +1 -2
- package/dist/commands/birthday.js +81 -0
- package/dist/commands/family.js +10 -38
- package/dist/commands/shared.js +15 -0
- package/dist/commands/village-events.js +62 -2
- package/dist/help.js +13 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -25,6 +25,7 @@ import { runFamiliesCommand } from "./commands/families.js";
|
|
|
25
25
|
import { runFamilyCommand, runKidCommand, runMeCommand, } from "./commands/family.js";
|
|
26
26
|
import { runStudentsTextsCommand, runUsersPhoneCommand, runUsersTextCommand, runStudentsTextParentCommand, } from "./commands/phone-and-texts.js";
|
|
27
27
|
import { hasCommunityHour, runUsersCommunityHourCommand, } from "./commands/community-hour.js";
|
|
28
|
+
import { runUsersBirthdayCommand } from "./commands/birthday.js";
|
|
28
29
|
import { runTuitionPlansCommand } from "./commands/tuition-plans.js";
|
|
29
30
|
import { runReportsCommand } from "./commands/reports.js";
|
|
30
31
|
import { runMasteryCommand } from "./commands/mastery.js";
|
|
@@ -35,7 +36,7 @@ import { runFlagsCommand } from "./commands/flags.js";
|
|
|
35
36
|
import { runRockyFreeCommand } from "./commands/rocky-free.js";
|
|
36
37
|
import { runSchoolCommand } from "./commands/school.js";
|
|
37
38
|
import { runVillageEventsCommand } from "./commands/village-events.js";
|
|
38
|
-
import { assertChoice, flagIdList, positional, readJsonFile, readJsonValue, } from "./commands/shared.js";
|
|
39
|
+
import { assertChoice, flagDate, flagIdList, positional, readJsonFile, readJsonValue, } from "./commands/shared.js";
|
|
39
40
|
import { CliError } from "./errors.js";
|
|
40
41
|
import { listFeedback, submitFeedback } from "./feedback.js";
|
|
41
42
|
import { HELP } from "./help.js";
|
|
@@ -2047,20 +2048,6 @@ function flagItemDateMs(parsed) {
|
|
|
2047
2048
|
}
|
|
2048
2049
|
return ms;
|
|
2049
2050
|
}
|
|
2050
|
-
function flagDateOnly(parsed, name) {
|
|
2051
|
-
const raw = flagString(parsed, name);
|
|
2052
|
-
if (raw === undefined)
|
|
2053
|
-
return undefined;
|
|
2054
|
-
const parsedDate = /^\d{4}-\d{2}-\d{2}$/.test(raw)
|
|
2055
|
-
? new Date(`${raw}T00:00:00.000Z`)
|
|
2056
|
-
: null;
|
|
2057
|
-
if (!parsedDate ||
|
|
2058
|
-
Number.isNaN(parsedDate.getTime()) ||
|
|
2059
|
-
parsedDate.toISOString().slice(0, 10) !== raw) {
|
|
2060
|
-
throw new CliError("invalid_arguments", `--${name} must be a valid YYYY-MM-DD date.`);
|
|
2061
|
-
}
|
|
2062
|
-
return raw;
|
|
2063
|
-
}
|
|
2064
2051
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
2065
2052
|
async function waitForContentLibraryLive(api, gems, timeoutSeconds) {
|
|
2066
2053
|
const pending = new Set(gems);
|
|
@@ -2829,11 +2816,11 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
2829
2816
|
}
|
|
2830
2817
|
throw new CliError("invalid_arguments", "Use village worlds export|import|promote.");
|
|
2831
2818
|
}
|
|
2832
|
-
if (verb === "events" || verb === "link-event") {
|
|
2819
|
+
if (verb === "events" || verb === "link-event" || verb === "age-exempt") {
|
|
2833
2820
|
return runVillageEventsCommand({ parsed, api, writeCommand }, verb);
|
|
2834
2821
|
}
|
|
2835
2822
|
if (verb !== "models") {
|
|
2836
|
-
throw new CliError("invalid_arguments", "Use village build …, village library …, village objects …, village worlds …, village models …, village events, village link-event …, or village render …");
|
|
2823
|
+
throw new CliError("invalid_arguments", "Use village build …, village library …, village objects …, village worlds …, village models …, village events, village link-event …, village age-exempt …, or village render …");
|
|
2837
2824
|
}
|
|
2838
2825
|
const action = positional(parsed, 2, "Village model action");
|
|
2839
2826
|
if (action === "list") {
|
|
@@ -3270,6 +3257,9 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
3270
3257
|
if (noun === "users" && verb === "phone") {
|
|
3271
3258
|
return runUsersPhoneCommand({ parsed, api, writeCommand });
|
|
3272
3259
|
}
|
|
3260
|
+
if (noun === "users" && verb === "birthday") {
|
|
3261
|
+
return runUsersBirthdayCommand({ parsed, api, writeCommand });
|
|
3262
|
+
}
|
|
3273
3263
|
if (noun === "users" && verb === "text") {
|
|
3274
3264
|
return runUsersTextCommand({ parsed, api, writeCommand });
|
|
3275
3265
|
}
|
|
@@ -6828,7 +6818,7 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
6828
6818
|
const todoId = positional(parsed, 2, "todo ID");
|
|
6829
6819
|
const student = await studentFlag(api, parsed, { required: true });
|
|
6830
6820
|
const studentId = student.id;
|
|
6831
|
-
const targetDueDateISO =
|
|
6821
|
+
const targetDueDateISO = flagDate(parsed, "due-date");
|
|
6832
6822
|
const mode = flagString(parsed, "mode");
|
|
6833
6823
|
if (mode !== undefined &&
|
|
6834
6824
|
mode !== "game" &&
|
package/dist/command-schema.js
CHANGED
|
@@ -86,7 +86,6 @@ export const FAMILY_REMOTE_WRITES = [
|
|
|
86
86
|
"family add-guardian",
|
|
87
87
|
"family cancel-reminder",
|
|
88
88
|
"family drop-class",
|
|
89
|
-
"family feedback",
|
|
90
89
|
"family pause",
|
|
91
90
|
"family register-class",
|
|
92
91
|
"family remind",
|
|
@@ -269,7 +268,6 @@ const FAMILY_COMMANDS = new Set([
|
|
|
269
268
|
"family changes",
|
|
270
269
|
"family config",
|
|
271
270
|
"family drop-class",
|
|
272
|
-
"family feedback",
|
|
273
271
|
"family guardians",
|
|
274
272
|
"family kids",
|
|
275
273
|
"family pause",
|
|
@@ -621,6 +619,7 @@ const STAFF_COMMANDS = new Set([
|
|
|
621
619
|
"users tier list-tiers",
|
|
622
620
|
"village events",
|
|
623
621
|
"village link-event",
|
|
622
|
+
"village age-exempt",
|
|
624
623
|
]);
|
|
625
624
|
/**
|
|
626
625
|
* Classify the command itself, not the target passed to it. Target-level
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { unwrap } from "../api.js";
|
|
2
|
+
import { CliError } from "../errors.js";
|
|
3
|
+
import { flagDate, positional } from "./shared.js";
|
|
4
|
+
/** apps/web-server/src/libs/birth-window.ts MIN_AGE/MAX_AGE: the school's kid ages. */
|
|
5
|
+
const KID_AGE_WINDOW = { min: 3, max: 21 };
|
|
6
|
+
/** Whole years from `birthdate` (YYYY-MM-DD) to `today`, as `users get` counts them. */
|
|
7
|
+
function ageOn(birthdate, today) {
|
|
8
|
+
const born = new Date(`${birthdate}T00:00:00.000Z`);
|
|
9
|
+
const hadBirthday = today.getUTCMonth() > born.getUTCMonth() ||
|
|
10
|
+
(today.getUTCMonth() === born.getUTCMonth() &&
|
|
11
|
+
today.getUTCDate() >= born.getUTCDate());
|
|
12
|
+
return today.getUTCFullYear() - born.getUTCFullYear() - (hadBirthday ? 0 : 1);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `users birthday set` — staff correction of a kid's birthday, typically a
|
|
16
|
+
* year typed in the wrong century (1911 for 2011, so Recess shows age 115).
|
|
17
|
+
* The parent's `kid set-profile` only reaches the caller's own kids; this
|
|
18
|
+
* writes the same kid-config field, which the server lets an admin set on any
|
|
19
|
+
* kid, so the change keeps its provenance and lands in the family change log.
|
|
20
|
+
*/
|
|
21
|
+
export async function runUsersBirthdayCommand({ parsed, api, writeCommand, }) {
|
|
22
|
+
const action = positional(parsed, 2, "users birthday action");
|
|
23
|
+
if (action !== "set") {
|
|
24
|
+
throw new CliError("invalid_arguments", "Use users birthday set.");
|
|
25
|
+
}
|
|
26
|
+
const userId = positional(parsed, 3, "kid ID");
|
|
27
|
+
const birthdate = flagDate(parsed, "date", { required: true });
|
|
28
|
+
const age = ageOn(birthdate, new Date());
|
|
29
|
+
if (age < 0) {
|
|
30
|
+
throw new CliError("invalid_arguments", `--date ${birthdate} is in the future.`);
|
|
31
|
+
}
|
|
32
|
+
const { user } = unwrap(await api.client.GET("/admin/users/{userId}", {
|
|
33
|
+
params: { path: { userId } },
|
|
34
|
+
}));
|
|
35
|
+
const current = {
|
|
36
|
+
userId: user.id,
|
|
37
|
+
name: [user.firstName, user.lastName].filter(Boolean).join(" "),
|
|
38
|
+
role: user.role,
|
|
39
|
+
birthdate: user.birthdate?.slice(0, 10) ?? null,
|
|
40
|
+
age: user.age ?? null,
|
|
41
|
+
};
|
|
42
|
+
if (user.role !== "KID") {
|
|
43
|
+
throw new CliError("invalid_arguments", `${current.name || user.id} is a ${user.role}, not a KID. Only a kid's birthday is set here: pass the kid's user ID.`, 1, { current });
|
|
44
|
+
}
|
|
45
|
+
if (current.birthdate === birthdate) {
|
|
46
|
+
return { ...current, status: "unchanged" };
|
|
47
|
+
}
|
|
48
|
+
const warnings = age < KID_AGE_WINDOW.min || age > KID_AGE_WINDOW.max
|
|
49
|
+
? [
|
|
50
|
+
`Age ${age} is outside the school's ${KID_AGE_WINDOW.min} to ${KID_AGE_WINDOW.max} window: check the year with the family before approving.`,
|
|
51
|
+
]
|
|
52
|
+
: [];
|
|
53
|
+
return writeCommand(parsed, {
|
|
54
|
+
action: `change this kid's birthday from ${current.birthdate ?? "unset"} (age ${current.age ?? "unknown"}) to ${birthdate} (age ${age}); the family's change log shows it under your first name, and a guardian can undo it`,
|
|
55
|
+
target: { userId: user.id },
|
|
56
|
+
request: { path: "profile.birthdate", value: birthdate },
|
|
57
|
+
details: {
|
|
58
|
+
current,
|
|
59
|
+
after: { birthdate, age },
|
|
60
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
61
|
+
},
|
|
62
|
+
}, async () => {
|
|
63
|
+
const { result } = unwrap(await api.client.PATCH("/kid-config/kid/{kidId}/", {
|
|
64
|
+
params: { path: { kidId: user.id }, query: { surface: "admin" } },
|
|
65
|
+
body: { path: "profile.birthdate", value: birthdate },
|
|
66
|
+
}));
|
|
67
|
+
if (result.status === "unconfirmed") {
|
|
68
|
+
throw new CliError("write_unconfirmed", `The server accepted the change but still reads ${String(result.after)}. Re-read with users get ${user.id}.`);
|
|
69
|
+
}
|
|
70
|
+
// What the server read back, not what was sent: a concurrent edit wins.
|
|
71
|
+
const saved = typeof result.after === "string" ? result.after : null;
|
|
72
|
+
return {
|
|
73
|
+
...current,
|
|
74
|
+
birthdate: saved,
|
|
75
|
+
age: saved === null ? null : ageOn(saved, new Date()),
|
|
76
|
+
status: result.status,
|
|
77
|
+
changeId: result.changeId,
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=birthday.js.map
|
package/dist/commands/family.js
CHANGED
|
@@ -3,7 +3,7 @@ import { unwrap } from "../api.js";
|
|
|
3
3
|
import { flagString, hasFlag } from "../args.js";
|
|
4
4
|
import { apiError, CliError } from "../errors.js";
|
|
5
5
|
import { resolveStudentReference } from "../goal-authoring.js";
|
|
6
|
-
import { assertChoice, flagBooleanValue, flagIdList, flagInteger, } from "./shared.js";
|
|
6
|
+
import { assertChoice, flagBooleanValue, flagDate, flagIdList, flagInteger, } from "./shared.js";
|
|
7
7
|
// packages/web-schema COMMUNITY_HOUR_COURSE_ID: the daily coworking pods are
|
|
8
8
|
// this course's event series (apps/web `$lib/onboarding/cowork.ts`).
|
|
9
9
|
const COWORK_COURSE_ID = "b96a9f7d-7851-4506-965e-2d9babd50b11";
|
|
@@ -12,7 +12,6 @@ const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
|
12
12
|
const DEFAULT_SUMMARY_SEND_HOUR = 18;
|
|
13
13
|
// lesson-notes.ts LESSON_NOTE_MAX_CHARS: the server's goal-note cap.
|
|
14
14
|
const GOAL_NOTE_MAX_CHARS = 2000;
|
|
15
|
-
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
16
15
|
const FEED_LOCK_MODES = [
|
|
17
16
|
"ALL_DAILY_TODOS",
|
|
18
17
|
"SELECTED_GOALS",
|
|
@@ -83,15 +82,6 @@ function redactedSecret(secret) {
|
|
|
83
82
|
.slice(0, 12),
|
|
84
83
|
};
|
|
85
84
|
}
|
|
86
|
-
function flagDate(parsed, name) {
|
|
87
|
-
const value = flagString(parsed, name);
|
|
88
|
-
if (value !== undefined &&
|
|
89
|
-
(!DATE.test(value) ||
|
|
90
|
-
new Date(`${value}T00:00:00.000Z`).toISOString().slice(0, 10) !== value)) {
|
|
91
|
-
throw new CliError("invalid_arguments", `--${name} must be a valid YYYY-MM-DD date.`);
|
|
92
|
-
}
|
|
93
|
-
return value;
|
|
94
|
-
}
|
|
95
85
|
function flagUuid(parsed, name, options = {}) {
|
|
96
86
|
const value = flagString(parsed, name, options);
|
|
97
87
|
if (value !== undefined && !UUID.test(value)) {
|
|
@@ -737,29 +727,6 @@ export async function runFamilyCommand({ parsed, api, writeCommand, }) {
|
|
|
737
727
|
body: { path: raw, value },
|
|
738
728
|
})), {}));
|
|
739
729
|
}
|
|
740
|
-
if (verb === "feedback") {
|
|
741
|
-
const kind = assertChoice(flagString(parsed, "kind", { required: true }).trim().toLowerCase(), ["wrong", "too-much", "wanted", "loved", "cant-do", "other"], "--kind");
|
|
742
|
-
const quote = flagString(parsed, "quote", { required: true }).trim();
|
|
743
|
-
if (!quote)
|
|
744
|
-
throw new CliError("invalid_arguments", "--quote cannot be empty.");
|
|
745
|
-
const about = flagString(parsed, "about")?.trim();
|
|
746
|
-
const kid = hasFlag(parsed, "student")
|
|
747
|
-
? await resolveFamilyKid(api, parsed)
|
|
748
|
-
: undefined;
|
|
749
|
-
const body = {
|
|
750
|
-
kind,
|
|
751
|
-
quote: quote.slice(0, 2000),
|
|
752
|
-
...(about ? { about: about.slice(0, 200) } : {}),
|
|
753
|
-
...(kid ? { studentId: kid.id } : {}),
|
|
754
|
-
};
|
|
755
|
-
// Not a change to the family: nothing to undo, so no confirm.
|
|
756
|
-
return writeNow(parsed, {
|
|
757
|
-
action: `pass on your feedback (${kind})`,
|
|
758
|
-
target: { user: "@me", ...(kid ? kidTarget(kid) : {}) },
|
|
759
|
-
request: body,
|
|
760
|
-
details: { consequence: "The Recess team reads it; nothing changes." },
|
|
761
|
-
}, async () => unwrap(await api.client.POST("/parent-v2/feedback/", { body })));
|
|
762
|
-
}
|
|
763
730
|
if (verb === "pause") {
|
|
764
731
|
const kid = await resolveFamilyKid(api, parsed);
|
|
765
732
|
const pauseWeeks = flagInteger(parsed, "weeks", {
|
|
@@ -908,6 +875,10 @@ export async function runFamilyCommand({ parsed, api, writeCommand, }) {
|
|
|
908
875
|
if (verb === "report-bug") {
|
|
909
876
|
const text = flagString(parsed, "text", { required: true }).trim();
|
|
910
877
|
const summary = flagString(parsed, "summary")?.trim();
|
|
878
|
+
const rawKind = flagString(parsed, "kind")?.trim().toLowerCase();
|
|
879
|
+
const kind = rawKind
|
|
880
|
+
? assertChoice(rawKind, ["bug", "request"], "--kind")
|
|
881
|
+
: undefined;
|
|
911
882
|
const todoId = flagUuid(parsed, "todo");
|
|
912
883
|
const kid = hasFlag(parsed, "student")
|
|
913
884
|
? await resolveFamilyKid(api, parsed)
|
|
@@ -915,20 +886,21 @@ export async function runFamilyCommand({ parsed, api, writeCommand, }) {
|
|
|
915
886
|
const body = {
|
|
916
887
|
text,
|
|
917
888
|
...(summary ? { summary } : {}),
|
|
889
|
+
...(kind ? { kind } : {}),
|
|
918
890
|
...(kid ? { studentId: kid.id } : {}),
|
|
919
891
|
...(todoId ? { todoId } : {}),
|
|
920
892
|
};
|
|
921
|
-
// Goes to the
|
|
893
|
+
// Goes to the Recess team (Recess Issues); nothing in the family changes.
|
|
922
894
|
return writeNow(parsed, {
|
|
923
|
-
action: `report a bug to the Recess team: "${(summary ?? text).slice(0, 80)}"`,
|
|
895
|
+
action: `report ${kind === "request" ? "a request" : "a bug"} to the Recess team: "${(summary ?? text).slice(0, 80)}"`,
|
|
924
896
|
target: { user: "@me", ...(kid ? kidTarget(kid) : {}) },
|
|
925
897
|
request: body,
|
|
926
898
|
details: {
|
|
927
|
-
consequence: "The
|
|
899
|
+
consequence: "The Recess team gets it; nothing changes.",
|
|
928
900
|
},
|
|
929
901
|
}, async () => unwrap(await api.client.POST("/parent-v2/report-bug/", { body })));
|
|
930
902
|
}
|
|
931
|
-
throw new CliError("invalid_arguments", "Use family kids|today|schedule|tutor|account|set-name|set-notifications|set-phone|set-timezone|guardians|changes|undo|remind|reminders|cancel-reminder|config|set|
|
|
903
|
+
throw new CliError("invalid_arguments", "Use family kids|today|schedule|tutor|account|set-name|set-notifications|set-phone|set-timezone|guardians|changes|undo|remind|reminders|cancel-reminder|config|set|pause|add-guardian|billing|billing-link|calendar|login-link|school-classes|school-class-options|drop-class|restore-class|swap-class|register-class|context|memory|message-guide|report-bug.");
|
|
932
904
|
}
|
|
933
905
|
export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
934
906
|
const verb = parsed.positionals[1];
|
package/dist/commands/shared.js
CHANGED
|
@@ -69,6 +69,21 @@ export function flagIsoInstant(parsed, name, options = {}) {
|
|
|
69
69
|
}
|
|
70
70
|
return raw;
|
|
71
71
|
}
|
|
72
|
+
/** A `YYYY-MM-DD` date that exists: 2015-02-31 and 2015-13-01 are refused. */
|
|
73
|
+
export function flagDate(parsed, name, options = {}) {
|
|
74
|
+
const raw = flagString(parsed, name, options);
|
|
75
|
+
if (raw === undefined)
|
|
76
|
+
return undefined;
|
|
77
|
+
const date = /^\d{4}-\d{2}-\d{2}$/.test(raw)
|
|
78
|
+
? new Date(`${raw}T00:00:00.000Z`)
|
|
79
|
+
: null;
|
|
80
|
+
if (!date ||
|
|
81
|
+
Number.isNaN(date.getTime()) ||
|
|
82
|
+
date.toISOString().slice(0, 10) !== raw) {
|
|
83
|
+
throw new CliError("invalid_arguments", `--${name} must be a valid YYYY-MM-DD date.`);
|
|
84
|
+
}
|
|
85
|
+
return raw;
|
|
86
|
+
}
|
|
72
87
|
export async function readJsonValue(filePath, label) {
|
|
73
88
|
const absolutePath = path.resolve(filePath);
|
|
74
89
|
let raw;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { unwrap } from "../api.js";
|
|
2
|
-
import { flagString, hasFlag } from "../args.js";
|
|
2
|
+
import { flagList, flagString, hasFlag } from "../args.js";
|
|
3
3
|
import { apiError, CliError } from "../errors.js";
|
|
4
4
|
import { renderColumns } from "./shared.js";
|
|
5
5
|
const NONE = "—";
|
|
@@ -155,11 +155,71 @@ async function linkEvent(ctx) {
|
|
|
155
155
|
};
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
+
/** `village age-exempt (--template <id> | --name <text>) (--add <kid-id> | --remove <kid-id>)…` */
|
|
159
|
+
async function ageExempt(ctx) {
|
|
160
|
+
const { parsed, api, writeCommand } = ctx;
|
|
161
|
+
const templateId = flagString(parsed, "template");
|
|
162
|
+
const name = flagString(parsed, "name")?.trim().toLowerCase();
|
|
163
|
+
const add = flagList(parsed, "add");
|
|
164
|
+
const remove = flagList(parsed, "remove");
|
|
165
|
+
if (Boolean(templateId) === Boolean(name)) {
|
|
166
|
+
throw new CliError("invalid_arguments", "Pass exactly one of --template <template-id> or --name <text>.");
|
|
167
|
+
}
|
|
168
|
+
if (add.length === 0 && remove.length === 0) {
|
|
169
|
+
throw new CliError("invalid_arguments", "Pass at least one --add <kid-id> or --remove <kid-id>.");
|
|
170
|
+
}
|
|
171
|
+
const { templates } = await fetchTemplatesAndRooms(ctx);
|
|
172
|
+
const targets = templates.filter((template) => templateId
|
|
173
|
+
? template.id === templateId
|
|
174
|
+
: template.name.toLowerCase().includes(name));
|
|
175
|
+
if (targets.length === 0) {
|
|
176
|
+
throw new CliError("not_found", `No editable event template matches ${templateId ?? `"${name}"`}. Run \`recess village events\` to list them.`);
|
|
177
|
+
}
|
|
178
|
+
const changes = targets.map((template) => {
|
|
179
|
+
const next = new Set(template.ageExemptUserIds);
|
|
180
|
+
for (const id of add)
|
|
181
|
+
next.add(id);
|
|
182
|
+
for (const id of remove)
|
|
183
|
+
next.delete(id);
|
|
184
|
+
return {
|
|
185
|
+
templateId: template.id,
|
|
186
|
+
templateName: template.name,
|
|
187
|
+
ages: { minAge: template.minAge, maxAge: template.maxAge },
|
|
188
|
+
before: template.ageExemptUserIds,
|
|
189
|
+
ageExemptUserIds: [...next],
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
return writeCommand(parsed, {
|
|
193
|
+
action: `Set age exemptions on ${changes.length} event template(s): ${changes.map((change) => change.templateName).join(", ")}`,
|
|
194
|
+
target: { templateIds: changes.map((change) => change.templateId) },
|
|
195
|
+
request: { add, remove },
|
|
196
|
+
details: { templates: changes },
|
|
197
|
+
}, async () => {
|
|
198
|
+
for (const change of changes) {
|
|
199
|
+
const result = await api.client.PATCH("/recess/event-templates/{id}/", {
|
|
200
|
+
params: { path: { id: change.templateId } },
|
|
201
|
+
body: { ageExemptUserIds: change.ageExemptUserIds },
|
|
202
|
+
});
|
|
203
|
+
if (!result.response.ok) {
|
|
204
|
+
throw apiError(result.response.status, result.error);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
templates: changes.map(({ templateId, templateName, ageExemptUserIds }) => ({
|
|
209
|
+
templateId,
|
|
210
|
+
templateName,
|
|
211
|
+
ageExemptUserIds,
|
|
212
|
+
})),
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
}
|
|
158
216
|
export async function runVillageEventsCommand(ctx, verb) {
|
|
159
217
|
if (verb === "events")
|
|
160
218
|
return listEvents(ctx);
|
|
161
219
|
if (verb === "link-event")
|
|
162
220
|
return linkEvent(ctx);
|
|
163
|
-
|
|
221
|
+
if (verb === "age-exempt")
|
|
222
|
+
return ageExempt(ctx);
|
|
223
|
+
throw new CliError("invalid_arguments", "Use village events, link-event or age-exempt.");
|
|
164
224
|
}
|
|
165
225
|
//# sourceMappingURL=village-events.js.map
|
package/dist/help.js
CHANGED
|
@@ -52,6 +52,7 @@ Usage:
|
|
|
52
52
|
recess [--json] users phone get <user-id>
|
|
53
53
|
recess [--json] users phone set <user-id> --phone <number> [--confirm]
|
|
54
54
|
recess [--json] users phone clear <user-id> [--confirm]
|
|
55
|
+
recess [--json] users birthday set <kid-id> --date YYYY-MM-DD [--confirm]
|
|
55
56
|
recess [--json] users text <user-id> --text TEXT [--confirm]
|
|
56
57
|
recess [--json] users lock <user-id> [--confirm]
|
|
57
58
|
recess [--json] users unlock <user-id> [--confirm]
|
|
@@ -228,8 +229,6 @@ Usage:
|
|
|
228
229
|
recess [--json] family cancel-reminder --reminder <reminder-id> [--confirm]
|
|
229
230
|
recess [--json] family config
|
|
230
231
|
recess [--json] family set --path <path> --value <value> [--confirm]
|
|
231
|
-
recess [--json] family feedback --kind wrong|too-much|wanted|loved|cant-do|other --quote TEXT
|
|
232
|
-
[--about TEXT] [--student <kid>] [--confirm]
|
|
233
232
|
recess [--json] family pause --student <kid> --weeks N [--enrollment <enrollment-id>] [--confirm]
|
|
234
233
|
recess [--json] family add-guardian --first-name TEXT [--last-name TEXT] --email EMAIL [--confirm]
|
|
235
234
|
recess [--json] family billing
|
|
@@ -243,7 +242,7 @@ Usage:
|
|
|
243
242
|
recess [--json] family memory forget --in journal|family|me --line TEXT
|
|
244
243
|
[--date YYYY-MM-DD] [--confirm]
|
|
245
244
|
recess [--json] family message-guide --text TEXT [--student <kid>] [--confirm]
|
|
246
|
-
recess [--json] family report-bug --text TEXT [--summary TEXT] [--student <kid>]
|
|
245
|
+
recess [--json] family report-bug --text TEXT [--summary TEXT] [--kind bug|request] [--student <kid>]
|
|
247
246
|
[--todo <todo-id>] [--confirm]
|
|
248
247
|
recess [--json] kid today --student <kid> [--date YYYY-MM-DD]
|
|
249
248
|
recess [--json] kid goals --student <kid>
|
|
@@ -598,6 +597,8 @@ Usage:
|
|
|
598
597
|
recess [--json] village events
|
|
599
598
|
recess [--json] village link-event --template <template-id>
|
|
600
599
|
[--room <zone-id>] [--unlink] [--url <https://…>] [--confirm]
|
|
600
|
+
recess [--json] village age-exempt (--template <template-id> | --name <text>)
|
|
601
|
+
[--add <kid-id>]… [--remove <kid-id>]… [--confirm]
|
|
601
602
|
recess [--json] store-items list [--search TEXT]
|
|
602
603
|
[--status ACTIVE|INACTIVE|COMING_SOON] [--item-type TYPE]
|
|
603
604
|
[--page 0] [--limit 20] [--sort-by name|price|createdAt|updatedAt|order]
|
|
@@ -912,6 +913,11 @@ account — the confirmed write's own response is the record of what changed.
|
|
|
912
913
|
without +country is read as US), rejects invalid or already-taken numbers, and
|
|
913
914
|
marks the new number unverified until the user's next phone sign-in.
|
|
914
915
|
|
|
916
|
+
"users birthday set" corrects any kid's birthday, e.g. a wrong-century year that
|
|
917
|
+
makes "users get" show age 115 ("kid set-profile" reaches only your own kids).
|
|
918
|
+
The preview shows the age before and after, and warns outside ages 3 to 21. The
|
|
919
|
+
family's change log shows the change under your first name; a guardian can undo it.
|
|
920
|
+
|
|
915
921
|
Parent SMS summary notes: "students texts get" shows the kid-level switch and
|
|
916
922
|
end-of-day send hour (0-23 in the kid's timezone; unset = 18) plus every
|
|
917
923
|
recipient's phone, texts on/off, frequency, and focus. "set" changes the
|
|
@@ -1274,6 +1280,7 @@ export const COMMAND_SUMMARIES = {
|
|
|
1274
1280
|
"users phone get": "Read a user's phone number and verification.",
|
|
1275
1281
|
"users phone set": "Set a user's phone number (stored E.164, unverified).",
|
|
1276
1282
|
"users phone clear": "Remove a user's phone number.",
|
|
1283
|
+
"users birthday set": "Correct any kid's birthday (shows the age it gives).",
|
|
1277
1284
|
"users text": "Text a parent from Rocky's number, signed with your first name.",
|
|
1278
1285
|
"users community-hour get": "Show whether a kid can join Community Hour.",
|
|
1279
1286
|
"users community-hour unlock": "Let a kid join Community Hour and enter the Village.",
|
|
@@ -1405,13 +1412,12 @@ export const COMMAND_SUMMARIES = {
|
|
|
1405
1412
|
"family memory rewrite": "Replace family.md or your own notes whole, tidied (at once).",
|
|
1406
1413
|
"family memory forget": "Forget one exact line of the family notes (at once).",
|
|
1407
1414
|
"family message-guide": "Message your kid's guide (Slack + the app chat); the person for anything.",
|
|
1408
|
-
"family report-bug": "Report something
|
|
1415
|
+
"family report-bug": "Report a bug, or a request (--kind request: something missing, or what you think of Rocky), to the Recess team (at once; not a change).",
|
|
1409
1416
|
"family remind": "Have Rocky text you a reminder (applies at once).",
|
|
1410
1417
|
"family reminders": "Your upcoming text-me reminders.",
|
|
1411
1418
|
"family cancel-reminder": "Cancel an upcoming reminder (applies at once).",
|
|
1412
1419
|
"family config": "The family's settings, one line each, with paths.",
|
|
1413
1420
|
"family set": "Change one family setting by path (at once, or confirm when marked).",
|
|
1414
|
-
"family feedback": "Pass on what you think of Rocky's texts or abilities (at once; not a change).",
|
|
1415
1421
|
"family pause": "Pause a kid's weekly class billing 1-6 weeks from Sunday (family undo resumes).",
|
|
1416
1422
|
"family add-guardian": "Add a co-guardian with full parent access; they get an invite email.",
|
|
1417
1423
|
"family school-classes": "Your kids' school classes, slots, queued switches.",
|
|
@@ -1647,6 +1653,7 @@ export const COMMAND_SUMMARIES = {
|
|
|
1647
1653
|
"village worlds promote": "Promote a mirror/archive world to live.",
|
|
1648
1654
|
"village events": "List event templates and their Village rooms.",
|
|
1649
1655
|
"village link-event": "Link (or unlink) an event template to a Village room.",
|
|
1656
|
+
"village age-exempt": "Let kids join a recurring event outside its age range.",
|
|
1650
1657
|
"store-items list": "List Village store items.",
|
|
1651
1658
|
"store-items set-status": "Change a Village store item's status.",
|
|
1652
1659
|
"db query": "Run a read-only SQL query against the API's database.",
|
|
@@ -1773,7 +1780,7 @@ export const NOUN_SUMMARIES = {
|
|
|
1773
1780
|
jobs: "Local ledger of write operations by operation key.",
|
|
1774
1781
|
feedback: "Send or list feedback about this CLI.",
|
|
1775
1782
|
auth: "Sign in (browser or headless), session status, sign out.",
|
|
1776
|
-
users: "Accounts: search/get, lock/unlock, community-hour, disable/restore, phone, tier, school status.",
|
|
1783
|
+
users: "Accounts: search/get, lock/unlock, community-hour, disable/restore, phone, birthday, tier, school status.",
|
|
1777
1784
|
guides: "Create and invite guide accounts.",
|
|
1778
1785
|
guardians: "Invite guardians into a family.",
|
|
1779
1786
|
students: "Kids: roster, today, schedule, todos, analysis, XP, SMS summaries, notes.",
|