Skip to main content

zonai_client 0.3.8 copy "zonai_client: ^0.3.8" to clipboard
zonai_client: ^0.3.8 copied to clipboard

Typed Dart and Flutter client for a Zonai backend: auth, CRUD, file uploads, and live SQLite query streams over HTTP.

0.3.8 #

  • Allows zonai_schema 0.11.0 (>=0.10.0 <0.12.0), so a project can take the schema that adds Web Push without dropping the client. Nothing else changed.

0.3.7 #

  • cron.run returns what the run did. CronDataSource.run now returns a CronRunResult (name, ok, ms, and the rows written per table and action) instead of void. Callers that only awaited it are unaffected; a class that implements CronDataSource must change its return type. Needs the zonai CLI 0.16.0, which also lets an API token scoped to crons call it.
  • Streamed responses pass real errors on to the listener. The generated readers used to swallow every stream error; now they swallow only transport errors. Bytes that can't be framed as a message (stray bytes, or a connection cut mid-message) are still reported to the StreamFramingInterceptor's reporter and dropped, so a live stream keeps the messages around them and ends quietly as before.
  • photos.view takes an optional ifNoneMatch.
  • Requires zonai_schema 0.10.0, which defines CronRunResult.

0.3.6 #

  • auth.createHandoff and auth.exchangeHandoff sign in another client. A signed-in app calls createHandoff with the PKCE challenge of a secret only the other client (a command line, say) holds, and gets a one-time code good for five minutes. That client calls exchangeHandoff with the code and its verifier and gets a session of its own, which outlives the approving session's sign-out. Needs the zonai CLI 0.14.0.
  • Requires zonai_schema 0.9.0, which defines the handoff bodies.

0.3.5 #

  • db.batch writes across tables in one transaction. It sends a BatchBody to POST /db/batch (zonai CLI 0.13.2) and returns one BatchResult per step. The first failing step rolls the batch back and is thrown as that step's error; a failed expect is a PreconditionFailedException, as with update. The batch types are exported from this package.
  • auth.confirm throws MagicLinkReplacedException when the magic link was replaced by a newer one sent to the same address (401 magic_link_replaced). Nobody was signed in and the newer link still works.
  • Requires zonai_schema 0.8.4, which defines the batch types.

0.3.4 #

  • db.listen gets whole messages however the network splits them. The server writes each live-query update as one JSON object with no separator, and the generated /db/stream* readers decoded every network read as its own message and dropped the ones that failed. An update bigger than one read (about 1 KB, so any real list) arrived in pieces, every piece failed, and the listener never got it: the page never loaded and new rows never showed. Several small updates in one read were lost the same way. ZonaiClient now installs a StreamFramingInterceptor that re-chunks those responses into one whole JSON value each before they are decoded. Apps that worked around this with their own interceptor can drop it.
  • Live-stream errors are reported, not just swallowed. A message the stream ends inside of, bytes between messages that aren't JSON, and a failed connection are logged under the zonai_client name. To send them somewhere else, put a StreamFramingInterceptor(onError: ...) on the Server you pass to ZonaiClient.server.

0.3.3 #

  • Allows zonai_schema 0.8.0. The constraint is now >=0.6.0 <0.9.0. Nothing in this package changed; 0.8.0's breaking change is to how the server's extensions worker reports refusals, which the client never uses.

0.3.2 #

  • Allows zonai_schema 0.7.0. The constraint is now >=0.6.0 <0.8.0. Nothing in this package changed; 0.7.0's breaking change is to server-side SMTP config validation, which the client never uses.

0.3.1 #

  • ZonaiClient.server(...) sends the stored token. Only the default constructor registered the interceptor that adds Authorization: Bearer, so a client built with .server stored a token from auth.setToken and never sent it, and every call answered 403. .server now registers it too, unless the Server already has one.
  • The auth bodies and Jwt are exported. Auth.sendVerifyEmail takes a VerifyEmailAuthBody and Auth.sendResetPassword a SendResetPasswordAuthBody, but neither was reachable from package:zonai_client/zonai_client.dart, so an app had to depend on zonai_schema to ask for either email. Also newly exported: AdminSendResetPasswordAuthBody, ConfirmResetPasswordAuthBody, ConfirmVerifyEmailAuthBody, VerifyOtpAuthBody, VerifyMagicLinkAuthBody, EmailAddress, SendAdminInviteEmail, and Jwt, JwtId and UnknownId (what Auth.jwt returns). Additive.

