@ueu/ueu-canvas 0.0.2 → 0.0.4

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.
Files changed (378) hide show
  1. package/dist/Account.d.ts +22 -0
  2. package/dist/Account.d.ts.map +1 -0
  3. package/dist/NotImplementedException.d.ts +4 -0
  4. package/dist/NotImplementedException.d.ts.map +1 -0
  5. package/dist/__mocks__/Account.d.ts +17 -0
  6. package/dist/__mocks__/Account.d.ts.map +1 -0
  7. package/dist/__mocks__/index.d.ts +9 -0
  8. package/dist/__mocks__/index.d.ts.map +1 -0
  9. package/dist/__mocks__/mockAccountData.d.ts +6 -0
  10. package/dist/__mocks__/mockAccountData.d.ts.map +1 -0
  11. package/dist/__mocks__/mockEnrollment.d.ts +3 -0
  12. package/dist/__mocks__/mockEnrollment.d.ts.map +1 -0
  13. package/dist/__mocks__/mockRubricData.d.ts +20 -0
  14. package/dist/__mocks__/mockRubricData.d.ts.map +1 -0
  15. package/dist/__mocks__/mockTabData.d.ts +4 -0
  16. package/dist/__mocks__/mockTabData.d.ts.map +1 -0
  17. package/dist/__mocks__/mockTermData.d.ts +3 -0
  18. package/dist/__mocks__/mockTermData.d.ts.map +1 -0
  19. package/dist/__mocks__/mockUserData.d.ts +3 -0
  20. package/dist/__mocks__/mockUserData.d.ts.map +1 -0
  21. package/dist/__mocks__/utils.d.ts +3 -0
  22. package/dist/__mocks__/utils.d.ts.map +1 -0
  23. package/dist/__tests__/canvasUtils.test.d.ts +2 -0
  24. package/dist/__tests__/canvasUtils.test.d.ts.map +1 -0
  25. package/dist/__tests__/fetch.test.d.ts +2 -0
  26. package/dist/__tests__/fetch.test.d.ts.map +1 -0
  27. package/dist/__tests__/profile.test.d.ts +2 -0
  28. package/dist/__tests__/profile.test.d.ts.map +1 -0
  29. package/dist/__tests__/rubrics.test.d.ts +2 -0
  30. package/dist/__tests__/rubrics.test.d.ts.map +1 -0
  31. package/dist/baseCanvasObject.d.ts +41 -0
  32. package/dist/baseCanvasObject.d.ts.map +1 -0
  33. package/dist/canvasDataDefs.d.ts +97 -0
  34. package/dist/canvasDataDefs.d.ts.map +1 -0
  35. package/dist/canvasUtils.d.ts +65 -0
  36. package/dist/canvasUtils.d.ts.map +1 -0
  37. package/dist/consts.d.ts +3 -0
  38. package/dist/consts.d.ts.map +1 -0
  39. package/dist/content/BaseContentItem.d.ts +32 -0
  40. package/dist/content/BaseContentItem.d.ts.map +1 -0
  41. package/dist/content/ContentKind.d.ts +28 -0
  42. package/dist/content/ContentKind.d.ts.map +1 -0
  43. package/dist/content/__mocks__/determineContent.d.ts +65 -0
  44. package/dist/content/__mocks__/determineContent.d.ts.map +1 -0
  45. package/dist/content/__mocks__/mockAssignmentSubmission.d.ts +4 -0
  46. package/dist/content/__mocks__/mockAssignmentSubmission.d.ts.map +1 -0
  47. package/dist/content/__mocks__/mockContentData.d.ts +8 -0
  48. package/dist/content/__mocks__/mockContentData.d.ts.map +1 -0
  49. package/dist/content/__mocks__/openThisContentInTarget.d.ts +3 -0
  50. package/dist/content/__mocks__/openThisContentInTarget.d.ts.map +1 -0
  51. package/dist/content/__testingUtils__/utils.d.ts +6 -0
  52. package/dist/content/__testingUtils__/utils.d.ts.map +1 -0
  53. package/dist/content/__tests__/determineContent.test.d.ts +2 -0
  54. package/dist/content/__tests__/determineContent.test.d.ts.map +1 -0
  55. package/dist/content/__tests__/getContentFuncs.test.d.ts +2 -0
  56. package/dist/content/__tests__/getContentFuncs.test.d.ts.map +1 -0
  57. package/dist/content/assignments/Assignment.d.ts +15 -0
  58. package/dist/content/assignments/Assignment.d.ts.map +1 -0
  59. package/dist/content/assignments/AssignmentKind.d.ts +14 -0
  60. package/dist/content/assignments/AssignmentKind.d.ts.map +1 -0
  61. package/dist/content/assignments/__tests__/AssignmentKind.test.d.ts +2 -0
  62. package/dist/content/assignments/__tests__/AssignmentKind.test.d.ts.map +1 -0
  63. package/dist/content/assignments/__tests__/assignments.test.d.ts +2 -0
  64. package/dist/content/assignments/__tests__/assignments.test.d.ts.map +1 -0
  65. package/dist/content/assignments/deleteAssignmentGroup.d.ts +3 -0
  66. package/dist/content/assignments/deleteAssignmentGroup.d.ts.map +1 -0
  67. package/dist/content/assignments/genAssignmentGroups.d.ts +5 -0
  68. package/dist/content/assignments/genAssignmentGroups.d.ts.map +1 -0
  69. package/dist/content/assignments/index.d.ts +11 -0
  70. package/dist/content/assignments/index.d.ts.map +1 -0
  71. package/dist/content/assignments/legacy.d.ts +4 -0
  72. package/dist/content/assignments/legacy.d.ts.map +1 -0
  73. package/dist/content/assignments/updateAssignmentDueDates.d.ts +7 -0
  74. package/dist/content/assignments/updateAssignmentDueDates.d.ts.map +1 -0
  75. package/dist/content/determineContent.d.ts +19 -0
  76. package/dist/content/determineContent.d.ts.map +1 -0
  77. package/dist/content/discussions/Discussion.d.ts +13 -0
  78. package/dist/content/discussions/Discussion.d.ts.map +1 -0
  79. package/dist/content/discussions/DiscussionKind.d.ts +14 -0
  80. package/dist/content/discussions/DiscussionKind.d.ts.map +1 -0
  81. package/dist/content/discussions/__tests__/DiscussionKind.test.d.ts +2 -0
  82. package/dist/content/discussions/__tests__/DiscussionKind.test.d.ts.map +1 -0
  83. package/dist/content/discussions/genEquivalentDiscussionData.d.ts +32 -0
  84. package/dist/content/discussions/genEquivalentDiscussionData.d.ts.map +1 -0
  85. package/{src/content/discussions/index.ts → dist/content/discussions/index.d.ts} +1 -0
  86. package/dist/content/discussions/index.d.ts.map +1 -0
  87. package/dist/content/getContentFuncs.d.ts +3 -0
  88. package/dist/content/getContentFuncs.d.ts.map +1 -0
  89. package/{src/content/index.ts → dist/content/index.d.ts} +3 -3
  90. package/dist/content/index.d.ts.map +1 -0
  91. package/dist/content/openThisContentInTarget.d.ts +4 -0
  92. package/dist/content/openThisContentInTarget.d.ts.map +1 -0
  93. package/dist/content/pages/Page.d.ts +15 -0
  94. package/dist/content/pages/Page.d.ts.map +1 -0
  95. package/dist/content/pages/PageKind.d.ts +15 -0
  96. package/dist/content/pages/PageKind.d.ts.map +1 -0
  97. package/dist/content/pages/__tests__/PageKind.test.d.ts +2 -0
  98. package/dist/content/pages/__tests__/PageKind.test.d.ts.map +1 -0
  99. package/dist/content/pages/__tests__/learningMaterialsForModule.d.ts +2 -0
  100. package/dist/content/pages/__tests__/learningMaterialsForModule.d.ts.map +1 -0
  101. package/dist/content/pages/index.d.ts +14 -0
  102. package/dist/content/pages/index.d.ts.map +1 -0
  103. package/dist/content/pages/learningMaterialsForModule.d.ts +7 -0
  104. package/dist/content/pages/learningMaterialsForModule.d.ts.map +1 -0
  105. package/dist/content/pages/types.d.ts +11 -0
  106. package/dist/content/pages/types.d.ts.map +1 -0
  107. package/dist/content/quizzes/Quiz.d.ts +9 -0
  108. package/dist/content/quizzes/Quiz.d.ts.map +1 -0
  109. package/dist/content/quizzes/QuizKind.d.ts +13 -0
  110. package/dist/content/quizzes/QuizKind.d.ts.map +1 -0
  111. package/dist/content/quizzes/__tests__/QuizKind.test.d.ts +2 -0
  112. package/dist/content/quizzes/__tests__/QuizKind.test.d.ts.map +1 -0
  113. package/dist/content/quizzes/index.d.ts +2 -0
  114. package/dist/content/quizzes/index.d.ts.map +1 -0
  115. package/dist/content/quizzes/types.d.ts +45 -0
  116. package/dist/content/quizzes/types.d.ts.map +1 -0
  117. package/dist/content/types.d.ts +229 -0
  118. package/dist/content/types.d.ts.map +1 -0
  119. package/dist/course/Course.d.ts +87 -0
  120. package/dist/course/Course.d.ts.map +1 -0
  121. package/dist/course/IBlueprintCourse.d.ts +7 -0
  122. package/dist/course/IBlueprintCourse.d.ts.map +1 -0
  123. package/dist/course/__mocks__/blueprint.d.ts +14 -0
  124. package/dist/course/__mocks__/blueprint.d.ts.map +1 -0
  125. package/dist/course/__mocks__/mockCourseData.d.ts +3 -0
  126. package/dist/course/__mocks__/mockCourseData.d.ts.map +1 -0
  127. package/dist/course/__mocks__/mockLatePolicy.d.ts +4 -0
  128. package/dist/course/__mocks__/mockLatePolicy.d.ts.map +1 -0
  129. package/dist/course/__mocks__/mockModuleData.d.ts +7 -0
  130. package/dist/course/__mocks__/mockModuleData.d.ts.map +1 -0
  131. package/dist/course/__mocks__/mockProgressData.d.ts +3 -0
  132. package/dist/course/__mocks__/mockProgressData.d.ts.map +1 -0
  133. package/dist/course/__tests__/Course.test.d.ts +2 -0
  134. package/dist/course/__tests__/Course.test.d.ts.map +1 -0
  135. package/dist/course/__tests__/blueprint.test.d.ts +2 -0
  136. package/dist/course/__tests__/blueprint.test.d.ts.map +1 -0
  137. package/dist/course/__tests__/changeStartDate.test.d.ts +2 -0
  138. package/dist/course/__tests__/changeStartDate.test.d.ts.map +1 -0
  139. package/dist/course/__tests__/index.test.d.ts +2 -0
  140. package/dist/course/__tests__/index.test.d.ts.map +1 -0
  141. package/dist/course/blueprint.d.ts +21 -0
  142. package/dist/course/blueprint.d.ts.map +1 -0
  143. package/dist/course/cachedGetAssociatedCoursesFunc.d.ts +4 -0
  144. package/dist/course/cachedGetAssociatedCoursesFunc.d.ts.map +1 -0
  145. package/dist/course/changeStartDate.d.ts +25 -0
  146. package/dist/course/changeStartDate.d.ts.map +1 -0
  147. package/dist/course/code.d.ts +9 -0
  148. package/dist/course/code.d.ts.map +1 -0
  149. package/dist/course/courseTypes.d.ts +102 -0
  150. package/dist/course/courseTypes.d.ts.map +1 -0
  151. package/dist/course/getCourseIdFromUrl.d.ts +3 -0
  152. package/dist/course/getCourseIdFromUrl.d.ts.map +1 -0
  153. package/dist/course/getSections.d.ts +5 -0
  154. package/dist/course/getSections.d.ts.map +1 -0
  155. package/dist/course/getTermNameFromSections.d.ts +3 -0
  156. package/dist/course/getTermNameFromSections.d.ts.map +1 -0
  157. package/dist/course/index.d.ts +12 -0
  158. package/dist/course/index.d.ts.map +1 -0
  159. package/dist/course/migration/__mocks__/mockMigrationData.d.ts +6 -0
  160. package/dist/course/migration/__mocks__/mockMigrationData.d.ts.map +1 -0
  161. package/dist/course/migration/__tests__/migration.test.d.ts +2 -0
  162. package/dist/course/migration/__tests__/migration.test.d.ts.map +1 -0
  163. package/dist/course/migration/__tests__/migrationCache.test.d.ts +2 -0
  164. package/dist/course/migration/__tests__/migrationCache.test.d.ts.map +1 -0
  165. package/dist/course/migration/index.d.ts +47 -0
  166. package/dist/course/migration/index.d.ts.map +1 -0
  167. package/dist/course/migration/migrationCache.d.ts +12 -0
  168. package/dist/course/migration/migrationCache.d.ts.map +1 -0
  169. package/dist/course/modules.d.ts +35 -0
  170. package/dist/course/modules.d.ts.map +1 -0
  171. package/dist/course/notABlueprintError.d.ts +4 -0
  172. package/dist/course/notABlueprintError.d.ts.map +1 -0
  173. package/dist/course/references/getReferencesForText.d.ts +4 -0
  174. package/dist/course/references/getReferencesForText.d.ts.map +1 -0
  175. package/dist/course/references/getReferencesForText.test.d.ts +2 -0
  176. package/dist/course/references/getReferencesForText.test.d.ts.map +1 -0
  177. package/dist/course/references/getReferencesTemplate.d.ts +13 -0
  178. package/dist/course/references/getReferencesTemplate.d.ts.map +1 -0
  179. package/dist/course/references/mockCiteAsResponse.d.ts +127 -0
  180. package/dist/course/references/mockCiteAsResponse.d.ts.map +1 -0
  181. package/dist/course/retireBlueprint.d.ts +4 -0
  182. package/dist/course/retireBlueprint.d.ts.map +1 -0
  183. package/dist/course/toolbox.d.ts +18 -0
  184. package/dist/course/toolbox.d.ts.map +1 -0
  185. package/dist/date.d.ts +18 -0
  186. package/dist/date.d.ts.map +1 -0
  187. package/dist/enrollments/EnrollmentTypes.d.ts +60 -0
  188. package/dist/enrollments/EnrollmentTypes.d.ts.map +1 -0
  189. package/dist/enrollments/enrollmentRole.d.ts +5 -0
  190. package/dist/enrollments/enrollmentRole.d.ts.map +1 -0
  191. package/dist/enrollments/getEnrollmentGenerator.d.ts +40 -0
  192. package/dist/enrollments/getEnrollmentGenerator.d.ts.map +1 -0
  193. package/dist/enrollments/index.d.ts +4 -0
  194. package/dist/enrollments/index.d.ts.map +1 -0
  195. package/dist/fetch/__mocks__/fetchJson.d.ts +4 -0
  196. package/dist/fetch/__mocks__/fetchJson.d.ts.map +1 -0
  197. package/dist/fetch/__mocks__/getPagedDataGenerator.d.ts +4 -0
  198. package/dist/fetch/__mocks__/getPagedDataGenerator.d.ts.map +1 -0
  199. package/dist/fetch/__mocks__/index.d.ts +4 -0
  200. package/dist/fetch/__mocks__/index.d.ts.map +1 -0
  201. package/dist/fetch/apiGetConfig.d.ts +4 -0
  202. package/dist/fetch/apiGetConfig.d.ts.map +1 -0
  203. package/dist/fetch/apiWriteConfig.d.ts +4 -0
  204. package/dist/fetch/apiWriteConfig.d.ts.map +1 -0
  205. package/dist/fetch/canvasDataFetchGenFunc.d.ts +6 -0
  206. package/dist/fetch/canvasDataFetchGenFunc.d.ts.map +1 -0
  207. package/dist/fetch/fetchJson.d.ts +3 -0
  208. package/dist/fetch/fetchJson.d.ts.map +1 -0
  209. package/dist/fetch/getPagedDataGenerator.d.ts +63 -0
  210. package/dist/fetch/getPagedDataGenerator.d.ts.map +1 -0
  211. package/{src/fetch/index.ts → dist/fetch/index.d.ts} +1 -0
  212. package/dist/fetch/index.d.ts.map +1 -0
  213. package/dist/fetch/utils.d.ts +4 -0
  214. package/dist/fetch/utils.d.ts.map +1 -0
  215. package/dist/files.d.ts +29 -0
  216. package/dist/files.d.ts.map +1 -0
  217. package/dist/fixes/annotations.d.ts +15 -0
  218. package/dist/fixes/annotations.d.ts.map +1 -0
  219. package/dist/fixes/index.d.ts +36 -0
  220. package/dist/fixes/index.d.ts.map +1 -0
  221. package/{src/index.ts → dist/index.d.ts} +5 -10
  222. package/dist/index.d.ts.map +1 -0
  223. package/dist/index.js +8966 -0
  224. package/dist/profile.d.ts +24 -0
  225. package/dist/profile.d.ts.map +1 -0
  226. package/dist/rubricTypes.d.ts +71 -0
  227. package/dist/rubricTypes.d.ts.map +1 -0
  228. package/dist/rubrics.d.ts +9 -0
  229. package/dist/rubrics.d.ts.map +1 -0
  230. package/dist/term/Term.d.ts +21 -0
  231. package/dist/term/Term.d.ts.map +1 -0
  232. package/dist/term/__tests__/dateFromTermName.test.d.ts +2 -0
  233. package/dist/term/__tests__/dateFromTermName.test.d.ts.map +1 -0
  234. package/dist/term/__tests__/getTermsGenerator.test.d.ts +2 -0
  235. package/dist/term/__tests__/getTermsGenerator.test.d.ts.map +1 -0
  236. package/dist/term/dateFromTermName.d.ts +4 -0
  237. package/dist/term/dateFromTermName.d.ts.map +1 -0
  238. package/dist/term/getTermsGenerator.d.ts +7 -0
  239. package/dist/term/getTermsGenerator.d.ts.map +1 -0
  240. package/dist/term/index.d.ts +4 -0
  241. package/dist/term/index.d.ts.map +1 -0
  242. package/dist/toolbox.d.ts +5 -0
  243. package/dist/toolbox.d.ts.map +1 -0
  244. package/dist/types.d.ts +120 -0
  245. package/dist/types.d.ts.map +1 -0
  246. package/dist/users/getUserGenerator.d.ts +19 -0
  247. package/dist/users/getUserGenerator.d.ts.map +1 -0
  248. package/dist/users/index.d.ts +2 -0
  249. package/dist/users/index.d.ts.map +1 -0
  250. package/package.json +51 -45
  251. package/LICENSE +0 -21
  252. package/html-loader.js +0 -7
  253. package/jest.config.js +0 -20
  254. package/src/Account.ts +0 -69
  255. package/src/NotImplementedException.ts +0 -3
  256. package/src/__mocks__/Account.ts +0 -55
  257. package/src/__mocks__/index.ts +0 -8
  258. package/src/__mocks__/mockAccountData.ts +0 -43
  259. package/src/__mocks__/mockEnrollment.ts +0 -22
  260. package/src/__mocks__/mockRubricData.ts +0 -71
  261. package/src/__mocks__/mockTabData.ts +0 -13
  262. package/src/__mocks__/mockTermData.ts +0 -7
  263. package/src/__mocks__/mockUserData.ts +0 -14
  264. package/src/__mocks__/utils.ts +0 -9
  265. package/src/__tests__/canvasUtils.test.ts +0 -527
  266. package/src/__tests__/fetch.test.ts +0 -310
  267. package/src/__tests__/profile.test.ts +0 -19
  268. package/src/__tests__/rubrics.test.ts +0 -131
  269. package/src/baseCanvasObject.ts +0 -139
  270. package/src/canvasDataDefs.ts +0 -124
  271. package/src/canvasUtils.ts +0 -420
  272. package/src/consts.ts +0 -2
  273. package/src/content/BaseContentItem.ts +0 -219
  274. package/src/content/ContentKind.ts +0 -85
  275. package/src/content/__mocks__/determineContent.ts +0 -27
  276. package/src/content/__mocks__/mockAssignmentSubmission.ts +0 -37
  277. package/src/content/__mocks__/mockContentData.ts +0 -98
  278. package/src/content/__mocks__/openThisContentInTarget.ts +0 -2
  279. package/src/content/__testingUtils__/utils.ts +0 -47
  280. package/src/content/__tests__/determineContent.test.ts +0 -101
  281. package/src/content/__tests__/getContentFuncs.test.ts +0 -78
  282. package/src/content/assignments/Assignment.ts +0 -69
  283. package/src/content/assignments/AssignmentKind.ts +0 -29
  284. package/src/content/assignments/__tests__/AssignmentKind.test.ts +0 -31
  285. package/src/content/assignments/__tests__/assignments.test.ts +0 -72
  286. package/src/content/assignments/deleteAssignmentGroup.ts +0 -15
  287. package/src/content/assignments/genAssignmentGroups.ts +0 -15
  288. package/src/content/assignments/index.ts +0 -31
  289. package/src/content/assignments/legacy.ts +0 -11
  290. package/src/content/assignments/updateAssignmentDueDates.ts +0 -25
  291. package/src/content/determineContent.ts +0 -72
  292. package/src/content/discussions/Discussion.ts +0 -32
  293. package/src/content/discussions/DiscussionKind.ts +0 -30
  294. package/src/content/discussions/__tests__/DiscussionKind.test.ts +0 -31
  295. package/src/content/discussions/genEquivalentDiscussionData.ts +0 -97
  296. package/src/content/getContentFuncs.ts +0 -30
  297. package/src/content/openThisContentInTarget.ts +0 -38
  298. package/src/content/pages/Page.ts +0 -35
  299. package/src/content/pages/PageKind.ts +0 -39
  300. package/src/content/pages/__tests__/PageKind.test.ts +0 -86
  301. package/src/content/pages/__tests__/learningMaterialsForModule.ts +0 -57
  302. package/src/content/pages/index.ts +0 -12
  303. package/src/content/pages/learningMaterialsForModule.ts +0 -16
  304. package/src/content/pages/types.ts +0 -11
  305. package/src/content/quizzes/Quiz.ts +0 -25
  306. package/src/content/quizzes/QuizKind.ts +0 -23
  307. package/src/content/quizzes/__tests__/QuizKind.test.ts +0 -30
  308. package/src/content/quizzes/index.ts +0 -3
  309. package/src/content/quizzes/types.ts +0 -101
  310. package/src/content/types.ts +0 -302
  311. package/src/course/Course.ts +0 -538
  312. package/src/course/IBlueprintCourse.ts +0 -8
  313. package/src/course/__mocks__/blueprint.ts +0 -31
  314. package/src/course/__mocks__/mockCourseData.ts +0 -49
  315. package/src/course/__mocks__/mockLatePolicy.ts +0 -14
  316. package/src/course/__mocks__/mockModuleData.ts +0 -60
  317. package/src/course/__mocks__/mockProgressData.ts +0 -28
  318. package/src/course/__mocks__/syllabus.gallant.html +0 -302
  319. package/src/course/__mocks__/syllabus.goofus.html +0 -288
  320. package/src/course/__mocks__/syllabus.grad.html +0 -282
  321. package/src/course/__tests__/Course.test.ts +0 -91
  322. package/src/course/__tests__/blueprint.test.ts +0 -292
  323. package/src/course/__tests__/changeStartDate.test.ts +0 -180
  324. package/src/course/__tests__/index.test.ts +0 -104
  325. package/src/course/blueprint.ts +0 -116
  326. package/src/course/cachedGetAssociatedCoursesFunc.ts +0 -13
  327. package/src/course/changeStartDate.ts +0 -139
  328. package/src/course/code.ts +0 -32
  329. package/src/course/courseTypes.ts +0 -161
  330. package/src/course/getCourseIdFromUrl.ts +0 -7
  331. package/src/course/getSections.ts +0 -9
  332. package/src/course/getTermNameFromSections.ts +0 -9
  333. package/src/course/index.ts +0 -12
  334. package/src/course/migration/__mocks__/mockMigrationData.ts +0 -39
  335. package/src/course/migration/__tests__/migration.test.ts +0 -173
  336. package/src/course/migration/__tests__/migrationCache.test.ts +0 -45
  337. package/src/course/migration/index.ts +0 -134
  338. package/src/course/migration/migrationCache.ts +0 -56
  339. package/src/course/modules.ts +0 -113
  340. package/src/course/notABlueprintError.ts +0 -3
  341. package/src/course/references/getReferencesForText.test.ts +0 -18
  342. package/src/course/references/getReferencesForText.ts +0 -12
  343. package/src/course/references/getReferencesTemplate.ts +0 -28
  344. package/src/course/references/mockCiteAsResponse.ts +0 -320
  345. package/src/course/retireBlueprint.ts +0 -21
  346. package/src/course/toolbox.ts +0 -107
  347. package/src/date.ts +0 -119
  348. package/src/enrollments/EnrollmentTypes.ts +0 -76
  349. package/src/enrollments/enrollmentRole.ts +0 -6
  350. package/src/enrollments/getEnrollmentGenerator.ts +0 -79
  351. package/src/enrollments/index.ts +0 -3
  352. package/src/fetch/__mocks__/fetchJson.ts +0 -1
  353. package/src/fetch/__mocks__/getPagedDataGenerator.ts +0 -8
  354. package/src/fetch/__mocks__/index.ts +0 -6
  355. package/src/fetch/apiGetConfig.ts +0 -10
  356. package/src/fetch/apiWriteConfig.ts +0 -13
  357. package/src/fetch/canvasDataFetchGenFunc.ts +0 -20
  358. package/src/fetch/fetchJson.ts +0 -22
  359. package/src/fetch/getPagedDataGenerator.ts +0 -157
  360. package/src/fetch/utils.ts +0 -16
  361. package/src/files.ts +0 -60
  362. package/src/fixes/annotations.ts +0 -105
  363. package/src/fixes/index.ts +0 -81
  364. package/src/profile.ts +0 -253
  365. package/src/rubricTypes.ts +0 -82
  366. package/src/rubrics.ts +0 -48
  367. package/src/term/Term.ts +0 -77
  368. package/src/term/__tests__/dateFromTermName.test.ts +0 -22
  369. package/src/term/__tests__/getTermsGenerator.test.ts +0 -24
  370. package/src/term/dateFromTermName.ts +0 -17
  371. package/src/term/getTermsGenerator.ts +0 -21
  372. package/src/term/index.ts +0 -3
  373. package/src/toolbox.ts +0 -19
  374. package/src/types.ts +0 -134
  375. package/src/users/getUserGenerator.ts +0 -39
  376. package/src/users/index.ts +0 -1
  377. package/tsconfig.json +0 -46
  378. package/webpack.config.js +0 -122
