MCPcopy Index your code
hub / github.com/simstudioai/sim / scopeMatchesRef

Function scopeMatchesRef

apps/sim/lib/execution/payloads/cache.ts:93–121  ·  view source on GitHub ↗
(
  ref: LargeValueRef,
  cachedScope: LargeValueCacheScope | undefined,
  callerScope?: LargeValueCacheScope
)

Source from the content-addressed store, hash-verified

91}
92
93function scopeMatchesRef(
94 ref: LargeValueRef,
95 cachedScope: LargeValueCacheScope | undefined,
96 callerScope?: LargeValueCacheScope
97): boolean {
98 if (!cachedScope?.executionId) {
99 return false
100 }
101 if (ref.executionId && ref.executionId !== cachedScope.executionId) {
102 return false
103 }
104 if (!callerScope) {
105 return Boolean(ref.key) && (!ref.executionId || ref.executionId === cachedScope.executionId)
106 }
107
108 const allowedExecutionIds = new Set([
109 callerScope.executionId,
110 ...(callerScope.largeValueExecutionIds ?? []),
111 ])
112 if (ref.key && callerScope.largeValueKeys?.includes(ref.key)) {
113 return true
114 }
115 const workflowScopeAllowed =
116 callerScope.allowLargeValueWorkflowScope &&
117 callerScope.workspaceId === cachedScope.workspaceId &&
118 callerScope.workflowId === cachedScope.workflowId
119
120 return allowedExecutionIds.has(cachedScope.executionId) || Boolean(workflowScopeAllowed)
121}
122
123export function materializeLargeValueRefSync(
124 ref: LargeValueRef,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected