n8n-nodes-linq 0.1.16 → 3.0.0
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/LICENSE.md +20 -20
- package/README.md +194 -193
- package/dist/credentials/LinqApi.credentials.d.ts +8 -0
- package/dist/credentials/LinqApi.credentials.js +10 -2
- package/dist/nodes/Linq/Linq.node.js +237 -93
- package/dist/nodes/LinqTrigger/LinqTrigger.node.d.ts +2 -2
- package/dist/nodes/LinqTrigger/LinqTrigger.node.js +78 -19
- package/index.js +1 -1
- package/package.json +59 -54
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.LinqTrigger = void 0;
|
|
4
37
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
38
|
+
const crypto = __importStar(require("crypto"));
|
|
5
39
|
class LinqTrigger {
|
|
6
40
|
constructor() {
|
|
7
41
|
this.description = {
|
|
@@ -74,31 +108,56 @@ class LinqTrigger {
|
|
|
74
108
|
};
|
|
75
109
|
}
|
|
76
110
|
async webhook() {
|
|
77
|
-
const
|
|
111
|
+
const req = this.getRequestObject();
|
|
78
112
|
const headers = this.getHeaderData();
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
113
|
+
const bodyData = this.getBodyData();
|
|
114
|
+
// 1. Validate and Parse Signature Header
|
|
115
|
+
const signatureHeader = headers['x-webhook-signature'];
|
|
116
|
+
if (!signatureHeader) {
|
|
117
|
+
throw new n8n_workflow_1.ApplicationError('Missing X-Webhook-Signature header');
|
|
118
|
+
}
|
|
119
|
+
const [scheme, signature] = signatureHeader.split('=');
|
|
120
|
+
if (scheme !== 'sha256' || !signature) {
|
|
121
|
+
throw new n8n_workflow_1.ApplicationError('Invalid signature format');
|
|
122
|
+
}
|
|
123
|
+
// 2. Verify HMAC Signature
|
|
82
124
|
const credentials = await this.getCredentials('linqApi');
|
|
83
|
-
const
|
|
125
|
+
const token = credentials.integrationToken;
|
|
126
|
+
// Use rawBody for accurate HMAC verification
|
|
127
|
+
const rawBody = req.rawBody;
|
|
128
|
+
if (!rawBody) {
|
|
129
|
+
console.warn('LinqTrigger: rawBody is missing, falling back to JSON.stringify. Signature verification might fail.');
|
|
130
|
+
}
|
|
131
|
+
const payloadToHash = rawBody || JSON.stringify(bodyData);
|
|
84
132
|
const expectedSignature = crypto
|
|
85
|
-
.createHmac('sha256',
|
|
86
|
-
.update(
|
|
87
|
-
.digest(
|
|
88
|
-
|
|
133
|
+
.createHmac('sha256', token)
|
|
134
|
+
.update(payloadToHash)
|
|
135
|
+
.digest();
|
|
136
|
+
const sourceSignature = Buffer.from(signature, 'hex');
|
|
137
|
+
if (sourceSignature.length !== expectedSignature.length || !crypto.timingSafeEqual(sourceSignature, expectedSignature)) {
|
|
89
138
|
throw new n8n_workflow_1.ApplicationError('Invalid signature');
|
|
90
139
|
}
|
|
91
|
-
//
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
140
|
+
// 3. Event Filtering
|
|
141
|
+
const events = this.getNodeParameter('events', []);
|
|
142
|
+
const incomingEvent = bodyData.event;
|
|
143
|
+
// Filter if events are specified
|
|
144
|
+
if (events.length > 0 && !events.includes(incomingEvent)) {
|
|
145
|
+
return {};
|
|
146
|
+
}
|
|
147
|
+
// 4. Extract Payload
|
|
148
|
+
// The V3 structure is { event: string, payload: object }
|
|
149
|
+
const { payload } = bodyData;
|
|
100
150
|
return {
|
|
101
|
-
workflowData: [
|
|
151
|
+
workflowData: [
|
|
152
|
+
[
|
|
153
|
+
{
|
|
154
|
+
json: {
|
|
155
|
+
event: incomingEvent,
|
|
156
|
+
...payload,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
],
|
|
102
161
|
};
|
|
103
162
|
}
|
|
104
163
|
}
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// This file is intentionally left blank.
|
|
1
|
+
// This file is intentionally left blank.
|
|
2
2
|
// It is required by n8n for community nodes.
|
package/package.json
CHANGED
|
@@ -1,54 +1,59 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "n8n-nodes-linq",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Linq API integration for n8n",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"n8n-community-node-package",
|
|
7
|
-
"n8n",
|
|
8
|
-
"linq",
|
|
9
|
-
"automation"
|
|
10
|
-
],
|
|
11
|
-
"license": "MIT",
|
|
12
|
-
"homepage": "https://www.npmjs.com/package/n8n-nodes-linq",
|
|
13
|
-
"author": {
|
|
14
|
-
"name": "alexautomates"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "https://github.com/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
"dist/
|
|
41
|
-
]
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
"typescript": "
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-linq",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Linq API integration for n8n",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"linq",
|
|
9
|
+
"automation"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"homepage": "https://www.npmjs.com/package/n8n-nodes-linq",
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "alexautomates"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/AutomatorAlex/linq-n8n.git",
|
|
19
|
+
"directory": "n8n-nodes-linq"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/AutomatorAlex/linq-n8n/issues"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=20.15"
|
|
26
|
+
},
|
|
27
|
+
"main": "index.js",
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "npx rimraf dist && tsc && gulp build:icons",
|
|
30
|
+
"lint": "eslint nodes credentials",
|
|
31
|
+
"lintfix": "eslint nodes credentials --fix",
|
|
32
|
+
"prepublishOnly": "npm run build && npm run lint -c .eslintrc.prepublish.js nodes credentials"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"n8n": {
|
|
38
|
+
"n8nNodesApiVersion": 1,
|
|
39
|
+
"credentials": [
|
|
40
|
+
"dist/credentials/LinqApi.credentials.js"
|
|
41
|
+
],
|
|
42
|
+
"nodes": [
|
|
43
|
+
"dist/nodes/Linq/Linq.node.js",
|
|
44
|
+
"dist/nodes/LinqTrigger/LinqTrigger.node.js"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^24.3.3",
|
|
49
|
+
"@typescript-eslint/parser": "~8.32.0",
|
|
50
|
+
"eslint": "^8.57.0",
|
|
51
|
+
"eslint-plugin-n8n-nodes-base": "^1.16.3",
|
|
52
|
+
"gulp": "^5.0.0",
|
|
53
|
+
"prettier": "^3.5.3",
|
|
54
|
+
"typescript": "^5.8.2"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"n8n-workflow": "*"
|
|
58
|
+
}
|
|
59
|
+
}
|