@touhidrahman/auditlog-sdk 1.0.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/package.json +29 -0
- package/src/hey-api/client/client.gen.d.ts +2 -0
- package/src/hey-api/client/client.gen.js +217 -0
- package/src/hey-api/client/index.d.ts +10 -0
- package/src/hey-api/client/index.js +6 -0
- package/src/hey-api/client/types.gen.d.ts +120 -0
- package/src/hey-api/client/types.gen.js +2 -0
- package/src/hey-api/client/utils.gen.d.ts +37 -0
- package/src/hey-api/client/utils.gen.js +233 -0
- package/src/hey-api/client.gen.d.ts +12 -0
- package/src/hey-api/client.gen.js +5 -0
- package/src/hey-api/core/auth.gen.d.ts +25 -0
- package/src/hey-api/core/auth.gen.js +14 -0
- package/src/hey-api/core/bodySerializer.gen.d.ts +25 -0
- package/src/hey-api/core/bodySerializer.gen.js +57 -0
- package/src/hey-api/core/params.gen.d.ts +43 -0
- package/src/hey-api/core/params.gen.js +106 -0
- package/src/hey-api/core/pathSerializer.gen.d.ts +33 -0
- package/src/hey-api/core/pathSerializer.gen.js +118 -0
- package/src/hey-api/core/queryKeySerializer.gen.d.ts +18 -0
- package/src/hey-api/core/queryKeySerializer.gen.js +100 -0
- package/src/hey-api/core/serverSentEvents.gen.d.ts +71 -0
- package/src/hey-api/core/serverSentEvents.gen.js +136 -0
- package/src/hey-api/core/types.gen.d.ts +83 -0
- package/src/hey-api/core/types.gen.js +2 -0
- package/src/hey-api/core/utils.gen.d.ts +19 -0
- package/src/hey-api/core/utils.gen.js +88 -0
- package/src/hey-api/index.d.ts +2 -0
- package/src/hey-api/index.js +2 -0
- package/src/hey-api/sdk.gen.d.ts +34 -0
- package/src/hey-api/sdk.gen.js +112 -0
- package/src/hey-api/transformers.gen.d.ts +15 -0
- package/src/hey-api/transformers.gen.js +130 -0
- package/src/hey-api/types.gen.d.ts +731 -0
- package/src/hey-api/types.gen.js +2 -0
- package/src/index.d.ts +3 -0
- package/src/index.js +3 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
export function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
|
|
3
|
+
let lastEventId;
|
|
4
|
+
const sleep = sseSleepFn ??
|
|
5
|
+
((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
6
|
+
const createStream = async function* () {
|
|
7
|
+
let retryDelay = sseDefaultRetryDelay ?? 3000;
|
|
8
|
+
let attempt = 0;
|
|
9
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
10
|
+
while (true) {
|
|
11
|
+
if (signal.aborted)
|
|
12
|
+
break;
|
|
13
|
+
attempt++;
|
|
14
|
+
const headers = options.headers instanceof Headers
|
|
15
|
+
? options.headers
|
|
16
|
+
: new Headers(options.headers);
|
|
17
|
+
if (lastEventId !== undefined) {
|
|
18
|
+
headers.set('Last-Event-ID', lastEventId);
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const requestInit = {
|
|
22
|
+
redirect: 'follow',
|
|
23
|
+
...options,
|
|
24
|
+
body: options.serializedBody,
|
|
25
|
+
headers,
|
|
26
|
+
signal,
|
|
27
|
+
};
|
|
28
|
+
let request = new Request(url, requestInit);
|
|
29
|
+
if (onRequest) {
|
|
30
|
+
request = await onRequest(url, requestInit);
|
|
31
|
+
}
|
|
32
|
+
// fetch must be assigned here, otherwise it would throw the error:
|
|
33
|
+
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
34
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
35
|
+
const response = await _fetch(request);
|
|
36
|
+
if (!response.ok)
|
|
37
|
+
throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
38
|
+
if (!response.body)
|
|
39
|
+
throw new Error('No body in SSE response');
|
|
40
|
+
const reader = response.body
|
|
41
|
+
.pipeThrough(new TextDecoderStream())
|
|
42
|
+
.getReader();
|
|
43
|
+
let buffer = '';
|
|
44
|
+
const abortHandler = () => {
|
|
45
|
+
try {
|
|
46
|
+
reader.cancel();
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// noop
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
signal.addEventListener('abort', abortHandler);
|
|
53
|
+
try {
|
|
54
|
+
while (true) {
|
|
55
|
+
const { done, value } = await reader.read();
|
|
56
|
+
if (done)
|
|
57
|
+
break;
|
|
58
|
+
buffer += value;
|
|
59
|
+
buffer = buffer.replace(/\r\n?/g, '\n'); // normalize line endings
|
|
60
|
+
const chunks = buffer.split('\n\n');
|
|
61
|
+
buffer = chunks.pop() ?? '';
|
|
62
|
+
for (const chunk of chunks) {
|
|
63
|
+
const lines = chunk.split('\n');
|
|
64
|
+
const dataLines = [];
|
|
65
|
+
let eventName;
|
|
66
|
+
for (const line of lines) {
|
|
67
|
+
if (line.startsWith('data:')) {
|
|
68
|
+
dataLines.push(line.replace(/^data:\s*/, ''));
|
|
69
|
+
}
|
|
70
|
+
else if (line.startsWith('event:')) {
|
|
71
|
+
eventName = line.replace(/^event:\s*/, '');
|
|
72
|
+
}
|
|
73
|
+
else if (line.startsWith('id:')) {
|
|
74
|
+
lastEventId = line.replace(/^id:\s*/, '');
|
|
75
|
+
}
|
|
76
|
+
else if (line.startsWith('retry:')) {
|
|
77
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10);
|
|
78
|
+
if (!Number.isNaN(parsed)) {
|
|
79
|
+
retryDelay = parsed;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
let data;
|
|
84
|
+
let parsedJson = false;
|
|
85
|
+
if (dataLines.length) {
|
|
86
|
+
const rawData = dataLines.join('\n');
|
|
87
|
+
try {
|
|
88
|
+
data = JSON.parse(rawData);
|
|
89
|
+
parsedJson = true;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
data = rawData;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (parsedJson) {
|
|
96
|
+
if (responseValidator) {
|
|
97
|
+
await responseValidator(data);
|
|
98
|
+
}
|
|
99
|
+
if (responseTransformer) {
|
|
100
|
+
data = await responseTransformer(data);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
onSseEvent?.({
|
|
104
|
+
data,
|
|
105
|
+
event: eventName,
|
|
106
|
+
id: lastEventId,
|
|
107
|
+
retry: retryDelay,
|
|
108
|
+
});
|
|
109
|
+
if (dataLines.length) {
|
|
110
|
+
yield data;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
signal.removeEventListener('abort', abortHandler);
|
|
117
|
+
reader.releaseLock();
|
|
118
|
+
}
|
|
119
|
+
break; // exit loop on normal completion
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
// connection failed or aborted; retry after delay
|
|
123
|
+
onSseError?.(error);
|
|
124
|
+
if (sseMaxRetryAttempts !== undefined &&
|
|
125
|
+
attempt >= sseMaxRetryAttempts) {
|
|
126
|
+
break; // stop after firing error
|
|
127
|
+
}
|
|
128
|
+
// exponential backoff: double retry each attempt, cap at 30s
|
|
129
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
|
|
130
|
+
await sleep(backoff);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
const stream = createStream();
|
|
135
|
+
return { stream };
|
|
136
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
/**
|
|
75
|
+
* Arbitrary metadata passed through the `meta` request option.
|
|
76
|
+
*/
|
|
77
|
+
export interface ClientMeta {
|
|
78
|
+
}
|
|
79
|
+
type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] ? true : [T] extends [never | undefined] ? [undefined] extends [T] ? false : true : false;
|
|
80
|
+
export type OmitNever<T extends Record<string, unknown>> = {
|
|
81
|
+
[K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
|
|
82
|
+
};
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, } from './pathSerializer.gen';
|
|
3
|
+
export const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
4
|
+
export const defaultPathSerializer = ({ path, url: _url, }) => {
|
|
5
|
+
let url = _url;
|
|
6
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
7
|
+
if (matches) {
|
|
8
|
+
for (const match of matches) {
|
|
9
|
+
let explode = false;
|
|
10
|
+
let name = match.substring(1, match.length - 1);
|
|
11
|
+
let style = 'simple';
|
|
12
|
+
if (name.endsWith('*')) {
|
|
13
|
+
explode = true;
|
|
14
|
+
name = name.substring(0, name.length - 1);
|
|
15
|
+
}
|
|
16
|
+
if (name.startsWith('.')) {
|
|
17
|
+
name = name.substring(1);
|
|
18
|
+
style = 'label';
|
|
19
|
+
}
|
|
20
|
+
else if (name.startsWith(';')) {
|
|
21
|
+
name = name.substring(1);
|
|
22
|
+
style = 'matrix';
|
|
23
|
+
}
|
|
24
|
+
const value = path[name];
|
|
25
|
+
if (value === undefined || value === null) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (Array.isArray(value)) {
|
|
29
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value === 'object') {
|
|
33
|
+
url = url.replace(match, serializeObjectParam({
|
|
34
|
+
explode,
|
|
35
|
+
name,
|
|
36
|
+
style,
|
|
37
|
+
value: value,
|
|
38
|
+
valueOnly: true,
|
|
39
|
+
}));
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (style === 'matrix') {
|
|
43
|
+
url = url.replace(match, `;${serializePrimitiveParam({
|
|
44
|
+
name,
|
|
45
|
+
value: value,
|
|
46
|
+
})}`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);
|
|
50
|
+
url = url.replace(match, replaceValue);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return url;
|
|
54
|
+
};
|
|
55
|
+
export const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {
|
|
56
|
+
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
|
|
57
|
+
let url = (baseUrl ?? '') + pathUrl;
|
|
58
|
+
if (path) {
|
|
59
|
+
url = defaultPathSerializer({ path, url });
|
|
60
|
+
}
|
|
61
|
+
let search = query ? querySerializer(query) : '';
|
|
62
|
+
if (search.startsWith('?')) {
|
|
63
|
+
search = search.substring(1);
|
|
64
|
+
}
|
|
65
|
+
if (search) {
|
|
66
|
+
url += `?${search}`;
|
|
67
|
+
}
|
|
68
|
+
return url;
|
|
69
|
+
};
|
|
70
|
+
export function getValidRequestBody(options) {
|
|
71
|
+
const hasBody = options.body !== undefined;
|
|
72
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
73
|
+
if (isSerializedBody) {
|
|
74
|
+
if ('serializedBody' in options) {
|
|
75
|
+
const hasSerializedBody = options.serializedBody !== undefined &&
|
|
76
|
+
options.serializedBody !== '';
|
|
77
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
78
|
+
}
|
|
79
|
+
// not all clients implement a serializedBody property (i.e., client-axios)
|
|
80
|
+
return options.body !== '' ? options.body : null;
|
|
81
|
+
}
|
|
82
|
+
// plain/text body
|
|
83
|
+
if (hasBody) {
|
|
84
|
+
return options.body;
|
|
85
|
+
}
|
|
86
|
+
// no body was provided
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { deleteLogsEntityEntityId, deleteLogsId, deleteProjectsByProjectId, deleteSecretKeysById, get, getLogs, getLogsExportCsv, getLogsId, getProjects, getProjectsByProjectId, getSecretKeys, getSecretKeysById, type Options, postAdminLogin, postAdminNewToken, postLogs, postProjects, postSecretKeys, putProjectsByProjectId, putProjectsByProjectIdChangeId, } from './sdk.gen';
|
|
2
|
+
export type { ClientOptions, DeleteLogsEntityEntityIdData, DeleteLogsEntityEntityIdError, DeleteLogsEntityEntityIdErrors, DeleteLogsEntityEntityIdResponse, DeleteLogsEntityEntityIdResponses, DeleteLogsIdData, DeleteLogsIdError, DeleteLogsIdErrors, DeleteLogsIdResponse, DeleteLogsIdResponses, DeleteProjectsByProjectIdData, DeleteProjectsByProjectIdResponse, DeleteProjectsByProjectIdResponses, DeleteSecretKeysByIdData, DeleteSecretKeysByIdResponse, DeleteSecretKeysByIdResponses, GetData, GetLogsData, GetLogsExportCsvData, GetLogsExportCsvResponse, GetLogsExportCsvResponses, GetLogsIdData, GetLogsIdError, GetLogsIdErrors, GetLogsIdResponse, GetLogsIdResponses, GetLogsResponse, GetLogsResponses, GetProjectsByProjectIdData, GetProjectsByProjectIdResponse, GetProjectsByProjectIdResponses, GetProjectsData, GetProjectsResponse, GetProjectsResponses, GetResponse, GetResponses, GetSecretKeysByIdData, GetSecretKeysByIdResponse, GetSecretKeysByIdResponses, GetSecretKeysData, GetSecretKeysResponse, GetSecretKeysResponses, PostAdminLoginData, PostAdminLoginResponse, PostAdminLoginResponses, PostAdminNewTokenData, PostAdminNewTokenResponse, PostAdminNewTokenResponses, PostLogsData, PostLogsError, PostLogsErrors, PostLogsResponse, PostLogsResponses, PostProjectsData, PostProjectsResponse, PostProjectsResponses, PostSecretKeysData, PostSecretKeysResponse, PostSecretKeysResponses, PutProjectsByProjectIdChangeIdData, PutProjectsByProjectIdChangeIdResponse, PutProjectsByProjectIdChangeIdResponses, PutProjectsByProjectIdData, PutProjectsByProjectIdResponse, PutProjectsByProjectIdResponses, } from './types.gen';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
export { deleteLogsEntityEntityId, deleteLogsId, deleteProjectsByProjectId, deleteSecretKeysById, get, getLogs, getLogsExportCsv, getLogsId, getProjects, getProjectsByProjectId, getSecretKeys, getSecretKeysById, postAdminLogin, postAdminNewToken, postLogs, postProjects, postSecretKeys, putProjectsByProjectId, putProjectsByProjectIdChangeId, } from './sdk.gen';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client';
|
|
2
|
+
import type { DeleteLogsEntityEntityIdData, DeleteLogsEntityEntityIdErrors, DeleteLogsEntityEntityIdResponses, DeleteLogsIdData, DeleteLogsIdErrors, DeleteLogsIdResponses, DeleteProjectsByProjectIdData, DeleteProjectsByProjectIdResponses, DeleteSecretKeysByIdData, DeleteSecretKeysByIdResponses, GetData, GetLogsData, GetLogsExportCsvData, GetLogsExportCsvResponses, GetLogsIdData, GetLogsIdErrors, GetLogsIdResponses, GetLogsResponses, GetProjectsByProjectIdData, GetProjectsByProjectIdResponses, GetProjectsData, GetProjectsResponses, GetResponses, GetSecretKeysByIdData, GetSecretKeysByIdResponses, GetSecretKeysData, GetSecretKeysResponses, PostAdminLoginData, PostAdminLoginResponses, PostAdminNewTokenData, PostAdminNewTokenResponses, PostLogsData, PostLogsErrors, PostLogsResponses, PostProjectsData, PostProjectsResponses, PostSecretKeysData, PostSecretKeysResponses, PutProjectsByProjectIdChangeIdData, PutProjectsByProjectIdChangeIdResponses, PutProjectsByProjectIdData, PutProjectsByProjectIdResponses } from './types.gen';
|
|
3
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
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?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
|
|
15
|
+
};
|
|
16
|
+
export declare const get: <ThrowOnError extends boolean = false>(options?: Options<GetData, ThrowOnError>) => RequestResult<GetResponses, unknown, ThrowOnError>;
|
|
17
|
+
export declare const postAdminNewToken: <ThrowOnError extends boolean = false>(options: Options<PostAdminNewTokenData, ThrowOnError>) => RequestResult<PostAdminNewTokenResponses, unknown, ThrowOnError>;
|
|
18
|
+
export declare const postAdminLogin: <ThrowOnError extends boolean = false>(options: Options<PostAdminLoginData, ThrowOnError>) => RequestResult<PostAdminLoginResponses, unknown, ThrowOnError>;
|
|
19
|
+
export declare const getProjects: <ThrowOnError extends boolean = false>(options?: Options<GetProjectsData, ThrowOnError>) => RequestResult<GetProjectsResponses, unknown, ThrowOnError>;
|
|
20
|
+
export declare const postProjects: <ThrowOnError extends boolean = false>(options?: Options<PostProjectsData, ThrowOnError>) => RequestResult<PostProjectsResponses, unknown, ThrowOnError>;
|
|
21
|
+
export declare const deleteProjectsByProjectId: <ThrowOnError extends boolean = false>(options: Options<DeleteProjectsByProjectIdData, ThrowOnError>) => RequestResult<DeleteProjectsByProjectIdResponses, unknown, ThrowOnError>;
|
|
22
|
+
export declare const getProjectsByProjectId: <ThrowOnError extends boolean = false>(options: Options<GetProjectsByProjectIdData, ThrowOnError>) => RequestResult<GetProjectsByProjectIdResponses, unknown, ThrowOnError>;
|
|
23
|
+
export declare const putProjectsByProjectId: <ThrowOnError extends boolean = false>(options: Options<PutProjectsByProjectIdData, ThrowOnError>) => RequestResult<PutProjectsByProjectIdResponses, unknown, ThrowOnError>;
|
|
24
|
+
export declare const putProjectsByProjectIdChangeId: <ThrowOnError extends boolean = false>(options: Options<PutProjectsByProjectIdChangeIdData, ThrowOnError>) => RequestResult<PutProjectsByProjectIdChangeIdResponses, unknown, ThrowOnError>;
|
|
25
|
+
export declare const getSecretKeys: <ThrowOnError extends boolean = false>(options?: Options<GetSecretKeysData, ThrowOnError>) => RequestResult<GetSecretKeysResponses, unknown, ThrowOnError>;
|
|
26
|
+
export declare const postSecretKeys: <ThrowOnError extends boolean = false>(options?: Options<PostSecretKeysData, ThrowOnError>) => RequestResult<PostSecretKeysResponses, unknown, ThrowOnError>;
|
|
27
|
+
export declare const deleteSecretKeysById: <ThrowOnError extends boolean = false>(options: Options<DeleteSecretKeysByIdData, ThrowOnError>) => RequestResult<DeleteSecretKeysByIdResponses, unknown, ThrowOnError>;
|
|
28
|
+
export declare const getSecretKeysById: <ThrowOnError extends boolean = false>(options: Options<GetSecretKeysByIdData, ThrowOnError>) => RequestResult<GetSecretKeysByIdResponses, unknown, ThrowOnError>;
|
|
29
|
+
export declare const getLogs: <ThrowOnError extends boolean = false>(options?: Options<GetLogsData, ThrowOnError>) => RequestResult<GetLogsResponses, unknown, ThrowOnError>;
|
|
30
|
+
export declare const postLogs: <ThrowOnError extends boolean = false>(options?: Options<PostLogsData, ThrowOnError>) => RequestResult<PostLogsResponses, PostLogsErrors, ThrowOnError>;
|
|
31
|
+
export declare const getLogsExportCsv: <ThrowOnError extends boolean = false>(options?: Options<GetLogsExportCsvData, ThrowOnError>) => RequestResult<GetLogsExportCsvResponses, unknown, ThrowOnError>;
|
|
32
|
+
export declare const deleteLogsId: <ThrowOnError extends boolean = false>(options: Options<DeleteLogsIdData, ThrowOnError>) => RequestResult<DeleteLogsIdResponses, DeleteLogsIdErrors, ThrowOnError>;
|
|
33
|
+
export declare const getLogsId: <ThrowOnError extends boolean = false>(options: Options<GetLogsIdData, ThrowOnError>) => RequestResult<GetLogsIdResponses, GetLogsIdErrors, ThrowOnError>;
|
|
34
|
+
export declare const deleteLogsEntityEntityId: <ThrowOnError extends boolean = false>(options: Options<DeleteLogsEntityEntityIdData, ThrowOnError>) => RequestResult<DeleteLogsEntityEntityIdResponses, DeleteLogsEntityEntityIdErrors, ThrowOnError>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
import { client } from './client.gen';
|
|
3
|
+
import { deleteProjectsByProjectIdResponseTransformer, deleteSecretKeysByIdResponseTransformer, getLogsIdResponseTransformer, getLogsResponseTransformer, getProjectsByProjectIdResponseTransformer, getProjectsResponseTransformer, getSecretKeysByIdResponseTransformer, getSecretKeysResponseTransformer, postAdminLoginResponseTransformer, postAdminNewTokenResponseTransformer, postLogsResponseTransformer, postProjectsResponseTransformer, postSecretKeysResponseTransformer, putProjectsByProjectIdResponseTransformer, } from './transformers.gen';
|
|
4
|
+
export const get = (options) => (options?.client ?? client).get({
|
|
5
|
+
url: '/',
|
|
6
|
+
...options,
|
|
7
|
+
});
|
|
8
|
+
export const postAdminNewToken = (options) => (options.client ?? client).post({
|
|
9
|
+
responseTransformer: postAdminNewTokenResponseTransformer,
|
|
10
|
+
url: '/admin/new-token',
|
|
11
|
+
...options,
|
|
12
|
+
headers: {
|
|
13
|
+
'Content-Type': 'application/json',
|
|
14
|
+
...options.headers,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export const postAdminLogin = (options) => (options.client ?? client).post({
|
|
18
|
+
responseTransformer: postAdminLoginResponseTransformer,
|
|
19
|
+
url: '/admin/login',
|
|
20
|
+
...options,
|
|
21
|
+
headers: {
|
|
22
|
+
'Content-Type': 'application/json',
|
|
23
|
+
...options.headers,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export const getProjects = (options) => (options?.client ?? client).get({
|
|
27
|
+
responseTransformer: getProjectsResponseTransformer,
|
|
28
|
+
url: '/projects',
|
|
29
|
+
...options,
|
|
30
|
+
});
|
|
31
|
+
export const postProjects = (options) => (options?.client ?? client).post({
|
|
32
|
+
responseTransformer: postProjectsResponseTransformer,
|
|
33
|
+
url: '/projects',
|
|
34
|
+
...options,
|
|
35
|
+
headers: {
|
|
36
|
+
'Content-Type': 'application/json',
|
|
37
|
+
...options?.headers,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
export const deleteProjectsByProjectId = (options) => (options.client ?? client).delete({
|
|
41
|
+
responseTransformer: deleteProjectsByProjectIdResponseTransformer,
|
|
42
|
+
url: '/projects/{projectId}',
|
|
43
|
+
...options,
|
|
44
|
+
});
|
|
45
|
+
export const getProjectsByProjectId = (options) => (options.client ?? client).get({
|
|
46
|
+
responseTransformer: getProjectsByProjectIdResponseTransformer,
|
|
47
|
+
url: '/projects/{projectId}',
|
|
48
|
+
...options,
|
|
49
|
+
});
|
|
50
|
+
export const putProjectsByProjectId = (options) => (options.client ?? client).put({
|
|
51
|
+
responseTransformer: putProjectsByProjectIdResponseTransformer,
|
|
52
|
+
url: '/projects/{projectId}',
|
|
53
|
+
...options,
|
|
54
|
+
headers: {
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
...options.headers,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
export const putProjectsByProjectIdChangeId = (options) => (options.client ?? client).put({
|
|
60
|
+
url: '/projects/{projectId}/change-id',
|
|
61
|
+
...options,
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': 'application/json',
|
|
64
|
+
...options.headers,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
export const getSecretKeys = (options) => (options?.client ?? client).get({
|
|
68
|
+
responseTransformer: getSecretKeysResponseTransformer,
|
|
69
|
+
url: '/secret-keys',
|
|
70
|
+
...options,
|
|
71
|
+
});
|
|
72
|
+
export const postSecretKeys = (options) => (options?.client ?? client).post({
|
|
73
|
+
responseTransformer: postSecretKeysResponseTransformer,
|
|
74
|
+
url: '/secret-keys',
|
|
75
|
+
...options,
|
|
76
|
+
headers: {
|
|
77
|
+
'Content-Type': 'application/json',
|
|
78
|
+
...options?.headers,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
export const deleteSecretKeysById = (options) => (options.client ?? client).delete({
|
|
82
|
+
responseTransformer: deleteSecretKeysByIdResponseTransformer,
|
|
83
|
+
url: '/secret-keys/{id}',
|
|
84
|
+
...options,
|
|
85
|
+
});
|
|
86
|
+
export const getSecretKeysById = (options) => (options.client ?? client).get({
|
|
87
|
+
responseTransformer: getSecretKeysByIdResponseTransformer,
|
|
88
|
+
url: '/secret-keys/{id}',
|
|
89
|
+
...options,
|
|
90
|
+
});
|
|
91
|
+
export const getLogs = (options) => (options?.client ?? client).get({
|
|
92
|
+
responseTransformer: getLogsResponseTransformer,
|
|
93
|
+
url: '/logs',
|
|
94
|
+
...options,
|
|
95
|
+
});
|
|
96
|
+
export const postLogs = (options) => (options?.client ?? client).post({
|
|
97
|
+
responseTransformer: postLogsResponseTransformer,
|
|
98
|
+
url: '/logs',
|
|
99
|
+
...options,
|
|
100
|
+
headers: {
|
|
101
|
+
'Content-Type': 'application/json',
|
|
102
|
+
...options?.headers,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
export const getLogsExportCsv = (options) => (options?.client ?? client).get({ url: '/logs/export/csv', ...options });
|
|
106
|
+
export const deleteLogsId = (options) => (options.client ?? client).delete({ url: '/logs/:id', ...options });
|
|
107
|
+
export const getLogsId = (options) => (options.client ?? client).get({
|
|
108
|
+
responseTransformer: getLogsIdResponseTransformer,
|
|
109
|
+
url: '/logs/:id',
|
|
110
|
+
...options,
|
|
111
|
+
});
|
|
112
|
+
export const deleteLogsEntityEntityId = (options) => (options.client ?? client).delete({ url: '/logs/entity/:entityId', ...options });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DeleteProjectsByProjectIdResponse, DeleteSecretKeysByIdResponse, GetLogsIdResponse, GetLogsResponse, GetProjectsByProjectIdResponse, GetProjectsResponse, GetSecretKeysByIdResponse, GetSecretKeysResponse, PostAdminLoginResponse, PostAdminNewTokenResponse, PostLogsResponse, PostProjectsResponse, PostSecretKeysResponse, PutProjectsByProjectIdResponse } from './types.gen';
|
|
2
|
+
export declare const postAdminNewTokenResponseTransformer: (data: any) => Promise<PostAdminNewTokenResponse>;
|
|
3
|
+
export declare const postAdminLoginResponseTransformer: (data: any) => Promise<PostAdminLoginResponse>;
|
|
4
|
+
export declare const getProjectsResponseTransformer: (data: any) => Promise<GetProjectsResponse>;
|
|
5
|
+
export declare const postProjectsResponseTransformer: (data: any) => Promise<PostProjectsResponse>;
|
|
6
|
+
export declare const deleteProjectsByProjectIdResponseTransformer: (data: any) => Promise<DeleteProjectsByProjectIdResponse>;
|
|
7
|
+
export declare const getProjectsByProjectIdResponseTransformer: (data: any) => Promise<GetProjectsByProjectIdResponse>;
|
|
8
|
+
export declare const putProjectsByProjectIdResponseTransformer: (data: any) => Promise<PutProjectsByProjectIdResponse>;
|
|
9
|
+
export declare const getSecretKeysResponseTransformer: (data: any) => Promise<GetSecretKeysResponse>;
|
|
10
|
+
export declare const postSecretKeysResponseTransformer: (data: any) => Promise<PostSecretKeysResponse>;
|
|
11
|
+
export declare const deleteSecretKeysByIdResponseTransformer: (data: any) => Promise<DeleteSecretKeysByIdResponse>;
|
|
12
|
+
export declare const getSecretKeysByIdResponseTransformer: (data: any) => Promise<GetSecretKeysByIdResponse>;
|
|
13
|
+
export declare const getLogsResponseTransformer: (data: any) => Promise<GetLogsResponse>;
|
|
14
|
+
export declare const postLogsResponseTransformer: (data: any) => Promise<PostLogsResponse>;
|
|
15
|
+
export declare const getLogsIdResponseTransformer: (data: any) => Promise<GetLogsIdResponse>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
export const postAdminNewTokenResponseTransformer = async (data) => {
|
|
3
|
+
if (data.data.lastLogin) {
|
|
4
|
+
data.data.lastLogin = new Date(data.data.lastLogin);
|
|
5
|
+
}
|
|
6
|
+
return data;
|
|
7
|
+
};
|
|
8
|
+
export const postAdminLoginResponseTransformer = async (data) => {
|
|
9
|
+
if (data.data.lastLogin) {
|
|
10
|
+
data.data.lastLogin = new Date(data.data.lastLogin);
|
|
11
|
+
}
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
export const getProjectsResponseTransformer = async (data) => {
|
|
15
|
+
data.data = data.data.map((item) => {
|
|
16
|
+
if (item.createdAt) {
|
|
17
|
+
item.createdAt = new Date(item.createdAt);
|
|
18
|
+
}
|
|
19
|
+
if (item.updatedAt) {
|
|
20
|
+
item.updatedAt = new Date(item.updatedAt);
|
|
21
|
+
}
|
|
22
|
+
return item;
|
|
23
|
+
});
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
export const postProjectsResponseTransformer = async (data) => {
|
|
27
|
+
if (data.data.createdAt) {
|
|
28
|
+
data.data.createdAt = new Date(data.data.createdAt);
|
|
29
|
+
}
|
|
30
|
+
if (data.data.updatedAt) {
|
|
31
|
+
data.data.updatedAt = new Date(data.data.updatedAt);
|
|
32
|
+
}
|
|
33
|
+
return data;
|
|
34
|
+
};
|
|
35
|
+
export const deleteProjectsByProjectIdResponseTransformer = async (data) => {
|
|
36
|
+
if (data.data.createdAt) {
|
|
37
|
+
data.data.createdAt = new Date(data.data.createdAt);
|
|
38
|
+
}
|
|
39
|
+
if (data.data.updatedAt) {
|
|
40
|
+
data.data.updatedAt = new Date(data.data.updatedAt);
|
|
41
|
+
}
|
|
42
|
+
return data;
|
|
43
|
+
};
|
|
44
|
+
export const getProjectsByProjectIdResponseTransformer = async (data) => {
|
|
45
|
+
if (data.data.createdAt) {
|
|
46
|
+
data.data.createdAt = new Date(data.data.createdAt);
|
|
47
|
+
}
|
|
48
|
+
if (data.data.updatedAt) {
|
|
49
|
+
data.data.updatedAt = new Date(data.data.updatedAt);
|
|
50
|
+
}
|
|
51
|
+
return data;
|
|
52
|
+
};
|
|
53
|
+
export const putProjectsByProjectIdResponseTransformer = async (data) => {
|
|
54
|
+
if (data.data.createdAt) {
|
|
55
|
+
data.data.createdAt = new Date(data.data.createdAt);
|
|
56
|
+
}
|
|
57
|
+
if (data.data.updatedAt) {
|
|
58
|
+
data.data.updatedAt = new Date(data.data.updatedAt);
|
|
59
|
+
}
|
|
60
|
+
return data;
|
|
61
|
+
};
|
|
62
|
+
export const getSecretKeysResponseTransformer = async (data) => {
|
|
63
|
+
data.data = data.data.map((item) => {
|
|
64
|
+
if (item.expiresAt) {
|
|
65
|
+
item.expiresAt = new Date(item.expiresAt);
|
|
66
|
+
}
|
|
67
|
+
if (item.createdAt) {
|
|
68
|
+
item.createdAt = new Date(item.createdAt);
|
|
69
|
+
}
|
|
70
|
+
return item;
|
|
71
|
+
});
|
|
72
|
+
return data;
|
|
73
|
+
};
|
|
74
|
+
export const postSecretKeysResponseTransformer = async (data) => {
|
|
75
|
+
if (data.data.expiresAt) {
|
|
76
|
+
data.data.expiresAt = new Date(data.data.expiresAt);
|
|
77
|
+
}
|
|
78
|
+
if (data.data.createdAt) {
|
|
79
|
+
data.data.createdAt = new Date(data.data.createdAt);
|
|
80
|
+
}
|
|
81
|
+
return data;
|
|
82
|
+
};
|
|
83
|
+
export const deleteSecretKeysByIdResponseTransformer = async (data) => {
|
|
84
|
+
if (data.data.expiresAt) {
|
|
85
|
+
data.data.expiresAt = new Date(data.data.expiresAt);
|
|
86
|
+
}
|
|
87
|
+
if (data.data.createdAt) {
|
|
88
|
+
data.data.createdAt = new Date(data.data.createdAt);
|
|
89
|
+
}
|
|
90
|
+
return data;
|
|
91
|
+
};
|
|
92
|
+
export const getSecretKeysByIdResponseTransformer = async (data) => {
|
|
93
|
+
if (data.data.expiresAt) {
|
|
94
|
+
data.data.expiresAt = new Date(data.data.expiresAt);
|
|
95
|
+
}
|
|
96
|
+
if (data.data.createdAt) {
|
|
97
|
+
data.data.createdAt = new Date(data.data.createdAt);
|
|
98
|
+
}
|
|
99
|
+
return data;
|
|
100
|
+
};
|
|
101
|
+
export const getLogsResponseTransformer = async (data) => {
|
|
102
|
+
data.data = data.data.map((item) => {
|
|
103
|
+
if (item.createdAt) {
|
|
104
|
+
item.createdAt = new Date(item.createdAt);
|
|
105
|
+
}
|
|
106
|
+
if (item.updatedAt) {
|
|
107
|
+
item.updatedAt = new Date(item.updatedAt);
|
|
108
|
+
}
|
|
109
|
+
return item;
|
|
110
|
+
});
|
|
111
|
+
return data;
|
|
112
|
+
};
|
|
113
|
+
export const postLogsResponseTransformer = async (data) => {
|
|
114
|
+
if (data.data.createdAt) {
|
|
115
|
+
data.data.createdAt = new Date(data.data.createdAt);
|
|
116
|
+
}
|
|
117
|
+
if (data.data.updatedAt) {
|
|
118
|
+
data.data.updatedAt = new Date(data.data.updatedAt);
|
|
119
|
+
}
|
|
120
|
+
return data;
|
|
121
|
+
};
|
|
122
|
+
export const getLogsIdResponseTransformer = async (data) => {
|
|
123
|
+
if (data.data.createdAt) {
|
|
124
|
+
data.data.createdAt = new Date(data.data.createdAt);
|
|
125
|
+
}
|
|
126
|
+
if (data.data.updatedAt) {
|
|
127
|
+
data.data.updatedAt = new Date(data.data.updatedAt);
|
|
128
|
+
}
|
|
129
|
+
return data;
|
|
130
|
+
};
|