@boboddy/sdk 0.1.12-alpha → 0.1.14-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.
@@ -208,47 +208,1375 @@ function definePipeline(config) {
208
208
  }))
209
209
  };
210
210
  }
211
- // src/definitions/pipelines/pipeline-definitions-client.ts
212
- function createPipelineDefinitionsClient(baseUrl) {
213
- const base = baseUrl.replace(/\/$/, "");
214
- async function doFetch(path, method, headers, body) {
215
- const requestHeaders = { ...headers };
216
- if (body !== undefined) {
217
- requestHeaders["Content-Type"] = "application/json";
211
+ // src/generated/core/bodySerializer.gen.ts
212
+ var jsonBodySerializer = {
213
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
214
+ };
215
+ // src/generated/core/params.gen.ts
216
+ var extraPrefixesMap = {
217
+ $body_: "body",
218
+ $headers_: "headers",
219
+ $path_: "path",
220
+ $query_: "query"
221
+ };
222
+ var extraPrefixes = Object.entries(extraPrefixesMap);
223
+ // src/generated/core/serverSentEvents.gen.ts
224
+ var createSseClient = ({
225
+ onRequest,
226
+ onSseError,
227
+ onSseEvent,
228
+ responseTransformer,
229
+ responseValidator,
230
+ sseDefaultRetryDelay,
231
+ sseMaxRetryAttempts,
232
+ sseMaxRetryDelay,
233
+ sseSleepFn,
234
+ url,
235
+ ...options
236
+ }) => {
237
+ let lastEventId;
238
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
239
+ const createStream = async function* () {
240
+ let retryDelay = sseDefaultRetryDelay ?? 3000;
241
+ let attempt = 0;
242
+ const signal2 = options.signal ?? new AbortController().signal;
243
+ while (true) {
244
+ if (signal2.aborted)
245
+ break;
246
+ attempt++;
247
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
248
+ if (lastEventId !== undefined) {
249
+ headers.set("Last-Event-ID", lastEventId);
250
+ }
251
+ try {
252
+ const requestInit = {
253
+ redirect: "follow",
254
+ ...options,
255
+ body: options.serializedBody,
256
+ headers,
257
+ signal: signal2
258
+ };
259
+ let request = new Request(url, requestInit);
260
+ if (onRequest) {
261
+ request = await onRequest(url, requestInit);
262
+ }
263
+ const _fetch = options.fetch ?? globalThis.fetch;
264
+ const response = await _fetch(request);
265
+ if (!response.ok)
266
+ throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
267
+ if (!response.body)
268
+ throw new Error("No body in SSE response");
269
+ const reader = response.body.pipeThrough(new TextDecoderStream).getReader();
270
+ let buffer = "";
271
+ const abortHandler = () => {
272
+ try {
273
+ reader.cancel();
274
+ } catch {}
275
+ };
276
+ signal2.addEventListener("abort", abortHandler);
277
+ try {
278
+ while (true) {
279
+ const { done, value } = await reader.read();
280
+ if (done)
281
+ break;
282
+ buffer += value;
283
+ buffer = buffer.replace(/\r\n/g, `
284
+ `).replace(/\r/g, `
285
+ `);
286
+ const chunks = buffer.split(`
287
+
288
+ `);
289
+ buffer = chunks.pop() ?? "";
290
+ for (const chunk of chunks) {
291
+ const lines = chunk.split(`
292
+ `);
293
+ const dataLines = [];
294
+ let eventName;
295
+ for (const line of lines) {
296
+ if (line.startsWith("data:")) {
297
+ dataLines.push(line.replace(/^data:\s*/, ""));
298
+ } else if (line.startsWith("event:")) {
299
+ eventName = line.replace(/^event:\s*/, "");
300
+ } else if (line.startsWith("id:")) {
301
+ lastEventId = line.replace(/^id:\s*/, "");
302
+ } else if (line.startsWith("retry:")) {
303
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
304
+ if (!Number.isNaN(parsed)) {
305
+ retryDelay = parsed;
306
+ }
307
+ }
308
+ }
309
+ let data;
310
+ let parsedJson = false;
311
+ if (dataLines.length) {
312
+ const rawData = dataLines.join(`
313
+ `);
314
+ try {
315
+ data = JSON.parse(rawData);
316
+ parsedJson = true;
317
+ } catch {
318
+ data = rawData;
319
+ }
320
+ }
321
+ if (parsedJson) {
322
+ if (responseValidator) {
323
+ await responseValidator(data);
324
+ }
325
+ if (responseTransformer) {
326
+ data = await responseTransformer(data);
327
+ }
328
+ }
329
+ onSseEvent?.({
330
+ data,
331
+ event: eventName,
332
+ id: lastEventId,
333
+ retry: retryDelay
334
+ });
335
+ if (dataLines.length) {
336
+ yield data;
337
+ }
338
+ }
339
+ }
340
+ } finally {
341
+ signal2.removeEventListener("abort", abortHandler);
342
+ reader.releaseLock();
343
+ }
344
+ break;
345
+ } catch (error) {
346
+ onSseError?.(error);
347
+ if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
348
+ break;
349
+ }
350
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
351
+ await sleep(backoff);
352
+ }
218
353
  }
219
- const response = await fetch(`${base}${path}`, {
220
- method,
221
- headers: requestHeaders,
222
- ...body !== undefined ? { body: JSON.stringify(body) } : {}
354
+ };
355
+ const stream = createStream();
356
+ return { stream };
357
+ };
358
+
359
+ // src/generated/core/pathSerializer.gen.ts
360
+ var separatorArrayExplode = (style) => {
361
+ switch (style) {
362
+ case "label":
363
+ return ".";
364
+ case "matrix":
365
+ return ";";
366
+ case "simple":
367
+ return ",";
368
+ default:
369
+ return "&";
370
+ }
371
+ };
372
+ var separatorArrayNoExplode = (style) => {
373
+ switch (style) {
374
+ case "form":
375
+ return ",";
376
+ case "pipeDelimited":
377
+ return "|";
378
+ case "spaceDelimited":
379
+ return "%20";
380
+ default:
381
+ return ",";
382
+ }
383
+ };
384
+ var separatorObjectExplode = (style) => {
385
+ switch (style) {
386
+ case "label":
387
+ return ".";
388
+ case "matrix":
389
+ return ";";
390
+ case "simple":
391
+ return ",";
392
+ default:
393
+ return "&";
394
+ }
395
+ };
396
+ var serializeArrayParam = ({
397
+ allowReserved,
398
+ explode,
399
+ name,
400
+ style,
401
+ value
402
+ }) => {
403
+ if (!explode) {
404
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
405
+ switch (style) {
406
+ case "label":
407
+ return `.${joinedValues2}`;
408
+ case "matrix":
409
+ return `;${name}=${joinedValues2}`;
410
+ case "simple":
411
+ return joinedValues2;
412
+ default:
413
+ return `${name}=${joinedValues2}`;
414
+ }
415
+ }
416
+ const separator = separatorArrayExplode(style);
417
+ const joinedValues = value.map((v) => {
418
+ if (style === "label" || style === "simple") {
419
+ return allowReserved ? v : encodeURIComponent(v);
420
+ }
421
+ return serializePrimitiveParam({
422
+ allowReserved,
423
+ name,
424
+ value: v
425
+ });
426
+ }).join(separator);
427
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
428
+ };
429
+ var serializePrimitiveParam = ({
430
+ allowReserved,
431
+ name,
432
+ value
433
+ }) => {
434
+ if (value === undefined || value === null) {
435
+ return "";
436
+ }
437
+ if (typeof value === "object") {
438
+ throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
439
+ }
440
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
441
+ };
442
+ var serializeObjectParam = ({
443
+ allowReserved,
444
+ explode,
445
+ name,
446
+ style,
447
+ value,
448
+ valueOnly
449
+ }) => {
450
+ if (value instanceof Date) {
451
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
452
+ }
453
+ if (style !== "deepObject" && !explode) {
454
+ let values = [];
455
+ Object.entries(value).forEach(([key, v]) => {
456
+ values = [
457
+ ...values,
458
+ key,
459
+ allowReserved ? v : encodeURIComponent(v)
460
+ ];
223
461
  });
224
- if (!response.ok) {
225
- const err = await response.json().catch(() => null);
226
- throw new Error(err?.title ?? `HTTP ${String(response.status)} ${method} ${path}`);
462
+ const joinedValues2 = values.join(",");
463
+ switch (style) {
464
+ case "form":
465
+ return `${name}=${joinedValues2}`;
466
+ case "label":
467
+ return `.${joinedValues2}`;
468
+ case "matrix":
469
+ return `;${name}=${joinedValues2}`;
470
+ default:
471
+ return joinedValues2;
472
+ }
473
+ }
474
+ const separator = separatorObjectExplode(style);
475
+ const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
476
+ allowReserved,
477
+ name: style === "deepObject" ? `${name}[${key}]` : key,
478
+ value: v
479
+ })).join(separator);
480
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
481
+ };
482
+
483
+ // src/generated/core/utils.gen.ts
484
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
485
+ var defaultPathSerializer = ({ path, url: _url }) => {
486
+ let url = _url;
487
+ const matches = _url.match(PATH_PARAM_RE);
488
+ if (matches) {
489
+ for (const match of matches) {
490
+ let explode = false;
491
+ let name = match.substring(1, match.length - 1);
492
+ let style = "simple";
493
+ if (name.endsWith("*")) {
494
+ explode = true;
495
+ name = name.substring(0, name.length - 1);
496
+ }
497
+ if (name.startsWith(".")) {
498
+ name = name.substring(1);
499
+ style = "label";
500
+ } else if (name.startsWith(";")) {
501
+ name = name.substring(1);
502
+ style = "matrix";
503
+ }
504
+ const value = path[name];
505
+ if (value === undefined || value === null) {
506
+ continue;
507
+ }
508
+ if (Array.isArray(value)) {
509
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
510
+ continue;
511
+ }
512
+ if (typeof value === "object") {
513
+ url = url.replace(match, serializeObjectParam({
514
+ explode,
515
+ name,
516
+ style,
517
+ value,
518
+ valueOnly: true
519
+ }));
520
+ continue;
521
+ }
522
+ if (style === "matrix") {
523
+ url = url.replace(match, `;${serializePrimitiveParam({
524
+ name,
525
+ value
526
+ })}`);
527
+ continue;
528
+ }
529
+ const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
530
+ url = url.replace(match, replaceValue);
227
531
  }
228
- return response.json().catch(() => null);
229
532
  }
230
- return buildPipelineDefinitionsClient(base, doFetch);
533
+ return url;
534
+ };
535
+ var getUrl = ({
536
+ baseUrl,
537
+ path,
538
+ query,
539
+ querySerializer,
540
+ url: _url
541
+ }) => {
542
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
543
+ let url = (baseUrl ?? "") + pathUrl;
544
+ if (path) {
545
+ url = defaultPathSerializer({ path, url });
546
+ }
547
+ let search = query ? querySerializer(query) : "";
548
+ if (search.startsWith("?")) {
549
+ search = search.substring(1);
550
+ }
551
+ if (search) {
552
+ url += `?${search}`;
553
+ }
554
+ return url;
555
+ };
556
+ function getValidRequestBody(options) {
557
+ const hasBody = options.body !== undefined;
558
+ const isSerializedBody = hasBody && options.bodySerializer;
559
+ if (isSerializedBody) {
560
+ if ("serializedBody" in options) {
561
+ const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== "";
562
+ return hasSerializedBody ? options.serializedBody : null;
563
+ }
564
+ return options.body !== "" ? options.body : null;
565
+ }
566
+ if (hasBody) {
567
+ return options.body;
568
+ }
569
+ return;
231
570
  }
232
- var buildPipelineDefinitionsClient = (_base, doFetch) => ({
233
- listByProjectId: async (projectId, options) => {
234
- const path = `/api/linear-pipeline-definitions?projectId=${encodeURIComponent(projectId)}`;
235
- const result = await doFetch(path, "GET", options?.headers ?? {});
236
- return result ?? [];
237
- },
238
- create: async (body, options) => {
239
- const result = await doFetch("/api/linear-pipeline-definitions", "POST", options?.headers ?? {}, body);
240
- return result;
241
- },
242
- update: async (pipelineId, body, options) => {
243
- await doFetch(`/api/linear-pipeline-definitions/${pipelineId}`, "PUT", options?.headers ?? {}, body);
244
- },
245
- addStep: async (pipelineId, body, options) => {
246
- await doFetch(`/api/linear-pipeline-definitions/${pipelineId}/steps`, "POST", options?.headers ?? {}, body);
571
+
572
+ // src/generated/core/auth.gen.ts
573
+ var getAuthToken = async (auth, callback) => {
574
+ const token = typeof callback === "function" ? await callback(auth) : callback;
575
+ if (!token) {
576
+ return;
577
+ }
578
+ if (auth.scheme === "bearer") {
579
+ return `Bearer ${token}`;
580
+ }
581
+ if (auth.scheme === "basic") {
582
+ return `Basic ${btoa(token)}`;
583
+ }
584
+ return token;
585
+ };
586
+
587
+ // src/generated/client/utils.gen.ts
588
+ var createQuerySerializer = ({
589
+ parameters = {},
590
+ ...args
591
+ } = {}) => {
592
+ const querySerializer = (queryParams) => {
593
+ const search = [];
594
+ if (queryParams && typeof queryParams === "object") {
595
+ for (const name in queryParams) {
596
+ const value = queryParams[name];
597
+ if (value === undefined || value === null) {
598
+ continue;
599
+ }
600
+ const options = parameters[name] || args;
601
+ if (Array.isArray(value)) {
602
+ const serializedArray = serializeArrayParam({
603
+ allowReserved: options.allowReserved,
604
+ explode: true,
605
+ name,
606
+ style: "form",
607
+ value,
608
+ ...options.array
609
+ });
610
+ if (serializedArray)
611
+ search.push(serializedArray);
612
+ } else if (typeof value === "object") {
613
+ const serializedObject = serializeObjectParam({
614
+ allowReserved: options.allowReserved,
615
+ explode: true,
616
+ name,
617
+ style: "deepObject",
618
+ value,
619
+ ...options.object
620
+ });
621
+ if (serializedObject)
622
+ search.push(serializedObject);
623
+ } else {
624
+ const serializedPrimitive = serializePrimitiveParam({
625
+ allowReserved: options.allowReserved,
626
+ name,
627
+ value
628
+ });
629
+ if (serializedPrimitive)
630
+ search.push(serializedPrimitive);
631
+ }
632
+ }
633
+ }
634
+ return search.join("&");
635
+ };
636
+ return querySerializer;
637
+ };
638
+ var getParseAs = (contentType) => {
639
+ if (!contentType) {
640
+ return "stream";
641
+ }
642
+ const cleanContent = contentType.split(";")[0]?.trim();
643
+ if (!cleanContent) {
644
+ return;
645
+ }
646
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
647
+ return "json";
648
+ }
649
+ if (cleanContent === "multipart/form-data") {
650
+ return "formData";
651
+ }
652
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
653
+ return "blob";
654
+ }
655
+ if (cleanContent.startsWith("text/")) {
656
+ return "text";
657
+ }
658
+ return;
659
+ };
660
+ var checkForExistence = (options, name) => {
661
+ if (!name) {
662
+ return false;
663
+ }
664
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
665
+ return true;
666
+ }
667
+ return false;
668
+ };
669
+ var setAuthParams = async ({
670
+ security,
671
+ ...options
672
+ }) => {
673
+ for (const auth of security) {
674
+ if (checkForExistence(options, auth.name)) {
675
+ continue;
676
+ }
677
+ const token = await getAuthToken(auth, options.auth);
678
+ if (!token) {
679
+ continue;
680
+ }
681
+ const name = auth.name ?? "Authorization";
682
+ switch (auth.in) {
683
+ case "query":
684
+ if (!options.query) {
685
+ options.query = {};
686
+ }
687
+ options.query[name] = token;
688
+ break;
689
+ case "cookie":
690
+ options.headers.append("Cookie", `${name}=${token}`);
691
+ break;
692
+ case "header":
693
+ default:
694
+ options.headers.set(name, token);
695
+ break;
696
+ }
697
+ }
698
+ };
699
+ var buildUrl = (options) => getUrl({
700
+ baseUrl: options.baseUrl,
701
+ path: options.path,
702
+ query: options.query,
703
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
704
+ url: options.url
705
+ });
706
+ var mergeConfigs = (a, b) => {
707
+ const config = { ...a, ...b };
708
+ if (config.baseUrl?.endsWith("/")) {
709
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
710
+ }
711
+ config.headers = mergeHeaders(a.headers, b.headers);
712
+ return config;
713
+ };
714
+ var headersEntries = (headers) => {
715
+ const entries = [];
716
+ headers.forEach((value, key) => {
717
+ entries.push([key, value]);
718
+ });
719
+ return entries;
720
+ };
721
+ var mergeHeaders = (...headers) => {
722
+ const mergedHeaders = new Headers;
723
+ for (const header of headers) {
724
+ if (!header) {
725
+ continue;
726
+ }
727
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
728
+ for (const [key, value] of iterator) {
729
+ if (value === null) {
730
+ mergedHeaders.delete(key);
731
+ } else if (Array.isArray(value)) {
732
+ for (const v of value) {
733
+ mergedHeaders.append(key, v);
734
+ }
735
+ } else if (value !== undefined) {
736
+ mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
737
+ }
738
+ }
739
+ }
740
+ return mergedHeaders;
741
+ };
742
+
743
+ class Interceptors {
744
+ fns = [];
745
+ clear() {
746
+ this.fns = [];
747
+ }
748
+ eject(id) {
749
+ const index = this.getInterceptorIndex(id);
750
+ if (this.fns[index]) {
751
+ this.fns[index] = null;
752
+ }
753
+ }
754
+ exists(id) {
755
+ const index = this.getInterceptorIndex(id);
756
+ return Boolean(this.fns[index]);
757
+ }
758
+ getInterceptorIndex(id) {
759
+ if (typeof id === "number") {
760
+ return this.fns[id] ? id : -1;
761
+ }
762
+ return this.fns.indexOf(id);
763
+ }
764
+ update(id, fn) {
765
+ const index = this.getInterceptorIndex(id);
766
+ if (this.fns[index]) {
767
+ this.fns[index] = fn;
768
+ return id;
769
+ }
770
+ return false;
771
+ }
772
+ use(fn) {
773
+ this.fns.push(fn);
774
+ return this.fns.length - 1;
775
+ }
776
+ }
777
+ var createInterceptors = () => ({
778
+ error: new Interceptors,
779
+ request: new Interceptors,
780
+ response: new Interceptors
781
+ });
782
+ var defaultQuerySerializer = createQuerySerializer({
783
+ allowReserved: false,
784
+ array: {
785
+ explode: true,
786
+ style: "form"
247
787
  },
248
- removeStep: async (pipelineId, stepId, options) => {
249
- await doFetch(`/api/linear-pipeline-definitions/${pipelineId}/steps/${stepId}`, "DELETE", options?.headers ?? {});
788
+ object: {
789
+ explode: true,
790
+ style: "deepObject"
250
791
  }
251
792
  });
793
+ var defaultHeaders = {
794
+ "Content-Type": "application/json"
795
+ };
796
+ var createConfig = (override = {}) => ({
797
+ ...jsonBodySerializer,
798
+ headers: defaultHeaders,
799
+ parseAs: "auto",
800
+ querySerializer: defaultQuerySerializer,
801
+ ...override
802
+ });
803
+
804
+ // src/generated/client/client.gen.ts
805
+ var createClient = (config = {}) => {
806
+ let _config = mergeConfigs(createConfig(), config);
807
+ const getConfig = () => ({ ..._config });
808
+ const setConfig = (config2) => {
809
+ _config = mergeConfigs(_config, config2);
810
+ return getConfig();
811
+ };
812
+ const interceptors = createInterceptors();
813
+ const beforeRequest = async (options) => {
814
+ const opts = {
815
+ ..._config,
816
+ ...options,
817
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
818
+ headers: mergeHeaders(_config.headers, options.headers),
819
+ serializedBody: undefined
820
+ };
821
+ if (opts.security) {
822
+ await setAuthParams({
823
+ ...opts,
824
+ security: opts.security
825
+ });
826
+ }
827
+ if (opts.requestValidator) {
828
+ await opts.requestValidator(opts);
829
+ }
830
+ if (opts.body !== undefined && opts.bodySerializer) {
831
+ opts.serializedBody = opts.bodySerializer(opts.body);
832
+ }
833
+ if (opts.body === undefined || opts.serializedBody === "") {
834
+ opts.headers.delete("Content-Type");
835
+ }
836
+ const url = buildUrl(opts);
837
+ return { opts, url };
838
+ };
839
+ const request = async (options) => {
840
+ const { opts, url } = await beforeRequest(options);
841
+ const requestInit = {
842
+ redirect: "follow",
843
+ ...opts,
844
+ body: getValidRequestBody(opts)
845
+ };
846
+ let request2 = new Request(url, requestInit);
847
+ for (const fn of interceptors.request.fns) {
848
+ if (fn) {
849
+ request2 = await fn(request2, opts);
850
+ }
851
+ }
852
+ const _fetch = opts.fetch;
853
+ let response;
854
+ try {
855
+ response = await _fetch(request2);
856
+ } catch (error2) {
857
+ let finalError2 = error2;
858
+ for (const fn of interceptors.error.fns) {
859
+ if (fn) {
860
+ finalError2 = await fn(error2, undefined, request2, opts);
861
+ }
862
+ }
863
+ finalError2 = finalError2 || {};
864
+ if (opts.throwOnError) {
865
+ throw finalError2;
866
+ }
867
+ return opts.responseStyle === "data" ? undefined : {
868
+ error: finalError2,
869
+ request: request2,
870
+ response: undefined
871
+ };
872
+ }
873
+ for (const fn of interceptors.response.fns) {
874
+ if (fn) {
875
+ response = await fn(response, request2, opts);
876
+ }
877
+ }
878
+ const result = {
879
+ request: request2,
880
+ response
881
+ };
882
+ if (response.ok) {
883
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
884
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
885
+ let emptyData;
886
+ switch (parseAs) {
887
+ case "arrayBuffer":
888
+ case "blob":
889
+ case "text":
890
+ emptyData = await response[parseAs]();
891
+ break;
892
+ case "formData":
893
+ emptyData = new FormData;
894
+ break;
895
+ case "stream":
896
+ emptyData = response.body;
897
+ break;
898
+ case "json":
899
+ default:
900
+ emptyData = {};
901
+ break;
902
+ }
903
+ return opts.responseStyle === "data" ? emptyData : {
904
+ data: emptyData,
905
+ ...result
906
+ };
907
+ }
908
+ let data;
909
+ switch (parseAs) {
910
+ case "arrayBuffer":
911
+ case "blob":
912
+ case "formData":
913
+ case "text":
914
+ data = await response[parseAs]();
915
+ break;
916
+ case "json": {
917
+ const text = await response.text();
918
+ data = text ? JSON.parse(text) : {};
919
+ break;
920
+ }
921
+ case "stream":
922
+ return opts.responseStyle === "data" ? response.body : {
923
+ data: response.body,
924
+ ...result
925
+ };
926
+ }
927
+ if (parseAs === "json") {
928
+ if (opts.responseValidator) {
929
+ await opts.responseValidator(data);
930
+ }
931
+ if (opts.responseTransformer) {
932
+ data = await opts.responseTransformer(data);
933
+ }
934
+ }
935
+ return opts.responseStyle === "data" ? data : {
936
+ data,
937
+ ...result
938
+ };
939
+ }
940
+ const textError = await response.text();
941
+ let jsonError;
942
+ try {
943
+ jsonError = JSON.parse(textError);
944
+ } catch {}
945
+ const error = jsonError ?? textError;
946
+ let finalError = error;
947
+ for (const fn of interceptors.error.fns) {
948
+ if (fn) {
949
+ finalError = await fn(error, response, request2, opts);
950
+ }
951
+ }
952
+ finalError = finalError || {};
953
+ if (opts.throwOnError) {
954
+ throw finalError;
955
+ }
956
+ return opts.responseStyle === "data" ? undefined : {
957
+ error: finalError,
958
+ ...result
959
+ };
960
+ };
961
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
962
+ const makeSseFn = (method) => async (options) => {
963
+ const { opts, url } = await beforeRequest(options);
964
+ return createSseClient({
965
+ ...opts,
966
+ body: opts.body,
967
+ headers: opts.headers,
968
+ method,
969
+ onRequest: async (url2, init) => {
970
+ let request2 = new Request(url2, init);
971
+ for (const fn of interceptors.request.fns) {
972
+ if (fn) {
973
+ request2 = await fn(request2, opts);
974
+ }
975
+ }
976
+ return request2;
977
+ },
978
+ serializedBody: getValidRequestBody(opts),
979
+ url
980
+ });
981
+ };
982
+ return {
983
+ buildUrl,
984
+ connect: makeMethodFn("CONNECT"),
985
+ delete: makeMethodFn("DELETE"),
986
+ get: makeMethodFn("GET"),
987
+ getConfig,
988
+ head: makeMethodFn("HEAD"),
989
+ interceptors,
990
+ options: makeMethodFn("OPTIONS"),
991
+ patch: makeMethodFn("PATCH"),
992
+ post: makeMethodFn("POST"),
993
+ put: makeMethodFn("PUT"),
994
+ request,
995
+ setConfig,
996
+ sse: {
997
+ connect: makeSseFn("CONNECT"),
998
+ delete: makeSseFn("DELETE"),
999
+ get: makeSseFn("GET"),
1000
+ head: makeSseFn("HEAD"),
1001
+ options: makeSseFn("OPTIONS"),
1002
+ patch: makeSseFn("PATCH"),
1003
+ post: makeSseFn("POST"),
1004
+ put: makeSseFn("PUT"),
1005
+ trace: makeSseFn("TRACE")
1006
+ },
1007
+ trace: makeMethodFn("TRACE")
1008
+ };
1009
+ };
1010
+ // src/generated/client.gen.ts
1011
+ var client = createClient(createConfig());
1012
+
1013
+ // src/generated/sdk.gen.ts
1014
+ class HeyApiClient {
1015
+ client;
1016
+ constructor(args) {
1017
+ this.client = args?.client ?? client;
1018
+ }
1019
+ }
1020
+
1021
+ class HeyApiRegistry {
1022
+ defaultKey = "default";
1023
+ instances = new Map;
1024
+ get(key) {
1025
+ const instance = this.instances.get(key ?? this.defaultKey);
1026
+ if (!instance) {
1027
+ throw new Error(`No SDK client found. Create one with "new BoboddyClient()" to fix this error.`);
1028
+ }
1029
+ return instance;
1030
+ }
1031
+ set(value, key) {
1032
+ this.instances.set(key ?? this.defaultKey, value);
1033
+ }
1034
+ }
1035
+
1036
+ class Api extends HeyApiClient {
1037
+ "allApiAuth*"(options) {
1038
+ return (options?.client ?? this.client).delete({ url: "/api/auth/*", ...options });
1039
+ }
1040
+ "allApiAuth*2"(options) {
1041
+ return (options?.client ?? this.client).get({ url: "/api/auth/*", ...options });
1042
+ }
1043
+ "allApiAuth*3"(options) {
1044
+ return (options?.client ?? this.client).head({ url: "/api/auth/*", ...options });
1045
+ }
1046
+ "allApiAuth*4"(options) {
1047
+ return (options?.client ?? this.client).options({ url: "/api/auth/*", ...options });
1048
+ }
1049
+ "allApiAuth*5"(options) {
1050
+ return (options?.client ?? this.client).patch({ url: "/api/auth/*", ...options });
1051
+ }
1052
+ "allApiAuth*6"(options) {
1053
+ return (options?.client ?? this.client).post({ url: "/api/auth/*", ...options });
1054
+ }
1055
+ "allApiAuth*7"(options) {
1056
+ return (options?.client ?? this.client).put({ url: "/api/auth/*", ...options });
1057
+ }
1058
+ "allApiAuth*8"(options) {
1059
+ return (options?.client ?? this.client).trace({ url: "/api/auth/*", ...options });
1060
+ }
1061
+ getApiIntegrationsGithubInstall(options) {
1062
+ return (options?.client ?? this.client).get({ url: "/api/integrations/github/install", ...options });
1063
+ }
1064
+ getApiIntegrationsGithubCallback(options) {
1065
+ return (options?.client ?? this.client).get({ url: "/api/integrations/github/callback", ...options });
1066
+ }
1067
+ postApiIntegrationsGithubWebhook(options) {
1068
+ return (options?.client ?? this.client).post({ url: "/api/integrations/github/webhook", ...options });
1069
+ }
1070
+ }
1071
+
1072
+ class Projects extends HeyApiClient {
1073
+ listProjects(options) {
1074
+ return (options?.client ?? this.client).get({ url: "/api/projects", ...options });
1075
+ }
1076
+ createProject(options) {
1077
+ return (options.client ?? this.client).post({
1078
+ url: "/api/projects",
1079
+ ...options,
1080
+ headers: {
1081
+ "Content-Type": "application/json",
1082
+ ...options.headers
1083
+ }
1084
+ });
1085
+ }
1086
+ listProjectWorkItems(options) {
1087
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/work-items", ...options });
1088
+ }
1089
+ getProject(options) {
1090
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}", ...options });
1091
+ }
1092
+ updateProjectMemberPermissions(options) {
1093
+ return (options.client ?? this.client).put({ url: "/api/projects/{projectId}/members/{userId}/permissions", ...options });
1094
+ }
1095
+ }
1096
+
1097
+ class StepDefinitions extends HeyApiClient {
1098
+ listStepDefinitions(options) {
1099
+ return (options.client ?? this.client).get({ url: "/api/step-definitions", ...options });
1100
+ }
1101
+ createStepDefinition(options) {
1102
+ return (options.client ?? this.client).post({
1103
+ url: "/api/step-definitions",
1104
+ ...options,
1105
+ headers: {
1106
+ "Content-Type": "application/json",
1107
+ ...options.headers
1108
+ }
1109
+ });
1110
+ }
1111
+ upsertStepDefinition(options) {
1112
+ return (options.client ?? this.client).put({
1113
+ url: "/api/step-definitions",
1114
+ ...options,
1115
+ headers: {
1116
+ "Content-Type": "application/json",
1117
+ ...options.headers
1118
+ }
1119
+ });
1120
+ }
1121
+ getStepDefinition(options) {
1122
+ return (options.client ?? this.client).get({ url: "/api/step-definitions/{stepDefinitionId}", ...options });
1123
+ }
1124
+ archiveStepDefinition(options) {
1125
+ return (options.client ?? this.client).put({ url: "/api/step-definitions/{stepDefinitionId}/archive", ...options });
1126
+ }
1127
+ }
1128
+
1129
+ class StepExecutions extends HeyApiClient {
1130
+ claimStepExecutions(options) {
1131
+ return (options.client ?? this.client).post({
1132
+ url: "/api/step-executions/claims",
1133
+ ...options,
1134
+ headers: {
1135
+ "Content-Type": "application/json",
1136
+ ...options.headers
1137
+ }
1138
+ });
1139
+ }
1140
+ listStepExecutions(options) {
1141
+ return (options.client ?? this.client).get({ url: "/api/step-executions", ...options });
1142
+ }
1143
+ createStepExecution(options) {
1144
+ return (options.client ?? this.client).post({
1145
+ url: "/api/step-executions",
1146
+ ...options,
1147
+ headers: {
1148
+ "Content-Type": "application/json",
1149
+ ...options.headers
1150
+ }
1151
+ });
1152
+ }
1153
+ heartbeatStepExecution(options) {
1154
+ return (options.client ?? this.client).put({
1155
+ url: "/api/step-executions/{stepExecutionId}/heartbeat",
1156
+ ...options,
1157
+ headers: {
1158
+ "Content-Type": "application/json",
1159
+ ...options.headers
1160
+ }
1161
+ });
1162
+ }
1163
+ getStepExecutionWorkerContext(options) {
1164
+ return (options.client ?? this.client).post({
1165
+ url: "/api/step-executions/{stepExecutionId}/worker-context",
1166
+ ...options,
1167
+ headers: {
1168
+ "Content-Type": "application/json",
1169
+ ...options.headers
1170
+ }
1171
+ });
1172
+ }
1173
+ completeStepExecution(options) {
1174
+ return (options.client ?? this.client).post({
1175
+ url: "/api/step-executions/{stepExecutionId}/completions",
1176
+ ...options,
1177
+ headers: {
1178
+ "Content-Type": "application/json",
1179
+ ...options.headers
1180
+ }
1181
+ });
1182
+ }
1183
+ markStepExecutionRunning(options) {
1184
+ return (options.client ?? this.client).put({ url: "/api/step-executions/{stepExecutionId}/running", ...options });
1185
+ }
1186
+ createStepExecutionResult(options) {
1187
+ return (options.client ?? this.client).post({
1188
+ url: "/api/step-execution-results",
1189
+ ...options,
1190
+ headers: {
1191
+ "Content-Type": "application/json",
1192
+ ...options.headers
1193
+ }
1194
+ });
1195
+ }
1196
+ extractStepExecutionSignals(options) {
1197
+ return (options.client ?? this.client).post({ url: "/api/step-execution-results/{stepExecutionResultId}/signals/extract", ...options });
1198
+ }
1199
+ getStepExecution(options) {
1200
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
1201
+ }
1202
+ }
1203
+
1204
+ class PipelineDefinitions extends HeyApiClient {
1205
+ listPipelineDefinitions(options) {
1206
+ return (options?.client ?? this.client).get({ url: "/api/linear-pipeline-definitions", ...options });
1207
+ }
1208
+ createPipelineDefinition(options) {
1209
+ return (options.client ?? this.client).post({
1210
+ url: "/api/linear-pipeline-definitions",
1211
+ ...options,
1212
+ headers: {
1213
+ "Content-Type": "application/json",
1214
+ ...options.headers
1215
+ }
1216
+ });
1217
+ }
1218
+ upsertPipelineDefinition(options) {
1219
+ return (options.client ?? this.client).put({
1220
+ url: "/api/linear-pipeline-definitions",
1221
+ ...options,
1222
+ headers: {
1223
+ "Content-Type": "application/json",
1224
+ ...options.headers
1225
+ }
1226
+ });
1227
+ }
1228
+ getPipelineDefinition(options) {
1229
+ return (options.client ?? this.client).get({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}", ...options });
1230
+ }
1231
+ archivePipelineDefinition(options) {
1232
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/archive", ...options });
1233
+ }
1234
+ unarchivePipelineDefinition(options) {
1235
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/unarchive", ...options });
1236
+ }
1237
+ addPipelineStep(options) {
1238
+ return (options.client ?? this.client).post({
1239
+ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps",
1240
+ ...options,
1241
+ headers: {
1242
+ "Content-Type": "application/json",
1243
+ ...options.headers
1244
+ }
1245
+ });
1246
+ }
1247
+ removePipelineStep(options) {
1248
+ return (options.client ?? this.client).delete({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}", ...options });
1249
+ }
1250
+ updatePipelineStep(options) {
1251
+ return (options.client ?? this.client).put({
1252
+ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}",
1253
+ ...options,
1254
+ headers: {
1255
+ "Content-Type": "application/json",
1256
+ ...options.headers
1257
+ }
1258
+ });
1259
+ }
1260
+ setPipelineStepAdvancementPolicy(options) {
1261
+ return (options.client ?? this.client).put({
1262
+ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}/advancement-policy",
1263
+ ...options,
1264
+ headers: {
1265
+ "Content-Type": "application/json",
1266
+ ...options.headers
1267
+ }
1268
+ });
1269
+ }
1270
+ }
1271
+
1272
+ class PipelineExecutions extends HeyApiClient {
1273
+ listPipelineExecutions(options) {
1274
+ return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions", ...options });
1275
+ }
1276
+ createPipelineExecution(options) {
1277
+ return (options.client ?? this.client).post({
1278
+ url: "/api/linear-pipeline-executions",
1279
+ ...options,
1280
+ headers: {
1281
+ "Content-Type": "application/json",
1282
+ ...options.headers
1283
+ }
1284
+ });
1285
+ }
1286
+ startPipelineExecution(options) {
1287
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/start", ...options });
1288
+ }
1289
+ queueFirstPipelineStepRun(options) {
1290
+ return (options.client ?? this.client).post({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/first", ...options });
1291
+ }
1292
+ markPipelineStepRunRunning(options) {
1293
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/running", ...options });
1294
+ }
1295
+ applyPipelineStepResult(options) {
1296
+ return (options.client ?? this.client).post({
1297
+ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/results",
1298
+ ...options,
1299
+ headers: {
1300
+ "Content-Type": "application/json",
1301
+ ...options.headers
1302
+ }
1303
+ });
1304
+ }
1305
+ acceptPipelineStepRun(options) {
1306
+ return (options.client ?? this.client).post({
1307
+ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/accept",
1308
+ ...options,
1309
+ headers: {
1310
+ "Content-Type": "application/json",
1311
+ ...options.headers
1312
+ }
1313
+ });
1314
+ }
1315
+ rerunPipelineExecution(options) {
1316
+ return (options.client ?? this.client).post({
1317
+ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/rerun",
1318
+ ...options,
1319
+ headers: {
1320
+ "Content-Type": "application/json",
1321
+ ...options.headers
1322
+ }
1323
+ });
1324
+ }
1325
+ cancelPipelineExecution(options) {
1326
+ return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/cancel", ...options });
1327
+ }
1328
+ getPipelineExecution(options) {
1329
+ return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}", ...options });
1330
+ }
1331
+ listPipelineExecutionsByDefinition(options) {
1332
+ return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/by-definition/{linearPipelineDefinitionId}", ...options });
1333
+ }
1334
+ }
1335
+
1336
+ class WorkItems extends HeyApiClient {
1337
+ createWorkItem(options) {
1338
+ return (options.client ?? this.client).post({
1339
+ url: "/api/work-items",
1340
+ ...options,
1341
+ headers: {
1342
+ "Content-Type": "application/json",
1343
+ ...options.headers
1344
+ }
1345
+ });
1346
+ }
1347
+ upsertWorkItem(options) {
1348
+ return (options.client ?? this.client).put({
1349
+ url: "/api/work-items",
1350
+ ...options,
1351
+ headers: {
1352
+ "Content-Type": "application/json",
1353
+ ...options.headers
1354
+ }
1355
+ });
1356
+ }
1357
+ deleteWorkItems(options) {
1358
+ return (options.client ?? this.client).delete({
1359
+ url: "/api/work-items/batch",
1360
+ ...options,
1361
+ headers: {
1362
+ "Content-Type": "application/json",
1363
+ ...options.headers
1364
+ }
1365
+ });
1366
+ }
1367
+ getWorkItems(options) {
1368
+ return (options.client ?? this.client).get({ url: "/api/work-items/batch", ...options });
1369
+ }
1370
+ createWorkItems(options) {
1371
+ return (options.client ?? this.client).post({
1372
+ url: "/api/work-items/batch",
1373
+ ...options,
1374
+ headers: {
1375
+ "Content-Type": "application/json",
1376
+ ...options.headers
1377
+ }
1378
+ });
1379
+ }
1380
+ upsertWorkItems(options) {
1381
+ return (options.client ?? this.client).put({
1382
+ url: "/api/work-items/batch",
1383
+ ...options,
1384
+ headers: {
1385
+ "Content-Type": "application/json",
1386
+ ...options.headers
1387
+ }
1388
+ });
1389
+ }
1390
+ deleteWorkItem(options) {
1391
+ return (options.client ?? this.client).delete({ url: "/api/work-items/{workItemId}", ...options });
1392
+ }
1393
+ getWorkItem(options) {
1394
+ return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}", ...options });
1395
+ }
1396
+ }
1397
+
1398
+ class ProjectContext extends HeyApiClient {
1399
+ listProjectContextEntries(options) {
1400
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/context-entries", ...options });
1401
+ }
1402
+ createProjectContextEntry(options) {
1403
+ return (options.client ?? this.client).post({
1404
+ url: "/api/projects/{projectId}/context-entries",
1405
+ ...options,
1406
+ headers: {
1407
+ "Content-Type": "application/json",
1408
+ ...options.headers
1409
+ }
1410
+ });
1411
+ }
1412
+ deleteProjectContextEntry(options) {
1413
+ return (options.client ?? this.client).delete({ url: "/api/projects/{projectId}/context-entries/{entryId}", ...options });
1414
+ }
1415
+ }
1416
+
1417
+ class FeedbackRequests extends HeyApiClient {
1418
+ listFeedbackRequests(options) {
1419
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/step-signals/{stepSignalId}/feedback-requests", ...options });
1420
+ }
1421
+ declineFeedbackRequest(options) {
1422
+ return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/feedback-requests/{feedbackRequestId}/decline", ...options });
1423
+ }
1424
+ }
1425
+
1426
+ class StepDefinitionTemplates extends HeyApiClient {
1427
+ listStepDefinitionTemplates(options) {
1428
+ return (options?.client ?? this.client).get({ url: "/api/step-definition-templates", ...options });
1429
+ }
1430
+ getStepDefinitionTemplate(options) {
1431
+ return (options.client ?? this.client).get({ url: "/api/step-definition-templates/{stepDefinitionTemplateId}", ...options });
1432
+ }
1433
+ instantiateStepDefinitionTemplate(options) {
1434
+ return (options.client ?? this.client).post({
1435
+ url: "/api/step-definition-templates/{stepDefinitionTemplateId}/instantiate",
1436
+ ...options,
1437
+ headers: {
1438
+ "Content-Type": "application/json",
1439
+ ...options.headers
1440
+ }
1441
+ });
1442
+ }
1443
+ }
1444
+
1445
+ class ProjectIntegrations extends HeyApiClient {
1446
+ listProjectIntegrations(options) {
1447
+ return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/integrations", ...options });
1448
+ }
1449
+ createProjectIntegration(options) {
1450
+ return (options.client ?? this.client).post({
1451
+ url: "/api/projects/{projectId}/integrations",
1452
+ ...options,
1453
+ headers: {
1454
+ "Content-Type": "application/json",
1455
+ ...options.headers
1456
+ }
1457
+ });
1458
+ }
1459
+ syncProjectIntegration(options) {
1460
+ return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/integrations/{integrationId}/sync", ...options });
1461
+ }
1462
+ deleteProjectIntegration(options) {
1463
+ return (options.client ?? this.client).delete({ url: "/api/projects/{projectId}/integrations/{integrationId}", ...options });
1464
+ }
1465
+ }
1466
+
1467
+ class BoboddyClient extends HeyApiClient {
1468
+ static __registry = new HeyApiRegistry;
1469
+ constructor(args) {
1470
+ super(args);
1471
+ BoboddyClient.__registry.set(this, args?.key);
1472
+ }
1473
+ _api;
1474
+ get api() {
1475
+ return this._api ??= new Api({ client: this.client });
1476
+ }
1477
+ _projects;
1478
+ get projects() {
1479
+ return this._projects ??= new Projects({ client: this.client });
1480
+ }
1481
+ _stepDefinitions;
1482
+ get stepDefinitions() {
1483
+ return this._stepDefinitions ??= new StepDefinitions({ client: this.client });
1484
+ }
1485
+ _stepExecutions;
1486
+ get stepExecutions() {
1487
+ return this._stepExecutions ??= new StepExecutions({ client: this.client });
1488
+ }
1489
+ _pipelineDefinitions;
1490
+ get pipelineDefinitions() {
1491
+ return this._pipelineDefinitions ??= new PipelineDefinitions({ client: this.client });
1492
+ }
1493
+ _pipelineExecutions;
1494
+ get pipelineExecutions() {
1495
+ return this._pipelineExecutions ??= new PipelineExecutions({ client: this.client });
1496
+ }
1497
+ _workItems;
1498
+ get workItems() {
1499
+ return this._workItems ??= new WorkItems({ client: this.client });
1500
+ }
1501
+ _projectContext;
1502
+ get projectContext() {
1503
+ return this._projectContext ??= new ProjectContext({ client: this.client });
1504
+ }
1505
+ _feedbackRequests;
1506
+ get feedbackRequests() {
1507
+ return this._feedbackRequests ??= new FeedbackRequests({ client: this.client });
1508
+ }
1509
+ _stepDefinitionTemplates;
1510
+ get stepDefinitionTemplates() {
1511
+ return this._stepDefinitionTemplates ??= new StepDefinitionTemplates({ client: this.client });
1512
+ }
1513
+ _projectIntegrations;
1514
+ get projectIntegrations() {
1515
+ return this._projectIntegrations ??= new ProjectIntegrations({ client: this.client });
1516
+ }
1517
+ }
1518
+
1519
+ // src/definitions/pipelines/pipeline-definitions-client.ts
1520
+ function createPipelineDefinitionsClient(baseUrl) {
1521
+ const client2 = createClient({ baseUrl });
1522
+ return buildPipelineDefinitionsClient(new PipelineDefinitions({ client: client2 }));
1523
+ }
1524
+ var buildPipelineDefinitionsClient = (pipelineDefinitions) => {
1525
+ return {
1526
+ listByProjectId: async (projectId, options) => {
1527
+ const result = await pipelineDefinitions.listPipelineDefinitions({
1528
+ query: { projectId },
1529
+ headers: options?.headers
1530
+ });
1531
+ if (result.error)
1532
+ throw new Error(JSON.stringify(result.error));
1533
+ return result.data ?? [];
1534
+ },
1535
+ upsertFromSpec: async (projectId, spec, stepDefs, options) => {
1536
+ const stepDefMap = new Map;
1537
+ for (const s of stepDefs) {
1538
+ const existing = stepDefMap.get(s.key);
1539
+ if (!existing || s.version > existing.version) {
1540
+ stepDefMap.set(s.key, s);
1541
+ }
1542
+ }
1543
+ const stepDefinitions = spec.steps.map((step) => {
1544
+ const stepDef = stepDefMap.get(step.stepKey);
1545
+ if (!stepDef) {
1546
+ throw new Error(`Step "${step.stepKey}" referenced in pipeline "${spec.key}" was not found on the server. ` + `Run \`boboddy steps push\` first to push your step definitions.`);
1547
+ }
1548
+ return {
1549
+ stepDefinitionId: stepDef.id,
1550
+ stepDefinitionVersion: stepDef.version,
1551
+ key: step.stepKey,
1552
+ name: step.stepName,
1553
+ description: step.stepDescription,
1554
+ position: step.position,
1555
+ inputBindingsJson: step.inputBindingsJson,
1556
+ timeoutSeconds: step.timeoutSeconds,
1557
+ retryPolicyJson: null,
1558
+ advancementPolicyDefinition: step.advancementPolicyDefinition,
1559
+ computedSignalDefinitions: step.computedSignalDefinitions
1560
+ };
1561
+ });
1562
+ const body = {
1563
+ projectId,
1564
+ key: spec.key,
1565
+ name: spec.name,
1566
+ description: spec.description,
1567
+ status: spec.status,
1568
+ stepDefinitions
1569
+ };
1570
+ const result = await pipelineDefinitions.upsertPipelineDefinition({
1571
+ body,
1572
+ headers: options?.headers
1573
+ });
1574
+ if (result.error)
1575
+ throw new Error(JSON.stringify(result.error));
1576
+ return result.data;
1577
+ }
1578
+ };
1579
+ };
252
1580
  export {
253
1581
  stepOutput,
254
1582
  fromSignal,