Skip to content

feat: add Jobs/Scheduler client API (Alpha1)#771

Open
nelson-parente wants to merge 2 commits intodapr:mainfrom
nelson-parente:feat/jobs-client
Open

feat: add Jobs/Scheduler client API (Alpha1)#771
nelson-parente wants to merge 2 commits intodapr:mainfrom
nelson-parente:feat/jobs-client

Conversation

@nelson-parente
Copy link
Copy Markdown
Contributor

Summary

  • Add the Jobs/Scheduler building block client for both gRPC and HTTP transports
  • schedule() — create or update a scheduled job
  • get() — retrieve a job definition by name
  • delete() — delete a job by name
  • All APIs are Alpha1, matching the Go SDK implementation
  • Includes unit tests for HTTP transport

Part 1 of 2 — see #769 (stacked) for the server callback handler.

Implementation Details

  • Types: Job, ScheduleJobRequest, JobFailurePolicy, JobEvent
  • gRPC: uses ConnectRPC scheduleJobAlpha1/getJobAlpha1/deleteJobAlpha1
  • HTTP: uses v1.0-alpha1/jobs/{name} routes (name in URL, not body)
  • JobFailurePolicy supports drop and constant retry strategies
  • data field serialized as google.protobuf.Any (JSON)

Test plan

  • tsc --noEmit passes (zero type errors)
  • Unit tests for HTTP client (schedule, get, delete, failure policies)
  • CI validates full test suite
  • E2E tests deferred to P7

Relates to #667.

Signed-off-by: Nelson Parente nelson_parente@live.com.pt

Add the Jobs building block client for both gRPC and HTTP transports:
- schedule() — create or update a scheduled job
- get() — retrieve a job definition by name
- delete() — delete a job by name

All APIs are Alpha1, matching the Go SDK's implementation.
Includes unit tests for HTTP transport.

Relates to dapr#667.

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 0% with 136 lines in your changes missing coverage. Please review.
✅ Project coverage is 30.26%. Comparing base (d1bf38a) to head (eb3eb70).
⚠️ Report is 64 commits behind head on main.

Files with missing lines Patch % Lines
src/implementation/Client/GRPCClient/jobs.ts 0.00% 79 Missing ⚠️
src/implementation/Client/HTTPClient/jobs.ts 0.00% 53 Missing ⚠️
src/implementation/Client/DaprClient.ts 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              main     #771       +/-   ##
============================================
- Coverage   100.00%   30.26%   -69.74%     
============================================
  Files            1      140      +139     
  Lines            6     3853     +3847     
  Branches         1      605      +604     
============================================
+ Hits             6     1166     +1160     
- Misses           0     2639     +2639     
- Partials         0       48       +48     

☔ View full report in Codecov by Sentry.
📢 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.

- Remove typeUrl from AnySchema (match other building blocks' pattern)
- fromProtoJob: fallback to string not raw Uint8Array on parse failure
- fromProtoJob: check value.length to handle empty Uint8Array
- parseDurationSeconds: throw on unrecognized format instead of silent 0
- parseDurationSeconds: use matchAll to avoid g-flag lastIndex issues
- Duration round-trip: always use seconds format for simplicity

Signed-off-by: Nelson Parente <nelson_parente@live.com.pt>
@WhitWaldo
Copy link
Copy Markdown
Contributor

@nelson-parente This is something already in progress by @atrauzzi in #688 - I've sought a status update on that one and will revisit this later should it not be something they're interested in pursuing.

@WhitWaldo
Copy link
Copy Markdown
Contributor

Also, regardless, the Jobs API is moving to stable in 1.18, so this should retarget the stable methods/types.

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