import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger'; import { Info } from 'protospack/dist/lib/interfaces'; export 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; } export class OauthObject { @ApiPropertyOptional() get_tokens_url: string; @ApiPropertyOptional() get_tokens_url_params: string; @ApiPropertyOptional() get_tokens_set_response: Record; @ApiPropertyOptional() content_type: string; } export class InputOptions { @ApiPropertyOptional() oauth: OauthObject; @ApiPropertyOptional() skip_select_columns: true; @ApiPropertyOptional() skip_select_entities: false; @ApiPropertyOptional() skip_transformation: true; } export class FileFormatParams { @ApiProperty() sep: string; @ApiProperty() header: boolean; @ApiProperty() encoding: string; } export class AuthParameters { @ApiProperty() aws_access_key_id: string; @ApiProperty() aws_secret_access_key: string; } export 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; } export 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; } export class Column { @ApiProperty() name: string; @ApiProperty() type: string; } export class TableColumns { @ApiProperty() name: string; @ApiProperty() columns: string[]; @ApiProperty() references: Column[]; } export class Input { @ApiProperty() id: string; @ApiProperty({ type: [TableColumns] }) tables: TableColumns[]; @ApiProperty() name: string; @ApiProperty() description: string; @ApiProperty() plugin: string; @ApiPropertyOptional() type?: string; @ApiProperty() created_at: string; @ApiProperty() updated_at: string; //deprecated attributes (for retro compatibility) @ApiPropertyOptional({ deprecated: true }) category: string; @ApiPropertyOptional({ deprecated: true }) credentials: Credentials; @ApiPropertyOptional({ deprecated: true }) options: InputOptions; @ApiPropertyOptional({ deprecated: true }) info: Info; @ApiPropertyOptional({ deprecated: true }) cron: string; @ApiPropertyOptional({ deprecated: true }) source_bucket: string; @ApiPropertyOptional({ deprecated: true }) source_prefix: string; @ApiPropertyOptional({ deprecated: true }) auth_parameters: AuthParameters; @ApiPropertyOptional({ deprecated: true }) file_format_params: FileFormatParams; } 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({ type: [TableColumns] }) 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 extends OmitType(Input, [ 'id', 'created_at', 'updated_at', ]) {}