fix: .js toevoegen aan imports
This commit is contained in:
		
							parent
							
								
									cb82a1afa7
								
							
						
					
					
						commit
						9d0e63649b
					
				
					 53 changed files with 174 additions and 169 deletions
				
			
		|  | @ -1,4 +1,4 @@ | |||
| import { EnvVars, getEnvVar } from './util/envvars'; | ||||
| import { EnvVars, getEnvVar } from './util/envvars.js'; | ||||
| 
 | ||||
| // API
 | ||||
| export const DWENGO_API_BASE = getEnvVar(EnvVars.LearningContentRepoApiBaseUrl); | ||||
|  |  | |||
|  | @ -1,11 +1,11 @@ | |||
| import { Request, Response } from 'express'; | ||||
| import { FALLBACK_LANG } from '../config.js'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '../interfaces/learning-content'; | ||||
| import learningObjectService from '../services/learning-objects/learning-object-service'; | ||||
| import { EnvVars, getEnvVar } from '../util/envvars'; | ||||
| import { Language } from '../entities/content/language'; | ||||
| import { BadRequestException } from '../exceptions'; | ||||
| import attachmentService from '../services/learning-objects/attachment-service'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '../interfaces/learning-content.js'; | ||||
| import learningObjectService from '../services/learning-objects/learning-object-service.js'; | ||||
| import { EnvVars, getEnvVar } from '../util/envvars.js'; | ||||
| import { Language } from '../entities/content/language.js'; | ||||
| import { BadRequestException } from '../exceptions.js'; | ||||
| import attachmentService from '../services/learning-objects/attachment-service.js'; | ||||
| import { NotFoundError } from '@mikro-orm/core'; | ||||
| 
 | ||||
