tods-competition-factory 1.7.12 → 1.7.13
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 +176 -90
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +205 -96
- 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/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -333,7 +333,7 @@ const matchUpFormatCode = {
|
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
function factoryVersion() {
|
|
336
|
-
return "1.7.
|
|
336
|
+
return "1.7.13";
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
function getObjectTieFormat(obj) {
|
|
@@ -29569,6 +29569,7 @@ function getTieFormat$1({
|
|
|
29569
29569
|
// optional - if an eventId is present only return tieFormat for event
|
|
29570
29570
|
event
|
|
29571
29571
|
}) {
|
|
29572
|
+
const stack = "getTieFormat";
|
|
29572
29573
|
let tieFormat;
|
|
29573
29574
|
structureId = structure?.structureId ?? structureId;
|
|
29574
29575
|
matchUpId = matchUp?.matchUpId ?? matchUpId;
|
|
@@ -29584,6 +29585,9 @@ function getTieFormat$1({
|
|
|
29584
29585
|
});
|
|
29585
29586
|
if (result.error)
|
|
29586
29587
|
return result;
|
|
29588
|
+
if (result.matchUp?.matchUpType !== TEAM_MATCHUP) {
|
|
29589
|
+
return decorateResult({ result: { error: INVALID_MATCHUP }, stack });
|
|
29590
|
+
}
|
|
29587
29591
|
if (!structure)
|
|
29588
29592
|
structure = result.structure;
|
|
29589
29593
|
if (!matchUp)
|
|
@@ -29617,7 +29621,7 @@ function getTieFormat$1({
|
|
|
29617
29621
|
tieFormat = getObjectTieFormat(drawDefinition) || getObjectTieFormat(event);
|
|
29618
29622
|
}
|
|
29619
29623
|
if (!tieFormat)
|
|
29620
|
-
return decorateResult({ result: { error: MISSING_TIE_FORMAT } });
|
|
29624
|
+
return decorateResult({ result: { error: MISSING_TIE_FORMAT }, stack });
|
|
29621
29625
|
return { ...SUCCESS, tieFormat, matchUp, structure };
|
|
29622
29626
|
}
|
|
29623
29627
|
|
|
@@ -29800,9 +29804,9 @@ function modifyCollectionDefinition$1({
|
|
|
29800
29804
|
tournamentRecord,
|
|
29801
29805
|
collectionOrder,
|
|
29802
29806
|
collectionName,
|
|
29807
|
+
tieFormatName,
|
|
29803
29808
|
drawDefinition,
|
|
29804
29809
|
matchUpFormat,
|
|
29805
|
-
tieFormatName,
|
|
29806
29810
|
matchUpCount,
|
|
29807
29811
|
collectionId,
|
|
29808
29812
|
matchUpType,
|
|
@@ -29819,19 +29823,35 @@ function modifyCollectionDefinition$1({
|
|
|
29819
29823
|
scoreValue,
|
|
29820
29824
|
setValue
|
|
29821
29825
|
}) {
|
|
29826
|
+
const stack = "modifyCollectionDefinition";
|
|
29822
29827
|
if (matchUpFormat && !isValid(matchUpFormat)) {
|
|
29823
|
-
return {
|
|
29828
|
+
return decorateResult({
|
|
29829
|
+
result: { error: INVALID_VALUES },
|
|
29830
|
+
context: { matchUpFormat },
|
|
29831
|
+
stack
|
|
29832
|
+
});
|
|
29824
29833
|
}
|
|
29825
29834
|
if (collectionName && typeof collectionName !== "string") {
|
|
29826
|
-
return {
|
|
29835
|
+
return decorateResult({
|
|
29836
|
+
result: { error: INVALID_VALUES },
|
|
29837
|
+
context: { collectionName },
|
|
29838
|
+
stack
|
|
29839
|
+
});
|
|
29827
29840
|
}
|
|
29828
29841
|
if (gender && !Object.values(genderConstants).includes(gender)) {
|
|
29829
|
-
return {
|
|
29842
|
+
return decorateResult({
|
|
29843
|
+
result: { error: INVALID_VALUES },
|
|
29844
|
+
context: { gender },
|
|
29845
|
+
stack
|
|
29846
|
+
});
|
|
29830
29847
|
}
|
|
29831
29848
|
if (category && typeof category !== "object") {
|
|
29832
|
-
return {
|
|
29849
|
+
return decorateResult({
|
|
29850
|
+
result: { error: INVALID_VALUES },
|
|
29851
|
+
context: { category },
|
|
29852
|
+
stack
|
|
29853
|
+
});
|
|
29833
29854
|
}
|
|
29834
|
-
const stack = "modifyCollectionDefinition";
|
|
29835
29855
|
const valueAssignments = {
|
|
29836
29856
|
collectionValueProfiles,
|
|
29837
29857
|
collectionValue,
|
|
@@ -29843,10 +29863,8 @@ function modifyCollectionDefinition$1({
|
|
|
29843
29863
|
return decorateResult({ result: { error: MISSING_VALUE }, stack });
|
|
29844
29864
|
if (Object.values(valueAssignments).filter(Boolean).length > 1)
|
|
29845
29865
|
return decorateResult({
|
|
29846
|
-
|
|
29847
|
-
|
|
29848
|
-
error: INVALID_VALUES
|
|
29849
|
-
},
|
|
29866
|
+
info: "Only one value assignment allowed per collectionDefinition",
|
|
29867
|
+
result: { error: INVALID_VALUES },
|
|
29850
29868
|
stack
|
|
29851
29869
|
});
|
|
29852
29870
|
let result = getTieFormat$1({
|
|
@@ -29856,79 +29874,137 @@ function modifyCollectionDefinition$1({
|
|
|
29856
29874
|
eventId,
|
|
29857
29875
|
event
|
|
29858
29876
|
});
|
|
29859
|
-
if (result.error)
|
|
29877
|
+
if (result.error) {
|
|
29860
29878
|
return decorateResult({ result, stack });
|
|
29879
|
+
}
|
|
29861
29880
|
const { matchUp, structure, tieFormat: existingTieFormat } = result;
|
|
29862
29881
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
29863
|
-
const
|
|
29864
|
-
(
|
|
29882
|
+
const sourceCollectionDefinition = existingTieFormat?.collectionDefinitions.find(
|
|
29883
|
+
(collectionDefinition) => collectionDefinition.collectionId === collectionId
|
|
29865
29884
|
);
|
|
29866
|
-
|
|
29885
|
+
const targetCollectionDefinition = tieFormat?.collectionDefinitions.find(
|
|
29886
|
+
(collectionDefinition) => collectionDefinition.collectionId === collectionId
|
|
29887
|
+
);
|
|
29888
|
+
if (!sourceCollectionDefinition)
|
|
29867
29889
|
return decorateResult({ result: { error: NOT_FOUND }, stack });
|
|
29868
|
-
const value = collectionValue
|
|
29869
|
-
if (
|
|
29870
|
-
|
|
29871
|
-
|
|
29872
|
-
|
|
29873
|
-
}
|
|
29874
|
-
|
|
29875
|
-
|
|
29876
|
-
|
|
29877
|
-
|
|
29878
|
-
|
|
29879
|
-
|
|
29880
|
-
result: { error: INVALID_VALUES, info: result2.errors },
|
|
29881
|
-
stack
|
|
29882
|
-
});
|
|
29883
|
-
}
|
|
29890
|
+
const value = collectionValue ?? matchUpValue ?? scoreValue ?? setValue;
|
|
29891
|
+
if (collectionValueProfiles) {
|
|
29892
|
+
const result2 = validateCollectionValueProfile({
|
|
29893
|
+
matchUpCount: matchUpCount || sourceCollectionDefinition?.matchUpCount,
|
|
29894
|
+
collectionValueProfiles
|
|
29895
|
+
});
|
|
29896
|
+
if (result2.errors) {
|
|
29897
|
+
return decorateResult({
|
|
29898
|
+
result: { error: INVALID_VALUES },
|
|
29899
|
+
info: result2.errors,
|
|
29900
|
+
stack
|
|
29901
|
+
});
|
|
29884
29902
|
}
|
|
29885
|
-
|
|
29886
|
-
|
|
29887
|
-
|
|
29888
|
-
|
|
29889
|
-
|
|
29903
|
+
} else if (value && !isConvertableInteger(value)) {
|
|
29904
|
+
return decorateResult({
|
|
29905
|
+
result: { error: INVALID_VALUES },
|
|
29906
|
+
info: "value is not an integer",
|
|
29907
|
+
context: { value },
|
|
29908
|
+
stack
|
|
29909
|
+
});
|
|
29910
|
+
}
|
|
29911
|
+
const equivalentValueProfiles = (a, b) => intersection(Object.keys(a), Object.keys(b)).length === Object.keys(a).length && intersection(Object.values(a), Object.values(b)).length === Object.values(a).length;
|
|
29912
|
+
const valueProfileModified = collectionValueProfiles && (!sourceCollectionDefinition.collectionValueProfiles || !equivalentValueProfiles(
|
|
29913
|
+
sourceCollectionDefinition.collectionValueProfiles,
|
|
29914
|
+
collectionValueProfiles
|
|
29915
|
+
));
|
|
29916
|
+
const valueModified = isConvertableInteger(collectionValue) && sourceCollectionDefinition.collectionValue !== collectionValue || isConvertableInteger(matchUpValue) && sourceCollectionDefinition.matchUpValue !== matchUpValue || isConvertableInteger(scoreValue) && sourceCollectionDefinition.scoreValue !== scoreValue || isConvertableInteger(setValue) && sourceCollectionDefinition.setValue !== setValue || valueProfileModified;
|
|
29917
|
+
const modifications = [];
|
|
29918
|
+
if (valueModified) {
|
|
29919
|
+
targetCollectionDefinition.collectionValueProfiles = void 0;
|
|
29920
|
+
targetCollectionDefinition.collectionValue = void 0;
|
|
29921
|
+
targetCollectionDefinition.matchUpValue = void 0;
|
|
29922
|
+
targetCollectionDefinition.scoreValue = void 0;
|
|
29923
|
+
targetCollectionDefinition.setValue = void 0;
|
|
29924
|
+
Object.assign(targetCollectionDefinition, valueAssignments);
|
|
29925
|
+
modifications.push({
|
|
29926
|
+
collectionId,
|
|
29927
|
+
...definedAttributes(valueAssignments)
|
|
29928
|
+
});
|
|
29890
29929
|
}
|
|
29891
|
-
if ((scoreValue || setValue) &&
|
|
29892
|
-
const targetCollectionGroupNumber =
|
|
29930
|
+
if ((isConvertableInteger(scoreValue) || isConvertableInteger(setValue)) && targetCollectionDefinition.collectionGroupNumber) {
|
|
29931
|
+
const targetCollectionGroupNumber = targetCollectionDefinition.collectionGroupNumber;
|
|
29893
29932
|
tieFormat.collectionDefinitions = tieFormat.collectionDefinitions.map(
|
|
29894
|
-
(
|
|
29895
|
-
const { collectionGroupNumber, ...rest } =
|
|
29933
|
+
(collectionDefinition) => {
|
|
29934
|
+
const { collectionGroupNumber, ...rest } = collectionDefinition;
|
|
29896
29935
|
if (collectionGroupNumber === targetCollectionGroupNumber) {
|
|
29897
29936
|
return rest;
|
|
29898
29937
|
} else {
|
|
29899
|
-
return
|
|
29938
|
+
return collectionDefinition;
|
|
29900
29939
|
}
|
|
29901
29940
|
}
|
|
29902
29941
|
);
|
|
29903
29942
|
tieFormat.collectionGroups = tieFormat.collectionGroups.filter(
|
|
29904
29943
|
({ groupNumber }) => groupNumber !== targetCollectionGroupNumber
|
|
29905
29944
|
);
|
|
29945
|
+
modifications.push({
|
|
29946
|
+
collectionId,
|
|
29947
|
+
change: "collectionGroupNumber removed"
|
|
29948
|
+
});
|
|
29906
29949
|
}
|
|
29907
29950
|
const { aggregateValue, valueGoal } = calculateWinCriteria(tieFormat);
|
|
29908
|
-
|
|
29909
|
-
|
|
29910
|
-
|
|
29911
|
-
|
|
29912
|
-
|
|
29913
|
-
|
|
29914
|
-
|
|
29915
|
-
|
|
29916
|
-
|
|
29917
|
-
|
|
29918
|
-
|
|
29919
|
-
|
|
29920
|
-
|
|
29921
|
-
|
|
29922
|
-
|
|
29923
|
-
|
|
29924
|
-
|
|
29925
|
-
|
|
29926
|
-
|
|
29927
|
-
|
|
29951
|
+
const winCriteria = definedAttributes({ aggregateValue, valueGoal });
|
|
29952
|
+
if (winCriteria.aggregateValue !== existingTieFormat?.winCriteria.aggregateValue || winCriteria.valueGoal !== existingTieFormat?.winCriteria.valueGoal) {
|
|
29953
|
+
tieFormat.winCriteria = winCriteria;
|
|
29954
|
+
modifications.push({ collectionId, winCriteria });
|
|
29955
|
+
}
|
|
29956
|
+
if (isConvertableInteger(collectionOrder) && sourceCollectionDefinition.collectionOrder !== collectionOrder) {
|
|
29957
|
+
targetCollectionDefinition.collectionOrder = collectionOrder;
|
|
29958
|
+
modifications.push({ collectionId, collectionOrder });
|
|
29959
|
+
}
|
|
29960
|
+
if (collectionName && sourceCollectionDefinition.collectionName !== collectionName) {
|
|
29961
|
+
targetCollectionDefinition.collectionName = collectionName;
|
|
29962
|
+
modifications.push({ collectionId, collectionName });
|
|
29963
|
+
}
|
|
29964
|
+
if (matchUpFormat && sourceCollectionDefinition.matchUpFormat !== matchUpFormat) {
|
|
29965
|
+
targetCollectionDefinition.matchUpFormat = matchUpFormat;
|
|
29966
|
+
modifications.push({ collectionId, matchUpFormat });
|
|
29967
|
+
}
|
|
29968
|
+
if (isConvertableInteger(matchUpCount) && sourceCollectionDefinition.matchUpCount !== matchUpCount) {
|
|
29969
|
+
return decorateResult({
|
|
29970
|
+
result: { error: NOT_IMPLEMENTED },
|
|
29971
|
+
context: { matchUpCount },
|
|
29972
|
+
stack
|
|
29973
|
+
});
|
|
29974
|
+
}
|
|
29975
|
+
if (matchUpType && sourceCollectionDefinition.matchUpType !== matchUpType) {
|
|
29976
|
+
return decorateResult({
|
|
29977
|
+
result: { error: NOT_IMPLEMENTED },
|
|
29978
|
+
context: { matchUpType },
|
|
29979
|
+
stack
|
|
29980
|
+
});
|
|
29981
|
+
}
|
|
29982
|
+
if (category && sourceCollectionDefinition.category !== category) {
|
|
29983
|
+
targetCollectionDefinition.category = category;
|
|
29984
|
+
modifications.push({ collectionId, category });
|
|
29985
|
+
}
|
|
29986
|
+
if (gender && sourceCollectionDefinition.gender !== gender) {
|
|
29987
|
+
targetCollectionDefinition.gender = gender;
|
|
29988
|
+
modifications.push({ collectionId, gender });
|
|
29989
|
+
}
|
|
29928
29990
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
29929
29991
|
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
29930
|
-
if (result.error)
|
|
29992
|
+
if (result.error) {
|
|
29931
29993
|
return decorateResult({ result, stack });
|
|
29994
|
+
}
|
|
29995
|
+
if (!modifications.length) {
|
|
29996
|
+
return decorateResult({ result: { ...SUCCESS, modifications } });
|
|
29997
|
+
}
|
|
29998
|
+
const changedTieFormatName = existingTieFormat?.tieFormatName !== tieFormatName;
|
|
29999
|
+
if (changedTieFormatName) {
|
|
30000
|
+
prunedTieFormat.tieFormatName = tieFormatName;
|
|
30001
|
+
modifications.push({ tieFormatName });
|
|
30002
|
+
} else if (modifications.length) {
|
|
30003
|
+
delete prunedTieFormat.tieFormatName;
|
|
30004
|
+
modifications.push(
|
|
30005
|
+
"tieFormatName removed: modifications without new tieFormatName"
|
|
30006
|
+
);
|
|
30007
|
+
}
|
|
29932
30008
|
result = updateTieFormat({
|
|
29933
30009
|
tieFormat: prunedTieFormat,
|
|
29934
30010
|
updateInProgressMatchUps,
|
|
@@ -29943,8 +30019,8 @@ function modifyCollectionDefinition$1({
|
|
|
29943
30019
|
const { appliedPolicies } = getAppliedPolicies({ tournamentRecord });
|
|
29944
30020
|
if (appliedPolicies?.audit?.[TIE_FORMAT_MODIFICATIONS]) {
|
|
29945
30021
|
const auditData = definedAttributes({
|
|
30022
|
+
collectionDefinition: targetCollectionDefinition,
|
|
29946
30023
|
drawId: drawDefinition?.drawId,
|
|
29947
|
-
collectionDefinition,
|
|
29948
30024
|
action: stack,
|
|
29949
30025
|
structureId,
|
|
29950
30026
|
matchUpId,
|
|
@@ -29953,7 +30029,7 @@ function modifyCollectionDefinition$1({
|
|
|
29953
30029
|
tieFormatTelemetry({ drawDefinition, auditData });
|
|
29954
30030
|
}
|
|
29955
30031
|
}
|
|
29956
|
-
return decorateResult({ result, stack });
|
|
30032
|
+
return decorateResult({ result: { ...result, modifications }, stack });
|
|
29957
30033
|
}
|
|
29958
30034
|
|
|
29959
30035
|
function resolveTournamentRecord(params) {
|
|
@@ -30448,10 +30524,10 @@ function addCollectionDefinition$1({
|
|
|
30448
30524
|
({ collectionId }) => collectionId
|
|
30449
30525
|
);
|
|
30450
30526
|
if (collectionIds.includes(collectionDefinition.collectionId))
|
|
30451
|
-
return {
|
|
30452
|
-
collectionId: collectionDefinition.collectionId,
|
|
30453
|
-
error: DUPLICATE_VALUE
|
|
30454
|
-
};
|
|
30527
|
+
return decorateResult({
|
|
30528
|
+
context: { collectionId: collectionDefinition.collectionId },
|
|
30529
|
+
result: { error: DUPLICATE_VALUE }
|
|
30530
|
+
});
|
|
30455
30531
|
}
|
|
30456
30532
|
tieFormat.collectionDefinitions.push(collectionDefinition);
|
|
30457
30533
|
tieFormat.collectionDefinitions.sort((a, b) => (a.collectionOrder || 0) - (b.collectionOrder || 0)).forEach(
|
|
@@ -30524,7 +30600,10 @@ function addCollectionDefinition$1({
|
|
|
30524
30600
|
});
|
|
30525
30601
|
} else if (matchUpId && matchUp) {
|
|
30526
30602
|
if (!validUpdate({ matchUp, updateInProgressMatchUps }))
|
|
30527
|
-
return {
|
|
30603
|
+
return decorateResult({
|
|
30604
|
+
result: { error: CANNOT_MODIFY_TIEFORMAT },
|
|
30605
|
+
stack
|
|
30606
|
+
});
|
|
30528
30607
|
matchUp.tieFormat = prunedTieFormat;
|
|
30529
30608
|
const newMatchUps = generateCollectionMatchUps({
|
|
30530
30609
|
collectionDefinition,
|
|
@@ -30579,10 +30658,10 @@ function addCollectionDefinition$1({
|
|
|
30579
30658
|
tieFormatTelemetry({ drawDefinition, auditData });
|
|
30580
30659
|
}
|
|
30581
30660
|
return {
|
|
30582
|
-
...SUCCESS,
|
|
30583
30661
|
tieFormat: prunedTieFormat,
|
|
30584
30662
|
targetMatchUps,
|
|
30585
|
-
addedMatchUps
|
|
30663
|
+
addedMatchUps,
|
|
30664
|
+
...SUCCESS
|
|
30586
30665
|
};
|
|
30587
30666
|
}
|
|
30588
30667
|
function updateStructureMatchUps({
|
|
@@ -31113,45 +31192,42 @@ function modifyTieFormat$1({
|
|
|
31113
31192
|
return decorateResult({ result, stack });
|
|
31114
31193
|
const { matchUp, tieFormat: existingTieFormat } = result;
|
|
31115
31194
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
31195
|
+
if (!compareTieFormats({ ancestor: tieFormat, descendant: modifiedTieFormat })?.different) {
|
|
31196
|
+
return { ...SUCCESS };
|
|
31197
|
+
}
|
|
31116
31198
|
const existingCollectionIds = tieFormat.collectionDefinitions.map(
|
|
31117
31199
|
({ collectionId }) => collectionId
|
|
31118
31200
|
);
|
|
31119
|
-
const
|
|
31120
|
-
|
|
31121
|
-
|
|
31122
|
-
modifiedTieFormat.collectionDefinitions.forEach((def) => {
|
|
31123
|
-
updatedCollectionIds.push(def.collectionId);
|
|
31124
|
-
if (modifiedTieFormat && existingCollectionIds.includes(def.collectionId)) {
|
|
31125
|
-
compareTieFormats({
|
|
31126
|
-
descendant: modifiedTieFormat,
|
|
31127
|
-
ancestor: tieFormat
|
|
31128
|
-
})?.different && modifiedCollectionDefinitions.push(def);
|
|
31129
|
-
} else {
|
|
31130
|
-
addedCollectionDefinitions.push(def);
|
|
31131
|
-
}
|
|
31132
|
-
});
|
|
31201
|
+
const updatedCollectionIds = modifiedTieFormat.collectionDefinitions.map(
|
|
31202
|
+
({ collectionId }) => collectionId
|
|
31203
|
+
);
|
|
31133
31204
|
const removedCollectionIds = existingCollectionIds.filter(
|
|
31134
31205
|
(collectionId) => !updatedCollectionIds.includes(collectionId)
|
|
31135
31206
|
);
|
|
31136
|
-
const
|
|
31207
|
+
const addedCollectionDefinitions = modifiedTieFormat.collectionDefinitions.filter(
|
|
31208
|
+
({ collectionId }) => !existingCollectionIds.includes(collectionId)
|
|
31209
|
+
);
|
|
31210
|
+
const modifications = [];
|
|
31137
31211
|
let processedTieFormat;
|
|
31138
|
-
for (const collectionDefinition of
|
|
31212
|
+
for (const collectionDefinition of modifiedTieFormat.collectionDefinitions) {
|
|
31139
31213
|
const result2 = modifyCollectionDefinition$1({
|
|
31140
31214
|
updateInProgressMatchUps,
|
|
31141
31215
|
...collectionDefinition,
|
|
31142
31216
|
tournamentRecord,
|
|
31143
31217
|
drawDefinition,
|
|
31144
|
-
tieFormatName,
|
|
31145
31218
|
structureId,
|
|
31146
31219
|
matchUpId,
|
|
31147
31220
|
eventId,
|
|
31148
31221
|
event
|
|
31149
31222
|
});
|
|
31223
|
+
if (result2.modifications)
|
|
31224
|
+
modifications.push(...result2.modifications);
|
|
31150
31225
|
if (result2.error)
|
|
31151
31226
|
return decorateResult({ result: result2, stack });
|
|
31152
31227
|
if (result2.tieFormat)
|
|
31153
31228
|
processedTieFormat = result2.tieFormat;
|
|
31154
31229
|
}
|
|
31230
|
+
const tieFormatName = modifiedTieFormat.tieFormatName;
|
|
31155
31231
|
for (const collectionDefinition of addedCollectionDefinitions) {
|
|
31156
31232
|
const result2 = addCollectionDefinition$1({
|
|
31157
31233
|
updateInProgressMatchUps,
|
|
@@ -31190,10 +31266,20 @@ function modifyTieFormat$1({
|
|
|
31190
31266
|
if (result2.tieFormat)
|
|
31191
31267
|
processedTieFormat = result2.tieFormat;
|
|
31192
31268
|
}
|
|
31269
|
+
const changedTieFormatName = existingTieFormat?.tieFormatName !== tieFormatName;
|
|
31270
|
+
if (changedTieFormatName) {
|
|
31271
|
+
processedTieFormat.tieFormatName = tieFormatName;
|
|
31272
|
+
modifications.push({ tieFormatName });
|
|
31273
|
+
} else if (modifications.length) {
|
|
31274
|
+
delete processedTieFormat.tieFormatName;
|
|
31275
|
+
modifications.push(
|
|
31276
|
+
"tieFormatName removed: modifications without new tieFormatName"
|
|
31277
|
+
);
|
|
31278
|
+
}
|
|
31193
31279
|
processedTieFormat.collectionDefinitions = processedTieFormat.collectionDefinitions.sort(
|
|
31194
31280
|
(a, b) => numericSortValue(a.collectionOrder) - numericSortValue(b.collectionOrder)
|
|
31195
31281
|
).map((def, i) => ({ ...def, collectionOrder: i + 1 }));
|
|
31196
|
-
return { ...SUCCESS, processedTieFormat };
|
|
31282
|
+
return { ...SUCCESS, processedTieFormat, modifications };
|
|
31197
31283
|
}
|
|
31198
31284
|
|
|
31199
31285
|
function modifyTieFormat(params) {
|