@juki-team/commons 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/README.md +3 -0
  2. package/biome.shared.json +102 -0
  3. package/dist/constants/commons.d.ts +62 -0
  4. package/dist/constants/commons.js +658 -0
  5. package/dist/constants/company.d.ts +9 -0
  6. package/dist/constants/company.js +24 -0
  7. package/dist/constants/contest.d.ts +15 -0
  8. package/dist/constants/contest.js +29 -0
  9. package/dist/constants/course.d.ts +8 -0
  10. package/dist/constants/course.js +12 -0
  11. package/dist/constants/date.d.ts +9 -0
  12. package/dist/constants/date.js +23 -0
  13. package/dist/constants/email.d.ts +2 -0
  14. package/dist/constants/email.js +34 -0
  15. package/dist/constants/entity.d.ts +3 -0
  16. package/dist/constants/entity.js +18 -0
  17. package/dist/constants/file.d.ts +28 -0
  18. package/dist/constants/file.js +46 -0
  19. package/dist/constants/index.d.ts +18 -0
  20. package/dist/constants/index.js +18 -0
  21. package/dist/constants/judge.d.ts +37 -0
  22. package/dist/constants/judge.js +221 -0
  23. package/dist/constants/problem.d.ts +37 -0
  24. package/dist/constants/problem.js +72 -0
  25. package/dist/constants/routing.d.ts +7 -0
  26. package/dist/constants/routing.js +7 -0
  27. package/dist/constants/services.d.ts +5 -0
  28. package/dist/constants/services.js +131 -0
  29. package/dist/constants/system.d.ts +8 -0
  30. package/dist/constants/system.js +9 -0
  31. package/dist/constants/teams.d.ts +15 -0
  32. package/dist/constants/teams.js +18 -0
  33. package/dist/constants/time.d.ts +9 -0
  34. package/dist/constants/time.js +9 -0
  35. package/dist/constants/user.d.ts +10 -0
  36. package/dist/constants/user.js +35 -0
  37. package/dist/constants/websocket.d.ts +6 -0
  38. package/dist/constants/websocket.js +5 -0
  39. package/dist/constants/worksheet.d.ts +11 -0
  40. package/dist/constants/worksheet.js +66 -0
  41. package/dist/dto/class.d.ts +115 -0
  42. package/dist/dto/class.js +1 -0
  43. package/dist/dto/code.d.ts +13 -0
  44. package/dist/dto/code.js +1 -0
  45. package/dist/dto/comments.d.ts +21 -0
  46. package/dist/dto/comments.js +1 -0
  47. package/dist/dto/contest.d.ts +95 -0
  48. package/dist/dto/contest.js +7 -0
  49. package/dist/dto/course.d.ts +34 -0
  50. package/dist/dto/course.js +1 -0
  51. package/dist/dto/entity.d.ts +92 -0
  52. package/dist/dto/entity.js +5 -0
  53. package/dist/dto/excalidraw.d.ts +12 -0
  54. package/dist/dto/excalidraw.js +1 -0
  55. package/dist/dto/file.d.ts +34 -0
  56. package/dist/dto/file.js +1 -0
  57. package/dist/dto/image.d.ts +6 -0
  58. package/dist/dto/image.js +1 -0
  59. package/dist/dto/index.d.ts +24 -0
  60. package/dist/dto/index.js +24 -0
  61. package/dist/dto/judge.d.ts +16 -0
  62. package/dist/dto/judge.js +1 -0
  63. package/dist/dto/markdown.d.ts +12 -0
  64. package/dist/dto/markdown.js +1 -0
  65. package/dist/dto/mermaid.d.ts +12 -0
  66. package/dist/dto/mermaid.js +1 -0
  67. package/dist/dto/organization.d.ts +102 -0
  68. package/dist/dto/organization.js +1 -0
  69. package/dist/dto/problem.d.ts +67 -0
  70. package/dist/dto/problem.js +1 -0
  71. package/dist/dto/scoreboard.d.ts +35 -0
  72. package/dist/dto/scoreboard.js +1 -0
  73. package/dist/dto/session.d.ts +15 -0
  74. package/dist/dto/session.js +1 -0
  75. package/dist/dto/socket.d.ts +257 -0
  76. package/dist/dto/socket.js +1 -0
  77. package/dist/dto/statistics.d.ts +43 -0
  78. package/dist/dto/statistics.js +1 -0
  79. package/dist/dto/submission.d.ts +95 -0
  80. package/dist/dto/submission.js +1 -0
  81. package/dist/dto/system.d.ts +91 -0
  82. package/dist/dto/system.js +1 -0
  83. package/dist/dto/url.d.ts +8 -0
  84. package/dist/dto/url.js +1 -0
  85. package/dist/dto/user.d.ts +109 -0
  86. package/dist/dto/user.js +1 -0
  87. package/dist/dto/virtual-user.d.ts +39 -0
  88. package/dist/dto/virtual-user.js +1 -0
  89. package/dist/dto/worksheet-submissions.d.ts +64 -0
  90. package/dist/dto/worksheet-submissions.js +1 -0
  91. package/dist/dto/worksheet.d.ts +39 -0
  92. package/dist/dto/worksheet.js +1 -0
  93. package/dist/helpers/class.d.ts +4 -0
  94. package/dist/helpers/class.js +10 -0
  95. package/dist/helpers/comments.d.ts +4 -0
  96. package/dist/helpers/comments.js +4 -0
  97. package/dist/helpers/commons.d.ts +33 -0
  98. package/dist/helpers/commons.js +191 -0
  99. package/dist/helpers/contest.d.ts +5 -0
  100. package/dist/helpers/contest.js +21 -0
  101. package/dist/helpers/document.d.ts +14 -0
  102. package/dist/helpers/document.js +38 -0
  103. package/dist/helpers/file.d.ts +1 -0
  104. package/dist/helpers/file.js +4 -0
  105. package/dist/helpers/index.d.ts +14 -0
  106. package/dist/helpers/index.js +14 -0
  107. package/dist/helpers/interval.d.ts +2 -0
  108. package/dist/helpers/interval.js +22 -0
  109. package/dist/helpers/judging.d.ts +25 -0
  110. package/dist/helpers/judging.js +107 -0
  111. package/dist/helpers/object.d.ts +1 -0
  112. package/dist/helpers/object.js +32 -0
  113. package/dist/helpers/responses.d.ts +8 -0
  114. package/dist/helpers/responses.js +78 -0
  115. package/dist/helpers/socket.d.ts +45 -0
  116. package/dist/helpers/socket.js +238 -0
  117. package/dist/helpers/time.d.ts +13 -0
  118. package/dist/helpers/time.js +101 -0
  119. package/dist/helpers/user.d.ts +11 -0
  120. package/dist/helpers/user.js +14 -0
  121. package/dist/helpers/worksheet.d.ts +10 -0
  122. package/dist/helpers/worksheet.js +131 -0
  123. package/dist/index.d.ts +6 -0
  124. package/dist/index.js +6 -0
  125. package/dist/prisma/enums/AssignmentClassType.d.ts +7 -0
  126. package/dist/prisma/enums/AssignmentClassType.js +6 -0
  127. package/dist/prisma/enums/ContestEventAction.d.ts +10 -0
  128. package/dist/prisma/enums/ContestEventAction.js +9 -0
  129. package/dist/prisma/enums/ContestProblemPrerequisiteType.d.ts +5 -0
  130. package/dist/prisma/enums/ContestProblemPrerequisiteType.js +4 -0
  131. package/dist/prisma/enums/ContestRole.d.ts +11 -0
  132. package/dist/prisma/enums/ContestRole.js +10 -0
  133. package/dist/prisma/enums/ContestStatus.d.ts +6 -0
  134. package/dist/prisma/enums/ContestStatus.js +5 -0
  135. package/dist/prisma/enums/CourseRole.d.ts +12 -0
  136. package/dist/prisma/enums/CourseRole.js +11 -0
  137. package/dist/prisma/enums/EntityObjectType.d.ts +13 -0
  138. package/dist/prisma/enums/EntityObjectType.js +12 -0
  139. package/dist/prisma/enums/EntityRole.d.ts +8 -0
  140. package/dist/prisma/enums/EntityRole.js +7 -0
  141. package/dist/prisma/enums/EntitySubjectType.d.ts +7 -0
  142. package/dist/prisma/enums/EntitySubjectType.js +6 -0
  143. package/dist/prisma/enums/FileRole.d.ts +9 -0
  144. package/dist/prisma/enums/FileRole.js +8 -0
  145. package/dist/prisma/enums/FileType.d.ts +5 -0
  146. package/dist/prisma/enums/FileType.js +4 -0
  147. package/dist/prisma/enums/GroupType.d.ts +5 -0
  148. package/dist/prisma/enums/GroupType.js +4 -0
  149. package/dist/prisma/enums/JudgeType.d.ts +12 -0
  150. package/dist/prisma/enums/JudgeType.js +11 -0
  151. package/dist/prisma/enums/OrganizationPlan.d.ts +7 -0
  152. package/dist/prisma/enums/OrganizationPlan.js +6 -0
  153. package/dist/prisma/enums/ProblemRole.d.ts +11 -0
  154. package/dist/prisma/enums/ProblemRole.js +10 -0
  155. package/dist/prisma/enums/ProblemScoringMode.d.ts +6 -0
  156. package/dist/prisma/enums/ProblemScoringMode.js +5 -0
  157. package/dist/prisma/enums/ProblemType.d.ts +6 -0
  158. package/dist/prisma/enums/ProblemType.js +5 -0
  159. package/dist/prisma/enums/ProblemVerdict.d.ts +14 -0
  160. package/dist/prisma/enums/ProblemVerdict.js +13 -0
  161. package/dist/prisma/enums/ShareLinkVisibility.d.ts +5 -0
  162. package/dist/prisma/enums/ShareLinkVisibility.js +4 -0
  163. package/dist/prisma/enums/SubmissionRunStatus.d.ts +18 -0
  164. package/dist/prisma/enums/SubmissionRunStatus.js +17 -0
  165. package/dist/prisma/enums/SystemRole.d.ts +9 -0
  166. package/dist/prisma/enums/SystemRole.js +8 -0
  167. package/dist/prisma/enums/TeamRole.d.ts +9 -0
  168. package/dist/prisma/enums/TeamRole.js +8 -0
  169. package/dist/prisma/enums/TelemetryType.d.ts +9 -0
  170. package/dist/prisma/enums/TelemetryType.js +8 -0
  171. package/dist/prisma/enums/UserRole.d.ts +10 -0
  172. package/dist/prisma/enums/UserRole.js +9 -0
  173. package/dist/prisma/enums/WorkingIn.d.ts +8 -0
  174. package/dist/prisma/enums/WorkingIn.js +7 -0
  175. package/dist/prisma/enums/WorksheetContentType.d.ts +10 -0
  176. package/dist/prisma/enums/WorksheetContentType.js +9 -0
  177. package/dist/prisma/enums/index.d.ts +26 -0
  178. package/dist/prisma/enums/index.js +26 -0
  179. package/dist/prototypes/Date.d.ts +62 -0
  180. package/dist/prototypes/Date.js +218 -0
  181. package/dist/prototypes/Error.d.ts +10 -0
  182. package/dist/prototypes/Error.js +17 -0
  183. package/dist/prototypes/Number.d.ts +7 -0
  184. package/dist/prototypes/Number.js +8 -0
  185. package/dist/prototypes/index.d.ts +3 -0
  186. package/dist/prototypes/index.js +3 -0
  187. package/dist/types/account.d.ts +9 -0
  188. package/dist/types/account.js +10 -0
  189. package/dist/types/class.d.ts +67 -0
  190. package/dist/types/class.js +7 -0
  191. package/dist/types/comments.d.ts +17 -0
  192. package/dist/types/comments.js +1 -0
  193. package/dist/types/commons.d.ts +84 -0
  194. package/dist/types/commons.js +69 -0
  195. package/dist/types/company.d.ts +6 -0
  196. package/dist/types/company.js +7 -0
  197. package/dist/types/contest.d.ts +144 -0
  198. package/dist/types/contest.js +6 -0
  199. package/dist/types/course.d.ts +13 -0
  200. package/dist/types/course.js +1 -0
  201. package/dist/types/entity.d.ts +116 -0
  202. package/dist/types/entity.js +50 -0
  203. package/dist/types/excalidraw.d.ts +9 -0
  204. package/dist/types/excalidraw.js +1 -0
  205. package/dist/types/file.d.ts +22 -0
  206. package/dist/types/file.js +13 -0
  207. package/dist/types/group.d.ts +9 -0
  208. package/dist/types/group.js +1 -0
  209. package/dist/types/index.d.ts +23 -0
  210. package/dist/types/index.js +23 -0
  211. package/dist/types/judge.d.ts +46 -0
  212. package/dist/types/judge.js +17 -0
  213. package/dist/types/markdown.d.ts +8 -0
  214. package/dist/types/markdown.js +1 -0
  215. package/dist/types/mermaid.d.ts +8 -0
  216. package/dist/types/mermaid.js +1 -0
  217. package/dist/types/notification.d.ts +7 -0
  218. package/dist/types/notification.js +8 -0
  219. package/dist/types/problems.d.ts +93 -0
  220. package/dist/types/problems.js +16 -0
  221. package/dist/types/services.d.ts +214 -0
  222. package/dist/types/services.js +147 -0
  223. package/dist/types/sheet.d.ts +104 -0
  224. package/dist/types/sheet.js +16 -0
  225. package/dist/types/socket.d.ts +49 -0
  226. package/dist/types/socket.js +49 -0
  227. package/dist/types/submission.d.ts +5 -0
  228. package/dist/types/submission.js +1 -0
  229. package/dist/types/teams.d.ts +96 -0
  230. package/dist/types/teams.js +28 -0
  231. package/dist/types/users.d.ts +65 -0
  232. package/dist/types/users.js +33 -0
  233. package/dist/types/worksheet.d.ts +42 -0
  234. package/dist/types/worksheet.js +11 -0
  235. package/package.json +42 -0
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # commons
2
+
3
+ See https://juki-team.github.io/commons/modules.html
@@ -0,0 +1,102 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.4.10/schema.json",
3
+ "formatter": {
4
+ "enabled": true,
5
+ "formatWithErrors": false,
6
+ "indentStyle": "space",
7
+ "indentWidth": 2,
8
+ "lineEnding": "lf",
9
+ "lineWidth": 128,
10
+ "attributePosition": "auto",
11
+ "bracketSameLine": false,
12
+ "bracketSpacing": true,
13
+ "expand": "auto",
14
+ "useEditorconfig": true
15
+ },
16
+ "linter": {
17
+ "enabled": true,
18
+ "rules": {
19
+ "recommended": true,
20
+ "correctness": {
21
+ "noUnusedImports": "error",
22
+ "noUnusedVariables": "error",
23
+ "noUnusedPrivateClassMembers": "error",
24
+ "noUnusedFunctionParameters": "error",
25
+ "useExhaustiveDependencies": "error",
26
+ "noConstantCondition": "error",
27
+ "noVoidTypeReturn": "error",
28
+ "noUndeclaredVariables": "error",
29
+ "useImportExtensions": "off"
30
+ },
31
+ "suspicious": {
32
+ "noConsole": { "level": "error", "options": { "allow": ["error", "warn", "info"] } },
33
+ "noExplicitAny": "error",
34
+ "noDoubleEquals": "error",
35
+ "noEmptyBlockStatements": "error",
36
+ "noConfusingVoidType": "error",
37
+ "useAwait": "error",
38
+ "noAssignInExpressions": "error",
39
+ "noMisleadingInstantiator": "error"
40
+ },
41
+ "style": {
42
+ "noNonNullAssertion": "error",
43
+ "useConst": "error",
44
+ "useTemplate": "error",
45
+ "noParameterAssign": "error",
46
+ "useShorthandAssign": "error",
47
+ "noUselessElse": "error",
48
+ "useDefaultParameterLast": "error",
49
+ "noDefaultExport": "error",
50
+ "useNamingConvention": {
51
+ "level": "error",
52
+ "options": {
53
+ "strictCase": false,
54
+ "conventions": [
55
+ {
56
+ "selector": { "kind": "enumMember" },
57
+ "formats": ["CONSTANT_CASE"]
58
+ }
59
+ ]
60
+ }
61
+ },
62
+ "useImportType": "error"
63
+ },
64
+ "performance": {
65
+ "noDelete": "error",
66
+ "noAccumulatingSpread": "error",
67
+ "noNamespaceImport": "error"
68
+ },
69
+ "complexity": {
70
+ "noExcessiveCognitiveComplexity": { "level": "warn", "options": { "maxAllowedComplexity": 10 } },
71
+ "noForEach": "error",
72
+ "useSimplifiedLogicExpression": "error",
73
+ "useFlatMap": "error",
74
+ "noStaticOnlyClass": "error",
75
+ "noUselessSwitchCase": "error"
76
+ }
77
+ }
78
+ },
79
+ "javascript": {
80
+ "formatter": {
81
+ "jsxQuoteStyle": "double",
82
+ "quoteProperties": "asNeeded",
83
+ "trailingCommas": "all",
84
+ "semicolons": "always",
85
+ "arrowParentheses": "always",
86
+ "bracketSameLine": false,
87
+ "quoteStyle": "single",
88
+ "attributePosition": "auto",
89
+ "bracketSpacing": true
90
+ }
91
+ },
92
+ "html": {
93
+ "formatter": {
94
+ "indentScriptAndStyle": false,
95
+ "selfCloseVoidElements": "always"
96
+ }
97
+ },
98
+ "assist": {
99
+ "enabled": true,
100
+ "actions": { "source": { "organizeImports": "on" } }
101
+ }
102
+ }
@@ -0,0 +1,62 @@
1
+ import { CodeLanguage, Language, Theme } from '../types/index.js';
2
+ export declare const LANGUAGE: {
3
+ [Key in Language]: {
4
+ value: Language;
5
+ label: string;
6
+ };
7
+ };
8
+ export declare const THEME: {
9
+ [Key in Theme]: {
10
+ value: Theme;
11
+ label: string;
12
+ };
13
+ };
14
+ export type CodeLanguageMeta = {
15
+ value: CodeLanguage;
16
+ label: string;
17
+ mime: string;
18
+ mainFilename: string;
19
+ fileExtension: Array<string>;
20
+ compilePattern: string;
21
+ runPattern: string;
22
+ templateSourceCode: string;
23
+ hasBuildFile: boolean;
24
+ executable: string;
25
+ executableVersion: string;
26
+ monacoKey: string;
27
+ codeMirrorKey: string;
28
+ highlightJsKey: string;
29
+ };
30
+ export declare const CODE_LANGUAGE: {
31
+ [Key in CodeLanguage]: CodeLanguageMeta;
32
+ };
33
+ export declare const PAGE_SIZES: string[];
34
+ export declare const PALLETE: {
35
+ vivos: {
36
+ color: string;
37
+ title: string;
38
+ }[];
39
+ oscuros: {
40
+ color: string;
41
+ title: string;
42
+ }[];
43
+ agrisados: {
44
+ color: string;
45
+ title: string;
46
+ }[];
47
+ claros: {
48
+ color: string;
49
+ title: string;
50
+ }[];
51
+ };
52
+ export declare const UPPERCASE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
53
+ export declare const LOWERCASE_LETTERS: string;
54
+ export declare const NUMBERS = "012345678";
55
+ export declare const DEFAULT_JUKI_PROFILE_IMAGE = "https://juki-judge.s3.us-east-2.amazonaws.com/public/file/5f69783aa7a8e048ef8d0ce2.";
56
+ export declare const SEPARATOR_TOKEN = "\u001E";
57
+ export declare const HEADER_JUKI_FORWARDED_HOST = "x-juki-forwarded-host";
58
+ export declare const HEADER_JUKI_VISITOR_SESSION_ID = "x-juki-visitor-session-id";
59
+ export declare const HEADER_JUKI_METADATA = "x-juki-metadata";
60
+ export declare const HEADER_JUKI_SECRET_TOKEN = "x-juki-secret-token";
61
+ export declare const HEADER_JUKI_INTERNAL_API_KEY = "x-juki-internal-api-key";
62
+ export declare const COOKIE_JUKI_SESSION_ID = "juki-session-id";