n8n-nodes-themq 0.9.0 → 0.9.1

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.

Potentially problematic release.


This version of n8n-nodes-themq might be problematic. Click here for more details.

package/README.md CHANGED
@@ -10,6 +10,7 @@ a lightweight, Redis-backed message broker built around queues and consumers.
10
10
  consumer connection.
11
11
  - **TheMQ Publish** publishes messages and applies clear on-queue / processing rules.
12
12
  - **TheMQ Ack** acknowledges a trigger-delivered message.
13
+ - **TheMQ Delete** removes a message with per-scenario choices.
13
14
 
14
15
  ## Requirements
15
16
 
@@ -166,7 +167,7 @@ Redis or pin `API_TOKEN`.
166
167
  ## Upgrading
167
168
 
168
169
  The package keeps the existing node types (`theMq`, `theMqTrigger`, and the new
169
- `theMqAck`). Existing workflows do not need to be removed and re-added.
170
+ `theMqAck`, `theMqDelete`). Existing workflows do not need to be removed and re-added.
170
171
  Existing `theMq` nodes stay on version 1; after updating the package, use
171
172
  n8n's node-version control to move to version 2 when you want the simplified
172
173
  Publish settings. Version 1 `publish`, `ack`, `requeue`, and `delete` workflows
@@ -216,6 +217,18 @@ Simple acknowledgement node for a trigger-delivered message. **Queue** and
216
217
  **Message ID** default to the trigger item. It marks the message successfully
217
218
  processed and resolves a waiting trigger.
218
219
 
220
+ ## TheMQ Delete
221
+
222
+ Remove a message from a queue. **Queue** and **Message ID** are explicit.
223
+
224
+ - `not_exist` → **skip**
225
+ - `on_queue` → **delete** a waiting message
226
+ - `processing` → choose **skip**, **cancel_ack**, or **cancel_requeue**
227
+
228
+ `cancel_ack` cancels the currently executing n8n workflow and acknowledges the
229
+ message without requeueing. `cancel_requeue` cancels execution and puts the
230
+ message back on queue. In both cases no downstream nodes run.
231
+
219
232
  ## Examples
220
233
 
221
234
  ### Publish on a schedule
