2022-12-01 17:58:08 +03:00
|
|
|
{
|
2023-12-10 20:10:54 +03:00
|
|
|
"name": "twenty-server",
|
2024-11-13 21:35:15 +03:00
|
|
|
"version": "0.33.0-canary",
|
2022-12-01 17:58:08 +03:00
|
|
|
"description": "",
|
|
|
|
"author": "",
|
|
|
|
"private": true,
|
2024-01-05 16:59:58 +03:00
|
|
|
"license": "AGPL-3.0",
|
2022-12-01 17:58:08 +03:00
|
|
|
"scripts": {
|
2024-01-04 18:39:57 +03:00
|
|
|
"nx": "NX_DEFAULT_PROJECT=twenty-server node ../../node_modules/nx/bin/nx.js",
|
2023-10-24 15:41:52 +03:00
|
|
|
"start:prod": "node dist/src/main",
|
2024-03-25 14:31:18 +03:00
|
|
|
"command:prod": "node dist/src/command/command",
|
|
|
|
"worker:prod": "node dist/src/queue-worker/queue-worker",
|
|
|
|
"database:init:prod": "npx ts-node ./scripts/setup-db.ts && yarn database:migrate:prod",
|
2024-08-16 22:20:02 +03:00
|
|
|
"database:migrate:prod": "npx -y typeorm migration:run -d dist/src/database/typeorm/metadata/metadata.datasource && npx -y typeorm migration:run -d dist/src/database/typeorm/core/core.datasource",
|
|
|
|
"typeorm": "../../node_modules/typeorm/.bin/typeorm"
|
2022-12-01 17:58:08 +03:00
|
|
|
},
|
|
|
|
"dependencies": {
|
2024-09-02 16:25:20 +03:00
|
|
|
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
2024-09-18 18:35:08 +03:00
|
|
|
"@graphql-yoga/nestjs": "patch:@graphql-yoga/nestjs@2.1.0#./patches/@graphql-yoga+nestjs+2.1.0.patch",
|
2024-07-04 09:57:26 +03:00
|
|
|
"@langchain/mistralai": "^0.0.24",
|
|
|
|
"@langchain/openai": "^0.1.3",
|
2024-07-29 14:03:09 +03:00
|
|
|
"@monaco-editor/react": "^4.6.0",
|
2024-03-07 16:07:01 +03:00
|
|
|
"@nestjs/cache-manager": "^2.2.1",
|
2024-03-15 16:40:58 +03:00
|
|
|
"@nestjs/devtools-integration": "^0.1.6",
|
2024-03-20 18:23:46 +03:00
|
|
|
"@nestjs/graphql": "patch:@nestjs/graphql@12.1.1#./patches/@nestjs+graphql+12.1.1.patch",
|
2024-10-21 21:07:08 +03:00
|
|
|
"@node-saml/passport-saml": "^5.0.0",
|
2023-12-11 12:54:57 +03:00
|
|
|
"@ptc-org/nestjs-query-graphql": "patch:@ptc-org/nestjs-query-graphql@4.2.0#./patches/@ptc-org+nestjs-query-graphql+4.2.0.patch",
|
2024-07-25 10:38:55 +03:00
|
|
|
"@revertdotdev/revert-react": "^0.0.21",
|
2024-09-21 07:33:15 +03:00
|
|
|
"@sentry/nestjs": "^8.30.0",
|
2024-03-07 16:07:01 +03:00
|
|
|
"cache-manager": "^5.4.0",
|
|
|
|
"cache-manager-redis-yet": "^4.1.2",
|
2024-02-14 00:16:21 +03:00
|
|
|
"class-validator": "patch:class-validator@0.14.0#./patches/class-validator+0.14.0.patch",
|
2024-10-21 21:07:08 +03:00
|
|
|
"connect-redis": "^7.1.1",
|
|
|
|
"express-session": "^1.18.1",
|
2024-02-07 20:11:32 +03:00
|
|
|
"graphql-middleware": "^6.1.35",
|
2024-09-12 12:00:25 +03:00
|
|
|
"handlebars": "^4.7.8",
|
2024-04-02 13:07:12 +03:00
|
|
|
"jsdom": "~22.1.0",
|
2024-03-20 18:23:46 +03:00
|
|
|
"jwt-decode": "^4.0.0",
|
2024-07-04 09:57:26 +03:00
|
|
|
"langchain": "^0.2.6",
|
|
|
|
"langfuse-langchain": "^3.11.2",
|
2024-03-22 20:10:55 +03:00
|
|
|
"lodash.differencewith": "^4.5.0",
|
feat: add new ACTOR field type and createdBy standard fields (#6324)
This pull request introduces a new `FieldMetadataType` called `ACTOR`.
The primary objective of this new type is to add an extra column to the
following objects: `person`, `company`, `opportunity`, `note`, `task`,
and all custom objects.
This composite type contains three properties:
- `source`
```typescript
export enum FieldActorSource {
EMAIL = 'EMAIL',
CALENDAR = 'CALENDAR',
API = 'API',
IMPORT = 'IMPORT',
MANUAL = 'MANUAL',
}
```
- `workspaceMemberId`
- This property can be `undefined` in some cases and refers to the
member who created the record.
- `name`
- Serves as a fallback if the `workspaceMember` is deleted and is used
for other source types like `API`.
### Functionality
The pre-hook system has been updated to allow real-time argument
updates. When a record is created, a pre-hook can now compute and update
the arguments accordingly. This enhancement enables the `createdBy`
field to be populated with the correct values based on the
`authContext`.
The `authContext` now includes:
- An optional User entity
- An optional ApiKey entity
- The workspace entity
This provides access to the necessary data for the `createdBy` field.
In the GraphQL API, only the `source` can be specified in the
`createdBy` input. This allows the front-end to specify the source when
creating records from a CSV file.
### Front-End Handling
On the front-end, `orderBy` and `filter` are only applied to the name
property of the `ACTOR` composite type. Currently, we are unable to
apply these operations to the workspace member relation. This means that
if a workspace member changes their first name or last name, there may
be a mismatch because the name will differ from the new one. The name
displayed on the screen is based on the workspace member entity when
available.
### Missing Components
Currently, this PR does not include a `createdBy` value for the `MAIL`
and `CALENDAR` sources. These records are created in a job, and at
present, we only have access to the workspaceId within the job. To
address this, we should use a function similar to
`loadServiceWithContext`, which was recently removed from `TwentyORM`.
This function would allow us to pass the `authContext` to the jobs
without disrupting existing jobs.
Another PR will be created to handle these cases.
### Related Issues
Fixes issue #5155.
### Additional Notes
This PR doesn't include the migrations of the current records and views.
Everything works properly when the database is reset but this part is
still missing for now. We'll add that in another PR.
- There is a minor issue: front-end tests are broken since this commit:
[https://github.com/twentyhq/twenty/commit/80c0fc7ff108d61c0e8d89fd334da64bd224f7aa](https://github.com/twentyhq/twenty/commit/80c0fc7ff108d61c0e8d89fd334da64bd224f7aa).
---------
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2024-08-03 16:43:31 +03:00
|
|
|
"lodash.merge": "^4.6.2",
|
feat: Enhancements to MessageQueue Module with Decorators (#5657)
### Overview
This PR introduces significant enhancements to the MessageQueue module
by integrating `@Processor`, `@Process`, and `@InjectMessageQueue`
decorators. These changes streamline the process of defining and
managing queue processors and job handlers, and also allow for
request-scoped handlers, improving compatibility with services that rely
on scoped providers like TwentyORM repositories.
### Key Features
1. **Decorator-based Job Handling**: Use `@Processor` and `@Process`
decorators to define job handlers declaratively.
2. **Request Scope Support**: Job handlers can be scoped per request,
enhancing integration with request-scoped services.
### Usage
#### Defining Processors and Job Handlers
The `@Processor` decorator is used to define a class that processes jobs
for a specific queue. The `@Process` decorator is applied to methods
within this class to define specific job handlers.
##### Example 1: Specific Job Handlers
```typescript
import { Processor, Process, InjectMessageQueue } from 'src/engine/integrations/message-queue';
@Processor('taskQueue')
export class TaskProcessor {
@Process('taskA')
async handleTaskA(job: { id: string, data: any }) {
console.log(`Handling task A with data:`, job.data);
// Logic for task A
}
@Process('taskB')
async handleTaskB(job: { id: string, data: any }) {
console.log(`Handling task B with data:`, job.data);
// Logic for task B
}
}
```
In the example above, `TaskProcessor` is responsible for processing jobs
in the `taskQueue`. The `handleTaskA` method will only be called for
jobs with the name `taskA`, while `handleTaskB` will be called for
`taskB` jobs.
##### Example 2: General Job Handler
```typescript
import { Processor, Process, InjectMessageQueue } from 'src/engine/integrations/message-queue';
@Processor('generalQueue')
export class GeneralProcessor {
@Process()
async handleAnyJob(job: { id: string, name: string, data: any }) {
console.log(`Handling job ${job.name} with data:`, job.data);
// Logic for any job
}
}
```
In this example, `GeneralProcessor` handles all jobs in the
`generalQueue`, regardless of the job name. The `handleAnyJob` method
will be invoked for every job added to the `generalQueue`.
#### Adding Jobs to a Queue
You can use the `@InjectMessageQueue` decorator to inject a queue into a
service and add jobs to it.
##### Example:
```typescript
import { Injectable } from '@nestjs/common';
import { InjectMessageQueue, MessageQueue } from 'src/engine/integrations/message-queue';
@Injectable()
export class TaskService {
constructor(
@InjectMessageQueue('taskQueue') private readonly taskQueue: MessageQueue,
) {}
async addTaskA(data: any) {
await this.taskQueue.add('taskA', data);
}
async addTaskB(data: any) {
await this.taskQueue.add('taskB', data);
}
}
```
In this example, `TaskService` adds jobs to the `taskQueue`. The
`addTaskA` and `addTaskB` methods add jobs named `taskA` and `taskB`,
respectively, to the queue.
#### Using Scoped Job Handlers
To utilize request-scoped job handlers, specify the scope in the
`@Processor` decorator. This is particularly useful for services that
use scoped repositories like those in TwentyORM.
##### Example:
```typescript
import { Processor, Process, InjectMessageQueue, Scope } from 'src/engine/integrations/message-queue';
@Processor({ name: 'scopedQueue', scope: Scope.REQUEST })
export class ScopedTaskProcessor {
@Process('scopedTask')
async handleScopedTask(job: { id: string, data: any }) {
console.log(`Handling scoped task with data:`, job.data);
// Logic for scoped task, which might use request-scoped services
}
}
```
Here, the `ScopedTaskProcessor` is associated with `scopedQueue` and
operates with request scope. This setup is essential when the job
handler relies on services that need to be instantiated per request,
such as scoped repositories.
### Migration Notes
- **Decorators**: Refactor job handlers to use `@Processor` and
`@Process` decorators.
- **Request Scope**: Utilize the scope option in `@Processor` if your
job handlers depend on request-scoped services.
Fix #5628
---------
Co-authored-by: Weiko <corentin@twenty.com>
2024-06-17 10:49:37 +03:00
|
|
|
"lodash.omitby": "^4.6.0",
|
2024-03-22 20:44:14 +03:00
|
|
|
"lodash.uniq": "^4.5.0",
|
|
|
|
"lodash.uniqby": "^4.7.0",
|
2024-09-02 16:25:20 +03:00
|
|
|
"monaco-editor": "^0.51.0",
|
|
|
|
"monaco-editor-auto-typings": "^0.4.5",
|
2024-10-21 21:07:08 +03:00
|
|
|
"openid-client": "^5.7.0",
|
2024-03-04 19:50:41 +03:00
|
|
|
"passport": "^0.7.0",
|
2024-03-21 21:22:21 +03:00
|
|
|
"psl": "^1.9.0",
|
2024-10-21 21:07:08 +03:00
|
|
|
"redis": "^4.7.0",
|
2024-10-17 16:08:42 +03:00
|
|
|
"ts-morph": "^24.0.0",
|
2024-07-04 09:57:26 +03:00
|
|
|
"tsconfig-paths": "^4.2.0",
|
2024-08-27 15:13:05 +03:00
|
|
|
"typeorm": "patch:typeorm@0.3.20#./patches/typeorm+0.3.20.patch",
|
2024-09-02 16:25:20 +03:00
|
|
|
"unzipper": "^0.12.3",
|
2024-07-04 09:57:26 +03:00
|
|
|
"zod-to-json-schema": "^3.23.1"
|
2024-01-23 11:59:00 +03:00
|
|
|
},
|
|
|
|
"devDependencies": {
|
2024-02-14 00:16:21 +03:00
|
|
|
"@nestjs/cli": "10.3.0",
|
2024-04-24 12:53:53 +03:00
|
|
|
"@nx/js": "18.3.3",
|
2024-10-21 21:07:08 +03:00
|
|
|
"@types/express-session": "^1.18.0",
|
2024-03-22 20:10:55 +03:00
|
|
|
"@types/lodash.differencewith": "^4.5.9",
|
2024-01-23 11:59:00 +03:00
|
|
|
"@types/lodash.isempty": "^4.4.7",
|
2024-02-15 20:04:12 +03:00
|
|
|
"@types/lodash.isequal": "^4.5.8",
|
2024-01-23 11:59:00 +03:00
|
|
|
"@types/lodash.isobject": "^3.0.7",
|
feat: add new ACTOR field type and createdBy standard fields (#6324)
This pull request introduces a new `FieldMetadataType` called `ACTOR`.
The primary objective of this new type is to add an extra column to the
following objects: `person`, `company`, `opportunity`, `note`, `task`,
and all custom objects.
This composite type contains three properties:
- `source`
```typescript
export enum FieldActorSource {
EMAIL = 'EMAIL',
CALENDAR = 'CALENDAR',
API = 'API',
IMPORT = 'IMPORT',
MANUAL = 'MANUAL',
}
```
- `workspaceMemberId`
- This property can be `undefined` in some cases and refers to the
member who created the record.
- `name`
- Serves as a fallback if the `workspaceMember` is deleted and is used
for other source types like `API`.
### Functionality
The pre-hook system has been updated to allow real-time argument
updates. When a record is created, a pre-hook can now compute and update
the arguments accordingly. This enhancement enables the `createdBy`
field to be populated with the correct values based on the
`authContext`.
The `authContext` now includes:
- An optional User entity
- An optional ApiKey entity
- The workspace entity
This provides access to the necessary data for the `createdBy` field.
In the GraphQL API, only the `source` can be specified in the
`createdBy` input. This allows the front-end to specify the source when
creating records from a CSV file.
### Front-End Handling
On the front-end, `orderBy` and `filter` are only applied to the name
property of the `ACTOR` composite type. Currently, we are unable to
apply these operations to the workspace member relation. This means that
if a workspace member changes their first name or last name, there may
be a mismatch because the name will differ from the new one. The name
displayed on the screen is based on the workspace member entity when
available.
### Missing Components
Currently, this PR does not include a `createdBy` value for the `MAIL`
and `CALENDAR` sources. These records are created in a job, and at
present, we only have access to the workspaceId within the job. To
address this, we should use a function similar to
`loadServiceWithContext`, which was recently removed from `TwentyORM`.
This function would allow us to pass the `authContext` to the jobs
without disrupting existing jobs.
Another PR will be created to handle these cases.
### Related Issues
Fixes issue #5155.
### Additional Notes
This PR doesn't include the migrations of the current records and views.
Everything works properly when the database is reset but this part is
still missing for now. We'll add that in another PR.
- There is a minor issue: front-end tests are broken since this commit:
[https://github.com/twentyhq/twenty/commit/80c0fc7ff108d61c0e8d89fd334da64bd224f7aa](https://github.com/twentyhq/twenty/commit/80c0fc7ff108d61c0e8d89fd334da64bd224f7aa).
---------
Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
Co-authored-by: Charles Bochet <charles@twenty.com>
2024-08-03 16:43:31 +03:00
|
|
|
"@types/lodash.merge": "^4.6.9",
|
2024-01-30 16:40:55 +03:00
|
|
|
"@types/lodash.omit": "^4.5.9",
|
feat: Enhancements to MessageQueue Module with Decorators (#5657)
### Overview
This PR introduces significant enhancements to the MessageQueue module
by integrating `@Processor`, `@Process`, and `@InjectMessageQueue`
decorators. These changes streamline the process of defining and
managing queue processors and job handlers, and also allow for
request-scoped handlers, improving compatibility with services that rely
on scoped providers like TwentyORM repositories.
### Key Features
1. **Decorator-based Job Handling**: Use `@Processor` and `@Process`
decorators to define job handlers declaratively.
2. **Request Scope Support**: Job handlers can be scoped per request,
enhancing integration with request-scoped services.
### Usage
#### Defining Processors and Job Handlers
The `@Processor` decorator is used to define a class that processes jobs
for a specific queue. The `@Process` decorator is applied to methods
within this class to define specific job handlers.
##### Example 1: Specific Job Handlers
```typescript
import { Processor, Process, InjectMessageQueue } from 'src/engine/integrations/message-queue';
@Processor('taskQueue')
export class TaskProcessor {
@Process('taskA')
async handleTaskA(job: { id: string, data: any }) {
console.log(`Handling task A with data:`, job.data);
// Logic for task A
}
@Process('taskB')
async handleTaskB(job: { id: string, data: any }) {
console.log(`Handling task B with data:`, job.data);
// Logic for task B
}
}
```
In the example above, `TaskProcessor` is responsible for processing jobs
in the `taskQueue`. The `handleTaskA` method will only be called for
jobs with the name `taskA`, while `handleTaskB` will be called for
`taskB` jobs.
##### Example 2: General Job Handler
```typescript
import { Processor, Process, InjectMessageQueue } from 'src/engine/integrations/message-queue';
@Processor('generalQueue')
export class GeneralProcessor {
@Process()
async handleAnyJob(job: { id: string, name: string, data: any }) {
console.log(`Handling job ${job.name} with data:`, job.data);
// Logic for any job
}
}
```
In this example, `GeneralProcessor` handles all jobs in the
`generalQueue`, regardless of the job name. The `handleAnyJob` method
will be invoked for every job added to the `generalQueue`.
#### Adding Jobs to a Queue
You can use the `@InjectMessageQueue` decorator to inject a queue into a
service and add jobs to it.
##### Example:
```typescript
import { Injectable } from '@nestjs/common';
import { InjectMessageQueue, MessageQueue } from 'src/engine/integrations/message-queue';
@Injectable()
export class TaskService {
constructor(
@InjectMessageQueue('taskQueue') private readonly taskQueue: MessageQueue,
) {}
async addTaskA(data: any) {
await this.taskQueue.add('taskA', data);
}
async addTaskB(data: any) {
await this.taskQueue.add('taskB', data);
}
}
```
In this example, `TaskService` adds jobs to the `taskQueue`. The
`addTaskA` and `addTaskB` methods add jobs named `taskA` and `taskB`,
respectively, to the queue.
#### Using Scoped Job Handlers
To utilize request-scoped job handlers, specify the scope in the
`@Processor` decorator. This is particularly useful for services that
use scoped repositories like those in TwentyORM.
##### Example:
```typescript
import { Processor, Process, InjectMessageQueue, Scope } from 'src/engine/integrations/message-queue';
@Processor({ name: 'scopedQueue', scope: Scope.REQUEST })
export class ScopedTaskProcessor {
@Process('scopedTask')
async handleScopedTask(job: { id: string, data: any }) {
console.log(`Handling scoped task with data:`, job.data);
// Logic for scoped task, which might use request-scoped services
}
}
```
Here, the `ScopedTaskProcessor` is associated with `scopedQueue` and
operates with request scope. This setup is essential when the job
handler relies on services that need to be instantiated per request,
such as scoped repositories.
### Migration Notes
- **Decorators**: Refactor job handlers to use `@Processor` and
`@Process` decorators.
- **Request Scope**: Utilize the scope option in `@Processor` if your
job handlers depend on request-scoped services.
Fix #5628
---------
Co-authored-by: Weiko <corentin@twenty.com>
2024-06-17 10:49:37 +03:00
|
|
|
"@types/lodash.omitby": "^4.6.9",
|
2024-01-23 11:59:00 +03:00
|
|
|
"@types/lodash.snakecase": "^4.1.7",
|
2024-03-22 20:44:14 +03:00
|
|
|
"@types/lodash.uniq": "^4.5.9",
|
|
|
|
"@types/lodash.uniqby": "^4.7.9",
|
2024-01-23 11:59:00 +03:00
|
|
|
"@types/lodash.upperfirst": "^4.3.7",
|
2024-10-21 21:07:08 +03:00
|
|
|
"@types/openid-client": "^3.7.0",
|
2024-01-23 11:59:00 +03:00
|
|
|
"@types/react": "^18.2.39",
|
2024-09-02 16:25:20 +03:00
|
|
|
"@types/unzipper": "^0",
|
2024-02-14 18:56:37 +03:00
|
|
|
"rimraf": "^5.0.5",
|
2024-04-04 16:38:01 +03:00
|
|
|
"typescript": "5.3.3"
|
2023-12-11 12:54:57 +03:00
|
|
|
},
|
|
|
|
"engines": {
|
2024-01-05 16:59:58 +03:00
|
|
|
"node": "^18.17.1",
|
2023-12-11 12:54:57 +03:00
|
|
|
"npm": "please-use-yarn",
|
|
|
|
"yarn": "^4.0.2"
|
2022-12-01 17:58:08 +03:00
|
|
|
}
|
2024-02-05 17:01:37 +03:00
|
|
|
}
|