pull:初次提交

This commit is contained in:
Yep_Q
2025-09-08 04:48:28 +08:00
parent 5c0619656d
commit f64f498365
11751 changed files with 1953723 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('AWS Cognito - Create Group', () => {
beforeEach(() => {
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_qqle3XBUA',
GroupName: 'MyNewGroup11',
})
.reply(200, {
Group: {
GroupName: 'MyNewGroup11',
UserPoolId: 'eu-central-1_qqle3XBUA',
CreationDate: 1743068959.243,
LastModifiedDate: 1743068959.243,
},
});
});
new NodeTestHarness().setupTests({
workflowFiles: ['create.workflow.json'],
credentials: {
aws: {
region: 'eu-central-1',
accessKeyId: 'test',
secretAccessKey: 'test',
},
},
});
});

View File

@@ -0,0 +1,63 @@
{
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [260, 360],
"id": "9ed2b86b-7c24-4ea0-a328-92d9e6dba35a",
"name": "When clicking Execute workflow"
},
{
"parameters": {
"resource": "group",
"operation": "create",
"userPool": {
"__rl": true,
"value": "eu-central-1_qqle3XBUA",
"mode": "list",
"cachedResultName": "UserPoolThree"
},
"newGroupName": "MyNewGroup11",
"additionalFields": {},
"requestOptions": {}
},
"id": "fc6ee80d-3c8f-4ecc-a053-b4a717484c2a",
"name": "createGroup",
"type": "n8n-nodes-base.awsCognito",
"typeVersion": 1,
"position": [500, 360],
"credentials": {
"aws": {
"id": "testId",
"name": "AWS account Central Europe"
}
}
}
],
"pinData": {
"createGroup": [
{
"json": {
"CreationDate": 1743068959.243,
"GroupName": "MyNewGroup11",
"LastModifiedDate": 1743068959.243,
"UserPoolId": "eu-central-1_qqle3XBUA"
}
}
]
},
"connections": {
"When clicking Execute workflow": {
"main": [
[
{
"node": "createGroup",
"type": "main",
"index": 0
}
]
]
}
}
}

View File

@@ -0,0 +1,35 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('AWS Cognito - Delete Group', () => {
beforeEach(() => {
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_qqle3XBUA',
GroupName: 'MyNewGroup22',
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.DeleteGroup')
.reply(200, {
Group: {
GroupName: 'MyNewGroup22',
UserPoolId: 'eu-central-1_qqle3XBUA',
CreationDate: 1743068959.243,
LastModifiedDate: 1743068959.243,
},
});
});
new NodeTestHarness().setupTests({
workflowFiles: ['delete.workflow.json'],
credentials: {
aws: {
region: 'eu-central-1',
accessKeyId: 'test',
secretAccessKey: 'test',
},
},
});
});

View File

@@ -0,0 +1,44 @@
{
"nodes": [
{
"parameters": {
"resource": "group",
"operation": "delete",
"userPool": {
"__rl": true,
"value": "eu-central-1_qqle3XBUA",
"mode": "list",
"cachedResultName": "UserPoolThree"
},
"group": {
"__rl": true,
"value": "MyNewGroup22",
"mode": "list",
"cachedResultName": "MyNewGroup22"
},
"requestOptions": {}
},
"type": "n8n-nodes-base.awsCognito",
"typeVersion": 1,
"position": [200, 1300],
"id": "ece9e04f-305c-45ed-afc6-34d34303f8b0",
"name": "AWS Cognito1",
"credentials": {
"aws": {
"id": "testId",
"name": "AWS account Central Europe"
}
}
}
],
"connections": {},
"pinData": {
"AWS Cognito1": [
{
"json": {
"deleted": true
}
}
]
}
}

View File