| function getLearningObjectIdentifierFromRequest(req: Request): LearningObjectIdentifier { | ||||
|  |  | |||
|  | @ -1,10 +1,14 @@ | |||
| import { Request, Response } from 'express'; | ||||
| import { themes } from '../data/themes.js'; | ||||
| import { FALLBACK_LANG } from '../config.js'; | ||||
| import learningPathService from '../services/learning-paths/learning-path-service'; | ||||
| import { BadRequestException, NotFoundException } from '../exceptions'; | ||||
| import { Language } from '../entities/content/language'; | ||||
| import { PersonalizationTarget, personalizedForGroup, personalizedForStudent } from '../services/learning-paths/learning-path-personalization-util'; | ||||
| import learningPathService from '../services/learning-paths/learning-path-service.js'; | ||||
| import { BadRequestException, NotFoundException } from '../exceptions.js'; | ||||
| import { Language } from '../entities/content/language.js'; | ||||
| import { | ||||
|     PersonalizationTarget, | ||||
|     personalizedForGroup, | ||||
|     personalizedForStudent, | ||||
| } from '../services/learning-paths/learning-path-personalization-util.js'; | ||||
| 
 | ||||
| /** | ||||
|  * Fetch learning paths based on query parameters. | ||||
|  |  | |||
|  | @ -1,8 +1,9 @@ | |||
| import { Request, Response } from 'express'; | ||||
| import { themes } from '../data/themes.js'; | ||||
| import { FALLBACK_LANG } from '../config.js'; | ||||
| import { fetchLearningPaths, searchLearningPaths } from '../services/learningPaths.js'; | ||||
| import { getLogger } from '../logging/initalize.js'; | ||||
| import learningPathService from '../services/learning-paths/learning-path-service.js'; | ||||
| import { Language } from '../entities/content/language.js'; | ||||
| /** | ||||
|  * Fetch learning paths based on query parameters. | ||||
|  */ | ||||
|  |  | |||
|  | @ -28,8 +28,8 @@ import { LearningPath } from '../entities/content/learning-path.entity.js'; | |||
| import { LearningPathRepository } from './content/learning-path-repository.js'; | ||||
| import { AttachmentRepository } from './content/attachment-repository.js'; | ||||
| import { Attachment } from '../entities/content/attachment.entity.js'; | ||||
| import { LearningPathNode } from '../entities/content/learning-path-node.entity'; | ||||
| import { LearningPathTransition } from '../entities/content/learning-path-transition.entity'; | ||||
| import { LearningPathNode } from '../entities/content/learning-path-node.entity.js'; | ||||
| import { LearningPathTransition } from '../entities/content/learning-path-transition.entity.js'; | ||||
| 
 | ||||
| let entityManager: EntityManager | undefined; | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import { Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro | |||
| import { Class } from '../classes/class.entity.js'; | ||||
| import { Group } from './group.entity.js'; | ||||
| import { Language } from '../content/language.js'; | ||||
| import { AssignmentRepository } from '../../data/assignments/assignment-repository'; | ||||
| import { AssignmentRepository } from '../../data/assignments/assignment-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => AssignmentRepository }) | ||||
| export class Assignment { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core'; | ||||
| import { Assignment } from './assignment.entity.js'; | ||||
| import { Student } from '../users/student.entity.js'; | ||||
| import { GroupRepository } from '../../data/assignments/group-repository'; | ||||
| import { GroupRepository } from '../../data/assignments/group-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => GroupRepository }) | ||||
| export class Group { | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import { Student } from '../users/student.entity.js'; | |||
| import { Group } from './group.entity.js'; | ||||
| import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { Language } from '../content/language.js'; | ||||
| import { SubmissionRepository } from '../../data/assignments/submission-repository'; | ||||
| import { SubmissionRepository } from '../../data/assignments/submission-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => SubmissionRepository }) | ||||
| export class Submission { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Entity, Enum, ManyToOne } from '@mikro-orm/core'; | ||||
| import { Student } from '../users/student.entity.js'; | ||||
| import { Class } from './class.entity.js'; | ||||
| import { ClassJoinRequestRepository } from '../../data/classes/class-join-request-repository'; | ||||
| import { ClassJoinRequestRepository } from '../../data/classes/class-join-request-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => ClassJoinRequestRepository }) | ||||
| export class ClassJoinRequest { | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import { Collection, Entity, ManyToMany, PrimaryKey, Property } from '@mikro-orm | |||
| import { v4 } from 'uuid'; | ||||
| import { Teacher } from '../users/teacher.entity.js'; | ||||
| import { Student } from '../users/student.entity.js'; | ||||
| import { ClassRepository } from '../../data/classes/class-repository'; | ||||
| import { ClassRepository } from '../../data/classes/class-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => ClassRepository }) | ||||
| export class Class { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Entity, ManyToOne } from '@mikro-orm/core'; | ||||
| import { Teacher } from '../users/teacher.entity.js'; | ||||
| import { Class } from './class.entity.js'; | ||||
| import { TeacherInvitationRepository } from '../../data/classes/teacher-invitation-repository'; | ||||
| import { TeacherInvitationRepository } from '../../data/classes/teacher-invitation-repository.js'; | ||||
| 
 | ||||
| /** | ||||
|  * Invitation of a teacher into a class (in order to teach it). | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { LearningObject } from './learning-object.entity.js'; | ||||
| import { AttachmentRepository } from '../../data/content/attachment-repository'; | ||||
| import { AttachmentRepository } from '../../data/content/attachment-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => AttachmentRepository }) | ||||
| export class Attachment { | ||||
|  |  | |||
|  | @ -2,9 +2,9 @@ import { Embeddable, Embedded, Entity, Enum, ManyToMany, OneToMany, PrimaryKey, | |||
| import { Language } from './language.js'; | ||||
| import { Attachment } from './attachment.entity.js'; | ||||
| import { Teacher } from '../users/teacher.entity.js'; | ||||
| import { DwengoContentType } from '../../services/learning-objects/processing/content-type'; | ||||
| import { DwengoContentType } from '../../services/learning-objects/processing/content-type.js'; | ||||
| import { v4 } from 'uuid'; | ||||
| import { LearningObjectRepository } from '../../data/content/learning-object-repository'; | ||||
| import { LearningObjectRepository } from '../../data/content/learning-object-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => LearningObjectRepository }) | ||||
| export class LearningObject { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { Language } from './language'; | ||||
| import { LearningPath } from './learning-path.entity'; | ||||
| import { LearningPathTransition } from './learning-path-transition.entity'; | ||||
| import { Language } from './language.js'; | ||||
| import { LearningPath } from './learning-path.entity.js'; | ||||
| import { LearningPathTransition } from './learning-path-transition.entity.js'; | ||||
| 
 | ||||
| @Entity() | ||||
| export class LearningPathNode { | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { LearningPathNode } from './learning-path-node.entity'; | ||||
| import { LearningPathNode } from './learning-path-node.entity.js'; | ||||
| 
 | ||||
| @Entity() | ||||
| export class LearningPathTransition { | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import { Entity, Enum, ManyToMany, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { Language } from './language.js'; | ||||
| import { Teacher } from '../users/teacher.entity.js'; | ||||
| import { LearningPathRepository } from '../../data/content/learning-path-repository'; | ||||
| import { LearningPathNode } from './learning-path-node.entity'; | ||||
| import { LearningPathRepository } from '../../data/content/learning-path-repository.js'; | ||||
| import { LearningPathNode } from './learning-path-node.entity.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => LearningPathRepository }) | ||||
| export class LearningPath { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { Question } from './question.entity.js'; | ||||
| import { Teacher } from '../users/teacher.entity.js'; | ||||
| import { AnswerRepository } from '../../data/questions/answer-repository'; | ||||
| import { AnswerRepository } from '../../data/questions/answer-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => AnswerRepository }) | ||||
| export class Answer { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||
| import { Language } from '../content/language.js'; | ||||
| import { Student } from '../users/student.entity.js'; | ||||
| import { QuestionRepository } from '../../data/questions/question-repository'; | ||||
| import { QuestionRepository } from '../../data/questions/question-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => QuestionRepository }) | ||||
| export class Question { | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { Collection, Entity, ManyToMany } from '@mikro-orm/core'; | ||||
| import { User } from './user.entity.js'; | ||||
| import { Class } from '../classes/class.entity.js'; | ||||
| import { TeacherRepository } from '../../data/users/teacher-repository'; | ||||
| import { TeacherRepository } from '../../data/users/teacher-repository.js'; | ||||
| 
 | ||||
| @Entity({ repository: () => TeacherRepository }) | ||||
| export class Teacher extends User { | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import * as express from 'express'; | |||
| import * as jwt from 'jsonwebtoken'; | ||||
| import { AuthenticatedRequest } from './authenticated-request.js'; | ||||
| import { AuthenticationInfo } from './authentication-info.js'; | ||||
| import { ForbiddenException, UnauthorizedException } from '../../exceptions'; | ||||
| import { ForbiddenException, UnauthorizedException } from '../../exceptions.js'; | ||||
| 
 | ||||
| const JWKS_CACHE = true; | ||||
| const JWKS_RATE_LIMIT = true; | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { getAttachmentRepository } from '../../data/repositories'; | ||||
| import { Attachment } from '../../entities/content/attachment.entity'; | ||||
| import { LearningObjectIdentifier } from '../../interfaces/learning-content'; | ||||
| import { getAttachmentRepository } from '../../data/repositories.js'; | ||||
| import { Attachment } from '../../entities/content/attachment.entity.js'; | ||||
| import { LearningObjectIdentifier } from '../../interfaces/learning-content.js'; | ||||
| 
 | ||||
| const attachmentService = { | ||||
|     getAttachment(learningObjectId: LearningObjectIdentifier, attachmentName: string): Promise<Attachment | null> { | ||||
|  |  | |||
|  | @ -1,13 +1,13 @@ | |||
| import { LearningObjectProvider } from './learning-object-provider'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '../../interfaces/learning-content'; | ||||
| import { getLearningObjectRepository, getLearningPathRepository } from '../../data/repositories'; | ||||
| import { Language } from '../../entities/content/language'; | ||||
| import { LearningObject } from '../../entities/content/learning-object.entity'; | ||||
| import { getUrlStringForLearningObject } from '../../util/links'; | ||||
| import processingService from './processing/processing-service'; | ||||
| import { LearningObjectProvider } from './learning-object-provider.js'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '../../interfaces/learning-content.js'; | ||||
| import { getLearningObjectRepository, getLearningPathRepository } from '../../data/repositories.js'; | ||||
| import { Language } from '../../entities/content/language.js'; | ||||
| import { LearningObject } from '../../entities/content/learning-object.entity.js'; | ||||
| import { getUrlStringForLearningObject } from '../../util/links.js'; | ||||
| import processingService from './processing/processing-service.js'; | ||||
| import { NotFoundError } from '@mikro-orm/core'; | ||||
| import learningObjectService from './learning-object-service'; | ||||
| import {getLogger, Logger} from "../../logging/initalize"; | ||||
| import learningObjectService from './learning-object-service.js'; | ||||
| import { getLogger, Logger } from '../../logging/initalize.js'; | ||||
| 
 | ||||
| const logger: Logger = getLogger(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,8 +9,8 @@ import { | |||
|     LearningPathResponse, | ||||
| } from '../../interfaces/learning-content.js'; | ||||
| import dwengoApiLearningPathProvider from '../learning-paths/dwengo-api-learning-path-provider.js'; | ||||
| import { LearningObjectProvider } from './learning-object-provider'; | ||||
| import {getLogger, Logger} from "../../logging/initalize"; | ||||
| import { LearningObjectProvider } from './learning-object-provider.js'; | ||||
| import { getLogger, Logger } from '../../logging/initalize.js'; | ||||
| 
 | ||||
| const logger: Logger = getLogger(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '../../interfaces/learning-content'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '../../interfaces/learning-content.js'; | ||||
| 
 | ||||
| export interface LearningObjectProvider { | ||||
|     /** | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '../../interfaces/learning-content'; | ||||
| import dwengoApiLearningObjectProvider from './dwengo-api-learning-object-provider'; | ||||
| import { LearningObjectProvider } from './learning-object-provider'; | ||||
| import { EnvVars, getEnvVar } from '../../util/envvars'; | ||||
| import databaseLearningObjectProvider from './database-learning-object-provider'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '../../interfaces/learning-content.js'; | ||||
| import dwengoApiLearningObjectProvider from './dwengo-api-learning-object-provider.js'; | ||||
| import { LearningObjectProvider } from './learning-object-provider.js'; | ||||
| import { EnvVars, getEnvVar } from '../../util/envvars.js'; | ||||
| import databaseLearningObjectProvider from './database-learning-object-provider.js'; | ||||
| 
 | ||||
| function getProvider(id: LearningObjectIdentifier): LearningObjectProvider { | ||||
|     if (id.hruid.startsWith(getEnvVar(EnvVars.UserContentPrefix))) { | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| 
 | ||||
| import DOMPurify from 'isomorphic-dompurify'; | ||||
| import { type } from 'node:os'; | ||||
| import { DwengoContentType } from '../content-type'; | ||||
| import { StringProcessor } from '../string-processor'; | ||||
| import { DwengoContentType } from '../content-type.js'; | ||||
| import { StringProcessor } from '../string-processor.js'; | ||||
| 
 | ||||
| class AudioProcessor extends StringProcessor { | ||||
|     constructor() { | ||||
|  |  | |||
|  | @ -5,10 +5,10 @@ | |||
|  */ | ||||
| 
 | ||||
| import DOMPurify from 'isomorphic-dompurify'; | ||||
| import { ProcessingError } from '../processing-error'; | ||||
| import { isValidHttpUrl } from '../../../../util/links'; | ||||
| import { DwengoContentType } from '../content-type'; | ||||
| import { StringProcessor } from '../string-processor'; | ||||
| import { ProcessingError } from '../processing-error.js'; | ||||
| import { isValidHttpUrl } from '../../../../util/links.js'; | ||||
| import { DwengoContentType } from '../content-type.js'; | ||||
| import { StringProcessor } from '../string-processor.js'; | ||||
| 
 | ||||
| class ExternProcessor extends StringProcessor { | ||||
|     constructor() { | ||||
|  |  | |||
|  | @ -4,17 +4,17 @@ | |||
| 
 | ||||
| import DOMPurify from 'isomorphic-dompurify'; | ||||
| import { GIFTQuestion, parse } from 'gift-pegjs'; | ||||
| import { DwengoContentType } from '../content-type'; | ||||
| import { GIFTQuestionRenderer } from './question-renderers/gift-question-renderer'; | ||||
| import { MultipleChoiceQuestionRenderer } from './question-renderers/multiple-choice-question-renderer'; | ||||
| import { CategoryQuestionRenderer } from './question-renderers/category-question-renderer'; | ||||
| import { DescriptionQuestionRenderer } from './question-renderers/description-question-renderer'; | ||||
| import { EssayQuestionRenderer } from './question-renderers/essay-question-renderer'; | ||||
| import { MatchingQuestionRenderer } from './question-renderers/matching-question-renderer'; | ||||
| import { NumericalQuestionRenderer } from './question-renderers/numerical-question-renderer'; | ||||
| import { ShortQuestionRenderer } from './question-renderers/short-question-renderer'; | ||||
| import { TrueFalseQuestionRenderer } from './question-renderers/true-false-question-renderer'; | ||||
| import { StringProcessor } from '../string-processor'; | ||||
| import { DwengoContentType } from '../content-type.js'; | ||||
| import { GIFTQuestionRenderer } from './question-renderers/gift-question-renderer.js'; | ||||
| import { MultipleChoiceQuestionRenderer } from './question-renderers/multiple-choice-question-renderer.js'; | ||||
| import { CategoryQuestionRenderer } from './question-renderers/category-question-renderer.js'; | ||||
| import { DescriptionQuestionRenderer } from './question-renderers/description-question-renderer.js'; | ||||
| import { EssayQuestionRenderer } from './question-renderers/essay-question-renderer.js'; | ||||
| import { MatchingQuestionRenderer } from './question-renderers/matching-question-renderer.js'; | ||||
| import { NumericalQuestionRenderer } from './question-renderers/numerical-question-renderer.js'; | ||||
| import { ShortQuestionRenderer } from './question-renderers/short-question-renderer.js'; | ||||
| import { TrueFalseQuestionRenderer } from './question-renderers/true-false-question-renderer.js'; | ||||
| import { StringProcessor } from '../string-processor.js'; | ||||
| 
 | ||||
| class GiftProcessor extends StringProcessor { | ||||
|     private renderers: RendererMap = { | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { GIFTQuestionRenderer } from './gift-question-renderer'; | ||||
| import { GIFTQuestionRenderer } from './gift-question-renderer.js'; | ||||
| import { Category } from 'gift-pegjs'; | ||||
| import { ProcessingError } from '../../processing-error'; | ||||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class CategoryQuestionRenderer extends GIFTQuestionRenderer<Category> { | ||||
|     render(question: Category, questionNumber: number): string { | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { GIFTQuestionRenderer } from './gift-question-renderer'; | ||||
| import { GIFTQuestionRenderer } from './gift-question-renderer.js'; | ||||
| import { Description } from 'gift-pegjs'; | ||||
| import { ProcessingError } from '../../processing-error'; | ||||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class DescriptionQuestionRenderer extends GIFTQuestionRenderer<Description> { | ||||
|     render(question: Description, questionNumber: number): string { | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { GIFTQuestionRenderer } from './gift-question-renderer'; | ||||
| import { GIFTQuestionRenderer } from './gift-question-renderer.js'; | ||||
| import { Essay } from 'gift-pegjs'; | ||||
| 
 | ||||
| export class EssayQuestionRenderer extends GIFTQuestionRenderer<Essay> { | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { GIFTQuestionRenderer } from './gift-question-renderer'; | ||||
| import { GIFTQuestionRenderer } from './gift-question-renderer.js'; | ||||
| import { Matching } from 'gift-pegjs'; | ||||
| import { ProcessingError } from '../../processing-error'; | ||||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class MatchingQuestionRenderer extends GIFTQuestionRenderer<Matching> { | ||||
|     render(question: Matching, questionNumber: number): string { | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| import { GIFTQuestionRenderer } from './gift-question-renderer'; | ||||
| import { GIFTQuestionRenderer } from './gift-question-renderer.js'; | ||||
| import { MultipleChoice } from 'gift-pegjs'; | ||||
| 
 | ||||
| export class MultipleChoiceQuestionRenderer extends GIFTQuestionRenderer<MultipleChoice> { | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { GIFTQuestionRenderer } from './gift-question-renderer'; | ||||
| import { GIFTQuestionRenderer } from './gift-question-renderer.js'; | ||||
| import { Numerical } from 'gift-pegjs'; | ||||
| import { ProcessingError } from '../../processing-error'; | ||||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class NumericalQuestionRenderer extends GIFTQuestionRenderer<Numerical> { | ||||
|     render(question: Numerical, questionNumber: number): string { | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { GIFTQuestionRenderer } from './gift-question-renderer'; | ||||
| import { GIFTQuestionRenderer } from './gift-question-renderer.js'; | ||||
| import { ShortAnswer } from 'gift-pegjs'; | ||||
| import { ProcessingError } from '../../processing-error'; | ||||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class ShortQuestionRenderer extends GIFTQuestionRenderer<ShortAnswer> { | ||||
|     render(question: ShortAnswer, questionNumber: number): string { | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { GIFTQuestionRenderer } from './gift-question-renderer'; | ||||
| import { GIFTQuestionRenderer } from './gift-question-renderer.js'; | ||||
| import { TrueFalse } from 'gift-pegjs'; | ||||
| import { ProcessingError } from '../../processing-error'; | ||||
| import { ProcessingError } from '../../processing-error.js'; | ||||
| 
 | ||||
| export class TrueFalseQuestionRenderer extends GIFTQuestionRenderer<TrueFalse> { | ||||
|     render(question: TrueFalse, questionNumber: number): string { | ||||
|  |  | |||
|  | @ -5,8 +5,8 @@ | |||
| import DOMPurify from 'isomorphic-dompurify'; | ||||
| import { DwengoContentType } from '../content-type.js'; | ||||
| import { ProcessingError } from '../processing-error.js'; | ||||
| import { isValidHttpUrl } from '../../../../util/links'; | ||||
| import { StringProcessor } from '../string-processor'; | ||||
| import { isValidHttpUrl } from '../../../../util/links.js'; | ||||
| import { StringProcessor } from '../string-processor.js'; | ||||
| 
 | ||||
| class InlineImageProcessor extends StringProcessor { | ||||
|     constructor(contentType: DwengoContentType = DwengoContentType.IMAGE_INLINE) { | ||||
|  |  | |||
|  | @ -6,10 +6,10 @@ import AudioProcessor from '../audio/audio-processor.js'; | |||
| import ExternProcessor from '../extern/extern-processor.js'; | ||||
| import InlineImageProcessor from '../image/inline-image-processor.js'; | ||||
| import * as marked from 'marked'; | ||||
| import { getUrlStringForLearningObjectHTML, isValidHttpUrl } from '../../../../util/links'; | ||||
| import { ProcessingError } from '../processing-error'; | ||||
| import { LearningObjectIdentifier } from '../../../../interfaces/learning-content'; | ||||
| import { Language } from '../../../../entities/content/language'; | ||||
| import { getUrlStringForLearningObjectHTML, isValidHttpUrl } from '../../../../util/links.js'; | ||||
| import { ProcessingError } from '../processing-error.js'; | ||||
| import { LearningObjectIdentifier } from '../../../../interfaces/learning-content.js'; | ||||
| import { Language } from '../../../../entities/content/language.js'; | ||||
| 
 | ||||
| import Image = marked.Tokens.Image; | ||||
| import Heading = marked.Tokens.Heading; | ||||
|  |  | |||
|  | @ -4,10 +4,10 @@ | |||
| 
 | ||||
| import { marked } from 'marked'; | ||||
| import InlineImageProcessor from '../image/inline-image-processor.js'; | ||||
| import { DwengoContentType } from '../content-type'; | ||||
| import dwengoMarkedRenderer from './dwengo-marked-renderer'; | ||||
| import { StringProcessor } from '../string-processor'; | ||||
| import { ProcessingError } from '../processing-error'; | ||||
| import { DwengoContentType } from '../content-type.js'; | ||||
| import dwengoMarkedRenderer from './dwengo-marked-renderer.js'; | ||||
| import { StringProcessor } from '../string-processor.js'; | ||||
| import { ProcessingError } from '../processing-error.js'; | ||||
| 
 | ||||
| class MarkdownProcessor extends StringProcessor { | ||||
|     constructor() { | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ import DOMPurify from 'isomorphic-dompurify'; | |||
| import { DwengoContentType } from '../content-type.js'; | ||||
| import { isValidHttpUrl } from '../../../../util/links.js'; | ||||
| import { ProcessingError } from '../processing-error.js'; | ||||
| import { StringProcessor } from '../string-processor'; | ||||
| import { StringProcessor } from '../string-processor.js'; | ||||
| 
 | ||||
| class PdfProcessor extends StringProcessor { | ||||
|     constructor() { | ||||
|  |  | |||
|  | @ -10,12 +10,12 @@ import AudioProcessor from './audio/audio-processor.js'; | |||
| import PdfProcessor from './pdf/pdf-processor.js'; | ||||
| import ExternProcessor from './extern/extern-processor.js'; | ||||
| import GiftProcessor from './gift/gift-processor.js'; | ||||
| import { LearningObject } from '../../../entities/content/learning-object.entity'; | ||||
| import Processor from './processor'; | ||||
| import { DwengoContentType } from './content-type'; | ||||
| import { LearningObjectIdentifier } from '../../../interfaces/learning-content'; | ||||
| import { Language } from '../../../entities/content/language'; | ||||
| import { replaceAsync } from '../../../util/async'; | ||||
| import { LearningObject } from '../../../entities/content/learning-object.entity.js'; | ||||
| import Processor from './processor.js'; | ||||
| import { DwengoContentType } from './content-type.js'; | ||||
| import { LearningObjectIdentifier } from '../../../interfaces/learning-content.js'; | ||||
| import { Language } from '../../../entities/content/language.js'; | ||||
| import { replaceAsync } from '../../../util/async.js'; | ||||
| 
 | ||||
| const EMBEDDED_LEARNING_OBJECT_PLACEHOLDER = /<learning-object hruid="([^"]+)" language="([^"]+)" version="([^"]+)"\/>/g; | ||||
| const LEARNING_OBJECT_DOES_NOT_EXIST = "<div class='non-existing-learning-object' />"; | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { LearningObject } from '../../../entities/content/learning-object.entity'; | ||||
| import { ProcessingError } from './processing-error'; | ||||
| import { DwengoContentType } from './content-type'; | ||||
| import { LearningObject } from '../../../entities/content/learning-object.entity.js'; | ||||
| import { ProcessingError } from './processing-error.js'; | ||||
| import { DwengoContentType } from './content-type.js'; | ||||
| 
 | ||||
| /** | ||||
|  * Abstract base class for all processors. | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| import Processor from './processor'; | ||||
| import { LearningObject } from '../../../entities/content/learning-object.entity'; | ||||
| import Processor from './processor.js'; | ||||
| import { LearningObject } from '../../../entities/content/learning-object.entity.js'; | ||||
| 
 | ||||
| export abstract class StringProcessor extends Processor<string> { | ||||
|     /** | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
| 
 | ||||
| import DOMPurify from 'isomorphic-dompurify'; | ||||
| import { DwengoContentType } from '../content-type.js'; | ||||
| import { StringProcessor } from '../string-processor'; | ||||
| import { StringProcessor } from '../string-processor.js'; | ||||
| 
 | ||||
| class TextProcessor extends StringProcessor { | ||||
|     constructor() { | ||||
|  |  | |||
|  | @ -1,12 +1,12 @@ | |||
| import { LearningPathProvider } from './learning-path-provider'; | ||||
| import { FilteredLearningObject, LearningObjectNode, LearningPath, LearningPathResponse, Transition } from '../../interfaces/learning-content'; | ||||
| import { LearningPath as LearningPathEntity } from '../../entities/content/learning-path.entity'; | ||||
| import { getLearningPathRepository } from '../../data/repositories'; | ||||
| import { Language } from '../../entities/content/language'; | ||||
| import learningObjectService from '../learning-objects/learning-object-service'; | ||||
| import { LearningPathNode } from '../../entities/content/learning-path-node.entity'; | ||||
| import { LearningPathTransition } from '../../entities/content/learning-path-transition.entity'; | ||||
| import { getLastSubmissionForCustomizationTarget, isTransitionPossible, PersonalizationTarget } from './learning-path-personalization-util'; | ||||
| import { LearningPathProvider } from './learning-path-provider.js'; | ||||
| import { FilteredLearningObject, LearningObjectNode, LearningPath, LearningPathResponse, Transition } from '../../interfaces/learning-content.js'; | ||||
| import { LearningPath as LearningPathEntity } from '../../entities/content/learning-path.entity.js'; | ||||
| import { getLearningPathRepository } from '../../data/repositories.js'; | ||||
| import { Language } from '../../entities/content/language.js'; | ||||
| import learningObjectService from '../learning-objects/learning-object-service.js'; | ||||
| import { LearningPathNode } from '../../entities/content/learning-path-node.entity.js'; | ||||
| import { LearningPathTransition } from '../../entities/content/learning-path-transition.entity.js'; | ||||
| import { getLastSubmissionForCustomizationTarget, isTransitionPossible, PersonalizationTarget } from './learning-path-personalization-util.js'; | ||||
| 
 | ||||
| /** | ||||
|  * Fetches the corresponding learning object for each of the nodes and creates a map that maps each node to its | ||||
|  |  | |||
|  | @ -1,8 +1,8 @@ | |||
| import { fetchWithLogging } from '../../util/apiHelper.js'; | ||||
| import { DWENGO_API_BASE } from '../../config.js'; | ||||
| import { LearningPath, LearningPathResponse } from '../../interfaces/learning-content.js'; | ||||
| import { LearningPathProvider } from './learning-path-provider'; | ||||
| import {getLogger, Logger} from "../../logging/initalize"; | ||||
| import { LearningPathProvider } from './learning-path-provider.js'; | ||||
| import { getLogger, Logger } from '../../logging/initalize.js'; | ||||
| 
 | ||||
| const logger: Logger = getLogger(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| import { LearningPathNode } from '../../entities/content/learning-path-node.entity'; | ||||
| import { Student } from '../../entities/users/student.entity'; | ||||
| import { Group } from '../../entities/assignments/group.entity'; | ||||
| import { Submission } from '../../entities/assignments/submission.entity'; | ||||
| import { getClassRepository, getGroupRepository, getStudentRepository, getSubmissionRepository } from '../../data/repositories'; | ||||
| import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier'; | ||||
| import { LearningPathTransition } from '../../entities/content/learning-path-transition.entity'; | ||||
| import { LearningPathNode } from '../../entities/content/learning-path-node.entity.js'; | ||||
| import { Student } from '../../entities/users/student.entity.js'; | ||||
| import { Group } from '../../entities/assignments/group.entity.js'; | ||||
| import { Submission } from '../../entities/assignments/submission.entity.js'; | ||||
| import { getClassRepository, getGroupRepository, getStudentRepository, getSubmissionRepository } from '../../data/repositories.js'; | ||||
| import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js'; | ||||
| import { LearningPathTransition } from '../../entities/content/learning-path-transition.entity.js'; | ||||
| import { JSONPath } from 'jsonpath-plus'; | ||||
| 
 | ||||
| export type PersonalizationTarget = { type: 'student'; student: Student } | { type: 'group'; group: Group }; | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { LearningPath, LearningPathResponse } from '../../interfaces/learning-content'; | ||||
| import { Language } from '../../entities/content/language'; | ||||
| import { PersonalizationTarget } from './learning-path-personalization-util'; | ||||
| import { LearningPath, LearningPathResponse } from '../../interfaces/learning-content.js'; | ||||
| import { Language } from '../../entities/content/language.js'; | ||||
| import { PersonalizationTarget } from './learning-path-personalization-util.js'; | ||||
| 
 | ||||
| /** | ||||
|  * Generic interface for a service which provides access to learning paths from a data source. | ||||
|  |  | |||
|  | @ -1,9 +1,9 @@ | |||
| import { LearningPath, LearningPathResponse } from '../../interfaces/learning-content'; | ||||
| import dwengoApiLearningPathProvider from './dwengo-api-learning-path-provider'; | ||||
| import databaseLearningPathProvider from './database-learning-path-provider'; | ||||
| import { EnvVars, getEnvVar } from '../../util/envvars'; | ||||
| import { Language } from '../../entities/content/language'; | ||||
| import { PersonalizationTarget } from './learning-path-personalization-util'; | ||||
| import { LearningPath, LearningPathResponse } from '../../interfaces/learning-content.js'; | ||||
| import dwengoApiLearningPathProvider from './dwengo-api-learning-path-provider.js'; | ||||
| import databaseLearningPathProvider from './database-learning-path-provider.js'; | ||||
| import { EnvVars, getEnvVar } from '../../util/envvars.js'; | ||||
| import { Language } from '../../entities/content/language.js'; | ||||
| import { PersonalizationTarget } from './learning-path-personalization-util.js'; | ||||
| 
 | ||||
| const userContentPrefix = getEnvVar(EnvVars.UserContentPrefix); | ||||
| const allProviders = [dwengoApiLearningPathProvider, databaseLearningPathProvider]; | ||||
|  |  | |||
|  | @ -1,12 +1,12 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { getAttachmentRepository, getLearningObjectRepository } from '../../../src/data/repositories'; | ||||
| import { AttachmentRepository } from '../../../src/data/content/attachment-repository'; | ||||
| import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository'; | ||||
| import example from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example'; | ||||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity'; | ||||
| import { Attachment } from '../../../src/entities/content/attachment.entity'; | ||||
| import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||
| import { setupTestApp } from '../../setup-tests.js'; | ||||
| import { getAttachmentRepository, getLearningObjectRepository } from '../../../src/data/repositories.js'; | ||||
| import { AttachmentRepository } from '../../../src/data/content/attachment-repository.js'; | ||||
| import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository.js'; | ||||
| import example from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example.js'; | ||||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity.js'; | ||||
| import { Attachment } from '../../../src/entities/content/attachment.entity.js'; | ||||
| import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier.js'; | ||||
| 
 | ||||
| const NEWER_TEST_SUFFIX = 'nEweR'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| import { beforeAll, describe, it, expect } from 'vitest'; | ||||
| import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { getLearningObjectRepository } from '../../../src/data/repositories'; | ||||
| import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository.js'; | ||||
| import { setupTestApp } from '../../setup-tests.js'; | ||||
| import { getLearningObjectRepository } from '../../../src/data/repositories.js'; | ||||
| import example from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example.js'; | ||||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity'; | ||||
| import { expectToBeCorrectEntity } from '../../test-utils/expectations'; | ||||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity.js'; | ||||
| import { expectToBeCorrectEntity } from '../../test-utils/expectations.js'; | ||||
| 
 | ||||
| describe('LearningObjectRepository', () => { | ||||
|     let learningObjectRepository: LearningObjectRepository; | ||||
|  |  | |||
|  | @ -1,11 +1,11 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { getLearningPathRepository } from '../../../src/data/repositories'; | ||||
| import { LearningPathRepository } from '../../../src/data/content/learning-path-repository'; | ||||
| import example from '../../test-assets/learning-paths/pn-werking-example'; | ||||
| import { LearningPath } from '../../../src/entities/content/learning-path.entity'; | ||||
| import { expectToBeCorrectEntity } from '../../test-utils/expectations'; | ||||
| import { Language } from '../../../src/entities/content/language'; | ||||
| import { setupTestApp } from '../../setup-tests.js'; | ||||
| import { getLearningPathRepository } from '../../../src/data/repositories.js'; | ||||
| import { LearningPathRepository } from '../../../src/data/content/learning-path-repository.js'; | ||||
| import example from '../../test-assets/learning-paths/pn-werking-example.js'; | ||||
| import { LearningPath } from '../../../src/entities/content/learning-path.entity.js'; | ||||
| import { expectToBeCorrectEntity } from '../../test-utils/expectations.js'; | ||||
| import { Language } from '../../../src/entities/content/language.js'; | ||||
| 
 | ||||
| function expectToHaveFoundPrecisely(expected: LearningPath, result: LearningPath[]): void { | ||||
|     expect(result).toHaveProperty('length'); | ||||
|  |  | |||
|  | @ -1,26 +1,26 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { LearningPath } from '../../../src/entities/content/learning-path.entity'; | ||||
| import {beforeAll, describe, expect, it} from 'vitest'; | ||||
| import {LearningObject} from '../../../src/entities/content/learning-object.entity.js'; | ||||
| import {setupTestApp} from '../../setup-tests.js'; | ||||
| import {LearningPath} from '../../../src/entities/content/learning-path.entity.js'; | ||||
| import { | ||||
|     getLearningObjectRepository, | ||||
|     getLearningPathRepository, | ||||
|     getStudentRepository, | ||||
|     getSubmissionRepository, | ||||
| } from '../../../src/data/repositories'; | ||||
| import learningObjectExample from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example'; | ||||
| import learningPathExample from '../../test-assets/learning-paths/pn-werking-example'; | ||||
| import databaseLearningPathProvider from '../../../src/services/learning-paths/database-learning-path-provider'; | ||||
| import { expectToBeCorrectLearningPath } from '../../test-utils/expectations'; | ||||
| import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository'; | ||||
| import learningObjectService from '../../../src/services/learning-objects/learning-object-service'; | ||||
| import { Language } from '../../../src/entities/content/language'; | ||||
| } from '../../../src/data/repositories.js'; | ||||
| import learningObjectExample from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example.js'; | ||||
| import learningPathExample from '../../test-assets/learning-paths/pn-werking-example.js'; | ||||
| import databaseLearningPathProvider from '../../../src/services/learning-paths/database-learning-path-provider.js'; | ||||
| import {expectToBeCorrectLearningPath} from '../../test-utils/expectations.js'; | ||||
| import {LearningObjectRepository} from '../../../src/data/content/learning-object-repository.js'; | ||||
| import learningObjectService from '../../../src/services/learning-objects/learning-object-service.js'; | ||||
| import {Language} from '../../../src/entities/content/language.js'; | ||||
| import { | ||||
|     ConditionTestLearningPathAndLearningObjects, | ||||
|     createConditionTestLearningPathAndLearningObjects, | ||||
| } from '../../test-assets/learning-paths/test-conditions-example'; | ||||
| import { Student } from '../../../src/entities/users/student.entity'; | ||||
| import { LearningObjectNode, LearningPathResponse } from '../../../src/interfaces/learning-content'; | ||||
| } from '../../test-assets/learning-paths/test-conditions-example.js'; | ||||
| import {Student} from '../../../src/entities/users/student.entity.js'; | ||||
| import {LearningObjectNode, LearningPathResponse} from '../../../src/interfaces/learning-content.js'; | ||||
| 
 | ||||
| async function initExampleData(): Promise<{ learningObject: LearningObject; learningPath: LearningPath }> { | ||||
|     const learningObjectRepo = getLearningObjectRepository(); | ||||
|  |  | |||
		Reference in a new issue