diff --git a/packages/nodes-base/nodes/Aws/Cognito/AwsCognito.node.ts b/packages/nodes-base/nodes/Aws/Cognito/AwsCognito.node.ts index a5b7f0f422..b642877b43 100644 --- a/packages/nodes-base/nodes/Aws/Cognito/AwsCognito.node.ts +++ b/packages/nodes-base/nodes/Aws/Cognito/AwsCognito.node.ts @@ -29,15 +29,22 @@ export class AwsCognito implements INodeType { inputs: [NodeConnectionType.Main], outputs: [NodeConnectionType.Main], hints: [ - // ToDo: Add hints - // { - // message: 'Please select a parameter in the options to modify the post', - // displayCondition: - // '={{$parameter["resource"] === "user" && $parameter["operation"] === "update" && Object.keys($parameter["additionalOptions"]).length === 0}}', - // whenToDisplay: 'always', - // location: 'outputPane', - // type: 'warning', - // }, + { + message: 'Please select a parameter in the options to update the user', + displayCondition: + '={{$parameter["resource"] === "user" && $parameter["operation"] === "update" && Object.keys($parameter["additionalOptions"]).length === 0}}', + whenToDisplay: 'always', + location: 'outputPane', + type: 'warning', + }, + { + message: 'Please select a parameter in the options to update the group', + displayCondition: + '={{$parameter["resource"] === "group" && $parameter["operation"] === "update" && Object.keys($parameter["options"]).length === 0}}', + whenToDisplay: 'always', + location: 'outputPane', + type: 'warning', + }, ], credentials: [ { diff --git a/packages/nodes-base/nodes/Aws/Cognito/GenericFunctions.ts b/packages/nodes-base/nodes/Aws/Cognito/GenericFunctions.ts index c1a1dd55b6..60c45dc539 100644 --- a/packages/nodes-base/nodes/Aws/Cognito/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Aws/Cognito/GenericFunctions.ts @@ -37,8 +37,6 @@ export async function presendFilter( let filterType = additionalFields.filterType as string; const filterValue = additionalFields.filterValue as string; - console.log('Attribute', filterAttribute, 'Type', filterType, 'Value', filterValue); - if (!filterAttribute || !filterType || !filterValue) { throw new NodeOperationError( this.getNode(), @@ -240,6 +238,12 @@ export async function handleErrorPostReceive( } } else if (resource === 'user') { if (operation === 'create') { + if (errorType === 'UserNotFoundException') { + throw new NodeApiError(this.getNode(), response as unknown as JsonObject, { + message: "'Message Action: Resend' needs an existing user", + description: 'Adjust the "User Name" parameter setting to create the user correctly.', + }); + } if ( errorType === 'UsernameExistsException' && errorMessage === 'User account already exists' diff --git a/packages/nodes-base/nodes/Aws/Cognito/descriptions/GroupDescription.ts b/packages/nodes-base/nodes/Aws/Cognito/descriptions/GroupDescription.ts index d0df011722..8119b48587 100644 --- a/packages/nodes-base/nodes/Aws/Cognito/descriptions/GroupDescription.ts +++ b/packages/nodes-base/nodes/Aws/Cognito/descriptions/GroupDescription.ts @@ -1,6 +1,11 @@ import type { INodeProperties } from 'n8n-workflow'; -import { handleErrorPostReceive, handlePagination, presendPath } from '../GenericFunctions'; +import { + handleErrorPostReceive, + handlePagination, + presendOptions, + presendPath, +} from '../GenericFunctions'; export const groupOperations: INodeProperties[] = [ { @@ -51,7 +56,7 @@ export const groupOperations: INodeProperties[] = [ { type: 'set', properties: { - value: '={{ { "deleted": true } }}', + value: '={{ { "success": true } }}', }, }, ], @@ -106,6 +111,9 @@ export const groupOperations: INodeProperties[] = [ value: 'update', description: 'Update an existing group', routing: { + send: { + preSend: [presendOptions], + }, request: { method: 'POST', headers: { @@ -119,7 +127,7 @@ export const groupOperations: INodeProperties[] = [ { type: 'set', properties: { - value: '={{ { "updated": true } }}', + value: '={{ { "success": true } }}', }, }, ], diff --git a/packages/nodes-base/nodes/Aws/Cognito/descriptions/UserDescription.ts b/packages/nodes-base/nodes/Aws/Cognito/descriptions/UserDescription.ts index 168678232a..0048e050ef 100644 --- a/packages/nodes-base/nodes/Aws/Cognito/descriptions/UserDescription.ts +++ b/packages/nodes-base/nodes/Aws/Cognito/descriptions/UserDescription.ts @@ -39,7 +39,7 @@ export const userOperations: INodeProperties[] = [ { type: 'set', properties: { - value: '={{ { "added": true } }}', + value: '={{ { "success": true } }}', }, }, ], @@ -83,7 +83,7 @@ export const userOperations: INodeProperties[] = [ { type: 'set', properties: { - value: '={{ { "deleted": true } }}', + value: '={{ { "success": true } }}', }, }, ], @@ -113,7 +113,10 @@ export const userOperations: INodeProperties[] = [ value: 'getAll', description: 'Retrieve a list of users', routing: { - send: { paginate: true }, + send: { + paginate: true, + preSend: [presendFilter], + }, operations: { pagination: handlePagination }, request: { method: 'POST', @@ -151,7 +154,7 @@ export const userOperations: INodeProperties[] = [ { type: 'set', properties: { - value: '={{ { "removed": true } }}', + value: '={{ { "success": true } }}', }, }, ], @@ -177,7 +180,7 @@ export const userOperations: INodeProperties[] = [ { type: 'set', properties: { - value: '={{ { "updated": true } }}', + value: '={{ { "success": true } }}', }, }, ], @@ -428,11 +431,11 @@ const createFields: INodeProperties[] = [ ], routing: { send: { + preSend: [processAttributes], type: 'body', property: 'UserAttributes', value: '={{ $value.attributes?.map(attribute => ({ Name: attribute.Name, Value: attribute.Value })) || [] }}', - preSend: [processAttributes], }, }, }, @@ -703,11 +706,6 @@ const getAllFields: INodeProperties[] = [ default: 'username', hint: 'Make sure to select an attribute, type, and provide a value before submitting.', description: 'The attribute to search for', - routing: { - send: { - preSend: [presendFilter], - }, - }, options: [ { name: 'Cognito User Status', value: 'cognito:user_status' }, { name: 'Email', value: 'email' },