export declare enum Unit { DAY = "day", MONTH = "month", WEEK = "week" } export declare enum PeriodGranularity { MINUTE = "minute", FIVE_MINUTE = "five_minute", HOUR = "hour", DAY = "day", WEEK = "week", MONTH = "month" } export declare enum PeriodTimeType { TIMESTAMP = "timestamp", PAST = "past" } export declare type Granularity = 'day' | 'hour' | 'month' | 'week' | 'five_minute'; export interface GroupByItem { property_name?: string; property_type?: string; number_group_type?: 1 | 0; distribution_interval?: number[]; datetime_group_type?: 1 | 0; datetime_group_granularity?: string; property_compose_type?: any; } export interface PeriodAmountSpan { type: PeriodTimeType.PAST; past: { amount: number; unit: Granularity; }; } export declare type PeriodDslSpan = PeriodAmountSpan | PeriodTimestampSpan; /** * 后端需要的 dsl period type */ export declare const PERIOD_PAST_RANGE = "past_range"; export declare enum PeriodWeekendOption { /** * 不去除周末和节假日 */ ALL = 1, /** * 去除周末 */ EXCLUDE_WEEKEND = 2, /** * 去除周末和节假日 */ EXCLUDE_WEEKEND_AND_HOLIDAY = 4, /** * 去除非交易日(包含周末及节假日) */ EXCLUDE_TRADING_HOLIDAY = 5 } /** * 显微镜中用到的 dsl period type */ export declare const PERIOD_RANGE = "range"; export interface PeriodDsl { type: typeof PERIOD_PAST_RANGE | typeof PERIOD_RANGE; spans?: [PeriodDslSpan, PeriodDslSpan]; timezone?: string; week_start?: number; granularity?: PeriodGranularity | 'all'; align_unit?: PeriodGranularity; /** * 以下是对比时间相关 */ adjust_model?: string; base_period_index?: number; /** * 对比时间 - N 天前 */ relative_amount?: number; /** * 是否跳过此时间。 * 如果跳过,返回值中对应的部分将全部是 0 */ skip_period?: boolean; weekendOption?: PeriodWeekendOption; weekend_option?: PeriodWeekendOption; interval?: string; /** * type为range类型时出现,用于显微镜中 */ range?: number[]; } export interface PeriodTimestampSpan { type: PeriodTimeType.TIMESTAMP; timestamp: string; } export declare type Span = PeriodAmountSpan | PeriodTimestampSpan; /** * 请求类型 */ export declare enum EDSLType { EVENT = "event_analysis", RETENTION = "retention_analysis", FUNNEL = "funnel_analysis", PATHFIND = "pathfind_analysis", SOURCE = "source_analysis", WEB_SESSION = "web_session_analysis", LIFE_CYCLE = "lifecycle_analysis", COMPOSITION = "composition_analysis", DISTRIBUTE = "distribute_analysis", LTV = "ltv_analysis", ITEM = "items_analysis", SQL_QUERY = "custom_sql_query", ATTRIBUTION = "attribution_analysis", RICH_TEXT = "rich_text", IFRAME = "embed", EVENT_INDICATOR_ANALYSIS = "event_indicator_analysis" } export declare module DSL { type ContentQueryType = 'event' | 'session' | 'retention' | 'funnel' | 'path_find' | 'life_cycle' | 'ltv' | 'web_session' | 'mini_program' | 'funnel_cohort' | 'composition' | 'distribution_cohort' | 'item' | 'behavior_attribution' | '$cohort' | 'funnel_distribution_cohort' | 'funnel_distribution' | 'distribution' | 'event_cohort'; type OrderDirection = 'asc' | 'desc'; type Logic = 'and' | 'or'; type PropertyType = 'user_profile' | 'profile' | 'event_param' | 'cohort' | 'item_param' | 'common_param'; /** * 属性的特性 */ type PropertyComposeType = 'virtual' | 'origin'; type PropertyOperation = '=' | '!=' | '>' | '<' | '>=' | '<=' | 'contain' | 'not_contain' | 'is_null' | 'is null' | 'is_not_null' | 'is not null' | 'in' | 'not_in' | 'between' | 'like' | 'not_like' | 'match' | 'time' | 'list_contain' | 'list_not_contain'; type PropertyValueType = 'string' | 'int' | 'float' | 'bigint'; type PeriodGranularity = Granularity | 'none' | 'all'; type PeriodUnit = Unit; type PeriodType = 'last' | 'range' | 'today' | 'yesterday' | 'past_range'; type PeriodLast = { amount: number; unit: PeriodUnit; }; interface ObjectWithAny { [key: string]: any; } type PropertyPeriodUnitType = 'day' | 'second' | 'minute' | 'hour' | 'week'; type PropertyPeriodSpan = { amount: number; unit: PropertyPeriodUnitType; }; type PropertyPeriodReference = 'current_time' | 'current_event' | 'today'; type PropertyPeriodType = 'range' | 'future_out' | 'future_in' | 'past_out' | 'past_in' | 'past_range' | 'future_range' | 'same_day' | 'same_week' | 'same_month' | 'past_range' | 'future_range'; type PropertyPeriod = { reference?: PropertyPeriodReference; type: PropertyPeriodType; spans?: PropertyPeriodSpan[]; time_stamps?: number[]; }; type IDsl = AnalysisDSL; interface SingleContentDsl { version: number; app_ids?: Array; /** * 分析的project id,数组类型保留扩展能力 */ project_ids?: Array; periods: Array; content: Content; show_option?: ContentShowOption; use_app_cloud_id?: boolean; option?: any; } interface MultipleContentDsl { version: number; app_ids: Array; periods: Array; contents: Array>; show_option: ContentShowOption; use_app_cloud_id?: boolean; option?: DSLOptions; } interface DSLOptions { blend: DSLOptionBlend; } interface DSLOptionBlend { status: boolean; base: number; } interface PeriodItem { granularity?: PeriodGranularity; interval?: string | number; range?: Array; type?: PeriodType; last?: PeriodLast; realtime?: boolean; real_time?: boolean; week_start?: number; timezone?: string; align_unit?: string; spans?: Span[]; /** * 对比时间的对齐方式 */ adjust_model?: string; /** * 向第几个时间对齐 */ base_period_index?: number; /** * 是否去除周末 */ weekendOption?: number; } interface Content { query_type: ContentQueryType | string; profile_filters: Array; profile_groups?: Array; profile_groups_v2?: Array; orders?: Array; page?: ContentPage; option?: ContentOption; show_option?: ContentShowOption; queries: Array>; } interface ContentOrderItem { field?: string; direction?: OrderDirection; } interface ContentPage { limit: number; offset: number; } interface ContentOption { [key: string]: any; refresh_cache?: boolean; window_period?: number; window_period_type?: string; distribution_group?: number; distribution_step?: number; is_temp_cohort?: boolean; } type ContentShowOption = any; interface ContentFiltersItem { show_name?: string; show_label?: string | number; expression: ContentExpression; skip_dict?: boolean; } interface ContentQueriesItem { formula?: string; show_name?: string; show_label?: string; event_id?: string | number; event_name?: string; event_type?: string; event_indicator?: string; measure_info?: ContentQueriesMeasureInfo; filters?: Array; groups_v2?: Array; type?: string; indicator_show_name?: string; } interface ContentComputeQueriesItem { show_name?: string; show_label?: string; formula: string; } interface ContentQueriesMeasureInfo { [key: string]: any; measure_type?: string; property_name?: string; measure_value?: number | string; } interface ContentExpression { conditions?: Array; expressions?: Array; logic: Logic; } interface ContentExpressionItem { property_type: PropertyType | string; property_name?: string; property_operation: PropertyOperation; property_value_type?: PropertyValueType; property_values: Array; property_period?: PropertyPeriod; skip_dict?: boolean; property_compose_type?: PropertyComposeType; datetime_group_type?: 1 | 0; datetime_group_granularity?: string; } } export declare type AnalysisDSL = { version: 3 | number | string; app_ids?: Array; periods: Array; content?: DSL.Content; contents?: DSL.Content[]; use_app_cloud_id?: boolean; option?: any; show_option: K; resources?: Array<{ project_ids: Array; subject_ids: Array; app_ids: Array; }>; };