@thecodigohub/n8n-nodes-insightshub 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +30 -0
- package/README.md +24 -0
- package/dist/InsightsHub.credentials.d.ts +14 -0
- package/dist/InsightsHub.credentials.d.ts.map +1 -0
- package/dist/InsightsHub.credentials.js +21 -0
- package/dist/InsightsHub.credentials.js.map +1 -0
- package/dist/InsightsHub.node.d.ts +6 -0
- package/dist/InsightsHub.node.d.ts.map +1 -0
- package/dist/InsightsHub.node.js +90 -0
- package/dist/InsightsHub.node.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/insightsHub.svg +3 -0
- package/package.json +46 -0
- package/src/InsightsHub.credentials.ts +19 -0
- package/src/InsightsHub.node.ts +95 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Node.js Package
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 22
|
|
18
|
+
- run: npm ci
|
|
19
|
+
|
|
20
|
+
publish-npm:
|
|
21
|
+
needs: build
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
- uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: 22
|
|
28
|
+
registry-url: https://registry.npmjs.org/
|
|
29
|
+
- run: npm ci
|
|
30
|
+
- run: npm publish
|
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Insights Hub N8N Node
|
|
2
|
+
|
|
3
|
+
This is a custom n8n node for connecting to Insights Hub, an internal project for displaying dashboards.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
1. Clone this repository.
|
|
8
|
+
2. Run `npm install` to install dependencies.
|
|
9
|
+
3. Run `npm run build` to compile the TypeScript code.
|
|
10
|
+
4. Copy the `dist` folder to your n8n custom nodes directory.
|
|
11
|
+
5. Restart n8n.
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
- **Project Name**: The name of the project in Insights Hub.
|
|
16
|
+
- **API Token**: Obtained from Insights Hub settings, configured as a credential.
|
|
17
|
+
|
|
18
|
+
## Operations
|
|
19
|
+
|
|
20
|
+
- **Get Dashboard**: Fetches dashboard data for the specified project.
|
|
21
|
+
|
|
22
|
+
## Future Enhancements
|
|
23
|
+
|
|
24
|
+
Additional fields and operations can be added as needed.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ICredentialType, NodePropertyTypes } from 'n8n-workflow';
|
|
2
|
+
export declare class InsightsHubApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: {
|
|
7
|
+
displayName: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: NodePropertyTypes;
|
|
10
|
+
default: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=InsightsHub.credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightsHub.credentials.d.ts","sourceRoot":"","sources":["../src/InsightsHub.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,iBAAiB,EACjB,MAAM,cAAc,CAAC;AAEtB,qBAAa,cAAe,YAAW,eAAe;IACrD,IAAI,SAAoB;IACxB,WAAW,SAAsB;IACjC,gBAAgB,SAAwC;IACxD,UAAU;;;cAIU,iBAAiB;;;QAInC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsightsHubApi = void 0;
|
|
4
|
+
class InsightsHubApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'insightsHubApi';
|
|
7
|
+
this.displayName = 'Insights Hub API';
|
|
8
|
+
this.documentationUrl = 'https://insights-hub.internal/docs'; // Placeholder
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'API Token',
|
|
12
|
+
name: 'apiToken',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: '',
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.InsightsHubApi = InsightsHubApi;
|
|
21
|
+
//# sourceMappingURL=InsightsHub.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightsHub.credentials.js","sourceRoot":"","sources":["../src/InsightsHub.credentials.ts"],"names":[],"mappings":";;;AAKA,MAAa,cAAc;IAA3B;QACC,SAAI,GAAG,gBAAgB,CAAC;QACxB,gBAAW,GAAG,kBAAkB,CAAC;QACjC,qBAAgB,GAAG,oCAAoC,CAAC,CAAC,cAAc;QACvE,eAAU,GAAG;YACZ;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAA6B;gBACnC,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;IACH,CAAC;CAAA;AAbD,wCAaC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class InsightsHubNode implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=InsightsHub.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightsHub.node.d.ts","sourceRoot":"","sources":["../src/InsightsHub.node.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EAEpB,MAAM,cAAc,CAAC;AAEtB,qBAAa,eAAgB,YAAW,SAAS;IAChD,WAAW,EAAE,oBAAoB,CA4C/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAuCvE"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsightsHubNode = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
class InsightsHubNode {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Insights Hub',
|
|
9
|
+
name: 'insightsHub',
|
|
10
|
+
icon: 'file:insightsHub.svg', // Placeholder icon
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
description: 'Connect to Insights Hub to fetch dashboard data',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Insights Hub',
|
|
16
|
+
},
|
|
17
|
+
inputs: ['main'],
|
|
18
|
+
outputs: ['main'],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'insightsHubApi',
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
properties: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Project Name',
|
|
28
|
+
name: 'projectName',
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: '',
|
|
31
|
+
placeholder: 'Enter the project name',
|
|
32
|
+
description: 'The name of the project in Insights Hub',
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Operation',
|
|
37
|
+
name: 'operation',
|
|
38
|
+
type: 'options',
|
|
39
|
+
options: [
|
|
40
|
+
{
|
|
41
|
+
name: 'Get Dashboard',
|
|
42
|
+
value: 'getDashboard',
|
|
43
|
+
description: 'Fetch dashboard data',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
default: 'getDashboard',
|
|
47
|
+
description: 'The operation to perform',
|
|
48
|
+
},
|
|
49
|
+
// Add more fields here as needed
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async execute() {
|
|
54
|
+
const items = this.getInputData();
|
|
55
|
+
const returnData = [];
|
|
56
|
+
const credentials = await this.getCredentials('insightsHubApi');
|
|
57
|
+
const apiToken = credentials.apiToken;
|
|
58
|
+
for (let i = 0; i < items.length; i++) {
|
|
59
|
+
try {
|
|
60
|
+
const projectName = this.getNodeParameter('projectName', i);
|
|
61
|
+
const operation = this.getNodeParameter('operation', i);
|
|
62
|
+
if (operation === 'getDashboard') {
|
|
63
|
+
// Placeholder: Assume API endpoint is something like https://insights-hub.internal/api/projects/{projectName}/dashboard
|
|
64
|
+
// In real implementation, make HTTP request
|
|
65
|
+
const response = {
|
|
66
|
+
project: projectName,
|
|
67
|
+
data: 'Sample dashboard data', // Replace with actual API call
|
|
68
|
+
};
|
|
69
|
+
returnData.push({
|
|
70
|
+
json: response,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (this.continueOnFail()) {
|
|
76
|
+
returnData.push({
|
|
77
|
+
json: { error: error instanceof Error ? error.message : String(error) },
|
|
78
|
+
});
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error instanceof Error ? error : new Error(String(error)), {
|
|
82
|
+
itemIndex: i,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return [returnData];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.InsightsHubNode = InsightsHubNode;
|
|
90
|
+
//# sourceMappingURL=InsightsHub.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InsightsHub.node.js","sourceRoot":"","sources":["../src/InsightsHub.node.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsightsHubApi = exports.InsightsHubNode = void 0;
|
|
4
|
+
const InsightsHub_node_1 = require("./InsightsHub.node");
|
|
5
|
+
Object.defineProperty(exports, "InsightsHubNode", { enumerable: true, get: function () { return InsightsHub_node_1.InsightsHubNode; } });
|
|
6
|
+
const InsightsHub_credentials_1 = require("./InsightsHub.credentials");
|
|
7
|
+
Object.defineProperty(exports, "InsightsHubApi", { enumerable: true, get: function () { return InsightsHub_credentials_1.InsightsHubApi; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAAqD;AAG5C,gGAHA,kCAAe,OAGA;AAFxB,uEAA2D;AAEjC,+FAFjB,wCAAc,OAEiB"}
|
package/insightsHub.svg
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thecodigohub/n8n-nodes-insightshub",
|
|
3
|
+
"version": "0.0.6",
|
|
4
|
+
"description": "Custom n8n node for Insights Hub",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"dev": "tsc --watch",
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/The-Codigo-Hub/InsightsHub-N8N.git"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"n8n",
|
|
17
|
+
"insights",
|
|
18
|
+
"hub",
|
|
19
|
+
"dashboard"
|
|
20
|
+
],
|
|
21
|
+
"author": "",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"type": "commonjs",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/The-Codigo-Hub/InsightsHub-N8N/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/The-Codigo-Hub/InsightsHub-N8N#readme",
|
|
28
|
+
"n8n": {
|
|
29
|
+
"n8nNodesApiVersion": 1,
|
|
30
|
+
"credentials": [
|
|
31
|
+
"dist/InsightsHub.credentials.js"
|
|
32
|
+
],
|
|
33
|
+
"nodes": [
|
|
34
|
+
"dist/InsightsHub.node.js"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@types/node": "^25.6.0",
|
|
42
|
+
"n8n-core": "^2.16.1",
|
|
43
|
+
"n8n-workflow": "^2.16.0",
|
|
44
|
+
"typescript": "^6.0.3"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ICredentialType,
|
|
3
|
+
NodePropertyTypes,
|
|
4
|
+
} from 'n8n-workflow';
|
|
5
|
+
|
|
6
|
+
export class InsightsHubApi implements ICredentialType {
|
|
7
|
+
name = 'insightsHubApi';
|
|
8
|
+
displayName = 'Insights Hub API';
|
|
9
|
+
documentationUrl = 'https://insights-hub.internal/docs'; // Placeholder
|
|
10
|
+
properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Token',
|
|
13
|
+
name: 'apiToken',
|
|
14
|
+
type: 'string' as NodePropertyTypes,
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IExecuteFunctions,
|
|
3
|
+
INodeExecutionData,
|
|
4
|
+
INodeType,
|
|
5
|
+
INodeTypeDescription,
|
|
6
|
+
NodeOperationError,
|
|
7
|
+
} from 'n8n-workflow';
|
|
8
|
+
|
|
9
|
+
export class InsightsHubNode implements INodeType {
|
|
10
|
+
description: INodeTypeDescription = {
|
|
11
|
+
displayName: 'Insights Hub',
|
|
12
|
+
name: 'insightsHub',
|
|
13
|
+
icon: 'file:insightsHub.svg', // Placeholder icon
|
|
14
|
+
group: ['transform'],
|
|
15
|
+
version: 1,
|
|
16
|
+
description: 'Connect to Insights Hub to fetch dashboard data',
|
|
17
|
+
defaults: {
|
|
18
|
+
name: 'Insights Hub',
|
|
19
|
+
},
|
|
20
|
+
inputs: ['main'],
|
|
21
|
+
outputs: ['main'],
|
|
22
|
+
credentials: [
|
|
23
|
+
{
|
|
24
|
+
name: 'insightsHubApi',
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
properties: [
|
|
29
|
+
{
|
|
30
|
+
displayName: 'Project Name',
|
|
31
|
+
name: 'projectName',
|
|
32
|
+
type: 'string',
|
|
33
|
+
default: '',
|
|
34
|
+
placeholder: 'Enter the project name',
|
|
35
|
+
description: 'The name of the project in Insights Hub',
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
displayName: 'Operation',
|
|
40
|
+
name: 'operation',
|
|
41
|
+
type: 'options',
|
|
42
|
+
options: [
|
|
43
|
+
{
|
|
44
|
+
name: 'Get Dashboard',
|
|
45
|
+
value: 'getDashboard',
|
|
46
|
+
description: 'Fetch dashboard data',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
default: 'getDashboard',
|
|
50
|
+
description: 'The operation to perform',
|
|
51
|
+
},
|
|
52
|
+
// Add more fields here as needed
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
57
|
+
const items = this.getInputData();
|
|
58
|
+
const returnData: INodeExecutionData[] = [];
|
|
59
|
+
|
|
60
|
+
const credentials = await this.getCredentials('insightsHubApi');
|
|
61
|
+
const apiToken = credentials.apiToken as string;
|
|
62
|
+
|
|
63
|
+
for (let i = 0; i < items.length; i++) {
|
|
64
|
+
try {
|
|
65
|
+
const projectName = this.getNodeParameter('projectName', i) as string;
|
|
66
|
+
const operation = this.getNodeParameter('operation', i) as string;
|
|
67
|
+
|
|
68
|
+
if (operation === 'getDashboard') {
|
|
69
|
+
// Placeholder: Assume API endpoint is something like https://insights-hub.internal/api/projects/{projectName}/dashboard
|
|
70
|
+
// In real implementation, make HTTP request
|
|
71
|
+
const response = {
|
|
72
|
+
project: projectName,
|
|
73
|
+
data: 'Sample dashboard data', // Replace with actual API call
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
returnData.push({
|
|
77
|
+
json: response,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if (this.continueOnFail()) {
|
|
82
|
+
returnData.push({
|
|
83
|
+
json: { error: error instanceof Error ? error.message : String(error) },
|
|
84
|
+
});
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
throw new NodeOperationError(this.getNode(), error instanceof Error ? error : new Error(String(error)), {
|
|
88
|
+
itemIndex: i,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return [returnData];
|
|
94
|
+
}
|
|
95
|
+
}
|
package/src/index.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"target": "es2019",
|
|
5
|
+
"lib": ["es2019"],
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*"],
|
|
17
|
+
"exclude": ["node_modules", "dist"]
|
|
18
|
+
}
|