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.
Files changed (239) hide show
  1. package/.idea/edu-format-ts.iml +10 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +28 -0
  3. package/.idea/misc.xml +4 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/vcs.xml +6 -0
  6. package/AGENTS.md +1 -0
  7. package/dist/courseFormat/AnswerPlaceholder.d.ts +37 -0
  8. package/dist/courseFormat/AnswerPlaceholder.js +101 -0
  9. package/dist/courseFormat/AnswerPlaceholderComparator.d.ts +4 -0
  10. package/dist/courseFormat/AnswerPlaceholderComparator.js +8 -0
  11. package/dist/courseFormat/AnswerPlaceholderDependency.d.ts +19 -0
  12. package/dist/courseFormat/AnswerPlaceholderDependency.js +91 -0
  13. package/dist/courseFormat/CheckFeedback.d.ts +20 -0
  14. package/dist/courseFormat/CheckFeedback.js +58 -0
  15. package/dist/courseFormat/CheckResult.d.ts +33 -0
  16. package/dist/courseFormat/CheckResult.js +58 -0
  17. package/dist/courseFormat/CheckResultSeverity.d.ts +7 -0
  18. package/dist/courseFormat/CheckResultSeverity.js +17 -0
  19. package/dist/courseFormat/CheckStatus.d.ts +5 -0
  20. package/dist/courseFormat/CheckStatus.js +9 -0
  21. package/dist/courseFormat/Course.d.ts +68 -0
  22. package/dist/courseFormat/Course.js +165 -0
  23. package/dist/courseFormat/CourseMode.d.ts +4 -0
  24. package/dist/courseFormat/CourseMode.js +8 -0
  25. package/dist/courseFormat/CourseVisibility.d.ts +4 -0
  26. package/dist/courseFormat/CourseVisibility.js +8 -0
  27. package/dist/courseFormat/CourseraCourse.d.ts +5 -0
  28. package/dist/courseFormat/CourseraCourse.js +15 -0
  29. package/dist/courseFormat/DescriptionFormat.d.ts +5 -0
  30. package/dist/courseFormat/DescriptionFormat.js +9 -0
  31. package/dist/courseFormat/EduCourse.d.ts +17 -0
  32. package/dist/courseFormat/EduCourse.js +42 -0
  33. package/dist/courseFormat/EduFile.d.ts +22 -0
  34. package/dist/courseFormat/EduFile.js +110 -0
  35. package/dist/courseFormat/EduFileErrorHighlightLevel.d.ts +5 -0
  36. package/dist/courseFormat/EduFileErrorHighlightLevel.js +9 -0
  37. package/dist/courseFormat/EduFormatNames.d.ts +75 -0
  38. package/dist/courseFormat/EduFormatNames.js +80 -0
  39. package/dist/courseFormat/EduTestInfo.d.ts +28 -0
  40. package/dist/courseFormat/EduTestInfo.js +68 -0
  41. package/dist/courseFormat/EduVersions.d.ts +2 -0
  42. package/dist/courseFormat/EduVersions.js +5 -0
  43. package/dist/courseFormat/FileContents.d.ts +36 -0
  44. package/dist/courseFormat/FileContents.js +67 -0
  45. package/dist/courseFormat/FileContentsFactory.d.ts +17 -0
  46. package/dist/courseFormat/FileContentsFactory.js +2 -0
  47. package/dist/courseFormat/FrameworkLesson.d.ts +9 -0
  48. package/dist/courseFormat/FrameworkLesson.js +28 -0
  49. package/dist/courseFormat/ItemContainer.d.ts +13 -0
  50. package/dist/courseFormat/ItemContainer.js +45 -0
  51. package/dist/courseFormat/JBAccountUserInfo.d.ts +9 -0
  52. package/dist/courseFormat/JBAccountUserInfo.js +20 -0
  53. package/dist/courseFormat/Language.d.ts +4 -0
  54. package/dist/courseFormat/Language.js +33 -0
  55. package/dist/courseFormat/Lesson.d.ts +20 -0
  56. package/dist/courseFormat/Lesson.js +56 -0
  57. package/dist/courseFormat/LessonContainer.d.ts +16 -0
  58. package/dist/courseFormat/LessonContainer.js +54 -0
  59. package/dist/courseFormat/PluginInfo.d.ts +7 -0
  60. package/dist/courseFormat/PluginInfo.js +15 -0
  61. package/dist/courseFormat/Section.d.ts +8 -0
  62. package/dist/courseFormat/Section.js +27 -0
  63. package/dist/courseFormat/StudyItem.d.ts +20 -0
  64. package/dist/courseFormat/StudyItem.js +47 -0
  65. package/dist/courseFormat/Tags.d.ts +16 -0
  66. package/dist/courseFormat/Tags.js +42 -0
  67. package/dist/courseFormat/TaskFile.d.ts +26 -0
  68. package/dist/courseFormat/TaskFile.js +72 -0
  69. package/dist/courseFormat/UserInfo.d.ts +3 -0
  70. package/dist/courseFormat/UserInfo.js +2 -0
  71. package/dist/courseFormat/Vendor.d.ts +7 -0
  72. package/dist/courseFormat/Vendor.js +14 -0
  73. package/dist/courseFormat/attempts/Attempt.d.ts +12 -0
  74. package/dist/courseFormat/attempts/Attempt.js +25 -0
  75. package/dist/courseFormat/attempts/AttemptBase.d.ts +9 -0
  76. package/dist/courseFormat/attempts/AttemptBase.js +28 -0
  77. package/dist/courseFormat/attempts/DataTaskAttempt.d.ts +6 -0
  78. package/dist/courseFormat/attempts/DataTaskAttempt.js +24 -0
  79. package/dist/courseFormat/attempts/Dataset.d.ts +12 -0
  80. package/dist/courseFormat/attempts/Dataset.js +21 -0
  81. package/dist/courseFormat/fileUtils.d.ts +5 -0
  82. package/dist/courseFormat/fileUtils.js +32 -0
  83. package/dist/courseFormat/hyperskill/HyperskillCourse.d.ts +13 -0
  84. package/dist/courseFormat/hyperskill/HyperskillCourse.js +25 -0
  85. package/dist/courseFormat/hyperskill/HyperskillProject.d.ts +10 -0
  86. package/dist/courseFormat/hyperskill/HyperskillProject.js +16 -0
  87. package/dist/courseFormat/hyperskill/HyperskillStage.d.ts +8 -0
  88. package/dist/courseFormat/hyperskill/HyperskillStage.js +20 -0
  89. package/dist/courseFormat/hyperskill/HyperskillTaskType.d.ts +4 -0
  90. package/dist/courseFormat/hyperskill/HyperskillTaskType.js +26 -0
  91. package/dist/courseFormat/hyperskill/HyperskillTopic.d.ts +5 -0
  92. package/dist/courseFormat/hyperskill/HyperskillTopic.js +11 -0
  93. package/dist/courseFormat/loggerUtils.d.ts +1 -0
  94. package/dist/courseFormat/loggerUtils.js +6 -0
  95. package/dist/courseFormat/stepik/StepikCourse.d.ts +5 -0
  96. package/dist/courseFormat/stepik/StepikCourse.js +15 -0
  97. package/dist/courseFormat/stepik/StepikLesson.d.ts +6 -0
  98. package/dist/courseFormat/stepik/StepikLesson.js +16 -0
  99. package/dist/courseFormat/tasks/AnswerTask.d.ts +8 -0
  100. package/dist/courseFormat/tasks/AnswerTask.js +11 -0
  101. package/dist/courseFormat/tasks/CodeTask.d.ts +12 -0
  102. package/dist/courseFormat/tasks/CodeTask.js +21 -0
  103. package/dist/courseFormat/tasks/DataTask.d.ts +18 -0
  104. package/dist/courseFormat/tasks/DataTask.js +32 -0
  105. package/dist/courseFormat/tasks/EduTask.d.ts +12 -0
  106. package/dist/courseFormat/tasks/EduTask.js +22 -0
  107. package/dist/courseFormat/tasks/IdeTask.d.ts +9 -0
  108. package/dist/courseFormat/tasks/IdeTask.js +14 -0
  109. package/dist/courseFormat/tasks/NumberTask.d.ts +9 -0
  110. package/dist/courseFormat/tasks/NumberTask.js +14 -0
  111. package/dist/courseFormat/tasks/OutputTask.d.ts +10 -0
  112. package/dist/courseFormat/tasks/OutputTask.js +18 -0
  113. package/dist/courseFormat/tasks/OutputTaskBase.d.ts +14 -0
  114. package/dist/courseFormat/tasks/OutputTaskBase.js +19 -0
  115. package/dist/courseFormat/tasks/RemoteEduTask.d.ts +9 -0
  116. package/dist/courseFormat/tasks/RemoteEduTask.js +15 -0
  117. package/dist/courseFormat/tasks/StringTask.d.ts +9 -0
  118. package/dist/courseFormat/tasks/StringTask.js +14 -0
  119. package/dist/courseFormat/tasks/TableTask.d.ts +17 -0
  120. package/dist/courseFormat/tasks/TableTask.js +43 -0
  121. package/dist/courseFormat/tasks/Task.d.ts +45 -0
  122. package/dist/courseFormat/tasks/Task.js +155 -0
  123. package/dist/courseFormat/tasks/TheoryTask.d.ts +10 -0
  124. package/dist/courseFormat/tasks/TheoryTask.js +15 -0
  125. package/dist/courseFormat/tasks/UnsupportedTask.d.ts +9 -0
  126. package/dist/courseFormat/tasks/UnsupportedTask.js +14 -0
  127. package/dist/courseFormat/tasks/choice/ChoiceOption.d.ts +10 -0
  128. package/dist/courseFormat/tasks/choice/ChoiceOption.js +33 -0
  129. package/dist/courseFormat/tasks/choice/ChoiceOptionStatus.d.ts +5 -0
  130. package/dist/courseFormat/tasks/choice/ChoiceOptionStatus.js +9 -0
  131. package/dist/courseFormat/tasks/choice/ChoiceTask.d.ts +23 -0
  132. package/dist/courseFormat/tasks/choice/ChoiceTask.js +47 -0
  133. package/dist/courseFormat/tasks/matching/MatchingTask.d.ts +10 -0
  134. package/dist/courseFormat/tasks/matching/MatchingTask.js +15 -0
  135. package/dist/courseFormat/tasks/matching/SortingBasedTask.d.ts +16 -0
  136. package/dist/courseFormat/tasks/matching/SortingBasedTask.js +50 -0
  137. package/dist/courseFormat/tasks/matching/SortingTask.d.ts +9 -0
  138. package/dist/courseFormat/tasks/matching/SortingTask.js +14 -0
  139. package/dist/courseFormat/uiMessages.d.ts +3 -0
  140. package/dist/courseFormat/uiMessages.js +14 -0
  141. package/dist/disk-loader.d.ts +4 -0
  142. package/dist/disk-loader.js +389 -0
  143. package/dist/index.d.ts +31 -0
  144. package/dist/index.js +64 -0
  145. package/dist/loader.d.ts +7 -0
  146. package/dist/loader.js +435 -0
  147. package/dist/models.d.ts +49 -0
  148. package/dist/models.js +2 -0
  149. package/dist/zip-loader.d.ts +4 -0
  150. package/dist/zip-loader.js +431 -0
  151. package/example-course-project/course-info.yaml +15 -0
  152. package/example-course-project/lesson1/lesson-info.yaml +3 -0
  153. package/example-course-project/lesson1/lesson-remote-info.yaml +1 -0
  154. package/example-course-project/lesson1/task1/Task.txt +1 -0
  155. package/example-course-project/lesson1/task1/task-info.yaml +12 -0
  156. package/example-course-project/lesson1/task1/task-remote-info.yaml +1 -0
  157. package/example-course-project/lesson1/task1/task.md +47 -0
  158. package/example-course-project/lesson1/task1/tests/Tests.txt +0 -0
  159. package/example-course-project/lesson1/task2/Task.txt +1 -0
  160. package/example-course-project/lesson1/task2/task-info.yaml +12 -0
  161. package/example-course-project/lesson1/task2/task-remote-info.yaml +1 -0
  162. package/example-course-project/lesson1/task2/task.md +47 -0
  163. package/example-course-project/lesson1/task2/tests/Tests.txt +0 -0
  164. package/package.json +19 -0
  165. package/src/@types/mime-types.d.ts +3 -0
  166. package/src/courseFormat/AnswerPlaceholder.ts +121 -0
  167. package/src/courseFormat/AnswerPlaceholderComparator.ts +7 -0
  168. package/src/courseFormat/AnswerPlaceholderDependency.ts +122 -0
  169. package/src/courseFormat/CheckFeedback.ts +71 -0
  170. package/src/courseFormat/CheckResult.ts +92 -0
  171. package/src/courseFormat/CheckResultSeverity.ts +13 -0
  172. package/src/courseFormat/CheckStatus.ts +5 -0
  173. package/src/courseFormat/Course.ts +201 -0
  174. package/src/courseFormat/CourseMode.ts +4 -0
  175. package/src/courseFormat/CourseVisibility.ts +4 -0
  176. package/src/courseFormat/CourseraCourse.ts +10 -0
  177. package/src/courseFormat/DescriptionFormat.ts +5 -0
  178. package/src/courseFormat/EduCourse.ts +41 -0
  179. package/src/courseFormat/EduFile.ts +133 -0
  180. package/src/courseFormat/EduFileErrorHighlightLevel.ts +5 -0
  181. package/src/courseFormat/EduFormatNames.ts +95 -0
  182. package/src/courseFormat/EduTestInfo.ts +87 -0
  183. package/src/courseFormat/EduVersions.ts +2 -0
  184. package/src/courseFormat/FileContents.ts +97 -0
  185. package/src/courseFormat/FileContentsFactory.ts +19 -0
  186. package/src/courseFormat/FrameworkLesson.ts +29 -0
  187. package/src/courseFormat/ItemContainer.ts +47 -0
  188. package/src/courseFormat/JBAccountUserInfo.ts +21 -0
  189. package/src/courseFormat/Language.ts +31 -0
  190. package/src/courseFormat/Lesson.ts +69 -0
  191. package/src/courseFormat/LessonContainer.ts +65 -0
  192. package/src/courseFormat/PluginInfo.ts +15 -0
  193. package/src/courseFormat/Section.ts +29 -0
  194. package/src/courseFormat/StudyItem.ts +55 -0
  195. package/src/courseFormat/Tags.ts +45 -0
  196. package/src/courseFormat/TaskFile.ts +88 -0
  197. package/src/courseFormat/UserInfo.ts +3 -0
  198. package/src/courseFormat/Vendor.ts +15 -0
  199. package/src/courseFormat/attempts/Attempt.ts +28 -0
  200. package/src/courseFormat/attempts/AttemptBase.ts +24 -0
  201. package/src/courseFormat/attempts/DataTaskAttempt.ts +19 -0
  202. package/src/courseFormat/attempts/Dataset.ts +13 -0
  203. package/src/courseFormat/fileUtils.ts +31 -0
  204. package/src/courseFormat/hyperskill/HyperskillCourse.ts +24 -0
  205. package/src/courseFormat/hyperskill/HyperskillProject.ts +10 -0
  206. package/src/courseFormat/hyperskill/HyperskillStage.ts +15 -0
  207. package/src/courseFormat/hyperskill/HyperskillTaskType.ts +23 -0
  208. package/src/courseFormat/hyperskill/HyperskillTopic.ts +5 -0
  209. package/src/courseFormat/loggerUtils.ts +3 -0
  210. package/src/courseFormat/stepik/StepikCourse.ts +10 -0
  211. package/src/courseFormat/stepik/StepikLesson.ts +11 -0
  212. package/src/courseFormat/tasks/AnswerTask.ts +13 -0
  213. package/src/courseFormat/tasks/CodeTask.ts +42 -0
  214. package/src/courseFormat/tasks/DataTask.ts +37 -0
  215. package/src/courseFormat/tasks/EduTask.ts +26 -0
  216. package/src/courseFormat/tasks/IdeTask.ts +17 -0
  217. package/src/courseFormat/tasks/NumberTask.ts +17 -0
  218. package/src/courseFormat/tasks/OutputTask.ts +21 -0
  219. package/src/courseFormat/tasks/OutputTaskBase.ts +23 -0
  220. package/src/courseFormat/tasks/RemoteEduTask.ts +18 -0
  221. package/src/courseFormat/tasks/StringTask.ts +17 -0
  222. package/src/courseFormat/tasks/TableTask.ts +51 -0
  223. package/src/courseFormat/tasks/Task.ts +181 -0
  224. package/src/courseFormat/tasks/TheoryTask.ts +19 -0
  225. package/src/courseFormat/tasks/UnsupportedTask.ts +17 -0
  226. package/src/courseFormat/tasks/choice/ChoiceOption.ts +37 -0
  227. package/src/courseFormat/tasks/choice/ChoiceOptionStatus.ts +5 -0
  228. package/src/courseFormat/tasks/choice/ChoiceTask.ts +57 -0
  229. package/src/courseFormat/tasks/matching/MatchingTask.ts +19 -0
  230. package/src/courseFormat/tasks/matching/SortingBasedTask.ts +59 -0
  231. package/src/courseFormat/tasks/matching/SortingTask.ts +17 -0
  232. package/src/courseFormat/uiMessages.ts +12 -0
  233. package/src/disk-loader.ts +463 -0
  234. package/src/index.ts +33 -0
  235. package/src/models.ts +54 -0
  236. package/src/zip-loader.ts +583 -0
  237. package/test/load-course.test.js +279 -0
  238. package/test/load-zip-course.test.js +73 -0
  239. package/tsconfig.json +15 -0
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Course = void 0;
4
+ const LessonContainer_1 = require("./LessonContainer");
5
+ const CourseMode_1 = require("./CourseMode");
6
+ const CourseVisibility_1 = require("./CourseVisibility");
7
+ const EduFormatNames_1 = require("./EduFormatNames");
8
+ const Section_1 = require("./Section");
9
+ const Language_1 = require("./Language");
10
+ class Course extends LessonContainer_1.LessonContainer {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.description = "";
14
+ this.environment = EduFormatNames_1.DEFAULT_ENVIRONMENT;
15
+ this.environmentSettings = {};
16
+ this.courseMode = CourseMode_1.CourseMode.STUDENT;
17
+ this.solutionsHidden = false;
18
+ this.disabledFeatures = [];
19
+ this.visibility = CourseVisibility_1.CourseVisibility.LocalVisibility;
20
+ this.additionalFiles = [];
21
+ this.pluginDependencies = [];
22
+ this.nonEditableFiles = new Set();
23
+ this.authors = [];
24
+ this.isLocal = false;
25
+ this.needWriteYamlText = false;
26
+ this.languageCode = "en";
27
+ this.isMarketplace = false;
28
+ this.marketplaceCourseVersion = 0;
29
+ this.isMarketplacePrivate = false;
30
+ this.createDate = new Date(0);
31
+ this.customContentPath = "";
32
+ this._languageId = "";
33
+ this._programmingLanguage = "";
34
+ }
35
+ get type() {
36
+ return this.itemType;
37
+ }
38
+ get title() {
39
+ return this.name;
40
+ }
41
+ set title(value) {
42
+ this.name = value;
43
+ }
44
+ get language() {
45
+ return this.languageCode;
46
+ }
47
+ get content() {
48
+ return this.lessons;
49
+ }
50
+ get programmingLanguage() {
51
+ return this._programmingLanguage;
52
+ }
53
+ set programmingLanguage(value) {
54
+ if (!value)
55
+ return;
56
+ this._programmingLanguage = value;
57
+ const parts = value.split(" ");
58
+ this.languageId = parts[0];
59
+ this.languageVersion = parts[1];
60
+ }
61
+ get languageId() {
62
+ var _a;
63
+ if (this._languageId === EduFormatNames_1.OBJECTIVE_C || this._languageId === EduFormatNames_1.CPP) {
64
+ return (_a = Language_1.Language.findLanguageByName("C/C++")) !== null && _a !== void 0 ? _a : this._languageId;
65
+ }
66
+ return this._languageId;
67
+ }
68
+ set languageId(value) {
69
+ this._languageId = value;
70
+ }
71
+ initCourse(isRestarted) {
72
+ this.init(this, isRestarted);
73
+ }
74
+ init(parentItem, isRestarted) {
75
+ if (!(parentItem instanceof Course)) {
76
+ throw new Error("Parent for course must be itself");
77
+ }
78
+ super.init(parentItem, isRestarted);
79
+ }
80
+ getLesson(param1, param2) {
81
+ if (typeof param1 === "string" && param2 !== undefined) {
82
+ const sectionName = param1;
83
+ const lessonName = param2;
84
+ if (sectionName) {
85
+ const section = this.getSection(sectionName);
86
+ if (section) {
87
+ return section.getLesson(lessonName);
88
+ }
89
+ }
90
+ return this.lessons.find((lesson) => lesson.name === lessonName);
91
+ }
92
+ if (param1 === undefined)
93
+ return undefined;
94
+ if (typeof param1 === "string") {
95
+ return super.getLesson(param1);
96
+ }
97
+ if (typeof param1 === "number") {
98
+ return super.getLesson(param1);
99
+ }
100
+ return super.getLesson(param1);
101
+ }
102
+ get sections() {
103
+ return this.items.filter((item) => item instanceof Section_1.Section);
104
+ }
105
+ addSection(section) {
106
+ this.addItem(section);
107
+ }
108
+ removeSection(section) {
109
+ this.removeItem(section);
110
+ }
111
+ getSection(param) {
112
+ if (typeof param === "string") {
113
+ return this.sections.find((section) => section.name === param);
114
+ }
115
+ return this.sections.find(param);
116
+ }
117
+ get course() {
118
+ return this;
119
+ }
120
+ get itemType() {
121
+ return EduFormatNames_1.PYCHARM;
122
+ }
123
+ get isStudy() {
124
+ return this.courseMode === CourseMode_1.CourseMode.STUDENT;
125
+ }
126
+ sortItems() {
127
+ super.sortItems();
128
+ this.sections.forEach((section) => section.sortItems());
129
+ }
130
+ toString() {
131
+ return this.name;
132
+ }
133
+ get authorFullNames() {
134
+ return this.organization ? [this.organization] : this.authors.map((author) => author.getFullName());
135
+ }
136
+ get humanLanguage() {
137
+ var _a;
138
+ try {
139
+ return (_a = new Intl.DisplayNames([this.languageCode], { type: "language" }).of(this.languageCode)) !== null && _a !== void 0 ? _a : this.languageCode;
140
+ }
141
+ catch (_b) {
142
+ return this.languageCode;
143
+ }
144
+ }
145
+ get isStepikRemote() {
146
+ return false;
147
+ }
148
+ incrementMarketplaceCourseVersion(remoteCourseVersion) {
149
+ this.marketplaceCourseVersion = remoteCourseVersion + 1;
150
+ }
151
+ isEditableFile(path) {
152
+ return !this.nonEditableFiles.has(path);
153
+ }
154
+ addNonEditableFile(path) {
155
+ if (path && this.isStudy) {
156
+ this.nonEditableFiles.add(path);
157
+ }
158
+ }
159
+ removeNonEditableFile(path) {
160
+ if (path && this.isStudy) {
161
+ this.nonEditableFiles.delete(path);
162
+ }
163
+ }
164
+ }
165
+ exports.Course = Course;
@@ -0,0 +1,4 @@
1
+ export declare enum CourseMode {
2
+ STUDENT = "STUDENT",
3
+ EDUCATOR = "EDUCATOR"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CourseMode = void 0;
4
+ var CourseMode;
5
+ (function (CourseMode) {
6
+ CourseMode["STUDENT"] = "STUDENT";
7
+ CourseMode["EDUCATOR"] = "EDUCATOR";
8
+ })(CourseMode || (exports.CourseMode = CourseMode = {}));
@@ -0,0 +1,4 @@
1
+ export declare enum CourseVisibility {
2
+ LocalVisibility = "LocalVisibility",
3
+ RemoteVisibility = "RemoteVisibility"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CourseVisibility = void 0;
4
+ var CourseVisibility;
5
+ (function (CourseVisibility) {
6
+ CourseVisibility["LocalVisibility"] = "LocalVisibility";
7
+ CourseVisibility["RemoteVisibility"] = "RemoteVisibility";
8
+ })(CourseVisibility || (exports.CourseVisibility = CourseVisibility = {}));
@@ -0,0 +1,5 @@
1
+ import { Course } from "./Course";
2
+ export declare class CourseraCourse extends Course {
3
+ submitManually: boolean;
4
+ get itemType(): string;
5
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CourseraCourse = void 0;
4
+ const Course_1 = require("./Course");
5
+ const EduFormatNames_1 = require("./EduFormatNames");
6
+ class CourseraCourse extends Course_1.Course {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.submitManually = false;
10
+ }
11
+ get itemType() {
12
+ return EduFormatNames_1.COURSERA;
13
+ }
14
+ }
15
+ exports.CourseraCourse = CourseraCourse;
@@ -0,0 +1,5 @@
1
+ export declare enum DescriptionFormat {
2
+ HTML = "HTML",
3
+ MD = "MD",
4
+ TEXT = "TEXT"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DescriptionFormat = void 0;
4
+ var DescriptionFormat;
5
+ (function (DescriptionFormat) {
6
+ DescriptionFormat["HTML"] = "HTML";
7
+ DescriptionFormat["MD"] = "MD";
8
+ DescriptionFormat["TEXT"] = "TEXT";
9
+ })(DescriptionFormat || (exports.DescriptionFormat = DescriptionFormat = {}));
@@ -0,0 +1,17 @@
1
+ import { Course } from "./Course";
2
+ export declare class EduCourse extends Course {
3
+ get itemType(): string;
4
+ get isStepikRemote(): boolean;
5
+ get isMarketplaceRemote(): boolean;
6
+ formatVersion: number;
7
+ isUpToDate: boolean;
8
+ learnersCount: number;
9
+ reviewScore: number;
10
+ generatedEduId?: string;
11
+ isPreview: boolean;
12
+ sectionIds: number[];
13
+ instructors: number[];
14
+ isStepikPublic: boolean;
15
+ reviewSummary: number;
16
+ convertToLocal(): void;
17
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EduCourse = void 0;
4
+ const Course_1 = require("./Course");
5
+ const EduFormatNames_1 = require("./EduFormatNames");
6
+ const EduVersions_1 = require("./EduVersions");
7
+ class EduCourse extends Course_1.Course {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.formatVersion = EduVersions_1.JSON_FORMAT_VERSION;
11
+ this.isUpToDate = true;
12
+ this.learnersCount = 0;
13
+ this.reviewScore = 0.0;
14
+ this.isPreview = false;
15
+ this.sectionIds = [];
16
+ this.instructors = [];
17
+ this.isStepikPublic = false;
18
+ this.reviewSummary = 0;
19
+ }
20
+ get itemType() {
21
+ return this.isMarketplace ? EduFormatNames_1.MARKETPLACE : super.itemType;
22
+ }
23
+ get isStepikRemote() {
24
+ return this.id !== 0 && !this.isMarketplace;
25
+ }
26
+ get isMarketplaceRemote() {
27
+ return this.id !== 0 && this.isMarketplace;
28
+ }
29
+ convertToLocal() {
30
+ if (this.isMarketplace) {
31
+ this.marketplaceCourseVersion = 1;
32
+ }
33
+ else {
34
+ this.isStepikPublic = false;
35
+ this.sectionIds = [];
36
+ this.instructors = [];
37
+ }
38
+ this.id = 0;
39
+ this.updateDate = new Date(0);
40
+ }
41
+ }
42
+ exports.EduCourse = EduCourse;
@@ -0,0 +1,22 @@
1
+ import { FileContents } from "./FileContents";
2
+ import { EduFileErrorHighlightLevel } from "./EduFileErrorHighlightLevel";
3
+ export declare class EduFile {
4
+ name: string;
5
+ private _contents;
6
+ get text(): string;
7
+ set text(value: string);
8
+ get contents(): FileContents;
9
+ set contents(value: FileContents);
10
+ setContentsIfEquals(expectedValue: FileContents, newValue: FileContents): boolean;
11
+ get isBinary(): boolean | undefined;
12
+ isTrackChanges: boolean;
13
+ errorHighlightLevel: EduFileErrorHighlightLevel;
14
+ isVisible: boolean;
15
+ isEditable: boolean;
16
+ isPropagatable: boolean;
17
+ isLearnerCreated: boolean;
18
+ constructor(name?: string, contents?: FileContents | string);
19
+ getTextToSerialize(): string | null;
20
+ get pathInCourse(): string;
21
+ get pathInArchive(): string;
22
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EduFile = void 0;
4
+ const FileContents_1 = require("./FileContents");
5
+ const EduFileErrorHighlightLevel_1 = require("./EduFileErrorHighlightLevel");
6
+ const fileUtils_1 = require("./fileUtils");
7
+ const loggerUtils_1 = require("./loggerUtils");
8
+ class EduFile {
9
+ get text() {
10
+ return this.contents.textualRepresentation;
11
+ }
12
+ set text(value) {
13
+ this.contents = new FileContents_1.InMemoryUndeterminedContents(value);
14
+ }
15
+ get contents() {
16
+ return this._contents;
17
+ }
18
+ set contents(value) {
19
+ this._contents = value;
20
+ }
21
+ setContentsIfEquals(expectedValue, newValue) {
22
+ if (this._contents === expectedValue) {
23
+ this._contents = newValue;
24
+ return true;
25
+ }
26
+ return false;
27
+ }
28
+ get isBinary() {
29
+ if (isTextualContents(this.contents))
30
+ return false;
31
+ if (isBinaryContents(this.contents))
32
+ return true;
33
+ return undefined;
34
+ }
35
+ constructor(name, contents) {
36
+ this.name = "";
37
+ this._contents = UndeterminedContentsEmpty;
38
+ this.isTrackChanges = true;
39
+ this.errorHighlightLevel = EduFileErrorHighlightLevel_1.EduFileErrorHighlightLevel.TEMPORARY_SUPPRESSION;
40
+ this.isVisible = false;
41
+ this.isEditable = true;
42
+ this.isPropagatable = true;
43
+ this.isLearnerCreated = false;
44
+ if (name !== undefined) {
45
+ this.name = name;
46
+ }
47
+ if (contents !== undefined) {
48
+ if (typeof contents === "string") {
49
+ this.contents = new FileContents_1.InMemoryTextualContents(contents);
50
+ }
51
+ else {
52
+ this.contents = contents;
53
+ }
54
+ }
55
+ }
56
+ getTextToSerialize() {
57
+ if (!(this instanceof requireTaskFile().TaskFile) || !this.task.course.needWriteYamlText) {
58
+ return null;
59
+ }
60
+ if (isBinaryContents(this.contents))
61
+ return null;
62
+ if (isUndeterminedContents(this.contents)) {
63
+ const contentType = (0, fileUtils_1.mimeFileType)(this.name);
64
+ if (contentType && (0, fileUtils_1.isBinary)(String(contentType)))
65
+ return null;
66
+ }
67
+ const text = this.contents.textualRepresentation;
68
+ if ((0, fileUtils_1.exceedsBase64ContentLimit)(text)) {
69
+ (0, loggerUtils_1.logger)("EduFile").warn(`Base64 encoding of \`${this.name}\` file exceeds limit (${(0, fileUtils_1.getBinaryFileLimit)()}), its content isn't serialized`);
70
+ return null;
71
+ }
72
+ return text;
73
+ }
74
+ get pathInCourse() {
75
+ const pathPrefix = this instanceof requireTaskFile().TaskFile ? this.task.pathInCourse : "";
76
+ const pathInCourse = `${pathPrefix}/${this.name}`;
77
+ return pathInCourse.startsWith("/") ? pathInCourse.substring(1) : pathInCourse;
78
+ }
79
+ get pathInArchive() {
80
+ return this.pathInCourse;
81
+ }
82
+ }
83
+ exports.EduFile = EduFile;
84
+ function requireTaskFile() {
85
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
86
+ return require("./TaskFile");
87
+ }
88
+ function isTextualContents(contents) {
89
+ return contents.text !== undefined;
90
+ }
91
+ function isBinaryContents(contents) {
92
+ return contents.bytes !== undefined;
93
+ }
94
+ function isUndeterminedContents(contents) {
95
+ return contents.textualRepresentation !== undefined && !isTextualContents(contents);
96
+ }
97
+ const UndeterminedContentsEmpty = {
98
+ textualRepresentation: "",
99
+ get text() {
100
+ return this.textualRepresentation;
101
+ },
102
+ get bytes() {
103
+ try {
104
+ return Buffer.from(this.textualRepresentation, "base64");
105
+ }
106
+ catch (_a) {
107
+ return new Uint8Array();
108
+ }
109
+ },
110
+ };
@@ -0,0 +1,5 @@
1
+ export declare enum EduFileErrorHighlightLevel {
2
+ NONE = "NONE",
3
+ ALL_PROBLEMS = "ALL_PROBLEMS",
4
+ TEMPORARY_SUPPRESSION = "TEMPORARY_SUPPRESSION"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EduFileErrorHighlightLevel = void 0;
4
+ var EduFileErrorHighlightLevel;
5
+ (function (EduFileErrorHighlightLevel) {
6
+ EduFileErrorHighlightLevel["NONE"] = "NONE";
7
+ EduFileErrorHighlightLevel["ALL_PROBLEMS"] = "ALL_PROBLEMS";
8
+ EduFileErrorHighlightLevel["TEMPORARY_SUPPRESSION"] = "TEMPORARY_SUPPRESSION";
9
+ })(EduFileErrorHighlightLevel || (exports.EduFileErrorHighlightLevel = EduFileErrorHighlightLevel = {}));
@@ -0,0 +1,75 @@
1
+ export declare const EDU_PREFIX = "edu";
2
+ export declare const REST_PREFIX = "api";
3
+ export declare const CODE_ARGUMENT = "code";
4
+ export declare const MARKETPLACE = "Marketplace";
5
+ export declare const COURSE_META_FILE = "course.json";
6
+ export declare const COURSE_ICON_FILE = "courseIcon.svg";
7
+ export declare const COURSE_CONTENTS_FOLDER = "contents";
8
+ export declare const COURSE = "course";
9
+ export declare const SECTION = "section";
10
+ export declare const LESSON = "lesson";
11
+ export declare const FRAMEWORK = "framework";
12
+ export declare const TASK = "task";
13
+ export declare const ITEM = "item";
14
+ export declare const SOLUTION = "solution";
15
+ export declare const STATES_ON_CLOSE = "states_on_close";
16
+ export declare const SUBMISSIONS = "submissions";
17
+ export declare const EMAIL = "email";
18
+ export declare const NAME = "name";
19
+ export declare const URL = "url";
20
+ export declare const CORRECT = "correct";
21
+ export declare const WRONG = "wrong";
22
+ export declare const UNCHECKED = "unchecked";
23
+ export declare const TIME_LEFT = "time_left";
24
+ export declare const ID = "id";
25
+ export declare const TIME = "time";
26
+ export declare const STEP = "step";
27
+ export declare const DATASET = "dataset";
28
+ export declare const STATUS = "status";
29
+ export declare const USER = "user";
30
+ export declare const IS_MULTIPLE_CHOICE = "is_multiple_choice";
31
+ export declare const OPTIONS = "options";
32
+ export declare const PAIRS = "pairs";
33
+ export declare const ROWS = "rows";
34
+ export declare const COLUMNS = "columns";
35
+ export declare const IS_CHECKBOX = "is_checkbox";
36
+ export declare const DEFAULT_ENVIRONMENT = "";
37
+ export declare const PYCHARM = "PyCharm";
38
+ export declare const TITLE = "title";
39
+ export declare const THEORY_ID = "theory";
40
+ export declare const STEP_ID = "step";
41
+ export declare const IS_COMPLETED = "is_completed";
42
+ export declare const DESCRIPTION = "description";
43
+ export declare const IDE_FILES = "ide_files";
44
+ export declare const USE_IDE = "use_ide";
45
+ export declare const LANGUAGE = "language";
46
+ export declare const ENVIRONMENT = "environment";
47
+ export declare const IS_TEMPLATE_BASED = "is_template_based";
48
+ export declare const HYPERSKILL_PROBLEMS = "Problems";
49
+ export declare const HYPERSKILL_TOPICS = "Topics";
50
+ export declare const TOPICS = "topics";
51
+ export declare const HYPERSKILL_PROJECTS_URL = "https://hyperskill.org/projects";
52
+ export declare const HYPERSKILL = "Hyperskill";
53
+ export declare const COURSERA = "Coursera";
54
+ export declare const STEPIK = "Stepik";
55
+ export declare const ATTEMPT = "attempt";
56
+ export declare const CHECK_PROFILE = "check_profile";
57
+ export declare const JAVA = "JAVA";
58
+ export declare const KOTLIN = "kotlin";
59
+ export declare const PYTHON = "Python";
60
+ export declare const SCALA = "Scala";
61
+ export declare const JAVASCRIPT = "JavaScript";
62
+ export declare const RUST = "Rust";
63
+ export declare const SHELL = "Shell Script";
64
+ export declare const CPP = "C++";
65
+ export declare const OBJECTIVE_C = "ObjectiveC";
66
+ export declare const GO = "go";
67
+ export declare const PHP = "PHP";
68
+ export declare const CSHARP = "C#";
69
+ export declare const PYTHON_2_VERSION = "2.x";
70
+ export declare const PYTHON_3_VERSION = "3.x";
71
+ export declare const TROUBLESHOOTING_GUIDE_URL = "https://plugins.jetbrains.com/plugin/10081-jetbrains-academy/docs/troubleshooting-guide.html";
72
+ export declare const NO_TESTS_URL = "https://plugins.jetbrains.com/plugin/10081-jetbrains-academy/docs/troubleshooting-guide.html#no_tests_have_run";
73
+ export declare const FAILED_TO_CHECK_URL = "https://plugins.jetbrains.com/plugin/10081-jetbrains-academy/docs/troubleshooting-guide.html#failed_to_launch_checking";
74
+ export declare const FAILED_TO_DELETE_SUBMISSIONS = "https://plugins.jetbrains.com/plugin/10081-jetbrains-academy/docs/troubleshooting-guide.html#failed_to_delete_submissions";
75
+ export declare const LOGIN_NEEDED_MESSAGE: string;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TOPICS = exports.HYPERSKILL_TOPICS = exports.HYPERSKILL_PROBLEMS = exports.IS_TEMPLATE_BASED = exports.ENVIRONMENT = exports.LANGUAGE = exports.USE_IDE = exports.IDE_FILES = exports.DESCRIPTION = exports.IS_COMPLETED = exports.STEP_ID = exports.THEORY_ID = exports.TITLE = exports.PYCHARM = exports.DEFAULT_ENVIRONMENT = exports.IS_CHECKBOX = exports.COLUMNS = exports.ROWS = exports.PAIRS = exports.OPTIONS = exports.IS_MULTIPLE_CHOICE = exports.USER = exports.STATUS = exports.DATASET = exports.STEP = exports.TIME = exports.ID = exports.TIME_LEFT = exports.UNCHECKED = exports.WRONG = exports.CORRECT = exports.URL = exports.NAME = exports.EMAIL = exports.SUBMISSIONS = exports.STATES_ON_CLOSE = exports.SOLUTION = exports.ITEM = exports.TASK = exports.FRAMEWORK = exports.LESSON = exports.SECTION = exports.COURSE = exports.COURSE_CONTENTS_FOLDER = exports.COURSE_ICON_FILE = exports.COURSE_META_FILE = exports.MARKETPLACE = exports.CODE_ARGUMENT = exports.REST_PREFIX = exports.EDU_PREFIX = void 0;
4
+ exports.LOGIN_NEEDED_MESSAGE = exports.FAILED_TO_DELETE_SUBMISSIONS = exports.FAILED_TO_CHECK_URL = exports.NO_TESTS_URL = exports.TROUBLESHOOTING_GUIDE_URL = exports.PYTHON_3_VERSION = exports.PYTHON_2_VERSION = exports.CSHARP = exports.PHP = exports.GO = exports.OBJECTIVE_C = exports.CPP = exports.SHELL = exports.RUST = exports.JAVASCRIPT = exports.SCALA = exports.PYTHON = exports.KOTLIN = exports.JAVA = exports.CHECK_PROFILE = exports.ATTEMPT = exports.STEPIK = exports.COURSERA = exports.HYPERSKILL = exports.HYPERSKILL_PROJECTS_URL = void 0;
5
+ const uiMessages_1 = require("./uiMessages");
6
+ exports.EDU_PREFIX = "edu";
7
+ exports.REST_PREFIX = "api";
8
+ exports.CODE_ARGUMENT = "code";
9
+ exports.MARKETPLACE = "Marketplace";
10
+ exports.COURSE_META_FILE = "course.json";
11
+ exports.COURSE_ICON_FILE = "courseIcon.svg";
12
+ exports.COURSE_CONTENTS_FOLDER = "contents";
13
+ exports.COURSE = "course";
14
+ exports.SECTION = "section";
15
+ exports.LESSON = "lesson";
16
+ exports.FRAMEWORK = "framework";
17
+ exports.TASK = "task";
18
+ exports.ITEM = "item";
19
+ exports.SOLUTION = "solution";
20
+ exports.STATES_ON_CLOSE = "states_on_close";
21
+ exports.SUBMISSIONS = "submissions";
22
+ exports.EMAIL = "email";
23
+ exports.NAME = "name";
24
+ exports.URL = "url";
25
+ exports.CORRECT = "correct";
26
+ exports.WRONG = "wrong";
27
+ exports.UNCHECKED = "unchecked";
28
+ exports.TIME_LEFT = "time_left";
29
+ exports.ID = "id";
30
+ exports.TIME = "time";
31
+ exports.STEP = "step";
32
+ exports.DATASET = "dataset";
33
+ exports.STATUS = "status";
34
+ exports.USER = "user";
35
+ exports.IS_MULTIPLE_CHOICE = "is_multiple_choice";
36
+ exports.OPTIONS = "options";
37
+ exports.PAIRS = "pairs";
38
+ exports.ROWS = "rows";
39
+ exports.COLUMNS = "columns";
40
+ exports.IS_CHECKBOX = "is_checkbox";
41
+ exports.DEFAULT_ENVIRONMENT = "";
42
+ exports.PYCHARM = "PyCharm";
43
+ exports.TITLE = "title";
44
+ exports.THEORY_ID = "theory";
45
+ exports.STEP_ID = "step";
46
+ exports.IS_COMPLETED = "is_completed";
47
+ exports.DESCRIPTION = "description";
48
+ exports.IDE_FILES = "ide_files";
49
+ exports.USE_IDE = "use_ide";
50
+ exports.LANGUAGE = "language";
51
+ exports.ENVIRONMENT = "environment";
52
+ exports.IS_TEMPLATE_BASED = "is_template_based";
53
+ exports.HYPERSKILL_PROBLEMS = "Problems";
54
+ exports.HYPERSKILL_TOPICS = "Topics";
55
+ exports.TOPICS = "topics";
56
+ exports.HYPERSKILL_PROJECTS_URL = "https://hyperskill.org/projects";
57
+ exports.HYPERSKILL = "Hyperskill";
58
+ exports.COURSERA = "Coursera";
59
+ exports.STEPIK = "Stepik";
60
+ exports.ATTEMPT = "attempt";
61
+ exports.CHECK_PROFILE = "check_profile";
62
+ exports.JAVA = "JAVA";
63
+ exports.KOTLIN = "kotlin";
64
+ exports.PYTHON = "Python";
65
+ exports.SCALA = "Scala";
66
+ exports.JAVASCRIPT = "JavaScript";
67
+ exports.RUST = "Rust";
68
+ exports.SHELL = "Shell Script";
69
+ exports.CPP = "C++";
70
+ exports.OBJECTIVE_C = "ObjectiveC";
71
+ exports.GO = "go";
72
+ exports.PHP = "PHP";
73
+ exports.CSHARP = "C#";
74
+ exports.PYTHON_2_VERSION = "2.x";
75
+ exports.PYTHON_3_VERSION = "3.x";
76
+ exports.TROUBLESHOOTING_GUIDE_URL = "https://plugins.jetbrains.com/plugin/10081-jetbrains-academy/docs/troubleshooting-guide.html";
77
+ exports.NO_TESTS_URL = `${exports.TROUBLESHOOTING_GUIDE_URL}#no_tests_have_run`;
78
+ exports.FAILED_TO_CHECK_URL = `${exports.TROUBLESHOOTING_GUIDE_URL}#failed_to_launch_checking`;
79
+ exports.FAILED_TO_DELETE_SUBMISSIONS = `${exports.TROUBLESHOOTING_GUIDE_URL}#failed_to_delete_submissions`;
80
+ exports.LOGIN_NEEDED_MESSAGE = (0, uiMessages_1.message)("check.error.login.needed");
@@ -0,0 +1,28 @@
1
+ import { CheckResultDiff } from "./CheckResult";
2
+ export declare class EduTestInfo {
3
+ readonly name: string;
4
+ readonly status: number;
5
+ readonly message: string;
6
+ readonly details?: string;
7
+ readonly checkResultDiff?: CheckResultDiff;
8
+ private readonly isSuccessInternal;
9
+ constructor(name?: string, status?: number, message?: string, details?: string | null, isFinishedSuccessfully?: boolean | null, checkResultDiff?: CheckResultDiff | null);
10
+ get isSuccess(): boolean;
11
+ toString(): string;
12
+ static firstFailed(tests: EduTestInfo[]): EduTestInfo | undefined;
13
+ }
14
+ export declare namespace EduTestInfo {
15
+ enum PresentableStatus {
16
+ SKIPPED = 0,
17
+ COMPLETED = 1,
18
+ NOT_RUN = 2,
19
+ RUNNING = 3,
20
+ TERMINATED = 4,
21
+ IGNORED = 5,
22
+ FAILED = 6,
23
+ ERROR = 8
24
+ }
25
+ function get(status: number): PresentableStatus | undefined;
26
+ function getPresentableStatus(status: number): string;
27
+ function isSuccess(status: PresentableStatus): boolean;
28
+ }