Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support execution listeners #168

Merged
merged 4 commits into from
Jul 31, 2024
Merged

feat: support execution listeners #168

merged 4 commits into from
Jul 31, 2024

Conversation

barmac
Copy link
Contributor

@barmac barmac commented Jul 23, 2024

Related to camunda/camunda-modeler#3951

Contains:

  • feat: add no-duplicate-execution-listeners rule - to prevent duplicates rejected by the engine
  • feat: add no-execution-listeners rule - to prevent usage with unsupported engine version
  • feat: add execution-listener rule - to ensure correct configuration

@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Jul 23, 2024
@barmac barmac force-pushed the execution-listeners branch 3 times, most recently from 5513a78 to 29b42cb Compare July 29, 2024 09:47
@barmac barmac marked this pull request as ready for review July 29, 2024 09:49
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Jul 29, 2024
@barmac barmac requested review from a team, philippfromme and jarekdanielak and removed request for a team July 29, 2024 09:49
@barmac barmac force-pushed the execution-listeners branch from 29b42cb to 3841463 Compare July 29, 2024 11:19
module.exports = skipInNonExecutableProcess(function() {
function check(node, reporter) {

console.log(node);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't want that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right 😅

return;
}

const errors = hasDuplicatedExecutionListeners(executionListeners, node);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's because duplication requires two duplicate properties instead of just one. We could still adjust the helper to allow multiple properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have considered this and decided against it due to the adjustment needed. If we have more cases like this, we may abstract it away, but right now I'd consider it YAGNI.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of using ERROR_TYPES.PROPERTY_VALUE_DUPLICATED and then duplicatedProperty: 'type' since it doesn't mention the event type at all. We should probably have a separate type PROPERTY_VALUES_DUPLICATED and include all the data necessary to create a custom error message.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just add a hasDuplicatedPropertiesValues helper that encapsulates the logic so the rule simply calls hasDuplicatedPropertiesValues(taskHeaders, 'listeners', [ 'eventType', 'type' ], node). 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philippfromme please have a look now.

Related to camunda/camunda-modeler#3951

feat: add `no-duplicate-execution-listeners` rule

feat: add `no-execution-listeners` rule

feat: add `execution-listener` rule
@barmac barmac force-pushed the execution-listeners branch from 897e806 to 1c0aa1f Compare July 30, 2024 07:31
Copy link
Collaborator

@philippfromme philippfromme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

@philippfromme philippfromme merged commit cf8d344 into main Jul 31, 2024
3 checks passed
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Jul 31, 2024
@philippfromme philippfromme deleted the execution-listeners branch July 31, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants