@k8slens/public-utilities
v1.1.2
Published
The handful of general-purpose types and helpers that public contracts packages need, published so an outsider can resolve them
Maintainers
Keywords
Readme
@k8slens/public-utilities
The few general-purpose types and helpers that public contracts packages need in their own signatures.
A contracts package promised to everyone ("visibility": "public-for-all") may
only depend on other public-for-all packages, or npm install fails outside
this monorepo. @lensapp/utilities is the natural home for a helper like
MaybePromise, but it is a large internal kitchen sink and publishing it whole
would make every one of its corners a forever public API.
So the minimum moves here, and @lensapp/utilities re-exports it. There is one
definition of each symbol, in this package; internal code keeps importing it
from @lensapp/utilities exactly as before.
What belongs here
Only a symbol that appears in the public surface of a public contracts package — a token's type, a factory's parameters, an exported interface. That is the whole admission rule.
Nothing else: this package is a forever public API, so every symbol added is a
promise that cannot be quietly withdrawn. When a public contract needs a
general-purpose helper, move that one helper here and re-export it from
@lensapp/utilities; do not move its neighbours along for symmetry.
What is here
| Symbol | Why it is public |
|---|---|
| MaybePromise<T> | Contracts model factories that may resolve later |
| AsyncVoidFunction, MaybeAsyncVoidFunction | Menu and action contracts take handlers that may be async |
| expectDefined | Contracts that read a React context assert it is present |
