moodle-cli 0.9.0 → 0.9.2
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/README.md +8 -0
- package/dist/moodle.js +1221 -336
- package/dist/worker/recovery.js +26 -2
- package/dist/worker/worker.js +26 -2
- package/package.json +1 -1
- package/references/command-reference.md +1 -1
package/dist/worker/recovery.js
CHANGED
|
@@ -26452,7 +26452,7 @@ function stringValue(value) {
|
|
|
26452
26452
|
}
|
|
26453
26453
|
|
|
26454
26454
|
// src/version.ts
|
|
26455
|
-
var VERSION = "0.9.
|
|
26455
|
+
var VERSION = "0.9.2";
|
|
26456
26456
|
|
|
26457
26457
|
// src/worker/http.ts
|
|
26458
26458
|
var HEALTH_PATH = "/healthz";
|
|
@@ -27004,7 +27004,12 @@ async function fetchWithSession(input3, init, moodleOrigin, cookie, fetchImpl =
|
|
|
27004
27004
|
headers.delete("authorization");
|
|
27005
27005
|
headers.delete("proxy-authorization");
|
|
27006
27006
|
}
|
|
27007
|
-
|
|
27007
|
+
let response;
|
|
27008
|
+
try {
|
|
27009
|
+
response = await fetchImpl(url2.toString(), { ...init, method, body, headers: Object.fromEntries(headers), signal, redirect: "manual" });
|
|
27010
|
+
} catch (error62) {
|
|
27011
|
+
throw requestFailure(error62, url2, deadline);
|
|
27012
|
+
}
|
|
27008
27013
|
if (!REDIRECT_STATUSES.has(response.status)) return response;
|
|
27009
27014
|
const location = response.headers.get("location");
|
|
27010
27015
|
if (!location) return response;
|
|
@@ -27025,6 +27030,25 @@ async function fetchWithSession(input3, init, moodleOrigin, cookie, fetchImpl =
|
|
|
27025
27030
|
url2 = next;
|
|
27026
27031
|
}
|
|
27027
27032
|
}
|
|
27033
|
+
var RequestFailed = class extends Error {
|
|
27034
|
+
host;
|
|
27035
|
+
timedOut;
|
|
27036
|
+
constructor(host, timedOut, cause) {
|
|
27037
|
+
super(timedOut ? `${host} did not respond within ${REQUEST_TIMEOUT_MS / 1e3}s.` : `Could not reach ${host}: ${cause}`);
|
|
27038
|
+
this.name = "RequestFailed";
|
|
27039
|
+
this.host = host;
|
|
27040
|
+
this.timedOut = timedOut;
|
|
27041
|
+
}
|
|
27042
|
+
};
|
|
27043
|
+
function requestFailure(error62, url2, deadline) {
|
|
27044
|
+
if (deadline.aborted) {
|
|
27045
|
+
return new RequestFailed(url2.host, true);
|
|
27046
|
+
}
|
|
27047
|
+
if (!(error62 instanceof Error)) {
|
|
27048
|
+
return error62;
|
|
27049
|
+
}
|
|
27050
|
+
return new RequestFailed(url2.host, false, error62.cause instanceof Error ? error62.cause.message : error62.message);
|
|
27051
|
+
}
|
|
27028
27052
|
|
|
27029
27053
|
// src/constants.ts
|
|
27030
27054
|
var PACKAGE_NAME = "moodle-cli";
|
package/dist/worker/worker.js
CHANGED
|
@@ -26452,7 +26452,7 @@ function stringValue(value) {
|
|
|
26452
26452
|
}
|
|
26453
26453
|
|
|
26454
26454
|
// src/version.ts
|
|
26455
|
-
var VERSION = "0.9.
|
|
26455
|
+
var VERSION = "0.9.2";
|
|
26456
26456
|
|
|
26457
26457
|
// src/worker/http.ts
|
|
26458
26458
|
var HEALTH_PATH = "/healthz";
|
|
@@ -27004,7 +27004,12 @@ async function fetchWithSession(input3, init, moodleOrigin, cookie, fetchImpl =
|
|
|
27004
27004
|
headers.delete("authorization");
|
|
27005
27005
|
headers.delete("proxy-authorization");
|
|
27006
27006
|
}
|
|
27007
|
-
|
|
27007
|
+
let response;
|
|
27008
|
+
try {
|
|
27009
|
+
response = await fetchImpl(url2.toString(), { ...init, method, body, headers: Object.fromEntries(headers), signal, redirect: "manual" });
|
|
27010
|
+
} catch (error62) {
|
|
27011
|
+
throw requestFailure(error62, url2, deadline);
|
|
27012
|
+
}
|
|
27008
27013
|
if (!REDIRECT_STATUSES.has(response.status)) return response;
|
|
27009
27014
|
const location = response.headers.get("location");
|
|
27010
27015
|
if (!location) return response;
|
|
@@ -27025,6 +27030,25 @@ async function fetchWithSession(input3, init, moodleOrigin, cookie, fetchImpl =
|
|
|
27025
27030
|
url2 = next;
|
|
27026
27031
|
}
|
|
27027
27032
|
}
|
|
27033
|
+
var RequestFailed = class extends Error {
|
|
27034
|
+
host;
|
|
27035
|
+
timedOut;
|
|
27036
|
+
constructor(host, timedOut, cause) {
|
|
27037
|
+
super(timedOut ? `${host} did not respond within ${REQUEST_TIMEOUT_MS / 1e3}s.` : `Could not reach ${host}: ${cause}`);
|
|
27038
|
+
this.name = "RequestFailed";
|
|
27039
|
+
this.host = host;
|
|
27040
|
+
this.timedOut = timedOut;
|
|
27041
|
+
}
|
|
27042
|
+
};
|
|
27043
|
+
function requestFailure(error62, url2, deadline) {
|
|
27044
|
+
if (deadline.aborted) {
|
|
27045
|
+
return new RequestFailed(url2.host, true);
|
|
27046
|
+
}
|
|
27047
|
+
if (!(error62 instanceof Error)) {
|
|
27048
|
+
return error62;
|
|
27049
|
+
}
|
|
27050
|
+
return new RequestFailed(url2.host, false, error62.cause instanceof Error ? error62.cause.message : error62.message);
|
|
27051
|
+
}
|
|
27028
27052
|
|
|
27029
27053
|
// src/constants.ts
|
|
27030
27054
|
var PACKAGE_NAME = "moodle-cli";
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ asks for confirmation (`--yes` skips it) and prints the receipt Moodle shows aft
|
|
|
20
20
|
| moodle auth keepalive install | Install a macOS launch agent that renews the session periodically. | | --interval (value required)<br>--pretty<br>--json<br>--yaml<br>--table<br>--fields (value required) |
|
|
21
21
|
| moodle auth keepalive status | Show whether the keepalive launch agent is installed. | | --pretty<br>--json<br>--yaml<br>--table<br>--fields (value required) |
|
|
22
22
|
| moodle auth keepalive uninstall | Remove the keepalive launch agent. | | --pretty<br>--json<br>--yaml<br>--table<br>--fields (value required) |
|
|
23
|
-
| moodle auth login |
|
|
23
|
+
| moodle auth login | Sign in through a browser the CLI controls, then capture the session. | | --paste<br>--pretty<br>--json<br>--yaml<br>--table<br>--fields (value required) |
|
|
24
24
|
| moodle auth status | Show cached session freshness and keepalive state. | | --pretty<br>--json<br>--yaml<br>--table<br>--fields (value required) |
|
|
25
25
|
| moodle commands | Describe the complete command tree. | | --pretty<br>--json<br>--yaml<br>--table<br>--fields (value required) |
|
|
26
26
|
| moodle completion | Print shell completion for zsh, bash or fish. | <shell> | |
|