Skip to content
This repository was archived by the owner on Dec 14, 2022. It is now read-only.

Commit 1bd834d

Browse files
author
Chris Wiechmann
committed
Updated JS-Flow-Node to 3.0.2 to add logger
#140
1 parent 20d1a46 commit 1bd834d

File tree

9 files changed

+6455
-7633
lines changed

9 files changed

+6455
-7633
lines changed

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-authorization/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"api-builder"
1010
],
1111
"engines": {
12-
"node": ">= 12.15"
12+
"node": ">= 12"
1313
},
1414
"main": "src/index.js",
1515
"files": [

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-axway-api-management/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"api-builder"
1010
],
1111
"engines": {
12-
"node": ">= 12.15"
12+
"node": ">= 12"
1313
},
1414
"main": "src/index.js",
1515
"files": [

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-elk-solution-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"api-builder"
1010
],
1111
"engines": {
12-
"node": ">= 12.15"
12+
"node": ">= 12"
1313
},
1414
"main": "src/index.js",
1515
"files": [

apibuilder4elastic/custom_flow_nodes/api-builder-plugin-traffic-monitor-api-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"api-builder"
1010
],
1111
"engines": {
12-
"node": ">= 12.15"
12+
"node": ">= 12"
1313
},
1414
"main": "src/index.js",
1515
"files": [

apibuilder4elastic/flows/trafficMonitorApi-circuitpath.json

Lines changed: 19 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,13 @@
109109
"name": "data",
110110
"type": "jsonpath",
111111
"value": "$.elasticsearch.result.body.hits",
112-
"metaName": "data",
113-
"metaDescription": "The value to apply as the `data` argument to the JavaScript code. For objects and arrays, `data` is passed by reference."
112+
"metaName": "Data",
113+
"metaDescription": "The value to apply as the `data` argument of the JavaScript code. For objects and arrays, `data` is passed by reference."
114114
},
115115
{
116116
"name": "code",
117117
"type": "string",
118-
"value": "\"let result = [];\\n //console.log(data);\\n \\n if(typeof data.hits[0] != \\\"undefined\\\"){\\n \\tresult = data.hits[0]._source.circuitPath;\\n }\\n \\n return result;\"",
119-
"metaName": "code",
120-
"metaDescription": "A JavaScript function body. Supports `await` and returning promises."
118+
"value": "\"let result = [];\\n //console.log(data);\\n \\n if(typeof data.hits[0] != \\\"undefined\\\"){\\n var source = data.hits[0]._source;\\n if(source.circuitPath) {\\n return source.circuitPath;\\n } else {\\n logger.warn(`Unexpectedly no CircuitPath information found for API request: '${source.correlationId}'`);\\n return [];\\n }\\n }\""
121119
}
122120
],
123121
"outputs": {
@@ -147,15 +145,15 @@
147145
"name": "data",
148146
"type": "jsonpath",
149147
"value": "$",
150-
"metaName": "data",
151-
"metaDescription": "The value to apply as the `data` argument to the JavaScript code. For objects and arrays, `data` is passed by reference."
148+
"metaName": "Data",
149+
"metaDescription": "The value to apply as the `data` argument of the JavaScript code. For objects and arrays, `data` is passed by reference."
152150
},
153151
{
154152
"name": "code",
155153
"type": "string",
156154
"value": "\"// Perhaps there is a region given\\n let region = data.params.region;\\n let index = 'apigw-traffic-details';\\n // Atach the region if given\\n if(region) {\\n index = `${index}-${region.toLowerCase()}`;\\n }\\n index = `${index}-*`;\\n \\n if(data.config.testElasticIndex) {\\n index = data.config.testElasticIndex;\\n }\\n return index;\"",
157-
"metaName": "code",
158-
"metaDescription": "A JavaScript function body. Supports `await` and returning promises."
155+
"metaName": "Code",
156+
"metaDescription": "A JavaScript function body. Supports `await` and returning promises. `data` is the value of the Data parameter. `logger` is the API Builder logger. See the docs for more info: https://docs.axway.com/bundle/API_Builder_4x_allOS_en/page/javascript_flow-node.html"
159157
}
160158
],
161159
"outputs": {
@@ -176,42 +174,6 @@
176174
},
177175
"metaMethod": "Execute"
178176
},
179-
"javascript.3": {
180-
"type": "nodehandler://@axway/api-builder-plugin-fn-javascript/javascript",
181-
"name": "Build Circuitpath Query",
182-
"method": "Execute",
183-
"parameters": [
184-
{
185-
"name": "data",
186-
"type": "jsonpath",
187-
"value": "$",
188-
"metaName": "data",
189-
"metaDescription": "The value to apply as the `data` argument to the JavaScript code. For objects and arrays, `data` is passed by reference."
190-
},
191-
{
192-
"name": "code",
193-
"type": "string",
194-
"value": "\"let elasticQuery = ({\\n \\\"bool\\\": {\\n \\\"must\\\": [\\n {\\n \\\"term\\\": {\\n \\\"correlationId\\\": data.params.correlationID\\n }\\n },\\n {\\n \\\"term\\\": {\\n \\\"processInfo.serviceId\\\": data.params.serviceID\\n }\\n }\\n ]\\n }\\n });\\n if (data.user.gatewayManager.isUnrestricted || data.authzConfig.enableUserAuthorization == false) {\\n return elasticQuery;\\n }\\n\\n var orgFilter;\\n if (data.user.apiManager.role == \\\"admin\\\") {\\n orgFilter = {\\n exists: {\\n \\\"field\\\": \\\"transactionSummary.serviceContext\\\"\\n }\\n };\\n } else {\\n orgFilter = {\\n term: {\\n \\\"transactionSummary.serviceContext.apiOrg\\\": data.user.apiManager.organizationName\\n }\\n };\\n }\\n elasticQuery.bool.must.push(orgFilter);\\n\\n return elasticQuery;\"",
195-
"metaName": "code",
196-
"metaDescription": "A JavaScript function body. Supports `await` and returning promises."
197-
}
198-
],
199-
"outputs": {
200-
"next": {
201-
"context": "$.elasticQuery",
202-
"routes": [],
203-
"metaName": "Next"
204-
},
205-
"error": {
206-
"context": "$.error",
207-
"routes": [
208-
"http.1"
209-
],
210-
"metaName": "Error"
211-
}
212-
},
213-
"metaMethod": "Execute"
214-
},
215177
"http.1": {
216178
"type": "nodehandler://axway-flow/http",
217179
"name": "HTTP 500 Error",
@@ -345,7 +307,9 @@
345307
{
346308
"name": "gatewayTopology",
347309
"type": "jsonpath",
348-
"value": "$.gatewayTopology"
310+
"value": "$.gatewayTopology",
311+
"metaName": "API-Gateway Topology",
312+
"metaDescription": "The API-Gateway topology as read by flow-node: axway-api-management->lookupTopology"
349313
}
350314
],
351315
"outputs": {
@@ -559,23 +523,28 @@
559523
{
560524
"name": "requestHeaders",
561525
"type": "jsonpath",
562-
"value": "$.request.headers"
526+
"value": "$.request.headers",
527+
"metaName": "Request Headers",
528+
"metaDescription": "The request headers are used to lookup the topology using the currently logged in user."
563529
}
564530
],
565531
"outputs": {
566532
"next": {
567533
"routes": [
568534
"javascript.2"
569535
],
570-
"context": "$.gatewayTopology"
536+
"context": "$.gatewayTopology",
537+
"metaName": "Next"
571538
},
572539
"error": {
573540
"routes": [
574541
"http.1"
575542
],
576-
"context": "$.error"
543+
"context": "$.error",
544+
"metaName": "Error"
577545
}
578-
}
546+
},
547+
"metaMethod": "Lookup topology"
579548
}
580549
}
581550
}

