@bizone-ai/json-transform-utils
Version:
Utilities for handling JSON transformers
40 lines • 1.9 kB
TypeScript
import { TypeSchema } from "@bizone-ai/json-schema-utils";
declare class TransformUtils {
private additionalContext;
private specialKeys;
private contextVariablesSchemas;
/**
* null means that the schema is defined at runtime
*/
private scopedContextVariablesSchema;
private allContextVariables;
variableDetectionRegExp: RegExp;
constructor(additionalContext?: Set<string>, specialKeys?: Set<string>, contextVariablesSchemas?: Record<string, TypeSchema>, scopedContextVariablesSchema?: Record<string, TypeSchema>);
/**
* This affects detection and syntax highlighting of additional context variables (e.g. $varname)
* @param additionalContext
*/
setAdditionalContext(additionalContext: Set<string>): void;
getAdditionalContext(): Set<string>;
/**
* This mainly affects syntax highlighting. Making certain keys being highlighted differently.
*/
setSpecialKeys(specialKeys: Set<string>): void;
getSpecialKeys(): Set<string>;
/**
* This affects detection and syntax highlighting of additional context variables (e.g. #varname)
* In this case, a schema is also required
* @param contextVariablesSchemas
*/
setContextVariablesSchemas(contextVariablesSchemas: Record<string, TypeSchema>): void;
getContextVariablesSchemas(): Record<string, TypeSchema>;
setScopedContextVariablesSchema(scopedContextVariablesSchema: Record<string, TypeSchema | null>): void;
getScopedContextVariablesSchema(): Record<string, TypeSchema | null>;
matchesAnyOfContextVariables(variableName: string): boolean;
matchesAnyOfAdditionalContext(variableName: string): boolean;
matchesAnyOfSpecialKeys(variableName: string): boolean;
private variableDetectionRegExpFactory;
}
export declare const transformUtils: TransformUtils;
export {};
//# sourceMappingURL=transformUtils.d.ts.map