@juki-team/commons 0.1.32 → 0.1.40

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 (254) hide show
  1. package/dist/cjs/index.cjs +3567 -0
  2. package/dist/esm/index.js +3347 -0
  3. package/dist/{constants → types/constants}/commons.d.ts +8 -8
  4. package/dist/{constants → types/constants}/company.d.ts +3 -3
  5. package/dist/{constants → types/constants}/contest.d.ts +3 -3
  6. package/dist/{constants → types/constants}/course.d.ts +2 -2
  7. package/dist/{constants → types/constants}/entity.d.ts +1 -1
  8. package/dist/{constants → types/constants}/file.d.ts +5 -6
  9. package/dist/types/constants/index.d.ts +18 -0
  10. package/dist/{constants → types/constants}/judge.d.ts +9 -11
  11. package/dist/{constants → types/constants}/problem.d.ts +8 -9
  12. package/dist/types/constants/services.d.ts +8 -0
  13. package/dist/{constants → types/constants}/system.d.ts +2 -2
  14. package/dist/{constants → types/constants}/teams.d.ts +3 -4
  15. package/dist/types/constants/user.d.ts +16 -0
  16. package/dist/{constants → types/constants}/websocket.d.ts +1 -1
  17. package/dist/{constants → types/constants}/worksheet.d.ts +2 -2
  18. package/dist/{dto → types/dto}/class.d.ts +4 -4
  19. package/dist/{dto → types/dto}/code.d.ts +1 -1
  20. package/dist/{dto → types/dto}/comments.d.ts +3 -3
  21. package/dist/types/dto/company.d.ts +67 -0
  22. package/dist/{dto → types/dto}/contest.d.ts +8 -9
  23. package/dist/{dto → types/dto}/course.d.ts +5 -5
  24. package/dist/{dto → types/dto}/entity.d.ts +3 -3
  25. package/dist/{dto → types/dto}/excalidraw.d.ts +4 -4
  26. package/dist/{dto → types/dto}/file.d.ts +2 -2
  27. package/dist/types/dto/index.d.ts +25 -0
  28. package/dist/{dto → types/dto}/judge.d.ts +1 -1
  29. package/dist/{dto → types/dto}/markdown.d.ts +4 -4
  30. package/dist/{dto → types/dto}/mermaid.d.ts +4 -4
  31. package/dist/{dto → types/dto}/problem.d.ts +4 -5
  32. package/dist/{dto → types/dto}/scoreboard.d.ts +1 -1
  33. package/dist/{dto → types/dto}/session.d.ts +2 -2
  34. package/dist/{dto → types/dto}/socket.d.ts +7 -8
  35. package/dist/{dto → types/dto}/statistics.d.ts +2 -2
  36. package/dist/{dto → types/dto}/submission.d.ts +4 -5
  37. package/dist/{dto → types/dto}/system.d.ts +18 -18
  38. package/dist/{dto → types/dto}/user.d.ts +14 -14
  39. package/dist/{dto → types/dto}/virtual-user.d.ts +1 -2
  40. package/dist/{dto → types/dto}/worksheet-submissions.d.ts +4 -4
  41. package/dist/{dto → types/dto}/worksheet.d.ts +4 -4
  42. package/dist/{helpers → types/helpers}/class.d.ts +1 -1
  43. package/dist/{helpers → types/helpers}/commons.d.ts +11 -9
  44. package/dist/{helpers → types/helpers}/contest.d.ts +1 -1
  45. package/dist/{helpers → types/helpers}/document.d.ts +2 -2
  46. package/dist/types/helpers/index.d.ts +14 -0
  47. package/dist/types/helpers/interval.d.ts +2 -0
  48. package/dist/{helpers → types/helpers}/judging.d.ts +2 -3
  49. package/dist/types/helpers/object.d.ts +1 -0
  50. package/dist/types/helpers/responses.d.ts +8 -0
  51. package/dist/types/helpers/socket.d.ts +45 -0
  52. package/dist/{helpers → types/helpers}/time.d.ts +1 -1
  53. package/dist/{helpers → types/helpers}/user.d.ts +1 -1
  54. package/dist/types/helpers/worksheet.d.ts +10 -0
  55. package/dist/types/index.d.ts +5 -23
  56. package/dist/{prototypes → types/prototypes}/Error.d.ts +3 -3
  57. package/dist/types/prototypes/Number.d.ts +7 -0
  58. package/dist/types/prototypes/index.d.ts +3 -0
  59. package/dist/types/{class.d.ts → types/class.d.ts} +2 -2
  60. package/dist/types/{commons.d.ts → types/commons.d.ts} +3 -3
  61. package/dist/types/types/company.d.ts +29 -0
  62. package/dist/types/{contest.d.ts → types/contest.d.ts} +26 -9
  63. package/dist/types/{course.d.ts → types/course.d.ts} +1 -1
  64. package/dist/types/{entity.d.ts → types/entity.d.ts} +4 -4
  65. package/dist/types/{excalidraw.d.ts → types/excalidraw.d.ts} +3 -3
  66. package/dist/types/{file.d.ts → types/file.d.ts} +9 -4
  67. package/dist/types/{group.d.ts → types/group.d.ts} +5 -2
  68. package/dist/types/types/index.d.ts +25 -0
  69. package/dist/types/{judge.d.ts → types/judge.d.ts} +32 -3
  70. package/dist/types/{markdown.d.ts → types/markdown.d.ts} +1 -1
  71. package/dist/types/{mermaid.d.ts → types/mermaid.d.ts} +1 -1
  72. package/dist/types/types/prisma.d.ts +284 -0
  73. package/dist/types/{problems.d.ts → types/problems.d.ts} +13 -4
  74. package/dist/types/types/services.d.ts +213 -0
  75. package/dist/types/{sheet.d.ts → types/sheet.d.ts} +2 -3
  76. package/dist/types/{socket.d.ts → types/socket.d.ts} +3 -3
  77. package/dist/types/{teams.d.ts → types/teams.d.ts} +2 -25
  78. package/dist/types/{users.d.ts → types/users.d.ts} +4 -10
  79. package/dist/types/types/virtual-user.d.ts +7 -0
  80. package/dist/types/{worksheet.d.ts → types/worksheet.d.ts} +3 -3
  81. package/package.json +19 -21
  82. package/biome.shared.json +0 -102
  83. package/dist/constants/commons.js +0 -658
  84. package/dist/constants/company.js +0 -24
  85. package/dist/constants/contest.js +0 -29
  86. package/dist/constants/course.js +0 -12
  87. package/dist/constants/date.js +0 -23
  88. package/dist/constants/email.js +0 -34
  89. package/dist/constants/entity.js +0 -18
  90. package/dist/constants/file.js +0 -46
  91. package/dist/constants/index.d.ts +0 -18
  92. package/dist/constants/index.js +0 -18
  93. package/dist/constants/judge.js +0 -221
  94. package/dist/constants/problem.js +0 -72
  95. package/dist/constants/routing.js +0 -7
  96. package/dist/constants/services.d.ts +0 -5
  97. package/dist/constants/services.js +0 -131
  98. package/dist/constants/system.js +0 -9
  99. package/dist/constants/teams.js +0 -18
  100. package/dist/constants/time.js +0 -9
  101. package/dist/constants/user.d.ts +0 -10
  102. package/dist/constants/user.js +0 -35
  103. package/dist/constants/websocket.js +0 -5
  104. package/dist/constants/worksheet.js +0 -66
  105. package/dist/dto/class.js +0 -1
  106. package/dist/dto/code.js +0 -1
  107. package/dist/dto/comments.js +0 -1
  108. package/dist/dto/contest.js +0 -7
  109. package/dist/dto/course.js +0 -1
  110. package/dist/dto/entity.js +0 -5
  111. package/dist/dto/excalidraw.js +0 -1
  112. package/dist/dto/file.js +0 -1
  113. package/dist/dto/image.js +0 -1
  114. package/dist/dto/index.d.ts +0 -24
  115. package/dist/dto/index.js +0 -24
  116. package/dist/dto/judge.js +0 -1
  117. package/dist/dto/markdown.js +0 -1
  118. package/dist/dto/mermaid.js +0 -1
  119. package/dist/dto/organization.d.ts +0 -102
  120. package/dist/dto/organization.js +0 -1
  121. package/dist/dto/problem.js +0 -1
  122. package/dist/dto/scoreboard.js +0 -1
  123. package/dist/dto/session.js +0 -1
  124. package/dist/dto/socket.js +0 -1
  125. package/dist/dto/statistics.js +0 -1
  126. package/dist/dto/submission.js +0 -1
  127. package/dist/dto/system.js +0 -1
  128. package/dist/dto/url.js +0 -1
  129. package/dist/dto/user.js +0 -1
  130. package/dist/dto/virtual-user.js +0 -1
  131. package/dist/dto/worksheet-submissions.js +0 -1
  132. package/dist/dto/worksheet.js +0 -1
  133. package/dist/helpers/class.js +0 -10
  134. package/dist/helpers/comments.js +0 -4
  135. package/dist/helpers/commons.js +0 -191
  136. package/dist/helpers/contest.js +0 -21
  137. package/dist/helpers/document.js +0 -38
  138. package/dist/helpers/file.js +0 -4
  139. package/dist/helpers/index.d.ts +0 -14
  140. package/dist/helpers/index.js +0 -14
  141. package/dist/helpers/interval.d.ts +0 -2
  142. package/dist/helpers/interval.js +0 -22
  143. package/dist/helpers/judging.js +0 -107
  144. package/dist/helpers/object.d.ts +0 -1
  145. package/dist/helpers/object.js +0 -32
  146. package/dist/helpers/responses.d.ts +0 -8
  147. package/dist/helpers/responses.js +0 -78
  148. package/dist/helpers/socket.d.ts +0 -45
  149. package/dist/helpers/socket.js +0 -238
  150. package/dist/helpers/time.js +0 -101
  151. package/dist/helpers/user.js +0 -14
  152. package/dist/helpers/worksheet.d.ts +0 -10
  153. package/dist/helpers/worksheet.js +0 -131
  154. package/dist/index.d.ts +0 -6
  155. package/dist/index.js +0 -6
  156. package/dist/prisma/enums/AssignmentClassType.d.ts +0 -7
  157. package/dist/prisma/enums/AssignmentClassType.js +0 -6
  158. package/dist/prisma/enums/ContestEventAction.d.ts +0 -10
  159. package/dist/prisma/enums/ContestEventAction.js +0 -9
  160. package/dist/prisma/enums/ContestProblemPrerequisiteType.d.ts +0 -5
  161. package/dist/prisma/enums/ContestProblemPrerequisiteType.js +0 -4
  162. package/dist/prisma/enums/ContestRole.d.ts +0 -11
  163. package/dist/prisma/enums/ContestRole.js +0 -10
  164. package/dist/prisma/enums/ContestStatus.d.ts +0 -6
  165. package/dist/prisma/enums/ContestStatus.js +0 -5
  166. package/dist/prisma/enums/CourseRole.d.ts +0 -12
  167. package/dist/prisma/enums/CourseRole.js +0 -11
  168. package/dist/prisma/enums/EntityObjectType.d.ts +0 -13
  169. package/dist/prisma/enums/EntityObjectType.js +0 -12
  170. package/dist/prisma/enums/EntityRole.d.ts +0 -8
  171. package/dist/prisma/enums/EntityRole.js +0 -7
  172. package/dist/prisma/enums/EntitySubjectType.d.ts +0 -7
  173. package/dist/prisma/enums/EntitySubjectType.js +0 -6
  174. package/dist/prisma/enums/FileRole.d.ts +0 -9
  175. package/dist/prisma/enums/FileRole.js +0 -8
  176. package/dist/prisma/enums/FileType.d.ts +0 -5
  177. package/dist/prisma/enums/FileType.js +0 -4
  178. package/dist/prisma/enums/GroupType.d.ts +0 -5
  179. package/dist/prisma/enums/GroupType.js +0 -4
  180. package/dist/prisma/enums/JudgeType.d.ts +0 -12
  181. package/dist/prisma/enums/JudgeType.js +0 -11
  182. package/dist/prisma/enums/OrganizationPlan.d.ts +0 -7
  183. package/dist/prisma/enums/OrganizationPlan.js +0 -6
  184. package/dist/prisma/enums/ProblemRole.d.ts +0 -11
  185. package/dist/prisma/enums/ProblemRole.js +0 -10
  186. package/dist/prisma/enums/ProblemScoringMode.d.ts +0 -6
  187. package/dist/prisma/enums/ProblemScoringMode.js +0 -5
  188. package/dist/prisma/enums/ProblemType.d.ts +0 -6
  189. package/dist/prisma/enums/ProblemType.js +0 -5
  190. package/dist/prisma/enums/ProblemVerdict.d.ts +0 -14
  191. package/dist/prisma/enums/ProblemVerdict.js +0 -13
  192. package/dist/prisma/enums/ShareLinkVisibility.d.ts +0 -5
  193. package/dist/prisma/enums/ShareLinkVisibility.js +0 -4
  194. package/dist/prisma/enums/SubmissionRunStatus.d.ts +0 -18
  195. package/dist/prisma/enums/SubmissionRunStatus.js +0 -17
  196. package/dist/prisma/enums/SystemRole.d.ts +0 -9
  197. package/dist/prisma/enums/SystemRole.js +0 -8
  198. package/dist/prisma/enums/TeamRole.d.ts +0 -9
  199. package/dist/prisma/enums/TeamRole.js +0 -8
  200. package/dist/prisma/enums/TelemetryType.d.ts +0 -9
  201. package/dist/prisma/enums/TelemetryType.js +0 -8
  202. package/dist/prisma/enums/UserRole.d.ts +0 -10
  203. package/dist/prisma/enums/UserRole.js +0 -9
  204. package/dist/prisma/enums/WorkingIn.d.ts +0 -8
  205. package/dist/prisma/enums/WorkingIn.js +0 -7
  206. package/dist/prisma/enums/WorksheetContentType.d.ts +0 -10
  207. package/dist/prisma/enums/WorksheetContentType.js +0 -9
  208. package/dist/prisma/enums/index.d.ts +0 -26
  209. package/dist/prisma/enums/index.js +0 -26
  210. package/dist/prototypes/Date.js +0 -218
  211. package/dist/prototypes/Error.js +0 -17
  212. package/dist/prototypes/Number.d.ts +0 -7
  213. package/dist/prototypes/Number.js +0 -8
  214. package/dist/prototypes/index.d.ts +0 -3
  215. package/dist/prototypes/index.js +0 -3
  216. package/dist/types/account.js +0 -10
  217. package/dist/types/class.js +0 -7
  218. package/dist/types/comments.js +0 -1
  219. package/dist/types/commons.js +0 -69
  220. package/dist/types/company.d.ts +0 -6
  221. package/dist/types/company.js +0 -7
  222. package/dist/types/contest.js +0 -6
  223. package/dist/types/course.js +0 -1
  224. package/dist/types/entity.js +0 -50
  225. package/dist/types/excalidraw.js +0 -1
  226. package/dist/types/file.js +0 -13
  227. package/dist/types/group.js +0 -1
  228. package/dist/types/index.js +0 -23
  229. package/dist/types/judge.js +0 -17
  230. package/dist/types/markdown.js +0 -1
  231. package/dist/types/mermaid.js +0 -1
  232. package/dist/types/notification.js +0 -8
  233. package/dist/types/problems.js +0 -16
  234. package/dist/types/services.d.ts +0 -214
  235. package/dist/types/services.js +0 -147
  236. package/dist/types/sheet.js +0 -16
  237. package/dist/types/socket.js +0 -49
  238. package/dist/types/submission.js +0 -1
  239. package/dist/types/teams.js +0 -28
  240. package/dist/types/users.js +0 -33
  241. package/dist/types/worksheet.js +0 -11
  242. /package/dist/{constants → types/constants}/date.d.ts +0 -0
  243. /package/dist/{constants → types/constants}/email.d.ts +0 -0
  244. /package/dist/{constants → types/constants}/routing.d.ts +0 -0
  245. /package/dist/{constants → types/constants}/time.d.ts +0 -0
  246. /package/dist/{dto → types/dto}/image.d.ts +0 -0
  247. /package/dist/{dto → types/dto}/url.d.ts +0 -0
  248. /package/dist/{helpers → types/helpers}/comments.d.ts +0 -0
  249. /package/dist/{helpers → types/helpers}/file.d.ts +0 -0
  250. /package/dist/{prototypes → types/prototypes}/Date.d.ts +0 -0
  251. /package/dist/types/{account.d.ts → types/account.d.ts} +0 -0
  252. /package/dist/types/{comments.d.ts → types/comments.d.ts} +0 -0
  253. /package/dist/types/{notification.d.ts → types/notification.d.ts} +0 -0
  254. /package/dist/types/{submission.d.ts → types/submission.d.ts} +0 -0
