@juki-team/commons 0.1.31

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 (235) hide show
  1. package/README.md +3 -0
  2. package/biome.shared.json +102 -0
  3. package/dist/constants/commons.d.ts +62 -0
  4. package/dist/constants/commons.js +658 -0
  5. package/dist/constants/company.d.ts +9 -0
  6. package/dist/constants/company.js +24 -0
  7. package/dist/constants/contest.d.ts +15 -0
  8. package/dist/constants/contest.js +29 -0
  9. package/dist/constants/course.d.ts +8 -0
  10. package/dist/constants/course.js +12 -0
  11. package/dist/constants/date.d.ts +9 -0
  12. package/dist/constants/date.js +23 -0
  13. package/dist/constants/email.d.ts +2 -0
  14. package/dist/constants/email.js +34 -0
  15. package/dist/constants/entity.d.ts +3 -0
  16. package/dist/constants/entity.js +18 -0
  17. package/dist/constants/file.d.ts +28 -0
  18. package/dist/constants/file.js +46 -0
  19. package/dist/constants/index.d.ts +18 -0
  20. package/dist/constants/index.js +18 -0
  21. package/dist/constants/judge.d.ts +37 -0
  22. package/dist/constants/judge.js +221 -0
  23. package/dist/constants/problem.d.ts +37 -0
  24. package/dist/constants/problem.js +72 -0
  25. package/dist/constants/routing.d.ts +7 -0
  26. package/dist/constants/routing.js +7 -0
  27. package/dist/constants/services.d.ts +5 -0
  28. package/dist/constants/services.js +131 -0
  29. package/dist/constants/system.d.ts +8 -0
  30. package/dist/constants/system.js +9 -0
  31. package/dist/constants/teams.d.ts +15 -0
  32. package/dist/constants/teams.js +18 -0
  33. package/dist/constants/time.d.ts +9 -0
  34. package/dist/constants/time.js +9 -0
  35. package/dist/constants/user.d.ts +10 -0
  36. package/dist/constants/user.js +35 -0
  37. package/dist/constants/websocket.d.ts +6 -0
  38. package/dist/constants/websocket.js +5 -0
  39. package/dist/constants/worksheet.d.ts +11 -0
  40. package/dist/constants/worksheet.js +66 -0
  41. package/dist/dto/class.d.ts +115 -0
  42. package/dist/dto/class.js +1 -0
  43. package/dist/dto/code.d.ts +13 -0
  44. package/dist/dto/code.js +1 -0
  45. package/dist/dto/comments.d.ts +21 -0
  46. package/dist/dto/comments.js +1 -0
  47. package/dist/dto/contest.d.ts +95 -0
  48. package/dist/dto/contest.js +7 -0
  49. package/dist/dto/course.d.ts +34 -0
  50. package/dist/dto/course.js +1 -0
  51. package/dist/dto/entity.d.ts +92 -0
  52. package/dist/dto/entity.js +5 -0
  53. package/dist/dto/excalidraw.d.ts +12 -0
  54. package/dist/dto/excalidraw.js +1 -0
  55. package/dist/dto/file.d.ts +34 -0
  56. package/dist/dto/file.js +1 -0
  57. package/dist/dto/image.d.ts +6 -0
  58. package/dist/dto/image.js +1 -0
  59. package/dist/dto/index.d.ts +24 -0
  60. package/dist/dto/index.js +24 -0
  61. package/dist/dto/judge.d.ts +16 -0
  62. package/dist/dto/judge.js +1 -0
  63. package/dist/dto/markdown.d.ts +12 -0
  64. package/dist/dto/markdown.js +1 -0
  65. package/dist/dto/mermaid.d.ts +12 -0
  66. package/dist/dto/mermaid.js +1 -0
  67. package/dist/dto/organization.d.ts +102 -0
  68. package/dist/dto/organization.js +1 -0
  69. package/dist/dto/problem.d.ts +67 -0
  70. package/dist/dto/problem.js +1 -0
  71. package/dist/dto/scoreboard.d.ts +35 -0
  72. package/dist/dto/scoreboard.js +1 -0
  73. package/dist/dto/session.d.ts +15 -0
  74. package/dist/dto/session.js +1 -0
  75. package/dist/dto/socket.d.ts +257 -0
  76. package/dist/dto/socket.js +1 -0
  77. package/dist/dto/statistics.d.ts +43 -0
  78. package/dist/dto/statistics.js +1 -0
  79. package/dist/dto/submission.d.ts +95 -0
  80. package/dist/dto/submission.js +1 -0
  81. package/dist/dto/system.d.ts +91 -0
  82. package/dist/dto/system.js +1 -0
  83. package/dist/dto/url.d.ts +8 -0
  84. package/dist/dto/url.js +1 -0
  85. package/dist/dto/user.d.ts +109 -0
  86. package/dist/dto/user.js +1 -0
  87. package/dist/dto/virtual-user.d.ts +39 -0
  88. package/dist/dto/virtual-user.js +1 -0
  89. package/dist/dto/worksheet-submissions.d.ts +64 -0
  90. package/dist/dto/worksheet-submissions.js +1 -0
  91. package/dist/dto/worksheet.d.ts +39 -0
  92. package/dist/dto/worksheet.js +1 -0
  93. package/dist/helpers/class.d.ts +4 -0
  94. package/dist/helpers/class.js +10 -0
  95. package/dist/helpers/comments.d.ts +4 -0
  96. package/dist/helpers/comments.js +4 -0
  97. package/dist/helpers/commons.d.ts +33 -0
  98. package/dist/helpers/commons.js +191 -0
  99. package/dist/helpers/contest.d.ts +5 -0
  100. package/dist/helpers/contest.js +21 -0
  101. package/dist/helpers/document.d.ts +14 -0
  102. package/dist/helpers/document.js +38 -0
  103. package/dist/helpers/file.d.ts +1 -0
  104. package/dist/helpers/file.js +4 -0
  105. package/dist/helpers/index.d.ts +14 -0
  106. package/dist/helpers/index.js +14 -0
  107. package/dist/helpers/interval.d.ts +2 -0
  108. package/dist/helpers/interval.js +22 -0
  109. package/dist/helpers/judging.d.ts +25 -0
  110. package/dist/helpers/judging.js +107 -0
  111. package/dist/helpers/object.d.ts +1 -0
  112. package/dist/helpers/object.js +32 -0
  113. package/dist/helpers/responses.d.ts +8 -0
  114. package/dist/helpers/responses.js +78 -0
  115. package/dist/helpers/socket.d.ts +45 -0
  116. package/dist/helpers/socket.js +238 -0
  117. package/dist/helpers/time.d.ts +13 -0
  118. package/dist/helpers/time.js +101 -0
  119. package/dist/helpers/user.d.ts +11 -0
  120. package/dist/helpers/user.js +14 -0
  121. package/dist/helpers/worksheet.d.ts +10 -0
  122. package/dist/helpers/worksheet.js +131 -0
  123. package/dist/index.d.ts +6 -0
  124. package/dist/index.js +6 -0
  125. package/dist/prisma/enums/AssignmentClassType.d.ts +7 -0
  126. package/dist/prisma/enums/AssignmentClassType.js +6 -0
  127. package/dist/prisma/enums/ContestEventAction.d.ts +10 -0
  128. package/dist/prisma/enums/ContestEventAction.js +9 -0
  129. package/dist/prisma/enums/ContestProblemPrerequisiteType.d.ts +5 -0
  130. package/dist/prisma/enums/ContestProblemPrerequisiteType.js +4 -0
  131. package/dist/prisma/enums/ContestRole.d.ts +11 -0
  132. package/dist/prisma/enums/ContestRole.js +10 -0
  133. package/dist/prisma/enums/ContestStatus.d.ts +6 -0
  134. package/dist/prisma/enums/ContestStatus.js +5 -0
  135. package/dist/prisma/enums/CourseRole.d.ts +12 -0
  136. package/dist/prisma/enums/CourseRole.js +11 -0
  137. package/dist/prisma/enums/EntityObjectType.d.ts +13 -0
  138. package/dist/prisma/enums/EntityObjectType.js +12 -0
  139. package/dist/prisma/enums/EntityRole.d.ts +8 -0
  140. package/dist/prisma/enums/EntityRole.js +7 -0
  141. package/dist/prisma/enums/EntitySubjectType.d.ts +7 -0
  142. package/dist/prisma/enums/EntitySubjectType.js +6 -0
  143. package/dist/prisma/enums/FileRole.d.ts +9 -0
  144. package/dist/prisma/enums/FileRole.js +8 -0
  145. package/dist/prisma/enums/FileType.d.ts +5 -0
  146. package/dist/prisma/enums/FileType.js +4 -0
  147. package/dist/prisma/enums/GroupType.d.ts +5 -0
  148. package/dist/prisma/enums/GroupType.js +4 -0
  149. package/dist/prisma/enums/JudgeType.d.ts +12 -0
  150. package/dist/prisma/enums/JudgeType.js +11 -0
  151. package/dist/prisma/enums/OrganizationPlan.d.ts +7 -0
  152. package/dist/prisma/enums/OrganizationPlan.js +6 -0
  153. package/dist/prisma/enums/ProblemRole.d.ts +11 -0
  154. package/dist/prisma/enums/ProblemRole.js +10 -0
  155. package/dist/prisma/enums/ProblemScoringMode.d.ts +6 -0
  156. package/dist/prisma/enums/ProblemScoringMode.js +5 -0
  157. package/dist/prisma/enums/ProblemType.d.ts +6 -0
  158. package/dist/prisma/enums/ProblemType.js +5 -0
  159. package/dist/prisma/enums/ProblemVerdict.d.ts +14 -0
  160. package/dist/prisma/enums/ProblemVerdict.js +13 -0
  161. package/dist/prisma/enums/ShareLinkVisibility.d.ts +5 -0
  162. package/dist/prisma/enums/ShareLinkVisibility.js +4 -0
  163. package/dist/prisma/enums/SubmissionRunStatus.d.ts +18 -0
  164. package/dist/prisma/enums/SubmissionRunStatus.js +17 -0
  165. package/dist/prisma/enums/SystemRole.d.ts +9 -0
  166. package/dist/prisma/enums/SystemRole.js +8 -0
  167. package/dist/prisma/enums/TeamRole.d.ts +9 -0
  168. package/dist/prisma/enums/TeamRole.js +8 -0
  169. package/dist/prisma/enums/TelemetryType.d.ts +9 -0
  170. package/dist/prisma/enums/TelemetryType.js +8 -0
  171. package/dist/prisma/enums/UserRole.d.ts +10 -0
  172. package/dist/prisma/enums/UserRole.js +9 -0
  173. package/dist/prisma/enums/WorkingIn.d.ts +8 -0
  174. package/dist/prisma/enums/WorkingIn.js +7 -0
  175. package/dist/prisma/enums/WorksheetContentType.d.ts +10 -0
  176. package/dist/prisma/enums/WorksheetContentType.js +9 -0
  177. package/dist/prisma/enums/index.d.ts +26 -0
  178. package/dist/prisma/enums/index.js +26 -0
  179. package/dist/prototypes/Date.d.ts +62 -0
  180. package/dist/prototypes/Date.js +218 -0
  181. package/dist/prototypes/Error.d.ts +10 -0
  182. package/dist/prototypes/Error.js +17 -0
  183. package/dist/prototypes/Number.d.ts +7 -0
  184. package/dist/prototypes/Number.js +8 -0
  185. package/dist/prototypes/index.d.ts +3 -0
  186. package/dist/prototypes/index.js +3 -0
  187. package/dist/types/account.d.ts +9 -0
  188. package/dist/types/account.js +10 -0
  189. package/dist/types/class.d.ts +67 -0
  190. package/dist/types/class.js +7 -0
  191. package/dist/types/comments.d.ts +17 -0
  192. package/dist/types/comments.js +1 -0
  193. package/dist/types/commons.d.ts +84 -0
  194. package/dist/types/commons.js +69 -0
  195. package/dist/types/company.d.ts +6 -0
  196. package/dist/types/company.js +7 -0
  197. package/dist/types/contest.d.ts +144 -0
  198. package/dist/types/contest.js +6 -0
  199. package/dist/types/course.d.ts +13 -0
  200. package/dist/types/course.js +1 -0
  201. package/dist/types/entity.d.ts +116 -0
  202. package/dist/types/entity.js +50 -0
  203. package/dist/types/excalidraw.d.ts +9 -0
  204. package/dist/types/excalidraw.js +1 -0
  205. package/dist/types/file.d.ts +22 -0
  206. package/dist/types/file.js +13 -0
  207. package/dist/types/group.d.ts +9 -0
  208. package/dist/types/group.js +1 -0
  209. package/dist/types/index.d.ts +23 -0
  210. package/dist/types/index.js +23 -0
  211. package/dist/types/judge.d.ts +46 -0
  212. package/dist/types/judge.js +17 -0
  213. package/dist/types/markdown.d.ts +8 -0
  214. package/dist/types/markdown.js +1 -0
  215. package/dist/types/mermaid.d.ts +8 -0
  216. package/dist/types/mermaid.js +1 -0
  217. package/dist/types/notification.d.ts +7 -0
  218. package/dist/types/notification.js +8 -0
  219. package/dist/types/problems.d.ts +93 -0
  220. package/dist/types/problems.js +16 -0
  221. package/dist/types/services.d.ts +214 -0
  222. package/dist/types/services.js +147 -0
  223. package/dist/types/sheet.d.ts +104 -0
  224. package/dist/types/sheet.js +16 -0
  225. package/dist/types/socket.d.ts +49 -0
  226. package/dist/types/socket.js +49 -0
  227. package/dist/types/submission.d.ts +5 -0
  228. package/dist/types/submission.js +1 -0
  229. package/dist/types/teams.d.ts +96 -0
  230. package/dist/types/teams.js +28 -0
  231. package/dist/types/users.d.ts +65 -0
  232. package/dist/types/users.js +33 -0
  233. package/dist/types/worksheet.d.ts +42 -0
  234. package/dist/types/worksheet.js +11 -0
  235. package/package.json +42 -0
