PR comment followups (isNonEmptyString and rename WorkflowExecutionResult) (#13706)

Addressing two comments from Thomas and Charles
This commit is contained in:
Félix Malfait
2025-08-06 22:09:30 +02:00
committed by GitHub
parent eab72d8e67
commit 453a6167a5
8 changed files with 25 additions and 22 deletions
@@ -1,7 +1,7 @@
import {
ExecutionStatus,
WorkflowExecutionResult,
} from '@/workflow/components/WorkflowExecutionResult';
WorkflowStepExecutionResult,
} from '@/workflow/components/WorkflowStepExecutionResult';
import { ServerlessFunctionTestData } from '@/workflow/states/serverlessFunctionTestDataFamilyState';
import { ServerlessFunctionExecutionStatus } from '~/generated-metadata/graphql';
@@ -37,7 +37,7 @@ export const ServerlessFunctionExecutionResult = ({
};
return (
<WorkflowExecutionResult
<WorkflowStepExecutionResult
result={result}
language={serverlessFunctionTestData.language}
height={serverlessFunctionTestData.height}
@@ -57,7 +57,7 @@ export type ExecutionStatus = {
additionalInfo?: string;
};
type WorkflowExecutionResultProps = {
type WorkflowStepExecutionResultProps = {
result: string;
language: 'plaintext' | 'json';
height?: string | number;
@@ -67,7 +67,7 @@ type WorkflowExecutionResultProps = {
idleMessage?: string;
};
export const WorkflowExecutionResult = ({
export const WorkflowStepExecutionResult = ({
result,
language,
height = '100%',
@@ -75,7 +75,7 @@ export const WorkflowExecutionResult = ({
isTesting = false,
loadingMessage = 'Processing...',
idleMessage = 'Output',
}: WorkflowExecutionResultProps) => {
}: WorkflowStepExecutionResultProps) => {
const theme = useTheme();
const SuccessLeftNode = (
@@ -4,11 +4,11 @@ import { ComponentDecorator } from 'twenty-ui/testing';
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
import { SnackBarDecorator } from '~/testing/decorators/SnackBarDecorator';
import { WorkflowExecutionResult } from '@/workflow/components/WorkflowExecutionResult';
import { WorkflowStepExecutionResult } from '@/workflow/components/WorkflowStepExecutionResult';
const meta: Meta<typeof WorkflowExecutionResult> = {
title: 'Modules/Workflow/Components/ExecutionResult',
component: WorkflowExecutionResult,
const meta: Meta<typeof WorkflowStepExecutionResult> = {
title: 'Modules/Workflow/Components/StepExecutionResult',
component: WorkflowStepExecutionResult,
decorators: [ComponentDecorator, SnackBarDecorator, I18nFrontDecorator],
args: {
result: JSON.stringify(
@@ -29,7 +29,7 @@ const meta: Meta<typeof WorkflowExecutionResult> = {
};
export default meta;
type Story = StoryObj<typeof WorkflowExecutionResult>;
type Story = StoryObj<typeof WorkflowStepExecutionResult>;
export const Idle: Story = {
args: {
@@ -1,7 +1,7 @@
import {
ExecutionStatus,
WorkflowExecutionResult,
} from '@/workflow/components/WorkflowExecutionResult';
WorkflowStepExecutionResult,
} from '@/workflow/components/WorkflowStepExecutionResult';
import type { HttpRequestTestData } from '@/workflow/workflow-steps/workflow-actions/http-request-action/types/HttpRequestTestData';
export const HttpRequestExecutionResult = ({
@@ -51,7 +51,7 @@ export const HttpRequestExecutionResult = ({
};
return (
<WorkflowExecutionResult
<WorkflowStepExecutionResult
result={result}
language={httpRequestTestData.language}
height="100%"
@@ -1,6 +1,7 @@
import { HttpService } from '@nestjs/axios';
import { Injectable } from '@nestjs/common';
import { isNonEmptyString } from '@sniptt/guards';
import { isDefined } from 'twenty-shared/utils';
import {
@@ -37,13 +38,13 @@ export class GeoMapService {
country?: string,
isFieldCity?: boolean,
): Promise<AutocompleteSanitizedResult[] | undefined> {
if (!isDefined(address) || address.trim().length === 0) {
if (!isNonEmptyString(address?.trim())) {
return [];
}
let url = `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${encodeURIComponent(address)}&sessiontoken=${token}&key=${this.apiMapKey}`;
if (isDefined(country) && country !== '') {
if (isNonEmptyString(country)) {
url += `&components=country:${country}`;
}
if (isDefined(isFieldCity) && isFieldCity === true) {
@@ -1,7 +1,8 @@
import { isNonEmptyString } from '@sniptt/guards';
import { ValidateIf, ValidationOptions, isDefined } from 'class-validator';
export function IsOptionalOrEmptyString(validationOptions?: ValidationOptions) {
return ValidateIf((_obj, value) => {
return isDefined(value) && value !== '';
return isDefined(value) && isNonEmptyString(value);
}, validationOptions);
}
@@ -1,5 +1,7 @@
import { Injectable } from '@nestjs/common';
import { isNonEmptyString } from '@sniptt/guards';
import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
import {
MessageImportDriverException,
@@ -47,7 +49,7 @@ export class MicrosoftEmailAliasManagerService {
})
// @ts-expect-error legacy noImplicitAny
.filter((address) => {
return address !== '';
return isNonEmptyString(address);
}) || [];
return handleAliases;
@@ -150,10 +150,9 @@ export class CreateCompanyAndContactService {
filteredContactsToCreateWithCompanyDomainNames.map((contact) => ({
handle: contact.handle,
displayName: contact.displayName,
companyId:
contact.companyDomainName && contact.companyDomainName !== ''
? companiesObject[contact.companyDomainName]
: undefined,
companyId: isNonEmptyString(contact.companyDomainName)
? companiesObject[contact.companyDomainName]
: undefined,
createdBySource: source,
createdByWorkspaceMember: connectedAccount.accountOwner,
createdByContext: {