-
Notifications
You must be signed in to change notification settings - Fork 264
fix: fixed exceptions that were throws for cf on unsupported flows & … #3466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // eslint-disable-next-line import/no-cycle | ||
| import { WorkflowModule } from '@/workflow/workflow.module'; | ||
| import { forwardRef, Module } from '@nestjs/common'; | ||
| import { CollectionFlowUtilityService } from './collection-flow-utility.service'; | ||
| import { UiDefinitionModule } from '@/ui-definition/ui-definition.module'; | ||
|
|
||
| @Module({ | ||
| imports: [ | ||
| // eslint-disable-next-line import/no-cycle | ||
| forwardRef(() => WorkflowModule), | ||
| UiDefinitionModule, | ||
| ], | ||
| providers: [CollectionFlowUtilityService], | ||
| exports: [CollectionFlowUtilityService], | ||
| }) | ||
| export class CollectionFlowUtilityModule {} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { isPrismaException } from '@/common/is-prisma-exception/is-prisma-exception'; | ||
| import { TProjectIds } from '@/types'; | ||
| import { UiDefinitionService } from '@/ui-definition/ui-definition.service'; | ||
| import { WorkflowService } from '@/workflow/workflow.service'; | ||
| import { forwardRef, Inject, Injectable } from '@nestjs/common'; | ||
|
|
||
| @Injectable() | ||
| export class CollectionFlowUtilityService { | ||
| constructor( | ||
| @Inject(forwardRef(() => WorkflowService)) | ||
| protected readonly workflowService: WorkflowService, | ||
| protected readonly uiDefinitionService: UiDefinitionService, | ||
| ) {} | ||
|
|
||
| async isCollectionFlowStateSupported(workflowId: string, projectIds: TProjectIds) { | ||
| const workflowDefinition = await this.workflowService.getWorkflowByIdWithRelations( | ||
| workflowId, | ||
| projectIds, | ||
| ); | ||
|
|
||
| try { | ||
| await this.uiDefinitionService.getByWorkflowDefinitionId( | ||
| workflowDefinition.workflowDefinitionId, | ||
| 'collection_flow', | ||
| projectIds, | ||
| ); | ||
|
|
||
| return true; | ||
| } catch (error) { | ||
| if (isPrismaException(error) && error.code === 'P2025') { | ||
| return false; | ||
| } | ||
|
|
||
| throw error; | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+1
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Fix directory name with Cyrillic character. Same issue as the module file - the directory name contains a Cyrillic 'с' instead of Latin 'c' in "сollection-flow-utility". Rename the directory from 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import { isType } from '@ballerine/common'; | ||
| import { PrismaClientKnownRequestError } from '@prisma/client/runtime'; | ||
| import { z } from 'zod'; | ||
|
|
||
| export const isPrismaException = (value: unknown): value is PrismaClientKnownRequestError => | ||
| isType(z.object({ code: z.string() }))(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Fix directory name with Cyrillic character.
The directory name contains a Cyrillic 'с' instead of Latin 'c' in "сollection-flow-utility". This can cause serious issues with:
Rename the directory from
сollection-flow-utilitytocollection-flow-utility(using Latin 'c').The module structure itself is correct with proper handling of circular dependencies using
forwardRef.🤖 Prompt for AI Agents