axway-flow-sdk
Advanced tools
Comparing version 3.1.11 to 3.2.0
{ | ||
"name": "axway-flow-sdk", | ||
"version": "3.1.11", | ||
"version": "3.2.0", | ||
"description": "SDK for implementing custom flow nodes for API Builder flows", | ||
@@ -51,6 +51,5 @@ "homepage": "https://platform.axway.com", | ||
"per-file": false, | ||
"statements": 94, | ||
"functions": 96, | ||
"branches": 86, | ||
"lines": 95 | ||
"statements": 95.59, | ||
"branches": 88.32, | ||
"lines": 95.59 | ||
}, | ||
@@ -66,3 +65,3 @@ "scripts": { | ||
}, | ||
"gitHead": "1d637e21932a24fd9d856520f486e34194ad6c31" | ||
"gitHead": "5aa8e8a3c1378beef2e233f8c5358690cdc6afb8" | ||
} |
@@ -157,3 +157,3 @@ # axway-flow-sdk | ||
* [.group(name)](#module_axway-flow-sdk..NodeBuilder+group) ⇒ <code>NodeBuilder</code> | ||
* [.parameter(name, schema, [required])](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code> | ||
* [.parameter(name, schema, options)](#module_axway-flow-sdk..NodeBuilder+parameter) ⇒ <code>NodeBuilder</code> | ||
* [.output(key, [options])](#module_axway-flow-sdk..NodeBuilder+output) ⇒ <code>NodeBuilder</code> | ||
@@ -265,3 +265,3 @@ * [.action(handler)](#module_axway-flow-sdk..NodeBuilder+action) ⇒ <code>NodeBuilder</code> | ||
#### nodeBuilder.parameter(name, schema, [required]) ⇒ <code>NodeBuilder</code> | ||
#### nodeBuilder.parameter(name, schema, options) ⇒ <code>NodeBuilder</code> | ||
Adds a new parameter to the current method. Any number of parameters can be added to a method. | ||
@@ -281,7 +281,12 @@ | ||
| Param | Type | Default | Description | | ||
| --- | --- | --- | --- | | ||
| name | <code>string</code> | | A unique name for the parameter as it will appear in the UI. | | ||
| schema | <code>object</code> | | A schema used to validate the parameter. | | ||
| [required] | <code>boolean</code> | <code>true</code> | A flag to indicate the parameter is required or optional. | | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| name | <code>string</code> | A unique name for the parameter as it will appear in the UI. | | ||
| schema | <code>object</code> | A schema used to validate the parameter. | | ||
| options | <code>object</code> \| <code>boolean</code> | As an object, specifies additional options to configure the parameter. As a boolean, specifies that the parameter is required. Parameters are required by default. | | ||
| options.required | <code>boolean</code> | specifies that the parameter is required. Parameters are required by default. | | ||
| options.multilineWrapper | <code>object</code> | object that holds the before and after parts that surrounds user provided value in the UI. | | ||
| options.multilineWrapper.before | <code>string</code> | string that is placed before the user provided value in the UI. | | ||
| options.multilineWrapper.after | <code>string</code> | string that is placed after the user provided value in the UI. | | ||
| options.initialType | <code>string</code> | autoselects the input type of the field in the ui | | ||
@@ -403,4 +408,16 @@ **Example** | ||
``` | ||
<a name="module_axway-flow-sdk..getSelectedOptions"></a> | ||
### axway-flow-sdk~getSelectedOptions(options) ⇒ <code>object</code> | ||
Add user provided option to the parameter schema. | ||
**Kind**: inner method of [<code>axway-flow-sdk</code>](#module_axway-flow-sdk) | ||
**Returns**: <code>object</code> - selected options and a flag that is set to true if there are selected options. | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| options | <code>object</code> | Specifies additional options to configure the parameter. | | ||
# Author | ||
@@ -413,2 +430,7 @@ | ||
#### 3.2.0 | ||
- #5891: Added alternative way to define parameter options. Instead of `false` as a third argument to `.parameter()`, an object can be provided as `{ required: false }`. | ||
- #5891: Added support for defining wrapper text for multiline and javascript format parameters. This wrapper text will be displayed in the parameter editor but will not be part of the value when saved in the flow. | ||
This is useful for when context or comments are needed. | ||
#### 3.1.11 | ||
@@ -418,3 +440,3 @@ - #5923: Fixes for both the README.md not being published and the wrong .README.md template. | ||
#### 3.1.10 | ||
- #5914: Internal changes adding README.md generation. | ||
- #5914: Internal change to re-introduce readme generation from JSDoc. | ||
@@ -452,3 +474,3 @@ #### 3.1.9 | ||
#### axway-flow-sdk@2.0.9 | ||
#### 2.0.9 | ||
- #4757: Changed SCM repository and associated internal cleanup. | ||
@@ -455,0 +477,0 @@ |
@@ -268,3 +268,10 @@ const axwayFlowSchema = require('axway-flow-schema'); | ||
* @param {object} schema - A schema used to validate the parameter. | ||
* @param {boolean} [required=true] - A flag to indicate the parameter is required or optional. | ||
* @param {object|boolean} options - As an object, specifies additional options to configure the parameter. | ||
* As a boolean, specifies that the parameter is required. Parameters are required by default. | ||
* @param {boolean} options.required - specifies that the parameter is required. Parameters are required by default. | ||
* @param {object} options.multilineWrapper - object that holds the before and after parts that surrounds user provided value in the UI. | ||
* @param {string} options.multilineWrapper.before - string that is placed before the user provided value in the UI. | ||
* @param {string} options.multilineWrapper.after - string that is placed after the user provided value in the UI. | ||
* @param {string} options.initialType - autoselects the input type of the field in the ui | ||
* @return {NodeBuilder} The current object (this). | ||
@@ -276,3 +283,3 @@ * @example | ||
*/ | ||
parameter(name, schema, required = true) { | ||
parameter(name, schema, options) { | ||
if (!this._name) { | ||
@@ -290,9 +297,33 @@ throw new Error('need to start a flow-node using: `node`'); | ||
} | ||
// Seperate options and required | ||
let required = true; | ||
if (typeof options === 'boolean') { | ||
// Use case where we provide true or false directly | ||
required = options; | ||
} else if (typeof options === 'object') { | ||
// Use case where options object is provided | ||
if (options.required !== undefined) { | ||
required = options.required; | ||
} | ||
// Create schema.options with allowed options | ||
for (const option of [ 'multilineWrapper' ]) { | ||
if (options[option] !== undefined) { | ||
// only initialise schema.options if we have something to add | ||
schema.options = schema.options || {}; | ||
schema.options[option] = options[option]; | ||
} | ||
} | ||
} | ||
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.addFormat('multiline', /* istanbul ignore next */ () => true); | ||
ajv.addFormat('javascript', /* istanbul ignore next */ () => true); | ||
ajv.compile(schema); | ||
@@ -305,2 +336,3 @@ } | ||
} | ||
return this; | ||
@@ -500,2 +532,3 @@ } | ||
} | ||
exports = module.exports = { | ||
@@ -502,0 +535,0 @@ init, |
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
51908
708
474