@boboddy/sdk 0.0.13-alpha → 0.1.0-alpha

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.
Files changed (43) hide show
  1. package/dist/boboddy-config-parser.d.ts +34 -0
  2. package/dist/boboddy-config-parser.js +510 -0
  3. package/dist/client.d.ts +3 -1
  4. package/dist/client.js +1327 -45
  5. package/dist/definitions/advancement-policies/define-advancement-policy.d.ts +218 -0
  6. package/dist/definitions/advancement-policies/index.d.ts +1 -0
  7. package/dist/definitions/advancement-policies/index.js +95 -0
  8. package/dist/definitions/pipelines/define-pipeline.d.ts +112 -0
  9. package/dist/definitions/pipelines/index.d.ts +1 -0
  10. package/dist/definitions/pipelines/index.js +141 -0
  11. package/dist/{define-step.d.ts → definitions/steps/define-step.d.ts} +37 -4
  12. package/dist/definitions/steps/index.d.ts +2 -0
  13. package/dist/definitions/steps/index.js +13302 -0
  14. package/dist/definitions/steps/step-definitions-client.d.ts +197 -0
  15. package/dist/generated/client/client.gen.d.ts +2 -0
  16. package/dist/generated/client/index.d.ts +8 -0
  17. package/dist/generated/client/types.gen.d.ts +117 -0
  18. package/dist/generated/client/utils.gen.d.ts +33 -0
  19. package/dist/generated/client.gen.d.ts +12 -0
  20. package/dist/generated/core/auth.gen.d.ts +18 -0
  21. package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
  22. package/dist/generated/core/params.gen.d.ts +43 -0
  23. package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
  24. package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
  25. package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
  26. package/dist/generated/core/types.gen.d.ts +78 -0
  27. package/dist/generated/core/utils.gen.d.ts +19 -0
  28. package/dist/generated/index.d.ts +2 -0
  29. package/dist/generated/sdk.gen.d.ts +140 -0
  30. package/dist/generated/types.gen.d.ts +7842 -0
  31. package/dist/index.d.ts +5 -1
  32. package/dist/index.js +16380 -956
  33. package/dist/jsonc.d.ts +3 -0
  34. package/dist/jsonc.js +133 -0
  35. package/dist/opencode-mcp.d.ts +73 -0
  36. package/dist/opencode-mcp.js +14332 -0
  37. package/dist/step-execution-plane-client.d.ts +107 -287
  38. package/package.json +45 -19
  39. package/dist/define-step.js +0 -1018
  40. package/dist/step-definitions-client.d.ts +0 -202
  41. package/dist/step-definitions-client.js +0 -47
  42. package/dist/treaty.d.ts +0 -13
  43. package/dist/treaty.js +0 -34
