@boboddy/sdk 0.0.16-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.
@@ -1,1372 +0,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) {
240
- return "";
241
- }
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)}`;
246
- };
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
- ];
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
- }
502
- }
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]);
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
- }
581
- }
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"
596
- }
597
- });
598
- var defaultHeaders = {
599
- "Content-Type": "application/json"
600
- };
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 RuntimeSessions extends HeyApiClient {
894
- listRuntimeSessions(options) {
895
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/runtime-sessions", ...options });
896
- }
897
- createRuntimeSession(options) {
898
- return (options.client ?? this.client).post({
899
- url: "/api/projects/{projectId}/runtime-sessions",
900
- ...options,
901
- headers: {
902
- "Content-Type": "application/json",
903
- ...options.headers
904
- }
905
- });
906
- }
907
- getRuntimeSession(options) {
908
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/runtime-sessions/{runtimeSessionId}", ...options });
909
- }
910
- stopRuntimeSession(options) {
911
- return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/runtime-sessions/{runtimeSessionId}/stop", ...options });
912
- }
913
- }
914
-
915
- class RuntimeServices extends HeyApiClient {
916
- createRuntimeService(options) {
917
- return (options.client ?? this.client).post({
918
- url: "/api/projects/{projectId}/runtime-sessions/{runtimeSessionId}/services",
919
- ...options,
920
- headers: {
921
- "Content-Type": "application/json",
922
- ...options.headers
923
- }
924
- });
925
- }
926
- getRuntimeService(options) {
927
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/runtime-sessions/{runtimeSessionId}/services/{runtimeServiceId}", ...options });
928
- }
929
- startRuntimeService(options) {
930
- return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/runtime-sessions/{runtimeSessionId}/services/{runtimeServiceId}/start", ...options });
931
- }
932
- stopRuntimeService(options) {
933
- return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/runtime-sessions/{runtimeSessionId}/services/{runtimeServiceId}/stop", ...options });
934
- }
935
- }
936
-
937
- class RuntimeCommands extends HeyApiClient {
938
- createRuntimeCommand(options) {
939
- return (options.client ?? this.client).post({
940
- url: "/api/projects/{projectId}/runtime-sessions/{runtimeSessionId}/commands",
941
- ...options,
942
- headers: {
943
- "Content-Type": "application/json",
944
- ...options.headers
945
- }
946
- });
947
- }
948
- runRuntimeCommand(options) {
949
- return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/runtime-sessions/{runtimeSessionId}/commands/{runtimeCommandId}/run", ...options });
950
- }
951
- }
952
-
953
- class StepDefinitions extends HeyApiClient {
954
- listStepDefinitions(options) {
955
- return (options.client ?? this.client).get({ url: "/api/step-definitions", ...options });
956
- }
957
- createStepDefinition(options) {
958
- return (options.client ?? this.client).post({
959
- url: "/api/step-definitions",
960
- ...options,
961
- headers: {
962
- "Content-Type": "application/json",
963
- ...options.headers
964
- }
965
- });
966
- }
967
- getStepDefinition(options) {
968
- return (options.client ?? this.client).get({ url: "/api/step-definitions/{stepDefinitionId}", ...options });
969
- }
970
- updateStepDefinition(options) {
971
- return (options.client ?? this.client).put({
972
- url: "/api/step-definitions/{stepDefinitionId}",
973
- ...options,
974
- headers: {
975
- "Content-Type": "application/json",
976
- ...options.headers
977
- }
978
- });
979
- }
980
- archiveStepDefinition(options) {
981
- return (options.client ?? this.client).put({ url: "/api/step-definitions/{stepDefinitionId}/archive", ...options });
982
- }
983
- }
984
-
985
- class StepExecutions extends HeyApiClient {
986
- claimStepExecutions(options) {
987
- return (options.client ?? this.client).post({
988
- url: "/api/step-executions/claims",
989
- ...options,
990
- headers: {
991
- "Content-Type": "application/json",
992
- ...options.headers
993
- }
994
- });
995
- }
996
- listStepExecutions(options) {
997
- return (options.client ?? this.client).get({ url: "/api/step-executions", ...options });
998
- }
999
- createStepExecution(options) {
1000
- return (options.client ?? this.client).post({
1001
- url: "/api/step-executions",
1002
- ...options,
1003
- headers: {
1004
- "Content-Type": "application/json",
1005
- ...options.headers
1006
- }
1007
- });
1008
- }
1009
- heartbeatStepExecution(options) {
1010
- return (options.client ?? this.client).put({
1011
- url: "/api/step-executions/{stepExecutionId}/heartbeat",
1012
- ...options,
1013
- headers: {
1014
- "Content-Type": "application/json",
1015
- ...options.headers
1016
- }
1017
- });
1018
- }
1019
- getStepExecutionWorkerContext(options) {
1020
- return (options.client ?? this.client).post({
1021
- url: "/api/step-executions/{stepExecutionId}/worker-context",
1022
- ...options,
1023
- headers: {
1024
- "Content-Type": "application/json",
1025
- ...options.headers
1026
- }
1027
- });
1028
- }
1029
- completeStepExecution(options) {
1030
- return (options.client ?? this.client).post({
1031
- url: "/api/step-executions/{stepExecutionId}/completions",
1032
- ...options,
1033
- headers: {
1034
- "Content-Type": "application/json",
1035
- ...options.headers
1036
- }
1037
- });
1038
- }
1039
- markStepExecutionRunning(options) {
1040
- return (options.client ?? this.client).put({ url: "/api/step-executions/{stepExecutionId}/running", ...options });
1041
- }
1042
- createStepExecutionResult(options) {
1043
- return (options.client ?? this.client).post({
1044
- url: "/api/step-execution-results",
1045
- ...options,
1046
- headers: {
1047
- "Content-Type": "application/json",
1048
- ...options.headers
1049
- }
1050
- });
1051
- }
1052
- extractStepExecutionSignals(options) {
1053
- return (options.client ?? this.client).post({ url: "/api/step-execution-results/{stepExecutionResultId}/signals/extract", ...options });
1054
- }
1055
- getStepExecution(options) {
1056
- return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
1057
- }
1058
- }
1059
-
1060
- class PipelineDefinitions extends HeyApiClient {
1061
- listPipelineDefinitions(options) {
1062
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-definitions", ...options });
1063
- }
1064
- createPipelineDefinition(options) {
1065
- return (options?.client ?? this.client).post({ url: "/api/linear-pipeline-definitions", ...options });
1066
- }
1067
- getPipelineDefinition(options) {
1068
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}", ...options });
1069
- }
1070
- updatePipelineDefinition(options) {
1071
- return (options.client ?? this.client).put({
1072
- url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}",
1073
- ...options,
1074
- headers: {
1075
- "Content-Type": "application/json",
1076
- ...options.headers
1077
- }
1078
- });
1079
- }
1080
- archivePipelineDefinition(options) {
1081
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/archive", ...options });
1082
- }
1083
- addPipelineStep(options) {
1084
- return (options.client ?? this.client).post({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps", ...options });
1085
- }
1086
- removePipelineStep(options) {
1087
- return (options.client ?? this.client).delete({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}", ...options });
1088
- }
1089
- updatePipelineStep(options) {
1090
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}", ...options });
1091
- }
1092
- setPipelineStepAdvancementPolicy(options) {
1093
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-definitions/{linearPipelineDefinitionId}/steps/{linearPipelineStepDefinitionId}/advancement-policy", ...options });
1094
- }
1095
- }
1096
-
1097
- class PipelineExecutions extends HeyApiClient {
1098
- listPipelineExecutions(options) {
1099
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions", ...options });
1100
- }
1101
- createPipelineExecution(options) {
1102
- return (options.client ?? this.client).post({
1103
- url: "/api/linear-pipeline-executions",
1104
- ...options,
1105
- headers: {
1106
- "Content-Type": "application/json",
1107
- ...options.headers
1108
- }
1109
- });
1110
- }
1111
- startPipelineExecution(options) {
1112
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/start", ...options });
1113
- }
1114
- queueFirstPipelineStepRun(options) {
1115
- return (options.client ?? this.client).post({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/first", ...options });
1116
- }
1117
- createPipelineStepRunAttempt(options) {
1118
- return (options.client ?? this.client).post({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/attempts", ...options });
1119
- }
1120
- markPipelineStepRunAttemptRunning(options) {
1121
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/attempts/{linearPipelineStepRunAttemptId}/running", ...options });
1122
- }
1123
- applyPipelineStepResult(options) {
1124
- return (options.client ?? this.client).post({
1125
- url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/attempts/{linearPipelineStepRunAttemptId}/results",
1126
- ...options,
1127
- headers: {
1128
- "Content-Type": "application/json",
1129
- ...options.headers
1130
- }
1131
- });
1132
- }
1133
- acceptPipelineStepRun(options) {
1134
- return (options.client ?? this.client).post({
1135
- url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/accept",
1136
- ...options,
1137
- headers: {
1138
- "Content-Type": "application/json",
1139
- ...options.headers
1140
- }
1141
- });
1142
- }
1143
- retriggerPipelineStepRun(options) {
1144
- return (options.client ?? this.client).post({
1145
- url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/step-runs/{linearPipelineStepRunId}/retrigger",
1146
- ...options,
1147
- headers: {
1148
- "Content-Type": "application/json",
1149
- ...options.headers
1150
- }
1151
- });
1152
- }
1153
- cancelPipelineExecution(options) {
1154
- return (options.client ?? this.client).put({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}/cancel", ...options });
1155
- }
1156
- getPipelineExecution(options) {
1157
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/{linearPipelineExecutionId}", ...options });
1158
- }
1159
- listPipelineExecutionsByDefinition(options) {
1160
- return (options.client ?? this.client).get({ url: "/api/linear-pipeline-executions/by-definition/{linearPipelineDefinitionId}", ...options });
1161
- }
1162
- }
1163
-
1164
- class WorkItems extends HeyApiClient {
1165
- createWorkItem(options) {
1166
- return (options.client ?? this.client).post({
1167
- url: "/api/work-items",
1168
- ...options,
1169
- headers: {
1170
- "Content-Type": "application/json",
1171
- ...options.headers
1172
- }
1173
- });
1174
- }
1175
- upsertWorkItem(options) {
1176
- return (options.client ?? this.client).put({
1177
- url: "/api/work-items",
1178
- ...options,
1179
- headers: {
1180
- "Content-Type": "application/json",
1181
- ...options.headers
1182
- }
1183
- });
1184
- }
1185
- deleteWorkItems(options) {
1186
- return (options.client ?? this.client).delete({
1187
- url: "/api/work-items/batch",
1188
- ...options,
1189
- headers: {
1190
- "Content-Type": "application/json",
1191
- ...options.headers
1192
- }
1193
- });
1194
- }
1195
- getWorkItems(options) {
1196
- return (options.client ?? this.client).get({ url: "/api/work-items/batch", ...options });
1197
- }
1198
- createWorkItems(options) {
1199
- return (options.client ?? this.client).post({
1200
- url: "/api/work-items/batch",
1201
- ...options,
1202
- headers: {
1203
- "Content-Type": "application/json",
1204
- ...options.headers
1205
- }
1206
- });
1207
- }
1208
- upsertWorkItems(options) {
1209
- return (options.client ?? this.client).put({
1210
- url: "/api/work-items/batch",
1211
- ...options,
1212
- headers: {
1213
- "Content-Type": "application/json",
1214
- ...options.headers
1215
- }
1216
- });
1217
- }
1218
- deleteWorkItem(options) {
1219
- return (options.client ?? this.client).delete({ url: "/api/work-items/{workItemId}", ...options });
1220
- }
1221
- getWorkItem(options) {
1222
- return (options.client ?? this.client).get({ url: "/api/work-items/{workItemId}", ...options });
1223
- }
1224
- }
1225
-
1226
- class ProjectContext extends HeyApiClient {
1227
- listProjectContextEntries(options) {
1228
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/context-entries", ...options });
1229
- }
1230
- createProjectContextEntry(options) {
1231
- return (options.client ?? this.client).post({
1232
- url: "/api/projects/{projectId}/context-entries",
1233
- ...options,
1234
- headers: {
1235
- "Content-Type": "application/json",
1236
- ...options.headers
1237
- }
1238
- });
1239
- }
1240
- deleteProjectContextEntry(options) {
1241
- return (options.client ?? this.client).delete({ url: "/api/projects/{projectId}/context-entries/{entryId}", ...options });
1242
- }
1243
- }
1244
-
1245
- class FeedbackRequests extends HeyApiClient {
1246
- listFeedbackRequests(options) {
1247
- return (options.client ?? this.client).get({ url: "/api/projects/{projectId}/step-signals/{stepSignalId}/feedback-requests", ...options });
1248
- }
1249
- declineFeedbackRequest(options) {
1250
- return (options.client ?? this.client).post({ url: "/api/projects/{projectId}/feedback-requests/{feedbackRequestId}/decline", ...options });
1251
- }
1252
- }
1253
-
1254
- class StepDefinitionTemplates extends HeyApiClient {
1255
- listStepDefinitionTemplates(options) {
1256
- return (options?.client ?? this.client).get({ url: "/api/step-definition-templates", ...options });
1257
- }
1258
- getStepDefinitionTemplate(options) {
1259
- return (options.client ?? this.client).get({ url: "/api/step-definition-templates/{stepDefinitionTemplateId}", ...options });
1260
- }
1261
- instantiateStepDefinitionTemplate(options) {
1262
- return (options.client ?? this.client).post({
1263
- url: "/api/step-definition-templates/{stepDefinitionTemplateId}/instantiate",
1264
- ...options,
1265
- headers: {
1266
- "Content-Type": "application/json",
1267
- ...options.headers
1268
- }
1269
- });
1270
- }
1271
- }
1272
-
1273
- class BoboddyClient extends HeyApiClient {
1274
- static __registry = new HeyApiRegistry;
1275
- constructor(args) {
1276
- super(args);
1277
- BoboddyClient.__registry.set(this, args?.key);
1278
- }
1279
- _api;
1280
- get api() {
1281
- return this._api ??= new Api({ client: this.client });
1282
- }
1283
- _projects;
1284
- get projects() {
1285
- return this._projects ??= new Projects({ client: this.client });
1286
- }
1287
- _runtimeSessions;
1288
- get runtimeSessions() {
1289
- return this._runtimeSessions ??= new RuntimeSessions({ client: this.client });
1290
- }
1291
- _runtimeServices;
1292
- get runtimeServices() {
1293
- return this._runtimeServices ??= new RuntimeServices({ client: this.client });
1294
- }
1295
- _runtimeCommands;
1296
- get runtimeCommands() {
1297
- return this._runtimeCommands ??= new RuntimeCommands({ client: this.client });
1298
- }
1299
- _stepDefinitions;
1300
- get stepDefinitions() {
1301
- return this._stepDefinitions ??= new StepDefinitions({ client: this.client });
1302
- }
1303
- _stepExecutions;
1304
- get stepExecutions() {
1305
- return this._stepExecutions ??= new StepExecutions({ client: this.client });
1306
- }
1307
- _pipelineDefinitions;
1308
- get pipelineDefinitions() {
1309
- return this._pipelineDefinitions ??= new PipelineDefinitions({ client: this.client });
1310
- }
1311
- _pipelineExecutions;
1312
- get pipelineExecutions() {
1313
- return this._pipelineExecutions ??= new PipelineExecutions({ client: this.client });
1314
- }
1315
- _workItems;
1316
- get workItems() {
1317
- return this._workItems ??= new WorkItems({ client: this.client });
1318
- }
1319
- _projectContext;
1320
- get projectContext() {
1321
- return this._projectContext ??= new ProjectContext({ client: this.client });
1322
- }
1323
- _feedbackRequests;
1324
- get feedbackRequests() {
1325
- return this._feedbackRequests ??= new FeedbackRequests({ client: this.client });
1326
- }
1327
- _stepDefinitionTemplates;
1328
- get stepDefinitionTemplates() {
1329
- return this._stepDefinitionTemplates ??= new StepDefinitionTemplates({ client: this.client });
1330
- }
1331
- }
1332
-
1333
- // src/step-definitions-client.ts
1334
- function createStepDefinitionsClient(baseUrl) {
1335
- const client2 = createClient({ baseUrl });
1336
- return buildStepDefinitionsClient(new StepDefinitions({ client: client2 }));
1337
- }
1338
- var buildStepDefinitionsClient = (stepDefinitions) => {
1339
- return {
1340
- listByProjectId: async (projectId, options) => {
1341
- const result = await stepDefinitions.listStepDefinitions({
1342
- query: { projectId },
1343
- headers: options?.headers
1344
- });
1345
- if (result.error)
1346
- throw new Error(JSON.stringify(result.error));
1347
- return result.data;
1348
- },
1349
- create: async (body, options) => {
1350
- const result = await stepDefinitions.createStepDefinition({
1351
- body,
1352
- headers: options?.headers
1353
- });
1354
- if (result.error)
1355
- throw new Error(JSON.stringify(result.error));
1356
- return result.data;
1357
- },
1358
- update: async (stepDefinitionId, body, options) => {
1359
- const result = await stepDefinitions.updateStepDefinition({
1360
- path: { stepDefinitionId },
1361
- body,
1362
- headers: options?.headers
1363
- });
1364
- if (result.error)
1365
- throw new Error(JSON.stringify(result.error));
1366
- return result.data;
1367
- }
1368
- };
1369
- };
1370
- export {
1371
- createStepDefinitionsClient
1372
- };