Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import { getRecordConnectionFromRecords } from '@/object-record/cache/utils/getR
import { getRefName } from '@/object-record/cache/utils/getRefName';
import { type RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
import { type ObjectRecord } from '@/object-record/types/ObjectRecord';
import { isDefined } from 'twenty-shared/utils';
import { isDefined, pascalCase } from 'twenty-shared/utils';
import { FieldMetadataType, RelationType } from '~/generated-metadata/graphql';
import { pascalCase } from '~/utils/string/pascalCase';

export const getRecordNodeFromRecord = <T extends ObjectRecord>({
objectMetadataItems,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
import { isFieldValueEmpty } from '@/object-record/record-field/ui/utils/isFieldValueEmpty';
import { type ObjectRecord } from '@/object-record/types/ObjectRecord';
import { getFieldPreviewValue } from '@/settings/data-model/fields/preview/utils/getFieldPreviewValue';
import { isDefined } from 'twenty-shared/utils';
import { pascalCase } from '~/utils/string/pascalCase';
import { isDefined, pascalCase } from 'twenty-shared/utils';

type UsePreviewRecordParams = {
objectNameSingular: string;
Expand Down
6 changes: 6 additions & 0 deletions packages/twenty-sdk/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ export default [
{
ignores: ['**/dist/**'],
},
{
files: ['**/*.{js,jsx,ts,tsx}'],
rules: {
'prettier/prettier': 'error',
},
},
{
rules: {
'no-console': 'off',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineApp } from '../define-app';
import { defineApp } from '@/application';

describe('defineApp', () => {
it('should return the config when valid', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineFrontComponent } from '../front-components/define-front-component';
import { defineFrontComponent } from '@/application';

// Mock component for testing
const MockComponent = () => null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineFunction } from '../functions/define-function';
import { defineFunction } from '@/application';

// Mock handler for testing
const mockHandler = async () => ({ success: true });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineObject } from '../objects/define-object';
import { defineObject } from '@/application';
import { FieldMetadataType } from 'twenty-shared/types';
import { type ObjectManifest } from 'twenty-shared/application';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineRole } from '../roles/define-role';
import { defineRole } from '@/application';

describe('defineRole', () => {
const validConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ export type {
FullNameMetadata as FullNameField,
LinksMetadata as LinksField,
PhonesMetadata as PhonesField,
RichTextV2Metadata as RichTextField
RichTextV2Metadata as RichTextField,
} from 'twenty-shared/types';

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FrontComponentConfig } from './front-component-config';
import { type FrontComponentConfig } from '@/application/front-components/front-component-config';

/**
* Define a front component configuration with validation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ export type FrontComponentType = React.ComponentType<any>;

export type FrontComponentConfig = Omit<
FrontComponentManifest,
'sourceComponentPath' | 'builtComponentPath' | 'builtComponentChecksum' | 'componentName'
| 'sourceComponentPath'
| 'builtComponentPath'
| 'builtComponentChecksum'
| 'componentName'
> & {
name?: string;
description?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type FunctionConfig } from './function-config';
import { type FunctionConfig } from '@/application/functions/function-config';

/**
* Define a serverless function configuration with validation.
Expand Down Expand Up @@ -68,7 +68,9 @@ export const defineFunction = <T extends FunctionConfig>(config: T): T => {
break;

default:
throw new Error(`Unknown trigger type: ${(trigger as { type: string }).type}`);
throw new Error(
`Unknown trigger type: ${(trigger as { type: string }).type}`,
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ export type FunctionHandler = (...args: any[]) => any | Promise<any>;

export type FunctionConfig = Omit<
ServerlessFunctionManifest,
'sourceHandlerPath' | 'builtHandlerPath' | 'builtHandlerChecksum' | 'handlerName'
| 'sourceHandlerPath'
| 'builtHandlerPath'
| 'builtHandlerChecksum'
| 'handlerName'
> & {
name?: string;
description?: string;
Expand Down
12 changes: 9 additions & 3 deletions packages/twenty-sdk/src/application/roles/define-role.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type RoleConfig } from '../role-config';
import { type RoleConfig } from '@/application/role-config';

/**
* Define a role configuration with validation.
Expand Down Expand Up @@ -36,7 +36,10 @@ export const defineRole = <T extends RoleConfig>(config: T): T => {
// Validate object permissions if provided
if (config.objectPermissions) {
for (const permission of config.objectPermissions) {
if (!permission.objectNameSingular && !permission.objectUniversalIdentifier) {
if (
!permission.objectNameSingular &&
!permission.objectUniversalIdentifier
) {
throw new Error(
'Object permission must have either objectNameSingular or objectUniversalIdentifier',
);
Expand All @@ -47,7 +50,10 @@ export const defineRole = <T extends RoleConfig>(config: T): T => {
// Validate field permissions if provided
if (config.fieldPermissions) {
for (const permission of config.fieldPermissions) {
if (!permission.objectNameSingular && !permission.objectUniversalIdentifier) {
if (
!permission.objectNameSingular &&
!permission.objectUniversalIdentifier
) {
throw new Error(
'Field permission must have either objectNameSingular or objectUniversalIdentifier',
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { runAppBuild } from '@/cli/__tests__/integration/utils/run-app-build.util';
import { type RunCliCommandResult } from '@/cli/__tests__/integration/utils/run-cli-command.util';
import { join } from 'path';

import { runAppBuild } from '@/cli/__tests__/integration/utils/run-app-build.util';
import { type RunCliCommandResult } from '@/cli/__tests__/integration/utils/run-cli-command.util';
import { defineConsoleOutputTests } from './tests/console-output.tests';
import { defineManifestTests } from '../app-dev/tests/manifest.tests';
import { defineFrontComponentsTests } from '../app-dev/tests/front-components.tests';
import { defineFunctionsTests } from '../app-dev/tests/functions.tests';
import { defineManifestTests } from '../app-dev/tests/manifest.tests';
import { defineConsoleOutputTests } from './tests/console-output.tests';

const APP_PATH = join(__dirname, '../..');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export const defineConsoleOutputTests = (
});

it('should contain front-components-watch messages', () => {
const output = getOutputByPrefix(getResult().output, 'front-components-watch');
const output = getOutputByPrefix(
getResult().output,
'front-components-watch',
);

expect(output).toContain('[front-components-watch] 🎨 Building...');
expect(output).toContain('[front-components-watch] ✓ Built');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { type RunCliCommandResult } from '@/cli/__tests__/integration/utils/run-
import { join } from 'path';

import { defineConsoleOutputTests } from './tests/console-output.tests';
import { defineFrontComponentsTests } from './tests/front-components.tests';
import { defineFunctionsTests } from './tests/functions.tests';
import { defineManifestTests } from './tests/manifest.tests';
import { defineManifestTests } from '../app-dev/tests/manifest.tests';
import { defineFrontComponentsTests } from '../app-dev/tests/front-components.tests';
import { defineFunctionsTests } from '../app-dev/tests/functions.tests';

const APP_PATH = join(__dirname, '../..');

Expand Down
Loading
Loading