From 9c654dbbf770873d380096ec0f7df39e5ee7c567 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Mon, 23 Jun 2025 14:04:33 +0300 Subject: [PATCH] refactor(editor): Move `templates` api to `@n8n/rest-api-client` package (no-changelog) (#16542) --- .prettierignore | 3 + .../@n8n/rest-api-client/src/api/index.ts | 3 + .../@n8n/rest-api-client/src/api/tags.ts | 7 + .../@n8n/rest-api-client/src/api/templates.ts | 195 +++++++++++++++++ .../@n8n/rest-api-client/src/api/workflows.ts | 42 ++++ packages/frontend/editor-ui/src/Interface.ts | 197 +----------------- .../src/__tests__/server/factories/tag.ts | 2 +- .../src/__tests__/server/fixtures/tags.ts | 2 +- .../src/__tests__/server/models/tag.ts | 2 +- packages/frontend/editor-ui/src/api/tags.ts | 2 +- .../frontend/editor-ui/src/api/templates.ts | 86 -------- .../AskAssistant/Agent/AskAssistantBuild.vue | 6 +- .../components/DuplicateWorkflowDialog.vue | 4 +- .../components/MainHeader/WorkflowDetails.vue | 4 +- .../editor-ui/src/components/NodeList.vue | 2 +- .../src/components/TagsContainer.vue | 2 +- .../editor-ui/src/components/TagsDropdown.vue | 2 +- .../TagsManager/AnnotationTagsManager.ee.vue | 2 +- .../components/TagsManager/TagsManager.vue | 2 +- .../TagsManager/TagsView/TagsView.vue | 3 +- .../TagsManager/WorkflowTagsManager.vue | 2 +- .../editor-ui/src/components/TemplateCard.vue | 2 +- .../src/components/TemplateDetails.vue | 2 +- .../src/components/TemplateFilters.vue | 2 +- .../editor-ui/src/components/TemplateList.vue | 2 +- .../src/components/TemplatesInfoCard.vue | 2 +- .../src/components/TemplatesInfoCarousel.vue | 2 +- .../src/components/WorkflowPreview.vue | 3 +- .../WorkflowSelectorParameterInput.vue | 6 +- .../src/components/WorkflowSettings.vue | 10 +- .../src/components/WorkflowTagsContainer.vue | 2 +- .../layouts/ResourcesListLayout.vue | 3 +- .../composables/useCanvasOperations.test.ts | 10 +- .../src/composables/useCanvasOperations.ts | 27 ++- .../src/composables/useRunWorkflow.test.ts | 35 ++-- .../src/composables/useWorkflowExtraction.ts | 7 +- .../composables/useWorkflowHelpers.test.ts | 5 +- .../src/composables/useWorkflowHelpers.ts | 13 +- .../src/composables/useWorkflowSaving.test.ts | 4 +- .../src/composables/useWorkflowSaving.ts | 18 +- .../editor-ui/src/constants.workflows.ts | 7 +- .../editor-ui/src/stores/settings.store.ts | 2 +- .../editor-ui/src/stores/tags.store.ts | 2 +- .../editor-ui/src/stores/templates.store.ts | 30 ++- .../src/stores/workflowHistory.store.ts | 7 +- .../editor-ui/src/stores/workflows.store.ts | 14 +- .../editor-ui/src/types/externalHooks.ts | 2 +- .../editor-ui/src/utils/nodeTypesUtils.ts | 2 +- .../utils/templates/templateActions.test.ts | 2 +- .../src/utils/templates/templateActions.ts | 11 +- .../templates/templateTransforms.test.ts | 2 +- .../src/utils/templates/templateTransforms.ts | 6 +- .../src/utils/templates/typeGuards.ts | 2 +- .../frontend/editor-ui/src/views/NodeView.vue | 12 +- .../__tests__/setupTemplate.store.testData.ts | 4 +- .../setupTemplate.store.test.ts | 4 +- .../useCredentialSetupState.test.ts | 2 +- .../src/views/TemplatesCollectionView.vue | 2 +- .../src/views/TemplatesSearchView.vue | 2 +- 59 files changed, 423 insertions(+), 417 deletions(-) create mode 100644 packages/frontend/@n8n/rest-api-client/src/api/tags.ts create mode 100644 packages/frontend/@n8n/rest-api-client/src/api/templates.ts create mode 100644 packages/frontend/@n8n/rest-api-client/src/api/workflows.ts delete mode 100644 packages/frontend/editor-ui/src/api/templates.ts diff --git a/.prettierignore b/.prettierignore index 01384d8ce8..be5895d204 100644 --- a/.prettierignore +++ b/.prettierignore @@ -18,3 +18,6 @@ CHANGELOG.md **/*.js **/*.json **/*.jsonc + +# Auto-generated +**/components.d.ts diff --git a/packages/frontend/@n8n/rest-api-client/src/api/index.ts b/packages/frontend/@n8n/rest-api-client/src/api/index.ts index f78c5640b9..2b45475f56 100644 --- a/packages/frontend/@n8n/rest-api-client/src/api/index.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/index.ts @@ -14,7 +14,10 @@ export * from './roles'; export * from './settings'; export * from './module-settings'; export * from './sso'; +export * from './tags'; +export * from './templates'; export * from './ui'; export * from './versions'; export * from './webhooks'; export * from './workflowHistory'; +export * from './workflows'; diff --git a/packages/frontend/@n8n/rest-api-client/src/api/tags.ts b/packages/frontend/@n8n/rest-api-client/src/api/tags.ts new file mode 100644 index 0000000000..2e51945a2a --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/src/api/tags.ts @@ -0,0 +1,7 @@ +export interface ITag { + id: string; + name: string; + usageCount?: number; + createdAt?: string; + updatedAt?: string; +} diff --git a/packages/frontend/@n8n/rest-api-client/src/api/templates.ts b/packages/frontend/@n8n/rest-api-client/src/api/templates.ts new file mode 100644 index 0000000000..d7e597eea5 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/src/api/templates.ts @@ -0,0 +1,195 @@ +import type { RawAxiosRequestHeaders } from 'axios'; +import type { INode, INodeCredentialsDetails } from 'n8n-workflow'; + +import type { VersionNode } from './versions'; +import type { WorkflowData } from './workflows'; +import { get } from '../utils'; + +export interface IWorkflowTemplateNode + extends Pick< + INode, + 'name' | 'type' | 'position' | 'parameters' | 'typeVersion' | 'webhookId' | 'id' | 'disabled' + > { + // The credentials in a template workflow have a different type than in a regular workflow + credentials?: IWorkflowTemplateNodeCredentials; +} + +export interface IWorkflowTemplateNodeCredentials { + [key: string]: string | INodeCredentialsDetails; +} + +export interface IWorkflowTemplate { + id: number; + name: string; + workflow: Pick & { + nodes: IWorkflowTemplateNode[]; + }; +} + +export interface ITemplatesNode extends VersionNode { + id: number; + categories?: ITemplatesCategory[]; +} + +export interface ITemplatesCollection { + id: number; + name: string; + nodes: ITemplatesNode[]; + workflows: Array<{ id: number }>; +} + +interface ITemplatesImage { + id: number; + url: string; +} + +interface ITemplatesCollectionExtended extends ITemplatesCollection { + description: string | null; + image: ITemplatesImage[]; + categories: ITemplatesCategory[]; + createdAt: string; +} + +export interface ITemplatesCollectionFull extends ITemplatesCollectionExtended { + full: true; +} + +export interface ITemplatesCollectionResponse extends ITemplatesCollectionExtended { + workflows: ITemplatesWorkflow[]; +} + +/** + * A template without the actual workflow definition + */ + +export interface ITemplatesWorkflow { + id: number; + createdAt: string; + name: string; + nodes: ITemplatesNode[]; + totalViews: number; + user: { + username: string; + }; +} + +export interface ITemplatesWorkflowInfo { + nodeCount: number; + nodeTypes: { + [key: string]: { + count: number; + }; + }; +} + +export type TemplateSearchFacet = { + field_name: string; + sampled: boolean; + stats: { + total_values: number; + }; + counts: Array<{ + count: number; + highlighted: string; + value: string; + }>; +}; + +export interface ITemplatesWorkflowResponse extends ITemplatesWorkflow, IWorkflowTemplate { + description: string | null; + image: ITemplatesImage[]; + categories: ITemplatesCategory[]; + workflowInfo: ITemplatesWorkflowInfo; +} + +/** + * A template with also the full workflow definition + */ + +export interface ITemplatesWorkflowFull extends ITemplatesWorkflowResponse { + full: true; +} + +export interface ITemplatesQuery { + categories: string[]; + search: string; +} + +export interface ITemplatesCategory { + id: number; + name: string; +} + +function stringifyArray(arr: string[]) { + return arr.join(','); +} + +export async function testHealthEndpoint(apiEndpoint: string) { + return await get(apiEndpoint, '/health'); +} + +export async function getCategories( + apiEndpoint: string, + headers?: RawAxiosRequestHeaders, +): Promise<{ categories: ITemplatesCategory[] }> { + return await get(apiEndpoint, '/templates/categories', undefined, headers); +} + +export async function getCollections( + apiEndpoint: string, + query: ITemplatesQuery, + headers?: RawAxiosRequestHeaders, +): Promise<{ collections: ITemplatesCollection[] }> { + return await get( + apiEndpoint, + '/templates/collections', + { category: query.categories, search: query.search }, + headers, + ); +} + +export async function getWorkflows( + apiEndpoint: string, + query: { page: number; limit: number; categories: string[]; search: string }, + headers?: RawAxiosRequestHeaders, +): Promise<{ + totalWorkflows: number; + workflows: ITemplatesWorkflow[]; + filters: TemplateSearchFacet[]; +}> { + return await get( + apiEndpoint, + '/templates/search', + { + page: query.page, + rows: query.limit, + category: stringifyArray(query.categories), + search: query.search, + }, + headers, + ); +} + +export async function getCollectionById( + apiEndpoint: string, + collectionId: string, + headers?: RawAxiosRequestHeaders, +): Promise<{ collection: ITemplatesCollectionResponse }> { + return await get(apiEndpoint, `/templates/collections/${collectionId}`, undefined, headers); +} + +export async function getTemplateById( + apiEndpoint: string, + templateId: string, + headers?: RawAxiosRequestHeaders, +): Promise<{ workflow: ITemplatesWorkflowResponse }> { + return await get(apiEndpoint, `/templates/workflows/${templateId}`, undefined, headers); +} + +export async function getWorkflowTemplate( + apiEndpoint: string, + templateId: string, + headers?: RawAxiosRequestHeaders, +): Promise { + return await get(apiEndpoint, `/workflows/templates/${templateId}`, undefined, headers); +} diff --git a/packages/frontend/@n8n/rest-api-client/src/api/workflows.ts b/packages/frontend/@n8n/rest-api-client/src/api/workflows.ts new file mode 100644 index 0000000000..941d71f23e --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/src/api/workflows.ts @@ -0,0 +1,42 @@ +import type { IWorkflowSettings, IConnections, INode, IPinData } from 'n8n-workflow'; + +import type { ITag } from './tags'; + +export interface WorkflowMetadata { + onboardingId?: string; + templateId?: string; + instanceId?: string; + templateCredsSetupCompleted?: boolean; +} + +// Simple version of n8n-workflow.Workflow +export interface WorkflowData { + id?: string; + name?: string; + active?: boolean; + nodes: INode[]; + connections: IConnections; + settings?: IWorkflowSettings; + tags?: string[]; + pinData?: IPinData; + versionId?: string; + meta?: WorkflowMetadata; +} + +export interface WorkflowDataUpdate { + id?: string; + name?: string; + nodes?: INode[]; + connections?: IConnections; + settings?: IWorkflowSettings; + active?: boolean; + tags?: ITag[] | string[]; // string[] when store or requested, ITag[] from API response + pinData?: IPinData; + versionId?: string; + meta?: WorkflowMetadata; + parentFolderId?: string; +} + +export interface WorkflowDataCreate extends WorkflowDataUpdate { + projectId?: string; +} diff --git a/packages/frontend/editor-ui/src/Interface.ts b/packages/frontend/editor-ui/src/Interface.ts index fd32a187a9..8f8e10fbc7 100644 --- a/packages/frontend/editor-ui/src/Interface.ts +++ b/packages/frontend/editor-ui/src/Interface.ts @@ -41,15 +41,21 @@ import type { INodeExecutionData, INodeProperties, NodeConnectionType, - INodeCredentialsDetails, StartNodeData, IPersonalizationSurveyAnswersV4, AnnotationVote, ITaskData, ISourceData, } from 'n8n-workflow'; -import type { Version, VersionNode } from '@n8n/rest-api-client/api/versions'; +import type { Version } from '@n8n/rest-api-client/api/versions'; import type { Cloud, InstanceUsage } from '@n8n/rest-api-client/api/cloudPlans'; +import type { + WorkflowMetadata, + WorkflowData, + WorkflowDataCreate, + WorkflowDataUpdate, +} from '@n8n/rest-api-client/api/workflows'; +import type { ITag } from '@n8n/rest-api-client/api/tags'; import type { AI_NODE_CREATOR_VIEW, @@ -203,7 +209,7 @@ export interface IAiData { } export interface IStartRunData { - workflowData: IWorkflowData; + workflowData: WorkflowData; startNodes?: StartNodeData[]; destinationNode?: string; runData?: IRunData; @@ -230,49 +236,17 @@ export interface ITableData { }; } -// Simple version of n8n-workflow.Workflow -export interface IWorkflowData { - id?: string; - name?: string; - active?: boolean; - nodes: INode[]; - connections: IConnections; - settings?: IWorkflowSettings; - tags?: string[]; - pinData?: IPinData; - versionId?: string; - meta?: WorkflowMetadata; -} - -export interface IWorkflowDataUpdate { - id?: string; - name?: string; - nodes?: INode[]; - connections?: IConnections; - settings?: IWorkflowSettings; - active?: boolean; - tags?: ITag[] | string[]; // string[] when store or requested, ITag[] from API response - pinData?: IPinData; - versionId?: string; - meta?: WorkflowMetadata; - parentFolderId?: string; -} - -export interface IWorkflowDataCreate extends IWorkflowDataUpdate { - projectId?: string; -} - /** * Workflow data with mandatory `templateId` * This is used to identify sample workflows that we create for onboarding */ -export interface WorkflowDataWithTemplateId extends Omit { +export interface WorkflowDataWithTemplateId extends Omit { meta: WorkflowMetadata & { templateId: Required['templateId']; }; } -export interface IWorkflowToShare extends IWorkflowDataUpdate { +export interface IWorkflowToShare extends WorkflowDataUpdate { meta: WorkflowMetadata; } @@ -281,38 +255,10 @@ export interface NewWorkflowResponse { defaultSettings: IWorkflowSettings; } -export interface IWorkflowTemplateNode - extends Pick< - INodeUi, - 'name' | 'type' | 'position' | 'parameters' | 'typeVersion' | 'webhookId' | 'id' | 'disabled' - > { - // The credentials in a template workflow have a different type than in a regular workflow - credentials?: IWorkflowTemplateNodeCredentials; -} - -export interface IWorkflowTemplateNodeCredentials { - [key: string]: string | INodeCredentialsDetails; -} - -export interface IWorkflowTemplate { - id: number; - name: string; - workflow: Pick & { - nodes: IWorkflowTemplateNode[]; - }; -} - export interface INewWorkflowData { name: string; } -export interface WorkflowMetadata { - onboardingId?: string; - templateId?: string; - instanceId?: string; - templateCredsSetupCompleted?: boolean; -} - // Almost identical to cli.Interfaces.ts export interface IWorkflowDb { id: string; @@ -627,93 +573,6 @@ export interface IUserPermissions { }; } -export interface ITemplatesCollection { - id: number; - name: string; - nodes: ITemplatesNode[]; - workflows: Array<{ id: number }>; -} - -interface ITemplatesImage { - id: number; - url: string; -} - -interface ITemplatesCollectionExtended extends ITemplatesCollection { - description: string | null; - image: ITemplatesImage[]; - categories: ITemplatesCategory[]; - createdAt: string; -} - -export interface ITemplatesCollectionFull extends ITemplatesCollectionExtended { - full: true; -} - -export interface ITemplatesCollectionResponse extends ITemplatesCollectionExtended { - workflows: ITemplatesWorkflow[]; -} - -/** - * A template without the actual workflow definition - */ -export interface ITemplatesWorkflow { - id: number; - createdAt: string; - name: string; - nodes: ITemplatesNode[]; - totalViews: number; - user: { - username: string; - }; -} - -export interface ITemplatesWorkflowInfo { - nodeCount: number; - nodeTypes: { - [key: string]: { - count: number; - }; - }; -} - -export type TemplateSearchFacet = { - field_name: string; - sampled: boolean; - stats: { - total_values: number; - }; - counts: Array<{ - count: number; - highlighted: string; - value: string; - }>; -}; - -export interface ITemplatesWorkflowResponse extends ITemplatesWorkflow, IWorkflowTemplate { - description: string | null; - image: ITemplatesImage[]; - categories: ITemplatesCategory[]; - workflowInfo: ITemplatesWorkflowInfo; -} - -/** - * A template with also the full workflow definition - */ -export interface ITemplatesWorkflowFull extends ITemplatesWorkflowResponse { - full: true; -} - -export interface ITemplatesQuery { - categories: string[]; - search: string; -} - -export interface ITemplatesCategory { - id: number; - name: string; -} - export type WorkflowCallerPolicyDefaultOption = 'any' | 'none' | 'workflowsFromAList'; export interface IWorkflowSettings extends IWorkflowSettingsWorkflow { @@ -893,13 +752,6 @@ export type NodeTypeSelectedPayload = { export interface SubcategorizedNodeTypes { [subcategory: string]: INodeCreateElement[]; } -export interface ITag { - id: string; - name: string; - usageCount?: number; - createdAt?: string; - updatedAt?: string; -} export interface ITagRow { tag?: ITag; @@ -911,11 +763,6 @@ export interface ITagRow { canDelete?: boolean; } -export interface ITemplatesNode extends VersionNode { - id: number; - categories?: ITemplatesCategory[]; -} - export interface INodeMetadata { parametersLastUpdatedAt?: number; pinnedDataLastUpdatedAt?: number; @@ -1130,28 +977,6 @@ export interface INodeTypesState { nodeTypes: NodeTypesByTypeNameAndVersion; } -export interface ITemplateState { - categories: ITemplatesCategory[]; - collections: { [id: string]: ITemplatesCollection }; - workflows: { [id: string]: ITemplatesWorkflow | ITemplatesWorkflowFull }; - workflowSearches: { - [search: string]: { - workflowIds: string[]; - totalWorkflows: number; - loadingMore?: boolean; - categories?: ITemplatesCategory[]; - }; - }; - collectionSearches: { - [search: string]: { - collectionIds: string[]; - }; - }; - currentSessionId: string; - previousSessionId: string; - currentN8nPath: string; -} - export interface IVersionsState { versionNotificationSettings: IVersionNotificationSettings; nextVersions: Version[]; diff --git a/packages/frontend/editor-ui/src/__tests__/server/factories/tag.ts b/packages/frontend/editor-ui/src/__tests__/server/factories/tag.ts index 5e1c93070e..339bd352d6 100644 --- a/packages/frontend/editor-ui/src/__tests__/server/factories/tag.ts +++ b/packages/frontend/editor-ui/src/__tests__/server/factories/tag.ts @@ -1,5 +1,5 @@ import { Factory } from 'miragejs'; -import type { ITag } from '@/Interface'; +import type { ITag } from '@n8n/rest-api-client/api/tags'; import { faker } from '@faker-js/faker'; export const tagFactory = Factory.extend({ diff --git a/packages/frontend/editor-ui/src/__tests__/server/fixtures/tags.ts b/packages/frontend/editor-ui/src/__tests__/server/fixtures/tags.ts index 740acef117..68a43c9f02 100644 --- a/packages/frontend/editor-ui/src/__tests__/server/fixtures/tags.ts +++ b/packages/frontend/editor-ui/src/__tests__/server/fixtures/tags.ts @@ -1,4 +1,4 @@ -import type { ITag } from '@/Interface'; +import type { ITag } from '@n8n/rest-api-client/api/tags'; export const tags: ITag[] = [ { id: '1', diff --git a/packages/frontend/editor-ui/src/__tests__/server/models/tag.ts b/packages/frontend/editor-ui/src/__tests__/server/models/tag.ts index 737e228856..0b1c4c9eea 100644 --- a/packages/frontend/editor-ui/src/__tests__/server/models/tag.ts +++ b/packages/frontend/editor-ui/src/__tests__/server/models/tag.ts @@ -1,4 +1,4 @@ -import type { ITag } from '@/Interface'; +import type { ITag } from '@n8n/rest-api-client/api/tags'; import { Model } from 'miragejs'; import type { ModelDefinition } from 'miragejs/-types'; diff --git a/packages/frontend/editor-ui/src/api/tags.ts b/packages/frontend/editor-ui/src/api/tags.ts index 894a1b35e6..d7f861fd9a 100644 --- a/packages/frontend/editor-ui/src/api/tags.ts +++ b/packages/frontend/editor-ui/src/api/tags.ts @@ -1,4 +1,4 @@ -import type { ITag } from '@/Interface'; +import type { ITag } from '@n8n/rest-api-client/api/tags'; import type { IRestApiContext } from '@n8n/rest-api-client'; import { makeRestApiRequest } from '@n8n/rest-api-client'; import type { CreateOrUpdateTagRequestDto, RetrieveTagQueryDto } from '@n8n/api-types'; diff --git a/packages/frontend/editor-ui/src/api/templates.ts b/packages/frontend/editor-ui/src/api/templates.ts deleted file mode 100644 index b953a6bf16..0000000000 --- a/packages/frontend/editor-ui/src/api/templates.ts +++ /dev/null @@ -1,86 +0,0 @@ -import type { RawAxiosRequestHeaders } from 'axios'; -import type { - ITemplatesCategory, - ITemplatesCollection, - ITemplatesQuery, - ITemplatesWorkflow, - ITemplatesCollectionResponse, - ITemplatesWorkflowResponse, - IWorkflowTemplate, - TemplateSearchFacet, -} from '@/Interface'; -import { get } from '@n8n/rest-api-client'; - -function stringifyArray(arr: string[]) { - return arr.join(','); -} - -export async function testHealthEndpoint(apiEndpoint: string) { - return await get(apiEndpoint, '/health'); -} - -export async function getCategories( - apiEndpoint: string, - headers?: RawAxiosRequestHeaders, -): Promise<{ categories: ITemplatesCategory[] }> { - return await get(apiEndpoint, '/templates/categories', undefined, headers); -} - -export async function getCollections( - apiEndpoint: string, - query: ITemplatesQuery, - headers?: RawAxiosRequestHeaders, -): Promise<{ collections: ITemplatesCollection[] }> { - return await get( - apiEndpoint, - '/templates/collections', - { category: query.categories, search: query.search }, - headers, - ); -} - -export async function getWorkflows( - apiEndpoint: string, - query: { page: number; limit: number; categories: string[]; search: string }, - headers?: RawAxiosRequestHeaders, -): Promise<{ - totalWorkflows: number; - workflows: ITemplatesWorkflow[]; - filters: TemplateSearchFacet[]; -}> { - return await get( - apiEndpoint, - '/templates/search', - { - page: query.page, - rows: query.limit, - category: stringifyArray(query.categories), - search: query.search, - }, - headers, - ); -} - -export async function getCollectionById( - apiEndpoint: string, - collectionId: string, - headers?: RawAxiosRequestHeaders, -): Promise<{ collection: ITemplatesCollectionResponse }> { - return await get(apiEndpoint, `/templates/collections/${collectionId}`, undefined, headers); -} - -export async function getTemplateById( - apiEndpoint: string, - templateId: string, - headers?: RawAxiosRequestHeaders, -): Promise<{ workflow: ITemplatesWorkflowResponse }> { - return await get(apiEndpoint, `/templates/workflows/${templateId}`, undefined, headers); -} - -export async function getWorkflowTemplate( - apiEndpoint: string, - templateId: string, - headers?: RawAxiosRequestHeaders, -): Promise { - return await get(apiEndpoint, `/workflows/templates/${templateId}`, undefined, headers); -} diff --git a/packages/frontend/editor-ui/src/components/AskAssistant/Agent/AskAssistantBuild.vue b/packages/frontend/editor-ui/src/components/AskAssistant/Agent/AskAssistantBuild.vue index c9e515ff96..0056600b1d 100644 --- a/packages/frontend/editor-ui/src/components/AskAssistant/Agent/AskAssistantBuild.vue +++ b/packages/frontend/editor-ui/src/components/AskAssistant/Agent/AskAssistantBuild.vue @@ -4,7 +4,7 @@ import { useUsersStore } from '@/stores/users.store'; import { computed, watch, ref, onBeforeUnmount } from 'vue'; import AskAssistantChat from '@n8n/design-system/components/AskAssistantChat/AskAssistantChat.vue'; import { useTelemetry } from '@/composables/useTelemetry'; -import type { IWorkflowDataUpdate } from '@/Interface'; +import type { WorkflowDataUpdate } from '@n8n/rest-api-client/api/workflows'; import { nodeViewEventBus } from '@/event-bus'; import { v4 as uuid } from 'uuid'; import { useI18n } from '@n8n/i18n'; @@ -37,7 +37,7 @@ async function onUserMessage(content: string) { await builderStore.initBuilderChat(content, 'chat'); } -function fixWorkflowStickiesPosition(workflowData: IWorkflowDataUpdate): IWorkflowDataUpdate { +function fixWorkflowStickiesPosition(workflowData: WorkflowDataUpdate): WorkflowDataUpdate { const STICKY_WIDTH = 480; const HEADERS_HEIGHT = 40; const NEW_LINE_HEIGHT = 20; @@ -76,7 +76,7 @@ function fixWorkflowStickiesPosition(workflowData: IWorkflowDataUpdate): IWorkfl } function onInsertWorkflow(code: string) { - let workflowData: IWorkflowDataUpdate; + let workflowData: WorkflowDataUpdate; try { workflowData = JSON.parse(code); } catch (error) { diff --git a/packages/frontend/editor-ui/src/components/DuplicateWorkflowDialog.vue b/packages/frontend/editor-ui/src/components/DuplicateWorkflowDialog.vue index 929984bca0..a96345d485 100644 --- a/packages/frontend/editor-ui/src/components/DuplicateWorkflowDialog.vue +++ b/packages/frontend/editor-ui/src/components/DuplicateWorkflowDialog.vue @@ -6,7 +6,7 @@ import WorkflowTagsDropdown from '@/components/WorkflowTagsDropdown.vue'; import Modal from '@/components/Modal.vue'; import { useSettingsStore } from '@/stores/settings.store'; import { useWorkflowsStore } from '@/stores/workflows.store'; -import type { IWorkflowDataUpdate } from '@/Interface'; +import type { WorkflowDataUpdate } from '@n8n/rest-api-client/api/workflows'; import { createEventBus, type EventBus } from '@n8n/utils/event-bus'; import { useCredentialsStore } from '@/stores/credentials.store'; import { useWorkflowHelpers } from '@/composables/useWorkflowHelpers'; @@ -86,7 +86,7 @@ const save = async (): Promise => { isSaving.value = true; try { - let workflowToUpdate: IWorkflowDataUpdate | undefined; + let workflowToUpdate: WorkflowDataUpdate | undefined; if (currentWorkflowId !== PLACEHOLDER_EMPTY_WORKFLOW_ID) { const { createdAt, diff --git a/packages/frontend/editor-ui/src/components/MainHeader/WorkflowDetails.vue b/packages/frontend/editor-ui/src/components/MainHeader/WorkflowDetails.vue index a0eaec055e..2b4b3fddc4 100644 --- a/packages/frontend/editor-ui/src/components/MainHeader/WorkflowDetails.vue +++ b/packages/frontend/editor-ui/src/components/MainHeader/WorkflowDetails.vue @@ -47,10 +47,10 @@ import { computed, ref, useCssModule, useTemplateRef, watch } from 'vue'; import type { ActionDropdownItem, FolderShortInfo, - IWorkflowDataUpdate, IWorkflowDb, IWorkflowToShare, } from '@/Interface'; +import type { WorkflowDataUpdate } from '@n8n/rest-api-client/api/workflows'; import { usePageRedirectionHelper } from '@/composables/usePageRedirectionHelper'; import { useTelemetry } from '@/composables/useTelemetry'; import type { PathItem } from '@n8n/design-system/components/N8nBreadcrumbs/Breadcrumbs.vue'; @@ -407,7 +407,7 @@ async function handleFileImport(): Promise { if (inputRef?.files && inputRef.files.length !== 0) { const reader = new FileReader(); reader.onload = () => { - let workflowData: IWorkflowDataUpdate; + let workflowData: WorkflowDataUpdate; try { workflowData = JSON.parse(reader.result as string); } catch (error) { diff --git a/packages/frontend/editor-ui/src/components/NodeList.vue b/packages/frontend/editor-ui/src/components/NodeList.vue index 69553cae50..71255ebde6 100644 --- a/packages/frontend/editor-ui/src/components/NodeList.vue +++ b/packages/frontend/editor-ui/src/components/NodeList.vue @@ -1,7 +1,7 @@