cyberdesk 1.0.0 → 1.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/README.md +64 -73
- package/dist/client/sdk.gen.d.ts +5 -5
- package/dist/client/types.gen.d.ts +35 -5
- package/dist/index.d.ts +152 -0
- package/dist/index.js +189 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,105 +1,96 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Cyberdesk TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
The official TypeScript SDK for Cyberdesk.
|
|
3
|
+
The official TypeScript SDK for Cyberdesk, providing type-safe access to all Cyberdesk APIs.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
8
|
npm install cyberdesk
|
|
11
|
-
# or
|
|
12
|
-
yarn add cyberdesk
|
|
13
|
-
# or
|
|
14
|
-
pnpm add cyberdesk
|
|
15
9
|
```
|
|
16
10
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
First, create a Cyberdesk client instance with your API key:
|
|
11
|
+
## Quick Start
|
|
20
12
|
|
|
21
13
|
```typescript
|
|
22
14
|
import { createCyberdeskClient } from 'cyberdesk';
|
|
23
15
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// Optionally, you can override the baseUrl or provide a custom fetch implementation
|
|
27
|
-
});
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Launch a Desktop
|
|
16
|
+
// Initialize client with your API key
|
|
17
|
+
const client = createCyberdeskClient('your-api-key');
|
|
31
18
|
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
19
|
+
// List machines with full type safety
|
|
20
|
+
const { data } = await client.machines.list({
|
|
21
|
+
status: 'connected', // ✅ Typed enum
|
|
22
|
+
limit: 10
|
|
35
23
|
});
|
|
36
24
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const desktopId = launchResult.id;
|
|
42
|
-
console.log('Launched desktop with ID:', desktopId);
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Get Desktop Info
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
const info = await cyberdesk.getDesktop({
|
|
49
|
-
path: { id: desktopId }
|
|
25
|
+
// Create a workflow
|
|
26
|
+
const workflow = await client.workflows.create({
|
|
27
|
+
main_prompt: "Automate my tasks",
|
|
28
|
+
cleanup_prompt: "Clean up afterwards"
|
|
50
29
|
});
|
|
51
30
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
console.log('Desktop info:', info);
|
|
31
|
+
// All responses are fully typed!
|
|
32
|
+
console.log(data?.items); // MachineResponse[]
|
|
57
33
|
```
|
|
58
34
|
|
|
59
|
-
|
|
35
|
+
## Custom Base URL
|
|
60
36
|
|
|
61
37
|
```typescript
|
|
62
|
-
const
|
|
63
|
-
path: { id: desktopId },
|
|
64
|
-
body: {
|
|
65
|
-
type: 'click_mouse',
|
|
66
|
-
x: 100,
|
|
67
|
-
y: 150
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
if (actionResult.error) {
|
|
72
|
-
throw new Error('Action failed: ' + actionResult.error);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
console.log('Action result:', actionResult);
|
|
38
|
+
const client = createCyberdeskClient('your-api-key', 'https://your-api.example.com');
|
|
76
39
|
```
|
|
77
40
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
41
|
+
## Available Methods
|
|
42
|
+
|
|
43
|
+
### Machines
|
|
44
|
+
- `client.machines.list(params?)` - List machines
|
|
45
|
+
- `client.machines.create(data)` - Create machine
|
|
46
|
+
- `client.machines.get(machineId)` - Get machine
|
|
47
|
+
- `client.machines.update(machineId, data)` - Update machine
|
|
48
|
+
- `client.machines.delete(machineId)` - Delete machine
|
|
49
|
+
|
|
50
|
+
### Workflows
|
|
51
|
+
- `client.workflows.list(params?)` - List workflows
|
|
52
|
+
- `client.workflows.create(data)` - Create workflow
|
|
53
|
+
- `client.workflows.get(workflowId)` - Get workflow
|
|
54
|
+
- `client.workflows.update(workflowId, data)` - Update workflow
|
|
55
|
+
- `client.workflows.delete(workflowId)` - Delete workflow
|
|
56
|
+
|
|
57
|
+
### Runs
|
|
58
|
+
- `client.runs.list(params?)` - List runs
|
|
59
|
+
- `client.runs.create(data)` - Create run
|
|
60
|
+
- `client.runs.get(runId)` - Get run
|
|
61
|
+
- `client.runs.update(runId, data)` - Update run
|
|
62
|
+
- `client.runs.delete(runId)` - Delete run
|
|
63
|
+
|
|
64
|
+
### Trajectories
|
|
65
|
+
- `client.trajectories.list(params?)` - List trajectories
|
|
66
|
+
- `client.trajectories.create(data)` - Create trajectory
|
|
67
|
+
- `client.trajectories.get(trajectoryId)` - Get trajectory
|
|
68
|
+
- `client.trajectories.update(trajectoryId, data)` - Update trajectory
|
|
69
|
+
- `client.trajectories.delete(trajectoryId)` - Delete trajectory
|
|
70
|
+
- `client.trajectories.getLatestForWorkflow(workflowId)` - Get latest trajectory for workflow
|
|
71
|
+
|
|
72
|
+
### Connections
|
|
73
|
+
- `client.connections.list(params?)` - List connections
|
|
74
|
+
- `client.connections.create(data)` - Create connection
|
|
94
75
|
|
|
95
76
|
## TypeScript Support
|
|
96
77
|
|
|
97
|
-
|
|
78
|
+
This SDK is built with TypeScript and provides full type safety:
|
|
98
79
|
|
|
99
80
|
```typescript
|
|
100
|
-
import
|
|
81
|
+
import {
|
|
82
|
+
createCyberdeskClient,
|
|
83
|
+
type MachineResponse,
|
|
84
|
+
type WorkflowResponse
|
|
85
|
+
} from 'cyberdesk';
|
|
86
|
+
|
|
87
|
+
const client = createCyberdeskClient('your-api-key');
|
|
88
|
+
|
|
89
|
+
// All parameters and responses are fully typed
|
|
90
|
+
const machines: { data?: PaginatedResponseMachineResponse } =
|
|
91
|
+
await client.machines.list();
|
|
101
92
|
```
|
|
102
93
|
|
|
103
94
|
## License
|
|
104
95
|
|
|
105
|
-
|
|
96
|
+
MIT
|
package/dist/client/sdk.gen.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare const databaseHealthCheckV1HealthDbGet: <ThrowOnError extends boo
|
|
|
37
37
|
*
|
|
38
38
|
* Supports pagination and filtering by status.
|
|
39
39
|
*/
|
|
40
|
-
export declare const listMachinesV1MachinesGet: <ThrowOnError extends boolean = false>(options?: Options<ListMachinesV1MachinesGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").
|
|
40
|
+
export declare const listMachinesV1MachinesGet: <ThrowOnError extends boolean = false>(options?: Options<ListMachinesV1MachinesGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponseMachineResponse, import("./types.gen").HttpValidationError, ThrowOnError>;
|
|
41
41
|
/**
|
|
42
42
|
* Create Machine
|
|
43
43
|
* Create a new machine.
|
|
@@ -74,7 +74,7 @@ export declare const updateMachineV1MachinesMachineIdPatch: <ThrowOnError extend
|
|
|
74
74
|
*
|
|
75
75
|
* Supports pagination and returns workflows ordered by updated_at descending.
|
|
76
76
|
*/
|
|
77
|
-
export declare const listWorkflowsV1WorkflowsGet: <ThrowOnError extends boolean = false>(options?: Options<ListWorkflowsV1WorkflowsGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").
|
|
77
|
+
export declare const listWorkflowsV1WorkflowsGet: <ThrowOnError extends boolean = false>(options?: Options<ListWorkflowsV1WorkflowsGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponseWorkflowResponse, import("./types.gen").HttpValidationError, ThrowOnError>;
|
|
78
78
|
/**
|
|
79
79
|
* Create Workflow
|
|
80
80
|
* Create a new workflow.
|
|
@@ -123,7 +123,7 @@ export declare const getWorkflowVersionsV1WorkflowsWorkflowIdVersionsGet: <Throw
|
|
|
123
123
|
* Supports pagination and filtering by workflow, machine, and status.
|
|
124
124
|
* Returns runs with their associated workflow and machine data.
|
|
125
125
|
*/
|
|
126
|
-
export declare const listRunsV1RunsGet: <ThrowOnError extends boolean = false>(options?: Options<ListRunsV1RunsGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").
|
|
126
|
+
export declare const listRunsV1RunsGet: <ThrowOnError extends boolean = false>(options?: Options<ListRunsV1RunsGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponseRunResponse, import("./types.gen").HttpValidationError, ThrowOnError>;
|
|
127
127
|
/**
|
|
128
128
|
* Create Run
|
|
129
129
|
* Create a new run.
|
|
@@ -164,7 +164,7 @@ export declare const updateRunV1RunsRunIdPatch: <ThrowOnError extends boolean =
|
|
|
164
164
|
* Supports pagination and filtering by machine and status.
|
|
165
165
|
* Returns connections with their associated machine data.
|
|
166
166
|
*/
|
|
167
|
-
export declare const listConnectionsV1ConnectionsGet: <ThrowOnError extends boolean = false>(options?: Options<ListConnectionsV1ConnectionsGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").
|
|
167
|
+
export declare const listConnectionsV1ConnectionsGet: <ThrowOnError extends boolean = false>(options?: Options<ListConnectionsV1ConnectionsGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponseConnectionResponse, import("./types.gen").HttpValidationError, ThrowOnError>;
|
|
168
168
|
/**
|
|
169
169
|
* Create Connection
|
|
170
170
|
* Create a new connection (typically done by the WebSocket handler).
|
|
@@ -239,7 +239,7 @@ export declare const updateRequestLogV1RequestLogsLogIdPatch: <ThrowOnError exte
|
|
|
239
239
|
* Supports pagination and filtering by workflow.
|
|
240
240
|
* Returns trajectories with their associated workflow data.
|
|
241
241
|
*/
|
|
242
|
-
export declare const listTrajectoriesV1TrajectoriesGet: <ThrowOnError extends boolean = false>(options?: Options<ListTrajectoriesV1TrajectoriesGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").
|
|
242
|
+
export declare const listTrajectoriesV1TrajectoriesGet: <ThrowOnError extends boolean = false>(options?: Options<ListTrajectoriesV1TrajectoriesGetData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").PaginatedResponseTrajectoryResponse, import("./types.gen").HttpValidationError, ThrowOnError>;
|
|
243
243
|
/**
|
|
244
244
|
* Create Trajectory
|
|
245
245
|
* Create a new trajectory for a workflow.
|
|
@@ -104,6 +104,36 @@ export type PaginatedResponse = {
|
|
|
104
104
|
skip: number;
|
|
105
105
|
limit: number;
|
|
106
106
|
};
|
|
107
|
+
export type PaginatedResponseConnectionResponse = {
|
|
108
|
+
items: Array<ConnectionResponse>;
|
|
109
|
+
total: number;
|
|
110
|
+
skip: number;
|
|
111
|
+
limit: number;
|
|
112
|
+
};
|
|
113
|
+
export type PaginatedResponseMachineResponse = {
|
|
114
|
+
items: Array<MachineResponse>;
|
|
115
|
+
total: number;
|
|
116
|
+
skip: number;
|
|
117
|
+
limit: number;
|
|
118
|
+
};
|
|
119
|
+
export type PaginatedResponseRunResponse = {
|
|
120
|
+
items: Array<RunResponse>;
|
|
121
|
+
total: number;
|
|
122
|
+
skip: number;
|
|
123
|
+
limit: number;
|
|
124
|
+
};
|
|
125
|
+
export type PaginatedResponseTrajectoryResponse = {
|
|
126
|
+
items: Array<TrajectoryResponse>;
|
|
127
|
+
total: number;
|
|
128
|
+
skip: number;
|
|
129
|
+
limit: number;
|
|
130
|
+
};
|
|
131
|
+
export type PaginatedResponseWorkflowResponse = {
|
|
132
|
+
items: Array<WorkflowResponse>;
|
|
133
|
+
total: number;
|
|
134
|
+
skip: number;
|
|
135
|
+
limit: number;
|
|
136
|
+
};
|
|
107
137
|
/**
|
|
108
138
|
* Schema for creating a request log
|
|
109
139
|
*/
|
|
@@ -306,7 +336,7 @@ export type ListMachinesV1MachinesGetResponses = {
|
|
|
306
336
|
/**
|
|
307
337
|
* Successful Response
|
|
308
338
|
*/
|
|
309
|
-
200:
|
|
339
|
+
200: PaginatedResponseMachineResponse;
|
|
310
340
|
};
|
|
311
341
|
export type ListMachinesV1MachinesGetResponse = ListMachinesV1MachinesGetResponses[keyof ListMachinesV1MachinesGetResponses];
|
|
312
342
|
export type CreateMachineV1MachinesPostData = {
|
|
@@ -415,7 +445,7 @@ export type ListWorkflowsV1WorkflowsGetResponses = {
|
|
|
415
445
|
/**
|
|
416
446
|
* Successful Response
|
|
417
447
|
*/
|
|
418
|
-
200:
|
|
448
|
+
200: PaginatedResponseWorkflowResponse;
|
|
419
449
|
};
|
|
420
450
|
export type ListWorkflowsV1WorkflowsGetResponse = ListWorkflowsV1WorkflowsGetResponses[keyof ListWorkflowsV1WorkflowsGetResponses];
|
|
421
451
|
export type CreateWorkflowV1WorkflowsPostData = {
|
|
@@ -560,7 +590,7 @@ export type ListRunsV1RunsGetResponses = {
|
|
|
560
590
|
/**
|
|
561
591
|
* Successful Response
|
|
562
592
|
*/
|
|
563
|
-
200:
|
|
593
|
+
200: PaginatedResponseRunResponse;
|
|
564
594
|
};
|
|
565
595
|
export type ListRunsV1RunsGetResponse = ListRunsV1RunsGetResponses[keyof ListRunsV1RunsGetResponses];
|
|
566
596
|
export type CreateRunV1RunsPostData = {
|
|
@@ -677,7 +707,7 @@ export type ListConnectionsV1ConnectionsGetResponses = {
|
|
|
677
707
|
/**
|
|
678
708
|
* Successful Response
|
|
679
709
|
*/
|
|
680
|
-
200:
|
|
710
|
+
200: PaginatedResponseConnectionResponse;
|
|
681
711
|
};
|
|
682
712
|
export type ListConnectionsV1ConnectionsGetResponse = ListConnectionsV1ConnectionsGetResponses[keyof ListConnectionsV1ConnectionsGetResponses];
|
|
683
713
|
export type CreateConnectionV1ConnectionsPostData = {
|
|
@@ -911,7 +941,7 @@ export type ListTrajectoriesV1TrajectoriesGetResponses = {
|
|
|
911
941
|
/**
|
|
912
942
|
* Successful Response
|
|
913
943
|
*/
|
|
914
|
-
200:
|
|
944
|
+
200: PaginatedResponseTrajectoryResponse;
|
|
915
945
|
};
|
|
916
946
|
export type ListTrajectoriesV1TrajectoriesGetResponse = ListTrajectoriesV1TrajectoriesGetResponses[keyof ListTrajectoriesV1TrajectoriesGetResponses];
|
|
917
947
|
export type CreateTrajectoryV1TrajectoriesPostData = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,155 @@
|
|
|
1
|
+
import { type MachineResponse, type WorkflowResponse, type RunResponse, type ConnectionResponse, type TrajectoryResponse, type PaginatedResponseMachineResponse, type PaginatedResponseWorkflowResponse, type PaginatedResponseRunResponse, type PaginatedResponseConnectionResponse, type PaginatedResponseTrajectoryResponse, type MachineStatus, type RunStatus, type ConnectionStatus, type MachineCreate, type WorkflowCreate, type RunCreate, type ConnectionCreate, type TrajectoryCreate, type MachineUpdate, type WorkflowUpdate, type RunUpdate, type TrajectoryUpdate } from './client/types.gen';
|
|
1
2
|
export * from './client/types.gen';
|
|
2
3
|
export * from './client/sdk.gen';
|
|
3
4
|
export * from './client/client.gen';
|
|
5
|
+
export declare function createCyberdeskClient(apiKey: string, baseUrl?: string): {
|
|
6
|
+
machines: {
|
|
7
|
+
list: (params?: {
|
|
8
|
+
skip?: number;
|
|
9
|
+
limit?: number;
|
|
10
|
+
status?: MachineStatus;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
data?: PaginatedResponseMachineResponse;
|
|
13
|
+
error?: any;
|
|
14
|
+
}>;
|
|
15
|
+
create: (data: MachineCreate) => Promise<{
|
|
16
|
+
data?: MachineResponse;
|
|
17
|
+
error?: any;
|
|
18
|
+
}>;
|
|
19
|
+
get: (machineId: string) => Promise<{
|
|
20
|
+
data?: MachineResponse;
|
|
21
|
+
error?: any;
|
|
22
|
+
}>;
|
|
23
|
+
update: (machineId: string, data: MachineUpdate) => Promise<{
|
|
24
|
+
data?: MachineResponse;
|
|
25
|
+
error?: any;
|
|
26
|
+
}>;
|
|
27
|
+
delete: (machineId: string) => Promise<({
|
|
28
|
+
data: undefined;
|
|
29
|
+
error: import("./client/types.gen").HttpValidationError;
|
|
30
|
+
} | {
|
|
31
|
+
data: void;
|
|
32
|
+
error: undefined;
|
|
33
|
+
}) & {
|
|
34
|
+
request: Request;
|
|
35
|
+
response: Response;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
workflows: {
|
|
39
|
+
list: (params?: {
|
|
40
|
+
skip?: number;
|
|
41
|
+
limit?: number;
|
|
42
|
+
}) => Promise<{
|
|
43
|
+
data?: PaginatedResponseWorkflowResponse;
|
|
44
|
+
error?: any;
|
|
45
|
+
}>;
|
|
46
|
+
create: (data: WorkflowCreate) => Promise<{
|
|
47
|
+
data?: WorkflowResponse;
|
|
48
|
+
error?: any;
|
|
49
|
+
}>;
|
|
50
|
+
get: (workflowId: string) => Promise<{
|
|
51
|
+
data?: WorkflowResponse;
|
|
52
|
+
error?: any;
|
|
53
|
+
}>;
|
|
54
|
+
update: (workflowId: string, data: WorkflowUpdate) => Promise<{
|
|
55
|
+
data?: WorkflowResponse;
|
|
56
|
+
error?: any;
|
|
57
|
+
}>;
|
|
58
|
+
delete: (workflowId: string) => Promise<({
|
|
59
|
+
data: undefined;
|
|
60
|
+
error: import("./client/types.gen").HttpValidationError;
|
|
61
|
+
} | {
|
|
62
|
+
data: void;
|
|
63
|
+
error: undefined;
|
|
64
|
+
}) & {
|
|
65
|
+
request: Request;
|
|
66
|
+
response: Response;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
runs: {
|
|
70
|
+
list: (params?: {
|
|
71
|
+
skip?: number;
|
|
72
|
+
limit?: number;
|
|
73
|
+
status?: RunStatus;
|
|
74
|
+
workflow_id?: string;
|
|
75
|
+
machine_id?: string;
|
|
76
|
+
}) => Promise<{
|
|
77
|
+
data?: PaginatedResponseRunResponse;
|
|
78
|
+
error?: any;
|
|
79
|
+
}>;
|
|
80
|
+
create: (data: RunCreate) => Promise<{
|
|
81
|
+
data?: RunResponse;
|
|
82
|
+
error?: any;
|
|
83
|
+
}>;
|
|
84
|
+
get: (runId: string) => Promise<{
|
|
85
|
+
data?: RunResponse;
|
|
86
|
+
error?: any;
|
|
87
|
+
}>;
|
|
88
|
+
update: (runId: string, data: RunUpdate) => Promise<{
|
|
89
|
+
data?: RunResponse;
|
|
90
|
+
error?: any;
|
|
91
|
+
}>;
|
|
92
|
+
delete: (runId: string) => Promise<({
|
|
93
|
+
data: undefined;
|
|
94
|
+
error: import("./client/types.gen").HttpValidationError;
|
|
95
|
+
} | {
|
|
96
|
+
data: void;
|
|
97
|
+
error: undefined;
|
|
98
|
+
}) & {
|
|
99
|
+
request: Request;
|
|
100
|
+
response: Response;
|
|
101
|
+
}>;
|
|
102
|
+
};
|
|
103
|
+
connections: {
|
|
104
|
+
list: (params?: {
|
|
105
|
+
skip?: number;
|
|
106
|
+
limit?: number;
|
|
107
|
+
machine_id?: string;
|
|
108
|
+
status?: ConnectionStatus;
|
|
109
|
+
}) => Promise<{
|
|
110
|
+
data?: PaginatedResponseConnectionResponse;
|
|
111
|
+
error?: any;
|
|
112
|
+
}>;
|
|
113
|
+
create: (data: ConnectionCreate) => Promise<{
|
|
114
|
+
data?: ConnectionResponse;
|
|
115
|
+
error?: any;
|
|
116
|
+
}>;
|
|
117
|
+
};
|
|
118
|
+
trajectories: {
|
|
119
|
+
list: (params?: {
|
|
120
|
+
skip?: number;
|
|
121
|
+
limit?: number;
|
|
122
|
+
workflow_id?: string;
|
|
123
|
+
}) => Promise<{
|
|
124
|
+
data?: PaginatedResponseTrajectoryResponse;
|
|
125
|
+
error?: any;
|
|
126
|
+
}>;
|
|
127
|
+
create: (data: TrajectoryCreate) => Promise<{
|
|
128
|
+
data?: TrajectoryResponse;
|
|
129
|
+
error?: any;
|
|
130
|
+
}>;
|
|
131
|
+
get: (trajectoryId: string) => Promise<{
|
|
132
|
+
data?: TrajectoryResponse;
|
|
133
|
+
error?: any;
|
|
134
|
+
}>;
|
|
135
|
+
update: (trajectoryId: string, data: TrajectoryUpdate) => Promise<{
|
|
136
|
+
data?: TrajectoryResponse;
|
|
137
|
+
error?: any;
|
|
138
|
+
}>;
|
|
139
|
+
delete: (trajectoryId: string) => Promise<({
|
|
140
|
+
data: undefined;
|
|
141
|
+
error: import("./client/types.gen").HttpValidationError;
|
|
142
|
+
} | {
|
|
143
|
+
data: void;
|
|
144
|
+
error: undefined;
|
|
145
|
+
}) & {
|
|
146
|
+
request: Request;
|
|
147
|
+
response: Response;
|
|
148
|
+
}>;
|
|
149
|
+
getLatestForWorkflow: (workflowId: string) => Promise<{
|
|
150
|
+
data?: TrajectoryResponse;
|
|
151
|
+
error?: any;
|
|
152
|
+
}>;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
export type { MachineResponse, WorkflowResponse, RunResponse, ConnectionResponse, TrajectoryResponse, PaginatedResponseMachineResponse, PaginatedResponseWorkflowResponse, PaginatedResponseRunResponse, PaginatedResponseConnectionResponse, PaginatedResponseTrajectoryResponse, };
|
package/dist/index.js
CHANGED
|
@@ -13,10 +13,196 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
16
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
26
|
+
exports.createCyberdeskClient = createCyberdeskClient;
|
|
27
|
+
const client_fetch_1 = require("@hey-api/client-fetch");
|
|
28
|
+
// Import SDK methods from sdk.gen
|
|
29
|
+
const sdk_gen_1 = require("./client/sdk.gen");
|
|
30
|
+
// Export all generated types and methods for direct use
|
|
18
31
|
__exportStar(require("./client/types.gen"), exports);
|
|
19
|
-
// Export all generated SDK methods
|
|
20
32
|
__exportStar(require("./client/sdk.gen"), exports);
|
|
21
|
-
// Export the client for manual configuration if needed
|
|
22
33
|
__exportStar(require("./client/client.gen"), exports);
|
|
34
|
+
// Configuration
|
|
35
|
+
const DEFAULT_API_BASE_URL = "https://api.cyberdesk.io";
|
|
36
|
+
// Create configured client with API key
|
|
37
|
+
function createApiClient(apiKey, baseUrl = DEFAULT_API_BASE_URL) {
|
|
38
|
+
return (0, client_fetch_1.createClient)({
|
|
39
|
+
baseUrl,
|
|
40
|
+
headers: {
|
|
41
|
+
'Content-Type': 'application/json',
|
|
42
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
// Create API client with your API key
|
|
47
|
+
function createCyberdeskClient(apiKey, baseUrl) {
|
|
48
|
+
const client = createApiClient(apiKey, baseUrl);
|
|
49
|
+
return {
|
|
50
|
+
// Machine endpoints
|
|
51
|
+
machines: {
|
|
52
|
+
list: (params) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
return (0, sdk_gen_1.listMachinesV1MachinesGet)({
|
|
54
|
+
client,
|
|
55
|
+
query: params,
|
|
56
|
+
});
|
|
57
|
+
}),
|
|
58
|
+
create: (data) => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return (0, sdk_gen_1.createMachineV1MachinesPost)({
|
|
60
|
+
client,
|
|
61
|
+
body: data,
|
|
62
|
+
});
|
|
63
|
+
}),
|
|
64
|
+
get: (machineId) => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
return (0, sdk_gen_1.getMachineV1MachinesMachineIdGet)({
|
|
66
|
+
client,
|
|
67
|
+
path: { machine_id: machineId },
|
|
68
|
+
});
|
|
69
|
+
}),
|
|
70
|
+
update: (machineId, data) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
return (0, sdk_gen_1.updateMachineV1MachinesMachineIdPatch)({
|
|
72
|
+
client,
|
|
73
|
+
path: { machine_id: machineId },
|
|
74
|
+
body: data,
|
|
75
|
+
});
|
|
76
|
+
}),
|
|
77
|
+
delete: (machineId) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
return (0, sdk_gen_1.deleteMachineV1MachinesMachineIdDelete)({
|
|
79
|
+
client,
|
|
80
|
+
path: { machine_id: machineId },
|
|
81
|
+
});
|
|
82
|
+
}),
|
|
83
|
+
},
|
|
84
|
+
// Workflow endpoints
|
|
85
|
+
workflows: {
|
|
86
|
+
list: (params) => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
return (0, sdk_gen_1.listWorkflowsV1WorkflowsGet)({
|
|
88
|
+
client,
|
|
89
|
+
query: params,
|
|
90
|
+
});
|
|
91
|
+
}),
|
|
92
|
+
create: (data) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
return (0, sdk_gen_1.createWorkflowV1WorkflowsPost)({
|
|
94
|
+
client,
|
|
95
|
+
body: data,
|
|
96
|
+
});
|
|
97
|
+
}),
|
|
98
|
+
get: (workflowId) => __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
return (0, sdk_gen_1.getWorkflowV1WorkflowsWorkflowIdGet)({
|
|
100
|
+
client,
|
|
101
|
+
path: { workflow_id: workflowId },
|
|
102
|
+
});
|
|
103
|
+
}),
|
|
104
|
+
update: (workflowId, data) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
return (0, sdk_gen_1.updateWorkflowV1WorkflowsWorkflowIdPatch)({
|
|
106
|
+
client,
|
|
107
|
+
path: { workflow_id: workflowId },
|
|
108
|
+
body: data,
|
|
109
|
+
});
|
|
110
|
+
}),
|
|
111
|
+
delete: (workflowId) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
return (0, sdk_gen_1.deleteWorkflowV1WorkflowsWorkflowIdDelete)({
|
|
113
|
+
client,
|
|
114
|
+
path: { workflow_id: workflowId },
|
|
115
|
+
});
|
|
116
|
+
}),
|
|
117
|
+
},
|
|
118
|
+
// Run endpoints
|
|
119
|
+
runs: {
|
|
120
|
+
list: (params) => __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
return (0, sdk_gen_1.listRunsV1RunsGet)({
|
|
122
|
+
client,
|
|
123
|
+
query: params,
|
|
124
|
+
});
|
|
125
|
+
}),
|
|
126
|
+
create: (data) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
return (0, sdk_gen_1.createRunV1RunsPost)({
|
|
128
|
+
client,
|
|
129
|
+
body: data,
|
|
130
|
+
});
|
|
131
|
+
}),
|
|
132
|
+
get: (runId) => __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
return (0, sdk_gen_1.getRunV1RunsRunIdGet)({
|
|
134
|
+
client,
|
|
135
|
+
path: { run_id: runId },
|
|
136
|
+
});
|
|
137
|
+
}),
|
|
138
|
+
update: (runId, data) => __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
return (0, sdk_gen_1.updateRunV1RunsRunIdPatch)({
|
|
140
|
+
client,
|
|
141
|
+
path: { run_id: runId },
|
|
142
|
+
body: data,
|
|
143
|
+
});
|
|
144
|
+
}),
|
|
145
|
+
delete: (runId) => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
return (0, sdk_gen_1.deleteRunV1RunsRunIdDelete)({
|
|
147
|
+
client,
|
|
148
|
+
path: { run_id: runId },
|
|
149
|
+
});
|
|
150
|
+
}),
|
|
151
|
+
},
|
|
152
|
+
// Connection endpoints
|
|
153
|
+
connections: {
|
|
154
|
+
list: (params) => __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
return (0, sdk_gen_1.listConnectionsV1ConnectionsGet)({
|
|
156
|
+
client,
|
|
157
|
+
query: params,
|
|
158
|
+
});
|
|
159
|
+
}),
|
|
160
|
+
create: (data) => __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
return (0, sdk_gen_1.createConnectionV1ConnectionsPost)({
|
|
162
|
+
client,
|
|
163
|
+
body: data,
|
|
164
|
+
});
|
|
165
|
+
}),
|
|
166
|
+
},
|
|
167
|
+
// Trajectory endpoints
|
|
168
|
+
trajectories: {
|
|
169
|
+
list: (params) => __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
return (0, sdk_gen_1.listTrajectoriesV1TrajectoriesGet)({
|
|
171
|
+
client,
|
|
172
|
+
query: params,
|
|
173
|
+
});
|
|
174
|
+
}),
|
|
175
|
+
create: (data) => __awaiter(this, void 0, void 0, function* () {
|
|
176
|
+
return (0, sdk_gen_1.createTrajectoryV1TrajectoriesPost)({
|
|
177
|
+
client,
|
|
178
|
+
body: data,
|
|
179
|
+
});
|
|
180
|
+
}),
|
|
181
|
+
get: (trajectoryId) => __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
return (0, sdk_gen_1.getTrajectoryV1TrajectoriesTrajectoryIdGet)({
|
|
183
|
+
client,
|
|
184
|
+
path: { trajectory_id: trajectoryId },
|
|
185
|
+
});
|
|
186
|
+
}),
|
|
187
|
+
update: (trajectoryId, data) => __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
return (0, sdk_gen_1.updateTrajectoryV1TrajectoriesTrajectoryIdPatch)({
|
|
189
|
+
client,
|
|
190
|
+
path: { trajectory_id: trajectoryId },
|
|
191
|
+
body: data,
|
|
192
|
+
});
|
|
193
|
+
}),
|
|
194
|
+
delete: (trajectoryId) => __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
return (0, sdk_gen_1.deleteTrajectoryV1TrajectoriesTrajectoryIdDelete)({
|
|
196
|
+
client,
|
|
197
|
+
path: { trajectory_id: trajectoryId },
|
|
198
|
+
});
|
|
199
|
+
}),
|
|
200
|
+
getLatestForWorkflow: (workflowId) => __awaiter(this, void 0, void 0, function* () {
|
|
201
|
+
return (0, sdk_gen_1.getLatestTrajectoryForWorkflowV1WorkflowsWorkflowIdLatestTrajectoryGet)({
|
|
202
|
+
client,
|
|
203
|
+
path: { workflow_id: workflowId },
|
|
204
|
+
});
|
|
205
|
+
}),
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}
|