@juki-team/commons 0.1.47 → 0.1.48

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 (191) hide show
  1. package/dist/{types/constants → constants}/commons.d.ts +1 -1
  2. package/dist/constants/commons.js +648 -0
  3. package/dist/{types/constants → constants}/contest.d.ts +1 -1
  4. package/dist/constants/contest.js +28 -0
  5. package/dist/{types/constants → constants}/course.d.ts +1 -1
  6. package/dist/constants/course.js +12 -0
  7. package/dist/constants/date.js +23 -0
  8. package/dist/constants/email.js +34 -0
  9. package/dist/{types/constants → constants}/entity.d.ts +1 -1
  10. package/dist/constants/entity.js +18 -0
  11. package/dist/{types/constants → constants}/file.d.ts +1 -1
  12. package/dist/constants/file.js +45 -0
  13. package/dist/constants/index.d.ts +18 -0
  14. package/dist/constants/index.js +18 -0
  15. package/dist/{types/constants → constants}/judge.d.ts +1 -1
  16. package/dist/constants/judge.js +225 -0
  17. package/dist/{types/constants → constants}/organization.d.ts +1 -1
  18. package/dist/constants/organization.js +24 -0
  19. package/dist/{types/constants → constants}/problem.d.ts +1 -1
  20. package/dist/constants/problem.js +69 -0
  21. package/dist/constants/routing.js +7 -0
  22. package/dist/{types/constants → constants}/services.d.ts +1 -1
  23. package/dist/constants/services.js +157 -0
  24. package/dist/{types/constants → constants}/system.d.ts +1 -1
  25. package/dist/constants/system.js +9 -0
  26. package/dist/{types/constants → constants}/teams.d.ts +1 -1
  27. package/dist/constants/teams.js +17 -0
  28. package/dist/constants/time.js +9 -0
  29. package/dist/{types/constants → constants}/user.d.ts +2 -2
  30. package/dist/constants/user.js +40 -0
  31. package/dist/{types/constants → constants}/websocket.d.ts +1 -1
  32. package/dist/constants/websocket.js +56 -0
  33. package/dist/{types/constants → constants}/worksheet.d.ts +1 -1
  34. package/dist/constants/worksheet.js +66 -0
  35. package/dist/{types/dto → dto}/class.d.ts +3 -3
  36. package/dist/dto/class.js +1 -0
  37. package/dist/{types/dto → dto}/code.d.ts +1 -1
  38. package/dist/dto/code.js +1 -0
  39. package/dist/{types/dto → dto}/comments.d.ts +1 -1
  40. package/dist/dto/comments.js +1 -0
  41. package/dist/{types/dto → dto}/contest.d.ts +4 -4
  42. package/dist/dto/contest.js +7 -0
  43. package/dist/{types/dto → dto}/course.d.ts +4 -4
  44. package/dist/dto/course.js +1 -0
  45. package/dist/{types/dto → dto}/entity.d.ts +2 -2
  46. package/dist/dto/entity.js +5 -0
  47. package/dist/{types/dto → dto}/excalidraw.d.ts +3 -3
  48. package/dist/dto/excalidraw.js +1 -0
  49. package/dist/{types/dto → dto}/file.d.ts +2 -2
  50. package/dist/dto/file.js +1 -0
  51. package/dist/dto/image.js +1 -0
  52. package/dist/dto/index.d.ts +25 -0
  53. package/dist/dto/index.js +25 -0
  54. package/dist/{types/dto → dto}/judge.d.ts +1 -1
  55. package/dist/dto/judge.js +1 -0
  56. package/dist/{types/dto → dto}/markdown.d.ts +3 -3
  57. package/dist/dto/markdown.js +1 -0
  58. package/dist/{types/dto → dto}/mermaid.d.ts +3 -3
  59. package/dist/dto/mermaid.js +1 -0
  60. package/dist/{types/dto → dto}/organization.d.ts +3 -3
  61. package/dist/dto/organization.js +1 -0
  62. package/dist/{types/dto → dto}/problem.d.ts +3 -3
  63. package/dist/dto/problem.js +1 -0
  64. package/dist/{types/dto → dto}/scoreboard.d.ts +2 -2
  65. package/dist/dto/scoreboard.js +1 -0
  66. package/dist/{types/dto → dto}/session.d.ts +2 -2
  67. package/dist/dto/session.js +1 -0
  68. package/dist/{types/dto → dto}/socket.d.ts +3 -3
  69. package/dist/dto/socket.js +1 -0
  70. package/dist/{types/dto → dto}/statistics.d.ts +1 -1
  71. package/dist/dto/statistics.js +1 -0
  72. package/dist/{types/dto → dto}/submission.d.ts +3 -3
  73. package/dist/dto/submission.js +1 -0
  74. package/dist/{types/dto → dto}/system.d.ts +1 -1
  75. package/dist/dto/system.js +1 -0
  76. package/dist/dto/url.js +1 -0
  77. package/dist/{types/dto → dto}/user.d.ts +3 -3
  78. package/dist/dto/user.js +1 -0
  79. package/dist/{types/dto → dto}/virtual-user.d.ts +1 -1
  80. package/dist/dto/virtual-user.js +1 -0
  81. package/dist/{types/dto → dto}/worksheet-submissions.d.ts +3 -3
  82. package/dist/dto/worksheet-submissions.js +1 -0
  83. package/dist/{types/dto → dto}/worksheet.d.ts +3 -3
  84. package/dist/dto/worksheet.js +1 -0
  85. package/dist/{types/helpers → helpers}/class.d.ts +1 -1
  86. package/dist/helpers/class.js +10 -0
  87. package/dist/helpers/comments.js +4 -0
  88. package/dist/{types/helpers → helpers}/commons.d.ts +1 -1
  89. package/dist/helpers/commons.js +187 -0
  90. package/dist/{types/helpers → helpers}/contest.d.ts +1 -1
  91. package/dist/helpers/contest.js +21 -0
  92. package/dist/helpers/date.js +181 -0
  93. package/dist/{types/helpers → helpers}/document.d.ts +2 -2
  94. package/dist/helpers/document.js +51 -0
  95. package/dist/{types/helpers → helpers}/errors.d.ts +1 -1
  96. package/dist/helpers/errors.js +17 -0
  97. package/dist/helpers/file.js +4 -0
  98. package/dist/helpers/index.d.ts +17 -0
  99. package/dist/helpers/index.js +17 -0
  100. package/dist/helpers/interval.js +24 -0
  101. package/dist/{types/helpers → helpers}/judging.d.ts +1 -1
  102. package/dist/helpers/judging.js +124 -0
  103. package/dist/helpers/number.js +2 -0
  104. package/dist/helpers/object.js +33 -0
  105. package/dist/{types/helpers → helpers}/responses.d.ts +2 -2
  106. package/dist/helpers/responses.js +95 -0
  107. package/dist/{types/helpers → helpers}/socket.d.ts +2 -2
  108. package/dist/helpers/socket.js +279 -0
  109. package/dist/{types/helpers → helpers}/time.d.ts +1 -1
  110. package/dist/helpers/time.js +69 -0
  111. package/dist/{types/helpers → helpers}/user.d.ts +1 -1
  112. package/dist/helpers/user.js +14 -0
  113. package/dist/{types/helpers → helpers}/worksheet.d.ts +1 -1
  114. package/dist/helpers/worksheet.js +107 -0
  115. package/dist/index.d.ts +4 -0
  116. package/dist/index.js +4 -0
  117. package/dist/types/account.js +10 -0
  118. package/dist/types/{types/class.d.ts → class.d.ts} +2 -2
  119. package/dist/types/class.js +7 -0
  120. package/dist/types/comments.js +1 -0
  121. package/dist/types/{types/commons.d.ts → commons.d.ts} +1 -1
  122. package/dist/types/commons.js +69 -0
  123. package/dist/types/{types/contest.d.ts → contest.d.ts} +4 -4
  124. package/dist/types/contest.js +27 -0
  125. package/dist/types/{types/course.d.ts → course.d.ts} +1 -1
  126. package/dist/types/course.js +1 -0
  127. package/dist/types/entity.js +50 -0
  128. package/dist/types/{types/excalidraw.d.ts → excalidraw.d.ts} +1 -1
  129. package/dist/types/excalidraw.js +1 -0
  130. package/dist/types/{types/file.d.ts → file.d.ts} +2 -2
  131. package/dist/types/file.js +19 -0
  132. package/dist/types/{types/group.d.ts → group.d.ts} +1 -1
  133. package/dist/types/group.js +5 -0
  134. package/dist/types/index.d.ts +27 -4
  135. package/dist/types/index.js +27 -0
  136. package/dist/types/{types/judge.d.ts → judge.d.ts} +2 -2
  137. package/dist/types/judge.js +49 -0
  138. package/dist/types/{types/markdown.d.ts → markdown.d.ts} +1 -1
  139. package/dist/types/markdown.js +1 -0
  140. package/dist/types/{types/mermaid.d.ts → mermaid.d.ts} +1 -1
  141. package/dist/types/mermaid.js +1 -0
  142. package/dist/types/notification.js +8 -0
  143. package/dist/types/organization.js +14 -0
  144. package/dist/types/{types/prisma.d.ts → prisma.d.ts} +1 -1
  145. package/dist/types/prisma.js +106 -0
  146. package/dist/types/{types/problems.d.ts → problems.d.ts} +3 -3
  147. package/dist/types/problems.js +28 -0
  148. package/dist/types/scoreboard.js +1 -0
  149. package/dist/types/{types/services.d.ts → services.d.ts} +1 -1
  150. package/dist/types/services.js +152 -0
  151. package/dist/types/{types/sheet.d.ts → sheet.d.ts} +2 -2
  152. package/dist/types/sheet.js +16 -0
  153. package/dist/types/{types/socket.d.ts → socket.d.ts} +1 -1
  154. package/dist/types/socket.js +76 -0
  155. package/dist/types/submission.js +1 -0
  156. package/dist/types/system.js +1 -0
  157. package/dist/types/{types/teams.d.ts → teams.d.ts} +2 -2
  158. package/dist/types/teams.js +1 -0
  159. package/dist/types/{types/users.d.ts → users.d.ts} +2 -2
  160. package/dist/types/users.js +23 -0
  161. package/dist/types/virtual-user.js +8 -0
  162. package/dist/types/{types/worksheet.d.ts → worksheet.d.ts} +3 -3
  163. package/dist/types/worksheet.js +11 -0
  164. package/package.json +8 -11
  165. package/dist/cjs/index.cjs +0 -3700
  166. package/dist/esm/index.js +0 -3420
  167. package/dist/types/constants/index.d.ts +0 -18
  168. package/dist/types/dto/index.d.ts +0 -25
  169. package/dist/types/helpers/index.d.ts +0 -17
  170. package/dist/types/types/index.d.ts +0 -27
  171. /package/dist/{types/constants → constants}/date.d.ts +0 -0
  172. /package/dist/{types/constants → constants}/email.d.ts +0 -0
  173. /package/dist/{types/constants → constants}/routing.d.ts +0 -0
  174. /package/dist/{types/constants → constants}/time.d.ts +0 -0
  175. /package/dist/{types/dto → dto}/image.d.ts +0 -0
  176. /package/dist/{types/dto → dto}/url.d.ts +0 -0
  177. /package/dist/{types/helpers → helpers}/comments.d.ts +0 -0
  178. /package/dist/{types/helpers → helpers}/date.d.ts +0 -0
  179. /package/dist/{types/helpers → helpers}/file.d.ts +0 -0
  180. /package/dist/{types/helpers → helpers}/interval.d.ts +0 -0
  181. /package/dist/{types/helpers → helpers}/number.d.ts +0 -0
  182. /package/dist/{types/helpers → helpers}/object.d.ts +0 -0
  183. /package/dist/types/{types/account.d.ts → account.d.ts} +0 -0
  184. /package/dist/types/{types/comments.d.ts → comments.d.ts} +0 -0
  185. /package/dist/types/{types/entity.d.ts → entity.d.ts} +0 -0
  186. /package/dist/types/{types/notification.d.ts → notification.d.ts} +0 -0
  187. /package/dist/types/{types/organization.d.ts → organization.d.ts} +0 -0
  188. /package/dist/types/{types/scoreboard.d.ts → scoreboard.d.ts} +0 -0
  189. /package/dist/types/{types/submission.d.ts → submission.d.ts} +0 -0
  190. /package/dist/types/{types/system.d.ts → system.d.ts} +0 -0
  191. /package/dist/types/{types/virtual-user.d.ts → virtual-user.d.ts} +0 -0
