From 6cf07200dc0f7a66e976fe82bc635ce52e62b0c1 Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Thu, 5 Jun 2025 12:08:10 +0200 Subject: [PATCH] refactor(editor): Extract API Requests into `@n8n/rest-api-client` package (no-changelog) (#15930) --- packages/@n8n/constants/src/browser.ts | 1 + packages/@n8n/constants/src/index.ts | 2 + packages/@n8n/utils/package.json | 5 + packages/@n8n/vitest-config/frontend.d.ts | 5 +- packages/@n8n/vitest-config/frontend.mjs | 59 ++--- .../@n8n/rest-api-client/.eslintrc.cjs | 10 + .../frontend/@n8n/rest-api-client/.gitignore | 24 +++ .../frontend/@n8n/rest-api-client/README.md | 22 ++ .../frontend/@n8n/rest-api-client/biome.jsonc | 4 + .../@n8n/rest-api-client/package.json | 58 +++++ .../rest-api-client}/src/api/api-keys.ts | 5 +- .../src/api/communityNodes.ts | 5 +- .../rest-api-client}/src/api/ctas.ts | 4 +- .../rest-api-client}/src/api/eventbus.ee.ts | 5 +- .../rest-api-client}/src/api/events.ts | 4 +- .../@n8n/rest-api-client/src/api/execution.ts | 0 .../@n8n/rest-api-client/src/api/index.ts | 12 ++ .../rest-api-client}/src/api/mfa.ts | 4 +- .../rest-api-client}/src/api/nodeTypes.ts | 21 +- .../rest-api-client}/src/api/npsSurvey.ts | 5 +- .../rest-api-client}/src/api/orchestration.ts | 4 +- .../rest-api-client/src/api/roles.ts} | 5 +- .../rest-api-client}/src/api/ui.ts | 5 +- .../rest-api-client}/src/api/webhooks.ts | 5 +- .../@n8n/rest-api-client/src/index.ts | 3 + .../@n8n/rest-api-client/src/shims.d.ts | 1 + .../@n8n/rest-api-client/src/types.ts | 4 + .../rest-api-client/src/utils.test.ts} | 2 +- .../rest-api-client/src/utils.ts} | 36 +--- .../@n8n/rest-api-client/tsconfig.json | 14 ++ .../@n8n/rest-api-client/tsup.config.ts | 11 + .../@n8n/rest-api-client/vite.config.ts | 4 + packages/frontend/editor-ui/package.json | 2 + packages/frontend/editor-ui/src/Interface.ts | 5 - packages/frontend/editor-ui/src/api/ai.ts | 5 +- .../frontend/editor-ui/src/api/cloudPlans.ts | 5 +- .../editor-ui/src/api/credentials.ee.ts | 5 +- .../frontend/editor-ui/src/api/credentials.ts | 9 +- .../editor-ui/src/api/environments.ee.ts | 5 +- .../editor-ui/src/api/evaluation.ee.ts | 4 +- .../editor-ui/src/api/externalSecrets.ee.ts | 5 +- .../frontend/editor-ui/src/api/invitation.ts | 10 +- packages/frontend/editor-ui/src/api/ldap.ts | 5 +- .../editor-ui/src/api/projects.api.ts | 4 +- .../editor-ui/src/api/schemaPreview.test.ts | 4 +- .../editor-ui/src/api/schemaPreview.ts | 2 +- .../frontend/editor-ui/src/api/settings.ts | 5 +- .../editor-ui/src/api/sourceControl.ts | 4 +- packages/frontend/editor-ui/src/api/sso.ts | 5 +- packages/frontend/editor-ui/src/api/tags.ts | 5 +- .../frontend/editor-ui/src/api/templates.ts | 2 +- packages/frontend/editor-ui/src/api/usage.ts | 5 +- packages/frontend/editor-ui/src/api/users.ts | 4 +- .../frontend/editor-ui/src/api/versions.ts | 2 +- .../editor-ui/src/api/workflow-webhooks.ts | 2 +- .../editor-ui/src/api/workflowHistory.ts | 4 +- .../editor-ui/src/api/workflows.ee.ts | 5 +- .../frontend/editor-ui/src/api/workflows.ts | 4 +- .../becomeTemplateCreatorStore.ts | 2 +- .../composables/useWorkflowHelpers.test.ts | 2 +- .../src/composables/useWorkflowHelpers.ts | 2 +- packages/frontend/editor-ui/src/constants.ts | 2 - .../src/features/insights/insights.api.ts | 4 +- .../editor-ui/src/plugins/sentry.test.ts | 2 +- .../frontend/editor-ui/src/plugins/sentry.ts | 2 +- .../editor-ui/src/stores/apiKeys.store.ts | 2 +- .../src/stores/communityNodes.store.ts | 2 +- .../editor-ui/src/stores/credentials.store.ts | 2 +- .../src/stores/executions.store.test.ts | 2 +- .../editor-ui/src/stores/executions.store.ts | 3 +- .../src/stores/logStreaming.store.ts | 2 +- .../editor-ui/src/stores/nodeTypes.store.ts | 2 +- .../src/stores/npsStore.store.test.ts | 2 +- .../editor-ui/src/stores/npsSurvey.store.ts | 2 +- .../src/stores/orchestration.store.ts | 2 +- .../editor-ui/src/stores/roles.store.test.ts | 2 +- .../editor-ui/src/stores/roles.store.ts | 2 +- .../src/stores/settings.store.test.ts | 2 +- .../editor-ui/src/stores/settings.store.ts | 4 +- .../frontend/editor-ui/src/stores/ui.store.ts | 2 +- .../editor-ui/src/stores/users.store.ts | 5 +- .../src/stores/workflows.store.test.ts | 2 +- .../editor-ui/src/stores/workflows.store.ts | 3 +- .../editor-ui/src/utils/executionUtils.ts | 31 ++- .../src/views/WorkflowExecutionsView.vue | 2 +- packages/frontend/editor-ui/tsconfig.json | 10 +- packages/frontend/editor-ui/vite.config.mts | 8 + packages/workflow/package.json | 2 +- pnpm-lock.yaml | 202 +++++++++--------- pnpm-workspace.yaml | 1 + 90 files changed, 502 insertions(+), 279 deletions(-) create mode 100644 packages/@n8n/constants/src/browser.ts create mode 100644 packages/frontend/@n8n/rest-api-client/.eslintrc.cjs create mode 100644 packages/frontend/@n8n/rest-api-client/.gitignore create mode 100644 packages/frontend/@n8n/rest-api-client/README.md create mode 100644 packages/frontend/@n8n/rest-api-client/biome.jsonc create mode 100644 packages/frontend/@n8n/rest-api-client/package.json rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/api-keys.ts (91%) rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/communityNodes.ts (88%) rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/ctas.ts (66%) rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/eventbus.ee.ts (93%) rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/events.ts (59%) create mode 100644 packages/frontend/@n8n/rest-api-client/src/api/execution.ts create mode 100644 packages/frontend/@n8n/rest-api-client/src/api/index.ts rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/mfa.ts (89%) rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/nodeTypes.ts (91%) rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/npsSurvey.ts (68%) rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/orchestration.ts (67%) rename packages/frontend/{editor-ui/src/api/roles.api.ts => @n8n/rest-api-client/src/api/roles.ts} (65%) rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/ui.ts (74%) rename packages/frontend/{editor-ui => @n8n/rest-api-client}/src/api/webhooks.ts (78%) create mode 100644 packages/frontend/@n8n/rest-api-client/src/index.ts create mode 100644 packages/frontend/@n8n/rest-api-client/src/shims.d.ts create mode 100644 packages/frontend/@n8n/rest-api-client/src/types.ts rename packages/frontend/{editor-ui/src/utils/apiUtils.test.ts => @n8n/rest-api-client/src/utils.test.ts} (99%) rename packages/frontend/{editor-ui/src/utils/apiUtils.ts => @n8n/rest-api-client/src/utils.ts} (88%) create mode 100644 packages/frontend/@n8n/rest-api-client/tsconfig.json create mode 100644 packages/frontend/@n8n/rest-api-client/tsup.config.ts create mode 100644 packages/frontend/@n8n/rest-api-client/vite.config.ts diff --git a/packages/@n8n/constants/src/browser.ts b/packages/@n8n/constants/src/browser.ts new file mode 100644 index 0000000000..0fae7238d3 --- /dev/null +++ b/packages/@n8n/constants/src/browser.ts @@ -0,0 +1 @@ +export const BROWSER_ID_STORAGE_KEY = 'n8n-browserId'; diff --git a/packages/@n8n/constants/src/index.ts b/packages/@n8n/constants/src/index.ts index 0e952df381..6b8ede8435 100644 --- a/packages/@n8n/constants/src/index.ts +++ b/packages/@n8n/constants/src/index.ts @@ -1,3 +1,5 @@ +export * from './browser'; + export const LICENSE_FEATURES = { SHARING: 'feat:sharing', LDAP: 'feat:ldap', diff --git a/packages/@n8n/utils/package.json b/packages/@n8n/utils/package.json index 45c50d6e6a..793a8d19b4 100644 --- a/packages/@n8n/utils/package.json +++ b/packages/@n8n/utils/package.json @@ -6,6 +6,11 @@ "dist" ], "exports": { + "./dist/*": { + "types": "./dist/*.d.ts", + "import": "./dist/*.js", + "require": "./dist/*.cjs" + }, "./*": { "types": "./dist/*.d.ts", "import": "./dist/*.js", diff --git a/packages/@n8n/vitest-config/frontend.d.ts b/packages/@n8n/vitest-config/frontend.d.ts index d6ecb6d5d5..39b6396b58 100644 --- a/packages/@n8n/vitest-config/frontend.d.ts +++ b/packages/@n8n/vitest-config/frontend.d.ts @@ -1,3 +1,6 @@ -import type { UserConfig } from 'vitest/node'; +import type { InlineConfig } from 'vitest/node'; +import type { UserConfig } from 'vite'; + +export const createVitestConfig: (options?: InlineConfig) => UserConfig; export const vitestConfig: UserConfig; diff --git a/packages/@n8n/vitest-config/frontend.mjs b/packages/@n8n/vitest-config/frontend.mjs index b2684b4efa..5799aceb16 100644 --- a/packages/@n8n/vitest-config/frontend.mjs +++ b/packages/@n8n/vitest-config/frontend.mjs @@ -2,34 +2,41 @@ import { defineConfig as defineVitestConfig } from 'vitest/config'; /** * Define a Vitest configuration - * - * @returns {import('vitest/node').UserConfig} + * @param {import('vitest/node').InlineConfig} options - The options to pass to the Vitest configuration + * @returns {import('vite').UserConfig} */ -export const vitestConfig = defineVitestConfig({ - test: { - silent: true, - globals: true, - environment: 'jsdom', - setupFiles: ['./src/__tests__/setup.ts'], - coverage: { - enabled: false, - all: false, - provider: 'v8', - reporter: ['text-summary', 'lcov', 'html-spa'], - }, - css: { - modules: { - classNameStrategy: 'non-scoped', +export const createVitestConfig = (options = {}) => { + const vitestConfig = defineVitestConfig({ + test: { + silent: true, + globals: true, + environment: 'jsdom', + setupFiles: ['./src/__tests__/setup.ts'], + coverage: { + enabled: false, + all: false, + provider: 'v8', + reporter: ['text-summary', 'lcov', 'html-spa'], }, + css: { + modules: { + classNameStrategy: 'non-scoped', + }, + }, + ...options, }, - }, -}); + }); -if (process.env.COVERAGE_ENABLED === 'true') { - const { coverage } = vitestConfig.test; - coverage.enabled = true; - if (process.env.CI === 'true') { - coverage.all = true; - coverage.reporter = ['cobertura']; + if (process.env.COVERAGE_ENABLED === 'true') { + const { coverage } = vitestConfig.test; + coverage.enabled = true; + if (process.env.CI === 'true') { + coverage.all = true; + coverage.reporter = ['cobertura']; + } } -} + + return vitestConfig; +}; + +export const vitestConfig = createVitestConfig(); diff --git a/packages/frontend/@n8n/rest-api-client/.eslintrc.cjs b/packages/frontend/@n8n/rest-api-client/.eslintrc.cjs new file mode 100644 index 0000000000..3f9a316c08 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/.eslintrc.cjs @@ -0,0 +1,10 @@ +const sharedOptions = require('@n8n/eslint-config/shared'); + +/** + * @type {import('@types/eslint').ESLint.ConfigData} + */ +module.exports = { + extends: ['@n8n/eslint-config/frontend'], + + ...sharedOptions(__dirname, 'frontend'), +}; diff --git a/packages/frontend/@n8n/rest-api-client/.gitignore b/packages/frontend/@n8n/rest-api-client/.gitignore new file mode 100644 index 0000000000..a547bf36d8 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/packages/frontend/@n8n/rest-api-client/README.md b/packages/frontend/@n8n/rest-api-client/README.md new file mode 100644 index 0000000000..5675f442e7 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/README.md @@ -0,0 +1,22 @@ +# @n8n/rest-api-client + +This package contains the REST API calls for n8n. + +## Table of Contents + +- [Features](#features) +- [Contributing](#contributing) +- [License](#license) + +## Features + +- Provides a REST API for n8n +- Supports authentication and authorization + +## Contributing + +For more details, please read our [CONTRIBUTING.md](CONTRIBUTING.md). + +## License + +For more details, please read our [LICENSE.md](LICENSE.md). diff --git a/packages/frontend/@n8n/rest-api-client/biome.jsonc b/packages/frontend/@n8n/rest-api-client/biome.jsonc new file mode 100644 index 0000000000..f882da95a5 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/biome.jsonc @@ -0,0 +1,4 @@ +{ + "$schema": "../../../../node_modules/@biomejs/biome/configuration_schema.json", + "extends": ["../../../../biome.jsonc"] +} diff --git a/packages/frontend/@n8n/rest-api-client/package.json b/packages/frontend/@n8n/rest-api-client/package.json new file mode 100644 index 0000000000..70aeb06db0 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/package.json @@ -0,0 +1,58 @@ +{ + "name": "@n8n/rest-api-client", + "type": "module", + "version": "1.0.0", + "files": [ + "dist" + ], + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs" + }, + "./*": { + "types": "./dist/*.d.ts", + "import": "./dist/*.js", + "require": "./dist/*.cjs" + } + }, + "scripts": { + "dev": "vite", + "build": "pnpm run typecheck && tsup", + "preview": "vite preview", + "typecheck": "vue-tsc --noEmit", + "test": "vitest run", + "test:dev": "vitest --silent=false", + "lint": "eslint src --ext .js,.ts,.vue --quiet", + "lintfix": "eslint src --ext .js,.ts,.vue --fix", + "format": "biome format --write . && prettier --write . --ignore-path ../../../../.prettierignore", + "format:check": "biome ci . && prettier --check . --ignore-path ../../../../.prettierignore" + }, + "dependencies": { + "@n8n/api-types": "workspace:*", + "@n8n/constants": "workspace:*", + "@n8n/permissions": "workspace:*", + "@n8n/utils": "workspace:*", + "js-base64": "catalog:", + "n8n-workflow": "workspace:*", + "axios": "catalog:", + "flatted": "catalog:" + }, + "devDependencies": { + "@n8n/eslint-config": "workspace:*", + "@n8n/i18n": "workspace:*", + "@n8n/typescript-config": "workspace:*", + "@n8n/vitest-config": "workspace:*", + "@testing-library/jest-dom": "catalog:frontend", + "@testing-library/user-event": "catalog:frontend", + "tsup": "catalog:", + "typescript": "catalog:frontend", + "vite": "catalog:frontend", + "vitest": "catalog:frontend" + }, + "license": "See LICENSE.md file in the root of the repository" +} diff --git a/packages/frontend/editor-ui/src/api/api-keys.ts b/packages/frontend/@n8n/rest-api-client/src/api/api-keys.ts similarity index 91% rename from packages/frontend/editor-ui/src/api/api-keys.ts rename to packages/frontend/@n8n/rest-api-client/src/api/api-keys.ts index a67ff51d4f..92759ffae0 100644 --- a/packages/frontend/editor-ui/src/api/api-keys.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/api-keys.ts @@ -1,5 +1,3 @@ -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; import type { CreateApiKeyRequestDto, UpdateApiKeyRequestDto, @@ -8,6 +6,9 @@ import type { } from '@n8n/api-types'; import type { ApiKeyScope } from '@n8n/permissions'; +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; + export async function getApiKeys(context: IRestApiContext): Promise { return await makeRestApiRequest(context, 'GET', '/api-keys'); } diff --git a/packages/frontend/editor-ui/src/api/communityNodes.ts b/packages/frontend/@n8n/rest-api-client/src/api/communityNodes.ts similarity index 88% rename from packages/frontend/editor-ui/src/api/communityNodes.ts rename to packages/frontend/@n8n/rest-api-client/src/api/communityNodes.ts index f376fa59bd..eeb61fbd0d 100644 --- a/packages/frontend/editor-ui/src/api/communityNodes.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/communityNodes.ts @@ -1,6 +1,7 @@ -import type { IRestApiContext } from '@/Interface'; import type { PublicInstalledPackage } from 'n8n-workflow'; -import { get, post, makeRestApiRequest } from '@/utils/apiUtils'; + +import type { IRestApiContext } from '../types'; +import { get, post, makeRestApiRequest } from '../utils'; export async function getInstalledCommunityNodes( context: IRestApiContext, diff --git a/packages/frontend/editor-ui/src/api/ctas.ts b/packages/frontend/@n8n/rest-api-client/src/api/ctas.ts similarity index 66% rename from packages/frontend/editor-ui/src/api/ctas.ts rename to packages/frontend/@n8n/rest-api-client/src/api/ctas.ts index 88a0e7da71..e72809b032 100644 --- a/packages/frontend/editor-ui/src/api/ctas.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/ctas.ts @@ -1,5 +1,5 @@ -import type { IRestApiContext } from '@/Interface'; -import { get } from '@/utils/apiUtils'; +import type { IRestApiContext } from '../types'; +import { get } from '../utils'; export async function getBecomeCreatorCta(context: IRestApiContext): Promise { const response = await get(context.baseUrl, '/cta/become-creator'); diff --git a/packages/frontend/editor-ui/src/api/eventbus.ee.ts b/packages/frontend/@n8n/rest-api-client/src/api/eventbus.ee.ts similarity index 93% rename from packages/frontend/editor-ui/src/api/eventbus.ee.ts rename to packages/frontend/@n8n/rest-api-client/src/api/eventbus.ee.ts index fa99c38e6c..f8de83e824 100644 --- a/packages/frontend/editor-ui/src/api/eventbus.ee.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/eventbus.ee.ts @@ -1,7 +1,8 @@ -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; import type { IDataObject, MessageEventBusDestinationOptions } from 'n8n-workflow'; +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; + export type ApiMessageEventBusDestinationOptions = MessageEventBusDestinationOptions & { id: string; }; diff --git a/packages/frontend/editor-ui/src/api/events.ts b/packages/frontend/@n8n/rest-api-client/src/api/events.ts similarity index 59% rename from packages/frontend/editor-ui/src/api/events.ts rename to packages/frontend/@n8n/rest-api-client/src/api/events.ts index 00182bcaa1..4528bc852e 100644 --- a/packages/frontend/editor-ui/src/api/events.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/events.ts @@ -1,5 +1,5 @@ -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; export async function sessionStarted(context: IRestApiContext): Promise { return await makeRestApiRequest(context, 'GET', '/events/session-started'); diff --git a/packages/frontend/@n8n/rest-api-client/src/api/execution.ts b/packages/frontend/@n8n/rest-api-client/src/api/execution.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/frontend/@n8n/rest-api-client/src/api/index.ts b/packages/frontend/@n8n/rest-api-client/src/api/index.ts new file mode 100644 index 0000000000..3237740e14 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/src/api/index.ts @@ -0,0 +1,12 @@ +export * from './api-keys'; +export * from './communityNodes'; +export * from './ctas'; +export * from './eventbus.ee'; +export * from './events'; +export * from './mfa'; +export * from './nodeTypes'; +export * from './npsSurvey'; +export * from './orchestration'; +export * from './roles'; +export * from './ui'; +export * from './webhooks'; diff --git a/packages/frontend/editor-ui/src/api/mfa.ts b/packages/frontend/@n8n/rest-api-client/src/api/mfa.ts similarity index 89% rename from packages/frontend/editor-ui/src/api/mfa.ts rename to packages/frontend/@n8n/rest-api-client/src/api/mfa.ts index df5849fe2c..4b5d9d7c8e 100644 --- a/packages/frontend/editor-ui/src/api/mfa.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/mfa.ts @@ -1,5 +1,5 @@ -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; export async function canEnableMFA(context: IRestApiContext) { return await makeRestApiRequest(context, 'POST', '/mfa/can-enable'); diff --git a/packages/frontend/editor-ui/src/api/nodeTypes.ts b/packages/frontend/@n8n/rest-api-client/src/api/nodeTypes.ts similarity index 91% rename from packages/frontend/editor-ui/src/api/nodeTypes.ts rename to packages/frontend/@n8n/rest-api-client/src/api/nodeTypes.ts index 33bc27b355..04baca60e4 100644 --- a/packages/frontend/editor-ui/src/api/nodeTypes.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/nodeTypes.ts @@ -5,19 +5,20 @@ import type { ResourceLocatorRequestDto, ResourceMapperFieldsRequestDto, } from '@n8n/api-types'; -import { makeRestApiRequest } from '@/utils/apiUtils'; -import type { IRestApiContext } from '@/Interface'; import type { INodeTranslationHeaders } from '@n8n/i18n'; import axios from 'axios'; -import { - type INodeListSearchResult, - type INodePropertyOptions, - type INodeTypeDescription, - type INodeTypeNameVersion, - type NodeParameterValueType, - type ResourceMapperFields, - sleep, +import type { + INodeListSearchResult, + INodePropertyOptions, + INodeTypeDescription, + INodeTypeNameVersion, + NodeParameterValueType, + ResourceMapperFields, } from 'n8n-workflow'; +import { sleep } from 'n8n-workflow'; + +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; async function fetchNodeTypesJsonWithRetry(url: string, retries = 5, delay = 500) { for (let attempt = 0; attempt < retries; attempt++) { diff --git a/packages/frontend/editor-ui/src/api/npsSurvey.ts b/packages/frontend/@n8n/rest-api-client/src/api/npsSurvey.ts similarity index 68% rename from packages/frontend/editor-ui/src/api/npsSurvey.ts rename to packages/frontend/@n8n/rest-api-client/src/api/npsSurvey.ts index 3d235851bc..341824f0b7 100644 --- a/packages/frontend/editor-ui/src/api/npsSurvey.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/npsSurvey.ts @@ -1,7 +1,8 @@ -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; import type { NpsSurveyState } from 'n8n-workflow'; +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; + export async function updateNpsSurveyState(context: IRestApiContext, state: NpsSurveyState) { await makeRestApiRequest(context, 'PATCH', '/user-settings/nps-survey', state); } diff --git a/packages/frontend/editor-ui/src/api/orchestration.ts b/packages/frontend/@n8n/rest-api-client/src/api/orchestration.ts similarity index 67% rename from packages/frontend/editor-ui/src/api/orchestration.ts rename to packages/frontend/@n8n/rest-api-client/src/api/orchestration.ts index 4c8e1cd1e0..bf81fc45bc 100644 --- a/packages/frontend/editor-ui/src/api/orchestration.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/orchestration.ts @@ -1,5 +1,5 @@ -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; const GET_STATUS_ENDPOINT = '/orchestration/worker/status'; diff --git a/packages/frontend/editor-ui/src/api/roles.api.ts b/packages/frontend/@n8n/rest-api-client/src/api/roles.ts similarity index 65% rename from packages/frontend/editor-ui/src/api/roles.api.ts rename to packages/frontend/@n8n/rest-api-client/src/api/roles.ts index ee578d97b7..1912c655df 100644 --- a/packages/frontend/editor-ui/src/api/roles.api.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/roles.ts @@ -1,6 +1,7 @@ import type { AllRolesMap } from '@n8n/permissions'; -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; + +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; export const getRoles = async (context: IRestApiContext): Promise => { return await makeRestApiRequest(context, 'GET', '/roles'); diff --git a/packages/frontend/editor-ui/src/api/ui.ts b/packages/frontend/@n8n/rest-api-client/src/api/ui.ts similarity index 74% rename from packages/frontend/editor-ui/src/api/ui.ts rename to packages/frontend/@n8n/rest-api-client/src/api/ui.ts index 7716415c6a..222c738983 100644 --- a/packages/frontend/editor-ui/src/api/ui.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/ui.ts @@ -1,7 +1,8 @@ -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; import type { BannerName } from '@n8n/api-types'; +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; + export async function dismissBannerPermanently( context: IRestApiContext, data: { bannerName: BannerName; dismissedBanners: string[] }, diff --git a/packages/frontend/editor-ui/src/api/webhooks.ts b/packages/frontend/@n8n/rest-api-client/src/api/webhooks.ts similarity index 78% rename from packages/frontend/editor-ui/src/api/webhooks.ts rename to packages/frontend/@n8n/rest-api-client/src/api/webhooks.ts index 074fbae674..db224272ae 100644 --- a/packages/frontend/editor-ui/src/api/webhooks.ts +++ b/packages/frontend/@n8n/rest-api-client/src/api/webhooks.ts @@ -1,7 +1,8 @@ -import { makeRestApiRequest } from '@/utils/apiUtils'; -import type { IRestApiContext } from '@/Interface'; import type { IHttpRequestMethods } from 'n8n-workflow'; +import type { IRestApiContext } from '../types'; +import { makeRestApiRequest } from '../utils'; + type WebhookData = { workflowId: string; webhookPath: string; diff --git a/packages/frontend/@n8n/rest-api-client/src/index.ts b/packages/frontend/@n8n/rest-api-client/src/index.ts new file mode 100644 index 0000000000..8806bb5196 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/src/index.ts @@ -0,0 +1,3 @@ +export * from './api'; +export * from './types'; +export * from './utils'; diff --git a/packages/frontend/@n8n/rest-api-client/src/shims.d.ts b/packages/frontend/@n8n/rest-api-client/src/shims.d.ts new file mode 100644 index 0000000000..11f02fe2a0 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/src/shims.d.ts @@ -0,0 +1 @@ +/// diff --git a/packages/frontend/@n8n/rest-api-client/src/types.ts b/packages/frontend/@n8n/rest-api-client/src/types.ts new file mode 100644 index 0000000000..de7d8ed6aa --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/src/types.ts @@ -0,0 +1,4 @@ +export interface IRestApiContext { + baseUrl: string; + pushRef: string; +} diff --git a/packages/frontend/editor-ui/src/utils/apiUtils.test.ts b/packages/frontend/@n8n/rest-api-client/src/utils.test.ts similarity index 99% rename from packages/frontend/editor-ui/src/utils/apiUtils.test.ts rename to packages/frontend/@n8n/rest-api-client/src/utils.test.ts index 43b361eee9..3bab3c564d 100644 --- a/packages/frontend/editor-ui/src/utils/apiUtils.test.ts +++ b/packages/frontend/@n8n/rest-api-client/src/utils.test.ts @@ -1,4 +1,4 @@ -import { ResponseError, STREAM_SEPERATOR, streamRequest } from './apiUtils'; +import { ResponseError, STREAM_SEPERATOR, streamRequest } from './utils'; describe('streamRequest', () => { it('should stream data from the API endpoint', async () => { diff --git a/packages/frontend/editor-ui/src/utils/apiUtils.ts b/packages/frontend/@n8n/rest-api-client/src/utils.ts similarity index 88% rename from packages/frontend/editor-ui/src/utils/apiUtils.ts rename to packages/frontend/@n8n/rest-api-client/src/utils.ts index 3be7d097e5..9f7668011d 100644 --- a/packages/frontend/editor-ui/src/utils/apiUtils.ts +++ b/packages/frontend/@n8n/rest-api-client/src/utils.ts @@ -1,11 +1,11 @@ +import { BROWSER_ID_STORAGE_KEY } from '@n8n/constants'; +import { assert } from '@n8n/utils/assert'; import type { AxiosRequestConfig, Method, RawAxiosRequestHeaders } from 'axios'; import axios from 'axios'; -import { ApplicationError, jsonParse, type GenericValue, type IDataObject } from 'n8n-workflow'; -import { parse } from 'flatted'; -import { assert } from '@n8n/utils/assert'; +import { ApplicationError, jsonParse } from 'n8n-workflow'; +import type { GenericValue, IDataObject } from 'n8n-workflow'; -import { BROWSER_ID_STORAGE_KEY } from '@/constants'; -import type { IExecutionFlattedResponse, IExecutionResponse, IRestApiContext } from '@/Interface'; +import type { IRestApiContext } from './types'; const getBrowserId = () => { let browserId = localStorage.getItem(BROWSER_ID_STORAGE_KEY); @@ -170,7 +170,7 @@ export async function makeRestApiRequest( data, }); - // @ts-ignore all cli rest api endpoints return data wrapped in `data` key + // All cli rest api endpoints return data wrapped in `data` key return response.data as T; } @@ -201,28 +201,6 @@ export async function patch( return await request({ method: 'PATCH', baseURL, endpoint, headers, data: params }); } -/** - * Unflattens the Execution data. - * - * @param {IExecutionFlattedResponse} fullExecutionData The data to unflatten - */ -export function unflattenExecutionData(fullExecutionData: IExecutionFlattedResponse) { - // Unflatten the data - const returnData: IExecutionResponse = { - ...fullExecutionData, - workflowData: fullExecutionData.workflowData, - data: parse(fullExecutionData.data), - }; - - returnData.finished = returnData.finished ? returnData.finished : false; - - if (fullExecutionData.id) { - returnData.id = fullExecutionData.id; - } - - return returnData; -} - export async function streamRequest( context: IRestApiContext, apiEndpoint: string, @@ -306,6 +284,6 @@ export async function streamRequest( } } catch (e: unknown) { assert(e instanceof Error); - onError?.(e); + onError?.(e as Error); } } diff --git a/packages/frontend/@n8n/rest-api-client/tsconfig.json b/packages/frontend/@n8n/rest-api-client/tsconfig.json new file mode 100644 index 0000000000..e51e37331b --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/tsconfig.json @@ -0,0 +1,14 @@ +{ + "extends": "@n8n/typescript-config/tsconfig.frontend.json", + "compilerOptions": { + "baseUrl": ".", + "outDir": "dist", + "useUnknownInCatchVariables": false, + "types": ["vite/client", "vitest/globals"], + "isolatedModules": true, + "paths": { + "@n8n/utils/*": ["../../../@n8n/utils/src/*"] + } + }, + "include": ["src/**/*.ts", "vite.config.ts", "tsup.config.ts"] +} diff --git a/packages/frontend/@n8n/rest-api-client/tsup.config.ts b/packages/frontend/@n8n/rest-api-client/tsup.config.ts new file mode 100644 index 0000000000..bff21e2550 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/tsup.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: ['src/**/*.ts', '!src/**/*.test.ts', '!src/**/*.d.ts', '!src/__tests__/**/*'], + format: ['cjs', 'esm'], + clean: true, + dts: true, + cjsInterop: true, + splitting: true, + sourcemap: true, +}); diff --git a/packages/frontend/@n8n/rest-api-client/vite.config.ts b/packages/frontend/@n8n/rest-api-client/vite.config.ts new file mode 100644 index 0000000000..27fe373747 --- /dev/null +++ b/packages/frontend/@n8n/rest-api-client/vite.config.ts @@ -0,0 +1,4 @@ +import { defineConfig, mergeConfig } from 'vite'; +import { createVitestConfig } from '@n8n/vitest-config/frontend'; + +export default mergeConfig(defineConfig({}), createVitestConfig({ setupFiles: [] })); diff --git a/packages/frontend/editor-ui/package.json b/packages/frontend/editor-ui/package.json index 82bd6594b6..bde75e3143 100644 --- a/packages/frontend/editor-ui/package.json +++ b/packages/frontend/editor-ui/package.json @@ -31,11 +31,13 @@ "@codemirror/view": "^6.26.3", "@dagrejs/dagre": "^1.1.4", "@lezer/common": "1.1.0", + "@n8n/rest-api-client": "workspace:*", "@n8n/api-types": "workspace:*", "@n8n/chat": "workspace:*", "@n8n/codemirror-lang": "workspace:*", "@n8n/codemirror-lang-sql": "^1.0.2", "@n8n/composables": "workspace:*", + "@n8n/constants": "workspace:*", "@n8n/design-system": "workspace:*", "@n8n/i18n": "workspace:*", "@n8n/permissions": "workspace:*", diff --git a/packages/frontend/editor-ui/src/Interface.ts b/packages/frontend/editor-ui/src/Interface.ts index e816af6a4e..a2ddef11d9 100644 --- a/packages/frontend/editor-ui/src/Interface.ts +++ b/packages/frontend/editor-ui/src/Interface.ts @@ -1177,11 +1177,6 @@ export interface CommunityNodesState { installedPackages: CommunityPackageMap; } -export interface IRestApiContext { - baseUrl: string; - pushRef: string; -} - export interface IZoomConfig { scale: number; offset: XYPosition; diff --git a/packages/frontend/editor-ui/src/api/ai.ts b/packages/frontend/editor-ui/src/api/ai.ts index f29f8485b8..63cd9ed2a0 100644 --- a/packages/frontend/editor-ui/src/api/ai.ts +++ b/packages/frontend/editor-ui/src/api/ai.ts @@ -1,8 +1,9 @@ import { useAIAssistantHelpers } from '@/composables/useAIAssistantHelpers'; import { AI_ASSISTANT_MAX_CONTENT_LENGTH } from '@/constants'; -import type { ICredentialsResponse, IRestApiContext } from '@/Interface'; +import type { ICredentialsResponse } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; import type { AskAiRequest, ChatRequest, ReplaceCodeRequest } from '@/types/assistant.types'; -import { makeRestApiRequest, streamRequest } from '@/utils/apiUtils'; +import { makeRestApiRequest, streamRequest } from '@n8n/rest-api-client'; import { getObjectSizeInKB } from '@/utils/objectUtils'; import type { IDataObject } from 'n8n-workflow'; diff --git a/packages/frontend/editor-ui/src/api/cloudPlans.ts b/packages/frontend/editor-ui/src/api/cloudPlans.ts index 821c1ce1a3..a7eabed0f0 100644 --- a/packages/frontend/editor-ui/src/api/cloudPlans.ts +++ b/packages/frontend/editor-ui/src/api/cloudPlans.ts @@ -1,5 +1,6 @@ -import type { Cloud, IRestApiContext, InstanceUsage } from '@/Interface'; -import { get, post } from '@/utils/apiUtils'; +import type { Cloud, InstanceUsage } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { get, post } from '@n8n/rest-api-client'; export async function getCurrentPlan(context: IRestApiContext): Promise { return await get(context.baseUrl, '/admin/cloud-plan'); diff --git a/packages/frontend/editor-ui/src/api/credentials.ee.ts b/packages/frontend/editor-ui/src/api/credentials.ee.ts index 590047a01c..40ab25869d 100644 --- a/packages/frontend/editor-ui/src/api/credentials.ee.ts +++ b/packages/frontend/editor-ui/src/api/credentials.ee.ts @@ -1,5 +1,6 @@ -import type { ICredentialsResponse, IRestApiContext, IShareCredentialsPayload } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { ICredentialsResponse, IShareCredentialsPayload } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import type { IDataObject } from 'n8n-workflow'; export async function setCredentialSharedWith( diff --git a/packages/frontend/editor-ui/src/api/credentials.ts b/packages/frontend/editor-ui/src/api/credentials.ts index d32dede2b5..6b26689bbe 100644 --- a/packages/frontend/editor-ui/src/api/credentials.ts +++ b/packages/frontend/editor-ui/src/api/credentials.ts @@ -1,9 +1,6 @@ -import type { - ICredentialsDecryptedResponse, - ICredentialsResponse, - IRestApiContext, -} from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { ICredentialsDecryptedResponse, ICredentialsResponse } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import type { ICredentialsDecrypted, ICredentialType, diff --git a/packages/frontend/editor-ui/src/api/environments.ee.ts b/packages/frontend/editor-ui/src/api/environments.ee.ts index a6a6bba632..b22ffc7a2b 100644 --- a/packages/frontend/editor-ui/src/api/environments.ee.ts +++ b/packages/frontend/editor-ui/src/api/environments.ee.ts @@ -1,5 +1,6 @@ -import type { EnvironmentVariable, IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { EnvironmentVariable } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import type { IDataObject } from 'n8n-workflow'; export async function getVariables(context: IRestApiContext): Promise { diff --git a/packages/frontend/editor-ui/src/api/evaluation.ee.ts b/packages/frontend/editor-ui/src/api/evaluation.ee.ts index f38a0c3321..5d6dbead02 100644 --- a/packages/frontend/editor-ui/src/api/evaluation.ee.ts +++ b/packages/frontend/editor-ui/src/api/evaluation.ee.ts @@ -1,5 +1,5 @@ -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest, request } from '@/utils/apiUtils'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest, request } from '@n8n/rest-api-client'; export interface TestRunRecord { id: string; diff --git a/packages/frontend/editor-ui/src/api/externalSecrets.ee.ts b/packages/frontend/editor-ui/src/api/externalSecrets.ee.ts index fb8cac9d77..9b01310f1b 100644 --- a/packages/frontend/editor-ui/src/api/externalSecrets.ee.ts +++ b/packages/frontend/editor-ui/src/api/externalSecrets.ee.ts @@ -1,5 +1,6 @@ -import type { IRestApiContext, ExternalSecretsProvider } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { ExternalSecretsProvider } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; export const getExternalSecrets = async ( context: IRestApiContext, diff --git a/packages/frontend/editor-ui/src/api/invitation.ts b/packages/frontend/editor-ui/src/api/invitation.ts index f2c7c4c8e0..9e4d34aec2 100644 --- a/packages/frontend/editor-ui/src/api/invitation.ts +++ b/packages/frontend/editor-ui/src/api/invitation.ts @@ -1,11 +1,7 @@ -import type { - CurrentUserResponse, - IInviteResponse, - IRestApiContext, - InvitableRoleName, -} from '@/Interface'; +import type { CurrentUserResponse, IInviteResponse, InvitableRoleName } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; import type { IDataObject } from 'n8n-workflow'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; type AcceptInvitationParams = { inviterId: string; diff --git a/packages/frontend/editor-ui/src/api/ldap.ts b/packages/frontend/editor-ui/src/api/ldap.ts index 7f1e4bbd69..2665d257d7 100644 --- a/packages/frontend/editor-ui/src/api/ldap.ts +++ b/packages/frontend/editor-ui/src/api/ldap.ts @@ -1,5 +1,6 @@ -import type { ILdapConfig, ILdapSyncData, IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { ILdapConfig, ILdapSyncData } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import type { IDataObject } from 'n8n-workflow'; export async function getLdapConfig(context: IRestApiContext): Promise { diff --git a/packages/frontend/editor-ui/src/api/projects.api.ts b/packages/frontend/editor-ui/src/api/projects.api.ts index 28e4f8abf7..61516f8d51 100644 --- a/packages/frontend/editor-ui/src/api/projects.api.ts +++ b/packages/frontend/editor-ui/src/api/projects.api.ts @@ -1,5 +1,5 @@ -import type { IRestApiContext } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import type { Project, ProjectListItem, ProjectsCount } from '@/types/projects.types'; import type { CreateProjectDto, UpdateProjectDto } from '@n8n/api-types'; diff --git a/packages/frontend/editor-ui/src/api/schemaPreview.test.ts b/packages/frontend/editor-ui/src/api/schemaPreview.test.ts index af72beeaf7..cf14e21413 100644 --- a/packages/frontend/editor-ui/src/api/schemaPreview.test.ts +++ b/packages/frontend/editor-ui/src/api/schemaPreview.test.ts @@ -1,7 +1,7 @@ import { getSchemaPreview } from './schemaPreview'; -import * as apiUtils from '@/utils/apiUtils'; +import * as apiUtils from '@n8n/rest-api-client'; -vi.mock('@/utils/apiUtils'); +vi.mock('@n8n/rest-api-client'); describe('API: schemaPreview', () => { describe('getSchemaPreview', () => { diff --git a/packages/frontend/editor-ui/src/api/schemaPreview.ts b/packages/frontend/editor-ui/src/api/schemaPreview.ts index ef6fb5e66c..2ba09f6848 100644 --- a/packages/frontend/editor-ui/src/api/schemaPreview.ts +++ b/packages/frontend/editor-ui/src/api/schemaPreview.ts @@ -1,4 +1,4 @@ -import { request } from '@/utils/apiUtils'; +import { request } from '@n8n/rest-api-client'; import type { JSONSchema7 } from 'json-schema'; import type { NodeParameterValueType } from 'n8n-workflow'; import { isEmpty } from '@/utils/typesUtils'; diff --git a/packages/frontend/editor-ui/src/api/settings.ts b/packages/frontend/editor-ui/src/api/settings.ts index f26703a1a4..cd23035921 100644 --- a/packages/frontend/editor-ui/src/api/settings.ts +++ b/packages/frontend/editor-ui/src/api/settings.ts @@ -1,5 +1,6 @@ -import type { IRestApiContext, IN8nPrompts, IN8nPromptResponse } from '../Interface'; -import { makeRestApiRequest, get, post } from '@/utils/apiUtils'; +import type { IN8nPrompts, IN8nPromptResponse } from '../Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest, get, post } from '@n8n/rest-api-client'; import { N8N_IO_BASE_URL, NPM_COMMUNITY_NODE_SEARCH_API_URL } from '@/constants'; import type { FrontendSettings } from '@n8n/api-types'; diff --git a/packages/frontend/editor-ui/src/api/sourceControl.ts b/packages/frontend/editor-ui/src/api/sourceControl.ts index 4553856928..f372d766ac 100644 --- a/packages/frontend/editor-ui/src/api/sourceControl.ts +++ b/packages/frontend/editor-ui/src/api/sourceControl.ts @@ -3,14 +3,14 @@ import type { PushWorkFolderRequestDto, SourceControlledFile, } from '@n8n/api-types'; -import type { IRestApiContext } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; import type { SourceControlPreferences, SourceControlStatus, SshKeyTypes, } from '@/types/sourceControl.types'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import type { TupleToUnion } from '@/utils/typeHelpers'; const sourceControlApiRoot = '/source-control'; diff --git a/packages/frontend/editor-ui/src/api/sso.ts b/packages/frontend/editor-ui/src/api/sso.ts index 050238ce5c..1ec52a4c8f 100644 --- a/packages/frontend/editor-ui/src/api/sso.ts +++ b/packages/frontend/editor-ui/src/api/sso.ts @@ -1,6 +1,7 @@ import type { SamlPreferences, SamlToggleDto } from '@n8n/api-types'; -import { makeRestApiRequest } from '@/utils/apiUtils'; -import type { IRestApiContext, SamlPreferencesExtractedData } from '@/Interface'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; +import type { SamlPreferencesExtractedData } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; export const initSSO = async (context: IRestApiContext, redirectUrl = ''): Promise => { return await makeRestApiRequest(context, 'GET', `/sso/saml/initsso?redirect=${redirectUrl}`); diff --git a/packages/frontend/editor-ui/src/api/tags.ts b/packages/frontend/editor-ui/src/api/tags.ts index d85f84cb5d..894a1b35e6 100644 --- a/packages/frontend/editor-ui/src/api/tags.ts +++ b/packages/frontend/editor-ui/src/api/tags.ts @@ -1,5 +1,6 @@ -import type { IRestApiContext, ITag } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { ITag } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import type { CreateOrUpdateTagRequestDto, RetrieveTagQueryDto } from '@n8n/api-types'; type TagsApiEndpoint = '/tags' | '/annotation-tags'; diff --git a/packages/frontend/editor-ui/src/api/templates.ts b/packages/frontend/editor-ui/src/api/templates.ts index 3e14b98a13..b953a6bf16 100644 --- a/packages/frontend/editor-ui/src/api/templates.ts +++ b/packages/frontend/editor-ui/src/api/templates.ts @@ -9,7 +9,7 @@ import type { IWorkflowTemplate, TemplateSearchFacet, } from '@/Interface'; -import { get } from '@/utils/apiUtils'; +import { get } from '@n8n/rest-api-client'; function stringifyArray(arr: string[]) { return arr.join(','); diff --git a/packages/frontend/editor-ui/src/api/usage.ts b/packages/frontend/editor-ui/src/api/usage.ts index 274175b99e..f5682b00cd 100644 --- a/packages/frontend/editor-ui/src/api/usage.ts +++ b/packages/frontend/editor-ui/src/api/usage.ts @@ -1,6 +1,7 @@ import type { CommunityRegisteredRequestDto } from '@n8n/api-types'; -import { makeRestApiRequest } from '@/utils/apiUtils'; -import type { IRestApiContext, UsageState } from '@/Interface'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; +import type { UsageState } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; export const getLicense = async (context: IRestApiContext): Promise => { return await makeRestApiRequest(context, 'GET', '/license'); diff --git a/packages/frontend/editor-ui/src/api/users.ts b/packages/frontend/editor-ui/src/api/users.ts index dff84242b5..e4cc851f36 100644 --- a/packages/frontend/editor-ui/src/api/users.ts +++ b/packages/frontend/editor-ui/src/api/users.ts @@ -7,12 +7,12 @@ import type { import type { CurrentUserResponse, IPersonalizationLatestVersion, - IRestApiContext, IUserResponse, InvitableRoleName, } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; import type { IDataObject, IUserSettings } from 'n8n-workflow'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; export async function loginCurrentUser( context: IRestApiContext, diff --git a/packages/frontend/editor-ui/src/api/versions.ts b/packages/frontend/editor-ui/src/api/versions.ts index 307688052b..da9a55b21c 100644 --- a/packages/frontend/editor-ui/src/api/versions.ts +++ b/packages/frontend/editor-ui/src/api/versions.ts @@ -1,6 +1,6 @@ import type { IVersion } from '@/Interface'; import { INSTANCE_ID_HEADER } from '@/constants'; -import { get } from '@/utils/apiUtils'; +import { get } from '@n8n/rest-api-client'; export async function getNextVersions( endpoint: string, diff --git a/packages/frontend/editor-ui/src/api/workflow-webhooks.ts b/packages/frontend/editor-ui/src/api/workflow-webhooks.ts index c90ca0964a..54eef42f3c 100644 --- a/packages/frontend/editor-ui/src/api/workflow-webhooks.ts +++ b/packages/frontend/editor-ui/src/api/workflow-webhooks.ts @@ -1,5 +1,5 @@ import type { IUser } from '@/Interface'; -import { post } from '@/utils/apiUtils'; +import { post } from '@n8n/rest-api-client'; const N8N_API_BASE_URL = 'https://api.n8n.io/api'; const CONTACT_EMAIL_SUBMISSION_ENDPOINT = '/accounts/onboarding'; diff --git a/packages/frontend/editor-ui/src/api/workflowHistory.ts b/packages/frontend/editor-ui/src/api/workflowHistory.ts index 29ce265544..390225b46c 100644 --- a/packages/frontend/editor-ui/src/api/workflowHistory.ts +++ b/packages/frontend/editor-ui/src/api/workflowHistory.ts @@ -1,5 +1,5 @@ -import type { IRestApiContext } from '@/Interface'; -import { get } from '@/utils/apiUtils'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { get } from '@n8n/rest-api-client'; import type { WorkflowHistory, WorkflowVersion, diff --git a/packages/frontend/editor-ui/src/api/workflows.ee.ts b/packages/frontend/editor-ui/src/api/workflows.ee.ts index 93a1e8f679..3b679d1e09 100644 --- a/packages/frontend/editor-ui/src/api/workflows.ee.ts +++ b/packages/frontend/editor-ui/src/api/workflows.ee.ts @@ -1,6 +1,7 @@ import type { TransferWorkflowBodyDto } from '@n8n/api-types'; -import type { IRestApiContext, IShareWorkflowsPayload, IWorkflowsShareResponse } from '@/Interface'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import type { IShareWorkflowsPayload, IWorkflowsShareResponse } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import type { IDataObject } from 'n8n-workflow'; export async function setWorkflowSharedWith( diff --git a/packages/frontend/editor-ui/src/api/workflows.ts b/packages/frontend/editor-ui/src/api/workflows.ts index d25019d2f1..c145536cf8 100644 --- a/packages/frontend/editor-ui/src/api/workflows.ts +++ b/packages/frontend/editor-ui/src/api/workflows.ts @@ -4,19 +4,19 @@ import type { FolderTreeResponseItem, IExecutionResponse, IExecutionsCurrentSummaryExtended, - IRestApiContext, IUsedCredential, IWorkflowDb, NewWorkflowResponse, WorkflowListResource, } from '@/Interface'; +import type { IRestApiContext } from '@n8n/rest-api-client'; import type { ExecutionFilters, ExecutionOptions, ExecutionSummary, IDataObject, } from 'n8n-workflow'; -import { getFullApiResponse, makeRestApiRequest } from '@/utils/apiUtils'; +import { getFullApiResponse, makeRestApiRequest } from '@n8n/rest-api-client'; export async function getNewWorkflow(context: IRestApiContext, data?: IDataObject) { const response = await makeRestApiRequest( diff --git a/packages/frontend/editor-ui/src/components/BecomeTemplateCreatorCta/becomeTemplateCreatorStore.ts b/packages/frontend/editor-ui/src/components/BecomeTemplateCreatorCta/becomeTemplateCreatorStore.ts index e122259f44..a7c2f6c686 100644 --- a/packages/frontend/editor-ui/src/components/BecomeTemplateCreatorCta/becomeTemplateCreatorStore.ts +++ b/packages/frontend/editor-ui/src/components/BecomeTemplateCreatorCta/becomeTemplateCreatorStore.ts @@ -5,7 +5,7 @@ import { STORES } from '@n8n/stores'; import { useCloudPlanStore } from '@/stores/cloudPlan.store'; import { useStorage } from '@/composables/useStorage'; import { useRootStore } from '@n8n/stores/useRootStore'; -import { getBecomeCreatorCta } from '@/api/ctas'; +import { getBecomeCreatorCta } from '@n8n/rest-api-client/api/ctas'; const LOCAL_STORAGE_KEY = 'N8N_BECOME_TEMPLATE_CREATOR_CTA_DISMISSED_AT'; const RESHOW_DISMISSED_AFTER_DAYS = 30; diff --git a/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.test.ts b/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.test.ts index 89896dcb93..27e5deaf26 100644 --- a/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.test.ts +++ b/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.test.ts @@ -14,7 +14,7 @@ import { useTagsStore } from '@/stores/tags.store'; import { useUIStore } from '@/stores/ui.store'; import { createTestNode, createTestWorkflow } from '@/__tests__/mocks'; import { WEBHOOK_NODE_TYPE, type AssignmentCollectionValue } from 'n8n-workflow'; -import * as apiWebhooks from '../api/webhooks'; +import * as apiWebhooks from '@n8n/rest-api-client/api/webhooks'; import { mockedStore } from '@/__tests__/utils'; import { nodeTypes } from '@/components/CanvasChat/__test__/data'; import { useNodeTypesStore } from '@/stores/nodeTypes.store'; diff --git a/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.ts b/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.ts index 66d3c0105a..0ed15e9bda 100644 --- a/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.ts +++ b/packages/frontend/editor-ui/src/composables/useWorkflowHelpers.ts @@ -69,7 +69,7 @@ import { useTelemetry } from '@/composables/useTelemetry'; import { useProjectsStore } from '@/stores/projects.store'; import { useTagsStore } from '@/stores/tags.store'; import { useWorkflowsEEStore } from '@/stores/workflows.ee.store'; -import { findWebhook } from '../api/webhooks'; +import { findWebhook } from '@n8n/rest-api-client/api/webhooks'; export type ResolveParameterOptions = { targetItem?: TargetItem; diff --git a/packages/frontend/editor-ui/src/constants.ts b/packages/frontend/editor-ui/src/constants.ts index cc6756fc3b..6d605bcb07 100644 --- a/packages/frontend/editor-ui/src/constants.ts +++ b/packages/frontend/editor-ui/src/constants.ts @@ -919,8 +919,6 @@ export const IsInPiPWindowSymbol = 'IsInPipWindow' as unknown as InjectionKey< >; /** Auth */ -export const BROWSER_ID_STORAGE_KEY = 'n8n-browserId'; - export const APP_MODALS_ELEMENT_ID = 'app-modals'; export const AI_NODES_PACKAGE_NAME = '@n8n/n8n-nodes-langchain'; diff --git a/packages/frontend/editor-ui/src/features/insights/insights.api.ts b/packages/frontend/editor-ui/src/features/insights/insights.api.ts index 8ab3da1387..0222113b8c 100644 --- a/packages/frontend/editor-ui/src/features/insights/insights.api.ts +++ b/packages/frontend/editor-ui/src/features/insights/insights.api.ts @@ -1,5 +1,5 @@ -import { makeRestApiRequest } from '@/utils/apiUtils'; -import type { IRestApiContext } from '@/Interface'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; +import type { IRestApiContext } from '@n8n/rest-api-client'; import type { InsightsSummary, InsightsByTime, diff --git a/packages/frontend/editor-ui/src/plugins/sentry.test.ts b/packages/frontend/editor-ui/src/plugins/sentry.test.ts index b8425647a2..71bd211a4d 100644 --- a/packages/frontend/editor-ui/src/plugins/sentry.test.ts +++ b/packages/frontend/editor-ui/src/plugins/sentry.test.ts @@ -1,7 +1,7 @@ import type * as Sentry from '@sentry/vue'; import { beforeSend } from '@/plugins/sentry'; import { AxiosError } from 'axios'; -import { ResponseError } from '@/utils/apiUtils'; +import { ResponseError } from '@n8n/rest-api-client'; function createErrorEvent(): Sentry.ErrorEvent { return {} as Sentry.ErrorEvent; diff --git a/packages/frontend/editor-ui/src/plugins/sentry.ts b/packages/frontend/editor-ui/src/plugins/sentry.ts index 07298ff658..826770c3e2 100644 --- a/packages/frontend/editor-ui/src/plugins/sentry.ts +++ b/packages/frontend/editor-ui/src/plugins/sentry.ts @@ -1,6 +1,6 @@ import type { Plugin } from 'vue'; import { AxiosError } from 'axios'; -import { ResponseError } from '@/utils/apiUtils'; +import { ResponseError } from '@n8n/rest-api-client'; import * as Sentry from '@sentry/vue'; const ignoredErrors = [ diff --git a/packages/frontend/editor-ui/src/stores/apiKeys.store.ts b/packages/frontend/editor-ui/src/stores/apiKeys.store.ts index 6f01df0c8a..8b5e2d69d0 100644 --- a/packages/frontend/editor-ui/src/stores/apiKeys.store.ts +++ b/packages/frontend/editor-ui/src/stores/apiKeys.store.ts @@ -2,7 +2,7 @@ import { STORES } from '@n8n/stores'; import { defineStore } from 'pinia'; import { useRootStore } from '@n8n/stores/useRootStore'; -import * as publicApiApi from '@/api/api-keys'; +import * as publicApiApi from '@n8n/rest-api-client/api/api-keys'; import { computed, ref } from 'vue'; import type { ApiKey, CreateApiKeyRequestDto, UpdateApiKeyRequestDto } from '@n8n/api-types'; import type { ApiKeyScope } from '@n8n/permissions'; diff --git a/packages/frontend/editor-ui/src/stores/communityNodes.store.ts b/packages/frontend/editor-ui/src/stores/communityNodes.store.ts index 4811eae472..4aa67ae025 100644 --- a/packages/frontend/editor-ui/src/stores/communityNodes.store.ts +++ b/packages/frontend/editor-ui/src/stores/communityNodes.store.ts @@ -1,4 +1,4 @@ -import * as communityNodesApi from '@/api/communityNodes'; +import * as communityNodesApi from '@n8n/rest-api-client/api/communityNodes'; import { getAvailableCommunityPackageCount } from '@/api/settings'; import { defineStore } from 'pinia'; import { useRootStore } from '@n8n/stores/useRootStore'; diff --git a/packages/frontend/editor-ui/src/stores/credentials.store.ts b/packages/frontend/editor-ui/src/stores/credentials.store.ts index 2a550e1549..340ca13f65 100644 --- a/packages/frontend/editor-ui/src/stores/credentials.store.ts +++ b/packages/frontend/editor-ui/src/stores/credentials.store.ts @@ -13,7 +13,7 @@ import { EnterpriseEditionFeature } from '@/constants'; import { STORES } from '@n8n/stores'; import { i18n } from '@n8n/i18n'; import type { ProjectSharingData } from '@/types/projects.types'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import { getAppNameFromCredType } from '@/utils/nodeTypesUtils'; import { splitName } from '@/utils/projects.utils'; import { isEmpty, isPresent } from '@/utils/typesUtils'; diff --git a/packages/frontend/editor-ui/src/stores/executions.store.test.ts b/packages/frontend/editor-ui/src/stores/executions.store.test.ts index e4f27bb97e..661144ea08 100644 --- a/packages/frontend/editor-ui/src/stores/executions.store.test.ts +++ b/packages/frontend/editor-ui/src/stores/executions.store.test.ts @@ -4,7 +4,7 @@ import { setActivePinia, createPinia } from 'pinia'; import type { ExecutionSummaryWithScopes } from '@/Interface'; import { useExecutionsStore } from '@/stores/executions.store'; -vi.mock('@/utils/apiUtils', () => ({ +vi.mock('@n8n/rest-api-client', () => ({ makeRestApiRequest: vi.fn(), })); diff --git a/packages/frontend/editor-ui/src/stores/executions.store.ts b/packages/frontend/editor-ui/src/stores/executions.store.ts index ddf31e59b6..da2fe08fb3 100644 --- a/packages/frontend/editor-ui/src/stores/executions.store.ts +++ b/packages/frontend/editor-ui/src/stores/executions.store.ts @@ -12,7 +12,8 @@ import type { IExecutionsStopData, } from '@/Interface'; import { useRootStore } from '@n8n/stores/useRootStore'; -import { makeRestApiRequest, unflattenExecutionData } from '@/utils/apiUtils'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; +import { unflattenExecutionData } from '@/utils/executionUtils'; import { executionFilterToQueryFilter, getDefaultExecutionFilters } from '@/utils/executionUtils'; import { useProjectsStore } from '@/stores/projects.store'; import { useSettingsStore } from '@/stores/settings.store'; diff --git a/packages/frontend/editor-ui/src/stores/logStreaming.store.ts b/packages/frontend/editor-ui/src/stores/logStreaming.store.ts index c06d368916..8116075e5b 100644 --- a/packages/frontend/editor-ui/src/stores/logStreaming.store.ts +++ b/packages/frontend/editor-ui/src/stores/logStreaming.store.ts @@ -7,7 +7,7 @@ import { hasDestinationId, saveDestinationToDb, sendTestMessageToDestination, -} from '@/api/eventbus.ee'; +} from '@n8n/rest-api-client/api/eventbus.ee'; import { useRootStore } from '@n8n/stores/useRootStore'; import { ref } from 'vue'; diff --git a/packages/frontend/editor-ui/src/stores/nodeTypes.store.ts b/packages/frontend/editor-ui/src/stores/nodeTypes.store.ts index c4a550cd1d..0617a29f44 100644 --- a/packages/frontend/editor-ui/src/stores/nodeTypes.store.ts +++ b/packages/frontend/editor-ui/src/stores/nodeTypes.store.ts @@ -5,7 +5,7 @@ import type { ResourceLocatorRequestDto, ResourceMapperFieldsRequestDto, } from '@n8n/api-types'; -import * as nodeTypesApi from '@/api/nodeTypes'; +import * as nodeTypesApi from '@n8n/rest-api-client/api/nodeTypes'; import { HTTP_REQUEST_NODE_TYPE, CREDENTIAL_ONLY_HTTP_NODE_VERSION } from '@/constants'; import { STORES } from '@n8n/stores'; import type { NodeTypesByTypeNameAndVersion } from '@/Interface'; diff --git a/packages/frontend/editor-ui/src/stores/npsStore.store.test.ts b/packages/frontend/editor-ui/src/stores/npsStore.store.test.ts index 141109cc28..75e2e78222 100644 --- a/packages/frontend/editor-ui/src/stores/npsStore.store.test.ts +++ b/packages/frontend/editor-ui/src/stores/npsStore.store.test.ts @@ -16,7 +16,7 @@ vi.mock('@/stores/ui.store', () => ({ })), })); -vi.mock('@/api/npsSurvey', () => ({ +vi.mock('@n8n/rest-api-client/api/npsSurvey', () => ({ updateNpsSurveyState, })); diff --git a/packages/frontend/editor-ui/src/stores/npsSurvey.store.ts b/packages/frontend/editor-ui/src/stores/npsSurvey.store.ts index 3930a424f3..3901629e2e 100644 --- a/packages/frontend/editor-ui/src/stores/npsSurvey.store.ts +++ b/packages/frontend/editor-ui/src/stores/npsSurvey.store.ts @@ -11,7 +11,7 @@ import { import { useRootStore } from '@n8n/stores/useRootStore'; import type { IUserSettings, NpsSurveyState } from 'n8n-workflow'; import { useSettingsStore } from './settings.store'; -import { updateNpsSurveyState } from '@/api/npsSurvey'; +import { updateNpsSurveyState } from '@n8n/rest-api-client/api/npsSurvey'; import type { IN8nPrompts } from '@/Interface'; import { getPromptsData } from '@/api/settings'; import { assert } from '@n8n/utils/assert'; diff --git a/packages/frontend/editor-ui/src/stores/orchestration.store.ts b/packages/frontend/editor-ui/src/stores/orchestration.store.ts index 21dd22198b..31937da317 100644 --- a/packages/frontend/editor-ui/src/stores/orchestration.store.ts +++ b/packages/frontend/editor-ui/src/stores/orchestration.store.ts @@ -2,7 +2,7 @@ import { defineStore } from 'pinia'; import type { WorkerStatus } from '@n8n/api-types'; import { useRootStore } from '@n8n/stores/useRootStore'; -import { sendGetWorkerStatus } from '../api/orchestration'; +import { sendGetWorkerStatus } from '@n8n/rest-api-client/api/orchestration'; export const WORKER_HISTORY_LENGTH = 100; const STALE_SECONDS = 120 * 1000; diff --git a/packages/frontend/editor-ui/src/stores/roles.store.test.ts b/packages/frontend/editor-ui/src/stores/roles.store.test.ts index e38ef4d434..906442330f 100644 --- a/packages/frontend/editor-ui/src/stores/roles.store.test.ts +++ b/packages/frontend/editor-ui/src/stores/roles.store.test.ts @@ -1,5 +1,5 @@ import { useRolesStore } from '@/stores/roles.store'; -import * as rolesApi from '@/api/roles.api'; +import * as rolesApi from '@n8n/rest-api-client/api/roles'; import { createPinia, setActivePinia } from 'pinia'; let rolesStore: ReturnType; diff --git a/packages/frontend/editor-ui/src/stores/roles.store.ts b/packages/frontend/editor-ui/src/stores/roles.store.ts index c5c64aa43c..cff0924663 100644 --- a/packages/frontend/editor-ui/src/stores/roles.store.ts +++ b/packages/frontend/editor-ui/src/stores/roles.store.ts @@ -1,7 +1,7 @@ import type { ProjectRole, AllRolesMap } from '@n8n/permissions'; import { defineStore } from 'pinia'; import { ref, computed } from 'vue'; -import * as rolesApi from '@/api/roles.api'; +import * as rolesApi from '@n8n/rest-api-client/api/roles'; import { useRootStore } from '@n8n/stores/useRootStore'; export const useRolesStore = defineStore('roles', () => { diff --git a/packages/frontend/editor-ui/src/stores/settings.store.test.ts b/packages/frontend/editor-ui/src/stores/settings.store.test.ts index fb77ec15fd..d6c0f35ad4 100644 --- a/packages/frontend/editor-ui/src/stores/settings.store.test.ts +++ b/packages/frontend/editor-ui/src/stores/settings.store.test.ts @@ -17,7 +17,7 @@ vi.mock('@/api/settings', () => ({ getSettings, })); -vi.mock('@/api/events', () => ({ +vi.mock('@n8n/rest-api-client/api/events', () => ({ sessionStarted, })); diff --git a/packages/frontend/editor-ui/src/stores/settings.store.ts b/packages/frontend/editor-ui/src/stores/settings.store.ts index 9619f5baa0..4735787074 100644 --- a/packages/frontend/editor-ui/src/stores/settings.store.ts +++ b/packages/frontend/editor-ui/src/stores/settings.store.ts @@ -2,7 +2,7 @@ import { computed, ref } from 'vue'; import Bowser from 'bowser'; import type { IUserManagementSettings, FrontendSettings } from '@n8n/api-types'; -import * as eventsApi from '@/api/events'; +import * as eventsApi from '@n8n/rest-api-client/api/events'; import * as ldapApi from '@/api/ldap'; import * as settingsApi from '@/api/settings'; import { testHealthEndpoint } from '@/api/templates'; @@ -19,7 +19,7 @@ import { useRootStore } from '@n8n/stores/useRootStore'; import { useUIStore } from './ui.store'; import { useUsersStore } from './users.store'; import { useVersionsStore } from './versions.store'; -import { makeRestApiRequest } from '@/utils/apiUtils'; +import { makeRestApiRequest } from '@n8n/rest-api-client'; import { useToast } from '@/composables/useToast'; import { useI18n } from '@n8n/i18n'; import { useLocalStorage } from '@vueuse/core'; diff --git a/packages/frontend/editor-ui/src/stores/ui.store.ts b/packages/frontend/editor-ui/src/stores/ui.store.ts index 98edc27037..8b98175de5 100644 --- a/packages/frontend/editor-ui/src/stores/ui.store.ts +++ b/packages/frontend/editor-ui/src/stores/ui.store.ts @@ -59,7 +59,7 @@ import { useRootStore } from '@n8n/stores/useRootStore'; import { useWorkflowsStore } from '@/stores/workflows.store'; import { useSettingsStore } from '@/stores/settings.store'; import { useUsersStore } from '@/stores/users.store'; -import { dismissBannerPermanently } from '@/api/ui'; +import { dismissBannerPermanently } from '@n8n/rest-api-client'; import type { BannerName } from '@n8n/api-types'; import { addThemeToBody, diff --git a/packages/frontend/editor-ui/src/stores/users.store.ts b/packages/frontend/editor-ui/src/stores/users.store.ts index f3de80665a..08758d330c 100644 --- a/packages/frontend/editor-ui/src/stores/users.store.ts +++ b/packages/frontend/editor-ui/src/stores/users.store.ts @@ -6,7 +6,8 @@ import type { } from '@n8n/api-types'; import type { UpdateGlobalRolePayload } from '@/api/users'; import * as usersApi from '@/api/users'; -import { BROWSER_ID_STORAGE_KEY, PERSONALIZATION_MODAL_KEY, ROLE } from '@/constants'; +import { BROWSER_ID_STORAGE_KEY } from '@n8n/constants'; +import { PERSONALIZATION_MODAL_KEY, ROLE } from '@/constants'; import { STORES } from '@n8n/stores'; import type { Cloud, @@ -22,7 +23,7 @@ import { useRootStore } from '@n8n/stores/useRootStore'; import { usePostHog } from './posthog.store'; import { useUIStore } from './ui.store'; import { useCloudPlanStore } from './cloudPlan.store'; -import * as mfaApi from '@/api/mfa'; +import * as mfaApi from '@n8n/rest-api-client/api/mfa'; import * as cloudApi from '@/api/cloudPlans'; import { useRBACStore } from '@/stores/rbac.store'; import type { Scope } from '@n8n/permissions'; diff --git a/packages/frontend/editor-ui/src/stores/workflows.store.test.ts b/packages/frontend/editor-ui/src/stores/workflows.store.test.ts index da1ffde2e8..72e742a174 100644 --- a/packages/frontend/editor-ui/src/stores/workflows.store.test.ts +++ b/packages/frontend/editor-ui/src/stores/workflows.store.test.ts @@ -27,7 +27,7 @@ import { flushPromises } from '@vue/test-utils'; import { useNDVStore } from '@/stores/ndv.store'; import { mock } from 'vitest-mock-extended'; import { mockedStore, type MockedStore } from '@/__tests__/utils'; -import * as apiUtils from '@/utils/apiUtils'; +import * as apiUtils from '@n8n/rest-api-client'; import { useSettingsStore } from '@/stores/settings.store'; import { useLocalStorage } from '@vueuse/core'; import { ref } from 'vue'; diff --git a/packages/frontend/editor-ui/src/stores/workflows.store.ts b/packages/frontend/editor-ui/src/stores/workflows.store.ts index adde6880e6..d442afe1dd 100644 --- a/packages/frontend/editor-ui/src/stores/workflows.store.ts +++ b/packages/frontend/editor-ui/src/stores/workflows.store.ts @@ -75,7 +75,8 @@ import { dataPinningEventBus } from '@/event-bus'; import { isObject } from '@/utils/objectUtils'; import { getPairedItemsMapping } from '@/utils/pairedItemUtils'; import { isJsonKeyObject, isEmpty, stringSizeInBytes, isPresent } from '@/utils/typesUtils'; -import { makeRestApiRequest, unflattenExecutionData, ResponseError } from '@/utils/apiUtils'; +import { makeRestApiRequest, ResponseError } from '@n8n/rest-api-client'; +import { unflattenExecutionData } from '@/utils/executionUtils'; import { useNDVStore } from '@/stores/ndv.store'; import { useNodeTypesStore } from '@/stores/nodeTypes.store'; import { getCredentialOnlyNodeTypeName } from '@/utils/credentialOnlyNodes'; diff --git a/packages/frontend/editor-ui/src/utils/executionUtils.ts b/packages/frontend/editor-ui/src/utils/executionUtils.ts index 2e922e8ed6..3afd6f2146 100644 --- a/packages/frontend/editor-ui/src/utils/executionUtils.ts +++ b/packages/frontend/editor-ui/src/utils/executionUtils.ts @@ -8,7 +8,13 @@ import type { IRunData, ExecutionError, } from 'n8n-workflow'; -import type { ExecutionFilterType, ExecutionsQueryFilter, INodeUi } from '@/Interface'; +import type { + ExecutionFilterType, + ExecutionsQueryFilter, + IExecutionFlattedResponse, + IExecutionResponse, + INodeUi, +} from '@/Interface'; import { isEmpty } from '@/utils/typesUtils'; import { FORM_NODE_TYPE, FORM_TRIGGER_NODE_TYPE, GITHUB_NODE_TYPE } from '../constants'; import { useWorkflowsStore } from '@/stores/workflows.store'; @@ -16,6 +22,7 @@ import { useRootStore } from '@n8n/stores/useRootStore'; import { i18n } from '@n8n/i18n'; import { h } from 'vue'; import NodeExecutionErrorMessage from '@/components/NodeExecutionErrorMessage.vue'; +import { parse } from 'flatted'; export function getDefaultExecutionFilters(): ExecutionFilterType { return { @@ -356,3 +363,25 @@ export function getExecutionErrorToastConfiguration({ message, }; } + +/** + * Unflattens the Execution data. + * + * @param {IExecutionFlattedResponse} fullExecutionData The data to unflatten + */ +export function unflattenExecutionData(fullExecutionData: IExecutionFlattedResponse) { + // Unflatten the data + const returnData: IExecutionResponse = { + ...fullExecutionData, + workflowData: fullExecutionData.workflowData, + data: parse(fullExecutionData.data), + }; + + returnData.finished = returnData.finished ? returnData.finished : false; + + if (fullExecutionData.id) { + returnData.id = fullExecutionData.id; + } + + return returnData; +} diff --git a/packages/frontend/editor-ui/src/views/WorkflowExecutionsView.vue b/packages/frontend/editor-ui/src/views/WorkflowExecutionsView.vue index 9f9650878b..ff8a4e809a 100644 --- a/packages/frontend/editor-ui/src/views/WorkflowExecutionsView.vue +++ b/packages/frontend/editor-ui/src/views/WorkflowExecutionsView.vue @@ -6,7 +6,7 @@ import { useI18n } from '@n8n/i18n'; import type { ExecutionFilterType, IWorkflowDb } from '@/Interface'; import { useWorkflowsStore } from '@/stores/workflows.store'; import { useNodeTypesStore } from '@/stores/nodeTypes.store'; -import { NO_NETWORK_ERROR_CODE } from '@/utils/apiUtils'; +import { NO_NETWORK_ERROR_CODE } from '@n8n/rest-api-client'; import { useToast } from '@/composables/useToast'; import { NEW_WORKFLOW_ID, PLACEHOLDER_EMPTY_WORKFLOW_ID, VIEWS } from '@/constants'; import { useRoute, useRouter } from 'vue-router'; diff --git a/packages/frontend/editor-ui/tsconfig.json b/packages/frontend/editor-ui/tsconfig.json index 6b71f7d7b0..009ac7eeba 100644 --- a/packages/frontend/editor-ui/tsconfig.json +++ b/packages/frontend/editor-ui/tsconfig.json @@ -2,7 +2,13 @@ "extends": "@n8n/typescript-config/tsconfig.frontend.json", "compilerOptions": { "baseUrl": ".", - "rootDirs": [".", "../@n8n/composables/src", "../@n8n/chat/src", "../@n8n/design-system/src"], + "rootDirs": [ + ".", + "../@n8n/rest-api-client/src", + "../@n8n/composables/src", + "../@n8n/chat/src", + "../@n8n/design-system/src" + ], "outDir": "dist", "types": [ "vitest/globals", @@ -11,7 +17,9 @@ ], "paths": { "@/*": ["./src/*"], + "@n8n/rest-api-client*": ["../@n8n/rest-api-client/src*"], "@n8n/composables*": ["../@n8n/composables/src*"], + "@n8n/constants*": ["../../@n8n/constants/src*"], "@n8n/chat*": ["../@n8n/chat/src*"], "@n8n/design-system*": ["../@n8n/design-system/src*"], "@n8n/i18n*": ["../@n8n/i18n/src*"], diff --git a/packages/frontend/editor-ui/vite.config.mts b/packages/frontend/editor-ui/vite.config.mts index abdfd9eec3..a666676939 100644 --- a/packages/frontend/editor-ui/vite.config.mts +++ b/packages/frontend/editor-ui/vite.config.mts @@ -27,10 +27,18 @@ const alias = [ find: /^@n8n\/chat(.+)$/, replacement: resolve(packagesDir, 'frontend', '@n8n', 'chat', 'src$1'), }, + { + find: /^@n8n\/api-requests(.+)$/, + replacement: resolve(packagesDir, 'frontend', '@n8n', 'api-requests', 'src$1'), + }, { find: /^@n8n\/composables(.+)$/, replacement: resolve(packagesDir, 'frontend', '@n8n', 'composables', 'src$1'), }, + { + find: /^@n8n\/constants(.+)$/, + replacement: resolve(packagesDir, '@n8n', 'constants', 'src$1'), + }, { find: /^@n8n\/design-system(.+)$/, replacement: resolve(packagesDir, 'frontend', '@n8n', 'design-system', 'src$1'), diff --git a/packages/workflow/package.json b/packages/workflow/package.json index fe74e4b649..a05ff72ae3 100644 --- a/packages/workflow/package.json +++ b/packages/workflow/package.json @@ -47,7 +47,7 @@ "esprima-next": "5.8.4", "form-data": "catalog:", "jmespath": "0.16.0", - "js-base64": "3.7.2", + "js-base64": "catalog:", "jssha": "3.3.1", "lodash": "catalog:", "luxon": "catalog:", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1f45a71409..31d8ecda54 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,6 +66,9 @@ catalogs: iconv-lite: specifier: 0.6.3 version: 0.6.3 + js-base64: + specifier: 3.7.2 + version: 3.7.2 jsonwebtoken: specifier: 9.0.2 version: 9.0.2 @@ -756,7 +759,7 @@ importers: version: 4.3.0 '@getzep/zep-cloud': specifier: 1.0.12 - version: 1.0.12(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)))(encoding@0.1.13)(langchain@0.3.11(d71d1df33a22803bba4e47303d410a51)) + version: 1.0.12(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)))(encoding@0.1.13)(langchain@0.3.11(a9c8f655d0ec4bd70e0f938ef73f85da)) '@getzep/zep-js': specifier: 0.9.0 version: 0.9.0 @@ -783,7 +786,7 @@ importers: version: 0.3.2(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)))(encoding@0.1.13) '@langchain/community': specifier: 'catalog:' - version: 0.3.24(3a2fa23b4df734da256fae2a3bd4f738) + version: 0.3.24(0f15853497e304ae94801fc86723d997) '@langchain/core': specifier: 'catalog:' version: 0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)) @@ -888,7 +891,7 @@ importers: version: 23.0.1 langchain: specifier: 0.3.11 - version: 0.3.11(d71d1df33a22803bba4e47303d410a51) + version: 0.3.11(a9c8f655d0ec4bd70e0f938ef73f85da) lodash: specifier: 'catalog:' version: 4.17.21 @@ -1945,6 +1948,64 @@ importers: specifier: ^2.2.8 version: 2.2.8(patch_hash=e2aee939ccac8a57fe449bfd92bedd8117841579526217bc39aca26c6b8c317f)(typescript@5.8.2) + packages/frontend/@n8n/rest-api-client: + dependencies: + '@n8n/api-types': + specifier: workspace:* + version: link:../../../@n8n/api-types + '@n8n/constants': + specifier: workspace:* + version: link:../../../@n8n/constants + '@n8n/permissions': + specifier: workspace:* + version: link:../../../@n8n/permissions + '@n8n/utils': + specifier: workspace:* + version: link:../../../@n8n/utils + axios: + specifier: 'catalog:' + version: 1.8.3 + flatted: + specifier: 'catalog:' + version: 3.2.7 + js-base64: + specifier: 'catalog:' + version: 3.7.2 + n8n-workflow: + specifier: workspace:* + version: link:../../../workflow + devDependencies: + '@n8n/eslint-config': + specifier: workspace:* + version: link:../../../@n8n/eslint-config + '@n8n/i18n': + specifier: workspace:* + version: link:../i18n + '@n8n/typescript-config': + specifier: workspace:* + version: link:../../../@n8n/typescript-config + '@n8n/vitest-config': + specifier: workspace:* + version: link:../../../@n8n/vitest-config + '@testing-library/jest-dom': + specifier: catalog:frontend + version: 6.6.3 + '@testing-library/user-event': + specifier: catalog:frontend + version: 14.6.1(@testing-library/dom@10.4.0) + tsup: + specifier: 'catalog:' + version: 8.4.0(@microsoft/api-extractor@7.52.1(@types/node@20.17.57))(jiti@1.21.0)(postcss@8.5.3)(tsx@4.19.3)(typescript@5.8.2) + typescript: + specifier: ^5.8.2 + version: 5.8.2 + vite: + specifier: catalog:frontend + version: 6.3.5(@types/node@20.17.57)(jiti@1.21.0)(sass@1.64.1)(terser@5.16.1)(tsx@4.19.3) + vitest: + specifier: catalog:frontend + version: 3.1.3(@types/debug@4.1.12)(@types/node@20.17.57)(jiti@1.21.0)(jsdom@23.0.1)(sass@1.64.1)(terser@5.16.1)(tsx@4.19.3) + packages/frontend/@n8n/stores: dependencies: n8n-workflow: @@ -2068,6 +2129,9 @@ importers: '@n8n/composables': specifier: workspace:* version: link:../@n8n/composables + '@n8n/constants': + specifier: workspace:* + version: link:../../@n8n/constants '@n8n/design-system': specifier: workspace:* version: link:../@n8n/design-system @@ -2077,6 +2141,9 @@ importers: '@n8n/permissions': specifier: workspace:* version: link:../../@n8n/permissions + '@n8n/rest-api-client': + specifier: workspace:* + version: link:../@n8n/rest-api-client '@n8n/stores': specifier: workspace:* version: link:../@n8n/stores @@ -2675,7 +2742,7 @@ importers: specifier: 0.16.0 version: 0.16.0 js-base64: - specifier: 3.7.2 + specifier: 'catalog:' version: 3.7.2 jssha: specifier: 3.3.1 @@ -4011,15 +4078,9 @@ packages: engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0, npm: '>=6.14.13'} deprecated: Please update to a newer version - '@floating-ui/core@1.3.1': - resolution: {integrity: sha512-Bu+AMaXNjrpjh41znzHqaz3r2Nr8hHuHZT6V2LBKMhyMl0FgKA62PNYbqnfgmzOhoWZj70Zecisbo4H1rotP5g==} - '@floating-ui/core@1.7.0': resolution: {integrity: sha512-FRdBLykrPPA6P76GGGqlex/e7fbe0F1ykgxHYNXQsH/iTEtjMj/f9bpY5oQqbjt5VgZvgz/uKXbGuROijh3VLA==} - '@floating-ui/dom@1.4.5': - resolution: {integrity: sha512-96KnRWkRnuBSSFbj0sFGwwOUd8EkiecINVl0O9wiZlZ64EkpyAOG3Xc2vKKNJmru0Z7RqWNymA+6b8OZqjgyyw==} - '@floating-ui/dom@1.7.0': resolution: {integrity: sha512-lGTor4VlXcesUMh1cupTUTDoCxMb0V6bm3CnxHzQcw8Eaf1jQbgQX4i02fYgT0vJ82tb5MZ4CZk1LRGkktJCzg==} @@ -4375,10 +4436,6 @@ packages: resolution: {integrity: sha512-tPKQNMPuXgvdOn2/Lg9HNfUvjYVGolt04Hp03f5hAk878uwOLikN+JzeLY0HcVgKgFl9Hs3EIqpu3WX27XNhnw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - '@jridgewell/gen-mapping@0.3.5': - resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} - engines: {node: '>=6.0.0'} - '@jridgewell/gen-mapping@0.3.8': resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==} engines: {node: '>=6.0.0'} @@ -8752,10 +8809,6 @@ packages: resolution: {integrity: sha512-j0PupcmELoVbYS2NNrsn5zcLLEsryQwP02x8fRawh7c2eEaPHwJFAxltZsqV7HJjsF57+SMpYyVRWgbVLfOagg==} engines: {node: '>= 0.4'} - es-define-property@1.0.0: - resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} - engines: {node: '>= 0.4'} - es-define-property@1.0.1: resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} engines: {node: '>= 0.4'} @@ -8770,10 +8823,6 @@ packages: es-module-lexer@1.7.0: resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} - es-object-atoms@1.0.0: - resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} - engines: {node: '>= 0.4'} - es-object-atoms@1.1.1: resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} engines: {node: '>= 0.4'} @@ -9567,9 +9616,6 @@ packages: deprecated: Package is no longer maintained hasBin: true - gopd@1.0.1: - resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} - gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} @@ -9614,10 +9660,6 @@ packages: resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} engines: {node: '>= 0.4'} - has-symbols@1.0.3: - resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} - engines: {node: '>= 0.4'} - has-symbols@1.1.0: resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} engines: {node: '>= 0.4'} @@ -14509,7 +14551,7 @@ snapshots: '@ampproject/remapping@2.3.0': dependencies: - '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/gen-mapping': 0.3.8 '@jridgewell/trace-mapping': 0.3.25 '@antfu/install-pkg@0.1.1': @@ -15665,7 +15707,7 @@ snapshots: '@babel/helper-validator-option': 7.25.9 browserslist: 4.24.4 lru-cache: 5.1.1 - semver: 7.6.0 + semver: 7.7.2 '@babel/helper-create-class-features-plugin@7.26.9(@babel/core@7.26.10)': dependencies: @@ -16699,16 +16741,10 @@ snapshots: '@faker-js/faker@8.0.2': {} - '@floating-ui/core@1.3.1': {} - '@floating-ui/core@1.7.0': dependencies: '@floating-ui/utils': 0.2.9 - '@floating-ui/dom@1.4.5': - dependencies: - '@floating-ui/core': 1.3.1 - '@floating-ui/dom@1.7.0': dependencies: '@floating-ui/core': 1.7.0 @@ -16749,7 +16785,7 @@ snapshots: '@gar/promisify@1.1.3': optional: true - '@getzep/zep-cloud@1.0.12(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)))(encoding@0.1.13)(langchain@0.3.11(d71d1df33a22803bba4e47303d410a51))': + '@getzep/zep-cloud@1.0.12(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)))(encoding@0.1.13)(langchain@0.3.11(a9c8f655d0ec4bd70e0f938ef73f85da))': dependencies: form-data: 4.0.0 node-fetch: 2.7.0(encoding@0.1.13) @@ -16758,7 +16794,7 @@ snapshots: zod: 3.24.1 optionalDependencies: '@langchain/core': 0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)) - langchain: 0.3.11(d71d1df33a22803bba4e47303d410a51) + langchain: 0.3.11(a9c8f655d0ec4bd70e0f938ef73f85da) transitivePeerDependencies: - encoding @@ -17181,12 +17217,6 @@ snapshots: '@types/yargs': 17.0.19 chalk: 4.1.2 - '@jridgewell/gen-mapping@0.3.5': - dependencies: - '@jridgewell/set-array': 1.2.1 - '@jridgewell/sourcemap-codec': 1.5.0 - '@jridgewell/trace-mapping': 0.3.25 - '@jridgewell/gen-mapping@0.3.8': dependencies: '@jridgewell/set-array': 1.2.1 @@ -17288,7 +17318,7 @@ snapshots: - aws-crt - encoding - '@langchain/community@0.3.24(3a2fa23b4df734da256fae2a3bd4f738)': + '@langchain/community@0.3.24(0f15853497e304ae94801fc86723d997)': dependencies: '@browserbasehq/stagehand': 1.9.0(@playwright/test@1.49.1)(deepmerge@4.3.1)(dotenv@16.5.0)(encoding@0.1.13)(openai@4.78.1(encoding@0.1.13)(zod@3.24.1))(zod@3.24.1) '@ibm-cloud/watsonx-ai': 1.1.2 @@ -17299,7 +17329,7 @@ snapshots: flat: 5.0.2 ibm-cloud-sdk-core: 5.3.2 js-yaml: 4.1.0 - langchain: 0.3.11(d71d1df33a22803bba4e47303d410a51) + langchain: 0.3.11(a9c8f655d0ec4bd70e0f938ef73f85da) langsmith: 0.2.15(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)) openai: 4.78.1(encoding@0.1.13)(zod@3.24.1) uuid: 10.0.0 @@ -17314,7 +17344,7 @@ snapshots: '@aws-sdk/credential-provider-node': 3.808.0 '@azure/storage-blob': 12.26.0 '@browserbasehq/sdk': 2.6.0(encoding@0.1.13) - '@getzep/zep-cloud': 1.0.12(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)))(encoding@0.1.13)(langchain@0.3.11(d71d1df33a22803bba4e47303d410a51)) + '@getzep/zep-cloud': 1.0.12(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)))(encoding@0.1.13)(langchain@0.3.11(a9c8f655d0ec4bd70e0f938ef73f85da)) '@getzep/zep-js': 0.9.0 '@google-ai/generativelanguage': 2.6.0(encoding@0.1.13) '@google-cloud/storage': 7.12.1(encoding@0.1.13) @@ -20833,14 +20863,6 @@ snapshots: transitivePeerDependencies: - debug - axios@1.9.0: - dependencies: - follow-redirects: 1.15.9(debug@4.3.6) - form-data: 4.0.2 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - axios@1.9.0(debug@4.3.6): dependencies: follow-redirects: 1.15.9(debug@4.3.6) @@ -20859,7 +20881,7 @@ snapshots: axios@1.9.0(debug@4.4.1): dependencies: - follow-redirects: 1.15.9(debug@4.4.1) + follow-redirects: 1.15.9(debug@4.3.6) form-data: 4.0.2 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -20900,7 +20922,7 @@ snapshots: '@babel/compat-data': 7.26.8 '@babel/core': 7.26.10 '@babel/helper-define-polyfill-provider': 0.6.3(@babel/core@7.26.10) - semver: 7.6.0 + semver: 7.7.2 transitivePeerDependencies: - supports-color @@ -21012,7 +21034,7 @@ snapshots: dependencies: bytes: 3.1.2 content-type: 1.0.5 - debug: 4.4.0 + debug: 4.4.1(supports-color@8.1.1) http-errors: 2.0.0 iconv-lite: 0.6.3 on-finished: 2.4.1 @@ -21964,8 +21986,8 @@ snapshots: object-is: 1.1.6 object-keys: 1.1.1 object.assign: 4.1.5 - regexp.prototype.flags: 1.5.2 - side-channel: 1.0.6 + regexp.prototype.flags: 1.5.3 + side-channel: 1.1.0 which-boxed-primitive: 1.0.2 which-collection: 1.0.1 which-typed-array: 1.1.15 @@ -22155,7 +22177,7 @@ snapshots: dependencies: '@ctrl/tinycolor': 3.6.0 '@element-plus/icons-vue': 2.3.1(vue@3.5.13(typescript@5.8.2)) - '@floating-ui/dom': 1.4.5 + '@floating-ui/dom': 1.7.0 '@popperjs/core': '@sxzz/popperjs-es@2.11.7' '@types/lodash': 4.17.17 '@types/lodash-es': 4.17.12 @@ -22289,19 +22311,19 @@ snapshots: data-view-buffer: 1.0.1 data-view-byte-length: 1.0.1 data-view-byte-offset: 1.0.0 - es-define-property: 1.0.0 + es-define-property: 1.0.1 es-errors: 1.3.0 - es-object-atoms: 1.0.0 + es-object-atoms: 1.1.1 es-set-tostringtag: 2.1.0 es-to-primitive: 1.2.1 function.prototype.name: 1.1.6 - get-intrinsic: 1.2.4 + get-intrinsic: 1.3.0 get-symbol-description: 1.0.2 globalthis: 1.0.4 - gopd: 1.0.1 + gopd: 1.2.0 has-property-descriptors: 1.0.2 has-proto: 1.0.3 - has-symbols: 1.0.3 + has-symbols: 1.1.0 hasown: 2.0.2 internal-slot: 1.0.7 is-array-buffer: 3.0.4 @@ -22340,10 +22362,6 @@ snapshots: has-property-descriptors: 1.0.2 set-function-name: 2.0.2 - es-define-property@1.0.0: - dependencies: - get-intrinsic: 1.3.0 - es-define-property@1.0.1: {} es-errors@1.3.0: {} @@ -22362,10 +22380,6 @@ snapshots: es-module-lexer@1.7.0: {} - es-object-atoms@1.0.0: - dependencies: - es-errors: 1.3.0 - es-object-atoms@1.1.1: dependencies: es-errors: 1.3.0 @@ -22986,7 +23000,7 @@ snapshots: finalhandler@2.1.0: dependencies: - debug: 4.4.0 + debug: 4.4.1(supports-color@8.1.1) encodeurl: 2.0.0 escape-html: 1.0.3 on-finished: 2.4.1 @@ -23040,10 +23054,6 @@ snapshots: optionalDependencies: debug: 4.4.0 - follow-redirects@1.15.9(debug@4.4.1): - optionalDependencies: - debug: 4.4.1(supports-color@8.1.1) - for-each@0.3.3: dependencies: is-callable: 1.2.7 @@ -23216,7 +23226,7 @@ snapshots: es-errors: 1.3.0 function-bind: 1.1.2 has-proto: 1.0.3 - has-symbols: 1.0.3 + has-symbols: 1.1.0 hasown: 2.0.2 get-intrinsic@1.3.0: @@ -23412,10 +23422,6 @@ snapshots: dependencies: node-forge: 1.3.1 - gopd@1.0.1: - dependencies: - get-intrinsic: 1.3.0 - gopd@1.2.0: {} graceful-fs@4.2.11: {} @@ -23474,8 +23480,6 @@ snapshots: has-proto@1.0.3: {} - has-symbols@1.0.3: {} - has-symbols@1.1.0: {} has-tostringtag@1.0.2: @@ -23663,7 +23667,7 @@ snapshots: isstream: 0.1.2 jsonwebtoken: 9.0.2 mime-types: 2.1.35 - retry-axios: 2.6.0(axios@1.9.0) + retry-axios: 2.6.0(axios@1.9.0(debug@4.4.1)) tough-cookie: 4.1.4 transitivePeerDependencies: - supports-color @@ -23728,7 +23732,7 @@ snapshots: infisical-node@1.3.0: dependencies: - axios: 1.9.0 + axios: 1.9.0(debug@4.4.1) dotenv: 16.3.1 tweetnacl: 1.0.3 tweetnacl-util: 0.15.1 @@ -24653,7 +24657,7 @@ snapshots: kuler@2.0.0: {} - langchain@0.3.11(d71d1df33a22803bba4e47303d410a51): + langchain@0.3.11(a9c8f655d0ec4bd70e0f938ef73f85da): dependencies: '@langchain/core': 0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)) '@langchain/openai': 0.3.17(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)))(encoding@0.1.13) @@ -24677,7 +24681,7 @@ snapshots: '@langchain/groq': 0.1.3(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1)))(encoding@0.1.13) '@langchain/mistralai': 0.2.0(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1))) '@langchain/ollama': 0.1.4(@langchain/core@0.3.39(openai@4.78.1(encoding@0.1.13)(zod@3.24.1))) - axios: 1.9.0 + axios: 1.9.0(debug@4.4.1) cheerio: 1.0.0 handlebars: 4.7.8 transitivePeerDependencies: @@ -25734,7 +25738,7 @@ snapshots: node-abi@3.54.0: dependencies: - semver: 7.6.0 + semver: 7.7.2 node-abort-controller@3.1.1: {} @@ -26462,7 +26466,7 @@ snapshots: posthog-node@3.2.1: dependencies: - axios: 1.9.0 + axios: 1.9.0(debug@4.4.1) rusha: 0.8.14 transitivePeerDependencies: - debug @@ -27039,9 +27043,9 @@ snapshots: onetime: 5.1.2 signal-exit: 3.0.7 - retry-axios@2.6.0(axios@1.9.0): + retry-axios@2.6.0(axios@1.9.0(debug@4.4.1)): dependencies: - axios: 1.9.0 + axios: 1.9.0(debug@4.4.1) retry-request@7.0.2(encoding@0.1.13): dependencies: @@ -27118,7 +27122,7 @@ snapshots: router@2.2.0: dependencies: - debug: 4.4.0 + debug: 4.4.1(supports-color@8.1.1) depd: 2.0.0 is-promise: 4.0.0 parseurl: 1.3.3 @@ -27237,7 +27241,7 @@ snapshots: send@1.2.0: dependencies: - debug: 4.4.0 + debug: 4.4.1(supports-color@8.1.1) encodeurl: 2.0.0 escape-html: 1.0.3 etag: 1.8.1 @@ -27501,7 +27505,7 @@ snapshots: asn1.js: 5.4.1 asn1.js-rfc2560: 5.0.1(asn1.js@5.4.1) asn1.js-rfc5280: 3.0.0 - axios: 1.9.0 + axios: 1.9.0(debug@4.4.1) big-integer: 1.6.52 bignumber.js: 9.1.2 binascii: 0.0.2 @@ -29197,7 +29201,7 @@ snapshots: yargs@17.7.2: dependencies: cliui: 8.0.1 - escalade: 3.1.1 + escalade: 3.2.0 get-caller-file: 2.0.5 require-directory: 2.1.1 string-width: 4.2.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 76178df7be..c7547dc75b 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -23,6 +23,7 @@ catalog: form-data: 4.0.0 iconv-lite: 0.6.3 jsonwebtoken: 9.0.2 + js-base64: 3.7.2 lodash: 4.17.21 luxon: 3.4.4 nanoid: 3.3.8