Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add resource locator parameter #3932

Merged
merged 56 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
dfd2506
✨ Added resource locator interfaces to `n8n-workflow` package
MiloradFilipovic Jul 26, 2022
504aac1
✅ Updating Trello node to use resource locator property type
MiloradFilipovic Jul 26, 2022
dc1ec80
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Jul 27, 2022
55b6d92
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Jul 28, 2022
3743491
✨ Added resource locator prop to Delete Board` Trello operation
MiloradFilipovic Jul 28, 2022
ecf1807
✔️ Fiixing linting errors in Trello node
MiloradFilipovic Jul 28, 2022
030f395
✨ Added list mode to Trello test node
MiloradFilipovic Aug 1, 2022
8d2d832
⚡ Updating resource locator modes interface
MiloradFilipovic Aug 1, 2022
0abf1e1
⚡ Updating Trello test node validation messages and placeholders
MiloradFilipovic Aug 1, 2022
9614936
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Aug 2, 2022
faf4837
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Aug 4, 2022
6147856
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Aug 5, 2022
167799d
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Aug 10, 2022
7e25794
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Aug 11, 2022
63fe0c0
N8N-4175 resource locator component (#3812)
MiloradFilipovic Aug 11, 2022
e24a410
💄 Added regex URL validation to Trello test node
MiloradFilipovic Aug 11, 2022
1c9c5db
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Aug 11, 2022
7c065f4
✨ Updating Trello test node with another (list mode only) test case
MiloradFilipovic Aug 15, 2022
b1a69e9
✔️ Fixing linting error in Trello node
MiloradFilipovic Aug 15, 2022
152dd52
🔨 Removing hardcoded custom modes and modes order
MiloradFilipovic Aug 17, 2022
402fda1
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Aug 17, 2022
d6de17e
Add value extractor to routing node (#3777)
valya Aug 17, 2022
6dad601
💄 Updating resource locator component styling and handling reset valu…
MiloradFilipovic Aug 18, 2022
04de48c
:sparkles: create v2 of Trello node for resource locator
valya Aug 18, 2022
3612f61
💄 Updating ResourceLocator droppable & activeDrop classes and removin…
MiloradFilipovic Aug 18, 2022
6adce04
Merge branch 'feature-resource-locator' of https://github.com/n8n-io/…
MiloradFilipovic Aug 18, 2022
b330a6b
⚡ Updating Trello test node with single-mode test case
MiloradFilipovic Aug 18, 2022
6d608ae
⚡ Updating field names in Trello node to avoid name clash
MiloradFilipovic Aug 18, 2022
4d7b2f7
Merge branch 'master' into feature-resource-locator
MiloradFilipovic Aug 19, 2022
ff39ab6
💄 Updating test Trello node mode order and board:update parameter name
MiloradFilipovic Aug 19, 2022
20f240b
💄 Updating test node parameter names and display options
MiloradFilipovic Aug 19, 2022
f1c71b0
Merge branch 'master' of github.com:n8n-io/n8n into n8n-4387-resource…
mutdmour Aug 24, 2022
66c349a
merge in master
mutdmour Aug 24, 2022
be49d85
Merge branch 'master' of github.com:n8n-io/n8n into n8n-4387-resource…
mutdmour Aug 25, 2022
0b4267e
Merge branch 'master' of github.com:n8n-io/n8n into n8n-4387-resource…
mutdmour Aug 29, 2022
20258cf
Merge branch 'master' of github.com:n8n-io/n8n into n8n-4387-resource…
mutdmour Aug 29, 2022
111423d
Merge branch 'master' of github.com:n8n-io/n8n into n8n-4387-resource…
mutdmour Aug 29, 2022
ada2ceb
Merge branch 'master' of github.com:n8n-io/n8n into n8n-4387-resource…
mutdmour Aug 30, 2022
926b5b1
Merge branch 'master' into n8n-4387-resource-loader
valya Aug 31, 2022
9efe5f7
List mode search endpoint (#3936)
valya Sep 5, 2022
a1f1a80
merge in master
mutdmour Sep 5, 2022
cb05729
Merge branch 'master' of github.com:n8n-io/n8n into n8n-4387-resource…
mutdmour Sep 6, 2022
449b840
N8 n 4179 resource locator list mode (#3933)
mutdmour Sep 20, 2022
7cace5b
Merge remote-tracking branch 'origin/master' into n8n-4387-resource-l…
valya Sep 20, 2022
b2a2c84
refactor: Resource locator review changes (#4109)
valya Sep 21, 2022
86eefd6
Merge remote-tracking branch 'origin/master' into n8n-4387-resource-l…
valya Sep 21, 2022
b0be855
fix build
mutdmour Sep 21, 2022
ff11c2c
update tests
mutdmour Sep 21, 2022
3c6ba59
fix bug with credential card
mutdmour Sep 21, 2022
4a56b30
update popover component
mutdmour Sep 21, 2022
edde813
fix expressions url
mutdmour Sep 21, 2022
d7b4a37
fix type issue
mutdmour Sep 21, 2022
8300123
format
mutdmour Sep 21, 2022
79ef242
update alt
mutdmour Sep 21, 2022
d7fdf72
fix lint issues
mutdmour Sep 21, 2022
3ac663e
fix eslint issues
mutdmour Sep 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 38 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 110 additions & 1 deletion packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,27 @@ import clientOAuth1, { RequestOptions } from 'oauth-1.0a';
// tested with all possible systems like Windows, Alpine on ARM, FreeBSD, ...
import { compare } from 'bcryptjs';

import { BinaryDataManager, Credentials, LoadNodeParameterOptions, UserSettings } from 'n8n-core';
import {
BinaryDataManager,
Credentials,
LoadNodeParameterOptions,
LoadNodeListSearch,
UserSettings,
} from 'n8n-core';

import {
ICredentialType,
INodeCredentials,
INodeCredentialsDetails,
INodeListSearchResult,
INodeParameters,
INodePropertyOptions,
INodeType,
INodeTypeDescription,
INodeTypeNameVersion,
ITelemetrySettings,
LoggerProxy,
NodeHelpers,
WebhookHttpMethod,
WorkflowExecuteMode,
} from 'n8n-workflow';
Expand Down Expand Up @@ -86,6 +96,7 @@ import { credentialsController } from './credentials/credentials.controller';
import { oauth2CredentialController } from './credentials/oauth2Credential.api';
import type {
ExecutionRequest,
NodeListSearchRequest,
NodeParameterOptionsRequest,
OAuthRequest,
WorkflowRequest,
Expand Down Expand Up @@ -136,6 +147,7 @@ import {
WebhookServer,
WorkflowExecuteAdditionalData,
} from '.';
import { ResponseError } from './ResponseHelper';

require('body-parser-xml')(bodyParser);

Expand Down Expand Up @@ -825,6 +837,103 @@ class App {
),
);

// Returns parameter values which normally get loaded from an external API or
// get generated dynamically
this.app.get(
`/${this.restEndpoint}/nodes-list-search`,
ResponseHelper.send(
async (
req: NodeListSearchRequest,
res: express.Response,
): Promise<INodeListSearchResult | undefined> => {
const nodeTypeAndVersion = JSON.parse(
req.query.nodeTypeAndVersion,
) as INodeTypeNameVersion;

const { path, methodName } = req.query;

if (!req.query.currentNodeParameters) {
throw new ResponseError('Parameter currentNodeParameters is required.', undefined, 400);
}

const currentNodeParameters = JSON.parse(
req.query.currentNodeParameters,
) as INodeParameters;

let credentials: INodeCredentials | undefined;

if (req.query.credentials) {
credentials = JSON.parse(req.query.credentials);
}

const listSearchInstance = new LoadNodeListSearch(
nodeTypeAndVersion,
NodeTypes(),
path,
currentNodeParameters,
credentials,
);

const additionalData = await WorkflowExecuteAdditionalData.getBase(
req.user.id,
currentNodeParameters,
);

if (methodName) {
return listSearchInstance.getOptionsViaMethodName(
methodName,
additionalData,
req.query.filter,
req.query.paginationToken,
);
}

throw new ResponseError('Parameter methodName is required.', undefined, 400);
},
),
);

// Returns all the node-types
this.app.get(
`/${this.restEndpoint}/node-types`,
ResponseHelper.send(
async (req: express.Request, res: express.Response): Promise<INodeTypeDescription[]> => {
const returnData: INodeTypeDescription[] = [];
const onlyLatest = req.query.onlyLatest === 'true';

const nodeTypes = NodeTypes();
const allNodes = nodeTypes.getAll();

const getNodeDescription = (nodeType: INodeType): INodeTypeDescription => {
const nodeInfo: INodeTypeDescription = { ...nodeType.description };
if (req.query.includeProperties !== 'true') {
// @ts-ignore
delete nodeInfo.properties;
}
return nodeInfo;
};

if (onlyLatest) {
allNodes.forEach((nodeData) => {
const nodeType = NodeHelpers.getVersionedNodeType(nodeData);
const nodeInfo: INodeTypeDescription = getNodeDescription(nodeType);
returnData.push(nodeInfo);
});
} else {
allNodes.forEach((nodeData) => {
const allNodeTypes = NodeHelpers.getVersionedNodeTypeAll(nodeData);
allNodeTypes.forEach((element) => {
const nodeInfo: INodeTypeDescription = getNodeDescription(element);
returnData.push(nodeInfo);
});
});
}

return returnData;
},
),
);

this.app.get(
`/${this.restEndpoint}/credential-translation`,
ResponseHelper.send(
Expand Down
19 changes: 19 additions & 0 deletions packages/cli/src/requests.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,25 @@ export type NodeParameterOptionsRequest = AuthenticatedRequest<
}
>;

// ----------------------------------
// /node-list-search
// ----------------------------------

export type NodeListSearchRequest = AuthenticatedRequest<
{},
{},
{},
{
nodeTypeAndVersion: string;
methodName: string;
path: string;
currentNodeParameters: string;
credentials: string;
filter?: string;
paginationToken?: string;
}
>;

// ----------------------------------
// /tags
// ----------------------------------
Expand Down
Loading