chore(*): remove unused code (#6781)
The code removed in the PR was flagged as unused by the JetBrains inspector. I did a QA on the dev environment but other checks are highly recommended. There is one commit by scope to make the review easier. --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -351,6 +351,7 @@ export type Mutation = {
|
|||||||
deleteOneServerlessFunction: ServerlessFunction;
|
deleteOneServerlessFunction: ServerlessFunction;
|
||||||
deleteUser: User;
|
deleteUser: User;
|
||||||
disablePostgresProxy: PostgresCredentials;
|
disablePostgresProxy: PostgresCredentials;
|
||||||
|
disableWorkflowTrigger: Scalars['Boolean'];
|
||||||
emailPasswordResetLink: EmailPasswordResetLink;
|
emailPasswordResetLink: EmailPasswordResetLink;
|
||||||
enablePostgresProxy: PostgresCredentials;
|
enablePostgresProxy: PostgresCredentials;
|
||||||
enableWorkflowTrigger: Scalars['Boolean'];
|
enableWorkflowTrigger: Scalars['Boolean'];
|
||||||
@ -431,6 +432,11 @@ export type MutationDeleteOneServerlessFunctionArgs = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export type MutationDisableWorkflowTriggerArgs = {
|
||||||
|
workflowVersionId: Scalars['String'];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
export type MutationEmailPasswordResetLinkArgs = {
|
export type MutationEmailPasswordResetLinkArgs = {
|
||||||
email: Scalars['String'];
|
email: Scalars['String'];
|
||||||
};
|
};
|
||||||
@ -1186,6 +1192,7 @@ export type Field = {
|
|||||||
isSystem?: Maybe<Scalars['Boolean']>;
|
isSystem?: Maybe<Scalars['Boolean']>;
|
||||||
label: Scalars['String'];
|
label: Scalars['String'];
|
||||||
name: Scalars['String'];
|
name: Scalars['String'];
|
||||||
|
object?: Maybe<Object>;
|
||||||
options?: Maybe<Scalars['JSON']>;
|
options?: Maybe<Scalars['JSON']>;
|
||||||
relationDefinition?: Maybe<RelationDefinition>;
|
relationDefinition?: Maybe<RelationDefinition>;
|
||||||
settings?: Maybe<Scalars['JSON']>;
|
settings?: Maybe<Scalars['JSON']>;
|
||||||
|
|||||||
@ -121,11 +121,13 @@ export const useRecordActionBar = ({
|
|||||||
title={`Delete ${numberOfSelectedRecords} ${
|
title={`Delete ${numberOfSelectedRecords} ${
|
||||||
numberOfSelectedRecords === 1 ? `record` : 'records'
|
numberOfSelectedRecords === 1 ? `record` : 'records'
|
||||||
}`}
|
}`}
|
||||||
subtitle={`This action cannot be undone. This will permanently delete ${
|
subtitle={`Are you sure you want to delete ${
|
||||||
numberOfSelectedRecords === 1
|
numberOfSelectedRecords === 1
|
||||||
? 'this record'
|
? 'this record'
|
||||||
: 'these records'
|
: 'these records'
|
||||||
}`}
|
}? ${
|
||||||
|
numberOfSelectedRecords === 1 ? 'It' : 'They'
|
||||||
|
} can be recovered from the Options menu.`}
|
||||||
onConfirmClick={() => handleDeleteClick()}
|
onConfirmClick={() => handleDeleteClick()}
|
||||||
deleteButtonText={`Delete ${
|
deleteButtonText={`Delete ${
|
||||||
numberOfSelectedRecords > 1 ? 'Records' : 'Record'
|
numberOfSelectedRecords > 1 ? 'Records' : 'Record'
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export const useHandleToggleTrashColumnFilter = ({
|
|||||||
operand: ViewFilterOperand.IsNotEmpty,
|
operand: ViewFilterOperand.IsNotEmpty,
|
||||||
displayValue: '',
|
displayValue: '',
|
||||||
definition: {
|
definition: {
|
||||||
label: 'Trash',
|
label: `Deleted ${objectNameSingular}`,
|
||||||
iconName: 'IconTrash',
|
iconName: 'IconTrash',
|
||||||
fieldMetadataId: trashFieldMetadata.id,
|
fieldMetadataId: trashFieldMetadata.id,
|
||||||
type: filterType,
|
type: filterType,
|
||||||
@ -61,7 +61,12 @@ export const useHandleToggleTrashColumnFilter = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
upsertCombinedViewFilter(newFilter);
|
upsertCombinedViewFilter(newFilter);
|
||||||
}, [columnDefinitions, objectMetadataItem.fields, upsertCombinedViewFilter]);
|
}, [
|
||||||
|
columnDefinitions,
|
||||||
|
objectMetadataItem.fields,
|
||||||
|
objectNameSingular,
|
||||||
|
upsertCombinedViewFilter,
|
||||||
|
]);
|
||||||
|
|
||||||
return handleToggleTrashColumnFilter;
|
return handleToggleTrashColumnFilter;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -166,7 +166,7 @@ export const RecordIndexOptionsDropdownContent = ({
|
|||||||
closeDropdown();
|
closeDropdown();
|
||||||
}}
|
}}
|
||||||
LeftIcon={IconTrash}
|
LeftIcon={IconTrash}
|
||||||
text="Trash"
|
text={`Deleted ${objectNameSingular}`}
|
||||||
/>
|
/>
|
||||||
</DropdownMenuItemsContainer>
|
</DropdownMenuItemsContainer>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable no-console */
|
||||||
import react from '@vitejs/plugin-react-swc';
|
import react from '@vitejs/plugin-react-swc';
|
||||||
import wyw from '@wyw-in-js/vite';
|
import wyw from '@wyw-in-js/vite';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
@ -8,13 +9,9 @@ import tsconfigPaths from 'vite-tsconfig-paths';
|
|||||||
|
|
||||||
type Checkers = Parameters<typeof checker>[0];
|
type Checkers = Parameters<typeof checker>[0];
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
|
||||||
export default defineConfig(({ command, mode }) => {
|
export default defineConfig(({ command, mode }) => {
|
||||||
const env = loadEnv(mode, process.cwd(), '');
|
const env = loadEnv(mode, process.cwd(), '');
|
||||||
|
|
||||||
/*
|
|
||||||
Using explicit env variables, there is no need to expose all of them (security).
|
|
||||||
*/
|
|
||||||
const {
|
const {
|
||||||
REACT_APP_SERVER_BASE_URL,
|
REACT_APP_SERVER_BASE_URL,
|
||||||
VITE_BUILD_SOURCEMAP,
|
VITE_BUILD_SOURCEMAP,
|
||||||
|
|||||||
@ -1,21 +1,9 @@
|
|||||||
import { DataSource } from 'typeorm';
|
import { DataSource } from 'typeorm';
|
||||||
|
|
||||||
import {
|
import { seedUsers } from 'src/database/typeorm-seeds/core/users';
|
||||||
seedUsers,
|
import { seedWorkspaces } from 'src/database/typeorm-seeds/core/workspaces';
|
||||||
deleteUsersByWorkspace,
|
import { seedFeatureFlags } from 'src/database/typeorm-seeds/core/feature-flags';
|
||||||
} from 'src/database/typeorm-seeds/core/users';
|
import { seedUserWorkspaces } from 'src/database/typeorm-seeds/core/userWorkspaces';
|
||||||
import {
|
|
||||||
seedWorkspaces,
|
|
||||||
deleteWorkspaces,
|
|
||||||
} from 'src/database/typeorm-seeds/core/workspaces';
|
|
||||||
import {
|
|
||||||
seedFeatureFlags,
|
|
||||||
deleteFeatureFlags,
|
|
||||||
} from 'src/database/typeorm-seeds/core/feature-flags';
|
|
||||||
import {
|
|
||||||
deleteUserWorkspaces,
|
|
||||||
seedUserWorkspaces,
|
|
||||||
} from 'src/database/typeorm-seeds/core/userWorkspaces';
|
|
||||||
|
|
||||||
export const seedCoreSchema = async (
|
export const seedCoreSchema = async (
|
||||||
workspaceDataSource: DataSource,
|
workspaceDataSource: DataSource,
|
||||||
@ -28,16 +16,3 @@ export const seedCoreSchema = async (
|
|||||||
await seedUserWorkspaces(workspaceDataSource, schemaName, workspaceId);
|
await seedUserWorkspaces(workspaceDataSource, schemaName, workspaceId);
|
||||||
await seedFeatureFlags(workspaceDataSource, schemaName, workspaceId);
|
await seedFeatureFlags(workspaceDataSource, schemaName, workspaceId);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteCoreSchema = async (
|
|
||||||
workspaceDataSource: DataSource,
|
|
||||||
workspaceId: string,
|
|
||||||
) => {
|
|
||||||
const schemaName = 'core';
|
|
||||||
|
|
||||||
await deleteUserWorkspaces(workspaceDataSource, schemaName, workspaceId);
|
|
||||||
await deleteUsersByWorkspace(workspaceDataSource, schemaName, workspaceId);
|
|
||||||
await deleteFeatureFlags(workspaceDataSource, schemaName, workspaceId);
|
|
||||||
// deleteWorkspaces should be last
|
|
||||||
await deleteWorkspaces(workspaceDataSource, schemaName, workspaceId);
|
|
||||||
};
|
|
||||||
|
|||||||
@ -75,9 +75,6 @@ export class GraphQLConfigService
|
|||||||
|
|
||||||
const data = await this.tokenService.validateToken(context.req);
|
const data = await this.tokenService.validateToken(context.req);
|
||||||
|
|
||||||
user = data.user;
|
|
||||||
workspace = data.workspace;
|
|
||||||
|
|
||||||
return await this.createSchema(context, data);
|
return await this.createSchema(context, data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof UnauthorizedException) {
|
if (error instanceof UnauthorizedException) {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
@ -14,8 +14,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class CreateManyQueryFactory {
|
export class CreateManyQueryFactory {
|
||||||
private readonly logger = new Logger(CreateManyQueryFactory.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||||
private readonly argsAliasFactory: ArgsAliasFactory,
|
private readonly argsAliasFactory: ArgsAliasFactory,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
||||||
import { DeleteOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver-builder/interfaces/workspace-resolvers-builder.interface';
|
import { DeleteOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver-builder/interfaces/workspace-resolvers-builder.interface';
|
||||||
@ -9,8 +9,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DeleteOneQueryFactory {
|
export class DeleteOneQueryFactory {
|
||||||
private readonly logger = new Logger(DeleteOneQueryFactory.name);
|
|
||||||
|
|
||||||
constructor(private readonly fieldsStringFactory: FieldsStringFactory) {}
|
constructor(private readonly fieldsStringFactory: FieldsStringFactory) {}
|
||||||
|
|
||||||
async create(
|
async create(
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { GraphQLResolveInfo } from 'graphql';
|
import { GraphQLResolveInfo } from 'graphql';
|
||||||
import graphqlFields from 'graphql-fields';
|
import graphqlFields from 'graphql-fields';
|
||||||
@ -15,8 +15,6 @@ import { RelationFieldAliasFactory } from './relation-field-alias.factory';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FieldsStringFactory {
|
export class FieldsStringFactory {
|
||||||
private readonly logger = new Logger(FieldsStringFactory.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly fieldAliasFactory: FieldAliasFactory,
|
private readonly fieldAliasFactory: FieldAliasFactory,
|
||||||
private readonly relationFieldAliasFactory: RelationFieldAliasFactory,
|
private readonly relationFieldAliasFactory: RelationFieldAliasFactory,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import isEmpty from 'lodash.isempty';
|
import isEmpty from 'lodash.isempty';
|
||||||
|
|
||||||
@ -15,8 +15,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FindDuplicatesQueryFactory {
|
export class FindDuplicatesQueryFactory {
|
||||||
private readonly logger = new Logger(FindDuplicatesQueryFactory.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||||
private readonly argsAliasFactory: ArgsAliasFactory,
|
private readonly argsAliasFactory: ArgsAliasFactory,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
RecordFilter,
|
RecordFilter,
|
||||||
@ -14,8 +14,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FindManyQueryFactory {
|
export class FindManyQueryFactory {
|
||||||
private readonly logger = new Logger(FindManyQueryFactory.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||||
private readonly argsStringFactory: ArgsStringFactory,
|
private readonly argsStringFactory: ArgsStringFactory,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
||||||
import { RecordFilter } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface';
|
import { RecordFilter } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface';
|
||||||
@ -11,8 +11,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class FindOneQueryFactory {
|
export class FindOneQueryFactory {
|
||||||
private readonly logger = new Logger(FindOneQueryFactory.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||||
private readonly argsStringFactory: ArgsStringFactory,
|
private readonly argsStringFactory: ArgsStringFactory,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { forwardRef, Inject, Injectable, Logger } from '@nestjs/common';
|
import { forwardRef, Inject, Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { GraphQLResolveInfo } from 'graphql';
|
import { GraphQLResolveInfo } from 'graphql';
|
||||||
|
|
||||||
@ -20,8 +20,6 @@ import { ArgsStringFactory } from './args-string.factory';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RelationFieldAliasFactory {
|
export class RelationFieldAliasFactory {
|
||||||
private logger = new Logger(RelationFieldAliasFactory.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => FieldsStringFactory))
|
@Inject(forwardRef(() => FieldsStringFactory))
|
||||||
private readonly fieldsStringFactory: CircularDep<FieldsStringFactory>,
|
private readonly fieldsStringFactory: CircularDep<FieldsStringFactory>,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { Record as IRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface';
|
import { Record as IRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface';
|
||||||
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
||||||
@ -12,8 +12,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UpdateOneQueryFactory {
|
export class UpdateOneQueryFactory {
|
||||||
private readonly logger = new Logger(UpdateOneQueryFactory.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||||
private readonly argsAliasFactory: ArgsAliasFactory,
|
private readonly argsAliasFactory: ArgsAliasFactory,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
||||||
import {
|
import {
|
||||||
@ -34,8 +34,6 @@ import { FindDuplicatesQueryFactory } from './factories/find-duplicates-query.fa
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceQueryBuilderFactory {
|
export class WorkspaceQueryBuilderFactory {
|
||||||
private readonly logger = new Logger(WorkspaceQueryBuilderFactory.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly findManyQueryFactory: FindManyQueryFactory,
|
private readonly findManyQueryFactory: FindManyQueryFactory,
|
||||||
private readonly findOneQueryFactory: FindOneQueryFactory,
|
private readonly findOneQueryFactory: FindOneQueryFactory,
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { TestingModule, Test } from '@nestjs/testing';
|
import { Test, TestingModule } from '@nestjs/testing';
|
||||||
|
|
||||||
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service';
|
|
||||||
import { RecordPositionQueryFactory } from 'src/engine/api/graphql/workspace-query-builder/factories/record-position-query.factory';
|
import { RecordPositionQueryFactory } from 'src/engine/api/graphql/workspace-query-builder/factories/record-position-query.factory';
|
||||||
import { RecordPositionFactory } from 'src/engine/api/graphql/workspace-query-runner/factories/record-position.factory';
|
import { RecordPositionFactory } from 'src/engine/api/graphql/workspace-query-runner/factories/record-position.factory';
|
||||||
|
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service';
|
||||||
|
|
||||||
describe('RecordPositionFactory', () => {
|
describe('RecordPositionFactory', () => {
|
||||||
const recordPositionQueryFactory = {
|
const recordPositionQueryFactory = {
|
||||||
create: jest.fn().mockResolvedValue('query'),
|
create: jest.fn().mockReturnValue(['query', []]),
|
||||||
};
|
};
|
||||||
|
|
||||||
let workspaceDataSourceService;
|
let workspaceDataSourceService;
|
||||||
|
|||||||
@ -134,7 +134,7 @@ export class QueryRunnerArgsFactory {
|
|||||||
),
|
),
|
||||||
];
|
];
|
||||||
case FieldMetadataType.NUMBER:
|
case FieldMetadataType.NUMBER:
|
||||||
return [key, await Promise.resolve(Number(value))];
|
return [key, Number(value)];
|
||||||
default:
|
default:
|
||||||
return [key, await Promise.resolve(value)];
|
return [key, await Promise.resolve(value)];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,7 +64,7 @@ export class RecordPositionFactory {
|
|||||||
dataSourceSchema: string,
|
dataSourceSchema: string,
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
) {
|
) {
|
||||||
const [query, params] = await this.recordPositionQueryFactory.create(
|
const [query, params] = this.recordPositionQueryFactory.create(
|
||||||
recordPositionQueryArgs,
|
recordPositionQueryArgs,
|
||||||
objectMetadata,
|
objectMetadata,
|
||||||
dataSourceSchema,
|
dataSourceSchema,
|
||||||
|
|||||||
@ -66,10 +66,4 @@ export class WorkspaceQueryHookStorage {
|
|||||||
|
|
||||||
this.postHookInstances.get(key)?.push(data);
|
this.postHookInstances.get(key)?.push(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWorkspaceQueryPostHookInstances(
|
|
||||||
key: WorkspaceQueryHookKey,
|
|
||||||
): WorkspaceQueryHookData<WorkspaceQueryHookInstance>[] | undefined {
|
|
||||||
return this.postHookInstances.get(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { WorkspaceQueryHookOptions } from 'src/engine/api/graphql/workspace-quer
|
|||||||
export class WorkspaceQueryHookMetadataAccessor {
|
export class WorkspaceQueryHookMetadataAccessor {
|
||||||
constructor(private readonly reflector: Reflector) {}
|
constructor(private readonly reflector: Reflector) {}
|
||||||
|
|
||||||
isWorkspaceQueryHook(target: Type<any> | Function): boolean {
|
isWorkspaceQueryHook(target: Type | Function): boolean {
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -18,7 +18,7 @@ export class WorkspaceQueryHookMetadataAccessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getWorkspaceQueryHookMetadata(
|
getWorkspaceQueryHookMetadata(
|
||||||
target: Type<any> | Function,
|
target: Type | Function,
|
||||||
): WorkspaceQueryHookOptions | undefined {
|
): WorkspaceQueryHookOptions | undefined {
|
||||||
return this.reflector.get(WORKSPACE_QUERY_HOOK_METADATA, target);
|
return this.reflector.get(WORKSPACE_QUERY_HOOK_METADATA, target);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1011,17 +1011,6 @@ export class WorkspaceQueryRunnerService {
|
|||||||
return parseResult(resultWithGetters);
|
return parseResult(resultWithGetters);
|
||||||
}
|
}
|
||||||
|
|
||||||
async executeAndParse<Result>(
|
|
||||||
query: string,
|
|
||||||
objectMetadataItem: ObjectMetadataInterface,
|
|
||||||
command: string,
|
|
||||||
workspaceId: string,
|
|
||||||
): Promise<Result> {
|
|
||||||
const result = await this.execute(query, workspaceId);
|
|
||||||
|
|
||||||
return this.parseResult(result, objectMetadataItem, command, workspaceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
async triggerWebhooks<Record>(
|
async triggerWebhooks<Record>(
|
||||||
jobsData: Record[] | undefined,
|
jobsData: Record[] | undefined,
|
||||||
operation: CallWebhookJobsJobOperation,
|
operation: CallWebhookJobsJobOperation,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { GraphQLFieldConfigMap, GraphQLInt, GraphQLObjectType } from 'graphql';
|
import { GraphQLFieldConfigMap, GraphQLInt, GraphQLObjectType } from 'graphql';
|
||||||
|
|
||||||
@ -20,8 +20,6 @@ export enum ConnectionTypeDefinitionKind {
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ConnectionTypeDefinitionFactory {
|
export class ConnectionTypeDefinitionFactory {
|
||||||
private readonly logger = new Logger(ConnectionTypeDefinitionFactory.name);
|
|
||||||
|
|
||||||
constructor(private readonly connectionTypeFactory: ConnectionTypeFactory) {}
|
constructor(private readonly connectionTypeFactory: ConnectionTypeFactory) {}
|
||||||
|
|
||||||
public create(
|
public create(
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { GraphQLFieldConfigMap, GraphQLObjectType } from 'graphql';
|
import { GraphQLFieldConfigMap, GraphQLObjectType } from 'graphql';
|
||||||
|
|
||||||
@ -20,8 +20,6 @@ export enum EdgeTypeDefinitionKind {
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class EdgeTypeDefinitionFactory {
|
export class EdgeTypeDefinitionFactory {
|
||||||
private readonly logger = new Logger(EdgeTypeDefinitionFactory.name);
|
|
||||||
|
|
||||||
constructor(private readonly edgeTypeFactory: EdgeTypeFactory) {}
|
constructor(private readonly edgeTypeFactory: EdgeTypeFactory) {}
|
||||||
|
|
||||||
public create(
|
public create(
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
|
|
||||||
|
|
||||||
import { FilterIs } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/filter-is.input-type';
|
|
||||||
import { DateTimeScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
|
||||||
|
|
||||||
export const DatetimeFilterType = new GraphQLInputObjectType({
|
|
||||||
name: 'DateTimeFilter',
|
|
||||||
fields: {
|
|
||||||
eq: { type: DateTimeScalarType },
|
|
||||||
gt: { type: DateTimeScalarType },
|
|
||||||
gte: { type: DateTimeScalarType },
|
|
||||||
in: { type: new GraphQLList(new GraphQLNonNull(DateTimeScalarType)) },
|
|
||||||
lt: { type: DateTimeScalarType },
|
|
||||||
lte: { type: DateTimeScalarType },
|
|
||||||
neq: { type: DateTimeScalarType },
|
|
||||||
is: { type: FilterIs },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -2,10 +2,7 @@ export * from './big-float-filter.input-type';
|
|||||||
export * from './big-int-filter.input-type';
|
export * from './big-int-filter.input-type';
|
||||||
export * from './boolean-filter.input-type';
|
export * from './boolean-filter.input-type';
|
||||||
export * from './date-filter.input-type';
|
export * from './date-filter.input-type';
|
||||||
export * from './date-time-filter.input-type';
|
|
||||||
export * from './float-filter.input-type';
|
export * from './float-filter.input-type';
|
||||||
export * from './int-filter.input-type';
|
export * from './int-filter.input-type';
|
||||||
export * from './raw-json-filter.input-type';
|
export * from './raw-json-filter.input-type';
|
||||||
export * from './string-filter.input-type';
|
export * from './string-filter.input-type';
|
||||||
export * from './time-filter.input-type';
|
|
||||||
export * from './uuid-filter.input-type';
|
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
|
|
||||||
|
|
||||||
import { FilterIs } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/filter-is.input-type';
|
|
||||||
import { TimeScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
|
||||||
|
|
||||||
export const TimeFilterType = new GraphQLInputObjectType({
|
|
||||||
name: 'TimeFilter',
|
|
||||||
fields: {
|
|
||||||
eq: { type: TimeScalarType },
|
|
||||||
gt: { type: TimeScalarType },
|
|
||||||
gte: { type: TimeScalarType },
|
|
||||||
in: { type: new GraphQLList(new GraphQLNonNull(TimeScalarType)) },
|
|
||||||
lt: { type: TimeScalarType },
|
|
||||||
lte: { type: TimeScalarType },
|
|
||||||
neq: { type: TimeScalarType },
|
|
||||||
is: { type: FilterIs },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
import { GraphQLInputObjectType, GraphQLList } from 'graphql';
|
|
||||||
|
|
||||||
import { FilterIs } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/filter-is.input-type';
|
|
||||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
|
||||||
|
|
||||||
export const UUIDFilterType = new GraphQLInputObjectType({
|
|
||||||
name: 'UUIDFilter',
|
|
||||||
fields: {
|
|
||||||
eq: { type: UUIDScalarType },
|
|
||||||
in: { type: new GraphQLList(UUIDScalarType) },
|
|
||||||
neq: { type: UUIDScalarType },
|
|
||||||
is: { type: FilterIs },
|
|
||||||
},
|
|
||||||
});
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { GraphQLSchema } from 'graphql';
|
import { GraphQLSchema } from 'graphql';
|
||||||
|
|
||||||
@ -14,8 +14,6 @@ import { OrphanedTypesFactory } from './factories/orphaned-types.factory';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceGraphQLSchemaFactory {
|
export class WorkspaceGraphQLSchemaFactory {
|
||||||
private readonly logger = new Logger(WorkspaceGraphQLSchemaFactory.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly typeDefinitionsGenerator: TypeDefinitionsGenerator,
|
private readonly typeDefinitionsGenerator: TypeDefinitionsGenerator,
|
||||||
private readonly queryTypeFactory: QueryTypeFactory,
|
private readonly queryTypeFactory: QueryTypeFactory,
|
||||||
|
|||||||
@ -96,7 +96,7 @@ export class AISQLQueryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getCreateTableStatement(tableName: string, colInfos: any[]) {
|
private getCreateTableStatement(tableName: string, colInfos: any[]) {
|
||||||
return `${`CREATE TABLE ${tableName} (\n`} ${colInfos
|
return `CREATE TABLE ${tableName} (\n ${colInfos
|
||||||
.map(
|
.map(
|
||||||
(colInfo) =>
|
(colInfo) =>
|
||||||
`${colInfo.column_name} ${colInfo.data_type} ${
|
`${colInfo.column_name} ${colInfo.data_type} ${
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { v4 as uuidv4 } from 'uuid';
|
|||||||
import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
|
import { AppToken } from 'src/engine/core-modules/app-token/app-token.entity';
|
||||||
|
|
||||||
export class BeforeCreateOneAppToken<T extends AppToken>
|
export class BeforeCreateOneAppToken<T extends AppToken>
|
||||||
implements BeforeCreateOneHook<T, any>
|
implements BeforeCreateOneHook<T>
|
||||||
{
|
{
|
||||||
async run(
|
async run(
|
||||||
instance: CreateOneInputType<T>,
|
instance: CreateOneInputType<T>,
|
||||||
|
|||||||
@ -10,6 +10,7 @@ export class AuthException extends CustomException {
|
|||||||
export enum AuthExceptionCode {
|
export enum AuthExceptionCode {
|
||||||
USER_NOT_FOUND = 'USER_NOT_FOUND',
|
USER_NOT_FOUND = 'USER_NOT_FOUND',
|
||||||
CLIENT_NOT_FOUND = 'CLIENT_NOT_FOUND',
|
CLIENT_NOT_FOUND = 'CLIENT_NOT_FOUND',
|
||||||
|
WORKSPACE_NOT_FOUND = 'WORKSPACE_NOT_FOUND',
|
||||||
INVALID_INPUT = 'INVALID_INPUT',
|
INVALID_INPUT = 'INVALID_INPUT',
|
||||||
FORBIDDEN_EXCEPTION = 'FORBIDDEN_EXCEPTION',
|
FORBIDDEN_EXCEPTION = 'FORBIDDEN_EXCEPTION',
|
||||||
UNAUTHENTICATED = 'UNAUTHENTICATED',
|
UNAUTHENTICATED = 'UNAUTHENTICATED',
|
||||||
|
|||||||
@ -72,7 +72,7 @@ export class GoogleAPIsAuthController {
|
|||||||
if (!workspaceId) {
|
if (!workspaceId) {
|
||||||
throw new AuthException(
|
throw new AuthException(
|
||||||
'Workspace not found',
|
'Workspace not found',
|
||||||
AuthExceptionCode.INVALID_INPUT,
|
AuthExceptionCode.WORKSPACE_NOT_FOUND,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,6 @@ import {
|
|||||||
export class AuthGraphqlApiExceptionFilter implements ExceptionFilter {
|
export class AuthGraphqlApiExceptionFilter implements ExceptionFilter {
|
||||||
catch(exception: AuthException) {
|
catch(exception: AuthException) {
|
||||||
switch (exception.code) {
|
switch (exception.code) {
|
||||||
case AuthExceptionCode.USER_NOT_FOUND:
|
|
||||||
case AuthExceptionCode.CLIENT_NOT_FOUND:
|
case AuthExceptionCode.CLIENT_NOT_FOUND:
|
||||||
throw new NotFoundError(exception.message);
|
throw new NotFoundError(exception.message);
|
||||||
case AuthExceptionCode.INVALID_INPUT:
|
case AuthExceptionCode.INVALID_INPUT:
|
||||||
@ -24,6 +23,8 @@ export class AuthGraphqlApiExceptionFilter implements ExceptionFilter {
|
|||||||
case AuthExceptionCode.FORBIDDEN_EXCEPTION:
|
case AuthExceptionCode.FORBIDDEN_EXCEPTION:
|
||||||
throw new ForbiddenError(exception.message);
|
throw new ForbiddenError(exception.message);
|
||||||
case AuthExceptionCode.UNAUTHENTICATED:
|
case AuthExceptionCode.UNAUTHENTICATED:
|
||||||
|
case AuthExceptionCode.USER_NOT_FOUND:
|
||||||
|
case AuthExceptionCode.WORKSPACE_NOT_FOUND:
|
||||||
throw new AuthenticationError(exception.message);
|
throw new AuthenticationError(exception.message);
|
||||||
case AuthExceptionCode.INVALID_DATA:
|
case AuthExceptionCode.INVALID_DATA:
|
||||||
case AuthExceptionCode.INTERNAL_SERVER_ERROR:
|
case AuthExceptionCode.INTERNAL_SERVER_ERROR:
|
||||||
|
|||||||
@ -41,12 +41,6 @@ import { EnvironmentService } from 'src/engine/integrations/environment/environm
|
|||||||
|
|
||||||
import { TokenService } from './token.service';
|
import { TokenService } from './token.service';
|
||||||
|
|
||||||
export type UserPayload = {
|
|
||||||
firstName: string;
|
|
||||||
lastName: string;
|
|
||||||
email: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
constructor(
|
constructor(
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export class JwtAuthStrategy extends PassportStrategy(Strategy, 'jwt') {
|
|||||||
if (!workspace) {
|
if (!workspace) {
|
||||||
throw new AuthException(
|
throw new AuthException(
|
||||||
'Workspace not found',
|
'Workspace not found',
|
||||||
AuthExceptionCode.INVALID_INPUT,
|
AuthExceptionCode.WORKSPACE_NOT_FOUND,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -38,7 +38,7 @@ export class FileService {
|
|||||||
|
|
||||||
const expirationDate = addMilliseconds(new Date(), ms(fileTokenExpiresIn));
|
const expirationDate = addMilliseconds(new Date(), ms(fileTokenExpiresIn));
|
||||||
|
|
||||||
const signedPayload = await this.jwtWrapperService.sign(
|
const signedPayload = this.jwtWrapperService.sign(
|
||||||
{
|
{
|
||||||
expiration_date: expirationDate,
|
expiration_date: expirationDate,
|
||||||
...payloadToEncode,
|
...payloadToEncode,
|
||||||
|
|||||||
@ -115,12 +115,6 @@ export class WorkspaceService extends TypeOrmQueryService<Workspace> {
|
|||||||
return workspace;
|
return workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getWorkspaceIds() {
|
|
||||||
return this.workspaceRepository
|
|
||||||
.find()
|
|
||||||
.then((workspaces) => workspaces.map((workspace) => workspace.id));
|
|
||||||
}
|
|
||||||
|
|
||||||
async handleRemoveWorkspaceMember(workspaceId: string, userId: string) {
|
async handleRemoveWorkspaceMember(workspaceId: string, userId: string) {
|
||||||
await this.userWorkspaceRepository.delete({
|
await this.userWorkspaceRepository.delete({
|
||||||
userId,
|
userId,
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
|
|
||||||
|
|
||||||
import { getRequest } from 'src/utils/extract-request';
|
|
||||||
|
|
||||||
export const UserAbility = createParamDecorator(
|
|
||||||
(_: unknown, context: ExecutionContext) => {
|
|
||||||
const request = getRequest(context);
|
|
||||||
|
|
||||||
return request.ability;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
@ -3,9 +3,6 @@ import { Logger } from '@nestjs/common';
|
|||||||
/**
|
/**
|
||||||
* A decorator function that logs the execution time of the decorated method.
|
* A decorator function that logs the execution time of the decorated method.
|
||||||
*
|
*
|
||||||
* @param target The target class of the decorated method.
|
|
||||||
* @param propertyKey The name of the decorated method.
|
|
||||||
* @param descriptor The property descriptor of the decorated method.
|
|
||||||
* @returns The modified property descriptor with the execution time logging functionality.
|
* @returns The modified property descriptor with the execution time logging functionality.
|
||||||
*/
|
*/
|
||||||
export function LogExecutionTime() {
|
export function LogExecutionTime() {
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
import {
|
import { ConfigurableModuleBuilder } from '@nestjs/common';
|
||||||
ConfigurableModuleBuilder,
|
|
||||||
FactoryProvider,
|
|
||||||
ModuleMetadata,
|
|
||||||
} from '@nestjs/common';
|
|
||||||
|
|
||||||
import { ExceptionHandlerModuleOptions } from './interfaces';
|
import { ExceptionHandlerModuleOptions } from './interfaces';
|
||||||
|
|
||||||
@ -16,10 +12,3 @@ export const {
|
|||||||
})
|
})
|
||||||
.setClassMethodName('forRoot')
|
.setClassMethodName('forRoot')
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
export type ExceptionHandlerModuleAsyncOptions = {
|
|
||||||
useFactory: (
|
|
||||||
...args: any[]
|
|
||||||
) => ExceptionHandlerModuleOptions | Promise<ExceptionHandlerModuleOptions>;
|
|
||||||
} & Pick<ModuleMetadata, 'imports'> &
|
|
||||||
Pick<FactoryProvider, 'inject'>;
|
|
||||||
|
|||||||
@ -6,8 +6,9 @@ import { ExceptionHandlerDriver } from 'src/engine/integrations/exception-handle
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ExceptionHandler Module factory
|
* ExceptionHandler Module factory
|
||||||
* @param environment
|
|
||||||
* @returns ExceptionHandlerModuleOptions
|
* @returns ExceptionHandlerModuleOptions
|
||||||
|
* @param environmentService
|
||||||
|
* @param adapterHost
|
||||||
*/
|
*/
|
||||||
export const exceptionHandlerModuleFactory = async (
|
export const exceptionHandlerModuleFactory = async (
|
||||||
environmentService: EnvironmentService,
|
environmentService: EnvironmentService,
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import { resolveAbsolutePath } from 'src/utils/resolve-absolute-path';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* FileStorage Module factory
|
* FileStorage Module factory
|
||||||
* @param environment
|
|
||||||
* @returns FileStorageModuleOptions
|
* @returns FileStorageModuleOptions
|
||||||
|
* @param environmentService
|
||||||
*/
|
*/
|
||||||
export const fileStorageModuleFactory = async (
|
export const fileStorageModuleFactory = async (
|
||||||
environmentService: EnvironmentService,
|
environmentService: EnvironmentService,
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
import {
|
import { ConfigurableModuleBuilder } from '@nestjs/common';
|
||||||
ConfigurableModuleBuilder,
|
|
||||||
FactoryProvider,
|
|
||||||
ModuleMetadata,
|
|
||||||
} from '@nestjs/common';
|
|
||||||
|
|
||||||
import { LoggerModuleOptions } from './interfaces';
|
import { LoggerModuleOptions } from './interfaces';
|
||||||
|
|
||||||
@ -16,10 +12,3 @@ export const {
|
|||||||
})
|
})
|
||||||
.setClassMethodName('forRoot')
|
.setClassMethodName('forRoot')
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
export type LoggerModuleAsyncOptions = {
|
|
||||||
useFactory: (
|
|
||||||
...args: any[]
|
|
||||||
) => LoggerModuleOptions | Promise<LoggerModuleOptions>;
|
|
||||||
} & Pick<ModuleMetadata, 'imports'> &
|
|
||||||
Pick<FactoryProvider, 'inject'>;
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Logger Module factory
|
* Logger Module factory
|
||||||
* @param environment
|
|
||||||
* @returns LoggerModuleOptions
|
* @returns LoggerModuleOptions
|
||||||
|
* @param environmentService
|
||||||
*/
|
*/
|
||||||
export const loggerModuleFactory = async (
|
export const loggerModuleFactory = async (
|
||||||
environmentService: EnvironmentService,
|
environmentService: EnvironmentService,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import { MessageQueueDriver } from './interfaces/message-queue-driver.interface'
|
|||||||
export class SyncDriver implements MessageQueueDriver {
|
export class SyncDriver implements MessageQueueDriver {
|
||||||
private readonly logger = new Logger(SyncDriver.name);
|
private readonly logger = new Logger(SyncDriver.name);
|
||||||
private workersMap: {
|
private workersMap: {
|
||||||
[queueName: string]: (job: MessageQueueJob<any>) => Promise<void> | void;
|
[queueName: string]: (job: MessageQueueJob) => Promise<void> | void;
|
||||||
} = {};
|
} = {};
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|||||||
@ -2,21 +2,18 @@
|
|||||||
import { Injectable, Type } from '@nestjs/common';
|
import { Injectable, Type } from '@nestjs/common';
|
||||||
import { Reflector } from '@nestjs/core';
|
import { Reflector } from '@nestjs/core';
|
||||||
|
|
||||||
import { MessageQueueWorkerOptions } from 'src/engine/integrations/message-queue/interfaces/message-queue-worker-options.interface';
|
|
||||||
|
|
||||||
import { MessageQueueProcessOptions } from 'src/engine/integrations/message-queue/decorators/process.decorator';
|
import { MessageQueueProcessOptions } from 'src/engine/integrations/message-queue/decorators/process.decorator';
|
||||||
import { MessageQueueProcessorOptions } from 'src/engine/integrations/message-queue/decorators/processor.decorator';
|
import { MessageQueueProcessorOptions } from 'src/engine/integrations/message-queue/decorators/processor.decorator';
|
||||||
import {
|
import {
|
||||||
PROCESSOR_METADATA,
|
PROCESSOR_METADATA,
|
||||||
PROCESS_METADATA,
|
PROCESS_METADATA,
|
||||||
WORKER_METADATA,
|
|
||||||
} from 'src/engine/integrations/message-queue/message-queue.constants';
|
} from 'src/engine/integrations/message-queue/message-queue.constants';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MessageQueueMetadataAccessor {
|
export class MessageQueueMetadataAccessor {
|
||||||
constructor(private readonly reflector: Reflector) {}
|
constructor(private readonly reflector: Reflector) {}
|
||||||
|
|
||||||
isProcessor(target: Type<any> | Function): boolean {
|
isProcessor(target: Type | Function): boolean {
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -24,7 +21,7 @@ export class MessageQueueMetadataAccessor {
|
|||||||
return !!this.reflector.get(PROCESSOR_METADATA, target);
|
return !!this.reflector.get(PROCESSOR_METADATA, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
isProcess(target: Type<any> | Function): boolean {
|
isProcess(target: Type | Function): boolean {
|
||||||
if (!target) {
|
if (!target) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -33,22 +30,16 @@ export class MessageQueueMetadataAccessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getProcessorMetadata(
|
getProcessorMetadata(
|
||||||
target: Type<any> | Function,
|
target: Type | Function,
|
||||||
): MessageQueueProcessorOptions | undefined {
|
): MessageQueueProcessorOptions | undefined {
|
||||||
return this.reflector.get(PROCESSOR_METADATA, target);
|
return this.reflector.get(PROCESSOR_METADATA, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
getProcessMetadata(
|
getProcessMetadata(
|
||||||
target: Type<any> | Function,
|
target: Type | Function,
|
||||||
): MessageQueueProcessOptions | undefined {
|
): MessageQueueProcessOptions | undefined {
|
||||||
const metadata = this.reflector.get(PROCESS_METADATA, target);
|
const metadata = this.reflector.get(PROCESS_METADATA, target);
|
||||||
|
|
||||||
return metadata;
|
return metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
getWorkerOptionsMetadata(
|
|
||||||
target: Type<any> | Function,
|
|
||||||
): MessageQueueWorkerOptions {
|
|
||||||
return this.reflector.get(WORKER_METADATA, target) ?? {};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* MessageQueue Module factory
|
* MessageQueue Module factory
|
||||||
* @param environment
|
|
||||||
* @returns MessageQueueModuleOptions
|
* @returns MessageQueueModuleOptions
|
||||||
|
* @param environmentService
|
||||||
*/
|
*/
|
||||||
export const messageQueueModuleFactory = async (
|
export const messageQueueModuleFactory = async (
|
||||||
environmentService: EnvironmentService,
|
environmentService: EnvironmentService,
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
export function getJobClassName(name: string): string {
|
|
||||||
const [, jobName] = name.split('.') ?? [];
|
|
||||||
|
|
||||||
return jobName ?? name;
|
|
||||||
}
|
|
||||||
@ -1,5 +1,4 @@
|
|||||||
import { CompositeType } from 'src/engine/metadata-modules/field-metadata/interfaces/composite-type.interface';
|
import { CompositeType } from 'src/engine/metadata-modules/field-metadata/interfaces/composite-type.interface';
|
||||||
import { FieldMetadataInterface } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata.interface';
|
|
||||||
|
|
||||||
import { actorCompositeType } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type';
|
import { actorCompositeType } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type';
|
||||||
import { addressCompositeType } from 'src/engine/metadata-modules/field-metadata/composite-types/address.composite-type';
|
import { addressCompositeType } from 'src/engine/metadata-modules/field-metadata/composite-types/address.composite-type';
|
||||||
@ -10,10 +9,6 @@ import { linkCompositeType } from 'src/engine/metadata-modules/field-metadata/co
|
|||||||
import { linksCompositeType } from 'src/engine/metadata-modules/field-metadata/composite-types/links.composite-type';
|
import { linksCompositeType } from 'src/engine/metadata-modules/field-metadata/composite-types/links.composite-type';
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
|
|
||||||
export type CompositeFieldsDefinitionFunction = (
|
|
||||||
fieldMetadata?: FieldMetadataInterface,
|
|
||||||
) => FieldMetadataInterface[];
|
|
||||||
|
|
||||||
export const compositeTypeDefinitions = new Map<
|
export const compositeTypeDefinitions = new Map<
|
||||||
FieldMetadataType,
|
FieldMetadataType,
|
||||||
CompositeType
|
CompositeType
|
||||||
|
|||||||
@ -94,7 +94,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const fieldMetadataRepository =
|
const fieldMetadataRepository =
|
||||||
queryRunner.manager.getRepository<FieldMetadataEntity<'default'>>(
|
queryRunner.manager.getRepository<FieldMetadataEntity>(
|
||||||
FieldMetadataEntity,
|
FieldMetadataEntity,
|
||||||
);
|
);
|
||||||
const objectMetadata =
|
const objectMetadata =
|
||||||
@ -304,7 +304,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const fieldMetadataRepository =
|
const fieldMetadataRepository =
|
||||||
queryRunner.manager.getRepository<FieldMetadataEntity<'default'>>(
|
queryRunner.manager.getRepository<FieldMetadataEntity>(
|
||||||
FieldMetadataEntity,
|
FieldMetadataEntity,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const fieldMetadataRepository =
|
const fieldMetadataRepository =
|
||||||
queryRunner.manager.getRepository<FieldMetadataEntity<'default'>>(
|
queryRunner.manager.getRepository<FieldMetadataEntity>(
|
||||||
FieldMetadataEntity,
|
FieldMetadataEntity,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -614,13 +614,6 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async deleteFieldsMetadata(workspaceId: string) {
|
|
||||||
await this.fieldMetadataRepository.delete({ workspaceId });
|
|
||||||
await this.workspaceMetadataVersionService.incrementMetadataVersion(
|
|
||||||
workspaceId,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private buildUpdatableStandardFieldInput(
|
private buildUpdatableStandardFieldInput(
|
||||||
fieldMetadataInput: UpdateFieldInput,
|
fieldMetadataInput: UpdateFieldInput,
|
||||||
existingFieldMetadata: FieldMetadataEntity,
|
existingFieldMetadata: FieldMetadataEntity,
|
||||||
|
|||||||
@ -52,12 +52,4 @@ export class IsFieldMetadataOptions {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultMessage(): string {
|
|
||||||
if (this.validationErrors.length > 0) {
|
|
||||||
return this.validationErrors.join(', ');
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'FieldMetadataOptions is not valid';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { CreateObjectInput } from 'src/engine/metadata-modules/object-metadata/d
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BeforeCreateOneObject<T extends CreateObjectInput>
|
export class BeforeCreateOneObject<T extends CreateObjectInput>
|
||||||
implements BeforeCreateOneHook<T, any>
|
implements BeforeCreateOneHook<T>
|
||||||
{
|
{
|
||||||
async run(
|
async run(
|
||||||
instance: CreateOneInputType<T>,
|
instance: CreateOneInputType<T>,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
import { ObjectMetadataService } from 'src/engine/metadata-modules/object-metadata/object-metadata.service';
|
import { ObjectMetadataService } from 'src/engine/metadata-modules/object-metadata/object-metadata.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BeforeDeleteOneObject implements BeforeDeleteOneHook<any> {
|
export class BeforeDeleteOneObject implements BeforeDeleteOneHook {
|
||||||
constructor(readonly objectMetadataService: ObjectMetadataService) {}
|
constructor(readonly objectMetadataService: ObjectMetadataService) {}
|
||||||
|
|
||||||
async run(
|
async run(
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadat
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BeforeUpdateOneObject<T extends UpdateObjectPayload>
|
export class BeforeUpdateOneObject<T extends UpdateObjectPayload>
|
||||||
implements BeforeUpdateOneHook<T, any>
|
implements BeforeUpdateOneHook<T>
|
||||||
{
|
{
|
||||||
constructor(
|
constructor(
|
||||||
readonly objectMetadataService: ObjectMetadataService,
|
readonly objectMetadataService: ObjectMetadataService,
|
||||||
|
|||||||
@ -399,31 +399,6 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async findOneOrFailWithinWorkspace(
|
|
||||||
workspaceId: string,
|
|
||||||
options: FindOneOptions<ObjectMetadataEntity>,
|
|
||||||
): Promise<ObjectMetadataEntity> {
|
|
||||||
try {
|
|
||||||
return this.objectMetadataRepository.findOneOrFail({
|
|
||||||
relations: [
|
|
||||||
'fields',
|
|
||||||
'fields.fromRelationMetadata',
|
|
||||||
'fields.toRelationMetadata',
|
|
||||||
],
|
|
||||||
...options,
|
|
||||||
where: {
|
|
||||||
...options.where,
|
|
||||||
workspaceId,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
throw new ObjectMetadataException(
|
|
||||||
'Object does not exist',
|
|
||||||
ObjectMetadataExceptionCode.OBJECT_METADATA_NOT_FOUND,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async findManyWithinWorkspace(
|
public async findManyWithinWorkspace(
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
options?: FindManyOptions<ObjectMetadataEntity>,
|
options?: FindManyOptions<ObjectMetadataEntity>,
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import { CreateRelationInput } from 'src/engine/metadata-modules/relation-metada
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BeforeCreateOneRelation<T extends CreateRelationInput>
|
export class BeforeCreateOneRelation<T extends CreateRelationInput>
|
||||||
implements BeforeCreateOneHook<T, any>
|
implements BeforeCreateOneHook<T>
|
||||||
{
|
{
|
||||||
async run(
|
async run(
|
||||||
instance: CreateOneInputType<T>,
|
instance: CreateOneInputType<T>,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
import { RelationMetadataService } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.service';
|
import { RelationMetadataService } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BeforeDeleteOneRelation implements BeforeDeleteOneHook<any> {
|
export class BeforeDeleteOneRelation implements BeforeDeleteOneHook {
|
||||||
constructor(readonly relationMetadataService: RelationMetadataService) {}
|
constructor(readonly relationMetadataService: RelationMetadataService) {}
|
||||||
|
|
||||||
async run(
|
async run(
|
||||||
|
|||||||
@ -601,7 +601,7 @@ export class RemoteTableService {
|
|||||||
columnName: string,
|
columnName: string,
|
||||||
columnType: string,
|
columnType: string,
|
||||||
objectMetadataId: string,
|
objectMetadataId: string,
|
||||||
): Promise<FieldMetadataEntity<'default'>> {
|
): Promise<FieldMetadataEntity> {
|
||||||
return this.fieldMetadataService.createOne({
|
return this.fieldMetadataService.createOne({
|
||||||
name: columnName,
|
name: columnName,
|
||||||
label: camelToTitleCase(columnName),
|
label: camelToTitleCase(columnName),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ArgsType, Field, InputType } from '@nestjs/graphql';
|
import { Field, InputType } from '@nestjs/graphql';
|
||||||
|
|
||||||
import { IsNotEmpty, IsObject, IsOptional, IsUUID } from 'class-validator';
|
import { IsNotEmpty, IsObject, IsOptional, IsUUID } from 'class-validator';
|
||||||
import graphqlTypeJson from 'graphql-type-json';
|
import graphqlTypeJson from 'graphql-type-json';
|
||||||
|
|||||||
@ -14,7 +14,6 @@ import {
|
|||||||
IsDateString,
|
IsDateString,
|
||||||
IsEnum,
|
IsEnum,
|
||||||
IsNotEmpty,
|
IsNotEmpty,
|
||||||
IsNumber,
|
|
||||||
IsString,
|
IsString,
|
||||||
IsUUID,
|
IsUUID,
|
||||||
} from 'class-validator';
|
} from 'class-validator';
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import {
|
|||||||
CreateDateColumn,
|
CreateDateColumn,
|
||||||
Entity,
|
Entity,
|
||||||
PrimaryGeneratedColumn,
|
PrimaryGeneratedColumn,
|
||||||
Unique,
|
|
||||||
UpdateDateColumn,
|
UpdateDateColumn,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
|
|
||||||
|
|||||||
@ -18,8 +18,8 @@ export class WorkspaceMigrationService {
|
|||||||
/**
|
/**
|
||||||
* Get all pending migrations for a given workspaceId
|
* Get all pending migrations for a given workspaceId
|
||||||
*
|
*
|
||||||
* @param workspaceId: string
|
|
||||||
* @returns Promise<WorkspaceMigration[]>
|
* @returns Promise<WorkspaceMigration[]>
|
||||||
|
* @param workspaceId
|
||||||
*/
|
*/
|
||||||
public async getPendingMigrations(
|
public async getPendingMigrations(
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
@ -53,8 +53,8 @@ export class WorkspaceMigrationService {
|
|||||||
* Set appliedAt as current date for a given migration.
|
* Set appliedAt as current date for a given migration.
|
||||||
* Should be called once the migration has been applied
|
* Should be called once the migration has been applied
|
||||||
*
|
*
|
||||||
* @param workspaceId: string
|
* @param workspaceId
|
||||||
* @param migration: WorkspaceMigration
|
* @param migration
|
||||||
*/
|
*/
|
||||||
public async setAppliedAtForMigration(
|
public async setAppliedAtForMigration(
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
@ -69,6 +69,7 @@ export class WorkspaceMigrationService {
|
|||||||
/**
|
/**
|
||||||
* Create a new pending migration for a given workspaceId and expected changes
|
* Create a new pending migration for a given workspaceId and expected changes
|
||||||
*
|
*
|
||||||
|
* @param name
|
||||||
* @param workspaceId
|
* @param workspaceId
|
||||||
* @param migrations
|
* @param migrations
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -36,8 +36,4 @@ export class WorkspaceDataSource extends DataSource {
|
|||||||
): WorkspaceEntityManager {
|
): WorkspaceEntityManager {
|
||||||
return new WorkspaceEntityManager(this.internalContext, this, queryRunner);
|
return new WorkspaceEntityManager(this.internalContext, this, queryRunner);
|
||||||
}
|
}
|
||||||
|
|
||||||
getWorkspaceId(): string {
|
|
||||||
return this.internalContext.workspaceId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,9 +57,7 @@ export function WorkspaceField<T extends FieldMetadataType>(
|
|||||||
) ?? false;
|
) ?? false;
|
||||||
|
|
||||||
const defaultValue = (options.defaultValue ??
|
const defaultValue = (options.defaultValue ??
|
||||||
generateDefaultValue(
|
generateDefaultValue(options.type)) as FieldMetadataDefaultValue | null;
|
||||||
options.type,
|
|
||||||
)) as FieldMetadataDefaultValue<'default'> | null;
|
|
||||||
|
|
||||||
metadataArgsStorage.addFields({
|
metadataArgsStorage.addFields({
|
||||||
target: object.constructor,
|
target: object.constructor,
|
||||||
|
|||||||
@ -3,10 +3,6 @@ import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args
|
|||||||
import { convertClassNameToObjectMetadataName } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/convert-class-to-object-metadata-name.util';
|
import { convertClassNameToObjectMetadataName } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/convert-class-to-object-metadata-name.util';
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
import { TypedReflect } from 'src/utils/typed-reflect';
|
||||||
|
|
||||||
export interface WorkspaceIndexOptions {
|
|
||||||
columns?: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function WorkspaceIndex(): PropertyDecorator;
|
export function WorkspaceIndex(): PropertyDecorator;
|
||||||
export function WorkspaceIndex(columns: string[]): ClassDecorator;
|
export function WorkspaceIndex(columns: string[]): ClassDecorator;
|
||||||
export function WorkspaceIndex(
|
export function WorkspaceIndex(
|
||||||
|
|||||||
@ -68,10 +68,6 @@ export class MetadataArgsStorage {
|
|||||||
target: Function | string,
|
target: Function | string,
|
||||||
): WorkspaceExtendedEntityMetadataArgs | undefined;
|
): WorkspaceExtendedEntityMetadataArgs | undefined;
|
||||||
|
|
||||||
filterExtendedEntities(
|
|
||||||
target: (Function | string)[],
|
|
||||||
): WorkspaceExtendedEntityMetadataArgs[];
|
|
||||||
|
|
||||||
filterExtendedEntities(
|
filterExtendedEntities(
|
||||||
target: (Function | string) | (Function | string)[],
|
target: (Function | string) | (Function | string)[],
|
||||||
):
|
):
|
||||||
@ -85,8 +81,6 @@ export class MetadataArgsStorage {
|
|||||||
|
|
||||||
filterFields(target: Function | string): WorkspaceFieldMetadataArgs[];
|
filterFields(target: Function | string): WorkspaceFieldMetadataArgs[];
|
||||||
|
|
||||||
filterFields(target: (Function | string)[]): WorkspaceFieldMetadataArgs[];
|
|
||||||
|
|
||||||
filterFields(
|
filterFields(
|
||||||
target: (Function | string) | (Function | string)[],
|
target: (Function | string) | (Function | string)[],
|
||||||
): WorkspaceFieldMetadataArgs[] {
|
): WorkspaceFieldMetadataArgs[] {
|
||||||
@ -107,8 +101,6 @@ export class MetadataArgsStorage {
|
|||||||
|
|
||||||
filterIndexes(target: Function | string): WorkspaceIndexMetadataArgs[];
|
filterIndexes(target: Function | string): WorkspaceIndexMetadataArgs[];
|
||||||
|
|
||||||
filterIndexes(target: (Function | string)[]): WorkspaceIndexMetadataArgs[];
|
|
||||||
|
|
||||||
filterIndexes(
|
filterIndexes(
|
||||||
target: (Function | string) | (Function | string)[],
|
target: (Function | string) | (Function | string)[],
|
||||||
): WorkspaceIndexMetadataArgs[] {
|
): WorkspaceIndexMetadataArgs[] {
|
||||||
@ -119,10 +111,6 @@ export class MetadataArgsStorage {
|
|||||||
target: Function | string,
|
target: Function | string,
|
||||||
): WorkspaceDynamicRelationMetadataArgs[];
|
): WorkspaceDynamicRelationMetadataArgs[];
|
||||||
|
|
||||||
filterDynamicRelations(
|
|
||||||
target: (Function | string)[],
|
|
||||||
): WorkspaceDynamicRelationMetadataArgs[];
|
|
||||||
|
|
||||||
filterDynamicRelations(
|
filterDynamicRelations(
|
||||||
target: (Function | string) | (Function | string)[],
|
target: (Function | string) | (Function | string)[],
|
||||||
): WorkspaceDynamicRelationMetadataArgs[] {
|
): WorkspaceDynamicRelationMetadataArgs[] {
|
||||||
@ -133,10 +121,6 @@ export class MetadataArgsStorage {
|
|||||||
target: Function | string,
|
target: Function | string,
|
||||||
): WorkspaceJoinColumnsMetadataArgs[];
|
): WorkspaceJoinColumnsMetadataArgs[];
|
||||||
|
|
||||||
filterJoinColumns(
|
|
||||||
target: (Function | string)[],
|
|
||||||
): WorkspaceJoinColumnsMetadataArgs[];
|
|
||||||
|
|
||||||
filterJoinColumns(
|
filterJoinColumns(
|
||||||
target: (Function | string) | (Function | string)[],
|
target: (Function | string) | (Function | string)[],
|
||||||
): WorkspaceJoinColumnsMetadataArgs[] {
|
): WorkspaceJoinColumnsMetadataArgs[] {
|
||||||
|
|||||||
@ -6,15 +6,6 @@ export class WorkspaceEntitiesStorage {
|
|||||||
Map<string, EntitySchema>
|
Map<string, EntitySchema>
|
||||||
>();
|
>();
|
||||||
|
|
||||||
static getEntitySchema(
|
|
||||||
workspaceId: string,
|
|
||||||
objectMetadataName: string,
|
|
||||||
): EntitySchema | undefined {
|
|
||||||
const workspace = this.workspaceEntities.get(workspaceId);
|
|
||||||
|
|
||||||
return workspace?.get(objectMetadataName);
|
|
||||||
}
|
|
||||||
|
|
||||||
static setEntitySchema(
|
static setEntitySchema(
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
objectMetadataName: string,
|
objectMetadataName: string,
|
||||||
@ -38,12 +29,4 @@ export class WorkspaceEntitiesStorage {
|
|||||||
([, schema]) => schema.options.name === target.options.name,
|
([, schema]) => schema.options.name === target.options.name,
|
||||||
)?.[0];
|
)?.[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static getEntities(workspaceId: string): EntitySchema[] {
|
|
||||||
return Array.from(this.workspaceEntities.get(workspaceId)?.values() || []);
|
|
||||||
}
|
|
||||||
|
|
||||||
static clearWorkspace(workspaceId: string): void {
|
|
||||||
this.workspaceEntities.delete(workspaceId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { EntitySchemaOptions } from 'typeorm';
|
import { EntitySchemaOptions } from 'typeorm';
|
||||||
|
|
||||||
@ -18,8 +18,6 @@ enum WorkspaceCacheKeys {
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceCacheStorageService {
|
export class WorkspaceCacheStorageService {
|
||||||
private readonly logger = new Logger(WorkspaceCacheStorageService.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@InjectCacheStorage(CacheStorageNamespace.EngineWorkspace)
|
@InjectCacheStorage(CacheStorageNamespace.EngineWorkspace)
|
||||||
private readonly cacheStorageService: CacheStorageService,
|
private readonly cacheStorageService: CacheStorageService,
|
||||||
|
|||||||
@ -20,7 +20,7 @@ export abstract class AbstractWorkspaceFixer<
|
|||||||
> {
|
> {
|
||||||
private issueTypes: IssueTypes[];
|
private issueTypes: IssueTypes[];
|
||||||
|
|
||||||
constructor(...issueTypes: IssueTypes[]) {
|
protected constructor(...issueTypes: IssueTypes[]) {
|
||||||
this.issueTypes = issueTypes;
|
this.issueTypes = issueTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -112,13 +112,12 @@ export class WorkspaceDefaultValueFixer extends AbstractWorkspaceFixer<Workspace
|
|||||||
|
|
||||||
for (const issue of issues) {
|
for (const issue of issues) {
|
||||||
const currentDefaultValue:
|
const currentDefaultValue:
|
||||||
| FieldMetadataDefaultValue<'default'>
|
| FieldMetadataDefaultValue
|
||||||
// Old format for default values
|
// Old format for default values
|
||||||
// TODO: Remove this after all workspaces are migrated
|
// TODO: Remove this after all workspaces are migrated
|
||||||
| { type: FieldMetadataDefaultValueFunctionNames }
|
| { type: FieldMetadataDefaultValueFunctionNames }
|
||||||
| null = issue.fieldMetadata.defaultValue;
|
| null = issue.fieldMetadata.defaultValue;
|
||||||
let alteredDefaultValue: FieldMetadataDefaultValue<'default'> | null =
|
let alteredDefaultValue: FieldMetadataDefaultValue | null = null;
|
||||||
null;
|
|
||||||
|
|
||||||
// Check if it's an old function default value
|
// Check if it's an old function default value
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
@ -189,7 +188,7 @@ export class WorkspaceDefaultValueFixer extends AbstractWorkspaceFixer<Workspace
|
|||||||
|
|
||||||
private computeFieldMetadataDefaultValueFromColumnDefault(
|
private computeFieldMetadataDefaultValueFromColumnDefault(
|
||||||
columnDefault: string | undefined,
|
columnDefault: string | undefined,
|
||||||
): FieldMetadataDefaultValue<'default'> {
|
): FieldMetadataDefaultValue {
|
||||||
if (
|
if (
|
||||||
columnDefault === undefined ||
|
columnDefault === undefined ||
|
||||||
columnDefault === null ||
|
columnDefault === null ||
|
||||||
|
|||||||
@ -151,24 +151,6 @@ export class DatabaseStructureService {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
async workspaceColumnExist(
|
|
||||||
schemaName: string,
|
|
||||||
tableName: string,
|
|
||||||
columnName: string,
|
|
||||||
): Promise<boolean> {
|
|
||||||
const mainDataSource = this.typeORMService.getMainDataSource();
|
|
||||||
const results = await mainDataSource.query(
|
|
||||||
`SELECT column_name
|
|
||||||
FROM information_schema.columns
|
|
||||||
WHERE table_schema = $1
|
|
||||||
AND table_name = $2
|
|
||||||
AND column_name = $3`,
|
|
||||||
[schemaName, tableName, columnName],
|
|
||||||
);
|
|
||||||
|
|
||||||
return results.length >= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
getPostgresDataTypes(fieldMetadata: FieldMetadataEntity): string[] {
|
getPostgresDataTypes(fieldMetadata: FieldMetadataEntity): string[] {
|
||||||
const mainDataSource = this.typeORMService.getMainDataSource();
|
const mainDataSource = this.typeORMService.getMainDataSource();
|
||||||
|
|
||||||
|
|||||||
@ -76,22 +76,6 @@ export class WorkspaceManagerService {
|
|||||||
await this.prefillWorkspaceWithDemoObjects(dataSourceMetadata, workspaceId);
|
await this.prefillWorkspaceWithDemoObjects(dataSourceMetadata, workspaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Check if the workspace schema has already been created or not
|
|
||||||
*
|
|
||||||
* @param workspaceId
|
|
||||||
* @Returns Promise<boolean>
|
|
||||||
*/
|
|
||||||
public async doesDataSourceExist(workspaceId: string): Promise<boolean> {
|
|
||||||
const dataSource =
|
|
||||||
await this.dataSourceService.getDataSourcesMetadataFromWorkspaceId(
|
|
||||||
workspaceId,
|
|
||||||
);
|
|
||||||
|
|
||||||
return dataSource.length > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* We are updating the pg_graphql max_rows from 30 (default value) to 60
|
* We are updating the pg_graphql max_rows from 30 (default value) to 60
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
QueryRunner,
|
QueryRunner,
|
||||||
@ -32,8 +32,6 @@ import { customTableDefaultColumns } from './utils/custom-table-default-column.u
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceMigrationRunnerService {
|
export class WorkspaceMigrationRunnerService {
|
||||||
private readonly logger = new Logger(WorkspaceMigrationRunnerService.name);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly workspaceDataSourceService: WorkspaceDataSourceService,
|
private readonly workspaceDataSourceService: WorkspaceDataSourceService,
|
||||||
private readonly workspaceMigrationService: WorkspaceMigrationService,
|
private readonly workspaceMigrationService: WorkspaceMigrationService,
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
import { PartialFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-field-metadata.interface';
|
|
||||||
import { PartialWorkspaceEntity } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-object-metadata.interface';
|
|
||||||
|
|
||||||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
|
||||||
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
|
|
||||||
export type MappedFieldMetadata = Record<string, PartialFieldMetadata>;
|
|
||||||
|
|
||||||
export interface MappedWorkspaceEntity
|
|
||||||
extends Omit<PartialWorkspaceEntity, 'fields'> {
|
|
||||||
fields: MappedFieldMetadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type MappedFieldMetadataEntity = Record<string, FieldMetadataEntity>;
|
|
||||||
|
|
||||||
export interface MappedObjectMetadataEntity
|
|
||||||
extends Omit<ObjectMetadataEntity, 'fields'> {
|
|
||||||
fields: MappedFieldMetadataEntity;
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
EntityManager,
|
EntityManager,
|
||||||
@ -27,8 +27,6 @@ import { WorkspaceSyncStorage } from 'src/engine/workspace-manager/workspace-syn
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceMetadataUpdaterService {
|
export class WorkspaceMetadataUpdaterService {
|
||||||
private readonly logger = new Logger(WorkspaceMetadataUpdaterService.name);
|
|
||||||
|
|
||||||
async updateObjectMetadata(
|
async updateObjectMetadata(
|
||||||
manager: EntityManager,
|
manager: EntityManager,
|
||||||
storage: WorkspaceSyncStorage,
|
storage: WorkspaceSyncStorage,
|
||||||
@ -127,12 +125,13 @@ export class WorkspaceMetadataUpdaterService {
|
|||||||
/**
|
/**
|
||||||
* Update field metadata
|
* Update field metadata
|
||||||
*/
|
*/
|
||||||
const updatedFieldMetadataCollection = await this.updateEntities<
|
const updatedFieldMetadataCollection =
|
||||||
FieldMetadataEntity<'default'>
|
await this.updateEntities<FieldMetadataEntity>(
|
||||||
>(manager, FieldMetadataEntity, storage.fieldMetadataUpdateCollection, [
|
manager,
|
||||||
'objectMetadataId',
|
FieldMetadataEntity,
|
||||||
'workspaceId',
|
storage.fieldMetadataUpdateCollection,
|
||||||
]);
|
['objectMetadataId', 'workspaceId'],
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create field metadata
|
* Create field metadata
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { EntityManager, Repository } from 'typeorm';
|
import { EntityManager, Repository } from 'typeorm';
|
||||||
|
|
||||||
@ -17,10 +17,6 @@ import { mapObjectMetadataByUniqueIdentifier } from 'src/engine/workspace-manage
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceSyncObjectMetadataIdentifiersService {
|
export class WorkspaceSyncObjectMetadataIdentifiersService {
|
||||||
private readonly logger = new Logger(
|
|
||||||
WorkspaceSyncObjectMetadataIdentifiersService.name,
|
|
||||||
);
|
|
||||||
|
|
||||||
constructor(private readonly standardObjectFactory: StandardObjectFactory) {}
|
constructor(private readonly standardObjectFactory: StandardObjectFactory) {}
|
||||||
|
|
||||||
async synchronize(
|
async synchronize(
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Injectable, Logger } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
import { EntityManager } from 'typeorm';
|
import { EntityManager } from 'typeorm';
|
||||||
|
|
||||||
@ -21,10 +21,6 @@ import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-en
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceSyncRelationMetadataService {
|
export class WorkspaceSyncRelationMetadataService {
|
||||||
private readonly logger = new Logger(
|
|
||||||
WorkspaceSyncRelationMetadataService.name,
|
|
||||||
);
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly standardRelationFactory: StandardRelationFactory,
|
private readonly standardRelationFactory: StandardRelationFactory,
|
||||||
private readonly workspaceRelationComparator: WorkspaceRelationComparator,
|
private readonly workspaceRelationComparator: WorkspaceRelationComparator,
|
||||||
|
|||||||
@ -84,10 +84,6 @@ export class WorkspaceSyncStorage {
|
|||||||
return this._indexMetadataCreateCollection;
|
return this._indexMetadataCreateCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
get indexMetadataUpdateCollection() {
|
|
||||||
return this._indexMetadataUpdateCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
get indexMetadataDeleteCollection() {
|
get indexMetadataDeleteCollection() {
|
||||||
return this._indexMetadataDeleteCollection;
|
return this._indexMetadataDeleteCollection;
|
||||||
}
|
}
|
||||||
@ -138,10 +134,6 @@ export class WorkspaceSyncStorage {
|
|||||||
this._indexMetadataCreateCollection.push(index);
|
this._indexMetadataCreateCollection.push(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
addUpdateIndexMetadata(index: Partial<IndexMetadataEntity>) {
|
|
||||||
this._indexMetadataUpdateCollection.push(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
addDeleteIndexMetadata(index: IndexMetadataEntity) {
|
addDeleteIndexMetadata(index: IndexMetadataEntity) {
|
||||||
this._indexMetadataDeleteCollection.push(index);
|
this._indexMetadataDeleteCollection.push(index);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* Each object in the map contains the original object metadata and its fields as a nested map.
|
* Each object in the map contains the original object metadata and its fields as a nested map.
|
||||||
*
|
*
|
||||||
* @param arr - The array of ObjectMetadataEntity objects to convert.
|
* @param arr - The array of ObjectMetadataEntity objects to convert.
|
||||||
|
* @param keyFactory
|
||||||
* @returns A map of object metadata, with nameSingular as the key and the object as the value.
|
* @returns A map of object metadata, with nameSingular as the key and the object as the value.
|
||||||
*/
|
*/
|
||||||
export const mapObjectMetadataByUniqueIdentifier = <
|
export const mapObjectMetadataByUniqueIdentifier = <
|
||||||
|
|||||||
@ -42,8 +42,8 @@ export class WorkspaceSyncMetadataService {
|
|||||||
* Sync all standard objects and fields metadata for a given workspace and data source
|
* Sync all standard objects and fields metadata for a given workspace and data source
|
||||||
* This will update the metadata if it has changed and generate migrations based on the diff.
|
* This will update the metadata if it has changed and generate migrations based on the diff.
|
||||||
*
|
*
|
||||||
* @param dataSourceId
|
* @param context
|
||||||
* @param workspaceId
|
* @param options
|
||||||
*/
|
*/
|
||||||
public async synchronize(
|
public async synchronize(
|
||||||
context: WorkspaceSyncContext,
|
context: WorkspaceSyncContext,
|
||||||
|
|||||||
@ -49,21 +49,4 @@ export class BlocklistRepository {
|
|||||||
transactionManager,
|
transactionManager,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getByWorkspaceMemberIdAndHandle(
|
|
||||||
workspaceMemberId: string,
|
|
||||||
handle: string,
|
|
||||||
workspaceId: string,
|
|
||||||
transactionManager?: EntityManager,
|
|
||||||
): Promise<BlocklistWorkspaceEntity[]> {
|
|
||||||
const dataSourceSchema =
|
|
||||||
this.workspaceDataSourceService.getSchemaName(workspaceId);
|
|
||||||
|
|
||||||
return await this.workspaceDataSourceService.executeRawQuery(
|
|
||||||
`SELECT * FROM ${dataSourceSchema}."blocklist" WHERE "workspaceMemberId" = $1 AND "handle" = $2`,
|
|
||||||
[workspaceMemberId, handle],
|
|
||||||
workspaceId,
|
|
||||||
transactionManager,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
export const CALENDAR_THROTTLE_DURATION = 1000 * 60 * 1; // 1 minute
|
|
||||||
@ -109,18 +109,6 @@ export class CalendarChannelSyncStatusService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async markAsCalendarEventsImportOngoing(calendarChannelId: string) {
|
|
||||||
const calendarChannelRepository =
|
|
||||||
await this.twentyORMManager.getRepository<CalendarChannelWorkspaceEntity>(
|
|
||||||
'calendarChannel',
|
|
||||||
);
|
|
||||||
|
|
||||||
await calendarChannelRepository.update(calendarChannelId, {
|
|
||||||
syncStage: CalendarChannelSyncStage.CALENDAR_EVENTS_IMPORT_ONGOING,
|
|
||||||
syncStatus: CalendarChannelSyncStatus.ONGOING,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public async markAsCompletedAndSchedulePartialMessageListFetch(
|
public async markAsCompletedAndSchedulePartialMessageListFetch(
|
||||||
calendarChannelId: string,
|
calendarChannelId: string,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -26,31 +26,3 @@ export const valuesStringForBatchRawQuery = (
|
|||||||
|
|
||||||
return castedValues.join(', ');
|
return castedValues.join(', ');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getFlattenedValuesAndValuesStringForBatchRawQuery = (
|
|
||||||
values: {
|
|
||||||
[key: string]: any;
|
|
||||||
}[],
|
|
||||||
keyTypeMap: {
|
|
||||||
[key: string]: string;
|
|
||||||
},
|
|
||||||
): {
|
|
||||||
flattenedValues: any[];
|
|
||||||
valuesString: string;
|
|
||||||
} => {
|
|
||||||
const keysToInsert = Object.keys(keyTypeMap);
|
|
||||||
|
|
||||||
const flattenedValues = values.flatMap((value) =>
|
|
||||||
keysToInsert.map((key) => value[key]),
|
|
||||||
);
|
|
||||||
|
|
||||||
const valuesString = valuesStringForBatchRawQuery(
|
|
||||||
values,
|
|
||||||
Object.values(keyTypeMap),
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
flattenedValues,
|
|
||||||
valuesString,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|||||||
@ -61,41 +61,6 @@ export class ConnectedAccountRepository {
|
|||||||
return connectedAccounts;
|
return connectedAccounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getAllByUserId(
|
|
||||||
userId: string,
|
|
||||||
workspaceId: string,
|
|
||||||
transactionManager?: EntityManager,
|
|
||||||
): Promise<ConnectedAccountWorkspaceEntity[] | undefined> {
|
|
||||||
const schemaExists =
|
|
||||||
await this.workspaceDataSourceService.checkSchemaExists(workspaceId);
|
|
||||||
|
|
||||||
if (!schemaExists) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const dataSourceSchema =
|
|
||||||
this.workspaceDataSourceService.getSchemaName(workspaceId);
|
|
||||||
|
|
||||||
const workspaceMember = (
|
|
||||||
await this.workspaceDataSourceService.executeRawQuery(
|
|
||||||
`SELECT * FROM ${dataSourceSchema}."workspaceMember" WHERE "userId" = $1`,
|
|
||||||
[userId],
|
|
||||||
workspaceId,
|
|
||||||
transactionManager,
|
|
||||||
)
|
|
||||||
)?.[0];
|
|
||||||
|
|
||||||
if (!workspaceMember) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return await this.getAllByWorkspaceMemberId(
|
|
||||||
workspaceMember.id,
|
|
||||||
workspaceId,
|
|
||||||
transactionManager,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async getAllByHandleAndWorkspaceMemberId(
|
public async getAllByHandleAndWorkspaceMemberId(
|
||||||
handle: string,
|
handle: string,
|
||||||
workspaceMemberId: string,
|
workspaceMemberId: string,
|
||||||
@ -204,58 +169,6 @@ export class ConnectedAccountRepository {
|
|||||||
return connectedAccount;
|
return connectedAccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async updateLastSyncHistoryId(
|
|
||||||
historyId: string,
|
|
||||||
connectedAccountId: string,
|
|
||||||
workspaceId: string,
|
|
||||||
transactionManager?: EntityManager,
|
|
||||||
) {
|
|
||||||
const dataSourceSchema =
|
|
||||||
this.workspaceDataSourceService.getSchemaName(workspaceId);
|
|
||||||
|
|
||||||
await this.workspaceDataSourceService.executeRawQuery(
|
|
||||||
`UPDATE ${dataSourceSchema}."connectedAccount" SET "lastSyncHistoryId" = $1 WHERE "id" = $2`,
|
|
||||||
[historyId, connectedAccountId],
|
|
||||||
workspaceId,
|
|
||||||
transactionManager,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async updateLastSyncHistoryIdIfHigher(
|
|
||||||
historyId: string,
|
|
||||||
connectedAccountId: string,
|
|
||||||
workspaceId: string,
|
|
||||||
transactionManager?: EntityManager,
|
|
||||||
) {
|
|
||||||
const dataSourceSchema =
|
|
||||||
this.workspaceDataSourceService.getSchemaName(workspaceId);
|
|
||||||
|
|
||||||
await this.workspaceDataSourceService.executeRawQuery(
|
|
||||||
`UPDATE ${dataSourceSchema}."connectedAccount" SET "lastSyncHistoryId" = $1
|
|
||||||
WHERE "id" = $2
|
|
||||||
AND ("lastSyncHistoryId" < $1 OR "lastSyncHistoryId" = '')`,
|
|
||||||
[historyId, connectedAccountId],
|
|
||||||
workspaceId,
|
|
||||||
transactionManager,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async deleteHistoryId(
|
|
||||||
connectedAccountId: string,
|
|
||||||
workspaceId: string,
|
|
||||||
transactionManager?: EntityManager,
|
|
||||||
) {
|
|
||||||
const dataSourceSchema =
|
|
||||||
this.workspaceDataSourceService.getSchemaName(workspaceId);
|
|
||||||
|
|
||||||
await this.workspaceDataSourceService.executeRawQuery(
|
|
||||||
`UPDATE ${dataSourceSchema}."connectedAccount" SET "lastSyncHistoryId" = '' WHERE "id" = $1`,
|
|
||||||
[connectedAccountId],
|
|
||||||
workspaceId,
|
|
||||||
transactionManager,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async updateAccessToken(
|
public async updateAccessToken(
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
connectedAccountId: string,
|
connectedAccountId: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user