mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(editor): Extract API Requests into @n8n/rest-api-client package (no-changelog) (#15930)
This commit is contained in:
10
packages/frontend/@n8n/rest-api-client/.eslintrc.cjs
Normal file
10
packages/frontend/@n8n/rest-api-client/.eslintrc.cjs
Normal file
@@ -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'),
|
||||
};
|
||||
24
packages/frontend/@n8n/rest-api-client/.gitignore
vendored
Normal file
24
packages/frontend/@n8n/rest-api-client/.gitignore
vendored
Normal file
@@ -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?
|
||||
22
packages/frontend/@n8n/rest-api-client/README.md
Normal file
22
packages/frontend/@n8n/rest-api-client/README.md
Normal file
@@ -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).
|
||||
4
packages/frontend/@n8n/rest-api-client/biome.jsonc
Normal file
4
packages/frontend/@n8n/rest-api-client/biome.jsonc
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"$schema": "../../../../node_modules/@biomejs/biome/configuration_schema.json",
|
||||
"extends": ["../../../../biome.jsonc"]
|
||||
}
|
||||
58
packages/frontend/@n8n/rest-api-client/package.json
Normal file
58
packages/frontend/@n8n/rest-api-client/package.json
Normal file
@@ -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"
|
||||
}
|
||||
@@ -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<ApiKey[]> {
|
||||
return await makeRestApiRequest(context, 'GET', '/api-keys');
|
||||
}
|
||||
@@ -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,
|
||||
@@ -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<boolean> {
|
||||
const response = await get(context.baseUrl, '/cta/become-creator');
|
||||
@@ -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;
|
||||
};
|
||||
@@ -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<void> {
|
||||
return await makeRestApiRequest(context, 'GET', '/events/session-started');
|
||||
12
packages/frontend/@n8n/rest-api-client/src/api/index.ts
Normal file
12
packages/frontend/@n8n/rest-api-client/src/api/index.ts
Normal file
@@ -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';
|
||||
@@ -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');
|
||||
@@ -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++) {
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
@@ -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<AllRolesMap> => {
|
||||
return await makeRestApiRequest(context, 'GET', '/roles');
|
||||
@@ -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[] },
|
||||
@@ -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;
|
||||
3
packages/frontend/@n8n/rest-api-client/src/index.ts
Normal file
3
packages/frontend/@n8n/rest-api-client/src/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './api';
|
||||
export * from './types';
|
||||
export * from './utils';
|
||||
1
packages/frontend/@n8n/rest-api-client/src/shims.d.ts
vendored
Normal file
1
packages/frontend/@n8n/rest-api-client/src/shims.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
4
packages/frontend/@n8n/rest-api-client/src/types.ts
Normal file
4
packages/frontend/@n8n/rest-api-client/src/types.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export interface IRestApiContext {
|
||||
baseUrl: string;
|
||||
pushRef: string;
|
||||
}
|
||||
@@ -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 () => {
|
||||
@@ -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<T>(
|
||||
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<T extends object>(
|
||||
context: IRestApiContext,
|
||||
apiEndpoint: string,
|
||||
@@ -306,6 +284,6 @@ export async function streamRequest<T extends object>(
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
assert(e instanceof Error);
|
||||
onError?.(e);
|
||||
onError?.(e as Error);
|
||||
}
|
||||
}
|
||||
14
packages/frontend/@n8n/rest-api-client/tsconfig.json
Normal file
14
packages/frontend/@n8n/rest-api-client/tsconfig.json
Normal file
@@ -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"]
|
||||
}
|
||||
11
packages/frontend/@n8n/rest-api-client/tsup.config.ts
Normal file
11
packages/frontend/@n8n/rest-api-client/tsup.config.ts
Normal file
@@ -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,
|
||||
});
|
||||
4
packages/frontend/@n8n/rest-api-client/vite.config.ts
Normal file
4
packages/frontend/@n8n/rest-api-client/vite.config.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { defineConfig, mergeConfig } from 'vite';
|
||||
import { createVitestConfig } from '@n8n/vitest-config/frontend';
|
||||
|
||||
export default mergeConfig(defineConfig({}), createVitestConfig({ setupFiles: [] }));
|
||||
@@ -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:*",
|
||||
|
||||
@@ -1177,11 +1177,6 @@ export interface CommunityNodesState {
|
||||
installedPackages: CommunityPackageMap;
|
||||
}
|
||||
|
||||
export interface IRestApiContext {
|
||||
baseUrl: string;
|
||||
pushRef: string;
|
||||
}
|
||||
|
||||
export interface IZoomConfig {
|
||||
scale: number;
|
||||
offset: XYPosition;
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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<Cloud.PlanData> {
|
||||
return await get(context.baseUrl, '/admin/cloud-plan');
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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<EnvironmentVariable[]> {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ILdapConfig> {
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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<string> => {
|
||||
return await makeRestApiRequest(context, 'GET', `/sso/saml/initsso?redirect=${redirectUrl}`);
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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(',');
|
||||
|
||||
@@ -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<UsageState['data']> => {
|
||||
return await makeRestApiRequest(context, 'GET', '/license');
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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<NewWorkflowResponse>(
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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(),
|
||||
}));
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -16,7 +16,7 @@ vi.mock('@/stores/ui.store', () => ({
|
||||
})),
|
||||
}));
|
||||
|
||||
vi.mock('@/api/npsSurvey', () => ({
|
||||
vi.mock('@n8n/rest-api-client/api/npsSurvey', () => ({
|
||||
updateNpsSurveyState,
|
||||
}));
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<typeof useRolesStore>;
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -17,7 +17,7 @@ vi.mock('@/api/settings', () => ({
|
||||
getSettings,
|
||||
}));
|
||||
|
||||
vi.mock('@/api/events', () => ({
|
||||
vi.mock('@n8n/rest-api-client/api/events', () => ({
|
||||
sessionStarted,
|
||||
}));
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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*"],
|
||||
|
||||
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user