@eigenpal/sdk 0.0.0-placeholder

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.
@@ -0,0 +1,140 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type { BodySerializer, QuerySerializer } from './bodySerializer.gen';
4
+ import {
5
+ type ArraySeparatorStyle,
6
+ serializeArrayParam,
7
+ serializeObjectParam,
8
+ serializePrimitiveParam,
9
+ } from './pathSerializer.gen';
10
+
11
+ export interface PathSerializer {
12
+ path: Record<string, unknown>;
13
+ url: string;
14
+ }
15
+
16
+ export const PATH_PARAM_RE = /\{[^{}]+\}/g;
17
+
18
+ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
19
+ let url = _url;
20
+ const matches = _url.match(PATH_PARAM_RE);
21
+ if (matches) {
22
+ for (const match of matches) {
23
+ let explode = false;
24
+ let name = match.substring(1, match.length - 1);
25
+ let style: ArraySeparatorStyle = 'simple';
26
+
27
+ if (name.endsWith('*')) {
28
+ explode = true;
29
+ name = name.substring(0, name.length - 1);
30
+ }
31
+
32
+ if (name.startsWith('.')) {
33
+ name = name.substring(1);
34
+ style = 'label';
35
+ } else if (name.startsWith(';')) {
36
+ name = name.substring(1);
37
+ style = 'matrix';
38
+ }
39
+
40
+ const value = path[name];
41
+
42
+ if (value === undefined || value === null) {
43
+ continue;
44
+ }
45
+
46
+ if (Array.isArray(value)) {
47
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
48
+ continue;
49
+ }
50
+
51
+ if (typeof value === 'object') {
52
+ url = url.replace(
53
+ match,
54
+ serializeObjectParam({
55
+ explode,
56
+ name,
57
+ style,
58
+ value: value as Record<string, unknown>,
59
+ valueOnly: true,
60
+ })
61
+ );
62
+ continue;
63
+ }
64
+
65
+ if (style === 'matrix') {
66
+ url = url.replace(
67
+ match,
68
+ `;${serializePrimitiveParam({
69
+ name,
70
+ value: value as string,
71
+ })}`
72
+ );
73
+ continue;
74
+ }
75
+
76
+ const replaceValue = encodeURIComponent(
77
+ style === 'label' ? `.${value as string}` : (value as string)
78
+ );
79
+ url = url.replace(match, replaceValue);
80
+ }
81
+ }
82
+ return url;
83
+ };
84
+
85
+ export const getUrl = ({
86
+ baseUrl,
87
+ path,
88
+ query,
89
+ querySerializer,
90
+ url: _url,
91
+ }: {
92
+ baseUrl?: string;
93
+ path?: Record<string, unknown>;
94
+ query?: Record<string, unknown>;
95
+ querySerializer: QuerySerializer;
96
+ url: string;
97
+ }) => {
98
+ const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
99
+ let url = (baseUrl ?? '') + pathUrl;
100
+ if (path) {
101
+ url = defaultPathSerializer({ path, url });
102
+ }
103
+ let search = query ? querySerializer(query) : '';
104
+ if (search.startsWith('?')) {
105
+ search = search.substring(1);
106
+ }
107
+ if (search) {
108
+ url += `?${search}`;
109
+ }
110
+ return url;
111
+ };
112
+
113
+ export function getValidRequestBody(options: {
114
+ body?: unknown;
115
+ bodySerializer?: BodySerializer | null;
116
+ serializedBody?: unknown;
117
+ }) {
118
+ const hasBody = options.body !== undefined;
119
+ const isSerializedBody = hasBody && options.bodySerializer;
120
+
121
+ if (isSerializedBody) {
122
+ if ('serializedBody' in options) {
123
+ const hasSerializedBody =
124
+ options.serializedBody !== undefined && options.serializedBody !== '';
125
+
126
+ return hasSerializedBody ? options.serializedBody : null;
127
+ }
128
+
129
+ // not all clients implement a serializedBody property (i.e., client-axios)
130
+ return options.body !== '' ? options.body : null;
131
+ }
132
+
133
+ // plain/text body
134
+ if (hasBody) {
135
+ return options.body;
136
+ }
137
+
138
+ // no body was provided
139
+ return undefined;
140
+ }
@@ -0,0 +1,63 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export {
4
+ executionsCancel,
5
+ executionsGet,
6
+ executionsList,
7
+ workflowsGet,
8
+ workflowsList,
9
+ workflowsRun,
10
+ workflowsVersionsList,
11
+ type Options,
12
+ } from './sdk.gen';
13
+ export type {
14
+ ApiErrorEnvelope,
15
+ ApiErrorIssue,
16
+ CancelExecutionResponse,
17
+ ClientOptions,
18
+ ExecutionStatus,
19
+ ExecutionStatusResponse,
20
+ ExecutionSummary,
21
+ ExecutionsCancelData,
22
+ ExecutionsCancelError,
23
+ ExecutionsCancelErrors,
24
+ ExecutionsCancelResponse,
25
+ ExecutionsCancelResponses,
26
+ ExecutionsGetData,
27
+ ExecutionsGetError,
28
+ ExecutionsGetErrors,
29
+ ExecutionsGetResponse,
30
+ ExecutionsGetResponses,
31
+ ExecutionsListData,
32
+ ExecutionsListError,
33
+ ExecutionsListErrors,
34
+ ExecutionsListResponse,
35
+ ExecutionsListResponses,
36
+ ListExecutionsResponse,
37
+ ListVersionsResponse,
38
+ ListWorkflowsResponse,
39
+ RunWorkflowBody,
40
+ RunWorkflowResponse,
41
+ WorkflowSummary,
42
+ WorkflowVersion,
43
+ WorkflowsGetData,
44
+ WorkflowsGetError,
45
+ WorkflowsGetErrors,
46
+ WorkflowsGetResponse,
47
+ WorkflowsGetResponses,
48
+ WorkflowsListData,
49
+ WorkflowsListError,
50
+ WorkflowsListErrors,
51
+ WorkflowsListResponse,
52
+ WorkflowsListResponses,
53
+ WorkflowsRunData,
54
+ WorkflowsRunError,
55
+ WorkflowsRunErrors,
56
+ WorkflowsRunResponse,
57
+ WorkflowsRunResponses,
58
+ WorkflowsVersionsListData,
59
+ WorkflowsVersionsListError,
60
+ WorkflowsVersionsListErrors,
61
+ WorkflowsVersionsListResponse,
62
+ WorkflowsVersionsListResponses,
63
+ } from './types.gen';
@@ -0,0 +1,151 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type { Client, Options as Options2, TDataShape } from './client';
4
+ import { client } from './client.gen';
5
+ import type {
6
+ ExecutionsCancelData,
7
+ ExecutionsCancelErrors,
8
+ ExecutionsCancelResponses,
9
+ ExecutionsGetData,
10
+ ExecutionsGetErrors,
11
+ ExecutionsGetResponses,
12
+ ExecutionsListData,
13
+ ExecutionsListErrors,
14
+ ExecutionsListResponses,
15
+ WorkflowsGetData,
16
+ WorkflowsGetErrors,
17
+ WorkflowsGetResponses,
18
+ WorkflowsListData,
19
+ WorkflowsListErrors,
20
+ WorkflowsListResponses,
21
+ WorkflowsRunData,
22
+ WorkflowsRunErrors,
23
+ WorkflowsRunResponses,
24
+ WorkflowsVersionsListData,
25
+ WorkflowsVersionsListErrors,
26
+ WorkflowsVersionsListResponses,
27
+ } from './types.gen';
28
+
29
+ export type Options<
30
+ TData extends TDataShape = TDataShape,
31
+ ThrowOnError extends boolean = boolean,
32
+ TResponse = unknown,
33
+ > = Options2<TData, ThrowOnError, TResponse> & {
34
+ /**
35
+ * You can provide a client instance returned by `createClient()` instead of
36
+ * individual options. This might be also useful if you want to implement a
37
+ * custom client.
38
+ */
39
+ client?: Client;
40
+ /**
41
+ * You can pass arbitrary values through the `meta` object. This can be
42
+ * used to access values that aren't defined as part of the SDK function.
43
+ */
44
+ meta?: Record<string, unknown>;
45
+ };
46
+
47
+ /**
48
+ * Cancel an execution
49
+ *
50
+ * Idempotent. For executions not yet picked up by a worker (status=created/pending), transitions immediately to `cancelled`. For running/waiting executions, stamps `cancelRequestedAt` so the worker observes cancellation between step transitions. Terminal executions are a no-op.
51
+ */
52
+ export const executionsCancel = <ThrowOnError extends boolean = false>(
53
+ options: Options<ExecutionsCancelData, ThrowOnError>
54
+ ) =>
55
+ (options.client ?? client).post<ExecutionsCancelResponses, ExecutionsCancelErrors, ThrowOnError>({
56
+ security: [{ scheme: 'bearer', type: 'http' }],
57
+ url: '/v1/executions/{executionId}/cancel',
58
+ ...options,
59
+ });
60
+
61
+ /**
62
+ * Get execution status
63
+ *
64
+ * Returns the current status, completion timestamps, and (when terminal) the result or error for a single execution. Pass `includeSteps=true` for the per-step artifact payload (heavier; intended for debugging).
65
+ */
66
+ export const executionsGet = <ThrowOnError extends boolean = false>(
67
+ options: Options<ExecutionsGetData, ThrowOnError>
68
+ ) =>
69
+ (options.client ?? client).get<ExecutionsGetResponses, ExecutionsGetErrors, ThrowOnError>({
70
+ security: [{ scheme: 'bearer', type: 'http' }],
71
+ url: '/v1/executions/{executionId}',
72
+ ...options,
73
+ });
74
+
75
+ /**
76
+ * List executions
77
+ *
78
+ * Returns executions across the tenant, optionally filtered by workflow, status, date range, or eval example. Paginated.
79
+ */
80
+ export const executionsList = <ThrowOnError extends boolean = false>(
81
+ options?: Options<ExecutionsListData, ThrowOnError>
82
+ ) =>
83
+ (options?.client ?? client).get<ExecutionsListResponses, ExecutionsListErrors, ThrowOnError>({
84
+ security: [{ scheme: 'bearer', type: 'http' }],
85
+ url: '/v1/executions',
86
+ ...options,
87
+ });
88
+
89
+ /**
90
+ * Get a workflow by id
91
+ *
92
+ * Returns the workflow with its current version (definition + YAML content).
93
+ */
94
+ export const workflowsGet = <ThrowOnError extends boolean = false>(
95
+ options: Options<WorkflowsGetData, ThrowOnError>
96
+ ) =>
97
+ (options.client ?? client).get<WorkflowsGetResponses, WorkflowsGetErrors, ThrowOnError>({
98
+ security: [{ scheme: 'bearer', type: 'http' }],
99
+ url: '/v1/workflows/{id}',
100
+ ...options,
101
+ });
102
+
103
+ /**
104
+ * Execute a workflow (async or sync)
105
+ *
106
+ * Enqueues a workflow execution. Returns 201 with `{ executionId }` by default. Pass `wait_for_completion=<seconds>` (max 60) to hold the connection until the run reaches a terminal state; the body then also includes `status`, `result`, and `error`. File inputs are uploaded as `multipart/form-data` (each file as a top-level form field; `_json` field carries scalar inputs).
107
+ */
108
+ export const workflowsRun = <ThrowOnError extends boolean = false>(
109
+ options: Options<WorkflowsRunData, ThrowOnError>
110
+ ) =>
111
+ (options.client ?? client).post<WorkflowsRunResponses, WorkflowsRunErrors, ThrowOnError>({
112
+ security: [{ scheme: 'bearer', type: 'http' }],
113
+ url: '/v1/workflows/{id}/run',
114
+ ...options,
115
+ headers: {
116
+ 'Content-Type': 'application/json',
117
+ ...options.headers,
118
+ },
119
+ });
120
+
121
+ /**
122
+ * List tagged versions for a workflow
123
+ *
124
+ * Returns released versions in reverse-chronological order, paginated.
125
+ */
126
+ export const workflowsVersionsList = <ThrowOnError extends boolean = false>(
127
+ options: Options<WorkflowsVersionsListData, ThrowOnError>
128
+ ) =>
129
+ (options.client ?? client).get<
130
+ WorkflowsVersionsListResponses,
131
+ WorkflowsVersionsListErrors,
132
+ ThrowOnError
133
+ >({
134
+ security: [{ scheme: 'bearer', type: 'http' }],
135
+ url: '/v1/workflows/{id}/versions',
136
+ ...options,
137
+ });
138
+
139
+ /**
140
+ * List workflows
141
+ *
142
+ * Returns workflows the API key has access to, with pagination. Use `name` for exact-match slug lookup, `search` for substring match.
143
+ */
144
+ export const workflowsList = <ThrowOnError extends boolean = false>(
145
+ options?: Options<WorkflowsListData, ThrowOnError>
146
+ ) =>
147
+ (options?.client ?? client).get<WorkflowsListResponses, WorkflowsListErrors, ThrowOnError>({
148
+ security: [{ scheme: 'bearer', type: 'http' }],
149
+ url: '/v1/workflows',
150
+ ...options,
151
+ });