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

global.ts — drizzle-orm Source File

Architecture documentation for global.ts, a typescript file in the drizzle-orm codebase. 0 imports, 21 dependents.

File typescript DrizzleKit Introspection 21 dependents 6 functions

Entity Profile

Dependency Diagram

graph LR
  8f03c4cf_4fdf_b056_3b24_d493cab0cc81["global.ts"]
  e668bfef_9125_1ef0_2f94_a0f9605584bd["api.ts"]
  e668bfef_9125_1ef0_2f94_a0f9605584bd --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  c2c22050_0d5c_404e_2b18_5934c728a89c["introspect.ts"]
  c2c22050_0d5c_404e_2b18_5934c728a89c --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  f816063a_7e7e_84b8_d556_2fad92ba1294["mysqlIntrospect.ts"]
  f816063a_7e7e_84b8_d556_2fad92ba1294 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  9b24aa9e_af00_88e2_5a0a_d67a2b0b670c["pgIntrospect.ts"]
  9b24aa9e_af00_88e2_5a0a_d67a2b0b670c --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  5ace557c_1d0c_8b30_588f_2973fb2830b3["singlestoreIntrospect.ts"]
  5ace557c_1d0c_8b30_588f_2973fb2830b3 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  cea479b5_7704_0339_de4e_3cc844834ec0["sqliteIntrospect.ts"]
  cea479b5_7704_0339_de4e_3cc844834ec0 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  09e5bcf1_0f03_3dbd_fbdb_762440f28855["utils.ts"]
  09e5bcf1_0f03_3dbd_fbdb_762440f28855 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  4e02c2bb_54a8_1500_813e_2cafd1ad4f59["connections.ts"]
  4e02c2bb_54a8_1500_813e_2cafd1ad4f59 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  5bf76609_579e_d312_b33b_ab5b8b683111["schema.ts"]
  5bf76609_579e_d312_b33b_ab5b8b683111 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  ac795a29_c480_454a_c930_ea8898cad46c["introspect-gel.ts"]
  ac795a29_c480_454a_c930_ea8898cad46c --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa["introspect-mysql.ts"]
  1198bdc6_ac5c_88c0_dda6_b8caf0f5d9fa --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  71516551_23e3_bf30_27c9_000fb046ef71["introspect-pg.ts"]
  71516551_23e3_bf30_27c9_000fb046ef71 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  c6b71380_9588_5d06_58bb_e4dc7e505759["introspect-singlestore.ts"]
  c6b71380_9588_5d06_58bb_e4dc7e505759 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  c1c349dd_2e31_d056_728c_c034cebb41c0["introspect-sqlite.ts"]
  c1c349dd_2e31_d056_728c_c034cebb41c0 --> 8f03c4cf_4fdf_b056_3b24_d493cab0cc81
  style 8f03c4cf_4fdf_b056_3b24_d493cab0cc81 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

export const originUUID = '00000000-0000-0000-0000-000000000000';
export const snapshotVersion = '7';

export function assertUnreachable(x: never | undefined): never {
	throw new Error("Didn't expect to get here");
}

// don't fail in runtime, types only
export function softAssertUnreachable(x: never) {
	return null as never;
}

export const mapValues = <IN, OUT>(
	obj: Record<string, IN>,
	map: (input: IN) => OUT,
): Record<string, OUT> => {
	const result = Object.keys(obj).reduce(function(result, key) {
		result[key] = map(obj[key]);
		return result;
	}, {} as Record<string, OUT>);
	return result;
};

export const mapKeys = <T>(
	obj: Record<string, T>,
	map: (key: string, value: T) => string,
): Record<string, T> => {
	const result = Object.fromEntries(
		Object.entries(obj).map(([key, val]) => {
			const newKey = map(key, val);
			return [newKey, val];
		}),
	);
	return result;
};

export const mapEntries = <T>(
	obj: Record<string, T>,
	map: (key: string, value: T) => [string, T],
): Record<string, T> => {
	const result = Object.fromEntries(
		Object.entries(obj).map(([key, val]) => {
			const [newKey, newVal] = map(key, val);
			return [newKey, newVal];
		}),
	);
	return result;
};

export const customMapEntries = <TReturn, T = any>(
	obj: Record<string, T>,
	map: (key: string, value: T) => [string, TReturn],
): Record<string, TReturn> => {
	const result = Object.fromEntries(
		Object.entries(obj).map(([key, val]) => {
			const [newKey, newVal] = map(key, val);
			return [newKey, newVal];
		}),
	);
	return result;
};

Domain

Subdomains

Frequently Asked Questions

What does global.ts do?
global.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleKit domain, Introspection subdomain.
What functions are defined in global.ts?
global.ts defines 6 function(s): assertUnreachable, customMapEntries, mapEntries, mapKeys, mapValues, softAssertUnreachable.
What files import global.ts?
global.ts is imported by 21 file(s): api.ts, connections.ts, gelSchema.ts, introspect-gel.ts, introspect-mysql.ts, introspect-pg.ts, introspect-singlestore.ts, introspect-sqlite.ts, and 13 more.
Where is global.ts in the architecture?
global.ts is located at drizzle-kit/src/global.ts (domain: DrizzleKit, subdomain: Introspection, directory: drizzle-kit/src).

Analyze Your Own Codebase

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

Try Supermodel Free