/**
 * SWIP-14 Inspect API — read-only catalog + entity enumeration on
 * admin-server's port 17128. The endpoints are:
 *
 *   GET /inspect/metrics
 *   GET /inspect/entities?metric=…&start=…&end=…&step=…&limit=…
 *
 * Both are admin-only and are off by default — the operator must set
 * `SW_INSPECT=default` on OAP. Wire shapes match the implementation on
 * `swip-14-inspect-api` (final, post-review-pass-2). See
 * `oap-server/server-admin/inspect/src/main/java/.../response/`.
 *
 * The MQE values themselves live behind OAP's regular GraphQL
 * `execExpression` surface; the Inspect API only returns the catalog
 * and MQE-ready Entity shapes you can paste into that mutation.
 */
import type { FetchLike } from './runtime-rule.js';
/** MetricsType emitted by OAP's `MetricsType.java`; values match
 *  `Column.ValueDataType` after the metadata mapping. */
export type InspectMetricType = 'REGULAR_VALUE' | 'LABELED_VALUE' | 'HEATMAP' | 'SAMPLED_RECORD';
/** Catalog string from `DefaultScopeDefine` — uppercase, underscore-
 *  separated. Used for the `/inspect/metrics?catalog=` filter. */
export type InspectCatalog = 'SERVICE' | 'SERVICE_INSTANCE' | 'ENDPOINT' | 'SERVICE_RELATION' | 'SERVICE_INSTANCE_RELATION' | 'ENDPOINT_RELATION' | (string & {});
/** Scope name (e.g. `Service`, `ServiceInstance`, `Endpoint`,
 *  `ServiceRelation`, `ServiceInstanceRelation`, `EndpointRelation`).
 *  Comes straight from `Scope.Finder.valueOf(scopeId).name()`. */
export type InspectScope = 'Service' | 'ServiceInstance' | 'Endpoint' | 'ServiceRelation' | 'ServiceInstanceRelation' | 'EndpointRelation' | (string & {});
export type InspectStep = 'MINUTE' | 'HOUR' | 'DAY';
export declare const INSPECT_STEPS: readonly InspectStep[];
/** Server-side hard cap on `/inspect/entities?limit=`. */
export declare const INSPECT_ENTITY_LIMIT_MAX = 300;
export interface MetricRow {
    name: string;
    type: InspectMetricType;
    catalog: InspectCatalog;
    scopeId: number;
    scope: InspectScope;
    valueColumnName: string;
    downsamplings: InspectStep[];
}
export interface MetricsResponse {
    metrics: MetricRow[];
}
/** MQE Entity input shape — field names match SkyWalking's GraphQL
 *  `Entity` input verbatim so the operator can paste this block
 *  straight into a `mutation execExpression(…, entity: …)`. The OAP
 *  side serialises with `@JsonInclude(NON_NULL)` so any field that
 *  doesn't apply to the scope is omitted from the JSON. */
export interface MqeEntity {
    scope: InspectScope;
    serviceName?: string;
    normal?: boolean;
    serviceInstanceName?: string;
    endpointName?: string;
    destServiceName?: string;
    destNormal?: boolean;
    destServiceInstanceName?: string;
    destEndpointName?: string;
}
/** Decoded entity-id payload — scope-dependent shape. For single
 *  scopes (`Service`, `ServiceInstance`, `Endpoint`) it carries
 *  service/instance/endpoint fields at the top level; for *Relation
 *  scopes it nests under `source` / `destination`. Modelled here as
 *  an open record because the JSON shape is fixed per scope but the
 *  union is wide. */
