Skip to content

Sdcisa-20256 typescript hooks - #783

Open
NoApiManagement wants to merge 37 commits into
swisspost:developfrom
NoApiManagement:SDCISA-20256-typescript-hooks
Open

Sdcisa-20256 typescript hooks#783
NoApiManagement wants to merge 37 commits into
swisspost:developfrom
NoApiManagement:SDCISA-20256-typescript-hooks

Conversation

@NoApiManagement

@NoApiManagement NoApiManagement commented Aug 4, 2026

Copy link
Copy Markdown

Create typescript hooks with features equivalent to the hooksjs

holtzsi added 18 commits July 14, 2026 15:10
* force the user to specify fetch
* the user should not be forced to unsubscribe from each topic, a dispose() shall cover any open topics
* get the build to work "mvn install -pl gateleen-hook-ts -am -DskipTests"
* Awaitility's await().until(supplier, matcher) doesn't retry when the supplier throws, so findElement() calls abort immediately instead of polling until the <li> renders. This pre-existing bug affected both HookJsSteps and HookTsSteps. Add .ignoreExceptions() (and bump timeout to five seconds) so the checks actually retry.
* better angular example readme.md
* was using internal artefactory possibly due to package-lock.json ...
* extract methods for readability
* add prettier
* explicitly ignore package-lock.json
@NoApiManagement NoApiManagement changed the title Sdcisa 20256 typescript hooks Sdcisa-20256 typescript hooks Aug 4, 2026
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.33%. Comparing base (2ddede3) to head (79787df).
⚠️ Report is 38 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #783      +/-   ##
=============================================
+ Coverage      49.68%   50.33%   +0.65%     
- Complexity      2047     2094      +47     
=============================================
  Files            244      244              
  Lines          12908    13013     +105     
  Branches        1396     1414      +18     
=============================================
+ Hits            6413     6550     +137     
+ Misses          5894     5848      -46     
- Partials         601      615      +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@NoApiManagement
NoApiManagement marked this pull request as ready for review August 5, 2026 07:53
holtzsi added 4 commits August 5, 2026 16:05
* the fetch was using / instead of getting the type of fetch from the user.
* union type is more usable than enum.
* Fix hook parity gaps vs. gateleen-hook-js: send x-expire-after header on
  registration, correct expireAfter body field, and queue live events
  during the initial fetch to prevent them racing ahead of it
* Deregister a hook on eventbus delivery error instead of silently
  swallowing it (fail-fast, consistent with registration/fetch error handling)
* Extract listen() into PendingEventBuffer, createDispatcher() and
  createMessageHandler() to keep it readable
Comment thread gateleen-hook-js/.gitignore Outdated
Comment thread gateleen-hook-js/README.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That file looks a bit mis-placed. I assume there is some "totally obvious" reason it is in the hook-js module and not in the hook-ts one?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

2 "Reasons", but I moved it into the hooks-ts as they where not so good anyway.
hooks-js is before hooks-ts, so if they failed the instructions would have been helpful there already.
hooks-ts already has a README.md, so if you don't run the tests manually but let an agent run them then it takes a tiny bit more tokens...

But as if in the future we ever remove the JS part then it makes sense to have it in the TS part anyway...

Comment thread gateleen-hook-ts/README.md Outdated
Comment thread gateleen-hook-ts/README.md Outdated
Comment thread gateleen-hook-ts/README.md Outdated
Comment thread gateleen-hook-ts/src/event-bus-service.spec.ts Outdated

service.getEventBus().onopen?.();

await Promise.resolve();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

await Promise.resolve()
WTF?!? - Should we at least explain (comment) why we do this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks! that comment made me find a few flaws in the testing... I added a comment in the code.

Flush the microtask queue (a lighter weight version of await new Promise(r => setTimeout(r, 0)) ).

Comment thread gateleen-hook-ts/.gitignore Outdated
Comment thread gateleen-hook-ts/src/hook-service.ts Outdated
Comment thread gateleen-hook-ts/src/hook-service.ts
holtzsi added 11 commits August 7, 2026 09:22
* move the testing instructions into the ts README.md
* remove global this
* remove uneeded examples
* set the dependency version exactly
* also use the explicit versions in devDependencies and user newer versions
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