recess-cli 3.47.1 → 3.48.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/commands/admissions.js +1 -1
- package/dist/commands/flags.js +23 -1
- package/dist/help.js +2 -2
- package/package.json +1 -1
|
@@ -133,7 +133,7 @@ function renderPacket(packet, admissionUrl, questions = []) {
|
|
|
133
133
|
if (packet.status === "COMPLETE") {
|
|
134
134
|
out.push("", "Orientation:");
|
|
135
135
|
for (const kid of packet.kids) {
|
|
136
|
-
out.push(` ${kid.firstName} (kid ${kid.id}): ${kid.orientationRegistered ? "registered in a Beginning cohort" : kid.orientationWeekOf ? `week of ${kid.orientationWeekOf}
|
|
136
|
+
out.push(` ${kid.firstName} (kid ${kid.id}): ${kid.orientationRegistered ? "registered in a Beginning cohort" : kid.orientationWeekOf ? `week of ${kid.orientationWeekOf}` : "no week yet: set one with `recess admissions orientation-week`"}`);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
if (packet.agreedPlan?.length) {
|
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, {
|
package/dist/help.js
CHANGED
|
@@ -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]
|