Codebook export secondary entry points#177
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38e31242d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| Missing, | ||
| UnitPropertiesForCodebook | ||
| } from '@iqb/ngx-coding-components/codebook-models'; | ||
| import { CodebookDocxGenerator } from './codebook-docx-generator.class'; |
There was a problem hiding this comment.
Keep JSON exports from requiring DOCX dependencies
Because docx, cheerio, and buffer are declared optional peers, a consumer can install this package for JSON-only generation without them. This top-level import evaluates the DOCX generator, which imports docx/cheerio, as soon as @iqb/ngx-coding-components/codebook-generator is imported, so even generateCodebook(..., { exportFormat: 'json' }) fails module resolution before the exportFormat branch runs. Lazy-load the DOCX generator only in the DOCX path or make those peers required.
Useful? React with 👍 / 👎.
| this.codebookPollingSubscription = interval(1500) | ||
| .pipe( | ||
| takeUntil(this.destroy$), | ||
| switchMap(() => provider.getJobStatus!(jobId)) |
There was a problem hiding this comment.
Avoid cancelling slow status polls
With HTTP-backed providers whose getJobStatus call takes longer than the 1.5s interval, switchMap unsubscribes from the in-flight request on every tick before it can emit. In that environment the UI can remain pending forever and never reach the completed/failed handlers even after the job finishes; use exhaustMap, concatMap, or otherwise wait for each poll to complete before starting the next one.
Useful? React with 👍 / 👎.
a534ef6 to
2ee07c1
Compare
Replaces #129.\n\n## Summary\n- move the codebook UI, generator, and shared models into dedicated secondary entry points\n- keep docx/cheerio/buffer out of the top-level package entry point\n- add provider-based export handling, generator tests, and shared model exports\n\n## Validation\n- npm run build_cc\n- npm run lint\n- CI=true npm run test:coverage\n- GitHub CI: https://github.com/iqb-berlin/coding-components/actions/runs/27618697101