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