v0.19.0
Architecture-maturity minor. Gate-aware authorizer, unified event base
class with per-event broadcast opt-in, full batch cancel API, two new
artisan generators, and a polymorphic useUpload hook on Vue/React.
Added
AbstractChunkyEventbase class for the entire event pipeline. Every event extends it and gates broadcasting on a per-eventchunky.broadcasting.events.{Key}flag. The four "completion" events (UploadCompleted, UploadFailed, BatchCompleted, BatchPartiallyCompleted) keep their default-on behaviour; per-chunk and per-init events default to off because broadcasting them is expensive.- Batch cancel API. New
ChunkyManager::cancelBatch(), newBatchStatus::Cancelledenum case (already shipped in v0.18 carved out for forward-compat), newBatchCancelledevent, newDELETE /api/chunky/batch/{batchId}route viaCancelBatchController. The DB driver also cascades the cancel to every active per-file upload (each firesUploadCancelled); the FS driver leaves the per-file uploads to the cleanup sweep because there's no efficient batch-member walk on disk. UploadCancelledevent now fires fromChunkyManager::cancel(). Subscribers can clear progress UI, decrement counters, etc. without polling.- Gate-aware
DefaultAuthorizer. When the host application registers Gate abilitiesviewChunkyUpload,cancelChunkyUpload,viewChunkyBatch,cancelChunkyBatch, the authorizer defers to them. Falls back to the existing ownership rule when no Gate is registered. Lets you express admin / team / shared-batch rules fromAuthServiceProviderwithout subclassing. canCancelUpload()/canCancelBatch()on theAuthorizercontract. Defaults to the access answer inDefaultAuthorizer; override in custom authorizers when cancel/delete needs tighter rules than read access.chunky.authorization.allow_anonymousconfig flag (default true). Set to false to refuse anonymous access even when the upload has no recordeduserId. Opt-in because flipping it on legacy setups breaks unauthenticated reads.make:chunky-contextartisan generator. Stubs out anapp/Chunky/<Name>Context.phpextendingChunkyContext, with placeholders forname()/rules()/save(). Replaces hand-writing the boilerplate from the README.make:chunky-authorizerartisan generator. Stubs out anapp/Chunky/<Name>Authorizer.phpimplementing the fullAuthorizercontract, plus a service-provider binding example in a trailing comment.useUploadpolymorphic hook on Vue 3 (@netipar/chunky-vue3) and React (@netipar/chunky-react). Accepts a singleFileorFile[]— internally backed byuseBatchUploadbecause every upload is a batch of N. Prefer this overuseChunkUpload/useBatchUploadfor new code; the two specific composables remain for back-compat.JsonObject/JsonValue/JsonPrimitivetypes exported from@netipar/chunky-core. TheuseUploadmetadata signature usesJsonObject, narrowing what TypeScript will accept (noDate,Map,Set, class instances) so the wire format actually matches the type.
Changed (breaking)
Authorizercontract gained two methods (canCancelUpload,canCancelBatch). Custom implementations need to add them — the default behaviour is "same as access" so simply forwarding to the existing access methods is the minimal migration.UploadFailed/UploadCompletedetc. extendAbstractChunkyEventinstead of using their ownDispatchable + ShouldBroadcastsetup. Behaviour is unchanged for the default broadcast set; custom code that exhaustivelyinstanceof-checks individual events still works.
Documentation
- Configuration recipes in
examples/en/configuration.mdcover the newauthorizationnamespace and the per-eventbroadcasting.eventsmap.
npm packages
- All packages bumped to
0.19.0(frontend additions —useUpload,JsonObjecttypes).