POC: chore: use Nx workspace lint rules (#3163)
* chore: use Nx workspace lint rules Closes #3162 * Fix lint * Fix lint on BE * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -30,9 +30,8 @@ export class GoogleGmailService {
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
const connectedAccount = await workspaceDataSource?.query(
|
||||
`SELECT * FROM ${dataSourceMetadata.schema}."connectedAccount" WHERE "handle" = $1 AND "provider" = $2 AND "accountOwnerId" = $3`,
|
||||
|
||||
@ -51,9 +51,8 @@ export class JwtAuthStrategy extends PassportStrategy(Strategy, 'jwt') {
|
||||
workspace.id,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
const apiKey = await workspaceDataSource?.query(
|
||||
`SELECT * FROM ${dataSourceMetadata.schema}."apiKey" WHERE id = '${payload.jti}'`,
|
||||
|
||||
@ -16,9 +16,8 @@ export class TimelineMessagingService {
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
// 10 first threads This hard limit is just for the POC, we will implement pagination later
|
||||
const messageThreads = await workspaceDataSource?.query(
|
||||
@ -80,9 +79,8 @@ export class TimelineMessagingService {
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
const personIds = await workspaceDataSource?.query(
|
||||
`
|
||||
|
||||
@ -106,11 +106,14 @@ const computeSchemaComponent = (
|
||||
|
||||
if (requiredFields?.length) {
|
||||
result.required = requiredFields;
|
||||
result.example = requiredFields.reduce((example, requiredField) => {
|
||||
example[requiredField] = '';
|
||||
result.example = requiredFields.reduce(
|
||||
(example, requiredField) => {
|
||||
example[requiredField] = '';
|
||||
|
||||
return example;
|
||||
}, {} as Record<string, string>);
|
||||
return example;
|
||||
},
|
||||
{} as Record<string, string>,
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -119,11 +122,14 @@ const computeSchemaComponent = (
|
||||
export const computeSchemaComponents = (
|
||||
objectMetadataItems: ObjectMetadataEntity[],
|
||||
): Record<string, OpenAPIV3.SchemaObject> => {
|
||||
return objectMetadataItems.reduce((schemas, item) => {
|
||||
schemas[capitalize(item.nameSingular)] = computeSchemaComponent(item);
|
||||
return objectMetadataItems.reduce(
|
||||
(schemas, item) => {
|
||||
schemas[capitalize(item.nameSingular)] = computeSchemaComponent(item);
|
||||
|
||||
return schemas;
|
||||
}, {} as Record<string, OpenAPIV3.SchemaObject>);
|
||||
return schemas;
|
||||
},
|
||||
{} as Record<string, OpenAPIV3.SchemaObject>,
|
||||
);
|
||||
};
|
||||
|
||||
export const computeParameterComponents = (): Record<
|
||||
|
||||
@ -25,9 +25,8 @@ export class UserService extends TypeOrmQueryService<User> {
|
||||
user.defaultWorkspace.id,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
const workspaceMembers = await workspaceDataSource?.query(
|
||||
`SELECT * FROM ${dataSourceMetadata.schema}."workspaceMember" WHERE "userId" = '${user.id}'`,
|
||||
@ -55,9 +54,8 @@ export class UserService extends TypeOrmQueryService<User> {
|
||||
user.defaultWorkspace.id,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
await workspaceDataSource?.query(
|
||||
`INSERT INTO ${dataSourceMetadata.schema}."workspaceMember"
|
||||
|
||||
@ -76,9 +76,8 @@ export class DataSeedWorkspaceCommand extends CommandRunner {
|
||||
this.workspaceId,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
if (!workspaceDataSource) {
|
||||
throw new Error('Could not connect to workspace data source');
|
||||
|
||||
@ -49,9 +49,8 @@ export class TypeORMService implements OnModuleInit, OnModuleDestroy {
|
||||
this.isDatasourceInitializing.set(dataSource.id, true);
|
||||
|
||||
try {
|
||||
const dataSourceInstance = await this.createAndInitializeDataSource(
|
||||
dataSource,
|
||||
);
|
||||
const dataSourceInstance =
|
||||
await this.createAndInitializeDataSource(dataSource);
|
||||
|
||||
this.dataSources.set(dataSource.id, dataSourceInstance);
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
|
||||
import { QueueJobOptions } from 'src/integrations/message-queue/drivers/interfaces/job-options.interface';
|
||||
import { MessageQueueDriver } from 'src/integrations/message-queue/drivers/interfaces/message-queue-driver.interface';
|
||||
import {
|
||||
MessageQueueJob,
|
||||
@ -17,7 +16,6 @@ export class SyncDriver implements MessageQueueDriver {
|
||||
_queueName: MessageQueue,
|
||||
jobName: string,
|
||||
data: T,
|
||||
_options?: QueueJobOptions | undefined,
|
||||
): Promise<void> {
|
||||
const jobClassName = getJobClassName(jobName);
|
||||
const job: MessageQueueJob<MessageQueueJobData> = this.jobsModuleRef.get(
|
||||
@ -28,10 +26,7 @@ export class SyncDriver implements MessageQueueDriver {
|
||||
return await job.handle(data);
|
||||
}
|
||||
|
||||
work<T>(
|
||||
queueName: MessageQueue,
|
||||
handler: ({ data, id }: { data: T; id: string }) => void | Promise<void>,
|
||||
) {
|
||||
work() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,9 +112,8 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
||||
fieldMetadataInput.workspaceId,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
// TODO: use typeorm repository
|
||||
const view = await workspaceDataSource?.query(
|
||||
@ -141,8 +140,8 @@ export class FieldMetadataService extends TypeOrmQueryService<FieldMetadataEntit
|
||||
`INSERT INTO ${dataSourceMetadata.schema}."viewField"
|
||||
("fieldMetadataId", "position", "isVisible", "size", "viewId")
|
||||
VALUES ('${createdFieldMetadata.id}', '${lastPosition + 1}', true, 180, '${
|
||||
view[0].id
|
||||
}')`,
|
||||
view[0].id
|
||||
}')`,
|
||||
);
|
||||
|
||||
return createdFieldMetadata;
|
||||
|
||||
@ -56,8 +56,8 @@ type DefaultValueByFieldMetadata<T extends FieldMetadataType | 'default'> = [
|
||||
] extends [keyof FieldMetadataDefaultValueMapping]
|
||||
? FieldMetadataDefaultValueMapping[T] | null
|
||||
: T extends 'default'
|
||||
? AllFieldMetadataDefaultValueTypes | null
|
||||
: never;
|
||||
? AllFieldMetadataDefaultValueTypes | null
|
||||
: never;
|
||||
|
||||
export type FieldMetadataDefaultValue<
|
||||
T extends FieldMetadataType | 'default' = 'default',
|
||||
@ -68,10 +68,10 @@ type FieldMetadataDefaultValueExtractNestedType<T> = T extends {
|
||||
}
|
||||
? U
|
||||
: T extends object
|
||||
? { [K in keyof T]: T[K] } extends { value: infer V }
|
||||
? V
|
||||
: T[keyof T]
|
||||
: never;
|
||||
? { [K in keyof T]: T[K] } extends { value: infer V }
|
||||
? V
|
||||
: T[keyof T]
|
||||
: never;
|
||||
|
||||
type FieldMetadataDefaultValueExtractedTypes = {
|
||||
[K in keyof FieldMetadataDefaultValueMapping]: FieldMetadataDefaultValueExtractNestedType<
|
||||
|
||||
@ -14,8 +14,8 @@ type OptionsByFieldMetadata<T extends FieldMetadataType | 'default'> =
|
||||
T extends keyof FieldMetadataOptionsMapping
|
||||
? FieldMetadataOptionsMapping[T]
|
||||
: T extends 'default'
|
||||
? FieldMetadataDefaultOptions[] | FieldMetadataComplexOptions[]
|
||||
: never;
|
||||
? FieldMetadataDefaultOptions[] | FieldMetadataComplexOptions[]
|
||||
: never;
|
||||
|
||||
export type FieldMetadataOptions<
|
||||
T extends FieldMetadataType | 'default' = 'default',
|
||||
|
||||
@ -34,8 +34,8 @@ type TypeByFieldMetadata<T extends FieldMetadataType | 'default'> = [
|
||||
] extends [keyof FieldMetadataTypeMapping]
|
||||
? FieldMetadataTypeMapping[T]
|
||||
: T extends 'default'
|
||||
? AllFieldMetadataTypes
|
||||
: FieldMetadataTargetColumnMapValue;
|
||||
? AllFieldMetadataTypes
|
||||
: FieldMetadataTargetColumnMapValue;
|
||||
|
||||
export type FieldMetadataTargetColumnMap<
|
||||
T extends FieldMetadataType | 'default' = 'default',
|
||||
|
||||
@ -281,9 +281,8 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
createdObjectMetadata.workspaceId,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
const view = await workspaceDataSource?.query(
|
||||
`INSERT INTO ${dataSourceMetadata.schema}."view"
|
||||
@ -300,8 +299,8 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
`INSERT INTO ${dataSourceMetadata.schema}."viewField"
|
||||
("fieldMetadataId", "position", "isVisible", "size", "viewId")
|
||||
VALUES ('${field.id}', '${index - 1}', true, 180, '${
|
||||
view[0].id
|
||||
}') RETURNING *`,
|
||||
view[0].id
|
||||
}') RETURNING *`,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@ -100,11 +100,14 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat
|
||||
},
|
||||
);
|
||||
|
||||
const objectMetadataMap = objectMetadataEntries.reduce((acc, curr) => {
|
||||
acc[curr.id] = curr;
|
||||
const objectMetadataMap = objectMetadataEntries.reduce(
|
||||
(acc, curr) => {
|
||||
acc[curr.id] = curr;
|
||||
|
||||
return acc;
|
||||
}, {} as { [key: string]: ObjectMetadataEntity });
|
||||
return acc;
|
||||
},
|
||||
{} as { [key: string]: ObjectMetadataEntity },
|
||||
);
|
||||
|
||||
if (
|
||||
objectMetadataMap[relationMetadataInput.fromObjectMetadataId] ===
|
||||
|
||||
@ -25,7 +25,7 @@ export function mergeDefaultOptions<
|
||||
return query.getRawMany();
|
||||
},
|
||||
getCursor: (record: Record | undefined) =>
|
||||
({ id: (record as unknown as { id: string })?.id } as unknown as Cursor),
|
||||
({ id: (record as unknown as { id: string })?.id }) as unknown as Cursor,
|
||||
encodeCursor: (cursor: Cursor) =>
|
||||
Buffer.from((cursor as unknown as { id: string }).id.toString()).toString(
|
||||
'base64',
|
||||
@ -33,9 +33,9 @@ export function mergeDefaultOptions<
|
||||
decodeCursor: (cursorString: string) =>
|
||||
({
|
||||
id: Buffer.from(cursorString, 'base64').toString(),
|
||||
} as unknown as Cursor),
|
||||
}) as unknown as Cursor,
|
||||
recordToEdge: (record: Record) =>
|
||||
({ node: record } as unknown as Omit<CustomEdge, 'cursor'>),
|
||||
({ node: record }) as unknown as Omit<CustomEdge, 'cursor'>,
|
||||
resolveInfo: null,
|
||||
...pOptions,
|
||||
};
|
||||
|
||||
@ -29,9 +29,8 @@ export class FetchBatchMessagesService {
|
||||
'batch_gmail_messages',
|
||||
);
|
||||
|
||||
const messages = await this.formatBatchResponsesAsGmailMessages(
|
||||
batchResponses,
|
||||
);
|
||||
const messages =
|
||||
await this.formatBatchResponsesAsGmailMessages(batchResponses);
|
||||
|
||||
return messages;
|
||||
}
|
||||
@ -46,9 +45,8 @@ export class FetchBatchMessagesService {
|
||||
'batch_gmail_threads',
|
||||
);
|
||||
|
||||
const threads = await this.formatBatchResponsesAsGmailThreads(
|
||||
batchResponses,
|
||||
);
|
||||
const threads =
|
||||
await this.formatBatchResponsesAsGmailThreads(batchResponses);
|
||||
|
||||
return threads;
|
||||
}
|
||||
@ -242,9 +240,8 @@ export class FetchBatchMessagesService {
|
||||
): Promise<GmailMessage[]> {
|
||||
const formattedResponses = await Promise.all(
|
||||
batchResponses.map(async (response) => {
|
||||
const formattedResponse = await this.formatBatchResponseAsGmailMessage(
|
||||
response,
|
||||
);
|
||||
const formattedResponse =
|
||||
await this.formatBatchResponseAsGmailMessage(response);
|
||||
|
||||
return formattedResponse;
|
||||
}),
|
||||
@ -292,9 +289,8 @@ export class FetchBatchMessagesService {
|
||||
): Promise<GmailThread[]> {
|
||||
const formattedResponses = await Promise.all(
|
||||
batchResponses.map(async (response) => {
|
||||
const formattedResponse = await this.formatBatchResponseAsGmailThread(
|
||||
response,
|
||||
);
|
||||
const formattedResponse =
|
||||
await this.formatBatchResponseAsGmailThread(response);
|
||||
|
||||
return formattedResponse;
|
||||
}),
|
||||
|
||||
@ -44,9 +44,8 @@ export class FetchWorkspaceMessagesService {
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
if (!workspaceDataSource) {
|
||||
throw new Error('No workspace data source found');
|
||||
|
||||
@ -23,9 +23,8 @@ export class RefreshAccessTokenService {
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
const workspaceDataSource = await this.typeORMService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const workspaceDataSource =
|
||||
await this.typeORMService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
if (!workspaceDataSource) {
|
||||
throw new Error('No workspace data source found');
|
||||
|
||||
@ -27,9 +27,8 @@ export class WorkspaceDataSourceService {
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
const dataSource = await this.typeormService.connectToDataSource(
|
||||
dataSourceMetadata,
|
||||
);
|
||||
const dataSource =
|
||||
await this.typeormService.connectToDataSource(dataSourceMetadata);
|
||||
|
||||
if (!dataSource) {
|
||||
throw new Error(
|
||||
|
||||
@ -146,8 +146,8 @@ export class WorkspaceMigrationEnumService {
|
||||
UPDATE "${schemaName}"."${tableName}"
|
||||
SET "${columnDefinition.columnName}" = ${defaultValue}
|
||||
WHERE "${columnDefinition.columnName}" NOT IN (${enumValues
|
||||
.map((e) => `'${e}'`)
|
||||
.join(', ')})
|
||||
.map((e) => `'${e}'`)
|
||||
.join(', ')})
|
||||
`);
|
||||
}
|
||||
|
||||
|
||||
@ -38,11 +38,11 @@ export class CreateManyQueryFactory {
|
||||
insertInto${
|
||||
options.targetTableName
|
||||
}Collection(objects: ${stringifyWithoutKeyQuote(
|
||||
computedArgs.data.map((datum) => ({
|
||||
id: uuidv4(),
|
||||
...datum,
|
||||
})),
|
||||
)}) {
|
||||
computedArgs.data.map((datum) => ({
|
||||
id: uuidv4(),
|
||||
...datum,
|
||||
})),
|
||||
)}) {
|
||||
affectedCount
|
||||
records {
|
||||
${fieldsString}
|
||||
|
||||
@ -25,8 +25,8 @@ export class DeleteManyQueryFactory {
|
||||
deleteFrom${
|
||||
options.targetTableName
|
||||
}Collection(filter: ${stringifyWithoutKeyQuote(
|
||||
args.filter,
|
||||
)}, atMost: 30) {
|
||||
args.filter,
|
||||
)}, atMost: 30) {
|
||||
affectedCount
|
||||
records {
|
||||
${fieldsString}
|
||||
|
||||
@ -38,8 +38,8 @@ export class FindManyQueryFactory {
|
||||
return `
|
||||
query {
|
||||
${options.targetTableName}Collection${
|
||||
argsString ? `(${argsString})` : ''
|
||||
} {
|
||||
argsString ? `(${argsString})` : ''
|
||||
} {
|
||||
${fieldsString}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,8 +32,8 @@ export class FindOneQueryFactory {
|
||||
return `
|
||||
query {
|
||||
${options.targetTableName}Collection${
|
||||
argsString ? `(${argsString})` : ''
|
||||
} {
|
||||
argsString ? `(${argsString})` : ''
|
||||
} {
|
||||
edges {
|
||||
node {
|
||||
${fieldsString}
|
||||
|
||||
@ -105,8 +105,8 @@ export class RelationFieldAliasFactory {
|
||||
|
||||
return `
|
||||
${fieldKey}: ${referencedObjectMetadata.targetTableName}Collection${
|
||||
argsString ? `(${argsString})` : ''
|
||||
} {
|
||||
argsString ? `(${argsString})` : ''
|
||||
} {
|
||||
${fieldsString}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -41,8 +41,8 @@ export class UpdateOneQueryFactory {
|
||||
update${
|
||||
options.targetTableName
|
||||
}Collection(set: ${stringifyWithoutKeyQuote(
|
||||
argsData,
|
||||
)}, filter: { id: { eq: "${computedArgs.id}" } }) {
|
||||
argsData,
|
||||
)}, filter: { id: { eq: "${computedArgs.id}" } }) {
|
||||
affectedCount
|
||||
records {
|
||||
${fieldsString}
|
||||
|
||||
@ -72,14 +72,17 @@ export class EnumTypeDefinitionFactory {
|
||||
return new GraphQLEnumType({
|
||||
name: `${pascalCase(objectName)}${pascalCase(fieldMetadata.name)}Enum`,
|
||||
description: fieldMetadata.description,
|
||||
values: enumOptions.reduce((acc, enumOption) => {
|
||||
acc[enumOption.value] = {
|
||||
value: enumOption.value,
|
||||
description: enumOption.label,
|
||||
};
|
||||
values: enumOptions.reduce(
|
||||
(acc, enumOption) => {
|
||||
acc[enumOption.value] = {
|
||||
value: enumOption.value,
|
||||
description: enumOption.label,
|
||||
};
|
||||
|
||||
return acc;
|
||||
}, {} as { [key: string]: { value: string; description: string } }),
|
||||
return acc;
|
||||
},
|
||||
{} as { [key: string]: { value: string; description: string } },
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,9 +28,8 @@ export class WorkspaceSchemaStorageService {
|
||||
(await this.cacheVersionMemoryStorageService.read({
|
||||
key: workspaceId,
|
||||
})) ?? '0';
|
||||
const latestVersion = await this.workspaceCacheVersionService.getVersion(
|
||||
workspaceId,
|
||||
);
|
||||
const latestVersion =
|
||||
await this.workspaceCacheVersionService.getVersion(workspaceId);
|
||||
|
||||
if (currentVersion !== latestVersion) {
|
||||
// Invalidate cache if version mismatch is detected
|
||||
|
||||
@ -36,18 +36,24 @@ export const mapObjectMetadataByUniqueIdentifier = <
|
||||
>(
|
||||
arr: T[],
|
||||
): Record<string, Omit<T, 'fields'> & { fields: Record<string, U> }> => {
|
||||
return arr.reduce((acc, curr) => {
|
||||
acc[curr.nameSingular] = {
|
||||
...curr,
|
||||
fields: curr.fields.reduce((acc, curr) => {
|
||||
acc[curr.name] = curr;
|
||||
return arr.reduce(
|
||||
(acc, curr) => {
|
||||
acc[curr.nameSingular] = {
|
||||
...curr,
|
||||
fields: curr.fields.reduce(
|
||||
(acc, curr) => {
|
||||
acc[curr.name] = curr;
|
||||
|
||||
return acc;
|
||||
}, {} as Record<string, U>),
|
||||
};
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, U>,
|
||||
),
|
||||
};
|
||||
|
||||
return acc;
|
||||
}, {} as Record<string, Omit<T, 'fields'> & { fields: Record<string, U> }>);
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, Omit<T, 'fields'> & { fields: Record<string, U> }>,
|
||||
);
|
||||
};
|
||||
|
||||
export const convertStringifiedFieldsToJSON = <
|
||||
|
||||
@ -405,7 +405,7 @@ export class WorkspaceSyncMetadataService {
|
||||
WorkspaceMigrationColumnActionType.CREATE,
|
||||
field,
|
||||
),
|
||||
} satisfies WorkspaceMigrationTableAction),
|
||||
}) satisfies WorkspaceMigrationTableAction,
|
||||
),
|
||||
];
|
||||
|
||||
@ -420,11 +420,14 @@ export class WorkspaceSyncMetadataService {
|
||||
// TODO: handle object delete migrations.
|
||||
// Note: we need to delete the relation first due to the DB constraint.
|
||||
|
||||
const objectsInDbById = objectsInDB.reduce((result, currentObject) => {
|
||||
result[currentObject.id] = currentObject;
|
||||
const objectsInDbById = objectsInDB.reduce(
|
||||
(result, currentObject) => {
|
||||
result[currentObject.id] = currentObject;
|
||||
|
||||
return result;
|
||||
}, {} as Record<string, ObjectMetadataEntity>);
|
||||
return result;
|
||||
},
|
||||
{} as Record<string, ObjectMetadataEntity>,
|
||||
);
|
||||
|
||||
if (fieldsToCreate.length > 0) {
|
||||
fieldsToCreate.map((field) => {
|
||||
|
||||
@ -60,9 +60,8 @@ export class WorkspaceFactory {
|
||||
}
|
||||
|
||||
// Get typeDefs from cache
|
||||
let typeDefs = await this.workspaceSchemaStorageService.getTypeDefs(
|
||||
workspaceId,
|
||||
);
|
||||
let typeDefs =
|
||||
await this.workspaceSchemaStorageService.getTypeDefs(workspaceId);
|
||||
let usedScalarNames =
|
||||
await this.workspaceSchemaStorageService.getUsedScalarNames(workspaceId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user