-
Notifications
You must be signed in to change notification settings - Fork 0
patchwork
Jacob Sampson edited this page Mar 23, 2026
·
1 revision
Generated by Cicadas Bootstrap on 2026-03-22.
The patchwork package (@aprovan/patchwork) provides the service proxy layer — the abstraction through which widgets call external services. It defines the ServiceBackend interface and exposes callProcedure(namespace, procedure, args) as the universal method for service invocation, with createProxy for ergonomic namespace-scoped access.
Exports:
-
callProcedure(namespace, procedure, args)— Invoke a remote procedure on a named service -
createProxy(namespace)— Create a proxy object where method calls map tocallProcedure -
setServiceBackend(backend)— Set the active service backend (global singleton) -
ServiceBackendinterface —{ call(service, procedure, args): Promise<any> } - Service type definitions
Dependencies:
- None (zero runtime dependencies — pure abstraction layer)
-
services/proxy.ts—createProxyimplementation using JavaScriptProxyto intercept method calls and route them tocallProcedure -
services/types.ts—ServiceBackendinterface definition and related types -
services/index.ts— Barrel export andsetServiceBackend/callProcedureimplementation
-
Global singleton backend: A single
ServiceBackendis set globally viasetServiceBackend(). Widgets don't need to know about backend configuration — they just callcallProcedure. -
Namespace-based routing: Services are identified by namespace strings (e.g.,
"weather","database"), allowing multiple service providers to coexist. - Zero dependencies: The package is a pure abstraction layer with no runtime dependencies, making it safe to bundle into any widget without bloat.
-
Proxy-based ergonomics:
createProxy("weather").getForecast(args)is syntactic sugar overcallProcedure("weather", "getForecast", args).