package/dist/client.js CHANGED
@@ -1,62 +1,1344 @@
1
- // src/treaty.ts
2
- import { treaty } from "@elysiajs/eden";
3
- var TRAILING_SLASHES_PATTERN = /\/+$/u;
4
- var API_SUFFIX_PATTERN = /\/api$/u;
5
- var normalizeBoboddyBaseUrl = (baseUrl) => {
6
- const trimmedBaseUrl = baseUrl.trim();
7
- if (trimmedBaseUrl.length === 0) {
1
+ var __defProp = Object.defineProperty;
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true,
11
+ configurable: true,
12
+ set: __exportSetter.bind(all, name)
13
+ });
14
+ };
15
+
16
+ // src/generated/core/bodySerializer.gen.ts
17
+ var jsonBodySerializer = {
18
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
19
+ };
20
+ // src/generated/core/params.gen.ts
21
+ var extraPrefixesMap = {
22
+ $body_: "body",
23
+ $headers_: "headers",
24
+ $path_: "path",
25
+ $query_: "query"
26
+ };
27
+ var extraPrefixes = Object.entries(extraPrefixesMap);
28
+ // src/generated/core/serverSentEvents.gen.ts
29
+ var createSseClient = ({
30
+ onRequest,
31
+ onSseError,
32
+ onSseEvent,
33
+ responseTransformer,
34
+ responseValidator,
35
+ sseDefaultRetryDelay,
36
+ sseMaxRetryAttempts,
37
+ sseMaxRetryDelay,
38
+ sseSleepFn,
39
+ url,
40
+ ...options
41
+ }) => {
42
+ let lastEventId;
43
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
44
+ const createStream = async function* () {
45
+ let retryDelay = sseDefaultRetryDelay ?? 3000;
46
+ let attempt = 0;
47
+ const signal = options.signal ?? new AbortController().signal;
48
+ while (true) {
49
+ if (signal.aborted)
50
+ break;
51
+ attempt++;
52
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
53
+ if (lastEventId !== undefined) {
54
+ headers.set("Last-Event-ID", lastEventId);
55
+ }
56
+ try {
57
+ const requestInit = {
58
+ redirect: "follow",
59
+ ...options,
60
+ body: options.serializedBody,
61
+ headers,
62
+ signal
63
+ };
64
+ let request = new Request(url, requestInit);
65
+ if (onRequest) {
66
+ request = await onRequest(url, requestInit);
67
+ }
68
+ const _fetch = options.fetch ?? globalThis.fetch;
69
+ const response = await _fetch(request);
70
+ if (!response.ok)
71
+ throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
72
+ if (!response.body)
73
+ throw new Error("No body in SSE response");
74
+ const reader = response.body.pipeThrough(new TextDecoderStream).getReader();
75
+ let buffer = "";
76
+ const abortHandler = () => {
77
+ try {
78
+ reader.cancel();
79
+ } catch {}
80
+ };
81
+ signal.addEventListener("abort", abortHandler);
82
+ try {
83
+ while (true) {
84
+ const { done, value } = await reader.read();
85
+ if (done)
86
+ break;
87
+ buffer += value;
88
+ buffer = buffer.replace(/\r\n/g, `
89
+ `).replace(/\r/g, `
90
+ `);
91
+ const chunks = buffer.split(`
92
+
93
+ `);
94
+ buffer = chunks.pop() ?? "";
95
+ for (const chunk of chunks) {
96
+ const lines = chunk.split(`
97
+ `);
98
+ const dataLines = [];
99
+ let eventName;
100
+ for (const line of lines) {
101
+ if (line.startsWith("data:")) {
102
+ dataLines.push(line.replace(/^data:\s*/, ""));
103
+ } else if (line.startsWith("event:")) {
104
+ eventName = line.replace(/^event:\s*/, "");
105
+ } else if (line.startsWith("id:")) {
106
+ lastEventId = line.replace(/^id:\s*/, "");
107
+ } else if (line.startsWith("retry:")) {
108
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
109
+ if (!Number.isNaN(parsed)) {
110
+ retryDelay = parsed;
111
+ }
112
+ }
113
+ }
114
+ let data;
115
+ let parsedJson = false;
116
+ if (dataLines.length) {
117
+ const rawData = dataLines.join(`
118
+ `);
119
+ try {
120
+ data = JSON.parse(rawData);
121
+ parsedJson = true;
122
+ } catch {
123
+ data = rawData;
124
+ }
125
+ }
126
+ if (parsedJson) {
127
+ if (responseValidator) {
128
+ await responseValidator(data);
129
+ }
130
+ if (responseTransformer) {
131
+ data = await responseTransformer(data);
132
+ }
133
+ }
134
+ onSseEvent?.({
135
+ data,
136
+ event: eventName,
137
+ id: lastEventId,
138
+ retry: retryDelay
139
+ });
140
+ if (dataLines.length) {
141
+ yield data;
142
+ }
143
+ }
144
+ }
145
+ } finally {
146
+ signal.removeEventListener("abort", abortHandler);
147
+ reader.releaseLock();
148
+ }
149
+ break;
150
+ } catch (error) {
151
+ onSseError?.(error);
152
+ if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
153
+ break;
154
+ }
155
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
156
+ await sleep(backoff);
157
+ }
158
+ }
159
+ };
160
+ const stream = createStream();
161
+ return { stream };
162
+ };
163
+
164
+ // src/generated/core/pathSerializer.gen.ts
165
+ var separatorArrayExplode = (style) => {
166
+ switch (style) {
167
+ case "label":
168
+ return ".";
169
+ case "matrix":
170
+ return ";";
171
+ case "simple":
172
+ return ",";
173
+ default:
174
+ return "&";
175
+ }
176
+ };
177
+ var separatorArrayNoExplode = (style) => {
178
+ switch (style) {
179
+ case "form":
180
+ return ",";
181
+ case "pipeDelimited":
182
+ return "|";
183
+ case "spaceDelimited":
184
+ return "%20";
185
+ default:
186
+ return ",";
187
+ }
188
+ };
189
+ var separatorObjectExplode = (style) => {
190
+ switch (style) {
191
+ case "label":
192
+ return ".";
193
+ case "matrix":
194
+ return ";";
195
+ case "simple":
196
+ return ",";
197
+ default:
198
+ return "&";
199
+ }
200
+ };
201
+ var serializeArrayParam = ({
202
+ allowReserved,
203
+ explode,
204
+ name,
205
+ style,
206
+ value
207
+ }) => {
208
+ if (!explode) {
209
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
210
+ switch (style) {
211
+ case "label":
212
+ return `.${joinedValues2}`;
213
+ case "matrix":
214
+ return `;${name}=${joinedValues2}`;
215
+ case "simple":
216
+ return joinedValues2;
217
+ default:
218
+ return `${name}=${joinedValues2}`;
219
+ }
220
+ }
221
+ const separator = separatorArrayExplode(style);
222
+ const joinedValues = value.map((v) => {
223
+ if (style === "label" || style === "simple") {
224
+ return allowReserved ? v : encodeURIComponent(v);
225
+ }
226
+ return serializePrimitiveParam({
227
+ allowReserved,
228
+ name,
229
+ value: v
230
+ });
231
+ }).join(separator);
232
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
233
+ };
234
+ var serializePrimitiveParam = ({
235
+ allowReserved,
236
+ name,
237
+ value
238
+ }) => {
239
+ if (value === undefined || value === null) {
8
240
  return "";
9
241
  }
10
- return trimmedBaseUrl.replace(TRAILING_SLASHES_PATTERN, "").replace(API_SUFFIX_PATTERN, "");
242
+ if (typeof value === "object") {
243
+ throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
244
+ }
245
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
11
246
  };
