Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.0.5 #9

Merged
merged 3 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.5] - 2024-01-07
### Changed
- Replaced usage of deprecated synchronous version of `evaluateJSONataExpression` by asynchronous version as synchronous version will not work anymore starting with Node-RED 4.0.
- Updated versions of some dependencies.

## [2.0.4] - 2023-06-15
### Fixed
- Removed port input for video sources in configuration UI.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Jens-Uwe Rossbach
Copyright (c) 2024 Jens-Uwe Rossbach

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ If you encountered a bug, would like to propose a new feature or simply want to
To see what has changed in recent versions of the software, please have a look at the project's [change log](https://github.com/jensrossbach/node-red-sony-audio/blob/master/CHANGELOG.md).

## License
Copyright (c) 2023 Jens-Uwe Rossbach
Copyright (c) 2024 Jens-Uwe Rossbach

This code is licensed under the MIT License.

Expand Down Expand Up @@ -59,7 +59,7 @@ THIS SOFTWARE AND ITS AUTHOR ARE NOT AFFILIATED WITH SONY CORPORATION.
The trademark "SONY" and any other product names, service names or logos of SONY used, quoted and/or referenced in this Web Site are trademarks or registered trademarks of Sony Corporation or any of its affiliates.

### License Audio Control API
Copyright (c) 2023 Sony Corporation. All rights reserved.
Copyright (c) 2024 Sony Corporation. All rights reserved.

The 'Audio Control API' is licensed to the user by Sony Video & Sound products Inc. under the license terms of the [Creative Commons Attribution-NoDerivatives 4.0 International Public License](https://creativecommons.org/licenses/by-nd/4.0/legalcode).

Expand Down
2 changes: 1 addition & 1 deletion nodes/common/event_constants.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Jens-Uwe Rossbach
* Copyright (c) 2024 Jens-Uwe Rossbach
*
* This code is licensed under the MIT License.
*
Expand Down
2 changes: 1 addition & 1 deletion nodes/common/event_recv.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Jens-Uwe Rossbach
* Copyright (c) 2024 Jens-Uwe Rossbach
*
* This code is licensed under the MIT License.
*
Expand Down
46 changes: 35 additions & 11 deletions nodes/common/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Jens-Uwe Rossbach
* Copyright (c) 2024 Jens-Uwe Rossbach
*
* This code is licensed under the MIT License.
*
Expand Down Expand Up @@ -27,6 +27,8 @@ const Nunjucks = require("nunjucks");

module.exports =
{
evaluateJSONataExpression: evaluateJSONataExpression,

validateOutputProperties: function(RED, node, source, target, allowEmpty)
{
for (let prop of source)
Expand Down Expand Up @@ -112,8 +114,9 @@ module.exports =
}
catch (e)
{
node.error(RED._("@jens_rossbach/node-red-sony-audio/sonyaudio-device:common.error.invalidExpression",
{error: e.code + ": " + e.message + " [POS: " + e.position + ", TOK: '" + e.token + ", VAL: '" + e.value + "']"}));
node.error(
RED._("@jens_rossbach/node-red-sony-audio/sonyaudio-device:common.error.invalidExpression",
{error: e.code + ": " + e.message + " [POS: " + e.position + ", TOK: '" + e.token + ", VAL: '" + e.value + "']"}));
return false;
}
}
Expand Down Expand Up @@ -142,7 +145,7 @@ module.exports =
return true;
},

prepareOutput: function(RED, node, properties, msg, data, sendIfPayload)
prepareOutput: async function(RED, node, properties, msg, data, sendIfPayload)
{
let out = msg ? msg : {};
let numMsgProps = 0;
Expand All @@ -154,7 +157,7 @@ module.exports =
{
if (prop.type == "msg")
{
RED.util.setMessageProperty(out, prop.name, getProperty(prop), true);
RED.util.setMessageProperty(out, prop.name, await getProperty(prop), true);
++numMsgProps;

if (prop.name == "payload")
Expand All @@ -165,7 +168,7 @@ module.exports =
else
{
let ctx = RED.util.parseContextStore(prop.name);
node.context()[prop.type].set(ctx.key, getProperty(prop), ctx.store);
node.context()[prop.type].set(ctx.key, await getProperty(prop), ctx.store);
}
}
catch (e)
Expand All @@ -192,7 +195,7 @@ module.exports =

return out;

function getProperty(prop)
async function getProperty(prop)
{
let value = null;

Expand Down Expand Up @@ -226,7 +229,9 @@ module.exports =
}
catch (e)
{
throw new Error(RED._("@jens_rossbach/node-red-sony-audio/sonyaudio-device:common.error.invalidTemplate", {error: e.message}));
throw new Error(
RED._("@jens_rossbach/node-red-sony-audio/sonyaudio-device:common.error.invalidTemplate",
{error: e.message}));
}
}
else
Expand All @@ -240,12 +245,13 @@ module.exports =
{
try
{
value = RED.util.evaluateJSONataExpression(prop.value.expression, data);
value = await evaluateJSONataExpression(RED, prop.value.expression, data);
}
catch (e)
{
throw new Error(RED._("@jens_rossbach/node-red-sony-audio/sonyaudio-device:common.error.invalidExpression",
{error: e.code + ": " + e.message + " [POS: " + e.position + ", TOK: '" + e.token + "']"}));
throw new Error(
RED._("@jens_rossbach/node-red-sony-audio/sonyaudio-device:common.error.invalidExpression",
{error: e.code + ": " + e.message + " [POS: " + e.position + ", TOK: '" + e.token + "']"}));
}

if (typeof value == "undefined")
Expand Down Expand Up @@ -662,3 +668,21 @@ module.exports =
}
}
};

function evaluateJSONataExpression(RED, expr, msg)
{
return new Promise((resolve, reject) =>
{
RED.util.evaluateJSONataExpression(expr, msg, (error, result) =>
{
if (error)
{
reject(error);
}
else
{
resolve(result);
}
});
});
}
2 changes: 1 addition & 1 deletion nodes/control.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright (c) 2023 Jens-Uwe Rossbach
Copyright (c) 2024 Jens-Uwe Rossbach

This code is licensed under the MIT License.

Expand Down
Loading
Loading