@arcane-utils/types
Version:
A collection of typescript types.
221 lines (219 loc) • 7.13 kB
text/typescript
type ServiceEnum = 'product_flow' | 'datalab' | 'audience_flow';
type ColumnType = 'string' | 'numeric' | 'boolean';
interface Ingestion {
id: number;
client_id: string;
name: string;
enabled: boolean;
type: IngestionType;
service: ServiceEnum;
parameters: IngestionParameterDATALAB | IngestionParameterSnowflake | IngestionParameterGCS;
execution_info?: ExecutionInfo;
latest_exec?: Date;
latest_load?: Date;
headers?: IngestionHeader[];
types_override?: {
[key: string]: ColumnType;
};
meta?: IngestionMeta;
alert_ids: string[];
protection_id?: string;
is_short_lived_archived?: boolean;
data_pre_preparation_enabled?: boolean;
product_evolution_info?: ProductEvolutionInformation | null;
reshaping?: ReshapingSettings | null;
}
interface ReshapingSettings {
aggregation: AggregationSettings;
}
interface AggregationOutputColumn {
output_name: string;
column_to_aggregate: string;
aggregation_function: 'MIN' | 'MAX' | 'AVERAGE' | 'COUNT' | 'SUM' | 'ANY_VALUE';
}
interface AggregationSettings {
aggregation_keys: string[];
output_columns: AggregationOutputColumn[];
unmapped_columns_as_any_content: boolean;
}
interface ProductEvolutionInformationLastCalculation {
date: Date;
monitoring_id: string;
}
interface ProductEvolutionInformation {
identifier_key: string[];
last_calculation?: ProductEvolutionInformationLastCalculation;
}
interface IngestionTaskBody {
ingestion_id?: number;
monitoring_id: string;
file_name: string;
}
interface FileHandlerTaskBody extends IngestionTaskBody {
no_get_headers: boolean;
}
interface IngestionHeader {
key: string;
type: string;
}
interface IngestionMeta {
quote: string;
fieldDelimiter: string;
}
interface BaseIngestionParameter {
file_name: string;
}
interface AdvancedIngestionParameter extends BaseIngestionParameter {
is_xml?: boolean;
is_json?: boolean;
compression?: 'zip' | 'gzip' | undefined;
max_bad_records?: number;
escape_character?: string;
enclosing_quotes?: string | null;
preserve_ascii_control_characters?: boolean;
}
interface IngestionParameterDATALAB extends AdvancedIngestionParameter {
source_type: 'smart-feeds-data-ingestions' | 'smart-feeds-data-processings';
entity_id: number;
}
interface IngestionParameterSnowflake extends BaseIngestionParameter {
account: string;
user_name: string;
pwd: string;
query: string;
sleep_time?: number;
execution_time?: ExecutionTime;
}
interface IngestionParameterGCS extends AdvancedIngestionParameter {
sub_type: 'GCS' | 'ARCANE_SFTP' | 'ARCANE_FTP';
input_filename: string;
directory?: string;
service_account?: string;
sleep_time?: number;
execution_time?: ExecutionTime;
}
interface ExecutionTime {
time: string;
day?: number;
}
type MonitoringStatus = 'start' | 'done' | 'error';
type IngestionType = 'GCS' | 'FTP/SFTP' | 'HTTP' | 'GA_CONVERSIONS' | 'BING_CAMPAIGN' | 'ADWORDS_CAMPAIGN' | 'ADWORDS_PRODUCT' | 'CRITEO' | 'ADWORDS_CRITERION' | 'FACEBOOK_ADSET' | 'INSTAGRAM' | 'BING_CRITERION' | 'GA_ECOMMERCE' | 'SPREADSHEET' | 'BIG_QUERY' | 'DATALAB' | 'SNOWFLAKE';
interface Protection {
id: number;
ingestion_id: number;
client_id: string;
enabled: boolean;
service: ServiceEnum;
size_variation_threshold: number;
triggered: boolean;
last_modified?: Date;
current_size?: string;
previous_size?: string;
notif_name: string;
}
interface Export {
id: number;
client_id: string;
name: string;
enabled: boolean;
type: string;
service: ServiceEnum;
parameters: ExportBaseParameters;
extension_name: string;
alert_ids: string[];
execution_info?: ExecutionInfo;
latest_exec?: Date;
export_format?: string;
dataflow_job_status?: string;
dataflow_job_id?: string;
feed_setup?: boolean;
should_gzip?: boolean;
protection_id?: string;
}
type ChannelType = 'mct_push' | 'local_inventory_push' | 'new_pass_culture' | 'pass_culture_offers' | 'google_automotive_push';
interface ExportBaseParameters extends Record<string, any> {
file_name: string;
channel_type?: ChannelType;
account_id?: string;
request_rate?: number;
channel?: string;
language?: string;
country?: string;
api_key?: string;
xml_sub_type?: string;
root_tag?: string;
product_tag?: string;
}
type ExecutionStatus = 'done' | 'error' | 'running';
interface BaseExecutionInfo {
status: ExecutionStatus;
errors: ExecutionInfoError[];
timestamp?: Date;
message_id?: string;
}
interface ExecutionInfo extends BaseExecutionInfo {
hash?: string;
}
interface ExecutionInfoError {
step: string;
reason: string;
severity: 'warning' | 'error';
}
interface ProcessingExecutionInfo extends ExecutionInfo {
hashes?: {
[fileName: string]: string;
};
total_output_rows?: number;
}
type ProcessingType = 'big_query' | 'dataprepApi' | 'facebook_adset' | 'fileEncoding' | 'gunzip' | 'unzip' | 'FileChangeDetection';
interface Processing {
id: number;
client_id: string;
name: string;
enabled: boolean;
type: ProcessingType;
service: ServiceEnum;
parameters: BQProcessingParameters;
execution_info?: ProcessingExecutionInfo;
latestExec?: Date;
is_periodic?: boolean;
execution_frequency?: string;
execution_time?: ExecutionTime;
sleepTime?: number;
trigger: string[];
}
type ExportFormat = 'CSV' | 'NEWLINE_DELIMITED_JSON';
interface BQProcessingExtractParameters {
export_format: ExportFormat;
export_delimiter?: string;
}
interface QueryOptions {
query: string;
}
interface BQProcessingQueryParameters {
options: QueryOptions;
destination_table: string;
}
interface SchemaFields {
name: string;
type: string;
}
interface BQSchemaDetection {
auto: boolean;
source_ingestion_id?: number;
schema?: {
fields: SchemaFields[];
delimiter: string;
};
}
interface BQProcessingInputParameters {
input_table_name: string;
schema_detection: BQSchemaDetection;
}
interface BQProcessingParameters {
query: BQProcessingQueryParameters;
extract: BQProcessingExtractParameters;
input_files: string[];
file_name: string;
}
export type { AdvancedIngestionParameter, AggregationOutputColumn, AggregationSettings, BQProcessingExtractParameters, BQProcessingInputParameters, BQProcessingParameters, BQProcessingQueryParameters, BQSchemaDetection, BaseExecutionInfo, BaseIngestionParameter, ChannelType, ExecutionInfo, ExecutionInfoError, ExecutionStatus, Export, ExportBaseParameters, ExportFormat, FileHandlerTaskBody, Ingestion, IngestionHeader, IngestionMeta, IngestionParameterDATALAB, IngestionParameterGCS, IngestionParameterSnowflake, IngestionTaskBody, IngestionType, MonitoringStatus, Processing, ProcessingExecutionInfo, ProcessingType, ProductEvolutionInformation, ProductEvolutionInformationLastCalculation, Protection, QueryOptions, ReshapingSettings, SchemaFields, ServiceEnum };