This commit is contained in:
2026-02-23 21:54:50 +07:00
parent 99bf57b154
commit 7853e94d2e
21 changed files with 65 additions and 65 deletions

View File

@@ -462,7 +462,7 @@ async function smartsend(subject, data, options = {}) {
* @param {string} options.replyToMsgId - Message ID this message is replying to (default: "")
* @param {boolean} options.isPublish - Whether to automatically publish the message to NATS (default: true)
*
* @returns {Promise<Object>} - An object with { env: MessageEnvelope, msg_json_str: string }
* @returns {Promise<Object>} - An object with { env: MessageEnvelope, env_json_str: string }
*/
const {
natsUrl = DEFAULT_NATS_URL,
@@ -559,17 +559,17 @@ async function smartsend(subject, data, options = {}) {
});
// Convert envelope to JSON string
const msg_json_str = env.toString();
const env_json_str = env.toString();
// Publish to NATS if isPublish is true
if (isPublish) {
await publish_message(natsUrl, subject, msg_json_str, correlationId);
await publish_message(natsUrl, subject, env_json_str, correlationId);
}
// Return both envelope and JSON string (tuple-like structure)
return {
env: env,
msg_json_str: msg_json_str
env_json_str: env_json_str
};
}