@@ -1,3700 +0,0 @@
1
- 'use strict';
2
-
3
- var uuid = require('uuid');
4
-
5
- exports.ProfileSetting = void 0;
6
- (function (ProfileSetting) {
7
- ProfileSetting["NEWSLETTER_SUBSCRIPTION"] = "newsletterSubscription";
8
- ProfileSetting["LANGUAGE"] = "preferredLanguage";
9
- ProfileSetting["THEME"] = "preferredTheme";
10
- ProfileSetting["DATA_VIEW_MODE"] = "preferredDataViewMode";
11
- ProfileSetting["MENU_VIEW_MODE"] = "preferredMenuViewMode";
12
- ProfileSetting["TIME_ZONE"] = "preferredTimeZone";
13
- ProfileSetting["FONT_SIZE"] = "preferredFontSize";
14
- })(exports.ProfileSetting || (exports.ProfileSetting = {}));
15
-
16
- exports.AssignmentClass = void 0;
17
- (function (AssignmentClass) {
18
- AssignmentClass["NONE"] = "NONE";
19
- AssignmentClass["COURSE"] = "COURSE";
20
- AssignmentClass["WORKSHEET"] = "WORKSHEET";
21
- AssignmentClass["CONTEST"] = "CONTEST";
22
- })(exports.AssignmentClass || (exports.AssignmentClass = {}));
23
-
24
- exports.CodeLanguage = void 0;
25
- (function (CodeLanguage) {
26
- CodeLanguage["C_11"] = "c11";
27
- CodeLanguage["CPP_11"] = "cpp11";
28
- CodeLanguage["CPP_20"] = "cpp20";
29
- CodeLanguage["JAVA_21"] = "java21";
30
- CodeLanguage["PYTHON_3"] = "python3";
31
- CodeLanguage["PYTHON_PYPY_3"] = "pypy3";
32
- CodeLanguage["JAVASCRIPT_NODE_JS_22"] = "nodejs22";
33
- // DEPRECATED
34
- CodeLanguage["PYTHON_2"] = "python2";
35
- CodeLanguage["PYTHON_PYPY_2"] = "pypy2";
36
- CodeLanguage["ICPC_C"] = "ICPC_C";
37
- CodeLanguage["C"] = "C";
38
- CodeLanguage["CPP"] = "CPP";
39
- CodeLanguage["ICPC_CPP"] = "ICPC_CPP";
40
- CodeLanguage["CPP11"] = "CPP11";
41
- CodeLanguage["CPP14"] = "CPP14";
42
- CodeLanguage["CPP17"] = "CPP17";
43
- CodeLanguage["JAVA"] = "JAVA";
44
- CodeLanguage["ICPC_PYTHON"] = "ICPC_PYTHON";
45
- CodeLanguage["PYTHON"] = "PYTHON";
46
- CodeLanguage["PYTHON2"] = "PYTHON2";
47
- CodeLanguage["PYTHON3"] = "PYTHON3";
48
- CodeLanguage["JAVASCRIPT"] = "JAVASCRIPT";
49
- CodeLanguage["TYPESCRIPT"] = "TYPESCRIPT";
50
- CodeLanguage["JSX"] = "JSX";
51
- CodeLanguage["TSX"] = "TSX";
52
- CodeLanguage["MDX"] = "MDX";
53
- CodeLanguage["PSEUDOCODE_PSEINT"] = "PSEUDOCODE_PSEINT";
54
- CodeLanguage["LATEX"] = "LATEX";
55
- CodeLanguage["JSON"] = "JSON";
56
- CodeLanguage["HTML"] = "HTML";
57
- CodeLanguage["TEXT"] = "TEXT";
58
- CodeLanguage["DIFF"] = "DIFF";
59
- CodeLanguage["MARKDOWN"] = "MARKDOWN";
60
- CodeLanguage["ARDUINO"] = "ARDUINO";
61
- CodeLanguage["DOT"] = "DOT";
62
- CodeLanguage["MERMAID"] = "MERMAID";
63
- CodeLanguage["BASH"] = "BASH";
64
- })(exports.CodeLanguage || (exports.CodeLanguage = {}));
65
- exports.ScopeData = void 0;
66
- (function (ScopeData) {
67
- ScopeData["USER"] = "USER";
68
- ScopeData["PROBLEM"] = "PROBLEM";
69
- ScopeData["CONTEST"] = "CONTEST";
70
- ScopeData["ATTEMPT"] = "ATTEMPT";
71
- })(exports.ScopeData || (exports.ScopeData = {}));
72
- exports.Status = void 0;
73
- (function (Status) {
74
- Status["SUCCESS"] = "SUCCESS";
75
- Status["ERROR"] = "ERROR";
76
- Status["LOADING"] = "LOADING";
77
- Status["NONE"] = "NONE";
78
- })(exports.Status || (exports.Status = {}));
79
- exports.EntityStatus = void 0;
80
- (function (EntityStatus) {
81
- EntityStatus["PUBLIC"] = "PUBLIC";
82
- EntityStatus["RESERVED"] = "RESERVED";
83
- EntityStatus["PRIVATE"] = "PRIVATE";
84
- EntityStatus["ARCHIVED"] = "ARCHIVED";
85
- })(exports.EntityStatus || (exports.EntityStatus = {}));
86
- exports.EntityAccess = void 0;
87
- (function (EntityAccess) {
88
- EntityAccess["PRIVATE"] = "PRIVATE";
89
- EntityAccess["RESTRICTED"] = "RESTRICTED";
90
- EntityAccess["PUBLIC"] = "PUBLIC";
91
- EntityAccess["EXPOSED"] = "EXPOSED";
92
- })(exports.EntityAccess || (exports.EntityAccess = {}));
93
-
94
- exports.OrganizationPlan = void 0;
95
- (function (OrganizationPlan) {
96
- OrganizationPlan["FREE"] = "FREE";
97
- OrganizationPlan["STANDARD"] = "STANDARD";
98
- OrganizationPlan["PREMIUM"] = "PREMIUM";
99
- OrganizationPlan["CUSTOM"] = "CUSTOM";
100
- })(exports.OrganizationPlan || (exports.OrganizationPlan = {}));
101
- exports.OrganizationLogoType = void 0;
102
- (function (OrganizationLogoType) {
103
- OrganizationLogoType["HORIZONTAL_WHITE"] = "horizontal-white";
104
- OrganizationLogoType["HORIZONTAL_COLOR"] = "horizontal-color";
105
- OrganizationLogoType["VERTICAL_WHITE"] = "vertical-white";
106
- OrganizationLogoType["VERTICAL_COLOR"] = "vertical-color";
107
- })(exports.OrganizationLogoType || (exports.OrganizationLogoType = {}));
108
-
109
- exports.ContestStatus = void 0;
110
- (function (ContestStatus) {
111
- ContestStatus["PUBLIC"] = "PUBLIC";
112
- ContestStatus["RESERVED"] = "RESERVED";
113
- ContestStatus["ARCHIVED"] = "ARCHIVED";
114
- })(exports.ContestStatus || (exports.ContestStatus = {}));
115
- exports.ContestTimeStatus = void 0;
116
- (function (ContestTimeStatus) {
117
- ContestTimeStatus["UPCOMING"] = "upcoming";
118
- ContestTimeStatus["LIVE"] = "live";
119
- ContestTimeStatus["PAST"] = "past";
120
- })(exports.ContestTimeStatus || (exports.ContestTimeStatus = {}));
121
- exports.ContestProblemPrerequisiteType = void 0;
122
- (function (ContestProblemPrerequisiteType) {
123
- ContestProblemPrerequisiteType["INDIVIDUALLY"] = "INDIVIDUALLY";
124
- ContestProblemPrerequisiteType["CONTEST"] = "CONTEST";
125
- })(exports.ContestProblemPrerequisiteType || (exports.ContestProblemPrerequisiteType = {}));
126
- exports.ContestEventAction = void 0;
127
- (function (ContestEventAction) {
128
- ContestEventAction["DATA_UPDATE"] = "DATA_UPDATE";
129
- ContestEventAction["SCOREBOARD_RECALCULATE"] = "SCOREBOARD_RECALCULATE";
130
- ContestEventAction["SCOREBOARD_UNLOCK"] = "SCOREBOARD_UNLOCK";
131
- ContestEventAction["SCOREBOARD_LOCK"] = "SCOREBOARD_LOCK";
132
- ContestEventAction["ENABLE_UPSOLVING"] = "ENABLE_UPSOLVING";
133
- ContestEventAction["DISABLE_UPSOLVING"] = "DISABLE_UPSOLVING";
134
- ContestEventAction["PARTICIPANT_JOIN"] = "PARTICIPANT_JOIN";
135
- })(exports.ContestEventAction || (exports.ContestEventAction = {}));
136
-
137
- exports.EntityMembersRank = void 0;
138
- (function (EntityMembersRank) {
139
- EntityMembersRank["NONE"] = "NONE";
140
- EntityMembersRank["CLOSE"] = "CLOSE";
141
- EntityMembersRank["OPEN"] = "OPEN";
142
- })(exports.EntityMembersRank || (exports.EntityMembersRank = {}));
143
- exports.EntityState = void 0;
144
- (function (EntityState) {
145
- EntityState["RELEASED"] = "RELEASED";
146
- EntityState["ARCHIVED"] = "ARCHIVED";
147
- })(exports.EntityState || (exports.EntityState = {}));
148
- exports.EntityCollection = void 0;
149
- (function (EntityCollection) {
150
- EntityCollection["ORGANIZATION"] = "ORGANIZATION";
151
- EntityCollection["PROBLEM"] = "PROBLEM";
152
- EntityCollection["CONTEST"] = "CONTEST";
153
- EntityCollection["JUDGE"] = "JUDGE";
154
- EntityCollection["USER"] = "USER";
155
- EntityCollection["SUBMISSION"] = "SUBMISSION";
156
- })(exports.EntityCollection || (exports.EntityCollection = {}));
157
- exports.CollectionKey = void 0;
158
- (function (CollectionKey) {
159
- CollectionKey["ORGANIZATION"] = "C";
160
- CollectionKey["USER"] = "U";
161
- CollectionKey["PROBLEM"] = "P";
162
- CollectionKey["CLASS"] = "K";
163
- CollectionKey["CLASS_ASSIGNMENT"] = "KA";
164
- CollectionKey["CONTEST"] = "T";
165
- CollectionKey["SCOREBOARD"] = "B";
166
- CollectionKey["SCOREBOARD_EVENTS"] = "BE";
167
- CollectionKey["COURSE"] = "R";
168
- CollectionKey["FILE"] = "F";
169
- CollectionKey["GROUP"] = "G";
170
- CollectionKey["JUDGE"] = "J";
171
- CollectionKey["WORKSHEET"] = "W";
172
- CollectionKey["WORKSHEET_SUBMISSIONS"] = "WS";
173
- CollectionKey["SUBMIT"] = "S";
174
- CollectionKey["LOCALE"] = "L";
175
- CollectionKey["COMMENT"] = "M";
176
- CollectionKey["EXCALIDRAW"] = "E";
177
- CollectionKey["MARKDOWN"] = "MD";
178
- CollectionKey["DOCUMENT_TEMPLATE"] = "DT";
179
- CollectionKey["MERMAID"] = "MM";
180
- })(exports.CollectionKey || (exports.CollectionKey = {}));
181
- exports.LogOperation = void 0;
182
- (function (LogOperation) {
183
- LogOperation["REMOVE"] = "REMOVE";
184
- LogOperation["ADD"] = "ADD";
185
- LogOperation["UPDATE"] = "UPDATE";
186
- })(exports.LogOperation || (exports.LogOperation = {}));
187
-
188
- exports.FileMemberRole = void 0;
189
- (function (FileMemberRole) {
190
- FileMemberRole["VIEWER"] = "VIEWER";
191
- FileMemberRole["EDITOR"] = "EDITOR";
192
- })(exports.FileMemberRole || (exports.FileMemberRole = {}));
193
- exports.FileType = void 0;
194
- (function (FileType) {
195
- FileType["FOLDER"] = "FOLDER";
196
- FileType["FILE"] = "FILE";
197
- })(exports.FileType || (exports.FileType = {}));
198
- exports.FilesJukiPub = void 0;
199
- (function (FilesJukiPub) {
200
- FilesJukiPub["SHARED"] = "shared";
201
- FilesJukiPub["SHARED_EXCALIDRAW"] = "shared/E";
202
- FilesJukiPub["TEMP"] = "temp";
203
- FilesJukiPub["PROBLEMS"] = "problems";
204
- FilesJukiPub["CONTESTS"] = "contests";
205
- })(exports.FilesJukiPub || (exports.FilesJukiPub = {}));
206
-
207
- exports.GroupType = void 0;
208
- (function (GroupType) {
209
- GroupType["CLASS"] = "CLASS";
210
- GroupType["TEAM"] = "TEAM";
211
- })(exports.GroupType || (exports.GroupType = {}));
212
-
213
- exports.Judge = void 0;
214
- (function (Judge) {
215
- Judge["JUKI_JUDGE"] = "JUKI_JUDGE";
216
- Judge["CODEFORCES"] = "CODEFORCES";
217
- Judge["CODEFORCES_GYM"] = "CODEFORCES_GYM";
218
- Judge["JV_UMSA"] = "JV_UMSA";
219
- Judge["UVA_ONLINE_JUDGE"] = "UVA_ONLINE_JUDGE";
220
- Judge["AT_CODER"] = "AT_CODER";
221
- Judge["CODECHEF"] = "CODECHEF";
222
- Judge["TOPCODER"] = "TOPCODER";
223
- Judge["LEETCODE"] = "LEETCODE";
224
- })(exports.Judge || (exports.Judge = {}));
225
- exports.ProblemVerdict = void 0;
226
- (function (ProblemVerdict) {
227
- ProblemVerdict["NONE"] = "NONE";
228
- ProblemVerdict["PENDING"] = "PENDING";
229
- ProblemVerdict["HIDDEN"] = "HIDDEN";
230
- ProblemVerdict["CE"] = "CE";
231
- ProblemVerdict["RE"] = "RE";
232
- ProblemVerdict["TLE"] = "TLE";
233
- ProblemVerdict["MLE"] = "MLE";
234
- ProblemVerdict["WA"] = "WA";
235
- ProblemVerdict["PE"] = "PE";
236
- ProblemVerdict["PA"] = "PA";
237
- ProblemVerdict["AC"] = "AC";
238
- })(exports.ProblemVerdict || (exports.ProblemVerdict = {}));
239
- exports.SubmissionRunStatus = void 0;
240
- (function (SubmissionRunStatus) {
241
- SubmissionRunStatus["NONE"] = "NONE";
242
- SubmissionRunStatus["RECEIVED"] = "RECEIVED";
243
- SubmissionRunStatus["COMPILING"] = "COMPILING";
244
- SubmissionRunStatus["COMPILED"] = "COMPILED";
245
- SubmissionRunStatus["COMPILATION_ERROR"] = "COMPILATION_ERROR";
246
- SubmissionRunStatus["FETCHING_TEST_CASES"] = "FETCHING_TEST_CASES";
247
- SubmissionRunStatus["RUNNING_TEST_CASE"] = "RUNNING_TEST_CASE";
248
- SubmissionRunStatus["RUNNING_TEST_CASES"] = "RUNNING_TEST_CASES";
249
- SubmissionRunStatus["RUNNING_SAMPLE_TEST_CASES"] = "RUNNING_SAMPLE_TEST_CASES";
250
- SubmissionRunStatus["EXECUTED_TEST_CASE"] = "EXECUTED_TEST_CASE";
251
- SubmissionRunStatus["FAILED_TEST_CASE"] = "FAILED_TEST_CASE";
252
- SubmissionRunStatus["JUDGING_TEST_CASE"] = "JUDGING_TEST_CASE";
253
- SubmissionRunStatus["GRADING"] = "GRADING";
254
- SubmissionRunStatus["FAILED"] = "FAILED";
255
- SubmissionRunStatus["COMPLETED"] = "COMPLETED";
256
- })(exports.SubmissionRunStatus || (exports.SubmissionRunStatus = {}));
257
- exports.RunnerType = void 0;
258
- (function (RunnerType) {
259
- RunnerType["HIGH_PERFORMANCE"] = "HIGH_PERFORMANCE";
260
- RunnerType["LOW_PERFORMANCE"] = "LOW_PERFORMANCE";
261
- })(exports.RunnerType || (exports.RunnerType = {}));
262
-
263
- exports.NotificationType = void 0;
264
- (function (NotificationType) {
265
- NotificationType["SUCCESS"] = "success";
266
- NotificationType["INFO"] = "info";
267
- NotificationType["WARNING"] = "warning";
268
- NotificationType["ERROR"] = "error";
269
- NotificationType["QUIET"] = "quiet";
270
- })(exports.NotificationType || (exports.NotificationType = {}));
271
-
272
- /**
273
- * Enums
274
- */
275
- // Based on
276
- // https://github.com/microsoft/TypeScript/issues/3192#issuecomment-261720275
277
- const CourseStatus = {
278
- RELEASED: 'RELEASED',
279
- IN_DRAFT: 'IN_DRAFT',
280
- IN_REVIEW: 'IN_REVIEW',
281
- ARCHIVED: 'ARCHIVED',
282
- };
283
- const CourseType = {
284
- PUBLIC: 'PUBLIC',
285
- PRIVATE: 'PRIVATE',
286
- CLOSED: 'CLOSED',
287
- };
288
- const AssignmentType = {
289
- READING_PDF: 'READING_PDF',
290
- READING_WEB: 'READING_WEB',
291
- SOLVE_JUKI_JUDGE_PROBLEM: 'SOLVE_JUKI_JUDGE_PROBLEM',
292
- SOLVE_CODEFORCES_JUDGE_PROBLEM: 'SOLVE_CODEFORCES_JUDGE_PROBLEM',
293
- };
294
- const AssignmentState = {
295
- ASSIGNED: 'ASSIGNED',
296
- IN_PROGRESS: 'IN_PROGRESS',
297
- TO_REVIEW: 'TO_REVIEW',
298
- RESOLVED: 'RESOLVED',
299
- };
300
- const TeamStatus = {
301
- ACTIVE: 'ACTIVE',
302
- REPORTED: 'REPORTED',
303
- ARCHIVED: 'ARCHIVED',
304
- };
305
- const MemberRole = {
306
- COACH: 'COACH',
307
- CO_COACH: 'CO_COACH',
308
- CONTESTANT: 'CONTESTANT',
309
- ATTENDEE: 'ATTENDEE',
310
- RESERVE: 'RESERVE',
311
- STAFF: 'STAFF',
312
- };
313
- const UserTeamStatus = {
314
- PENDING: 'PENDING',
315
- ACCEPTED: 'ACCEPTED',
316
- REJECTED: 'REJECTED',
317
- };
318
- const Language = {
319
- ES: 'ES',
320
- EN: 'EN',
321
- };
322
- const Theme = {
323
- LIGHT: 'LIGHT',
324
- DARK: 'DARK',
325
- };
326
- const EmailSubscription = {
327
- NONE: 'NONE',
328
- RANKED_CONTESTS: 'RANKED_CONTESTS',
329
- WEEKLY_NEWS_SUBSCRIPTION: 'WEEKLY_NEWS_SUBSCRIPTION',
330
- MONTHLY_NEWS_SUBSCRIPTION: 'MONTHLY_NEWS_SUBSCRIPTION',
331
- };
332
- const EmailValidationState = {
333
- PENDING: 'PENDING',
334
- VALIDATED: 'VALIDATED',
335
- };
336
- const UserStatus = {
337
- ACTIVE: 'ACTIVE',
338
- REPORTED: 'REPORTED',
339
- ARCHIVED: 'ARCHIVED',
340
- };
341
- const UserRole = {
342
- RESTRICTED: 'RESTRICTED',
343
- GUEST: 'GUEST',
344
- LIMITED: 'LIMITED',
345
- REGULAR: 'REGULAR',
346
- MANAGER: 'MANAGER',
347
- ADMIN: 'ADMIN',
348
- SUPER_ADMIN: 'SUPER_ADMIN',
349
- };
350
- const SystemRole = {
351
- GUEST: 'GUEST',
352
- REGULAR: 'REGULAR',
353
- MANAGER: 'MANAGER',
354
- MASTER: 'MASTER',
355
- ADMIN: 'ADMIN',
356
- SUPER_ADMIN: 'SUPER_ADMIN',
357
- };
358
- const TeamRole = {
359
- RESTRICTED: 'RESTRICTED',
360
- GUEST: 'GUEST',
361
- REGULAR: 'REGULAR',
362
- MANAGER: 'MANAGER',
363
- ADMIN: 'ADMIN',
364
- SUPER_ADMIN: 'SUPER_ADMIN',
365
- };
366
- const CourseRole = {
367
- RESTRICTED: 'RESTRICTED',
368
- GUEST: 'GUEST',
369
- REGULAR: 'REGULAR',
370
- CREATOR: 'CREATOR',
371
- SUPER_CREATOR: 'SUPER_CREATOR',
372
- MANAGER: 'MANAGER',
373
- MASTER: 'MASTER',
374
- ADMIN: 'ADMIN',
375
- SUPER_ADMIN: 'SUPER_ADMIN',
376
- };
377
-
378
- exports.TypeTestCase = void 0;
379
- (function (TypeTestCase) {
380
- TypeTestCase["INPUT"] = "INPUT";
381
- TypeTestCase["OUTPUT"] = "OUTPUT";
382
- })(exports.TypeTestCase || (exports.TypeTestCase = {}));
383
- exports.ProblemInput = void 0;
384
- (function (ProblemInput) {
385
- ProblemInput["STANDARD"] = "STANDARD";
386
- ProblemInput["INTERACTIVE"] = "INTERACTIVE";
387
- })(exports.ProblemInput || (exports.ProblemInput = {}));
388
- exports.ProblemOutput = void 0;
389
- (function (ProblemOutput) {
390
- ProblemOutput["STANDARD"] = "STANDARD";
391
- ProblemOutput["DYNAMIC"] = "DYNAMIC";
392
- ProblemOutput["INTERACTIVE"] = "INTERACTIVE";
393
- })(exports.ProblemOutput || (exports.ProblemOutput = {}));
394
- exports.ProblemType = void 0;
395
- (function (ProblemType) {
396
- ProblemType["STANDARD"] = "STANDARD";
397
- ProblemType["DYNAMIC"] = "DYNAMIC";
398
- ProblemType["INTERACTIVE"] = "INTERACTIVE";
399
- })(exports.ProblemType || (exports.ProblemType = {}));
400
- exports.ProblemScoringMode = void 0;
401
- (function (ProblemScoringMode) {
402
- ProblemScoringMode["SUBTASK"] = "SUBTASK";
403
- ProblemScoringMode["TOTAL"] = "TOTAL";
404
- ProblemScoringMode["PARTIAL"] = "PARTIAL";
405
- })(exports.ProblemScoringMode || (exports.ProblemScoringMode = {}));
406
-
407
- exports.ErrorCode = void 0;
408
- (function (ErrorCode) {
409
- // General errors
410
- ErrorCode["ERR400"] = "ERR400";
411
- ErrorCode["ERR401"] = "ERR401";
412
- ErrorCode["ERR403"] = "ERR403";
413
- ErrorCode["ERR404"] = "ERR404";
414
- ErrorCode["ERR405"] = "ERR405";
415
- ErrorCode["ERR500"] = "ERR500";
416
- // UI general errors
417
- ErrorCode["ERR9997"] = "ERR9997";
418
- ErrorCode["ERR9998"] = "ERR9998";
419
- ErrorCode["ERR9999"] = "ERR9999";
420
- // User errors // 'unable update nickname yet', 'User not active'
421
- ErrorCode["ERR0000"] = "ERR0000";
422
- ErrorCode["ERR0010"] = "ERR0010";
423
- ErrorCode["ERR0011"] = "ERR0011";
424
- ErrorCode["ERR0012"] = "ERR0012";
425
- ErrorCode["ERR0013"] = "ERR0013";
426
- ErrorCode["ERR0014"] = "ERR0014";
427
- ErrorCode["ERR0015"] = "ERR0015";
428
- ErrorCode["ERR0016"] = "ERR0016";
429
- ErrorCode["ERR0017"] = "ERR0017";
430
- ErrorCode["ERR0018"] = "ERR0018";
431
- ErrorCode["ERR0019"] = "ERR0019";
432
- ErrorCode["ERR0020"] = "ERR0020";
433
- ErrorCode["ERR0021"] = "ERR0021";
434
- ErrorCode["ERR0022"] = "ERR0022";
435
- ErrorCode["ERR0023"] = "ERR0023";
436
- ErrorCode["ERR0024"] = "ERR0024";
437
- ErrorCode["ERR0050"] = "ERR0050";
438
- ErrorCode["ERR0051"] = "ERR0051";
439
- ErrorCode["ERR0052"] = "ERR0052";
440
- ErrorCode["ERR0053"] = "ERR0053";
441
- // Problem Errors ERR01XX',
442
- ErrorCode["ERR0100"] = "ERR0100";
443
- ErrorCode["ERR0110"] = "ERR0110";
444
- ErrorCode["ERR0111"] = "ERR0111";
445
- ErrorCode["ERR0112"] = " ERR0112";
446
- ErrorCode["ERR0113"] = "ERR0113";
447
- ErrorCode["ERR0114"] = "ERR0114";
448
- ErrorCode["ERR0115"] = "ERR0115";
449
- ErrorCode["ERR0116"] = "ERR0116";
450
- ErrorCode["ERR0117"] = "ERR0117";
451
- ErrorCode["ERR0118"] = "ERR0118";
452
- ErrorCode["ERR0119"] = "ERR0119";
453
- ErrorCode["ERR0120"] = "ERR0120";
454
- ErrorCode["ERR0121"] = "ERR0121";
455
- ErrorCode["ERR0122"] = "ERR0122";
456
- // Contest Errors ERR02XX',
457
- ErrorCode["ERR0200"] = "ERR0200";
458
- // CRUD contest
459
- ErrorCode["ERR0210"] = "ERR0210";
460
- ErrorCode["ERR0211"] = "ERR0211";
461
- ErrorCode["ERR0212"] = "ERR0212";
462
- ErrorCode["ERR0213"] = "ERR0213";
463
- // permissions contest
464
- ErrorCode["ERR0214"] = "ERR0214";
465
- ErrorCode["ERR0215"] = "ERR0215";
466
- ErrorCode["ERR0216"] = "ERR0216";
467
- ErrorCode["ERR0217"] = "ERR0217";
468
- ErrorCode["ERR0218"] = "ERR0218";
469
- ErrorCode["ERR0219"] = "ERR0219";
470
- ErrorCode["ERR0220"] = "ERR0220";
471
- // CRUD scoreboard
472
- ErrorCode["ERR0230"] = "ERR0230";
473
- ErrorCode["ERR0231"] = "ERR0231";
474
- ErrorCode["ERR0232"] = "ERR0232";
475
- ErrorCode["ERR0233"] = "ERR0233";
476
- // permissions scoreboard
477
- ErrorCode["ERR0234"] = "ERR0234";
478
- ErrorCode["ERR0235"] = "ERR0235";
479
- ErrorCode["ERR0236"] = "ERR0236";
480
- ErrorCode["ERR0237"] = "ERR0237";
481
- ErrorCode["ERR0240"] = "ERR0240";
482
- ErrorCode["ERR0241"] = "ERR0241";
483
- ErrorCode["ERR0242"] = "ERR0242";
484
- ErrorCode["ERR0243"] = "ERR0243";
485
- ErrorCode["ERR0244"] = "ERR0244";
486
- ErrorCode["ERR0245"] = "ERR0245";
487
- ErrorCode["ERR0246"] = "ERR0246";
488
- ErrorCode["ERR0247"] = "ERR0247";
489
- // Submission Errors ERR03XXX',
490
- ErrorCode["ERR0300"] = "ERR0300";
491
- ErrorCode["ERR0301"] = "ERR0301";
492
- ErrorCode["ERR0302"] = "ERR0302";
493
- ErrorCode["ERR0303"] = "ERR0303";
494
- ErrorCode["ERR0310"] = "ERR0310";
495
- ErrorCode["ERR0311"] = "ERR0311";
496
- ErrorCode["ERR0321"] = "ERR0321";
497
- ErrorCode["ERR0331"] = "ERR0331";
498
- // Utils Errors ERR04XX
499
- ErrorCode["ERR0400"] = "ERR0400";
500
- ErrorCode["ERR0410"] = "ERR0410";
501
- ErrorCode["ERR0420"] = "ERR0420";
502
- ErrorCode["ERR0421"] = "ERR0421";
503
- ErrorCode["ERR0430"] = "ERR0430";
504
- ErrorCode["ERR0440"] = "ERR0440";
505
- // Team Errors ERR06XX
506
- ErrorCode["ERR0600"] = "ERR0600";
507
- ErrorCode["ERR0610"] = "ERR0610";
508
- ErrorCode["ERR0611"] = "ERR0611";
509
- ErrorCode["ERR0612"] = "ERR0612";
510
- ErrorCode["ERR0613"] = "ERR0613";
511
- ErrorCode["ERR0614"] = "ERR0614";
512
- ErrorCode["ERR0615"] = "ERR0615";
513
- ErrorCode["ERR0616"] = "ERR0665";
514
- ErrorCode["ERR0617"] = "ERR0617";
515
- ErrorCode["ERR0618"] = "ERR0618";
516
- ErrorCode["ERR0619"] = "ERR0619";
517
- // Course Errors ERR07XXX',
518
- // Sheets Errors ERR08XXX',
519
- ErrorCode["ERR0800"] = "ERR0800";
520
- ErrorCode["ERR0810"] = "ERR0810";
521
- ErrorCode["ERR0811"] = "ERR0811";
522
- ErrorCode["ERR0812"] = "ERR0812";
523
- ErrorCode["ERR0813"] = "ERR0813";
524
- ErrorCode["ERR0814"] = "ERR0814";
525
- ErrorCode["ERR0815"] = "ERR0815";
526
- ErrorCode["ERR0816"] = "ERR0865";
527
- ErrorCode["ERR0817"] = "ERR0817";
528
- ErrorCode["ERR0818"] = "ERR0818";
529
- ErrorCode["ERR0819"] = "ERR0819";
530
- ErrorCode["ERR0820"] = "ERR0820";
531
- // Organization Errors ERR99XXX',
532
- ErrorCode["ERR9900"] = "ERR9900";
533
- ErrorCode["ERR9910"] = "ERR9910";
534
- ErrorCode["ERR9911"] = "ERR9911";
535
- ErrorCode["ERR9912"] = "ERR9912";
536
- ErrorCode["ERR9913"] = "ERR9913";
537
- ErrorCode["ERR9914"] = "ERR9914";
538
- ErrorCode["ERR9915"] = "ERR9915";
539
- ErrorCode["ERR9916"] = "ERR9916";
540
- ErrorCode["ERR9917"] = "ERR9917";
541
- })(exports.ErrorCode || (exports.ErrorCode = {}));
542
- exports.LogLevel = void 0;
543
- (function (LogLevel) {
544
- LogLevel["FATAL"] = "FATAL";
545
- LogLevel["ERROR"] = "ERROR";
546
- LogLevel["WARN"] = "WARN";
547
- LogLevel["INFO"] = "INFO";
548
- LogLevel["DEBUG"] = "DEBUG";
549
- LogLevel["TRACE"] = "TRACE";
550
- })(exports.LogLevel || (exports.LogLevel = {}));
551
- exports.HTTPMethod = void 0;
552
- (function (HTTPMethod) {
553
- HTTPMethod["POST"] = "POST";
554
- HTTPMethod["GET"] = "GET";
555
- HTTPMethod["PUT"] = "PUT";
556
- HTTPMethod["PATCH"] = "PATCH";
557
- HTTPMethod["DELETE"] = "DELETE";
558
- })(exports.HTTPMethod || (exports.HTTPMethod = {}));
559
-
560
- exports.WorksheetType = void 0;
561
- (function (WorksheetType) {
562
- WorksheetType["JK_MD"] = "JK_MD";
563
- WorksheetType["CODE_EDITOR"] = "CODE_EDITOR";
564
- WorksheetType["LIST"] = "LIST";
565
- WorksheetType["GRAPH"] = "GRAPH";
566
- WorksheetType["QUIZ_PROBLEM"] = "QUIZ_PROBLEM";
567
- WorksheetType["QUIZ_TEXT"] = "QUIZ_TEXT";
568
- WorksheetType["QUIZ_OPTIONS"] = "QUIZ_OPTIONS";
569
- WorksheetType["NEW_PAGE"] = "NEW_PAGE";
570
- })(exports.WorksheetType || (exports.WorksheetType = {}));
571
- exports.QuizScoringMode = void 0;
572
- (function (QuizScoringMode) {
573
- QuizScoringMode["TOTAL"] = "TOTAL";
574
- QuizScoringMode["PARTIAL"] = "PARTIAL";
575
- })(exports.QuizScoringMode || (exports.QuizScoringMode = {}));
576
-
577
- /**
578
- * Subscriptions of the client. With the TOPIC channels they are not sent to the server anymore:
579
- * they only say which channel the client attaches (`getChannelOfWebSocketSubscribeEvent`) and the dispatch key.
580
- */
581
- exports.WebSocketSubscriptionEvent = void 0;
582
- (function (WebSocketSubscriptionEvent) {
583
- WebSocketSubscriptionEvent["SUBSCRIBE_CODE_RUN_STATUS"] = "SUBSCRIBE_CODE_RUN_STATUS";
584
- WebSocketSubscriptionEvent["UNSUBSCRIBE_CODE_RUN_STATUS"] = "UNSUBSCRIBE_CODE_RUN_STATUS";
585
- WebSocketSubscriptionEvent["SUBSCRIBE_SUBMISSION_RUN_STATUS"] = "SUBSCRIBE_SUBMISSION_RUN_STATUS";
586
- WebSocketSubscriptionEvent["UNSUBSCRIBE_SUBMISSION_RUN_STATUS"] = "UNSUBSCRIBE_SUBMISSION_RUN_STATUS";
587
- WebSocketSubscriptionEvent["SUBSCRIBE_GET_DATA"] = "SUBSCRIBE_GET_DATA";
588
- WebSocketSubscriptionEvent["UNSUBSCRIBE_GET_DATA"] = "SUBSCRIBE_GET_DATA";
589
- WebSocketSubscriptionEvent["SUBSCRIBE_PROBLEM_CRAWLED"] = "SUBSCRIBE_PROBLEM_CRAWLED";
590
- WebSocketSubscriptionEvent["UNSUBSCRIBE_PROBLEM_CRAWLED"] = "UNSUBSCRIBE_PROBLEM_CRAWLED";
591
- WebSocketSubscriptionEvent["SUBSCRIBE_SUBMISSIONS_CRAWL"] = "SUBSCRIBE_SUBMISSIONS_CRAWL";
592
- WebSocketSubscriptionEvent["UNSUBSCRIBE_SUBMISSIONS_CRAWL"] = "UNSUBSCRIBE_SUBMISSIONS_CRAWL";
593
- WebSocketSubscriptionEvent["SUBSCRIBE_CONTEST_CHANGES"] = "SUBSCRIBE_CONTEST_CHANGES";
594
- WebSocketSubscriptionEvent["UNSUBSCRIBE_CONTEST_CHANGES"] = "UNSUBSCRIBE_CONTEST_CHANGES";
595
- WebSocketSubscriptionEvent["SUBSCRIBE_USER_NOTIFICATION"] = "SUBSCRIBE_USER_NOTIFICATION";
596
- WebSocketSubscriptionEvent["UNSUBSCRIBE_USER_NOTIFICATION"] = "UNSUBSCRIBE_USER_NOTIFICATION";
597
- WebSocketSubscriptionEvent["SUBSCRIBE_SUBMISSIONS_JUDGING"] = "SUBSCRIBE_SUBMISSIONS_JUDGING";
598
- WebSocketSubscriptionEvent["UNSUBSCRIBE_SUBMISSIONS_JUDGING"] = "UNSUBSCRIBE_SUBMISSIONS_JUDGING";
599
- })(exports.WebSocketSubscriptionEvent || (exports.WebSocketSubscriptionEvent = {}));
600
- exports.WebSocketResponseEvent = void 0;
601
- (function (WebSocketResponseEvent) {
602
- WebSocketResponseEvent["CODE_RUN_STATUS"] = "CODE_RUN_STATUS";
603
- WebSocketResponseEvent["SUBMISSION_RUN_STATUS"] = "SUBMISSION_RUN_STATUS";
604
- WebSocketResponseEvent["USER_MESSAGE"] = "USER_MESSAGE";
605
- WebSocketResponseEvent["SEND_DATA_"] = "SEND_DATA_";
606
- WebSocketResponseEvent["SEND_DATA_ECS_TASK_DEFINITIONS_LIST"] = "SEND_DATA_ECS_TASK_DEFINITIONS_LIST";
607
- WebSocketResponseEvent["SEND_DATA_ECS_TASKS_LIST"] = "SEND_DATA_ECS_TASKS_LIST";
608
- WebSocketResponseEvent["SEND_DATA_EC2_INSTANCES_LIST"] = "SEND_DATA_EC2_INSTANCES_LIST";
609
- WebSocketResponseEvent["SEND_DATA_SSM_SESSIONS_LIST"] = "SEND_DATA_SSM_SESSIONS_LIST";
610
- WebSocketResponseEvent["SEND_DATA_RUN_COMMAND"] = "SEND_DATA_RUN_COMMAND";
611
- WebSocketResponseEvent["PROBLEM_CRAWLED"] = "PROBLEM_CRAWLED";
612
- WebSocketResponseEvent["SUBMISSIONS_CRAWL"] = "SUBMISSIONS_CRAWL";
613
- WebSocketResponseEvent["CONTEST_CHANGES"] = "CONTEST_CHANGES";
614
- WebSocketResponseEvent["USER_NOTIFICATION_"] = "USER_NOTIFICATION_";
615
- WebSocketResponseEvent["USER_NOTIFICATION_SUBMISSION"] = "USER_NOTIFICATION_SUBMISSION";
616
- WebSocketResponseEvent["USER_NOTIFICATION_CONTEST_CLARIFICATION"] = "USER_NOTIFICATION_CONTEST_CLARIFICATION";
617
- WebSocketResponseEvent["SUBMISSION_JUDGING"] = "SUBMISSION_JUDGING";
618
- })(exports.WebSocketResponseEvent || (exports.WebSocketResponseEvent = {}));
619
- /**
620
- * Roles of a contest, with the same names as the contest members in the DB.
621
- * Each role has its own Ably channel: `contest:{contestKey}:{role}` (see `CHANNEL_CONTEST`).
622
- * The inclusions follow `getContestAccessPermissions`:
623
- * spectators ⊇ managers ⊇ administrators, spectators ⊇ participants, spectators ⊇ guests
624
- */
625
- exports.ContestChannelRole = void 0;
626
- (function (ContestChannelRole) {
627
- ContestChannelRole["ADMINISTRATORS"] = "administrators";
628
- ContestChannelRole["MANAGERS"] = "managers";
629
- ContestChannelRole["PARTICIPANTS"] = "participants";
630
- ContestChannelRole["GUESTS"] = "guests";
631
- ContestChannelRole["SPECTATORS"] = "spectators";
632
- })(exports.ContestChannelRole || (exports.ContestChannelRole = {}));
633
- /**
634
- * Roles of a problem, the ones computed by `getProblemAccessPermissions` (backend).
635
- * Each role has its own Ably channel: `problem:{problemKey}:{role}` (see `CHANNEL_PROBLEM`).
636
- */
637
- exports.ProblemChannelRole = void 0;
638
- (function (ProblemChannelRole) {
639
- ProblemChannelRole["ADMINISTRATORS"] = "administrators";
640
- ProblemChannelRole["MANAGERS"] = "managers";
641
- ProblemChannelRole["SPECTATORS"] = "spectators";
642
- })(exports.ProblemChannelRole || (exports.ProblemChannelRole = {}));
643
- /**
644
- * Roles of the public channels of a user: `user:{userKey}:{role}` (see `CHANNEL_USER_ROLE`), by its public key
645
- * (`getUserKey(nickname, organizationKey)`) like problems and contests.
646
- * There are no per-user permissions: `spectators` is everyone who can list the submissions of the user.
647
- * The private channel of the user is `user:{userId}` (see `CHANNEL_USER`).
648
- */
649
- exports.UserChannelRole = void 0;
650
- (function (UserChannelRole) {
651
- UserChannelRole["SPECTATORS"] = "spectators";
652
- })(exports.UserChannelRole || (exports.UserChannelRole = {}));
653
-
654
- exports.DataViewMode = void 0;
655
- (function (DataViewMode) {
656
- DataViewMode["CARDS"] = "CARDS";
657
- DataViewMode["ROWS"] = "ROWS";
658
- })(exports.DataViewMode || (exports.DataViewMode = {}));
659
- exports.MenuViewMode = void 0;
660
- (function (MenuViewMode) {
661
- MenuViewMode["HORIZONTAL"] = "HORIZONTAL";
662
- MenuViewMode["VERTICAL"] = "VERTICAL";
663
- })(exports.MenuViewMode || (exports.MenuViewMode = {}));
664
- exports.Role = void 0;
665
- (function (Role) {
666
- Role["SUPER_ADMIN"] = "SUPER_ADMIN";
667
- Role["ADMIN"] = "ADMIN";
668
- Role["MASTER"] = "MASTER";
669
- Role["MANAGER"] = "MANAGER";
670
- Role["CREATOR"] = "CREATOR";
671
- Role["REGULAR"] = "REGULAR";
672
- Role["LIMITED"] = "LIMITED";
673
- Role["GUEST"] = "GUEST";
674
- Role["RESTRICTED"] = "RESTRICTED";
675
- })(exports.Role || (exports.Role = {}));
676
-
677
- exports.WorkingIn = void 0;
678
- (function (WorkingIn) {
679
- WorkingIn["NOTHING"] = "NOTHING";
680
- WorkingIn["SEND_SUBMISSION"] = "SEND_SUBMISSION";
681
- WorkingIn["TRACKING_SUBMISSION"] = "TRACKING_SUBMISSION";
682
- WorkingIn["CRAWLING_LANGUAGES"] = "CRAWLING_LANGUAGES";
683
- WorkingIn["CRAWLING_PROBLEM_DATA"] = "CRAWLING_PROBLEM_DATA";
684
- })(exports.WorkingIn || (exports.WorkingIn = {}));
685
-
686
- exports.AspectRatio = void 0;
687
- (function (AspectRatio) {
688
- AspectRatio["RATIO_21_9"] = "21:9";
689
- AspectRatio["RATIO_20_9"] = "20:9";
690
- AspectRatio["RATIO_16_9"] = "16:9";
691
- AspectRatio["RATIO_16_10"] = "16:10";
692
- AspectRatio["RATIO_3_2"] = "3:2";
693
- AspectRatio["RATIO_4_3"] = "4:3";
694
- AspectRatio["RATIO_5_4"] = "5:4";
695
- AspectRatio["RATIO_1_1"] = "1:1";
696
- })(exports.AspectRatio || (exports.AspectRatio = {}));
697
-
698
- const LANGUAGE = {
699
- [Language.EN]: { value: Language.EN, label: 'english' },
700
- [Language.ES]: { value: Language.ES, label: 'español' },
701
- };
702
- const THEME = {
703
- [Theme.LIGHT]: { value: Theme.LIGHT, label: 'light' },
704
- [Theme.DARK]: { value: Theme.DARK, label: 'dark' },
705
- };
706
- const GCC_VERSION = `gcc (Debian 12.2.0-14+deb12u1) 12.2.0
707
- Copyright (C) 2022 Free Software Foundation, Inc.
708
- This is free software; see the source for copying conditions. There is NO
709
- warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.`;
710
- const GPP_VERSION = `g++ (Debian 12.2.0-14+deb12u1) 12.2.0
711
- Copyright (C) 2022 Free Software Foundation, Inc.
712
- This is free software; see the source for copying conditions. There is NO
713
- warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.`;
714
- const JAVAC_VERSION = `javac 17.0.15`;
715
- const NODE_VERSION = `v20.19.2`;
716
- const PYTHON3_VERSION = 'Python 3.11.2';
717
- const PYPY3_VERSION = `Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
718
- [PyPy 7.3.11 with GCC 12.2.0]`;
719
- const PSEINT_VERSION = `PSeInt 20230904-l64-wx3
720
- http://pseint.sourceforge.net
721
- by Pablo Novara (zaskar_84@yahoo.com.ar)
722
- psExport 20230904-l64-wx3
723
- http://pseint.sourceforge.net
724
- by Pablo Novara (zaskar_84@yahoo.com.ar)`;
725
- const C = {
726
- mime: 'text/x-csrc',
727
- mainFilename: 'main.c',
728
- fileExtension: ['c'],
729
- hasBuildFile: true,
730
- executable: 'gcc',
731
- executableVersion: GCC_VERSION,
732
- templateSourceCode: '#include <stdio.h>\n \nint main(void) {\n \n printf("Hello World\\n");\n \n return 0;\n}',
733
- monacoKey: 'c',
734
- codeMirrorKey: 'c',
735
- highlightJsKey: 'c',
736
- };
737
- const CPP = {
738
- mime: 'text/x-c++src',
739
- mainFilename: 'main.cpp',
740
- fileExtension: ['cpp', 'c++', 'cxx', 'cc'],
741
- hasBuildFile: true,
742
- executable: 'g++',
743
- executableVersion: GPP_VERSION,
744
- templateSourceCode: '#include <iostream>\n\nusing namespace std;\n\n' + 'int main() {\n \n cout << "Hello World" << endl;\n \n return 0;\n}',
745
- monacoKey: 'cpp',
746
- codeMirrorKey: 'cpp',
747
- highlightJsKey: 'cpp',
748
- };
749
- const PYTHON = {
750
- mime: 'text/x-python',
751
- mainFilename: 'main.py',
752
- fileExtension: ['py'],
753
- hasBuildFile: false,
754
- templateSourceCode: 'print("Hello World\\n")',
755
- monacoKey: 'python',
756
- codeMirrorKey: 'python',
757
- highlightJsKey: 'python',
758
- };
759
- const CODE_LANGUAGE = {
760
- [exports.CodeLanguage.C_11]: {
761
- value: exports.CodeLanguage.C_11,
762
- label: 'C 11',
763
- compilePattern: '/usr/bin/jk-c11 -static -fno-optimize-sibling-calls -fno-strict-aliasing -DONLINE_JUDGE -fno-asm -lm -s -O2 -std=gnu11 -o ' +
764
- '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
765
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
766
- ...C,
767
- /*
768
- -static
769
- Binario independiente.
770
- -fno-optimize-sibling-calls
771
- Desactiva la optimización de llamadas recursivas “tail call”. Facilita detectar desbordes de pila o trazas correctas.
772
- -fno-strict-aliasing
773
- Evita asumir aliasing de punteros agresivo. Previene bugs raros en código competitivo.
774
- -DONLINE_JUDGE
775
- Define la macro ONLINE_JUDGE, usada a veces para omitir logs o debug prints (#ifdef ONLINE_JUDGE).
776
- -fno-asm
777
- Prohíbe insertar código ensamblador inline (asm()). Seguridad en entornos restringidos.
778
- -lm
779
- Enlaza libm.
780
- -s
781
- “Strips symbols”: elimina toda información de depuración. Binario más pequeño y más difícil de desensamblar.
782
- -O2
783
- Nivel medio de optimización (rápido y seguro).
784
- -std=gnu11
785
- Usa el estándar C11 con extensiones GNU.
786
- */
787
- },
788
- [exports.CodeLanguage.CPP_11]: {
789
- value: exports.CodeLanguage.CPP_11,
790
- label: 'C++ 11',
791
- compilePattern: '/usr/bin/jk-cpp11 -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=gnu++11 -o ' +
792
- '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
793
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
794
- ...CPP,
795
- },
796
- [exports.CodeLanguage.CPP_20]: {
797
- value: exports.CodeLanguage.CPP_20,
798
- label: 'C++ 20',
799
- compilePattern: '/usr/bin/jk-cpp20 -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=gnu++20 -o ' +
800
- '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
801
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
802
- ...CPP,
803
- },
804
- [exports.CodeLanguage.JAVA_21]: {
805
- value: exports.CodeLanguage.JAVA_21,
806
- label: 'Java 21',
807
- mime: 'text/x-java',
808
- mainFilename: 'Main.java',
809
- fileExtension: ['java'],
810
- compilePattern: "/usr/bin/jk-javac -cp '.;*' {{folder_path}}/{{source_full_file_name}}",
811
- // compilePattern: 'javac {{folder_path}}/{{source_full_file_name}}',
812
- // runPattern: 'java -cp {{folder_path}} {{class_name}}'
813
- runPattern: '/usr/bin/jk-java -Xmx512M -Xss64M -DONLINE_JUDGE=true -Duser.language=en -Duser.region=US -Duser.variant=US -cp ' + '{{folder_path}} {{class_name}}',
814
- templateSourceCode: 'class Main {\n public static void main (String[] args) {' + '\n \n System.out.println("Hello World");\n \n }\n}',
815
- hasBuildFile: true,
816
- executable: 'java',
817
- executableVersion: JAVAC_VERSION,
818
- monacoKey: 'java',
819
- codeMirrorKey: 'java',
820
- highlightJsKey: 'java',
821
- },
822
- [exports.CodeLanguage.PYTHON_2]: {
823
- // DEPRECATED
824
- value: exports.CodeLanguage.PYTHON_2,
825
- label: 'Python 2 *',
826
- compilePattern: '/usr/bin/jk-python2 -m py_compile {{folder_path}}/{{source_full_file_name}}',
827
- runPattern: '/usr/bin/jk-python2 {{folder_path}}/{{source_full_file_name}}',
828
- executable: 'python2',
829
- executableVersion: PYPY3_VERSION,
830
- ...PYTHON,
831
- },
832
- [exports.CodeLanguage.PYTHON_3]: {
833
- value: exports.CodeLanguage.PYTHON_3,
834
- label: 'Python 3',
835
- compilePattern: '/usr/bin/jk-python3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
836
- runPattern: '/usr/bin/jk-python3 {{folder_path}}/{{source_full_file_name}}',
837
- executable: 'python3',
838
- executableVersion: PYPY3_VERSION,
839
- ...PYTHON,
840
- },
841
- [exports.CodeLanguage.PYTHON_PYPY_2]: {
842
- // DEPRECATED
843
- value: exports.CodeLanguage.PYTHON_PYPY_2,
844
- label: 'PyPy 2 *',
845
- compilePattern: '/usr/bin/jk-pypy2 -m py_compile {{folder_path}}/{{source_full_file_name}}',
846
- runPattern: '/usr/bin/jk-pypy2 {{folder_path}}/{{source_full_file_name}}',
847
- executable: 'pypy2',
848
- executableVersion: PYPY3_VERSION,
849
- ...PYTHON,
850
- },
851
- [exports.CodeLanguage.PYTHON_PYPY_3]: {
852
- value: exports.CodeLanguage.PYTHON_PYPY_3,
853
- label: 'PyPy 3',
854
- compilePattern: '/usr/bin/jk-pypy3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
855
- runPattern: '/usr/bin/jk-pypy3 {{folder_path}}/{{source_full_file_name}}',
856
- executable: 'pypy3',
857
- executableVersion: PYPY3_VERSION,
858
- ...PYTHON,
859
- },
860
- [exports.CodeLanguage.JAVASCRIPT_NODE_JS_22]: {
861
- value: exports.CodeLanguage.JAVASCRIPT_NODE_JS_22,
862
- label: 'Javascript Node.js 22',
863
- mime: 'application/x-javascript',
864
- mainFilename: 'main.js',
865
- fileExtension: ['js'],
866
- compilePattern: '',
867
- runPattern: '/usr/bin/jk-node22 {{folder_path}}/{{source_full_file_name}}',
868
- templateSourceCode: 'console.log("Hello World\\n")',
869
- hasBuildFile: false,
870
- executable: 'node',
871
- executableVersion: NODE_VERSION,
872
- monacoKey: 'javascript',
873
- codeMirrorKey: 'javascript',
874
- highlightJsKey: 'javascript',
875
- },
876
- [exports.CodeLanguage.ICPC_C]: {
877
- // DEPRECATED
878
- value: exports.CodeLanguage.ICPC_C,
879
- label: 'ICPC C *',
880
- compilePattern: 'gcc -x c -g -O2 -std=gnu11 -static -lm -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
881
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
882
- ...C,
883
- },
884
- [exports.CodeLanguage.C]: {
885
- // DEPRECATED
886
- value: exports.CodeLanguage.C,
887
- label: 'C *',
888
- compilePattern: 'gcc -static -fno-optimize-sibling-calls -fno-strict-aliasing -DONLINE_JUDGE -fno-asm -lm -s -O2 -o ' +
889
- '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
890
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
891
- ...C,
892
- },
893
- [exports.CodeLanguage.ICPC_CPP]: {
894
- // DEPRECATED
895
- value: exports.CodeLanguage.ICPC_CPP,
896
- label: 'ICPC C++ *',
897
- compilePattern: 'g++ -x c++ -static -g -O2 -std=gnu++20 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
898
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
899
- ...CPP,
900
- },
901
- [exports.CodeLanguage.CPP]: {
902
- // DEPRECATED
903
- value: exports.CodeLanguage.CPP,
904
- label: 'C++ *',
905
- compilePattern: 'g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
906
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
907
- ...CPP,
908
- },
909
- [exports.CodeLanguage.CPP11]: {
910
- // DEPRECATED
911
- value: exports.CodeLanguage.CPP11,
912
- label: 'C++ 11 *',
913
- compilePattern: 'g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=c++11 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
914
- // compilePattern: 'g++ -O2 -s -Wall -std=c++11 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}} -lm',
915
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
916
- ...CPP,
917
- },
918
- [exports.CodeLanguage.CPP14]: {
919
- // DEPRECATED
920
- value: exports.CodeLanguage.CPP14,
921
- label: 'C++ 14 *',
922
- // compilePattern: 'g++ -O2 -s -Wall -std=c++14 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}} -lm',
923
- compilePattern: 'g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=c++14 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
924
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
925
- ...CPP,
926
- },
927
- [exports.CodeLanguage.CPP17]: {
928
- // DEPRECATED
929
- value: exports.CodeLanguage.CPP17,
930
- label: 'C++ 17 *',
931
- // compilePattern: 'g++ -O2 -s -Wall -std=c++17 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}} -lm',
932
- compilePattern: 'g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=c++17 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
933
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
934
- ...CPP,
935
- },
936
- [exports.CodeLanguage.JAVA]: {
937
- // DEPRECATED
938
- value: exports.CodeLanguage.JAVA,
939
- label: 'Java *',
940
- mime: 'text/x-java',
941
- mainFilename: 'Main.java',
942
- fileExtension: ['java'],
943
- compilePattern: "javac -cp '.;*' {{folder_path}}/{{source_full_file_name}}",
944
- // compilePattern: 'javac {{folder_path}}/{{source_full_file_name}}',
945
- // runPattern: 'java -cp {{folder_path}} {{class_name}}'
946
- runPattern: '/usr/lib/jvm/java-17-openjdk-amd64/bin/java -Xmx512M -Xss64M -DONLINE_JUDGE=true -Duser.language=en -Duser.region=US -Duser.variant=US -cp ' +
947
- '{{folder_path}} {{class_name}}',
948
- templateSourceCode: 'class Main {\n public static void main (String[] args) {' + '\n \n System.out.println("Hello World");\n \n }\n}',
949
- hasBuildFile: true,
950
- executable: 'javac',
951
- executableVersion: JAVAC_VERSION,
952
- monacoKey: 'java',
953
- codeMirrorKey: 'java',
954
- highlightJsKey: 'java',
955
- },
956
- [exports.CodeLanguage.ICPC_PYTHON]: {
957
- // DEPRECATED
958
- value: exports.CodeLanguage.ICPC_PYTHON,
959
- label: 'ICPC Python *',
960
- compilePattern: 'pypy3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
961
- runPattern: '/usr/bin/pypy3 {{folder_path}}/{{source_full_file_name}}',
962
- executable: 'pypy3',
963
- executableVersion: PYPY3_VERSION,
964
- ...PYTHON,
965
- },
966
- [exports.CodeLanguage.PYTHON]: {
967
- // DEPRECATED
968
- value: exports.CodeLanguage.PYTHON,
969
- label: 'Python *',
970
- compilePattern: 'python3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
971
- runPattern: '/usr/bin/python3 {{folder_path}}/{{source_full_file_name}}',
972
- executable: 'python3',
973
- executableVersion: PYTHON3_VERSION,
974
- ...PYTHON,
975
- },
976
- [exports.CodeLanguage.PYTHON2]: {
977
- // DEPRECATED
978
- value: exports.CodeLanguage.PYTHON2,
979
- label: 'Python 2 *',
980
- compilePattern: 'python2 -m py_compile {{folder_path}}/{{source_full_file_name}}',
981
- runPattern: '/usr/bin/python2 {{folder_path}}/{{source_full_file_name}}',
982
- executable: 'python',
983
- executableVersion: 'Python 2.7.18',
984
- ...PYTHON,
985
- },
986
- [exports.CodeLanguage.PYTHON3]: {
987
- // DEPRECATED
988
- value: exports.CodeLanguage.PYTHON3,
989
- label: 'Python 3 *',
990
- compilePattern: 'python3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
991
- runPattern: '/usr/bin/python3 {{folder_path}}/{{source_full_file_name}}',
992
- executable: 'python3',
993
- executableVersion: PYTHON3_VERSION,
994
- ...PYTHON,
995
- },
996
- [exports.CodeLanguage.JAVASCRIPT]: {
997
- // DEPRECATED
998
- value: exports.CodeLanguage.JAVASCRIPT,
999
- label: 'Javascript *',
1000
- mime: 'application/x-javascript',
1001
- mainFilename: 'main.js',
1002
- fileExtension: ['js'],
1003
- compilePattern: '',
1004
- runPattern: '/usr/bin/node {{folder_path}}/{{source_full_file_name}}',
1005
- templateSourceCode: 'console.log("Hello World\\n")',
1006
- hasBuildFile: false,
1007
- executable: 'node',
1008
- executableVersion: NODE_VERSION,
1009
- monacoKey: 'javascript',
1010
- codeMirrorKey: 'javascript',
1011
- highlightJsKey: 'javascript',
1012
- },
1013
- [exports.CodeLanguage.TYPESCRIPT]: {
1014
- // DEPRECATED
1015
- value: exports.CodeLanguage.TYPESCRIPT,
1016
- label: 'Typescript *',
1017
- mime: 'application/x-typescript',
1018
- mainFilename: 'main.ts',
1019
- fileExtension: ['ts'],
1020
- compilePattern: '',
1021
- runPattern: '/usr/bin/node {{folder_path}}/{{source_full_file_name}}',
1022
- templateSourceCode: 'console.log("Hello World\\n")',
1023
- hasBuildFile: false,
1024
- executable: 'node',
1025
- executableVersion: NODE_VERSION,
1026
- monacoKey: 'typescript',
1027
- codeMirrorKey: 'typescript',
1028
- highlightJsKey: 'typescript',
1029
- },
1030
- [exports.CodeLanguage.TSX]: {
1031
- // DEPRECATED
1032
- value: exports.CodeLanguage.TSX,
1033
- label: 'TSX *',
1034
- mime: 'application/x-typescript',
1035
- mainFilename: 'main.tsx',
1036
- fileExtension: ['tsx'],
1037
- compilePattern: '',
1038
- runPattern: '/usr/bin/node {{folder_path}}/{{source_full_file_name}}',
1039
- templateSourceCode: 'console.log("Hello World\\n")',
1040
- hasBuildFile: false,
1041
- executable: 'node',
1042
- executableVersion: NODE_VERSION,
1043
- monacoKey: 'typescript',
1044
- codeMirrorKey: 'typescript',
1045
- highlightJsKey: 'typescript',
1046
- },
1047
- [exports.CodeLanguage.JSX]: {
1048
- // DEPRECATED
1049
- value: exports.CodeLanguage.JSX,
1050
- label: 'JSX *',
1051
- mime: 'application/x-javascript',
1052
- mainFilename: 'main.jsx',
1053
- fileExtension: ['jsx'],
1054
- compilePattern: '',
1055
- runPattern: '/usr/bin/node {{folder_path}}/{{source_full_file_name}}',
1056
- templateSourceCode: 'console.log("Hello World\\n")',
1057
- hasBuildFile: false,
1058
- executable: 'node',
1059
- executableVersion: NODE_VERSION,
1060
- monacoKey: 'javascript',
1061
- codeMirrorKey: 'javascript',
1062
- highlightJsKey: 'javascript',
1063
- },
1064
- [exports.CodeLanguage.PSEUDOCODE_PSEINT]: {
1065
- value: exports.CodeLanguage.PSEUDOCODE_PSEINT,
1066
- label: 'Pseudo-código (PSeInt)',
1067
- mime: 'text/plain',
1068
- mainFilename: 'main.psc',
1069
- fileExtension: ['psc'],
1070
- compilePattern: 'jk-pseint {{folder_path}}/{{source_full_file_name}} --norun --nouser' +
1071
- ' && jk-pseint {{folder_path}}/{{source_full_file_name}} --draw {{folder_path}}/{{source_full_file_name}}.psd' +
1072
- ' && jk-psexport {{folder_path}}/{{source_full_file_name}}.psd {{folder_path}}/{{source_full_file_name}}.cpp --lang=cpp' +
1073
- ' && g++ -x c++ -g -O2 -std=gnu++20 -static -o ' +
1074
- '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}.cpp',
1075
- runPattern: '{{folder_path}}/{{compiled_file_name}}',
1076
- templateSourceCode: 'Algoritmo HOLA_MUNDO\n\tImprimir "Hello World"\nFinAlgoritmo\n',
1077
- hasBuildFile: false,
1078
- executable: '',
1079
- executableVersion: PSEINT_VERSION,
1080
- monacoKey: 'text',
1081
- codeMirrorKey: 'pseudocode-pseint',
1082
- highlightJsKey: 'plaintext',
1083
- },
1084
- [exports.CodeLanguage.DOT]: {
1085
- value: exports.CodeLanguage.DOT,
1086
- label: 'DOT',
1087
- mime: 'text/vnd.graphviz',
1088
- mainFilename: 'diagram.dot',
1089
- fileExtension: ['dot'],
1090
- compilePattern: '',
1091
- runPattern: '',
1092
- templateSourceCode: 'digraph G {\n A -> B;\n B -> C;\n}',
1093
- hasBuildFile: false,
1094
- executable: '',
1095
- executableVersion: '',
1096
- monacoKey: 'dot',
1097
- codeMirrorKey: 'dot',
1098
- highlightJsKey: 'plaintext',
1099
- },
1100
- [exports.CodeLanguage.MERMAID]: {
1101
- value: exports.CodeLanguage.MERMAID,
1102
- label: 'Mermaid',
1103
- mime: 'text/mermaid',
1104
- mainFilename: 'diagram.mmd',
1105
- fileExtension: ['mmd', 'mermaid'],
1106
- compilePattern: '',
1107
- runPattern: '',
1108
- templateSourceCode: `graph TD
1109
- A[Start] --> B{Is it working?}
1110
- B -- Yes --> C[Great!]
1111
- B -- No --> D[Fix it]
1112
- D --> B
1113
- `,
1114
- hasBuildFile: false,
1115
- executable: '',
1116
- executableVersion: '',
1117
- monacoKey: 'mermaid',
1118
- codeMirrorKey: 'mermaid',
1119
- highlightJsKey: 'plaintext',
1120
- },
1121
- [exports.CodeLanguage.JSON]: {
1122
- value: exports.CodeLanguage.JSON,
1123
- label: 'JSON',
1124
- mime: 'application/json',
1125
- mainFilename: 'main.json',
1126
- fileExtension: ['json'],
1127
- compilePattern: '',
1128
- runPattern: '',
1129
- templateSourceCode: '{\n \n}',
1130
- hasBuildFile: false,
1131
- executable: '',
1132
- executableVersion: '',
1133
- monacoKey: 'json',
1134
- codeMirrorKey: 'javascript',
1135
- highlightJsKey: 'json',
1136
- },
1137
- [exports.CodeLanguage.TEXT]: {
1138
- value: exports.CodeLanguage.TEXT,
1139
- label: 'plain text',
1140
- mime: 'text/plain',
1141
- mainFilename: 'main.txt',
1142
- fileExtension: ['txt', 'text', 'in', 'out'],
1143
- compilePattern: '',
1144
- runPattern: '',
1145
- templateSourceCode: '',
1146
- hasBuildFile: false,
1147
- executable: '',
1148
- executableVersion: '',
1149
- monacoKey: 'text',
1150
- codeMirrorKey: 'text',
1151
- highlightJsKey: 'plaintext',
1152
- },
1153
- [exports.CodeLanguage.DIFF]: {
1154
- value: exports.CodeLanguage.DIFF,
1155
- label: 'diff',
1156
- mime: 'text/plain',
1157
- mainFilename: 'main.patch',
1158
- fileExtension: ['diff', 'patch'],
1159
- compilePattern: '',
1160
- runPattern: '',
1161
- templateSourceCode: '',
1162
- hasBuildFile: false,
1163
- executable: '',
1164
- executableVersion: '',
1165
- monacoKey: 'diff',
1166
- codeMirrorKey: 'diff',
1167
- highlightJsKey: 'diff',
1168
- },
1169
- [exports.CodeLanguage.LATEX]: {
1170
- value: exports.CodeLanguage.LATEX,
1171
- label: 'LaTeX',
1172
- mime: 'application/x-latex',
1173
- mainFilename: 'main.tex',
1174
- fileExtension: ['tex'],
1175
- compilePattern: '',
1176
- runPattern: '',
1177
- templateSourceCode: '',
1178
- hasBuildFile: false,
1179
- executable: '',
1180
- executableVersion: '',
1181
- monacoKey: 'latex',
1182
- codeMirrorKey: 'stex',
1183
- highlightJsKey: 'latex',
1184
- },
1185
- // asc txt text diff pot
1186
- [exports.CodeLanguage.MARKDOWN]: {
1187
- value: exports.CodeLanguage.MARKDOWN,
1188
- label: 'Markdown',
1189
- mime: 'text/plain',
1190
- mainFilename: 'main.md',
1191
- fileExtension: ['md'],
1192
- compilePattern: '',
1193
- runPattern: '',
1194
- templateSourceCode: '# Hello World\n',
1195
- hasBuildFile: false,
1196
- executable: '',
1197
- executableVersion: '',
1198
- monacoKey: 'markdown',
1199
- codeMirrorKey: 'markdown',
1200
- highlightJsKey: 'markdown',
1201
- },
1202
- [exports.CodeLanguage.MDX]: {
1203
- value: exports.CodeLanguage.MDX,
1204
- label: 'MDX',
1205
- mime: 'text/plain',
1206
- mainFilename: 'main.mdx',
1207
- fileExtension: ['mdx'],
1208
- compilePattern: '',
1209
- runPattern: '',
1210
- templateSourceCode: '# Hello World\n',
1211
- hasBuildFile: false,
1212
- executable: '',
1213
- executableVersion: '',
1214
- monacoKey: 'markdown',
1215
- codeMirrorKey: 'markdown',
1216
- highlightJsKey: 'markdown',
1217
- },
1218
- [exports.CodeLanguage.ARDUINO]: {
1219
- value: exports.CodeLanguage.ARDUINO,
1220
- label: 'Arduino',
1221
- mime: 'text/plain',
1222
- mainFilename: 'main.c',
1223
- fileExtension: ['c', 'cpp', 'pde', 'h', 'ino'],
1224
- compilePattern: '',
1225
- runPattern: '',
1226
- templateSourceCode: '',
1227
- hasBuildFile: false,
1228
- executable: '',
1229
- executableVersion: '',
1230
- monacoKey: 'c',
1231
- codeMirrorKey: 'c',
1232
- highlightJsKey: 'c',
1233
- },
1234
- [exports.CodeLanguage.HTML]: {
1235
- value: exports.CodeLanguage.HTML,
1236
- label: 'HTML',
1237
- mime: 'text/HTML',
1238
- mainFilename: 'index.html',
1239
- fileExtension: ['html'],
1240
- compilePattern: '',
1241
- runPattern: '',
1242
- templateSourceCode: '',
1243
- hasBuildFile: false,
1244
- executable: '',
1245
- executableVersion: '',
1246
- monacoKey: 'html',
1247
- codeMirrorKey: 'html',
1248
- highlightJsKey: 'xml',
1249
- },
1250
- [exports.CodeLanguage.BASH]: {
1251
- value: exports.CodeLanguage.BASH,
1252
- label: 'Bash',
1253
- mime: 'text/plain',
1254
- mainFilename: 'main.sh',
1255
- fileExtension: ['sh', 'bash'],
1256
- compilePattern: '',
1257
- runPattern: '',
1258
- templateSourceCode: '#!/bin/bash\necho "Hello World"\n',
1259
- hasBuildFile: false,
1260
- executable: 'bash',
1261
- executableVersion: '',
1262
- monacoKey: 'shell',
1263
- codeMirrorKey: 'shell',
1264
- highlightJsKey: 'bash',
1265
- },
1266
- };
1267
- const PAGE_SIZES = ['32', '64', '128', '256', '512'];
1268
- const PALLETE = {
1269
- VIVOS: [
1270
- { color: '#FF0000', title: 'Rojo' },
1271
- { color: '#FF5900', title: 'Rojo - Naranja' },
1272
- { color: '#FF8600', title: 'Naranja' },
1273
- { color: '#FFBF00', title: 'Ámbar' },
1274
- { color: '#FFFF00', title: 'Amarillo' },
1275
- { color: '#A6FF00', title: 'Lima o Verde limon' },
1276
- { color: '#00FF8C', title: 'Verde puro' },
1277
- { color: '#00FF8C', title: 'Verde cian' },
1278
- { color: '#00FFFF', title: 'Cian' },
1279
- { color: '#0099FF', title: 'Cerúleo o Azur' },
1280
- { color: '#0000FF', title: 'Azul' },
1281
- { color: '#9F00FF', title: 'Violeta' },
1282
- { color: '#FF00FF', title: 'Magenta' },
1283
- { color: '#FF0099', title: 'Fucsia' },
1284
- ],
1285
- OSCUROS: [
1286
- { color: '#880000', title: 'Granate' },
1287
- { color: '#882F00', title: 'Caoba o Rojo indio' },
1288
- { color: '#884700', title: 'Marrón o Pardo' },
1289
- { color: '#886600', title: 'Marrón dorado' },
1290
- { color: '#888800', title: 'Oliva' },
1291
- { color: '#588800', title: 'Verde palta' },
1292
- { color: '#008800', title: 'Verde estándar' },
1293
- { color: '#008858', title: 'Esmeralda' },
1294
- { color: '#008888', title: 'Cerceta o Azul verde' },
1295
- { color: '#005288', title: 'Añil' },
1296
- { color: '#000080', title: 'Azul marino' },
1297
- { color: '#880088', title: 'Azul púrpura' },
1298
- { color: '#880088', title: 'Púrpura o Morado' },
1299
- { color: '#880047', title: 'Vino' },
1300
- ],
1301
- AGRISADOS: [
1302
- { color: '#BF4040', title: 'Lacre' },
1303
- { color: '#BF6340', title: 'Cobre' },
1304
- { color: '#BF8340', title: 'Cnalea o Ocre' },
1305
- { color: '#BF9F40', title: 'Dorado' },
1306
- { color: '#BFBF40', title: 'Chartreuse' },
1307
- { color: '#93BF40', title: 'Verde manzana' },
1308
- { color: '#93BF40', title: 'Verde bosque' },
1309
- { color: '#40BF40', title: 'Verde mar' },
1310
- { color: '#40BFBF', title: 'Turquesa' },
1311
- { color: '#408CBF', title: 'Azul acero' },
1312
- { color: '#4040BF', title: 'Zafiro' },
1313
- { color: '#9340BF', title: 'Amastista' },
1314
- { color: '#B140BF', title: 'Púrpureo' },
1315
- { color: '#B140BF', title: 'Fandango' },
1316
- ],
1317
- CLAROS: [
1318
- { color: '#FF7777', title: 'Coral' },
1319
- { color: '#FF9977', title: 'Salmón' },
1320
- { color: '#FFB977', title: 'Melón o Durazno' },
1321
- { color: '#FFDA80', title: 'Crema' },
1322
- { color: '#FFFF88', title: 'Maíz' },
1323
- { color: '#CFFF77', title: 'Té verde' },
1324
- { color: '#77FF77', title: 'Verde claro' },
1325
- { color: '#77FFAA', title: 'Menta' },
1326
- { color: '#80FFFF', title: 'Aguamarina' },
1327
- { color: '#73C7FF', title: 'Celeste' },
1328
- { color: '#8082FF', title: 'Bígaro o aciano' },
1329
- { color: '#C977FF', title: 'Lavanda o lila' },
1330
- { color: '#FF77FF', title: 'Malva' },
1331
- { color: '#FF77C1', title: 'Rosado' },
1332
- ],
1333
- };
1334
- const UPPERCASE_LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
1335
- const LOWERCASE_LETTERS = UPPERCASE_LETTERS.toLowerCase();
1336
- const NUMBERS = '012345678';
1337
- const DEFAULT_JUKI_PROFILE_IMAGE = 'https://juki-judge.s3.us-east-2.amazonaws.com/public/file/5f69783aa7a8e048ef8d0ce2.';
1338
- const SEPARATOR_TOKEN = '\x1E';
1339
- const HEADER_JUKI_FORWARDED_HOST = 'x-juki-forwarded-host';
1340
- const HEADER_JUKI_VISITOR_SESSION_ID = 'x-juki-visitor-session-id';
1341
- const HEADER_JUKI_METADATA = 'x-juki-metadata';
1342
- const HEADER_JUKI_SECRET_TOKEN = 'x-juki-secret-token';
1343
- const HEADER_JUKI_INTERNAL_API_KEY = 'x-juki-internal-api-key';
1344
- const COOKIE_JUKI_SESSION_ID = 'juki-session-id';
1345
-
1346
- const JUKI_APP_ORGANIZATION_KEY = 'juki-app';
1347
- const ORGANIZATION_PLAN = {
1348
- [exports.OrganizationPlan.FREE]: {
1349
- value: exports.OrganizationPlan.FREE,
1350
- label: 'free',
1351
- description: 'the resources, runners and compilers, are shared with the juki.app giving priority to juki.app',
1352
- },
1353
- [exports.OrganizationPlan.STANDARD]: {
1354
- value: exports.OrganizationPlan.STANDARD,
1355
- label: 'standard',
1356
- description: 'the resources are dedicated, 1 runner and 1 compiler',
1357
- },
1358
- [exports.OrganizationPlan.PREMIUM]: {
1359
- value: exports.OrganizationPlan.PREMIUM,
1360
- label: 'premium',
1361
- description: 'the resources are dedicated and on demand use with at least 1 runner and 1 compiler',
1362
- },
1363
- [exports.OrganizationPlan.CUSTOM]: {
1364
- value: exports.OrganizationPlan.CUSTOM,
1365
- label: 'custom',
1366
- description: 'the resources are dedicated and on demand use with at least 1 (settable) runner and 1 (settable) compiler',
1367
- },
1368
- };
1369
-
1370
- const CONTEST_STATUS = {
1371
- [exports.ContestStatus.PUBLIC]: {
1372
- value: exports.ContestStatus.PUBLIC,
1373
- label: 'public',
1374
- description: 'the contest will appear in the contest list and the users will have access according to their roles',
1375
- },
1376
- [exports.ContestStatus.RESERVED]: {
1377
- value: exports.ContestStatus.RESERVED,
1378
- label: 'reserved',
1379
- description: 'the contest will appear in the contest list only for contest members and the users will have access according to their roles',
1380
- },
1381
- [exports.ContestStatus.ARCHIVED]: {
1382
- value: exports.ContestStatus.ARCHIVED,
1383
- label: 'archived',
1384
- description: 'the contest will not appear for anyone, contact the administrator to see it again',
1385
- },
1386
- };
1387
- const CONTEST_ROLE = {
1388
- [exports.Role.RESTRICTED]: { value: exports.Role.RESTRICTED, label: 'restricted', level: 7 },
1389
- [exports.Role.GUEST]: { value: exports.Role.GUEST, label: 'guest', level: 6 },
1390
- [exports.Role.REGULAR]: { value: exports.Role.REGULAR, label: 'regular', level: 5 },
1391
- [exports.Role.CREATOR]: { value: exports.Role.CREATOR, label: 'creator', level: 4 },
1392
- [exports.Role.MANAGER]: { value: exports.Role.MANAGER, label: 'manager', level: 3 },
1393
- [exports.Role.MASTER]: { value: exports.Role.MASTER, label: 'master', level: 2 },
1394
- [exports.Role.ADMIN]: { value: exports.Role.ADMIN, label: 'admin', level: 1 },
1395
- [exports.Role.SUPER_ADMIN]: { value: exports.Role.SUPER_ADMIN, label: 'super admin', level: 0 },
1396
- };
1397
-
1398
- const COURSE_ROLE = {
1399
- [CourseRole.RESTRICTED]: { value: CourseRole.RESTRICTED, label: 'restricted', level: 8 },
1400
- [CourseRole.GUEST]: { value: CourseRole.GUEST, label: 'guest', level: 7 },
1401
- [CourseRole.REGULAR]: { value: CourseRole.REGULAR, label: 'regular', level: 6 },
1402
- [CourseRole.CREATOR]: { value: CourseRole.CREATOR, label: 'creator', level: 5 },
1403
- [CourseRole.SUPER_CREATOR]: { value: CourseRole.SUPER_CREATOR, label: 'super creator', level: 4 },
1404
- [CourseRole.MANAGER]: { value: CourseRole.MANAGER, label: 'manager', level: 3 },
1405
- [CourseRole.MASTER]: { value: CourseRole.MASTER, label: 'super admin', level: 2 },
1406
- [CourseRole.ADMIN]: { value: CourseRole.ADMIN, label: 'admin', level: 1 },
1407
- [CourseRole.SUPER_ADMIN]: { value: CourseRole.SUPER_ADMIN, label: 'super admin', level: 0 },
1408
- };
1409
-
1410
- function isStringJson(str) {
1411
- try {
1412
- if (typeof str === 'string') {
1413
- JSON.parse(str);
1414
- return true;
1415
- }
1416
- }
1417
- catch (e) {
1418
- return false;
1419
- }
1420
- return false;
1421
- }
1422
- function safeJsonParse(str) {
1423
- try {
1424
- if (typeof str === 'string') {
1425
- return JSON.parse(str);
1426
- }
1427
- }
1428
- catch (e) {
1429
- return null;
1430
- }
1431
- return null;
1432
- }
1433
- function isObjectJson(obj) {
1434
- try {
1435
- return typeof JSON.stringify(obj) === 'string';
1436
- }
1437
- catch (e) {
1438
- return false;
1439
- }
1440
- }
1441
- function mex(array) {
1442
- let i = 0;
1443
- while (array.indexOf(i) !== -1) {
1444
- i++;
1445
- }
1446
- return i;
1447
- }
1448
- function range(start, end) {
1449
- const result = [];
1450
- for (let i = start; i < end; i++) {
1451
- result.push(i);
1452
- }
1453
- return result;
1454
- }
1455
- async function getPlainText(url) {
1456
- return await fetch(url)
1457
- .then(data => data.text())
1458
- .catch((error) => {
1459
- console.error('ERROR:', error);
1460
- return '';
1461
- });
1462
- }
1463
- function objectUpdate(base, update) {
1464
- if (JSON.stringify(base) === JSON.stringify(update)) {
1465
- return base;
1466
- }
1467
- if (base !== null && update !== null && !Array.isArray(base) && typeof base === 'object' && typeof update === 'object') {
1468
- const mergeKeys = new Set([...Object.keys(base), ...Object.keys(update)]);
1469
- Array.from(mergeKeys).forEach(key => {
1470
- if (update[key] !== null && update[key] !== undefined && base[key] !== update[key]) {
1471
- base[key] = objectUpdate(base[key], update[key]);
1472
- }
1473
- });
1474
- return base;
1475
- }
1476
- if (update !== null && update !== undefined) {
1477
- return update;
1478
- }
1479
- return base;
1480
- }
1481
- function objectsUpdate(base, ...objects) {
1482
- let newObject = { ...base };
1483
- objects.forEach((update) => {
1484
- newObject = objectUpdate(newObject, update);
1485
- });
1486
- return newObject;
1487
- }
1488
- function consoleWarn(...warn) {
1489
- console.warn(new Date().toLocaleString(), ...warn);
1490
- }
1491
- function consoleInfo(...info) {
1492
- console.info(new Date().toLocaleString(), ...info);
1493
- }
1494
- function consoleError(...error) {
1495
- console.error(new Date().toLocaleString(), ...error);
1496
- }
1497
- function indexToLetters(index) {
1498
- const d = Math.ceil(index / 26);
1499
- if (d === 1) {
1500
- return UPPERCASE_LETTERS.charAt(index - 1);
1501
- }
1502
- return UPPERCASE_LETTERS.charAt(d - 2) + UPPERCASE_LETTERS.charAt(index - (26 * (d - 1)) - 1);
1503
- }
1504
- function lettersToIndex(index) {
1505
- if (index.length) {
1506
- if (index.length === 1) {
1507
- const d = UPPERCASE_LETTERS.indexOf(index);
1508
- if (d !== -1) {
1509
- return d + 1;
1510
- }
1511
- }
1512
- else if (index.length === 2) {
1513
- const a = index.charAt(0);
1514
- const b = index.charAt(1);
1515
- const numA = lettersToIndex(a);
1516
- const numB = lettersToIndex(b);
1517
- return numA * 26 + numB;
1518
- }
1519
- }
1520
- return 0;
1521
- }
1522
- function getProblemJudgeKey(judge, key) {
1523
- return `${judge}-${key}`;
1524
- }
1525
- /**
1526
- * https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string
1527
- * Format bytes as human-readable text.
1528
- *
1529
- * @param bytes Number of bytes.
1530
- * @param si True to use metric (SI) units, aka powers of 1000. False to use
1531
- * binary (IEC), aka powers of 1024.
1532
- * @param dp Number of decimal places to display.
1533
- *
1534
- * @return Formatted string.
1535
- */
1536
- function humanFileSize(bytes, si = false, dp = 1) {
1537
- const thresh = si ? 1000 : 1024;
1538
- if (Math.abs(bytes) < thresh) {
1539
- return bytes + ' B';
1540
- }
1541
- const units = si
1542
- ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
1543
- : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
1544
- let u = -1;
1545
- const r = 10 ** dp;
1546
- do {
1547
- bytes /= thresh;
1548
- ++u;
1549
- } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
1550
- return bytes.toFixed(dp) + ' ' + units[u];
1551
- }
1552
- function stringToArrayBuffer(str) {
1553
- const buf = new ArrayBuffer(str.length); //convert str to arrayBuffer
1554
- const view = new Uint8Array(buf); //create Uint8Array as viewer
1555
- for (let i = 0; i < str.length; i++) {
1556
- view[i] = str.charCodeAt(i) & 0xFF; //convert to octet
1557
- }
1558
- return buf;
1559
- }
1560
- function chunkString(str, size) {
1561
- const numChunks = Math.ceil(str.length / size);
1562
- const chunks = new Array(numChunks);
1563
- for (let i = 0, o = 0; i < numChunks; ++i, o += size) {
1564
- chunks[i] = str.substr(o, size);
1565
- }
1566
- return chunks;
1567
- }
1568
- function getRandomString(length) {
1569
- const charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; // 62
1570
- let retVal = '';
1571
- for (let i = 0; i < length; ++i) {
1572
- retVal += charset.charAt(Math.floor(Math.random() * charset.length));
1573
- }
1574
- return retVal;
1575
- }
1576
- function join(array) {
1577
- return array.join(SEPARATOR_TOKEN);
1578
- }
1579
- function split(text) {
1580
- return text.split(SEPARATOR_TOKEN);
1581
- }
1582
- const areArraysDifferent = (a, b) => {
1583
- if (a === b) {
1584
- return false;
1585
- }
1586
- if (a.length !== b.length) {
1587
- return true;
1588
- }
1589
- for (let i = 0; i < b.length; i += 1) {
1590
- if (b[i] !== a[i]) {
1591
- return true;
1592
- }
1593
- }
1594
- return false;
1595
- };
1596
-
1597
- const YEARS = range(1970, 2100);
1598
- const MONTH_NAMES = [
1599
- 'January',
1600
- 'February',
1601
- 'March',
1602
- 'April',
1603
- 'May',
1604
- 'June',
1605
- 'July',
1606
- 'August',
1607
- 'September',
1608
- 'October',
1609
- 'November',
1610
- 'December',
1611
- ];
1612
- const DAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
1613
- const HOURS = range(0, 24);
1614
- const MINUTES = range(0, 60);
1615
- const SECONDS = range(0, 60);
1616
- const MILLISECONDS = range(0, 1000);
1617
- const MAX_DATE = new Date(8640000000000000);
1618
- const MIN_DATE = new Date(0);
1619
-
1620
- const SUPPORT_EMAIL = 'support@juki.app';
1621
- const JUKI_APP_EMAIL_TEMPLATE = `<div style="width: 100%; background: #F2F2F2;">
1622
- <div style="background: #164066; width: 100%;">
1623
- <div style="height: 56px; color: white; width: 100px; margin: 0 auto">
1624
- <img
1625
- src="https://images.juki.pub/assets/juki-app-horizontal-white-logo.svg"
1626
- alt="juki app logo"
1627
- height="56px"
1628
- style="padding:10px; box-sizing: border-box"
1629
- />
1630
- </div>
1631
- </div>
1632
- <div style="padding: 24px; color: #333333; font-family: sans-serif; font-size: 16px; line-height: 24px;">
1633
- <div style="max-width: 520px; margin: 0 auto; padding: 24px; background: white; border-radius: 6px;">
1634
- <section style="padding: 0 0 1em 0; border-bottom: 1px solid #828282;">
1635
- {{content}}
1636
- </section>
1637
- <div style="font-size: 14px; text-align: center; color: #828282; line-height: 16px; padding-top: 1em">
1638
- <p style="margin: 0;">
1639
- Si tú no realizaste la solicitud, escribenos a
1640
- <a href="mailto:${SUPPORT_EMAIL}" style="color: #2468A6; text-decoration: none;">
1641
- ${SUPPORT_EMAIL}
1642
- </a>
1643
- </p>
1644
- <p style="margin: 0;">
1645
- Este mensaje fue enviado por el equipo de
1646
- <a href="https://juki.app" style="color: #2468A6; text-decoration: none;">
1647
- juki.app
1648
- </a>
1649
- </p>
1650
- </div>
1651
- </div>
1652
- </div>
1653
- </div>`;
1654
-
1655
- const EMPTY_DOCUMENT_MEMBERS = () => ({
1656
- access: exports.EntityAccess.PRIVATE,
1657
- managers: {},
1658
- spectators: {},
1659
- });
1660
- const EMPTY_ENTITY_MEMBERS = () => ({
1661
- rankAdministrators: exports.EntityMembersRank.CLOSE,
1662
- administrators: {},
1663
- rankManagers: exports.EntityMembersRank.CLOSE,
1664
- managers: {},
1665
- rankGuests: exports.EntityMembersRank.CLOSE,
1666
- guests: {},
1667
- rankSpectators: exports.EntityMembersRank.CLOSE,
1668
- spectators: {},
1669
- rankParticipants: exports.EntityMembersRank.CLOSE,
1670
- participants: {},
1671
- });
1672
-
1673
- const JUDGE = {
1674
- // [Judge.CUSTOMER]: {
1675
- // value: Judge.CUSTOMER,
1676
- // label: '',
1677
- // logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
1678
- // logoSize: [ 883.991, 435 ],
1679
- // url: '',
1680
- // // getLoginUrl: () => '',
1681
- // // getProfileUrl: () => '',
1682
- // // getSubmitUrl: () => '',
1683
- // // getSubmissionUrl: () => '',
1684
- // // getProblemUrl: (key: string) => `/problem/view/${key}`,
1685
- // // getUserSubmissionsUrl: () => '',
1686
- // },
1687
- [exports.Judge.JUKI_JUDGE]: {
1688
- value: exports.Judge.JUKI_JUDGE,
1689
- label: 'Juki Judge',
1690
- logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
1691
- logoSize: [883.991, 435],
1692
- url: 'https://judge.juki.app',
1693
- // getLoginUrl: () => '',
1694
- // getProfileUrl: () => '',
1695
- // getSubmitUrl: () => '',
1696
- // getSubmissionUrl: () => '',
1697
- // getProblemUrl: (key: string) => `https://judge.juki.app/problem/view/${key}`,
1698
- // getUserSubmissionsUrl: () => '',
1699
- },
1700
- [exports.Judge.CODEFORCES]: {
1701
- value: exports.Judge.CODEFORCES,
1702
- label: 'Codeforces',
1703
- logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
1704
- logoSize: [1232.75, 145.12],
1705
- url: 'https://codeforces.com',
1706
- // getLoginUrl: () => 'https://codeforces.com/enter',
1707
- // getProfileUrl: () => '',
1708
- // getSubmitUrl: () => 'https://codeforces.com/problemset/submit',
1709
- // getSubmissionUrl: (problemKey: string, submissionId: string) => {
1710
- // const [ contestId ] = problemKey.split('-');
1711
- // return `https://codeforces.com/problemset/submission/${contestId}/${submissionId}`;
1712
- // },
1713
- // getProblemUrl: (problemKey: string) => {
1714
- // const [ contestId, index ] = problemKey.split('-');
1715
- // return `https://codeforces.com/problemset/problem/${contestId}/${index}`;
1716
- // },
1717
- // getUserSubmissionsUrl: () => '',
1718
- },
1719
- [exports.Judge.CODEFORCES_GYM]: {
1720
- value: exports.Judge.CODEFORCES_GYM,
1721
- label: 'Codeforces Gym',
1722
- logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
1723
- logoSize: [1232.75, 145.12],
1724
- url: 'https://codeforces.com',
1725
- // getLoginUrl: () => 'https://codeforces.com/enter',
1726
- // getProfileUrl: () => '',
1727
- // getSubmitUrl: (problemKey: string) => {
1728
- // const [ gymContestId, index ] = problemKey.split('-');
1729
- // return `https://codeforces.com/gym/${gymContestId}/submit`;
1730
- // },
1731
- // getSubmissionUrl: (problemKey: string, submissionId: string) => {
1732
- // const [ gymContestId ] = problemKey.split('-');
1733
- // return `https://codeforces.com/gym/${gymContestId}/submission/${submissionId}`;
1734
- // },
1735
- // getProblemUrl: (problemKey: string) => {
1736
- // const [ gymContestId, index ] = problemKey.split('-');
1737
- // return `https://codeforces.com/gym/${gymContestId}/problem/${index}`;
1738
- // },
1739
- // getUserSubmissionsUrl: () => '',
1740
- },
1741
- [exports.Judge.JV_UMSA]: {
1742
- value: exports.Judge.JV_UMSA,
1743
- label: 'Juez Virtual UMSA',
1744
- logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
1745
- logoSize: [1232.75, 145.12],
1746
- url: 'https://jv.umsa.bo',
1747
- // getLoginUrl: () => 'https://jv.umsa.bo/oj/login.php',
1748
- // getProfileUrl: () => 'https://jv.umsa.bo/oj/userInfo.php',
1749
- // getSubmitUrl: (problemKey: string) => {
1750
- // // single problem: '1019'
1751
- // // cib problem: '1019-A'
1752
- // const isContestProblem = problemKey.includes('-');
1753
- // // A -> 0, B -> 1, C -> 2, D -> 3, E -> 4, F -> 5, G -> 6, H -> 7, I -> 8, J -> 9
1754
- // const params = problemKey.split('-');
1755
- // return isContestProblem
1756
- // ? `https://jv.umsa.bo/oj/submitpage.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
1757
- // : `https://jv.umsa.bo/oj/submitpage.php?id=${problemKey}`;
1758
- // },
1759
- // getSubmissionUrl: (problemKey: string, submissionId: string, username: string) => {
1760
- // // return `https://jv.umsa.bo/status.php?problem_id=&user_id=${username}&language=-1&jresult=-1`;
1761
- // return `https://jv.umsa.bo/oj/showsource.php?id=${submissionId}`;
1762
- // },
1763
- // getProblemUrl: (problemKey: string) => {
1764
- // const isContestProblem = problemKey.includes('-');
1765
- // const params = problemKey.split('-');
1766
- // return isContestProblem
1767
- // ? `https://jv.umsa.bo/oj/problem.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
1768
- // : `https://jv.umsa.bo/oj/problem.php?id=${problemKey}`;
1769
- // },
1770
- // getUserSubmissionsUrl: (username: string) => `https://jv.umsa.bo/oj/status.php?user_id=${username}`,
1771
- },
1772
- [exports.Judge.UVA_ONLINE_JUDGE]: {
1773
- value: exports.Judge.UVA_ONLINE_JUDGE,
1774
- label: 'Uva Online Judge',
1775
- logo: 'https://images.juki.pub/c/uva-online-judge-logo-color.png',
1776
- logoSize: [150, 135.994],
1777
- url: 'https://onlinejudge.org',
1778
- },
1779
- [exports.Judge.AT_CODER]: {
1780
- value: exports.Judge.AT_CODER,
1781
- label: 'AtCoder',
1782
- logo: 'https://images.juki.pub/c/at-coder-logo-color.png',
1783
- logoSize: [762.997, 675],
1784
- url: 'https://atcoder.jp',
1785
- },
1786
- [exports.Judge.CODECHEF]: {
1787
- value: exports.Judge.CODECHEF,
1788
- label: 'Codechef',
1789
- logo: 'https://images.juki.pub/c/codechef-logo-color.svg',
1790
- logoSize: [1207.7, 453.17],
1791
- url: 'https://www.codechef.com',
1792
- },
1793
- [exports.Judge.TOPCODER]: {
1794
- value: exports.Judge.TOPCODER,
1795
- label: 'Topcoder',
1796
- logo: 'https://images.juki.pub/c/topcoder-logo-color.png',
1797
- logoSize: [971.99, 415.99],
1798
- url: 'https://www.topcoder.com',
1799
- },
1800
- [exports.Judge.LEETCODE]: {
1801
- value: exports.Judge.LEETCODE,
1802
- label: 'LeetCode',
1803
- logo: 'https://images.juki.pub/assets/leetcode-logo-color.svg',
1804
- logoSize: [95, 111],
1805
- url: 'https://leetcode.com',
1806
- // getProblemUrl: (problemKey: string) => {
1807
- // return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}`;
1808
- // },
1809
- // getProfileUrl: (userNickname: string) => {
1810
- // return `https://leetcode.com/u/${userNickname}`;
1811
- // },
1812
- // getSubmissionUrl: (problemKey: string, submissionId: string, username: string, submissionRunId: string) => {
1813
- // return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}/submissions/${submissionRunId}`;
1814
- // },
1815
- },
1816
- };
1817
- const RUNNER_ACCEPTED_PROBLEM_MODES = [
1818
- exports.ProblemScoringMode.TOTAL,
1819
- exports.ProblemScoringMode.SUBTASK,
1820
- exports.ProblemScoringMode.PARTIAL,
1821
- ];
1822
- const RUNNER_ACCEPTED_PROBLEM_TYPES = [
1823
- exports.ProblemType.STANDARD,
1824
- exports.ProblemType.DYNAMIC,
1825
- ];
1826
- const RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES = [
1827
- exports.CodeLanguage.C_11,
1828
- exports.CodeLanguage.CPP_11,
1829
- exports.CodeLanguage.CPP_20,
1830
- exports.CodeLanguage.JAVA_21,
1831
- exports.CodeLanguage.PYTHON_3,
1832
- exports.CodeLanguage.PYTHON_PYPY_3,
1833
- exports.CodeLanguage.JAVASCRIPT_NODE_JS_22,
1834
- exports.CodeLanguage.PSEUDOCODE_PSEINT,
1835
- ];
1836
- const ACCEPTED_PROGRAMMING_LANGUAGES = [
1837
- ...RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES,
1838
- ];
1839
- const PROBLEM_VERDICT = {
1840
- [exports.ProblemVerdict.NONE]: { value: exports.ProblemVerdict.NONE, label: 'none', color: '#555555' },
1841
- [exports.ProblemVerdict.PENDING]: { value: exports.ProblemVerdict.PENDING, label: 'pending', color: '#79B6FD' },
1842
- [exports.ProblemVerdict.HIDDEN]: { value: exports.ProblemVerdict.HIDDEN, label: 'hidden', color: '#555555' },
1843
- [exports.ProblemVerdict.AC]: { value: exports.ProblemVerdict.AC, label: 'accepted', color: '#43D787' },
1844
- [exports.ProblemVerdict.PE]: { value: exports.ProblemVerdict.PE, label: 'presentation error', color: '#55db93' },
1845
- [exports.ProblemVerdict.PA]: { value: exports.ProblemVerdict.PA, label: 'partial accepted', color: '#55db93' },
1846
- [exports.ProblemVerdict.CE]: { value: exports.ProblemVerdict.CE, label: 'compilation error', color: '#FE9F9F' },
1847
- [exports.ProblemVerdict.RE]: { value: exports.ProblemVerdict.RE, label: 'runtime error', color: '#FE9F9F' },
1848
- [exports.ProblemVerdict.TLE]: { value: exports.ProblemVerdict.TLE, label: 'time limit exceed', color: '#FE9F9F' },
1849
- [exports.ProblemVerdict.MLE]: { value: exports.ProblemVerdict.MLE, label: 'memory limit exceed', color: '#FE9F9F' },
1850
- [exports.ProblemVerdict.WA]: { value: exports.ProblemVerdict.WA, label: 'wrong answer', color: '#FE9F9F' },
1851
- };
1852
- const PROBLEM_VERDICTS = [
1853
- exports.ProblemVerdict.NONE,
1854
- exports.ProblemVerdict.PENDING,
1855
- exports.ProblemVerdict.AC,
1856
- exports.ProblemVerdict.PE,
1857
- exports.ProblemVerdict.PA,
1858
- exports.ProblemVerdict.CE,
1859
- exports.ProblemVerdict.RE,
1860
- exports.ProblemVerdict.TLE,
1861
- exports.ProblemVerdict.MLE,
1862
- exports.ProblemVerdict.WA,
1863
- ];
1864
- const SUBMISSION_RUN_STATUS = {
1865
- [exports.SubmissionRunStatus.NONE]: { value: exports.SubmissionRunStatus.NONE, label: 'none' }, // status
1866
- [exports.SubmissionRunStatus.RECEIVED]: { value: exports.SubmissionRunStatus.RECEIVED, label: 'received' }, // state
1867
- [exports.SubmissionRunStatus.COMPILING]: { value: exports.SubmissionRunStatus.COMPILING, label: 'compiling' }, // state
1868
- [exports.SubmissionRunStatus.COMPILED]: { value: exports.SubmissionRunStatus.COMPILED, label: 'compiled' }, // status
1869
- [exports.SubmissionRunStatus.COMPILATION_ERROR]: { value: exports.SubmissionRunStatus.COMPILATION_ERROR, label: 'compilation error' }, // status
1870
- [exports.SubmissionRunStatus.FETCHING_TEST_CASES]: {
1871
- value: exports.SubmissionRunStatus.FETCHING_TEST_CASES,
1872
- label: 'fetching test cases',
1873
- }, // state
1874
- [exports.SubmissionRunStatus.RUNNING_TEST_CASE]: { value: exports.SubmissionRunStatus.RUNNING_TEST_CASE, label: 'running test case' }, // state
1875
- [exports.SubmissionRunStatus.RUNNING_TEST_CASES]: {
1876
- value: exports.SubmissionRunStatus.RUNNING_TEST_CASES,
1877
- label: 'running test cases',
1878
- }, // state
1879
- [exports.SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES]: {
1880
- value: exports.SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES,
1881
- label: 'running sample cases',
1882
- }, // state
1883
- [exports.SubmissionRunStatus.EXECUTED_TEST_CASE]: {
1884
- value: exports.SubmissionRunStatus.EXECUTED_TEST_CASE,
1885
- label: 'executed test case',
1886
- }, // status
1887
- [exports.SubmissionRunStatus.FAILED_TEST_CASE]: { value: exports.SubmissionRunStatus.FAILED_TEST_CASE, label: 'failed test case' }, // status
1888
- [exports.SubmissionRunStatus.JUDGING_TEST_CASE]: { value: exports.SubmissionRunStatus.JUDGING_TEST_CASE, label: 'judging test case' }, // state
1889
- [exports.SubmissionRunStatus.GRADING]: { value: exports.SubmissionRunStatus.GRADING, label: 'grading' }, // status
1890
- [exports.SubmissionRunStatus.FAILED]: { value: exports.SubmissionRunStatus.FAILED, label: 'failed' }, // status
1891
- [exports.SubmissionRunStatus.COMPLETED]: { value: exports.SubmissionRunStatus.COMPLETED, label: 'completed' }, // status
1892
- };
1893
- const RUNNER_TYPE = {
1894
- [exports.RunnerType.HIGH_PERFORMANCE]: { value: exports.RunnerType.HIGH_PERFORMANCE, label: 'high performance' },
1895
- [exports.RunnerType.LOW_PERFORMANCE]: { value: exports.RunnerType.LOW_PERFORMANCE, label: 'low performance' },
1896
- };
1897
-
1898
- const PROBLEM_INPUT = {
1899
- [exports.ProblemInput.STANDARD]: { value: exports.ProblemInput.STANDARD, label: 'standard' },
1900
- [exports.ProblemInput.INTERACTIVE]: { value: exports.ProblemInput.INTERACTIVE, label: 'interactive' },
1901
- };
1902
- const PROBLEM_OUTPUT = {
1903
- [exports.ProblemOutput.STANDARD]: { value: exports.ProblemOutput.STANDARD, label: 'standard' },
1904
- [exports.ProblemOutput.DYNAMIC]: { value: exports.ProblemOutput.DYNAMIC, label: 'dynamic' },
1905
- [exports.ProblemOutput.INTERACTIVE]: { value: exports.ProblemOutput.INTERACTIVE, label: 'interactive' },
1906
- };
1907
- const PROBLEM_MODES = [exports.ProblemScoringMode.TOTAL, exports.ProblemScoringMode.SUBTASK, exports.ProblemScoringMode.PARTIAL];
1908
- const PROBLEM_MODE = {
1909
- [exports.ProblemScoringMode.TOTAL]: {
1910
- value: exports.ProblemScoringMode.TOTAL,
1911
- label: 'total',
1912
- description: 'if all test cases are Accepted the result is Accepted '
1913
- + 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
1914
- },
1915
- [exports.ProblemScoringMode.SUBTASK]: {
1916
- value: exports.ProblemScoringMode.SUBTASK,
1917
- label: 'subtask',
1918
- description: 'the test cases are grouped and each group of test cases is assigned a score, '
1919
- + 'if all test cases in a group are Accepted then the score assigned to that group of test cases is added to total score, '
1920
- + 'if total score is equal to the sum of the assigned scores of all groups of test cases then the result is Accepted, '
1921
- + 'otherwise if the total score is greater than zero the result is Partial Accepted with the total accumulated score, '
1922
- + 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
1923
- },
1924
- [exports.ProblemScoringMode.PARTIAL]: {
1925
- value: exports.ProblemScoringMode.PARTIAL,
1926
- label: 'partial',
1927
- description: 'the test cases are grouped and each group is associated with X points, '
1928
- + 'and each test case in a group scores X points ',
1929
- },
1930
- };
1931
- const PROBLEM_TYPES = [exports.ProblemType.STANDARD, exports.ProblemType.DYNAMIC, exports.ProblemType.INTERACTIVE];
1932
- const PROBLEM_TYPE = {
1933
- [exports.ProblemType.STANDARD]: {
1934
- value: exports.ProblemType.STANDARD,
1935
- label: 'standard',
1936
- description: 'The contestant submit a single source code in one of the allowed programming languages. '
1937
- + 'The source code is either standalone or to be compiled. '
1938
- + 'The resulting user\'s executable does I/O standard input and output. '
1939
- + 'The output produced by the contestant\'s program is then compared to the correct output using a simple diff algorithm.',
1940
- },
1941
- [exports.ProblemType.INTERACTIVE]: {
1942
- value: exports.ProblemType.INTERACTIVE, label: 'interactive', description: 'developing..',
1943
- },
1944
- [exports.ProblemType.DYNAMIC]: {
1945
- value: exports.ProblemType.DYNAMIC,
1946
- label: 'dynamic',
1947
- description: 'The contestant submit a single source code in one of the allowed programming languages. '
1948
- + 'The user\'s source code is either standalone or to be compiled. '
1949
- + 'The resulting user\'s executable does I/O standard input and output. '
1950
- + 'The output produced by the contestant\'s program is saved. '
1951
- + 'The problem editor save a single source code in C++ 17. '
1952
- + 'The editor\'s source code can read judge input filepath argv[1], judge output filepath argv[2], user\'s output filepath argv[3], user\'s error filepath argv[4], user\'s log filepath argv[5], user\'s source filepath argv[6] and submission information filepath argv[7] (companyId, submitId, runId, userId, contestId, problemId, language, userNickname, timestamp). '
1953
- + 'The resulting editor\'s executable should be "AC" or a number between 1 and 100 for partial accepted',
1954
- },
1955
- };
1956
- const PROBLEM_ROLE = {
1957
- [exports.Role.RESTRICTED]: { value: exports.Role.RESTRICTED, label: 'restricted', level: 7 },
1958
- [exports.Role.GUEST]: { value: exports.Role.GUEST, label: 'guest', level: 6 },
1959
- [exports.Role.REGULAR]: { value: exports.Role.REGULAR, label: 'regular', level: 5 },
1960
- [exports.Role.CREATOR]: { value: exports.Role.CREATOR, label: 'creator', level: 4 },
1961
- [exports.Role.MANAGER]: { value: exports.Role.MANAGER, label: 'manager', level: 3 },
1962
- [exports.Role.MASTER]: { value: exports.Role.MASTER, label: 'master', level: 2 },
1963
- [exports.Role.ADMIN]: { value: exports.Role.ADMIN, label: 'admin', level: 1 },
1964
- [exports.Role.SUPER_ADMIN]: { value: exports.Role.SUPER_ADMIN, label: 'super admin', level: 0 },
1965
- };
1966
-
1967
- const _TYPE = ':type';
1968
- const _KEY = ':key';
1969
- const _TAB = ':tab';
1970
- const _SUB_TAB = ':subTab?';
1971
- const _SUB_SUB_TAB = ':subSubTab?';
1972
- const PAGE = 'page';
1973
- const PAGE_SIZE = 'size';
1974
-
1975
- const ERROR = {
1976
- // Http Errors
1977
- [exports.ErrorCode.ERR500]: { value: exports.ErrorCode.ERR500, message: 'internal server error', status: 500 },
1978
- [exports.ErrorCode.ERR400]: { value: exports.ErrorCode.ERR400, message: 'bad request', status: 400 },
1979
- [exports.ErrorCode.ERR401]: { value: exports.ErrorCode.ERR401, message: 'unauthorized', status: 401 },
1980
- [exports.ErrorCode.ERR403]: { value: exports.ErrorCode.ERR403, message: 'forbidden', status: 403 },
1981
- [exports.ErrorCode.ERR404]: { value: exports.ErrorCode.ERR404, message: 'not found', status: 404 },
1982
- [exports.ErrorCode.ERR405]: { value: exports.ErrorCode.ERR405, message: 'method not allowed', status: 405 },
1983
- // UI general errors
1984
- [exports.ErrorCode.ERR9997]: { value: exports.ErrorCode.ERR9997, message: 'aborted request', status: 400 },
1985
- [exports.ErrorCode.ERR9998]: { value: exports.ErrorCode.ERR9998, message: 'error on response', status: 400 },
1986
- [exports.ErrorCode.ERR9999]: { value: exports.ErrorCode.ERR9999, message: 'service no found', status: 400 },
1987
- // ORGANIZATION ERRORS ERR99XX
1988
- [exports.ErrorCode.ERR9900]: { value: exports.ErrorCode.ERR9900, message: 'internal server error on organization service', status: 500 },
1989
- // Organization server errors
1990
- [exports.ErrorCode.ERR9910]: { value: exports.ErrorCode.ERR9910, message: 'organization not created', status: 500 },
1991
- [exports.ErrorCode.ERR9911]: { value: exports.ErrorCode.ERR9911, message: 'organization not found', status: 500 },
1992
- [exports.ErrorCode.ERR9912]: { value: exports.ErrorCode.ERR9912, message: 'organization not updated', status: 500 },
1993
- [exports.ErrorCode.ERR9913]: { value: exports.ErrorCode.ERR9913, message: 'organization not deleted', status: 500 },
1994
- // Organization user permission error
1995
- [exports.ErrorCode.ERR9914]: { value: exports.ErrorCode.ERR9914, message: 'not allowed to create the organization', status: 400 },
1996
- [exports.ErrorCode.ERR9915]: { value: exports.ErrorCode.ERR9915, message: 'not allowed to view the organization', status: 400 },
1997
- [exports.ErrorCode.ERR9916]: { value: exports.ErrorCode.ERR9916, message: 'not allowed to updated the organization', status: 400 },
1998
- [exports.ErrorCode.ERR9917]: { value: exports.ErrorCode.ERR9917, message: 'not allowed to deleted the organization', status: 400 },
1999
- // USER ERRORS ERR00XX
2000
- [exports.ErrorCode.ERR0000]: { value: exports.ErrorCode.ERR0000, message: 'internal server error on users service', status: 500 },
2001
- // User server errors
2002
- [exports.ErrorCode.ERR0010]: { value: exports.ErrorCode.ERR0010, message: 'user not created', status: 500 },
2003
- [exports.ErrorCode.ERR0011]: { value: exports.ErrorCode.ERR0011, message: 'user not found', status: 500 },
2004
- [exports.ErrorCode.ERR0012]: { value: exports.ErrorCode.ERR0012, message: 'user not updated', status: 500 },
2005
- [exports.ErrorCode.ERR0013]: { value: exports.ErrorCode.ERR0013, message: 'user not deleted', status: 500 },
2006
- // User user permission error
2007
- [exports.ErrorCode.ERR0014]: { value: exports.ErrorCode.ERR0014, message: 'not allowed to create the user', status: 400 },
2008
- [exports.ErrorCode.ERR0015]: { value: exports.ErrorCode.ERR0015, message: 'not allowed to view the user', status: 400 },
2009
- [exports.ErrorCode.ERR0016]: { value: exports.ErrorCode.ERR0016, message: 'not allowed to updated the user', status: 400 },
2010
- [exports.ErrorCode.ERR0017]: { value: exports.ErrorCode.ERR0017, message: 'not allowed to deleted the user', status: 400 },
2011
- // User status permissions errors
2012
- [exports.ErrorCode.ERR0018]: { value: exports.ErrorCode.ERR0018, message: 'user is reported', status: 400 },
2013
- [exports.ErrorCode.ERR0019]: { value: exports.ErrorCode.ERR0019, message: 'user is archived', status: 400 },
2014
- // User others permissions errors
2015
- [exports.ErrorCode.ERR0020]: { value: exports.ErrorCode.ERR0020, message: 'user with email requested not found', status: 400 },
2016
- [exports.ErrorCode.ERR0021]: { value: exports.ErrorCode.ERR0021, message: 'user with nickname requested not found', status: 400 },
2017
- [exports.ErrorCode.ERR0022]: { value: exports.ErrorCode.ERR0022, message: 'the email is already registered', status: 400 },
2018
- [exports.ErrorCode.ERR0023]: { value: exports.ErrorCode.ERR0023, message: 'the nickname is already taken', status: 400 },
2019
- [exports.ErrorCode.ERR0024]: { value: exports.ErrorCode.ERR0024, message: 'incorrect password', status: 400 },
2020
- // User sessions errors
2021
- [exports.ErrorCode.ERR0050]: { value: exports.ErrorCode.ERR0050, message: 'user session not created', status: 500 },
2022
- [exports.ErrorCode.ERR0051]: { value: exports.ErrorCode.ERR0051, message: 'user session not found', status: 500 },
2023
- [exports.ErrorCode.ERR0052]: { value: exports.ErrorCode.ERR0052, message: 'user session not updated', status: 500 },
2024
- [exports.ErrorCode.ERR0053]: { value: exports.ErrorCode.ERR0053, message: 'user session not deleted', status: 500 },
2025
- // PROBLEM ERRORS ERR01XX
2026
- [exports.ErrorCode.ERR0100]: { value: exports.ErrorCode.ERR0100, message: 'internal server error on problems service', status: 500 },
2027
- // Problem server errors
2028
- [exports.ErrorCode.ERR0110]: { value: exports.ErrorCode.ERR0110, message: 'problem not created', status: 500 },
2029
- [exports.ErrorCode.ERR0111]: { value: exports.ErrorCode.ERR0111, message: 'problem not found', status: 500 },
2030
- [exports.ErrorCode.ERR0112]: { value: exports.ErrorCode.ERR0112, message: 'problem not updated', status: 500 },
2031
- [exports.ErrorCode.ERR0113]: { value: exports.ErrorCode.ERR0113, message: 'problem not deleted', status: 500 },
2032
- // Problem user permission error
2033
- [exports.ErrorCode.ERR0114]: { value: exports.ErrorCode.ERR0114, message: 'not allowed to create the problem', status: 400 },
2034
- [exports.ErrorCode.ERR0115]: { value: exports.ErrorCode.ERR0115, message: 'not allowed to view the problem', status: 400 },
2035
- [exports.ErrorCode.ERR0116]: { value: exports.ErrorCode.ERR0116, message: 'not allowed to updated the problem', status: 400 },
2036
- [exports.ErrorCode.ERR0117]: { value: exports.ErrorCode.ERR0117, message: 'not allowed to deleted the problem', status: 400 },
2037
- // Problem others permissions errors
2038
- [exports.ErrorCode.ERR0118]: { value: exports.ErrorCode.ERR0118, message: 'problem mode not supported', status: 500 },
2039
- [exports.ErrorCode.ERR0119]: { value: exports.ErrorCode.ERR0119, message: 'problem type not supported', status: 500 },
2040
- [exports.ErrorCode.ERR0120]: { value: exports.ErrorCode.ERR0120, message: 'problem time limit must be a number', status: 500 },
2041
- [exports.ErrorCode.ERR0121]: { value: exports.ErrorCode.ERR0121, message: 'problem memory limit must be number', status: 500 },
2042
- [exports.ErrorCode.ERR0122]: { value: exports.ErrorCode.ERR0122, message: 'test case file empty', status: 400 },
2043
- // Contest Errors ERR02XX
2044
- [exports.ErrorCode.ERR0200]: { value: exports.ErrorCode.ERR0200, message: 'internal server error on contests service', status: 500 },
2045
- // Contest Server Error
2046
- [exports.ErrorCode.ERR0210]: { value: exports.ErrorCode.ERR0210, message: 'contest not created', status: 500 },
2047
- [exports.ErrorCode.ERR0211]: { value: exports.ErrorCode.ERR0211, message: 'contest not found', status: 500 },
2048
- [exports.ErrorCode.ERR0212]: { value: exports.ErrorCode.ERR0212, message: 'contest not updated', status: 500 },
2049
- [exports.ErrorCode.ERR0213]: { value: exports.ErrorCode.ERR0213, message: 'contest not deleted', status: 500 },
2050
- // Contest User Permission error
2051
- [exports.ErrorCode.ERR0214]: { value: exports.ErrorCode.ERR0214, message: 'not allowed to create the contest', status: 400 },
2052
- [exports.ErrorCode.ERR0215]: { value: exports.ErrorCode.ERR0215, message: 'not allowed to view the contest', status: 400 },
2053
- [exports.ErrorCode.ERR0216]: { value: exports.ErrorCode.ERR0216, message: 'not allowed to updated the contest', status: 400 },
2054
- [exports.ErrorCode.ERR0217]: { value: exports.ErrorCode.ERR0217, message: 'not allowed to deleted the contest', status: 400 },
2055
- // Contest Others permissions errors
2056
- [exports.ErrorCode.ERR0218]: { value: exports.ErrorCode.ERR0218, message: 'not allowed to register to the contest', status: 400 },
2057
- [exports.ErrorCode.ERR0219]: { value: exports.ErrorCode.ERR0219, message: 'is already registered', status: 400 },
2058
- [exports.ErrorCode.ERR0220]: { value: exports.ErrorCode.ERR0220, message: 'not allowed to view contests', status: 400 },
2059
- [exports.ErrorCode.ERR0230]: { value: exports.ErrorCode.ERR0230, message: 'scoreboard not created', status: 500 },
2060
- [exports.ErrorCode.ERR0231]: { value: exports.ErrorCode.ERR0231, message: 'scoreboard not found', status: 500 },
2061
- [exports.ErrorCode.ERR0232]: { value: exports.ErrorCode.ERR0232, message: 'scoreboard not updated', status: 500 },
2062
- [exports.ErrorCode.ERR0233]: { value: exports.ErrorCode.ERR0233, message: 'scoreboard not deleted', status: 500 },
2063
- [exports.ErrorCode.ERR0234]: { value: exports.ErrorCode.ERR0234, message: 'not allowed to create the scoreboard', status: 400 },
2064
- [exports.ErrorCode.ERR0235]: { value: exports.ErrorCode.ERR0235, message: 'not allowed to view the scoreboard', status: 400 },
2065
- [exports.ErrorCode.ERR0236]: { value: exports.ErrorCode.ERR0236, message: 'not allowed to update the scoreboard', status: 400 },
2066
- [exports.ErrorCode.ERR0237]: { value: exports.ErrorCode.ERR0237, message: 'not allowed to delete the scoreboard', status: 400 },
2067
- [exports.ErrorCode.ERR0240]: { value: exports.ErrorCode.ERR0240, message: 'clarification not created', status: 500 },
2068
- [exports.ErrorCode.ERR0241]: { value: exports.ErrorCode.ERR0241, message: 'clarification not found', status: 500 },
2069
- [exports.ErrorCode.ERR0242]: { value: exports.ErrorCode.ERR0242, message: 'clarification not updated', status: 500 },
2070
- [exports.ErrorCode.ERR0243]: { value: exports.ErrorCode.ERR0243, message: 'clarification not deleted', status: 500 },
2071
- [exports.ErrorCode.ERR0244]: { value: exports.ErrorCode.ERR0244, message: 'not allowed to submit clarification', status: 400 },
2072
- [exports.ErrorCode.ERR0245]: { value: exports.ErrorCode.ERR0245, message: 'not allowed to view clarification', status: 400 },
2073
- [exports.ErrorCode.ERR0246]: { value: exports.ErrorCode.ERR0246, message: 'not allowed to update clarification', status: 400 },
2074
- [exports.ErrorCode.ERR0247]: { value: exports.ErrorCode.ERR0247, message: 'not allowed to delete clarification', status: 400 },
2075
- // Submission Errors ERR03XXX
2076
- [exports.ErrorCode.ERR0300]: {
2077
- value: exports.ErrorCode.ERR0300,
2078
- message: 'internal server error on submissions service',
2079
- status: 500,
2080
- },
2081
- [exports.ErrorCode.ERR0301]: { value: exports.ErrorCode.ERR0301, message: 'submission not found', status: 500 },
2082
- [exports.ErrorCode.ERR0302]: { value: exports.ErrorCode.ERR0302, message: 'submission not created', status: 500 },
2083
- [exports.ErrorCode.ERR0303]: { value: exports.ErrorCode.ERR0303, message: 'submission not updated', status: 500 },
2084
- [exports.ErrorCode.ERR0310]: { value: exports.ErrorCode.ERR0310, message: 'source empty', status: 400 },
2085
- [exports.ErrorCode.ERR0311]: { value: exports.ErrorCode.ERR0311, message: 'programming language not supported', status: 400 },
2086
- [exports.ErrorCode.ERR0321]: {
2087
- value: exports.ErrorCode.ERR0321,
2088
- message: 'not allowed submit the problem in the contest',
2089
- status: 400,
2090
- },
2091
- [exports.ErrorCode.ERR0331]: { value: exports.ErrorCode.ERR0331, message: 'judgement unavailable', status: 400 },
2092
- // Utils Errors ERR04XX
2093
- [exports.ErrorCode.ERR0400]: { value: exports.ErrorCode.ERR0400, message: 'internal server error on utils services', status: 500 },
2094
- [exports.ErrorCode.ERR0410]: { value: exports.ErrorCode.ERR0410, message: 'empty image', status: 400 },
2095
- [exports.ErrorCode.ERR0420]: { value: exports.ErrorCode.ERR0420, message: '', status: 400 }, // codes
2096
- [exports.ErrorCode.ERR0421]: { value: exports.ErrorCode.ERR0421, message: 'compilation failed', status: 400 }, // codes
2097
- [exports.ErrorCode.ERR0430]: { value: exports.ErrorCode.ERR0430, message: '', status: 400 }, // files
2098
- [exports.ErrorCode.ERR0440]: { value: exports.ErrorCode.ERR0440, message: 'the email could not be sent', status: 400 }, // mails
2099
- // TEAMS ERRORS ERR06XX
2100
- [exports.ErrorCode.ERR0600]: { value: exports.ErrorCode.ERR0600, message: 'internal server error on teams service', status: 500 },
2101
- // Teams server errors
2102
- [exports.ErrorCode.ERR0610]: { value: exports.ErrorCode.ERR0610, message: 'team not created', status: 400 },
2103
- [exports.ErrorCode.ERR0611]: { value: exports.ErrorCode.ERR0611, message: 'team not found', status: 400 },
2104
- [exports.ErrorCode.ERR0612]: { value: exports.ErrorCode.ERR0612, message: 'team not updated', status: 400 },
2105
- [exports.ErrorCode.ERR0613]: { value: exports.ErrorCode.ERR0613, message: 'team not deleted', status: 400 },
2106
- // Teams user permission error
2107
- [exports.ErrorCode.ERR0614]: { value: exports.ErrorCode.ERR0614, message: 'not allowed to create the team', status: 400 },
2108
- [exports.ErrorCode.ERR0615]: { value: exports.ErrorCode.ERR0615, message: 'not allowed to view the team', status: 400 },
2109
- [exports.ErrorCode.ERR0616]: { value: exports.ErrorCode.ERR0616, message: 'not allowed to updated the team', status: 400 },
2110
- [exports.ErrorCode.ERR0617]: { value: exports.ErrorCode.ERR0617, message: 'not allowed to deleted the team', status: 400 },
2111
- // Teams status permission error
2112
- [exports.ErrorCode.ERR0618]: { value: exports.ErrorCode.ERR0618, message: 'team is reported', status: 400 },
2113
- [exports.ErrorCode.ERR0619]: { value: exports.ErrorCode.ERR0619, message: 'team is archived', status: 400 },
2114
- // FILES ERRORS ERR08XX
2115
- [exports.ErrorCode.ERR0800]: { value: exports.ErrorCode.ERR0800, message: 'internal server error on files service', status: 500 },
2116
- // Files server errors
2117
- [exports.ErrorCode.ERR0810]: { value: exports.ErrorCode.ERR0810, message: 'file not created', status: 400 },
2118
- [exports.ErrorCode.ERR0811]: { value: exports.ErrorCode.ERR0811, message: 'file not found', status: 400 },
2119
- [exports.ErrorCode.ERR0812]: { value: exports.ErrorCode.ERR0812, message: 'file not updated', status: 400 },
2120
- [exports.ErrorCode.ERR0813]: { value: exports.ErrorCode.ERR0813, message: 'file not deleted', status: 400 },
2121
- // Files user permission error
2122
- [exports.ErrorCode.ERR0814]: { value: exports.ErrorCode.ERR0814, message: 'not allowed to create the file', status: 400 },
2123
- [exports.ErrorCode.ERR0815]: { value: exports.ErrorCode.ERR0815, message: 'not allowed to view the file', status: 400 },
2124
- [exports.ErrorCode.ERR0816]: { value: exports.ErrorCode.ERR0816, message: 'not allowed to updated the file', status: 400 },
2125
- [exports.ErrorCode.ERR0817]: { value: exports.ErrorCode.ERR0817, message: 'not allowed to deleted the file', status: 400 },
2126
- // Files status permission error
2127
- [exports.ErrorCode.ERR0818]: { value: exports.ErrorCode.ERR0818, message: 'file is reserved', status: 400 },
2128
- [exports.ErrorCode.ERR0819]: { value: exports.ErrorCode.ERR0819, message: 'file is private', status: 400 },
2129
- [exports.ErrorCode.ERR0820]: { value: exports.ErrorCode.ERR0820, message: 'file is archived', status: 400 },
2130
- };
2131
-
2132
- const FILE_TYPE = {
2133
- [exports.FileType.FILE]: { value: exports.FileType.FILE, label: 'file' },
2134
- [exports.FileType.FOLDER]: { value: exports.FileType.FOLDER, label: 'folder' },
2135
- };
2136
- const FILE_ROLE = {
2137
- [exports.Role.RESTRICTED]: { value: exports.Role.RESTRICTED, label: 'restricted', level: 5 },
2138
- [exports.Role.GUEST]: { value: exports.Role.GUEST, label: 'guest', level: 4 },
2139
- [exports.Role.REGULAR]: { value: exports.Role.REGULAR, label: 'regular', level: 3 },
2140
- [exports.Role.MASTER]: { value: exports.Role.MASTER, label: 'master', level: 2 },
2141
- [exports.Role.ADMIN]: { value: exports.Role.ADMIN, label: 'admin', level: 1 },
2142
- [exports.Role.SUPER_ADMIN]: { value: exports.Role.SUPER_ADMIN, label: 'super admin', level: 0 },
2143
- };
2144
- const ENTITY_STATE = {
2145
- [exports.EntityState.RELEASED]: {
2146
- value: exports.EntityState.RELEASED,
2147
- label: 'released',
2148
- },
2149
- [exports.EntityState.ARCHIVED]: {
2150
- value: exports.EntityState.ARCHIVED,
2151
- label: 'archived',
2152
- },
2153
- };
2154
- const ENTITY_ACCESS = {
2155
- [exports.EntityAccess.PRIVATE]: {
2156
- value: exports.EntityAccess.PRIVATE,
2157
- label: 'private',
2158
- description: 'the record will be visible and editable only to the owner',
2159
- },
2160
- [exports.EntityAccess.RESTRICTED]: {
2161
- value: exports.EntityAccess.RESTRICTED,
2162
- label: 'restricted',
2163
- description: 'the record will be visible to viewers and the owner and editable to editors and the owner',
2164
- },
2165
- [exports.EntityAccess.PUBLIC]: {
2166
- value: exports.EntityAccess.PUBLIC,
2167
- label: 'public',
2168
- description: 'the record will be visible to anyone and editable to editors and the owner',
2169
- },
2170
- [exports.EntityAccess.EXPOSED]: {
2171
- value: exports.EntityAccess.EXPOSED,
2172
- label: 'exposed',
2173
- description: 'the record will be visible and editable to anyone',
2174
- },
2175
- };
2176
-
2177
- const SYSTEM_ROLE = {
2178
- [SystemRole.GUEST]: { value: SystemRole.GUEST, label: 'guest', level: 5 },
2179
- [SystemRole.REGULAR]: { value: SystemRole.REGULAR, label: 'regular', level: 4 },
2180
- [SystemRole.MANAGER]: { value: SystemRole.MANAGER, label: 'manager', level: 3 },
2181
- [SystemRole.MASTER]: { value: SystemRole.MASTER, label: 'master', level: 2 },
2182
- [SystemRole.ADMIN]: { value: SystemRole.ADMIN, label: 'admin', level: 1 },
2183
- [SystemRole.SUPER_ADMIN]: { value: SystemRole.SUPER_ADMIN, label: 'super admin', level: 0 },
2184
- };
2185
-
2186
- const MEMBER_ROLE = {
2187
- [MemberRole.COACH]: { value: MemberRole.COACH, label: 'coach' },
2188
- [MemberRole.CO_COACH]: { value: MemberRole.CO_COACH, label: 'co-coach' },
2189
- [MemberRole.STAFF]: { value: MemberRole.STAFF, label: 'staff' },
2190
- [MemberRole.ATTENDEE]: { value: MemberRole.ATTENDEE, label: 'attendee' },
2191
- [MemberRole.RESERVE]: { value: MemberRole.RESERVE, label: 'reserve' },
2192
- [MemberRole.CONTESTANT]: { value: MemberRole.CONTESTANT, label: 'contestant' },
2193
- };
2194
- const TEAM_ROLE = {
2195
- [TeamRole.RESTRICTED]: { value: TeamRole.RESTRICTED, label: 'restricted', level: 5 },
2196
- [TeamRole.GUEST]: { value: TeamRole.GUEST, label: 'guest', level: 4 },
2197
- [TeamRole.REGULAR]: { value: TeamRole.REGULAR, label: 'regular', level: 3 },
2198
- [TeamRole.MANAGER]: { value: TeamRole.MANAGER, label: 'manager', level: 2 },
2199
- [TeamRole.ADMIN]: { value: TeamRole.ADMIN, label: 'admin', level: 1 },
2200
- [TeamRole.SUPER_ADMIN]: { value: TeamRole.SUPER_ADMIN, label: 'super admin', level: 0 },
2201
- };
2202
-
2203
- const ONE_SECOND = 1000;
2204
- const SEC_30 = ONE_SECOND * 30;
2205
- const SEC_60 = ONE_SECOND * 60;
2206
- const SEC_90 = ONE_SECOND * 90;
2207
- const SEC_120 = ONE_SECOND * 120;
2208
- const ONE_MINUTE = ONE_SECOND * 60;
2209
- const ONE_HOUR = ONE_MINUTE * 60;
2210
- const ONE_DAY = ONE_HOUR * 24;
2211
- const ONE_WEEK = ONE_DAY * 7;
2212
-
2213
- const USER_STATUS = {
2214
- [UserStatus.ACTIVE]: { value: UserStatus.ACTIVE, label: 'active' },
2215
- [UserStatus.REPORTED]: { value: UserStatus.REPORTED, label: 'reported' },
2216
- [UserStatus.ARCHIVED]: { value: UserStatus.ARCHIVED, label: 'archived' },
2217
- };
2218
- const USER_ROLE = {
2219
- [UserRole.RESTRICTED]: { value: UserRole.RESTRICTED, label: 'restricted', level: 6 },
2220
- [UserRole.GUEST]: { value: UserRole.GUEST, label: 'guest', level: 5 },
2221
- [UserRole.LIMITED]: { value: UserRole.LIMITED, label: 'limited', level: 4 },
2222
- [UserRole.REGULAR]: { value: UserRole.REGULAR, label: 'regular', level: 3 },
2223
- [UserRole.MANAGER]: { value: UserRole.MANAGER, label: 'manager', level: 2 },
2224
- [UserRole.ADMIN]: { value: UserRole.ADMIN, label: 'admin', level: 1 },
2225
- [UserRole.SUPER_ADMIN]: { value: UserRole.SUPER_ADMIN, label: 'super admin', level: 0 },
2226
- };
2227
- const EMPTY_USER_PERMISSIONS = {
2228
- users: {
2229
- create: false,
2230
- manage: false,
2231
- administrate: false,
2232
- },
2233
- problems: {
2234
- create: false,
2235
- manage: false,
2236
- },
2237
- submissions: {
2238
- manage: false,
2239
- },
2240
- contests: {
2241
- create: false,
2242
- manage: false,
2243
- },
2244
- organization: {
2245
- manage: false,
2246
- administrate: false,
2247
- },
2248
- services: {
2249
- administrate: false,
2250
- },
2251
- };
2252
-
2253
- // TOPIC channels
2254
- // The backend publishes each event once on the channel of its topic and Ably does the fan-out.
2255
- // Who can subscribe to each channel is decided by the API in the Ably token (capability), never by the client.
2256
- // Dynamic segments are encoded so a key can never inject a `:` (the Ably segment separator used by the wildcards).
2257
- const segment = (value) => encodeURIComponent(value);
2258
- /** private: events of one session (code runs, requested data) */
2259
- const CHANNEL_SESSION = (sessionId) => `session:${segment(sessionId)}`;
2260
- /** private: events of one user (own submissions while the contest is frozen, notifications, own problem crawls) */
2261
- const CHANNEL_USER = (userId) => `user:${segment(userId)}`;
2262
- /**
2263
- * per role: public events of one user (judging of its submissions visible to everyone, see `UserChannelRole`).
2264
- * By its public key (`getUserKey(nickname, organizationKey)`), the one the clients know; the private channel
2265
- * (`CHANNEL_USER`) is by id. They never collide: the role channel has one more segment.
2266
- */
2267
- const CHANNEL_USER_ROLE = (userKey, role) => `user:${segment(userKey)}:${role}`;
2268
- /** public: status of a submission when it is visible to everyone */
2269
- const CHANNEL_SUBMISSION = (submitId) => `submission:${segment(submitId)}`;
2270
- /** per role: events of a problem for one role (judging of its submissions, see `ProblemChannelRole`) */
2271
- const CHANNEL_PROBLEM = (problemKey, role) => `problem:${segment(problemKey)}:${role}`;
2272
- /** per role: events of a contest for one role (and the roles above it, see `ContestChannelRole`) */
2273
- const CHANNEL_CONTEST = (contestKey, role) => `contest:${segment(contestKey)}:${role}`;
2274
- /**
2275
- * presence of the clients (tabs) of the logged users of a organization (by its key), data: `UserPresenceData`.
2276
- * The clients only enter (capability `presence`), only the administrators of the organization receive it
2277
- * (capability `presence-subscribe`). Ably limits the presence members per channel (200 by default,
2278
- * more with server-side batching enabled on the `presence` namespace).
2279
- * The identity of a member is its `clientId` (`sessionId|uiId`, verified by Ably), never its data.
2280
- */
2281
- const CHANNEL_ORGANIZATION_PRESENCE = (organizationKey) => `presence:organization:${segment(organizationKey)}`;
2282
- // capability resources (wildcards) of the public channels.
2283
- // Ably: a trailing `*` replaces one or more segments, any other `*` exactly one segment. So `user:*:spectators`
2284
- // matches every `user:{userKey}:spectators` but never the private `user:{userId}`.
2285
- // There is no public `problem:*`: it would also match the role channels `problem:{problemKey}:{role}`.
2286
- const CHANNEL_SUBMISSION_ALL = 'submission:*';
2287
- const CHANNEL_USER_SPECTATORS_ALL = `user:*:${exports.UserChannelRole.SPECTATORS}`;
2288
- /**
2289
- * Returns the contest and role of a `CHANNEL_CONTEST` channel name, or null if it is not one.
2290
- */
2291
- const getContestChannelParams = (channel) => {
2292
- const [namespace, contestKey, role, ...rest] = channel.split(':');
2293
- if (namespace !== 'contest' || !contestKey || rest.length || !Object.values(exports.ContestChannelRole).includes(role)) {
2294
- return null;
2295
- }
2296
- return { contestKey: decodeURIComponent(contestKey), role: role };
2297
- };
2298
- /**
2299
- * Returns the problem and role of a `CHANNEL_PROBLEM` channel name, or null if it is not one.
2300
- */
2301
- const getProblemChannelParams = (channel) => {
2302
- const [namespace, problemKey, role, ...rest] = channel.split(':');
2303
- if (namespace !== 'problem' || !problemKey || rest.length || !Object.values(exports.ProblemChannelRole).includes(role)) {
2304
- return null;
2305
- }
2306
- return { problemKey: decodeURIComponent(problemKey), role: role };
2307
- };
2308
-
2309
- const NEW_PAGE_SHEET = () => ({
2310
- id: uuid.v4(),
2311
- type: exports.WorksheetType.NEW_PAGE,
2312
- title: '',
2313
- points: 0,
2314
- });
2315
- const ASPECT_RATIO = {
2316
- [exports.AspectRatio.RATIO_21_9]: {
2317
- aspectRatio: exports.AspectRatio.RATIO_21_9,
2318
- width: 2520,
2319
- height: 1080,
2320
- decimal: 21 / 9,
2321
- label: 'ultrawide',
2322
- },
2323
- [exports.AspectRatio.RATIO_20_9]: {
2324
- aspectRatio: exports.AspectRatio.RATIO_20_9,
2325
- width: 2400,
2326
- height: 1080,
2327
- decimal: 20 / 9,
2328
- label: 'mobile wide',
2329
- },
2330
- [exports.AspectRatio.RATIO_16_9]: {
2331
- aspectRatio: exports.AspectRatio.RATIO_16_9,
2332
- width: 1920,
2333
- height: 1080,
2334
- decimal: 16 / 9,
2335
- label: 'widescreen',
2336
- },
2337
- [exports.AspectRatio.RATIO_16_10]: {
2338
- aspectRatio: exports.AspectRatio.RATIO_16_10,
2339
- width: 1920,
2340
- height: 1200,
2341
- decimal: 16 / 10,
2342
- label: 'widescreen tall',
2343
- },
2344
- [exports.AspectRatio.RATIO_3_2]: {
2345
- aspectRatio: exports.AspectRatio.RATIO_3_2,
2346
- width: 1440,
2347
- height: 960,
2348
- decimal: 3 / 2,
2349
- label: 'balanced',
2350
- },
2351
- [exports.AspectRatio.RATIO_4_3]: {
2352
- aspectRatio: exports.AspectRatio.RATIO_4_3,
2353
- width: 1024,
2354
- height: 768,
2355
- decimal: 4 / 3,
2356
- label: 'standard',
2357
- },
2358
- [exports.AspectRatio.RATIO_5_4]: {
2359
- aspectRatio: exports.AspectRatio.RATIO_5_4,
2360
- width: 1280,
2361
- height: 1024,
2362
- decimal: 5 / 4,
2363
- label: 'square old',
2364
- },
2365
- [exports.AspectRatio.RATIO_1_1]: {
2366
- aspectRatio: exports.AspectRatio.RATIO_1_1,
2367
- width: 1000,
2368
- height: 1000,
2369
- decimal: 1,
2370
- label: 'square',
2371
- },
2372
- };
2373
-
2374
- exports.ContestProblemBlockedByType = void 0;
2375
- (function (ContestProblemBlockedByType) {
2376
- ContestProblemBlockedByType["UNMET_PREREQUISITES"] = "UNMET_PREREQUISITES";
2377
- ContestProblemBlockedByType["MAX_ACCEPTED_SUBMISSIONS_ACHIEVED"] = "MAX_ACCEPTED_SUBMISSIONS_ACHIEVED";
2378
- ContestProblemBlockedByType["START_TIME_IN_THE_FUTURE"] = "START_TIME_IN_THE_FUTURE";
2379
- ContestProblemBlockedByType["END_TIME_IN_THE_PAST"] = "END_TIME_IN_THE_PAST";
2380
- })(exports.ContestProblemBlockedByType || (exports.ContestProblemBlockedByType = {}));
2381
-
2382
- exports.MemberType = void 0;
2383
- (function (MemberType) {
2384
- MemberType["USER"] = "USER";
2385
- MemberType["TEAM"] = "TEAM";
2386
- })(exports.MemberType || (exports.MemberType = {}));
2387
-
2388
- const isWorksheetAssignment = (assignment) => {
2389
- return assignment.type === exports.AssignmentClass.WORKSHEET;
2390
- };
2391
- const isCourseAssignment = (assignment) => {
2392
- return assignment.type === exports.AssignmentClass.COURSE;
2393
- };
2394
- const isContestAssignment = (assignment) => {
2395
- return assignment.type === exports.AssignmentClass.CONTEST;
2396
- };
2397
-
2398
- const getAssignmentCommentKey = (classKey, cycleKey, sessionKey, assignmentKey) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}`;
2399
- const getAssignmentUserCommentKey = (classKey, cycleKey, sessionKey, assignmentKey, userNickname, userOrganization) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}|user_nickname:${userNickname}|user_organization:${userOrganization}`;
2400
- const getProblemCommentKey = (problemKey) => `problem:${problemKey}`;
2401
- const getContestCommentKey = (contestKey) => `contest:${contestKey}`;
2402
-
2403
- const isEndlessContest = (settings) => {
2404
- return settings?.startsAt === MIN_DATE.getTime()
2405
- && settings?.frozenAt === MAX_DATE.getTime()
2406
- && settings?.silencedAt === MAX_DATE.getTime()
2407
- && settings?.endsAt === MAX_DATE.getTime()
2408
- && settings?.penalty === 0;
2409
- };
2410
- const isGlobalContest = (settings) => {
2411
- return settings?.startsAt === 0
2412
- && settings?.frozenAt === 0
2413
- && settings?.silencedAt === 0
2414
- && settings?.endsAt === 0
2415
- && settings?.penalty === 0;
2416
- };
2417
- const isPastContest = (settings) => {
2418
- return Date.now() > (settings?.endsAt ?? 0);
2419
- };
2420
- const isFutureContest = (settings) => {
2421
- return (settings?.startsAt ?? 0) > Date.now();
2422
- };
2423
-
2424
- const changeYear = (date, year) => {
2425
- const newDate = new Date(date);
2426
- newDate.setFullYear(year);
2427
- return newDate;
2428
- };
2429
- const changeMonth = (date, monthIndex) => {
2430
- const newDate = new Date(date);
2431
- newDate.setMonth(monthIndex);
2432
- return newDate;
2433
- };
2434
- const changeDay = (date, day) => {
2435
- const newDate = new Date(date);
2436
- newDate.setDate(day);
2437
- return newDate;
2438
- };
2439
- const changeHours = (date, hours) => {
2440
- const newDate = new Date(date);
2441
- newDate.setHours(hours);
2442
- return newDate;
2443
- };
2444
- const changeMinutes = (date, minutes) => {
2445
- const newDate = new Date(date);
2446
- newDate.setMinutes(minutes);
2447
- return newDate;
2448
- };
2449
- const changeSeconds = (date, seconds) => {
2450
- const newDate = new Date(date);
2451
- newDate.setSeconds(seconds);
2452
- return newDate;
2453
- };
2454
- const changeMilliseconds = (date, milliseconds) => {
2455
- const newDate = new Date(date);
2456
- newDate.setMilliseconds(milliseconds);
2457
- return newDate;
2458
- };
2459
- const decreaseYear = (date, count = 1) => changeYear(date, date.getFullYear() - count);
2460
- const increaseYear = (date, count = 1) => changeYear(date, date.getFullYear() + count);
2461
- const decreaseMonth = (date) => {
2462
- const newDate = new Date(date);
2463
- newDate.setMonth(newDate.getMonth() - 1);
2464
- return newDate;
2465
- };
2466
- const increaseMonth = (date) => {
2467
- const newDate = new Date(date);
2468
- newDate.setMonth(newDate.getMonth() + 1);
2469
- return newDate;
2470
- };
2471
- const decreaseDay = (date) => {
2472
- const newDate = new Date(date);
2473
- newDate.setDate(newDate.getDate() - 1);
2474
- return newDate;
2475
- };
2476
- const increaseDay = (date) => {
2477
- const newDate = new Date(date);
2478
- newDate.setDate(newDate.getDate() + 1);
2479
- return newDate;
2480
- };
2481
- const startOfDay = (date) => {
2482
- const newDate = new Date(date);
2483
- newDate.setHours(0, 0, 0, 0);
2484
- return newDate;
2485
- };
2486
- const endOfDay = (date) => {
2487
- const newDate = new Date(date);
2488
- newDate.setHours(23, 59, 59, 999);
2489
- return newDate;
2490
- };
2491
- const startOfMonth = (date) => {
2492
- const newDate = new Date(date);
2493
- newDate.setDate(1);
2494
- return startOfDay(newDate);
2495
- };
2496
- const endOfMonth = (date) => {
2497
- const nextMonth = startOfMonth(increaseMonth(date));
2498
- return new Date(nextMonth.getTime() - 1);
2499
- };
2500
- const startOfYear = (date) => {
2501
- const newDate = new Date(date);
2502
- newDate.setMonth(0);
2503
- return startOfMonth(newDate);
2504
- };
2505
- const endOfYear = (date) => {
2506
- const nextYear = startOfYear(increaseYear(date));
2507
- return new Date(nextYear.getTime() - 1);
2508
- };
2509
- const startOfWeek = (date) => {
2510
- const newDate = new Date(date);
2511
- while (newDate.getDay()) {
2512
- newDate.setDate(newDate.getDate() - 1);
2513
- }
2514
- return startOfDay(newDate);
2515
- };
2516
- const endOfWeek = (date) => {
2517
- const newDate = new Date(date);
2518
- while (newDate.getDay() < 6) {
2519
- newDate.setDate(newDate.getDate() + 1);
2520
- }
2521
- return endOfDay(newDate);
2522
- };
2523
- const startOfHour = (date) => {
2524
- const newDate = new Date(date);
2525
- newDate.setMinutes(0, 0, 0);
2526
- return newDate;
2527
- };
2528
- const endOfHour = (date) => {
2529
- const newDate = new Date(date);
2530
- newDate.setMinutes(59, 59, 999);
2531
- return newDate;
2532
- };
2533
- const startOfMinute = (date) => {
2534
- const newDate = new Date(date);
2535
- newDate.setSeconds(0, 0);
2536
- return newDate;
2537
- };
2538
- const endOfMinute = (date) => {
2539
- const newDate = new Date(date);
2540
- newDate.setSeconds(59, 999);
2541
- return newDate;
2542
- };
2543
- const startOfSecond = (date) => {
2544
- const newDate = new Date(date);
2545
- newDate.setMilliseconds(0);
2546
- return newDate;
2547
- };
2548
- const endOfSecond = (date) => {
2549
- const newDate = new Date(date);
2550
- newDate.setMilliseconds(999);
2551
- return newDate;
2552
- };
2553
- const isEqual = (a, b) => a.getTime() === b.getTime();
2554
- const isSameYear = (a, b) => a.getFullYear() === b.getFullYear();
2555
- const isSameMonth = (a, b) => isSameYear(a, b) && a.getMonth() === b.getMonth();
2556
- const isSameDay = (a, b) => isSameMonth(a, b) && a.getDate() === b.getDate();
2557
- const isSameHour = (a, b) => isSameDay(a, b) && a.getHours() === b.getHours();
2558
- const isSameMinute = (a, b) => isSameHour(a, b) && a.getMinutes() === b.getMinutes();
2559
- const isSameSecond = (a, b) => isSameMinute(a, b) && a.getSeconds() === b.getSeconds();
2560
- const isSameMillisecond = (a, b) => isEqual(a, b);
2561
- const isToday = (date) => isSameDay(date, new Date());
2562
- const isValidDate = (date) => date instanceof Date && !Number.isNaN(date.getTime());
2563
- const isAfter = (a, b) => a.getTime() > b.getTime();
2564
- const isBefore = (a, b) => a.getTime() < b.getTime();
2565
- const isYearAfter = (a, b) => a.getFullYear() > b.getFullYear();
2566
- const isMonthAfter = (a, b) => isYearAfter(a, b) || (isSameYear(a, b) && a.getMonth() > b.getMonth());
2567
- const isDayAfter = (a, b) => isMonthAfter(a, b) || (isSameMonth(a, b) && a.getDate() > b.getDate());
2568
- const isHoursAfter = (a, b) => isDayAfter(a, b) || (isSameDay(a, b) && a.getHours() > b.getHours());
2569
- const isMinutesAfter = (a, b) => isHoursAfter(a, b) || (isSameHour(a, b) && a.getMinutes() > b.getMinutes());
2570
- const isSecondsAfter = (a, b) => isMinutesAfter(a, b) || (isSameMinute(a, b) && a.getSeconds() > b.getSeconds());
2571
- const isMillisecondsAfter = (a, b) => isSecondsAfter(a, b) || (isSameSecond(a, b) && a.getMilliseconds() > b.getMilliseconds());
2572
- const isYearBefore = (a, b) => a.getFullYear() < b.getFullYear();
2573
- const isMonthBefore = (a, b) => isYearBefore(a, b) || (isSameYear(a, b) && a.getMonth() < b.getMonth());
2574
- const isDayBefore = (a, b) => isMonthBefore(a, b) || (isSameMonth(a, b) && a.getDate() < b.getDate());
2575
- const isHoursBefore = (a, b) => isDayBefore(a, b) || (isSameDay(a, b) && a.getHours() < b.getHours());
2576
- const isMinutesBefore = (a, b) => isHoursBefore(a, b) || (isSameHour(a, b) && a.getMinutes() < b.getMinutes());
2577
- const isSecondsBefore = (a, b) => isMinutesBefore(a, b) || (isSameMinute(a, b) && a.getSeconds() < b.getSeconds());
2578
- const isMillisecondsBefore = (a, b) => isSecondsBefore(a, b) || (isSameSecond(a, b) && a.getMilliseconds() < b.getMilliseconds());
2579
- const isWithinInterval = (date, { start, end }, cmp = '[]') => (cmp.charAt(0) === '[' ? isEqual(date, start) || isAfter(date, start) : isAfter(date, start)) &&
2580
- (cmp.charAt(1) === ']' ? isEqual(date, end) || isBefore(date, end) : isBefore(date, end));
2581
- const normalizeToLocalStartOfDay = (timestamp) => {
2582
- const d = new Date(timestamp);
2583
- return new Date(d.getFullYear(), d.getMonth(), d.getDate());
2584
- };
2585
- const normalizeToLocalStartOfHour = (timestamp) => {
2586
- const d = new Date(timestamp);
2587
- return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours());
2588
- };
2589
- const normalizeToLocalStartOfMinutes = (timestamp) => {
2590
- const d = new Date(timestamp);
2591
- return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes());
2592
- };
2593
- const normalizeToLocalStartOfSeconds = (timestamp) => {
2594
- const d = new Date(timestamp);
2595
- return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds());
2596
- };
2597
- const getYears = (d) => d.getFullYear();
2598
- const getMonths = (d) => d.getFullYear() * 12 + d.getMonth();
2599
- const getDays = (d) => Math.floor(normalizeToLocalStartOfDay(d).getTime() / ONE_DAY);
2600
- const getHours = (d) => Math.floor(normalizeToLocalStartOfHour(d).getTime() / ONE_HOUR);
2601
- const getMinutes = (d) => Math.floor(normalizeToLocalStartOfMinutes(d).getTime() / ONE_MINUTE);
2602
- const getSeconds = (d) => Math.floor(normalizeToLocalStartOfSeconds(d).getTime() / 1000);
2603
- const getMilliseconds = (d) => d.getTime();
2604
-
2605
- const getDocumentAccess = (document) => {
2606
- switch (true) {
2607
- case (document?.members?.rankAdministrators === exports.EntityMembersRank.NONE || document?.members?.rankAdministrators === exports.EntityMembersRank.CLOSE)
2608
- && document?.members?.rankManagers === exports.EntityMembersRank.OPEN
2609
- && (document?.members?.rankGuests === exports.EntityMembersRank.NONE || document?.members?.rankGuests === exports.EntityMembersRank.CLOSE || document?.members?.rankGuests === exports.EntityMembersRank.OPEN)
2610
- && document?.members?.rankSpectators === exports.EntityMembersRank.OPEN
2611
- && (document?.members?.rankParticipants === exports.EntityMembersRank.NONE || document?.members?.rankParticipants === exports.EntityMembersRank.CLOSE || document?.members?.rankParticipants === exports.EntityMembersRank.OPEN):
2612
- return exports.EntityAccess.EXPOSED;
2613
- case (document?.members?.rankAdministrators === exports.EntityMembersRank.NONE || document?.members?.rankAdministrators === exports.EntityMembersRank.CLOSE)
2614
- && document?.members?.rankManagers === exports.EntityMembersRank.CLOSE
2615
- && (document?.members?.rankGuests === exports.EntityMembersRank.NONE || document?.members?.rankGuests === exports.EntityMembersRank.CLOSE || document?.members?.rankGuests === exports.EntityMembersRank.OPEN)
2616
- && document?.members?.rankSpectators === exports.EntityMembersRank.OPEN
2617
- && (document?.members?.rankParticipants === exports.EntityMembersRank.NONE || document?.members?.rankParticipants === exports.EntityMembersRank.CLOSE || document?.members?.rankParticipants === exports.EntityMembersRank.OPEN):
2618
- return exports.EntityAccess.PUBLIC;
2619
- case (document?.members?.rankAdministrators === exports.EntityMembersRank.NONE || document?.members?.rankAdministrators === exports.EntityMembersRank.CLOSE)
2620
- && document?.members?.rankManagers === exports.EntityMembersRank.CLOSE
2621
- && (document?.members?.rankGuests === exports.EntityMembersRank.NONE || document?.members?.rankGuests === exports.EntityMembersRank.CLOSE || document?.members?.rankGuests === exports.EntityMembersRank.OPEN)
2622
- && document?.members?.rankSpectators === exports.EntityMembersRank.CLOSE
2623
- && (document?.members?.rankParticipants === exports.EntityMembersRank.NONE || document?.members?.rankParticipants === exports.EntityMembersRank.CLOSE || document?.members?.rankParticipants === exports.EntityMembersRank.OPEN):
2624
- return exports.EntityAccess.RESTRICTED;
2625
- case document?.members?.rankAdministrators === exports.EntityMembersRank.NONE
2626
- && document?.members?.rankManagers === exports.EntityMembersRank.NONE
2627
- && document?.members?.rankGuests === exports.EntityMembersRank.NONE
2628
- && document?.members?.rankSpectators === exports.EntityMembersRank.NONE
2629
- && document?.members?.rankParticipants === exports.EntityMembersRank.NONE:
2630
- return exports.EntityAccess.PRIVATE;
2631
- default:
2632
- return exports.EntityAccess.PRIVATE;
2633
- }
2634
- };
2635
- const isUserMember = (member) => {
2636
- return typeof member.userId === 'string';
2637
- };
2638
- const isTeamMember = (member) => {
2639
- return typeof member.teamId === 'string';
2640
- };
2641
- const toEntityMembersDto = (members) => {
2642
- return {
2643
- rankAdministrators: members.rankAdministrators,
2644
- administrators: Object.keys(members.administrators),
2645
- rankManagers: members.rankManagers,
2646
- managers: Object.keys(members.managers),
2647
- rankParticipants: members.rankParticipants,
2648
- participants: Object.keys(members.participants),
2649
- rankGuests: members.rankGuests,
2650
- guests: Object.keys(members.guests),
2651
- rankSpectators: members.rankSpectators,
2652
- spectators: Object.keys(members.spectators),
2653
- };
2654
- };
2655
-
2656
- class JkError extends Error {
2657
- constructor(code, custom) {
2658
- const message = custom?.message || ERROR[code].message;
2659
- super(message);
2660
- this.message = message;
2661
- this.code = code;
2662
- if (custom?.stack) {
2663
- this.stack = custom.stack;
2664
- }
2665
- if (custom?.data) {
2666
- this.data = custom.data;
2667
- }
2668
- }
2669
- }
2670
-
2671
- function removeExtension(fileName) {
2672
- const i = fileName.lastIndexOf('.');
2673
- return i !== -1 ? fileName.substring(0, i) : fileName;
2674
- }
2675
-
2676
- // https://dev.to/jsmccrumb/asynchronous-setinterval-4j69
2677
- const asyncIntervals = [];
2678
- const runAsyncInterval = async (cb, interval, intervalIndex) => {
2679
- await cb();
2680
- if (asyncIntervals[intervalIndex]) {
2681
- setTimeout(() => runAsyncInterval(cb, interval, intervalIndex), interval);
2682
- }
2683
- };
2684
- const setAsyncInterval = (cb, interval) => {
2685
- if (cb && typeof cb === 'function') {
2686
- const intervalIndex = asyncIntervals.length;
2687
- asyncIntervals.push(true);
2688
- void runAsyncInterval(cb, interval, intervalIndex);
2689
- return intervalIndex;
2690
- }
2691
- else {
2692
- throw new Error('Callback must be a function');
2693
- }
2694
- };
2695
- const clearAsyncInterval = (intervalIndex) => {
2696
- if (asyncIntervals[intervalIndex]) {
2697
- asyncIntervals[intervalIndex] = false;
2698
- }
2699
- };
2700
-
2701
- const getDataOfTestCase = (testCase, timeLimit, memoryLimit) => {
2702
- const { timeUsed, memoryUsed, exitCode } = getDataLog(testCase?.log);
2703
- const timeLimitExceeded = timeUsed > timeLimit;
2704
- const memoryLimitExceeded = memoryUsed > memoryLimit;
2705
- const runtimeError = exitCode !== 0;
2706
- const compilationError = testCase?.status === exports.SubmissionRunStatus.COMPILATION_ERROR;
2707
- return {
2708
- compilationError,
2709
- timeUsed,
2710
- timeLimitExceeded: timeLimitExceeded,
2711
- memoryUsed,
2712
- memoryLimitExceeded: memoryLimitExceeded,
2713
- exitCode,
2714
- runtimeError,
2715
- failed: !!testCase?.log && (timeLimitExceeded || memoryLimitExceeded || runtimeError),
2716
- };
2717
- };
2718
- const getVerdictFromTestCase = (testCaseValue, timeLimit, memoryLimit) => {
2719
- const { compilationError, timeLimitExceeded, memoryLimitExceeded, runtimeError, timeUsed, memoryUsed, exitCode, } = getDataOfTestCase(testCaseValue, timeLimit, memoryLimit);
2720
- return {
2721
- verdict: compilationError
2722
- ? exports.ProblemVerdict.CE
2723
- : timeLimitExceeded
2724
- ? exports.ProblemVerdict.TLE
2725
- : memoryLimitExceeded
2726
- ? exports.ProblemVerdict.MLE
2727
- : runtimeError
2728
- ? exports.ProblemVerdict.RE
2729
- : testCaseValue.out === testCaseValue.testOut
2730
- ? exports.ProblemVerdict.AC
2731
- : testCaseValue.withPE && testCaseValue.out.split(' ').join('').split('\n').join('') === testCaseValue.testOut.split(' ').join('').split('\n').join('')
2732
- ? exports.ProblemVerdict.PE
2733
- : !testCaseValue.withPE && testCaseValue.out.split(' ').join('').split('\n').join('') === testCaseValue.testOut.split(' ').join('').split('\n').join('')
2734
- ? exports.ProblemVerdict.AC
2735
- : exports.ProblemVerdict.WA,
2736
- timeUsed,
2737
- memoryUsed,
2738
- exitCode,
2739
- };
2740
- };
2741
- const mergeVerdicts = (first, second) => {
2742
- let verdict = first.verdict;
2743
- if (second.verdict === exports.ProblemVerdict.RE) {
2744
- verdict = exports.ProblemVerdict.RE;
2745
- }
2746
- else if (second.verdict === exports.ProblemVerdict.TLE && verdict != exports.ProblemVerdict.RE) {
2747
- verdict = exports.ProblemVerdict.TLE;
2748
- }
2749
- else if (second.verdict === exports.ProblemVerdict.MLE
2750
- && verdict !== exports.ProblemVerdict.TLE
2751
- && verdict !== exports.ProblemVerdict.RE) {
2752
- verdict = exports.ProblemVerdict.MLE;
2753
- }
2754
- else if (second.verdict === exports.ProblemVerdict.WA
2755
- && verdict !== exports.ProblemVerdict.MLE
2756
- && verdict !== exports.ProblemVerdict.TLE
2757
- && verdict !== exports.ProblemVerdict.RE) {
2758
- verdict = exports.ProblemVerdict.WA;
2759
- }
2760
- else if (second.verdict === exports.ProblemVerdict.PE
2761
- && verdict !== exports.ProblemVerdict.WA
2762
- && verdict !== exports.ProblemVerdict.MLE
2763
- && verdict !== exports.ProblemVerdict.TLE
2764
- && verdict !== exports.ProblemVerdict.RE) {
2765
- verdict = exports.ProblemVerdict.PE;
2766
- }
2767
- else if (second.verdict === exports.ProblemVerdict.PA
2768
- && verdict !== exports.ProblemVerdict.PE
2769
- && verdict !== exports.ProblemVerdict.WA
2770
- && verdict !== exports.ProblemVerdict.MLE
2771
- && verdict !== exports.ProblemVerdict.TLE
2772
- && verdict !== exports.ProblemVerdict.RE) {
2773
- verdict = exports.ProblemVerdict.PA;
2774
- }
2775
- else if (second.verdict === exports.ProblemVerdict.AC
2776
- && verdict !== exports.ProblemVerdict.PA
2777
- && verdict !== exports.ProblemVerdict.PE
2778
- && verdict !== exports.ProblemVerdict.WA
2779
- && verdict !== exports.ProblemVerdict.MLE
2780
- && verdict !== exports.ProblemVerdict.TLE
2781
- && verdict !== exports.ProblemVerdict.RE) {
2782
- verdict = exports.ProblemVerdict.AC;
2783
- }
2784
- return {
2785
- timeUsed: Math.max(first.timeUsed, second.timeUsed),
2786
- memoryUsed: Math.max(first.memoryUsed, second.memoryUsed),
2787
- exitCode: first.exitCode || second.exitCode,
2788
- verdict,
2789
- };
2790
- };
2791
- const getDataLog = (log) => {
2792
- const lines = log?.split?.('\n') || [];
2793
- let timeUsed = 0;
2794
- let memoryUsed = 0;
2795
- let exitCode = -1;
2796
- if (lines.length > 4) {
2797
- for (const line of lines) {
2798
- if (line.startsWith('time:')) {
2799
- timeUsed = +line.split(':')[1];
2800
- if (Number.isNaN(timeUsed)) {
2801
- timeUsed = 0;
2802
- }
2803
- timeUsed *= 1000;
2804
- }
2805
- else if (line.startsWith('max-rss:')) {
2806
- memoryUsed = parseInt(line.split(':')[1], 10); // en KB
2807
- }
2808
- else if (line.startsWith('exitcode:')) {
2809
- exitCode = parseInt(line.split(':')[1], 10);
2810
- }
2811
- }
2812
- }
2813
- else if (lines.length >= 3) {
2814
- timeUsed = +lines[0];
2815
- memoryUsed = +lines[1];
2816
- exitCode = +lines[2];
2817
- }
2818
- return {
2819
- timeUsed: Number.isNaN(timeUsed) ? 0 : timeUsed,
2820
- memoryUsed: Number.isNaN(memoryUsed) ? 0 : memoryUsed,
2821
- exitCode: Number.isNaN(exitCode) ? -1 : exitCode,
2822
- };
2823
- };
2824
-
2825
- const padStart = (n, maxLength, fillString = '0') => `${n}`.padStart(maxLength, fillString);
2826
- const padEnd = (n, maxLength, fillString = '0') => `${n}`.padEnd(maxLength, fillString);
2827
-
2828
- function memorySizeOf(obj) {
2829
- let bytes = 0;
2830
- function sizeOf(obj) {
2831
- if (obj !== null && obj !== undefined) {
2832
- switch (typeof obj) {
2833
- case "number":
2834
- bytes += 8;
2835
- break;
2836
- case "string":
2837
- bytes += obj.length * 2;
2838
- break;
2839
- case "boolean":
2840
- bytes += 4;
2841
- break;
2842
- case "object":
2843
- const objClass = Object.prototype.toString.call(obj).slice(8, -1);
2844
- if (objClass === "Object" || objClass === "Array") {
2845
- for (const key in obj) {
2846
- if (!obj.hasOwnProperty(key))
2847
- continue;
2848
- bytes += key.length * 2;
2849
- sizeOf(obj[key]);
2850
- }
2851
- }
2852
- else
2853
- bytes += obj.toString().length * 2;
2854
- break;
2855
- }
2856
- }
2857
- return bytes;
2858
- }
2859
- return sizeOf(obj);
2860
- }
2861
-
2862
- function toJkError(err) {
2863
- const error = new Error();
2864
- let code = err?.code;
2865
- if (!(code in exports.ErrorCode)) {
2866
- code = exports.ErrorCode.ERR500;
2867
- }
2868
- return new JkError(code, {
2869
- message: err?.message || error.message,
2870
- stack: err?.stack || error.stack,
2871
- data: err?.data || null,
2872
- });
2873
- }
2874
- function errorsResponse(message, ...errors) {
2875
- return {
2876
- success: false,
2877
- message: message,
2878
- errors: errors.map(error => ({
2879
- code: error.code,
2880
- message: error.message,
2881
- detail: error.stack || new Error().stack || '',
2882
- data: error.data,
2883
- })),
2884
- };
2885
- }
2886
- function contentResponse(message, content) {
2887
- return {
2888
- success: true,
2889
- message,
2890
- content,
2891
- };
2892
- }
2893
- function contentsResponse(message, contents, meta) {
2894
- return {
2895
- success: true,
2896
- message,
2897
- contents,
2898
- meta,
2899
- };
2900
- }
2901
- const cleanRequest = (responseText) => {
2902
- if (!isStringJson(responseText)) {
2903
- // this occurs when the endpoint don't exits or server is down
2904
- const response = {
2905
- success: false,
2906
- message: ERROR[exports.ErrorCode.ERR9999].message,
2907
- errors: [{ code: exports.ErrorCode.ERR9999, detail: '', message: ERROR[exports.ErrorCode.ERR9999].message }],
2908
- };
2909
- consoleError({ message: 'response is not string json, success false on cleaning request', responseText, response });
2910
- // jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
2911
- return response;
2912
- }
2913
- const responseJson = JSON.parse(responseText);
2914
- if (typeof responseJson.success === 'boolean') {
2915
- if (responseJson.success === true && typeof responseJson.message === 'string' && responseJson.content) { // V1
2916
- return {
2917
- success: true,
2918
- message: responseJson.message,
2919
- content: responseJson.content,
2920
- };
2921
- }
2922
- else if (responseJson.success === true && typeof responseJson.message === 'string' && Array.isArray(responseJson.contents) && responseJson.meta) { // V1
2923
- return {
2924
- success: true,
2925
- message: responseJson.message,
2926
- contents: responseJson.contents,
2927
- meta: responseJson.meta,
2928
- };
2929
- }
2930
- else if (responseJson.success === false && typeof responseJson.message === 'string' && Array.isArray(responseJson.errors)) { // V1
2931
- const response = {
2932
- success: false,
2933
- message: responseJson.message,
2934
- errors: responseJson.errors,
2935
- };
2936
- consoleError({ message: 'success false on cleaning request', responseText, response });
2937
- // jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
2938
- return response;
2939
- }
2940
- }
2941
- const response = {
2942
- success: false,
2943
- message: ERROR[exports.ErrorCode.ERR9998].message,
2944
- errors: [{ code: exports.ErrorCode.ERR9998, detail: '', message: ERROR[exports.ErrorCode.ERR9998].message }],
2945
- };
2946
- consoleError({ message: 'success false on cleaning request', responseText, response });
2947
- // jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
2948
- return response;
2949
- };
2950
- const getDefaultMeta = (contents, sort) => {
2951
- return { sort: sort ?? [], page: 1, size: contents.length, totalElements: contents.length, filter: {} };
2952
- };
2953
-
2954
- const isWebsocketSubscription = (event) => {
2955
- return Object.values(exports.WebSocketSubscriptionEvent).includes(event?.event)
2956
- && typeof event?.clientId === 'string' && !!event.clientId;
2957
- };
2958
- // CHANNEL_PUBLISH_SUBSCRIPTIONS
2959
- const isSubscribeCodeRunStatusWebSocketEventDto = (event) => {
2960
- return isWebsocketSubscription(event)
2961
- && event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_CODE_RUN_STATUS
2962
- && typeof event?.runId === 'string' && !!event.runId;
2963
- };
2964
- const isUnsubscribeCodeRunStatusWebSocketEventDto = (event) => {
2965
- return isWebsocketSubscription(event)
2966
- && event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_CODE_RUN_STATUS
2967
- && typeof event?.runId === 'string' && !!event.runId;
2968
- };
2969
- const isSubscribeSubmissionRunStatusWebSocketEventDto = (event) => {
2970
- return isWebsocketSubscription(event)
2971
- && event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSION_RUN_STATUS
2972
- && typeof event?.submitId === 'string' && !!event.submitId;
2973
- };
2974
- const isUnsubscribeSubmissionRunStatusWebSocketEventDto = (event) => {
2975
- return isWebsocketSubscription(event)
2976
- && event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSION_RUN_STATUS
2977
- && typeof event?.submitId === 'string' && !!event.submitId;
2978
- };
2979
- const isSubscribeGetDataWebSocketEventDto = (event) => {
2980
- return isWebsocketSubscription(event)
2981
- && event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_GET_DATA;
2982
- };
2983
- const isUnsubscribeGetDataWebSocketEventDto = (event) => {
2984
- return isWebsocketSubscription(event)
2985
- && event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_GET_DATA;
2986
- };
2987
- const isSubscribeProblemCrawledWebSocketEventDto = (event) => {
2988
- return isWebsocketSubscription(event)
2989
- && event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_PROBLEM_CRAWLED;
2990
- };
2991
- const isUnsubscribeProblemCrawledWebSocketEventDto = (event) => {
2992
- return isWebsocketSubscription(event)
2993
- && event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_PROBLEM_CRAWLED;
2994
- };
2995
- const isSubscribeSubmissionsCrawlWebSocketEventDto = (event) => {
2996
- return isWebsocketSubscription(event)
2997
- && event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSIONS_CRAWL;
2998
- };
2999
- const isUnsubscribeSubmissionsCrawlWebSocketEventDto = (event) => {
3000
- return isWebsocketSubscription(event)
3001
- && event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSIONS_CRAWL;
3002
- };
3003
- const isSubscribeContestChangesWebSocketEventDto = (event) => {
3004
- return isWebsocketSubscription(event)
3005
- && event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_CONTEST_CHANGES;
3006
- };
3007
- const isUnsubscribeContestChangesWebSocketEventDto = (event) => {
3008
- return isWebsocketSubscription(event)
3009
- && event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_CONTEST_CHANGES;
3010
- };
3011
- const isSubscribeUserNotificationWebSocketEventDto = (event) => {
3012
- return isWebsocketSubscription(event)
3013
- && event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_USER_NOTIFICATION;
3014
- };
3015
- const isUnsubscribeUserNotificationWebSocketEventDto = (event) => {
3016
- return isWebsocketSubscription(event)
3017
- && event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_USER_NOTIFICATION;
3018
- };
3019
- const isNonEmptyString = (value) => typeof value === 'string' && !!value;
3020
- /**
3021
- * Exactly one of `problemKey` / `contestKey` / `userKey` is set.
3022
- */
3023
- const isSubmissionsJudgingScope = (scope) => {
3024
- return [scope?.problemKey, scope?.contestKey, scope?.userKey].filter(isNonEmptyString).length === 1;
3025
- };
3026
- const isSubscribeSubmissionsJudgingWebSocketEventDto = (event) => {
3027
- return isWebsocketSubscription(event)
3028
- && event?.event === exports.WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSIONS_JUDGING
3029
- && isSubmissionsJudgingScope(event);
3030
- };
3031
- const isUnsubscribeSubmissionsJudgingWebSocketEventDto = (event) => {
3032
- return isWebsocketSubscription(event)
3033
- && event?.event === exports.WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSIONS_JUDGING
3034
- && isSubmissionsJudgingScope(event);
3035
- };
3036
- // is WebSocketResponseEventDto, CHANNEL_SUBSCRIBE_CLIENT
3037
- const isWebSocketResponseEventDto = (event) => {
3038
- return Object.values(exports.WebSocketResponseEvent).includes(event?.event)
3039
- && typeof event?.key === 'string'
3040
- && typeof event?.connectionId === 'string'
3041
- && typeof event?.createdAt === 'number' && !!event.createdAt;
3042
- };
3043
- const isCodeRunStatusMessageWebSocketResponseEventDto = (event) => {
3044
- return isWebSocketResponseEventDto(event)
3045
- && event?.event === exports.WebSocketResponseEvent.CODE_RUN_STATUS
3046
- && typeof event?.runId === 'string' && !!event.runId
3047
- && event?.status in exports.SubmissionRunStatus;
3048
- };
3049
- const isSubmissionRunStatusMessageWebSocketResponseEventDto = (event) => {
3050
- return isWebSocketResponseEventDto(event)
3051
- && event?.event === exports.WebSocketResponseEvent.SUBMISSION_RUN_STATUS
3052
- && typeof event?.submitId === 'string' && !!event.submitId
3053
- && event?.status in exports.SubmissionRunStatus
3054
- && event?.verdict in exports.ProblemVerdict
3055
- && typeof event?.points === 'number';
3056
- };
3057
- const isSubmissionJudgingWebSocketResponseEventDto = (event) => {
3058
- return isWebSocketResponseEventDto(event)
3059
- && event?.event === exports.WebSocketResponseEvent.SUBMISSION_JUDGING
3060
- && isNonEmptyString(event?.submitId)
3061
- && isNonEmptyString(event?.problemKey)
3062
- && (event?.contestKey === null || isNonEmptyString(event?.contestKey))
3063
- && isNonEmptyString(event?.userKey)
3064
- && typeof event?.judging === 'boolean'
3065
- && event?.status in exports.SubmissionRunStatus
3066
- && event?.verdict in exports.ProblemVerdict
3067
- && typeof event?.points === 'number';
3068
- };
3069
- const isUserMessageWebSocketResponseEventDto = (event) => {
3070
- return isWebSocketResponseEventDto(event)
3071
- && event?.event === exports.WebSocketResponseEvent.USER_MESSAGE
3072
- && typeof event?.user?.nickname === 'string' && !!event.user?.nickname
3073
- && typeof event?.user?.imageUrl === 'string' && !!event.user?.imageUrl
3074
- && typeof event?.user?.organization?.key === 'string' && !!event.user?.organization?.key
3075
- && !!event?.content;
3076
- };
3077
- const isSendDataWebSocketResponseEventDto = (event) => {
3078
- return [
3079
- exports.WebSocketResponseEvent.SEND_DATA_ECS_TASK_DEFINITIONS_LIST,
3080
- exports.WebSocketResponseEvent.SEND_DATA_EC2_INSTANCES_LIST,
3081
- exports.WebSocketResponseEvent.SEND_DATA_ECS_TASKS_LIST,
3082
- exports.WebSocketResponseEvent.SEND_DATA_SSM_SESSIONS_LIST,
3083
- exports.WebSocketResponseEvent.SEND_DATA_RUN_COMMAND,
3084
- ].includes(event?.event)
3085
- && typeof event?.dataId === 'string' && !!event.dataId
3086
- && !!event?.content;
3087
- };
3088
- const isSendDataEcsTaskDefinitionListWebSocketResponseEventDto = (event) => {
3089
- return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
3090
- && event?.event === exports.WebSocketResponseEvent.SEND_DATA_ECS_TASK_DEFINITIONS_LIST;
3091
- };
3092
- const isSendDataEc2InstancesListWebSocketResponseEventDto = (event) => {
3093
- return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
3094
- && event?.event === exports.WebSocketResponseEvent.SEND_DATA_EC2_INSTANCES_LIST;
3095
- };
3096
- const isSendDataEcsTasksListWebSocketResponseEventDto = (event) => {
3097
- return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
3098
- && event?.event === exports.WebSocketResponseEvent.SEND_DATA_ECS_TASKS_LIST;
3099
- };
3100
- const isSendDataSsmSessionsListWebSocketResponseEventDto = (event) => {
3101
- return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
3102
- && event?.event === exports.WebSocketResponseEvent.SEND_DATA_SSM_SESSIONS_LIST;
3103
- };
3104
- const isSendDataRunCommandWebSocketResponseEventDto = (event) => {
3105
- return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
3106
- && event?.event === exports.WebSocketResponseEvent.SEND_DATA_RUN_COMMAND;
3107
- };
3108
- const isProblemCrawledWebSocketResponseEventDto = (event) => {
3109
- return isWebSocketResponseEventDto(event)
3110
- && event?.event === exports.WebSocketResponseEvent.PROBLEM_CRAWLED
3111
- && !!event?.content;
3112
- };
3113
- const isSubmissionsCrawlWebSocketResponseEventDto = (event) => {
3114
- return isWebSocketResponseEventDto(event)
3115
- && event?.event === exports.WebSocketResponseEvent.SUBMISSIONS_CRAWL
3116
- && !!event?.content;
3117
- };
3118
- const isContestChangesWebSocketResponseEventDto = (event) => {
3119
- return isWebSocketResponseEventDto(event)
3120
- && event?.event === exports.WebSocketResponseEvent.CONTEST_CHANGES
3121
- && !!event?.content;
3122
- };
3123
- const isUserNotificationWebSocketResponseEventDto = (event) => {
3124
- return [
3125
- exports.WebSocketResponseEvent.USER_NOTIFICATION_SUBMISSION,
3126
- exports.WebSocketResponseEvent.USER_NOTIFICATION_CONTEST_CLARIFICATION,
3127
- ].includes(event?.event)
3128
- && !!event?.content;
3129
- };
3130
- const isUserNotificationSubmissionWebSocketResponseEventDto = (event) => {
3131
- return isWebSocketResponseEventDto(event) && isUserNotificationWebSocketResponseEventDto(event)
3132
- && event?.event === exports.WebSocketResponseEvent.USER_NOTIFICATION_SUBMISSION;
3133
- };
3134
- const isUserNotificationContestClarificationWebSocketResponseEventDto = (event) => {
3135
- return isWebSocketResponseEventDto(event) && isUserNotificationWebSocketResponseEventDto(event)
3136
- && event?.event === exports.WebSocketResponseEvent.USER_NOTIFICATION_CONTEST_CLARIFICATION;
3137
- };
3138
- // generic
3139
- const getWebSocketResponseEventKey = (event, clientId, id) => {
3140
- return `${event}-${clientId}-${id}`;
3141
- };
3142
- const isWebSocketChannelsMessageDto = (message) => {
3143
- return Array.isArray(message?.channels)
3144
- && message.channels.every((channel) => typeof channel === 'string' && !!channel)
3145
- && Object.values(exports.WebSocketResponseEvent).includes(message?.event?.event);
3146
- };
3147
- /**
3148
- * Key used by the client to dispatch a response received on a TOPIC channel to its subscribers.
3149
- * It is the same key that `getKeyWebSocketEventDto` (base-ui) computes for the subscription.
3150
- * Returns null when the response is not addressed to this client.
3151
- */
3152
- const getWebSocketResponseEventKeyOfResponse = (response, clientId) => {
3153
- if (isCodeRunStatusMessageWebSocketResponseEventDto(response)) {
3154
- return getWebSocketResponseEventKey(exports.WebSocketResponseEvent.CODE_RUN_STATUS, clientId, response.runId);
3155
- }
3156
- if (isSubmissionRunStatusMessageWebSocketResponseEventDto(response)) {
3157
- return getWebSocketResponseEventKey(exports.WebSocketResponseEvent.SUBMISSION_RUN_STATUS, clientId, response.submitId);
3158
- }
3159
- if (isSendDataWebSocketResponseEventDto(response)) {
3160
- return getWebSocketResponseEventKey(exports.WebSocketResponseEvent.SEND_DATA_, clientId, response.dataId);
3161
- }
3162
- if (isContestChangesWebSocketResponseEventDto(response)) {
3163
- return getWebSocketResponseEventKey(exports.WebSocketResponseEvent.CONTEST_CHANGES, clientId, response.content.contestKey);
3164
- }
3165
- if (isProblemCrawledWebSocketResponseEventDto(response)) {
3166
- return getWebSocketResponseEventKey(exports.WebSocketResponseEvent.PROBLEM_CRAWLED, clientId, response.content.problemKey);
3167
- }
3168
- if (isSubmissionsCrawlWebSocketResponseEventDto(response)) {
3169
- return getWebSocketResponseEventKey(exports.WebSocketResponseEvent.SUBMISSIONS_CRAWL, clientId, join([response.content.contestKey, response.content.problemKeys]));
3170
- }
3171
- if (isUserNotificationWebSocketResponseEventDto(response)) {
3172
- return getWebSocketResponseEventKey(exports.WebSocketResponseEvent.USER_NOTIFICATION_, clientId, '*');
3173
- }
3174
- if (isSubmissionJudgingWebSocketResponseEventDto(response)) {
3175
- // one key for every table: the same event is published on several channels (problem / contest / user) and the
3176
- // client deduplicates it, so it is dispatched once; each table filters by the submissions it lists
3177
- return getWebSocketResponseEventKey(exports.WebSocketResponseEvent.SUBMISSION_JUDGING, clientId, '*');
3178
- }
3179
- return null;
3180
- };
3181
- /**
3182
- * TOPIC channel that the client has to attach to receive the events of a subscription,
3183
- * or null when the events arrive by the private channels (session / user) the client is always attached to.
3184
- * Ably rejects the attach if the token has no capability for the channel.
3185
- */
3186
- const getChannelOfWebSocketSubscribeEvent = (event) => {
3187
- if (isSubscribeSubmissionRunStatusWebSocketEventDto(event)) {
3188
- return CHANNEL_SUBMISSION(event.submitId);
3189
- }
3190
- // SUBSCRIBE_PROBLEM_CRAWLED: the event arrives by the private user channel of who requested the crawl
3191
- if (isSubscribeContestChangesWebSocketEventDto(event) || isSubscribeSubmissionsCrawlWebSocketEventDto(event)) {
3192
- return CHANNEL_CONTEST(event.contestKey, exports.ContestChannelRole.SPECTATORS);
3193
- }
3194
- if (isSubscribeSubmissionsJudgingWebSocketEventDto(event)) {
3195
- // the judging start/end is published on the spectators channel when it is visible to everyone; the hidden ones
3196
- // (frozen / quiet contests) arrive by the role channels of the contest (managers) and the private user channel
3197
- if ('problemKey' in event && event.problemKey) {
3198
- return CHANNEL_PROBLEM(event.problemKey, exports.ProblemChannelRole.SPECTATORS);
3199
- }
3200
- if ('contestKey' in event && event.contestKey) {
3201
- return CHANNEL_CONTEST(event.contestKey, exports.ContestChannelRole.SPECTATORS);
3202
- }
3203
- if ('userKey' in event && event.userKey) {
3204
- return CHANNEL_USER_ROLE(event.userKey, exports.UserChannelRole.SPECTATORS);
3205
- }
3206
- }
3207
- return null;
3208
- };
3209
- /**
3210
- * Contest whose role channels the client needs (the API grants them when the token is requested with this contest).
3211
- */
3212
- const getContestKeyOfWebSocketSubscribeEvent = (event) => {
3213
- if (isSubscribeContestChangesWebSocketEventDto(event) || isSubscribeSubmissionsCrawlWebSocketEventDto(event)) {
3214
- return event.contestKey;
3215
- }
3216
- if (isSubscribeSubmissionsJudgingWebSocketEventDto(event) && 'contestKey' in event && event.contestKey) {
3217
- return event.contestKey;
3218
- }
3219
- return null;
3220
- };
3221
- /**
3222
- * Problem whose role channels the client needs (the API grants them when the token is requested with this problem).
3223
- */
3224
- const getProblemKeyOfWebSocketSubscribeEvent = (event) => {
3225
- if (isSubscribeSubmissionsJudgingWebSocketEventDto(event) && 'problemKey' in event && event.problemKey) {
3226
- return event.problemKey;
3227
- }
3228
- return null;
3229
- };
3230
-
3231
- function splitTime(timeRemaining) {
3232
- const remaining = [];
3233
- // const aYearMilliseconds = 1000 * 60 * 60 * 24 * 365;
3234
- // const remainingYears = Math.floor(timeRemaining / aYearMilliseconds);
3235
- // remaining.push({ remaining: remainingYears, label: 'years', milliseconds: aYearMilliseconds });
3236
- // const aWeekMilliseconds = 1000 * 60 * 60 * 24 * 7;
3237
- // const remainingWeeks = Math.floor((timeRemaining % aYearMilliseconds) / aWeekMilliseconds);
3238
- // remaining.push({ remaining: remainingWeeks, label: 'weeks', milliseconds: aWeekMilliseconds });
3239
- const aSecondMilliseconds = 1000;
3240
- const aMinuteMilliseconds = aSecondMilliseconds * 60;
3241
- const aHourMilliseconds = aMinuteMilliseconds * 60;
3242
- const aDayMilliseconds = aHourMilliseconds * 24;
3243
- const aWeekMilliseconds = aDayMilliseconds * 7;
3244
- const remainingWeeks = Math.floor(timeRemaining / aWeekMilliseconds);
3245
- remaining.push({
3246
- remaining: remainingWeeks,
3247
- label: remainingWeeks === 1 ? 'week' : 'weeks',
3248
- abbreviatedLabel: 'w',
3249
- milliseconds: aWeekMilliseconds,
3250
- digits: 2,
3251
- });
3252
- const remainingDays = Math.floor((timeRemaining % aWeekMilliseconds) / aDayMilliseconds);
3253
- remaining.push({
3254
- remaining: remainingDays,
3255
- label: remainingDays === 1 ? 'day' : 'days',
3256
- abbreviatedLabel: 'd',
3257
- milliseconds: aDayMilliseconds,
3258
- digits: 2,
3259
- });
3260
- const remainingHours = Math.floor((timeRemaining % aDayMilliseconds) / aHourMilliseconds);
3261
- remaining.push({
3262
- remaining: remainingHours,
3263
- label: remainingHours === 1 ? 'hour' : 'hours',
3264
- abbreviatedLabel: 'h',
3265
- milliseconds: aHourMilliseconds,
3266
- digits: 2,
3267
- });
3268
- const remainingMinutes = Math.floor((timeRemaining % aHourMilliseconds) / aMinuteMilliseconds);
3269
- remaining.push({
3270
- remaining: remainingMinutes,
3271
- label: remainingMinutes === 1 ? 'minute' : 'minutes',
3272
- abbreviatedLabel: 'm',
3273
- milliseconds: aMinuteMilliseconds,
3274
- digits: 2,
3275
- });
3276
- const remainingSeconds = Math.floor((timeRemaining % aMinuteMilliseconds) / aSecondMilliseconds);
3277
- remaining.push({
3278
- remaining: remainingSeconds,
3279
- label: remainingSeconds === 1 ? 'second' : 'seconds',
3280
- abbreviatedLabel: 's',
3281
- milliseconds: aSecondMilliseconds,
3282
- digits: 2,
3283
- });
3284
- const remainingMilliseconds = Math.floor(timeRemaining % aSecondMilliseconds);
3285
- remaining.push({
3286
- remaining: remainingMilliseconds,
3287
- label: remainingMilliseconds === 1 ? 'millisecond' : 'milliseconds',
3288
- abbreviatedLabel: 'ms',
3289
- milliseconds: 1,
3290
- digits: 3,
3291
- });
3292
- // while (remaining[0].remaining <= 0) {
3293
- // remaining.shift();
3294
- // if (remaining.length === 3) {
3295
- // break;
3296
- // }
3297
- // }
3298
- return remaining;
3299
- }
3300
-
3301
- const getUserKey = (userNickname, userOrganizationKey) => {
3302
- return userNickname + '|' + userOrganizationKey;
3303
- };
3304
- const getParamsOfUserKey = (userKey) => {
3305
- const [userNickname, userOrganizationKey] = userKey.split('|');
3306
- return { userNickname, userOrganizationKey };
3307
- };
3308
- const getClientId = (sessionId, uiId) => {
3309
- return `${sessionId}|${uiId}`;
3310
- };
3311
- const getParamsOfClientId = (clientId) => {
3312
- const [sessionId, uiId] = clientId.split('|');
3313
- return { sessionId, uiId };
3314
- };
3315
-
3316
- const getWorksheetsInPages = (initialSheets) => {
3317
- const sheets = [...initialSheets];
3318
- if (sheets[0]?.type !== exports.WorksheetType.NEW_PAGE) {
3319
- sheets.unshift(NEW_PAGE_SHEET());
3320
- }
3321
- let newPage = sheets[0];
3322
- let content = [];
3323
- const sheetsByPages = [];
3324
- for (let i = 1; i < sheets.length; i++) {
3325
- const sheet = sheets[i];
3326
- if (sheet.type === exports.WorksheetType.NEW_PAGE) {
3327
- sheetsByPages.push({
3328
- header: newPage,
3329
- content: [...content],
3330
- });
3331
- newPage = sheet;
3332
- content = [];
3333
- }
3334
- else {
3335
- content.push(sheet);
3336
- }
3337
- }
3338
- sheetsByPages.push({
3339
- header: newPage,
3340
- content: [...content],
3341
- });
3342
- return sheetsByPages;
3343
- };
3344
- const getSummaryWorksheetsInPages = (initialSheets) => {
3345
- const sheets = [...initialSheets];
3346
- if (sheets[0]?.type !== exports.WorksheetType.NEW_PAGE) {
3347
- sheets.unshift(NEW_PAGE_SHEET());
3348
- }
3349
- let newPage = sheets[0];
3350
- let content = [];
3351
- const sheetsByPages = [];
3352
- for (let i = 1; i < sheets.length; i++) {
3353
- const sheet = sheets[i];
3354
- if (sheet.type === exports.WorksheetType.NEW_PAGE) {
3355
- sheetsByPages.push({
3356
- header: newPage,
3357
- content: content.map(c => ({
3358
- id: c.id,
3359
- type: c.type,
3360
- title: c.title,
3361
- points: c.points,
3362
- })),
3363
- });
3364
- newPage = sheet;
3365
- content = [];
3366
- }
3367
- else {
3368
- content.push(sheet);
3369
- }
3370
- }
3371
- sheetsByPages.push({
3372
- header: newPage,
3373
- content: [...content],
3374
- });
3375
- return sheetsByPages;
3376
- };
3377
- const getTotalExercisesOfSummaryWorksheetsInPages = (content) => content.reduce((sum, { content }) => sum + content.reduce((sum, { type }) => sum + +(type === exports.WorksheetType.QUIZ_OPTIONS || type === exports.WorksheetType.QUIZ_PROBLEM || type === exports.WorksheetType.QUIZ_TEXT), 0), 0);
3378
- const isBasicWorksheet = (value) => {
3379
- return typeof value?.id == 'string' && value.id
3380
- && Object.values(exports.WorksheetType).includes(value?.type)
3381
- && typeof value?.title == 'string'
3382
- && typeof value?.points == 'number';
3383
- };
3384
- const isJkmdSheet = (value) => {
3385
- return isBasicWorksheet(value)
3386
- && value?.type === exports.WorksheetType.JK_MD
3387
- && typeof value?.content == 'string';
3388
- };
3389
- const isCodeEditorSheet = (value) => {
3390
- return isBasicWorksheet(value)
3391
- && value?.type === exports.WorksheetType.CODE_EDITOR
3392
- && typeof value?.sourceCode === 'object' && value?.sourceCode !== null
3393
- && value?.testCases === 'object' && value?.testCases !== null
3394
- && Array.isArray(value?.languages)
3395
- && typeof value?.height == 'number';
3396
- };
3397
- const isQuizProblemSheet = (value) => {
3398
- return isBasicWorksheet(value)
3399
- && value?.type === exports.WorksheetType.QUIZ_PROBLEM
3400
- && Object.values(exports.Judge).includes(value?.problemJudge) || typeof value?.problemJudge === 'string'
3401
- && typeof value?.problemKey == 'string'
3402
- && Array.isArray(value?.languages)
3403
- && typeof value?.height == 'number';
3404
- };
3405
- const isQuizOptionsSheet = (value) => {
3406
- return isBasicWorksheet(value)
3407
- && value?.type === exports.WorksheetType.QUIZ_OPTIONS
3408
- && typeof value?.description == 'string'
3409
- && Array.isArray(value?.options)
3410
- && value?.options.every((option) => typeof option?.label == 'string' && typeof option?.correct == 'boolean' && typeof option?.id == 'string')
3411
- && typeof value?.multiple == 'boolean'
3412
- && (value?.scoringMode === 'TOTAL' || value?.scoringMode === 'PARTIAL');
3413
- };
3414
- const isQuizTextSheet = (value) => {
3415
- return isBasicWorksheet(value)
3416
- && value?.type === exports.WorksheetType.QUIZ_TEXT
3417
- && typeof value?.description == 'string'
3418
- && typeof value?.answer == 'string'
3419
- && ['text', 'number', 'textarea'].includes(value?.inputType);
3420
- };
3421
-
3422
- exports.ACCEPTED_PROGRAMMING_LANGUAGES = ACCEPTED_PROGRAMMING_LANGUAGES;
3423
- exports.ASPECT_RATIO = ASPECT_RATIO;
3424
- exports.AssignmentState = AssignmentState;
3425
- exports.AssignmentType = AssignmentType;
3426
- exports.CHANNEL_CONTEST = CHANNEL_CONTEST;
3427
- exports.CHANNEL_ORGANIZATION_PRESENCE = CHANNEL_ORGANIZATION_PRESENCE;
3428
- exports.CHANNEL_PROBLEM = CHANNEL_PROBLEM;
3429
- exports.CHANNEL_SESSION = CHANNEL_SESSION;
3430
- exports.CHANNEL_SUBMISSION = CHANNEL_SUBMISSION;
3431
- exports.CHANNEL_SUBMISSION_ALL = CHANNEL_SUBMISSION_ALL;
3432
- exports.CHANNEL_USER = CHANNEL_USER;
3433
- exports.CHANNEL_USER_ROLE = CHANNEL_USER_ROLE;
3434
- exports.CHANNEL_USER_SPECTATORS_ALL = CHANNEL_USER_SPECTATORS_ALL;
3435
- exports.CODE_LANGUAGE = CODE_LANGUAGE;
3436
- exports.CONTEST_ROLE = CONTEST_ROLE;
3437
- exports.CONTEST_STATUS = CONTEST_STATUS;
3438
- exports.COOKIE_JUKI_SESSION_ID = COOKIE_JUKI_SESSION_ID;
3439
- exports.COURSE_ROLE = COURSE_ROLE;
3440
- exports.CourseRole = CourseRole;
3441
- exports.CourseStatus = CourseStatus;
3442
- exports.CourseType = CourseType;
3443
- exports.DAY_NAMES = DAY_NAMES;
3444
- exports.DEFAULT_JUKI_PROFILE_IMAGE = DEFAULT_JUKI_PROFILE_IMAGE;
3445
- exports.EMPTY_DOCUMENT_MEMBERS = EMPTY_DOCUMENT_MEMBERS;
3446
- exports.EMPTY_ENTITY_MEMBERS = EMPTY_ENTITY_MEMBERS;
3447
- exports.EMPTY_USER_PERMISSIONS = EMPTY_USER_PERMISSIONS;
3448
- exports.ENTITY_ACCESS = ENTITY_ACCESS;
3449
- exports.ENTITY_STATE = ENTITY_STATE;
3450
- exports.ERROR = ERROR;
3451
- exports.EmailSubscription = EmailSubscription;
3452
- exports.EmailValidationState = EmailValidationState;
3453
- exports.FILE_ROLE = FILE_ROLE;
3454
- exports.FILE_TYPE = FILE_TYPE;
3455
- exports.HEADER_JUKI_FORWARDED_HOST = HEADER_JUKI_FORWARDED_HOST;
3456
- exports.HEADER_JUKI_INTERNAL_API_KEY = HEADER_JUKI_INTERNAL_API_KEY;
3457
- exports.HEADER_JUKI_METADATA = HEADER_JUKI_METADATA;
3458
- exports.HEADER_JUKI_SECRET_TOKEN = HEADER_JUKI_SECRET_TOKEN;
3459
- exports.HEADER_JUKI_VISITOR_SESSION_ID = HEADER_JUKI_VISITOR_SESSION_ID;
3460
- exports.HOURS = HOURS;
3461
- exports.JUDGE = JUDGE;
3462
- exports.JUKI_APP_EMAIL_TEMPLATE = JUKI_APP_EMAIL_TEMPLATE;
3463
- exports.JUKI_APP_ORGANIZATION_KEY = JUKI_APP_ORGANIZATION_KEY;
3464
- exports.JkError = JkError;
3465
- exports.LANGUAGE = LANGUAGE;
3466
- exports.LOWERCASE_LETTERS = LOWERCASE_LETTERS;
3467
- exports.Language = Language;
3468
- exports.MAX_DATE = MAX_DATE;
3469
- exports.MEMBER_ROLE = MEMBER_ROLE;
3470
- exports.MILLISECONDS = MILLISECONDS;
3471
- exports.MINUTES = MINUTES;
3472
- exports.MIN_DATE = MIN_DATE;
3473
- exports.MONTH_NAMES = MONTH_NAMES;
3474
- exports.MemberRole = MemberRole;
3475
- exports.NEW_PAGE_SHEET = NEW_PAGE_SHEET;
3476
- exports.NUMBERS = NUMBERS;
3477
- exports.ONE_DAY = ONE_DAY;
3478
- exports.ONE_HOUR = ONE_HOUR;
3479
- exports.ONE_MINUTE = ONE_MINUTE;
3480
- exports.ONE_SECOND = ONE_SECOND;
3481
- exports.ONE_WEEK = ONE_WEEK;
3482
- exports.ORGANIZATION_PLAN = ORGANIZATION_PLAN;
3483
- exports.PAGE = PAGE;
3484
- exports.PAGE_SIZE = PAGE_SIZE;
3485
- exports.PAGE_SIZES = PAGE_SIZES;
3486
- exports.PALLETE = PALLETE;
3487
- exports.PROBLEM_INPUT = PROBLEM_INPUT;
3488
- exports.PROBLEM_MODE = PROBLEM_MODE;
3489
- exports.PROBLEM_MODES = PROBLEM_MODES;
3490
- exports.PROBLEM_OUTPUT = PROBLEM_OUTPUT;
3491
- exports.PROBLEM_ROLE = PROBLEM_ROLE;
3492
- exports.PROBLEM_TYPE = PROBLEM_TYPE;
3493
- exports.PROBLEM_TYPES = PROBLEM_TYPES;
3494
- exports.PROBLEM_VERDICT = PROBLEM_VERDICT;
3495
- exports.PROBLEM_VERDICTS = PROBLEM_VERDICTS;
3496
- exports.RUNNER_ACCEPTED_PROBLEM_MODES = RUNNER_ACCEPTED_PROBLEM_MODES;
3497
- exports.RUNNER_ACCEPTED_PROBLEM_TYPES = RUNNER_ACCEPTED_PROBLEM_TYPES;
3498
- exports.RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES = RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES;
3499
- exports.RUNNER_TYPE = RUNNER_TYPE;
3500
- exports.SECONDS = SECONDS;
3501
- exports.SEC_120 = SEC_120;
3502
- exports.SEC_30 = SEC_30;
3503
- exports.SEC_60 = SEC_60;
3504
- exports.SEC_90 = SEC_90;
3505
- exports.SEPARATOR_TOKEN = SEPARATOR_TOKEN;
3506
- exports.SUBMISSION_RUN_STATUS = SUBMISSION_RUN_STATUS;
3507
- exports.SUPPORT_EMAIL = SUPPORT_EMAIL;
3508
- exports.SYSTEM_ROLE = SYSTEM_ROLE;
3509
- exports.SystemRole = SystemRole;
3510
- exports.TEAM_ROLE = TEAM_ROLE;
3511
- exports.THEME = THEME;
3512
- exports.TeamRole = TeamRole;
3513
- exports.TeamStatus = TeamStatus;
3514
- exports.Theme = Theme;
3515
- exports.UPPERCASE_LETTERS = UPPERCASE_LETTERS;
3516
- exports.USER_ROLE = USER_ROLE;
3517
- exports.USER_STATUS = USER_STATUS;
3518
- exports.UserRole = UserRole;
3519
- exports.UserStatus = UserStatus;
3520
- exports.UserTeamStatus = UserTeamStatus;
3521
- exports.YEARS = YEARS;
3522
- exports._KEY = _KEY;
3523
- exports._SUB_SUB_TAB = _SUB_SUB_TAB;
3524
- exports._SUB_TAB = _SUB_TAB;
3525
- exports._TAB = _TAB;
3526
- exports._TYPE = _TYPE;
3527
- exports.areArraysDifferent = areArraysDifferent;
3528
- exports.changeDay = changeDay;
3529
- exports.changeHours = changeHours;
3530
- exports.changeMilliseconds = changeMilliseconds;
3531
- exports.changeMinutes = changeMinutes;
3532
- exports.changeMonth = changeMonth;
3533
- exports.changeSeconds = changeSeconds;
3534
- exports.changeYear = changeYear;
3535
- exports.chunkString = chunkString;
3536
- exports.cleanRequest = cleanRequest;
3537
- exports.clearAsyncInterval = clearAsyncInterval;
3538
- exports.consoleError = consoleError;
3539
- exports.consoleInfo = consoleInfo;
3540
- exports.consoleWarn = consoleWarn;
3541
- exports.contentResponse = contentResponse;
3542
- exports.contentsResponse = contentsResponse;
3543
- exports.decreaseDay = decreaseDay;
3544
- exports.decreaseMonth = decreaseMonth;
3545
- exports.decreaseYear = decreaseYear;
3546
- exports.endOfDay = endOfDay;
3547
- exports.endOfHour = endOfHour;
3548
- exports.endOfMinute = endOfMinute;
3549
- exports.endOfMonth = endOfMonth;
3550
- exports.endOfSecond = endOfSecond;
3551
- exports.endOfWeek = endOfWeek;
3552
- exports.endOfYear = endOfYear;
3553
- exports.errorsResponse = errorsResponse;
3554
- exports.getAssignmentCommentKey = getAssignmentCommentKey;
3555
- exports.getAssignmentUserCommentKey = getAssignmentUserCommentKey;
3556
- exports.getChannelOfWebSocketSubscribeEvent = getChannelOfWebSocketSubscribeEvent;
3557
- exports.getClientId = getClientId;
3558
- exports.getContestChannelParams = getContestChannelParams;
3559
- exports.getContestCommentKey = getContestCommentKey;
3560
- exports.getContestKeyOfWebSocketSubscribeEvent = getContestKeyOfWebSocketSubscribeEvent;
3561
- exports.getDataLog = getDataLog;
3562
- exports.getDataOfTestCase = getDataOfTestCase;
3563
- exports.getDays = getDays;
3564
- exports.getDefaultMeta = getDefaultMeta;
3565
- exports.getDocumentAccess = getDocumentAccess;
3566
- exports.getHours = getHours;
3567
- exports.getMilliseconds = getMilliseconds;
3568
- exports.getMinutes = getMinutes;
3569
- exports.getMonths = getMonths;
3570
- exports.getParamsOfClientId = getParamsOfClientId;
3571
- exports.getParamsOfUserKey = getParamsOfUserKey;
3572
- exports.getPlainText = getPlainText;
3573
- exports.getProblemChannelParams = getProblemChannelParams;
3574
- exports.getProblemCommentKey = getProblemCommentKey;
3575
- exports.getProblemJudgeKey = getProblemJudgeKey;
3576
- exports.getProblemKeyOfWebSocketSubscribeEvent = getProblemKeyOfWebSocketSubscribeEvent;
3577
- exports.getRandomString = getRandomString;
3578
- exports.getSeconds = getSeconds;
3579
- exports.getSummaryWorksheetsInPages = getSummaryWorksheetsInPages;
3580
- exports.getTotalExercisesOfSummaryWorksheetsInPages = getTotalExercisesOfSummaryWorksheetsInPages;
3581
- exports.getUserKey = getUserKey;
3582
- exports.getVerdictFromTestCase = getVerdictFromTestCase;
3583
- exports.getWebSocketResponseEventKey = getWebSocketResponseEventKey;
3584
- exports.getWebSocketResponseEventKeyOfResponse = getWebSocketResponseEventKeyOfResponse;
3585
- exports.getWorksheetsInPages = getWorksheetsInPages;
3586
- exports.getYears = getYears;
3587
- exports.humanFileSize = humanFileSize;
3588
- exports.increaseDay = increaseDay;
3589
- exports.increaseMonth = increaseMonth;
3590
- exports.increaseYear = increaseYear;
3591
- exports.indexToLetters = indexToLetters;
3592
- exports.isAfter = isAfter;
3593
- exports.isBasicWorksheet = isBasicWorksheet;
3594
- exports.isBefore = isBefore;
3595
- exports.isCodeEditorSheet = isCodeEditorSheet;
3596
- exports.isCodeRunStatusMessageWebSocketResponseEventDto = isCodeRunStatusMessageWebSocketResponseEventDto;
3597
- exports.isContestAssignment = isContestAssignment;
3598
- exports.isContestChangesWebSocketResponseEventDto = isContestChangesWebSocketResponseEventDto;
3599
- exports.isCourseAssignment = isCourseAssignment;
3600
- exports.isDayAfter = isDayAfter;
3601
- exports.isDayBefore = isDayBefore;
3602
- exports.isEndlessContest = isEndlessContest;
3603
- exports.isEqual = isEqual;
3604
- exports.isFutureContest = isFutureContest;
3605
- exports.isGlobalContest = isGlobalContest;
3606
- exports.isHoursAfter = isHoursAfter;
3607
- exports.isHoursBefore = isHoursBefore;
3608
- exports.isJkmdSheet = isJkmdSheet;
3609
- exports.isMillisecondsAfter = isMillisecondsAfter;
3610
- exports.isMillisecondsBefore = isMillisecondsBefore;
3611
- exports.isMinutesAfter = isMinutesAfter;
3612
- exports.isMinutesBefore = isMinutesBefore;
3613
- exports.isMonthAfter = isMonthAfter;
3614
- exports.isMonthBefore = isMonthBefore;
3615
- exports.isObjectJson = isObjectJson;
3616
- exports.isPastContest = isPastContest;
3617
- exports.isProblemCrawledWebSocketResponseEventDto = isProblemCrawledWebSocketResponseEventDto;
3618
- exports.isQuizOptionsSheet = isQuizOptionsSheet;
3619
- exports.isQuizProblemSheet = isQuizProblemSheet;
3620
- exports.isQuizTextSheet = isQuizTextSheet;
3621
- exports.isSameDay = isSameDay;
3622
- exports.isSameHour = isSameHour;
3623
- exports.isSameMillisecond = isSameMillisecond;
3624
- exports.isSameMinute = isSameMinute;
3625
- exports.isSameMonth = isSameMonth;
3626
- exports.isSameSecond = isSameSecond;
3627
- exports.isSameYear = isSameYear;
3628
- exports.isSecondsAfter = isSecondsAfter;
3629
- exports.isSecondsBefore = isSecondsBefore;
3630
- exports.isSendDataEc2InstancesListWebSocketResponseEventDto = isSendDataEc2InstancesListWebSocketResponseEventDto;
3631
- exports.isSendDataEcsTaskDefinitionListWebSocketResponseEventDto = isSendDataEcsTaskDefinitionListWebSocketResponseEventDto;
3632
- exports.isSendDataEcsTasksListWebSocketResponseEventDto = isSendDataEcsTasksListWebSocketResponseEventDto;
3633
- exports.isSendDataRunCommandWebSocketResponseEventDto = isSendDataRunCommandWebSocketResponseEventDto;
3634
- exports.isSendDataSsmSessionsListWebSocketResponseEventDto = isSendDataSsmSessionsListWebSocketResponseEventDto;
3635
- exports.isSendDataWebSocketResponseEventDto = isSendDataWebSocketResponseEventDto;
3636
- exports.isStringJson = isStringJson;
3637
- exports.isSubmissionJudgingWebSocketResponseEventDto = isSubmissionJudgingWebSocketResponseEventDto;
3638
- exports.isSubmissionRunStatusMessageWebSocketResponseEventDto = isSubmissionRunStatusMessageWebSocketResponseEventDto;
3639
- exports.isSubmissionsCrawlWebSocketResponseEventDto = isSubmissionsCrawlWebSocketResponseEventDto;
3640
- exports.isSubmissionsJudgingScope = isSubmissionsJudgingScope;
3641
- exports.isSubscribeCodeRunStatusWebSocketEventDto = isSubscribeCodeRunStatusWebSocketEventDto;
3642
- exports.isSubscribeContestChangesWebSocketEventDto = isSubscribeContestChangesWebSocketEventDto;
3643
- exports.isSubscribeGetDataWebSocketEventDto = isSubscribeGetDataWebSocketEventDto;
3644
- exports.isSubscribeProblemCrawledWebSocketEventDto = isSubscribeProblemCrawledWebSocketEventDto;
3645
- exports.isSubscribeSubmissionRunStatusWebSocketEventDto = isSubscribeSubmissionRunStatusWebSocketEventDto;
3646
- exports.isSubscribeSubmissionsCrawlWebSocketEventDto = isSubscribeSubmissionsCrawlWebSocketEventDto;
3647
- exports.isSubscribeSubmissionsJudgingWebSocketEventDto = isSubscribeSubmissionsJudgingWebSocketEventDto;
3648
- exports.isSubscribeUserNotificationWebSocketEventDto = isSubscribeUserNotificationWebSocketEventDto;
3649
- exports.isTeamMember = isTeamMember;
3650
- exports.isToday = isToday;
3651
- exports.isUnsubscribeCodeRunStatusWebSocketEventDto = isUnsubscribeCodeRunStatusWebSocketEventDto;
3652
- exports.isUnsubscribeContestChangesWebSocketEventDto = isUnsubscribeContestChangesWebSocketEventDto;
3653
- exports.isUnsubscribeGetDataWebSocketEventDto = isUnsubscribeGetDataWebSocketEventDto;
3654
- exports.isUnsubscribeProblemCrawledWebSocketEventDto = isUnsubscribeProblemCrawledWebSocketEventDto;
3655
- exports.isUnsubscribeSubmissionRunStatusWebSocketEventDto = isUnsubscribeSubmissionRunStatusWebSocketEventDto;
3656
- exports.isUnsubscribeSubmissionsCrawlWebSocketEventDto = isUnsubscribeSubmissionsCrawlWebSocketEventDto;
3657
- exports.isUnsubscribeSubmissionsJudgingWebSocketEventDto = isUnsubscribeSubmissionsJudgingWebSocketEventDto;
3658
- exports.isUnsubscribeUserNotificationWebSocketEventDto = isUnsubscribeUserNotificationWebSocketEventDto;
3659
- exports.isUserMember = isUserMember;
3660
- exports.isUserMessageWebSocketResponseEventDto = isUserMessageWebSocketResponseEventDto;
3661
- exports.isUserNotificationContestClarificationWebSocketResponseEventDto = isUserNotificationContestClarificationWebSocketResponseEventDto;
3662
- exports.isUserNotificationSubmissionWebSocketResponseEventDto = isUserNotificationSubmissionWebSocketResponseEventDto;
3663
- exports.isUserNotificationWebSocketResponseEventDto = isUserNotificationWebSocketResponseEventDto;
3664
- exports.isValidDate = isValidDate;
3665
- exports.isWebSocketChannelsMessageDto = isWebSocketChannelsMessageDto;
3666
- exports.isWebSocketResponseEventDto = isWebSocketResponseEventDto;
3667
- exports.isWebsocketSubscription = isWebsocketSubscription;
3668
- exports.isWithinInterval = isWithinInterval;
3669
- exports.isWorksheetAssignment = isWorksheetAssignment;
3670
- exports.isYearAfter = isYearAfter;
3671
- exports.isYearBefore = isYearBefore;
3672
- exports.join = join;
3673
- exports.lettersToIndex = lettersToIndex;
3674
- exports.memorySizeOf = memorySizeOf;
3675
- exports.mergeVerdicts = mergeVerdicts;
3676
- exports.mex = mex;
3677
- exports.normalizeToLocalStartOfDay = normalizeToLocalStartOfDay;
3678
- exports.normalizeToLocalStartOfHour = normalizeToLocalStartOfHour;
3679
- exports.normalizeToLocalStartOfMinutes = normalizeToLocalStartOfMinutes;
3680
- exports.normalizeToLocalStartOfSeconds = normalizeToLocalStartOfSeconds;
3681
- exports.objectUpdate = objectUpdate;
3682
- exports.objectsUpdate = objectsUpdate;
3683
- exports.padEnd = padEnd;
3684
- exports.padStart = padStart;
3685
- exports.range = range;
3686
- exports.removeExtension = removeExtension;
3687
- exports.safeJsonParse = safeJsonParse;
3688
- exports.setAsyncInterval = setAsyncInterval;
3689
- exports.split = split;
3690
- exports.splitTime = splitTime;
3691
- exports.startOfDay = startOfDay;
3692
- exports.startOfHour = startOfHour;
3693
- exports.startOfMinute = startOfMinute;
3694
- exports.startOfMonth = startOfMonth;
3695
- exports.startOfSecond = startOfSecond;
3696
- exports.startOfWeek = startOfWeek;
3697
- exports.startOfYear = startOfYear;
3698
- exports.stringToArrayBuffer = stringToArrayBuffer;
3699
- exports.toEntityMembersDto = toEntityMembersDto;
3700
- exports.toJkError = toJkError;