n8n-nodes-bozonx-redis-sugar 1.7.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/README.md +130 -0
- package/dist/credentials/BozonxRedis.credentials.d.ts +8 -0
- package/dist/credentials/BozonxRedis.credentials.js +68 -0
- package/dist/credentials/BozonxRedis.credentials.js.map +1 -0
- package/dist/nodes/RedisCache/BozonxRedisCache.node.d.ts +10 -0
- package/dist/nodes/RedisCache/BozonxRedisCache.node.js +380 -0
- package/dist/nodes/RedisCache/BozonxRedisCache.node.js.map +1 -0
- package/dist/nodes/RedisCache/redis-cache.dark.svg +19 -0
- package/dist/nodes/RedisCache/redis-cache.svg +24 -0
- package/dist/nodes/RedisCache/redisClient.d.ts +20 -0
- package/dist/nodes/RedisCache/redisClient.js +95 -0
- package/dist/nodes/RedisCache/redisClient.js.map +1 -0
- package/dist/nodes/RedisStreamProducer/BozonxRedisStreamProducer.node.d.ts +5 -0
- package/dist/nodes/RedisStreamProducer/BozonxRedisStreamProducer.node.js +315 -0
- package/dist/nodes/RedisStreamProducer/BozonxRedisStreamProducer.node.js.map +1 -0
- package/dist/nodes/RedisStreamProducer/redis-stream-producer.dark.svg +18 -0
- package/dist/nodes/RedisStreamProducer/redis-stream-producer.svg +18 -0
- package/dist/nodes/RedisStreamProducer/redisClient.d.ts +9 -0
- package/dist/nodes/RedisStreamProducer/redisClient.js +70 -0
- package/dist/nodes/RedisStreamProducer/redisClient.js.map +1 -0
- package/dist/nodes/RedisStreamTrigger/BozonxRedisStreamTrigger.node.d.ts +5 -0
- package/dist/nodes/RedisStreamTrigger/BozonxRedisStreamTrigger.node.js +277 -0
- package/dist/nodes/RedisStreamTrigger/BozonxRedisStreamTrigger.node.js.map +1 -0
- package/dist/nodes/RedisStreamTrigger/redis-stream-trigger.dark.svg +19 -0
- package/dist/nodes/RedisStreamTrigger/redis-stream-trigger.svg +19 -0
- package/dist/package.json +53 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="64" height="64" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Redis Cache icon">
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="g" x1="0" y1="0" x2="0" y2="1">
|
|
5
|
+
<stop offset="0%" stop-color="#e34c4c"/>
|
|
6
|
+
<stop offset="100%" stop-color="#b92525"/>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
</defs>
|
|
9
|
+
<g fill="none" fill-rule="evenodd">
|
|
10
|
+
<!-- Top disk -->
|
|
11
|
+
<ellipse cx="32" cy="16" rx="22" ry="8" fill="url(#g)"/>
|
|
12
|
+
<!-- Middle body -->
|
|
13
|
+
<path d="M10 16v14c0 4.418 9.85 8 22 8s22-3.582 22-8V16c0 4.418-9.85 8-22 8S10 20.418 10 16z" fill="#c73737"/>
|
|
14
|
+
<!-- Second disk -->
|
|
15
|
+
<ellipse cx="32" cy="30" rx="22" ry="8" fill="url(#g)"/>
|
|
16
|
+
<!-- Bottom body -->
|
|
17
|
+
<path d="M10 30v14c0 4.418 9.85 8 22 8s22-3.582 22-8V30c0 4.418-9.85 8-22 8S10 34.418 10 30z" fill="#b12f2f"/>
|
|
18
|
+
<!-- Shine star -->
|
|
19
|
+
<polygon points="32,12 34,15 38,16 35,18 36,22 32,20 28,22 29,18 26,16 30,15" fill="#fff" opacity="0.9"/>
|
|
20
|
+
<text x="32" y="44" text-anchor="middle" font-family="Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif" font-size="10" font-weight="700" fill="#ffffff" stroke="#7a1d1d" stroke-width="0.8" paint-order="stroke">
|
|
21
|
+
cache
|
|
22
|
+
</text>
|
|
23
|
+
</g>
|
|
24
|
+
</svg>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface RedisConnectionOptions {
|
|
2
|
+
host: string;
|
|
3
|
+
port: number;
|
|
4
|
+
username?: string;
|
|
5
|
+
password?: string;
|
|
6
|
+
tls?: boolean;
|
|
7
|
+
db?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function ttlToSeconds(ttl: number, unit: 'seconds' | 'minutes' | 'hours' | 'days'): number;
|
|
10
|
+
type MinimalRedisClient = {
|
|
11
|
+
connect(): Promise<void>;
|
|
12
|
+
quit(): Promise<void>;
|
|
13
|
+
get(key: string): Promise<string | null>;
|
|
14
|
+
set(key: string, value: string, options?: {
|
|
15
|
+
EX?: number;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
destroy?: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare function createRedisClientConnected(options: RedisConnectionOptions): Promise<MinimalRedisClient>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ttlToSeconds = ttlToSeconds;
|
|
37
|
+
exports.createRedisClientConnected = createRedisClientConnected;
|
|
38
|
+
function ttlToSeconds(ttl, unit) {
|
|
39
|
+
if (!ttl || ttl <= 0)
|
|
40
|
+
return 0;
|
|
41
|
+
switch (unit) {
|
|
42
|
+
case 'seconds':
|
|
43
|
+
return ttl;
|
|
44
|
+
case 'minutes':
|
|
45
|
+
return ttl * 60;
|
|
46
|
+
case 'hours':
|
|
47
|
+
return ttl * 3600;
|
|
48
|
+
case 'days':
|
|
49
|
+
return ttl * 86400;
|
|
50
|
+
default:
|
|
51
|
+
return ttl;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function createRedisClientConnected(options) {
|
|
55
|
+
var _a;
|
|
56
|
+
const scheme = options.tls ? 'rediss' : 'redis';
|
|
57
|
+
const authPart = options.username
|
|
58
|
+
? `${encodeURIComponent(options.username)}:${encodeURIComponent((_a = options.password) !== null && _a !== void 0 ? _a : '')}@`
|
|
59
|
+
: options.password
|
|
60
|
+
? `:${encodeURIComponent(options.password)}@`
|
|
61
|
+
: '';
|
|
62
|
+
const dbPart = typeof options.db === 'number' ? `/${options.db}` : '';
|
|
63
|
+
const url = `${scheme}://${authPart}${options.host}:${options.port}${dbPart}`;
|
|
64
|
+
const { createClient } = await Promise.resolve().then(() => __importStar(require('redis')));
|
|
65
|
+
const clientImpl = createClient({ url });
|
|
66
|
+
await clientImpl.connect();
|
|
67
|
+
const client = {
|
|
68
|
+
async connect() { },
|
|
69
|
+
async quit() {
|
|
70
|
+
await clientImpl.quit();
|
|
71
|
+
},
|
|
72
|
+
async get(key) {
|
|
73
|
+
const value = await clientImpl.get(key);
|
|
74
|
+
return value !== null && value !== void 0 ? value : null;
|
|
75
|
+
},
|
|
76
|
+
async set(key, value, options) {
|
|
77
|
+
if ((options === null || options === void 0 ? void 0 : options.EX) && options.EX > 0) {
|
|
78
|
+
await clientImpl.set(key, value, { EX: options.EX });
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
await clientImpl.set(key, value);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
destroy() {
|
|
85
|
+
try {
|
|
86
|
+
clientImpl.disconnect();
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
void e;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
return client;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=redisClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redisClient.js","sourceRoot":"","sources":["../../../nodes/RedisCache/redisClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,oCAcC;AAUD,gEA0CC;AAlED,SAAgB,YAAY,CAAC,GAAW,EAAE,IAA8C;IACvF,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAC/B,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,SAAS;YACb,OAAO,GAAG,CAAC;QACZ,KAAK,SAAS;YACb,OAAO,GAAG,GAAG,EAAE,CAAC;QACjB,KAAK,OAAO;YACX,OAAO,GAAG,GAAG,IAAI,CAAC;QACnB,KAAK,MAAM;YACV,OAAO,GAAG,GAAG,KAAK,CA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K,GAAI,IAAI,CAAC;QACtB,CAAC;QACD,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,OAAyB;YAC9D,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,EAAE,KAAI,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;gBACnC,MAAM,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACP,MAAM,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAClC,CAAC;QACF,CAAC;QACD,OAAO;YACN,IAAI,CAAC;gBACJ,UAAU,CAAC,UAAU,EAAE,CAAC;YACzB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACZ,KAAK,CAAC,CAAC;YACR,CAAC;QACF,CAAC;KACD,CAAC;IAEF,OAAO,MAAM,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type IExecuteFunctions, type INodeExecutionData, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class BozonxRedisStreamProducer implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BozonxRedisStreamProducer = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const redisClient_1 = require("./redisClient");
|
|
6
|
+
class BozonxRedisStreamProducer {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.description = {
|
|
9
|
+
displayName: 'Redis Pub',
|
|
10
|
+
name: 'bozonxRedisStreamProducer',
|
|
11
|
+
group: ['output'],
|
|
12
|
+
version: 1,
|
|
13
|
+
description: 'Append entries to a Redis Stream using XADD',
|
|
14
|
+
defaults: { name: 'Redis Pub' },
|
|
15
|
+
icon: 'file:redis-stream-producer.svg',
|
|
16
|
+
inputs: ['main'],
|
|
17
|
+
outputs: ['main'],
|
|
18
|
+
credentials: [
|
|
19
|
+
{
|
|
20
|
+
name: 'bozonxRedis',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
properties: [
|
|
25
|
+
{
|
|
26
|
+
displayName: 'Event Name',
|
|
27
|
+
name: 'streamKey',
|
|
28
|
+
type: 'string',
|
|
29
|
+
default: 'my-service:main',
|
|
30
|
+
required: true,
|
|
31
|
+
description: 'Redis Stream key (event name) to append entries to, e.g. "my-service:main"',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Payload Mode',
|
|
35
|
+
name: 'payloadMode',
|
|
36
|
+
type: 'options',
|
|
37
|
+
options: [
|
|
38
|
+
{
|
|
39
|
+
name: 'Key-Value',
|
|
40
|
+
value: 'kv',
|
|
41
|
+
description: 'Send the key-value pairs configured below. The incoming item is ignored.',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Text',
|
|
45
|
+
value: 'text',
|
|
46
|
+
description: 'Send a single field named "payload" with the provided text',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'JSON',
|
|
50
|
+
value: 'json',
|
|
51
|
+
description: 'Send a single field named "data" with the JSON string of the provided JSON or the incoming item (if left empty)',
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
default: 'kv',
|
|
55
|
+
description: 'Choose how the stream entry fields are constructed',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
displayName: 'Payload',
|
|
59
|
+
name: 'stringPayload',
|
|
60
|
+
type: 'string',
|
|
61
|
+
displayOptions: { show: { payloadMode: ['text', 'json'] } },
|
|
62
|
+
typeOptions: { rows: 8 },
|
|
63
|
+
default: '',
|
|
64
|
+
description: 'Content used by Text and JSON modes. For Text, sent as-is in field "payload". For JSON, provide valid JSON or leave empty to use the incoming item as JSON.',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Payload',
|
|
68
|
+
name: 'payload',
|
|
69
|
+
type: 'fixedCollection',
|
|
70
|
+
displayOptions: { show: { payloadMode: ['kv'] } },
|
|
71
|
+
typeOptions: { multipleValues: true },
|
|
72
|
+
default: {},
|
|
73
|
+
options: [
|
|
74
|
+
{
|
|
75
|
+
name: 'pair',
|
|
76
|
+
displayName: 'Pair',
|
|
77
|
+
values: [
|
|
78
|
+
{
|
|
79
|
+
displayName: 'Key',
|
|
80
|
+
name: 'key',
|
|
81
|
+
type: 'string',
|
|
82
|
+
default: '',
|
|
83
|
+
description: 'Field name',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
displayName: 'Type',
|
|
87
|
+
name: 'type',
|
|
88
|
+
type: 'options',
|
|
89
|
+
options: [
|
|
90
|
+
{ name: 'Boolean', value: 'boolean' },
|
|
91
|
+
{ name: 'JSON', value: 'json' },
|
|
92
|
+
{ name: 'Null', value: 'null' },
|
|
93
|
+
{ name: 'Number', value: 'number' },
|
|
94
|
+
{ name: 'String', value: 'string' },
|
|
95
|
+
],
|
|
96
|
+
default: 'string',
|
|
97
|
+
description: 'Value type. It will be validated and serialized accordingly.',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
displayName: 'Value',
|
|
101
|
+
name: 'valueString',
|
|
102
|
+
type: 'string',
|
|
103
|
+
default: '',
|
|
104
|
+
description: 'Field value',
|
|
105
|
+
displayOptions: { show: { type: ['string'] } },
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
displayName: 'Value',
|
|
109
|
+
name: 'valueNumber',
|
|
110
|
+
type: 'number',
|
|
111
|
+
default: 0,
|
|
112
|
+
description: 'Field value',
|
|
113
|
+
displayOptions: { show: { type: ['number'] } },
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
displayName: 'Value',
|
|
117
|
+
name: 'valueBoolean',
|
|
118
|
+
type: 'boolean',
|
|
119
|
+
default: false,
|
|
120
|
+
description: 'Whether the field value is true or false',
|
|
121
|
+
displayOptions: { show: { type: ['boolean'] } },
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
displayName: 'Value',
|
|
125
|
+
name: 'valueJson',
|
|
126
|
+
type: 'string',
|
|
127
|
+
typeOptions: { rows: 8 },
|
|
128
|
+
default: '',
|
|
129
|
+
description: 'Field value as JSON (stringified)',
|
|
130
|
+
displayOptions: { show: { type: ['json'] } },
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
description: 'Key-value pairs used when Payload Mode is Key-Value',
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
usableAsTool: true,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
async execute() {
|
|
142
|
+
var _a, _b, _c, _d, _e;
|
|
143
|
+
const items = this.getInputData();
|
|
144
|
+
const returnData = [];
|
|
145
|
+
const creds = await this.getCredentials('bozonxRedis');
|
|
146
|
+
const host = (creds === null || creds === void 0 ? void 0 : creds.host) || 'localhost';
|
|
147
|
+
const port = (_a = creds === null || creds === void 0 ? void 0 : creds.port) !== null && _a !== void 0 ? _a : 6379;
|
|
148
|
+
const username = (creds === null || creds === void 0 ? void 0 : creds.username) || '';
|
|
149
|
+
const password = (creds === null || creds === void 0 ? void 0 : creds.password) || '';
|
|
150
|
+
const tls = (creds === null || creds === void 0 ? void 0 : creds.tls) || false;
|
|
151
|
+
const db = (_b = creds === null || creds === void 0 ? void 0 : creds.db) !== null && _b !== void 0 ? _b : 0;
|
|
152
|
+
const client = await (0, redisClient_1.getRedisClientConnected)({ host, port, username, password, tls, db });
|
|
153
|
+
for (let i = 0; i < items.length; i++) {
|
|
154
|
+
try {
|
|
155
|
+
const streamKey = this.getNodeParameter('streamKey', i).trim();
|
|
156
|
+
const messageIdParam = '*';
|
|
157
|
+
const payloadMode = this.getNodeParameter('payloadMode', i);
|
|
158
|
+
const maxLen = 1000000;
|
|
159
|
+
const ttlSec = 86400;
|
|
160
|
+
if (!streamKey) {
|
|
161
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Event name is required', { itemIndex: i });
|
|
162
|
+
}
|
|
163
|
+
const fields = [];
|
|
164
|
+
let resultPayloadKV = null;
|
|
165
|
+
if (payloadMode === 'text') {
|
|
166
|
+
const text = this.getNodeParameter('stringPayload', i, '').trim();
|
|
167
|
+
fields.push(['payload', text]);
|
|
168
|
+
}
|
|
169
|
+
else if (payloadMode === 'json') {
|
|
170
|
+
const raw = this.getNodeParameter('stringPayload', i, '').trim();
|
|
171
|
+
let dataObj;
|
|
172
|
+
if (raw) {
|
|
173
|
+
try {
|
|
174
|
+
dataObj = JSON.parse(raw);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid JSON in Payload', {
|
|
178
|
+
itemIndex: i,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
dataObj = items[i].json;
|
|
184
|
+
}
|
|
185
|
+
fields.push(['data', JSON.stringify(dataObj)]);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
const payload = this.getNodeParameter('payload', i, {});
|
|
189
|
+
const pairs = (payload.pair || [])
|
|
190
|
+
.map((p) => {
|
|
191
|
+
var _a, _b;
|
|
192
|
+
const obj = p;
|
|
193
|
+
return {
|
|
194
|
+
key: String((_a = obj.key) !== null && _a !== void 0 ? _a : ''),
|
|
195
|
+
type: String((_b = obj.type) !== null && _b !== void 0 ? _b : 'string'),
|
|
196
|
+
valueString: typeof obj.valueString === 'string' ? obj.valueString : undefined,
|
|
197
|
+
valueNumber: typeof obj.valueNumber === 'number' ? obj.valueNumber : undefined,
|
|
198
|
+
valueBoolean: typeof obj.valueBoolean === 'boolean' ? obj.valueBoolean : undefined,
|
|
199
|
+
valueJson: typeof obj.valueJson === 'string' ? obj.valueJson : undefined,
|
|
200
|
+
};
|
|
201
|
+
})
|
|
202
|
+
.filter((p) => p.key.length > 0);
|
|
203
|
+
const resultObj = {};
|
|
204
|
+
for (const p of pairs) {
|
|
205
|
+
let v;
|
|
206
|
+
let typed;
|
|
207
|
+
switch (p.type) {
|
|
208
|
+
case 'number': {
|
|
209
|
+
const n = Number(p.valueNumber);
|
|
210
|
+
if (!Number.isFinite(n)) {
|
|
211
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid number for key "${p.key}"`, { itemIndex: i });
|
|
212
|
+
}
|
|
213
|
+
v = String(n);
|
|
214
|
+
typed = n;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case 'boolean': {
|
|
218
|
+
const b = Boolean(p.valueBoolean);
|
|
219
|
+
v = b ? 'true' : 'false';
|
|
220
|
+
typed = b;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
case 'json': {
|
|
224
|
+
try {
|
|
225
|
+
const parsed = JSON.parse((_c = p.valueJson) !== null && _c !== void 0 ? _c : '');
|
|
226
|
+
v = JSON.stringify(parsed);
|
|
227
|
+
typed = parsed;
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid JSON for key "${p.key}"`, {
|
|
231
|
+
itemIndex: i,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
case 'null': {
|
|
237
|
+
v = 'null';
|
|
238
|
+
typed = null;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
case 'string':
|
|
242
|
+
default:
|
|
243
|
+
v = String((_d = p.valueString) !== null && _d !== void 0 ? _d : '');
|
|
244
|
+
typed = (_e = p.valueString) !== null && _e !== void 0 ? _e : '';
|
|
245
|
+
}
|
|
246
|
+
fields.push([p.key, v]);
|
|
247
|
+
resultObj[p.key] = typed;
|
|
248
|
+
}
|
|
249
|
+
if (pairs.length === 0) {
|
|
250
|
+
fields.push(['__empty', 'true']);
|
|
251
|
+
}
|
|
252
|
+
resultPayloadKV = Object.keys(resultObj).length > 0 ? resultObj : null;
|
|
253
|
+
}
|
|
254
|
+
const cmd = ['XADD', streamKey];
|
|
255
|
+
if (maxLen && maxLen > 0) {
|
|
256
|
+
cmd.push('MAXLEN', '~', String(maxLen));
|
|
257
|
+
}
|
|
258
|
+
cmd.push(messageIdParam || '*');
|
|
259
|
+
for (const [k, v] of fields) {
|
|
260
|
+
cmd.push(k, v);
|
|
261
|
+
}
|
|
262
|
+
const c = client;
|
|
263
|
+
const id = await c.sendCommand(cmd);
|
|
264
|
+
if (ttlSec && ttlSec > 0) {
|
|
265
|
+
await c.sendCommand(['EXPIRE', streamKey, String(ttlSec)]);
|
|
266
|
+
}
|
|
267
|
+
const fieldsObj = Object.fromEntries(fields);
|
|
268
|
+
let payload = null;
|
|
269
|
+
if (payloadMode === 'kv') {
|
|
270
|
+
payload = resultPayloadKV;
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
if (Object.keys(fieldsObj).length === 1) {
|
|
274
|
+
if (fieldsObj['data'] !== undefined) {
|
|
275
|
+
try {
|
|
276
|
+
const parsed = JSON.parse(fieldsObj['data']);
|
|
277
|
+
payload =
|
|
278
|
+
typeof parsed === 'object' && parsed !== null
|
|
279
|
+
? parsed
|
|
280
|
+
: { value: parsed };
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
payload = { data: fieldsObj['data'] };
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
else if (fieldsObj['payload'] !== undefined) {
|
|
287
|
+
payload = fieldsObj['payload'];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else if (Object.keys(fieldsObj).length > 0) {
|
|
291
|
+
payload = { ...fieldsObj };
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
payload = null;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
const json = { payload, _stream: streamKey, _id: id };
|
|
298
|
+
returnData.push({ json, pairedItem: { item: i } });
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
if (this.continueOnFail()) {
|
|
302
|
+
returnData.push({
|
|
303
|
+
json: { error: error.message },
|
|
304
|
+
pairedItem: { item: i },
|
|
305
|
+
});
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
throw error;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return [returnData];
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
exports.BozonxRedisStreamProducer = BozonxRedisStreamProducer;
|
|
315
|
+
//# sourceMappingURL=BozonxRedisStreamProducer.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BozonxRedisStreamProducer.node.js","sourceRoot":"","sources":["../../../nodes/RedisStreamProducer/BozonxRedisStreamProducer.node.ts"],"names":[],"mappings":";;;AAAA,+CAOsB;AACtB,+CAAwD;AAExD,MAAa,yBAAyB;IAAtC;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,2BAA2B;YACjC,KAAK,EAAE,CAAC,QAAQ,CAAC;YACjB,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;YAC/B,IAAI,EAAE,gCAAgC;YACtC,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,YAAY;oBACzB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,QAAQ;oBACd,OAAO,EAAE,iBAAiB;oBAC1B,QAAQ,EAAE,IAAI;oBACd,W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S,EAAE,CAAC;4BAC/C,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;wBAChC,CAAC;oBACF,CAAC;yBAAM,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAC9C,OAAO,GAAG,EAAE,GAAG,SAAS,EAAiB,CAAC;oBAC3C,CAAC;yBAAM,CAAC;wBACP,OAAO,GAAG,IAAI,CAAC;oBAChB,CAAC;gBACF,CAAC;gBACD,MAAM,IAAI,GAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,EAAiB,CAAC;gBAClF,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACpD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAiB;wBACxD,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAvTD,8DAuTC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="64" height="64" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Redis Pub icon (dark)">
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="g" x1="0" y1="0" x2="0" y2="1">
|
|
5
|
+
<stop offset="0%" stop-color="#ff6b6b"/>
|
|
6
|
+
<stop offset="100%" stop-color="#d64545"/>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
</defs>
|
|
9
|
+
<g fill="none" fill-rule="evenodd">
|
|
10
|
+
<ellipse cx="28" cy="18" rx="20" ry="7" fill="url(#g)"/>
|
|
11
|
+
<path d="M8 18v12c0 4 9 7 20 7s20-3 20-7V18c0 4-9 7-20 7S8 22 8 18z" fill="#a82f2f"/>
|
|
12
|
+
<ellipse cx="28" cy="30" rx="20" ry="7" fill="url(#g)"/>
|
|
13
|
+
<path d="M8 30v12c0 4 9 7 20 7s20-3 20-7V30c0 4-9 7-20 7S8 34 8 30z" fill="#922828"/>
|
|
14
|
+
<path d="M40 22l12 10-12 10v-6H28c-4.418 0-8-3.134-8-7s3.582-7 8-7h12v-6z" fill="#ffffff" opacity="0.95"/>
|
|
15
|
+
<rect x="41" y="45" width="18" height="12" rx="3" fill="#000000" opacity="0.7"/>
|
|
16
|
+
<text x="50" y="54" text-anchor="middle" font-family="Inter, Arial, sans-serif" font-size="9" font-weight="700" fill="#FFFFFF" opacity="0.98">pub</text>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="64" height="64" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Redis Pub icon">
|
|
3
|
+
<defs>
|
|
4
|
+
<linearGradient id="g" x1="0" y1="0" x2="0" y2="1">
|
|
5
|
+
<stop offset="0%" stop-color="#e34c4c"/>
|
|
6
|
+
<stop offset="100%" stop-color="#b92525"/>
|
|
7
|
+
</linearGradient>
|
|
8
|
+
</defs>
|
|
9
|
+
<g fill="none" fill-rule="evenodd">
|
|
10
|
+
<ellipse cx="28" cy="18" rx="20" ry="7" fill="url(#g)"/>
|
|
11
|
+
<path d="M8 18v12c0 4 9 7 20 7s20-3 20-7V18c0 4-9 7-20 7S8 22 8 18z" fill="#c73737"/>
|
|
12
|
+
<ellipse cx="28" cy="30" rx="20" ry="7" fill="url(#g)"/>
|
|
13
|
+
<path d="M8 30v12c0 4 9 7 20 7s20-3 20-7V30c0 4-9 7-20 7S8 34 8 30z" fill="#b12f2f"/>
|
|
14
|
+
<path d="M40 22l12 10-12 10v-6H28c-4.418 0-8-3.134-8-7s3.582-7 8-7h12v-6z" fill="#ffffff" opacity="0.9"/>
|
|
15
|
+
<rect x="41" y="45" width="18" height="12" rx="3" fill="#111111" opacity="0.85"/>
|
|
16
|
+
<text x="50" y="54" text-anchor="middle" font-family="Inter, Arial, sans-serif" font-size="9" font-weight="700" fill="#FFFFFF" opacity="0.95">pub</text>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getRedisClientConnected = getRedisClientConnected;
|
|
37
|
+
const clients = new Map();
|
|
38
|
+
function buildUrl(opts) {
|
|
39
|
+
var _a;
|
|
40
|
+
const proto = opts.tls ? 'rediss' : 'redis';
|
|
41
|
+
const authPart = opts.username
|
|
42
|
+
? `${encodeURIComponent(opts.username)}:${encodeURIComponent((_a = opts.password) !== null && _a !== void 0 ? _a : '')}@`
|
|
43
|
+
: opts.password
|
|
44
|
+
? `:${encodeURIComponent(opts.password)}@`
|
|
45
|
+
: '';
|
|
46
|
+
const dbPath = typeof opts.db === 'number' ? `/${opts.db}` : '';
|
|
47
|
+
return `${proto}://${authPart}${opts.host}:${opts.port}${dbPath}`;
|
|
48
|
+
}
|
|
49
|
+
async function getRedisClientConnected(opts) {
|
|
50
|
+
const url = buildUrl(opts);
|
|
51
|
+
const cached = clients.get(url);
|
|
52
|
+
if (cached) {
|
|
53
|
+
if (cached.isOpen)
|
|
54
|
+
return cached;
|
|
55
|
+
try {
|
|
56
|
+
await cached.connect();
|
|
57
|
+
return cached;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const { createClient } = await Promise.resolve().then(() => __importStar(require('redis')));
|
|
63
|
+
const client = createClient({ url });
|
|
64
|
+
client.on('error', () => {
|
|
65
|
+
});
|
|
66
|
+
await client.connect();
|
|
67
|
+
clients.set(url, client);
|
|
68
|
+
return client;
|
|
69
|
+
}
|
|
70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AC;YACJ,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;YACvB,OAAO,MAAiB,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;QAET,CAAC;IACF,CAAC;IACD,MAAM,EAAE,YAAY,EAAE,GAAG,wDAAa,OAAO,GAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;IAExB,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;IACvB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,MAAiB,CAAC,CAAC;IACpC,OAAO,MAAiB,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ITriggerFunctions, type INodeType, type INodeTypeDescription, type ITriggerResponse } from 'n8n-workflow';
|
|
2
|
+
export declare class BozonxRedisStreamTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
trigger(this: ITriggerFunctions): Promise<ITriggerResponse>;
|
|
5
|
+
}
|