@touhidrahman/auditlog-sdk 1.0.3 → 1.1.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/index.cjs.js CHANGED
@@ -1076,6 +1076,7 @@ const deleteLogsEntityEntityId = options => (options.client ?? client).delete({
1076
1076
  ...options
1077
1077
  });
1078
1078
 
1079
+ exports.client = client;
1079
1080
  exports.deleteLogsEntityEntityId = deleteLogsEntityEntityId;
1080
1081
  exports.deleteLogsId = deleteLogsId;
1081
1082
  exports.deleteProjectsByProjectId = deleteProjectsByProjectId;
package/index.esm.js CHANGED
@@ -1074,4 +1074,4 @@ const deleteLogsEntityEntityId = options => (options.client ?? client).delete({
1074
1074
  ...options
1075
1075
  });
1076
1076
 
1077
- export { deleteLogsEntityEntityId, deleteLogsId, deleteProjectsByProjectId, deleteSecretKeysById, get, getLogs, getLogsExportCsv, getLogsId, getProjects, getProjectsByProjectId, getSecretKeys, getSecretKeysById, postAdminLogin, postAdminNewToken, postLogs, postProjects, postSecretKeys, putProjectsByProjectId, putProjectsByProjectIdChangeId };
1077
+ export { client, deleteLogsEntityEntityId, deleteLogsId, deleteProjectsByProjectId, deleteSecretKeysById, get, getLogs, getLogsExportCsv, getLogsId, getProjects, getProjectsByProjectId, getSecretKeys, getSecretKeysById, postAdminLogin, postAdminNewToken, postLogs, postProjects, postSecretKeys, putProjectsByProjectId, putProjectsByProjectIdChangeId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@touhidrahman/auditlog-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,2 @@
1
+ import type { Client, Config } from './types.gen';
2
+ export declare const createClient: (config?: Config) => Client;
@@ -0,0 +1,10 @@
1
+ export type { Auth } from '../core/auth.gen';
2
+ export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
3
+ export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
4
+ export { buildClientParams } from '../core/params.gen';
5
+ export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
6
+ export type { ServerSentEventsResult } from '../core/serverSentEvents.gen';
7
+ export type { ClientMeta } from '../core/types.gen';
8
+ export { createClient } from './client.gen';
9
+ export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from './types.gen';
10
+ export { createConfig, mergeHeaders } from './utils.gen';
@@ -0,0 +1,120 @@
1
+ import type { Auth } from '../core/auth.gen';
2
+ import type { ServerSentEventsOptions, ServerSentEventsResult } from '../core/serverSentEvents.gen';
3
+ import type { Client as CoreClient, Config as CoreConfig } from '../core/types.gen';
4
+ import type { Middleware } from './utils.gen';
5
+ export type ResponseStyle = 'data' | 'fields';
6
+ export interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, CoreConfig {
7
+ /**
8
+ * Base URL for all requests made by this client.
9
+ */
10
+ baseUrl?: T['baseUrl'];
11
+ /**
12
+ * Fetch API implementation. You can use this option to provide a custom
13
+ * fetch instance.
14
+ *
15
+ * @default globalThis.fetch
16
+ */
17
+ fetch?: typeof fetch;
18
+ /**
19
+ * Please don't use the Fetch client for Next.js applications. The `next`
20
+ * options won't have any effect.
21
+ *
22
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
23
+ */
24
+ next?: never;
25
+ /**
26
+ * Return the response data parsed in a specified format. By default, `auto`
27
+ * will infer the appropriate method from the `Content-Type` response header.
28
+ * You can override this behavior with any of the {@link Body} methods.
29
+ * Select `stream` if you don't want to parse response data at all.
30
+ *
31
+ * @default 'auto'
32
+ */
33
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
34
+ /**
35
+ * Should we return only data or multiple fields (data, error, response, etc.)?
36
+ *
37
+ * @default 'fields'
38
+ */
39
+ responseStyle?: ResponseStyle;
40
+ /**
41
+ * Throw an error instead of returning it in the response?
42
+ *
43
+ * @default false
44
+ */
45
+ throwOnError?: T['throwOnError'];
46
+ }
47
+ export interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
48
+ responseStyle: TResponseStyle;
49
+ throwOnError: ThrowOnError;
50
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
51
+ /**
52
+ * Any body that you want to add to your request.
53
+ *
54
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
55
+ */
56
+ body?: unknown;
57
+ path?: Record<string, unknown>;
58
+ query?: Record<string, unknown>;
59
+ /**
60
+ * Security mechanism(s) to use for the request.
61
+ */
62
+ security?: ReadonlyArray<Auth>;
63
+ url: Url;
64
+ }
65
+ export interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
66
+ headers: Headers;
67
+ serializedBody?: string;
68
+ }
69
+ export type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
70
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
71
+ request: Request;
72
+ response: Response;
73
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
74
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
75
+ error: undefined;
76
+ } | {
77
+ data: undefined;
78
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
79
+ }) & {
80
+ /** request may be undefined, because error may be from building the request object itself */
81
+ request?: Request;
82
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
83
+ response?: Response;
84
+ }>;
85
+ export interface ClientOptions {
86
+ baseUrl?: string;
87
+ responseStyle?: ResponseStyle;
88
+ throwOnError?: boolean;
89
+ }
90
+ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
91
+ type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
92
+ type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
93
+ type BuildUrlFn = <TData extends {
94
+ body?: unknown;
95
+ path?: Record<string, unknown>;
96
+ query?: Record<string, unknown>;
97
+ url: string;
98
+ }>(options: TData & Options<TData>) => string;
99
+ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
100
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
101
+ };
102
+ /**
103
+ * The `createClientConfig()` function will be called on client initialization
104
+ * and the returned object will become the client's initial configuration.
105
+ *
106
+ * You may want to initialize your client this way instead of calling
107
+ * `setConfig()`. This is useful for example if you're using Next.js
108
+ * to ensure your client always has the correct values.
109
+ */
110
+ export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
111
+ export interface TDataShape {
112
+ body?: unknown;
113
+ headers?: unknown;
114
+ path?: unknown;
115
+ query?: unknown;
116
+ url: string;
117
+ }
118
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
119
+ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
120
+ export {};
@@ -1,2 +1,12 @@
1
- import type { Client, Config } from './types.gen';
2
- export declare const createClient: (config?: Config) => Client;
1
+ import { type Client, type ClientOptions, type Config } from './client';
2
+ import type { ClientOptions as ClientOptions2 } from './types.gen';
3
+ /**
4
+ * The `createClientConfig()` function will be called on client initialization
5
+ * and the returned object will become the client's initial configuration.
6
+ *
7
+ * You may want to initialize your client this way instead of calling
8
+ * `setConfig()`. This is useful for example if you're using Next.js
9
+ * to ensure your client always has the correct values.
10
+ */
11
+ export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
12
+ export declare const client: Client;
@@ -1,10 +1,2 @@
1
- export type { Auth } from '../core/auth.gen';
2
- export type { QuerySerializerOptions } from '../core/bodySerializer.gen';
3
- export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer, } from '../core/bodySerializer.gen';
4
- export { buildClientParams } from '../core/params.gen';
5
- export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen';
6
- export type { ServerSentEventsResult } from '../core/serverSentEvents.gen';
7
- export type { ClientMeta } from '../core/types.gen';
8
- export { createClient } from './client.gen';
9
- export type { Client, ClientOptions, Config, CreateClientConfig, Options, RequestOptions, RequestResult, ResolvedRequestOptions, ResponseStyle, TDataShape, } from './types.gen';
10
- export { createConfig, mergeHeaders } from './utils.gen';
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';