@devtable/dashboard 10.37.3 → 10.39.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.
@@ -1,5 +1,7 @@
1
1
  import { DataSourceType, TPayloadForSQL } from '~/model';
2
2
  import { IDataSource } from './types';
3
+ import { AxiosError } from 'axios';
4
+ import { AnyObject } from '..';
3
5
  export declare type QueryFailureError = {
4
6
  code: 'BAD_REQUEST';
5
7
  detail: {
@@ -24,7 +26,7 @@ interface IQueryByHTTP {
24
26
  configString: string;
25
27
  name: string;
26
28
  }
27
- export declare function queryByHTTP({ type, key, configString, name }: IQueryByHTTP, signal: AbortSignal): Promise<any>;
29
+ export declare function queryByHTTP({ type, key, configString, name }: IQueryByHTTP, signal: AbortSignal): Promise<import("axios").AxiosResponse<AnyObject, any> | AxiosError<AnyObject, any>>;
28
30
  export declare type TQuerySources = Record<string, string[]>;
29
31
  export declare function listDataSources(): Promise<IDataSource[]>;
30
32
  export declare type GlobalSQLSnippetDBType = {
@@ -1,45 +1,37 @@
1
- import { AxiosRequestConfig, Method } from 'axios';
2
1
  import { DataSourceType } from '~/model';
3
2
  import { AnyObject, IDashboardConfig } from '..';
3
+ import { DefaultApiClient, IAPIClient, IAPIClientRequestOptions } from '../shared';
4
+ import { AxiosResponse, Method } from 'axios';
5
+ export { FacadeApiClient, DefaultApiClient } from '../shared';
6
+ export type { IAPIClient, IAPIClientRequestOptions } from '../shared';
4
7
  export declare type TQueryPayload = {
5
8
  type: DataSourceType;
6
9
  key: string;
7
10
  query: string;
8
11
  env?: AnyObject;
9
12
  };
10
- export interface IAPIClientRequestOptions {
11
- string?: boolean;
12
- params?: AnyObject;
13
- headers?: AnyObject;
14
- }
15
- export interface IAPIClient {
16
- getRequest: <T = $TSFixMe>(method: Method, signal?: AbortSignal) => (url: string, data: AnyObject, options?: IAPIClientRequestOptions) => Promise<T>;
13
+ export interface IDashboardAPIClient extends IAPIClient {
17
14
  query: <T = $TSFixMe>(signal?: AbortSignal) => (data: TQueryPayload, options?: AnyObject) => Promise<T>;
15
+ httpDataSourceQuery: <T = $TSFixMe>(signal?: AbortSignal) => (data: TQueryPayload, options?: AnyObject) => Promise<AxiosResponse<T>>;
18
16
  }
19
- export declare class DefaultApiClient implements IAPIClient {
20
- baseURL: string;
21
- app_id: string;
22
- app_secret: string;
23
- makeQueryENV: (() => AnyObject) | null;
24
- constructor();
25
- getAuthentication(params: Record<string, unknown>): {
26
- app_id: string;
27
- nonce_str: string;
28
- sign: string;
29
- } | undefined;
30
- getRequest(method: Method, signal?: AbortSignal): (url: string, data: AnyObject, options?: IAPIClientRequestOptions) => Promise<any>;
31
- buildAxiosConfig(method: Method, url: string, data: AnyObject, options: IAPIClientRequestOptions, headers: AnyObject, signal: AbortSignal | undefined): AxiosRequestConfig<any>;
32
- buildHeader(options: IAPIClientRequestOptions): AnyObject;
33
- query(signal?: AbortSignal): (data: TQueryPayload, options?: AnyObject) => Promise<any>;
17
+ export declare class DashboardApiClient extends DefaultApiClient implements IDashboardAPIClient {
18
+ makeQueryENV?: (() => AnyObject) | null;
19
+ query<T>(signal: AbortSignal | undefined): (data: TQueryPayload, options?: AnyObject) => Promise<T>;
20
+ httpDataSourceQuery<T>(signal: AbortSignal | undefined): (data: TQueryPayload, options?: AnyObject) => Promise<AxiosResponse<T>>;
34
21
  }
35
- export declare function configureAPIClient(config: IDashboardConfig): void;
36
- export declare class FacadeApiClient implements IAPIClient {
37
- implementation: IAPIClient;
38
- getRequest<T>(method: Method, signal?: AbortSignal): (url: string, data: AnyObject, options?: IAPIClientRequestOptions) => Promise<T>;
39
- query<T>(signal?: AbortSignal): (data: TQueryPayload, options?: AnyObject) => Promise<T>;
22
+ export declare class DashboardApiFacadeClient implements IDashboardAPIClient {
23
+ implementation: IDashboardAPIClient;
24
+ constructor(implementation: IDashboardAPIClient);
25
+ query<T>(signal?: AbortSignal): (data: TQueryPayload, options?: AnyObject | undefined) => Promise<T>;
26
+ httpDataSourceQuery<T>(signal?: AbortSignal): (data: TQueryPayload, options?: AnyObject | undefined) => Promise<AxiosResponse<T, any>>;
27
+ getRequest<T>(method: Method, signal?: AbortSignal): (url: string, data: import("../shared").AnyObject, options: IAPIClientRequestOptions, forResponse?: boolean | undefined) => Promise<T>;
28
+ get<T>(signal?: AbortSignal): (url: string, data: import("../shared").AnyObject, options: IAPIClientRequestOptions, forResponse?: boolean | undefined) => Promise<T>;
29
+ post<T>(signal?: AbortSignal): (url: string, data: import("../shared").AnyObject, options: IAPIClientRequestOptions, forResponse?: boolean | undefined) => Promise<T>;
30
+ put<T>(signal?: AbortSignal): (url: string, data: import("../shared").AnyObject, options: IAPIClientRequestOptions, forResponse?: boolean | undefined) => Promise<T>;
40
31
  }
32
+ export declare function configureAPIClient(config: IDashboardConfig): void;
41
33
  /**
42
34
  * @example facadeApiClient.implementation = new MyAPIClient();
43
35
  */
44
- export declare const facadeApiClient: FacadeApiClient;
45
- export declare const APIClient: IAPIClient;
36
+ export declare const facadeApiClient: DashboardApiFacadeClient;
37
+ export declare const APIClient: IDashboardAPIClient;