@@ -1,124 +0,0 @@
1
- export type CanvasData = Record<string, any> & {
2
- retrieved_at?: string;
3
- }
4
-
5
-
6
- export interface HasUser extends CanvasData {
7
- user: IUserData
8
- }
9
-
10
- export interface IUserData extends CanvasData {
11
- id: number,
12
- name: string,
13
- sortable_name: string,
14
- last_name: string,
15
- first_name: string,
16
- short_name: string,
17
- email: string,
18
- bio?: string
19
- }
20
-
21
-
22
- export interface IModuleData extends CanvasData {
23
- id: number,
24
- name: string,
25
- position: number,
26
- unlock_at?: string | null,
27
- require_sequential_progress: boolean,
28
- prerequisite_module_ids: number[],
29
- items_count: number,
30
- items_url: string,
31
- items: IModuleItemData[],
32
- state: string,
33
- completed_at?: string | null,
34
- publish_final_grade?: boolean,
35
- published: boolean
36
- }
37
-
38
- export type ModuleItemType =
39
- "File"
40
- | "Assignment"
41
- | "Discussion"
42
- | "Quiz"
43
- | "ExternalTool"
44
- | "ExternalUrl"
45
- | "Page"
46
- | "Subheader"
47
- export type RestrictModuleItemType =
48
- 'assignment'
49
- | 'attachment'
50
- | 'discussion_topic'
51
- | 'external_tool'
52
- | 'lti-quiz'
53
- | 'quiz'
54
- | 'wiki_page'
55
-
56
-
57
- export interface IModuleItemData extends CanvasData {
58
- id: number,
59
- module_id: number,
60
- position: number,
61
- title: string,
62
- indent: number,
63
- type: ModuleItemType,
64
- content_id: number,
65
- html_url: string,
66
- url?: string,
67
- page_url?: string,
68
- external_url?: string,
69
- new_tab: boolean,
70
- completion_requirement?: {
71
- type: "min_score" | "must_view" | "must_contribute" | "must_submit" | "must_mark_done",
72
- min_score?: number
73
- },
74
- content_details?: {
75
- points_possible: number,
76
- due_at?: string,
77
- unlock_at?: string,
78
- lock_at?: string,
79
- }
80
- }
81
-
82
-
83
- export interface IUpdateCallback {
84
- (current: number, total: number, message: string | undefined): void
85
- }
86
-
87
- export interface ILatePolicyUpdate {
88
- "id"?: number,
89
- "missing_submission_deduction_enabled"?: boolean,
90
- "missing_submission_deduction"?: number,
91
- "late_submission_deduction_enabled"?: boolean,
92
- "late_submission_deduction"?: number,
93
- "late_submission_interval"?: string,
94
- "late_submission_minimum_percent_enabled"?: boolean,
95
- "late_submission_minimum_percent"?: number
96
- }
97
-
98
- export interface ILatePolicyData extends ILatePolicyUpdate{
99
- "id": number,
100
- "missing_submission_deduction_enabled": boolean,
101
- "missing_submission_deduction": number,
102
- "late_submission_deduction_enabled": boolean,
103
- "late_submission_deduction": number,
104
- "late_submission_interval": string,
105
- "late_submission_minimum_percent_enabled": boolean,
106
- "late_submission_minimum_percent": number
107
- }
108
-
109
- export interface IAccountData {
110
- root_account_id: number|null;
111
- integration_id?: string;
112
- default_time_zone: string;
113
- default_group_storage_quota_mb: number;
114
- sis_account_id?: string;
115
- default_user_storage_quota_mb: number;
116
- uuid: string;
117
- lti_guid: string;
118
- parent_account_id: number|null;
119
- name: string;
120
- default_storage_quota_mb: number;
121
- workflow_state: 'active' | 'deleted';
122
- id: number;
123
- sis_import_id: number
124
- }
@@ -1,420 +0,0 @@
1
- import assert from "assert";
2
- import {IModuleItemData, ModuleItemType, RestrictModuleItemType} from "./canvasDataDefs";
3
-
4
-
5
- import {Course} from "./course/Course";
6
-
7
- import {ICourseData} from "@/types";
8
-
9
- import {fetchJson} from "@/fetch/fetchJson";
10
-
11
-
12
- import {IPageData} from "@/content/pages/types";
13
-
14
-
15
- type FuncType<T> = FuncObject<T> | WithoutParamsFuncType<T> | WithParamsFuncType<T>
16
- type WithoutParamsFuncType<T> = () => T;
17
- type FunctionParamsType<T> = (FuncType<T> extends WithoutParamsFuncType<T> ? undefined : any);
18
- type FuncObject<T> = { func: WithParamsFuncType<T>, params: FunctionParamsType<T> }
19
- type WithParamsFuncType<T> = (params: FunctionParamsType<T>) => T;
20
- type PassedInParamsType<T> = FunctionParamsType<T>;
21
-
22
- function isWithParamsFunc<T>(func: FuncObject<T> | WithParamsFuncType<T> | WithoutParamsFuncType<T>): func is WithParamsFuncType<T> {
23
- return typeof func === 'function' && func.length > 0;
24
- }
25
-
26
- function isWithoutParamsFunc<T>(
27
- func: FuncObject<T> | WithParamsFuncType<T> | WithoutParamsFuncType<T>): func is WithoutParamsFuncType<T> {
28
- return typeof func === 'function' && func.length === 0;
29
- }
30
-
31
-
32
- /**
33
- * Takes in a list of functions and calls all of them, returning the result.
34
- * This is an abomination.
35
- * @param funcs A list of functions, or a list of { func, params } pairs to run, passing params into func
36
- * @param params optional params to pass into each run of the function
37
- */
38
- function callAll<T>(funcs: (() => T)[]): T[]
39
- function callAll<T, ParamType>(funcs: { func: (params: ParamType) => T, params: ParamType }[]): T[]
40
- function callAll<T, ParamType>(funcs: ((params: ParamType) => T)[], params: ParamType): T[]
41
- function callAll<T>(funcs: FuncType<T>[] | WithParamsFuncType<T>[], params?: PassedInParamsType<T>) {
42
- const output: T[] = [];
43
-
44
- for (const func of funcs) {
45
- if ((typeof func === 'object')) {
46
- output.push(func.func(func.params))
47
- continue;
48
- }
49
- if (isWithoutParamsFunc(func)) {
50
- output.push(func());
51
- continue;
52
- }
53
- if (isWithParamsFunc(func) && typeof params !== 'undefined') {
54
- output.push(func(params));
55
- }
56
- }
57
- return output;
58
- }
59
-
60
- export {callAll}
61
-
62
- /**
63
- * Traverses up the DOM and finds a parent with a matching Tag
64
- * @param el
65
- * @param tagName
66
- */
67
- export function parentElement(el: Element | null, tagName: string) {
68
- if (!el) return null;
69
- while (el && el.parentElement) {
70
- el = el.parentElement;
71
- if (el.tagName && el.tagName.toLowerCase() == tagName) {
72
- return el;
73
- }
74
- }
75
- return null;
76
- }
77
-
78
-
79
- export interface IQueryParams extends Record<string, any> {
80
- include?: (string | number)[]
81
- }
82
-
83
- export interface ICanvasCallConfig<QueryParamsType extends IQueryParams = IQueryParams> {
84
- fetchInit?: RequestInit,
85
- queryParams?: QueryParamsType
86
- }
87
-
88
- const type_lut: Record<ModuleItemType, RestrictModuleItemType | null> = {
89
- Assignment: 'assignment',
90
- Discussion: 'discussion_topic',
91
- Quiz: 'quiz',
92
- ExternalTool: 'external_tool',
93
- File: 'attachment',
94
- Page: 'wiki_page',
95
- ExternalUrl: null, //Not passable to restrict
96
- Subheader: null, //Not passable to restrict
97
-
98
- }
99
-
100
- export function formDataify(data: Record<string, any>) {
101
- const formData = new FormData();
102
- for (const key in data) {
103
- addToFormData(formData, key, data[key]);
104
- }
105
-
106
- if (document) {
107
- const el: HTMLInputElement | null = document.querySelector("input[name='authenticity_token']");
108
- const authenticityToken = el ? el.value : null;
109
- const cookies = getCookies();
110
- let csrfToken = cookies['_csrf_token'];
111
- if (authenticityToken) formData.append('authenticity_token', authenticityToken);
112
- else if (csrfToken) {
113
- csrfToken = csrfToken.replaceAll(/%([0-9A-F]{2})/g, (substring, hex) => {
114
- const hexCode = hex;
115
- return String.fromCharCode(parseInt(hexCode, 16))
116
- })
117
-
118
- console.log(csrfToken);
119
- formData.append('authenticity_token', csrfToken);
120
- }
121
- }
122
- return formData;
123
- }
124
-
125
-
126
- export function deepObjectCopy<T extends ReturnType<typeof deepObjectMerge> & ({} | [])>(
127
- toCopy: T,
128
- complexObjectsTracker: Array<unknown> = [],
129
- ) {
130
- return deepObjectMerge(toCopy, {} as T, true, complexObjectsTracker) as T;
131
- }
132
-
133
-
134
- export function deepObjectMerge<
135
- Return extends string | number | object | Record<string, any> | null | undefined | []
136
- >(
137
- a: Return,
138
- b: Return,
139
- overrideWithA: boolean = false,
140
- complexObjectsTracker: Array<unknown> = [],
141
- ): Return {
142
- for (const value of [a, b]) {
143
- if (typeof value == "object" &&
144
- complexObjectsTracker.includes(value)) throw new Error(`Infinite Loop: Element ${value} contains itself`);
145
- }
146
-
147
- //if the types don't match
148
- if (a && b && (
149
- typeof a !== typeof b ||
150
- Array.isArray(a) != Array.isArray(b)
151
- )) {
152
- if (a === b) return a;
153
- if (overrideWithA) return a;
154
- throw new Error(`Type clash on merge ${typeof a} ${a}, ${typeof b} ${b}`);
155
- }
156
-
157
- //If either or both are arrays, merge if able to
158
- if (Array.isArray(a)) {
159
- if (!b) return deepObjectCopy(a, complexObjectsTracker);
160
- assert(Array.isArray(b), "We should not get here if b is not an array")
161
- const mergedArray = [...a, ...b];
162
- const outputArray = mergedArray.map(value => {
163
- if (!value) return value;
164
- if (typeof value === 'object' && Object.getPrototypeOf(value) === Object.prototype) {
165
- //Make a deep of any object literal
166
- if (!value) return value;
167
- value = deepObjectCopy(value, [...complexObjectsTracker, a, b]);
168
- }
169
- return value;
170
- }) as Return
171
- return outputArray;
172
- }
173
-
174
- if (Array.isArray(b)) return deepObjectCopy(b, complexObjectsTracker); //we already know A is not an array at this point, return a deep copy of b
175
- if ((a && typeof a === 'object') || (b && typeof b === 'object')) {
176
- if (a instanceof File && b instanceof File) {
177
- if (!overrideWithA) assert(a.size == b.size && a.name == b.name, `File value clash ${a.name} ${b.name}`);
178
- return a;
179
- }
180
- if (a && Object.getPrototypeOf(a) != Object.prototype
181
- || b && Object.getPrototypeOf(b) != Object.prototype) {
182
- if (!overrideWithA) assert(!a || !b || a === b, `Non-mergeable object clash ${a} ${b}`);
183
- if (a) return a;
184
- if (b) return b;
185
- }
186
- if (a && !b) return deepObjectCopy(a, complexObjectsTracker);
187
- if (b && !a) return deepObjectCopy(b, complexObjectsTracker);
188
-
189
-
190
- assert(a && typeof a === 'object' && Object.getPrototypeOf(a) === Object.prototype, "a should always be defined here.")
191
- assert(b && typeof b === 'object' && Object.getPrototypeOf(b) === Object.prototype, "b should always be defined here.")
192
-
193
- const allKeys = [...Object.keys(a), ...Object.keys(b)].filter(filterUniqueFunc);
194
- const aRecord: Record<string, any> = a;
195
- const bRecord: Record<string, any> = b;
196
-
197
- const entries = allKeys.map((key: string) => [
198
- key,
199
- deepObjectMerge(aRecord[key], bRecord[key], overrideWithA, [...complexObjectsTracker, a, b])
200
- ]);
201
- return Object.fromEntries(entries)
202
- }
203
- if (a && b) {
204
- if (overrideWithA || a === b) return a;
205
- throw new Error(`Values unmergeable, ${a}>:${typeof a}, ${b} ${typeof b}`)
206
- }
207
- if (a) return a;
208
- if (b) return b;
209
- if (a === null) return a;
210
- if (b === null) return b;
211
- assert(typeof a === 'undefined')
212
- return a;
213
- }
214
-
215
- export interface FormMergeOutput {
216
- [key: string]: FormMergeOutput | FormDataEntryValue | FormDataEntryValue[]
217
- }
218
-
219
- export function deFormDataify(formData: FormData) {
220
- return [...formData.entries()].reduce((aggregator, [key, value]) => {
221
- const isArray = key.includes('[]');
222
- const keys = key.split('[').map(key => key.replaceAll(/[\[\]]/g, ''));
223
- if (isArray) keys.pop(); //remove the last, empty, key if it's an array
224
- let currentValue: FormDataEntryValue | FormDataEntryValue[] | FormMergeOutput = isArray ? [value] : value;
225
- while (keys.length > 0) {
226
- let newValue: Record<string, any>;
227
- newValue = {
228
- [keys.pop() as string]: currentValue
229
- };
230
- currentValue = newValue;
231
-
232
- }
233
- return deepObjectMerge(aggregator, currentValue as FormMergeOutput) || {...aggregator};
234
- }, {} as FormMergeOutput);
235
- }
236
-
237
-
238
- function getCookies() {
239
- const cookieString = document.cookie;
240
- const cookies = cookieString.split('; ')
241
- const out: Record<string, string> = {};
242
- for (const cookie of cookies) {
243
- const [key, value] = cookie.split('=')
244
- out[key] = value;
245
- }
246
- return out;
247
- }
248
-
249
- /**
250
- * Adds arrays and objects in the form formData posts expects
251
- * @param formData
252
- * @param key
253
- * @param value
254
- */
255
- function addToFormData(formData: FormData, key: string, value: any | Record<string, any> | []) {
256
- if (Array.isArray(value)) {
257
- for (const item of value) {
258
- addToFormData(formData, `${key}[]`, item);
259
- }
260
- } else if (typeof value === 'object') {
261
- for (const itemKey in value) {
262
- const itemValue = value[itemKey];
263
- addToFormData(formData, key.length > 0 ? `${key}[${itemKey}]` : itemKey, itemValue);
264
- }
265
- } else {
266
- formData.append(key, value);
267
- }
268
- }
269
-
270
-
271
- export function queryStringify(data: Record<string, any>) {
272
- const searchParams = new URLSearchParams();
273
- for (const key in data) {
274
- addToQuery(searchParams, key, data[key])
275
- }
276
-
277
- return searchParams;
278
- }
279
-
280
- function addToQuery(searchParams: URLSearchParams, key: string, value: any | Record<string, any> | []) {
281
- if (Array.isArray(value)) {
282
- for (const item of value) {
283
- addToQuery(searchParams, `${key}[]`, item);
284
- }
285
- } else if (typeof value === 'object') {
286
- for (const itemKey in value) {
287
- const itemValue = value[itemKey];
288
- addToQuery(searchParams, key.length > 0 ? `${key}[${itemKey}]` : itemKey, itemValue);
289
- }
290
- } else {
291
- searchParams.append(key, value)
292
- }
293
- }
294
-
295
-
296
- /**
297
- * Takes in a module item and returns an object specifying its type and content id
298
- * @param item
299
- */
300
- export async function getItemTypeAndId(
301
- item: IModuleItemData
302
- ): Promise<{ type: RestrictModuleItemType | null, id: number }> {
303
- let id;
304
- let type;
305
- assert(type_lut.hasOwnProperty(item.type), "Unexpected type " + item.type);
306
-
307
- type = type_lut[item.type];
308
- if (type === "wiki_page") {
309
- assert(item.url); //wiki_page items always have a url param
310
- const pageData = await fetchJson(item.url) as IPageData;
311
- id = pageData.page_id;
312
- } else {
313
- id = item.content_id;
314
- }
315
-
316
- return {type, id}
317
- }
318
-
319
- /**
320
- * @param queryParams
321
- * @returns {URLSearchParams} The correctly formatted parameters
322
- */
323
- export function searchParamsFromObject(queryParams: string[][] | Record<string, string>): URLSearchParams {
324
- return queryStringify(queryParams);
325
- }
326
-
327
-
328
-
329
- /**
330
- * sort courses (or course Data) alphabetically by name
331
- * @param a item to compare.
332
- * @param b item to compare.
333
- */
334
- export function courseNameSort(a: Course | ICourseData, b: Course | ICourseData) {
335
- if (a.name < b.name) return -1;
336
- if (b.name < a.name) return 1;
337
- return 0;
338
- }
339
-
340
- export function* range(start: number, end?: number, step: number = 1) {
341
- if (typeof end === 'undefined') {
342
- let i = start;
343
- while (true) {
344
- yield i;
345
- i+= step;
346
- }
347
- }
348
-
349
- for (let i = start; i <= end; i++) {
350
- yield i;
351
- }
352
- }
353
-
354
- export function* numbers(start: number, step: number = 1) {
355
- let i = 0;
356
- while (true) {
357
- yield i;
358
- i += step;
359
- }
360
- }
361
-
362
-
363
- export function getPlainTextFromHtml(html: string) {
364
- const el = document.createElement('div');
365
- el.innerHTML = html;
366
- return el.innerText || el.textContent || "";
367
- }
368
-
369
-
370
-
371
- export function batchify<T>(toBatch: T[], batchSize: number) {
372
- const out: T[][] = [];
373
- for (let i = 0; i < toBatch.length; i += batchSize) {
374
- out.push(toBatch.slice(i, i + batchSize));
375
-
376
- }
377
- return out;
378
- }
379
-
380
- export function filterUniqueFunc<T>(item: T, index: number, array: T[]) {
381
- return array.indexOf(item) === index;
382
- }
383
-
384
-
385
-
386
- export async function* batchGen<T>(generator: AsyncGenerator<T>, batchSize: number) {
387
- if(batchSize <= 0) throw new Error("Batch size cannot be 0 or lower")
388
- while (true) {
389
- const out = [] as T[];
390
- for (let i = 0; i < batchSize; i++) {
391
- const next = await generator.next();
392
- if (next.done) {
393
- if (out.length > 0) yield out;
394
- return;
395
- }
396
- out.push(next.value)
397
- }
398
- yield out;
399
- }
400
- }
401
-
402
- export async function renderAsyncGen<T, R = any>(generator: AsyncGenerator<T, R, undefined>) {
403
- const out = [] as T[];
404
- for await (const item of generator) {
405
- out.push(item);
406
- }
407
- return out;
408
- }
409
-
410
- export async function* generatorMap<T, MapOutput>(
411
- generator: AsyncGenerator<T>,
412
- nextMapFunc: (value: T, index: number, generator: AsyncGenerator<T>) => MapOutput,
413
- ) {
414
-
415
- let i = 0;
416
- for await(const value of generator) {
417
- yield nextMapFunc(value, i, generator);
418
- i++;
419
- }
420
- }
package/src/consts.ts DELETED
@@ -1,2 +0,0 @@
1
- export const DEV_TEMPLATE_COURSE_ID = 3850558;
2
- export const REFERENCES_PAGE_URL_NAME = 'learning-materials-reference-page';