Skip to content

Expose CpsCronValidationService publicly via an InjectionToken#604

Open
fateeand wants to merge 2 commits intomasterfrom
602-expose-cronvalidationservice-publicly-via-an-injectiontoken
Open

Expose CpsCronValidationService publicly via an InjectionToken#604
fateeand wants to merge 2 commits intomasterfrom
602-expose-cronvalidationservice-publicly-via-an-injectiontoken

Conversation

@fateeand
Copy link
Copy Markdown
Collaborator

@fateeand fateeand commented May 7, 2026

Overview

  1. Renamed CronValidationService to CpsCronValidationService
  2. Moved it from cps-ui-kit/src/lib/services/cron-validation.service.ts to cps-ui-kit/src/lib/services/cps-cron-validation/cps-cron-validation.service.ts
  3. Created CPS_CRON_VALIDATION_SERVICE injection token, so it can be reimplemented/disabled by consumer apps
  4. Injected the token to CpsSchedulerComponent
  5. Exposed it through public-api.ts
  6. Added the service API to the Scheduler component page in the composition app

Release notes:

  • Publicly exposing CpsCronValidationService via an InjectionToken

Copilot AI review requested due to automatic review settings May 7, 2026 17:21
@fateeand fateeand linked an issue May 7, 2026 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Coverage report for library

St.
Category Percentage Covered / Total
🔴 Statements 30.01% 2062/6870
🔴 Branches 23.91% 750/3137
🔴 Functions 26.13% 380/1454
🔴 Lines 30.81% 1947/6320

Test suite run success

457 tests passing in 22 suites.

Report generated by 🧪jest coverage report action from 5849008

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes the cron validation logic in cps-ui-kit publicly consumable and overrideable by exposing CpsCronValidationService via a root-provided InjectionToken, and updates the composition app to document the service (including tokens) in the scheduler docs.

Changes:

  • Renamed/moved the cron validation service to CpsCronValidationService and exported it from cps-ui-kit’s public API.
  • Introduced CPS_CRON_VALIDATION_SERVICE token and updated CpsSchedulerComponent to inject the token instead of the concrete service.
  • Extended the docs generation + composition docs viewer to display service “Tokens” alongside service methods.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
projects/cps-ui-kit/src/public-api.ts Exports the cron validation service (and its token) publicly.
projects/cps-ui-kit/src/lib/services/cps-cron-validation/cps-cron-validation.service.ts Renames service and adds CPS_CRON_VALIDATION_SERVICE injection token.
projects/cps-ui-kit/src/lib/services/cps-cron-validation/cps-cron-validation.service.spec.ts Updates tests for renamed service and adds token behavior coverage.
projects/cps-ui-kit/src/lib/components/cps-scheduler/cps-scheduler.component.ts Switches scheduler to inject the cron validation token.
projects/composition/src/app/pages/scheduler-page/scheduler-page.component.ts Adds service API JSON data for scheduler page docs.
projects/composition/src/app/pages/scheduler-page/scheduler-page.component.html Passes services into the docs viewer.
projects/composition/src/app/models/service-api.model.ts Extends docs model to support service tokens.
projects/composition/src/app/components/component-docs-viewer/component-docs-viewer.component.ts Adds services input and tooltip directive import for service docs rendering.
projects/composition/src/app/components/component-docs-viewer/component-docs-viewer.component.html Renders service methods and tokens tables in the API tab.
projects/composition/src/app/api-data/cps-notification.json Updates generated method description wording.
projects/composition/src/app/api-data/cps-dialog.json Updates generated method description wording.
projects/composition/src/app/api-data/cps-cron-validation.json Updates service name and documents the new injection token.
api-generator/api-generator.js Adds generation support for “Tokens” group + tweaks method description wording.
Comments suppressed due to low confidence (1)

projects/cps-ui-kit/src/lib/services/cps-cron-validation/cps-cron-validation.service.ts:501

  • CPS_CRON_VALIDATION_SERVICE is typed as InjectionToken<CpsCronValidationService>, which forces consumers to treat the injected value as the concrete class even though the intent is to allow replacement/disablement. Consider exporting a minimal public interface (e.g. with isValidCron) and typing the token as InjectionToken<ThatInterface>, with CpsCronValidationService implementing it, so overrides are type-safe and don’t imply class inheritance.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Playwright test results

passed  56 passed

Details

stats  56 tests across 4 suites
duration  1 minute, 47 seconds
commit  5849008
info  For details, download the Playwright report

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.

Expose CpsCronValidationService publicly via an InjectionToken

2 participants