@reverbia/sdk 1.0.0 → 1.1.0-next.20251230221037
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/README.md +290 -45
- package/dist/expo/index.cjs +3428 -0
- package/dist/expo/index.d.mts +1217 -0
- package/dist/expo/index.d.ts +1217 -0
- package/dist/expo/index.mjs +3395 -0
- package/dist/index.cjs +972 -0
- package/dist/index.d.mts +1514 -0
- package/dist/index.d.ts +1514 -0
- package/dist/index.mjs +934 -0
- package/dist/next/index.cjs +64 -0
- package/dist/next/index.d.mts +23 -0
- package/dist/next/index.d.ts +23 -0
- package/dist/next/index.mjs +39 -0
- package/dist/polyfills/index.cjs +61 -0
- package/dist/polyfills/index.d.mts +9 -0
- package/dist/polyfills/index.d.ts +9 -0
- package/dist/polyfills/index.mjs +34 -0
- package/dist/react/chunk-KUFGQF6E.mjs +290 -0
- package/dist/react/chunk-T56Y62G7.mjs +410 -0
- package/dist/react/index.cjs +7982 -0
- package/dist/react/index.d.mts +3139 -0
- package/dist/react/index.d.ts +3139 -0
- package/dist/react/index.mjs +7209 -0
- package/dist/react/storage-Z2NBANCK.mjs +29 -0
- package/dist/react/useEncryption-5RTXKDNZ.mjs +31 -0
- package/dist/vercel/index.cjs +86 -0
- package/dist/vercel/index.d.mts +119 -0
- package/dist/vercel/index.d.ts +119 -0
- package/dist/vercel/index.mjs +57 -0
- package/package.json +91 -16
- package/dist/cjs/client/client/client.gen.d.ts +0 -2
- package/dist/cjs/client/client/client.gen.js +0 -203
- package/dist/cjs/client/client/index.d.ts +0 -8
- package/dist/cjs/client/client/index.js +0 -16
- package/dist/cjs/client/client/types.gen.d.ts +0 -99
- package/dist/cjs/client/client/types.gen.js +0 -3
- package/dist/cjs/client/client/utils.gen.d.ts +0 -40
- package/dist/cjs/client/client/utils.gen.js +0 -314
- package/dist/cjs/client/client.gen.d.ts +0 -12
- package/dist/cjs/client/client.gen.js +0 -6
- package/dist/cjs/client/core/auth.gen.d.ts +0 -18
- package/dist/cjs/client/core/auth.gen.js +0 -18
- package/dist/cjs/client/core/bodySerializer.gen.d.ts +0 -25
- package/dist/cjs/client/core/bodySerializer.gen.js +0 -60
- package/dist/cjs/client/core/params.gen.d.ts +0 -43
- package/dist/cjs/client/core/params.gen.js +0 -104
- package/dist/cjs/client/core/pathSerializer.gen.d.ts +0 -33
- package/dist/cjs/client/core/pathSerializer.gen.js +0 -123
- package/dist/cjs/client/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/cjs/client/core/queryKeySerializer.gen.js +0 -105
- package/dist/cjs/client/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/cjs/client/core/serverSentEvents.gen.js +0 -139
- package/dist/cjs/client/core/types.gen.d.ts +0 -78
- package/dist/cjs/client/core/types.gen.js +0 -3
- package/dist/cjs/client/core/utils.gen.d.ts +0 -19
- package/dist/cjs/client/core/utils.gen.js +0 -93
- package/dist/cjs/client/index.d.ts +0 -2
- package/dist/cjs/client/index.js +0 -18
- package/dist/cjs/client/sdk.gen.d.ts +0 -27
- package/dist/cjs/client/sdk.gen.js +0 -33
- package/dist/cjs/client/types.gen.d.ts +0 -120
- package/dist/cjs/client/types.gen.js +0 -3
- package/dist/esm/client/client/client.gen.d.ts +0 -2
- package/dist/esm/client/client/client.gen.js +0 -199
- package/dist/esm/client/client/index.d.ts +0 -8
- package/dist/esm/client/client/index.js +0 -6
- package/dist/esm/client/client/types.gen.d.ts +0 -99
- package/dist/esm/client/client/types.gen.js +0 -2
- package/dist/esm/client/client/utils.gen.d.ts +0 -40
- package/dist/esm/client/client/utils.gen.js +0 -302
- package/dist/esm/client/client.gen.d.ts +0 -12
- package/dist/esm/client/client.gen.js +0 -3
- package/dist/esm/client/core/auth.gen.d.ts +0 -18
- package/dist/esm/client/core/auth.gen.js +0 -14
- package/dist/esm/client/core/bodySerializer.gen.d.ts +0 -25
- package/dist/esm/client/core/bodySerializer.gen.js +0 -57
- package/dist/esm/client/core/params.gen.d.ts +0 -43
- package/dist/esm/client/core/params.gen.js +0 -100
- package/dist/esm/client/core/pathSerializer.gen.d.ts +0 -33
- package/dist/esm/client/core/pathSerializer.gen.js +0 -114
- package/dist/esm/client/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/esm/client/core/queryKeySerializer.gen.js +0 -99
- package/dist/esm/client/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/esm/client/core/serverSentEvents.gen.js +0 -135
- package/dist/esm/client/core/types.gen.d.ts +0 -78
- package/dist/esm/client/core/types.gen.js +0 -2
- package/dist/esm/client/core/utils.gen.d.ts +0 -19
- package/dist/esm/client/core/utils.gen.js +0 -87
- package/dist/esm/client/index.d.ts +0 -2
- package/dist/esm/client/index.js +0 -2
- package/dist/esm/client/sdk.gen.d.ts +0 -27
- package/dist/esm/client/sdk.gen.js +0 -28
- package/dist/esm/client/types.gen.d.ts +0 -120
- package/dist/esm/client/types.gen.js +0 -2
- package/dist/types/client/client/client.gen.d.ts +0 -2
- package/dist/types/client/client/index.d.ts +0 -8
- package/dist/types/client/client/types.gen.d.ts +0 -99
- package/dist/types/client/client/utils.gen.d.ts +0 -40
- package/dist/types/client/client.gen.d.ts +0 -12
- package/dist/types/client/core/auth.gen.d.ts +0 -18
- package/dist/types/client/core/bodySerializer.gen.d.ts +0 -25
- package/dist/types/client/core/params.gen.d.ts +0 -43
- package/dist/types/client/core/pathSerializer.gen.d.ts +0 -33
- package/dist/types/client/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/types/client/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/types/client/core/types.gen.d.ts +0 -78
- package/dist/types/client/core/utils.gen.d.ts +0 -19
- package/dist/types/client/index.d.ts +0 -2
- package/dist/types/client/sdk.gen.d.ts +0 -27
- package/dist/types/client/types.gen.d.ts +0 -120
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.createSseClient = void 0;
|
|
5
|
-
const createSseClient = ({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) => {
|
|
6
|
-
let lastEventId;
|
|
7
|
-
const sleep = sseSleepFn ??
|
|
8
|
-
((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
9
|
-
const createStream = async function* () {
|
|
10
|
-
let retryDelay = sseDefaultRetryDelay ?? 3000;
|
|
11
|
-
let attempt = 0;
|
|
12
|
-
const signal = options.signal ?? new AbortController().signal;
|
|
13
|
-
while (true) {
|
|
14
|
-
if (signal.aborted)
|
|
15
|
-
break;
|
|
16
|
-
attempt++;
|
|
17
|
-
const headers = options.headers instanceof Headers
|
|
18
|
-
? options.headers
|
|
19
|
-
: new Headers(options.headers);
|
|
20
|
-
if (lastEventId !== undefined) {
|
|
21
|
-
headers.set('Last-Event-ID', lastEventId);
|
|
22
|
-
}
|
|
23
|
-
try {
|
|
24
|
-
const requestInit = {
|
|
25
|
-
redirect: 'follow',
|
|
26
|
-
...options,
|
|
27
|
-
body: options.serializedBody,
|
|
28
|
-
headers,
|
|
29
|
-
signal,
|
|
30
|
-
};
|
|
31
|
-
let request = new Request(url, requestInit);
|
|
32
|
-
if (onRequest) {
|
|
33
|
-
request = await onRequest(url, requestInit);
|
|
34
|
-
}
|
|
35
|
-
// fetch must be assigned here, otherwise it would throw the error:
|
|
36
|
-
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
37
|
-
const _fetch = options.fetch ?? globalThis.fetch;
|
|
38
|
-
const response = await _fetch(request);
|
|
39
|
-
if (!response.ok)
|
|
40
|
-
throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
41
|
-
if (!response.body)
|
|
42
|
-
throw new Error('No body in SSE response');
|
|
43
|
-
const reader = response.body
|
|
44
|
-
.pipeThrough(new TextDecoderStream())
|
|
45
|
-
.getReader();
|
|
46
|
-
let buffer = '';
|
|
47
|
-
const abortHandler = () => {
|
|
48
|
-
try {
|
|
49
|
-
reader.cancel();
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
// noop
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
signal.addEventListener('abort', abortHandler);
|
|
56
|
-
try {
|
|
57
|
-
while (true) {
|
|
58
|
-
const { done, value } = await reader.read();
|
|
59
|
-
if (done)
|
|
60
|
-
break;
|
|
61
|
-
buffer += value;
|
|
62
|
-
const chunks = buffer.split('\n\n');
|
|
63
|
-
buffer = chunks.pop() ?? '';
|
|
64
|
-
for (const chunk of chunks) {
|
|
65
|
-
const lines = chunk.split('\n');
|
|
66
|
-
const dataLines = [];
|
|
67
|
-
let eventName;
|
|
68
|
-
for (const line of lines) {
|
|
69
|
-
if (line.startsWith('data:')) {
|
|
70
|
-
dataLines.push(line.replace(/^data:\s*/, ''));
|
|
71
|
-
}
|
|
72
|
-
else if (line.startsWith('event:')) {
|
|
73
|
-
eventName = line.replace(/^event:\s*/, '');
|
|
74
|
-
}
|
|
75
|
-
else if (line.startsWith('id:')) {
|
|
76
|
-
lastEventId = line.replace(/^id:\s*/, '');
|
|
77
|
-
}
|
|
78
|
-
else if (line.startsWith('retry:')) {
|
|
79
|
-
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10);
|
|
80
|
-
if (!Number.isNaN(parsed)) {
|
|
81
|
-
retryDelay = parsed;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
let data;
|
|
86
|
-
let parsedJson = false;
|
|
87
|
-
if (dataLines.length) {
|
|
88
|
-
const rawData = dataLines.join('\n');
|
|
89
|
-
try {
|
|
90
|
-
data = JSON.parse(rawData);
|
|
91
|
-
parsedJson = true;
|
|
92
|
-
}
|
|
93
|
-
catch {
|
|
94
|
-
data = rawData;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
if (parsedJson) {
|
|
98
|
-
if (responseValidator) {
|
|
99
|
-
await responseValidator(data);
|
|
100
|
-
}
|
|
101
|
-
if (responseTransformer) {
|
|
102
|
-
data = await responseTransformer(data);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
onSseEvent?.({
|
|
106
|
-
data,
|
|
107
|
-
event: eventName,
|
|
108
|
-
id: lastEventId,
|
|
109
|
-
retry: retryDelay,
|
|
110
|
-
});
|
|
111
|
-
if (dataLines.length) {
|
|
112
|
-
yield data;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
finally {
|
|
118
|
-
signal.removeEventListener('abort', abortHandler);
|
|
119
|
-
reader.releaseLock();
|
|
120
|
-
}
|
|
121
|
-
break; // exit loop on normal completion
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
// connection failed or aborted; retry after delay
|
|
125
|
-
onSseError?.(error);
|
|
126
|
-
if (sseMaxRetryAttempts !== undefined &&
|
|
127
|
-
attempt >= sseMaxRetryAttempts) {
|
|
128
|
-
break; // stop after firing error
|
|
129
|
-
}
|
|
130
|
-
// exponential backoff: double retry each attempt, cap at 30s
|
|
131
|
-
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
|
|
132
|
-
await sleep(backoff);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
const stream = createStream();
|
|
137
|
-
return { stream };
|
|
138
|
-
};
|
|
139
|
-
exports.createSseClient = createSseClient;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { Auth, AuthToken } from './auth.gen';
|
|
2
|
-
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen';
|
|
3
|
-
export type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
4
|
-
export type Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
5
|
-
/**
|
|
6
|
-
* Returns the final request URL.
|
|
7
|
-
*/
|
|
8
|
-
buildUrl: BuildUrlFn;
|
|
9
|
-
getConfig: () => Config;
|
|
10
|
-
request: RequestFn;
|
|
11
|
-
setConfig: (config: Config) => Config;
|
|
12
|
-
} & {
|
|
13
|
-
[K in HttpMethod]: MethodFn;
|
|
14
|
-
} & ([SseFn] extends [never] ? {
|
|
15
|
-
sse?: never;
|
|
16
|
-
} : {
|
|
17
|
-
sse: {
|
|
18
|
-
[K in HttpMethod]: SseFn;
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
export interface Config {
|
|
22
|
-
/**
|
|
23
|
-
* Auth token or a function returning auth token. The resolved value will be
|
|
24
|
-
* added to the request payload as defined by its `security` array.
|
|
25
|
-
*/
|
|
26
|
-
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
|
27
|
-
/**
|
|
28
|
-
* A function for serializing request body parameter. By default,
|
|
29
|
-
* {@link JSON.stringify()} will be used.
|
|
30
|
-
*/
|
|
31
|
-
bodySerializer?: BodySerializer | null;
|
|
32
|
-
/**
|
|
33
|
-
* An object containing any HTTP headers that you want to pre-populate your
|
|
34
|
-
* `Headers` object with.
|
|
35
|
-
*
|
|
36
|
-
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
37
|
-
*/
|
|
38
|
-
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
39
|
-
/**
|
|
40
|
-
* The request method.
|
|
41
|
-
*
|
|
42
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
43
|
-
*/
|
|
44
|
-
method?: Uppercase<HttpMethod>;
|
|
45
|
-
/**
|
|
46
|
-
* A function for serializing request query parameters. By default, arrays
|
|
47
|
-
* will be exploded in form style, objects will be exploded in deepObject
|
|
48
|
-
* style, and reserved characters are percent-encoded.
|
|
49
|
-
*
|
|
50
|
-
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
51
|
-
* API function is used.
|
|
52
|
-
*
|
|
53
|
-
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
54
|
-
*/
|
|
55
|
-
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
56
|
-
/**
|
|
57
|
-
* A function validating request data. This is useful if you want to ensure
|
|
58
|
-
* the request conforms to the desired shape, so it can be safely sent to
|
|
59
|
-
* the server.
|
|
60
|
-
*/
|
|
61
|
-
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
62
|
-
/**
|
|
63
|
-
* A function transforming response data before it's returned. This is useful
|
|
64
|
-
* for post-processing data, e.g. converting ISO strings into Date objects.
|
|
65
|
-
*/
|
|
66
|
-
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
67
|
-
/**
|
|
68
|
-
* A function validating response data. This is useful if you want to ensure
|
|
69
|
-
* the response conforms to the desired shape, so it can be safely passed to
|
|
70
|
-
* the transformers and returned to the user.
|
|
71
|
-
*/
|
|
72
|
-
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
73
|
-
}
|
|
74
|
-
type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] ? true : [T] extends [never | undefined] ? [undefined] extends [T] ? false : true : false;
|
|
75
|
-
export type OmitNever<T extends Record<string, unknown>> = {
|
|
76
|
-
[K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
|
|
77
|
-
};
|
|
78
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BodySerializer, QuerySerializer } from './bodySerializer.gen';
|
|
2
|
-
export interface PathSerializer {
|
|
3
|
-
path: Record<string, unknown>;
|
|
4
|
-
url: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const PATH_PARAM_RE: RegExp;
|
|
7
|
-
export declare const defaultPathSerializer: ({ path, url: _url }: PathSerializer) => string;
|
|
8
|
-
export declare const getUrl: ({ baseUrl, path, query, querySerializer, url: _url, }: {
|
|
9
|
-
baseUrl?: string;
|
|
10
|
-
path?: Record<string, unknown>;
|
|
11
|
-
query?: Record<string, unknown>;
|
|
12
|
-
querySerializer: QuerySerializer;
|
|
13
|
-
url: string;
|
|
14
|
-
}) => string;
|
|
15
|
-
export declare function getValidRequestBody(options: {
|
|
16
|
-
body?: unknown;
|
|
17
|
-
bodySerializer?: BodySerializer | null;
|
|
18
|
-
serializedBody?: unknown;
|
|
19
|
-
}): unknown;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getUrl = exports.defaultPathSerializer = exports.PATH_PARAM_RE = void 0;
|
|
5
|
-
exports.getValidRequestBody = getValidRequestBody;
|
|
6
|
-
const pathSerializer_gen_1 = require("./pathSerializer.gen");
|
|
7
|
-
exports.PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
8
|
-
const defaultPathSerializer = ({ path, url: _url }) => {
|
|
9
|
-
let url = _url;
|
|
10
|
-
const matches = _url.match(exports.PATH_PARAM_RE);
|
|
11
|
-
if (matches) {
|
|
12
|
-
for (const match of matches) {
|
|
13
|
-
let explode = false;
|
|
14
|
-
let name = match.substring(1, match.length - 1);
|
|
15
|
-
let style = 'simple';
|
|
16
|
-
if (name.endsWith('*')) {
|
|
17
|
-
explode = true;
|
|
18
|
-
name = name.substring(0, name.length - 1);
|
|
19
|
-
}
|
|
20
|
-
if (name.startsWith('.')) {
|
|
21
|
-
name = name.substring(1);
|
|
22
|
-
style = 'label';
|
|
23
|
-
}
|
|
24
|
-
else if (name.startsWith(';')) {
|
|
25
|
-
name = name.substring(1);
|
|
26
|
-
style = 'matrix';
|
|
27
|
-
}
|
|
28
|
-
const value = path[name];
|
|
29
|
-
if (value === undefined || value === null) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (Array.isArray(value)) {
|
|
33
|
-
url = url.replace(match, (0, pathSerializer_gen_1.serializeArrayParam)({ explode, name, style, value }));
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
if (typeof value === 'object') {
|
|
37
|
-
url = url.replace(match, (0, pathSerializer_gen_1.serializeObjectParam)({
|
|
38
|
-
explode,
|
|
39
|
-
name,
|
|
40
|
-
style,
|
|
41
|
-
value: value,
|
|
42
|
-
valueOnly: true,
|
|
43
|
-
}));
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
if (style === 'matrix') {
|
|
47
|
-
url = url.replace(match, `;${(0, pathSerializer_gen_1.serializePrimitiveParam)({
|
|
48
|
-
name,
|
|
49
|
-
value: value,
|
|
50
|
-
})}`);
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);
|
|
54
|
-
url = url.replace(match, replaceValue);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return url;
|
|
58
|
-
};
|
|
59
|
-
exports.defaultPathSerializer = defaultPathSerializer;
|
|
60
|
-
const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {
|
|
61
|
-
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
|
|
62
|
-
let url = (baseUrl ?? '') + pathUrl;
|
|
63
|
-
if (path) {
|
|
64
|
-
url = (0, exports.defaultPathSerializer)({ path, url });
|
|
65
|
-
}
|
|
66
|
-
let search = query ? querySerializer(query) : '';
|
|
67
|
-
if (search.startsWith('?')) {
|
|
68
|
-
search = search.substring(1);
|
|
69
|
-
}
|
|
70
|
-
if (search) {
|
|
71
|
-
url += `?${search}`;
|
|
72
|
-
}
|
|
73
|
-
return url;
|
|
74
|
-
};
|
|
75
|
-
exports.getUrl = getUrl;
|
|
76
|
-
function getValidRequestBody(options) {
|
|
77
|
-
const hasBody = options.body !== undefined;
|
|
78
|
-
const isSerializedBody = hasBody && options.bodySerializer;
|
|
79
|
-
if (isSerializedBody) {
|
|
80
|
-
if ('serializedBody' in options) {
|
|
81
|
-
const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== '';
|
|
82
|
-
return hasSerializedBody ? options.serializedBody : null;
|
|
83
|
-
}
|
|
84
|
-
// not all clients implement a serializedBody property (i.e. client-axios)
|
|
85
|
-
return options.body !== '' ? options.body : null;
|
|
86
|
-
}
|
|
87
|
-
// plain/text body
|
|
88
|
-
if (hasBody) {
|
|
89
|
-
return options.body;
|
|
90
|
-
}
|
|
91
|
-
// no body was provided
|
|
92
|
-
return undefined;
|
|
93
|
-
}
|
package/dist/cjs/client/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
__exportStar(require("./sdk.gen"), exports);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Client, Options as Options2, TDataShape } from './client';
|
|
2
|
-
import type { GetHealthData, GetHealthErrors, GetHealthResponses, PostApiV1ChatCompletionsData, PostApiV1ChatCompletionsErrors, PostApiV1ChatCompletionsResponses } from './types.gen';
|
|
3
|
-
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
|
4
|
-
/**
|
|
5
|
-
* You can provide a client instance returned by `createClient()` instead of
|
|
6
|
-
* individual options. This might be also useful if you want to implement a
|
|
7
|
-
* custom client.
|
|
8
|
-
*/
|
|
9
|
-
client?: Client;
|
|
10
|
-
/**
|
|
11
|
-
* You can pass arbitrary values through the `meta` object. This can be
|
|
12
|
-
* used to access values that aren't defined as part of the SDK function.
|
|
13
|
-
*/
|
|
14
|
-
meta?: Record<string, unknown>;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Create chat completion
|
|
18
|
-
*
|
|
19
|
-
* Generates a chat completion using the configured gateway.
|
|
20
|
-
*/
|
|
21
|
-
export declare const postApiV1ChatCompletions: <ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatCompletionsData, ThrowOnError>) => import("./client").RequestResult<PostApiV1ChatCompletionsResponses, PostApiV1ChatCompletionsErrors, ThrowOnError>;
|
|
22
|
-
/**
|
|
23
|
-
* Health check
|
|
24
|
-
*
|
|
25
|
-
* Returns the current health status of the service.
|
|
26
|
-
*/
|
|
27
|
-
export declare const getHealth: <ThrowOnError extends boolean = false>(options?: Options<GetHealthData, ThrowOnError>) => import("./client").RequestResult<GetHealthResponses, GetHealthErrors, ThrowOnError>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getHealth = exports.postApiV1ChatCompletions = void 0;
|
|
5
|
-
const client_gen_1 = require("./client.gen");
|
|
6
|
-
/**
|
|
7
|
-
* Create chat completion
|
|
8
|
-
*
|
|
9
|
-
* Generates a chat completion using the configured gateway.
|
|
10
|
-
*/
|
|
11
|
-
const postApiV1ChatCompletions = (options) => {
|
|
12
|
-
return (options.client ?? client_gen_1.client).post({
|
|
13
|
-
url: '/api/v1/chat/completions',
|
|
14
|
-
...options,
|
|
15
|
-
headers: {
|
|
16
|
-
'Content-Type': 'application/json',
|
|
17
|
-
...options.headers
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
exports.postApiV1ChatCompletions = postApiV1ChatCompletions;
|
|
22
|
-
/**
|
|
23
|
-
* Health check
|
|
24
|
-
*
|
|
25
|
-
* Returns the current health status of the service.
|
|
26
|
-
*/
|
|
27
|
-
const getHealth = (options) => {
|
|
28
|
-
return (options?.client ?? client_gen_1.client).get({
|
|
29
|
-
url: '/health',
|
|
30
|
-
...options
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
exports.getHealth = getHealth;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
export type ClientOptions = {
|
|
2
|
-
baseUrl: `${string}://${string}` | (string & {});
|
|
3
|
-
};
|
|
4
|
-
export type HandlersHealthResponse = {
|
|
5
|
-
/**
|
|
6
|
-
* Status indicates the service health status
|
|
7
|
-
*/
|
|
8
|
-
status?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Timestamp is the Unix timestamp of the response
|
|
11
|
-
*/
|
|
12
|
-
timestamp?: number;
|
|
13
|
-
/**
|
|
14
|
-
* Version is the current API version
|
|
15
|
-
*/
|
|
16
|
-
version?: string;
|
|
17
|
-
};
|
|
18
|
-
export type LlmapiChatCompletionRequest = {
|
|
19
|
-
/**
|
|
20
|
-
* Messages is the conversation history
|
|
21
|
-
*/
|
|
22
|
-
messages?: Array<LlmapiMessage>;
|
|
23
|
-
/**
|
|
24
|
-
* Model is the model identifier
|
|
25
|
-
*/
|
|
26
|
-
model?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Stream indicates if response should be streamed
|
|
29
|
-
*/
|
|
30
|
-
stream?: boolean;
|
|
31
|
-
};
|
|
32
|
-
export type LlmapiChatCompletionResponse = {
|
|
33
|
-
/**
|
|
34
|
-
* Choices contains the completion choices
|
|
35
|
-
*/
|
|
36
|
-
choices?: Array<LlmapiChoice>;
|
|
37
|
-
/**
|
|
38
|
-
* ID is the completion ID
|
|
39
|
-
*/
|
|
40
|
-
id?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Model is the model used
|
|
43
|
-
*/
|
|
44
|
-
model?: string;
|
|
45
|
-
};
|
|
46
|
-
export type LlmapiChoice = {
|
|
47
|
-
/**
|
|
48
|
-
* FinishReason indicates why the completion stopped
|
|
49
|
-
*/
|
|
50
|
-
finish_reason?: string;
|
|
51
|
-
/**
|
|
52
|
-
* Index is the choice index
|
|
53
|
-
*/
|
|
54
|
-
index?: number;
|
|
55
|
-
message?: LlmapiMessage;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Message is the generated message
|
|
59
|
-
*/
|
|
60
|
-
export type LlmapiMessage = {
|
|
61
|
-
/**
|
|
62
|
-
* Content is the message content
|
|
63
|
-
*/
|
|
64
|
-
content?: string;
|
|
65
|
-
role?: LlmapiRole;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Role is the message role (system, user, assistant)
|
|
69
|
-
*/
|
|
70
|
-
export type LlmapiRole = string;
|
|
71
|
-
export type ResponseErrorResponse = {
|
|
72
|
-
error?: string;
|
|
73
|
-
};
|
|
74
|
-
export type PostApiV1ChatCompletionsData = {
|
|
75
|
-
/**
|
|
76
|
-
* Chat completion request
|
|
77
|
-
*/
|
|
78
|
-
body: LlmapiChatCompletionRequest;
|
|
79
|
-
path?: never;
|
|
80
|
-
query?: never;
|
|
81
|
-
url: '/api/v1/chat/completions';
|
|
82
|
-
};
|
|
83
|
-
export type PostApiV1ChatCompletionsErrors = {
|
|
84
|
-
/**
|
|
85
|
-
* Bad Request
|
|
86
|
-
*/
|
|
87
|
-
400: ResponseErrorResponse;
|
|
88
|
-
/**
|
|
89
|
-
* Internal Server Error
|
|
90
|
-
*/
|
|
91
|
-
500: ResponseErrorResponse;
|
|
92
|
-
};
|
|
93
|
-
export type PostApiV1ChatCompletionsError = PostApiV1ChatCompletionsErrors[keyof PostApiV1ChatCompletionsErrors];
|
|
94
|
-
export type PostApiV1ChatCompletionsResponses = {
|
|
95
|
-
/**
|
|
96
|
-
* OK
|
|
97
|
-
*/
|
|
98
|
-
200: LlmapiChatCompletionResponse;
|
|
99
|
-
};
|
|
100
|
-
export type PostApiV1ChatCompletionsResponse = PostApiV1ChatCompletionsResponses[keyof PostApiV1ChatCompletionsResponses];
|
|
101
|
-
export type GetHealthData = {
|
|
102
|
-
body?: never;
|
|
103
|
-
path?: never;
|
|
104
|
-
query?: never;
|
|
105
|
-
url: '/health';
|
|
106
|
-
};
|
|
107
|
-
export type GetHealthErrors = {
|
|
108
|
-
/**
|
|
109
|
-
* Internal Server Error
|
|
110
|
-
*/
|
|
111
|
-
500: ResponseErrorResponse;
|
|
112
|
-
};
|
|
113
|
-
export type GetHealthError = GetHealthErrors[keyof GetHealthErrors];
|
|
114
|
-
export type GetHealthResponses = {
|
|
115
|
-
/**
|
|
116
|
-
* OK
|
|
117
|
-
*/
|
|
118
|
-
200: HandlersHealthResponse;
|
|
119
|
-
};
|
|
120
|
-
export type GetHealthResponse = GetHealthResponses[keyof GetHealthResponses];
|