@celerity-sdk/common
v0.3.1
Published
Shared runtime utilities for the Celerity Node SDK
Readme
@celerity-sdk/common
Shared runtime utilities for the Celerity Node SDK.
This package provides small, general-purpose helpers used across multiple SDK packages. It has no internal dependencies and only requires @celerity-sdk/types.
Installation
pnpm add @celerity-sdk/commonAPI
joinHandlerPath(prefix, path)
Joins a controller prefix and a route path into a single normalized path. Handles leading/trailing slashes and avoids double slashes.
import { joinHandlerPath } from "@celerity-sdk/common";
joinHandlerPath("/api", "/users"); // "/api/users"
joinHandlerPath("/api", "/"); // "/api"extractUserId(auth)
Extracts a user identifier from an HttpRequest.auth object, checking common claim fields (sub, userId, user_id, id).
import { extractUserId } from "@celerity-sdk/common";
const userId = extractUserId(request.auth); // string | nullPart of the Celerity Framework
See celerityframework.io for full documentation.
