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,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EduTestInfo = void 0;
|
|
4
|
+
class EduTestInfo {
|
|
5
|
+
constructor(name = "", status = -1, message = "", details, isFinishedSuccessfully, checkResultDiff) {
|
|
6
|
+
this.name = name;
|
|
7
|
+
this.status = status;
|
|
8
|
+
this.message = message;
|
|
9
|
+
this.details = details !== null && details !== void 0 ? details : undefined;
|
|
10
|
+
this.checkResultDiff = checkResultDiff !== null && checkResultDiff !== void 0 ? checkResultDiff : undefined;
|
|
11
|
+
this.isSuccessInternal =
|
|
12
|
+
isFinishedSuccessfully === true ||
|
|
13
|
+
(EduTestInfo.get(status) !== undefined && EduTestInfo.isSuccess(EduTestInfo.get(status)));
|
|
14
|
+
}
|
|
15
|
+
get isSuccess() {
|
|
16
|
+
return this.isSuccessInternal;
|
|
17
|
+
}
|
|
18
|
+
toString() {
|
|
19
|
+
return `[${EduTestInfo.getPresentableStatus(this.status)}] ${this.name}`;
|
|
20
|
+
}
|
|
21
|
+
static firstFailed(tests) {
|
|
22
|
+
return tests.find((test) => !test.isSuccess);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.EduTestInfo = EduTestInfo;
|
|
26
|
+
(function (EduTestInfo) {
|
|
27
|
+
let PresentableStatus;
|
|
28
|
+
(function (PresentableStatus) {
|
|
29
|
+
PresentableStatus[PresentableStatus["SKIPPED"] = 0] = "SKIPPED";
|
|
30
|
+
PresentableStatus[PresentableStatus["COMPLETED"] = 1] = "COMPLETED";
|
|
31
|
+
PresentableStatus[PresentableStatus["NOT_RUN"] = 2] = "NOT_RUN";
|
|
32
|
+
PresentableStatus[PresentableStatus["RUNNING"] = 3] = "RUNNING";
|
|
33
|
+
PresentableStatus[PresentableStatus["TERMINATED"] = 4] = "TERMINATED";
|
|
34
|
+
PresentableStatus[PresentableStatus["IGNORED"] = 5] = "IGNORED";
|
|
35
|
+
PresentableStatus[PresentableStatus["FAILED"] = 6] = "FAILED";
|
|
36
|
+
PresentableStatus[PresentableStatus["ERROR"] = 8] = "ERROR";
|
|
37
|
+
})(PresentableStatus = EduTestInfo.PresentableStatus || (EduTestInfo.PresentableStatus = {}));
|
|
38
|
+
const STATUS_TITLES = {
|
|
39
|
+
[PresentableStatus.SKIPPED]: "Skipped",
|
|
40
|
+
[PresentableStatus.COMPLETED]: "Completed",
|
|
41
|
+
[PresentableStatus.NOT_RUN]: "Not run",
|
|
42
|
+
[PresentableStatus.RUNNING]: "Running",
|
|
43
|
+
[PresentableStatus.TERMINATED]: "Terminated",
|
|
44
|
+
[PresentableStatus.IGNORED]: "Ignored",
|
|
45
|
+
[PresentableStatus.FAILED]: "Failed",
|
|
46
|
+
[PresentableStatus.ERROR]: "Error",
|
|
47
|
+
};
|
|
48
|
+
function get(status) {
|
|
49
|
+
return Object.values(PresentableStatus)
|
|
50
|
+
.filter((value) => typeof value === "number")
|
|
51
|
+
.map((value) => value)
|
|
52
|
+
.includes(status)
|
|
53
|
+
? status
|
|
54
|
+
: undefined;
|
|
55
|
+
}
|
|
56
|
+
EduTestInfo.get = get;
|
|
57
|
+
function getPresentableStatus(status) {
|
|
58
|
+
const value = get(status);
|
|
59
|
+
return value === undefined ? "Unknown" : STATUS_TITLES[value];
|
|
60
|
+
}
|
|
61
|
+
EduTestInfo.getPresentableStatus = getPresentableStatus;
|
|
62
|
+
function isSuccess(status) {
|
|
63
|
+
return (status === PresentableStatus.COMPLETED ||
|
|
64
|
+
status === PresentableStatus.SKIPPED ||
|
|
65
|
+
status === PresentableStatus.IGNORED);
|
|
66
|
+
}
|
|
67
|
+
EduTestInfo.isSuccess = isSuccess;
|
|
68
|
+
})(EduTestInfo || (exports.EduTestInfo = EduTestInfo = {}));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JSON_FORMAT_VERSION_WITH_NEW_LANGUAGE_VERSION = exports.JSON_FORMAT_VERSION = void 0;
|
|
4
|
+
exports.JSON_FORMAT_VERSION = 22;
|
|
5
|
+
exports.JSON_FORMAT_VERSION_WITH_NEW_LANGUAGE_VERSION = 16;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface FileContents {
|
|
2
|
+
readonly textualRepresentation: string;
|
|
3
|
+
}
|
|
4
|
+
export interface DeterminedContents extends FileContents {
|
|
5
|
+
}
|
|
6
|
+
export interface TextualContents extends DeterminedContents {
|
|
7
|
+
readonly text: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BinaryContents extends DeterminedContents {
|
|
10
|
+
readonly bytes: Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
export interface UndeterminedContents extends FileContents {
|
|
13
|
+
readonly textualRepresentation: string;
|
|
14
|
+
readonly text: string;
|
|
15
|
+
readonly bytes: Uint8Array;
|
|
16
|
+
}
|
|
17
|
+
export declare const TextualContentsEmpty: TextualContents;
|
|
18
|
+
export declare const BinaryContentsEmpty: BinaryContents;
|
|
19
|
+
export declare const UndeterminedContentsEmpty: UndeterminedContents;
|
|
20
|
+
export declare class InMemoryBinaryContents implements BinaryContents {
|
|
21
|
+
readonly bytes: Uint8Array;
|
|
22
|
+
constructor(bytes: Uint8Array);
|
|
23
|
+
get textualRepresentation(): string;
|
|
24
|
+
static parseBase64Encoding(base64: string): InMemoryBinaryContents;
|
|
25
|
+
}
|
|
26
|
+
export declare class InMemoryTextualContents implements TextualContents {
|
|
27
|
+
readonly text: string;
|
|
28
|
+
constructor(text: string);
|
|
29
|
+
get textualRepresentation(): string;
|
|
30
|
+
}
|
|
31
|
+
export declare class InMemoryUndeterminedContents implements UndeterminedContents {
|
|
32
|
+
readonly textualRepresentation: string;
|
|
33
|
+
constructor(textualRepresentation: string);
|
|
34
|
+
get text(): string;
|
|
35
|
+
get bytes(): Uint8Array;
|
|
36
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemoryUndeterminedContents = exports.InMemoryTextualContents = exports.InMemoryBinaryContents = exports.UndeterminedContentsEmpty = exports.BinaryContentsEmpty = exports.TextualContentsEmpty = void 0;
|
|
4
|
+
exports.TextualContentsEmpty = {
|
|
5
|
+
text: "",
|
|
6
|
+
get textualRepresentation() {
|
|
7
|
+
return this.text;
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
exports.BinaryContentsEmpty = {
|
|
11
|
+
bytes: new Uint8Array(),
|
|
12
|
+
get textualRepresentation() {
|
|
13
|
+
return Buffer.from(this.bytes).toString("base64");
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
exports.UndeterminedContentsEmpty = {
|
|
17
|
+
textualRepresentation: "",
|
|
18
|
+
get text() {
|
|
19
|
+
return this.textualRepresentation;
|
|
20
|
+
},
|
|
21
|
+
get bytes() {
|
|
22
|
+
try {
|
|
23
|
+
return Buffer.from(this.textualRepresentation, "base64");
|
|
24
|
+
}
|
|
25
|
+
catch (_a) {
|
|
26
|
+
return new Uint8Array();
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
class InMemoryBinaryContents {
|
|
31
|
+
constructor(bytes) {
|
|
32
|
+
this.bytes = bytes;
|
|
33
|
+
}
|
|
34
|
+
get textualRepresentation() {
|
|
35
|
+
return Buffer.from(this.bytes).toString("base64");
|
|
36
|
+
}
|
|
37
|
+
static parseBase64Encoding(base64) {
|
|
38
|
+
return new InMemoryBinaryContents(Buffer.from(base64, "base64"));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.InMemoryBinaryContents = InMemoryBinaryContents;
|
|
42
|
+
class InMemoryTextualContents {
|
|
43
|
+
constructor(text) {
|
|
44
|
+
this.text = text;
|
|
45
|
+
}
|
|
46
|
+
get textualRepresentation() {
|
|
47
|
+
return this.text;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.InMemoryTextualContents = InMemoryTextualContents;
|
|
51
|
+
class InMemoryUndeterminedContents {
|
|
52
|
+
constructor(textualRepresentation) {
|
|
53
|
+
this.textualRepresentation = textualRepresentation;
|
|
54
|
+
}
|
|
55
|
+
get text() {
|
|
56
|
+
return this.textualRepresentation;
|
|
57
|
+
}
|
|
58
|
+
get bytes() {
|
|
59
|
+
try {
|
|
60
|
+
return Buffer.from(this.textualRepresentation, "base64");
|
|
61
|
+
}
|
|
62
|
+
catch (_a) {
|
|
63
|
+
return new Uint8Array();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.InMemoryUndeterminedContents = InMemoryUndeterminedContents;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EduFile } from "./EduFile";
|
|
2
|
+
import type { BinaryContents, TextualContents } from "./FileContents";
|
|
3
|
+
/**
|
|
4
|
+
* Factory used to create file contents during deserialization of EduFile, TaskFile.
|
|
5
|
+
* Used when json or yaml do not have the contents themselves (text field is empty).
|
|
6
|
+
*/
|
|
7
|
+
export interface FileContentsFactory {
|
|
8
|
+
/**
|
|
9
|
+
* [file] is the EduFile object that will contain these contents.
|
|
10
|
+
* This file may not be fully initialized at the moment of the call.
|
|
11
|
+
*/
|
|
12
|
+
createBinaryContents(file: EduFile): BinaryContents;
|
|
13
|
+
/**
|
|
14
|
+
* see createBinaryContents
|
|
15
|
+
*/
|
|
16
|
+
createTextualContents(file: EduFile): TextualContents;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Lesson } from "./Lesson";
|
|
2
|
+
import { Task } from "./tasks/Task";
|
|
3
|
+
export declare class FrameworkLesson extends Lesson {
|
|
4
|
+
currentTaskIndex: number;
|
|
5
|
+
isTemplateBased: boolean;
|
|
6
|
+
constructor(lesson?: Lesson);
|
|
7
|
+
currentTask(): Task | undefined;
|
|
8
|
+
get itemType(): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FrameworkLesson = void 0;
|
|
4
|
+
const Lesson_1 = require("./Lesson");
|
|
5
|
+
const EduFormatNames_1 = require("./EduFormatNames");
|
|
6
|
+
class FrameworkLesson extends Lesson_1.Lesson {
|
|
7
|
+
constructor(lesson) {
|
|
8
|
+
super();
|
|
9
|
+
this.currentTaskIndex = 0;
|
|
10
|
+
this.isTemplateBased = true;
|
|
11
|
+
if (lesson) {
|
|
12
|
+
this.id = lesson.id;
|
|
13
|
+
this.updateDate = lesson.updateDate;
|
|
14
|
+
this.name = lesson.name;
|
|
15
|
+
this.items = lesson.items;
|
|
16
|
+
this.parent = lesson.parent;
|
|
17
|
+
this.index = lesson.index;
|
|
18
|
+
this.customPresentableName = lesson.customPresentableName;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
currentTask() {
|
|
22
|
+
return this.taskList[this.currentTaskIndex];
|
|
23
|
+
}
|
|
24
|
+
get itemType() {
|
|
25
|
+
return EduFormatNames_1.FRAMEWORK;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.FrameworkLesson = FrameworkLesson;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StudyItem } from "./StudyItem";
|
|
2
|
+
export declare abstract class ItemContainer extends StudyItem {
|
|
3
|
+
private _items;
|
|
4
|
+
get items(): StudyItem[];
|
|
5
|
+
set items(value: StudyItem[]);
|
|
6
|
+
init(parentItem: ItemContainer, isRestarted: boolean): void;
|
|
7
|
+
getItem(name: string): StudyItem | undefined;
|
|
8
|
+
addItem(item: StudyItem): void;
|
|
9
|
+
addItemAt(index: number, item: StudyItem): void;
|
|
10
|
+
replaceItem(existingItem: StudyItem, newItem: StudyItem): void;
|
|
11
|
+
removeItem(item: StudyItem): void;
|
|
12
|
+
sortItems(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ItemContainer = void 0;
|
|
4
|
+
const StudyItem_1 = require("./StudyItem");
|
|
5
|
+
class ItemContainer extends StudyItem_1.StudyItem {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this._items = [];
|
|
9
|
+
}
|
|
10
|
+
get items() {
|
|
11
|
+
return this._items;
|
|
12
|
+
}
|
|
13
|
+
set items(value) {
|
|
14
|
+
this._items = [...value];
|
|
15
|
+
}
|
|
16
|
+
init(parentItem, isRestarted) {
|
|
17
|
+
this.parent = parentItem;
|
|
18
|
+
this.items.forEach((item, index) => {
|
|
19
|
+
item.index = index + 1;
|
|
20
|
+
item.init(this, isRestarted);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
getItem(name) {
|
|
24
|
+
return this.items.find((item) => item.name === name);
|
|
25
|
+
}
|
|
26
|
+
addItem(item) {
|
|
27
|
+
this._items.push(item);
|
|
28
|
+
}
|
|
29
|
+
addItemAt(index, item) {
|
|
30
|
+
this._items.splice(index, 0, item);
|
|
31
|
+
}
|
|
32
|
+
replaceItem(existingItem, newItem) {
|
|
33
|
+
const index = this._items.indexOf(existingItem);
|
|
34
|
+
if (index < 0)
|
|
35
|
+
return;
|
|
36
|
+
this._items[index] = newItem;
|
|
37
|
+
}
|
|
38
|
+
removeItem(item) {
|
|
39
|
+
this._items = this._items.filter((value) => value !== item);
|
|
40
|
+
}
|
|
41
|
+
sortItems() {
|
|
42
|
+
this._items.sort((a, b) => a.index - b.index);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ItemContainer = ItemContainer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JBAccountUserInfo = void 0;
|
|
4
|
+
class JBAccountUserInfo {
|
|
5
|
+
constructor(userName) {
|
|
6
|
+
this.email = "";
|
|
7
|
+
this.name = "";
|
|
8
|
+
this.jbaLogin = "";
|
|
9
|
+
if (userName) {
|
|
10
|
+
this.name = userName;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
getFullName() {
|
|
14
|
+
return this.name;
|
|
15
|
+
}
|
|
16
|
+
toString() {
|
|
17
|
+
return this.getFullName();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.JBAccountUserInfo = JBAccountUserInfo;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Language = void 0;
|
|
4
|
+
const languages = {
|
|
5
|
+
Python: "Python",
|
|
6
|
+
"C++": "C/C++",
|
|
7
|
+
ObjectiveC: "C/C++",
|
|
8
|
+
go: "Go",
|
|
9
|
+
JAVA: "Java",
|
|
10
|
+
kotlin: "Kotlin",
|
|
11
|
+
Scala: "Scala",
|
|
12
|
+
JavaScript: "JavaScript",
|
|
13
|
+
Rust: "Rust",
|
|
14
|
+
PHP: "PHP",
|
|
15
|
+
"Shell Script": "Shell Script",
|
|
16
|
+
SQL: "SQL",
|
|
17
|
+
"C#": "C#",
|
|
18
|
+
unity: "unity",
|
|
19
|
+
TEXT: "Plain text",
|
|
20
|
+
FakeGradleBasedLanguage: "FakeGradleBasedLanguage",
|
|
21
|
+
};
|
|
22
|
+
exports.Language = {
|
|
23
|
+
findLanguageByID(id) {
|
|
24
|
+
return languages[id];
|
|
25
|
+
},
|
|
26
|
+
findLanguageByName(name) {
|
|
27
|
+
if (name === "C/C++") {
|
|
28
|
+
return "C++";
|
|
29
|
+
}
|
|
30
|
+
const entry = Object.entries(languages).find(([, value]) => value === name);
|
|
31
|
+
return entry ? entry[0] : undefined;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LessonContainer } from "./LessonContainer";
|
|
2
|
+
import type { Course } from "./Course";
|
|
3
|
+
import type { Section } from "./Section";
|
|
4
|
+
import { Task } from "./tasks/Task";
|
|
5
|
+
import { ItemContainer } from "./ItemContainer";
|
|
6
|
+
export declare class Lesson extends LessonContainer {
|
|
7
|
+
init(parentItem: ItemContainer, isRestarted: boolean): void;
|
|
8
|
+
get taskList(): Task[];
|
|
9
|
+
get course(): Course;
|
|
10
|
+
get section(): Section | undefined;
|
|
11
|
+
get content(): Task[];
|
|
12
|
+
get itemType(): string;
|
|
13
|
+
addTask(task: Task): void;
|
|
14
|
+
addTaskAt(index: number, task: Task): void;
|
|
15
|
+
removeTask(task: Task): void;
|
|
16
|
+
getTask(name: string): Task | undefined;
|
|
17
|
+
getTask(id: number): Task | undefined;
|
|
18
|
+
get container(): LessonContainer;
|
|
19
|
+
visitTasks(visit: (task: Task) => void): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Lesson = void 0;
|
|
4
|
+
const LessonContainer_1 = require("./LessonContainer");
|
|
5
|
+
const Task_1 = require("./tasks/Task");
|
|
6
|
+
const EduFormatNames_1 = require("./EduFormatNames");
|
|
7
|
+
function getLessonContainerModule() {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
9
|
+
return require("./Section");
|
|
10
|
+
}
|
|
11
|
+
class Lesson extends LessonContainer_1.LessonContainer {
|
|
12
|
+
init(parentItem, isRestarted) {
|
|
13
|
+
if (!(parentItem instanceof LessonContainer_1.LessonContainer)) {
|
|
14
|
+
throw new Error(`Parent for lesson ${this.name} should be either course or section`);
|
|
15
|
+
}
|
|
16
|
+
super.init(parentItem, isRestarted);
|
|
17
|
+
}
|
|
18
|
+
get taskList() {
|
|
19
|
+
return this.items.filter((item) => item instanceof Task_1.Task);
|
|
20
|
+
}
|
|
21
|
+
get course() {
|
|
22
|
+
return this.parent.course;
|
|
23
|
+
}
|
|
24
|
+
get section() {
|
|
25
|
+
return this.parent instanceof getLessonContainerModule().Section ? this.parent : undefined;
|
|
26
|
+
}
|
|
27
|
+
get content() {
|
|
28
|
+
return this.items.filter((item) => item instanceof Task_1.Task);
|
|
29
|
+
}
|
|
30
|
+
get itemType() {
|
|
31
|
+
return EduFormatNames_1.LESSON;
|
|
32
|
+
}
|
|
33
|
+
addTask(task) {
|
|
34
|
+
this.addItem(task);
|
|
35
|
+
}
|
|
36
|
+
addTaskAt(index, task) {
|
|
37
|
+
this.addItemAt(index, task);
|
|
38
|
+
}
|
|
39
|
+
removeTask(task) {
|
|
40
|
+
this.removeItem(task);
|
|
41
|
+
}
|
|
42
|
+
getTask(param) {
|
|
43
|
+
if (typeof param === "string") {
|
|
44
|
+
return this.taskList.find((task) => task.name === param);
|
|
45
|
+
}
|
|
46
|
+
return this.taskList.find((task) => task.id === param);
|
|
47
|
+
}
|
|
48
|
+
get container() {
|
|
49
|
+
var _a;
|
|
50
|
+
return (_a = this.section) !== null && _a !== void 0 ? _a : this.course;
|
|
51
|
+
}
|
|
52
|
+
visitTasks(visit) {
|
|
53
|
+
this.taskList.forEach(visit);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.Lesson = Lesson;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ItemContainer } from "./ItemContainer";
|
|
2
|
+
import type { Lesson } from "./Lesson";
|
|
3
|
+
import type { Section } from "./Section";
|
|
4
|
+
import { Task } from "./tasks/Task";
|
|
5
|
+
export declare abstract class LessonContainer extends ItemContainer {
|
|
6
|
+
get lessons(): Lesson[];
|
|
7
|
+
getLesson(name: string): Lesson | undefined;
|
|
8
|
+
getLesson(id: number): Lesson | undefined;
|
|
9
|
+
getLesson(check: (lesson: Lesson) => boolean): Lesson | undefined;
|
|
10
|
+
addLessons(lessons: Lesson[]): void;
|
|
11
|
+
addLesson(lesson: Lesson): void;
|
|
12
|
+
removeLesson(lesson: Lesson): void;
|
|
13
|
+
visitLessons(visit: (lesson: Lesson) => void): void;
|
|
14
|
+
visitSections(visit: (section: Section) => void): void;
|
|
15
|
+
visitTasks(visit: (task: Task) => void): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LessonContainer = void 0;
|
|
4
|
+
const ItemContainer_1 = require("./ItemContainer");
|
|
5
|
+
function getLessonModule() {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
7
|
+
const SectionModule = require("./Section");
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
9
|
+
const LessonModule = require("./Lesson");
|
|
10
|
+
return { Lesson: LessonModule.Lesson, Section: SectionModule.Section };
|
|
11
|
+
}
|
|
12
|
+
class LessonContainer extends ItemContainer_1.ItemContainer {
|
|
13
|
+
get lessons() {
|
|
14
|
+
const mod = getLessonModule();
|
|
15
|
+
return this.items.filter((item) => item instanceof mod.Lesson);
|
|
16
|
+
}
|
|
17
|
+
getLesson(param) {
|
|
18
|
+
if (typeof param === "string") {
|
|
19
|
+
return this.getLesson((lesson) => lesson.name === param);
|
|
20
|
+
}
|
|
21
|
+
if (typeof param === "number") {
|
|
22
|
+
return this.getLesson((lesson) => lesson.id === param);
|
|
23
|
+
}
|
|
24
|
+
return this.lessons.find(param);
|
|
25
|
+
}
|
|
26
|
+
addLessons(lessons) {
|
|
27
|
+
lessons.forEach((lesson) => this.addItem(lesson));
|
|
28
|
+
}
|
|
29
|
+
addLesson(lesson) {
|
|
30
|
+
this.addItem(lesson);
|
|
31
|
+
}
|
|
32
|
+
removeLesson(lesson) {
|
|
33
|
+
this.removeItem(lesson);
|
|
34
|
+
}
|
|
35
|
+
visitLessons(visit) {
|
|
36
|
+
const mod = getLessonModule();
|
|
37
|
+
for (const item of this.items) {
|
|
38
|
+
if (item instanceof mod.Lesson) {
|
|
39
|
+
visit(item);
|
|
40
|
+
}
|
|
41
|
+
else if (item instanceof mod.Section) {
|
|
42
|
+
item.lessons.forEach(visit);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
visitSections(visit) {
|
|
47
|
+
const mod = getLessonModule();
|
|
48
|
+
this.items.filter((item) => item instanceof mod.Section).forEach(visit);
|
|
49
|
+
}
|
|
50
|
+
visitTasks(visit) {
|
|
51
|
+
this.visitLessons((lesson) => lesson.visitTasks(visit));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.LessonContainer = LessonContainer;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PluginInfo = void 0;
|
|
4
|
+
class PluginInfo {
|
|
5
|
+
constructor(stringId, displayName, minVersion, maxVersion) {
|
|
6
|
+
this.stringId = "";
|
|
7
|
+
if (stringId !== undefined) {
|
|
8
|
+
this.stringId = stringId;
|
|
9
|
+
}
|
|
10
|
+
this.displayName = displayName !== null && displayName !== void 0 ? displayName : undefined;
|
|
11
|
+
this.minVersion = minVersion !== null && minVersion !== void 0 ? minVersion : undefined;
|
|
12
|
+
this.maxVersion = maxVersion !== null && maxVersion !== void 0 ? maxVersion : undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.PluginInfo = PluginInfo;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LessonContainer } from "./LessonContainer";
|
|
2
|
+
import type { Course } from "./Course";
|
|
3
|
+
import { ItemContainer } from "./ItemContainer";
|
|
4
|
+
export declare class Section extends LessonContainer {
|
|
5
|
+
init(parentItem: ItemContainer, isRestarted: boolean): void;
|
|
6
|
+
get course(): Course;
|
|
7
|
+
get itemType(): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Section = void 0;
|
|
4
|
+
const LessonContainer_1 = require("./LessonContainer");
|
|
5
|
+
const EduFormatNames_1 = require("./EduFormatNames");
|
|
6
|
+
function getCourseModule() {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
8
|
+
return require("./Course");
|
|
9
|
+
}
|
|
10
|
+
class Section extends LessonContainer_1.LessonContainer {
|
|
11
|
+
init(parentItem, isRestarted) {
|
|
12
|
+
if (!(parentItem instanceof getCourseModule().Course)) {
|
|
13
|
+
throw new Error(`Course is null for section ${this.name}`);
|
|
14
|
+
}
|
|
15
|
+
super.init(parentItem, isRestarted);
|
|
16
|
+
}
|
|
17
|
+
get course() {
|
|
18
|
+
if (!(this.parent instanceof getCourseModule().Course)) {
|
|
19
|
+
throw new Error(`Course is null for section ${this.name}`);
|
|
20
|
+
}
|
|
21
|
+
return this.parent;
|
|
22
|
+
}
|
|
23
|
+
get itemType() {
|
|
24
|
+
return EduFormatNames_1.SECTION;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.Section = Section;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ItemContainer } from "./ItemContainer";
|
|
2
|
+
import type { Course } from "./Course";
|
|
3
|
+
export declare abstract class StudyItem {
|
|
4
|
+
index: number;
|
|
5
|
+
name: string;
|
|
6
|
+
updateDate: Date;
|
|
7
|
+
id: number;
|
|
8
|
+
contentTags: string[];
|
|
9
|
+
customPresentableName?: string;
|
|
10
|
+
protected _parent?: ItemContainer;
|
|
11
|
+
constructor(name?: string);
|
|
12
|
+
get parent(): ItemContainer;
|
|
13
|
+
set parent(value: ItemContainer);
|
|
14
|
+
get presentableName(): string;
|
|
15
|
+
abstract get course(): Course;
|
|
16
|
+
abstract get itemType(): string;
|
|
17
|
+
abstract init(parentItem: ItemContainer, isRestarted: boolean): void;
|
|
18
|
+
getRelativePath(root: StudyItem): string;
|
|
19
|
+
get pathInCourse(): string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StudyItem = void 0;
|
|
4
|
+
class StudyItem {
|
|
5
|
+
constructor(name) {
|
|
6
|
+
this.index = -1;
|
|
7
|
+
this.name = "";
|
|
8
|
+
this.updateDate = new Date(0);
|
|
9
|
+
this.id = 0;
|
|
10
|
+
this.contentTags = [];
|
|
11
|
+
if (name) {
|
|
12
|
+
this.name = name;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
get parent() {
|
|
16
|
+
if (!this._parent) {
|
|
17
|
+
throw new Error(`Parent is null for StudyItem ${this.name}`);
|
|
18
|
+
}
|
|
19
|
+
return this._parent;
|
|
20
|
+
}
|
|
21
|
+
set parent(value) {
|
|
22
|
+
this._parent = value;
|
|
23
|
+
}
|
|
24
|
+
get presentableName() {
|
|
25
|
+
var _a;
|
|
26
|
+
return (_a = this.customPresentableName) !== null && _a !== void 0 ? _a : this.name;
|
|
27
|
+
}
|
|
28
|
+
getRelativePath(root) {
|
|
29
|
+
if (this === root)
|
|
30
|
+
return "";
|
|
31
|
+
const parents = [];
|
|
32
|
+
let currentParent = this.parent;
|
|
33
|
+
while (currentParent !== root) {
|
|
34
|
+
parents.push(currentParent.name);
|
|
35
|
+
currentParent = currentParent.parent;
|
|
36
|
+
}
|
|
37
|
+
parents.reverse();
|
|
38
|
+
if (parents.length === 0)
|
|
39
|
+
return this.name;
|
|
40
|
+
parents.push(this.name);
|
|
41
|
+
return parents.join("/");
|
|
42
|
+
}
|
|
43
|
+
get pathInCourse() {
|
|
44
|
+
return this.getRelativePath(this.course);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.StudyItem = StudyItem;
|