mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-17 01:42:43 -05:00
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:
@@ -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(),
|
||||
}))
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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>> {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isLikelyReferenceSegment } from '@/lib/workflows/references'
|
||||
import { isLikelyReferenceSegment } from '@/lib/workflows/sanitization/references'
|
||||
import { REFERENCE } from '@/executor/consts'
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user