recess-cli 3.47.2 → 3.49.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 +2 -2
- package/dist/command-schema.js +1 -2
- package/dist/commands/family.js +9 -27
- package/dist/commands/flags.js +23 -1
- package/dist/commands/village-events.js +62 -2
- package/dist/help.js +7 -7
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2829,11 +2829,11 @@ export async function executeRecessCommand(argv, options = {}) {
|
|
|
2829
2829
|
}
|
|
2830
2830
|
throw new CliError("invalid_arguments", "Use village worlds export|import|promote.");
|
|
2831
2831
|
}
|
|
2832
|
-
if (verb === "events" || verb === "link-event") {
|
|
2832
|
+
if (verb === "events" || verb === "link-event" || verb === "age-exempt") {
|
|
2833
2833
|
return runVillageEventsCommand({ parsed, api, writeCommand }, verb);
|
|
2834
2834
|
}
|
|
2835
2835
|
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 …");
|
|
2836
|
+
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
2837
|
}
|
|
2838
2838
|
const action = positional(parsed, 2, "Village model action");
|
|
2839
2839
|
if (action === "list") {
|
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
|
package/dist/commands/family.js
CHANGED
|
@@ -737,29 +737,6 @@ export async function runFamilyCommand({ parsed, api, writeCommand, }) {
|
|
|
737
737
|
body: { path: raw, value },
|
|
738
738
|
})), {}));
|
|
739
739
|
}
|
|
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
740
|
if (verb === "pause") {
|
|
764
741
|
const kid = await resolveFamilyKid(api, parsed);
|
|
765
742
|
const pauseWeeks = flagInteger(parsed, "weeks", {
|
|
@@ -908,6 +885,10 @@ export async function runFamilyCommand({ parsed, api, writeCommand, }) {
|
|
|
908
885
|
if (verb === "report-bug") {
|
|
909
886
|
const text = flagString(parsed, "text", { required: true }).trim();
|
|
910
887
|
const summary = flagString(parsed, "summary")?.trim();
|
|
888
|
+
const rawKind = flagString(parsed, "kind")?.trim().toLowerCase();
|
|
889
|
+
const kind = rawKind
|
|
890
|
+
? assertChoice(rawKind, ["bug", "request"], "--kind")
|
|
891
|
+
: undefined;
|
|
911
892
|
const todoId = flagUuid(parsed, "todo");
|
|
912
893
|
const kid = hasFlag(parsed, "student")
|
|
913
894
|
? await resolveFamilyKid(api, parsed)
|
|
@@ -915,20 +896,21 @@ export async function runFamilyCommand({ parsed, api, writeCommand, }) {
|
|
|
915
896
|
const body = {
|
|
916
897
|
text,
|
|
917
898
|
...(summary ? { summary } : {}),
|
|
899
|
+
...(kind ? { kind } : {}),
|
|
918
900
|
...(kid ? { studentId: kid.id } : {}),
|
|
919
901
|
...(todoId ? { todoId } : {}),
|
|
920
902
|
};
|
|
921
|
-
// Goes to the
|
|
903
|
+
// Goes to the Recess team (Recess Issues); nothing in the family changes.
|
|
922
904
|
return writeNow(parsed, {
|
|
923
|
-
action: `report a bug to the Recess team: "${(summary ?? text).slice(0, 80)}"`,
|
|
905
|
+
action: `report ${kind === "request" ? "a request" : "a bug"} to the Recess team: "${(summary ?? text).slice(0, 80)}"`,
|
|
924
906
|
target: { user: "@me", ...(kid ? kidTarget(kid) : {}) },
|
|
925
907
|
request: body,
|
|
926
908
|
details: {
|
|
927
|
-
consequence: "The
|
|
909
|
+
consequence: "The Recess team gets it; nothing changes.",
|
|
928
910
|
},
|
|
929
911
|
}, async () => unwrap(await api.client.POST("/parent-v2/report-bug/", { body })));
|
|
930
912
|
}
|
|
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|
|
|
913
|
+
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
914
|
}
|
|
933
915
|
export async function runKidCommand({ parsed, api, writeCommand, }) {
|
|
934
916
|
const verb = parsed.positionals[1];
|
package/dist/commands/flags.js
CHANGED
|
@@ -58,6 +58,8 @@ function current(flag) {
|
|
|
58
58
|
return {
|
|
59
59
|
enabled: flag.enabled,
|
|
60
60
|
everyone: flag.everyone,
|
|
61
|
+
percentage: flag.percentage,
|
|
62
|
+
percentageRoles: flag.percentageRoles,
|
|
61
63
|
roles: flag.roles,
|
|
62
64
|
emails: flag.emails,
|
|
63
65
|
users: flag.users.map((user) => `${[user.firstName, user.lastName].filter(Boolean).join(" ") || user.email || user.id} (${user.role})`),
|
|
@@ -106,6 +108,17 @@ export async function runFlagsCommand(context) {
|
|
|
106
108
|
const body = {};
|
|
107
109
|
const enabled = onOff(context, "enabled");
|
|
108
110
|
const everyone = onOff(context, "everyone");
|
|
111
|
+
if (flagString(parsed, "percentage-roles")?.toLowerCase() === "all") {
|
|
112
|
+
body.percentageRoles = [];
|
|
113
|
+
}
|
|
114
|
+
else if (flagString(parsed, "percentage-roles") !== undefined) {
|
|
115
|
+
const roles = list(context, "percentage-roles").map((role) => role.toUpperCase());
|
|
116
|
+
const badRole = roles.find((role) => !ROLES.includes(role));
|
|
117
|
+
if (badRole || !roles.length) {
|
|
118
|
+
throw new CliError("invalid_arguments", `--percentage-roles takes all or a list of ${ROLES.join(", ")}.`);
|
|
119
|
+
}
|
|
120
|
+
body.percentageRoles = roles;
|
|
121
|
+
}
|
|
109
122
|
const name = flagString(parsed, "name")?.trim();
|
|
110
123
|
const description = flagString(parsed, "description");
|
|
111
124
|
const payloadFile = flagString(parsed, "payload-file");
|
|
@@ -115,6 +128,15 @@ export async function runFlagsCommand(context) {
|
|
|
115
128
|
body.enabled = enabled;
|
|
116
129
|
if (everyone !== undefined)
|
|
117
130
|
body.everyone = everyone;
|
|
131
|
+
const percentage = flagString(parsed, "percentage");
|
|
132
|
+
if (percentage !== undefined) {
|
|
133
|
+
body.percentage = Number(percentage);
|
|
134
|
+
if (!Number.isInteger(body.percentage) ||
|
|
135
|
+
body.percentage < 0 ||
|
|
136
|
+
body.percentage > 100) {
|
|
137
|
+
throw new CliError("invalid_arguments", "--percentage takes a whole number from 0 to 100.");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
118
140
|
if (description !== undefined)
|
|
119
141
|
body.description = description || null;
|
|
120
142
|
if (payloadFile !== undefined) {
|
|
@@ -124,7 +146,7 @@ export async function runFlagsCommand(context) {
|
|
|
124
146
|
: await readJsonFile(payloadFile, "--payload-file");
|
|
125
147
|
}
|
|
126
148
|
if (!Object.keys(body).length) {
|
|
127
|
-
throw new CliError("invalid_arguments", "Pass at least one of --enabled, --everyone, --name, --description, --payload-file.");
|
|
149
|
+
throw new CliError("invalid_arguments", "Pass at least one of --enabled, --everyone, --percentage, --percentage-roles, --name, --description, --payload-file.");
|
|
128
150
|
}
|
|
129
151
|
const turningOnForEveryone = (body.everyone ?? flag.everyone) && (body.enabled ?? flag.enabled);
|
|
130
152
|
return writeCommand(parsed, {
|
|
@@ -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
|
@@ -228,8 +228,6 @@ Usage:
|
|
|
228
228
|
recess [--json] family cancel-reminder --reminder <reminder-id> [--confirm]
|
|
229
229
|
recess [--json] family config
|
|
230
230
|
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
231
|
recess [--json] family pause --student <kid> --weeks N [--enrollment <enrollment-id>] [--confirm]
|
|
234
232
|
recess [--json] family add-guardian --first-name TEXT [--last-name TEXT] --email EMAIL [--confirm]
|
|
235
233
|
recess [--json] family billing
|
|
@@ -243,7 +241,7 @@ Usage:
|
|
|
243
241
|
recess [--json] family memory forget --in journal|family|me --line TEXT
|
|
244
242
|
[--date YYYY-MM-DD] [--confirm]
|
|
245
243
|
recess [--json] family message-guide --text TEXT [--student <kid>] [--confirm]
|
|
246
|
-
recess [--json] family report-bug --text TEXT [--summary TEXT] [--student <kid>]
|
|
244
|
+
recess [--json] family report-bug --text TEXT [--summary TEXT] [--kind bug|request] [--student <kid>]
|
|
247
245
|
[--todo <todo-id>] [--confirm]
|
|
248
246
|
recess [--json] kid today --student <kid> [--date YYYY-MM-DD]
|
|
249
247
|
recess [--json] kid goals --student <kid>
|
|
@@ -598,6 +596,8 @@ Usage:
|
|
|
598
596
|
recess [--json] village events
|
|
599
597
|
recess [--json] village link-event --template <template-id>
|
|
600
598
|
[--room <zone-id>] [--unlink] [--url <https://…>] [--confirm]
|
|
599
|
+
recess [--json] village age-exempt (--template <template-id> | --name <text>)
|
|
600
|
+
[--add <kid-id>]… [--remove <kid-id>]… [--confirm]
|
|
601
601
|
recess [--json] store-items list [--search TEXT]
|
|
602
602
|
[--status ACTIVE|INACTIVE|COMING_SOON] [--item-type TYPE]
|
|
603
603
|
[--page 0] [--limit 20] [--sort-by name|price|createdAt|updatedAt|order]
|
|
@@ -734,8 +734,8 @@ Usage:
|
|
|
734
734
|
recess [--json] flags list
|
|
735
735
|
recess [--json] flags get <key>
|
|
736
736
|
recess [--json] flags create <key> [--name TEXT] [--description TEXT] [--confirm]
|
|
737
|
-
recess [--json] flags set <key> [--enabled on|off] [--everyone on|off] [--
|
|
738
|
-
[--description TEXT] [--payload-file <path.json|none>] [--confirm]
|
|
737
|
+
recess [--json] flags set <key> [--enabled on|off] [--everyone on|off] [--percentage 0-100]
|
|
738
|
+
[--percentage-roles <all|ROLE,...>] [--name TEXT] [--description TEXT] [--payload-file <path.json|none>] [--confirm]
|
|
739
739
|
recess [--json] flags add <key> [--user <id,...>] [--email <email,...>] [--role <ROLE,...>] [--confirm]
|
|
740
740
|
recess [--json] flags remove <key> [--user <id,...>] [--email <email,...>] [--role <ROLE,...>]
|
|
741
741
|
[--confirm]
|
|
@@ -1405,13 +1405,12 @@ export const COMMAND_SUMMARIES = {
|
|
|
1405
1405
|
"family memory rewrite": "Replace family.md or your own notes whole, tidied (at once).",
|
|
1406
1406
|
"family memory forget": "Forget one exact line of the family notes (at once).",
|
|
1407
1407
|
"family message-guide": "Message your kid's guide (Slack + the app chat); the person for anything.",
|
|
1408
|
-
"family report-bug": "Report something
|
|
1408
|
+
"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
1409
|
"family remind": "Have Rocky text you a reminder (applies at once).",
|
|
1410
1410
|
"family reminders": "Your upcoming text-me reminders.",
|
|
1411
1411
|
"family cancel-reminder": "Cancel an upcoming reminder (applies at once).",
|
|
1412
1412
|
"family config": "The family's settings, one line each, with paths.",
|
|
1413
1413
|
"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
1414
|
"family pause": "Pause a kid's weekly class billing 1-6 weeks from Sunday (family undo resumes).",
|
|
1416
1415
|
"family add-guardian": "Add a co-guardian with full parent access; they get an invite email.",
|
|
1417
1416
|
"family school-classes": "Your kids' school classes, slots, queued switches.",
|
|
@@ -1647,6 +1646,7 @@ export const COMMAND_SUMMARIES = {
|
|
|
1647
1646
|
"village worlds promote": "Promote a mirror/archive world to live.",
|
|
1648
1647
|
"village events": "List event templates and their Village rooms.",
|
|
1649
1648
|
"village link-event": "Link (or unlink) an event template to a Village room.",
|
|
1649
|
+
"village age-exempt": "Let kids join a recurring event outside its age range.",
|
|
1650
1650
|
"store-items list": "List Village store items.",
|
|
1651
1651
|
"store-items set-status": "Change a Village store item's status.",
|
|
1652
1652
|
"db query": "Run a read-only SQL query against the API's database.",
|