@uluops/sdk-core
Shared infrastructure for UluOps SDKs — HTTP client, authentication strategies, error classes, configuration loading, and utilities.
Installation
npm install @uluops/sdk-coreQuick Start
import { HttpClient } from '@uluops/sdk-core';
const client = new HttpClient({
apiKey: 'ulr_your-api-key',
});Constructor Parameters
baseUrlrequiredstringBase URL for API requests. Must use HTTPS for non-loopback targets (localhost/127.0.0.1 exempt).
sdkNamerequiredstringSDK name for User-Agent header (e.g., '@uluops/ops-sdk').
sdkVersionrequiredstringSDK version for User-Agent header.
loggerPrefixrequiredstringLogger prefix for debug output (e.g., '[ops-sdk:http]').
authBaseUrloptionalstringSeparate base URL for auth endpoints (when auth is delegated to a different API). Must use HTTPS for non-loopback targets.
timeoutoptionalnumberRequest timeout in milliseconds.
Default:30000retriesoptionalnumberMax retry attempts for transient errors.
Default:3debugoptionalbooleanEnable debug logging.
defaultHeadersoptionalRecord<string, string>Extra default headers sent with every request.
apiKeyoptionalstringAPI key for authentication.
emailoptionalstringEmail for session-based authentication.
passwordoptionalstringPassword for session-based authentication.
sessionTokenoptionalstringPre-existing session token.
onTokenRefreshoptional(token: string) => voidCallback invoked when session token is automatically refreshed.
Subpath Exports
@uluops/sdk-core/httpHttpClient class@uluops/sdk-core/errorsError classes and type guards@uluops/sdk-core/configConfiguration loading utilities@uluops/sdk-core/config/constantsSDK constants (timeouts, prefixes, status codes)@uluops/sdk-core/utilsUtility functions (retry, sleep, isUuid, logger)
Namespaces
Core HTTP client with automatic authentication, retry logic, rate limit handling, and response envelope unwrapping.
12 methods
Authentication strategies for API key and JWT session-based auth. Factory function and strategy classes.
6 methods
Typed error classes for every HTTP status code and type guard functions for error discrimination in catch blocks.
8 methods
Configuration and credential loading. Resolves credentials from explicit params, environment variables, and stored files with priority chain.
6 methods
Helper functions for retry logic, UUID validation, rate limit parsing, and logging.
7 methods