Search variables - finish the search by step type (#14046)

- Add a specific search and type for find records step. Will be mainly
useful when we start fetching list of records
- Same for forms
This commit is contained in:
Thomas Trompette
2025-08-25 15:48:12 +02:00
committed by GitHub
parent 97e5f06ff9
commit 293cf0be39
14 changed files with 1528 additions and 5 deletions
@@ -1,9 +1,16 @@
import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow';
import { useWorkflowVersionIdOrThrow } from '@/workflow/hooks/useWorkflowVersionIdOrThrow';
import { stepsOutputSchemaFamilySelector } from '@/workflow/states/selectors/stepsOutputSchemaFamilySelector';
import type { BaseOutputSchemaV2 } from '@/workflow/workflow-variables/types/BaseOutputSchemaV2';
import type { CodeOutputSchema } from '@/workflow/workflow-variables/types/CodeOutputSchema';
import type { FindRecordsOutputSchema } from '@/workflow/workflow-variables/types/FindRecordsOutputSchema';
import type { FormOutputSchema } from '@/workflow/workflow-variables/types/FormOutputSchema';
import { type RecordOutputSchemaV2 } from '@/workflow/workflow-variables/types/RecordOutputSchemaV2';
import { getOutputSchemaType } from '@/workflow/workflow-variables/utils/getOutputSchemaType';
import { searchVariableThroughOutputSchema } from '@/workflow/workflow-variables/utils/searchVariableThroughOutputSchema';
import { searchVariableThroughBaseOutputSchema } from '@/workflow/workflow-variables/utils/searchVariableThroughBaseOutputSchema';
import { searchVariableThroughCodeOutputSchema } from '@/workflow/workflow-variables/utils/searchVariableThroughCodeOutputSchema';
import { searchVariableThroughFindRecordsOutputSchema } from '@/workflow/workflow-variables/utils/searchVariableThroughFindRecordsOutputSchema';
import { searchVariableThroughFormOutputSchema } from '@/workflow/workflow-variables/utils/searchVariableThroughFormOutputSchema';
import { searchVariableThroughRecordEventOutputSchema } from '@/workflow/workflow-variables/utils/searchVariableThroughRecordEventOutputSchema';
import { searchVariableThroughRecordOutputSchema } from '@/workflow/workflow-variables/utils/searchVariableThroughRecordOutputSchema';
import { useRecoilValue } from 'recoil';
@@ -67,9 +74,39 @@ export const useSearchVariable = ({
});
}
// TODO: remove old search once all schema types are handled
return searchVariableThroughOutputSchema({
stepOutputSchema,
if (outputSchemaType === 'FIND_RECORDS') {
return searchVariableThroughFindRecordsOutputSchema({
stepName: stepOutputSchema.name,
searchRecordOutputSchema:
stepOutputSchema.outputSchema as unknown as FindRecordsOutputSchema,
rawVariableName,
isFullRecord,
});
}
if (outputSchemaType === 'FORM') {
return searchVariableThroughFormOutputSchema({
stepName: stepOutputSchema.name,
formOutputSchema:
stepOutputSchema.outputSchema as unknown as FormOutputSchema,
rawVariableName,
isFullRecord,
});
}
if (outputSchemaType === 'CODE') {
return searchVariableThroughCodeOutputSchema({
stepName: stepOutputSchema.name,
codeOutputSchema:
stepOutputSchema.outputSchema as unknown as CodeOutputSchema,
rawVariableName,
isFullRecord,
});
}
return searchVariableThroughBaseOutputSchema({
stepName: stepOutputSchema.name,
baseOutputSchema: stepOutputSchema.outputSchema as BaseOutputSchemaV2,
rawVariableName,
isFullRecord,
});