@ueu/ueu-canvas 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/LICENSE +21 -0
  2. package/html-loader.js +7 -0
  3. package/jest.config.js +20 -0
  4. package/package.json +45 -0
  5. package/src/Account.ts +69 -0
  6. package/src/NotImplementedException.ts +3 -0
  7. package/src/__mocks__/Account.ts +55 -0
  8. package/src/__mocks__/index.ts +8 -0
  9. package/src/__mocks__/mockAccountData.ts +43 -0
  10. package/src/__mocks__/mockEnrollment.ts +22 -0
  11. package/src/__mocks__/mockRubricData.ts +71 -0
  12. package/src/__mocks__/mockTabData.ts +13 -0
  13. package/src/__mocks__/mockTermData.ts +7 -0
  14. package/src/__mocks__/mockUserData.ts +14 -0
  15. package/src/__mocks__/utils.ts +9 -0
  16. package/src/__tests__/canvasUtils.test.ts +527 -0
  17. package/src/__tests__/fetch.test.ts +310 -0
  18. package/src/__tests__/profile.test.ts +19 -0
  19. package/src/__tests__/rubrics.test.ts +131 -0
  20. package/src/baseCanvasObject.ts +139 -0
  21. package/src/canvasDataDefs.ts +124 -0
  22. package/src/canvasUtils.ts +420 -0
  23. package/src/consts.ts +2 -0
  24. package/src/content/BaseContentItem.ts +219 -0
  25. package/src/content/ContentKind.ts +85 -0
  26. package/src/content/__mocks__/determineContent.ts +27 -0
  27. package/src/content/__mocks__/mockAssignmentSubmission.ts +37 -0
  28. package/src/content/__mocks__/mockContentData.ts +98 -0
  29. package/src/content/__mocks__/openThisContentInTarget.ts +2 -0
  30. package/src/content/__testingUtils__/utils.ts +47 -0
  31. package/src/content/__tests__/determineContent.test.ts +101 -0
  32. package/src/content/__tests__/getContentFuncs.test.ts +78 -0
  33. package/src/content/assignments/Assignment.ts +69 -0
  34. package/src/content/assignments/AssignmentKind.ts +29 -0
  35. package/src/content/assignments/__tests__/AssignmentKind.test.ts +31 -0
  36. package/src/content/assignments/__tests__/assignments.test.ts +72 -0
  37. package/src/content/assignments/deleteAssignmentGroup.ts +15 -0
  38. package/src/content/assignments/genAssignmentGroups.ts +15 -0
  39. package/src/content/assignments/index.ts +31 -0
  40. package/src/content/assignments/legacy.ts +11 -0
  41. package/src/content/assignments/updateAssignmentDueDates.ts +25 -0
  42. package/src/content/determineContent.ts +72 -0
  43. package/src/content/discussions/Discussion.ts +32 -0
  44. package/src/content/discussions/DiscussionKind.ts +30 -0
  45. package/src/content/discussions/__tests__/DiscussionKind.test.ts +31 -0
  46. package/src/content/discussions/genEquivalentDiscussionData.ts +97 -0
  47. package/src/content/discussions/index.ts +2 -0
  48. package/src/content/getContentFuncs.ts +30 -0
  49. package/src/content/index.ts +11 -0
  50. package/src/content/openThisContentInTarget.ts +38 -0
  51. package/src/content/pages/Page.ts +35 -0
  52. package/src/content/pages/PageKind.ts +39 -0
  53. package/src/content/pages/__tests__/PageKind.test.ts +86 -0
  54. package/src/content/pages/__tests__/learningMaterialsForModule.ts +57 -0
  55. package/src/content/pages/index.ts +12 -0
  56. package/src/content/pages/learningMaterialsForModule.ts +16 -0
  57. package/src/content/pages/types.ts +11 -0
  58. package/src/content/quizzes/Quiz.ts +25 -0
  59. package/src/content/quizzes/QuizKind.ts +23 -0
  60. package/src/content/quizzes/__tests__/QuizKind.test.ts +30 -0
  61. package/src/content/quizzes/index.ts +3 -0
  62. package/src/content/quizzes/types.ts +101 -0
  63. package/src/content/types.ts +302 -0
  64. package/src/course/Course.ts +538 -0
  65. package/src/course/IBlueprintCourse.ts +8 -0
  66. package/src/course/__mocks__/blueprint.ts +31 -0
  67. package/src/course/__mocks__/mockCourseData.ts +49 -0
  68. package/src/course/__mocks__/mockLatePolicy.ts +14 -0
  69. package/src/course/__mocks__/mockModuleData.ts +60 -0
  70. package/src/course/__mocks__/mockProgressData.ts +28 -0
  71. package/src/course/__mocks__/syllabus.gallant.html +302 -0
  72. package/src/course/__mocks__/syllabus.goofus.html +288 -0
  73. package/src/course/__mocks__/syllabus.grad.html +282 -0
  74. package/src/course/__tests__/Course.test.ts +91 -0
  75. package/src/course/__tests__/blueprint.test.ts +292 -0
  76. package/src/course/__tests__/changeStartDate.test.ts +180 -0
  77. package/src/course/__tests__/index.test.ts +104 -0
  78. package/src/course/blueprint.ts +116 -0
  79. package/src/course/cachedGetAssociatedCoursesFunc.ts +13 -0
  80. package/src/course/changeStartDate.ts +139 -0
  81. package/src/course/code.ts +32 -0
  82. package/src/course/courseTypes.ts +161 -0
  83. package/src/course/getCourseIdFromUrl.ts +7 -0
  84. package/src/course/getSections.ts +9 -0
  85. package/src/course/getTermNameFromSections.ts +9 -0
  86. package/src/course/index.ts +12 -0
  87. package/src/course/migration/__mocks__/mockMigrationData.ts +39 -0
  88. package/src/course/migration/__tests__/migration.test.ts +173 -0
  89. package/src/course/migration/__tests__/migrationCache.test.ts +45 -0
  90. package/src/course/migration/index.ts +134 -0
  91. package/src/course/migration/migrationCache.ts +56 -0
  92. package/src/course/modules.ts +113 -0
  93. package/src/course/notABlueprintError.ts +3 -0
  94. package/src/course/references/getReferencesForText.test.ts +18 -0
  95. package/src/course/references/getReferencesForText.ts +12 -0
  96. package/src/course/references/getReferencesTemplate.ts +28 -0
  97. package/src/course/references/mockCiteAsResponse.ts +320 -0
  98. package/src/course/retireBlueprint.ts +21 -0
  99. package/src/course/toolbox.ts +107 -0
  100. package/src/date.ts +119 -0
  101. package/src/enrollments/EnrollmentTypes.ts +76 -0
  102. package/src/enrollments/enrollmentRole.ts +6 -0
  103. package/src/enrollments/getEnrollmentGenerator.ts +79 -0
  104. package/src/enrollments/index.ts +3 -0
  105. package/src/fetch/__mocks__/fetchJson.ts +1 -0
  106. package/src/fetch/__mocks__/getPagedDataGenerator.ts +8 -0
  107. package/src/fetch/__mocks__/index.ts +6 -0
  108. package/src/fetch/apiGetConfig.ts +10 -0
  109. package/src/fetch/apiWriteConfig.ts +13 -0
  110. package/src/fetch/canvasDataFetchGenFunc.ts +20 -0
  111. package/src/fetch/fetchJson.ts +22 -0
  112. package/src/fetch/getPagedDataGenerator.ts +157 -0
  113. package/src/fetch/index.ts +5 -0
  114. package/src/fetch/utils.ts +16 -0
  115. package/src/files.ts +60 -0
  116. package/src/fixes/annotations.ts +105 -0
  117. package/src/fixes/index.ts +81 -0
  118. package/src/index.ts +29 -0
  119. package/src/profile.ts +253 -0
  120. package/src/rubricTypes.ts +82 -0
  121. package/src/rubrics.ts +48 -0
  122. package/src/term/Term.ts +77 -0
  123. package/src/term/__tests__/dateFromTermName.test.ts +22 -0
  124. package/src/term/__tests__/getTermsGenerator.test.ts +24 -0
  125. package/src/term/dateFromTermName.ts +17 -0
  126. package/src/term/getTermsGenerator.ts +21 -0
  127. package/src/term/index.ts +3 -0
  128. package/src/toolbox.ts +19 -0
  129. package/src/types.ts +134 -0
  130. package/src/users/getUserGenerator.ts +39 -0
  131. package/src/users/index.ts +1 -0
  132. package/tsconfig.json +46 -0
  133. package/webpack.config.js +122 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Unity Environmental University
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/html-loader.js ADDED
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ process(src) {
3
+ return {
4
+ code: `module.exports = ${JSON.stringify(src)};`, // Returns the HTML as a string
5
+ };
6
+ },
7
+ };
package/jest.config.js ADDED
@@ -0,0 +1,20 @@
1
+ const path = require('path')
2
+ const {pathsToModuleNameMapper} = require("ts-jest");
3
+ const {compilerOptions} = require("./tsconfig.json");
4
+ /** @type {import('ts-jest').JestConfigWithTsJest} */
5
+ module.exports = {
6
+ preset: 'ts-jest',
7
+ testEnvironment: 'jsdom',
8
+ "transformIgnorePatterns": [
9
+ "node_modules/(?!isomorphic-git)"
10
+ ],
11
+ transform: {
12
+ "^.+\\.html$": "<rootDir>/html-loader.js",
13
+ },
14
+ moduleNameMapper: {
15
+ ...pathsToModuleNameMapper(compilerOptions.paths, {prefix: '<rootDir>/src/'}),
16
+ // "^webextension-polyfill$":
17
+ // path.join(process.cwd(), "src", "__mocks__", "runtime.ts"),
18
+ // '\\.(css|scss)$': 'identity-obj-proxy',
19
+ }
20
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@ueu/ueu-canvas",
3
+ "version": "0.0.2",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "exports": {
7
+ ".": "./dist/index.js"
8
+ },
9
+ "scripts": {
10
+ "test": "ts-jest",
11
+ "build": "webpack && tsc --emitDeclarationOnly",
12
+ "build:webpack": "webpack",
13
+ "build:types": "tsc --emitDeclarationOnly"
14
+ },
15
+ "keywords": ["canvas", "lms", "course", "education"],
16
+ "author": "Unity Environmental University",
17
+ "license": "MIT",
18
+ "description": "Canvas LMS API client and utilities for course management at Unity Environmental University",
19
+ "devDependencies": {
20
+ "@testing-library/jest-dom": "^6.6.3",
21
+ "@types/aria-query": "^5.0.4",
22
+ "@types/assert": "^1.5.11",
23
+ "@types/jest": "^29.5.14",
24
+ "@types/webpack": "^5.28.5",
25
+ "copy-webpack-plugin": "^12.0.2",
26
+ "dotenv": "^16.4.7",
27
+ "html-webpack-plugin": "^5.6.3",
28
+ "jest": "^29.7.0",
29
+ "jest-dom": "^4.0.0",
30
+ "jest-environment-jsdom": "^29.7.0",
31
+ "jest-fetch-mock": "^3.0.3",
32
+ "process": "^0.11.10",
33
+ "ts-jest": "^29.2.5",
34
+ "ts-loader": "^9.5.2",
35
+ "tsconfig-paths-webpack-plugin": "^4.2.0",
36
+ "typescript": "^5.7.3",
37
+ "webpack": "^5.97.1",
38
+ "webpack-cli": "^6.0.1"
39
+ },
40
+ "dependencies": {
41
+ "assert": "^2.1.0",
42
+ "redux-persist": "^6.0.0",
43
+ "temporal-polyfill": "^0.2.5"
44
+ }
45
+ }
package/src/Account.ts ADDED
@@ -0,0 +1,69 @@
1
+ import {BaseCanvasObject} from "./baseCanvasObject";
2
+ import {CanvasData} from "./canvasDataDefs";
3
+ import {ICanvasCallConfig} from "./canvasUtils";
4
+ import {getPagedDataGenerator} from "./fetch/getPagedDataGenerator";
5
+ import {fetchJson} from "./fetch/fetchJson";
6
+
7
+ /**
8
+ * A base class for objects that interact with the Canvas API
9
+ */
10
+ export class Account extends BaseCanvasObject<CanvasData> {
11
+ static nameProperty = 'name'; // The field name of the primary name of the canvas object type
12
+ static contentUrlTemplate = '/api/v1/accounts/{content_id}'; // A templated url to get a single item
13
+ static allContentUrlTemplate = '/api/v1/accounts'; // A templated url to get all items
14
+ private static account: Account;
15
+
16
+ static async getFromUrl(url: string | null = null) {
17
+ if (url === null) {
18
+ url = document.documentURI
19
+ }
20
+ const match = /accounts\/(\d+)/.exec(url);
21
+ if (match) {
22
+ console.log(match);
23
+ return await this.getAccountById(parseInt(match[1]));
24
+ }
25
+ return null;
26
+ }
27
+
28
+ static async getAccountById(accountId: number, config: ICanvasCallConfig | undefined = undefined): Promise<Account> {
29
+ const data = await fetchJson(`/api/v1/accounts/${accountId}`, config)
30
+ return new Account(data);
31
+ }
32
+
33
+
34
+ static async getRootAccount(resetCache = false) {
35
+ if (!resetCache && this.hasOwnProperty('account') && this.account) {
36
+ return this.account;
37
+ }
38
+ const accountGen = getPagedDataGenerator('/api/v1/accounts')
39
+ for await (const account of accountGen) {
40
+ if (account.root_account_id) continue; //if there is a root_account_id, this is not the root account
41
+ const root = new Account(account);
42
+ this.account = root;
43
+ return root;
44
+ }
45
+ }
46
+
47
+
48
+ get rootAccountId() {
49
+ return this.canvasData['root_account_id']
50
+ }
51
+
52
+ }
53
+
54
+ export class RootAccountNotFoundError extends Error {
55
+ name = 'RootAccountNotFoundError';
56
+ }
57
+
58
+ const getAccountIdFromUrl = (url: string | null = null) =>
59
+ {
60
+ if (url === null) {
61
+ url = document.documentURI;
62
+ }
63
+ const match = /accounts\/(\d+)/.exec(url);
64
+ return match ? parseInt(match[1]) : null;
65
+ }
66
+
67
+ export {
68
+ getAccountIdFromUrl,
69
+ }
@@ -0,0 +1,3 @@
1
+ export class NotImplementedException extends Error {
2
+ name = "NotImplementedException"
3
+ }
@@ -0,0 +1,55 @@
1
+ import { ICanvasCallConfig } from '@/canvasUtils';
2
+ import { CanvasData } from '@/canvasDataDefs';
3
+ import {BaseCanvasObject} from "@/baseCanvasObject";
4
+
5
+ // Create a type alias for the original Account class
6
+ export class MockAccount extends BaseCanvasObject<CanvasData> {
7
+ static override nameProperty = 'name';
8
+ static override contentUrlTemplate = '/api/v1/accounts/{content_id}';
9
+ static override allContentUrlTemplate = '/api/v1/accounts';
10
+ private static mockAccount: MockAccount;
11
+
12
+ static mockAccounts: MockAccount[] = [];
13
+ static mockDataById: Record<number, CanvasData> = {};
14
+
15
+ static resetMocks() {
16
+ this.mockAccounts = [];
17
+ this.mockDataById = {};
18
+ this.mockAccount = undefined as unknown as MockAccount;
19
+ }
20
+
21
+ static async getFromUrl(url: string | null = null) {
22
+ if (url === null) {
23
+ url = document.documentURI;
24
+ }
25
+ const match = /accounts\/(\d+)/.exec(url);
26
+ if (match) {
27
+ return await this.getAccountById(parseInt(match[1]));
28
+ }
29
+ return null;
30
+ }
31
+
32
+ static async getAccountById(accountId: number, _config: ICanvasCallConfig | undefined = undefined): Promise<MockAccount> {
33
+ const data = this.mockDataById[accountId];
34
+ if (!data) {
35
+ throw new Error(`No mock data found for account ID: ${accountId}`);
36
+ }
37
+ return new MockAccount(data);
38
+ }
39
+
40
+ static async getRootAccount(resetCache = false): Promise<MockAccount> {
41
+ if (!resetCache && this.mockAccount) {
42
+ return this.mockAccount;
43
+ }
44
+ const root = this.mockAccounts.find((a) => a.rootAccountId === null);
45
+ if (!root) {
46
+ throw new Error('No root account found in mock data');
47
+ }
48
+ this.mockAccount = root;
49
+ return root;
50
+ }
51
+
52
+ get rootAccountId() {
53
+ return this.canvasData['root_account_id'];
54
+ }
55
+ }
@@ -0,0 +1,8 @@
1
+ export * from './Account'
2
+ export * from './mockAccountData'
3
+ export * from './mockEnrollment'
4
+ export * from './mockRubricData'
5
+ export * from './mockTabData'
6
+ export * from './mockUserData'
7
+ export * from './mockTermData'
8
+ export * from './utils'
@@ -0,0 +1,43 @@
1
+ import {IAccountData} from "../canvasDataDefs";
2
+
3
+ /**
4
+ * From Canvas Api Docs - https://canvas.instructure.com/doc/api/accounts.html
5
+ */
6
+ export const mockAccountData: IAccountData = {
7
+ // the ID of the Account object
8
+ "id": 2,
9
+ // The display name of the account
10
+ "name": "Canvas Account",
11
+ // The UUID of the account
12
+ "uuid": "WvAHhY5FINzq5IyRIJybGeiXyFkG3SqHUPb7jZY5",
13
+ // The account's parent ID, or null if this is the root account
14
+ "parent_account_id": 1,
15
+ // The ID of the root account, or null if this is the root account
16
+ "root_account_id": 1,
17
+ // The storage quota for the account in megabytes, if not otherwise specified
18
+ "default_storage_quota_mb": 500,
19
+ // The storage quota for a user in the account in megabytes, if not otherwise
20
+ // specified
21
+ "default_user_storage_quota_mb": 50,
22
+ // The storage quota for a group in the account in megabytes, if not otherwise
23
+ // specified
24
+ "default_group_storage_quota_mb": 50,
25
+ // The default time zone of the account. Allowed time zones are
26
+ // {http://www.iana.org/time-zones IANA time zones} or friendlier
27
+ // {http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html Ruby on Rails
28
+ // time zones}.
29
+ "default_time_zone": "America/Denver",
30
+ // The account's identifier in the Student Information System. Only included if
31
+ // the user has permission to view SIS information.
32
+ "sis_account_id": "123xyz",
33
+ // The account's identifier in the Student Information System. Only included if
34
+ // the user has permission to view SIS information.
35
+ "integration_id": "123xyz",
36
+ // The id of the SIS import if created through SIS. Only included if the user
37
+ // has permission to manage SIS information.
38
+ "sis_import_id": 12,
39
+ // The account's identifier that is sent as context_id in LTI launches.
40
+ "lti_guid": "123xyz",
41
+ // The state of the account. Can be 'active' or 'deleted'.
42
+ "workflow_state": "active"
43
+ }
@@ -0,0 +1,22 @@
1
+ import {IUserData} from "@/canvasDataDefs";
2
+ import {mockUserData} from "@/__mocks__/mockUserData";
3
+ import {createEnrollmentRole, EnrollmentData} from "@/enrollments";
4
+
5
+ export const mockEnrollment: EnrollmentData = {
6
+ created_at: "",
7
+ end_at: "",
8
+ html_url: "",
9
+ role: createEnrollmentRole(""),
10
+ role_id: 0,
11
+ root_account_id: 0,
12
+ start_at: "",
13
+ total_activity_time: 0,
14
+ unposted_current_points: 0,
15
+ updated_at: "",
16
+ id: 1,
17
+ user_id: 1,
18
+ type: 'StudentEnrollment',
19
+ enrollment_state: 'active',
20
+ course_id: 1,
21
+ user: {...mockUserData, id: 1, name: 'Student Name', sis_user_id: '12345'} as IUserData
22
+ };
@@ -0,0 +1,71 @@
1
+ import mock = jest.mock;
2
+
3
+
4
+ import {IAssignmentData} from "@canvas/content/types";
5
+
6
+ import {IRubricAssessmentData, IRubricAssociationData, RubricTypes} from "@canvas/rubricTypes";
7
+
8
+
9
+ export const mockRubricAssociation:IRubricAssociationData = {
10
+ association_id: 0,
11
+ association_type: "Assignment",
12
+ hide_outcome_results: false,
13
+ hide_points: false,
14
+ hide_score_total: false,
15
+ id: 0,
16
+ purpose: 'grading',
17
+ rubric_id: 0,
18
+ use_for_grading: false
19
+ }
20
+
21
+ export const mockRubricAssessment: IRubricAssessmentData = {
22
+ artifact_attempt: 0,
23
+ artifact_id: 0,
24
+ artifact_type: "",
25
+ assessment_type: 'grading',
26
+ assessor_id: 0,
27
+ id: 0,
28
+ rubric_association_id: 0,
29
+ rubric_id: 0,
30
+ score: 0
31
+
32
+ }
33
+
34
+ export const mockRubric:RubricTypes = {
35
+ // the ID of the rubric
36
+ "id": 1,
37
+ // title of the rubric
38
+ "title": "some title",
39
+ // the context owning the rubric
40
+ "context_id": 1,
41
+ "context_type": "Course",
42
+ "points_possible": 10.0,
43
+ "reusable": false,
44
+ "read_only": true,
45
+ "free_form_criterion_comments": true,
46
+ "hide_score_total": true,
47
+ "data": null,
48
+ "assessments": [mockRubricAssessment],
49
+ "associations": [mockRubricAssociation]
50
+ }
51
+
52
+
53
+ export function mockRubricsForAssignments(
54
+ assignmentIds:number[],
55
+ rubricOverride?:Partial<RubricTypes>,
56
+ associationOverride?:Partial<IRubricAssociationData>
57
+ ) {
58
+
59
+ return assignmentIds.map((association_id, index) => {
60
+ const rubric_id = 1000 + index;
61
+ return {
62
+ ...mockRubric,
63
+ id: rubric_id,
64
+ associations: [{...mockRubricAssociation, rubric_id, association_id, ...associationOverride}],
65
+ ...rubricOverride
66
+ }
67
+ })
68
+ }
69
+
70
+
71
+ export default mockRubric;
@@ -0,0 +1,13 @@
1
+ import {ITabData} from "@/types";
2
+
3
+ export const mockTabData:ITabData = {
4
+ full_url: "/api/v1/...",
5
+ html_url: "http://localhost",
6
+ id: "0",
7
+ label: "tab",
8
+ position: 0,
9
+ type: "",
10
+ visibility: ""
11
+ }
12
+
13
+ export default mockTabData;
@@ -0,0 +1,7 @@
1
+ import {ITermData} from "@/term/Term";
2
+
3
+ export const mockTermData: ITermData = {
4
+ id: 1,
5
+ course_count: 0, end_at: "", name: "", start_at: "", workflow_state: "active"
6
+
7
+ }
@@ -0,0 +1,14 @@
1
+ //Generated by ChatGPT-4o
2
+
3
+ import {IUserData} from "../canvasDataDefs";
4
+
5
+ export const mockUserData: IUserData = {
6
+ id: 1,
7
+ name: 'John Doe',
8
+ sortable_name: 'Doe, John',
9
+ last_name: 'Doe',
10
+ first_name: 'John',
11
+ short_name: 'J. Doe',
12
+ email: 'john.doe@example.com',
13
+ bio: 'This is a bio for John Doe.',
14
+ };
@@ -0,0 +1,9 @@
1
+ export function returnMockAsyncGen<T>(dataSet: T[]) {
2
+ return async function* () {
3
+ for (const value of dataSet) yield value;
4
+ }
5
+ }
6
+
7
+ export function mockAsyncGen<T>(dataSet: T[]) {
8
+ return returnMockAsyncGen<T>(dataSet)();
9
+ }