/** * Creates and synchronously executes a `DELETE_ONLY` regulation. * * Returns the regulation result for every well-formed outcome, including * `FAILED`, `PARTIAL_SUCCESS`, and `NOT_SUPPORTED` — branch on * {@link RegulationResult.status}. Throws {@link RegulationRequestError} when * the request itself is rejected (invalid body, wrong secret, misconfigured * deployment) and `TypeError` for locally invalid options. */ export declare function createRegulation(options: CreateRegulationOptions): Promise; export declare interface CreateRegulationOptions { /** Base URL of the OpenTrack deployment, e.g. `https://analytics.example.com`. */ host: string; /** The deployment's server-only `OPENTRACK_SECRET`. Never expose it to browsers. */ secret: string; /** 1-100 user ids, each 1-255 characters — the same ids sent to the ingestion API. */ subjectIds: string[]; /** Overridable fetch implementation (defaults to the Node.js global). */ fetch?: typeof fetch; } export declare interface DestinationRegulationReport { name: string; status: DestinationRegulationStatus; } export declare type DestinationRegulationStatus = 'FINISHED' | 'RUNNING' | 'FAILED' | 'NOT_SUPPORTED'; export declare const MAX_SUBJECT_ID_LENGTH = 255; /** * Server-only admin client for OpenTrack privacy regulations. * * Wraps `POST /internal/v1/regulations` (modeled on Segment's Deletion and * Suppression API) with typed statuses and input validation. Authentication * uses the deployment's server-only `OPENTRACK_SECRET`, so this module must * never be imported into browser code: import it from * `opentrack-analytics/admin` in Node.js (>= 18) only. */ export declare const MAX_SUBJECT_IDS = 100; /** A rejected regulation request: bad input (400/415), bad credential (401), or a misconfigured deployment (503). */ export declare class RegulationRequestError extends Error { /** HTTP status returned by the deployment. */ readonly status: number; /** Machine-readable error type from the deployment (e.g. `authentication_error`). */ readonly code: string; constructor( /** HTTP status returned by the deployment. */ status: number, /** Machine-readable error type from the deployment (e.g. `authentication_error`). */ code: string, message: string); } export declare interface RegulationResult { regulationType: 'DELETE_ONLY'; subjectType: 'USER_ID'; /** * Overall regulation outcome. `FINISHED` means every deletion-capable * destination deleted the subjects' current data. `RUNNING` means the same * request should be retried after `retryAfterSeconds` (deletion is * idempotent). `FAILED` and `PARTIAL_SUCCESS` mean at least one destination * failed and the request should be retried. `NOT_SUPPORTED` means no * configured destination can delete users. */ status: RegulationStatus; destinations: DestinationRegulationReport[]; /** Present when `status` is `RUNNING`: seconds to wait before retrying. */ retryAfterSeconds?: number; } export declare type RegulationStatus = 'FINISHED' | 'RUNNING' | 'PARTIAL_SUCCESS' | 'FAILED' | 'NOT_SUPPORTED'; export { }