@zilfu/sdk 0.0.1

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,1396 @@
1
+ 'use strict';
2
+
3
+ // src/generated/core/bodySerializer.gen.ts
4
+ var serializeFormDataPair = (data, key, value) => {
5
+ if (typeof value === "string" || value instanceof Blob) {
6
+ data.append(key, value);
7
+ } else if (value instanceof Date) {
8
+ data.append(key, value.toISOString());
9
+ } else {
10
+ data.append(key, JSON.stringify(value));
11
+ }
12
+ };
13
+ var formDataBodySerializer = {
14
+ bodySerializer: (body) => {
15
+ const data = new FormData();
16
+ Object.entries(body).forEach(([key, value]) => {
17
+ if (value === void 0 || value === null) {
18
+ return;
19
+ }
20
+ if (Array.isArray(value)) {
21
+ value.forEach((v) => serializeFormDataPair(data, key, v));
22
+ } else {
23
+ serializeFormDataPair(data, key, value);
24
+ }
25
+ });
26
+ return data;
27
+ }
28
+ };
29
+ var jsonBodySerializer = {
30
+ bodySerializer: (body) => JSON.stringify(
31
+ body,
32
+ (_key, value) => typeof value === "bigint" ? value.toString() : value
33
+ )
34
+ };
35
+
36
+ // src/generated/core/serverSentEvents.gen.ts
37
+ var createSseClient = ({
38
+ onRequest,
39
+ onSseError,
40
+ onSseEvent,
41
+ responseTransformer,
42
+ responseValidator,
43
+ sseDefaultRetryDelay,
44
+ sseMaxRetryAttempts,
45
+ sseMaxRetryDelay,
46
+ sseSleepFn,
47
+ url,
48
+ ...options
49
+ }) => {
50
+ let lastEventId;
51
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
52
+ const createStream = async function* () {
53
+ let retryDelay = sseDefaultRetryDelay ?? 3e3;
54
+ let attempt = 0;
55
+ const signal = options.signal ?? new AbortController().signal;
56
+ while (true) {
57
+ if (signal.aborted) break;
58
+ attempt++;
59
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
60
+ if (lastEventId !== void 0) {
61
+ headers.set("Last-Event-ID", lastEventId);
62
+ }
63
+ try {
64
+ const requestInit = {
65
+ redirect: "follow",
66
+ ...options,
67
+ body: options.serializedBody,
68
+ headers,
69
+ signal
70
+ };
71
+ let request = new Request(url, requestInit);
72
+ if (onRequest) {
73
+ request = await onRequest(url, requestInit);
74
+ }
75
+ const _fetch = options.fetch ?? globalThis.fetch;
76
+ const response = await _fetch(request);
77
+ if (!response.ok)
78
+ throw new Error(
79
+ `SSE failed: ${response.status} ${response.statusText}`
80
+ );
81
+ if (!response.body) throw new Error("No body in SSE response");
82
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
83
+ let buffer = "";
84
+ const abortHandler = () => {
85
+ try {
86
+ reader.cancel();
87
+ } catch {
88
+ }
89
+ };
90
+ signal.addEventListener("abort", abortHandler);
91
+ try {
92
+ while (true) {
93
+ const { done, value } = await reader.read();
94
+ if (done) break;
95
+ buffer += value;
96
+ const chunks = buffer.split("\n\n");
97
+ buffer = chunks.pop() ?? "";
98
+ for (const chunk of chunks) {
99
+ const lines = chunk.split("\n");
100
+ const dataLines = [];
101
+ let eventName;
102
+ for (const line of lines) {
103
+ if (line.startsWith("data:")) {
104
+ dataLines.push(line.replace(/^data:\s*/, ""));
105
+ } else if (line.startsWith("event:")) {
106
+ eventName = line.replace(/^event:\s*/, "");
107
+ } else if (line.startsWith("id:")) {
108
+ lastEventId = line.replace(/^id:\s*/, "");
109
+ } else if (line.startsWith("retry:")) {
110
+ const parsed = Number.parseInt(
111
+ line.replace(/^retry:\s*/, ""),
112
+ 10
113
+ );
114
+ if (!Number.isNaN(parsed)) {
115
+ retryDelay = parsed;
116
+ }
117
+ }
118
+ }
119
+ let data;
120
+ let parsedJson = false;
121
+ if (dataLines.length) {
122
+ const rawData = dataLines.join("\n");
123
+ try {
124
+ data = JSON.parse(rawData);
125
+ parsedJson = true;
126
+ } catch {
127
+ data = rawData;
128
+ }
129
+ }
130
+ if (parsedJson) {
131
+ if (responseValidator) {
132
+ await responseValidator(data);
133
+ }
134
+ if (responseTransformer) {
135
+ data = await responseTransformer(data);
136
+ }
137
+ }
138
+ onSseEvent?.({
139
+ data,
140
+ event: eventName,
141
+ id: lastEventId,
142
+ retry: retryDelay
143
+ });
144
+ if (dataLines.length) {
145
+ yield data;
146
+ }
147
+ }
148
+ }
149
+ } finally {
150
+ signal.removeEventListener("abort", abortHandler);
151
+ reader.releaseLock();
152
+ }
153
+ break;
154
+ } catch (error) {
155
+ onSseError?.(error);
156
+ if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
157
+ break;
158
+ }
159
+ const backoff = Math.min(
160
+ retryDelay * 2 ** (attempt - 1),
161
+ sseMaxRetryDelay ?? 3e4
162
+ );
163
+ await sleep(backoff);
164
+ }
165
+ }
166
+ };
167
+ const stream = createStream();
168
+ return { stream };
169
+ };
170
+
171
+ // src/generated/core/pathSerializer.gen.ts
172
+ var separatorArrayExplode = (style) => {
173
+ switch (style) {
174
+ case "label":
175
+ return ".";
176
+ case "matrix":
177
+ return ";";
178
+ case "simple":
179
+ return ",";
180
+ default:
181
+ return "&";
182
+ }
183
+ };
184
+ var separatorArrayNoExplode = (style) => {
185
+ switch (style) {
186
+ case "form":
187
+ return ",";
188
+ case "pipeDelimited":
189
+ return "|";
190
+ case "spaceDelimited":
191
+ return "%20";
192
+ default:
193
+ return ",";
194
+ }
195
+ };
196
+ var separatorObjectExplode = (style) => {
197
+ switch (style) {
198
+ case "label":
199
+ return ".";
200
+ case "matrix":
201
+ return ";";
202
+ case "simple":
203
+ return ",";
204
+ default:
205
+ return "&";
206
+ }
207
+ };
208
+ var serializeArrayParam = ({
209
+ allowReserved,
210
+ explode,
211
+ name,
212
+ style,
213
+ value
214
+ }) => {
215
+ if (!explode) {
216
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
217
+ switch (style) {
218
+ case "label":
219
+ return `.${joinedValues2}`;
220
+ case "matrix":
221
+ return `;${name}=${joinedValues2}`;
222
+ case "simple":
223
+ return joinedValues2;
224
+ default:
225
+ return `${name}=${joinedValues2}`;
226
+ }
227
+ }
228
+ const separator = separatorArrayExplode(style);
229
+ const joinedValues = value.map((v) => {
230
+ if (style === "label" || style === "simple") {
231
+ return allowReserved ? v : encodeURIComponent(v);
232
+ }
233
+ return serializePrimitiveParam({
234
+ allowReserved,
235
+ name,
236
+ value: v
237
+ });
238
+ }).join(separator);
239
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
240
+ };
241
+ var serializePrimitiveParam = ({
242
+ allowReserved,
243
+ name,
244
+ value
245
+ }) => {
246
+ if (value === void 0 || value === null) {
247
+ return "";
248
+ }
249
+ if (typeof value === "object") {
250
+ throw new Error(
251
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
252
+ );
253
+ }
254
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
255
+ };
256
+ var serializeObjectParam = ({
257
+ allowReserved,
258
+ explode,
259
+ name,
260
+ style,
261
+ value,
262
+ valueOnly
263
+ }) => {
264
+ if (value instanceof Date) {
265
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
266
+ }
267
+ if (style !== "deepObject" && !explode) {
268
+ let values = [];
269
+ Object.entries(value).forEach(([key, v]) => {
270
+ values = [
271
+ ...values,
272
+ key,
273
+ allowReserved ? v : encodeURIComponent(v)
274
+ ];
275
+ });
276
+ const joinedValues2 = values.join(",");
277
+ switch (style) {
278
+ case "form":
279
+ return `${name}=${joinedValues2}`;
280
+ case "label":
281
+ return `.${joinedValues2}`;
282
+ case "matrix":
283
+ return `;${name}=${joinedValues2}`;
284
+ default:
285
+ return joinedValues2;
286
+ }
287
+ }
288
+ const separator = separatorObjectExplode(style);
289
+ const joinedValues = Object.entries(value).map(
290
+ ([key, v]) => serializePrimitiveParam({
291
+ allowReserved,
292
+ name: style === "deepObject" ? `${name}[${key}]` : key,
293
+ value: v
294
+ })
295
+ ).join(separator);
296
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
297
+ };
298
+
299
+ // src/generated/core/utils.gen.ts
300
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
301
+ var defaultPathSerializer = ({ path, url: _url }) => {
302
+ let url = _url;
303
+ const matches = _url.match(PATH_PARAM_RE);
304
+ if (matches) {
305
+ for (const match of matches) {
306
+ let explode = false;
307
+ let name = match.substring(1, match.length - 1);
308
+ let style = "simple";
309
+ if (name.endsWith("*")) {
310
+ explode = true;
311
+ name = name.substring(0, name.length - 1);
312
+ }
313
+ if (name.startsWith(".")) {
314
+ name = name.substring(1);
315
+ style = "label";
316
+ } else if (name.startsWith(";")) {
317
+ name = name.substring(1);
318
+ style = "matrix";
319
+ }
320
+ const value = path[name];
321
+ if (value === void 0 || value === null) {
322
+ continue;
323
+ }
324
+ if (Array.isArray(value)) {
325
+ url = url.replace(
326
+ match,
327
+ serializeArrayParam({ explode, name, style, value })
328
+ );
329
+ continue;
330
+ }
331
+ if (typeof value === "object") {
332
+ url = url.replace(
333
+ match,
334
+ serializeObjectParam({
335
+ explode,
336
+ name,
337
+ style,
338
+ value,
339
+ valueOnly: true
340
+ })
341
+ );
342
+ continue;
343
+ }
344
+ if (style === "matrix") {
345
+ url = url.replace(
346
+ match,
347
+ `;${serializePrimitiveParam({
348
+ name,
349
+ value
350
+ })}`
351
+ );
352
+ continue;
353
+ }
354
+ const replaceValue = encodeURIComponent(
355
+ style === "label" ? `.${value}` : value
356
+ );
357
+ url = url.replace(match, replaceValue);
358
+ }
359
+ }
360
+ return url;
361
+ };
362
+ var getUrl = ({
363
+ baseUrl,
364
+ path,
365
+ query,
366
+ querySerializer,
367
+ url: _url
368
+ }) => {
369
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
370
+ let url = (baseUrl ?? "") + pathUrl;
371
+ if (path) {
372
+ url = defaultPathSerializer({ path, url });
373
+ }
374
+ let search = query ? querySerializer(query) : "";
375
+ if (search.startsWith("?")) {
376
+ search = search.substring(1);
377
+ }
378
+ if (search) {
379
+ url += `?${search}`;
380
+ }
381
+ return url;
382
+ };
383
+ function getValidRequestBody(options) {
384
+ const hasBody = options.body !== void 0;
385
+ const isSerializedBody = hasBody && options.bodySerializer;
386
+ if (isSerializedBody) {
387
+ if ("serializedBody" in options) {
388
+ const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
389
+ return hasSerializedBody ? options.serializedBody : null;
390
+ }
391
+ return options.body !== "" ? options.body : null;
392
+ }
393
+ if (hasBody) {
394
+ return options.body;
395
+ }
396
+ return void 0;
397
+ }
398
+
399
+ // src/generated/core/auth.gen.ts
400
+ var getAuthToken = async (auth, callback) => {
401
+ const token = typeof callback === "function" ? await callback(auth) : callback;
402
+ if (!token) {
403
+ return;
404
+ }
405
+ if (auth.scheme === "bearer") {
406
+ return `Bearer ${token}`;
407
+ }
408
+ if (auth.scheme === "basic") {
409
+ return `Basic ${btoa(token)}`;
410
+ }
411
+ return token;
412
+ };
413
+
414
+ // src/generated/client/utils.gen.ts
415
+ var createQuerySerializer = ({
416
+ allowReserved,
417
+ array,
418
+ object
419
+ } = {}) => {
420
+ const querySerializer = (queryParams) => {
421
+ const search = [];
422
+ if (queryParams && typeof queryParams === "object") {
423
+ for (const name in queryParams) {
424
+ const value = queryParams[name];
425
+ if (value === void 0 || value === null) {
426
+ continue;
427
+ }
428
+ if (Array.isArray(value)) {
429
+ const serializedArray = serializeArrayParam({
430
+ allowReserved,
431
+ explode: true,
432
+ name,
433
+ style: "form",
434
+ value,
435
+ ...array
436
+ });
437
+ if (serializedArray) search.push(serializedArray);
438
+ } else if (typeof value === "object") {
439
+ const serializedObject = serializeObjectParam({
440
+ allowReserved,
441
+ explode: true,
442
+ name,
443
+ style: "deepObject",
444
+ value,
445
+ ...object
446
+ });
447
+ if (serializedObject) search.push(serializedObject);
448
+ } else {
449
+ const serializedPrimitive = serializePrimitiveParam({
450
+ allowReserved,
451
+ name,
452
+ value
453
+ });
454
+ if (serializedPrimitive) search.push(serializedPrimitive);
455
+ }
456
+ }
457
+ }
458
+ return search.join("&");
459
+ };
460
+ return querySerializer;
461
+ };
462
+ var getParseAs = (contentType) => {
463
+ if (!contentType) {
464
+ return "stream";
465
+ }
466
+ const cleanContent = contentType.split(";")[0]?.trim();
467
+ if (!cleanContent) {
468
+ return;
469
+ }
470
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
471
+ return "json";
472
+ }
473
+ if (cleanContent === "multipart/form-data") {
474
+ return "formData";
475
+ }
476
+ if (["application/", "audio/", "image/", "video/"].some(
477
+ (type) => cleanContent.startsWith(type)
478
+ )) {
479
+ return "blob";
480
+ }
481
+ if (cleanContent.startsWith("text/")) {
482
+ return "text";
483
+ }
484
+ return;
485
+ };
486
+ var checkForExistence = (options, name) => {
487
+ if (!name) {
488
+ return false;
489
+ }
490
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
491
+ return true;
492
+ }
493
+ return false;
494
+ };
495
+ var setAuthParams = async ({
496
+ security,
497
+ ...options
498
+ }) => {
499
+ for (const auth of security) {
500
+ if (checkForExistence(options, auth.name)) {
501
+ continue;
502
+ }
503
+ const token = await getAuthToken(auth, options.auth);
504
+ if (!token) {
505
+ continue;
506
+ }
507
+ const name = auth.name ?? "Authorization";
508
+ switch (auth.in) {
509
+ case "query":
510
+ if (!options.query) {
511
+ options.query = {};
512
+ }
513
+ options.query[name] = token;
514
+ break;
515
+ case "cookie":
516
+ options.headers.append("Cookie", `${name}=${token}`);
517
+ break;
518
+ case "header":
519
+ default:
520
+ options.headers.set(name, token);
521
+ break;
522
+ }
523
+ }
524
+ };
525
+ var buildUrl = (options) => getUrl({
526
+ baseUrl: options.baseUrl,
527
+ path: options.path,
528
+ query: options.query,
529
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
530
+ url: options.url
531
+ });
532
+ var mergeConfigs = (a, b) => {
533
+ const config = { ...a, ...b };
534
+ if (config.baseUrl?.endsWith("/")) {
535
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
536
+ }
537
+ config.headers = mergeHeaders(a.headers, b.headers);
538
+ return config;
539
+ };
540
+ var headersEntries = (headers) => {
541
+ const entries = [];
542
+ headers.forEach((value, key) => {
543
+ entries.push([key, value]);
544
+ });
545
+ return entries;
546
+ };
547
+ var mergeHeaders = (...headers) => {
548
+ const mergedHeaders = new Headers();
549
+ for (const header of headers) {
550
+ if (!header) {
551
+ continue;
552
+ }
553
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
554
+ for (const [key, value] of iterator) {
555
+ if (value === null) {
556
+ mergedHeaders.delete(key);
557
+ } else if (Array.isArray(value)) {
558
+ for (const v of value) {
559
+ mergedHeaders.append(key, v);
560
+ }
561
+ } else if (value !== void 0) {
562
+ mergedHeaders.set(
563
+ key,
564
+ typeof value === "object" ? JSON.stringify(value) : value
565
+ );
566
+ }
567
+ }
568
+ }
569
+ return mergedHeaders;
570
+ };
571
+ var Interceptors = class {
572
+ fns = [];
573
+ clear() {
574
+ this.fns = [];
575
+ }
576
+ eject(id) {
577
+ const index = this.getInterceptorIndex(id);
578
+ if (this.fns[index]) {
579
+ this.fns[index] = null;
580
+ }
581
+ }
582
+ exists(id) {
583
+ const index = this.getInterceptorIndex(id);
584
+ return Boolean(this.fns[index]);
585
+ }
586
+ getInterceptorIndex(id) {
587
+ if (typeof id === "number") {
588
+ return this.fns[id] ? id : -1;
589
+ }
590
+ return this.fns.indexOf(id);
591
+ }
592
+ update(id, fn) {
593
+ const index = this.getInterceptorIndex(id);
594
+ if (this.fns[index]) {
595
+ this.fns[index] = fn;
596
+ return id;
597
+ }
598
+ return false;
599
+ }
600
+ use(fn) {
601
+ this.fns.push(fn);
602
+ return this.fns.length - 1;
603
+ }
604
+ };
605
+ var createInterceptors = () => ({
606
+ error: new Interceptors(),
607
+ request: new Interceptors(),
608
+ response: new Interceptors()
609
+ });
610
+ var defaultQuerySerializer = createQuerySerializer({
611
+ allowReserved: false,
612
+ array: {
613
+ explode: true,
614
+ style: "form"
615
+ },
616
+ object: {
617
+ explode: true,
618
+ style: "deepObject"
619
+ }
620
+ });
621
+ var defaultHeaders = {
622
+ "Content-Type": "application/json"
623
+ };
624
+ var createConfig = (override = {}) => ({
625
+ ...jsonBodySerializer,
626
+ headers: defaultHeaders,
627
+ parseAs: "auto",
628
+ querySerializer: defaultQuerySerializer,
629
+ ...override
630
+ });
631
+
632
+ // src/generated/client/client.gen.ts
633
+ var createClient = (config = {}) => {
634
+ let _config = mergeConfigs(createConfig(), config);
635
+ const getConfig = () => ({ ..._config });
636
+ const setConfig = (config2) => {
637
+ _config = mergeConfigs(_config, config2);
638
+ return getConfig();
639
+ };
640
+ const interceptors = createInterceptors();
641
+ const beforeRequest = async (options) => {
642
+ const opts = {
643
+ ..._config,
644
+ ...options,
645
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
646
+ headers: mergeHeaders(_config.headers, options.headers),
647
+ serializedBody: void 0
648
+ };
649
+ if (opts.security) {
650
+ await setAuthParams({
651
+ ...opts,
652
+ security: opts.security
653
+ });
654
+ }
655
+ if (opts.requestValidator) {
656
+ await opts.requestValidator(opts);
657
+ }
658
+ if (opts.body !== void 0 && opts.bodySerializer) {
659
+ opts.serializedBody = opts.bodySerializer(opts.body);
660
+ }
661
+ if (opts.body === void 0 || opts.serializedBody === "") {
662
+ opts.headers.delete("Content-Type");
663
+ }
664
+ const url = buildUrl(opts);
665
+ return { opts, url };
666
+ };
667
+ const request = async (options) => {
668
+ const { opts, url } = await beforeRequest(options);
669
+ const requestInit = {
670
+ redirect: "follow",
671
+ ...opts,
672
+ body: getValidRequestBody(opts)
673
+ };
674
+ let request2 = new Request(url, requestInit);
675
+ for (const fn of interceptors.request.fns) {
676
+ if (fn) {
677
+ request2 = await fn(request2, opts);
678
+ }
679
+ }
680
+ const _fetch = opts.fetch;
681
+ let response = await _fetch(request2);
682
+ for (const fn of interceptors.response.fns) {
683
+ if (fn) {
684
+ response = await fn(response, request2, opts);
685
+ }
686
+ }
687
+ const result = {
688
+ request: request2,
689
+ response
690
+ };
691
+ if (response.ok) {
692
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
693
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
694
+ let emptyData;
695
+ switch (parseAs) {
696
+ case "arrayBuffer":
697
+ case "blob":
698
+ case "text":
699
+ emptyData = await response[parseAs]();
700
+ break;
701
+ case "formData":
702
+ emptyData = new FormData();
703
+ break;
704
+ case "stream":
705
+ emptyData = response.body;
706
+ break;
707
+ case "json":
708
+ default:
709
+ emptyData = {};
710
+ break;
711
+ }
712
+ return opts.responseStyle === "data" ? emptyData : {
713
+ data: emptyData,
714
+ ...result
715
+ };
716
+ }
717
+ let data;
718
+ switch (parseAs) {
719
+ case "arrayBuffer":
720
+ case "blob":
721
+ case "formData":
722
+ case "json":
723
+ case "text":
724
+ data = await response[parseAs]();
725
+ break;
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
+ }
751
+ const error = jsonError ?? textError;
752
+ let finalError = error;
753
+ for (const fn of interceptors.error.fns) {
754
+ if (fn) {
755
+ finalError = await fn(error, response, request2, opts);
756
+ }
757
+ }
758
+ finalError = finalError || {};
759
+ if (opts.throwOnError) {
760
+ throw finalError;
761
+ }
762
+ return opts.responseStyle === "data" ? void 0 : {
763
+ error: finalError,
764
+ ...result
765
+ };
766
+ };
767
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
768
+ const makeSseFn = (method) => async (options) => {
769
+ const { opts, url } = await beforeRequest(options);
770
+ return createSseClient({
771
+ ...opts,
772
+ body: opts.body,
773
+ headers: opts.headers,
774
+ method,
775
+ onRequest: async (url2, init) => {
776
+ let request2 = new Request(url2, init);
777
+ for (const fn of interceptors.request.fns) {
778
+ if (fn) {
779
+ request2 = await fn(request2, opts);
780
+ }
781
+ }
782
+ return request2;
783
+ },
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
+
816
+ // src/generated/client.gen.ts
817
+ var client = createClient(createConfig({
818
+ baseUrl: "https://zilfu.app/api"
819
+ }));
820
+
821
+ // src/client.ts
822
+ function createZilfuClient(options) {
823
+ const { baseUrl, token, fetch: fetchImpl } = options;
824
+ client.setConfig({
825
+ baseUrl,
826
+ auth: typeof token === "function" ? token : token,
827
+ ...fetchImpl ? { fetch: fetchImpl } : {}
828
+ });
829
+ }
830
+
831
+ // src/generated/sdk.gen.ts
832
+ var accountsDestroyMany = (options) => {
833
+ return (options.client ?? client).delete({
834
+ security: [
835
+ {
836
+ scheme: "bearer",
837
+ type: "http"
838
+ }
839
+ ],
840
+ url: "/spaces/{space}/accounts",
841
+ ...options
842
+ });
843
+ };
844
+ var accountsIndex = (options) => {
845
+ return (options.client ?? client).get({
846
+ security: [
847
+ {
848
+ scheme: "bearer",
849
+ type: "http"
850
+ }
851
+ ],
852
+ url: "/spaces/{space}/accounts",
853
+ ...options
854
+ });
855
+ };
856
+ var accountsActivate = (options) => {
857
+ return (options.client ?? client).patch({
858
+ security: [
859
+ {
860
+ scheme: "bearer",
861
+ type: "http"
862
+ }
863
+ ],
864
+ url: "/spaces/{space}/accounts/{account}/activate",
865
+ ...options
866
+ });
867
+ };
868
+ var accountsBoards = (options) => {
869
+ return (options.client ?? client).get({
870
+ security: [
871
+ {
872
+ scheme: "bearer",
873
+ type: "http"
874
+ }
875
+ ],
876
+ url: "/spaces/{space}/accounts/{account}/boards",
877
+ ...options
878
+ });
879
+ };
880
+ var accountsDestroy = (options) => {
881
+ return (options.client ?? client).delete({
882
+ security: [
883
+ {
884
+ scheme: "bearer",
885
+ type: "http"
886
+ }
887
+ ],
888
+ url: "/spaces/{space}/accounts/{account}",
889
+ ...options
890
+ });
891
+ };
892
+ var apiTokensStore = (options) => {
893
+ return (options.client ?? client).post({
894
+ security: [
895
+ {
896
+ scheme: "bearer",
897
+ type: "http"
898
+ }
899
+ ],
900
+ url: "/api-tokens",
901
+ ...options,
902
+ headers: {
903
+ "Content-Type": "application/json",
904
+ ...options.headers
905
+ }
906
+ });
907
+ };
908
+ var apiTokensDestroy = (options) => {
909
+ return (options.client ?? client).delete({
910
+ security: [
911
+ {
912
+ scheme: "bearer",
913
+ type: "http"
914
+ }
915
+ ],
916
+ url: "/api-tokens/{tokenId}",
917
+ ...options
918
+ });
919
+ };
920
+ var bioBlocksIndex = (options) => {
921
+ return (options.client ?? client).get({
922
+ security: [
923
+ {
924
+ scheme: "bearer",
925
+ type: "http"
926
+ }
927
+ ],
928
+ url: "/spaces/{space}/bio/blocks",
929
+ ...options
930
+ });
931
+ };
932
+ var bioBlocksStore = (options) => {
933
+ return (options.client ?? client).post({
934
+ security: [
935
+ {
936
+ scheme: "bearer",
937
+ type: "http"
938
+ }
939
+ ],
940
+ url: "/spaces/{space}/bio/blocks",
941
+ ...options,
942
+ headers: {
943
+ "Content-Type": "application/json",
944
+ ...options.headers
945
+ }
946
+ });
947
+ };
948
+ var bioBlocksDestroy = (options) => {
949
+ return (options.client ?? client).delete({
950
+ security: [
951
+ {
952
+ scheme: "bearer",
953
+ type: "http"
954
+ }
955
+ ],
956
+ url: "/spaces/{space}/bio/blocks/{block}",
957
+ ...options
958
+ });
959
+ };
960
+ var bioBlocksUpdate = (options) => {
961
+ return (options.client ?? client).put({
962
+ security: [
963
+ {
964
+ scheme: "bearer",
965
+ type: "http"
966
+ }
967
+ ],
968
+ url: "/spaces/{space}/bio/blocks/{block}",
969
+ ...options,
970
+ headers: {
971
+ "Content-Type": "application/json",
972
+ ...options.headers
973
+ }
974
+ });
975
+ };
976
+ var bioBlocksReorder = (options) => {
977
+ return (options.client ?? client).post({
978
+ security: [
979
+ {
980
+ scheme: "bearer",
981
+ type: "http"
982
+ }
983
+ ],
984
+ url: "/spaces/{space}/bio/blocks/{block}/reorder",
985
+ ...options,
986
+ headers: {
987
+ "Content-Type": "application/json",
988
+ ...options.headers
989
+ }
990
+ });
991
+ };
992
+ var bioShow = (options) => {
993
+ return (options.client ?? client).get({
994
+ security: [
995
+ {
996
+ scheme: "bearer",
997
+ type: "http"
998
+ }
999
+ ],
1000
+ url: "/spaces/{space}/bio",
1001
+ ...options
1002
+ });
1003
+ };
1004
+ var bioStore = (options) => {
1005
+ return (options.client ?? client).post({
1006
+ security: [
1007
+ {
1008
+ scheme: "bearer",
1009
+ type: "http"
1010
+ }
1011
+ ],
1012
+ url: "/spaces/{space}/bio",
1013
+ ...options,
1014
+ headers: {
1015
+ "Content-Type": "application/json",
1016
+ ...options.headers
1017
+ }
1018
+ });
1019
+ };
1020
+ var bioUpdate = (options) => {
1021
+ return (options.client ?? client).put({
1022
+ security: [
1023
+ {
1024
+ scheme: "bearer",
1025
+ type: "http"
1026
+ }
1027
+ ],
1028
+ url: "/spaces/{space}/bio",
1029
+ ...options,
1030
+ headers: {
1031
+ "Content-Type": "application/json",
1032
+ ...options.headers
1033
+ }
1034
+ });
1035
+ };
1036
+ var bioAvatar = (options) => {
1037
+ return (options.client ?? client).post({
1038
+ ...formDataBodySerializer,
1039
+ security: [
1040
+ {
1041
+ scheme: "bearer",
1042
+ type: "http"
1043
+ }
1044
+ ],
1045
+ url: "/spaces/{space}/bio/avatar",
1046
+ ...options,
1047
+ headers: {
1048
+ "Content-Type": null,
1049
+ ...options.headers
1050
+ }
1051
+ });
1052
+ };
1053
+ var mediaStore = (options) => {
1054
+ return (options.client ?? client).post({
1055
+ ...formDataBodySerializer,
1056
+ security: [
1057
+ {
1058
+ scheme: "bearer",
1059
+ type: "http"
1060
+ }
1061
+ ],
1062
+ url: "/media",
1063
+ ...options,
1064
+ headers: {
1065
+ "Content-Type": null,
1066
+ ...options.headers
1067
+ }
1068
+ });
1069
+ };
1070
+ var mediaDestroy = (options) => {
1071
+ return (options.client ?? client).delete({
1072
+ security: [
1073
+ {
1074
+ scheme: "bearer",
1075
+ type: "http"
1076
+ }
1077
+ ],
1078
+ url: "/media/{media}",
1079
+ ...options
1080
+ });
1081
+ };
1082
+ var postsIndex = (options) => {
1083
+ return (options.client ?? client).get({
1084
+ security: [
1085
+ {
1086
+ scheme: "bearer",
1087
+ type: "http"
1088
+ }
1089
+ ],
1090
+ url: "/spaces/{space}/posts",
1091
+ ...options
1092
+ });
1093
+ };
1094
+ var postsStore = (options) => {
1095
+ return (options.client ?? client).post({
1096
+ security: [
1097
+ {
1098
+ scheme: "bearer",
1099
+ type: "http"
1100
+ }
1101
+ ],
1102
+ url: "/spaces/{space}/posts",
1103
+ ...options,
1104
+ headers: {
1105
+ "Content-Type": "application/json",
1106
+ ...options.headers
1107
+ }
1108
+ });
1109
+ };
1110
+ var postsDestroy = (options) => {
1111
+ return (options.client ?? client).delete({
1112
+ security: [
1113
+ {
1114
+ scheme: "bearer",
1115
+ type: "http"
1116
+ }
1117
+ ],
1118
+ url: "/spaces/{space}/posts/{post}",
1119
+ ...options
1120
+ });
1121
+ };
1122
+ var postsShow = (options) => {
1123
+ return (options.client ?? client).get({
1124
+ security: [
1125
+ {
1126
+ scheme: "bearer",
1127
+ type: "http"
1128
+ }
1129
+ ],
1130
+ url: "/spaces/{space}/posts/{post}",
1131
+ ...options
1132
+ });
1133
+ };
1134
+ var postsUpdate = (options) => {
1135
+ return (options.client ?? client).put({
1136
+ security: [
1137
+ {
1138
+ scheme: "bearer",
1139
+ type: "http"
1140
+ }
1141
+ ],
1142
+ url: "/spaces/{space}/posts/{post}",
1143
+ ...options,
1144
+ headers: {
1145
+ "Content-Type": "application/json",
1146
+ ...options.headers
1147
+ }
1148
+ });
1149
+ };
1150
+ var clustersUpdate = (options) => {
1151
+ return (options.client ?? client).put({
1152
+ security: [
1153
+ {
1154
+ scheme: "bearer",
1155
+ type: "http"
1156
+ }
1157
+ ],
1158
+ url: "/spaces/{space}/clusters/{cluster_id}",
1159
+ ...options,
1160
+ headers: {
1161
+ "Content-Type": "application/json",
1162
+ ...options.headers
1163
+ }
1164
+ });
1165
+ };
1166
+ var queueIndex = (options) => {
1167
+ return (options.client ?? client).get({
1168
+ security: [
1169
+ {
1170
+ scheme: "bearer",
1171
+ type: "http"
1172
+ }
1173
+ ],
1174
+ url: "/spaces/{space}/queue",
1175
+ ...options
1176
+ });
1177
+ };
1178
+ var slotsIndex = (options) => {
1179
+ return (options.client ?? client).get({
1180
+ security: [
1181
+ {
1182
+ scheme: "bearer",
1183
+ type: "http"
1184
+ }
1185
+ ],
1186
+ url: "/spaces/{space}/slots",
1187
+ ...options
1188
+ });
1189
+ };
1190
+ var slotsStore = (options) => {
1191
+ return (options.client ?? client).post({
1192
+ security: [
1193
+ {
1194
+ scheme: "bearer",
1195
+ type: "http"
1196
+ }
1197
+ ],
1198
+ url: "/spaces/{space}/slots",
1199
+ ...options,
1200
+ headers: {
1201
+ "Content-Type": "application/json",
1202
+ ...options.headers
1203
+ }
1204
+ });
1205
+ };
1206
+ var slotsDestroy = (options) => {
1207
+ return (options.client ?? client).delete({
1208
+ security: [
1209
+ {
1210
+ scheme: "bearer",
1211
+ type: "http"
1212
+ }
1213
+ ],
1214
+ url: "/spaces/{space}/slots/{slot}",
1215
+ ...options
1216
+ });
1217
+ };
1218
+ var spacesIndex = (options) => {
1219
+ return (options?.client ?? client).get({
1220
+ security: [
1221
+ {
1222
+ scheme: "bearer",
1223
+ type: "http"
1224
+ }
1225
+ ],
1226
+ url: "/spaces",
1227
+ ...options
1228
+ });
1229
+ };
1230
+ var spacesStore = (options) => {
1231
+ return (options.client ?? client).post({
1232
+ security: [
1233
+ {
1234
+ scheme: "bearer",
1235
+ type: "http"
1236
+ }
1237
+ ],
1238
+ url: "/spaces",
1239
+ ...options,
1240
+ headers: {
1241
+ "Content-Type": "application/json",
1242
+ ...options.headers
1243
+ }
1244
+ });
1245
+ };
1246
+ var spacesDestroy = (options) => {
1247
+ return (options.client ?? client).delete({
1248
+ security: [
1249
+ {
1250
+ scheme: "bearer",
1251
+ type: "http"
1252
+ }
1253
+ ],
1254
+ url: "/spaces/{space}",
1255
+ ...options
1256
+ });
1257
+ };
1258
+ var spacesShow = (options) => {
1259
+ return (options.client ?? client).get({
1260
+ security: [
1261
+ {
1262
+ scheme: "bearer",
1263
+ type: "http"
1264
+ }
1265
+ ],
1266
+ url: "/spaces/{space}",
1267
+ ...options
1268
+ });
1269
+ };
1270
+ var spacesUpdate = (options) => {
1271
+ return (options.client ?? client).put({
1272
+ security: [
1273
+ {
1274
+ scheme: "bearer",
1275
+ type: "http"
1276
+ }
1277
+ ],
1278
+ url: "/spaces/{space}",
1279
+ ...options,
1280
+ headers: {
1281
+ "Content-Type": "application/json",
1282
+ ...options.headers
1283
+ }
1284
+ });
1285
+ };
1286
+ var subscriptionShow = (options) => {
1287
+ return (options?.client ?? client).get({
1288
+ security: [
1289
+ {
1290
+ scheme: "bearer",
1291
+ type: "http"
1292
+ }
1293
+ ],
1294
+ url: "/subscription",
1295
+ ...options
1296
+ });
1297
+ };
1298
+ var webhooksIndex = (options) => {
1299
+ return (options.client ?? client).get({
1300
+ security: [
1301
+ {
1302
+ scheme: "bearer",
1303
+ type: "http"
1304
+ }
1305
+ ],
1306
+ url: "/spaces/{space}/webhooks",
1307
+ ...options
1308
+ });
1309
+ };
1310
+ var webhooksStore = (options) => {
1311
+ return (options.client ?? client).post({
1312
+ security: [
1313
+ {
1314
+ scheme: "bearer",
1315
+ type: "http"
1316
+ }
1317
+ ],
1318
+ url: "/spaces/{space}/webhooks",
1319
+ ...options,
1320
+ headers: {
1321
+ "Content-Type": "application/json",
1322
+ ...options.headers
1323
+ }
1324
+ });
1325
+ };
1326
+ var webhooksDestroy = (options) => {
1327
+ return (options.client ?? client).delete({
1328
+ security: [
1329
+ {
1330
+ scheme: "bearer",
1331
+ type: "http"
1332
+ }
1333
+ ],
1334
+ url: "/spaces/{space}/webhooks/{webhook}",
1335
+ ...options
1336
+ });
1337
+ };
1338
+ var webhooksUpdate = (options) => {
1339
+ return (options.client ?? client).put({
1340
+ security: [
1341
+ {
1342
+ scheme: "bearer",
1343
+ type: "http"
1344
+ }
1345
+ ],
1346
+ url: "/spaces/{space}/webhooks/{webhook}",
1347
+ ...options,
1348
+ headers: {
1349
+ "Content-Type": "application/json",
1350
+ ...options.headers
1351
+ }
1352
+ });
1353
+ };
1354
+
1355
+ exports.accountsActivate = accountsActivate;
1356
+ exports.accountsBoards = accountsBoards;
1357
+ exports.accountsDestroy = accountsDestroy;
1358
+ exports.accountsDestroyMany = accountsDestroyMany;
1359
+ exports.accountsIndex = accountsIndex;
1360
+ exports.apiTokensDestroy = apiTokensDestroy;
1361
+ exports.apiTokensStore = apiTokensStore;
1362
+ exports.bioAvatar = bioAvatar;
1363
+ exports.bioBlocksDestroy = bioBlocksDestroy;
1364
+ exports.bioBlocksIndex = bioBlocksIndex;
1365
+ exports.bioBlocksReorder = bioBlocksReorder;
1366
+ exports.bioBlocksStore = bioBlocksStore;
1367
+ exports.bioBlocksUpdate = bioBlocksUpdate;
1368
+ exports.bioShow = bioShow;
1369
+ exports.bioStore = bioStore;
1370
+ exports.bioUpdate = bioUpdate;
1371
+ exports.client = client;
1372
+ exports.clustersUpdate = clustersUpdate;
1373
+ exports.createZilfuClient = createZilfuClient;
1374
+ exports.mediaDestroy = mediaDestroy;
1375
+ exports.mediaStore = mediaStore;
1376
+ exports.postsDestroy = postsDestroy;
1377
+ exports.postsIndex = postsIndex;
1378
+ exports.postsShow = postsShow;
1379
+ exports.postsStore = postsStore;
1380
+ exports.postsUpdate = postsUpdate;
1381
+ exports.queueIndex = queueIndex;
1382
+ exports.slotsDestroy = slotsDestroy;
1383
+ exports.slotsIndex = slotsIndex;
1384
+ exports.slotsStore = slotsStore;
1385
+ exports.spacesDestroy = spacesDestroy;
1386
+ exports.spacesIndex = spacesIndex;
1387
+ exports.spacesShow = spacesShow;
1388
+ exports.spacesStore = spacesStore;
1389
+ exports.spacesUpdate = spacesUpdate;
1390
+ exports.subscriptionShow = subscriptionShow;
1391
+ exports.webhooksDestroy = webhooksDestroy;
1392
+ exports.webhooksIndex = webhooksIndex;
1393
+ exports.webhooksStore = webhooksStore;
1394
+ exports.webhooksUpdate = webhooksUpdate;
1395
+ //# sourceMappingURL=index.cjs.map
1396
+ //# sourceMappingURL=index.cjs.map