Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/sim/app/api/workflows/[id]/execute/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
} from '@/lib/execution/manual-cancellation'
import { preprocessExecution } from '@/lib/execution/preprocessing'
import { LoggingSession } from '@/lib/logs/execution/logging-session'
import { cleanupPaginatedCache } from '@/lib/paginated-cache/paginate'
import {
cleanupExecutionBase64Cache,
hydrateUserFilesWithBase64,
Expand Down Expand Up @@ -988,6 +989,9 @@ async function handleExecutePost(
void cleanupExecutionBase64Cache(executionId).catch((error) => {
reqLogger.error('Failed to cleanup base64 cache', { error })
})
void cleanupPaginatedCache(executionId).catch((error) => {
reqLogger.error('Failed to cleanup paginated cache', { error })
})
}
}
}
Expand Down Expand Up @@ -1483,6 +1487,7 @@ async function handleExecutePost(
timeoutController.cleanup()
if (executionId) {
await cleanupExecutionBase64Cache(executionId)
await cleanupPaginatedCache(executionId)
}
if (!isStreamClosed) {
try {
Expand Down
5 changes: 3 additions & 2 deletions apps/sim/blocks/blocks/zendesk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ Return ONLY the search query - no explanations.`,
description: 'Cursor value from a previous response to fetch the next page of results',
condition: {
field: 'operation',
value: ['get_tickets', 'get_users', 'get_organizations', 'search'],
value: ['get_users', 'get_organizations', 'search'],
},
mode: 'advanced',
},
Expand All @@ -534,6 +534,7 @@ Return ONLY the search query - no explanations.`,
tools: {
access: [
'zendesk_get_tickets',
'zendesk_get_tickets_v2',
'zendesk_get_ticket',
'zendesk_create_ticket',
'zendesk_create_tickets_bulk',
Expand Down Expand Up @@ -564,7 +565,7 @@ Return ONLY the search query - no explanations.`,
tool: (params) => {
switch (params.operation) {
case 'get_tickets':
return 'zendesk_get_tickets'
return 'zendesk_get_tickets_v2'
case 'get_ticket':
return 'zendesk_get_ticket'
case 'create_ticket':
Expand Down
5 changes: 5 additions & 0 deletions apps/sim/executor/execution/block-executor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createLogger, type Logger } from '@sim/logger'
import { redactApiKeys } from '@/lib/core/security/redaction'
import { getBaseUrl } from '@/lib/core/utils/urls'
import { hydrateCacheReferences } from '@/lib/paginated-cache/paginate'
import {
containsUserFileWithMetadata,
hydrateUserFilesWithBase64,
Expand Down Expand Up @@ -167,6 +168,10 @@ export class BlockExecutor {
})) as NormalizedBlockOutput
}

normalizedOutput = (await hydrateCacheReferences(
normalizedOutput as Record<string, unknown>
)) as NormalizedBlockOutput

const duration = performance.now() - startTime

if (blockLog) {
Expand Down
20 changes: 20 additions & 0 deletions apps/sim/lib/paginated-cache/adapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { CachedPage, CacheMetadata } from '@/lib/paginated-cache/types'

/**
* Storage-agnostic interface for paginated cache operations.
* TTL and other storage-specific concerns belong in implementations.
*/
export interface PaginatedCacheStorageAdapter {
/** Store a single page of items */
storePage(cacheId: string, pageIndex: number, items: unknown[]): Promise<void>
/** Store cache metadata */
storeMetadata(cacheId: string, metadata: CacheMetadata): Promise<void>
/** Retrieve a single page. Returns null if not found or expired. */
getPage(cacheId: string, pageIndex: number): Promise<CachedPage | null>
/** Retrieve cache metadata. Returns null if not found or expired. */
getMetadata(cacheId: string): Promise<CacheMetadata | null>
/** Retrieve all pages in order. Throws if any page is missing. */
getAllPages(cacheId: string, totalPages: number): Promise<CachedPage[]>
/** Delete all data for a cache entry */
delete(cacheId: string): Promise<void>
}
14 changes: 14 additions & 0 deletions apps/sim/lib/paginated-cache/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export type { PaginatedCacheStorageAdapter } from '@/lib/paginated-cache/adapter'
export {
autoPaginate,
cleanupPaginatedCache,
hydrateCacheReferences,
} from '@/lib/paginated-cache/paginate'
export { RedisPaginatedCache } from '@/lib/paginated-cache/redis-cache'
export {
type CachedPage,
type CacheMetadata,
isPaginatedCacheReference,
type PaginatedCacheReference,
type ToolPaginationConfig,
} from '@/lib/paginated-cache/types'
Loading
Loading