From c4fcbe40c585a5dbb5ac6510618dbb0cc88bdac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Wed, 14 Aug 2024 12:52:19 +0200 Subject: [PATCH] fix(editor): Remove `@n8n/permissions` from `n8n-workflow` (no-changelog) (#10399) --- packages/editor-ui/src/Interface.ts | 4 +++- .../executions/global/GlobalExecutionsList.vue | 6 +++--- .../workflow/WorkflowExecutionsPreview.test.ts | 4 ++-- packages/editor-ui/src/stores/executions.store.ts | 9 +++++---- packages/workflow/package.json | 1 - packages/workflow/src/Interfaces.ts | 2 -- pnpm-lock.yaml | 3 --- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 986336a396..05c40402f1 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -385,9 +385,11 @@ export interface IExecutionResponse extends IExecutionBase { executedNode?: string; } +export type ExecutionSummaryWithScopes = ExecutionSummary & { scopes: Scope[] }; + export interface IExecutionsListResponse { count: number; - results: ExecutionSummary[]; + results: ExecutionSummaryWithScopes[]; estimated: boolean; } diff --git a/packages/editor-ui/src/components/executions/global/GlobalExecutionsList.vue b/packages/editor-ui/src/components/executions/global/GlobalExecutionsList.vue index a0ec572697..321eb47534 100644 --- a/packages/editor-ui/src/components/executions/global/GlobalExecutionsList.vue +++ b/packages/editor-ui/src/components/executions/global/GlobalExecutionsList.vue @@ -7,7 +7,7 @@ import { useToast } from '@/composables/useToast'; import { useMessage } from '@/composables/useMessage'; import { useI18n } from '@/composables/useI18n'; import { useTelemetry } from '@/composables/useTelemetry'; -import type { ExecutionFilterType, IWorkflowDb } from '@/Interface'; +import type { ExecutionFilterType, ExecutionSummaryWithScopes, IWorkflowDb } from '@/Interface'; import type { ExecutionSummary } from 'n8n-workflow'; import { useWorkflowsStore } from '@/stores/workflows.store'; import { useExecutionsStore } from '@/stores/executions.store'; @@ -16,7 +16,7 @@ import { getResourcePermissions } from '@/permissions'; const props = withDefaults( defineProps<{ - executions: ExecutionSummary[]; + executions: ExecutionSummaryWithScopes[]; filters: ExecutionFilterType; total: number; estimated: boolean; @@ -165,7 +165,7 @@ function getExecutionWorkflowName(execution: ExecutionSummary): string { } function getExecutionWorkflowPermissions( - execution: ExecutionSummary, + execution: ExecutionSummaryWithScopes, ): PermissionsRecord['workflow'] { return getResourcePermissions(execution.scopes).workflow; } diff --git a/packages/editor-ui/src/components/executions/workflow/WorkflowExecutionsPreview.test.ts b/packages/editor-ui/src/components/executions/workflow/WorkflowExecutionsPreview.test.ts index ce092dab46..f5646e1245 100644 --- a/packages/editor-ui/src/components/executions/workflow/WorkflowExecutionsPreview.test.ts +++ b/packages/editor-ui/src/components/executions/workflow/WorkflowExecutionsPreview.test.ts @@ -12,7 +12,7 @@ import { i18nInstance, I18nPlugin } from '@/plugins/i18n'; import { FontAwesomePlugin } from '@/plugins/icons'; import { GlobalComponentsPlugin } from '@/plugins/components'; import { useWorkflowsStore } from '@/stores/workflows.store'; -import type { IWorkflowDb } from '@/Interface'; +import type { ExecutionSummaryWithScopes, IWorkflowDb } from '@/Interface'; let pinia: ReturnType; @@ -49,7 +49,7 @@ const generateUndefinedNullOrString = () => { } }; -const executionDataFactory = (): ExecutionSummary => ({ +const executionDataFactory = (): ExecutionSummaryWithScopes => ({ id: faker.string.uuid(), finished: faker.datatype.boolean(), mode: faker.helpers.arrayElement(['manual', 'trigger']), diff --git a/packages/editor-ui/src/stores/executions.store.ts b/packages/editor-ui/src/stores/executions.store.ts index 756fdff6c4..af3850fd11 100644 --- a/packages/editor-ui/src/stores/executions.store.ts +++ b/packages/editor-ui/src/stores/executions.store.ts @@ -4,6 +4,7 @@ import type { IDataObject, ExecutionSummary } from 'n8n-workflow'; import type { ExecutionFilterType, ExecutionsQueryFilter, + ExecutionSummaryWithScopes, IExecutionDeleteFilter, IExecutionFlattedResponse, IExecutionResponse, @@ -34,7 +35,7 @@ export const useExecutionsStore = defineStore('executions', () => { const autoRefreshTimeout = ref(null); const autoRefreshDelay = ref(4 * 1000); // Refresh data every 4 secs - const executionsById = ref>({}); + const executionsById = ref>({}); const executionsCount = ref(0); const executionsCountEstimated = ref(false); const executions = computed(() => { @@ -57,7 +58,7 @@ export const useExecutionsStore = defineStore('executions', () => { }, {}), ); - const currentExecutionsById = ref>({}); + const currentExecutionsById = ref>({}); const currentExecutions = computed(() => { const data = Object.values(currentExecutionsById.value); @@ -80,14 +81,14 @@ export const useExecutionsStore = defineStore('executions', () => { const allExecutions = computed(() => [...currentExecutions.value, ...executions.value]); - function addExecution(execution: ExecutionSummary) { + function addExecution(execution: ExecutionSummaryWithScopes) { executionsById.value[execution.id] = { ...execution, mode: execution.mode, }; } - function addCurrentExecution(execution: ExecutionSummary) { + function addCurrentExecution(execution: ExecutionSummaryWithScopes) { currentExecutionsById.value[execution.id] = { ...execution, mode: execution.mode, diff --git a/packages/workflow/package.json b/packages/workflow/package.json index 6bbdc59a1c..ed434fe98f 100644 --- a/packages/workflow/package.json +++ b/packages/workflow/package.json @@ -39,7 +39,6 @@ "@types/xml2js": "catalog:" }, "dependencies": { - "@n8n/permissions": "workspace:*", "@n8n/tournament": "1.0.5", "@n8n_io/riot-tmpl": "4.0.0", "ast-types": "0.15.2", diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index 1e6e5872ff..eb6c3ca07c 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -10,7 +10,6 @@ import type { URLSearchParams } from 'url'; import type { RequestBodyMatcher } from 'nock'; import type { Client as SSHClient } from 'ssh2'; -import type { Scope } from '@n8n/permissions'; import type { AuthenticationMethod } from './Authentication'; import type { CODE_EXECUTION_MODES, CODE_LANGUAGES, LOG_LEVELS } from './Constants'; import type { IDeferredPromise } from './DeferredPromise'; @@ -2464,7 +2463,6 @@ export interface ExecutionSummary { nodeExecutionStatus?: { [key: string]: IExecutionSummaryNodeExecutionResult; }; - scopes?: Scope[]; } export interface IExecutionSummaryNodeExecutionResult { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 16ba572ac4..37fddb4bb3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1709,9 +1709,6 @@ importers: packages/workflow: dependencies: - '@n8n/permissions': - specifier: workspace:* - version: link:../@n8n/permissions '@n8n/tournament': specifier: 1.0.5 version: 1.0.5