@gamelobby/common 1.0.372 → 1.0.373

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.
@@ -1,11 +1,62 @@
1
+ export declare type BracketMatchType = 'winner' | 'loser' | 'grandFinal' | 'grandFinalReset' | 'consolation';
1
2
  export interface BracketBackEnd {
2
- round: Number;
3
- match: Number;
4
- player1: Number | null;
5
- player2?: Number | null;
3
+ round: number;
4
+ match: number;
5
+ player1: number | null;
6
+ player2?: number | null;
6
7
  win: {
7
8
  round: number;
8
9
  match: number;
10
+ bracketType?: BracketMatchType;
9
11
  };
10
- lose?: string;
12
+ loss?: {
13
+ round: number;
14
+ match: number;
15
+ bracketType?: BracketMatchType;
16
+ } | string;
17
+ bracketType?: BracketMatchType;
18
+ isBye?: boolean;
19
+ byeAdvancesTo?: {
20
+ round: number;
21
+ match: number;
22
+ };
23
+ player1Score?: number;
24
+ player2Score?: number;
25
+ winnerId?: number;
26
+ loserId?: number;
27
+ status?: 'pending' | 'in_progress' | 'completed' | 'forfeited' | 'bye';
28
+ isForfeited?: boolean;
29
+ forfeitedBy?: number;
30
+ forfeitReason?: string;
31
+ player1Raw?: {
32
+ teamId: number;
33
+ teamName: string;
34
+ logo?: string;
35
+ seed?: number;
36
+ };
37
+ player2Raw?: {
38
+ teamId: number;
39
+ teamName: string;
40
+ logo?: string;
41
+ seed?: number;
42
+ };
43
+ scheduledTime?: Date;
44
+ startedAt?: Date;
45
+ completedAt?: Date;
46
+ }
47
+ export interface BracketStructure {
48
+ roomId: number;
49
+ bracketType: 'single' | 'double' | 'swiss' | 'roundRobin';
50
+ totalParticipants: number;
51
+ totalRounds: number;
52
+ winnerBracket: BracketBackEnd[];
53
+ loserBracket?: BracketBackEnd[];
54
+ grandFinal?: BracketBackEnd;
55
+ grandFinalReset?: BracketBackEnd;
56
+ consolation?: BracketBackEnd;
57
+ currentRound: number;
58
+ isComplete: boolean;
59
+ championTeamId?: number;
60
+ runnerUpTeamId?: number;
61
+ thirdPlaceTeamId?: number;
11
62
  }
@@ -1,7 +1,21 @@
1
+ export declare type TournamentType = 'single' | 'double' | 'swiss' | 'roundRobin';
1
2
  export interface BracketConfig {
2
3
  _id?: string;
3
4
  name?: string;
4
5
  total?: number;
5
6
  ordered?: boolean;
6
7
  generated?: boolean;
8
+ bracketType?: TournamentType;
9
+ enableGrandFinalReset?: boolean;
10
+ enableConsolationBracket?: boolean;
11
+ consolationPlaces?: number;
12
+ swissRounds?: number;
13
+ roundRobinGroups?: number;
14
+ teamsAdvancingPerGroup?: number;
15
+ seedByRanking?: boolean;
16
+ randomSeed?: boolean;
17
+ byeHandling?: 'top_seed' | 'bottom_seed' | 'random';
18
+ bestOf?: number;
19
+ matchDurationMinutes?: number;
20
+ breakBetweenMatchesMinutes?: number;
7
21
  }
@@ -1,6 +1,15 @@
1
1
  import { ColorsUserInfo } from './colorsUserInfo.interface';
2
2
  import { Question } from './question.interface';
3
3
  import { UserBanners } from './userBanners.interface';
