cyberdesk 0.2.1 → 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/dist/index.d.ts CHANGED
@@ -1,37 +1,155 @@
1
- import { type Options as ClientOptions } from '@hey-api/client-fetch';
2
- import * as apiMethods from './client/sdk.gen';
3
- import { GetV1DesktopByIdData, PostV1DesktopData, PostV1DesktopByIdStopData, PostV1DesktopByIdComputerActionData, PostV1DesktopByIdBashActionData } from './client/types.gen';
4
- type FetchFn = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
5
- /**
6
- * Configuration options for the Cyberdesk SDK client.
7
- */
8
- export interface CyberdeskClientOptions {
9
- /** Your Cyberdesk API Key */
10
- apiKey: string;
11
- /** Optional: Override the base URL for the API. Defaults to Cyberdesk production API. */
12
- baseUrl?: string;
13
- /** Optional: Provide a custom fetch implementation. */
14
- fetch?: FetchFn;
15
- /** Optional: Provide additional default options for the underlying client (e.g., timeout, keepalive). */
16
- clientOptions?: Partial<ClientOptions>;
17
- }
18
- export type GetDesktopParams = Omit<GetV1DesktopByIdData, 'headers' | 'url'>;
19
- export type LaunchDesktopParams = Omit<PostV1DesktopData, 'headers' | 'url'>;
20
- export type TerminateDesktopParams = Omit<PostV1DesktopByIdStopData, 'headers' | 'url'>;
21
- export type ExecuteComputerActionParams = Omit<PostV1DesktopByIdComputerActionData, 'headers' | 'url'>;
22
- export type ExecuteBashActionParams = Omit<PostV1DesktopByIdBashActionData, 'headers' | 'url'>;
23
- export type CyberdeskSDK = {
24
- getDesktop: (opts: GetDesktopParams) => ReturnType<typeof apiMethods.getV1DesktopById>;
25
- launchDesktop: (opts: LaunchDesktopParams) => ReturnType<typeof apiMethods.postV1Desktop>;
26
- terminateDesktop: (opts: TerminateDesktopParams) => ReturnType<typeof apiMethods.postV1DesktopByIdStop>;
27
- executeComputerAction: (opts: ExecuteComputerActionParams) => ReturnType<typeof apiMethods.postV1DesktopByIdComputerAction>;
28
- executeBashAction: (opts: ExecuteBashActionParams) => ReturnType<typeof apiMethods.postV1DesktopByIdBashAction>;
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';
2
+ export * from './client/types.gen';
3
+ export * from './client/sdk.gen';
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
+ };
29
154
  };
30
- /**
31
- * Creates a Cyberdesk SDK instance configured with your API key.
32
- *
33
- * @param options - Configuration options including the API key.
34
- * @returns An SDK instance with methods ready to be called.
35
- */
36
- export declare function createCyberdeskClient(options: CyberdeskClientOptions): CyberdeskSDK;
37
- export {};
155
+ export type { MachineResponse, WorkflowResponse, RunResponse, ConnectionResponse, TrajectoryResponse, PaginatedResponseMachineResponse, PaginatedResponseWorkflowResponse, PaginatedResponseRunResponse, PaginatedResponseConnectionResponse, PaginatedResponseTrajectoryResponse, };
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /// <reference lib="dom" />
3
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
3
  if (k2 === undefined) k2 = k;
5
4
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -11,54 +10,199 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
11
10
  if (k2 === undefined) k2 = k;
12
11
  o[k2] = m[k];
13
12
  }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
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
+ };
36
25
  Object.defineProperty(exports, "__esModule", { value: true });
37
26
  exports.createCyberdeskClient = createCyberdeskClient;
38
27
  const client_fetch_1 = require("@hey-api/client-fetch");
39
- const apiMethods = __importStar(require("./client/sdk.gen"));
40
- const DEFAULT_BASE_URL = 'https://api.cyberdesk.io';
41
- /**
42
- * Creates a Cyberdesk SDK instance configured with your API key.
43
- *
44
- * @param options - Configuration options including the API key.
45
- * @returns An SDK instance with methods ready to be called.
46
- */
47
- function createCyberdeskClient(options) {
48
- const { apiKey, baseUrl = DEFAULT_BASE_URL, fetch: customFetch, clientOptions = {} } = options;
49
- if (!apiKey) {
50
- throw new Error('Cyberdesk SDK requires an `apiKey` to be provided.');
51
- }
52
- const finalBaseUrl = baseUrl;
53
- const mergedHeaders = Object.assign({ 'x-api-key': apiKey, 'Content-Type': 'application/json' }, (clientOptions.headers || {}));
54
- const finalClientOptions = Object.assign({ baseUrl: finalBaseUrl, headers: mergedHeaders }, (customFetch && { fetch: customFetch }));
55
- const configuredClient = (0, client_fetch_1.createClient)(finalClientOptions);
56
- // Return an object where each method is pre-configured with the client instance
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
31
+ __exportStar(require("./client/types.gen"), exports);
32
+ __exportStar(require("./client/sdk.gen"), exports);
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);
57
49
  return {
58
- getDesktop: (opts) => apiMethods.getV1DesktopById(Object.assign(Object.assign({}, opts), { client: configuredClient, headers: Object.assign(Object.assign({}, mergedHeaders), opts.headers) })),
59
- launchDesktop: (opts) => apiMethods.postV1Desktop(Object.assign(Object.assign({}, opts), { client: configuredClient, headers: Object.assign(Object.assign({}, mergedHeaders), opts.headers) })),
60
- terminateDesktop: (opts) => apiMethods.postV1DesktopByIdStop(Object.assign(Object.assign({}, opts), { path: Object.assign(Object.assign({}, opts.path), { id: opts.path.id }), client: configuredClient, headers: Object.assign(Object.assign({}, mergedHeaders), opts.headers) })),
61
- executeComputerAction: (opts) => apiMethods.postV1DesktopByIdComputerAction(Object.assign(Object.assign({}, opts), { client: configuredClient, headers: Object.assign(Object.assign({}, mergedHeaders), opts.headers) })),
62
- executeBashAction: (opts) => apiMethods.postV1DesktopByIdBashAction(Object.assign(Object.assign({}, opts), { client: configuredClient, headers: Object.assign(Object.assign({}, mergedHeaders), opts.headers) })),
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
+ },
63
207
  };
64
208
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberdesk",
3
- "version": "0.2.1",
3
+ "version": "1.1.0",
4
4
  "description": "The official TypeScript SDK for Cyberdesk",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",