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

ast.ts — drizzle-orm Source File

Architecture documentation for ast.ts, a typescript file in the drizzle-orm codebase. 1 imports, 2 dependents.

File typescript DrizzleORM RelationalQuery 1 imports 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  e5742924_3949_00fb_8a61_51fa28a972cf["ast.ts"]
  02888e0e_5ac9_200a_278f_c729b5af7410["utils"]
  e5742924_3949_00fb_8a61_51fa28a972cf --> 02888e0e_5ac9_200a_278f_c729b5af7410
  f0c93e37_d0c6_85de_9c85_875c07d8cd5b["enforce-delete-with-where.ts"]
  f0c93e37_d0c6_85de_9c85_875c07d8cd5b --> e5742924_3949_00fb_8a61_51fa28a972cf
  293f011b_cdb8_71ff_a37a_bbe21603eeb7["enforce-update-with-where.ts"]
  293f011b_cdb8_71ff_a37a_bbe21603eeb7 --> e5742924_3949_00fb_8a61_51fa28a972cf
  style e5742924_3949_00fb_8a61_51fa28a972cf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { TSESTree } from '@typescript-eslint/utils';

export const resolveMemberExpressionPath = (node: TSESTree.MemberExpression) => {
	let objectExpression = node.object;
	let fullName = '';

	const addToFullName = (name: string) => {
		const prefix = fullName ? '.' : '';
		fullName = `${name}${prefix}${fullName}`;
	};

	while (objectExpression) {
		if (objectExpression.type === 'MemberExpression') {
			if (objectExpression.property.type === 'Identifier') {
				addToFullName(objectExpression.property.name);
			}
			objectExpression = objectExpression.object;
		} else if (objectExpression.type === 'CallExpression' && objectExpression.callee.type === 'Identifier') {
			addToFullName(`${objectExpression.callee.name}(...)`);
			break;
		} else if (objectExpression.type === 'CallExpression' && objectExpression.callee.type === 'MemberExpression') {
			if (objectExpression.callee.property.type === 'Identifier') {
				addToFullName(`${objectExpression.callee.property.name}(...)`);
			}
			objectExpression = objectExpression.callee.object;
		} else if (objectExpression.type === 'Identifier') {
			addToFullName(objectExpression.name);
			break;
		} else if (objectExpression.type === 'ThisExpression') {
			addToFullName('this');
			break;
		} else {
			break;
		}
	}

	return fullName;
};

Domain

Subdomains

Dependencies

  • utils

Frequently Asked Questions

What does ast.ts do?
ast.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleORM domain, RelationalQuery subdomain.
What functions are defined in ast.ts?
ast.ts defines 1 function(s): resolveMemberExpressionPath.
What does ast.ts depend on?
ast.ts imports 1 module(s): utils.
What files import ast.ts?
ast.ts is imported by 2 file(s): enforce-delete-with-where.ts, enforce-update-with-where.ts.
Where is ast.ts in the architecture?
ast.ts is located at eslint-plugin-drizzle/src/utils/ast.ts (domain: DrizzleORM, subdomain: RelationalQuery, directory: eslint-plugin-drizzle/src/utils).

Analyze Your Own Codebase

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

Try Supermodel Free