@@ -0,0 +1,86 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('AWS Cognito - Get Group', () => {
beforeEach(() => {
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_qqle3XBUA',
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.DescribeUserPool')
.reply(200, {
UserPool: {
Arn: 'arn:aws:cognito-idp:eu-central-1:123456789012:userpool/eu-central-1_qqle3XBUA',
CreationDate: 1739530218.869,
DeletionProtection: 'INACTIVE',
EstimatedNumberOfUsers: 4,
Id: 'eu-central-1_qqle3XBUA',
LastModifiedDate: 1739530218.869,
MfaConfiguration: 'OFF',
Name: 'UserPoolThree',
},
});
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_qqle3XBUA',
Limit: 50,
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListGroups')
.reply(200, {
Groups: [
{
CreationDate: 1741609269.287,
GroupName: 'MyNewGroup2',
LastModifiedDate: 1741609269.287,
UserPoolId: 'eu-central-1_qqle3XBUA',
},
],
});
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_qqle3XBUA',
GroupName: 'MyNewGroup2',
Limit: 50,
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsersInGroup')
.reply(200, {
Users: [],
});
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_qqle3XBUA',
GroupName: 'MyNewGroup2',
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.GetGroup')
.reply(200, {
Group: {
CreationDate: 1741609269.287,
GroupName: 'MyNewGroup2',
LastModifiedDate: 1741609269.287,
UserPoolId: 'eu-central-1_qqle3XBUA',
},
});
});
new NodeTestHarness().setupTests({
workflowFiles: ['get.workflow.json'],
credentials: {
aws: {
region: 'eu-central-1',
accessKeyId: 'test',
secretAccessKey: 'test',
},
},
});
});

View File

@@ -0,0 +1,47 @@
{
"nodes": [
{
"parameters": {
"resource": "group",
"operation": "get",
"userPool": {
"__rl": true,
"value": "eu-central-1_qqle3XBUA",
"mode": "list",
"cachedResultName": "UserPoolThree"
},
"group": {
"__rl": true,
"value": "MyNewGroup2",
"mode": "list",
"cachedResultName": "MyNewGroup2"
},
"requestOptions": {}
},
"type": "n8n-nodes-base.awsCognito",
"typeVersion": 1,
"position": [200, 1300],
"id": "ece9e04f-305c-45ed-afc6-34d34303f8b0",
"name": "AWS Cognito1",
"credentials": {
"aws": {
"id": "testId",
"name": "AWS account Central Europe"
}
}
}
],
"connections": {},
"pinData": {
"AWS Cognito1": [
{
"json": {
"CreationDate": 1741609269.287,
"GroupName": "MyNewGroup2",
"LastModifiedDate": 1741609269.287,
"UserPoolId": "eu-central-1_qqle3XBUA"
}
}
]
}
}

View File

@@ -0,0 +1,144 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('AWS Cognito - Get All Groups', () => {
beforeEach(() => {
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_KkXQgdCJv',
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListGroups')
.reply(200, {
Groups: [
{
GroupName: 'MyNewGroup',
Description: 'Updated',
CreationDate: 1732740693.563,
LastModifiedDate: 1733422336.443,
Precedence: 0,
RoleArn: 'arn:aws:iam::123456789012:group/Admins',
UserPoolId: 'eu-central-1_KkXQgdCJv',
Users: [
{
Username: 'user1',
Attributes: [{ Name: 'email', Value: 'user1@example.com' }],
},
{
Username: 'user2',
Attributes: [{ Name: 'email', Value: 'user2@example.com' }],
},
],
},
{
GroupName: 'MyNewTesttttt',
Description: 'Updated description',
CreationDate: 1733424987.825,
LastModifiedDate: 1741609241.742,
Precedence: 5,
UserPoolId: 'eu-central-1_KkXQgdCJv',
Users: [],
},
{
GroupName: 'MyNewTest1',
Description: 'test',
CreationDate: 1733398042.783,
LastModifiedDate: 1733691256.447,
Precedence: 5,
UserPoolId: 'eu-central-1_KkXQgdCJv',
Users: [],
},
],
});
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_KkXQgdCJv',
GroupName: 'MyNewGroup',
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsersInGroup')
.reply(200, {
Users: [],
});
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_KkXQgdCJv',
GroupName: 'MyNewTesttttt',
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsersInGroup')
.reply(200, {
Users: [],
});
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_KkXQgdCJv',
GroupName: 'MyNewTest1',
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListUsersInGroup')
.reply(200, {
Users: [],
});
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_KkXQgdCJv',
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.ListGroups')
.reply(200, {
Groups: [
{
GroupName: 'MyNewGroup',
Description: 'Updated',
CreationDate: 1732740693.563,
LastModifiedDate: 1733422336.443,
Precedence: 0,
RoleArn: 'arn:aws:iam::123456789012:group/Admins',
UserPoolId: 'eu-central-1_KkXQgdCJv',
Users: [],
},
{
GroupName: 'MyNewTesttttt',
Description: 'Updated description',
CreationDate: 1733424987.825,
LastModifiedDate: 1741609241.742,
Precedence: 5,
UserPoolId: 'eu-central-1_KkXQgdCJv',
Users: [],
},
{
GroupName: 'MyNewTest1',
Description: 'test',
CreationDate: 1733398042.783,
LastModifiedDate: 1733691256.447,
Precedence: 5,
UserPoolId: 'eu-central-1_KkXQgdCJv',
Users: [],
},
],
});
});
new NodeTestHarness().setupTests({
workflowFiles: ['getAll.workflow.json'],
credentials: {
aws: {
region: 'eu-central-1',
accessKeyId: 'test',
secretAccessKey: 'test',
},
},
});
});

