Skip to content

Feat DF-388: Adapter V1 formatter #174

Merged
mokhld merged 12 commits intomainfrom
feat-listener-integration
Aug 27, 2025
Merged

Feat DF-388: Adapter V1 formatter #174
mokhld merged 12 commits intomainfrom
feat-listener-integration

Conversation

@mokhld
Copy link
Copy Markdown
Contributor

@mokhld mokhld commented Aug 21, 2025

Proposed change

Jira ticket: https://eaflood.atlassian.net/browse/DF-388

Type of change

This PR introduces a new adapter V1 formatter and relevant types to be consumed by Runner and the Adapter.

  • Bug fix
  • New feature
  • Breaking change
  • Misc. (documentation, build updates, etc)

Checklist

  • You have executed this code locally and it performs as expected.
  • You have added tests to verify your code works.
  • You have added code comments and JSDoc, where appropriate.
  • There is no commented-out code.
  • You have added developer docs in README.md and docs/* (where appropriate, e.g. new features).
  • The tests are passing (npm run test).
  • The linting checks are passing (npm run lint).
  • The code has been formatted (npm run format).

) {
// No-op: Notification functionality has been moved to another service
// TODO: come back to this
return Promise.resolve()
Copy link
Copy Markdown
Contributor

@alexluckett alexluckett Aug 21, 2025

Choose a reason for hiding this comment

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

One of these output services could be the one that drops it on SNS?

Copy link
Copy Markdown
Contributor Author

@mokhld mokhld Aug 21, 2025

Choose a reason for hiding this comment

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

Hmm. My thinking is that we could provide an outputService in Runner that we could inject into the plugin and override it which I suppose has a cleaner separation of concerns and Runner still controls its own logic. Happy to discuss the approach if there's a better alternative.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

having in engine would be nice if other teams wanted to use it, great idea to the use the output service though.

Comment thread src/server/plugins/engine/services/notifyService.ts
timestamp: now.toISOString(),
referenceNumber: context.referenceNumber,
definition: model.def
formId: model.def.name,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we need to leave v1 and v2 and add a new output formatter. I don't know where you can getformId from, but it is the FormMetadata.id: model/src/form/form-metadata/types.ts line 101

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. We're creating a separate output service that will use the machine v2 formatter.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we'll need to leave v2 intact, as our schema will change slightly - removing definition would be a breaking change. The new output service can use the new output formatter

@mokhld mokhld force-pushed the feat-listener-integration branch from e6bd218 to 993e6ce Compare August 21, 2025 17:51
@mokhld mokhld force-pushed the feat-listener-integration branch from 993e6ce to d7f4b93 Compare August 21, 2025 18:05
@mokhld mokhld force-pushed the feat-listener-integration branch from 34683f0 to 7289e09 Compare August 22, 2025 11:24
Comment thread src/server/plugins/engine/outputFormatters/index.ts Outdated
Comment thread src/server/plugins/engine/outputFormatters/machine/v3.ts Outdated
Comment thread src/server/plugins/engine/outputFormatters/machine/v3.ts Outdated
Comment thread src/server/plugins/engine/services/notifyService.ts
@mokhld mokhld force-pushed the feat-listener-integration branch from 90368d3 to cf23a18 Compare August 22, 2025 14:55
'2': formatMachineV2
},
adapter: {
'1': formatMachineV3
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would it be worth changing this name to formatAdapterV1 to avoid confusion?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good shout. I've created a new folder under /ouputFormatters/adapter/v1.ts to be more descriptive.

Comment thread package.json
@mokhld mokhld force-pushed the feat-listener-integration branch from 655592e to 383900c Compare August 26, 2025 15:33
@mokhld mokhld changed the title WIP: Feature listener integration Feat DF-388: Adapter V1 formatter Aug 27, 2025
@mokhld mokhld marked this pull request as ready for review August 27, 2025 09:00
Copy link
Copy Markdown
Contributor

@whitewaterdesign whitewaterdesign left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the coverage :). Just question about where to whether to put SNS publishing here or in runner, but will leave this to @alexluckett

Comment thread src/server/plugins/engine/services/notifyService.ts
formMetadata?: FormMetadata
) {
if (!templateId) {
return Promise.resolve()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

any reason we're resolving the promise here, not throwing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The service is optional and should silently fail if it isn't configured.

@sonarqubecloud
Copy link
Copy Markdown

@mokhld mokhld merged commit 182794c into main Aug 27, 2025
9 checks passed
@mokhld mokhld deleted the feat-listener-integration branch August 27, 2025 14:29
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.

3 participants