@juki-team/commons 0.1.11

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 (95) hide show
  1. package/README.md +3 -0
  2. package/dist/cjs/index.cjs +3567 -0
  3. package/dist/esm/index.js +3347 -0
  4. package/dist/types/constants/commons.d.ts +62 -0
  5. package/dist/types/constants/company.d.ts +9 -0
  6. package/dist/types/constants/contest.d.ts +15 -0
  7. package/dist/types/constants/course.d.ts +8 -0
  8. package/dist/types/constants/date.d.ts +9 -0
  9. package/dist/types/constants/email.d.ts +2 -0
  10. package/dist/types/constants/entity.d.ts +3 -0
  11. package/dist/types/constants/file.d.ts +27 -0
  12. package/dist/types/constants/index.d.ts +18 -0
  13. package/dist/types/constants/judge.d.ts +35 -0
  14. package/dist/types/constants/problem.d.ts +36 -0
  15. package/dist/types/constants/routing.d.ts +7 -0
  16. package/dist/types/constants/services.d.ts +8 -0
  17. package/dist/types/constants/system.d.ts +8 -0
  18. package/dist/types/constants/teams.d.ts +14 -0
  19. package/dist/types/constants/time.d.ts +9 -0
  20. package/dist/types/constants/user.d.ts +16 -0
  21. package/dist/types/constants/websocket.d.ts +6 -0
  22. package/dist/types/constants/worksheet.d.ts +11 -0
  23. package/dist/types/dto/class.d.ts +115 -0
  24. package/dist/types/dto/code.d.ts +13 -0
  25. package/dist/types/dto/comments.d.ts +21 -0
  26. package/dist/types/dto/company.d.ts +67 -0
  27. package/dist/types/dto/contest.d.ts +94 -0
  28. package/dist/types/dto/course.d.ts +34 -0
  29. package/dist/types/dto/entity.d.ts +92 -0
  30. package/dist/types/dto/excalidraw.d.ts +12 -0
  31. package/dist/types/dto/file.d.ts +34 -0
  32. package/dist/types/dto/image.d.ts +6 -0
  33. package/dist/types/dto/index.d.ts +25 -0
  34. package/dist/types/dto/judge.d.ts +16 -0
  35. package/dist/types/dto/markdown.d.ts +12 -0
  36. package/dist/types/dto/mermaid.d.ts +12 -0
  37. package/dist/types/dto/problem.d.ts +66 -0
  38. package/dist/types/dto/scoreboard.d.ts +35 -0
  39. package/dist/types/dto/session.d.ts +15 -0
  40. package/dist/types/dto/socket.d.ts +256 -0
  41. package/dist/types/dto/statistics.d.ts +43 -0
  42. package/dist/types/dto/submission.d.ts +94 -0
  43. package/dist/types/dto/system.d.ts +91 -0
  44. package/dist/types/dto/url.d.ts +8 -0
  45. package/dist/types/dto/user.d.ts +109 -0
  46. package/dist/types/dto/virtual-user.d.ts +38 -0
  47. package/dist/types/dto/worksheet-submissions.d.ts +64 -0
  48. package/dist/types/dto/worksheet.d.ts +39 -0
  49. package/dist/types/helpers/class.d.ts +4 -0
  50. package/dist/types/helpers/comments.d.ts +4 -0
  51. package/dist/types/helpers/commons.d.ts +35 -0
  52. package/dist/types/helpers/contest.d.ts +5 -0
  53. package/dist/types/helpers/document.d.ts +14 -0
  54. package/dist/types/helpers/file.d.ts +1 -0
  55. package/dist/types/helpers/index.d.ts +14 -0
  56. package/dist/types/helpers/interval.d.ts +2 -0
  57. package/dist/types/helpers/judging.d.ts +24 -0
  58. package/dist/types/helpers/object.d.ts +1 -0
  59. package/dist/types/helpers/responses.d.ts +8 -0
  60. package/dist/types/helpers/socket.d.ts +45 -0
  61. package/dist/types/helpers/time.d.ts +13 -0
  62. package/dist/types/helpers/user.d.ts +11 -0
  63. package/dist/types/helpers/worksheet.d.ts +10 -0
  64. package/dist/types/index.d.ts +5 -0
  65. package/dist/types/prototypes/Date.d.ts +62 -0
  66. package/dist/types/prototypes/Error.d.ts +10 -0
  67. package/dist/types/prototypes/Number.d.ts +7 -0
  68. package/dist/types/prototypes/index.d.ts +3 -0
  69. package/dist/types/types/account.d.ts +9 -0
  70. package/dist/types/types/class.d.ts +67 -0
  71. package/dist/types/types/comments.d.ts +17 -0
  72. package/dist/types/types/commons.d.ts +84 -0
  73. package/dist/types/types/company.d.ts +29 -0
  74. package/dist/types/types/contest.d.ts +161 -0
  75. package/dist/types/types/course.d.ts +13 -0
  76. package/dist/types/types/entity.d.ts +116 -0
  77. package/dist/types/types/excalidraw.d.ts +9 -0
  78. package/dist/types/types/file.d.ts +27 -0
  79. package/dist/types/types/group.d.ts +12 -0
  80. package/dist/types/types/index.d.ts +25 -0
  81. package/dist/types/types/judge.d.ts +75 -0
  82. package/dist/types/types/markdown.d.ts +8 -0
  83. package/dist/types/types/mermaid.d.ts +8 -0
  84. package/dist/types/types/notification.d.ts +7 -0
  85. package/dist/types/types/prisma.d.ts +284 -0
  86. package/dist/types/types/problems.d.ts +102 -0
  87. package/dist/types/types/services.d.ts +213 -0
  88. package/dist/types/types/sheet.d.ts +103 -0
  89. package/dist/types/types/socket.d.ts +49 -0
  90. package/dist/types/types/submission.d.ts +5 -0
  91. package/dist/types/types/teams.d.ts +73 -0
  92. package/dist/types/types/users.d.ts +59 -0
  93. package/dist/types/types/virtual-user.d.ts +7 -0
  94. package/dist/types/types/worksheet.d.ts +42 -0
  95. package/package.json +38 -0
