@runtypelabs/sdk 0.1.1
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 +398 -0
- package/dist/batch-builder.d.ts +106 -0
- package/dist/batch-builder.d.ts.map +1 -0
- package/dist/batch-builder.js +124 -0
- package/dist/batch-builder.js.map +1 -0
- package/dist/batches-namespace.d.ts +132 -0
- package/dist/batches-namespace.d.ts.map +1 -0
- package/dist/batches-namespace.js +128 -0
- package/dist/batches-namespace.js.map +1 -0
- package/dist/client.d.ts +121 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +485 -0
- package/dist/client.js.map +1 -0
- package/dist/endpoints.d.ts +560 -0
- package/dist/endpoints.d.ts.map +1 -0
- package/dist/endpoints.js +725 -0
- package/dist/endpoints.js.map +1 -0
- package/dist/eval-builder.d.ts +216 -0
- package/dist/eval-builder.d.ts.map +1 -0
- package/dist/eval-builder.js +225 -0
- package/dist/eval-builder.js.map +1 -0
- package/dist/evals-namespace.d.ts +205 -0
- package/dist/evals-namespace.d.ts.map +1 -0
- package/dist/evals-namespace.js +208 -0
- package/dist/evals-namespace.js.map +1 -0
- package/dist/flow-builder.d.ts +620 -0
- package/dist/flow-builder.d.ts.map +1 -0
- package/dist/flow-builder.js +565 -0
- package/dist/flow-builder.js.map +1 -0
- package/dist/flow-result.d.ts +117 -0
- package/dist/flow-result.d.ts.map +1 -0
- package/dist/flow-result.js +175 -0
- package/dist/flow-result.js.map +1 -0
- package/dist/flows-namespace.d.ts +430 -0
- package/dist/flows-namespace.d.ts.map +1 -0
- package/dist/flows-namespace.js +679 -0
- package/dist/flows-namespace.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts-namespace.d.ts +236 -0
- package/dist/prompts-namespace.d.ts.map +1 -0
- package/dist/prompts-namespace.js +222 -0
- package/dist/prompts-namespace.js.map +1 -0
- package/dist/runtype.d.ts +232 -0
- package/dist/runtype.d.ts.map +1 -0
- package/dist/runtype.js +367 -0
- package/dist/runtype.js.map +1 -0
- package/dist/stream-utils.d.ts +58 -0
- package/dist/stream-utils.d.ts.map +1 -0
- package/dist/stream-utils.js +348 -0
- package/dist/stream-utils.js.map +1 -0
- package/dist/transform.d.ts +21 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/transform.js +170 -0
- package/dist/transform.js.map +1 -0
- package/dist/types.d.ts +626 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +61 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Main Runtype API Client with automatic camelCase/snake_case transformation
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.RuntypeApiError = exports.RuntypeClient = void 0;
|
|
40
|
+
exports.createClient = createClient;
|
|
41
|
+
const transform_1 = require("./transform");
|
|
42
|
+
const endpoints_1 = require("./endpoints");
|
|
43
|
+
const flow_builder_1 = require("./flow-builder");
|
|
44
|
+
const flow_result_1 = require("./flow-result");
|
|
45
|
+
/**
|
|
46
|
+
* RuntypeClient - The main entry point for interacting with the Runtype API
|
|
47
|
+
*
|
|
48
|
+
* Automatically transforms field names between camelCase (client) and snake_case (API)
|
|
49
|
+
* to provide an idiomatic JavaScript/TypeScript experience while maintaining API consistency.
|
|
50
|
+
*/
|
|
51
|
+
class RuntypeClient {
|
|
52
|
+
constructor(config = {}) {
|
|
53
|
+
const baseUrl = config.baseUrl || 'https://api.runtype.com';
|
|
54
|
+
this.apiVersion = config.apiVersion || 'v1';
|
|
55
|
+
// Construct versioned base URL (api.runtype.com/v1)
|
|
56
|
+
this.baseUrl = this.apiVersion ? `${baseUrl}/${this.apiVersion}` : baseUrl;
|
|
57
|
+
this.timeout = config.timeout || 30000;
|
|
58
|
+
this.headers = {
|
|
59
|
+
'Content-Type': 'application/json',
|
|
60
|
+
...(config.headers || {})
|
|
61
|
+
};
|
|
62
|
+
// Set API key if provided
|
|
63
|
+
if (config.apiKey) {
|
|
64
|
+
this.headers.Authorization = `Bearer ${config.apiKey}`;
|
|
65
|
+
}
|
|
66
|
+
// Initialize endpoint handlers
|
|
67
|
+
this.flows = new endpoints_1.FlowsEndpoint(this);
|
|
68
|
+
this.prompts = new endpoints_1.PromptsEndpoint(this);
|
|
69
|
+
this.records = new endpoints_1.RecordsEndpoint(this);
|
|
70
|
+
this.apiKeys = new endpoints_1.ApiKeysEndpoint(this);
|
|
71
|
+
this.modelConfigs = new endpoints_1.ModelConfigsEndpoint(this);
|
|
72
|
+
this.dispatch = new endpoints_1.DispatchEndpoint(this);
|
|
73
|
+
this.chat = new endpoints_1.ChatEndpoint(this);
|
|
74
|
+
this.users = new endpoints_1.UsersEndpoint(this);
|
|
75
|
+
this.analytics = new endpoints_1.AnalyticsEndpoint(this);
|
|
76
|
+
this.flowSteps = new endpoints_1.FlowStepsEndpoint(this);
|
|
77
|
+
this.contextTemplates = new endpoints_1.ContextTemplatesEndpoint(this);
|
|
78
|
+
this.tools = new endpoints_1.ToolsEndpoint(this);
|
|
79
|
+
this.eval = new endpoints_1.EvalEndpoint(this);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Set the API key for authentication
|
|
83
|
+
*/
|
|
84
|
+
setApiKey(apiKey) {
|
|
85
|
+
this.headers.Authorization = `Bearer ${apiKey}`;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Start building a flow with fluent API
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const response = await runtype
|
|
93
|
+
* .flow('My Flow')
|
|
94
|
+
* .withRecord({ name: 'Test', type: 'data' })
|
|
95
|
+
* .fetchUrl({ name: 'Fetch', url: '...', outputVariable: 'data' })
|
|
96
|
+
* .prompt({ name: 'Process', model: 'gpt-4', userPrompt: '...' })
|
|
97
|
+
* .run()
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
flow(name) {
|
|
101
|
+
return new flow_builder_1.ClientFlowBuilder({
|
|
102
|
+
dispatch: (config) => this.dispatch.executeStream(config),
|
|
103
|
+
runWithLocalTools: (config, tools) => this.runWithLocalTools(config, tools)
|
|
104
|
+
}, name);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Remove the API key
|
|
108
|
+
*/
|
|
109
|
+
clearApiKey() {
|
|
110
|
+
delete this.headers.Authorization;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Run a flow with client-side tools (automatic pause/resume loop)
|
|
114
|
+
*
|
|
115
|
+
* @param request - The dispatch request configuration
|
|
116
|
+
* @param clientTools - Map of tool names to async functions that execute the tool logic
|
|
117
|
+
* @param callbacks - Optional callbacks for streaming events
|
|
118
|
+
* @returns The final result of the flow execution or summary if streaming
|
|
119
|
+
*/
|
|
120
|
+
async runWithLocalTools(request, localTools, callbacks) {
|
|
121
|
+
// If callbacks are provided, use streaming mode
|
|
122
|
+
// If not, force non-streaming for JSON state machine
|
|
123
|
+
const isStreaming = !!callbacks;
|
|
124
|
+
const modifiedRequest = {
|
|
125
|
+
...request,
|
|
126
|
+
options: {
|
|
127
|
+
...(request.options || {}),
|
|
128
|
+
streamResponse: isStreaming,
|
|
129
|
+
stream_response: isStreaming
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
// Helper to process a step result (either from stream or JSON)
|
|
133
|
+
// Returns { done: boolean, result: any }
|
|
134
|
+
const processStep = async (response) => {
|
|
135
|
+
if (isStreaming) {
|
|
136
|
+
// Stream processing
|
|
137
|
+
let pausedState = null;
|
|
138
|
+
// Wrap user callbacks to intercept paused event
|
|
139
|
+
const wrappedCallbacks = {
|
|
140
|
+
...callbacks,
|
|
141
|
+
onFlowStart: (event) => callbacks?.onFlowStart?.(event),
|
|
142
|
+
onStepStart: (event) => callbacks?.onStepStart?.(event),
|
|
143
|
+
onStepChunk: (chunk, event) => callbacks?.onStepChunk?.(chunk, event),
|
|
144
|
+
onStepComplete: (result, event) => callbacks?.onStepComplete?.(result, event),
|
|
145
|
+
onFlowComplete: (event) => callbacks?.onFlowComplete?.(event),
|
|
146
|
+
onError: (error) => callbacks?.onError?.(error)
|
|
147
|
+
};
|
|
148
|
+
const { streamEvents } = await Promise.resolve().then(() => __importStar(require('./stream-utils')));
|
|
149
|
+
const summary = {
|
|
150
|
+
results: new Map(),
|
|
151
|
+
success: true
|
|
152
|
+
};
|
|
153
|
+
try {
|
|
154
|
+
for await (const event of streamEvents(response)) {
|
|
155
|
+
// Check for flow_paused
|
|
156
|
+
if (event.type === 'flow_paused') {
|
|
157
|
+
// API sends: executionId, flowId, toolId, toolName.
|
|
158
|
+
// Parameters are sent in step_waiting_local event just before this
|
|
159
|
+
pausedState = {
|
|
160
|
+
...pausedState,
|
|
161
|
+
toolName: event.toolName,
|
|
162
|
+
executionId: event.executionId
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
if (event.type === 'step_waiting_local') {
|
|
166
|
+
// Capture parameters
|
|
167
|
+
pausedState = {
|
|
168
|
+
toolName: event.toolName,
|
|
169
|
+
parameters: event.parameters,
|
|
170
|
+
executionId: event.executionId
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
// Handle standard events via callbacks
|
|
174
|
+
switch (event.type) {
|
|
175
|
+
case 'flow_start':
|
|
176
|
+
wrappedCallbacks.onFlowStart?.(event);
|
|
177
|
+
break;
|
|
178
|
+
case 'step_start':
|
|
179
|
+
wrappedCallbacks.onStepStart?.(event);
|
|
180
|
+
break;
|
|
181
|
+
case 'step_chunk': {
|
|
182
|
+
// Normalize API's 'text' field to 'chunk' for consistency
|
|
183
|
+
const chunkText = event.chunk || event.text || '';
|
|
184
|
+
wrappedCallbacks.onStepChunk?.(chunkText, event);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
case 'step_complete':
|
|
188
|
+
summary.results?.set(event.name, event.result);
|
|
189
|
+
wrappedCallbacks.onStepComplete?.(event.result, event);
|
|
190
|
+
break;
|
|
191
|
+
case 'flow_complete':
|
|
192
|
+
wrappedCallbacks.onFlowComplete?.(event);
|
|
193
|
+
break;
|
|
194
|
+
case 'flow_error':
|
|
195
|
+
wrappedCallbacks.onError?.(new Error(event.error));
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
catch (e) {
|
|
201
|
+
wrappedCallbacks.onError?.(e instanceof Error ? e : new Error(String(e)));
|
|
202
|
+
throw e;
|
|
203
|
+
}
|
|
204
|
+
if (pausedState) {
|
|
205
|
+
return { done: false, result: { status: 'paused', pausedReason: { type: 'local_action', ...pausedState } } };
|
|
206
|
+
}
|
|
207
|
+
return { done: true, result: summary };
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
// Non-streaming (JSON)
|
|
211
|
+
const data = await response.json();
|
|
212
|
+
return {
|
|
213
|
+
done: data.status !== 'paused',
|
|
214
|
+
result: data
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
// Initial dispatch
|
|
219
|
+
let currentResponse;
|
|
220
|
+
if (isStreaming) {
|
|
221
|
+
currentResponse = await this.dispatch.executeStream(modifiedRequest);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
const data = await this.dispatch.execute(modifiedRequest);
|
|
225
|
+
currentResponse = new Response(JSON.stringify(data), { headers: { 'content-type': 'application/json' } });
|
|
226
|
+
}
|
|
227
|
+
// Loop
|
|
228
|
+
while (true) {
|
|
229
|
+
const { done, result } = await processStep(currentResponse);
|
|
230
|
+
if (done) {
|
|
231
|
+
if (isStreaming)
|
|
232
|
+
return result;
|
|
233
|
+
return new flow_result_1.FlowResult(new Response(JSON.stringify(result), { headers: { 'content-type': 'application/json' } }));
|
|
234
|
+
}
|
|
235
|
+
// Handle Pause
|
|
236
|
+
if (result.status === 'paused' && result.pausedReason?.type === 'local_action') {
|
|
237
|
+
const { toolName, parameters, executionId } = result.pausedReason;
|
|
238
|
+
if (!localTools[toolName]) {
|
|
239
|
+
throw new Error(`Local tool "${toolName}" required but not provided in localTools map`);
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
// Execute local tool logic
|
|
243
|
+
const toolResult = await localTools[toolName](parameters);
|
|
244
|
+
// Resume flow execution - API expects snake_case field names
|
|
245
|
+
const resumeData = {
|
|
246
|
+
execution_id: executionId,
|
|
247
|
+
tool_outputs: { [toolName]: toolResult },
|
|
248
|
+
stream_response: isStreaming
|
|
249
|
+
};
|
|
250
|
+
if (isStreaming) {
|
|
251
|
+
currentResponse = await this.dispatch.resume(resumeData);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
const data = await this.dispatch.resume(resumeData);
|
|
255
|
+
currentResponse = new Response(JSON.stringify(data), { headers: { 'content-type': 'application/json' } });
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
throw new Error(`Error executing local tool "${toolName}": ${error instanceof Error ? error.message : String(error)}`);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
// Should not happen if done=false
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
throw new Error('Unexpected end of flow execution loop');
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Generic GET request
|
|
271
|
+
*/
|
|
272
|
+
async get(path, params) {
|
|
273
|
+
const url = this.buildUrl(path, params);
|
|
274
|
+
const response = await this.makeRequest(url, {
|
|
275
|
+
method: 'GET',
|
|
276
|
+
headers: this.headers
|
|
277
|
+
});
|
|
278
|
+
return (0, transform_1.transformResponse)(response);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Generic POST request
|
|
282
|
+
*/
|
|
283
|
+
async post(path, data) {
|
|
284
|
+
const url = this.buildUrl(path);
|
|
285
|
+
const response = await this.makeRequest(url, {
|
|
286
|
+
method: 'POST',
|
|
287
|
+
headers: this.headers,
|
|
288
|
+
body: data ? JSON.stringify((0, transform_1.transformRequest)(data)) : undefined
|
|
289
|
+
});
|
|
290
|
+
return (0, transform_1.transformResponse)(response);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* POST request with FormData support for file uploads
|
|
294
|
+
*/
|
|
295
|
+
async postFormData(path, formData) {
|
|
296
|
+
const url = this.buildUrl(path);
|
|
297
|
+
const headers = { ...this.headers };
|
|
298
|
+
// Remove Content-Type to let browser set multipart boundary
|
|
299
|
+
delete headers['Content-Type'];
|
|
300
|
+
const response = await this.makeRequest(url, {
|
|
301
|
+
method: 'POST',
|
|
302
|
+
headers,
|
|
303
|
+
body: formData
|
|
304
|
+
});
|
|
305
|
+
return (0, transform_1.transformResponse)(response);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Generic request that returns raw Response for streaming
|
|
309
|
+
*/
|
|
310
|
+
async requestStream(path, options = {}) {
|
|
311
|
+
const url = this.buildUrl(path);
|
|
312
|
+
const headers = {
|
|
313
|
+
...this.headers,
|
|
314
|
+
...options.headers
|
|
315
|
+
};
|
|
316
|
+
// Transform request body if it's JSON
|
|
317
|
+
let body = options.body;
|
|
318
|
+
if (body && typeof body === 'string' && headers['Content-Type']?.includes('application/json')) {
|
|
319
|
+
try {
|
|
320
|
+
const parsed = JSON.parse(body);
|
|
321
|
+
body = JSON.stringify((0, transform_1.transformRequest)(parsed));
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
// If parsing fails, use original body
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return this.makeRawRequest(url, {
|
|
328
|
+
...options,
|
|
329
|
+
headers,
|
|
330
|
+
body
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Generic PUT request
|
|
335
|
+
*/
|
|
336
|
+
async put(path, data) {
|
|
337
|
+
const url = this.buildUrl(path);
|
|
338
|
+
const response = await this.makeRequest(url, {
|
|
339
|
+
method: 'PUT',
|
|
340
|
+
headers: this.headers,
|
|
341
|
+
body: data ? JSON.stringify((0, transform_1.transformRequest)(data)) : undefined
|
|
342
|
+
});
|
|
343
|
+
return (0, transform_1.transformResponse)(response);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Generic PATCH request
|
|
347
|
+
*/
|
|
348
|
+
async patch(path, data) {
|
|
349
|
+
const url = this.buildUrl(path);
|
|
350
|
+
const response = await this.makeRequest(url, {
|
|
351
|
+
method: 'PATCH',
|
|
352
|
+
headers: this.headers,
|
|
353
|
+
body: data ? JSON.stringify((0, transform_1.transformRequest)(data)) : undefined
|
|
354
|
+
});
|
|
355
|
+
return (0, transform_1.transformResponse)(response);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Generic DELETE request
|
|
359
|
+
*/
|
|
360
|
+
async delete(path, data) {
|
|
361
|
+
const url = this.buildUrl(path);
|
|
362
|
+
const response = await this.makeRequest(url, {
|
|
363
|
+
method: 'DELETE',
|
|
364
|
+
headers: this.headers,
|
|
365
|
+
body: data ? JSON.stringify((0, transform_1.transformRequest)(data)) : undefined
|
|
366
|
+
});
|
|
367
|
+
return (0, transform_1.transformResponse)(response);
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Build full URL with query parameters
|
|
371
|
+
*/
|
|
372
|
+
buildUrl(path, params) {
|
|
373
|
+
// Ensure versioned base URL is treated as a directory by URL()
|
|
374
|
+
const base = this.baseUrl.endsWith('/') ? this.baseUrl : `${this.baseUrl}/`;
|
|
375
|
+
// Avoid leading slash in path which would reset to origin root
|
|
376
|
+
const relPath = path.startsWith('/') ? path.slice(1) : path;
|
|
377
|
+
const url = new URL(relPath, base);
|
|
378
|
+
if (params) {
|
|
379
|
+
const transformedParams = (0, transform_1.transformQueryParams)(params);
|
|
380
|
+
Object.entries(transformedParams).forEach(([key, value]) => {
|
|
381
|
+
url.searchParams.set(key, value);
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
return url.toString();
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Make HTTP request with timeout and error handling
|
|
388
|
+
*/
|
|
389
|
+
async makeRequest(url, options) {
|
|
390
|
+
const controller = new AbortController();
|
|
391
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
392
|
+
try {
|
|
393
|
+
const response = await fetch(url, {
|
|
394
|
+
...options,
|
|
395
|
+
signal: controller.signal
|
|
396
|
+
});
|
|
397
|
+
clearTimeout(timeoutId);
|
|
398
|
+
if (!response.ok) {
|
|
399
|
+
await this.handleErrorResponse(response);
|
|
400
|
+
}
|
|
401
|
+
// Handle empty responses (like 204 No Content)
|
|
402
|
+
if (response.status === 204) {
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
const contentType = response.headers.get('content-type');
|
|
406
|
+
if (contentType?.includes('application/json')) {
|
|
407
|
+
return response.json();
|
|
408
|
+
}
|
|
409
|
+
return response.text();
|
|
410
|
+
}
|
|
411
|
+
catch (error) {
|
|
412
|
+
clearTimeout(timeoutId);
|
|
413
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
414
|
+
throw new Error(`Request timeout after ${this.timeout}ms`);
|
|
415
|
+
}
|
|
416
|
+
throw error;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Make HTTP request that returns raw Response (for streaming)
|
|
421
|
+
*/
|
|
422
|
+
async makeRawRequest(url, options) {
|
|
423
|
+
const controller = new AbortController();
|
|
424
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
425
|
+
try {
|
|
426
|
+
const response = await fetch(url, {
|
|
427
|
+
...options,
|
|
428
|
+
signal: controller.signal
|
|
429
|
+
});
|
|
430
|
+
clearTimeout(timeoutId);
|
|
431
|
+
if (!response.ok) {
|
|
432
|
+
const errorText = await response.text();
|
|
433
|
+
throw new Error(`API request failed: ${response.status} ${response.statusText} - ${errorText}`);
|
|
434
|
+
}
|
|
435
|
+
return response;
|
|
436
|
+
}
|
|
437
|
+
catch (error) {
|
|
438
|
+
clearTimeout(timeoutId);
|
|
439
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
440
|
+
throw new Error(`Request timeout after ${this.timeout}ms`);
|
|
441
|
+
}
|
|
442
|
+
throw error;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Handle error responses
|
|
447
|
+
*/
|
|
448
|
+
async handleErrorResponse(response) {
|
|
449
|
+
let errorData;
|
|
450
|
+
try {
|
|
451
|
+
const contentType = response.headers.get('content-type');
|
|
452
|
+
if (contentType?.includes('application/json')) {
|
|
453
|
+
errorData = await response.json();
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
errorData = { error: await response.text() };
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
catch {
|
|
460
|
+
errorData = { error: 'Unknown error occurred' };
|
|
461
|
+
}
|
|
462
|
+
const error = new RuntypeApiError(errorData.error || errorData.message || 'Request failed', response.status, errorData);
|
|
463
|
+
throw error;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
exports.RuntypeClient = RuntypeClient;
|
|
467
|
+
/**
|
|
468
|
+
* Custom error class for Runtype API errors
|
|
469
|
+
*/
|
|
470
|
+
class RuntypeApiError extends Error {
|
|
471
|
+
constructor(message, statusCode, data) {
|
|
472
|
+
super(message);
|
|
473
|
+
this.statusCode = statusCode;
|
|
474
|
+
this.data = data;
|
|
475
|
+
this.name = 'RuntypeApiError';
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
exports.RuntypeApiError = RuntypeApiError;
|
|
479
|
+
/**
|
|
480
|
+
* Convenience function to create a new RuntypeClient instance
|
|
481
|
+
*/
|
|
482
|
+
function createClient(config) {
|
|
483
|
+
return new RuntypeClient(config);
|
|
484
|
+
}
|
|
485
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAihBH,oCAEC;AAhhBD,2CAAuF;AACvF,2CAeoB;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