4
+ export interface CreatorSocialNetwork {
5
+ id: number;
6
+ socialId: number;
7
+ usuario: string;
8
+ url?: string;
9
+ nombre?: string;
10
+ icono?: string;
11
+ baseUrl?: string;
12
+ }
4
13
  export interface Creator {
5
14
  userInfoId: string;
6
15
  apellido: string;
@@ -17,4 +26,5 @@ export interface Creator {
17
26
  hasCode: boolean;
18
27
  codeAnswered: boolean;
19
28
  contact: string;
29
+ socialNetworks?: CreatorSocialNetwork[];
20
30
  }
@@ -1,3 +1,4 @@
1
+ import { GameDayStatus, QualificationRules } from './gameDayStatus.interface';
1
2
  export interface GameDay {
2
3
  _id?: string;
3
4
  id?: number;
@@ -11,4 +12,16 @@ export interface GameDay {
11
12
  ranked?: number;
12
13
  generated?: boolean;
13
14
  createdAt?: string;
15
+ status?: GameDayStatus;
16
+ closedAt?: string;
17
+ closedBy?: string;
18
+ finalizedAt?: string;
19
+ finalizedBy?: string;
20
+ reopenedAt?: string;
21
+ reopenedBy?: string;
22
+ qualificationRules?: QualificationRules;
23
+ totalParticipants?: number;
24
+ qualifiedCount?: number;
25
+ eliminatedCount?: number;
26
+ actionsExecuted?: boolean;
14
27
  }
@@ -0,0 +1,111 @@
1
+ /**
2
+ * GameDay Status - States for tournament game days
3
+ */
4
+ export declare enum GameDayStatus {
5
+ DRAFT = "draft",
6
+ OPEN = "open",
7
+ IN_PROGRESS = "in_progress",
8
+ PENDING_CLOSE = "pending_close",
9
+ CLOSED = "closed",
10
+ FINALIZED = "finalized",
11
+ REOPENED = "reopened"
12
+ }
13
+ /**
14
+ * Qualification Action Types
15
+ */
16
+ export declare enum QualifiedActionType {
17
+ STAY = "stay",
18
+ MOVE_TO_ROOM = "move_to_room",
19
+ EXCLUDE_NEXT = "exclude_next",
20
+ EXCLUDE_BRACKET = "exclude_bracket"
21
+ }
22
+ export declare enum EliminatedActionType {
23
+ ALLOW_REENTRY = "allow_reentry",
24
+ EXCLUDE = "exclude",
25
+ MOVE_TO_ROOM = "move_to_room"
26
+ }
27
+ /**
28
+ * Qualification Rules Configuration
29
+ */
30
+ export interface QualificationRules {
31
+ enabled: boolean;
32
+ qualifyTop: number;
33
+ qualifyByPoints?: number;
34
+ qualifiedAction: QualifiedActionType;
35
+ qualifiedTargetRoomId?: string;
36
+ qualifiedTargetRoomName?: string;
37
+ eliminatedAction: EliminatedActionType;
38
+ eliminatedTargetRoomId?: string;
39
+ allowReentry: boolean;
40
+ autoExecute: boolean;
41
+ gracePeriodMinutes: number;
42
+ }
43
+ /**
44
+ * Participant Status per GameDay
45
+ */
46
+ export declare enum ParticipantGameDayStatus {
47
+ ACTIVE = "active",
48
+ QUALIFIED = "qualified",
49
+ ELIMINATED = "eliminated",
50
+ PROMOTED = "promoted",
51
+ RELEGATED = "relegated",
52
+ PENDING = "pending"
53
+ }
54
+ export interface ParticipantGameDayState {
55
+ participantId: number;
56
+ teamId: number;
57
+ teamName: string;
58
+ roomId: number;
59
+ gameDayId: string;
60
+ status: ParticipantGameDayStatus;
61
+ qualifiedPosition?: number;
62
+ points?: number;
63
+ nextAction?: QualifiedActionType | EliminatedActionType;
64
+ targetRoomId?: string;
65
+ actionExecuted: boolean;
66
+ actionExecutedAt?: Date;
67
+ createdAt: Date;
68
+ updatedAt: Date;
69
+ }
70
+ /**
71
+ * Pending Qualification Action
72
+ */
73
+ export interface QualificationAction {
74
+ id: number;
75
+ roomId: number;
76
+ gameDayId: string;
77
+ participantId: number;
78
+ teamId: number;
79
+ teamName: string;
80
+ actionType: QualifiedActionType | EliminatedActionType;
81
+ targetRoomId?: string;
82
+ status: 'pending' | 'executed' | 'cancelled' | 'failed';
83
+ position?: number;
84
+ points?: number;
85
+ executedAt?: Date;
86
+ executedBy?: string;
87
+ failureReason?: string;
88
+ createdAt: Date;
89
+ }
90
+ /**
91
+ * GameDay State Transition Result
92
+ */
93
+ export interface GameDayTransitionResult {
94
+ success: boolean;
95
+ previousStatus: GameDayStatus;
96
+ newStatus: GameDayStatus;
97
+ message: string;
98
+ requiresConfirmation?: boolean;
99
+ dependencies?: {
100
+ hasPromotedPlayers: boolean;
101
+ promotedPlayersCount: number;
102
+ hasNextBracketGenerated: boolean;
103
+ hasPrizesDistributed: boolean;
104
+ };
105
+ affectedParticipants?: ParticipantGameDayState[];
106
+ pendingActions?: QualificationAction[];
107
+ }
108
+ /**
109
+ * Default Qualification Rules
110
+ */
111
+ export declare const DEFAULT_QUALIFICATION_RULES: QualificationRules;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_QUALIFICATION_RULES = exports.ParticipantGameDayStatus = exports.EliminatedActionType = exports.QualifiedActionType = exports.GameDayStatus = void 0;
4
+ /**
5
+ * GameDay Status - States for tournament game days
6
+ */
7
+ var GameDayStatus;
8
+ (function (GameDayStatus) {
9
+ GameDayStatus["DRAFT"] = "draft";
10
+ GameDayStatus["OPEN"] = "open";
11
+ GameDayStatus["IN_PROGRESS"] = "in_progress";
12
+ GameDayStatus["PENDING_CLOSE"] = "pending_close";
13
+ GameDayStatus["CLOSED"] = "closed";
14
+ GameDayStatus["FINALIZED"] = "finalized";
15
+ GameDayStatus["REOPENED"] = "reopened"; // Reopened (special case)
16
+ })(GameDayStatus = exports.GameDayStatus || (exports.GameDayStatus = {}));
17
+ /**
18
+ * Qualification Action Types
19
+ */
20
+ var QualifiedActionType;
21
+ (function (QualifiedActionType) {
22
+ QualifiedActionType["STAY"] = "stay";
23
+ QualifiedActionType["MOVE_TO_ROOM"] = "move_to_room";
24
+ QualifiedActionType["EXCLUDE_NEXT"] = "exclude_next";
25
+ QualifiedActionType["EXCLUDE_BRACKET"] = "exclude_bracket"; // Exclude from next bracket generation
26
+ })(QualifiedActionType = exports.QualifiedActionType || (exports.QualifiedActionType = {}));
27
+ var EliminatedActionType;
28
+ (function (EliminatedActionType) {
29
+ EliminatedActionType["ALLOW_REENTRY"] = "allow_reentry";
30
+ EliminatedActionType["EXCLUDE"] = "exclude";
31
+ EliminatedActionType["MOVE_TO_ROOM"] = "move_to_room"; // Move to consolation room
32
+ })(EliminatedActionType = exports.EliminatedActionType || (exports.EliminatedActionType = {}));
33
+ /**
34
+ * Participant Status per GameDay
35
+ */
36
+ var ParticipantGameDayStatus;
37
+ (function (ParticipantGameDayStatus) {
38
+ ParticipantGameDayStatus["ACTIVE"] = "active";
39
+ ParticipantGameDayStatus["QUALIFIED"] = "qualified";
40
+ ParticipantGameDayStatus["ELIMINATED"] = "eliminated";
41
+ ParticipantGameDayStatus["PROMOTED"] = "promoted";
42
+ ParticipantGameDayStatus["RELEGATED"] = "relegated";
43
+ ParticipantGameDayStatus["PENDING"] = "pending";
44
+ })(ParticipantGameDayStatus = exports.ParticipantGameDayStatus || (exports.ParticipantGameDayStatus = {}));
45
+ /**
46
+ * Default Qualification Rules
47
+ */
48
+ exports.DEFAULT_QUALIFICATION_RULES = {
49
+ enabled: false,
50
+ qualifyTop: 0,
51
+ qualifiedAction: QualifiedActionType.STAY,
52
+ eliminatedAction: EliminatedActionType.ALLOW_REENTRY,
53
+ allowReentry: true,
54
+ autoExecute: false,
55
+ gracePeriodMinutes: 60
56
+ };
@@ -71,6 +71,8 @@ export * from './requestStates.enum';
71
71
  export * from './awardNew.interface';
72
72
  export * from './awardType.enum';
73
73
  export * from './bracketBackend.interface';
74
+ export * from './bracketConfig.interface';
74
75
  export * from './wallet.interface';
75
76
  export * from './imageGallery.interface';
77
+ export * from './gameDayStatus.interface';
76
78
  export * from './gameDay.interface';
@@ -83,6 +83,8 @@ __exportStar(require("./requestStates.enum"), exports);
83
83
  __exportStar(require("./awardNew.interface"), exports);
84
84
  __exportStar(require("./awardType.enum"), exports);
85
85
  __exportStar(require("./bracketBackend.interface"), exports);
86
+ __exportStar(require("./bracketConfig.interface"), exports);
86
87
  __exportStar(require("./wallet.interface"), exports);
87
88
  __exportStar(require("./imageGallery.interface"), exports);
89
+ __exportStar(require("./gameDayStatus.interface"), exports);
88
90
  __exportStar(require("./gameDay.interface"), exports);
@@ -4,6 +4,7 @@ import { BracketConfig } from "./bracketConfig.interface";
4
4
  import { ConfigRoom } from "./config.interface";
5
5
  import { Game } from "./game.interface";
6
6
  import { GameDay } from "./gameDay.interface";
7
+ import { QualificationRules } from "./gameDayStatus.interface";
7
8
  import { GameMode } from "./gamemode.interface";
8
9
  import { Platform } from "./platform.interface";
9
10
  import { Points } from "./points.interface";
@@ -81,6 +82,7 @@ export interface Room {
81
82
  welcomeMsgMatch: string;
82
83
  welcomeMsgRoom: string;
83
84
  price: number;
85
+ priceCurrency?: string;
84
86
  online: boolean;
85
87
  userInfo?: UserInfo;
86
88
  streaming: Streaming;
@@ -104,4 +106,5 @@ export interface Room {
104
106
  gameDay?: GameDay;
105
107
  bannerImageUrl?: string;
106
108
  showOpponentInInvitation?: boolean;
109
+ qualificationRules?: QualificationRules;
107
110
  }
@@ -1,18 +1,59 @@
1
1
  import { GameDay } from "./gameDay.interface";
2
+ import { BracketMatchType } from "./bracketBackend.interface";
2
3
  export interface TournamentRound {
3
- roomId: string;
4
- round: string;
5
- match: string;
6
- player1: string;
7
- player2: string;
4
+ id?: number;
5
+ roomId: string | number;
6
+ round: string | number;
7
+ match: string | number;
8
+ player1: string | number | null;
9
+ player2: string | number | null;
10
+ player1Raw?: {
11
+ teamId: number;
12
+ teamName: string;
13
+ logo?: string;
14
+ seed?: number;
15
+ };
16
+ player2Raw?: {
17
+ teamId: number;
18
+ teamName: string;
19
+ logo?: string;
20
+ seed?: number;
21
+ };
8
22
  win: {
9
- round: string;
10
- match: string;
23
+ round: string | number;
24
+ match: string | number;
25
+ bracketType?: BracketMatchType;
11
26
  };
12
27
  loss: {
13
- round: string;
14
- match: string;
28
+ round: string | number;
29
+ match: string | number;
30
+ bracketType?: BracketMatchType;
15
31
  };
16
32
  created: boolean;
17
33
  gameDay: GameDay;
34
+ bracketType?: BracketMatchType;
35
+ status?: 'pending' | 'in_progress' | 'completed' | 'forfeited' | 'bye';
36
+ isBye?: boolean;
37
+ isForfeited?: boolean;
38
+ forfeitedBy?: number;
39
+ forfeitReason?: string;
40
+ player1Score?: number;
41
+ player2Score?: number;
42
+ winnerId?: number;
43
+ loserId?: number;
44
+ manualScore1?: number;
45
+ manualScore2?: number;
46
+ isManuallyEdited?: boolean;
47
+ editedBy?: string;
48
+ editedAt?: Date;
49
+ previousResult?: {
50
+ player1Score?: number;
51
+ player2Score?: number;
52
+ winnerId?: number;
53
+ loserId?: number;
54
+ status?: string;
55
+ };
56
+ matchId?: number;
57
+ createdAt?: Date;
58
+ updatedAt?: Date;
18
59
  }
@@ -11,5 +11,13 @@ export declare enum Matchestopics {
11
11
  matchTournamentDelete = "match.tournament.delete",
12
12
  matchTournamentDeleted = "match.tournament.deleted",
13
13
  matchTournamentUpdate = "match.tournament.update",
14
- matchTournamentUpdated = "match.tournament.updated"
14
+ matchTournamentUpdated = "match.tournament.updated",
15
+ bracketGenerated = "bracket.generated",
16
+ bracketUpdated = "bracket.updated",
17
+ bracketMatchCompleted = "bracket.match.completed",
18
+ bracketForfeit = "bracket.forfeit",
19
+ bracketRollback = "bracket.rollback",
20
+ bracketByeAdvanced = "bracket.bye.advanced",
21
+ bracketGrandFinalReset = "bracket.grandfinal.reset",
22
+ bracketCompleted = "bracket.completed"
15
23
  }
@@ -16,4 +16,13 @@ var Matchestopics;
16
16
  Matchestopics["matchTournamentDeleted"] = "match.tournament.deleted";
17
17
  Matchestopics["matchTournamentUpdate"] = "match.tournament.update";
18
18
  Matchestopics["matchTournamentUpdated"] = "match.tournament.updated";
19
+ // Bracket events
20
+ Matchestopics["bracketGenerated"] = "bracket.generated";
21
+ Matchestopics["bracketUpdated"] = "bracket.updated";
22
+ Matchestopics["bracketMatchCompleted"] = "bracket.match.completed";
23
+ Matchestopics["bracketForfeit"] = "bracket.forfeit";
24
+ Matchestopics["bracketRollback"] = "bracket.rollback";
25
+ Matchestopics["bracketByeAdvanced"] = "bracket.bye.advanced";
26
+ Matchestopics["bracketGrandFinalReset"] = "bracket.grandfinal.reset";
27
+ Matchestopics["bracketCompleted"] = "bracket.completed";
19
28
  })(Matchestopics = exports.Matchestopics || (exports.Matchestopics = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamelobby/common",
3
- "version": "1.0.372",
3
+ "version": "1.0.373",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",