0.3.0 #

  • Requires zonai_schema 0.6.0 (>=0.6.0 <0.7.0). Db.update's expect and the new exceptions come from it, and so does Paginated.total becoming int?. A list whose caller may not count every row now arrives without a total, so code that reads total as an int needs a null check.
  • Anonymous auth. signInAnonymously creates an account with no address and returns its session plus a credential to keep in secure storage. resumeAnonymous trades that credential for a new session. requestUpgrade and confirmUpgrade give the account a verified address and keep its id.
  • ServerException is exported. Every non-2xx response is thrown as one, so catching it used to need a direct dependency on revali_client, a transport detail. Now package:zonai_client/zonai_client.dart is enough. Additive.
  • PreconditionFailedException. Db.update and Db.updateMany throw it when the server refuses an update on its expect (412, precondition_failed); current carries the failing rows. Any other failure is rethrown unchanged. Additive.

0.2.4 #

  • The zonai_schema lower bound moves to >=0.5.0 (0.2.3 declared >=0.4.1, which was wrong). The generated client uses SpaceReclamationResult, first published in zonai_schema 0.5.0, and imports api_token_body.dart, first published in 0.4.2 — so 0.2.3 against a locked 0.4.x failed to compile with Error when reading '…/zonai_schema-0.4.1/lib/src/payloads/api_token_body.dart'. If you hit that, dart pub upgrade zonai_schema fixes it without this release. No API change.

0.2.3 #

  • Widen the zonai_schema constraint to >=0.4.1 <0.6.0 so consumers can move to zonai_schema 0.5.0. The published 0.2.2 declares <0.5.0, which excludes it — anyone using this client alongside zonai_schema would be pinned below 0.5.0 regardless of what they ask for. Nothing here references what changed in 0.5.0 (DevicePlatform.iosSandbox, routed server-side), so no API change.

0.2.2 #

  • The barrel now exports the query vocabulary, so a consumer can name the types the generated typed client takes and returns. zonai gen client emits code whose signatures are Where, Update, OrderByTerm and friends; before this, that code compiled only if the app also depended on zonai_schema directly and imported it by hand, which defeats the point of a generated client. Added: Where, Update, UpdateValue, ColumnUpdate, ObjectUpdate, OrderByTerm, SortDirection, the comparison and set clauses (Eq, Gt, Gte, Lt, Lte, In, NotIn, And, Or, Literal), the string clauses (Contains, NotContains, StartsWith, EndsWith), and the mutation values (Add, AddAll, Remove, RemoveAll, Increment, Decrement). Also newly exported are the data sources a typed client hangs off — Db, DbListen, AdminAuth, Emails, Photos. Purely additive; nothing was removed or renamed.
  • Null and NotNull are deliberately not exported, and this is the one place the addition is not mechanical. A library that imports them shadows dart:core's Null, because Dart resolves an explicit import ahead of the implicit dart:core one — so every Null written in that library would mean the where-clause class instead. Build those clauses with Where.isNull / Where.isNotNull (new in zonai_schema), which redirect to them. If you already import package:zonai_schema/payloads.dart directly and rely on Null, nothing changes for you.
  • The zonai_schema lower bound moves to >=0.4.1 (was >=0.1.0). It is load-bearing for the first time: Where.isNull / Where.isNotNull are the documented way to build the two clauses this barrel withholds, and they do not exist below 0.4.1. Against 0.4.0 this package would export a query vocabulary with no way to express IS NULL, and zonai gen client output — whose runtime calls Where.isNull — would not compile.

