@xcpcio/core 0.52.0 → 0.53.0

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/index.d.ts CHANGED
@@ -1,8 +1,24 @@
1
- import { TimeUnit, SubmissionReaction, SubmissionStatus, Submission as Submission$1, Submissions as Submissions$1, BalloonColor, Problem as Problem$1, Problems as Problems$1, Lang, CalculationOfPenalty, StatusTimeDisplay, MedalPreset, Image, BannerMode, ContestState, Contest as Contest$1, Team as Team$1, Teams as Teams$1, IPerson, IRatingHistory, IRatingUser, IRating, ContestIndex as ContestIndex$1 } from '@xcpcio/types';
1
+ import { TimeUnit, SubmissionReaction, SubmissionStatus, Submission as Submission$1, Submissions as Submissions$1, BalloonColor, Problem as Problem$1, Problems as Problems$1, CalculationOfPenalty, Image, Team as Team$1, Teams as Teams$1, Lang, StatusTimeDisplay, MedalPreset, BannerMode, ContestState, Contest as Contest$1, ContestIndex as ContestIndex$1, IPerson, IRatingHistory, IRatingUser, IRating } from '@xcpcio/types';
2
2
  import dayjs from 'dayjs';
3
3
  export { default as dayjs } from 'dayjs';
4
4
  import * as XLSX from 'xlsx-js-style';
5
5
 