export type DecodedEntity = Record<string, unknown>;
export interface EntityRow {
    entityId: string;
    decoded: DecodedEntity;
    /** Set for service-bearing rows; one row per registered Layer.
     *  Omitted (Java `null` → field absent thanks to `NON_NULL`) when
     *  the service is missing from the metadata cache. */
    layer?: string;
    mqeEntity: MqeEntity;
}
export interface EntitiesResponse {
    metric: string;
    scope: InspectScope;
    step: InspectStep;
    /** Echo of the `start` query param in the step-specific format. */
    start: string;
    /** Echo of the `end` query param in the step-specific format. */
    end: string;
    rows: EntityRow[];
}
export interface ListMetricsArgs {
    /** Java regex.Pattern over metric name. No filter when omitted. */
    regex?: string;
    /** Repeatable; matches `MetricsType` enum names. */
    type?: InspectMetricType[];
    /** Repeatable; matches `DefaultScopeDefine` catalog names. */
    catalog?: InspectCatalog[];
    /** If true, narrows to MQE-queryable types (`REGULAR_VALUE` +
     *  `LABELED_VALUE`). */
    mqeQueryable?: boolean;
}
export interface ListEntitiesArgs {
    metric: string;
    /** Date string per step format. Use `formatInspectDate(date, step)`
     *  to build it. */
    start: string;
    end: string;
    step: InspectStep;
    /** 1–300, default 300 server-side. Studio defaults to a smaller
     *  number per widget. */
    limit?: number;
}
export type ExpressionResultType = 'UNKNOWN' | 'SINGLE_VALUE' | 'TIME_SERIES_VALUES' | 'SORTED_LIST' | 'RECORD_LIST';
export interface MqeOwner {
    scope?: string | null;
    serviceID?: string | null;
    serviceName?: string | null;
    normal?: boolean | null;
    serviceInstanceID?: string | null;
    serviceInstanceName?: string | null;
    endpointID?: string | null;
    endpointName?: string | null;
}
export interface MqeKeyValue {
    key: string;
    value: string;
}
export interface MqeMetadata {
    labels: MqeKeyValue[];
}
export interface MqeValue {
    id?: string | null;
    owner?: MqeOwner | null;
    /** Stringified number or `null` when absent. */
    value: string | null;
    traceID?: string | null;
}
export interface MqeValues {
    metric: MqeMetadata;
    values: MqeValue[];
}
export interface ExpressionResult {
    type: ExpressionResultType;
    results: MqeValues[];
    error?: string | null;
}
/** Wire shape for Studio's `POST /api/inspect/exec`. The BFF will
 *  translate this into a GraphQL `mutation execExpression(...)` call
 *  against the resolved MQE base. */
export interface InspectExecRequest {
    expression: string;
    entity: MqeEntity;
    duration: {
        start: string;
        end: string;
        step: InspectStep;
        /** Cold-stage flag, BanyanDB-only. Default false. */
        coldStage?: boolean;
    };
    /** Forwarded to GraphQL as `debug: Boolean`. Off by default. */
    debug?: boolean;
}
/** Format a `Date` into the date string OAP expects for the given
 *  step. Mirrors `Duration.getStartTimeBucket` / `getEndTimeBucket`'s
 *  accepted shapes:
 *
 *    DAY    → `yyyy-MM-dd`
 *    HOUR   → `yyyy-MM-dd HH`
 *    MINUTE → `yyyy-MM-dd HHmm`
 *
 *  All values are zero-padded; the date is interpreted in the OAP
 *  server's local timezone, so prefer feeding through `UTC` if your
 *  OAP is configured for UTC (the default for containerised deploys).
 */
export declare function formatInspectDate(d: Date, step: InspectStep): string;
/** True iff `s` parses as a valid date string for the given step. */
export declare function isInspectDate(s: string, step: InspectStep): boolean;
/** OAP's inspect error envelope: `{ "error": "string" }`. */
export interface InspectErrorBody {
    error: string;
}
export declare class InspectApiError extends Error {
    readonly status: number;
    readonly body: InspectErrorBody | string;
    readonly url: string;
    constructor(status: number, body: InspectErrorBody | string, url: string);
}
export interface InspectClientOptions {
    /** OAP admin port URL, e.g. `http://oap:17128`. No trailing slash. */
    adminUrl: string;
    fetch?: FetchLike;
    headers?: Record<string, string>;
    /** Default per-call timeout in ms. `0` disables. */
    timeoutMs?: number;
}
export declare class InspectClient {
    private readonly fetchImpl;
    private readonly base;
    private readonly defaultHeaders;
    private readonly timeoutMs;
    constructor(options: InspectClientOptions);
    /** `GET /inspect/metrics` with optional `regex` / `type` / `catalog`
     *  / `mqeQueryable` filters. Returns the full catalog when no
     *  filters are passed. */
    listMetrics(args?: ListMetricsArgs): Promise<MetricsResponse>;
    /** `GET /inspect/entities` — `metric` + time range + step + limit. */
    listEntities(args: ListEntitiesArgs): Promise<EntitiesResponse>;
    private send;
    private toError;
}
//# sourceMappingURL=inspect.d.ts.map