canvas-lms-mcp 2.4.0 → 2.4.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 +10 -0
- package/dist/canvas/index.cjs +3 -3
- package/dist/canvas/index.js +2 -2
- package/dist/canvas/rubrics.d.ts +4 -3
- package/dist/canvas/rubrics.d.ts.map +1 -1
- package/dist/canvas/types.d.ts +5 -0
- package/dist/canvas/types.d.ts.map +1 -1
- package/dist/{chunk-DHO2DXGI.js → chunk-3TED6SUG.js} +4 -4
- package/dist/chunk-3TED6SUG.js.map +1 -0
- package/dist/{chunk-D2L5S2CL.cjs → chunk-BCKOQCPP.cjs} +58 -48
- package/dist/chunk-BCKOQCPP.cjs.map +1 -0
- package/dist/{chunk-UNQ7N5X4.js → chunk-KP5VF6M5.js} +2 -2
- package/dist/{chunk-UNQ7N5X4.js.map → chunk-KP5VF6M5.js.map} +1 -1
- package/dist/{chunk-ZL2O45GK.cjs → chunk-TRY2MYPG.cjs} +336 -336
- package/dist/{chunk-ZL2O45GK.cjs.map → chunk-TRY2MYPG.cjs.map} +1 -1
- package/dist/{chunk-W7OMWOZH.cjs → chunk-WKYLHAWE.cjs} +2 -2
- package/dist/{chunk-W7OMWOZH.cjs.map → chunk-WKYLHAWE.cjs.map} +1 -1
- package/dist/{chunk-ZPUJT62F.js → chunk-YFRSDHBN.js} +13 -3
- package/dist/chunk-YFRSDHBN.js.map +1 -0
- package/dist/http.cjs +6 -6
- package/dist/http.js +3 -3
- package/dist/init.cjs +3 -3
- package/dist/init.js +1 -1
- package/dist/server.cjs +4 -4
- package/dist/server.js +3 -3
- package/dist/stdio.cjs +4 -4
- package/dist/stdio.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-D2L5S2CL.cjs.map +0 -1
- package/dist/chunk-DHO2DXGI.js.map +0 -1
- package/dist/chunk-ZPUJT62F.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkWKYLHAWEcjs = require('./chunk-WKYLHAWE.cjs');
|
|
5
5
|
|
|
6
6
|
// src/canvas/courses.ts
|
|
7
7
|
var DEFAULT_LIST_INCLUDE = ["term"];
|
|
@@ -253,6 +253,7 @@ var RubricsModule = class {
|
|
|
253
253
|
}
|
|
254
254
|
);
|
|
255
255
|
}
|
|
256
|
+
/** Canvas returns an envelope and reports association validation failures with HTTP 200. */
|
|
256
257
|
async create(courseId, rubric, association) {
|
|
257
258
|
const params = new URLSearchParams();
|
|
258
259
|
params.append("rubric[title]", rubric.title);
|
|
@@ -275,11 +276,20 @@ var RubricsModule = class {
|
|
|
275
276
|
params.append("rubric_association[purpose]", association.purpose);
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
|
-
|
|
279
|
+
const endpoint = `/api/v1/courses/${courseId}/rubrics`;
|
|
280
|
+
const result = await this.client.request(endpoint, {
|
|
279
281
|
method: "POST",
|
|
280
282
|
body: params.toString(),
|
|
281
283
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
282
284
|
});
|
|
285
|
+
if (result.error === true) {
|
|
286
|
+
throw new (0, _chunkWKYLHAWEcjs.CanvasApiError)(
|
|
287
|
+
_optionalChain([result, 'access', _2 => _2.messages, 'optionalAccess', _3 => _3.join, 'call', _4 => _4("; ")]) || "Canvas rejected the rubric",
|
|
288
|
+
422,
|
|
289
|
+
endpoint
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
return result;
|
|
283
293
|
}
|
|
284
294
|
/**
|
|
285
295
|
* Attach an existing rubric to an assignment via
|
|
@@ -1100,7 +1110,7 @@ var AccountsModule = class {
|
|
|
1100
1110
|
}
|
|
1101
1111
|
async listCourses(accountId, params) {
|
|
1102
1112
|
const query = {};
|
|
1103
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
1113
|
+
if (_optionalChain([params, 'optionalAccess', _5 => _5.search_term])) query.search_term = params.search_term;
|
|
1104
1114
|
return this.client.paginate(
|
|
1105
1115
|
`/api/v1/accounts/${accountId}/courses`,
|
|
1106
1116
|
Object.keys(query).length ? query : void 0
|
|
@@ -1108,7 +1118,7 @@ var AccountsModule = class {
|
|
|
1108
1118
|
}
|
|
1109
1119
|
async listUsers(accountId, params) {
|
|
1110
1120
|
const query = {};
|
|
1111
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
1121
|
+
if (_optionalChain([params, 'optionalAccess', _6 => _6.search_term])) query.search_term = params.search_term;
|
|
1112
1122
|
return this.client.paginate(
|
|
1113
1123
|
`/api/v1/accounts/${accountId}/users`,
|
|
1114
1124
|
Object.keys(query).length ? query : void 0
|
|
@@ -1263,8 +1273,8 @@ var OutcomesModule = class {
|
|
|
1263
1273
|
async listOutcomeGroupLinks(contextType, contextId, options) {
|
|
1264
1274
|
return this.client.paginate(
|
|
1265
1275
|
this.withQuery(this.buildContextPath(contextType, contextId, "outcome_group_links"), {
|
|
1266
|
-
outcome_style: _optionalChain([options, 'optionalAccess',
|
|
1267
|
-
outcome_group_style: _optionalChain([options, 'optionalAccess',
|
|
1276
|
+
outcome_style: _optionalChain([options, 'optionalAccess', _7 => _7.outcome_style]),
|
|
1277
|
+
outcome_group_style: _optionalChain([options, 'optionalAccess', _8 => _8.outcome_group_style])
|
|
1268
1278
|
})
|
|
1269
1279
|
);
|
|
1270
1280
|
}
|
|
@@ -1277,7 +1287,7 @@ var OutcomesModule = class {
|
|
|
1277
1287
|
return this.client.paginate(
|
|
1278
1288
|
this.withQuery(
|
|
1279
1289
|
`${this.buildContextPath(contextType, contextId, "outcome_groups")}/${groupId}/outcomes`,
|
|
1280
|
-
{ outcome_style: _optionalChain([options, 'optionalAccess',
|
|
1290
|
+
{ outcome_style: _optionalChain([options, 'optionalAccess', _9 => _9.outcome_style]) }
|
|
1281
1291
|
)
|
|
1282
1292
|
);
|
|
1283
1293
|
}
|
|
@@ -1289,63 +1299,63 @@ var OutcomesModule = class {
|
|
|
1289
1299
|
async getOutcome(outcomeId, options) {
|
|
1290
1300
|
return this.client.request(
|
|
1291
1301
|
this.withQuery(`/api/v1/outcomes/${outcomeId}`, {
|
|
1292
|
-
add_defaults: _optionalChain([options, 'optionalAccess',
|
|
1302
|
+
add_defaults: _optionalChain([options, 'optionalAccess', _10 => _10.add_defaults])
|
|
1293
1303
|
})
|
|
1294
1304
|
);
|
|
1295
1305
|
}
|
|
1296
1306
|
async getOutcomeAlignments(courseId, options) {
|
|
1297
1307
|
return this.client.request(
|
|
1298
1308
|
this.withQuery(`/api/v1/courses/${courseId}/outcome_alignments`, {
|
|
1299
|
-
student_id: _optionalChain([options, 'optionalAccess',
|
|
1300
|
-
assignment_id: _optionalChain([options, 'optionalAccess',
|
|
1309
|
+
student_id: _optionalChain([options, 'optionalAccess', _11 => _11.student_id]),
|
|
1310
|
+
assignment_id: _optionalChain([options, 'optionalAccess', _12 => _12.assignment_id])
|
|
1301
1311
|
})
|
|
1302
1312
|
);
|
|
1303
1313
|
}
|
|
1304
1314
|
async getOutcomeResults(courseId, options) {
|
|
1305
1315
|
return this.client.request(
|
|
1306
1316
|
this.withQuery(`/api/v1/courses/${courseId}/outcome_results`, {
|
|
1307
|
-
"user_ids[]": _optionalChain([options, 'optionalAccess',
|
|
1308
|
-
"outcome_ids[]": _optionalChain([options, 'optionalAccess',
|
|
1309
|
-
"include[]": _optionalChain([options, 'optionalAccess',
|
|
1310
|
-
include_hidden: _optionalChain([options, 'optionalAccess',
|
|
1317
|
+
"user_ids[]": _optionalChain([options, 'optionalAccess', _13 => _13.user_ids]),
|
|
1318
|
+
"outcome_ids[]": _optionalChain([options, 'optionalAccess', _14 => _14.outcome_ids]),
|
|
1319
|
+
"include[]": _optionalChain([options, 'optionalAccess', _15 => _15.include_alignments]) ? ["alignments"] : void 0,
|
|
1320
|
+
include_hidden: _optionalChain([options, 'optionalAccess', _16 => _16.include_hidden])
|
|
1311
1321
|
})
|
|
1312
1322
|
);
|
|
1313
1323
|
}
|
|
1314
1324
|
async getOutcomeRollups(courseId, options) {
|
|
1315
1325
|
return this.client.request(
|
|
1316
1326
|
this.withQuery(`/api/v1/courses/${courseId}/outcome_rollups`, {
|
|
1317
|
-
aggregate: _optionalChain([options, 'optionalAccess',
|
|
1318
|
-
aggregate_stat: _optionalChain([options, 'optionalAccess',
|
|
1319
|
-
"user_ids[]": _optionalChain([options, 'optionalAccess',
|
|
1320
|
-
"outcome_ids[]": _optionalChain([options, 'optionalAccess',
|
|
1321
|
-
"include[]": _optionalChain([options, 'optionalAccess',
|
|
1322
|
-
"exclude[]": _optionalChain([options, 'optionalAccess',
|
|
1323
|
-
sort_by: _optionalChain([options, 'optionalAccess',
|
|
1324
|
-
sort_outcome_id: _optionalChain([options, 'optionalAccess',
|
|
1325
|
-
sort_order: _optionalChain([options, 'optionalAccess',
|
|
1326
|
-
add_defaults: _optionalChain([options, 'optionalAccess',
|
|
1327
|
+
aggregate: _optionalChain([options, 'optionalAccess', _17 => _17.aggregate]),
|
|
1328
|
+
aggregate_stat: _optionalChain([options, 'optionalAccess', _18 => _18.aggregate_stat]),
|
|
1329
|
+
"user_ids[]": _optionalChain([options, 'optionalAccess', _19 => _19.user_ids]),
|
|
1330
|
+
"outcome_ids[]": _optionalChain([options, 'optionalAccess', _20 => _20.outcome_ids]),
|
|
1331
|
+
"include[]": _optionalChain([options, 'optionalAccess', _21 => _21.include_courses]) ? ["courses"] : void 0,
|
|
1332
|
+
"exclude[]": _optionalChain([options, 'optionalAccess', _22 => _22.exclude]),
|
|
1333
|
+
sort_by: _optionalChain([options, 'optionalAccess', _23 => _23.sort_by]),
|
|
1334
|
+
sort_outcome_id: _optionalChain([options, 'optionalAccess', _24 => _24.sort_outcome_id]),
|
|
1335
|
+
sort_order: _optionalChain([options, 'optionalAccess', _25 => _25.sort_order]),
|
|
1336
|
+
add_defaults: _optionalChain([options, 'optionalAccess', _26 => _26.add_defaults])
|
|
1327
1337
|
})
|
|
1328
1338
|
);
|
|
1329
1339
|
}
|
|
1330
1340
|
async getOutcomeContributingScores(courseId, outcomeId, options) {
|
|
1331
1341
|
return this.client.request(
|
|
1332
1342
|
this.withQuery(`/api/v1/courses/${courseId}/outcomes/${outcomeId}/contributing_scores`, {
|
|
1333
|
-
"user_ids[]": _optionalChain([options, 'optionalAccess',
|
|
1334
|
-
only_assignment_alignments: _optionalChain([options, 'optionalAccess',
|
|
1335
|
-
show_unpublished_assignments: _optionalChain([options, 'optionalAccess',
|
|
1343
|
+
"user_ids[]": _optionalChain([options, 'optionalAccess', _27 => _27.user_ids]),
|
|
1344
|
+
only_assignment_alignments: _optionalChain([options, 'optionalAccess', _28 => _28.only_assignment_alignments]),
|
|
1345
|
+
show_unpublished_assignments: _optionalChain([options, 'optionalAccess', _29 => _29.show_unpublished_assignments])
|
|
1336
1346
|
})
|
|
1337
1347
|
);
|
|
1338
1348
|
}
|
|
1339
1349
|
async getOutcomeMasteryDistribution(courseId, options) {
|
|
1340
1350
|
return this.client.request(
|
|
1341
1351
|
this.withQuery(`/api/v1/courses/${courseId}/outcome_mastery_distribution`, {
|
|
1342
|
-
"exclude[]": _optionalChain([options, 'optionalAccess',
|
|
1343
|
-
"outcome_ids[]": _optionalChain([options, 'optionalAccess',
|
|
1344
|
-
"student_ids[]": _optionalChain([options, 'optionalAccess',
|
|
1345
|
-
"include[]": _optionalChain([options, 'optionalAccess',
|
|
1346
|
-
only_assignment_alignments: _optionalChain([options, 'optionalAccess',
|
|
1347
|
-
show_unpublished_assignments: _optionalChain([options, 'optionalAccess',
|
|
1348
|
-
add_defaults: _optionalChain([options, 'optionalAccess',
|
|
1352
|
+
"exclude[]": _optionalChain([options, 'optionalAccess', _30 => _30.exclude]),
|
|
1353
|
+
"outcome_ids[]": _optionalChain([options, 'optionalAccess', _31 => _31.outcome_ids]),
|
|
1354
|
+
"student_ids[]": _optionalChain([options, 'optionalAccess', _32 => _32.student_ids]),
|
|
1355
|
+
"include[]": _optionalChain([options, 'optionalAccess', _33 => _33.include_alignment_distributions]) ? ["alignment_distributions"] : void 0,
|
|
1356
|
+
only_assignment_alignments: _optionalChain([options, 'optionalAccess', _34 => _34.only_assignment_alignments]),
|
|
1357
|
+
show_unpublished_assignments: _optionalChain([options, 'optionalAccess', _35 => _35.show_unpublished_assignments]),
|
|
1358
|
+
add_defaults: _optionalChain([options, 'optionalAccess', _36 => _36.add_defaults])
|
|
1349
1359
|
})
|
|
1350
1360
|
);
|
|
1351
1361
|
}
|
|
@@ -1502,7 +1512,7 @@ var NewQuizzesModule = class {
|
|
|
1502
1512
|
`/api/quiz/v1/courses/${courseId}/accommodations/${userId}`
|
|
1503
1513
|
);
|
|
1504
1514
|
} catch (err) {
|
|
1505
|
-
if (err instanceof
|
|
1515
|
+
if (err instanceof _chunkWKYLHAWEcjs.CanvasApiError && err.status === 404) return null;
|
|
1506
1516
|
throw err;
|
|
1507
1517
|
}
|
|
1508
1518
|
}
|
|
@@ -1768,14 +1778,14 @@ var AppointmentGroupsModule = class {
|
|
|
1768
1778
|
|
|
1769
1779
|
async list(params) {
|
|
1770
1780
|
const query = {};
|
|
1771
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
1772
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
1773
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
1781
|
+
if (_optionalChain([params, 'optionalAccess', _37 => _37.scope])) query.scope = params.scope;
|
|
1782
|
+
if (_optionalChain([params, 'optionalAccess', _38 => _38.include, 'optionalAccess', _39 => _39.length])) query.include = [...params.include];
|
|
1783
|
+
if (_optionalChain([params, 'optionalAccess', _40 => _40.context_codes, 'optionalAccess', _41 => _41.length])) query.context_codes = params.context_codes;
|
|
1774
1784
|
return this.client.paginate("/api/v1/appointment_groups", query);
|
|
1775
1785
|
}
|
|
1776
1786
|
async get(id, include) {
|
|
1777
1787
|
const query = {};
|
|
1778
|
-
if (_optionalChain([include, 'optionalAccess',
|
|
1788
|
+
if (_optionalChain([include, 'optionalAccess', _42 => _42.length])) query.include = [...include];
|
|
1779
1789
|
return this.client.request(`/api/v1/appointment_groups/${id}`, {
|
|
1780
1790
|
query
|
|
1781
1791
|
});
|
|
@@ -1807,7 +1817,7 @@ var AppointmentGroupsModule = class {
|
|
|
1807
1817
|
}
|
|
1808
1818
|
async nextAppointment(appointmentGroupIds) {
|
|
1809
1819
|
const query = {};
|
|
1810
|
-
if (_optionalChain([appointmentGroupIds, 'optionalAccess',
|
|
1820
|
+
if (_optionalChain([appointmentGroupIds, 'optionalAccess', _43 => _43.length])) query.appointment_group_ids = appointmentGroupIds;
|
|
1811
1821
|
return this.client.request(
|
|
1812
1822
|
"/api/v1/appointment_groups/next_appointment",
|
|
1813
1823
|
{ query }
|
|
@@ -1901,8 +1911,8 @@ function describeReceived(value) {
|
|
|
1901
1911
|
return Array.isArray(value) ? "an array" : `a ${typeof value}`;
|
|
1902
1912
|
}
|
|
1903
1913
|
function issueLabel(path) {
|
|
1904
|
-
for (let index = (_nullishCoalesce(_optionalChain([path, 'optionalAccess',
|
|
1905
|
-
const segment = _optionalChain([path, 'optionalAccess',
|
|
1914
|
+
for (let index = (_nullishCoalesce(_optionalChain([path, 'optionalAccess', _44 => _44.length]), () => ( 0))) - 1; index >= 0; index -= 1) {
|
|
1915
|
+
const segment = _optionalChain([path, 'optionalAccess', _45 => _45[index]]);
|
|
1906
1916
|
if (typeof segment === "string") return segment;
|
|
1907
1917
|
}
|
|
1908
1918
|
return "value";
|
|
@@ -1933,11 +1943,11 @@ function prefixedArm(prefix) {
|
|
|
1933
1943
|
});
|
|
1934
1944
|
}
|
|
1935
1945
|
function canvasIdInput(options) {
|
|
1936
|
-
const sentinels = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1946
|
+
const sentinels = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _46 => _46.sentinels]), () => ( []));
|
|
1937
1947
|
const members = [
|
|
1938
1948
|
numberArm(),
|
|
1939
1949
|
stringArm(),
|
|
1940
|
-
...(_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1950
|
+
...(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _47 => _47.prefixes]), () => ( []))).map(prefixedArm),
|
|
1941
1951
|
...sentinels.length > 0 ? [_zod.z.literal([...sentinels])] : []
|
|
1942
1952
|
];
|
|
1943
1953
|
return _zod.z.union(members, { error: contractMessage }).transform((value) => String(value));
|
|
@@ -1952,8 +1962,8 @@ function compareCanvasIds(a, b) {
|
|
|
1952
1962
|
function normalizeCanvasIdInput(value, options) {
|
|
1953
1963
|
const issue = { input: value };
|
|
1954
1964
|
if (typeof value === "string") {
|
|
1955
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1956
|
-
for (const prefix of _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1965
|
+
if (_optionalChain([options, 'optionalAccess', _48 => _48.sentinels, 'optionalAccess', _49 => _49.includes, 'call', _50 => _50(value)])) return value;
|
|
1966
|
+
for (const prefix of _nullishCoalesce(_optionalChain([options, 'optionalAccess', _51 => _51.prefixes]), () => ( []))) {
|
|
1957
1967
|
if (!value.startsWith(`${prefix}:`)) continue;
|
|
1958
1968
|
if (value.length === prefix.length + 1) throw new TypeError(prefixMessage(prefix)(issue));
|
|
1959
1969
|
return value;
|
|
@@ -2001,7 +2011,7 @@ var CanvasClient = class {
|
|
|
2001
2011
|
|
|
2002
2012
|
|
|
2003
2013
|
constructor(config) {
|
|
2004
|
-
this.client = new (0,
|
|
2014
|
+
this.client = new (0, _chunkWKYLHAWEcjs.CanvasHttpClient)(config);
|
|
2005
2015
|
this.courses = new CoursesModule(this.client);
|
|
2006
2016
|
this.assignments = new AssignmentsModule(this.client);
|
|
2007
2017
|
this.submissions = new SubmissionsModule(this.client);
|
|
@@ -2050,4 +2060,4 @@ var CanvasClient = class {
|
|
|
2050
2060
|
|
|
2051
2061
|
|
|
2052
2062
|
exports.mapWithConcurrency = mapWithConcurrency; exports.SEARCH_CONTENT_TYPES = SEARCH_CONTENT_TYPES; exports.OUTCOME_CONTEXT_TYPES = OUTCOME_CONTEXT_TYPES; exports.OUTCOME_DETAIL_LEVELS = OUTCOME_DETAIL_LEVELS; exports.OUTCOME_ROLLUP_AGGREGATE_STATS = OUTCOME_ROLLUP_AGGREGATE_STATS; exports.OUTCOME_ROLLUP_SORT_BY = OUTCOME_ROLLUP_SORT_BY; exports.OUTCOME_SORT_ORDER = OUTCOME_SORT_ORDER; exports.OUTCOME_EXCLUDE_OPTIONS = OUTCOME_EXCLUDE_OPTIONS; exports.CANVAS_MAX_ID = CANVAS_MAX_ID; exports.MAX_SAFE_CANVAS_NUMBER_ID = MAX_SAFE_CANVAS_NUMBER_ID; exports.canvasIdInput = canvasIdInput; exports.canvasIdList = canvasIdList; exports.compareCanvasIds = compareCanvasIds; exports.normalizeCanvasIdInput = normalizeCanvasIdInput; exports.CanvasClient = CanvasClient;
|
|
2053
|
-
//# sourceMappingURL=chunk-
|
|
2063
|
+
//# sourceMappingURL=chunk-BCKOQCPP.cjs.map
|