feat(editor): Add HTTP request nodes for credentials without a node (#7157)

Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Elias Meire
2023-11-13 12:11:16 +01:00
committed by GitHub
parent 460ac85fda
commit 14035e1244
62 changed files with 665 additions and 146 deletions

View File

@@ -10,9 +10,12 @@
import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
import uniqBy from 'lodash/uniqBy';
import type {
FieldType,
IContextObject,
IHttpRequestMethods,
INode,
INodeCredentialDescription,
INodeIssueObjectProperty,
@@ -23,17 +26,15 @@ import type {
INodePropertyCollection,
INodePropertyMode,
INodePropertyModeValidation,
INodePropertyOptions,
INodePropertyRegexValidation,
INodeType,
IVersionedNodeType,
IParameterDependencies,
IRunExecutionData,
IVersionedNodeType,
IWebhookData,
IWorkflowExecuteAdditionalData,
NodeParameterValue,
IHttpRequestMethods,
FieldType,
INodePropertyOptions,
ResourceMapperValue,
ValidationResult,
ConnectionTypes,
@@ -45,8 +46,8 @@ import type {
import { isResourceMapperValue, isValidResourceLocatorParameterValue } from './type-guards';
import { deepCopy } from './utils';
import type { Workflow } from './Workflow';
import { DateTime } from 'luxon';
import type { Workflow } from './Workflow';
export const cronNodeOptions: INodePropertyCollection[] = [
{
@@ -1733,10 +1734,33 @@ export function getVersionedNodeType(
export function getVersionedNodeTypeAll(object: IVersionedNodeType | INodeType): INodeType[] {
if ('nodeVersions' in object) {
return Object.values(object.nodeVersions).map((element) => {
element.description.name = object.description.name;
return element;
});
return uniqBy(
Object.values(object.nodeVersions)
.map((element) => {
element.description.name = object.description.name;
return element;
})
.reverse(),
(node) => {
const { version } = node.description;
return Array.isArray(version) ? version.join(',') : version.toString();
},
);
}
return [object];
}
export function getCredentialsForNode(
object: IVersionedNodeType | INodeType,
): INodeCredentialDescription[] {
if ('nodeVersions' in object) {
return uniqBy(
Object.values(object.nodeVersions).flatMap(
(version) => version.description.credentials ?? [],
),
'name',
);
}
return object.description.credentials ?? [];
}