improvement(lib): refactored lib/ to be more aligned with queries and api directory (#2160)

* fix(lib): consolidate into core dir in lib/

* refactored lib/
This commit is contained in:
Waleed
2025-12-02 14:17:41 -08:00
committed by GitHub
parent 6fda9bd72e
commit 41c068c023
707 changed files with 1771 additions and 1748 deletions

View File

@@ -31,8 +31,11 @@ vi.mock('@/tools/utils', () => ({
}))
// Utils
vi.mock('@/lib/utils', () => ({
isHosted: vi.fn().mockReturnValue(false),
vi.mock('@/lib/core/config/environment', () => ({
isHosted: false,
}))
vi.mock('@/lib/core/config/api-keys', () => ({
getRotatingApiKey: vi.fn(),
}))

View File

@@ -1,5 +1,5 @@
import { getBaseUrl } from '@/lib/core/utils/urls'
import { createLogger } from '@/lib/logs/console/logger'
import { getBaseUrl } from '@/lib/urls/utils'
import {
BlockType,
buildResumeApiUrl,

View File

@@ -1,5 +1,5 @@
import { createLogger } from '@/lib/logs/console/logger'
import { StartBlockPath } from '@/lib/workflows/triggers'
import { StartBlockPath } from '@/lib/workflows/triggers/triggers'
import type { BlockOutput } from '@/blocks/types'
import { DAGBuilder } from '@/executor/dag/builder'
import { BlockExecutor } from '@/executor/execution/block-executor'

View File

@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, type Mock, vi } from 'vitest'
import { isHosted } from '@/lib/environment'
import { isHosted } from '@/lib/core/config/environment'
import { getAllBlocks } from '@/blocks'
import { BlockType } from '@/executor/consts'
import { AgentBlockHandler } from '@/executor/handlers/agent/agent-handler'
@@ -11,7 +11,7 @@ import { executeTool } from '@/tools'
process.env.NEXT_PUBLIC_APP_URL = 'http://localhost:3000'
vi.mock('@/lib/environment', () => ({
vi.mock('@/lib/core/config/environment', () => ({
isHosted: vi.fn().mockReturnValue(false),
isProd: vi.fn().mockReturnValue(false),
isDev: vi.fn().mockReturnValue(true),

View File

@@ -1,5 +1,5 @@
import { getBaseUrl } from '@/lib/core/utils/urls'
import { createLogger } from '@/lib/logs/console/logger'
import { getBaseUrl } from '@/lib/urls/utils'
import type { BlockOutput } from '@/blocks/types'
import {
BlockType,

View File

@@ -1,5 +1,5 @@
import { getBaseUrl } from '@/lib/core/utils/urls'
import { createLogger } from '@/lib/logs/console/logger'
import { getBaseUrl } from '@/lib/urls/utils'
import { generateRouterPrompt } from '@/blocks/blocks/router'
import type { BlockOutput } from '@/blocks/types'
import { BlockType, DEFAULTS, HTTP, isAgentBlockType, ROUTER } from '@/executor/consts'

View File

@@ -1,5 +1,5 @@
import { generateInternalToken } from '@/lib/auth/internal'
import { getBaseUrl } from '@/lib/urls/utils'
import { getBaseUrl } from '@/lib/core/utils/urls'
import { HTTP } from '@/executor/consts'
export async function buildAuthHeaders(): Promise<Record<string, string>> {

View File

@@ -1,4 +1,4 @@
import { isLikelyReferenceSegment } from '@/lib/workflows/references'
import { isLikelyReferenceSegment } from '@/lib/workflows/sanitization/references'
import { REFERENCE } from '@/executor/consts'
/**

View File

@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import { StartBlockPath } from '@/lib/workflows/triggers'
import { StartBlockPath } from '@/lib/workflows/triggers/triggers'
import type { UserFile } from '@/executor/types'
import {
buildResolutionFromBlock,

View File

@@ -1,10 +1,10 @@
import { isUserFile } from '@/lib/utils'
import { isUserFile } from '@/lib/core/utils/display-filters'
import {
classifyStartBlockType,
getLegacyStarterMode,
resolveStartCandidates,
StartBlockPath,
} from '@/lib/workflows/triggers'
} from '@/lib/workflows/triggers/triggers'
import type { InputFormatField } from '@/lib/workflows/types'
import type { NormalizedBlockOutput, UserFile } from '@/executor/types'
import type { SerializedBlock } from '@/serializer/types'

View File

@@ -1,5 +1,5 @@
import { createLogger } from '@/lib/logs/console/logger'
import { VariableManager } from '@/lib/variables/variable-manager'
import { VariableManager } from '@/lib/workflows/variables/variable-manager'
import { isReference, parseReferencePath, REFERENCE } from '@/executor/consts'
import {
navigatePath,