feat(core, editor): Support pairedItem for pinned data (#3843)

* 📘 Adjust interface

*  Adjust pindata in state store

*  Add utils

*  Replace utils calls

*  Adjust pindata intake and display

* 🔥 Remove excess BE fixes

* 📝 Update comment

* 🧪 Adjust tests

* 🔥 Remove unneeded helper

* 🚚 Improve naming

* 🧹 Clean up `ormconfig.ts`

* 📘 Add types and type guards

*  Improve serializer for sqlite

*  Create migration utils

*  Set up sqlite serializer

* 🗃️ Write sqlite migration

* 🗃️ Write MySQL migration

* 🗃️ Write Postgres migration

*  Add imports and exports to barrels

* 🚚 Rename `runChunked` to `runInBatches`

*  Improve migration loggers

* ♻️ Address feedback

* 🚚 Improve naming
This commit is contained in:
Iván Ovejero
2022-08-22 17:46:22 +02:00
committed by GitHub
parent 6bd7a09a45
commit b1e715299d
24 changed files with 399 additions and 143 deletions

View File

@@ -3,8 +3,9 @@ import express from 'express';
import * as utils from './shared/utils';
import * as testDb from './shared/testDb';
import { WorkflowEntity } from '../../src/databases/entities/WorkflowEntity';
import type { Role } from '../../src/databases/entities/Role';
import { IPinData } from 'n8n-workflow';
import type { IPinData } from 'n8n-workflow';
jest.mock('../../src/telemetry');
@@ -46,7 +47,7 @@ test('POST /workflows should store pin data for node in workflow', async () => {
const { pinData } = response.body.data as { pinData: IPinData };
expect(pinData).toMatchObject({ Spotify: [{ myKey: 'myValue' }] });
expect(pinData).toMatchObject(MOCK_PINDATA);
});
test('POST /workflows should set pin data to null if no pin data', async () => {
@@ -80,7 +81,7 @@ test('GET /workflows/:id should return pin data', async () => {
const { pinData } = workflowRetrievalResponse.body.data as { pinData: IPinData };
expect(pinData).toMatchObject({ Spotify: [{ myKey: 'myValue' }] });
expect(pinData).toMatchObject(MOCK_PINDATA);
});
function makeWorkflow({ withPinData }: { withPinData: boolean }) {
@@ -101,8 +102,10 @@ function makeWorkflow({ withPinData }: { withPinData: boolean }) {
];
if (withPinData) {
workflow.pinData = { Spotify: [{ myKey: 'myValue' }] };
workflow.pinData = MOCK_PINDATA;
}
return workflow;
}
const MOCK_PINDATA = { Spotify: [{ json: { myKey: 'myValue' } }] };