@5minds/node-red-contrib-processcube 1.15.1 → 1.15.2-develop-751ba4-mcx6kwz0
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
@@ -15,7 +15,7 @@ module.exports = function (RED) {
|
|
15
15
|
node.engineClient = new engine_client.EngineClient(node.url, {
|
16
16
|
clientId: node.credentials.clientId,
|
17
17
|
clientSecret: node.credentials.clientSecret,
|
18
|
-
scope: 'engine_etw engine_read engine_write',
|
18
|
+
scope: 'engine_etw engine_read engine_write engine_observer',
|
19
19
|
});
|
20
20
|
} else {
|
21
21
|
node.log('Create Client without secrets');
|
@@ -4,7 +4,8 @@
|
|
4
4
|
color: '#02AFD6',
|
5
5
|
defaults: {
|
6
6
|
name: { value: '' },
|
7
|
-
template_link: { value: '', type: 'str' }
|
7
|
+
template_link: { value: '', type: 'str' },
|
8
|
+
template_link_type: { value: 'str'},
|
8
9
|
},
|
9
10
|
inputs: 1,
|
10
11
|
outputs: 1,
|
@@ -12,6 +13,19 @@
|
|
12
13
|
label: function () {
|
13
14
|
return this.name || 'processcube-google-docs-mail-template';
|
14
15
|
},
|
16
|
+
oneditprepare: function () {
|
17
|
+
$('#node-input-template_link').typedInput({
|
18
|
+
default: 'msg',
|
19
|
+
types: ['msg', 'str'],
|
20
|
+
});
|
21
|
+
|
22
|
+
$('#node-input-template_link').typedInput('value', this.template_link);
|
23
|
+
$('#node-input-template_link').typedInput('type', this.template_link_type);
|
24
|
+
},
|
25
|
+
oneditsave: function () {
|
26
|
+
(this.template_link = $('#node-input-template_link').typedInput('value')),
|
27
|
+
(this.template_link_type = $('#node-input-template_link').typedInput('type'));
|
28
|
+
},
|
15
29
|
});
|
16
30
|
</script>
|
17
31
|
|
@@ -76,7 +90,8 @@ if (openMatch) {
|
|
76
90
|
|
77
91
|
## Inputs
|
78
92
|
|
79
|
-
### `
|
93
|
+
### `template_link` (String||msg): The URL to the ZIP archive containing the HTML template and images.
|
94
|
+
### `payload` (JSON): Field to replace placeholders in the HTML template.
|
80
95
|
|
81
96
|
Fields for placeholder replacement. Example:
|
82
97
|
|
@@ -13,8 +13,6 @@ module.exports = function (RED) {
|
|
13
13
|
RED.nodes.createNode(this, config);
|
14
14
|
const node = this;
|
15
15
|
|
16
|
-
const template_link = config.template_link;
|
17
|
-
|
18
16
|
node.on('input', async function (msg) {
|
19
17
|
|
20
18
|
try {
|
@@ -86,6 +84,8 @@ module.exports = function (RED) {
|
|
86
84
|
});
|
87
85
|
}
|
88
86
|
|
87
|
+
const template_link = RED.util.evaluateNodeProperty(config.template_link, config.template_link_type, node, msg);
|
88
|
+
|
89
89
|
const customRoot = path.resolve(RED.settings.userDir, 'tmp/processcube-google-docs-mail-template');
|
90
90
|
fs.mkdirSync(customRoot, { recursive: true });
|
91
91
|
const tempDir = fs.mkdtempSync(path.join(customRoot, 'run-'));
|
@@ -14,6 +14,10 @@ module.exports = function (RED) {
|
|
14
14
|
|
15
15
|
let query = RED.util.evaluateNodeProperty(config.query, config.query_type, node, msg);
|
16
16
|
|
17
|
+
if (typeof query !== 'object' || Array.isArray(query) || query === null) {
|
18
|
+
query = {};
|
19
|
+
}
|
20
|
+
|
17
21
|
node.log(`Querying process definitions with query: ${JSON.stringify(query)}`);
|
18
22
|
|
19
23
|
const isUser = !!msg._client?.user && !!msg._client.user.accessToken;
|
@@ -23,14 +27,8 @@ module.exports = function (RED) {
|
|
23
27
|
client.processDefinitions
|
24
28
|
.getAll(query)
|
25
29
|
.then((matchingProcessDefinitions) => {
|
26
|
-
if (config.models_only
|
27
|
-
|
28
|
-
|
29
|
-
matchingProcessDefinitions.processDefinitions.forEach((processDefinition) => {
|
30
|
-
processDefinition.processModels.forEach((model) => {
|
31
|
-
models.push(model);
|
32
|
-
});
|
33
|
-
});
|
30
|
+
if (config.models_only) {
|
31
|
+
const models = matchingProcessDefinitions.processDefinitions.flatMap(processDefinition => processDefinition.processModels);
|
34
32
|
|
35
33
|
msg.payload = {
|
36
34
|
models: models,
|