@aifeatures/backend 0.1.8 → 0.3.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 CHANGED
@@ -1,965 +1,7 @@
1
- // src/client/core/bodySerializer.gen.ts
2
- var jsonBodySerializer = {
3
- bodySerializer: (body) => JSON.stringify(
4
- body,
5
- (_key, value) => typeof value === "bigint" ? value.toString() : value
6
- )
7
- };
1
+ var j={bodySerializer:e=>JSON.stringify(e,(r,t)=>typeof t=="bigint"?t.toString():t)};var te={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},Tr=Object.entries(te);var M=({onRequest:e,onSseError:r,onSseEvent:t,responseTransformer:a,responseValidator:n,sseDefaultRetryDelay:u,sseMaxRetryAttempts:p,sseMaxRetryDelay:i,sseSleepFn:d,url:l,...o})=>{let y,P=d??(c=>new Promise(O=>setTimeout(O,c)));return{stream:async function*(){let c=u??3e3,O=0,C=o.signal??new AbortController().signal;for(;!C.aborted;){O++;let g=o.headers instanceof Headers?o.headers:new Headers(o.headers);y!==void 0&&g.set("Last-Event-ID",y);try{let T={redirect:"follow",...o,body:o.serializedBody,headers:g,signal:C},R=new Request(l,T);e&&(R=await e(l,T));let m=await(o.fetch??globalThis.fetch)(R);if(!m.ok)throw new Error(`SSE failed: ${m.status} ${m.statusText}`);if(!m.body)throw new Error("No body in SSE response");let f=m.body.pipeThrough(new TextDecoderStream).getReader(),x="",q=()=>{try{f.cancel()}catch{}};C.addEventListener("abort",q);try{for(;;){let{done:Y,value:Z}=await f.read();if(Y)break;x+=Z,x=x.replace(/\r\n/g,`
2
+ `).replace(/\r/g,`
3
+ `);let W=x.split(`
8
4
 
9
- // src/client/core/params.gen.ts
10
- var extraPrefixesMap = {
11
- $body_: "body",
12
- $headers_: "headers",
13
- $path_: "path",
14
- $query_: "query"
15
- };
16
- var extraPrefixes = Object.entries(extraPrefixesMap);
17
-
18
- // src/client/core/serverSentEvents.gen.ts
19
- var createSseClient = ({
20
- onRequest,
21
- onSseError,
22
- onSseEvent,
23
- responseTransformer,
24
- responseValidator,
25
- sseDefaultRetryDelay,
26
- sseMaxRetryAttempts,
27
- sseMaxRetryDelay,
28
- sseSleepFn,
29
- url,
30
- ...options
31
- }) => {
32
- let lastEventId;
33
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
34
- const createStream = async function* () {
35
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
36
- let attempt = 0;
37
- const signal = options.signal ?? new AbortController().signal;
38
- while (true) {
39
- if (signal.aborted) break;
40
- attempt++;
41
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
42
- if (lastEventId !== void 0) {
43
- headers.set("Last-Event-ID", lastEventId);
44
- }
45
- try {
46
- const requestInit = {
47
- redirect: "follow",
48
- ...options,
49
- body: options.serializedBody,
50
- headers,
51
- signal
52
- };
53
- let request = new Request(url, requestInit);
54
- if (onRequest) {
55
- request = await onRequest(url, requestInit);
56
- }
57
- const _fetch = options.fetch ?? globalThis.fetch;
58
- const response = await _fetch(request);
59
- if (!response.ok)
60
- throw new Error(
61
- `SSE failed: ${response.status} ${response.statusText}`
62
- );
63
- if (!response.body) throw new Error("No body in SSE response");
64
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
65
- let buffer = "";
66
- const abortHandler = () => {
67
- try {
68
- reader.cancel();
69
- } catch {
70
- }
71
- };
72
- signal.addEventListener("abort", abortHandler);
73
- try {
74
- while (true) {
75
- const { done, value } = await reader.read();
76
- if (done) break;
77
- buffer += value;
78
- buffer = buffer.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
79
- const chunks = buffer.split("\n\n");
80
- buffer = chunks.pop() ?? "";
81
- for (const chunk of chunks) {
82
- const lines = chunk.split("\n");
83
- const dataLines = [];
84
- let eventName;
85
- for (const line of lines) {
86
- if (line.startsWith("data:")) {
87
- dataLines.push(line.replace(/^data:\s*/, ""));
88
- } else if (line.startsWith("event:")) {
89
- eventName = line.replace(/^event:\s*/, "");
90
- } else if (line.startsWith("id:")) {
91
- lastEventId = line.replace(/^id:\s*/, "");
92
- } else if (line.startsWith("retry:")) {
93
- const parsed = Number.parseInt(
94
- line.replace(/^retry:\s*/, ""),
95
- 10
96
- );
97
- if (!Number.isNaN(parsed)) {
98
- retryDelay = parsed;
99
- }
100
- }
101
- }
102
- let data;
103
- let parsedJson = false;
104
- if (dataLines.length) {
105
- const rawData = dataLines.join("\n");
106
- try {
107
- data = JSON.parse(rawData);
108
- parsedJson = true;
109
- } catch {
110
- data = rawData;
111
- }
112
- }
113
- if (parsedJson) {
114
- if (responseValidator) {
115
- await responseValidator(data);
116
- }
117
- if (responseTransformer) {
118
- data = await responseTransformer(data);
119
- }
120
- }
121
- onSseEvent?.({
122
- data,
123
- event: eventName,
124
- id: lastEventId,
125
- retry: retryDelay
126
- });
127
- if (dataLines.length) {
128
- yield data;
129
- }
130
- }
131
- }
132
- } finally {
133
- signal.removeEventListener("abort", abortHandler);
134
- reader.releaseLock();
135
- }
136
- break;
137
- } catch (error) {
138
- onSseError?.(error);
139
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
140
- break;
141
- }
142
- const backoff = Math.min(
143
- retryDelay * 2 ** (attempt - 1),
144
- sseMaxRetryDelay ?? 3e4
145
- );
146
- await sleep(backoff);
147
- }
148
- }
149
- };
150
- const stream = createStream();
151
- return { stream };
152
- };
153
-
154
- // src/client/core/pathSerializer.gen.ts
155
- var separatorArrayExplode = (style) => {
156
- switch (style) {
157
- case "label":
158
- return ".";
159
- case "matrix":
160
- return ";";
161
- case "simple":
162
- return ",";
163
- default:
164
- return "&";
165
- }
166
- };
167
- var separatorArrayNoExplode = (style) => {
168
- switch (style) {
169
- case "form":
170
- return ",";
171
- case "pipeDelimited":
172
- return "|";
173
- case "spaceDelimited":
174
- return "%20";
175
- default:
176
- return ",";
177
- }
178
- };
179
- var separatorObjectExplode = (style) => {
180
- switch (style) {
181
- case "label":
182
- return ".";
183
- case "matrix":
184
- return ";";
185
- case "simple":
186
- return ",";
187
- default:
188
- return "&";
189
- }
190
- };
191
- var serializeArrayParam = ({
192
- allowReserved,
193
- explode,
194
- name,
195
- style,
196
- value
197
- }) => {
198
- if (!explode) {
199
- const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
200
- switch (style) {
201
- case "label":
202
- return `.${joinedValues2}`;
203
- case "matrix":
204
- return `;${name}=${joinedValues2}`;
205
- case "simple":
206
- return joinedValues2;
207
- default:
208
- return `${name}=${joinedValues2}`;
209
- }
210
- }
211
- const separator = separatorArrayExplode(style);
212
- const joinedValues = value.map((v) => {
213
- if (style === "label" || style === "simple") {
214
- return allowReserved ? v : encodeURIComponent(v);
215
- }
216
- return serializePrimitiveParam({
217
- allowReserved,
218
- name,
219
- value: v
220
- });
221
- }).join(separator);
222
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
223
- };
224
- var serializePrimitiveParam = ({
225
- allowReserved,
226
- name,
227
- value
228
- }) => {
229
- if (value === void 0 || value === null) {
230
- return "";
231
- }
232
- if (typeof value === "object") {
233
- throw new Error(
234
- "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
235
- );
236
- }
237
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
238
- };
239
- var serializeObjectParam = ({
240
- allowReserved,
241
- explode,
242
- name,
243
- style,
244
- value,
245
- valueOnly
246
- }) => {
247
- if (value instanceof Date) {
248
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
249
- }
250
- if (style !== "deepObject" && !explode) {
251
- let values = [];
252
- Object.entries(value).forEach(([key, v]) => {
253
- values = [
254
- ...values,
255
- key,
256
- allowReserved ? v : encodeURIComponent(v)
257
- ];
258
- });
259
- const joinedValues2 = values.join(",");
260
- switch (style) {
261
- case "form":
262
- return `${name}=${joinedValues2}`;
263
- case "label":
264
- return `.${joinedValues2}`;
265
- case "matrix":
266
- return `;${name}=${joinedValues2}`;
267
- default:
268
- return joinedValues2;
269
- }
270
- }
271
- const separator = separatorObjectExplode(style);
272
- const joinedValues = Object.entries(value).map(
273
- ([key, v]) => serializePrimitiveParam({
274
- allowReserved,
275
- name: style === "deepObject" ? `${name}[${key}]` : key,
276
- value: v
277
- })
278
- ).join(separator);
279
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
280
- };
281
-
282
- // src/client/core/utils.gen.ts
283
- var PATH_PARAM_RE = /\{[^{}]+\}/g;
284
- var defaultPathSerializer = ({ path, url: _url }) => {
285
- let url = _url;
286
- const matches = _url.match(PATH_PARAM_RE);
287
- if (matches) {
288
- for (const match of matches) {
289
- let explode = false;
290
- let name = match.substring(1, match.length - 1);
291
- let style = "simple";
292
- if (name.endsWith("*")) {
293
- explode = true;
294
- name = name.substring(0, name.length - 1);
295
- }
296
- if (name.startsWith(".")) {
297
- name = name.substring(1);
298
- style = "label";
299
- } else if (name.startsWith(";")) {
300
- name = name.substring(1);
301
- style = "matrix";
302
- }
303
- const value = path[name];
304
- if (value === void 0 || value === null) {
305
- continue;
306
- }
307
- if (Array.isArray(value)) {
308
- url = url.replace(
309
- match,
310
- serializeArrayParam({ explode, name, style, value })
311
- );
312
- continue;
313
- }
314
- if (typeof value === "object") {
315
- url = url.replace(
316
- match,
317
- serializeObjectParam({
318
- explode,
319
- name,
320
- style,
321
- value,
322
- valueOnly: true
323
- })
324
- );
325
- continue;
326
- }
327
- if (style === "matrix") {
328
- url = url.replace(
329
- match,
330
- `;${serializePrimitiveParam({
331
- name,
332
- value
333
- })}`
334
- );
335
- continue;
336
- }
337
- const replaceValue = encodeURIComponent(
338
- style === "label" ? `.${value}` : value
339
- );
340
- url = url.replace(match, replaceValue);
341
- }
342
- }
343
- return url;
344
- };
345
- var getUrl = ({
346
- baseUrl,
347
- path,
348
- query,
349
- querySerializer,
350
- url: _url
351
- }) => {
352
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
353
- let url = (baseUrl ?? "") + pathUrl;
354
- if (path) {
355
- url = defaultPathSerializer({ path, url });
356
- }
357
- let search = query ? querySerializer(query) : "";
358
- if (search.startsWith("?")) {
359
- search = search.substring(1);
360
- }
361
- if (search) {
362
- url += `?${search}`;
363
- }
364
- return url;
365
- };
366
- function getValidRequestBody(options) {
367
- const hasBody = options.body !== void 0;
368
- const isSerializedBody = hasBody && options.bodySerializer;
369
- if (isSerializedBody) {
370
- if ("serializedBody" in options) {
371
- const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
372
- return hasSerializedBody ? options.serializedBody : null;
373
- }
374
- return options.body !== "" ? options.body : null;
375
- }
376
- if (hasBody) {
377
- return options.body;
378
- }
379
- return void 0;
380
- }
381
-
382
- // src/client/core/auth.gen.ts
383
- var getAuthToken = async (auth, callback) => {
384
- const token = typeof callback === "function" ? await callback(auth) : callback;
385
- if (!token) {
386
- return;
387
- }
388
- if (auth.scheme === "bearer") {
389
- return `Bearer ${token}`;
390
- }
391
- if (auth.scheme === "basic") {
392
- return `Basic ${btoa(token)}`;
393
- }
394
- return token;
395
- };
396
-
397
- // src/client/client/utils.gen.ts
398
- var createQuerySerializer = ({
399
- parameters = {},
400
- ...args
401
- } = {}) => {
402
- const querySerializer = (queryParams) => {
403
- const search = [];
404
- if (queryParams && typeof queryParams === "object") {
405
- for (const name in queryParams) {
406
- const value = queryParams[name];
407
- if (value === void 0 || value === null) {
408
- continue;
409
- }
410
- const options = parameters[name] || args;
411
- if (Array.isArray(value)) {
412
- const serializedArray = serializeArrayParam({
413
- allowReserved: options.allowReserved,
414
- explode: true,
415
- name,
416
- style: "form",
417
- value,
418
- ...options.array
419
- });
420
- if (serializedArray) search.push(serializedArray);
421
- } else if (typeof value === "object") {
422
- const serializedObject = serializeObjectParam({
423
- allowReserved: options.allowReserved,
424
- explode: true,
425
- name,
426
- style: "deepObject",
427
- value,
428
- ...options.object
429
- });
430
- if (serializedObject) search.push(serializedObject);
431
- } else {
432
- const serializedPrimitive = serializePrimitiveParam({
433
- allowReserved: options.allowReserved,
434
- name,
435
- value
436
- });
437
- if (serializedPrimitive) search.push(serializedPrimitive);
438
- }
439
- }
440
- }
441
- return search.join("&");
442
- };
443
- return querySerializer;
444
- };
445
- var getParseAs = (contentType) => {
446
- if (!contentType) {
447
- return "stream";
448
- }
449
- const cleanContent = contentType.split(";")[0]?.trim();
450
- if (!cleanContent) {
451
- return;
452
- }
453
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
454
- return "json";
455
- }
456
- if (cleanContent === "multipart/form-data") {
457
- return "formData";
458
- }
459
- if (["application/", "audio/", "image/", "video/"].some(
460
- (type) => cleanContent.startsWith(type)
461
- )) {
462
- return "blob";
463
- }
464
- if (cleanContent.startsWith("text/")) {
465
- return "text";
466
- }
467
- return;
468
- };
469
- var checkForExistence = (options, name) => {
470
- if (!name) {
471
- return false;
472
- }
473
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
474
- return true;
475
- }
476
- return false;
477
- };
478
- var setAuthParams = async ({
479
- security,
480
- ...options
481
- }) => {
482
- for (const auth of security) {
483
- if (checkForExistence(options, auth.name)) {
484
- continue;
485
- }
486
- const token = await getAuthToken(auth, options.auth);
487
- if (!token) {
488
- continue;
489
- }
490
- const name = auth.name ?? "Authorization";
491
- switch (auth.in) {
492
- case "query":
493
- if (!options.query) {
494
- options.query = {};
495
- }
496
- options.query[name] = token;
497
- break;
498
- case "cookie":
499
- options.headers.append("Cookie", `${name}=${token}`);
500
- break;
501
- case "header":
502
- default:
503
- options.headers.set(name, token);
504
- break;
505
- }
506
- }
507
- };
508
- var buildUrl = (options) => getUrl({
509
- baseUrl: options.baseUrl,
510
- path: options.path,
511
- query: options.query,
512
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
513
- url: options.url
514
- });
515
- var mergeConfigs = (a, b) => {
516
- const config = { ...a, ...b };
517
- if (config.baseUrl?.endsWith("/")) {
518
- config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
519
- }
520
- config.headers = mergeHeaders(a.headers, b.headers);
521
- return config;
522
- };
523
- var headersEntries = (headers) => {
524
- const entries = [];
525
- headers.forEach((value, key) => {
526
- entries.push([key, value]);
527
- });
528
- return entries;
529
- };
530
- var mergeHeaders = (...headers) => {
531
- const mergedHeaders = new Headers();
532
- for (const header of headers) {
533
- if (!header) {
534
- continue;
535
- }
536
- const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
537
- for (const [key, value] of iterator) {
538
- if (value === null) {
539
- mergedHeaders.delete(key);
540
- } else if (Array.isArray(value)) {
541
- for (const v of value) {
542
- mergedHeaders.append(key, v);
543
- }
544
- } else if (value !== void 0) {
545
- mergedHeaders.set(
546
- key,
547
- typeof value === "object" ? JSON.stringify(value) : value
548
- );
549
- }
550
- }
551
- }
552
- return mergedHeaders;
553
- };
554
- var Interceptors = class {
555
- constructor() {
556
- this.fns = [];
557
- }
558
- clear() {
559
- this.fns = [];
560
- }
561
- eject(id) {
562
- const index = this.getInterceptorIndex(id);
563
- if (this.fns[index]) {
564
- this.fns[index] = null;
565
- }
566
- }
567
- exists(id) {
568
- const index = this.getInterceptorIndex(id);
569
- return Boolean(this.fns[index]);
570
- }
571
- getInterceptorIndex(id) {
572
- if (typeof id === "number") {
573
- return this.fns[id] ? id : -1;
574
- }
575
- return this.fns.indexOf(id);
576
- }
577
- update(id, fn) {
578
- const index = this.getInterceptorIndex(id);
579
- if (this.fns[index]) {
580
- this.fns[index] = fn;
581
- return id;
582
- }
583
- return false;
584
- }
585
- use(fn) {
586
- this.fns.push(fn);
587
- return this.fns.length - 1;
588
- }
589
- };
590
- var createInterceptors = () => ({
591
- error: new Interceptors(),
592
- request: new Interceptors(),
593
- response: new Interceptors()
594
- });
595
- var defaultQuerySerializer = createQuerySerializer({
596
- allowReserved: false,
597
- array: {
598
- explode: true,
599
- style: "form"
600
- },
601
- object: {
602
- explode: true,
603
- style: "deepObject"
604
- }
605
- });
606
- var defaultHeaders = {
607
- "Content-Type": "application/json"
608
- };
609
- var createConfig = (override = {}) => ({
610
- ...jsonBodySerializer,
611
- headers: defaultHeaders,
612
- parseAs: "auto",
613
- querySerializer: defaultQuerySerializer,
614
- ...override
615
- });
616
-
617
- // src/client/client/client.gen.ts
618
- var createClient = (config = {}) => {
619
- let _config = mergeConfigs(createConfig(), config);
620
- const getConfig = () => ({ ..._config });
621
- const setConfig = (config2) => {
622
- _config = mergeConfigs(_config, config2);
623
- return getConfig();
624
- };
625
- const interceptors = createInterceptors();
626
- const beforeRequest = async (options) => {
627
- const opts = {
628
- ..._config,
629
- ...options,
630
- fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
631
- headers: mergeHeaders(_config.headers, options.headers),
632
- serializedBody: void 0
633
- };
634
- if (opts.security) {
635
- await setAuthParams({
636
- ...opts,
637
- security: opts.security
638
- });
639
- }
640
- if (opts.requestValidator) {
641
- await opts.requestValidator(opts);
642
- }
643
- if (opts.body !== void 0 && opts.bodySerializer) {
644
- opts.serializedBody = opts.bodySerializer(opts.body);
645
- }
646
- if (opts.body === void 0 || opts.serializedBody === "") {
647
- opts.headers.delete("Content-Type");
648
- }
649
- const url = buildUrl(opts);
650
- return { opts, url };
651
- };
652
- const request = async (options) => {
653
- const { opts, url } = await beforeRequest(options);
654
- const requestInit = {
655
- redirect: "follow",
656
- ...opts,
657
- body: getValidRequestBody(opts)
658
- };
659
- let request2 = new Request(url, requestInit);
660
- for (const fn of interceptors.request.fns) {
661
- if (fn) {
662
- request2 = await fn(request2, opts);
663
- }
664
- }
665
- const _fetch = opts.fetch;
666
- let response;
667
- try {
668
- response = await _fetch(request2);
669
- } catch (error2) {
670
- let finalError2 = error2;
671
- for (const fn of interceptors.error.fns) {
672
- if (fn) {
673
- finalError2 = await fn(
674
- error2,
675
- void 0,
676
- request2,
677
- opts
678
- );
679
- }
680
- }
681
- finalError2 = finalError2 || {};
682
- if (opts.throwOnError) {
683
- throw finalError2;
684
- }
685
- return opts.responseStyle === "data" ? void 0 : {
686
- error: finalError2,
687
- request: request2,
688
- response: void 0
689
- };
690
- }
691
- for (const fn of interceptors.response.fns) {
692
- if (fn) {
693
- response = await fn(response, request2, opts);
694
- }
695
- }
696
- const result = {
697
- request: request2,
698
- response
699
- };
700
- if (response.ok) {
701
- const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
702
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
703
- let emptyData;
704
- switch (parseAs) {
705
- case "arrayBuffer":
706
- case "blob":
707
- case "text":
708
- emptyData = await response[parseAs]();
709
- break;
710
- case "formData":
711
- emptyData = new FormData();
712
- break;
713
- case "stream":
714
- emptyData = response.body;
715
- break;
716
- case "json":
717
- default:
718
- emptyData = {};
719
- break;
720
- }
721
- return opts.responseStyle === "data" ? emptyData : {
722
- data: emptyData,
723
- ...result
724
- };
725
- }
726
- let data;
727
- switch (parseAs) {
728
- case "arrayBuffer":
729
- case "blob":
730
- case "formData":
731
- case "json":
732
- case "text":
733
- data = await response[parseAs]();
734
- break;
735
- case "stream":
736
- return opts.responseStyle === "data" ? response.body : {
737
- data: response.body,
738
- ...result
739
- };
740
- }
741
- if (parseAs === "json") {
742
- if (opts.responseValidator) {
743
- await opts.responseValidator(data);
744
- }
745
- if (opts.responseTransformer) {
746
- data = await opts.responseTransformer(data);
747
- }
748
- }
749
- return opts.responseStyle === "data" ? data : {
750
- data,
751
- ...result
752
- };
753
- }
754
- const textError = await response.text();
755
- let jsonError;
756
- try {
757
- jsonError = JSON.parse(textError);
758
- } catch {
759
- }
760
- const error = jsonError ?? textError;
761
- let finalError = error;
762
- for (const fn of interceptors.error.fns) {
763
- if (fn) {
764
- finalError = await fn(error, response, request2, opts);
765
- }
766
- }
767
- finalError = finalError || {};
768
- if (opts.throwOnError) {
769
- throw finalError;
770
- }
771
- return opts.responseStyle === "data" ? void 0 : {
772
- error: finalError,
773
- ...result
774
- };
775
- };
776
- const makeMethodFn = (method) => (options) => request({ ...options, method });
777
- const makeSseFn = (method) => async (options) => {
778
- const { opts, url } = await beforeRequest(options);
779
- return createSseClient({
780
- ...opts,
781
- body: opts.body,
782
- headers: opts.headers,
783
- method,
784
- onRequest: async (url2, init) => {
785
- let request2 = new Request(url2, init);
786
- for (const fn of interceptors.request.fns) {
787
- if (fn) {
788
- request2 = await fn(request2, opts);
789
- }
790
- }
791
- return request2;
792
- },
793
- url
794
- });
795
- };
796
- return {
797
- buildUrl,
798
- connect: makeMethodFn("CONNECT"),
799
- delete: makeMethodFn("DELETE"),
800
- get: makeMethodFn("GET"),
801
- getConfig,
802
- head: makeMethodFn("HEAD"),
803
- interceptors,
804
- options: makeMethodFn("OPTIONS"),
805
- patch: makeMethodFn("PATCH"),
806
- post: makeMethodFn("POST"),
807
- put: makeMethodFn("PUT"),
808
- request,
809
- setConfig,
810
- sse: {
811
- connect: makeSseFn("CONNECT"),
812
- delete: makeSseFn("DELETE"),
813
- get: makeSseFn("GET"),
814
- head: makeSseFn("HEAD"),
815
- options: makeSseFn("OPTIONS"),
816
- patch: makeSseFn("PATCH"),
817
- post: makeSseFn("POST"),
818
- put: makeSseFn("PUT"),
819
- trace: makeSseFn("TRACE")
820
- },
821
- trace: makeMethodFn("TRACE")
822
- };
823
- };
824
-
825
- // src/client/client.gen.ts
826
- var client = createClient(
827
- createConfig({ baseUrl: "https://aifeatures.dev" })
828
- );
829
-
830
- // src/client/sdk.gen.ts
831
- var listFormsWithSiteToken = (options) => (options?.client ?? client).get({
832
- security: [{ scheme: "bearer", type: "http" }],
833
- url: "/api/v1/forms",
834
- ...options
835
- });
836
- var createFormWithSiteToken = (options) => (options.client ?? client).post({
837
- security: [{ scheme: "bearer", type: "http" }],
838
- url: "/api/v1/forms",
839
- ...options,
840
- headers: {
841
- "Content-Type": "application/json",
842
- ...options.headers
843
- }
844
- });
845
- var listSites = (options) => (options?.client ?? client).get({
846
- security: [{ scheme: "bearer", type: "http" }],
847
- url: "/api/v1/sites",
848
- ...options
849
- });
850
- var createSite = (options) => (options.client ?? client).post({
851
- security: [{ scheme: "bearer", type: "http" }],
852
- url: "/api/v1/sites",
853
- ...options,
854
- headers: {
855
- "Content-Type": "application/json",
856
- ...options.headers
857
- }
858
- });
859
- var deleteSite = (options) => (options.client ?? client).delete({
860
- security: [{ scheme: "bearer", type: "http" }],
861
- url: "/api/v1/sites/{siteId}",
862
- ...options
863
- });
864
- var getSite = (options) => (options.client ?? client).get(
865
- {
866
- security: [{ scheme: "bearer", type: "http" }],
867
- url: "/api/v1/sites/{siteId}",
868
- ...options
869
- }
870
- );
871
- var updateSite = (options) => (options.client ?? client).patch({
872
- security: [{ scheme: "bearer", type: "http" }],
873
- url: "/api/v1/sites/{siteId}",
874
- ...options,
875
- headers: {
876
- "Content-Type": "application/json",
877
- ...options.headers
878
- }
879
- });
880
- var updateSiteDomains = (options) => (options.client ?? client).patch({
881
- security: [{ scheme: "bearer", type: "http" }],
882
- url: "/api/v1/sites/{siteId}/domains",
883
- ...options,
884
- headers: {
885
- "Content-Type": "application/json",
886
- ...options.headers
887
- }
888
- });
889
- var listForms = (options) => (options.client ?? client).get({
890
- security: [{ scheme: "bearer", type: "http" }],
891
- url: "/api/v1/sites/{siteId}/forms",
892
- ...options
893
- });
894
- var createForm = (options) => (options.client ?? client).post({
895
- security: [{ scheme: "bearer", type: "http" }],
896
- url: "/api/v1/sites/{siteId}/forms",
897
- ...options,
898
- headers: {
899
- "Content-Type": "application/json",
900
- ...options.headers
901
- }
902
- });
903
- var deleteForm = (options) => (options.client ?? client).delete({
904
- security: [{ scheme: "bearer", type: "http" }],
905
- url: "/api/v1/forms/{formId}",
906
- ...options
907
- });
908
- var getForm = (options) => (options.client ?? client).get(
909
- {
910
- security: [{ scheme: "bearer", type: "http" }],
911
- url: "/api/v1/forms/{formId}",
912
- ...options
913
- }
914
- );
915
- var updateForm = (options) => (options.client ?? client).patch({
916
- security: [{ scheme: "bearer", type: "http" }],
917
- url: "/api/v1/forms/{formId}",
918
- ...options,
919
- headers: {
920
- "Content-Type": "application/json",
921
- ...options.headers
922
- }
923
- });
924
- var listSubmissions = (options) => (options.client ?? client).get({
925
- security: [{ scheme: "bearer", type: "http" }],
926
- url: "/api/v1/forms/{formId}/submissions",
927
- ...options
928
- });
929
- var deleteSubmission = (options) => (options.client ?? client).delete({
930
- security: [{ scheme: "bearer", type: "http" }],
931
- url: "/api/v1/submissions/{submissionId}",
932
- ...options
933
- });
934
- var getSubmission = (options) => (options.client ?? client).get({
935
- security: [{ scheme: "bearer", type: "http" }],
936
- url: "/api/v1/submissions/{submissionId}",
937
- ...options
938
- });
939
- var downloadAttachment = (options) => (options.client ?? client).get({
940
- security: [{ scheme: "bearer", type: "http" }],
941
- url: "/api/v1/submissions/{submissionId}/attachments/{filename}",
942
- ...options
943
- });
944
- export {
945
- createClient,
946
- createConfig,
947
- createForm,
948
- createFormWithSiteToken,
949
- createSite,
950
- deleteForm,
951
- deleteSite,
952
- deleteSubmission,
953
- downloadAttachment,
954
- getForm,
955
- getSite,
956
- getSubmission,
957
- listForms,
958
- listFormsWithSiteToken,
959
- listSites,
960
- listSubmissions,
961
- updateForm,
962
- updateSite,
963
- updateSiteDomains
964
- };
965
- //# sourceMappingURL=index.js.map
5
+ `);x=W.pop()??"";for(let ee of W){let re=ee.split(`
6
+ `),F=[],z;for(let E of re)if(E.startsWith("data:"))F.push(E.replace(/^data:\s*/,""));else if(E.startsWith("event:"))z=E.replace(/^event:\s*/,"");else if(E.startsWith("id:"))y=E.replace(/^id:\s*/,"");else if(E.startsWith("retry:")){let N=Number.parseInt(E.replace(/^retry:\s*/,""),10);Number.isNaN(N)||(c=N)}let b,B=!1;if(F.length){let E=F.join(`
7
+ `);try{b=JSON.parse(E),B=!0}catch{b=E}}B&&(n&&await n(b),a&&(b=await a(b))),t?.({data:b,event:z,id:y,retry:c}),F.length&&(yield b)}}}finally{C.removeEventListener("abort",q),f.releaseLock()}break}catch(T){if(r?.(T),p!==void 0&&O>=p)break;let R=Math.min(c*2**(O-1),i??3e4);await P(R)}}}()}};var se=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},oe=e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},ne=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},I=({allowReserved:e,explode:r,name:t,style:a,value:n})=>{if(!r){let i=(e?n:n.map(d=>encodeURIComponent(d))).join(oe(a));switch(a){case"label":return`.${i}`;case"matrix":return`;${t}=${i}`;case"simple":return i;default:return`${t}=${i}`}}let u=se(a),p=n.map(i=>a==="label"||a==="simple"?e?i:encodeURIComponent(i):D({allowReserved:e,name:t,value:i})).join(u);return a==="label"||a==="matrix"?u+p:p},D=({allowReserved:e,name:r,value:t})=>{if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return`${r}=${e?t:encodeURIComponent(t)}`},v=({allowReserved:e,explode:r,name:t,style:a,value:n,valueOnly:u})=>{if(n instanceof Date)return u?n.toISOString():`${t}=${n.toISOString()}`;if(a!=="deepObject"&&!r){let d=[];Object.entries(n).forEach(([o,y])=>{d=[...d,o,e?y:encodeURIComponent(y)]});let l=d.join(",");switch(a){case"form":return`${t}=${l}`;case"label":return`.${l}`;case"matrix":return`;${t}=${l}`;default:return l}}let p=ne(a),i=Object.entries(n).map(([d,l])=>D({allowReserved:e,name:a==="deepObject"?`${t}[${d}]`:d,value:l})).join(p);return a==="label"||a==="matrix"?p+i:i};var ae=/\{[^{}]+\}/g,ie=({path:e,url:r})=>{let t=r,a=r.match(ae);if(a)for(let n of a){let u=!1,p=n.substring(1,n.length-1),i="simple";p.endsWith("*")&&(u=!0,p=p.substring(0,p.length-1)),p.startsWith(".")?(p=p.substring(1),i="label"):p.startsWith(";")&&(p=p.substring(1),i="matrix");let d=e[p];if(d==null)continue;if(Array.isArray(d)){t=t.replace(n,I({explode:u,name:p,style:i,value:d}));continue}if(typeof d=="object"){t=t.replace(n,v({explode:u,name:p,style:i,value:d,valueOnly:!0}));continue}if(i==="matrix"){t=t.replace(n,`;${D({name:p,value:d})}`);continue}let l=encodeURIComponent(i==="label"?`.${d}`:d);t=t.replace(n,l)}return t},$=({baseUrl:e,path:r,query:t,querySerializer:a,url:n})=>{let u=n.startsWith("/")?n:`/${n}`,p=(e??"")+u;r&&(p=ie({path:r,url:p}));let i=t?a(t):"";return i.startsWith("?")&&(i=i.substring(1)),i&&(p+=`?${i}`),p};function H(e){let r=e.body!==void 0;if(r&&e.bodySerializer)return"serializedBody"in e?e.serializedBody!==void 0&&e.serializedBody!==""?e.serializedBody:null:e.body!==""?e.body:null;if(r)return e.body}var J=async(e,r)=>{let t=typeof r=="function"?await r(e):r;if(t)return e.scheme==="bearer"?`Bearer ${t}`:e.scheme==="basic"?`Basic ${btoa(t)}`:t};var Q=({parameters:e={},...r}={})=>a=>{let n=[];if(a&&typeof a=="object")for(let u in a){let p=a[u];if(p==null)continue;let i=e[u]||r;if(Array.isArray(p)){let d=I({allowReserved:i.allowReserved,explode:!0,name:u,style:"form",value:p,...i.array});d&&n.push(d)}else if(typeof p=="object"){let d=v({allowReserved:i.allowReserved,explode:!0,name:u,style:"deepObject",value:p,...i.object});d&&n.push(d)}else{let d=D({allowReserved:i.allowReserved,name:u,value:p});d&&n.push(d)}}return n.join("&")},_=e=>{if(!e)return"stream";let r=e.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return"json";if(r==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(t=>r.startsWith(t)))return"blob";if(r.startsWith("text/"))return"text"}},pe=(e,r)=>r?!!(e.headers.has(r)||e.query?.[r]||e.headers.get("Cookie")?.includes(`${r}=`)):!1,K=async({security:e,...r})=>{for(let t of e){if(pe(r,t.name))continue;let a=await J(t,r.auth);if(!a)continue;let n=t.name??"Authorization";switch(t.in){case"query":r.query||(r.query={}),r.query[n]=a;break;case"cookie":r.headers.append("Cookie",`${n}=${a}`);break;case"header":default:r.headers.set(n,a);break}}},A=e=>$({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:Q(e.querySerializer),url:e.url}),V=(e,r)=>{let t={...e,...r};return t.baseUrl?.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=U(e.headers,r.headers),t},de=e=>{let r=[];return e.forEach((t,a)=>{r.push([a,t])}),r},U=(...e)=>{let r=new Headers;for(let t of e){if(!t)continue;let a=t instanceof Headers?de(t):Object.entries(t);for(let[n,u]of a)if(u===null)r.delete(n);else if(Array.isArray(u))for(let p of u)r.append(n,p);else u!==void 0&&r.set(n,typeof u=="object"?JSON.stringify(u):u)}return r},k=class{constructor(){this.fns=[]}clear(){this.fns=[]}eject(r){let t=this.getInterceptorIndex(r);this.fns[t]&&(this.fns[t]=null)}exists(r){let t=this.getInterceptorIndex(r);return!!this.fns[t]}getInterceptorIndex(r){return typeof r=="number"?this.fns[r]?r:-1:this.fns.indexOf(r)}update(r,t){let a=this.getInterceptorIndex(r);return this.fns[a]?(this.fns[a]=t,r):!1}use(r){return this.fns.push(r),this.fns.length-1}},X=()=>({error:new k,request:new k,response:new k}),ue=Q({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),ce={"Content-Type":"application/json"},w=(e={})=>({...j,headers:ce,parseAs:"auto",querySerializer:ue,...e});var L=(e={})=>{let r=V(w(),e),t=()=>({...r}),a=l=>(r=V(r,l),t()),n=X(),u=async l=>{let o={...r,...l,fetch:l.fetch??r.fetch??globalThis.fetch,headers:U(r.headers,l.headers),serializedBody:void 0};o.security&&await K({...o,security:o.security}),o.requestValidator&&await o.requestValidator(o),o.body!==void 0&&o.bodySerializer&&(o.serializedBody=o.bodySerializer(o.body)),(o.body===void 0||o.serializedBody==="")&&o.headers.delete("Content-Type");let y=A(o);return{opts:o,url:y}},p=async l=>{let{opts:o,url:y}=await u(l),P={redirect:"follow",...o,body:H(o)},S=new Request(y,P);for(let h of n.request.fns)h&&(S=await h(S,o));let G=o.fetch,c;try{c=await G(S)}catch(h){let m=h;for(let f of n.error.fns)f&&(m=await f(h,void 0,S,o));if(m=m||{},o.throwOnError)throw m;return o.responseStyle==="data"?void 0:{error:m,request:S,response:void 0}}for(let h of n.response.fns)h&&(c=await h(c,S,o));let O={request:S,response:c};if(c.ok){let h=(o.parseAs==="auto"?_(c.headers.get("Content-Type")):o.parseAs)??"json";if(c.status===204||c.headers.get("Content-Length")==="0"){let f;switch(h){case"arrayBuffer":case"blob":case"text":f=await c[h]();break;case"formData":f=new FormData;break;case"stream":f=c.body;break;case"json":default:f={};break}return o.responseStyle==="data"?f:{data:f,...O}}let m;switch(h){case"arrayBuffer":case"blob":case"formData":case"json":case"text":m=await c[h]();break;case"stream":return o.responseStyle==="data"?c.body:{data:c.body,...O}}return h==="json"&&(o.responseValidator&&await o.responseValidator(m),o.responseTransformer&&(m=await o.responseTransformer(m))),o.responseStyle==="data"?m:{data:m,...O}}let C=await c.text(),g;try{g=JSON.parse(C)}catch{}let T=g??C,R=T;for(let h of n.error.fns)h&&(R=await h(T,c,S,o));if(R=R||{},o.throwOnError)throw R;return o.responseStyle==="data"?void 0:{error:R,...O}},i=l=>o=>p({...o,method:l}),d=l=>async o=>{let{opts:y,url:P}=await u(o);return M({...y,body:y.body,headers:y.headers,method:l,onRequest:async(S,G)=>{let c=new Request(S,G);for(let O of n.request.fns)O&&(c=await O(c,y));return c},url:P})};return{buildUrl:A,connect:i("CONNECT"),delete:i("DELETE"),get:i("GET"),getConfig:t,head:i("HEAD"),interceptors:n,options:i("OPTIONS"),patch:i("PATCH"),post:i("POST"),put:i("PUT"),request:p,setConfig:a,sse:{connect:d("CONNECT"),delete:d("DELETE"),get:d("GET"),head:d("HEAD"),options:d("OPTIONS"),patch:d("PATCH"),post:d("POST"),put:d("PUT"),trace:d("TRACE")},trace:i("TRACE")}};var s=L(w({baseUrl:"https://aifeatures.dev"}));var le=e=>(e.client??s).patch({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}/payments",...e,headers:{"Content-Type":"application/json",...e.headers}}),he=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/payments/status",...e}),me=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products",...e}),ye=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products",...e,headers:{"Content-Type":"application/json",...e.headers}}),Oe=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}/products",...e}),fe=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}/products",...e,headers:{"Content-Type":"application/json",...e.headers}}),Se=e=>(e.client??s).delete({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products/{productId}",...e}),Ee=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products/{productId}",...e}),Re=e=>(e.client??s).patch({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products/{productId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),Ce=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products/{productId}/file",...e,headers:{"Content-Type":"application/json",...e.headers}}),Te=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products/{productId}/test-order",...e,headers:{"Content-Type":"application/json",...e.headers}}),be=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/test-orders",...e,headers:{"Content-Type":"application/json",...e.headers}}),De=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products/{productId}/variants",...e,headers:{"Content-Type":"application/json",...e.headers}}),we=e=>(e.client??s).put({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products/{productId}/variants",...e,headers:{"Content-Type":"application/json",...e.headers}}),Pe=e=>(e.client??s).delete({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/variants/{variantId}",...e}),ge=e=>(e.client??s).patch({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/variants/{variantId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),xe=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/products/{productId}/options",...e,headers:{"Content-Type":"application/json",...e.headers}}),ke=e=>(e.client??s).delete({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/options/{optionId}",...e}),Ge=e=>(e.client??s).patch({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/options/{optionId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),Fe=e=>(e.client??s).put({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/variants/{variantId}/inventory",...e,headers:{"Content-Type":"application/json",...e.headers}}),Ie=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/variants/{variantId}/inventory/adjust",...e,headers:{"Content-Type":"application/json",...e.headers}}),ve=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/orders",...e}),Ue=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/orders/{orderId}",...e}),Le=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/orders/{orderId}/refund",...e,headers:{"Content-Type":"application/json",...e.headers}}),je=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/orders/{orderId}/resend-receipt",...e}),Ae=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/orders/{orderId}/reset-downloads",...e}),Ve=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/webhook-events/{eventId}/reset",...e}),qe=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/customers",...e}),We=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/customers",...e,headers:{"Content-Type":"application/json",...e.headers}}),ze=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/customers/{customerId}",...e}),Be=e=>(e.client??s).patch({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/customers/{customerId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),Ne=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/summary",...e}),Me=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sales-summary",...e}),$e=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/people",...e}),He=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/people/{email}",...e}),Je=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/payouts/next",...e}),Qe=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/orders/{orderId}/fulfillment",...e,headers:{"Content-Type":"application/json",...e.headers}}),_e=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/forms",...e}),Ke=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/forms",...e,headers:{"Content-Type":"application/json",...e.headers}}),Xe=e=>(e?.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites",...e}),Ye=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites",...e,headers:{"Content-Type":"application/json",...e.headers}}),Ze=e=>(e.client??s).delete({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}",...e}),er=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}",...e}),rr=e=>(e.client??s).patch({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),tr=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}/checkout-pause",...e}),sr=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}/checkout-pause",...e,headers:{"Content-Type":"application/json",...e.headers}}),or=e=>(e.client??s).patch({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}/domains",...e,headers:{"Content-Type":"application/json",...e.headers}}),nr=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}/forms",...e}),ar=e=>(e.client??s).post({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/sites/{siteId}/forms",...e,headers:{"Content-Type":"application/json",...e.headers}}),ir=e=>(e.client??s).delete({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/forms/{formId}",...e}),pr=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/forms/{formId}",...e}),dr=e=>(e.client??s).patch({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/forms/{formId}",...e,headers:{"Content-Type":"application/json",...e.headers}}),ur=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/forms/{formId}/submissions",...e}),cr=e=>(e.client??s).delete({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/submissions/{submissionId}",...e}),lr=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/submissions/{submissionId}",...e}),hr=e=>(e.client??s).get({security:[{scheme:"bearer",type:"http"}],url:"/api/v1/submissions/{submissionId}/attachments/{attachmentId}",...e}),mr=e=>(e.client??s).get({url:"/v1/p/{productId}",...e}),yr=e=>(e.client??s).post({url:"/v1/p/{productId}/checkout",...e,headers:{"Content-Type":"application/json",...e.headers}}),Or=e=>(e.client??s).post({url:"/v1/p/checkout",...e,headers:{"Content-Type":"application/json",...e.headers}}),fr=e=>(e.client??s).post({url:"/v1/p/checkout/summary",...e,headers:{"Content-Type":"application/json",...e.headers}}),Sr=e=>(e.client??s).get({url:"/v1/o/session/{sessionId}",...e}),Er=e=>(e.client??s).get({url:"/v1/d/{token}",...e}),Rr=e=>(e?.client??s).get({url:"/v1/geo",...e});export{Ie as adjustVariantInventory,Ce as attachProductFile,Or as createCartCheckout,yr as createCheckout,L as createClient,w as createConfig,We as createCustomer,ar as createForm,Ke as createFormWithSiteToken,be as createMultiItemTestOrder,xe as createOption,fe as createProduct,ye as createProductWithSiteToken,Ye as createSite,Te as createTestOrder,De as createVariant,ir as deleteForm,ke as deleteOption,Se as deleteProduct,Ze as deleteSite,cr as deleteSubmission,Pe as deleteVariant,hr as downloadAttachment,Er as downloadFile,Ne as getBusinessSummary,fr as getCartSummary,ze as getCustomer,pr as getForm,Rr as getGeo,Je as getNextPayout,Ue as getOrder,Sr as getOrderSession,he as getPaymentsStatus,He as getPerson,Ee as getProduct,mr as getPublicProduct,Me as getSalesSummary,er as getSite,tr as getSiteCheckoutPause,lr as getSubmission,qe as listCustomers,nr as listForms,_e as listFormsWithSiteToken,ve as listOrdersWithSiteToken,$e as listPeople,Oe as listProducts,me as listProductsWithSiteToken,Xe as listSites,ur as listSubmissions,sr as pauseSiteCheckout,Le as refundOrder,je as resendOrderReceipt,Ae as resetOrderDownloads,Ve as resetWebhookEvent,Qe as setOrderFulfillment,we as setProductVariants,Fe as setVariantInventory,Be as updateCustomer,dr as updateForm,Ge as updateOption,Re as updateProduct,rr as updateSite,or as updateSiteDomains,le as updateSitePayments,ge as updateVariant};