mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-11 23:54:48 +00:00
216 lines
4.3 KiB
TypeScript
216 lines
4.3 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Info } from 'src/clients/inputs/interfaces';
|
|
import { Method } from 'axios';
|
|
|
|
export class InputModel {
|
|
category: string;
|
|
plugin: string;
|
|
name: string;
|
|
cron?: string;
|
|
credentials?: {
|
|
connection_type: string;
|
|
oauth: string;
|
|
oauth_code: string;
|
|
start_date: string;
|
|
};
|
|
options?: {
|
|
oauth?: {
|
|
get_tokens_url: string;
|
|
get_tokens_method?: Method;
|
|
get_tokens_url_params: string;
|
|
get_tokens_set_response: Record<string, string>;
|
|
content_type: string;
|
|
};
|
|
};
|
|
}
|
|
|
|
class GoogleAnalyticsClientSecrets {
|
|
@ApiProperty()
|
|
type: string;
|
|
@ApiProperty()
|
|
project_id: string;
|
|
@ApiProperty()
|
|
private_key_id: string;
|
|
@ApiProperty()
|
|
private_key: string;
|
|
@ApiProperty()
|
|
client_email: string;
|
|
@ApiProperty()
|
|
client_id: string;
|
|
@ApiProperty()
|
|
auth_uri: string;
|
|
@ApiProperty()
|
|
token_uri: string;
|
|
@ApiProperty()
|
|
auth_provider_x509_cert_url: string;
|
|
@ApiProperty()
|
|
client_x509_cert_url: string;
|
|
}
|
|
class OauthObject {
|
|
@ApiPropertyOptional()
|
|
get_tokens_url: string;
|
|
@ApiPropertyOptional()
|
|
get_tokens_url_params: string;
|
|
@ApiPropertyOptional()
|
|
get_tokens_set_response: Record<string, any>;
|
|
@ApiPropertyOptional()
|
|
content_type: string;
|
|
}
|
|
class InputOptions {
|
|
@ApiPropertyOptional()
|
|
oauth: OauthObject;
|
|
@ApiPropertyOptional()
|
|
skip_select_columns: true;
|
|
@ApiPropertyOptional()
|
|
skip_select_entities: false;
|
|
@ApiPropertyOptional()
|
|
skip_transformation: true;
|
|
}
|
|
|
|
class CredentialsJdbc {
|
|
@ApiPropertyOptional()
|
|
jdbc_user: string;
|
|
@ApiPropertyOptional()
|
|
jdbc_password: string;
|
|
@ApiPropertyOptional()
|
|
database: string;
|
|
@ApiPropertyOptional()
|
|
endpoint: string;
|
|
@ApiPropertyOptional()
|
|
port: string;
|
|
@ApiPropertyOptional()
|
|
engine: string;
|
|
@ApiPropertyOptional()
|
|
schema: string;
|
|
}
|
|
class FileFormatParams {
|
|
@ApiPropertyOptional()
|
|
file_format: string;
|
|
@ApiPropertyOptional()
|
|
encoding: string;
|
|
}
|
|
|
|
class Credentials extends CredentialsJdbc {
|
|
@ApiProperty()
|
|
connection_type: string;
|
|
|
|
@ApiPropertyOptional()
|
|
client_aws_access_key_id: string;
|
|
@ApiPropertyOptional()
|
|
client_aws_secret_access_key: string;
|
|
@ApiPropertyOptional()
|
|
client_bucket: string;
|
|
@ApiPropertyOptional()
|
|
file_to_extract: string;
|
|
@ApiPropertyOptional()
|
|
file_format_params: FileFormatParams;
|
|
|
|
@ApiPropertyOptional()
|
|
view_id: string;
|
|
@ApiPropertyOptional()
|
|
client_secrets: GoogleAnalyticsClientSecrets;
|
|
@ApiPropertyOptional()
|
|
start_date: string;
|
|
@ApiPropertyOptional()
|
|
end_date: string;
|
|
|
|
@ApiPropertyOptional()
|
|
oauth_code: string;
|
|
}
|
|
class Column {
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
type: string;
|
|
}
|
|
class TableColumns {
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
columns: Column[];
|
|
@ApiProperty()
|
|
references: Column[];
|
|
}
|
|
export class GetAvailableEntitiesReq {
|
|
@ApiProperty()
|
|
plugin: string;
|
|
}
|
|
|
|
export class GetAvailableEntitiesRes {
|
|
@ApiProperty()
|
|
entities: string[];
|
|
}
|
|
|
|
export class TestConnectionGetColumnsReq {
|
|
@ApiProperty()
|
|
plugin: string;
|
|
@ApiProperty()
|
|
tables: string[];
|
|
@ApiPropertyOptional()
|
|
credentials: CredentialsJdbc;
|
|
@ApiPropertyOptional()
|
|
id: string;
|
|
@ApiPropertyOptional()
|
|
info: Info;
|
|
}
|
|
export class TestConnectionGetColumnsRes {
|
|
@ApiProperty()
|
|
tables: TableColumns[];
|
|
}
|
|
|
|
export class TestConnectionReq {
|
|
@ApiProperty()
|
|
plugin: string;
|
|
@ApiProperty()
|
|
credentials: CredentialsJdbc;
|
|
@ApiPropertyOptional()
|
|
info: Info;
|
|
}
|
|
export class TestConnectionRes {
|
|
@ApiProperty()
|
|
connection_state: boolean;
|
|
@ApiProperty()
|
|
total_entities: number;
|
|
@ApiProperty()
|
|
database_tables: string[];
|
|
}
|
|
export class CreateInputReq {
|
|
@ApiPropertyOptional()
|
|
id: string;
|
|
@ApiProperty()
|
|
plugin: string;
|
|
@ApiProperty()
|
|
category: string;
|
|
@ApiProperty()
|
|
credentials: Credentials;
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiPropertyOptional()
|
|
options: InputOptions;
|
|
@ApiPropertyOptional()
|
|
info: Info;
|
|
}
|
|
|
|
export class Input {
|
|
@ApiProperty()
|
|
id: string;
|
|
@ApiProperty()
|
|
category: string;
|
|
@ApiProperty()
|
|
plugin: string;
|
|
@ApiProperty()
|
|
name: string;
|
|
@ApiProperty()
|
|
cron: string;
|
|
@ApiProperty()
|
|
credentials: Credentials;
|
|
@ApiProperty()
|
|
client_id: string;
|
|
@ApiProperty()
|
|
created_at: string;
|
|
@ApiProperty()
|
|
updated_at: string;
|
|
@ApiPropertyOptional()
|
|
info: Info;
|
|
}
|