View File

@@ -0,0 +1,89 @@
{
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [260, 360],
"id": "9ed2b86b-7c24-4ea0-a328-92d9e6dba35a",
"name": "When clicking Execute workflow"
},
{
"parameters": {
"resource": "group",
"userPool": {
"__rl": true,
"value": "eu-central-1_KkXQgdCJv",
"mode": "list",
"cachedResultName": "AWS test"
},
"returnAll": true,
"includeUsers": true,
"requestOptions": {}
},
"id": "f1d96de9-a43f-4452-8760-94fc13990e0b",
"name": "getAllGroups",
"type": "n8n-nodes-base.awsCognito",
"typeVersion": 1,
"position": [460, 360],
"alwaysOutputData": true,
"credentials": {
"aws": {
"id": "testId",
"name": "AWS account Central Europe"
}
}
}
],
"pinData": {
"getAllGroups": [
{
"json": {
"CreationDate": 1732740693.563,
"Description": "Updated",
"GroupName": "MyNewGroup",
"LastModifiedDate": 1733422336.443,
"Precedence": 0,
"RoleArn": "arn:aws:iam::123456789012:group/Admins",
"UserPoolId": "eu-central-1_KkXQgdCJv",
"Users": []
}
},
{
"json": {
"CreationDate": 1733424987.825,
"Description": "Updated description",
"GroupName": "MyNewTesttttt",
"LastModifiedDate": 1741609241.742,
"Precedence": 5,
"UserPoolId": "eu-central-1_KkXQgdCJv",
"Users": []
}
},
{
"json": {
"CreationDate": 1733398042.783,
"Description": "test",
"GroupName": "MyNewTest1",
"LastModifiedDate": 1733691256.447,
"Precedence": 5,
"UserPoolId": "eu-central-1_KkXQgdCJv",
"Users": []
}
}
]
},
"connections": {
"When clicking Execute workflow": {
"main": [
[
{
"node": "getAllGroups",
"type": "main",
"index": 0
}
]
]
}
}
}

View File

@@ -0,0 +1,36 @@
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
import nock from 'nock';
describe('AWS Cognito - Update Group', () => {
beforeEach(() => {
const baseUrl = 'https://cognito-idp.eu-central-1.amazonaws.com/';
nock(baseUrl)
.persist()
.defaultReplyHeaders({ 'Content-Type': 'application/x-amz-json-1.1' })
.post('/', {
UserPoolId: 'eu-central-1_KkXQgdCJv',
GroupName: 'MyNewTesttttt',
Description: 'Updated description',
})
.matchHeader('x-amz-target', 'AWSCognitoIdentityProviderService.UpdateGroup')
.reply(200, {
Group: {
GroupName: 'MyNewTesttttt',
UserPoolId: 'eu-central-1_KkXQgdCJv',
Description: 'Updated description',
},
});
});
new NodeTestHarness().setupTests({
workflowFiles: ['update.workflow.json'],
credentials: {
aws: {
region: 'eu-central-1',
accessKeyId: 'test',
secretAccessKey: 'test',
},
},
});
});

View File

@@ -0,0 +1,67 @@
{
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [-80, -100],
"id": "7da2ce49-9a9d-4240-b082-ff1b12d101b1",
"name": "When clicking Execute workflow"
},
{
"parameters": {
"resource": "group",
"operation": "update",
"userPool": {
"__rl": true,
"value": "eu-central-1_KkXQgdCJv",
"mode": "list",
"cachedResultName": "AWS test"
},
"group": {
"__rl": true,
"value": "MyNewTesttttt",
"mode": "list",
"cachedResultName": "MyNewTesttttt"
},
"additionalFields": {
"description": "Updated description"
},
"requestOptions": {}
},
"id": "fd0610c8-9af2-4ca5-943f-f0de5d897fc0",
"name": "updateGroup",
"type": "n8n-nodes-base.awsCognito",
"typeVersion": 1,
"position": [160, -100],
"credentials": {
"aws": {
"id": "testId",
"name": "AWS account Central Europe"
}
}
}
],
"connections": {
"When clicking Execute workflow": {
"main": [
[
{
"node": "updateGroup",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {
"updateGroup": [
{
"json": {
"updated": true
}
}
]
}
}