Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
3 changes: 1 addition & 2 deletions apps/sim/blocks/blocks/zendesk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ Return ONLY the search query - no explanations.`,
condition: {
field: 'operation',
value: [
'get_tickets',
'get_users',
'get_organizations',
'search_users',
Expand All @@ -514,7 +513,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 Down
2 changes: 2 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 @@ -109,6 +110,7 @@ export class BlockExecutor {
}

resolvedInputs = this.resolver.resolveInputs(ctx, node.id, block.config.params, block)
resolvedInputs = await hydrateCacheReferences(resolvedInputs)

if (blockLog) {
blockLog.input = this.sanitizeInputsForLog(resolvedInputs)
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 { RedisPaginatedCache } from '@/lib/paginated-cache/redis-cache'
export {
autoPaginate,
cleanupPaginatedCache,
hydrateCacheReferences,
} from '@/lib/paginated-cache/paginate'
export {
isPaginatedCacheReference,
type CachedPage,
type CacheMetadata,
type PaginatedCacheReference,
type ToolPaginationConfig,
} from '@/lib/paginated-cache/types'
Loading
Loading