Runtime constants and environment helpers shared across the UCD.js workspace.
npm install @ucdjs/envNote
Full documentation is available at docs.ucdjs.dev/api-reference/utilities/env.
These resolve from the matching process.env variable when set, otherwise fall back to the defaults below.
| Export | Default |
|---|---|
UCDJS_API_BASE_URL |
https://api.ucdjs.dev |
UCDJS_DOCS_URL |
https://docs.ucdjs.dev |
UCDJS_STORE_BASE_URL |
https://ucd-store.ucdjs.dev |
DEFAULT_USER_AGENT |
ucdjs.dev (https://ucdjs.dev) |
Header name constants used in UCD HTTP responses to surface file/directory metadata.
| Export | Header name |
|---|---|
UCD_STAT_TYPE_HEADER |
X-UCD-Stat-Type |
UCD_STAT_SIZE_HEADER |
X-UCD-Stat-Size |
UCD_STAT_CHILDREN_HEADER |
X-UCD-Stat-Children |
UCD_STAT_CHILDREN_FILES_HEADER |
X-UCD-Stat-Children-Files |
UCD_STAT_CHILDREN_DIRS_HEADER |
X-UCD-Stat-Children-Dirs |
Validates that the specified keys are present in an environment object and returns it with narrowed types. Throws if any key is missing.
import { requiredEnv } from "@ucdjs/env";
const env = requiredEnv(rawEnv, ["DATABASE_URL", "API_KEY"]);
// env.DATABASE_URL and env.API_KEY are guaranteed non-nullablePublished under MIT License.