dartway_core_shared 0.20.0
dartway_core_shared: ^0.20.0 copied to clipboard
The shared contract of DartWay: DTO kinds, results and refusals, channels and the wire protocol spoken between a DartWay server and its clients.
Changelog #
0.20.0 #
- First publication of the rewrite to pub.dev.
0.20.0-dev.4 #
- BREAKING (wire): the project's contract decides which apps a server serves (#296, D-084).
DwWireProtocol(contractVersion:)carries the shared package'sversion:, written by the generator;DwContractVersioncompares breaking lines — the major version, or the minor below 1.0.Dw-Contract-Version(and?contract=on the socket) carries it; a client of an older line is answered426withdw.updateRequired.dwProtocolVersionis 2: every installed app is shown the update screen once.Dw-App-Versionstays, as the label of a session key. Migration note:docs/migrations/2026-09-24-contract-version.md.
0.20.0-dev.3 #
- Nothing changed here; the family moves in lockstep with
dartway_core_flutter.
0.20.0-dev.2 #
DwIdentifierKind.of(identifier)(#283): the framework's one rule for which kind an identifier is — an@makes it an e-mail, anything else a phone. It lived as private copies inDwFirstAdministrator, the Studio binding and the skeleton, and every app signing in from a stored identifier wrote a fourth.
0.20.0-dev.1 #
The rewrite (see docs/1.0).
-
Writing the
unknownof an open enum throwsDwUnknownEnumWrite, not a bareStateError(D-071). The guarantee is unchanged — no build overwrites a value it did not know — but a type the call layer can catch is what lets the server answer it asdw.updateRequiredinstead of reporting an incident. -
DwDeleteMyAccount— the built-in command that deletes the caller's account (D-072). -
DwOpenEnum, and unknown enum names as newer data (D-071).DwJsonCodec.decodeEnumthrowsDwUnknownEnumValue(aFormatException) for a name a strict enum does not have, and reads it asunknownfor an enumwith DwOpenEnum;DwJsonCodec.encodeEnumrefuses to writeunknown. -
DwFieldPatch.applyis an extension (DwFieldPatchApply).const DwFieldPatch.clear()or.keep()whereTcannot be inferred — a conditional in a generic function — is aDwClearField<Never>, and the memberapplyfailed at run time with "String is not a subtype of Null". Resolved by the static type, it applies to a value of the declared type. A library that re-exportsDwFieldPatchby ashowlist must showDwFieldPatchApplytoo. -
Identity and session key DTOs (D-042, D-045). Built into
DwWireProtocol.core:DwRequestIdentifierCode(kind, identifier)→DwCodeTicketandDwConfirmIdentifier(ticketId, code, replace)→DwIdentityInfo— attach or change an identifier by one-time code while signed in; data objectsDwIdentityInfo(id, accountId, kind, value, createdAt, verifiedAt) andDwSessionKeyInfo(id, accountId, kind, label, createdAt, lastUsedAt, revokedAt — never a token);DwSessionKeyKind { app, personal };DwAuthRefusal.identifierTaken(dw.identifierTaken), a separate enum fromDwCoreRefusal. -
Updates carry their channel (D-036). A response's
updatesare grouped by channel wire name, then by type —{"bookings:7": {"SessionBooking": [...]}, "schedule": {"ClubSession": [...]}}— and collapse by (channel, type, id):DwUpdateTransport(Iterable<(String, DwWireObject)>),channels,objectsOn(channel). One channel's type groups areDwChannelUpdates, the body of a liveupdmessage, which names its channel beside them. The channel is the only fact that says whose data an object is: routed by type alone, a member's profile in an admin's answer landed in the admin's own "my profile". -
Caller channels (D-037).
DwLiveChannel.ofCaller(kind)— a channel keyed by whoever watches — for "my" requests, which carry no account id;resolvedFor(accountId)andDwLiveChannel.forAccount(kind, accountId). An unresolved caller channel has nowireName(throwsStateError). -
DwTableRequestrefetches on a new matching object (D-037). Defaultmatches ? upsert : remove(newmatches, default every object): an object on the page is replaced in place; one not on the page, one that stops matching and a deletion read the page again, so the total and the paging stay true. -
File uploads (D-034): the wire half.
DwUploadPurpose— the mixin a project's purposes enum takes, as channels takeDwChannelKind. Built intoDwWireProtocol.core:DwStartUpload→DwUploadTicket(a presigned PUT, the headers it is bound to, its expiry),DwFinishUpload→DwStoredFile(with aurlonly when public),DwGetFileLink→DwFileLink(a single request: a read, retried freely, stores no outcome).DwStartUploadvalidates on both sides — a display name without control characters or path separators, a lower-case MIME type without parameters, a positive size — and carries nothing the server decides: the object key is built by the server.DwUploadRefusalholds the upload codes (dw.uploadPurposeUnknown,dw.uploadTooLarge,dw.uploadTypeRejected,dw.uploadMissing,dw.uploadMismatch,dw.uploadExpired,dw.fileNotOwned) in an enum of its own, so a project's exhaustive switch overDwCoreRefusalstill compiles. Ticket and linktoStringleave the presigned URL out.