V3 project migration (#1652)

* migrate settings

* migrate viewsettings

* migrate url preset

* migrate project data

* migrate custom fields

* migrate automations

* migrate rundown

* lint

* return custom field translation table

* check regex

* new url type

* refactor

* migrate old OSC subscriptions

* migrate old http subscriptions

* update comments

* migrate the whole db

* remove automation logging unlis there is an error

* return a new object

* refactor: copy currup is only used in one place

* make a copy of original migrated file

* refactor: ensure image flder is part of project service init

* add entrys to groups

* small cleanup

* just drop incorrect custom fields in the default data parser
This commit is contained in:
Alex Christoffer Rasmussen
2025-08-07 15:48:58 +02:00
committed by GitHub
parent 35347e8d63
commit 9ebb3decdb
12 changed files with 993 additions and 87 deletions
@@ -3,36 +3,7 @@ import { DatabaseModel, AutomationSettings, NormalisedAutomation, Trigger } from
import { dbModel } from '../../models/dataModel.js';
import type { ErrorEmitter } from '../../utils/parserUtils.js';
interface LegacyData extends Partial<DatabaseModel> {
http?: unknown;
osc?: {
enabledIn?: boolean;
portIn?: number;
};
}
export function parseAutomationSettings(data: LegacyData, emitError?: ErrorEmitter): AutomationSettings {
// TODO(v4): move to migration script
/**
* Leaving a path for migrating users to the new automations
* This should be removed after a few releases
*/
if (data.http || data.osc) {
emitError?.('Found legacy integrations');
console.log('Found legacy integrations...');
if (data.osc) {
return {
enabledAutomations: dbModel.automation.enabledAutomations,
enabledOscIn: data.osc?.enabledIn ?? dbModel.automation.enabledOscIn,
oscPortIn: data.osc?.portIn ?? dbModel.automation.oscPortIn,
triggers: [],
automations: {},
};
} else {
return { ...dbModel.automation };
}
}
export function parseAutomationSettings(data: Partial<DatabaseModel>, emitError?: ErrorEmitter): AutomationSettings {
if (!data.automation) {
emitError?.('No data found to import');
return { ...dbModel.automation };
@@ -21,7 +21,6 @@ function preparePayload(output: HTTPOutput, state: RuntimeState): string {
/** Emits message over transport */
async function emit(url: string) {
logger.info(LogOrigin.Rx, `Sending HTTP: ${url}`);
try {
const response = await fetch(url);
if (!response.ok) {
@@ -31,8 +31,6 @@ function preparePayload(output: OSCOutput, state: RuntimeState): OscPacketInput
/** Emits message over transport */
function emit(targetIP: string, targetPort: number, packet: OscPacketInput) {
logger.info(LogOrigin.Tx, `Sending OSC: ${targetIP}:${targetPort}`);
const buffer = oscPacketToBuffer(packet);
udpClient.send(buffer, 0, buffer.byteLength, targetPort, targetIP, (error) => {
if (error) {