tods-competition-factory 0.149.0 → 0.152.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/tods-competition-factory.development.cjs.js +101 -70
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/dist/tods-competition-factory.production.esm.min.js +1 -1
- package/dist/tods-competition-factory.production.esm.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.152.0';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
function isPowerOf2(n) {
|
|
@@ -8986,6 +8986,9 @@ function updateTieFormat({
|
|
|
8986
8986
|
error: MISSING_DRAW_DEFINITION
|
|
8987
8987
|
};
|
|
8988
8988
|
}
|
|
8989
|
+
|
|
8990
|
+
return { ...SUCCESS
|
|
8991
|
+
};
|
|
8989
8992
|
}
|
|
8990
8993
|
|
|
8991
8994
|
function updateStructureMatchUps$1({
|
|
@@ -46803,8 +46806,17 @@ function getTieMatchUpContext({
|
|
|
46803
46806
|
drawDefinition,
|
|
46804
46807
|
matchUpsMap
|
|
46805
46808
|
});
|
|
46809
|
+
const {
|
|
46810
|
+
matchUp: inContextDualMatchUp
|
|
46811
|
+
} = findMatchUp$1({
|
|
46812
|
+
matchUpId: matchUpTieId,
|
|
46813
|
+
inContext: true,
|
|
46814
|
+
drawDefinition,
|
|
46815
|
+
matchUpsMap
|
|
46816
|
+
});
|
|
46806
46817
|
const tieFormat = dualMatchUp.tieFormat || structure.tieFormat || drawDefinition.tieFormat || event.tieFormat || undefined;
|
|
46807
46818
|
return {
|
|
46819
|
+
inContextDualMatchUp,
|
|
46808
46820
|
relevantAssignments,
|
|
46809
46821
|
collectionPosition,
|
|
46810
46822
|
teamParticipants,
|
|
@@ -46833,6 +46845,7 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
46833
46845
|
error: MISSING_PARTICIPANT_ID
|
|
46834
46846
|
};
|
|
46835
46847
|
const {
|
|
46848
|
+
inContextDualMatchUp,
|
|
46836
46849
|
relevantAssignments,
|
|
46837
46850
|
collectionPosition,
|
|
46838
46851
|
teamParticipants,
|
|
@@ -46904,6 +46917,14 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
46904
46917
|
};
|
|
46905
46918
|
|
|
46906
46919
|
if (!((_dualMatchUp$sides = dualMatchUp.sides) !== null && _dualMatchUp$sides !== void 0 && _dualMatchUp$sides.length)) {
|
|
46920
|
+
const {
|
|
46921
|
+
extension
|
|
46922
|
+
} = findExtension$1({
|
|
46923
|
+
element: drawDefinition,
|
|
46924
|
+
name: LINEUPS
|
|
46925
|
+
});
|
|
46926
|
+
const lineUps = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
|
|
46927
|
+
|
|
46907
46928
|
const extractSideDetail = ({
|
|
46908
46929
|
displaySideNumber,
|
|
46909
46930
|
drawPosition,
|
|
@@ -46914,11 +46935,12 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
46914
46935
|
displaySideNumber
|
|
46915
46936
|
});
|
|
46916
46937
|
|
|
46917
|
-
dualMatchUp.sides =
|
|
46918
|
-
|
|
46919
|
-
|
|
46920
|
-
|
|
46921
|
-
|
|
46938
|
+
dualMatchUp.sides = inContextDualMatchUp.sides.map(side => {
|
|
46939
|
+
const participantId = side.participantId;
|
|
46940
|
+
return { ...extractSideDetail(side),
|
|
46941
|
+
lineUp: participantId && lineUps[participantId] || []
|
|
46942
|
+
};
|
|
46943
|
+
});
|
|
46922
46944
|
}
|
|
46923
46945
|
|
|
46924
46946
|
const dualMatchUpSide = dualMatchUp.sides.find(side => side.sideNumber === sideNumber);
|
|
@@ -47114,34 +47136,8 @@ function updateLineUp({
|
|
|
47114
47136
|
});
|
|
47115
47137
|
}
|
|
47116
47138
|
|
|
47117
|
-
function findLineUpWithParticipantIds({
|
|
47118
|
-
drawDefinition,
|
|
47119
|
-
participantIds
|
|
47120
|
-
}) {
|
|
47121
|
-
if (typeof drawDefinition !== 'object') return {
|
|
47122
|
-
error: MISSING_DRAW_DEFINITION
|
|
47123
|
-
};
|
|
47124
|
-
if (!Array.isArray(participantIds)) return {
|
|
47125
|
-
error: INVALID_PARTICIPANT_IDS
|
|
47126
|
-
};
|
|
47127
|
-
const {
|
|
47128
|
-
extension
|
|
47129
|
-
} = findExtension$1({
|
|
47130
|
-
element: drawDefinition,
|
|
47131
|
-
name: LINEUPS
|
|
47132
|
-
});
|
|
47133
|
-
const lineUps = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
|
|
47134
|
-
const keys = Object.keys(lineUps);
|
|
47135
|
-
const teamParticipantId = keys === null || keys === void 0 ? void 0 : keys.find(teamParticipantId => lineUps[teamParticipantId].map(getParticipantId).some(id => participantIds.includes(id)));
|
|
47136
|
-
const lineUp = lineUps[teamParticipantId];
|
|
47137
|
-
return {
|
|
47138
|
-
lineUp,
|
|
47139
|
-
teamParticipantId
|
|
47140
|
-
};
|
|
47141
|
-
}
|
|
47142
|
-
|
|
47143
47139
|
function removeTieMatchUpParticipantId(params) {
|
|
47144
|
-
var _tieMatchUp$sides, _dualMatchUp$sides,
|
|
47140
|
+
var _tieMatchUp$sides, _inContextDualMatchUp, _inContextDualMatchUp2, _dualMatchUp$sides, _dualMatchUp$sides2;
|
|
47145
47141
|
|
|
47146
47142
|
const {
|
|
47147
47143
|
tournamentRecord,
|
|
@@ -47154,6 +47150,7 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
47154
47150
|
const matchUpContext = getTieMatchUpContext(params);
|
|
47155
47151
|
if (matchUpContext.error) return matchUpContext;
|
|
47156
47152
|
const {
|
|
47153
|
+
inContextDualMatchUp,
|
|
47157
47154
|
relevantAssignments,
|
|
47158
47155
|
collectionPosition,
|
|
47159
47156
|
teamParticipants,
|
|
@@ -47176,6 +47173,12 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
47176
47173
|
if (!side) return {
|
|
47177
47174
|
error: PARTICIPANT_NOT_FOUND
|
|
47178
47175
|
};
|
|
47176
|
+
const teamParticipantId = (_inContextDualMatchUp = inContextDualMatchUp.sides) === null || _inContextDualMatchUp === void 0 ? void 0 : (_inContextDualMatchUp2 = _inContextDualMatchUp.find(({
|
|
47177
|
+
sideNumber
|
|
47178
|
+
}) => sideNumber === side.sideNumber)) === null || _inContextDualMatchUp2 === void 0 ? void 0 : _inContextDualMatchUp2.participantId;
|
|
47179
|
+
if (!teamParticipantId) return {
|
|
47180
|
+
error: PARTICIPANT_NOT_FOUND
|
|
47181
|
+
};
|
|
47179
47182
|
const {
|
|
47180
47183
|
tournamentParticipants: [participantToRemove]
|
|
47181
47184
|
} = getTournamentParticipants({
|
|
@@ -47198,22 +47201,37 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
47198
47201
|
}
|
|
47199
47202
|
|
|
47200
47203
|
const participantIds = participantToRemove.participantType === INDIVIDUAL$1 ? [participantId] : participantToRemove.individualParticipantIds;
|
|
47201
|
-
|
|
47202
|
-
|
|
47203
|
-
|
|
47204
|
-
|
|
47205
|
-
|
|
47204
|
+
|
|
47205
|
+
if (!dualMatchUp.sides) {
|
|
47206
|
+
const {
|
|
47207
|
+
extension
|
|
47208
|
+
} = findExtension$1({
|
|
47209
|
+
element: drawDefinition,
|
|
47210
|
+
name: LINEUPS
|
|
47211
|
+
});
|
|
47212
|
+
const lineUps = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
|
|
47213
|
+
|
|
47214
|
+
const extractSideDetail = ({
|
|
47215
|
+
displaySideNumber,
|
|
47216
|
+
drawPosition,
|
|
47217
|
+
sideNumber
|
|
47218
|
+
}) => ({
|
|
47219
|
+
drawPosition,
|
|
47220
|
+
sideNumber,
|
|
47221
|
+
displaySideNumber
|
|
47222
|
+
});
|
|
47223
|
+
|
|
47224
|
+
dualMatchUp.sides = inContextDualMatchUp.sides.map(side => {
|
|
47225
|
+
const participantId = side.participantId;
|
|
47226
|
+
return { ...extractSideDetail(side),
|
|
47227
|
+
lineUp: participantId && lineUps[participantId] || []
|
|
47228
|
+
};
|
|
47229
|
+
});
|
|
47230
|
+
}
|
|
47231
|
+
|
|
47206
47232
|
let dualMatchUpSide = (_dualMatchUp$sides = dualMatchUp.sides) === null || _dualMatchUp$sides === void 0 ? void 0 : _dualMatchUp$sides.find(({
|
|
47207
47233
|
sideNumber
|
|
47208
47234
|
}) => sideNumber === side.sideNumber);
|
|
47209
|
-
const templateTeamLineUp = findLineUpWithParticipantIds({
|
|
47210
|
-
drawDefinition,
|
|
47211
|
-
participantIds
|
|
47212
|
-
});
|
|
47213
|
-
const teamParticipantId = (templateTeamLineUp === null || templateTeamLineUp === void 0 ? void 0 : templateTeamLineUp.teamParticipantId) || (teamParticipants === null || teamParticipants === void 0 ? void 0 : (_teamParticipants$fin = teamParticipants.find(participant => intersection((participant === null || participant === void 0 ? void 0 : participant.individualParticipantIds) || [], participantIds).length === participantIds.length)) === null || _teamParticipants$fin === void 0 ? void 0 : _teamParticipants$fin.participantId);
|
|
47214
|
-
if (!teamParticipantId) return {
|
|
47215
|
-
error: PARTICIPANT_NOT_FOUND
|
|
47216
|
-
};
|
|
47217
47235
|
|
|
47218
47236
|
if (!dualMatchUpSide && (((_dualMatchUp$sides2 = dualMatchUp.sides) === null || _dualMatchUp$sides2 === void 0 ? void 0 : _dualMatchUp$sides2.filter(({
|
|
47219
47237
|
lineUp
|
|
@@ -47230,9 +47248,6 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
47230
47248
|
teamParticipantId
|
|
47231
47249
|
};
|
|
47232
47250
|
});
|
|
47233
|
-
console.log({
|
|
47234
|
-
drawPositionMap
|
|
47235
|
-
});
|
|
47236
47251
|
dualMatchUpSide = (_dualMatchUp$sides3 = dualMatchUp.sides) === null || _dualMatchUp$sides3 === void 0 ? void 0 : _dualMatchUp$sides3.find(side => {
|
|
47237
47252
|
var _drawPositionMap$find;
|
|
47238
47253
|
|
|
@@ -47349,7 +47364,7 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
47349
47364
|
}
|
|
47350
47365
|
|
|
47351
47366
|
function replaceTieMatchUpParticipantId(params) {
|
|
47352
|
-
var _tieMatchUp$sides, _dualMatchUp$sides,
|
|
47367
|
+
var _tieMatchUp$sides, _dualMatchUp$sides, _inContextDualMatchUp, _inContextDualMatchUp2;
|
|
47353
47368
|
|
|
47354
47369
|
const matchUpContext = getTieMatchUpContext(params);
|
|
47355
47370
|
if (matchUpContext.error) return matchUpContext;
|
|
@@ -47363,8 +47378,8 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
47363
47378
|
error: MISSING_PARTICIPANT_ID
|
|
47364
47379
|
};
|
|
47365
47380
|
const {
|
|
47381
|
+
inContextDualMatchUp,
|
|
47366
47382
|
collectionPosition,
|
|
47367
|
-
teamParticipants,
|
|
47368
47383
|
collectionId,
|
|
47369
47384
|
dualMatchUp,
|
|
47370
47385
|
tieMatchUp,
|
|
@@ -47395,28 +47410,49 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
47395
47410
|
if (targetParticipants[0].participantType !== targetParticipants[1].participantType) return {
|
|
47396
47411
|
error: INVALID_PARTICIPANT_TYPE
|
|
47397
47412
|
};
|
|
47398
|
-
const
|
|
47413
|
+
const {
|
|
47414
|
+
extension
|
|
47415
|
+
} = findExtension$1({
|
|
47416
|
+
element: drawDefinition,
|
|
47417
|
+
name: LINEUPS
|
|
47418
|
+
});
|
|
47419
|
+
const lineUps = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
|
|
47420
|
+
|
|
47421
|
+
if (!((_dualMatchUp$sides = dualMatchUp.sides) !== null && _dualMatchUp$sides !== void 0 && _dualMatchUp$sides.length)) {
|
|
47422
|
+
const extractSideDetail = ({
|
|
47423
|
+
displaySideNumber,
|
|
47424
|
+
drawPosition,
|
|
47425
|
+
sideNumber
|
|
47426
|
+
}) => ({
|
|
47427
|
+
drawPosition,
|
|
47428
|
+
sideNumber,
|
|
47429
|
+
displaySideNumber
|
|
47430
|
+
});
|
|
47431
|
+
|
|
47432
|
+
dualMatchUp.sides = inContextDualMatchUp.sides.map(side => {
|
|
47433
|
+
const participantId = side.participantId;
|
|
47434
|
+
return { ...extractSideDetail(side),
|
|
47435
|
+
lineUp: participantId && lineUps[participantId] || []
|
|
47436
|
+
};
|
|
47437
|
+
});
|
|
47438
|
+
}
|
|
47439
|
+
|
|
47440
|
+
const dualMatchUpSide = dualMatchUp.sides.find(({
|
|
47399
47441
|
sideNumber
|
|
47400
47442
|
}) => sideNumber === side.sideNumber);
|
|
47401
47443
|
|
|
47402
47444
|
if (!dualMatchUpSide) {
|
|
47403
47445
|
return {
|
|
47404
47446
|
error: NOT_FOUND,
|
|
47405
|
-
existingParticipantId
|
|
47447
|
+
existingParticipantId,
|
|
47448
|
+
sideNumber: side.sideNumber
|
|
47406
47449
|
};
|
|
47407
47450
|
}
|
|
47408
47451
|
|
|
47409
|
-
const
|
|
47410
|
-
|
|
47411
|
-
}) =>
|
|
47412
|
-
const
|
|
47413
|
-
const templateTeamLineUp = findLineUpWithParticipantIds({
|
|
47414
|
-
drawDefinition,
|
|
47415
|
-
participantIds
|
|
47416
|
-
});
|
|
47417
|
-
const teamParticipantId = (templateTeamLineUp === null || templateTeamLineUp === void 0 ? void 0 : templateTeamLineUp.teamParticipantId) || (teamParticipants === null || teamParticipants === void 0 ? void 0 : (_teamParticipants$fin = teamParticipants.find(participant => intersection((participant === null || participant === void 0 ? void 0 : participant.individualParticipantIds) || [], participantIds).length)) === null || _teamParticipants$fin === void 0 ? void 0 : _teamParticipants$fin.participantId); // if dualMatchUpSide does not currently have a lineUp use a lineUp found in drawDefinition.extention as a template
|
|
47418
|
-
|
|
47419
|
-
const teamLineUp = dualMatchUpSide.lineUp || templateTeamLineUp;
|
|
47452
|
+
const teamParticipantId = (_inContextDualMatchUp = inContextDualMatchUp.sides) === null || _inContextDualMatchUp === void 0 ? void 0 : (_inContextDualMatchUp2 = _inContextDualMatchUp.find(({
|
|
47453
|
+
sideNumber
|
|
47454
|
+
}) => sideNumber === side.sideNumber)) === null || _inContextDualMatchUp2 === void 0 ? void 0 : _inContextDualMatchUp2.participantId;
|
|
47455
|
+
const teamLineUp = dualMatchUpSide.lineUp;
|
|
47420
47456
|
const newParticipantIdInLineUp = teamLineUp === null || teamLineUp === void 0 ? void 0 : teamLineUp.find(({
|
|
47421
47457
|
participantId
|
|
47422
47458
|
}) => newParticipantId === participantId);
|
|
@@ -47478,12 +47514,7 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
47478
47514
|
drawDefinition,
|
|
47479
47515
|
tieFormat
|
|
47480
47516
|
});
|
|
47481
|
-
|
|
47482
|
-
if (result.error) {
|
|
47483
|
-
console.log(result.error, {
|
|
47484
|
-
templateTeamLineUp
|
|
47485
|
-
});
|
|
47486
|
-
}
|
|
47517
|
+
if (result.error) return result;
|
|
47487
47518
|
} else {
|
|
47488
47519
|
console.log('team participantId not found');
|
|
47489
47520
|
}
|