Repository navigation
v2.0.0 — Capability tiers: universal XCapability + Instance + ReadOnly
Highlights
A new capability API: universal XCapability + Instance + ReadOnly tiers. This is a breaking change (#40).
- Universal capability per building block.
DaprCapability.statereturnsStateCapability, which reaches any store:StateCapability.save(storeName, key, value). The same holds for publish, invoke (appIdper call), secrets, configuration, bindings, lock, crypto, workflow, actor, and, on the JVM, jobs and conversation. - Narrow by name with
instance(name). It returnsXCapability.Instance, bound to one resource:dapr.state.instance(store).get[T](key). - Narrow by authority with
ReadOnly. State, Secrets, Configuration, Jobs and Workflow haveX.ReadOnlyandX.Instance.ReadOnly. Narrowing a read-only capability by name stays read-only, which the compiler checks. - Actor has two levels:
ActorCapability.forType(actorType).instance(actorId). - Companion forwarders and accessors on every interface. For example,
StateCapability.Instance.save(key, v)uses the capability inusingscope, andStateCapability.ReadOnly.instance(store)returns the narrowed capability. - Handle-style sugar that respects the tiers:
WorkflowInstanceId:id.waitForCompletion(timeout)andid.getStatusneed onlyWorkflowCapability.ReadOnly;id.suspend(),id.terminate()and the other mutations needWorkflowCapability.JobName(JVM):name.get,name.scheduleOnce(...)andname.delete().
- One package per family:
dapr4s.state,dapr4s.invoke,dapr4s.workflowand so on. Cross-cutting types stay indapr4s.
Migrating from 1.x
- Add family imports, e.g.
import dapr4s.state.*, dapr4s.workflow.*. - Code that is bound to one store, inside a
DaprCapability.state(name) { ... }block, now usesStateCapability.Instance. For example,(using StateCapability)becomes(using StateCapability.Instance), andStateCapability.get(key)becomesStateCapability.Instance.get(key). dapr.state(name)becomesdapr.state.instance(name).dapr.actor(t)(id)becomesdapr.actor.forType(t).instance(id).- These types were removed:
Access*Capability,WorkflowInstanceCapability,ActorTypeCapabilityandJobCapability. - dapr4s-examples shows the full migration.
Features
- Universal /
Instance/ReadOnlycapability tiers for all building blocks; derivation macros require the narrowest tier (#40). - Tier-aware handle sugar on
WorkflowInstanceIdandJobName(#40). - One package per capability family (#40).
Fixes
- Scaladoc: 94 unresolved links fixed. JVM and Scala.js scaladoc now report 0 warnings.
Build / CI
- Fixed a silent hang in the Scala.js integration tests. scala-cli chose
__loader.jsinstead ofmain.jsas the Wasm test entry when its temp dir was on ext4. The test harness now runs scala-cli with its temp dir on tmpfs. Upstream fix: VirtusLab/scala-cli#4548. - scala-cli is pinned to 1.14.0, because newer versions with the Scala.js 1.22 linker cannot link
js.asyncon Wasm without a JSPI switch. The integration step now has a 20-minute timeout. - Publishes of the same version are serialized with a concurrency group.
Docs
- New
docs/CAPABILITY-HIERARCHY.md: one Mermaid class diagram per capability family. docs/CAPABILITY-SPLITS.md§11 describes the implemented design. DESIGN.md, README and SPEC.allium are updated, andallium checkreports 0 errors.