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.generalAsyncFunction- an async, failable function (JS only)Enabled- type-safe union ofEnabled | DisabledErrorMsg- typed error message, with some util and predefined casesJsExt- JS-only implicit extensions (JS only)LazyVal- lightweightlazy valas a portable valueLoggerJs- simple logger (JS only)Permission- type-safe union ofAllow | DenyProtocol- abstract definitions of protocolsRetries- immutable retry policyThreadUtils- thread groups, thread pools,ExecutionContextutil, 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.ajaxAjaxProtocol- protocol for an AJAX endpointAjaxClient- means for a client to perform AJAX calls (JS only)
-
japgolly.webapputil.binaryBinaryData- 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 JSpakolibrary with provides zlib compression & decompression (JS only)
-
japgolly.webapputil.browserWindowConfirm- abstraction overwindow.confirm(JS only)WindowLocation- abstraction overwindow.location(JS only)WindowPrompt- abstraction overwindow.prompt(JS only)
-
japgolly.webapputil.entrypointEntrypointDef- 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 vialoadjsbefore entrypoint invocation (JVM only)
-
japgolly.webapputil.httpCookie- 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.locksLockMechanism- 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.websocketWebSocket- 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.testBinaryTestUtil- util for testing binary dataTestAjaxClient-AjaxClientinstance for use in tests (JS only)TestHttpClient-HttpClientinstance for use in testsTestTimersJs-TimersJsinstance for use in tests (JS only)TestWebSocket-WebSocketinstance for use in tests (JS only)TestWebWorker- in-memory instances ofAbstractWebWorkerclient and server API for use in tests (JS only)TestWindowConfirm-WindowConfirminstance for use in tests (JS only)TestWindowLocation-WindowLocationinstance for use in tests (JS only)TestWindowPrompt-WindowPromptinstance for use in tests (JS only)
japgolly.webapputil.test.node(JS only)TestNode- util for testing using Node
japgolly.webapputil.boopickleBinaryFormatExt- additional functionality aroundBinaryFormat(JS only)BinaryWebWorkerProtocol- implementation ofWebWorkerProtocolthat uses boopickle for message encoding (JS only)BoopickleCodecEngine- implementation ofCodecEnginefor boopickleBoopickleWebSocketClient- implementation ofWebSocketClientthat uses boopickle for message encoding (JS only)EncryptionEngine- implementation ofEncryption.Engine(JS only)EntrypointDefExt- additional functionality aroundEntrypointDefIndexedDbExt- additional functionality around IndexedDb (JS only)PicklerUtil- util around, and implementations of, BoopicklePicklersSafePickler- safer version of a BoopicklePicklerwith versioning supportSafePicklerUtil- util for working withSafePicklerversions during (de)serialisation
japgolly.webapputil.boopickle.testTestEncryption- 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
IOis 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,IOruntimes (JVM only)
- Implicits so that
japgolly.webapputil.cats.effect.testTestHttpClientIO(JVM only)
japgolly.webapputil.circeJsonAjaxClient- implementation ofAjaxClientthat uses JSON andJsonCodec(JS only)JsonCodec- composition of Circe'sEncoderandDecoderinto a single typeclassJsonEntrypointCodec- creates instances ofEntrypointDef.Codecusing Circe codecsJsonUtil- util to supplement Circe- Extension methods available via
import japgolly.webapputil.circe._HttpClient.Body.jsonto create response bodies as JSONHttpClient.Body#parseJsonBodyto parse request bodies as JSON
japgolly.webapputil.circe.testJsonTestUtil- util to test JSON codecsTestJsonAjaxClient- implementation ofTestAjaxClientthat uses JSON andJsonCodec(JS only)
japgolly.webapputil.okhttp4OkHttp4Client- implementation ofHttpClientusing okhttp4
japgolly.webapputil.dbDb- 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.testDbTable- util around DB tables and row countingDelegateConnection-java.sql.Connectioninstance 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.