@instructure/platform-mock-canvas-api 0.6.0 → 0.8.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/index.js CHANGED
@@ -1,154 +1,789 @@
1
- import { courses as b, educatorAccessibilityCourseStatistics as _, moduleScenariosByCourseId as j, submissionsStore as m } from "./fixtures.js";
2
- import { MODULES_SMALL_MODULE_COUNT as D, MODULE_ITEMS_INLINE_LIMIT as F, buildCanvasCourseModules as O, mockEducatorAccessibilityStatistic as B, modulesCourseEmpty as G, modulesCourseFatModule as $, modulesCourseLarge as K, modulesCourseSmall as X, stickerDescriptions as Y, stickerTranslations as q, submissions as z } from "./fixtures.js";
3
- import { http as u, HttpResponse as t } from "msw";
4
- const S = [
5
- // GET /api/v1/courses
6
- u.get("/api/v1/courses", () => t.json(b)),
7
- // GET /api/v1/courses/:courseId (courseId may be a numeric id or a `uuid:<uuid>` ref)
8
- u.get("/api/v1/courses/:courseId", ({ params: e }) => {
9
- const s = String(e.courseId).replace(/^uuid:/, ""), n = b.find((o) => o.id === s || o.uuid === s);
10
- return n ? t.json(n) : t.json({ errors: [{ message: "Course not found" }] }, { status: 404 });
11
- })
12
- ], P = [
13
- u.get("/api/v1/users/:userId/educator_accessibility_course_statistics", () => t.json(_))
14
- ], M = 10, L = 100, d = () => t.json(
1
+ import { moduleScenariosByCourseId as y, courses as b, educatorAccessibilityCourseStatistics as M, submissionsStore as m } from "./fixtures.js";
2
+ import { MODULES_SMALL_MODULE_COUNT as St, MODULE_ITEMS_INLINE_LIMIT as jt, buildCanvasCourseModules as Ht, mockEducatorAccessibilityStatistic as vt, modulesCourseEmpty as Et, modulesCourseFatModule as Dt, modulesCourseLarge as Pt, modulesCourseSmall as At, stickerDescriptions as Nt, stickerTranslations as Ot, submissions as Ut } from "./fixtures.js";
3
+ import { http as c, HttpResponse as s } from "msw";
4
+ const I = 10, w = 100, u = () => s.json(
15
5
  { errors: [{ message: "The specified resource does not exist." }] },
16
6
  {
17
7
  status: 404
18
8
  }
19
- ), g = /* @__PURE__ */ new Map(), p = (e) => {
20
- const s = g.get(e);
21
- if (s) return s;
22
- const n = j[e];
23
- if (!n) return;
24
- const o = n();
25
- return g.set(e, o), o;
9
+ ), p = /* @__PURE__ */ new Map(), h = (t) => {
10
+ const e = p.get(t);
11
+ if (e) return e;
12
+ const o = y[t];
13
+ if (!o) return;
14
+ const a = o();
15
+ return p.set(t, a), a;
26
16
  };
27
- function x() {
28
- g.clear();
17
+ function Ct() {
18
+ p.clear();
29
19
  }
30
- const f = (e) => {
31
- const s = Number.parseInt(e.searchParams.get("per_page") ?? "", 10), n = Number.parseInt(e.searchParams.get("page") ?? "", 10);
20
+ const k = (t) => {
21
+ const e = Number.parseInt(t.searchParams.get("per_page") ?? "", 10), o = Number.parseInt(t.searchParams.get("page") ?? "", 10);
32
22
  return {
33
- perPage: Number.isFinite(s) && s > 0 ? Math.min(s, L) : M,
34
- page: Number.isFinite(n) && n > 0 ? n : 1
23
+ perPage: Number.isFinite(e) && e > 0 ? Math.min(e, w) : I,
24
+ page: Number.isFinite(o) && o > 0 ? o : 1
35
25
  };
36
- }, k = (e) => [...e.searchParams.getAll("include[]"), ...e.searchParams.getAll("include")].flatMap(
37
- (s) => s.split(",")
38
- ), v = (e, s, n) => {
39
- const o = new URL(e.href);
40
- return o.searchParams.set("page", String(s)), o.searchParams.set("per_page", String(n)), o.href;
26
+ }, C = (t) => [...t.searchParams.getAll("include[]"), ...t.searchParams.getAll("include")].flatMap(
27
+ (e) => e.split(",")
28
+ ), T = (t, e, o) => {
29
+ const a = new URL(t.href);
30
+ return a.searchParams.set("page", String(e)), a.searchParams.set("per_page", String(o)), a.href;
41
31
  };
42
- function h(e, s, n, o) {
43
- const r = Math.max(1, Math.ceil(o / n)), i = [["current", s]];
44
- return s < r && i.push(["next", s + 1]), s > 1 && i.push(["prev", s - 1]), i.push(["first", 1], ["last", r]), i.map(([c, a]) => `<${v(e, a, n)}>; rel="${c}"`).join(",");
32
+ function f(t, e, o, a) {
33
+ const n = Math.max(1, Math.ceil(a / o)), r = [["current", e]];
34
+ return e < n && r.push(["next", e + 1]), e > 1 && r.push(["prev", e - 1]), r.push(["first", 1], ["last", n]), r.map(([i, d]) => `<${T(t, d, o)}>; rel="${i}"`).join(",");
45
35
  }
46
- const y = (e) => {
47
- const s = { ...e };
48
- return delete s.items, s;
49
- }, w = [
36
+ const Z = (t) => {
37
+ const e = { ...t };
38
+ return delete e.items, e;
39
+ }, L = [
50
40
  // GET /api/v1/courses/:courseId/modules
51
- u.get("/api/v1/courses/:courseId/modules", ({ params: e, request: s }) => {
52
- const n = p(String(e.courseId));
53
- if (!n) return d();
54
- const o = new URL(s.url), { page: r, perPage: i } = f(o), c = k(o).includes("items"), a = (r - 1) * i, l = n.modules.slice(a, a + i).map((I) => c ? I : y(I));
55
- return t.json(l, {
56
- headers: { Link: h(o, r, i, n.modules.length) }
41
+ c.get("/api/v1/courses/:courseId/modules", ({ params: t, request: e }) => {
42
+ const o = h(String(t.courseId));
43
+ if (!o) return u();
44
+ const a = new URL(e.url), { page: n, perPage: r } = k(a), i = C(a).includes("items"), d = (n - 1) * r, l = o.modules.slice(d, d + r).map((g) => i ? g : Z(g));
45
+ return s.json(l, {
46
+ headers: { Link: f(a, n, r, o.modules.length) }
57
47
  });
58
48
  }),
59
49
  // GET /api/v1/courses/:courseId/modules/:moduleId/items
60
- u.get("/api/v1/courses/:courseId/modules/:moduleId/items", ({ params: e, request: s }) => {
61
- const n = p(String(e.courseId));
62
- if (!n) return d();
63
- const o = String(e.moduleId), r = n.itemsByModuleId[o];
64
- if (!r) return d();
65
- const i = new URL(s.url), { page: c, perPage: a } = f(i), l = (c - 1) * a;
66
- return t.json(r.slice(l, l + a), {
67
- headers: { Link: h(i, c, a, r.length) }
50
+ c.get("/api/v1/courses/:courseId/modules/:moduleId/items", ({ params: t, request: e }) => {
51
+ const o = h(String(t.courseId));
52
+ if (!o) return u();
53
+ const a = String(t.moduleId), n = o.itemsByModuleId[a];
54
+ if (!n) return u();
55
+ const r = new URL(e.url), { page: i, perPage: d } = k(r), l = (i - 1) * d;
56
+ return s.json(n.slice(l, l + d), {
57
+ headers: { Link: f(r, i, d, n.length) }
68
58
  });
69
59
  }),
70
60
  // POST /courses/:courseId/modules/:moduleId/collapse
71
61
  //
72
62
  // Mirrors `ContextModulesController#toggle_collapse`: collapsing returns the
73
63
  // progression, uncollapsing returns the module's content tags.
74
- u.post("/courses/:courseId/modules/:moduleId/collapse", async ({ params: e, request: s }) => {
75
- const n = p(String(e.courseId));
76
- if (!n) return d();
77
- const o = Number(e.moduleId);
78
- if (!n.modules.some((c) => c.id === o)) return d();
79
- const r = await s.json().catch(() => null), i = !!(r != null && r.collapse);
80
- return t.json(i ? { collapsed: !0 } : []);
64
+ c.post("/courses/:courseId/modules/:moduleId/collapse", async ({ params: t, request: e }) => {
65
+ const o = h(String(t.courseId));
66
+ if (!o) return u();
67
+ const a = Number(t.moduleId);
68
+ if (!o.modules.some((i) => i.id === a)) return u();
69
+ const n = await e.json().catch(() => null), r = !!(n != null && n.collapse);
70
+ return s.json(r ? { collapsed: !0 } : []);
81
71
  }),
82
72
  // POST /courses/:courseId/collapse_all_modules
83
73
  //
84
74
  // Mirrors `ContextModulesController#toggle_collapse_all`.
85
- u.post("/courses/:courseId/collapse_all_modules", ({ params: e, request: s }) => !p(String(e.courseId)) || !new URL(s.url).searchParams.has("collapse") ? d() : t.json({}))
86
- ], A = 300, C = [
75
+ c.post("/courses/:courseId/collapse_all_modules", ({ params: t, request: e }) => !h(String(t.courseId)) || !new URL(e.url).searchParams.has("collapse") ? u() : s.json({}))
76
+ ], _ = (t, e) => {
77
+ const o = Number.parseInt(t.searchParams.get("per_page") ?? "", 10), a = Number.parseInt(t.searchParams.get("page") ?? "", 10), n = Number.isFinite(o) && o > 0 ? Math.min(o, 100) : 10, r = Number.isFinite(a) && a > 0 ? a : 1, i = (r - 1) * n;
78
+ return {
79
+ body: e.slice(i, i + n),
80
+ headers: { Link: f(t, r, n, e.length) }
81
+ };
82
+ }, S = () => [
83
+ {
84
+ id: 4002,
85
+ root_account_id: 1,
86
+ root_cohort_id: 4001,
87
+ account_id: 17,
88
+ parent_cohort_id: 4001,
89
+ name: "Mercy General Hospital",
90
+ description: "Mercy's flagship acute care hospital.",
91
+ depth: 2,
92
+ workflow_state: "active",
93
+ sis_source_id: "HS-MERCY-GEN",
94
+ sis_batch_id: null,
95
+ stuck_sis_fields: [],
96
+ created_at: "2026-09-02T09:15:41Z",
97
+ updated_at: "2026-09-10T11:03:20Z",
98
+ member_count: 1420,
99
+ child_count: 6
100
+ },
101
+ {
102
+ id: 4003,
103
+ root_account_id: 1,
104
+ root_cohort_id: 4001,
105
+ account_id: 1,
106
+ parent_cohort_id: 4001,
107
+ name: "Mercy Children's Hospital",
108
+ description: "Mercy's pediatric hospital.",
109
+ depth: 2,
110
+ workflow_state: "active",
111
+ sis_source_id: "HS-MERCY-CHI",
112
+ sis_batch_id: null,
113
+ stuck_sis_fields: [],
114
+ created_at: "2026-09-02T09:16:02Z",
115
+ updated_at: "2026-09-02T09:16:02Z",
116
+ member_count: 640,
117
+ child_count: 3
118
+ }
119
+ ], j = () => ({
120
+ id: 4002,
121
+ root_account_id: 1,
122
+ root_cohort_id: 4001,
123
+ account_id: 17,
124
+ parent_cohort_id: 4001,
125
+ name: "Mercy General Hospital",
126
+ description: "Mercy's flagship acute care hospital.",
127
+ depth: 2,
128
+ workflow_state: "active",
129
+ sis_source_id: "HS-MERCY-GEN",
130
+ sis_batch_id: 88,
131
+ stuck_sis_fields: ["name"],
132
+ created_at: "2026-09-02T09:15:41Z",
133
+ updated_at: "2026-09-10T11:03:20Z"
134
+ }), H = () => ({
135
+ id: 4002,
136
+ root_account_id: 1,
137
+ root_cohort_id: 4001,
138
+ account_id: 17,
139
+ parent_cohort_id: 4001,
140
+ name: "Mercy General Hospital",
141
+ description: "Mercy's flagship acute care hospital.",
142
+ depth: 2,
143
+ workflow_state: "active",
144
+ sis_source_id: "HS-MERCY-GEN",
145
+ sis_batch_id: 88,
146
+ stuck_sis_fields: ["name"],
147
+ created_at: "2026-09-02T09:15:41Z",
148
+ updated_at: "2026-09-10T11:03:20Z"
149
+ }), v = () => ({
150
+ id: 4002,
151
+ root_account_id: 1,
152
+ root_cohort_id: 4001,
153
+ account_id: 17,
154
+ parent_cohort_id: 4001,
155
+ name: "Mercy General Hospital",
156
+ description: "Mercy's flagship acute care hospital.",
157
+ depth: 2,
158
+ workflow_state: "active",
159
+ sis_source_id: "HS-MERCY-GEN",
160
+ sis_batch_id: 88,
161
+ stuck_sis_fields: ["name"],
162
+ created_at: "2026-09-02T09:15:41Z",
163
+ updated_at: "2026-09-10T11:03:20Z"
164
+ }), E = () => ({
165
+ id: 4002,
166
+ root_account_id: 1,
167
+ root_cohort_id: 4001,
168
+ account_id: 17,
169
+ parent_cohort_id: 4001,
170
+ name: "Mercy General Hospital",
171
+ description: "Mercy's flagship acute care hospital.",
172
+ depth: 2,
173
+ workflow_state: "deleted",
174
+ sis_source_id: "HS-MERCY-GEN",
175
+ sis_batch_id: 88,
176
+ stuck_sis_fields: ["name"],
177
+ created_at: "2026-09-02T09:15:41Z",
178
+ updated_at: "2026-09-12T16:44:00Z"
179
+ }), D = () => ({
180
+ cohort: {
181
+ id: 4002,
182
+ root_account_id: 1,
183
+ root_cohort_id: 4001,
184
+ account_id: 17,
185
+ parent_cohort_id: 4001,
186
+ name: "Mercy General Hospital",
187
+ description: "Mercy's flagship acute care hospital.",
188
+ depth: 2,
189
+ workflow_state: "active",
190
+ sis_source_id: "HS-MERCY-GEN",
191
+ sis_batch_id: null,
192
+ stuck_sis_fields: [],
193
+ created_at: "2026-09-02T09:15:41Z",
194
+ updated_at: "2026-09-10T11:03:20Z"
195
+ },
196
+ truncated: !1,
197
+ children_truncated: !1,
198
+ children: [
199
+ {
200
+ cohort: {
201
+ id: 4010,
202
+ root_account_id: 1,
203
+ root_cohort_id: 4001,
204
+ account_id: 17,
205
+ parent_cohort_id: 4002,
206
+ name: "Emergency Department",
207
+ description: null,
208
+ depth: 3,
209
+ workflow_state: "active",
210
+ sis_source_id: null,
211
+ sis_batch_id: null,
212
+ stuck_sis_fields: [],
213
+ created_at: "2026-09-03T08:00:00Z",
214
+ updated_at: "2026-09-03T08:00:00Z"
215
+ },
216
+ truncated: !0,
217
+ children_truncated: !1,
218
+ children: []
219
+ }
220
+ ]
221
+ }), P = () => ({
222
+ manage_cohorts_view: !0,
223
+ manage_cohorts_create: !0,
224
+ manage_cohorts_edit: !0,
225
+ manage_cohorts_remove: !0,
226
+ manage_cohorts_enrollment_scopes: !1,
227
+ manage_cohorts_add_members: !0,
228
+ manage_cohorts_remove_members: !0,
229
+ manage_cohorts_add_leaders: !1,
230
+ manage_cohorts_remove_leaders: !1,
231
+ manage_cohorts_view_analytics: !1
232
+ }), A = () => [
233
+ {
234
+ id: 77001,
235
+ cohort_id: 4002,
236
+ user_id: 901,
237
+ root_account_id: 1,
238
+ workflow_state: "active",
239
+ sis_batch_id: null,
240
+ created_at: "2026-09-04T10:00:00Z",
241
+ updated_at: "2026-09-04T10:00:00Z",
242
+ user: {
243
+ id: 901,
244
+ name: "Dana Okafor",
245
+ sortable_name: "Okafor, Dana",
246
+ short_name: "Dana",
247
+ avatar_url: "https://canvas.example.edu/images/messages/avatar-50.png"
248
+ }
249
+ },
250
+ {
251
+ id: 77002,
252
+ cohort_id: 4002,
253
+ user_id: 902,
254
+ root_account_id: 1,
255
+ workflow_state: "active",
256
+ sis_batch_id: null,
257
+ created_at: "2026-09-04T10:00:01Z",
258
+ updated_at: "2026-09-04T10:00:01Z",
259
+ user: {
260
+ id: 902,
261
+ name: "Sam Whitfield",
262
+ sortable_name: "Whitfield, Sam",
263
+ short_name: "Sam",
264
+ avatar_url: "https://canvas.example.edu/images/messages/avatar-50.png"
265
+ }
266
+ }
267
+ ], N = () => ({
268
+ added: [
269
+ {
270
+ id: 77010,
271
+ cohort_id: 4002,
272
+ user_id: 901,
273
+ root_account_id: 1,
274
+ workflow_state: "active",
275
+ sis_batch_id: null,
276
+ created_at: "2026-09-12T12:00:00Z",
277
+ updated_at: "2026-09-12T12:00:00Z",
278
+ user: { id: 901, name: "Dana Okafor", sortable_name: "Okafor, Dana", short_name: "Dana" }
279
+ },
280
+ {
281
+ id: 77011,
282
+ cohort_id: 4002,
283
+ user_id: 902,
284
+ root_account_id: 1,
285
+ workflow_state: "active",
286
+ sis_batch_id: null,
287
+ created_at: "2026-09-12T12:00:00Z",
288
+ updated_at: "2026-09-12T12:00:00Z",
289
+ user: { id: 902, name: "Sam Whitfield", sortable_name: "Whitfield, Sam", short_name: "Sam" }
290
+ }
291
+ ],
292
+ skipped: [{ user_id: 903, reason: "already_member" }]
293
+ }), O = () => ({
294
+ id: 77001,
295
+ cohort_id: 4002,
296
+ user_id: 901,
297
+ root_account_id: 1,
298
+ workflow_state: "deleted",
299
+ sis_batch_id: null,
300
+ created_at: "2026-09-04T10:00:00Z",
301
+ updated_at: "2026-09-12T17:20:05Z",
302
+ user: { id: 901, name: "Dana Okafor", sortable_name: "Okafor, Dana", short_name: "Dana" }
303
+ }), U = () => [
304
+ {
305
+ id: 88001,
306
+ user_id: 901,
307
+ course_id: 610,
308
+ course_section_id: 720,
309
+ root_account_id: 1,
310
+ type: "StudentEnrollment",
311
+ role: "StudentEnrollment",
312
+ role_id: 3,
313
+ enrollment_state: "active",
314
+ created_at: "2026-09-05T12:00:00Z",
315
+ updated_at: "2026-09-05T12:00:00Z",
316
+ last_activity_at: "2026-09-20T10:15:00Z",
317
+ user: {
318
+ id: 901,
319
+ name: "Dana Okafor",
320
+ sortable_name: "Okafor, Dana",
321
+ short_name: "Dana",
322
+ avatar_url: "https://canvas.example.edu/images/messages/avatar-50.png"
323
+ }
324
+ },
325
+ {
326
+ id: 88002,
327
+ user_id: 902,
328
+ course_id: 611,
329
+ course_section_id: 731,
330
+ root_account_id: 1,
331
+ type: "StudentEnrollment",
332
+ role: "StudentEnrollment",
333
+ role_id: 3,
334
+ enrollment_state: "invited",
335
+ created_at: "2026-09-05T12:00:01Z",
336
+ updated_at: "2026-09-05T12:00:01Z",
337
+ last_activity_at: null,
338
+ user: {
339
+ id: 902,
340
+ name: "Sam Whitfield",
341
+ sortable_name: "Whitfield, Sam",
342
+ short_name: "Sam",
343
+ avatar_url: "https://canvas.example.edu/images/messages/avatar-50.png"
344
+ }
345
+ }
346
+ ], G = () => [
347
+ {
348
+ id: 5501,
349
+ cohort_id: 4002,
350
+ user_id: 901,
351
+ root_account_id: 1,
352
+ role_id: 12,
353
+ role: { id: 12, label: "Cohort Leader", base_role_type: "CohortLeader" },
354
+ applies_to_descendants: !0,
355
+ inherited: !1,
356
+ source_cohort_id: 4002,
357
+ workflow_state: "active",
358
+ created_at: "2026-09-05T13:30:00Z",
359
+ updated_at: "2026-09-05T13:30:00Z",
360
+ user: { id: 901, name: "Dana Okafor", sortable_name: "Okafor, Dana", short_name: "Dana" }
361
+ },
362
+ {
363
+ id: 5480,
364
+ cohort_id: 4002,
365
+ user_id: 950,
366
+ root_account_id: 1,
367
+ role_id: 12,
368
+ role: { id: 12, label: "Cohort Leader", base_role_type: "CohortLeader" },
369
+ applies_to_descendants: !0,
370
+ inherited: !0,
371
+ source_cohort_id: 4001,
372
+ workflow_state: "active",
373
+ created_at: "2026-09-01T15:00:00Z",
374
+ updated_at: "2026-09-01T15:00:00Z",
375
+ user: { id: 950, name: "Priya Raman", sortable_name: "Raman, Priya", short_name: "Priya" }
376
+ }
377
+ ], x = () => ({
378
+ id: 5501,
379
+ cohort_id: 4002,
380
+ user_id: 901,
381
+ root_account_id: 1,
382
+ role_id: 12,
383
+ role: { id: 12, label: "Cohort Leader", base_role_type: "CohortLeader" },
384
+ applies_to_descendants: !0,
385
+ inherited: !1,
386
+ source_cohort_id: 4002,
387
+ workflow_state: "active",
388
+ created_at: "2026-09-05T13:30:00Z",
389
+ updated_at: "2026-09-05T13:30:00Z",
390
+ user: { id: 901, name: "Dana Okafor", sortable_name: "Okafor, Dana", short_name: "Dana" }
391
+ }), F = () => ({
392
+ id: 5501,
393
+ cohort_id: 4002,
394
+ user_id: 901,
395
+ root_account_id: 1,
396
+ role_id: 77,
397
+ role: { id: 77, label: "Ward Lead", base_role_type: "CohortLeader" },
398
+ applies_to_descendants: !0,
399
+ inherited: !1,
400
+ source_cohort_id: 4002,
401
+ workflow_state: "active",
402
+ created_at: "2026-09-05T13:30:00Z",
403
+ updated_at: "2026-09-14T09:15:00Z",
404
+ user: { id: 901, name: "Dana Okafor", sortable_name: "Okafor, Dana", short_name: "Dana" }
405
+ }), Y = () => ({
406
+ id: 5501,
407
+ cohort_id: 4002,
408
+ user_id: 901,
409
+ root_account_id: 1,
410
+ role_id: 12,
411
+ role: { id: 12, label: "Cohort Leader", base_role_type: "CohortLeader" },
412
+ applies_to_descendants: !0,
413
+ inherited: !1,
414
+ source_cohort_id: 4002,
415
+ workflow_state: "deleted",
416
+ created_at: "2026-09-05T13:30:00Z",
417
+ updated_at: "2026-09-12T18:02:11Z",
418
+ user: { id: 901, name: "Dana Okafor", sortable_name: "Okafor, Dana", short_name: "Dana" }
419
+ }), W = () => [
420
+ {
421
+ id: 8001,
422
+ cohort_id: 4002,
423
+ scopable_type: "account",
424
+ scopable_id: "5",
425
+ applies_to_descendants: !0,
426
+ created_at: "2026-09-18T09:00:00Z",
427
+ updated_at: "2026-09-18T09:00:00Z"
428
+ },
429
+ {
430
+ id: 8002,
431
+ cohort_id: 4002,
432
+ scopable_type: "course",
433
+ scopable_id: "42",
434
+ applies_to_descendants: !1,
435
+ created_at: "2026-09-18T09:00:01Z",
436
+ updated_at: "2026-09-18T09:00:01Z"
437
+ },
438
+ {
439
+ id: 8003,
440
+ cohort_id: 4002,
441
+ scopable_type: "program",
442
+ scopable_id: "prog_88213",
443
+ applies_to_descendants: !1,
444
+ created_at: "2026-09-18T09:00:02Z",
445
+ updated_at: "2026-09-18T09:00:02Z"
446
+ }
447
+ ], q = () => ({
448
+ id: 8002,
449
+ cohort_id: 4002,
450
+ scopable_type: "course",
451
+ scopable_id: "42",
452
+ applies_to_descendants: !1,
453
+ created_at: "2026-09-18T09:00:01Z",
454
+ updated_at: "2026-09-18T09:00:01Z"
455
+ }), B = () => ({
456
+ id: 8002,
457
+ cohort_id: 4002,
458
+ scopable_type: "course",
459
+ scopable_id: "42",
460
+ applies_to_descendants: !1,
461
+ created_at: "2026-09-18T09:00:01Z",
462
+ updated_at: "2026-09-20T11:15:00Z"
463
+ }), $ = () => ({
464
+ id: 3312,
465
+ context_id: 1,
466
+ context_type: "Account",
467
+ user_id: 950,
468
+ tag: "bulk_enrollment",
469
+ completion: 0,
470
+ workflow_state: "queued",
471
+ created_at: "2026-09-12T19:00:00Z",
472
+ updated_at: "2026-09-12T19:00:00Z",
473
+ message: null,
474
+ results: null,
475
+ url: "https://canvas.example.edu/api/v1/progress/3312"
476
+ }), K = () => ({
477
+ id: 220,
478
+ subject: "Flu season training",
479
+ message: "Complete your annual training by 1 November.",
480
+ start_at: "2026-10-01T00:00:00Z",
481
+ end_at: "2026-11-01T00:00:00Z",
482
+ icon: "information",
483
+ roles: [],
484
+ role_ids: [],
485
+ author: null,
486
+ cohort_ids: [4002, 4003]
487
+ }), X = () => ({
488
+ id: 220,
489
+ subject: "Flu season training",
490
+ message: "Complete your annual training by 1 November.",
491
+ start_at: "2026-10-01T00:00:00Z",
492
+ end_at: "2026-11-01T00:00:00Z",
493
+ icon: "information",
494
+ roles: [],
495
+ role_ids: [],
496
+ author: null,
497
+ cohort_ids: [4002, 4003]
498
+ }), z = (t, e) => c.get(
499
+ "/api/v1/accounts/:accountId/cohorts",
500
+ async (o) => {
501
+ const a = t !== void 0 ? typeof t == "function" ? await t(o) : t : S(), { body: n, headers: r } = _(new URL(o.request.url), a);
502
+ return s.json(n, { status: 200, headers: r });
503
+ },
504
+ e
505
+ ), J = (t, e) => c.post(
506
+ "/api/v1/accounts/:accountId/cohorts",
507
+ async (o) => s.json(
508
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : j(),
509
+ { status: 200 }
510
+ ),
511
+ e
512
+ ), Q = (t, e) => c.get(
513
+ "/api/v1/accounts/:accountId/cohorts/:cohortId",
514
+ async (o) => s.json(
515
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : H(),
516
+ { status: 200 }
517
+ ),
518
+ e
519
+ ), V = (t, e) => c.put(
520
+ "/api/v1/accounts/:accountId/cohorts/:cohortId",
521
+ async (o) => s.json(
522
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : v(),
523
+ { status: 200 }
524
+ ),
525
+ e
526
+ ), R = (t, e) => c.delete(
527
+ "/api/v1/accounts/:accountId/cohorts/:cohortId",
528
+ async (o) => s.json(
529
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : E(),
530
+ { status: 200 }
531
+ ),
532
+ e
533
+ ), tt = (t, e) => c.get(
534
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/tree",
535
+ async (o) => s.json(
536
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : D(),
537
+ { status: 200 }
538
+ ),
539
+ e
540
+ ), et = (t, e) => c.get(
541
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/permissions",
542
+ async (o) => s.json(
543
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : P(),
544
+ { status: 200 }
545
+ ),
546
+ e
547
+ ), ot = (t, e) => c.get(
548
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/members",
549
+ async (o) => {
550
+ const a = t !== void 0 ? typeof t == "function" ? await t(o) : t : A(), { body: n, headers: r } = _(new URL(o.request.url), a);
551
+ return s.json(n, { status: 200, headers: r });
552
+ },
553
+ e
554
+ ), at = (t, e) => c.post(
555
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/members",
556
+ async (o) => s.json(
557
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : N(),
558
+ { status: 200 }
559
+ ),
560
+ e
561
+ ), st = (t, e) => c.delete(
562
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/members/:userId",
563
+ async (o) => s.json(
564
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : O(),
565
+ { status: 200 }
566
+ ),
567
+ e
568
+ ), ct = (t, e) => c.get(
569
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/enrollments",
570
+ async (o) => {
571
+ const a = t !== void 0 ? typeof t == "function" ? await t(o) : t : U(), { body: n, headers: r } = _(new URL(o.request.url), a);
572
+ return s.json(n, { status: 200, headers: r });
573
+ },
574
+ e
575
+ ), nt = (t, e) => c.get(
576
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/leaders",
577
+ async (o) => {
578
+ const a = t !== void 0 ? typeof t == "function" ? await t(o) : t : G(), { body: n, headers: r } = _(new URL(o.request.url), a);
579
+ return s.json(n, { status: 200, headers: r });
580
+ },
581
+ e
582
+ ), rt = (t, e) => c.post(
583
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/leaders",
584
+ async (o) => s.json(
585
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : x(),
586
+ { status: 200 }
587
+ ),
588
+ e
589
+ ), it = (t, e) => c.put(
590
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/leaders/:cohortLeaderId",
591
+ async (o) => s.json(
592
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : F(),
593
+ { status: 200 }
594
+ ),
595
+ e
596
+ ), dt = (t, e) => c.delete(
597
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/leaders/:cohortLeaderId",
598
+ async (o) => s.json(
599
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : Y(),
600
+ { status: 200 }
601
+ ),
602
+ e
603
+ ), ut = (t, e) => c.get(
604
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/enrollment_scopes",
605
+ async (o) => {
606
+ const a = t !== void 0 ? typeof t == "function" ? await t(o) : t : W(), { body: n, headers: r } = _(new URL(o.request.url), a);
607
+ return s.json(n, { status: 200, headers: r });
608
+ },
609
+ e
610
+ ), _t = (t, e) => c.post(
611
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/enrollment_scopes",
612
+ async (o) => s.json(
613
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : q(),
614
+ { status: 200 }
615
+ ),
616
+ e
617
+ ), lt = (t, e) => c.delete(
618
+ "/api/v1/accounts/:accountId/cohorts/:cohortId/enrollment_scopes/:scopeId",
619
+ async (o) => s.json(
620
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : B(),
621
+ { status: 200 }
622
+ ),
623
+ e
624
+ ), mt = (t, e) => c.post(
625
+ "/api/v1/accounts/:accountId/bulk_enrollment",
626
+ async (o) => s.json(
627
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : $(),
628
+ { status: 200 }
629
+ ),
630
+ e
631
+ ), ht = (t, e) => c.post(
632
+ "/api/v1/accounts/:accountId/account_notifications",
633
+ async (o) => s.json(
634
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : K(),
635
+ { status: 200 }
636
+ ),
637
+ e
638
+ ), pt = (t, e) => c.put(
639
+ "/api/v1/accounts/:accountId/account_notifications/:id",
640
+ async (o) => s.json(
641
+ t !== void 0 ? typeof t == "function" ? await t(o) : t : X(),
642
+ { status: 200 }
643
+ ),
644
+ e
645
+ ), ft = [
646
+ z(),
647
+ J(),
648
+ Q(),
649
+ V(),
650
+ R(),
651
+ tt(),
652
+ et(),
653
+ ot(),
654
+ at(),
655
+ st(),
656
+ ct(),
657
+ nt(),
658
+ rt(),
659
+ it(),
660
+ dt(),
661
+ ut(),
662
+ _t(),
663
+ lt(),
664
+ mt(),
665
+ ht(),
666
+ pt()
667
+ ], gt = [
668
+ // GET /api/v1/courses
669
+ c.get("/api/v1/courses", () => s.json(b)),
670
+ // GET /api/v1/courses/:courseId (courseId may be a numeric id or a `uuid:<uuid>` ref)
671
+ c.get("/api/v1/courses/:courseId", ({ params: t }) => {
672
+ const e = String(t.courseId).replace(/^uuid:/, ""), o = b.find((a) => a.id === e || a.uuid === e);
673
+ return o ? s.json(o) : s.json({ errors: [{ message: "Course not found" }] }, { status: 404 });
674
+ })
675
+ ], bt = [
676
+ c.get("/api/v1/users/:userId/educator_accessibility_course_statistics", () => s.json(M))
677
+ ], kt = 300, yt = [
87
678
  // GET submission
88
- u.get(
679
+ c.get(
89
680
  "/api/v1/courses/:courseId/assignments/:assignmentId/submissions/:submissionId",
90
- ({ params: e }) => {
91
- const s = m.get(e.submissionId);
92
- return s ? t.json(s) : t.json({ errors: [{ message: "Submission not found" }] }, { status: 404 });
681
+ ({ params: t }) => {
682
+ const e = m.get(t.submissionId);
683
+ return e ? s.json(e) : s.json({ errors: [{ message: "Submission not found" }] }, { status: 404 });
93
684
  }
94
685
  ),
95
686
  // PATCH submission (update sticker)
96
- u.patch(
687
+ c.patch(
97
688
  "/api/v1/courses/:courseId/assignments/:assignmentId/submissions/:submissionId",
98
- async ({ params: e, request: s }) => {
99
- const { submissionId: n } = e, o = await s.json(), r = m.get(n);
100
- return r ? (o.submission && "sticker" in o.submission && o.submission.sticker !== void 0 && (r.sticker = o.submission.sticker, m.set(n, r)), await new Promise((i) => setTimeout(i, A)), t.json(r)) : t.json({ errors: [{ message: "Submission not found" }] }, { status: 404 });
689
+ async ({ params: t, request: e }) => {
690
+ const { submissionId: o } = t, a = await e.json(), n = m.get(o);
691
+ return n ? (a.submission && "sticker" in a.submission && a.submission.sticker !== void 0 && (n.sticker = a.submission.sticker, m.set(o, n)), await new Promise((r) => setTimeout(r, kt)), s.json(n)) : s.json({ errors: [{ message: "Submission not found" }] }, { status: 404 });
101
692
  }
102
693
  ),
103
694
  // GET all submissions for an assignment
104
- u.get("/api/v1/courses/:courseId/assignments/:assignmentId/submissions", ({ params: e }) => {
105
- const s = Array.from(m.values()).filter(
106
- (n) => n.course_id === e.courseId && n.assignment_id === e.assignmentId
695
+ c.get("/api/v1/courses/:courseId/assignments/:assignmentId/submissions", ({ params: t }) => {
696
+ const e = Array.from(m.values()).filter(
697
+ (o) => o.course_id === t.courseId && o.assignment_id === t.assignmentId
107
698
  );
108
- return t.json(s);
699
+ return s.json(e);
109
700
  })
110
- ], E = [
701
+ ], Mt = [
111
702
  // PUT /api/v1/users/:userId/colors/:assetString -> persist a course color
112
- u.put("/api/v1/users/:userId/colors/:assetString", async ({ request: e }) => {
113
- const s = await e.json().catch(() => ({}));
114
- return t.json({ hexcode: s.hexcode ?? "" });
703
+ c.put("/api/v1/users/:userId/colors/:assetString", async ({ request: t }) => {
704
+ const e = await t.json().catch(() => ({}));
705
+ return s.json({ hexcode: e.hexcode ?? "" });
115
706
  }),
116
707
  // PUT /api/v1/users/self/course_nicknames/:courseId -> set a nickname
117
- u.put("/api/v1/users/self/course_nicknames/:courseId", async ({ request: e }) => {
118
- const s = await e.json().catch(() => ({}));
119
- return t.json({ nickname: s.nickname ?? "", name: s.nickname ?? "" });
708
+ c.put("/api/v1/users/self/course_nicknames/:courseId", async ({ request: t }) => {
709
+ const e = await t.json().catch(() => ({}));
710
+ return s.json({ nickname: e.nickname ?? "", name: e.nickname ?? "" });
120
711
  }),
121
712
  // DELETE /api/v1/users/self/course_nicknames/:courseId -> clear a nickname
122
- u.delete("/api/v1/users/self/course_nicknames/:courseId", () => t.json({ nickname: null, name: "" }))
123
- ], H = [
124
- ...S,
125
- ...P,
126
- ...w,
127
- ...C,
128
- ...E
713
+ c.delete("/api/v1/users/self/course_nicknames/:courseId", () => s.json({ nickname: null, name: "" }))
714
+ ], Tt = [
715
+ ...ft,
716
+ ...gt,
717
+ ...bt,
718
+ ...L,
719
+ ...yt,
720
+ ...Mt
129
721
  ];
130
722
  export {
131
- D as MODULES_SMALL_MODULE_COUNT,
132
- F as MODULE_ITEMS_INLINE_LIMIT,
133
- O as buildCanvasCourseModules,
134
- h as buildLinkHeader,
135
- S as courseHandlers,
723
+ St as MODULES_SMALL_MODULE_COUNT,
724
+ jt as MODULE_ITEMS_INLINE_LIMIT,
725
+ Ht as buildCanvasCourseModules,
726
+ f as buildLinkHeader,
727
+ ft as cohortHandlers,
728
+ gt as courseHandlers,
136
729
  b as courses,
137
- _ as educatorAccessibilityCourseStatistics,
138
- P as educatorAccessibilityHandlers,
139
- H as handlers,
140
- B as mockEducatorAccessibilityStatistic,
141
- w as moduleHandlers,
142
- j as moduleScenariosByCourseId,
143
- G as modulesCourseEmpty,
144
- $ as modulesCourseFatModule,
145
- K as modulesCourseLarge,
146
- X as modulesCourseSmall,
147
- x as resetModuleScenarios,
148
- Y as stickerDescriptions,
149
- q as stickerTranslations,
150
- C as submissionHandlers,
151
- z as submissions,
730
+ M as educatorAccessibilityCourseStatistics,
731
+ bt as educatorAccessibilityHandlers,
732
+ _t as getAddCohortEnrollmentScopeMockHandler,
733
+ q as getAddCohortEnrollmentScopeResponseMock,
734
+ rt as getAddCohortLeaderMockHandler,
735
+ x as getAddCohortLeaderResponseMock,
736
+ at as getAddCohortMembersMockHandler,
737
+ N as getAddCohortMembersResponseMock,
738
+ mt as getBulkEnrollMockHandler,
739
+ $ as getBulkEnrollResponseMock,
740
+ ht as getCreateAccountNotificationMockHandler,
741
+ K as getCreateAccountNotificationResponseMock,
742
+ J as getCreateCohortMockHandler,
743
+ j as getCreateCohortResponseMock,
744
+ R as getDeleteCohortMockHandler,
745
+ E as getDeleteCohortResponseMock,
746
+ Q as getGetCohortMockHandler,
747
+ et as getGetCohortPermissionsMockHandler,
748
+ P as getGetCohortPermissionsResponseMock,
749
+ H as getGetCohortResponseMock,
750
+ tt as getGetCohortTreeMockHandler,
751
+ D as getGetCohortTreeResponseMock,
752
+ ut as getListCohortEnrollmentScopesMockHandler,
753
+ W as getListCohortEnrollmentScopesResponseMock,
754
+ ct as getListCohortEnrollmentsMockHandler,
755
+ U as getListCohortEnrollmentsResponseMock,
756
+ nt as getListCohortLeadersMockHandler,
757
+ G as getListCohortLeadersResponseMock,
758
+ ot as getListCohortMembersMockHandler,
759
+ A as getListCohortMembersResponseMock,
760
+ z as getListCohortsMockHandler,
761
+ S as getListCohortsResponseMock,
762
+ lt as getRemoveCohortEnrollmentScopeMockHandler,
763
+ B as getRemoveCohortEnrollmentScopeResponseMock,
764
+ dt as getRemoveCohortLeaderMockHandler,
765
+ Y as getRemoveCohortLeaderResponseMock,
766
+ st as getRemoveCohortMemberMockHandler,
767
+ O as getRemoveCohortMemberResponseMock,
768
+ pt as getUpdateAccountNotificationMockHandler,
769
+ X as getUpdateAccountNotificationResponseMock,
770
+ it as getUpdateCohortLeaderMockHandler,
771
+ F as getUpdateCohortLeaderResponseMock,
772
+ V as getUpdateCohortMockHandler,
773
+ v as getUpdateCohortResponseMock,
774
+ Tt as handlers,
775
+ vt as mockEducatorAccessibilityStatistic,
776
+ L as moduleHandlers,
777
+ y as moduleScenariosByCourseId,
778
+ Et as modulesCourseEmpty,
779
+ Dt as modulesCourseFatModule,
780
+ Pt as modulesCourseLarge,
781
+ At as modulesCourseSmall,
782
+ Ct as resetModuleScenarios,
783
+ Nt as stickerDescriptions,
784
+ Ot as stickerTranslations,
785
+ yt as submissionHandlers,
786
+ Ut as submissions,
152
787
  m as submissionsStore,
153
- E as userColorHandlers
788
+ Mt as userColorHandlers
154
789
  };