@scalepad/sdk-lm
v0.1.3
Published
Thin typed ScalePad Lifecycle Manager helper package used by the ScalePad CLI.
Keywords
Readme
@scalepad/sdk-lm
Thin typed client for selected ScalePad Lifecycle Manager API routes used by the ScalePad CLI.
@scalepad/cli is the primary supported developer interface right now. Use this package when you need a lightweight programmatic helper for a subset of Lifecycle Manager workflows.
Install
npm install @scalepad/sdk-lmUsage
import { createLifecycleManagerClient } from "@scalepad/sdk-lm";
const client = createLifecycleManagerClient({
apiKey: process.env.SCALEPAD_API_KEY!,
validateResponses: true
});
const actionItems = await client.listActionItems({ pageSize: 10 });
console.log(actionItems.data);API
The package exports a generated client plus a small convenience wrapper.
Wrapper helpers:
createLifecycleManagerClient(config)ScalepadLifecycleManagerClientlistActionItems(query)getActionItem(id)paginateActionItemPages(query)paginateActionItems(query)collectAllActionItems(query)
Generated and schema exports:
GeneratedLifecycleManagerClientlifecycleManagerOperationsScalepadLmApiErrorpaths
Client configuration
type LifecycleManagerClientConfig = {
apiKey: string;
baseUrl?: string;
fetchImpl?: typeof fetch;
userAgent?: string;
timeoutMs?: number;
maxRetries?: number;
retry?: Partial<RetryConfig>;
validateResponses?: boolean;
};apiKeyis required and is sent asx-api-keybaseUrldefaults tohttps://api.scalepad.comfetchImpllets you inject a custom fetch implementationuserAgentdefaults to@scalepad/clitimeoutMsdefaults to30000maxRetriesis kept for backward compatibility and overridesretry.maxRetrieswhen setretry.retryOn429andretry.retryOn5xxcontrol safe-method retriesretry.retryUnsafeMethodsdefaults tofalsevalidateResponsesenables basic runtime envelope validation for wrapper methods
List queries
List endpoints accept this shared shape:
type ListQuery = {
cursor?: string;
pageSize?: number;
filters?: Record<string, string>;
sort?: string;
};Filters are translated to filter[field]=expression query parameters, and pageSize is translated to page_size.
Pagination helpers
Wrapper list methods still support manual cursor pagination through ListQuery, and the package now also exports helper iterators:
for await (const actionItem of client.paginateActionItems({ pageSize: 100 })) {
console.log(actionItem.id);
}
const allActionItems = await client.collectAllActionItems({ pageSize: 200 });Error handling
Failed requests throw richer typed errors:
ScalepadLmApiErrorfor general API failuresAuthenticationErrorAuthorizationErrorRateLimitErrorServerErrorTimeoutErrorNetworkErrorResponseValidationError
Development
This package is generated from the checked-in OpenAPI spec in the monorepo root. To refresh or rebuild it:
pnpm fetch:specs
pnpm generate:sdk
pnpm --filter @scalepad/sdk-lm build