@newhomestar/sdk 0.5.0 → 0.5.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.
- package/dist/index.js +24 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -174,7 +174,17 @@ export async function runWorker(def) {
|
|
|
174
174
|
continue;
|
|
175
175
|
}
|
|
176
176
|
for (const msg of data) {
|
|
177
|
-
|
|
177
|
+
console.log(`[nova] 🔍 Raw message received:`, JSON.stringify(msg, null, 2));
|
|
178
|
+
const { jobId, action: actName, payload, user_id, topic, ...otherFields } = msg.message;
|
|
179
|
+
console.log(`[nova] 📝 Message fields:`, {
|
|
180
|
+
jobId,
|
|
181
|
+
action: actName,
|
|
182
|
+
topic,
|
|
183
|
+
user_id,
|
|
184
|
+
payloadType: typeof payload,
|
|
185
|
+
payloadKeys: payload && typeof payload === 'object' ? Object.keys(payload) : 'N/A',
|
|
186
|
+
otherFields: Object.keys(otherFields)
|
|
187
|
+
});
|
|
178
188
|
// Determine which action to run:
|
|
179
189
|
// 1. If action is explicitly specified, use it
|
|
180
190
|
// 2. If topic is specified, map topic to action
|
|
@@ -182,19 +192,29 @@ export async function runWorker(def) {
|
|
|
182
192
|
let targetActionName = actName;
|
|
183
193
|
if (!targetActionName && topic) {
|
|
184
194
|
targetActionName = topicActionMap.get(topic);
|
|
185
|
-
console.log(`[nova] Topic-based routing: '${topic}' -> '${targetActionName || 'NOT_FOUND'}'`);
|
|
195
|
+
console.log(`[nova] 🎯 Topic-based routing: '${topic}' -> '${targetActionName || 'NOT_FOUND'}'`);
|
|
196
|
+
console.log(`[nova] 📋 Available topic mappings:`, Object.fromEntries(topicActionMap));
|
|
197
|
+
}
|
|
198
|
+
else if (!targetActionName) {
|
|
199
|
+
console.log(`[nova] ⚠️ No action or topic specified in message`);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
console.log(`[nova] ✅ Direct action specified: '${targetActionName}'`);
|
|
186
203
|
}
|
|
187
204
|
const act = targetActionName ? def.actions[targetActionName] : undefined;
|
|
188
205
|
if (!act) {
|
|
189
|
-
console.
|
|
206
|
+
console.error(`[nova] ❌ No action handler found!`);
|
|
207
|
+
console.error(`[nova] 📋 Message analysis:`, {
|
|
190
208
|
action: actName,
|
|
191
209
|
topic,
|
|
192
210
|
targetAction: targetActionName,
|
|
193
|
-
availableActions: Object.keys(def.actions)
|
|
211
|
+
availableActions: Object.keys(def.actions),
|
|
212
|
+
topicMappings: Object.fromEntries(topicActionMap)
|
|
194
213
|
});
|
|
195
214
|
await nack(msg.msg_id, def.queue);
|
|
196
215
|
continue;
|
|
197
216
|
}
|
|
217
|
+
console.log(`[nova] 🚀 Executing action '${targetActionName}' for message ${msg.msg_id}`);
|
|
198
218
|
// FGA enforcement (unchanged from original)
|
|
199
219
|
const hints = act.fga ? (Array.isArray(act.fga) ? act.fga : [act.fga]) : [];
|
|
200
220
|
if (hints.length) {
|
package/package.json
CHANGED