@tapi-dev/sdk 0.1.5 → 0.1.7

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.
@@ -0,0 +1,22 @@
1
+ import type { HttpClient } from "./client.js";
2
+ import type { CloudBatchRun, CloudBalance, CloudCreditCheckout, CloudCreditCheckoutRequest, CloudRunEvent, CloudRunResults, CloudRunUser } from "./types.js";
3
+ export declare class CloudRunsResource {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ get(runId: string): Promise<CloudBatchRun>;
7
+ events(runId: string): Promise<{
8
+ events: CloudRunEvent[];
9
+ }>;
10
+ results(runId: string): Promise<CloudRunResults>;
11
+ cancel(runId: string): Promise<CloudBatchRun>;
12
+ balance(user?: CloudRunUser): Promise<CloudBalance>;
13
+ checkout(request: CloudCreditCheckoutRequest): Promise<CloudCreditCheckout>;
14
+ wait(runId: string, options?: {
15
+ intervalMs?: number;
16
+ timeoutMs?: number;
17
+ }): Promise<CloudBatchRun>;
18
+ stream(runId: string, options?: {
19
+ intervalMs?: number;
20
+ timeoutMs?: number;
21
+ }): AsyncGenerator<CloudRunEvent, void, unknown>;
22
+ }
@@ -0,0 +1,71 @@
1
+ export class CloudRunsResource {
2
+ http;
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ get(runId) {
7
+ return this.http.get(`/api/sdk/v1/cloud-runs/${encodeURIComponent(runId)}`);
8
+ }
9
+ events(runId) {
10
+ return this.http.get(`/api/sdk/v1/cloud-runs/${encodeURIComponent(runId)}/events`);
11
+ }
12
+ results(runId) {
13
+ return this.http.get(`/api/sdk/v1/cloud-runs/${encodeURIComponent(runId)}/results`);
14
+ }
15
+ cancel(runId) {
16
+ return this.http.post(`/api/sdk/v1/cloud-runs/${encodeURIComponent(runId)}/cancel`);
17
+ }
18
+ balance(user) {
19
+ return this.http.get(`/api/sdk/v1/billing/cloud/balance${cloudUserQuery(user)}`);
20
+ }
21
+ checkout(request) {
22
+ return this.http.post("/api/sdk/v1/billing/cloud/checkout", request);
23
+ }
24
+ async wait(runId, options = {}) {
25
+ const intervalMs = options.intervalMs ?? 1000;
26
+ const deadline = Date.now() + (options.timeoutMs ?? 300000);
27
+ while (Date.now() <= deadline) {
28
+ const run = await this.get(runId);
29
+ if (["completed", "failed", "cancelled", "payment_required"].includes(run.status)) {
30
+ return run;
31
+ }
32
+ await new Promise((resolve) => setTimeout(resolve, intervalMs));
33
+ }
34
+ throw new Error(`timed out waiting for cloud run ${runId}`);
35
+ }
36
+ async *stream(runId, options = {}) {
37
+ const intervalMs = options.intervalMs ?? 1000;
38
+ const deadline = Date.now() + (options.timeoutMs ?? 300000);
39
+ const seen = new Set();
40
+ while (Date.now() <= deadline) {
41
+ const response = await this.events(runId);
42
+ for (const event of response.events) {
43
+ const key = `${event.type}:${event.itemIndex ?? ""}:${event.status ?? ""}:${event.updatedAt ?? ""}`;
44
+ if (!seen.has(key)) {
45
+ seen.add(key);
46
+ yield event;
47
+ }
48
+ }
49
+ const run = await this.get(runId);
50
+ if (["completed", "failed", "cancelled", "payment_required"].includes(run.status)) {
51
+ return;
52
+ }
53
+ await new Promise((resolve) => setTimeout(resolve, intervalMs));
54
+ }
55
+ throw new Error(`timed out streaming cloud run ${runId}`);
56
+ }
57
+ }
58
+ function cloudUserQuery(user) {
59
+ if (!user) {
60
+ return "";
61
+ }
62
+ const params = new URLSearchParams();
63
+ if (user.externalUserId) {
64
+ params.set("externalUserId", user.externalUserId);
65
+ }
66
+ if (user.email) {
67
+ params.set("email", user.email);
68
+ }
69
+ const text = params.toString();
70
+ return text ? `?${text}` : "";
71
+ }
package/dist/index.d.ts CHANGED
@@ -1,16 +1,18 @@
1
- import { CatalogResource } from "./catalog";
2
- import { RunnersResource } from "./runners";
3
- import { RunsResource } from "./runs";
4
- import { RuntimeResource } from "./runtime";
5
- import type { TapiClientOptions } from "./types";
6
- import { WebsiteApisResource } from "./website-apis";
1
+ import { CloudRunsResource } from "./cloud-runs.js";
2
+ import { CatalogResource } from "./catalog.js";
3
+ import { RunnersResource } from "./runners.js";
4
+ import { RunsResource } from "./runs.js";
5
+ import { RuntimeResource } from "./runtime.js";
6
+ import type { TapiClientOptions } from "./types.js";
7
+ import { WebsiteApisResource } from "./website-apis.js";
7
8
  export declare class TapiClient {
8
9
  readonly catalog: CatalogResource;
10
+ readonly cloudRuns: CloudRunsResource;
9
11
  readonly runners: RunnersResource;
10
12
  readonly runs: RunsResource;
11
13
  readonly runtime: RuntimeResource;
12
14
  readonly websiteApis: WebsiteApisResource;
13
15
  constructor(options: TapiClientOptions);
14
16
  }
