piece-signal-cli-rest-api 0.2.18 → 0.2.19
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piece-signal-cli-rest-api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "echo \"piece-signal-cli-rest-api: kein zusätzlicher Build-Schritt erforderlich (bereits als JS ausgeliefert)\"",
|
|
6
6
|
"publish:npm": "npm publish --access public"
|
|
@@ -81,6 +81,43 @@ exports.receiveMessages = (0, pieces_framework_1.createAction)({
|
|
|
81
81
|
// Use HTTP GET for normal/native mode
|
|
82
82
|
messages = yield (0, message_utils_1.tryHttpReceive)(httpUrl, headers);
|
|
83
83
|
}
|
|
84
|
+
// #region agent log
|
|
85
|
+
for (const raw of messages) {
|
|
86
|
+
const env = (raw && raw.envelope) || {};
|
|
87
|
+
const dm = env.dataMessage || {};
|
|
88
|
+
fetch('http://10.3.0.249:7243/ingest/103f08fb-273f-440d-bbe5-4f1e30168ab7', {
|
|
89
|
+
method: 'POST',
|
|
90
|
+
headers: { 'Content-Type': 'application/json' },
|
|
91
|
+
body: JSON.stringify({
|
|
92
|
+
location: 'receive-messages.js:raw',
|
|
93
|
+
message: 'Raw received Signal message',
|
|
94
|
+
data: {
|
|
95
|
+
source: env.source,
|
|
96
|
+
sourceNumber: env.sourceNumber,
|
|
97
|
+
sourceUuid: env.sourceUuid,
|
|
98
|
+
hasDataMessage: !!env.dataMessage,
|
|
99
|
+
messageText: (dm.message || '').substring(0, 100),
|
|
100
|
+
hasQuote: !!dm.quote,
|
|
101
|
+
quote: dm.quote ? {
|
|
102
|
+
id: dm.quote.id,
|
|
103
|
+
author: dm.quote.author,
|
|
104
|
+
timestamp: dm.quote.timestamp,
|
|
105
|
+
} : null,
|
|
106
|
+
hasReaction: !!dm.reaction,
|
|
107
|
+
reaction: dm.reaction ? {
|
|
108
|
+
emoji: dm.reaction.emoji,
|
|
109
|
+
targetTimestamp: dm.reaction.targetTimestamp,
|
|
110
|
+
targetSentTimestamp: dm.reaction.targetSentTimestamp,
|
|
111
|
+
} : null,
|
|
112
|
+
isGroupMessage: !!dm.groupInfo,
|
|
113
|
+
groupId: dm.groupInfo ? dm.groupInfo.groupId : null,
|
|
114
|
+
},
|
|
115
|
+
timestamp: Date.now(),
|
|
116
|
+
hypothesisId: 'RAW',
|
|
117
|
+
}),
|
|
118
|
+
}).catch(() => { });
|
|
119
|
+
}
|
|
120
|
+
// #endregion
|
|
84
121
|
// Cleanup expired approvals (also when no messages)
|
|
85
122
|
yield (0, message_utils_1.cleanupExpiredApprovals)(context.store);
|
|
86
123
|
// Process each message: try to resume approval flows if applicable
|
|
@@ -276,6 +276,42 @@ exports.newMessageReceived = (0, pieces_framework_1.createTrigger)({
|
|
|
276
276
|
// Get messages from polling
|
|
277
277
|
const messages = yield pieces_common_1.pollingHelper.poll(polling, context);
|
|
278
278
|
const apiUrl = ((_a = context.server) === null || _a === void 0 ? void 0 : _a.apiUrl) || '';
|
|
279
|
+
// #region agent log
|
|
280
|
+
for (const raw of messages) {
|
|
281
|
+
const env = (raw && raw.envelope) || {};
|
|
282
|
+
const dm = env.dataMessage || {};
|
|
283
|
+
fetch('http://10.3.0.249:7243/ingest/103f08fb-273f-440d-bbe5-4f1e30168ab7', {
|
|
284
|
+
method: 'POST',
|
|
285
|
+
headers: { 'Content-Type': 'application/json' },
|
|
286
|
+
body: JSON.stringify({
|
|
287
|
+
location: 'new-message-received.js:raw',
|
|
288
|
+
message: 'Trigger raw Signal message',
|
|
289
|
+
data: {
|
|
290
|
+
source: env.source,
|
|
291
|
+
sourceNumber: env.sourceNumber,
|
|
292
|
+
sourceUuid: env.sourceUuid,
|
|
293
|
+
messageText: (dm.message || '').substring(0, 100),
|
|
294
|
+
hasQuote: !!dm.quote,
|
|
295
|
+
quote: dm.quote ? {
|
|
296
|
+
id: dm.quote.id,
|
|
297
|
+
author: dm.quote.author,
|
|
298
|
+
timestamp: dm.quote.timestamp,
|
|
299
|
+
} : null,
|
|
300
|
+
hasReaction: !!dm.reaction,
|
|
301
|
+
reaction: dm.reaction ? {
|
|
302
|
+
emoji: dm.reaction.emoji,
|
|
303
|
+
targetTimestamp: dm.reaction.targetTimestamp,
|
|
304
|
+
targetSentTimestamp: dm.reaction.targetSentTimestamp,
|
|
305
|
+
} : null,
|
|
306
|
+
isGroupMessage: !!dm.groupInfo,
|
|
307
|
+
groupId: dm.groupInfo ? dm.groupInfo.groupId : null,
|
|
308
|
+
},
|
|
309
|
+
timestamp: Date.now(),
|
|
310
|
+
hypothesisId: 'RAW_TRIGGER',
|
|
311
|
+
}),
|
|
312
|
+
}).catch(() => { });
|
|
313
|
+
}
|
|
314
|
+
// #endregion
|
|
279
315
|
// Cleanup expired approvals (also when no messages)
|
|
280
316
|
yield message_utils_1.cleanupExpiredApprovals(context.store);
|
|
281
317
|
// Process each message: try to resume approval flows if applicable
|