12
- function createBoboddyTreaty(baseUrlOrApp) {
13
- if (typeof baseUrlOrApp === "string") {
14
- return treaty(normalizeBoboddyBaseUrl(baseUrlOrApp), {
15
- parseDate: false
247
+ var serializeObjectParam = ({
248
+ allowReserved,
249
+ explode,
250
+ name,
251
+ style,
252
+ value,
253
+ valueOnly
254
+ }) => {
255
+ if (value instanceof Date) {
256
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
257
+ }
258
+ if (style !== "deepObject" && !explode) {
259
+ let values = [];
260
+ Object.entries(value).forEach(([key, v]) => {
261
+ values = [
262
+ ...values,
263
+ key,
264
+ allowReserved ? v : encodeURIComponent(v)
265
+ ];
16
266
  });
267
+ const joinedValues2 = values.join(",");
268
+ switch (style) {
269
+ case "form":
270
+ return `${name}=${joinedValues2}`;
271
+ case "label":
272
+ return `.${joinedValues2}`;
273
+ case "matrix":
274
+ return `;${name}=${joinedValues2}`;
275
+ default:
276
+ return joinedValues2;
277
+ }
278
+ }
279
+ const separator = separatorObjectExplode(style);
280
+ const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
281
+ allowReserved,
282
+ name: style === "deepObject" ? `${name}[${key}]` : key,
283
+ value: v
284
+ })).join(separator);
285
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
286
+ };
287
+
288
+ // src/generated/core/utils.gen.ts
289
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
290
+ var defaultPathSerializer = ({ path, url: _url }) => {
291
+ let url = _url;
292
+ const matches = _url.match(PATH_PARAM_RE);
293
+ if (matches) {
294
+ for (const match of matches) {
295
+ let explode = false;
296
+ let name = match.substring(1, match.length - 1);
297
+ let style = "simple";
298
+ if (name.endsWith("*")) {
299
+ explode = true;
300
+ name = name.substring(0, name.length - 1);
301
+ }
302
+ if (name.startsWith(".")) {
303
+ name = name.substring(1);
304
+ style = "label";
305
+ } else if (name.startsWith(";")) {
306
+ name = name.substring(1);
307
+ style = "matrix";
308
+ }
309
+ const value = path[name];
310
+ if (value === undefined || value === null) {
311
+ continue;
312
+ }
313
+ if (Array.isArray(value)) {
314
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
315
+ continue;
316
+ }
317
+ if (typeof value === "object") {
318
+ url = url.replace(match, serializeObjectParam({
319
+ explode,
320
+ name,
321
+ style,
322
+ value,
323
+ valueOnly: true
324
+ }));
325
+ continue;
326
+ }
327
+ if (style === "matrix") {
328
+ url = url.replace(match, `;${serializePrimitiveParam({
329
+ name,
330
+ value
331
+ })}`);
332
+ continue;
333
+ }
334
+ const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
335
+ url = url.replace(match, replaceValue);
336
+ }
337
+ }
338
+ return url;
339
+ };
340
+ var getUrl = ({
341
+ baseUrl,
342
+ path,
343
+ query,
344
+ querySerializer,
345
+ url: _url
346
+ }) => {
347
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
348
+ let url = (baseUrl ?? "") + pathUrl;
349
+ if (path) {
350
+ url = defaultPathSerializer({ path, url });
351
+ }
352
+ let search = query ? querySerializer(query) : "";
353
+ if (search.startsWith("?")) {
354
+ search = search.substring(1);
355
+ }
356
+ if (search) {
357
+ url += `?${search}`;
358
+ }
359
+ return url;
360
+ };
361
+ function getValidRequestBody(options) {
362
+ const hasBody = options.body !== undefined;
363
+ const isSerializedBody = hasBody && options.bodySerializer;
364
+ if (isSerializedBody) {
365
+ if ("serializedBody" in options) {
366
+ const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== "";
367
+ return hasSerializedBody ? options.serializedBody : null;
368
+ }
369
+ return options.body !== "" ? options.body : null;
370
+ }
371
+ if (hasBody) {
372
+ return options.body;
373
+ }
374
+ return;
375
+ }
376
+
377
+ // src/generated/core/auth.gen.ts
378
+ var getAuthToken = async (auth, callback) => {
379
+ const token = typeof callback === "function" ? await callback(auth) : callback;
380
+ if (!token) {
381
+ return;
382
+ }
383
+ if (auth.scheme === "bearer") {
384
+ return `Bearer ${token}`;
385
+ }
386
+ if (auth.scheme === "basic") {
387
+ return `Basic ${btoa(token)}`;
388
+ }
389
+ return token;
390
+ };
391
+
392
+ // src/generated/client/utils.gen.ts
393
+ var createQuerySerializer = ({
394
+ parameters = {},
395
+ ...args
396
+ } = {}) => {
397
+ const querySerializer = (queryParams) => {
398
+ const search = [];
399
+ if (queryParams && typeof queryParams === "object") {
400
+ for (const name in queryParams) {
401
+ const value = queryParams[name];
402
+ if (value === undefined || value === null) {
403
+ continue;
404
+ }
405
+ const options = parameters[name] || args;
406
+ if (Array.isArray(value)) {
407
+ const serializedArray = serializeArrayParam({
408
+ allowReserved: options.allowReserved,
409
+ explode: true,
410
+ name,
411
+ style: "form",
412
+ value,
413
+ ...options.array
414
+ });
415
+ if (serializedArray)
416
+ search.push(serializedArray);
417
+ } else if (typeof value === "object") {
418
+ const serializedObject = serializeObjectParam({
419
+ allowReserved: options.allowReserved,
420
+ explode: true,
421
+ name,
422
+ style: "deepObject",
423
+ value,
424
+ ...options.object
425
+ });
426
+ if (serializedObject)
427
+ search.push(serializedObject);
428
+ } else {
429
+ const serializedPrimitive = serializePrimitiveParam({
430
+ allowReserved: options.allowReserved,
431
+ name,
432
+ value
433
+ });
434
+ if (serializedPrimitive)
435
+ search.push(serializedPrimitive);
436
+ }
437
+ }
438
+ }
439
+ return search.join("&");
440
+ };
441
+ return querySerializer;
442
+ };
443
+ var getParseAs = (contentType) => {
444
+ if (!contentType) {
445
+ return "stream";
446
+ }
447
+ const cleanContent = contentType.split(";")[0]?.trim();
448
+ if (!cleanContent) {
449
+ return;
450
+ }
451
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
452
+ return "json";
453
+ }
454
+ if (cleanContent === "multipart/form-data") {
455
+ return "formData";
456
+ }
457
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
458
+ return "blob";
459
+ }
460
+ if (cleanContent.startsWith("text/")) {
461
+ return "text";
462
+ }
463
+ return;
464
+ };
465
+ var checkForExistence = (options, name) => {
466
+ if (!name) {
467
+ return false;
468
+ }
469
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
470
+ return true;
471
+ }
472
+ return false;
473
+ };
474
+ var setAuthParams = async ({
475
+ security,
476
+ ...options
477
+ }) => {
478
+ for (const auth of security) {
479
+ if (checkForExistence(options, auth.name)) {
480
+ continue;
481
+ }
482
+ const token = await getAuthToken(auth, options.auth);
483
+ if (!token) {
484
+ continue;
485
+ }
486
+ const name = auth.name ?? "Authorization";
487
+ switch (auth.in) {
488
+ case "query":
489
+ if (!options.query) {
490
+ options.query = {};
491
+ }
492
+ options.query[name] = token;
493
+ break;
494
+ case "cookie":
495
+ options.headers.append("Cookie", `${name}=${token}`);
496
+ break;
497
+ case "header":
498
+ default:
499
+ options.headers.set(name, token);
500
+ break;
501
+ }
17
502
  }
18
- return treaty(baseUrlOrApp, {
19
- parseDate: false
503
+ };
504
+ var buildUrl = (options) => getUrl({
505
+ baseUrl: options.baseUrl,
506
+ path: options.path,
507
+ query: options.query,
508
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
509
+ url: options.url
510
+ });
511
+ var mergeConfigs = (a, b) => {
512
+ const config = { ...a, ...b };
513
+ if (config.baseUrl?.endsWith("/")) {
514
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
515
+ }
516
+ config.headers = mergeHeaders(a.headers, b.headers);
517
+ return config;
518
+ };
519
+ var headersEntries = (headers) => {
520
+ const entries = [];
521
+ headers.forEach((value, key) => {
522
+ entries.push([key, value]);
20
523
  });
524
+ return entries;
525
+ };
526
+ var mergeHeaders = (...headers) => {
527
+ const mergedHeaders = new Headers;
528
+ for (const header of headers) {
529
+ if (!header) {
530
+ continue;
531
+ }
532
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
533
+ for (const [key, value] of iterator) {
534
+ if (value === null) {
535
+ mergedHeaders.delete(key);
536
+ } else if (Array.isArray(value)) {
537
+ for (const v of value) {
538
+ mergedHeaders.append(key, v);
539
+ }
540
+ } else if (value !== undefined) {
541
+ mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
542
+ }
543
+ }
544
+ }
545
+ return mergedHeaders;
546
+ };
547
+
548
+ class Interceptors {
549
+ fns = [];
550
+ clear() {
551
+ this.fns = [];
552
+ }
553
+ eject(id) {
554
+ const index = this.getInterceptorIndex(id);
555
+ if (this.fns[index]) {
556
+ this.fns[index] = null;
557
+ }
558
+ }
559
+ exists(id) {
560
+ const index = this.getInterceptorIndex(id);
561
+ return Boolean(this.fns[index]);
562
+ }
563
+ getInterceptorIndex(id) {
564
+ if (typeof id === "number") {
565
+ return this.fns[id] ? id : -1;
566
+ }
567
+ return this.fns.indexOf(id);
568
+ }
569
+ update(id, fn) {
570
+ const index = this.getInterceptorIndex(id);
571
+ if (this.fns[index]) {
572
+ this.fns[index] = fn;
573
+ return id;
574
+ }
575
+ return false;
576
+ }
577
+ use(fn) {
578
+ this.fns.push(fn);
579
+ return this.fns.length - 1;
580
+ }
21
581
  }
22
- var unwrapTreatyResponse = async (promise) => {
23
- const { data, error } = await promise;
24
- if (error) {
25
- throw error.value;
582
+ var createInterceptors = () => ({
583
+ error: new Interceptors,
584
+ request: new Interceptors,
585
+ response: new Interceptors
586
+ });
587
+ var defaultQuerySerializer = createQuerySerializer({
588
+ allowReserved: false,
589
+ array: {
590
+ explode: true,
591
+ style: "form"
592
+ },
593
+ object: {
594
+ explode: true,
595
+ style: "deepObject"
26
596
  }
27
- return data;
597
+ });
598
+ var defaultHeaders = {
599
+ "Content-Type": "application/json"
28
600
  };
29
- var createBoboddyApiClient = createBoboddyTreaty;
601
+ var createConfig = (override = {}) => ({
602
+ ...jsonBodySerializer,
603
+ headers: defaultHeaders,
604
+ parseAs: "auto",
605
+ querySerializer: defaultQuerySerializer,
606
+ ...override
607
+ });
608
+
609
+ // src/generated/client/client.gen.ts
610
+ var createClient = (config = {}) => {
611
+ let _config = mergeConfigs(createConfig(), config);
612
+ const getConfig = () => ({ ..._config });
613
+ const setConfig = (config2) => {
614
+ _config = mergeConfigs(_config, config2);
615
+ return getConfig();
616
+ };
617
+ const interceptors = createInterceptors();
618
+ const beforeRequest = async (options) => {
619
+ const opts = {
620
+ ..._config,
621
+ ...options,
622
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
623
+ headers: mergeHeaders(_config.headers, options.headers),
624
+ serializedBody: undefined
625
+ };
626
+ if (opts.security) {
627
+ await setAuthParams({
628
+ ...opts,
629
+ security: opts.security
630
+ });
631
+ }
632
+ if (opts.requestValidator) {
633
+ await opts.requestValidator(opts);
634
+ }
635
+ if (opts.body !== undefined && opts.bodySerializer) {
636
+ opts.serializedBody = opts.bodySerializer(opts.body);
637
+ }
638
+ if (opts.body === undefined || opts.serializedBody === "") {
639
+ opts.headers.delete("Content-Type");
640
+ }
641
+ const url = buildUrl(opts);
642
+ return { opts, url };
643
+ };
644
+ const request = async (options) => {
645
+ const { opts, url } = await beforeRequest(options);
646
+ const requestInit = {
647
+ redirect: "follow",
648
+ ...opts,
649
+ body: getValidRequestBody(opts)
650
+ };
651
+ let request2 = new Request(url, requestInit);
652
+ for (const fn of interceptors.request.fns) {
653
+ if (fn) {
654
+ request2 = await fn(request2, opts);
655
+ }
656
+ }
657
+ const _fetch = opts.fetch;
658
+ let response;
659
+ try {
660
+ response = await _fetch(request2);
661
+ } catch (error2) {
662
+ let finalError2 = error2;
663
+ for (const fn of interceptors.error.fns) {
664
+ if (fn) {
665
+ finalError2 = await fn(error2, undefined, request2, opts);
666
+ }
667
+ }
668
+ finalError2 = finalError2 || {};
669
+ if (opts.throwOnError) {
670
+ throw finalError2;
671
+ }
672
+ return opts.responseStyle === "data" ? undefined : {
673
+ error: finalError2,
674
+ request: request2,
675
+ response: undefined
676
+ };
677
+ }
678
+ for (const fn of interceptors.response.fns) {
679
+ if (fn) {
680
+ response = await fn(response, request2, opts);
681
+ }
682
+ }
683
+ const result = {
684
+ request: request2,
685
+ response
686
+ };
687
+ if (response.ok) {
688
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
689
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
690
+ let emptyData;
691
+ switch (parseAs) {
692
+ case "arrayBuffer":
693
+ case "blob":
694
+ case "text":
695
+ emptyData = await response[parseAs]();
696
+ break;
697
+ case "formData":
698
+ emptyData = new FormData;
699
+ break;
700
+ case "stream":
701
+ emptyData = response.body;
702
+ break;
703
+ case "json":
704
+ default:
705
+ emptyData = {};
706
+ break;
707
+ }
708
+ return opts.responseStyle === "data" ? emptyData : {
709
+ data: emptyData,
710
+ ...result
711
+ };
712
+ }
713
+ let data;
714
+ switch (parseAs) {
715
+ case "arrayBuffer":
716
+ case "blob":
717
+ case "formData":
718
+ case "text":
719
+ data = await response[parseAs]();
720
+ break;
721
+ case "json": {
722
+ const text = await response.text();
723
+ data = text ? JSON.parse(text) : {};
724
+ break;
725
+ }
726
+ case "stream":
727
+ return opts.responseStyle === "data" ? response.body : {
728
+ data: response.body,
729
+ ...result
730
+ };
731
+ }
732
+ if (parseAs === "json") {
733
+ if (opts.responseValidator) {
734
+ await opts.responseValidator(data);
735
+ }
736
+ if (opts.responseTransformer) {
737
+ data = await opts.responseTransformer(data);
738
+ }
739
+ }
740
+ return opts.responseStyle === "data" ? data : {
741
+ data,
742
+ ...result
743
+ };
744
+ }
745
+ const textError = await response.text();
746
+ let jsonError;
747
+ try {
748
+ jsonError = JSON.parse(textError);
749
+ } catch {}
750
+ const error = jsonError ?? textError;
751
+ let finalError = error;
752
+ for (const fn of interceptors.error.fns) {
753
+ if (fn) {
754
+ finalError = await fn(error, response, request2, opts);
755
+ }
756
+ }
757
+ finalError = finalError || {};
758
+ if (opts.throwOnError) {
759
+ throw finalError;
760
+ }
761
+ return opts.responseStyle === "data" ? undefined : {
762
+ error: finalError,
763
+ ...result
764
+ };
765
+ };
766
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
767
+ const makeSseFn = (method) => async (options) => {
768
+ const { opts, url } = await beforeRequest(options);
769
+ return createSseClient({
770
+ ...opts,
771
+ body: opts.body,
772
+ headers: opts.headers,
773
+ method,
774
+ onRequest: async (url2, init) => {
775
+ let request2 = new Request(url2, init);
776
+ for (const fn of interceptors.request.fns) {
777
+ if (fn) {
778
+ request2 = await fn(request2, opts);
779
+ }
780
+ }
781
+ return request2;
782
+ },
783
+ serializedBody: getValidRequestBody(opts),
784
+ url
785
+ });
786
+ };
787
+ return {
788
+ buildUrl,
789
+ connect: makeMethodFn("CONNECT"),
790
+ delete: makeMethodFn("DELETE"),
791
+ get: makeMethodFn("GET"),
792
+ getConfig,
793
+ head: makeMethodFn("HEAD"),
794
+ interceptors,
795
+ options: makeMethodFn("OPTIONS"),
796
+ patch: makeMethodFn("PATCH"),
797
+ post: makeMethodFn("POST"),
798
+ put: makeMethodFn("PUT"),
799
+ request,
800
+ setConfig,
801
+ sse: {
802
+ connect: makeSseFn("CONNECT"),
803
+ delete: makeSseFn("DELETE"),
804
+ get: makeSseFn("GET"),
805
+ head: makeSseFn("HEAD"),
806
+ options: makeSseFn("OPTIONS"),
807
+ patch: makeSseFn("PATCH"),
808
+ post: makeSseFn("POST"),
809
+ put: makeSseFn("PUT"),
810
+ trace: makeSseFn("TRACE")
811
+ },
812
+ trace: makeMethodFn("TRACE")
813
+ };
814
+ };
815
+ // src/generated/client.gen.ts
816
+ var client = createClient(createConfig());
817
+
818
+ // src/generated/sdk.gen.ts
819
+ class HeyApiClient {
820
+ client;
821
+ constructor(args) {
822
+ this.client = args?.client ?? client;
823
+ }
824
+ }
825
+
826
+ class HeyApiRegistry {
827
+ defaultKey = "default";
828
+ instances = new Map;
829
+ get(key) {
830
+ const instance = this.instances.get(key ?? this.defaultKey);
831
+ if (!instance) {
832
+ throw new Error(`No SDK client found. Create one with "new BoboddyClient()" to fix this error.`);
833
+ }
834
+ return instance;
835
+ }
836
+ set(value, key) {
837
+ this.instances.set(key ?? this.defaultKey, value);
838
+ }
839
+ }
840
+
841
+ class Api extends HeyApiClient {
842
+ "allApiApiAuth*"(options) {
843
+ return (options?.client ?? this.client).delete({ url: "/api/api/auth/*", ...options });
844
+ }
845
+ "allApiApiAuth*2"(options) {
846
+ return (options?.client ?? this.client).get({ url: "/api/api/auth/*", ...options });
847
+ }
848
+ "allApiApiAuth*3"(options) {
849
+ return (options?.client ?? this.client).head({ url: "/api/api/auth/*", ...options });
850
+ }
851
+ "allApiApiAuth*4"(options) {
852
+ return (options?.client ?? this.client).options({ url: "/api/api/auth/*", ...options });
853
+ }
854
+ "allApiApiAuth*5"(options) {
855
+ return (options?.client ?? this.client).patch({ url: "/api/api/auth/*", ...options });
856
+ }
857
+ "allApiApiAuth*6"(options) {
858
+ return (options?.client ?? this.client).post({ url: "/api/api/auth/*", ...options });
859
+ }
860
+ "allApiApiAuth*7"(options) {
861
+ return (options?.client ?? this.client).put({ url: "/api/api/auth/*", ...options });
862
+ }
863
+ "allApiApiAuth*8"(options) {
864
+ return (options?.client ?? this.client).trace({ url: "/api/api/auth/*", ...options });
865
+ }
866
+ }
867
+
868
+ class Projects extends HeyApiClient {
869
+ listProjects(options) {
870
+ return (options?.client ?? this.client).get({ url: "/api/projects", ...options });
871
+ }
872
+ createProject(options) {
873
+ return (options.client ?? this.client).post({
874
+ url: "/api/projects",
875
+ ...options,
876
+ headers: {
877
+ "Content-Type": "application/json",
878
+ ...options.headers
879
+ }
880
+ });
881
+ }
882
+ listProjectWorkItems(options) {
883
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-items", ...options });
884
+ }
885
+ getProject(options) {
886
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}", ...options });
887
+ }
888
+ updateProjectMemberPermissions(options) {
889
+ return (options.client ?? this.client).put({ url: "/api/projects/{projectId}/members/{userId}/permissions", ...options });
890
+ }
891
+ }
892
+
893
+ class StepDefinitions extends HeyApiClient {
894
+ listStepDefinitions(options) {
895
+ return (options.client ?? this.client).get({ url: "/api/step-definitions", ...options });
896
+ }
897
+ createStepDefinition(options) {
898
+ return (options.client ?? this.client).post({
899
+ url: "/api/step-definitions",
900
+ ...options,
901
+ headers: {
902
+ "Content-Type": "application/json",
903
+ ...options.headers
904
+ }
905
+ });
906
+ }
907
+ getStepDefinition(options) {
908
+ return (options.client ?? this.client).get({ url: "/api/step-definitions/{stepDefinitionId}", ...options });
909
+ }
910
+ updateStepDefinition(options) {
911
+ return (options.client ?? this.client).put({
912
+ url: "/api/step-definitions/{stepDefinitionId}",
913
+ ...options,
914
+ headers: {
915
+ "Content-Type": "application/json",
916
+ ...options.headers
917
+ }
918
+ });
919
+ }
920
+ archiveStepDefinition(options) {
921
+ return (options.client ?? this.client).put({ url: "/api/step-definitions/{stepDefinitionId}/archive", ...options });
922
+ }
923
+ }
924
+
925
+ class StepExecutions extends HeyApiClient {
926
+ claimStepExecutions(options) {
927
+ return (options.client ?? this.client).post({
928
+ url: "/api/step-executions/claims",
929
+ ...options,
930
+ headers: {
931
+ "Content-Type": "application/json",
932
+ ...options.headers
933
+ }
934
+ });
935
+ }
936
+ listStepExecutions(options) {
937
+ return (options.client ?? this.client).get({ url: "/api/step-executions", ...options });
938
+ }
939
+ createStepExecution(options) {
940
+ return (options.client ?? this.client).post({
941
+ url: "/api/step-executions",
942
+ ...options,
943
+ headers: {
944
+ "Content-Type": "application/json",
945
+ ...options.headers
946
+ }
947
+ });
948
+ }
949
+ heartbeatStepExecution(options) {
950
+ return (options.client ?? this.client).put({
951
+ url: "/api/step-executions/{stepExecutionId}/heartbeat",
952
+ ...options,
953
+ headers: {
954
+ "Content-Type": "application/json",
955
+ ...options.headers
956
+ }
957
+ });
958
+ }
959
+ getStepExecutionWorkerContext(options) {
960
+ return (options.client ?? this.client).post({
961
+ url: "/api/step-executions/{stepExecutionId}/worker-context",
962
+ ...options,
963
+ headers: {
964
+ "Content-Type": "application/json",
965
+ ...options.headers
966
+ }
967
+ });
968
+ }
969
+ completeStepExecution(options) {
970
+ return (options.client ?? this.client).post({
971
+ url: "/api/step-executions/{stepExecutionId}/completions",
972
+ ...options,
973
+ headers: {
974
+ "Content-Type": "application/json",
975
+ ...options.headers
976
+ }
977
+ });
978
+ }
979
+ markStepExecutionRunning(options) {
980
+ return (options.client ?? this.client).put({ url: "/api/step-executions/{stepExecutionId}/running", ...options });
981
+ }
982
+ createStepExecutionResult(options) {
983
+ return (options.client ?? this.client).post({
984
+ url: "/api/step-execution-results",
985
+ ...options,
986
+ headers: {
987
+ "Content-Type": "application/json",
988
+ ...options.headers
989
+ }
990
+ });
991
+ }
992
+ extractStepExecutionSignals(options) {
993
+ return (options.client ?? this.client).post({ url: "/api/step-execution-results/{stepExecutionResultId}/signals/extract", ...options });
994
+ }
995
+ getStepExecution(options) {
996
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
997
+ }
998
+ }
999
+
1000
+ class PipelineDefinitions extends HeyApiClient {
1001
+ listPipelineDefinitions(options) {
1002
+ return (options.client ?? this.client).get({ url: "/api/linear-pipeline-definitions", ...options });
1003
+ }
1004
+ createPipelineDefinition(options) {
1005
+ return (options?.client ?? this.client).post({ url: "/api/linear-pipeline-definitions", ...options });
1006
+ }
1007
+ getPipelineDefinition(options) {
1008
+ return (options.client ?? this.client).get({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}", ...options });
1009
+ }
1010
+ updatePipelineDefinition(options) {
1011
+ return (options.client ?? this.client).put({
1012
+ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}",
1013
+ ...options,
1014
+ headers: {
1015
+ "Content-Type": "application/json",
1016
+ ...options.headers
1017
+ }
1018
+ });
1019
+ }
1020
+ archivePipelineDefinition(options) {
1021
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/archive", ...options });
1022
+ }
1023
+ addPipelineStep(options) {
1024
+ return (options.client ?? this.client).post({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps", ...options });
1025
+ }
1026
+ removePipelineStep(options) {
1027
+ return (options.client ?? this.client).delete({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}", ...options });
1028
+ }
1029
+ updatePipelineStep(options) {
1030
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}", ...options });
1031
+ }
1032
+ setPipelineStepAdvancementPolicy(options) {
1033
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}/advancement-policy", ...options });
1034
+ }
1035
+ }
1036
+
1037
+ class PipelineExecutions extends HeyApiClient {
1038
+ listPipelineExecutions(options) {
1039
+ return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions", ...options });
1040
+ }
1041
+ createPipelineExecution(options) {
1042
+ return (options.client ?? this.client).post({
1043
+ url: "/api/linear-pipeline-executions",
1044
+ ...options,
1045
+ headers: {
1046
+ "Content-Type": "application/json",
1047
+ ...options.headers
1048
+ }
1049
+ });
1050
+ }
1051
+ startPipelineExecution(options) {
1052
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/start", ...options });
1053
+ }
1054
+ queueFirstPipelineStepRun(options) {
1055
+ return (options.client ?? this.client).post({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/first", ...options });
1056
+ }
1057
+ createPipelineStepRunAttempt(options) {
1058
+ return (options.client ?? this.client).post({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/attempts", ...options });
1059
+ }
1060
+ markPipelineStepRunAttemptRunning(options) {
1061
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/attempts/{linearPipelineStepRunAttemptId}/running", ...options });
1062
+ }
1063
+ applyPipelineStepResult(options) {
1064
+ return (options.client ?? this.client).post({
1065
+ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/attempts/{linearPipelineStepRunAttemptId}/results",
1066
+ ...options,
1067
+ headers: {
1068
+ "Content-Type": "application/json",
1069
+ ...options.headers
1070
+ }
1071
+ });
1072
+ }
1073
+ acceptPipelineStepRun(options) {
1074
+ return (options.client ?? this.client).post({
1075
+ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/accept",
1076
+ ...options,
1077
+ headers: {
1078
+ "Content-Type": "application/json",
1079
+ ...options.headers
1080
+ }
1081
+ });
1082
+ }
1083
+ retriggerPipelineStepRun(options) {
1084
+ return (options.client ?? this.client).post({
1085
+ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/retrigger",
1086
+ ...options,
1087
+ headers: {
1088
+ "Content-Type": "application/json",
1089
+ ...options.headers
1090
+ }
1091
+ });
1092
+ }
1093
+ cancelPipelineExecution(options) {
1094
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/cancel", ...options });
1095
+ }
1096
+ getPipelineExecution(options) {
1097
+ return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}", ...options });
1098
+ }
1099
+ listPipelineExecutionsByDefinition(options) {
1100
+ return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/by-definition/{linearPipelineDefinitionId}", ...options });
1101
+ }
1102
+ }
1103
+
1104
+ class WorkItems extends HeyApiClient {
1105
+ createWorkItem(options) {
1106
+ return (options.client ?? this.client).post({
1107
+ url: "/api/work-items",
1108
+ ...options,
1109
+ headers: {
1110
+ "Content-Type": "application/json",
1111
+ ...options.headers
1112
+ }
1113
+ });
1114
+ }
1115
+ upsertWorkItem(options) {
1116
+ return (options.client ?? this.client).put({
1117
+ url: "/api/work-items",
1118
+ ...options,
1119
+ headers: {
1120
+ "Content-Type": "application/json",
1121
+ ...options.headers
1122
+ }
1123
+ });
1124
+ }
1125
+ deleteWorkItems(options) {
1126
+ return (options.client ?? this.client).delete({
1127
+ url: "/api/work-items/batch",
1128
+ ...options,
1129
+ headers: {
1130
+ "Content-Type": "application/json",
1131
+ ...options.headers
1132
+ }
1133
+ });
1134
+ }
1135
+ getWorkItems(options) {
1136
+ return (options.client ?? this.client).get({ url: "/api/work-items/batch", ...options });
1137
+ }
1138
+ createWorkItems(options) {
1139
+ return (options.client ?? this.client).post({
1140
+ url: "/api/work-items/batch",
1141
+ ...options,
1142
+ headers: {
1143
+ "Content-Type": "application/json",
1144
+ ...options.headers
1145
+ }
1146
+ });
1147
+ }
1148
+ upsertWorkItems(options) {
1149
+ return (options.client ?? this.client).put({
1150
+ url: "/api/work-items/batch",
1151
+ ...options,
1152
+ headers: {
1153
+ "Content-Type": "application/json",
1154
+ ...options.headers
1155
+ }
1156
+ });
1157
+ }
1158
+ deleteWorkItem(options) {
1159
+ return (options.client ?? this.client).delete({ url: "/api/work-items/{workItemId}", ...options });
1160
+ }
1161
+ getWorkItem(options) {
1162
+ return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}", ...options });
1163
+ }
1164
+ }
1165
+
1166
+ class ProjectContext extends HeyApiClient {
1167
+ listProjectContextEntries(options) {
1168
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/context-entries", ...options });
1169
+ }
1170
+ createProjectContextEntry(options) {
1171
+ return (options.client ?? this.client).post({
1172
+ url: "/api/projects/{projectId}/context-entries",
1173
+ ...options,
1174
+ headers: {
1175
+ "Content-Type": "application/json",
1176
+ ...options.headers
1177
+ }
1178
+ });
1179
+ }
1180
+ deleteProjectContextEntry(options) {
1181
+ return (options.client ?? this.client).delete({ url: "/api/projects/{projectId}/context-entries/{entryId}", ...options });
1182
+ }
1183
+ }
1184
+
1185
+ class FeedbackRequests extends HeyApiClient {
1186
+ listFeedbackRequests(options) {
1187
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/step-signals/{stepSignalId}/feedback-requests", ...options });
1188
+ }
1189
+ declineFeedbackRequest(options) {
1190
+ return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/feedback-requests/{feedbackRequestId}/decline", ...options });
1191
+ }
1192
+ }
1193
+
1194
+ class StepDefinitionTemplates extends HeyApiClient {
1195
+ listStepDefinitionTemplates(options) {
1196
+ return (options?.client ?? this.client).get({ url: "/api/step-definition-templates", ...options });
1197
+ }
1198
+ getStepDefinitionTemplate(options) {
1199
+ return (options.client ?? this.client).get({ url: "/api/step-definition-templates/{stepDefinitionTemplateId}", ...options });
1200
+ }
1201
+ instantiateStepDefinitionTemplate(options) {
1202
+ return (options.client ?? this.client).post({
1203
+ url: "/api/step-definition-templates/{stepDefinitionTemplateId}/instantiate",
1204
+ ...options,
1205
+ headers: {
1206
+ "Content-Type": "application/json",
1207
+ ...options.headers
1208
+ }
1209
+ });
1210
+ }
1211
+ }
1212
+
1213
+ class BoboddyClient extends HeyApiClient {
1214
+ static __registry = new HeyApiRegistry;
1215
+ constructor(args) {
1216
+ super(args);
1217
+ BoboddyClient.__registry.set(this, args?.key);
1218
+ }
1219
+ _api;
1220
+ get api() {
1221
+ return this._api ??= new Api({ client: this.client });
1222
+ }
1223
+ _projects;
1224
+ get projects() {
1225
+ return this._projects ??= new Projects({ client: this.client });
1226
+ }
1227
+ _stepDefinitions;
1228
+ get stepDefinitions() {
1229
+ return this._stepDefinitions ??= new StepDefinitions({ client: this.client });
1230
+ }
1231
+ _stepExecutions;
1232
+ get stepExecutions() {
1233
+ return this._stepExecutions ??= new StepExecutions({ client: this.client });
1234
+ }
1235
+ _pipelineDefinitions;
1236
+ get pipelineDefinitions() {
1237
+ return this._pipelineDefinitions ??= new PipelineDefinitions({ client: this.client });
1238
+ }
1239
+ _pipelineExecutions;
1240
+ get pipelineExecutions() {
1241
+ return this._pipelineExecutions ??= new PipelineExecutions({ client: this.client });
1242
+ }
1243
+ _workItems;
1244
+ get workItems() {
1245
+ return this._workItems ??= new WorkItems({ client: this.client });
1246
+ }
1247
+ _projectContext;
1248
+ get projectContext() {
1249
+ return this._projectContext ??= new ProjectContext({ client: this.client });
1250
+ }
1251
+ _feedbackRequests;
1252
+ get feedbackRequests() {
1253
+ return this._feedbackRequests ??= new FeedbackRequests({ client: this.client });
1254
+ }
1255
+ _stepDefinitionTemplates;
1256
+ get stepDefinitionTemplates() {
1257
+ return this._stepDefinitionTemplates ??= new StepDefinitionTemplates({ client: this.client });
1258
+ }
1259
+ }
30
1260
  // src/step-execution-plane-client.ts
31
- function createStepExecutionPlaneClient(baseUrlOrApp) {
32
- return buildStepExecutionPlaneClient(createBoboddyTreaty(baseUrlOrApp));
1261
+ function createStepExecutionPlaneClient(baseUrl) {
1262
+ const client2 = createClient({ baseUrl });
1263
+ return buildStepExecutionPlaneClient(new StepExecutions({ client: client2 }));
33
1264
  }
34
- var buildStepExecutionPlaneClient = (apiClient) => {
1265
+ var buildStepExecutionPlaneClient = (stepExecutions) => {
35
1266
  return {
36
- claimStepExecutions: async (body, options) => await unwrapTreatyResponse(apiClient.api["step-executions"].claims.post(body, options)),
37
- heartbeatStepExecution: async (stepExecutionId, body, options) => await unwrapTreatyResponse(apiClient.api["step-executions"]({
38
- stepExecutionId
39
- }).heartbeat.put(body, options)),
40
- getStepExecution: async (stepExecutionId, options) => await unwrapTreatyResponse(apiClient.api["step-executions"]({
41
- stepExecutionId
42
- }).get(options)),
43
- getStepExecutionWorkerContext: async (stepExecutionId, body, options) => await unwrapTreatyResponse(apiClient.api["step-executions"]({
44
- stepExecutionId
45
- })["worker-context"].post(body, options)),
46
- completeStepExecution: async (stepExecutionId, body, options) => await unwrapTreatyResponse(apiClient.api["step-executions"]({
47
- stepExecutionId
48
- }).completions.post(body, options)),
49
- failStepExecution: async (stepExecutionId, body, options) => await unwrapTreatyResponse(apiClient.api["step-executions"]({
50
- stepExecutionId
51
- }).completions.post({
52
- ...body,
53
- status: "failed"
54
- }, options))
1267
+ claimStepExecutions: async (body, options) => {
1268
+ const result = await stepExecutions.claimStepExecutions({
1269
+ body,
1270
+ headers: options?.headers
1271
+ });
1272
+ if (result.error)
1273
+ throw new Error(JSON.stringify(result.error));
1274
+ return result.data;
1275
+ },
1276
+ heartbeatStepExecution: async (stepExecutionId, body, options) => {
1277
+ const result = await stepExecutions.heartbeatStepExecution({
1278
+ path: { stepExecutionId },
1279
+ body,
1280
+ headers: options?.headers
1281
+ });
1282
+ if (result.error)
1283
+ throw new Error(JSON.stringify(result.error));
1284
+ },
1285
+ getStepExecution: async (stepExecutionId, options) => {
1286
+ const result = await stepExecutions.getStepExecution({
1287
+ path: { stepExecutionId },
1288
+ headers: options?.headers
1289
+ });
1290
+ if (result.error)
1291
+ throw new Error(JSON.stringify(result.error));
1292
+ return result.data;
1293
+ },
1294
+ getStepExecutionWorkerContext: async (stepExecutionId, body, options) => {
1295
+ const result = await stepExecutions.getStepExecutionWorkerContext({
1296
+ path: { stepExecutionId },
1297
+ body,
1298
+ headers: options?.headers
1299
+ });
1300
+ if (result.error)
1301
+ throw new Error(JSON.stringify(result.error));
1302
+ return result.data;
1303
+ },
1304
+ completeStepExecution: async (stepExecutionId, body, options) => {
1305
+ const result = await stepExecutions.completeStepExecution({
1306
+ path: { stepExecutionId },
1307
+ body,
1308
+ headers: options?.headers
1309
+ });
1310
+ if (result.error)
1311
+ throw new Error(JSON.stringify(result.error));
1312
+ },
1313
+ failStepExecution: async (stepExecutionId, body, options) => {
1314
+ const result = await stepExecutions.completeStepExecution({
1315
+ path: { stepExecutionId },
1316
+ body: { ...body, status: "failed" },
1317
+ headers: options?.headers
1318
+ });
1319
+ if (result.error)
1320
+ throw new Error(JSON.stringify(result.error));
1321
+ }
55
1322
  };
56
1323
  };
1324
+
1325
+ // src/client.ts
1326
+ function createBoboddyClient(baseUrl) {
1327
+ const client2 = createClient({ baseUrl });
1328
+ return new BoboddyClient({ client: client2 });
1329
+ }
57
1330
  export {
58
- unwrapTreatyResponse,
59
1331
  createStepExecutionPlaneClient,
60
- createBoboddyTreaty,
61
- createBoboddyApiClient
1332
+ createBoboddyClient,
1333
+ WorkItems,
1334
+ StepExecutions,
1335
+ StepDefinitions,
1336
+ StepDefinitionTemplates,
1337
+ Projects,
1338
+ ProjectContext,
1339
+ PipelineExecutions,
1340
+ PipelineDefinitions,
1341
+ FeedbackRequests,
1342
+ BoboddyClient,
1343
+ Api
62
1344
  };