15
- export * from "./errors";
16
- export * from "./types";
17
+ export * from "./errors.js";
18
+ export * from "./types.js";
package/dist/index.js CHANGED
@@ -1,11 +1,13 @@
1
- import { HttpClient } from "./client";
2
- import { CatalogResource } from "./catalog";
3
- import { RunnersResource } from "./runners";
4
- import { RunsResource } from "./runs";
5
- import { RuntimeResource } from "./runtime";
6
- import { WebsiteApisResource } from "./website-apis";
1
+ import { HttpClient } from "./client.js";
2
+ import { CloudRunsResource } from "./cloud-runs.js";
3
+ import { CatalogResource } from "./catalog.js";
4
+ import { RunnersResource } from "./runners.js";
5
+ import { RunsResource } from "./runs.js";
6
+ import { RuntimeResource } from "./runtime.js";
7
+ import { WebsiteApisResource } from "./website-apis.js";
7
8
  export class TapiClient {
8
9
  catalog;
10
+ cloudRuns;
9
11
  runners;
10
12
  runs;
11
13
  runtime;
@@ -13,11 +15,12 @@ export class TapiClient {
13
15
  constructor(options) {
14
16
  const http = new HttpClient(options);
15
17
  this.catalog = new CatalogResource(http);
18
+ this.cloudRuns = new CloudRunsResource(http);
16
19
  this.runners = new RunnersResource(http);
17
20
  this.runs = new RunsResource(http);
18
- this.runtime = new RuntimeResource(http);
21
+ this.runtime = new RuntimeResource(http, options);
19
22
  this.websiteApis = new WebsiteApisResource(http);
20
23
  }
21
24
  }
22
- export * from "./errors";
23
- export * from "./types";
25
+ export * from "./errors.js";
26
+ export * from "./types.js";
package/dist/runners.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { HttpClient } from "./client";
2
- import type { TapiRunner } from "./types";
1
+ import type { HttpClient } from "./client.js";
2
+ import type { TapiRunner } from "./types.js";
3
3
  export declare class RunnersResource {
4
4
  private readonly http;
5
5
  constructor(http: HttpClient);
package/dist/runs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { HttpClient } from "./client";
2
- import type { TapiRun } from "./types";
1
+ import type { HttpClient } from "./client.js";
2
+ import type { TapiRun } from "./types.js";
3
3
  export declare class RunsResource {
4
4
  private readonly http;
5
5
  constructor(http: HttpClient);
package/dist/runtime.d.ts CHANGED
@@ -1,7 +1,41 @@
1
- import type { HttpClient } from "./client";
2
- import type { RuntimeRequirements } from "./types";
1
+ import type { HttpClient } from "./client.js";
2
+ import type { CreatePermProfileRequest, CreateRuntimeCloneRequest, LaunchPermProfileSetupRequest, LocalWebSocketConstructor, ProvisionTempProfilesRequest, PromoteTempProfileRequest, RuntimeProfileListResponse, RuntimeProfileResponse, RuntimeProfilesDestroyedResponse, RuntimeRequirements, TapiClientOptions } from "./types.js";
3
3
  export declare class RuntimeResource {
4
4
  private readonly http;
5
- constructor(http: HttpClient);
5
+ readonly profiles: RuntimeProfilesResource;
6
+ readonly permProfiles: PermProfilesResource;
7
+ readonly tempProfiles: TempProfilesResource;
8
+ private readonly rpc;
9
+ constructor(http: HttpClient, options: TapiClientOptions);
6
10
  requirements(): Promise<RuntimeRequirements>;
7
11
  }
12
+ export declare class RuntimeProfilesResource {
13
+ private readonly rpc;
14
+ constructor(rpc: LocalRuntimeRpc);
15
+ list(options?: {
16
+ includeClones?: boolean;
17
+ }): Promise<RuntimeProfileListResponse>;
18
+ destroy(profileRef: string): Promise<RuntimeProfilesDestroyedResponse>;
19
+ clone(request: string | CreateRuntimeCloneRequest): Promise<RuntimeProfileResponse>;
20
+ }
21
+ export declare class PermProfilesResource {
22
+ private readonly rpc;
23
+ constructor(rpc: LocalRuntimeRpc);
24
+ create(request: CreatePermProfileRequest): Promise<RuntimeProfileResponse>;
25
+ launchSetup(request: string | LaunchPermProfileSetupRequest): Promise<Record<string, unknown>>;
26
+ }
27
+ export declare class TempProfilesResource {
28
+ private readonly rpc;
29
+ constructor(rpc: LocalRuntimeRpc);
30
+ provisionMany(request?: ProvisionTempProfilesRequest): Promise<RuntimeProfileListResponse>;
31
+ promote(request: string | PromoteTempProfileRequest): Promise<RuntimeProfileResponse>;
32
+ }
33
+ declare class LocalRuntimeRpc {
34
+ private readonly url;
35
+ private readonly webSocketCtor?;
36
+ private nextId;
37
+ constructor(url: string, webSocketCtor?: LocalWebSocketConstructor | undefined);
38
+ request<T>(method: string, params?: object): Promise<T>;
39
+ private resolveWebSocket;
40
+ }
41
+ export {};
package/dist/runtime.js CHANGED
@@ -1,9 +1,140 @@
1
1
  export class RuntimeResource {
2
2
  http;
3
- constructor(http) {
3
+ profiles;
4
+ permProfiles;
5
+ tempProfiles;
6
+ rpc;
7
+ constructor(http, options) {
4
8
  this.http = http;
9
+ this.rpc = new LocalRuntimeRpc(options.localControlUrl ?? "ws://127.0.0.1:8765", options.webSocket);
10
+ this.profiles = new RuntimeProfilesResource(this.rpc);
11
+ this.permProfiles = new PermProfilesResource(this.rpc);
12
+ this.tempProfiles = new TempProfilesResource(this.rpc);
5
13
  }
6
14
  requirements() {
7
15
  return this.http.get("/api/sdk/v1/runtime/requirements");
8
16
  }
9
17
  }
18
+ export class RuntimeProfilesResource {
19
+ rpc;
20
+ constructor(rpc) {
21
+ this.rpc = rpc;
22
+ }
23
+ list(options = {}) {
24
+ return this.rpc.request("runtime.profiles.list", {
25
+ includeClones: options.includeClones === true,
26
+ });
27
+ }
28
+ destroy(profileRef) {
29
+ return this.rpc.request("runtime.profiles.destroy", { profileRef });
30
+ }
31
+ clone(request) {
32
+ const payload = typeof request === "string" ? { profileRef: request } : request;
33
+ return this.rpc.request("runtime.profiles.clone", payload);
34
+ }
35
+ }
36
+ export class PermProfilesResource {
37
+ rpc;
38
+ constructor(rpc) {
39
+ this.rpc = rpc;
40
+ }
41
+ create(request) {
42
+ return this.rpc.request("runtime.perm_profiles.create", request);
43
+ }
44
+ launchSetup(request) {
45
+ const payload = typeof request === "string" ? { profileRef: request } : request;
46
+ return this.rpc.request("runtime.perm_profiles.launch_setup", payload);
47
+ }
48
+ }
49
+ export class TempProfilesResource {
50
+ rpc;
51
+ constructor(rpc) {
52
+ this.rpc = rpc;
53
+ }
54
+ provisionMany(request = {}) {
55
+ return this.rpc.request("runtime.temp_profiles.provision_many", request);
56
+ }
57
+ promote(request) {
58
+ const payload = typeof request === "string" ? { profileRef: request } : request;
59
+ return this.rpc.request("runtime.temp_profiles.promote", payload);
60
+ }
61
+ }
62
+ class LocalRuntimeRpc {
63
+ url;
64
+ webSocketCtor;
65
+ nextId = 1;
66
+ constructor(url, webSocketCtor) {
67
+ this.url = url;
68
+ this.webSocketCtor = webSocketCtor;
69
+ }
70
+ request(method, params = {}) {
71
+ const WebSocketCtor = this.resolveWebSocket();
72
+ const id = this.nextId++;
73
+ return new Promise((resolve, reject) => {
74
+ let settled = false;
75
+ const socket = new WebSocketCtor(this.url);
76
+ const finish = (fn) => {
77
+ if (settled) {
78
+ return;
79
+ }
80
+ settled = true;
81
+ try {
82
+ socket.close();
83
+ }
84
+ catch {
85
+ // Ignore close failures; the RPC already has its outcome.
86
+ }
87
+ fn();
88
+ };
89
+ socket.onopen = () => {
90
+ socket.send(JSON.stringify({ id, method, params }));
91
+ };
92
+ socket.onmessage = (event) => {
93
+ let payload;
94
+ try {
95
+ payload = JSON.parse(String(event.data));
96
+ }
97
+ catch (error) {
98
+ finish(() => reject(error));
99
+ return;
100
+ }
101
+ if (payload.id !== id) {
102
+ return;
103
+ }
104
+ if (payload.error !== undefined) {
105
+ finish(() => reject(new Error(formatRpcError(payload.error))));
106
+ return;
107
+ }
108
+ finish(() => resolve(payload.result));
109
+ };
110
+ socket.onerror = () => {
111
+ finish(() => reject(new Error(`TAPI local runtime RPC failed: ${method}`)));
112
+ };
113
+ socket.onclose = () => {
114
+ if (!settled) {
115
+ finish(() => reject(new Error(`TAPI local runtime closed before ${method} completed`)));
116
+ }
117
+ };
118
+ });
119
+ }
120
+ resolveWebSocket() {
121
+ if (this.webSocketCtor) {
122
+ return this.webSocketCtor;
123
+ }
124
+ const globalWebSocket = globalThis.WebSocket;
125
+ if (globalWebSocket) {
126
+ return globalWebSocket;
127
+ }
128
+ throw new Error("No WebSocket implementation is available. Pass { webSocket } to TapiClient to use local runtime profile APIs.");
129
+ }
130
+ }
131
+ function formatRpcError(error) {
132
+ if (typeof error === "string") {
133
+ return error;
134
+ }
135
+ if (typeof error === "object" && error !== null) {
136
+ const record = error;
137
+ return String(record.message ?? record.error ?? JSON.stringify(record));
138
+ }
139
+ return String(error);
140
+ }
package/dist/types.d.ts CHANGED
@@ -4,12 +4,163 @@ export interface TapiClientOptions {
4
4
  apiKey: string;
5
5
  appId?: string;
6
6
  fetch?: typeof fetch;
7
+ localControlUrl?: string;
8
+ webSocket?: LocalWebSocketConstructor;
7
9
  }
8
10
  export interface WebsiteApiRunRequest {
9
11
  inputs?: Record<string, unknown>;
12
+ runtime?: RuntimeRunOptions;
10
13
  priority?: number;
11
14
  runnerId?: string;
12
15
  idempotencyKey?: string;
16
+ site?: string;
17
+ }
18
+ export interface CloudRunOptions {
19
+ windows?: boolean;
20
+ maxVms?: number;
21
+ chromePerVm?: number;
22
+ maxCostUsd?: number;
23
+ [key: string]: unknown;
24
+ }
25
+ export interface CloudRunUser {
26
+ externalUserId: string;
27
+ email?: string;
28
+ }
29
+ export interface CloudRunPaymentOptions {
30
+ successUrl?: string;
31
+ cancelUrl?: string;
32
+ }
33
+ export interface WebsiteApiCloudQuoteRequest {
34
+ inputs?: Array<Record<string, unknown>>;
35
+ cloud?: CloudRunOptions;
36
+ user?: CloudRunUser;
37
+ site?: string;
38
+ }
39
+ export interface WebsiteApiCloudBatchRequest {
40
+ inputs: Array<Record<string, unknown>>;
41
+ cloud?: CloudRunOptions;
42
+ user?: CloudRunUser;
43
+ payment?: CloudRunPaymentOptions;
44
+ site?: string;
45
+ idempotencyKey?: string;
46
+ }
47
+ export interface CloudRunQuote {
48
+ inputCount: number;
49
+ windows: boolean;
50
+ maxVms: number;
51
+ chromePerVm: number;
52
+ estimatedVms: number;
53
+ estimatedVmSeconds: number;
54
+ estimatedCostCents: number;
55
+ requiredBalanceCents: number;
56
+ currency: string;
57
+ maxCostUsd?: number | null;
58
+ withinMaxCost?: boolean;
59
+ billingEnabled?: boolean;
60
+ availableBalanceCents?: number | null;
61
+ minimumBalanceCents?: number;
62
+ user?: CloudRunUser;
63
+ [key: string]: unknown;
64
+ }
65
+ export interface CloudBatchRun {
66
+ id: string;
67
+ status: RunStatus | "payment_required" | "provisioning";
68
+ apiName?: string;
69
+ requestKey?: string;
70
+ site?: string;
71
+ inputCount?: number;
72
+ completedCount?: number;
73
+ failedCount?: number;
74
+ cancelledCount?: number;
75
+ cloud?: CloudRunOptions | Record<string, unknown>;
76
+ quote?: CloudRunQuote | Record<string, unknown>;
77
+ user?: CloudRunUser;
78
+ paymentRequired?: boolean;
79
+ checkoutUrl?: string | null;
80
+ checkoutSessionId?: string | null;
81
+ paymentProvider?: string;
82
+ paymentProviderEnabled?: boolean;
83
+ availableBalanceCents?: number;
84
+ requiredBalanceCents?: number;
85
+ reservationCents?: number;
86
+ actualCostCents?: number;
87
+ error?: Record<string, unknown> | null;
88
+ traceId?: string;
89
+ createdAt?: string;
90
+ updatedAt?: string;
91
+ [key: string]: unknown;
92
+ }
93
+ export interface CloudRunEvent {
94
+ runId: string;
95
+ type: string;
96
+ status?: string;
97
+ itemIndex?: number;
98
+ traceId?: string;
99
+ createdAt?: string;
100
+ updatedAt?: string;
101
+ [key: string]: unknown;
102
+ }
103
+ export interface CloudRunResultItem {
104
+ index: number;
105
+ status: string;
106
+ traceId?: string;
107
+ result?: Record<string, unknown> | null;
108
+ error?: Record<string, unknown> | null;
109
+ [key: string]: unknown;
110
+ }
111
+ export interface CloudRunResults {
112
+ runId: string;
113
+ status: string;
114
+ results: CloudRunResultItem[];
115
+ }
116
+ export interface CloudBalance {
117
+ balanceCents: number;
118
+ currency: string;
119
+ billingEnabled: boolean;
120
+ minimumBalanceCents: number;
121
+ user?: CloudRunUser;
122
+ }
123
+ export interface CloudCreditCheckoutRequest {
124
+ amountCents: number;
125
+ user?: CloudRunUser;
126
+ successUrl?: string;
127
+ cancelUrl?: string;
128
+ }
129
+ export interface CloudCreditCheckout {
130
+ checkoutUrl: string | null;
131
+ checkoutSessionId: string | null;
132
+ paymentProvider: "stripe" | string;
133
+ paymentProviderEnabled: boolean;
134
+ }
135
+ export interface WebsiteApiInputContract {
136
+ key: string;
137
+ label?: string;
138
+ type?: string;
139
+ valueType?: string;
140
+ control?: string;
141
+ options?: unknown[];
142
+ requiredWhen?: Record<string, unknown>;
143
+ default?: unknown;
144
+ [key: string]: unknown;
145
+ }
146
+ export interface WebsiteApiOutputContract {
147
+ key: string;
148
+ type?: string;
149
+ [key: string]: unknown;
150
+ }
151
+ export interface WebsiteApiOperation {
152
+ name: string;
153
+ namespace: string;
154
+ operation: string;
155
+ site?: string;
156
+ version?: string;
157
+ status?: string;
158
+ publishedAt?: string | null;
159
+ inputs: WebsiteApiInputContract[];
160
+ outputs?: WebsiteApiOutputContract[];
161
+ inputSchema?: Record<string, unknown>;
162
+ outputSchema?: Record<string, unknown>;
163
+ [key: string]: unknown;
13
164
  }
14
165
  export interface TapiRun {
15
166
  id: string;
@@ -18,6 +169,7 @@ export interface TapiRun {
18
169
  requestKey?: string;
19
170
  result?: Record<string, unknown> | null;
20
171
  error?: Record<string, unknown> | null;
172
+ runtime?: RuntimeRunOptions | Record<string, unknown> | null;
21
173
  createdAt?: string;
22
174
  updatedAt?: string;
23
175
  [key: string]: unknown;
@@ -38,10 +190,93 @@ export interface RuntimeRequirements {
38
190
  windowsServiceName?: string;
39
191
  [key: string]: unknown;
40
192
  }
193
+ export type RuntimeProfileKind = "perm" | "temp" | "runtime_clone";
194
+ export type OriginPolicyType = "home" | "direct" | "fixed_proxy";
195
+ export interface OriginPolicy {
196
+ type: OriginPolicyType;
197
+ proxy?: string;
198
+ [key: string]: unknown;
199
+ }
200
+ export interface RuntimeProfile {
201
+ profileRef: string;
202
+ kind: RuntimeProfileKind;
203
+ displayName: string;
204
+ userDataDir?: string;
205
+ originPolicy: OriginPolicy;
206
+ templateRef?: string;
207
+ parentProfileRef?: string;
208
+ destroyOnRelease?: boolean;
209
+ ttlSeconds?: number | null;
210
+ state?: string;
211
+ createdAt?: string;
212
+ updatedAt?: string;
213
+ metadata?: Record<string, unknown>;
214
+ [key: string]: unknown;
215
+ }
216
+ export interface RuntimeRunOptions {
217
+ profileRef?: string;
218
+ destroyOnRelease?: boolean;
219
+ [key: string]: unknown;
220
+ }
221
+ export interface CreatePermProfileRequest {
222
+ displayName: string;
223
+ originPolicy?: OriginPolicy | OriginPolicyType | string;
224
+ profileRef?: string;
225
+ }
226
+ export interface ProvisionTempProfilesRequest {
227
+ count?: number;
228
+ proxies?: string[];
229
+ templateRef?: string;
230
+ displayNamePrefix?: string;
231
+ destroyOnRelease?: boolean;
232
+ ttlSeconds?: number;
233
+ }
234
+ export interface PromoteTempProfileRequest {
235
+ profileRef: string;
236
+ displayName?: string;
237
+ originPolicy?: OriginPolicy | OriginPolicyType | string;
238
+ }
239
+ export interface CreateRuntimeCloneRequest {
240
+ profileRef: string;
241
+ site?: string;
242
+ }
243
+ export interface LaunchPermProfileSetupRequest {
244
+ profileRef: string;
245
+ windowBounds?: Record<string, number>;
246
+ }
247
+ export interface RuntimeProfileListResponse {
248
+ success: boolean;
249
+ profiles: RuntimeProfile[];
250
+ }
251
+ export interface RuntimeProfileResponse {
252
+ success: boolean;
253
+ profile: RuntimeProfile;
254
+ }
255
+ export interface RuntimeProfilesDestroyedResponse {
256
+ success: boolean;
257
+ destroyed: boolean;
258
+ profileRef: string;
259
+ }
260
+ export interface LocalWebSocketMessageEvent {
261
+ data: unknown;
262
+ }
263
+ export interface LocalWebSocketLike {
264
+ onopen: (() => void) | null;
265
+ onmessage: ((event: LocalWebSocketMessageEvent) => void) | null;
266
+ onerror: ((event: unknown) => void) | null;
267
+ onclose: ((event: unknown) => void) | null;
268
+ send(data: string): void;
269
+ close(): void;
270
+ }
271
+ export type LocalWebSocketConstructor = new (url: string) => LocalWebSocketLike;
41
272
  export interface SdkCatalogRequest {
42
273
  key: string;
43
274
  status: string;
44
- inputs?: unknown[];
275
+ operation?: string;
276
+ sdkName?: string;
277
+ inputs?: WebsiteApiInputContract[];
278
+ inputSchema?: Record<string, unknown>;
279
+ outputSchema?: Record<string, unknown>;
45
280
  responseSchema?: Record<string, unknown>;
46
281
  [key: string]: unknown;
47
282
  }
@@ -1,7 +1,15 @@
1
- import type { HttpClient } from "./client";
2
- import type { TapiRun, WebsiteApiRunRequest } from "./types";
1
+ import type { HttpClient } from "./client.js";
2
+ import type { CloudBatchRun, CloudRunQuote, TapiRun, WebsiteApiCloudBatchRequest, WebsiteApiCloudQuoteRequest, WebsiteApiOperation, WebsiteApiRunRequest } from "./types.js";
3
3
  export declare class WebsiteApisResource {
4
4
  private readonly http;
5
5
  constructor(http: HttpClient);
6
6
  run(apiRequest: string, request?: WebsiteApiRunRequest): Promise<TapiRun>;
7
+ quoteCloud(apiRequest: string, request?: WebsiteApiCloudQuoteRequest): Promise<CloudRunQuote>;
8
+ runCloud(apiRequest: string, request?: WebsiteApiRunRequest & {
9
+ cloud?: WebsiteApiCloudBatchRequest["cloud"];
10
+ user?: WebsiteApiCloudBatchRequest["user"];
11
+ payment?: WebsiteApiCloudBatchRequest["payment"];
12
+ }): Promise<CloudBatchRun>;
13
+ runCloudBatch(apiRequest: string, request: WebsiteApiCloudBatchRequest): Promise<CloudBatchRun>;
14
+ describe(apiRequest: string): Promise<WebsiteApiOperation>;
7
15
  }