ResolveSchemasSelect Class — drizzle-orm Architecture
Architecture documentation for the ResolveSchemasSelect class in views.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 381c3fdc_f28f_2e1b_d5aa_00dcdd8d98f6["ResolveSchemasSelect"] 217e2cbd_4fb7_ceab_251c_5733ece08a8f["views.ts"] 381c3fdc_f28f_2e1b_d5aa_00dcdd8d98f6 -->|defined in| 217e2cbd_4fb7_ceab_251c_5733ece08a8f e6f58c19_44ba_6000_7f0c_e1aee20bc031["constructor()"] 381c3fdc_f28f_2e1b_d5aa_00dcdd8d98f6 -->|method| e6f58c19_44ba_6000_7f0c_e1aee20bc031 0d0fab37_f23a_9c72_132f_3fdfe0f2728c["render()"] 381c3fdc_f28f_2e1b_d5aa_00dcdd8d98f6 -->|method| 0d0fab37_f23a_9c72_132f_3fdfe0f2728c b8bf28f8_54c2_ff60_3442_1175912f4c57["result()"] 381c3fdc_f28f_2e1b_d5aa_00dcdd8d98f6 -->|method| b8bf28f8_54c2_ff60_3442_1175912f4c57
Relationship Graph
Source Code
drizzle-kit/src/cli/views.ts lines 309–370
export class ResolveSchemasSelect<T extends Named> extends Prompt<
RenamePropmtItem<T> | T
> {
private readonly state: SelectState<RenamePropmtItem<T> | T>;
constructor(private readonly base: Named, data: (RenamePropmtItem<T> | T)[]) {
super();
this.on('attach', (terminal) => terminal.toggleCursor('hide'));
this.state = new SelectState(data);
this.state.bind(this);
this.base = base;
}
render(status: 'idle' | 'submitted' | 'aborted'): string {
if (status === 'submitted' || status === 'aborted') {
return '';
}
let text = `\nIs ${
chalk.bold.blue(
this.base.name,
)
} schema created or renamed from another schema?\n`;
const isSelectedRenamed = isRenamePromptItem(
this.state.items[this.state.selectedIdx],
);
const selectedPrefix = isSelectedRenamed
? chalk.yellow('❯ ')
: chalk.green('❯ ');
const labelLength: number = this.state.items
.filter((it) => isRenamePromptItem(it))
.map((it: RenamePropmtItem<T>) => {
return this.base.name.length + 3 + it['from'].name.length;
})
.reduce((a, b) => {
if (a > b) {
return a;
}
return b;
}, 0);
this.state.items.forEach((it, idx) => {
const isSelected = idx === this.state.selectedIdx;
const isRenamed = isRenamePromptItem(it);
const title = isRenamed
? `${it.from.name} › ${it.to.name}`.padEnd(labelLength, ' ')
: it.name.padEnd(labelLength, ' ');
const label = isRenamed
? `${chalk.yellow('~')} ${title} ${chalk.gray('rename schema')}`
: `${chalk.green('+')} ${title} ${chalk.gray('create schema')}`;
text += isSelected ? `${selectedPrefix}${label}` : ` ${label}`;
text += idx != this.state.items.length - 1 ? '\n' : '';
});
return text;
}
result(): RenamePropmtItem<T> | T {
return this.state.items[this.state.selectedIdx]!;
}
}
Domain
Defined In
Source
Frequently Asked Questions
What is the ResolveSchemasSelect class?
ResolveSchemasSelect is a class in the drizzle-orm codebase, defined in drizzle-kit/src/cli/views.ts.
Where is ResolveSchemasSelect defined?
ResolveSchemasSelect is defined in drizzle-kit/src/cli/views.ts at line 309.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free