Home / Class/ IntrospectProgress Class — drizzle-orm Architecture

IntrospectProgress Class — drizzle-orm Architecture

Architecture documentation for the IntrospectProgress class in views.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  4d3a78f8_0730_e394_e2da_0f213c03b618["IntrospectProgress"]
  217e2cbd_4fb7_ceab_251c_5733ece08a8f["views.ts"]
  4d3a78f8_0730_e394_e2da_0f213c03b618 -->|defined in| 217e2cbd_4fb7_ceab_251c_5733ece08a8f
  7ec2fe77_abf5_5ae2_241b_e7305485f356["constructor()"]
  4d3a78f8_0730_e394_e2da_0f213c03b618 -->|method| 7ec2fe77_abf5_5ae2_241b_e7305485f356
  db0c397a_220a_c404_bea0_7813784bf108["update()"]
  4d3a78f8_0730_e394_e2da_0f213c03b618 -->|method| db0c397a_220a_c404_bea0_7813784bf108
  39a8f874_5bef_622a_77ce_4550021d46b2["render()"]
  4d3a78f8_0730_e394_e2da_0f213c03b618 -->|method| 39a8f874_5bef_622a_77ce_4550021d46b2

Relationship Graph

Source Code

drizzle-kit/src/cli/views.ts lines 423–527

export class IntrospectProgress extends TaskView {
	private readonly spinner: Spinner = new Spinner('⣷⣯⣟⡿⢿⣻⣽⣾'.split(''));
	private timeout: NodeJS.Timeout | undefined;

	private state: IntrospectState = {
		tables: {
			count: 0,
			name: 'tables',
			status: 'fetching',
		},
		columns: {
			count: 0,
			name: 'columns',
			status: 'fetching',
		},
		enums: {
			count: 0,
			name: 'enums',
			status: 'fetching',
		},
		indexes: {
			count: 0,
			name: 'indexes',
			status: 'fetching',
		},
		fks: {
			count: 0,
			name: 'foreign keys',
			status: 'fetching',
		},
		policies: {
			count: 0,
			name: 'policies',
			status: 'fetching',
		},
		checks: {
			count: 0,
			name: 'check constraints',
			status: 'fetching',
		},
		views: {
			count: 0,
			name: 'views',
			status: 'fetching',
		},
	};

	constructor(private readonly hasEnums: boolean = false) {
		super();
		this.timeout = setInterval(() => {
			this.spinner.tick();
			this.requestLayout();
		}, 128);

		this.on('detach', () => clearInterval(this.timeout));
	}

	public update(
		stage: IntrospectStage,
		count: number,
		status: IntrospectStatus,
	) {
		this.state[stage].count = count;
		this.state[stage].status = status;
		this.requestLayout();
	}

	private formatCount = (count: number) => {
		const width: number = Math.max.apply(
			null,
			Object.values(this.state).map((it) => it.count.toFixed(0).length),
		);

		return count.toFixed(0).padEnd(width, ' ');
	};

	private statusText = (spinner: string, stage: ValueOf<IntrospectState>) => {
		const { name, count } = stage;
		const isDone = stage.status === 'done';

		const prefix = isDone ? `[${chalk.green('✓')}]` : `[${spinner}]`;

Domain

Frequently Asked Questions

What is the IntrospectProgress class?
IntrospectProgress is a class in the drizzle-orm codebase, defined in drizzle-kit/src/cli/views.ts.
Where is IntrospectProgress defined?
IntrospectProgress is defined in drizzle-kit/src/cli/views.ts at line 423.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free