@@ -1,18 +0,0 @@
1
- import { TeamRole } from '../prisma/enums/index.js';
2
- import { MemberRole } from '../types/index.js';
3
- export const MEMBER_ROLE = {
4
- [MemberRole.COACH]: { value: MemberRole.COACH, label: 'coach' },
5
- [MemberRole.CO_COACH]: { value: MemberRole.CO_COACH, label: 'co-coach' },
6
- [MemberRole.STAFF]: { value: MemberRole.STAFF, label: 'staff' },
7
- [MemberRole.ATTENDEE]: { value: MemberRole.ATTENDEE, label: 'attendee' },
8
- [MemberRole.RESERVE]: { value: MemberRole.RESERVE, label: 'reserve' },
9
- [MemberRole.CONTESTANT]: { value: MemberRole.CONTESTANT, label: 'contestant' },
10
- };
11
- export const TEAM_ROLE = {
12
- [TeamRole.RESTRICTED]: { value: TeamRole.RESTRICTED, label: 'restricted', level: 5 },
13
- [TeamRole.GUEST]: { value: TeamRole.GUEST, label: 'guest', level: 4 },
14
- [TeamRole.REGULAR]: { value: TeamRole.REGULAR, label: 'regular', level: 3 },
15
- [TeamRole.MANAGER]: { value: TeamRole.MANAGER, label: 'manager', level: 2 },
16
- [TeamRole.ADMIN]: { value: TeamRole.ADMIN, label: 'admin', level: 1 },
17
- [TeamRole.SUPER_ADMIN]: { value: TeamRole.SUPER_ADMIN, label: 'super admin', level: 0 },
18
- };
@@ -1,9 +0,0 @@
1
- export const ONE_SECOND = 1000;
2
- export const SEC_30 = ONE_SECOND * 30;
3
- export const SEC_60 = ONE_SECOND * 60;
4
- export const SEC_90 = ONE_SECOND * 90;
5
- export const SEC_120 = ONE_SECOND * 120;
6
- export const ONE_MINUTE = ONE_SECOND * 60;
7
- export const ONE_HOUR = ONE_MINUTE * 60;
8
- export const ONE_DAY = ONE_HOUR * 24;
9
- export const ONE_WEEK = ONE_DAY * 7;
@@ -1,10 +0,0 @@
1
- import type { UserPermissionsResponseDTO } from '../dto/index.js';
2
- import { UserRole } from '../prisma/enums/index.js';
3
- export declare const USER_ROLE: {
4
- [Key in UserRole]: {
5
- value: UserRole;
6
- label: string;
7
- level: number;
8
- };
9
- };
10
- export declare const EMPTY_USER_PERMISSIONS: UserPermissionsResponseDTO;
@@ -1,35 +0,0 @@
1
- import { UserRole } from '../prisma/enums/index.js';
2
- export const USER_ROLE = {
3
- [UserRole.RESTRICTED]: { value: UserRole.RESTRICTED, label: 'restricted', level: 6 },
4
- [UserRole.GUEST]: { value: UserRole.GUEST, label: 'guest', level: 5 },
5
- [UserRole.LIMITED]: { value: UserRole.LIMITED, label: 'limited', level: 4 },
6
- [UserRole.REGULAR]: { value: UserRole.REGULAR, label: 'regular', level: 3 },
7
- [UserRole.MANAGER]: { value: UserRole.MANAGER, label: 'manager', level: 2 },
8
- [UserRole.ADMIN]: { value: UserRole.ADMIN, label: 'admin', level: 1 },
9
- [UserRole.SUPER_ADMIN]: { value: UserRole.SUPER_ADMIN, label: 'super admin', level: 0 },
10
- };
11
- export const EMPTY_USER_PERMISSIONS = {
12
- users: {
13
- create: false,
14
- manage: false,
15
- administrate: false,
16
- },
17
- problems: {
18
- create: false,
19
- manage: false,
20
- },
21
- submissions: {
22
- manage: false,
23
- },
24
- contests: {
25
- create: false,
26
- manage: false,
27
- },
28
- company: {
29
- manage: false,
30
- administrate: false,
31
- },
32
- services: {
33
- administrate: false,
34
- },
35
- };
@@ -1,5 +0,0 @@
1
- export const CHANNEL_PUBLISH_SUBSCRIPTIONS = 'pub:subscriptions';
2
- export const CHANNEL_SUBSCRIBE_NOTIFICATIONS = 'sub:notifications';
3
- export const CHANNEL_SUBSCRIBE_CLIENT = (clientId) => `sub:client:${clientId}`;
4
- export const CHANNEL_PUBLISH_MESSAGES = 'pub:messages';
5
- export const CHANNEL_PRESENCE_CLIENT = 'pre:client';
@@ -1,66 +0,0 @@
1
- import { v4 } from 'uuid';
2
- import { AspectRatio, WorksheetType } from '../types/index.js';
3
- export const NEW_PAGE_SHEET = () => ({
4
- id: v4(),
5
- type: WorksheetType.NEW_PAGE,
6
- title: '',
7
- points: 0,
8
- });
9
- export const ASPECT_RATIO = {
10
- [AspectRatio.RATIO_21_9]: {
11
- aspectRatio: AspectRatio.RATIO_21_9,
12
- width: 2520,
13
- height: 1080,
14
- decimal: 21 / 9,
15
- label: 'ultrawide',
16
- },
17
- [AspectRatio.RATIO_20_9]: {
18
- aspectRatio: AspectRatio.RATIO_20_9,
19
- width: 2400,
20
- height: 1080,
21
- decimal: 20 / 9,
22
- label: 'mobile wide',
23
- },
24
- [AspectRatio.RATIO_16_9]: {
25
- aspectRatio: AspectRatio.RATIO_16_9,
26
- width: 1920,
27
- height: 1080,
28
- decimal: 16 / 9,
29
- label: 'widescreen',
30
- },
31
- [AspectRatio.RATIO_16_10]: {
32
- aspectRatio: AspectRatio.RATIO_16_10,
33
- width: 1920,
34
- height: 1200,
35
- decimal: 16 / 10,
36
- label: 'widescreen tall',
37
- },
38
- [AspectRatio.RATIO_3_2]: {
39
- aspectRatio: AspectRatio.RATIO_3_2,
40
- width: 1440,
41
- height: 960,
42
- decimal: 3 / 2,
43
- label: 'balanced',
44
- },
45
- [AspectRatio.RATIO_4_3]: {
46
- aspectRatio: AspectRatio.RATIO_4_3,
47
- width: 1024,
48
- height: 768,
49
- decimal: 4 / 3,
50
- label: 'standard',
51
- },
52
- [AspectRatio.RATIO_5_4]: {
53
- aspectRatio: AspectRatio.RATIO_5_4,
54
- width: 1280,
55
- height: 1024,
56
- decimal: 5 / 4,
57
- label: 'square old',
58
- },
59
- [AspectRatio.RATIO_1_1]: {
60
- aspectRatio: AspectRatio.RATIO_1_1,
61
- width: 1000,
62
- height: 1000,
63
- decimal: 1,
64
- label: 'square',
65
- },
66
- };
package/dist/dto/class.js DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/dto/code.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- export var ContestProblemBlockedByType;
2
- (function (ContestProblemBlockedByType) {
3
- ContestProblemBlockedByType["UNMET_PREREQUISITES"] = "UNMET_PREREQUISITES";
4
- ContestProblemBlockedByType["MAX_ACCEPTED_SUBMISSIONS_ACHIEVED"] = "MAX_ACCEPTED_SUBMISSIONS_ACHIEVED";
5
- ContestProblemBlockedByType["START_TIME_IN_THE_FUTURE"] = "START_TIME_IN_THE_FUTURE";
6
- ContestProblemBlockedByType["END_TIME_IN_THE_PAST"] = "END_TIME_IN_THE_PAST";
7
- })(ContestProblemBlockedByType || (ContestProblemBlockedByType = {}));
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export var MemberType;
2
- (function (MemberType) {
3
- MemberType["USER"] = "USER";
4
- MemberType["TEAM"] = "TEAM";
5
- })(MemberType || (MemberType = {}));
@@ -1 +0,0 @@
1
- export {};
package/dist/dto/file.js DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/dto/image.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- export * from './class.js';
2
- export * from './code.js';
3
- export * from './comments.js';
4
- export * from './contest.js';
5
- export * from './course.js';
6
- export * from './entity.js';
7
- export * from './excalidraw.js';
8
- export * from './file.js';
9
- export * from './image.js';
10
- export * from './judge.js';
11
- export * from './markdown.js';
12
- export * from './mermaid.js';
13
- export * from './organization.js';
14
- export * from './problem.js';
15
- export * from './scoreboard.js';
16
- export * from './session.js';
17
- export * from './socket.js';
18
- export * from './statistics.js';
19
- export * from './submission.js';
20
- export * from './system.js';
21
- export * from './url.js';
22
- export * from './user.js';
23
- export * from './worksheet.js';
24
- export * from './worksheet-submissions.js';
package/dist/dto/index.js DELETED
@@ -1,24 +0,0 @@
1
- export * from './class.js';
2
- export * from './code.js';
3
- export * from './comments.js';
4
- export * from './contest.js';
5
- export * from './course.js';
6
- export * from './entity.js';
7
- export * from './excalidraw.js';
8
- export * from './file.js';
9
- export * from './image.js';
10
- export * from './judge.js';
11
- export * from './markdown.js';
12
- export * from './mermaid.js';
13
- export * from './organization.js';
14
- export * from './problem.js';
15
- export * from './scoreboard.js';
16
- export * from './session.js';
17
- export * from './socket.js';
18
- export * from './statistics.js';
19
- export * from './submission.js';
20
- export * from './system.js';
21
- export * from './url.js';
22
- export * from './user.js';
23
- export * from './worksheet.js';
24
- export * from './worksheet-submissions.js';
package/dist/dto/judge.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,102 +0,0 @@
1
- import type { OrganizationPlan } from '../prisma/enums/index.js';
2
- import type { Theme } from '../types/index.js';
3
- import type { EmailDataResponseDTO } from './system.js';
4
- import type { UserOrganizationBasicInfoResponseDTO, UserPermissionsResponseDTO } from './user.js';
5
- export interface OrganizationJudgeResponseDTO {
6
- key: string;
7
- name: string;
8
- keyPrefix: string;
9
- }
10
- export interface OrganizationTrustedCompanyResponseDTO {
11
- key: string;
12
- name: string;
13
- }
14
- export interface OrganizationResponseDTO extends EmailDataResponseDTO {
15
- name: string;
16
- key: string;
17
- hosts: string[];
18
- imageUrl: string;
19
- managerUser: UserOrganizationBasicInfoResponseDTO;
20
- systemAdminUser: UserOrganizationBasicInfoResponseDTO;
21
- plan: OrganizationPlan;
22
- startTimestamp: number;
23
- judges: OrganizationJudgeResponseDTO[];
24
- trustedCompanies: OrganizationTrustedCompanyResponseDTO[];
25
- styles: OrganizationStylesResponseDTO;
26
- }
27
- export interface OrganizationUserPermissionsResponseDTO extends OrganizationResponseDTO {
28
- userPermissions: UserPermissionsResponseDTO;
29
- contactEmail: string;
30
- contactCellPhoneNumber: string;
31
- contactTelegram: string;
32
- }
33
- export interface OrganizationResourcesEcsSpec {
34
- taskDefinition: string;
35
- minimum: number;
36
- maximum: number;
37
- }
38
- export interface OrganizationResourcesEc2Instance {
39
- imageId: string;
40
- instanceType: string;
41
- userDataScript: string;
42
- minimum: number;
43
- maximum: number;
44
- }
45
- export interface OrganizationResourcesTelegramChannel {
46
- chatId: string;
47
- messageThreadId: string;
48
- }
49
- export interface OrganizationResourcesResponseDTO {
50
- ecs: {
51
- listener: OrganizationResourcesEcsSpec;
52
- highPerformanceRunner: OrganizationResourcesEcsSpec;
53
- lowPerformanceRunner: OrganizationResourcesEcsSpec;
54
- };
55
- ec2: {
56
- runner: OrganizationResourcesEc2Instance;
57
- highPerformanceRunner: OrganizationResourcesEc2Instance;
58
- lowPerformanceRunner: OrganizationResourcesEc2Instance;
59
- };
60
- notifications: {
61
- telegram: {
62
- enabled: boolean;
63
- info: OrganizationResourcesTelegramChannel;
64
- error: OrganizationResourcesTelegramChannel;
65
- };
66
- slack: {
67
- enabled: boolean;
68
- info: {
69
- webhookUrl: string;
70
- };
71
- error: {
72
- webhookUrl: string;
73
- };
74
- };
75
- email: {
76
- enabled: boolean;
77
- info: {
78
- address: string;
79
- };
80
- error: {
81
- address: string;
82
- };
83
- };
84
- };
85
- }
86
- export type OrganizationStylesResponseDTO = Record<'light' | 'dark', {
87
- body: {
88
- backgroundColor: string;
89
- backgroundColorHighlight: string;
90
- textColor: string;
91
- textColorHighlight: string;
92
- textColorHighlightInset: string;
93
- accentColor: string;
94
- accentColorInset: string;
95
- };
96
- navbar: {
97
- textColor: string;
98
- backgroundColor: string;
99
- logoTheme: Theme;
100
- accentColor: string;
101
- };
102
- }>;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
package/dist/dto/url.js DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/dto/user.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- import { WorksheetType, } from '../types/index.js';
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import { AssignmentClass } from '../types/index.js';
2
- export const isWorksheetAssignment = (assignment) => {
3
- return assignment.type === AssignmentClass.WORKSHEET;
4
- };
5
- export const isCourseAssignment = (assignment) => {
6
- return assignment.type === AssignmentClass.COURSE;
7
- };
8
- export const isContestAssignment = (assignment) => {
9
- return assignment.type === AssignmentClass.CONTEST;
10
- };
@@ -1,4 +0,0 @@
1
- export const getAssignmentCommentKey = (classKey, cycleKey, sessionKey, assignmentKey) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}`;
2
- export const getAssignmentUserCommentKey = (classKey, cycleKey, sessionKey, assignmentKey, userNickname, userCompany) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}|user_nickname:${userNickname}|user_company:${userCompany}`;
3
- export const getProblemCommentKey = (problemKey) => `problem:${problemKey}`;
4
- export const getContestCommentKey = (contestKey) => `contest:${contestKey}`;
@@ -1,191 +0,0 @@
1
- import { SEPARATOR_TOKEN, UPPERCASE_LETTERS } from '../constants/commons.js';
2
- export function isStringJson(str) {
3
- try {
4
- if (typeof str === 'string') {
5
- JSON.parse(str);
6
- return true;
7
- }
8
- }
9
- catch {
10
- return false;
11
- }
12
- return false;
13
- }
14
- export function safeJsonParse(str) {
15
- try {
16
- if (typeof str === 'string') {
17
- return JSON.parse(str);
18
- }
19
- }
20
- catch {
21
- return null;
22
- }
23
- return null;
24
- }
25
- export function isObjectJson(obj) {
26
- try {
27
- return typeof JSON.stringify(obj) === 'string';
28
- }
29
- catch {
30
- return false;
31
- }
32
- }
33
- export function mex(array) {
34
- let i = 0;
35
- while (array.indexOf(i) !== -1) {
36
- i++;
37
- }
38
- return i;
39
- }
40
- export function range(start, end) {
41
- const result = [];
42
- for (let i = start; i < end; i++) {
43
- result.push(i);
44
- }
45
- return result;
46
- }
47
- export async function getPlainText(url) {
48
- return await fetch(url)
49
- .then((data) => data.text())
50
- .catch((error) => {
51
- console.error('ERROR:', error);
52
- return '';
53
- });
54
- }
55
- function mergeRecords(b, u) {
56
- const mergeKeys = new Set([...Object.keys(b), ...Object.keys(u)]);
57
- for (const key of mergeKeys) {
58
- if (u[key] !== null && u[key] !== undefined && b[key] !== u[key]) {
59
- b[key] = objectUpdate(b[key], u[key]);
60
- }
61
- }
62
- return b;
63
- }
64
- export function objectUpdate(base, update) {
65
- if (JSON.stringify(base) === JSON.stringify(update)) {
66
- return base;
67
- }
68
- if (base !== null && update !== null && !Array.isArray(base) && typeof base === 'object' && typeof update === 'object') {
69
- return mergeRecords(base, update);
70
- }
71
- if (update !== null && update !== undefined) {
72
- return update;
73
- }
74
- return base;
75
- }
76
- export function objectsUpdate(base, ...objects) {
77
- let newObject = { ...base };
78
- for (const update of objects) {
79
- newObject = objectUpdate(newObject, update);
80
- }
81
- return newObject;
82
- }
83
- export function consoleWarn(...warn) {
84
- console.warn(new Date().toLocaleString(), ...warn);
85
- }
86
- export function consoleInfo(...info) {
87
- console.info(new Date().toLocaleString(), ...info);
88
- }
89
- export function consoleError(...error) {
90
- console.error(new Date().toLocaleString(), ...error);
91
- }
92
- export function indexToLetters(index) {
93
- const d = Math.ceil(index / 26);
94
- if (d === 1) {
95
- return UPPERCASE_LETTERS.charAt(index - 1);
96
- }
97
- return UPPERCASE_LETTERS.charAt(d - 2) + UPPERCASE_LETTERS.charAt(index - 26 * (d - 1) - 1);
98
- }
99
- export function lettersToIndex(index) {
100
- if (index.length) {
101
- if (index.length === 1) {
102
- const d = UPPERCASE_LETTERS.indexOf(index);
103
- if (d !== -1) {
104
- return d + 1;
105
- }
106
- }
107
- else if (index.length === 2) {
108
- const a = index.charAt(0);
109
- const b = index.charAt(1);
110
- const numA = lettersToIndex(a);
111
- const numB = lettersToIndex(b);
112
- return numA * 26 + numB;
113
- }
114
- }
115
- return 0;
116
- }
117
- export function getProblemJudgeKey(judge, key) {
118
- return `${judge}-${key}`;
119
- }
120
- /**
121
- * https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string
122
- * Format bytes as human-readable text.
123
- *
124
- * @param bytes Number of bytes.
125
- * @param si True to use metric (SI) units, aka powers of 1000. False to use
126
- * binary (IEC), aka powers of 1024.
127
- * @param dp Number of decimal places to display.
128
- *
129
- * @return Formatted string.
130
- */
131
- export function humanFileSize(bytes, si = false, dp = 1) {
132
- const thresh = si ? 1000 : 1024;
133
- if (Math.abs(bytes) < thresh) {
134
- return `${bytes} B`;
135
- }
136
- const units = si
137
- ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
138
- : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
139
- let u = -1;
140
- let value = bytes;
141
- const r = 10 ** dp;
142
- do {
143
- value /= thresh;
144
- ++u;
145
- } while (Math.round(Math.abs(value) * r) / r >= thresh && u < units.length - 1);
146
- return `${value.toFixed(dp)} ${units[u]}`;
147
- }
148
- export function stringToArrayBuffer(str) {
149
- const buf = new ArrayBuffer(str.length); //convert str to arrayBuffer
150
- const view = new Uint8Array(buf); //create Uint8Array as viewer
151
- for (let i = 0; i < str.length; i++) {
152
- view[i] = str.charCodeAt(i) & 0xff; //convert to octet
153
- }
154
- return buf;
155
- }
156
- export function chunkString(str, size) {
157
- const numChunks = Math.ceil(str.length / size);
158
- const chunks = new Array(numChunks);
159
- for (let i = 0, o = 0; i < numChunks; ++i, o += size) {
160
- chunks[i] = str.substr(o, size);
161
- }
162
- return chunks;
163
- }
164
- export function getRandomString(length) {
165
- const charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; // 62
166
- let retVal = '';
167
- for (let i = 0; i < length; ++i) {
168
- retVal += charset.charAt(Math.floor(Math.random() * charset.length));
169
- }
170
- return retVal;
171
- }
172
- export function join(array) {
173
- return array.join(SEPARATOR_TOKEN);
174
- }
175
- export function split(text) {
176
- return text.split(SEPARATOR_TOKEN);
177
- }
178
- export const areArraysDifferent = (a, b) => {
179
- if (a === b) {
180
- return false;
181
- }
182
- if (a.length !== b.length) {
183
- return true;
184
- }
185
- for (let i = 0; i < b.length; i += 1) {
186
- if (b[i] !== a[i]) {
187
- return true;
188
- }
189
- }
190
- return false;
191
- };
@@ -1,21 +0,0 @@
1
- import { MAX_DATE, MIN_DATE } from '../constants/index.js';
2
- export const isEndlessContest = (settings) => {
3
- return (settings?.startTimestamp === MIN_DATE.getTime() &&
4
- settings?.frozenTimestamp === MAX_DATE.getTime() &&
5
- settings?.quietTimestamp === MAX_DATE.getTime() &&
6
- settings?.endTimestamp === MAX_DATE.getTime() &&
7
- settings?.penalty === 0);
8
- };
9
- export const isGlobalContest = (settings) => {
10
- return (settings?.startTimestamp === 0 &&
11
- settings?.frozenTimestamp === 0 &&
12
- settings?.quietTimestamp === 0 &&
13
- settings?.endTimestamp === 0 &&
14
- settings?.penalty === 0);
15
- };
16
- export const isPastContest = (settings) => {
17
- return Date.now() > (settings?.endTimestamp ?? 0);
18
- };
19
- export const isFutureContest = (settings) => {
20
- return (settings?.startTimestamp ?? 0) > Date.now();
21
- };
@@ -1,38 +0,0 @@
1
- import { EntityAccess, EntityMembersRank, } from '../types/index.js';
2
- export const getDocumentAccess = (document) => {
3
- const members = document?.members;
4
- const adminRank = members?.rankAdministrators;
5
- const adminClosed = adminRank === EntityMembersRank.NONE || adminRank === EntityMembersRank.CLOSE;
6
- if (!adminClosed)
7
- return EntityAccess.PRIVATE;
8
- const spectatorsOpen = members?.rankSpectators === EntityMembersRank.OPEN;
9
- const managersOpen = members?.rankManagers === EntityMembersRank.OPEN;
10
- const managersClose = members?.rankManagers === EntityMembersRank.CLOSE;
11
- if (spectatorsOpen && managersOpen)
12
- return EntityAccess.EXPOSED;
13
- if (spectatorsOpen && managersClose)
14
- return EntityAccess.PUBLIC;
15
- if (managersClose)
16
- return EntityAccess.RESTRICTED;
17
- return EntityAccess.PRIVATE;
18
- };
19
- export const isUserMember = (member) => {
20
- return typeof member.userId === 'string';
21
- };
22
- export const isTeamMember = (member) => {
23
- return typeof member.teamId === 'string';
24
- };
25
- export const toEntityMembersDTO = (members) => {
26
- return {
27
- rankAdministrators: members.rankAdministrators,
28
- administrators: Object.keys(members.administrators),
29
- rankManagers: members.rankManagers,
30
- managers: Object.keys(members.managers),
31
- rankParticipants: members.rankParticipants,
32
- participants: Object.keys(members.participants),
33
- rankGuests: members.rankGuests,
34
- guests: Object.keys(members.guests),
35
- rankSpectators: members.rankSpectators,
36
- spectators: Object.keys(members.spectators),
37
- };
38
- };
@@ -1,4 +0,0 @@
1
- export function removeExtension(fileName) {
2
- const i = fileName.lastIndexOf('.');
3
- return i !== -1 ? fileName.substring(0, i) : fileName;
4
- }