@betterportal/node-red-contrib-betterportal 0.0.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.
@@ -0,0 +1,37 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType("betterportal-action", {
3
+ category: "BetterPortal",
4
+ color: "#d8eefc",
5
+ defaults: {
6
+ name: { value: "" },
7
+ tenantUrl: { value: "", required: true },
8
+ configManagerUrl: { value: "" },
9
+ action: { value: "" }
10
+ },
11
+ inputs: 1,
12
+ outputs: 1,
13
+ icon: "bridge.svg",
14
+ label: function() {
15
+ return this.name || "BetterPortal action";
16
+ }
17
+ });
18
+ </script>
19
+
20
+ <script type="text/html" data-template-name="betterportal-action">
21
+ <div class="form-row">
22
+ <label for="node-input-name">Name</label>
23
+ <input type="text" id="node-input-name">
24
+ </div>
25
+ <div class="form-row">
26
+ <label for="node-input-tenantUrl">Tenant URL</label>
27
+ <input type="text" id="node-input-tenantUrl" placeholder="https://portal.example.com">
28
+ </div>
29
+ <div class="form-row">
30
+ <label for="node-input-configManagerUrl">Config Manager URL</label>
31
+ <input type="text" id="node-input-configManagerUrl" placeholder="optional">
32
+ </div>
33
+ </script>
34
+
35
+ <script type="text/html" data-help-name="betterportal-action">
36
+ <p>Loads BetterPortal automation catalog metadata for the configured tenant. Current output is discovery-only.</p>
37
+ </script>
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ const { discover, actionChoices } = require("../shared/bp-client.js");
4
+
5
+ module.exports = function register(RED) {
6
+ function BetterPortalActionNode(config) {
7
+ RED.nodes.createNode(this, config);
8
+ this.tenantUrl = config.tenantUrl;
9
+ this.configManagerUrl = config.configManagerUrl;
10
+ this.action = config.action;
11
+
12
+ this.on("input", async (msg, send, done) => {
13
+ try {
14
+ const catalog = await discover({
15
+ tenantUrl: msg.tenantUrl || this.tenantUrl,
16
+ configManagerUrl: msg.configManagerUrl || this.configManagerUrl,
17
+ apiKey: msg.apiKey
18
+ });
19
+ msg.bpCatalog = catalog;
20
+ msg.bpActions = actionChoices(catalog);
21
+ send(msg);
22
+ done();
23
+ } catch (error) {
24
+ done(error);
25
+ }
26
+ });
27
+ }
28
+
29
+ RED.nodes.registerType("betterportal-action", BetterPortalActionNode);
30
+ };
package/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ module.exports = function register(RED) {
4
+ require("./betterportal-action.js")(RED);
5
+ };
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@betterportal/node-red-contrib-betterportal",
3
+ "version": "0.0.1",
4
+ "description": "Node-RED nodes for BetterPortal automation discovery.",
5
+ "main": "index.js",
6
+ "node-red": {
7
+ "nodes": {
8
+ "betterportal-action": "betterportal-action.js"
9
+ }
10
+ },
11
+ "author": "BetterCorp",
12
+ "license": "(AGPL-3.0-only OR Commercial)",
13
+ "homepage": "https://github.com/BetterCorp/BetterPortal#readme",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/BetterCorp/BetterPortal.git",
17
+ "directory": "automations/node-red"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/BetterCorp/BetterPortal/issues"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ }
25
+ }