apibuilder4elastic/flows/trafficMonitorApi-search.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,6 @@
117117
"name": "Format result",
118118
"method": "Execute",
119119
"parameters": [
120-
{
121-
"name": "unsafe",
122-
"type": "boolean",
123-
"value": "false",
124-
"metaName": "Unsafe mode",
125-
"metaDescription": "USE WITH CAUTION. When enabled, JavaScript is not executed in a sandboxed environment and all globals are available."
126-
},
127120
{
128121
"name": "data",
129122
"type": "jsonpath",

apibuilder4elastic/flows/trafficMonitorApi-trace.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,6 @@
228228
"value": "\"//only json is supported. \\n //If param format is skipped automatically json is returned\\n if(data.params.format != undefined && data.params.format != 'json') {\\n throw {\\n name: \\\"unknown format exception\\\",\\n message: \\\"unknown format\\\"\\n };\\n }\"",
229229
"metaName": "code",
230230
"metaDescription": "A JavaScript function body. Supports `await` and returning promises."
231-
},
232-
{
233-
"name": "unsafe",
234-
"type": "boolean",
235-
"value": "true",
236-
"metaName": "Unsafe mode",
237-
"metaDescription": "USE WITH CAUTION. When enabled, JavaScript is not executed in a sandboxed environment and all globals are available."
238231
}
239232
],
240233
"outputs": {

0 commit comments

Comments
 (0)