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