@reduck-ai/sdk 1.1.11 → 1.1.13
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/dist/client.d.ts +1 -3
- package/dist/client.js +2 -8
- package/dist/get.d.ts +1 -2
- package/dist/get.js +0 -8
- package/dist/search.d.ts +1 -2
- package/dist/search.js +0 -7
- package/dist/types.d.ts +2 -2
- package/dist/types.js +2 -2
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Device, type
|
|
1
|
+
import { type Device, type ReduckClientOptions, type RunOptions, type RunRecord, type RunsPage, type Site } from "./types.js";
|
|
2
2
|
import { Run } from "./run.js";
|
|
3
3
|
export declare class ReduckClient {
|
|
4
4
|
private readonly _runnerBaseUrl;
|
|
@@ -10,9 +10,7 @@ export declare class ReduckClient {
|
|
|
10
10
|
listDevices(): Promise<Device[]>;
|
|
11
11
|
listRuns(page?: number): Promise<RunsPage>;
|
|
12
12
|
getRun(runId: string): Promise<RunRecord>;
|
|
13
|
-
searchMethods(query: string): Promise<Method[]>;
|
|
14
13
|
searchSites(query: string): Promise<Site[]>;
|
|
15
|
-
getMethod(slug: string): Promise<Method>;
|
|
16
14
|
getSite(host: string): Promise<Site>;
|
|
17
15
|
interrupt(runId: string): Promise<void>;
|
|
18
16
|
private _createRun;
|
package/dist/client.js
CHANGED
|
@@ -7,8 +7,8 @@ import { authHeader } from "./types.js";
|
|
|
7
7
|
import { Run } from "./run.js";
|
|
8
8
|
import { fetchDevices } from "./device.js";
|
|
9
9
|
import { fetchRun, fetchRuns } from "./session.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { fetchSearchSites } from "./search.js";
|
|
11
|
+
import { fetchGetSite } from "./get.js";
|
|
12
12
|
import { RUNNER_URL, APP_URL } from "./build-env.generated.js";
|
|
13
13
|
export class ReduckClient {
|
|
14
14
|
_runnerBaseUrl;
|
|
@@ -60,15 +60,9 @@ export class ReduckClient {
|
|
|
60
60
|
async getRun(runId) {
|
|
61
61
|
return fetchRun(this._appBaseUrl, this._headers, runId);
|
|
62
62
|
}
|
|
63
|
-
async searchMethods(query) {
|
|
64
|
-
return fetchSearchMethods(this._runnerBaseUrl, this._headers, query);
|
|
65
|
-
}
|
|
66
63
|
async searchSites(query) {
|
|
67
64
|
return fetchSearchSites(this._runnerBaseUrl, this._headers, query);
|
|
68
65
|
}
|
|
69
|
-
async getMethod(slug) {
|
|
70
|
-
return fetchGetMethod(this._runnerBaseUrl, this._headers, slug);
|
|
71
|
-
}
|
|
72
66
|
async getSite(host) {
|
|
73
67
|
return fetchGetSite(this._runnerBaseUrl, this._headers, host);
|
|
74
68
|
}
|
package/dist/get.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function fetchGetMethod(appBaseUrl: string, headers: Record<string, string>, slug: string): Promise<Method>;
|
|
1
|
+
import type { Site } from "./types.js";
|
|
3
2
|
export declare function fetchGetSite(appBaseUrl: string, headers: Record<string, string>, host: string): Promise<Site>;
|
package/dist/get.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export async function fetchGetMethod(appBaseUrl, headers, slug) {
|
|
2
|
-
const res = await fetch(`${appBaseUrl}/methods/${encodeURIComponent(slug)}`, { headers });
|
|
3
|
-
if (res.status === 404)
|
|
4
|
-
throw new Error(`Method not found: ${slug}`);
|
|
5
|
-
if (!res.ok)
|
|
6
|
-
throw new Error(`Get method failed (HTTP ${res.status})`);
|
|
7
|
-
return res.json();
|
|
8
|
-
}
|
|
9
1
|
export async function fetchGetSite(appBaseUrl, headers, host) {
|
|
10
2
|
const res = await fetch(`${appBaseUrl}/sites/${encodeURIComponent(host)}`, { headers });
|
|
11
3
|
if (res.status === 404)
|
package/dist/search.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function fetchSearchMethods(appBaseUrl: string, headers: Record<string, string>, query: string): Promise<Method[]>;
|
|
1
|
+
import type { Site } from "./types.js";
|
|
3
2
|
export declare function fetchSearchSites(appBaseUrl: string, headers: Record<string, string>, query: string): Promise<Site[]>;
|
package/dist/search.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export async function fetchSearchMethods(appBaseUrl, headers, query) {
|
|
2
|
-
const url = `${appBaseUrl}/methods?q=${encodeURIComponent(query)}`;
|
|
3
|
-
const res = await fetch(url, { headers });
|
|
4
|
-
if (!res.ok)
|
|
5
|
-
throw new Error(`Search methods failed (HTTP ${res.status})`);
|
|
6
|
-
return res.json();
|
|
7
|
-
}
|
|
8
1
|
export async function fetchSearchSites(appBaseUrl, headers, query) {
|
|
9
2
|
const url = `${appBaseUrl}/sites?q=${encodeURIComponent(query)}`;
|
|
10
3
|
const res = await fetch(url, { headers });
|
package/dist/types.d.ts
CHANGED
|
@@ -89,12 +89,12 @@ export interface ReduckClientOptions {
|
|
|
89
89
|
export interface Method {
|
|
90
90
|
host: string;
|
|
91
91
|
method_slug: string;
|
|
92
|
-
display_name: string;
|
|
93
92
|
description: string;
|
|
93
|
+
args: Record<string, unknown>;
|
|
94
|
+
output_schema: Record<string, unknown> | null;
|
|
94
95
|
}
|
|
95
96
|
export interface Site {
|
|
96
97
|
host: string;
|
|
97
|
-
display_name: string;
|
|
98
98
|
methods: Method[];
|
|
99
99
|
}
|
|
100
100
|
export {};
|
package/dist/types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReduckError } from "./errors.js";
|
|
2
2
|
export function authHeader(opts) {
|
|
3
3
|
if (opts.oauthToken)
|
|
4
|
-
return { Authorization: `Bearer ${opts.oauthToken}` };
|
|
4
|
+
return { Authorization: `Bearer ${opts.oauthToken.trim()}` };
|
|
5
5
|
if (opts.apiKey)
|
|
6
|
-
return { "X-API-Key": opts.apiKey };
|
|
6
|
+
return { "X-API-Key": opts.apiKey.trim() };
|
|
7
7
|
throw new ReduckError("Either oauthToken or apiKey is required", { code: "MISSING_CREDENTIALS" });
|
|
8
8
|
}
|
package/package.json
CHANGED