tods-competition-factory 1.9.2 → 1.9.4

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.mjs CHANGED
@@ -2414,7 +2414,7 @@ const matchUpFormatCode = {
2414
2414
  };
2415
2415
 
2416
2416
  function factoryVersion() {
2417
- return "1.9.2";
2417
+ return "1.9.4";
2418
2418
  }
2419
2419
 
2420
2420
  function getObjectTieFormat(obj) {
@@ -15122,44 +15122,37 @@ const positionActionConstants = {
15122
15122
  SEED_VALUE
15123
15123
  };
15124
15124
 
15125
- const POLICY_POSITION_ACTIONS_DEFAULT = {
15125
+ const POLICY_POSITION_ACTIONS_UNRESTRICTED = {
15126
15126
  [POLICY_TYPE_POSITION_ACTIONS]: {
15127
- policyName: "positionActionsDefault",
15127
+ policyName: "positionActionsUnrestricted",
15128
+ // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [], structureTypes: [] }
15129
+ // enabledStructures: [] => all structures are enabled
15130
+ enabledStructures: [],
15131
+ // enables entries in other flights to be accessed as alternates
15132
+ otherFlightEntries: true,
15133
+ // enables entries with multiple qualifying roundTargets to be placed in any round
15134
+ disableRoundRestrictions: true,
15135
+ // enable specific actions even when there are active positions
15136
+ activePositionOverrides: [SEED_VALUE, REMOVE_SEED]
15137
+ }
15138
+ };
15139
+
15140
+ const POLICY_POSITION_ACTIONS_NO_MOVEMENT = {
15141
+ [POLICY_TYPE_POSITION_ACTIONS]: {
15142
+ policyName: "positionActionsNoMovement",
15128
15143
  // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [] }
15129
15144
  // enabledStructures: [] => all structures are enabled
15130
15145
  enabledStructures: [
15131
- {
15132
- stages: [QUALIFYING, MAIN],
15133
- // stages to which this policy applies
15134
- stageSequences: [1],
15135
- // stageSequences to which this policy applies
15136
- enabledActions: [],
15137
- // enabledActions: [] => all actions are enabled
15138
- disabledActions: []
15139
- // disabledActions: [] => no actions are disabled
15140
- },
15141
15146
  {
15142
15147
  stages: [],
15143
15148
  // stages: [] => applies to all stages
15144
15149
  stageSequences: [],
15145
15150
  // stageSequences: [] => applies to all stageSequences
15146
- enabledActions: [
15147
- ADD_NICKNAME,
15148
- ADD_PENALTY,
15149
- QUALIFYING_PARTICIPANT,
15150
- SEED_VALUE
15151
- ],
15151
+ enabledActions: [SEED_VALUE, ADD_NICKNAME, ADD_PENALTY],
15152
15152
  disabledActions: []
15153
15153
  // disabledActions: [] => no actions are disabled
15154
15154
  }
15155
- ],
15156
- // positionActions will be completely disabled for any structures matching { stages: [], stageSequences: [] }
15157
- // disabledStructures: [] => no structures are disabled
15158
- disbledStructures: [],
15159
- // enables entries in other flights to be accessed as alternates
15160
- otherFlightEntries: false,
15161
- // enable specific actions even when there are active positions
15162
- activePositionOverrides: []
15155
+ ]
15163
15156
  }
15164
15157
  };
15165
15158
 
@@ -15172,115 +15165,44 @@ const POLICY_POSITION_ACTIONS_DISABLED = {
15172
15165
  }
15173
15166
  };
15174
15167
 
