UNPKG

target-clickhouse

Version:
67 lines (66 loc) 2.77 kB
import { ExtendedJSONSchema7, SchemaKeyProperties } from "singer-node"; import { ValueTranslator } from "./SchemaTranslator"; export interface IExtendedJSONSchema7 extends ExtendedJSONSchema7 { decimals?: number; precision?: number; lowCardinality?: boolean; } export declare const nestedSubObjectSeparator = "$%\u20AC\u00A3"; export declare class JsonSchemaInspectorContext { readonly alias: string; readonly schema: IExtendedJSONSchema7; readonly keyProperties: string[]; readonly subtableSeparator: string; readonly parentCtx?: JsonSchemaInspectorContext | undefined; readonly level: number; readonly tableName: string; readonly cleaningColumn?: string | undefined; readonly allKeyProperties: SchemaKeyProperties; constructor(alias: string, schema: IExtendedJSONSchema7, keyProperties: string[], subtableSeparator?: string, parentCtx?: JsonSchemaInspectorContext | undefined, level?: number, tableName?: string, cleaningColumn?: string | undefined, allKeyProperties?: SchemaKeyProperties); static defaultTableName(alias: string, subtableSeparator: string, parentCtx?: JsonSchemaInspectorContext): string; isTypeObject(): boolean; isRoot(): boolean; getRootContext(): JsonSchemaInspectorContext; } export declare type ValueExtractor = (data: Record<string, any> | any) => any; export interface ISimpleColumnType { chType?: string; valueTranslator?: ValueTranslator; typeFormat?: string; nullable: boolean; lowCardinality: boolean; nestedArray?: boolean; } export interface IColumnMapping { prop?: string; valueExtractor: ValueExtractor; sqlIdentifier: string; } export declare type ColumnMap = IColumnMapping & ISimpleColumnType; export declare enum PKType { ROOT = "ROOT", PARENT = "PARENT", CURRENT = "CURRENT", LEVEL = "LEVEL" } export interface IPKMapping { prop: string; valueExtractor: ValueExtractor; sqlIdentifier: string; pkType: PKType; } export declare type PkMap = IPKMapping & ISimpleColumnType; export interface ISourceMeta { prop: string; children: ISourceMeta[]; pkMappings: PkMap[]; simpleColumnMappings: ColumnMap[]; sqlTableName: string; cleaningColumn?: string; } export declare const formatLevelIndexColumn: (level: number) => string; export declare const formatRootPKColumn: (prop: string) => string; export declare const formatParentPKColumn: (prop: string) => string; export declare const buildMeta: (ctx: JsonSchemaInspectorContext) => ISourceMeta; export declare function getSimpleColumnSqlType(ctx: JsonSchemaInspectorContext, propDef: IExtendedJSONSchema7, key?: string): string | undefined; export declare function escapeIdentifier(id: string, subtableSeparator?: string): string;