cyberdesk 0.2.1 → 1.0.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,3 @@
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>;
29
- };
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 {};
1
+ export * from './client/types.gen';
2
+ export * from './client/sdk.gen';
3
+ export * from './client/client.gen';
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,13 @@ 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
+ };
36
16
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.createCyberdeskClient = createCyberdeskClient;
38
- 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
57
- 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) })),
63
- };
64
- }
17
+ // Export all generated types
18
+ __exportStar(require("./client/types.gen"), exports);
19
+ // Export all generated SDK methods
20
+ __exportStar(require("./client/sdk.gen"), exports);
21
+ // Export the client for manual configuration if needed
22
+ __exportStar(require("./client/client.gen"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberdesk",
3
- "version": "0.2.1",
3
+ "version": "1.0.0",
4
4
  "description": "The official TypeScript SDK for Cyberdesk",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",