export type Deadline = {business_days_prior: number, deadline_type: 'calculation' | 'restatement', metrics?: Array | undefined, next_day: boolean, og_priority: 'P1' | 'P2' | 'P3', time_of_day: string}; export type Administrative = {client?: ({approved_by?: string | undefined, owner?: string | undefined, requested_by?: string | undefined}) | undefined, deadlines?: Array | undefined, role: 'data point' | 'verification' | 'calculation' | 'development' | 'administration'}; export type BaseDate = string; export type IndexBenchmark = {benchmark_metric?: string | undefined, index_metric?: string | undefined, threshold: number, ticker: string}; export type LevelCheckParams = {max: number | null, min: number | null}; export type PercentChangeCheckParams = {max: number | null, min: number | null}; export type HistoryCheckParams = {days: number | null}; export type CalculationCheck = Array<{check_type: 'LEVEL_CHECK', alert_type?: ('email' | 'slack' | 'opsgenie' | 'fail_computation') | undefined, enabled: boolean, metric: string, params: LevelCheckParams} | {check_type: 'PERCENT_CHANGE_CHECK', alert_type?: ('email' | 'slack' | 'opsgenie' | 'fail_computation') | undefined, enabled: boolean, metric: string, params: PercentChangeCheckParams} | {check_type: 'HISTORY_CHECK', alert_type?: ('email' | 'slack' | 'opsgenie' | 'fail_computation') | undefined, enabled: boolean, metric: string, params: HistoryCheckParams}>; export type MetricsSchema = {data_type: 'string' | 'number64' | 'datetime64' | 'int64' | 'bool' | 'object', description: string, name: string, object_schema?: Record | undefined}; export type IsoDate = string; export type FreezerConfig = {corax?: boolean | undefined, fx_rates?: boolean | undefined, prices?: boolean | undefined, primary_index_name?: string | undefined, rebalances?: boolean | undefined}; export type Provider = 'bloomberg' | 'reuters' | 'morningstar' | 'factset' | 'nasdaq' | 'wind' | 'secapi'; export type IdentifierUUIDRef = {enabled?: boolean | undefined, name: string, provider: Provider}; export type MerqTimestamp = string | string | string; export type IntradayTickFilter = {days_of_week?: Array | undefined, end_date?: MerqTimestamp | undefined, end_time?: string | undefined, exclude_holidays?: boolean | undefined, start_date?: MerqTimestamp | undefined, start_time?: string | undefined}; export type IntradayPublishConfigDbTarget = {active_time_ranges?: Array | undefined, target: 'db'}; export type IntradayPublishConfigSecapiTarget = {active_time_ranges?: Array | undefined, target: 'secapi'}; export type IntradayPublishConfigBloombergTargetParams = {rounding_decimals?: number | undefined, ticker?: string | undefined}; export type IntradayPublishConfigBloombergTarget = {active_time_ranges?: Array | undefined, params?: IntradayPublishConfigBloombergTargetParams | undefined, target: 'bloomberg'}; export type ReutersProviderKwargsPostType = 'EOD' | 'RT' | 'EOD_AND_RT' | 'EOD_AND_RT_COMBINED'; export type IntradayPublishConfigReutersTargetParams = {post_type?: ReutersProviderKwargsPostType | undefined, rounding_decimals?: number | undefined, ticker?: string | undefined}; export type IntradayPublishConfigReutersTarget = {active_time_ranges?: Array | undefined, params?: IntradayPublishConfigReutersTargetParams | undefined, target: 'reuters'}; export type IntradayPublishConfig = {[key: string]: Array}; export type AlertHours = {end?: string | undefined, start?: string | undefined}; export type IntradayAlertType = 'opsgenie' | 'slack'; export type IntradayFlatlineAlerts = {alert_hours?: AlertHours | undefined, alert_type?: IntradayAlertType | undefined, enabled?: boolean | undefined, min_ticks?: number | undefined, window_length?: number | undefined}; export type IntradayAlerting = {flatline_alerts?: IntradayFlatlineAlerts | undefined}; export type IntradayInfraTimedScaling = {enabled?: boolean | undefined, end_time_buffer?: number | undefined, start_time_buffer?: number | undefined}; export type IntradayPreOpenWarmup = {enabled?: boolean | undefined, lead_seconds?: number | undefined}; export type RangePrefetch = {enabled?: boolean | undefined, max_batch_ticks?: number | undefined, max_span_seconds?: number | undefined, read_timeout_seconds?: number | undefined}; export type Intraday = {publish_config?: IntradayPublishConfig | undefined, active_time_ranges?: Array | undefined, alerting?: IntradayAlerting | undefined, calculation_max_retry_delay?: number | undefined, data_refresh_period?: number | undefined, enabled: boolean, heartbeat_timeout?: number | undefined, infra_timed_scaling?: IntradayInfraTimedScaling | undefined, ohl_enabled?: boolean | undefined, opening_tick_time?: string | undefined, pre_open_warmup?: IntradayPreOpenWarmup | undefined, range_prefetch?: RangePrefetch | undefined, resource_cpu_request?: number | undefined, resource_memory_request?: number | undefined, security_id?: string | undefined, startup_failure_timeout?: number | undefined, summaries_read_replica?: boolean | undefined, tick_delay?: number | undefined, ticker_period?: number | undefined, tzinfo: string}; export type NotificationConfig = {email_list_uuid?: string | undefined, emails?: Array | undefined, enabled?: boolean | undefined}; export type RebalFrequency = 'Annual' | 'Daily' | 'Monthly' | 'Quarterly' | 'Semi-Annual' | 'Weekly' | 'Bi-Monthly' | 'Intraday' | 'None'; export type Related = {default_display?: boolean | undefined, id: string, metric?: string | undefined, name: string, type: 'security' | 'index'}; export type S3Bucket = {bucket: string, path?: string | undefined}; export type ArgumentsOrEnvVars = Array>; export type SubPod = {arguments?: ArgumentsOrEnvVars | undefined, command: string, env_vars?: ArgumentsOrEnvVars | undefined, pod_kwargs?: ({name?: string | undefined}) | undefined, pod_type: string, uuid: string}; export type AirflowConfig = {affinity_match_expression_key?: string | undefined, dag?: {[key: string]: unknown} | undefined, description?: string | undefined, env?: {[key: string]: unknown} | undefined, pod?: {[key: string]: unknown} | undefined, s3_location?: S3Bucket | undefined, subpods?: Array | undefined}; export type DqmsConfig = {enabled?: boolean | undefined}; export type FlatCalendarSchema = {calendar_identifiers?: Array | undefined, condition?: ('any' | 'all' | 'custom') | undefined, holidays_to_add?: Array | undefined, holidays_to_remove?: Array | undefined, swaps_monitor_codes?: Array | undefined, weekmask?: (Array<'Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat' | 'Sun'>) | undefined}; export type CalendarIdentifiers = {calendar_identifiers?: Array | undefined}; export type HolidaysToAdd = {holidays_to_add?: Array | undefined}; export type NestedCalendarSchema = {children: Array, operator: 'union' | 'intersection' | 'difference', weekmask?: (Array<'Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat' | 'Sun'>) | undefined}; export type HolidayCalendarSpec = FlatCalendarSchema | NestedCalendarSchema; export type DisseminationDestinations = {email_dissapi_configs?: (Array<{bcc_list?: Array | undefined, cc_list?: Array | undefined, content?: string | undefined, email_list?: Array | undefined, file_keys?: Array | undefined, recipient_list: Array, subject: string}>) | undefined, s3_dissapi_configs?: Array<{bucket: string, file_keys: Array, key_prefix: string}> | undefined, sftp_dissapi_configs?: Array<{file_keys: Array, sftp_ids: Array}> | undefined}; export type IndexReport = {dissemination_destinations?: DisseminationDestinations | undefined, program_args?: Record | undefined, task_id?: string | undefined, uuid: string}; export type Schedule = {business_days_prior?: number | undefined, event_driven?: boolean | undefined, holiday_calendar?: ({cal_type?: string | undefined, mic?: string | undefined}) | undefined, retries: number, retry_interval_min: number, schedule_cron?: string | undefined, schedule_start: string, timeout_delta?: string | undefined, triggers?: Array | undefined}; export type RunConfig = {airflow_config?: AirflowConfig | undefined, alert_priority?: ('P1' | 'P2' | 'P3' | 'P4' | 'P5') | undefined, command?: string | undefined, command_arguments?: ArgumentsOrEnvVars | undefined, day_chunk_size?: number | undefined, dqms?: DqmsConfig | undefined, holiday_calendar?: HolidayCalendarSpec | undefined, index_report_uuids?: Array | undefined, index_reports?: (Array | Array) | undefined, job_enabled: boolean, num_days_to_load: number, pod_image_and_tag?: string | undefined, schedule: Schedule, state_key?: string | undefined, tzinfo?: string | undefined} | {[key: string]: unknown}; export type RunConfigLabel = {airflow_config?: AirflowConfig | undefined, alert_priority?: ('P1' | 'P2' | 'P3' | 'P4' | 'P5') | undefined, command?: string | undefined, command_arguments?: ArgumentsOrEnvVars | undefined, day_chunk_size?: number | undefined, dqms?: DqmsConfig | undefined, holiday_calendar?: HolidayCalendarSpec | undefined, index_report_uuids?: Array | undefined, index_reports?: (Array | Array) | undefined, job_enabled: boolean, num_days_to_load: number, pod_image_and_tag?: string | undefined, schedule: Schedule, state_key?: string | undefined, tzinfo?: string | undefined, label: string} | {[key: string]: unknown}; export type IndexSpec = {index_class_args?: Record | undefined, index_class_code: string, index_variables?: Record | undefined, version?: number | undefined}; export type CustomCharts = {chart_type?: ('line' | 'spline' | 'area' | 'bar' | 'column') | undefined, compare_mode?: ('absolute' | 'percent') | undefined, constructor_type?: ('chart' | 'stockChart') | undefined, data?: Array<{array_field: string, key_field: string, url: string, values: Array<{display_name: string, path: string}>}> | undefined, name: string, size?: number | undefined, xlabel: string, ylabel: string}; export type Webpage = {custom_charts?: Array | undefined, visible?: boolean | undefined}; export type Status = {created_at?: string | undefined, created_by?: string | undefined, last_modified: string, last_modified_by?: string | undefined, locked_after?: string | undefined}; export type IndexDefinitionPatchPutGet = {administrative: Administrative, base_date?: BaseDate | undefined, base_year?: number | undefined, benchmark?: (IndexBenchmark | Array) | undefined, calc_freq?: ('Daily' | 'Daily, EOD' | 'Daily, Real Time' | 'Intraday') | undefined, calculation_check?: CalculationCheck | undefined, currency?: string | undefined, custom_metrics?: Array | undefined, description: string, display_month?: ('Jan' | 'Feb' | 'Mar' | 'Apr' | 'May' | 'Jun' | 'Jul' | 'Aug' | 'Sep' | 'Oct' | 'Nov' | 'Dec') | undefined, documents?: Record | undefined, eod_rt_price_check?: boolean | undefined, excess_strategy?: 'keep_in_cash' | undefined, family?: string | undefined, family_codes?: Array | undefined, family_description?: string | undefined, fill_missing_data?: boolean | undefined, first_value_date?: IsoDate | undefined, freezer_config?: FreezerConfig | undefined, identifiers?: Array | undefined, intraday?: Intraday | undefined, launch_date: string, methodology?: string | undefined, month?: number | undefined, name: string, namespace: string, notify_configuration?: NotificationConfig | undefined, plot_metric?: string | undefined, portfolio_allocation_display?: boolean | undefined, portfolio_display?: ({fields?: (Array<{display_name?: string | undefined, field_name?: string | undefined}>) | undefined}) | undefined, portfolio_handler_id?: string | undefined, rebal_freq?: RebalFrequency | undefined, related?: Array | undefined, run_configuration?: RunConfig | undefined, run_configurations?: Array | undefined, sales_force_deal_id?: string | undefined, spec?: IndexSpec | undefined, stage: 'prod' | 'test' | 'development' | 'backtest' | 'inqubator', tags?: string | undefined, title: string, webpage?: Webpage | undefined, weighting_method?: ('Other' | 'Equal') | undefined, id: string, status: Status}; export type UpdateApiIndexUuidArgs = {body: IndexDefinitionPatchPutGet}; export type UpdateApiIndexUuidOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Replace a MerQube index * * PUT /index/{uuid} */ export const updateApiIndexUuid = async (args: UpdateApiIndexUuidArgs, options?: UpdateApiIndexUuidOptions) => { const {baseUrl = "https://api.merqube.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/index/${encodeURIComponent(String(args.uuid))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };