Fix initial code step functionInput (#18002)
At code step creation ## before <img width="623" height="816" alt="image" src="https://github.com/user-attachments/assets/0aed5ed8-8d56-4988-9d31-fe80942191bb" /> ## after <img width="627" height="528" alt="image" src="https://github.com/user-attachments/assets/9e2a5cb9-7480-4734-8e41-25b45edcec07" />
This commit is contained in:
+2
-6
@@ -37,7 +37,7 @@ import { CODE_ACTION } from '@/workflow/workflow-steps/workflow-actions/constant
|
||||
import { type Monaco } from '@monaco-editor/react';
|
||||
import { type editor } from 'monaco-editor';
|
||||
import { AutoTypings } from 'monaco-editor-auto-typings';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useState } from 'react';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { Key } from 'ts-key-enum';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
@@ -49,7 +49,7 @@ import { IconCode, IconPlayerPlay } from 'twenty-ui/display';
|
||||
import { CodeEditor } from 'twenty-ui/input';
|
||||
import { useIsMobile } from 'twenty-ui/utilities';
|
||||
import { useDebouncedCallback } from 'use-debounce';
|
||||
import { getFunctionInputFromInputSchema } from '@/workflow/workflow-steps/workflow-actions/code-action/utils/getFunctionInputFromInputSchema';
|
||||
import { getFunctionInputFromInputSchema } from 'twenty-shared/workflow';
|
||||
|
||||
const CODE_EDITOR_MIN_HEIGHT = 343;
|
||||
|
||||
@@ -290,10 +290,6 @@ export const WorkflowEditActionCode = ({
|
||||
},
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
setFunctionInput(action.settings.input.logicFunctionInput);
|
||||
}, [action]);
|
||||
|
||||
useHotkeysOnFocusedElement({
|
||||
keys: [Key.Escape],
|
||||
callback: () => {
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { FormNestedFieldInputContainer } from '@/object-record/record-field/ui/f
|
||||
import { FormTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormTextFieldInput';
|
||||
import { type VariablePickerComponent } from '@/object-record/record-field/ui/form-types/types/VariablePickerComponent';
|
||||
import { InputLabel } from '@/ui/input/components/InputLabel';
|
||||
import { type FunctionInput } from '@/workflow/workflow-steps/workflow-actions/code-action/types/FunctionInput';
|
||||
import { type FunctionInput } from 'twenty-shared/workflow';
|
||||
import styled from '@emotion/styled';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { isObject } from '@sniptt/guards';
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { type FunctionInput } from '@/workflow/workflow-steps/workflow-actions/code-action/types/FunctionInput';
|
||||
import { type FunctionInput } from 'twenty-shared/workflow';
|
||||
import { isObject } from '@sniptt/guards';
|
||||
|
||||
export const mergeDefaultFunctionInputAndFunctionInput = ({
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
import { type InputSchemaPropertyType } from '@/workflow/types/InputSchema';
|
||||
import { type BaseOutputSchemaV2 } from 'twenty-shared/workflow';
|
||||
import {
|
||||
type InputSchemaPropertyType,
|
||||
type BaseOutputSchemaV2,
|
||||
} from 'twenty-shared/workflow';
|
||||
|
||||
const getValueType = (value: unknown): InputSchemaPropertyType => {
|
||||
if (value === null || value === undefined) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { getFunctionInputFromInputSchema } from '@/workflow/workflow-steps/workflow-actions/code-action/utils/getFunctionInputFromInputSchema';
|
||||
import { getFunctionInputFromInputSchema } from 'twenty-shared/workflow';
|
||||
import { mergeDefaultFunctionInputAndFunctionInput } from '@/workflow/workflow-steps/workflow-actions/code-action/utils/mergeDefaultFunctionInputAndFunctionInput';
|
||||
import { useGetOneLogicFunction } from '@/logic-functions/hooks/useGetOneLogicFunction';
|
||||
import { type WorkflowLogicFunctionAction } from '@/workflow/types/Workflow';
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { StyledDropdownButtonContainer } from '@/ui/layout/dropdown/components/S
|
||||
import { useCloseDropdown } from '@/ui/layout/dropdown/hooks/useCloseDropdown';
|
||||
import { isDropdownOpenComponentState } from '@/ui/layout/dropdown/states/isDropdownOpenComponentState';
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { type InputSchemaPropertyType } from '@/workflow/types/InputSchema';
|
||||
import { type InputSchemaPropertyType } from 'twenty-shared/workflow';
|
||||
import { WorkflowVariablesDropdownStepItems } from '@/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems';
|
||||
import { WorkflowVariablesDropdownSteps } from '@/workflow/workflow-variables/components/WorkflowVariablesDropdownSteps';
|
||||
import { SEARCH_VARIABLES_DROPDOWN_ID } from '@/workflow/workflow-variables/constants/SearchVariablesDropdownId';
|
||||
|
||||
+4
-2
@@ -1,14 +1,16 @@
|
||||
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
|
||||
import { useFlowOrThrow } from '@/workflow/hooks/useFlowOrThrow';
|
||||
import { stepsOutputSchemaFamilySelector } from '@/workflow/states/selectors/stepsOutputSchemaFamilySelector';
|
||||
import { type InputSchemaPropertyType } from '@/workflow/types/InputSchema';
|
||||
import {
|
||||
type InputSchemaPropertyType,
|
||||
TRIGGER_STEP_ID,
|
||||
} from 'twenty-shared/workflow';
|
||||
import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState';
|
||||
import { getPreviousSteps } from '@/workflow/workflow-steps/utils/getWorkflowPreviousSteps';
|
||||
import { type StepOutputSchemaV2 } from '@/workflow/workflow-variables/types/StepOutputSchemaV2';
|
||||
import { filterOutputSchema } from '@/workflow/workflow-variables/utils/filterOutputSchema';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { isDefined, isEmptyObject } from 'twenty-shared/utils';
|
||||
import { TRIGGER_STEP_ID } from 'twenty-shared/workflow';
|
||||
|
||||
export const useAvailableVariablesInWorkflowStep = ({
|
||||
shouldDisplayRecordFields,
|
||||
|
||||
+5
-2
@@ -1,4 +1,8 @@
|
||||
import { type InputSchemaPropertyType } from '@/workflow/types/InputSchema';
|
||||
import {
|
||||
type InputSchemaPropertyType,
|
||||
type BaseOutputSchemaV2,
|
||||
type Node,
|
||||
} from 'twenty-shared/workflow';
|
||||
import {
|
||||
type FieldOutputSchemaV2,
|
||||
type RecordOutputSchemaV2,
|
||||
@@ -9,7 +13,6 @@ import { isLinkOutputSchema } from '@/workflow/workflow-variables/types/guards/i
|
||||
import { isRecordOutputSchemaV2 } from '@/workflow/workflow-variables/types/guards/isRecordOutputSchemaV2';
|
||||
import { isFieldTypeCompatibleWithRecordId } from '@/workflow/workflow-variables/utils/isFieldTypeCompatibleWithRecordId';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { type BaseOutputSchemaV2, type Node } from 'twenty-shared/workflow';
|
||||
|
||||
const isValidRecordOutputSchema = ({
|
||||
shouldDisplayRecordFields,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { type InputSchemaPropertyType } from '@/workflow/types/InputSchema';
|
||||
import { type InputSchemaPropertyType } from 'twenty-shared/workflow';
|
||||
import { FieldMetadataType } from 'twenty-shared/types';
|
||||
|
||||
export const getStepItemIcon = ({
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { type InputSchemaPropertyType } from '@/workflow/types/InputSchema';
|
||||
import { type InputSchemaPropertyType } from 'twenty-shared/workflow';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const isFieldTypeCompatibleWithRecordId = (
|
||||
|
||||
@@ -26,10 +26,7 @@ const twentyUiIndividualIndex = path.resolve(
|
||||
'../../../twenty-ui/dist/individual/individual-entry.js',
|
||||
);
|
||||
|
||||
const sdkIndividualIndex = path.resolve(
|
||||
dirname,
|
||||
'../../dist/sdk/index.js',
|
||||
);
|
||||
const sdkIndividualIndex = path.resolve(dirname, '../../dist/sdk/index.js');
|
||||
|
||||
const twentySharedIndividualDir = path.resolve(
|
||||
dirname,
|
||||
@@ -107,19 +104,12 @@ type BundleSizeEntry = {
|
||||
const collectBundleSizes = (): BundleSizeEntry[] =>
|
||||
STORY_COMPONENTS.map((name) => {
|
||||
const reactFile = path.join(exampleSourcesBuiltDir, `${name}.mjs`);
|
||||
const preactFile = path.join(
|
||||
exampleSourcesBuiltPreactDir,
|
||||
`${name}.mjs`,
|
||||
);
|
||||
const preactFile = path.join(exampleSourcesBuiltPreactDir, `${name}.mjs`);
|
||||
|
||||
return {
|
||||
name,
|
||||
reactBytes: fs.existsSync(reactFile)
|
||||
? fs.statSync(reactFile).size
|
||||
: 0,
|
||||
preactBytes: fs.existsSync(preactFile)
|
||||
? fs.statSync(preactFile).size
|
||||
: 0,
|
||||
reactBytes: fs.existsSync(reactFile) ? fs.statSync(reactFile).size : 0,
|
||||
preactBytes: fs.existsSync(preactFile) ? fs.statSync(preactFile).size : 0,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
import { type ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
|
||||
import { type FirstDayOfTheWeek } from 'twenty-shared/utils';
|
||||
import {
|
||||
type FirstDayOfTheWeek,
|
||||
type ObjectRecordGroupByDateGranularity,
|
||||
} from 'twenty-shared/types';
|
||||
|
||||
import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type';
|
||||
|
||||
|
||||
+4
-2
@@ -1,5 +1,7 @@
|
||||
import { type ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
|
||||
import { type FirstDayOfTheWeek } from 'twenty-shared/utils';
|
||||
import {
|
||||
type ObjectRecordGroupByDateGranularity,
|
||||
type FirstDayOfTheWeek,
|
||||
} from 'twenty-shared/types';
|
||||
|
||||
export type DateFieldGroupByDefinition = {
|
||||
granularity: ObjectRecordGroupByDateGranularity;
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@ import {
|
||||
type ObjectRecordGroupByDateGranularity,
|
||||
type ObjectRecordOrderByForCompositeField,
|
||||
type ObjectRecordOrderByForScalarField,
|
||||
type FirstDayOfTheWeek,
|
||||
} from 'twenty-shared/types';
|
||||
import { type FirstDayOfTheWeek } from 'twenty-shared/utils';
|
||||
|
||||
export type ObjectRecordFilter = Partial<{
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
+5
-2
@@ -1,5 +1,8 @@
|
||||
import { type ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
|
||||
import { type FirstDayOfTheWeek, isDefined } from 'twenty-shared/utils';
|
||||
import {
|
||||
type ObjectRecordGroupByDateGranularity,
|
||||
type FirstDayOfTheWeek,
|
||||
} from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type';
|
||||
import { type GroupByRawResult } from 'src/modules/dashboard/chart-data/types/group-by-raw-result.type';
|
||||
|
||||
+5
-2
@@ -1,5 +1,8 @@
|
||||
import { type ObjectRecordGroupByDateGranularity } from 'twenty-shared/types';
|
||||
import { type FirstDayOfTheWeek, isDefined } from 'twenty-shared/utils';
|
||||
import {
|
||||
type ObjectRecordGroupByDateGranularity,
|
||||
type FirstDayOfTheWeek,
|
||||
} from 'twenty-shared/types';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { type FlatFieldMetadata } from 'src/engine/metadata-modules/flat-field-metadata/types/flat-field-metadata.type';
|
||||
import { type GroupByRawResult } from 'src/modules/dashboard/chart-data/types/group-by-raw-result.type';
|
||||
|
||||
+6
-1
@@ -9,6 +9,7 @@ import {
|
||||
import { isDefined, isValidUuid } from 'twenty-shared/utils';
|
||||
import {
|
||||
IF_ELSE_BRANCH_POSITION_OFFSETS,
|
||||
getFunctionInputFromInputSchema,
|
||||
type StepIfElseBranch,
|
||||
} from 'twenty-shared/workflow';
|
||||
import { Repository } from 'typeorm';
|
||||
@@ -181,7 +182,11 @@ export class WorkflowVersionStepOperationsWorkspaceService {
|
||||
},
|
||||
input: {
|
||||
logicFunctionId: newLogicFunction.id,
|
||||
logicFunctionInput: newLogicFunction.toolInputSchema ?? {},
|
||||
logicFunctionInput: isDefined(newLogicFunction.toolInputSchema)
|
||||
? (getFunctionInputFromInputSchema([
|
||||
newLogicFunction.toolInputSchema,
|
||||
])[0] ?? {})
|
||||
: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { getInputSchemaFromSourceCode } from '@/logic-function/get-input-schema-from-source-code';
|
||||
import { DEFAULT_TOOL_INPUT_SCHEMA } from '@/logic-function/constants/default-tool-input-schema';
|
||||
import { DEFAULT_TOOL_INPUT_SCHEMA } from '@/logic-function/constants/DefaultToolInputSchema';
|
||||
|
||||
describe('getInputSchemaFromSourceCode', () => {
|
||||
it('should return empty input if not parameter', async () => {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* |___/
|
||||
*/
|
||||
|
||||
export { DEFAULT_TOOL_INPUT_SCHEMA } from './constants/default-tool-input-schema';
|
||||
export { SEED_LOGIC_FUNCTION_INPUT_SCHEMA } from './constants/seed-logic-function-input-schema';
|
||||
export { DEFAULT_TOOL_INPUT_SCHEMA } from './constants/DefaultToolInputSchema';
|
||||
export { SEED_LOGIC_FUNCTION_INPUT_SCHEMA } from './constants/SeedLogicFunctionInputSchema';
|
||||
export { getInputSchemaFromSourceCode } from './get-input-schema-from-source-code';
|
||||
export { getOutputSchemaFromValue } from './get-output-schema-from-value';
|
||||
export type { InputJsonSchema } from './input-json-schema.type';
|
||||
|
||||
@@ -44,10 +44,7 @@ describe('turnJSDateToPlainDate', () => {
|
||||
describe('turnPlainDateIntoUserTimeZoneInstantString', () => {
|
||||
it('should convert a PlainDate to an instant string in the given timezone', () => {
|
||||
const plainDate = Temporal.PlainDate.from('2024-03-15');
|
||||
const result = turnPlainDateIntoUserTimeZoneInstantString(
|
||||
plainDate,
|
||||
'UTC',
|
||||
);
|
||||
const result = turnPlainDateIntoUserTimeZoneInstantString(plainDate, 'UTC');
|
||||
|
||||
expect(result).toBe('2024-03-15T00:00:00Z');
|
||||
});
|
||||
|
||||
+1
-3
@@ -3,9 +3,7 @@ import { Temporal } from 'temporal-polyfill';
|
||||
import { addUnitToZonedDateTime } from '@/utils/filter/dates/utils/addUnitToZonedDateTime';
|
||||
|
||||
describe('addUnitToZonedDateTime', () => {
|
||||
const baseZdt = Temporal.ZonedDateTime.from(
|
||||
'2024-03-15T12:00:00[UTC]',
|
||||
);
|
||||
const baseZdt = Temporal.ZonedDateTime.from('2024-03-15T12:00:00[UTC]');
|
||||
|
||||
it('should add days', () => {
|
||||
const result = addUnitToZonedDateTime(baseZdt, 'DAY', 3);
|
||||
|
||||
+4
-2
@@ -14,7 +14,8 @@ describe('relativeDateFilterStringifiedSchema', () => {
|
||||
});
|
||||
|
||||
it('should parse a valid NEXT filter string', () => {
|
||||
const result = relativeDateFilterStringifiedSchema.safeParse('NEXT_30_MINUTE');
|
||||
const result =
|
||||
relativeDateFilterStringifiedSchema.safeParse('NEXT_30_MINUTE');
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
|
||||
@@ -26,7 +27,8 @@ describe('relativeDateFilterStringifiedSchema', () => {
|
||||
});
|
||||
|
||||
it('should parse a THIS filter string', () => {
|
||||
const result = relativeDateFilterStringifiedSchema.safeParse('THIS_1_MONTH');
|
||||
const result =
|
||||
relativeDateFilterStringifiedSchema.safeParse('THIS_1_MONTH');
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
|
||||
|
||||
+1
-3
@@ -3,9 +3,7 @@ import { Temporal } from 'temporal-polyfill';
|
||||
import { resolveRelativeDateFilter } from '@/utils/filter/dates/utils/resolveRelativeDateFilter';
|
||||
|
||||
describe('resolveRelativeDateFilter', () => {
|
||||
const referenceZdt = Temporal.ZonedDateTime.from(
|
||||
'2024-03-15T12:00:00[UTC]',
|
||||
);
|
||||
const referenceZdt = Temporal.ZonedDateTime.from('2024-03-15T12:00:00[UTC]');
|
||||
|
||||
describe('NEXT direction', () => {
|
||||
it('should compute start and end for NEXT 7 DAY', () => {
|
||||
|
||||
+1
-3
@@ -3,9 +3,7 @@ import { Temporal } from 'temporal-polyfill';
|
||||
import { resolveRelativeDateTimeFilter } from '@/utils/filter/dates/utils/resolveRelativeDateTimeFilter';
|
||||
|
||||
describe('resolveRelativeDateTimeFilter', () => {
|
||||
const referenceZdt = Temporal.ZonedDateTime.from(
|
||||
'2024-03-15T12:00:00[UTC]',
|
||||
);
|
||||
const referenceZdt = Temporal.ZonedDateTime.from('2024-03-15T12:00:00[UTC]');
|
||||
|
||||
describe('NEXT direction', () => {
|
||||
it('should compute for sub-day unit (HOUR)', () => {
|
||||
|
||||
+1
-3
@@ -3,9 +3,7 @@ import { Temporal } from 'temporal-polyfill';
|
||||
import { subUnitFromZonedDateTime } from '@/utils/filter/dates/utils/subUnitFromZonedDateTime';
|
||||
|
||||
describe('subUnitFromZonedDateTime', () => {
|
||||
const baseZdt = Temporal.ZonedDateTime.from(
|
||||
'2024-03-15T12:00:00[UTC]',
|
||||
);
|
||||
const baseZdt = Temporal.ZonedDateTime.from('2024-03-15T12:00:00[UTC]');
|
||||
|
||||
it('should subtract days', () => {
|
||||
const result = subUnitFromZonedDateTime(baseZdt, 'DAY', 3);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { FirstDayOfTheWeek as FirstDayOfTheWeekEnum } from '@/types/FirstDayOfTheWeek';
|
||||
import { FirstDayOfTheWeek } from '@/types';
|
||||
import z from 'zod';
|
||||
|
||||
export const firstDayOfWeekSchema = z.enum([
|
||||
FirstDayOfTheWeekEnum.MONDAY,
|
||||
FirstDayOfTheWeekEnum.SATURDAY,
|
||||
FirstDayOfTheWeekEnum.SUNDAY,
|
||||
FirstDayOfTheWeek.MONDAY,
|
||||
FirstDayOfTheWeek.SATURDAY,
|
||||
FirstDayOfTheWeek.SUNDAY,
|
||||
]);
|
||||
|
||||
export type FirstDayOfTheWeek = z.infer<typeof firstDayOfWeekSchema>;
|
||||
export type FirstDayOfTheWeekSchema = z.infer<typeof firstDayOfWeekSchema>;
|
||||
|
||||
+6
-6
@@ -1,16 +1,16 @@
|
||||
import { FirstDayOfTheWeek as FirstDayOfTheWeekEnum } from '@/types/FirstDayOfTheWeek';
|
||||
import { FirstDayOfTheWeek } from '@/types';
|
||||
import { assertUnreachable } from '@/utils/assertUnreachable';
|
||||
import { type FirstDayOfTheWeek } from '@/utils/filter/dates/utils/firstDayOfWeekSchema';
|
||||
import { type FirstDayOfTheWeekSchema } from '@/utils/filter/dates/utils/firstDayOfWeekSchema';
|
||||
|
||||
export const getFirstDayOfTheWeekAsANumberForDateFNS = (
|
||||
firstDayOfTheWeek: FirstDayOfTheWeek,
|
||||
firstDayOfTheWeek: FirstDayOfTheWeekSchema,
|
||||
): 0 | 1 | 6 => {
|
||||
switch (firstDayOfTheWeek) {
|
||||
case FirstDayOfTheWeekEnum.MONDAY:
|
||||
case FirstDayOfTheWeek.MONDAY:
|
||||
return 1;
|
||||
case FirstDayOfTheWeekEnum.SATURDAY:
|
||||
case FirstDayOfTheWeek.SATURDAY:
|
||||
return 6;
|
||||
case FirstDayOfTheWeekEnum.SUNDAY:
|
||||
case FirstDayOfTheWeek.SUNDAY:
|
||||
return 0;
|
||||
default:
|
||||
return assertUnreachable(firstDayOfTheWeek);
|
||||
|
||||
+6
-6
@@ -1,16 +1,16 @@
|
||||
import { FirstDayOfTheWeek as FirstDayOfTheWeekEnum } from '@/types/FirstDayOfTheWeek';
|
||||
import { FirstDayOfTheWeek } from '@/types';
|
||||
import { assertUnreachable } from '@/utils/assertUnreachable';
|
||||
import { type FirstDayOfTheWeek } from '@/utils/filter/dates/utils/firstDayOfWeekSchema';
|
||||
import { type FirstDayOfTheWeekSchema } from '@/utils/filter/dates/utils/firstDayOfWeekSchema';
|
||||
|
||||
export const getFirstDayOfTheWeekAsISONumber = (
|
||||
firstDayOfTheWeek: FirstDayOfTheWeek,
|
||||
firstDayOfTheWeek: FirstDayOfTheWeekSchema,
|
||||
): 1 | 6 | 7 => {
|
||||
switch (firstDayOfTheWeek) {
|
||||
case FirstDayOfTheWeekEnum.MONDAY:
|
||||
case FirstDayOfTheWeek.MONDAY:
|
||||
return 1;
|
||||
case FirstDayOfTheWeekEnum.SATURDAY:
|
||||
case FirstDayOfTheWeek.SATURDAY:
|
||||
return 6;
|
||||
case FirstDayOfTheWeekEnum.SUNDAY:
|
||||
case FirstDayOfTheWeek.SUNDAY:
|
||||
return 7;
|
||||
default:
|
||||
return assertUnreachable(firstDayOfTheWeek);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { type Nullable } from '@/types';
|
||||
import { assertUnreachable } from '@/utils/assertUnreachable';
|
||||
import { type DateTimePeriod } from '@/utils/filter/dates/types/DateTimePeriod';
|
||||
import { type FirstDayOfTheWeek } from '@/utils/filter/dates/utils/firstDayOfWeekSchema';
|
||||
import { type FirstDayOfTheWeekSchema } from '@/utils/filter/dates/utils/firstDayOfWeekSchema';
|
||||
import { getPeriodStart } from '@/utils/filter/dates/utils/getPeriodStart';
|
||||
import { type Temporal } from 'temporal-polyfill';
|
||||
|
||||
@@ -10,7 +10,7 @@ export const FIRST_DAY_OF_WEEK_ISO_8601_MONDAY = 1;
|
||||
export const getNextPeriodStart = (
|
||||
dateTime: Temporal.ZonedDateTime,
|
||||
unit: DateTimePeriod,
|
||||
firstDayOfTheWeek?: Nullable<FirstDayOfTheWeek>,
|
||||
firstDayOfTheWeek?: Nullable<FirstDayOfTheWeekSchema>,
|
||||
) => {
|
||||
switch (unit) {
|
||||
case 'DAY':
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { type Nullable } from '@/types';
|
||||
import { assertUnreachable, type DateTimePeriod } from '@/utils';
|
||||
|
||||
import { type FirstDayOfTheWeek } from '@/utils/filter/dates/utils/firstDayOfWeekSchema';
|
||||
import { type FirstDayOfTheWeekSchema } from '@/utils/filter/dates/utils/firstDayOfWeekSchema';
|
||||
import { getFirstDayOfTheWeekAsISONumber } from '@/utils/filter/dates/utils/getFirstDayOfTheWeekAsISONumber';
|
||||
import { FIRST_DAY_OF_WEEK_ISO_8601_MONDAY } from '@/utils/filter/dates/utils/getNextPeriodStart';
|
||||
import { isDefined } from '@/utils/validation';
|
||||
@@ -10,7 +10,7 @@ import { type Temporal } from 'temporal-polyfill';
|
||||
export const getPeriodStart = (
|
||||
dateTime: Temporal.ZonedDateTime,
|
||||
unit: DateTimePeriod,
|
||||
firstDayOfTheWeek?: Nullable<FirstDayOfTheWeek>,
|
||||
firstDayOfTheWeek?: Nullable<FirstDayOfTheWeekSchema>,
|
||||
) => {
|
||||
switch (unit) {
|
||||
case 'DAY':
|
||||
|
||||
@@ -56,7 +56,7 @@ export { addUnitToDateTime } from './filter/dates/utils/addUnitToDateTime';
|
||||
export { addUnitToZonedDateTime } from './filter/dates/utils/addUnitToZonedDateTime';
|
||||
export { convertCalendarStartDayNonIsoNumberToFirstDayOfTheWeek } from './filter/dates/utils/convertCalendarStartDayNonIsoNumberToFirstDayOfTheWeek';
|
||||
export { convertFirstDayOfTheWeekToCalendarStartDayNumber } from './filter/dates/utils/convertFirstDayOfTheWeekToCalendarStartDayNumber';
|
||||
export type { FirstDayOfTheWeek } from './filter/dates/utils/firstDayOfWeekSchema';
|
||||
export type { FirstDayOfTheWeekSchema } from './filter/dates/utils/firstDayOfWeekSchema';
|
||||
export { firstDayOfWeekSchema } from './filter/dates/utils/firstDayOfWeekSchema';
|
||||
export { getFirstDayOfTheWeekAsANumberForDateFNS } from './filter/dates/utils/getFirstDayOfTheWeekAsANumberForDateFNS';
|
||||
export { getFirstDayOfTheWeekAsISONumber } from './filter/dates/utils/getFirstDayOfTheWeekAsISONumber';
|
||||
|
||||
@@ -67,6 +67,12 @@ export { workflowRunStatusSchema } from './schemas/workflow-run-status-schema';
|
||||
export { workflowRunStepStatusSchema } from './schemas/workflow-run-step-status-schema';
|
||||
export { workflowTriggerSchema } from './schemas/workflow-trigger-schema';
|
||||
export type { EmailRecipients } from './types/EmailRecipients';
|
||||
export type { FunctionInput } from './types/FunctionInput';
|
||||
export type {
|
||||
InputSchemaPropertyType,
|
||||
InputSchemaProperty,
|
||||
InputSchema,
|
||||
} from './types/InputSchema';
|
||||
export type { StepIfElseBranch } from './types/StepIfElseBranch';
|
||||
export type { BodyType } from './types/workflowHttpRequestStep';
|
||||
export type {
|
||||
@@ -76,6 +82,7 @@ export type {
|
||||
export { StepStatus } from './types/WorkflowRunStateStepInfos';
|
||||
export { canObjectBeManagedByWorkflow } from './utils/canObjectBeManagedByWorkflow';
|
||||
export { extractRawVariableNamePart } from './utils/extractRawVariableNameParts';
|
||||
export { getFunctionInputFromInputSchema } from './utils/getFunctionInputFromInputSchema';
|
||||
export { getWorkflowRunContext } from './utils/getWorkflowRunContext';
|
||||
export { parseBooleanFromStringValue } from './utils/parseBooleanFromStringValue';
|
||||
export { parseDataFromContentType } from './utils/parseDataFromContentType';
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import { type LeafType, type NodeType } from 'twenty-shared/workflow';
|
||||
import { type FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { type LeafType, type NodeType } from '@/workflow';
|
||||
import { type FieldMetadataType } from '@/types';
|
||||
|
||||
export type InputSchemaPropertyType = LeafType | NodeType | FieldMetadataType;
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
import { type InputSchema } from '@/workflow/types/InputSchema';
|
||||
import { getFunctionInputFromInputSchema } from '@/workflow/workflow-steps/workflow-actions/code-action/utils/getFunctionInputFromInputSchema';
|
||||
import { getFunctionInputFromInputSchema, type InputSchema } from '@/workflow';
|
||||
|
||||
describe('getDefaultFunctionInputFromInputSchema', () => {
|
||||
it('should init function input properly', () => {
|
||||
+3
-4
@@ -1,7 +1,6 @@
|
||||
import { type InputSchema } from '@/workflow/types/InputSchema';
|
||||
import { type FunctionInput } from '@/workflow/workflow-steps/workflow-actions/code-action/types/FunctionInput';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import type { InputJsonSchema } from 'twenty-shared/logic-function';
|
||||
import { type InputSchema, type FunctionInput } from '@/workflow';
|
||||
import { type InputJsonSchema } from '@/logic-function';
|
||||
import { isDefined } from '@/utils';
|
||||
|
||||
export const getFunctionInputFromInputSchema = (
|
||||
inputSchema: InputSchema | InputJsonSchema[],
|
||||
@@ -1,8 +1,6 @@
|
||||
// @ts-ignore
|
||||
import path from 'path';
|
||||
import { type UserConfig, defineConfig } from 'vite';
|
||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||
// @ts-ignore
|
||||
import packageJson from './package.json';
|
||||
|
||||
const submodules = Object.keys((packageJson as any).exports || {})
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { type IconComponentProps } from '@ui/display/icon/types/IconComponent';
|
||||
|
||||
type ThinkingOrbitLoaderIconProps = Pick<IconComponentProps, 'className' | 'size'>;
|
||||
type ThinkingOrbitLoaderIconProps = Pick<
|
||||
IconComponentProps,
|
||||
'className' | 'size'
|
||||
>;
|
||||
|
||||
export const ThinkingOrbitLoaderIcon = ({
|
||||
className,
|
||||
|
||||
@@ -13,4 +13,3 @@ export * from './layout';
|
||||
export * from './navigation';
|
||||
export * from './theme';
|
||||
export * from './utilities';
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { Avatar, type AvatarProps } from '@ui/display';
|
||||
import { type MenuItemIconButton, MenuItem } from '@ui/navigation/menu/menu-item/components/MenuItem';
|
||||
import {
|
||||
type MenuItemIconButton,
|
||||
MenuItem,
|
||||
} from '@ui/navigation/menu/menu-item/components/MenuItem';
|
||||
import { type MouseEvent, type ReactNode } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { type MenuItemAccent } from '../types/MenuItemAccent';
|
||||
|
||||
Reference in New Issue
Block a user