@mshowes/brackets-manager 1.8.1
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/LICENSE +21 -0
- package/README.md +82 -0
- package/dist/base/getter.d.ts +272 -0
- package/dist/base/getter.d.ts.map +1 -0
- package/dist/base/getter.js +545 -0
- package/dist/base/getter.js.map +1 -0
- package/dist/base/stage/creator.d.ts +269 -0
- package/dist/base/stage/creator.d.ts.map +1 -0
- package/dist/base/stage/creator.js +735 -0
- package/dist/base/stage/creator.js.map +1 -0
- package/dist/base/updater.d.ts +121 -0
- package/dist/base/updater.d.ts.map +1 -0
- package/dist/base/updater.js +323 -0
- package/dist/base/updater.js.map +1 -0
- package/dist/create.d.ts +25 -0
- package/dist/create.d.ts.map +1 -0
- package/dist/create.js +55 -0
- package/dist/create.js.map +1 -0
- package/dist/delete.d.ts +33 -0
- package/dist/delete.d.ts.map +1 -0
- package/dist/delete.js +57 -0
- package/dist/delete.js.map +1 -0
- package/dist/find.d.ts +60 -0
- package/dist/find.d.ts.map +1 -0
- package/dist/find.js +196 -0
- package/dist/find.js.map +1 -0
- package/dist/get.d.ts +121 -0
- package/dist/get.d.ts.map +1 -0
- package/dist/get.js +420 -0
- package/dist/get.js.map +1 -0
- package/dist/helpers.d.ts +804 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +1897 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/manager.d.ts +60 -0
- package/dist/manager.d.ts.map +1 -0
- package/dist/manager.js +189 -0
- package/dist/manager.js.map +1 -0
- package/dist/ordering.d.ts +7 -0
- package/dist/ordering.d.ts.map +1 -0
- package/dist/ordering.js +147 -0
- package/dist/ordering.js.map +1 -0
- package/dist/reset.d.ts +27 -0
- package/dist/reset.d.ts.map +1 -0
- package/dist/reset.js +82 -0
- package/dist/reset.js.map +1 -0
- package/dist/types.d.ts +260 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/update.d.ts +111 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +265 -0
- package/dist/update.js.map +1 -0
- package/package.json +67 -0
package/dist/update.js
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Update = void 0;
|
|
4
|
+
const brackets_model_1 = require("brackets-model");
|
|
5
|
+
const ordering_1 = require("./ordering");
|
|
6
|
+
const updater_1 = require("./base/updater");
|
|
7
|
+
const helpers = require("./helpers");
|
|
8
|
+
class Update extends updater_1.BaseUpdater {
|
|
9
|
+
/**
|
|
10
|
+
* Updates partial information of a match. Its id must be given.
|
|
11
|
+
*
|
|
12
|
+
* This will update related matches accordingly.
|
|
13
|
+
*
|
|
14
|
+
* @param match Values to change in a match.
|
|
15
|
+
*/
|
|
16
|
+
async match(match) {
|
|
17
|
+
if (match.id === undefined)
|
|
18
|
+
throw Error('No match id given.');
|
|
19
|
+
const stored = await this.storage.select('match', match.id);
|
|
20
|
+
if (!stored)
|
|
21
|
+
throw Error('Match not found.');
|
|
22
|
+
await this.updateMatch(stored, match);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Updates partial information of a match game. Its id must be given.
|
|
26
|
+
*
|
|
27
|
+
* This will update the parent match accordingly.
|
|
28
|
+
*
|
|
29
|
+
* @param game Values to change in a match game.
|
|
30
|
+
*/
|
|
31
|
+
async matchGame(game) {
|
|
32
|
+
const stored = await this.findMatchGame(game);
|
|
33
|
+
await this.updateMatchGame(stored, game);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Updates the seed ordering of every ordered round in a stage.
|
|
37
|
+
*
|
|
38
|
+
* @param stageId ID of the stage.
|
|
39
|
+
* @param seedOrdering A list of ordering methods.
|
|
40
|
+
*/
|
|
41
|
+
async ordering(stageId, seedOrdering) {
|
|
42
|
+
const stage = await this.storage.select('stage', stageId);
|
|
43
|
+
if (!stage)
|
|
44
|
+
throw Error('Stage not found.');
|
|
45
|
+
helpers.ensureNotRoundRobin(stage);
|
|
46
|
+
const roundsToOrder = await this.getOrderedRounds(stage);
|
|
47
|
+
if (seedOrdering.length !== roundsToOrder.length)
|
|
48
|
+
throw Error('The count of seed orderings is incorrect.');
|
|
49
|
+
for (let i = 0; i < roundsToOrder.length; i++)
|
|
50
|
+
await this.updateRoundOrdering(roundsToOrder[i], seedOrdering[i]);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Updates the seed ordering of a round.
|
|
54
|
+
*
|
|
55
|
+
* @param roundId ID of the round.
|
|
56
|
+
* @param method Seed ordering method.
|
|
57
|
+
*/
|
|
58
|
+
async roundOrdering(roundId, method) {
|
|
59
|
+
const round = await this.storage.select('round', roundId);
|
|
60
|
+
if (!round)
|
|
61
|
+
throw Error('This round does not exist.');
|
|
62
|
+
const stage = await this.storage.select('stage', round.stage_id);
|
|
63
|
+
if (!stage)
|
|
64
|
+
throw Error('Stage not found.');
|
|
65
|
+
helpers.ensureNotRoundRobin(stage);
|
|
66
|
+
await this.updateRoundOrdering(round, method);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Updates child count of all matches of a given level.
|
|
70
|
+
*
|
|
71
|
+
* @param level The level at which to act.
|
|
72
|
+
* @param id ID of the chosen level.
|
|
73
|
+
* @param childCount The target child count.
|
|
74
|
+
*/
|
|
75
|
+
async matchChildCount(level, id, childCount) {
|
|
76
|
+
switch (level) {
|
|
77
|
+
case 'stage':
|
|
78
|
+
await this.updateStageMatchChildCount(id, childCount);
|
|
79
|
+
break;
|
|
80
|
+
case 'group':
|
|
81
|
+
await this.updateGroupMatchChildCount(id, childCount);
|
|
82
|
+
break;
|
|
83
|
+
case 'round':
|
|
84
|
+
await this.updateRoundMatchChildCount(id, childCount);
|
|
85
|
+
break;
|
|
86
|
+
case 'match':
|
|
87
|
+
const match = await this.storage.select('match', id);
|
|
88
|
+
if (!match)
|
|
89
|
+
throw Error('Match not found.');
|
|
90
|
+
await this.adjustMatchChildGames(match, childCount);
|
|
91
|
+
break;
|
|
92
|
+
default:
|
|
93
|
+
throw Error('Unknown child count level.');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Updates the seeding of a stage.
|
|
98
|
+
*
|
|
99
|
+
* @param stageId ID of the stage.
|
|
100
|
+
* @param seeding The new seeding.
|
|
101
|
+
* @param keepSameSize Whether to keep the same size as before for the stage. **Default:** false.
|
|
102
|
+
*/
|
|
103
|
+
async seeding(stageId, seeding, keepSameSize = false) {
|
|
104
|
+
await this.updateSeeding(stageId, { seeding }, keepSameSize);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Updates the seeding of a stage (with a list of IDs).
|
|
108
|
+
*
|
|
109
|
+
* @param stageId ID of the stage.
|
|
110
|
+
* @param seedingIds The new seeding, containing only IDs.
|
|
111
|
+
* @param keepSameSize Whether to keep the same size as before for the stage. **Default:** false.
|
|
112
|
+
*/
|
|
113
|
+
async seedingIds(stageId, seedingIds, keepSameSize = false) {
|
|
114
|
+
await this.updateSeeding(stageId, { seedingIds }, keepSameSize);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Confirms the seeding of a stage.
|
|
118
|
+
*
|
|
119
|
+
* This will convert TBDs to BYEs and propagate them.
|
|
120
|
+
*
|
|
121
|
+
* @param stageId ID of the stage.
|
|
122
|
+
*/
|
|
123
|
+
async confirmSeeding(stageId) {
|
|
124
|
+
await this.confirmCurrentSeeding(stageId);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Update the seed ordering of a round.
|
|
128
|
+
*
|
|
129
|
+
* @param round The round of which to update the ordering.
|
|
130
|
+
* @param method The new ordering method.
|
|
131
|
+
*/
|
|
132
|
+
async updateRoundOrdering(round, method) {
|
|
133
|
+
const matches = await this.storage.select('match', {
|
|
134
|
+
round_id: round.id,
|
|
135
|
+
});
|
|
136
|
+
if (!matches)
|
|
137
|
+
throw Error('This round has no match.');
|
|
138
|
+
if (matches.some((match) => match.status > brackets_model_1.Status.Ready))
|
|
139
|
+
throw Error('At least one match has started or is completed.');
|
|
140
|
+
const stage = await this.storage.select('stage', round.stage_id);
|
|
141
|
+
if (!stage)
|
|
142
|
+
throw Error('Stage not found.');
|
|
143
|
+
if (stage.settings.size === undefined)
|
|
144
|
+
throw Error('Undefined stage size.');
|
|
145
|
+
const group = await this.storage.select('group', round.group_id);
|
|
146
|
+
if (!group)
|
|
147
|
+
throw Error('Group not found.');
|
|
148
|
+
const inLoserBracket = helpers.isLoserBracket(stage.type, group.number);
|
|
149
|
+
const roundCountLB = helpers.getLowerBracketRoundCount(stage.settings.size);
|
|
150
|
+
const seeds = helpers.getSeeds(inLoserBracket, round.number, roundCountLB, matches.length);
|
|
151
|
+
const positions = ordering_1.ordering[method](seeds);
|
|
152
|
+
await this.applyRoundOrdering(round.number, matches, positions);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Updates child count of all matches of a stage.
|
|
156
|
+
*
|
|
157
|
+
* @param stageId ID of the stage.
|
|
158
|
+
* @param childCount The target child count.
|
|
159
|
+
*/
|
|
160
|
+
async updateStageMatchChildCount(stageId, childCount) {
|
|
161
|
+
if (!(await this.storage.update('match', { stage_id: stageId }, { child_count: childCount })))
|
|
162
|
+
throw Error('Could not update the match.');
|
|
163
|
+
const matches = await this.storage.select('match', {
|
|
164
|
+
stage_id: stageId,
|
|
165
|
+
});
|
|
166
|
+
if (!matches)
|
|
167
|
+
throw Error('This stage has no match.');
|
|
168
|
+
for (const match of matches)
|
|
169
|
+
await this.adjustMatchChildGames(match, childCount);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Updates child count of all matches of a group.
|
|
173
|
+
*
|
|
174
|
+
* @param groupId ID of the group.
|
|
175
|
+
* @param childCount The target child count.
|
|
176
|
+
*/
|
|
177
|
+
async updateGroupMatchChildCount(groupId, childCount) {
|
|
178
|
+
if (!(await this.storage.update('match', { group_id: groupId }, { child_count: childCount })))
|
|
179
|
+
throw Error('Could not update the match.');
|
|
180
|
+
const matches = await this.storage.select('match', {
|
|
181
|
+
group_id: groupId,
|
|
182
|
+
});
|
|
183
|
+
if (!matches)
|
|
184
|
+
throw Error('This group has no match.');
|
|
185
|
+
for (const match of matches)
|
|
186
|
+
await this.adjustMatchChildGames(match, childCount);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Updates child count of all matches of a round.
|
|
190
|
+
*
|
|
191
|
+
* @param roundId ID of the round.
|
|
192
|
+
* @param childCount The target child count.
|
|
193
|
+
*/
|
|
194
|
+
async updateRoundMatchChildCount(roundId, childCount) {
|
|
195
|
+
if (!(await this.storage.update('match', { round_id: roundId }, { child_count: childCount })))
|
|
196
|
+
throw Error('Could not update the match.');
|
|
197
|
+
const matches = await this.storage.select('match', {
|
|
198
|
+
round_id: roundId,
|
|
199
|
+
});
|
|
200
|
+
if (!matches)
|
|
201
|
+
throw Error('This round has no match.');
|
|
202
|
+
for (const match of matches)
|
|
203
|
+
await this.adjustMatchChildGames(match, childCount);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Updates the ordering of participants in a round's matches.
|
|
207
|
+
*
|
|
208
|
+
* @param roundNumber The number of the round.
|
|
209
|
+
* @param matches The matches of the round.
|
|
210
|
+
* @param positions The new positions.
|
|
211
|
+
*/
|
|
212
|
+
async applyRoundOrdering(roundNumber, matches, positions) {
|
|
213
|
+
for (const match of matches) {
|
|
214
|
+
const updated = { ...match };
|
|
215
|
+
updated.opponent1 = helpers.findPosition(matches, positions.shift());
|
|
216
|
+
// The only rounds where we have a second ordered participant are first rounds of brackets (upper and lower).
|
|
217
|
+
if (roundNumber === 1) {
|
|
218
|
+
updated.opponent2 = helpers.findPosition(matches, positions.shift());
|
|
219
|
+
}
|
|
220
|
+
if (!(await this.storage.update('match', updated.id, updated)))
|
|
221
|
+
throw Error('Could not update the match.');
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Adds or deletes match games of a match based on a target child count.
|
|
226
|
+
*
|
|
227
|
+
* @param match The match of which child games need to be adjusted.
|
|
228
|
+
* @param targetChildCount The target child count.
|
|
229
|
+
*/
|
|
230
|
+
async adjustMatchChildGames(match, targetChildCount) {
|
|
231
|
+
const games = await this.storage.select('match_game', {
|
|
232
|
+
parent_id: match.id,
|
|
233
|
+
});
|
|
234
|
+
let childCount = games ? games.length : 0;
|
|
235
|
+
while (childCount < targetChildCount) {
|
|
236
|
+
const id = await this.storage.insert('match_game', {
|
|
237
|
+
number: childCount + 1,
|
|
238
|
+
stage_id: match.stage_id,
|
|
239
|
+
parent_id: match.id,
|
|
240
|
+
status: match.status,
|
|
241
|
+
opponent1: { id: null },
|
|
242
|
+
opponent2: { id: null },
|
|
243
|
+
});
|
|
244
|
+
if (id === -1)
|
|
245
|
+
throw Error('Could not adjust the match games when inserting.');
|
|
246
|
+
childCount++;
|
|
247
|
+
}
|
|
248
|
+
while (childCount > targetChildCount) {
|
|
249
|
+
const deleted = await this.storage.delete('match_game', {
|
|
250
|
+
parent_id: match.id,
|
|
251
|
+
number: childCount,
|
|
252
|
+
});
|
|
253
|
+
if (!deleted)
|
|
254
|
+
throw Error('Could not adjust the match games when deleting.');
|
|
255
|
+
childCount--;
|
|
256
|
+
}
|
|
257
|
+
if (!(await this.storage.update('match', match.id, {
|
|
258
|
+
...match,
|
|
259
|
+
child_count: targetChildCount,
|
|
260
|
+
})))
|
|
261
|
+
throw Error('Could not update the match.');
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
exports.Update = Update;
|
|
265
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../src/update.ts"],"names":[],"mappings":";;;AAAA,mDASwB;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AK,CAAC,EAAE;gBACnB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;gBACvB,SAAS,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;aAC1B,CAAC,CAAC;YAEH,IAAI,EAAE,KAAK,CAAC,CAAC;gBACT,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;YAEpE,UAAU,EAAE,CAAC;SAChB;QAED,OAAO,UAAU,GAAG,gBAAgB,EAAE;YAClC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE;gBACpD,SAAS,EAAE,KAAK,CAAC,EAAE;gBACnB,MAAM,EAAE,UAAU;aACrB,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO;gBACR,MAAM,KAAK,CAAC,iDAAiD,CAAC,CAAC;YAEnE,UAAU,EAAE,CAAC;SAChB;QAED,IACI,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE;YAC3C,GAAG,KAAK;YACR,WAAW,EAAE,gBAAgB;SAChC,CAAC,CAAC;YAEH,MAAM,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACnD,CAAC;CACJ;AAvWD,wBAuWC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mshowes/brackets-manager",
|
|
3
|
+
"version": "1.8.1",
|
|
4
|
+
"description": "A simple library to manage tournament brackets (round-robin, single elimination, double elimination)",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=14"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"brackets-model": "^1.6.0",
|
|
15
|
+
"uuid": "^9.0.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"brackets-drizzle-db": "^2.1.0",
|
|
19
|
+
"@types/chai": "^4.3.3",
|
|
20
|
+
"@types/mocha": "^9.1.1",
|
|
21
|
+
"@types/node": "18.11.9",
|
|
22
|
+
"@types/uuid": "^9.0.2",
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^5.42.0",
|
|
24
|
+
"@typescript-eslint/parser": "^5.42.0",
|
|
25
|
+
"brackets-json-db": "1.0.2",
|
|
26
|
+
"brackets-memory-db": "^1.0.4",
|
|
27
|
+
"chai": "^4.3.6",
|
|
28
|
+
"chai-as-promised": "^7.1.1",
|
|
29
|
+
"eslint": "^8.26.0",
|
|
30
|
+
"eslint-plugin-jsdoc": "^39.6.2",
|
|
31
|
+
"json-server": "^0.17.1",
|
|
32
|
+
"mocha": "10.1.0",
|
|
33
|
+
"mocha-each": "^2.0.1",
|
|
34
|
+
"nyc": "^15.1.0",
|
|
35
|
+
"typescript": "^4.8.4"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"javascript",
|
|
39
|
+
"typescript",
|
|
40
|
+
"tournament",
|
|
41
|
+
"brackets",
|
|
42
|
+
"manager",
|
|
43
|
+
"database"
|
|
44
|
+
],
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/Drarig29/brackets-manager.js.git"
|
|
48
|
+
},
|
|
49
|
+
"author": "Corentin Girard",
|
|
50
|
+
"license": "ISC",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/Drarig29/brackets-manager.js/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://github.com/Drarig29/brackets-manager.js#readme",
|
|
55
|
+
"volta": {
|
|
56
|
+
"node": "14.21.3",
|
|
57
|
+
"npm": "7.24.2"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"lint": "eslint '**/*.{js,ts}' --fix",
|
|
61
|
+
"test": "mocha 'test/**/*.spec.js'",
|
|
62
|
+
"db": "json-server --watch db.json",
|
|
63
|
+
"start": "tsc --watch",
|
|
64
|
+
"build": "tsc",
|
|
65
|
+
"coverage": "nyc -r text -r lcov npm test"
|
|
66
|
+
}
|
|
67
|
+
}
|