0.2.1 #

  • Widen the zonai_schema constraint to >=0.1.0 <0.5.0 so consumers can move to zonai_schema 0.4.0. The published 0.2.0 declares <0.4.0, which excludes it — anyone using this client alongside zonai_schema is pinned below 0.4.0 regardless of what they ask for, and 0.4.0 is the release carrying push notifications and the tightened auth defaults that Zonai CLI v0.8.0 requires. Nothing here references what changed in 0.4.0 (push vocabulary and rate-limit defaults, both server-side), so this spans the minors rather than pinning to the newest.
  • OAuth reaches the client. Auth gains providers({table}), startUrl({...}), complete({...}) and signInWithIdToken({...}), covering both the redirect flow and the native one. Underneath, AuthDataSource gains startOAuth, oauth, oauthProviders, oauthCallbackFormPost and acceptAdminInvite, and a new AdminDataSource (members, invite, revokeInvite, removeMember) is reachable as client.admin. Additive throughout; the package's exported entrypoint surface is unchanged.
  • The generated client gains MaintenanceDataSource — purgeLogs, purgeTable, cleanupPhotos and reclaimLogSpace, reachable as client.maintenance — and DashboardDataSource.storage(), which back the dashboard's new Maintenance screen.
  • EmailDataSource.send, RootDataSource.swaggerJson and RootDataSource.swaggerYaml now take an optional authorization argument, because the server no longer serves those unauthenticated. Additive for callers; if you implement or mock any of these interfaces yourself, you will need to add the parameter and the new members.

0.2.0 #

  • Breaking: require revali_client ^3.0.0 (was ^2.1.0). This is breaking for you only if you pass your own interceptor to ZonaiClient(extraInterceptors: [...]), because HttpInterceptor.onRequest and onResponse now return FutureOr<HttpResponse?> instead of void. The migration is mechanical: change the return type and return null, which means "carry on". Returning a response instead is the new capability — from onRequest it answers the call without sending anything, and from onResponse it substitutes what arrived, which is what makes retries, caching and circuit breaking expressible at all. Callers who pass no interceptor of their own are unaffected; this package's own X-Auth interceptor already returned null throughout.
  • Behaviour change, no API change: a throwing interceptor now fails the request instead of being swallowed. Previously an interceptor that threw let the request continue in whatever half-prepared state it was left in, so a failed auth interceptor put an unauthenticated request on the wire and surfaced as a puzzling 401 from the server rather than as an error where it actually broke. If you relied on that swallowing, catch inside your interceptor.
  • The bundled revali_client also gains RevaliClient.timeout and an opt-in RetryPolicy, and ServerException now parses the server's error envelope (code, reason, details, isStructured) when one was sent. This client does not yet configure any of them; they are listed because they arrive in the dependency you now resolve.
  • No change to this package's own public API, generated client, or zonai_schema constraint. The generated client is byte-identical under revali_client_gen 2.5.0.

0.1.3 #

  • Widen the zonai_schema constraint to >=0.1.0 <0.4.0 so consumers can move to zonai_schema 0.3.0. The published 0.1.2 declares <0.3.0, which excludes it — anyone using this client alongside zonai_schema is pinned below 0.3.0 regardless of what they ask for, and 0.3.0 is the release carrying the scheduled-cron fix. Nothing here references what changed in 0.3.0 (a revali_core major and new cron IPC vocabulary, both server-side), so this spans the minors rather than pinning to the newest.

0.1.2 #

  • Widen the zonai_schema constraint to >=0.1.0 <0.3.0 so consumers can move to zonai_schema 0.2.0. The published 0.1.1 declares ^0.1.0, which excludes it — anyone using this client alongside zonai_schema was pinned below 0.2.0 regardless of what they asked for. Nothing here references the API that changed in 0.2.0 (TableRateLimits.customPolicy, which is server-side), so this deliberately spans both minors rather than pinning to the new one.
  • Add RootDataSource.logo(), backing the optional dashboard logo served from imagesPath. Additive for callers; if you implement or mock RootDataSource yourself, you will need to add the member.

0.1.1 #

  • Fix: lib/gen/ (the generated Revali HTTP client) was excluded from the published package by the repo's root .gitignore, making 0.1.0 unimportable. The generated client is now tracked and shipped.

0.1.0 #

  • Initial release.
0
likes
100
points
1.38k
downloads

Documentation

Documentation
API reference

Publisher

verified publisherzonai.dev

Weekly Downloads

Typed Dart and Flutter client for a Zonai backend: auth, CRUD, file uploads, and live SQLite query streams over HTTP.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#backend #api-client #sqlite #streaming #authentication

License

MIT (license)

Dependencies

file, http, revali_client, zonai_schema

More

Packages that depend on zonai_client