@rearray/sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +105 -0
- package/dist/index.cjs +240 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +833 -0
- package/dist/index.d.ts +833 -0
- package/dist/index.js +208 -0
- package/dist/index.js.map +1 -0
- package/openapi/integration-api.json +1145 -0
- package/package.json +44 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// src/errors.ts
|
|
2
|
+
var RearrayApiError = class _RearrayApiError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
status;
|
|
5
|
+
requestId;
|
|
6
|
+
details;
|
|
7
|
+
constructor(code, message, status, requestId, details) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "RearrayApiError";
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.status = status;
|
|
12
|
+
this.requestId = requestId;
|
|
13
|
+
this.details = details;
|
|
14
|
+
}
|
|
15
|
+
static fromBody(body, status) {
|
|
16
|
+
const { code, message, request_id, details } = body.error;
|
|
17
|
+
return new _RearrayApiError(code, message, status, request_id, details);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function isRearrayApiError(error) {
|
|
21
|
+
return error instanceof RearrayApiError;
|
|
22
|
+
}
|
|
23
|
+
function parseErrorBody(body) {
|
|
24
|
+
if (body && typeof body === "object" && "error" in body && body.error && typeof body.error === "object" && "code" in body.error && "message" in body.error) {
|
|
25
|
+
return body;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/pagination.ts
|
|
31
|
+
async function* iterateExecutions(client, params = {}) {
|
|
32
|
+
let cursor = void 0;
|
|
33
|
+
for (; ; ) {
|
|
34
|
+
const page = await client.listExecutions({
|
|
35
|
+
...params,
|
|
36
|
+
...cursor ? { cursor } : {}
|
|
37
|
+
});
|
|
38
|
+
for (const item of page.data ?? []) {
|
|
39
|
+
yield item;
|
|
40
|
+
}
|
|
41
|
+
cursor = page.next_cursor;
|
|
42
|
+
if (!cursor) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/client.ts
|
|
49
|
+
var DEFAULT_BASE_URL = "https://api.rearray.ai/api/v1/integrations";
|
|
50
|
+
var RearrayClient = class {
|
|
51
|
+
apiKey;
|
|
52
|
+
baseUrl;
|
|
53
|
+
fetchFn;
|
|
54
|
+
constructor(options) {
|
|
55
|
+
this.apiKey = options.apiKey;
|
|
56
|
+
this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
|
|
57
|
+
this.fetchFn = options.fetch ?? fetch;
|
|
58
|
+
}
|
|
59
|
+
async createExecution(body, options = {}) {
|
|
60
|
+
const query = options.validateOnly ? "?validate_only=true" : "";
|
|
61
|
+
const headers = {};
|
|
62
|
+
if (options.idempotencyKey) {
|
|
63
|
+
headers["Idempotency-Key"] = options.idempotencyKey;
|
|
64
|
+
}
|
|
65
|
+
return this.request("POST", `/executions${query}`, {
|
|
66
|
+
body,
|
|
67
|
+
headers
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async listExecutions(params = {}) {
|
|
71
|
+
const query = buildQuery(params);
|
|
72
|
+
return this.request("GET", `/executions${query}`);
|
|
73
|
+
}
|
|
74
|
+
async *iterateExecutions(params = {}) {
|
|
75
|
+
yield* iterateExecutions(this, params);
|
|
76
|
+
}
|
|
77
|
+
async getExecution(id) {
|
|
78
|
+
return this.request("GET", `/executions/${id}`);
|
|
79
|
+
}
|
|
80
|
+
async cancelExecution(id) {
|
|
81
|
+
return this.request("POST", `/executions/${id}/cancel`);
|
|
82
|
+
}
|
|
83
|
+
async getExecutionArtifacts(id) {
|
|
84
|
+
return this.request("GET", `/executions/${id}/artifacts`);
|
|
85
|
+
}
|
|
86
|
+
async listTasks() {
|
|
87
|
+
return this.request("GET", "/tasks");
|
|
88
|
+
}
|
|
89
|
+
async getTask(id) {
|
|
90
|
+
return this.request("GET", `/tasks/${id}`);
|
|
91
|
+
}
|
|
92
|
+
async getTaskParamsSchema(id, options = {}) {
|
|
93
|
+
const query = options.version ? `?${new URLSearchParams({ version: options.version }).toString()}` : "";
|
|
94
|
+
return this.request(
|
|
95
|
+
"GET",
|
|
96
|
+
`/tasks/${id}/params-schema${query}`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
async listAgents() {
|
|
100
|
+
return this.request("GET", "/agents");
|
|
101
|
+
}
|
|
102
|
+
async testWebhook(callbackUrl) {
|
|
103
|
+
return this.request("POST", "/webhooks/test", {
|
|
104
|
+
body: { callback_url: callbackUrl }
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async request(method, path, init = {}) {
|
|
108
|
+
const url = `${this.baseUrl.replace(/\/$/, "")}${path}`;
|
|
109
|
+
const headers = {
|
|
110
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
111
|
+
Accept: "application/json",
|
|
112
|
+
...init.headers
|
|
113
|
+
};
|
|
114
|
+
const requestInit = {
|
|
115
|
+
method,
|
|
116
|
+
headers
|
|
117
|
+
};
|
|
118
|
+
if (init.body !== void 0) {
|
|
119
|
+
headers["Content-Type"] = "application/json";
|
|
120
|
+
requestInit.body = JSON.stringify(init.body);
|
|
121
|
+
}
|
|
122
|
+
const response = await this.fetchFn(url, requestInit);
|
|
123
|
+
const text = await response.text();
|
|
124
|
+
const json = text.length > 0 ? safeJsonParse(text) : null;
|
|
125
|
+
if (!response.ok) {
|
|
126
|
+
const errorBody = parseErrorBody(json);
|
|
127
|
+
if (errorBody) {
|
|
128
|
+
throw RearrayApiError.fromBody(errorBody, response.status);
|
|
129
|
+
}
|
|
130
|
+
throw new Error(
|
|
131
|
+
`Request failed with status ${response.status}: ${text || response.statusText}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
return json;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
function buildQuery(params) {
|
|
138
|
+
const search = new URLSearchParams();
|
|
139
|
+
for (const [key, value] of Object.entries(params)) {
|
|
140
|
+
if (value !== void 0 && value !== null) {
|
|
141
|
+
search.set(key, String(value));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const qs = search.toString();
|
|
145
|
+
return qs ? `?${qs}` : "";
|
|
146
|
+
}
|
|
147
|
+
function safeJsonParse(text) {
|
|
148
|
+
try {
|
|
149
|
+
return JSON.parse(text);
|
|
150
|
+
} catch {
|
|
151
|
+
return text;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// src/webhooks.ts
|
|
156
|
+
function buildCanonicalString(payload, timestamp) {
|
|
157
|
+
return `${payload}${timestamp}`;
|
|
158
|
+
}
|
|
159
|
+
async function signPayload(payload, timestamp, secret) {
|
|
160
|
+
const enc = new TextEncoder();
|
|
161
|
+
const key = await crypto.subtle.importKey(
|
|
162
|
+
"raw",
|
|
163
|
+
enc.encode(secret),
|
|
164
|
+
{ name: "HMAC", hash: "SHA-256" },
|
|
165
|
+
false,
|
|
166
|
+
["sign"]
|
|
167
|
+
);
|
|
168
|
+
const sig = await crypto.subtle.sign(
|
|
169
|
+
"HMAC",
|
|
170
|
+
key,
|
|
171
|
+
enc.encode(buildCanonicalString(payload, timestamp))
|
|
172
|
+
);
|
|
173
|
+
return Array.from(new Uint8Array(sig)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
174
|
+
}
|
|
175
|
+
function constantTimeEqual(a, b) {
|
|
176
|
+
if (a.length !== b.length) return false;
|
|
177
|
+
let diff = 0;
|
|
178
|
+
for (let i = 0; i < a.length; i++) {
|
|
179
|
+
diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
180
|
+
}
|
|
181
|
+
return diff === 0;
|
|
182
|
+
}
|
|
183
|
+
async function verifyWebhookSignature(options) {
|
|
184
|
+
const {
|
|
185
|
+
payload,
|
|
186
|
+
timestamp,
|
|
187
|
+
signature,
|
|
188
|
+
secret,
|
|
189
|
+
toleranceSeconds = 300
|
|
190
|
+
} = options;
|
|
191
|
+
if (toleranceSeconds > 0) {
|
|
192
|
+
const ts = Number.parseInt(timestamp, 10);
|
|
193
|
+
if (!Number.isFinite(ts)) return false;
|
|
194
|
+
const age = Math.abs(Math.floor(Date.now() / 1e3) - ts);
|
|
195
|
+
if (age > toleranceSeconds) return false;
|
|
196
|
+
}
|
|
197
|
+
const expected = await signPayload(payload, timestamp, secret);
|
|
198
|
+
return constantTimeEqual(expected, signature);
|
|
199
|
+
}
|
|
200
|
+
export {
|
|
201
|
+
RearrayApiError,
|
|
202
|
+
RearrayClient,
|
|
203
|
+
isRearrayApiError,
|
|
204
|
+
iterateExecutions,
|
|
205
|
+
parseErrorBody,
|
|
206
|
+
verifyWebhookSignature
|
|
207
|
+
};
|
|
208
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/pagination.ts","../src/client.ts","../src/webhooks.ts"],"sourcesContent":["import type { components } from './generated/openapi.js';\n\nexport type RearrayErrorCode =\n components['schemas']['Error']['error']['code'];\n\nexport type RearrayErrorBody = components['schemas']['Error'];\n\nexport class RearrayApiError extends Error {\n readonly code: RearrayErrorCode;\n readonly status: number;\n readonly requestId?: string;\n readonly details?: unknown;\n\n constructor(\n code: RearrayErrorCode,\n message: string,\n status: number,\n requestId?: string,\n details?: unknown,\n ) {\n super(message);\n this.name = 'RearrayApiError';\n this.code = code;\n this.status = status;\n this.requestId = requestId;\n this.details = details;\n }\n\n static fromBody(body: RearrayErrorBody, status: number): RearrayApiError {\n const { code, message, request_id, details } = body.error;\n return new RearrayApiError(code, message, status, request_id, details);\n }\n}\n\nexport function isRearrayApiError(error: unknown): error is RearrayApiError {\n return error instanceof RearrayApiError;\n}\n\nexport function parseErrorBody(body: unknown): RearrayErrorBody | null {\n if (\n body &&\n typeof body === 'object' &&\n 'error' in body &&\n body.error &&\n typeof body.error === 'object' &&\n 'code' in body.error &&\n 'message' in body.error\n ) {\n return body as RearrayErrorBody;\n }\n return null;\n}\n","import type { components, paths } from './generated/openapi.js';\n\nexport type Execution = components['schemas']['Execution'];\n\nexport type ListExecutionsParams = NonNullable<\n paths['/executions']['get']['parameters']['query']\n>;\n\nexport type ListExecutionsResponse =\n paths['/executions']['get']['responses'][200]['content']['application/json'];\n\nexport type ExecutionLister = {\n listExecutions(params?: ListExecutionsParams): Promise<ListExecutionsResponse>;\n};\n\nexport async function* iterateExecutions(\n client: ExecutionLister,\n params: ListExecutionsParams = {},\n): AsyncGenerator<Execution, void, undefined> {\n let cursor: string | null | undefined = undefined;\n\n for (;;) {\n const page = await client.listExecutions({\n ...params,\n ...(cursor ? { cursor } : {}),\n });\n\n for (const item of page.data ?? []) {\n yield item;\n }\n\n cursor = page.next_cursor;\n if (!cursor) {\n return;\n }\n }\n}\n","import type { components, paths } from './generated/openapi.js';\nimport { parseErrorBody, RearrayApiError } from './errors.js';\nimport { iterateExecutions as iterateExecutionsImpl } from './pagination.js';\n\n/** Webhook callback payload (not yet in OpenAPI). */\nexport type WebhookEvent = {\n event_id: string;\n type: string;\n occurred_at: string;\n request_id?: string;\n reference?: string | null;\n metadata?: Record<string, unknown>;\n execution?: Record<string, unknown> | null;\n message?: string;\n};\n\nexport type CreateExecutionRequest =\n components['schemas']['CreateExecutionRequest'];\nexport type CreateExecutionResponse =\n components['schemas']['CreateExecutionResponse'];\nexport type Execution = components['schemas']['Execution'];\nexport type ExecutionDetail = components['schemas']['ExecutionDetail'];\nexport type ArtifactsResponse = components['schemas']['ArtifactsResponse'];\nexport type Task = components['schemas']['Task'];\nexport type TaskDetail = components['schemas']['TaskDetail'];\nexport type ParamsSchemaResponse =\n components['schemas']['ParamsSchemaResponse'];\nexport type Agent = components['schemas']['Agent'];\n\nexport type ListExecutionsParams = NonNullable<\n paths['/executions']['get']['parameters']['query']\n>;\n\nexport type ListExecutionsResponse =\n paths['/executions']['get']['responses'][200]['content']['application/json'];\n\nexport type CreateExecutionOptions = {\n idempotencyKey?: string;\n validateOnly?: boolean;\n};\n\nexport type GetTaskParamsSchemaOptions = {\n version?: string;\n};\n\nexport type RearrayClientOptions = {\n apiKey: string;\n baseUrl?: string;\n fetch?: typeof fetch;\n};\n\nconst DEFAULT_BASE_URL = 'https://api.rearray.ai/api/v1/integrations';\n\nexport class RearrayClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly fetchFn: typeof fetch;\n\n constructor(options: RearrayClientOptions) {\n this.apiKey = options.apiKey;\n this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;\n this.fetchFn = options.fetch ?? fetch;\n }\n\n async createExecution(\n body: CreateExecutionRequest,\n options: CreateExecutionOptions = {},\n ): Promise<CreateExecutionResponse> {\n const query = options.validateOnly ? '?validate_only=true' : '';\n const headers: Record<string, string> = {};\n if (options.idempotencyKey) {\n headers['Idempotency-Key'] = options.idempotencyKey;\n }\n return this.request<CreateExecutionResponse>('POST', `/executions${query}`, {\n body,\n headers,\n });\n }\n\n async listExecutions(\n params: ListExecutionsParams = {},\n ): Promise<ListExecutionsResponse> {\n const query = buildQuery(params);\n return this.request<ListExecutionsResponse>('GET', `/executions${query}`);\n }\n\n async *iterateExecutions(\n params: ListExecutionsParams = {},\n ): AsyncGenerator<Execution, void, undefined> {\n yield* iterateExecutionsImpl(this, params);\n }\n\n async getExecution(id: string): Promise<ExecutionDetail> {\n return this.request<ExecutionDetail>('GET', `/executions/${id}`);\n }\n\n async cancelExecution(id: string): Promise<components['schemas']['CancelExecutionResponse']> {\n return this.request('POST', `/executions/${id}/cancel`);\n }\n\n async getExecutionArtifacts(id: string): Promise<ArtifactsResponse> {\n return this.request<ArtifactsResponse>('GET', `/executions/${id}/artifacts`);\n }\n\n async listTasks(): Promise<{\n data?: Task[];\n request_id?: string;\n }> {\n return this.request('GET', '/tasks');\n }\n\n async getTask(id: string): Promise<TaskDetail> {\n return this.request<TaskDetail>('GET', `/tasks/${id}`);\n }\n\n async getTaskParamsSchema(\n id: string,\n options: GetTaskParamsSchemaOptions = {},\n ): Promise<ParamsSchemaResponse> {\n const query = options.version\n ? `?${new URLSearchParams({ version: options.version }).toString()}`\n : '';\n return this.request<ParamsSchemaResponse>(\n 'GET',\n `/tasks/${id}/params-schema${query}`,\n );\n }\n\n async listAgents(): Promise<{\n data?: Agent[];\n request_id?: string;\n }> {\n return this.request('GET', '/agents');\n }\n\n async testWebhook(callbackUrl: string): Promise<components['schemas']['WebhookTestResponse']> {\n return this.request('POST', '/webhooks/test', {\n body: { callback_url: callbackUrl },\n });\n }\n\n private async request<T>(\n method: string,\n path: string,\n init: {\n body?: unknown;\n headers?: Record<string, string>;\n } = {},\n ): Promise<T> {\n const url = `${this.baseUrl.replace(/\\/$/, '')}${path}`;\n const headers: Record<string, string> = {\n Authorization: `Bearer ${this.apiKey}`,\n Accept: 'application/json',\n ...init.headers,\n };\n\n const requestInit: RequestInit = {\n method,\n headers,\n };\n\n if (init.body !== undefined) {\n headers['Content-Type'] = 'application/json';\n requestInit.body = JSON.stringify(init.body);\n }\n\n const response = await this.fetchFn(url, requestInit);\n const text = await response.text();\n const json = text.length > 0 ? safeJsonParse(text) : null;\n\n if (!response.ok) {\n const errorBody = parseErrorBody(json);\n if (errorBody) {\n throw RearrayApiError.fromBody(errorBody, response.status);\n }\n throw new Error(\n `Request failed with status ${response.status}: ${text || response.statusText}`,\n );\n }\n\n return json as T;\n }\n}\n\nfunction buildQuery(params: Record<string, string | number | undefined>): string {\n const search = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n search.set(key, String(value));\n }\n }\n const qs = search.toString();\n return qs ? `?${qs}` : '';\n}\n\nfunction safeJsonParse(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n}\n","export type VerifyWebhookSignatureOptions = {\n payload: string;\n timestamp: string;\n signature: string;\n secret: string;\n /** Reject timestamps older than this many seconds (default: 300). Set to 0 to skip. */\n toleranceSeconds?: number;\n};\n\nfunction buildCanonicalString(payload: string, timestamp: string): string {\n return `${payload}${timestamp}`;\n}\n\nasync function signPayload(\n payload: string,\n timestamp: string,\n secret: string,\n): Promise<string> {\n const enc = new TextEncoder();\n const key = await crypto.subtle.importKey(\n 'raw',\n enc.encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign'],\n );\n const sig = await crypto.subtle.sign(\n 'HMAC',\n key,\n enc.encode(buildCanonicalString(payload, timestamp)),\n );\n return Array.from(new Uint8Array(sig))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('');\n}\n\nfunction constantTimeEqual(a: string, b: string): boolean {\n if (a.length !== b.length) return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++) {\n diff |= a.charCodeAt(i) ^ b.charCodeAt(i);\n }\n return diff === 0;\n}\n\nexport async function verifyWebhookSignature(\n options: VerifyWebhookSignatureOptions,\n): Promise<boolean> {\n const {\n payload,\n timestamp,\n signature,\n secret,\n toleranceSeconds = 300,\n } = options;\n\n if (toleranceSeconds > 0) {\n const ts = Number.parseInt(timestamp, 10);\n if (!Number.isFinite(ts)) return false;\n const age = Math.abs(Math.floor(Date.now() / 1000) - ts);\n if (age > toleranceSeconds) return false;\n }\n\n const expected = await signPayload(payload, timestamp, secret);\n return constantTimeEqual(expected, signature);\n}\n\n/** ponytail: test-only helper mirroring server signing for the one runnable check */\nexport async function signWebhookPayloadForTest(\n payload: string,\n timestamp: string,\n secret: string,\n): Promise<string> {\n return signPayload(payload, timestamp, secret);\n}\n"],"mappings":";AAOO,IAAM,kBAAN,MAAM,yBAAwB,MAAM;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YACE,MACA,SACA,QACA,WACA,SACA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AACd,SAAK,YAAY;AACjB,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,OAAO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