persona-community-5/.pnpm-store/v3/files/37/b42c31a7903bbce11a4dc8a355ef63b0d82d359b67d49cfa50ad107547c6026683fd53625db9a455cf121c99e6906e7c10becb510821a7c4defb6f9697bdd2
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

34 lines
1.2 KiB
Plaintext

import type { Arazzo1Rule } from '../../visitors';
import type { UserContext } from '../../walk';
export const StepOnSuccessUnique: Arazzo1Rule = () => {
return {
OnSuccessActionList: {
enter(onSuccessActionList, { report, location }: UserContext) {
if (!onSuccessActionList) return;
const seenSuccessActions = new Set();
for (const onSuccessAction of onSuccessActionList) {
if (seenSuccessActions.has(onSuccessAction?.name)) {
report({
message: 'The action `name` must be unique amongst listed `onSuccess` actions.',
location: location.child([onSuccessActionList.indexOf(onSuccessAction)]),
});
}
if (seenSuccessActions.has(onSuccessAction?.reference)) {
report({
message: 'The action `reference` must be unique amongst listed `onSuccess` actions.',
location: location.child([onSuccessActionList.indexOf(onSuccessAction)]),
});
}
onSuccessAction?.name
? seenSuccessActions.add(onSuccessAction.name)
: seenSuccessActions.add(onSuccessAction.reference);
}
},
},
};
};