@juki-team/commons 0.1.46 → 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.
- package/dist/{types/constants → constants}/commons.d.ts +1 -1
- package/dist/constants/commons.js +648 -0
- package/dist/{types/constants → constants}/contest.d.ts +1 -1
- package/dist/constants/contest.js +28 -0
- package/dist/{types/constants → constants}/course.d.ts +1 -1
- package/dist/constants/course.js +12 -0
- package/dist/constants/date.js +23 -0
- package/dist/constants/email.js +34 -0
- package/dist/{types/constants → constants}/entity.d.ts +1 -1
- package/dist/constants/entity.js +18 -0
- package/dist/{types/constants → constants}/file.d.ts +1 -1
- package/dist/constants/file.js +45 -0
- package/dist/constants/index.d.ts +18 -0
- package/dist/constants/index.js +18 -0
- package/dist/{types/constants → constants}/judge.d.ts +1 -1
- package/dist/constants/judge.js +225 -0
- package/dist/{types/constants → constants}/organization.d.ts +1 -1
- package/dist/constants/organization.js +24 -0
- package/dist/{types/constants → constants}/problem.d.ts +1 -1
- package/dist/constants/problem.js +69 -0
- package/dist/constants/routing.js +7 -0
- package/dist/{types/constants → constants}/services.d.ts +1 -1
- package/dist/constants/services.js +157 -0
- package/dist/{types/constants → constants}/system.d.ts +1 -1
- package/dist/constants/system.js +9 -0
- package/dist/{types/constants → constants}/teams.d.ts +1 -1
- package/dist/constants/teams.js +17 -0
- package/dist/constants/time.js +9 -0
- package/dist/{types/constants → constants}/user.d.ts +2 -2
- package/dist/constants/user.js +40 -0
- package/dist/{types/constants → constants}/websocket.d.ts +7 -3
- package/dist/constants/websocket.js +56 -0
- package/dist/{types/constants → constants}/worksheet.d.ts +1 -1
- package/dist/constants/worksheet.js +66 -0
- package/dist/{types/dto → dto}/class.d.ts +3 -3
- package/dist/dto/class.js +1 -0
- package/dist/{types/dto → dto}/code.d.ts +1 -1
- package/dist/dto/code.js +1 -0
- package/dist/{types/dto → dto}/comments.d.ts +1 -1
- package/dist/dto/comments.js +1 -0
- package/dist/{types/dto → dto}/contest.d.ts +4 -4
- package/dist/dto/contest.js +7 -0
- package/dist/{types/dto → dto}/course.d.ts +4 -4
- package/dist/dto/course.js +1 -0
- package/dist/{types/dto → dto}/entity.d.ts +2 -2
- package/dist/dto/entity.js +5 -0
- package/dist/{types/dto → dto}/excalidraw.d.ts +3 -3
- package/dist/dto/excalidraw.js +1 -0
- package/dist/{types/dto → dto}/file.d.ts +2 -2
- package/dist/dto/file.js +1 -0
- package/dist/dto/image.js +1 -0
- package/dist/dto/index.d.ts +25 -0
- package/dist/dto/index.js +25 -0
- package/dist/{types/dto → dto}/judge.d.ts +1 -1
- package/dist/dto/judge.js +1 -0
- package/dist/{types/dto → dto}/markdown.d.ts +3 -3
- package/dist/dto/markdown.js +1 -0
- package/dist/{types/dto → dto}/mermaid.d.ts +3 -3
- package/dist/dto/mermaid.js +1 -0
- package/dist/{types/dto → dto}/organization.d.ts +3 -3
- package/dist/dto/organization.js +1 -0
- package/dist/{types/dto → dto}/problem.d.ts +3 -3
- package/dist/dto/problem.js +1 -0
- package/dist/{types/dto → dto}/scoreboard.d.ts +2 -2
- package/dist/dto/scoreboard.js +1 -0
- package/dist/{types/dto → dto}/session.d.ts +2 -2
- package/dist/dto/session.js +1 -0
- package/dist/{types/dto → dto}/socket.d.ts +5 -5
- package/dist/dto/socket.js +1 -0
- package/dist/{types/dto → dto}/statistics.d.ts +1 -1
- package/dist/dto/statistics.js +1 -0
- package/dist/{types/dto → dto}/submission.d.ts +3 -3
- package/dist/dto/submission.js +1 -0
- package/dist/{types/dto → dto}/system.d.ts +1 -1
- package/dist/dto/system.js +1 -0
- package/dist/dto/url.js +1 -0
- package/dist/{types/dto → dto}/user.d.ts +3 -3
- package/dist/dto/user.js +1 -0
- package/dist/{types/dto → dto}/virtual-user.d.ts +1 -1
- package/dist/dto/virtual-user.js +1 -0
- package/dist/{types/dto → dto}/worksheet-submissions.d.ts +3 -3
- package/dist/dto/worksheet-submissions.js +1 -0
- package/dist/{types/dto → dto}/worksheet.d.ts +3 -3
- package/dist/dto/worksheet.js +1 -0
- package/dist/{types/helpers → helpers}/class.d.ts +1 -1
- package/dist/helpers/class.js +10 -0
- package/dist/helpers/comments.js +4 -0
- package/dist/{types/helpers → helpers}/commons.d.ts +1 -1
- package/dist/helpers/commons.js +187 -0
- package/dist/{types/helpers → helpers}/contest.d.ts +1 -1
- package/dist/helpers/contest.js +21 -0
- package/dist/helpers/date.js +181 -0
- package/dist/{types/helpers → helpers}/document.d.ts +2 -2
- package/dist/helpers/document.js +51 -0
- package/dist/{types/helpers → helpers}/errors.d.ts +1 -1
- package/dist/helpers/errors.js +17 -0
- package/dist/helpers/file.js +4 -0
- package/dist/helpers/index.d.ts +17 -0
- package/dist/helpers/index.js +17 -0
- package/dist/helpers/interval.js +24 -0
- package/dist/{types/helpers → helpers}/judging.d.ts +1 -1
- package/dist/helpers/judging.js +124 -0
- package/dist/helpers/number.js +2 -0
- package/dist/helpers/object.js +33 -0
- package/dist/{types/helpers → helpers}/responses.d.ts +2 -2
- package/dist/helpers/responses.js +95 -0
- package/dist/{types/helpers → helpers}/socket.d.ts +3 -3
- package/dist/helpers/socket.js +279 -0
- package/dist/{types/helpers → helpers}/time.d.ts +1 -1
- package/dist/helpers/time.js +69 -0
- package/dist/{types/helpers → helpers}/user.d.ts +1 -1
- package/dist/helpers/user.js +14 -0
- package/dist/{types/helpers → helpers}/worksheet.d.ts +1 -1
- package/dist/helpers/worksheet.js +107 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/types/account.js +10 -0
- package/dist/types/{types/class.d.ts → class.d.ts} +2 -2
- package/dist/types/class.js +7 -0
- package/dist/types/comments.js +1 -0
- package/dist/types/{types/commons.d.ts → commons.d.ts} +1 -1
- package/dist/types/commons.js +69 -0
- package/dist/types/{types/contest.d.ts → contest.d.ts} +4 -4
- package/dist/types/contest.js +27 -0
- package/dist/types/{types/course.d.ts → course.d.ts} +1 -1
- package/dist/types/course.js +1 -0
- package/dist/types/entity.js +50 -0
- package/dist/types/{types/excalidraw.d.ts → excalidraw.d.ts} +1 -1
- package/dist/types/excalidraw.js +1 -0
- package/dist/types/{types/file.d.ts → file.d.ts} +2 -2
- package/dist/types/file.js +19 -0
- package/dist/types/{types/group.d.ts → group.d.ts} +1 -1
- package/dist/types/group.js +5 -0
- package/dist/types/index.d.ts +27 -4
- package/dist/types/index.js +27 -0
- package/dist/types/{types/judge.d.ts → judge.d.ts} +2 -2
- package/dist/types/judge.js +49 -0
- package/dist/types/{types/markdown.d.ts → markdown.d.ts} +1 -1
- package/dist/types/markdown.js +1 -0
- package/dist/types/{types/mermaid.d.ts → mermaid.d.ts} +1 -1
- package/dist/types/mermaid.js +1 -0
- package/dist/types/notification.js +8 -0
- package/dist/types/organization.js +14 -0
- package/dist/types/{types/prisma.d.ts → prisma.d.ts} +1 -1
- package/dist/types/prisma.js +106 -0
- package/dist/types/{types/problems.d.ts → problems.d.ts} +3 -3
- package/dist/types/problems.js +28 -0
- package/dist/types/scoreboard.js +1 -0
- package/dist/types/{types/services.d.ts → services.d.ts} +1 -1
- package/dist/types/services.js +152 -0
- package/dist/types/{types/sheet.d.ts → sheet.d.ts} +2 -2
- package/dist/types/sheet.js +16 -0
- package/dist/types/{types/socket.d.ts → socket.d.ts} +3 -2
- package/dist/types/socket.js +76 -0
- package/dist/types/submission.js +1 -0
- package/dist/types/system.js +1 -0
- package/dist/types/{types/teams.d.ts → teams.d.ts} +2 -2
- package/dist/types/teams.js +1 -0
- package/dist/types/{types/users.d.ts → users.d.ts} +2 -2
- package/dist/types/users.js +23 -0
- package/dist/types/virtual-user.js +8 -0
- package/dist/types/{types/worksheet.d.ts → worksheet.d.ts} +3 -3
- package/dist/types/worksheet.js +11 -0
- package/package.json +8 -11
- package/dist/cjs/index.cjs +0 -3695
- package/dist/esm/index.js +0 -3415
- package/dist/types/constants/index.d.ts +0 -18
- package/dist/types/dto/index.d.ts +0 -25
- package/dist/types/helpers/index.d.ts +0 -17
- package/dist/types/types/index.d.ts +0 -27
- /package/dist/{types/constants → constants}/date.d.ts +0 -0
- /package/dist/{types/constants → constants}/email.d.ts +0 -0
- /package/dist/{types/constants → constants}/routing.d.ts +0 -0
- /package/dist/{types/constants → constants}/time.d.ts +0 -0
- /package/dist/{types/dto → dto}/image.d.ts +0 -0
- /package/dist/{types/dto → dto}/url.d.ts +0 -0
- /package/dist/{types/helpers → helpers}/comments.d.ts +0 -0
- /package/dist/{types/helpers → helpers}/date.d.ts +0 -0
- /package/dist/{types/helpers → helpers}/file.d.ts +0 -0
- /package/dist/{types/helpers → helpers}/interval.d.ts +0 -0
- /package/dist/{types/helpers → helpers}/number.d.ts +0 -0
- /package/dist/{types/helpers → helpers}/object.d.ts +0 -0
- /package/dist/types/{types/account.d.ts → account.d.ts} +0 -0
- /package/dist/types/{types/comments.d.ts → comments.d.ts} +0 -0
- /package/dist/types/{types/entity.d.ts → entity.d.ts} +0 -0
- /package/dist/types/{types/notification.d.ts → notification.d.ts} +0 -0
- /package/dist/types/{types/organization.d.ts → organization.d.ts} +0 -0
- /package/dist/types/{types/scoreboard.d.ts → scoreboard.d.ts} +0 -0
- /package/dist/types/{types/submission.d.ts → submission.d.ts} +0 -0
- /package/dist/types/{types/system.d.ts → system.d.ts} +0 -0
- /package/dist/types/{types/virtual-user.d.ts → virtual-user.d.ts} +0 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { CHANNEL_CONTEST, CHANNEL_PROBLEM, CHANNEL_SUBMISSION, CHANNEL_USER_ROLE, } from '../constants/websocket.js';
|
|
2
|
+
import { ContestChannelRole, ProblemChannelRole, ProblemVerdict, SubmissionRunStatus, UserChannelRole, WebSocketResponseEvent, WebSocketSubscriptionEvent, } from '../types/index.js';
|
|
3
|
+
import { join } from './commons.js';
|
|
4
|
+
export const isWebsocketSubscription = (event) => {
|
|
5
|
+
return Object.values(WebSocketSubscriptionEvent).includes(event?.event)
|
|
6
|
+
&& typeof event?.clientId === 'string' && !!event.clientId;
|
|
7
|
+
};
|
|
8
|
+
// CHANNEL_PUBLISH_SUBSCRIPTIONS
|
|
9
|
+
export const isSubscribeCodeRunStatusWebSocketEventDto = (event) => {
|
|
10
|
+
return isWebsocketSubscription(event)
|
|
11
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_CODE_RUN_STATUS
|
|
12
|
+
&& typeof event?.runId === 'string' && !!event.runId;
|
|
13
|
+
};
|
|
14
|
+
export const isUnsubscribeCodeRunStatusWebSocketEventDto = (event) => {
|
|
15
|
+
return isWebsocketSubscription(event)
|
|
16
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_CODE_RUN_STATUS
|
|
17
|
+
&& typeof event?.runId === 'string' && !!event.runId;
|
|
18
|
+
};
|
|
19
|
+
export const isSubscribeSubmissionRunStatusWebSocketEventDto = (event) => {
|
|
20
|
+
return isWebsocketSubscription(event)
|
|
21
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSION_RUN_STATUS
|
|
22
|
+
&& typeof event?.submitId === 'string' && !!event.submitId;
|
|
23
|
+
};
|
|
24
|
+
export const isUnsubscribeSubmissionRunStatusWebSocketEventDto = (event) => {
|
|
25
|
+
return isWebsocketSubscription(event)
|
|
26
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSION_RUN_STATUS
|
|
27
|
+
&& typeof event?.submitId === 'string' && !!event.submitId;
|
|
28
|
+
};
|
|
29
|
+
export const isSubscribeGetDataWebSocketEventDto = (event) => {
|
|
30
|
+
return isWebsocketSubscription(event)
|
|
31
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_GET_DATA;
|
|
32
|
+
};
|
|
33
|
+
export const isUnsubscribeGetDataWebSocketEventDto = (event) => {
|
|
34
|
+
return isWebsocketSubscription(event)
|
|
35
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_GET_DATA;
|
|
36
|
+
};
|
|
37
|
+
export const isSubscribeProblemCrawledWebSocketEventDto = (event) => {
|
|
38
|
+
return isWebsocketSubscription(event)
|
|
39
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_PROBLEM_CRAWLED;
|
|
40
|
+
};
|
|
41
|
+
export const isUnsubscribeProblemCrawledWebSocketEventDto = (event) => {
|
|
42
|
+
return isWebsocketSubscription(event)
|
|
43
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_PROBLEM_CRAWLED;
|
|
44
|
+
};
|
|
45
|
+
export const isSubscribeSubmissionsCrawlWebSocketEventDto = (event) => {
|
|
46
|
+
return isWebsocketSubscription(event)
|
|
47
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSIONS_CRAWL;
|
|
48
|
+
};
|
|
49
|
+
export const isUnsubscribeSubmissionsCrawlWebSocketEventDto = (event) => {
|
|
50
|
+
return isWebsocketSubscription(event)
|
|
51
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSIONS_CRAWL;
|
|
52
|
+
};
|
|
53
|
+
export const isSubscribeContestChangesWebSocketEventDto = (event) => {
|
|
54
|
+
return isWebsocketSubscription(event)
|
|
55
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_CONTEST_CHANGES;
|
|
56
|
+
};
|
|
57
|
+
export const isUnsubscribeContestChangesWebSocketEventDto = (event) => {
|
|
58
|
+
return isWebsocketSubscription(event)
|
|
59
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_CONTEST_CHANGES;
|
|
60
|
+
};
|
|
61
|
+
export const isSubscribeUserNotificationWebSocketEventDto = (event) => {
|
|
62
|
+
return isWebsocketSubscription(event)
|
|
63
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_USER_NOTIFICATION;
|
|
64
|
+
};
|
|
65
|
+
export const isUnsubscribeUserNotificationWebSocketEventDto = (event) => {
|
|
66
|
+
return isWebsocketSubscription(event)
|
|
67
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_USER_NOTIFICATION;
|
|
68
|
+
};
|
|
69
|
+
const isNonEmptyString = (value) => typeof value === 'string' && !!value;
|
|
70
|
+
/**
|
|
71
|
+
* Exactly one of `problemKey` / `contestKey` / `userKey` is set.
|
|
72
|
+
*/
|
|
73
|
+
export const isSubmissionsJudgingScope = (scope) => {
|
|
74
|
+
return [scope?.problemKey, scope?.contestKey, scope?.userKey].filter(isNonEmptyString).length === 1;
|
|
75
|
+
};
|
|
76
|
+
export const isSubscribeSubmissionsJudgingWebSocketEventDto = (event) => {
|
|
77
|
+
return isWebsocketSubscription(event)
|
|
78
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSIONS_JUDGING
|
|
79
|
+
&& isSubmissionsJudgingScope(event);
|
|
80
|
+
};
|
|
81
|
+
export const isUnsubscribeSubmissionsJudgingWebSocketEventDto = (event) => {
|
|
82
|
+
return isWebsocketSubscription(event)
|
|
83
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSIONS_JUDGING
|
|
84
|
+
&& isSubmissionsJudgingScope(event);
|
|
85
|
+
};
|
|
86
|
+
// is WebSocketResponseEventDto, CHANNEL_SUBSCRIBE_CLIENT
|
|
87
|
+
export const isWebSocketResponseEventDto = (event) => {
|
|
88
|
+
return Object.values(WebSocketResponseEvent).includes(event?.event)
|
|
89
|
+
&& typeof event?.key === 'string'
|
|
90
|
+
&& typeof event?.connectionId === 'string'
|
|
91
|
+
&& typeof event?.createdAt === 'number' && !!event.createdAt;
|
|
92
|
+
};
|
|
93
|
+
export const isCodeRunStatusMessageWebSocketResponseEventDto = (event) => {
|
|
94
|
+
return isWebSocketResponseEventDto(event)
|
|
95
|
+
&& event?.event === WebSocketResponseEvent.CODE_RUN_STATUS
|
|
96
|
+
&& typeof event?.runId === 'string' && !!event.runId
|
|
97
|
+
&& event?.status in SubmissionRunStatus;
|
|
98
|
+
};
|
|
99
|
+
export const isSubmissionRunStatusMessageWebSocketResponseEventDto = (event) => {
|
|
100
|
+
return isWebSocketResponseEventDto(event)
|
|
101
|
+
&& event?.event === WebSocketResponseEvent.SUBMISSION_RUN_STATUS
|
|
102
|
+
&& typeof event?.submitId === 'string' && !!event.submitId
|
|
103
|
+
&& event?.status in SubmissionRunStatus
|
|
104
|
+
&& event?.verdict in ProblemVerdict
|
|
105
|
+
&& typeof event?.points === 'number';
|
|
106
|
+
};
|
|
107
|
+
export const isSubmissionJudgingWebSocketResponseEventDto = (event) => {
|
|
108
|
+
return isWebSocketResponseEventDto(event)
|
|
109
|
+
&& event?.event === WebSocketResponseEvent.SUBMISSION_JUDGING
|
|
110
|
+
&& isNonEmptyString(event?.submitId)
|
|
111
|
+
&& isNonEmptyString(event?.problemKey)
|
|
112
|
+
&& (event?.contestKey === null || isNonEmptyString(event?.contestKey))
|
|
113
|
+
&& isNonEmptyString(event?.userKey)
|
|
114
|
+
&& typeof event?.judging === 'boolean'
|
|
115
|
+
&& event?.status in SubmissionRunStatus
|
|
116
|
+
&& event?.verdict in ProblemVerdict
|
|
117
|
+
&& typeof event?.points === 'number';
|
|
118
|
+
};
|
|
119
|
+
export const isUserMessageWebSocketResponseEventDto = (event) => {
|
|
120
|
+
return isWebSocketResponseEventDto(event)
|
|
121
|
+
&& event?.event === WebSocketResponseEvent.USER_MESSAGE
|
|
122
|
+
&& typeof event?.user?.nickname === 'string' && !!event.user?.nickname
|
|
123
|
+
&& typeof event?.user?.imageUrl === 'string' && !!event.user?.imageUrl
|
|
124
|
+
&& typeof event?.user?.organization?.key === 'string' && !!event.user?.organization?.key
|
|
125
|
+
&& !!event?.content;
|
|
126
|
+
};
|
|
127
|
+
export const isSendDataWebSocketResponseEventDto = (event) => {
|
|
128
|
+
return [
|
|
129
|
+
WebSocketResponseEvent.SEND_DATA_ECS_TASK_DEFINITIONS_LIST,
|
|
130
|
+
WebSocketResponseEvent.SEND_DATA_EC2_INSTANCES_LIST,
|
|
131
|
+
WebSocketResponseEvent.SEND_DATA_ECS_TASKS_LIST,
|
|
132
|
+
WebSocketResponseEvent.SEND_DATA_SSM_SESSIONS_LIST,
|
|
133
|
+
WebSocketResponseEvent.SEND_DATA_RUN_COMMAND,
|
|
134
|
+
].includes(event?.event)
|
|
135
|
+
&& typeof event?.dataId === 'string' && !!event.dataId
|
|
136
|
+
&& !!event?.content;
|
|
137
|
+
};
|
|
138
|
+
export const isSendDataEcsTaskDefinitionListWebSocketResponseEventDto = (event) => {
|
|
139
|
+
return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
|
|
140
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_ECS_TASK_DEFINITIONS_LIST;
|
|
141
|
+
};
|
|
142
|
+
export const isSendDataEc2InstancesListWebSocketResponseEventDto = (event) => {
|
|
143
|
+
return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
|
|
144
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_EC2_INSTANCES_LIST;
|
|
145
|
+
};
|
|
146
|
+
export const isSendDataEcsTasksListWebSocketResponseEventDto = (event) => {
|
|
147
|
+
return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
|
|
148
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_ECS_TASKS_LIST;
|
|
149
|
+
};
|
|
150
|
+
export const isSendDataSsmSessionsListWebSocketResponseEventDto = (event) => {
|
|
151
|
+
return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
|
|
152
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_SSM_SESSIONS_LIST;
|
|
153
|
+
};
|
|
154
|
+
export const isSendDataRunCommandWebSocketResponseEventDto = (event) => {
|
|
155
|
+
return isWebSocketResponseEventDto(event) && isSendDataWebSocketResponseEventDto(event)
|
|
156
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_RUN_COMMAND;
|
|
157
|
+
};
|
|
158
|
+
export const isProblemCrawledWebSocketResponseEventDto = (event) => {
|
|
159
|
+
return isWebSocketResponseEventDto(event)
|
|
160
|
+
&& event?.event === WebSocketResponseEvent.PROBLEM_CRAWLED
|
|
161
|
+
&& !!event?.content;
|
|
162
|
+
};
|
|
163
|
+
export const isSubmissionsCrawlWebSocketResponseEventDto = (event) => {
|
|
164
|
+
return isWebSocketResponseEventDto(event)
|
|
165
|
+
&& event?.event === WebSocketResponseEvent.SUBMISSIONS_CRAWL
|
|
166
|
+
&& !!event?.content;
|
|
167
|
+
};
|
|
168
|
+
export const isContestChangesWebSocketResponseEventDto = (event) => {
|
|
169
|
+
return isWebSocketResponseEventDto(event)
|
|
170
|
+
&& event?.event === WebSocketResponseEvent.CONTEST_CHANGES
|
|
171
|
+
&& !!event?.content;
|
|
172
|
+
};
|
|
173
|
+
export const isUserNotificationWebSocketResponseEventDto = (event) => {
|
|
174
|
+
return [
|
|
175
|
+
WebSocketResponseEvent.USER_NOTIFICATION_SUBMISSION,
|
|
176
|
+
WebSocketResponseEvent.USER_NOTIFICATION_CONTEST_CLARIFICATION,
|
|
177
|
+
].includes(event?.event)
|
|
178
|
+
&& !!event?.content;
|
|
179
|
+
};
|
|
180
|
+
export const isUserNotificationSubmissionWebSocketResponseEventDto = (event) => {
|
|
181
|
+
return isWebSocketResponseEventDto(event) && isUserNotificationWebSocketResponseEventDto(event)
|
|
182
|
+
&& event?.event === WebSocketResponseEvent.USER_NOTIFICATION_SUBMISSION;
|
|
183
|
+
};
|
|
184
|
+
export const isUserNotificationContestClarificationWebSocketResponseEventDto = (event) => {
|
|
185
|
+
return isWebSocketResponseEventDto(event) && isUserNotificationWebSocketResponseEventDto(event)
|
|
186
|
+
&& event?.event === WebSocketResponseEvent.USER_NOTIFICATION_CONTEST_CLARIFICATION;
|
|
187
|
+
};
|
|
188
|
+
// generic
|
|
189
|
+
export const getWebSocketResponseEventKey = (event, clientId, id) => {
|
|
190
|
+
return `${event}-${clientId}-${id}`;
|
|
191
|
+
};
|
|
192
|
+
export const isWebSocketChannelsMessageDto = (message) => {
|
|
193
|
+
return Array.isArray(message?.channels)
|
|
194
|
+
&& message.channels.every((channel) => typeof channel === 'string' && !!channel)
|
|
195
|
+
&& Object.values(WebSocketResponseEvent).includes(message?.event?.event);
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Key used by the client to dispatch a response received on a TOPIC channel to its subscribers.
|
|
199
|
+
* It is the same key that `getKeyWebSocketEventDto` (base-ui) computes for the subscription.
|
|
200
|
+
* Returns null when the response is not addressed to this client.
|
|
201
|
+
*/
|
|
202
|
+
export const getWebSocketResponseEventKeyOfResponse = (response, clientId) => {
|
|
203
|
+
if (isCodeRunStatusMessageWebSocketResponseEventDto(response)) {
|
|
204
|
+
return getWebSocketResponseEventKey(WebSocketResponseEvent.CODE_RUN_STATUS, clientId, response.runId);
|
|
205
|
+
}
|
|
206
|
+
if (isSubmissionRunStatusMessageWebSocketResponseEventDto(response)) {
|
|
207
|
+
return getWebSocketResponseEventKey(WebSocketResponseEvent.SUBMISSION_RUN_STATUS, clientId, response.submitId);
|
|
208
|
+
}
|
|
209
|
+
if (isSendDataWebSocketResponseEventDto(response)) {
|
|
210
|
+
return getWebSocketResponseEventKey(WebSocketResponseEvent.SEND_DATA_, clientId, response.dataId);
|
|
211
|
+
}
|
|
212
|
+
if (isContestChangesWebSocketResponseEventDto(response)) {
|
|
213
|
+
return getWebSocketResponseEventKey(WebSocketResponseEvent.CONTEST_CHANGES, clientId, response.content.contestKey);
|
|
214
|
+
}
|
|
215
|
+
if (isProblemCrawledWebSocketResponseEventDto(response)) {
|
|
216
|
+
return getWebSocketResponseEventKey(WebSocketResponseEvent.PROBLEM_CRAWLED, clientId, response.content.problemKey);
|
|
217
|
+
}
|
|
218
|
+
if (isSubmissionsCrawlWebSocketResponseEventDto(response)) {
|
|
219
|
+
return getWebSocketResponseEventKey(WebSocketResponseEvent.SUBMISSIONS_CRAWL, clientId, join([response.content.contestKey, response.content.problemKeys]));
|
|
220
|
+
}
|
|
221
|
+
if (isUserNotificationWebSocketResponseEventDto(response)) {
|
|
222
|
+
return getWebSocketResponseEventKey(WebSocketResponseEvent.USER_NOTIFICATION_, clientId, '*');
|
|
223
|
+
}
|
|
224
|
+
if (isSubmissionJudgingWebSocketResponseEventDto(response)) {
|
|
225
|
+
// one key for every table: the same event is published on several channels (problem / contest / user) and the
|
|
226
|
+
// client deduplicates it, so it is dispatched once; each table filters by the submissions it lists
|
|
227
|
+
return getWebSocketResponseEventKey(WebSocketResponseEvent.SUBMISSION_JUDGING, clientId, '*');
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* TOPIC channel that the client has to attach to receive the events of a subscription,
|
|
233
|
+
* or null when the events arrive by the private channels (session / user) the client is always attached to.
|
|
234
|
+
* Ably rejects the attach if the token has no capability for the channel.
|
|
235
|
+
*/
|
|
236
|
+
export const getChannelOfWebSocketSubscribeEvent = (event) => {
|
|
237
|
+
if (isSubscribeSubmissionRunStatusWebSocketEventDto(event)) {
|
|
238
|
+
return CHANNEL_SUBMISSION(event.submitId);
|
|
239
|
+
}
|
|
240
|
+
// SUBSCRIBE_PROBLEM_CRAWLED: the event arrives by the private user channel of who requested the crawl
|
|
241
|
+
if (isSubscribeContestChangesWebSocketEventDto(event) || isSubscribeSubmissionsCrawlWebSocketEventDto(event)) {
|
|
242
|
+
return CHANNEL_CONTEST(event.contestKey, ContestChannelRole.SPECTATORS);
|
|
243
|
+
}
|
|
244
|
+
if (isSubscribeSubmissionsJudgingWebSocketEventDto(event)) {
|
|
245
|
+
// the judging start/end is published on the spectators channel when it is visible to everyone; the hidden ones
|
|
246
|
+
// (frozen / quiet contests) arrive by the role channels of the contest (managers) and the private user channel
|
|
247
|
+
if ('problemKey' in event && event.problemKey) {
|
|
248
|
+
return CHANNEL_PROBLEM(event.problemKey, ProblemChannelRole.SPECTATORS);
|
|
249
|
+
}
|
|
250
|
+
if ('contestKey' in event && event.contestKey) {
|
|
251
|
+
return CHANNEL_CONTEST(event.contestKey, ContestChannelRole.SPECTATORS);
|
|
252
|
+
}
|
|
253
|
+
if ('userKey' in event && event.userKey) {
|
|
254
|
+
return CHANNEL_USER_ROLE(event.userKey, UserChannelRole.SPECTATORS);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return null;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Contest whose role channels the client needs (the API grants them when the token is requested with this contest).
|
|
261
|
+
*/
|
|
262
|
+
export const getContestKeyOfWebSocketSubscribeEvent = (event) => {
|
|
263
|
+
if (isSubscribeContestChangesWebSocketEventDto(event) || isSubscribeSubmissionsCrawlWebSocketEventDto(event)) {
|
|
264
|
+
return event.contestKey;
|
|
265
|
+
}
|
|
266
|
+
if (isSubscribeSubmissionsJudgingWebSocketEventDto(event) && 'contestKey' in event && event.contestKey) {
|
|
267
|
+
return event.contestKey;
|
|
268
|
+
}
|
|
269
|
+
return null;
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Problem whose role channels the client needs (the API grants them when the token is requested with this problem).
|
|
273
|
+
*/
|
|
274
|
+
export const getProblemKeyOfWebSocketSubscribeEvent = (event) => {
|
|
275
|
+
if (isSubscribeSubmissionsJudgingWebSocketEventDto(event) && 'problemKey' in event && event.problemKey) {
|
|
276
|
+
return event.problemKey;
|
|
277
|
+
}
|
|
278
|
+
return null;
|
|
279
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SplitTime } from '../types';
|
|
1
|
+
import { SplitTime } from '../types/index.js';
|
|
2
2
|
export declare function splitTime(timeRemaining: number): [SplitTime, SplitTime, SplitTime, SplitTime, SplitTime, SplitTime];
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export function splitTime(timeRemaining) {
|
|
2
|
+
const remaining = [];
|
|
3
|
+
// const aYearMilliseconds = 1000 * 60 * 60 * 24 * 365;
|
|
4
|
+
// const remainingYears = Math.floor(timeRemaining / aYearMilliseconds);
|
|
5
|
+
// remaining.push({ remaining: remainingYears, label: 'years', milliseconds: aYearMilliseconds });
|
|
6
|
+
// const aWeekMilliseconds = 1000 * 60 * 60 * 24 * 7;
|
|
7
|
+
// const remainingWeeks = Math.floor((timeRemaining % aYearMilliseconds) / aWeekMilliseconds);
|
|
8
|
+
// remaining.push({ remaining: remainingWeeks, label: 'weeks', milliseconds: aWeekMilliseconds });
|
|
9
|
+
const aSecondMilliseconds = 1000;
|
|
10
|
+
const aMinuteMilliseconds = aSecondMilliseconds * 60;
|
|
11
|
+
const aHourMilliseconds = aMinuteMilliseconds * 60;
|
|
12
|
+
const aDayMilliseconds = aHourMilliseconds * 24;
|
|
13
|
+
const aWeekMilliseconds = aDayMilliseconds * 7;
|
|
14
|
+
const remainingWeeks = Math.floor(timeRemaining / aWeekMilliseconds);
|
|
15
|
+
remaining.push({
|
|
16
|
+
remaining: remainingWeeks,
|
|
17
|
+
label: remainingWeeks === 1 ? 'week' : 'weeks',
|
|
18
|
+
abbreviatedLabel: 'w',
|
|
19
|
+
milliseconds: aWeekMilliseconds,
|
|
20
|
+
digits: 2,
|
|
21
|
+
});
|
|
22
|
+
const remainingDays = Math.floor((timeRemaining % aWeekMilliseconds) / aDayMilliseconds);
|
|
23
|
+
remaining.push({
|
|
24
|
+
remaining: remainingDays,
|
|
25
|
+
label: remainingDays === 1 ? 'day' : 'days',
|
|
26
|
+
abbreviatedLabel: 'd',
|
|
27
|
+
milliseconds: aDayMilliseconds,
|
|
28
|
+
digits: 2,
|
|
29
|
+
});
|
|
30
|
+
const remainingHours = Math.floor((timeRemaining % aDayMilliseconds) / aHourMilliseconds);
|
|
31
|
+
remaining.push({
|
|
32
|
+
remaining: remainingHours,
|
|
33
|
+
label: remainingHours === 1 ? 'hour' : 'hours',
|
|
34
|
+
abbreviatedLabel: 'h',
|
|
35
|
+
milliseconds: aHourMilliseconds,
|
|
36
|
+
digits: 2,
|
|
37
|
+
});
|
|
38
|
+
const remainingMinutes = Math.floor((timeRemaining % aHourMilliseconds) / aMinuteMilliseconds);
|
|
39
|
+
remaining.push({
|
|
40
|
+
remaining: remainingMinutes,
|
|
41
|
+
label: remainingMinutes === 1 ? 'minute' : 'minutes',
|
|
42
|
+
abbreviatedLabel: 'm',
|
|
43
|
+
milliseconds: aMinuteMilliseconds,
|
|
44
|
+
digits: 2,
|
|
45
|
+
});
|
|
46
|
+
const remainingSeconds = Math.floor((timeRemaining % aMinuteMilliseconds) / aSecondMilliseconds);
|
|
47
|
+
remaining.push({
|
|
48
|
+
remaining: remainingSeconds,
|
|
49
|
+
label: remainingSeconds === 1 ? 'second' : 'seconds',
|
|
50
|
+
abbreviatedLabel: 's',
|
|
51
|
+
milliseconds: aSecondMilliseconds,
|
|
52
|
+
digits: 2,
|
|
53
|
+
});
|
|
54
|
+
const remainingMilliseconds = Math.floor(timeRemaining % aSecondMilliseconds);
|
|
55
|
+
remaining.push({
|
|
56
|
+
remaining: remainingMilliseconds,
|
|
57
|
+
label: remainingMilliseconds === 1 ? 'millisecond' : 'milliseconds',
|
|
58
|
+
abbreviatedLabel: 'ms',
|
|
59
|
+
milliseconds: 1,
|
|
60
|
+
digits: 3,
|
|
61
|
+
});
|
|
62
|
+
// while (remaining[0].remaining <= 0) {
|
|
63
|
+
// remaining.shift();
|
|
64
|
+
// if (remaining.length === 3) {
|
|
65
|
+
// break;
|
|
66
|
+
// }
|
|
67
|
+
// }
|
|
68
|
+
return remaining;
|
|
69
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClientId, RecordId } from '../types';
|
|
1
|
+
import { ClientId, RecordId } from '../types/index.js';
|
|
2
2
|
export declare const getUserKey: (userNickname: string, userOrganizationKey: string) => string;
|
|
3
3
|
export declare const getParamsOfUserKey: (userKey: string) => {
|
|
4
4
|
userNickname: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const getUserKey = (userNickname, userOrganizationKey) => {
|
|
2
|
+
return userNickname + '|' + userOrganizationKey;
|
|
3
|
+
};
|
|
4
|
+
export const getParamsOfUserKey = (userKey) => {
|
|
5
|
+
const [userNickname, userOrganizationKey] = userKey.split('|');
|
|
6
|
+
return { userNickname, userOrganizationKey };
|
|
7
|
+
};
|
|
8
|
+
export const getClientId = (sessionId, uiId) => {
|
|
9
|
+
return `${sessionId}|${uiId}`;
|
|
10
|
+
};
|
|
11
|
+
export const getParamsOfClientId = (clientId) => {
|
|
12
|
+
const [sessionId, uiId] = clientId.split('|');
|
|
13
|
+
return { sessionId, uiId };
|
|
14
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasicWorksheet, BodyWorksheet, CodeEditorSheet, JkmdSheet, QuizOptionsSheet, QuizProblemSheet, QuizTextSheet, SummaryWorksheetsInPages, WorksheetsInPages } from '../types';
|
|
1
|
+
import { BasicWorksheet, BodyWorksheet, CodeEditorSheet, JkmdSheet, QuizOptionsSheet, QuizProblemSheet, QuizTextSheet, SummaryWorksheetsInPages, WorksheetsInPages } from '../types/index.js';
|
|
2
2
|
export declare const getWorksheetsInPages: (initialSheets: BodyWorksheet[]) => WorksheetsInPages;
|
|
3
3
|
export declare const getSummaryWorksheetsInPages: (initialSheets: BodyWorksheet[]) => SummaryWorksheetsInPages;
|
|
4
4
|
export declare const getTotalExercisesOfSummaryWorksheetsInPages: (content: SummaryWorksheetsInPages) => number;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { NEW_PAGE_SHEET } from '../constants/worksheet.js';
|
|
2
|
+
import { Judge, WorksheetType, } from '../types/index.js';
|
|
3
|
+
export const getWorksheetsInPages = (initialSheets) => {
|
|
4
|
+
const sheets = [...initialSheets];
|
|
5
|
+
if (sheets[0]?.type !== WorksheetType.NEW_PAGE) {
|
|
6
|
+
sheets.unshift(NEW_PAGE_SHEET());
|
|
7
|
+
}
|
|
8
|
+
let newPage = sheets[0];
|
|
9
|
+
let content = [];
|
|
10
|
+
const sheetsByPages = [];
|
|
11
|
+
for (let i = 1; i < sheets.length; i++) {
|
|
12
|
+
const sheet = sheets[i];
|
|
13
|
+
if (sheet.type === WorksheetType.NEW_PAGE) {
|
|
14
|
+
sheetsByPages.push({
|
|
15
|
+
header: newPage,
|
|
16
|
+
content: [...content],
|
|
17
|
+
});
|
|
18
|
+
newPage = sheet;
|
|
19
|
+
content = [];
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
content.push(sheet);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
sheetsByPages.push({
|
|
26
|
+
header: newPage,
|
|
27
|
+
content: [...content],
|
|
28
|
+
});
|
|
29
|
+
return sheetsByPages;
|
|
30
|
+
};
|
|
31
|
+
export const getSummaryWorksheetsInPages = (initialSheets) => {
|
|
32
|
+
const sheets = [...initialSheets];
|
|
33
|
+
if (sheets[0]?.type !== WorksheetType.NEW_PAGE) {
|
|
34
|
+
sheets.unshift(NEW_PAGE_SHEET());
|
|
35
|
+
}
|
|
36
|
+
let newPage = sheets[0];
|
|
37
|
+
let content = [];
|
|
38
|
+
const sheetsByPages = [];
|
|
39
|
+
for (let i = 1; i < sheets.length; i++) {
|
|
40
|
+
const sheet = sheets[i];
|
|
41
|
+
if (sheet.type === WorksheetType.NEW_PAGE) {
|
|
42
|
+
sheetsByPages.push({
|
|
43
|
+
header: newPage,
|
|
44
|
+
content: content.map(c => ({
|
|
45
|
+
id: c.id,
|
|
46
|
+
type: c.type,
|
|
47
|
+
title: c.title,
|
|
48
|
+
points: c.points,
|
|
49
|
+
})),
|
|
50
|
+
});
|
|
51
|
+
newPage = sheet;
|
|
52
|
+
content = [];
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
content.push(sheet);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
sheetsByPages.push({
|
|
59
|
+
header: newPage,
|
|
60
|
+
content: [...content],
|
|
61
|
+
});
|
|
62
|
+
return sheetsByPages;
|
|
63
|
+
};
|
|
64
|
+
export const getTotalExercisesOfSummaryWorksheetsInPages = (content) => content.reduce((sum, { content }) => sum + content.reduce((sum, { type }) => sum + +(type === WorksheetType.QUIZ_OPTIONS || type === WorksheetType.QUIZ_PROBLEM || type === WorksheetType.QUIZ_TEXT), 0), 0);
|
|
65
|
+
export const isBasicWorksheet = (value) => {
|
|
66
|
+
return typeof value?.id == 'string' && value.id
|
|
67
|
+
&& Object.values(WorksheetType).includes(value?.type)
|
|
68
|
+
&& typeof value?.title == 'string'
|
|
69
|
+
&& typeof value?.points == 'number';
|
|
70
|
+
};
|
|
71
|
+
export const isJkmdSheet = (value) => {
|
|
72
|
+
return isBasicWorksheet(value)
|
|
73
|
+
&& value?.type === WorksheetType.JK_MD
|
|
74
|
+
&& typeof value?.content == 'string';
|
|
75
|
+
};
|
|
76
|
+
export const isCodeEditorSheet = (value) => {
|
|
77
|
+
return isBasicWorksheet(value)
|
|
78
|
+
&& value?.type === WorksheetType.CODE_EDITOR
|
|
79
|
+
&& typeof value?.sourceCode === 'object' && value?.sourceCode !== null
|
|
80
|
+
&& value?.testCases === 'object' && value?.testCases !== null
|
|
81
|
+
&& Array.isArray(value?.languages)
|
|
82
|
+
&& typeof value?.height == 'number';
|
|
83
|
+
};
|
|
84
|
+
export const isQuizProblemSheet = (value) => {
|
|
85
|
+
return isBasicWorksheet(value)
|
|
86
|
+
&& value?.type === WorksheetType.QUIZ_PROBLEM
|
|
87
|
+
&& Object.values(Judge).includes(value?.problemJudge) || typeof value?.problemJudge === 'string'
|
|
88
|
+
&& typeof value?.problemKey == 'string'
|
|
89
|
+
&& Array.isArray(value?.languages)
|
|
90
|
+
&& typeof value?.height == 'number';
|
|
91
|
+
};
|
|
92
|
+
export const isQuizOptionsSheet = (value) => {
|
|
93
|
+
return isBasicWorksheet(value)
|
|
94
|
+
&& value?.type === WorksheetType.QUIZ_OPTIONS
|
|
95
|
+
&& typeof value?.description == 'string'
|
|
96
|
+
&& Array.isArray(value?.options)
|
|
97
|
+
&& value?.options.every((option) => typeof option?.label == 'string' && typeof option?.correct == 'boolean' && typeof option?.id == 'string')
|
|
98
|
+
&& typeof value?.multiple == 'boolean'
|
|
99
|
+
&& (value?.scoringMode === 'TOTAL' || value?.scoringMode === 'PARTIAL');
|
|
100
|
+
};
|
|
101
|
+
export const isQuizTextSheet = (value) => {
|
|
102
|
+
return isBasicWorksheet(value)
|
|
103
|
+
&& value?.type === WorksheetType.QUIZ_TEXT
|
|
104
|
+
&& typeof value?.description == 'string'
|
|
105
|
+
&& typeof value?.answer == 'string'
|
|
106
|
+
&& ['text', 'number', 'textarea'].includes(value?.inputType);
|
|
107
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var ProfileSetting;
|
|
2
|
+
(function (ProfileSetting) {
|
|
3
|
+
ProfileSetting["NEWSLETTER_SUBSCRIPTION"] = "newsletterSubscription";
|
|
4
|
+
ProfileSetting["LANGUAGE"] = "preferredLanguage";
|
|
5
|
+
ProfileSetting["THEME"] = "preferredTheme";
|
|
6
|
+
ProfileSetting["DATA_VIEW_MODE"] = "preferredDataViewMode";
|
|
7
|
+
ProfileSetting["MENU_VIEW_MODE"] = "preferredMenuViewMode";
|
|
8
|
+
ProfileSetting["TIME_ZONE"] = "preferredTimeZone";
|
|
9
|
+
ProfileSetting["FONT_SIZE"] = "preferredFontSize";
|
|
10
|
+
})(ProfileSetting || (ProfileSetting = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BodyWorksheet } from '../types/sheet';
|
|
2
|
-
import { EntityMembers, EntityState } from './entity';
|
|
1
|
+
import { BodyWorksheet } from '../types/sheet.js';
|
|
2
|
+
import { EntityMembers, EntityState } from './entity.js';
|
|
3
3
|
export declare enum AssignmentClass {
|
|
4
4
|
NONE = "NONE",
|
|
5
5
|
COURSE = "COURSE",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var AssignmentClass;
|
|
2
|
+
(function (AssignmentClass) {
|
|
3
|
+
AssignmentClass["NONE"] = "NONE";
|
|
4
|
+
AssignmentClass["COURSE"] = "COURSE";
|
|
5
|
+
AssignmentClass["WORKSHEET"] = "WORKSHEET";
|
|
6
|
+
AssignmentClass["CONTEST"] = "CONTEST";
|
|
7
|
+
})(AssignmentClass || (AssignmentClass = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export var CodeLanguage;
|
|
2
|
+
(function (CodeLanguage) {
|
|
3
|
+
CodeLanguage["C_11"] = "c11";
|
|
4
|
+
CodeLanguage["CPP_11"] = "cpp11";
|
|
5
|
+
CodeLanguage["CPP_20"] = "cpp20";
|
|
6
|
+
CodeLanguage["JAVA_21"] = "java21";
|
|
7
|
+
CodeLanguage["PYTHON_3"] = "python3";
|
|
8
|
+
CodeLanguage["PYTHON_PYPY_3"] = "pypy3";
|
|
9
|
+
CodeLanguage["JAVASCRIPT_NODE_JS_22"] = "nodejs22";
|
|
10
|
+
// DEPRECATED
|
|
11
|
+
CodeLanguage["PYTHON_2"] = "python2";
|
|
12
|
+
CodeLanguage["PYTHON_PYPY_2"] = "pypy2";
|
|
13
|
+
CodeLanguage["ICPC_C"] = "ICPC_C";
|
|
14
|
+
CodeLanguage["C"] = "C";
|
|
15
|
+
CodeLanguage["CPP"] = "CPP";
|
|
16
|
+
CodeLanguage["ICPC_CPP"] = "ICPC_CPP";
|
|
17
|
+
CodeLanguage["CPP11"] = "CPP11";
|
|
18
|
+
CodeLanguage["CPP14"] = "CPP14";
|
|
19
|
+
CodeLanguage["CPP17"] = "CPP17";
|
|
20
|
+
CodeLanguage["JAVA"] = "JAVA";
|
|
21
|
+
CodeLanguage["ICPC_PYTHON"] = "ICPC_PYTHON";
|
|
22
|
+
CodeLanguage["PYTHON"] = "PYTHON";
|
|
23
|
+
CodeLanguage["PYTHON2"] = "PYTHON2";
|
|
24
|
+
CodeLanguage["PYTHON3"] = "PYTHON3";
|
|
25
|
+
CodeLanguage["JAVASCRIPT"] = "JAVASCRIPT";
|
|
26
|
+
CodeLanguage["TYPESCRIPT"] = "TYPESCRIPT";
|
|
27
|
+
CodeLanguage["JSX"] = "JSX";
|
|
28
|
+
CodeLanguage["TSX"] = "TSX";
|
|
29
|
+
CodeLanguage["MDX"] = "MDX";
|
|
30
|
+
CodeLanguage["PSEUDOCODE_PSEINT"] = "PSEUDOCODE_PSEINT";
|
|
31
|
+
CodeLanguage["LATEX"] = "LATEX";
|
|
32
|
+
CodeLanguage["JSON"] = "JSON";
|
|
33
|
+
CodeLanguage["HTML"] = "HTML";
|
|
34
|
+
CodeLanguage["TEXT"] = "TEXT";
|
|
35
|
+
CodeLanguage["DIFF"] = "DIFF";
|
|
36
|
+
CodeLanguage["MARKDOWN"] = "MARKDOWN";
|
|
37
|
+
CodeLanguage["ARDUINO"] = "ARDUINO";
|
|
38
|
+
CodeLanguage["DOT"] = "DOT";
|
|
39
|
+
CodeLanguage["MERMAID"] = "MERMAID";
|
|
40
|
+
CodeLanguage["BASH"] = "BASH";
|
|
41
|
+
})(CodeLanguage || (CodeLanguage = {}));
|
|
42
|
+
export var ScopeData;
|
|
43
|
+
(function (ScopeData) {
|
|
44
|
+
ScopeData["USER"] = "USER";
|
|
45
|
+
ScopeData["PROBLEM"] = "PROBLEM";
|
|
46
|
+
ScopeData["CONTEST"] = "CONTEST";
|
|
47
|
+
ScopeData["ATTEMPT"] = "ATTEMPT";
|
|
48
|
+
})(ScopeData || (ScopeData = {}));
|
|
49
|
+
export var Status;
|
|
50
|
+
(function (Status) {
|
|
51
|
+
Status["SUCCESS"] = "SUCCESS";
|
|
52
|
+
Status["ERROR"] = "ERROR";
|
|
53
|
+
Status["LOADING"] = "LOADING";
|
|
54
|
+
Status["NONE"] = "NONE";
|
|
55
|
+
})(Status || (Status = {}));
|
|
56
|
+
export var EntityStatus;
|
|
57
|
+
(function (EntityStatus) {
|
|
58
|
+
EntityStatus["PUBLIC"] = "PUBLIC";
|
|
59
|
+
EntityStatus["RESERVED"] = "RESERVED";
|
|
60
|
+
EntityStatus["PRIVATE"] = "PRIVATE";
|
|
61
|
+
EntityStatus["ARCHIVED"] = "ARCHIVED";
|
|
62
|
+
})(EntityStatus || (EntityStatus = {}));
|
|
63
|
+
export var EntityAccess;
|
|
64
|
+
(function (EntityAccess) {
|
|
65
|
+
EntityAccess["PRIVATE"] = "PRIVATE";
|
|
66
|
+
EntityAccess["RESTRICTED"] = "RESTRICTED";
|
|
67
|
+
EntityAccess["PUBLIC"] = "PUBLIC";
|
|
68
|
+
EntityAccess["EXPOSED"] = "EXPOSED";
|
|
69
|
+
})(EntityAccess || (EntityAccess = {}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { CodeLanguage } from './commons';
|
|
2
|
-
import { EntityMembers } from './entity';
|
|
3
|
-
import { Judge } from './judge';
|
|
4
|
-
import { UserBasicInfo } from './users';
|
|
1
|
+
import { CodeLanguage } from './commons.js';
|
|
2
|
+
import { EntityMembers } from './entity.js';
|
|
3
|
+
import { Judge } from './judge.js';
|
|
4
|
+
import { UserBasicInfo } from './users.js';
|
|
5
5
|
export declare enum ContestStatus {
|
|
6
6
|
PUBLIC = "PUBLIC",
|
|
7
7
|
RESERVED = "RESERVED",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export var ContestStatus;
|
|
2
|
+
(function (ContestStatus) {
|
|
3
|
+
ContestStatus["PUBLIC"] = "PUBLIC";
|
|
4
|
+
ContestStatus["RESERVED"] = "RESERVED";
|
|
5
|
+
ContestStatus["ARCHIVED"] = "ARCHIVED";
|
|
6
|
+
})(ContestStatus || (ContestStatus = {}));
|
|
7
|
+
export var ContestTimeStatus;
|
|
8
|
+
(function (ContestTimeStatus) {
|
|
9
|
+
ContestTimeStatus["UPCOMING"] = "upcoming";
|
|
10
|
+
ContestTimeStatus["LIVE"] = "live";
|
|
11
|
+
ContestTimeStatus["PAST"] = "past";
|
|
12
|
+
})(ContestTimeStatus || (ContestTimeStatus = {}));
|
|
13
|
+
export var ContestProblemPrerequisiteType;
|
|
14
|
+
(function (ContestProblemPrerequisiteType) {
|
|
15
|
+
ContestProblemPrerequisiteType["INDIVIDUALLY"] = "INDIVIDUALLY";
|
|
16
|
+
ContestProblemPrerequisiteType["CONTEST"] = "CONTEST";
|
|
17
|
+
})(ContestProblemPrerequisiteType || (ContestProblemPrerequisiteType = {}));
|
|
18
|
+
export var ContestEventAction;
|
|
19
|
+
(function (ContestEventAction) {
|
|
20
|
+
ContestEventAction["DATA_UPDATE"] = "DATA_UPDATE";
|
|
21
|
+
ContestEventAction["SCOREBOARD_RECALCULATE"] = "SCOREBOARD_RECALCULATE";
|
|
22
|
+
ContestEventAction["SCOREBOARD_UNLOCK"] = "SCOREBOARD_UNLOCK";
|
|
23
|
+
ContestEventAction["SCOREBOARD_LOCK"] = "SCOREBOARD_LOCK";
|
|
24
|
+
ContestEventAction["ENABLE_UPSOLVING"] = "ENABLE_UPSOLVING";
|
|
25
|
+
ContestEventAction["DISABLE_UPSOLVING"] = "DISABLE_UPSOLVING";
|
|
26
|
+
ContestEventAction["PARTICIPANT_JOIN"] = "PARTICIPANT_JOIN";
|
|
27
|
+
})(ContestEventAction || (ContestEventAction = {}));
|