Skip to content
Merged
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
3 changes: 3 additions & 0 deletions src/modules/temporal/activities/nodes/add-label.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export interface AddLabelNodeInput {
labelId: string;
labelName?: string;
sessionId: string;
// EVO-1917: journeyId lets interpolateNodeData load journey-level variable
// defaults so {{variables}} resolve in this node (mirrors send-webhook).
journeyId?: string;
nodeData: {
labelId: string;
nextNodeId?: string;
Expand Down
25 changes: 25 additions & 0 deletions src/modules/temporal/activities/nodes/base.node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,31 @@ describe('BaseNode.interpolateNodeData — journeyId fallback (EVO-1885)', () =>
expect(findOne).toHaveBeenCalledWith({ where: { id: 'journey-from-input' } });
});

// EVO-1917: the dispatch sweep threads input.journeyId to every interpolating
// executor. This proves that thread is load-bearing: when the cached session
// carries no journeyId (e.g. a lean cache shape), the explicitly-dispatched
// input.journeyId is what resolves journey-default {{variables}}.
it('EVO-1917: resolves journey defaults from input.journeyId when session has none', async () => {
mockGetSessionFromCache.mockResolvedValue({
id: 's1',
// no journeyId on the session — only the dispatched input carries it
variables: {},
});
findOne.mockResolvedValue({
variables: [{ name: 'greeting', defaultValue: 'Olá' }],
});

const result = await node.interpolate(
{ sessionId: 's1', journeyId: 'journey-from-dispatch' },
{ message: '{{greeting}}' },
);

expect(findOne).toHaveBeenCalledWith({
where: { id: 'journey-from-dispatch' },
});
expect(result.message).toBe('Olá');
});

it('AC3: skips the journey query when no id resolves, leaving journey-default tokens literal', async () => {
mockGetSessionFromCache.mockResolvedValue({
id: 's1',
Expand Down
1 change: 1 addition & 0 deletions src/modules/temporal/activities/nodes/conditional.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface ConditionalNodeInput {
contactId: string;
conversationId?: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} in condition values via interpolateNodeData
nodeData: {
paths: Array<{
id: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface AssignAgentNodeInput {
nodeId: string;
conversationId: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
agent_id?: string;
agent_name?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface AssignBotNodeInput {
nodeId: string;
conversationId: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
bot_id?: string;
bot_name?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface AssignTeamNodeInput {
nodeId: string;
conversationId: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
team_id?: string;
team_name?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface SendCannedResponseNodeInput {
conversationId?: string;
sessionId: string;
contactId?: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
canned_response_id?: string;
cannedResponseId?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface SendEmailTeamNodeInput {
nodeId: string;
conversationId?: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
team_ids?: string[];
teamIds?: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface SendMessageNodeInput {
conversationId?: string; // Optional - will create new conversation if not provided
sessionId: string;
contactId?: string; // Add contactId for creating new conversations
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} in the message body via interpolateNodeData
nodeData: {
message?: string;
message_content?: string; // Alternative field name from frontend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface SendTranscriptNodeInput {
nodeId: string;
conversationId: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
email?: string;
recipient_email?: string; // Alternative field name from frontend
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface ChangePriorityNodeInput {
nodeId: string;
conversationId: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
priority?: 'low' | 'medium' | 'high' | 'urgent' | null;
nextNodeId?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface AssignToPipelineNodeInput {
nodeId: string;
conversationId?: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
pipeline_id?: string;
pipelineId?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface CreatePipelineTaskNodeInput {
nodeId: string;
conversationId?: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
title?: string;
description?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface MoveToPipelineStageNodeInput {
nodeId: string;
conversationId?: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
pipeline_id?: string;
pipelineId?: string;
Expand Down
1 change: 1 addition & 0 deletions src/modules/temporal/activities/nodes/remove-label.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface RemoveLabelNodeInput {
labelId: string;
labelName?: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
labelId: string;
nextNodeId?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface UpdateContactNodeInput {
nodeId: string;
contactId: string;
sessionId: string;
journeyId?: string; // EVO-1917: resolve journey-default {{variables}} via interpolateNodeData
nodeData: {
fieldToUpdate?: string;
newValue?: any;
Expand Down
17 changes: 17 additions & 0 deletions src/modules/temporal/workflows/journey-execution.workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,9 @@ export async function JourneyExecutionWorkflow(
labelId: currentNode.data.labelId,
labelName: currentNode.data.labelName,
sessionId: input.sessionId,
// EVO-1917: thread journeyId so interpolateNodeData resolves
// journey-default {{variables}} (mirrors send-webhook/scheduled-action).
journeyId: input.journeyId,
nodeData: currentNode.data,
});
break;
Expand All @@ -681,6 +684,7 @@ export async function JourneyExecutionWorkflow(
labelId: currentNode.data.labelId,
labelName: currentNode.data.labelName,
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand All @@ -691,6 +695,7 @@ export async function JourneyExecutionWorkflow(
nodeId: currentNode.id,
contactId: input.contactId,
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand Down Expand Up @@ -778,6 +783,7 @@ export async function JourneyExecutionWorkflow(
conversationId:
input.triggerEvent?.properties?.conversation_id || undefined,
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917: resolve journey-default {{var}} in condition values
nodeData: currentNode.data,
});
break;
Expand All @@ -797,6 +803,7 @@ export async function JourneyExecutionWorkflow(
conversationId: conversationId || undefined,
sessionId: input.sessionId,
contactId: input.contactId, // Pass contactId for creating new conversations
journeyId: input.journeyId, // EVO-1917: resolve journey-default {{var}} in message body
nodeData: currentNode.data,
});

Expand All @@ -817,6 +824,7 @@ export async function JourneyExecutionWorkflow(
input.triggerEvent?.properties?.conversation_id || undefined,
sessionId: input.sessionId,
contactId: input.contactId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand All @@ -827,6 +835,7 @@ export async function JourneyExecutionWorkflow(
conversationId:
input.triggerEvent?.properties?.conversation_id || undefined,
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand All @@ -838,6 +847,7 @@ export async function JourneyExecutionWorkflow(
conversationId:
input.triggerEvent?.properties?.conversation_id || undefined,
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand All @@ -849,6 +859,7 @@ export async function JourneyExecutionWorkflow(
conversationId:
input.triggerEvent?.properties?.conversation_id || undefined,
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand All @@ -860,6 +871,7 @@ export async function JourneyExecutionWorkflow(
conversationId:
input.triggerEvent?.properties?.conversation_id || undefined,
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand All @@ -870,6 +882,7 @@ export async function JourneyExecutionWorkflow(
conversationId:
input.triggerEvent?.properties?.conversation_id || '',
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand All @@ -880,6 +893,7 @@ export async function JourneyExecutionWorkflow(
conversationId:
input.triggerEvent?.properties?.conversation_id || '',
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand All @@ -890,6 +904,7 @@ export async function JourneyExecutionWorkflow(
conversationId:
input.triggerEvent?.properties?.conversation_id || '',
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand All @@ -901,6 +916,7 @@ export async function JourneyExecutionWorkflow(
input.triggerEvent?.properties?.conversation_id ||
'inbox-level', // Bot assignment can work without specific conversation
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand Down Expand Up @@ -957,6 +973,7 @@ export async function JourneyExecutionWorkflow(
conversationId:
input.triggerEvent?.properties?.conversation_id || '',
sessionId: input.sessionId,
journeyId: input.journeyId, // EVO-1917
nodeData: currentNode.data,
});
break;
Expand Down
Loading