@scalepad/sdk-lm 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +121 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +51 -3
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +52 -4
- package/dist/runtime.js +183 -19
- package/dist/runtime.js.map +1 -1
- package/package.json +9 -1
- package/src/catalog.ts +0 -1161
- package/src/generated.ts +0 -1288
- package/src/index.ts +0 -63
- package/src/runtime.ts +0 -132
- package/src/schema.ts +0 -8768
- package/tsconfig.json +0 -9
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# @scalepad/sdk-lm
|
|
2
|
+
|
|
3
|
+
Thin typed client for selected ScalePad Lifecycle Manager API routes used by the ScalePad CLI.
|
|
4
|
+
|
|
5
|
+
`@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.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @scalepad/sdk-lm
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createLifecycleManagerClient } from "@scalepad/sdk-lm";
|
|
17
|
+
|
|
18
|
+
const client = createLifecycleManagerClient({
|
|
19
|
+
apiKey: process.env.SCALEPAD_API_KEY!,
|
|
20
|
+
validateResponses: true
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const actionItems = await client.listActionItems({ pageSize: 10 });
|
|
24
|
+
console.log(actionItems.data);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
The package exports a generated client plus a small convenience wrapper.
|
|
30
|
+
|
|
31
|
+
Wrapper helpers:
|
|
32
|
+
|
|
33
|
+
- `createLifecycleManagerClient(config)`
|
|
34
|
+
- `ScalepadLifecycleManagerClient`
|
|
35
|
+
- `listActionItems(query)`
|
|
36
|
+
- `getActionItem(id)`
|
|
37
|
+
- `paginateActionItemPages(query)`
|
|
38
|
+
- `paginateActionItems(query)`
|
|
39
|
+
- `collectAllActionItems(query)`
|
|
40
|
+
|
|
41
|
+
Generated and schema exports:
|
|
42
|
+
|
|
43
|
+
- `GeneratedLifecycleManagerClient`
|
|
44
|
+
- `lifecycleManagerOperations`
|
|
45
|
+
- `ScalepadLmApiError`
|
|
46
|
+
- `paths`
|
|
47
|
+
|
|
48
|
+
## Client configuration
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
type LifecycleManagerClientConfig = {
|
|
52
|
+
apiKey: string;
|
|
53
|
+
baseUrl?: string;
|
|
54
|
+
fetchImpl?: typeof fetch;
|
|
55
|
+
userAgent?: string;
|
|
56
|
+
timeoutMs?: number;
|
|
57
|
+
maxRetries?: number;
|
|
58
|
+
retry?: Partial<RetryConfig>;
|
|
59
|
+
validateResponses?: boolean;
|
|
60
|
+
};
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- `apiKey` is required and is sent as `x-api-key`
|
|
64
|
+
- `baseUrl` defaults to `https://api.scalepad.com`
|
|
65
|
+
- `fetchImpl` lets you inject a custom fetch implementation
|
|
66
|
+
- `userAgent` defaults to `@scalepad/cli`
|
|
67
|
+
- `timeoutMs` defaults to `30000`
|
|
68
|
+
- `maxRetries` is kept for backward compatibility and overrides `retry.maxRetries` when set
|
|
69
|
+
- `retry.retryOn429` and `retry.retryOn5xx` control safe-method retries
|
|
70
|
+
- `retry.retryUnsafeMethods` defaults to `false`
|
|
71
|
+
- `validateResponses` enables basic runtime envelope validation for wrapper methods
|
|
72
|
+
|
|
73
|
+
## List queries
|
|
74
|
+
|
|
75
|
+
List endpoints accept this shared shape:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
type ListQuery = {
|
|
79
|
+
cursor?: string;
|
|
80
|
+
pageSize?: number;
|
|
81
|
+
filters?: Record<string, string>;
|
|
82
|
+
sort?: string;
|
|
83
|
+
};
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Filters are translated to `filter[field]=expression` query parameters, and `pageSize` is translated to `page_size`.
|
|
87
|
+
|
|
88
|
+
## Pagination helpers
|
|
89
|
+
|
|
90
|
+
Wrapper list methods still support manual cursor pagination through `ListQuery`, and the package now also exports helper iterators:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
for await (const actionItem of client.paginateActionItems({ pageSize: 100 })) {
|
|
94
|
+
console.log(actionItem.id);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const allActionItems = await client.collectAllActionItems({ pageSize: 200 });
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Error handling
|
|
101
|
+
|
|
102
|
+
Failed requests throw richer typed errors:
|
|
103
|
+
|
|
104
|
+
- `ScalepadLmApiError` for general API failures
|
|
105
|
+
- `AuthenticationError`
|
|
106
|
+
- `AuthorizationError`
|
|
107
|
+
- `RateLimitError`
|
|
108
|
+
- `ServerError`
|
|
109
|
+
- `TimeoutError`
|
|
110
|
+
- `NetworkError`
|
|
111
|
+
- `ResponseValidationError`
|
|
112
|
+
|
|
113
|
+
## Development
|
|
114
|
+
|
|
115
|
+
This package is generated from the checked-in OpenAPI spec in the monorepo root. To refresh or rebuild it:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pnpm fetch:specs
|
|
119
|
+
pnpm generate:sdk
|
|
120
|
+
pnpm --filter @scalepad/sdk-lm build
|
|
121
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type GetactionitemsbyidResponse as GetActionItemResponse, type ListactionitemsResponse as ListActionItemsResponse } from "./generated.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type BaseClientConfig } from "./runtime.js";
|
|
3
3
|
export { lifecycleManagerOperations, type GeneratedOperation as GeneratedLifecycleManagerOperation } from "./catalog.js";
|
|
4
4
|
export { GeneratedLifecycleManagerClient } from "./generated.js";
|
|
5
|
-
export {
|
|
5
|
+
export { ApiError as ScalepadLmApiError, AuthenticationError, AuthorizationError, NetworkError, RateLimitError, ResponseValidationError, ScalePadError, ServerError, TimeoutError, type FetchLike, type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue, type RetryConfig } from "./runtime.js";
|
|
6
6
|
export type { paths } from "./schema.js";
|
|
7
7
|
export interface ListQuery {
|
|
8
8
|
cursor?: string;
|
|
@@ -12,10 +12,24 @@ export interface ListQuery {
|
|
|
12
12
|
}
|
|
13
13
|
export interface LifecycleManagerClientConfig extends BaseClientConfig {
|
|
14
14
|
}
|
|
15
|
+
export interface PaginatedResponse<T = Record<string, unknown>> {
|
|
16
|
+
data?: T[];
|
|
17
|
+
total_count?: number;
|
|
18
|
+
next_cursor?: string | null;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
type PaginatedItem<T> = T extends PaginatedResponse<infer Item> ? Item : never;
|
|
22
|
+
export declare function paginatePages<T>(fetchPage: (query: ListQuery) => Promise<PaginatedResponse<T>>, query?: ListQuery): AsyncGenerator<T[], void, unknown>;
|
|
23
|
+
export declare function paginateItems<T>(fetchPage: (query: ListQuery) => Promise<PaginatedResponse<T>>, query?: ListQuery): AsyncGenerator<T, void, unknown>;
|
|
24
|
+
export declare function collectAll<T>(fetchPage: (query: ListQuery) => Promise<PaginatedResponse<T>>, query?: ListQuery): Promise<T[]>;
|
|
15
25
|
export declare class ScalepadLifecycleManagerClient {
|
|
16
26
|
private readonly generated;
|
|
27
|
+
private readonly validateResponses;
|
|
17
28
|
constructor(config: LifecycleManagerClientConfig);
|
|
18
29
|
listActionItems(query?: ListQuery): Promise<ListActionItemsResponse>;
|
|
19
30
|
getActionItem(id: string): Promise<GetActionItemResponse>;
|
|
31
|
+
paginateActionItemPages(query?: ListQuery): AsyncGenerator<PaginatedItem<ListActionItemsResponse>[], void, unknown>;
|
|
32
|
+
paginateActionItems(query?: ListQuery): AsyncGenerator<PaginatedItem<ListActionItemsResponse>, void, unknown>;
|
|
33
|
+
collectAllActionItems(query?: ListQuery): Promise<PaginatedItem<ListActionItemsResponse>[]>;
|
|
20
34
|
}
|
|
21
35
|
export declare function createLifecycleManagerClient(config: LifecycleManagerClientConfig): ScalepadLifecycleManagerClient;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { GeneratedLifecycleManagerClient } from "./generated.js";
|
|
2
|
+
import { assertListResponse, assertObjectResponse } from "./runtime.js";
|
|
2
3
|
export { lifecycleManagerOperations } from "./catalog.js";
|
|
3
4
|
export { GeneratedLifecycleManagerClient } from "./generated.js";
|
|
4
|
-
export {
|
|
5
|
+
export { ApiError as ScalepadLmApiError, AuthenticationError, AuthorizationError, NetworkError, RateLimitError, ResponseValidationError, ScalePadError, ServerError, TimeoutError } from "./runtime.js";
|
|
5
6
|
function buildListQuery(query = {}) {
|
|
6
7
|
const params = {};
|
|
7
8
|
if (query.pageSize != null) {
|
|
@@ -18,16 +19,63 @@ function buildListQuery(query = {}) {
|
|
|
18
19
|
}
|
|
19
20
|
return params;
|
|
20
21
|
}
|
|
22
|
+
export async function* paginatePages(fetchPage, query = {}) {
|
|
23
|
+
let nextQuery = { ...query };
|
|
24
|
+
while (true) {
|
|
25
|
+
const page = await fetchPage(nextQuery);
|
|
26
|
+
yield page.data ?? [];
|
|
27
|
+
const cursor = page.next_cursor ?? undefined;
|
|
28
|
+
if (!cursor) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
nextQuery = { ...nextQuery, cursor };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function* paginateItems(fetchPage, query = {}) {
|
|
35
|
+
for await (const page of paginatePages(fetchPage, query)) {
|
|
36
|
+
for (const item of page) {
|
|
37
|
+
yield item;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export async function collectAll(fetchPage, query = {}) {
|
|
42
|
+
const items = [];
|
|
43
|
+
for await (const item of paginateItems(fetchPage, query)) {
|
|
44
|
+
items.push(item);
|
|
45
|
+
}
|
|
46
|
+
return items;
|
|
47
|
+
}
|
|
21
48
|
export class ScalepadLifecycleManagerClient {
|
|
22
49
|
generated;
|
|
50
|
+
validateResponses;
|
|
23
51
|
constructor(config) {
|
|
24
52
|
this.generated = new GeneratedLifecycleManagerClient(config);
|
|
53
|
+
this.validateResponses = config.validateResponses ?? false;
|
|
25
54
|
}
|
|
26
55
|
listActionItems(query = {}) {
|
|
27
|
-
return this.generated.listActionItems(buildListQuery(query))
|
|
56
|
+
return this.generated.listActionItems(buildListQuery(query)).then((response) => {
|
|
57
|
+
if (this.validateResponses) {
|
|
58
|
+
assertListResponse(response, "Invalid response from listActionItems().");
|
|
59
|
+
}
|
|
60
|
+
return response;
|
|
61
|
+
});
|
|
28
62
|
}
|
|
29
63
|
getActionItem(id) {
|
|
30
|
-
return this.generated.getActionItemsById({ id })
|
|
64
|
+
return this.generated.getActionItemsById({ id }).then((response) => {
|
|
65
|
+
if (this.validateResponses) {
|
|
66
|
+
assertObjectResponse(response, "Invalid response from getActionItem().");
|
|
67
|
+
}
|
|
68
|
+
return response;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
paginateActionItemPages(query = {}) {
|
|
72
|
+
return paginatePages((pageQuery) => this.listActionItems(pageQuery), query);
|
|
73
|
+
}
|
|
74
|
+
paginateActionItems(query = {}) {
|
|
75
|
+
return paginateItems((pageQuery) => this.listActionItems(pageQuery), query);
|
|
76
|
+
}
|
|
77
|
+
collectAllActionItems(query = {}) {
|
|
78
|
+
return collectAll((pageQuery) => this.listActionItems(pageQuery), query);
|
|
31
79
|
}
|
|
32
80
|
}
|
|
33
81
|
export function createLifecycleManagerClient(config) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,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ts
CHANGED
|
@@ -9,29 +9,77 @@ export type FetchLike = typeof fetch;
|
|
|
9
9
|
export type QueryArrayValue = string | number | boolean;
|
|
10
10
|
export type QueryValue = string | number | boolean | null | undefined | ReadonlyArray<QueryArrayValue>;
|
|
11
11
|
export type QueryParams = Record<string, QueryValue>;
|
|
12
|
-
export declare class
|
|
12
|
+
export declare class ScalePadError extends Error {
|
|
13
|
+
constructor(message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class ApiError extends ScalePadError {
|
|
13
16
|
readonly status: number;
|
|
14
17
|
readonly payload: unknown;
|
|
15
18
|
constructor(message: string, status: number, payload: unknown);
|
|
16
19
|
}
|
|
20
|
+
export declare class AuthenticationError extends ApiError {
|
|
21
|
+
constructor(status: number, payload: unknown);
|
|
22
|
+
}
|
|
23
|
+
export declare class AuthorizationError extends ApiError {
|
|
24
|
+
constructor(status: number, payload: unknown);
|
|
25
|
+
}
|
|
26
|
+
export declare class RateLimitError extends ApiError {
|
|
27
|
+
readonly retryAfterSeconds?: number;
|
|
28
|
+
constructor(status: number, payload: unknown, retryAfterSeconds?: number);
|
|
29
|
+
}
|
|
30
|
+
export declare class ServerError extends ApiError {
|
|
31
|
+
constructor(status: number, payload: unknown);
|
|
32
|
+
}
|
|
33
|
+
export declare class TimeoutError extends ScalePadError {
|
|
34
|
+
readonly timeoutMs: number;
|
|
35
|
+
constructor(timeoutMs: number);
|
|
36
|
+
}
|
|
37
|
+
export declare class NetworkError extends ScalePadError {
|
|
38
|
+
readonly cause?: unknown;
|
|
39
|
+
constructor(message: string, cause?: unknown);
|
|
40
|
+
}
|
|
41
|
+
export declare class ResponseValidationError extends ScalePadError {
|
|
42
|
+
readonly issues: string[];
|
|
43
|
+
readonly payload: unknown;
|
|
44
|
+
constructor(message: string, payload: unknown, issues: string[]);
|
|
45
|
+
}
|
|
46
|
+
export interface RetryConfig {
|
|
47
|
+
maxRetries: number;
|
|
48
|
+
retryOn429: boolean;
|
|
49
|
+
retryOn5xx: boolean;
|
|
50
|
+
retryUnsafeMethods: boolean;
|
|
51
|
+
}
|
|
52
|
+
export type ResponseValidator<T> = (payload: unknown) => void;
|
|
17
53
|
export interface BaseClientConfig {
|
|
18
54
|
apiKey: string;
|
|
19
55
|
baseUrl?: string;
|
|
20
56
|
fetchImpl?: FetchLike;
|
|
21
57
|
userAgent?: string;
|
|
58
|
+
timeoutMs?: number;
|
|
22
59
|
maxRetries?: number;
|
|
60
|
+
retry?: Partial<RetryConfig>;
|
|
61
|
+
validateResponses?: boolean;
|
|
23
62
|
}
|
|
24
63
|
export declare class BaseApiClient {
|
|
25
64
|
private readonly apiKey;
|
|
26
65
|
private readonly baseUrl;
|
|
27
66
|
private readonly fetchImpl;
|
|
28
67
|
private readonly userAgent;
|
|
29
|
-
private readonly
|
|
68
|
+
private readonly timeoutMs;
|
|
69
|
+
private readonly retryConfig;
|
|
70
|
+
private readonly validateResponses;
|
|
30
71
|
constructor(config: BaseClientConfig);
|
|
31
|
-
protected requestJson(request: {
|
|
72
|
+
protected requestJson<T>(request: {
|
|
32
73
|
method: string;
|
|
33
74
|
path: string;
|
|
34
75
|
query?: QueryParams;
|
|
35
76
|
body?: JsonValue;
|
|
36
|
-
|
|
77
|
+
validator?: ResponseValidator<T>;
|
|
78
|
+
}): Promise<T>;
|
|
37
79
|
}
|
|
80
|
+
export declare function assertObjectResponse(payload: unknown, message?: string): asserts payload is Record<string, unknown>;
|
|
81
|
+
export declare function assertListResponse(payload: unknown, message?: string): asserts payload is {
|
|
82
|
+
data: unknown[];
|
|
83
|
+
total_count?: number;
|
|
84
|
+
next_cursor?: string | null;
|
|
85
|
+
};
|
package/dist/runtime.js
CHANGED
|
@@ -1,19 +1,136 @@
|
|
|
1
|
-
export class
|
|
1
|
+
export class ScalePadError extends Error {
|
|
2
|
+
constructor(message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = "ScalePadError";
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class ApiError extends ScalePadError {
|
|
2
8
|
status;
|
|
3
9
|
payload;
|
|
4
10
|
constructor(message, status, payload) {
|
|
5
11
|
super(message);
|
|
6
|
-
this.name = "
|
|
12
|
+
this.name = "ApiError";
|
|
7
13
|
this.status = status;
|
|
8
14
|
this.payload = payload;
|
|
9
15
|
}
|
|
10
16
|
}
|
|
17
|
+
export class AuthenticationError extends ApiError {
|
|
18
|
+
constructor(status, payload) {
|
|
19
|
+
super("Authentication failed.", status, payload);
|
|
20
|
+
this.name = "AuthenticationError";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export class AuthorizationError extends ApiError {
|
|
24
|
+
constructor(status, payload) {
|
|
25
|
+
super("You are not authorized to perform this request.", status, payload);
|
|
26
|
+
this.name = "AuthorizationError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class RateLimitError extends ApiError {
|
|
30
|
+
retryAfterSeconds;
|
|
31
|
+
constructor(status, payload, retryAfterSeconds) {
|
|
32
|
+
super("Rate limit exceeded.", status, payload);
|
|
33
|
+
this.name = "RateLimitError";
|
|
34
|
+
this.retryAfterSeconds = retryAfterSeconds;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class ServerError extends ApiError {
|
|
38
|
+
constructor(status, payload) {
|
|
39
|
+
super(`Server request failed with status ${status}.`, status, payload);
|
|
40
|
+
this.name = "ServerError";
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export class TimeoutError extends ScalePadError {
|
|
44
|
+
timeoutMs;
|
|
45
|
+
constructor(timeoutMs) {
|
|
46
|
+
super(`Request timed out after ${timeoutMs}ms.`);
|
|
47
|
+
this.name = "TimeoutError";
|
|
48
|
+
this.timeoutMs = timeoutMs;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export class NetworkError extends ScalePadError {
|
|
52
|
+
cause;
|
|
53
|
+
constructor(message, cause) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.name = "NetworkError";
|
|
56
|
+
this.cause = cause;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export class ResponseValidationError extends ScalePadError {
|
|
60
|
+
issues;
|
|
61
|
+
payload;
|
|
62
|
+
constructor(message, payload, issues) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.name = "ResponseValidationError";
|
|
65
|
+
this.issues = issues;
|
|
66
|
+
this.payload = payload;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
11
69
|
const DEFAULT_BASE_URL = "https://api.scalepad.com";
|
|
70
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
71
|
+
const SAFE_RETRY_METHODS = new Set(["GET", "HEAD", "OPTIONS"]);
|
|
72
|
+
const DEFAULT_RETRY_CONFIG = {
|
|
73
|
+
maxRetries: 3,
|
|
74
|
+
retryOn429: true,
|
|
75
|
+
retryOn5xx: true,
|
|
76
|
+
retryUnsafeMethods: false
|
|
77
|
+
};
|
|
12
78
|
function delay(ms) {
|
|
13
79
|
return new Promise((resolve) => {
|
|
14
80
|
setTimeout(resolve, ms);
|
|
15
81
|
});
|
|
16
82
|
}
|
|
83
|
+
function isRecord(value) {
|
|
84
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
85
|
+
}
|
|
86
|
+
function parseRetryAfterSeconds(value) {
|
|
87
|
+
if (!value) {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const seconds = Number(value);
|
|
91
|
+
if (Number.isFinite(seconds) && seconds > 0) {
|
|
92
|
+
return seconds;
|
|
93
|
+
}
|
|
94
|
+
const retryAt = Date.parse(value);
|
|
95
|
+
if (!Number.isNaN(retryAt)) {
|
|
96
|
+
return Math.max(0, Math.ceil((retryAt - Date.now()) / 1000));
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
}
|
|
100
|
+
function validateResponse(payload, validator, enabled) {
|
|
101
|
+
if (enabled && validator) {
|
|
102
|
+
validator(payload);
|
|
103
|
+
}
|
|
104
|
+
return payload;
|
|
105
|
+
}
|
|
106
|
+
function shouldRetryRequest(method, status, retryConfig) {
|
|
107
|
+
const canRetryMethod = retryConfig.retryUnsafeMethods || SAFE_RETRY_METHODS.has(method);
|
|
108
|
+
if (!canRetryMethod) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
if (status === 429) {
|
|
112
|
+
return retryConfig.retryOn429;
|
|
113
|
+
}
|
|
114
|
+
if (status >= 500 && status < 600) {
|
|
115
|
+
return retryConfig.retryOn5xx;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
function createApiError(status, payload, retryAfterSeconds) {
|
|
120
|
+
if (status === 401) {
|
|
121
|
+
return new AuthenticationError(status, payload);
|
|
122
|
+
}
|
|
123
|
+
if (status === 403) {
|
|
124
|
+
return new AuthorizationError(status, payload);
|
|
125
|
+
}
|
|
126
|
+
if (status === 429) {
|
|
127
|
+
return new RateLimitError(status, payload, retryAfterSeconds);
|
|
128
|
+
}
|
|
129
|
+
if (status >= 500 && status < 600) {
|
|
130
|
+
return new ServerError(status, payload);
|
|
131
|
+
}
|
|
132
|
+
return new ApiError(`API request failed with status ${status}.`, status, payload);
|
|
133
|
+
}
|
|
17
134
|
async function parseResponseBody(response) {
|
|
18
135
|
if (response.status === 204 || response.status === 205) {
|
|
19
136
|
return null;
|
|
@@ -45,44 +162,91 @@ export class BaseApiClient {
|
|
|
45
162
|
baseUrl;
|
|
46
163
|
fetchImpl;
|
|
47
164
|
userAgent;
|
|
48
|
-
|
|
165
|
+
timeoutMs;
|
|
166
|
+
retryConfig;
|
|
167
|
+
validateResponses;
|
|
49
168
|
constructor(config) {
|
|
50
169
|
this.apiKey = config.apiKey;
|
|
51
170
|
this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
52
171
|
this.fetchImpl = config.fetchImpl ?? fetch;
|
|
53
172
|
this.userAgent = config.userAgent ?? "@scalepad/cli";
|
|
54
|
-
this.
|
|
173
|
+
this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
174
|
+
this.retryConfig = {
|
|
175
|
+
...DEFAULT_RETRY_CONFIG,
|
|
176
|
+
...(config.retry ?? {}),
|
|
177
|
+
...(config.maxRetries != null ? { maxRetries: config.maxRetries } : {})
|
|
178
|
+
};
|
|
179
|
+
this.validateResponses = config.validateResponses ?? false;
|
|
55
180
|
}
|
|
56
181
|
async requestJson(request) {
|
|
57
182
|
const url = new URL(request.path, this.baseUrl);
|
|
58
183
|
appendQuery(url, request.query);
|
|
184
|
+
const method = request.method.toUpperCase();
|
|
59
185
|
let attempt = 0;
|
|
60
186
|
while (true) {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
187
|
+
const abortController = new AbortController();
|
|
188
|
+
const timeoutHandle = setTimeout(() => {
|
|
189
|
+
abortController.abort();
|
|
190
|
+
}, this.timeoutMs);
|
|
191
|
+
let response;
|
|
192
|
+
try {
|
|
193
|
+
response = await this.fetchImpl(url, {
|
|
194
|
+
method,
|
|
195
|
+
headers: {
|
|
196
|
+
accept: "application/json",
|
|
197
|
+
...(request.body != null ? { "content-type": "application/json" } : {}),
|
|
198
|
+
"x-api-key": this.apiKey,
|
|
199
|
+
"user-agent": this.userAgent
|
|
200
|
+
},
|
|
201
|
+
body: request.body != null ? JSON.stringify(request.body) : undefined,
|
|
202
|
+
signal: abortController.signal
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
clearTimeout(timeoutHandle);
|
|
207
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
208
|
+
throw new TimeoutError(this.timeoutMs);
|
|
209
|
+
}
|
|
210
|
+
throw new NetworkError(`Network request failed: ${error instanceof Error ? error.message : String(error)}`, error);
|
|
211
|
+
}
|
|
212
|
+
clearTimeout(timeoutHandle);
|
|
71
213
|
if (response.ok) {
|
|
72
|
-
|
|
214
|
+
const payload = await parseResponseBody(response);
|
|
215
|
+
return validateResponse(payload, request.validator, this.validateResponses);
|
|
73
216
|
}
|
|
74
|
-
|
|
217
|
+
const retryAfterSeconds = parseRetryAfterSeconds(response.headers.get("retry-after"));
|
|
218
|
+
if (attempt < this.retryConfig.maxRetries && shouldRetryRequest(method, response.status, this.retryConfig)) {
|
|
75
219
|
attempt += 1;
|
|
76
|
-
const
|
|
77
|
-
const waitMs = Number.isFinite(retryAfterSeconds) && retryAfterSeconds > 0
|
|
220
|
+
const waitMs = retryAfterSeconds != null
|
|
78
221
|
? retryAfterSeconds * 1000
|
|
79
222
|
: 500 * (2 ** (attempt - 1));
|
|
80
223
|
await delay(waitMs);
|
|
81
224
|
continue;
|
|
82
225
|
}
|
|
83
226
|
const payload = await parseResponseBody(response);
|
|
84
|
-
throw
|
|
227
|
+
throw createApiError(response.status, payload, retryAfterSeconds);
|
|
85
228
|
}
|
|
86
229
|
}
|
|
87
230
|
}
|
|
231
|
+
export function assertObjectResponse(payload, message = "Expected an object response.") {
|
|
232
|
+
if (!isRecord(payload)) {
|
|
233
|
+
throw new ResponseValidationError(message, payload, ["Response payload must be a JSON object."]);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
export function assertListResponse(payload, message = "Expected a list response envelope.") {
|
|
237
|
+
assertObjectResponse(payload, message);
|
|
238
|
+
const issues = [];
|
|
239
|
+
if (!Array.isArray(payload.data)) {
|
|
240
|
+
issues.push("Response payload must include a data array.");
|
|
241
|
+
}
|
|
242
|
+
if ("total_count" in payload && typeof payload.total_count !== "number") {
|
|
243
|
+
issues.push("total_count must be a number when present.");
|
|
244
|
+
}
|
|
245
|
+
if ("next_cursor" in payload && payload.next_cursor !== null && typeof payload.next_cursor !== "string") {
|
|
246
|
+
issues.push("next_cursor must be a string or null when present.");
|
|
247
|
+
}
|
|
248
|
+
if (issues.length > 0) {
|
|
249
|
+
throw new ResponseValidationError(message, payload, issues);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
88
252
|
//# sourceMappingURL=runtime.js.map
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,OAAO,QAAS,SAAQ,aAAa;IACzB,MAAM,CAAS;IACf,OAAO,CAAU;IAEjC,YAAmB,OAAe,EAAE,MAAc,EAAE,OAAgB;QAClE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,QAAQ;IAC/C,YAAmB,MAAc,EAAE,OAAgB;QACjD,KAAK,CAAC,wBAAwB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,QAAQ;IAC9C,YAAmB,MAAc,EAAE,OAAgB;QACjD,KAAK,CAAC,iDAAiD,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC1E,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,QAAQ;IAC1B,iBAAiB,CAAU;IAE3C,YAAmB,MAAc,EAAE,OAAgB,EAAE,iBAA0B;QAC7E,KAAK,CAAC,sBAAsB,EAAE,MAAM,EAAE,OAAO,CAAC,CAA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,EAAE,CAAC;QACxE,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,aAAa,IAAI,OAAO,IAAI,OAAO,CAAC,WAAW,KAAK,IAAI,IAAI,OAAO,OAAO,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QACxG,MAAM,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalepad/sdk-lm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Thin typed ScalePad Lifecycle Manager helper package used by the ScalePad CLI.",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
7
15
|
"exports": {
|
|
8
16
|
".": {
|
|
9
17
|
"types": "./dist/index.d.ts",
|