@reduck-ai/sdk 1.1.21 → 2.0.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 +102 -204
- package/dist/client.d.ts +11 -20
- package/dist/client.js +19 -107
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/client.gen.js +216 -0
- package/dist/generated/client/index.d.ts +10 -0
- package/dist/generated/client/index.js +6 -0
- package/dist/generated/client/types.gen.d.ts +120 -0
- package/dist/generated/client/types.gen.js +2 -0
- package/dist/generated/client/utils.gen.d.ts +37 -0
- package/dist/generated/client/utils.gen.js +228 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/client.gen.js +3 -0
- package/dist/generated/core/auth.gen.d.ts +25 -0
- package/dist/generated/core/auth.gen.js +14 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/bodySerializer.gen.js +57 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/params.gen.js +109 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/pathSerializer.gen.js +106 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/queryKeySerializer.gen.js +92 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/serverSentEvents.gen.js +132 -0
- package/dist/generated/core/types.gen.d.ts +83 -0
- package/dist/generated/core/types.gen.js +2 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/core/utils.gen.js +87 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/index.js +3 -0
- package/dist/generated/sdk.gen.d.ts +471 -0
- package/dist/generated/sdk.gen.js +862 -0
- package/dist/generated/types.gen.d.ts +5489 -0
- package/dist/generated/types.gen.js +56 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.js +4 -4
- package/openapi.json +16668 -0
- package/package.json +23 -25
- package/dist/build-env.generated.d.ts +0 -3
- package/dist/build-env.generated.js +0 -4
- package/dist/device.d.ts +0 -3
- package/dist/device.js +0 -7
- package/dist/errors.d.ts +0 -9
- package/dist/errors.js +0 -21
- package/dist/method.d.ts +0 -3
- package/dist/method.js +0 -23
- package/dist/run.d.ts +0 -12
- package/dist/run.js +0 -73
- package/dist/schemas.d.ts +0 -597
- package/dist/schemas.js +0 -106
- package/dist/session.d.ts +0 -3
- package/dist/session.js +0 -14
- package/dist/site.d.ts +0 -3
- package/dist/site.js +0 -21
- package/dist/types.d.ts +0 -43
- package/dist/types.js +0 -8
package/dist/session.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ReduckError } from "./errors.js";
|
|
2
|
-
export async function fetchRuns(appBaseUrl, headers, page = 0) {
|
|
3
|
-
const params = new URLSearchParams({ page: String(page) });
|
|
4
|
-
const res = await fetch(`${appBaseUrl}/api/runs?${params}`, { headers });
|
|
5
|
-
if (!res.ok)
|
|
6
|
-
throw ReduckError.fromResponse("GET /api/runs", res.status);
|
|
7
|
-
return (await res.json());
|
|
8
|
-
}
|
|
9
|
-
export async function fetchRun(appBaseUrl, headers, runId) {
|
|
10
|
-
const res = await fetch(`${appBaseUrl}/api/runs/${encodeURIComponent(runId)}`, { headers });
|
|
11
|
-
if (!res.ok)
|
|
12
|
-
throw ReduckError.fromResponse(`GET /api/runs/${runId}`, res.status);
|
|
13
|
-
return (await res.json());
|
|
14
|
-
}
|
package/dist/site.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ListSitesOptions, Site, SitesPage } from "./types.js";
|
|
2
|
-
export declare function fetchSites(appBaseUrl: string, headers: Record<string, string>, options?: ListSitesOptions): Promise<SitesPage>;
|
|
3
|
-
export declare function fetchSite(appBaseUrl: string, headers: Record<string, string>, host: string): Promise<Site>;
|
package/dist/site.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ReduckError } from "./errors.js";
|
|
2
|
-
export async function fetchSites(appBaseUrl, headers, options = {}) {
|
|
3
|
-
const params = new URLSearchParams();
|
|
4
|
-
if (options.q)
|
|
5
|
-
params.set("q", options.q);
|
|
6
|
-
if (options.page !== undefined)
|
|
7
|
-
params.set("page", String(options.page));
|
|
8
|
-
if (options.pageSize !== undefined)
|
|
9
|
-
params.set("pageSize", String(options.pageSize));
|
|
10
|
-
const qs = params.toString();
|
|
11
|
-
const res = await fetch(`${appBaseUrl}/api/sites${qs ? `?${qs}` : ""}`, { headers });
|
|
12
|
-
if (!res.ok)
|
|
13
|
-
throw ReduckError.fromResponse("GET /api/sites", res.status);
|
|
14
|
-
return (await res.json());
|
|
15
|
-
}
|
|
16
|
-
export async function fetchSite(appBaseUrl, headers, host) {
|
|
17
|
-
const res = await fetch(`${appBaseUrl}/api/sites/${encodeURIComponent(host)}`, { headers });
|
|
18
|
-
if (!res.ok)
|
|
19
|
-
throw ReduckError.fromResponse(`GET /api/sites/${host}`, res.status);
|
|
20
|
-
return (await res.json());
|
|
21
|
-
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { z } from "zod";
|
|
2
|
-
import * as S from "./schemas.js";
|
|
3
|
-
export type Device = z.infer<typeof S.DeviceSchema>;
|
|
4
|
-
export type RunEvent = z.infer<typeof S.RunEventSchema>;
|
|
5
|
-
export type RunResult = z.infer<typeof S.RunResultSchema>;
|
|
6
|
-
export type RunRecord = z.infer<typeof S.RunRecordSchema>;
|
|
7
|
-
export type RunsPage = z.infer<typeof S.RunsPageSchema>;
|
|
8
|
-
export type Method = z.infer<typeof S.MethodSchema>;
|
|
9
|
-
export type MethodsPage = z.infer<typeof S.MethodsPageSchema>;
|
|
10
|
-
export type Site = z.infer<typeof S.SiteSchema>;
|
|
11
|
-
export type SitesPage = z.infer<typeof S.SitesPageSchema>;
|
|
12
|
-
export interface PaginationParameters {
|
|
13
|
-
page?: number;
|
|
14
|
-
pageSize?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface ListSitesOptions extends PaginationParameters {
|
|
17
|
-
q?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface ListMethodsOptions extends PaginationParameters {
|
|
20
|
-
q?: string;
|
|
21
|
-
host?: string;
|
|
22
|
-
}
|
|
23
|
-
export type RunRequestedEvent = Extract<RunEvent, {
|
|
24
|
-
type: "run_requested";
|
|
25
|
-
}>;
|
|
26
|
-
export type RunRequestedArgs = RunRequestedEvent["args"];
|
|
27
|
-
export interface RunOptions {
|
|
28
|
-
deviceId: string;
|
|
29
|
-
mount?: string[];
|
|
30
|
-
method?: string;
|
|
31
|
-
methodArgs?: Record<string, string>;
|
|
32
|
-
pasteSlots?: Record<string, string>;
|
|
33
|
-
outputSchema?: object;
|
|
34
|
-
slug?: string;
|
|
35
|
-
}
|
|
36
|
-
export interface ReduckClientOptions {
|
|
37
|
-
oauthToken?: string;
|
|
38
|
-
apiKey?: string;
|
|
39
|
-
runnerBaseUrl?: string;
|
|
40
|
-
appBaseUrl?: string;
|
|
41
|
-
headers?: Record<string, string>;
|
|
42
|
-
}
|
|
43
|
-
export declare function authHeader(opts: ReduckClientOptions): Record<string, string>;
|
package/dist/types.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ReduckError } from "./errors.js";
|
|
2
|
-
export function authHeader(opts) {
|
|
3
|
-
if (opts.oauthToken)
|
|
4
|
-
return { Authorization: `Bearer ${opts.oauthToken.trim()}` };
|
|
5
|
-
if (opts.apiKey)
|
|
6
|
-
return { "X-API-Key": opts.apiKey.trim() };
|
|
7
|
-
throw new ReduckError("Either oauthToken or apiKey is required", { code: "MISSING_CREDENTIALS" });
|
|
8
|
-
}
|