6
+ declare enum MedalType {
7
+ UNKNOWN = "Unknown",
8
+ GOLD = "Gold",
9
+ SILVER = "Silver",
10
+ BRONZE = "Bronze",
11
+ HONORABLE = "Honorable"
12
+ }
13
+ declare class Award {
14
+ medalType: MedalType;
15
+ minRank: number;
16
+ maxRank: number;
17
+ constructor();
18
+ }
19
+ declare function isValidMedalType(medal: MedalType): boolean;
20
+ type Awards = Map<string, Award[]>;
21
+
6
22
  declare class Submission {
7
23
  id: string;
8
24
  teamId: string;
@@ -86,38 +102,6 @@ declare class TeamProblemStatistics {
86
102
  get penaltyInSecond(): number;
87
103
  }
88
104
 
89
- declare function calcDirt(attemptedNum: number, solvedNum: number): number;
90
-
91
- declare function getWhiteOrBlackColorV1(background: string): "#000" | "#fff";
92
- declare function getWhiteOrBlackColor(background: string): "#000" | "#fff";
93
-
94
- declare function createDayJS(time?: Date | string | number | undefined): dayjs.Dayjs;
95
- declare function getTimestamp(time: number | dayjs.Dayjs): number;
96
- declare function getTimeDiff(seconds: number): string;
97
-
98
- declare class Group {
99
- names: Map<Lang, string>;
100
- defaultLang: Lang;
101
- isDefault: boolean;
102
- constructor();
103
- }
104
-
105
- declare enum MedalType {
106
- UNKNOWN = "Unknown",
107
- GOLD = "Gold",
108
- SILVER = "Silver",
109
- BRONZE = "Bronze",
110
- HONORABLE = "Honorable"
111
- }
112
- declare class Award {
113
- medalType: MedalType;
114
- minRank: number;
115
- maxRank: number;
116
- constructor();
117
- }
118
- declare function isValidMedalType(medal: MedalType): boolean;
119
- type Awards = Map<string, Award[]>;
120
-
121
105
  declare class ContestOptions {
122
106
  calculationOfPenalty: CalculationOfPenalty;
123
107
  submissionTimestampUnit: TimeUnit;
@@ -127,51 +111,6 @@ declare class ContestOptions {
127
111
  constructor();
128
112
  }
129
113
 
130
- declare class Contest {
131
- id: string;
132
- name: string;
133
- startTime: dayjs.Dayjs;
134
- endTime: dayjs.Dayjs;
135
- freezeTime: dayjs.Dayjs;
136
- replayStartTime?: dayjs.Dayjs;
137
- replayEndTime?: dayjs.Dayjs;
138
- replayFreezeTime?: dayjs.Dayjs;
139
- replayNowTime?: dayjs.Dayjs;
140
- replayContestStartTimestamp?: number;
141
- totalDurationTimestamp: number;
142
- freezeDurationTimestamp: number;
143
- unFreezeDurationTimestamp: number;
144
- penalty: number;
145
- problems: Problems;
146
- problemsMap: Map<string, Problem>;
147
- statusTimeDisplay: StatusTimeDisplay;
148
- badge?: string;
149
- medal?: Record<string, Record<string, number>> | MedalPreset;
150
- awards?: Awards;
151
- organization?: string;
152
- group: Map<string, Group>;
153
- tag: Map<string, string>;
154
- logo?: Image;
155
- banner?: Image;
156
- bannerMode?: BannerMode;
157
- boardLink?: string;
158
- options: ContestOptions;
159
- constructor();
160
- getStartTime(): dayjs.Dayjs;
161
- getEndTime(): dayjs.Dayjs;
162
- getFreezeTime(): dayjs.Dayjs;
163
- getContestDuration(timeFormat?: string): string;
164
- getContestState(nowTime?: Date): ContestState;
165
- getContestPendingTime(nowTime?: Date): string;
166
- getContestElapsedTime(nowTime?: Date): string;
167
- getContestRemainingTime(nowTime?: Date): string;
168
- getContestProgressRatio(nowTime?: Date): number;
169
- isEnableAwards(group: string): boolean;
170
- resetReplayTime(): void;
171
- setReplayTime(replayStartTimestamp: number): void;
172
- }
173
- declare function createContest(contestJSON: Contest$1): Contest;
174
-
175
114
  declare class PlaceChartPointData {
176
115
  timePoint: number;
177
116
  rank: number;
@@ -223,17 +162,6 @@ type Teams = Array<Team>;
223
162
  declare function createTeam(teamJSON: Team$1): Team;
224
163
  declare function createTeams(teamsJSON: Teams$1): Teams;
225
164
 
226
- declare class RankStatistics {
227
- teamSolvedNum: Array<number>;
228
- teamSolvedNumIndex: Array<number>;
229
- maxSolvedProblems: number;
230
- effectiveTeamNum: number;
231
- totalTeamNum: number;
232
- constructor();
233
- reset(): void;
234
- getTeamSolvedNumIndex(solvedNum: number): number;
235
- }
236
-
237
165
  declare class Balloon {
238
166
  problem: Problem;
239
167
  team: Team;
@@ -287,6 +215,98 @@ declare class BattleOfGiants {
287
215
  FromBase64(base64: string): void;
288
216
  }
289
217
 
218
+ declare class Group {
219
+ names: Map<Lang, string>;
220
+ defaultLang: Lang;
221
+ isDefault: boolean;
222
+ constructor();
223
+ }
224
+
225
+ declare function calcDirt(attemptedNum: number, solvedNum: number): number;
226
+
227
+ declare function getWhiteOrBlackColorV1(background: string): "#000" | "#fff";
228
+ declare function getWhiteOrBlackColor(background: string): "#000" | "#fff";
229
+
230
+ declare function createDayJS(time?: Date | string | number | undefined): dayjs.Dayjs;
231
+ declare function getTimestamp(time: number | dayjs.Dayjs): number;
232
+ declare function getTimeDiff(seconds: number): string;
233
+
234
+ declare class Contest {
235
+ id: string;
236
+ name: string;
237
+ startTime: dayjs.Dayjs;
238
+ endTime: dayjs.Dayjs;
239
+ freezeTime: dayjs.Dayjs;
240
+ replayStartTime?: dayjs.Dayjs;
241
+ replayEndTime?: dayjs.Dayjs;
242
+ replayFreezeTime?: dayjs.Dayjs;
243
+ replayNowTime?: dayjs.Dayjs;
244
+ replayContestStartTimestamp?: number;
245
+ totalDurationTimestamp: number;
246
+ freezeDurationTimestamp: number;
247
+ unFreezeDurationTimestamp: number;
248
+ penalty: number;
249
+ problems: Problems;
250
+ problemsMap: Map<string, Problem>;
251
+ statusTimeDisplay: StatusTimeDisplay;
252
+ badge?: string;
253
+ medal?: Record<string, Record<string, number>> | MedalPreset;
254
+ awards?: Awards;
255
+ organization?: string;
256
+ group: Map<string, Group>;
257
+ tag: Map<string, string>;
258
+ logo?: Image;
259
+ banner?: Image;
260
+ bannerMode?: BannerMode;
261
+ boardLink?: string;
262
+ options: ContestOptions;
263
+ constructor();
264
+ getStartTime(): dayjs.Dayjs;
265
+ getEndTime(): dayjs.Dayjs;
266
+ getFreezeTime(): dayjs.Dayjs;
267
+ getContestDuration(timeFormat?: string): string;
268
+ getContestState(nowTime?: Date): ContestState;
269
+ getContestPendingTime(nowTime?: Date): string;
270
+ getContestElapsedTime(nowTime?: Date): string;
271
+ getContestRemainingTime(nowTime?: Date): string;
272
+ getContestProgressRatio(nowTime?: Date): number;
273
+ isEnableAwards(group: string): boolean;
274
+ resetReplayTime(): void;
275
+ setReplayTime(replayStartTimestamp: number): void;
276
+ }
277
+ declare function createContest(contestJSON: Contest$1): Contest;
278
+
279
+ declare class ContestIndexConfig {
280
+ contestName: string;
281
+ startTime: dayjs.Dayjs;
282
+ endTime: dayjs.Dayjs;
283
+ freezeTime: dayjs.Dayjs;
284
+ totalDurationTimestamp: number;
285
+ freezeDurationTimestamp: number;
286
+ unFreezeDurationTimestamp: number;
287
+ logo?: Image;
288
+ constructor();
289
+ }
290
+ declare class ContestIndex {
291
+ contest: Contest;
292
+ boardLink: string;
293
+ constructor();
294
+ }
295
+ type ContestIndexList = Array<ContestIndex>;
296
+ declare function createContestIndex(contestIndexJSON: ContestIndex$1): ContestIndex;
297
+ declare function createContestIndexList(contestListJSON: any): ContestIndexList;
298
+
299
+ declare class RankStatistics {
300
+ teamSolvedNum: Array<number>;
301
+ teamSolvedNumIndex: Array<number>;
302
+ maxSolvedProblems: number;
303
+ effectiveTeamNum: number;
304
+ totalTeamNum: number;
305
+ constructor();
306
+ reset(): void;
307
+ getTeamSolvedNumIndex(solvedNum: number): number;
308
+ }
309
+
290
310
  declare class RankOptions {
291
311
  enableFilterSubmissionsByTimestamp: boolean;
292
312
  width: number;
@@ -356,6 +376,8 @@ declare class ICPCStandingsCsvConverter {
356
376
  private getMedalCitation;
357
377
  }
358
378
 
379
+ declare function getImageSource(image: Image, asset_host?: string): string;
380
+
359
381
  declare class Person {
360
382
  name: string;
361
383
  constructor(name?: string);
@@ -404,6 +426,21 @@ declare class RatingUser {
404
426
  type RatingUsers = Array<RatingUser>;
405
427
  type RatingUserMap = Map<string, RatingUser>;
406
428
 
429
+ declare class Rating {
430
+ id: string;
431
+ name: string;
432
+ baseRating: number;
433
+ contestIDs: string[];
434
+ users: RatingUsers;
435
+ ranks: Ranks;
436
+ userMap: RatingUserMap;
437
+ constructor();
438
+ buildRating(): void;
439
+ generateTeamId(t: Team): string;
440
+ toJSON(): IRating;
441
+ static fromJSON(iRating: IRating | string): Rating;
442
+ }
443
+
407
444
  declare class RatingCalculator {
408
445
  users: RatingUsers;
409
446
  constructor();
@@ -434,43 +471,6 @@ declare class RatingUtility {
434
471
  static getRatingLevelClass(ratingLevel: RatingLevel | number): string;
435
472
  }
436
473
 
437
- declare class Rating {
438
- id: string;
439
- name: string;
440
- baseRating: number;
441
- contestIDs: string[];
442
- users: RatingUsers;
443
- ranks: Ranks;
444
- userMap: RatingUserMap;
445
- constructor();
446
- buildRating(): void;
447
- generateTeamId(t: Team): string;
448
- toJSON(): IRating;
449
- static fromJSON(iRating: IRating | string): Rating;
450
- }
451
-
452
- declare class ContestIndexConfig {
453
- contestName: string;
454
- startTime: dayjs.Dayjs;
455
- endTime: dayjs.Dayjs;
456
- freezeTime: dayjs.Dayjs;
457
- totalDurationTimestamp: number;
458
- freezeDurationTimestamp: number;
459
- unFreezeDurationTimestamp: number;
460
- logo?: Image;
461
- constructor();
462
- }
463
- declare class ContestIndex {
464
- contest: Contest;
465
- boardLink: string;
466
- constructor();
467
- }
468
- type ContestIndexList = Array<ContestIndex>;
469
- declare function createContestIndex(contestIndexJSON: ContestIndex$1): ContestIndex;
470
- declare function createContestIndexList(contestListJSON: any): ContestIndexList;
471
-
472
- declare function getImageSource(image: Image, asset_host?: string): string;
473
-
474
474
  declare class ResolverOperation {
475
475
  id: number;
476
476
  team: Team;
@@ -516,4 +516,4 @@ declare function isRejected(status: SubmissionStatus): boolean;
516
516
  declare function isPending(status: SubmissionStatus): boolean;
517
517
  declare function isNotCalculatedPenaltyStatus(status: SubmissionStatus): boolean;
518
518
 
519
- export { Award, Awards, Balloon, Balloons, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestIndexList, ContestOptions, GeneralExcelConverter, Giants, GiantsType, ICPCStandingsCsvConverter, MedalType, Person, Persons, PlaceChartPointData, Problem, ProblemStatistics, Problems, Rank, RankOptions, RankStatistics, Ranks, Rating, RatingCalculator, RatingHistories, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUserMap, RatingUsers, RatingUtility, Resolver, ResolverVue, SelectOptionItem, Submission, Submissions, Team, TeamProblemStatistics, Teams, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
519
+ export { Award, type Awards, Balloon, type Balloons, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, type ContestIndexList, ContestOptions, GeneralExcelConverter, Giants, GiantsType, ICPCStandingsCsvConverter, MedalType, Person, type Persons, PlaceChartPointData, Problem, ProblemStatistics, type Problems, Rank, RankOptions, RankStatistics, type Ranks, Rating, RatingCalculator, type RatingHistories, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, type RatingUserMap, type RatingUsers, RatingUtility, Resolver, ResolverVue, type SelectOptionItem, Submission, type Submissions, Team, TeamProblemStatistics, type Teams, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };