recess-cli 3.50.2 → 3.52.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/api.js +13 -9
- package/dist/auth.js +3 -0
- package/dist/cli.js +484 -37
- package/dist/command-schema.js +17 -1
- package/dist/commands/admissions.js +1 -1
- package/dist/commands/apps.js +2 -1
- package/dist/commands/changelog.js +1 -1
- package/dist/commands/channels.js +1 -1
- package/dist/commands/db.js +1 -1
- package/dist/commands/onboarding.js +1 -1
- package/dist/commands/reading-checks.js +1 -1
- package/dist/commands/reports.js +1 -1
- package/dist/commands/safe-staff-operations.js +1 -1
- package/dist/commands/school.js +1 -1
- package/dist/commands/shared.js +1 -1
- package/dist/commands/tuition-plans.js +2 -1
- package/dist/config.js +1 -1
- package/dist/delivery.js +1 -1
- package/dist/feedback.js +1 -1
- package/dist/help.js +26 -1
- package/dist/in-app.js +511 -0
- package/dist/jobs.js +1 -1
- package/dist/setup.js +1 -1
- package/dist/skill-update.js +1 -1
- package/dist/skills-cache.js +1 -1
- package/dist/update-notice.js +2 -1
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -24,6 +24,8 @@ export class RecessAdminApi {
|
|
|
24
24
|
clientTag;
|
|
25
25
|
client;
|
|
26
26
|
villageSessionPromise;
|
|
27
|
+
/** Every request to the API origin: the injected transport when hosted. */
|
|
28
|
+
apiFetch;
|
|
27
29
|
constructor(config, reason, clientTag = RECESS_CLIENT_CLI, clientOverride, fetchOverride) {
|
|
28
30
|
this.config = config;
|
|
29
31
|
this.reason = reason;
|
|
@@ -41,6 +43,8 @@ export class RecessAdminApi {
|
|
|
41
43
|
const requestClientTag = this.clientTag;
|
|
42
44
|
const liveConfig = this.config;
|
|
43
45
|
const doFetch = fetchOverride ?? globalThis.fetch;
|
|
46
|
+
this.apiFetch =
|
|
47
|
+
fetchOverride ?? ((input, init) => globalThis.fetch(input, init));
|
|
44
48
|
// Replayable copies for the one 401 retry below (the sent body is spent).
|
|
45
49
|
const replays = new WeakMap();
|
|
46
50
|
this.client.use({
|
|
@@ -80,7 +84,7 @@ export class RecessAdminApi {
|
|
|
80
84
|
if (!path.startsWith("/") || path.startsWith("//")) {
|
|
81
85
|
throw new CliError("invalid_arguments", "Raw request paths must start with one '/'.");
|
|
82
86
|
}
|
|
83
|
-
const response = await
|
|
87
|
+
const response = await this.apiFetch(new URL(path, this.config.apiOrigin), {
|
|
84
88
|
headers: cliRequestHeaders({ cookie: this.config.sessionCookie }, this.reason, this.clientTag),
|
|
85
89
|
});
|
|
86
90
|
noteServerCliVersions(response.headers);
|
|
@@ -105,7 +109,7 @@ export class RecessAdminApi {
|
|
|
105
109
|
: { "content-type": "application/json" }),
|
|
106
110
|
}, this.reason, this.clientTag);
|
|
107
111
|
applyIdempotencyHeaders(headers);
|
|
108
|
-
const response = await
|
|
112
|
+
const response = await this.apiFetch(new URL(path, this.config.apiOrigin), {
|
|
109
113
|
method: options.method ?? "GET",
|
|
110
114
|
headers,
|
|
111
115
|
...(options.body === undefined
|
|
@@ -157,7 +161,7 @@ export class RecessAdminApi {
|
|
|
157
161
|
form.set("file", new Blob([arrayBuffer], { type: "model/gltf-binary" }), fileName);
|
|
158
162
|
const headers = cliRequestHeaders({ cookie: this.config.sessionCookie }, this.reason, this.clientTag);
|
|
159
163
|
applyIdempotencyHeaders(headers);
|
|
160
|
-
const response = await
|
|
164
|
+
const response = await this.apiFetch(new URL(`/admin/village/models/upload?worldId=${encodeURIComponent(worldId)}`, this.config.apiOrigin), {
|
|
161
165
|
method: "POST",
|
|
162
166
|
headers,
|
|
163
167
|
body: form,
|
|
@@ -181,7 +185,7 @@ export class RecessAdminApi {
|
|
|
181
185
|
formData.append("file", new Blob([arrayBuffer], { type: mimeType }), fileName);
|
|
182
186
|
const headers = cliRequestHeaders({ cookie: this.config.sessionCookie }, this.reason, this.clientTag);
|
|
183
187
|
applyIdempotencyHeaders(headers);
|
|
184
|
-
const response = await
|
|
188
|
+
const response = await this.apiFetch(new URL("/admin/partner/logo-upload", this.config.apiOrigin), {
|
|
185
189
|
method: "POST",
|
|
186
190
|
headers,
|
|
187
191
|
body: formData,
|
|
@@ -198,7 +202,7 @@ export class RecessAdminApi {
|
|
|
198
202
|
formData.append("file", new Blob([arrayBuffer], { type: mimeType }), fileName);
|
|
199
203
|
const headers = cliRequestHeaders({ cookie: this.config.sessionCookie }, this.reason, this.clientTag);
|
|
200
204
|
applyIdempotencyHeaders(headers);
|
|
201
|
-
const response = await
|
|
205
|
+
const response = await this.apiFetch(new URL(`/admin/channels/${encodeURIComponent(channelId)}/image`, this.config.apiOrigin), {
|
|
202
206
|
method: "POST",
|
|
203
207
|
headers,
|
|
204
208
|
body: formData,
|
|
@@ -216,7 +220,7 @@ export class RecessAdminApi {
|
|
|
216
220
|
formData.append("file", new Blob([pdfBody.buffer], { type: "application/pdf" }), fileName);
|
|
217
221
|
const headers = cliRequestHeaders({ cookie: this.config.sessionCookie }, this.reason, this.clientTag);
|
|
218
222
|
applyIdempotencyHeaders(headers);
|
|
219
|
-
const response = await
|
|
223
|
+
const response = await this.apiFetch(new URL(`/tutor/students/${encodeURIComponent(studentId)}/map-test-scores/upload`, this.config.apiOrigin), {
|
|
220
224
|
method: "POST",
|
|
221
225
|
headers,
|
|
222
226
|
body: formData,
|
|
@@ -247,7 +251,7 @@ export class RecessAdminApi {
|
|
|
247
251
|
if (value !== undefined)
|
|
248
252
|
url.searchParams.set(key, String(value));
|
|
249
253
|
}
|
|
250
|
-
const response = await
|
|
254
|
+
const response = await this.apiFetch(url, {
|
|
251
255
|
method: "POST",
|
|
252
256
|
headers,
|
|
253
257
|
body: formData,
|
|
@@ -270,7 +274,7 @@ export class RecessAdminApi {
|
|
|
270
274
|
const url = new URL(`/admin/admissions/${encodeURIComponent(packetId)}/contract`, this.config.apiOrigin);
|
|
271
275
|
if (optionId)
|
|
272
276
|
url.searchParams.set("option", optionId);
|
|
273
|
-
const response = await
|
|
277
|
+
const response = await this.apiFetch(url, {
|
|
274
278
|
headers: cliRequestHeaders({ cookie: this.config.sessionCookie }, this.reason, this.clientTag),
|
|
275
279
|
});
|
|
276
280
|
noteServerCliVersions(response.headers);
|
|
@@ -299,7 +303,7 @@ export class RecessAdminApi {
|
|
|
299
303
|
formData.append("file", new Blob([pdfBody.buffer], { type: "application/pdf" }), fileName);
|
|
300
304
|
const headers = cliRequestHeaders({ cookie: this.config.sessionCookie }, this.reason, this.clientTag);
|
|
301
305
|
applyIdempotencyHeaders(headers);
|
|
302
|
-
const response = await
|
|
306
|
+
const response = await this.apiFetch(new URL(`/admin/admissions/${encodeURIComponent(packetId)}/signed-agreement`, this.config.apiOrigin), { method: "POST", headers, body: formData });
|
|
303
307
|
const body = await readResponseBody(response);
|
|
304
308
|
if (!response.ok)
|
|
305
309
|
throw apiError(response.status, body);
|
package/dist/auth.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createServer } from "node:http";
|
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
4
|
import { clearPendingDeviceAuth, updateStoredConfig } from "./config.js";
|
|
5
5
|
import { apiError, CliError } from "./errors.js";
|
|
6
|
+
import { assertLocalMachine } from "./in-app.js";
|
|
6
7
|
import { cliRequestHeaders } from "./http.js";
|
|
7
8
|
/** Stored secrets stay in the 0600 config; never return them to stdout. */
|
|
8
9
|
function publicSession(session) {
|
|
@@ -23,6 +24,7 @@ export function openBrowser(url) {
|
|
|
23
24
|
? "rundll32"
|
|
24
25
|
: "xdg-open";
|
|
25
26
|
const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", url] : [url];
|
|
27
|
+
assertLocalMachine();
|
|
26
28
|
const child = spawn(command, args, { detached: true, stdio: "ignore" });
|
|
27
29
|
child.unref();
|
|
28
30
|
}
|
|
@@ -32,6 +34,7 @@ export function waitForSsoCallback(port, expectedState) {
|
|
|
32
34
|
server.close();
|
|
33
35
|
reject(new CliError("auth_timeout", "Timed out waiting for Recess SSO."));
|
|
34
36
|
}, 5 * 60 * 1000);
|
|
37
|
+
assertLocalMachine();
|
|
35
38
|
const server = createServer((request, response) => {
|
|
36
39
|
const url = new URL(request.url ?? "/", `http://127.0.0.1:${port}`);
|
|
37
40
|
if (url.pathname !== "/callback") {
|