mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Merge branch 'master' of https://github.com/n8n-io/n8n into node-2015-google-calendar-confusing-errors
This commit is contained in:
commit
c1f7ff07ad
1
.github/workflows/units-tests-reusable.yml
vendored
1
.github/workflows/units-tests-reusable.yml
vendored
|
@ -49,7 +49,6 @@ jobs:
|
|||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Setup build cache
|
||||
if: inputs.collectCoverage != true
|
||||
uses: rharkor/caching-for-turbo@v1.5
|
||||
|
||||
- name: Build
|
||||
|
|
|
@ -41,7 +41,9 @@ describe('Data mapping', () => {
|
|||
ndv.actions.mapDataFromHeader(1, 'value');
|
||||
ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.timestamp }}');
|
||||
ndv.getters.inlineExpressionEditorInput().type('{esc}');
|
||||
ndv.getters.parameterExpressionPreview('value').should('include.text', '2024');
|
||||
ndv.getters
|
||||
.parameterExpressionPreview('value')
|
||||
.should('include.text', new Date().getFullYear());
|
||||
|
||||
ndv.actions.mapDataFromHeader(2, 'value');
|
||||
ndv.getters
|
||||
|
|
|
@ -6,6 +6,7 @@ export class FeatureNotLicensedError extends ApplicationError {
|
|||
constructor(feature: (typeof LICENSE_FEATURES)[keyof typeof LICENSE_FEATURES]) {
|
||||
super(
|
||||
`Your license does not allow for ${feature}. To enable ${feature}, please upgrade to a license that supports this feature.`,
|
||||
{ level: 'warning' },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,10 @@ export class ErrorReporter {
|
|||
const context = executionId ? ` (execution ${executionId})` : '';
|
||||
|
||||
do {
|
||||
const msg = [e.message + context, e.stack ? `\n${e.stack}\n` : ''].join('');
|
||||
const msg = [
|
||||
e.message + context,
|
||||
e instanceof ApplicationError && e.level === 'error' && e.stack ? `\n${e.stack}\n` : '',
|
||||
].join('');
|
||||
const meta = e instanceof ApplicationError ? e.extra : undefined;
|
||||
this.logger.error(msg, meta);
|
||||
e = e.cause as Error;
|
||||
|
|
|
@ -5,6 +5,7 @@ import { mock } from 'jest-mock-extended';
|
|||
import { ApplicationError } from 'n8n-workflow';
|
||||
|
||||
import { ErrorReporter } from '@/error-reporter';
|
||||
import type { Logger } from '@/logging/logger';
|
||||
|
||||
jest.mock('@sentry/node', () => ({
|
||||
init: jest.fn(),
|
||||
|
@ -101,4 +102,29 @@ describe('ErrorReporter', () => {
|
|||
expect(result).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('error', () => {
|
||||
let error: ApplicationError;
|
||||
let logger: Logger;
|
||||
let errorReporter: ErrorReporter;
|
||||
const metadata = undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
error = new ApplicationError('Test error');
|
||||
logger = mock<Logger>();
|
||||
errorReporter = new ErrorReporter(logger);
|
||||
});
|
||||
|
||||
it('should include stack trace for error-level `ApplicationError`', () => {
|
||||
error.level = 'error';
|
||||
errorReporter.error(error);
|
||||
expect(logger.error).toHaveBeenCalledWith(`Test error\n${error.stack}\n`, metadata);
|
||||
});
|
||||
|
||||
it('should exclude stack trace for warning-level `ApplicationError`', () => {
|
||||
error.level = 'warning';
|
||||
errorReporter.error(error);
|
||||
expect(logger.error).toHaveBeenCalledWith('Test error', metadata);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,6 +7,7 @@ import { createComponentRenderer } from '@/__tests__/render';
|
|||
import { useCredentialsStore } from '@/stores/credentials.store';
|
||||
import { mockedStore } from '@/__tests__/utils';
|
||||
import type { INodeUi } from '@/Interface';
|
||||
import { useNDVStore } from '@/stores/ndv.store';
|
||||
|
||||
const httpNode: INodeUi = {
|
||||
parameters: {
|
||||
|
@ -31,6 +32,25 @@ const httpNode: INodeUi = {
|
|||
issues: { parameters: { url: ['Parameter "URL" is required.'] } },
|
||||
};
|
||||
|
||||
const openAiNode: INodeUi = {
|
||||
parameters: {
|
||||
resource: 'text',
|
||||
operation: 'message',
|
||||
modelId: { __rl: true, mode: 'list', value: '' },
|
||||
messages: { values: [{ content: '', role: 'user' }] },
|
||||
simplify: true,
|
||||
jsonOutput: false,
|
||||
options: {},
|
||||
},
|
||||
type: '@n8n/n8n-nodes-langchain.openAi',
|
||||
typeVersion: 1.8,
|
||||
position: [440, 0],
|
||||
id: '17241295-a277-4cdf-8c46-6c3f85b335e9',
|
||||
name: 'OpenAI',
|
||||
credentials: { openAiApi: { id: 'byDFnd7vN5GzMVD2', name: 'n8n free OpenAI API credits' } },
|
||||
issues: { parameters: { modelId: ['Parameter "Model" is required.'] } },
|
||||
};
|
||||
|
||||
describe('NodeCredentials', () => {
|
||||
const defaultRenderOptions: RenderOptions = {
|
||||
pinia: createTestingPinia(),
|
||||
|
@ -45,6 +65,9 @@ describe('NodeCredentials', () => {
|
|||
|
||||
const renderComponent = createComponentRenderer(NodeCredentials, defaultRenderOptions);
|
||||
|
||||
const credentialsStore = mockedStore(useCredentialsStore);
|
||||
const ndvStore = mockedStore(useNDVStore);
|
||||
|
||||
beforeAll(() => {
|
||||
credentialsStore.state.credentialTypes = {
|
||||
openAiApi: {
|
||||
|
@ -80,9 +103,8 @@ describe('NodeCredentials', () => {
|
|||
};
|
||||
});
|
||||
|
||||
const credentialsStore = mockedStore(useCredentialsStore);
|
||||
|
||||
it('should display available credentials in the dropdown', async () => {
|
||||
ndvStore.activeNode = httpNode;
|
||||
credentialsStore.state.credentials = {
|
||||
c8vqdPpPClh4TgIO: {
|
||||
id: 'c8vqdPpPClh4TgIO',
|
||||
|
@ -103,7 +125,8 @@ describe('NodeCredentials', () => {
|
|||
expect(screen.queryByText('OpenAi account')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should ignore managed credentials in the dropdown', async () => {
|
||||
it('should ignore managed credentials in the dropdown if active node is the HTTP node', async () => {
|
||||
ndvStore.activeNode = httpNode;
|
||||
credentialsStore.state.credentials = {
|
||||
c8vqdPpPClh4TgIO: {
|
||||
id: 'c8vqdPpPClh4TgIO',
|
||||
|
@ -132,4 +155,42 @@ describe('NodeCredentials', () => {
|
|||
expect(screen.queryByText('OpenAi account')).toBeInTheDocument();
|
||||
expect(screen.queryByText('OpenAi account 2')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not ignored managed credentials in the dropdown if active node is not the HTTP node', async () => {
|
||||
ndvStore.activeNode = openAiNode;
|
||||
credentialsStore.state.credentials = {
|
||||
c8vqdPpPClh4TgIO: {
|
||||
id: 'c8vqdPpPClh4TgIO',
|
||||
name: 'OpenAi account',
|
||||
type: 'openAiApi',
|
||||
isManaged: false,
|
||||
createdAt: '',
|
||||
updatedAt: '',
|
||||
},
|
||||
SkXM3oUkQvvYS31c: {
|
||||
id: 'c8vqdPpPClh4TgIO',
|
||||
name: 'OpenAi account 2',
|
||||
type: 'openAiApi',
|
||||
isManaged: true,
|
||||
createdAt: '',
|
||||
updatedAt: '',
|
||||
},
|
||||
};
|
||||
|
||||
renderComponent(
|
||||
{
|
||||
props: {
|
||||
node: openAiNode,
|
||||
},
|
||||
},
|
||||
{ merge: true },
|
||||
);
|
||||
|
||||
const credentialsSelect = screen.getByTestId('node-credentials-select');
|
||||
|
||||
await fireEvent.click(credentialsSelect);
|
||||
|
||||
expect(screen.queryByText('OpenAi account')).toBeInTheDocument();
|
||||
expect(screen.queryByText('OpenAi account 2')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<script setup lang="ts">
|
||||
import type { ICredentialsResponse, INodeUi, INodeUpdatePropertiesInformation } from '@/Interface';
|
||||
import type {
|
||||
INodeCredentialDescription,
|
||||
INodeCredentialsDetails,
|
||||
NodeParameterValueType,
|
||||
import {
|
||||
HTTP_REQUEST_NODE_TYPE,
|
||||
type INodeCredentialDescription,
|
||||
type INodeCredentialsDetails,
|
||||
type NodeParameterValueType,
|
||||
} from 'n8n-workflow';
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
|
||||
|
@ -261,7 +262,11 @@ function getCredentialOptions(types: string[]): CredentialDropdownOption[] {
|
|||
);
|
||||
});
|
||||
|
||||
return options.filter((option) => !option.isManaged);
|
||||
if (ndvStore.activeNode?.type === HTTP_REQUEST_NODE_TYPE) {
|
||||
options = options.filter((option) => !option.isManaged);
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function getSelectedId(type: string) {
|
||||
|
|
|
@ -434,7 +434,7 @@ importers:
|
|||
version: 3.666.0(@aws-sdk/client-sts@3.666.0)
|
||||
'@getzep/zep-cloud':
|
||||
specifier: 1.0.12
|
||||
version: 1.0.12(@langchain/core@0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13)(langchain@0.3.6(4axcxpjbcq5bce7ff6ajxrpp4i))
|
||||
version: 1.0.12(@langchain/core@0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13)(langchain@0.3.6(e4rnrwhosnp2xiru36mqgdy2bu))
|
||||
'@getzep/zep-js':
|
||||
specifier: 0.9.0
|
||||
version: 0.9.0
|
||||
|
@ -461,7 +461,7 @@ importers:
|
|||
version: 0.3.1(@aws-sdk/client-sso-oidc@3.666.0(@aws-sdk/client-sts@3.666.0))(@langchain/core@0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13)
|
||||
'@langchain/community':
|
||||
specifier: 0.3.15
|
||||
version: 0.3.15(v4qhcw25bevfr6xzz4fnsvjiqe)
|
||||
version: 0.3.15(vc5hvyy27o4cmm4jplsptc2fqm)
|
||||
'@langchain/core':
|
||||
specifier: 'catalog:'
|
||||
version: 0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8))
|
||||
|
@ -548,7 +548,7 @@ importers:
|
|||
version: 23.0.1
|
||||
langchain:
|
||||
specifier: 0.3.6
|
||||
version: 0.3.6(4axcxpjbcq5bce7ff6ajxrpp4i)
|
||||
version: 0.3.6(e4rnrwhosnp2xiru36mqgdy2bu)
|
||||
lodash:
|
||||
specifier: 'catalog:'
|
||||
version: 4.17.21
|
||||
|
@ -15690,7 +15690,7 @@ snapshots:
|
|||
'@gar/promisify@1.1.3':
|
||||
optional: true
|
||||
|
||||
'@getzep/zep-cloud@1.0.12(@langchain/core@0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13)(langchain@0.3.6(4axcxpjbcq5bce7ff6ajxrpp4i))':
|
||||
'@getzep/zep-cloud@1.0.12(@langchain/core@0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13)(langchain@0.3.6(e4rnrwhosnp2xiru36mqgdy2bu))':
|
||||
dependencies:
|
||||
form-data: 4.0.0
|
||||
node-fetch: 2.7.0(encoding@0.1.13)
|
||||
|
@ -15699,7 +15699,7 @@ snapshots:
|
|||
zod: 3.23.8
|
||||
optionalDependencies:
|
||||
'@langchain/core': 0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8))
|
||||
langchain: 0.3.6(4axcxpjbcq5bce7ff6ajxrpp4i)
|
||||
langchain: 0.3.6(e4rnrwhosnp2xiru36mqgdy2bu)
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
|
||||
|
@ -16163,7 +16163,7 @@ snapshots:
|
|||
- aws-crt
|
||||
- encoding
|
||||
|
||||
'@langchain/community@0.3.15(v4qhcw25bevfr6xzz4fnsvjiqe)':
|
||||
'@langchain/community@0.3.15(vc5hvyy27o4cmm4jplsptc2fqm)':
|
||||
dependencies:
|
||||
'@ibm-cloud/watsonx-ai': 1.1.2
|
||||
'@langchain/core': 0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8))
|
||||
|
@ -16173,7 +16173,7 @@ snapshots:
|
|||
flat: 5.0.2
|
||||
ibm-cloud-sdk-core: 5.1.0
|
||||
js-yaml: 4.1.0
|
||||
langchain: 0.3.6(4axcxpjbcq5bce7ff6ajxrpp4i)
|
||||
langchain: 0.3.6(e4rnrwhosnp2xiru36mqgdy2bu)
|
||||
langsmith: 0.2.3(openai@4.73.1(encoding@0.1.13)(zod@3.23.8))
|
||||
uuid: 10.0.0
|
||||
zod: 3.23.8
|
||||
|
@ -16186,7 +16186,7 @@ snapshots:
|
|||
'@aws-sdk/client-s3': 3.666.0
|
||||
'@aws-sdk/credential-provider-node': 3.666.0(@aws-sdk/client-sso-oidc@3.666.0(@aws-sdk/client-sts@3.666.0))(@aws-sdk/client-sts@3.666.0)
|
||||
'@azure/storage-blob': 12.18.0(encoding@0.1.13)
|
||||
'@getzep/zep-cloud': 1.0.12(@langchain/core@0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13)(langchain@0.3.6(4axcxpjbcq5bce7ff6ajxrpp4i))
|
||||
'@getzep/zep-cloud': 1.0.12(@langchain/core@0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13)(langchain@0.3.6(e4rnrwhosnp2xiru36mqgdy2bu))
|
||||
'@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)
|
||||
|
@ -19470,6 +19470,14 @@ snapshots:
|
|||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
axios@1.7.4(debug@4.3.7):
|
||||
dependencies:
|
||||
follow-redirects: 1.15.6(debug@4.3.7)
|
||||
form-data: 4.0.0
|
||||
proxy-from-env: 1.1.0
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
axios@1.7.7:
|
||||
dependencies:
|
||||
follow-redirects: 1.15.6(debug@4.3.6)
|
||||
|
@ -22321,7 +22329,7 @@ snapshots:
|
|||
'@types/debug': 4.1.12
|
||||
'@types/node': 18.16.16
|
||||
'@types/tough-cookie': 4.0.2
|
||||
axios: 1.7.4
|
||||
axios: 1.7.4(debug@4.3.7)
|
||||
camelcase: 6.3.0
|
||||
debug: 4.3.7
|
||||
dotenv: 16.4.5
|
||||
|
@ -22331,7 +22339,7 @@ snapshots:
|
|||
isstream: 0.1.2
|
||||
jsonwebtoken: 9.0.2
|
||||
mime-types: 2.1.35
|
||||
retry-axios: 2.6.0(axios@1.7.4(debug@4.3.7))
|
||||
retry-axios: 2.6.0(axios@1.7.4)
|
||||
tough-cookie: 4.1.3
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
@ -23332,7 +23340,7 @@ snapshots:
|
|||
|
||||
kuler@2.0.0: {}
|
||||
|
||||
langchain@0.3.6(4axcxpjbcq5bce7ff6ajxrpp4i):
|
||||
langchain@0.3.6(e4rnrwhosnp2xiru36mqgdy2bu):
|
||||
dependencies:
|
||||
'@langchain/core': 0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8))
|
||||
'@langchain/openai': 0.3.14(@langchain/core@0.3.19(openai@4.73.1(encoding@0.1.13)(zod@3.23.8)))(encoding@0.1.13)
|
||||
|
@ -25702,7 +25710,7 @@ snapshots:
|
|||
|
||||
ret@0.1.15: {}
|
||||
|
||||
retry-axios@2.6.0(axios@1.7.4(debug@4.3.7)):
|
||||
retry-axios@2.6.0(axios@1.7.4):
|
||||
dependencies:
|
||||
axios: 1.7.4
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
},
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"outputs": ["dist/**"]
|
||||
"outputs": ["dist/**", "coverage/**"]
|
||||
},
|
||||
"typecheck": {
|
||||
"dependsOn": ["^typecheck"]
|
||||
|
|
Loading…
Reference in a new issue