@superbuilders/primer-tives 5.0.4 → 6.0.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/README.md +39 -27
- package/dist/client/auth-state.d.ts +4 -2
- package/dist/client/auth-state.d.ts.map +1 -1
- package/dist/client/choice-state.d.ts +2 -2
- package/dist/client/choice-state.d.ts.map +1 -1
- package/dist/client/extended-text-state.d.ts +8 -3
- package/dist/client/extended-text-state.d.ts.map +1 -1
- package/dist/client/feedback-state.d.ts +3 -3
- package/dist/client/feedback-state.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +376 -106
- package/dist/client/index.js.map +19 -17
- package/dist/client/journey.d.ts +13 -0
- package/dist/client/journey.d.ts.map +1 -0
- package/dist/client/match-state.d.ts +2 -2
- package/dist/client/match-state.d.ts.map +1 -1
- package/dist/client/mode.d.ts +5 -0
- package/dist/client/mode.d.ts.map +1 -0
- package/dist/client/observation-state.d.ts +2 -2
- package/dist/client/observation-state.d.ts.map +1 -1
- package/dist/client/order-state.d.ts +2 -2
- package/dist/client/order-state.d.ts.map +1 -1
- package/dist/client/pci-state.d.ts +2 -2
- package/dist/client/pci-state.d.ts.map +1 -1
- package/dist/client/session-context.d.ts +1 -0
- package/dist/client/session-context.d.ts.map +1 -1
- package/dist/client/session.d.ts +4 -2
- package/dist/client/session.d.ts.map +1 -1
- package/dist/client/start.d.ts +3 -0
- package/dist/client/start.d.ts.map +1 -1
- package/dist/client/text-entry-state.d.ts +7 -3
- package/dist/client/text-entry-state.d.ts.map +1 -1
- package/dist/client/transport.d.ts +9 -2
- package/dist/client/transport.d.ts.map +1 -1
- package/dist/client/types.d.ts +59 -12
- package/dist/client/types.d.ts.map +1 -1
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +13 -32
- package/dist/contracts/index.js.map +3 -3
- package/dist/contracts/types.d.ts +3 -20
- package/dist/contracts/types.d.ts.map +1 -1
- package/dist/contracts/validation.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/contracts/index.js
CHANGED
|
@@ -6564,33 +6564,6 @@ function findUnknownIds(values, choices) {
|
|
|
6564
6564
|
return !ids.has(value);
|
|
6565
6565
|
});
|
|
6566
6566
|
}
|
|
6567
|
-
function countByIdentifier(pairs, side) {
|
|
6568
|
-
const counts = new Map;
|
|
6569
|
-
for (const pair of pairs) {
|
|
6570
|
-
const key = pair[side];
|
|
6571
|
-
const currentCount = counts.get(key);
|
|
6572
|
-
if (currentCount === undefined) {
|
|
6573
|
-
counts.set(key, 1);
|
|
6574
|
-
continue;
|
|
6575
|
-
}
|
|
6576
|
-
counts.set(key, currentCount + 1);
|
|
6577
|
-
}
|
|
6578
|
-
return counts;
|
|
6579
|
-
}
|
|
6580
|
-
function validateUsageBounds(choices, counts, side) {
|
|
6581
|
-
const issues2 = [];
|
|
6582
|
-
for (const choice of choices) {
|
|
6583
|
-
const maybeCount = counts.get(choice.identifier);
|
|
6584
|
-
const count = maybeCount === undefined ? 0 : maybeCount;
|
|
6585
|
-
if (choice.matchMax !== 0 && count > choice.matchMax) {
|
|
6586
|
-
issues2.push(`${side} '${choice.identifier}' used ${count} times, max ${choice.matchMax}`);
|
|
6587
|
-
}
|
|
6588
|
-
if (count < choice.matchMin) {
|
|
6589
|
-
issues2.push(`${side} '${choice.identifier}' used ${count} times, min ${choice.matchMin}`);
|
|
6590
|
-
}
|
|
6591
|
-
}
|
|
6592
|
-
return issues2;
|
|
6593
|
-
}
|
|
6594
6567
|
function pciSubmissionSchema(pciId) {
|
|
6595
6568
|
switch (pciId) {
|
|
6596
6569
|
case "urn:primer:pci:fraction-input":
|
|
@@ -6684,6 +6657,18 @@ function validateMatch(interaction, submission) {
|
|
|
6684
6657
|
if (duplicatePairs.length > 0) {
|
|
6685
6658
|
issues2.push("duplicate associations are not allowed");
|
|
6686
6659
|
}
|
|
6660
|
+
const duplicateSources = duplicates(submission.pairs, function keyOf(pair) {
|
|
6661
|
+
return pair.source;
|
|
6662
|
+
});
|
|
6663
|
+
if (duplicateSources.length > 0) {
|
|
6664
|
+
issues2.push(`duplicate sources: ${duplicateSources.join(", ")}`);
|
|
6665
|
+
}
|
|
6666
|
+
const duplicateTargets = duplicates(submission.pairs, function keyOf(pair) {
|
|
6667
|
+
return pair.target;
|
|
6668
|
+
});
|
|
6669
|
+
if (duplicateTargets.length > 0) {
|
|
6670
|
+
issues2.push(`duplicate targets: ${duplicateTargets.join(", ")}`);
|
|
6671
|
+
}
|
|
6687
6672
|
const sourceIds = new Set(interaction.sourceChoices.map(function getId(choice) {
|
|
6688
6673
|
return choice.identifier;
|
|
6689
6674
|
}));
|
|
@@ -6698,10 +6683,6 @@ function validateMatch(interaction, submission) {
|
|
|
6698
6683
|
issues2.push(`unknown target '${pair.target}'`);
|
|
6699
6684
|
}
|
|
6700
6685
|
}
|
|
6701
|
-
const sourceCounts = countByIdentifier(submission.pairs, "source");
|
|
6702
|
-
const targetCounts = countByIdentifier(submission.pairs, "target");
|
|
6703
|
-
issues2.push(...validateUsageBounds(interaction.sourceChoices, sourceCounts, "source"));
|
|
6704
|
-
issues2.push(...validateUsageBounds(interaction.targetChoices, targetCounts, "target"));
|
|
6705
6686
|
return issues2;
|
|
6706
6687
|
}
|
|
6707
6688
|
function validatePortableCustom(interaction, submission) {
|
|
@@ -6774,4 +6755,4 @@ export {
|
|
|
6774
6755
|
ChoiceSubmissionSchema
|
|
6775
6756
|
};
|
|
6776
6757
|
|
|
6777
|
-
//# debugId=
|
|
6758
|
+
//# debugId=5D8B00487076F04164756E2164756E21
|