15175
- const POLICY_POSITION_ACTIONS_NO_MOVEMENT = {
15168
+ const POLICY_POSITION_ACTIONS_DEFAULT = {
15176
15169
  [POLICY_TYPE_POSITION_ACTIONS]: {
15177
- policyName: "positionActionsNoMovement",
15170
+ policyName: "positionActionsDefault",
15178
15171
  // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [] }
15179
15172
  // enabledStructures: [] => all structures are enabled
15180
15173
  enabledStructures: [
15174
+ {
15175
+ stages: [QUALIFYING, MAIN],
15176
+ // stages to which this policy applies
15177
+ stageSequences: [1],
15178
+ // stageSequences to which this policy applies
15179
+ enabledActions: [],
15180
+ // enabledActions: [] => all actions are enabled
15181
+ disabledActions: []
15182
+ // disabledActions: [] => no actions are disabled
15183
+ },
15181
15184
  {
15182
15185
  stages: [],
15183
15186
  // stages: [] => applies to all stages
15184
15187
  stageSequences: [],
15185
15188
  // stageSequences: [] => applies to all stageSequences
15186
- enabledActions: [SEED_VALUE, ADD_NICKNAME, ADD_PENALTY],
15189
+ enabledActions: [
15190
+ ADD_NICKNAME,
15191
+ ADD_PENALTY,
15192
+ QUALIFYING_PARTICIPANT,
15193
+ SEED_VALUE
15194
+ ],
15187
15195
  disabledActions: []
15188
15196
  // disabledActions: [] => no actions are disabled
15189
15197
  }
15190
- ]
15191
- }
15192
- };
15193
-
15194
- const POLICY_POSITION_ACTIONS_UNRESTRICTED = {
15195
- [POLICY_TYPE_POSITION_ACTIONS]: {
15196
- policyName: "positionActionsUnrestricted",
15197
- // positionActions will be selectively enabled for structures matching { stages: [], stageSequences: [], structureTypes: [] }
15198
- // enabledStructures: [] => all structures are enabled
15199
- enabledStructures: [],
15198
+ ],
15199
+ // positionActions will be completely disabled for any structures matching { stages: [], stageSequences: [] }
15200
+ // disabledStructures: [] => no structures are disabled
15201
+ disbledStructures: [],
15200
15202
  // enables entries in other flights to be accessed as alternates
15201
- otherFlightEntries: true,
15202
- // enables entries with multiple qualifying roundTargets to be placed in any round
15203
- disableRoundRestrictions: true,
15203
+ otherFlightEntries: false,
15204
15204
  // enable specific actions even when there are active positions
15205
- activePositionOverrides: [SEED_VALUE, REMOVE_SEED]
15206
- }
15207
- };
15208
-
15209
- const POLICY_PRIVACY_DEFAULT = {
15210
- [POLICY_TYPE_PARTICIPANT]: {
15211
- policyName: "Participant Privacy Policy",
15212
- participant: {
15213
- contacts: false,
15214
- individualParticipants: {
15215
- onlineResources: false,
15216
- participantName: true,
15217
- participantOtherName: true,
15218
- participantId: true,
15219
- participantRole: true,
15220
- participantStatus: true,
15221
- penalties: false,
15222
- representing: true,
15223
- participantRoleResponsibilities: false,
15224
- participantType: true,
15225
- person: {
15226
- addresses: false,
15227
- biographicalInformation: false,
15228
- birthDate: false,
15229
- contacts: false,
15230
- nationalityCode: true,
15231
- nativeFamilyName: false,
15232
- nativeGivenName: false,
15233
- onlineResources: false,
15234
- otherNames: true,
15235
- parentOrganisationId: false,
15236
- passportFamilyName: false,
15237
- passportGivenName: false,
15238
- personId: false,
15239
- personOtherIds: false,
15240
- previousNames: false,
15241
- sex: false,
15242
- standardFamilyName: true,
15243
- standardGivenName: true,
15244
- status: false,
15245
- tennisId: false,
15246
- wheelchair: true
15247
- }
15248
- },
15249
- individualParticipantIds: true,
15250
- onlineResources: false,
15251
- participantName: true,
15252
- participantOtherName: true,
15253
- participantId: true,
15254
- participantRole: true,
15255
- participantStatus: true,
15256
- penalties: false,
15257
- representing: true,
15258
- participantRoleResponsibilities: false,
15259
- participantType: true,
15260
- person: {
15261
- addresses: false,
15262
- biographicalInformation: false,
15263
- birthDate: false,
15264
- contacts: false,
15265
- nationalityCode: true,
15266
- nativeFamilyName: false,
15267
- nativeGivenName: false,
15268
- onlineResources: false,
15269
- otherNames: true,
15270
- parentOrganisationId: false,
15271
- passportFamilyName: false,
15272
- passportGivenName: false,
15273
- personId: false,
15274
- personOtherIds: false,
15275
- previousNames: false,
15276
- sex: false,
15277
- standardFamilyName: true,
15278
- standardGivenName: true,
15279
- status: false,
15280
- tennisId: false,
15281
- wheelchair: true
15282
- }
15283
- }
15205
+ activePositionOverrides: []
15284
15206
  }
15285
15207
  };
15286
15208
 
@@ -15479,6 +15401,107 @@ const POLICY_SCHEDULING_DEFAULT = {
15479
15401
  }
