Fix variable search for iterators (#14742)
Add specific search util for iterators. Also making workflow version id optional in compute step output schema endpoint to avoid breaking changes on next release. Before https://github.com/user-attachments/assets/2ceb5b38-4c0a-4d38-8f57-0e4467dcfd93 After https://github.com/user-attachments/assets/3ce503ac-5299-4bca-906f-e0fef379df7c
This commit is contained in:
+11
-7
@@ -47,7 +47,7 @@ export class WorkflowSchemaWorkspaceService {
|
||||
}: {
|
||||
step: WorkflowTrigger | WorkflowAction;
|
||||
workspaceId: string;
|
||||
workflowVersionId: string;
|
||||
workflowVersionId?: string;
|
||||
}): Promise<OutputSchema> {
|
||||
const stepType = step.type;
|
||||
|
||||
@@ -108,8 +108,8 @@ export class WorkflowSchemaWorkspaceService {
|
||||
return {
|
||||
currentItem: await this.computeLoopCurrentItemOutputSchema({
|
||||
items,
|
||||
workflowVersionId,
|
||||
workspaceId,
|
||||
workflowVersionId,
|
||||
}),
|
||||
currentItemIndex: {
|
||||
label: 'Current Item Index',
|
||||
@@ -308,12 +308,12 @@ export class WorkflowSchemaWorkspaceService {
|
||||
|
||||
private async computeLoopCurrentItemOutputSchema({
|
||||
items,
|
||||
workflowVersionId,
|
||||
workspaceId,
|
||||
workflowVersionId,
|
||||
}: {
|
||||
items: string | undefined | unknown[];
|
||||
workflowVersionId: string;
|
||||
workspaceId: string;
|
||||
workflowVersionId?: string;
|
||||
}): Promise<Leaf | Node> {
|
||||
if (!isDefined(items)) {
|
||||
return DEFAULT_ITERATOR_CURRENT_ITEM;
|
||||
@@ -322,8 +322,8 @@ export class WorkflowSchemaWorkspaceService {
|
||||
if (isString(items) && isValidVariable(items)) {
|
||||
return this.computeIteratorCurrentItemFromVariable({
|
||||
items,
|
||||
workflowVersionId,
|
||||
workspaceId,
|
||||
workflowVersionId,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -332,13 +332,17 @@ export class WorkflowSchemaWorkspaceService {
|
||||
|
||||
private async computeIteratorCurrentItemFromVariable({
|
||||
items,
|
||||
workflowVersionId,
|
||||
workspaceId,
|
||||
workflowVersionId,
|
||||
}: {
|
||||
items: string;
|
||||
workflowVersionId: string;
|
||||
workspaceId: string;
|
||||
workflowVersionId?: string;
|
||||
}): Promise<Leaf | Node> {
|
||||
if (!isDefined(workflowVersionId)) {
|
||||
return DEFAULT_ITERATOR_CURRENT_ITEM;
|
||||
}
|
||||
|
||||
const workflowVersion =
|
||||
await this.workflowCommonWorkspaceService.getWorkflowVersionOrFail({
|
||||
workflowVersionId,
|
||||
|
||||
Reference in New Issue
Block a user