jala_core 0.4.0 copy "jala_core: ^0.4.0" to clipboard
jala_core: ^0.4.0 copied to clipboard

Pure-Dart core for Jala: network call model, event bus, ring-buffer store, redaction, DevTools-style filter grammar, and exporters (cURL, Dart/Dio snippet, HAR 1.2).

jala_core #

Pure-Dart core for Jala, the in-app Flutter network inspector: the captured-call model, event bus, ring-buffer store, capture-time redaction, DevTools-style filter grammar, and exporters (cURL, Dart/Dio snippet, HAR 1.2).

Zero Flutter dependency. This package only depends on dart:core / dart:convert and is tested with dart test, so it can be reused outside Flutter (CLI tooling, server-side log tooling, etc.) as well as inside it.

Building an app? Install jala instead — it pulls in this package plus jala_ui and gives you Jala.initialize() and JalaOverlay out of the box. jala_core is for people building client integrations or plugins (like jala_dio), or anyone who wants the model/ store/filter/exporter primitives without any UI.

Main classes #

Class Role
JalaBinding Process-wide singleton wiring config, event bus, store, and replay registry. Client integrations read JalaBinding.instance instead of taking constructor parameters.
JalaReplayRegistry / JalaReplayer Connects the inspector UI's Replay action to whichever client integration can re-issue a call.
JalaEvent / JalaEventBus Sealed event types (NetworkRequestEvent, NetworkResponseEvent, NetworkErrorEvent, NetworkCancelEvent, NetworkProgressEvent) and the broadcast bus clients emit them into. A true no-op (no allocation) when Jala is disabled.
JalaStore Ring-buffer store (default 300 entries) that correlates request/response/error/progress events by call id into immutable NetworkCallEntry values, exposed as entries and a watch stream.
NetworkCallEntry / CapturedBody The immutable model of one captured call, and its request/response bodies with a hard 512 KB capture cap (including BodyKind.image bytes and structured @multipart parts).
JalaRedactor Case-insensitive header redaction (Authorization, Cookie, X-Api-Key, etc. by default) and body pattern redaction, meant to run at capture time so secrets never enter the store.
JalaFilter JalaFilter.parse(query) compiles a DevTools-style query into a matches(NetworkCallEntry) predicate.
CurlExporter Renders an entry as a runnable, shell-escaped curl command.
DartSnippetExporter Renders an entry as a runnable dio.request(...) snippet.
HarExporter Renders one call or a whole session as HAR 1.2 JSON.
JalaConfig enabled, maxEntries, maxBodyBytes, captureImageBodies, redactor — passed to JalaBinding.instance.initialize(config: ...).

Filter grammar #

JalaFilter.parse(String query) splits the query on whitespace into terms (AND semantics), where a leading - negates a term. Matching is case-insensitive; malformed structured terms degrade to free text instead of throwing.

Term Matches
method:get / m:get HTTP method; comma list allowed (m:get,post)
status:404 / s:404 Exact status code
status:4xx Status class; also s:error (>= 400 or errored/cancelled) and s:pending
host:api.example.com / d: Host; * wildcard allowed (host:*.example.com)
path:/users Path substring
type:json / t:json Response content-type substring
larger-than:10k responseSize greater than n bytes (k/m suffixes supported)
slower-than:500 Duration greater than n milliseconds
is:replay Entry is a replay of another call (replayOf != null)
body:token Substring of the captured request or response body text
bare word Substring of method + " " + full URL
-<any term above> Negates that term

Example: method:get status:4xx larger-than:10k -host:*.cdn.com.

Usage without Flutter #

import 'package:jala_core/jala_core.dart';

final config = JalaConfig(enabled: true);
JalaBinding.instance.initialize(config: config);

JalaBinding.instance.bus.emit(NetworkRequestEvent(/* ... */));
// ...
final entries = JalaBinding.instance.store.entries;
final filter = JalaFilter.parse('method:post s:error');
final matches = entries.where(filter.matches);

print(CurlExporter.export(matches.first));
print(HarExporter.exportSession(entries));

See docs/SPEC-v0.1.md for the full v0.1 contract.

0
likes
0
points
428
downloads

Publisher

verified publisherketok.id

Weekly Downloads

Pure-Dart core for Jala: network call model, event bus, ring-buffer store, redaction, DevTools-style filter grammar, and exporters (cURL, Dart/Dio snippet, HAR 1.2).

Repository (GitHub)
View/report issues

Topics

#network #debugging #devtools #http

License

unknown (license)

More

Packages that depend on jala_core