nodehandler-utils
v4.3.11
Published
nodehandler utils
Downloads
438
Readme
nodehandler-utils
nodehandler utils
API Reference
Example (Quick start)
const { NodeHandlerUtils } = require('nodehandler-utils');
const { FlowManager } = require('axway-flow');
const uri = FlowManager.formatNodeHandlerUri('service-connector', 'thing');
const swagger = require('./thing.json');
const schemas = NodeHandlerUtils.exportSchemas(swagger, 'thing');
const spec = NodeHandlerUtils.swaggerToNodeHandlerSpec(swagger, 'thing', uri, 'thing-icon');
const icon = NodeHandlerUtils.loadIcon('icon.png');
nodehandler-utils~NodeHandlerUtils
Node handler utils
Kind: inner class of nodehandler-utils Access: public
- ~NodeHandlerUtils
- .getSwaggerMethodAsProperties(swagger, name, verb, path) ⇒ object
- .swaggerToNodeHandlerSpec(swagger, scope, uri, [icon]) ⇒ object
- .exportSchemas(swagger, scope) ⇒ array
- .loadIcon(file) ⇒ Promise.<string>
- .formatNodeHandlerUri(module, type) ⇒ string
NodeHandlerUtils.getSwaggerMethodAsProperties(swagger, name, verb, path) ⇒ object
Converts the swagger parameters to json-schema properties.
Kind: static method of NodeHandlerUtils Returns: object - schema property Access: public
| Param | Type | Description | | --- | --- | --- | | swagger | object | swagger doc | | name | string | The name of the node handler | | verb | object | the method verb | | path | object | the method path under swagger.paths |
NodeHandlerUtils.swaggerToNodeHandlerSpec(swagger, scope, uri, [icon]) ⇒ object
Converts a swagger definition to a flow-node spec. The uri
uniquely identifies
the flow-node, e.g. nodehandler://service-connector/foo (see FlowManager.formatNodeHandlerUri
).
Kind: static method of NodeHandlerUtils Returns: object - flow-node spec Access: public
| Param | Type | Description |
| --- | --- | --- |
| swagger | object | The swagger document to convert |
| scope | string | The flow-node scope used in schema references |
| uri | string | The unique uri of the flow-node |
| [icon] | string | The flow-node's icon (defaults to glyphicon-link
). |
NodeHandlerUtils.exportSchemas(swagger, scope) ⇒ array
Exports schema from a swagger document. Before returning, all of the references are rewritten to an axway-schema type reference, and identifiers are applied to each schema.
Kind: static method of NodeHandlerUtils Returns: array - An array of schemas. Access: public
| Param | Type | Description | | --- | --- | --- | | swagger | object | The swagger document to use to register schemas | | scope | string | The flow-node scope used in schema references |
NodeHandlerUtils.loadIcon(file) ⇒ Promise.<string>
Loads an icon file and returns it as a data URI. Supports bmp, jpeg, jpg, png, gif, tiff, and svg.
Kind: static method of NodeHandlerUtils Returns: Promise.<string> - The icon data URI.
| Param | Type | Description | | --- | --- | --- | | file | string | The icon file to load. |
NodeHandlerUtils.formatNodeHandlerUri(module, type) ⇒ string
Formats a nodehandler URI.
Kind: static method of NodeHandlerUtils Returns: string - The formatted URI.
| Param | Type | Description | | --- | --- | --- | | module | string | A module name for scope, e.g. "twilio". | | type | string | A simple URL safe type name, e.g. "echo". |
nodehandler-utils~generateFunctionName(swpath, method) ⇒ string
Method to create custom operationID-like operation id. Taken from connectors team NOTE: duplicated from code from arrow-admin-api/src/util.js,
Kind: inner method of nodehandler-utils Returns: string - The custom operationID
| Param | Type | Description | | --- | --- | --- | | swpath | string | The swagger path (eg. /thing) | | method | string | The swagger method/verb (eg. "GET") |
Building
npm run build
Author
Axway [email protected] https://axway.com
Changes
4.3.10
- #6116: Internal cleanup chore.
4.3.9
- #6114: Refactor code for style, security and performance improvements.
4.3.8
- #6074: Internal CI chore
4.3.7
- #5711: Internal cleanup of npm scripts.
4.3.6
- #5708: Internal changes to get rid of generating readme if unnecesarry.
4.3.5
- #5708: Internal changes to update mocha configuration.
4.3.4
- #5707: Internal cleanup to code coverage during build process.
4.3.3
- #5552: Exported metadata contains only methods metadata and no longer contains URI metadata.
####4.3.2
- #5653: Added integration test case for Swagger with circular references.
####4.3.1
- #5622: Update documentation for "Decode Response" parameter.
4.3.0
- #5630: Add support for
multipart/form-data
inContent Type
parameter.multipart/form-data
will be prioritised as a default value if the Swagger method hasformData
fields of typefile
. - #5630: Add an enum property choice of
application/wwww-form-urlencoded
andmultipart/form-data
toContent Type
parameters when Swagger method hasformData
parameters which are not typefile
and do not defineconsumes
. - #5630: Change the default value for
Content Type
parameters toapplication/wwww-form-urlencoded
, falling back tomultipart/form-data
and then the firstconsumes
value when either values exist inside the Swagger method'sconsumes
. - #5640: Fix issue where charset is stripped from the default value for
Content Type
parameters in some cases.
4.2.0
- #5432: It now adds additional information for
formData
parameters while converting the swagger parameters to json-schema properties
4.1.0
- #5432: It now respects swagger
consumes
andproduces
properties while converting swagger definitions to flow node specs
4.0.0
- #4919: Now exports spec and metadata
- #4918: Breaking Change: Adds authorizations to the spec
- #5358: Breaking Change: A
Default
output is created for all flow-nodes regardless of the swagger definition. - #5358: Breaking Change: An
Error
output is created for all flow-nodes to allow routing on connection errors. - #5358: The default JSONPath selector for all outputs is now
$.response
. Only the Error output defaults to$.error
.
3.0.11
- #5111: Fixed bug where swagger documents with extensions in the same location as path methods failed to load correctly.
3.0.10
- #5112: Previously, schemas generated from a swagger document with no "definitions" section was returned as
undefined
. Now, an empty array will be returned instead.
3.0.3
- #4757: Changed SCM repository and associated internal cleanup.
- #4860: Previously, api-builder-plugin-fn-swagger would throw "Error: Invalid reference token" when attempting to handle URI encoded JSON schema references in Swagger files. Now, invalid reference errors are not thrown.
License
This code is proprietary, closed source software licensed to you by Axway. All Rights Reserved. You may not modify Axway’s code without express written permission of Axway. You are licensed to use and distribute your services developed with the use of this software and dependencies, including distributing reasonable and appropriate portions of the Axway code and dependencies. Except as set forth above, this code MUST not be copied or otherwise redistributed without express written permission of Axway. This module is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement (General Conditions) located here: https://support.axway.com/en/auth/general-conditions; EXCEPT THAT IF YOU RECEIVED A FREE SUBSCRIPTION, LICENSE, OR SUPPORT SUBSCRIPTION FOR THIS CODE, NOTWITHSTANDING THE LANGUAGE OF THE GENERAL CONDITIONS, AXWAY HEREBY DISCLAIMS ALL SUPPORT AND MAINTENANCE OBLIGATIONS, AS WELL AS ALL EXPRESS AND IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO IMPLIED INFRINGEMENT WARRANTIES, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, AND YOU ACCEPT THE PRODUCT AS-IS AND WITH ALL FAULTS, SOLELY AT YOUR OWN RISK. Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.