[QRQC_2] No implicitAny in twenty-server (#12075)
# Introduction Following https://github.com/twentyhq/twenty/pull/12068 Related with https://github.com/twentyhq/core-team-issues/issues/975 We're enabling `noImplicitAny` handled few use case manually, added a `ts-expect-error` to the others, we should plan to handle them in the future
This commit is contained in:
@ -9,16 +9,17 @@ async function dropSchemasSequentially() {
|
||||
await rawDataSource.initialize();
|
||||
|
||||
// Fetch all schemas excluding the ones we want to keep
|
||||
const schemas = await performQuery(
|
||||
`
|
||||
const schemas =
|
||||
(await performQuery<{ schema_name: string }[]>(
|
||||
`
|
||||
SELECT n.nspname AS "schema_name"
|
||||
FROM pg_catalog.pg_namespace n
|
||||
WHERE n.nspname !~ '^pg_'
|
||||
AND n.nspname <> 'information_schema'
|
||||
AND n.nspname NOT IN ('metric_helpers', 'user_management', 'public')
|
||||
`,
|
||||
'Fetching schemas...',
|
||||
);
|
||||
'Fetching schemas...',
|
||||
)) ?? [];
|
||||
|
||||
const batchSize = 10;
|
||||
|
||||
|
||||
@ -2,17 +2,17 @@ import console from 'console';
|
||||
|
||||
import { rawDataSource } from 'src/database/typeorm/raw/raw.datasource';
|
||||
|
||||
export const camelToSnakeCase = (str) =>
|
||||
export const camelToSnakeCase = (str: string) =>
|
||||
str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
||||
|
||||
export const performQuery = async (
|
||||
export const performQuery = async <T = unknown>(
|
||||
query: string,
|
||||
consoleDescription: string,
|
||||
withLog = true,
|
||||
ignoreAlreadyExistsError = false,
|
||||
) => {
|
||||
try {
|
||||
const result = await rawDataSource.query(query);
|
||||
const result = await rawDataSource.query<T>(query);
|
||||
|
||||
withLog && console.log(`Performed '${consoleDescription}' successfully`);
|
||||
|
||||
|
||||
@ -187,9 +187,11 @@ describe('UpgradeCommandRunner', () => {
|
||||
workspaces: [higherVersionWorkspace],
|
||||
appVersion,
|
||||
});
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const passedParams = [];
|
||||
const options = {};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
await upgradeCommandRunner.run(passedParams, options);
|
||||
|
||||
const { fail: failReport, success: successReport } =
|
||||
@ -239,9 +241,11 @@ describe('UpgradeCommandRunner', () => {
|
||||
workspaces: failingWorkspaces,
|
||||
appVersion,
|
||||
});
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const passedParams = [];
|
||||
const options = {};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
await upgradeCommandRunner.run(passedParams, options);
|
||||
|
||||
// Common assertions
|
||||
@ -287,9 +291,11 @@ describe('UpgradeCommandRunner', () => {
|
||||
numberOfWorkspace,
|
||||
appVersion,
|
||||
});
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const passedParams = [];
|
||||
const options = {};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
await upgradeCommandRunner.run(passedParams, options);
|
||||
|
||||
[
|
||||
@ -310,9 +316,11 @@ describe('UpgradeCommandRunner', () => {
|
||||
|
||||
it('should run syncMetadataCommand betweensuccessful beforeSyncMetadataUpgradeCommandsToRun and afterSyncMetadataUpgradeCommandsToRun', async () => {
|
||||
await buildModuleAndSetupSpies({});
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const passedParams = [];
|
||||
const options = {};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
await upgradeCommandRunner.run(passedParams, options);
|
||||
|
||||
[
|
||||
@ -380,9 +388,11 @@ describe('UpgradeCommandRunner', () => {
|
||||
async ({ context: { input } }) => {
|
||||
await buildModuleAndSetupSpies(input);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const passedParams = [];
|
||||
const options = {};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
await upgradeCommandRunner.run(passedParams, options);
|
||||
|
||||
const { fail: failReport, success: successReport } =
|
||||
@ -461,9 +471,11 @@ describe('UpgradeCommandRunner', () => {
|
||||
it.each(failingTestUseCases)('$title', async ({ context: { input } }) => {
|
||||
await buildModuleAndSetupSpies(input);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const passedParams = [];
|
||||
const options = {};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
await upgradeCommandRunner.run(passedParams, options);
|
||||
|
||||
const { fail: failReport, success: successReport } =
|
||||
|
||||
@ -8,6 +8,7 @@ interface CommandLoggerOptions {
|
||||
export const isCommandLogger = (
|
||||
logger: Logger | CommandLogger,
|
||||
): logger is CommandLogger => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return typeof logger['setVerbose'] === 'function';
|
||||
};
|
||||
|
||||
|
||||
@ -64,9 +64,11 @@ export class AddTasksAssignedToMeViewCommand extends ActiveOrSuspendedWorkspaces
|
||||
});
|
||||
|
||||
const objectMetadataMap = objectMetadata.reduce((acc, object) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[object.standardId ?? ''] = {
|
||||
id: object.id,
|
||||
fields: object.fields.reduce((acc, field) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[field.standardId ?? ''] = field.id;
|
||||
|
||||
return acc;
|
||||
|
||||
@ -59,6 +59,7 @@ export class CopyTypeormMigrationsCommand extends ActiveOrSuspendedWorkspacesMig
|
||||
);
|
||||
|
||||
const existingMigrationNames = new Set(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
existingCoreMigrations.map((migration) => migration.name),
|
||||
);
|
||||
|
||||
|
||||
@ -300,11 +300,13 @@ export const objectMetadataMapItemMock = {
|
||||
namePlural: 'objectsName',
|
||||
fields,
|
||||
fieldsById: fields.reduce((acc, field) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[field.id] = field;
|
||||
|
||||
return acc;
|
||||
}, {}),
|
||||
fieldsByName: fields.reduce((acc, field) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[field.name] = field;
|
||||
|
||||
return acc;
|
||||
|
||||
@ -117,6 +117,7 @@ export abstract class GraphqlQueryBaseResolverService<
|
||||
const computedArgs = (await this.queryRunnerArgsFactory.create(
|
||||
hookedArgs,
|
||||
options,
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
ResolverArgsType[capitalize(operationName)],
|
||||
)) as Input;
|
||||
|
||||
@ -195,6 +196,7 @@ export abstract class GraphqlQueryBaseResolverService<
|
||||
)
|
||||
) {
|
||||
const permissionRequired: SettingPermissionType =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
SYSTEM_OBJECTS_PERMISSIONS_REQUIREMENTS[
|
||||
objectMetadataItemWithFieldMaps.nameSingular
|
||||
];
|
||||
|
||||
@ -209,6 +209,7 @@ export class GraphqlQueryCreateManyResolverService extends GraphqlQueryBaseResol
|
||||
.filter(Boolean);
|
||||
|
||||
if (fieldValues.length > 0) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
whereConditions[field.column] = In(fieldValues);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,6 +52,7 @@ export class ApiEventEmitterService {
|
||||
objectMetadataNameSingular: objectMetadataItem.nameSingular,
|
||||
action: DatabaseEventAction.UPDATED,
|
||||
events: records.map((record) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const before = mappedExistingRecords[record.id];
|
||||
const after = record;
|
||||
const diff = objectRecordChangedValues(
|
||||
|
||||
@ -10,6 +10,7 @@ export class ScalarsExplorerService {
|
||||
|
||||
constructor() {
|
||||
this.scalarImplementations = scalars.reduce((acc, scalar) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[scalar.name] = scalar;
|
||||
|
||||
return acc;
|
||||
|
||||
@ -44,6 +44,7 @@ const findFieldNode = (
|
||||
return field;
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const parseValueNode = (
|
||||
valueNode: ValueNode,
|
||||
variables: GraphQLResolveInfo['variableValues'],
|
||||
@ -62,6 +63,7 @@ const parseValueNode = (
|
||||
return valueNode.values.map((value) => parseValueNode(value, variables));
|
||||
case Kind.OBJECT:
|
||||
return valueNode.fields.reduce((obj, field) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
obj[field.name.value] = parseValueNode(field.value, variables);
|
||||
|
||||
return obj;
|
||||
|
||||
@ -260,12 +260,15 @@ export class QueryRunnerArgsFactory {
|
||||
const overrideFilter = (filterObject: ObjectRecordFilter) => {
|
||||
return Object.entries(filterObject).reduce((acc, [key, value]) => {
|
||||
if (key === 'and' || key === 'or') {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[key] = value.map((nestedFilter: ObjectRecordFilter) =>
|
||||
overrideFilter(nestedFilter),
|
||||
);
|
||||
} else if (key === 'not') {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[key] = overrideFilter(value);
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[key] = this.transformFilterValueByType(
|
||||
key,
|
||||
value,
|
||||
|
||||
@ -5,6 +5,7 @@ import {
|
||||
} from 'src/engine/api/graphql/workspace-query-runner/utils/parse-result.util';
|
||||
|
||||
describe('handleSpecialKey', () => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
let result;
|
||||
|
||||
beforeEach(() => {
|
||||
@ -13,10 +14,12 @@ describe('handleSpecialKey', () => {
|
||||
|
||||
test('should correctly process a composite key and add it to the result object', () => {
|
||||
handleCompositeKey(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
result,
|
||||
createCompositeFieldKey('complexField', 'link'),
|
||||
'value1',
|
||||
);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
expect(result).toEqual({
|
||||
complexField: {
|
||||
link: 'value1',
|
||||
@ -26,15 +29,18 @@ describe('handleSpecialKey', () => {
|
||||
|
||||
test('should add values under the same newKey if called multiple times', () => {
|
||||
handleCompositeKey(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
result,
|
||||
createCompositeFieldKey('complexField', 'link'),
|
||||
'value1',
|
||||
);
|
||||
handleCompositeKey(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
result,
|
||||
createCompositeFieldKey('complexField', 'text'),
|
||||
'value2',
|
||||
);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
expect(result).toEqual({
|
||||
complexField: {
|
||||
link: 'value1',
|
||||
@ -44,7 +50,9 @@ describe('handleSpecialKey', () => {
|
||||
});
|
||||
|
||||
test('should not create a new field if the composite key is not correctly formed', () => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
handleCompositeKey(result, 'COMPOSITE___complexField', 'value1');
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
expect(result).toEqual({});
|
||||
});
|
||||
});
|
||||
|
||||
@ -35,6 +35,7 @@ const pgGraphQLErrorMapping: PgGraphQLErrorMapping = {
|
||||
'duplicate key value violates unique constraint': (command, objectName, _) =>
|
||||
new WorkspaceQueryRunnerException(
|
||||
`Cannot ${
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
pgGraphQLCommandMapping[command] ?? command
|
||||
} ${objectName} because it violates a uniqueness constraint.`,
|
||||
WorkspaceQueryRunnerExceptionCode.QUERY_VIOLATES_UNIQUE_CONSTRAINT,
|
||||
@ -42,6 +43,7 @@ const pgGraphQLErrorMapping: PgGraphQLErrorMapping = {
|
||||
'violates foreign key constraint': (command, objectName, _) =>
|
||||
new WorkspaceQueryRunnerException(
|
||||
`Cannot ${
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
pgGraphQLCommandMapping[command] ?? command
|
||||
} ${objectName} because it violates a foreign key constraint.`,
|
||||
WorkspaceQueryRunnerExceptionCode.QUERY_VIOLATES_FOREIGN_KEY_CONSTRAINT,
|
||||
|
||||
@ -110,11 +110,13 @@ export class WorkspaceQueryHookExplorer implements OnModuleInit {
|
||||
contextId,
|
||||
);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return contextInstance[methodName].call(
|
||||
contextInstance,
|
||||
...executeParams,
|
||||
);
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return instance[methodName].call(instance, ...executeParams);
|
||||
}
|
||||
}
|
||||
@ -173,6 +175,7 @@ export class WorkspaceQueryHookExplorer implements OnModuleInit {
|
||||
contextId,
|
||||
);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return contextInstance[methodName].call(
|
||||
contextInstance,
|
||||
executeParams[0],
|
||||
@ -180,6 +183,7 @@ export class WorkspaceQueryHookExplorer implements OnModuleInit {
|
||||
transformedPayload,
|
||||
);
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return instance[methodName].call(
|
||||
instance,
|
||||
executeParams[0],
|
||||
|
||||
@ -97,6 +97,7 @@ export class WorkspaceResolverFactory {
|
||||
methodName,
|
||||
)
|
||||
) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
resolvers.Query[resolverName] = resolverFactory.create({
|
||||
authContext,
|
||||
objectMetadataMaps,
|
||||
@ -120,6 +121,7 @@ export class WorkspaceResolverFactory {
|
||||
throw new Error(`Unknown mutation resolver type: ${methodName}`);
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
resolvers.Mutation[resolverName] = resolverFactory.create({
|
||||
authContext,
|
||||
objectMetadataMaps,
|
||||
|
||||
@ -37,6 +37,7 @@ export class InputTypeDefinitionFactory {
|
||||
kind: InputTypeDefinitionKind,
|
||||
options: WorkspaceBuildSchemaOptions,
|
||||
): InputTypeDefinition {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const inputType = new GraphQLInputObjectType({
|
||||
name: `${pascalCase(objectMetadata.nameSingular)}${kind.toString()}Input`,
|
||||
description: objectMetadata.description,
|
||||
@ -46,6 +47,7 @@ export class InputTypeDefinitionFactory {
|
||||
* Filter input type has additional fields for filtering and is self referencing
|
||||
*/
|
||||
case InputTypeDefinitionKind.Filter: {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const andOrType = this.typeMapperService.mapToGqlType(inputType, {
|
||||
isArray: true,
|
||||
arrayDepth: 1,
|
||||
|
||||
@ -172,6 +172,7 @@ export class TypeDefinitionsGenerator {
|
||||
) {
|
||||
const objectTypeDefs = objectMetadataCollection.map((objectMetadata) =>
|
||||
this.objectTypeDefinitionFactory.create(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectMetadata,
|
||||
ObjectTypeDefinitionKind.Plain,
|
||||
options,
|
||||
|
||||
@ -104,12 +104,14 @@ export const generateFields = <
|
||||
throw new Error('Join column name is not defined');
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fields[joinColumnName] = {
|
||||
type,
|
||||
description: fieldMetadata.description,
|
||||
};
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fields[fieldMetadata.name] = {
|
||||
type,
|
||||
description: fieldMetadata.description,
|
||||
|
||||
@ -42,8 +42,10 @@ export const parseFilter = (
|
||||
`'filter' invalid. 'not' conjunction should contain only 1 condition. eg: not(field[eq]:1)`,
|
||||
);
|
||||
}
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
result[conjunction] = subResult[0];
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
result[conjunction] = subResult;
|
||||
}
|
||||
|
||||
|
||||
@ -69,11 +69,13 @@ export class OrderByInputFactory {
|
||||
if (Object.keys(fieldResult).length) {
|
||||
fieldResult = { [field]: fieldResult };
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fieldResult[field] = itemDirection;
|
||||
}
|
||||
}, itemDirection);
|
||||
|
||||
const resultFields = Object.keys(fieldResult).map((key) => ({
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
[key]: fieldResult[key],
|
||||
}));
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import { fetchMetadataFields } from 'src/engine/api/rest/metadata/query-builder/
|
||||
|
||||
@Injectable()
|
||||
export class FindManyMetadataQueryFactory {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
create(objectNamePlural): string {
|
||||
const fields = fetchMetadataFields(objectNamePlural);
|
||||
|
||||
|
||||
@ -16,15 +16,18 @@ export const cleanGraphQLResponse = (input: any) => {
|
||||
if (isObject(obj[key])) {
|
||||
if (obj[key].edges) {
|
||||
// Handle edges by mapping over them and applying cleanObject to each node
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
cleanedObj[key] = obj[key].edges.map((edge) =>
|
||||
cleanObject(edge.node),
|
||||
);
|
||||
} else {
|
||||
// Recursively clean nested objects
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
cleanedObj[key] = cleanObject(obj[key]);
|
||||
}
|
||||
} else {
|
||||
// Directly assign non-object properties
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
cleanedObj[key] = obj[key];
|
||||
}
|
||||
});
|
||||
@ -35,22 +38,29 @@ export const cleanGraphQLResponse = (input: any) => {
|
||||
Object.keys(input).forEach((key) => {
|
||||
if (isObject(input[key]) && input[key].edges) {
|
||||
// Handle collections with edges, ensuring data is placed under the data key
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
output.data[key] = input[key].edges.map((edge) => cleanObject(edge.node));
|
||||
// Move pageInfo and totalCount to the top level
|
||||
if (input[key].pageInfo) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
output['pageInfo'] = input[key].pageInfo;
|
||||
}
|
||||
if (input[key].totalCount) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
output['totalCount'] = input[key].totalCount;
|
||||
}
|
||||
} else if (isObject(input[key])) {
|
||||
// Recursively clean and assign nested objects under the data key
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
output.data[key] = cleanObject(input[key]);
|
||||
} else if (Array.isArray(input[key])) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const itemsWithEdges = input[key].filter((item) => item.edges);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const cleanedObjArray = itemsWithEdges.map(({ edges, ...item }) => {
|
||||
return {
|
||||
...item,
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
[key]: edges.map((edge) => cleanObject(edge.node)),
|
||||
};
|
||||
});
|
||||
@ -58,6 +68,7 @@ export const cleanGraphQLResponse = (input: any) => {
|
||||
output.data = cleanedObjArray;
|
||||
} else {
|
||||
// Assign all other properties directly under the data key
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
output.data[key] = input[key];
|
||||
}
|
||||
});
|
||||
|
||||
@ -47,11 +47,14 @@ export const buildDuplicateConditions = (
|
||||
compositeFieldMetadataMap.get(columnName);
|
||||
|
||||
if (compositeFieldMetadata) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
condition[compositeFieldMetadata.parentField] = {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
...condition[compositeFieldMetadata.parentField],
|
||||
[compositeFieldMetadata.name]: { eq: record[columnName] },
|
||||
};
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
condition[columnName] = { eq: record[columnName] };
|
||||
}
|
||||
});
|
||||
|
||||
@ -127,6 +127,7 @@ export class AdminPanelHealthService {
|
||||
if (indicatorId === HealthIndicatorId.worker) {
|
||||
return {
|
||||
...indicatorStatus,
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
queues: (indicatorStatus?.queues ?? []).map((queue) => ({
|
||||
id: `${indicatorId}-${queue.queueName}`,
|
||||
queueName: queue.queueName,
|
||||
|
||||
@ -201,14 +201,18 @@ export class AdminPanelService {
|
||||
);
|
||||
|
||||
const versions = response.data.results
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.filter((tag) => tag && tag.name !== 'latest')
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.map((tag) => semver.coerce(tag.name)?.version)
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.filter((version) => version !== undefined);
|
||||
|
||||
if (versions.length === 0) {
|
||||
return { currentVersion, latestVersion: 'latest' };
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
versions.sort((a, b) => semver.compare(b, a));
|
||||
const latestVersion = versions[0];
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ export class JwtAuthStrategy extends PassportStrategy(Strategy, 'jwt') {
|
||||
private readonly userWorkspaceRepository: Repository<UserWorkspace>,
|
||||
) {
|
||||
const jwtFromRequestFunction = jwtWrapperService.extractJwtFromRequest();
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const secretOrKeyProviderFunction = async (_request, rawJwtToken, done) => {
|
||||
try {
|
||||
const decodedToken = jwtWrapperService.decode(
|
||||
|
||||
@ -24,6 +24,7 @@ export const transformStripeSubscriptionEventToDatabaseSubscription = (
|
||||
currentPeriodStart: getDateFromTimestamp(data.object.current_period_start),
|
||||
metadata: data.object.metadata,
|
||||
collectionMethod:
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
BillingSubscriptionCollectionMethod[
|
||||
data.object.collection_method.toUpperCase()
|
||||
],
|
||||
|
||||
@ -21,8 +21,10 @@ export class CloudflareSecretMatchGuard implements CanActivate {
|
||||
if (
|
||||
!cloudflareWebhookSecret ||
|
||||
(cloudflareWebhookSecret &&
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
(typeof request.headers['cf-webhook-auth'] === 'string' ||
|
||||
timingSafeEqual(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
Buffer.from(request.headers['cf-webhook-auth']),
|
||||
Buffer.from(cloudflareWebhookSecret),
|
||||
)))
|
||||
|
||||
@ -18,6 +18,7 @@ describe('DomainManagerService', () => {
|
||||
FRONTEND_URL: 'https://example.com',
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return env[key];
|
||||
});
|
||||
|
||||
@ -42,6 +43,7 @@ describe('DomainManagerService', () => {
|
||||
IS_MULTIWORKSPACE_ENABLED: true,
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return env[key];
|
||||
});
|
||||
|
||||
@ -91,6 +93,7 @@ describe('DomainManagerService', () => {
|
||||
FRONTEND_URL: 'https://example.com',
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return env[key];
|
||||
});
|
||||
|
||||
@ -109,6 +112,7 @@ describe('DomainManagerService', () => {
|
||||
DEFAULT_SUBDOMAIN: 'test',
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return env[key];
|
||||
});
|
||||
|
||||
@ -129,6 +133,7 @@ describe('DomainManagerService', () => {
|
||||
DEFAULT_SUBDOMAIN: 'default',
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return env[key];
|
||||
});
|
||||
|
||||
@ -151,6 +156,7 @@ describe('DomainManagerService', () => {
|
||||
FRONTEND_URL: 'https://example.com',
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return env[key];
|
||||
});
|
||||
|
||||
@ -174,6 +180,7 @@ describe('DomainManagerService', () => {
|
||||
FRONTEND_URL: 'https://example.com',
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return env[key];
|
||||
});
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ export const objectRecordChangedProperties = <
|
||||
newRecord: PRecord,
|
||||
) => {
|
||||
const changedProperties = Object.keys(newRecord).filter(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
(key) => !deepEqual(oldRecord[key], newRecord[key]),
|
||||
);
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ export const useSentryTracing = <
|
||||
onExecute({ args }) {
|
||||
const transactionName = args.operationName || 'Anonymous Operation';
|
||||
const rootOperation = args.document.definitions.find(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
(o) => o.kind === Kind.OPERATION_DEFINITION,
|
||||
) as OperationDefinitionNode;
|
||||
const operationType = rootOperation.operation;
|
||||
|
||||
@ -212,6 +212,7 @@ describe('FeatureFlagService', () => {
|
||||
// Assert
|
||||
expect(result).toEqual(mockFeatureFlag);
|
||||
expect(mockFeatureFlagRepository.save).toHaveBeenCalledWith({
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
key: FeatureFlagKey[featureFlag],
|
||||
value,
|
||||
workspaceId,
|
||||
|
||||
@ -99,6 +99,7 @@ export class FeatureFlagService {
|
||||
),
|
||||
);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const featureFlagKey = FeatureFlagKey[featureFlag];
|
||||
|
||||
if (shouldBePublic) {
|
||||
|
||||
@ -7,6 +7,7 @@ const assertIsFeatureFlagKey = (
|
||||
featureFlagKey: string,
|
||||
exceptionToThrow: CustomException,
|
||||
): asserts featureFlagKey is FeatureFlagKey => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
if (isDefined(FeatureFlagKey[featureFlagKey])) return;
|
||||
throw exceptionToThrow;
|
||||
};
|
||||
|
||||
@ -67,6 +67,7 @@ export class S3Driver implements StorageDriver {
|
||||
await this.s3Client.send(command);
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
private async emptyS3Directory(folderPath) {
|
||||
const listParams = {
|
||||
Bucket: this.bucketName,
|
||||
|
||||
@ -40,6 +40,7 @@ export class FileController {
|
||||
@Req() req: Request,
|
||||
) {
|
||||
const folderPath = checkFilePath(params[0]);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const filename = checkFilename(params['filename']);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
@ -26,6 +26,7 @@ export const checkFilePath = (filePath: string): string => {
|
||||
if (
|
||||
folder !== kebabCase(FileFolder.ServerlessFunction) &&
|
||||
size &&
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
!settings.storage.imageCropSizes[folder]?.includes(size)
|
||||
) {
|
||||
throw new BadRequestException(`Size ${size} is not allowed`);
|
||||
|
||||
@ -54,6 +54,7 @@ export const useGraphQLErrorHandlerHook = <
|
||||
async onExecute({ args }) {
|
||||
const exceptionHandlerService = options.exceptionHandlerService;
|
||||
const rootOperation = args.document.definitions.find(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
(o) => o.kind === Kind.OPERATION_DEFINITION,
|
||||
) as OperationDefinitionNode;
|
||||
|
||||
|
||||
@ -75,6 +75,7 @@ export class KeyValuePairService<
|
||||
const conflictPaths = Object.keys(upsertData).filter(
|
||||
(key) =>
|
||||
['userId', 'workspaceId', 'key'].includes(key) &&
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
upsertData[key] !== undefined,
|
||||
);
|
||||
|
||||
|
||||
@ -14,11 +14,13 @@ export interface MessageQueueDriver {
|
||||
data: T,
|
||||
options?: QueueJobOptions,
|
||||
): Promise<void>;
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
work<T extends MessageQueueJobData>(
|
||||
queueName: MessageQueue,
|
||||
handler: ({ data, id }: { data: T; id: string }) => Promise<void> | void,
|
||||
options?: MessageQueueWorkerOptions,
|
||||
);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
addCron<T extends MessageQueueJobData | undefined>({
|
||||
queueName,
|
||||
jobName,
|
||||
@ -32,6 +34,7 @@ export interface MessageQueueDriver {
|
||||
options: QueueCronJobOptions;
|
||||
jobId?: string;
|
||||
});
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
removeCron({
|
||||
queueName,
|
||||
jobName,
|
||||
|
||||
@ -148,6 +148,7 @@ export class MessageQueueExplorer implements OnModuleInit {
|
||||
const filteredProcessMethodNames = processMethodNames.filter(
|
||||
(processMethodName) => {
|
||||
const metadata = this.metadataAccessor.getProcessMetadata(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
instance[processMethodName],
|
||||
);
|
||||
|
||||
@ -203,6 +204,7 @@ export class MessageQueueExplorer implements OnModuleInit {
|
||||
) {
|
||||
for (const processMethodName of processMethodNames) {
|
||||
try {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
await instance[processMethodName].call(instance, job.data);
|
||||
} catch (err) {
|
||||
if (!shouldFilterException(err)) {
|
||||
|
||||
@ -156,9 +156,12 @@ export class TimelineMessagingService {
|
||||
if (!threadParticipant.message.messageThreadId)
|
||||
return threadParticipantsAcc;
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
if (!threadParticipantsAcc[threadParticipant.message.messageThreadId])
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
threadParticipantsAcc[threadParticipant.message.messageThreadId] = [];
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
threadParticipantsAcc[threadParticipant.message.messageThreadId].push(
|
||||
threadParticipant,
|
||||
);
|
||||
@ -248,6 +251,7 @@ export class TimelineMessagingService {
|
||||
[key: string]: MessageChannelVisibility;
|
||||
} = messageThreadIds.reduce((threadVisibilityAcc, messageThreadId) => {
|
||||
// If the workspace member is not the owner of the thread, use the visibility value from the query
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
threadVisibilityAcc[messageThreadId] =
|
||||
threadIdsWithoutWorkspaceMember.includes(messageThreadId)
|
||||
? (threadVisibilityByThreadIdForWhichWorkspaceMemberIsNotOwner?.[
|
||||
|
||||
@ -258,7 +258,9 @@ export class SearchService {
|
||||
}
|
||||
|
||||
return (
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
(STANDARD_OBJECTS_BY_PRIORITY_RANK[b.objectNameSingular] || 0) -
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
(STANDARD_OBJECTS_BY_PRIORITY_RANK[a.objectNameSingular] || 0)
|
||||
);
|
||||
});
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import fs from 'fs';
|
||||
import { pipeline } from 'stream/promises';
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
import archiver from 'archiver';
|
||||
|
||||
export const createZipFile = async (
|
||||
|
||||
@ -15,6 +15,7 @@ export class ConsoleListener {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
intercept(callback: (type: string, message: any[]) => void) {
|
||||
Object.keys(this.originalConsole).forEach((method) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
console[method] = (...args: any[]) => {
|
||||
callback(method, args);
|
||||
@ -24,8 +25,10 @@ export class ConsoleListener {
|
||||
|
||||
release() {
|
||||
Object.keys(this.originalConsole).forEach((method) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
console[method] = (...args: any[]) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
this.originalConsole[method](...args);
|
||||
};
|
||||
});
|
||||
|
||||
@ -3,8 +3,7 @@ import { Transform } from 'class-transformer';
|
||||
export const CastToPositiveNumber = () =>
|
||||
Transform(({ value }: { value: string }) => toNumber(value));
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const toNumber = (value: any) => {
|
||||
const toNumber = (value: unknown): number | undefined => {
|
||||
if (typeof value === 'number') {
|
||||
return value >= 0 ? value : undefined;
|
||||
}
|
||||
|
||||
@ -382,6 +382,7 @@ describe('TwentyConfigService', () => {
|
||||
SENSITIVE_VAR: 'sensitive_data_123',
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return values[keyStr] || undefined;
|
||||
});
|
||||
|
||||
@ -390,6 +391,7 @@ describe('TwentyConfigService', () => {
|
||||
.mockImplementation((key: keyof ConfigVariables) => {
|
||||
const keyStr = String(key);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
if (mockConfigVarMetadata[keyStr]?.isEnvOnly) {
|
||||
return environmentConfigDriver.get(key);
|
||||
}
|
||||
@ -398,6 +400,7 @@ describe('TwentyConfigService', () => {
|
||||
SENSITIVE_VAR: 'sensitive_data_123',
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return values[keyStr] || undefined;
|
||||
});
|
||||
};
|
||||
|
||||
@ -64,12 +64,14 @@ describe('applyBasicValidators', () => {
|
||||
const mockTransformParams = { value: 'true' };
|
||||
|
||||
(configTransformers.boolean as jest.Mock).mockReturnValueOnce(true);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const result1 = transformFn(mockTransformParams);
|
||||
|
||||
expect(configTransformers.boolean).toHaveBeenCalledWith('true');
|
||||
expect(result1).toBe(true);
|
||||
|
||||
(configTransformers.boolean as jest.Mock).mockReturnValueOnce(undefined);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const result2 = transformFn(mockTransformParams);
|
||||
|
||||
expect(result2).toBe('true');
|
||||
@ -99,12 +101,14 @@ describe('applyBasicValidators', () => {
|
||||
const mockTransformParams = { value: '42' };
|
||||
|
||||
(configTransformers.number as jest.Mock).mockReturnValueOnce(42);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const result1 = transformFn(mockTransformParams);
|
||||
|
||||
expect(configTransformers.number).toHaveBeenCalledWith('42');
|
||||
expect(result1).toBe(42);
|
||||
|
||||
(configTransformers.number as jest.Mock).mockReturnValueOnce(undefined);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const result2 = transformFn(mockTransformParams);
|
||||
|
||||
expect(result2).toBe('42');
|
||||
|
||||
@ -35,8 +35,10 @@ describe('mergeUserVars', () => {
|
||||
});
|
||||
|
||||
it('should merge user vars correctly when user vars are empty', () => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const userVars = [];
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const mergedUserVars = mergeUserVars(userVars);
|
||||
|
||||
expect(mergedUserVars).toEqual(new Map());
|
||||
|
||||
@ -129,11 +129,15 @@ export class UserResolver {
|
||||
|
||||
const grantedSettingsPermissions: SettingPermissionType[] = (
|
||||
Object.keys(settingsPermissions) as SettingPermissionType[]
|
||||
).filter((feature) => settingsPermissions[feature] === true);
|
||||
)
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.filter((feature) => settingsPermissions[feature] === true);
|
||||
|
||||
const grantedObjectRecordsPermissions = (
|
||||
Object.keys(objectRecordsPermissions) as PermissionsOnAllObjectRecords[]
|
||||
).filter((permission) => objectRecordsPermissions[permission] === true);
|
||||
)
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.filter((permission) => objectRecordsPermissions[permission] === true);
|
||||
|
||||
currentUserWorkspace.settingsPermissions = grantedSettingsPermissions;
|
||||
currentUserWorkspace.objectRecordsPermissions =
|
||||
|
||||
@ -31,6 +31,7 @@ export const actorCompositeType: CompositeType = {
|
||||
(key, index) =>
|
||||
({
|
||||
id: v4(),
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
label: `${FieldActorSource[key].toLowerCase()}`,
|
||||
value: key,
|
||||
position: index,
|
||||
|
||||
@ -124,6 +124,7 @@ export class FieldMetadataValidationService<
|
||||
if (
|
||||
enumOptions &&
|
||||
(enumOptions.includes(formattedDefaultValue) ||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
enumOptions.some((option) => option.to === formattedDefaultValue))
|
||||
) {
|
||||
return;
|
||||
|
||||
@ -699,6 +699,7 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
||||
}
|
||||
|
||||
const translationValue =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fieldMetadata.standardOverrides?.translations?.[locale]?.[labelKey];
|
||||
|
||||
if (isDefined(translationValue)) {
|
||||
|
||||
@ -29,6 +29,7 @@ export const unserializeDefaultValue = (
|
||||
if (typeof serializedDefaultValue === 'object') {
|
||||
return Object.entries(serializedDefaultValue).reduce(
|
||||
(acc, [key, value]) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[key] = unserializeDefaultValue(value);
|
||||
|
||||
return acc;
|
||||
|
||||
@ -73,6 +73,7 @@ export const validateDefaultValueForType = (
|
||||
};
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const validators = defaultValueValidatorsMap[type] as any[];
|
||||
|
||||
|
||||
@ -31,10 +31,12 @@ export class IsFieldMetadataDefaultValue
|
||||
args: ValidationArguments,
|
||||
): Promise<boolean> {
|
||||
// Try to extract type value from the object
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
let type: FieldMetadataType | null = args.object['type'];
|
||||
|
||||
if (!type) {
|
||||
// Extract id value from the instance, should happen only when updating
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const id: string | undefined = args.instance?.['id'];
|
||||
|
||||
if (!id) {
|
||||
|
||||
@ -25,10 +25,12 @@ export class IsFieldMetadataOptions {
|
||||
args: ValidationArguments,
|
||||
): Promise<boolean> {
|
||||
// Try to extract type value from the object
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
let type: FieldMetadataType | null = args.object['type'];
|
||||
|
||||
if (!type) {
|
||||
// Extract id value from the instance, should happen only when updating
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const id: string | undefined = args.instance?.['id'];
|
||||
|
||||
if (!id) {
|
||||
|
||||
@ -474,6 +474,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
acc[object.standardId ?? ''] = {
|
||||
id: object.id,
|
||||
fields: object.fields.reduce((acc, field) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[field.standardId ?? ''] = field.id;
|
||||
|
||||
return acc;
|
||||
@ -608,6 +609,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
}
|
||||
|
||||
const translationValue =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectMetadata.standardOverrides?.translations?.[locale]?.[labelKey];
|
||||
|
||||
if (isDefined(translationValue)) {
|
||||
|
||||
@ -160,6 +160,7 @@ export class ObjectMetadataFieldRelationService {
|
||||
standardId: createRelationDeterministicUuid({
|
||||
objectId: sourceObjectMetadata.id,
|
||||
standardId:
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
STANDARD_OBJECT_FIELD_IDS[targetObjectMetadata.nameSingular].custom,
|
||||
}),
|
||||
objectMetadataId: targetObjectMetadata.id,
|
||||
@ -192,6 +193,7 @@ export class ObjectMetadataFieldRelationService {
|
||||
const sourceFieldMetadataToUpdate =
|
||||
await this.fieldMetadataRepository.findOneByOrFail({
|
||||
standardId:
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
CUSTOM_OBJECT_STANDARD_FIELD_IDS[targetObjectMetadata.namePlural],
|
||||
objectMetadataId: sourceObjectMetadata.id,
|
||||
workspaceId: workspaceId,
|
||||
@ -239,6 +241,7 @@ export class ObjectMetadataFieldRelationService {
|
||||
return {
|
||||
id: uuidV4(),
|
||||
standardId:
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
CUSTOM_OBJECT_STANDARD_FIELD_IDS[relationObjectMetadataNamePlural],
|
||||
objectMetadataId: sourceObjectMetadata.id,
|
||||
workspaceId: workspaceId,
|
||||
@ -250,6 +253,7 @@ export class ObjectMetadataFieldRelationService {
|
||||
label: capitalize(relationObjectMetadataNamePlural),
|
||||
description,
|
||||
icon:
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
STANDARD_OBJECT_ICONS[targetObjectMetadata.nameSingular] ||
|
||||
'IconBuildingSkyscraper',
|
||||
isNullable: true,
|
||||
@ -280,6 +284,7 @@ export class ObjectMetadataFieldRelationService {
|
||||
targetObjectMetadata: ObjectMetadataEntity,
|
||||
): Partial<FieldMetadataEntity<FieldMetadataType.RELATION>> {
|
||||
const customStandardFieldId =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
STANDARD_OBJECT_FIELD_IDS[targetObjectMetadata.nameSingular].custom;
|
||||
|
||||
if (!customStandardFieldId) {
|
||||
@ -318,6 +323,7 @@ export class ObjectMetadataFieldRelationService {
|
||||
targetObjectMetadata: ObjectMetadataEntity,
|
||||
) {
|
||||
const customStandardFieldId =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
STANDARD_OBJECT_FIELD_IDS[targetObjectMetadata.nameSingular].custom;
|
||||
|
||||
if (!customStandardFieldId) {
|
||||
|
||||
@ -96,6 +96,7 @@ export class DistantTableService {
|
||||
await entityManager.query(`DROP SCHEMA "${tmpSchemaName}" CASCADE`);
|
||||
|
||||
return createdForeignTableNames.reduce(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
(acc, { table_name, column_name, data_type, udt_name }) => {
|
||||
if (!acc[table_name]) {
|
||||
acc[table_name] = [];
|
||||
|
||||
@ -41,11 +41,15 @@ export class ForeignTableService {
|
||||
await this.workspaceDataSourceService.connectToMainDataSource();
|
||||
|
||||
return (
|
||||
await mainDataSource.query(
|
||||
`SELECT foreign_table_name, foreign_server_name FROM information_schema.foreign_tables WHERE foreign_server_name = $1`,
|
||||
[foreignDataWrapperId],
|
||||
(
|
||||
await mainDataSource.query(
|
||||
`SELECT foreign_table_name, foreign_server_name FROM information_schema.foreign_tables WHERE foreign_server_name = $1`,
|
||||
[foreignDataWrapperId],
|
||||
)
|
||||
)
|
||||
).map((foreignTable) => foreignTable.foreign_table_name);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.map((foreignTable) => foreignTable.foreign_table_name)
|
||||
);
|
||||
}
|
||||
|
||||
public async createForeignTable(
|
||||
|
||||
@ -62,6 +62,7 @@ export class RemoteTableSchemaUpdateService {
|
||||
const tableName = remoteTable.distantTableName;
|
||||
|
||||
if (!distantTable) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
updates[tableName] = [DistantTableUpdate.TABLE_DELETED];
|
||||
continue;
|
||||
}
|
||||
@ -78,13 +79,17 @@ export class RemoteTableSchemaUpdateService {
|
||||
);
|
||||
|
||||
if (columnsAdded.length > 0) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
updates[tableName] = [
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
...(updates[tableName] || []),
|
||||
DistantTableUpdate.COLUMNS_ADDED,
|
||||
];
|
||||
}
|
||||
if (columnsDeleted.length > 0) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
updates[tableName] = [
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
...(updates[tableName] || []),
|
||||
DistantTableUpdate.COLUMNS_DELETED,
|
||||
];
|
||||
|
||||
@ -16,6 +16,7 @@ export const fetchTableColumns = async (
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return res.map((column) => ({
|
||||
columnName: column.column_name,
|
||||
dataType: column.data_type,
|
||||
|
||||
@ -44,10 +44,12 @@ export const buildUpdateRemoteServerRawQuery = (
|
||||
}
|
||||
|
||||
if (remoteServerToUpdate.schema) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
options.push(`"schema" = $${parametersPositions['schema']}`);
|
||||
}
|
||||
|
||||
if (remoteServerToUpdate.label) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
options.push(`"label" = $${parametersPositions['label']}`);
|
||||
}
|
||||
|
||||
@ -78,6 +80,7 @@ const buildParametersAndPositions = (
|
||||
Object.entries(remoteServerToUpdate.userMappingOptions).forEach(
|
||||
([key, value]) => {
|
||||
parameters.push(value);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
parametersPositions[key] = parameters.length;
|
||||
},
|
||||
);
|
||||
@ -87,6 +90,7 @@ const buildParametersAndPositions = (
|
||||
Object.entries(remoteServerToUpdate.foreignDataWrapperOptions).forEach(
|
||||
([key, value]) => {
|
||||
parameters.push(value);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
parametersPositions[key] = parameters.length;
|
||||
},
|
||||
);
|
||||
@ -94,11 +98,13 @@ const buildParametersAndPositions = (
|
||||
|
||||
if (remoteServerToUpdate.schema) {
|
||||
parameters.push(remoteServerToUpdate.schema);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
parametersPositions['schema'] = parameters.length;
|
||||
}
|
||||
|
||||
if (remoteServerToUpdate.label) {
|
||||
parameters.push(remoteServerToUpdate.label);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
parametersPositions['label'] = parameters.length;
|
||||
}
|
||||
|
||||
@ -119,9 +125,11 @@ const buildJsonRawQuery = (
|
||||
): string => {
|
||||
const [[firstKey, _], ...followingOptions] = Object.entries(opts);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
let query = `jsonb_set("${objectName}", '{${firstKey}}', to_jsonb($${parametersPositions[firstKey]}::text))`;
|
||||
|
||||
followingOptions.forEach(([key, _]) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
query = `jsonb_set(${query}, '{${key}}', to_jsonb($${parametersPositions[key]}::text))`;
|
||||
});
|
||||
|
||||
|
||||
@ -266,6 +266,7 @@ export class RoleService {
|
||||
isArgDefinedIfProvidedOrThrow({
|
||||
input,
|
||||
key,
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
value: input[key],
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
@ -51,6 +51,7 @@ export class ServerlessFunctionService {
|
||||
private readonly messageQueueService: MessageQueueService,
|
||||
) {}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
async findManyServerlessFunctions(where) {
|
||||
return this.serverlessFunctionRepository.findBy(where);
|
||||
}
|
||||
@ -276,6 +277,7 @@ export class ServerlessFunctionService {
|
||||
|
||||
for (const key of Object.keys(serverlessFunctionInput.code)) {
|
||||
await this.fileStorageService.write({
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
file: serverlessFunctionInput.code[key],
|
||||
name: basename(key),
|
||||
mimeType: undefined,
|
||||
@ -306,6 +308,7 @@ export class ServerlessFunctionService {
|
||||
const packageName = match[1].split('@', 1)[0];
|
||||
const version = match[2];
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
if (packageJson.dependencies[packageName]) {
|
||||
versions[packageName] = version;
|
||||
}
|
||||
|
||||
@ -59,6 +59,7 @@ export class CompositeColumnActionFactory extends ColumnActionAbstractFactory<Co
|
||||
}
|
||||
|
||||
const columnName = computeCompositeColumnName(fieldMetadata, property);
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const defaultValue = fieldMetadata.defaultValue?.[property.name];
|
||||
const serializedDefaultValue = serializeDefaultValue(defaultValue);
|
||||
const enumOptions = property.options
|
||||
@ -139,6 +140,7 @@ export class CompositeColumnActionFactory extends ColumnActionAbstractFactory<Co
|
||||
alteredProperty,
|
||||
);
|
||||
const defaultValue =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
alteredFieldMetadata.defaultValue?.[alteredProperty.name];
|
||||
const serializedDefaultValue = serializeDefaultValue(defaultValue);
|
||||
const enumOptions = alteredProperty.options
|
||||
@ -173,6 +175,7 @@ export class CompositeColumnActionFactory extends ColumnActionAbstractFactory<Co
|
||||
currentFieldMetadata.isNullable || !currentProperty.isRequired,
|
||||
isUnique: currentFieldMetadata.isUnique ?? false,
|
||||
defaultValue: serializeDefaultValue(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
currentFieldMetadata.defaultValue?.[currentProperty.name],
|
||||
),
|
||||
isArray:
|
||||
|
||||
@ -224,6 +224,7 @@ export class WorkspacePermissionsCacheService {
|
||||
workspaceId,
|
||||
});
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return userWorkspaceRoleMap[userWorkspaceId];
|
||||
}
|
||||
|
||||
|
||||
@ -10,8 +10,11 @@ import { convertClassNameToObjectMetadataName } from 'src/engine/workspace-manag
|
||||
@Global()
|
||||
@Module({})
|
||||
export class ObjectMetadataRepositoryModule {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
static forFeature(objectMetadatas): DynamicModule {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const providers: Provider[] = objectMetadatas.map((objectMetadata) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const repositoryClass = metadataToRepositoryMapping[objectMetadata.name];
|
||||
|
||||
if (!repositoryClass) {
|
||||
|
||||
@ -112,6 +112,7 @@ export class SeederService {
|
||||
|
||||
const subFieldNameAsSQLColumnName = `${field.name}${capitalize(subFieldName)}`;
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectRecordSeedsAsSQLFlattenedSeeds[
|
||||
subFieldNameAsSQLColumnName
|
||||
] = subFieldValueAsSQLValue;
|
||||
@ -124,6 +125,7 @@ export class SeederService {
|
||||
fieldValue,
|
||||
);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectRecordSeedsAsSQLFlattenedSeeds[field.name] =
|
||||
fieldValueAsSQLValue;
|
||||
}
|
||||
|
||||
@ -122,6 +122,7 @@ export class EntitySchemaColumnFactory {
|
||||
);
|
||||
const columnType = fieldMetadataTypeToColumnType(compositeProperty.type);
|
||||
const defaultValue = serializeDefaultValue(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fieldMetadata.defaultValue?.[compositeProperty.name],
|
||||
);
|
||||
|
||||
|
||||
@ -16,15 +16,20 @@ export class ScopedWorkspaceContextFactory {
|
||||
isExecutedByApiKey: boolean;
|
||||
} {
|
||||
const workspaceId: string | undefined =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
this.request?.['req']?.['workspaceId'] ||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
this.request?.['params']?.['workspaceId'];
|
||||
const workspaceMetadataVersion: number | undefined =
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
this.request?.['req']?.['workspaceMetadataVersion'];
|
||||
|
||||
return {
|
||||
workspaceId: workspaceId ?? null,
|
||||
workspaceMetadataVersion: workspaceMetadataVersion ?? null,
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
userWorkspaceId: this.request?.['req']?.['userWorkspaceId'] ?? null,
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
isExecutedByApiKey: !!this.request?.['req']?.['apiKey'],
|
||||
};
|
||||
}
|
||||
|
||||
@ -63,17 +63,20 @@ export function formatResult<T>(
|
||||
|
||||
if (!compositePropertyArgs && !isRelation) {
|
||||
if (isPlainObject(value)) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[key] = formatResult(
|
||||
value,
|
||||
objectMetadataItemWithFieldMaps,
|
||||
objectMetadataMaps,
|
||||
);
|
||||
} else if (objectMetadaItemFieldsByName[key]) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[key] = formatFieldMetadataValue(
|
||||
value,
|
||||
objectMetadaItemFieldsByName[key],
|
||||
);
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[key] = value;
|
||||
}
|
||||
|
||||
@ -96,6 +99,7 @@ export function formatResult<T>(
|
||||
);
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[key] = formatResult(
|
||||
value,
|
||||
targetObjectMetadata,
|
||||
@ -109,10 +113,13 @@ export function formatResult<T>(
|
||||
|
||||
const { parentField, ...compositeProperty } = compositePropertyArgs;
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
if (!newData[parentField]) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[parentField] = {};
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[parentField][compositeProperty.name] = value;
|
||||
}
|
||||
|
||||
@ -135,6 +142,7 @@ export function formatResult<T>(
|
||||
new Date().getTimezoneOffset() * 60 * 1000;
|
||||
|
||||
for (const dateFieldMetadata of dateFieldMetadataCollection) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const rawUpdatedDate = newData[dateFieldMetadata.name] as
|
||||
| string
|
||||
| null
|
||||
@ -152,9 +160,11 @@ export function formatResult<T>(
|
||||
serverOffsetInMillisecondsToCounterActTypeORMAutomaticTimezoneShift,
|
||||
);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[dateFieldMetadata.name] = shiftedDate;
|
||||
}
|
||||
} else if (isNonEmptyString(rawUpdatedDate)) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const currentDate = new Date(newData[dateFieldMetadata.name]);
|
||||
|
||||
const shiftedDate = new Date(
|
||||
@ -162,6 +172,7 @@ export function formatResult<T>(
|
||||
serverOffsetInMillisecondsToCounterActTypeORMAutomaticTimezoneShift,
|
||||
);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
newData[dateFieldMetadata.name] = shiftedDate;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,8 +104,10 @@ const convertHttpExceptionToGraphql = (exception: HttpException) => {
|
||||
let error: BaseGraphQLError;
|
||||
|
||||
if (status in graphQLPredefinedExceptions) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const message = exception.getResponse()['message'] ?? exception.message;
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
error = new graphQLPredefinedExceptions[exception.getStatus()](message);
|
||||
} else {
|
||||
error = new BaseGraphQLError(
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
|
||||
export const shouldSeedWorkspaceFavorite = (
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectMetadataId,
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectMetadataMap,
|
||||
): boolean =>
|
||||
objectMetadataId !==
|
||||
|
||||
@ -16,7 +16,9 @@ const generateRandomAmountMicros = () => {
|
||||
return firstDigit * 10000000000;
|
||||
};
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const generateOpportunities = (companies) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return companies.map((company) => ({
|
||||
id: v4(),
|
||||
name: company.name,
|
||||
@ -66,6 +68,7 @@ export const seedOpportunityWithDemoData = async (
|
||||
])
|
||||
.orIgnore()
|
||||
.values(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
opportunities.map((opportunity, index) => ({
|
||||
...opportunity,
|
||||
position: index,
|
||||
|
||||
@ -16,9 +16,11 @@ export const seedWorkspaceWithDemoData = async (
|
||||
objectMetadata: ObjectMetadataEntity[],
|
||||
) => {
|
||||
const objectMetadataMap = objectMetadata.reduce((acc, object) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[object.standardId ?? ''] = {
|
||||
id: object.id,
|
||||
fields: object.fields.reduce((acc, field) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[field.standardId ?? ''] = field.id;
|
||||
|
||||
return acc;
|
||||
|
||||
@ -18,6 +18,7 @@ export const standardObjectsPrefillData = async (
|
||||
throw new Error('Standard Id is not set for object: ${object.name}');
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[object.standardId] = {
|
||||
id: object.id,
|
||||
fields: object.fields.reduce((acc, field) => {
|
||||
@ -25,6 +26,7 @@ export const standardObjectsPrefillData = async (
|
||||
throw new Error('Standard Id is not set for field: ${field.name}');
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[field.standardId] = field.id;
|
||||
|
||||
return acc;
|
||||
|
||||
@ -134,6 +134,7 @@ export class WorkspaceDefaultValueFixer extends AbstractWorkspaceFixer<Workspace
|
||||
continue;
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const value = currentDefaultValue[key];
|
||||
|
||||
const newValue =
|
||||
|
||||
@ -303,7 +303,8 @@ export class DatabaseStructureService {
|
||||
normalizer(
|
||||
compositeProperty.type,
|
||||
typeof initialDefaultValue === 'object'
|
||||
? initialDefaultValue?.[compositeProperty.name]
|
||||
? // @ts-expect-error legacy noImplicitAny
|
||||
initialDefaultValue?.[compositeProperty.name]
|
||||
: null,
|
||||
),
|
||||
);
|
||||
|
||||
@ -18,9 +18,11 @@ describe('WorkspaceRelationComparator', () => {
|
||||
}
|
||||
|
||||
it('should generate CREATE action for new relations', () => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const original = [];
|
||||
const standard = [createMockRelationMetadata({})];
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const result = comparator.compare(original, standard);
|
||||
|
||||
expect(result).toEqual([
|
||||
@ -36,8 +38,10 @@ describe('WorkspaceRelationComparator', () => {
|
||||
|
||||
it('should generate DELETE action for removed relations', () => {
|
||||
const original = [createMockRelationMetadata({ id: '1' })];
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const standard = [];
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const result = comparator.compare(original, standard);
|
||||
|
||||
expect(result).toEqual([
|
||||
|
||||
@ -51,10 +51,12 @@ export function transformMetadataForComparison<T, Keys extends keyof T>(
|
||||
) {
|
||||
const orderedValue = orderObjectProperties(datum[property] as object);
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
transformedField[property as string] = JSON.stringify(
|
||||
orderedValue,
|
||||
) as T[Keys];
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
transformedField[property as string] = datum[property];
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,8 +183,10 @@ export class WorkspaceFieldRelationComparator {
|
||||
}
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
propertiesMap[fieldId][property] = newValue;
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
propertiesMap[fieldId][property] = difference.value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,10 +191,12 @@ export class WorkspaceFieldComparator {
|
||||
if (
|
||||
(fieldPropertiesToStringify as readonly string[]).includes(property)
|
||||
) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fieldPropertiesToUpdateMap[id][property] = this.parseJSONOrString(
|
||||
difference.value,
|
||||
);
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
fieldPropertiesToUpdateMap[id][property] = difference.value;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -74,6 +74,7 @@ export class WorkspaceObjectComparator {
|
||||
|
||||
const property = difference.path[0];
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectPropertiesToUpdate[property] = standardObjectMetadata[property];
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,12 +26,15 @@ export class MicrosoftEmailAliasManagerService {
|
||||
|
||||
const handleAliases =
|
||||
proxyAddresses
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
?.filter((address) => {
|
||||
return address.startsWith('SMTP:') === false;
|
||||
})
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.map((address) => {
|
||||
return address.replace('smtp:', '').toLowerCase();
|
||||
})
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.filter((address) => {
|
||||
return address !== '';
|
||||
}) || [];
|
||||
|
||||
@ -21,6 +21,7 @@ describe('Email Alias Manager Service', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
connectedAccountRepository = {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
update: jest.fn().mockResolvedValue((arg) => arg),
|
||||
};
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ export function filterOutSelfAndContactsFromCompanyOrWorkspace(
|
||||
|
||||
const workspaceMembersMap = workspaceMembers.reduce(
|
||||
(map, workspaceMember) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
map[workspaceMember.userEmail.toLowerCase()] = true;
|
||||
|
||||
return map;
|
||||
@ -36,6 +37,7 @@ export function filterOutSelfAndContactsFromCompanyOrWorkspace(
|
||||
(contact) =>
|
||||
(isDifferentDomain(contact, selfDomainName) ||
|
||||
!isWorkDomain(selfDomainName)) &&
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
!workspaceMembersMap[contact.handle.toLowerCase()] &&
|
||||
!allHandles.includes(contact.handle.toLowerCase()),
|
||||
);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
import psl from 'psl';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
import psl from 'psl';
|
||||
|
||||
export const getDomainNameFromHandle = (handle: string): string => {
|
||||
|
||||
@ -77,6 +77,7 @@ export class GmailGetMessageListService {
|
||||
firstMessageExternalId = messageList.data.messages?.[0].id ?? undefined;
|
||||
}
|
||||
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
messageExternalIds.push(...messages.map((message) => message.id));
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { gmail_v1 as gmailV1 } from 'googleapis';
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
import planer from 'planer';
|
||||
|
||||
import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
|
||||
|
||||
@ -91,14 +91,17 @@ export class MicrosoftGetMessagesService {
|
||||
'from',
|
||||
),
|
||||
...formatAddressObjectAsParticipants(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
response?.toRecipients?.map((recipient) => recipient.emailAddress),
|
||||
'to',
|
||||
),
|
||||
...formatAddressObjectAsParticipants(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
response?.ccRecipients?.map((recipient) => recipient.emailAddress),
|
||||
'cc',
|
||||
),
|
||||
...formatAddressObjectAsParticipants(
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
response?.bccRecipients?.map((recipient) => recipient.emailAddress),
|
||||
'bcc',
|
||||
),
|
||||
|
||||
@ -175,34 +175,38 @@ export class TimelineActivityService {
|
||||
if (activityTargets.length === 0) return;
|
||||
if (activity.length === 0) return;
|
||||
|
||||
return activityTargets
|
||||
.map((activityTarget) => {
|
||||
const targetColumn: string[] = Object.entries(activityTarget)
|
||||
.map(([columnName, columnValue]: [string, string]) => {
|
||||
if (
|
||||
columnName === activityType + 'Id' ||
|
||||
!columnName.endsWith('Id')
|
||||
)
|
||||
return;
|
||||
if (columnValue === null) return;
|
||||
return (
|
||||
activityTargets
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.map((activityTarget) => {
|
||||
const targetColumn: string[] = Object.entries(activityTarget)
|
||||
.map(([columnName, columnValue]: [string, string]) => {
|
||||
if (
|
||||
columnName === activityType + 'Id' ||
|
||||
!columnName.endsWith('Id')
|
||||
)
|
||||
return;
|
||||
if (columnValue === null) return;
|
||||
|
||||
return columnName;
|
||||
})
|
||||
.filter((column): column is string => column !== undefined);
|
||||
return columnName;
|
||||
})
|
||||
.filter((column): column is string => column !== undefined);
|
||||
|
||||
if (targetColumn.length === 0) return;
|
||||
if (targetColumn.length === 0) return;
|
||||
|
||||
return {
|
||||
...event,
|
||||
name: 'linked-' + eventName,
|
||||
objectName: targetColumn[0].replace(/Id$/, ''),
|
||||
recordId: activityTarget[targetColumn[0]],
|
||||
linkedRecordCachedName: activity[0].title,
|
||||
linkedRecordId: activity[0].id,
|
||||
linkedObjectMetadataId: event.objectMetadata.id,
|
||||
} satisfies TimelineActivity;
|
||||
})
|
||||
.filter((event): event is TimelineActivity => event !== undefined);
|
||||
return {
|
||||
...event,
|
||||
name: 'linked-' + eventName,
|
||||
objectName: targetColumn[0].replace(/Id$/, ''),
|
||||
recordId: activityTarget[targetColumn[0]],
|
||||
linkedRecordCachedName: activity[0].title,
|
||||
linkedRecordId: activity[0].id,
|
||||
linkedObjectMetadataId: event.objectMetadata.id,
|
||||
} satisfies TimelineActivity;
|
||||
})
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
.filter((event): event is TimelineActivity => event !== undefined)
|
||||
);
|
||||
}
|
||||
|
||||
private async computeActivityTargets({
|
||||
|
||||
@ -35,6 +35,7 @@ export class ViewService {
|
||||
);
|
||||
|
||||
for (const viewId of viewsIds) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
const position = positions?.[viewId];
|
||||
const newFieldInThisView = await viewFieldRepository.findBy({
|
||||
fieldMetadataId: fieldId,
|
||||
|
||||
@ -9,6 +9,7 @@ const companyMockObjectMetadataItem = mockObjectMetadataItemsWithFieldMaps.find(
|
||||
)!;
|
||||
|
||||
describe('generateFakeFormResponse', () => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
let objectMetadataRepository;
|
||||
|
||||
beforeEach(() => {
|
||||
@ -52,6 +53,7 @@ describe('generateFakeFormResponse', () => {
|
||||
const result = await generateFakeFormResponse({
|
||||
formMetadata: schema,
|
||||
workspaceId: '1',
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
objectMetadataRepository,
|
||||
});
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ export const generateFakeField = ({
|
||||
icon: icon,
|
||||
label: label,
|
||||
value: compositeType.properties.reduce((acc, property) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[property.name] = {
|
||||
isLeaf: true,
|
||||
type: property.type,
|
||||
|
||||
@ -572,7 +572,9 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
|
||||
const enrichedResponses = await Promise.all(
|
||||
responseKeys.map(async (key) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
if (!isDefined(response[key])) {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return { key, value: response[key] };
|
||||
}
|
||||
|
||||
@ -581,7 +583,9 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
if (
|
||||
field?.type === 'RECORD' &&
|
||||
field?.settings?.objectName &&
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
isDefined(response[key].id) &&
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
isValidUuid(response[key].id)
|
||||
) {
|
||||
const repository = await this.twentyORMManager.getRepository(
|
||||
@ -589,17 +593,20 @@ export class WorkflowVersionStepWorkspaceService {
|
||||
);
|
||||
|
||||
const record = await repository.findOne({
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
where: { id: response[key].id },
|
||||
});
|
||||
|
||||
return { key, value: record };
|
||||
} else {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
return { key, value: response[key] };
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
return enrichedResponses.reduce((acc, { key, value }) => {
|
||||
// @ts-expect-error legacy noImplicitAny
|
||||
acc[key] = value;
|
||||
|
||||
return acc;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user