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(n8n AWS Cognito Node): New node #11767

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f9ad3bc
Initial commit
valentina98 Nov 17, 2024
48ebf1f
add error handle function
Stamsy Nov 22, 2024
f7d39b6
add group description
Stamsy Nov 25, 2024
133ba47
Added User description
adina-hub Nov 25, 2024
d1bbde9
Edit User description
adina-hub Nov 26, 2024
9d2b604
update group description
Stamsy Nov 26, 2024
bcc479e
Merge branch 'node-aws-cognito' of https://github.com/digital-boss/n8…
Stamsy Nov 26, 2024
6eb585d
add search method to get group from list
Stamsy Nov 26, 2024
e85ced0
Updated User description
adina-hub Nov 26, 2024
8fcfc4c
update group description logic
Stamsy Nov 27, 2024
61d63b9
Merge branch 'node-aws-cognito' of https://github.com/digital-boss/n8…
Stamsy Nov 27, 2024
39d4d9d
Added more fields for create action
adina-hub Nov 27, 2024
b4406c4
Merge branch 'node-aws-cognito' of https://github.com/digital-boss/n8…
adina-hub Nov 27, 2024
c57f838
add process response group
Stamsy Nov 27, 2024
f09091a
Worked on error handling and pagination
adina-hub Nov 28, 2024
e4088ca
Worked on pagination function
adina-hub Nov 28, 2024
6914c11
Removed some ToDos
adina-hub Nov 28, 2024
477bbbc
Fixed pagination
adina-hub Nov 29, 2024
3615cd9
Changes after feedback
adina-hub Dec 5, 2024
3f15fd5
Fixed issues after feedback
adina-hub Dec 9, 2024
c667116
add handle pagination and aws request unit tests
Stamsy Dec 15, 2024
9fa6985
add unit test for other functions in generic function file
Stamsy Dec 16, 2024
f3bcf18
Merge branch 'node-aws-cognito' of https://github.com/digital-boss/n8…
adina-hub Dec 18, 2024
abdd152
Fixed some issues after feedback
adina-hub Jan 6, 2025
2d5eb7c
Modified temporaryPassword and filters for User, and 'options' to add…
adina-hub Jan 8, 2025
2a680d8
Fixed tests
adina-hub Jan 8, 2025
0da656f
Removed UserAttributes for create action
adina-hub Jan 9, 2025
d4cf2f8
Modified tests based on changes
adina-hub Jan 10, 2025
874f0b2
WIP tests for searchGroups
adina-hub Jan 10, 2025
e397867
fix searchGroups test
Stamsy Jan 10, 2025
27a3ab6
Fixed last tests for search functions
adina-hub Jan 13, 2025
f8b090b
Made some changes on processAttributes function test
adina-hub Jan 13, 2025
56a6cb1
Added validation for services and prefix to response variable
adina-hub Jan 23, 2025
8244972
Minor copy tweaks.
gandreini Jan 30, 2025
2fc9e95
Fixed issues after feedback
adina-hub Feb 3, 2025
98e6280
User output changes
adina-hub Feb 4, 2025
1d596fc
Modified available groups for removeUserFromGroup & fixed updateUser
adina-hub Feb 12, 2025
d050efb
Fixed tests
adina-hub Feb 12, 2025
442f30b
Removed comments
adina-hub Feb 12, 2025
b28298f
Minor copy tweak.
gandreini Feb 13, 2025
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
4 changes: 1 addition & 3 deletions packages/nodes-base/credentials/Aws.credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export class Aws implements ICredentialType {
region = parsed.region;
}
} else {
if (!requestOptions.baseURL && !requestOptions.url) {
if (!requestOptions.baseURL && !requestOptions.url && service) {
let endpointString: string;
if (service === 'lambda' && credentials.lambdaEndpoint) {
endpointString = credentials.lambdaEndpoint;
Expand All @@ -353,8 +353,6 @@ export class Aws implements ICredentialType {
endpointString = credentials.sesEndpoint;
} else if (service === 'rekognition' && credentials.rekognitionEndpoint) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add validation to ensure service is defined and valid before constructing the endpoint string.

endpointString = credentials.rekognitionEndpoint;
} else if (service === 'sqs' && credentials.sqsEndpoint) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these lines removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a duplicate, there was also a comment previously with this as a to-do

endpointString = credentials.sqsEndpoint;
} else if (service) {
endpointString = `https://${service}.${region}.amazonaws.com`;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { sign, type Request } from 'aws4';
import type { IHttpRequestOptions } from 'n8n-workflow';

import { Aws, type AwsCredentialsType } from '../Aws.credentials';

jest.mock('aws4', () => ({
Expand Down
18 changes: 18 additions & 0 deletions packages/nodes-base/nodes/Aws/Cognito/AwsCognito.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"node": "n8n-nodes-base.awsCognito",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Development"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/credentials/aws/"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.awscognito/"
}
]
}
}
108 changes: 108 additions & 0 deletions packages/nodes-base/nodes/Aws/Cognito/AwsCognito.node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import type { INodeType, INodeTypeDescription } from 'n8n-workflow';
import { NodeConnectionType } from 'n8n-workflow';

import {
userOperations,
userFields,
userPoolOperations,
userPoolFields,
groupOperations,
groupFields,
} from './descriptions';
import {
presendStringifyBody,
searchUserPools,
searchGroups,
searchUsers,
searchGroupsForUser,
} from './GenericFunctions';

export class AwsCognito implements INodeType {
description: INodeTypeDescription = {
displayName: 'AWS Cognito',
name: 'awsCognito',
icon: 'file:cognito.svg',
group: ['output'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Interacts with Amazon Cognito',
defaults: { name: 'AWS Cognito' },
inputs: [NodeConnectionType.Main],
outputs: [NodeConnectionType.Main],
hints: [
{
message: 'Select a parameter to update this resource',
displayCondition:
'={{$parameter["resource"] === "user" && $parameter["operation"] === "update" && Object.keys($parameter["additionalOptions"]).length === 0}}',
whenToDisplay: 'always',
location: 'outputPane',
type: 'warning',
},
{
message: 'Select a parameter to update this resource',
displayCondition:
'={{$parameter["resource"] === "group" && $parameter["operation"] === "update" && Object.keys($parameter["options"]).length === 0}}',
whenToDisplay: 'always',
location: 'outputPane',
type: 'warning',
},
],
credentials: [
{
name: 'aws',
required: true,
},
],
requestDefaults: {
baseURL: '=https://cognito-idp.{{$credentials.region}}.amazonaws.com',
url: '',
json: true,
headers: {
'Content-Type': 'application/x-amz-json-1.1',
},
},
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
default: 'user',
routing: {
send: {
preSend: [presendStringifyBody],
},
},
options: [
{
name: 'User',
value: 'user',
},
{
name: 'User Pool',
value: 'userPool',
},
{
name: 'Group',
value: 'group',
},
],
},
...userPoolOperations,
...userPoolFields,
...userOperations,
...userFields,
...groupOperations,
...groupFields,
],
};

methods = {
listSearch: {
searchUserPools,
searchGroups,
searchUsers,
searchGroupsForUser,
},
};
}
Loading