Skip to content

Commit 9daa1e6

Browse files
authored
Merge branch 'mg/OPS-2396-2' into mg/OPS-2396-3
2 parents bca2dd4 + 066f5f5 commit 9daa1e6

10 files changed

Lines changed: 61 additions & 43 deletions

File tree

packages/blocks/aws/src/lib/actions/ec2/ec2-modify-instance-action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const ec2ModifyInstanceAction = createAction({
5656
attributeName,
5757
}): Promise<{ [key: string]: any }> => {
5858
if (!attributeName) {
59-
return {};
59+
return { attributeValue: {} };
6060
}
6161
const attributeNameProp = attributeName as unknown as string;
6262

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { BlockAuth, createBlock } from '@openops/blocks-framework';
22
import { BlockCategory } from '@openops/shared';
3-
import { endFlowAction } from './lib/actions/end-workflow';
3+
import { stopFlowAction } from './lib/actions/end-workflow';
44

5-
export const endFlow = createBlock({
6-
displayName: 'End Workflow',
7-
description: 'End the current workflow',
5+
export const stopFlow = createBlock({
6+
displayName: 'Stop Execution',
7+
description: 'Stop the current scope execution (flow or loop iteration)',
88
auth: BlockAuth.None(),
99
minimumSupportedRelease: '0.20.0',
1010
logoUrl:
1111
'data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3C!--%20License%3A%20MIT.%20Made%20by%20phosphor%3A%20https%3A%2F%2Fgithub.com%2Fphosphor-icons%2Fphosphor-icons%20--%3E%3Csvg%20fill%3D%22%23000000%22%20width%3D%22800px%22%20height%3D%22800px%22%20viewBox%3D%220%200%20256%20256%22%20id%3D%22Flat%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M128%2C20.00012a108%2C108%2C0%2C1%2C0%2C108%2C108A108.12217%2C108.12217%2C0%2C0%2C0%2C128%2C20.00012Zm0%2C192a84%2C84%2C0%2C1%2C1%2C84-84A84.0953%2C84.0953%2C0%2C0%2C1%2C128%2C212.00012Zm40.48535-107.51465L144.9707%2C128.00012l23.51465%2C23.51465a12.0001%2C12.0001%2C0%2C0%2C1-16.9707%2C16.9707L128%2C144.97082l-23.51465%2C23.51465a12.0001%2C12.0001%2C0%2C0%2C1-16.9707-16.9707l23.51465-23.51465L87.51465%2C104.48547a12.0001%2C12.0001%2C0%2C0%2C1%2C16.9707-16.9707L128%2C111.02942l23.51465-23.51465a12.0001%2C12.0001%2C0%2C0%2C1%2C16.9707%2C16.9707Z%22%2F%3E%3C%2Fsvg%3E',
1212
authors: [],
13-
actions: [endFlowAction],
13+
actions: [stopFlowAction],
1414
triggers: [],
1515
categories: [BlockCategory.WORKFLOW],
1616
});

packages/blocks/end-flow/src/lib/actions/end-workflow.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { createAction } from '@openops/blocks-framework';
22

3-
export const endFlowAction = createAction({
3+
export const stopFlowAction = createAction({
44
name: 'end_workflow',
5-
displayName: 'End Workflow',
6-
description: 'End the current workflow',
5+
displayName: 'Stop Execution',
6+
description: 'Stop the current scope execution (flow or loop iteration)',
77
props: {},
88
errorHandlingOptions: {
99
continueOnFailure: {

packages/engine/src/lib/helper/trigger-helper.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,9 @@ export const triggerHelper = {
125125
await trigger.onEnable(context);
126126
return {
127127
listeners: appListeners,
128-
scheduleOptions:
129-
trigger.type === TriggerStrategy.POLLING
130-
? scheduleOptions
131-
: undefined,
128+
scheduleOptions: isSchedulable(trigger.type)
129+
? scheduleOptions
130+
: undefined,
132131
};
133132
case TriggerHookType.RENEW:
134133
assertEqual(
@@ -247,6 +246,10 @@ export const triggerHelper = {
247246
},
248247
};
249248

249+
function isSchedulable(type: TriggerStrategy): boolean {
250+
return type === TriggerStrategy.POLLING || type === TriggerStrategy.SCHEDULED;
251+
}
252+
250253
type ExecuteTriggerParams = {
251254
params: ExecuteTriggerOperation<TriggerHookType>;
252255
constants: EngineConstants;

packages/openops/src/lib/ai/providers.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,3 @@ function sanitizeProviderSettings(
165165

166166
return sanitized;
167167
}
168-
169-
export const providerOptions = {
170-
openai: {
171-
structuredOutputs: false,
172-
},
173-
};

packages/react-ui/src/app/features/builder/block-properties/builder-json-wrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const BuilderJsonEditorWrapper = ({
3636
endLineNumber: position.lineNumber,
3737
endColumn: position.column,
3838
},
39-
text: `"{{${propertyPath}}}"`,
39+
text: `{{${propertyPath}}}`,
4040
},
4141
]);
4242
}

packages/server/api/src/app/ai/chat/code.service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isLLMTelemetryEnabled, providerOptions } from '@openops/common';
1+
import { isLLMTelemetryEnabled } from '@openops/common';
22
import { logger } from '@openops/server-shared';
33
import {
44
AiConfig,
@@ -49,7 +49,6 @@ export const streamCode = ({
4949
onError,
5050
schema: unifiedCodeLLMSchema,
5151
experimental_telemetry: { isEnabled: isLLMTelemetryEnabled() },
52-
providerOptions,
5352
});
5453
};
5554

@@ -80,6 +79,5 @@ export const generateCode = ({
8079
...aiConfig.modelSettings,
8180
schema: unifiedCodeLLMSchema,
8281
experimental_telemetry: { isEnabled: isLLMTelemetryEnabled() },
83-
providerOptions,
8482
});
8583
};

packages/server/api/src/app/ai/chat/llm-stream-handler.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isLLMTelemetryEnabled, providerOptions } from '@openops/common';
1+
import { isLLMTelemetryEnabled } from '@openops/common';
22
import { AiConfig } from '@openops/shared';
33
import {
44
LanguageModel,
@@ -57,7 +57,6 @@ export function getLLMAsyncStream(
5757
async onError({ error }): Promise<void> {
5858
throw error;
5959
},
60-
providerOptions,
6160
});
6261

6362
return fullStream;

packages/server/api/src/app/ai/mcp/tools-selector.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isLLMTelemetryEnabled, providerOptions } from '@openops/common';
1+
import { isLLMTelemetryEnabled } from '@openops/common';
22
import { logger } from '@openops/server-shared';
33
import { AiConfig } from '@openops/shared';
44
import { generateObject, LanguageModel, ModelMessage, ToolSet } from 'ai';
@@ -36,7 +36,6 @@ export async function selectRelevantTools({
3636
messages,
3737
...aiConfig.modelSettings,
3838
experimental_telemetry: { isEnabled: isLLMTelemetryEnabled() },
39-
providerOptions,
4039
});
4140

4241
let selectedToolNames = toolSelectionResult.tool_names;

packages/server/api/src/app/flows/trigger/hooks/enable-trigger-hook.ts

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
OpsEdition,
1818
ProjectId,
1919
RunEnvironment,
20+
ScheduleOptions,
2021
TriggerHookType,
2122
TriggerType,
2223
} from '@openops/shared';
@@ -125,29 +126,32 @@ export const enableBlockTrigger = async (
125126
}
126127
break;
127128
}
128-
case TriggerStrategy.POLLING:
129-
case TriggerStrategy.SCHEDULED: {
129+
case TriggerStrategy.POLLING: {
130130
if (isNil(engineHelperResponse.result.scheduleOptions)) {
131131
engineHelperResponse.result.scheduleOptions = {
132132
cronExpression: POLLING_FREQUENCY_CRON_EXPRESSON,
133133
timezone: 'UTC',
134134
failureCount: 0,
135135
};
136136
}
137-
await flowQueue.add({
138-
executionCorrelationId: flowVersion.id,
139-
type: JobType.REPEATING,
140-
data: {
141-
schemaVersion: LATEST_JOB_DATA_SCHEMA_VERSION,
142-
projectId,
143-
environment: RunEnvironment.PRODUCTION,
144-
flowVersionId: flowVersion.id,
145-
flowId: flowVersion.flowId,
146-
triggerType: TriggerType.BLOCK,
147-
jobType: RepeatableJobType.EXECUTE_TRIGGER,
148-
},
149-
scheduleOptions: engineHelperResponse.result.scheduleOptions,
150-
});
137+
138+
const scheduleOptions = engineHelperResponse.result.scheduleOptions;
139+
140+
await addBlockTriggerToQueue(projectId, flowVersion, scheduleOptions);
141+
142+
break;
143+
}
144+
case TriggerStrategy.SCHEDULED: {
145+
const scheduleOptions = engineHelperResponse.result.scheduleOptions;
146+
147+
if (isNil(scheduleOptions)) {
148+
throw new Error(
149+
'No schedule options set for trigger of Schedule type.',
150+
);
151+
}
152+
153+
await addBlockTriggerToQueue(projectId, flowVersion, scheduleOptions);
154+
151155
break;
152156
}
153157
}
@@ -160,3 +164,24 @@ type EnableParams = {
160164
flowVersion: FlowVersion;
161165
simulate: boolean;
162166
};
167+
168+
async function addBlockTriggerToQueue(
169+
projectId: string,
170+
flowVersion: FlowVersion,
171+
scheduleOptions: ScheduleOptions,
172+
): Promise<void> {
173+
await flowQueue.add({
174+
executionCorrelationId: flowVersion.id,
175+
type: JobType.REPEATING,
176+
data: {
177+
schemaVersion: LATEST_JOB_DATA_SCHEMA_VERSION,
178+
projectId,
179+
environment: RunEnvironment.PRODUCTION,
180+
flowVersionId: flowVersion.id,
181+
flowId: flowVersion.flowId,
182+
triggerType: TriggerType.BLOCK,
183+
jobType: RepeatableJobType.EXECUTE_TRIGGER,
184+
},
185+
scheduleOptions,
186+
});
187+
}

0 commit comments

Comments
 (0)