axway-flow-sdk
Advanced tools
Comparing version 3.0.0 to 3.1.0
{ | ||
"name": "axway-flow-sdk", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "SDK for implementing custom flow nodes for API Builder flows", | ||
@@ -56,3 +56,3 @@ "homepage": "https://platform.axway.com", | ||
"test:watch": "npm test -- --watch", | ||
"posttest": "nyc check-coverage --lines 80 --branches 80 --functions 80", | ||
"posttest": "nyc check-coverage --lines 95 --branches 86 --functions 97 --statements 95", | ||
"check:dependencies": "npm run check:used && npm run check:unused", | ||
@@ -62,3 +62,3 @@ "check:used": "dependency-check ./package.json", | ||
}, | ||
"gitHead": "14870247a219c1d73855e722f063954e46913c49" | ||
"gitHead": "b47efa1af61f664e6677858f224f864248ebf126" | ||
} |
@@ -153,3 +153,3 @@ # axway-flow-sdk | ||
* [~NodeBuilder](#module_axway-flow-sdk..NodeBuilder) | ||
* [new NodeBuilder(srcModule)](#new_module_axway-flow-sdk..NodeBuilder_new) | ||
* [new NodeBuilder(srcModule, [options])](#new_module_axway-flow-sdk..NodeBuilder_new) | ||
* [.add(key, [options])](#module_axway-flow-sdk..NodeBuilder+add) ⇒ <code>NodeBuilder</code> | ||
@@ -164,7 +164,9 @@ * [.method(key, [options])](#module_axway-flow-sdk..NodeBuilder+method) ⇒ <code>NodeBuilder</code> | ||
#### new NodeBuilder(srcModule) | ||
#### new NodeBuilder(srcModule, [options]) | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| srcModule | <code>object</code> | a node module | | ||
| Param | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| srcModule | <code>object</code> | | a node module | | ||
| [options] | <code>object</code> | | The options for the builder. | | ||
| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation. Disable if you need to use refs. | | ||
@@ -239,2 +241,7 @@ <a name="module_axway-flow-sdk..NodeBuilder+add"></a> | ||
``` | ||
**Example** *(Disable validation)* | ||
```js | ||
sdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' }) | ||
.method('encode', { $ref: '#/definitions/foo' }); | ||
``` | ||
<a name="module_axway-flow-sdk..NodeBuilder+group"></a> | ||
@@ -353,3 +360,3 @@ | ||
### axway-flow-sdk~init(module) ⇒ <code>NodeBuilder</code> | ||
### axway-flow-sdk~init(module, [options]) ⇒ <code>NodeBuilder</code> | ||
Axway API Builder SDK for creating custom nodes to work with flows. | ||
@@ -361,5 +368,7 @@ | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| module | <code>object</code> | The node module. | | ||
| Param | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| module | <code>object</code> | | The node module. | | ||
| [options] | <code>object</code> | | The options for the builder. | | ||
| [options.validate] | <code>object</code> | <code>true</code> | The enables parameter validation. Disable if you need to use refs. | | ||
@@ -402,3 +411,6 @@ **Example** | ||
## Changes | ||
#### 2.0.0 | ||
#### 3.1.0 | ||
- #5600: Support schema references by disabling validation when building flow-nodes. | ||
#### 3.0.0 | ||
- #5436: Breaking Change: Minimum supported version of API Builder is now Jakarta | ||
@@ -405,0 +417,0 @@ - #5436: Moves advanced HTTP options into a new group, "Advanced HTTP Options" |
@@ -17,5 +17,8 @@ const axwayFlowSchema = require('axway-flow-schema'); | ||
* @param {object} srcModule - a node module | ||
* @param {object} [options] - The options for the builder. | ||
* @param {object} [options.validate=true] - The enables parameter validation. Disable | ||
* if you need to use refs. | ||
* @private | ||
*/ | ||
constructor(srcModule) { | ||
constructor(srcModule, options = { validate: true }) { | ||
if (!srcModule) { | ||
@@ -26,4 +29,19 @@ throw new Error('expected a node module'); | ||
this.clear(); | ||
this.setOptions(options); | ||
} | ||
/** | ||
* Sets options for the builder. | ||
* | ||
* @private | ||
* @param {object} [options] - The options for the builder. | ||
* @param {object} [options.validate=true] - The enables parameter validation. Disable | ||
* if you need to use refs. | ||
*/ | ||
setOptions(options) { | ||
if (options && options.validate !== undefined) { | ||
this._validate = !!options.validate; | ||
} | ||
} | ||
_package(srcModule) { | ||
@@ -174,2 +192,5 @@ // find the package.json | ||
* .method('encode', { name: 'Encode URI' }); | ||
* @example <caption>Disable validation</caption> | ||
* sdk.init(module, { validation: false }).add('encodeURI', { icon: 'encode.svg' }) | ||
* .method('encode', { $ref: '#/definitions/foo' }); | ||
*/ | ||
@@ -270,9 +291,11 @@ method(key, options = {}) { | ||
} | ||
const ajv = new Ajv({ unknownFormats: 'ignore' }); | ||
ajv.addFormat('multiline', () => true); | ||
if (this._group) { | ||
// add parameter group | ||
schema.group = this._group; | ||
if (this._validate) { | ||
const ajv = new Ajv({ unknownFormats: 'ignore' }); | ||
ajv.addFormat('multiline', () => true); | ||
if (this._group) { | ||
// add parameter group | ||
schema.group = this._group; | ||
} | ||
ajv.compile(schema); | ||
} | ||
ajv.compile(schema); | ||
@@ -411,3 +434,8 @@ this.flownodes[this._name].methods[this._method].parameter.properties[name] = schema; | ||
* @typicalname init | ||
* | ||
* @param {object} module - The node module. | ||
* @param {object} [options] - The options for the builder. | ||
* @param {object} [options.validate=true] - The enables parameter validation. Disable | ||
* if you need to use refs. | ||
* | ||
* @return {NodeBuilder} A newly constructed | ||
@@ -420,4 +448,4 @@ * {@link module:axway-flow-sdk~NodeBuilder `NodeBuilder`} object | ||
*/ | ||
function init(module) { | ||
return new NodeBuilder(module); | ||
function init(module, options = { validate: true }) { | ||
return new NodeBuilder(module, options); | ||
} | ||
@@ -424,0 +452,0 @@ |
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
48962
593
419