Fix self host application (#18292)
- Fixes self host application - add new telemetry information - add serverId to identify a server instance - remove .twenty from git tracking - tree-shake "twenty-sdk" usage in built logic functions and front components - fix "twenty-sdk" version usage - fix twenty-zapier cli --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
import { InjectDataSource, InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { Command } from 'nest-commander';
|
||||
import { DataSource, Repository } from 'typeorm';
|
||||
|
||||
import { ActiveOrSuspendedWorkspacesMigrationCommandRunner } from 'src/database/commands/command-runners/active-or-suspended-workspaces-migration.command-runner';
|
||||
import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service';
|
||||
import { GlobalWorkspaceOrmManager } from 'src/engine/twenty-orm/global-workspace-datasource/global-workspace-orm.manager';
|
||||
import { seedServerId } from 'src/engine/workspace-manager/dev-seeder/core/utils/seed-server-id.util';
|
||||
|
||||
@Command({
|
||||
name: 'upgrade:1-19:seed-server-id',
|
||||
description:
|
||||
'Seed a unique SERVER_ID (UUID v4) into the keyValuePair table as a CONFIG_VARIABLE',
|
||||
})
|
||||
export class SeedServerIdCommand extends ActiveOrSuspendedWorkspacesMigrationCommandRunner {
|
||||
private hasRun = false;
|
||||
|
||||
constructor(
|
||||
@InjectRepository(WorkspaceEntity)
|
||||
protected readonly workspaceRepository: Repository<WorkspaceEntity>,
|
||||
@InjectDataSource()
|
||||
private readonly coreDataSource: DataSource,
|
||||
protected readonly twentyORMGlobalManager: GlobalWorkspaceOrmManager,
|
||||
protected readonly dataSourceService: DataSourceService,
|
||||
) {
|
||||
super(workspaceRepository, twentyORMGlobalManager, dataSourceService);
|
||||
}
|
||||
|
||||
override async runOnWorkspace(): Promise<void> {
|
||||
if (this.hasRun) {
|
||||
return;
|
||||
}
|
||||
|
||||
const queryRunner = this.coreDataSource.createQueryRunner();
|
||||
|
||||
await seedServerId({ queryRunner, schemaName: 'core' });
|
||||
|
||||
this.hasRun = true;
|
||||
|
||||
await queryRunner.release();
|
||||
|
||||
this.logger.log(`SERVER_ID seeded successfully`);
|
||||
}
|
||||
}
|
||||
+3
@@ -6,6 +6,7 @@ import { BackfillMessageChannelMessageAssociationMessageFolderCommand } from 'sr
|
||||
import { BackfillPageLayoutsCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-backfill-page-layouts.command';
|
||||
import { BackfillSystemFieldsIsSystemCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-backfill-system-fields-is-system.command';
|
||||
import { FixInvalidStandardUniversalIdentifiersCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-fix-invalid-standard-universal-identifiers.command';
|
||||
import { SeedServerIdCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-seed-server-id.command';
|
||||
import { ApplicationModule } from 'src/engine/core-modules/application/application.module';
|
||||
import { FeatureFlagModule } from 'src/engine/core-modules/feature-flag/feature-flag.module';
|
||||
import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
@@ -34,6 +35,7 @@ import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace
|
||||
BackfillMessageChannelMessageAssociationMessageFolderCommand,
|
||||
BackfillPageLayoutsCommand,
|
||||
FixInvalidStandardUniversalIdentifiersCommand,
|
||||
SeedServerIdCommand,
|
||||
],
|
||||
exports: [
|
||||
BackfillSystemFieldsIsSystemCommand,
|
||||
@@ -41,6 +43,7 @@ import { WorkspaceMigrationModule } from 'src/engine/workspace-manager/workspace
|
||||
BackfillMessageChannelMessageAssociationMessageFolderCommand,
|
||||
BackfillPageLayoutsCommand,
|
||||
FixInvalidStandardUniversalIdentifiersCommand,
|
||||
SeedServerIdCommand,
|
||||
],
|
||||
})
|
||||
export class V1_19_UpgradeVersionCommandModule {}
|
||||
|
||||
+3
@@ -32,6 +32,7 @@ import { BackfillMessageChannelMessageAssociationMessageFolderCommand } from 'sr
|
||||
import { BackfillPageLayoutsCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-backfill-page-layouts.command';
|
||||
import { BackfillSystemFieldsIsSystemCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-backfill-system-fields-is-system.command';
|
||||
import { FixInvalidStandardUniversalIdentifiersCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-fix-invalid-standard-universal-identifiers.command';
|
||||
import { SeedServerIdCommand } from 'src/database/commands/upgrade-version-command/1-19/1-19-seed-server-id.command';
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
|
||||
import { DataSourceService } from 'src/engine/metadata-modules/data-source/data-source.service';
|
||||
@@ -79,6 +80,7 @@ export class UpgradeCommand extends UpgradeCommandRunner {
|
||||
protected readonly backfillMessageChannelMessageAssociationMessageFolderCommand: BackfillMessageChannelMessageAssociationMessageFolderCommand,
|
||||
protected readonly backfillPageLayoutsCommand: BackfillPageLayoutsCommand,
|
||||
protected readonly fixRoleAndAgentUniversalIdentifiersCommand: FixInvalidStandardUniversalIdentifiersCommand,
|
||||
protected readonly seedServerIdCommand: SeedServerIdCommand,
|
||||
) {
|
||||
super(
|
||||
workspaceRepository,
|
||||
@@ -121,6 +123,7 @@ export class UpgradeCommand extends UpgradeCommandRunner {
|
||||
this.backfillMessageChannelMessageAssociationMessageFolderCommand,
|
||||
this.backfillPageLayoutsCommand,
|
||||
this.fixRoleAndAgentUniversalIdentifiersCommand,
|
||||
this.seedServerIdCommand,
|
||||
];
|
||||
|
||||
this.allCommands = {
|
||||
|
||||
Reference in New Issue
Block a user