cdk8s-cli
Version:
This is the command line tool for Cloud Development Kit (CDK) for Kubernetes (cdk8s).
38 lines (37 loc) • 1.14 kB
TypeScript
/**
* A function that takes a value and the path to it within the parent object,
* and either transforms it or leaves it alone.
*/
export type Sanitizer = (path: string[], value: string) => {
applied: boolean;
sanitized?: string;
};
/**
* Properties for 'SafeReviver'.
*/
export interface SafeReviverProps {
readonly allowlistedKeys?: string[];
readonly sanitizers?: Array<Sanitizer>;
}
/**
* JSON/YAML reviver that:
*
* - Throws when an illegal key is detected.
* - Replaces illegal values with a special marker.
*/
export declare class SafeReviver {
static readonly LEGAL_CHARS: RegExp;
static readonly LEGAL_CHARS_IN_ENUM: RegExp;
static readonly STRIPPED_VALUE = "__stripped_by_cdk8s__";
static readonly DESCRIPTION_SANITIZER: Sanitizer;
static readonly LEGAL_CHAR_SANITIZER: Sanitizer;
private readonly allowlistedKeys;
private readonly sanitizers;
constructor(props?: SafeReviverProps);
sanitizeValue(path: string[], value: string): string | undefined;
/**
* Sanitizes a JSON object in-place.
*/
sanitize(obj: any): void;
private _sanitizeObj;
}