import { Codegen, Context, type ProjectDefaults } from './internal/codegen/index.js'; import { Program, ObjectValueBuilder, GeneratedFile } from '../sourcegen/index.js'; import { AlertEscalationResource } from './alert-escalation-policy-codegen.js'; import { ApiCheckCodegen } from './api-check-codegen.js'; import { BrowserCheckCodegen } from './browser-check-codegen.js'; import { CheckGroupCodegen } from './check-group-codegen.js'; import { EnvironmentVariable } from './environment-variable.js'; import { FrequencyResource } from './frequency-codegen.js'; import { HeartbeatMonitorCodegen } from './heartbeat-monitor-codegen.js'; import { MultiStepCheckCodegen } from './multi-step-check-codegen.js'; import { PlaywrightCheckCodegen } from './playwright-check-codegen.js'; import { RetryStrategyResource } from './retry-strategy-codegen.js'; import { TcpMonitorCodegen } from './tcp-monitor-codegen.js'; import { UrlMonitorCodegen } from './url-monitor-codegen.js'; import { DnsMonitorCodegen } from './dns-monitor-codegen.js'; import { IcmpMonitorCodegen } from './icmp-monitor-codegen.js'; import { GrpcMonitorCodegen } from './grpc-monitor-codegen.js'; import { SslMonitorCodegen } from './ssl-monitor-codegen.js'; import { TracerouteMonitorCodegen } from './traceroute-monitor-codegen.js'; import type { CheckConfigDefaults } from '../services/checkly-config-loader.js'; import { ConfigDefaultsGetter } from './check-config.js'; /** * Intent shape returned by the checks resource API. * * Construct code generation adapts this wire representation to typed intent * constraints so exported resources round-trip through Monitoring as Code. */ export interface CheckIntentResource { goal: string; constraints?: Array<{ type: 'REQUIRED_OUTCOME' | 'MUST_PRESERVE'; statement: string; }>; /** Compatibility with import plans created before construct-shaped intent was deployed. */ requiredOutcomes?: string[]; /** Compatibility with import plans created before construct-shaped intent was deployed. */ mustPreserve?: string[]; } /** * The constraints of an intent as the construct spells them, from either form * the import format may carry: the `constraints` list itself, or the two * outcome lists Checkly stores (`requiredOutcomes`, `mustPreserve`), required * outcomes first. */ export declare function intentConstraints(intent: CheckIntentResource): NonNullable; export interface CheckResource { id: string; checkType: string; name: string; description?: string | null; intent?: CheckIntentResource | null; aiAutoRepairEnabled?: boolean | null; activated?: boolean; muted?: boolean; shouldFail?: boolean; locations?: string[]; tags?: string[]; frequency?: number | FrequencyResource; frequencyOffset?: number; groupId?: number; alertSettings?: AlertEscalationResource | null; useGlobalAlertSettings?: boolean | null; testOnly?: boolean; retryStrategy?: RetryStrategyResource; runParallel?: boolean; } /** * Options controlling which common check fields `buildCheckProps` emits. * * The defaults match the historical behavior — every field is emitted if * the resource provides it. Individual check types can opt out of specific * fields when their construct's props type does not accept them. */ export interface BuildCheckPropsOptions { /** * Skip emitting the `intent` property for constructs that do not support it. */ skipIntent?: boolean; /** * Emit `aiAutoRepairEnabled` for constructs that support automatic check * repair. Browser and MultiStep checks are the only current consumers. */ includeAutomaticCheckRepair?: boolean; /** * Emit `shouldFail` for constructs that support it. ApiCheck, UrlMonitor * and TcpMonitor are the only current consumers. */ includeShouldFail?: boolean; /** * Shared props the construct's own props type omits, which are never * generated whatever the row or a project default holds. */ omit?: readonly OmittableCheckProp[]; } export type OmittableCheckProp = 'retryStrategy'; /** * The project-level defaults a construct of the given check type falls back * to for a prop it is not given, through the same getter and in the same * order the constructs use (`Check`, `BrowserCheck` and `MultiStepCheck` * each build theirs in `configDefaultsGetter`): the type's own * `checkly.config` section first, then the shared `checks` section. A group's * check defaults, which sit in the constructs' chains too, carry only * `frequency`, which this lookup never asks for. * * `undefined` when the project is unknown (`ContextOptions.projectDefaults` * is absent): any of the defaults could then be set, so no omission is safe. */ export declare function projectDefaultsFor(checkType: string, projectDefaults: ProjectDefaults | undefined): ConfigDefaultsGetter | undefined; export declare function buildCheckProps(program: Program, genfile: GeneratedFile, builder: ObjectValueBuilder, resource: CheckResource, context: Context, options?: BuildCheckPropsOptions): void; export interface RuntimeCheckResource extends CheckResource { runtimeId?: string; environmentVariables?: EnvironmentVariable[]; } export declare function buildRuntimeCheckProps(program: Program, genfile: GeneratedFile, builder: ObjectValueBuilder, resource: RuntimeCheckResource, context: Context, options?: BuildCheckPropsOptions): void; /** * Check types whose codegen exists for the deploy preview only, with the * reason `checkly import` gives when it refuses one. A check of such a type * is defined by an uploaded code bundle, which an import plan cannot hand * back as source, so the import refuses the resource instead of generating * a construct without its files (the API leaves such checks out of import * plans as well). */ export declare const PREVIEW_ONLY_CHECK_TYPES: ReadonlyMap; export declare class CheckCodegen extends Codegen { apiCheckCodegen: ApiCheckCodegen; browserCheckCodegen: BrowserCheckCodegen; checkGroupCodegen: CheckGroupCodegen; heartbeatMonitorCodegen: HeartbeatMonitorCodegen; multiStepCheckCodegen: MultiStepCheckCodegen; playwrightCheckCodegen: PlaywrightCheckCodegen; tcpMonitorCodegen: TcpMonitorCodegen; urlMonitorCodegen: UrlMonitorCodegen; dnsMonitorCodegen: DnsMonitorCodegen; icmpMonitorCodegen: IcmpMonitorCodegen; grpcMonitorCodegen: GrpcMonitorCodegen; sslMonitorCodegen: SslMonitorCodegen; tracerouteMonitorCodegen: TracerouteMonitorCodegen; constructor(program: Program); describe(resource: CheckResource): string; gencode(logicalId: string, resource: CheckResource, context: Context): void; }