course-format-ts 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/edu-format-ts.iml +10 -0
- package/.idea/inspectionProfiles/Project_Default.xml +28 -0
- package/.idea/misc.xml +4 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/AGENTS.md +1 -0
- package/dist/courseFormat/AnswerPlaceholder.d.ts +37 -0
- package/dist/courseFormat/AnswerPlaceholder.js +101 -0
- package/dist/courseFormat/AnswerPlaceholderComparator.d.ts +4 -0
- package/dist/courseFormat/AnswerPlaceholderComparator.js +8 -0
- package/dist/courseFormat/AnswerPlaceholderDependency.d.ts +19 -0
- package/dist/courseFormat/AnswerPlaceholderDependency.js +91 -0
- package/dist/courseFormat/CheckFeedback.d.ts +20 -0
- package/dist/courseFormat/CheckFeedback.js +58 -0
- package/dist/courseFormat/CheckResult.d.ts +33 -0
- package/dist/courseFormat/CheckResult.js +58 -0
- package/dist/courseFormat/CheckResultSeverity.d.ts +7 -0
- package/dist/courseFormat/CheckResultSeverity.js +17 -0
- package/dist/courseFormat/CheckStatus.d.ts +5 -0
- package/dist/courseFormat/CheckStatus.js +9 -0
- package/dist/courseFormat/Course.d.ts +68 -0
- package/dist/courseFormat/Course.js +165 -0
- package/dist/courseFormat/CourseMode.d.ts +4 -0
- package/dist/courseFormat/CourseMode.js +8 -0
- package/dist/courseFormat/CourseVisibility.d.ts +4 -0
- package/dist/courseFormat/CourseVisibility.js +8 -0
- package/dist/courseFormat/CourseraCourse.d.ts +5 -0
- package/dist/courseFormat/CourseraCourse.js +15 -0
- package/dist/courseFormat/DescriptionFormat.d.ts +5 -0
- package/dist/courseFormat/DescriptionFormat.js +9 -0
- package/dist/courseFormat/EduCourse.d.ts +17 -0
- package/dist/courseFormat/EduCourse.js +42 -0
- package/dist/courseFormat/EduFile.d.ts +22 -0
- package/dist/courseFormat/EduFile.js +110 -0
- package/dist/courseFormat/EduFileErrorHighlightLevel.d.ts +5 -0
- package/dist/courseFormat/EduFileErrorHighlightLevel.js +9 -0
- package/dist/courseFormat/EduFormatNames.d.ts +75 -0
- package/dist/courseFormat/EduFormatNames.js +80 -0
- package/dist/courseFormat/EduTestInfo.d.ts +28 -0
- package/dist/courseFormat/EduTestInfo.js +68 -0
- package/dist/courseFormat/EduVersions.d.ts +2 -0
- package/dist/courseFormat/EduVersions.js +5 -0
- package/dist/courseFormat/FileContents.d.ts +36 -0
- package/dist/courseFormat/FileContents.js +67 -0
- package/dist/courseFormat/FileContentsFactory.d.ts +17 -0
- package/dist/courseFormat/FileContentsFactory.js +2 -0
- package/dist/courseFormat/FrameworkLesson.d.ts +9 -0
- package/dist/courseFormat/FrameworkLesson.js +28 -0
- package/dist/courseFormat/ItemContainer.d.ts +13 -0
- package/dist/courseFormat/ItemContainer.js +45 -0
- package/dist/courseFormat/JBAccountUserInfo.d.ts +9 -0
- package/dist/courseFormat/JBAccountUserInfo.js +20 -0
- package/dist/courseFormat/Language.d.ts +4 -0
- package/dist/courseFormat/Language.js +33 -0
- package/dist/courseFormat/Lesson.d.ts +20 -0
- package/dist/courseFormat/Lesson.js +56 -0
- package/dist/courseFormat/LessonContainer.d.ts +16 -0
- package/dist/courseFormat/LessonContainer.js +54 -0
- package/dist/courseFormat/PluginInfo.d.ts +7 -0
- package/dist/courseFormat/PluginInfo.js +15 -0
- package/dist/courseFormat/Section.d.ts +8 -0
- package/dist/courseFormat/Section.js +27 -0
- package/dist/courseFormat/StudyItem.d.ts +20 -0
- package/dist/courseFormat/StudyItem.js +47 -0
- package/dist/courseFormat/Tags.d.ts +16 -0
- package/dist/courseFormat/Tags.js +42 -0
- package/dist/courseFormat/TaskFile.d.ts +26 -0
- package/dist/courseFormat/TaskFile.js +72 -0
- package/dist/courseFormat/UserInfo.d.ts +3 -0
- package/dist/courseFormat/UserInfo.js +2 -0
- package/dist/courseFormat/Vendor.d.ts +7 -0
- package/dist/courseFormat/Vendor.js +14 -0
- package/dist/courseFormat/attempts/Attempt.d.ts +12 -0
- package/dist/courseFormat/attempts/Attempt.js +25 -0
- package/dist/courseFormat/attempts/AttemptBase.d.ts +9 -0
- package/dist/courseFormat/attempts/AttemptBase.js +28 -0
- package/dist/courseFormat/attempts/DataTaskAttempt.d.ts +6 -0
- package/dist/courseFormat/attempts/DataTaskAttempt.js +24 -0
- package/dist/courseFormat/attempts/Dataset.d.ts +12 -0
- package/dist/courseFormat/attempts/Dataset.js +21 -0
- package/dist/courseFormat/fileUtils.d.ts +5 -0
- package/dist/courseFormat/fileUtils.js +32 -0
- package/dist/courseFormat/hyperskill/HyperskillCourse.d.ts +13 -0
- package/dist/courseFormat/hyperskill/HyperskillCourse.js +25 -0
- package/dist/courseFormat/hyperskill/HyperskillProject.d.ts +10 -0
- package/dist/courseFormat/hyperskill/HyperskillProject.js +16 -0
- package/dist/courseFormat/hyperskill/HyperskillStage.d.ts +8 -0
- package/dist/courseFormat/hyperskill/HyperskillStage.js +20 -0
- package/dist/courseFormat/hyperskill/HyperskillTaskType.d.ts +4 -0
- package/dist/courseFormat/hyperskill/HyperskillTaskType.js +26 -0
- package/dist/courseFormat/hyperskill/HyperskillTopic.d.ts +5 -0
- package/dist/courseFormat/hyperskill/HyperskillTopic.js +11 -0
- package/dist/courseFormat/loggerUtils.d.ts +1 -0
- package/dist/courseFormat/loggerUtils.js +6 -0
- package/dist/courseFormat/stepik/StepikCourse.d.ts +5 -0
- package/dist/courseFormat/stepik/StepikCourse.js +15 -0
- package/dist/courseFormat/stepik/StepikLesson.d.ts +6 -0
- package/dist/courseFormat/stepik/StepikLesson.js +16 -0
- package/dist/courseFormat/tasks/AnswerTask.d.ts +8 -0
- package/dist/courseFormat/tasks/AnswerTask.js +11 -0
- package/dist/courseFormat/tasks/CodeTask.d.ts +12 -0
- package/dist/courseFormat/tasks/CodeTask.js +21 -0
- package/dist/courseFormat/tasks/DataTask.d.ts +18 -0
- package/dist/courseFormat/tasks/DataTask.js +32 -0
- package/dist/courseFormat/tasks/EduTask.d.ts +12 -0
- package/dist/courseFormat/tasks/EduTask.js +22 -0
- package/dist/courseFormat/tasks/IdeTask.d.ts +9 -0
- package/dist/courseFormat/tasks/IdeTask.js +14 -0
- package/dist/courseFormat/tasks/NumberTask.d.ts +9 -0
- package/dist/courseFormat/tasks/NumberTask.js +14 -0
- package/dist/courseFormat/tasks/OutputTask.d.ts +10 -0
- package/dist/courseFormat/tasks/OutputTask.js +18 -0
- package/dist/courseFormat/tasks/OutputTaskBase.d.ts +14 -0
- package/dist/courseFormat/tasks/OutputTaskBase.js +19 -0
- package/dist/courseFormat/tasks/RemoteEduTask.d.ts +9 -0
- package/dist/courseFormat/tasks/RemoteEduTask.js +15 -0
- package/dist/courseFormat/tasks/StringTask.d.ts +9 -0
- package/dist/courseFormat/tasks/StringTask.js +14 -0
- package/dist/courseFormat/tasks/TableTask.d.ts +17 -0
- package/dist/courseFormat/tasks/TableTask.js +43 -0
- package/dist/courseFormat/tasks/Task.d.ts +45 -0
- package/dist/courseFormat/tasks/Task.js +155 -0
- package/dist/courseFormat/tasks/TheoryTask.d.ts +10 -0
- package/dist/courseFormat/tasks/TheoryTask.js +15 -0
- package/dist/courseFormat/tasks/UnsupportedTask.d.ts +9 -0
- package/dist/courseFormat/tasks/UnsupportedTask.js +14 -0
- package/dist/courseFormat/tasks/choice/ChoiceOption.d.ts +10 -0
- package/dist/courseFormat/tasks/choice/ChoiceOption.js +33 -0
- package/dist/courseFormat/tasks/choice/ChoiceOptionStatus.d.ts +5 -0
- package/dist/courseFormat/tasks/choice/ChoiceOptionStatus.js +9 -0
- package/dist/courseFormat/tasks/choice/ChoiceTask.d.ts +23 -0
- package/dist/courseFormat/tasks/choice/ChoiceTask.js +47 -0
- package/dist/courseFormat/tasks/matching/MatchingTask.d.ts +10 -0
- package/dist/courseFormat/tasks/matching/MatchingTask.js +15 -0
- package/dist/courseFormat/tasks/matching/SortingBasedTask.d.ts +16 -0
- package/dist/courseFormat/tasks/matching/SortingBasedTask.js +50 -0
- package/dist/courseFormat/tasks/matching/SortingTask.d.ts +9 -0
- package/dist/courseFormat/tasks/matching/SortingTask.js +14 -0
- package/dist/courseFormat/uiMessages.d.ts +3 -0
- package/dist/courseFormat/uiMessages.js +14 -0
- package/dist/disk-loader.d.ts +4 -0
- package/dist/disk-loader.js +389 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +64 -0
- package/dist/loader.d.ts +7 -0
- package/dist/loader.js +435 -0
- package/dist/models.d.ts +49 -0
- package/dist/models.js +2 -0
- package/dist/zip-loader.d.ts +4 -0
- package/dist/zip-loader.js +431 -0
- package/example-course-project/course-info.yaml +15 -0
- package/example-course-project/lesson1/lesson-info.yaml +3 -0
- package/example-course-project/lesson1/lesson-remote-info.yaml +1 -0
- package/example-course-project/lesson1/task1/Task.txt +1 -0
- package/example-course-project/lesson1/task1/task-info.yaml +12 -0
- package/example-course-project/lesson1/task1/task-remote-info.yaml +1 -0
- package/example-course-project/lesson1/task1/task.md +47 -0
- package/example-course-project/lesson1/task1/tests/Tests.txt +0 -0
- package/example-course-project/lesson1/task2/Task.txt +1 -0
- package/example-course-project/lesson1/task2/task-info.yaml +12 -0
- package/example-course-project/lesson1/task2/task-remote-info.yaml +1 -0
- package/example-course-project/lesson1/task2/task.md +47 -0
- package/example-course-project/lesson1/task2/tests/Tests.txt +0 -0
- package/package.json +19 -0
- package/src/@types/mime-types.d.ts +3 -0
- package/src/courseFormat/AnswerPlaceholder.ts +121 -0
- package/src/courseFormat/AnswerPlaceholderComparator.ts +7 -0
- package/src/courseFormat/AnswerPlaceholderDependency.ts +122 -0
- package/src/courseFormat/CheckFeedback.ts +71 -0
- package/src/courseFormat/CheckResult.ts +92 -0
- package/src/courseFormat/CheckResultSeverity.ts +13 -0
- package/src/courseFormat/CheckStatus.ts +5 -0
- package/src/courseFormat/Course.ts +201 -0
- package/src/courseFormat/CourseMode.ts +4 -0
- package/src/courseFormat/CourseVisibility.ts +4 -0
- package/src/courseFormat/CourseraCourse.ts +10 -0
- package/src/courseFormat/DescriptionFormat.ts +5 -0
- package/src/courseFormat/EduCourse.ts +41 -0
- package/src/courseFormat/EduFile.ts +133 -0
- package/src/courseFormat/EduFileErrorHighlightLevel.ts +5 -0
- package/src/courseFormat/EduFormatNames.ts +95 -0
- package/src/courseFormat/EduTestInfo.ts +87 -0
- package/src/courseFormat/EduVersions.ts +2 -0
- package/src/courseFormat/FileContents.ts +97 -0
- package/src/courseFormat/FileContentsFactory.ts +19 -0
- package/src/courseFormat/FrameworkLesson.ts +29 -0
- package/src/courseFormat/ItemContainer.ts +47 -0
- package/src/courseFormat/JBAccountUserInfo.ts +21 -0
- package/src/courseFormat/Language.ts +31 -0
- package/src/courseFormat/Lesson.ts +69 -0
- package/src/courseFormat/LessonContainer.ts +65 -0
- package/src/courseFormat/PluginInfo.ts +15 -0
- package/src/courseFormat/Section.ts +29 -0
- package/src/courseFormat/StudyItem.ts +55 -0
- package/src/courseFormat/Tags.ts +45 -0
- package/src/courseFormat/TaskFile.ts +88 -0
- package/src/courseFormat/UserInfo.ts +3 -0
- package/src/courseFormat/Vendor.ts +15 -0
- package/src/courseFormat/attempts/Attempt.ts +28 -0
- package/src/courseFormat/attempts/AttemptBase.ts +24 -0
- package/src/courseFormat/attempts/DataTaskAttempt.ts +19 -0
- package/src/courseFormat/attempts/Dataset.ts +13 -0
- package/src/courseFormat/fileUtils.ts +31 -0
- package/src/courseFormat/hyperskill/HyperskillCourse.ts +24 -0
- package/src/courseFormat/hyperskill/HyperskillProject.ts +10 -0
- package/src/courseFormat/hyperskill/HyperskillStage.ts +15 -0
- package/src/courseFormat/hyperskill/HyperskillTaskType.ts +23 -0
- package/src/courseFormat/hyperskill/HyperskillTopic.ts +5 -0
- package/src/courseFormat/loggerUtils.ts +3 -0
- package/src/courseFormat/stepik/StepikCourse.ts +10 -0
- package/src/courseFormat/stepik/StepikLesson.ts +11 -0
- package/src/courseFormat/tasks/AnswerTask.ts +13 -0
- package/src/courseFormat/tasks/CodeTask.ts +42 -0
- package/src/courseFormat/tasks/DataTask.ts +37 -0
- package/src/courseFormat/tasks/EduTask.ts +26 -0
- package/src/courseFormat/tasks/IdeTask.ts +17 -0
- package/src/courseFormat/tasks/NumberTask.ts +17 -0
- package/src/courseFormat/tasks/OutputTask.ts +21 -0
- package/src/courseFormat/tasks/OutputTaskBase.ts +23 -0
- package/src/courseFormat/tasks/RemoteEduTask.ts +18 -0
- package/src/courseFormat/tasks/StringTask.ts +17 -0
- package/src/courseFormat/tasks/TableTask.ts +51 -0
- package/src/courseFormat/tasks/Task.ts +181 -0
- package/src/courseFormat/tasks/TheoryTask.ts +19 -0
- package/src/courseFormat/tasks/UnsupportedTask.ts +17 -0
- package/src/courseFormat/tasks/choice/ChoiceOption.ts +37 -0
- package/src/courseFormat/tasks/choice/ChoiceOptionStatus.ts +5 -0
- package/src/courseFormat/tasks/choice/ChoiceTask.ts +57 -0
- package/src/courseFormat/tasks/matching/MatchingTask.ts +19 -0
- package/src/courseFormat/tasks/matching/SortingBasedTask.ts +59 -0
- package/src/courseFormat/tasks/matching/SortingTask.ts +17 -0
- package/src/courseFormat/uiMessages.ts +12 -0
- package/src/disk-loader.ts +463 -0
- package/src/index.ts +33 -0
- package/src/models.ts +54 -0
- package/src/zip-loader.ts +583 -0
- package/test/load-course.test.js +279 -0
- package/test/load-zip-course.test.js +73 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class Tag {
|
|
2
|
+
readonly text: string;
|
|
3
|
+
private readonly searchOption;
|
|
4
|
+
constructor(text: string, searchOption?: string);
|
|
5
|
+
getSearchText(): string;
|
|
6
|
+
accept(filter: string): boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class ProgrammingLanguageTag extends Tag {
|
|
9
|
+
constructor(language: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class HumanLanguageTag extends Tag {
|
|
12
|
+
constructor(languageName: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class FeaturedTag extends Tag {
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FeaturedTag = exports.HumanLanguageTag = exports.ProgrammingLanguageTag = exports.Tag = void 0;
|
|
4
|
+
const uiMessages_1 = require("./uiMessages");
|
|
5
|
+
const PROGRAMMING_LANGUAGE_TAG_SEARCH_OPTION = "programming_language";
|
|
6
|
+
const LANGUAGE_TAG_SEARCH_OPTION = "language";
|
|
7
|
+
class Tag {
|
|
8
|
+
constructor(text, searchOption = "tag") {
|
|
9
|
+
this.text = text;
|
|
10
|
+
this.searchOption = searchOption;
|
|
11
|
+
}
|
|
12
|
+
getSearchText() {
|
|
13
|
+
return `${this.searchOption}:${this.text}`.toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
accept(filter) {
|
|
16
|
+
const textInLowerCase = this.text.toLowerCase();
|
|
17
|
+
if (textInLowerCase.includes(filter)) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
const searchPrefix = `${this.searchOption}:`;
|
|
21
|
+
return filter.startsWith(searchPrefix) && textInLowerCase.includes(filter.substring(searchPrefix.length));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Tag = Tag;
|
|
25
|
+
class ProgrammingLanguageTag extends Tag {
|
|
26
|
+
constructor(language) {
|
|
27
|
+
super(language, PROGRAMMING_LANGUAGE_TAG_SEARCH_OPTION);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ProgrammingLanguageTag = ProgrammingLanguageTag;
|
|
31
|
+
class HumanLanguageTag extends Tag {
|
|
32
|
+
constructor(languageName) {
|
|
33
|
+
super(languageName, LANGUAGE_TAG_SEARCH_OPTION);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.HumanLanguageTag = HumanLanguageTag;
|
|
37
|
+
class FeaturedTag extends Tag {
|
|
38
|
+
constructor() {
|
|
39
|
+
super((0, uiMessages_1.message)("course.dialog.tags.featured"));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.FeaturedTag = FeaturedTag;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EduFile } from "./EduFile";
|
|
2
|
+
import { AnswerPlaceholder } from "./AnswerPlaceholder";
|
|
3
|
+
import type { Task } from "./tasks/Task";
|
|
4
|
+
import { FileContents } from "./FileContents";
|
|
5
|
+
export declare class TaskFile extends EduFile {
|
|
6
|
+
private _answerPlaceholders;
|
|
7
|
+
private _task?;
|
|
8
|
+
isVisible: boolean;
|
|
9
|
+
constructor();
|
|
10
|
+
constructor(name: string, text: string);
|
|
11
|
+
constructor(name: string, contents: FileContents);
|
|
12
|
+
constructor(name: string, text: string, isVisible: boolean);
|
|
13
|
+
constructor(name: string, text: string, isVisible: boolean, isLearnerCreated: boolean);
|
|
14
|
+
get answerPlaceholders(): AnswerPlaceholder[];
|
|
15
|
+
set answerPlaceholders(value: AnswerPlaceholder[]);
|
|
16
|
+
get task(): Task;
|
|
17
|
+
set task(value: Task);
|
|
18
|
+
initTaskFile(task: Task, isRestarted: boolean): void;
|
|
19
|
+
addAnswerPlaceholder(answerPlaceholder: AnswerPlaceholder): void;
|
|
20
|
+
removeAnswerPlaceholder(answerPlaceholder: AnswerPlaceholder): void;
|
|
21
|
+
getAnswerPlaceholder(offset: number): AnswerPlaceholder | undefined;
|
|
22
|
+
removeAllPlaceholders(): void;
|
|
23
|
+
sortAnswerPlaceholders(): void;
|
|
24
|
+
hasFailedPlaceholders(): boolean;
|
|
25
|
+
isValid(text: string): boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaskFile = void 0;
|
|
4
|
+
const EduFile_1 = require("./EduFile");
|
|
5
|
+
const AnswerPlaceholderComparator_1 = require("./AnswerPlaceholderComparator");
|
|
6
|
+
const CheckStatus_1 = require("./CheckStatus");
|
|
7
|
+
class TaskFile extends EduFile_1.EduFile {
|
|
8
|
+
constructor(name, textOrContents, isVisible, isLearnerCreated) {
|
|
9
|
+
super();
|
|
10
|
+
this._answerPlaceholders = [];
|
|
11
|
+
this.isVisible = true;
|
|
12
|
+
if (name !== undefined)
|
|
13
|
+
this.name = name;
|
|
14
|
+
if (typeof textOrContents === "string") {
|
|
15
|
+
this.text = textOrContents;
|
|
16
|
+
}
|
|
17
|
+
else if (textOrContents) {
|
|
18
|
+
this.contents = textOrContents;
|
|
19
|
+
}
|
|
20
|
+
if (isVisible !== undefined)
|
|
21
|
+
this.isVisible = isVisible;
|
|
22
|
+
if (isLearnerCreated !== undefined)
|
|
23
|
+
this.isLearnerCreated = isLearnerCreated;
|
|
24
|
+
}
|
|
25
|
+
get answerPlaceholders() {
|
|
26
|
+
return this._answerPlaceholders;
|
|
27
|
+
}
|
|
28
|
+
set answerPlaceholders(value) {
|
|
29
|
+
this._answerPlaceholders = [...value];
|
|
30
|
+
}
|
|
31
|
+
get task() {
|
|
32
|
+
if (!this._task) {
|
|
33
|
+
throw new Error(`Task is null for TaskFile ${this.name}`);
|
|
34
|
+
}
|
|
35
|
+
return this._task;
|
|
36
|
+
}
|
|
37
|
+
set task(value) {
|
|
38
|
+
this._task = value;
|
|
39
|
+
}
|
|
40
|
+
initTaskFile(task, isRestarted) {
|
|
41
|
+
this.task = task;
|
|
42
|
+
for (const answerPlaceholder of this._answerPlaceholders) {
|
|
43
|
+
answerPlaceholder.init(this, isRestarted);
|
|
44
|
+
}
|
|
45
|
+
this.sortAnswerPlaceholders();
|
|
46
|
+
}
|
|
47
|
+
addAnswerPlaceholder(answerPlaceholder) {
|
|
48
|
+
this._answerPlaceholders.push(answerPlaceholder);
|
|
49
|
+
}
|
|
50
|
+
removeAnswerPlaceholder(answerPlaceholder) {
|
|
51
|
+
this._answerPlaceholders = this._answerPlaceholders.filter((item) => item !== answerPlaceholder);
|
|
52
|
+
}
|
|
53
|
+
getAnswerPlaceholder(offset) {
|
|
54
|
+
return this._answerPlaceholders.find((placeholder) => offset >= placeholder.offset && offset <= placeholder.endOffset);
|
|
55
|
+
}
|
|
56
|
+
removeAllPlaceholders() {
|
|
57
|
+
this._answerPlaceholders = [];
|
|
58
|
+
}
|
|
59
|
+
sortAnswerPlaceholders() {
|
|
60
|
+
this._answerPlaceholders.sort(AnswerPlaceholderComparator_1.AnswerPlaceholderComparator.compare);
|
|
61
|
+
this._answerPlaceholders.forEach((placeholder, index) => {
|
|
62
|
+
placeholder.index = index;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
hasFailedPlaceholders() {
|
|
66
|
+
return this._answerPlaceholders.some((placeholder) => placeholder.status === CheckStatus_1.CheckStatus.Failed);
|
|
67
|
+
}
|
|
68
|
+
isValid(text) {
|
|
69
|
+
return this._answerPlaceholders.every((placeholder) => placeholder.isValid(text.length));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.TaskFile = TaskFile;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Vendor = void 0;
|
|
4
|
+
class Vendor {
|
|
5
|
+
constructor(name = "", email, url) {
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.email = email !== null && email !== void 0 ? email : undefined;
|
|
8
|
+
this.url = url !== null && url !== void 0 ? url : undefined;
|
|
9
|
+
}
|
|
10
|
+
toString() {
|
|
11
|
+
return this.name;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.Vendor = Vendor;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AttemptBase } from "./AttemptBase";
|
|
2
|
+
import { Dataset } from "./Dataset";
|
|
3
|
+
export declare class Attempt extends AttemptBase {
|
|
4
|
+
step: number;
|
|
5
|
+
dataset: Dataset | null;
|
|
6
|
+
status: string | null;
|
|
7
|
+
user: string | null;
|
|
8
|
+
get isActive(): boolean;
|
|
9
|
+
constructor();
|
|
10
|
+
constructor(step: number);
|
|
11
|
+
constructor(id: number, time: Date, timeLeft: number);
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Attempt = void 0;
|
|
4
|
+
const AttemptBase_1 = require("./AttemptBase");
|
|
5
|
+
class Attempt extends AttemptBase_1.AttemptBase {
|
|
6
|
+
get isActive() {
|
|
7
|
+
return this.status === "active";
|
|
8
|
+
}
|
|
9
|
+
constructor(stepOrId, time, timeLeft) {
|
|
10
|
+
super();
|
|
11
|
+
this.step = 0;
|
|
12
|
+
this.dataset = null;
|
|
13
|
+
this.status = null;
|
|
14
|
+
this.user = null;
|
|
15
|
+
if (stepOrId !== undefined && time === undefined) {
|
|
16
|
+
this.step = stepOrId;
|
|
17
|
+
}
|
|
18
|
+
else if (stepOrId !== undefined && time !== undefined) {
|
|
19
|
+
this.id = stepOrId;
|
|
20
|
+
this.time = time;
|
|
21
|
+
this.timeLeft = timeLeft !== null && timeLeft !== void 0 ? timeLeft : null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.Attempt = Attempt;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AttemptBase = void 0;
|
|
4
|
+
class AttemptBase {
|
|
5
|
+
get isRunning() {
|
|
6
|
+
const endDateTime = this.calculateEndDateTime();
|
|
7
|
+
if (endDateTime === null)
|
|
8
|
+
return true;
|
|
9
|
+
return new Date() < endDateTime;
|
|
10
|
+
}
|
|
11
|
+
calculateEndDateTime() {
|
|
12
|
+
if (this.timeLeft === null)
|
|
13
|
+
return null;
|
|
14
|
+
return new Date(this.time.getTime() + this.timeLeft * 1000);
|
|
15
|
+
}
|
|
16
|
+
constructor(id, time, timeLeft) {
|
|
17
|
+
this.id = 0;
|
|
18
|
+
this.time = new Date();
|
|
19
|
+
this.timeLeft = null;
|
|
20
|
+
if (id !== undefined)
|
|
21
|
+
this.id = id;
|
|
22
|
+
if (time !== undefined)
|
|
23
|
+
this.time = time;
|
|
24
|
+
if (timeLeft !== undefined)
|
|
25
|
+
this.timeLeft = timeLeft;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.AttemptBase = AttemptBase;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataTaskAttempt = void 0;
|
|
4
|
+
const AttemptBase_1 = require("./AttemptBase");
|
|
5
|
+
class DataTaskAttempt extends AttemptBase_1.AttemptBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.endDateTime = null;
|
|
9
|
+
}
|
|
10
|
+
get isRunning() {
|
|
11
|
+
if (this.endDateTime === null)
|
|
12
|
+
return true;
|
|
13
|
+
return new Date() < this.endDateTime;
|
|
14
|
+
}
|
|
15
|
+
static fromAttempt(attempt) {
|
|
16
|
+
const result = new DataTaskAttempt();
|
|
17
|
+
result.id = attempt.id;
|
|
18
|
+
result.time = attempt.time;
|
|
19
|
+
result.timeLeft = attempt.timeLeft;
|
|
20
|
+
result.endDateTime = result.calculateEndDateTime();
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.DataTaskAttempt = DataTaskAttempt;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class Dataset {
|
|
2
|
+
isMultipleChoice: boolean;
|
|
3
|
+
options: string[] | null;
|
|
4
|
+
pairs: Pair[] | null;
|
|
5
|
+
rows: string[] | null;
|
|
6
|
+
columns: string[] | null;
|
|
7
|
+
isCheckbox: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class Pair {
|
|
10
|
+
first: string;
|
|
11
|
+
second: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Pair = exports.Dataset = void 0;
|
|
4
|
+
class Dataset {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.isMultipleChoice = false;
|
|
7
|
+
this.options = null;
|
|
8
|
+
this.pairs = null;
|
|
9
|
+
this.rows = null;
|
|
10
|
+
this.columns = null;
|
|
11
|
+
this.isCheckbox = false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.Dataset = Dataset;
|
|
15
|
+
class Pair {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.first = "";
|
|
18
|
+
this.second = "";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.Pair = Pair;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function isBinary(contentType: string): boolean;
|
|
2
|
+
export declare function mimeFileType(path: string): string | false | undefined;
|
|
3
|
+
export declare function exceedsBase64ContentLimit(base64text: string): boolean;
|
|
4
|
+
export declare function getBinaryFileLimit(): number;
|
|
5
|
+
export declare function getExtension(fileName: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isBinary = isBinary;
|
|
4
|
+
exports.mimeFileType = mimeFileType;
|
|
5
|
+
exports.exceedsBase64ContentLimit = exceedsBase64ContentLimit;
|
|
6
|
+
exports.getBinaryFileLimit = getBinaryFileLimit;
|
|
7
|
+
exports.getExtension = getExtension;
|
|
8
|
+
const mime_types_1 = require("mime-types");
|
|
9
|
+
const loggerUtils_1 = require("./loggerUtils");
|
|
10
|
+
const mimeBinaryTypes = ["image", "audio", "video", "application", "font"].map((type) => `${type}/`);
|
|
11
|
+
function isBinary(contentType) {
|
|
12
|
+
return mimeBinaryTypes.some((prefix) => contentType.startsWith(prefix));
|
|
13
|
+
}
|
|
14
|
+
function mimeFileType(path) {
|
|
15
|
+
try {
|
|
16
|
+
return (0, mime_types_1.lookup)(path);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
(0, loggerUtils_1.logger)("fileUtils").error("Failed to determine file mimetype", error);
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function exceedsBase64ContentLimit(base64text) {
|
|
24
|
+
return Buffer.from(base64text, "utf16le").byteLength > getBinaryFileLimit();
|
|
25
|
+
}
|
|
26
|
+
function getBinaryFileLimit() {
|
|
27
|
+
return 1024 * 1024;
|
|
28
|
+
}
|
|
29
|
+
function getExtension(fileName) {
|
|
30
|
+
const index = fileName.lastIndexOf(".");
|
|
31
|
+
return index < 0 ? "" : fileName.substring(index + 1);
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Course } from "../Course";
|
|
2
|
+
import { HyperskillProject } from "./HyperskillProject";
|
|
3
|
+
import { HyperskillStage } from "./HyperskillStage";
|
|
4
|
+
import { HyperskillTopic } from "./HyperskillTopic";
|
|
5
|
+
export declare class HyperskillCourse extends Course {
|
|
6
|
+
taskToTopics: Map<number, HyperskillTopic[]>;
|
|
7
|
+
stages: HyperskillStage[];
|
|
8
|
+
hyperskillProject: HyperskillProject | null;
|
|
9
|
+
selectedStage: number | null;
|
|
10
|
+
selectedProblem: number | null;
|
|
11
|
+
get itemType(): string;
|
|
12
|
+
get isTemplateBased(): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HyperskillCourse = void 0;
|
|
4
|
+
const Course_1 = require("../Course");
|
|
5
|
+
const EduFormatNames_1 = require("../EduFormatNames");
|
|
6
|
+
class HyperskillCourse extends Course_1.Course {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.taskToTopics = new Map();
|
|
10
|
+
this.stages = [];
|
|
11
|
+
this.hyperskillProject = null;
|
|
12
|
+
this.selectedStage = null;
|
|
13
|
+
this.selectedProblem = null;
|
|
14
|
+
}
|
|
15
|
+
get itemType() {
|
|
16
|
+
return EduFormatNames_1.HYPERSKILL;
|
|
17
|
+
}
|
|
18
|
+
get isTemplateBased() {
|
|
19
|
+
if (!this.hyperskillProject) {
|
|
20
|
+
throw new Error("Disconnected Hyperskill project");
|
|
21
|
+
}
|
|
22
|
+
return this.hyperskillProject.isTemplateBased;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.HyperskillCourse = HyperskillCourse;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HyperskillProject = void 0;
|
|
4
|
+
class HyperskillProject {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.id = -1;
|
|
7
|
+
this.title = "";
|
|
8
|
+
this.description = "";
|
|
9
|
+
this.ideFiles = "";
|
|
10
|
+
this.useIde = true;
|
|
11
|
+
this.language = "";
|
|
12
|
+
this.environment = null;
|
|
13
|
+
this.isTemplateBased = false;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.HyperskillProject = HyperskillProject;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HyperskillStage = void 0;
|
|
4
|
+
class HyperskillStage {
|
|
5
|
+
constructor(stageId, stageTitle, stageStepId, isStageCompleted) {
|
|
6
|
+
this.id = -1;
|
|
7
|
+
this.title = "";
|
|
8
|
+
this.stepId = -1;
|
|
9
|
+
this.isCompleted = false;
|
|
10
|
+
if (stageId !== undefined)
|
|
11
|
+
this.id = stageId;
|
|
12
|
+
if (stageTitle !== undefined)
|
|
13
|
+
this.title = stageTitle;
|
|
14
|
+
if (stageStepId !== undefined)
|
|
15
|
+
this.stepId = stageStepId;
|
|
16
|
+
if (isStageCompleted !== undefined)
|
|
17
|
+
this.isCompleted = isStageCompleted;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.HyperskillStage = HyperskillStage;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HYPERSKILL_TASK_TYPE_LABELS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Maps Hyperskill task type IDs to their human-readable labels.
|
|
6
|
+
*/
|
|
7
|
+
exports.HYPERSKILL_TASK_TYPE_LABELS = {
|
|
8
|
+
admin: "Linux",
|
|
9
|
+
choice: "Quiz",
|
|
10
|
+
code: "Programming",
|
|
11
|
+
dataset: "Data",
|
|
12
|
+
"fill-blanks": "Fill Blanks",
|
|
13
|
+
"free-answer": "Free Response",
|
|
14
|
+
"manual-score": "Manual Score",
|
|
15
|
+
matching: "Matching",
|
|
16
|
+
math: "Math",
|
|
17
|
+
number: "Number",
|
|
18
|
+
parsons: "Parsons",
|
|
19
|
+
pycharm: "Programming",
|
|
20
|
+
remote_edu: "Programming",
|
|
21
|
+
sorting: "Sorting",
|
|
22
|
+
string: "Text",
|
|
23
|
+
table: "Table",
|
|
24
|
+
text: "Theory",
|
|
25
|
+
video: "Video",
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HyperskillTopic = void 0;
|
|
4
|
+
class HyperskillTopic {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.id = -1;
|
|
7
|
+
this.title = "";
|
|
8
|
+
this.theoryId = null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.HyperskillTopic = HyperskillTopic;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function logger(name: string): Console;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StepikCourse = void 0;
|
|
4
|
+
const EduCourse_1 = require("../EduCourse");
|
|
5
|
+
const EduFormatNames_1 = require("../EduFormatNames");
|
|
6
|
+
class StepikCourse extends EduCourse_1.EduCourse {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.isAdaptive = false;
|
|
10
|
+
}
|
|
11
|
+
get itemType() {
|
|
12
|
+
return EduFormatNames_1.STEPIK;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.StepikCourse = StepikCourse;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StepikLesson = void 0;
|
|
4
|
+
const Lesson_1 = require("../Lesson");
|
|
5
|
+
const EduFormatNames_1 = require("../EduFormatNames");
|
|
6
|
+
class StepikLesson extends Lesson_1.Lesson {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.stepIds = [];
|
|
10
|
+
this.unitId = 0;
|
|
11
|
+
}
|
|
12
|
+
get itemType() {
|
|
13
|
+
return EduFormatNames_1.STEPIK;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.StepikLesson = StepikLesson;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CheckStatus } from "../CheckStatus";
|
|
2
|
+
import { Task } from "./Task";
|
|
3
|
+
export declare abstract class AnswerTask extends Task {
|
|
4
|
+
static ANSWER_FILE_NAME: string;
|
|
5
|
+
constructor();
|
|
6
|
+
constructor(name: string);
|
|
7
|
+
constructor(name: string, id: number, position: number, updateDate: Date, status: CheckStatus);
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AnswerTask = void 0;
|
|
4
|
+
const Task_1 = require("./Task");
|
|
5
|
+
class AnswerTask extends Task_1.Task {
|
|
6
|
+
constructor(name, id, position, updateDate, status) {
|
|
7
|
+
super(name, id, position, updateDate, status);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.AnswerTask = AnswerTask;
|
|
11
|
+
AnswerTask.ANSWER_FILE_NAME = "answer.txt";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CheckStatus } from "../CheckStatus";
|
|
2
|
+
import { Task } from "./Task";
|
|
3
|
+
export declare class CodeTask extends Task {
|
|
4
|
+
submissionLanguage?: string;
|
|
5
|
+
constructor();
|
|
6
|
+
constructor(name: string);
|
|
7
|
+
constructor(name: string, id: number, position: number, updateDate: Date, status: CheckStatus, submissionLanguage?: string | null);
|
|
8
|
+
get itemType(): string;
|
|
9
|
+
get supportSubmissions(): boolean;
|
|
10
|
+
get isPluginTaskType(): boolean;
|
|
11
|
+
static CODE_TASK_TYPE: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeTask = void 0;
|
|
4
|
+
const Task_1 = require("./Task");
|
|
5
|
+
class CodeTask extends Task_1.Task {
|
|
6
|
+
constructor(name, id, position, updateDate, status, submissionLanguage) {
|
|
7
|
+
super(name, id, position, updateDate, status);
|
|
8
|
+
this.submissionLanguage = submissionLanguage !== null && submissionLanguage !== void 0 ? submissionLanguage : undefined;
|
|
9
|
+
}
|
|
10
|
+
get itemType() {
|
|
11
|
+
return CodeTask.CODE_TASK_TYPE;
|
|
12
|
+
}
|
|
13
|
+
get supportSubmissions() {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
get isPluginTaskType() {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.CodeTask = CodeTask;
|
|
21
|
+
CodeTask.CODE_TASK_TYPE = "code";
|