@@ -0,0 +1,10 @@
1
+ import { BasicWorksheet, BodyWorksheet, CodeEditorSheet, JkmdSheet, QuizOptionsSheet, QuizProblemSheet, QuizTextSheet, SummaryWorksheetsInPages, WorksheetsInPages } from '../types';
2
+ export declare const getWorksheetsInPages: (initialSheets: BodyWorksheet[]) => WorksheetsInPages;
3
+ export declare const getSummaryWorksheetsInPages: (initialSheets: BodyWorksheet[]) => SummaryWorksheetsInPages;
4
+ export declare const getTotalExercisesOfSummaryWorksheetsInPages: (content: SummaryWorksheetsInPages) => number;
5
+ export declare const isBasicWorksheet: (value: any) => value is BasicWorksheet & any;
6
+ export declare const isJkmdSheet: (value: any) => value is JkmdSheet;
7
+ export declare const isCodeEditorSheet: (value: any) => value is CodeEditorSheet;
8
+ export declare const isQuizProblemSheet: (value: any) => value is QuizProblemSheet;
9
+ export declare const isQuizOptionsSheet: (value: any) => value is QuizOptionsSheet;
10
+ export declare const isQuizTextSheet: (value: any) => value is QuizTextSheet;
@@ -0,0 +1,5 @@
1
+ export * from './constants';
2
+ export * from './dto';
3
+ export * from './helpers';
4
+ export * from './prototypes';
5
+ export * from './types';
@@ -0,0 +1,62 @@
1
+ declare global {
2
+ interface Date {
3
+ changeYear(year: number): Date;
4
+ changeMonth(monthIndex: number): Date;
5
+ changeDay(date: number): Date;
6
+ changeHours(hours: number): Date;
7
+ changeMinutes(minutes: number): Date;
8
+ changeSeconds(seconds: number): Date;
9
+ changeMilliseconds(milliseconds: number): Date;
10
+ decreaseYear(count?: number): Date;
11
+ increaseYear(count?: number): Date;
12
+ decreaseMonth(): Date;
13
+ increaseMonth(): Date;
14
+ decreaseDay(): Date;
15
+ increaseDay(): Date;
16
+ startOfYear(): Date;
17
+ endOfYear(): Date;
18
+ startOfMonth(): Date;
19
+ endOfMonth(): Date;
20
+ startOfWeek(): Date;
21
+ endOfWeek(): Date;
22
+ startOfDay(): Date;
23
+ endOfDay(): Date;
24
+ startOfHour(): Date;
25
+ endOfHour(): Date;
26
+ startOfMinute(): Date;
27
+ endOfMinute(): Date;
28
+ startOfSecond(): Date;
29
+ endOfSecond(): Date;
30
+ isSameYear(date: Date): boolean;
31
+ isSameMonth(date: Date): boolean;
32
+ isSameDay(date: Date): boolean;
33
+ isSameHour(date: Date): boolean;
34
+ isSameMinute(date: Date): boolean;
35
+ isSameSecond(date: Date): boolean;
36
+ isSameMillisecond(date: Date): boolean;
37
+ isToday(): boolean;
38
+ isEqual(date: Date): boolean;
39
+ isValidDate(): boolean;
40
+ isYearAfter(date: Date): boolean;
41
+ isMonthAfter(date: Date): boolean;
42
+ isDayAfter(date: Date): boolean;
43
+ isHoursAfter(date: Date): boolean;
44
+ isMinutesAfter(date: Date): boolean;
45
+ isSecondsAfter(date: Date): boolean;
46
+ isMillisecondsAfter(date: Date): boolean;
47
+ isAfter(date: Date): boolean;
48
+ isYearBefore(date: Date): boolean;
49
+ isMonthBefore(date: Date): boolean;
50
+ isDayBefore(date: Date): boolean;
51
+ isHoursBefore(date: Date): boolean;
52
+ isMinutesBefore(date: Date): boolean;
53
+ isSecondsBefore(date: Date): boolean;
54
+ isMillisecondsBefore(date: Date): boolean;
55
+ isBefore(date: Date): boolean;
56
+ isWithinInterval(props: {
57
+ start: Date;
58
+ end: Date;
59
+ }, cmp?: '[]' | '()' | '[)' | '(]'): boolean;
60
+ }
61
+ }
62
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ErrorCode } from '../types';
2
+ export declare class JkError extends Error {
3
+ code: ErrorCode;
4
+ data: any;
5
+ constructor(code: ErrorCode, custom?: {
6
+ message?: string;
7
+ stack?: string;
8
+ data?: any;
9
+ });
10
+ }
@@ -0,0 +1,7 @@
1
+ declare global {
2
+ interface Number {
3
+ padStart(maxLength: number, fillString?: string): String;
4
+ padEnd(maxLength: number, fillString?: string): String;
5
+ }
6
+ }
7
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './Date';
2
+ export * from './Error';
3
+ export * from './Number';
@@ -0,0 +1,9 @@
1
+ export declare enum ProfileSetting {
2
+ NEWSLETTER_SUBSCRIPTION = "newsletterSubscription",
3
+ LANGUAGE = "preferredLanguage",
4
+ THEME = "preferredTheme",
5
+ DATA_VIEW_MODE = "preferredDataViewMode",
6
+ MENU_VIEW_MODE = "preferredMenuViewMode",
7
+ TIME_ZONE = "preferredTimeZone",
8
+ FONT_SIZE = "preferredFontSize"
9
+ }
@@ -0,0 +1,67 @@
1
+ import { BodyWorksheet } from '../types/sheet';
2
+ import { EntityMembers, EntityState } from './entity';
3
+ export declare enum AssignmentClass {
4
+ NONE = "NONE",
5
+ COURSE = "COURSE",
6
+ WORKSHEET = "WORKSHEET",
7
+ CONTEST = "CONTEST"
8
+ }
9
+ export interface AssignmentBasicInfo {
10
+ id: string;
11
+ index: number;
12
+ type: AssignmentClass;
13
+ points: number;
14
+ startTimestamp: number;
15
+ endTimestamp: number;
16
+ title: string;
17
+ content: BodyWorksheet[];
18
+ tags: string[];
19
+ graded: boolean;
20
+ visible: boolean;
21
+ }
22
+ export interface ClassCycleSessionAssignment extends AssignmentBasicInfo {
23
+ entityId: string;
24
+ state: EntityState;
25
+ }
26
+ export interface ClassCycleSessionAssignments {
27
+ [key: string]: ClassCycleSessionAssignment;
28
+ }
29
+ interface ClassCycleSession {
30
+ id: string;
31
+ index: number;
32
+ name: string;
33
+ assignments: ClassCycleSessionAssignments;
34
+ startTimestamp: number;
35
+ endTimestamp: number;
36
+ state: EntityState;
37
+ }
38
+ export interface ClassCycleSessions {
39
+ [key: string]: ClassCycleSession;
40
+ }
41
+ export type ClassCycleTag = {
42
+ key: string;
43
+ name: string;
44
+ color: string;
45
+ points: number;
46
+ };
47
+ export type ClassCycle = {
48
+ id: string;
49
+ index: number;
50
+ name: string;
51
+ sessions: ClassCycleSessions;
52
+ tags: ClassCycleTag[];
53
+ startTimestamp: number;
54
+ endTimestamp: number;
55
+ state: EntityState;
56
+ };
57
+ export interface ClassCycles {
58
+ [key: string]: ClassCycle;
59
+ }
60
+ export interface ClassBaseDocument {
61
+ key: string;
62
+ name: string;
63
+ description: string;
64
+ members: EntityMembers;
65
+ cycles: ClassCycles;
66
+ }
67
+ export {};
@@ -0,0 +1,17 @@
1
+ export type ReactionUser = {
2
+ key: string;
3
+ userId: string;
4
+ createdTimestamp: number;
5
+ updatedTimestamp: number;
6
+ };
7
+ export interface CommentBaseDocument {
8
+ key: string;
9
+ parentId: string | null;
10
+ content: string;
11
+ hidden: boolean;
12
+ reactions: {
13
+ [key: string]: {
14
+ [key: string]: ReactionUser;
15
+ };
16
+ };
17
+ }
@@ -0,0 +1,84 @@
1
+ import { Language } from './prisma';
2
+ export declare enum CodeLanguage {
3
+ C_11 = "c11",
4
+ CPP_11 = "cpp11",
5
+ CPP_20 = "cpp20",
6
+ JAVA_21 = "java21",
7
+ PYTHON_3 = "python3",
8
+ PYTHON_PYPY_3 = "pypy3",
9
+ JAVASCRIPT_NODE_JS_22 = "nodejs22",
10
+ PYTHON_2 = "python2",
11
+ PYTHON_PYPY_2 = "pypy2",
12
+ ICPC_C = "ICPC_C",
13
+ C = "C",
14
+ CPP = "CPP",
15
+ ICPC_CPP = "ICPC_CPP",
16
+ CPP11 = "CPP11",
17
+ CPP14 = "CPP14",
18
+ CPP17 = "CPP17",
19
+ JAVA = "JAVA",
20
+ ICPC_PYTHON = "ICPC_PYTHON",
21
+ PYTHON = "PYTHON",
22
+ PYTHON2 = "PYTHON2",
23
+ PYTHON3 = "PYTHON3",
24
+ JAVASCRIPT = "JAVASCRIPT",
25
+ TYPESCRIPT = "TYPESCRIPT",
26
+ JSX = "JSX",
27
+ TSX = "TSX",
28
+ MDX = "MDX",
29
+ PSEUDOCODE_PSEINT = "PSEUDOCODE_PSEINT",
30
+ LATEX = "LATEX",
31
+ JSON = "JSON",
32
+ HTML = "HTML",
33
+ TEXT = "TEXT",
34
+ DIFF = "DIFF",
35
+ MARKDOWN = "MARKDOWN",
36
+ ARDUINO = "ARDUINO",
37
+ DOT = "DOT",
38
+ MERMAID = "MERMAID",
39
+ BASH = "BASH"
40
+ }
41
+ export declare enum ScopeData {
42
+ USER = "USER",
43
+ PROBLEM = "PROBLEM",
44
+ CONTEST = "CONTEST",
45
+ ATTEMPT = "ATTEMPT"
46
+ }
47
+ export declare enum Status {
48
+ SUCCESS = "SUCCESS",
49
+ ERROR = "ERROR",
50
+ LOADING = "LOADING",
51
+ NONE = "NONE"
52
+ }
53
+ export declare enum EntityStatus {
54
+ PUBLIC = "PUBLIC",// Active for the users
55
+ RESERVED = "RESERVED",// On preparation
56
+ PRIVATE = "PRIVATE",
57
+ ARCHIVED = "ARCHIVED"
58
+ }
59
+ export declare enum EntityAccess {
60
+ PRIVATE = "PRIVATE",
61
+ RESTRICTED = "RESTRICTED",
62
+ PUBLIC = "PUBLIC",
63
+ EXPOSED = "EXPOSED"
64
+ }
65
+ export type TextLanguage = {
66
+ [key in Language]: string;
67
+ };
68
+ export type SplitTime = {
69
+ remaining: number;
70
+ label: string;
71
+ milliseconds: number;
72
+ abbreviatedLabel: string;
73
+ digits: number;
74
+ };
75
+ export type RecordId = `${string & {
76
+ length: 24;
77
+ }}`;
78
+ export type Device = {
79
+ label: string;
80
+ isMobile: boolean;
81
+ isBrowser: boolean;
82
+ type: string;
83
+ osLabel: string;
84
+ };
@@ -0,0 +1,29 @@
1
+ export declare enum CompanyPlan {
2
+ FREE = "FREE",// shared runner and shared compiles
3
+ STANDARD = "STANDARD",// 1 dedicated runner, 1 dedicated compiler
4
+ PREMIUM = "PREMIUM",// 1 dedicated runner, 1 dedicated compiler + extra hours billed
5
+ CUSTOM = "CUSTOM"
6
+ }
7
+ export declare enum CompanyLogoType {
8
+ HORIZONTAL_WHITE = "horizontal-white",
9
+ HORIZONTAL_COLOR = "horizontal-color",
10
+ VERTICAL_WHITE = "vertical-white",
11
+ VERTICAL_COLOR = "vertical-color"
12
+ }
13
+ export type ResourceInstance = {
14
+ imageId: string;
15
+ instanceType: string;
16
+ userDataScript: string;
17
+ minimum: number;
18
+ maximum: number;
19
+ };
20
+ export type ResourceLogger = {
21
+ info: {
22
+ chatId: string;
23
+ messageThreadId: string;
24
+ };
25
+ error: {
26
+ chatId: string;
27
+ messageThreadId: string;
28
+ };
29
+ };
@@ -0,0 +1,161 @@
1
+ import { ContestDataResponseDTO, UpsertContestDTO, UserCompanyBasicInfoResponseDTO } from '../dto';
2
+ import { CodeLanguage } from './commons';
3
+ import { EntityMembers } from './entity';
4
+ import { Judge } from './judge';
5
+ import { UserBasicInfo } from './users';
6
+ export declare enum ContestStatus {
7
+ PUBLIC = "PUBLIC",
8
+ RESERVED = "RESERVED",
9
+ ARCHIVED = "ARCHIVED"
10
+ }
11
+ export declare enum ContestTimeStatus {
12
+ UPCOMING = "upcoming",
13
+ LIVE = "live",
14
+ PAST = "past"
15
+ }
16
+ export type MetaProblemSearcher = {
17
+ name: string;
18
+ url: string;
19
+ id: string;
20
+ rating: number;
21
+ tag: string;
22
+ judge: Judge;
23
+ };
24
+ export type BaseClarification = {
25
+ answer: string;
26
+ publicVisible: boolean;
27
+ };
28
+ export interface NewClarification extends BaseClarification {
29
+ problem: string;
30
+ question: string;
31
+ }
32
+ export interface AnswerClarification extends NewClarification {
33
+ answered: boolean;
34
+ answeredTime: number;
35
+ judgeType: false;
36
+ user: string;
37
+ userAnswer: string;
38
+ id: string;
39
+ }
40
+ export type ContestUser = {
41
+ isOwner: boolean;
42
+ isAdministrator: boolean;
43
+ isManager: boolean;
44
+ isParticipant: boolean;
45
+ isGuest: boolean;
46
+ isSpectator: boolean;
47
+ };
48
+ export type ContestClarification = {
49
+ key: string;
50
+ problemJudgeKey: string;
51
+ question: string;
52
+ questionUser: UserCompanyBasicInfoResponseDTO;
53
+ questionTimestamp: number;
54
+ answer: string;
55
+ answerTimestamp: number;
56
+ answerUser: UserCompanyBasicInfoResponseDTO;
57
+ public: boolean;
58
+ };
59
+ export declare enum ContestProblemPrerequisiteType {
60
+ INDIVIDUALLY = "INDIVIDUALLY",
61
+ CONTEST = "CONTEST"
62
+ }
63
+ export type ContestProblemPrerequisite = {
64
+ problemId: string;
65
+ type: ContestProblemPrerequisiteType;
66
+ delay: number;
67
+ };
68
+ export type ContestProblem = {
69
+ id: string;
70
+ index: string;
71
+ points: number;
72
+ color: string;
73
+ startTimestamp: number;
74
+ endTimestamp: number;
75
+ prerequisites: ContestProblemPrerequisite[];
76
+ maxAcceptedUsers: number;
77
+ group: string;
78
+ };
79
+ export type ContestSettings = {
80
+ clarifications: boolean;
81
+ numberJudgeValidations: number;
82
+ languages: CodeLanguage[];
83
+ penalty: number;
84
+ timeToSolve: number;
85
+ startTimestamp: number;
86
+ frozenTimestamp: number;
87
+ quietTimestamp: number;
88
+ endTimestamp: number;
89
+ scoreboardLocked: boolean;
90
+ upsolvingEnabled: boolean;
91
+ };
92
+ export type MemberUserData = {
93
+ userId: string;
94
+ lastVisitTimestamp: number | null;
95
+ joinedAtTimestamp: number;
96
+ };
97
+ export type ContestMembersBasic = {
98
+ administrators: {
99
+ [key: string]: MemberUserData;
100
+ };
101
+ judges: {
102
+ [key: string]: MemberUserData;
103
+ };
104
+ guests: {
105
+ [key: string]: MemberUserData;
106
+ };
107
+ spectators: {
108
+ [key: string]: MemberUserData;
109
+ };
110
+ };
111
+ export declare enum ContestEventAction {
112
+ DATA_UPDATE = "DATA_UPDATE",
113
+ SCOREBOARD_RECALCULATE = "SCOREBOARD_RECALCULATE",
114
+ SCOREBOARD_UNLOCK = "SCOREBOARD_UNLOCK",
115
+ SCOREBOARD_LOCK = "SCOREBOARD_LOCK",
116
+ ENABLE_UPSOLVING = "ENABLE_UPSOLVING",
117
+ DISABLE_UPSOLVING = "DISABLE_UPSOLVING",
118
+ PARTICIPANT_JOIN = "PARTICIPANT_JOIN"
119
+ }
120
+ export interface ContestEvent {
121
+ action: ContestEventAction;
122
+ userId: string;
123
+ timestamp: number;
124
+ details: Record<string, any>;
125
+ }
126
+ export interface ContestGroup {
127
+ label: string;
128
+ value: string;
129
+ color: string;
130
+ }
131
+ export interface ContestBaseDocument {
132
+ key: string;
133
+ name: string;
134
+ description: string;
135
+ settings: ContestSettings;
136
+ problems: Record<string, ContestProblem>;
137
+ members: EntityMembers;
138
+ tags: string[];
139
+ groups: Record<string, ContestGroup>;
140
+ events: ContestEvent[];
141
+ }
142
+ export type ContestMembersResponse = {
143
+ administrators: {
144
+ [key: string]: UserBasicInfo;
145
+ };
146
+ judges: {
147
+ [key: string]: UserBasicInfo;
148
+ };
149
+ guests: {
150
+ [key: string]: UserBasicInfo;
151
+ };
152
+ spectators: {
153
+ [key: string]: UserBasicInfo;
154
+ };
155
+ contestants: {
156
+ [key: string]: UserBasicInfo;
157
+ };
158
+ };
159
+ export type ContestTimeData = Pick<ContestDataResponseDTO, 'isLive' | 'isFrozenTime' | 'isQuietTime' | 'isEndless' | 'isPast' | 'isFuture' | 'isGlobal'> & {
160
+ settings: Pick<UpsertContestDTO['settings'], 'penalty' | 'startTimestamp' | 'frozenTimestamp' | 'quietTimestamp' | 'endTimestamp' | 'upsolvingEnabled'>;
161
+ };
@@ -0,0 +1,13 @@
1
+ import { EntityMembers, EntityState } from './entity';
2
+ export interface CourseBaseDocument {
3
+ key: string;
4
+ title: string;
5
+ abstract: string;
6
+ description: string;
7
+ coverImageUrl: string;
8
+ state: EntityState;
9
+ lessons: {
10
+ worksheetId: string;
11
+ }[];
12
+ members: EntityMembers;
13
+ }
@@ -0,0 +1,116 @@
1
+ import { UserCompanyBasicInfoResponseDTO } from '../dto';
2
+ export declare enum EntityMembersRank {
3
+ NONE = "NONE",
4
+ CLOSE = "CLOSE",
5
+ OPEN = "OPEN"
6
+ }
7
+ export declare enum EntityState {
8
+ RELEASED = "RELEASED",
9
+ ARCHIVED = "ARCHIVED"
10
+ }
11
+ export type EntityUsersMemberUserData = {
12
+ userId: string;
13
+ lastVisitTimestamp: number | null;
14
+ joinedAtTimestamp: number;
15
+ };
16
+ export type EntityTeamsMemberUserData = {
17
+ teamId: string;
18
+ lastVisitTimestamp: number | null;
19
+ joinedAtTimestamp: number;
20
+ };
21
+ export type EntityMembersUserData = EntityUsersMemberUserData | EntityTeamsMemberUserData;
22
+ export interface EntityMembers {
23
+ rankAdministrators: EntityMembersRank;
24
+ administrators: {
25
+ [key: string]: EntityMembersUserData;
26
+ };
27
+ rankManagers: EntityMembersRank;
28
+ managers: {
29
+ [key: string]: EntityMembersUserData;
30
+ };
31
+ rankGuests: EntityMembersRank;
32
+ guests: {
33
+ [key: string]: EntityMembersUserData;
34
+ };
35
+ rankSpectators: EntityMembersRank;
36
+ spectators: {
37
+ [key: string]: EntityMembersUserData;
38
+ };
39
+ rankParticipants: EntityMembersRank;
40
+ participants: {
41
+ [key: string]: EntityMembersUserData;
42
+ };
43
+ }
44
+ export interface EntityOwnerDocument {
45
+ ownerUserId: string;
46
+ }
47
+ export interface EntityCompanyDocument {
48
+ companyId: string;
49
+ }
50
+ export interface EntityTimestampsDocument {
51
+ createdAt: Date;
52
+ updatedAt: Date;
53
+ }
54
+ export interface EntityStateDocument {
55
+ state: EntityState;
56
+ }
57
+ export interface EntityLogChanges {
58
+ key: string;
59
+ path: string;
60
+ valueType: string | null;
61
+ value?: any;
62
+ oldValue?: any;
63
+ type: LogOperation;
64
+ }
65
+ export interface EntityLog {
66
+ changes: EntityLogChanges[];
67
+ timestamp: number;
68
+ customerUserId: string;
69
+ }
70
+ export interface EntityLogsDocument {
71
+ logs: EntityLog[];
72
+ }
73
+ export type NewEntityDocument<T> = T & EntityCompanyDocument & EntityOwnerDocument & EntityTimestampsDocument & EntityStateDocument & EntityLogsDocument;
74
+ export type CreateEntityDocument<T> = Omit<T, '_id' | 'createdAt' | 'updatedAt' | 'companyId' | 'ownerUserId' | 'state' | 'logs'>;
75
+ export type UpdateEntityDocument<T> = Partial<Omit<T, '_id' | 'createdAt' | 'updatedAt' | 'companyId' | 'ownerUserId' | 'state' | 'logs' | 'key'>>;
76
+ export declare enum EntityCollection {
77
+ COMPANY = "COMPANY",
78
+ PROBLEM = "PROBLEM",
79
+ CONTEST = "CONTEST",
80
+ JUDGE = "JUDGE",
81
+ USER = "USER",
82
+ SUBMISSION = "SUBMISSION"
83
+ }
84
+ export declare enum CollectionKey {
85
+ COMPANY = "C",
86
+ USER = "U",
87
+ PROBLEM = "P",
88
+ CLASS = "K",
89
+ CLASS_ASSIGNMENT = "KA",
90
+ CONTEST = "T",
91
+ SCOREBOARD = "B",
92
+ SCOREBOARD_EVENTS = "BE",
93
+ COURSE = "R",
94
+ FILE = "F",
95
+ GROUP = "G",
96
+ JUDGE = "J",
97
+ WORKSHEET = "W",
98
+ WORKSHEET_SUBMISSIONS = "WS",
99
+ SUBMIT = "S",
100
+ LOCALE = "L",
101
+ COMMENT = "M",
102
+ EXCALIDRAW = "E",
103
+ MARKDOWN = "MD",
104
+ DOCUMENT_TEMPLATE = "DT",
105
+ MERMAID = "MM"
106
+ }
107
+ export declare enum LogOperation {
108
+ REMOVE = "REMOVE",
109
+ ADD = "ADD",
110
+ UPDATE = "UPDATE"
111
+ }
112
+ export interface LogDataResponseDTO {
113
+ changes: EntityLogChanges[];
114
+ timestamp: number;
115
+ customerUser: UserCompanyBasicInfoResponseDTO;
116
+ }
@@ -0,0 +1,9 @@
1
+ import { EntityMembers } from './entity';
2
+ export interface ExcalidrawBaseDocument {
3
+ key: string;
4
+ name: string;
5
+ elements: any;
6
+ appState: any;
7
+ members: EntityMembers;
8
+ tags: string[];
9
+ }
@@ -0,0 +1,27 @@
1
+ import { Role } from './users';
2
+ export type FileRole = Role.RESTRICTED | Role.GUEST | Role.REGULAR | Role.MASTER | Role.ADMIN | Role.SUPER_ADMIN;
3
+ export declare enum FileMemberRole {
4
+ VIEWER = "VIEWER",
5
+ EDITOR = "EDITOR"
6
+ }
7
+ export declare enum FileType {
8
+ FOLDER = "FOLDER",
9
+ FILE = "FILE"
10
+ }
11
+ export type FolderFileContent = {
12
+ type: FileType.FOLDER;
13
+ };
14
+ export type FileFileContent = {
15
+ type: FileType.FILE;
16
+ mime: string;
17
+ key: string;
18
+ };
19
+ export type FileContent = FolderFileContent | FileFileContent;
20
+ export type SummaryFileContent = FolderFileContent | Omit<FileFileContent, 'key'>;
21
+ export declare enum FilesJukiPub {
22
+ SHARED = "shared",// files to share
23
+ SHARED_EXCALIDRAW = "shared/E",
24
+ TEMP = "temp",// temporal files
25
+ PROBLEMS = "problems",
26
+ CONTESTS = "contests"
27
+ }
@@ -0,0 +1,12 @@
1
+ import { EntityMembers, EntityState } from './entity';
2
+ export declare enum GroupType {
3
+ CLASS = "CLASS",
4
+ TEAM = "TEAM"
5
+ }
6
+ export interface GroupBaseDocument {
7
+ name: string;
8
+ description: string;
9
+ state: EntityState;
10
+ types: GroupType;
11
+ members: EntityMembers;
12
+ }
@@ -0,0 +1,25 @@
1
+ export * from './account';
2
+ export * from './class';
3
+ export * from './comments';
4
+ export * from './commons';
5
+ export * from './company';
6
+ export * from './contest';
7
+ export * from './course';
8
+ export * from './entity';
9
+ export * from './excalidraw';
10
+ export * from './file';
11
+ export * from './group';
12
+ export * from './judge';
13
+ export * from './markdown';
14
+ export * from './mermaid';
15
+ export * from './notification';
16
+ export * from './prisma';
17
+ export * from './problems';
18
+ export * from './services';
19
+ export * from './sheet';
20
+ export * from './socket';
21
+ export * from './submission';
22
+ export * from './teams';
23
+ export * from './users';
24
+ export * from './virtual-user';
25
+ export * from './worksheet';