Home / File/ gel.ts — drizzle-orm Source File

gel.ts — drizzle-orm Source File

Architecture documentation for gel.ts, a typescript file in the drizzle-orm codebase. 5 imports, 3 dependents.

File typescript DrizzleKit CLIWorkflow 5 imports 3 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  3b06bb5a_5f4f_2e22_4153_4879511c568b["gel.ts"]
  217e2cbd_4fb7_ceab_251c_5733ece08a8f["views.ts"]
  3b06bb5a_5f4f_2e22_4153_4879511c568b --> 217e2cbd_4fb7_ceab_251c_5733ece08a8f
  b0ef3d06_896b_eefc_c410_dfb419673d70["error"]
  3b06bb5a_5f4f_2e22_4153_4879511c568b --> b0ef3d06_896b_eefc_c410_dfb419673d70
  9135e6b6_37f7_c980_ee35_90f5531de5a4["common.ts"]
  3b06bb5a_5f4f_2e22_4153_4879511c568b --> 9135e6b6_37f7_c980_ee35_90f5531de5a4
  b00190f0_9c7c_acbf_86f7_950ac8c79592["wrapParam"]
  3b06bb5a_5f4f_2e22_4153_4879511c568b --> b00190f0_9c7c_acbf_86f7_950ac8c79592
  9d8cc145_835b_8147_2ea5_b7b5383ae775["zod"]
  3b06bb5a_5f4f_2e22_4153_4879511c568b --> 9d8cc145_835b_8147_2ea5_b7b5383ae775
  c2c22050_0d5c_404e_2b18_5934c728a89c["introspect.ts"]
  c2c22050_0d5c_404e_2b18_5934c728a89c --> 3b06bb5a_5f4f_2e22_4153_4879511c568b
  09e5bcf1_0f03_3dbd_fbdb_762440f28855["utils.ts"]
  09e5bcf1_0f03_3dbd_fbdb_762440f28855 --> 3b06bb5a_5f4f_2e22_4153_4879511c568b
  4e02c2bb_54a8_1500_813e_2cafd1ad4f59["connections.ts"]
  4e02c2bb_54a8_1500_813e_2cafd1ad4f59 --> 3b06bb5a_5f4f_2e22_4153_4879511c568b
  style 3b06bb5a_5f4f_2e22_4153_4879511c568b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { coerce, literal, object, string, TypeOf, undefined as undefinedType, union } from 'zod';
import { error } from '../views';
import { wrapParam } from './common';

export const gelCredentials = union([
	object({
		driver: undefinedType(),
		host: string().min(1),
		port: coerce.number().min(1).optional(),
		user: string().min(1).optional(),
		password: string().min(1).optional(),
		database: string().min(1),
		tlsSecurity: union([
			literal('insecure'),
			literal('no_host_verification'),
			literal('strict'),
			literal('default'),
		]).optional(),
	}).transform((o) => {
		delete o.driver;
		return o as Omit<typeof o, 'driver'>;
	}),
	object({
		driver: undefinedType(),
		url: string().min(1),
		tlsSecurity: union([
			literal('insecure'),
			literal('no_host_verification'),
			literal('strict'),
			literal('default'),
		]).optional(),
	}).transform<{
		url: string;
		tlsSecurity?:
			| 'insecure'
			| 'no_host_verification'
			| 'strict'
			| 'default';
	}>((o) => {
		delete o.driver;
		return o;
	}),
	object({
		driver: undefinedType(),
	}).transform<undefined>((o) => {
		return undefined;
	}),
]);

export type GelCredentials = TypeOf<typeof gelCredentials>;

export const printConfigConnectionIssues = (
	options: Record<string, unknown>,
) => {
	if ('url' in options) {
		let text = `Please provide required params for Gel driver:\n`;
		console.log(error(text));
		console.log(wrapParam('url', options.url, false, 'url'));
		process.exit(1);
	}

	if ('host' in options || 'database' in options) {
		let text = `Please provide required params for Gel driver:\n`;
		console.log(error(text));
		console.log(wrapParam('host', options.host));
		console.log(wrapParam('port', options.port, true));
		console.log(wrapParam('user', options.user, true));
		console.log(wrapParam('password', options.password, true, 'secret'));
		console.log(wrapParam('database', options.database));
		console.log(wrapParam('tlsSecurity', options.tlsSecurity, true));
		process.exit(1);
	}

	console.log(
		error(
			`Either connection "url" or "host", "database" are required for Gel database connection`,
		),
	);
	process.exit(1);
};

Domain

Subdomains

Frequently Asked Questions

What does gel.ts do?
gel.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleKit domain, CLIWorkflow subdomain.
What functions are defined in gel.ts?
gel.ts defines 2 function(s): gelCredentials, printConfigConnectionIssues.
What does gel.ts depend on?
gel.ts imports 5 module(s): common.ts, error, views.ts, wrapParam, zod.
What files import gel.ts?
gel.ts is imported by 3 file(s): connections.ts, introspect.ts, utils.ts.
Where is gel.ts in the architecture?
gel.ts is located at drizzle-kit/src/cli/validations/gel.ts (domain: DrizzleKit, subdomain: CLIWorkflow, directory: drizzle-kit/src/cli/validations).

Analyze Your Own Codebase

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

Try Supermodel Free