This library was initially extracted (with permission) from the closed-source ShipReq where it when through many evolutions, and was battled-tested on a real-world, large and complex project. It was ported without git commit history, so please understand that in this case, the low commit count is not an indication of immaturity.
val WebappUtilVer = "<version>"
// Minimal
"com.github.japgolly.webapp-util" %%% "core" % WebappUtilVer
"com.github.japgolly.webapp-util" %%% "test" % WebappUtilVer % Test
// Node-specific additional testing support
"com.github.japgolly.webapp-util" %%% "test-node" % WebappUtilVer % Test
// Requiring Boopickle
"com.github.japgolly.webapp-util" %%% "core-boopickle" % WebappUtilVer
"com.github.japgolly.webapp-util" %%% "test-boopickle" % WebappUtilVer % Test
// Cats Effect support
"com.github.japgolly.webapp-util" %%% "core-cats-effect" % WebappUtilVer
"com.github.japgolly.webapp-util" %%% "test-cats-effect" % WebappUtilVer % Test
// Circe JSON support
"com.github.japgolly.webapp-util" %%% "core-circe" % WebappUtilVer
"com.github.japgolly.webapp-util" %%% "test-circe" % WebappUtilVer % Test
// HttpClient implementation using okhttp4
"com.github.japgolly.webapp-util" %% "core-okhttp4" % WebappUtilVer
// Postgres support via Doobie and Cats Effect
"com.github.japgolly.webapp-util" %% "db-postgres" % WebappUtilVer
"com.github.japgolly.webapp-util" %% "test-db-postgres" % WebappUtilVer % Test
-
japgolly.webapputil.general
AsyncFunction
- an async, failable function (JS only)Enabled
- type-safe union ofEnabled | Disabled
ErrorMsg
- typed error message, with some util and predefined casesJsExt
- JS-only implicit extensions (JS only)LazyVal
- lightweightlazy val
as a portable valueLoggerJs
- simple logger (JS only)Permission
- type-safe union ofAllow | Deny
Protocol
- abstract definitions of protocolsRetries
- immutable retry policyThreadUtils
- thread groups, thread pools,ExecutionContext
util, shutdown hooks (JVM only)TimersJs
- API over JS timers (JS only)Url
- types for URLsVarJs
- immutable reference to a potentially abstract, potentially mutable variable (JS only)Version
- types for a version with a major and minor component
-
japgolly.webapputil.ajax
AjaxProtocol
- protocol for an AJAX endpointAjaxClient
- means for a client to perform AJAX calls (JS only)
-
japgolly.webapputil.binary
BinaryData
- immutable representation of BinaryDataBinaryFormat
- converts a type to a binary format and back (JS only)BinaryJs
- functions for conversion between various JS binary data types (JS only)BinaryString
- binary data efficiently encoded as a UTF-16 string (JS only)CodecEngine
- capability to encode and decode binary data given a codec typeclassCompression
- binary compression and decompression (JS only)Encryption
- binary encryption and decryption (JS only)Pako
- facade for the JSpako
library with provides zlib compression & decompression (JS only)
-
japgolly.webapputil.browser
WindowConfirm
- abstraction overwindow.confirm
(JS only)WindowLocation
- abstraction overwindow.location
(JS only)WindowPrompt
- abstraction overwindow.prompt
(JS only)
-
japgolly.webapputil.entrypoint
EntrypointDef
- definition of a JS app entrypointEntrypoint
- abstract class for a JS app entrypoint (JS only)EntrypointInvoker
- generate JS to invoke an entrypoint (JVM only)Html
- HTML content (JVM only)Js
- typed text representing JavaScript code (plus some util) (JVM only)LoadJs
- define a bundle of JS assets to be loaded vialoadjs
before entrypoint invocation (JVM only)
-
japgolly.webapputil.http
Cookie
- abstract HTTP cookie and associated utilHttpClient
- abstract HTTP (invocation) clientUrlEncoder
- cross-platform URL encoding and decoding
-
japgolly.webapputil.indexeddb
(JS only)IndexedDb
- monadic API over IndexedDb that enforces transaction rules at compile-time, and provides higher-level ops such as atomic async modification (JS only)IndexedDbKey
- typed key for use in IndexedDb (JS only)KeyCodec
- codec between an arbitrary type and a IndexedDb key (JS only)ObjectStoreDef
- IndexedDb store and codecs (JS only)ValueCodec
- codec between an arbitrary type and a IndexedDb value (JS only)
-
japgolly.webapputil.locks
LockMechanism
- means of implicitly specifying how to acquire locks (JVM only)LockUtils
- helpers around Java locks (JVM only)GenericSharedLock.Safe
- shared lock APIs that are FP-safe (consistent between JVM and JS)GenericSharedLock.Unsafe
- shared lock APIs that are FP-unsafe, in that not effect type is used (consistent between JVM and JS)SharedLock
- lock that can be safely shared between threads (different API between JVM & JS)SharedLock.ReadWrite
- read/write lock that can be safely shared between threads (different API between JVM & JS)
-
japgolly.webapputil.websocket
WebSocket
- abstract API over a websocket connection (JS only)WebSocketClient
- high-level, managed websocket connection from client to server, supporting things like authorisation, auto-reconnection, retries, session expiry (TLA+ spec
) (JS only)WebSocketServerUtil
- util for writing server-side websockets (JVM only)WebSocketShared
- definitions and util shared between websocket client and server
-
japgolly.webapputil.webstorage
(JS only)AbstractWebStorage
- API over webstorage with some implsKeyCodec
- codec between an arbitrary type and a webstorage keyValueCodec
- codec between an arbitrary type and a webstorage valueWebStorageKey
- high-level interface to data in webstorage
-
japgolly.webapputil.webworker
(JS only)AbstractWebWorker
- web worker client & server APIManagedWebWorker
- web worker client & server implementations that handle all the low-level workOnError
- web worker error handlerWebWorkerProtocol
- protocol API for communication between web worker client and server
japgolly.webapputil.test
BinaryTestUtil
- util for testing binary dataTestAjaxClient
-AjaxClient
instance for use in tests (JS only)TestHttpClient
-HttpClient
instance for use in testsTestTimersJs
-TimersJs
instance for use in tests (JS only)TestWebSocket
-WebSocket
instance for use in tests (JS only)TestWebWorker
- in-memory instances ofAbstractWebWorker
client and server API for use in tests (JS only)TestWindowConfirm
-WindowConfirm
instance for use in tests (JS only)TestWindowLocation
-WindowLocation
instance for use in tests (JS only)TestWindowPrompt
-WindowPrompt
instance for use in tests (JS only)
japgolly.webapputil.test.node
(JS only)TestNode
- util for testing using Node
japgolly.webapputil.boopickle
BinaryFormatExt
- additional functionality aroundBinaryFormat
(JS only)BinaryWebWorkerProtocol
- implementation ofWebWorkerProtocol
that uses boopickle for message encoding (JS only)BoopickleCodecEngine
- implementation ofCodecEngine
for boopickleBoopickleWebSocketClient
- implementation ofWebSocketClient
that uses boopickle for message encoding (JS only)EncryptionEngine
- implementation ofEncryption.Engine
(JS only)EntrypointDefExt
- additional functionality aroundEntrypointDef
IndexedDbExt
- additional functionality around IndexedDb (JS only)PicklerUtil
- util around, and implementations of, BoopicklePickler
sSafePickler
- safer version of a BoopicklePickler
with versioning supportSafePicklerUtil
- util for working withSafePickler
versions during (de)serialisation
japgolly.webapputil.boopickle.test
TestEncryption
- util for testing encryption (JS only)TestIndexedDb
- util for testing IndexedDb code (JS only)WebSocketTestUtil
- util for testing WebSocket code (JS only)
japgolly.webapputil.cats.effect
- Implicits so that
IO
is recognised as an effect type usable by the rest of the this library.Effect.Async[IO]
Effect.Sync[IO]
(JVM only)
ThreadUtilsIO
- thread pools, scheduling, shutdown hooks,IO
runtimes (JVM only)
- Implicits so that
japgolly.webapputil.cats.effect.test
TestHttpClientIO
(JVM only)
japgolly.webapputil.circe
JsonAjaxClient
- implementation ofAjaxClient
that uses JSON andJsonCodec
(JS only)JsonCodec
- composition of Circe'sEncoder
andDecoder
into a single typeclassJsonEntrypointCodec
- creates instances ofEntrypointDef.Codec
using Circe codecsJsonUtil
- util to supplement Circe- Extension methods available via
import japgolly.webapputil.circe._
HttpClient.Body.json
to create response bodies as JSONHttpClient.Body#parseJsonBody
to parse request bodies as JSON
japgolly.webapputil.circe.test
JsonTestUtil
- util to test JSON codecsTestJsonAjaxClient
- implementation ofTestAjaxClient
that uses JSON andJsonCodec
(JS only)
japgolly.webapputil.okhttp4
OkHttp4Client
- implementation ofHttpClient
using okhttp4
japgolly.webapputil.db
Db
- connection to the databaseDbConfig
- DB config definitions, i.e. to load DB details at runtime on app startupDbMigration
- manages DB schema migrations (via Flyway)DoobieCodecs
- a few generic codecs for DoobieDoobieHelpers
- helpers for DoobieJdbcLogging
- times and logs JDBC callsSqlTracer
- modularised behaviour around JDBC callsXA
- wrapper aroundTransactor[IO]
(used to be more and may again)
japgolly.webapputil.db.test
DbTable
- util around DB tables and row countingDelegateConnection
-java.sql.Connection
instance that routes all calls to a delegated connectionTestDb
- provides access to a test DB, manages things like migration, and utilTestDbConfig
- easily load DB config from testsTestDbHelpers
- DB util helpful during testingTestXA
- a live connection to the DB, and util to make testing as easy as possible
- Add examples
- Add ScalaDoc and proper doc
If you like what I do —my OSS libraries, my contributions to other OSS libs, my programming blog— and you'd like to support me, more content, more lib maintenance, please become a patron! I do all my OSS work unpaid so showing your support will make a big difference.