Commit Graph

1800 Commits

Author SHA1 Message Date
183dc40916 [FIX] Out of memory while running app localy (#11341)
# Introduction
Lately encountering a lot of out of memory error when running
twenty-front in watch mode with both TypeScript and lint checkers
```ts
Error: Worker terminated due to reaching memory limit: JS heap out of memory
    at new NodeError (node:internal/errors:405:5)
    at [kOnExit] (node:internal/worker:287:26)
    at Worker.<computed>.onexit (node:internal/worker:209:20)
```

The existing configuration looks like this:
```ts
// packages/twenty-front/vite.config.ts
'cd ../.. && eslint packages/twenty-front --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs',
```
This is wrong as computing the root eslintrc completely omitting
twenty-front's one ***and its ignorePattern*** so will be checking in
`node_modules` etc checking for project-structure :).
For example this a
[snippet](https://gist.github.com/prastoin/d7f8ad4ef5eb2f7732209b756a38094c)
of the above commands errors. We can see rule that should be disabled by
`eslintrc.react.cjs` extension made from twenty-front `eslintrc` :
```ts
/Users/paulrastoin/ws/twenty-two/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/__stories__/SettingsDataModelFieldSettingsFormCard.stories.tsx
  23:27  warning  Forbidden non-null assertion  @typescript-eslint/no-non-null-assertion
```

## Fixes
- consume the `twenty-front` package eslint configuration within the
vite lint checker
- eslint overrides extends are getting merged based on glob inclusion of
their files declarations
- any linted files should be included in one of our `tsconfig`
- removed redundant and counter-productive negative `ignorePatterns`, as
eslint will naturally only lint files within configuration file
directory by default which will result making it go through local
`node_modules` project structure

## Now
Less cpu usage <3.5 gb and faster
```ts
// from packages/twenty-front
TIMING=1  npx eslint . --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs --debug
#...
Rule                                            | Time (ms) | Relative
:-----------------------------------------------|----------:|--------:
project-structure/folder-structure              | 19578.927 |    20.2%
prettier/prettier                               | 13746.156 |    14.2%
no-redeclare                                    |  9546.570 |     9.9%
@nx/workspace-explicit-boolean-predicates-in-if |  8167.805 |     8.4%
@typescript-eslint/no-unused-vars               |  6872.803 |     7.1%
import/no-relative-packages                     |  6577.273 |     6.8%
@nx/enforce-module-boundaries                   |  6520.945 |     6.7%
import/no-duplicates                            |  4987.476 |     5.2%
react/no-direct-mutation-state                  |  2323.082 |     2.4%
react/require-render-return                     |  1155.261 |     1.2%
```

## Conclusion
Please note that `nx linter` might not be as strict as vite config
eslint runner

---------

Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
2025-04-02 18:35:00 +02:00
7488c6727a Add record picker in form action (#11331)
Record picker becomes a form field that could be used in another context
than workflows.

Settings
<img width="488" alt="Capture d’écran 2025-04-02 à 10 55 53"
src="https://github.com/user-attachments/assets/a9fc09ff-28cd-4ede-8aaa-af1e986cda8e"
/>

Execution
<img width="936" alt="Capture d’écran 2025-04-02 à 10 57 36"
src="https://github.com/user-attachments/assets/d796aeeb-cae1-4e59-b388-5b8d08739ea8"
/>
2025-04-02 17:08:33 +02:00
2bc9691021 fix stripe subscription deletion (#11353)
when soft deleting workspace, stripe subscription is canceled then
workspace is soft deleted before stripe async web hook event is
received. This webhook event is needed to update billingSubscription
status.
2025-04-02 15:59:09 +02:00
55eadf1ab4 11312 rest api cant filter enum type columns by null value (#11343)
- Fixes https://github.com/twentyhq/twenty/issues/11312
- Fixes record undefined on webhook deleted events
- Emit destroy event when deleting record via the rest api
2025-04-02 15:07:53 +02:00
76bbffc315 [FIX] Upgrade command missmatch (#11348)
# Introduction
As we deploy patch from the main branch we've ship the upgrade for the
`0.51` within the `0.50`.
We should only do that when about to release

We should find a way for this not to occur again
2025-04-02 11:58:50 +00:00
da1413c5a1 fix hot reload (#11347) 2025-04-02 11:42:05 +00:00
c6afb0d1ba Revert "[4/n]: migrate the RESTAPI GET /rest/* to use TwentyORM direc… (#11344)
…tly (#10372)"

This reverts commit a26b3f54d6.
2025-04-02 13:39:28 +02:00
6e92b19e01 11311 object create webhook should be triggered when object is created via rest api (#11336)
Fixes https://github.com/twentyhq/twenty/issues/11311
2025-04-02 10:22:22 +02:00
44bf393b06 fix(email-validation): validation email cross workspace (#11261)
- Finish removing captcha guard from validation  email
- Fix an issue where domain validation wasn't working on a multi-domain
setup
2025-04-02 08:06:34 +00:00
3357f93415 Bump 0.51.0-canary (#11329) 2025-04-02 09:23:17 +02:00
8e6b175f34 700 fix rest api issues (#11326)
fixes issues listed here
https://github.com/twentyhq/core-team-issues/issues/700
2025-04-01 17:22:24 +02:00
8385e2d08b Fix object metadata collection not found (#11306)
## Context
This fix ensures that even if a datasource creation promise throws and
is cached, subsequent requests won't return that cached exception.
Also adding a TTL on MetadataObjectMetadataOngoingCachingLock, this is
not something that should stay in the cache forever and could
potentially unlock some race conditions (the origin of the issue is
probably due to performances where the lock is not removed as it should
be after metadata computation and caching)
2025-04-01 16:38:43 +02:00
1d4fc5ff4a update subscription with metered products at trial ending (#11319)
Context
- Subscription with metered prices can't be 'paused' at the end of
trialing period
- Currently, pausing subscription have been the process we choose at
Twenty

Two solutions : 
- [x] (The chosen one!) Adding metered products when the trial period is
ended.
- [ ] Switching from 'paused' to 'past_due' status at the end of
trialing period. Tricky because we should handle different cases of
'past_due' subscription status, some causing workspace suspension and
some other not.

closes https://github.com/twentyhq/core-team-issues/issues/676
2025-04-01 15:57:01 +02:00
e74c8723d0 Add position in run / version + block creation from generated API (#11318)
- Add position during workflow version / creation. It will allow to have
the versions and runs ordered
- Block the creation from generated api for versions. We use workflow
post hooks or create from draft
2025-04-01 15:29:54 +02:00
aa5da92555 Improve upsert for spreadsheet import (#11283)
Refactor query runner to improve the import method for upserts, we now
take into account any unique field and prevent any conflict upfront.
Previously, we would only update if an `id` was passed.



https://github.com/user-attachments/assets/8087b864-ba42-4b6e-abf2-b9ea66e6c467


This is only a first step, there are other things to fix on the frontend
for this to work.
2025-04-01 15:27:08 +02:00
023d071103 Set record position on workflow creation (#11308)
- Migrate record position factory to core-modules 
- set position on record creation
2025-04-01 09:50:43 +00:00
a26b3f54d6 [4/n]: migrate the RESTAPI GET /rest/* to use TwentyORM directly (#10372)
# This PR

- Addressing #3644
- Migrates the `findOne` and the `findMany` Rest API to use TwentyORM
directly
- Adds integration tests to the migrated methods

---------

Co-authored-by: prastoin <paul@twenty.com>
Co-authored-by: martmull <martmull@hotmail.fr>
2025-04-01 11:34:43 +02:00
06ff16e086 add role update (#11217)
## Context
This PR introduces the new Create and Edit role components, behind the
PERMISSIONS_ENABLED_V2 feature flag.
2025-03-31 17:57:14 +02:00
eea30828a4 test(user-workspace): add unit tests for UserWorkspaceService + review #11239 (#11256) 2025-03-30 08:37:16 +02:00
3e20134676 Add command to update createdBySource enum values (#11280)
Fixes webhook create workflowRun by WEBHOOK error

Co-authored-by: Raphaël Bosi <71827178+bosiraphael@users.noreply.github.com>
2025-03-28 16:53:14 +00:00
d9ac662302 Microsoft Throtling error and wrongly types on our side (#11266) 2025-03-28 16:37:46 +00:00
da9e078283 fix no billing subscription error (#11257)
closes https://github.com/twentyhq/core-team-issues/issues/625

Context : 
Soft-deleted workspaces no longer have any subscriptions. Computing
inactivity causes an error.
2025-03-28 14:45:13 +00:00
8d35454dd8 Form action fast follows (#11242)
- on form action, add trash on hover and fix spacing
- fix dark mode
- second batch of icon fixes

<img width="692" alt="Capture d’écran 2025-03-27 à 18 25 48"
src="https://github.com/user-attachments/assets/963f50d2-12ee-425c-97a3-2ad0c6bb5c57"
/>
2025-03-28 10:11:01 +01:00
391392dd87 set up metrics collecting with open telemetry (#11236)
Done :  
- move metrics and health cache services from health module to metrics
module
- refactor metrics counter from specific method to set up from enum keys
- add OpenTelemetry (Otel) instrumentation for metrics
- set up Otel SDK to send metrics to Otel collector

To do later : 
- implement Otel instrumentation for traces + plug Sentry on top
2025-03-28 08:45:24 +01:00
9af2628264 feat(auth): enhance email validation when no workspace available + disable captcha on email validation (#11239)
Implemented fallback logic to associate a user with a workspace when
none is found. Introduced new GraphQL types and mutations for roles and
permissions management. Simplified and refactored URL-building logic for
email verification, improving code maintainability and flexibility.
2025-03-28 07:38:58 +01:00
976c6afb4b Generate more random subdomains (#11249)
Sorted the 2 existing lists + added a new colors list to generate the
random subdomain to have less collision

<img width="368" alt="Screenshot 2025-03-27 at 19 25 28"
src="https://github.com/user-attachments/assets/6d6d27f1-134b-4ae7-88a6-4af506115317"
/>
2025-03-27 19:40:20 +01:00
a683827e4b Fix inline cell height issue and allow field settings update (#11248)
In this PR:
- allow to update settings on fields metadata (regression introduced by
a recent refactoring of fields-metadata update)
- revert changes introduced by
https://github.com/twentyhq/twenty/pull/11221
2025-03-27 19:29:34 +01:00
e201da263d Fix sync-workspace log (#11247)
This is now log for every workspace we sync so stopped making sense
2025-03-27 18:17:11 +00:00
d12bbdf9f1 Move MigrationRelations command out of 0.50 -> 0.51 (#11234) 2025-03-27 16:06:52 +00:00
439ccb0a52 Fix workflow placeholders and icons (#11222)
- allow all form fields that may need a placeholder to set it
- update main icons on versions and runs
2025-03-27 17:01:33 +01:00
3b9e7c38eb better error handling for messaging import in case of unknown error (#11228) 2025-03-27 16:19:57 +01:00
645d76fe69 Removing advanced filter feature flag (#11219)
This PR removes the advanced filter feature flag.
2025-03-27 15:25:07 +01:00
a545b3adf3 CSV Import translations and dark mode fixes (#11184)
Fixes #11182 and adds missing translations
2025-03-27 08:53:00 +01:00
22e56339a1 Fix field options not updatable anymore (#11213)
As per title
2025-03-26 23:40:44 +01:00
4c7d71e325 chore(analytics): remove tinybird (#11146)
Co-authored-by: Charles Bochet <charles@twenty.com>
2025-03-26 21:59:42 +01:00
870069f682 [CHORE] Enable workspace version validation on upgrade for next release (#11211)
# Introduction
- Activate workspace version validation on upgrade command
- Update upgrade command to manager next release starting from `0.44.0`
2025-03-26 21:47:39 +01:00
5bd10d40cb Fix deactivate objects impacts (#11185)
In this PR:
- Remove deactivated objects from ActivityTargetInlineCell record picker
- Prevent users to deactivate createdAt, updatedAt, deletedAt fields on
any objects

Still left:
- write unit tests on the assert utils
- write integration tests on field metadata service
- prevent users to deactivate createdAt, updatedAt, deletedAt on FE
2025-03-26 20:45:46 +01:00
151841d3db i18n - translations (#11207)
Created by Github action

---------

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: github-actions <github-actions@twenty.com>
2025-03-26 19:21:48 +01:00
4827ad600d Add workspace constraint on defaultRoleId and activationStatus (#11191)
Part of https://github.com/twentyhq/core-team-issues/issues/526

An active workspace's defaultRoleId should never be null.
We can't rely on a simple postgres NOT NULL constraint as defaultRoleId
will always be initially null when the workspace is first created since
the roles do not exist at that time.
Since a suspended workspace can be active again, we should maintain that
rule during the workspace suspension. The only moment defaultRoleId can
have a null value is during the onboarding. this pr enforces that
2025-03-26 14:43:13 +00:00
7af90eb4c4 [permissions V2] Custom role deletion (#11187)
Closes https://github.com/twentyhq/core-team-issues/issues/616
2025-03-26 15:08:48 +01:00
16cb768c5c Do not suspend onboarding workspaces after stripe hook and add cron to delete them after 7 days (#11189)
## Context
When a trial ends, we receive a webhook from stripe to switch a
workspace from its previous status to SUSPENDED.
We also have some workspaces in ONGOING_CREATION that started the flow,
started the trial but did not finish completely the flow which means the
workspace has no data/metadata/schema.
Because of this, we can have workspaces that switch from
ONGOING_CREATION to SUSPENDED directly and ONGOING_CREATION workspaces
that didn't start the trial can stay in this state forever since they
are not cleaned up by the current cleaner.
To solve those 2 issues, I'm adding a new cron that will automatically
clean ONGOING_CREATION workspaces that are older than 7 days and I'm
updating the stripe webhook to only update the activationStatus to
SUSPENDED if it's already ACTIVE (then it will be deleted by the other
cron in the other case)
2025-03-26 14:35:11 +01:00
72b4b26e2c [permissions] Enable permissions V1 for all workspaces (#11172)
Closes https://github.com/twentyhq/core-team-issues/issues/526

(for reminder: 
1. Make defaultRoleId non-nullable for an active workspace
2. Remove permissions V1 feature flag
3. Set member role as default role for new workspaces

About 1.:
An active workspace's defaultRoleId should never be null.
We can't rely on a simple postgres NOT NULL constraint as defaultRoleId
will always be initially null when the workspace is first created since
the roles do not exist at that time.

Let's add a more complex rule to ensure that

About 3.:
In the first phase of our deploy of permissions, we chose to assign
admin role to all existing users, not to break any existing behavior
with the introduction of the feature (= existing users have less rights
than before).

As we deploy permissions to all existing and future workspaces, let's
set the member role as default role for future workspaces.
)
2025-03-26 12:51:34 +00:00
c36cfb3af9 Fix no timeline for opportunities (#11186)
Fixes #11176
2025-03-26 12:35:59 +01:00
6ec06be18d Overwrite standard translations (#11134)
Manage overwriting translations for standard fields and standard objects
properties
2025-03-25 22:17:29 +01:00
934abf1fb3 fix billing issues (#11160)
- first commit : fix quantity update on Enterprise plan
- second commit : fix user with soft deleted workspace trying to
recreate another workspace

closes https://github.com/twentyhq/core-team-issues/issues/634
2025-03-25 19:09:36 +01:00
20f2a251b6 fix(auth): handle missing workspaceId in auth service (#11173)
Add a check to return undefined if workspaceId is not provided. Prevents
unnecessary execution and potential errors during workspace lookup.
2025-03-25 17:58:53 +00:00
45b8a330c6 Fix lambda iam (#11163)
As title, fix lambda driver for serverless functions
2025-03-25 15:57:04 +01:00
b70aa6f2ee i18n - translations (#11155)
Created by Github action

---------

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: github-actions <github-actions@twenty.com>
2025-03-25 15:21:06 +01:00
96c61df007 fix MailboxConcurrency And email format without @ (#11133) 2025-03-25 11:40:58 +01:00
4680bc740a [permissions V2] Upsert object and setting permissions (#11119)
Closes https://github.com/twentyhq/core-team-issues/issues/639
2025-03-25 11:07:51 +01:00