@@ -0,0 +1,8 @@
1
+ export declare const WorkingIn: {
2
+ readonly NOTHING: "NOTHING";
3
+ readonly SEND_SUBMISSION: "SEND_SUBMISSION";
4
+ readonly TRACKING_SUBMISSION: "TRACKING_SUBMISSION";
5
+ readonly CRAWLING_LANGUAGES: "CRAWLING_LANGUAGES";
6
+ readonly CRAWLING_PROBLEM_DATA: "CRAWLING_PROBLEM_DATA";
7
+ };
8
+ export type WorkingIn = (typeof WorkingIn)[keyof typeof WorkingIn];
@@ -0,0 +1,7 @@
1
+ export const WorkingIn = {
2
+ NOTHING: 'NOTHING',
3
+ SEND_SUBMISSION: 'SEND_SUBMISSION',
4
+ TRACKING_SUBMISSION: 'TRACKING_SUBMISSION',
5
+ CRAWLING_LANGUAGES: 'CRAWLING_LANGUAGES',
6
+ CRAWLING_PROBLEM_DATA: 'CRAWLING_PROBLEM_DATA',
7
+ };
@@ -0,0 +1,10 @@
1
+ export declare const WorksheetContentType: {
2
+ readonly JK_MD: "JK_MD";
3
+ readonly CODE_EDITOR: "CODE_EDITOR";
4
+ readonly GRAPH: "GRAPH";
5
+ readonly QUIZ_PROBLEM: "QUIZ_PROBLEM";
6
+ readonly QUIZ_TEXT: "QUIZ_TEXT";
7
+ readonly QUIZ_OPTIONS: "QUIZ_OPTIONS";
8
+ readonly NEW_PAGE: "NEW_PAGE";
9
+ };
10
+ export type WorksheetContentType = (typeof WorksheetContentType)[keyof typeof WorksheetContentType];
@@ -0,0 +1,9 @@
1
+ export const WorksheetContentType = {
2
+ JK_MD: 'JK_MD',
3
+ CODE_EDITOR: 'CODE_EDITOR',
4
+ GRAPH: 'GRAPH',
5
+ QUIZ_PROBLEM: 'QUIZ_PROBLEM',
6
+ QUIZ_TEXT: 'QUIZ_TEXT',
7
+ QUIZ_OPTIONS: 'QUIZ_OPTIONS',
8
+ NEW_PAGE: 'NEW_PAGE',
9
+ };
@@ -0,0 +1,26 @@
1
+ export { AssignmentClassType } from './AssignmentClassType.js';
2
+ export { ContestStatus } from './ContestStatus.js';
3
+ export { ContestProblemPrerequisiteType } from './ContestProblemPrerequisiteType.js';
4
+ export { ContestEventAction } from './ContestEventAction.js';
5
+ export { EntityObjectType } from './EntityObjectType.js';
6
+ export { EntitySubjectType } from './EntitySubjectType.js';
7
+ export { EntityRole } from './EntityRole.js';
8
+ export { ShareLinkVisibility } from './ShareLinkVisibility.js';
9
+ export { FileType } from './FileType.js';
10
+ export { GroupType } from './GroupType.js';
11
+ export { JudgeType } from './JudgeType.js';
12
+ export { OrganizationPlan } from './OrganizationPlan.js';
13
+ export { ProblemType } from './ProblemType.js';
14
+ export { ProblemScoringMode } from './ProblemScoringMode.js';
15
+ export { ProblemVerdict } from './ProblemVerdict.js';
16
+ export { SubmissionRunStatus } from './SubmissionRunStatus.js';
17
+ export { TelemetryType } from './TelemetryType.js';
18
+ export { UserRole } from './UserRole.js';
19
+ export { SystemRole } from './SystemRole.js';
20
+ export { ProblemRole } from './ProblemRole.js';
21
+ export { ContestRole } from './ContestRole.js';
22
+ export { TeamRole } from './TeamRole.js';
23
+ export { CourseRole } from './CourseRole.js';
24
+ export { FileRole } from './FileRole.js';
25
+ export { WorkingIn } from './WorkingIn.js';
26
+ export { WorksheetContentType } from './WorksheetContentType.js';
@@ -0,0 +1,26 @@
1
+ export { AssignmentClassType } from './AssignmentClassType.js';
2
+ export { ContestStatus } from './ContestStatus.js';
3
+ export { ContestProblemPrerequisiteType } from './ContestProblemPrerequisiteType.js';
4
+ export { ContestEventAction } from './ContestEventAction.js';
5
+ export { EntityObjectType } from './EntityObjectType.js';
6
+ export { EntitySubjectType } from './EntitySubjectType.js';
7
+ export { EntityRole } from './EntityRole.js';
8
+ export { ShareLinkVisibility } from './ShareLinkVisibility.js';
9
+ export { FileType } from './FileType.js';
10
+ export { GroupType } from './GroupType.js';
11
+ export { JudgeType } from './JudgeType.js';
12
+ export { OrganizationPlan } from './OrganizationPlan.js';
13
+ export { ProblemType } from './ProblemType.js';
14
+ export { ProblemScoringMode } from './ProblemScoringMode.js';
15
+ export { ProblemVerdict } from './ProblemVerdict.js';
16
+ export { SubmissionRunStatus } from './SubmissionRunStatus.js';
17
+ export { TelemetryType } from './TelemetryType.js';
18
+ export { UserRole } from './UserRole.js';
19
+ export { SystemRole } from './SystemRole.js';
20
+ export { ProblemRole } from './ProblemRole.js';
21
+ export { ContestRole } from './ContestRole.js';
22
+ export { TeamRole } from './TeamRole.js';
23
+ export { CourseRole } from './CourseRole.js';
24
+ export { FileRole } from './FileRole.js';
25
+ export { WorkingIn } from './WorkingIn.js';
26
+ export { WorksheetContentType } from './WorksheetContentType.js';
@@ -0,0 +1,62 @@
1
+ declare global {
2
+ interface Date {
3
+ changeYear(year: number): Date;
4
+ changeMonth(monthIndex: number): Date;
5
+ changeDay(date: number): Date;
6
+ changeHours(hours: number): Date;
7
+ changeMinutes(minutes: number): Date;
8
+ changeSeconds(seconds: number): Date;
9
+ changeMilliseconds(milliseconds: number): Date;
10
+ decreaseYear(count?: number): Date;
11
+ increaseYear(count?: number): Date;
12
+ decreaseMonth(): Date;
13
+ increaseMonth(): Date;
14
+ decreaseDay(): Date;
15
+ increaseDay(): Date;
16
+ startOfYear(): Date;
17
+ endOfYear(): Date;
18
+ startOfMonth(): Date;
19
+ endOfMonth(): Date;
20
+ startOfWeek(): Date;
21
+ endOfWeek(): Date;
22
+ startOfDay(): Date;
23
+ endOfDay(): Date;
24
+ startOfHour(): Date;
25
+ endOfHour(): Date;
26
+ startOfMinute(): Date;
27
+ endOfMinute(): Date;
28
+ startOfSecond(): Date;
29
+ endOfSecond(): Date;
30
+ isSameYear(date: Date): boolean;
31
+ isSameMonth(date: Date): boolean;
32
+ isSameDay(date: Date): boolean;
33
+ isSameHour(date: Date): boolean;
34
+ isSameMinute(date: Date): boolean;
35
+ isSameSecond(date: Date): boolean;
36
+ isSameMillisecond(date: Date): boolean;
37
+ isToday(): boolean;
38
+ isEqual(date: Date): boolean;
39
+ isValidDate(): boolean;
40
+ isYearAfter(date: Date): boolean;
41
+ isMonthAfter(date: Date): boolean;
42
+ isDayAfter(date: Date): boolean;
43
+ isHoursAfter(date: Date): boolean;
44
+ isMinutesAfter(date: Date): boolean;
45
+ isSecondsAfter(date: Date): boolean;
46
+ isMillisecondsAfter(date: Date): boolean;
47
+ isAfter(date: Date): boolean;
48
+ isYearBefore(date: Date): boolean;
49
+ isMonthBefore(date: Date): boolean;
50
+ isDayBefore(date: Date): boolean;
51
+ isHoursBefore(date: Date): boolean;
52
+ isMinutesBefore(date: Date): boolean;
53
+ isSecondsBefore(date: Date): boolean;
54
+ isMillisecondsBefore(date: Date): boolean;
55
+ isBefore(date: Date): boolean;
56
+ isWithinInterval(props: {
57
+ start: Date;
58
+ end: Date;
59
+ }, cmp?: '[]' | '()' | '[)' | '(]'): boolean;
60
+ }
61
+ }
62
+ export {};
@@ -0,0 +1,218 @@
1
+ /* eslint-disable no-extend-native */
2
+ Date.prototype.changeYear = function (year) {
3
+ const newDate = new Date(this);
4
+ newDate.setFullYear(year);
5
+ return newDate;
6
+ };
7
+ Date.prototype.changeMonth = function (monthIndex) {
8
+ const newDate = new Date(this);
9
+ newDate.setMonth(monthIndex);
10
+ return newDate;
11
+ };
12
+ Date.prototype.changeDay = function (date) {
13
+ const newDate = new Date(this);
14
+ newDate.setDate(date);
15
+ return newDate;
16
+ };
17
+ Date.prototype.changeHours = function (hours) {
18
+ const newDate = new Date(this);
19
+ newDate.setHours(hours);
20
+ return newDate;
21
+ };
22
+ Date.prototype.changeMinutes = function (minutes) {
23
+ const newDate = new Date(this);
24
+ newDate.setMinutes(minutes);
25
+ return newDate;
26
+ };
27
+ Date.prototype.changeSeconds = function (seconds) {
28
+ const newDate = new Date(this);
29
+ newDate.setSeconds(seconds);
30
+ return newDate;
31
+ };
32
+ Date.prototype.changeMilliseconds = function (milliseconds) {
33
+ const newDate = new Date(this);
34
+ newDate.setMilliseconds(milliseconds);
35
+ return newDate;
36
+ };
37
+ Date.prototype.decreaseYear = function (count = 1) {
38
+ return this.changeYear(this.getFullYear() - count);
39
+ };
40
+ Date.prototype.increaseYear = function (count = 1) {
41
+ return this.changeYear(this.getFullYear() + count);
42
+ };
43
+ Date.prototype.decreaseMonth = function () {
44
+ const newDate = new Date(this);
45
+ newDate.setMonth(newDate.getMonth() - 1);
46
+ return newDate;
47
+ };
48
+ Date.prototype.increaseMonth = function () {
49
+ const newDate = new Date(this);
50
+ newDate.setMonth(newDate.getMonth() + 1);
51
+ return newDate;
52
+ };
53
+ Date.prototype.increaseDay = function () {
54
+ const newDate = new Date(this);
55
+ newDate.setDate(newDate.getDate() + 1);
56
+ return newDate;
57
+ };
58
+ Date.prototype.decreaseDay = function () {
59
+ const newDate = new Date(this);
60
+ newDate.setDate(newDate.getDate() - 1);
61
+ return newDate;
62
+ };
63
+ Date.prototype.startOfYear = function () {
64
+ const newDate = new Date(this);
65
+ newDate.setMonth(0);
66
+ return newDate.startOfMonth();
67
+ };
68
+ Date.prototype.endOfYear = function () {
69
+ const nextMonth = this.increaseYear().startOfYear();
70
+ return new Date(nextMonth.getTime() - 1);
71
+ };
72
+ Date.prototype.startOfMonth = function () {
73
+ const newDate = new Date(this);
74
+ newDate.setDate(1);
75
+ return newDate.startOfDay();
76
+ };
77
+ Date.prototype.endOfMonth = function () {
78
+ const nextMonth = this.increaseMonth().startOfMonth();
79
+ return new Date(nextMonth.getTime() - 1);
80
+ };
81
+ Date.prototype.startOfWeek = function () {
82
+ const newDate = new Date(this);
83
+ while (newDate.getDay()) {
84
+ newDate.setDate(newDate.getDate() - 1);
85
+ }
86
+ return newDate.startOfDay();
87
+ };
88
+ Date.prototype.endOfWeek = function () {
89
+ const newDate = new Date(this);
90
+ while (newDate.getDay() < 6) {
91
+ newDate.setDate(newDate.getDate() - 1);
92
+ }
93
+ return newDate.endOfDay();
94
+ };
95
+ Date.prototype.startOfDay = function () {
96
+ const newDate = new Date(this);
97
+ newDate.setHours(0, 0, 0, 0);
98
+ return newDate;
99
+ };
100
+ Date.prototype.endOfDay = function () {
101
+ const newDate = new Date(this);
102
+ newDate.setHours(23, 59, 59, 999);
103
+ return newDate;
104
+ };
105
+ Date.prototype.startOfHour = function () {
106
+ const newDate = new Date(this);
107
+ newDate.setMinutes(0, 0, 0);
108
+ return newDate;
109
+ };
110
+ Date.prototype.endOfHour = function () {
111
+ const newDate = new Date(this);
112
+ newDate.setMinutes(59, 59, 999);
113
+ return newDate;
114
+ };
115
+ Date.prototype.startOfMinute = function () {
116
+ const newDate = new Date(this);
117
+ newDate.setSeconds(0, 0);
118
+ return newDate;
119
+ };
120
+ Date.prototype.endOfMinute = function () {
121
+ const newDate = new Date(this);
122
+ newDate.setSeconds(59, 999);
123
+ return newDate;
124
+ };
125
+ Date.prototype.startOfSecond = function () {
126
+ const newDate = new Date(this);
127
+ newDate.setMilliseconds(0);
128
+ return newDate;
129
+ };
130
+ Date.prototype.endOfSecond = function () {
131
+ const newDate = new Date(this);
132
+ newDate.setMilliseconds(999);
133
+ return newDate;
134
+ };
135
+ Date.prototype.isToday = function () {
136
+ const today = new Date();
137
+ return this.isSameDay(today);
138
+ };
139
+ Date.prototype.isEqual = function (date) {
140
+ return this.getTime() === date.getTime();
141
+ };
142
+ Date.prototype.isSameYear = function (date) {
143
+ return this.getFullYear() === date.getFullYear();
144
+ };
145
+ Date.prototype.isSameMonth = function (date) {
146
+ return this.isSameYear(date) && this.getMonth() === date.getMonth();
147
+ };
148
+ Date.prototype.isSameDay = function (date) {
149
+ return this.isSameMonth(date) && this.getDate() === date.getDate();
150
+ };
151
+ Date.prototype.isSameHour = function (date) {
152
+ return this.isSameDay(date) && this.getHours() === date.getHours();
153
+ };
154
+ Date.prototype.isSameMinute = function (date) {
155
+ return this.isSameHour(date) && this.getMinutes() === date.getMinutes();
156
+ };
157
+ Date.prototype.isSameSecond = function (date) {
158
+ return this.isSameMinute(date) && this.getSeconds() === date.getSeconds();
159
+ };
160
+ Date.prototype.isSameMillisecond = function (date) {
161
+ return this.isEqual(date);
162
+ };
163
+ Date.prototype.isValidDate = function () {
164
+ return this instanceof Date && !Number.isNaN(this.getTime());
165
+ };
166
+ Date.prototype.isYearAfter = function (date) {
167
+ return this.getFullYear() > date.getFullYear();
168
+ };
169
+ Date.prototype.isMonthAfter = function (date) {
170
+ return this.isYearAfter(date) || (this.isSameYear(date) && this.getMonth() > date.getMonth());
171
+ };
172
+ Date.prototype.isDayAfter = function (date) {
173
+ return this.isMonthAfter(date) || (this.isSameMonth(date) && this.getDate() > date.getDate());
174
+ };
175
+ Date.prototype.isHoursAfter = function (date) {
176
+ return this.isDayAfter(date) || (this.isSameDay(date) && this.getHours() > date.getHours());
177
+ };
178
+ Date.prototype.isMinutesAfter = function (date) {
179
+ return this.isHoursAfter(date) || (this.isSameHour(date) && this.getMinutes() > date.getMinutes());
180
+ };
181
+ Date.prototype.isSecondsAfter = function (date) {
182
+ return this.isMinutesAfter(date) || (this.isSameMinute(date) && this.getSeconds() > date.getSeconds());
183
+ };
184
+ Date.prototype.isMillisecondsAfter = function (date) {
185
+ return this.isSecondsAfter(date) || (this.isSameSecond(date) && this.getMilliseconds() > date.getMilliseconds());
186
+ };
187
+ Date.prototype.isAfter = function (date) {
188
+ return this.getTime() > date.getTime();
189
+ };
190
+ Date.prototype.isYearBefore = function (date) {
191
+ return this.getFullYear() < date.getFullYear();
192
+ };
193
+ Date.prototype.isMonthBefore = function (date) {
194
+ return this.isYearBefore(date) || (this.isSameYear(date) && this.getMonth() < date.getMonth());
195
+ };
196
+ Date.prototype.isDayBefore = function (date) {
197
+ return this.isMonthBefore(date) || (this.isSameMonth(date) && this.getDate() < date.getDate());
198
+ };
199
+ Date.prototype.isHoursBefore = function (date) {
200
+ return this.isDayBefore(date) || (this.isSameDay(date) && this.getHours() < date.getHours());
201
+ };
202
+ Date.prototype.isMinutesBefore = function (date) {
203
+ return this.isHoursBefore(date) || (this.isSameHour(date) && this.getMinutes() < date.getMinutes());
204
+ };
205
+ Date.prototype.isSecondsBefore = function (date) {
206
+ return this.isMinutesBefore(date) || (this.isSameMinute(date) && this.getSeconds() < date.getSeconds());
207
+ };
208
+ Date.prototype.isMillisecondsBefore = function (date) {
209
+ return this.isSecondsBefore(date) || (this.isSameSecond(date) && this.getMilliseconds() < date.getMilliseconds());
210
+ };
211
+ Date.prototype.isBefore = function (date) {
212
+ return this.getTime() < date.getTime();
213
+ };
214
+ Date.prototype.isWithinInterval = function ({ start, end }, cmp = '[]') {
215
+ return ((cmp.charAt(0) === '[' ? this.isEqual(start) || this.isAfter(start) : this.isAfter(start)) &&
216
+ (cmp.charAt(1) === '[' ? this.isEqual(end) || this.isBefore(end) : this.isBefore(end)));
217
+ };
218
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { ErrorCode } from '../types/index.js';
2
+ export declare class JkError extends Error {
3
+ code: ErrorCode;
4
+ data: unknown;
5
+ constructor(code: ErrorCode, custom?: {
6
+ message?: string;
7
+ stack?: string;
8
+ data?: unknown;
9
+ });
10
+ }
@@ -0,0 +1,17 @@
1
+ import { getErrorMessage } from '../constants/services.js';
2
+ export class JkError extends Error {
3
+ code;
4
+ data;
5
+ constructor(code, custom) {
6
+ const message = custom?.message || getErrorMessage(code);
7
+ super(message);
8
+ this.message = message;
9
+ this.code = code;
10
+ if (custom?.stack) {
11
+ this.stack = custom.stack;
12
+ }
13
+ if (custom?.data) {
14
+ this.data = custom.data;
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ declare global {
2
+ interface Number {
3
+ padStart(maxLength: number, fillString?: string): string;
4
+ padEnd(maxLength: number, fillString?: string): string;
5
+ }
6
+ }
7
+ export {};
@@ -0,0 +1,8 @@
1
+ /* eslint-disable no-extend-native */
2
+ Number.prototype.padStart = function (maxLength, fillString = '0') {
3
+ return `${this}`.padStart(maxLength, fillString);
4
+ };
5
+ Number.prototype.padEnd = function (maxLength, fillString = '0') {
6
+ return `${this}`.padEnd(maxLength, fillString);
7
+ };
8
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './Date.js';
2
+ export * from './Error.js';
3
+ export * from './Number.js';
@@ -0,0 +1,3 @@
1
+ export * from './Date.js';
2
+ export * from './Error.js';
3
+ export * from './Number.js';
@@ -0,0 +1,9 @@
1
+ export declare enum ProfileSetting {
2
+ NEWSLETTER_SUBSCRIPTION = "newsletterSubscription",
3
+ LANGUAGE = "preferredLanguage",
4
+ THEME = "preferredTheme",
5
+ DATA_VIEW_MODE = "preferredDataViewMode",
6
+ MENU_VIEW_MODE = "preferredMenuViewMode",
7
+ TIME_ZONE = "preferredTimeZone",
8
+ FONT_SIZE = "preferredFontSize"
9
+ }
@@ -0,0 +1,10 @@
1
+ export var ProfileSetting;
2
+ (function (ProfileSetting) {
3
+ ProfileSetting["NEWSLETTER_SUBSCRIPTION"] = "newsletterSubscription";
4
+ ProfileSetting["LANGUAGE"] = "preferredLanguage";
5
+ ProfileSetting["THEME"] = "preferredTheme";
6
+ ProfileSetting["DATA_VIEW_MODE"] = "preferredDataViewMode";
7
+ ProfileSetting["MENU_VIEW_MODE"] = "preferredMenuViewMode";
8
+ ProfileSetting["TIME_ZONE"] = "preferredTimeZone";
9
+ ProfileSetting["FONT_SIZE"] = "preferredFontSize";
10
+ })(ProfileSetting || (ProfileSetting = {}));
@@ -0,0 +1,67 @@
1
+ import type { EntityMembers, EntityState } from './entity.js';
2
+ import type { BodyWorksheet } from './sheet.js';
3
+ export declare enum AssignmentClass {
4
+ NONE = "NONE",
5
+ COURSE = "COURSE",
6
+ WORKSHEET = "WORKSHEET",
7
+ CONTEST = "CONTEST"
8
+ }
9
+ export interface AssignmentBasicInfo {
10
+ id: string;
11
+ index: number;
12
+ type: AssignmentClass;
13
+ points: number;
14
+ startTimestamp: number;
15
+ endTimestamp: number;
16
+ title: string;
17
+ content: BodyWorksheet[];
18
+ tags: string[];
19
+ graded: boolean;
20
+ visible: boolean;
21
+ }
22
+ export interface ClassCycleSessionAssignment extends AssignmentBasicInfo {
23
+ entityId: string;
24
+ state: EntityState;
25
+ }
26
+ export interface ClassCycleSessionAssignments {
27
+ [key: string]: ClassCycleSessionAssignment;
28
+ }
29
+ interface ClassCycleSession {
30
+ id: string;
31
+ index: number;
32
+ name: string;
33
+ assignments: ClassCycleSessionAssignments;
34
+ startTimestamp: number;
35
+ endTimestamp: number;
36
+ state: EntityState;
37
+ }
38
+ export interface ClassCycleSessions {
39
+ [key: string]: ClassCycleSession;
40
+ }
41
+ export type ClassCycleTag = {
42
+ key: string;
43
+ name: string;
44
+ color: string;
45
+ points: number;
46
+ };
47
+ export type ClassCycle = {
48
+ id: string;
49
+ index: number;
50
+ name: string;
51
+ sessions: ClassCycleSessions;
52
+ tags: ClassCycleTag[];
53
+ startTimestamp: number;
54
+ endTimestamp: number;
55
+ state: EntityState;
56
+ };
57
+ export interface ClassCycles {
58
+ [key: string]: ClassCycle;
59
+ }
60
+ export interface ClassBaseDocument {
61
+ key: string;
62
+ name: string;
63
+ description: string;
64
+ members: EntityMembers;
65
+ cycles: ClassCycles;
66
+ }
67
+ export {};
@@ -0,0 +1,7 @@
1
+ export var AssignmentClass;
2
+ (function (AssignmentClass) {
3
+ AssignmentClass["NONE"] = "NONE";
4
+ AssignmentClass["COURSE"] = "COURSE";
5
+ AssignmentClass["WORKSHEET"] = "WORKSHEET";
6
+ AssignmentClass["CONTEST"] = "CONTEST";
7
+ })(AssignmentClass || (AssignmentClass = {}));
@@ -0,0 +1,17 @@
1
+ export type ReactionUser = {
2
+ key: string;
3
+ userId: string;
4
+ createdTimestamp: number;
5
+ updatedTimestamp: number;
6
+ };
7
+ export interface CommentBaseDocument {
8
+ key: string;
9
+ parentId: string | null;
10
+ content: string;
11
+ hidden: boolean;
12
+ reactions: {
13
+ [key: string]: {
14
+ [key: string]: ReactionUser;
15
+ };
16
+ };
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,84 @@
1
+ import type { Language } from './users.js';
2
+ export declare enum CodeLanguage {
3
+ C_11 = "c11",
4
+ CPP_11 = "cpp11",
5
+ CPP_20 = "cpp20",
6
+ JAVA_21 = "java21",
7
+ PYTHON_3 = "python3",
8
+ PYTHON_PYPY_3 = "pypy3",
9
+ JAVASCRIPT_NODE_JS_22 = "nodejs22",
10
+ PYTHON_2 = "python2",
11
+ PYTHON_PYPY_2 = "pypy2",
12
+ ICPC_C = "ICPC_C",
13
+ C = "C",
14
+ CPP = "CPP",
15
+ ICPC_CPP = "ICPC_CPP",
16
+ CPP11 = "CPP11",
17
+ CPP14 = "CPP14",
18
+ CPP17 = "CPP17",
19
+ JAVA = "JAVA",
20
+ ICPC_PYTHON = "ICPC_PYTHON",
21
+ PYTHON = "PYTHON",
22
+ PYTHON2 = "PYTHON2",
23
+ PYTHON3 = "PYTHON3",
24
+ JAVASCRIPT = "JAVASCRIPT",
25
+ TYPESCRIPT = "TYPESCRIPT",
26
+ JSX = "JSX",
27
+ TSX = "TSX",
28
+ MDX = "MDX",
29
+ PSEUDOCODE_PSEINT = "PSEUDOCODE_PSEINT",
30
+ LATEX = "LATEX",
31
+ JSON = "JSON",
32
+ HTML = "HTML",
33
+ TEXT = "TEXT",
34
+ DIFF = "DIFF",
35
+ MARKDOWN = "MARKDOWN",
36
+ ARDUINO = "ARDUINO",
37
+ DOT = "DOT",
38
+ MERMAID = "MERMAID",
39
+ BASH = "BASH"
40
+ }
41
+ export declare enum ScopeData {
42
+ USER = "USER",
43
+ PROBLEM = "PROBLEM",
44
+ CONTEST = "CONTEST",
45
+ ATTEMPT = "ATTEMPT"
46
+ }
47
+ export declare enum Status {
48
+ SUCCESS = "SUCCESS",
49
+ ERROR = "ERROR",
50
+ LOADING = "LOADING",
51
+ NONE = "NONE"
52
+ }
53
+ export declare enum EntityStatus {
54
+ PUBLIC = "PUBLIC",// Active for the users
55
+ RESERVED = "RESERVED",// On preparation
56
+ PRIVATE = "PRIVATE",
57
+ ARCHIVED = "ARCHIVED"
58
+ }
59
+ export declare enum EntityAccess {
60
+ PRIVATE = "PRIVATE",
61
+ RESTRICTED = "RESTRICTED",
62
+ PUBLIC = "PUBLIC",
63
+ EXPOSED = "EXPOSED"
64
+ }
65
+ export type TextLanguage = {
66
+ [Key in Language]: string;
67
+ };
68
+ export type SplitTime = {
69
+ remaining: number;
70
+ label: string;
71
+ milliseconds: number;
72
+ abbreviatedLabel: string;
73
+ digits: number;
74
+ };
75
+ export type RecordId = string | `${string & {
76
+ length: 24;
77
+ }}`;
78
+ export type Device = {
79
+ label: string;
80
+ isMobile: boolean;
81
+ isBrowser: boolean;
82
+ type: string;
83
+ osLabel: string;
84
+ };