feat(actors): Implement UnregisterActorRemindersByType for bulk reminder cleanup
- Dominant language
- JavaScript
- Stars
- 217
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
The Dapr runtime exposes an `UnregisterActorRemindersByType` RPC (defined in `dapr.proto` line 103) that unregisters all reminders for a given actor type, optionally scoped to a specific actor instance. The JS SDK does not currently implement this method.
## Motivation
- **SDK parity:** Other Dapr SDKs expose this capability.
- **Operational cleanup:** Enables bulk removal of reminders during actor type deprecation, scaling events, or testing cleanup.
- **Reduced boilerplate:** Without this, users must enumerate reminders via `ListActorReminders` and individually unregister each one.
## Proto Definition
From `src/proto/dapr/proto/runtime/v1/actors.proto`:
```protobuf
// UnregisterActorRemindersByTypeRequest is the message to unregister an actor
// reminders by the given type. Optional actor_id can be provided to limit the
// scope of the operation to a specific actor instance.
message UnregisterActorRemindersByTypeRequest {
string actor_type = 1;
optional string actor_id = 2;
}
message UnregisterActorRemindersByTypeResponse {}
```
## Proposed API Surface
```ts
// IClientActor interface addition:
unregisterActorRemindersByType(actorType: string, actorId?: ActorId): Promise;
```
## Implementation Notes
- gRPC path: Call UnregisterActorRemindersByType on the Dapr service via ConnectRPC client.
- HTTP path: `DELETE /v1.0/actors/{actorType}/reminders` (with optional `?actorId=` query param — verify against Dapr runtime HTTP API).
- The actor_id parameter is optional. When provided, only reminders for that specific actor instance are removed. When omitted, all reminders for the entire actor type are removed — this should be clearly documented as a potentially destructive operation.
## Acceptance Criteria
- [ ] `unregisterActorRemindersByType` added to `IClientActor` interface
- [ ] gRPC implementation
- [ ] HTTP implementation
- [ ] Unit tests
- [ ] E2E tests (register several reminders, bulk unregister, verify they're gone)
- [ ] Clear JSDoc documentation warning about the destructive nature when `actorId` is omitted
## References
- Dapr Actors API reference: [https://docs.dapr.io/reference/api/actors_api/](https://docs.dapr.io/reference/api/actors_api/)
- Proto: `src/proto/dapr/proto/runtime/v1/dapr.proto` line 103
- Messages: `src/proto/dapr/proto/runtime/v1/actors.proto` lines 160-168
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.