@engini/client 0.0.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,1223 @@
1
+ 'use strict';
2
+
3
+ // src/generated/core/bodySerializer.gen.ts
4
+ var jsonBodySerializer = {
5
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
6
+ };
7
+
8
+ // src/generated/core/serverSentEvents.gen.ts
9
+ function createSseClient({
10
+ onRequest,
11
+ onSseError,
12
+ onSseEvent,
13
+ responseTransformer,
14
+ responseValidator,
15
+ sseDefaultRetryDelay,
16
+ sseMaxRetryAttempts,
17
+ sseMaxRetryDelay,
18
+ sseSleepFn,
19
+ url,
20
+ ...options
21
+ }) {
22
+ let lastEventId;
23
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
24
+ const createStream = async function* () {
25
+ let retryDelay = sseDefaultRetryDelay ?? 3e3;
26
+ let attempt = 0;
27
+ const signal = options.signal ?? new AbortController().signal;
28
+ while (true) {
29
+ if (signal.aborted) break;
30
+ attempt++;
31
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
32
+ if (lastEventId !== void 0) {
33
+ headers.set("Last-Event-ID", lastEventId);
34
+ }
35
+ try {
36
+ const requestInit = {
37
+ redirect: "follow",
38
+ ...options,
39
+ body: options.serializedBody,
40
+ headers,
41
+ signal
42
+ };
43
+ let request = new Request(url, requestInit);
44
+ if (onRequest) {
45
+ request = await onRequest(url, requestInit);
46
+ }
47
+ const _fetch = options.fetch ?? globalThis.fetch;
48
+ const response = await _fetch(request);
49
+ if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
50
+ if (!response.body) throw new Error("No body in SSE response");
51
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
52
+ let buffer = "";
53
+ const abortHandler = () => {
54
+ try {
55
+ reader.cancel();
56
+ } catch {
57
+ }
58
+ };
59
+ signal.addEventListener("abort", abortHandler);
60
+ try {
61
+ while (true) {
62
+ const { done, value } = await reader.read();
63
+ if (done) break;
64
+ buffer += value;
65
+ buffer = buffer.replace(/\r\n?/g, "\n");
66
+ const chunks = buffer.split("\n\n");
67
+ buffer = chunks.pop() ?? "";
68
+ for (const chunk of chunks) {
69
+ const lines = chunk.split("\n");
70
+ const dataLines = [];
71
+ let eventName;
72
+ for (const line of lines) {
73
+ if (line.startsWith("data:")) {
74
+ dataLines.push(line.replace(/^data:\s*/, ""));
75
+ } else if (line.startsWith("event:")) {
76
+ eventName = line.replace(/^event:\s*/, "");
77
+ } else if (line.startsWith("id:")) {
78
+ lastEventId = line.replace(/^id:\s*/, "");
79
+ } else if (line.startsWith("retry:")) {
80
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
81
+ if (!Number.isNaN(parsed)) {
82
+ retryDelay = parsed;
83
+ }
84
+ }
85
+ }
86
+ let data;
87
+ let parsedJson = false;
88
+ if (dataLines.length) {
89
+ const rawData = dataLines.join("\n");
90
+ try {
91
+ data = JSON.parse(rawData);
92
+ parsedJson = true;
93
+ } catch {
94
+ data = rawData;
95
+ }
96
+ }
97
+ if (parsedJson) {
98
+ if (responseValidator) {
99
+ await responseValidator(data);
100
+ }
101
+ if (responseTransformer) {
102
+ data = await responseTransformer(data);
103
+ }
104
+ }
105
+ onSseEvent?.({
106
+ data,
107
+ event: eventName,
108
+ id: lastEventId,
109
+ retry: retryDelay
110
+ });
111
+ if (dataLines.length) {
112
+ yield data;
113
+ }
114
+ }
115
+ }
116
+ } finally {
117
+ signal.removeEventListener("abort", abortHandler);
118
+ reader.releaseLock();
119
+ }
120
+ break;
121
+ } catch (error) {
122
+ onSseError?.(error);
123
+ if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
124
+ break;
125
+ }
126
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
127
+ await sleep(backoff);
128
+ }
129
+ }
130
+ };
131
+ const stream = createStream();
132
+ return { stream };
133
+ }
134
+
135
+ // src/generated/core/pathSerializer.gen.ts
136
+ var separatorArrayExplode = (style) => {
137
+ switch (style) {
138
+ case "label":
139
+ return ".";
140
+ case "matrix":
141
+ return ";";
142
+ case "simple":
143
+ return ",";
144
+ default:
145
+ return "&";
146
+ }
147
+ };
148
+ var separatorArrayNoExplode = (style) => {
149
+ switch (style) {
150
+ case "form":
151
+ return ",";
152
+ case "pipeDelimited":
153
+ return "|";
154
+ case "spaceDelimited":
155
+ return "%20";
156
+ default:
157
+ return ",";
158
+ }
159
+ };
160
+ var separatorObjectExplode = (style) => {
161
+ switch (style) {
162
+ case "label":
163
+ return ".";
164
+ case "matrix":
165
+ return ";";
166
+ case "simple":
167
+ return ",";
168
+ default:
169
+ return "&";
170
+ }
171
+ };
172
+ var serializeArrayParam = ({
173
+ allowReserved,
174
+ explode,
175
+ name,
176
+ style,
177
+ value
178
+ }) => {
179
+ if (!explode) {
180
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
181
+ switch (style) {
182
+ case "label":
183
+ return `.${joinedValues2}`;
184
+ case "matrix":
185
+ return `;${name}=${joinedValues2}`;
186
+ case "simple":
187
+ return joinedValues2;
188
+ default:
189
+ return `${name}=${joinedValues2}`;
190
+ }
191
+ }
192
+ const separator = separatorArrayExplode(style);
193
+ const joinedValues = value.map((v) => {
194
+ if (style === "label" || style === "simple") {
195
+ return allowReserved ? v : encodeURIComponent(v);
196
+ }
197
+ return serializePrimitiveParam({
198
+ allowReserved,
199
+ name,
200
+ value: v
201
+ });
202
+ }).join(separator);
203
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
204
+ };
205
+ var serializePrimitiveParam = ({
206
+ allowReserved,
207
+ name,
208
+ value
209
+ }) => {
210
+ if (value === void 0 || value === null) {
211
+ return "";
212
+ }
213
+ if (typeof value === "object") {
214
+ throw new Error(
215
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
216
+ );
217
+ }
218
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
219
+ };
220
+ var serializeObjectParam = ({
221
+ allowReserved,
222
+ explode,
223
+ name,
224
+ style,
225
+ value,
226
+ valueOnly
227
+ }) => {
228
+ if (value instanceof Date) {
229
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
230
+ }
231
+ if (style !== "deepObject" && !explode) {
232
+ let values = [];
233
+ Object.entries(value).forEach(([key, v]) => {
234
+ values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
235
+ });
236
+ const joinedValues2 = values.join(",");
237
+ switch (style) {
238
+ case "form":
239
+ return `${name}=${joinedValues2}`;
240
+ case "label":
241
+ return `.${joinedValues2}`;
242
+ case "matrix":
243
+ return `;${name}=${joinedValues2}`;
244
+ default:
245
+ return joinedValues2;
246
+ }
247
+ }
248
+ const separator = separatorObjectExplode(style);
249
+ const joinedValues = Object.entries(value).map(
250
+ ([key, v]) => serializePrimitiveParam({
251
+ allowReserved,
252
+ name: style === "deepObject" ? `${name}[${key}]` : key,
253
+ value: v
254
+ })
255
+ ).join(separator);
256
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
257
+ };
258
+
259
+ // src/generated/core/utils.gen.ts
260
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
261
+ var defaultPathSerializer = ({ path, url: _url }) => {
262
+ let url = _url;
263
+ const matches = _url.match(PATH_PARAM_RE);
264
+ if (matches) {
265
+ for (const match of matches) {
266
+ let explode = false;
267
+ let name = match.substring(1, match.length - 1);
268
+ let style = "simple";
269
+ if (name.endsWith("*")) {
270
+ explode = true;
271
+ name = name.substring(0, name.length - 1);
272
+ }
273
+ if (name.startsWith(".")) {
274
+ name = name.substring(1);
275
+ style = "label";
276
+ } else if (name.startsWith(";")) {
277
+ name = name.substring(1);
278
+ style = "matrix";
279
+ }
280
+ const value = path[name];
281
+ if (value === void 0 || value === null) {
282
+ continue;
283
+ }
284
+ if (Array.isArray(value)) {
285
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
286
+ continue;
287
+ }
288
+ if (typeof value === "object") {
289
+ url = url.replace(
290
+ match,
291
+ serializeObjectParam({
292
+ explode,
293
+ name,
294
+ style,
295
+ value,
296
+ valueOnly: true
297
+ })
298
+ );
299
+ continue;
300
+ }
301
+ if (style === "matrix") {
302
+ url = url.replace(
303
+ match,
304
+ `;${serializePrimitiveParam({
305
+ name,
306
+ value
307
+ })}`
308
+ );
309
+ continue;
310
+ }
311
+ const replaceValue = encodeURIComponent(
312
+ style === "label" ? `.${value}` : value
313
+ );
314
+ url = url.replace(match, replaceValue);
315
+ }
316
+ }
317
+ return url;
318
+ };
319
+ var getUrl = ({
320
+ baseUrl,
321
+ path,
322
+ query,
323
+ querySerializer,
324
+ url: _url
325
+ }) => {
326
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
327
+ let url = (baseUrl ?? "") + pathUrl;
328
+ if (path) {
329
+ url = defaultPathSerializer({ path, url });
330
+ }
331
+ let search = query ? querySerializer(query) : "";
332
+ if (search.startsWith("?")) {
333
+ search = search.substring(1);
334
+ }
335
+ if (search) {
336
+ url += `?${search}`;
337
+ }
338
+ return url;
339
+ };
340
+ function getValidRequestBody(options) {
341
+ const hasBody = options.body !== void 0;
342
+ const isSerializedBody = hasBody && options.bodySerializer;
343
+ if (isSerializedBody) {
344
+ if ("serializedBody" in options) {
345
+ const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
346
+ return hasSerializedBody ? options.serializedBody : null;
347
+ }
348
+ return options.body !== "" ? options.body : null;
349
+ }
350
+ if (hasBody) {
351
+ return options.body;
352
+ }
353
+ return void 0;
354
+ }
355
+
356
+ // src/generated/core/auth.gen.ts
357
+ var getAuthToken = async (auth, callback) => {
358
+ const token = typeof callback === "function" ? await callback(auth) : callback;
359
+ if (!token) {
360
+ return;
361
+ }
362
+ if (auth.scheme === "bearer") {
363
+ return `Bearer ${token}`;
364
+ }
365
+ if (auth.scheme === "basic") {
366
+ return `Basic ${btoa(token)}`;
367
+ }
368
+ return token;
369
+ };
370
+
371
+ // src/generated/client/utils.gen.ts
372
+ var createQuerySerializer = ({
373
+ parameters = {},
374
+ ...args
375
+ } = {}) => {
376
+ const querySerializer = (queryParams) => {
377
+ const search = [];
378
+ if (queryParams && typeof queryParams === "object") {
379
+ for (const name in queryParams) {
380
+ const value = queryParams[name];
381
+ if (value === void 0 || value === null) {
382
+ continue;
383
+ }
384
+ const options = parameters[name] || args;
385
+ if (Array.isArray(value)) {
386
+ const serializedArray = serializeArrayParam({
387
+ allowReserved: options.allowReserved,
388
+ explode: true,
389
+ name,
390
+ style: "form",
391
+ value,
392
+ ...options.array
393
+ });
394
+ if (serializedArray) search.push(serializedArray);
395
+ } else if (typeof value === "object") {
396
+ const serializedObject = serializeObjectParam({
397
+ allowReserved: options.allowReserved,
398
+ explode: true,
399
+ name,
400
+ style: "deepObject",
401
+ value,
402
+ ...options.object
403
+ });
404
+ if (serializedObject) search.push(serializedObject);
405
+ } else {
406
+ const serializedPrimitive = serializePrimitiveParam({
407
+ allowReserved: options.allowReserved,
408
+ name,
409
+ value
410
+ });
411
+ if (serializedPrimitive) search.push(serializedPrimitive);
412
+ }
413
+ }
414
+ }
415
+ return search.join("&");
416
+ };
417
+ return querySerializer;
418
+ };
419
+ var getParseAs = (contentType) => {
420
+ if (!contentType) {
421
+ return "stream";
422
+ }
423
+ const cleanContent = contentType.split(";")[0]?.trim();
424
+ if (!cleanContent) {
425
+ return;
426
+ }
427
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
428
+ return "json";
429
+ }
430
+ if (cleanContent === "multipart/form-data") {
431
+ return "formData";
432
+ }
433
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
434
+ return "blob";
435
+ }
436
+ if (cleanContent.startsWith("text/")) {
437
+ return "text";
438
+ }
439
+ return;
440
+ };
441
+ var checkForExistence = (options, name) => {
442
+ if (!name) {
443
+ return false;
444
+ }
445
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
446
+ return true;
447
+ }
448
+ return false;
449
+ };
450
+ async function setAuthParams(options) {
451
+ for (const auth of options.security ?? []) {
452
+ if (checkForExistence(options, auth.name)) {
453
+ continue;
454
+ }
455
+ const token = await getAuthToken(auth, options.auth);
456
+ if (!token) {
457
+ continue;
458
+ }
459
+ const name = auth.name ?? "Authorization";
460
+ switch (auth.in) {
461
+ case "query":
462
+ if (!options.query) {
463
+ options.query = {};
464
+ }
465
+ options.query[name] = token;
466
+ break;
467
+ case "cookie":
468
+ options.headers.append("Cookie", `${name}=${token}`);
469
+ break;
470
+ case "header":
471
+ default:
472
+ options.headers.set(name, token);
473
+ break;
474
+ }
475
+ }
476
+ }
477
+ var buildUrl = (options) => getUrl({
478
+ baseUrl: options.baseUrl,
479
+ path: options.path,
480
+ query: options.query,
481
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
482
+ url: options.url
483
+ });
484
+ var mergeConfigs = (a, b) => {
485
+ const config = { ...a, ...b };
486
+ if (config.baseUrl?.endsWith("/")) {
487
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
488
+ }
489
+ config.headers = mergeHeaders(a.headers, b.headers);
490
+ return config;
491
+ };
492
+ var headersEntries = (headers) => {
493
+ const entries = [];
494
+ headers.forEach((value, key) => {
495
+ entries.push([key, value]);
496
+ });
497
+ return entries;
498
+ };
499
+ var mergeHeaders = (...headers) => {
500
+ const mergedHeaders = new Headers();
501
+ for (const header of headers) {
502
+ if (!header) {
503
+ continue;
504
+ }
505
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
506
+ for (const [key, value] of iterator) {
507
+ if (value === null) {
508
+ mergedHeaders.delete(key);
509
+ } else if (Array.isArray(value)) {
510
+ for (const v of value) {
511
+ mergedHeaders.append(key, v);
512
+ }
513
+ } else if (value !== void 0) {
514
+ mergedHeaders.set(
515
+ key,
516
+ typeof value === "object" ? JSON.stringify(value) : value
517
+ );
518
+ }
519
+ }
520
+ }
521
+ return mergedHeaders;
522
+ };
523
+ var Interceptors = class {
524
+ fns = [];
525
+ clear() {
526
+ this.fns = [];
527
+ }
528
+ eject(id) {
529
+ const index = this.getInterceptorIndex(id);
530
+ if (this.fns[index]) {
531
+ this.fns[index] = null;
532
+ }
533
+ }
534
+ exists(id) {
535
+ const index = this.getInterceptorIndex(id);
536
+ return Boolean(this.fns[index]);
537
+ }
538
+ getInterceptorIndex(id) {
539
+ if (typeof id === "number") {
540
+ return this.fns[id] ? id : -1;
541
+ }
542
+ return this.fns.indexOf(id);
543
+ }
544
+ update(id, fn) {
545
+ const index = this.getInterceptorIndex(id);
546
+ if (this.fns[index]) {
547
+ this.fns[index] = fn;
548
+ return id;
549
+ }
550
+ return false;
551
+ }
552
+ use(fn) {
553
+ this.fns.push(fn);
554
+ return this.fns.length - 1;
555
+ }
556
+ };
557
+ var createInterceptors = () => ({
558
+ error: new Interceptors(),
559
+ request: new Interceptors(),
560
+ response: new Interceptors()
561
+ });
562
+ var defaultQuerySerializer = createQuerySerializer({
563
+ allowReserved: false,
564
+ array: {
565
+ explode: true,
566
+ style: "form"
567
+ },
568
+ object: {
569
+ explode: true,
570
+ style: "deepObject"
571
+ }
572
+ });
573
+ var defaultHeaders = {
574
+ "Content-Type": "application/json"
575
+ };
576
+ var createConfig = (override = {}) => ({
577
+ ...jsonBodySerializer,
578
+ headers: defaultHeaders,
579
+ parseAs: "auto",
580
+ querySerializer: defaultQuerySerializer,
581
+ ...override
582
+ });
583
+
584
+ // src/generated/client/client.gen.ts
585
+ var createClient = (config = {}) => {
586
+ let _config = mergeConfigs(createConfig(), config);
587
+ const getConfig = () => ({ ..._config });
588
+ const setConfig = (config2) => {
589
+ _config = mergeConfigs(_config, config2);
590
+ return getConfig();
591
+ };
592
+ const interceptors = createInterceptors();
593
+ const beforeRequest = async (options) => {
594
+ const opts = {
595
+ ..._config,
596
+ ...options,
597
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
598
+ headers: mergeHeaders(_config.headers, options.headers),
599
+ serializedBody: void 0
600
+ };
601
+ if (opts.security) {
602
+ await setAuthParams(opts);
603
+ }
604
+ if (opts.requestValidator) {
605
+ await opts.requestValidator(opts);
606
+ }
607
+ if (opts.body !== void 0 && opts.bodySerializer) {
608
+ opts.serializedBody = opts.bodySerializer(opts.body);
609
+ }
610
+ if (opts.body === void 0 || opts.serializedBody === "") {
611
+ opts.headers.delete("Content-Type");
612
+ }
613
+ const resolvedOpts = opts;
614
+ const url = buildUrl(resolvedOpts);
615
+ return { opts: resolvedOpts, url };
616
+ };
617
+ const request = async (options) => {
618
+ const throwOnError = options.throwOnError ?? _config.throwOnError;
619
+ const responseStyle = options.responseStyle ?? _config.responseStyle;
620
+ let request2;
621
+ let response;
622
+ try {
623
+ const { opts, url } = await beforeRequest(options);
624
+ const requestInit = {
625
+ redirect: "follow",
626
+ ...opts,
627
+ body: getValidRequestBody(opts)
628
+ };
629
+ request2 = new Request(url, requestInit);
630
+ for (const fn of interceptors.request.fns) {
631
+ if (fn) {
632
+ request2 = await fn(request2, opts);
633
+ }
634
+ }
635
+ const _fetch = opts.fetch;
636
+ response = await _fetch(request2);
637
+ for (const fn of interceptors.response.fns) {
638
+ if (fn) {
639
+ response = await fn(response, request2, opts);
640
+ }
641
+ }
642
+ const result = {
643
+ request: request2,
644
+ response
645
+ };
646
+ if (response.ok) {
647
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
648
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
649
+ let emptyData;
650
+ switch (parseAs) {
651
+ case "arrayBuffer":
652
+ case "blob":
653
+ case "text":
654
+ emptyData = await response[parseAs]();
655
+ break;
656
+ case "formData":
657
+ emptyData = new FormData();
658
+ break;
659
+ case "stream":
660
+ emptyData = response.body;
661
+ break;
662
+ case "json":
663
+ default:
664
+ emptyData = {};
665
+ break;
666
+ }
667
+ return opts.responseStyle === "data" ? emptyData : {
668
+ data: emptyData,
669
+ ...result
670
+ };
671
+ }
672
+ let data;
673
+ switch (parseAs) {
674
+ case "arrayBuffer":
675
+ case "blob":
676
+ case "formData":
677
+ case "text":
678
+ data = await response[parseAs]();
679
+ break;
680
+ case "json": {
681
+ const text = await response.text();
682
+ data = text ? JSON.parse(text) : {};
683
+ break;
684
+ }
685
+ case "stream":
686
+ return opts.responseStyle === "data" ? response.body : {
687
+ data: response.body,
688
+ ...result
689
+ };
690
+ }
691
+ if (parseAs === "json") {
692
+ if (opts.responseValidator) {
693
+ await opts.responseValidator(data);
694
+ }
695
+ if (opts.responseTransformer) {
696
+ data = await opts.responseTransformer(data);
697
+ }
698
+ }
699
+ return opts.responseStyle === "data" ? data : {
700
+ data,
701
+ ...result
702
+ };
703
+ }
704
+ const textError = await response.text();
705
+ let jsonError;
706
+ try {
707
+ jsonError = JSON.parse(textError);
708
+ } catch {
709
+ }
710
+ throw jsonError ?? textError;
711
+ } catch (error) {
712
+ let finalError = error;
713
+ for (const fn of interceptors.error.fns) {
714
+ if (fn) {
715
+ finalError = await fn(finalError, response, request2, options);
716
+ }
717
+ }
718
+ finalError = finalError || {};
719
+ if (throwOnError) {
720
+ throw finalError;
721
+ }
722
+ return responseStyle === "data" ? void 0 : {
723
+ error: finalError,
724
+ request: request2,
725
+ response
726
+ };
727
+ }
728
+ };
729
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
730
+ const makeSseFn = (method) => async (options) => {
731
+ const { opts, url } = await beforeRequest(options);
732
+ return createSseClient({
733
+ ...opts,
734
+ body: opts.body,
735
+ method,
736
+ onRequest: async (url2, init) => {
737
+ let request2 = new Request(url2, init);
738
+ for (const fn of interceptors.request.fns) {
739
+ if (fn) {
740
+ request2 = await fn(request2, opts);
741
+ }
742
+ }
743
+ return request2;
744
+ },
745
+ serializedBody: getValidRequestBody(opts),
746
+ url
747
+ });
748
+ };
749
+ const _buildUrl = (options) => buildUrl({ ..._config, ...options });
750
+ return {
751
+ buildUrl: _buildUrl,
752
+ connect: makeMethodFn("CONNECT"),
753
+ delete: makeMethodFn("DELETE"),
754
+ get: makeMethodFn("GET"),
755
+ getConfig,
756
+ head: makeMethodFn("HEAD"),
757
+ interceptors,
758
+ options: makeMethodFn("OPTIONS"),
759
+ patch: makeMethodFn("PATCH"),
760
+ post: makeMethodFn("POST"),
761
+ put: makeMethodFn("PUT"),
762
+ request,
763
+ setConfig,
764
+ sse: {
765
+ connect: makeSseFn("CONNECT"),
766
+ delete: makeSseFn("DELETE"),
767
+ get: makeSseFn("GET"),
768
+ head: makeSseFn("HEAD"),
769
+ options: makeSseFn("OPTIONS"),
770
+ patch: makeSseFn("PATCH"),
771
+ post: makeSseFn("POST"),
772
+ put: makeSseFn("PUT"),
773
+ trace: makeSseFn("TRACE")
774
+ },
775
+ trace: makeMethodFn("TRACE")
776
+ };
777
+ };
778
+
779
+ // src/generated/client.gen.ts
780
+ var client = createClient(
781
+ createConfig({ baseUrl: "https://feat-public-api.staging.engini.io/api" })
782
+ );
783
+
784
+ // src/generated/sdk.gen.ts
785
+ var authWhoAmI = (options) => (options?.client ?? client).get({
786
+ security: [
787
+ { scheme: "bearer", type: "http" },
788
+ { name: "x-api-key", type: "apiKey" }
789
+ ],
790
+ url: "/v1/auth/whoami",
791
+ ...options
792
+ });
793
+ var solutionsCreateSolution = (options) => (options.client ?? client).post({
794
+ security: [
795
+ { scheme: "bearer", type: "http" },
796
+ { name: "companytoken", type: "apiKey" },
797
+ { name: "x-api-key", type: "apiKey" }
798
+ ],
799
+ url: "/v1/solutions/admin",
800
+ ...options,
801
+ headers: {
802
+ "Content-Type": "application/json",
803
+ ...options.headers
804
+ }
805
+ });
806
+ var solutionsArchiveSolution = (options) => (options.client ?? client).delete({
807
+ security: [
808
+ { scheme: "bearer", type: "http" },
809
+ { name: "x-api-key", type: "apiKey" }
810
+ ],
811
+ url: "/v1/solutions/admin/{slug}",
812
+ ...options
813
+ });
814
+ var solutionsUpdateSolution = (options) => (options.client ?? client).put({
815
+ security: [
816
+ { scheme: "bearer", type: "http" },
817
+ { name: "companytoken", type: "apiKey" },
818
+ { name: "x-api-key", type: "apiKey" }
819
+ ],
820
+ url: "/v1/solutions/admin/{slug}",
821
+ ...options,
822
+ headers: {
823
+ "Content-Type": "application/json",
824
+ ...options.headers
825
+ }
826
+ });
827
+ var solutionsPublishSolution = (options) => (options.client ?? client).post({
828
+ security: [
829
+ { scheme: "bearer", type: "http" },
830
+ { name: "x-api-key", type: "apiKey" }
831
+ ],
832
+ url: "/v1/solutions/admin/{slug}/publish",
833
+ ...options
834
+ });
835
+ var solutionsBuildManifest = (options) => (options.client ?? client).post({
836
+ security: [
837
+ { scheme: "bearer", type: "http" },
838
+ { name: "companytoken", type: "apiKey" },
839
+ { name: "x-api-key", type: "apiKey" }
840
+ ],
841
+ url: "/v1/solutions/admin/build-manifest",
842
+ ...options,
843
+ headers: {
844
+ "Content-Type": "application/json",
845
+ ...options.headers
846
+ }
847
+ });
848
+ var solutionsGetPublishedSolutions = (options) => (options?.client ?? client).get({
849
+ security: [
850
+ { scheme: "bearer", type: "http" },
851
+ { name: "x-api-key", type: "apiKey" }
852
+ ],
853
+ url: "/v1/solutions",
854
+ ...options
855
+ });
856
+ var solutionsGetSolutionBySlug = (options) => (options.client ?? client).get({
857
+ security: [
858
+ { scheme: "bearer", type: "http" },
859
+ { name: "x-api-key", type: "apiKey" }
860
+ ],
861
+ url: "/v1/solutions/{slug}",
862
+ ...options
863
+ });
864
+ var solutionsGetInstallations = (options) => (options?.client ?? client).get({
865
+ security: [
866
+ { scheme: "bearer", type: "http" },
867
+ { name: "companytoken", type: "apiKey" },
868
+ { name: "x-api-key", type: "apiKey" }
869
+ ],
870
+ url: "/v1/solutions/installations",
871
+ ...options
872
+ });
873
+ var solutionsGetInstallationDetail = (options) => (options.client ?? client).get({
874
+ security: [
875
+ { scheme: "bearer", type: "http" },
876
+ { name: "companytoken", type: "apiKey" },
877
+ { name: "x-api-key", type: "apiKey" }
878
+ ],
879
+ url: "/v1/solutions/installations/{id}",
880
+ ...options
881
+ });
882
+ var solutionsGetInstallationResources = (options) => (options.client ?? client).get({
883
+ security: [
884
+ { scheme: "bearer", type: "http" },
885
+ { name: "companytoken", type: "apiKey" },
886
+ { name: "x-api-key", type: "apiKey" }
887
+ ],
888
+ url: "/v1/solutions/installations/{id}/resources",
889
+ ...options
890
+ });
891
+ var solutionsInstallSolution = (options) => (options.client ?? client).post({
892
+ security: [
893
+ { scheme: "bearer", type: "http" },
894
+ { name: "companytoken", type: "apiKey" },
895
+ { name: "x-api-key", type: "apiKey" }
896
+ ],
897
+ url: "/v1/solutions/{slug}/install",
898
+ ...options,
899
+ headers: {
900
+ "Content-Type": "application/json",
901
+ ...options.headers
902
+ }
903
+ });
904
+ var solutionsUpdateInstallation = (options) => (options.client ?? client).post({
905
+ security: [
906
+ { scheme: "bearer", type: "http" },
907
+ { name: "companytoken", type: "apiKey" },
908
+ { name: "x-api-key", type: "apiKey" }
909
+ ],
910
+ url: "/v1/solutions/installations/{id}/update",
911
+ ...options,
912
+ headers: {
913
+ "Content-Type": "application/json",
914
+ ...options.headers
915
+ }
916
+ });
917
+ var solutionsUninstallSolution = (options) => (options.client ?? client).post({
918
+ security: [
919
+ { scheme: "bearer", type: "http" },
920
+ { name: "companytoken", type: "apiKey" },
921
+ { name: "x-api-key", type: "apiKey" }
922
+ ],
923
+ url: "/v1/solutions/{slug}/uninstall",
924
+ ...options,
925
+ headers: {
926
+ "Content-Type": "application/json",
927
+ ...options.headers
928
+ }
929
+ });
930
+ var applicationsListApplications = (options) => (options?.client ?? client).get({
931
+ security: [
932
+ { scheme: "bearer", type: "http" },
933
+ { name: "x-api-key", type: "apiKey" }
934
+ ],
935
+ url: "/v1/applications",
936
+ ...options
937
+ });
938
+ var applicationsGetApplication = (options) => (options.client ?? client).get({
939
+ security: [
940
+ { scheme: "bearer", type: "http" },
941
+ { name: "x-api-key", type: "apiKey" }
942
+ ],
943
+ url: "/v1/applications/{slug}",
944
+ ...options
945
+ });
946
+ var connectionsGetConnections = (options) => (options?.client ?? client).get({
947
+ security: [
948
+ { scheme: "bearer", type: "http" },
949
+ { name: "x-api-key", type: "apiKey" }
950
+ ],
951
+ url: "/v1/connections",
952
+ ...options
953
+ });
954
+ var connectionsCreateConnection = (options) => (options.client ?? client).post({
955
+ security: [
956
+ { scheme: "bearer", type: "http" },
957
+ { name: "x-api-key", type: "apiKey" }
958
+ ],
959
+ url: "/v1/connections",
960
+ ...options,
961
+ headers: {
962
+ "Content-Type": "application/json",
963
+ ...options.headers
964
+ }
965
+ });
966
+ var connectionsDeleteConnection = (options) => (options.client ?? client).delete({
967
+ security: [
968
+ { scheme: "bearer", type: "http" },
969
+ { name: "x-api-key", type: "apiKey" }
970
+ ],
971
+ url: "/v1/connections/{connectionId}",
972
+ ...options
973
+ });
974
+ var connectionsGetConnection = (options) => (options.client ?? client).get({
975
+ security: [
976
+ { scheme: "bearer", type: "http" },
977
+ { name: "x-api-key", type: "apiKey" }
978
+ ],
979
+ url: "/v1/connections/{connectionId}",
980
+ ...options
981
+ });
982
+ var connectionsUpdateConnection = (options) => (options.client ?? client).put({
983
+ security: [
984
+ { scheme: "bearer", type: "http" },
985
+ { name: "x-api-key", type: "apiKey" }
986
+ ],
987
+ url: "/v1/connections/{connectionId}",
988
+ ...options,
989
+ headers: {
990
+ "Content-Type": "application/json",
991
+ ...options.headers
992
+ }
993
+ });
994
+ var connectionsGetDefaultConnections = (options) => (options?.client ?? client).get({
995
+ security: [
996
+ { scheme: "bearer", type: "http" },
997
+ { name: "x-api-key", type: "apiKey" }
998
+ ],
999
+ url: "/v1/connections/Defaults",
1000
+ ...options
1001
+ });
1002
+ var connectionsClearDefaultConnection = (options) => (options.client ?? client).delete({
1003
+ security: [
1004
+ { scheme: "bearer", type: "http" },
1005
+ { name: "x-api-key", type: "apiKey" }
1006
+ ],
1007
+ url: "/v1/connections/{connectionId}/Default",
1008
+ ...options
1009
+ });
1010
+ var connectionsSetDefaultConnection = (options) => (options.client ?? client).put({
1011
+ security: [
1012
+ { scheme: "bearer", type: "http" },
1013
+ { name: "x-api-key", type: "apiKey" }
1014
+ ],
1015
+ url: "/v1/connections/{connectionId}/Default",
1016
+ ...options
1017
+ });
1018
+ var connectionsReplaceConnection = (options) => (options.client ?? client).post({
1019
+ security: [
1020
+ { scheme: "bearer", type: "http" },
1021
+ { name: "x-api-key", type: "apiKey" }
1022
+ ],
1023
+ url: "/v1/connections/Replace",
1024
+ ...options,
1025
+ headers: {
1026
+ "Content-Type": "application/json",
1027
+ ...options.headers
1028
+ }
1029
+ });
1030
+ var connectionsRefreshObjects = (options) => (options.client ?? client).post({
1031
+ security: [
1032
+ { scheme: "bearer", type: "http" },
1033
+ { name: "x-api-key", type: "apiKey" }
1034
+ ],
1035
+ url: "/v1/connections/{connectionId}/RefreshObjects",
1036
+ ...options
1037
+ });
1038
+ var connectionsGetRefreshStatus = (options) => (options.client ?? client).get({
1039
+ security: [
1040
+ { scheme: "bearer", type: "http" },
1041
+ { name: "x-api-key", type: "apiKey" }
1042
+ ],
1043
+ url: "/v1/connections/{connectionId}/RefreshStatus",
1044
+ ...options
1045
+ });
1046
+ var connectionsSelectObjects = (options) => (options.client ?? client).post({
1047
+ security: [
1048
+ { scheme: "bearer", type: "http" },
1049
+ { name: "x-api-key", type: "apiKey" }
1050
+ ],
1051
+ url: "/v1/connections/{connectionId}/SelectObjects",
1052
+ ...options,
1053
+ headers: {
1054
+ "Content-Type": "application/json",
1055
+ ...options.headers
1056
+ }
1057
+ });
1058
+ var connectionsGetConnectionObjects = (options) => (options.client ?? client).get({
1059
+ security: [
1060
+ { scheme: "bearer", type: "http" },
1061
+ { name: "x-api-key", type: "apiKey" }
1062
+ ],
1063
+ url: "/v1/connections/{connectionId}/Objects",
1064
+ ...options
1065
+ });
1066
+ var connectionsCheckConnection = (options) => (options.client ?? client).get({
1067
+ security: [
1068
+ { scheme: "bearer", type: "http" },
1069
+ { name: "x-api-key", type: "apiKey" }
1070
+ ],
1071
+ url: "/v1/connections/{connectionId}/Check",
1072
+ ...options
1073
+ });
1074
+ var connectionsGetSignInUrl = (options) => (options.client ?? client).post({
1075
+ security: [
1076
+ { scheme: "bearer", type: "http" },
1077
+ { name: "x-api-key", type: "apiKey" }
1078
+ ],
1079
+ url: "/v1/connections/GetSignInUrl",
1080
+ ...options,
1081
+ headers: {
1082
+ "Content-Type": "application/json",
1083
+ ...options.headers
1084
+ }
1085
+ });
1086
+ var connectionsGetAccessToken = (options) => (options.client ?? client).get({
1087
+ security: [
1088
+ { scheme: "bearer", type: "http" },
1089
+ { name: "x-api-key", type: "apiKey" }
1090
+ ],
1091
+ url: "/v1/connections/AccessToken/{state}",
1092
+ ...options
1093
+ });
1094
+ var toolsListTools = (options) => (options?.client ?? client).get({
1095
+ security: [
1096
+ { scheme: "bearer", type: "http" },
1097
+ { name: "x-api-key", type: "apiKey" }
1098
+ ],
1099
+ url: "/v1/tools",
1100
+ ...options
1101
+ });
1102
+ var toolsGetTool = (options) => (options.client ?? client).get({
1103
+ security: [
1104
+ { scheme: "bearer", type: "http" },
1105
+ { name: "x-api-key", type: "apiKey" }
1106
+ ],
1107
+ url: "/v1/tools/{toolSlug}",
1108
+ ...options
1109
+ });
1110
+ var toolsExecuteTool = (options) => (options.client ?? client).post({
1111
+ security: [
1112
+ { scheme: "bearer", type: "http" },
1113
+ { name: "x-api-key", type: "apiKey" }
1114
+ ],
1115
+ url: "/v1/tools/{toolSlug}/execute",
1116
+ ...options,
1117
+ headers: {
1118
+ "Content-Type": "application/json",
1119
+ ...options.headers
1120
+ }
1121
+ });
1122
+ var toolsetsListToolsets = (options) => (options?.client ?? client).get({
1123
+ security: [
1124
+ { scheme: "bearer", type: "http" },
1125
+ { name: "x-api-key", type: "apiKey" }
1126
+ ],
1127
+ url: "/v1/toolsets",
1128
+ ...options
1129
+ });
1130
+ var toolsetsCreateToolset = (options) => (options.client ?? client).post({
1131
+ security: [
1132
+ { scheme: "bearer", type: "http" },
1133
+ { name: "x-api-key", type: "apiKey" }
1134
+ ],
1135
+ url: "/v1/toolsets",
1136
+ ...options,
1137
+ headers: {
1138
+ "Content-Type": "application/json",
1139
+ ...options.headers
1140
+ }
1141
+ });
1142
+ var toolsetsDeleteToolset = (options) => (options.client ?? client).delete({
1143
+ security: [
1144
+ { scheme: "bearer", type: "http" },
1145
+ { name: "x-api-key", type: "apiKey" }
1146
+ ],
1147
+ url: "/v1/toolsets/{toolsetId}",
1148
+ ...options
1149
+ });
1150
+ var toolsetsGetToolset = (options) => (options.client ?? client).get({
1151
+ security: [
1152
+ { scheme: "bearer", type: "http" },
1153
+ { name: "x-api-key", type: "apiKey" }
1154
+ ],
1155
+ url: "/v1/toolsets/{toolsetId}",
1156
+ ...options
1157
+ });
1158
+ var toolsetsUpdateToolset = (options) => (options.client ?? client).patch({
1159
+ security: [
1160
+ { scheme: "bearer", type: "http" },
1161
+ { name: "x-api-key", type: "apiKey" }
1162
+ ],
1163
+ url: "/v1/toolsets/{toolsetId}",
1164
+ ...options,
1165
+ headers: {
1166
+ "Content-Type": "application/json",
1167
+ ...options.headers
1168
+ }
1169
+ });
1170
+
1171
+ // src/index.ts
1172
+ function createEnginiClient(options) {
1173
+ return createClient(
1174
+ createConfig({
1175
+ baseUrl: options.baseUrl,
1176
+ ...options.token !== void 0 ? { auth: options.token } : {}
1177
+ })
1178
+ );
1179
+ }
1180
+
1181
+ exports.applicationsGetApplication = applicationsGetApplication;
1182
+ exports.applicationsListApplications = applicationsListApplications;
1183
+ exports.authWhoAmI = authWhoAmI;
1184
+ exports.connectionsCheckConnection = connectionsCheckConnection;
1185
+ exports.connectionsClearDefaultConnection = connectionsClearDefaultConnection;
1186
+ exports.connectionsCreateConnection = connectionsCreateConnection;
1187
+ exports.connectionsDeleteConnection = connectionsDeleteConnection;
1188
+ exports.connectionsGetAccessToken = connectionsGetAccessToken;
1189
+ exports.connectionsGetConnection = connectionsGetConnection;
1190
+ exports.connectionsGetConnectionObjects = connectionsGetConnectionObjects;
1191
+ exports.connectionsGetConnections = connectionsGetConnections;
1192
+ exports.connectionsGetDefaultConnections = connectionsGetDefaultConnections;
1193
+ exports.connectionsGetRefreshStatus = connectionsGetRefreshStatus;
1194
+ exports.connectionsGetSignInUrl = connectionsGetSignInUrl;
1195
+ exports.connectionsRefreshObjects = connectionsRefreshObjects;
1196
+ exports.connectionsReplaceConnection = connectionsReplaceConnection;
1197
+ exports.connectionsSelectObjects = connectionsSelectObjects;
1198
+ exports.connectionsSetDefaultConnection = connectionsSetDefaultConnection;
1199
+ exports.connectionsUpdateConnection = connectionsUpdateConnection;
1200
+ exports.createEnginiClient = createEnginiClient;
1201
+ exports.solutionsArchiveSolution = solutionsArchiveSolution;
1202
+ exports.solutionsBuildManifest = solutionsBuildManifest;
1203
+ exports.solutionsCreateSolution = solutionsCreateSolution;
1204
+ exports.solutionsGetInstallationDetail = solutionsGetInstallationDetail;
1205
+ exports.solutionsGetInstallationResources = solutionsGetInstallationResources;
1206
+ exports.solutionsGetInstallations = solutionsGetInstallations;
1207
+ exports.solutionsGetPublishedSolutions = solutionsGetPublishedSolutions;
1208
+ exports.solutionsGetSolutionBySlug = solutionsGetSolutionBySlug;
1209
+ exports.solutionsInstallSolution = solutionsInstallSolution;
1210
+ exports.solutionsPublishSolution = solutionsPublishSolution;
1211
+ exports.solutionsUninstallSolution = solutionsUninstallSolution;
1212
+ exports.solutionsUpdateInstallation = solutionsUpdateInstallation;
1213
+ exports.solutionsUpdateSolution = solutionsUpdateSolution;
1214
+ exports.toolsExecuteTool = toolsExecuteTool;
1215
+ exports.toolsGetTool = toolsGetTool;
1216
+ exports.toolsListTools = toolsListTools;
1217
+ exports.toolsetsCreateToolset = toolsetsCreateToolset;
1218
+ exports.toolsetsDeleteToolset = toolsetsDeleteToolset;
1219
+ exports.toolsetsGetToolset = toolsetsGetToolset;
1220
+ exports.toolsetsListToolsets = toolsetsListToolsets;
1221
+ exports.toolsetsUpdateToolset = toolsetsUpdateToolset;
1222
+ //# sourceMappingURL=index.cjs.map
1223
+ //# sourceMappingURL=index.cjs.map