Fix use as draft (#9718)
- remove delete serverless function when archiving workflow version - update copy serverless function to reset serverless function to old version - remove createNewWorkflowVersion and use createDraftFromWorkflowVersion - fix step update issue and optimistic rendering when generate draft from active version
This commit is contained in:
@ -551,7 +551,7 @@ export type Mutation = {
|
||||
challenge: LoginToken;
|
||||
checkoutSession: SessionEntity;
|
||||
computeStepOutputSchema: Scalars['JSON']['output'];
|
||||
createDraftFromWorkflowVersion: Scalars['Boolean']['output'];
|
||||
createDraftFromWorkflowVersion: WorkflowVersion;
|
||||
createOIDCIdentityProvider: SetupSsoOutput;
|
||||
createOneAppToken: AppToken;
|
||||
createOneField: Field;
|
||||
@ -1711,6 +1711,11 @@ export type WorkflowRun = {
|
||||
workflowRunId: Scalars['UUID']['output'];
|
||||
};
|
||||
|
||||
export type WorkflowVersion = {
|
||||
__typename?: 'WorkflowVersion';
|
||||
workflowVersionId: Scalars['UUID']['output'];
|
||||
};
|
||||
|
||||
export type Workspace = {
|
||||
__typename?: 'Workspace';
|
||||
activationStatus: WorkspaceActivationStatus;
|
||||
|
||||
@ -477,7 +477,7 @@ export type Mutation = {
|
||||
challenge: LoginToken;
|
||||
checkoutSession: SessionEntity;
|
||||
computeStepOutputSchema: Scalars['JSON'];
|
||||
createDraftFromWorkflowVersion: Scalars['Boolean'];
|
||||
createDraftFromWorkflowVersion: WorkflowVersion;
|
||||
createOIDCIdentityProvider: SetupSsoOutput;
|
||||
createOneAppToken: AppToken;
|
||||
createOneField: Field;
|
||||
@ -1508,6 +1508,11 @@ export type WorkflowRun = {
|
||||
workflowRunId: Scalars['UUID'];
|
||||
};
|
||||
|
||||
export type WorkflowVersion = {
|
||||
__typename?: 'WorkflowVersion';
|
||||
id: Scalars['UUID'];
|
||||
};
|
||||
|
||||
export type Workspace = {
|
||||
__typename?: 'Workspace';
|
||||
activationStatus: WorkspaceActivationStatus;
|
||||
@ -2131,6 +2136,13 @@ export type ComputeStepOutputSchemaMutationVariables = Exact<{
|
||||
|
||||
export type ComputeStepOutputSchemaMutation = { __typename?: 'Mutation', computeStepOutputSchema: any };
|
||||
|
||||
export type CreateDraftFromWorkflowVersionMutationVariables = Exact<{
|
||||
input: CreateDraftFromWorkflowVersionInput;
|
||||
}>;
|
||||
|
||||
|
||||
export type CreateDraftFromWorkflowVersionMutation = { __typename?: 'Mutation', createDraftFromWorkflowVersion: { __typename?: 'WorkflowVersion', id: any } };
|
||||
|
||||
export type CreateWorkflowVersionStepMutationVariables = Exact<{
|
||||
input: CreateWorkflowVersionStepInput;
|
||||
}>;
|
||||
@ -2152,13 +2164,6 @@ export type DeleteWorkflowVersionStepMutationVariables = Exact<{
|
||||
|
||||
export type DeleteWorkflowVersionStepMutation = { __typename?: 'Mutation', deleteWorkflowVersionStep: { __typename?: 'WorkflowAction', id: any, name: string, type: string, settings: any, valid: boolean } };
|
||||
|
||||
export type CreateDraftFromWorkflowVersionMutationVariables = Exact<{
|
||||
input: CreateDraftFromWorkflowVersionInput;
|
||||
}>;
|
||||
|
||||
|
||||
export type CreateDraftFromWorkflowVersionMutation = { __typename?: 'Mutation', createDraftFromWorkflowVersion: boolean };
|
||||
|
||||
export type RunWorkflowVersionMutationVariables = Exact<{
|
||||
input: RunWorkflowVersionInput;
|
||||
}>;
|
||||
@ -4092,6 +4097,39 @@ export function useComputeStepOutputSchemaMutation(baseOptions?: Apollo.Mutation
|
||||
export type ComputeStepOutputSchemaMutationHookResult = ReturnType<typeof useComputeStepOutputSchemaMutation>;
|
||||
export type ComputeStepOutputSchemaMutationResult = Apollo.MutationResult<ComputeStepOutputSchemaMutation>;
|
||||
export type ComputeStepOutputSchemaMutationOptions = Apollo.BaseMutationOptions<ComputeStepOutputSchemaMutation, ComputeStepOutputSchemaMutationVariables>;
|
||||
export const CreateDraftFromWorkflowVersionDocument = gql`
|
||||
mutation CreateDraftFromWorkflowVersion($input: CreateDraftFromWorkflowVersionInput!) {
|
||||
createDraftFromWorkflowVersion(input: $input) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
export type CreateDraftFromWorkflowVersionMutationFn = Apollo.MutationFunction<CreateDraftFromWorkflowVersionMutation, CreateDraftFromWorkflowVersionMutationVariables>;
|
||||
|
||||
/**
|
||||
* __useCreateDraftFromWorkflowVersionMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useCreateDraftFromWorkflowVersionMutation` within a React component and pass it any options that fit your needs.
|
||||
* When your component renders, `useCreateDraftFromWorkflowVersionMutation` returns a tuple that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - An object with fields that represent the current status of the mutation's execution
|
||||
*
|
||||
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
|
||||
*
|
||||
* @example
|
||||
* const [createDraftFromWorkflowVersionMutation, { data, loading, error }] = useCreateDraftFromWorkflowVersionMutation({
|
||||
* variables: {
|
||||
* input: // value for 'input'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useCreateDraftFromWorkflowVersionMutation(baseOptions?: Apollo.MutationHookOptions<CreateDraftFromWorkflowVersionMutation, CreateDraftFromWorkflowVersionMutationVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useMutation<CreateDraftFromWorkflowVersionMutation, CreateDraftFromWorkflowVersionMutationVariables>(CreateDraftFromWorkflowVersionDocument, options);
|
||||
}
|
||||
export type CreateDraftFromWorkflowVersionMutationHookResult = ReturnType<typeof useCreateDraftFromWorkflowVersionMutation>;
|
||||
export type CreateDraftFromWorkflowVersionMutationResult = Apollo.MutationResult<CreateDraftFromWorkflowVersionMutation>;
|
||||
export type CreateDraftFromWorkflowVersionMutationOptions = Apollo.BaseMutationOptions<CreateDraftFromWorkflowVersionMutation, CreateDraftFromWorkflowVersionMutationVariables>;
|
||||
export const CreateWorkflowVersionStepDocument = gql`
|
||||
mutation CreateWorkflowVersionStep($input: CreateWorkflowVersionStepInput!) {
|
||||
createWorkflowVersionStep(input: $input) {
|
||||
@ -4197,37 +4235,6 @@ export function useDeleteWorkflowVersionStepMutation(baseOptions?: Apollo.Mutati
|
||||
export type DeleteWorkflowVersionStepMutationHookResult = ReturnType<typeof useDeleteWorkflowVersionStepMutation>;
|
||||
export type DeleteWorkflowVersionStepMutationResult = Apollo.MutationResult<DeleteWorkflowVersionStepMutation>;
|
||||
export type DeleteWorkflowVersionStepMutationOptions = Apollo.BaseMutationOptions<DeleteWorkflowVersionStepMutation, DeleteWorkflowVersionStepMutationVariables>;
|
||||
export const CreateDraftFromWorkflowVersionDocument = gql`
|
||||
mutation CreateDraftFromWorkflowVersion($input: CreateDraftFromWorkflowVersionInput!) {
|
||||
createDraftFromWorkflowVersion(input: $input)
|
||||
}
|
||||
`;
|
||||
export type CreateDraftFromWorkflowVersionMutationFn = Apollo.MutationFunction<CreateDraftFromWorkflowVersionMutation, CreateDraftFromWorkflowVersionMutationVariables>;
|
||||
|
||||
/**
|
||||
* __useCreateDraftFromWorkflowVersionMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useCreateDraftFromWorkflowVersionMutation` within a React component and pass it any options that fit your needs.
|
||||
* When your component renders, `useCreateDraftFromWorkflowVersionMutation` returns a tuple that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - An object with fields that represent the current status of the mutation's execution
|
||||
*
|
||||
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
|
||||
*
|
||||
* @example
|
||||
* const [createDraftFromWorkflowVersionMutation, { data, loading, error }] = useCreateDraftFromWorkflowVersionMutation({
|
||||
* variables: {
|
||||
* input: // value for 'input'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useCreateDraftFromWorkflowVersionMutation(baseOptions?: Apollo.MutationHookOptions<CreateDraftFromWorkflowVersionMutation, CreateDraftFromWorkflowVersionMutationVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useMutation<CreateDraftFromWorkflowVersionMutation, CreateDraftFromWorkflowVersionMutationVariables>(CreateDraftFromWorkflowVersionDocument, options);
|
||||
}
|
||||
export type CreateDraftFromWorkflowVersionMutationHookResult = ReturnType<typeof useCreateDraftFromWorkflowVersionMutation>;
|
||||
export type CreateDraftFromWorkflowVersionMutationResult = Apollo.MutationResult<CreateDraftFromWorkflowVersionMutation>;
|
||||
export type CreateDraftFromWorkflowVersionMutationOptions = Apollo.BaseMutationOptions<CreateDraftFromWorkflowVersionMutation, CreateDraftFromWorkflowVersionMutationVariables>;
|
||||
export const RunWorkflowVersionDocument = gql`
|
||||
mutation RunWorkflowVersion($input: RunWorkflowVersionInput!) {
|
||||
runWorkflowVersion(input: $input) {
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const OVERRIDE_WORKFLOW_DRAFT_VERSION = gql`
|
||||
export const CREATE_DRAFT_FROM_WORKFLOW_VERSION = gql`
|
||||
mutation CreateDraftFromWorkflowVersion(
|
||||
$input: CreateDraftFromWorkflowVersionInput!
|
||||
) {
|
||||
createDraftFromWorkflowVersion(input: $input)
|
||||
createDraftFromWorkflowVersion(input: $input) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -1,36 +0,0 @@
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
||||
import { WorkflowVersion } from '@/workflow/types/Workflow';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { useCreateNewWorkflowVersion } from '../useCreateNewWorkflowVersion';
|
||||
|
||||
jest.mock('@/object-record/hooks/useCreateOneRecord', () => ({
|
||||
useCreateOneRecord: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('useCreateNewWorkflowVersion', () => {
|
||||
it('should create workflow version', async () => {
|
||||
const mockCreateOneRecord = jest.fn();
|
||||
(useCreateOneRecord as jest.Mock).mockImplementation(() => ({
|
||||
createOneRecord: mockCreateOneRecord,
|
||||
}));
|
||||
|
||||
const workflowVersionData = {
|
||||
workflowId: '123',
|
||||
name: 'Test Version',
|
||||
status: 'draft',
|
||||
trigger: { type: 'manual' },
|
||||
steps: [],
|
||||
};
|
||||
|
||||
const { result } = renderHook(() => useCreateNewWorkflowVersion());
|
||||
await result.current.createNewWorkflowVersion(
|
||||
workflowVersionData as unknown as WorkflowVersion,
|
||||
);
|
||||
|
||||
expect(useCreateOneRecord).toHaveBeenCalledWith({
|
||||
objectNameSingular: CoreObjectNameSingular.WorkflowVersion,
|
||||
});
|
||||
expect(mockCreateOneRecord).toHaveBeenCalledWith(workflowVersionData);
|
||||
});
|
||||
});
|
||||
@ -2,21 +2,11 @@ import { renderHook } from '@testing-library/react';
|
||||
import { useGetUpdatableWorkflowVersion } from '@/workflow/hooks/useGetUpdatableWorkflowVersion';
|
||||
import { WorkflowWithCurrentVersion } from '@/workflow/types/Workflow';
|
||||
|
||||
const mockCreateNewWorkflowVersion = jest.fn().mockResolvedValue({
|
||||
id: '457',
|
||||
name: 'toto',
|
||||
createdAt: '2024-07-03T20:03:35.064Z',
|
||||
updatedAt: '2024-07-03T20:03:35.064Z',
|
||||
workflowId: '123',
|
||||
__typename: 'WorkflowVersion',
|
||||
status: 'DRAFT',
|
||||
steps: [],
|
||||
trigger: null,
|
||||
});
|
||||
const mockCreateDraftFromWorkflowVersion = jest.fn().mockResolvedValue('457');
|
||||
|
||||
jest.mock('@/workflow/hooks/useCreateNewWorkflowVersion', () => ({
|
||||
useCreateNewWorkflowVersion: () => ({
|
||||
createNewWorkflowVersion: mockCreateNewWorkflowVersion,
|
||||
jest.mock('@/workflow/hooks/useCreateDraftFromWorkflowVersion', () => ({
|
||||
useCreateDraftFromWorkflowVersion: () => ({
|
||||
createDraftFromWorkflowVersion: mockCreateDraftFromWorkflowVersion,
|
||||
}),
|
||||
}));
|
||||
|
||||
@ -44,19 +34,19 @@ describe('useGetUpdatableWorkflowVersion', () => {
|
||||
|
||||
it('should not create workflow version if draft version exists', async () => {
|
||||
const { result } = renderHook(() => useGetUpdatableWorkflowVersion());
|
||||
const workflowVersion = await result.current.getUpdatableWorkflowVersion(
|
||||
const workflowVersionId = await result.current.getUpdatableWorkflowVersion(
|
||||
mockWorkflow('DRAFT'),
|
||||
);
|
||||
expect(mockCreateNewWorkflowVersion).not.toHaveBeenCalled();
|
||||
expect(workflowVersion.id === '456');
|
||||
expect(mockCreateDraftFromWorkflowVersion).not.toHaveBeenCalled();
|
||||
expect(workflowVersionId).toEqual('456');
|
||||
});
|
||||
|
||||
it('should create workflow version if no draft version exists', async () => {
|
||||
const { result } = renderHook(() => useGetUpdatableWorkflowVersion());
|
||||
const workflowVersion = await result.current.getUpdatableWorkflowVersion(
|
||||
const workflowVersionId = await result.current.getUpdatableWorkflowVersion(
|
||||
mockWorkflow('ACTIVE'),
|
||||
);
|
||||
expect(mockCreateNewWorkflowVersion).toHaveBeenCalled();
|
||||
expect(workflowVersion.id === '457');
|
||||
expect(mockCreateDraftFromWorkflowVersion).toHaveBeenCalled();
|
||||
expect(workflowVersionId).toEqual('457');
|
||||
});
|
||||
});
|
||||
|
||||
@ -28,7 +28,7 @@ export const useCreateDraftFromWorkflowVersion = () => {
|
||||
const createDraftFromWorkflowVersion = async (
|
||||
input: CreateDraftFromWorkflowVersionInput,
|
||||
) => {
|
||||
await mutate({
|
||||
const result = await mutate({
|
||||
variables: { input },
|
||||
awaitRefetchQueries: true,
|
||||
refetchQueries: [
|
||||
@ -40,6 +40,8 @@ export const useCreateDraftFromWorkflowVersion = () => {
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
return result?.data?.createDraftFromWorkflowVersion.id;
|
||||
};
|
||||
|
||||
return {
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { useCreateOneRecord } from '@/object-record/hooks/useCreateOneRecord';
|
||||
import { WorkflowVersion } from '@/workflow/types/Workflow';
|
||||
|
||||
export const useCreateNewWorkflowVersion = () => {
|
||||
const { createOneRecord: createOneWorkflowVersion } =
|
||||
useCreateOneRecord<WorkflowVersion>({
|
||||
objectNameSingular: CoreObjectNameSingular.WorkflowVersion,
|
||||
});
|
||||
|
||||
const createNewWorkflowVersion = async (
|
||||
workflowVersionData: Pick<
|
||||
WorkflowVersion,
|
||||
'workflowId' | 'name' | 'status' | 'trigger' | 'steps'
|
||||
>,
|
||||
) => {
|
||||
return await createOneWorkflowVersion(workflowVersionData);
|
||||
};
|
||||
|
||||
return {
|
||||
createNewWorkflowVersion,
|
||||
};
|
||||
};
|
||||
@ -1,21 +1,18 @@
|
||||
import { WorkflowWithCurrentVersion } from '@/workflow/types/Workflow';
|
||||
import { useCreateNewWorkflowVersion } from '@/workflow/hooks/useCreateNewWorkflowVersion';
|
||||
import { useCreateDraftFromWorkflowVersion } from '@/workflow/hooks/useCreateDraftFromWorkflowVersion';
|
||||
|
||||
export const useGetUpdatableWorkflowVersion = () => {
|
||||
const { createNewWorkflowVersion } = useCreateNewWorkflowVersion();
|
||||
const { createDraftFromWorkflowVersion } =
|
||||
useCreateDraftFromWorkflowVersion();
|
||||
const getUpdatableWorkflowVersion = async (
|
||||
workflow: WorkflowWithCurrentVersion,
|
||||
) => {
|
||||
if (workflow.currentVersion.status === 'DRAFT') {
|
||||
return workflow.currentVersion;
|
||||
return workflow.currentVersion.id;
|
||||
}
|
||||
|
||||
return await createNewWorkflowVersion({
|
||||
return await createDraftFromWorkflowVersion({
|
||||
workflowId: workflow.id,
|
||||
name: `v${workflow.versions.length + 1}`,
|
||||
status: 'DRAFT',
|
||||
trigger: workflow.currentVersion.trigger,
|
||||
steps: workflow.currentVersion.steps,
|
||||
workflowVersionIdToCopy: workflow.currentVersion.id,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ import { renderHook } from '@testing-library/react';
|
||||
import { useCreateStep } from '../useCreateStep';
|
||||
|
||||
const mockOpenRightDrawer = jest.fn();
|
||||
const mockCreateNewWorkflowVersion = jest.fn();
|
||||
const mockCreateDraftFromWorkflowVersion = jest.fn().mockResolvedValue('457');
|
||||
const mockCreateWorkflowVersionStep = jest.fn().mockResolvedValue({
|
||||
data: { createWorkflowVersionStep: { id: '1' } },
|
||||
});
|
||||
@ -29,9 +29,9 @@ jest.mock(
|
||||
}),
|
||||
);
|
||||
|
||||
jest.mock('@/workflow/hooks/useCreateNewWorkflowVersion', () => ({
|
||||
useCreateNewWorkflowVersion: () => ({
|
||||
createNewWorkflowVersion: mockCreateNewWorkflowVersion,
|
||||
jest.mock('@/workflow/hooks/useCreateDraftFromWorkflowVersion', () => ({
|
||||
useCreateDraftFromWorkflowVersion: () => ({
|
||||
createDraftFromWorkflowVersion: mockCreateDraftFromWorkflowVersion,
|
||||
}),
|
||||
}));
|
||||
|
||||
|
||||
@ -4,9 +4,9 @@ import { renderHook } from '@testing-library/react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
|
||||
const mockCloseRightDrawer = jest.fn();
|
||||
const mockCreateNewWorkflowVersion = jest.fn();
|
||||
const mockDeleteWorkflowVersionStep = jest.fn();
|
||||
const updateOneRecordMock = jest.fn();
|
||||
const mockCreateDraftFromWorkflowVersion = jest.fn().mockResolvedValue('457');
|
||||
|
||||
jest.mock('@/object-record/hooks/useUpdateOneRecord', () => ({
|
||||
useUpdateOneRecord: () => ({
|
||||
@ -26,9 +26,9 @@ jest.mock('@/workflow/hooks/useDeleteWorkflowVersionStep', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock('@/workflow/hooks/useCreateNewWorkflowVersion', () => ({
|
||||
useCreateNewWorkflowVersion: () => ({
|
||||
createNewWorkflowVersion: mockCreateNewWorkflowVersion,
|
||||
jest.mock('@/workflow/hooks/useCreateDraftFromWorkflowVersion', () => ({
|
||||
useCreateDraftFromWorkflowVersion: () => ({
|
||||
createDraftFromWorkflowVersion: mockCreateDraftFromWorkflowVersion,
|
||||
}),
|
||||
}));
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@ import { WorkflowWithCurrentVersion } from '@/workflow/types/Workflow';
|
||||
import { useUpdateStep } from '@/workflow/workflow-steps/hooks/useUpdateStep';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
|
||||
const mockCreateNewWorkflowVersion = jest.fn();
|
||||
const mockUpdateWorkflowVersionStep = jest.fn();
|
||||
const mockCreateDraftFromWorkflowVersion = jest.fn().mockResolvedValue('457');
|
||||
|
||||
jest.mock('recoil', () => ({
|
||||
useRecoilValue: () => 'parent-step-id',
|
||||
@ -20,9 +20,9 @@ jest.mock(
|
||||
}),
|
||||
);
|
||||
|
||||
jest.mock('@/workflow/hooks/useCreateNewWorkflowVersion', () => ({
|
||||
useCreateNewWorkflowVersion: () => ({
|
||||
createNewWorkflowVersion: mockCreateNewWorkflowVersion,
|
||||
jest.mock('@/workflow/hooks/useCreateDraftFromWorkflowVersion', () => ({
|
||||
useCreateDraftFromWorkflowVersion: () => ({
|
||||
createDraftFromWorkflowVersion: mockCreateDraftFromWorkflowVersion,
|
||||
}),
|
||||
}));
|
||||
|
||||
|
||||
@ -35,11 +35,11 @@ export const useCreateStep = ({
|
||||
throw new Error('Select a step to create a new step from first.');
|
||||
}
|
||||
|
||||
const workflowVersion = await getUpdatableWorkflowVersion(workflow);
|
||||
const workflowVersionId = await getUpdatableWorkflowVersion(workflow);
|
||||
|
||||
const createdStep = (
|
||||
await createWorkflowVersionStep({
|
||||
workflowVersionId: workflowVersion.id,
|
||||
workflowVersionId,
|
||||
stepType: newStepType,
|
||||
})
|
||||
)?.data?.createWorkflowVersionStep;
|
||||
|
||||
@ -28,10 +28,10 @@ export const useDeleteStep = ({
|
||||
const deleteStep = async (stepId: string) => {
|
||||
closeRightDrawer();
|
||||
closeCommandMenu();
|
||||
const workflowVersion = await getUpdatableWorkflowVersion(workflow);
|
||||
const workflowVersionId = await getUpdatableWorkflowVersion(workflow);
|
||||
if (stepId === TRIGGER_STEP_ID) {
|
||||
await updateOneWorkflowVersion({
|
||||
idToUpdate: workflowVersion.id,
|
||||
idToUpdate: workflowVersionId,
|
||||
updateOneRecordInput: {
|
||||
trigger: null,
|
||||
},
|
||||
@ -39,7 +39,7 @@ export const useDeleteStep = ({
|
||||
return;
|
||||
}
|
||||
await deleteWorkflowVersionStep({
|
||||
workflowVersionId: workflowVersion.id,
|
||||
workflowVersionId,
|
||||
stepId,
|
||||
});
|
||||
};
|
||||
|
||||
@ -19,9 +19,10 @@ export const useUpdateStep = ({
|
||||
throw new Error('Can not update an undefined workflow version.');
|
||||
}
|
||||
|
||||
const workflowVersion = await getUpdatableWorkflowVersion(workflow);
|
||||
const workflowVersionId = await getUpdatableWorkflowVersion(workflow);
|
||||
|
||||
await updateWorkflowVersionStep({
|
||||
workflowVersionId: workflowVersion.id,
|
||||
workflowVersionId,
|
||||
step: updatedStep,
|
||||
});
|
||||
};
|
||||
|
||||
@ -28,7 +28,7 @@ export const useUpdateWorkflowVersionTrigger = ({
|
||||
throw new Error('Can not update an undefined workflow version.');
|
||||
}
|
||||
|
||||
const workflowVersion = await getUpdatableWorkflowVersion(workflow);
|
||||
const workflowVersionId = await getUpdatableWorkflowVersion(workflow);
|
||||
|
||||
const outputSchema = (
|
||||
await computeStepOutputSchema({
|
||||
@ -42,7 +42,7 @@ export const useUpdateWorkflowVersionTrigger = ({
|
||||
};
|
||||
|
||||
await updateOneWorkflowVersion({
|
||||
idToUpdate: workflowVersion.id,
|
||||
idToUpdate: workflowVersionId,
|
||||
updateOneRecordInput: {
|
||||
trigger: updatedTrigger,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user