15480
15402
  };
15481
15403
 
15404
+ const POLICY_PRIVACY_DEFAULT = {
15405
+ [POLICY_TYPE_PARTICIPANT]: {
15406
+ policyName: "Participant Privacy Policy",
15407
+ participant: {
15408
+ contacts: false,
15409
+ individualParticipants: {
15410
+ onlineResources: false,
15411
+ participantName: true,
15412
+ participantOtherName: true,
15413
+ participantId: true,
15414
+ participantRole: true,
15415
+ participantStatus: true,
15416
+ penalties: false,
15417
+ representing: true,
15418
+ participantRoleResponsibilities: false,
15419
+ participantType: true,
15420
+ person: {
15421
+ addresses: false,
15422
+ biographicalInformation: false,
15423
+ birthDate: false,
15424
+ contacts: false,
15425
+ nationalityCode: true,
15426
+ nativeFamilyName: false,
15427
+ nativeGivenName: false,
15428
+ onlineResources: false,
15429
+ otherNames: true,
15430
+ parentOrganisationId: false,
15431
+ passportFamilyName: false,
15432
+ passportGivenName: false,
15433
+ personId: false,
15434
+ personOtherIds: false,
15435
+ previousNames: false,
15436
+ sex: false,
15437
+ standardFamilyName: true,
15438
+ standardGivenName: true,
15439
+ status: false,
15440
+ tennisId: false,
15441
+ wheelchair: true
15442
+ }
15443
+ },
15444
+ individualParticipantIds: true,
15445
+ onlineResources: false,
15446
+ participantName: true,
15447
+ participantOtherName: true,
15448
+ participantId: true,
15449
+ participantRole: true,
15450
+ participantStatus: true,
15451
+ penalties: false,
15452
+ representing: true,
15453
+ participantRoleResponsibilities: false,
15454
+ participantType: true,
15455
+ person: {
15456
+ addresses: false,
15457
+ biographicalInformation: false,
15458
+ birthDate: false,
15459
+ contacts: false,
15460
+ nationalityCode: true,
15461
+ nativeFamilyName: false,
15462
+ nativeGivenName: false,
15463
+ onlineResources: false,
15464
+ otherNames: true,
15465
+ parentOrganisationId: false,
15466
+ passportFamilyName: false,
15467
+ passportGivenName: false,
15468
+ personId: false,
15469
+ personOtherIds: false,
15470
+ previousNames: false,
15471
+ sex: false,
15472
+ standardFamilyName: true,
15473
+ standardGivenName: true,
15474
+ status: false,
15475
+ tennisId: false,
15476
+ wheelchair: true
15477
+ }
15478
+ }
15479
+ }
15480
+ };
15481
+
15482
+ const POLICY_SCORING_DEFAULT = {
15483
+ [POLICY_TYPE_SCORING]: {
15484
+ defaultMatchUpFormat: FORMAT_STANDARD,
15485
+ allowDeletionWithScoresPresent: {
15486
+ drawDefinitions: false,
15487
+ structures: false
15488
+ },
15489
+ requireAllPositionsAssigned: false,
15490
+ processCodes: {
15491
+ incompleteAssignmentsOnDefault: ["RANKING.IGNORE"]
15492
+ },
15493
+ stage: {
15494
+ [MAIN]: {
15495
+ stageSequence: {
15496
+ 1: {
15497
+ requireAllPositionsAssigned: true
15498
+ }
15499
+ }
15500
+ }
15501
+ }
15502
+ }
15503
+ };
15504
+
15482
15505
  const POLICY_SCORING_USTA = {
15483
15506
  [POLICY_TYPE_SCORING]: {
15484
15507
  requireAllPositionsAssigned: false,
@@ -15575,66 +15598,43 @@ const POLICY_SCORING_USTA = {
15575
15598
  }
15576
15599
  };
15577
15600
 
15578
- const POLICY_SCORING_DEFAULT = {
15579
- [POLICY_TYPE_SCORING]: {
15580
- defaultMatchUpFormat: FORMAT_STANDARD,
15581
- allowDeletionWithScoresPresent: {
15582
- drawDefinitions: false,
15583
- structures: false
15584
- },
15585
- requireAllPositionsAssigned: false,
15586
- processCodes: {
15587
- incompleteAssignmentsOnDefault: ["RANKING.IGNORE"]
15588
- },
15589
- stage: {
15590
- [MAIN]: {
15591
- stageSequence: {
15592
- 1: {
15593
- requireAllPositionsAssigned: true
15594
- }
15595
- }
15596
- }
15597
- }
15598
- }
15599
- };
15600
-
15601
- const POLICY_SEEDING_ITF = {
15601
+ const POLICY_SEEDING_DEFAULT = {
15602
15602
  [POLICY_TYPE_SEEDING]: {
15603
- seedingProfile: { positioning: CLUSTER },
15604
15603
  validSeedPositions: { ignore: true },
15605
15604
  duplicateSeedNumbers: true,
15606
15605
  drawSizeProgression: true,
15607
- policyName: "ITF SEEDING",
15606
+ seedingProfile: {
15607
+ drawTypes: {
15608
+ [ROUND_ROBIN_WITH_PLAYOFF]: { positioning: WATERFALL },
15609
+ [ROUND_ROBIN]: { positioning: WATERFALL }
15610
+ },
15611
+ positioning: SEPARATE
15612
+ },
15613
+ policyName: "USTA SEEDING",
15608
15614
  seedsCountThresholds: [
15609
15615
  { drawSize: 4, minimumParticipantCount: 3, seedsCount: 2 },
15610
15616
  { drawSize: 16, minimumParticipantCount: 12, seedsCount: 4 },
15611
15617
  { drawSize: 32, minimumParticipantCount: 24, seedsCount: 8 },
15612
15618
  { drawSize: 64, minimumParticipantCount: 48, seedsCount: 16 },
15613
- { drawSize: 128, minimumParticipantCount: 97, seedsCount: 32 },
15619
+ { drawSize: 128, minimumParticipantCount: 96, seedsCount: 32 },
15614
15620
  { drawSize: 256, minimumParticipantCount: 192, seedsCount: 64 }
15615
15621
  ]
15616
15622
  }
15617
15623
  };
15618
15624
 
15619
- const POLICY_SEEDING_USTA = {
15625
+ const POLICY_SEEDING_ITF = {
15620
15626
  [POLICY_TYPE_SEEDING]: {
15627
+ seedingProfile: { positioning: CLUSTER },
15621
15628
  validSeedPositions: { ignore: true },
15622
15629
  duplicateSeedNumbers: true,
15623
15630
  drawSizeProgression: true,
15624
- seedingProfile: {
15625
- drawTypes: {
15626
- [ROUND_ROBIN_WITH_PLAYOFF]: { positioning: WATERFALL },
15627
- [ROUND_ROBIN]: { positioning: WATERFALL }
15628
- },
15629
- positioning: SEPARATE
15630
- },
15631
- policyName: "USTA SEEDING",
15631
+ policyName: "ITF SEEDING",
15632
15632
  seedsCountThresholds: [
15633
15633
  { drawSize: 4, minimumParticipantCount: 3, seedsCount: 2 },
15634
15634
  { drawSize: 16, minimumParticipantCount: 12, seedsCount: 4 },
15635
15635
  { drawSize: 32, minimumParticipantCount: 24, seedsCount: 8 },
15636
15636
  { drawSize: 64, minimumParticipantCount: 48, seedsCount: 16 },
15637
- { drawSize: 128, minimumParticipantCount: 96, seedsCount: 32 },
15637
+ { drawSize: 128, minimumParticipantCount: 97, seedsCount: 32 },
15638
15638
  { drawSize: 256, minimumParticipantCount: 192, seedsCount: 64 }
15639
15639
  ]
15640
15640
  }
@@ -15652,7 +15652,7 @@ const policies = {
15652
15652
  POLICY_SCORING_DEFAULT,
15653
15653
  POLICY_SCORING_USTA,
15654
15654
  POLICY_SEEDING_ITF,
15655
- POLICY_SEEDING_USTA
15655
+ POLICY_SEEDING_DEFAULT
15656
15656
  };
15657
15657
 
15658
15658
  const fixtures = {
@@ -43876,11 +43876,14 @@ function randomUnseededSeparation({
43876
43876
  idCollections,
43877
43877
  participants
43878
43878
  });
43879
+ if (allGroups.error) {
43880
+ return decorateResult({ result: allGroups, stack });
43881
+ }
43879
43882
  const participantIdGroups = Object.assign(
43880
43883
  {},
43881
43884
  ...unseededParticipantIds.map((participantId) => {
43882
43885
  const groups = Object.keys(allGroups).filter(
43883
- (key) => allGroups[key].includes(participantId)
43886
+ (key) => (allGroups[key] ?? []).includes(participantId)
43884
43887
  );
43885
43888
  return { [participantId]: groups };
43886
43889
  })
@@ -44078,7 +44081,7 @@ function positionUnseededParticipants({
44078
44081
  drawDefinition,
44079
44082
  event
44080
44083
  });
44081
- let avoidance = (appliedPolicies ?? {})[POLICY_TYPE_AVOIDANCE];
44084
+ let avoidance = appliedPolicies?.[POLICY_TYPE_AVOIDANCE];
44082
44085
  if (structure.stage === PLAY_OFF) {
44083
44086
  const groupings = entries.reduce((groupings2, entry) => {
44084
44087
  if (!groupings2[entry.groupingValue])
@@ -49473,8 +49476,8 @@ const matchUpGovernor = {
49473
49476
  };
49474
49477
 
49475
49478
  function attachPolicies({
49476
- drawDefinition,
49477
- policyDefinitions
49479
+ policyDefinitions,
49480
+ drawDefinition
49478
49481
  }) {
49479
49482
  if (!drawDefinition) {
49480
49483
  return { error: MISSING_DRAW_DEFINITION };
@@ -59923,13 +59926,15 @@ function generateDrawDefinition(params) {
59923
59926
  if (params.seedingProfile) {
59924
59927
  if (!policyDefinitions[POLICY_TYPE_SEEDING]) {
59925
59928
  policyDefinitions[POLICY_TYPE_SEEDING] = {
59926
- ...POLICY_SEEDING_USTA[POLICY_TYPE_SEEDING]
59929
+ ...POLICY_SEEDING_DEFAULT[POLICY_TYPE_SEEDING]
59927
59930
  };
59928
59931
  }
59929
59932
  policyDefinitions[POLICY_TYPE_SEEDING].seedingProfile = seedingProfile;
59930
59933
  }
59931
59934
  const { participants, participantMap } = getParticipants$1({
59932
59935
  withIndividualParticipants: true,
59936
+ convertExtensions: true,
59937
+ internalUse: true,
59933
59938
  tournamentRecord
59934
59939
  });
59935
59940
  const enforceGender = params.enforceGender ?? policyDefinitions?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender ?? appliedPolicies?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender;
@@ -60040,6 +60045,9 @@ function generateDrawDefinition(params) {
60040
60045
  drawDefinition.matchUpType = matchUpType;
60041
60046
  }
60042
60047
  }
60048
+ const policiesToAttach = {
60049
+ [POLICY_TYPE_AVOIDANCE]: appliedPolicies[POLICY_TYPE_AVOIDANCE]
60050
+ };
60043
60051
  if (policyDefinitions) {
60044
60052
  if (typeof policyDefinitions !== "object") {
60045
60053
  return decorateResult({
@@ -60048,7 +60056,6 @@ function generateDrawDefinition(params) {
60048
60056
  stack
60049
60057
  });
60050
60058
  } else {
60051
- const policiesToAttach = {};
60052
60059
  for (const key of Object.keys(policyDefinitions)) {
60053
60060
  if (JSON.stringify(appliedPolicies?.[key]) !== JSON.stringify(policyDefinitions[key])) {
60054
60061
  policiesToAttach[key] = policyDefinitions[key];
@@ -60059,10 +60066,15 @@ function generateDrawDefinition(params) {
60059
60066
  Object.assign(appliedPolicies, policiesToAttach);
60060
60067
  }
60061
60068
  }
60069
+ } else if (policiesToAttach.avoidance) {
60070
+ attachPolicies({ drawDefinition, policyDefinitions: policiesToAttach });
60062
60071
  }
60063
60072
  if (!appliedPolicies[POLICY_TYPE_SEEDING] && !policyDefinitions[POLICY_TYPE_SEEDING]) {
60064
- attachPolicies({ drawDefinition, policyDefinitions: POLICY_SEEDING_USTA });
60065
- Object.assign(appliedPolicies, POLICY_SEEDING_USTA);
60073
+ attachPolicies({
60074
+ drawDefinition,
60075
+ policyDefinitions: POLICY_SEEDING_DEFAULT
60076
+ });
60077
+ Object.assign(appliedPolicies, POLICY_SEEDING_DEFAULT);
60066
60078
  }
60067
60079
  let structureId = existingDrawDefinition?.structures?.find(
60068
60080
  (structure) => structure.stage === MAIN && structure.stageSequence === 1