Home / File/ api.ts — ui Source File

api.ts — ui Source File

Architecture documentation for api.ts, a typescript file in the ui codebase. 4 imports, 0 dependents.

File typescript DesignEngine Transformers 4 imports 3 functions

Entity Profile

Dependency Diagram

graph LR
  943c084a_a0e9_6180_b716_36b2f3a304b1["api.ts"]
  787248c9_681f_3c57_9883_813b643bcaa4["server-only"]
  943c084a_a0e9_6180_b716_36b2f3a304b1 --> 787248c9_681f_3c57_9883_813b643bcaa4
  ceec689a_1334_a657_3c35_094070222b09["schema"]
  943c084a_a0e9_6180_b716_36b2f3a304b1 --> ceec689a_1334_a657_3c35_094070222b09
  f14cf7ca_f213_afc2_bc66_ebc0fb7d9834["config"]
  943c084a_a0e9_6180_b716_36b2f3a304b1 --> f14cf7ca_f213_afc2_bc66_ebc0fb7d9834
  59c28bae_bf23_eaf9_96bc_8cab053c5c96["constants"]
  943c084a_a0e9_6180_b716_36b2f3a304b1 --> 59c28bae_bf23_eaf9_96bc_8cab053c5c96
  style 943c084a_a0e9_6180_b716_36b2f3a304b1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import "server-only"

import { registryItemSchema } from "shadcn/schema"

import { getThemesForBaseColor, type BaseName } from "@/registry/config"
import { ALLOWED_ITEM_TYPES } from "@/app/(create)/lib/constants"

export async function getItemsForBase(base: BaseName) {
  const { Index } = await import("@/registry/bases/__index__")
  const index = Index[base]

  if (!index) {
    return []
  }

  return Object.values(index).filter((item) =>
    ALLOWED_ITEM_TYPES.includes(item.type)
  )
}

export async function getBaseItem(name: string, base: BaseName) {
  const { Index } = await import("@/registry/bases/__index__")
  const index = Index[base]

  if (!index?.[name]) {
    return null
  }

  return registryItemSchema.parse(index[name])
}

export async function getBaseComponent(name: string, base: BaseName) {
  const { Index } = await import("@/registry/bases/__index__")
  const index = Index[base]

  if (!index?.[name]) {
    return null
  }

  return index[name].component
}

// Re-export for server-side use.
export { getThemesForBaseColor }

Domain

Subdomains

Dependencies

  • config
  • constants
  • schema
  • server-only

Frequently Asked Questions

What does api.ts do?
api.ts is a source file in the ui codebase, written in typescript. It belongs to the DesignEngine domain, Transformers subdomain.
What functions are defined in api.ts?
api.ts defines 3 function(s): getBaseComponent, getBaseItem, getItemsForBase.
What does api.ts depend on?
api.ts imports 4 module(s): config, constants, schema, server-only.
Where is api.ts in the architecture?
api.ts is located at apps/v4/app/(create)/lib/api.ts (domain: DesignEngine, subdomain: Transformers, directory: apps/v4/app/(create)/lib).

Analyze Your Own Codebase

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

Try Supermodel Free