axway-flow-sdk
Advanced tools
Comparing version 2.0.17 to 3.0.0
{ | ||
"name": "axway-flow-sdk", | ||
"version": "2.0.17", | ||
"version": "3.0.0", | ||
"description": "SDK for implementing custom flow nodes for API Builder flows", | ||
@@ -35,3 +35,3 @@ "homepage": "https://platform.axway.com", | ||
"ajv": "^5.3.0", | ||
"axway-flow-schema": "^2.0.0", | ||
"axway-flow-schema": "^5.0.0", | ||
"dot": "^1.1.2", | ||
@@ -42,3 +42,3 @@ "nomnom": "^1.8.1", | ||
"devDependencies": { | ||
"axway-flow": "^3.0.0" | ||
"axway-flow": "^5.0.0" | ||
}, | ||
@@ -63,3 +63,3 @@ "repository": { | ||
}, | ||
"gitHead": "4acfad047f2c6a2274d7ab9192764a4f6ccc5581" | ||
"gitHead": "14870247a219c1d73855e722f063954e46913c49" | ||
} |
@@ -156,2 +156,3 @@ # axway-flow-sdk | ||
* [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code> | ||
* [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code> | ||
* [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code> | ||
@@ -237,2 +238,20 @@ * [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code> | ||
``` | ||
<a name="module_axway-flow-sdk..NodeBuilder+group"></a> | ||
#### nodeBuilder.group(name) ⇒ <code>NodeBuilder</code> | ||
**Kind**: instance method of [<code>NodeBuilder</code>](#module_axway-flow-sdk..NodeBuilder) | ||
**Returns**: <code>NodeBuilder</code> - The current object (this). | ||
**Access**: public | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| name | <code>string</code> | A unique name for the parameter group as it will appear in the UI. | | ||
**Example** | ||
```js | ||
sdk.init(module).add('encodeURI', { icon: 'encode.svg' }) | ||
.method('encode', { name: 'Encode URI' }) | ||
.group('Advanced') | ||
.parameter('uri', { type: 'string' }); | ||
``` | ||
<a name="module_axway-flow-sdk..NodeBuilder+parameter"></a> | ||
@@ -380,4 +399,8 @@ | ||
## Changes | ||
#### 2.0.0 | ||
- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta | ||
- #5436: Moves advanced HTTP options into a new group, "Advanced HTTP Options" | ||
#### axway-flow-sdk@2.0.9 | ||
- RDPP-4757: Changed SCM repository and associated internal cleanup. | ||
- #4757: Changed SCM repository and associated internal cleanup. | ||
@@ -384,0 +407,0 @@ ## License |
@@ -1,2 +0,2 @@ | ||
const { v2: flowschema } = require('axway-flow-schema'); | ||
const axwayFlowSchema = require('axway-flow-schema'); | ||
const fs = require('fs'); | ||
@@ -56,2 +56,3 @@ const Ajv = require('ajv'); | ||
this._method = null; | ||
this._group = null; | ||
return this; | ||
@@ -109,3 +110,3 @@ } | ||
this.flownodes[key] = { | ||
schemaVersion: '1', | ||
schemaVersion: '2', | ||
name: options.name || key, | ||
@@ -200,2 +201,3 @@ type: 'nodehandler://', // This is updated by API Builder on load | ||
} | ||
this._group = null; | ||
this._method = key; | ||
@@ -206,2 +208,31 @@ return this; | ||
/** | ||
* @public | ||
* @param {string} name - A unique name for the parameter group as it will appear in the UI. | ||
* @return {NodeBuilder} The current object (this). | ||
* @example | ||
* sdk.init(module).add('encodeURI', { icon: 'encode.svg' }) | ||
* .method('encode', { name: 'Encode URI' }) | ||
* .group('Advanced') | ||
* .parameter('uri', { type: 'string' }); | ||
*/ | ||
group(name) { | ||
if (!this._name) { | ||
throw new Error('need to start a flow-node using: `node`'); | ||
} | ||
if (!this._method) { | ||
throw new Error('need to start a method using: `method`'); | ||
} | ||
if (!name) { | ||
throw new Error('missing required parameter: name'); | ||
} | ||
// Note that 'Authorization' is prohibited for now because we we want to be able to use | ||
// it later for flow-node Authorization group. | ||
if ([ '_group', 'Authorization' ].includes(name)) { | ||
throw new Error(`invalid group name: ${name}`); | ||
} | ||
this._group = name; | ||
return this; | ||
} | ||
/** | ||
* Adds a new parameter to the current method. Any number of parameters can be added to a method. | ||
@@ -242,2 +273,6 @@ * | ||
ajv.addFormat('multiline', () => true); | ||
if (this._group) { | ||
// add parameter group | ||
schema.group = this._group; | ||
} | ||
ajv.compile(schema); | ||
@@ -391,10 +426,12 @@ | ||
const ajv = new Ajv({ unknownFormats: 'ignore' }); | ||
ajv.addSchema(flowschema); | ||
ajv.addSchema(axwayFlowSchema.flownode.v1); | ||
ajv.addSchema(axwayFlowSchema.flownode.v2); | ||
ajv.addSchema(axwayFlowSchema.flownode.all); | ||
// Validate the flownode | ||
const schemaValidate = ajv.getSchema( | ||
'http://axway.com/schemas/flowschema.json#/node-handler-schema' | ||
); | ||
const schemaValidate = ajv.getSchema('http://axway.com/schemas/flownode.json'); | ||
if (!schemaValidate(flownode)) { | ||
// clone and strip off all the `action` functions | ||
const clone = JSON.parse(JSON.stringify(flownode)); | ||
if (!schemaValidate(clone)) { | ||
const errMsg = schemaValidate.errors.map(err => { | ||
@@ -401,0 +438,0 @@ const dataPath = err.dataPath ? `$${err.dataPath}` : 'node-handler-schema root'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47142
566
407
+ Addedaxway-flow-schema@5.4.3(transitive)
- Removedaxway-flow-schema@2.0.0(transitive)
Updatedaxway-flow-schema@^5.0.0