@@ -0,0 +1,6 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from "n8n-workflow";
2
+ /** Delete a message, or explicitly choose what happens when it is leased. */
3
+ export declare class TheMqDelete implements INodeType {
4
+ description: INodeTypeDescription;
5
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
6
+ }
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TheMqDelete = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const errors_js_1 = require("../shared/errors.js");
6
+ const http_js_1 = require("../shared/http.js");
7
+ const request_js_1 = require("../shared/request.js");
8
+ const params_js_1 = require("../shared/params.js");
9
+ /** Delete a message, or explicitly choose what happens when it is leased. */
10
+ class TheMqDelete {
11
+ constructor() {
12
+ this.description = {
13
+ displayName: "TheMQ Delete",
14
+ name: "theMqDelete",
15
+ icon: "file:themq.png",
16
+ group: ["transform"],
17
+ version: 1,
18
+ description: "Remove a message from a queue and choose what happens in every message state",
19
+ defaults: { name: "TheMQ Delete" },
20
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
21
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
22
+ credentials: [{ name: "theMqApi", required: true }],
23
+ properties: [
24
+ {
25
+ displayName: "Queue",
26
+ name: "queue",
27
+ type: "string",
28
+ default: "={{ $json.queue }}",
29
+ required: true,
30
+ },
31
+ {
32
+ displayName: "Message ID",
33
+ name: "messageId",
34
+ type: "string",
35
+ default: "={{ $json.messageId }}",
36
+ required: true,
37
+ },
38
+ {
39
+ displayName: "If the message does not exist",
40
+ name: "not_exist",
41
+ type: "options",
42
+ default: "skip",
43
+ options: [{ name: "Skip", value: "skip", description: "Do nothing." }],
44
+ },
45
+ {
46
+ displayName: "If the message is on queue",
47
+ name: "on_queue",
48
+ type: "options",
49
+ default: "delete",
50
+ options: [{ name: "Delete", value: "delete", description: "Remove the waiting message." }],
51
+ },
52
+ {
53
+ displayName: "If the message is processing",
54
+ name: "processing",
55
+ type: "options",
56
+ default: "skip",
57
+ options: [
58
+ { name: "Skip", value: "skip", description: "Do nothing." },
59
+ {
60
+ name: "Cancel execution + ack",
61
+ value: "cancel_ack",
62
+ description: "Cancel the processing n8n execution and acknowledge the message; it is not requeued.",
63
+ },
64
+ {
65
+ name: "Cancel execution + requeue",
66
+ value: "cancel_requeue",
67
+ description: "Cancel the processing n8n execution and put the message back on queue.",
68
+ },
69
+ ],
70
+ },
71
+ ],
72
+ };
73
+ }
74
+ async execute() {
75
+ var _a;
76
+ const items = this.getInputData();
77
+ const returnData = [];
78
+ for (let i = 0; i < items.length; i += 1) {
79
+ const queue = (0, params_js_1.strParam)(this.getNodeParameter("queue", i, ""), "").trim();
80
+ const messageId = (0, params_js_1.strParam)(this.getNodeParameter("messageId", i, ""), "").trim();
81
+ if (queue === "")
82
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Queue is required.", { itemIndex: i });
83
+ if (messageId === "")
84
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Message ID is required.", { itemIndex: i });
85
+ const processing = parseProcessing(this.getNodeParameter("processing", i, "skip"));
86
+ const requestContext = { itemIndex: i, operation: "delete", queue, messageId };
87
+ const current = await fetchMessage(this, queue, messageId, requestContext);
88
+ // not_exist → skip
89
+ if (current === undefined) {
90
+ returnData.push({
91
+ json: { queue, messageId, deleted: false, skipped: true, state: "not_exist" },
92
+ pairedItem: { item: i },
93
+ });
94
+ continue;
95
+ }
96
+ const state = (0, params_js_1.strParam)(current["state"], "");
97
+ if (state === "unacked") {
98
+ if (processing === "skip") {
99
+ returnData.push({
100
+ json: { queue, messageId, deleted: false, skipped: true, state },
101
+ pairedItem: { item: i },
102
+ });
103
+ continue;
104
+ }
105
+ // TheMQ only permits DELETE on waiting messages. Settle the
106
+ // lease first; ack removes it, requeue places it back on queue.
107
+ if (processing === "cancel_ack") {
108
+ await (0, request_js_1.requestTheMq)(this, "POST", (0, http_js_1.messageActionPath)(queue, messageId, "ack"), undefined, {
109
+ ...requestContext,
110
+ operation: "ack",
111
+ });
112
+ }
113
+ else {
114
+ await (0, request_js_1.requestTheMq)(this, "POST", (0, http_js_1.messageActionPath)(queue, messageId, "requeue"), {}, { ...requestContext, operation: "requeue" });
115
+ }
116
+ // This cancels the currently executing n8n workflow and stops
117
+ // every downstream node. No extra TheMQ mutation is performed.
118
+ throw new n8n_workflow_1.ManualExecutionCancelledError((_a = this.getExecutionId()) !== null && _a !== void 0 ? _a : "unknown");
119
+ }
120
+ // on_queue → delete a waiting (ready/delayed) message.
121
+ await (0, request_js_1.requestTheMq)(this, "DELETE", (0, http_js_1.messagePath)(queue, messageId), undefined, requestContext);
122
+ returnData.push({
123
+ json: { queue, messageId, deleted: true, previousState: state },
124
+ pairedItem: { item: i },
125
+ });
126
+ }
127
+ return [returnData];
128
+ }
129
+ }
130
+ exports.TheMqDelete = TheMqDelete;
131
+ async function fetchMessage(context, queue, messageId, requestContext) {
132
+ try {
133
+ return (0, params_js_1.toDataObject)(await (0, request_js_1.requestTheMq)(context, "GET", (0, http_js_1.messagePath)(queue, messageId), undefined, requestContext));
134
+ }
135
+ catch (error) {
136
+ if ((0, errors_js_1.apiCodeOf)(error) === "NOT_FOUND")
137
+ return undefined;
138
+ throw error;
139
+ }
140
+ }
141
+ function parseProcessing(value) {
142
+ return value === "cancel_ack" || value === "cancel_requeue" ? value : "skip";
143
+ }
144
+ //# sourceMappingURL=TheMqDelete.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TheMqDelete.node.js","sourceRoot":"","sources":["../../../nodes/TheMqDelete/TheMqDelete.node.ts"],"names":[],"mappings":";;;AAOA,+CAIsB;AACtB,mDAAgD;AAChD,+CAAmE;AACnE,qDAAoD;AACpD,mDAA6D;AAI7D,6EAA6E;AAC7E,MAAa,WAAW;IAAxB;QACE,gBAAW,GAAyB;YAClC,WAAW,EAAE,cAAc;YAC3B,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,gBAAgB;YACtB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,8EAA8E;YAC3F,QA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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-themq",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Native n8n community nodes for TheMQ — a lightweight, Redis-backed queue/consumer message broker.",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",
@@ -22,7 +22,7 @@
22
22
  "main": "dist/index.js",
23
23
  "scripts": {
24
24
  "build": "tsc -p tsconfig.json && npm run copy:icons",
25
- "copy:icons": "mkdir -p dist/nodes/TheMq dist/nodes/TheMqAck dist/nodes/TheMqTrigger && cp nodes/TheMq/themq.png dist/nodes/TheMq/themq.png && cp nodes/TheMqAck/themq.png dist/nodes/TheMqAck/themq.png && cp nodes/TheMqTrigger/themq.png dist/nodes/TheMqTrigger/themq.png",
25
+ "copy:icons": "mkdir -p dist/nodes/TheMq dist/nodes/TheMqAck dist/nodes/TheMqDelete dist/nodes/TheMqTrigger && cp nodes/TheMq/themq.png dist/nodes/TheMq/themq.png && cp nodes/TheMqAck/themq.png dist/nodes/TheMqAck/themq.png && cp nodes/TheMqDelete/themq.png dist/nodes/TheMqDelete/themq.png && cp nodes/TheMqTrigger/themq.png dist/nodes/TheMqTrigger/themq.png",
26
26
  "typecheck": "tsc --noEmit -p tsconfig.json",
27
27
  "test": "npm run build && node --test tests/*.test.cjs",
28
28
  "lint": "eslint credentials nodes index.ts",
@@ -41,6 +41,7 @@
41
41
  "nodes": [
42
42
  "dist/nodes/TheMq/TheMq.node.js",
43
43
  "dist/nodes/TheMqAck/TheMqAck.node.js",
44
+ "dist/nodes/TheMqDelete/TheMqDelete.node.js",
44
45
  "dist/nodes/TheMqTrigger/TheMqTrigger.node.js"
45
46
  ]
46
47
  },